Last active
January 9, 2024 08:56
-
-
Save jcppman/201a13ff58b314fccdcbe6271f48b739 to your computer and use it in GitHub Desktop.
XSY
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(factory) { | |
typeof define === "function" && define.amd ? define(factory) : factory(); | |
})(function() { | |
"use strict"; | |
function makeMap(str, expectsLowerCase) { | |
const map = /* @__PURE__ */ Object.create(null); | |
const list = str.split(","); | |
for (let i = 0; i < list.length; i++) { | |
map[list[i]] = true; | |
} | |
return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val]; | |
} | |
const EMPTY_OBJ = {}; | |
const EMPTY_ARR = []; | |
const NOOP = () => { | |
}; | |
const NO = () => false; | |
const onRE = /^on[^a-z]/; | |
const isOn = (key) => onRE.test(key); | |
const isModelListener = (key) => key.startsWith("onUpdate:"); | |
const extend = Object.assign; | |
const remove = (arr, el) => { | |
const i = arr.indexOf(el); | |
if (i > -1) { | |
arr.splice(i, 1); | |
} | |
}; | |
const hasOwnProperty$1 = Object.prototype.hasOwnProperty; | |
const hasOwn = (val, key) => hasOwnProperty$1.call(val, key); | |
const isArray$1 = Array.isArray; | |
const isMap = (val) => toTypeString(val) === "[object Map]"; | |
const isSet = (val) => toTypeString(val) === "[object Set]"; | |
const isFunction = (val) => typeof val === "function"; | |
const isString = (val) => typeof val === "string"; | |
const isSymbol = (val) => typeof val === "symbol"; | |
const isObject = (val) => val !== null && typeof val === "object"; | |
const isPromise = (val) => { | |
return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch); | |
}; | |
const objectToString = Object.prototype.toString; | |
const toTypeString = (value) => objectToString.call(value); | |
const toRawType = (value) => { | |
return toTypeString(value).slice(8, -1); | |
}; | |
const isPlainObject = (val) => toTypeString(val) === "[object Object]"; | |
const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key; | |
const isReservedProp = /* @__PURE__ */ makeMap( | |
// the leading comma is intentional so empty string "" is also included | |
",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted" | |
); | |
const cacheStringFunction = (fn) => { | |
const cache = /* @__PURE__ */ Object.create(null); | |
return (str) => { | |
const hit = cache[str]; | |
return hit || (cache[str] = fn(str)); | |
}; | |
}; | |
const camelizeRE = /-(\w)/g; | |
const camelize = cacheStringFunction((str) => { | |
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : ""); | |
}); | |
const hyphenateRE = /\B([A-Z])/g; | |
const hyphenate = cacheStringFunction( | |
(str) => str.replace(hyphenateRE, "-$1").toLowerCase() | |
); | |
const capitalize = cacheStringFunction((str) => { | |
return str.charAt(0).toUpperCase() + str.slice(1); | |
}); | |
const toHandlerKey = cacheStringFunction((str) => { | |
const s = str ? `on${capitalize(str)}` : ``; | |
return s; | |
}); | |
const hasChanged = (value, oldValue) => !Object.is(value, oldValue); | |
const invokeArrayFns = (fns, arg) => { | |
for (let i = 0; i < fns.length; i++) { | |
fns[i](arg); | |
} | |
}; | |
const def = (obj, key, value) => { | |
Object.defineProperty(obj, key, { | |
configurable: true, | |
enumerable: false, | |
value | |
}); | |
}; | |
const looseToNumber = (val) => { | |
const n = parseFloat(val); | |
return isNaN(n) ? val : n; | |
}; | |
const toNumber = (val) => { | |
const n = isString(val) ? Number(val) : NaN; | |
return isNaN(n) ? val : n; | |
}; | |
let _globalThis; | |
const getGlobalThis$1 = () => { | |
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {}); | |
}; | |
function normalizeStyle(value) { | |
if (isArray$1(value)) { | |
const res = {}; | |
for (let i = 0; i < value.length; i++) { | |
const item = value[i]; | |
const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item); | |
if (normalized) { | |
for (const key in normalized) { | |
res[key] = normalized[key]; | |
} | |
} | |
} | |
return res; | |
} else if (isString(value) || isObject(value)) { | |
return value; | |
} | |
} | |
const listDelimiterRE = /;(?![^(]*\))/g; | |
const propertyDelimiterRE = /:([^]+)/; | |
const styleCommentRE = /\/\*[^]*?\*\//g; | |
function parseStringStyle(cssText) { | |
const ret = {}; | |
cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => { | |
if (item) { | |
const tmp = item.split(propertyDelimiterRE); | |
tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim()); | |
} | |
}); | |
return ret; | |
} | |
function normalizeClass(value) { | |
let res = ""; | |
if (isString(value)) { | |
res = value; | |
} else if (isArray$1(value)) { | |
for (let i = 0; i < value.length; i++) { | |
const normalized = normalizeClass(value[i]); | |
if (normalized) { | |
res += normalized + " "; | |
} | |
} | |
} else if (isObject(value)) { | |
for (const name in value) { | |
if (value[name]) { | |
res += name + " "; | |
} | |
} | |
} | |
return res.trim(); | |
} | |
const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`; | |
const isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs); | |
function includeBooleanAttr(value) { | |
return !!value || value === ""; | |
} | |
const toDisplayString = (val) => { | |
return isString(val) ? val : val == null ? "" : isArray$1(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val); | |
}; | |
const replacer = (_key, val) => { | |
if (val && val.__v_isRef) { | |
return replacer(_key, val.value); | |
} else if (isMap(val)) { | |
return { | |
[`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val2]) => { | |
entries[`${key} =>`] = val2; | |
return entries; | |
}, {}) | |
}; | |
} else if (isSet(val)) { | |
return { | |
[`Set(${val.size})`]: [...val.values()] | |
}; | |
} else if (isObject(val) && !isArray$1(val) && !isPlainObject(val)) { | |
return String(val); | |
} | |
return val; | |
}; | |
let activeEffectScope; | |
class EffectScope { | |
constructor(detached = false) { | |
this.detached = detached; | |
this._active = true; | |
this.effects = []; | |
this.cleanups = []; | |
this.parent = activeEffectScope; | |
if (!detached && activeEffectScope) { | |
this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push( | |
this | |
) - 1; | |
} | |
} | |
get active() { | |
return this._active; | |
} | |
run(fn) { | |
if (this._active) { | |
const currentEffectScope = activeEffectScope; | |
try { | |
activeEffectScope = this; | |
return fn(); | |
} finally { | |
activeEffectScope = currentEffectScope; | |
} | |
} | |
} | |
/** | |
* This should only be called on non-detached scopes | |
* @internal | |
*/ | |
on() { | |
activeEffectScope = this; | |
} | |
/** | |
* This should only be called on non-detached scopes | |
* @internal | |
*/ | |
off() { | |
activeEffectScope = this.parent; | |
} | |
stop(fromParent) { | |
if (this._active) { | |
let i, l; | |
for (i = 0, l = this.effects.length; i < l; i++) { | |
this.effects[i].stop(); | |
} | |
for (i = 0, l = this.cleanups.length; i < l; i++) { | |
this.cleanups[i](); | |
} | |
if (this.scopes) { | |
for (i = 0, l = this.scopes.length; i < l; i++) { | |
this.scopes[i].stop(true); | |
} | |
} | |
if (!this.detached && this.parent && !fromParent) { | |
const last = this.parent.scopes.pop(); | |
if (last && last !== this) { | |
this.parent.scopes[this.index] = last; | |
last.index = this.index; | |
} | |
} | |
this.parent = void 0; | |
this._active = false; | |
} | |
} | |
} | |
function recordEffectScope(effect, scope = activeEffectScope) { | |
if (scope && scope.active) { | |
scope.effects.push(effect); | |
} | |
} | |
function getCurrentScope() { | |
return activeEffectScope; | |
} | |
const createDep = (effects) => { | |
const dep = new Set(effects); | |
dep.w = 0; | |
dep.n = 0; | |
return dep; | |
}; | |
const wasTracked = (dep) => (dep.w & trackOpBit) > 0; | |
const newTracked = (dep) => (dep.n & trackOpBit) > 0; | |
const initDepMarkers = ({ deps }) => { | |
if (deps.length) { | |
for (let i = 0; i < deps.length; i++) { | |
deps[i].w |= trackOpBit; | |
} | |
} | |
}; | |
const finalizeDepMarkers = (effect) => { | |
const { deps } = effect; | |
if (deps.length) { | |
let ptr = 0; | |
for (let i = 0; i < deps.length; i++) { | |
const dep = deps[i]; | |
if (wasTracked(dep) && !newTracked(dep)) { | |
dep.delete(effect); | |
} else { | |
deps[ptr++] = dep; | |
} | |
dep.w &= ~trackOpBit; | |
dep.n &= ~trackOpBit; | |
} | |
deps.length = ptr; | |
} | |
}; | |
const targetMap = /* @__PURE__ */ new WeakMap(); | |
let effectTrackDepth = 0; | |
let trackOpBit = 1; | |
const maxMarkerBits = 30; | |
let activeEffect; | |
const ITERATE_KEY = Symbol(""); | |
const MAP_KEY_ITERATE_KEY = Symbol(""); | |
class ReactiveEffect { | |
constructor(fn, scheduler = null, scope) { | |
this.fn = fn; | |
this.scheduler = scheduler; | |
this.active = true; | |
this.deps = []; | |
this.parent = void 0; | |
recordEffectScope(this, scope); | |
} | |
run() { | |
if (!this.active) { | |
return this.fn(); | |
} | |
let parent = activeEffect; | |
let lastShouldTrack = shouldTrack; | |
while (parent) { | |
if (parent === this) { | |
return; | |
} | |
parent = parent.parent; | |
} | |
try { | |
this.parent = activeEffect; | |
activeEffect = this; | |
shouldTrack = true; | |
trackOpBit = 1 << ++effectTrackDepth; | |
if (effectTrackDepth <= maxMarkerBits) { | |
initDepMarkers(this); | |
} else { | |
cleanupEffect(this); | |
} | |
return this.fn(); | |
} finally { | |
if (effectTrackDepth <= maxMarkerBits) { | |
finalizeDepMarkers(this); | |
} | |
trackOpBit = 1 << --effectTrackDepth; | |
activeEffect = this.parent; | |
shouldTrack = lastShouldTrack; | |
this.parent = void 0; | |
if (this.deferStop) { | |
this.stop(); | |
} | |
} | |
} | |
stop() { | |
if (activeEffect === this) { | |
this.deferStop = true; | |
} else if (this.active) { | |
cleanupEffect(this); | |
if (this.onStop) { | |
this.onStop(); | |
} | |
this.active = false; | |
} | |
} | |
} | |
function cleanupEffect(effect2) { | |
const { deps } = effect2; | |
if (deps.length) { | |
for (let i = 0; i < deps.length; i++) { | |
deps[i].delete(effect2); | |
} | |
deps.length = 0; | |
} | |
} | |
let shouldTrack = true; | |
const trackStack = []; | |
function pauseTracking() { | |
trackStack.push(shouldTrack); | |
shouldTrack = false; | |
} | |
function resetTracking() { | |
const last = trackStack.pop(); | |
shouldTrack = last === void 0 ? true : last; | |
} | |
function track(target, type, key) { | |
if (shouldTrack && activeEffect) { | |
let depsMap = targetMap.get(target); | |
if (!depsMap) { | |
targetMap.set(target, depsMap = /* @__PURE__ */ new Map()); | |
} | |
let dep = depsMap.get(key); | |
if (!dep) { | |
depsMap.set(key, dep = createDep()); | |
} | |
trackEffects(dep); | |
} | |
} | |
function trackEffects(dep, debuggerEventExtraInfo) { | |
let shouldTrack2 = false; | |
if (effectTrackDepth <= maxMarkerBits) { | |
if (!newTracked(dep)) { | |
dep.n |= trackOpBit; | |
shouldTrack2 = !wasTracked(dep); | |
} | |
} else { | |
shouldTrack2 = !dep.has(activeEffect); | |
} | |
if (shouldTrack2) { | |
dep.add(activeEffect); | |
activeEffect.deps.push(dep); | |
} | |
} | |
function trigger(target, type, key, newValue, oldValue, oldTarget) { | |
const depsMap = targetMap.get(target); | |
if (!depsMap) { | |
return; | |
} | |
let deps = []; | |
if (type === "clear") { | |
deps = [...depsMap.values()]; | |
} else if (key === "length" && isArray$1(target)) { | |
const newLength = Number(newValue); | |
depsMap.forEach((dep, key2) => { | |
if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) { | |
deps.push(dep); | |
} | |
}); | |
} else { | |
if (key !== void 0) { | |
deps.push(depsMap.get(key)); | |
} | |
switch (type) { | |
case "add": | |
if (!isArray$1(target)) { | |
deps.push(depsMap.get(ITERATE_KEY)); | |
if (isMap(target)) { | |
deps.push(depsMap.get(MAP_KEY_ITERATE_KEY)); | |
} | |
} else if (isIntegerKey(key)) { | |
deps.push(depsMap.get("length")); | |
} | |
break; | |
case "delete": | |
if (!isArray$1(target)) { | |
deps.push(depsMap.get(ITERATE_KEY)); | |
if (isMap(target)) { | |
deps.push(depsMap.get(MAP_KEY_ITERATE_KEY)); | |
} | |
} | |
break; | |
case "set": | |
if (isMap(target)) { | |
deps.push(depsMap.get(ITERATE_KEY)); | |
} | |
break; | |
} | |
} | |
if (deps.length === 1) { | |
if (deps[0]) { | |
{ | |
triggerEffects(deps[0]); | |
} | |
} | |
} else { | |
const effects = []; | |
for (const dep of deps) { | |
if (dep) { | |
effects.push(...dep); | |
} | |
} | |
{ | |
triggerEffects(createDep(effects)); | |
} | |
} | |
} | |
function triggerEffects(dep, debuggerEventExtraInfo) { | |
const effects = isArray$1(dep) ? dep : [...dep]; | |
for (const effect2 of effects) { | |
if (effect2.computed) { | |
triggerEffect(effect2); | |
} | |
} | |
for (const effect2 of effects) { | |
if (!effect2.computed) { | |
triggerEffect(effect2); | |
} | |
} | |
} | |
function triggerEffect(effect2, debuggerEventExtraInfo) { | |
if (effect2 !== activeEffect || effect2.allowRecurse) { | |
if (effect2.scheduler) { | |
effect2.scheduler(); | |
} else { | |
effect2.run(); | |
} | |
} | |
} | |
const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`); | |
const builtInSymbols = new Set( | |
/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol) | |
); | |
const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations(); | |
function createArrayInstrumentations() { | |
const instrumentations = {}; | |
["includes", "indexOf", "lastIndexOf"].forEach((key) => { | |
instrumentations[key] = function(...args) { | |
const arr = toRaw(this); | |
for (let i = 0, l = this.length; i < l; i++) { | |
track(arr, "get", i + ""); | |
} | |
const res = arr[key](...args); | |
if (res === -1 || res === false) { | |
return arr[key](...args.map(toRaw)); | |
} else { | |
return res; | |
} | |
}; | |
}); | |
["push", "pop", "shift", "unshift", "splice"].forEach((key) => { | |
instrumentations[key] = function(...args) { | |
pauseTracking(); | |
const res = toRaw(this)[key].apply(this, args); | |
resetTracking(); | |
return res; | |
}; | |
}); | |
return instrumentations; | |
} | |
function hasOwnProperty(key) { | |
const obj = toRaw(this); | |
track(obj, "has", key); | |
return obj.hasOwnProperty(key); | |
} | |
class BaseReactiveHandler { | |
constructor(_isReadonly = false, _shallow = false) { | |
this._isReadonly = _isReadonly; | |
this._shallow = _shallow; | |
} | |
get(target, key, receiver) { | |
const isReadonly2 = this._isReadonly, shallow = this._shallow; | |
if (key === "__v_isReactive") { | |
return !isReadonly2; | |
} else if (key === "__v_isReadonly") { | |
return isReadonly2; | |
} else if (key === "__v_isShallow") { | |
return shallow; | |
} else if (key === "__v_raw" && receiver === (isReadonly2 ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target)) { | |
return target; | |
} | |
const targetIsArray = isArray$1(target); | |
if (!isReadonly2) { | |
if (targetIsArray && hasOwn(arrayInstrumentations, key)) { | |
return Reflect.get(arrayInstrumentations, key, receiver); | |
} | |
if (key === "hasOwnProperty") { | |
return hasOwnProperty; | |
} | |
} | |
const res = Reflect.get(target, key, receiver); | |
if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) { | |
return res; | |
} | |
if (!isReadonly2) { | |
track(target, "get", key); | |
} | |
if (shallow) { | |
return res; | |
} | |
if (isRef(res)) { | |
return targetIsArray && isIntegerKey(key) ? res : res.value; | |
} | |
if (isObject(res)) { | |
return isReadonly2 ? readonly(res) : reactive(res); | |
} | |
return res; | |
} | |
} | |
class MutableReactiveHandler extends BaseReactiveHandler { | |
constructor(shallow = false) { | |
super(false, shallow); | |
} | |
set(target, key, value, receiver) { | |
let oldValue = target[key]; | |
if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) { | |
return false; | |
} | |
if (!this._shallow) { | |
if (!isShallow(value) && !isReadonly(value)) { | |
oldValue = toRaw(oldValue); | |
value = toRaw(value); | |
} | |
if (!isArray$1(target) && isRef(oldValue) && !isRef(value)) { | |
oldValue.value = value; | |
return true; | |
} | |
} | |
const hadKey = isArray$1(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key); | |
const result = Reflect.set(target, key, value, receiver); | |
if (target === toRaw(receiver)) { | |
if (!hadKey) { | |
trigger(target, "add", key, value); | |
} else if (hasChanged(value, oldValue)) { | |
trigger(target, "set", key, value); | |
} | |
} | |
return result; | |
} | |
deleteProperty(target, key) { | |
const hadKey = hasOwn(target, key); | |
target[key]; | |
const result = Reflect.deleteProperty(target, key); | |
if (result && hadKey) { | |
trigger(target, "delete", key, void 0); | |
} | |
return result; | |
} | |
has(target, key) { | |
const result = Reflect.has(target, key); | |
if (!isSymbol(key) || !builtInSymbols.has(key)) { | |
track(target, "has", key); | |
} | |
return result; | |
} | |
ownKeys(target) { | |
track( | |
target, | |
"iterate", | |
isArray$1(target) ? "length" : ITERATE_KEY | |
); | |
return Reflect.ownKeys(target); | |
} | |
} | |
class ReadonlyReactiveHandler extends BaseReactiveHandler { | |
constructor(shallow = false) { | |
super(true, shallow); | |
} | |
set(target, key) { | |
return true; | |
} | |
deleteProperty(target, key) { | |
return true; | |
} | |
} | |
const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler(); | |
const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(); | |
const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler( | |
true | |
); | |
const toShallow = (value) => value; | |
const getProto = (v) => Reflect.getPrototypeOf(v); | |
function get(target, key, isReadonly2 = false, isShallow2 = false) { | |
target = target["__v_raw"]; | |
const rawTarget = toRaw(target); | |
const rawKey = toRaw(key); | |
if (!isReadonly2) { | |
if (hasChanged(key, rawKey)) { | |
track(rawTarget, "get", key); | |
} | |
track(rawTarget, "get", rawKey); | |
} | |
const { has: has2 } = getProto(rawTarget); | |
const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive; | |
if (has2.call(rawTarget, key)) { | |
return wrap(target.get(key)); | |
} else if (has2.call(rawTarget, rawKey)) { | |
return wrap(target.get(rawKey)); | |
} else if (target !== rawTarget) { | |
target.get(key); | |
} | |
} | |
function has(key, isReadonly2 = false) { | |
const target = this["__v_raw"]; | |
const rawTarget = toRaw(target); | |
const rawKey = toRaw(key); | |
if (!isReadonly2) { | |
if (hasChanged(key, rawKey)) { | |
track(rawTarget, "has", key); | |
} | |
track(rawTarget, "has", rawKey); | |
} | |
return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey); | |
} | |
function size(target, isReadonly2 = false) { | |
target = target["__v_raw"]; | |
!isReadonly2 && track(toRaw(target), "iterate", ITERATE_KEY); | |
return Reflect.get(target, "size", target); | |
} | |
function add(value) { | |
value = toRaw(value); | |
const target = toRaw(this); | |
const proto = getProto(target); | |
const hadKey = proto.has.call(target, value); | |
if (!hadKey) { | |
target.add(value); | |
trigger(target, "add", value, value); | |
} | |
return this; | |
} | |
function set(key, value) { | |
value = toRaw(value); | |
const target = toRaw(this); | |
const { has: has2, get: get2 } = getProto(target); | |
let hadKey = has2.call(target, key); | |
if (!hadKey) { | |
key = toRaw(key); | |
hadKey = has2.call(target, key); | |
} | |
const oldValue = get2.call(target, key); | |
target.set(key, value); | |
if (!hadKey) { | |
trigger(target, "add", key, value); | |
} else if (hasChanged(value, oldValue)) { | |
trigger(target, "set", key, value); | |
} | |
return this; | |
} | |
function deleteEntry(key) { | |
const target = toRaw(this); | |
const { has: has2, get: get2 } = getProto(target); | |
let hadKey = has2.call(target, key); | |
if (!hadKey) { | |
key = toRaw(key); | |
hadKey = has2.call(target, key); | |
} | |
get2 ? get2.call(target, key) : void 0; | |
const result = target.delete(key); | |
if (hadKey) { | |
trigger(target, "delete", key, void 0); | |
} | |
return result; | |
} | |
function clear() { | |
const target = toRaw(this); | |
const hadItems = target.size !== 0; | |
const result = target.clear(); | |
if (hadItems) { | |
trigger(target, "clear", void 0, void 0); | |
} | |
return result; | |
} | |
function createForEach(isReadonly2, isShallow2) { | |
return function forEach(callback, thisArg) { | |
const observed = this; | |
const target = observed["__v_raw"]; | |
const rawTarget = toRaw(target); | |
const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive; | |
!isReadonly2 && track(rawTarget, "iterate", ITERATE_KEY); | |
return target.forEach((value, key) => { | |
return callback.call(thisArg, wrap(value), wrap(key), observed); | |
}); | |
}; | |
} | |
function createIterableMethod(method, isReadonly2, isShallow2) { | |
return function(...args) { | |
const target = this["__v_raw"]; | |
const rawTarget = toRaw(target); | |
const targetIsMap = isMap(rawTarget); | |
const isPair = method === "entries" || method === Symbol.iterator && targetIsMap; | |
const isKeyOnly = method === "keys" && targetIsMap; | |
const innerIterator = target[method](...args); | |
const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive; | |
!isReadonly2 && track( | |
rawTarget, | |
"iterate", | |
isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY | |
); | |
return { | |
// iterator protocol | |
next() { | |
const { value, done } = innerIterator.next(); | |
return done ? { value, done } : { | |
value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value), | |
done | |
}; | |
}, | |
// iterable protocol | |
[Symbol.iterator]() { | |
return this; | |
} | |
}; | |
}; | |
} | |
function createReadonlyMethod(type) { | |
return function(...args) { | |
return type === "delete" ? false : this; | |
}; | |
} | |
function createInstrumentations() { | |
const mutableInstrumentations2 = { | |
get(key) { | |
return get(this, key); | |
}, | |
get size() { | |
return size(this); | |
}, | |
has, | |
add, | |
set, | |
delete: deleteEntry, | |
clear, | |
forEach: createForEach(false, false) | |
}; | |
const shallowInstrumentations2 = { | |
get(key) { | |
return get(this, key, false, true); | |
}, | |
get size() { | |
return size(this); | |
}, | |
has, | |
add, | |
set, | |
delete: deleteEntry, | |
clear, | |
forEach: createForEach(false, true) | |
}; | |
const readonlyInstrumentations2 = { | |
get(key) { | |
return get(this, key, true); | |
}, | |
get size() { | |
return size(this, true); | |
}, | |
has(key) { | |
return has.call(this, key, true); | |
}, | |
add: createReadonlyMethod("add"), | |
set: createReadonlyMethod("set"), | |
delete: createReadonlyMethod("delete"), | |
clear: createReadonlyMethod("clear"), | |
forEach: createForEach(true, false) | |
}; | |
const shallowReadonlyInstrumentations2 = { | |
get(key) { | |
return get(this, key, true, true); | |
}, | |
get size() { | |
return size(this, true); | |
}, | |
has(key) { | |
return has.call(this, key, true); | |
}, | |
add: createReadonlyMethod("add"), | |
set: createReadonlyMethod("set"), | |
delete: createReadonlyMethod("delete"), | |
clear: createReadonlyMethod("clear"), | |
forEach: createForEach(true, true) | |
}; | |
const iteratorMethods = ["keys", "values", "entries", Symbol.iterator]; | |
iteratorMethods.forEach((method) => { | |
mutableInstrumentations2[method] = createIterableMethod( | |
method, | |
false, | |
false | |
); | |
readonlyInstrumentations2[method] = createIterableMethod( | |
method, | |
true, | |
false | |
); | |
shallowInstrumentations2[method] = createIterableMethod( | |
method, | |
false, | |
true | |
); | |
shallowReadonlyInstrumentations2[method] = createIterableMethod( | |
method, | |
true, | |
true | |
); | |
}); | |
return [ | |
mutableInstrumentations2, | |
readonlyInstrumentations2, | |
shallowInstrumentations2, | |
shallowReadonlyInstrumentations2 | |
]; | |
} | |
const [ | |
mutableInstrumentations, | |
readonlyInstrumentations, | |
shallowInstrumentations, | |
shallowReadonlyInstrumentations | |
] = /* @__PURE__ */ createInstrumentations(); | |
function createInstrumentationGetter(isReadonly2, shallow) { | |
const instrumentations = shallow ? isReadonly2 ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly2 ? readonlyInstrumentations : mutableInstrumentations; | |
return (target, key, receiver) => { | |
if (key === "__v_isReactive") { | |
return !isReadonly2; | |
} else if (key === "__v_isReadonly") { | |
return isReadonly2; | |
} else if (key === "__v_raw") { | |
return target; | |
} | |
return Reflect.get( | |
hasOwn(instrumentations, key) && key in target ? instrumentations : target, | |
key, | |
receiver | |
); | |
}; | |
} | |
const mutableCollectionHandlers = { | |
get: /* @__PURE__ */ createInstrumentationGetter(false, false) | |
}; | |
const shallowCollectionHandlers = { | |
get: /* @__PURE__ */ createInstrumentationGetter(false, true) | |
}; | |
const readonlyCollectionHandlers = { | |
get: /* @__PURE__ */ createInstrumentationGetter(true, false) | |
}; | |
const reactiveMap = /* @__PURE__ */ new WeakMap(); | |
const shallowReactiveMap = /* @__PURE__ */ new WeakMap(); | |
const readonlyMap = /* @__PURE__ */ new WeakMap(); | |
const shallowReadonlyMap = /* @__PURE__ */ new WeakMap(); | |
function targetTypeMap(rawType) { | |
switch (rawType) { | |
case "Object": | |
case "Array": | |
return 1; | |
case "Map": | |
case "Set": | |
case "WeakMap": | |
case "WeakSet": | |
return 2; | |
default: | |
return 0; | |
} | |
} | |
function getTargetType(value) { | |
return value["__v_skip"] || !Object.isExtensible(value) ? 0 : targetTypeMap(toRawType(value)); | |
} | |
function reactive(target) { | |
if (isReadonly(target)) { | |
return target; | |
} | |
return createReactiveObject( | |
target, | |
false, | |
mutableHandlers, | |
mutableCollectionHandlers, | |
reactiveMap | |
); | |
} | |
function shallowReactive(target) { | |
return createReactiveObject( | |
target, | |
false, | |
shallowReactiveHandlers, | |
shallowCollectionHandlers, | |
shallowReactiveMap | |
); | |
} | |
function readonly(target) { | |
return createReactiveObject( | |
target, | |
true, | |
readonlyHandlers, | |
readonlyCollectionHandlers, | |
readonlyMap | |
); | |
} | |
function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) { | |
if (!isObject(target)) { | |
return target; | |
} | |
if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) { | |
return target; | |
} | |
const existingProxy = proxyMap.get(target); | |
if (existingProxy) { | |
return existingProxy; | |
} | |
const targetType = getTargetType(target); | |
if (targetType === 0) { | |
return target; | |
} | |
const proxy = new Proxy( | |
target, | |
targetType === 2 ? collectionHandlers : baseHandlers | |
); | |
proxyMap.set(target, proxy); | |
return proxy; | |
} | |
function isReactive(value) { | |
if (isReadonly(value)) { | |
return isReactive(value["__v_raw"]); | |
} | |
return !!(value && value["__v_isReactive"]); | |
} | |
function isReadonly(value) { | |
return !!(value && value["__v_isReadonly"]); | |
} | |
function isShallow(value) { | |
return !!(value && value["__v_isShallow"]); | |
} | |
function isProxy(value) { | |
return isReactive(value) || isReadonly(value); | |
} | |
function toRaw(observed) { | |
const raw = observed && observed["__v_raw"]; | |
return raw ? toRaw(raw) : observed; | |
} | |
function markRaw(value) { | |
def(value, "__v_skip", true); | |
return value; | |
} | |
const toReactive = (value) => isObject(value) ? reactive(value) : value; | |
const toReadonly = (value) => isObject(value) ? readonly(value) : value; | |
function trackRefValue(ref2) { | |
if (shouldTrack && activeEffect) { | |
ref2 = toRaw(ref2); | |
{ | |
trackEffects(ref2.dep || (ref2.dep = createDep())); | |
} | |
} | |
} | |
function triggerRefValue(ref2, newVal) { | |
ref2 = toRaw(ref2); | |
const dep = ref2.dep; | |
if (dep) { | |
{ | |
triggerEffects(dep); | |
} | |
} | |
} | |
function isRef(r) { | |
return !!(r && r.__v_isRef === true); | |
} | |
function ref(value) { | |
return createRef(value, false); | |
} | |
function createRef(rawValue, shallow) { | |
if (isRef(rawValue)) { | |
return rawValue; | |
} | |
return new RefImpl(rawValue, shallow); | |
} | |
class RefImpl { | |
constructor(value, __v_isShallow) { | |
this.__v_isShallow = __v_isShallow; | |
this.dep = void 0; | |
this.__v_isRef = true; | |
this._rawValue = __v_isShallow ? value : toRaw(value); | |
this._value = __v_isShallow ? value : toReactive(value); | |
} | |
get value() { | |
trackRefValue(this); | |
return this._value; | |
} | |
set value(newVal) { | |
const useDirectValue = this.__v_isShallow || isShallow(newVal) || isReadonly(newVal); | |
newVal = useDirectValue ? newVal : toRaw(newVal); | |
if (hasChanged(newVal, this._rawValue)) { | |
this._rawValue = newVal; | |
this._value = useDirectValue ? newVal : toReactive(newVal); | |
triggerRefValue(this); | |
} | |
} | |
} | |
function unref(ref2) { | |
return isRef(ref2) ? ref2.value : ref2; | |
} | |
const shallowUnwrapHandlers = { | |
get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)), | |
set: (target, key, value, receiver) => { | |
const oldValue = target[key]; | |
if (isRef(oldValue) && !isRef(value)) { | |
oldValue.value = value; | |
return true; | |
} else { | |
return Reflect.set(target, key, value, receiver); | |
} | |
} | |
}; | |
function proxyRefs(objectWithRefs) { | |
return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers); | |
} | |
class ComputedRefImpl { | |
constructor(getter, _setter, isReadonly2, isSSR) { | |
this._setter = _setter; | |
this.dep = void 0; | |
this.__v_isRef = true; | |
this["__v_isReadonly"] = false; | |
this._dirty = true; | |
this.effect = new ReactiveEffect(getter, () => { | |
if (!this._dirty) { | |
this._dirty = true; | |
triggerRefValue(this); | |
} | |
}); | |
this.effect.computed = this; | |
this.effect.active = this._cacheable = !isSSR; | |
this["__v_isReadonly"] = isReadonly2; | |
} | |
get value() { | |
const self2 = toRaw(this); | |
trackRefValue(self2); | |
if (self2._dirty || !self2._cacheable) { | |
self2._dirty = false; | |
self2._value = self2.effect.run(); | |
} | |
return self2._value; | |
} | |
set value(newValue) { | |
this._setter(newValue); | |
} | |
} | |
function computed$1(getterOrOptions, debugOptions, isSSR = false) { | |
let getter; | |
let setter; | |
const onlyGetter = isFunction(getterOrOptions); | |
if (onlyGetter) { | |
getter = getterOrOptions; | |
setter = NOOP; | |
} else { | |
getter = getterOrOptions.get; | |
setter = getterOrOptions.set; | |
} | |
const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR); | |
return cRef; | |
} | |
function warn(msg, ...args) { | |
return; | |
} | |
function callWithErrorHandling(fn, instance, type, args) { | |
let res; | |
try { | |
res = args ? fn(...args) : fn(); | |
} catch (err) { | |
handleError(err, instance, type); | |
} | |
return res; | |
} | |
function callWithAsyncErrorHandling(fn, instance, type, args) { | |
if (isFunction(fn)) { | |
const res = callWithErrorHandling(fn, instance, type, args); | |
if (res && isPromise(res)) { | |
res.catch((err) => { | |
handleError(err, instance, type); | |
}); | |
} | |
return res; | |
} | |
const values = []; | |
for (let i = 0; i < fn.length; i++) { | |
values.push(callWithAsyncErrorHandling(fn[i], instance, type, args)); | |
} | |
return values; | |
} | |
function handleError(err, instance, type, throwInDev = true) { | |
const contextVNode = instance ? instance.vnode : null; | |
if (instance) { | |
let cur = instance.parent; | |
const exposedInstance = instance.proxy; | |
const errorInfo = type; | |
while (cur) { | |
const errorCapturedHooks = cur.ec; | |
if (errorCapturedHooks) { | |
for (let i = 0; i < errorCapturedHooks.length; i++) { | |
if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) { | |
return; | |
} | |
} | |
} | |
cur = cur.parent; | |
} | |
const appErrorHandler = instance.appContext.config.errorHandler; | |
if (appErrorHandler) { | |
callWithErrorHandling( | |
appErrorHandler, | |
null, | |
10, | |
[err, exposedInstance, errorInfo] | |
); | |
return; | |
} | |
} | |
logError(err, type, contextVNode, throwInDev); | |
} | |
function logError(err, type, contextVNode, throwInDev = true) { | |
{ | |
console.error(err); | |
} | |
} | |
let isFlushing = false; | |
let isFlushPending = false; | |
const queue = []; | |
let flushIndex = 0; | |
const pendingPostFlushCbs = []; | |
let activePostFlushCbs = null; | |
let postFlushIndex = 0; | |
const resolvedPromise = /* @__PURE__ */ Promise.resolve(); | |
let currentFlushPromise = null; | |
function nextTick(fn) { | |
const p2 = currentFlushPromise || resolvedPromise; | |
return fn ? p2.then(this ? fn.bind(this) : fn) : p2; | |
} | |
function findInsertionIndex(id) { | |
let start = flushIndex + 1; | |
let end = queue.length; | |
while (start < end) { | |
const middle = start + end >>> 1; | |
const middleJob = queue[middle]; | |
const middleJobId = getId(middleJob); | |
if (middleJobId < id || middleJobId === id && middleJob.pre) { | |
start = middle + 1; | |
} else { | |
end = middle; | |
} | |
} | |
return start; | |
} | |
function queueJob(job) { | |
if (!queue.length || !queue.includes( | |
job, | |
isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex | |
)) { | |
if (job.id == null) { | |
queue.push(job); | |
} else { | |
queue.splice(findInsertionIndex(job.id), 0, job); | |
} | |
queueFlush(); | |
} | |
} | |
function queueFlush() { | |
if (!isFlushing && !isFlushPending) { | |
isFlushPending = true; | |
currentFlushPromise = resolvedPromise.then(flushJobs); | |
} | |
} | |
function invalidateJob(job) { | |
const i = queue.indexOf(job); | |
if (i > flushIndex) { | |
queue.splice(i, 1); | |
} | |
} | |
function queuePostFlushCb(cb) { | |
if (!isArray$1(cb)) { | |
if (!activePostFlushCbs || !activePostFlushCbs.includes( | |
cb, | |
cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex | |
)) { | |
pendingPostFlushCbs.push(cb); | |
} | |
} else { | |
pendingPostFlushCbs.push(...cb); | |
} | |
queueFlush(); | |
} | |
function flushPreFlushCbs(seen, i = isFlushing ? flushIndex + 1 : 0) { | |
for (; i < queue.length; i++) { | |
const cb = queue[i]; | |
if (cb && cb.pre) { | |
queue.splice(i, 1); | |
i--; | |
cb(); | |
} | |
} | |
} | |
function flushPostFlushCbs(seen) { | |
if (pendingPostFlushCbs.length) { | |
const deduped = [...new Set(pendingPostFlushCbs)]; | |
pendingPostFlushCbs.length = 0; | |
if (activePostFlushCbs) { | |
activePostFlushCbs.push(...deduped); | |
return; | |
} | |
activePostFlushCbs = deduped; | |
activePostFlushCbs.sort((a, b) => getId(a) - getId(b)); | |
for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) { | |
activePostFlushCbs[postFlushIndex](); | |
} | |
activePostFlushCbs = null; | |
postFlushIndex = 0; | |
} | |
} | |
const getId = (job) => job.id == null ? Infinity : job.id; | |
const comparator = (a, b) => { | |
const diff = getId(a) - getId(b); | |
if (diff === 0) { | |
if (a.pre && !b.pre) | |
return -1; | |
if (b.pre && !a.pre) | |
return 1; | |
} | |
return diff; | |
}; | |
function flushJobs(seen) { | |
isFlushPending = false; | |
isFlushing = true; | |
queue.sort(comparator); | |
const check = NOOP; | |
try { | |
for (flushIndex = 0; flushIndex < queue.length; flushIndex++) { | |
const job = queue[flushIndex]; | |
if (job && job.active !== false) { | |
if (false) | |
; | |
callWithErrorHandling(job, null, 14); | |
} | |
} | |
} finally { | |
flushIndex = 0; | |
queue.length = 0; | |
flushPostFlushCbs(); | |
isFlushing = false; | |
currentFlushPromise = null; | |
if (queue.length || pendingPostFlushCbs.length) { | |
flushJobs(); | |
} | |
} | |
} | |
let devtools; | |
let buffer = []; | |
let devtoolsNotInstalled = false; | |
function emit$1(event, ...args) { | |
if (devtools) { | |
devtools.emit(event, ...args); | |
} else if (!devtoolsNotInstalled) { | |
buffer.push({ event, args }); | |
} | |
} | |
function setDevtoolsHook(hook, target) { | |
var _a, _b; | |
devtools = hook; | |
if (devtools) { | |
devtools.enabled = true; | |
buffer.forEach(({ event, args }) => devtools.emit(event, ...args)); | |
buffer = []; | |
} else if ( | |
// handle late devtools injection - only do this if we are in an actual | |
// browser environment to avoid the timer handle stalling test runner exit | |
// (#4815) | |
typeof window !== "undefined" && // some envs mock window but not fully | |
window.HTMLElement && // also exclude jsdom | |
!((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom")) | |
) { | |
const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || []; | |
replay.push((newHook) => { | |
setDevtoolsHook(newHook, target); | |
}); | |
setTimeout(() => { | |
if (!devtools) { | |
target.__VUE_DEVTOOLS_HOOK_REPLAY__ = null; | |
devtoolsNotInstalled = true; | |
buffer = []; | |
} | |
}, 3e3); | |
} else { | |
devtoolsNotInstalled = true; | |
buffer = []; | |
} | |
} | |
function devtoolsInitApp(app, version2) { | |
emit$1("app:init", app, version2, { | |
Fragment, | |
Text, | |
Comment, | |
Static | |
}); | |
} | |
function devtoolsUnmountApp(app) { | |
emit$1("app:unmount", app); | |
} | |
const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook( | |
"component:added" | |
/* COMPONENT_ADDED */ | |
); | |
const devtoolsComponentUpdated = /* @__PURE__ */ createDevtoolsComponentHook( | |
"component:updated" | |
/* COMPONENT_UPDATED */ | |
); | |
const _devtoolsComponentRemoved = /* @__PURE__ */ createDevtoolsComponentHook( | |
"component:removed" | |
/* COMPONENT_REMOVED */ | |
); | |
const devtoolsComponentRemoved = (component) => { | |
if (devtools && typeof devtools.cleanupBuffer === "function" && // remove the component if it wasn't buffered | |
!devtools.cleanupBuffer(component)) { | |
_devtoolsComponentRemoved(component); | |
} | |
}; | |
function createDevtoolsComponentHook(hook) { | |
return (component) => { | |
emit$1( | |
hook, | |
component.appContext.app, | |
component.uid, | |
component.parent ? component.parent.uid : void 0, | |
component | |
); | |
}; | |
} | |
function devtoolsComponentEmit(component, event, params) { | |
emit$1( | |
"component:emit", | |
component.appContext.app, | |
component, | |
event, | |
params | |
); | |
} | |
function emit(instance, event, ...rawArgs) { | |
if (instance.isUnmounted) | |
return; | |
const props = instance.vnode.props || EMPTY_OBJ; | |
let args = rawArgs; | |
const isModelListener2 = event.startsWith("update:"); | |
const modelArg = isModelListener2 && event.slice(7); | |
if (modelArg && modelArg in props) { | |
const modifiersKey = `${modelArg === "modelValue" ? "model" : modelArg}Modifiers`; | |
const { number, trim } = props[modifiersKey] || EMPTY_OBJ; | |
if (trim) { | |
args = rawArgs.map((a) => isString(a) ? a.trim() : a); | |
} | |
if (number) { | |
args = rawArgs.map(looseToNumber); | |
} | |
} | |
if (__VUE_PROD_DEVTOOLS__) { | |
devtoolsComponentEmit(instance, event, args); | |
} | |
let handlerName; | |
let handler = props[handlerName = toHandlerKey(event)] || // also try camelCase event handler (#2249) | |
props[handlerName = toHandlerKey(camelize(event))]; | |
if (!handler && isModelListener2) { | |
handler = props[handlerName = toHandlerKey(hyphenate(event))]; | |
} | |
if (handler) { | |
callWithAsyncErrorHandling( | |
handler, | |
instance, | |
6, | |
args | |
); | |
} | |
const onceHandler = props[handlerName + `Once`]; | |
if (onceHandler) { | |
if (!instance.emitted) { | |
instance.emitted = {}; | |
} else if (instance.emitted[handlerName]) { | |
return; | |
} | |
instance.emitted[handlerName] = true; | |
callWithAsyncErrorHandling( | |
onceHandler, | |
instance, | |
6, | |
args | |
); | |
} | |
} | |
function normalizeEmitsOptions(comp, appContext, asMixin = false) { | |
const cache = appContext.emitsCache; | |
const cached = cache.get(comp); | |
if (cached !== void 0) { | |
return cached; | |
} | |
const raw = comp.emits; | |
let normalized = {}; | |
let hasExtends = false; | |
if (__VUE_OPTIONS_API__ && !isFunction(comp)) { | |
const extendEmits = (raw2) => { | |
const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true); | |
if (normalizedFromExtend) { | |
hasExtends = true; | |
extend(normalized, normalizedFromExtend); | |
} | |
}; | |
if (!asMixin && appContext.mixins.length) { | |
appContext.mixins.forEach(extendEmits); | |
} | |
if (comp.extends) { | |
extendEmits(comp.extends); | |
} | |
if (comp.mixins) { | |
comp.mixins.forEach(extendEmits); | |
} | |
} | |
if (!raw && !hasExtends) { | |
if (isObject(comp)) { | |
cache.set(comp, null); | |
} | |
return null; | |
} | |
if (isArray$1(raw)) { | |
raw.forEach((key) => normalized[key] = null); | |
} else { | |
extend(normalized, raw); | |
} | |
if (isObject(comp)) { | |
cache.set(comp, normalized); | |
} | |
return normalized; | |
} | |
function isEmitListener(options, key) { | |
if (!options || !isOn(key)) { | |
return false; | |
} | |
key = key.slice(2).replace(/Once$/, ""); | |
return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key); | |
} | |
let currentRenderingInstance = null; | |
let currentScopeId = null; | |
function setCurrentRenderingInstance(instance) { | |
const prev = currentRenderingInstance; | |
currentRenderingInstance = instance; | |
currentScopeId = instance && instance.type.__scopeId || null; | |
return prev; | |
} | |
function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) { | |
if (!ctx) | |
return fn; | |
if (fn._n) { | |
return fn; | |
} | |
const renderFnWithContext = (...args) => { | |
if (renderFnWithContext._d) { | |
setBlockTracking(-1); | |
} | |
const prevInstance = setCurrentRenderingInstance(ctx); | |
let res; | |
try { | |
res = fn(...args); | |
} finally { | |
setCurrentRenderingInstance(prevInstance); | |
if (renderFnWithContext._d) { | |
setBlockTracking(1); | |
} | |
} | |
if (__VUE_PROD_DEVTOOLS__) { | |
devtoolsComponentUpdated(ctx); | |
} | |
return res; | |
}; | |
renderFnWithContext._n = true; | |
renderFnWithContext._c = true; | |
renderFnWithContext._d = true; | |
return renderFnWithContext; | |
} | |
function markAttrsAccessed() { | |
} | |
function renderComponentRoot(instance) { | |
const { | |
type: Component, | |
vnode, | |
proxy, | |
withProxy, | |
props, | |
propsOptions: [propsOptions], | |
slots, | |
attrs, | |
emit: emit2, | |
render: render2, | |
renderCache, | |
data, | |
setupState, | |
ctx, | |
inheritAttrs | |
} = instance; | |
let result; | |
let fallthroughAttrs; | |
const prev = setCurrentRenderingInstance(instance); | |
try { | |
if (vnode.shapeFlag & 4) { | |
const proxyToUse = withProxy || proxy; | |
result = normalizeVNode( | |
render2.call( | |
proxyToUse, | |
proxyToUse, | |
renderCache, | |
props, | |
setupState, | |
data, | |
ctx | |
) | |
); | |
fallthroughAttrs = attrs; | |
} else { | |
const render22 = Component; | |
if (false) | |
; | |
result = normalizeVNode( | |
render22.length > 1 ? render22( | |
props, | |
false ? { | |
get attrs() { | |
markAttrsAccessed(); | |
return attrs; | |
}, | |
slots, | |
emit: emit2 | |
} : { attrs, slots, emit: emit2 } | |
) : render22( | |
props, | |
null | |
/* we know it doesn't need it */ | |
) | |
); | |
fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs); | |
} | |
} catch (err) { | |
blockStack.length = 0; | |
handleError(err, instance, 1); | |
result = createVNode(Comment); | |
} | |
let root = result; | |
if (fallthroughAttrs && inheritAttrs !== false) { | |
const keys = Object.keys(fallthroughAttrs); | |
const { shapeFlag } = root; | |
if (keys.length) { | |
if (shapeFlag & (1 | 6)) { | |
if (propsOptions && keys.some(isModelListener)) { | |
fallthroughAttrs = filterModelListeners( | |
fallthroughAttrs, | |
propsOptions | |
); | |
} | |
root = cloneVNode(root, fallthroughAttrs); | |
} | |
} | |
} | |
if (vnode.dirs) { | |
root = cloneVNode(root); | |
root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs; | |
} | |
if (vnode.transition) { | |
root.transition = vnode.transition; | |
} | |
{ | |
result = root; | |
} | |
setCurrentRenderingInstance(prev); | |
return result; | |
} | |
const getFunctionalFallthrough = (attrs) => { | |
let res; | |
for (const key in attrs) { | |
if (key === "class" || key === "style" || isOn(key)) { | |
(res || (res = {}))[key] = attrs[key]; | |
} | |
} | |
return res; | |
}; | |
const filterModelListeners = (attrs, props) => { | |
const res = {}; | |
for (const key in attrs) { | |
if (!isModelListener(key) || !(key.slice(9) in props)) { | |
res[key] = attrs[key]; | |
} | |
} | |
return res; | |
}; | |
function shouldUpdateComponent(prevVNode, nextVNode, optimized) { | |
const { props: prevProps, children: prevChildren, component } = prevVNode; | |
const { props: nextProps, children: nextChildren, patchFlag } = nextVNode; | |
const emits = component.emitsOptions; | |
if (nextVNode.dirs || nextVNode.transition) { | |
return true; | |
} | |
if (optimized && patchFlag >= 0) { | |
if (patchFlag & 1024) { | |
return true; | |
} | |
if (patchFlag & 16) { | |
if (!prevProps) { | |
return !!nextProps; | |
} | |
return hasPropsChanged(prevProps, nextProps, emits); | |
} else if (patchFlag & 8) { | |
const dynamicProps = nextVNode.dynamicProps; | |
for (let i = 0; i < dynamicProps.length; i++) { | |
const key = dynamicProps[i]; | |
if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) { | |
return true; | |
} | |
} | |
} | |
} else { | |
if (prevChildren || nextChildren) { | |
if (!nextChildren || !nextChildren.$stable) { | |
return true; | |
} | |
} | |
if (prevProps === nextProps) { | |
return false; | |
} | |
if (!prevProps) { | |
return !!nextProps; | |
} | |
if (!nextProps) { | |
return true; | |
} | |
return hasPropsChanged(prevProps, nextProps, emits); | |
} | |
return false; | |
} | |
function hasPropsChanged(prevProps, nextProps, emitsOptions) { | |
const nextKeys = Object.keys(nextProps); | |
if (nextKeys.length !== Object.keys(prevProps).length) { | |
return true; | |
} | |
for (let i = 0; i < nextKeys.length; i++) { | |
const key = nextKeys[i]; | |
if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) { | |
return true; | |
} | |
} | |
return false; | |
} | |
function updateHOCHostEl({ vnode, parent }, el) { | |
while (parent && parent.subTree === vnode) { | |
(vnode = parent.vnode).el = el; | |
parent = parent.parent; | |
} | |
} | |
const isSuspense = (type) => type.__isSuspense; | |
function queueEffectWithSuspense(fn, suspense) { | |
if (suspense && suspense.pendingBranch) { | |
if (isArray$1(fn)) { | |
suspense.effects.push(...fn); | |
} else { | |
suspense.effects.push(fn); | |
} | |
} else { | |
queuePostFlushCb(fn); | |
} | |
} | |
const INITIAL_WATCHER_VALUE = {}; | |
function watch(source, cb, options) { | |
return doWatch(source, cb, options); | |
} | |
function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EMPTY_OBJ) { | |
var _a; | |
const instance = getCurrentScope() === ((_a = currentInstance) == null ? void 0 : _a.scope) ? currentInstance : null; | |
let getter; | |
let forceTrigger = false; | |
let isMultiSource = false; | |
if (isRef(source)) { | |
getter = () => source.value; | |
forceTrigger = isShallow(source); | |
} else if (isReactive(source)) { | |
getter = () => source; | |
deep = true; | |
} else if (isArray$1(source)) { | |
isMultiSource = true; | |
forceTrigger = source.some((s) => isReactive(s) || isShallow(s)); | |
getter = () => source.map((s) => { | |
if (isRef(s)) { | |
return s.value; | |
} else if (isReactive(s)) { | |
return traverse(s); | |
} else if (isFunction(s)) { | |
return callWithErrorHandling(s, instance, 2); | |
} else | |
; | |
}); | |
} else if (isFunction(source)) { | |
if (cb) { | |
getter = () => callWithErrorHandling(source, instance, 2); | |
} else { | |
getter = () => { | |
if (instance && instance.isUnmounted) { | |
return; | |
} | |
if (cleanup) { | |
cleanup(); | |
} | |
return callWithAsyncErrorHandling( | |
source, | |
instance, | |
3, | |
[onCleanup] | |
); | |
}; | |
} | |
} else { | |
getter = NOOP; | |
} | |
if (cb && deep) { | |
const baseGetter = getter; | |
getter = () => traverse(baseGetter()); | |
} | |
let cleanup; | |
let onCleanup = (fn) => { | |
cleanup = effect.onStop = () => { | |
callWithErrorHandling(fn, instance, 4); | |
}; | |
}; | |
let ssrCleanup; | |
if (isInSSRComponentSetup) { | |
onCleanup = NOOP; | |
if (!cb) { | |
getter(); | |
} else if (immediate) { | |
callWithAsyncErrorHandling(cb, instance, 3, [ | |
getter(), | |
isMultiSource ? [] : void 0, | |
onCleanup | |
]); | |
} | |
if (flush === "sync") { | |
const ctx = useSSRContext(); | |
ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = []); | |
} else { | |
return NOOP; | |
} | |
} | |
let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE; | |
const job = () => { | |
if (!effect.active) { | |
return; | |
} | |
if (cb) { | |
const newValue = effect.run(); | |
if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue)) || false) { | |
if (cleanup) { | |
cleanup(); | |
} | |
callWithAsyncErrorHandling(cb, instance, 3, [ | |
newValue, | |
// pass undefined as the old value when it's changed for the first time | |
oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue, | |
onCleanup | |
]); | |
oldValue = newValue; | |
} | |
} else { | |
effect.run(); | |
} | |
}; | |
job.allowRecurse = !!cb; | |
let scheduler; | |
if (flush === "sync") { | |
scheduler = job; | |
} else if (flush === "post") { | |
scheduler = () => queuePostRenderEffect(job, instance && instance.suspense); | |
} else { | |
job.pre = true; | |
if (instance) | |
job.id = instance.uid; | |
scheduler = () => queueJob(job); | |
} | |
const effect = new ReactiveEffect(getter, scheduler); | |
if (cb) { | |
if (immediate) { | |
job(); | |
} else { | |
oldValue = effect.run(); | |
} | |
} else if (flush === "post") { | |
queuePostRenderEffect( | |
effect.run.bind(effect), | |
instance && instance.suspense | |
); | |
} else { | |
effect.run(); | |
} | |
const unwatch = () => { | |
effect.stop(); | |
if (instance && instance.scope) { | |
remove(instance.scope.effects, effect); | |
} | |
}; | |
if (ssrCleanup) | |
ssrCleanup.push(unwatch); | |
return unwatch; | |
} | |
function instanceWatch(source, value, options) { | |
const publicThis = this.proxy; | |
const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis); | |
let cb; | |
if (isFunction(value)) { | |
cb = value; | |
} else { | |
cb = value.handler; | |
options = value; | |
} | |
const cur = currentInstance; | |
setCurrentInstance(this); | |
const res = doWatch(getter, cb.bind(publicThis), options); | |
if (cur) { | |
setCurrentInstance(cur); | |
} else { | |
unsetCurrentInstance(); | |
} | |
return res; | |
} | |
function createPathGetter(ctx, path) { | |
const segments = path.split("."); | |
return () => { | |
let cur = ctx; | |
for (let i = 0; i < segments.length && cur; i++) { | |
cur = cur[segments[i]]; | |
} | |
return cur; | |
}; | |
} | |
function traverse(value, seen) { | |
if (!isObject(value) || value["__v_skip"]) { | |
return value; | |
} | |
seen = seen || /* @__PURE__ */ new Set(); | |
if (seen.has(value)) { | |
return value; | |
} | |
seen.add(value); | |
if (isRef(value)) { | |
traverse(value.value, seen); | |
} else if (isArray$1(value)) { | |
for (let i = 0; i < value.length; i++) { | |
traverse(value[i], seen); | |
} | |
} else if (isSet(value) || isMap(value)) { | |
value.forEach((v) => { | |
traverse(v, seen); | |
}); | |
} else if (isPlainObject(value)) { | |
for (const key in value) { | |
traverse(value[key], seen); | |
} | |
} | |
return value; | |
} | |
function invokeDirectiveHook(vnode, prevVNode, instance, name) { | |
const bindings = vnode.dirs; | |
const oldBindings = prevVNode && prevVNode.dirs; | |
for (let i = 0; i < bindings.length; i++) { | |
const binding = bindings[i]; | |
if (oldBindings) { | |
binding.oldValue = oldBindings[i].value; | |
} | |
let hook = binding.dir[name]; | |
if (hook) { | |
pauseTracking(); | |
callWithAsyncErrorHandling(hook, instance, 8, [ | |
vnode.el, | |
binding, | |
vnode, | |
prevVNode | |
]); | |
resetTracking(); | |
} | |
} | |
} | |
/*! #__NO_SIDE_EFFECTS__ */ | |
// @__NO_SIDE_EFFECTS__ | |
function defineComponent(options, extraOptions) { | |
return isFunction(options) ? ( | |
// #8326: extend call and options.name access are considered side-effects | |
// by Rollup, so we have to wrap it in a pure-annotated IIFE. | |
/* @__PURE__ */ (() => extend({ name: options.name }, extraOptions, { setup: options }))() | |
) : options; | |
} | |
const isAsyncWrapper = (i) => !!i.type.__asyncLoader; | |
const isKeepAlive = (vnode) => vnode.type.__isKeepAlive; | |
function onActivated(hook, target) { | |
registerKeepAliveHook(hook, "a", target); | |
} | |
function onDeactivated(hook, target) { | |
registerKeepAliveHook(hook, "da", target); | |
} | |
function registerKeepAliveHook(hook, type, target = currentInstance) { | |
const wrappedHook = hook.__wdc || (hook.__wdc = () => { | |
let current = target; | |
while (current) { | |
if (current.isDeactivated) { | |
return; | |
} | |
current = current.parent; | |
} | |
return hook(); | |
}); | |
injectHook(type, wrappedHook, target); | |
if (target) { | |
let current = target.parent; | |
while (current && current.parent) { | |
if (isKeepAlive(current.parent.vnode)) { | |
injectToKeepAliveRoot(wrappedHook, type, target, current); | |
} | |
current = current.parent; | |
} | |
} | |
} | |
function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) { | |
const injected = injectHook( | |
type, | |
hook, | |
keepAliveRoot, | |
true | |
/* prepend */ | |
); | |
onUnmounted(() => { | |
remove(keepAliveRoot[type], injected); | |
}, target); | |
} | |
function injectHook(type, hook, target = currentInstance, prepend = false) { | |
if (target) { | |
const hooks = target[type] || (target[type] = []); | |
const wrappedHook = hook.__weh || (hook.__weh = (...args) => { | |
if (target.isUnmounted) { | |
return; | |
} | |
pauseTracking(); | |
setCurrentInstance(target); | |
const res = callWithAsyncErrorHandling(hook, target, type, args); | |
unsetCurrentInstance(); | |
resetTracking(); | |
return res; | |
}); | |
if (prepend) { | |
hooks.unshift(wrappedHook); | |
} else { | |
hooks.push(wrappedHook); | |
} | |
return wrappedHook; | |
} | |
} | |
const createHook = (lifecycle) => (hook, target = currentInstance) => ( | |
// post-create lifecycle registrations are noops during SSR (except for serverPrefetch) | |
(!isInSSRComponentSetup || lifecycle === "sp") && injectHook(lifecycle, (...args) => hook(...args), target) | |
); | |
const onBeforeMount = createHook("bm"); | |
const onMounted = createHook("m"); | |
const onBeforeUpdate = createHook("bu"); | |
const onUpdated = createHook("u"); | |
const onBeforeUnmount = createHook("bum"); | |
const onUnmounted = createHook("um"); | |
const onServerPrefetch = createHook("sp"); | |
const onRenderTriggered = createHook( | |
"rtg" | |
); | |
const onRenderTracked = createHook( | |
"rtc" | |
); | |
function onErrorCaptured(hook, target = currentInstance) { | |
injectHook("ec", hook, target); | |
} | |
const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc"); | |
const getPublicInstance = (i) => { | |
if (!i) | |
return null; | |
if (isStatefulComponent(i)) | |
return getExposeProxy(i) || i.proxy; | |
return getPublicInstance(i.parent); | |
}; | |
const publicPropertiesMap = ( | |
// Move PURE marker to new line to workaround compiler discarding it | |
// due to type annotation | |
/* @__PURE__ */ extend(/* @__PURE__ */ Object.create(null), { | |
$: (i) => i, | |
$el: (i) => i.vnode.el, | |
$data: (i) => i.data, | |
$props: (i) => i.props, | |
$attrs: (i) => i.attrs, | |
$slots: (i) => i.slots, | |
$refs: (i) => i.refs, | |
$parent: (i) => getPublicInstance(i.parent), | |
$root: (i) => getPublicInstance(i.root), | |
$emit: (i) => i.emit, | |
$options: (i) => __VUE_OPTIONS_API__ ? resolveMergedOptions(i) : i.type, | |
$forceUpdate: (i) => i.f || (i.f = () => queueJob(i.update)), | |
$nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)), | |
$watch: (i) => __VUE_OPTIONS_API__ ? instanceWatch.bind(i) : NOOP | |
}) | |
); | |
const hasSetupBinding = (state, key) => state !== EMPTY_OBJ && !state.__isScriptSetup && hasOwn(state, key); | |
const PublicInstanceProxyHandlers = { | |
get({ _: instance }, key) { | |
const { ctx, setupState, data, props, accessCache, type, appContext } = instance; | |
let normalizedProps; | |
if (key[0] !== "$") { | |
const n = accessCache[key]; | |
if (n !== void 0) { | |
switch (n) { | |
case 1: | |
return setupState[key]; | |
case 2: | |
return data[key]; | |
case 4: | |
return ctx[key]; | |
case 3: | |
return props[key]; | |
} | |
} else if (hasSetupBinding(setupState, key)) { | |
accessCache[key] = 1; | |
return setupState[key]; | |
} else if (data !== EMPTY_OBJ && hasOwn(data, key)) { | |
accessCache[key] = 2; | |
return data[key]; | |
} else if ( | |
// only cache other properties when instance has declared (thus stable) | |
// props | |
(normalizedProps = instance.propsOptions[0]) && hasOwn(normalizedProps, key) | |
) { | |
accessCache[key] = 3; | |
return props[key]; | |
} else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) { | |
accessCache[key] = 4; | |
return ctx[key]; | |
} else if (!__VUE_OPTIONS_API__ || shouldCacheAccess) { | |
accessCache[key] = 0; | |
} | |
} | |
const publicGetter = publicPropertiesMap[key]; | |
let cssModule, globalProperties; | |
if (publicGetter) { | |
if (key === "$attrs") { | |
track(instance, "get", key); | |
} | |
return publicGetter(instance); | |
} else if ( | |
// css module (injected by vue-loader) | |
(cssModule = type.__cssModules) && (cssModule = cssModule[key]) | |
) { | |
return cssModule; | |
} else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) { | |
accessCache[key] = 4; | |
return ctx[key]; | |
} else if ( | |
// global properties | |
globalProperties = appContext.config.globalProperties, hasOwn(globalProperties, key) | |
) { | |
{ | |
return globalProperties[key]; | |
} | |
} else | |
; | |
}, | |
set({ _: instance }, key, value) { | |
const { data, setupState, ctx } = instance; | |
if (hasSetupBinding(setupState, key)) { | |
setupState[key] = value; | |
return true; | |
} else if (data !== EMPTY_OBJ && hasOwn(data, key)) { | |
data[key] = value; | |
return true; | |
} else if (hasOwn(instance.props, key)) { | |
return false; | |
} | |
if (key[0] === "$" && key.slice(1) in instance) { | |
return false; | |
} else { | |
{ | |
ctx[key] = value; | |
} | |
} | |
return true; | |
}, | |
has({ | |
_: { data, setupState, accessCache, ctx, appContext, propsOptions } | |
}, key) { | |
let normalizedProps; | |
return !!accessCache[key] || data !== EMPTY_OBJ && hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key); | |
}, | |
defineProperty(target, key, descriptor) { | |
if (descriptor.get != null) { | |
target._.accessCache[key] = 0; | |
} else if (hasOwn(descriptor, "value")) { | |
this.set(target, key, descriptor.value, null); | |
} | |
return Reflect.defineProperty(target, key, descriptor); | |
} | |
}; | |
function normalizePropsOrEmits(props) { | |
return isArray$1(props) ? props.reduce( | |
(normalized, p2) => (normalized[p2] = null, normalized), | |
{} | |
) : props; | |
} | |
let shouldCacheAccess = true; | |
function applyOptions(instance) { | |
const options = resolveMergedOptions(instance); | |
const publicThis = instance.proxy; | |
const ctx = instance.ctx; | |
shouldCacheAccess = false; | |
if (options.beforeCreate) { | |
callHook(options.beforeCreate, instance, "bc"); | |
} | |
const { | |
// state | |
data: dataOptions, | |
computed: computedOptions, | |
methods, | |
watch: watchOptions, | |
provide: provideOptions, | |
inject: injectOptions, | |
// lifecycle | |
created, | |
beforeMount, | |
mounted, | |
beforeUpdate, | |
updated, | |
activated, | |
deactivated, | |
beforeDestroy, | |
beforeUnmount, | |
destroyed, | |
unmounted, | |
render: render2, | |
renderTracked, | |
renderTriggered, | |
errorCaptured, | |
serverPrefetch, | |
// public API | |
expose, | |
inheritAttrs, | |
// assets | |
components, | |
directives, | |
filters | |
} = options; | |
const checkDuplicateProperties = null; | |
if (injectOptions) { | |
resolveInjections(injectOptions, ctx, checkDuplicateProperties); | |
} | |
if (methods) { | |
for (const key in methods) { | |
const methodHandler = methods[key]; | |
if (isFunction(methodHandler)) { | |
{ | |
ctx[key] = methodHandler.bind(publicThis); | |
} | |
} | |
} | |
} | |
if (dataOptions) { | |
const data = dataOptions.call(publicThis, publicThis); | |
if (!isObject(data)) | |
; | |
else { | |
instance.data = reactive(data); | |
} | |
} | |
shouldCacheAccess = true; | |
if (computedOptions) { | |
for (const key in computedOptions) { | |
const opt = computedOptions[key]; | |
const get2 = isFunction(opt) ? opt.bind(publicThis, publicThis) : isFunction(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP; | |
const set2 = !isFunction(opt) && isFunction(opt.set) ? opt.set.bind(publicThis) : NOOP; | |
const c = computed({ | |
get: get2, | |
set: set2 | |
}); | |
Object.defineProperty(ctx, key, { | |
enumerable: true, | |
configurable: true, | |
get: () => c.value, | |
set: (v) => c.value = v | |
}); | |
} | |
} | |
if (watchOptions) { | |
for (const key in watchOptions) { | |
createWatcher(watchOptions[key], ctx, publicThis, key); | |
} | |
} | |
if (provideOptions) { | |
const provides = isFunction(provideOptions) ? provideOptions.call(publicThis) : provideOptions; | |
Reflect.ownKeys(provides).forEach((key) => { | |
provide(key, provides[key]); | |
}); | |
} | |
if (created) { | |
callHook(created, instance, "c"); | |
} | |
function registerLifecycleHook(register, hook) { | |
if (isArray$1(hook)) { | |
hook.forEach((_hook) => register(_hook.bind(publicThis))); | |
} else if (hook) { | |
register(hook.bind(publicThis)); | |
} | |
} | |
registerLifecycleHook(onBeforeMount, beforeMount); | |
registerLifecycleHook(onMounted, mounted); | |
registerLifecycleHook(onBeforeUpdate, beforeUpdate); | |
registerLifecycleHook(onUpdated, updated); | |
registerLifecycleHook(onActivated, activated); | |
registerLifecycleHook(onDeactivated, deactivated); | |
registerLifecycleHook(onErrorCaptured, errorCaptured); | |
registerLifecycleHook(onRenderTracked, renderTracked); | |
registerLifecycleHook(onRenderTriggered, renderTriggered); | |
registerLifecycleHook(onBeforeUnmount, beforeUnmount); | |
registerLifecycleHook(onUnmounted, unmounted); | |
registerLifecycleHook(onServerPrefetch, serverPrefetch); | |
if (isArray$1(expose)) { | |
if (expose.length) { | |
const exposed = instance.exposed || (instance.exposed = {}); | |
expose.forEach((key) => { | |
Object.defineProperty(exposed, key, { | |
get: () => publicThis[key], | |
set: (val) => publicThis[key] = val | |
}); | |
}); | |
} else if (!instance.exposed) { | |
instance.exposed = {}; | |
} | |
} | |
if (render2 && instance.render === NOOP) { | |
instance.render = render2; | |
} | |
if (inheritAttrs != null) { | |
instance.inheritAttrs = inheritAttrs; | |
} | |
if (components) | |
instance.components = components; | |
if (directives) | |
instance.directives = directives; | |
} | |
function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP) { | |
if (isArray$1(injectOptions)) { | |
injectOptions = normalizeInject(injectOptions); | |
} | |
for (const key in injectOptions) { | |
const opt = injectOptions[key]; | |
let injected; | |
if (isObject(opt)) { | |
if ("default" in opt) { | |
injected = inject( | |
opt.from || key, | |
opt.default, | |
true | |
/* treat default function as factory */ | |
); | |
} else { | |
injected = inject(opt.from || key); | |
} | |
} else { | |
injected = inject(opt); | |
} | |
if (isRef(injected)) { | |
Object.defineProperty(ctx, key, { | |
enumerable: true, | |
configurable: true, | |
get: () => injected.value, | |
set: (v) => injected.value = v | |
}); | |
} else { | |
ctx[key] = injected; | |
} | |
} | |
} | |
function callHook(hook, instance, type) { | |
callWithAsyncErrorHandling( | |
isArray$1(hook) ? hook.map((h) => h.bind(instance.proxy)) : hook.bind(instance.proxy), | |
instance, | |
type | |
); | |
} | |
function createWatcher(raw, ctx, publicThis, key) { | |
const getter = key.includes(".") ? createPathGetter(publicThis, key) : () => publicThis[key]; | |
if (isString(raw)) { | |
const handler = ctx[raw]; | |
if (isFunction(handler)) { | |
watch(getter, handler); | |
} | |
} else if (isFunction(raw)) { | |
watch(getter, raw.bind(publicThis)); | |
} else if (isObject(raw)) { | |
if (isArray$1(raw)) { | |
raw.forEach((r) => createWatcher(r, ctx, publicThis, key)); | |
} else { | |
const handler = isFunction(raw.handler) ? raw.handler.bind(publicThis) : ctx[raw.handler]; | |
if (isFunction(handler)) { | |
watch(getter, handler, raw); | |
} | |
} | |
} else | |
; | |
} | |
function resolveMergedOptions(instance) { | |
const base = instance.type; | |
const { mixins, extends: extendsOptions } = base; | |
const { | |
mixins: globalMixins, | |
optionsCache: cache, | |
config: { optionMergeStrategies } | |
} = instance.appContext; | |
const cached = cache.get(base); | |
let resolved; | |
if (cached) { | |
resolved = cached; | |
} else if (!globalMixins.length && !mixins && !extendsOptions) { | |
{ | |
resolved = base; | |
} | |
} else { | |
resolved = {}; | |
if (globalMixins.length) { | |
globalMixins.forEach( | |
(m) => mergeOptions(resolved, m, optionMergeStrategies, true) | |
); | |
} | |
mergeOptions(resolved, base, optionMergeStrategies); | |
} | |
if (isObject(base)) { | |
cache.set(base, resolved); | |
} | |
return resolved; | |
} | |
function mergeOptions(to, from2, strats, asMixin = false) { | |
const { mixins, extends: extendsOptions } = from2; | |
if (extendsOptions) { | |
mergeOptions(to, extendsOptions, strats, true); | |
} | |
if (mixins) { | |
mixins.forEach( | |
(m) => mergeOptions(to, m, strats, true) | |
); | |
} | |
for (const key in from2) { | |
if (asMixin && key === "expose") | |
; | |
else { | |
const strat = internalOptionMergeStrats[key] || strats && strats[key]; | |
to[key] = strat ? strat(to[key], from2[key]) : from2[key]; | |
} | |
} | |
return to; | |
} | |
const internalOptionMergeStrats = { | |
data: mergeDataFn, | |
props: mergeEmitsOrPropsOptions, | |
emits: mergeEmitsOrPropsOptions, | |
// objects | |
methods: mergeObjectOptions, | |
computed: mergeObjectOptions, | |
// lifecycle | |
beforeCreate: mergeAsArray, | |
created: mergeAsArray, | |
beforeMount: mergeAsArray, | |
mounted: mergeAsArray, | |
beforeUpdate: mergeAsArray, | |
updated: mergeAsArray, | |
beforeDestroy: mergeAsArray, | |
beforeUnmount: mergeAsArray, | |
destroyed: mergeAsArray, | |
unmounted: mergeAsArray, | |
activated: mergeAsArray, | |
deactivated: mergeAsArray, | |
errorCaptured: mergeAsArray, | |
serverPrefetch: mergeAsArray, | |
// assets | |
components: mergeObjectOptions, | |
directives: mergeObjectOptions, | |
// watch | |
watch: mergeWatchOptions, | |
// provide / inject | |
provide: mergeDataFn, | |
inject: mergeInject | |
}; | |
function mergeDataFn(to, from2) { | |
if (!from2) { | |
return to; | |
} | |
if (!to) { | |
return from2; | |
} | |
return function mergedDataFn() { | |
return extend( | |
isFunction(to) ? to.call(this, this) : to, | |
isFunction(from2) ? from2.call(this, this) : from2 | |
); | |
}; | |
} | |
function mergeInject(to, from2) { | |
return mergeObjectOptions(normalizeInject(to), normalizeInject(from2)); | |
} | |
function normalizeInject(raw) { | |
if (isArray$1(raw)) { | |
const res = {}; | |
for (let i = 0; i < raw.length; i++) { | |
res[raw[i]] = raw[i]; | |
} | |
return res; | |
} | |
return raw; | |
} | |
function mergeAsArray(to, from2) { | |
return to ? [...new Set([].concat(to, from2))] : from2; | |
} | |
function mergeObjectOptions(to, from2) { | |
return to ? extend(/* @__PURE__ */ Object.create(null), to, from2) : from2; | |
} | |
function mergeEmitsOrPropsOptions(to, from2) { | |
if (to) { | |
if (isArray$1(to) && isArray$1(from2)) { | |
return [.../* @__PURE__ */ new Set([...to, ...from2])]; | |
} | |
return extend( | |
/* @__PURE__ */ Object.create(null), | |
normalizePropsOrEmits(to), | |
normalizePropsOrEmits(from2 != null ? from2 : {}) | |
); | |
} else { | |
return from2; | |
} | |
} | |
function mergeWatchOptions(to, from2) { | |
if (!to) | |
return from2; | |
if (!from2) | |
return to; | |
const merged = extend(/* @__PURE__ */ Object.create(null), to); | |
for (const key in from2) { | |
merged[key] = mergeAsArray(to[key], from2[key]); | |
} | |
return merged; | |
} | |
function createAppContext() { | |
return { | |
app: null, | |
config: { | |
isNativeTag: NO, | |
performance: false, | |
globalProperties: {}, | |
optionMergeStrategies: {}, | |
errorHandler: void 0, | |
warnHandler: void 0, | |
compilerOptions: {} | |
}, | |
mixins: [], | |
components: {}, | |
directives: {}, | |
provides: /* @__PURE__ */ Object.create(null), | |
optionsCache: /* @__PURE__ */ new WeakMap(), | |
propsCache: /* @__PURE__ */ new WeakMap(), | |
emitsCache: /* @__PURE__ */ new WeakMap() | |
}; | |
} | |
let uid$1 = 0; | |
function createAppAPI(render2, hydrate) { | |
return function createApp(rootComponent, rootProps = null) { | |
if (!isFunction(rootComponent)) { | |
rootComponent = extend({}, rootComponent); | |
} | |
if (rootProps != null && !isObject(rootProps)) { | |
rootProps = null; | |
} | |
const context = createAppContext(); | |
const installedPlugins = /* @__PURE__ */ new WeakSet(); | |
let isMounted = false; | |
const app = context.app = { | |
_uid: uid$1++, | |
_component: rootComponent, | |
_props: rootProps, | |
_container: null, | |
_context: context, | |
_instance: null, | |
version, | |
get config() { | |
return context.config; | |
}, | |
set config(v) { | |
}, | |
use(plugin, ...options) { | |
if (installedPlugins.has(plugin)) | |
; | |
else if (plugin && isFunction(plugin.install)) { | |
installedPlugins.add(plugin); | |
plugin.install(app, ...options); | |
} else if (isFunction(plugin)) { | |
installedPlugins.add(plugin); | |
plugin(app, ...options); | |
} else | |
; | |
return app; | |
}, | |
mixin(mixin) { | |
if (__VUE_OPTIONS_API__) { | |
if (!context.mixins.includes(mixin)) { | |
context.mixins.push(mixin); | |
} | |
} | |
return app; | |
}, | |
component(name, component) { | |
if (!component) { | |
return context.components[name]; | |
} | |
context.components[name] = component; | |
return app; | |
}, | |
directive(name, directive) { | |
if (!directive) { | |
return context.directives[name]; | |
} | |
context.directives[name] = directive; | |
return app; | |
}, | |
mount(rootContainer, isHydrate, isSVG) { | |
if (!isMounted) { | |
const vnode = createVNode(rootComponent, rootProps); | |
vnode.appContext = context; | |
if (isHydrate && hydrate) { | |
hydrate(vnode, rootContainer); | |
} else { | |
render2(vnode, rootContainer, isSVG); | |
} | |
isMounted = true; | |
app._container = rootContainer; | |
rootContainer.__vue_app__ = app; | |
if (__VUE_PROD_DEVTOOLS__) { | |
app._instance = vnode.component; | |
devtoolsInitApp(app, version); | |
} | |
return getExposeProxy(vnode.component) || vnode.component.proxy; | |
} | |
}, | |
unmount() { | |
if (isMounted) { | |
render2(null, app._container); | |
if (__VUE_PROD_DEVTOOLS__) { | |
app._instance = null; | |
devtoolsUnmountApp(app); | |
} | |
delete app._container.__vue_app__; | |
} | |
}, | |
provide(key, value) { | |
context.provides[key] = value; | |
return app; | |
}, | |
runWithContext(fn) { | |
currentApp = app; | |
try { | |
return fn(); | |
} finally { | |
currentApp = null; | |
} | |
} | |
}; | |
return app; | |
}; | |
} | |
let currentApp = null; | |
function provide(key, value) { | |
if (!currentInstance) | |
; | |
else { | |
let provides = currentInstance.provides; | |
const parentProvides = currentInstance.parent && currentInstance.parent.provides; | |
if (parentProvides === provides) { | |
provides = currentInstance.provides = Object.create(parentProvides); | |
} | |
provides[key] = value; | |
} | |
} | |
function inject(key, defaultValue, treatDefaultAsFactory = false) { | |
const instance = currentInstance || currentRenderingInstance; | |
if (instance || currentApp) { | |
const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : currentApp._context.provides; | |
if (provides && key in provides) { | |
return provides[key]; | |
} else if (arguments.length > 1) { | |
return treatDefaultAsFactory && isFunction(defaultValue) ? defaultValue.call(instance && instance.proxy) : defaultValue; | |
} else | |
; | |
} | |
} | |
function initProps(instance, rawProps, isStateful, isSSR = false) { | |
const props = {}; | |
const attrs = {}; | |
def(attrs, InternalObjectKey, 1); | |
instance.propsDefaults = /* @__PURE__ */ Object.create(null); | |
setFullProps(instance, rawProps, props, attrs); | |
for (const key in instance.propsOptions[0]) { | |
if (!(key in props)) { | |
props[key] = void 0; | |
} | |
} | |
if (isStateful) { | |
instance.props = isSSR ? props : shallowReactive(props); | |
} else { | |
if (!instance.type.props) { | |
instance.props = attrs; | |
} else { | |
instance.props = props; | |
} | |
} | |
instance.attrs = attrs; | |
} | |
function updateProps(instance, rawProps, rawPrevProps, optimized) { | |
const { | |
props, | |
attrs, | |
vnode: { patchFlag } | |
} = instance; | |
const rawCurrentProps = toRaw(props); | |
const [options] = instance.propsOptions; | |
let hasAttrsChanged = false; | |
if ( | |
// always force full diff in dev | |
// - #1942 if hmr is enabled with sfc component | |
// - vite#872 non-sfc component used by sfc component | |
(optimized || patchFlag > 0) && !(patchFlag & 16) | |
) { | |
if (patchFlag & 8) { | |
const propsToUpdate = instance.vnode.dynamicProps; | |
for (let i = 0; i < propsToUpdate.length; i++) { | |
let key = propsToUpdate[i]; | |
if (isEmitListener(instance.emitsOptions, key)) { | |
continue; | |
} | |
const value = rawProps[key]; | |
if (options) { | |
if (hasOwn(attrs, key)) { | |
if (value !== attrs[key]) { | |
attrs[key] = value; | |
hasAttrsChanged = true; | |
} | |
} else { | |
const camelizedKey = camelize(key); | |
props[camelizedKey] = resolvePropValue( | |
options, | |
rawCurrentProps, | |
camelizedKey, | |
value, | |
instance, | |
false | |
/* isAbsent */ | |
); | |
} | |
} else { | |
if (value !== attrs[key]) { | |
attrs[key] = value; | |
hasAttrsChanged = true; | |
} | |
} | |
} | |
} | |
} else { | |
if (setFullProps(instance, rawProps, props, attrs)) { | |
hasAttrsChanged = true; | |
} | |
let kebabKey; | |
for (const key in rawCurrentProps) { | |
if (!rawProps || // for camelCase | |
!hasOwn(rawProps, key) && // it's possible the original props was passed in as kebab-case | |
// and converted to camelCase (#955) | |
((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey))) { | |
if (options) { | |
if (rawPrevProps && // for camelCase | |
(rawPrevProps[key] !== void 0 || // for kebab-case | |
rawPrevProps[kebabKey] !== void 0)) { | |
props[key] = resolvePropValue( | |
options, | |
rawCurrentProps, | |
key, | |
void 0, | |
instance, | |
true | |
/* isAbsent */ | |
); | |
} | |
} else { | |
delete props[key]; | |
} | |
} | |
} | |
if (attrs !== rawCurrentProps) { | |
for (const key in attrs) { | |
if (!rawProps || !hasOwn(rawProps, key) && true) { | |
delete attrs[key]; | |
hasAttrsChanged = true; | |
} | |
} | |
} | |
} | |
if (hasAttrsChanged) { | |
trigger(instance, "set", "$attrs"); | |
} | |
} | |
function setFullProps(instance, rawProps, props, attrs) { | |
const [options, needCastKeys] = instance.propsOptions; | |
let hasAttrsChanged = false; | |
let rawCastValues; | |
if (rawProps) { | |
for (let key in rawProps) { | |
if (isReservedProp(key)) { | |
continue; | |
} | |
const value = rawProps[key]; | |
let camelKey; | |
if (options && hasOwn(options, camelKey = camelize(key))) { | |
if (!needCastKeys || !needCastKeys.includes(camelKey)) { | |
props[camelKey] = value; | |
} else { | |
(rawCastValues || (rawCastValues = {}))[camelKey] = value; | |
} | |
} else if (!isEmitListener(instance.emitsOptions, key)) { | |
if (!(key in attrs) || value !== attrs[key]) { | |
attrs[key] = value; | |
hasAttrsChanged = true; | |
} | |
} | |
} | |
} | |
if (needCastKeys) { | |
const rawCurrentProps = toRaw(props); | |
const castValues = rawCastValues || EMPTY_OBJ; | |
for (let i = 0; i < needCastKeys.length; i++) { | |
const key = needCastKeys[i]; | |
props[key] = resolvePropValue( | |
options, | |
rawCurrentProps, | |
key, | |
castValues[key], | |
instance, | |
!hasOwn(castValues, key) | |
); | |
} | |
} | |
return hasAttrsChanged; | |
} | |
function resolvePropValue(options, props, key, value, instance, isAbsent) { | |
const opt = options[key]; | |
if (opt != null) { | |
const hasDefault = hasOwn(opt, "default"); | |
if (hasDefault && value === void 0) { | |
const defaultValue = opt.default; | |
if (opt.type !== Function && !opt.skipFactory && isFunction(defaultValue)) { | |
const { propsDefaults } = instance; | |
if (key in propsDefaults) { | |
value = propsDefaults[key]; | |
} else { | |
setCurrentInstance(instance); | |
value = propsDefaults[key] = defaultValue.call( | |
null, | |
props | |
); | |
unsetCurrentInstance(); | |
} | |
} else { | |
value = defaultValue; | |
} | |
} | |
if (opt[ | |
0 | |
/* shouldCast */ | |
]) { | |
if (isAbsent && !hasDefault) { | |
value = false; | |
} else if (opt[ | |
1 | |
/* shouldCastTrue */ | |
] && (value === "" || value === hyphenate(key))) { | |
value = true; | |
} | |
} | |
} | |
return value; | |
} | |
function normalizePropsOptions(comp, appContext, asMixin = false) { | |
const cache = appContext.propsCache; | |
const cached = cache.get(comp); | |
if (cached) { | |
return cached; | |
} | |
const raw = comp.props; | |
const normalized = {}; | |
const needCastKeys = []; | |
let hasExtends = false; | |
if (__VUE_OPTIONS_API__ && !isFunction(comp)) { | |
const extendProps = (raw2) => { | |
hasExtends = true; | |
const [props, keys] = normalizePropsOptions(raw2, appContext, true); | |
extend(normalized, props); | |
if (keys) | |
needCastKeys.push(...keys); | |
}; | |
if (!asMixin && appContext.mixins.length) { | |
appContext.mixins.forEach(extendProps); | |
} | |
if (comp.extends) { | |
extendProps(comp.extends); | |
} | |
if (comp.mixins) { | |
comp.mixins.forEach(extendProps); | |
} | |
} | |
if (!raw && !hasExtends) { | |
if (isObject(comp)) { | |
cache.set(comp, EMPTY_ARR); | |
} | |
return EMPTY_ARR; | |
} | |
if (isArray$1(raw)) { | |
for (let i = 0; i < raw.length; i++) { | |
const normalizedKey = camelize(raw[i]); | |
if (validatePropName(normalizedKey)) { | |
normalized[normalizedKey] = EMPTY_OBJ; | |
} | |
} | |
} else if (raw) { | |
for (const key in raw) { | |
const normalizedKey = camelize(key); | |
if (validatePropName(normalizedKey)) { | |
const opt = raw[key]; | |
const prop = normalized[normalizedKey] = isArray$1(opt) || isFunction(opt) ? { type: opt } : extend({}, opt); | |
if (prop) { | |
const booleanIndex = getTypeIndex(Boolean, prop.type); | |
const stringIndex = getTypeIndex(String, prop.type); | |
prop[ | |
0 | |
/* shouldCast */ | |
] = booleanIndex > -1; | |
prop[ | |
1 | |
/* shouldCastTrue */ | |
] = stringIndex < 0 || booleanIndex < stringIndex; | |
if (booleanIndex > -1 || hasOwn(prop, "default")) { | |
needCastKeys.push(normalizedKey); | |
} | |
} | |
} | |
} | |
} | |
const res = [normalized, needCastKeys]; | |
if (isObject(comp)) { | |
cache.set(comp, res); | |
} | |
return res; | |
} | |
function validatePropName(key) { | |
if (key[0] !== "$") { | |
return true; | |
} | |
return false; | |
} | |
function getType(ctor) { | |
const match = ctor && ctor.toString().match(/^\s*(function|class) (\w+)/); | |
return match ? match[2] : ctor === null ? "null" : ""; | |
} | |
function isSameType(a, b) { | |
return getType(a) === getType(b); | |
} | |
function getTypeIndex(type, expectedTypes) { | |
if (isArray$1(expectedTypes)) { | |
return expectedTypes.findIndex((t) => isSameType(t, type)); | |
} else if (isFunction(expectedTypes)) { | |
return isSameType(expectedTypes, type) ? 0 : -1; | |
} | |
return -1; | |
} | |
const isInternalKey = (key) => key[0] === "_" || key === "$stable"; | |
const normalizeSlotValue = (value) => isArray$1(value) ? value.map(normalizeVNode) : [normalizeVNode(value)]; | |
const normalizeSlot = (key, rawSlot, ctx) => { | |
if (rawSlot._n) { | |
return rawSlot; | |
} | |
const normalized = withCtx((...args) => { | |
if (false) | |
; | |
return normalizeSlotValue(rawSlot(...args)); | |
}, ctx); | |
normalized._c = false; | |
return normalized; | |
}; | |
const normalizeObjectSlots = (rawSlots, slots, instance) => { | |
const ctx = rawSlots._ctx; | |
for (const key in rawSlots) { | |
if (isInternalKey(key)) | |
continue; | |
const value = rawSlots[key]; | |
if (isFunction(value)) { | |
slots[key] = normalizeSlot(key, value, ctx); | |
} else if (value != null) { | |
const normalized = normalizeSlotValue(value); | |
slots[key] = () => normalized; | |
} | |
} | |
}; | |
const normalizeVNodeSlots = (instance, children) => { | |
const normalized = normalizeSlotValue(children); | |
instance.slots.default = () => normalized; | |
}; | |
const initSlots = (instance, children) => { | |
if (instance.vnode.shapeFlag & 32) { | |
const type = children._; | |
if (type) { | |
instance.slots = toRaw(children); | |
def(children, "_", type); | |
} else { | |
normalizeObjectSlots( | |
children, | |
instance.slots = {} | |
); | |
} | |
} else { | |
instance.slots = {}; | |
if (children) { | |
normalizeVNodeSlots(instance, children); | |
} | |
} | |
def(instance.slots, InternalObjectKey, 1); | |
}; | |
const updateSlots = (instance, children, optimized) => { | |
const { vnode, slots } = instance; | |
let needDeletionCheck = true; | |
let deletionComparisonTarget = EMPTY_OBJ; | |
if (vnode.shapeFlag & 32) { | |
const type = children._; | |
if (type) { | |
if (optimized && type === 1) { | |
needDeletionCheck = false; | |
} else { | |
extend(slots, children); | |
if (!optimized && type === 1) { | |
delete slots._; | |
} | |
} | |
} else { | |
needDeletionCheck = !children.$stable; | |
normalizeObjectSlots(children, slots); | |
} | |
deletionComparisonTarget = children; | |
} else if (children) { | |
normalizeVNodeSlots(instance, children); | |
deletionComparisonTarget = { default: 1 }; | |
} | |
if (needDeletionCheck) { | |
for (const key in slots) { | |
if (!isInternalKey(key) && deletionComparisonTarget[key] == null) { | |
delete slots[key]; | |
} | |
} | |
} | |
}; | |
function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) { | |
if (isArray$1(rawRef)) { | |
rawRef.forEach( | |
(r, i) => setRef( | |
r, | |
oldRawRef && (isArray$1(oldRawRef) ? oldRawRef[i] : oldRawRef), | |
parentSuspense, | |
vnode, | |
isUnmount | |
) | |
); | |
return; | |
} | |
if (isAsyncWrapper(vnode) && !isUnmount) { | |
return; | |
} | |
const refValue = vnode.shapeFlag & 4 ? getExposeProxy(vnode.component) || vnode.component.proxy : vnode.el; | |
const value = isUnmount ? null : refValue; | |
const { i: owner, r: ref2 } = rawRef; | |
const oldRef = oldRawRef && oldRawRef.r; | |
const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs; | |
const setupState = owner.setupState; | |
if (oldRef != null && oldRef !== ref2) { | |
if (isString(oldRef)) { | |
refs[oldRef] = null; | |
if (hasOwn(setupState, oldRef)) { | |
setupState[oldRef] = null; | |
} | |
} else if (isRef(oldRef)) { | |
oldRef.value = null; | |
} | |
} | |
if (isFunction(ref2)) { | |
callWithErrorHandling(ref2, owner, 12, [value, refs]); | |
} else { | |
const _isString = isString(ref2); | |
const _isRef = isRef(ref2); | |
if (_isString || _isRef) { | |
const doSet = () => { | |
if (rawRef.f) { | |
const existing = _isString ? hasOwn(setupState, ref2) ? setupState[ref2] : refs[ref2] : ref2.value; | |
if (isUnmount) { | |
isArray$1(existing) && remove(existing, refValue); | |
} else { | |
if (!isArray$1(existing)) { | |
if (_isString) { | |
refs[ref2] = [refValue]; | |
if (hasOwn(setupState, ref2)) { | |
setupState[ref2] = refs[ref2]; | |
} | |
} else { | |
ref2.value = [refValue]; | |
if (rawRef.k) | |
refs[rawRef.k] = ref2.value; | |
} | |
} else if (!existing.includes(refValue)) { | |
existing.push(refValue); | |
} | |
} | |
} else if (_isString) { | |
refs[ref2] = value; | |
if (hasOwn(setupState, ref2)) { | |
setupState[ref2] = value; | |
} | |
} else if (_isRef) { | |
ref2.value = value; | |
if (rawRef.k) | |
refs[rawRef.k] = value; | |
} else | |
; | |
}; | |
if (value) { | |
doSet.id = -1; | |
queuePostRenderEffect(doSet, parentSuspense); | |
} else { | |
doSet(); | |
} | |
} | |
} | |
} | |
function initFeatureFlags() { | |
if (typeof __VUE_OPTIONS_API__ !== "boolean") { | |
getGlobalThis$1().__VUE_OPTIONS_API__ = true; | |
} | |
if (typeof __VUE_PROD_DEVTOOLS__ !== "boolean") { | |
getGlobalThis$1().__VUE_PROD_DEVTOOLS__ = false; | |
} | |
} | |
const queuePostRenderEffect = queueEffectWithSuspense; | |
function createRenderer(options) { | |
return baseCreateRenderer(options); | |
} | |
function baseCreateRenderer(options, createHydrationFns) { | |
{ | |
initFeatureFlags(); | |
} | |
const target = getGlobalThis$1(); | |
target.__VUE__ = true; | |
if (__VUE_PROD_DEVTOOLS__) { | |
setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target); | |
} | |
const { | |
insert: hostInsert, | |
remove: hostRemove, | |
patchProp: hostPatchProp, | |
createElement: hostCreateElement, | |
createText: hostCreateText, | |
createComment: hostCreateComment, | |
setText: hostSetText, | |
setElementText: hostSetElementText, | |
parentNode: hostParentNode, | |
nextSibling: hostNextSibling, | |
setScopeId: hostSetScopeId = NOOP, | |
insertStaticContent: hostInsertStaticContent | |
} = options; | |
const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, isSVG = false, slotScopeIds = null, optimized = !!n2.dynamicChildren) => { | |
if (n1 === n2) { | |
return; | |
} | |
if (n1 && !isSameVNodeType(n1, n2)) { | |
anchor = getNextHostNode(n1); | |
unmount(n1, parentComponent, parentSuspense, true); | |
n1 = null; | |
} | |
if (n2.patchFlag === -2) { | |
optimized = false; | |
n2.dynamicChildren = null; | |
} | |
const { type, ref: ref2, shapeFlag } = n2; | |
switch (type) { | |
case Text: | |
processText(n1, n2, container, anchor); | |
break; | |
case Comment: | |
processCommentNode(n1, n2, container, anchor); | |
break; | |
case Static: | |
if (n1 == null) { | |
mountStaticNode(n2, container, anchor, isSVG); | |
} | |
break; | |
case Fragment: | |
processFragment( | |
n1, | |
n2, | |
container, | |
anchor, | |
parentComponent, | |
parentSuspense, | |
isSVG, | |
slotScopeIds, | |
optimized | |
); | |
break; | |
default: | |
if (shapeFlag & 1) { | |
processElement( | |
n1, | |
n2, | |
container, | |
anchor, | |
parentComponent, | |
parentSuspense, | |
isSVG, | |
slotScopeIds, | |
optimized | |
); | |
} else if (shapeFlag & 6) { | |
processComponent( | |
n1, | |
n2, | |
container, | |
anchor, | |
parentComponent, | |
parentSuspense, | |
isSVG, | |
slotScopeIds, | |
optimized | |
); | |
} else if (shapeFlag & 64) { | |
type.process( | |
n1, | |
n2, | |
container, | |
anchor, | |
parentComponent, | |
parentSuspense, | |
isSVG, | |
slotScopeIds, | |
optimized, | |
internals | |
); | |
} else if (shapeFlag & 128) { | |
type.process( | |
n1, | |
n2, | |
container, | |
anchor, | |
parentComponent, | |
parentSuspense, | |
isSVG, | |
slotScopeIds, | |
optimized, | |
internals | |
); | |
} else | |
; | |
} | |
if (ref2 != null && parentComponent) { | |
setRef(ref2, n1 && n1.ref, parentSuspense, n2 || n1, !n2); | |
} | |
}; | |
const processText = (n1, n2, container, anchor) => { | |
if (n1 == null) { | |
hostInsert( | |
n2.el = hostCreateText(n2.children), | |
container, | |
anchor | |
); | |
} else { | |
const el = n2.el = n1.el; | |
if (n2.children !== n1.children) { | |
hostSetText(el, n2.children); | |
} | |
} | |
}; | |
const processCommentNode = (n1, n2, container, anchor) => { | |
if (n1 == null) { | |
hostInsert( | |
n2.el = hostCreateComment(n2.children || ""), | |
container, | |
anchor | |
); | |
} else { | |
n2.el = n1.el; | |
} | |
}; | |
const mountStaticNode = (n2, container, anchor, isSVG) => { | |
[n2.el, n2.anchor] = hostInsertStaticContent( | |
n2.children, | |
container, | |
anchor, | |
isSVG, | |
n2.el, | |
n2.anchor | |
); | |
}; | |
const moveStaticNode = ({ el, anchor }, container, nextSibling) => { | |
let next; | |
while (el && el !== anchor) { | |
next = hostNextSibling(el); | |
hostInsert(el, container, nextSibling); | |
el = next; | |
} | |
hostInsert(anchor, container, nextSibling); | |
}; | |
const removeStaticNode = ({ el, anchor }) => { | |
let next; | |
while (el && el !== anchor) { | |
next = hostNextSibling(el); | |
hostRemove(el); | |
el = next; | |
} | |
hostRemove(anchor); | |
}; | |
const processElement = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => { | |
isSVG = isSVG || n2.type === "svg"; | |
if (n1 == null) { | |
mountElement( | |
n2, | |
container, | |
anchor, | |
parentComponent, | |
parentSuspense, | |
isSVG, | |
slotScopeIds, | |
optimized | |
); | |
} else { | |
patchElement( | |
n1, | |
n2, | |
parentComponent, | |
parentSuspense, | |
isSVG, | |
slotScopeIds, | |
optimized | |
); | |
} | |
}; | |
const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => { | |
let el; | |
let vnodeHook; | |
const { type, props, shapeFlag, transition, dirs } = vnode; | |
el = vnode.el = hostCreateElement( | |
vnode.type, | |
isSVG, | |
props && props.is, | |
props | |
); | |
if (shapeFlag & 8) { | |
hostSetElementText(el, vnode.children); | |
} else if (shapeFlag & 16) { | |
mountChildren( | |
vnode.children, | |
el, | |
null, | |
parentComponent, | |
parentSuspense, | |
isSVG && type !== "foreignObject", | |
slotScopeIds, | |
optimized | |
); | |
} | |
if (dirs) { | |
invokeDirectiveHook(vnode, null, parentComponent, "created"); | |
} | |
setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent); | |
if (props) { | |
for (const key in props) { | |
if (key !== "value" && !isReservedProp(key)) { | |
hostPatchProp( | |
el, | |
key, | |
null, | |
props[key], | |
isSVG, | |
vnode.children, | |
parentComponent, | |
parentSuspense, | |
unmountChildren | |
); | |
} | |
} | |
if ("value" in props) { | |
hostPatchProp(el, "value", null, props.value); | |
} | |
if (vnodeHook = props.onVnodeBeforeMount) { | |
invokeVNodeHook(vnodeHook, parentComponent, vnode); | |
} | |
} | |
if (__VUE_PROD_DEVTOOLS__) { | |
Object.defineProperty(el, "__vnode", { | |
value: vnode, | |
enumerable: false | |
}); | |
Object.defineProperty(el, "__vueParentComponent", { | |
value: parentComponent, | |
enumerable: false | |
}); | |
} | |
if (dirs) { | |
invokeDirectiveHook(vnode, null, parentComponent, "beforeMount"); | |
} | |
const needCallTransitionHooks = needTransition(parentSuspense, transition); | |
if (needCallTransitionHooks) { | |
transition.beforeEnter(el); | |
} | |
hostInsert(el, container, anchor); | |
if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) { | |
queuePostRenderEffect(() => { | |
vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode); | |
needCallTransitionHooks && transition.enter(el); | |
dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted"); | |
}, parentSuspense); | |
} | |
}; | |
const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => { | |
if (scopeId) { | |
hostSetScopeId(el, scopeId); | |
} | |
if (slotScopeIds) { | |
for (let i = 0; i < slotScopeIds.length; i++) { | |
hostSetScopeId(el, slotScopeIds[i]); | |
} | |
} | |
if (parentComponent) { | |
let subTree = parentComponent.subTree; | |
if (vnode === subTree) { | |
const parentVNode = parentComponent.vnode; | |
setScopeId( | |
el, | |
parentVNode, | |
parentVNode.scopeId, | |
parentVNode.slotScopeIds, | |
parentComponent.parent | |
); | |
} | |
} | |
}; | |
const mountChildren = (children, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, start = 0) => { | |
for (let i = start; i < children.length; i++) { | |
const child = children[i] = optimized ? cloneIfMounted(children[i]) : normalizeVNode(children[i]); | |
patch( | |
null, | |
child, | |
container, | |
anchor, | |
parentComponent, | |
parentSuspense, | |
isSVG, | |
slotScopeIds, | |
optimized | |
); | |
} | |
}; | |
const patchElement = (n1, n2, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => { | |
const el = n2.el = n1.el; | |
let { patchFlag, dynamicChildren, dirs } = n2; | |
patchFlag |= n1.patchFlag & 16; | |
const oldProps = n1.props || EMPTY_OBJ; | |
const newProps = n2.props || EMPTY_OBJ; | |
let vnodeHook; | |
parentComponent && toggleRecurse(parentComponent, false); | |
if (vnodeHook = newProps.onVnodeBeforeUpdate) { | |
invokeVNodeHook(vnodeHook, parentComponent, n2, n1); | |
} | |
if (dirs) { | |
invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate"); | |
} | |
parentComponent && toggleRecurse(parentComponent, true); | |
const areChildrenSVG = isSVG && n2.type !== "foreignObject"; | |
if (dynamicChildren) { | |
patchBlockChildren( | |
n1.dynamicChildren, | |
dynamicChildren, | |
el, | |
parentComponent, | |
parentSuspense, | |
areChildrenSVG, | |
slotScopeIds | |
); | |
} else if (!optimized) { | |
patchChildren( | |
n1, | |
n2, | |
el, | |
null, | |
parentComponent, | |
parentSuspense, | |
areChildrenSVG, | |
slotScopeIds, | |
false | |
); | |
} | |
if (patchFlag > 0) { | |
if (patchFlag & 16) { | |
patchProps( | |
el, | |
n2, | |
oldProps, | |
newProps, | |
parentComponent, | |
parentSuspense, | |
isSVG | |
); | |
} else { | |
if (patchFlag & 2) { | |
if (oldProps.class !== newProps.class) { | |
hostPatchProp(el, "class", null, newProps.class, isSVG); | |
} | |
} | |
if (patchFlag & 4) { | |
hostPatchProp(el, "style", oldProps.style, newProps.style, isSVG); | |
} | |
if (patchFlag & 8) { | |
const propsToUpdate = n2.dynamicProps; | |
for (let i = 0; i < propsToUpdate.length; i++) { | |
const key = propsToUpdate[i]; | |
const prev = oldProps[key]; | |
const next = newProps[key]; | |
if (next !== prev || key === "value") { | |
hostPatchProp( | |
el, | |
key, | |
prev, | |
next, | |
isSVG, | |
n1.children, | |
parentComponent, | |
parentSuspense, | |
unmountChildren | |
); | |
} | |
} | |
} | |
} | |
if (patchFlag & 1) { | |
if (n1.children !== n2.children) { | |
hostSetElementText(el, n2.children); | |
} | |
} | |
} else if (!optimized && dynamicChildren == null) { | |
patchProps( | |
el, | |
n2, | |
oldProps, | |
newProps, | |
parentComponent, | |
parentSuspense, | |
isSVG | |
); | |
} | |
if ((vnodeHook = newProps.onVnodeUpdated) || dirs) { | |
queuePostRenderEffect(() => { | |
vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, n2, n1); | |
dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated"); | |
}, parentSuspense); | |
} | |
}; | |
const patchBlockChildren = (oldChildren, newChildren, fallbackContainer, parentComponent, parentSuspense, isSVG, slotScopeIds) => { | |
for (let i = 0; i < newChildren.length; i++) { | |
const oldVNode = oldChildren[i]; | |
const newVNode = newChildren[i]; | |
const container = ( | |
// oldVNode may be an errored async setup() component inside Suspense | |
// which will not have a mounted element | |
oldVNode.el && // - In the case of a Fragment, we need to provide the actual parent | |
// of the Fragment itself so it can move its children. | |
(oldVNode.type === Fragment || // - In the case of different nodes, there is going to be a replacement | |
// which also requires the correct parent container | |
!isSameVNodeType(oldVNode, newVNode) || // - In the case of a component, it could contain anything. | |
oldVNode.shapeFlag & (6 | 64)) ? hostParentNode(oldVNode.el) : ( | |
// In other cases, the parent container is not actually used so we | |
// just pass the block element here to avoid a DOM parentNode call. | |
fallbackContainer | |
) | |
); | |
patch( | |
oldVNode, | |
newVNode, | |
container, | |
null, | |
parentComponent, | |
parentSuspense, | |
isSVG, | |
slotScopeIds, | |
true | |
); | |
} | |
}; | |
const patchProps = (el, vnode, oldProps, newProps, parentComponent, parentSuspense, isSVG) => { | |
if (oldProps !== newProps) { | |
if (oldProps !== EMPTY_OBJ) { | |
for (const key in oldProps) { | |
if (!isReservedProp(key) && !(key in newProps)) { | |
hostPatchProp( | |
el, | |
key, | |
oldProps[key], | |
null, | |
isSVG, | |
vnode.children, | |
parentComponent, | |
parentSuspense, | |
unmountChildren | |
); | |
} | |
} | |
} | |
for (const key in newProps) { | |
if (isReservedProp(key)) | |
continue; | |
const next = newProps[key]; | |
const prev = oldProps[key]; | |
if (next !== prev && key !== "value") { | |
hostPatchProp( | |
el, | |
key, | |
prev, | |
next, | |
isSVG, | |
vnode.children, | |
parentComponent, | |
parentSuspense, | |
unmountChildren | |
); | |
} | |
} | |
if ("value" in newProps) { | |
hostPatchProp(el, "value", oldProps.value, newProps.value); | |
} | |
} | |
}; | |
const processFragment = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => { | |
const fragmentStartAnchor = n2.el = n1 ? n1.el : hostCreateText(""); | |
const fragmentEndAnchor = n2.anchor = n1 ? n1.anchor : hostCreateText(""); | |
let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2; | |
if (fragmentSlotScopeIds) { | |
slotScopeIds = slotScopeIds ? slotScopeIds.concat(fragmentSlotScopeIds) : fragmentSlotScopeIds; | |
} | |
if (n1 == null) { | |
hostInsert(fragmentStartAnchor, container, anchor); | |
hostInsert(fragmentEndAnchor, container, anchor); | |
mountChildren( | |
n2.children, | |
container, | |
fragmentEndAnchor, | |
parentComponent, | |
parentSuspense, | |
isSVG, | |
slotScopeIds, | |
optimized | |
); | |
} else { | |
if (patchFlag > 0 && patchFlag & 64 && dynamicChildren && // #2715 the previous fragment could've been a BAILed one as a result | |
// of renderSlot() with no valid children | |
n1.dynamicChildren) { | |
patchBlockChildren( | |
n1.dynamicChildren, | |
dynamicChildren, | |
container, | |
parentComponent, | |
parentSuspense, | |
isSVG, | |
slotScopeIds | |
); | |
if ( | |
// #2080 if the stable fragment has a key, it's a <template v-for> that may | |
// get moved around. Make sure all root level vnodes inherit el. | |
// #2134 or if it's a component root, it may also get moved around | |
// as the component is being moved. | |
n2.key != null || parentComponent && n2 === parentComponent.subTree | |
) { | |
traverseStaticChildren( | |
n1, | |
n2, | |
true | |
/* shallow */ | |
); | |
} | |
} else { | |
patchChildren( | |
n1, | |
n2, | |
container, | |
fragmentEndAnchor, | |
parentComponent, | |
parentSuspense, | |
isSVG, | |
slotScopeIds, | |
optimized | |
); | |
} | |
} | |
}; | |
const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => { | |
n2.slotScopeIds = slotScopeIds; | |
if (n1 == null) { | |
if (n2.shapeFlag & 512) { | |
parentComponent.ctx.activate( | |
n2, | |
container, | |
anchor, | |
isSVG, | |
optimized | |
); | |
} else { | |
mountComponent( | |
n2, | |
container, | |
anchor, | |
parentComponent, | |
parentSuspense, | |
isSVG, | |
optimized | |
); | |
} | |
} else { | |
updateComponent(n1, n2, optimized); | |
} | |
}; | |
const mountComponent = (initialVNode, container, anchor, parentComponent, parentSuspense, isSVG, optimized) => { | |
const instance = initialVNode.component = createComponentInstance( | |
initialVNode, | |
parentComponent, | |
parentSuspense | |
); | |
if (isKeepAlive(initialVNode)) { | |
instance.ctx.renderer = internals; | |
} | |
{ | |
setupComponent(instance); | |
} | |
if (instance.asyncDep) { | |
parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect); | |
if (!initialVNode.el) { | |
const placeholder = instance.subTree = createVNode(Comment); | |
processCommentNode(null, placeholder, container, anchor); | |
} | |
return; | |
} | |
setupRenderEffect( | |
instance, | |
initialVNode, | |
container, | |
anchor, | |
parentSuspense, | |
isSVG, | |
optimized | |
); | |
}; | |
const updateComponent = (n1, n2, optimized) => { | |
const instance = n2.component = n1.component; | |
if (shouldUpdateComponent(n1, n2, optimized)) { | |
if (instance.asyncDep && !instance.asyncResolved) { | |
updateComponentPreRender(instance, n2, optimized); | |
return; | |
} else { | |
instance.next = n2; | |
invalidateJob(instance.update); | |
instance.update(); | |
} | |
} else { | |
n2.el = n1.el; | |
instance.vnode = n2; | |
} | |
}; | |
const setupRenderEffect = (instance, initialVNode, container, anchor, parentSuspense, isSVG, optimized) => { | |
const componentUpdateFn = () => { | |
if (!instance.isMounted) { | |
let vnodeHook; | |
const { el, props } = initialVNode; | |
const { bm, m, parent } = instance; | |
const isAsyncWrapperVNode = isAsyncWrapper(initialVNode); | |
toggleRecurse(instance, false); | |
if (bm) { | |
invokeArrayFns(bm); | |
} | |
if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeBeforeMount)) { | |
invokeVNodeHook(vnodeHook, parent, initialVNode); | |
} | |
toggleRecurse(instance, true); | |
if (el && hydrateNode) { | |
const hydrateSubTree = () => { | |
instance.subTree = renderComponentRoot(instance); | |
hydrateNode( | |
el, | |
instance.subTree, | |
instance, | |
parentSuspense, | |
null | |
); | |
}; | |
if (isAsyncWrapperVNode) { | |
initialVNode.type.__asyncLoader().then( | |
// note: we are moving the render call into an async callback, | |
// which means it won't track dependencies - but it's ok because | |
// a server-rendered async wrapper is already in resolved state | |
// and it will never need to change. | |
() => !instance.isUnmounted && hydrateSubTree() | |
); | |
} else { | |
hydrateSubTree(); | |
} | |
} else { | |
const subTree = instance.subTree = renderComponentRoot(instance); | |
patch( | |
null, | |
subTree, | |
container, | |
anchor, | |
instance, | |
parentSuspense, | |
isSVG | |
); | |
initialVNode.el = subTree.el; | |
} | |
if (m) { | |
queuePostRenderEffect(m, parentSuspense); | |
} | |
if (!isAsyncWrapperVNode && (vnodeHook = props && props.onVnodeMounted)) { | |
const scopedInitialVNode = initialVNode; | |
queuePostRenderEffect( | |
() => invokeVNodeHook(vnodeHook, parent, scopedInitialVNode), | |
parentSuspense | |
); | |
} | |
if (initialVNode.shapeFlag & 256 || parent && isAsyncWrapper(parent.vnode) && parent.vnode.shapeFlag & 256) { | |
instance.a && queuePostRenderEffect(instance.a, parentSuspense); | |
} | |
instance.isMounted = true; | |
if (__VUE_PROD_DEVTOOLS__) { | |
devtoolsComponentAdded(instance); | |
} | |
initialVNode = container = anchor = null; | |
} else { | |
let { next, bu, u, parent, vnode } = instance; | |
let originNext = next; | |
let vnodeHook; | |
toggleRecurse(instance, false); | |
if (next) { | |
next.el = vnode.el; | |
updateComponentPreRender(instance, next, optimized); | |
} else { | |
next = vnode; | |
} | |
if (bu) { | |
invokeArrayFns(bu); | |
} | |
if (vnodeHook = next.props && next.props.onVnodeBeforeUpdate) { | |
invokeVNodeHook(vnodeHook, parent, next, vnode); | |
} | |
toggleRecurse(instance, true); | |
const nextTree = renderComponentRoot(instance); | |
const prevTree = instance.subTree; | |
instance.subTree = nextTree; | |
patch( | |
prevTree, | |
nextTree, | |
// parent may have changed if it's in a teleport | |
hostParentNode(prevTree.el), | |
// anchor may have changed if it's in a fragment | |
getNextHostNode(prevTree), | |
instance, | |
parentSuspense, | |
isSVG | |
); | |
next.el = nextTree.el; | |
if (originNext === null) { | |
updateHOCHostEl(instance, nextTree.el); | |
} | |
if (u) { | |
queuePostRenderEffect(u, parentSuspense); | |
} | |
if (vnodeHook = next.props && next.props.onVnodeUpdated) { | |
queuePostRenderEffect( | |
() => invokeVNodeHook(vnodeHook, parent, next, vnode), | |
parentSuspense | |
); | |
} | |
if (__VUE_PROD_DEVTOOLS__) { | |
devtoolsComponentUpdated(instance); | |
} | |
} | |
}; | |
const effect = instance.effect = new ReactiveEffect( | |
componentUpdateFn, | |
() => queueJob(update), | |
instance.scope | |
// track it in component's effect scope | |
); | |
const update = instance.update = () => effect.run(); | |
update.id = instance.uid; | |
toggleRecurse(instance, true); | |
update(); | |
}; | |
const updateComponentPreRender = (instance, nextVNode, optimized) => { | |
nextVNode.component = instance; | |
const prevProps = instance.vnode.props; | |
instance.vnode = nextVNode; | |
instance.next = null; | |
updateProps(instance, nextVNode.props, prevProps, optimized); | |
updateSlots(instance, nextVNode.children, optimized); | |
pauseTracking(); | |
flushPreFlushCbs(); | |
resetTracking(); | |
}; | |
const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized = false) => { | |
const c1 = n1 && n1.children; | |
const prevShapeFlag = n1 ? n1.shapeFlag : 0; | |
const c2 = n2.children; | |
const { patchFlag, shapeFlag } = n2; | |
if (patchFlag > 0) { | |
if (patchFlag & 128) { | |
patchKeyedChildren( | |
c1, | |
c2, | |
container, | |
anchor, | |
parentComponent, | |
parentSuspense, | |
isSVG, | |
slotScopeIds, | |
optimized | |
); | |
return; | |
} else if (patchFlag & 256) { | |
patchUnkeyedChildren( | |
c1, | |
c2, | |
container, | |
anchor, | |
parentComponent, | |
parentSuspense, | |
isSVG, | |
slotScopeIds, | |
optimized | |
); | |
return; | |
} | |
} | |
if (shapeFlag & 8) { | |
if (prevShapeFlag & 16) { | |
unmountChildren(c1, parentComponent, parentSuspense); | |
} | |
if (c2 !== c1) { | |
hostSetElementText(container, c2); | |
} | |
} else { | |
if (prevShapeFlag & 16) { | |
if (shapeFlag & 16) { | |
patchKeyedChildren( | |
c1, | |
c2, | |
container, | |
anchor, | |
parentComponent, | |
parentSuspense, | |
isSVG, | |
slotScopeIds, | |
optimized | |
); | |
} else { | |
unmountChildren(c1, parentComponent, parentSuspense, true); | |
} | |
} else { | |
if (prevShapeFlag & 8) { | |
hostSetElementText(container, ""); | |
} | |
if (shapeFlag & 16) { | |
mountChildren( | |
c2, | |
container, | |
anchor, | |
parentComponent, | |
parentSuspense, | |
isSVG, | |
slotScopeIds, | |
optimized | |
); | |
} | |
} | |
} | |
}; | |
const patchUnkeyedChildren = (c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => { | |
c1 = c1 || EMPTY_ARR; | |
c2 = c2 || EMPTY_ARR; | |
const oldLength = c1.length; | |
const newLength = c2.length; | |
const commonLength = Math.min(oldLength, newLength); | |
let i; | |
for (i = 0; i < commonLength; i++) { | |
const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]); | |
patch( | |
c1[i], | |
nextChild, | |
container, | |
null, | |
parentComponent, | |
parentSuspense, | |
isSVG, | |
slotScopeIds, | |
optimized | |
); | |
} | |
if (oldLength > newLength) { | |
unmountChildren( | |
c1, | |
parentComponent, | |
parentSuspense, | |
true, | |
false, | |
commonLength | |
); | |
} else { | |
mountChildren( | |
c2, | |
container, | |
anchor, | |
parentComponent, | |
parentSuspense, | |
isSVG, | |
slotScopeIds, | |
optimized, | |
commonLength | |
); | |
} | |
}; | |
const patchKeyedChildren = (c1, c2, container, parentAnchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => { | |
let i = 0; | |
const l2 = c2.length; | |
let e1 = c1.length - 1; | |
let e2 = l2 - 1; | |
while (i <= e1 && i <= e2) { | |
const n1 = c1[i]; | |
const n2 = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]); | |
if (isSameVNodeType(n1, n2)) { | |
patch( | |
n1, | |
n2, | |
container, | |
null, | |
parentComponent, | |
parentSuspense, | |
isSVG, | |
slotScopeIds, | |
optimized | |
); | |
} else { | |
break; | |
} | |
i++; | |
} | |
while (i <= e1 && i <= e2) { | |
const n1 = c1[e1]; | |
const n2 = c2[e2] = optimized ? cloneIfMounted(c2[e2]) : normalizeVNode(c2[e2]); | |
if (isSameVNodeType(n1, n2)) { | |
patch( | |
n1, | |
n2, | |
container, | |
null, | |
parentComponent, | |
parentSuspense, | |
isSVG, | |
slotScopeIds, | |
optimized | |
); | |
} else { | |
break; | |
} | |
e1--; | |
e2--; | |
} | |
if (i > e1) { | |
if (i <= e2) { | |
const nextPos = e2 + 1; | |
const anchor = nextPos < l2 ? c2[nextPos].el : parentAnchor; | |
while (i <= e2) { | |
patch( | |
null, | |
c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]), | |
container, | |
anchor, | |
parentComponent, | |
parentSuspense, | |
isSVG, | |
slotScopeIds, | |
optimized | |
); | |
i++; | |
} | |
} | |
} else if (i > e2) { | |
while (i <= e1) { | |
unmount(c1[i], parentComponent, parentSuspense, true); | |
i++; | |
} | |
} else { | |
const s1 = i; | |
const s2 = i; | |
const keyToNewIndexMap = /* @__PURE__ */ new Map(); | |
for (i = s2; i <= e2; i++) { | |
const nextChild = c2[i] = optimized ? cloneIfMounted(c2[i]) : normalizeVNode(c2[i]); | |
if (nextChild.key != null) { | |
keyToNewIndexMap.set(nextChild.key, i); | |
} | |
} | |
let j; | |
let patched = 0; | |
const toBePatched = e2 - s2 + 1; | |
let moved = false; | |
let maxNewIndexSoFar = 0; | |
const newIndexToOldIndexMap = new Array(toBePatched); | |
for (i = 0; i < toBePatched; i++) | |
newIndexToOldIndexMap[i] = 0; | |
for (i = s1; i <= e1; i++) { | |
const prevChild = c1[i]; | |
if (patched >= toBePatched) { | |
unmount(prevChild, parentComponent, parentSuspense, true); | |
continue; | |
} | |
let newIndex; | |
if (prevChild.key != null) { | |
newIndex = keyToNewIndexMap.get(prevChild.key); | |
} else { | |
for (j = s2; j <= e2; j++) { | |
if (newIndexToOldIndexMap[j - s2] === 0 && isSameVNodeType(prevChild, c2[j])) { | |
newIndex = j; | |
break; | |
} | |
} | |
} | |
if (newIndex === void 0) { | |
unmount(prevChild, parentComponent, parentSuspense, true); | |
} else { | |
newIndexToOldIndexMap[newIndex - s2] = i + 1; | |
if (newIndex >= maxNewIndexSoFar) { | |
maxNewIndexSoFar = newIndex; | |
} else { | |
moved = true; | |
} | |
patch( | |
prevChild, | |
c2[newIndex], | |
container, | |
null, | |
parentComponent, | |
parentSuspense, | |
isSVG, | |
slotScopeIds, | |
optimized | |
); | |
patched++; | |
} | |
} | |
const increasingNewIndexSequence = moved ? getSequence(newIndexToOldIndexMap) : EMPTY_ARR; | |
j = increasingNewIndexSequence.length - 1; | |
for (i = toBePatched - 1; i >= 0; i--) { | |
const nextIndex = s2 + i; | |
const nextChild = c2[nextIndex]; | |
const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor; | |
if (newIndexToOldIndexMap[i] === 0) { | |
patch( | |
null, | |
nextChild, | |
container, | |
anchor, | |
parentComponent, | |
parentSuspense, | |
isSVG, | |
slotScopeIds, | |
optimized | |
); | |
} else if (moved) { | |
if (j < 0 || i !== increasingNewIndexSequence[j]) { | |
move(nextChild, container, anchor, 2); | |
} else { | |
j--; | |
} | |
} | |
} | |
} | |
}; | |
const move = (vnode, container, anchor, moveType, parentSuspense = null) => { | |
const { el, type, transition, children, shapeFlag } = vnode; | |
if (shapeFlag & 6) { | |
move(vnode.component.subTree, container, anchor, moveType); | |
return; | |
} | |
if (shapeFlag & 128) { | |
vnode.suspense.move(container, anchor, moveType); | |
return; | |
} | |
if (shapeFlag & 64) { | |
type.move(vnode, container, anchor, internals); | |
return; | |
} | |
if (type === Fragment) { | |
hostInsert(el, container, anchor); | |
for (let i = 0; i < children.length; i++) { | |
move(children[i], container, anchor, moveType); | |
} | |
hostInsert(vnode.anchor, container, anchor); | |
return; | |
} | |
if (type === Static) { | |
moveStaticNode(vnode, container, anchor); | |
return; | |
} | |
const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition; | |
if (needTransition2) { | |
if (moveType === 0) { | |
transition.beforeEnter(el); | |
hostInsert(el, container, anchor); | |
queuePostRenderEffect(() => transition.enter(el), parentSuspense); | |
} else { | |
const { leave, delayLeave, afterLeave } = transition; | |
const remove22 = () => hostInsert(el, container, anchor); | |
const performLeave = () => { | |
leave(el, () => { | |
remove22(); | |
afterLeave && afterLeave(); | |
}); | |
}; | |
if (delayLeave) { | |
delayLeave(el, remove22, performLeave); | |
} else { | |
performLeave(); | |
} | |
} | |
} else { | |
hostInsert(el, container, anchor); | |
} | |
}; | |
const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => { | |
const { | |
type, | |
props, | |
ref: ref2, | |
children, | |
dynamicChildren, | |
shapeFlag, | |
patchFlag, | |
dirs | |
} = vnode; | |
if (ref2 != null) { | |
setRef(ref2, null, parentSuspense, vnode, true); | |
} | |
if (shapeFlag & 256) { | |
parentComponent.ctx.deactivate(vnode); | |
return; | |
} | |
const shouldInvokeDirs = shapeFlag & 1 && dirs; | |
const shouldInvokeVnodeHook = !isAsyncWrapper(vnode); | |
let vnodeHook; | |
if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) { | |
invokeVNodeHook(vnodeHook, parentComponent, vnode); | |
} | |
if (shapeFlag & 6) { | |
unmountComponent(vnode.component, parentSuspense, doRemove); | |
} else { | |
if (shapeFlag & 128) { | |
vnode.suspense.unmount(parentSuspense, doRemove); | |
return; | |
} | |
if (shouldInvokeDirs) { | |
invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount"); | |
} | |
if (shapeFlag & 64) { | |
vnode.type.remove( | |
vnode, | |
parentComponent, | |
parentSuspense, | |
optimized, | |
internals, | |
doRemove | |
); | |
} else if (dynamicChildren && // #1153: fast path should not be taken for non-stable (v-for) fragments | |
(type !== Fragment || patchFlag > 0 && patchFlag & 64)) { | |
unmountChildren( | |
dynamicChildren, | |
parentComponent, | |
parentSuspense, | |
false, | |
true | |
); | |
} else if (type === Fragment && patchFlag & (128 | 256) || !optimized && shapeFlag & 16) { | |
unmountChildren(children, parentComponent, parentSuspense); | |
} | |
if (doRemove) { | |
remove2(vnode); | |
} | |
} | |
if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) { | |
queuePostRenderEffect(() => { | |
vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode); | |
shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted"); | |
}, parentSuspense); | |
} | |
}; | |
const remove2 = (vnode) => { | |
const { type, el, anchor, transition } = vnode; | |
if (type === Fragment) { | |
{ | |
removeFragment(el, anchor); | |
} | |
return; | |
} | |
if (type === Static) { | |
removeStaticNode(vnode); | |
return; | |
} | |
const performRemove = () => { | |
hostRemove(el); | |
if (transition && !transition.persisted && transition.afterLeave) { | |
transition.afterLeave(); | |
} | |
}; | |
if (vnode.shapeFlag & 1 && transition && !transition.persisted) { | |
const { leave, delayLeave } = transition; | |
const performLeave = () => leave(el, performRemove); | |
if (delayLeave) { | |
delayLeave(vnode.el, performRemove, performLeave); | |
} else { | |
performLeave(); | |
} | |
} else { | |
performRemove(); | |
} | |
}; | |
const removeFragment = (cur, end) => { | |
let next; | |
while (cur !== end) { | |
next = hostNextSibling(cur); | |
hostRemove(cur); | |
cur = next; | |
} | |
hostRemove(end); | |
}; | |
const unmountComponent = (instance, parentSuspense, doRemove) => { | |
const { bum, scope, update, subTree, um } = instance; | |
if (bum) { | |
invokeArrayFns(bum); | |
} | |
scope.stop(); | |
if (update) { | |
update.active = false; | |
unmount(subTree, instance, parentSuspense, doRemove); | |
} | |
if (um) { | |
queuePostRenderEffect(um, parentSuspense); | |
} | |
queuePostRenderEffect(() => { | |
instance.isUnmounted = true; | |
}, parentSuspense); | |
if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) { | |
parentSuspense.deps--; | |
if (parentSuspense.deps === 0) { | |
parentSuspense.resolve(); | |
} | |
} | |
if (__VUE_PROD_DEVTOOLS__) { | |
devtoolsComponentRemoved(instance); | |
} | |
}; | |
const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => { | |
for (let i = start; i < children.length; i++) { | |
unmount(children[i], parentComponent, parentSuspense, doRemove, optimized); | |
} | |
}; | |
const getNextHostNode = (vnode) => { | |
if (vnode.shapeFlag & 6) { | |
return getNextHostNode(vnode.component.subTree); | |
} | |
if (vnode.shapeFlag & 128) { | |
return vnode.suspense.next(); | |
} | |
return hostNextSibling(vnode.anchor || vnode.el); | |
}; | |
const render2 = (vnode, container, isSVG) => { | |
if (vnode == null) { | |
if (container._vnode) { | |
unmount(container._vnode, null, null, true); | |
} | |
} else { | |
patch(container._vnode || null, vnode, container, null, null, null, isSVG); | |
} | |
flushPreFlushCbs(); | |
flushPostFlushCbs(); | |
container._vnode = vnode; | |
}; | |
const internals = { | |
p: patch, | |
um: unmount, | |
m: move, | |
r: remove2, | |
mt: mountComponent, | |
mc: mountChildren, | |
pc: patchChildren, | |
pbc: patchBlockChildren, | |
n: getNextHostNode, | |
o: options | |
}; | |
let hydrate; | |
let hydrateNode; | |
if (createHydrationFns) { | |
[hydrate, hydrateNode] = createHydrationFns( | |
internals | |
); | |
} | |
return { | |
render: render2, | |
hydrate, | |
createApp: createAppAPI(render2, hydrate) | |
}; | |
} | |
function toggleRecurse({ effect, update }, allowed) { | |
effect.allowRecurse = update.allowRecurse = allowed; | |
} | |
function needTransition(parentSuspense, transition) { | |
return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted; | |
} | |
function traverseStaticChildren(n1, n2, shallow = false) { | |
const ch1 = n1.children; | |
const ch2 = n2.children; | |
if (isArray$1(ch1) && isArray$1(ch2)) { | |
for (let i = 0; i < ch1.length; i++) { | |
const c1 = ch1[i]; | |
let c2 = ch2[i]; | |
if (c2.shapeFlag & 1 && !c2.dynamicChildren) { | |
if (c2.patchFlag <= 0 || c2.patchFlag === 32) { | |
c2 = ch2[i] = cloneIfMounted(ch2[i]); | |
c2.el = c1.el; | |
} | |
if (!shallow) | |
traverseStaticChildren(c1, c2); | |
} | |
if (c2.type === Text) { | |
c2.el = c1.el; | |
} | |
} | |
} | |
} | |
function getSequence(arr) { | |
const p2 = arr.slice(); | |
const result = [0]; | |
let i, j, u, v, c; | |
const len = arr.length; | |
for (i = 0; i < len; i++) { | |
const arrI = arr[i]; | |
if (arrI !== 0) { | |
j = result[result.length - 1]; | |
if (arr[j] < arrI) { | |
p2[i] = j; | |
result.push(i); | |
continue; | |
} | |
u = 0; | |
v = result.length - 1; | |
while (u < v) { | |
c = u + v >> 1; | |
if (arr[result[c]] < arrI) { | |
u = c + 1; | |
} else { | |
v = c; | |
} | |
} | |
if (arrI < arr[result[u]]) { | |
if (u > 0) { | |
p2[i] = result[u - 1]; | |
} | |
result[u] = i; | |
} | |
} | |
} | |
u = result.length; | |
v = result[u - 1]; | |
while (u-- > 0) { | |
result[u] = v; | |
v = p2[v]; | |
} | |
return result; | |
} | |
const isTeleport = (type) => type.__isTeleport; | |
const Fragment = Symbol.for("v-fgt"); | |
const Text = Symbol.for("v-txt"); | |
const Comment = Symbol.for("v-cmt"); | |
const Static = Symbol.for("v-stc"); | |
const blockStack = []; | |
let currentBlock = null; | |
function openBlock(disableTracking = false) { | |
blockStack.push(currentBlock = disableTracking ? null : []); | |
} | |
function closeBlock() { | |
blockStack.pop(); | |
currentBlock = blockStack[blockStack.length - 1] || null; | |
} | |
let isBlockTreeEnabled = 1; | |
function setBlockTracking(value) { | |
isBlockTreeEnabled += value; | |
} | |
function setupBlock(vnode) { | |
vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || EMPTY_ARR : null; | |
closeBlock(); | |
if (isBlockTreeEnabled > 0 && currentBlock) { | |
currentBlock.push(vnode); | |
} | |
return vnode; | |
} | |
function createElementBlock(type, props, children, patchFlag, dynamicProps, shapeFlag) { | |
return setupBlock( | |
createBaseVNode( | |
type, | |
props, | |
children, | |
patchFlag, | |
dynamicProps, | |
shapeFlag, | |
true | |
/* isBlock */ | |
) | |
); | |
} | |
function isVNode(value) { | |
return value ? value.__v_isVNode === true : false; | |
} | |
function isSameVNodeType(n1, n2) { | |
return n1.type === n2.type && n1.key === n2.key; | |
} | |
const InternalObjectKey = `__vInternal`; | |
const normalizeKey = ({ key }) => key != null ? key : null; | |
const normalizeRef = ({ | |
ref: ref2, | |
ref_key, | |
ref_for | |
}) => { | |
if (typeof ref2 === "number") { | |
ref2 = "" + ref2; | |
} | |
return ref2 != null ? isString(ref2) || isRef(ref2) || isFunction(ref2) ? { i: currentRenderingInstance, r: ref2, k: ref_key, f: !!ref_for } : ref2 : null; | |
}; | |
function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) { | |
const vnode = { | |
__v_isVNode: true, | |
__v_skip: true, | |
type, | |
props, | |
key: props && normalizeKey(props), | |
ref: props && normalizeRef(props), | |
scopeId: currentScopeId, | |
slotScopeIds: null, | |
children, | |
component: null, | |
suspense: null, | |
ssContent: null, | |
ssFallback: null, | |
dirs: null, | |
transition: null, | |
el: null, | |
anchor: null, | |
target: null, | |
targetAnchor: null, | |
staticCount: 0, | |
shapeFlag, | |
patchFlag, | |
dynamicProps, | |
dynamicChildren: null, | |
appContext: null, | |
ctx: currentRenderingInstance | |
}; | |
if (needFullChildrenNormalization) { | |
normalizeChildren(vnode, children); | |
if (shapeFlag & 128) { | |
type.normalize(vnode); | |
} | |
} else if (children) { | |
vnode.shapeFlag |= isString(children) ? 8 : 16; | |
} | |
if (isBlockTreeEnabled > 0 && // avoid a block node from tracking itself | |
!isBlockNode && // has current parent block | |
currentBlock && // presence of a patch flag indicates this node needs patching on updates. | |
// component nodes also should always be patched, because even if the | |
// component doesn't need to update, it needs to persist the instance on to | |
// the next vnode so that it can be properly unmounted later. | |
(vnode.patchFlag > 0 || shapeFlag & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the | |
// vnode should not be considered dynamic due to handler caching. | |
vnode.patchFlag !== 32) { | |
currentBlock.push(vnode); | |
} | |
return vnode; | |
} | |
const createVNode = _createVNode; | |
function _createVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, isBlockNode = false) { | |
if (!type || type === NULL_DYNAMIC_COMPONENT) { | |
type = Comment; | |
} | |
if (isVNode(type)) { | |
const cloned = cloneVNode( | |
type, | |
props, | |
true | |
/* mergeRef: true */ | |
); | |
if (children) { | |
normalizeChildren(cloned, children); | |
} | |
if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) { | |
if (cloned.shapeFlag & 6) { | |
currentBlock[currentBlock.indexOf(type)] = cloned; | |
} else { | |
currentBlock.push(cloned); | |
} | |
} | |
cloned.patchFlag |= -2; | |
return cloned; | |
} | |
if (isClassComponent(type)) { | |
type = type.__vccOpts; | |
} | |
if (props) { | |
props = guardReactiveProps(props); | |
let { class: klass, style: style2 } = props; | |
if (klass && !isString(klass)) { | |
props.class = normalizeClass(klass); | |
} | |
if (isObject(style2)) { | |
if (isProxy(style2) && !isArray$1(style2)) { | |
style2 = extend({}, style2); | |
} | |
props.style = normalizeStyle(style2); | |
} | |
} | |
const shapeFlag = isString(type) ? 1 : isSuspense(type) ? 128 : isTeleport(type) ? 64 : isObject(type) ? 4 : isFunction(type) ? 2 : 0; | |
return createBaseVNode( | |
type, | |
props, | |
children, | |
patchFlag, | |
dynamicProps, | |
shapeFlag, | |
isBlockNode, | |
true | |
); | |
} | |
function guardReactiveProps(props) { | |
if (!props) | |
return null; | |
return isProxy(props) || InternalObjectKey in props ? extend({}, props) : props; | |
} | |
function cloneVNode(vnode, extraProps, mergeRef = false) { | |
const { props, ref: ref2, patchFlag, children } = vnode; | |
const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props; | |
const cloned = { | |
__v_isVNode: true, | |
__v_skip: true, | |
type: vnode.type, | |
props: mergedProps, | |
key: mergedProps && normalizeKey(mergedProps), | |
ref: extraProps && extraProps.ref ? ( | |
// #2078 in the case of <component :is="vnode" ref="extra"/> | |
// if the vnode itself already has a ref, cloneVNode will need to merge | |
// the refs so the single vnode can be set on multiple refs | |
mergeRef && ref2 ? isArray$1(ref2) ? ref2.concat(normalizeRef(extraProps)) : [ref2, normalizeRef(extraProps)] : normalizeRef(extraProps) | |
) : ref2, | |
scopeId: vnode.scopeId, | |
slotScopeIds: vnode.slotScopeIds, | |
children, | |
target: vnode.target, | |
targetAnchor: vnode.targetAnchor, | |
staticCount: vnode.staticCount, | |
shapeFlag: vnode.shapeFlag, | |
// if the vnode is cloned with extra props, we can no longer assume its | |
// existing patch flag to be reliable and need to add the FULL_PROPS flag. | |
// note: preserve flag for fragments since they use the flag for children | |
// fast paths only. | |
patchFlag: extraProps && vnode.type !== Fragment ? patchFlag === -1 ? 16 : patchFlag | 16 : patchFlag, | |
dynamicProps: vnode.dynamicProps, | |
dynamicChildren: vnode.dynamicChildren, | |
appContext: vnode.appContext, | |
dirs: vnode.dirs, | |
transition: vnode.transition, | |
// These should technically only be non-null on mounted VNodes. However, | |
// they *should* be copied for kept-alive vnodes. So we just always copy | |
// them since them being non-null during a mount doesn't affect the logic as | |
// they will simply be overwritten. | |
component: vnode.component, | |
suspense: vnode.suspense, | |
ssContent: vnode.ssContent && cloneVNode(vnode.ssContent), | |
ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback), | |
el: vnode.el, | |
anchor: vnode.anchor, | |
ctx: vnode.ctx, | |
ce: vnode.ce | |
}; | |
return cloned; | |
} | |
function createTextVNode(text = " ", flag = 0) { | |
return createVNode(Text, null, text, flag); | |
} | |
function normalizeVNode(child) { | |
if (child == null || typeof child === "boolean") { | |
return createVNode(Comment); | |
} else if (isArray$1(child)) { | |
return createVNode( | |
Fragment, | |
null, | |
// #3666, avoid reference pollution when reusing vnode | |
child.slice() | |
); | |
} else if (typeof child === "object") { | |
return cloneIfMounted(child); | |
} else { | |
return createVNode(Text, null, String(child)); | |
} | |
} | |
function cloneIfMounted(child) { | |
return child.el === null && child.patchFlag !== -1 || child.memo ? child : cloneVNode(child); | |
} | |
function normalizeChildren(vnode, children) { | |
let type = 0; | |
const { shapeFlag } = vnode; | |
if (children == null) { | |
children = null; | |
} else if (isArray$1(children)) { | |
type = 16; | |
} else if (typeof children === "object") { | |
if (shapeFlag & (1 | 64)) { | |
const slot = children.default; | |
if (slot) { | |
slot._c && (slot._d = false); | |
normalizeChildren(vnode, slot()); | |
slot._c && (slot._d = true); | |
} | |
return; | |
} else { | |
type = 32; | |
const slotFlag = children._; | |
if (!slotFlag && !(InternalObjectKey in children)) { | |
children._ctx = currentRenderingInstance; | |
} else if (slotFlag === 3 && currentRenderingInstance) { | |
if (currentRenderingInstance.slots._ === 1) { | |
children._ = 1; | |
} else { | |
children._ = 2; | |
vnode.patchFlag |= 1024; | |
} | |
} | |
} | |
} else if (isFunction(children)) { | |
children = { default: children, _ctx: currentRenderingInstance }; | |
type = 32; | |
} else { | |
children = String(children); | |
if (shapeFlag & 64) { | |
type = 16; | |
children = [createTextVNode(children)]; | |
} else { | |
type = 8; | |
} | |
} | |
vnode.children = children; | |
vnode.shapeFlag |= type; | |
} | |
function mergeProps(...args) { | |
const ret = {}; | |
for (let i = 0; i < args.length; i++) { | |
const toMerge = args[i]; | |
for (const key in toMerge) { | |
if (key === "class") { | |
if (ret.class !== toMerge.class) { | |
ret.class = normalizeClass([ret.class, toMerge.class]); | |
} | |
} else if (key === "style") { | |
ret.style = normalizeStyle([ret.style, toMerge.style]); | |
} else if (isOn(key)) { | |
const existing = ret[key]; | |
const incoming = toMerge[key]; | |
if (incoming && existing !== incoming && !(isArray$1(existing) && existing.includes(incoming))) { | |
ret[key] = existing ? [].concat(existing, incoming) : incoming; | |
} | |
} else if (key !== "") { | |
ret[key] = toMerge[key]; | |
} | |
} | |
} | |
return ret; | |
} | |
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) { | |
callWithAsyncErrorHandling(hook, instance, 7, [ | |
vnode, | |
prevVNode | |
]); | |
} | |
const emptyAppContext = createAppContext(); | |
let uid = 0; | |
function createComponentInstance(vnode, parent, suspense) { | |
const type = vnode.type; | |
const appContext = (parent ? parent.appContext : vnode.appContext) || emptyAppContext; | |
const instance = { | |
uid: uid++, | |
vnode, | |
type, | |
parent, | |
appContext, | |
root: null, | |
// to be immediately set | |
next: null, | |
subTree: null, | |
// will be set synchronously right after creation | |
effect: null, | |
update: null, | |
// will be set synchronously right after creation | |
scope: new EffectScope( | |
true | |
/* detached */ | |
), | |
render: null, | |
proxy: null, | |
exposed: null, | |
exposeProxy: null, | |
withProxy: null, | |
provides: parent ? parent.provides : Object.create(appContext.provides), | |
accessCache: null, | |
renderCache: [], | |
// local resolved assets | |
components: null, | |
directives: null, | |
// resolved props and emits options | |
propsOptions: normalizePropsOptions(type, appContext), | |
emitsOptions: normalizeEmitsOptions(type, appContext), | |
// emit | |
emit: null, | |
// to be set immediately | |
emitted: null, | |
// props default value | |
propsDefaults: EMPTY_OBJ, | |
// inheritAttrs | |
inheritAttrs: type.inheritAttrs, | |
// state | |
ctx: EMPTY_OBJ, | |
data: EMPTY_OBJ, | |
props: EMPTY_OBJ, | |
attrs: EMPTY_OBJ, | |
slots: EMPTY_OBJ, | |
refs: EMPTY_OBJ, | |
setupState: EMPTY_OBJ, | |
setupContext: null, | |
attrsProxy: null, | |
slotsProxy: null, | |
// suspense related | |
suspense, | |
suspenseId: suspense ? suspense.pendingId : 0, | |
asyncDep: null, | |
asyncResolved: false, | |
// lifecycle hooks | |
// not using enums here because it results in computed properties | |
isMounted: false, | |
isUnmounted: false, | |
isDeactivated: false, | |
bc: null, | |
c: null, | |
bm: null, | |
m: null, | |
bu: null, | |
u: null, | |
um: null, | |
bum: null, | |
da: null, | |
a: null, | |
rtg: null, | |
rtc: null, | |
ec: null, | |
sp: null | |
}; | |
{ | |
instance.ctx = { _: instance }; | |
} | |
instance.root = parent ? parent.root : instance; | |
instance.emit = emit.bind(null, instance); | |
if (vnode.ce) { | |
vnode.ce(instance); | |
} | |
return instance; | |
} | |
let currentInstance = null; | |
let internalSetCurrentInstance; | |
let globalCurrentInstanceSetters; | |
let settersKey = "__VUE_INSTANCE_SETTERS__"; | |
{ | |
if (!(globalCurrentInstanceSetters = getGlobalThis$1()[settersKey])) { | |
globalCurrentInstanceSetters = getGlobalThis$1()[settersKey] = []; | |
} | |
globalCurrentInstanceSetters.push((i) => currentInstance = i); | |
internalSetCurrentInstance = (instance) => { | |
if (globalCurrentInstanceSetters.length > 1) { | |
globalCurrentInstanceSetters.forEach((s) => s(instance)); | |
} else { | |
globalCurrentInstanceSetters[0](instance); | |
} | |
}; | |
} | |
const setCurrentInstance = (instance) => { | |
internalSetCurrentInstance(instance); | |
instance.scope.on(); | |
}; | |
const unsetCurrentInstance = () => { | |
currentInstance && currentInstance.scope.off(); | |
internalSetCurrentInstance(null); | |
}; | |
function isStatefulComponent(instance) { | |
return instance.vnode.shapeFlag & 4; | |
} | |
let isInSSRComponentSetup = false; | |
function setupComponent(instance, isSSR = false) { | |
isInSSRComponentSetup = isSSR; | |
const { props, children } = instance.vnode; | |
const isStateful = isStatefulComponent(instance); | |
initProps(instance, props, isStateful, isSSR); | |
initSlots(instance, children); | |
const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0; | |
isInSSRComponentSetup = false; | |
return setupResult; | |
} | |
function setupStatefulComponent(instance, isSSR) { | |
const Component = instance.type; | |
instance.accessCache = /* @__PURE__ */ Object.create(null); | |
instance.proxy = markRaw(new Proxy(instance.ctx, PublicInstanceProxyHandlers)); | |
const { setup } = Component; | |
if (setup) { | |
const setupContext = instance.setupContext = setup.length > 1 ? createSetupContext(instance) : null; | |
setCurrentInstance(instance); | |
pauseTracking(); | |
const setupResult = callWithErrorHandling( | |
setup, | |
instance, | |
0, | |
[instance.props, setupContext] | |
); | |
resetTracking(); | |
unsetCurrentInstance(); | |
if (isPromise(setupResult)) { | |
setupResult.then(unsetCurrentInstance, unsetCurrentInstance); | |
if (isSSR) { | |
return setupResult.then((resolvedResult) => { | |
handleSetupResult(instance, resolvedResult, isSSR); | |
}).catch((e) => { | |
handleError(e, instance, 0); | |
}); | |
} else { | |
instance.asyncDep = setupResult; | |
} | |
} else { | |
handleSetupResult(instance, setupResult, isSSR); | |
} | |
} else { | |
finishComponentSetup(instance, isSSR); | |
} | |
} | |
function handleSetupResult(instance, setupResult, isSSR) { | |
if (isFunction(setupResult)) { | |
if (instance.type.__ssrInlineRender) { | |
instance.ssrRender = setupResult; | |
} else { | |
instance.render = setupResult; | |
} | |
} else if (isObject(setupResult)) { | |
if (__VUE_PROD_DEVTOOLS__) { | |
instance.devtoolsRawSetupState = setupResult; | |
} | |
instance.setupState = proxyRefs(setupResult); | |
} else | |
; | |
finishComponentSetup(instance, isSSR); | |
} | |
let compile; | |
function finishComponentSetup(instance, isSSR, skipOptions) { | |
const Component = instance.type; | |
if (!instance.render) { | |
if (!isSSR && compile && !Component.render) { | |
const template = Component.template || resolveMergedOptions(instance).template; | |
if (template) { | |
const { isCustomElement, compilerOptions } = instance.appContext.config; | |
const { delimiters, compilerOptions: componentCompilerOptions } = Component; | |
const finalCompilerOptions = extend( | |
extend( | |
{ | |
isCustomElement, | |
delimiters | |
}, | |
compilerOptions | |
), | |
componentCompilerOptions | |
); | |
Component.render = compile(template, finalCompilerOptions); | |
} | |
} | |
instance.render = Component.render || NOOP; | |
} | |
if (__VUE_OPTIONS_API__ && true) { | |
setCurrentInstance(instance); | |
pauseTracking(); | |
try { | |
applyOptions(instance); | |
} finally { | |
resetTracking(); | |
unsetCurrentInstance(); | |
} | |
} | |
} | |
function getAttrsProxy(instance) { | |
return instance.attrsProxy || (instance.attrsProxy = new Proxy( | |
instance.attrs, | |
{ | |
get(target, key) { | |
track(instance, "get", "$attrs"); | |
return target[key]; | |
} | |
} | |
)); | |
} | |
function createSetupContext(instance) { | |
const expose = (exposed) => { | |
instance.exposed = exposed || {}; | |
}; | |
{ | |
return { | |
get attrs() { | |
return getAttrsProxy(instance); | |
}, | |
slots: instance.slots, | |
emit: instance.emit, | |
expose | |
}; | |
} | |
} | |
function getExposeProxy(instance) { | |
if (instance.exposed) { | |
return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), { | |
get(target, key) { | |
if (key in target) { | |
return target[key]; | |
} else if (key in publicPropertiesMap) { | |
return publicPropertiesMap[key](instance); | |
} | |
}, | |
has(target, key) { | |
return key in target || key in publicPropertiesMap; | |
} | |
})); | |
} | |
} | |
function isClassComponent(value) { | |
return isFunction(value) && "__vccOpts" in value; | |
} | |
const computed = (getterOrOptions, debugOptions) => { | |
return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup); | |
}; | |
const ssrContextKey = Symbol.for("v-scx"); | |
const useSSRContext = () => { | |
{ | |
const ctx = inject(ssrContextKey); | |
return ctx; | |
} | |
}; | |
const version = "3.3.7"; | |
const svgNS = "http://www.w3.org/2000/svg"; | |
const doc = typeof document !== "undefined" ? document : null; | |
const templateContainer = doc && /* @__PURE__ */ doc.createElement("template"); | |
const nodeOps = { | |
insert: (child, parent, anchor) => { | |
parent.insertBefore(child, anchor || null); | |
}, | |
remove: (child) => { | |
const parent = child.parentNode; | |
if (parent) { | |
parent.removeChild(child); | |
} | |
}, | |
createElement: (tag, isSVG, is, props) => { | |
const el = isSVG ? doc.createElementNS(svgNS, tag) : doc.createElement(tag, is ? { is } : void 0); | |
if (tag === "select" && props && props.multiple != null) { | |
el.setAttribute("multiple", props.multiple); | |
} | |
return el; | |
}, | |
createText: (text) => doc.createTextNode(text), | |
createComment: (text) => doc.createComment(text), | |
setText: (node, text) => { | |
node.nodeValue = text; | |
}, | |
setElementText: (el, text) => { | |
el.textContent = text; | |
}, | |
parentNode: (node) => node.parentNode, | |
nextSibling: (node) => node.nextSibling, | |
querySelector: (selector) => doc.querySelector(selector), | |
setScopeId(el, id) { | |
el.setAttribute(id, ""); | |
}, | |
// __UNSAFE__ | |
// Reason: innerHTML. | |
// Static content here can only come from compiled templates. | |
// As long as the user only uses trusted templates, this is safe. | |
insertStaticContent(content, parent, anchor, isSVG, start, end) { | |
const before = anchor ? anchor.previousSibling : parent.lastChild; | |
if (start && (start === end || start.nextSibling)) { | |
while (true) { | |
parent.insertBefore(start.cloneNode(true), anchor); | |
if (start === end || !(start = start.nextSibling)) | |
break; | |
} | |
} else { | |
templateContainer.innerHTML = isSVG ? `<svg>${content}</svg>` : content; | |
const template = templateContainer.content; | |
if (isSVG) { | |
const wrapper = template.firstChild; | |
while (wrapper.firstChild) { | |
template.appendChild(wrapper.firstChild); | |
} | |
template.removeChild(wrapper); | |
} | |
parent.insertBefore(template, anchor); | |
} | |
return [ | |
// first | |
before ? before.nextSibling : parent.firstChild, | |
// last | |
anchor ? anchor.previousSibling : parent.lastChild | |
]; | |
} | |
}; | |
const vtcKey = Symbol("_vtc"); | |
function patchClass(el, value, isSVG) { | |
const transitionClasses = el[vtcKey]; | |
if (transitionClasses) { | |
value = (value ? [value, ...transitionClasses] : [...transitionClasses]).join(" "); | |
} | |
if (value == null) { | |
el.removeAttribute("class"); | |
} else if (isSVG) { | |
el.setAttribute("class", value); | |
} else { | |
el.className = value; | |
} | |
} | |
const vShowOldKey = Symbol("_vod"); | |
function patchStyle(el, prev, next) { | |
const style2 = el.style; | |
const isCssString = isString(next); | |
if (next && !isCssString) { | |
if (prev && !isString(prev)) { | |
for (const key in prev) { | |
if (next[key] == null) { | |
setStyle(style2, key, ""); | |
} | |
} | |
} | |
for (const key in next) { | |
setStyle(style2, key, next[key]); | |
} | |
} else { | |
const currentDisplay = style2.display; | |
if (isCssString) { | |
if (prev !== next) { | |
style2.cssText = next; | |
} | |
} else if (prev) { | |
el.removeAttribute("style"); | |
} | |
if (vShowOldKey in el) { | |
style2.display = currentDisplay; | |
} | |
} | |
} | |
const importantRE = /\s*!important$/; | |
function setStyle(style2, name, val) { | |
if (isArray$1(val)) { | |
val.forEach((v) => setStyle(style2, name, v)); | |
} else { | |
if (val == null) | |
val = ""; | |
if (name.startsWith("--")) { | |
style2.setProperty(name, val); | |
} else { | |
const prefixed = autoPrefix(style2, name); | |
if (importantRE.test(val)) { | |
style2.setProperty( | |
hyphenate(prefixed), | |
val.replace(importantRE, ""), | |
"important" | |
); | |
} else { | |
style2[prefixed] = val; | |
} | |
} | |
} | |
} | |
const prefixes = ["Webkit", "Moz", "ms"]; | |
const prefixCache = {}; | |
function autoPrefix(style2, rawName) { | |
const cached = prefixCache[rawName]; | |
if (cached) { | |
return cached; | |
} | |
let name = camelize(rawName); | |
if (name !== "filter" && name in style2) { | |
return prefixCache[rawName] = name; | |
} | |
name = capitalize(name); | |
for (let i = 0; i < prefixes.length; i++) { | |
const prefixed = prefixes[i] + name; | |
if (prefixed in style2) { | |
return prefixCache[rawName] = prefixed; | |
} | |
} | |
return rawName; | |
} | |
const xlinkNS = "http://www.w3.org/1999/xlink"; | |
function patchAttr(el, key, value, isSVG, instance) { | |
if (isSVG && key.startsWith("xlink:")) { | |
if (value == null) { | |
el.removeAttributeNS(xlinkNS, key.slice(6, key.length)); | |
} else { | |
el.setAttributeNS(xlinkNS, key, value); | |
} | |
} else { | |
const isBoolean = isSpecialBooleanAttr(key); | |
if (value == null || isBoolean && !includeBooleanAttr(value)) { | |
el.removeAttribute(key); | |
} else { | |
el.setAttribute(key, isBoolean ? "" : value); | |
} | |
} | |
} | |
function patchDOMProp(el, key, value, prevChildren, parentComponent, parentSuspense, unmountChildren) { | |
if (key === "innerHTML" || key === "textContent") { | |
if (prevChildren) { | |
unmountChildren(prevChildren, parentComponent, parentSuspense); | |
} | |
el[key] = value == null ? "" : value; | |
return; | |
} | |
const tag = el.tagName; | |
if (key === "value" && tag !== "PROGRESS" && // custom elements may use _value internally | |
!tag.includes("-")) { | |
el._value = value; | |
const oldValue = tag === "OPTION" ? el.getAttribute("value") : el.value; | |
const newValue = value == null ? "" : value; | |
if (oldValue !== newValue) { | |
el.value = newValue; | |
} | |
if (value == null) { | |
el.removeAttribute(key); | |
} | |
return; | |
} | |
let needRemove = false; | |
if (value === "" || value == null) { | |
const type = typeof el[key]; | |
if (type === "boolean") { | |
value = includeBooleanAttr(value); | |
} else if (value == null && type === "string") { | |
value = ""; | |
needRemove = true; | |
} else if (type === "number") { | |
value = 0; | |
needRemove = true; | |
} | |
} | |
try { | |
el[key] = value; | |
} catch (e) { | |
} | |
needRemove && el.removeAttribute(key); | |
} | |
function addEventListener(el, event, handler, options) { | |
el.addEventListener(event, handler, options); | |
} | |
function removeEventListener(el, event, handler, options) { | |
el.removeEventListener(event, handler, options); | |
} | |
const veiKey = Symbol("_vei"); | |
function patchEvent(el, rawName, prevValue, nextValue, instance = null) { | |
const invokers = el[veiKey] || (el[veiKey] = {}); | |
const existingInvoker = invokers[rawName]; | |
if (nextValue && existingInvoker) { | |
existingInvoker.value = nextValue; | |
} else { | |
const [name, options] = parseName(rawName); | |
if (nextValue) { | |
const invoker = invokers[rawName] = createInvoker(nextValue, instance); | |
addEventListener(el, name, invoker, options); | |
} else if (existingInvoker) { | |
removeEventListener(el, name, existingInvoker, options); | |
invokers[rawName] = void 0; | |
} | |
} | |
} | |
const optionsModifierRE = /(?:Once|Passive|Capture)$/; | |
function parseName(name) { | |
let options; | |
if (optionsModifierRE.test(name)) { | |
options = {}; | |
let m; | |
while (m = name.match(optionsModifierRE)) { | |
name = name.slice(0, name.length - m[0].length); | |
options[m[0].toLowerCase()] = true; | |
} | |
} | |
const event = name[2] === ":" ? name.slice(3) : hyphenate(name.slice(2)); | |
return [event, options]; | |
} | |
let cachedNow = 0; | |
const p = /* @__PURE__ */ Promise.resolve(); | |
const getNow = () => cachedNow || (p.then(() => cachedNow = 0), cachedNow = Date.now()); | |
function createInvoker(initialValue, instance) { | |
const invoker = (e) => { | |
if (!e._vts) { | |
e._vts = Date.now(); | |
} else if (e._vts <= invoker.attached) { | |
return; | |
} | |
callWithAsyncErrorHandling( | |
patchStopImmediatePropagation(e, invoker.value), | |
instance, | |
5, | |
[e] | |
); | |
}; | |
invoker.value = initialValue; | |
invoker.attached = getNow(); | |
return invoker; | |
} | |
function patchStopImmediatePropagation(e, value) { | |
if (isArray$1(value)) { | |
const originalStop = e.stopImmediatePropagation; | |
e.stopImmediatePropagation = () => { | |
originalStop.call(e); | |
e._stopped = true; | |
}; | |
return value.map((fn) => (e2) => !e2._stopped && fn && fn(e2)); | |
} else { | |
return value; | |
} | |
} | |
const nativeOnRE = /^on[a-z]/; | |
const patchProp = (el, key, prevValue, nextValue, isSVG = false, prevChildren, parentComponent, parentSuspense, unmountChildren) => { | |
if (key === "class") { | |
patchClass(el, nextValue, isSVG); | |
} else if (key === "style") { | |
patchStyle(el, prevValue, nextValue); | |
} else if (isOn(key)) { | |
if (!isModelListener(key)) { | |
patchEvent(el, key, prevValue, nextValue, parentComponent); | |
} | |
} else if (key[0] === "." ? (key = key.slice(1), true) : key[0] === "^" ? (key = key.slice(1), false) : shouldSetAsProp(el, key, nextValue, isSVG)) { | |
patchDOMProp( | |
el, | |
key, | |
nextValue, | |
prevChildren, | |
parentComponent, | |
parentSuspense, | |
unmountChildren | |
); | |
} else { | |
if (key === "true-value") { | |
el._trueValue = nextValue; | |
} else if (key === "false-value") { | |
el._falseValue = nextValue; | |
} | |
patchAttr(el, key, nextValue, isSVG); | |
} | |
}; | |
function shouldSetAsProp(el, key, value, isSVG) { | |
if (isSVG) { | |
if (key === "innerHTML" || key === "textContent") { | |
return true; | |
} | |
if (key in el && nativeOnRE.test(key) && isFunction(value)) { | |
return true; | |
} | |
return false; | |
} | |
if (key === "spellcheck" || key === "draggable" || key === "translate") { | |
return false; | |
} | |
if (key === "form") { | |
return false; | |
} | |
if (key === "list" && el.tagName === "INPUT") { | |
return false; | |
} | |
if (key === "type" && el.tagName === "TEXTAREA") { | |
return false; | |
} | |
if (nativeOnRE.test(key) && isString(value)) { | |
return false; | |
} | |
return key in el; | |
} | |
/*! #__NO_SIDE_EFFECTS__ */ | |
// @__NO_SIDE_EFFECTS__ | |
function defineCustomElement(options, hydrate2) { | |
const Comp = /* @__PURE__ */ defineComponent(options); | |
class VueCustomElement extends VueElement { | |
constructor(initialProps) { | |
super(Comp, initialProps, hydrate2); | |
} | |
} | |
VueCustomElement.def = Comp; | |
return VueCustomElement; | |
} | |
const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class { | |
}; | |
class VueElement extends BaseClass { | |
constructor(_def, _props = {}, hydrate2) { | |
super(); | |
this._def = _def; | |
this._props = _props; | |
this._instance = null; | |
this._connected = false; | |
this._resolved = false; | |
this._numberProps = null; | |
this._ob = null; | |
if (this.shadowRoot && hydrate2) { | |
hydrate2(this._createVNode(), this.shadowRoot); | |
} else { | |
this.attachShadow({ mode: "open" }); | |
if (!this._def.__asyncLoader) { | |
this._resolveProps(this._def); | |
} | |
} | |
} | |
connectedCallback() { | |
this._connected = true; | |
if (!this._instance) { | |
if (this._resolved) { | |
this._update(); | |
} else { | |
this._resolveDef(); | |
} | |
} | |
} | |
disconnectedCallback() { | |
this._connected = false; | |
if (this._ob) { | |
this._ob.disconnect(); | |
this._ob = null; | |
} | |
nextTick(() => { | |
if (!this._connected) { | |
render(null, this.shadowRoot); | |
this._instance = null; | |
} | |
}); | |
} | |
/** | |
* resolve inner component definition (handle possible async component) | |
*/ | |
_resolveDef() { | |
this._resolved = true; | |
for (let i = 0; i < this.attributes.length; i++) { | |
this._setAttr(this.attributes[i].name); | |
} | |
this._ob = new MutationObserver((mutations) => { | |
for (const m of mutations) { | |
this._setAttr(m.attributeName); | |
} | |
}); | |
this._ob.observe(this, { attributes: true }); | |
const resolve = (def2, isAsync = false) => { | |
const { props, styles } = def2; | |
let numberProps; | |
if (props && !isArray$1(props)) { | |
for (const key in props) { | |
const opt = props[key]; | |
if (opt === Number || opt && opt.type === Number) { | |
if (key in this._props) { | |
this._props[key] = toNumber(this._props[key]); | |
} | |
(numberProps || (numberProps = /* @__PURE__ */ Object.create(null)))[camelize(key)] = true; | |
} | |
} | |
} | |
this._numberProps = numberProps; | |
if (isAsync) { | |
this._resolveProps(def2); | |
} | |
this._applyStyles(styles); | |
this._update(); | |
}; | |
const asyncDef = this._def.__asyncLoader; | |
if (asyncDef) { | |
asyncDef().then((def2) => resolve(def2, true)); | |
} else { | |
resolve(this._def); | |
} | |
} | |
_resolveProps(def2) { | |
const { props } = def2; | |
const declaredPropKeys = isArray$1(props) ? props : Object.keys(props || {}); | |
for (const key of Object.keys(this)) { | |
if (key[0] !== "_" && declaredPropKeys.includes(key)) { | |
this._setProp(key, this[key], true, false); | |
} | |
} | |
for (const key of declaredPropKeys.map(camelize)) { | |
Object.defineProperty(this, key, { | |
get() { | |
return this._getProp(key); | |
}, | |
set(val) { | |
this._setProp(key, val); | |
} | |
}); | |
} | |
} | |
_setAttr(key) { | |
let value = this.getAttribute(key); | |
const camelKey = camelize(key); | |
if (this._numberProps && this._numberProps[camelKey]) { | |
value = toNumber(value); | |
} | |
this._setProp(camelKey, value, false); | |
} | |
/** | |
* @internal | |
*/ | |
_getProp(key) { | |
return this._props[key]; | |
} | |
/** | |
* @internal | |
*/ | |
_setProp(key, val, shouldReflect = true, shouldUpdate = true) { | |
if (val !== this._props[key]) { | |
this._props[key] = val; | |
if (shouldUpdate && this._instance) { | |
this._update(); | |
} | |
if (shouldReflect) { | |
if (val === true) { | |
this.setAttribute(hyphenate(key), ""); | |
} else if (typeof val === "string" || typeof val === "number") { | |
this.setAttribute(hyphenate(key), val + ""); | |
} else if (!val) { | |
this.removeAttribute(hyphenate(key)); | |
} | |
} | |
} | |
} | |
_update() { | |
render(this._createVNode(), this.shadowRoot); | |
} | |
_createVNode() { | |
const vnode = createVNode(this._def, extend({}, this._props)); | |
if (!this._instance) { | |
vnode.ce = (instance) => { | |
this._instance = instance; | |
instance.isCE = true; | |
const dispatch = (event, args) => { | |
this.dispatchEvent( | |
new CustomEvent(event, { | |
detail: args | |
}) | |
); | |
}; | |
instance.emit = (event, ...args) => { | |
dispatch(event, args); | |
if (hyphenate(event) !== event) { | |
dispatch(hyphenate(event), args); | |
} | |
}; | |
let parent = this; | |
while (parent = parent && (parent.parentNode || parent.host)) { | |
if (parent instanceof VueElement) { | |
instance.parent = parent._instance; | |
instance.provides = parent._instance.provides; | |
break; | |
} | |
} | |
}; | |
} | |
return vnode; | |
} | |
_applyStyles(styles) { | |
if (styles) { | |
styles.forEach((css) => { | |
const s = document.createElement("style"); | |
s.textContent = css; | |
this.shadowRoot.appendChild(s); | |
}); | |
} | |
} | |
} | |
const systemModifiers = ["ctrl", "shift", "alt", "meta"]; | |
const modifierGuards = { | |
stop: (e) => e.stopPropagation(), | |
prevent: (e) => e.preventDefault(), | |
self: (e) => e.target !== e.currentTarget, | |
ctrl: (e) => !e.ctrlKey, | |
shift: (e) => !e.shiftKey, | |
alt: (e) => !e.altKey, | |
meta: (e) => !e.metaKey, | |
left: (e) => "button" in e && e.button !== 0, | |
middle: (e) => "button" in e && e.button !== 1, | |
right: (e) => "button" in e && e.button !== 2, | |
exact: (e, modifiers) => systemModifiers.some((m) => e[`${m}Key`] && !modifiers.includes(m)) | |
}; | |
const withModifiers = (fn, modifiers) => { | |
return (event, ...args) => { | |
for (let i = 0; i < modifiers.length; i++) { | |
const guard = modifierGuards[modifiers[i]]; | |
if (guard && guard(event, modifiers)) | |
return; | |
} | |
return fn(event, ...args); | |
}; | |
}; | |
const keyNames = { | |
esc: "escape", | |
space: " ", | |
up: "arrow-up", | |
left: "arrow-left", | |
right: "arrow-right", | |
down: "arrow-down", | |
delete: "backspace" | |
}; | |
const withKeys = (fn, modifiers) => { | |
return (event) => { | |
if (!("key" in event)) { | |
return; | |
} | |
const eventKey = hyphenate(event.key); | |
if (modifiers.some((k) => k === eventKey || keyNames[k] === eventKey)) { | |
return fn(event); | |
} | |
}; | |
}; | |
const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps); | |
let renderer; | |
function ensureRenderer() { | |
return renderer || (renderer = createRenderer(rendererOptions)); | |
} | |
const render = (...args) => { | |
ensureRenderer().render(...args); | |
}; | |
const START_TIME_ID = "2743734761003874"; | |
const END_TIME_ID = "2743735062840016"; | |
const ID_MAIN_ENTRY = "crm-assistant-main"; | |
const MEMBERSHIP_BELONG_ID = "100952068"; | |
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {}; | |
var lodash = { exports: {} }; | |
/** | |
* @license | |
* Lodash <https://lodash.com/> | |
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/> | |
* Released under MIT license <https://lodash.com/license> | |
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> | |
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | |
*/ | |
lodash.exports; | |
(function(module, exports) { | |
(function() { | |
var undefined$1; | |
var VERSION = "4.17.21"; | |
var LARGE_ARRAY_SIZE = 200; | |
var CORE_ERROR_TEXT = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", FUNC_ERROR_TEXT = "Expected a function", INVALID_TEMPL_VAR_ERROR_TEXT = "Invalid `variable` option passed into `_.template`"; | |
var HASH_UNDEFINED = "__lodash_hash_undefined__"; | |
var MAX_MEMOIZE_SIZE = 500; | |
var PLACEHOLDER = "__lodash_placeholder__"; | |
var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4; | |
var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2; | |
var WRAP_BIND_FLAG = 1, WRAP_BIND_KEY_FLAG = 2, WRAP_CURRY_BOUND_FLAG = 4, WRAP_CURRY_FLAG = 8, WRAP_CURRY_RIGHT_FLAG = 16, WRAP_PARTIAL_FLAG = 32, WRAP_PARTIAL_RIGHT_FLAG = 64, WRAP_ARY_FLAG = 128, WRAP_REARG_FLAG = 256, WRAP_FLIP_FLAG = 512; | |
var DEFAULT_TRUNC_LENGTH = 30, DEFAULT_TRUNC_OMISSION = "..."; | |
var HOT_COUNT = 800, HOT_SPAN = 16; | |
var LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2, LAZY_WHILE_FLAG = 3; | |
var INFINITY = 1 / 0, MAX_SAFE_INTEGER = 9007199254740991, MAX_INTEGER = 17976931348623157e292, NAN = 0 / 0; | |
var MAX_ARRAY_LENGTH = 4294967295, MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1; | |
var wrapFlags = [ | |
["ary", WRAP_ARY_FLAG], | |
["bind", WRAP_BIND_FLAG], | |
["bindKey", WRAP_BIND_KEY_FLAG], | |
["curry", WRAP_CURRY_FLAG], | |
["curryRight", WRAP_CURRY_RIGHT_FLAG], | |
["flip", WRAP_FLIP_FLAG], | |
["partial", WRAP_PARTIAL_FLAG], | |
["partialRight", WRAP_PARTIAL_RIGHT_FLAG], | |
["rearg", WRAP_REARG_FLAG] | |
]; | |
var argsTag = "[object Arguments]", arrayTag = "[object Array]", asyncTag = "[object AsyncFunction]", boolTag = "[object Boolean]", dateTag = "[object Date]", domExcTag = "[object DOMException]", errorTag = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag = "[object Map]", numberTag = "[object Number]", nullTag = "[object Null]", objectTag = "[object Object]", promiseTag = "[object Promise]", proxyTag = "[object Proxy]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]", undefinedTag = "[object Undefined]", weakMapTag = "[object WeakMap]", weakSetTag = "[object WeakSet]"; | |
var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]"; | |
var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; | |
var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, reUnescapedHtml = /[&<>"']/g, reHasEscapedHtml = RegExp(reEscapedHtml.source), reHasUnescapedHtml = RegExp(reUnescapedHtml.source); | |
var reEscape = /<%-([\s\S]+?)%>/g, reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g; | |
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; | |
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar.source); | |
var reTrimStart = /^\s+/; | |
var reWhitespace = /\s/; | |
var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, reSplitDetails = /,? & /; | |
var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; | |
var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/; | |
var reEscapeChar = /\\(\\)?/g; | |
var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; | |
var reFlags = /\w*$/; | |
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; | |
var reIsBinary = /^0b[01]+$/i; | |
var reIsHostCtor = /^\[object .+?Constructor\]$/; | |
var reIsOctal = /^0o[0-7]+$/i; | |
var reIsUint = /^(?:0|[1-9]\d*)$/; | |
var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; | |
var reNoMatch = /($^)/; | |
var reUnescapedString = /['\n\r\u2028\u2029\\]/g; | |
var rsAstralRange = "\\ud800-\\udfff", rsComboMarksRange = "\\u0300-\\u036f", reComboHalfMarksRange = "\\ufe20-\\ufe2f", rsComboSymbolsRange = "\\u20d0-\\u20ff", rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, rsDingbatRange = "\\u2700-\\u27bf", rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff", rsMathOpRange = "\\xac\\xb1\\xd7\\xf7", rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", rsPunctuationRange = "\\u2000-\\u206f", rsSpaceRange = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde", rsVarRange = "\\ufe0e\\ufe0f", rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange; | |
var rsApos = "['’]", rsAstral = "[" + rsAstralRange + "]", rsBreak = "[" + rsBreakRange + "]", rsCombo = "[" + rsComboRange + "]", rsDigits = "\\d+", rsDingbat = "[" + rsDingbatRange + "]", rsLower = "[" + rsLowerRange + "]", rsMisc = "[^" + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]", rsFitz = "\\ud83c[\\udffb-\\udfff]", rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")", rsNonAstral = "[^" + rsAstralRange + "]", rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}", rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]", rsUpper = "[" + rsUpperRange + "]", rsZWJ = "\\u200d"; | |
var rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")", rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")", rsOptContrLower = "(?:" + rsApos + "(?:d|ll|m|re|s|t|ve))?", rsOptContrUpper = "(?:" + rsApos + "(?:D|LL|M|RE|S|T|VE))?", reOptMod = rsModifier + "?", rsOptVar = "[" + rsVarRange + "]?", rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*", rsOrdLower = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", rsOrdUpper = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", rsSeq = rsOptVar + reOptMod + rsOptJoin, rsEmoji = "(?:" + [rsDingbat, rsRegional, rsSurrPair].join("|") + ")" + rsSeq, rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")"; | |
var reApos = RegExp(rsApos, "g"); | |
var reComboMark = RegExp(rsCombo, "g"); | |
var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g"); | |
var reUnicodeWord = RegExp([ | |
rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")", | |
rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")", | |
rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower, | |
rsUpper + "+" + rsOptContrUpper, | |
rsOrdUpper, | |
rsOrdLower, | |
rsDigits, | |
rsEmoji | |
].join("|"), "g"); | |
var reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + "]"); | |
var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; | |
var contextProps = [ | |
"Array", | |
"Buffer", | |
"DataView", | |
"Date", | |
"Error", | |
"Float32Array", | |
"Float64Array", | |
"Function", | |
"Int8Array", | |
"Int16Array", | |
"Int32Array", | |
"Map", | |
"Math", | |
"Object", | |
"Promise", | |
"RegExp", | |
"Set", | |
"String", | |
"Symbol", | |
"TypeError", | |
"Uint8Array", | |
"Uint8ClampedArray", | |
"Uint16Array", | |
"Uint32Array", | |
"WeakMap", | |
"_", | |
"clearTimeout", | |
"isFinite", | |
"parseInt", | |
"setTimeout" | |
]; | |
var templateCounter = -1; | |
var typedArrayTags = {}; | |
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true; | |
typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; | |
var cloneableTags = {}; | |
cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; | |
cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false; | |
var deburredLetters = { | |
// Latin-1 Supplement block. | |
"À": "A", | |
"Á": "A", | |
"Â": "A", | |
"Ã": "A", | |
"Ä": "A", | |
"Å": "A", | |
"à": "a", | |
"á": "a", | |
"â": "a", | |
"ã": "a", | |
"ä": "a", | |
"å": "a", | |
"Ç": "C", | |
"ç": "c", | |
"Ð": "D", | |
"ð": "d", | |
"È": "E", | |
"É": "E", | |
"Ê": "E", | |
"Ë": "E", | |
"è": "e", | |
"é": "e", | |
"ê": "e", | |
"ë": "e", | |
"Ì": "I", | |
"Í": "I", | |
"Î": "I", | |
"Ï": "I", | |
"ì": "i", | |
"í": "i", | |
"î": "i", | |
"ï": "i", | |
"Ñ": "N", | |
"ñ": "n", | |
"Ò": "O", | |
"Ó": "O", | |
"Ô": "O", | |
"Õ": "O", | |
"Ö": "O", | |
"Ø": "O", | |
"ò": "o", | |
"ó": "o", | |
"ô": "o", | |
"õ": "o", | |
"ö": "o", | |
"ø": "o", | |
"Ù": "U", | |
"Ú": "U", | |
"Û": "U", | |
"Ü": "U", | |
"ù": "u", | |
"ú": "u", | |
"û": "u", | |
"ü": "u", | |
"Ý": "Y", | |
"ý": "y", | |
"ÿ": "y", | |
"Æ": "Ae", | |
"æ": "ae", | |
"Þ": "Th", | |
"þ": "th", | |
"ß": "ss", | |
// Latin Extended-A block. | |
"Ā": "A", | |
"Ă": "A", | |
"Ą": "A", | |
"ā": "a", | |
"ă": "a", | |
"ą": "a", | |
"Ć": "C", | |
"Ĉ": "C", | |
"Ċ": "C", | |
"Č": "C", | |
"ć": "c", | |
"ĉ": "c", | |
"ċ": "c", | |
"č": "c", | |
"Ď": "D", | |
"Đ": "D", | |
"ď": "d", | |
"đ": "d", | |
"Ē": "E", | |
"Ĕ": "E", | |
"Ė": "E", | |
"Ę": "E", | |
"Ě": "E", | |
"ē": "e", | |
"ĕ": "e", | |
"ė": "e", | |
"ę": "e", | |
"ě": "e", | |
"Ĝ": "G", | |
"Ğ": "G", | |
"Ġ": "G", | |
"Ģ": "G", | |
"ĝ": "g", | |
"ğ": "g", | |
"ġ": "g", | |
"ģ": "g", | |
"Ĥ": "H", | |
"Ħ": "H", | |
"ĥ": "h", | |
"ħ": "h", | |
"Ĩ": "I", | |
"Ī": "I", | |
"Ĭ": "I", | |
"Į": "I", | |
"İ": "I", | |
"ĩ": "i", | |
"ī": "i", | |
"ĭ": "i", | |
"į": "i", | |
"ı": "i", | |
"Ĵ": "J", | |
"ĵ": "j", | |
"Ķ": "K", | |
"ķ": "k", | |
"ĸ": "k", | |
"Ĺ": "L", | |
"Ļ": "L", | |
"Ľ": "L", | |
"Ŀ": "L", | |
"Ł": "L", | |
"ĺ": "l", | |
"ļ": "l", | |
"ľ": "l", | |
"ŀ": "l", | |
"ł": "l", | |
"Ń": "N", | |
"Ņ": "N", | |
"Ň": "N", | |
"Ŋ": "N", | |
"ń": "n", | |
"ņ": "n", | |
"ň": "n", | |
"ŋ": "n", | |
"Ō": "O", | |
"Ŏ": "O", | |
"Ő": "O", | |
"ō": "o", | |
"ŏ": "o", | |
"ő": "o", | |
"Ŕ": "R", | |
"Ŗ": "R", | |
"Ř": "R", | |
"ŕ": "r", | |
"ŗ": "r", | |
"ř": "r", | |
"Ś": "S", | |
"Ŝ": "S", | |
"Ş": "S", | |
"Š": "S", | |
"ś": "s", | |
"ŝ": "s", | |
"ş": "s", | |
"š": "s", | |
"Ţ": "T", | |
"Ť": "T", | |
"Ŧ": "T", | |
"ţ": "t", | |
"ť": "t", | |
"ŧ": "t", | |
"Ũ": "U", | |
"Ū": "U", | |
"Ŭ": "U", | |
"Ů": "U", | |
"Ű": "U", | |
"Ų": "U", | |
"ũ": "u", | |
"ū": "u", | |
"ŭ": "u", | |
"ů": "u", | |
"ű": "u", | |
"ų": "u", | |
"Ŵ": "W", | |
"ŵ": "w", | |
"Ŷ": "Y", | |
"ŷ": "y", | |
"Ÿ": "Y", | |
"Ź": "Z", | |
"Ż": "Z", | |
"Ž": "Z", | |
"ź": "z", | |
"ż": "z", | |
"ž": "z", | |
"IJ": "IJ", | |
"ij": "ij", | |
"Œ": "Oe", | |
"œ": "oe", | |
"ʼn": "'n", | |
"ſ": "s" | |
}; | |
var htmlEscapes = { | |
"&": "&", | |
"<": "<", | |
">": ">", | |
'"': """, | |
"'": "'" | |
}; | |
var htmlUnescapes = { | |
"&": "&", | |
"<": "<", | |
">": ">", | |
""": '"', | |
"'": "'" | |
}; | |
var stringEscapes = { | |
"\\": "\\", | |
"'": "'", | |
"\n": "n", | |
"\r": "r", | |
"\u2028": "u2028", | |
"\u2029": "u2029" | |
}; | |
var freeParseFloat = parseFloat, freeParseInt = parseInt; | |
var freeGlobal = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal; | |
var freeSelf = typeof self == "object" && self && self.Object === Object && self; | |
var root = freeGlobal || freeSelf || Function("return this")(); | |
var freeExports = exports && !exports.nodeType && exports; | |
var freeModule = freeExports && true && module && !module.nodeType && module; | |
var moduleExports = freeModule && freeModule.exports === freeExports; | |
var freeProcess = moduleExports && freeGlobal.process; | |
var nodeUtil = function() { | |
try { | |
var types = freeModule && freeModule.require && freeModule.require("util").types; | |
if (types) { | |
return types; | |
} | |
return freeProcess && freeProcess.binding && freeProcess.binding("util"); | |
} catch (e) { | |
} | |
}(); | |
var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer, nodeIsDate = nodeUtil && nodeUtil.isDate, nodeIsMap = nodeUtil && nodeUtil.isMap, nodeIsRegExp = nodeUtil && nodeUtil.isRegExp, nodeIsSet = nodeUtil && nodeUtil.isSet, nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; | |
function apply(func, thisArg, args) { | |
switch (args.length) { | |
case 0: | |
return func.call(thisArg); | |
case 1: | |
return func.call(thisArg, args[0]); | |
case 2: | |
return func.call(thisArg, args[0], args[1]); | |
case 3: | |
return func.call(thisArg, args[0], args[1], args[2]); | |
} | |
return func.apply(thisArg, args); | |
} | |
function arrayAggregator(array, setter, iteratee, accumulator) { | |
var index = -1, length = array == null ? 0 : array.length; | |
while (++index < length) { | |
var value = array[index]; | |
setter(accumulator, value, iteratee(value), array); | |
} | |
return accumulator; | |
} | |
function arrayEach(array, iteratee) { | |
var index = -1, length = array == null ? 0 : array.length; | |
while (++index < length) { | |
if (iteratee(array[index], index, array) === false) { | |
break; | |
} | |
} | |
return array; | |
} | |
function arrayEachRight(array, iteratee) { | |
var length = array == null ? 0 : array.length; | |
while (length--) { | |
if (iteratee(array[length], length, array) === false) { | |
break; | |
} | |
} | |
return array; | |
} | |
function arrayEvery(array, predicate) { | |
var index = -1, length = array == null ? 0 : array.length; | |
while (++index < length) { | |
if (!predicate(array[index], index, array)) { | |
return false; | |
} | |
} | |
return true; | |
} | |
function arrayFilter(array, predicate) { | |
var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = []; | |
while (++index < length) { | |
var value = array[index]; | |
if (predicate(value, index, array)) { | |
result[resIndex++] = value; | |
} | |
} | |
return result; | |
} | |
function arrayIncludes(array, value) { | |
var length = array == null ? 0 : array.length; | |
return !!length && baseIndexOf(array, value, 0) > -1; | |
} | |
function arrayIncludesWith(array, value, comparator2) { | |
var index = -1, length = array == null ? 0 : array.length; | |
while (++index < length) { | |
if (comparator2(value, array[index])) { | |
return true; | |
} | |
} | |
return false; | |
} | |
function arrayMap(array, iteratee) { | |
var index = -1, length = array == null ? 0 : array.length, result = Array(length); | |
while (++index < length) { | |
result[index] = iteratee(array[index], index, array); | |
} | |
return result; | |
} | |
function arrayPush(array, values) { | |
var index = -1, length = values.length, offset = array.length; | |
while (++index < length) { | |
array[offset + index] = values[index]; | |
} | |
return array; | |
} | |
function arrayReduce(array, iteratee, accumulator, initAccum) { | |
var index = -1, length = array == null ? 0 : array.length; | |
if (initAccum && length) { | |
accumulator = array[++index]; | |
} | |
while (++index < length) { | |
accumulator = iteratee(accumulator, array[index], index, array); | |
} | |
return accumulator; | |
} | |
function arrayReduceRight(array, iteratee, accumulator, initAccum) { | |
var length = array == null ? 0 : array.length; | |
if (initAccum && length) { | |
accumulator = array[--length]; | |
} | |
while (length--) { | |
accumulator = iteratee(accumulator, array[length], length, array); | |
} | |
return accumulator; | |
} | |
function arraySome(array, predicate) { | |
var index = -1, length = array == null ? 0 : array.length; | |
while (++index < length) { | |
if (predicate(array[index], index, array)) { | |
return true; | |
} | |
} | |
return false; | |
} | |
var asciiSize = baseProperty("length"); | |
function asciiToArray(string) { | |
return string.split(""); | |
} | |
function asciiWords(string) { | |
return string.match(reAsciiWord) || []; | |
} | |
function baseFindKey(collection, predicate, eachFunc) { | |
var result; | |
eachFunc(collection, function(value, key, collection2) { | |
if (predicate(value, key, collection2)) { | |
result = key; | |
return false; | |
} | |
}); | |
return result; | |
} | |
function baseFindIndex(array, predicate, fromIndex, fromRight) { | |
var length = array.length, index = fromIndex + (fromRight ? 1 : -1); | |
while (fromRight ? index-- : ++index < length) { | |
if (predicate(array[index], index, array)) { | |
return index; | |
} | |
} | |
return -1; | |
} | |
function baseIndexOf(array, value, fromIndex) { | |
return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex); | |
} | |
function baseIndexOfWith(array, value, fromIndex, comparator2) { | |
var index = fromIndex - 1, length = array.length; | |
while (++index < length) { | |
if (comparator2(array[index], value)) { | |
return index; | |
} | |
} | |
return -1; | |
} | |
function baseIsNaN(value) { | |
return value !== value; | |
} | |
function baseMean(array, iteratee) { | |
var length = array == null ? 0 : array.length; | |
return length ? baseSum(array, iteratee) / length : NAN; | |
} | |
function baseProperty(key) { | |
return function(object) { | |
return object == null ? undefined$1 : object[key]; | |
}; | |
} | |
function basePropertyOf(object) { | |
return function(key) { | |
return object == null ? undefined$1 : object[key]; | |
}; | |
} | |
function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) { | |
eachFunc(collection, function(value, index, collection2) { | |
accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection2); | |
}); | |
return accumulator; | |
} | |
function baseSortBy(array, comparer) { | |
var length = array.length; | |
array.sort(comparer); | |
while (length--) { | |
array[length] = array[length].value; | |
} | |
return array; | |
} | |
function baseSum(array, iteratee) { | |
var result, index = -1, length = array.length; | |
while (++index < length) { | |
var current = iteratee(array[index]); | |
if (current !== undefined$1) { | |
result = result === undefined$1 ? current : result + current; | |
} | |
} | |
return result; | |
} | |
function baseTimes(n, iteratee) { | |
var index = -1, result = Array(n); | |
while (++index < n) { | |
result[index] = iteratee(index); | |
} | |
return result; | |
} | |
function baseToPairs(object, props) { | |
return arrayMap(props, function(key) { | |
return [key, object[key]]; | |
}); | |
} | |
function baseTrim(string) { | |
return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string; | |
} | |
function baseUnary(func) { | |
return function(value) { | |
return func(value); | |
}; | |
} | |
function baseValues(object, props) { | |
return arrayMap(props, function(key) { | |
return object[key]; | |
}); | |
} | |
function cacheHas(cache, key) { | |
return cache.has(key); | |
} | |
function charsStartIndex(strSymbols, chrSymbols) { | |
var index = -1, length = strSymbols.length; | |
while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) { | |
} | |
return index; | |
} | |
function charsEndIndex(strSymbols, chrSymbols) { | |
var index = strSymbols.length; | |
while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) { | |
} | |
return index; | |
} | |
function countHolders(array, placeholder) { | |
var length = array.length, result = 0; | |
while (length--) { | |
if (array[length] === placeholder) { | |
++result; | |
} | |
} | |
return result; | |
} | |
var deburrLetter = basePropertyOf(deburredLetters); | |
var escapeHtmlChar = basePropertyOf(htmlEscapes); | |
function escapeStringChar(chr) { | |
return "\\" + stringEscapes[chr]; | |
} | |
function getValue(object, key) { | |
return object == null ? undefined$1 : object[key]; | |
} | |
function hasUnicode(string) { | |
return reHasUnicode.test(string); | |
} | |
function hasUnicodeWord(string) { | |
return reHasUnicodeWord.test(string); | |
} | |
function iteratorToArray(iterator) { | |
var data, result = []; | |
while (!(data = iterator.next()).done) { | |
result.push(data.value); | |
} | |
return result; | |
} | |
function mapToArray(map) { | |
var index = -1, result = Array(map.size); | |
map.forEach(function(value, key) { | |
result[++index] = [key, value]; | |
}); | |
return result; | |
} | |
function overArg(func, transform2) { | |
return function(arg) { | |
return func(transform2(arg)); | |
}; | |
} | |
function replaceHolders(array, placeholder) { | |
var index = -1, length = array.length, resIndex = 0, result = []; | |
while (++index < length) { | |
var value = array[index]; | |
if (value === placeholder || value === PLACEHOLDER) { | |
array[index] = PLACEHOLDER; | |
result[resIndex++] = index; | |
} | |
} | |
return result; | |
} | |
function setToArray(set2) { | |
var index = -1, result = Array(set2.size); | |
set2.forEach(function(value) { | |
result[++index] = value; | |
}); | |
return result; | |
} | |
function setToPairs(set2) { | |
var index = -1, result = Array(set2.size); | |
set2.forEach(function(value) { | |
result[++index] = [value, value]; | |
}); | |
return result; | |
} | |
function strictIndexOf(array, value, fromIndex) { | |
var index = fromIndex - 1, length = array.length; | |
while (++index < length) { | |
if (array[index] === value) { | |
return index; | |
} | |
} | |
return -1; | |
} | |
function strictLastIndexOf(array, value, fromIndex) { | |
var index = fromIndex + 1; | |
while (index--) { | |
if (array[index] === value) { | |
return index; | |
} | |
} | |
return index; | |
} | |
function stringSize(string) { | |
return hasUnicode(string) ? unicodeSize(string) : asciiSize(string); | |
} | |
function stringToArray(string) { | |
return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string); | |
} | |
function trimmedEndIndex(string) { | |
var index = string.length; | |
while (index-- && reWhitespace.test(string.charAt(index))) { | |
} | |
return index; | |
} | |
var unescapeHtmlChar = basePropertyOf(htmlUnescapes); | |
function unicodeSize(string) { | |
var result = reUnicode.lastIndex = 0; | |
while (reUnicode.test(string)) { | |
++result; | |
} | |
return result; | |
} | |
function unicodeToArray(string) { | |
return string.match(reUnicode) || []; | |
} | |
function unicodeWords(string) { | |
return string.match(reUnicodeWord) || []; | |
} | |
var runInContext = function runInContext2(context) { | |
context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps)); | |
var Array2 = context.Array, Date2 = context.Date, Error2 = context.Error, Function2 = context.Function, Math2 = context.Math, Object2 = context.Object, RegExp2 = context.RegExp, String2 = context.String, TypeError2 = context.TypeError; | |
var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto = Object2.prototype; | |
var coreJsData = context["__core-js_shared__"]; | |
var funcToString = funcProto.toString; | |
var hasOwnProperty2 = objectProto.hasOwnProperty; | |
var idCounter = 0; | |
var maskSrcKey = function() { | |
var uid2 = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ""); | |
return uid2 ? "Symbol(src)_1." + uid2 : ""; | |
}(); | |
var nativeObjectToString = objectProto.toString; | |
var objectCtorString = funcToString.call(Object2); | |
var oldDash = root._; | |
var reIsNative = RegExp2( | |
"^" + funcToString.call(hasOwnProperty2).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" | |
); | |
var Buffer2 = moduleExports ? context.Buffer : undefined$1, Symbol2 = context.Symbol, Uint8Array2 = context.Uint8Array, allocUnsafe2 = Buffer2 ? Buffer2.allocUnsafe : undefined$1, getPrototype = overArg(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : undefined$1, symIterator = Symbol2 ? Symbol2.iterator : undefined$1, symToStringTag = Symbol2 ? Symbol2.toStringTag : undefined$1; | |
var defineProperty = function() { | |
try { | |
var func = getNative(Object2, "defineProperty"); | |
func({}, "", {}); | |
return func; | |
} catch (e) { | |
} | |
}(); | |
var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, ctxNow = Date2 && Date2.now !== root.Date.now && Date2.now, ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout; | |
var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : undefined$1, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object2.keys, Object2), nativeMax = Math2.max, nativeMin = Math2.min, nativeNow = Date2.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto.reverse; | |
var DataView = getNative(context, "DataView"), Map2 = getNative(context, "Map"), Promise2 = getNative(context, "Promise"), Set2 = getNative(context, "Set"), WeakMap2 = getNative(context, "WeakMap"), nativeCreate = getNative(Object2, "create"); | |
var metaMap = WeakMap2 && new WeakMap2(); | |
var realNames = {}; | |
var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map2), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set2), weakMapCtorString = toSource(WeakMap2); | |
var symbolProto = Symbol2 ? Symbol2.prototype : undefined$1, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined$1, symbolToString = symbolProto ? symbolProto.toString : undefined$1; | |
function lodash2(value) { | |
if (isObjectLike(value) && !isArray2(value) && !(value instanceof LazyWrapper)) { | |
if (value instanceof LodashWrapper) { | |
return value; | |
} | |
if (hasOwnProperty2.call(value, "__wrapped__")) { | |
return wrapperClone(value); | |
} | |
} | |
return new LodashWrapper(value); | |
} | |
var baseCreate = function() { | |
function object() { | |
} | |
return function(proto) { | |
if (!isObject2(proto)) { | |
return {}; | |
} | |
if (objectCreate) { | |
return objectCreate(proto); | |
} | |
object.prototype = proto; | |
var result2 = new object(); | |
object.prototype = undefined$1; | |
return result2; | |
}; | |
}(); | |
function baseLodash() { | |
} | |
function LodashWrapper(value, chainAll) { | |
this.__wrapped__ = value; | |
this.__actions__ = []; | |
this.__chain__ = !!chainAll; | |
this.__index__ = 0; | |
this.__values__ = undefined$1; | |
} | |
lodash2.templateSettings = { | |
/** | |
* Used to detect `data` property values to be HTML-escaped. | |
* | |
* @memberOf _.templateSettings | |
* @type {RegExp} | |
*/ | |
"escape": reEscape, | |
/** | |
* Used to detect code to be evaluated. | |
* | |
* @memberOf _.templateSettings | |
* @type {RegExp} | |
*/ | |
"evaluate": reEvaluate, | |
/** | |
* Used to detect `data` property values to inject. | |
* | |
* @memberOf _.templateSettings | |
* @type {RegExp} | |
*/ | |
"interpolate": reInterpolate, | |
/** | |
* Used to reference the data object in the template text. | |
* | |
* @memberOf _.templateSettings | |
* @type {string} | |
*/ | |
"variable": "", | |
/** | |
* Used to import variables into the compiled template. | |
* | |
* @memberOf _.templateSettings | |
* @type {Object} | |
*/ | |
"imports": { | |
/** | |
* A reference to the `lodash` function. | |
* | |
* @memberOf _.templateSettings.imports | |
* @type {Function} | |
*/ | |
"_": lodash2 | |
} | |
}; | |
lodash2.prototype = baseLodash.prototype; | |
lodash2.prototype.constructor = lodash2; | |
LodashWrapper.prototype = baseCreate(baseLodash.prototype); | |
LodashWrapper.prototype.constructor = LodashWrapper; | |
function LazyWrapper(value) { | |
this.__wrapped__ = value; | |
this.__actions__ = []; | |
this.__dir__ = 1; | |
this.__filtered__ = false; | |
this.__iteratees__ = []; | |
this.__takeCount__ = MAX_ARRAY_LENGTH; | |
this.__views__ = []; | |
} | |
function lazyClone() { | |
var result2 = new LazyWrapper(this.__wrapped__); | |
result2.__actions__ = copyArray(this.__actions__); | |
result2.__dir__ = this.__dir__; | |
result2.__filtered__ = this.__filtered__; | |
result2.__iteratees__ = copyArray(this.__iteratees__); | |
result2.__takeCount__ = this.__takeCount__; | |
result2.__views__ = copyArray(this.__views__); | |
return result2; | |
} | |
function lazyReverse() { | |
if (this.__filtered__) { | |
var result2 = new LazyWrapper(this); | |
result2.__dir__ = -1; | |
result2.__filtered__ = true; | |
} else { | |
result2 = this.clone(); | |
result2.__dir__ *= -1; | |
} | |
return result2; | |
} | |
function lazyValue() { | |
var array = this.__wrapped__.value(), dir = this.__dir__, isArr = isArray2(array), isRight = dir < 0, arrLength = isArr ? array.length : 0, view = getView(0, arrLength, this.__views__), start = view.start, end = view.end, length = end - start, index = isRight ? end : start - 1, iteratees = this.__iteratees__, iterLength = iteratees.length, resIndex = 0, takeCount = nativeMin(length, this.__takeCount__); | |
if (!isArr || !isRight && arrLength == length && takeCount == length) { | |
return baseWrapperValue(array, this.__actions__); | |
} | |
var result2 = []; | |
outer: | |
while (length-- && resIndex < takeCount) { | |
index += dir; | |
var iterIndex = -1, value = array[index]; | |
while (++iterIndex < iterLength) { | |
var data = iteratees[iterIndex], iteratee2 = data.iteratee, type = data.type, computed2 = iteratee2(value); | |
if (type == LAZY_MAP_FLAG) { | |
value = computed2; | |
} else if (!computed2) { | |
if (type == LAZY_FILTER_FLAG) { | |
continue outer; | |
} else { | |
break outer; | |
} | |
} | |
} | |
result2[resIndex++] = value; | |
} | |
return result2; | |
} | |
LazyWrapper.prototype = baseCreate(baseLodash.prototype); | |
LazyWrapper.prototype.constructor = LazyWrapper; | |
function Hash(entries) { | |
var index = -1, length = entries == null ? 0 : entries.length; | |
this.clear(); | |
while (++index < length) { | |
var entry = entries[index]; | |
this.set(entry[0], entry[1]); | |
} | |
} | |
function hashClear() { | |
this.__data__ = nativeCreate ? nativeCreate(null) : {}; | |
this.size = 0; | |
} | |
function hashDelete(key) { | |
var result2 = this.has(key) && delete this.__data__[key]; | |
this.size -= result2 ? 1 : 0; | |
return result2; | |
} | |
function hashGet(key) { | |
var data = this.__data__; | |
if (nativeCreate) { | |
var result2 = data[key]; | |
return result2 === HASH_UNDEFINED ? undefined$1 : result2; | |
} | |
return hasOwnProperty2.call(data, key) ? data[key] : undefined$1; | |
} | |
function hashHas(key) { | |
var data = this.__data__; | |
return nativeCreate ? data[key] !== undefined$1 : hasOwnProperty2.call(data, key); | |
} | |
function hashSet(key, value) { | |
var data = this.__data__; | |
this.size += this.has(key) ? 0 : 1; | |
data[key] = nativeCreate && value === undefined$1 ? HASH_UNDEFINED : value; | |
return this; | |
} | |
Hash.prototype.clear = hashClear; | |
Hash.prototype["delete"] = hashDelete; | |
Hash.prototype.get = hashGet; | |
Hash.prototype.has = hashHas; | |
Hash.prototype.set = hashSet; | |
function ListCache(entries) { | |
var index = -1, length = entries == null ? 0 : entries.length; | |
this.clear(); | |
while (++index < length) { | |
var entry = entries[index]; | |
this.set(entry[0], entry[1]); | |
} | |
} | |
function listCacheClear() { | |
this.__data__ = []; | |
this.size = 0; | |
} | |
function listCacheDelete(key) { | |
var data = this.__data__, index = assocIndexOf(data, key); | |
if (index < 0) { | |
return false; | |
} | |
var lastIndex = data.length - 1; | |
if (index == lastIndex) { | |
data.pop(); | |
} else { | |
splice.call(data, index, 1); | |
} | |
--this.size; | |
return true; | |
} | |
function listCacheGet(key) { | |
var data = this.__data__, index = assocIndexOf(data, key); | |
return index < 0 ? undefined$1 : data[index][1]; | |
} | |
function listCacheHas(key) { | |
return assocIndexOf(this.__data__, key) > -1; | |
} | |
function listCacheSet(key, value) { | |
var data = this.__data__, index = assocIndexOf(data, key); | |
if (index < 0) { | |
++this.size; | |
data.push([key, value]); | |
} else { | |
data[index][1] = value; | |
} | |
return this; | |
} | |
ListCache.prototype.clear = listCacheClear; | |
ListCache.prototype["delete"] = listCacheDelete; | |
ListCache.prototype.get = listCacheGet; | |
ListCache.prototype.has = listCacheHas; | |
ListCache.prototype.set = listCacheSet; | |
function MapCache(entries) { | |
var index = -1, length = entries == null ? 0 : entries.length; | |
this.clear(); | |
while (++index < length) { | |
var entry = entries[index]; | |
this.set(entry[0], entry[1]); | |
} | |
} | |
function mapCacheClear() { | |
this.size = 0; | |
this.__data__ = { | |
"hash": new Hash(), | |
"map": new (Map2 || ListCache)(), | |
"string": new Hash() | |
}; | |
} | |
function mapCacheDelete(key) { | |
var result2 = getMapData(this, key)["delete"](key); | |
this.size -= result2 ? 1 : 0; | |
return result2; | |
} | |
function mapCacheGet(key) { | |
return getMapData(this, key).get(key); | |
} | |
function mapCacheHas(key) { | |
return getMapData(this, key).has(key); | |
} | |
function mapCacheSet(key, value) { | |
var data = getMapData(this, key), size22 = data.size; | |
data.set(key, value); | |
this.size += data.size == size22 ? 0 : 1; | |
return this; | |
} | |
MapCache.prototype.clear = mapCacheClear; | |
MapCache.prototype["delete"] = mapCacheDelete; | |
MapCache.prototype.get = mapCacheGet; | |
MapCache.prototype.has = mapCacheHas; | |
MapCache.prototype.set = mapCacheSet; | |
function SetCache(values2) { | |
var index = -1, length = values2 == null ? 0 : values2.length; | |
this.__data__ = new MapCache(); | |
while (++index < length) { | |
this.add(values2[index]); | |
} | |
} | |
function setCacheAdd(value) { | |
this.__data__.set(value, HASH_UNDEFINED); | |
return this; | |
} | |
function setCacheHas(value) { | |
return this.__data__.has(value); | |
} | |
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; | |
SetCache.prototype.has = setCacheHas; | |
function Stack(entries) { | |
var data = this.__data__ = new ListCache(entries); | |
this.size = data.size; | |
} | |
function stackClear() { | |
this.__data__ = new ListCache(); | |
this.size = 0; | |
} | |
function stackDelete(key) { | |
var data = this.__data__, result2 = data["delete"](key); | |
this.size = data.size; | |
return result2; | |
} | |
function stackGet(key) { | |
return this.__data__.get(key); | |
} | |
function stackHas(key) { | |
return this.__data__.has(key); | |
} | |
function stackSet(key, value) { | |
var data = this.__data__; | |
if (data instanceof ListCache) { | |
var pairs = data.__data__; | |
if (!Map2 || pairs.length < LARGE_ARRAY_SIZE - 1) { | |
pairs.push([key, value]); | |
this.size = ++data.size; | |
return this; | |
} | |
data = this.__data__ = new MapCache(pairs); | |
} | |
data.set(key, value); | |
this.size = data.size; | |
return this; | |
} | |
Stack.prototype.clear = stackClear; | |
Stack.prototype["delete"] = stackDelete; | |
Stack.prototype.get = stackGet; | |
Stack.prototype.has = stackHas; | |
Stack.prototype.set = stackSet; | |
function arrayLikeKeys(value, inherited) { | |
var isArr = isArray2(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer2(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result2 = skipIndexes ? baseTimes(value.length, String2) : [], length = result2.length; | |
for (var key in value) { | |
if ((inherited || hasOwnProperty2.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode. | |
(key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. | |
isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. | |
isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties. | |
isIndex(key, length)))) { | |
result2.push(key); | |
} | |
} | |
return result2; | |
} | |
function arraySample(array) { | |
var length = array.length; | |
return length ? array[baseRandom(0, length - 1)] : undefined$1; | |
} | |
function arraySampleSize(array, n) { | |
return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length)); | |
} | |
function arrayShuffle(array) { | |
return shuffleSelf(copyArray(array)); | |
} | |
function assignMergeValue(object, key, value) { | |
if (value !== undefined$1 && !eq(object[key], value) || value === undefined$1 && !(key in object)) { | |
baseAssignValue(object, key, value); | |
} | |
} | |
function assignValue(object, key, value) { | |
var objValue = object[key]; | |
if (!(hasOwnProperty2.call(object, key) && eq(objValue, value)) || value === undefined$1 && !(key in object)) { | |
baseAssignValue(object, key, value); | |
} | |
} | |
function assocIndexOf(array, key) { | |
var length = array.length; | |
while (length--) { | |
if (eq(array[length][0], key)) { | |
return length; | |
} | |
} | |
return -1; | |
} | |
function baseAggregator(collection, setter, iteratee2, accumulator) { | |
baseEach(collection, function(value, key, collection2) { | |
setter(accumulator, value, iteratee2(value), collection2); | |
}); | |
return accumulator; | |
} | |
function baseAssign(object, source) { | |
return object && copyObject(source, keys(source), object); | |
} | |
function baseAssignIn(object, source) { | |
return object && copyObject(source, keysIn(source), object); | |
} | |
function baseAssignValue(object, key, value) { | |
if (key == "__proto__" && defineProperty) { | |
defineProperty(object, key, { | |
"configurable": true, | |
"enumerable": true, | |
"value": value, | |
"writable": true | |
}); | |
} else { | |
object[key] = value; | |
} | |
} | |
function baseAt(object, paths) { | |
var index = -1, length = paths.length, result2 = Array2(length), skip = object == null; | |
while (++index < length) { | |
result2[index] = skip ? undefined$1 : get2(object, paths[index]); | |
} | |
return result2; | |
} | |
function baseClamp(number, lower, upper) { | |
if (number === number) { | |
if (upper !== undefined$1) { | |
number = number <= upper ? number : upper; | |
} | |
if (lower !== undefined$1) { | |
number = number >= lower ? number : lower; | |
} | |
} | |
return number; | |
} | |
function baseClone(value, bitmask, customizer, key, object, stack) { | |
var result2, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG; | |
if (customizer) { | |
result2 = object ? customizer(value, key, object, stack) : customizer(value); | |
} | |
if (result2 !== undefined$1) { | |
return result2; | |
} | |
if (!isObject2(value)) { | |
return value; | |
} | |
var isArr = isArray2(value); | |
if (isArr) { | |
result2 = initCloneArray(value); | |
if (!isDeep) { | |
return copyArray(value, result2); | |
} | |
} else { | |
var tag = getTag(value), isFunc = tag == funcTag || tag == genTag; | |
if (isBuffer2(value)) { | |
return cloneBuffer(value, isDeep); | |
} | |
if (tag == objectTag || tag == argsTag || isFunc && !object) { | |
result2 = isFlat || isFunc ? {} : initCloneObject(value); | |
if (!isDeep) { | |
return isFlat ? copySymbolsIn(value, baseAssignIn(result2, value)) : copySymbols(value, baseAssign(result2, value)); | |
} | |
} else { | |
if (!cloneableTags[tag]) { | |
return object ? value : {}; | |
} | |
result2 = initCloneByTag(value, tag, isDeep); | |
} | |
} | |
stack || (stack = new Stack()); | |
var stacked = stack.get(value); | |
if (stacked) { | |
return stacked; | |
} | |
stack.set(value, result2); | |
if (isSet2(value)) { | |
value.forEach(function(subValue) { | |
result2.add(baseClone(subValue, bitmask, customizer, subValue, value, stack)); | |
}); | |
} else if (isMap2(value)) { | |
value.forEach(function(subValue, key2) { | |
result2.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack)); | |
}); | |
} | |
var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys; | |
var props = isArr ? undefined$1 : keysFunc(value); | |
arrayEach(props || value, function(subValue, key2) { | |
if (props) { | |
key2 = subValue; | |
subValue = value[key2]; | |
} | |
assignValue(result2, key2, baseClone(subValue, bitmask, customizer, key2, value, stack)); | |
}); | |
return result2; | |
} | |
function baseConforms(source) { | |
var props = keys(source); | |
return function(object) { | |
return baseConformsTo(object, source, props); | |
}; | |
} | |
function baseConformsTo(object, source, props) { | |
var length = props.length; | |
if (object == null) { | |
return !length; | |
} | |
object = Object2(object); | |
while (length--) { | |
var key = props[length], predicate = source[key], value = object[key]; | |
if (value === undefined$1 && !(key in object) || !predicate(value)) { | |
return false; | |
} | |
} | |
return true; | |
} | |
function baseDelay(func, wait, args) { | |
if (typeof func != "function") { | |
throw new TypeError2(FUNC_ERROR_TEXT); | |
} | |
return setTimeout2(function() { | |
func.apply(undefined$1, args); | |
}, wait); | |
} | |
function baseDifference(array, values2, iteratee2, comparator2) { | |
var index = -1, includes3 = arrayIncludes, isCommon = true, length = array.length, result2 = [], valuesLength = values2.length; | |
if (!length) { | |
return result2; | |
} | |
if (iteratee2) { | |
values2 = arrayMap(values2, baseUnary(iteratee2)); | |
} | |
if (comparator2) { | |
includes3 = arrayIncludesWith; | |
isCommon = false; | |
} else if (values2.length >= LARGE_ARRAY_SIZE) { | |
includes3 = cacheHas; | |
isCommon = false; | |
values2 = new SetCache(values2); | |
} | |
outer: | |
while (++index < length) { | |
var value = array[index], computed2 = iteratee2 == null ? value : iteratee2(value); | |
value = comparator2 || value !== 0 ? value : 0; | |
if (isCommon && computed2 === computed2) { | |
var valuesIndex = valuesLength; | |
while (valuesIndex--) { | |
if (values2[valuesIndex] === computed2) { | |
continue outer; | |
} | |
} | |
result2.push(value); | |
} else if (!includes3(values2, computed2, comparator2)) { | |
result2.push(value); | |
} | |
} | |
return result2; | |
} | |
var baseEach = createBaseEach(baseForOwn); | |
var baseEachRight = createBaseEach(baseForOwnRight, true); | |
function baseEvery(collection, predicate) { | |
var result2 = true; | |
baseEach(collection, function(value, index, collection2) { | |
result2 = !!predicate(value, index, collection2); | |
return result2; | |
}); | |
return result2; | |
} | |
function baseExtremum(array, iteratee2, comparator2) { | |
var index = -1, length = array.length; | |
while (++index < length) { | |
var value = array[index], current = iteratee2(value); | |
if (current != null && (computed2 === undefined$1 ? current === current && !isSymbol2(current) : comparator2(current, computed2))) { | |
var computed2 = current, result2 = value; | |
} | |
} | |
return result2; | |
} | |
function baseFill(array, value, start, end) { | |
var length = array.length; | |
start = toInteger(start); | |
if (start < 0) { | |
start = -start > length ? 0 : length + start; | |
} | |
end = end === undefined$1 || end > length ? length : toInteger(end); | |
if (end < 0) { | |
end += length; | |
} | |
end = start > end ? 0 : toLength(end); | |
while (start < end) { | |
array[start++] = value; | |
} | |
return array; | |
} | |
function baseFilter(collection, predicate) { | |
var result2 = []; | |
baseEach(collection, function(value, index, collection2) { | |
if (predicate(value, index, collection2)) { | |
result2.push(value); | |
} | |
}); | |
return result2; | |
} | |
function baseFlatten(array, depth, predicate, isStrict, result2) { | |
var index = -1, length = array.length; | |
predicate || (predicate = isFlattenable); | |
result2 || (result2 = []); | |
while (++index < length) { | |
var value = array[index]; | |
if (depth > 0 && predicate(value)) { | |
if (depth > 1) { | |
baseFlatten(value, depth - 1, predicate, isStrict, result2); | |
} else { | |
arrayPush(result2, value); | |
} | |
} else if (!isStrict) { | |
result2[result2.length] = value; | |
} | |
} | |
return result2; | |
} | |
var baseFor = createBaseFor(); | |
var baseForRight = createBaseFor(true); | |
function baseForOwn(object, iteratee2) { | |
return object && baseFor(object, iteratee2, keys); | |
} | |
function baseForOwnRight(object, iteratee2) { | |
return object && baseForRight(object, iteratee2, keys); | |
} | |
function baseFunctions(object, props) { | |
return arrayFilter(props, function(key) { | |
return isFunction2(object[key]); | |
}); | |
} | |
function baseGet(object, path) { | |
path = castPath(path, object); | |
var index = 0, length = path.length; | |
while (object != null && index < length) { | |
object = object[toKey(path[index++])]; | |
} | |
return index && index == length ? object : undefined$1; | |
} | |
function baseGetAllKeys(object, keysFunc, symbolsFunc) { | |
var result2 = keysFunc(object); | |
return isArray2(object) ? result2 : arrayPush(result2, symbolsFunc(object)); | |
} | |
function baseGetTag(value) { | |
if (value == null) { | |
return value === undefined$1 ? undefinedTag : nullTag; | |
} | |
return symToStringTag && symToStringTag in Object2(value) ? getRawTag(value) : objectToString2(value); | |
} | |
function baseGt(value, other) { | |
return value > other; | |
} | |
function baseHas(object, key) { | |
return object != null && hasOwnProperty2.call(object, key); | |
} | |
function baseHasIn(object, key) { | |
return object != null && key in Object2(object); | |
} | |
function baseInRange(number, start, end) { | |
return number >= nativeMin(start, end) && number < nativeMax(start, end); | |
} | |
function baseIntersection(arrays, iteratee2, comparator2) { | |
var includes3 = comparator2 ? arrayIncludesWith : arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array2(othLength), maxLength = Infinity, result2 = []; | |
while (othIndex--) { | |
var array = arrays[othIndex]; | |
if (othIndex && iteratee2) { | |
array = arrayMap(array, baseUnary(iteratee2)); | |
} | |
maxLength = nativeMin(array.length, maxLength); | |
caches[othIndex] = !comparator2 && (iteratee2 || length >= 120 && array.length >= 120) ? new SetCache(othIndex && array) : undefined$1; | |
} | |
array = arrays[0]; | |
var index = -1, seen = caches[0]; | |
outer: | |
while (++index < length && result2.length < maxLength) { | |
var value = array[index], computed2 = iteratee2 ? iteratee2(value) : value; | |
value = comparator2 || value !== 0 ? value : 0; | |
if (!(seen ? cacheHas(seen, computed2) : includes3(result2, computed2, comparator2))) { | |
othIndex = othLength; | |
while (--othIndex) { | |
var cache = caches[othIndex]; | |
if (!(cache ? cacheHas(cache, computed2) : includes3(arrays[othIndex], computed2, comparator2))) { | |
continue outer; | |
} | |
} | |
if (seen) { | |
seen.push(computed2); | |
} | |
result2.push(value); | |
} | |
} | |
return result2; | |
} | |
function baseInverter(object, setter, iteratee2, accumulator) { | |
baseForOwn(object, function(value, key, object2) { | |
setter(accumulator, iteratee2(value), key, object2); | |
}); | |
return accumulator; | |
} | |
function baseInvoke(object, path, args) { | |
path = castPath(path, object); | |
object = parent(object, path); | |
var func = object == null ? object : object[toKey(last(path))]; | |
return func == null ? undefined$1 : apply(func, object, args); | |
} | |
function baseIsArguments(value) { | |
return isObjectLike(value) && baseGetTag(value) == argsTag; | |
} | |
function baseIsArrayBuffer(value) { | |
return isObjectLike(value) && baseGetTag(value) == arrayBufferTag; | |
} | |
function baseIsDate(value) { | |
return isObjectLike(value) && baseGetTag(value) == dateTag; | |
} | |
function baseIsEqual(value, other, bitmask, customizer, stack) { | |
if (value === other) { | |
return true; | |
} | |
if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) { | |
return value !== value && other !== other; | |
} | |
return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); | |
} | |
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { | |
var objIsArr = isArray2(object), othIsArr = isArray2(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other); | |
objTag = objTag == argsTag ? objectTag : objTag; | |
othTag = othTag == argsTag ? objectTag : othTag; | |
var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag; | |
if (isSameTag && isBuffer2(object)) { | |
if (!isBuffer2(other)) { | |
return false; | |
} | |
objIsArr = true; | |
objIsObj = false; | |
} | |
if (isSameTag && !objIsObj) { | |
stack || (stack = new Stack()); | |
return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); | |
} | |
if (!(bitmask & COMPARE_PARTIAL_FLAG)) { | |
var objIsWrapped = objIsObj && hasOwnProperty2.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty2.call(other, "__wrapped__"); | |
if (objIsWrapped || othIsWrapped) { | |
var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other; | |
stack || (stack = new Stack()); | |
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); | |
} | |
} | |
if (!isSameTag) { | |
return false; | |
} | |
stack || (stack = new Stack()); | |
return equalObjects(object, other, bitmask, customizer, equalFunc, stack); | |
} | |
function baseIsMap(value) { | |
return isObjectLike(value) && getTag(value) == mapTag; | |
} | |
function baseIsMatch(object, source, matchData, customizer) { | |
var index = matchData.length, length = index, noCustomizer = !customizer; | |
if (object == null) { | |
return !length; | |
} | |
object = Object2(object); | |
while (index--) { | |
var data = matchData[index]; | |
if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) { | |
return false; | |
} | |
} | |
while (++index < length) { | |
data = matchData[index]; | |
var key = data[0], objValue = object[key], srcValue = data[1]; | |
if (noCustomizer && data[2]) { | |
if (objValue === undefined$1 && !(key in object)) { | |
return false; | |
} | |
} else { | |
var stack = new Stack(); | |
if (customizer) { | |
var result2 = customizer(objValue, srcValue, key, object, source, stack); | |
} | |
if (!(result2 === undefined$1 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) : result2)) { | |
return false; | |
} | |
} | |
} | |
return true; | |
} | |
function baseIsNative(value) { | |
if (!isObject2(value) || isMasked(value)) { | |
return false; | |
} | |
var pattern = isFunction2(value) ? reIsNative : reIsHostCtor; | |
return pattern.test(toSource(value)); | |
} | |
function baseIsRegExp(value) { | |
return isObjectLike(value) && baseGetTag(value) == regexpTag; | |
} | |
function baseIsSet(value) { | |
return isObjectLike(value) && getTag(value) == setTag; | |
} | |
function baseIsTypedArray(value) { | |
return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; | |
} | |
function baseIteratee(value) { | |
if (typeof value == "function") { | |
return value; | |
} | |
if (value == null) { | |
return identity; | |
} | |
if (typeof value == "object") { | |
return isArray2(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value); | |
} | |
return property(value); | |
} | |
function baseKeys(object) { | |
if (!isPrototype(object)) { | |
return nativeKeys(object); | |
} | |
var result2 = []; | |
for (var key in Object2(object)) { | |
if (hasOwnProperty2.call(object, key) && key != "constructor") { | |
result2.push(key); | |
} | |
} | |
return result2; | |
} | |
function baseKeysIn(object) { | |
if (!isObject2(object)) { | |
return nativeKeysIn(object); | |
} | |
var isProto = isPrototype(object), result2 = []; | |
for (var key in object) { | |
if (!(key == "constructor" && (isProto || !hasOwnProperty2.call(object, key)))) { | |
result2.push(key); | |
} | |
} | |
return result2; | |
} | |
function baseLt(value, other) { | |
return value < other; | |
} | |
function baseMap(collection, iteratee2) { | |
var index = -1, result2 = isArrayLike(collection) ? Array2(collection.length) : []; | |
baseEach(collection, function(value, key, collection2) { | |
result2[++index] = iteratee2(value, key, collection2); | |
}); | |
return result2; | |
} | |
function baseMatches(source) { | |
var matchData = getMatchData(source); | |
if (matchData.length == 1 && matchData[0][2]) { | |
return matchesStrictComparable(matchData[0][0], matchData[0][1]); | |
} | |
return function(object) { | |
return object === source || baseIsMatch(object, source, matchData); | |
}; | |
} | |
function baseMatchesProperty(path, srcValue) { | |
if (isKey(path) && isStrictComparable(srcValue)) { | |
return matchesStrictComparable(toKey(path), srcValue); | |
} | |
return function(object) { | |
var objValue = get2(object, path); | |
return objValue === undefined$1 && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG); | |
}; | |
} | |
function baseMerge(object, source, srcIndex, customizer, stack) { | |
if (object === source) { | |
return; | |
} | |
baseFor(source, function(srcValue, key) { | |
stack || (stack = new Stack()); | |
if (isObject2(srcValue)) { | |
baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); | |
} else { | |
var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : undefined$1; | |
if (newValue === undefined$1) { | |
newValue = srcValue; | |
} | |
assignMergeValue(object, key, newValue); | |
} | |
}, keysIn); | |
} | |
function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { | |
var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue); | |
if (stacked) { | |
assignMergeValue(object, key, stacked); | |
return; | |
} | |
var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : undefined$1; | |
var isCommon = newValue === undefined$1; | |
if (isCommon) { | |
var isArr = isArray2(srcValue), isBuff = !isArr && isBuffer2(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue); | |
newValue = srcValue; | |
if (isArr || isBuff || isTyped) { | |
if (isArray2(objValue)) { | |
newValue = objValue; | |
} else if (isArrayLikeObject(objValue)) { | |
newValue = copyArray(objValue); | |
} else if (isBuff) { | |
isCommon = false; | |
newValue = cloneBuffer(srcValue, true); | |
} else if (isTyped) { | |
isCommon = false; | |
newValue = cloneTypedArray(srcValue, true); | |
} else { | |
newValue = []; | |
} | |
} else if (isPlainObject2(srcValue) || isArguments(srcValue)) { | |
newValue = objValue; | |
if (isArguments(objValue)) { | |
newValue = toPlainObject(objValue); | |
} else if (!isObject2(objValue) || isFunction2(objValue)) { | |
newValue = initCloneObject(srcValue); | |
} | |
} else { | |
isCommon = false; | |
} | |
} | |
if (isCommon) { | |
stack.set(srcValue, newValue); | |
mergeFunc(newValue, srcValue, srcIndex, customizer, stack); | |
stack["delete"](srcValue); | |
} | |
assignMergeValue(object, key, newValue); | |
} | |
function baseNth(array, n) { | |
var length = array.length; | |
if (!length) { | |
return; | |
} | |
n += n < 0 ? length : 0; | |
return isIndex(n, length) ? array[n] : undefined$1; | |
} | |
function baseOrderBy(collection, iteratees, orders) { | |
if (iteratees.length) { | |
iteratees = arrayMap(iteratees, function(iteratee2) { | |
if (isArray2(iteratee2)) { | |
return function(value) { | |
return baseGet(value, iteratee2.length === 1 ? iteratee2[0] : iteratee2); | |
}; | |
} | |
return iteratee2; | |
}); | |
} else { | |
iteratees = [identity]; | |
} | |
var index = -1; | |
iteratees = arrayMap(iteratees, baseUnary(getIteratee())); | |
var result2 = baseMap(collection, function(value, key, collection2) { | |
var criteria = arrayMap(iteratees, function(iteratee2) { | |
return iteratee2(value); | |
}); | |
return { "criteria": criteria, "index": ++index, "value": value }; | |
}); | |
return baseSortBy(result2, function(object, other) { | |
return compareMultiple(object, other, orders); | |
}); | |
} | |
function basePick(object, paths) { | |
return basePickBy(object, paths, function(value, path) { | |
return hasIn(object, path); | |
}); | |
} | |
function basePickBy(object, paths, predicate) { | |
var index = -1, length = paths.length, result2 = {}; | |
while (++index < length) { | |
var path = paths[index], value = baseGet(object, path); | |
if (predicate(value, path)) { | |
baseSet(result2, castPath(path, object), value); | |
} | |
} | |
return result2; | |
} | |
function basePropertyDeep(path) { | |
return function(object) { | |
return baseGet(object, path); | |
}; | |
} | |
function basePullAll(array, values2, iteratee2, comparator2) { | |
var indexOf3 = comparator2 ? baseIndexOfWith : baseIndexOf, index = -1, length = values2.length, seen = array; | |
if (array === values2) { | |
values2 = copyArray(values2); | |
} | |
if (iteratee2) { | |
seen = arrayMap(array, baseUnary(iteratee2)); | |
} | |
while (++index < length) { | |
var fromIndex = 0, value = values2[index], computed2 = iteratee2 ? iteratee2(value) : value; | |
while ((fromIndex = indexOf3(seen, computed2, fromIndex, comparator2)) > -1) { | |
if (seen !== array) { | |
splice.call(seen, fromIndex, 1); | |
} | |
splice.call(array, fromIndex, 1); | |
} | |
} | |
return array; | |
} | |
function basePullAt(array, indexes) { | |
var length = array ? indexes.length : 0, lastIndex = length - 1; | |
while (length--) { | |
var index = indexes[length]; | |
if (length == lastIndex || index !== previous) { | |
var previous = index; | |
if (isIndex(index)) { | |
splice.call(array, index, 1); | |
} else { | |
baseUnset(array, index); | |
} | |
} | |
} | |
return array; | |
} | |
function baseRandom(lower, upper) { | |
return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); | |
} | |
function baseRange(start, end, step, fromRight) { | |
var index = -1, length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), result2 = Array2(length); | |
while (length--) { | |
result2[fromRight ? length : ++index] = start; | |
start += step; | |
} | |
return result2; | |
} | |
function baseRepeat(string, n) { | |
var result2 = ""; | |
if (!string || n < 1 || n > MAX_SAFE_INTEGER) { | |
return result2; | |
} | |
do { | |
if (n % 2) { | |
result2 += string; | |
} | |
n = nativeFloor(n / 2); | |
if (n) { | |
string += string; | |
} | |
} while (n); | |
return result2; | |
} | |
function baseRest(func, start) { | |
return setToString(overRest(func, start, identity), func + ""); | |
} | |
function baseSample(collection) { | |
return arraySample(values(collection)); | |
} | |
function baseSampleSize(collection, n) { | |
var array = values(collection); | |
return shuffleSelf(array, baseClamp(n, 0, array.length)); | |
} | |
function baseSet(object, path, value, customizer) { | |
if (!isObject2(object)) { | |
return object; | |
} | |
path = castPath(path, object); | |
var index = -1, length = path.length, lastIndex = length - 1, nested = object; | |
while (nested != null && ++index < length) { | |
var key = toKey(path[index]), newValue = value; | |
if (key === "__proto__" || key === "constructor" || key === "prototype") { | |
return object; | |
} | |
if (index != lastIndex) { | |
var objValue = nested[key]; | |
newValue = customizer ? customizer(objValue, key, nested) : undefined$1; | |
if (newValue === undefined$1) { | |
newValue = isObject2(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {}; | |
} | |
} | |
assignValue(nested, key, newValue); | |
nested = nested[key]; | |
} | |
return object; | |
} | |
var baseSetData = !metaMap ? identity : function(func, data) { | |
metaMap.set(func, data); | |
return func; | |
}; | |
var baseSetToString = !defineProperty ? identity : function(func, string) { | |
return defineProperty(func, "toString", { | |
"configurable": true, | |
"enumerable": false, | |
"value": constant(string), | |
"writable": true | |
}); | |
}; | |
function baseShuffle(collection) { | |
return shuffleSelf(values(collection)); | |
} | |
function baseSlice(array, start, end) { | |
var index = -1, length = array.length; | |
if (start < 0) { | |
start = -start > length ? 0 : length + start; | |
} | |
end = end > length ? length : end; | |
if (end < 0) { | |
end += length; | |
} | |
length = start > end ? 0 : end - start >>> 0; | |
start >>>= 0; | |
var result2 = Array2(length); | |
while (++index < length) { | |
result2[index] = array[index + start]; | |
} | |
return result2; | |
} | |
function baseSome(collection, predicate) { | |
var result2; | |
baseEach(collection, function(value, index, collection2) { | |
result2 = predicate(value, index, collection2); | |
return !result2; | |
}); | |
return !!result2; | |
} | |
function baseSortedIndex(array, value, retHighest) { | |
var low = 0, high = array == null ? low : array.length; | |
if (typeof value == "number" && value === value && high <= HALF_MAX_ARRAY_LENGTH) { | |
while (low < high) { | |
var mid = low + high >>> 1, computed2 = array[mid]; | |
if (computed2 !== null && !isSymbol2(computed2) && (retHighest ? computed2 <= value : computed2 < value)) { | |
low = mid + 1; | |
} else { | |
high = mid; | |
} | |
} | |
return high; | |
} | |
return baseSortedIndexBy(array, value, identity, retHighest); | |
} | |
function baseSortedIndexBy(array, value, iteratee2, retHighest) { | |
var low = 0, high = array == null ? 0 : array.length; | |
if (high === 0) { | |
return 0; | |
} | |
value = iteratee2(value); | |
var valIsNaN = value !== value, valIsNull = value === null, valIsSymbol = isSymbol2(value), valIsUndefined = value === undefined$1; | |
while (low < high) { | |
var mid = nativeFloor((low + high) / 2), computed2 = iteratee2(array[mid]), othIsDefined = computed2 !== undefined$1, othIsNull = computed2 === null, othIsReflexive = computed2 === computed2, othIsSymbol = isSymbol2(computed2); | |
if (valIsNaN) { | |
var setLow = retHighest || othIsReflexive; | |
} else if (valIsUndefined) { | |
setLow = othIsReflexive && (retHighest || othIsDefined); | |
} else if (valIsNull) { | |
setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull); | |
} else if (valIsSymbol) { | |
setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol); | |
} else if (othIsNull || othIsSymbol) { | |
setLow = false; | |
} else { | |
setLow = retHighest ? computed2 <= value : computed2 < value; | |
} | |
if (setLow) { | |
low = mid + 1; | |
} else { | |
high = mid; | |
} | |
} | |
return nativeMin(high, MAX_ARRAY_INDEX); | |
} | |
function baseSortedUniq(array, iteratee2) { | |
var index = -1, length = array.length, resIndex = 0, result2 = []; | |
while (++index < length) { | |
var value = array[index], computed2 = iteratee2 ? iteratee2(value) : value; | |
if (!index || !eq(computed2, seen)) { | |
var seen = computed2; | |
result2[resIndex++] = value === 0 ? 0 : value; | |
} | |
} | |
return result2; | |
} | |
function baseToNumber(value) { | |
if (typeof value == "number") { | |
return value; | |
} | |
if (isSymbol2(value)) { | |
return NAN; | |
} | |
return +value; | |
} | |
function baseToString(value) { | |
if (typeof value == "string") { | |
return value; | |
} | |
if (isArray2(value)) { | |
return arrayMap(value, baseToString) + ""; | |
} | |
if (isSymbol2(value)) { | |
return symbolToString ? symbolToString.call(value) : ""; | |
} | |
var result2 = value + ""; | |
return result2 == "0" && 1 / value == -INFINITY ? "-0" : result2; | |
} | |
function baseUniq(array, iteratee2, comparator2) { | |
var index = -1, includes3 = arrayIncludes, length = array.length, isCommon = true, result2 = [], seen = result2; | |
if (comparator2) { | |
isCommon = false; | |
includes3 = arrayIncludesWith; | |
} else if (length >= LARGE_ARRAY_SIZE) { | |
var set22 = iteratee2 ? null : createSet(array); | |
if (set22) { | |
return setToArray(set22); | |
} | |
isCommon = false; | |
includes3 = cacheHas; | |
seen = new SetCache(); | |
} else { | |
seen = iteratee2 ? [] : result2; | |
} | |
outer: | |
while (++index < length) { | |
var value = array[index], computed2 = iteratee2 ? iteratee2(value) : value; | |
value = comparator2 || value !== 0 ? value : 0; | |
if (isCommon && computed2 === computed2) { | |
var seenIndex = seen.length; | |
while (seenIndex--) { | |
if (seen[seenIndex] === computed2) { | |
continue outer; | |
} | |
} | |
if (iteratee2) { | |
seen.push(computed2); | |
} | |
result2.push(value); | |
} else if (!includes3(seen, computed2, comparator2)) { | |
if (seen !== result2) { | |
seen.push(computed2); | |
} | |
result2.push(value); | |
} | |
} | |
return result2; | |
} | |
function baseUnset(object, path) { | |
path = castPath(path, object); | |
object = parent(object, path); | |
return object == null || delete object[toKey(last(path))]; | |
} | |
function baseUpdate(object, path, updater, customizer) { | |
return baseSet(object, path, updater(baseGet(object, path)), customizer); | |
} | |
function baseWhile(array, predicate, isDrop, fromRight) { | |
var length = array.length, index = fromRight ? length : -1; | |
while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) { | |
} | |
return isDrop ? baseSlice(array, fromRight ? 0 : index, fromRight ? index + 1 : length) : baseSlice(array, fromRight ? index + 1 : 0, fromRight ? length : index); | |
} | |
function baseWrapperValue(value, actions) { | |
var result2 = value; | |
if (result2 instanceof LazyWrapper) { | |
result2 = result2.value(); | |
} | |
return arrayReduce(actions, function(result3, action) { | |
return action.func.apply(action.thisArg, arrayPush([result3], action.args)); | |
}, result2); | |
} | |
function baseXor(arrays, iteratee2, comparator2) { | |
var length = arrays.length; | |
if (length < 2) { | |
return length ? baseUniq(arrays[0]) : []; | |
} | |
var index = -1, result2 = Array2(length); | |
while (++index < length) { | |
var array = arrays[index], othIndex = -1; | |
while (++othIndex < length) { | |
if (othIndex != index) { | |
result2[index] = baseDifference(result2[index] || array, arrays[othIndex], iteratee2, comparator2); | |
} | |
} | |
} | |
return baseUniq(baseFlatten(result2, 1), iteratee2, comparator2); | |
} | |
function baseZipObject(props, values2, assignFunc) { | |
var index = -1, length = props.length, valsLength = values2.length, result2 = {}; | |
while (++index < length) { | |
var value = index < valsLength ? values2[index] : undefined$1; | |
assignFunc(result2, props[index], value); | |
} | |
return result2; | |
} | |
function castArrayLikeObject(value) { | |
return isArrayLikeObject(value) ? value : []; | |
} | |
function castFunction(value) { | |
return typeof value == "function" ? value : identity; | |
} | |
function castPath(value, object) { | |
if (isArray2(value)) { | |
return value; | |
} | |
return isKey(value, object) ? [value] : stringToPath(toString3(value)); | |
} | |
var castRest = baseRest; | |
function castSlice(array, start, end) { | |
var length = array.length; | |
end = end === undefined$1 ? length : end; | |
return !start && end >= length ? array : baseSlice(array, start, end); | |
} | |
var clearTimeout = ctxClearTimeout || function(id) { | |
return root.clearTimeout(id); | |
}; | |
function cloneBuffer(buffer2, isDeep) { | |
if (isDeep) { | |
return buffer2.slice(); | |
} | |
var length = buffer2.length, result2 = allocUnsafe2 ? allocUnsafe2(length) : new buffer2.constructor(length); | |
buffer2.copy(result2); | |
return result2; | |
} | |
function cloneArrayBuffer(arrayBuffer) { | |
var result2 = new arrayBuffer.constructor(arrayBuffer.byteLength); | |
new Uint8Array2(result2).set(new Uint8Array2(arrayBuffer)); | |
return result2; | |
} | |
function cloneDataView(dataView, isDeep) { | |
var buffer2 = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; | |
return new dataView.constructor(buffer2, dataView.byteOffset, dataView.byteLength); | |
} | |
function cloneRegExp(regexp) { | |
var result2 = new regexp.constructor(regexp.source, reFlags.exec(regexp)); | |
result2.lastIndex = regexp.lastIndex; | |
return result2; | |
} | |
function cloneSymbol(symbol) { | |
return symbolValueOf ? Object2(symbolValueOf.call(symbol)) : {}; | |
} | |
function cloneTypedArray(typedArray, isDeep) { | |
var buffer2 = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; | |
return new typedArray.constructor(buffer2, typedArray.byteOffset, typedArray.length); | |
} | |
function compareAscending(value, other) { | |
if (value !== other) { | |
var valIsDefined = value !== undefined$1, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol2(value); | |
var othIsDefined = other !== undefined$1, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol2(other); | |
if (!othIsNull && !othIsSymbol && !valIsSymbol && value > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) { | |
return 1; | |
} | |
if (!valIsNull && !valIsSymbol && !othIsSymbol && value < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) { | |
return -1; | |
} | |
} | |
return 0; | |
} | |
function compareMultiple(object, other, orders) { | |
var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length; | |
while (++index < length) { | |
var result2 = compareAscending(objCriteria[index], othCriteria[index]); | |
if (result2) { | |
if (index >= ordersLength) { | |
return result2; | |
} | |
var order = orders[index]; | |
return result2 * (order == "desc" ? -1 : 1); | |
} | |
} | |
return object.index - other.index; | |
} | |
function composeArgs(args, partials, holders, isCurried) { | |
var argsIndex = -1, argsLength = args.length, holdersLength = holders.length, leftIndex = -1, leftLength = partials.length, rangeLength = nativeMax(argsLength - holdersLength, 0), result2 = Array2(leftLength + rangeLength), isUncurried = !isCurried; | |
while (++leftIndex < leftLength) { | |
result2[leftIndex] = partials[leftIndex]; | |
} | |
while (++argsIndex < holdersLength) { | |
if (isUncurried || argsIndex < argsLength) { | |
result2[holders[argsIndex]] = args[argsIndex]; | |
} | |
} | |
while (rangeLength--) { | |
result2[leftIndex++] = args[argsIndex++]; | |
} | |
return result2; | |
} | |
function composeArgsRight(args, partials, holders, isCurried) { | |
var argsIndex = -1, argsLength = args.length, holdersIndex = -1, holdersLength = holders.length, rightIndex = -1, rightLength = partials.length, rangeLength = nativeMax(argsLength - holdersLength, 0), result2 = Array2(rangeLength + rightLength), isUncurried = !isCurried; | |
while (++argsIndex < rangeLength) { | |
result2[argsIndex] = args[argsIndex]; | |
} | |
var offset = argsIndex; | |
while (++rightIndex < rightLength) { | |
result2[offset + rightIndex] = partials[rightIndex]; | |
} | |
while (++holdersIndex < holdersLength) { | |
if (isUncurried || argsIndex < argsLength) { | |
result2[offset + holders[holdersIndex]] = args[argsIndex++]; | |
} | |
} | |
return result2; | |
} | |
function copyArray(source, array) { | |
var index = -1, length = source.length; | |
array || (array = Array2(length)); | |
while (++index < length) { | |
array[index] = source[index]; | |
} | |
return array; | |
} | |
function copyObject(source, props, object, customizer) { | |
var isNew = !object; | |
object || (object = {}); | |
var index = -1, length = props.length; | |
while (++index < length) { | |
var key = props[index]; | |
var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined$1; | |
if (newValue === undefined$1) { | |
newValue = source[key]; | |
} | |
if (isNew) { | |
baseAssignValue(object, key, newValue); | |
} else { | |
assignValue(object, key, newValue); | |
} | |
} | |
return object; | |
} | |
function copySymbols(source, object) { | |
return copyObject(source, getSymbols(source), object); | |
} | |
function copySymbolsIn(source, object) { | |
return copyObject(source, getSymbolsIn(source), object); | |
} | |
function createAggregator(setter, initializer) { | |
return function(collection, iteratee2) { | |
var func = isArray2(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {}; | |
return func(collection, setter, getIteratee(iteratee2, 2), accumulator); | |
}; | |
} | |
function createAssigner(assigner) { | |
return baseRest(function(object, sources) { | |
var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : undefined$1, guard = length > 2 ? sources[2] : undefined$1; | |
customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : undefined$1; | |
if (guard && isIterateeCall(sources[0], sources[1], guard)) { | |
customizer = length < 3 ? undefined$1 : customizer; | |
length = 1; | |
} | |
object = Object2(object); | |
while (++index < length) { | |
var source = sources[index]; | |
if (source) { | |
assigner(object, source, index, customizer); | |
} | |
} | |
return object; | |
}); | |
} | |
function createBaseEach(eachFunc, fromRight) { | |
return function(collection, iteratee2) { | |
if (collection == null) { | |
return collection; | |
} | |
if (!isArrayLike(collection)) { | |
return eachFunc(collection, iteratee2); | |
} | |
var length = collection.length, index = fromRight ? length : -1, iterable = Object2(collection); | |
while (fromRight ? index-- : ++index < length) { | |
if (iteratee2(iterable[index], index, iterable) === false) { | |
break; | |
} | |
} | |
return collection; | |
}; | |
} | |
function createBaseFor(fromRight) { | |
return function(object, iteratee2, keysFunc) { | |
var index = -1, iterable = Object2(object), props = keysFunc(object), length = props.length; | |
while (length--) { | |
var key = props[fromRight ? length : ++index]; | |
if (iteratee2(iterable[key], key, iterable) === false) { | |
break; | |
} | |
} | |
return object; | |
}; | |
} | |
function createBind(func, bitmask, thisArg) { | |
var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func); | |
function wrapper() { | |
var fn = this && this !== root && this instanceof wrapper ? Ctor : func; | |
return fn.apply(isBind ? thisArg : this, arguments); | |
} | |
return wrapper; | |
} | |
function createCaseFirst(methodName) { | |
return function(string) { | |
string = toString3(string); | |
var strSymbols = hasUnicode(string) ? stringToArray(string) : undefined$1; | |
var chr = strSymbols ? strSymbols[0] : string.charAt(0); | |
var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string.slice(1); | |
return chr[methodName]() + trailing; | |
}; | |
} | |
function createCompounder(callback) { | |
return function(string) { | |
return arrayReduce(words(deburr(string).replace(reApos, "")), callback, ""); | |
}; | |
} | |
function createCtor(Ctor) { | |
return function() { | |
var args = arguments; | |
switch (args.length) { | |
case 0: | |
return new Ctor(); | |
case 1: | |
return new Ctor(args[0]); | |
case 2: | |
return new Ctor(args[0], args[1]); | |
case 3: | |
return new Ctor(args[0], args[1], args[2]); | |
case 4: | |
return new Ctor(args[0], args[1], args[2], args[3]); | |
case 5: | |
return new Ctor(args[0], args[1], args[2], args[3], args[4]); | |
case 6: | |
return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]); | |
case 7: | |
return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); | |
} | |
var thisBinding = baseCreate(Ctor.prototype), result2 = Ctor.apply(thisBinding, args); | |
return isObject2(result2) ? result2 : thisBinding; | |
}; | |
} | |
function createCurry(func, bitmask, arity) { | |
var Ctor = createCtor(func); | |
function wrapper() { | |
var length = arguments.length, args = Array2(length), index = length, placeholder = getHolder(wrapper); | |
while (index--) { | |
args[index] = arguments[index]; | |
} | |
var holders = length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder ? [] : replaceHolders(args, placeholder); | |
length -= holders.length; | |
if (length < arity) { | |
return createRecurry( | |
func, | |
bitmask, | |
createHybrid, | |
wrapper.placeholder, | |
undefined$1, | |
args, | |
holders, | |
undefined$1, | |
undefined$1, | |
arity - length | |
); | |
} | |
var fn = this && this !== root && this instanceof wrapper ? Ctor : func; | |
return apply(fn, this, args); | |
} | |
return wrapper; | |
} | |
function createFind(findIndexFunc) { | |
return function(collection, predicate, fromIndex) { | |
var iterable = Object2(collection); | |
if (!isArrayLike(collection)) { | |
var iteratee2 = getIteratee(predicate, 3); | |
collection = keys(collection); | |
predicate = function(key) { | |
return iteratee2(iterable[key], key, iterable); | |
}; | |
} | |
var index = findIndexFunc(collection, predicate, fromIndex); | |
return index > -1 ? iterable[iteratee2 ? collection[index] : index] : undefined$1; | |
}; | |
} | |
function createFlow(fromRight) { | |
return flatRest(function(funcs) { | |
var length = funcs.length, index = length, prereq = LodashWrapper.prototype.thru; | |
if (fromRight) { | |
funcs.reverse(); | |
} | |
while (index--) { | |
var func = funcs[index]; | |
if (typeof func != "function") { | |
throw new TypeError2(FUNC_ERROR_TEXT); | |
} | |
if (prereq && !wrapper && getFuncName(func) == "wrapper") { | |
var wrapper = new LodashWrapper([], true); | |
} | |
} | |
index = wrapper ? index : length; | |
while (++index < length) { | |
func = funcs[index]; | |
var funcName = getFuncName(func), data = funcName == "wrapper" ? getData(func) : undefined$1; | |
if (data && isLaziable(data[0]) && data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && !data[4].length && data[9] == 1) { | |
wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]); | |
} else { | |
wrapper = func.length == 1 && isLaziable(func) ? wrapper[funcName]() : wrapper.thru(func); | |
} | |
} | |
return function() { | |
var args = arguments, value = args[0]; | |
if (wrapper && args.length == 1 && isArray2(value)) { | |
return wrapper.plant(value).value(); | |
} | |
var index2 = 0, result2 = length ? funcs[index2].apply(this, args) : value; | |
while (++index2 < length) { | |
result2 = funcs[index2].call(this, result2); | |
} | |
return result2; | |
}; | |
}); | |
} | |
function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary2, arity) { | |
var isAry = bitmask & WRAP_ARY_FLAG, isBind = bitmask & WRAP_BIND_FLAG, isBindKey = bitmask & WRAP_BIND_KEY_FLAG, isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), isFlip = bitmask & WRAP_FLIP_FLAG, Ctor = isBindKey ? undefined$1 : createCtor(func); | |
function wrapper() { | |
var length = arguments.length, args = Array2(length), index = length; | |
while (index--) { | |
args[index] = arguments[index]; | |
} | |
if (isCurried) { | |
var placeholder = getHolder(wrapper), holdersCount = countHolders(args, placeholder); | |
} | |
if (partials) { | |
args = composeArgs(args, partials, holders, isCurried); | |
} | |
if (partialsRight) { | |
args = composeArgsRight(args, partialsRight, holdersRight, isCurried); | |
} | |
length -= holdersCount; | |
if (isCurried && length < arity) { | |
var newHolders = replaceHolders(args, placeholder); | |
return createRecurry( | |
func, | |
bitmask, | |
createHybrid, | |
wrapper.placeholder, | |
thisArg, | |
args, | |
newHolders, | |
argPos, | |
ary2, | |
arity - length | |
); | |
} | |
var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func; | |
length = args.length; | |
if (argPos) { | |
args = reorder(args, argPos); | |
} else if (isFlip && length > 1) { | |
args.reverse(); | |
} | |
if (isAry && ary2 < length) { | |
args.length = ary2; | |
} | |
if (this && this !== root && this instanceof wrapper) { | |
fn = Ctor || createCtor(fn); | |
} | |
return fn.apply(thisBinding, args); | |
} | |
return wrapper; | |
} | |
function createInverter(setter, toIteratee) { | |
return function(object, iteratee2) { | |
return baseInverter(object, setter, toIteratee(iteratee2), {}); | |
}; | |
} | |
function createMathOperation(operator, defaultValue) { | |
return function(value, other) { | |
var result2; | |
if (value === undefined$1 && other === undefined$1) { | |
return defaultValue; | |
} | |
if (value !== undefined$1) { | |
result2 = value; | |
} | |
if (other !== undefined$1) { | |
if (result2 === undefined$1) { | |
return other; | |
} | |
if (typeof value == "string" || typeof other == "string") { | |
value = baseToString(value); | |
other = baseToString(other); | |
} else { | |
value = baseToNumber(value); | |
other = baseToNumber(other); | |
} | |
result2 = operator(value, other); | |
} | |
return result2; | |
}; | |
} | |
function createOver(arrayFunc) { | |
return flatRest(function(iteratees) { | |
iteratees = arrayMap(iteratees, baseUnary(getIteratee())); | |
return baseRest(function(args) { | |
var thisArg = this; | |
return arrayFunc(iteratees, function(iteratee2) { | |
return apply(iteratee2, thisArg, args); | |
}); | |
}); | |
}); | |
} | |
function createPadding(length, chars) { | |
chars = chars === undefined$1 ? " " : baseToString(chars); | |
var charsLength = chars.length; | |
if (charsLength < 2) { | |
return charsLength ? baseRepeat(chars, length) : chars; | |
} | |
var result2 = baseRepeat(chars, nativeCeil(length / stringSize(chars))); | |
return hasUnicode(chars) ? castSlice(stringToArray(result2), 0, length).join("") : result2.slice(0, length); | |
} | |
function createPartial(func, bitmask, thisArg, partials) { | |
var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func); | |
function wrapper() { | |
var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array2(leftLength + argsLength), fn = this && this !== root && this instanceof wrapper ? Ctor : func; | |
while (++leftIndex < leftLength) { | |
args[leftIndex] = partials[leftIndex]; | |
} | |
while (argsLength--) { | |
args[leftIndex++] = arguments[++argsIndex]; | |
} | |
return apply(fn, isBind ? thisArg : this, args); | |
} | |
return wrapper; | |
} | |
function createRange(fromRight) { | |
return function(start, end, step) { | |
if (step && typeof step != "number" && isIterateeCall(start, end, step)) { | |
end = step = undefined$1; | |
} | |
start = toFinite(start); | |
if (end === undefined$1) { | |
end = start; | |
start = 0; | |
} else { | |
end = toFinite(end); | |
} | |
step = step === undefined$1 ? start < end ? 1 : -1 : toFinite(step); | |
return baseRange(start, end, step, fromRight); | |
}; | |
} | |
function createRelationalOperation(operator) { | |
return function(value, other) { | |
if (!(typeof value == "string" && typeof other == "string")) { | |
value = toNumber2(value); | |
other = toNumber2(other); | |
} | |
return operator(value, other); | |
}; | |
} | |
function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary2, arity) { | |
var isCurry = bitmask & WRAP_CURRY_FLAG, newHolders = isCurry ? holders : undefined$1, newHoldersRight = isCurry ? undefined$1 : holders, newPartials = isCurry ? partials : undefined$1, newPartialsRight = isCurry ? undefined$1 : partials; | |
bitmask |= isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG; | |
bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG); | |
if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) { | |
bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG); | |
} | |
var newData = [ | |
func, | |
bitmask, | |
thisArg, | |
newPartials, | |
newHolders, | |
newPartialsRight, | |
newHoldersRight, | |
argPos, | |
ary2, | |
arity | |
]; | |
var result2 = wrapFunc.apply(undefined$1, newData); | |
if (isLaziable(func)) { | |
setData(result2, newData); | |
} | |
result2.placeholder = placeholder; | |
return setWrapToString(result2, func, bitmask); | |
} | |
function createRound(methodName) { | |
var func = Math2[methodName]; | |
return function(number, precision) { | |
number = toNumber2(number); | |
precision = precision == null ? 0 : nativeMin(toInteger(precision), 292); | |
if (precision && nativeIsFinite(number)) { | |
var pair = (toString3(number) + "e").split("e"), value = func(pair[0] + "e" + (+pair[1] + precision)); | |
pair = (toString3(value) + "e").split("e"); | |
return +(pair[0] + "e" + (+pair[1] - precision)); | |
} | |
return func(number); | |
}; | |
} | |
var createSet = !(Set2 && 1 / setToArray(new Set2([, -0]))[1] == INFINITY) ? noop : function(values2) { | |
return new Set2(values2); | |
}; | |
function createToPairs(keysFunc) { | |
return function(object) { | |
var tag = getTag(object); | |
if (tag == mapTag) { | |
return mapToArray(object); | |
} | |
if (tag == setTag) { | |
return setToPairs(object); | |
} | |
return baseToPairs(object, keysFunc(object)); | |
}; | |
} | |
function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary2, arity) { | |
var isBindKey = bitmask & WRAP_BIND_KEY_FLAG; | |
if (!isBindKey && typeof func != "function") { | |
throw new TypeError2(FUNC_ERROR_TEXT); | |
} | |
var length = partials ? partials.length : 0; | |
if (!length) { | |
bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG); | |
partials = holders = undefined$1; | |
} | |
ary2 = ary2 === undefined$1 ? ary2 : nativeMax(toInteger(ary2), 0); | |
arity = arity === undefined$1 ? arity : toInteger(arity); | |
length -= holders ? holders.length : 0; | |
if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) { | |
var partialsRight = partials, holdersRight = holders; | |
partials = holders = undefined$1; | |
} | |
var data = isBindKey ? undefined$1 : getData(func); | |
var newData = [ | |
func, | |
bitmask, | |
thisArg, | |
partials, | |
holders, | |
partialsRight, | |
holdersRight, | |
argPos, | |
ary2, | |
arity | |
]; | |
if (data) { | |
mergeData(newData, data); | |
} | |
func = newData[0]; | |
bitmask = newData[1]; | |
thisArg = newData[2]; | |
partials = newData[3]; | |
holders = newData[4]; | |
arity = newData[9] = newData[9] === undefined$1 ? isBindKey ? 0 : func.length : nativeMax(newData[9] - length, 0); | |
if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) { | |
bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG); | |
} | |
if (!bitmask || bitmask == WRAP_BIND_FLAG) { | |
var result2 = createBind(func, bitmask, thisArg); | |
} else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) { | |
result2 = createCurry(func, bitmask, arity); | |
} else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) { | |
result2 = createPartial(func, bitmask, thisArg, partials); | |
} else { | |
result2 = createHybrid.apply(undefined$1, newData); | |
} | |
var setter = data ? baseSetData : setData; | |
return setWrapToString(setter(result2, newData), func, bitmask); | |
} | |
function customDefaultsAssignIn(objValue, srcValue, key, object) { | |
if (objValue === undefined$1 || eq(objValue, objectProto[key]) && !hasOwnProperty2.call(object, key)) { | |
return srcValue; | |
} | |
return objValue; | |
} | |
function customDefaultsMerge(objValue, srcValue, key, object, source, stack) { | |
if (isObject2(objValue) && isObject2(srcValue)) { | |
stack.set(srcValue, objValue); | |
baseMerge(objValue, srcValue, undefined$1, customDefaultsMerge, stack); | |
stack["delete"](srcValue); | |
} | |
return objValue; | |
} | |
function customOmitClone(value) { | |
return isPlainObject2(value) ? undefined$1 : value; | |
} | |
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { | |
var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array.length, othLength = other.length; | |
if (arrLength != othLength && !(isPartial && othLength > arrLength)) { | |
return false; | |
} | |
var arrStacked = stack.get(array); | |
var othStacked = stack.get(other); | |
if (arrStacked && othStacked) { | |
return arrStacked == other && othStacked == array; | |
} | |
var index = -1, result2 = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : undefined$1; | |
stack.set(array, other); | |
stack.set(other, array); | |
while (++index < arrLength) { | |
var arrValue = array[index], othValue = other[index]; | |
if (customizer) { | |
var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack); | |
} | |
if (compared !== undefined$1) { | |
if (compared) { | |
continue; | |
} | |
result2 = false; | |
break; | |
} | |
if (seen) { | |
if (!arraySome(other, function(othValue2, othIndex) { | |
if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) { | |
return seen.push(othIndex); | |
} | |
})) { | |
result2 = false; | |
break; | |
} | |
} else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { | |
result2 = false; | |
break; | |
} | |
} | |
stack["delete"](array); | |
stack["delete"](other); | |
return result2; | |
} | |
function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { | |
switch (tag) { | |
case dataViewTag: | |
if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) { | |
return false; | |
} | |
object = object.buffer; | |
other = other.buffer; | |
case arrayBufferTag: | |
if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array2(object), new Uint8Array2(other))) { | |
return false; | |
} | |
return true; | |
case boolTag: | |
case dateTag: | |
case numberTag: | |
return eq(+object, +other); | |
case errorTag: | |
return object.name == other.name && object.message == other.message; | |
case regexpTag: | |
case stringTag: | |
return object == other + ""; | |
case mapTag: | |
var convert = mapToArray; | |
case setTag: | |
var isPartial = bitmask & COMPARE_PARTIAL_FLAG; | |
convert || (convert = setToArray); | |
if (object.size != other.size && !isPartial) { | |
return false; | |
} | |
var stacked = stack.get(object); | |
if (stacked) { | |
return stacked == other; | |
} | |
bitmask |= COMPARE_UNORDERED_FLAG; | |
stack.set(object, other); | |
var result2 = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); | |
stack["delete"](object); | |
return result2; | |
case symbolTag: | |
if (symbolValueOf) { | |
return symbolValueOf.call(object) == symbolValueOf.call(other); | |
} | |
} | |
return false; | |
} | |
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { | |
var isPartial = bitmask & COMPARE_PARTIAL_FLAG, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length; | |
if (objLength != othLength && !isPartial) { | |
return false; | |
} | |
var index = objLength; | |
while (index--) { | |
var key = objProps[index]; | |
if (!(isPartial ? key in other : hasOwnProperty2.call(other, key))) { | |
return false; | |
} | |
} | |
var objStacked = stack.get(object); | |
var othStacked = stack.get(other); | |
if (objStacked && othStacked) { | |
return objStacked == other && othStacked == object; | |
} | |
var result2 = true; | |
stack.set(object, other); | |
stack.set(other, object); | |
var skipCtor = isPartial; | |
while (++index < objLength) { | |
key = objProps[index]; | |
var objValue = object[key], othValue = other[key]; | |
if (customizer) { | |
var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack); | |
} | |
if (!(compared === undefined$1 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) { | |
result2 = false; | |
break; | |
} | |
skipCtor || (skipCtor = key == "constructor"); | |
} | |
if (result2 && !skipCtor) { | |
var objCtor = object.constructor, othCtor = other.constructor; | |
if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) { | |
result2 = false; | |
} | |
} | |
stack["delete"](object); | |
stack["delete"](other); | |
return result2; | |
} | |
function flatRest(func) { | |
return setToString(overRest(func, undefined$1, flatten), func + ""); | |
} | |
function getAllKeys(object) { | |
return baseGetAllKeys(object, keys, getSymbols); | |
} | |
function getAllKeysIn(object) { | |
return baseGetAllKeys(object, keysIn, getSymbolsIn); | |
} | |
var getData = !metaMap ? noop : function(func) { | |
return metaMap.get(func); | |
}; | |
function getFuncName(func) { | |
var result2 = func.name + "", array = realNames[result2], length = hasOwnProperty2.call(realNames, result2) ? array.length : 0; | |
while (length--) { | |
var data = array[length], otherFunc = data.func; | |
if (otherFunc == null || otherFunc == func) { | |
return data.name; | |
} | |
} | |
return result2; | |
} | |
function getHolder(func) { | |
var object = hasOwnProperty2.call(lodash2, "placeholder") ? lodash2 : func; | |
return object.placeholder; | |
} | |
function getIteratee() { | |
var result2 = lodash2.iteratee || iteratee; | |
result2 = result2 === iteratee ? baseIteratee : result2; | |
return arguments.length ? result2(arguments[0], arguments[1]) : result2; | |
} | |
function getMapData(map2, key) { | |
var data = map2.__data__; | |
return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map; | |
} | |
function getMatchData(object) { | |
var result2 = keys(object), length = result2.length; | |
while (length--) { | |
var key = result2[length], value = object[key]; | |
result2[length] = [key, value, isStrictComparable(value)]; | |
} | |
return result2; | |
} | |
function getNative(object, key) { | |
var value = getValue(object, key); | |
return baseIsNative(value) ? value : undefined$1; | |
} | |
function getRawTag(value) { | |
var isOwn = hasOwnProperty2.call(value, symToStringTag), tag = value[symToStringTag]; | |
try { | |
value[symToStringTag] = undefined$1; | |
var unmasked = true; | |
} catch (e) { | |
} | |
var result2 = nativeObjectToString.call(value); | |
if (unmasked) { | |
if (isOwn) { | |
value[symToStringTag] = tag; | |
} else { | |
delete value[symToStringTag]; | |
} | |
} | |
return result2; | |
} | |
var getSymbols = !nativeGetSymbols ? stubArray : function(object) { | |
if (object == null) { | |
return []; | |
} | |
object = Object2(object); | |
return arrayFilter(nativeGetSymbols(object), function(symbol) { | |
return propertyIsEnumerable.call(object, symbol); | |
}); | |
}; | |
var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) { | |
var result2 = []; | |
while (object) { | |
arrayPush(result2, getSymbols(object)); | |
object = getPrototype(object); | |
} | |
return result2; | |
}; | |
var getTag = baseGetTag; | |
if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map2 && getTag(new Map2()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set2 && getTag(new Set2()) != setTag || WeakMap2 && getTag(new WeakMap2()) != weakMapTag) { | |
getTag = function(value) { | |
var result2 = baseGetTag(value), Ctor = result2 == objectTag ? value.constructor : undefined$1, ctorString = Ctor ? toSource(Ctor) : ""; | |
if (ctorString) { | |
switch (ctorString) { | |
case dataViewCtorString: | |
return dataViewTag; | |
case mapCtorString: | |
return mapTag; | |
case promiseCtorString: | |
return promiseTag; | |
case setCtorString: | |
return setTag; | |
case weakMapCtorString: | |
return weakMapTag; | |
} | |
} | |
return result2; | |
}; | |
} | |
function getView(start, end, transforms) { | |
var index = -1, length = transforms.length; | |
while (++index < length) { | |
var data = transforms[index], size22 = data.size; | |
switch (data.type) { | |
case "drop": | |
start += size22; | |
break; | |
case "dropRight": | |
end -= size22; | |
break; | |
case "take": | |
end = nativeMin(end, start + size22); | |
break; | |
case "takeRight": | |
start = nativeMax(start, end - size22); | |
break; | |
} | |
} | |
return { "start": start, "end": end }; | |
} | |
function getWrapDetails(source) { | |
var match = source.match(reWrapDetails); | |
return match ? match[1].split(reSplitDetails) : []; | |
} | |
function hasPath(object, path, hasFunc) { | |
path = castPath(path, object); | |
var index = -1, length = path.length, result2 = false; | |
while (++index < length) { | |
var key = toKey(path[index]); | |
if (!(result2 = object != null && hasFunc(object, key))) { | |
break; | |
} | |
object = object[key]; | |
} | |
if (result2 || ++index != length) { | |
return result2; | |
} | |
length = object == null ? 0 : object.length; | |
return !!length && isLength(length) && isIndex(key, length) && (isArray2(object) || isArguments(object)); | |
} | |
function initCloneArray(array) { | |
var length = array.length, result2 = new array.constructor(length); | |
if (length && typeof array[0] == "string" && hasOwnProperty2.call(array, "index")) { | |
result2.index = array.index; | |
result2.input = array.input; | |
} | |
return result2; | |
} | |
function initCloneObject(object) { | |
return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {}; | |
} | |
function initCloneByTag(object, tag, isDeep) { | |
var Ctor = object.constructor; | |
switch (tag) { | |
case arrayBufferTag: | |
return cloneArrayBuffer(object); | |
case boolTag: | |
case dateTag: | |
return new Ctor(+object); | |
case dataViewTag: | |
return cloneDataView(object, isDeep); | |
case float32Tag: | |
case float64Tag: | |
case int8Tag: | |
case int16Tag: | |
case int32Tag: | |
case uint8Tag: | |
case uint8ClampedTag: | |
case uint16Tag: | |
case uint32Tag: | |
return cloneTypedArray(object, isDeep); | |
case mapTag: | |
return new Ctor(); | |
case numberTag: | |
case stringTag: | |
return new Ctor(object); | |
case regexpTag: | |
return cloneRegExp(object); | |
case setTag: | |
return new Ctor(); | |
case symbolTag: | |
return cloneSymbol(object); | |
} | |
} | |
function insertWrapDetails(source, details) { | |
var length = details.length; | |
if (!length) { | |
return source; | |
} | |
var lastIndex = length - 1; | |
details[lastIndex] = (length > 1 ? "& " : "") + details[lastIndex]; | |
details = details.join(length > 2 ? ", " : " "); | |
return source.replace(reWrapComment, "{\n/* [wrapped with " + details + "] */\n"); | |
} | |
function isFlattenable(value) { | |
return isArray2(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]); | |
} | |
function isIndex(value, length) { | |
var type = typeof value; | |
length = length == null ? MAX_SAFE_INTEGER : length; | |
return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length); | |
} | |
function isIterateeCall(value, index, object) { | |
if (!isObject2(object)) { | |
return false; | |
} | |
var type = typeof index; | |
if (type == "number" ? isArrayLike(object) && isIndex(index, object.length) : type == "string" && index in object) { | |
return eq(object[index], value); | |
} | |
return false; | |
} | |
function isKey(value, object) { | |
if (isArray2(value)) { | |
return false; | |
} | |
var type = typeof value; | |
if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol2(value)) { | |
return true; | |
} | |
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object2(object); | |
} | |
function isKeyable(value) { | |
var type = typeof value; | |
return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null; | |
} | |
function isLaziable(func) { | |
var funcName = getFuncName(func), other = lodash2[funcName]; | |
if (typeof other != "function" || !(funcName in LazyWrapper.prototype)) { | |
return false; | |
} | |
if (func === other) { | |
return true; | |
} | |
var data = getData(other); | |
return !!data && func === data[0]; | |
} | |
function isMasked(func) { | |
return !!maskSrcKey && maskSrcKey in func; | |
} | |
var isMaskable = coreJsData ? isFunction2 : stubFalse; | |
function isPrototype(value) { | |
var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto; | |
return value === proto; | |
} | |
function isStrictComparable(value) { | |
return value === value && !isObject2(value); | |
} | |
function matchesStrictComparable(key, srcValue) { | |
return function(object) { | |
if (object == null) { | |
return false; | |
} | |
return object[key] === srcValue && (srcValue !== undefined$1 || key in Object2(object)); | |
}; | |
} | |
function memoizeCapped(func) { | |
var result2 = memoize(func, function(key) { | |
if (cache.size === MAX_MEMOIZE_SIZE) { | |
cache.clear(); | |
} | |
return key; | |
}); | |
var cache = result2.cache; | |
return result2; | |
} | |
function mergeData(data, source) { | |
var bitmask = data[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); | |
var isCombo = srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_CURRY_FLAG || srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_REARG_FLAG && data[7].length <= source[8] || srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG) && source[7].length <= source[8] && bitmask == WRAP_CURRY_FLAG; | |
if (!(isCommon || isCombo)) { | |
return data; | |
} | |
if (srcBitmask & WRAP_BIND_FLAG) { | |
data[2] = source[2]; | |
newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG; | |
} | |
var value = source[3]; | |
if (value) { | |
var partials = data[3]; | |
data[3] = partials ? composeArgs(partials, value, source[4]) : value; | |
data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4]; | |
} | |
value = source[5]; | |
if (value) { | |
partials = data[5]; | |
data[5] = partials ? composeArgsRight(partials, value, source[6]) : value; | |
data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6]; | |
} | |
value = source[7]; | |
if (value) { | |
data[7] = value; | |
} | |
if (srcBitmask & WRAP_ARY_FLAG) { | |
data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]); | |
} | |
if (data[9] == null) { | |
data[9] = source[9]; | |
} | |
data[0] = source[0]; | |
data[1] = newBitmask; | |
return data; | |
} | |
function nativeKeysIn(object) { | |
var result2 = []; | |
if (object != null) { | |
for (var key in Object2(object)) { | |
result2.push(key); | |
} | |
} | |
return result2; | |
} | |
function objectToString2(value) { | |
return nativeObjectToString.call(value); | |
} | |
function overRest(func, start, transform3) { | |
start = nativeMax(start === undefined$1 ? func.length - 1 : start, 0); | |
return function() { | |
var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array2(length); | |
while (++index < length) { | |
array[index] = args[start + index]; | |
} | |
index = -1; | |
var otherArgs = Array2(start + 1); | |
while (++index < start) { | |
otherArgs[index] = args[index]; | |
} | |
otherArgs[start] = transform3(array); | |
return apply(func, this, otherArgs); | |
}; | |
} | |
function parent(object, path) { | |
return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1)); | |
} | |
function reorder(array, indexes) { | |
var arrLength = array.length, length = nativeMin(indexes.length, arrLength), oldArray = copyArray(array); | |
while (length--) { | |
var index = indexes[length]; | |
array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined$1; | |
} | |
return array; | |
} | |
function safeGet(object, key) { | |
if (key === "constructor" && typeof object[key] === "function") { | |
return; | |
} | |
if (key == "__proto__") { | |
return; | |
} | |
return object[key]; | |
} | |
var setData = shortOut(baseSetData); | |
var setTimeout2 = ctxSetTimeout || function(func, wait) { | |
return root.setTimeout(func, wait); | |
}; | |
var setToString = shortOut(baseSetToString); | |
function setWrapToString(wrapper, reference, bitmask) { | |
var source = reference + ""; | |
return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))); | |
} | |
function shortOut(func) { | |
var count = 0, lastCalled = 0; | |
return function() { | |
var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled); | |
lastCalled = stamp; | |
if (remaining > 0) { | |
if (++count >= HOT_COUNT) { | |
return arguments[0]; | |
} | |
} else { | |
count = 0; | |
} | |
return func.apply(undefined$1, arguments); | |
}; | |
} | |
function shuffleSelf(array, size22) { | |
var index = -1, length = array.length, lastIndex = length - 1; | |
size22 = size22 === undefined$1 ? length : size22; | |
while (++index < size22) { | |
var rand = baseRandom(index, lastIndex), value = array[rand]; | |
array[rand] = array[index]; | |
array[index] = value; | |
} | |
array.length = size22; | |
return array; | |
} | |
var stringToPath = memoizeCapped(function(string) { | |
var result2 = []; | |
if (string.charCodeAt(0) === 46) { | |
result2.push(""); | |
} | |
string.replace(rePropName, function(match, number, quote, subString) { | |
result2.push(quote ? subString.replace(reEscapeChar, "$1") : number || match); | |
}); | |
return result2; | |
}); | |
function toKey(value) { | |
if (typeof value == "string" || isSymbol2(value)) { | |
return value; | |
} | |
var result2 = value + ""; | |
return result2 == "0" && 1 / value == -INFINITY ? "-0" : result2; | |
} | |
function toSource(func) { | |
if (func != null) { | |
try { | |
return funcToString.call(func); | |
} catch (e) { | |
} | |
try { | |
return func + ""; | |
} catch (e) { | |
} | |
} | |
return ""; | |
} | |
function updateWrapDetails(details, bitmask) { | |
arrayEach(wrapFlags, function(pair) { | |
var value = "_." + pair[0]; | |
if (bitmask & pair[1] && !arrayIncludes(details, value)) { | |
details.push(value); | |
} | |
}); | |
return details.sort(); | |
} | |
function wrapperClone(wrapper) { | |
if (wrapper instanceof LazyWrapper) { | |
return wrapper.clone(); | |
} | |
var result2 = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__); | |
result2.__actions__ = copyArray(wrapper.__actions__); | |
result2.__index__ = wrapper.__index__; | |
result2.__values__ = wrapper.__values__; | |
return result2; | |
} | |
function chunk(array, size22, guard) { | |
if (guard ? isIterateeCall(array, size22, guard) : size22 === undefined$1) { | |
size22 = 1; | |
} else { | |
size22 = nativeMax(toInteger(size22), 0); | |
} | |
var length = array == null ? 0 : array.length; | |
if (!length || size22 < 1) { | |
return []; | |
} | |
var index = 0, resIndex = 0, result2 = Array2(nativeCeil(length / size22)); | |
while (index < length) { | |
result2[resIndex++] = baseSlice(array, index, index += size22); | |
} | |
return result2; | |
} | |
function compact(array) { | |
var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result2 = []; | |
while (++index < length) { | |
var value = array[index]; | |
if (value) { | |
result2[resIndex++] = value; | |
} | |
} | |
return result2; | |
} | |
function concat2() { | |
var length = arguments.length; | |
if (!length) { | |
return []; | |
} | |
var args = Array2(length - 1), array = arguments[0], index = length; | |
while (index--) { | |
args[index - 1] = arguments[index]; | |
} | |
return arrayPush(isArray2(array) ? copyArray(array) : [array], baseFlatten(args, 1)); | |
} | |
var difference = baseRest(function(array, values2) { | |
return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values2, 1, isArrayLikeObject, true)) : []; | |
}); | |
var differenceBy = baseRest(function(array, values2) { | |
var iteratee2 = last(values2); | |
if (isArrayLikeObject(iteratee2)) { | |
iteratee2 = undefined$1; | |
} | |
return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values2, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2)) : []; | |
}); | |
var differenceWith = baseRest(function(array, values2) { | |
var comparator2 = last(values2); | |
if (isArrayLikeObject(comparator2)) { | |
comparator2 = undefined$1; | |
} | |
return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values2, 1, isArrayLikeObject, true), undefined$1, comparator2) : []; | |
}); | |
function drop(array, n, guard) { | |
var length = array == null ? 0 : array.length; | |
if (!length) { | |
return []; | |
} | |
n = guard || n === undefined$1 ? 1 : toInteger(n); | |
return baseSlice(array, n < 0 ? 0 : n, length); | |
} | |
function dropRight(array, n, guard) { | |
var length = array == null ? 0 : array.length; | |
if (!length) { | |
return []; | |
} | |
n = guard || n === undefined$1 ? 1 : toInteger(n); | |
n = length - n; | |
return baseSlice(array, 0, n < 0 ? 0 : n); | |
} | |
function dropRightWhile(array, predicate) { | |
return array && array.length ? baseWhile(array, getIteratee(predicate, 3), true, true) : []; | |
} | |
function dropWhile(array, predicate) { | |
return array && array.length ? baseWhile(array, getIteratee(predicate, 3), true) : []; | |
} | |
function fill2(array, value, start, end) { | |
var length = array == null ? 0 : array.length; | |
if (!length) { | |
return []; | |
} | |
if (start && typeof start != "number" && isIterateeCall(array, value, start)) { | |
start = 0; | |
end = length; | |
} | |
return baseFill(array, value, start, end); | |
} | |
function findIndex(array, predicate, fromIndex) { | |
var length = array == null ? 0 : array.length; | |
if (!length) { | |
return -1; | |
} | |
var index = fromIndex == null ? 0 : toInteger(fromIndex); | |
if (index < 0) { | |
index = nativeMax(length + index, 0); | |
} | |
return baseFindIndex(array, getIteratee(predicate, 3), index); | |
} | |
function findLastIndex(array, predicate, fromIndex) { | |
var length = array == null ? 0 : array.length; | |
if (!length) { | |
return -1; | |
} | |
var index = length - 1; | |
if (fromIndex !== undefined$1) { | |
index = toInteger(fromIndex); | |
index = fromIndex < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); | |
} | |
return baseFindIndex(array, getIteratee(predicate, 3), index, true); | |
} | |
function flatten(array) { | |
var length = array == null ? 0 : array.length; | |
return length ? baseFlatten(array, 1) : []; | |
} | |
function flattenDeep(array) { | |
var length = array == null ? 0 : array.length; | |
return length ? baseFlatten(array, INFINITY) : []; | |
} | |
function flattenDepth(array, depth) { | |
var length = array == null ? 0 : array.length; | |
if (!length) { | |
return []; | |
} | |
depth = depth === undefined$1 ? 1 : toInteger(depth); | |
return baseFlatten(array, depth); | |
} | |
function fromPairs(pairs) { | |
var index = -1, length = pairs == null ? 0 : pairs.length, result2 = {}; | |
while (++index < length) { | |
var pair = pairs[index]; | |
result2[pair[0]] = pair[1]; | |
} | |
return result2; | |
} | |
function head(array) { | |
return array && array.length ? array[0] : undefined$1; | |
} | |
function indexOf2(array, value, fromIndex) { | |
var length = array == null ? 0 : array.length; | |
if (!length) { | |
return -1; | |
} | |
var index = fromIndex == null ? 0 : toInteger(fromIndex); | |
if (index < 0) { | |
index = nativeMax(length + index, 0); | |
} | |
return baseIndexOf(array, value, index); | |
} | |
function initial(array) { | |
var length = array == null ? 0 : array.length; | |
return length ? baseSlice(array, 0, -1) : []; | |
} | |
var intersection = baseRest(function(arrays) { | |
var mapped = arrayMap(arrays, castArrayLikeObject); | |
return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : []; | |
}); | |
var intersectionBy = baseRest(function(arrays) { | |
var iteratee2 = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject); | |
if (iteratee2 === last(mapped)) { | |
iteratee2 = undefined$1; | |
} else { | |
mapped.pop(); | |
} | |
return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, getIteratee(iteratee2, 2)) : []; | |
}); | |
var intersectionWith = baseRest(function(arrays) { | |
var comparator2 = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject); | |
comparator2 = typeof comparator2 == "function" ? comparator2 : undefined$1; | |
if (comparator2) { | |
mapped.pop(); | |
} | |
return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined$1, comparator2) : []; | |
}); | |
function join(array, separator) { | |
return array == null ? "" : nativeJoin.call(array, separator); | |
} | |
function last(array) { | |
var length = array == null ? 0 : array.length; | |
return length ? array[length - 1] : undefined$1; | |
} | |
function lastIndexOf2(array, value, fromIndex) { | |
var length = array == null ? 0 : array.length; | |
if (!length) { | |
return -1; | |
} | |
var index = length; | |
if (fromIndex !== undefined$1) { | |
index = toInteger(fromIndex); | |
index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1); | |
} | |
return value === value ? strictLastIndexOf(array, value, index) : baseFindIndex(array, baseIsNaN, index, true); | |
} | |
function nth(array, n) { | |
return array && array.length ? baseNth(array, toInteger(n)) : undefined$1; | |
} | |
var pull = baseRest(pullAll); | |
function pullAll(array, values2) { | |
return array && array.length && values2 && values2.length ? basePullAll(array, values2) : array; | |
} | |
function pullAllBy(array, values2, iteratee2) { | |
return array && array.length && values2 && values2.length ? basePullAll(array, values2, getIteratee(iteratee2, 2)) : array; | |
} | |
function pullAllWith(array, values2, comparator2) { | |
return array && array.length && values2 && values2.length ? basePullAll(array, values2, undefined$1, comparator2) : array; | |
} | |
var pullAt = flatRest(function(array, indexes) { | |
var length = array == null ? 0 : array.length, result2 = baseAt(array, indexes); | |
basePullAt(array, arrayMap(indexes, function(index) { | |
return isIndex(index, length) ? +index : index; | |
}).sort(compareAscending)); | |
return result2; | |
}); | |
function remove2(array, predicate) { | |
var result2 = []; | |
if (!(array && array.length)) { | |
return result2; | |
} | |
var index = -1, indexes = [], length = array.length; | |
predicate = getIteratee(predicate, 3); | |
while (++index < length) { | |
var value = array[index]; | |
if (predicate(value, index, array)) { | |
result2.push(value); | |
indexes.push(index); | |
} | |
} | |
basePullAt(array, indexes); | |
return result2; | |
} | |
function reverse(array) { | |
return array == null ? array : nativeReverse.call(array); | |
} | |
function slice2(array, start, end) { | |
var length = array == null ? 0 : array.length; | |
if (!length) { | |
return []; | |
} | |
if (end && typeof end != "number" && isIterateeCall(array, start, end)) { | |
start = 0; | |
end = length; | |
} else { | |
start = start == null ? 0 : toInteger(start); | |
end = end === undefined$1 ? length : toInteger(end); | |
} | |
return baseSlice(array, start, end); | |
} | |
function sortedIndex(array, value) { | |
return baseSortedIndex(array, value); | |
} | |
function sortedIndexBy(array, value, iteratee2) { | |
return baseSortedIndexBy(array, value, getIteratee(iteratee2, 2)); | |
} | |
function sortedIndexOf(array, value) { | |
var length = array == null ? 0 : array.length; | |
if (length) { | |
var index = baseSortedIndex(array, value); | |
if (index < length && eq(array[index], value)) { | |
return index; | |
} | |
} | |
return -1; | |
} | |
function sortedLastIndex(array, value) { | |
return baseSortedIndex(array, value, true); | |
} | |
function sortedLastIndexBy(array, value, iteratee2) { | |
return baseSortedIndexBy(array, value, getIteratee(iteratee2, 2), true); | |
} | |
function sortedLastIndexOf(array, value) { | |
var length = array == null ? 0 : array.length; | |
if (length) { | |
var index = baseSortedIndex(array, value, true) - 1; | |
if (eq(array[index], value)) { | |
return index; | |
} | |
} | |
return -1; | |
} | |
function sortedUniq(array) { | |
return array && array.length ? baseSortedUniq(array) : []; | |
} | |
function sortedUniqBy(array, iteratee2) { | |
return array && array.length ? baseSortedUniq(array, getIteratee(iteratee2, 2)) : []; | |
} | |
function tail(array) { | |
var length = array == null ? 0 : array.length; | |
return length ? baseSlice(array, 1, length) : []; | |
} | |
function take(array, n, guard) { | |
if (!(array && array.length)) { | |
return []; | |
} | |
n = guard || n === undefined$1 ? 1 : toInteger(n); | |
return baseSlice(array, 0, n < 0 ? 0 : n); | |
} | |
function takeRight(array, n, guard) { | |
var length = array == null ? 0 : array.length; | |
if (!length) { | |
return []; | |
} | |
n = guard || n === undefined$1 ? 1 : toInteger(n); | |
n = length - n; | |
return baseSlice(array, n < 0 ? 0 : n, length); | |
} | |
function takeRightWhile(array, predicate) { | |
return array && array.length ? baseWhile(array, getIteratee(predicate, 3), false, true) : []; | |
} | |
function takeWhile(array, predicate) { | |
return array && array.length ? baseWhile(array, getIteratee(predicate, 3)) : []; | |
} | |
var union = baseRest(function(arrays) { | |
return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true)); | |
}); | |
var unionBy = baseRest(function(arrays) { | |
var iteratee2 = last(arrays); | |
if (isArrayLikeObject(iteratee2)) { | |
iteratee2 = undefined$1; | |
} | |
return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2)); | |
}); | |
var unionWith = baseRest(function(arrays) { | |
var comparator2 = last(arrays); | |
comparator2 = typeof comparator2 == "function" ? comparator2 : undefined$1; | |
return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined$1, comparator2); | |
}); | |
function uniq(array) { | |
return array && array.length ? baseUniq(array) : []; | |
} | |
function uniqBy(array, iteratee2) { | |
return array && array.length ? baseUniq(array, getIteratee(iteratee2, 2)) : []; | |
} | |
function uniqWith(array, comparator2) { | |
comparator2 = typeof comparator2 == "function" ? comparator2 : undefined$1; | |
return array && array.length ? baseUniq(array, undefined$1, comparator2) : []; | |
} | |
function unzip(array) { | |
if (!(array && array.length)) { | |
return []; | |
} | |
var length = 0; | |
array = arrayFilter(array, function(group) { | |
if (isArrayLikeObject(group)) { | |
length = nativeMax(group.length, length); | |
return true; | |
} | |
}); | |
return baseTimes(length, function(index) { | |
return arrayMap(array, baseProperty(index)); | |
}); | |
} | |
function unzipWith(array, iteratee2) { | |
if (!(array && array.length)) { | |
return []; | |
} | |
var result2 = unzip(array); | |
if (iteratee2 == null) { | |
return result2; | |
} | |
return arrayMap(result2, function(group) { | |
return apply(iteratee2, undefined$1, group); | |
}); | |
} | |
var without = baseRest(function(array, values2) { | |
return isArrayLikeObject(array) ? baseDifference(array, values2) : []; | |
}); | |
var xor = baseRest(function(arrays) { | |
return baseXor(arrayFilter(arrays, isArrayLikeObject)); | |
}); | |
var xorBy = baseRest(function(arrays) { | |
var iteratee2 = last(arrays); | |
if (isArrayLikeObject(iteratee2)) { | |
iteratee2 = undefined$1; | |
} | |
return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee2, 2)); | |
}); | |
var xorWith = baseRest(function(arrays) { | |
var comparator2 = last(arrays); | |
comparator2 = typeof comparator2 == "function" ? comparator2 : undefined$1; | |
return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined$1, comparator2); | |
}); | |
var zip = baseRest(unzip); | |
function zipObject(props, values2) { | |
return baseZipObject(props || [], values2 || [], assignValue); | |
} | |
function zipObjectDeep(props, values2) { | |
return baseZipObject(props || [], values2 || [], baseSet); | |
} | |
var zipWith = baseRest(function(arrays) { | |
var length = arrays.length, iteratee2 = length > 1 ? arrays[length - 1] : undefined$1; | |
iteratee2 = typeof iteratee2 == "function" ? (arrays.pop(), iteratee2) : undefined$1; | |
return unzipWith(arrays, iteratee2); | |
}); | |
function chain(value) { | |
var result2 = lodash2(value); | |
result2.__chain__ = true; | |
return result2; | |
} | |
function tap(value, interceptor) { | |
interceptor(value); | |
return value; | |
} | |
function thru(value, interceptor) { | |
return interceptor(value); | |
} | |
var wrapperAt = flatRest(function(paths) { | |
var length = paths.length, start = length ? paths[0] : 0, value = this.__wrapped__, interceptor = function(object) { | |
return baseAt(object, paths); | |
}; | |
if (length > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex(start)) { | |
return this.thru(interceptor); | |
} | |
value = value.slice(start, +start + (length ? 1 : 0)); | |
value.__actions__.push({ | |
"func": thru, | |
"args": [interceptor], | |
"thisArg": undefined$1 | |
}); | |
return new LodashWrapper(value, this.__chain__).thru(function(array) { | |
if (length && !array.length) { | |
array.push(undefined$1); | |
} | |
return array; | |
}); | |
}); | |
function wrapperChain() { | |
return chain(this); | |
} | |
function wrapperCommit() { | |
return new LodashWrapper(this.value(), this.__chain__); | |
} | |
function wrapperNext() { | |
if (this.__values__ === undefined$1) { | |
this.__values__ = toArray(this.value()); | |
} | |
var done = this.__index__ >= this.__values__.length, value = done ? undefined$1 : this.__values__[this.__index__++]; | |
return { "done": done, "value": value }; | |
} | |
function wrapperToIterator() { | |
return this; | |
} | |
function wrapperPlant(value) { | |
var result2, parent2 = this; | |
while (parent2 instanceof baseLodash) { | |
var clone2 = wrapperClone(parent2); | |
clone2.__index__ = 0; | |
clone2.__values__ = undefined$1; | |
if (result2) { | |
previous.__wrapped__ = clone2; | |
} else { | |
result2 = clone2; | |
} | |
var previous = clone2; | |
parent2 = parent2.__wrapped__; | |
} | |
previous.__wrapped__ = value; | |
return result2; | |
} | |
function wrapperReverse() { | |
var value = this.__wrapped__; | |
if (value instanceof LazyWrapper) { | |
var wrapped = value; | |
if (this.__actions__.length) { | |
wrapped = new LazyWrapper(this); | |
} | |
wrapped = wrapped.reverse(); | |
wrapped.__actions__.push({ | |
"func": thru, | |
"args": [reverse], | |
"thisArg": undefined$1 | |
}); | |
return new LodashWrapper(wrapped, this.__chain__); | |
} | |
return this.thru(reverse); | |
} | |
function wrapperValue() { | |
return baseWrapperValue(this.__wrapped__, this.__actions__); | |
} | |
var countBy = createAggregator(function(result2, value, key) { | |
if (hasOwnProperty2.call(result2, key)) { | |
++result2[key]; | |
} else { | |
baseAssignValue(result2, key, 1); | |
} | |
}); | |
function every(collection, predicate, guard) { | |
var func = isArray2(collection) ? arrayEvery : baseEvery; | |
if (guard && isIterateeCall(collection, predicate, guard)) { | |
predicate = undefined$1; | |
} | |
return func(collection, getIteratee(predicate, 3)); | |
} | |
function filter(collection, predicate) { | |
var func = isArray2(collection) ? arrayFilter : baseFilter; | |
return func(collection, getIteratee(predicate, 3)); | |
} | |
var find = createFind(findIndex); | |
var findLast = createFind(findLastIndex); | |
function flatMap(collection, iteratee2) { | |
return baseFlatten(map(collection, iteratee2), 1); | |
} | |
function flatMapDeep(collection, iteratee2) { | |
return baseFlatten(map(collection, iteratee2), INFINITY); | |
} | |
function flatMapDepth(collection, iteratee2, depth) { | |
depth = depth === undefined$1 ? 1 : toInteger(depth); | |
return baseFlatten(map(collection, iteratee2), depth); | |
} | |
function forEach(collection, iteratee2) { | |
var func = isArray2(collection) ? arrayEach : baseEach; | |
return func(collection, getIteratee(iteratee2, 3)); | |
} | |
function forEachRight(collection, iteratee2) { | |
var func = isArray2(collection) ? arrayEachRight : baseEachRight; | |
return func(collection, getIteratee(iteratee2, 3)); | |
} | |
var groupBy = createAggregator(function(result2, value, key) { | |
if (hasOwnProperty2.call(result2, key)) { | |
result2[key].push(value); | |
} else { | |
baseAssignValue(result2, key, [value]); | |
} | |
}); | |
function includes2(collection, value, fromIndex, guard) { | |
collection = isArrayLike(collection) ? collection : values(collection); | |
fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0; | |
var length = collection.length; | |
if (fromIndex < 0) { | |
fromIndex = nativeMax(length + fromIndex, 0); | |
} | |
return isString2(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1; | |
} | |
var invokeMap = baseRest(function(collection, path, args) { | |
var index = -1, isFunc = typeof path == "function", result2 = isArrayLike(collection) ? Array2(collection.length) : []; | |
baseEach(collection, function(value) { | |
result2[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args); | |
}); | |
return result2; | |
}); | |
var keyBy = createAggregator(function(result2, value, key) { | |
baseAssignValue(result2, key, value); | |
}); | |
function map(collection, iteratee2) { | |
var func = isArray2(collection) ? arrayMap : baseMap; | |
return func(collection, getIteratee(iteratee2, 3)); | |
} | |
function orderBy(collection, iteratees, orders, guard) { | |
if (collection == null) { | |
return []; | |
} | |
if (!isArray2(iteratees)) { | |
iteratees = iteratees == null ? [] : [iteratees]; | |
} | |
orders = guard ? undefined$1 : orders; | |
if (!isArray2(orders)) { | |
orders = orders == null ? [] : [orders]; | |
} | |
return baseOrderBy(collection, iteratees, orders); | |
} | |
var partition = createAggregator(function(result2, value, key) { | |
result2[key ? 0 : 1].push(value); | |
}, function() { | |
return [[], []]; | |
}); | |
function reduce(collection, iteratee2, accumulator) { | |
var func = isArray2(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3; | |
return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEach); | |
} | |
function reduceRight(collection, iteratee2, accumulator) { | |
var func = isArray2(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3; | |
return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEachRight); | |
} | |
function reject(collection, predicate) { | |
var func = isArray2(collection) ? arrayFilter : baseFilter; | |
return func(collection, negate(getIteratee(predicate, 3))); | |
} | |
function sample(collection) { | |
var func = isArray2(collection) ? arraySample : baseSample; | |
return func(collection); | |
} | |
function sampleSize(collection, n, guard) { | |
if (guard ? isIterateeCall(collection, n, guard) : n === undefined$1) { | |
n = 1; | |
} else { | |
n = toInteger(n); | |
} | |
var func = isArray2(collection) ? arraySampleSize : baseSampleSize; | |
return func(collection, n); | |
} | |
function shuffle(collection) { | |
var func = isArray2(collection) ? arrayShuffle : baseShuffle; | |
return func(collection); | |
} | |
function size2(collection) { | |
if (collection == null) { | |
return 0; | |
} | |
if (isArrayLike(collection)) { | |
return isString2(collection) ? stringSize(collection) : collection.length; | |
} | |
var tag = getTag(collection); | |
if (tag == mapTag || tag == setTag) { | |
return collection.size; | |
} | |
return baseKeys(collection).length; | |
} | |
function some(collection, predicate, guard) { | |
var func = isArray2(collection) ? arraySome : baseSome; | |
if (guard && isIterateeCall(collection, predicate, guard)) { | |
predicate = undefined$1; | |
} | |
return func(collection, getIteratee(predicate, 3)); | |
} | |
var sortBy = baseRest(function(collection, iteratees) { | |
if (collection == null) { | |
return []; | |
} | |
var length = iteratees.length; | |
if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) { | |
iteratees = []; | |
} else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) { | |
iteratees = [iteratees[0]]; | |
} | |
return baseOrderBy(collection, baseFlatten(iteratees, 1), []); | |
}); | |
var now = ctxNow || function() { | |
return root.Date.now(); | |
}; | |
function after(n, func) { | |
if (typeof func != "function") { | |
throw new TypeError2(FUNC_ERROR_TEXT); | |
} | |
n = toInteger(n); | |
return function() { | |
if (--n < 1) { | |
return func.apply(this, arguments); | |
} | |
}; | |
} | |
function ary(func, n, guard) { | |
n = guard ? undefined$1 : n; | |
n = func && n == null ? func.length : n; | |
return createWrap(func, WRAP_ARY_FLAG, undefined$1, undefined$1, undefined$1, undefined$1, n); | |
} | |
function before(n, func) { | |
var result2; | |
if (typeof func != "function") { | |
throw new TypeError2(FUNC_ERROR_TEXT); | |
} | |
n = toInteger(n); | |
return function() { | |
if (--n > 0) { | |
result2 = func.apply(this, arguments); | |
} | |
if (n <= 1) { | |
func = undefined$1; | |
} | |
return result2; | |
}; | |
} | |
var bind = baseRest(function(func, thisArg, partials) { | |
var bitmask = WRAP_BIND_FLAG; | |
if (partials.length) { | |
var holders = replaceHolders(partials, getHolder(bind)); | |
bitmask |= WRAP_PARTIAL_FLAG; | |
} | |
return createWrap(func, bitmask, thisArg, partials, holders); | |
}); | |
var bindKey = baseRest(function(object, key, partials) { | |
var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG; | |
if (partials.length) { | |
var holders = replaceHolders(partials, getHolder(bindKey)); | |
bitmask |= WRAP_PARTIAL_FLAG; | |
} | |
return createWrap(key, bitmask, object, partials, holders); | |
}); | |
function curry(func, arity, guard) { | |
arity = guard ? undefined$1 : arity; | |
var result2 = createWrap(func, WRAP_CURRY_FLAG, undefined$1, undefined$1, undefined$1, undefined$1, undefined$1, arity); | |
result2.placeholder = curry.placeholder; | |
return result2; | |
} | |
function curryRight(func, arity, guard) { | |
arity = guard ? undefined$1 : arity; | |
var result2 = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined$1, undefined$1, undefined$1, undefined$1, undefined$1, arity); | |
result2.placeholder = curryRight.placeholder; | |
return result2; | |
} | |
function debounce(func, wait, options) { | |
var lastArgs, lastThis, maxWait, result2, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true; | |
if (typeof func != "function") { | |
throw new TypeError2(FUNC_ERROR_TEXT); | |
} | |
wait = toNumber2(wait) || 0; | |
if (isObject2(options)) { | |
leading = !!options.leading; | |
maxing = "maxWait" in options; | |
maxWait = maxing ? nativeMax(toNumber2(options.maxWait) || 0, wait) : maxWait; | |
trailing = "trailing" in options ? !!options.trailing : trailing; | |
} | |
function invokeFunc(time) { | |
var args = lastArgs, thisArg = lastThis; | |
lastArgs = lastThis = undefined$1; | |
lastInvokeTime = time; | |
result2 = func.apply(thisArg, args); | |
return result2; | |
} | |
function leadingEdge(time) { | |
lastInvokeTime = time; | |
timerId = setTimeout2(timerExpired, wait); | |
return leading ? invokeFunc(time) : result2; | |
} | |
function remainingWait(time) { | |
var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall; | |
return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting; | |
} | |
function shouldInvoke(time) { | |
var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime; | |
return lastCallTime === undefined$1 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait; | |
} | |
function timerExpired() { | |
var time = now(); | |
if (shouldInvoke(time)) { | |
return trailingEdge(time); | |
} | |
timerId = setTimeout2(timerExpired, remainingWait(time)); | |
} | |
function trailingEdge(time) { | |
timerId = undefined$1; | |
if (trailing && lastArgs) { | |
return invokeFunc(time); | |
} | |
lastArgs = lastThis = undefined$1; | |
return result2; | |
} | |
function cancel() { | |
if (timerId !== undefined$1) { | |
clearTimeout(timerId); | |
} | |
lastInvokeTime = 0; | |
lastArgs = lastCallTime = lastThis = timerId = undefined$1; | |
} | |
function flush() { | |
return timerId === undefined$1 ? result2 : trailingEdge(now()); | |
} | |
function debounced() { | |
var time = now(), isInvoking = shouldInvoke(time); | |
lastArgs = arguments; | |
lastThis = this; | |
lastCallTime = time; | |
if (isInvoking) { | |
if (timerId === undefined$1) { | |
return leadingEdge(lastCallTime); | |
} | |
if (maxing) { | |
clearTimeout(timerId); | |
timerId = setTimeout2(timerExpired, wait); | |
return invokeFunc(lastCallTime); | |
} | |
} | |
if (timerId === undefined$1) { | |
timerId = setTimeout2(timerExpired, wait); | |
} | |
return result2; | |
} | |
debounced.cancel = cancel; | |
debounced.flush = flush; | |
return debounced; | |
} | |
var defer = baseRest(function(func, args) { | |
return baseDelay(func, 1, args); | |
}); | |
var delay = baseRest(function(func, wait, args) { | |
return baseDelay(func, toNumber2(wait) || 0, args); | |
}); | |
function flip(func) { | |
return createWrap(func, WRAP_FLIP_FLAG); | |
} | |
function memoize(func, resolver) { | |
if (typeof func != "function" || resolver != null && typeof resolver != "function") { | |
throw new TypeError2(FUNC_ERROR_TEXT); | |
} | |
var memoized = function() { | |
var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache; | |
if (cache.has(key)) { | |
return cache.get(key); | |
} | |
var result2 = func.apply(this, args); | |
memoized.cache = cache.set(key, result2) || cache; | |
return result2; | |
}; | |
memoized.cache = new (memoize.Cache || MapCache)(); | |
return memoized; | |
} | |
memoize.Cache = MapCache; | |
function negate(predicate) { | |
if (typeof predicate != "function") { | |
throw new TypeError2(FUNC_ERROR_TEXT); | |
} | |
return function() { | |
var args = arguments; | |
switch (args.length) { | |
case 0: | |
return !predicate.call(this); | |
case 1: | |
return !predicate.call(this, args[0]); | |
case 2: | |
return !predicate.call(this, args[0], args[1]); | |
case 3: | |
return !predicate.call(this, args[0], args[1], args[2]); | |
} | |
return !predicate.apply(this, args); | |
}; | |
} | |
function once(func) { | |
return before(2, func); | |
} | |
var overArgs = castRest(function(func, transforms) { | |
transforms = transforms.length == 1 && isArray2(transforms[0]) ? arrayMap(transforms[0], baseUnary(getIteratee())) : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee())); | |
var funcsLength = transforms.length; | |
return baseRest(function(args) { | |
var index = -1, length = nativeMin(args.length, funcsLength); | |
while (++index < length) { | |
args[index] = transforms[index].call(this, args[index]); | |
} | |
return apply(func, this, args); | |
}); | |
}); | |
var partial = baseRest(function(func, partials) { | |
var holders = replaceHolders(partials, getHolder(partial)); | |
return createWrap(func, WRAP_PARTIAL_FLAG, undefined$1, partials, holders); | |
}); | |
var partialRight = baseRest(function(func, partials) { | |
var holders = replaceHolders(partials, getHolder(partialRight)); | |
return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined$1, partials, holders); | |
}); | |
var rearg = flatRest(function(func, indexes) { | |
return createWrap(func, WRAP_REARG_FLAG, undefined$1, undefined$1, undefined$1, indexes); | |
}); | |
function rest(func, start) { | |
if (typeof func != "function") { | |
throw new TypeError2(FUNC_ERROR_TEXT); | |
} | |
start = start === undefined$1 ? start : toInteger(start); | |
return baseRest(func, start); | |
} | |
function spread(func, start) { | |
if (typeof func != "function") { | |
throw new TypeError2(FUNC_ERROR_TEXT); | |
} | |
start = start == null ? 0 : nativeMax(toInteger(start), 0); | |
return baseRest(function(args) { | |
var array = args[start], otherArgs = castSlice(args, 0, start); | |
if (array) { | |
arrayPush(otherArgs, array); | |
} | |
return apply(func, this, otherArgs); | |
}); | |
} | |
function throttle(func, wait, options) { | |
var leading = true, trailing = true; | |
if (typeof func != "function") { | |
throw new TypeError2(FUNC_ERROR_TEXT); | |
} | |
if (isObject2(options)) { | |
leading = "leading" in options ? !!options.leading : leading; | |
trailing = "trailing" in options ? !!options.trailing : trailing; | |
} | |
return debounce(func, wait, { | |
"leading": leading, | |
"maxWait": wait, | |
"trailing": trailing | |
}); | |
} | |
function unary(func) { | |
return ary(func, 1); | |
} | |
function wrap(value, wrapper) { | |
return partial(castFunction(wrapper), value); | |
} | |
function castArray() { | |
if (!arguments.length) { | |
return []; | |
} | |
var value = arguments[0]; | |
return isArray2(value) ? value : [value]; | |
} | |
function clone(value) { | |
return baseClone(value, CLONE_SYMBOLS_FLAG); | |
} | |
function cloneWith(value, customizer) { | |
customizer = typeof customizer == "function" ? customizer : undefined$1; | |
return baseClone(value, CLONE_SYMBOLS_FLAG, customizer); | |
} | |
function cloneDeep(value) { | |
return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG); | |
} | |
function cloneDeepWith(value, customizer) { | |
customizer = typeof customizer == "function" ? customizer : undefined$1; | |
return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer); | |
} | |
function conformsTo(object, source) { | |
return source == null || baseConformsTo(object, source, keys(source)); | |
} | |
function eq(value, other) { | |
return value === other || value !== value && other !== other; | |
} | |
var gt = createRelationalOperation(baseGt); | |
var gte = createRelationalOperation(function(value, other) { | |
return value >= other; | |
}); | |
var isArguments = baseIsArguments(function() { | |
return arguments; | |
}()) ? baseIsArguments : function(value) { | |
return isObjectLike(value) && hasOwnProperty2.call(value, "callee") && !propertyIsEnumerable.call(value, "callee"); | |
}; | |
var isArray2 = Array2.isArray; | |
var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer; | |
function isArrayLike(value) { | |
return value != null && isLength(value.length) && !isFunction2(value); | |
} | |
function isArrayLikeObject(value) { | |
return isObjectLike(value) && isArrayLike(value); | |
} | |
function isBoolean(value) { | |
return value === true || value === false || isObjectLike(value) && baseGetTag(value) == boolTag; | |
} | |
var isBuffer2 = nativeIsBuffer || stubFalse; | |
var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate; | |
function isElement(value) { | |
return isObjectLike(value) && value.nodeType === 1 && !isPlainObject2(value); | |
} | |
function isEmpty(value) { | |
if (value == null) { | |
return true; | |
} | |
if (isArrayLike(value) && (isArray2(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer2(value) || isTypedArray(value) || isArguments(value))) { | |
return !value.length; | |
} | |
var tag = getTag(value); | |
if (tag == mapTag || tag == setTag) { | |
return !value.size; | |
} | |
if (isPrototype(value)) { | |
return !baseKeys(value).length; | |
} | |
for (var key in value) { | |
if (hasOwnProperty2.call(value, key)) { | |
return false; | |
} | |
} | |
return true; | |
} | |
function isEqual(value, other) { | |
return baseIsEqual(value, other); | |
} | |
function isEqualWith(value, other, customizer) { | |
customizer = typeof customizer == "function" ? customizer : undefined$1; | |
var result2 = customizer ? customizer(value, other) : undefined$1; | |
return result2 === undefined$1 ? baseIsEqual(value, other, undefined$1, customizer) : !!result2; | |
} | |
function isError(value) { | |
if (!isObjectLike(value)) { | |
return false; | |
} | |
var tag = baseGetTag(value); | |
return tag == errorTag || tag == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject2(value); | |
} | |
function isFinite2(value) { | |
return typeof value == "number" && nativeIsFinite(value); | |
} | |
function isFunction2(value) { | |
if (!isObject2(value)) { | |
return false; | |
} | |
var tag = baseGetTag(value); | |
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; | |
} | |
function isInteger(value) { | |
return typeof value == "number" && value == toInteger(value); | |
} | |
function isLength(value) { | |
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; | |
} | |
function isObject2(value) { | |
var type = typeof value; | |
return value != null && (type == "object" || type == "function"); | |
} | |
function isObjectLike(value) { | |
return value != null && typeof value == "object"; | |
} | |
var isMap2 = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap; | |
function isMatch(object, source) { | |
return object === source || baseIsMatch(object, source, getMatchData(source)); | |
} | |
function isMatchWith(object, source, customizer) { | |
customizer = typeof customizer == "function" ? customizer : undefined$1; | |
return baseIsMatch(object, source, getMatchData(source), customizer); | |
} | |
function isNaN2(value) { | |
return isNumber(value) && value != +value; | |
} | |
function isNative(value) { | |
if (isMaskable(value)) { | |
throw new Error2(CORE_ERROR_TEXT); | |
} | |
return baseIsNative(value); | |
} | |
function isNull(value) { | |
return value === null; | |
} | |
function isNil(value) { | |
return value == null; | |
} | |
function isNumber(value) { | |
return typeof value == "number" || isObjectLike(value) && baseGetTag(value) == numberTag; | |
} | |
function isPlainObject2(value) { | |
if (!isObjectLike(value) || baseGetTag(value) != objectTag) { | |
return false; | |
} | |
var proto = getPrototype(value); | |
if (proto === null) { | |
return true; | |
} | |
var Ctor = hasOwnProperty2.call(proto, "constructor") && proto.constructor; | |
return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString; | |
} | |
var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp; | |
function isSafeInteger(value) { | |
return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER; | |
} | |
var isSet2 = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet; | |
function isString2(value) { | |
return typeof value == "string" || !isArray2(value) && isObjectLike(value) && baseGetTag(value) == stringTag; | |
} | |
function isSymbol2(value) { | |
return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag; | |
} | |
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; | |
function isUndefined(value) { | |
return value === undefined$1; | |
} | |
function isWeakMap(value) { | |
return isObjectLike(value) && getTag(value) == weakMapTag; | |
} | |
function isWeakSet(value) { | |
return isObjectLike(value) && baseGetTag(value) == weakSetTag; | |
} | |
var lt = createRelationalOperation(baseLt); | |
var lte = createRelationalOperation(function(value, other) { | |
return value <= other; | |
}); | |
function toArray(value) { | |
if (!value) { | |
return []; | |
} | |
if (isArrayLike(value)) { | |
return isString2(value) ? stringToArray(value) : copyArray(value); | |
} | |
if (symIterator && value[symIterator]) { | |
return iteratorToArray(value[symIterator]()); | |
} | |
var tag = getTag(value), func = tag == mapTag ? mapToArray : tag == setTag ? setToArray : values; | |
return func(value); | |
} | |
function toFinite(value) { | |
if (!value) { | |
return value === 0 ? value : 0; | |
} | |
value = toNumber2(value); | |
if (value === INFINITY || value === -INFINITY) { | |
var sign = value < 0 ? -1 : 1; | |
return sign * MAX_INTEGER; | |
} | |
return value === value ? value : 0; | |
} | |
function toInteger(value) { | |
var result2 = toFinite(value), remainder = result2 % 1; | |
return result2 === result2 ? remainder ? result2 - remainder : result2 : 0; | |
} | |
function toLength(value) { | |
return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0; | |
} | |
function toNumber2(value) { | |
if (typeof value == "number") { | |
return value; | |
} | |
if (isSymbol2(value)) { | |
return NAN; | |
} | |
if (isObject2(value)) { | |
var other = typeof value.valueOf == "function" ? value.valueOf() : value; | |
value = isObject2(other) ? other + "" : other; | |
} | |
if (typeof value != "string") { | |
return value === 0 ? value : +value; | |
} | |
value = baseTrim(value); | |
var isBinary = reIsBinary.test(value); | |
return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value; | |
} | |
function toPlainObject(value) { | |
return copyObject(value, keysIn(value)); | |
} | |
function toSafeInteger(value) { | |
return value ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) : value === 0 ? value : 0; | |
} | |
function toString3(value) { | |
return value == null ? "" : baseToString(value); | |
} | |
var assign = createAssigner(function(object, source) { | |
if (isPrototype(source) || isArrayLike(source)) { | |
copyObject(source, keys(source), object); | |
return; | |
} | |
for (var key in source) { | |
if (hasOwnProperty2.call(source, key)) { | |
assignValue(object, key, source[key]); | |
} | |
} | |
}); | |
var assignIn = createAssigner(function(object, source) { | |
copyObject(source, keysIn(source), object); | |
}); | |
var assignInWith = createAssigner(function(object, source, srcIndex, customizer) { | |
copyObject(source, keysIn(source), object, customizer); | |
}); | |
var assignWith = createAssigner(function(object, source, srcIndex, customizer) { | |
copyObject(source, keys(source), object, customizer); | |
}); | |
var at = flatRest(baseAt); | |
function create(prototype, properties) { | |
var result2 = baseCreate(prototype); | |
return properties == null ? result2 : baseAssign(result2, properties); | |
} | |
var defaults = baseRest(function(object, sources) { | |
object = Object2(object); | |
var index = -1; | |
var length = sources.length; | |
var guard = length > 2 ? sources[2] : undefined$1; | |
if (guard && isIterateeCall(sources[0], sources[1], guard)) { | |
length = 1; | |
} | |
while (++index < length) { | |
var source = sources[index]; | |
var props = keysIn(source); | |
var propsIndex = -1; | |
var propsLength = props.length; | |
while (++propsIndex < propsLength) { | |
var key = props[propsIndex]; | |
var value = object[key]; | |
if (value === undefined$1 || eq(value, objectProto[key]) && !hasOwnProperty2.call(object, key)) { | |
object[key] = source[key]; | |
} | |
} | |
} | |
return object; | |
}); | |
var defaultsDeep = baseRest(function(args) { | |
args.push(undefined$1, customDefaultsMerge); | |
return apply(mergeWith, undefined$1, args); | |
}); | |
function findKey(object, predicate) { | |
return baseFindKey(object, getIteratee(predicate, 3), baseForOwn); | |
} | |
function findLastKey(object, predicate) { | |
return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight); | |
} | |
function forIn(object, iteratee2) { | |
return object == null ? object : baseFor(object, getIteratee(iteratee2, 3), keysIn); | |
} | |
function forInRight(object, iteratee2) { | |
return object == null ? object : baseForRight(object, getIteratee(iteratee2, 3), keysIn); | |
} | |
function forOwn(object, iteratee2) { | |
return object && baseForOwn(object, getIteratee(iteratee2, 3)); | |
} | |
function forOwnRight(object, iteratee2) { | |
return object && baseForOwnRight(object, getIteratee(iteratee2, 3)); | |
} | |
function functions(object) { | |
return object == null ? [] : baseFunctions(object, keys(object)); | |
} | |
function functionsIn(object) { | |
return object == null ? [] : baseFunctions(object, keysIn(object)); | |
} | |
function get2(object, path, defaultValue) { | |
var result2 = object == null ? undefined$1 : baseGet(object, path); | |
return result2 === undefined$1 ? defaultValue : result2; | |
} | |
function has2(object, path) { | |
return object != null && hasPath(object, path, baseHas); | |
} | |
function hasIn(object, path) { | |
return object != null && hasPath(object, path, baseHasIn); | |
} | |
var invert = createInverter(function(result2, value, key) { | |
if (value != null && typeof value.toString != "function") { | |
value = nativeObjectToString.call(value); | |
} | |
result2[value] = key; | |
}, constant(identity)); | |
var invertBy = createInverter(function(result2, value, key) { | |
if (value != null && typeof value.toString != "function") { | |
value = nativeObjectToString.call(value); | |
} | |
if (hasOwnProperty2.call(result2, value)) { | |
result2[value].push(key); | |
} else { | |
result2[value] = [key]; | |
} | |
}, getIteratee); | |
var invoke = baseRest(baseInvoke); | |
function keys(object) { | |
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); | |
} | |
function keysIn(object) { | |
return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); | |
} | |
function mapKeys(object, iteratee2) { | |
var result2 = {}; | |
iteratee2 = getIteratee(iteratee2, 3); | |
baseForOwn(object, function(value, key, object2) { | |
baseAssignValue(result2, iteratee2(value, key, object2), value); | |
}); | |
return result2; | |
} | |
function mapValues(object, iteratee2) { | |
var result2 = {}; | |
iteratee2 = getIteratee(iteratee2, 3); | |
baseForOwn(object, function(value, key, object2) { | |
baseAssignValue(result2, key, iteratee2(value, key, object2)); | |
}); | |
return result2; | |
} | |
var merge = createAssigner(function(object, source, srcIndex) { | |
baseMerge(object, source, srcIndex); | |
}); | |
var mergeWith = createAssigner(function(object, source, srcIndex, customizer) { | |
baseMerge(object, source, srcIndex, customizer); | |
}); | |
var omit = flatRest(function(object, paths) { | |
var result2 = {}; | |
if (object == null) { | |
return result2; | |
} | |
var isDeep = false; | |
paths = arrayMap(paths, function(path) { | |
path = castPath(path, object); | |
isDeep || (isDeep = path.length > 1); | |
return path; | |
}); | |
copyObject(object, getAllKeysIn(object), result2); | |
if (isDeep) { | |
result2 = baseClone(result2, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone); | |
} | |
var length = paths.length; | |
while (length--) { | |
baseUnset(result2, paths[length]); | |
} | |
return result2; | |
}); | |
function omitBy(object, predicate) { | |
return pickBy(object, negate(getIteratee(predicate))); | |
} | |
var pick = flatRest(function(object, paths) { | |
return object == null ? {} : basePick(object, paths); | |
}); | |
function pickBy(object, predicate) { | |
if (object == null) { | |
return {}; | |
} | |
var props = arrayMap(getAllKeysIn(object), function(prop) { | |
return [prop]; | |
}); | |
predicate = getIteratee(predicate); | |
return basePickBy(object, props, function(value, path) { | |
return predicate(value, path[0]); | |
}); | |
} | |
function result(object, path, defaultValue) { | |
path = castPath(path, object); | |
var index = -1, length = path.length; | |
if (!length) { | |
length = 1; | |
object = undefined$1; | |
} | |
while (++index < length) { | |
var value = object == null ? undefined$1 : object[toKey(path[index])]; | |
if (value === undefined$1) { | |
index = length; | |
value = defaultValue; | |
} | |
object = isFunction2(value) ? value.call(object) : value; | |
} | |
return object; | |
} | |
function set2(object, path, value) { | |
return object == null ? object : baseSet(object, path, value); | |
} | |
function setWith(object, path, value, customizer) { | |
customizer = typeof customizer == "function" ? customizer : undefined$1; | |
return object == null ? object : baseSet(object, path, value, customizer); | |
} | |
var toPairs = createToPairs(keys); | |
var toPairsIn = createToPairs(keysIn); | |
function transform2(object, iteratee2, accumulator) { | |
var isArr = isArray2(object), isArrLike = isArr || isBuffer2(object) || isTypedArray(object); | |
iteratee2 = getIteratee(iteratee2, 4); | |
if (accumulator == null) { | |
var Ctor = object && object.constructor; | |
if (isArrLike) { | |
accumulator = isArr ? new Ctor() : []; | |
} else if (isObject2(object)) { | |
accumulator = isFunction2(Ctor) ? baseCreate(getPrototype(object)) : {}; | |
} else { | |
accumulator = {}; | |
} | |
} | |
(isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object2) { | |
return iteratee2(accumulator, value, index, object2); | |
}); | |
return accumulator; | |
} | |
function unset(object, path) { | |
return object == null ? true : baseUnset(object, path); | |
} | |
function update(object, path, updater) { | |
return object == null ? object : baseUpdate(object, path, castFunction(updater)); | |
} | |
function updateWith(object, path, updater, customizer) { | |
customizer = typeof customizer == "function" ? customizer : undefined$1; | |
return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer); | |
} | |
function values(object) { | |
return object == null ? [] : baseValues(object, keys(object)); | |
} | |
function valuesIn(object) { | |
return object == null ? [] : baseValues(object, keysIn(object)); | |
} | |
function clamp(number, lower, upper) { | |
if (upper === undefined$1) { | |
upper = lower; | |
lower = undefined$1; | |
} | |
if (upper !== undefined$1) { | |
upper = toNumber2(upper); | |
upper = upper === upper ? upper : 0; | |
} | |
if (lower !== undefined$1) { | |
lower = toNumber2(lower); | |
lower = lower === lower ? lower : 0; | |
} | |
return baseClamp(toNumber2(number), lower, upper); | |
} | |
function inRange(number, start, end) { | |
start = toFinite(start); | |
if (end === undefined$1) { | |
end = start; | |
start = 0; | |
} else { | |
end = toFinite(end); | |
} | |
number = toNumber2(number); | |
return baseInRange(number, start, end); | |
} | |
function random(lower, upper, floating) { | |
if (floating && typeof floating != "boolean" && isIterateeCall(lower, upper, floating)) { | |
upper = floating = undefined$1; | |
} | |
if (floating === undefined$1) { | |
if (typeof upper == "boolean") { | |
floating = upper; | |
upper = undefined$1; | |
} else if (typeof lower == "boolean") { | |
floating = lower; | |
lower = undefined$1; | |
} | |
} | |
if (lower === undefined$1 && upper === undefined$1) { | |
lower = 0; | |
upper = 1; | |
} else { | |
lower = toFinite(lower); | |
if (upper === undefined$1) { | |
upper = lower; | |
lower = 0; | |
} else { | |
upper = toFinite(upper); | |
} | |
} | |
if (lower > upper) { | |
var temp = lower; | |
lower = upper; | |
upper = temp; | |
} | |
if (floating || lower % 1 || upper % 1) { | |
var rand = nativeRandom(); | |
return nativeMin(lower + rand * (upper - lower + freeParseFloat("1e-" + ((rand + "").length - 1))), upper); | |
} | |
return baseRandom(lower, upper); | |
} | |
var camelCase = createCompounder(function(result2, word, index) { | |
word = word.toLowerCase(); | |
return result2 + (index ? capitalize2(word) : word); | |
}); | |
function capitalize2(string) { | |
return upperFirst(toString3(string).toLowerCase()); | |
} | |
function deburr(string) { | |
string = toString3(string); | |
return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ""); | |
} | |
function endsWith(string, target, position) { | |
string = toString3(string); | |
target = baseToString(target); | |
var length = string.length; | |
position = position === undefined$1 ? length : baseClamp(toInteger(position), 0, length); | |
var end = position; | |
position -= target.length; | |
return position >= 0 && string.slice(position, end) == target; | |
} | |
function escape(string) { | |
string = toString3(string); | |
return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, escapeHtmlChar) : string; | |
} | |
function escapeRegExp(string) { | |
string = toString3(string); | |
return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar, "\\$&") : string; | |
} | |
var kebabCase = createCompounder(function(result2, word, index) { | |
return result2 + (index ? "-" : "") + word.toLowerCase(); | |
}); | |
var lowerCase = createCompounder(function(result2, word, index) { | |
return result2 + (index ? " " : "") + word.toLowerCase(); | |
}); | |
var lowerFirst = createCaseFirst("toLowerCase"); | |
function pad(string, length, chars) { | |
string = toString3(string); | |
length = toInteger(length); | |
var strLength = length ? stringSize(string) : 0; | |
if (!length || strLength >= length) { | |
return string; | |
} | |
var mid = (length - strLength) / 2; | |
return createPadding(nativeFloor(mid), chars) + string + createPadding(nativeCeil(mid), chars); | |
} | |
function padEnd(string, length, chars) { | |
string = toString3(string); | |
length = toInteger(length); | |
var strLength = length ? stringSize(string) : 0; | |
return length && strLength < length ? string + createPadding(length - strLength, chars) : string; | |
} | |
function padStart(string, length, chars) { | |
string = toString3(string); | |
length = toInteger(length); | |
var strLength = length ? stringSize(string) : 0; | |
return length && strLength < length ? createPadding(length - strLength, chars) + string : string; | |
} | |
function parseInt2(string, radix, guard) { | |
if (guard || radix == null) { | |
radix = 0; | |
} else if (radix) { | |
radix = +radix; | |
} | |
return nativeParseInt(toString3(string).replace(reTrimStart, ""), radix || 0); | |
} | |
function repeat(string, n, guard) { | |
if (guard ? isIterateeCall(string, n, guard) : n === undefined$1) { | |
n = 1; | |
} else { | |
n = toInteger(n); | |
} | |
return baseRepeat(toString3(string), n); | |
} | |
function replace() { | |
var args = arguments, string = toString3(args[0]); | |
return args.length < 3 ? string : string.replace(args[1], args[2]); | |
} | |
var snakeCase = createCompounder(function(result2, word, index) { | |
return result2 + (index ? "_" : "") + word.toLowerCase(); | |
}); | |
function split(string, separator, limit) { | |
if (limit && typeof limit != "number" && isIterateeCall(string, separator, limit)) { | |
separator = limit = undefined$1; | |
} | |
limit = limit === undefined$1 ? MAX_ARRAY_LENGTH : limit >>> 0; | |
if (!limit) { | |
return []; | |
} | |
string = toString3(string); | |
if (string && (typeof separator == "string" || separator != null && !isRegExp(separator))) { | |
separator = baseToString(separator); | |
if (!separator && hasUnicode(string)) { | |
return castSlice(stringToArray(string), 0, limit); | |
} | |
} | |
return string.split(separator, limit); | |
} | |
var startCase = createCompounder(function(result2, word, index) { | |
return result2 + (index ? " " : "") + upperFirst(word); | |
}); | |
function startsWith(string, target, position) { | |
string = toString3(string); | |
position = position == null ? 0 : baseClamp(toInteger(position), 0, string.length); | |
target = baseToString(target); | |
return string.slice(position, position + target.length) == target; | |
} | |
function template(string, options, guard) { | |
var settings = lodash2.templateSettings; | |
if (guard && isIterateeCall(string, options, guard)) { | |
options = undefined$1; | |
} | |
string = toString3(string); | |
options = assignInWith({}, options, settings, customDefaultsAssignIn); | |
var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys); | |
var isEscaping, isEvaluating, index = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '"; | |
var reDelimiters = RegExp2( | |
(options.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$", | |
"g" | |
); | |
var sourceURL = "//# sourceURL=" + (hasOwnProperty2.call(options, "sourceURL") ? (options.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n"; | |
string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) { | |
interpolateValue || (interpolateValue = esTemplateValue); | |
source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar); | |
if (escapeValue) { | |
isEscaping = true; | |
source += "' +\n__e(" + escapeValue + ") +\n'"; | |
} | |
if (evaluateValue) { | |
isEvaluating = true; | |
source += "';\n" + evaluateValue + ";\n__p += '"; | |
} | |
if (interpolateValue) { | |
source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'"; | |
} | |
index = offset + match.length; | |
return match; | |
}); | |
source += "';\n"; | |
var variable = hasOwnProperty2.call(options, "variable") && options.variable; | |
if (!variable) { | |
source = "with (obj) {\n" + source + "\n}\n"; | |
} else if (reForbiddenIdentifierChars.test(variable)) { | |
throw new Error2(INVALID_TEMPL_VAR_ERROR_TEXT); | |
} | |
source = (isEvaluating ? source.replace(reEmptyStringLeading, "") : source).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;"); | |
source = "function(" + (variable || "obj") + ") {\n" + (variable ? "" : "obj || (obj = {});\n") + "var __t, __p = ''" + (isEscaping ? ", __e = _.escape" : "") + (isEvaluating ? ", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n" : ";\n") + source + "return __p\n}"; | |
var result2 = attempt(function() { | |
return Function2(importsKeys, sourceURL + "return " + source).apply(undefined$1, importsValues); | |
}); | |
result2.source = source; | |
if (isError(result2)) { | |
throw result2; | |
} | |
return result2; | |
} | |
function toLower(value) { | |
return toString3(value).toLowerCase(); | |
} | |
function toUpper(value) { | |
return toString3(value).toUpperCase(); | |
} | |
function trim(string, chars, guard) { | |
string = toString3(string); | |
if (string && (guard || chars === undefined$1)) { | |
return baseTrim(string); | |
} | |
if (!string || !(chars = baseToString(chars))) { | |
return string; | |
} | |
var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars), start = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1; | |
return castSlice(strSymbols, start, end).join(""); | |
} | |
function trimEnd(string, chars, guard) { | |
string = toString3(string); | |
if (string && (guard || chars === undefined$1)) { | |
return string.slice(0, trimmedEndIndex(string) + 1); | |
} | |
if (!string || !(chars = baseToString(chars))) { | |
return string; | |
} | |
var strSymbols = stringToArray(string), end = charsEndIndex(strSymbols, stringToArray(chars)) + 1; | |
return castSlice(strSymbols, 0, end).join(""); | |
} | |
function trimStart(string, chars, guard) { | |
string = toString3(string); | |
if (string && (guard || chars === undefined$1)) { | |
return string.replace(reTrimStart, ""); | |
} | |
if (!string || !(chars = baseToString(chars))) { | |
return string; | |
} | |
var strSymbols = stringToArray(string), start = charsStartIndex(strSymbols, stringToArray(chars)); | |
return castSlice(strSymbols, start).join(""); | |
} | |
function truncate(string, options) { | |
var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION; | |
if (isObject2(options)) { | |
var separator = "separator" in options ? options.separator : separator; | |
length = "length" in options ? toInteger(options.length) : length; | |
omission = "omission" in options ? baseToString(options.omission) : omission; | |
} | |
string = toString3(string); | |
var strLength = string.length; | |
if (hasUnicode(string)) { | |
var strSymbols = stringToArray(string); | |
strLength = strSymbols.length; | |
} | |
if (length >= strLength) { | |
return string; | |
} | |
var end = length - stringSize(omission); | |
if (end < 1) { | |
return omission; | |
} | |
var result2 = strSymbols ? castSlice(strSymbols, 0, end).join("") : string.slice(0, end); | |
if (separator === undefined$1) { | |
return result2 + omission; | |
} | |
if (strSymbols) { | |
end += result2.length - end; | |
} | |
if (isRegExp(separator)) { | |
if (string.slice(end).search(separator)) { | |
var match, substring = result2; | |
if (!separator.global) { | |
separator = RegExp2(separator.source, toString3(reFlags.exec(separator)) + "g"); | |
} | |
separator.lastIndex = 0; | |
while (match = separator.exec(substring)) { | |
var newEnd = match.index; | |
} | |
result2 = result2.slice(0, newEnd === undefined$1 ? end : newEnd); | |
} | |
} else if (string.indexOf(baseToString(separator), end) != end) { | |
var index = result2.lastIndexOf(separator); | |
if (index > -1) { | |
result2 = result2.slice(0, index); | |
} | |
} | |
return result2 + omission; | |
} | |
function unescape(string) { | |
string = toString3(string); | |
return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, unescapeHtmlChar) : string; | |
} | |
var upperCase = createCompounder(function(result2, word, index) { | |
return result2 + (index ? " " : "") + word.toUpperCase(); | |
}); | |
var upperFirst = createCaseFirst("toUpperCase"); | |
function words(string, pattern, guard) { | |
string = toString3(string); | |
pattern = guard ? undefined$1 : pattern; | |
if (pattern === undefined$1) { | |
return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string); | |
} | |
return string.match(pattern) || []; | |
} | |
var attempt = baseRest(function(func, args) { | |
try { | |
return apply(func, undefined$1, args); | |
} catch (e) { | |
return isError(e) ? e : new Error2(e); | |
} | |
}); | |
var bindAll = flatRest(function(object, methodNames) { | |
arrayEach(methodNames, function(key) { | |
key = toKey(key); | |
baseAssignValue(object, key, bind(object[key], object)); | |
}); | |
return object; | |
}); | |
function cond(pairs) { | |
var length = pairs == null ? 0 : pairs.length, toIteratee = getIteratee(); | |
pairs = !length ? [] : arrayMap(pairs, function(pair) { | |
if (typeof pair[1] != "function") { | |
throw new TypeError2(FUNC_ERROR_TEXT); | |
} | |
return [toIteratee(pair[0]), pair[1]]; | |
}); | |
return baseRest(function(args) { | |
var index = -1; | |
while (++index < length) { | |
var pair = pairs[index]; | |
if (apply(pair[0], this, args)) { | |
return apply(pair[1], this, args); | |
} | |
} | |
}); | |
} | |
function conforms(source) { | |
return baseConforms(baseClone(source, CLONE_DEEP_FLAG)); | |
} | |
function constant(value) { | |
return function() { | |
return value; | |
}; | |
} | |
function defaultTo(value, defaultValue) { | |
return value == null || value !== value ? defaultValue : value; | |
} | |
var flow = createFlow(); | |
var flowRight = createFlow(true); | |
function identity(value) { | |
return value; | |
} | |
function iteratee(func) { | |
return baseIteratee(typeof func == "function" ? func : baseClone(func, CLONE_DEEP_FLAG)); | |
} | |
function matches(source) { | |
return baseMatches(baseClone(source, CLONE_DEEP_FLAG)); | |
} | |
function matchesProperty(path, srcValue) { | |
return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG)); | |
} | |
var method = baseRest(function(path, args) { | |
return function(object) { | |
return baseInvoke(object, path, args); | |
}; | |
}); | |
var methodOf = baseRest(function(object, args) { | |
return function(path) { | |
return baseInvoke(object, path, args); | |
}; | |
}); | |
function mixin(object, source, options) { | |
var props = keys(source), methodNames = baseFunctions(source, props); | |
if (options == null && !(isObject2(source) && (methodNames.length || !props.length))) { | |
options = source; | |
source = object; | |
object = this; | |
methodNames = baseFunctions(source, keys(source)); | |
} | |
var chain2 = !(isObject2(options) && "chain" in options) || !!options.chain, isFunc = isFunction2(object); | |
arrayEach(methodNames, function(methodName) { | |
var func = source[methodName]; | |
object[methodName] = func; | |
if (isFunc) { | |
object.prototype[methodName] = function() { | |
var chainAll = this.__chain__; | |
if (chain2 || chainAll) { | |
var result2 = object(this.__wrapped__), actions = result2.__actions__ = copyArray(this.__actions__); | |
actions.push({ "func": func, "args": arguments, "thisArg": object }); | |
result2.__chain__ = chainAll; | |
return result2; | |
} | |
return func.apply(object, arrayPush([this.value()], arguments)); | |
}; | |
} | |
}); | |
return object; | |
} | |
function noConflict() { | |
if (root._ === this) { | |
root._ = oldDash; | |
} | |
return this; | |
} | |
function noop() { | |
} | |
function nthArg(n) { | |
n = toInteger(n); | |
return baseRest(function(args) { | |
return baseNth(args, n); | |
}); | |
} | |
var over = createOver(arrayMap); | |
var overEvery = createOver(arrayEvery); | |
var overSome = createOver(arraySome); | |
function property(path) { | |
return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path); | |
} | |
function propertyOf(object) { | |
return function(path) { | |
return object == null ? undefined$1 : baseGet(object, path); | |
}; | |
} | |
var range = createRange(); | |
var rangeRight = createRange(true); | |
function stubArray() { | |
return []; | |
} | |
function stubFalse() { | |
return false; | |
} | |
function stubObject() { | |
return {}; | |
} | |
function stubString() { | |
return ""; | |
} | |
function stubTrue() { | |
return true; | |
} | |
function times(n, iteratee2) { | |
n = toInteger(n); | |
if (n < 1 || n > MAX_SAFE_INTEGER) { | |
return []; | |
} | |
var index = MAX_ARRAY_LENGTH, length = nativeMin(n, MAX_ARRAY_LENGTH); | |
iteratee2 = getIteratee(iteratee2); | |
n -= MAX_ARRAY_LENGTH; | |
var result2 = baseTimes(length, iteratee2); | |
while (++index < n) { | |
iteratee2(index); | |
} | |
return result2; | |
} | |
function toPath(value) { | |
if (isArray2(value)) { | |
return arrayMap(value, toKey); | |
} | |
return isSymbol2(value) ? [value] : copyArray(stringToPath(toString3(value))); | |
} | |
function uniqueId(prefix) { | |
var id = ++idCounter; | |
return toString3(prefix) + id; | |
} | |
var add2 = createMathOperation(function(augend, addend) { | |
return augend + addend; | |
}, 0); | |
var ceil = createRound("ceil"); | |
var divide = createMathOperation(function(dividend, divisor) { | |
return dividend / divisor; | |
}, 1); | |
var floor = createRound("floor"); | |
function max(array) { | |
return array && array.length ? baseExtremum(array, identity, baseGt) : undefined$1; | |
} | |
function maxBy(array, iteratee2) { | |
return array && array.length ? baseExtremum(array, getIteratee(iteratee2, 2), baseGt) : undefined$1; | |
} | |
function mean(array) { | |
return baseMean(array, identity); | |
} | |
function meanBy(array, iteratee2) { | |
return baseMean(array, getIteratee(iteratee2, 2)); | |
} | |
function min(array) { | |
return array && array.length ? baseExtremum(array, identity, baseLt) : undefined$1; | |
} | |
function minBy(array, iteratee2) { | |
return array && array.length ? baseExtremum(array, getIteratee(iteratee2, 2), baseLt) : undefined$1; | |
} | |
var multiply = createMathOperation(function(multiplier, multiplicand) { | |
return multiplier * multiplicand; | |
}, 1); | |
var round = createRound("round"); | |
var subtract = createMathOperation(function(minuend, subtrahend) { | |
return minuend - subtrahend; | |
}, 0); | |
function sum(array) { | |
return array && array.length ? baseSum(array, identity) : 0; | |
} | |
function sumBy(array, iteratee2) { | |
return array && array.length ? baseSum(array, getIteratee(iteratee2, 2)) : 0; | |
} | |
lodash2.after = after; | |
lodash2.ary = ary; | |
lodash2.assign = assign; | |
lodash2.assignIn = assignIn; | |
lodash2.assignInWith = assignInWith; | |
lodash2.assignWith = assignWith; | |
lodash2.at = at; | |
lodash2.before = before; | |
lodash2.bind = bind; | |
lodash2.bindAll = bindAll; | |
lodash2.bindKey = bindKey; | |
lodash2.castArray = castArray; | |
lodash2.chain = chain; | |
lodash2.chunk = chunk; | |
lodash2.compact = compact; | |
lodash2.concat = concat2; | |
lodash2.cond = cond; | |
lodash2.conforms = conforms; | |
lodash2.constant = constant; | |
lodash2.countBy = countBy; | |
lodash2.create = create; | |
lodash2.curry = curry; | |
lodash2.curryRight = curryRight; | |
lodash2.debounce = debounce; | |
lodash2.defaults = defaults; | |
lodash2.defaultsDeep = defaultsDeep; | |
lodash2.defer = defer; | |
lodash2.delay = delay; | |
lodash2.difference = difference; | |
lodash2.differenceBy = differenceBy; | |
lodash2.differenceWith = differenceWith; | |
lodash2.drop = drop; | |
lodash2.dropRight = dropRight; | |
lodash2.dropRightWhile = dropRightWhile; | |
lodash2.dropWhile = dropWhile; | |
lodash2.fill = fill2; | |
lodash2.filter = filter; | |
lodash2.flatMap = flatMap; | |
lodash2.flatMapDeep = flatMapDeep; | |
lodash2.flatMapDepth = flatMapDepth; | |
lodash2.flatten = flatten; | |
lodash2.flattenDeep = flattenDeep; | |
lodash2.flattenDepth = flattenDepth; | |
lodash2.flip = flip; | |
lodash2.flow = flow; | |
lodash2.flowRight = flowRight; | |
lodash2.fromPairs = fromPairs; | |
lodash2.functions = functions; | |
lodash2.functionsIn = functionsIn; | |
lodash2.groupBy = groupBy; | |
lodash2.initial = initial; | |
lodash2.intersection = intersection; | |
lodash2.intersectionBy = intersectionBy; | |
lodash2.intersectionWith = intersectionWith; | |
lodash2.invert = invert; | |
lodash2.invertBy = invertBy; | |
lodash2.invokeMap = invokeMap; | |
lodash2.iteratee = iteratee; | |
lodash2.keyBy = keyBy; | |
lodash2.keys = keys; | |
lodash2.keysIn = keysIn; | |
lodash2.map = map; | |
lodash2.mapKeys = mapKeys; | |
lodash2.mapValues = mapValues; | |
lodash2.matches = matches; | |
lodash2.matchesProperty = matchesProperty; | |
lodash2.memoize = memoize; | |
lodash2.merge = merge; | |
lodash2.mergeWith = mergeWith; | |
lodash2.method = method; | |
lodash2.methodOf = methodOf; | |
lodash2.mixin = mixin; | |
lodash2.negate = negate; | |
lodash2.nthArg = nthArg; | |
lodash2.omit = omit; | |
lodash2.omitBy = omitBy; | |
lodash2.once = once; | |
lodash2.orderBy = orderBy; | |
lodash2.over = over; | |
lodash2.overArgs = overArgs; | |
lodash2.overEvery = overEvery; | |
lodash2.overSome = overSome; | |
lodash2.partial = partial; | |
lodash2.partialRight = partialRight; | |
lodash2.partition = partition; | |
lodash2.pick = pick; | |
lodash2.pickBy = pickBy; | |
lodash2.property = property; | |
lodash2.propertyOf = propertyOf; | |
lodash2.pull = pull; | |
lodash2.pullAll = pullAll; | |
lodash2.pullAllBy = pullAllBy; | |
lodash2.pullAllWith = pullAllWith; | |
lodash2.pullAt = pullAt; | |
lodash2.range = range; | |
lodash2.rangeRight = rangeRight; | |
lodash2.rearg = rearg; | |
lodash2.reject = reject; | |
lodash2.remove = remove2; | |
lodash2.rest = rest; | |
lodash2.reverse = reverse; | |
lodash2.sampleSize = sampleSize; | |
lodash2.set = set2; | |
lodash2.setWith = setWith; | |
lodash2.shuffle = shuffle; | |
lodash2.slice = slice2; | |
lodash2.sortBy = sortBy; | |
lodash2.sortedUniq = sortedUniq; | |
lodash2.sortedUniqBy = sortedUniqBy; | |
lodash2.split = split; | |
lodash2.spread = spread; | |
lodash2.tail = tail; | |
lodash2.take = take; | |
lodash2.takeRight = takeRight; | |
lodash2.takeRightWhile = takeRightWhile; | |
lodash2.takeWhile = takeWhile; | |
lodash2.tap = tap; | |
lodash2.throttle = throttle; | |
lodash2.thru = thru; | |
lodash2.toArray = toArray; | |
lodash2.toPairs = toPairs; | |
lodash2.toPairsIn = toPairsIn; | |
lodash2.toPath = toPath; | |
lodash2.toPlainObject = toPlainObject; | |
lodash2.transform = transform2; | |
lodash2.unary = unary; | |
lodash2.union = union; | |
lodash2.unionBy = unionBy; | |
lodash2.unionWith = unionWith; | |
lodash2.uniq = uniq; | |
lodash2.uniqBy = uniqBy; | |
lodash2.uniqWith = uniqWith; | |
lodash2.unset = unset; | |
lodash2.unzip = unzip; | |
lodash2.unzipWith = unzipWith; | |
lodash2.update = update; | |
lodash2.updateWith = updateWith; | |
lodash2.values = values; | |
lodash2.valuesIn = valuesIn; | |
lodash2.without = without; | |
lodash2.words = words; | |
lodash2.wrap = wrap; | |
lodash2.xor = xor; | |
lodash2.xorBy = xorBy; | |
lodash2.xorWith = xorWith; | |
lodash2.zip = zip; | |
lodash2.zipObject = zipObject; | |
lodash2.zipObjectDeep = zipObjectDeep; | |
lodash2.zipWith = zipWith; | |
lodash2.entries = toPairs; | |
lodash2.entriesIn = toPairsIn; | |
lodash2.extend = assignIn; | |
lodash2.extendWith = assignInWith; | |
mixin(lodash2, lodash2); | |
lodash2.add = add2; | |
lodash2.attempt = attempt; | |
lodash2.camelCase = camelCase; | |
lodash2.capitalize = capitalize2; | |
lodash2.ceil = ceil; | |
lodash2.clamp = clamp; | |
lodash2.clone = clone; | |
lodash2.cloneDeep = cloneDeep; | |
lodash2.cloneDeepWith = cloneDeepWith; | |
lodash2.cloneWith = cloneWith; | |
lodash2.conformsTo = conformsTo; | |
lodash2.deburr = deburr; | |
lodash2.defaultTo = defaultTo; | |
lodash2.divide = divide; | |
lodash2.endsWith = endsWith; | |
lodash2.eq = eq; | |
lodash2.escape = escape; | |
lodash2.escapeRegExp = escapeRegExp; | |
lodash2.every = every; | |
lodash2.find = find; | |
lodash2.findIndex = findIndex; | |
lodash2.findKey = findKey; | |
lodash2.findLast = findLast; | |
lodash2.findLastIndex = findLastIndex; | |
lodash2.findLastKey = findLastKey; | |
lodash2.floor = floor; | |
lodash2.forEach = forEach; | |
lodash2.forEachRight = forEachRight; | |
lodash2.forIn = forIn; | |
lodash2.forInRight = forInRight; | |
lodash2.forOwn = forOwn; | |
lodash2.forOwnRight = forOwnRight; | |
lodash2.get = get2; | |
lodash2.gt = gt; | |
lodash2.gte = gte; | |
lodash2.has = has2; | |
lodash2.hasIn = hasIn; | |
lodash2.head = head; | |
lodash2.identity = identity; | |
lodash2.includes = includes2; | |
lodash2.indexOf = indexOf2; | |
lodash2.inRange = inRange; | |
lodash2.invoke = invoke; | |
lodash2.isArguments = isArguments; | |
lodash2.isArray = isArray2; | |
lodash2.isArrayBuffer = isArrayBuffer; | |
lodash2.isArrayLike = isArrayLike; | |
lodash2.isArrayLikeObject = isArrayLikeObject; | |
lodash2.isBoolean = isBoolean; | |
lodash2.isBuffer = isBuffer2; | |
lodash2.isDate = isDate; | |
lodash2.isElement = isElement; | |
lodash2.isEmpty = isEmpty; | |
lodash2.isEqual = isEqual; | |
lodash2.isEqualWith = isEqualWith; | |
lodash2.isError = isError; | |
lodash2.isFinite = isFinite2; | |
lodash2.isFunction = isFunction2; | |
lodash2.isInteger = isInteger; | |
lodash2.isLength = isLength; | |
lodash2.isMap = isMap2; | |
lodash2.isMatch = isMatch; | |
lodash2.isMatchWith = isMatchWith; | |
lodash2.isNaN = isNaN2; | |
lodash2.isNative = isNative; | |
lodash2.isNil = isNil; | |
lodash2.isNull = isNull; | |
lodash2.isNumber = isNumber; | |
lodash2.isObject = isObject2; | |
lodash2.isObjectLike = isObjectLike; | |
lodash2.isPlainObject = isPlainObject2; | |
lodash2.isRegExp = isRegExp; | |
lodash2.isSafeInteger = isSafeInteger; | |
lodash2.isSet = isSet2; | |
lodash2.isString = isString2; | |
lodash2.isSymbol = isSymbol2; | |
lodash2.isTypedArray = isTypedArray; | |
lodash2.isUndefined = isUndefined; | |
lodash2.isWeakMap = isWeakMap; | |
lodash2.isWeakSet = isWeakSet; | |
lodash2.join = join; | |
lodash2.kebabCase = kebabCase; | |
lodash2.last = last; | |
lodash2.lastIndexOf = lastIndexOf2; | |
lodash2.lowerCase = lowerCase; | |
lodash2.lowerFirst = lowerFirst; | |
lodash2.lt = lt; | |
lodash2.lte = lte; | |
lodash2.max = max; | |
lodash2.maxBy = maxBy; | |
lodash2.mean = mean; | |
lodash2.meanBy = meanBy; | |
lodash2.min = min; | |
lodash2.minBy = minBy; | |
lodash2.stubArray = stubArray; | |
lodash2.stubFalse = stubFalse; | |
lodash2.stubObject = stubObject; | |
lodash2.stubString = stubString; | |
lodash2.stubTrue = stubTrue; | |
lodash2.multiply = multiply; | |
lodash2.nth = nth; | |
lodash2.noConflict = noConflict; | |
lodash2.noop = noop; | |
lodash2.now = now; | |
lodash2.pad = pad; | |
lodash2.padEnd = padEnd; | |
lodash2.padStart = padStart; | |
lodash2.parseInt = parseInt2; | |
lodash2.random = random; | |
lodash2.reduce = reduce; | |
lodash2.reduceRight = reduceRight; | |
lodash2.repeat = repeat; | |
lodash2.replace = replace; | |
lodash2.result = result; | |
lodash2.round = round; | |
lodash2.runInContext = runInContext2; | |
lodash2.sample = sample; | |
lodash2.size = size2; | |
lodash2.snakeCase = snakeCase; | |
lodash2.some = some; | |
lodash2.sortedIndex = sortedIndex; | |
lodash2.sortedIndexBy = sortedIndexBy; | |
lodash2.sortedIndexOf = sortedIndexOf; | |
lodash2.sortedLastIndex = sortedLastIndex; | |
lodash2.sortedLastIndexBy = sortedLastIndexBy; | |
lodash2.sortedLastIndexOf = sortedLastIndexOf; | |
lodash2.startCase = startCase; | |
lodash2.startsWith = startsWith; | |
lodash2.subtract = subtract; | |
lodash2.sum = sum; | |
lodash2.sumBy = sumBy; | |
lodash2.template = template; | |
lodash2.times = times; | |
lodash2.toFinite = toFinite; | |
lodash2.toInteger = toInteger; | |
lodash2.toLength = toLength; | |
lodash2.toLower = toLower; | |
lodash2.toNumber = toNumber2; | |
lodash2.toSafeInteger = toSafeInteger; | |
lodash2.toString = toString3; | |
lodash2.toUpper = toUpper; | |
lodash2.trim = trim; | |
lodash2.trimEnd = trimEnd; | |
lodash2.trimStart = trimStart; | |
lodash2.truncate = truncate; | |
lodash2.unescape = unescape; | |
lodash2.uniqueId = uniqueId; | |
lodash2.upperCase = upperCase; | |
lodash2.upperFirst = upperFirst; | |
lodash2.each = forEach; | |
lodash2.eachRight = forEachRight; | |
lodash2.first = head; | |
mixin(lodash2, function() { | |
var source = {}; | |
baseForOwn(lodash2, function(func, methodName) { | |
if (!hasOwnProperty2.call(lodash2.prototype, methodName)) { | |
source[methodName] = func; | |
} | |
}); | |
return source; | |
}(), { "chain": false }); | |
lodash2.VERSION = VERSION; | |
arrayEach(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) { | |
lodash2[methodName].placeholder = lodash2; | |
}); | |
arrayEach(["drop", "take"], function(methodName, index) { | |
LazyWrapper.prototype[methodName] = function(n) { | |
n = n === undefined$1 ? 1 : nativeMax(toInteger(n), 0); | |
var result2 = this.__filtered__ && !index ? new LazyWrapper(this) : this.clone(); | |
if (result2.__filtered__) { | |
result2.__takeCount__ = nativeMin(n, result2.__takeCount__); | |
} else { | |
result2.__views__.push({ | |
"size": nativeMin(n, MAX_ARRAY_LENGTH), | |
"type": methodName + (result2.__dir__ < 0 ? "Right" : "") | |
}); | |
} | |
return result2; | |
}; | |
LazyWrapper.prototype[methodName + "Right"] = function(n) { | |
return this.reverse()[methodName](n).reverse(); | |
}; | |
}); | |
arrayEach(["filter", "map", "takeWhile"], function(methodName, index) { | |
var type = index + 1, isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG; | |
LazyWrapper.prototype[methodName] = function(iteratee2) { | |
var result2 = this.clone(); | |
result2.__iteratees__.push({ | |
"iteratee": getIteratee(iteratee2, 3), | |
"type": type | |
}); | |
result2.__filtered__ = result2.__filtered__ || isFilter; | |
return result2; | |
}; | |
}); | |
arrayEach(["head", "last"], function(methodName, index) { | |
var takeName = "take" + (index ? "Right" : ""); | |
LazyWrapper.prototype[methodName] = function() { | |
return this[takeName](1).value()[0]; | |
}; | |
}); | |
arrayEach(["initial", "tail"], function(methodName, index) { | |
var dropName = "drop" + (index ? "" : "Right"); | |
LazyWrapper.prototype[methodName] = function() { | |
return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1); | |
}; | |
}); | |
LazyWrapper.prototype.compact = function() { | |
return this.filter(identity); | |
}; | |
LazyWrapper.prototype.find = function(predicate) { | |
return this.filter(predicate).head(); | |
}; | |
LazyWrapper.prototype.findLast = function(predicate) { | |
return this.reverse().find(predicate); | |
}; | |
LazyWrapper.prototype.invokeMap = baseRest(function(path, args) { | |
if (typeof path == "function") { | |
return new LazyWrapper(this); | |
} | |
return this.map(function(value) { | |
return baseInvoke(value, path, args); | |
}); | |
}); | |
LazyWrapper.prototype.reject = function(predicate) { | |
return this.filter(negate(getIteratee(predicate))); | |
}; | |
LazyWrapper.prototype.slice = function(start, end) { | |
start = toInteger(start); | |
var result2 = this; | |
if (result2.__filtered__ && (start > 0 || end < 0)) { | |
return new LazyWrapper(result2); | |
} | |
if (start < 0) { | |
result2 = result2.takeRight(-start); | |
} else if (start) { | |
result2 = result2.drop(start); | |
} | |
if (end !== undefined$1) { | |
end = toInteger(end); | |
result2 = end < 0 ? result2.dropRight(-end) : result2.take(end - start); | |
} | |
return result2; | |
}; | |
LazyWrapper.prototype.takeRightWhile = function(predicate) { | |
return this.reverse().takeWhile(predicate).reverse(); | |
}; | |
LazyWrapper.prototype.toArray = function() { | |
return this.take(MAX_ARRAY_LENGTH); | |
}; | |
baseForOwn(LazyWrapper.prototype, function(func, methodName) { | |
var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName), isTaker = /^(?:head|last)$/.test(methodName), lodashFunc = lodash2[isTaker ? "take" + (methodName == "last" ? "Right" : "") : methodName], retUnwrapped = isTaker || /^find/.test(methodName); | |
if (!lodashFunc) { | |
return; | |
} | |
lodash2.prototype[methodName] = function() { | |
var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee2 = args[0], useLazy = isLazy || isArray2(value); | |
var interceptor = function(value2) { | |
var result3 = lodashFunc.apply(lodash2, arrayPush([value2], args)); | |
return isTaker && chainAll ? result3[0] : result3; | |
}; | |
if (useLazy && checkIteratee && typeof iteratee2 == "function" && iteratee2.length != 1) { | |
isLazy = useLazy = false; | |
} | |
var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid; | |
if (!retUnwrapped && useLazy) { | |
value = onlyLazy ? value : new LazyWrapper(this); | |
var result2 = func.apply(value, args); | |
result2.__actions__.push({ "func": thru, "args": [interceptor], "thisArg": undefined$1 }); | |
return new LodashWrapper(result2, chainAll); | |
} | |
if (isUnwrapped && onlyLazy) { | |
return func.apply(this, args); | |
} | |
result2 = this.thru(interceptor); | |
return isUnwrapped ? isTaker ? result2.value()[0] : result2.value() : result2; | |
}; | |
}); | |
arrayEach(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) { | |
var func = arrayProto[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName); | |
lodash2.prototype[methodName] = function() { | |
var args = arguments; | |
if (retUnwrapped && !this.__chain__) { | |
var value = this.value(); | |
return func.apply(isArray2(value) ? value : [], args); | |
} | |
return this[chainName](function(value2) { | |
return func.apply(isArray2(value2) ? value2 : [], args); | |
}); | |
}; | |
}); | |
baseForOwn(LazyWrapper.prototype, function(func, methodName) { | |
var lodashFunc = lodash2[methodName]; | |
if (lodashFunc) { | |
var key = lodashFunc.name + ""; | |
if (!hasOwnProperty2.call(realNames, key)) { | |
realNames[key] = []; | |
} | |
realNames[key].push({ "name": methodName, "func": lodashFunc }); | |
} | |
}); | |
realNames[createHybrid(undefined$1, WRAP_BIND_KEY_FLAG).name] = [{ | |
"name": "wrapper", | |
"func": undefined$1 | |
}]; | |
LazyWrapper.prototype.clone = lazyClone; | |
LazyWrapper.prototype.reverse = lazyReverse; | |
LazyWrapper.prototype.value = lazyValue; | |
lodash2.prototype.at = wrapperAt; | |
lodash2.prototype.chain = wrapperChain; | |
lodash2.prototype.commit = wrapperCommit; | |
lodash2.prototype.next = wrapperNext; | |
lodash2.prototype.plant = wrapperPlant; | |
lodash2.prototype.reverse = wrapperReverse; | |
lodash2.prototype.toJSON = lodash2.prototype.valueOf = lodash2.prototype.value = wrapperValue; | |
lodash2.prototype.first = lodash2.prototype.head; | |
if (symIterator) { | |
lodash2.prototype[symIterator] = wrapperToIterator; | |
} | |
return lodash2; | |
}; | |
var _ = runInContext(); | |
if (freeModule) { | |
(freeModule.exports = _)._ = _; | |
freeExports._ = _; | |
} else { | |
root._ = _; | |
} | |
}).call(commonjsGlobal); | |
})(lodash, lodash.exports); | |
var lodashExports = lodash.exports; | |
var es = {}; | |
var FileReader$1 = {}; | |
var browser = {}; | |
var globalThis$1 = {}; | |
Object.defineProperty(globalThis$1, "__esModule", { value: true }); | |
globalThis$1.getGlobalThis = void 0; | |
function getGlobalThis() { | |
if (typeof globalThis !== "undefined") | |
return globalThis; | |
if (typeof window !== "undefined") | |
return window; | |
if (typeof WorkerGlobalScope !== "undefined") | |
return self; | |
if (typeof commonjsGlobal !== "undefined") | |
return commonjsGlobal; | |
if (this) { | |
return this; | |
} | |
Object.defineProperty(Object.prototype, "__global_this__", { | |
get: function() { | |
return this; | |
}, | |
configurable: true | |
}); | |
try { | |
return __global_this__; | |
} finally { | |
delete Object.prototype.__global_this__; | |
} | |
} | |
globalThis$1.getGlobalThis = getGlobalThis; | |
(function(exports) { | |
Object.defineProperty(exports, "__esModule", { value: true }); | |
exports.getGlobalThis = exports.globalThis = void 0; | |
const global_this_12 = globalThis$1; | |
Object.defineProperty(exports, "getGlobalThis", { enumerable: true, get: function() { | |
return global_this_12.getGlobalThis; | |
} }); | |
const globalThis2 = (0, global_this_12.getGlobalThis)(); | |
exports.globalThis = globalThis2; | |
})(browser); | |
Object.defineProperty(FileReader$1, "__esModule", { value: true }); | |
FileReader$1.FileReader = void 0; | |
const global_this_1 = browser; | |
class FileReader { | |
constructor(source) { | |
this._readPositions = { start: 0, end: 0 }; | |
this._source = source; | |
this._reader = new global_this_1.globalThis.FileReader(); | |
this._reader.addEventListener("load", this._onLoad.bind(this)); | |
this._reader.addEventListener("error", this._onError.bind(this)); | |
this._reader.addEventListener("abort", this._onError.bind(this)); | |
} | |
_onLoad() { | |
if (!this._currentRead) | |
throw new Error("Assertion error: a result was received but no read operation was in progress"); | |
const { resolve } = this._currentRead; | |
this._currentRead = void 0; | |
resolve(this._reader.result); | |
} | |
_onError() { | |
if (!this._currentRead) { | |
return; | |
} | |
const { reject } = this._currentRead; | |
this._currentRead = void 0; | |
reject(this._reader.error); | |
} | |
_assertNoReadInProgress() { | |
if (this._currentRead) | |
throw new Error("Assertion error: a read operation is already in progress"); | |
} | |
abort() { | |
return this._reader.abort(); | |
} | |
async readAsDataURL() { | |
this._assertNoReadInProgress(); | |
return new Promise((resolve, reject) => { | |
this._currentRead = { resolve, reject }; | |
this._reader.readAsDataURL(this._source); | |
}); | |
} | |
async readAsText(encoding) { | |
this._assertNoReadInProgress(); | |
return new Promise((resolve, reject) => { | |
this._currentRead = { resolve, reject }; | |
this._reader.readAsText(this._source, encoding); | |
}); | |
} | |
async readAsArrayBuffer(byteSize) { | |
this._assertNoReadInProgress(); | |
const start = this._readPositions.end; | |
const end = byteSize ? Math.min(start + byteSize, this._source.size) : this._source.size; | |
this._readPositions = { start, end }; | |
const blobSlice = Blob.prototype.slice || Blob.prototype.mozSlice || Blob.prototype.webkitSlice; | |
return new Promise((resolve, reject) => { | |
this._currentRead = { resolve, reject }; | |
this._reader.readAsArrayBuffer(blobSlice.call(this._source, start, end)); | |
}); | |
} | |
} | |
FileReader$1.FileReader = FileReader; | |
(function(exports) { | |
Object.defineProperty(exports, "__esModule", { value: true }); | |
exports.FileReader = void 0; | |
const FileReader_1 = FileReader$1; | |
Object.defineProperty(exports, "FileReader", { enumerable: true, get: function() { | |
return FileReader_1.FileReader; | |
} }); | |
})(es); | |
var global$1 = typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}; | |
var lookup = []; | |
var revLookup = []; | |
var Arr = typeof Uint8Array !== "undefined" ? Uint8Array : Array; | |
var inited = false; | |
function init() { | |
inited = true; | |
var code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; | |
for (var i = 0, len = code.length; i < len; ++i) { | |
lookup[i] = code[i]; | |
revLookup[code.charCodeAt(i)] = i; | |
} | |
revLookup["-".charCodeAt(0)] = 62; | |
revLookup["_".charCodeAt(0)] = 63; | |
} | |
function toByteArray(b64) { | |
if (!inited) { | |
init(); | |
} | |
var i, j, l, tmp, placeHolders, arr; | |
var len = b64.length; | |
if (len % 4 > 0) { | |
throw new Error("Invalid string. Length must be a multiple of 4"); | |
} | |
placeHolders = b64[len - 2] === "=" ? 2 : b64[len - 1] === "=" ? 1 : 0; | |
arr = new Arr(len * 3 / 4 - placeHolders); | |
l = placeHolders > 0 ? len - 4 : len; | |
var L = 0; | |
for (i = 0, j = 0; i < l; i += 4, j += 3) { | |
tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)]; | |
arr[L++] = tmp >> 16 & 255; | |
arr[L++] = tmp >> 8 & 255; | |
arr[L++] = tmp & 255; | |
} | |
if (placeHolders === 2) { | |
tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4; | |
arr[L++] = tmp & 255; | |
} else if (placeHolders === 1) { | |
tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2; | |
arr[L++] = tmp >> 8 & 255; | |
arr[L++] = tmp & 255; | |
} | |
return arr; | |
} | |
function tripletToBase64(num) { | |
return lookup[num >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[num & 63]; | |
} | |
function encodeChunk(uint8, start, end) { | |
var tmp; | |
var output = []; | |
for (var i = start; i < end; i += 3) { | |
tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + uint8[i + 2]; | |
output.push(tripletToBase64(tmp)); | |
} | |
return output.join(""); | |
} | |
function fromByteArray(uint8) { | |
if (!inited) { | |
init(); | |
} | |
var tmp; | |
var len = uint8.length; | |
var extraBytes = len % 3; | |
var output = ""; | |
var parts = []; | |
var maxChunkLength = 16383; | |
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { | |
parts.push(encodeChunk(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength)); | |
} | |
if (extraBytes === 1) { | |
tmp = uint8[len - 1]; | |
output += lookup[tmp >> 2]; | |
output += lookup[tmp << 4 & 63]; | |
output += "=="; | |
} else if (extraBytes === 2) { | |
tmp = (uint8[len - 2] << 8) + uint8[len - 1]; | |
output += lookup[tmp >> 10]; | |
output += lookup[tmp >> 4 & 63]; | |
output += lookup[tmp << 2 & 63]; | |
output += "="; | |
} | |
parts.push(output); | |
return parts.join(""); | |
} | |
function read(buffer2, offset, isLE, mLen, nBytes) { | |
var e, m; | |
var eLen = nBytes * 8 - mLen - 1; | |
var eMax = (1 << eLen) - 1; | |
var eBias = eMax >> 1; | |
var nBits = -7; | |
var i = isLE ? nBytes - 1 : 0; | |
var d = isLE ? -1 : 1; | |
var s = buffer2[offset + i]; | |
i += d; | |
e = s & (1 << -nBits) - 1; | |
s >>= -nBits; | |
nBits += eLen; | |
for (; nBits > 0; e = e * 256 + buffer2[offset + i], i += d, nBits -= 8) { | |
} | |
m = e & (1 << -nBits) - 1; | |
e >>= -nBits; | |
nBits += mLen; | |
for (; nBits > 0; m = m * 256 + buffer2[offset + i], i += d, nBits -= 8) { | |
} | |
if (e === 0) { | |
e = 1 - eBias; | |
} else if (e === eMax) { | |
return m ? NaN : (s ? -1 : 1) * Infinity; | |
} else { | |
m = m + Math.pow(2, mLen); | |
e = e - eBias; | |
} | |
return (s ? -1 : 1) * m * Math.pow(2, e - mLen); | |
} | |
function write(buffer2, value, offset, isLE, mLen, nBytes) { | |
var e, m, c; | |
var eLen = nBytes * 8 - mLen - 1; | |
var eMax = (1 << eLen) - 1; | |
var eBias = eMax >> 1; | |
var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0; | |
var i = isLE ? 0 : nBytes - 1; | |
var d = isLE ? 1 : -1; | |
var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0; | |
value = Math.abs(value); | |
if (isNaN(value) || value === Infinity) { | |
m = isNaN(value) ? 1 : 0; | |
e = eMax; | |
} else { | |
e = Math.floor(Math.log(value) / Math.LN2); | |
if (value * (c = Math.pow(2, -e)) < 1) { | |
e--; | |
c *= 2; | |
} | |
if (e + eBias >= 1) { | |
value += rt / c; | |
} else { | |
value += rt * Math.pow(2, 1 - eBias); | |
} | |
if (value * c >= 2) { | |
e++; | |
c /= 2; | |
} | |
if (e + eBias >= eMax) { | |
m = 0; | |
e = eMax; | |
} else if (e + eBias >= 1) { | |
m = (value * c - 1) * Math.pow(2, mLen); | |
e = e + eBias; | |
} else { | |
m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen); | |
e = 0; | |
} | |
} | |
for (; mLen >= 8; buffer2[offset + i] = m & 255, i += d, m /= 256, mLen -= 8) { | |
} | |
e = e << mLen | m; | |
eLen += mLen; | |
for (; eLen > 0; buffer2[offset + i] = e & 255, i += d, e /= 256, eLen -= 8) { | |
} | |
buffer2[offset + i - d] |= s * 128; | |
} | |
var toString = {}.toString; | |
var isArray = Array.isArray || function(arr) { | |
return toString.call(arr) == "[object Array]"; | |
}; | |
var INSPECT_MAX_BYTES = 50; | |
Buffer.TYPED_ARRAY_SUPPORT = global$1.TYPED_ARRAY_SUPPORT !== void 0 ? global$1.TYPED_ARRAY_SUPPORT : true; | |
kMaxLength(); | |
function kMaxLength() { | |
return Buffer.TYPED_ARRAY_SUPPORT ? 2147483647 : 1073741823; | |
} | |
function createBuffer(that, length) { | |
if (kMaxLength() < length) { | |
throw new RangeError("Invalid typed array length"); | |
} | |
if (Buffer.TYPED_ARRAY_SUPPORT) { | |
that = new Uint8Array(length); | |
that.__proto__ = Buffer.prototype; | |
} else { | |
if (that === null) { | |
that = new Buffer(length); | |
} | |
that.length = length; | |
} | |
return that; | |
} | |
function Buffer(arg, encodingOrOffset, length) { | |
if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) { | |
return new Buffer(arg, encodingOrOffset, length); | |
} | |
if (typeof arg === "number") { | |
if (typeof encodingOrOffset === "string") { | |
throw new Error( | |
"If encoding is specified then the first argument must be a string" | |
); | |
} | |
return allocUnsafe(this, arg); | |
} | |
return from(this, arg, encodingOrOffset, length); | |
} | |
Buffer.poolSize = 8192; | |
Buffer._augment = function(arr) { | |
arr.__proto__ = Buffer.prototype; | |
return arr; | |
}; | |
function from(that, value, encodingOrOffset, length) { | |
if (typeof value === "number") { | |
throw new TypeError('"value" argument must not be a number'); | |
} | |
if (typeof ArrayBuffer !== "undefined" && value instanceof ArrayBuffer) { | |
return fromArrayBuffer(that, value, encodingOrOffset, length); | |
} | |
if (typeof value === "string") { | |
return fromString(that, value, encodingOrOffset); | |
} | |
return fromObject(that, value); | |
} | |
Buffer.from = function(value, encodingOrOffset, length) { | |
return from(null, value, encodingOrOffset, length); | |
}; | |
if (Buffer.TYPED_ARRAY_SUPPORT) { | |
Buffer.prototype.__proto__ = Uint8Array.prototype; | |
Buffer.__proto__ = Uint8Array; | |
if (typeof Symbol !== "undefined" && Symbol.species && Buffer[Symbol.species] === Buffer) | |
; | |
} | |
function assertSize(size2) { | |
if (typeof size2 !== "number") { | |
throw new TypeError('"size" argument must be a number'); | |
} else if (size2 < 0) { | |
throw new RangeError('"size" argument must not be negative'); | |
} | |
} | |
function alloc(that, size2, fill2, encoding) { | |
assertSize(size2); | |
if (size2 <= 0) { | |
return createBuffer(that, size2); | |
} | |
if (fill2 !== void 0) { | |
return typeof encoding === "string" ? createBuffer(that, size2).fill(fill2, encoding) : createBuffer(that, size2).fill(fill2); | |
} | |
return createBuffer(that, size2); | |
} | |
Buffer.alloc = function(size2, fill2, encoding) { | |
return alloc(null, size2, fill2, encoding); | |
}; | |
function allocUnsafe(that, size2) { | |
assertSize(size2); | |
that = createBuffer(that, size2 < 0 ? 0 : checked(size2) | 0); | |
if (!Buffer.TYPED_ARRAY_SUPPORT) { | |
for (var i = 0; i < size2; ++i) { | |
that[i] = 0; | |
} | |
} | |
return that; | |
} | |
Buffer.allocUnsafe = function(size2) { | |
return allocUnsafe(null, size2); | |
}; | |
Buffer.allocUnsafeSlow = function(size2) { | |
return allocUnsafe(null, size2); | |
}; | |
function fromString(that, string, encoding) { | |
if (typeof encoding !== "string" || encoding === "") { | |
encoding = "utf8"; | |
} | |
if (!Buffer.isEncoding(encoding)) { | |
throw new TypeError('"encoding" must be a valid string encoding'); | |
} | |
var length = byteLength(string, encoding) | 0; | |
that = createBuffer(that, length); | |
var actual = that.write(string, encoding); | |
if (actual !== length) { | |
that = that.slice(0, actual); | |
} | |
return that; | |
} | |
function fromArrayLike(that, array) { | |
var length = array.length < 0 ? 0 : checked(array.length) | 0; | |
that = createBuffer(that, length); | |
for (var i = 0; i < length; i += 1) { | |
that[i] = array[i] & 255; | |
} | |
return that; | |
} | |
function fromArrayBuffer(that, array, byteOffset, length) { | |
array.byteLength; | |
if (byteOffset < 0 || array.byteLength < byteOffset) { | |
throw new RangeError("'offset' is out of bounds"); | |
} | |
if (array.byteLength < byteOffset + (length || 0)) { | |
throw new RangeError("'length' is out of bounds"); | |
} | |
if (byteOffset === void 0 && length === void 0) { | |
array = new Uint8Array(array); | |
} else if (length === void 0) { | |
array = new Uint8Array(array, byteOffset); | |
} else { | |
array = new Uint8Array(array, byteOffset, length); | |
} | |
if (Buffer.TYPED_ARRAY_SUPPORT) { | |
that = array; | |
that.__proto__ = Buffer.prototype; | |
} else { | |
that = fromArrayLike(that, array); | |
} | |
return that; | |
} | |
function fromObject(that, obj) { | |
if (internalIsBuffer(obj)) { | |
var len = checked(obj.length) | 0; | |
that = createBuffer(that, len); | |
if (that.length === 0) { | |
return that; | |
} | |
obj.copy(that, 0, 0, len); | |
return that; | |
} | |
if (obj) { | |
if (typeof ArrayBuffer !== "undefined" && obj.buffer instanceof ArrayBuffer || "length" in obj) { | |
if (typeof obj.length !== "number" || isnan(obj.length)) { | |
return createBuffer(that, 0); | |
} | |
return fromArrayLike(that, obj); | |
} | |
if (obj.type === "Buffer" && isArray(obj.data)) { | |
return fromArrayLike(that, obj.data); | |
} | |
} | |
throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object."); | |
} | |
function checked(length) { | |
if (length >= kMaxLength()) { | |
throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + kMaxLength().toString(16) + " bytes"); | |
} | |
return length | 0; | |
} | |
Buffer.isBuffer = isBuffer; | |
function internalIsBuffer(b) { | |
return !!(b != null && b._isBuffer); | |
} | |
Buffer.compare = function compare(a, b) { | |
if (!internalIsBuffer(a) || !internalIsBuffer(b)) { | |
throw new TypeError("Arguments must be Buffers"); | |
} | |
if (a === b) | |
return 0; | |
var x = a.length; | |
var y = b.length; | |
for (var i = 0, len = Math.min(x, y); i < len; ++i) { | |
if (a[i] !== b[i]) { | |
x = a[i]; | |
y = b[i]; | |
break; | |
} | |
} | |
if (x < y) | |
return -1; | |
if (y < x) | |
return 1; | |
return 0; | |
}; | |
Buffer.isEncoding = function isEncoding(encoding) { | |
switch (String(encoding).toLowerCase()) { | |
case "hex": | |
case "utf8": | |
case "utf-8": | |
case "ascii": | |
case "latin1": | |
case "binary": | |
case "base64": | |
case "ucs2": | |
case "ucs-2": | |
case "utf16le": | |
case "utf-16le": | |
return true; | |
default: | |
return false; | |
} | |
}; | |
Buffer.concat = function concat(list, length) { | |
if (!isArray(list)) { | |
throw new TypeError('"list" argument must be an Array of Buffers'); | |
} | |
if (list.length === 0) { | |
return Buffer.alloc(0); | |
} | |
var i; | |
if (length === void 0) { | |
length = 0; | |
for (i = 0; i < list.length; ++i) { | |
length += list[i].length; | |
} | |
} | |
var buffer2 = Buffer.allocUnsafe(length); | |
var pos = 0; | |
for (i = 0; i < list.length; ++i) { | |
var buf = list[i]; | |
if (!internalIsBuffer(buf)) { | |
throw new TypeError('"list" argument must be an Array of Buffers'); | |
} | |
buf.copy(buffer2, pos); | |
pos += buf.length; | |
} | |
return buffer2; | |
}; | |
function byteLength(string, encoding) { | |
if (internalIsBuffer(string)) { | |
return string.length; | |
} | |
if (typeof ArrayBuffer !== "undefined" && typeof ArrayBuffer.isView === "function" && (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) { | |
return string.byteLength; | |
} | |
if (typeof string !== "string") { | |
string = "" + string; | |
} | |
var len = string.length; | |
if (len === 0) | |
return 0; | |
var loweredCase = false; | |
for (; ; ) { | |
switch (encoding) { | |
case "ascii": | |
case "latin1": | |
case "binary": | |
return len; | |
case "utf8": | |
case "utf-8": | |
case void 0: | |
return utf8ToBytes(string).length; | |
case "ucs2": | |
case "ucs-2": | |
case "utf16le": | |
case "utf-16le": | |
return len * 2; | |
case "hex": | |
return len >>> 1; | |
case "base64": | |
return base64ToBytes(string).length; | |
default: | |
if (loweredCase) | |
return utf8ToBytes(string).length; | |
encoding = ("" + encoding).toLowerCase(); | |
loweredCase = true; | |
} | |
} | |
} | |
Buffer.byteLength = byteLength; | |
function slowToString(encoding, start, end) { | |
var loweredCase = false; | |
if (start === void 0 || start < 0) { | |
start = 0; | |
} | |
if (start > this.length) { | |
return ""; | |
} | |
if (end === void 0 || end > this.length) { | |
end = this.length; | |
} | |
if (end <= 0) { | |
return ""; | |
} | |
end >>>= 0; | |
start >>>= 0; | |
if (end <= start) { | |
return ""; | |
} | |
if (!encoding) | |
encoding = "utf8"; | |
while (true) { | |
switch (encoding) { | |
case "hex": | |
return hexSlice(this, start, end); | |
case "utf8": | |
case "utf-8": | |
return utf8Slice(this, start, end); | |
case "ascii": | |
return asciiSlice(this, start, end); | |
case "latin1": | |
case "binary": | |
return latin1Slice(this, start, end); | |
case "base64": | |
return base64Slice(this, start, end); | |
case "ucs2": | |
case "ucs-2": | |
case "utf16le": | |
case "utf-16le": | |
return utf16leSlice(this, start, end); | |
default: | |
if (loweredCase) | |
throw new TypeError("Unknown encoding: " + encoding); | |
encoding = (encoding + "").toLowerCase(); | |
loweredCase = true; | |
} | |
} | |
} | |
Buffer.prototype._isBuffer = true; | |
function swap(b, n, m) { | |
var i = b[n]; | |
b[n] = b[m]; | |
b[m] = i; | |
} | |
Buffer.prototype.swap16 = function swap16() { | |
var len = this.length; | |
if (len % 2 !== 0) { | |
throw new RangeError("Buffer size must be a multiple of 16-bits"); | |
} | |
for (var i = 0; i < len; i += 2) { | |
swap(this, i, i + 1); | |
} | |
return this; | |
}; | |
Buffer.prototype.swap32 = function swap32() { | |
var len = this.length; | |
if (len % 4 !== 0) { | |
throw new RangeError("Buffer size must be a multiple of 32-bits"); | |
} | |
for (var i = 0; i < len; i += 4) { | |
swap(this, i, i + 3); | |
swap(this, i + 1, i + 2); | |
} | |
return this; | |
}; | |
Buffer.prototype.swap64 = function swap64() { | |
var len = this.length; | |
if (len % 8 !== 0) { | |
throw new RangeError("Buffer size must be a multiple of 64-bits"); | |
} | |
for (var i = 0; i < len; i += 8) { | |
swap(this, i, i + 7); | |
swap(this, i + 1, i + 6); | |
swap(this, i + 2, i + 5); | |
swap(this, i + 3, i + 4); | |
} | |
return this; | |
}; | |
Buffer.prototype.toString = function toString2() { | |
var length = this.length | 0; | |
if (length === 0) | |
return ""; | |
if (arguments.length === 0) | |
return utf8Slice(this, 0, length); | |
return slowToString.apply(this, arguments); | |
}; | |
Buffer.prototype.equals = function equals(b) { | |
if (!internalIsBuffer(b)) | |
throw new TypeError("Argument must be a Buffer"); | |
if (this === b) | |
return true; | |
return Buffer.compare(this, b) === 0; | |
}; | |
Buffer.prototype.inspect = function inspect() { | |
var str = ""; | |
var max = INSPECT_MAX_BYTES; | |
if (this.length > 0) { | |
str = this.toString("hex", 0, max).match(/.{2}/g).join(" "); | |
if (this.length > max) | |
str += " ... "; | |
} | |
return "<Buffer " + str + ">"; | |
}; | |
Buffer.prototype.compare = function compare2(target, start, end, thisStart, thisEnd) { | |
if (!internalIsBuffer(target)) { | |
throw new TypeError("Argument must be a Buffer"); | |
} | |
if (start === void 0) { | |
start = 0; | |
} | |
if (end === void 0) { | |
end = target ? target.length : 0; | |
} | |
if (thisStart === void 0) { | |
thisStart = 0; | |
} | |
if (thisEnd === void 0) { | |
thisEnd = this.length; | |
} | |
if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { | |
throw new RangeError("out of range index"); | |
} | |
if (thisStart >= thisEnd && start >= end) { | |
return 0; | |
} | |
if (thisStart >= thisEnd) { | |
return -1; | |
} | |
if (start >= end) { | |
return 1; | |
} | |
start >>>= 0; | |
end >>>= 0; | |
thisStart >>>= 0; | |
thisEnd >>>= 0; | |
if (this === target) | |
return 0; | |
var x = thisEnd - thisStart; | |
var y = end - start; | |
var len = Math.min(x, y); | |
var thisCopy = this.slice(thisStart, thisEnd); | |
var targetCopy = target.slice(start, end); | |
for (var i = 0; i < len; ++i) { | |
if (thisCopy[i] !== targetCopy[i]) { | |
x = thisCopy[i]; | |
y = targetCopy[i]; | |
break; | |
} | |
} | |
if (x < y) | |
return -1; | |
if (y < x) | |
return 1; | |
return 0; | |
}; | |
function bidirectionalIndexOf(buffer2, val, byteOffset, encoding, dir) { | |
if (buffer2.length === 0) | |
return -1; | |
if (typeof byteOffset === "string") { | |
encoding = byteOffset; | |
byteOffset = 0; | |
} else if (byteOffset > 2147483647) { | |
byteOffset = 2147483647; | |
} else if (byteOffset < -2147483648) { | |
byteOffset = -2147483648; | |
} | |
byteOffset = +byteOffset; | |
if (isNaN(byteOffset)) { | |
byteOffset = dir ? 0 : buffer2.length - 1; | |
} | |
if (byteOffset < 0) | |
byteOffset = buffer2.length + byteOffset; | |
if (byteOffset >= buffer2.length) { | |
if (dir) | |
return -1; | |
else | |
byteOffset = buffer2.length - 1; | |
} else if (byteOffset < 0) { | |
if (dir) | |
byteOffset = 0; | |
else | |
return -1; | |
} | |
if (typeof val === "string") { | |
val = Buffer.from(val, encoding); | |
} | |
if (internalIsBuffer(val)) { | |
if (val.length === 0) { | |
return -1; | |
} | |
return arrayIndexOf(buffer2, val, byteOffset, encoding, dir); | |
} else if (typeof val === "number") { | |
val = val & 255; | |
if (Buffer.TYPED_ARRAY_SUPPORT && typeof Uint8Array.prototype.indexOf === "function") { | |
if (dir) { | |
return Uint8Array.prototype.indexOf.call(buffer2, val, byteOffset); | |
} else { | |
return Uint8Array.prototype.lastIndexOf.call(buffer2, val, byteOffset); | |
} | |
} | |
return arrayIndexOf(buffer2, [val], byteOffset, encoding, dir); | |
} | |
throw new TypeError("val must be string, number or Buffer"); | |
} | |
function arrayIndexOf(arr, val, byteOffset, encoding, dir) { | |
var indexSize = 1; | |
var arrLength = arr.length; | |
var valLength = val.length; | |
if (encoding !== void 0) { | |
encoding = String(encoding).toLowerCase(); | |
if (encoding === "ucs2" || encoding === "ucs-2" || encoding === "utf16le" || encoding === "utf-16le") { | |
if (arr.length < 2 || val.length < 2) { | |
return -1; | |
} | |
indexSize = 2; | |
arrLength /= 2; | |
valLength /= 2; | |
byteOffset /= 2; | |
} | |
} | |
function read2(buf, i2) { | |
if (indexSize === 1) { | |
return buf[i2]; | |
} else { | |
return buf.readUInt16BE(i2 * indexSize); | |
} | |
} | |
var i; | |
if (dir) { | |
var foundIndex = -1; | |
for (i = byteOffset; i < arrLength; i++) { | |
if (read2(arr, i) === read2(val, foundIndex === -1 ? 0 : i - foundIndex)) { | |
if (foundIndex === -1) | |
foundIndex = i; | |
if (i - foundIndex + 1 === valLength) | |
return foundIndex * indexSize; | |
} else { | |
if (foundIndex !== -1) | |
i -= i - foundIndex; | |
foundIndex = -1; | |
} | |
} | |
} else { | |
if (byteOffset + valLength > arrLength) | |
byteOffset = arrLength - valLength; | |
for (i = byteOffset; i >= 0; i--) { | |
var found = true; | |
for (var j = 0; j < valLength; j++) { | |
if (read2(arr, i + j) !== read2(val, j)) { | |
found = false; | |
break; | |
} | |
} | |
if (found) | |
return i; | |
} | |
} | |
return -1; | |
} | |
Buffer.prototype.includes = function includes(val, byteOffset, encoding) { | |
return this.indexOf(val, byteOffset, encoding) !== -1; | |
}; | |
Buffer.prototype.indexOf = function indexOf(val, byteOffset, encoding) { | |
return bidirectionalIndexOf(this, val, byteOffset, encoding, true); | |
}; | |
Buffer.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) { | |
return bidirectionalIndexOf(this, val, byteOffset, encoding, false); | |
}; | |
function hexWrite(buf, string, offset, length) { | |
offset = Number(offset) || 0; | |
var remaining = buf.length - offset; | |
if (!length) { | |
length = remaining; | |
} else { | |
length = Number(length); | |
if (length > remaining) { | |
length = remaining; | |
} | |
} | |
var strLen = string.length; | |
if (strLen % 2 !== 0) | |
throw new TypeError("Invalid hex string"); | |
if (length > strLen / 2) { | |
length = strLen / 2; | |
} | |
for (var i = 0; i < length; ++i) { | |
var parsed = parseInt(string.substr(i * 2, 2), 16); | |
if (isNaN(parsed)) | |
return i; | |
buf[offset + i] = parsed; | |
} | |
return i; | |
} | |
function utf8Write(buf, string, offset, length) { | |
return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length); | |
} | |
function asciiWrite(buf, string, offset, length) { | |
return blitBuffer(asciiToBytes(string), buf, offset, length); | |
} | |
function latin1Write(buf, string, offset, length) { | |
return asciiWrite(buf, string, offset, length); | |
} | |
function base64Write(buf, string, offset, length) { | |
return blitBuffer(base64ToBytes(string), buf, offset, length); | |
} | |
function ucs2Write(buf, string, offset, length) { | |
return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length); | |
} | |
Buffer.prototype.write = function write2(string, offset, length, encoding) { | |
if (offset === void 0) { | |
encoding = "utf8"; | |
length = this.length; | |
offset = 0; | |
} else if (length === void 0 && typeof offset === "string") { | |
encoding = offset; | |
length = this.length; | |
offset = 0; | |
} else if (isFinite(offset)) { | |
offset = offset | 0; | |
if (isFinite(length)) { | |
length = length | 0; | |
if (encoding === void 0) | |
encoding = "utf8"; | |
} else { | |
encoding = length; | |
length = void 0; | |
} | |
} else { | |
throw new Error( | |
"Buffer.write(string, encoding, offset[, length]) is no longer supported" | |
); | |
} | |
var remaining = this.length - offset; | |
if (length === void 0 || length > remaining) | |
length = remaining; | |
if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) { | |
throw new RangeError("Attempt to write outside buffer bounds"); | |
} | |
if (!encoding) | |
encoding = "utf8"; | |
var loweredCase = false; | |
for (; ; ) { | |
switch (encoding) { | |
case "hex": | |
return hexWrite(this, string, offset, length); | |
case "utf8": | |
case "utf-8": | |
return utf8Write(this, string, offset, length); | |
case "ascii": | |
return asciiWrite(this, string, offset, length); | |
case "latin1": | |
case "binary": | |
return latin1Write(this, string, offset, length); | |
case "base64": | |
return base64Write(this, string, offset, length); | |
case "ucs2": | |
case "ucs-2": | |
case "utf16le": | |
case "utf-16le": | |
return ucs2Write(this, string, offset, length); | |
default: | |
if (loweredCase) | |
throw new TypeError("Unknown encoding: " + encoding); | |
encoding = ("" + encoding).toLowerCase(); | |
loweredCase = true; | |
} | |
} | |
}; | |
Buffer.prototype.toJSON = function toJSON() { | |
return { | |
type: "Buffer", | |
data: Array.prototype.slice.call(this._arr || this, 0) | |
}; | |
}; | |
function base64Slice(buf, start, end) { | |
if (start === 0 && end === buf.length) { | |
return fromByteArray(buf); | |
} else { | |
return fromByteArray(buf.slice(start, end)); | |
} | |
} | |
function utf8Slice(buf, start, end) { | |
end = Math.min(buf.length, end); | |
var res = []; | |
var i = start; | |
while (i < end) { | |
var firstByte = buf[i]; | |
var codePoint = null; | |
var bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1; | |
if (i + bytesPerSequence <= end) { | |
var secondByte, thirdByte, fourthByte, tempCodePoint; | |
switch (bytesPerSequence) { | |
case 1: | |
if (firstByte < 128) { | |
codePoint = firstByte; | |
} | |
break; | |
case 2: | |
secondByte = buf[i + 1]; | |
if ((secondByte & 192) === 128) { | |
tempCodePoint = (firstByte & 31) << 6 | secondByte & 63; | |
if (tempCodePoint > 127) { | |
codePoint = tempCodePoint; | |
} | |
} | |
break; | |
case 3: | |
secondByte = buf[i + 1]; | |
thirdByte = buf[i + 2]; | |
if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) { | |
tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63; | |
if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) { | |
codePoint = tempCodePoint; | |
} | |
} | |
break; | |
case 4: | |
secondByte = buf[i + 1]; | |
thirdByte = buf[i + 2]; | |
fourthByte = buf[i + 3]; | |
if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) { | |
tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63; | |
if (tempCodePoint > 65535 && tempCodePoint < 1114112) { | |
codePoint = tempCodePoint; | |
} | |
} | |
} | |
} | |
if (codePoint === null) { | |
codePoint = 65533; | |
bytesPerSequence = 1; | |
} else if (codePoint > 65535) { | |
codePoint -= 65536; | |
res.push(codePoint >>> 10 & 1023 | 55296); | |
codePoint = 56320 | codePoint & 1023; | |
} | |
res.push(codePoint); | |
i += bytesPerSequence; | |
} | |
return decodeCodePointsArray(res); | |
} | |
var MAX_ARGUMENTS_LENGTH = 4096; | |
function decodeCodePointsArray(codePoints) { | |
var len = codePoints.length; | |
if (len <= MAX_ARGUMENTS_LENGTH) { | |
return String.fromCharCode.apply(String, codePoints); | |
} | |
var res = ""; | |
var i = 0; | |
while (i < len) { | |
res += String.fromCharCode.apply( | |
String, | |
codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) | |
); | |
} | |
return res; | |
} | |
function asciiSlice(buf, start, end) { | |
var ret = ""; | |
end = Math.min(buf.length, end); | |
for (var i = start; i < end; ++i) { | |
ret += String.fromCharCode(buf[i] & 127); | |
} | |
return ret; | |
} | |
function latin1Slice(buf, start, end) { | |
var ret = ""; | |
end = Math.min(buf.length, end); | |
for (var i = start; i < end; ++i) { | |
ret += String.fromCharCode(buf[i]); | |
} | |
return ret; | |
} | |
function hexSlice(buf, start, end) { | |
var len = buf.length; | |
if (!start || start < 0) | |
start = 0; | |
if (!end || end < 0 || end > len) | |
end = len; | |
var out = ""; | |
for (var i = start; i < end; ++i) { | |
out += toHex(buf[i]); | |
} | |
return out; | |
} | |
function utf16leSlice(buf, start, end) { | |
var bytes = buf.slice(start, end); | |
var res = ""; | |
for (var i = 0; i < bytes.length; i += 2) { | |
res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256); | |
} | |
return res; | |
} | |
Buffer.prototype.slice = function slice(start, end) { | |
var len = this.length; | |
start = ~~start; | |
end = end === void 0 ? len : ~~end; | |
if (start < 0) { | |
start += len; | |
if (start < 0) | |
start = 0; | |
} else if (start > len) { | |
start = len; | |
} | |
if (end < 0) { | |
end += len; | |
if (end < 0) | |
end = 0; | |
} else if (end > len) { | |
end = len; | |
} | |
if (end < start) | |
end = start; | |
var newBuf; | |
if (Buffer.TYPED_ARRAY_SUPPORT) { | |
newBuf = this.subarray(start, end); | |
newBuf.__proto__ = Buffer.prototype; | |
} else { | |
var sliceLen = end - start; | |
newBuf = new Buffer(sliceLen, void 0); | |
for (var i = 0; i < sliceLen; ++i) { | |
newBuf[i] = this[i + start]; | |
} | |
} | |
return newBuf; | |
}; | |
function checkOffset(offset, ext, length) { | |
if (offset % 1 !== 0 || offset < 0) | |
throw new RangeError("offset is not uint"); | |
if (offset + ext > length) | |
throw new RangeError("Trying to access beyond buffer length"); | |
} | |
Buffer.prototype.readUIntLE = function readUIntLE(offset, byteLength2, noAssert) { | |
offset = offset | 0; | |
byteLength2 = byteLength2 | 0; | |
if (!noAssert) | |
checkOffset(offset, byteLength2, this.length); | |
var val = this[offset]; | |
var mul = 1; | |
var i = 0; | |
while (++i < byteLength2 && (mul *= 256)) { | |
val += this[offset + i] * mul; | |
} | |
return val; | |
}; | |
Buffer.prototype.readUIntBE = function readUIntBE(offset, byteLength2, noAssert) { | |
offset = offset | 0; | |
byteLength2 = byteLength2 | 0; | |
if (!noAssert) { | |
checkOffset(offset, byteLength2, this.length); | |
} | |
var val = this[offset + --byteLength2]; | |
var mul = 1; | |
while (byteLength2 > 0 && (mul *= 256)) { | |
val += this[offset + --byteLength2] * mul; | |
} | |
return val; | |
}; | |
Buffer.prototype.readUInt8 = function readUInt8(offset, noAssert) { | |
if (!noAssert) | |
checkOffset(offset, 1, this.length); | |
return this[offset]; | |
}; | |
Buffer.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) { | |
if (!noAssert) | |
checkOffset(offset, 2, this.length); | |
return this[offset] | this[offset + 1] << 8; | |
}; | |
Buffer.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) { | |
if (!noAssert) | |
checkOffset(offset, 2, this.length); | |
return this[offset] << 8 | this[offset + 1]; | |
}; | |
Buffer.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) { | |
if (!noAssert) | |
checkOffset(offset, 4, this.length); | |
return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216; | |
}; | |
Buffer.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) { | |
if (!noAssert) | |
checkOffset(offset, 4, this.length); | |
return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]); | |
}; | |
Buffer.prototype.readIntLE = function readIntLE(offset, byteLength2, noAssert) { | |
offset = offset | 0; | |
byteLength2 = byteLength2 | 0; | |
if (!noAssert) | |
checkOffset(offset, byteLength2, this.length); | |
var val = this[offset]; | |
var mul = 1; | |
var i = 0; | |
while (++i < byteLength2 && (mul *= 256)) { | |
val += this[offset + i] * mul; | |
} | |
mul *= 128; | |
if (val >= mul) | |
val -= Math.pow(2, 8 * byteLength2); | |
return val; | |
}; | |
Buffer.prototype.readIntBE = function readIntBE(offset, byteLength2, noAssert) { | |
offset = offset | 0; | |
byteLength2 = byteLength2 | 0; | |
if (!noAssert) | |
checkOffset(offset, byteLength2, this.length); | |
var i = byteLength2; | |
var mul = 1; | |
var val = this[offset + --i]; | |
while (i > 0 && (mul *= 256)) { | |
val += this[offset + --i] * mul; | |
} | |
mul *= 128; | |
if (val >= mul) | |
val -= Math.pow(2, 8 * byteLength2); | |
return val; | |
}; | |
Buffer.prototype.readInt8 = function readInt8(offset, noAssert) { | |
if (!noAssert) | |
checkOffset(offset, 1, this.length); | |
if (!(this[offset] & 128)) | |
return this[offset]; | |
return (255 - this[offset] + 1) * -1; | |
}; | |
Buffer.prototype.readInt16LE = function readInt16LE(offset, noAssert) { | |
if (!noAssert) | |
checkOffset(offset, 2, this.length); | |
var val = this[offset] | this[offset + 1] << 8; | |
return val & 32768 ? val | 4294901760 : val; | |
}; | |
Buffer.prototype.readInt16BE = function readInt16BE(offset, noAssert) { | |
if (!noAssert) | |
checkOffset(offset, 2, this.length); | |
var val = this[offset + 1] | this[offset] << 8; | |
return val & 32768 ? val | 4294901760 : val; | |
}; | |
Buffer.prototype.readInt32LE = function readInt32LE(offset, noAssert) { | |
if (!noAssert) | |
checkOffset(offset, 4, this.length); | |
return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24; | |
}; | |
Buffer.prototype.readInt32BE = function readInt32BE(offset, noAssert) { | |
if (!noAssert) | |
checkOffset(offset, 4, this.length); | |
return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]; | |
}; | |
Buffer.prototype.readFloatLE = function readFloatLE(offset, noAssert) { | |
if (!noAssert) | |
checkOffset(offset, 4, this.length); | |
return read(this, offset, true, 23, 4); | |
}; | |
Buffer.prototype.readFloatBE = function readFloatBE(offset, noAssert) { | |
if (!noAssert) | |
checkOffset(offset, 4, this.length); | |
return read(this, offset, false, 23, 4); | |
}; | |
Buffer.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) { | |
if (!noAssert) | |
checkOffset(offset, 8, this.length); | |
return read(this, offset, true, 52, 8); | |
}; | |
Buffer.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) { | |
if (!noAssert) | |
checkOffset(offset, 8, this.length); | |
return read(this, offset, false, 52, 8); | |
}; | |
function checkInt(buf, value, offset, ext, max, min) { | |
if (!internalIsBuffer(buf)) | |
throw new TypeError('"buffer" argument must be a Buffer instance'); | |
if (value > max || value < min) | |
throw new RangeError('"value" argument is out of bounds'); | |
if (offset + ext > buf.length) | |
throw new RangeError("Index out of range"); | |
} | |
Buffer.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength2, noAssert) { | |
value = +value; | |
offset = offset | 0; | |
byteLength2 = byteLength2 | 0; | |
if (!noAssert) { | |
var maxBytes = Math.pow(2, 8 * byteLength2) - 1; | |
checkInt(this, value, offset, byteLength2, maxBytes, 0); | |
} | |
var mul = 1; | |
var i = 0; | |
this[offset] = value & 255; | |
while (++i < byteLength2 && (mul *= 256)) { | |
this[offset + i] = value / mul & 255; | |
} | |
return offset + byteLength2; | |
}; | |
Buffer.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength2, noAssert) { | |
value = +value; | |
offset = offset | 0; | |
byteLength2 = byteLength2 | 0; | |
if (!noAssert) { | |
var maxBytes = Math.pow(2, 8 * byteLength2) - 1; | |
checkInt(this, value, offset, byteLength2, maxBytes, 0); | |
} | |
var i = byteLength2 - 1; | |
var mul = 1; | |
this[offset + i] = value & 255; | |
while (--i >= 0 && (mul *= 256)) { | |
this[offset + i] = value / mul & 255; | |
} | |
return offset + byteLength2; | |
}; | |
Buffer.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) { | |
value = +value; | |
offset = offset | 0; | |
if (!noAssert) | |
checkInt(this, value, offset, 1, 255, 0); | |
if (!Buffer.TYPED_ARRAY_SUPPORT) | |
value = Math.floor(value); | |
this[offset] = value & 255; | |
return offset + 1; | |
}; | |
function objectWriteUInt16(buf, value, offset, littleEndian) { | |
if (value < 0) | |
value = 65535 + value + 1; | |
for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) { | |
buf[offset + i] = (value & 255 << 8 * (littleEndian ? i : 1 - i)) >>> (littleEndian ? i : 1 - i) * 8; | |
} | |
} | |
Buffer.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) { | |
value = +value; | |
offset = offset | 0; | |
if (!noAssert) | |
checkInt(this, value, offset, 2, 65535, 0); | |
if (Buffer.TYPED_ARRAY_SUPPORT) { | |
this[offset] = value & 255; | |
this[offset + 1] = value >>> 8; | |
} else { | |
objectWriteUInt16(this, value, offset, true); | |
} | |
return offset + 2; | |
}; | |
Buffer.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) { | |
value = +value; | |
offset = offset | 0; | |
if (!noAssert) | |
checkInt(this, value, offset, 2, 65535, 0); | |
if (Buffer.TYPED_ARRAY_SUPPORT) { | |
this[offset] = value >>> 8; | |
this[offset + 1] = value & 255; | |
} else { | |
objectWriteUInt16(this, value, offset, false); | |
} | |
return offset + 2; | |
}; | |
function objectWriteUInt32(buf, value, offset, littleEndian) { | |
if (value < 0) | |
value = 4294967295 + value + 1; | |
for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) { | |
buf[offset + i] = value >>> (littleEndian ? i : 3 - i) * 8 & 255; | |
} | |
} | |
Buffer.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) { | |
value = +value; | |
offset = offset | 0; | |
if (!noAssert) | |
checkInt(this, value, offset, 4, 4294967295, 0); | |
if (Buffer.TYPED_ARRAY_SUPPORT) { | |
this[offset + 3] = value >>> 24; | |
this[offset + 2] = value >>> 16; | |
this[offset + 1] = value >>> 8; | |
this[offset] = value & 255; | |
} else { | |
objectWriteUInt32(this, value, offset, true); | |
} | |
return offset + 4; | |
}; | |
Buffer.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) { | |
value = +value; | |
offset = offset | 0; | |
if (!noAssert) | |
checkInt(this, value, offset, 4, 4294967295, 0); | |
if (Buffer.TYPED_ARRAY_SUPPORT) { | |
this[offset] = value >>> 24; | |
this[offset + 1] = value >>> 16; | |
this[offset + 2] = value >>> 8; | |
this[offset + 3] = value & 255; | |
} else { | |
objectWriteUInt32(this, value, offset, false); | |
} | |
return offset + 4; | |
}; | |
Buffer.prototype.writeIntLE = function writeIntLE(value, offset, byteLength2, noAssert) { | |
value = +value; | |
offset = offset | 0; | |
if (!noAssert) { | |
var limit = Math.pow(2, 8 * byteLength2 - 1); | |
checkInt(this, value, offset, byteLength2, limit - 1, -limit); | |
} | |
var i = 0; | |
var mul = 1; | |
var sub = 0; | |
this[offset] = value & 255; | |
while (++i < byteLength2 && (mul *= 256)) { | |
if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { | |
sub = 1; | |
} | |
this[offset + i] = (value / mul >> 0) - sub & 255; | |
} | |
return offset + byteLength2; | |
}; | |
Buffer.prototype.writeIntBE = function writeIntBE(value, offset, byteLength2, noAssert) { | |
value = +value; | |
offset = offset | 0; | |
if (!noAssert) { | |
var limit = Math.pow(2, 8 * byteLength2 - 1); | |
checkInt(this, value, offset, byteLength2, limit - 1, -limit); | |
} | |
var i = byteLength2 - 1; | |
var mul = 1; | |
var sub = 0; | |
this[offset + i] = value & 255; | |
while (--i >= 0 && (mul *= 256)) { | |
if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { | |
sub = 1; | |
} | |
this[offset + i] = (value / mul >> 0) - sub & 255; | |
} | |
return offset + byteLength2; | |
}; | |
Buffer.prototype.writeInt8 = function writeInt8(value, offset, noAssert) { | |
value = +value; | |
offset = offset | 0; | |
if (!noAssert) | |
checkInt(this, value, offset, 1, 127, -128); | |
if (!Buffer.TYPED_ARRAY_SUPPORT) | |
value = Math.floor(value); | |
if (value < 0) | |
value = 255 + value + 1; | |
this[offset] = value & 255; | |
return offset + 1; | |
}; | |
Buffer.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) { | |
value = +value; | |
offset = offset | 0; | |
if (!noAssert) | |
checkInt(this, value, offset, 2, 32767, -32768); | |
if (Buffer.TYPED_ARRAY_SUPPORT) { | |
this[offset] = value & 255; | |
this[offset + 1] = value >>> 8; | |
} else { | |
objectWriteUInt16(this, value, offset, true); | |
} | |
return offset + 2; | |
}; | |
Buffer.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) { | |
value = +value; | |
offset = offset | 0; | |
if (!noAssert) | |
checkInt(this, value, offset, 2, 32767, -32768); | |
if (Buffer.TYPED_ARRAY_SUPPORT) { | |
this[offset] = value >>> 8; | |
this[offset + 1] = value & 255; | |
} else { | |
objectWriteUInt16(this, value, offset, false); | |
} | |
return offset + 2; | |
}; | |
Buffer.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) { | |
value = +value; | |
offset = offset | 0; | |
if (!noAssert) | |
checkInt(this, value, offset, 4, 2147483647, -2147483648); | |
if (Buffer.TYPED_ARRAY_SUPPORT) { | |
this[offset] = value & 255; | |
this[offset + 1] = value >>> 8; | |
this[offset + 2] = value >>> 16; | |
this[offset + 3] = value >>> 24; | |
} else { | |
objectWriteUInt32(this, value, offset, true); | |
} | |
return offset + 4; | |
}; | |
Buffer.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) { | |
value = +value; | |
offset = offset | 0; | |
if (!noAssert) | |
checkInt(this, value, offset, 4, 2147483647, -2147483648); | |
if (value < 0) | |
value = 4294967295 + value + 1; | |
if (Buffer.TYPED_ARRAY_SUPPORT) { | |
this[offset] = value >>> 24; | |
this[offset + 1] = value >>> 16; | |
this[offset + 2] = value >>> 8; | |
this[offset + 3] = value & 255; | |
} else { | |
objectWriteUInt32(this, value, offset, false); | |
} | |
return offset + 4; | |
}; | |
function checkIEEE754(buf, value, offset, ext, max, min) { | |
if (offset + ext > buf.length) | |
throw new RangeError("Index out of range"); | |
if (offset < 0) | |
throw new RangeError("Index out of range"); | |
} | |
function writeFloat(buf, value, offset, littleEndian, noAssert) { | |
if (!noAssert) { | |
checkIEEE754(buf, value, offset, 4); | |
} | |
write(buf, value, offset, littleEndian, 23, 4); | |
return offset + 4; | |
} | |
Buffer.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) { | |
return writeFloat(this, value, offset, true, noAssert); | |
}; | |
Buffer.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) { | |
return writeFloat(this, value, offset, false, noAssert); | |
}; | |
function writeDouble(buf, value, offset, littleEndian, noAssert) { | |
if (!noAssert) { | |
checkIEEE754(buf, value, offset, 8); | |
} | |
write(buf, value, offset, littleEndian, 52, 8); | |
return offset + 8; | |
} | |
Buffer.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) { | |
return writeDouble(this, value, offset, true, noAssert); | |
}; | |
Buffer.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) { | |
return writeDouble(this, value, offset, false, noAssert); | |
}; | |
Buffer.prototype.copy = function copy(target, targetStart, start, end) { | |
if (!start) | |
start = 0; | |
if (!end && end !== 0) | |
end = this.length; | |
if (targetStart >= target.length) | |
targetStart = target.length; | |
if (!targetStart) | |
targetStart = 0; | |
if (end > 0 && end < start) | |
end = start; | |
if (end === start) | |
return 0; | |
if (target.length === 0 || this.length === 0) | |
return 0; | |
if (targetStart < 0) { | |
throw new RangeError("targetStart out of bounds"); | |
} | |
if (start < 0 || start >= this.length) | |
throw new RangeError("sourceStart out of bounds"); | |
if (end < 0) | |
throw new RangeError("sourceEnd out of bounds"); | |
if (end > this.length) | |
end = this.length; | |
if (target.length - targetStart < end - start) { | |
end = target.length - targetStart + start; | |
} | |
var len = end - start; | |
var i; | |
if (this === target && start < targetStart && targetStart < end) { | |
for (i = len - 1; i >= 0; --i) { | |
target[i + targetStart] = this[i + start]; | |
} | |
} else if (len < 1e3 || !Buffer.TYPED_ARRAY_SUPPORT) { | |
for (i = 0; i < len; ++i) { | |
target[i + targetStart] = this[i + start]; | |
} | |
} else { | |
Uint8Array.prototype.set.call( | |
target, | |
this.subarray(start, start + len), | |
targetStart | |
); | |
} | |
return len; | |
}; | |
Buffer.prototype.fill = function fill(val, start, end, encoding) { | |
if (typeof val === "string") { | |
if (typeof start === "string") { | |
encoding = start; | |
start = 0; | |
end = this.length; | |
} else if (typeof end === "string") { | |
encoding = end; | |
end = this.length; | |
} | |
if (val.length === 1) { | |
var code = val.charCodeAt(0); | |
if (code < 256) { | |
val = code; | |
} | |
} | |
if (encoding !== void 0 && typeof encoding !== "string") { | |
throw new TypeError("encoding must be a string"); | |
} | |
if (typeof encoding === "string" && !Buffer.isEncoding(encoding)) { | |
throw new TypeError("Unknown encoding: " + encoding); | |
} | |
} else if (typeof val === "number") { | |
val = val & 255; | |
} | |
if (start < 0 || this.length < start || this.length < end) { | |
throw new RangeError("Out of range index"); | |
} | |
if (end <= start) { | |
return this; | |
} | |
start = start >>> 0; | |
end = end === void 0 ? this.length : end >>> 0; | |
if (!val) | |
val = 0; | |
var i; | |
if (typeof val === "number") { | |
for (i = start; i < end; ++i) { | |
this[i] = val; | |
} | |
} else { | |
var bytes = internalIsBuffer(val) ? val : utf8ToBytes(new Buffer(val, encoding).toString()); | |
var len = bytes.length; | |
for (i = 0; i < end - start; ++i) { | |
this[i + start] = bytes[i % len]; | |
} | |
} | |
return this; | |
}; | |
var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g; | |
function base64clean(str) { | |
str = stringtrim(str).replace(INVALID_BASE64_RE, ""); | |
if (str.length < 2) | |
return ""; | |
while (str.length % 4 !== 0) { | |
str = str + "="; | |
} | |
return str; | |
} | |
function stringtrim(str) { | |
if (str.trim) | |
return str.trim(); | |
return str.replace(/^\s+|\s+$/g, ""); | |
} | |
function toHex(n) { | |
if (n < 16) | |
return "0" + n.toString(16); | |
return n.toString(16); | |
} | |
function utf8ToBytes(string, units) { | |
units = units || Infinity; | |
var codePoint; | |
var length = string.length; | |
var leadSurrogate = null; | |
var bytes = []; | |
for (var i = 0; i < length; ++i) { | |
codePoint = string.charCodeAt(i); | |
if (codePoint > 55295 && codePoint < 57344) { | |
if (!leadSurrogate) { | |
if (codePoint > 56319) { | |
if ((units -= 3) > -1) | |
bytes.push(239, 191, 189); | |
continue; | |
} else if (i + 1 === length) { | |
if ((units -= 3) > -1) | |
bytes.push(239, 191, 189); | |
continue; | |
} | |
leadSurrogate = codePoint; | |
continue; | |
} | |
if (codePoint < 56320) { | |
if ((units -= 3) > -1) | |
bytes.push(239, 191, 189); | |
leadSurrogate = codePoint; | |
continue; | |
} | |
codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536; | |
} else if (leadSurrogate) { | |
if ((units -= 3) > -1) | |
bytes.push(239, 191, 189); | |
} | |
leadSurrogate = null; | |
if (codePoint < 128) { | |
if ((units -= 1) < 0) | |
break; | |
bytes.push(codePoint); | |
} else if (codePoint < 2048) { | |
if ((units -= 2) < 0) | |
break; | |
bytes.push( | |
codePoint >> 6 | 192, | |
codePoint & 63 | 128 | |
); | |
} else if (codePoint < 65536) { | |
if ((units -= 3) < 0) | |
break; | |
bytes.push( | |
codePoint >> 12 | 224, | |
codePoint >> 6 & 63 | 128, | |
codePoint & 63 | 128 | |
); | |
} else if (codePoint < 1114112) { | |
if ((units -= 4) < 0) | |
break; | |
bytes.push( | |
codePoint >> 18 | 240, | |
codePoint >> 12 & 63 | 128, | |
codePoint >> 6 & 63 | 128, | |
codePoint & 63 | 128 | |
); | |
} else { | |
throw new Error("Invalid code point"); | |
} | |
} | |
return bytes; | |
} | |
function asciiToBytes(str) { | |
var byteArray = []; | |
for (var i = 0; i < str.length; ++i) { | |
byteArray.push(str.charCodeAt(i) & 255); | |
} | |
return byteArray; | |
} | |
function utf16leToBytes(str, units) { | |
var c, hi, lo; | |
var byteArray = []; | |
for (var i = 0; i < str.length; ++i) { | |
if ((units -= 2) < 0) | |
break; | |
c = str.charCodeAt(i); | |
hi = c >> 8; | |
lo = c % 256; | |
byteArray.push(lo); | |
byteArray.push(hi); | |
} | |
return byteArray; | |
} | |
function base64ToBytes(str) { | |
return toByteArray(base64clean(str)); | |
} | |
function blitBuffer(src, dst, offset, length) { | |
for (var i = 0; i < length; ++i) { | |
if (i + offset >= dst.length || i >= src.length) | |
break; | |
dst[i + offset] = src[i]; | |
} | |
return i; | |
} | |
function isnan(val) { | |
return val !== val; | |
} | |
function isBuffer(obj) { | |
return obj != null && (!!obj._isBuffer || isFastBuffer(obj) || isSlowBuffer(obj)); | |
} | |
function isFastBuffer(obj) { | |
return !!obj.constructor && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj); | |
} | |
function isSlowBuffer(obj) { | |
return typeof obj.readFloatLE === "function" && typeof obj.slice === "function" && isFastBuffer(obj.slice(0, 0)); | |
} | |
class CsvError extends Error { | |
constructor(code, message, options, ...contexts) { | |
if (Array.isArray(message)) | |
message = message.join(" ").trim(); | |
super(message); | |
if (Error.captureStackTrace !== void 0) { | |
Error.captureStackTrace(this, CsvError); | |
} | |
this.code = code; | |
for (const context of contexts) { | |
for (const key in context) { | |
const value = context[key]; | |
this[key] = isBuffer(value) ? value.toString(options.encoding) : value == null ? value : JSON.parse(JSON.stringify(value)); | |
} | |
} | |
} | |
} | |
const is_object = function(obj) { | |
return typeof obj === "object" && obj !== null && !Array.isArray(obj); | |
}; | |
const normalize_columns_array = function(columns) { | |
const normalizedColumns = []; | |
for (let i = 0, l = columns.length; i < l; i++) { | |
const column = columns[i]; | |
if (column === void 0 || column === null || column === false) { | |
normalizedColumns[i] = { disabled: true }; | |
} else if (typeof column === "string") { | |
normalizedColumns[i] = { name: column }; | |
} else if (is_object(column)) { | |
if (typeof column.name !== "string") { | |
throw new CsvError("CSV_OPTION_COLUMNS_MISSING_NAME", [ | |
"Option columns missing name:", | |
`property "name" is required at position ${i}`, | |
"when column is an object literal" | |
]); | |
} | |
normalizedColumns[i] = column; | |
} else { | |
throw new CsvError("CSV_INVALID_COLUMN_DEFINITION", [ | |
"Invalid column definition:", | |
"expect a string or a literal object,", | |
`got ${JSON.stringify(column)} at position ${i}` | |
]); | |
} | |
} | |
return normalizedColumns; | |
}; | |
class ResizeableBuffer { | |
constructor(size2 = 100) { | |
this.size = size2; | |
this.length = 0; | |
this.buf = Buffer.allocUnsafe(size2); | |
} | |
prepend(val) { | |
if (isBuffer(val)) { | |
const length = this.length + val.length; | |
if (length >= this.size) { | |
this.resize(); | |
if (length >= this.size) { | |
throw Error("INVALID_BUFFER_STATE"); | |
} | |
} | |
const buf = this.buf; | |
this.buf = Buffer.allocUnsafe(this.size); | |
val.copy(this.buf, 0); | |
buf.copy(this.buf, val.length); | |
this.length += val.length; | |
} else { | |
const length = this.length++; | |
if (length === this.size) { | |
this.resize(); | |
} | |
const buf = this.clone(); | |
this.buf[0] = val; | |
buf.copy(this.buf, 1, 0, length); | |
} | |
} | |
append(val) { | |
const length = this.length++; | |
if (length === this.size) { | |
this.resize(); | |
} | |
this.buf[length] = val; | |
} | |
clone() { | |
return Buffer.from(this.buf.slice(0, this.length)); | |
} | |
resize() { | |
const length = this.length; | |
this.size = this.size * 2; | |
const buf = Buffer.allocUnsafe(this.size); | |
this.buf.copy(buf, 0, 0, length); | |
this.buf = buf; | |
} | |
toString(encoding) { | |
if (encoding) { | |
return this.buf.slice(0, this.length).toString(encoding); | |
} else { | |
return Uint8Array.prototype.slice.call(this.buf.slice(0, this.length)); | |
} | |
} | |
toJSON() { | |
return this.toString("utf8"); | |
} | |
reset() { | |
this.length = 0; | |
} | |
} | |
const np = 12; | |
const cr$1 = 13; | |
const nl$1 = 10; | |
const space = 32; | |
const tab = 9; | |
const init_state = function(options) { | |
return { | |
bomSkipped: false, | |
bufBytesStart: 0, | |
castField: options.cast_function, | |
commenting: false, | |
// Current error encountered by a record | |
error: void 0, | |
enabled: options.from_line === 1, | |
escaping: false, | |
escapeIsQuote: isBuffer(options.escape) && isBuffer(options.quote) && Buffer.compare(options.escape, options.quote) === 0, | |
// columns can be `false`, `true`, `Array` | |
expectedRecordLength: Array.isArray(options.columns) ? options.columns.length : void 0, | |
field: new ResizeableBuffer(20), | |
firstLineToHeaders: options.cast_first_line_to_header, | |
needMoreDataSize: Math.max( | |
// Skip if the remaining buffer smaller than comment | |
options.comment !== null ? options.comment.length : 0, | |
...options.delimiter.map((delimiter) => delimiter.length), | |
// Skip if the remaining buffer can be escape sequence | |
options.quote !== null ? options.quote.length : 0 | |
), | |
previousBuf: void 0, | |
quoting: false, | |
stop: false, | |
rawBuffer: new ResizeableBuffer(100), | |
record: [], | |
recordHasError: false, | |
record_length: 0, | |
recordDelimiterMaxLength: options.record_delimiter.length === 0 ? 0 : Math.max(...options.record_delimiter.map((v) => v.length)), | |
trimChars: [Buffer.from(" ", options.encoding)[0], Buffer.from(" ", options.encoding)[0]], | |
wasQuoting: false, | |
wasRowDelimiter: false, | |
timchars: [ | |
Buffer.from(Buffer.from([cr$1], "utf8").toString(), options.encoding), | |
Buffer.from(Buffer.from([nl$1], "utf8").toString(), options.encoding), | |
Buffer.from(Buffer.from([np], "utf8").toString(), options.encoding), | |
Buffer.from(Buffer.from([space], "utf8").toString(), options.encoding), | |
Buffer.from(Buffer.from([tab], "utf8").toString(), options.encoding) | |
] | |
}; | |
}; | |
const underscore = function(str) { | |
return str.replace(/([A-Z])/g, function(_, match) { | |
return "_" + match.toLowerCase(); | |
}); | |
}; | |
const normalize_options = function(opts) { | |
const options = {}; | |
for (const opt in opts) { | |
options[underscore(opt)] = opts[opt]; | |
} | |
if (options.encoding === void 0 || options.encoding === true) { | |
options.encoding = "utf8"; | |
} else if (options.encoding === null || options.encoding === false) { | |
options.encoding = null; | |
} else if (typeof options.encoding !== "string" && options.encoding !== null) { | |
throw new CsvError("CSV_INVALID_OPTION_ENCODING", [ | |
"Invalid option encoding:", | |
"encoding must be a string or null to return a buffer,", | |
`got ${JSON.stringify(options.encoding)}` | |
], options); | |
} | |
if (options.bom === void 0 || options.bom === null || options.bom === false) { | |
options.bom = false; | |
} else if (options.bom !== true) { | |
throw new CsvError("CSV_INVALID_OPTION_BOM", [ | |
"Invalid option bom:", | |
"bom must be true,", | |
`got ${JSON.stringify(options.bom)}` | |
], options); | |
} | |
options.cast_function = null; | |
if (options.cast === void 0 || options.cast === null || options.cast === false || options.cast === "") { | |
options.cast = void 0; | |
} else if (typeof options.cast === "function") { | |
options.cast_function = options.cast; | |
options.cast = true; | |
} else if (options.cast !== true) { | |
throw new CsvError("CSV_INVALID_OPTION_CAST", [ | |
"Invalid option cast:", | |
"cast must be true or a function,", | |
`got ${JSON.stringify(options.cast)}` | |
], options); | |
} | |
if (options.cast_date === void 0 || options.cast_date === null || options.cast_date === false || options.cast_date === "") { | |
options.cast_date = false; | |
} else if (options.cast_date === true) { | |
options.cast_date = function(value) { | |
const date = Date.parse(value); | |
return !isNaN(date) ? new Date(date) : value; | |
}; | |
} else if (typeof options.cast_date !== "function") { | |
throw new CsvError("CSV_INVALID_OPTION_CAST_DATE", [ | |
"Invalid option cast_date:", | |
"cast_date must be true or a function,", | |
`got ${JSON.stringify(options.cast_date)}` | |
], options); | |
} | |
options.cast_first_line_to_header = null; | |
if (options.columns === true) { | |
options.cast_first_line_to_header = void 0; | |
} else if (typeof options.columns === "function") { | |
options.cast_first_line_to_header = options.columns; | |
options.columns = true; | |
} else if (Array.isArray(options.columns)) { | |
options.columns = normalize_columns_array(options.columns); | |
} else if (options.columns === void 0 || options.columns === null || options.columns === false) { | |
options.columns = false; | |
} else { | |
throw new CsvError("CSV_INVALID_OPTION_COLUMNS", [ | |
"Invalid option columns:", | |
"expect an array, a function or true,", | |
`got ${JSON.stringify(options.columns)}` | |
], options); | |
} | |
if (options.group_columns_by_name === void 0 || options.group_columns_by_name === null || options.group_columns_by_name === false) { | |
options.group_columns_by_name = false; | |
} else if (options.group_columns_by_name !== true) { | |
throw new CsvError("CSV_INVALID_OPTION_GROUP_COLUMNS_BY_NAME", [ | |
"Invalid option group_columns_by_name:", | |
"expect an boolean,", | |
`got ${JSON.stringify(options.group_columns_by_name)}` | |
], options); | |
} else if (options.columns === false) { | |
throw new CsvError("CSV_INVALID_OPTION_GROUP_COLUMNS_BY_NAME", [ | |
"Invalid option group_columns_by_name:", | |
"the `columns` mode must be activated." | |
], options); | |
} | |
if (options.comment === void 0 || options.comment === null || options.comment === false || options.comment === "") { | |
options.comment = null; | |
} else { | |
if (typeof options.comment === "string") { | |
options.comment = Buffer.from(options.comment, options.encoding); | |
} | |
if (!isBuffer(options.comment)) { | |
throw new CsvError("CSV_INVALID_OPTION_COMMENT", [ | |
"Invalid option comment:", | |
"comment must be a buffer or a string,", | |
`got ${JSON.stringify(options.comment)}` | |
], options); | |
} | |
} | |
if (options.comment_no_infix === void 0 || options.comment_no_infix === null || options.comment_no_infix === false) { | |
options.comment_no_infix = false; | |
} else if (options.comment_no_infix !== true) { | |
throw new CsvError("CSV_INVALID_OPTION_COMMENT", [ | |
"Invalid option comment_no_infix:", | |
"value must be a boolean,", | |
`got ${JSON.stringify(options.comment_no_infix)}` | |
], options); | |
} | |
const delimiter_json = JSON.stringify(options.delimiter); | |
if (!Array.isArray(options.delimiter)) | |
options.delimiter = [options.delimiter]; | |
if (options.delimiter.length === 0) { | |
throw new CsvError("CSV_INVALID_OPTION_DELIMITER", [ | |
"Invalid option delimiter:", | |
"delimiter must be a non empty string or buffer or array of string|buffer,", | |
`got ${delimiter_json}` | |
], options); | |
} | |
options.delimiter = options.delimiter.map(function(delimiter) { | |
if (delimiter === void 0 || delimiter === null || delimiter === false) { | |
return Buffer.from(",", options.encoding); | |
} | |
if (typeof delimiter === "string") { | |
delimiter = Buffer.from(delimiter, options.encoding); | |
} | |
if (!isBuffer(delimiter) || delimiter.length === 0) { | |
throw new CsvError("CSV_INVALID_OPTION_DELIMITER", [ | |
"Invalid option delimiter:", | |
"delimiter must be a non empty string or buffer or array of string|buffer,", | |
`got ${delimiter_json}` | |
], options); | |
} | |
return delimiter; | |
}); | |
if (options.escape === void 0 || options.escape === true) { | |
options.escape = Buffer.from('"', options.encoding); | |
} else if (typeof options.escape === "string") { | |
options.escape = Buffer.from(options.escape, options.encoding); | |
} else if (options.escape === null || options.escape === false) { | |
options.escape = null; | |
} | |
if (options.escape !== null) { | |
if (!isBuffer(options.escape)) { | |
throw new Error(`Invalid Option: escape must be a buffer, a string or a boolean, got ${JSON.stringify(options.escape)}`); | |
} | |
} | |
if (options.from === void 0 || options.from === null) { | |
options.from = 1; | |
} else { | |
if (typeof options.from === "string" && /\d+/.test(options.from)) { | |
options.from = parseInt(options.from); | |
} | |
if (Number.isInteger(options.from)) { | |
if (options.from < 0) { | |
throw new Error(`Invalid Option: from must be a positive integer, got ${JSON.stringify(opts.from)}`); | |
} | |
} else { | |
throw new Error(`Invalid Option: from must be an integer, got ${JSON.stringify(options.from)}`); | |
} | |
} | |
if (options.from_line === void 0 || options.from_line === null) { | |
options.from_line = 1; | |
} else { | |
if (typeof options.from_line === "string" && /\d+/.test(options.from_line)) { | |
options.from_line = parseInt(options.from_line); | |
} | |
if (Number.isInteger(options.from_line)) { | |
if (options.from_line <= 0) { | |
throw new Error(`Invalid Option: from_line must be a positive integer greater than 0, got ${JSON.stringify(opts.from_line)}`); | |
} | |
} else { | |
throw new Error(`Invalid Option: from_line must be an integer, got ${JSON.stringify(opts.from_line)}`); | |
} | |
} | |
if (options.ignore_last_delimiters === void 0 || options.ignore_last_delimiters === null) { | |
options.ignore_last_delimiters = false; | |
} else if (typeof options.ignore_last_delimiters === "number") { | |
options.ignore_last_delimiters = Math.floor(options.ignore_last_delimiters); | |
if (options.ignore_last_delimiters === 0) { | |
options.ignore_last_delimiters = false; | |
} | |
} else if (typeof options.ignore_last_delimiters !== "boolean") { | |
throw new CsvError("CSV_INVALID_OPTION_IGNORE_LAST_DELIMITERS", [ | |
"Invalid option `ignore_last_delimiters`:", | |
"the value must be a boolean value or an integer,", | |
`got ${JSON.stringify(options.ignore_last_delimiters)}` | |
], options); | |
} | |
if (options.ignore_last_delimiters === true && options.columns === false) { | |
throw new CsvError("CSV_IGNORE_LAST_DELIMITERS_REQUIRES_COLUMNS", [ | |
"The option `ignore_last_delimiters`", | |
"requires the activation of the `columns` option" | |
], options); | |
} | |
if (options.info === void 0 || options.info === null || options.info === false) { | |
options.info = false; | |
} else if (options.info !== true) { | |
throw new Error(`Invalid Option: info must be true, got ${JSON.stringify(options.info)}`); | |
} | |
if (options.max_record_size === void 0 || options.max_record_size === null || options.max_record_size === false) { | |
options.max_record_size = 0; | |
} else if (Number.isInteger(options.max_record_size) && options.max_record_size >= 0) | |
; | |
else if (typeof options.max_record_size === "string" && /\d+/.test(options.max_record_size)) { | |
options.max_record_size = parseInt(options.max_record_size); | |
} else { | |
throw new Error(`Invalid Option: max_record_size must be a positive integer, got ${JSON.stringify(options.max_record_size)}`); | |
} | |
if (options.objname === void 0 || options.objname === null || options.objname === false) { | |
options.objname = void 0; | |
} else if (isBuffer(options.objname)) { | |
if (options.objname.length === 0) { | |
throw new Error(`Invalid Option: objname must be a non empty buffer`); | |
} | |
if (options.encoding === null) | |
; | |
else { | |
options.objname = options.objname.toString(options.encoding); | |
} | |
} else if (typeof options.objname === "string") { | |
if (options.objname.length === 0) { | |
throw new Error(`Invalid Option: objname must be a non empty string`); | |
} | |
} else if (typeof options.objname === "number") | |
; | |
else { | |
throw new Error(`Invalid Option: objname must be a string or a buffer, got ${options.objname}`); | |
} | |
if (options.objname !== void 0) { | |
if (typeof options.objname === "number") { | |
if (options.columns !== false) { | |
throw Error("Invalid Option: objname index cannot be combined with columns or be defined as a field"); | |
} | |
} else { | |
if (options.columns === false) { | |
throw Error("Invalid Option: objname field must be combined with columns or be defined as an index"); | |
} | |
} | |
} | |
if (options.on_record === void 0 || options.on_record === null) { | |
options.on_record = void 0; | |
} else if (typeof options.on_record !== "function") { | |
throw new CsvError("CSV_INVALID_OPTION_ON_RECORD", [ | |
"Invalid option `on_record`:", | |
"expect a function,", | |
`got ${JSON.stringify(options.on_record)}` | |
], options); | |
} | |
if (options.quote === null || options.quote === false || options.quote === "") { | |
options.quote = null; | |
} else { | |
if (options.quote === void 0 || options.quote === true) { | |
options.quote = Buffer.from('"', options.encoding); | |
} else if (typeof options.quote === "string") { | |
options.quote = Buffer.from(options.quote, options.encoding); | |
} | |
if (!isBuffer(options.quote)) { | |
throw new Error(`Invalid Option: quote must be a buffer or a string, got ${JSON.stringify(options.quote)}`); | |
} | |
} | |
if (options.raw === void 0 || options.raw === null || options.raw === false) { | |
options.raw = false; | |
} else if (options.raw !== true) { | |
throw new Error(`Invalid Option: raw must be true, got ${JSON.stringify(options.raw)}`); | |
} | |
if (options.record_delimiter === void 0) { | |
options.record_delimiter = []; | |
} else if (typeof options.record_delimiter === "string" || isBuffer(options.record_delimiter)) { | |
if (options.record_delimiter.length === 0) { | |
throw new CsvError("CSV_INVALID_OPTION_RECORD_DELIMITER", [ | |
"Invalid option `record_delimiter`:", | |
"value must be a non empty string or buffer,", | |
`got ${JSON.stringify(options.record_delimiter)}` | |
], options); | |
} | |
options.record_delimiter = [options.record_delimiter]; | |
} else if (!Array.isArray(options.record_delimiter)) { | |
throw new CsvError("CSV_INVALID_OPTION_RECORD_DELIMITER", [ | |
"Invalid option `record_delimiter`:", | |
"value must be a string, a buffer or array of string|buffer,", | |
`got ${JSON.stringify(options.record_delimiter)}` | |
], options); | |
} | |
options.record_delimiter = options.record_delimiter.map(function(rd, i) { | |
if (typeof rd !== "string" && !isBuffer(rd)) { | |
throw new CsvError("CSV_INVALID_OPTION_RECORD_DELIMITER", [ | |
"Invalid option `record_delimiter`:", | |
"value must be a string, a buffer or array of string|buffer", | |
`at index ${i},`, | |
`got ${JSON.stringify(rd)}` | |
], options); | |
} else if (rd.length === 0) { | |
throw new CsvError("CSV_INVALID_OPTION_RECORD_DELIMITER", [ | |
"Invalid option `record_delimiter`:", | |
"value must be a non empty string or buffer", | |
`at index ${i},`, | |
`got ${JSON.stringify(rd)}` | |
], options); | |
} | |
if (typeof rd === "string") { | |
rd = Buffer.from(rd, options.encoding); | |
} | |
return rd; | |
}); | |
if (typeof options.relax_column_count === "boolean") | |
; | |
else if (options.relax_column_count === void 0 || options.relax_column_count === null) { | |
options.relax_column_count = false; | |
} else { | |
throw new Error(`Invalid Option: relax_column_count must be a boolean, got ${JSON.stringify(options.relax_column_count)}`); | |
} | |
if (typeof options.relax_column_count_less === "boolean") | |
; | |
else if (options.relax_column_count_less === void 0 || options.relax_column_count_less === null) { | |
options.relax_column_count_less = false; | |
} else { | |
throw new Error(`Invalid Option: relax_column_count_less must be a boolean, got ${JSON.stringify(options.relax_column_count_less)}`); | |
} | |
if (typeof options.relax_column_count_more === "boolean") | |
; | |
else if (options.relax_column_count_more === void 0 || options.relax_column_count_more === null) { | |
options.relax_column_count_more = false; | |
} else { | |
throw new Error(`Invalid Option: relax_column_count_more must be a boolean, got ${JSON.stringify(options.relax_column_count_more)}`); | |
} | |
if (typeof options.relax_quotes === "boolean") | |
; | |
else if (options.relax_quotes === void 0 || options.relax_quotes === null) { | |
options.relax_quotes = false; | |
} else { | |
throw new Error(`Invalid Option: relax_quotes must be a boolean, got ${JSON.stringify(options.relax_quotes)}`); | |
} | |
if (typeof options.skip_empty_lines === "boolean") | |
; | |
else if (options.skip_empty_lines === void 0 || options.skip_empty_lines === null) { | |
options.skip_empty_lines = false; | |
} else { | |
throw new Error(`Invalid Option: skip_empty_lines must be a boolean, got ${JSON.stringify(options.skip_empty_lines)}`); | |
} | |
if (typeof options.skip_records_with_empty_values === "boolean") | |
; | |
else if (options.skip_records_with_empty_values === void 0 || options.skip_records_with_empty_values === null) { | |
options.skip_records_with_empty_values = false; | |
} else { | |
throw new Error(`Invalid Option: skip_records_with_empty_values must be a boolean, got ${JSON.stringify(options.skip_records_with_empty_values)}`); | |
} | |
if (typeof options.skip_records_with_error === "boolean") | |
; | |
else if (options.skip_records_with_error === void 0 || options.skip_records_with_error === null) { | |
options.skip_records_with_error = false; | |
} else { | |
throw new Error(`Invalid Option: skip_records_with_error must be a boolean, got ${JSON.stringify(options.skip_records_with_error)}`); | |
} | |
if (options.rtrim === void 0 || options.rtrim === null || options.rtrim === false) { | |
options.rtrim = false; | |
} else if (options.rtrim !== true) { | |
throw new Error(`Invalid Option: rtrim must be a boolean, got ${JSON.stringify(options.rtrim)}`); | |
} | |
if (options.ltrim === void 0 || options.ltrim === null || options.ltrim === false) { | |
options.ltrim = false; | |
} else if (options.ltrim !== true) { | |
throw new Error(`Invalid Option: ltrim must be a boolean, got ${JSON.stringify(options.ltrim)}`); | |
} | |
if (options.trim === void 0 || options.trim === null || options.trim === false) { | |
options.trim = false; | |
} else if (options.trim !== true) { | |
throw new Error(`Invalid Option: trim must be a boolean, got ${JSON.stringify(options.trim)}`); | |
} | |
if (options.trim === true && opts.ltrim !== false) { | |
options.ltrim = true; | |
} else if (options.ltrim !== true) { | |
options.ltrim = false; | |
} | |
if (options.trim === true && opts.rtrim !== false) { | |
options.rtrim = true; | |
} else if (options.rtrim !== true) { | |
options.rtrim = false; | |
} | |
if (options.to === void 0 || options.to === null) { | |
options.to = -1; | |
} else { | |
if (typeof options.to === "string" && /\d+/.test(options.to)) { | |
options.to = parseInt(options.to); | |
} | |
if (Number.isInteger(options.to)) { | |
if (options.to <= 0) { | |
throw new Error(`Invalid Option: to must be a positive integer greater than 0, got ${JSON.stringify(opts.to)}`); | |
} | |
} else { | |
throw new Error(`Invalid Option: to must be an integer, got ${JSON.stringify(opts.to)}`); | |
} | |
} | |
if (options.to_line === void 0 || options.to_line === null) { | |
options.to_line = -1; | |
} else { | |
if (typeof options.to_line === "string" && /\d+/.test(options.to_line)) { | |
options.to_line = parseInt(options.to_line); | |
} | |
if (Number.isInteger(options.to_line)) { | |
if (options.to_line <= 0) { | |
throw new Error(`Invalid Option: to_line must be a positive integer greater than 0, got ${JSON.stringify(opts.to_line)}`); | |
} | |
} else { | |
throw new Error(`Invalid Option: to_line must be an integer, got ${JSON.stringify(opts.to_line)}`); | |
} | |
} | |
return options; | |
}; | |
const isRecordEmpty = function(record) { | |
return record.every((field) => field == null || field.toString && field.toString().trim() === ""); | |
}; | |
const cr = 13; | |
const nl = 10; | |
const boms = { | |
// Note, the following are equals: | |
// Buffer.from("\ufeff") | |
// Buffer.from([239, 187, 191]) | |
// Buffer.from('EFBBBF', 'hex') | |
"utf8": Buffer.from([239, 187, 191]), | |
// Note, the following are equals: | |
// Buffer.from "\ufeff", 'utf16le | |
// Buffer.from([255, 254]) | |
"utf16le": Buffer.from([255, 254]) | |
}; | |
const transform = function(original_options = {}) { | |
const info = { | |
bytes: 0, | |
comment_lines: 0, | |
empty_lines: 0, | |
invalid_field_length: 0, | |
lines: 1, | |
records: 0 | |
}; | |
const options = normalize_options(original_options); | |
return { | |
info, | |
original_options, | |
options, | |
state: init_state(options), | |
__needMoreData: function(i, bufLen, end) { | |
if (end) | |
return false; | |
const { encoding, escape, quote } = this.options; | |
const { quoting, needMoreDataSize, recordDelimiterMaxLength } = this.state; | |
const numOfCharLeft = bufLen - i - 1; | |
const requiredLength = Math.max( | |
needMoreDataSize, | |
// Skip if the remaining buffer smaller than record delimiter | |
// If "record_delimiter" is yet to be discovered: | |
// 1. It is equals to `[]` and "recordDelimiterMaxLength" equals `0` | |
// 2. We set the length to windows line ending in the current encoding | |
// Note, that encoding is known from user or bom discovery at that point | |
// recordDelimiterMaxLength, | |
recordDelimiterMaxLength === 0 ? Buffer.from("\r\n", encoding).length : recordDelimiterMaxLength, | |
// Skip if remaining buffer can be an escaped quote | |
quoting ? (escape === null ? 0 : escape.length) + quote.length : 0, | |
// Skip if remaining buffer can be record delimiter following the closing quote | |
quoting ? quote.length + recordDelimiterMaxLength : 0 | |
); | |
return numOfCharLeft < requiredLength; | |
}, | |
// Central parser implementation | |
parse: function(nextBuf, end, push, close) { | |
const { bom, comment_no_infix, encoding, from_line, ltrim, max_record_size, raw, relax_quotes, rtrim, skip_empty_lines, to, to_line } = this.options; | |
let { comment, escape, quote, record_delimiter } = this.options; | |
const { bomSkipped, previousBuf, rawBuffer, escapeIsQuote } = this.state; | |
let buf; | |
if (previousBuf === void 0) { | |
if (nextBuf === void 0) { | |
close(); | |
return; | |
} else { | |
buf = nextBuf; | |
} | |
} else if (previousBuf !== void 0 && nextBuf === void 0) { | |
buf = previousBuf; | |
} else { | |
buf = Buffer.concat([previousBuf, nextBuf]); | |
} | |
if (bomSkipped === false) { | |
if (bom === false) { | |
this.state.bomSkipped = true; | |
} else if (buf.length < 3) { | |
if (end === false) { | |
this.state.previousBuf = buf; | |
return; | |
} | |
} else { | |
for (const encoding2 in boms) { | |
if (boms[encoding2].compare(buf, 0, boms[encoding2].length) === 0) { | |
const bomLength = boms[encoding2].length; | |
this.state.bufBytesStart += bomLength; | |
buf = buf.slice(bomLength); | |
this.options = normalize_options({ ...this.original_options, encoding: encoding2 }); | |
({ comment, escape, quote } = this.options); | |
break; | |
} | |
} | |
this.state.bomSkipped = true; | |
} | |
} | |
const bufLen = buf.length; | |
let pos; | |
for (pos = 0; pos < bufLen; pos++) { | |
if (this.__needMoreData(pos, bufLen, end)) { | |
break; | |
} | |
if (this.state.wasRowDelimiter === true) { | |
this.info.lines++; | |
this.state.wasRowDelimiter = false; | |
} | |
if (to_line !== -1 && this.info.lines > to_line) { | |
this.state.stop = true; | |
close(); | |
return; | |
} | |
if (this.state.quoting === false && record_delimiter.length === 0) { | |
const record_delimiterCount = this.__autoDiscoverRecordDelimiter(buf, pos); | |
if (record_delimiterCount) { | |
record_delimiter = this.options.record_delimiter; | |
} | |
} | |
const chr = buf[pos]; | |
if (raw === true) { | |
rawBuffer.append(chr); | |
} | |
if ((chr === cr || chr === nl) && this.state.wasRowDelimiter === false) { | |
this.state.wasRowDelimiter = true; | |
} | |
if (this.state.escaping === true) { | |
this.state.escaping = false; | |
} else { | |
if (escape !== null && this.state.quoting === true && this.__isEscape(buf, pos, chr) && pos + escape.length < bufLen) { | |
if (escapeIsQuote) { | |
if (this.__isQuote(buf, pos + escape.length)) { | |
this.state.escaping = true; | |
pos += escape.length - 1; | |
continue; | |
} | |
} else { | |
this.state.escaping = true; | |
pos += escape.length - 1; | |
continue; | |
} | |
} | |
if (this.state.commenting === false && this.__isQuote(buf, pos)) { | |
if (this.state.quoting === true) { | |
const nextChr = buf[pos + quote.length]; | |
const isNextChrTrimable = rtrim && this.__isCharTrimable(buf, pos + quote.length); | |
const isNextChrComment = comment !== null && this.__compareBytes(comment, buf, pos + quote.length, nextChr); | |
const isNextChrDelimiter = this.__isDelimiter(buf, pos + quote.length, nextChr); | |
const isNextChrRecordDelimiter = record_delimiter.length === 0 ? this.__autoDiscoverRecordDelimiter(buf, pos + quote.length) : this.__isRecordDelimiter(nextChr, buf, pos + quote.length); | |
if (escape !== null && this.__isEscape(buf, pos, chr) && this.__isQuote(buf, pos + escape.length)) { | |
pos += escape.length - 1; | |
} else if (!nextChr || isNextChrDelimiter || isNextChrRecordDelimiter || isNextChrComment || isNextChrTrimable) { | |
this.state.quoting = false; | |
this.state.wasQuoting = true; | |
pos += quote.length - 1; | |
continue; | |
} else if (relax_quotes === false) { | |
const err = this.__error( | |
new CsvError("CSV_INVALID_CLOSING_QUOTE", [ | |
"Invalid Closing Quote:", | |
`got "${String.fromCharCode(nextChr)}"`, | |
`at line ${this.info.lines}`, | |
"instead of delimiter, record delimiter, trimable character", | |
"(if activated) or comment" | |
], this.options, this.__infoField()) | |
); | |
if (err !== void 0) | |
return err; | |
} else { | |
this.state.quoting = false; | |
this.state.wasQuoting = true; | |
this.state.field.prepend(quote); | |
pos += quote.length - 1; | |
} | |
} else { | |
if (this.state.field.length !== 0) { | |
if (relax_quotes === false) { | |
const info2 = this.__infoField(); | |
const bom2 = Object.keys(boms).map((b) => boms[b].equals(this.state.field.toString()) ? b : false).filter(Boolean)[0]; | |
const err = this.__error( | |
new CsvError("INVALID_OPENING_QUOTE", [ | |
"Invalid Opening Quote:", | |
`a quote is found on field ${JSON.stringify(info2.column)} at line ${info2.lines}, value is ${JSON.stringify(this.state.field.toString(encoding))}`, | |
bom2 ? `(${bom2} bom)` : void 0 | |
], this.options, info2, { | |
field: this.state.field | |
}) | |
); | |
if (err !== void 0) | |
return err; | |
} | |
} else { | |
this.state.quoting = true; | |
pos += quote.length - 1; | |
continue; | |
} | |
} | |
} | |
if (this.state.quoting === false) { | |
const recordDelimiterLength = this.__isRecordDelimiter(chr, buf, pos); | |
if (recordDelimiterLength !== 0) { | |
const skipCommentLine = this.state.commenting && (this.state.wasQuoting === false && this.state.record.length === 0 && this.state.field.length === 0); | |
if (skipCommentLine) { | |
this.info.comment_lines++; | |
} else { | |
if (this.state.enabled === false && this.info.lines + (this.state.wasRowDelimiter === true ? 1 : 0) >= from_line) { | |
this.state.enabled = true; | |
this.__resetField(); | |
this.__resetRecord(); | |
pos += recordDelimiterLength - 1; | |
continue; | |
} | |
if (skip_empty_lines === true && this.state.wasQuoting === false && this.state.record.length === 0 && this.state.field.length === 0) { | |
this.info.empty_lines++; | |
pos += recordDelimiterLength - 1; | |
continue; | |
} | |
this.info.bytes = this.state.bufBytesStart + pos; | |
const errField = this.__onField(); | |
if (errField !== void 0) | |
return errField; | |
this.info.bytes = this.state.bufBytesStart + pos + recordDelimiterLength; | |
const errRecord = this.__onRecord(push); | |
if (errRecord !== void 0) | |
return errRecord; | |
if (to !== -1 && this.info.records >= to) { | |
this.state.stop = true; | |
close(); | |
return; | |
} | |
} | |
this.state.commenting = false; | |
pos += recordDelimiterLength - 1; | |
continue; | |
} | |
if (this.state.commenting) { | |
continue; | |
} | |
const commentCount = comment === null ? 0 : this.__compareBytes(comment, buf, pos, chr); | |
if (commentCount !== 0 && (comment_no_infix === false || this.state.field.length === 0)) { | |
this.state.commenting = true; | |
continue; | |
} | |
const delimiterLength = this.__isDelimiter(buf, pos, chr); | |
if (delimiterLength !== 0) { | |
this.info.bytes = this.state.bufBytesStart + pos; | |
const errField = this.__onField(); | |
if (errField !== void 0) | |
return errField; | |
pos += delimiterLength - 1; | |
continue; | |
} | |
} | |
} | |
if (this.state.commenting === false) { | |
if (max_record_size !== 0 && this.state.record_length + this.state.field.length > max_record_size) { | |
return this.__error( | |
new CsvError("CSV_MAX_RECORD_SIZE", [ | |
"Max Record Size:", | |
"record exceed the maximum number of tolerated bytes", | |
`of ${max_record_size}`, | |
`at line ${this.info.lines}` | |
], this.options, this.__infoField()) | |
); | |
} | |
} | |
const lappend = ltrim === false || this.state.quoting === true || this.state.field.length !== 0 || !this.__isCharTrimable(buf, pos); | |
const rappend = rtrim === false || this.state.wasQuoting === false; | |
if (lappend === true && rappend === true) { | |
this.state.field.append(chr); | |
} else if (rtrim === true && !this.__isCharTrimable(buf, pos)) { | |
return this.__error( | |
new CsvError("CSV_NON_TRIMABLE_CHAR_AFTER_CLOSING_QUOTE", [ | |
"Invalid Closing Quote:", | |
"found non trimable byte after quote", | |
`at line ${this.info.lines}` | |
], this.options, this.__infoField()) | |
); | |
} else { | |
if (lappend === false) { | |
pos += this.__isCharTrimable(buf, pos) - 1; | |
} | |
continue; | |
} | |
} | |
if (end === true) { | |
if (this.state.quoting === true) { | |
const err = this.__error( | |
new CsvError("CSV_QUOTE_NOT_CLOSED", [ | |
"Quote Not Closed:", | |
`the parsing is finished with an opening quote at line ${this.info.lines}` | |
], this.options, this.__infoField()) | |
); | |
if (err !== void 0) | |
return err; | |
} else { | |
if (this.state.wasQuoting === true || this.state.record.length !== 0 || this.state.field.length !== 0) { | |
this.info.bytes = this.state.bufBytesStart + pos; | |
const errField = this.__onField(); | |
if (errField !== void 0) | |
return errField; | |
const errRecord = this.__onRecord(push); | |
if (errRecord !== void 0) | |
return errRecord; | |
} else if (this.state.wasRowDelimiter === true) { | |
this.info.empty_lines++; | |
} else if (this.state.commenting === true) { | |
this.info.comment_lines++; | |
} | |
} | |
} else { | |
this.state.bufBytesStart += pos; | |
this.state.previousBuf = buf.slice(pos); | |
} | |
if (this.state.wasRowDelimiter === true) { | |
this.info.lines++; | |
this.state.wasRowDelimiter = false; | |
} | |
}, | |
__onRecord: function(push) { | |
const { columns, group_columns_by_name, encoding, info: info2, from: from2, relax_column_count, relax_column_count_less, relax_column_count_more, raw, skip_records_with_empty_values } = this.options; | |
const { enabled, record } = this.state; | |
if (enabled === false) { | |
return this.__resetRecord(); | |
} | |
const recordLength = record.length; | |
if (columns === true) { | |
if (skip_records_with_empty_values === true && isRecordEmpty(record)) { | |
this.__resetRecord(); | |
return; | |
} | |
return this.__firstLineToColumns(record); | |
} | |
if (columns === false && this.info.records === 0) { | |
this.state.expectedRecordLength = recordLength; | |
} | |
if (recordLength !== this.state.expectedRecordLength) { | |
const err = columns === false ? new CsvError("CSV_RECORD_INCONSISTENT_FIELDS_LENGTH", [ | |
"Invalid Record Length:", | |
`expect ${this.state.expectedRecordLength},`, | |
`got ${recordLength} on line ${this.info.lines}` | |
], this.options, this.__infoField(), { | |
record | |
}) : new CsvError("CSV_RECORD_INCONSISTENT_COLUMNS", [ | |
"Invalid Record Length:", | |
`columns length is ${columns.length},`, | |
// rename columns | |
`got ${recordLength} on line ${this.info.lines}` | |
], this.options, this.__infoField(), { | |
record | |
}); | |
if (relax_column_count === true || relax_column_count_less === true && recordLength < this.state.expectedRecordLength || relax_column_count_more === true && recordLength > this.state.expectedRecordLength) { | |
this.info.invalid_field_length++; | |
this.state.error = err; | |
} else { | |
const finalErr = this.__error(err); | |
if (finalErr) | |
return finalErr; | |
} | |
} | |
if (skip_records_with_empty_values === true && isRecordEmpty(record)) { | |
this.__resetRecord(); | |
return; | |
} | |
if (this.state.recordHasError === true) { | |
this.__resetRecord(); | |
this.state.recordHasError = false; | |
return; | |
} | |
this.info.records++; | |
if (from2 === 1 || this.info.records >= from2) { | |
const { objname } = this.options; | |
if (columns !== false) { | |
const obj = {}; | |
for (let i = 0, l = record.length; i < l; i++) { | |
if (columns[i] === void 0 || columns[i].disabled) | |
continue; | |
if (group_columns_by_name === true && obj[columns[i].name] !== void 0) { | |
if (Array.isArray(obj[columns[i].name])) { | |
obj[columns[i].name] = obj[columns[i].name].concat(record[i]); | |
} else { | |
obj[columns[i].name] = [obj[columns[i].name], record[i]]; | |
} | |
} else { | |
obj[columns[i].name] = record[i]; | |
} | |
} | |
if (raw === true || info2 === true) { | |
const extRecord = Object.assign( | |
{ record: obj }, | |
raw === true ? { raw: this.state.rawBuffer.toString(encoding) } : {}, | |
info2 === true ? { info: this.__infoRecord() } : {} | |
); | |
const err = this.__push( | |
objname === void 0 ? extRecord : [obj[objname], extRecord], | |
push | |
); | |
if (err) { | |
return err; | |
} | |
} else { | |
const err = this.__push( | |
objname === void 0 ? obj : [obj[objname], obj], | |
push | |
); | |
if (err) { | |
return err; | |
} | |
} | |
} else { | |
if (raw === true || info2 === true) { | |
const extRecord = Object.assign( | |
{ record }, | |
raw === true ? { raw: this.state.rawBuffer.toString(encoding) } : {}, | |
info2 === true ? { info: this.__infoRecord() } : {} | |
); | |
const err = this.__push( | |
objname === void 0 ? extRecord : [record[objname], extRecord], | |
push | |
); | |
if (err) { | |
return err; | |
} | |
} else { | |
const err = this.__push( | |
objname === void 0 ? record : [record[objname], record], | |
push | |
); | |
if (err) { | |
return err; | |
} | |
} | |
} | |
} | |
this.__resetRecord(); | |
}, | |
__firstLineToColumns: function(record) { | |
const { firstLineToHeaders } = this.state; | |
try { | |
const headers = firstLineToHeaders === void 0 ? record : firstLineToHeaders.call(null, record); | |
if (!Array.isArray(headers)) { | |
return this.__error( | |
new CsvError("CSV_INVALID_COLUMN_MAPPING", [ | |
"Invalid Column Mapping:", | |
"expect an array from column function,", | |
`got ${JSON.stringify(headers)}` | |
], this.options, this.__infoField(), { | |
headers | |
}) | |
); | |
} | |
const normalizedHeaders = normalize_columns_array(headers); | |
this.state.expectedRecordLength = normalizedHeaders.length; | |
this.options.columns = normalizedHeaders; | |
this.__resetRecord(); | |
return; | |
} catch (err) { | |
return err; | |
} | |
}, | |
__resetRecord: function() { | |
if (this.options.raw === true) { | |
this.state.rawBuffer.reset(); | |
} | |
this.state.error = void 0; | |
this.state.record = []; | |
this.state.record_length = 0; | |
}, | |
__onField: function() { | |
const { cast, encoding, rtrim, max_record_size } = this.options; | |
const { enabled, wasQuoting } = this.state; | |
if (enabled === false) { | |
return this.__resetField(); | |
} | |
let field = this.state.field.toString(encoding); | |
if (rtrim === true && wasQuoting === false) { | |
field = field.trimRight(); | |
} | |
if (cast === true) { | |
const [err, f] = this.__cast(field); | |
if (err !== void 0) | |
return err; | |
field = f; | |
} | |
this.state.record.push(field); | |
if (max_record_size !== 0 && typeof field === "string") { | |
this.state.record_length += field.length; | |
} | |
this.__resetField(); | |
}, | |
__resetField: function() { | |
this.state.field.reset(); | |
this.state.wasQuoting = false; | |
}, | |
__push: function(record, push) { | |
const { on_record } = this.options; | |
if (on_record !== void 0) { | |
const info2 = this.__infoRecord(); | |
try { | |
record = on_record.call(null, record, info2); | |
} catch (err) { | |
return err; | |
} | |
if (record === void 0 || record === null) { | |
return; | |
} | |
} | |
push(record); | |
}, | |
// Return a tuple with the error and the casted value | |
__cast: function(field) { | |
const { columns, relax_column_count } = this.options; | |
const isColumns = Array.isArray(columns); | |
if (isColumns === true && relax_column_count && this.options.columns.length <= this.state.record.length) { | |
return [void 0, void 0]; | |
} | |
if (this.state.castField !== null) { | |
try { | |
const info2 = this.__infoField(); | |
return [void 0, this.state.castField.call(null, field, info2)]; | |
} catch (err) { | |
return [err]; | |
} | |
} | |
if (this.__isFloat(field)) { | |
return [void 0, parseFloat(field)]; | |
} else if (this.options.cast_date !== false) { | |
const info2 = this.__infoField(); | |
return [void 0, this.options.cast_date.call(null, field, info2)]; | |
} | |
return [void 0, field]; | |
}, | |
// Helper to test if a character is a space or a line delimiter | |
__isCharTrimable: function(buf, pos) { | |
const isTrim = (buf2, pos2) => { | |
const { timchars } = this.state; | |
loop1: | |
for (let i = 0; i < timchars.length; i++) { | |
const timchar = timchars[i]; | |
for (let j = 0; j < timchar.length; j++) { | |
if (timchar[j] !== buf2[pos2 + j]) | |
continue loop1; | |
} | |
return timchar.length; | |
} | |
return 0; | |
}; | |
return isTrim(buf, pos); | |
}, | |
// Keep it in case we implement the `cast_int` option | |
// __isInt(value){ | |
// // return Number.isInteger(parseInt(value)) | |
// // return !isNaN( parseInt( obj ) ); | |
// return /^(\-|\+)?[1-9][0-9]*$/.test(value) | |
// } | |
__isFloat: function(value) { | |
return value - parseFloat(value) + 1 >= 0; | |
}, | |
__compareBytes: function(sourceBuf, targetBuf, targetPos, firstByte) { | |
if (sourceBuf[0] !== firstByte) | |
return 0; | |
const sourceLength = sourceBuf.length; | |
for (let i = 1; i < sourceLength; i++) { | |
if (sourceBuf[i] !== targetBuf[targetPos + i]) | |
return 0; | |
} | |
return sourceLength; | |
}, | |
__isDelimiter: function(buf, pos, chr) { | |
const { delimiter, ignore_last_delimiters } = this.options; | |
if (ignore_last_delimiters === true && this.state.record.length === this.options.columns.length - 1) { | |
return 0; | |
} else if (ignore_last_delimiters !== false && typeof ignore_last_delimiters === "number" && this.state.record.length === ignore_last_delimiters - 1) { | |
return 0; | |
} | |
loop1: | |
for (let i = 0; i < delimiter.length; i++) { | |
const del = delimiter[i]; | |
if (del[0] === chr) { | |
for (let j = 1; j < del.length; j++) { | |
if (del[j] !== buf[pos + j]) | |
continue loop1; | |
} | |
return del.length; | |
} | |
} | |
return 0; | |
}, | |
__isRecordDelimiter: function(chr, buf, pos) { | |
const { record_delimiter } = this.options; | |
const recordDelimiterLength = record_delimiter.length; | |
loop1: | |
for (let i = 0; i < recordDelimiterLength; i++) { | |
const rd = record_delimiter[i]; | |
const rdLength = rd.length; | |
if (rd[0] !== chr) { | |
continue; | |
} | |
for (let j = 1; j < rdLength; j++) { | |
if (rd[j] !== buf[pos + j]) { | |
continue loop1; | |
} | |
} | |
return rd.length; | |
} | |
return 0; | |
}, | |
__isEscape: function(buf, pos, chr) { | |
const { escape } = this.options; | |
if (escape === null) | |
return false; | |
const l = escape.length; | |
if (escape[0] === chr) { | |
for (let i = 0; i < l; i++) { | |
if (escape[i] !== buf[pos + i]) { | |
return false; | |
} | |
} | |
return true; | |
} | |
return false; | |
}, | |
__isQuote: function(buf, pos) { | |
const { quote } = this.options; | |
if (quote === null) | |
return false; | |
const l = quote.length; | |
for (let i = 0; i < l; i++) { | |
if (quote[i] !== buf[pos + i]) { | |
return false; | |
} | |
} | |
return true; | |
}, | |
__autoDiscoverRecordDelimiter: function(buf, pos) { | |
const { encoding } = this.options; | |
const rds = [ | |
// Important, the windows line ending must be before mac os 9 | |
Buffer.from("\r\n", encoding), | |
Buffer.from("\n", encoding), | |
Buffer.from("\r", encoding) | |
]; | |
loop: | |
for (let i = 0; i < rds.length; i++) { | |
const l = rds[i].length; | |
for (let j = 0; j < l; j++) { | |
if (rds[i][j] !== buf[pos + j]) { | |
continue loop; | |
} | |
} | |
this.options.record_delimiter.push(rds[i]); | |
this.state.recordDelimiterMaxLength = rds[i].length; | |
return rds[i].length; | |
} | |
return 0; | |
}, | |
__error: function(msg) { | |
const { encoding, raw, skip_records_with_error } = this.options; | |
const err = typeof msg === "string" ? new Error(msg) : msg; | |
if (skip_records_with_error) { | |
this.state.recordHasError = true; | |
if (this.options.on_skip !== void 0) { | |
this.options.on_skip(err, raw ? this.state.rawBuffer.toString(encoding) : void 0); | |
} | |
return void 0; | |
} else { | |
return err; | |
} | |
}, | |
__infoDataSet: function() { | |
return { | |
...this.info, | |
columns: this.options.columns | |
}; | |
}, | |
__infoRecord: function() { | |
const { columns, raw, encoding } = this.options; | |
return { | |
...this.__infoDataSet(), | |
error: this.state.error, | |
header: columns === true, | |
index: this.state.record.length, | |
raw: raw ? this.state.rawBuffer.toString(encoding) : void 0 | |
}; | |
}, | |
__infoField: function() { | |
const { columns } = this.options; | |
const isColumns = Array.isArray(columns); | |
return { | |
...this.__infoRecord(), | |
column: isColumns === true ? columns.length > this.state.record.length ? columns[this.state.record.length].name : null : this.state.record.length, | |
quoting: this.state.wasQuoting | |
}; | |
} | |
}; | |
}; | |
const parse = function(data, opts = {}) { | |
if (typeof data === "string") { | |
data = Buffer.from(data); | |
} | |
const records = opts && opts.objname ? {} : []; | |
const parser = transform(opts); | |
const push = (record) => { | |
if (parser.options.objname === void 0) | |
records.push(record); | |
else { | |
records[record[0]] = record[1]; | |
} | |
}; | |
const close = () => { | |
}; | |
const err1 = parser.parse(data, false, push, close); | |
if (err1 !== void 0) | |
throw err1; | |
const err2 = parser.parse(void 0, true, push, close); | |
if (err2 !== void 0) | |
throw err2; | |
return records; | |
}; | |
async function getUserMembershipChanges(params) { | |
const { | |
data: { | |
entityLogs: { | |
logs | |
} | |
} | |
} = await fetch("https://crm-tencent.xiaoshouyi.com/json/crm_customize/entity-logs.action", { | |
"headers": { | |
"content-type": "application/x-www-form-urlencoded; charset=UTF-8" | |
}, | |
"body": `instanceId=${params.instanceId}&belongId=${MEMBERSHIP_BELONG_ID}`, | |
"method": "POST", | |
"mode": "cors", | |
"credentials": "include" | |
}).then((res) => res.json()); | |
return logs.filter((log) => log.itemId === START_TIME_ID || log.itemId === END_TIME_ID).map((log) => { | |
return { | |
type: log.itemId === START_TIME_ID ? "start" : "end", | |
time: new Date(parseInt(log.createdAt)), | |
newValue: log.newValue ? new Date(parseInt(log.newValue)) : void 0, | |
oldValue: log.oldValue ? new Date(parseInt(log.oldValue)) : void 0 | |
}; | |
}); | |
} | |
const _hoisted_1$1 = /* @__PURE__ */ createBaseVNode("label", { class: "form-label" }, "感兴趣用户列表 (csv)", -1); | |
const _hoisted_2$1 = ["disabled"]; | |
const _sfc_main$1 = /* @__PURE__ */ defineComponent({ | |
__name: "UsersScanner", | |
setup(__props) { | |
const fileTargetClients = ref(); | |
async function readCsvFile(file) { | |
console.log(file); | |
const reader = new es.FileReader(file); | |
const content = await reader.readAsText(); | |
return parse(content, { | |
columns: true, | |
skip_empty_lines: true | |
}); | |
} | |
const state = reactive({ | |
total: 0, | |
done: 0 | |
}); | |
const analyzing = ref(false); | |
async function startAnalyzing() { | |
var _a, _b; | |
analyzing.value = true; | |
try { | |
const targetClientsFile = (_b = (_a = fileTargetClients.value) == null ? void 0 : _a.files) == null ? void 0 : _b[0]; | |
if (!targetClientsFile) { | |
alert("请上传文件"); | |
return; | |
} | |
const targetClients = await readCsvFile(targetClientsFile); | |
if (!targetClients[0].hasOwnProperty("id")) { | |
alert("请上传正确的目标用户列表"); | |
return; | |
} | |
const resultLines = []; | |
state.total = targetClients.length; | |
for (const client of targetClients) { | |
let getRecord = function(date, startChange, endChange) { | |
var _a2, _b2, _c, _d, _e, _f; | |
let daysDelta = 0; | |
if (startChange && !startChange.oldValue) { | |
if (!endChange) { | |
console.error("no endChange"); | |
} else { | |
daysDelta = Math.round(((((_a2 = endChange.newValue) == null ? void 0 : _a2.getTime()) ?? 0) - (((_b2 = startChange.newValue) == null ? void 0 : _b2.getTime()) ?? 0)) / (1e3 * 60 * 60 * 24)); | |
} | |
} else { | |
const startDelta = (((_c = startChange == null ? void 0 : startChange.newValue) == null ? void 0 : _c.getTime()) ?? 0) - (((_d = startChange == null ? void 0 : startChange.oldValue) == null ? void 0 : _d.getTime()) ?? 0); | |
const endDelta = (((_e = endChange == null ? void 0 : endChange.newValue) == null ? void 0 : _e.getTime()) ?? 0) - (((_f = endChange == null ? void 0 : endChange.oldValue) == null ? void 0 : _f.getTime()) ?? 0); | |
daysDelta = Math.round((endDelta - startDelta) / (1e3 * 60 * 60 * 24)); | |
} | |
return { | |
name: client["会员姓名"], | |
phone: client["手机号码"], | |
date: new Date(date), | |
oldStart: startChange == null ? void 0 : startChange.oldValue, | |
newStart: startChange == null ? void 0 : startChange.newValue, | |
oldEnd: endChange == null ? void 0 : endChange.oldValue, | |
newEnd: endChange == null ? void 0 : endChange.newValue, | |
daysDelta | |
}; | |
}; | |
const clientId = client.id.trim(); | |
const membershipChanges = await getUserMembershipChanges({ instanceId: clientId }); | |
const groupedChanges = lodashExports.groupBy(membershipChanges, (change) => change.time.toISOString().replace(/\.\d{3}Z$/, "")); | |
const lines = lodashExports.flatten(Object.entries(groupedChanges).map(([date, _changeGroup]) => { | |
const pairs = []; | |
const changeGroup = _changeGroup.slice(); | |
while (changeGroup.length > 0) { | |
const endChange = changeGroup.find((change) => change.type === "end"); | |
const startChange = changeGroup.find((change) => change.type === "start"); | |
if (endChange) { | |
changeGroup.splice(changeGroup.indexOf(endChange), 1); | |
} | |
if (startChange) { | |
changeGroup.splice(changeGroup.indexOf(startChange), 1); | |
} | |
pairs.push([startChange, endChange]); | |
} | |
return pairs.map(([startChange, endChange]) => getRecord(new Date(date), startChange, endChange)); | |
})); | |
resultLines.push(...lines); | |
state.done += 1; | |
await new Promise((resolve) => setTimeout(resolve, 200)); | |
} | |
exportCSV(resultLines); | |
} catch (e) { | |
console.error(e); | |
} finally { | |
analyzing.value = false; | |
} | |
} | |
function exportCSV(lines) { | |
const csvContent = [ | |
"姓名,手机号码,修改日期,旧开始时间,新开始时间,旧结束时间,新结束时间,天数差", | |
...lines.map((line) => { | |
var _a, _b, _c, _d; | |
return [ | |
line.name, | |
line.phone, | |
line.date.toISOString().replace(/\.\d{3}Z$/, ""), | |
((_a = line.oldStart) == null ? void 0 : _a.toLocaleDateString()) ?? "", | |
((_b = line.newStart) == null ? void 0 : _b.toLocaleDateString()) ?? "", | |
((_c = line.oldEnd) == null ? void 0 : _c.toLocaleDateString()) ?? "", | |
((_d = line.newEnd) == null ? void 0 : _d.toLocaleDateString()) ?? "", | |
line.daysDelta | |
].join(","); | |
}) | |
].join("\n"); | |
const blob = new Blob([csvContent], { type: "text/csv;charset=utf-8;" }); | |
const url = URL.createObjectURL(blob); | |
const link = document.createElement("a"); | |
link.setAttribute("href", url); | |
link.setAttribute("download", "result.csv"); | |
link.style.visibility = "hidden"; | |
document.body.appendChild(link); | |
link.click(); | |
document.body.removeChild(link); | |
} | |
return (_ctx, _cache) => { | |
return openBlock(), createElementBlock("div", null, [ | |
createBaseVNode("div", null, [ | |
_hoisted_1$1, | |
createBaseVNode("input", { | |
ref_key: "fileTargetClients", | |
ref: fileTargetClients, | |
type: "file", | |
class: "file-input w-full max-w-xs", | |
accept: ".csv" | |
}, null, 512) | |
]), | |
createBaseVNode("div", null, [ | |
createBaseVNode("button", { | |
onClick: startAnalyzing, | |
class: "btn btn-neutral", | |
disabled: analyzing.value | |
}, "开始", 8, _hoisted_2$1) | |
]), | |
createBaseVNode("div", null, toDisplayString(state.done) + "/" + toDisplayString(state.total), 1) | |
]); | |
}; | |
} | |
}); | |
const _hoisted_1 = { | |
"data-theme": "corporate", | |
"data-dom-root": "" | |
}; | |
const _hoisted_2 = { class: "fixed top-5 right-10" }; | |
const _hoisted_3 = ["id"]; | |
const _hoisted_4 = { class: "modal-box relative w-full min-w-full h-full" }; | |
const _hoisted_5 = /* @__PURE__ */ createBaseVNode("div", { class: "modal-action absolute top-0 right-4" }, [ | |
/* @__PURE__ */ createBaseVNode("form", { method: "dialog" }, [ | |
/* @__PURE__ */ createBaseVNode("button", { class: "btn btn-sm btn-circle" }, "X") | |
]) | |
], -1); | |
const _sfc_main = /* @__PURE__ */ defineComponent({ | |
__name: "App", | |
setup(__props) { | |
const modal = ref(); | |
function showModal() { | |
var _a; | |
(_a = modal.value) == null ? void 0 : _a.showModal(); | |
} | |
return (_ctx, _cache) => { | |
return openBlock(), createElementBlock("div", _hoisted_1, [ | |
createBaseVNode("div", _hoisted_2, [ | |
createBaseVNode("button", { | |
onClick: _cache[0] || (_cache[0] = ($event) => showModal()), | |
class: "btn btn-lg btn-primary" | |
}, "小秘书") | |
]), | |
createBaseVNode("dialog", { | |
id: unref(ID_MAIN_ENTRY), | |
class: "modal p-4", | |
ref_key: "modal", | |
ref: modal, | |
onKeydown: _cache[1] || (_cache[1] = withKeys(withModifiers(() => { | |
}, ["prevent"]), ["esc"])) | |
}, [ | |
createBaseVNode("div", _hoisted_4, [ | |
_hoisted_5, | |
createVNode(_sfc_main$1) | |
]) | |
], 40, _hoisted_3) | |
]); | |
}; | |
} | |
}); | |
const style = '/*\n1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)\n2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)\n2. [UnoCSS]: allow to override the default border color with css var `--un-default-border-color`\n*/\n\n*,\n::before,\n::after {\n box-sizing: border-box; /* 1 */\n border-width: 0; /* 2 */\n border-style: solid; /* 2 */\n border-color: var(--un-default-border-color, #e5e7eb); /* 2 */\n}\n\n/*\n1. Use a consistent sensible line-height in all browsers.\n2. Prevent adjustments of font size after orientation changes in iOS.\n3. Use a more readable tab size.\n4. Use the user\'s configured `sans` font-family by default.\n*/\n\nhtml {\n line-height: 1.5; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n text-size-adjust: 100%; /* 2 */\n -moz-tab-size: 4; /* 3 */\n tab-size: 4; /* 3 */\n font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; /* 4 */\n}\n\n/*\n1. Remove the margin in all browsers.\n2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.\n*/\n\nbody {\n margin: 0; /* 1 */\n line-height: inherit; /* 2 */\n}\n\n/*\n1. Add the correct height in Firefox.\n2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)\n3. Ensure horizontal rules are visible by default.\n*/\n\nhr {\n height: 0; /* 1 */\n color: inherit; /* 2 */\n border-top-width: 1px; /* 3 */\n}\n\n/*\nAdd the correct text decoration in Chrome, Edge, and Safari.\n*/\n\nabbr:where([title]) {\n text-decoration: underline dotted;\n}\n\n/*\nRemove the default font size and weight for headings.\n*/\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6 {\n font-size: inherit;\n font-weight: inherit;\n}\n\n/*\nReset links to optimize for opt-in styling instead of opt-out.\n*/\n\na {\n color: inherit;\n text-decoration: inherit;\n}\n\n/*\nAdd the correct font weight in Edge and Safari.\n*/\n\nb,\nstrong {\n font-weight: bolder;\n}\n\n/*\n1. Use the user\'s configured `mono` font family by default.\n2. Correct the odd `em` font sizing in all browsers.\n*/\n\ncode,\nkbd,\nsamp,\npre {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; /* 1 */\n font-size: 1em; /* 2 */\n}\n\n/*\nAdd the correct font size in all browsers.\n*/\n\nsmall {\n font-size: 80%;\n}\n\n/*\nPrevent `sub` and `sup` elements from affecting the line height in all browsers.\n*/\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\n/*\n1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)\n2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)\n3. Remove gaps between table borders by default.\n*/\n\ntable {\n text-indent: 0; /* 1 */\n border-color: inherit; /* 2 */\n border-collapse: collapse; /* 3 */\n}\n\n/*\n1. Change the font styles in all browsers.\n2. Remove the margin in Firefox and Safari.\n3. Remove default padding in all browsers.\n*/\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit; /* 1 */\n font-feature-settings: inherit; /* 1 */\n font-variation-settings: inherit; /* 1 */\n font-size: 100%; /* 1 */\n font-weight: inherit; /* 1 */\n line-height: inherit; /* 1 */\n color: inherit; /* 1 */\n margin: 0; /* 2 */\n padding: 0; /* 3 */\n}\n\n/*\nRemove the inheritance of text transform in Edge and Firefox.\n*/\n\nbutton,\nselect {\n text-transform: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Remove default button styles.\n*/\n\nbutton,\n[type=\'button\'],\n[type=\'reset\'],\n[type=\'submit\'] {\n -webkit-appearance: button; /* 1 */\n background-color: transparent; /* 2 */\n background-image: none; /* 2 */\n}\n\n/*\nUse the modern Firefox focus style for all focusable elements.\n*/\n\n:-moz-focusring {\n outline: auto;\n}\n\n/*\nRemove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)\n*/\n\n:-moz-ui-invalid {\n box-shadow: none;\n}\n\n/*\nAdd the correct vertical alignment in Chrome and Firefox.\n*/\n\nprogress {\n vertical-align: baseline;\n}\n\n/*\nCorrect the cursor style of increment and decrement buttons in Safari.\n*/\n\n::-webkit-inner-spin-button,\n::-webkit-outer-spin-button {\n height: auto;\n}\n\n/*\n1. Correct the odd appearance in Chrome and Safari.\n2. Correct the outline style in Safari.\n*/\n\n[type=\'search\'] {\n -webkit-appearance: textfield; /* 1 */\n outline-offset: -2px; /* 2 */\n}\n\n/*\nRemove the inner padding in Chrome and Safari on macOS.\n*/\n\n::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Change font properties to `inherit` in Safari.\n*/\n\n::-webkit-file-upload-button {\n -webkit-appearance: button; /* 1 */\n font: inherit; /* 2 */\n}\n\n/*\nAdd the correct display in Chrome and Safari.\n*/\n\nsummary {\n display: list-item;\n}\n\n/*\nRemoves the default spacing and border for appropriate elements.\n*/\n\nblockquote,\ndl,\ndd,\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\nhr,\nfigure,\np,\npre {\n margin: 0;\n}\n\nfieldset {\n margin: 0;\n padding: 0;\n}\n\nlegend {\n padding: 0;\n}\n\nol,\nul,\nmenu {\n list-style: none;\n margin: 0;\n padding: 0;\n}\n\n/*\nPrevent resizing textareas horizontally by default.\n*/\n\ntextarea {\n resize: vertical;\n}\n\n/*\n1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)\n2. Set the default placeholder color to the user\'s configured gray 400 color.\n*/\n\ninput::placeholder,\ntextarea::placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\n/*\nSet the default cursor for buttons.\n*/\n\nbutton,\n[role="button"] {\n cursor: pointer;\n}\n\n/*\nMake sure disabled buttons don\'t get the pointer cursor.\n*/\n:disabled {\n cursor: default;\n}\n\n/*\n1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)\n2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)\n This can trigger a poorly considered lint error in some tools but is included by design.\n*/\n\nimg,\nsvg,\nvideo,\ncanvas,\naudio,\niframe,\nembed,\nobject {\n display: block; /* 1 */\n vertical-align: middle; /* 2 */\n}\n\n/*\nConstrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)\n*/\n\nimg,\nvideo {\n max-width: 100%;\n height: auto;\n}\n\n/* Make elements with the HTML hidden attribute stay hidden by default */\n[hidden] {\n display: none;\n}\n\n *,::before,::after{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / 0.5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: ;}::backdrop{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / 0.5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: ;}:root,[data-theme] { background-color: hsl(var(--b1) / var(--un-bg-opacity, 1)); color: hsl(var(--bc) / var(--un-text-opacity, 1))}html { -webkit-tap-highlight-color: transparent}.link-hover:hover { text-decoration-line: underline }.link-primary:hover { --un-text-opacity: 1; color: hsl(var(--pf) / var(--un-text-opacity)) }.link-secondary:hover { --un-text-opacity: 1; color: hsl(var(--sf) / var(--un-text-opacity)) }.link-accent:hover { --un-text-opacity: 1; color: hsl(var(--af) / var(--un-text-opacity)) }.link-neutral:hover { --un-text-opacity: 1; color: hsl(var(--nf) / var(--un-text-opacity)) }.link-success:hover { --un-text-opacity: 1; color: hsl(var(--su) / var(--un-text-opacity)) }.link-info:hover { --un-text-opacity: 1; color: hsl(var(--in) / var(--un-text-opacity)) }.link-warning:hover { --un-text-opacity: 1; color: hsl(var(--wa) / var(--un-text-opacity)) }.link-error:hover { --un-text-opacity: 1; color: hsl(var(--er) / var(--un-text-opacity)) }.link { cursor: pointer; text-decoration-line: underline}.link-hover { text-decoration-line: none}.link-primary { --un-text-opacity: 1; color: hsl(var(--p) / var(--un-text-opacity))}.link-secondary { --un-text-opacity: 1; color: hsl(var(--s) / var(--un-text-opacity))}.link-accent { --un-text-opacity: 1; color: hsl(var(--a) / var(--un-text-opacity))}.link-neutral { --un-text-opacity: 1; color: hsl(var(--n) / var(--un-text-opacity))}.link-success { --un-text-opacity: 1; color: hsl(var(--su) / var(--un-text-opacity))}.link-info { --un-text-opacity: 1; color: hsl(var(--in) / var(--un-text-opacity))}.link-warning { --un-text-opacity: 1; color: hsl(var(--wa) / var(--un-text-opacity))}.link-error { --un-text-opacity: 1; color: hsl(var(--er) / var(--un-text-opacity))}.link:focus { outline: 2px solid transparent; outline-offset: 2px}.link:focus-visible { outline: 2px solid currentColor; outline-offset: 2px}.label a:hover { --un-text-opacity: 1; color: hsl(var(--bc) / var(--un-text-opacity)) }.label { display: flex; -webkit-user-select: none; -moz-user-select: none; user-select: none; align-items: center; justify-content: space-between; padding-left: 0.25rem; padding-right: 0.25rem; padding-top: 0.5rem; padding-bottom: 0.5rem}.btn { display: inline-flex; flex-shrink: 0; cursor: pointer; -webkit-user-select: none; -moz-user-select: none; user-select: none; flex-wrap: wrap; align-items: center; justify-content: center; border-color: transparent; border-color: hsl(var(--b2) / var(--un-border-opacity)); text-align: center; transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter; transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter; transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-timing-function: cubic-bezier(0, 0, 0.2, 1); transition-duration: 200ms; border-radius: var(--rounded-btn, 0.5rem); height: 3rem; padding-left: 1rem; padding-right: 1rem; min-height: 3rem; font-size: 0.875rem; line-height: 1em; gap: 0.5rem; font-weight: 600; text-decoration-line: none; text-decoration-line: none; border-width: var(--border-btn, 1px); animation: button-pop var(--animation-btn, 0.25s) ease-out; text-transform: var(--btn-text-case, uppercase); --un-border-opacity: 1; --un-bg-opacity: 1; background-color: hsl(var(--b2) / var(--un-bg-opacity)); --un-text-opacity: 1; color: hsl(var(--bc) / var(--un-text-opacity)); outline-color: hsl(var(--bc) / 1)}.btn:is(input[type="checkbox"]),.btn:is(input[type="radio"]) { width: auto; -webkit-appearance: none; -moz-appearance: none; appearance: none}.btn:is(input[type="checkbox"]):after,.btn:is(input[type="radio"]):after { --un-content: attr(aria-label); content: var(--un-content)}.btn:hover { --un-border-opacity: 1; border-color: hsl(var(--b3) / var(--un-border-opacity)); --un-bg-opacity: 1; background-color: hsl(var(--b3) / var(--un-bg-opacity)) }.btn.glass:hover { --glass-opacity: 25%; --glass-border-opacity: 15% }.btn:is(input[type="checkbox"]:checked):hover, .btn:is(input[type="radio"]:checked):hover { --un-border-opacity: 1; border-color: hsl(var(--pf) / var(--un-border-opacity)); --un-bg-opacity: 1; background-color: hsl(var(--pf) / var(--un-bg-opacity)) }.btn:active:hover, .btn:active:focus { animation: button-pop 0s ease-out; transform: scale(var(--btn-focus-scale, 0.97))}.btn:focus-visible { outline-style: solid; outline-width: 2px; outline-offset: 2px}.btn.glass { --un-shadow: 0 0 #0000; --un-shadow-colored: 0 0 #0000; box-shadow: var(--un-ring-offset-shadow, 0 0 #0000), var(--un-ring-shadow, 0 0 #0000), var(--un-shadow); outline-color: currentColor}.btn.glass.btn-active { --glass-opacity: 25%; --glass-border-opacity: 15%}.btn.btn-disabled, .btn[disabled], .btn:disabled { --un-border-opacity: 0; background-color: hsl(var(--n) / var(--un-bg-opacity)); --un-bg-opacity: 0.2; color: hsl(var(--bc) / var(--un-text-opacity)); --un-text-opacity: 0.2}.btn:is(input[type="checkbox"]:checked),.btn:is(input[type="radio"]:checked) { --un-border-opacity: 1; border-color: hsl(var(--p) / var(--un-border-opacity)); --un-bg-opacity: 1; background-color: hsl(var(--p) / var(--un-bg-opacity)); --un-text-opacity: 1; color: hsl(var(--pc) / var(--un-text-opacity))}.btn:is(input[type="checkbox"]:checked):focus-visible, .btn:is(input[type="radio"]:checked):focus-visible { outline-color: hsl(var(--p) / 1)}.btn-circle { height: 3rem; width: 3rem; border-radius: 9999px; padding: 0px}.btn-circle:where(.btn-xs) { height: 1.5rem; width: 1.5rem; border-radius: 9999px; padding: 0px}.btn-circle:where(.btn-sm) { height: 2rem; width: 2rem; border-radius: 9999px; padding: 0px}.btn-circle:where(.btn-md) { height: 3rem; width: 3rem; border-radius: 9999px; padding: 0px}.btn-circle:where(.btn-lg) { height: 4rem; width: 4rem; border-radius: 9999px; padding: 0px}.btn-primary:hover { --un-border-opacity: 1; border-color: hsl(var(--pf) / var(--un-border-opacity)); --un-bg-opacity: 1; background-color: hsl(var(--pf) / var(--un-bg-opacity)) }.btn-primary { --un-border-opacity: 1; border-color: hsl(var(--p) / var(--un-border-opacity)); --un-bg-opacity: 1; background-color: hsl(var(--p) / var(--un-bg-opacity)); --un-text-opacity: 1; color: hsl(var(--pc) / var(--un-text-opacity)); outline-color: hsl(var(--p) / 1)}.btn-primary.btn-active { --un-border-opacity: 1; border-color: hsl(var(--pf) / var(--un-border-opacity)); --un-bg-opacity: 1; background-color: hsl(var(--pf) / var(--un-bg-opacity))}.btn-neutral:hover { --un-border-opacity: 1; border-color: hsl(var(--nf) / var(--un-border-opacity)); --un-bg-opacity: 1; background-color: hsl(var(--nf) / var(--un-bg-opacity)) }.btn-neutral { --un-border-opacity: 1; border-color: hsl(var(--n) / var(--un-border-opacity)); --un-bg-opacity: 1; background-color: hsl(var(--n) / var(--un-bg-opacity)); --un-text-opacity: 1; color: hsl(var(--nc) / var(--un-text-opacity)); outline-color: hsl(var(--n) / 1)}.btn-neutral.btn-active { --un-border-opacity: 1; border-color: hsl(var(--nf) / var(--un-border-opacity)); --un-bg-opacity: 1; background-color: hsl(var(--nf) / var(--un-bg-opacity))}.input { flex-shrink: 1; height: 3rem; padding-left: 1rem; padding-right: 1rem; font-size: 0.875rem; font-size: 1rem; line-height: 1.25rem; line-height: 2; line-height: 1.5rem; border-width: 1px; border-color: hsl(var(--bc) / var(--un-border-opacity)); --un-border-opacity: 0; --un-bg-opacity: 1; background-color: hsl(var(--b1) / var(--un-bg-opacity)); border-radius: var(--rounded-btn, 0.5rem)}.input input:focus { outline: 2px solid transparent; outline-offset: 2px}.input[list]::-webkit-calendar-picker-indicator { line-height: 1em}.input:focus, .input:focus-within { outline-style: solid; outline-width: 2px; outline-offset: 2px; outline-color: hsl(var(--bc) / 0.2)}.modal { pointer-events: none; position: fixed; inset: 0px; margin: 0px; display: grid; height: 100%; max-height: none; width: 100%; max-width: none; justify-items: center; padding: 0px; opacity: 0; overscroll-behavior: contain; overscroll-behavior: contain; z-index: 999; background-color: transparent; color: inherit; transition-duration: 200ms; transition-timing-function: cubic-bezier(0, 0, 0.2, 1); transition-property: transform, opacity, visibility; overflow-y: hidden}:where(.modal) { align-items: center}.modal-open,.modal:target,.modal-toggle:checked + .modal,.modal[open] { pointer-events: auto; visibility: visible; opacity: 1}:root:has(:is(.modal-open, .modal:target, .modal-toggle:checked + .modal, .modal[open])) { overflow: hidden}.modal:not(dialog:not(.modal-open)), .modal::backdrop { background-color: rgba(0, 0, 0, 0.3); animation: modal-pop 0.2s ease-out}.modal-open .modal-box,.modal-toggle:checked + .modal .modal-box,.modal:target .modal-box,.modal[open] .modal-box { --un-translate-y: 0px; --un-scale-x: 1; --un-scale-y: 1; transform: translate(var(--un-translate-x), var(--un-translate-y)) rotate(var(--un-rotate)) skewX(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y))}.modal-box { max-height: calc(100vh - 5em); grid-column-start: 1; grid-row-start: 1; width: 91.666667%; max-width: 32rem; --un-scale-x: .9; --un-scale-y: .9; transform: translate(var(--un-translate-x), var(--un-translate-y)) rotate(var(--un-rotate)) skewX(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)); --un-bg-opacity: 1; background-color: hsl(var(--b1) / var(--un-bg-opacity)); padding: 1.5rem; transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter; transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter; transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-timing-function: cubic-bezier(0, 0, 0.2, 1); transition-duration: 200ms; border-top-left-radius: var(--rounded-box, 1rem); border-top-right-radius: var(--rounded-box, 1rem); border-bottom-left-radius: var(--rounded-box, 1rem); border-bottom-right-radius: var(--rounded-box, 1rem); box-shadow: rgba(0, 0, 0, 0.25) 0px 25px 50px -12px; overflow-y: auto; overscroll-behavior: contain}.modal-action { display: flex; margin-top: 1.5rem; justify-content: flex-end}.modal-action > :not([hidden]) ~ :not([hidden]) { --un-space-x-reverse: 0; margin-right: calc(0.5rem * var(--un-space-x-reverse)); margin-left: calc(0.5rem * calc(1 - var(--un-space-x-reverse)))}.btn-sm { height: 2rem; padding-left: 0.75rem; padding-right: 0.75rem; min-height: 2rem; font-size: 0.875rem}.btn-lg { height: 4rem; padding-left: 1.5rem; padding-right: 1.5rem; min-height: 4rem; font-size: 1.125rem}@keyframes button-pop { 0% { transform: scale(var(--btn-focus-scale, 0.98)) } 40% { transform: scale(1.02) } 100% { transform: scale(1) }}@keyframes checkmark { 0% { background-position-y: 5px } 50% { background-position-y: -2px } 100% { background-position-y: 0 }}@keyframes modal-pop { 0% { opacity: 0 }}@keyframes progress-loading { 50% { background-position-x: -115% }}@keyframes radiomark { 0% { box-shadow: 0 0 0 12px hsl(var(--b1)) inset, 0 0 0 12px hsl(var(--b1)) inset } 50% { box-shadow: 0 0 0 3px hsl(var(--b1)) inset, 0 0 0 3px hsl(var(--b1)) inset } 100% { box-shadow: 0 0 0 4px hsl(var(--b1)) inset, 0 0 0 4px hsl(var(--b1)) inset }}@keyframes rating-pop { 0% { transform: translateY(-0.125em) } 40% { transform: translateY(-0.125em) } 100% { transform: translateY(0) }}@keyframes toast-pop { 0% { transform: scale(0.9); opacity: 0 } 100% { transform: scale(1); opacity: 1 }}:root { color-scheme: light; --pf: 229 96% 57%; --sf: 215 26% 52%; --af: 154 49% 53%; --nf: 233 27% 6%; --b2: 0 0% 93%; --b3: 0 0% 86%; --in: 198 93% 60%; --su: 158 64% 52%; --wa: 43 96% 56%; --er: 0 91% 71%; --pc: 243 100% 94%; --sc: 216 13% 13%; --ac: 151 21% 13%; --inc: 198 100% 12%; --suc: 158 100% 10%; --wac: 43 100% 11%; --erc: 0 100% 14%; --btn-text-case: uppercase; --border-btn: 1px; --tab-border: 1px; --tab-radius: 0.5rem; --p: 229 96% 64%; --s: 215 26% 59%; --a: 154 49% 60%; --n: 233 27% 13%; --nc: 210 38% 95%; --b1: 0 0% 100%; --bc: 233 27% 13%; --rounded-box: 0.25rem; --rounded-btn: .125rem; --rounded-badge: .125rem; --animation-btn: 0; --animation-input: 0; --btn-focus-scale: 1}.absolute{position:absolute;}.fixed{position:fixed;}.relative{position:relative;}.right-10{right:2.5rem;}.right-4{right:1rem;}.top-0{top:0;}.top-5{top:1.25rem;}.hidden{display:none;}.h-full{height:100%;}.max-w-xs{max-width:20rem;}.min-w-full{min-width:100%;}.w-full{width:100%;}.p-4{padding:1rem;} '; | |
const theme = '[data-dom-root] {\n line-height: 1.5; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n text-size-adjust: 100%; /* 2 */\n -moz-tab-size: 4; /* 3 */\n tab-size: 4; /* 3 */\n font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; /* 4 */\n}\n[data-theme=corporate] {\n color-scheme: light;\n --pf: 229 96% 57%;\n --sf: 215 26% 52%;\n --af: 154 49% 53%;\n --nf: 233 27% 6%;\n --b2: 0 0% 93%;\n --b3: 0 0% 86%;\n --in: 198 93% 60%;\n --su: 158 64% 52%;\n --wa: 43 96% 56%;\n --er: 0 91% 71%;\n --pc: 243 100% 94%;\n --sc: 216 13% 13%;\n --ac: 151 21% 13%;\n --inc: 198 100% 12%;\n --suc: 158 100% 10%;\n --wac: 43 100% 11%;\n --erc: 0 100% 14%;\n --btn-text-case: uppercase;\n --border-btn: 1px;\n --tab-border: 1px;\n --tab-radius: 0.5rem;\n --p: 229 96% 64%;\n --s: 215 26% 59%;\n --a: 154 49% 60%;\n --n: 233 27% 13%;\n --nc: 210 38% 95%;\n --b1: 0 0% 100%;\n --bc: 233 27% 13%;\n --rounded-box: 0.25rem;\n --rounded-btn: .125rem;\n --rounded-badge: .125rem;\n --animation-btn: 0;\n --animation-input: 0;\n --btn-focus-scale: 1\n}\n'; | |
const MyApp = /* @__PURE__ */ defineCustomElement({ | |
..._sfc_main, | |
styles: [ | |
style, | |
theme | |
] | |
}); | |
customElements.define("erickson-assistant", MyApp); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name xiaoshouyi-assistant | |
// @version 0.1.0 | |
// @namespace https://gist.github.com/jcppman/ | |
// @description xiaoshouyi analyzer | |
// @author Chriest Yu | |
// @match https://crm-tencent.xiaoshouyi.com/* | |
// @require https://gist.githubusercontent.com/jcppman/201a13ff58b314fccdcbe6271f48b739/raw/97af5a13eeb6d02576b933a6638dd15e267075f5/assistant.umd.cjs | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
const dom = document.createElement('erickson-assistant'); | |
document.body.appendChild(dom); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment