UNPKG

asp-smart-ui-plus-test

Version:

A Component Library for Vue 3

1,645 lines (1,570 loc) 6.15 MB
/*! Element Plus v0.0.0-dev.1 */ import { shallowRef, watchEffect, readonly, unref, ref, watch, customRef, getCurrentScope, onScopeDispose, effectScope, isRef, computed, reactive, toRefs as toRefs$1, toRef, getCurrentInstance, onBeforeMount, nextTick, onBeforeUnmount, onMounted, onUnmounted, provide, inject, isReactive, onUpdated, onBeforeUpdate, markRaw, isReadonly, defineComponent, openBlock, createElementBlock, createElementVNode, warn, isVNode, Fragment, Comment as Comment$3, renderSlot, normalizeClass, normalizeStyle as normalizeStyle$1, mergeProps, useSlots, createBlock, Transition, withCtx, withDirectives, resolveDynamicComponent, createCommentVNode, createTextVNode, toDisplayString, createVNode, vShow, TransitionGroup, useAttrs as useAttrs$1, withModifiers, onActivated, cloneVNode, Text as Text$3, Teleport as Teleport$1, onDeactivated, renderList, withKeys, createSlots, normalizeProps, guardReactiveProps, toRaw, vModelCheckbox, vModelRadio, h as h$2, resolveComponent, vModelText, toHandlers, resolveDirective, toHandlerKey, render, shallowReactive, vModelSelect, createApp, triggerRef } from 'vue'; function _mergeNamespaces(n, m) { m.forEach(function (e) { e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) { if (k !== 'default' && !(k in n)) { var d = Object.getOwnPropertyDescriptor(e, k); Object.defineProperty(n, k, d.get ? d : { enumerable: true, get: function () { return e[k]; } }); } }); }); return Object.freeze(n); } const INSTALLED_KEY = Symbol("INSTALLED_KEY"); const configProviderContextKey$1 = Symbol(); 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$1 = (element) => { if (process.env.NODE_ENV === "test") return true; 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$1(item)); }; const isFocusable = (element) => { if (element.tabIndex > 0 || element.tabIndex === 0 && element.getAttribute("tabIndex") !== null) { return true; } if (element.disabled) { 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$1 = (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$1(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; }; var isVue3 = true; var __defProp$9$1 = Object.defineProperty; var __defProps$6$1 = Object.defineProperties; var __getOwnPropDescs$6$1 = Object.getOwnPropertyDescriptors; var __getOwnPropSymbols$b$1 = Object.getOwnPropertySymbols; var __hasOwnProp$b$1 = Object.prototype.hasOwnProperty; var __propIsEnum$b$1 = Object.prototype.propertyIsEnumerable; var __defNormalProp$9$1 = (obj, key, value) => key in obj ? __defProp$9$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues$9$1 = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp$b$1.call(b, prop)) __defNormalProp$9$1(a, prop, b[prop]); if (__getOwnPropSymbols$b$1) for (var prop of __getOwnPropSymbols$b$1(b)) { if (__propIsEnum$b$1.call(b, prop)) __defNormalProp$9$1(a, prop, b[prop]); } return a; }; var __spreadProps$6$1 = (a, b) => __defProps$6$1(a, __getOwnPropDescs$6$1(b)); function computedEager(fn, options) { var _a; const result = shallowRef(); watchEffect(() => { result.value = fn(); }, __spreadProps$6$1(__spreadValues$9$1({}, options), { flush: (_a = options == null ? void 0 : options.flush) != null ? _a : "sync" })); return readonly(result); } var _a$1; const isClient$2 = typeof window !== "undefined"; const isDef$1 = (val) => typeof val !== "undefined"; const assert = (condition, ...infos) => { if (!condition) console.warn(...infos); }; const toString$2 = Object.prototype.toString; const isBoolean$2 = (val) => typeof val === "boolean"; const isFunction$4 = (val) => typeof val === "function"; const isNumber$2 = (val) => typeof val === "number"; const isString$4 = (val) => typeof val === "string"; const isObject$6 = (val) => toString$2.call(val) === "[object Object]"; const isWindow$5 = (val) => typeof window !== "undefined" && toString$2.call(val) === "[object Window]"; const now$4 = () => Date.now(); const timestamp = () => +Date.now(); const clamp$3 = (n, min, max) => Math.min(max, Math.max(min, n)); const noop$h = () => { }; const rand = (min, max) => { min = Math.ceil(min); max = Math.floor(max); return Math.floor(Math.random() * (max - min + 1)) + min; }; const isIOS$2 = isClient$2 && ((_a$1 = window == null ? void 0 : window.navigator) == null ? void 0 : _a$1.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent); const hasOwn$2 = (val, key) => Object.prototype.hasOwnProperty.call(val, key); function resolveUnref$1(r) { return typeof r === "function" ? r() : unref(r); } 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; } const bypassFilter = (invoke) => { return invoke(); }; function debounceFilter(ms, options = {}) { let timer; let maxTimer; let lastRejector = noop$h; const _clearTimeout = (timer2) => { clearTimeout(timer2); lastRejector(); lastRejector = noop$h; }; const filter = (invoke) => { const duration = resolveUnref$1(ms); const maxDuration = resolveUnref$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(ms, trailing = true, leading = true, rejectOnCancel = false) { let lastExec = 0; let timer; let isLeading = true; let lastRejector = noop$h; let lastValue; const clear = () => { if (timer) { clearTimeout(timer); timer = void 0; lastRejector(); lastRejector = noop$h; } }; const filter = (_invoke) => { const duration = resolveUnref$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 pausableFilter(extendFilter = bypassFilter) { const isActive = ref(true); function pause() { isActive.value = false; } function resume() { isActive.value = true; } const eventFilter = (...args) => { if (isActive.value) extendFilter(...args); }; return { isActive: readonly(isActive), pause, resume, eventFilter }; } function __onlyVue3(name = "this function") { return; } function __onlyVue27Plus(name = "this function") { return; } const directiveHooks = { mounted: isVue3 ? "mounted" : "inserted", updated: isVue3 ? "updated" : "componentUpdated", unmounted: isVue3 ? "unmounted" : "unbind" }; function promiseTimeout(ms, throwOnTimeout = false, reason = "Timeout") { return new Promise((resolve, reject) => { if (throwOnTimeout) setTimeout(() => reject(reason), ms); else setTimeout(resolve, ms); }); } function identity$1(arg) { return arg; } function createSingletonPromise(fn) { let _promise; function wrapper() { if (!_promise) _promise = fn(); return _promise; } wrapper.reset = async () => { const _prev = _promise; _promise = void 0; if (_prev) await _prev; }; return wrapper; } function invoke$1(fn) { return fn(); } function containsProp(obj, ...props) { return props.some((k) => k in obj); } function increaseWithUnit(target, delta) { var _a; if (typeof target === "number") return target + delta; const value = ((_a = target.match(/^-?[0-9]+\.?[0-9]*/)) == null ? void 0 : _a[0]) || ""; const unit = target.slice(value.length); const result = parseFloat(value) + delta; if (Number.isNaN(result)) return target; return result + unit; } function objectPick(obj, keys, omitUndefined = false) { return keys.reduce((n, k) => { if (k in obj) { if (!omitUndefined || obj[k] !== void 0) n[k] = obj[k]; } return n; }, {}); } function computedWithControl(source, fn) { let v = void 0; let track; let trigger; const dirty = ref(true); const update = () => { dirty.value = true; trigger(); }; watch(source, update, { flush: "sync" }); const get = isFunction$4(fn) ? fn : fn.get; const set = isFunction$4(fn) ? void 0 : fn.set; const result = customRef((_track, _trigger) => { track = _track; trigger = _trigger; return { get() { if (dirty.value) { v = get(); dirty.value = false; } track(); return v; }, set(v2) { set == null ? void 0 : set(v2); } }; }); if (Object.isExtensible(result)) result.trigger = update; return result; } function tryOnScopeDispose$2(fn) { if (getCurrentScope()) { onScopeDispose(fn); return true; } return false; } function createEventHook() { const fns = []; const off = (fn) => { const index = fns.indexOf(fn); if (index !== -1) fns.splice(index, 1); }; const on = (fn) => { fns.push(fn); const offFn = () => off(fn); tryOnScopeDispose$2(offFn); return { off: offFn }; }; const trigger = (param) => { fns.forEach((fn) => fn(param)); }; return { on, off, trigger }; } function createGlobalState(stateFactory) { let initialized = false; let state; const scope = effectScope(true); return () => { if (!initialized) { state = scope.run(stateFactory); initialized = true; } return state; }; } function createInjectionState(composable) { const key = Symbol("InjectionState"); const useProvidingState = (...args) => { const state = composable(...args); provide(key, state); return state; }; const useInjectedState = () => inject(key); return [useProvidingState, useInjectedState]; } function createSharedComposable(composable) { let subscribers = 0; let state; let scope; const dispose = () => { subscribers -= 1; if (scope && subscribers <= 0) { scope.stop(); state = void 0; scope = void 0; } }; return (...args) => { subscribers += 1; if (!state) { scope = effectScope(true); state = scope.run(() => composable(...args)); } tryOnScopeDispose$2(dispose); return state; }; } function extendRef(ref, extend, { enumerable = false, unwrap = true } = {}) { for (const [key, value] of Object.entries(extend)) { if (key === "value") continue; if (isRef(value) && unwrap) { Object.defineProperty(ref, key, { get() { return value.value; }, set(v) { value.value = v; }, enumerable }); } else { Object.defineProperty(ref, key, { value, enumerable }); } } return ref; } function get$3(obj, key) { if (key == null) return unref(obj); return unref(obj)[key]; } function isDefined(v) { return unref(v) != null; } var __defProp$8$2 = Object.defineProperty; var __getOwnPropSymbols$a$1 = Object.getOwnPropertySymbols; var __hasOwnProp$a$1 = Object.prototype.hasOwnProperty; var __propIsEnum$a$1 = Object.prototype.propertyIsEnumerable; var __defNormalProp$8$2 = (obj, key, value) => key in obj ? __defProp$8$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues$8$1 = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp$a$1.call(b, prop)) __defNormalProp$8$2(a, prop, b[prop]); if (__getOwnPropSymbols$a$1) for (var prop of __getOwnPropSymbols$a$1(b)) { if (__propIsEnum$a$1.call(b, prop)) __defNormalProp$8$2(a, prop, b[prop]); } return a; }; function makeDestructurable(obj, arr) { if (typeof Symbol !== "undefined") { const clone = __spreadValues$8$1({}, obj); Object.defineProperty(clone, Symbol.iterator, { enumerable: false, value() { let index = 0; return { next: () => ({ value: arr[index++], done: index > arr.length }) }; } }); return clone; } else { return Object.assign([...arr], obj); } } function reactify(fn, options) { const unrefFn = (options == null ? void 0 : options.computedGetter) === false ? unref : resolveUnref$1; return function(...args) { return computed(() => fn.apply(this, args.map((i) => unrefFn(i)))); }; } function reactifyObject(obj, optionsOrKeys = {}) { let keys = []; let options; if (Array.isArray(optionsOrKeys)) { keys = optionsOrKeys; } else { options = optionsOrKeys; const { includeOwnProperties = true } = optionsOrKeys; keys.push(...Object.keys(obj)); if (includeOwnProperties) keys.push(...Object.getOwnPropertyNames(obj)); } return Object.fromEntries(keys.map((key) => { const value = obj[key]; return [ key, typeof value === "function" ? reactify(value.bind(obj), options) : value ]; })); } function toReactive$1(objectRef) { if (!isRef(objectRef)) return reactive(objectRef); const proxy = new Proxy({}, { get(_, p, receiver) { return unref(Reflect.get(objectRef.value, p, receiver)); }, set(_, p, value) { if (isRef(objectRef.value[p]) && !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 }; } }); return reactive(proxy); } function reactiveComputed(fn) { return toReactive$1(computed(fn)); } function reactiveOmit(obj, ...keys) { const flatKeys = keys.flat(); return reactiveComputed(() => Object.fromEntries(Object.entries(toRefs$1(obj)).filter((e) => !flatKeys.includes(e[0])))); } function reactivePick$1(obj, ...keys) { const flatKeys = keys.flat(); return reactive(Object.fromEntries(flatKeys.map((k) => [k, toRef(obj, k)]))); } function refAutoReset(defaultValue, afterMs = 1e4) { return customRef((track, trigger) => { let value = defaultValue; let timer; const resetAfter = () => setTimeout(() => { value = defaultValue; trigger(); }, resolveUnref$1(afterMs)); tryOnScopeDispose$2(() => { clearTimeout(timer); }); return { get() { track(); return value; }, set(newValue) { value = newValue; trigger(); clearTimeout(timer); timer = resetAfter(); } }; }); } function useDebounceFn(fn, ms = 200, options = {}) { return createFilterWrapper(debounceFilter(ms, options), fn); } function refDebounced(value, ms = 200, options = {}) { const debounced = ref(value.value); const updater = useDebounceFn(() => { debounced.value = value.value; }, ms, options); watch(value, () => updater()); return debounced; } function refDefault(source, defaultValue) { return computed({ get() { var _a; return (_a = source.value) != null ? _a : defaultValue; }, set(value) { source.value = value; } }); } function useThrottleFn(fn, ms = 200, trailing = false, leading = true, rejectOnCancel = false) { return createFilterWrapper(throttleFilter(ms, trailing, leading, rejectOnCancel), fn); } function refThrottled(value, delay = 200, trailing = true, leading = true) { if (delay <= 0) return value; const throttled = ref(value.value); const updater = useThrottleFn(() => { throttled.value = value.value; }, delay, trailing, leading); watch(value, () => updater()); return throttled; } function refWithControl(initial, options = {}) { let source = initial; let track; let trigger; const ref = customRef((_track, _trigger) => { track = _track; trigger = _trigger; return { get() { return get(); }, set(v) { set(v); } }; }); function get(tracking = true) { if (tracking) track(); return source; } function set(value, triggering = true) { var _a, _b; if (value === source) return; const old = source; if (((_a = options.onBeforeChange) == null ? void 0 : _a.call(options, value, old)) === false) return; source = value; (_b = options.onChanged) == null ? void 0 : _b.call(options, value, old); if (triggering) trigger(); } const untrackedGet = () => get(false); const silentSet = (v) => set(v, false); const peek = () => get(false); const lay = (v) => set(v, false); return extendRef(ref, { get, set, untrackedGet, silentSet, peek, lay }, { enumerable: true }); } const controlledRef = refWithControl; function resolveRef(r) { return typeof r === "function" ? computed(r) : ref(r); } function set$2(...args) { if (args.length === 2) { const [ref, value] = args; ref.value = value; } if (args.length === 3) { { const [target, key, value] = args; target[key] = value; } } } function syncRef(left, right, options = {}) { var _a, _b; const { flush = "sync", deep = false, immediate = true, direction = "both", transform = {} } = options; let watchLeft; let watchRight; const transformLTR = (_a = transform.ltr) != null ? _a : (v) => v; const transformRTL = (_b = transform.rtl) != null ? _b : (v) => v; if (direction === "both" || direction === "ltr") { watchLeft = watch(left, (newValue) => right.value = transformLTR(newValue), { flush, deep, immediate }); } if (direction === "both" || direction === "rtl") { watchRight = watch(right, (newValue) => left.value = transformRTL(newValue), { flush, deep, immediate }); } return () => { watchLeft == null ? void 0 : watchLeft(); watchRight == null ? void 0 : watchRight(); }; } function syncRefs(source, targets, options = {}) { const { flush = "sync", deep = false, immediate = true } = options; if (!Array.isArray(targets)) targets = [targets]; return watch(source, (newValue) => targets.forEach((target) => target.value = newValue), { flush, deep, immediate }); } var __defProp$7$2 = Object.defineProperty; var __defProps$5$1 = Object.defineProperties; var __getOwnPropDescs$5$1 = Object.getOwnPropertyDescriptors; var __getOwnPropSymbols$9$1 = Object.getOwnPropertySymbols; var __hasOwnProp$9$1 = Object.prototype.hasOwnProperty; var __propIsEnum$9$1 = Object.prototype.propertyIsEnumerable; var __defNormalProp$7$2 = (obj, key, value) => key in obj ? __defProp$7$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues$7$1 = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp$9$1.call(b, prop)) __defNormalProp$7$2(a, prop, b[prop]); if (__getOwnPropSymbols$9$1) for (var prop of __getOwnPropSymbols$9$1(b)) { if (__propIsEnum$9$1.call(b, prop)) __defNormalProp$7$2(a, prop, b[prop]); } return a; }; var __spreadProps$5$1 = (a, b) => __defProps$5$1(a, __getOwnPropDescs$5$1(b)); function toRefs(objectRef) { if (!isRef(objectRef)) return toRefs$1(objectRef); const result = Array.isArray(objectRef.value) ? new Array(objectRef.value.length) : {}; for (const key in objectRef.value) { result[key] = customRef(() => ({ get() { return objectRef.value[key]; }, set(v) { if (Array.isArray(objectRef.value)) { const copy = [...objectRef.value]; copy[key] = v; objectRef.value = copy; } else { const newObject = __spreadProps$5$1(__spreadValues$7$1({}, objectRef.value), { [key]: v }); Object.setPrototypeOf(newObject, objectRef.value); objectRef.value = newObject; } } })); } return result; } function tryOnBeforeMount(fn, sync = true) { if (getCurrentInstance()) onBeforeMount(fn); else if (sync) fn(); else nextTick(fn); } function tryOnBeforeUnmount(fn) { if (getCurrentInstance()) onBeforeUnmount(fn); } function tryOnMounted$1(fn, sync = true) { if (getCurrentInstance()) onMounted(fn); else if (sync) fn(); else nextTick(fn); } function tryOnUnmounted(fn) { if (getCurrentInstance()) onUnmounted(fn); } function createUntil(r, isNot = false) { function toMatch(condition, { flush = "sync", deep = false, timeout, throwOnTimeout } = {}) { let stop = null; const watcher = new Promise((resolve) => { stop = watch(r, (v) => { if (condition(v) !== isNot) { stop == null ? void 0 : stop(); resolve(v); } }, { flush, deep, immediate: true }); }); const promises = [watcher]; if (timeout != null) { promises.push(promiseTimeout(timeout, throwOnTimeout).then(() => resolveUnref$1(r)).finally(() => stop == null ? void 0 : stop())); } return Promise.race(promises); } function toBe(value, options) { if (!isRef(value)) return toMatch((v) => v === value, options); const { flush = "sync", deep = false, timeout, throwOnTimeout } = options != null ? options : {}; let stop = null; const watcher = new Promise((resolve) => { stop = watch([r, value], ([v1, v2]) => { if (isNot !== (v1 === v2)) { stop == null ? void 0 : stop(); resolve(v1); } }, { flush, deep, immediate: true }); }); const promises = [watcher]; if (timeout != null) { promises.push(promiseTimeout(timeout, throwOnTimeout).then(() => resolveUnref$1(r)).finally(() => { stop == null ? void 0 : stop(); return resolveUnref$1(r); })); } return Promise.race(promises); } function toBeTruthy(options) { return toMatch((v) => Boolean(v), options); } function toBeNull(options) { return toBe(null, options); } function toBeUndefined(options) { return toBe(void 0, options); } function toBeNaN(options) { return toMatch(Number.isNaN, options); } function toContains(value, options) { return toMatch((v) => { const array = Array.from(v); return array.includes(value) || array.includes(resolveUnref$1(value)); }, options); } function changed(options) { return changedTimes(1, options); } function changedTimes(n = 1, options) { let count = -1; return toMatch(() => { count += 1; return count >= n; }, options); } if (Array.isArray(resolveUnref$1(r))) { const instance = { toMatch, toContains, changed, changedTimes, get not() { return createUntil(r, !isNot); } }; return instance; } else { const instance = { toMatch, toBe, toBeTruthy, toBeNull, toBeNaN, toBeUndefined, changed, changedTimes, get not() { return createUntil(r, !isNot); } }; return instance; } } function until(r) { return createUntil(r); } function useArrayEvery(list, fn) { return computed(() => resolveUnref$1(list).every((element, index, array) => fn(resolveUnref$1(element), index, array))); } function useArrayFilter(list, fn) { return computed(() => resolveUnref$1(list).map((i) => resolveUnref$1(i)).filter(fn)); } function useArrayFind(list, fn) { return computed(() => resolveUnref$1(resolveUnref$1(list).find((element, index, array) => fn(resolveUnref$1(element), index, array)))); } function useArrayFindIndex(list, fn) { return computed(() => resolveUnref$1(list).findIndex((element, index, array) => fn(resolveUnref$1(element), index, array))); } function findLast$1(arr, cb) { let index = arr.length; while (index-- > 0) { if (cb(arr[index], index, arr)) return arr[index]; } return void 0; } function useArrayFindLast(list, fn) { return computed(() => resolveUnref$1(!Array.prototype.findLast ? findLast$1(resolveUnref$1(list), (element, index, array) => fn(resolveUnref$1(element), index, array)) : resolveUnref$1(list).findLast((element, index, array) => fn(resolveUnref$1(element), index, array)))); } function useArrayJoin(list, separator) { return computed(() => resolveUnref$1(list).map((i) => resolveUnref$1(i)).join(resolveUnref$1(separator))); } function useArrayMap(list, fn) { return computed(() => resolveUnref$1(list).map((i) => resolveUnref$1(i)).map(fn)); } function useArrayReduce(list, reducer, ...args) { const reduceCallback = (sum, value, index) => reducer(resolveUnref$1(sum), resolveUnref$1(value), index); return computed(() => { const resolved = resolveUnref$1(list); return args.length ? resolved.reduce(reduceCallback, resolveUnref$1(args[0])) : resolved.reduce(reduceCallback); }); } function useArraySome(list, fn) { return computed(() => resolveUnref$1(list).some((element, index, array) => fn(resolveUnref$1(element), index, array))); } function useArrayUnique(list) { return computed(() => [...new Set(resolveUnref$1(list).map((element) => resolveUnref$1(element)))]); } function useCounter(initialValue = 0, options = {}) { const count = ref(initialValue); const { max = Infinity, min = -Infinity } = options; const inc = (delta = 1) => count.value = Math.min(max, count.value + delta); const dec = (delta = 1) => count.value = Math.max(min, count.value - delta); const get = () => count.value; const set = (val) => count.value = Math.max(min, Math.min(max, val)); const reset = (val = initialValue) => { initialValue = val; return set(val); }; return { count, inc, dec, get, set, reset }; } const REGEX_PARSE = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/; const REGEX_FORMAT = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a{1,2}|A{1,2}|m{1,2}|s{1,2}|Z{1,2}|SSS/g; const defaultMeridiem = (hours, minutes, isLowercase, hasPeriod) => { let m = hours < 12 ? "AM" : "PM"; if (hasPeriod) m = m.split("").reduce((acc, curr) => acc += `${curr}.`, ""); return isLowercase ? m.toLowerCase() : m; }; const formatDate = (date, formatStr, options = {}) => { var _a; const years = date.getFullYear(); const month = date.getMonth(); const days = date.getDate(); const hours = date.getHours(); const minutes = date.getMinutes(); const seconds = date.getSeconds(); const milliseconds = date.getMilliseconds(); const day = date.getDay(); const meridiem = (_a = options.customMeridiem) != null ? _a : defaultMeridiem; const matches = { YY: () => String(years).slice(-2), YYYY: () => years, M: () => month + 1, MM: () => `${month + 1}`.padStart(2, "0"), MMM: () => date.toLocaleDateString(options.locales, { month: "short" }), MMMM: () => date.toLocaleDateString(options.locales, { month: "long" }), D: () => String(days), DD: () => `${days}`.padStart(2, "0"), H: () => String(hours), HH: () => `${hours}`.padStart(2, "0"), h: () => `${hours % 12 || 12}`.padStart(1, "0"), hh: () => `${hours % 12 || 12}`.padStart(2, "0"), m: () => String(minutes), mm: () => `${minutes}`.padStart(2, "0"), s: () => String(seconds), ss: () => `${seconds}`.padStart(2, "0"), SSS: () => `${milliseconds}`.padStart(3, "0"), d: () => day, dd: () => date.toLocaleDateString(options.locales, { weekday: "narrow" }), ddd: () => date.toLocaleDateString(options.locales, { weekday: "short" }), dddd: () => date.toLocaleDateString(options.locales, { weekday: "long" }), A: () => meridiem(hours, minutes), AA: () => meridiem(hours, minutes, false, true), a: () => meridiem(hours, minutes, true), aa: () => meridiem(hours, minutes, true, true) }; return formatStr.replace(REGEX_FORMAT, (match, $1) => $1 || matches[match]()); }; const normalizeDate = (date) => { if (date === null) return new Date(NaN); if (date === void 0) return new Date(); if (date instanceof Date) return new Date(date); if (typeof date === "string" && !/Z$/i.test(date)) { const d = date.match(REGEX_PARSE); if (d) { const m = d[2] - 1 || 0; const ms = (d[7] || "0").substring(0, 3); return new Date(d[1], m, d[3] || 1, d[4] || 0, d[5] || 0, d[6] || 0, ms); } } return new Date(date); }; function useDateFormat(date, formatStr = "HH:mm:ss", options = {}) { return computed(() => formatDate(normalizeDate(resolveUnref$1(date)), resolveUnref$1(formatStr), options)); } function useIntervalFn(cb, interval = 1e3, options = {}) { const { immediate = true, immediateCallback = false } = options; let timer = null; const isActive = ref(false); function clean() { if (timer) { clearInterval(timer); timer = null; } } function pause() { isActive.value = false; clean(); } function resume() { const intervalValue = resolveUnref$1(interval); if (intervalValue <= 0) return; isActive.value = true; if (immediateCallback) cb(); clean(); timer = setInterval(cb, intervalValue); } if (immediate && isClient$2) resume(); if (isRef(interval) || isFunction$4(interval)) { const stopWatch = watch(interval, () => { if (isActive.value && isClient$2) resume(); }); tryOnScopeDispose$2(stopWatch); } tryOnScopeDispose$2(pause); return { isActive, pause, resume }; } var __defProp$6$2 = Object.defineProperty; var __getOwnPropSymbols$8$1 = Object.getOwnPropertySymbols; var __hasOwnProp$8$1 = Object.prototype.hasOwnProperty; var __propIsEnum$8$1 = Object.prototype.propertyIsEnumerable; var __defNormalProp$6$2 = (obj, key, value) => key in obj ? __defProp$6$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues$6$1 = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp$8$1.call(b, prop)) __defNormalProp$6$2(a, prop, b[prop]); if (__getOwnPropSymbols$8$1) for (var prop of __getOwnPropSymbols$8$1(b)) { if (__propIsEnum$8$1.call(b, prop)) __defNormalProp$6$2(a, prop, b[prop]); } return a; }; function useInterval(interval = 1e3, options = {}) { const { controls: exposeControls = false, immediate = true, callback } = options; const counter = ref(0); const update = () => counter.value += 1; const reset = () => { counter.value = 0; }; const controls = useIntervalFn(callback ? () => { update(); callback(counter.value); } : update, interval, { immediate }); if (exposeControls) { return __spreadValues$6$1({ counter, reset }, controls); } else { return counter; } } function useLastChanged(source, options = {}) { var _a; const ms = ref((_a = options.initialValue) != null ? _a : null); watch(source, () => ms.value = timestamp(), options); return ms; } function useTimeoutFn$1(cb, interval, options = {}) { const { immediate = true } = options; const isPending = 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); }, resolveUnref$1(interval)); } if (immediate) { isPending.value = true; if (isClient$2) start(); } tryOnScopeDispose$2(stop); return { isPending: readonly(isPending), start, stop }; } var __defProp$5$2 = Object.defineProperty; var __getOwnPropSymbols$7$1 = Object.getOwnPropertySymbols; var __hasOwnProp$7$1 = Object.prototype.hasOwnProperty; var __propIsEnum$7$1 = Object.prototype.propertyIsEnumerable; var __defNormalProp$5$2 = (obj, key, value) => key in obj ? __defProp$5$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues$5$1 = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp$7$1.call(b, prop)) __defNormalProp$5$2(a, prop, b[prop]); if (__getOwnPropSymbols$7$1) for (var prop of __getOwnPropSymbols$7$1(b)) { if (__propIsEnum$7$1.call(b, prop)) __defNormalProp$5$2(a, prop, b[prop]); } return a; }; function useTimeout$1(interval = 1e3, options = {}) { const { controls: exposeControls = false, callback } = options; const controls = useTimeoutFn$1(callback != null ? callback : noop$h, interval, options); const ready = computed(() => !controls.isPending.value); if (exposeControls) { return __spreadValues$5$1({ ready }, controls); } else { return ready; } } function useToNumber(value, options = {}) { const { method = "parseFloat", radix, nanToZero } = options; return computed(() => { let resolved = resolveUnref$1(value); if (typeof resolved === "string") resolved = Number[method](resolved, radix); if (nanToZero && isNaN(resolved)) resolved = 0; return resolved; }); } function useToString(value) { return computed(() => `${resolveUnref$1(value)}`); } function useToggle$1(initialValue = false, options = {}) { const { truthyValue = true, falsyValue = false } = options; const valueIsRef = isRef(initialValue); const _value = ref(initialValue); function toggle(value) { if (arguments.length) { _value.value = value; return _value.value; } else { const truthy = resolveUnref$1(truthyValue); _value.value = _value.value === truthy ? resolveUnref$1(falsyValue) : truthy; return _value.value; } } if (valueIsRef) return toggle; else return [_value, toggle]; } function watchArray(source, cb, options) { let oldList = (options == null ? void 0 : options.immediate) ? [] : [ ...source instanceof Function ? source() : Array.isArray(source) ? source : unref(source) ]; return watch(source, (newList, _, onCleanup) => { const oldListRemains = new Array(oldList.length); const added = []; for (const obj of newList) { let found = false; for (let i = 0; i < oldList.length; i++) { if (!oldListRemains[i] && obj === oldList[i]) { oldListRemains[i] = true; found = true; break; } } if (!found) added.push(obj); } const removed = oldList.filter((_2, i) => !oldListRemains[i]); cb(newList, oldList, added, removed, onCleanup); oldList = [...newList]; }, options); } var __getOwnPropSymbols$6$1 = Object.getOwnPropertySymbols; var __hasOwnProp$6$1 = Object.prototype.hasOwnProperty; var __propIsEnum$6$1 = Object.prototype.propertyIsEnumerable; var __objRest$5 = (source, exclude) => { var target = {}; for (var prop in source) if (__hasOwnProp$6$1.call(source, prop) && exclude.indexOf(prop) < 0) target[prop] = source[prop]; if (source != null && __getOwnPropSymbols$6$1) for (var prop of __getOwnPropSymbols$6$1(source)) { if (exclude.indexOf(prop) < 0 && __propIsEnum$6$1.call(source, prop)) target[prop] = source[prop]; } return target; }; function watchWithFilter(source, cb, options = {}) { const _a = options, { eventFilter = bypassFilter } = _a, watchOptions = __objRest$5(_a, [ "eventFilter" ]); return watch(source, createFilterWrapper(eventFilter, cb), watchOptions); } var __getOwnPropSymbols$5$1 = Object.getOwnPropertySymbols; var __hasOwnProp$5$1 = Object.prototype.hasOwnProperty; var __propIsEnum$5$1 = Object.prototype.propertyIsEnumerable; var __objRest$4 = (source, exclude) => { var target = {}; for (var prop in source) if (__hasOwnProp$5$1.call(source, prop) && exclude.indexOf(prop) < 0) target[prop] = source[prop]; if (source != null && __getOwnPropSymbols$5$1) for (var prop of __getOwnPropSymbols$5$1(source)) { if (exclude.indexOf(prop) < 0 && __propIsEnum$5$1.call(source, prop)) target[prop] = source[prop]; } return target; }; function watchAtMost(source, cb, options) { const _a = options, { count } = _a, watchOptions = __objRest$4(_a, [ "count" ]); const current = ref(0); const stop = watchWithFilter(source, (...args) => { current.value += 1; if (current.value >= resolveUnref$1(count)) nextTick(() => stop()); cb(...args); }, watchOptions); return { count: current, stop }; } var __defProp$4$2 = Object.defineProperty; var __defProps$4$1 = Object.defineProperties; var __getOwnPropDescs$4$1 = Object.getOwnPropertyDescriptors; var __getOwnPropSymbols$4$1 = Object.getOwnPropertySymbols; var __hasOwnProp$4$1 = Object.prototype.hasOwnProperty; var __propIsEnum$4$1 = Object.prototype.propertyIsEnumerable; var __defNormalProp$4$2 = (obj, key, value) => key in obj ? __defProp$4$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues$4$1 = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp$4$1.call(b, prop)) __defNormalProp$4$2(a, prop, b[prop]); if (__getOwnPropSymbols$4$1) for (var prop of __getOwnPropSymbols$4$1(b)) { if (__propIsEnum$4$1.call(b, prop)) __defNormalProp$4$2(a, prop, b[prop]); } return a; }; var __spreadProps$4$1 = (a, b) => __defProps$4$1(a, __getOwnPropDescs$4$1(b)); var __objRest$3 = (source, exclude) => { var target = {}; for (var prop in source) if (__hasOwnProp$4$1.call(source, prop) && exclude.indexOf(prop) < 0) target[prop] = source[prop]; if (source != null && __getOwnPropSymbols$4$1) for (var prop of __getOwnPropSymbols$4$1(source)) { if (exclude.indexOf(prop) < 0 && __propIsEnum$4$1.call(source, prop)) target[prop] = source[prop]; } return target; }; function watchDebounced(source, cb, options = {}) { const _a = options, { debounce = 0, maxWait = void 0 } = _a, watchOptions = __objRest$3(_a, [ "debounce", "maxWait" ]); return watchWithFilter(source, cb, __spreadProps$4$1(__spreadValues$4$1({}, watchOptions), { eventFilter: debounceFilter(debounce, { maxWait }) })); } var __defProp$3$2 = Object.defineProperty; var __defProps$3$1 = Object.defineProperties; var __getOwnPropDescs$3$1 = Object.getOwnPropertyDescriptors; var __getOwnPropSymbols$3$1 = Object.getOwnPropertySymbols; var __hasOwnProp$3$1 = Object.prototype.hasOwnProperty; var __propIsEnum$3$1 = Object.prototype.propertyIsEnumerable; var __defNormalProp$3$2 = (obj, key, value) => key in obj ? __defProp$3$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues$3$1 = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp$3$1.call(b, prop)) __defNormalProp$3$2(a, prop, b[prop]); if (__getOwnPropSymbols$3$1) for (var prop of __getOwnPropSymbols$3$1(b)) { if (__propIsEnum$3$1.call(b, prop)) __defNormalProp$3$2(a, prop, b[prop]); } return a; }; var __spreadProps$3$1 = (a, b) => __defProps$3$1(a, __getOwnPropDescs$3$1(b)); var __objRest$2$1 = (source, exclude) => { var target = {}; for (var prop in source) if (__hasOwnProp$3$1.call(source, prop) && exclude.indexOf(prop) < 0) target[prop] = source[prop]; if (source != null && __getOwnPropSymbols$3$1) for (var prop of __getOwnPropSymbols$3$1(source)) { if (exclude.indexOf(prop) < 0 && __propIsEnum$3$1.call(source, prop)) target[prop] = source[prop]; } return target; }; function watchIgnorable(source, cb, options = {}) { const _a = options, { eventFilter = bypassFilter } = _a, watchOptions = __objRest$2$1(_a, [ "eventFilter" ]); const filteredCb = createFilterWrapper(eventFilter, cb); let ignoreUpdates; let ignorePrevAsyncUpdates; let stop; if (watchOptions.flush === "sync") { const ignore = ref(false); ignorePrevAsyncUpdates = () => { }; ignoreUpdates = (updater) => { ignore.value = true; updater(); ignore.value = false; }; stop = watch(source, (...args) => { if (!ignore.value) filteredCb(...args); }, watchOptions); } else { const disposables = []; const ignoreCounter = ref(0); const syncCounter = ref(0); ignorePrevAsyncUpdates = () => { ignoreCounter.value = syncCounter.value; }; disposables.push(watch(source, () => { syncCounter.value++; }, __spreadProps$3$1(__spreadValues$3$1({}, watchOptions), { flush: "sync" }))); ignoreUpdates = (updater) => { const syncCounterPrev = syncCounter.value; updater(); ignoreCounter.value += syncCounter.value - syncCounterPrev; }; disposables.push(watch(source, (...args) => { const ignore = ignoreCounter.value > 0 && ignoreCounter.value === syncCounter.value; ignoreCounter.value = 0; syncCounter.value = 0; if (ignore) return; filteredCb(...args); }, watchOptions)); stop = () => { disposables.forEach((fn) => fn()); }; } return { stop, ignoreUpdates, ignorePrevAsyncUpdates }; } function watchOnce(source, cb, options) { const stop = watch(source, (...args) => { nextTick(() => stop()); return cb(...args); }, options); } var __defProp$2$2 = Object.defineProperty; var __defProps$2$1 = Object.defineProperties; var __getOwnPropDescs$2$1 = Object.getOwnPropertyDescriptors; var __getOwnPropSymbols$2$1 = Object.getOwnPropertySymbols; var __hasOwnProp$2$1 = Object.prototype.hasOwnProperty; var __propIsEnum$2$1 = Object.prototype.propertyIsEnumerable; var __defNormalProp$2$2 = (obj, key, value) => key in obj ? __defProp$2$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues$2$1 = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp$2$1.call(b, prop)) __defNormalProp$2$2(a, prop, b[prop]); if (__getOwnPropSymbols$2$1) for (var prop of __getOwnPropSymbols$2$1(b)) { if (__propIsEnum$2$1.call(b, prop)) __defNormalProp$2$2(a, prop, b[prop]); } return a; }; var __spreadProps$2$1 = (a, b) => __defProps$2$1(a, __getOwnPropDescs$2$1(b)); var __objRest$1$1 = (source, exclude) => { var target = {}; for (var prop in source) if (__hasOwnProp$2$1.call(source, prop) && exclude.indexOf(prop) < 0) target[prop] = source[prop]; if (source != null && __getOwnPropSymbols$2$1) for (var prop of __getOwnPropSymbols$2$1(source)) { if (exclude.indexOf(prop) < 0 && __propIsEnum$2$1.call(source, prop)) target[prop] = source[prop]; } return target; }; function watchPausable(source, cb, options = {}) { const _a = options, { eventFilter: filter } = _a, watchOptions = __objRest$1$1(_a, [ "eventFilter" ]); const { eventFilter, pause, resume, isActive } = pausableFilter(filter); const stop = watchWithFilter(source, cb, __spreadProps$2$1(__spreadValues$2$1({}, watchOptions), { eventFilter })); return { stop, pause, resume, isActive }; } var __defProp$1$2 = Object.defineProperty; var __defProps$1$1 = Object.defineProperties; var __getOwnPropDescs$1$1 = Object.getOwnPropertyDescriptors; var __getOwnPropSymbols$1$1 = Object.getOwnPropertySymbols; var __hasOwnProp$1$1 = Object.prototype.hasOwnProperty; var __propIsEnum$1$1 = Object.prototype.propertyIsEnumerable; var __defNormalProp$1$2 = (obj, key, value) => key in obj ? __defProp$1$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues$1$1 = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp$1$1.call(b, prop)) __defNormalProp$1$2(a, prop, b[prop]); if (__getOwnPropSymbols$1$1) for (var prop of __getOwnPropSymbols$1$1(b)) { if (__propIsEnum$1$1.call(b, prop)) __defNormalProp$1$2(a, prop, b[prop]); } return a; }; var __spreadProps$1$1 = (a, b) => __defProps$1$1(a, __getOwnPropDescs$1$1(b)); var __objRest$6 = (source, exclude) => { var target = {}; for (var prop in source) if (__hasOwnProp$1$1.call(source, prop) && exclude.indexOf(prop) < 0) target[prop] = source[prop]; if (source != null && __getOwnPropSymbols$1$1) for (var prop of __getOwnPropSymbols$1$1(source)) { if (exclude.indexOf(prop) < 0 && __propIsEnum$1$1.call(source, prop)) target[prop] = source[prop]; } return target; }; function watchThrottled(source, cb, options = {}) { const _a = options, { throttle = 0, trailing = true, leading = true } = _a, watchOptions = __objRest$6(_a, [ "throttle", "trailing", "leading" ]); return watchWithFilter(source, cb, __spreadProps$1$1(__spreadValues$1$1({}, watchOptions), { eventFilter: throttleFilter(throttle, trailing, leading) })); } var __defProp$p = Object.defineProperty; var __defProps$a = Object.defineProperties; var __getOwnPropDescs$a = Object.getOwnPropertyDescriptors; var __getOwnPropSymbols$q = Object.getOwnPropertySymbols; var __hasOwnProp$q = Object.prototype.hasOwnProperty; var __propIsEnum$q = Object.prototype.propertyIsEnumerable; var __defNormalProp$p = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues$o = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp$q.call(b, prop)) __defNormalProp$p(a, prop, b[prop]); if (__getOwnPropSymbols$q) for (var prop of __getOwnPropSymbols$q(b)) { if (__propIsEnum$q.call(b, prop)) __defNormalProp$p(a, prop, b[prop]); } return a; }; var __spreadProps$a = (a, b) => __defProps$a(a, __getOwnPropDescs$a(b)); function watchTriggerable(source, cb, options = {}) { let cleanupFn; function onEffect() { if (!cleanupFn) return; const fn = cleanupFn; cleanupFn = void 0; fn(); } function onCleanup(callback) { cleanupFn = callback; } const _cb = (value, oldValue) => { onEffect(); return cb(value, oldValue, onCleanup); }; const res = watchIgnorable(source, _cb, options); const { ignoreUpdates } = res; const trigger = () => { let res2; ignoreUpdates(() => { res2 = _cb(getWatchSources(source), getOldValue(source)); }); return res2; }; return __spreadProps$a(__spreadValues$o({}, res), { trigger }); } function getWatchSources(sources) { if (isReactive(sources)) return sources; if (Array.isArray(sources)) retu