UNPKG

element-plus

Version:

A Component Library for Vue 3

1,642 lines (1,535 loc) 2.17 MB
/*! Element Plus v2.9.10 */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue')) : typeof define === 'function' && define.amd ? define(['exports', 'vue'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ElementPlus = {}, global.Vue)); })(this, (function (exports, vue) { 'use strict'; const FOCUSABLE_ELEMENT_SELECTORS = `a[href],button:not([disabled]),button:not([hidden]),:not([tabindex="-1"]),input:not([disabled]),input:not([type="hidden"]),select:not([disabled]),textarea:not([disabled])`; const isVisible = (element) => { const computed = getComputedStyle(element); return computed.position === "fixed" ? false : element.offsetParent !== null; }; const obtainAllFocusableElements$1 = (element) => { return Array.from(element.querySelectorAll(FOCUSABLE_ELEMENT_SELECTORS)).filter((item) => isFocusable(item) && isVisible(item)); }; const isFocusable = (element) => { if (element.tabIndex > 0 || element.tabIndex === 0 && element.getAttribute("tabIndex") !== null) { return true; } if (element.tabIndex < 0 || element.hasAttribute("disabled") || element.getAttribute("aria-disabled") === "true") { return false; } switch (element.nodeName) { case "A": { return !!element.href && element.rel !== "ignore"; } case "INPUT": { return !(element.type === "hidden" || element.type === "file"); } case "BUTTON": case "SELECT": case "TEXTAREA": { return true; } default: { return false; } } }; const triggerEvent = function(elm, name, ...opts) { let eventName; if (name.includes("mouse") || name.includes("click")) { eventName = "MouseEvents"; } else if (name.includes("key")) { eventName = "KeyboardEvent"; } else { eventName = "HTMLEvents"; } const evt = document.createEvent(eventName); evt.initEvent(name, ...opts); elm.dispatchEvent(evt); return elm; }; const isLeaf = (el) => !el.getAttribute("aria-owns"); const getSibling = (el, distance, elClass) => { const { parentNode } = el; if (!parentNode) return null; const siblings = parentNode.querySelectorAll(elClass); const index = Array.prototype.indexOf.call(siblings, el); return siblings[index + distance] || null; }; const focusNode = (el) => { if (!el) return; el.focus(); !isLeaf(el) && el.click(); }; const composeEventHandlers = (theirsHandler, oursHandler, { checkForDefaultPrevented = true } = {}) => { const handleEvent = (event) => { const shouldPrevent = theirsHandler == null ? void 0 : theirsHandler(event); if (checkForDefaultPrevented === false || !shouldPrevent) { return oursHandler == null ? void 0 : oursHandler(event); } }; return handleEvent; }; const whenMouse = (handler) => { return (e) => e.pointerType === "mouse" ? handler(e) : void 0; }; function computedEager(fn, options) { var _a; const result = vue.shallowRef(); vue.watchEffect(() => { result.value = fn(); }, { ...options, flush: (_a = options == null ? void 0 : options.flush) != null ? _a : "sync" }); return vue.readonly(result); } function tryOnScopeDispose(fn) { if (vue.getCurrentScope()) { vue.onScopeDispose(fn); return true; } return false; } function toValue(r) { return typeof r === "function" ? r() : vue.unref(r); } const isClient = typeof window !== "undefined" && typeof document !== "undefined"; typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope; const isDef = (val) => typeof val !== "undefined"; const notNullish = (val) => val != null; const toString$1 = Object.prototype.toString; const isObject$2 = (val) => toString$1.call(val) === "[object Object]"; const noop$1 = () => { }; const isIOS = /* @__PURE__ */ getIsIOS(); function getIsIOS() { var _a, _b; return isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && (/iP(?:ad|hone|od)/.test(window.navigator.userAgent) || ((_b = window == null ? void 0 : window.navigator) == null ? void 0 : _b.maxTouchPoints) > 2 && /iPad|Macintosh/.test(window == null ? void 0 : window.navigator.userAgent)); } function createFilterWrapper(filter, fn) { function wrapper(...args) { return new Promise((resolve, reject) => { Promise.resolve(filter(() => fn.apply(this, args), { fn, thisArg: this, args })).then(resolve).catch(reject); }); } return wrapper; } function debounceFilter(ms, options = {}) { let timer; let maxTimer; let lastRejector = noop$1; const _clearTimeout = (timer2) => { clearTimeout(timer2); lastRejector(); lastRejector = noop$1; }; const filter = (invoke) => { const duration = toValue(ms); const maxDuration = toValue(options.maxWait); if (timer) _clearTimeout(timer); if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) { if (maxTimer) { _clearTimeout(maxTimer); maxTimer = null; } return Promise.resolve(invoke()); } return new Promise((resolve, reject) => { lastRejector = options.rejectOnCancel ? reject : resolve; if (maxDuration && !maxTimer) { maxTimer = setTimeout(() => { if (timer) _clearTimeout(timer); maxTimer = null; resolve(invoke()); }, maxDuration); } timer = setTimeout(() => { if (maxTimer) _clearTimeout(maxTimer); maxTimer = null; resolve(invoke()); }, duration); }); }; return filter; } function throttleFilter(...args) { let lastExec = 0; let timer; let isLeading = true; let lastRejector = noop$1; let lastValue; let ms; let trailing; let leading; let rejectOnCancel; if (!vue.isRef(args[0]) && typeof args[0] === "object") ({ delay: ms, trailing = true, leading = true, rejectOnCancel = false } = args[0]); else [ms, trailing = true, leading = true, rejectOnCancel = false] = args; const clear = () => { if (timer) { clearTimeout(timer); timer = void 0; lastRejector(); lastRejector = noop$1; } }; const filter = (_invoke) => { const duration = toValue(ms); const elapsed = Date.now() - lastExec; const invoke = () => { return lastValue = _invoke(); }; clear(); if (duration <= 0) { lastExec = Date.now(); return invoke(); } if (elapsed > duration && (leading || !isLeading)) { lastExec = Date.now(); invoke(); } else if (trailing) { lastValue = new Promise((resolve, reject) => { lastRejector = rejectOnCancel ? reject : resolve; timer = setTimeout(() => { lastExec = Date.now(); isLeading = true; resolve(invoke()); clear(); }, Math.max(0, duration - elapsed)); }); } if (!leading && !timer) timer = setTimeout(() => isLeading = true, duration); isLeading = false; return lastValue; }; return filter; } function getLifeCycleTarget(target) { return target || vue.getCurrentInstance(); } function useDebounceFn(fn, ms = 200, options = {}) { return createFilterWrapper( debounceFilter(ms, options), fn ); } function refDebounced(value, ms = 200, options = {}) { const debounced = vue.ref(value.value); const updater = useDebounceFn(() => { debounced.value = value.value; }, ms, options); vue.watch(value, () => updater()); return debounced; } function useThrottleFn(fn, ms = 200, trailing = false, leading = true, rejectOnCancel = false) { return createFilterWrapper( throttleFilter(ms, trailing, leading, rejectOnCancel), fn ); } function tryOnMounted(fn, sync = true, target) { const instance = getLifeCycleTarget(); if (instance) vue.onMounted(fn, target); else if (sync) fn(); else vue.nextTick(fn); } function useTimeoutFn(cb, interval, options = {}) { const { immediate = true } = options; const isPending = vue.ref(false); let timer = null; function clear() { if (timer) { clearTimeout(timer); timer = null; } } function stop() { isPending.value = false; clear(); } function start(...args) { clear(); isPending.value = true; timer = setTimeout(() => { isPending.value = false; timer = null; cb(...args); }, toValue(interval)); } if (immediate) { isPending.value = true; if (isClient) start(); } tryOnScopeDispose(stop); return { isPending: vue.readonly(isPending), start, stop }; } function unrefElement(elRef) { var _a; const plain = toValue(elRef); return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain; } const defaultWindow = isClient ? window : void 0; const defaultDocument = isClient ? window.document : void 0; function useEventListener(...args) { let target; let events; let listeners; let options; if (typeof args[0] === "string" || Array.isArray(args[0])) { [events, listeners, options] = args; target = defaultWindow; } else { [target, events, listeners, options] = args; } if (!target) return noop$1; if (!Array.isArray(events)) events = [events]; if (!Array.isArray(listeners)) listeners = [listeners]; const cleanups = []; const cleanup = () => { cleanups.forEach((fn) => fn()); cleanups.length = 0; }; const register = (el, event, listener, options2) => { el.addEventListener(event, listener, options2); return () => el.removeEventListener(event, listener, options2); }; const stopWatch = vue.watch( () => [unrefElement(target), toValue(options)], ([el, options2]) => { cleanup(); if (!el) return; const optionsClone = isObject$2(options2) ? { ...options2 } : options2; cleanups.push( ...events.flatMap((event) => { return listeners.map((listener) => register(el, event, listener, optionsClone)); }) ); }, { immediate: true, flush: "post" } ); const stop = () => { stopWatch(); cleanup(); }; tryOnScopeDispose(stop); return stop; } let _iOSWorkaround = false; function onClickOutside(target, handler, options = {}) { const { window = defaultWindow, ignore = [], capture = true, detectIframe = false } = options; if (!window) return noop$1; if (isIOS && !_iOSWorkaround) { _iOSWorkaround = true; Array.from(window.document.body.children).forEach((el) => el.addEventListener("click", noop$1)); window.document.documentElement.addEventListener("click", noop$1); } let shouldListen = true; const shouldIgnore = (event) => { return ignore.some((target2) => { if (typeof target2 === "string") { return Array.from(window.document.querySelectorAll(target2)).some((el) => el === event.target || event.composedPath().includes(el)); } else { const el = unrefElement(target2); return el && (event.target === el || event.composedPath().includes(el)); } }); }; const listener = (event) => { const el = unrefElement(target); if (!el || el === event.target || event.composedPath().includes(el)) return; if (event.detail === 0) shouldListen = !shouldIgnore(event); if (!shouldListen) { shouldListen = true; return; } handler(event); }; const cleanup = [ useEventListener(window, "click", listener, { passive: true, capture }), useEventListener(window, "pointerdown", (e) => { const el = unrefElement(target); shouldListen = !shouldIgnore(e) && !!(el && !e.composedPath().includes(el)); }, { passive: true }), detectIframe && useEventListener(window, "blur", (event) => { setTimeout(() => { var _a; const el = unrefElement(target); if (((_a = window.document.activeElement) == null ? void 0 : _a.tagName) === "IFRAME" && !(el == null ? void 0 : el.contains(window.document.activeElement))) { handler(event); } }, 0); }) ].filter(Boolean); const stop = () => cleanup.forEach((fn) => fn()); return stop; } function useMounted() { const isMounted = vue.ref(false); const instance = vue.getCurrentInstance(); if (instance) { vue.onMounted(() => { isMounted.value = true; }, instance); } return isMounted; } function useSupported(callback) { const isMounted = useMounted(); return vue.computed(() => { isMounted.value; return Boolean(callback()); }); } function useMutationObserver(target, callback, options = {}) { const { window = defaultWindow, ...mutationOptions } = options; let observer; const isSupported = useSupported(() => window && "MutationObserver" in window); const cleanup = () => { if (observer) { observer.disconnect(); observer = void 0; } }; const targets = vue.computed(() => { const value = toValue(target); const items = (Array.isArray(value) ? value : [value]).map(unrefElement).filter(notNullish); return new Set(items); }); const stopWatch = vue.watch( () => targets.value, (targets2) => { cleanup(); if (isSupported.value && targets2.size) { observer = new MutationObserver(callback); targets2.forEach((el) => observer.observe(el, mutationOptions)); } }, { immediate: true, flush: "post" } ); const takeRecords = () => { return observer == null ? void 0 : observer.takeRecords(); }; const stop = () => { cleanup(); stopWatch(); }; tryOnScopeDispose(stop); return { isSupported, stop, takeRecords }; } function useActiveElement(options = {}) { var _a; const { window = defaultWindow, deep = true, triggerOnRemoval = false } = options; const document = (_a = options.document) != null ? _a : window == null ? void 0 : window.document; const getDeepActiveElement = () => { var _a2; let element = document == null ? void 0 : document.activeElement; if (deep) { while (element == null ? void 0 : element.shadowRoot) element = (_a2 = element == null ? void 0 : element.shadowRoot) == null ? void 0 : _a2.activeElement; } return element; }; const activeElement = vue.ref(); const trigger = () => { activeElement.value = getDeepActiveElement(); }; if (window) { useEventListener(window, "blur", (event) => { if (event.relatedTarget !== null) return; trigger(); }, true); useEventListener(window, "focus", trigger, true); } if (triggerOnRemoval) { useMutationObserver(document, (mutations) => { mutations.filter((m) => m.removedNodes.length).map((n) => Array.from(n.removedNodes)).flat().forEach((node) => { if (node === activeElement.value) trigger(); }); }, { childList: true, subtree: true }); } trigger(); return activeElement; } function useMediaQuery(query, options = {}) { const { window = defaultWindow } = options; const isSupported = useSupported(() => window && "matchMedia" in window && typeof window.matchMedia === "function"); let mediaQuery; const matches = vue.ref(false); const handler = (event) => { matches.value = event.matches; }; const cleanup = () => { if (!mediaQuery) return; if ("removeEventListener" in mediaQuery) mediaQuery.removeEventListener("change", handler); else mediaQuery.removeListener(handler); }; const stopWatch = vue.watchEffect(() => { if (!isSupported.value) return; cleanup(); mediaQuery = window.matchMedia(toValue(query)); if ("addEventListener" in mediaQuery) mediaQuery.addEventListener("change", handler); else mediaQuery.addListener(handler); matches.value = mediaQuery.matches; }); tryOnScopeDispose(() => { stopWatch(); cleanup(); mediaQuery = void 0; }); return matches; } function cloneFnJSON(source) { return JSON.parse(JSON.stringify(source)); } function useCssVar(prop, target, options = {}) { const { window = defaultWindow, initialValue = "", observe = false } = options; const variable = vue.ref(initialValue); const elRef = vue.computed(() => { var _a; return unrefElement(target) || ((_a = window == null ? void 0 : window.document) == null ? void 0 : _a.documentElement); }); function updateCssVar() { var _a; const key = toValue(prop); const el = toValue(elRef); if (el && window) { const value = (_a = window.getComputedStyle(el).getPropertyValue(key)) == null ? void 0 : _a.trim(); variable.value = value || initialValue; } } if (observe) { useMutationObserver(elRef, updateCssVar, { attributeFilter: ["style", "class"], window }); } vue.watch( [elRef, () => toValue(prop)], updateCssVar, { immediate: true } ); vue.watch( variable, (val) => { var _a; if ((_a = elRef.value) == null ? void 0 : _a.style) elRef.value.style.setProperty(toValue(prop), val); } ); return variable; } function useDocumentVisibility(options = {}) { const { document = defaultDocument } = options; if (!document) return vue.ref("visible"); const visibility = vue.ref(document.visibilityState); useEventListener(document, "visibilitychange", () => { visibility.value = document.visibilityState; }); return visibility; } function useResizeObserver(target, callback, options = {}) { const { window = defaultWindow, ...observerOptions } = options; let observer; const isSupported = useSupported(() => window && "ResizeObserver" in window); const cleanup = () => { if (observer) { observer.disconnect(); observer = void 0; } }; const targets = vue.computed(() => Array.isArray(target) ? target.map((el) => unrefElement(el)) : [unrefElement(target)]); const stopWatch = vue.watch( targets, (els) => { cleanup(); if (isSupported.value && window) { observer = new ResizeObserver(callback); for (const _el of els) _el && observer.observe(_el, observerOptions); } }, { immediate: true, flush: "post" } ); const stop = () => { cleanup(); stopWatch(); }; tryOnScopeDispose(stop); return { isSupported, stop }; } function useElementBounding(target, options = {}) { const { reset = true, windowResize = true, windowScroll = true, immediate = true } = options; const height = vue.ref(0); const bottom = vue.ref(0); const left = vue.ref(0); const right = vue.ref(0); const top = vue.ref(0); const width = vue.ref(0); const x = vue.ref(0); const y = vue.ref(0); function update() { const el = unrefElement(target); if (!el) { if (reset) { height.value = 0; bottom.value = 0; left.value = 0; right.value = 0; top.value = 0; width.value = 0; x.value = 0; y.value = 0; } return; } const rect = el.getBoundingClientRect(); height.value = rect.height; bottom.value = rect.bottom; left.value = rect.left; right.value = rect.right; top.value = rect.top; width.value = rect.width; x.value = rect.x; y.value = rect.y; } useResizeObserver(target, update); vue.watch(() => unrefElement(target), (ele) => !ele && update()); useMutationObserver(target, update, { attributeFilter: ["style", "class"] }); if (windowScroll) useEventListener("scroll", update, { capture: true, passive: true }); if (windowResize) useEventListener("resize", update, { passive: true }); tryOnMounted(() => { if (immediate) update(); }); return { height, bottom, left, right, top, width, x, y, update }; } function useVModel(props, key, emit, options = {}) { var _a, _b, _c; const { clone = false, passive = false, eventName, deep = false, defaultValue, shouldEmit } = options; const vm = vue.getCurrentInstance(); const _emit = emit || (vm == null ? void 0 : vm.emit) || ((_a = vm == null ? void 0 : vm.$emit) == null ? void 0 : _a.bind(vm)) || ((_c = (_b = vm == null ? void 0 : vm.proxy) == null ? void 0 : _b.$emit) == null ? void 0 : _c.bind(vm == null ? void 0 : vm.proxy)); let event = eventName; if (!key) { { key = "modelValue"; } } event = event || `update:${key.toString()}`; const cloneFn = (val) => !clone ? val : typeof clone === "function" ? clone(val) : cloneFnJSON(val); const getValue = () => isDef(props[key]) ? cloneFn(props[key]) : defaultValue; const triggerEmit = (value) => { if (shouldEmit) { if (shouldEmit(value)) _emit(event, value); } else { _emit(event, value); } }; if (passive) { const initialValue = getValue(); const proxy = vue.ref(initialValue); let isUpdating = false; vue.watch( () => props[key], (v) => { if (!isUpdating) { isUpdating = true; proxy.value = cloneFn(v); vue.nextTick(() => isUpdating = false); } } ); vue.watch( proxy, (v) => { if (!isUpdating && (v !== props[key] || deep)) triggerEmit(v); }, { deep } ); return proxy; } else { return vue.computed({ get() { return getValue(); }, set(value) { triggerEmit(value); } }); } } function useWindowFocus(options = {}) { const { window = defaultWindow } = options; if (!window) return vue.ref(false); const focused = vue.ref(window.document.hasFocus()); useEventListener(window, "blur", () => { focused.value = false; }); useEventListener(window, "focus", () => { focused.value = true; }); return focused; } function useWindowSize(options = {}) { const { window = defaultWindow, initialWidth = Number.POSITIVE_INFINITY, initialHeight = Number.POSITIVE_INFINITY, listenOrientation = true, includeScrollbar = true } = options; const width = vue.ref(initialWidth); const height = vue.ref(initialHeight); const update = () => { if (window) { if (includeScrollbar) { width.value = window.innerWidth; height.value = window.innerHeight; } else { width.value = window.document.documentElement.clientWidth; height.value = window.document.documentElement.clientHeight; } } }; update(); tryOnMounted(update); useEventListener("resize", update, { passive: true }); if (listenOrientation) { const matches = useMediaQuery("(orientation: portrait)"); vue.watch(matches, () => update()); } return { width, height }; } const isFirefox = () => isClient && /firefox/i.test(window.navigator.userAgent); const isInContainer = (el, container) => { if (!isClient || !el || !container) return false; const elRect = el.getBoundingClientRect(); let containerRect; if (container instanceof Element) { containerRect = container.getBoundingClientRect(); } else { containerRect = { top: 0, right: window.innerWidth, bottom: window.innerHeight, left: 0 }; } return elRect.top < containerRect.bottom && elRect.bottom > containerRect.top && elRect.right > containerRect.left && elRect.left < containerRect.right; }; const getOffsetTop = (el) => { let offset = 0; let parent = el; while (parent) { offset += parent.offsetTop; parent = parent.offsetParent; } return offset; }; const getOffsetTopDistance = (el, containerEl) => { return Math.abs(getOffsetTop(el) - getOffsetTop(containerEl)); }; const getClientXY = (event) => { let clientX; let clientY; if (event.type === "touchend") { clientY = event.changedTouches[0].clientY; clientX = event.changedTouches[0].clientX; } else if (event.type.startsWith("touch")) { clientY = event.touches[0].clientY; clientX = event.touches[0].clientX; } else { clientY = event.clientY; clientX = event.clientX; } return { clientX, clientY }; }; function easeInOutCubic(t, b, c, d) { const cc = c - b; t /= d / 2; if (t < 1) { return cc / 2 * t * t * t + b; } return cc / 2 * ((t -= 2) * t * t + 2) + b; } const NOOP = () => { }; const hasOwnProperty$p = Object.prototype.hasOwnProperty; const hasOwn = (val, key) => hasOwnProperty$p.call(val, key); const isArray$1 = Array.isArray; const isDate$1 = (val) => toTypeString(val) === "[object Date]"; const isFunction$1 = (val) => typeof val === "function"; const isString$1 = (val) => typeof val === "string"; const isObject$1 = (val) => val !== null && typeof val === "object"; const isPromise = (val) => { return isObject$1(val) && isFunction$1(val.then) && isFunction$1(val.catch); }; const objectToString$1 = Object.prototype.toString; const toTypeString = (value) => objectToString$1.call(value); const isPlainObject$1 = (val) => toTypeString(val) === "[object Object]"; 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$2 = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1)); var freeGlobal = typeof global == "object" && global && global.Object === Object && global; var freeSelf = typeof self == "object" && self && self.Object === Object && self; var root = freeGlobal || freeSelf || Function("return this")(); var Symbol$1 = root.Symbol; var objectProto$s = Object.prototype; var hasOwnProperty$o = objectProto$s.hasOwnProperty; var nativeObjectToString$3 = objectProto$s.toString; var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : void 0; function getRawTag(value) { var isOwn = hasOwnProperty$o.call(value, symToStringTag$1), tag = value[symToStringTag$1]; try { value[symToStringTag$1] = void 0; var unmasked = true; } catch (e) { } var result = nativeObjectToString$3.call(value); if (unmasked) { if (isOwn) { value[symToStringTag$1] = tag; } else { delete value[symToStringTag$1]; } } return result; } var objectProto$r = Object.prototype; var nativeObjectToString$2 = objectProto$r.toString; function objectToString(value) { return nativeObjectToString$2.call(value); } var nullTag = "[object Null]"; var undefinedTag = "[object Undefined]"; var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : void 0; function baseGetTag(value) { if (value == null) { return value === void 0 ? undefinedTag : nullTag; } return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value); } function isObjectLike(value) { return value != null && typeof value == "object"; } var symbolTag$3 = "[object Symbol]"; function isSymbol(value) { return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag$3; } var NAN$2 = 0 / 0; function baseToNumber(value) { if (typeof value == "number") { return value; } if (isSymbol(value)) { return NAN$2; } return +value; } 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; } var isArray = Array.isArray; var INFINITY$5 = 1 / 0; var symbolProto$2 = Symbol$1 ? Symbol$1.prototype : void 0; var symbolToString = symbolProto$2 ? symbolProto$2.toString : void 0; function baseToString(value) { if (typeof value == "string") { return value; } if (isArray(value)) { return arrayMap(value, baseToString) + ""; } if (isSymbol(value)) { return symbolToString ? symbolToString.call(value) : ""; } var result = value + ""; return result == "0" && 1 / value == -INFINITY$5 ? "-0" : result; } function createMathOperation(operator, defaultValue) { return function(value, other) { var result; if (value === void 0 && other === void 0) { return defaultValue; } if (value !== void 0) { result = value; } if (other !== void 0) { if (result === void 0) { return other; } if (typeof value == "string" || typeof other == "string") { value = baseToString(value); other = baseToString(other); } else { value = baseToNumber(value); other = baseToNumber(other); } result = operator(value, other); } return result; }; } var add = createMathOperation(function(augend, addend) { return augend + addend; }, 0); var reWhitespace = /\s/; function trimmedEndIndex(string) { var index = string.length; while (index-- && reWhitespace.test(string.charAt(index))) { } return index; } var reTrimStart$2 = /^\s+/; function baseTrim(string) { return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart$2, "") : string; } function isObject(value) { var type = typeof value; return value != null && (type == "object" || type == "function"); } var NAN$1 = 0 / 0; var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; var reIsBinary = /^0b[01]+$/i; var reIsOctal = /^0o[0-7]+$/i; var freeParseInt = parseInt; function toNumber(value) { if (typeof value == "number") { return value; } if (isSymbol(value)) { return NAN$1; } if (isObject(value)) { var other = typeof value.valueOf == "function" ? value.valueOf() : value; value = isObject(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$1 : +value; } var INFINITY$4 = 1 / 0; var MAX_INTEGER = 17976931348623157e292; function toFinite(value) { if (!value) { return value === 0 ? value : 0; } value = toNumber(value); if (value === INFINITY$4 || value === -INFINITY$4) { var sign = value < 0 ? -1 : 1; return sign * MAX_INTEGER; } return value === value ? value : 0; } function toInteger(value) { var result = toFinite(value), remainder = result % 1; return result === result ? remainder ? result - remainder : result : 0; } var FUNC_ERROR_TEXT$b = "Expected a function"; function after(n, func) { if (typeof func != "function") { throw new TypeError(FUNC_ERROR_TEXT$b); } n = toInteger(n); return function() { if (--n < 1) { return func.apply(this, arguments); } }; } function identity(value) { return value; } var asyncTag = "[object AsyncFunction]"; var funcTag$2 = "[object Function]"; var genTag$1 = "[object GeneratorFunction]"; var proxyTag = "[object Proxy]"; function isFunction(value) { if (!isObject(value)) { return false; } var tag = baseGetTag(value); return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag; } var coreJsData = root["__core-js_shared__"]; var maskSrcKey = function() { var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ""); return uid ? "Symbol(src)_1." + uid : ""; }(); function isMasked(func) { return !!maskSrcKey && maskSrcKey in func; } var funcProto$2 = Function.prototype; var funcToString$2 = funcProto$2.toString; function toSource(func) { if (func != null) { try { return funcToString$2.call(func); } catch (e) { } try { return func + ""; } catch (e) { } } return ""; } var reRegExpChar$1 = /[\\^$.*+?()[\]{}|]/g; var reIsHostCtor = /^\[object .+?Constructor\]$/; var funcProto$1 = Function.prototype; var objectProto$q = Object.prototype; var funcToString$1 = funcProto$1.toString; var hasOwnProperty$n = objectProto$q.hasOwnProperty; var reIsNative = RegExp("^" + funcToString$1.call(hasOwnProperty$n).replace(reRegExpChar$1, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"); function baseIsNative(value) { if (!isObject(value) || isMasked(value)) { return false; } var pattern = isFunction(value) ? reIsNative : reIsHostCtor; return pattern.test(toSource(value)); } function getValue$1(object, key) { return object == null ? void 0 : object[key]; } function getNative(object, key) { var value = getValue$1(object, key); return baseIsNative(value) ? value : void 0; } var WeakMap = getNative(root, "WeakMap"); var metaMap = WeakMap && new WeakMap(); var baseSetData = !metaMap ? identity : function(func, data) { metaMap.set(func, data); return func; }; var objectCreate = Object.create; var baseCreate = function() { function object() { } return function(proto) { if (!isObject(proto)) { return {}; } if (objectCreate) { return objectCreate(proto); } object.prototype = proto; var result = new object(); object.prototype = void 0; return result; }; }(); 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), result = Ctor.apply(thisBinding, args); return isObject(result) ? result : thisBinding; }; } var WRAP_BIND_FLAG$8 = 1; function createBind(func, bitmask, thisArg) { var isBind = bitmask & WRAP_BIND_FLAG$8, 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 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); } var nativeMax$g = Math.max; function composeArgs(args, partials, holders, isCurried) { var argsIndex = -1, argsLength = args.length, holdersLength = holders.length, leftIndex = -1, leftLength = partials.length, rangeLength = nativeMax$g(argsLength - holdersLength, 0), result = Array(leftLength + rangeLength), isUncurried = !isCurried; while (++leftIndex < leftLength) { result[leftIndex] = partials[leftIndex]; } while (++argsIndex < holdersLength) { if (isUncurried || argsIndex < argsLength) { result[holders[argsIndex]] = args[argsIndex]; } } while (rangeLength--) { result[leftIndex++] = args[argsIndex++]; } return result; } var nativeMax$f = Math.max; function composeArgsRight(args, partials, holders, isCurried) { var argsIndex = -1, argsLength = args.length, holdersIndex = -1, holdersLength = holders.length, rightIndex = -1, rightLength = partials.length, rangeLength = nativeMax$f(argsLength - holdersLength, 0), result = Array(rangeLength + rightLength), isUncurried = !isCurried; while (++argsIndex < rangeLength) { result[argsIndex] = args[argsIndex]; } var offset = argsIndex; while (++rightIndex < rightLength) { result[offset + rightIndex] = partials[rightIndex]; } while (++holdersIndex < holdersLength) { if (isUncurried || argsIndex < argsLength) { result[offset + holders[holdersIndex]] = args[argsIndex++]; } } return result; } function countHolders(array, placeholder) { var length = array.length, result = 0; while (length--) { if (array[length] === placeholder) { ++result; } } return result; } function baseLodash() { } var MAX_ARRAY_LENGTH$6 = 4294967295; function LazyWrapper(value) { this.__wrapped__ = value; this.__actions__ = []; this.__dir__ = 1; this.__filtered__ = false; this.__iteratees__ = []; this.__takeCount__ = MAX_ARRAY_LENGTH$6; this.__views__ = []; } LazyWrapper.prototype = baseCreate(baseLodash.prototype); LazyWrapper.prototype.constructor = LazyWrapper; function noop() { } var getData = !metaMap ? noop : function(func) { return metaMap.get(func); }; var realNames = {}; var objectProto$p = Object.prototype; var hasOwnProperty$m = objectProto$p.hasOwnProperty; function getFuncName(func) { var result = func.name + "", array = realNames[result], length = hasOwnProperty$m.call(realNames, result) ? array.length : 0; while (length--) { var data = array[length], otherFunc = data.func; if (otherFunc == null || otherFunc == func) { return data.name; } } return result; } function LodashWrapper(value, chainAll) { this.__wrapped__ = value; this.__actions__ = []; this.__chain__ = !!chainAll; this.__index__ = 0; this.__values__ = void 0; } LodashWrapper.prototype = baseCreate(baseLodash.prototype); LodashWrapper.prototype.constructor = LodashWrapper; function copyArray(source, array) { var index = -1, length = source.length; array || (array = Array(length)); while (++index < length) { array[index] = source[index]; } return array; } function wrapperClone(wrapper) { if (wrapper instanceof LazyWrapper) { return wrapper.clone(); } var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__); result.__actions__ = copyArray(wrapper.__actions__); result.__index__ = wrapper.__index__; result.__values__ = wrapper.__values__; return result; } var objectProto$o = Object.prototype; var hasOwnProperty$l = objectProto$o.hasOwnProperty; function lodash(value) { if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) { if (value instanceof LodashWrapper) { return value; } if (hasOwnProperty$l.call(value, "__wrapped__")) { return wrapperClone(value); } } return new LodashWrapper(value); } lodash.prototype = baseLodash.prototype; lodash.prototype.constructor = lodash; function isLaziable(func) { var funcName = getFuncName(func), other = lodash[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]; } var HOT_COUNT = 800; var HOT_SPAN = 16; var nativeNow = Date.now; 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(void 0, arguments); }; } var setData = shortOut(baseSetData); var reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/; var reSplitDetails = /,? & /; function getWrapDetails(source) { var match = source.match(reWrapDetails); return match ? match[1].split(reSplitDetails) : []; } var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/; 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 constant(value) { return function() { return value; }; } var defineProperty = function() { try { var func = getNative(Object, "defineProperty"); func({}, "", {}); return func; } catch (e) { } }(); var baseSetToString = !defineProperty ? identity : function(func, string) { return defineProperty(func, "toString", { "configurable": true, "enumerable": false, "value": constant(string), "writable": true }); }; var setToString = shortOut(baseSetToString); 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 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 baseIsNaN(value) { return value !== value; } function strictIndexOf(array, value, fromIndex) { var index = fromIndex - 1, length = array.length; while (++index < length) { if (array[index] === value) { return index; } } return -1; } function baseIndexOf(array, value, fromIndex) { return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex); } function arrayIncludes(array, value) { var length = array == null ? 0 : array.length; return !!length && baseIndexOf(array, value, 0) > -1; } var WRAP_BIND_FLAG$7 = 1; var WRAP_BIND_KEY_FLAG$6 = 2; var WRAP_CURRY_FLAG$6 = 8; var WRAP_CURRY_RIGHT_FLAG$3 = 16; var WRAP_PARTIAL_FLAG$6 = 32; var WRAP_PARTIAL_RIGHT_FLAG$3 = 64; var WRAP_ARY_FLAG$4 = 128; var WRAP_REARG_FLAG$3 = 256; var WRAP_FLIP_FLAG$2 = 512; var wrapFlags = [ ["ary", WRAP_ARY_FLAG$4], ["bind", WRAP_BIND_FLAG$7], ["bindKey", WRAP_BIND_KEY_FLAG$6], ["curry", WRAP_CURRY_FLAG$6], ["curryRight", WRAP_CURRY_RIGHT_FLAG$3], ["flip", WRAP_FLIP_FLAG$2], ["partial", WRAP_PARTIAL_FLAG$6], ["partialRight", WRAP_PARTIAL_RIGHT_FLAG$3], ["rearg", WRAP_REARG_FLAG$3] ]; 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 setWrapToString(wrapper, reference, bitmask) { var source = reference + ""; return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask))); } var WRAP_BIND_FLAG$6 = 1; var WRAP_BIND_KEY_FLAG$5 = 2; var WRAP_CURRY_BOUND_FLAG$1 = 4; var WRAP_CURRY_FLAG$5 = 8; var WRAP_PARTIAL_FLAG$5 = 32; var WRAP_PARTIAL_RIGHT_FLAG$2 = 64; function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) { var isCurry = bitmask & WRAP_CURRY_FLAG$5, newHolders = isCurry ? holders : void 0, newHoldersRight = isCurry ? void 0 : holders, newPartials = isCurry ? partials : void 0, newPartialsRight = isCurry ? void 0 : partials; bitmask |= isCurry ? WRAP_PARTIAL_FLAG$5 : WRAP_PARTIAL_RIGHT_FLAG$2; bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG$2 : WRAP_PARTIAL_FLAG$5); if (!(bitmask & WRAP_CURRY_BOUND_FLAG$1)) { bitmask &= ~(WRAP_BIND_FLAG$6 | WRAP_BIND_KEY_FLAG$5); } var newData = [ func, bitmask, thisArg, newPartials, newHolders, newPartialsRight, newHoldersRight, argPos, ary, arity ]; var result = wrapFunc.apply(void 0, newData); if (isLaziable(func)) { setData(result, newData); } result.placeholder = placeholder; return setWrapToString(result, func, bitmask); } function getHolder(func) { var object = func; return object.placeholder; } var MAX_SAFE_INTEGER$5 = 9007199254740991; var reIsUint = /^(?:0|[1-9]\d*)$/; function isIndex(value, length) { var type = typeof value; length = length == null ? MAX_SAFE_INTEGER$5 : length; return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length); } var nativeMin$e = Math.min; function reorder(array, indexes) { var arrLength = array.length, length = nativeMin$e(indexes.length, arrLength), oldArray = copyArray(array); while (length--) { var index = indexes[length]; array[length] = isIndex(index, arrLength) ? oldArray[index] : void 0; } return array; } var PLACEHOLDER$1 = "__lodash_placeholder__"; 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$1) { array[index] = PLACEHOLDER$1; result[resIndex++] = index; } } return result; } var WRAP_BIND_FLAG$5 = 1; var WRAP_BIND_KEY_FLAG$4 = 2; var WRAP_CURRY_FLAG$4 = 8; var WRAP_CURRY_RIGHT_FLAG$2 = 16; var WRAP_ARY_FLAG$3 = 128; var WRAP_FLIP_FLAG$1 = 512; function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) { var isAry = bitmask & WRAP_ARY_FLAG$3, isBind = bitmask & WRAP_BIND_FLAG$5, isBindKey = bitmask & WRAP_BIND_KEY_FLAG$4, isCurried = bitmask & (WRAP_CURRY_FLAG$4 | WRAP_CURRY_RIGHT_FLAG$2), isFlip = bitmask & WRAP_FLIP_FLAG$1, Ctor = isBindKey ? void 0 : createCtor(func); function wrapper() { var length = arguments.length, args = Array(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, ary, 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 && ary < length) { args.length = ary; } if (this && this !== root && this instanceof wrapper) { fn = Ctor || createCtor(fn); } return fn.apply(thisBinding, args); } return wrapper; } function createCurry(func, bitmask, arity) { var Ctor = createCtor(func); function wrapper() { var length = arguments.length, args = Array(length), index = length, placeholder = getHold