123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194 |
- import {
- __async,
- init_define_APP_INFO
- } from "./chunk-XY75H3MP.js";
- // node_modules/@vueuse/shared/index.mjs
- init_define_APP_INFO();
- import { computed, unref, watch, ref, customRef, isVue3, isRef, effectScope, getCurrentScope, onScopeDispose, shallowRef, watchSyncEffect, readonly, reactive, toRef, isVue2, set as set$1, toRefs as toRefs$1, getCurrentInstance, onBeforeUnmount, onMounted, nextTick, onUnmounted } from "vue-demi";
- function and(...args) {
- return computed(() => args.every((i) => unref(i)));
- }
- function biSyncRef(a, b) {
- const flush = "sync";
- const stop1 = watch(a, (newValue) => {
- b.value = newValue;
- }, {
- flush,
- immediate: true
- });
- const stop2 = watch(b, (newValue) => {
- a.value = newValue;
- }, {
- flush,
- immediate: true
- });
- return () => {
- stop1();
- stop2();
- };
- }
- function controlledComputed(source, fn) {
- let v = void 0;
- let track;
- let trigger;
- const dirty = ref(true);
- watch(source, () => {
- dirty.value = true;
- trigger();
- }, { flush: "sync" });
- return customRef((_track, _trigger) => {
- track = _track;
- trigger = _trigger;
- return {
- get() {
- if (dirty.value) {
- v = fn();
- dirty.value = false;
- }
- track();
- return v;
- },
- set() {
- }
- };
- });
- }
- function __onlyVue3(name = "this function") {
- if (isVue3)
- return;
- throw new Error(`[VueUse] ${name} is only works on Vue 3.`);
- }
- function extendRef(ref2, extend, { enumerable = false, unwrap = true } = {}) {
- __onlyVue3();
- for (const [key, value] of Object.entries(extend)) {
- if (key === "value")
- continue;
- if (isRef(value) && unwrap) {
- Object.defineProperty(ref2, key, {
- get() {
- return value.value;
- },
- set(v) {
- value.value = v;
- },
- enumerable
- });
- } else {
- Object.defineProperty(ref2, key, { value, enumerable });
- }
- }
- return ref2;
- }
- function controlledRef(initial, options = {}) {
- let source = initial;
- let track;
- let trigger;
- const ref2 = customRef((_track, _trigger) => {
- track = _track;
- trigger = _trigger;
- return {
- get() {
- return get2();
- },
- set(v) {
- set2(v);
- }
- };
- });
- function get2(tracking = true) {
- if (tracking)
- track();
- return source;
- }
- function set2(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 = () => get2(false);
- const silentSet = (v) => set2(v, false);
- const peek = () => get2(false);
- const lay = (v) => set2(v, false);
- return extendRef(ref2, {
- get: get2,
- set: set2,
- untrackedGet,
- silentSet,
- peek,
- lay
- }, { enumerable: true });
- }
- 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);
- return {
- off: () => off(fn)
- };
- };
- 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 reactify(fn) {
- return function(...args) {
- return computed(() => fn.apply(this, args.map((i) => unref(i))));
- };
- }
- function tryOnScopeDispose(fn) {
- if (getCurrentScope()) {
- onScopeDispose(fn);
- return true;
- }
- return false;
- }
- 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(dispose);
- return state;
- };
- }
- var isClient = typeof window !== "undefined";
- var isDef = (val) => typeof val !== "undefined";
- var assert = (condition, ...infos) => {
- if (!condition)
- console.warn(...infos);
- };
- var toString = Object.prototype.toString;
- var isBoolean = (val) => typeof val === "boolean";
- var isFunction = (val) => typeof val === "function";
- var isNumber = (val) => typeof val === "number";
- var isString = (val) => typeof val === "string";
- var isObject = (val) => toString.call(val) === "[object Object]";
- var isWindow = (val) => typeof window !== "undefined" && toString.call(val) === "[object Window]";
- var now = () => Date.now();
- var timestamp = () => +Date.now();
- var clamp = (n, min, max) => Math.min(max, Math.max(min, n));
- var noop = () => {
- };
- var rand = (min, max) => {
- min = Math.ceil(min);
- max = Math.floor(max);
- return Math.floor(Math.random() * (max - min + 1)) + min;
- };
- function createFilterWrapper(filter, fn) {
- function wrapper(...args) {
- filter(() => fn.apply(this, args), { fn, thisArg: this, args });
- }
- return wrapper;
- }
- var bypassFilter = (invoke2) => {
- return invoke2();
- };
- function debounceFilter(ms, options = {}) {
- let timer;
- let maxTimer;
- const filter = (invoke2) => {
- const duration = unref(ms);
- const maxDuration = unref(options.maxWait);
- if (timer)
- clearTimeout(timer);
- if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
- if (maxTimer) {
- clearTimeout(maxTimer);
- maxTimer = null;
- }
- return invoke2();
- }
- if (maxDuration && !maxTimer) {
- maxTimer = setTimeout(() => {
- if (timer)
- clearTimeout(timer);
- maxTimer = null;
- invoke2();
- }, maxDuration);
- }
- timer = setTimeout(() => {
- if (maxTimer)
- clearTimeout(maxTimer);
- maxTimer = null;
- invoke2();
- }, duration);
- };
- return filter;
- }
- function throttleFilter(ms, trailing = true, leading = true) {
- let lastExec = 0;
- let timer;
- let preventLeading = !leading;
- const clear = () => {
- if (timer) {
- clearTimeout(timer);
- timer = void 0;
- }
- };
- const filter = (invoke2) => {
- const duration = unref(ms);
- const elapsed = Date.now() - lastExec;
- clear();
- if (duration <= 0) {
- lastExec = Date.now();
- return invoke2();
- }
- if (elapsed > duration) {
- lastExec = Date.now();
- if (preventLeading)
- preventLeading = false;
- else
- invoke2();
- } else if (trailing) {
- timer = setTimeout(() => {
- lastExec = Date.now();
- if (!leading)
- preventLeading = true;
- clear();
- invoke2();
- }, duration);
- }
- if (!leading && !timer)
- timer = setTimeout(() => preventLeading = true, duration);
- };
- 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, pause, resume, eventFilter };
- }
- function promiseTimeout(ms, throwOnTimeout = false, reason = "Timeout") {
- return new Promise((resolve, reject) => {
- if (throwOnTimeout)
- setTimeout(() => reject(reason), ms);
- else
- setTimeout(resolve, ms);
- });
- }
- function identity(arg) {
- return arg;
- }
- function createSingletonPromise(fn) {
- let _promise;
- function wrapper() {
- if (!_promise)
- _promise = fn();
- return _promise;
- }
- wrapper.reset = () => __async(this, null, function* () {
- const _prev = _promise;
- _promise = void 0;
- if (_prev)
- yield _prev;
- });
- return wrapper;
- }
- function invoke(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 useDebounceFn(fn, ms = 200, options = {}) {
- return createFilterWrapper(debounceFilter(ms, options), fn);
- }
- function useDebounce(value, ms = 200, options = {}) {
- if (ms <= 0)
- return value;
- const debounced = ref(value.value);
- const updater = useDebounceFn(() => {
- debounced.value = value.value;
- }, ms, options);
- watch(value, () => updater());
- return debounced;
- }
- var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
- var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
- var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
- var __objRest$5 = (source, exclude) => {
- var target = {};
- for (var prop in source)
- if (__hasOwnProp$9.call(source, prop) && exclude.indexOf(prop) < 0)
- target[prop] = source[prop];
- if (source != null && __getOwnPropSymbols$9)
- for (var prop of __getOwnPropSymbols$9(source)) {
- if (exclude.indexOf(prop) < 0 && __propIsEnum$9.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 __defProp$7 = Object.defineProperty;
- var __defProps$4 = Object.defineProperties;
- var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
- var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
- var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
- var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
- var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
- var __spreadValues$7 = (a, b) => {
- for (var prop in b || (b = {}))
- if (__hasOwnProp$8.call(b, prop))
- __defNormalProp$7(a, prop, b[prop]);
- if (__getOwnPropSymbols$8)
- for (var prop of __getOwnPropSymbols$8(b)) {
- if (__propIsEnum$8.call(b, prop))
- __defNormalProp$7(a, prop, b[prop]);
- }
- return a;
- };
- var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
- var __objRest$4 = (source, exclude) => {
- var target = {};
- for (var prop in source)
- if (__hasOwnProp$8.call(source, prop) && exclude.indexOf(prop) < 0)
- target[prop] = source[prop];
- if (source != null && __getOwnPropSymbols$8)
- for (var prop of __getOwnPropSymbols$8(source)) {
- if (exclude.indexOf(prop) < 0 && __propIsEnum$8.call(source, prop))
- target[prop] = source[prop];
- }
- return target;
- };
- function debouncedWatch(source, cb, options = {}) {
- const _a = options, {
- debounce = 0
- } = _a, watchOptions = __objRest$4(_a, [
- "debounce"
- ]);
- return watchWithFilter(source, cb, __spreadProps$4(__spreadValues$7({}, watchOptions), {
- eventFilter: debounceFilter(debounce)
- }));
- }
- function eagerComputed(fn) {
- const result = shallowRef();
- watchSyncEffect(() => {
- result.value = fn();
- });
- return readonly(result);
- }
- function get(obj, key) {
- if (key == null)
- return unref(obj);
- return unref(obj)[key];
- }
- var __defProp$6 = Object.defineProperty;
- var __defProps$3 = Object.defineProperties;
- var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
- var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
- var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
- var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
- var __spreadValues$6 = (a, b) => {
- for (var prop in b || (b = {}))
- if (__hasOwnProp$7.call(b, prop))
- __defNormalProp$6(a, prop, b[prop]);
- if (__getOwnPropSymbols$7)
- for (var prop of __getOwnPropSymbols$7(b)) {
- if (__propIsEnum$7.call(b, prop))
- __defNormalProp$6(a, prop, b[prop]);
- }
- return a;
- };
- var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
- var __objRest$3 = (source, exclude) => {
- var target = {};
- for (var prop in source)
- if (__hasOwnProp$7.call(source, prop) && exclude.indexOf(prop) < 0)
- target[prop] = source[prop];
- if (source != null && __getOwnPropSymbols$7)
- for (var prop of __getOwnPropSymbols$7(source)) {
- if (exclude.indexOf(prop) < 0 && __propIsEnum$7.call(source, prop))
- target[prop] = source[prop];
- }
- return target;
- };
- function ignorableWatch(source, cb, options = {}) {
- const _a = options, {
- eventFilter = bypassFilter
- } = _a, watchOptions = __objRest$3(_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(__spreadValues$6({}, 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 isDefined(v) {
- return unref(v) != null;
- }
- var __defProp$5 = Object.defineProperty;
- var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
- var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
- var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
- var __spreadValues$5 = (a, b) => {
- for (var prop in b || (b = {}))
- if (__hasOwnProp$6.call(b, prop))
- __defNormalProp$5(a, prop, b[prop]);
- if (__getOwnPropSymbols$6)
- for (var prop of __getOwnPropSymbols$6(b)) {
- if (__propIsEnum$6.call(b, prop))
- __defNormalProp$5(a, prop, b[prop]);
- }
- return a;
- };
- function makeDestructurable(obj, arr) {
- if (typeof Symbol !== "undefined") {
- const clone = __spreadValues$5({}, 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 not(v) {
- return computed(() => !unref(v));
- }
- function or(...args) {
- return computed(() => args.some((i) => unref(i)));
- }
- var __defProp$4 = Object.defineProperty;
- var __defProps$2 = Object.defineProperties;
- var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
- var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
- var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
- var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
- var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
- var __spreadValues$4 = (a, b) => {
- for (var prop in b || (b = {}))
- if (__hasOwnProp$5.call(b, prop))
- __defNormalProp$4(a, prop, b[prop]);
- if (__getOwnPropSymbols$5)
- for (var prop of __getOwnPropSymbols$5(b)) {
- if (__propIsEnum$5.call(b, prop))
- __defNormalProp$4(a, prop, b[prop]);
- }
- return a;
- };
- var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
- var __objRest$2 = (source, exclude) => {
- var target = {};
- for (var prop in source)
- if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
- target[prop] = source[prop];
- if (source != null && __getOwnPropSymbols$5)
- for (var prop of __getOwnPropSymbols$5(source)) {
- if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
- target[prop] = source[prop];
- }
- return target;
- };
- function pausableWatch(source, cb, options = {}) {
- const _a = options, {
- eventFilter: filter
- } = _a, watchOptions = __objRest$2(_a, [
- "eventFilter"
- ]);
- const { eventFilter, pause, resume, isActive } = pausableFilter(filter);
- const stop = watchWithFilter(source, cb, __spreadProps$2(__spreadValues$4({}, watchOptions), {
- eventFilter
- }));
- return { stop, pause, resume, isActive };
- }
- function reactifyObject(obj, optionsOrKeys = {}) {
- let keys = [];
- if (Array.isArray(optionsOrKeys)) {
- keys = optionsOrKeys;
- } else {
- 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)) : value
- ];
- }));
- }
- function reactivePick(obj, ...keys) {
- return reactive(Object.fromEntries(keys.map((k) => [k, toRef(obj, k)])));
- }
- function refDefault(source, defaultValue) {
- return computed({
- get() {
- var _a;
- return (_a = source.value) != null ? _a : defaultValue;
- },
- set(value) {
- source.value = value;
- }
- });
- }
- function set(...args) {
- if (args.length === 2) {
- const [ref2, value] = args;
- ref2.value = value;
- }
- if (args.length === 3) {
- if (isVue2) {
- set$1(...args);
- } else {
- const [target, key, value] = args;
- target[key] = value;
- }
- }
- }
- function syncRef(source, targets, {
- flush = "sync",
- deep = false,
- immediate = true
- } = {}) {
- if (!Array.isArray(targets))
- targets = [targets];
- return watch(source, (newValue) => targets.forEach((target) => target.value = newValue), { flush, deep, immediate });
- }
- function useThrottleFn(fn, ms = 200, trailing = true, leading = true) {
- return createFilterWrapper(throttleFilter(ms, trailing, leading), fn);
- }
- function useThrottle(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;
- }
- var __defProp$3 = Object.defineProperty;
- var __defProps$1 = Object.defineProperties;
- var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
- var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
- var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
- var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
- var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
- var __spreadValues$3 = (a, b) => {
- for (var prop in b || (b = {}))
- if (__hasOwnProp$4.call(b, prop))
- __defNormalProp$3(a, prop, b[prop]);
- if (__getOwnPropSymbols$4)
- for (var prop of __getOwnPropSymbols$4(b)) {
- if (__propIsEnum$4.call(b, prop))
- __defNormalProp$3(a, prop, b[prop]);
- }
- return a;
- };
- var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
- var __objRest$1 = (source, exclude) => {
- var target = {};
- for (var prop in source)
- if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
- target[prop] = source[prop];
- if (source != null && __getOwnPropSymbols$4)
- for (var prop of __getOwnPropSymbols$4(source)) {
- if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
- target[prop] = source[prop];
- }
- return target;
- };
- function throttledWatch(source, cb, options = {}) {
- const _a = options, {
- throttle = 0,
- trailing = true,
- leading = true
- } = _a, watchOptions = __objRest$1(_a, [
- "throttle",
- "trailing",
- "leading"
- ]);
- return watchWithFilter(source, cb, __spreadProps$1(__spreadValues$3({}, watchOptions), {
- eventFilter: throttleFilter(throttle, trailing, leading)
- }));
- }
- function toReactive(objectRef) {
- if (!isRef(objectRef))
- return reactive(objectRef);
- const proxy = new Proxy({}, {
- get(_, p, receiver) {
- return Reflect.get(objectRef.value, p, receiver);
- },
- set(_, p, value) {
- 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);
- }
- var __defProp$2 = Object.defineProperty;
- var __defProps = Object.defineProperties;
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
- var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
- var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
- var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
- var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
- var __spreadValues$2 = (a, b) => {
- for (var prop in b || (b = {}))
- if (__hasOwnProp$3.call(b, prop))
- __defNormalProp$2(a, prop, b[prop]);
- if (__getOwnPropSymbols$3)
- for (var prop of __getOwnPropSymbols$3(b)) {
- if (__propIsEnum$3.call(b, prop))
- __defNormalProp$2(a, prop, b[prop]);
- }
- return a;
- };
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(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 {
- objectRef.value = __spreadProps(__spreadValues$2({}, objectRef.value), { [key]: v });
- }
- }
- }));
- }
- return result;
- }
- function tryOnBeforeUnmount(fn) {
- if (getCurrentInstance())
- onBeforeUnmount(fn);
- }
- function tryOnMounted(fn, sync = true) {
- if (getCurrentInstance())
- onMounted(fn);
- else if (sync)
- fn();
- else
- nextTick(fn);
- }
- function tryOnUnmounted(fn) {
- if (getCurrentInstance())
- onUnmounted(fn);
- }
- function until(r) {
- let 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();
- }
- }, {
- flush,
- deep,
- immediate: true
- });
- });
- const promises = [watcher];
- if (timeout) {
- promises.push(promiseTimeout(timeout, throwOnTimeout).finally(() => {
- stop == null ? void 0 : stop();
- }));
- }
- return Promise.race(promises);
- }
- function toBe(value, options) {
- return toMatch((v) => v === unref(value), options);
- }
- 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(unref(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(unref(r))) {
- const instance = {
- toMatch,
- toContains,
- changed,
- changedTimes,
- get not() {
- isNot = !isNot;
- return this;
- }
- };
- return instance;
- } else {
- const instance = {
- toMatch,
- toBe,
- toBeTruthy,
- toBeNull,
- toBeNaN,
- toBeUndefined,
- changed,
- changedTimes,
- get not() {
- isNot = !isNot;
- return this;
- }
- };
- return instance;
- }
- }
- 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 get2 = () => count.value;
- const set2 = (val) => count.value = val;
- const reset = (val = initialValue) => {
- initialValue = val;
- return set2(val);
- };
- return { count, inc, dec, get: get2, set: set2, reset };
- }
- 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() {
- if (interval <= 0)
- return;
- isActive.value = true;
- if (immediateCallback)
- cb();
- clean();
- timer = setInterval(cb, interval);
- }
- if (immediate && isClient)
- resume();
- tryOnScopeDispose(pause);
- return {
- isActive,
- pause,
- resume
- };
- }
- var __defProp$1 = Object.defineProperty;
- var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
- var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
- var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
- var __spreadValues$1 = (a, b) => {
- for (var prop in b || (b = {}))
- if (__hasOwnProp$2.call(b, prop))
- __defNormalProp$1(a, prop, b[prop]);
- if (__getOwnPropSymbols$2)
- for (var prop of __getOwnPropSymbols$2(b)) {
- if (__propIsEnum$2.call(b, prop))
- __defNormalProp$1(a, prop, b[prop]);
- }
- return a;
- };
- function useInterval(interval = 1e3, options = {}) {
- const {
- controls: exposeControls = false,
- immediate = true
- } = options;
- const counter = ref(0);
- const controls = useIntervalFn(() => counter.value += 1, interval, { immediate });
- if (exposeControls) {
- return __spreadValues$1({
- counter
- }, 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(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);
- }, unref(interval));
- }
- if (immediate) {
- isPending.value = true;
- if (isClient)
- start();
- }
- tryOnScopeDispose(stop);
- return {
- isPending,
- start,
- stop
- };
- }
- var __defProp = Object.defineProperty;
- var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
- var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
- var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
- var __spreadValues = (a, b) => {
- for (var prop in b || (b = {}))
- if (__hasOwnProp$1.call(b, prop))
- __defNormalProp(a, prop, b[prop]);
- if (__getOwnPropSymbols$1)
- for (var prop of __getOwnPropSymbols$1(b)) {
- if (__propIsEnum$1.call(b, prop))
- __defNormalProp(a, prop, b[prop]);
- }
- return a;
- };
- function useTimeout(interval = 1e3, options = {}) {
- const {
- controls: exposeControls = false
- } = options;
- const controls = useTimeoutFn(noop, interval, options);
- const ready = computed(() => !controls.isPending.value);
- if (exposeControls) {
- return __spreadValues({
- ready
- }, controls);
- } else {
- return ready;
- }
- }
- function useToggle(initialValue = false) {
- if (isRef(initialValue)) {
- return (value) => {
- initialValue.value = typeof value === "boolean" ? value : !initialValue.value;
- };
- } else {
- const boolean = ref(initialValue);
- const toggle = (value) => {
- boolean.value = typeof value === "boolean" ? value : !boolean.value;
- };
- return [boolean, toggle];
- }
- }
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
- var __hasOwnProp = Object.prototype.hasOwnProperty;
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
- var __objRest = (source, exclude) => {
- var target = {};
- for (var prop in source)
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
- target[prop] = source[prop];
- if (source != null && __getOwnPropSymbols)
- for (var prop of __getOwnPropSymbols(source)) {
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
- target[prop] = source[prop];
- }
- return target;
- };
- function watchAtMost(source, cb, options) {
- const _a = options, {
- count
- } = _a, watchOptions = __objRest(_a, [
- "count"
- ]);
- const current = ref(0);
- const stop = watchWithFilter(source, (...args) => {
- current.value += 1;
- if (current.value >= unref(count))
- stop();
- cb(...args);
- }, watchOptions);
- return { count: current, stop };
- }
- function watchOnce(source, cb, options) {
- const stop = watch(source, (...args) => {
- stop();
- return cb(...args);
- }, options);
- }
- function whenever(source, cb, options) {
- return watch(source, (v, ov, onInvalidate) => {
- if (v)
- cb(v, ov, onInvalidate);
- }, options);
- }
- export {
- and,
- biSyncRef,
- controlledComputed,
- extendRef,
- controlledRef,
- createEventHook,
- createGlobalState,
- reactify,
- tryOnScopeDispose,
- createSharedComposable,
- isClient,
- isDef,
- assert,
- isBoolean,
- isFunction,
- isNumber,
- isString,
- isObject,
- isWindow,
- now,
- timestamp,
- clamp,
- noop,
- rand,
- createFilterWrapper,
- bypassFilter,
- debounceFilter,
- throttleFilter,
- pausableFilter,
- promiseTimeout,
- identity,
- createSingletonPromise,
- invoke,
- containsProp,
- increaseWithUnit,
- objectPick,
- useDebounceFn,
- useDebounce,
- watchWithFilter,
- debouncedWatch,
- eagerComputed,
- get,
- ignorableWatch,
- isDefined,
- makeDestructurable,
- not,
- or,
- pausableWatch,
- reactifyObject,
- reactivePick,
- refDefault,
- set,
- syncRef,
- useThrottleFn,
- useThrottle,
- throttledWatch,
- toReactive,
- toRefs,
- tryOnBeforeUnmount,
- tryOnMounted,
- tryOnUnmounted,
- until,
- useCounter,
- useIntervalFn,
- useInterval,
- useLastChanged,
- useTimeoutFn,
- useTimeout,
- useToggle,
- watchAtMost,
- watchOnce,
- whenever
- };
- //# sourceMappingURL=chunk-22ATY35G.js.map
|