@vueuse/shared 12.2.0 → 12.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +65 -62
- package/index.d.cts +10 -5
- package/index.d.mts +10 -5
- package/index.d.ts +10 -5
- package/index.iife.js +65 -62
- package/index.iife.min.js +1 -1
- package/index.mjs +66 -64
- package/package.json +1 -1
package/index.iife.js
CHANGED
|
@@ -207,13 +207,8 @@
|
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
-
function toValue(r) {
|
|
211
|
-
return typeof r === "function" ? r() : vue.unref(r);
|
|
212
|
-
}
|
|
213
|
-
const resolveUnref = toValue;
|
|
214
|
-
|
|
215
210
|
function reactify(fn, options) {
|
|
216
|
-
const unrefFn = (options == null ? void 0 : options.computedGetter) === false ? vue.unref : toValue;
|
|
211
|
+
const unrefFn = (options == null ? void 0 : options.computedGetter) === false ? vue.unref : vue.toValue;
|
|
217
212
|
return function(...args) {
|
|
218
213
|
return vue.computed(() => fn.apply(this, args.map((i) => unrefFn(i))));
|
|
219
214
|
};
|
|
@@ -282,7 +277,7 @@
|
|
|
282
277
|
function reactiveOmit(obj, ...keys) {
|
|
283
278
|
const flatKeys = keys.flat();
|
|
284
279
|
const predicate = flatKeys[0];
|
|
285
|
-
return reactiveComputed(() => typeof predicate === "function" ? Object.fromEntries(Object.entries(vue.toRefs(obj)).filter(([k, v]) => !predicate(toValue(v), k))) : Object.fromEntries(Object.entries(vue.toRefs(obj)).filter((e) => !flatKeys.includes(e[0]))));
|
|
280
|
+
return reactiveComputed(() => typeof predicate === "function" ? Object.fromEntries(Object.entries(vue.toRefs(obj)).filter(([k, v]) => !predicate(vue.toValue(v), k))) : Object.fromEntries(Object.entries(vue.toRefs(obj)).filter((e) => !flatKeys.includes(e[0]))));
|
|
286
281
|
}
|
|
287
282
|
|
|
288
283
|
const isClient = typeof window !== "undefined" && typeof document !== "undefined";
|
|
@@ -333,8 +328,8 @@
|
|
|
333
328
|
lastRejector = noop;
|
|
334
329
|
};
|
|
335
330
|
const filter = (invoke) => {
|
|
336
|
-
const duration = toValue(ms);
|
|
337
|
-
const maxDuration = toValue(options.maxWait);
|
|
331
|
+
const duration = vue.toValue(ms);
|
|
332
|
+
const maxDuration = vue.toValue(options.maxWait);
|
|
338
333
|
if (timer)
|
|
339
334
|
_clearTimeout(timer);
|
|
340
335
|
if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
|
|
@@ -387,7 +382,7 @@
|
|
|
387
382
|
}
|
|
388
383
|
};
|
|
389
384
|
const filter = (_invoke) => {
|
|
390
|
-
const duration = toValue(ms);
|
|
385
|
+
const duration = vue.toValue(ms);
|
|
391
386
|
const elapsed = Date.now() - lastExec;
|
|
392
387
|
const invoke = () => {
|
|
393
388
|
return lastValue = _invoke();
|
|
@@ -513,6 +508,9 @@
|
|
|
513
508
|
function getLifeCycleTarget(target) {
|
|
514
509
|
return target || vue.getCurrentInstance();
|
|
515
510
|
}
|
|
511
|
+
function toArray(value) {
|
|
512
|
+
return Array.isArray(value) ? value : [value];
|
|
513
|
+
}
|
|
516
514
|
|
|
517
515
|
function toRef(...args) {
|
|
518
516
|
if (args.length !== 1)
|
|
@@ -525,17 +523,17 @@
|
|
|
525
523
|
function reactivePick(obj, ...keys) {
|
|
526
524
|
const flatKeys = keys.flat();
|
|
527
525
|
const predicate = flatKeys[0];
|
|
528
|
-
return reactiveComputed(() => typeof predicate === "function" ? Object.fromEntries(Object.entries(vue.toRefs(obj)).filter(([k, v]) => predicate(toValue(v), k))) : Object.fromEntries(flatKeys.map((k) => [k, toRef(obj, k)])));
|
|
526
|
+
return reactiveComputed(() => typeof predicate === "function" ? Object.fromEntries(Object.entries(vue.toRefs(obj)).filter(([k, v]) => predicate(vue.toValue(v), k))) : Object.fromEntries(flatKeys.map((k) => [k, toRef(obj, k)])));
|
|
529
527
|
}
|
|
530
528
|
|
|
531
529
|
function refAutoReset(defaultValue, afterMs = 1e4) {
|
|
532
530
|
return vue.customRef((track, trigger) => {
|
|
533
|
-
let value = toValue(defaultValue);
|
|
531
|
+
let value = vue.toValue(defaultValue);
|
|
534
532
|
let timer;
|
|
535
533
|
const resetAfter = () => setTimeout(() => {
|
|
536
|
-
value = toValue(defaultValue);
|
|
534
|
+
value = vue.toValue(defaultValue);
|
|
537
535
|
trigger();
|
|
538
|
-
}, toValue(afterMs));
|
|
536
|
+
}, vue.toValue(afterMs));
|
|
539
537
|
tryOnScopeDispose(() => {
|
|
540
538
|
clearTimeout(timer);
|
|
541
539
|
});
|
|
@@ -740,8 +738,7 @@
|
|
|
740
738
|
deep = false,
|
|
741
739
|
immediate = true
|
|
742
740
|
} = options;
|
|
743
|
-
|
|
744
|
-
targets = [targets];
|
|
741
|
+
targets = toArray(targets);
|
|
745
742
|
return vue.watch(
|
|
746
743
|
source,
|
|
747
744
|
(newValue) => targets.forEach((target) => target.value = newValue),
|
|
@@ -760,7 +757,7 @@
|
|
|
760
757
|
},
|
|
761
758
|
set(v) {
|
|
762
759
|
var _a;
|
|
763
|
-
const replaceRef = (_a = toValue(options.replaceRef)) != null ? _a : true;
|
|
760
|
+
const replaceRef = (_a = vue.toValue(options.replaceRef)) != null ? _a : true;
|
|
764
761
|
if (replaceRef) {
|
|
765
762
|
if (Array.isArray(objectRef.value)) {
|
|
766
763
|
const copy = [...objectRef.value];
|
|
@@ -780,6 +777,9 @@
|
|
|
780
777
|
return result;
|
|
781
778
|
}
|
|
782
779
|
|
|
780
|
+
const toValue = vue.toValue;
|
|
781
|
+
const resolveUnref = vue.toValue;
|
|
782
|
+
|
|
783
783
|
function tryOnBeforeMount(fn, sync = true, target) {
|
|
784
784
|
const instance = getLifeCycleTarget(target);
|
|
785
785
|
if (instance)
|
|
@@ -837,7 +837,7 @@
|
|
|
837
837
|
const promises = [watcher];
|
|
838
838
|
if (timeout != null) {
|
|
839
839
|
promises.push(
|
|
840
|
-
promiseTimeout(timeout, throwOnTimeout).then(() => toValue(r)).finally(() => stop == null ? void 0 : stop())
|
|
840
|
+
promiseTimeout(timeout, throwOnTimeout).then(() => vue.toValue(r)).finally(() => stop == null ? void 0 : stop())
|
|
841
841
|
);
|
|
842
842
|
}
|
|
843
843
|
return Promise.race(promises);
|
|
@@ -869,9 +869,9 @@
|
|
|
869
869
|
const promises = [watcher];
|
|
870
870
|
if (timeout != null) {
|
|
871
871
|
promises.push(
|
|
872
|
-
promiseTimeout(timeout, throwOnTimeout).then(() => toValue(r)).finally(() => {
|
|
872
|
+
promiseTimeout(timeout, throwOnTimeout).then(() => vue.toValue(r)).finally(() => {
|
|
873
873
|
stop == null ? void 0 : stop();
|
|
874
|
-
return toValue(r);
|
|
874
|
+
return vue.toValue(r);
|
|
875
875
|
})
|
|
876
876
|
);
|
|
877
877
|
}
|
|
@@ -892,7 +892,7 @@
|
|
|
892
892
|
function toContains(value, options) {
|
|
893
893
|
return toMatch((v) => {
|
|
894
894
|
const array = Array.from(v);
|
|
895
|
-
return array.includes(value) || array.includes(toValue(value));
|
|
895
|
+
return array.includes(value) || array.includes(vue.toValue(value));
|
|
896
896
|
}, options);
|
|
897
897
|
}
|
|
898
898
|
function changed(options) {
|
|
@@ -905,7 +905,7 @@
|
|
|
905
905
|
return count >= n;
|
|
906
906
|
}, options);
|
|
907
907
|
}
|
|
908
|
-
if (Array.isArray(toValue(r))) {
|
|
908
|
+
if (Array.isArray(vue.toValue(r))) {
|
|
909
909
|
const instance = {
|
|
910
910
|
toMatch,
|
|
911
911
|
toContains,
|
|
@@ -952,31 +952,31 @@
|
|
|
952
952
|
const key = compareFn;
|
|
953
953
|
compareFn = (value, othVal) => value[key] === othVal[key];
|
|
954
954
|
}
|
|
955
|
-
const diff1 = vue.computed(() => toValue(list).filter((x) => toValue(values).findIndex((y) => compareFn(x, y)) === -1));
|
|
955
|
+
const diff1 = vue.computed(() => vue.toValue(list).filter((x) => vue.toValue(values).findIndex((y) => compareFn(x, y)) === -1));
|
|
956
956
|
if (symmetric) {
|
|
957
|
-
const diff2 = vue.computed(() => toValue(values).filter((x) => toValue(list).findIndex((y) => compareFn(x, y)) === -1));
|
|
958
|
-
return vue.computed(() => symmetric ? [...toValue(diff1), ...toValue(diff2)] : toValue(diff1));
|
|
957
|
+
const diff2 = vue.computed(() => vue.toValue(values).filter((x) => vue.toValue(list).findIndex((y) => compareFn(x, y)) === -1));
|
|
958
|
+
return vue.computed(() => symmetric ? [...vue.toValue(diff1), ...vue.toValue(diff2)] : vue.toValue(diff1));
|
|
959
959
|
} else {
|
|
960
960
|
return diff1;
|
|
961
961
|
}
|
|
962
962
|
}
|
|
963
963
|
|
|
964
964
|
function useArrayEvery(list, fn) {
|
|
965
|
-
return vue.computed(() => toValue(list).every((element, index, array) => fn(toValue(element), index, array)));
|
|
965
|
+
return vue.computed(() => vue.toValue(list).every((element, index, array) => fn(vue.toValue(element), index, array)));
|
|
966
966
|
}
|
|
967
967
|
|
|
968
968
|
function useArrayFilter(list, fn) {
|
|
969
|
-
return vue.computed(() => toValue(list).map((i) => toValue(i)).filter(fn));
|
|
969
|
+
return vue.computed(() => vue.toValue(list).map((i) => vue.toValue(i)).filter(fn));
|
|
970
970
|
}
|
|
971
971
|
|
|
972
972
|
function useArrayFind(list, fn) {
|
|
973
|
-
return vue.computed(() => toValue(
|
|
974
|
-
toValue(list).find((element, index, array) => fn(toValue(element), index, array))
|
|
973
|
+
return vue.computed(() => vue.toValue(
|
|
974
|
+
vue.toValue(list).find((element, index, array) => fn(vue.toValue(element), index, array))
|
|
975
975
|
));
|
|
976
976
|
}
|
|
977
977
|
|
|
978
978
|
function useArrayFindIndex(list, fn) {
|
|
979
|
-
return vue.computed(() => toValue(list).findIndex((element, index, array) => fn(toValue(element), index, array)));
|
|
979
|
+
return vue.computed(() => vue.toValue(list).findIndex((element, index, array) => fn(vue.toValue(element), index, array)));
|
|
980
980
|
}
|
|
981
981
|
|
|
982
982
|
function findLast(arr, cb) {
|
|
@@ -988,8 +988,8 @@
|
|
|
988
988
|
return void 0;
|
|
989
989
|
}
|
|
990
990
|
function useArrayFindLast(list, fn) {
|
|
991
|
-
return vue.computed(() => toValue(
|
|
992
|
-
!Array.prototype.findLast ? findLast(toValue(list), (element, index, array) => fn(toValue(element), index, array)) : toValue(list).findLast((element, index, array) => fn(toValue(element), index, array))
|
|
991
|
+
return vue.computed(() => vue.toValue(
|
|
992
|
+
!Array.prototype.findLast ? findLast(vue.toValue(list), (element, index, array) => fn(vue.toValue(element), index, array)) : vue.toValue(list).findLast((element, index, array) => fn(vue.toValue(element), index, array))
|
|
993
993
|
));
|
|
994
994
|
}
|
|
995
995
|
|
|
@@ -1008,35 +1008,35 @@
|
|
|
1008
1008
|
}
|
|
1009
1009
|
if (typeof comparator === "string") {
|
|
1010
1010
|
const key = comparator;
|
|
1011
|
-
comparator = (element, value2) => element[key] === toValue(value2);
|
|
1011
|
+
comparator = (element, value2) => element[key] === vue.toValue(value2);
|
|
1012
1012
|
}
|
|
1013
|
-
comparator = comparator != null ? comparator : (element, value2) => element === toValue(value2);
|
|
1014
|
-
return vue.computed(() => toValue(list).slice(formIndex).some((element, index, array) => comparator(
|
|
1015
|
-
toValue(element),
|
|
1016
|
-
toValue(value),
|
|
1013
|
+
comparator = comparator != null ? comparator : (element, value2) => element === vue.toValue(value2);
|
|
1014
|
+
return vue.computed(() => vue.toValue(list).slice(formIndex).some((element, index, array) => comparator(
|
|
1015
|
+
vue.toValue(element),
|
|
1016
|
+
vue.toValue(value),
|
|
1017
1017
|
index,
|
|
1018
|
-
toValue(array)
|
|
1018
|
+
vue.toValue(array)
|
|
1019
1019
|
)));
|
|
1020
1020
|
}
|
|
1021
1021
|
|
|
1022
1022
|
function useArrayJoin(list, separator) {
|
|
1023
|
-
return vue.computed(() => toValue(list).map((i) => toValue(i)).join(toValue(separator)));
|
|
1023
|
+
return vue.computed(() => vue.toValue(list).map((i) => vue.toValue(i)).join(vue.toValue(separator)));
|
|
1024
1024
|
}
|
|
1025
1025
|
|
|
1026
1026
|
function useArrayMap(list, fn) {
|
|
1027
|
-
return vue.computed(() => toValue(list).map((i) => toValue(i)).map(fn));
|
|
1027
|
+
return vue.computed(() => vue.toValue(list).map((i) => vue.toValue(i)).map(fn));
|
|
1028
1028
|
}
|
|
1029
1029
|
|
|
1030
1030
|
function useArrayReduce(list, reducer, ...args) {
|
|
1031
|
-
const reduceCallback = (sum, value, index) => reducer(toValue(sum), toValue(value), index);
|
|
1031
|
+
const reduceCallback = (sum, value, index) => reducer(vue.toValue(sum), vue.toValue(value), index);
|
|
1032
1032
|
return vue.computed(() => {
|
|
1033
|
-
const resolved = toValue(list);
|
|
1034
|
-
return args.length ? resolved.reduce(reduceCallback, typeof args[0] === "function" ? toValue(args[0]()) : toValue(args[0])) : resolved.reduce(reduceCallback);
|
|
1033
|
+
const resolved = vue.toValue(list);
|
|
1034
|
+
return args.length ? resolved.reduce(reduceCallback, typeof args[0] === "function" ? vue.toValue(args[0]()) : vue.toValue(args[0])) : resolved.reduce(reduceCallback);
|
|
1035
1035
|
});
|
|
1036
1036
|
}
|
|
1037
1037
|
|
|
1038
1038
|
function useArraySome(list, fn) {
|
|
1039
|
-
return vue.computed(() => toValue(list).some((element, index, array) => fn(toValue(element), index, array)));
|
|
1039
|
+
return vue.computed(() => vue.toValue(list).some((element, index, array) => fn(vue.toValue(element), index, array)));
|
|
1040
1040
|
}
|
|
1041
1041
|
|
|
1042
1042
|
function uniq(array) {
|
|
@@ -1051,7 +1051,7 @@
|
|
|
1051
1051
|
}
|
|
1052
1052
|
function useArrayUnique(list, compareFn) {
|
|
1053
1053
|
return vue.computed(() => {
|
|
1054
|
-
const resolvedList = toValue(list).map((element) => toValue(element));
|
|
1054
|
+
const resolvedList = vue.toValue(list).map((element) => vue.toValue(element));
|
|
1055
1055
|
return compareFn ? uniqueElementsBy(resolvedList, compareFn) : uniq(resolvedList);
|
|
1056
1056
|
});
|
|
1057
1057
|
}
|
|
@@ -1105,8 +1105,8 @@
|
|
|
1105
1105
|
M: () => month + 1,
|
|
1106
1106
|
Mo: () => formatOrdinal(month + 1),
|
|
1107
1107
|
MM: () => `${month + 1}`.padStart(2, "0"),
|
|
1108
|
-
MMM: () => date.toLocaleDateString(toValue(options.locales), { month: "short" }),
|
|
1109
|
-
MMMM: () => date.toLocaleDateString(toValue(options.locales), { month: "long" }),
|
|
1108
|
+
MMM: () => date.toLocaleDateString(vue.toValue(options.locales), { month: "short" }),
|
|
1109
|
+
MMMM: () => date.toLocaleDateString(vue.toValue(options.locales), { month: "long" }),
|
|
1110
1110
|
D: () => String(days),
|
|
1111
1111
|
Do: () => formatOrdinal(days),
|
|
1112
1112
|
DD: () => `${days}`.padStart(2, "0"),
|
|
@@ -1124,9 +1124,9 @@
|
|
|
1124
1124
|
ss: () => `${seconds}`.padStart(2, "0"),
|
|
1125
1125
|
SSS: () => `${milliseconds}`.padStart(3, "0"),
|
|
1126
1126
|
d: () => day,
|
|
1127
|
-
dd: () => date.toLocaleDateString(toValue(options.locales), { weekday: "narrow" }),
|
|
1128
|
-
ddd: () => date.toLocaleDateString(toValue(options.locales), { weekday: "short" }),
|
|
1129
|
-
dddd: () => date.toLocaleDateString(toValue(options.locales), { weekday: "long" }),
|
|
1127
|
+
dd: () => date.toLocaleDateString(vue.toValue(options.locales), { weekday: "narrow" }),
|
|
1128
|
+
ddd: () => date.toLocaleDateString(vue.toValue(options.locales), { weekday: "short" }),
|
|
1129
|
+
dddd: () => date.toLocaleDateString(vue.toValue(options.locales), { weekday: "long" }),
|
|
1130
1130
|
A: () => meridiem(hours, minutes),
|
|
1131
1131
|
AA: () => meridiem(hours, minutes, false, true),
|
|
1132
1132
|
a: () => meridiem(hours, minutes, true),
|
|
@@ -1155,7 +1155,7 @@
|
|
|
1155
1155
|
return new Date(date);
|
|
1156
1156
|
}
|
|
1157
1157
|
function useDateFormat(date, formatStr = "HH:mm:ss", options = {}) {
|
|
1158
|
-
return vue.computed(() => formatDate(normalizeDate(toValue(date)), toValue(formatStr), options));
|
|
1158
|
+
return vue.computed(() => formatDate(normalizeDate(vue.toValue(date)), vue.toValue(formatStr), options));
|
|
1159
1159
|
}
|
|
1160
1160
|
|
|
1161
1161
|
function useIntervalFn(cb, interval = 1e3, options = {}) {
|
|
@@ -1176,7 +1176,7 @@
|
|
|
1176
1176
|
clean();
|
|
1177
1177
|
}
|
|
1178
1178
|
function resume() {
|
|
1179
|
-
const intervalValue = toValue(interval);
|
|
1179
|
+
const intervalValue = vue.toValue(interval);
|
|
1180
1180
|
if (intervalValue <= 0)
|
|
1181
1181
|
return;
|
|
1182
1182
|
isActive.value = true;
|
|
@@ -1267,7 +1267,7 @@
|
|
|
1267
1267
|
isPending.value = false;
|
|
1268
1268
|
timer = null;
|
|
1269
1269
|
cb(...args);
|
|
1270
|
-
}, toValue(interval));
|
|
1270
|
+
}, vue.toValue(interval));
|
|
1271
1271
|
}
|
|
1272
1272
|
if (immediate) {
|
|
1273
1273
|
isPending.value = true;
|
|
@@ -1310,8 +1310,10 @@
|
|
|
1310
1310
|
nanToZero
|
|
1311
1311
|
} = options;
|
|
1312
1312
|
return vue.computed(() => {
|
|
1313
|
-
let resolved = toValue(value);
|
|
1314
|
-
if (typeof
|
|
1313
|
+
let resolved = vue.toValue(value);
|
|
1314
|
+
if (typeof method === "function")
|
|
1315
|
+
resolved = method(resolved);
|
|
1316
|
+
else if (typeof resolved === "string")
|
|
1315
1317
|
resolved = Number[method](resolved, radix);
|
|
1316
1318
|
if (nanToZero && Number.isNaN(resolved))
|
|
1317
1319
|
resolved = 0;
|
|
@@ -1320,7 +1322,7 @@
|
|
|
1320
1322
|
}
|
|
1321
1323
|
|
|
1322
1324
|
function useToString(value) {
|
|
1323
|
-
return vue.computed(() => `${toValue(value)}`);
|
|
1325
|
+
return vue.computed(() => `${vue.toValue(value)}`);
|
|
1324
1326
|
}
|
|
1325
1327
|
|
|
1326
1328
|
function useToggle(initialValue = false, options = {}) {
|
|
@@ -1335,8 +1337,8 @@
|
|
|
1335
1337
|
_value.value = value;
|
|
1336
1338
|
return _value.value;
|
|
1337
1339
|
} else {
|
|
1338
|
-
const truthy = toValue(truthyValue);
|
|
1339
|
-
_value.value = _value.value === truthy ? toValue(falsyValue) : truthy;
|
|
1340
|
+
const truthy = vue.toValue(truthyValue);
|
|
1341
|
+
_value.value = _value.value === truthy ? vue.toValue(falsyValue) : truthy;
|
|
1340
1342
|
return _value.value;
|
|
1341
1343
|
}
|
|
1342
1344
|
}
|
|
@@ -1347,7 +1349,7 @@
|
|
|
1347
1349
|
}
|
|
1348
1350
|
|
|
1349
1351
|
function watchArray(source, cb, options) {
|
|
1350
|
-
let oldList = (options == null ? void 0 : options.immediate) ? [] : [...source instanceof Function ? source() : Array.isArray(source) ? source : toValue(source)];
|
|
1352
|
+
let oldList = (options == null ? void 0 : options.immediate) ? [] : [...source instanceof Function ? source() : Array.isArray(source) ? source : vue.toValue(source)];
|
|
1351
1353
|
return vue.watch(source, (newList, _, onCleanup) => {
|
|
1352
1354
|
const oldListRemains = Array.from({ length: oldList.length });
|
|
1353
1355
|
const added = [];
|
|
@@ -1379,7 +1381,7 @@
|
|
|
1379
1381
|
source,
|
|
1380
1382
|
(...args) => {
|
|
1381
1383
|
current.value += 1;
|
|
1382
|
-
if (current.value >= toValue(count))
|
|
1384
|
+
if (current.value >= vue.toValue(count))
|
|
1383
1385
|
vue.nextTick(() => stop());
|
|
1384
1386
|
cb(...args);
|
|
1385
1387
|
},
|
|
@@ -1556,8 +1558,8 @@
|
|
|
1556
1558
|
if (vue.isReactive(sources))
|
|
1557
1559
|
return sources;
|
|
1558
1560
|
if (Array.isArray(sources))
|
|
1559
|
-
return sources.map((item) => toValue(item));
|
|
1560
|
-
return toValue(sources);
|
|
1561
|
+
return sources.map((item) => vue.toValue(item));
|
|
1562
|
+
return vue.toValue(sources);
|
|
1561
1563
|
}
|
|
1562
1564
|
function getOldValue(source) {
|
|
1563
1565
|
return Array.isArray(source) ? source.map(() => void 0) : void 0;
|
|
@@ -1652,6 +1654,7 @@
|
|
|
1652
1654
|
exports.throttledRef = refThrottled;
|
|
1653
1655
|
exports.throttledWatch = watchThrottled;
|
|
1654
1656
|
exports.timestamp = timestamp;
|
|
1657
|
+
exports.toArray = toArray;
|
|
1655
1658
|
exports.toReactive = toReactive;
|
|
1656
1659
|
exports.toRef = toRef;
|
|
1657
1660
|
exports.toRefs = toRefs;
|
package/index.iife.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(o,u){"use strict";function H(e,t){var n;const r=u.shallowRef();return u.watchEffect(()=>{r.value=e()},{...t,flush:(n=t?.flush)!=null?n:"sync"}),u.readonly(r)}function G(e,t){let n,r,i;const c=u.ref(!0),a=()=>{c.value=!0,i()};u.watch(e,a,{flush:"sync"});const l=typeof t=="function"?t:t.get,f=typeof t=="function"?void 0:t.set,y=u.customRef((h,m)=>(r=h,i=m,{get(){return c.value&&(n=l(n),c.value=!1),r(),n},set(d){f?.(d)}}));return Object.isExtensible(y)&&(y.trigger=a),y}function A(e){return u.getCurrentScope()?(u.onScopeDispose(e),!0):!1}function de(){const e=new Set,t=c=>{e.delete(c)};return{on:c=>{e.add(c);const a=()=>t(c);return A(a),{off:a}},off:t,trigger:(...c)=>Promise.all(Array.from(e).map(a=>a(...c))),clear:()=>{e.clear()}}}function me(e){let t=!1,n;const r=u.effectScope(!0);return(...i)=>(t||(n=r.run(()=>e(...i)),t=!0),n)}const T=new WeakMap,z=(...e)=>{var t;const n=e[0],r=(t=u.getCurrentInstance())==null?void 0:t.proxy;if(r==null&&!u.hasInjectionContext())throw new Error("injectLocal must be called in setup");return r&&T.has(r)&&n in T.get(r)?T.get(r)[n]:u.inject(...e)},q=(e,t)=>{var n;const r=(n=u.getCurrentInstance())==null?void 0:n.proxy;if(r==null)throw new Error("provideLocal must be called in setup");T.has(r)||T.set(r,Object.create(null));const i=T.get(r);i[e]=t,u.provide(e,t)};function he(e,t){const n=t?.injectionKey||Symbol(e.name||"InjectionState"),r=t?.defaultValue;return[(...a)=>{const l=e(...a);return q(n,l),l},()=>z(n,r)]}function ye(e){let t=0,n,r;const i=()=>{t-=1,r&&t<=0&&(r.stop(),n=void 0,r=void 0)};return(...c)=>(t+=1,r||(r=u.effectScope(!0),n=r.run(()=>e(...c))),A(i),n)}function Z(e,t,{enumerable:n=!1,unwrap:r=!0}={}){for(const[i,c]of Object.entries(t))i!=="value"&&(u.isRef(c)&&r?Object.defineProperty(e,i,{get(){return c.value},set(a){c.value=a},enumerable:n}):Object.defineProperty(e,i,{value:c,enumerable:n}));return e}function ge(e,t){return t==null?u.unref(e):u.unref(e)[t]}function we(e){return u.unref(e)!=null}function be(e,t){if(typeof Symbol<"u"){const n={...e};return Object.defineProperty(n,Symbol.iterator,{enumerable:!1,value(){let r=0;return{next:()=>({value:t[r++],done:r>t.length})}}}),n}else return Object.assign([...t],e)}function s(e){return typeof e=="function"?e():u.unref(e)}const pe=s;function E(e,t){const n=t?.computedGetter===!1?u.unref:s;return function(...r){return u.computed(()=>e.apply(this,r.map(i=>n(i))))}}function ve(e,t={}){let n=[],r;if(Array.isArray(t))n=t;else{r=t;const{includeOwnProperties:i=!0}=t;n.push(...Object.keys(e)),i&&n.push(...Object.getOwnPropertyNames(e))}return Object.fromEntries(n.map(i=>{const c=e[i];return[i,typeof c=="function"?E(c.bind(e),r):c]}))}function J(e){if(!u.isRef(e))return u.reactive(e);const t=new Proxy({},{get(n,r,i){return u.unref(Reflect.get(e.value,r,i))},set(n,r,i){return u.isRef(e.value[r])&&!u.isRef(i)?e.value[r].value=i:e.value[r]=i,!0},deleteProperty(n,r){return Reflect.deleteProperty(e.value,r)},has(n,r){return Reflect.has(e.value,r)},ownKeys(){return Object.keys(e.value)},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}});return u.reactive(t)}function _(e){return J(u.computed(e))}function Ae(e,...t){const n=t.flat(),r=n[0];return _(()=>Object.fromEntries(typeof r=="function"?Object.entries(u.toRefs(e)).filter(([i,c])=>!r(s(c),i)):Object.entries(u.toRefs(e)).filter(i=>!n.includes(i[0]))))}const F=typeof window<"u"&&typeof document<"u",Oe=typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope,Se=e=>typeof e<"u",Te=e=>e!=null,De=(e,...t)=>{e||console.warn(...t)},Fe=Object.prototype.toString,X=e=>Fe.call(e)==="[object Object]",Me=()=>Date.now(),K=()=>+Date.now(),Pe=(e,t,n)=>Math.min(n,Math.max(t,e)),O=()=>{},Ie=(e,t)=>(e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e),Re=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Ce=ke();function ke(){var e,t;return F&&((e=window?.navigator)==null?void 0:e.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((t=window?.navigator)==null?void 0:t.maxTouchPoints)>2&&/iPad|Macintosh/.test(window?.navigator.userAgent))}function M(e,t){function n(...r){return new Promise((i,c)=>{Promise.resolve(e(()=>t.apply(this,r),{fn:t,thisArg:this,args:r})).then(i).catch(c)})}return n}const R=e=>e();function N(e,t={}){let n,r,i=O;const c=l=>{clearTimeout(l),i(),i=O};return l=>{const f=s(e),y=s(t.maxWait);return n&&c(n),f<=0||y!==void 0&&y<=0?(r&&(c(r),r=null),Promise.resolve(l())):new Promise((h,m)=>{i=t.rejectOnCancel?m:h,y&&!r&&(r=setTimeout(()=>{n&&c(n),r=null,h(l())},y)),n=setTimeout(()=>{r&&c(r),r=null,h(l())},f)})}}function j(...e){let t=0,n,r=!0,i=O,c,a,l,f,y;!u.isRef(e[0])&&typeof e[0]=="object"?{delay:a,trailing:l=!0,leading:f=!0,rejectOnCancel:y=!1}=e[0]:[a,l=!0,f=!0,y=!1]=e;const h=()=>{n&&(clearTimeout(n),n=void 0,i(),i=O)};return d=>{const g=s(a),w=Date.now()-t,p=()=>c=d();return h(),g<=0?(t=Date.now(),p()):(w>g&&(f||!r)?(t=Date.now(),p()):l&&(c=new Promise((b,v)=>{i=y?v:b,n=setTimeout(()=>{t=Date.now(),r=!0,b(p()),h()},Math.max(0,g-w))})),!f&&!n&&(n=setTimeout(()=>r=!0,g)),r=!1,c)}}function Q(e=R){const t=u.ref(!0);function n(){t.value=!1}function r(){t.value=!0}const i=(...c)=>{t.value&&e(...c)};return{isActive:u.readonly(t),pause:n,resume:r,eventFilter:i}}function x(e){const t=Object.create(null);return n=>t[n]||(t[n]=e(n))}const Ee=/\B([A-Z])/g,_e=x(e=>e.replace(Ee,"-$1").toLowerCase()),Ne=/-(\w)/g,je=x(e=>e.replace(Ne,(t,n)=>n?n.toUpperCase():""));function L(e,t=!1,n="Timeout"){return new Promise((r,i)=>{setTimeout(t?()=>i(n):r,e)})}function Le(e){return e}function We(e){let t;function n(){return t||(t=e()),t}return n.reset=async()=>{const r=t;t=void 0,r&&await r},n}function Ue(e){return e()}function ee(e,...t){return t.some(n=>n in e)}function Be(e,t){var n;if(typeof e=="number")return e+t;const r=((n=e.match(/^-?\d+\.?\d*/))==null?void 0:n[0])||"",i=e.slice(r.length),c=Number.parseFloat(r)+t;return Number.isNaN(c)?e:c+i}function Ve(e){return e.endsWith("rem")?Number.parseFloat(e)*16:Number.parseFloat(e)}function Ye(e,t,n=!1){return t.reduce((r,i)=>(i in e&&(!n||e[i]!==void 0)&&(r[i]=e[i]),r),{})}function $e(e,t,n=!1){return Object.fromEntries(Object.entries(e).filter(([r,i])=>(!n||i!==void 0)&&!t.includes(r)))}function He(e){return Object.entries(e)}function P(e){return e||u.getCurrentInstance()}function W(...e){if(e.length!==1)return u.toRef(...e);const t=e[0];return typeof t=="function"?u.readonly(u.customRef(()=>({get:t,set:O}))):u.ref(t)}const Ge=W;function ze(e,...t){const n=t.flat(),r=n[0];return _(()=>Object.fromEntries(typeof r=="function"?Object.entries(u.toRefs(e)).filter(([i,c])=>r(s(c),i)):n.map(i=>[i,W(e,i)])))}function te(e,t=1e4){return u.customRef((n,r)=>{let i=s(e),c;const a=()=>setTimeout(()=>{i=s(e),r()},s(t));return A(()=>{clearTimeout(c)}),{get(){return n(),i},set(l){i=l,r(),clearTimeout(c),c=a()}}})}function ne(e,t=200,n={}){return M(N(t,n),e)}function U(e,t=200,n={}){const r=u.ref(e.value),i=ne(()=>{r.value=e.value},t,n);return u.watch(e,()=>i()),r}function qe(e,t){return u.computed({get(){var n;return(n=e.value)!=null?n:t},set(n){e.value=n}})}function re(e,t=200,n=!1,r=!0,i=!1){return M(j(t,n,r,i),e)}function B(e,t=200,n=!0,r=!0){if(t<=0)return e;const i=u.ref(e.value),c=re(()=>{i.value=e.value},t,n,r);return u.watch(e,()=>c()),i}function ie(e,t={}){let n=e,r,i;const c=u.customRef((d,g)=>(r=d,i=g,{get(){return a()},set(w){l(w)}}));function a(d=!0){return d&&r(),n}function l(d,g=!0){var w,p;if(d===n)return;const b=n;((w=t.onBeforeChange)==null?void 0:w.call(t,d,b))!==!1&&(n=d,(p=t.onChanged)==null||p.call(t,d,b),g&&i())}return Z(c,{get:a,set:l,untrackedGet:()=>a(!1),silentSet:d=>l(d,!1),peek:()=>a(!1),lay:d=>l(d,!1)},{enumerable:!0})}const Ze=ie;function Je(...e){if(e.length===2){const[t,n]=e;t.value=n}if(e.length===3){const[t,n,r]=e;t[n]=r}}function I(e,t,n={}){const{eventFilter:r=R,...i}=n;return u.watch(e,M(r,t),i)}function C(e,t,n={}){const{eventFilter:r,...i}=n,{eventFilter:c,pause:a,resume:l,isActive:f}=Q(r);return{stop:I(e,t,{...i,eventFilter:c}),pause:a,resume:l,isActive:f}}function Xe(e,t,...[n]){const{flush:r="sync",deep:i=!1,immediate:c=!0,direction:a="both",transform:l={}}=n||{},f=[],y="ltr"in l&&l.ltr||(d=>d),h="rtl"in l&&l.rtl||(d=>d);return(a==="both"||a==="ltr")&&f.push(C(e,d=>{f.forEach(g=>g.pause()),t.value=y(d),f.forEach(g=>g.resume())},{flush:r,deep:i,immediate:c})),(a==="both"||a==="rtl")&&f.push(C(t,d=>{f.forEach(g=>g.pause()),e.value=h(d),f.forEach(g=>g.resume())},{flush:r,deep:i,immediate:c})),()=>{f.forEach(d=>d.stop())}}function Ke(e,t,n={}){const{flush:r="sync",deep:i=!1,immediate:c=!0}=n;return Array.isArray(t)||(t=[t]),u.watch(e,a=>t.forEach(l=>l.value=a),{flush:r,deep:i,immediate:c})}function Qe(e,t={}){if(!u.isRef(e))return u.toRefs(e);const n=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const r in e.value)n[r]=u.customRef(()=>({get(){return e.value[r]},set(i){var c;if((c=s(t.replaceRef))!=null?c:!0)if(Array.isArray(e.value)){const l=[...e.value];l[r]=i,e.value=l}else{const l={...e.value,[r]:i};Object.setPrototypeOf(l,Object.getPrototypeOf(e.value)),e.value=l}else e.value[r]=i}}));return n}function xe(e,t=!0,n){P(n)?u.onBeforeMount(e,n):t?e():u.nextTick(e)}function et(e,t){P(t)&&u.onBeforeUnmount(e,t)}function tt(e,t=!0,n){P()?u.onMounted(e,n):t?e():u.nextTick(e)}function nt(e,t){P(t)&&u.onUnmounted(e,t)}function V(e,t=!1){function n(m,{flush:d="sync",deep:g=!1,timeout:w,throwOnTimeout:p}={}){let b=null;const $=[new Promise(k=>{b=u.watch(e,D=>{m(D)!==t&&(b?b():u.nextTick(()=>b?.()),k(D))},{flush:d,deep:g,immediate:!0})})];return w!=null&&$.push(L(w,p).then(()=>s(e)).finally(()=>b?.())),Promise.race($)}function r(m,d){if(!u.isRef(m))return n(D=>D===m,d);const{flush:g="sync",deep:w=!1,timeout:p,throwOnTimeout:b}=d??{};let v=null;const k=[new Promise(D=>{v=u.watch([e,m],([fe,Vt])=>{t!==(fe===Vt)&&(v?v():u.nextTick(()=>v?.()),D(fe))},{flush:g,deep:w,immediate:!0})})];return p!=null&&k.push(L(p,b).then(()=>s(e)).finally(()=>(v?.(),s(e)))),Promise.race(k)}function i(m){return n(d=>!!d,m)}function c(m){return r(null,m)}function a(m){return r(void 0,m)}function l(m){return n(Number.isNaN,m)}function f(m,d){return n(g=>{const w=Array.from(g);return w.includes(m)||w.includes(s(m))},d)}function y(m){return h(1,m)}function h(m=1,d){let g=-1;return n(()=>(g+=1,g>=m),d)}return Array.isArray(s(e))?{toMatch:n,toContains:f,changed:y,changedTimes:h,get not(){return V(e,!t)}}:{toMatch:n,toBe:r,toBeTruthy:i,toBeNull:c,toBeNaN:l,toBeUndefined:a,changed:y,changedTimes:h,get not(){return V(e,!t)}}}function rt(e){return V(e)}function it(e,t){return e===t}function ct(...e){var t,n;const r=e[0],i=e[1];let c=(t=e[2])!=null?t:it;const{symmetric:a=!1}=(n=e[3])!=null?n:{};if(typeof c=="string"){const f=c;c=(y,h)=>y[f]===h[f]}const l=u.computed(()=>s(r).filter(f=>s(i).findIndex(y=>c(f,y))===-1));if(a){const f=u.computed(()=>s(i).filter(y=>s(r).findIndex(h=>c(y,h))===-1));return u.computed(()=>a?[...s(l),...s(f)]:s(l))}else return l}function ot(e,t){return u.computed(()=>s(e).every((n,r,i)=>t(s(n),r,i)))}function ut(e,t){return u.computed(()=>s(e).map(n=>s(n)).filter(t))}function at(e,t){return u.computed(()=>s(s(e).find((n,r,i)=>t(s(n),r,i))))}function lt(e,t){return u.computed(()=>s(e).findIndex((n,r,i)=>t(s(n),r,i)))}function st(e,t){let n=e.length;for(;n-- >0;)if(t(e[n],n,e))return e[n]}function ft(e,t){return u.computed(()=>s(Array.prototype.findLast?s(e).findLast((n,r,i)=>t(s(n),r,i)):st(s(e),(n,r,i)=>t(s(n),r,i))))}function dt(e){return X(e)&&ee(e,"formIndex","comparator")}function mt(...e){var t;const n=e[0],r=e[1];let i=e[2],c=0;if(dt(i)&&(c=(t=i.fromIndex)!=null?t:0,i=i.comparator),typeof i=="string"){const a=i;i=(l,f)=>l[a]===s(f)}return i=i??((a,l)=>a===s(l)),u.computed(()=>s(n).slice(c).some((a,l,f)=>i(s(a),s(r),l,s(f))))}function ht(e,t){return u.computed(()=>s(e).map(n=>s(n)).join(s(t)))}function yt(e,t){return u.computed(()=>s(e).map(n=>s(n)).map(t))}function gt(e,t,...n){const r=(i,c,a)=>t(s(i),s(c),a);return u.computed(()=>{const i=s(e);return n.length?i.reduce(r,typeof n[0]=="function"?s(n[0]()):s(n[0])):i.reduce(r)})}function wt(e,t){return u.computed(()=>s(e).some((n,r,i)=>t(s(n),r,i)))}function bt(e){return Array.from(new Set(e))}function pt(e,t){return e.reduce((n,r)=>(n.some(i=>t(r,i,e))||n.push(r),n),[])}function vt(e,t){return u.computed(()=>{const n=s(e).map(r=>s(r));return t?pt(n,t):bt(n)})}function At(e=0,t={}){let n=u.unref(e);const r=u.ref(e),{max:i=Number.POSITIVE_INFINITY,min:c=Number.NEGATIVE_INFINITY}=t,a=(m=1)=>r.value=Math.max(Math.min(i,r.value+m),c),l=(m=1)=>r.value=Math.min(Math.max(c,r.value-m),i),f=()=>r.value,y=m=>r.value=Math.max(c,Math.min(i,m));return{count:r,inc:a,dec:l,get:f,set:y,reset:(m=n)=>(n=m,y(m))}}const Ot=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[T\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/i,St=/[YMDHhms]o|\[([^\]]+)\]|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;function Tt(e,t,n,r){let i=e<12?"AM":"PM";return r&&(i=i.split("").reduce((c,a)=>c+=`${a}.`,"")),n?i.toLowerCase():i}function S(e){const t=["th","st","nd","rd"],n=e%100;return e+(t[(n-20)%10]||t[n]||t[0])}function ce(e,t,n={}){var r;const i=e.getFullYear(),c=e.getMonth(),a=e.getDate(),l=e.getHours(),f=e.getMinutes(),y=e.getSeconds(),h=e.getMilliseconds(),m=e.getDay(),d=(r=n.customMeridiem)!=null?r:Tt,g={Yo:()=>S(i),YY:()=>String(i).slice(-2),YYYY:()=>i,M:()=>c+1,Mo:()=>S(c+1),MM:()=>`${c+1}`.padStart(2,"0"),MMM:()=>e.toLocaleDateString(s(n.locales),{month:"short"}),MMMM:()=>e.toLocaleDateString(s(n.locales),{month:"long"}),D:()=>String(a),Do:()=>S(a),DD:()=>`${a}`.padStart(2,"0"),H:()=>String(l),Ho:()=>S(l),HH:()=>`${l}`.padStart(2,"0"),h:()=>`${l%12||12}`.padStart(1,"0"),ho:()=>S(l%12||12),hh:()=>`${l%12||12}`.padStart(2,"0"),m:()=>String(f),mo:()=>S(f),mm:()=>`${f}`.padStart(2,"0"),s:()=>String(y),so:()=>S(y),ss:()=>`${y}`.padStart(2,"0"),SSS:()=>`${h}`.padStart(3,"0"),d:()=>m,dd:()=>e.toLocaleDateString(s(n.locales),{weekday:"narrow"}),ddd:()=>e.toLocaleDateString(s(n.locales),{weekday:"short"}),dddd:()=>e.toLocaleDateString(s(n.locales),{weekday:"long"}),A:()=>d(l,f),AA:()=>d(l,f,!1,!0),a:()=>d(l,f,!0),aa:()=>d(l,f,!0,!0)};return t.replace(St,(w,p)=>{var b,v;return(v=p??((b=g[w])==null?void 0:b.call(g)))!=null?v:w})}function oe(e){if(e===null)return new Date(Number.NaN);if(e===void 0)return new Date;if(e instanceof Date)return new Date(e);if(typeof e=="string"&&!/Z$/i.test(e)){const t=e.match(Ot);if(t){const n=t[2]-1||0,r=(t[7]||"0").substring(0,3);return new Date(t[1],n,t[3]||1,t[4]||0,t[5]||0,t[6]||0,r)}}return new Date(e)}function Dt(e,t="HH:mm:ss",n={}){return u.computed(()=>ce(oe(s(e)),s(t),n))}function ue(e,t=1e3,n={}){const{immediate:r=!0,immediateCallback:i=!1}=n;let c=null;const a=u.ref(!1);function l(){c&&(clearInterval(c),c=null)}function f(){a.value=!1,l()}function y(){const h=s(t);h<=0||(a.value=!0,i&&e(),l(),a.value&&(c=setInterval(e,h)))}if(r&&F&&y(),u.isRef(t)||typeof t=="function"){const h=u.watch(t,()=>{a.value&&F&&y()});A(h)}return A(f),{isActive:a,pause:f,resume:y}}function Ft(e=1e3,t={}){const{controls:n=!1,immediate:r=!0,callback:i}=t,c=u.ref(0),a=()=>c.value+=1,l=()=>{c.value=0},f=ue(i?()=>{a(),i(c.value)}:a,e,{immediate:r});return n?{counter:c,reset:l,...f}:c}function Mt(e,t={}){var n;const r=u.ref((n=t.initialValue)!=null?n:null);return u.watch(e,()=>r.value=K(),t),r}function ae(e,t,n={}){const{immediate:r=!0}=n,i=u.ref(!1);let c=null;function a(){c&&(clearTimeout(c),c=null)}function l(){i.value=!1,a()}function f(...y){a(),i.value=!0,c=setTimeout(()=>{i.value=!1,c=null,e(...y)},s(t))}return r&&(i.value=!0,F&&f()),A(l),{isPending:u.readonly(i),start:f,stop:l}}function Pt(e=1e3,t={}){const{controls:n=!1,callback:r}=t,i=ae(r??O,e,t),c=u.computed(()=>!i.isPending.value);return n?{ready:c,...i}:c}function It(e,t={}){const{method:n="parseFloat",radix:r,nanToZero:i}=t;return u.computed(()=>{let c=s(e);return typeof c=="string"&&(c=Number[n](c,r)),i&&Number.isNaN(c)&&(c=0),c})}function Rt(e){return u.computed(()=>`${s(e)}`)}function Ct(e=!1,t={}){const{truthyValue:n=!0,falsyValue:r=!1}=t,i=u.isRef(e),c=u.ref(e);function a(l){if(arguments.length)return c.value=l,c.value;{const f=s(n);return c.value=c.value===f?s(r):f,c.value}}return i?a:[c,a]}function kt(e,t,n){let r=n?.immediate?[]:[...e instanceof Function?e():Array.isArray(e)?e:s(e)];return u.watch(e,(i,c,a)=>{const l=Array.from({length:r.length}),f=[];for(const h of i){let m=!1;for(let d=0;d<r.length;d++)if(!l[d]&&h===r[d]){l[d]=!0,m=!0;break}m||f.push(h)}const y=r.filter((h,m)=>!l[m]);t(i,r,f,y,a),r=[...i]},n)}function Et(e,t,n){const{count:r,...i}=n,c=u.ref(0),a=I(e,(...l)=>{c.value+=1,c.value>=s(r)&&u.nextTick(()=>a()),t(...l)},i);return{count:c,stop:a}}function le(e,t,n={}){const{debounce:r=0,maxWait:i=void 0,...c}=n;return I(e,t,{...c,eventFilter:N(r,{maxWait:i})})}function _t(e,t,n){return u.watch(e,t,{...n,deep:!0})}function Y(e,t,n={}){const{eventFilter:r=R,...i}=n,c=M(r,t);let a,l,f;if(i.flush==="sync"){const y=u.ref(!1);l=()=>{},a=h=>{y.value=!0,h(),y.value=!1},f=u.watch(e,(...h)=>{y.value||c(...h)},i)}else{const y=[],h=u.ref(0),m=u.ref(0);l=()=>{h.value=m.value},y.push(u.watch(e,()=>{m.value++},{...i,flush:"sync"})),a=d=>{const g=m.value;d(),h.value+=m.value-g},y.push(u.watch(e,(...d)=>{const g=h.value>0&&h.value===m.value;h.value=0,m.value=0,!g&&c(...d)},i)),f=()=>{y.forEach(d=>d())}}return{stop:f,ignoreUpdates:a,ignorePrevAsyncUpdates:l}}function Nt(e,t,n){return u.watch(e,t,{...n,immediate:!0})}function jt(e,t,n){const r=u.watch(e,(...i)=>(u.nextTick(()=>r()),t(...i)),n);return r}function se(e,t,n={}){const{throttle:r=0,trailing:i=!0,leading:c=!0,...a}=n;return I(e,t,{...a,eventFilter:j(r,i,c)})}function Lt(e,t,n={}){let r;function i(){if(!r)return;const h=r;r=void 0,h()}function c(h){r=h}const a=(h,m)=>(i(),t(h,m,c)),l=Y(e,a,n),{ignoreUpdates:f}=l;return{...l,trigger:()=>{let h;return f(()=>{h=a(Wt(e),Ut(e))}),h}}}function Wt(e){return u.isReactive(e)?e:Array.isArray(e)?e.map(t=>s(t)):s(e)}function Ut(e){return Array.isArray(e)?e.map(()=>{}):void 0}function Bt(e,t,n){const r=u.watch(e,(i,c,a)=>{i&&(n?.once&&u.nextTick(()=>r()),t(i,c,a))},{...n,once:!1});return r}o.assert=De,o.autoResetRef=te,o.bypassFilter=R,o.camelize=je,o.clamp=Pe,o.computedEager=H,o.computedWithControl=G,o.containsProp=ee,o.controlledComputed=G,o.controlledRef=Ze,o.createEventHook=de,o.createFilterWrapper=M,o.createGlobalState=me,o.createInjectionState=he,o.createReactiveFn=E,o.createSharedComposable=ye,o.createSingletonPromise=We,o.debounceFilter=N,o.debouncedRef=U,o.debouncedWatch=le,o.eagerComputed=H,o.extendRef=Z,o.formatDate=ce,o.get=ge,o.getLifeCycleTarget=P,o.hasOwn=Re,o.hyphenate=_e,o.identity=Le,o.ignorableWatch=Y,o.increaseWithUnit=Be,o.injectLocal=z,o.invoke=Ue,o.isClient=F,o.isDef=Se,o.isDefined=we,o.isIOS=Ce,o.isObject=X,o.isWorker=Oe,o.makeDestructurable=be,o.noop=O,o.normalizeDate=oe,o.notNullish=Te,o.now=Me,o.objectEntries=He,o.objectOmit=$e,o.objectPick=Ye,o.pausableFilter=Q,o.pausableWatch=C,o.promiseTimeout=L,o.provideLocal=q,o.pxValue=Ve,o.rand=Ie,o.reactify=E,o.reactifyObject=ve,o.reactiveComputed=_,o.reactiveOmit=Ae,o.reactivePick=ze,o.refAutoReset=te,o.refDebounced=U,o.refDefault=qe,o.refThrottled=B,o.refWithControl=ie,o.resolveRef=Ge,o.resolveUnref=pe,o.set=Je,o.syncRef=Xe,o.syncRefs=Ke,o.throttleFilter=j,o.throttledRef=B,o.throttledWatch=se,o.timestamp=K,o.toReactive=J,o.toRef=W,o.toRefs=Qe,o.toValue=s,o.tryOnBeforeMount=xe,o.tryOnBeforeUnmount=et,o.tryOnMounted=tt,o.tryOnScopeDispose=A,o.tryOnUnmounted=nt,o.until=rt,o.useArrayDifference=ct,o.useArrayEvery=ot,o.useArrayFilter=ut,o.useArrayFind=at,o.useArrayFindIndex=lt,o.useArrayFindLast=ft,o.useArrayIncludes=mt,o.useArrayJoin=ht,o.useArrayMap=yt,o.useArrayReduce=gt,o.useArraySome=wt,o.useArrayUnique=vt,o.useCounter=At,o.useDateFormat=Dt,o.useDebounce=U,o.useDebounceFn=ne,o.useInterval=Ft,o.useIntervalFn=ue,o.useLastChanged=Mt,o.useThrottle=B,o.useThrottleFn=re,o.useTimeout=Pt,o.useTimeoutFn=ae,o.useToNumber=It,o.useToString=Rt,o.useToggle=Ct,o.watchArray=kt,o.watchAtMost=Et,o.watchDebounced=le,o.watchDeep=_t,o.watchIgnorable=Y,o.watchImmediate=Nt,o.watchOnce=jt,o.watchPausable=C,o.watchThrottled=se,o.watchTriggerable=Lt,o.watchWithFilter=I,o.whenever=Bt})(this.VueUse=this.VueUse||{},Vue);
|
|
1
|
+
(function(c,o){"use strict";function H(t,e){var n;const r=o.shallowRef();return o.watchEffect(()=>{r.value=t()},{...e,flush:(n=e?.flush)!=null?n:"sync"}),o.readonly(r)}function G(t,e){let n,r,a;const i=o.ref(!0),l=()=>{i.value=!0,a()};o.watch(t,l,{flush:"sync"});const u=typeof e=="function"?e:e.get,s=typeof e=="function"?void 0:e.set,h=o.customRef((m,d)=>(r=m,a=d,{get(){return i.value&&(n=u(n),i.value=!1),r(),n},set(f){s?.(f)}}));return Object.isExtensible(h)&&(h.trigger=l),h}function p(t){return o.getCurrentScope()?(o.onScopeDispose(t),!0):!1}function dt(){const t=new Set,e=i=>{t.delete(i)};return{on:i=>{t.add(i);const l=()=>e(i);return p(l),{off:l}},off:e,trigger:(...i)=>Promise.all(Array.from(t).map(l=>l(...i))),clear:()=>{t.clear()}}}function mt(t){let e=!1,n;const r=o.effectScope(!0);return(...a)=>(e||(n=r.run(()=>t(...a)),e=!0),n)}const S=new WeakMap,z=(...t)=>{var e;const n=t[0],r=(e=o.getCurrentInstance())==null?void 0:e.proxy;if(r==null&&!o.hasInjectionContext())throw new Error("injectLocal must be called in setup");return r&&S.has(r)&&n in S.get(r)?S.get(r)[n]:o.inject(...t)},q=(t,e)=>{var n;const r=(n=o.getCurrentInstance())==null?void 0:n.proxy;if(r==null)throw new Error("provideLocal must be called in setup");S.has(r)||S.set(r,Object.create(null));const a=S.get(r);a[t]=e,o.provide(t,e)};function ht(t,e){const n=e?.injectionKey||Symbol(t.name||"InjectionState"),r=e?.defaultValue;return[(...l)=>{const u=t(...l);return q(n,u),u},()=>z(n,r)]}function yt(t){let e=0,n,r;const a=()=>{e-=1,r&&e<=0&&(r.stop(),n=void 0,r=void 0)};return(...i)=>(e+=1,r||(r=o.effectScope(!0),n=r.run(()=>t(...i))),p(a),n)}function Z(t,e,{enumerable:n=!1,unwrap:r=!0}={}){for(const[a,i]of Object.entries(e))a!=="value"&&(o.isRef(i)&&r?Object.defineProperty(t,a,{get(){return i.value},set(l){i.value=l},enumerable:n}):Object.defineProperty(t,a,{value:i,enumerable:n}));return t}function gt(t,e){return e==null?o.unref(t):o.unref(t)[e]}function wt(t){return o.unref(t)!=null}function Vt(t,e){if(typeof Symbol<"u"){const n={...t};return Object.defineProperty(n,Symbol.iterator,{enumerable:!1,value(){let r=0;return{next:()=>({value:e[r++],done:r>e.length})}}}),n}else return Object.assign([...e],t)}function k(t,e){const n=e?.computedGetter===!1?o.unref:o.toValue;return function(...r){return o.computed(()=>t.apply(this,r.map(a=>n(a))))}}function bt(t,e={}){let n=[],r;if(Array.isArray(e))n=e;else{r=e;const{includeOwnProperties:a=!0}=e;n.push(...Object.keys(t)),a&&n.push(...Object.getOwnPropertyNames(t))}return Object.fromEntries(n.map(a=>{const i=t[a];return[a,typeof i=="function"?k(i.bind(t),r):i]}))}function J(t){if(!o.isRef(t))return o.reactive(t);const e=new Proxy({},{get(n,r,a){return o.unref(Reflect.get(t.value,r,a))},set(n,r,a){return o.isRef(t.value[r])&&!o.isRef(a)?t.value[r].value=a:t.value[r]=a,!0},deleteProperty(n,r){return Reflect.deleteProperty(t.value,r)},has(n,r){return Reflect.has(t.value,r)},ownKeys(){return Object.keys(t.value)},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}});return o.reactive(e)}function E(t){return J(o.computed(t))}function pt(t,...e){const n=e.flat(),r=n[0];return E(()=>Object.fromEntries(typeof r=="function"?Object.entries(o.toRefs(t)).filter(([a,i])=>!r(o.toValue(i),a)):Object.entries(o.toRefs(t)).filter(a=>!n.includes(a[0]))))}const D=typeof window<"u"&&typeof document<"u",At=typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope,Ot=t=>typeof t<"u",St=t=>t!=null,Tt=(t,...e)=>{t||console.warn(...e)},Dt=Object.prototype.toString,X=t=>Dt.call(t)==="[object Object]",Ft=()=>Date.now(),K=()=>+Date.now(),Mt=(t,e,n)=>Math.min(n,Math.max(e,t)),A=()=>{},Pt=(t,e)=>(t=Math.ceil(t),e=Math.floor(e),Math.floor(Math.random()*(e-t+1))+t),It=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Rt=Ct();function Ct(){var t,e;return D&&((t=window?.navigator)==null?void 0:t.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((e=window?.navigator)==null?void 0:e.maxTouchPoints)>2&&/iPad|Macintosh/.test(window?.navigator.userAgent))}function F(t,e){function n(...r){return new Promise((a,i)=>{Promise.resolve(t(()=>e.apply(this,r),{fn:e,thisArg:this,args:r})).then(a).catch(i)})}return n}const I=t=>t();function _(t,e={}){let n,r,a=A;const i=u=>{clearTimeout(u),a(),a=A};return u=>{const s=o.toValue(t),h=o.toValue(e.maxWait);return n&&i(n),s<=0||h!==void 0&&h<=0?(r&&(i(r),r=null),Promise.resolve(u())):new Promise((m,d)=>{a=e.rejectOnCancel?d:m,h&&!r&&(r=setTimeout(()=>{n&&i(n),r=null,m(u())},h)),n=setTimeout(()=>{r&&i(r),r=null,m(u())},s)})}}function N(...t){let e=0,n,r=!0,a=A,i,l,u,s,h;!o.isRef(t[0])&&typeof t[0]=="object"?{delay:l,trailing:u=!0,leading:s=!0,rejectOnCancel:h=!1}=t[0]:[l,u=!0,s=!0,h=!1]=t;const m=()=>{n&&(clearTimeout(n),n=void 0,a(),a=A)};return f=>{const y=o.toValue(l),g=Date.now()-e,V=()=>i=f();return m(),y<=0?(e=Date.now(),V()):(g>y&&(s||!r)?(e=Date.now(),V()):u&&(i=new Promise((w,b)=>{a=h?b:w,n=setTimeout(()=>{e=Date.now(),r=!0,w(V()),m()},Math.max(0,y-g))})),!s&&!n&&(n=setTimeout(()=>r=!0,y)),r=!1,i)}}function Q(t=I){const e=o.ref(!0);function n(){e.value=!1}function r(){e.value=!0}const a=(...i)=>{e.value&&t(...i)};return{isActive:o.readonly(e),pause:n,resume:r,eventFilter:a}}function v(t){const e=Object.create(null);return n=>e[n]||(e[n]=t(n))}const kt=/\B([A-Z])/g,Et=v(t=>t.replace(kt,"-$1").toLowerCase()),_t=/-(\w)/g,Nt=v(t=>t.replace(_t,(e,n)=>n?n.toUpperCase():""));function j(t,e=!1,n="Timeout"){return new Promise((r,a)=>{setTimeout(e?()=>a(n):r,t)})}function jt(t){return t}function Lt(t){let e;function n(){return e||(e=t()),e}return n.reset=async()=>{const r=e;e=void 0,r&&await r},n}function Wt(t){return t()}function x(t,...e){return e.some(n=>n in t)}function Ut(t,e){var n;if(typeof t=="number")return t+e;const r=((n=t.match(/^-?\d+\.?\d*/))==null?void 0:n[0])||"",a=t.slice(r.length),i=Number.parseFloat(r)+e;return Number.isNaN(i)?t:i+a}function Bt(t){return t.endsWith("rem")?Number.parseFloat(t)*16:Number.parseFloat(t)}function Yt(t,e,n=!1){return e.reduce((r,a)=>(a in t&&(!n||t[a]!==void 0)&&(r[a]=t[a]),r),{})}function $t(t,e,n=!1){return Object.fromEntries(Object.entries(t).filter(([r,a])=>(!n||a!==void 0)&&!e.includes(r)))}function Ht(t){return Object.entries(t)}function M(t){return t||o.getCurrentInstance()}function tt(t){return Array.isArray(t)?t:[t]}function L(...t){if(t.length!==1)return o.toRef(...t);const e=t[0];return typeof e=="function"?o.readonly(o.customRef(()=>({get:e,set:A}))):o.ref(e)}const Gt=L;function zt(t,...e){const n=e.flat(),r=n[0];return E(()=>Object.fromEntries(typeof r=="function"?Object.entries(o.toRefs(t)).filter(([a,i])=>r(o.toValue(i),a)):n.map(a=>[a,L(t,a)])))}function et(t,e=1e4){return o.customRef((n,r)=>{let a=o.toValue(t),i;const l=()=>setTimeout(()=>{a=o.toValue(t),r()},o.toValue(e));return p(()=>{clearTimeout(i)}),{get(){return n(),a},set(u){a=u,r(),clearTimeout(i),i=l()}}})}function nt(t,e=200,n={}){return F(_(e,n),t)}function W(t,e=200,n={}){const r=o.ref(t.value),a=nt(()=>{r.value=t.value},e,n);return o.watch(t,()=>a()),r}function qt(t,e){return o.computed({get(){var n;return(n=t.value)!=null?n:e},set(n){t.value=n}})}function rt(t,e=200,n=!1,r=!0,a=!1){return F(N(e,n,r,a),t)}function U(t,e=200,n=!0,r=!0){if(e<=0)return t;const a=o.ref(t.value),i=rt(()=>{a.value=t.value},e,n,r);return o.watch(t,()=>i()),a}function ot(t,e={}){let n=t,r,a;const i=o.customRef((f,y)=>(r=f,a=y,{get(){return l()},set(g){u(g)}}));function l(f=!0){return f&&r(),n}function u(f,y=!0){var g,V;if(f===n)return;const w=n;((g=e.onBeforeChange)==null?void 0:g.call(e,f,w))!==!1&&(n=f,(V=e.onChanged)==null||V.call(e,f,w),y&&a())}return Z(i,{get:l,set:u,untrackedGet:()=>l(!1),silentSet:f=>u(f,!1),peek:()=>l(!1),lay:f=>u(f,!1)},{enumerable:!0})}const Zt=ot;function Jt(...t){if(t.length===2){const[e,n]=t;e.value=n}if(t.length===3){const[e,n,r]=t;e[n]=r}}function P(t,e,n={}){const{eventFilter:r=I,...a}=n;return o.watch(t,F(r,e),a)}function R(t,e,n={}){const{eventFilter:r,...a}=n,{eventFilter:i,pause:l,resume:u,isActive:s}=Q(r);return{stop:P(t,e,{...a,eventFilter:i}),pause:l,resume:u,isActive:s}}function Xt(t,e,...[n]){const{flush:r="sync",deep:a=!1,immediate:i=!0,direction:l="both",transform:u={}}=n||{},s=[],h="ltr"in u&&u.ltr||(f=>f),m="rtl"in u&&u.rtl||(f=>f);return(l==="both"||l==="ltr")&&s.push(R(t,f=>{s.forEach(y=>y.pause()),e.value=h(f),s.forEach(y=>y.resume())},{flush:r,deep:a,immediate:i})),(l==="both"||l==="rtl")&&s.push(R(e,f=>{s.forEach(y=>y.pause()),t.value=m(f),s.forEach(y=>y.resume())},{flush:r,deep:a,immediate:i})),()=>{s.forEach(f=>f.stop())}}function Kt(t,e,n={}){const{flush:r="sync",deep:a=!1,immediate:i=!0}=n;return e=tt(e),o.watch(t,l=>e.forEach(u=>u.value=l),{flush:r,deep:a,immediate:i})}function Qt(t,e={}){if(!o.isRef(t))return o.toRefs(t);const n=Array.isArray(t.value)?Array.from({length:t.value.length}):{};for(const r in t.value)n[r]=o.customRef(()=>({get(){return t.value[r]},set(a){var i;if((i=o.toValue(e.replaceRef))!=null?i:!0)if(Array.isArray(t.value)){const u=[...t.value];u[r]=a,t.value=u}else{const u={...t.value,[r]:a};Object.setPrototypeOf(u,Object.getPrototypeOf(t.value)),t.value=u}else t.value[r]=a}}));return n}const vt=o.toValue,xt=o.toValue;function te(t,e=!0,n){M(n)?o.onBeforeMount(t,n):e?t():o.nextTick(t)}function ee(t,e){M(e)&&o.onBeforeUnmount(t,e)}function ne(t,e=!0,n){M()?o.onMounted(t,n):e?t():o.nextTick(t)}function re(t,e){M(e)&&o.onUnmounted(t,e)}function B(t,e=!1){function n(d,{flush:f="sync",deep:y=!1,timeout:g,throwOnTimeout:V}={}){let w=null;const $=[new Promise(C=>{w=o.watch(t,T=>{d(T)!==e&&(w?w():o.nextTick(()=>w?.()),C(T))},{flush:f,deep:y,immediate:!0})})];return g!=null&&$.push(j(g,V).then(()=>o.toValue(t)).finally(()=>w?.())),Promise.race($)}function r(d,f){if(!o.isRef(d))return n(T=>T===d,f);const{flush:y="sync",deep:g=!1,timeout:V,throwOnTimeout:w}=f??{};let b=null;const C=[new Promise(T=>{b=o.watch([t,d],([ft,$e])=>{e!==(ft===$e)&&(b?b():o.nextTick(()=>b?.()),T(ft))},{flush:y,deep:g,immediate:!0})})];return V!=null&&C.push(j(V,w).then(()=>o.toValue(t)).finally(()=>(b?.(),o.toValue(t)))),Promise.race(C)}function a(d){return n(f=>!!f,d)}function i(d){return r(null,d)}function l(d){return r(void 0,d)}function u(d){return n(Number.isNaN,d)}function s(d,f){return n(y=>{const g=Array.from(y);return g.includes(d)||g.includes(o.toValue(d))},f)}function h(d){return m(1,d)}function m(d=1,f){let y=-1;return n(()=>(y+=1,y>=d),f)}return Array.isArray(o.toValue(t))?{toMatch:n,toContains:s,changed:h,changedTimes:m,get not(){return B(t,!e)}}:{toMatch:n,toBe:r,toBeTruthy:a,toBeNull:i,toBeNaN:u,toBeUndefined:l,changed:h,changedTimes:m,get not(){return B(t,!e)}}}function oe(t){return B(t)}function ae(t,e){return t===e}function ie(...t){var e,n;const r=t[0],a=t[1];let i=(e=t[2])!=null?e:ae;const{symmetric:l=!1}=(n=t[3])!=null?n:{};if(typeof i=="string"){const s=i;i=(h,m)=>h[s]===m[s]}const u=o.computed(()=>o.toValue(r).filter(s=>o.toValue(a).findIndex(h=>i(s,h))===-1));if(l){const s=o.computed(()=>o.toValue(a).filter(h=>o.toValue(r).findIndex(m=>i(h,m))===-1));return o.computed(()=>l?[...o.toValue(u),...o.toValue(s)]:o.toValue(u))}else return u}function ce(t,e){return o.computed(()=>o.toValue(t).every((n,r,a)=>e(o.toValue(n),r,a)))}function le(t,e){return o.computed(()=>o.toValue(t).map(n=>o.toValue(n)).filter(e))}function ue(t,e){return o.computed(()=>o.toValue(o.toValue(t).find((n,r,a)=>e(o.toValue(n),r,a))))}function se(t,e){return o.computed(()=>o.toValue(t).findIndex((n,r,a)=>e(o.toValue(n),r,a)))}function fe(t,e){let n=t.length;for(;n-- >0;)if(e(t[n],n,t))return t[n]}function de(t,e){return o.computed(()=>o.toValue(Array.prototype.findLast?o.toValue(t).findLast((n,r,a)=>e(o.toValue(n),r,a)):fe(o.toValue(t),(n,r,a)=>e(o.toValue(n),r,a))))}function me(t){return X(t)&&x(t,"formIndex","comparator")}function he(...t){var e;const n=t[0],r=t[1];let a=t[2],i=0;if(me(a)&&(i=(e=a.fromIndex)!=null?e:0,a=a.comparator),typeof a=="string"){const l=a;a=(u,s)=>u[l]===o.toValue(s)}return a=a??((l,u)=>l===o.toValue(u)),o.computed(()=>o.toValue(n).slice(i).some((l,u,s)=>a(o.toValue(l),o.toValue(r),u,o.toValue(s))))}function ye(t,e){return o.computed(()=>o.toValue(t).map(n=>o.toValue(n)).join(o.toValue(e)))}function ge(t,e){return o.computed(()=>o.toValue(t).map(n=>o.toValue(n)).map(e))}function we(t,e,...n){const r=(a,i,l)=>e(o.toValue(a),o.toValue(i),l);return o.computed(()=>{const a=o.toValue(t);return n.length?a.reduce(r,typeof n[0]=="function"?o.toValue(n[0]()):o.toValue(n[0])):a.reduce(r)})}function Ve(t,e){return o.computed(()=>o.toValue(t).some((n,r,a)=>e(o.toValue(n),r,a)))}function be(t){return Array.from(new Set(t))}function pe(t,e){return t.reduce((n,r)=>(n.some(a=>e(r,a,t))||n.push(r),n),[])}function Ae(t,e){return o.computed(()=>{const n=o.toValue(t).map(r=>o.toValue(r));return e?pe(n,e):be(n)})}function Oe(t=0,e={}){let n=o.unref(t);const r=o.ref(t),{max:a=Number.POSITIVE_INFINITY,min:i=Number.NEGATIVE_INFINITY}=e,l=(d=1)=>r.value=Math.max(Math.min(a,r.value+d),i),u=(d=1)=>r.value=Math.min(Math.max(i,r.value-d),a),s=()=>r.value,h=d=>r.value=Math.max(i,Math.min(a,d));return{count:r,inc:l,dec:u,get:s,set:h,reset:(d=n)=>(n=d,h(d))}}const Se=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[T\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/i,Te=/[YMDHhms]o|\[([^\]]+)\]|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;function De(t,e,n,r){let a=t<12?"AM":"PM";return r&&(a=a.split("").reduce((i,l)=>i+=`${l}.`,"")),n?a.toLowerCase():a}function O(t){const e=["th","st","nd","rd"],n=t%100;return t+(e[(n-20)%10]||e[n]||e[0])}function at(t,e,n={}){var r;const a=t.getFullYear(),i=t.getMonth(),l=t.getDate(),u=t.getHours(),s=t.getMinutes(),h=t.getSeconds(),m=t.getMilliseconds(),d=t.getDay(),f=(r=n.customMeridiem)!=null?r:De,y={Yo:()=>O(a),YY:()=>String(a).slice(-2),YYYY:()=>a,M:()=>i+1,Mo:()=>O(i+1),MM:()=>`${i+1}`.padStart(2,"0"),MMM:()=>t.toLocaleDateString(o.toValue(n.locales),{month:"short"}),MMMM:()=>t.toLocaleDateString(o.toValue(n.locales),{month:"long"}),D:()=>String(l),Do:()=>O(l),DD:()=>`${l}`.padStart(2,"0"),H:()=>String(u),Ho:()=>O(u),HH:()=>`${u}`.padStart(2,"0"),h:()=>`${u%12||12}`.padStart(1,"0"),ho:()=>O(u%12||12),hh:()=>`${u%12||12}`.padStart(2,"0"),m:()=>String(s),mo:()=>O(s),mm:()=>`${s}`.padStart(2,"0"),s:()=>String(h),so:()=>O(h),ss:()=>`${h}`.padStart(2,"0"),SSS:()=>`${m}`.padStart(3,"0"),d:()=>d,dd:()=>t.toLocaleDateString(o.toValue(n.locales),{weekday:"narrow"}),ddd:()=>t.toLocaleDateString(o.toValue(n.locales),{weekday:"short"}),dddd:()=>t.toLocaleDateString(o.toValue(n.locales),{weekday:"long"}),A:()=>f(u,s),AA:()=>f(u,s,!1,!0),a:()=>f(u,s,!0),aa:()=>f(u,s,!0,!0)};return e.replace(Te,(g,V)=>{var w,b;return(b=V??((w=y[g])==null?void 0:w.call(y)))!=null?b:g})}function it(t){if(t===null)return new Date(Number.NaN);if(t===void 0)return new Date;if(t instanceof Date)return new Date(t);if(typeof t=="string"&&!/Z$/i.test(t)){const e=t.match(Se);if(e){const n=e[2]-1||0,r=(e[7]||"0").substring(0,3);return new Date(e[1],n,e[3]||1,e[4]||0,e[5]||0,e[6]||0,r)}}return new Date(t)}function Fe(t,e="HH:mm:ss",n={}){return o.computed(()=>at(it(o.toValue(t)),o.toValue(e),n))}function ct(t,e=1e3,n={}){const{immediate:r=!0,immediateCallback:a=!1}=n;let i=null;const l=o.ref(!1);function u(){i&&(clearInterval(i),i=null)}function s(){l.value=!1,u()}function h(){const m=o.toValue(e);m<=0||(l.value=!0,a&&t(),u(),l.value&&(i=setInterval(t,m)))}if(r&&D&&h(),o.isRef(e)||typeof e=="function"){const m=o.watch(e,()=>{l.value&&D&&h()});p(m)}return p(s),{isActive:l,pause:s,resume:h}}function Me(t=1e3,e={}){const{controls:n=!1,immediate:r=!0,callback:a}=e,i=o.ref(0),l=()=>i.value+=1,u=()=>{i.value=0},s=ct(a?()=>{l(),a(i.value)}:l,t,{immediate:r});return n?{counter:i,reset:u,...s}:i}function Pe(t,e={}){var n;const r=o.ref((n=e.initialValue)!=null?n:null);return o.watch(t,()=>r.value=K(),e),r}function lt(t,e,n={}){const{immediate:r=!0}=n,a=o.ref(!1);let i=null;function l(){i&&(clearTimeout(i),i=null)}function u(){a.value=!1,l()}function s(...h){l(),a.value=!0,i=setTimeout(()=>{a.value=!1,i=null,t(...h)},o.toValue(e))}return r&&(a.value=!0,D&&s()),p(u),{isPending:o.readonly(a),start:s,stop:u}}function Ie(t=1e3,e={}){const{controls:n=!1,callback:r}=e,a=lt(r??A,t,e),i=o.computed(()=>!a.isPending.value);return n?{ready:i,...a}:i}function Re(t,e={}){const{method:n="parseFloat",radix:r,nanToZero:a}=e;return o.computed(()=>{let i=o.toValue(t);return typeof n=="function"?i=n(i):typeof i=="string"&&(i=Number[n](i,r)),a&&Number.isNaN(i)&&(i=0),i})}function Ce(t){return o.computed(()=>`${o.toValue(t)}`)}function ke(t=!1,e={}){const{truthyValue:n=!0,falsyValue:r=!1}=e,a=o.isRef(t),i=o.ref(t);function l(u){if(arguments.length)return i.value=u,i.value;{const s=o.toValue(n);return i.value=i.value===s?o.toValue(r):s,i.value}}return a?l:[i,l]}function Ee(t,e,n){let r=n?.immediate?[]:[...t instanceof Function?t():Array.isArray(t)?t:o.toValue(t)];return o.watch(t,(a,i,l)=>{const u=Array.from({length:r.length}),s=[];for(const m of a){let d=!1;for(let f=0;f<r.length;f++)if(!u[f]&&m===r[f]){u[f]=!0,d=!0;break}d||s.push(m)}const h=r.filter((m,d)=>!u[d]);e(a,r,s,h,l),r=[...a]},n)}function _e(t,e,n){const{count:r,...a}=n,i=o.ref(0),l=P(t,(...u)=>{i.value+=1,i.value>=o.toValue(r)&&o.nextTick(()=>l()),e(...u)},a);return{count:i,stop:l}}function ut(t,e,n={}){const{debounce:r=0,maxWait:a=void 0,...i}=n;return P(t,e,{...i,eventFilter:_(r,{maxWait:a})})}function Ne(t,e,n){return o.watch(t,e,{...n,deep:!0})}function Y(t,e,n={}){const{eventFilter:r=I,...a}=n,i=F(r,e);let l,u,s;if(a.flush==="sync"){const h=o.ref(!1);u=()=>{},l=m=>{h.value=!0,m(),h.value=!1},s=o.watch(t,(...m)=>{h.value||i(...m)},a)}else{const h=[],m=o.ref(0),d=o.ref(0);u=()=>{m.value=d.value},h.push(o.watch(t,()=>{d.value++},{...a,flush:"sync"})),l=f=>{const y=d.value;f(),m.value+=d.value-y},h.push(o.watch(t,(...f)=>{const y=m.value>0&&m.value===d.value;m.value=0,d.value=0,!y&&i(...f)},a)),s=()=>{h.forEach(f=>f())}}return{stop:s,ignoreUpdates:l,ignorePrevAsyncUpdates:u}}function je(t,e,n){return o.watch(t,e,{...n,immediate:!0})}function Le(t,e,n){const r=o.watch(t,(...a)=>(o.nextTick(()=>r()),e(...a)),n);return r}function st(t,e,n={}){const{throttle:r=0,trailing:a=!0,leading:i=!0,...l}=n;return P(t,e,{...l,eventFilter:N(r,a,i)})}function We(t,e,n={}){let r;function a(){if(!r)return;const m=r;r=void 0,m()}function i(m){r=m}const l=(m,d)=>(a(),e(m,d,i)),u=Y(t,l,n),{ignoreUpdates:s}=u;return{...u,trigger:()=>{let m;return s(()=>{m=l(Ue(t),Be(t))}),m}}}function Ue(t){return o.isReactive(t)?t:Array.isArray(t)?t.map(e=>o.toValue(e)):o.toValue(t)}function Be(t){return Array.isArray(t)?t.map(()=>{}):void 0}function Ye(t,e,n){const r=o.watch(t,(a,i,l)=>{a&&(n?.once&&o.nextTick(()=>r()),e(a,i,l))},{...n,once:!1});return r}c.assert=Tt,c.autoResetRef=et,c.bypassFilter=I,c.camelize=Nt,c.clamp=Mt,c.computedEager=H,c.computedWithControl=G,c.containsProp=x,c.controlledComputed=G,c.controlledRef=Zt,c.createEventHook=dt,c.createFilterWrapper=F,c.createGlobalState=mt,c.createInjectionState=ht,c.createReactiveFn=k,c.createSharedComposable=yt,c.createSingletonPromise=Lt,c.debounceFilter=_,c.debouncedRef=W,c.debouncedWatch=ut,c.eagerComputed=H,c.extendRef=Z,c.formatDate=at,c.get=gt,c.getLifeCycleTarget=M,c.hasOwn=It,c.hyphenate=Et,c.identity=jt,c.ignorableWatch=Y,c.increaseWithUnit=Ut,c.injectLocal=z,c.invoke=Wt,c.isClient=D,c.isDef=Ot,c.isDefined=wt,c.isIOS=Rt,c.isObject=X,c.isWorker=At,c.makeDestructurable=Vt,c.noop=A,c.normalizeDate=it,c.notNullish=St,c.now=Ft,c.objectEntries=Ht,c.objectOmit=$t,c.objectPick=Yt,c.pausableFilter=Q,c.pausableWatch=R,c.promiseTimeout=j,c.provideLocal=q,c.pxValue=Bt,c.rand=Pt,c.reactify=k,c.reactifyObject=bt,c.reactiveComputed=E,c.reactiveOmit=pt,c.reactivePick=zt,c.refAutoReset=et,c.refDebounced=W,c.refDefault=qt,c.refThrottled=U,c.refWithControl=ot,c.resolveRef=Gt,c.resolveUnref=xt,c.set=Jt,c.syncRef=Xt,c.syncRefs=Kt,c.throttleFilter=N,c.throttledRef=U,c.throttledWatch=st,c.timestamp=K,c.toArray=tt,c.toReactive=J,c.toRef=L,c.toRefs=Qt,c.toValue=vt,c.tryOnBeforeMount=te,c.tryOnBeforeUnmount=ee,c.tryOnMounted=ne,c.tryOnScopeDispose=p,c.tryOnUnmounted=re,c.until=oe,c.useArrayDifference=ie,c.useArrayEvery=ce,c.useArrayFilter=le,c.useArrayFind=ue,c.useArrayFindIndex=se,c.useArrayFindLast=de,c.useArrayIncludes=he,c.useArrayJoin=ye,c.useArrayMap=ge,c.useArrayReduce=we,c.useArraySome=Ve,c.useArrayUnique=Ae,c.useCounter=Oe,c.useDateFormat=Fe,c.useDebounce=W,c.useDebounceFn=nt,c.useInterval=Me,c.useIntervalFn=ct,c.useLastChanged=Pe,c.useThrottle=U,c.useThrottleFn=rt,c.useTimeout=Ie,c.useTimeoutFn=lt,c.useToNumber=Re,c.useToString=Ce,c.useToggle=ke,c.watchArray=Ee,c.watchAtMost=_e,c.watchDebounced=ut,c.watchDeep=Ne,c.watchIgnorable=Y,c.watchImmediate=je,c.watchOnce=Le,c.watchPausable=R,c.watchThrottled=st,c.watchTriggerable=We,c.watchWithFilter=P,c.whenever=Ye})(this.VueUse=this.VueUse||{},Vue);
|