UNPKG

element-plus

Version:

A Component Library for Vue 3

1,609 lines (1,570 loc) 2.12 MB
/*! Element Plus v2.13.6 */ (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) { Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } }); //#region \0rolldown/runtime.js var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports); var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) { key = keys[i]; if (!__hasOwnProp.call(to, key) && key !== except) { __defProp(to, key, { get: ((k) => from[k]).bind(null, key), enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } } } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod)); //#endregion //#region ../../packages/utils/dom/aria.ts 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 isShadowRoot$1 = (e) => { if (typeof ShadowRoot === "undefined") return false; return e instanceof ShadowRoot; }; const isHTMLElement$1 = (e) => { if (typeof Element === "undefined") return false; return e instanceof Element; }; /** * Determine if the testing element is visible on screen no matter if its on the viewport or not */ const isVisible = (element) => { return getComputedStyle(element).position === "fixed" ? false : element.offsetParent !== null; }; const obtainAllFocusableElements$1 = (element) => { return Array.from(element.querySelectorAll(FOCUSABLE_ELEMENT_SELECTORS)).filter((item) => isFocusable(item) && isVisible(item)); }; /** * @desc Determine if target element is focusable * @param element {HTMLElement} * @returns {Boolean} true if it is focusable */ 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; } }; /** * Trigger an event * mouseenter, mouseleave, mouseover, keyup, change, click, etc. * @param {HTMLElement} elm * @param {String} name * @param {*} opts */ 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); return siblings[Array.prototype.indexOf.call(siblings, el) + distance] || null; }; const focusElement = (el, options) => { if (!el || !el.focus) return; let cleanup = false; if (isHTMLElement$1(el) && !isFocusable(el) && !el.getAttribute("tabindex")) { el.setAttribute("tabindex", "-1"); cleanup = true; } el.focus(options); if (isHTMLElement$1(el) && cleanup) el.removeAttribute("tabindex"); }; const focusNode = (el) => { if (!el) return; focusElement(el); !isLeaf(el) && el.click(); }; //#endregion //#region ../../packages/constants/aria.ts const EVENT_CODE = { tab: "Tab", enter: "Enter", space: "Space", left: "ArrowLeft", up: "ArrowUp", right: "ArrowRight", down: "ArrowDown", esc: "Escape", delete: "Delete", backspace: "Backspace", numpadEnter: "NumpadEnter", pageUp: "PageUp", pageDown: "PageDown", home: "Home", end: "End" }; //#endregion //#region ../../packages/constants/date.ts const datePickTypes = [ "year", "years", "month", "months", "date", "dates", "week", "datetime", "datetimerange", "daterange", "monthrange", "yearrange" ]; const WEEK_DAYS = [ "sun", "mon", "tue", "wed", "thu", "fri", "sat" ]; //#endregion //#region ../../packages/constants/event.ts const UPDATE_MODEL_EVENT = "update:modelValue"; const CHANGE_EVENT = "change"; const INPUT_EVENT = "input"; //#endregion //#region ../../packages/constants/key.ts const INSTALLED_KEY = Symbol("INSTALLED_KEY"); //#endregion //#region ../../packages/constants/size.ts const componentSizes = [ "", "default", "small", "large" ]; const componentSizeMap = { large: 40, default: 32, small: 24 }; //#endregion //#region ../../packages/constants/column-alignment.ts const columnAlignment = [ "left", "center", "right" ]; //#endregion //#region ../../packages/constants/form.ts const MINIMUM_INPUT_WIDTH = 11; const BORDER_HORIZONTAL_WIDTH = 2; //#endregion //#region ../../node_modules/.pnpm/@vueuse+shared@12.0.0_typescript@5.5.4/node_modules/@vueuse/shared/index.mjs function computedEager(fn, options) { var _a; const result = (0, vue.shallowRef)(); (0, vue.watchEffect)(() => { result.value = fn(); }, { ...options, flush: (_a = options == null ? void 0 : options.flush) != null ? _a : "sync" }); return (0, vue.readonly)(result); } function tryOnScopeDispose(fn) { if ((0, vue.getCurrentScope)()) { (0, vue.onScopeDispose)(fn); return true; } return false; } function toValue$1(r) { return typeof r === "function" ? r() : (0, vue.unref)(r); } function toReactive(objectRef) { if (!(0, vue.isRef)(objectRef)) return (0, vue.reactive)(objectRef); return (0, vue.reactive)(new Proxy({}, { get(_, p, receiver) { return (0, vue.unref)(Reflect.get(objectRef.value, p, receiver)); }, set(_, p, value) { if ((0, vue.isRef)(objectRef.value[p]) && !(0, vue.isRef)(value)) objectRef.value[p].value = value; else objectRef.value[p] = value; return true; }, deleteProperty(_, p) { return Reflect.deleteProperty(objectRef.value, p); }, has(_, p) { return Reflect.has(objectRef.value, p); }, ownKeys() { return Object.keys(objectRef.value); }, getOwnPropertyDescriptor() { return { enumerable: true, configurable: true }; } })); } function reactiveComputed(fn) { return toReactive((0, vue.computed)(fn)); } const isClient = typeof window !== "undefined" && typeof document !== "undefined"; const isWorker = 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 clamp$2 = (n, min, max) => Math.min(max, Math.max(min, n)); 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$1(ms); const maxDuration = toValue$1(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 (!(0, 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$1(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 cacheStringFunction$1(fn) { const cache = /* @__PURE__ */ Object.create(null); return (str) => { return cache[str] || (cache[str] = fn(str)); }; } const hyphenateRE$1 = /\B([A-Z])/g; const hyphenate$1 = cacheStringFunction$1((str) => str.replace(hyphenateRE$1, "-$1").toLowerCase()); const camelizeRE$1 = /-(\w)/g; const camelize$1 = cacheStringFunction$1((str) => { return str.replace(camelizeRE$1, (_, c) => c ? c.toUpperCase() : ""); }); function getLifeCycleTarget(target) { return target || (0, vue.getCurrentInstance)(); } function useDebounceFn(fn, ms = 200, options = {}) { return createFilterWrapper(debounceFilter(ms, options), fn); } function refDebounced(value, ms = 200, options = {}) { const debounced = (0, vue.ref)(value.value); const updater = useDebounceFn(() => { debounced.value = value.value; }, ms, options); (0, 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) { if (getLifeCycleTarget()) (0, vue.onMounted)(fn, target); else if (sync) fn(); else (0, vue.nextTick)(fn); } function useTimeoutFn(cb, interval, options = {}) { const { immediate = true } = options; const isPending = (0, 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$1(interval)); } if (immediate) { isPending.value = true; if (isClient) start(); } tryOnScopeDispose(stop); return { isPending: (0, vue.readonly)(isPending), start, stop }; } //#endregion //#region ../../node_modules/.pnpm/@vueuse+core@12.0.0_typescript@5.5.4/node_modules/@vueuse/core/index.mjs const defaultWindow = isClient ? window : void 0; const defaultDocument = isClient ? window.document : void 0; const defaultNavigator = isClient ? window.navigator : void 0; const defaultLocation = isClient ? window.location : void 0; function unrefElement(elRef) { var _a; const plain = toValue$1(elRef); return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain; } 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 = (0, vue.watch)(() => [unrefElement(target), toValue$1(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 toValue$1(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)); } }); }; function hasMultipleRoots(target2) { const vm = toValue$1(target2); return vm && vm.$.subTree.shapeFlag === 16; } function checkMultipleRoots(target2, event) { const vm = toValue$1(target2); const children = vm.$.subTree && vm.$.subTree.children; if (children == null || !Array.isArray(children)) return false; return children.some((child) => child.el === event.target || event.composedPath().includes(child.el)); } const listener = (event) => { const el = unrefElement(target); if (event.target == null) return; if (!(el instanceof Element) && hasMultipleRoots(target) && checkMultipleRoots(target, event)) return; if (!el || el === event.target || event.composedPath().includes(el)) return; if (event.detail === 0) shouldListen = !shouldIgnore(event); if (!shouldListen) { shouldListen = true; return; } handler(event); }; let isProcessingClick = false; const cleanup = [ useEventListener(window, "click", (event) => { if (!isProcessingClick) { isProcessingClick = true; setTimeout(() => { isProcessingClick = false; }, 0); listener(event); } }, { 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 = (0, vue.ref)(false); const instance = (0, vue.getCurrentInstance)(); if (instance) (0, vue.onMounted)(() => { isMounted.value = true; }, instance); return isMounted; } function useSupported(callback) { const isMounted = useMounted(); return (0, 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 = (0, vue.computed)(() => { const value = toValue$1(target); const items = (Array.isArray(value) ? value : [value]).map(unrefElement).filter(notNullish); return new Set(items); }); const stopWatch = (0, 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 = () => { stopWatch(); cleanup(); }; 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 = (0, 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 = (0, 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 = (0, vue.watchEffect)(() => { if (!isSupported.value) return; cleanup(); mediaQuery = window.matchMedia(toValue$1(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 = (0, vue.ref)(initialValue); const elRef = (0, 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$1(prop); const el = toValue$1(elRef); if (el && window && key) variable.value = ((_a = window.getComputedStyle(el).getPropertyValue(key)) == null ? void 0 : _a.trim()) || initialValue; } if (observe) useMutationObserver(elRef, updateCssVar, { attributeFilter: ["style", "class"], window }); (0, vue.watch)([elRef, () => toValue$1(prop)], (_, old) => { if (old[0] && old[1]) old[0].style.removeProperty(old[1]); updateCssVar(); }, { immediate: true }); (0, vue.watch)(variable, (val) => { var _a; const raw_prop = toValue$1(prop); if (((_a = elRef.value) == null ? void 0 : _a.style) && raw_prop) if (val == null) elRef.value.style.removeProperty(raw_prop); else elRef.value.style.setProperty(raw_prop, val); }); return variable; } function useDocumentVisibility(options = {}) { const { document = defaultDocument } = options; if (!document) return (0, vue.ref)("visible"); const visibility = (0, 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 stopWatch = (0, vue.watch)((0, vue.computed)(() => { const _targets = toValue$1(target); return Array.isArray(_targets) ? _targets.map((el) => unrefElement(el)) : [unrefElement(_targets)]; }), (els) => { cleanup(); if (isSupported.value && window) { observer = new ResizeObserver(callback); for (const _el of els) if (_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, updateTiming = "sync" } = options; const height = (0, vue.ref)(0); const bottom = (0, vue.ref)(0); const left = (0, vue.ref)(0); const right = (0, vue.ref)(0); const top = (0, vue.ref)(0); const width = (0, vue.ref)(0); const x = (0, vue.ref)(0); const y = (0, vue.ref)(0); function recalculate() { 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; } function update() { if (updateTiming === "sync") recalculate(); else if (updateTiming === "next-frame") requestAnimationFrame(() => recalculate()); } useResizeObserver(target, update); (0, 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 useElementSize(target, initialSize = { width: 0, height: 0 }, options = {}) { const { window = defaultWindow, box = "content-box" } = options; const isSVG = (0, vue.computed)(() => { var _a, _b; return (_b = (_a = unrefElement(target)) == null ? void 0 : _a.namespaceURI) == null ? void 0 : _b.includes("svg"); }); const width = (0, vue.ref)(initialSize.width); const height = (0, vue.ref)(initialSize.height); const { stop: stop1 } = useResizeObserver(target, ([entry]) => { const boxSize = box === "border-box" ? entry.borderBoxSize : box === "content-box" ? entry.contentBoxSize : entry.devicePixelContentBoxSize; if (window && isSVG.value) { const $elem = unrefElement(target); if ($elem) { const rect = $elem.getBoundingClientRect(); width.value = rect.width; height.value = rect.height; } } else if (boxSize) { const formatBoxSize = Array.isArray(boxSize) ? boxSize : [boxSize]; width.value = formatBoxSize.reduce((acc, { inlineSize }) => acc + inlineSize, 0); height.value = formatBoxSize.reduce((acc, { blockSize }) => acc + blockSize, 0); } else { width.value = entry.contentRect.width; height.value = entry.contentRect.height; } }, options); tryOnMounted(() => { const ele = unrefElement(target); if (ele) { width.value = "offsetWidth" in ele ? ele.offsetWidth : initialSize.width; height.value = "offsetHeight" in ele ? ele.offsetHeight : initialSize.height; } }); const stop2 = (0, vue.watch)(() => unrefElement(target), (ele) => { width.value = ele ? initialSize.width : 0; height.value = ele ? initialSize.height : 0; }); function stop() { stop1(); stop2(); } return { width, height, stop }; } function useIntersectionObserver(target, callback, options = {}) { const { root, rootMargin = "0px", threshold = 0, window = defaultWindow, immediate = true } = options; const isSupported = useSupported(() => window && "IntersectionObserver" in window); const targets = (0, vue.computed)(() => { const _target = toValue$1(target); return (Array.isArray(_target) ? _target : [_target]).map(unrefElement).filter(notNullish); }); let cleanup = noop$1; const isActive = (0, vue.ref)(immediate); const stopWatch = isSupported.value ? (0, vue.watch)(() => [ targets.value, unrefElement(root), isActive.value ], ([targets2, root2]) => { cleanup(); if (!isActive.value) return; if (!targets2.length) return; const observer = new IntersectionObserver(callback, { root: unrefElement(root2), rootMargin, threshold }); targets2.forEach((el) => el && observer.observe(el)); cleanup = () => { observer.disconnect(); cleanup = noop$1; }; }, { immediate, flush: "post" }) : noop$1; const stop = () => { cleanup(); stopWatch(); isActive.value = false; }; tryOnScopeDispose(stop); return { isSupported, isActive, pause() { cleanup(); isActive.value = false; }, resume() { isActive.value = true; }, stop }; } const DEFAULT_UNITS = [ { max: 6e4, value: 1e3, name: "second" }, { max: 276e4, value: 6e4, name: "minute" }, { max: 72e6, value: 36e5, name: "hour" }, { max: 5184e5, value: 864e5, name: "day" }, { max: 24192e5, value: 6048e5, name: "week" }, { max: 28512e6, value: 2592e6, name: "month" }, { max: Number.POSITIVE_INFINITY, value: 31536e6, name: "year" } ]; function useVModel(props, key, emit, options = {}) { var _a, _b, _c; const { clone = false, passive = false, eventName, deep = false, defaultValue, shouldEmit } = options; const vm = (0, 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 proxy = (0, vue.ref)(getValue()); let isUpdating = false; (0, vue.watch)(() => props[key], (v) => { if (!isUpdating) { isUpdating = true; proxy.value = cloneFn(v); (0, vue.nextTick)(() => isUpdating = false); } }); (0, vue.watch)(proxy, (v) => { if (!isUpdating && (v !== props[key] || deep)) triggerEmit(v); }, { deep }); return proxy; } else return (0, vue.computed)({ get() { return getValue(); }, set(value) { triggerEmit(value); } }); } function useWindowFocus(options = {}) { const { window = defaultWindow } = options; if (!window) return (0, vue.ref)(false); const focused = (0, 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, type = "inner" } = options; const width = (0, vue.ref)(initialWidth); const height = (0, vue.ref)(initialHeight); const update = () => { if (window) if (type === "outer") { width.value = window.outerWidth; height.value = window.outerHeight; } else 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) (0, vue.watch)(useMediaQuery("(orientation: portrait)"), () => update()); return { width, height }; } //#endregion //#region ../../packages/utils/browser.ts const isFirefox = () => isClient && /firefox/i.test(window.navigator.userAgent); const isAndroid = () => isClient && /android/i.test(window.navigator.userAgent); //#endregion //#region ../../packages/utils/dom/event.ts const composeEventHandlers = (theirsHandler, oursHandler, { checkForDefaultPrevented = true } = {}) => { const handleEvent = (event) => { const shouldPrevent = theirsHandler?.(event); if (checkForDefaultPrevented === false || !shouldPrevent) return oursHandler?.(event); }; return handleEvent; }; const whenMouse = (handler) => { return (e) => e.pointerType === "mouse" ? handler(e) : void 0; }; const getEventCode = (event) => { if (event.code && event.code !== "Unidentified") return event.code; const key = getEventKey(event); if (key) { if (Object.values(EVENT_CODE).includes(key)) return key; switch (key) { case " ": return EVENT_CODE.space; default: return ""; } } return ""; }; const getEventKey = (event) => { let key = event.key && event.key !== "Unidentified" ? event.key : ""; if (!key && event.type === "keyup" && isAndroid()) { const target = event.target; key = target.value.charAt(target.selectionStart - 1); } return key; }; //#endregion //#region ../../packages/utils/dom/position.ts 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 }; }; //#endregion //#region ../../packages/utils/easings.ts 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; } //#endregion //#region ../../node_modules/.pnpm/@vue+shared@3.5.25/node_modules/@vue/shared/dist/shared.esm-bundler.js /** * @vue/shared v3.5.25 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT **/ /* @__NO_SIDE_EFFECTS__ */ function makeMap(str) { const map = /* @__PURE__ */ Object.create(null); for (const key of str.split(",")) map[key] = 1; return (val) => val in map; } const NOOP = () => {}; const hasOwnProperty$14 = Object.prototype.hasOwnProperty; const hasOwn = (val, key) => hasOwnProperty$14.call(val, key); const isArray$1 = Array.isArray; const isDate = (val) => toTypeString(val) === "[object Date]"; const isFunction$1 = (val) => typeof val === "function"; const isString = (val) => typeof val === "string"; const isObject$1 = (val) => val !== null && typeof val === "object"; const isPromise = (val) => { return (isObject$1(val) || isFunction$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) => { return cache[str] || (cache[str] = fn(str)); }); }; const camelizeRE = /-\w/g; const camelize = cacheStringFunction((str) => { return str.replace(camelizeRE, (c) => c.slice(1).toUpperCase()); }); const hyphenateRE = /\B([A-Z])/g; const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase()); const capitalize$1 = cacheStringFunction((str) => { return str.charAt(0).toUpperCase() + str.slice(1); }); const toHandlerKey = cacheStringFunction((str) => { return str ? `on${capitalize$1(str)}` : ``; }); const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`; const isBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`); //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_freeGlobal.js /** Detect free variable `global` from Node.js. */ var freeGlobal = typeof global == "object" && global && global.Object === Object && global; //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_root.js /** Detect free variable `self`. */ var freeSelf = typeof self == "object" && self && self.Object === Object && self; /** Used as a reference to the global object. */ var root = freeGlobal || freeSelf || Function("return this")(); //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_Symbol.js /** Built-in value references. */ var Symbol$1 = root.Symbol; //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_getRawTag.js /** Used for built-in method references. */ var objectProto$4 = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty$13 = objectProto$4.hasOwnProperty; /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var nativeObjectToString$1 = objectProto$4.toString; /** Built-in value references. */ var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : void 0; /** * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. * * @private * @param {*} value The value to query. * @returns {string} Returns the raw `toStringTag`. */ function getRawTag(value) { var isOwn = hasOwnProperty$13.call(value, symToStringTag$1), tag = value[symToStringTag$1]; try { value[symToStringTag$1] = void 0; var unmasked = true; } catch (e) {} var result = nativeObjectToString$1.call(value); if (unmasked) if (isOwn) value[symToStringTag$1] = tag; else delete value[symToStringTag$1]; return result; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_objectToString.js /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var nativeObjectToString = Object.prototype.toString; /** * Converts `value` to a string using `Object.prototype.toString`. * * @private * @param {*} value The value to convert. * @returns {string} Returns the converted string. */ function objectToString(value) { return nativeObjectToString.call(value); } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseGetTag.js /** `Object#toString` result references. */ var nullTag = "[object Null]", undefinedTag = "[object Undefined]"; /** Built-in value references. */ var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : void 0; /** * The base implementation of `getTag` without fallbacks for buggy environments. * * @private * @param {*} value The value to query. * @returns {string} Returns the `toStringTag`. */ function baseGetTag(value) { if (value == null) return value === void 0 ? undefinedTag : nullTag; return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value); } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isObjectLike.js /** * Checks if `value` is object-like. A value is object-like if it's not `null` * and has a `typeof` result of "object". * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. * @example * * _.isObjectLike({}); * // => true * * _.isObjectLike([1, 2, 3]); * // => true * * _.isObjectLike(_.noop); * // => false * * _.isObjectLike(null); * // => false */ function isObjectLike(value) { return value != null && typeof value == "object"; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isSymbol.js /** `Object#toString` result references. */ var symbolTag$3 = "[object Symbol]"; /** * Checks if `value` is classified as a `Symbol` primitive or object. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. * @example * * _.isSymbol(Symbol.iterator); * // => true * * _.isSymbol('abc'); * // => false */ function isSymbol(value) { return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag$3; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_arrayMap.js /** * A specialized version of `_.map` for arrays without support for iteratee * shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the new mapped array. */ 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; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isArray.js /** * Checks if `value` is classified as an `Array` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array, else `false`. * @example * * _.isArray([1, 2, 3]); * // => true * * _.isArray(document.body.children); * // => false * * _.isArray('abc'); * // => false * * _.isArray(_.noop); * // => false */ var isArray = Array.isArray; //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseToString.js /** Used as references for various `Number` constants. */ var INFINITY$3 = Infinity; /** Used to convert symbols to primitives and strings. */ var symbolProto$2 = Symbol$1 ? Symbol$1.prototype : void 0, symbolToString = symbolProto$2 ? symbolProto$2.toString : void 0; /** * The base implementation of `_.toString` which doesn't convert nullish * values to empty strings. * * @private * @param {*} value The value to process. * @returns {string} Returns the string. */ 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$3 ? "-0" : result; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_trimmedEndIndex.js /** Used to match a single whitespace character. */ var reWhitespace = /\s/; /** * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace * character of `string`. * * @private * @param {string} string The string to inspect. * @returns {number} Returns the index of the last non-whitespace character. */ function trimmedEndIndex(string) { var index = string.length; while (index-- && reWhitespace.test(string.charAt(index))); return index; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_baseTrim.js /** Used to match leading whitespace. */ var reTrimStart = /^\s+/; /** * The base implementation of `_.trim`. * * @private * @param {string} string The string to trim. * @returns {string} Returns the trimmed string. */ function baseTrim(string) { return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isObject.js /** * Checks if `value` is the * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(_.noop); * // => true * * _.isObject(null); * // => false */ function isObject(value) { var type = typeof value; return value != null && (type == "object" || type == "function"); } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/toNumber.js /** Used as references for various `Number` constants. */ var NAN = NaN; /** Used to detect bad signed hexadecimal string values. */ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; /** Used to detect binary string values. */ var reIsBinary = /^0b[01]+$/i; /** Used to detect octal string values. */ var reIsOctal = /^0o[0-7]+$/i; /** Built-in method references without a dependency on `root`. */ var freeParseInt = parseInt; /** * Converts `value` to a number. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to process. * @returns {number} Returns the number. * @example * * _.toNumber(3.2); * // => 3.2 * * _.toNumber(Number.MIN_VALUE); * // => 5e-324 * * _.toNumber(Infinity); * // => Infinity * * _.toNumber('3.2'); * // => 3.2 */ function toNumber(value) { if (typeof value == "number") return value; if (isSymbol(value)) return NAN; 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 : +value; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/toFinite.js /** Used as references for various `Number` constants. */ var INFINITY$2 = Infinity, MAX_INTEGER = 17976931348623157e292; /** * Converts `value` to a finite number. * * @static * @memberOf _ * @since 4.12.0 * @category Lang * @param {*} value The value to convert. * @returns {number} Returns the converted number. * @example * * _.toFinite(3.2); * // => 3.2 * * _.toFinite(Number.MIN_VALUE); * // => 5e-324 * * _.toFinite(Infinity); * // => 1.7976931348623157e+308 * * _.toFinite('3.2'); * // => 3.2 */ function toFinite(value) { if (!value) return value === 0 ? value : 0; value = toNumber(value); if (value === INFINITY$2 || value === -INFINITY$2) return (value < 0 ? -1 : 1) * MAX_INTEGER; return value === value ? value : 0; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/toInteger.js /** * Converts `value` to an integer. * * **Note:** This method is loosely based on * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to convert. * @returns {number} Returns the converted integer. * @example * * _.toInteger(3.2); * // => 3 * * _.toInteger(Number.MIN_VALUE); * // => 0 * * _.toInteger(Infinity); * // => 1.7976931348623157e+308 * * _.toInteger('3.2'); * // => 3 */ function toInteger(value) { var result = toFinite(value), remainder = result % 1; return result === result ? remainder ? result - remainder : result : 0; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/identity.js /** * This method returns the first argument it receives. * * @static * @since 0.1.0 * @memberOf _ * @category Util * @param {*} value Any value. * @returns {*} Returns `value`. * @example * * var object = { 'a': 1 }; * * console.log(_.identity(object) === object); * // => true */ function identity(value) { return value; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/isFunction.js /** `Object#toString` result references. */ var asyncTag = "[object AsyncFunction]", funcTag$2 = "[object Function]", genTag$1 = "[object GeneratorFunction]", proxyTag = "[object Proxy]"; /** * Checks if `value` is classified as a `Function` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a function, else `false`. * @example * * _.isFunction(_); * // => true * * _.isFunction(/abc/); * // => false */ function isFunction(value) { if (!isObject(value)) return false; var tag = baseGetTag(value); return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_coreJsData.js /** Used to detect overreaching core-js shims. */ var coreJsData = root["__core-js_shared__"]; //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_isMasked.js /** Used to detect methods masquerading as native. */ var maskSrcKey = function() { var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ""); return uid ? "Symbol(src)_1." + uid : ""; }(); /** * Checks if `func` has its source masked. * * @private * @param {Function} func The function to check. * @returns {boolean} Returns `true` if `func` is masked, else `false`. */ function isMasked(func) { return !!maskSrcKey && maskSrcKey in func; } //#endregion //#region ../../node_modules/.pnpm/lodash-es@4.17.23/node_modules/lodash-es/_toSource.js /** Used to resolve the decompiled source of functions. */ var funcToString$2 = Function.prototype.toString; /** * Converts `func` to its source code. * * @private * @param {Function} func The fun