chunk-22ATY35G.js 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194
  1. import {
  2. __async,
  3. init_define_APP_INFO
  4. } from "./chunk-XY75H3MP.js";
  5. // node_modules/@vueuse/shared/index.mjs
  6. init_define_APP_INFO();
  7. 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";
  8. function and(...args) {
  9. return computed(() => args.every((i) => unref(i)));
  10. }
  11. function biSyncRef(a, b) {
  12. const flush = "sync";
  13. const stop1 = watch(a, (newValue) => {
  14. b.value = newValue;
  15. }, {
  16. flush,
  17. immediate: true
  18. });
  19. const stop2 = watch(b, (newValue) => {
  20. a.value = newValue;
  21. }, {
  22. flush,
  23. immediate: true
  24. });
  25. return () => {
  26. stop1();
  27. stop2();
  28. };
  29. }
  30. function controlledComputed(source, fn) {
  31. let v = void 0;
  32. let track;
  33. let trigger;
  34. const dirty = ref(true);
  35. watch(source, () => {
  36. dirty.value = true;
  37. trigger();
  38. }, { flush: "sync" });
  39. return customRef((_track, _trigger) => {
  40. track = _track;
  41. trigger = _trigger;
  42. return {
  43. get() {
  44. if (dirty.value) {
  45. v = fn();
  46. dirty.value = false;
  47. }
  48. track();
  49. return v;
  50. },
  51. set() {
  52. }
  53. };
  54. });
  55. }
  56. function __onlyVue3(name = "this function") {
  57. if (isVue3)
  58. return;
  59. throw new Error(`[VueUse] ${name} is only works on Vue 3.`);
  60. }
  61. function extendRef(ref2, extend, { enumerable = false, unwrap = true } = {}) {
  62. __onlyVue3();
  63. for (const [key, value] of Object.entries(extend)) {
  64. if (key === "value")
  65. continue;
  66. if (isRef(value) && unwrap) {
  67. Object.defineProperty(ref2, key, {
  68. get() {
  69. return value.value;
  70. },
  71. set(v) {
  72. value.value = v;
  73. },
  74. enumerable
  75. });
  76. } else {
  77. Object.defineProperty(ref2, key, { value, enumerable });
  78. }
  79. }
  80. return ref2;
  81. }
  82. function controlledRef(initial, options = {}) {
  83. let source = initial;
  84. let track;
  85. let trigger;
  86. const ref2 = customRef((_track, _trigger) => {
  87. track = _track;
  88. trigger = _trigger;
  89. return {
  90. get() {
  91. return get2();
  92. },
  93. set(v) {
  94. set2(v);
  95. }
  96. };
  97. });
  98. function get2(tracking = true) {
  99. if (tracking)
  100. track();
  101. return source;
  102. }
  103. function set2(value, triggering = true) {
  104. var _a, _b;
  105. if (value === source)
  106. return;
  107. const old = source;
  108. if (((_a = options.onBeforeChange) == null ? void 0 : _a.call(options, value, old)) === false)
  109. return;
  110. source = value;
  111. (_b = options.onChanged) == null ? void 0 : _b.call(options, value, old);
  112. if (triggering)
  113. trigger();
  114. }
  115. const untrackedGet = () => get2(false);
  116. const silentSet = (v) => set2(v, false);
  117. const peek = () => get2(false);
  118. const lay = (v) => set2(v, false);
  119. return extendRef(ref2, {
  120. get: get2,
  121. set: set2,
  122. untrackedGet,
  123. silentSet,
  124. peek,
  125. lay
  126. }, { enumerable: true });
  127. }
  128. function createEventHook() {
  129. const fns = [];
  130. const off = (fn) => {
  131. const index = fns.indexOf(fn);
  132. if (index !== -1)
  133. fns.splice(index, 1);
  134. };
  135. const on = (fn) => {
  136. fns.push(fn);
  137. return {
  138. off: () => off(fn)
  139. };
  140. };
  141. const trigger = (param) => {
  142. fns.forEach((fn) => fn(param));
  143. };
  144. return {
  145. on,
  146. off,
  147. trigger
  148. };
  149. }
  150. function createGlobalState(stateFactory) {
  151. let initialized = false;
  152. let state;
  153. const scope = effectScope(true);
  154. return () => {
  155. if (!initialized) {
  156. state = scope.run(stateFactory);
  157. initialized = true;
  158. }
  159. return state;
  160. };
  161. }
  162. function reactify(fn) {
  163. return function(...args) {
  164. return computed(() => fn.apply(this, args.map((i) => unref(i))));
  165. };
  166. }
  167. function tryOnScopeDispose(fn) {
  168. if (getCurrentScope()) {
  169. onScopeDispose(fn);
  170. return true;
  171. }
  172. return false;
  173. }
  174. function createSharedComposable(composable) {
  175. let subscribers = 0;
  176. let state;
  177. let scope;
  178. const dispose = () => {
  179. subscribers -= 1;
  180. if (scope && subscribers <= 0) {
  181. scope.stop();
  182. state = void 0;
  183. scope = void 0;
  184. }
  185. };
  186. return (...args) => {
  187. subscribers += 1;
  188. if (!state) {
  189. scope = effectScope(true);
  190. state = scope.run(() => composable(...args));
  191. }
  192. tryOnScopeDispose(dispose);
  193. return state;
  194. };
  195. }
  196. var isClient = typeof window !== "undefined";
  197. var isDef = (val) => typeof val !== "undefined";
  198. var assert = (condition, ...infos) => {
  199. if (!condition)
  200. console.warn(...infos);
  201. };
  202. var toString = Object.prototype.toString;
  203. var isBoolean = (val) => typeof val === "boolean";
  204. var isFunction = (val) => typeof val === "function";
  205. var isNumber = (val) => typeof val === "number";
  206. var isString = (val) => typeof val === "string";
  207. var isObject = (val) => toString.call(val) === "[object Object]";
  208. var isWindow = (val) => typeof window !== "undefined" && toString.call(val) === "[object Window]";
  209. var now = () => Date.now();
  210. var timestamp = () => +Date.now();
  211. var clamp = (n, min, max) => Math.min(max, Math.max(min, n));
  212. var noop = () => {
  213. };
  214. var rand = (min, max) => {
  215. min = Math.ceil(min);
  216. max = Math.floor(max);
  217. return Math.floor(Math.random() * (max - min + 1)) + min;
  218. };
  219. function createFilterWrapper(filter, fn) {
  220. function wrapper(...args) {
  221. filter(() => fn.apply(this, args), { fn, thisArg: this, args });
  222. }
  223. return wrapper;
  224. }
  225. var bypassFilter = (invoke2) => {
  226. return invoke2();
  227. };
  228. function debounceFilter(ms, options = {}) {
  229. let timer;
  230. let maxTimer;
  231. const filter = (invoke2) => {
  232. const duration = unref(ms);
  233. const maxDuration = unref(options.maxWait);
  234. if (timer)
  235. clearTimeout(timer);
  236. if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
  237. if (maxTimer) {
  238. clearTimeout(maxTimer);
  239. maxTimer = null;
  240. }
  241. return invoke2();
  242. }
  243. if (maxDuration && !maxTimer) {
  244. maxTimer = setTimeout(() => {
  245. if (timer)
  246. clearTimeout(timer);
  247. maxTimer = null;
  248. invoke2();
  249. }, maxDuration);
  250. }
  251. timer = setTimeout(() => {
  252. if (maxTimer)
  253. clearTimeout(maxTimer);
  254. maxTimer = null;
  255. invoke2();
  256. }, duration);
  257. };
  258. return filter;
  259. }
  260. function throttleFilter(ms, trailing = true, leading = true) {
  261. let lastExec = 0;
  262. let timer;
  263. let preventLeading = !leading;
  264. const clear = () => {
  265. if (timer) {
  266. clearTimeout(timer);
  267. timer = void 0;
  268. }
  269. };
  270. const filter = (invoke2) => {
  271. const duration = unref(ms);
  272. const elapsed = Date.now() - lastExec;
  273. clear();
  274. if (duration <= 0) {
  275. lastExec = Date.now();
  276. return invoke2();
  277. }
  278. if (elapsed > duration) {
  279. lastExec = Date.now();
  280. if (preventLeading)
  281. preventLeading = false;
  282. else
  283. invoke2();
  284. } else if (trailing) {
  285. timer = setTimeout(() => {
  286. lastExec = Date.now();
  287. if (!leading)
  288. preventLeading = true;
  289. clear();
  290. invoke2();
  291. }, duration);
  292. }
  293. if (!leading && !timer)
  294. timer = setTimeout(() => preventLeading = true, duration);
  295. };
  296. return filter;
  297. }
  298. function pausableFilter(extendFilter = bypassFilter) {
  299. const isActive = ref(true);
  300. function pause() {
  301. isActive.value = false;
  302. }
  303. function resume() {
  304. isActive.value = true;
  305. }
  306. const eventFilter = (...args) => {
  307. if (isActive.value)
  308. extendFilter(...args);
  309. };
  310. return { isActive, pause, resume, eventFilter };
  311. }
  312. function promiseTimeout(ms, throwOnTimeout = false, reason = "Timeout") {
  313. return new Promise((resolve, reject) => {
  314. if (throwOnTimeout)
  315. setTimeout(() => reject(reason), ms);
  316. else
  317. setTimeout(resolve, ms);
  318. });
  319. }
  320. function identity(arg) {
  321. return arg;
  322. }
  323. function createSingletonPromise(fn) {
  324. let _promise;
  325. function wrapper() {
  326. if (!_promise)
  327. _promise = fn();
  328. return _promise;
  329. }
  330. wrapper.reset = () => __async(this, null, function* () {
  331. const _prev = _promise;
  332. _promise = void 0;
  333. if (_prev)
  334. yield _prev;
  335. });
  336. return wrapper;
  337. }
  338. function invoke(fn) {
  339. return fn();
  340. }
  341. function containsProp(obj, ...props) {
  342. return props.some((k) => k in obj);
  343. }
  344. function increaseWithUnit(target, delta) {
  345. var _a;
  346. if (typeof target === "number")
  347. return target + delta;
  348. const value = ((_a = target.match(/^-?[0-9]+\.?[0-9]*/)) == null ? void 0 : _a[0]) || "";
  349. const unit = target.slice(value.length);
  350. const result = parseFloat(value) + delta;
  351. if (Number.isNaN(result))
  352. return target;
  353. return result + unit;
  354. }
  355. function objectPick(obj, keys, omitUndefined = false) {
  356. return keys.reduce((n, k) => {
  357. if (k in obj) {
  358. if (!omitUndefined || !obj[k] === void 0)
  359. n[k] = obj[k];
  360. }
  361. return n;
  362. }, {});
  363. }
  364. function useDebounceFn(fn, ms = 200, options = {}) {
  365. return createFilterWrapper(debounceFilter(ms, options), fn);
  366. }
  367. function useDebounce(value, ms = 200, options = {}) {
  368. if (ms <= 0)
  369. return value;
  370. const debounced = ref(value.value);
  371. const updater = useDebounceFn(() => {
  372. debounced.value = value.value;
  373. }, ms, options);
  374. watch(value, () => updater());
  375. return debounced;
  376. }
  377. var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
  378. var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
  379. var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
  380. var __objRest$5 = (source, exclude) => {
  381. var target = {};
  382. for (var prop in source)
  383. if (__hasOwnProp$9.call(source, prop) && exclude.indexOf(prop) < 0)
  384. target[prop] = source[prop];
  385. if (source != null && __getOwnPropSymbols$9)
  386. for (var prop of __getOwnPropSymbols$9(source)) {
  387. if (exclude.indexOf(prop) < 0 && __propIsEnum$9.call(source, prop))
  388. target[prop] = source[prop];
  389. }
  390. return target;
  391. };
  392. function watchWithFilter(source, cb, options = {}) {
  393. const _a = options, {
  394. eventFilter = bypassFilter
  395. } = _a, watchOptions = __objRest$5(_a, [
  396. "eventFilter"
  397. ]);
  398. return watch(source, createFilterWrapper(eventFilter, cb), watchOptions);
  399. }
  400. var __defProp$7 = Object.defineProperty;
  401. var __defProps$4 = Object.defineProperties;
  402. var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
  403. var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
  404. var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
  405. var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
  406. var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  407. var __spreadValues$7 = (a, b) => {
  408. for (var prop in b || (b = {}))
  409. if (__hasOwnProp$8.call(b, prop))
  410. __defNormalProp$7(a, prop, b[prop]);
  411. if (__getOwnPropSymbols$8)
  412. for (var prop of __getOwnPropSymbols$8(b)) {
  413. if (__propIsEnum$8.call(b, prop))
  414. __defNormalProp$7(a, prop, b[prop]);
  415. }
  416. return a;
  417. };
  418. var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
  419. var __objRest$4 = (source, exclude) => {
  420. var target = {};
  421. for (var prop in source)
  422. if (__hasOwnProp$8.call(source, prop) && exclude.indexOf(prop) < 0)
  423. target[prop] = source[prop];
  424. if (source != null && __getOwnPropSymbols$8)
  425. for (var prop of __getOwnPropSymbols$8(source)) {
  426. if (exclude.indexOf(prop) < 0 && __propIsEnum$8.call(source, prop))
  427. target[prop] = source[prop];
  428. }
  429. return target;
  430. };
  431. function debouncedWatch(source, cb, options = {}) {
  432. const _a = options, {
  433. debounce = 0
  434. } = _a, watchOptions = __objRest$4(_a, [
  435. "debounce"
  436. ]);
  437. return watchWithFilter(source, cb, __spreadProps$4(__spreadValues$7({}, watchOptions), {
  438. eventFilter: debounceFilter(debounce)
  439. }));
  440. }
  441. function eagerComputed(fn) {
  442. const result = shallowRef();
  443. watchSyncEffect(() => {
  444. result.value = fn();
  445. });
  446. return readonly(result);
  447. }
  448. function get(obj, key) {
  449. if (key == null)
  450. return unref(obj);
  451. return unref(obj)[key];
  452. }
  453. var __defProp$6 = Object.defineProperty;
  454. var __defProps$3 = Object.defineProperties;
  455. var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
  456. var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
  457. var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
  458. var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
  459. var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  460. var __spreadValues$6 = (a, b) => {
  461. for (var prop in b || (b = {}))
  462. if (__hasOwnProp$7.call(b, prop))
  463. __defNormalProp$6(a, prop, b[prop]);
  464. if (__getOwnPropSymbols$7)
  465. for (var prop of __getOwnPropSymbols$7(b)) {
  466. if (__propIsEnum$7.call(b, prop))
  467. __defNormalProp$6(a, prop, b[prop]);
  468. }
  469. return a;
  470. };
  471. var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
  472. var __objRest$3 = (source, exclude) => {
  473. var target = {};
  474. for (var prop in source)
  475. if (__hasOwnProp$7.call(source, prop) && exclude.indexOf(prop) < 0)
  476. target[prop] = source[prop];
  477. if (source != null && __getOwnPropSymbols$7)
  478. for (var prop of __getOwnPropSymbols$7(source)) {
  479. if (exclude.indexOf(prop) < 0 && __propIsEnum$7.call(source, prop))
  480. target[prop] = source[prop];
  481. }
  482. return target;
  483. };
  484. function ignorableWatch(source, cb, options = {}) {
  485. const _a = options, {
  486. eventFilter = bypassFilter
  487. } = _a, watchOptions = __objRest$3(_a, [
  488. "eventFilter"
  489. ]);
  490. const filteredCb = createFilterWrapper(eventFilter, cb);
  491. let ignoreUpdates;
  492. let ignorePrevAsyncUpdates;
  493. let stop;
  494. if (watchOptions.flush === "sync") {
  495. const ignore = ref(false);
  496. ignorePrevAsyncUpdates = () => {
  497. };
  498. ignoreUpdates = (updater) => {
  499. ignore.value = true;
  500. updater();
  501. ignore.value = false;
  502. };
  503. stop = watch(source, (...args) => {
  504. if (!ignore.value)
  505. filteredCb(...args);
  506. }, watchOptions);
  507. } else {
  508. const disposables = [];
  509. const ignoreCounter = ref(0);
  510. const syncCounter = ref(0);
  511. ignorePrevAsyncUpdates = () => {
  512. ignoreCounter.value = syncCounter.value;
  513. };
  514. disposables.push(watch(source, () => {
  515. syncCounter.value++;
  516. }, __spreadProps$3(__spreadValues$6({}, watchOptions), { flush: "sync" })));
  517. ignoreUpdates = (updater) => {
  518. const syncCounterPrev = syncCounter.value;
  519. updater();
  520. ignoreCounter.value += syncCounter.value - syncCounterPrev;
  521. };
  522. disposables.push(watch(source, (...args) => {
  523. const ignore = ignoreCounter.value > 0 && ignoreCounter.value === syncCounter.value;
  524. ignoreCounter.value = 0;
  525. syncCounter.value = 0;
  526. if (ignore)
  527. return;
  528. filteredCb(...args);
  529. }, watchOptions));
  530. stop = () => {
  531. disposables.forEach((fn) => fn());
  532. };
  533. }
  534. return { stop, ignoreUpdates, ignorePrevAsyncUpdates };
  535. }
  536. function isDefined(v) {
  537. return unref(v) != null;
  538. }
  539. var __defProp$5 = Object.defineProperty;
  540. var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
  541. var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
  542. var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
  543. var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  544. var __spreadValues$5 = (a, b) => {
  545. for (var prop in b || (b = {}))
  546. if (__hasOwnProp$6.call(b, prop))
  547. __defNormalProp$5(a, prop, b[prop]);
  548. if (__getOwnPropSymbols$6)
  549. for (var prop of __getOwnPropSymbols$6(b)) {
  550. if (__propIsEnum$6.call(b, prop))
  551. __defNormalProp$5(a, prop, b[prop]);
  552. }
  553. return a;
  554. };
  555. function makeDestructurable(obj, arr) {
  556. if (typeof Symbol !== "undefined") {
  557. const clone = __spreadValues$5({}, obj);
  558. Object.defineProperty(clone, Symbol.iterator, {
  559. enumerable: false,
  560. value() {
  561. let index = 0;
  562. return {
  563. next: () => ({
  564. value: arr[index++],
  565. done: index > arr.length
  566. })
  567. };
  568. }
  569. });
  570. return clone;
  571. } else {
  572. return Object.assign([...arr], obj);
  573. }
  574. }
  575. function not(v) {
  576. return computed(() => !unref(v));
  577. }
  578. function or(...args) {
  579. return computed(() => args.some((i) => unref(i)));
  580. }
  581. var __defProp$4 = Object.defineProperty;
  582. var __defProps$2 = Object.defineProperties;
  583. var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
  584. var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
  585. var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
  586. var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
  587. var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  588. var __spreadValues$4 = (a, b) => {
  589. for (var prop in b || (b = {}))
  590. if (__hasOwnProp$5.call(b, prop))
  591. __defNormalProp$4(a, prop, b[prop]);
  592. if (__getOwnPropSymbols$5)
  593. for (var prop of __getOwnPropSymbols$5(b)) {
  594. if (__propIsEnum$5.call(b, prop))
  595. __defNormalProp$4(a, prop, b[prop]);
  596. }
  597. return a;
  598. };
  599. var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
  600. var __objRest$2 = (source, exclude) => {
  601. var target = {};
  602. for (var prop in source)
  603. if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
  604. target[prop] = source[prop];
  605. if (source != null && __getOwnPropSymbols$5)
  606. for (var prop of __getOwnPropSymbols$5(source)) {
  607. if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
  608. target[prop] = source[prop];
  609. }
  610. return target;
  611. };
  612. function pausableWatch(source, cb, options = {}) {
  613. const _a = options, {
  614. eventFilter: filter
  615. } = _a, watchOptions = __objRest$2(_a, [
  616. "eventFilter"
  617. ]);
  618. const { eventFilter, pause, resume, isActive } = pausableFilter(filter);
  619. const stop = watchWithFilter(source, cb, __spreadProps$2(__spreadValues$4({}, watchOptions), {
  620. eventFilter
  621. }));
  622. return { stop, pause, resume, isActive };
  623. }
  624. function reactifyObject(obj, optionsOrKeys = {}) {
  625. let keys = [];
  626. if (Array.isArray(optionsOrKeys)) {
  627. keys = optionsOrKeys;
  628. } else {
  629. const { includeOwnProperties = true } = optionsOrKeys;
  630. keys.push(...Object.keys(obj));
  631. if (includeOwnProperties)
  632. keys.push(...Object.getOwnPropertyNames(obj));
  633. }
  634. return Object.fromEntries(keys.map((key) => {
  635. const value = obj[key];
  636. return [
  637. key,
  638. typeof value === "function" ? reactify(value.bind(obj)) : value
  639. ];
  640. }));
  641. }
  642. function reactivePick(obj, ...keys) {
  643. return reactive(Object.fromEntries(keys.map((k) => [k, toRef(obj, k)])));
  644. }
  645. function refDefault(source, defaultValue) {
  646. return computed({
  647. get() {
  648. var _a;
  649. return (_a = source.value) != null ? _a : defaultValue;
  650. },
  651. set(value) {
  652. source.value = value;
  653. }
  654. });
  655. }
  656. function set(...args) {
  657. if (args.length === 2) {
  658. const [ref2, value] = args;
  659. ref2.value = value;
  660. }
  661. if (args.length === 3) {
  662. if (isVue2) {
  663. set$1(...args);
  664. } else {
  665. const [target, key, value] = args;
  666. target[key] = value;
  667. }
  668. }
  669. }
  670. function syncRef(source, targets, {
  671. flush = "sync",
  672. deep = false,
  673. immediate = true
  674. } = {}) {
  675. if (!Array.isArray(targets))
  676. targets = [targets];
  677. return watch(source, (newValue) => targets.forEach((target) => target.value = newValue), { flush, deep, immediate });
  678. }
  679. function useThrottleFn(fn, ms = 200, trailing = true, leading = true) {
  680. return createFilterWrapper(throttleFilter(ms, trailing, leading), fn);
  681. }
  682. function useThrottle(value, delay = 200, trailing = true, leading = true) {
  683. if (delay <= 0)
  684. return value;
  685. const throttled = ref(value.value);
  686. const updater = useThrottleFn(() => {
  687. throttled.value = value.value;
  688. }, delay, trailing, leading);
  689. watch(value, () => updater());
  690. return throttled;
  691. }
  692. var __defProp$3 = Object.defineProperty;
  693. var __defProps$1 = Object.defineProperties;
  694. var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
  695. var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
  696. var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
  697. var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
  698. var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  699. var __spreadValues$3 = (a, b) => {
  700. for (var prop in b || (b = {}))
  701. if (__hasOwnProp$4.call(b, prop))
  702. __defNormalProp$3(a, prop, b[prop]);
  703. if (__getOwnPropSymbols$4)
  704. for (var prop of __getOwnPropSymbols$4(b)) {
  705. if (__propIsEnum$4.call(b, prop))
  706. __defNormalProp$3(a, prop, b[prop]);
  707. }
  708. return a;
  709. };
  710. var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
  711. var __objRest$1 = (source, exclude) => {
  712. var target = {};
  713. for (var prop in source)
  714. if (__hasOwnProp$4.call(source, prop) && exclude.indexOf(prop) < 0)
  715. target[prop] = source[prop];
  716. if (source != null && __getOwnPropSymbols$4)
  717. for (var prop of __getOwnPropSymbols$4(source)) {
  718. if (exclude.indexOf(prop) < 0 && __propIsEnum$4.call(source, prop))
  719. target[prop] = source[prop];
  720. }
  721. return target;
  722. };
  723. function throttledWatch(source, cb, options = {}) {
  724. const _a = options, {
  725. throttle = 0,
  726. trailing = true,
  727. leading = true
  728. } = _a, watchOptions = __objRest$1(_a, [
  729. "throttle",
  730. "trailing",
  731. "leading"
  732. ]);
  733. return watchWithFilter(source, cb, __spreadProps$1(__spreadValues$3({}, watchOptions), {
  734. eventFilter: throttleFilter(throttle, trailing, leading)
  735. }));
  736. }
  737. function toReactive(objectRef) {
  738. if (!isRef(objectRef))
  739. return reactive(objectRef);
  740. const proxy = new Proxy({}, {
  741. get(_, p, receiver) {
  742. return Reflect.get(objectRef.value, p, receiver);
  743. },
  744. set(_, p, value) {
  745. objectRef.value[p] = value;
  746. return true;
  747. },
  748. deleteProperty(_, p) {
  749. return Reflect.deleteProperty(objectRef.value, p);
  750. },
  751. has(_, p) {
  752. return Reflect.has(objectRef.value, p);
  753. },
  754. ownKeys() {
  755. return Object.keys(objectRef.value);
  756. },
  757. getOwnPropertyDescriptor() {
  758. return {
  759. enumerable: true,
  760. configurable: true
  761. };
  762. }
  763. });
  764. return reactive(proxy);
  765. }
  766. var __defProp$2 = Object.defineProperty;
  767. var __defProps = Object.defineProperties;
  768. var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
  769. var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
  770. var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
  771. var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
  772. var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  773. var __spreadValues$2 = (a, b) => {
  774. for (var prop in b || (b = {}))
  775. if (__hasOwnProp$3.call(b, prop))
  776. __defNormalProp$2(a, prop, b[prop]);
  777. if (__getOwnPropSymbols$3)
  778. for (var prop of __getOwnPropSymbols$3(b)) {
  779. if (__propIsEnum$3.call(b, prop))
  780. __defNormalProp$2(a, prop, b[prop]);
  781. }
  782. return a;
  783. };
  784. var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
  785. function toRefs(objectRef) {
  786. if (!isRef(objectRef))
  787. return toRefs$1(objectRef);
  788. const result = Array.isArray(objectRef.value) ? new Array(objectRef.value.length) : {};
  789. for (const key in objectRef.value) {
  790. result[key] = customRef(() => ({
  791. get() {
  792. return objectRef.value[key];
  793. },
  794. set(v) {
  795. if (Array.isArray(objectRef.value)) {
  796. const copy = [...objectRef.value];
  797. copy[key] = v;
  798. objectRef.value = copy;
  799. } else {
  800. objectRef.value = __spreadProps(__spreadValues$2({}, objectRef.value), { [key]: v });
  801. }
  802. }
  803. }));
  804. }
  805. return result;
  806. }
  807. function tryOnBeforeUnmount(fn) {
  808. if (getCurrentInstance())
  809. onBeforeUnmount(fn);
  810. }
  811. function tryOnMounted(fn, sync = true) {
  812. if (getCurrentInstance())
  813. onMounted(fn);
  814. else if (sync)
  815. fn();
  816. else
  817. nextTick(fn);
  818. }
  819. function tryOnUnmounted(fn) {
  820. if (getCurrentInstance())
  821. onUnmounted(fn);
  822. }
  823. function until(r) {
  824. let isNot = false;
  825. function toMatch(condition, { flush = "sync", deep = false, timeout, throwOnTimeout } = {}) {
  826. let stop = null;
  827. const watcher = new Promise((resolve) => {
  828. stop = watch(r, (v) => {
  829. if (condition(v) === !isNot) {
  830. stop == null ? void 0 : stop();
  831. resolve();
  832. }
  833. }, {
  834. flush,
  835. deep,
  836. immediate: true
  837. });
  838. });
  839. const promises = [watcher];
  840. if (timeout) {
  841. promises.push(promiseTimeout(timeout, throwOnTimeout).finally(() => {
  842. stop == null ? void 0 : stop();
  843. }));
  844. }
  845. return Promise.race(promises);
  846. }
  847. function toBe(value, options) {
  848. return toMatch((v) => v === unref(value), options);
  849. }
  850. function toBeTruthy(options) {
  851. return toMatch((v) => Boolean(v), options);
  852. }
  853. function toBeNull(options) {
  854. return toBe(null, options);
  855. }
  856. function toBeUndefined(options) {
  857. return toBe(void 0, options);
  858. }
  859. function toBeNaN(options) {
  860. return toMatch(Number.isNaN, options);
  861. }
  862. function toContains(value, options) {
  863. return toMatch((v) => {
  864. const array = Array.from(v);
  865. return array.includes(value) || array.includes(unref(value));
  866. }, options);
  867. }
  868. function changed(options) {
  869. return changedTimes(1, options);
  870. }
  871. function changedTimes(n = 1, options) {
  872. let count = -1;
  873. return toMatch(() => {
  874. count += 1;
  875. return count >= n;
  876. }, options);
  877. }
  878. if (Array.isArray(unref(r))) {
  879. const instance = {
  880. toMatch,
  881. toContains,
  882. changed,
  883. changedTimes,
  884. get not() {
  885. isNot = !isNot;
  886. return this;
  887. }
  888. };
  889. return instance;
  890. } else {
  891. const instance = {
  892. toMatch,
  893. toBe,
  894. toBeTruthy,
  895. toBeNull,
  896. toBeNaN,
  897. toBeUndefined,
  898. changed,
  899. changedTimes,
  900. get not() {
  901. isNot = !isNot;
  902. return this;
  903. }
  904. };
  905. return instance;
  906. }
  907. }
  908. function useCounter(initialValue = 0, options = {}) {
  909. const count = ref(initialValue);
  910. const {
  911. max = Infinity,
  912. min = -Infinity
  913. } = options;
  914. const inc = (delta = 1) => count.value = Math.min(max, count.value + delta);
  915. const dec = (delta = 1) => count.value = Math.max(min, count.value - delta);
  916. const get2 = () => count.value;
  917. const set2 = (val) => count.value = val;
  918. const reset = (val = initialValue) => {
  919. initialValue = val;
  920. return set2(val);
  921. };
  922. return { count, inc, dec, get: get2, set: set2, reset };
  923. }
  924. function useIntervalFn(cb, interval = 1e3, options = {}) {
  925. const {
  926. immediate = true,
  927. immediateCallback = false
  928. } = options;
  929. let timer = null;
  930. const isActive = ref(false);
  931. function clean() {
  932. if (timer) {
  933. clearInterval(timer);
  934. timer = null;
  935. }
  936. }
  937. function pause() {
  938. isActive.value = false;
  939. clean();
  940. }
  941. function resume() {
  942. if (interval <= 0)
  943. return;
  944. isActive.value = true;
  945. if (immediateCallback)
  946. cb();
  947. clean();
  948. timer = setInterval(cb, interval);
  949. }
  950. if (immediate && isClient)
  951. resume();
  952. tryOnScopeDispose(pause);
  953. return {
  954. isActive,
  955. pause,
  956. resume
  957. };
  958. }
  959. var __defProp$1 = Object.defineProperty;
  960. var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
  961. var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
  962. var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
  963. var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  964. var __spreadValues$1 = (a, b) => {
  965. for (var prop in b || (b = {}))
  966. if (__hasOwnProp$2.call(b, prop))
  967. __defNormalProp$1(a, prop, b[prop]);
  968. if (__getOwnPropSymbols$2)
  969. for (var prop of __getOwnPropSymbols$2(b)) {
  970. if (__propIsEnum$2.call(b, prop))
  971. __defNormalProp$1(a, prop, b[prop]);
  972. }
  973. return a;
  974. };
  975. function useInterval(interval = 1e3, options = {}) {
  976. const {
  977. controls: exposeControls = false,
  978. immediate = true
  979. } = options;
  980. const counter = ref(0);
  981. const controls = useIntervalFn(() => counter.value += 1, interval, { immediate });
  982. if (exposeControls) {
  983. return __spreadValues$1({
  984. counter
  985. }, controls);
  986. } else {
  987. return counter;
  988. }
  989. }
  990. function useLastChanged(source, options = {}) {
  991. var _a;
  992. const ms = ref((_a = options.initialValue) != null ? _a : null);
  993. watch(source, () => ms.value = timestamp(), options);
  994. return ms;
  995. }
  996. function useTimeoutFn(cb, interval, options = {}) {
  997. const {
  998. immediate = true
  999. } = options;
  1000. const isPending = ref(false);
  1001. let timer = null;
  1002. function clear() {
  1003. if (timer) {
  1004. clearTimeout(timer);
  1005. timer = null;
  1006. }
  1007. }
  1008. function stop() {
  1009. isPending.value = false;
  1010. clear();
  1011. }
  1012. function start(...args) {
  1013. clear();
  1014. isPending.value = true;
  1015. timer = setTimeout(() => {
  1016. isPending.value = false;
  1017. timer = null;
  1018. cb(...args);
  1019. }, unref(interval));
  1020. }
  1021. if (immediate) {
  1022. isPending.value = true;
  1023. if (isClient)
  1024. start();
  1025. }
  1026. tryOnScopeDispose(stop);
  1027. return {
  1028. isPending,
  1029. start,
  1030. stop
  1031. };
  1032. }
  1033. var __defProp = Object.defineProperty;
  1034. var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
  1035. var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
  1036. var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
  1037. var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  1038. var __spreadValues = (a, b) => {
  1039. for (var prop in b || (b = {}))
  1040. if (__hasOwnProp$1.call(b, prop))
  1041. __defNormalProp(a, prop, b[prop]);
  1042. if (__getOwnPropSymbols$1)
  1043. for (var prop of __getOwnPropSymbols$1(b)) {
  1044. if (__propIsEnum$1.call(b, prop))
  1045. __defNormalProp(a, prop, b[prop]);
  1046. }
  1047. return a;
  1048. };
  1049. function useTimeout(interval = 1e3, options = {}) {
  1050. const {
  1051. controls: exposeControls = false
  1052. } = options;
  1053. const controls = useTimeoutFn(noop, interval, options);
  1054. const ready = computed(() => !controls.isPending.value);
  1055. if (exposeControls) {
  1056. return __spreadValues({
  1057. ready
  1058. }, controls);
  1059. } else {
  1060. return ready;
  1061. }
  1062. }
  1063. function useToggle(initialValue = false) {
  1064. if (isRef(initialValue)) {
  1065. return (value) => {
  1066. initialValue.value = typeof value === "boolean" ? value : !initialValue.value;
  1067. };
  1068. } else {
  1069. const boolean = ref(initialValue);
  1070. const toggle = (value) => {
  1071. boolean.value = typeof value === "boolean" ? value : !boolean.value;
  1072. };
  1073. return [boolean, toggle];
  1074. }
  1075. }
  1076. var __getOwnPropSymbols = Object.getOwnPropertySymbols;
  1077. var __hasOwnProp = Object.prototype.hasOwnProperty;
  1078. var __propIsEnum = Object.prototype.propertyIsEnumerable;
  1079. var __objRest = (source, exclude) => {
  1080. var target = {};
  1081. for (var prop in source)
  1082. if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
  1083. target[prop] = source[prop];
  1084. if (source != null && __getOwnPropSymbols)
  1085. for (var prop of __getOwnPropSymbols(source)) {
  1086. if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
  1087. target[prop] = source[prop];
  1088. }
  1089. return target;
  1090. };
  1091. function watchAtMost(source, cb, options) {
  1092. const _a = options, {
  1093. count
  1094. } = _a, watchOptions = __objRest(_a, [
  1095. "count"
  1096. ]);
  1097. const current = ref(0);
  1098. const stop = watchWithFilter(source, (...args) => {
  1099. current.value += 1;
  1100. if (current.value >= unref(count))
  1101. stop();
  1102. cb(...args);
  1103. }, watchOptions);
  1104. return { count: current, stop };
  1105. }
  1106. function watchOnce(source, cb, options) {
  1107. const stop = watch(source, (...args) => {
  1108. stop();
  1109. return cb(...args);
  1110. }, options);
  1111. }
  1112. function whenever(source, cb, options) {
  1113. return watch(source, (v, ov, onInvalidate) => {
  1114. if (v)
  1115. cb(v, ov, onInvalidate);
  1116. }, options);
  1117. }
  1118. export {
  1119. and,
  1120. biSyncRef,
  1121. controlledComputed,
  1122. extendRef,
  1123. controlledRef,
  1124. createEventHook,
  1125. createGlobalState,
  1126. reactify,
  1127. tryOnScopeDispose,
  1128. createSharedComposable,
  1129. isClient,
  1130. isDef,
  1131. assert,
  1132. isBoolean,
  1133. isFunction,
  1134. isNumber,
  1135. isString,
  1136. isObject,
  1137. isWindow,
  1138. now,
  1139. timestamp,
  1140. clamp,
  1141. noop,
  1142. rand,
  1143. createFilterWrapper,
  1144. bypassFilter,
  1145. debounceFilter,
  1146. throttleFilter,
  1147. pausableFilter,
  1148. promiseTimeout,
  1149. identity,
  1150. createSingletonPromise,
  1151. invoke,
  1152. containsProp,
  1153. increaseWithUnit,
  1154. objectPick,
  1155. useDebounceFn,
  1156. useDebounce,
  1157. watchWithFilter,
  1158. debouncedWatch,
  1159. eagerComputed,
  1160. get,
  1161. ignorableWatch,
  1162. isDefined,
  1163. makeDestructurable,
  1164. not,
  1165. or,
  1166. pausableWatch,
  1167. reactifyObject,
  1168. reactivePick,
  1169. refDefault,
  1170. set,
  1171. syncRef,
  1172. useThrottleFn,
  1173. useThrottle,
  1174. throttledWatch,
  1175. toReactive,
  1176. toRefs,
  1177. tryOnBeforeUnmount,
  1178. tryOnMounted,
  1179. tryOnUnmounted,
  1180. until,
  1181. useCounter,
  1182. useIntervalFn,
  1183. useInterval,
  1184. useLastChanged,
  1185. useTimeoutFn,
  1186. useTimeout,
  1187. useToggle,
  1188. watchAtMost,
  1189. watchOnce,
  1190. whenever
  1191. };
  1192. //# sourceMappingURL=chunk-22ATY35G.js.map