@baleada/logic 0.24.19 → 0.24.21

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.
Files changed (4) hide show
  1. package/lib/index.cjs +801 -296
  2. package/lib/index.d.ts +204 -11
  3. package/lib/index.js +798 -297
  4. package/package.json +15 -13
package/lib/index.js CHANGED
@@ -1,8 +1,5 @@
1
1
  import BezierEasing from 'bezier-easing';
2
2
  import { pipe, flatMap, unique, map, toArray, concat, filter, reduce, slice, sort, find, findIndex, at, some, includes, toLength, join, every, reverse as reverse$1, average } from 'lazy-collections';
3
- import { sortKind, Searcher } from 'fast-fuzzy';
4
- import createDOMPurify from 'dompurify';
5
- import slugify from '@sindresorhus/slugify';
6
3
  import arrayShuffle from 'array-shuffle';
7
4
  import { klona } from 'klona';
8
5
  import { dequal } from 'dequal';
@@ -11,6 +8,9 @@ import { getStroke } from 'perfect-freehand';
11
8
  import polygonClipping from 'polygon-clipping';
12
9
  import ky from 'ky';
13
10
  import clsx from 'clsx';
11
+ import { sortKind, Searcher } from 'fast-fuzzy';
12
+ import createDOMPurify from 'dompurify';
13
+ import slugify from '@sindresorhus/slugify';
14
14
 
15
15
  function createClip(content) {
16
16
  return (string) => {
@@ -45,10 +45,8 @@ function createResults(candidates, options = {}) {
45
45
  }
46
46
 
47
47
  function fromShorthandAliasToLonghandAlias(shorthand) {
48
- if (capitalLetterRE.test(shorthand))
49
- return `shift+${shorthand.toLowerCase()}`;
50
- if (shorthand in keycombosBySpecialCharacter)
51
- return keycombosBySpecialCharacter[shorthand];
48
+ if (capitalLetterRE.test(shorthand)) return `shift+${shorthand.toLowerCase()}`;
49
+ if (shorthand in keycombosBySpecialCharacter) return keycombosBySpecialCharacter[shorthand];
52
50
  return shorthand;
53
51
  }
54
52
  const capitalLetterRE = /^[A-Z]$/;
@@ -100,16 +98,11 @@ function createAliases(options = {}) {
100
98
  }
101
99
 
102
100
  function fromAliasToCode(alias) {
103
- if (alias in partialCodesByAlias)
104
- return partialCodesByAlias[alias];
105
- if (alias in keyStatusKeysByAlias)
106
- return keyStatusKeysByAlias[alias];
107
- if (letterRE.test(alias))
108
- return `Key${alias.toUpperCase()}`;
109
- if (digitRE.test(alias))
110
- return `Digit${alias}`;
111
- if (functionRE.test(alias))
112
- return alias.toUpperCase();
101
+ if (alias in partialCodesByAlias) return partialCodesByAlias[alias];
102
+ if (alias in keyStatusKeysByAlias) return keyStatusKeysByAlias[alias];
103
+ if (letterRE.test(alias)) return `Key${alias.toUpperCase()}`;
104
+ if (digitRE.test(alias)) return `Digit${alias}`;
105
+ if (functionRE.test(alias)) return alias.toUpperCase();
113
106
  return "unsupported";
114
107
  }
115
108
  const digitRE = /^[0-9]$/;
@@ -235,8 +228,7 @@ function createReverse() {
235
228
  };
236
229
  }
237
230
  function createSlice(from, to) {
238
- if (from < 0 || to && to < 0)
239
- return (array) => array.slice(from, to);
231
+ if (from < 0 || to && to < 0) return (array) => array.slice(from, to);
240
232
  const toSliced = to ? slice(from, to - 1) : slice(from);
241
233
  return (array) => {
242
234
  return from === to ? [] : pipe(
@@ -351,8 +343,7 @@ function createFindAsync(predicate) {
351
343
  return async (array) => {
352
344
  for (let i = 0; i < array.length; i++) {
353
345
  const item = array[i], is = await predicate(item, i);
354
- if (is)
355
- return item;
346
+ if (is) return item;
356
347
  }
357
348
  };
358
349
  }
@@ -360,8 +351,7 @@ function createFindIndexAsync(predicate) {
360
351
  return async (array) => {
361
352
  for (let i = 0; i < array.length; i++) {
362
353
  const item = array[i], is = await predicate(item, i);
363
- if (is)
364
- return i;
354
+ if (is) return i;
365
355
  }
366
356
  };
367
357
  }
@@ -426,11 +416,18 @@ function createBreadthPathConfig(directedAcyclic) {
426
416
  return { predicatePathable, toTraversalCandidates };
427
417
  }
428
418
 
419
+ var __defProp$i = Object.defineProperty;
420
+ var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
421
+ var __publicField$i = (obj, key, value) => __defNormalProp$i(obj, typeof key !== "symbol" ? key + "" : key, value);
429
422
  class Recognizeable {
430
- maxSequenceLength;
431
- effects;
432
- effectApi;
433
423
  constructor(sequence, options = {}) {
424
+ __publicField$i(this, "maxSequenceLength");
425
+ __publicField$i(this, "effects");
426
+ __publicField$i(this, "effectApi");
427
+ __publicField$i(this, "computedMetadata");
428
+ __publicField$i(this, "computedStatus");
429
+ __publicField$i(this, "computedStops");
430
+ __publicField$i(this, "computedSequence");
434
431
  const defaultOptions = {
435
432
  maxSequenceLength: true,
436
433
  effects: {}
@@ -456,7 +453,6 @@ class Recognizeable {
456
453
  };
457
454
  this.ready();
458
455
  }
459
- computedMetadata;
460
456
  resetComputedMetadata() {
461
457
  this.computedMetadata = {};
462
458
  }
@@ -466,7 +462,6 @@ class Recognizeable {
466
462
  denied() {
467
463
  this.computedStatus = "denied";
468
464
  }
469
- computedStatus;
470
465
  ready() {
471
466
  this.computedStatus = "ready";
472
467
  }
@@ -476,7 +471,6 @@ class Recognizeable {
476
471
  set sequence(sequence) {
477
472
  this.setSequence(sequence);
478
473
  }
479
- computedStops;
480
474
  get stops() {
481
475
  return this.computedStops;
482
476
  }
@@ -486,7 +480,6 @@ class Recognizeable {
486
480
  get metadata() {
487
481
  return this.computedMetadata;
488
482
  }
489
- computedSequence;
490
483
  setSequence(sequence) {
491
484
  this.computedSequence = sequence;
492
485
  return this;
@@ -495,11 +488,9 @@ class Recognizeable {
495
488
  this.recognizing();
496
489
  const type = this.toType(sequenceItem), pushSequence = (sequenceItem2) => {
497
490
  newSequence.push(sequenceItem2);
498
- if (this.maxSequenceLength !== true && newSequence.length > this.maxSequenceLength)
499
- newSequence.shift();
491
+ if (this.maxSequenceLength !== true && newSequence.length > this.maxSequenceLength) newSequence.shift();
500
492
  }, newSequence = [];
501
- for (const previousSequenceItem of this.sequence)
502
- pushSequence(previousSequenceItem);
493
+ for (const previousSequenceItem of this.sequence) pushSequence(previousSequenceItem);
503
494
  pushSequence(sequenceItem);
504
495
  this.effectApi.getSequence = () => newSequence;
505
496
  this.effectApi.pushSequence = pushSequence;
@@ -558,11 +549,17 @@ function isEffectConfig(effectOrConfig) {
558
549
  return typeof effectOrConfig === "object";
559
550
  }
560
551
 
552
+ var __defProp$h = Object.defineProperty;
553
+ var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
554
+ var __publicField$h = (obj, key, value) => __defNormalProp$h(obj, typeof key !== "symbol" ? key + "" : key, value);
561
555
  class Listenable {
562
- computedRecognizeable;
563
- recognizeableEffectsKeys;
564
- computedActive;
565
556
  constructor(type, options) {
557
+ __publicField$h(this, "computedRecognizeable");
558
+ __publicField$h(this, "recognizeableEffectsKeys");
559
+ __publicField$h(this, "computedActive");
560
+ __publicField$h(this, "computedStatus");
561
+ __publicField$h(this, "computedType");
562
+ __publicField$h(this, "implementation");
566
563
  if (type === "recognizeable") {
567
564
  this.computedRecognizeable = new Recognizeable([], options?.recognizeable);
568
565
  this.recognizeableEffectsKeys = Object.keys(options?.recognizeable?.effects);
@@ -571,7 +568,6 @@ class Listenable {
571
568
  this.setType(type);
572
569
  this.ready();
573
570
  }
574
- computedStatus;
575
571
  ready() {
576
572
  this.computedStatus = "ready";
577
573
  }
@@ -590,8 +586,6 @@ class Listenable {
590
586
  get recognizeable() {
591
587
  return this.computedRecognizeable;
592
588
  }
593
- computedType;
594
- implementation;
595
589
  setType(type) {
596
590
  this.stop();
597
591
  this.computedType = type;
@@ -668,8 +662,7 @@ class Listenable {
668
662
  sequenceItem,
669
663
  { listenInjection: { effect, optionsByType } }
670
664
  );
671
- if (this.recognizeable.status === "recognized")
672
- effect(sequenceItem);
665
+ if (this.recognizeable.status === "recognized") effect(sequenceItem);
673
666
  }, optionsByType = {};
674
667
  for (const type of this.recognizeableEffectsKeys) {
675
668
  optionsByType[type] = {
@@ -722,8 +715,7 @@ class Listenable {
722
715
  stop(stoppable);
723
716
  this.active.delete(stoppable);
724
717
  }
725
- if (shouldUpdateStatus)
726
- this.stopped();
718
+ if (shouldUpdateStatus) this.stopped();
727
719
  break;
728
720
  }
729
721
  return this;
@@ -895,8 +887,7 @@ function createKeypress(keycomboOrKeycombos, options = {}) {
895
887
  toAliases,
896
888
  getRequest: () => request
897
889
  }), fromComboToAliasesLength = createAliasesLength({ toLonghand }), maybeAddWindowBlurListener = () => {
898
- if (windowBlurStatus === "added")
899
- return;
890
+ if (windowBlurStatus === "added") return;
900
891
  window.addEventListener("blur", onWindowBlur);
901
892
  windowBlurStatus = "added";
902
893
  }, onWindowBlur = () => {
@@ -925,13 +916,11 @@ function createKeypress(keycomboOrKeycombos, options = {}) {
925
916
  ) {
926
917
  denied();
927
918
  localStatus = getStatus();
928
- if (includes(event.key)(unsupportedKeys))
929
- clearStatuses();
919
+ if (includes(event.key)(unsupportedKeys)) clearStatuses();
930
920
  onDown?.(toHookApi(api));
931
921
  return;
932
922
  }
933
- if (preventsDefaultUnlessDenied)
934
- event.preventDefault();
923
+ if (preventsDefaultUnlessDenied) event.preventDefault();
935
924
  const { getMetadata } = api, metadata = getMetadata();
936
925
  metadata.keycombo = downCombos[0];
937
926
  localStatus = "recognizing";
@@ -959,12 +948,9 @@ function createKeypress(keycomboOrKeycombos, options = {}) {
959
948
  const { denied } = api, key = fromEventToKeyStatusCode(event);
960
949
  if (localStatus === "denied") {
961
950
  denied();
962
- if (includes(event.key)(unsupportedKeys))
963
- clearStatuses();
964
- else
965
- deleteStatus(key);
966
- if (!predicateSomeKeyDown(statuses))
967
- localStatus = "recognizing";
951
+ if (includes(event.key)(unsupportedKeys)) clearStatuses();
952
+ else deleteStatus(key);
953
+ if (!predicateSomeKeyDown(statuses)) localStatus = "recognizing";
968
954
  onUp?.(toHookApi(api));
969
955
  return;
970
956
  }
@@ -973,8 +959,7 @@ function createKeypress(keycomboOrKeycombos, options = {}) {
973
959
  if (downCombos.length && matches) {
974
960
  const { getMetadata } = api, metadata = getMetadata();
975
961
  metadata.keycombo = downCombos[0];
976
- if (preventsDefaultUnlessDenied)
977
- event.preventDefault();
962
+ if (preventsDefaultUnlessDenied) event.preventDefault();
978
963
  localStatus = "recognizing";
979
964
  onUp?.(toHookApi(api));
980
965
  return;
@@ -984,8 +969,7 @@ function createKeypress(keycomboOrKeycombos, options = {}) {
984
969
  onUp?.(toHookApi(api));
985
970
  };
986
971
  const visibilitychange = (event, api) => {
987
- if (document.visibilityState === "hidden")
988
- onWindowBlur();
972
+ if (document.visibilityState === "hidden") onWindowBlur();
989
973
  onVisibilitychange?.(toHookApi(api));
990
974
  };
991
975
  return {
@@ -1048,8 +1032,7 @@ function createKeyrelease(keycomboOrKeycombos, options = {}) {
1048
1032
  toAliases,
1049
1033
  getRequest: () => request
1050
1034
  }), fromComboToAliasesLength = createAliasesLength({ toLonghand }), maybeAddWindowBlurListener = () => {
1051
- if (windowBlurStatus === "added")
1052
- return;
1035
+ if (windowBlurStatus === "added") return;
1053
1036
  window.addEventListener("blur", onWindowBlur);
1054
1037
  windowBlurStatus = "added";
1055
1038
  }, onWindowBlur = () => {
@@ -1078,13 +1061,11 @@ function createKeyrelease(keycomboOrKeycombos, options = {}) {
1078
1061
  ) {
1079
1062
  denied();
1080
1063
  localStatus = getStatus();
1081
- if (includes(event.key)(unsupportedKeys))
1082
- clearStatuses();
1064
+ if (includes(event.key)(unsupportedKeys)) clearStatuses();
1083
1065
  onDown?.(toHookApi(api));
1084
1066
  return;
1085
1067
  }
1086
- if (preventsDefaultUnlessDenied)
1087
- event.preventDefault();
1068
+ if (preventsDefaultUnlessDenied) event.preventDefault();
1088
1069
  const { getMetadata } = api;
1089
1070
  localStatus = "recognizing";
1090
1071
  stop();
@@ -1104,14 +1085,10 @@ function createKeyrelease(keycomboOrKeycombos, options = {}) {
1104
1085
  denied
1105
1086
  } = api, metadata = getMetadata(), key = fromEventToKeyStatusCode(event);
1106
1087
  if (["denied", "recognized"].includes(localStatus)) {
1107
- if (localStatus === "denied")
1108
- denied();
1109
- if (includes(event.key)(unsupportedKeys))
1110
- clearStatuses();
1111
- else
1112
- deleteStatus(key);
1113
- if (!predicateSomeKeyDown(statuses))
1114
- localStatus = "recognizing";
1088
+ if (localStatus === "denied") denied();
1089
+ if (includes(event.key)(unsupportedKeys)) clearStatuses();
1090
+ else deleteStatus(key);
1091
+ if (!predicateSomeKeyDown(statuses)) localStatus = "recognizing";
1115
1092
  onUp?.(toHookApi(api));
1116
1093
  return;
1117
1094
  }
@@ -1127,8 +1104,7 @@ function createKeyrelease(keycomboOrKeycombos, options = {}) {
1127
1104
  localStatus = status;
1128
1105
  metadata.keycombo = downCombos[0];
1129
1106
  }
1130
- if (preventsDefaultUnlessDenied)
1131
- event.preventDefault();
1107
+ if (preventsDefaultUnlessDenied) event.preventDefault();
1132
1108
  onUp?.(toHookApi(api));
1133
1109
  };
1134
1110
  const recognize = (event, api) => {
@@ -1222,8 +1198,7 @@ function createKeychord(keycombos, options = {}) {
1222
1198
  return;
1223
1199
  }
1224
1200
  const { getMetadata } = api, metadata = getMetadata(), downCombos = keyStates[playedIndex].getDownCombos();
1225
- if (playedIndex === 0)
1226
- metadata.played = [];
1201
+ if (playedIndex === 0) metadata.played = [];
1227
1202
  if (
1228
1203
  // NOT BUILDING VALID COMBO
1229
1204
  !keyStates[playedIndex].predicateValid(event) || downCombos.length > 1 && fromComboToAliasesLength(downCombos[0]) === fromComboToAliasesLength(downCombos[1]) || playedIndex > 0 && event.timeStamp - metadata.played[playedIndex - 1].times.end > maxInterval
@@ -1231,14 +1206,12 @@ function createKeychord(keycombos, options = {}) {
1231
1206
  denied();
1232
1207
  localStatuses[playedIndex] = getStatus();
1233
1208
  if (includes(event.key)(unsupportedKeys)) {
1234
- for (const { clearStatuses } of keyStates)
1235
- clearStatuses();
1209
+ for (const { clearStatuses } of keyStates) clearStatuses();
1236
1210
  }
1237
1211
  onDown?.(toHookApi(api));
1238
1212
  return;
1239
1213
  }
1240
- if (preventsDefaultUnlessDenied)
1241
- event.preventDefault();
1214
+ if (preventsDefaultUnlessDenied) event.preventDefault();
1242
1215
  localStatuses[playedIndex] = "recognizing";
1243
1216
  keyStates[playedIndex].stop();
1244
1217
  storeKeyboardTimeMetadata({
@@ -1260,21 +1233,16 @@ function createKeychord(keycombos, options = {}) {
1260
1233
  denied
1261
1234
  } = api, metadata = getMetadata(), key = fromEventToKeyStatusCode(event);
1262
1235
  if (["denied", "recognized"].includes(localStatuses[playedIndex])) {
1263
- if (localStatuses[playedIndex] === "denied")
1264
- denied();
1236
+ if (localStatuses[playedIndex] === "denied") denied();
1265
1237
  for (const { clearStatuses, deleteStatus } of keyStates) {
1266
- if (includes(event.key)(unsupportedKeys))
1267
- clearStatuses();
1268
- else
1269
- deleteStatus(key);
1238
+ if (includes(event.key)(unsupportedKeys)) clearStatuses();
1239
+ else deleteStatus(key);
1270
1240
  }
1271
1241
  if (!predicateSomeKeyDown(keyStates[playedIndex].statuses)) {
1272
1242
  if (localStatuses[playedIndex] === "denied" || playedIndex === narrowedKeycombos.length - 1 && localStatuses[playedIndex] === "recognized") {
1273
1243
  playedIndex = 0;
1274
- for (let i = 0; i < localStatuses.length; i++)
1275
- localStatuses[i] = "recognizing";
1276
- for (const { clearStatuses } of keyStates)
1277
- clearStatuses();
1244
+ for (let i = 0; i < localStatuses.length; i++) localStatuses[i] = "recognizing";
1245
+ for (const { clearStatuses } of keyStates) clearStatuses();
1278
1246
  }
1279
1247
  }
1280
1248
  onUp?.(toHookApi(api));
@@ -1294,14 +1262,11 @@ function createKeychord(keycombos, options = {}) {
1294
1262
  keycombo: downCombos[0]
1295
1263
  };
1296
1264
  }
1297
- if (preventsDefaultUnlessDenied)
1298
- event.preventDefault();
1265
+ if (preventsDefaultUnlessDenied) event.preventDefault();
1299
1266
  if (playedIndex === narrowedKeycombos.length - 1 && !predicateSomeKeyDown(keyStates[playedIndex].statuses)) {
1300
1267
  playedIndex = 0;
1301
- for (let i = 0; i < localStatuses.length; i++)
1302
- localStatuses[i] = "recognizing";
1303
- for (const { clearStatuses } of keyStates)
1304
- clearStatuses();
1268
+ for (let i = 0; i < localStatuses.length; i++) localStatuses[i] = "recognizing";
1269
+ for (const { clearStatuses } of keyStates) clearStatuses();
1305
1270
  }
1306
1271
  onUp?.(toHookApi(api));
1307
1272
  };
@@ -1320,8 +1285,7 @@ function createKeychord(keycombos, options = {}) {
1320
1285
  };
1321
1286
  const visibilitychange = (event, api) => {
1322
1287
  if (document.visibilityState === "hidden") {
1323
- for (const { clearStatuses } of keyStates)
1324
- clearStatuses();
1288
+ for (const { clearStatuses } of keyStates) clearStatuses();
1325
1289
  localStatuses[playedIndex] = "recognizing";
1326
1290
  keyStates[playedIndex].stop();
1327
1291
  playedIndex = 0;
@@ -1427,14 +1391,13 @@ function createPointerpress(options = {}) {
1427
1391
  if (pointerStatus === "down") {
1428
1392
  denied();
1429
1393
  stop(target);
1430
- pointerStatus = "leave";
1394
+ pointerStatus = "out";
1431
1395
  }
1432
1396
  onOut?.(toHookApi(api));
1433
1397
  };
1434
1398
  const pointerup = (event, api) => {
1435
1399
  const { denied, listenInjection: { optionsByType: { pointerup: { target } } } } = api;
1436
- if (pointerStatus !== "down")
1437
- return;
1400
+ if (pointerStatus !== "down") return;
1438
1401
  denied();
1439
1402
  stop(target);
1440
1403
  pointerStatus = "up";
@@ -1551,8 +1514,7 @@ function createTerminal(graph) {
1551
1514
  function createChildren(graph) {
1552
1515
  return function* (node) {
1553
1516
  const outgoing = createOutgoing(graph)(node);
1554
- for (const edge of outgoing)
1555
- yield edge.to;
1517
+ for (const edge of outgoing) yield edge.to;
1556
1518
  };
1557
1519
  }
1558
1520
  function createIndegree(graph) {
@@ -1623,11 +1585,9 @@ function createSiblings(graph) {
1623
1585
  function createFind(node) {
1624
1586
  return (tree) => {
1625
1587
  for (const treeNode of tree) {
1626
- if (treeNode.node === node)
1627
- return treeNode;
1588
+ if (treeNode.node === node) return treeNode;
1628
1589
  const found = createFind(node)(treeNode.children);
1629
- if (found)
1630
- return found;
1590
+ if (found) return found;
1631
1591
  }
1632
1592
  };
1633
1593
  }
@@ -1658,8 +1618,7 @@ function createLayers$1(options = {}) {
1658
1618
  const layers = [];
1659
1619
  for (const { path } of toSteps(directedAcyclic)) {
1660
1620
  const node = path.at(-1), depth = path.length - 1;
1661
- if (!layers[depth] && depth > 0)
1662
- yield layers[depth - 1];
1621
+ if (!layers[depth] && depth > 0) yield layers[depth - 1];
1663
1622
  (layers[depth] || (layers[depth] = [])).push(node);
1664
1623
  }
1665
1624
  yield layers.at(-1);
@@ -1751,8 +1710,7 @@ function createSteps$1(configure, options = {}) {
1751
1710
  yield { path, state: JSON.parse(JSON.stringify(state)) };
1752
1711
  function* toStep() {
1753
1712
  if (predicateExhausted(location)) {
1754
- if (includes(location)(roots))
1755
- return;
1713
+ if (includes(location)(roots)) return;
1756
1714
  state[location].status = "unset";
1757
1715
  delete state[location].value;
1758
1716
  const path3 = toPath(state);
@@ -1766,8 +1724,7 @@ function createSteps$1(configure, options = {}) {
1766
1724
  yield { path: path2, state: JSON.parse(JSON.stringify(state)) };
1767
1725
  stepFromEffect(location);
1768
1726
  const newLocation = path2.at(-1);
1769
- if (predicateSteppable(newLocation))
1770
- location = newLocation;
1727
+ if (predicateSteppable(newLocation)) location = newLocation;
1771
1728
  yield* toStep();
1772
1729
  }
1773
1730
  yield* toStep();
@@ -1777,10 +1734,8 @@ function createRoots(options = {}) {
1777
1734
  return function* (directedAcyclic) {
1778
1735
  const { nodes } = directedAcyclic, predicateRoot = createRoot(directedAcyclic);
1779
1736
  for (const node of nodes) {
1780
- if (predicateRoot(node))
1781
- yield node;
1782
- if (options.kind === "arborescence")
1783
- break;
1737
+ if (predicateRoot(node)) yield node;
1738
+ if (options.kind === "arborescence") break;
1784
1739
  }
1785
1740
  };
1786
1741
  }
@@ -1956,8 +1911,7 @@ function createSteps(configure, options = {}) {
1956
1911
  yield { path, state: JSON.parse(JSON.stringify(state)) };
1957
1912
  async function* toStep() {
1958
1913
  if (predicateExhausted(location)) {
1959
- if (includes(location)(roots))
1960
- return;
1914
+ if (includes(location)(roots)) return;
1961
1915
  state[location].status = "unset";
1962
1916
  delete state[location].value;
1963
1917
  const path3 = await toPath(state);
@@ -1971,8 +1925,7 @@ function createSteps(configure, options = {}) {
1971
1925
  yield { path: path2, state: JSON.parse(JSON.stringify(state)) };
1972
1926
  stepFromEffect(location);
1973
1927
  const newLocation = path2.at(-1);
1974
- if (predicateSteppable(newLocation))
1975
- location = newLocation;
1928
+ if (predicateSteppable(newLocation)) location = newLocation;
1976
1929
  yield* await toStep();
1977
1930
  }
1978
1931
  yield* await toStep();
@@ -2050,53 +2003,44 @@ function createFocusable(order, options = {}) {
2050
2003
  switch (order) {
2051
2004
  case "first":
2052
2005
  return (element) => {
2053
- if (predicatesElement && predicateFocusable(element))
2054
- return element;
2006
+ if (predicatesElement && predicateFocusable(element)) return element;
2055
2007
  for (let i = 0; i < element.children.length; i++) {
2056
2008
  const focusable = createFocusable(order, { predicatesElement: true })(element.children[i]);
2057
- if (focusable)
2058
- return focusable;
2009
+ if (focusable) return focusable;
2059
2010
  }
2060
2011
  };
2061
2012
  case "last":
2062
2013
  return (element) => {
2063
- if (predicatesElement && predicateFocusable(element))
2064
- return element;
2014
+ if (predicatesElement && predicateFocusable(element)) return element;
2065
2015
  for (let i = element.children.length - 1; i > -1; i--) {
2066
2016
  const focusable = createFocusable(order, { predicatesElement: true })(element.children[i]);
2067
- if (focusable)
2068
- return focusable;
2017
+ if (focusable) return focusable;
2069
2018
  }
2070
2019
  };
2071
2020
  case "next":
2072
2021
  return (element) => {
2073
- if (predicatesElement && predicateFocusable(element))
2074
- return element;
2022
+ if (predicatesElement && predicateFocusable(element)) return element;
2075
2023
  const focusable = createFocusable("first")(element);
2076
- if (focusable)
2077
- return focusable;
2024
+ if (focusable) return focusable;
2078
2025
  let current = element;
2079
2026
  while (current && current !== document.documentElement) {
2080
2027
  const nextSibling = current.nextElementSibling;
2081
2028
  if (nextSibling) {
2082
2029
  const focusable2 = createFocusable("first", { predicatesElement: true })(nextSibling);
2083
- if (focusable2)
2084
- return focusable2;
2030
+ if (focusable2) return focusable2;
2085
2031
  }
2086
2032
  current = current.nextElementSibling || current.parentElement;
2087
2033
  }
2088
2034
  };
2089
2035
  case "previous":
2090
2036
  return (element) => {
2091
- if (predicatesElement && predicateFocusable(element))
2092
- return element;
2037
+ if (predicatesElement && predicateFocusable(element)) return element;
2093
2038
  let current = element;
2094
2039
  while (current && current !== document.documentElement) {
2095
2040
  const previousSibling = current.previousElementSibling;
2096
2041
  if (previousSibling) {
2097
2042
  const focusable = createFocusable("last", { predicatesElement: true })(previousSibling);
2098
- if (focusable)
2099
- return focusable;
2043
+ if (focusable) return focusable;
2100
2044
  }
2101
2045
  current = current.previousElementSibling || current.parentElement;
2102
2046
  }
@@ -2138,19 +2082,16 @@ const createKeycomboMatch$1 = (keycombo, options = {}) => {
2138
2082
  const implicitModifier = find(
2139
2083
  (modifier) => code.includes(modifier)
2140
2084
  )(modifiers);
2141
- if (implicitModifier)
2142
- implicitModifierAliases2.push(implicitModifier.toLowerCase());
2085
+ if (implicitModifier) implicitModifierAliases2.push(implicitModifier.toLowerCase());
2143
2086
  }
2144
2087
  return implicitModifierAliases2;
2145
2088
  })();
2146
2089
  return (descriptor) => {
2147
2090
  const statuses = [];
2148
- if (descriptor.code)
2149
- createSet(fromEventToKeyStatusCode(descriptor), "down")(statuses);
2091
+ if (descriptor.code) createSet(fromEventToKeyStatusCode(descriptor), "down")(statuses);
2150
2092
  for (const modifier of modifiers) {
2151
2093
  const prefix = modifier === "Control" ? "ctrl" : modifier.toLowerCase();
2152
- if (descriptor[`${prefix}Key`])
2153
- createSet(modifier, "down")(statuses);
2094
+ if (descriptor[`${prefix}Key`]) createSet(modifier, "down")(statuses);
2154
2095
  }
2155
2096
  const descriptors = createMap(
2156
2097
  ([code]) => {
@@ -2261,8 +2202,7 @@ function createEvery(predicate) {
2261
2202
  function createSome(predicate) {
2262
2203
  return (object) => {
2263
2204
  for (const key in object) {
2264
- if (predicate(key, object[key]))
2265
- return true;
2205
+ if (predicate(key, object[key])) return true;
2266
2206
  }
2267
2207
  return false;
2268
2208
  };
@@ -2343,8 +2283,7 @@ function createDelete$2(key, options = {}) {
2343
2283
  const index = findIndex(
2344
2284
  ([candidate]) => predicateKey(candidate)
2345
2285
  )(associativeArray);
2346
- if (index === -1)
2347
- return associativeArray;
2286
+ if (index === -1) return associativeArray;
2348
2287
  associativeArray.splice(index, 1);
2349
2288
  return associativeArray;
2350
2289
  };
@@ -2414,11 +2353,9 @@ const createKeycomboDown = (keycombo, options = {}) => {
2414
2353
  };
2415
2354
 
2416
2355
  function fromKeyboardEventDescriptorToAliases(descriptor) {
2417
- if (descriptor.shiftKey && descriptor.code in aliasesByShiftCode)
2418
- return [aliasesByShiftCode[descriptor.code]];
2356
+ if (descriptor.shiftKey && descriptor.code in aliasesByShiftCode) return [aliasesByShiftCode[descriptor.code]];
2419
2357
  const withoutModifierSide = toWithoutModifierSide(descriptor.code);
2420
- if (withoutModifierSide in aliasListsByModifier)
2421
- return aliasListsByModifier[withoutModifierSide];
2358
+ if (withoutModifierSide in aliasListsByModifier) return aliasListsByModifier[withoutModifierSide];
2422
2359
  return descriptor.code in aliasesByCode ? [aliasesByCode[descriptor.code]] : [descriptor.code.match(aliasCaptureRE)?.[1].toLowerCase() || "unsupported"];
2423
2360
  }
2424
2361
  const toWithoutModifierSide = createClip(/(?:Left|Right)$/);
@@ -2589,8 +2526,7 @@ function createToIntl(_Intl) {
2589
2526
  params,
2590
2527
  { predicateKey: createDeepEqual(params) }
2591
2528
  )(intls);
2592
- if (intl)
2593
- return intl;
2529
+ if (intl) return intl;
2594
2530
  const newIntl = new _Intl(...params);
2595
2531
  createSet$2(
2596
2532
  params,
@@ -2699,11 +2635,9 @@ function storeKeyboardTimeMetadata({
2699
2635
  setRequest,
2700
2636
  recognize
2701
2637
  }) {
2702
- if (!getShouldStore())
2703
- return;
2638
+ if (!getShouldStore()) return;
2704
2639
  const { getStatus, listenInjection: { effect } } = api, timeMetadata = getTimeMetadata();
2705
- if (!timeMetadata.times)
2706
- timeMetadata.times = createClone()(initialMetadata$3.times);
2640
+ if (!timeMetadata.times) timeMetadata.times = createClone()(initialMetadata$3.times);
2707
2641
  timeMetadata.times.start = Math.round(event.timeStamp);
2708
2642
  timeMetadata.times.end = Math.round(event.timeStamp);
2709
2643
  const frameEffect = (timestamp) => {
@@ -2711,18 +2645,15 @@ function storeKeyboardTimeMetadata({
2711
2645
  timeMetadata.duration = Math.max(0, timeMetadata.times.end - timeMetadata.times.start);
2712
2646
  if (recognize) {
2713
2647
  recognize(event, api);
2714
- if (getStatus() === "recognized")
2715
- effect(event);
2648
+ if (getStatus() === "recognized") effect(event);
2716
2649
  }
2717
2650
  }, storeDuration = () => {
2718
2651
  const sequence = api.getSequence();
2719
2652
  if (!document.body.contains(
2720
2653
  at(-1)(sequence).target
2721
- ))
2722
- return;
2654
+ )) return;
2723
2655
  const request = requestAnimationFrame((timestamp) => {
2724
- if (!getShouldStore())
2725
- return;
2656
+ if (!getShouldStore()) return;
2726
2657
  frameEffect(timestamp);
2727
2658
  storeDuration();
2728
2659
  });
@@ -2741,8 +2672,7 @@ const initialMetadata$2 = {
2741
2672
  function storePointerStartMetadata({ event, api }) {
2742
2673
  const { getMetadata } = api, metadata = getMetadata();
2743
2674
  const point = event instanceof MouseEvent || event instanceof PointerEvent ? toPointerPoint(event) : toTouchMovePoint(event);
2744
- if (!metadata.points)
2745
- metadata.points = createClone()(initialMetadata$2.points);
2675
+ if (!metadata.points) metadata.points = createClone()(initialMetadata$2.points);
2746
2676
  metadata.points.start = point;
2747
2677
  metadata.points.end = point;
2748
2678
  }
@@ -2848,17 +2778,14 @@ function storePointerTimeMetadata({
2848
2778
  metadata.velocity = metadata.distance.straight.fromPrevious / durationFromPrevious || 0;
2849
2779
  const event2 = getSequence().at(-1);
2850
2780
  recognize?.(event2, api);
2851
- if (getStatus() === "recognized")
2852
- effect(event2);
2781
+ if (getStatus() === "recognized") effect(event2);
2853
2782
  }, storeDuration = () => {
2854
2783
  const sequence = api.getSequence();
2855
2784
  if (!document.contains(
2856
2785
  at(-1)(sequence).target
2857
- ))
2858
- return;
2786
+ )) return;
2859
2787
  const request = requestAnimationFrame((timestamp) => {
2860
- if (!getShouldStore())
2861
- return;
2788
+ if (!getShouldStore()) return;
2862
2789
  frameEffect(timestamp);
2863
2790
  storeDuration();
2864
2791
  });
@@ -2998,6 +2925,12 @@ function toInterpolated({ previous, next, progress }, options = {}) {
2998
2925
  }
2999
2926
  }
3000
2927
 
2928
+ var __defProp$g = Object.defineProperty;
2929
+ var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2930
+ var __publicField$g = (obj, key, value) => __defNormalProp$g(obj, typeof key !== "symbol" ? key + "" : key, value);
2931
+ function defineAnimateableKeyframes(keyframes) {
2932
+ return keyframes;
2933
+ }
3001
2934
  const defaultOptions$8 = {
3002
2935
  duration: 0,
3003
2936
  // delay not supported, because it can be effectd by delayable
@@ -3020,22 +2953,37 @@ const defaultAnimateOptions = {
3020
2953
  }
3021
2954
  };
3022
2955
  class Animateable {
3023
- initialDuration;
3024
- iterationLimit;
3025
- alternates;
3026
- controlPoints;
3027
- reversedControlPoints;
3028
- toAnimationProgress;
3029
- reversedToAnimationProgress;
3030
- playCache;
3031
- reverseCache;
3032
- pauseCache;
3033
- seekCache;
3034
- alternateCache;
3035
- visibilitychange;
3036
- getEaseables;
3037
- getReversedEaseables;
3038
2956
  constructor(keyframes, options = {}) {
2957
+ __publicField$g(this, "initialDuration");
2958
+ __publicField$g(this, "iterationLimit");
2959
+ __publicField$g(this, "alternates");
2960
+ __publicField$g(this, "controlPoints");
2961
+ __publicField$g(this, "reversedControlPoints");
2962
+ __publicField$g(this, "toAnimationProgress");
2963
+ __publicField$g(this, "reversedToAnimationProgress");
2964
+ __publicField$g(this, "playCache");
2965
+ __publicField$g(this, "reverseCache");
2966
+ __publicField$g(this, "pauseCache");
2967
+ __publicField$g(this, "seekCache");
2968
+ __publicField$g(this, "alternateCache");
2969
+ __publicField$g(this, "visibilitychange");
2970
+ __publicField$g(this, "getEaseables");
2971
+ __publicField$g(this, "getReversedEaseables");
2972
+ __publicField$g(this, "computedStatus");
2973
+ __publicField$g(this, "computedTime");
2974
+ __publicField$g(this, "computedProgress");
2975
+ __publicField$g(this, "computedIterations");
2976
+ __publicField$g(this, "computedKeyframes");
2977
+ __publicField$g(this, "reversedKeyframes");
2978
+ __publicField$g(this, "properties");
2979
+ __publicField$g(this, "easeables");
2980
+ __publicField$g(this, "reversedEaseables");
2981
+ __publicField$g(this, "computedPlaybackRate");
2982
+ __publicField$g(this, "duration");
2983
+ __publicField$g(this, "totalTimeInvisible");
2984
+ __publicField$g(this, "invisibleAt");
2985
+ __publicField$g(this, "computedRequest");
2986
+ __publicField$g(this, "startTime");
3039
2987
  this.initialDuration = options?.duration || defaultOptions$8.duration;
3040
2988
  this.controlPoints = fromTimingToControlPoints(options?.timing || defaultOptions$8.timing);
3041
2989
  this.iterationLimit = options?.iterations || defaultOptions$8.iterations;
@@ -3058,25 +3006,21 @@ class Animateable {
3058
3006
  this.resetProgress();
3059
3007
  this.resetIterations();
3060
3008
  }
3061
- computedStatus;
3062
3009
  ready() {
3063
3010
  this.computedStatus = "ready";
3064
3011
  }
3065
- computedTime;
3066
3012
  resetTime() {
3067
3013
  this.computedTime = {
3068
3014
  elapsed: 0,
3069
3015
  remaining: this.duration
3070
3016
  };
3071
3017
  }
3072
- computedProgress;
3073
3018
  resetProgress() {
3074
3019
  this.computedProgress = {
3075
3020
  time: 0,
3076
3021
  animation: 0
3077
3022
  };
3078
3023
  }
3079
- computedIterations;
3080
3024
  resetIterations() {
3081
3025
  this.computedIterations = 0;
3082
3026
  }
@@ -3107,11 +3051,6 @@ class Animateable {
3107
3051
  get progress() {
3108
3052
  return this.computedProgress;
3109
3053
  }
3110
- computedKeyframes;
3111
- reversedKeyframes;
3112
- properties;
3113
- easeables;
3114
- reversedEaseables;
3115
3054
  setKeyframes(keyframes) {
3116
3055
  this.stop();
3117
3056
  this.computedKeyframes = Array.from(keyframes).sort(({ progress: progressA }, { progress: progressB }) => progressA - progressB);
@@ -3125,9 +3064,6 @@ class Animateable {
3125
3064
  this.reversedEaseables = this.getReversedEaseables({ keyframes: this.reversedKeyframes, properties: this.properties });
3126
3065
  return this;
3127
3066
  }
3128
- computedPlaybackRate;
3129
- duration;
3130
- totalTimeInvisible;
3131
3067
  setPlaybackRate(playbackRate) {
3132
3068
  const narrowedPlaybackRate = Math.max(0, playbackRate);
3133
3069
  this.computedPlaybackRate = narrowedPlaybackRate;
@@ -3273,7 +3209,6 @@ class Animateable {
3273
3209
  reversed() {
3274
3210
  this.computedStatus = "reversed";
3275
3211
  }
3276
- invisibleAt;
3277
3212
  listenForVisibilitychange() {
3278
3213
  if (this.visibilitychange.active.size === 0) {
3279
3214
  this.totalTimeInvisible = 0;
@@ -3289,7 +3224,6 @@ class Animateable {
3289
3224
  });
3290
3225
  }
3291
3226
  }
3292
- computedRequest;
3293
3227
  createAnimate(type) {
3294
3228
  return (effect, options = {}) => {
3295
3229
  const { interpolate: interpolateOptions } = createDeepMerge(options)(defaultAnimateOptions);
@@ -3310,7 +3244,6 @@ class Animateable {
3310
3244
  return this;
3311
3245
  };
3312
3246
  }
3313
- startTime;
3314
3247
  setStartTimeAndStatus(type, timestamp) {
3315
3248
  switch (type) {
3316
3249
  case "play":
@@ -3901,17 +3834,23 @@ const easingsNetInOutBack = [
3901
3834
  1.6
3902
3835
  ];
3903
3836
 
3837
+ var __defProp$f = Object.defineProperty;
3838
+ var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3839
+ var __publicField$f = (obj, key, value) => __defNormalProp$f(obj, typeof key !== "symbol" ? key + "" : key, value);
3904
3840
  const defaultOptions$7 = {
3905
3841
  name: "baleada"
3906
3842
  };
3907
3843
  class Broadcastable {
3908
- name;
3909
3844
  constructor(state, options = {}) {
3845
+ __publicField$f(this, "name");
3846
+ __publicField$f(this, "computedStatus");
3847
+ __publicField$f(this, "computedChannel");
3848
+ __publicField$f(this, "computedError");
3849
+ __publicField$f(this, "computedState");
3910
3850
  this.setState(state);
3911
3851
  this.name = options.name ?? defaultOptions$7.name;
3912
3852
  this.ready();
3913
3853
  }
3914
- computedStatus;
3915
3854
  ready() {
3916
3855
  this.computedStatus = "ready";
3917
3856
  }
@@ -3924,15 +3863,12 @@ class Broadcastable {
3924
3863
  get status() {
3925
3864
  return this.computedStatus;
3926
3865
  }
3927
- computedChannel;
3928
3866
  get channel() {
3929
3867
  return this.computedChannel || (this.computedChannel = new BroadcastChannel(this.name));
3930
3868
  }
3931
- computedError;
3932
3869
  get error() {
3933
3870
  return this.computedError;
3934
3871
  }
3935
- computedState;
3936
3872
  setState(state) {
3937
3873
  this.computedState = state;
3938
3874
  return this;
@@ -3973,12 +3909,19 @@ function toMessageListenParams(instance, effect) {
3973
3909
  ];
3974
3910
  }
3975
3911
 
3912
+ var __defProp$e = Object.defineProperty;
3913
+ var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3914
+ var __publicField$e = (obj, key, value) => __defNormalProp$e(obj, typeof key !== "symbol" ? key + "" : key, value);
3976
3915
  const defaultOptions$6 = {
3977
3916
  locales: "en",
3978
3917
  collator: { sensitivity: "base" }
3979
3918
  };
3980
3919
  class Compareable {
3981
3920
  constructor(string, options = {}) {
3921
+ __publicField$e(this, "computedStatus");
3922
+ __publicField$e(this, "computedCollator");
3923
+ __publicField$e(this, "computedComparison");
3924
+ __publicField$e(this, "computedString");
3982
3925
  const locales = options.locales || defaultOptions$6.locales, collatorOptions = { ...defaultOptions$6.collator, ...options.collator }, key = locales + pipe(
3983
3926
  createEntries(),
3984
3927
  sort((a, b) => a[0] < b[0] ? -1 : 1),
@@ -3988,7 +3931,6 @@ class Compareable {
3988
3931
  this.setString(string);
3989
3932
  this.ready();
3990
3933
  }
3991
- computedStatus;
3992
3934
  ready() {
3993
3935
  this.computedStatus = "ready";
3994
3936
  }
@@ -4001,15 +3943,12 @@ class Compareable {
4001
3943
  get status() {
4002
3944
  return this.computedStatus;
4003
3945
  }
4004
- computedCollator;
4005
3946
  get collator() {
4006
3947
  return this.computedCollator;
4007
3948
  }
4008
- computedComparison;
4009
3949
  get comparison() {
4010
3950
  return this.computedComparison;
4011
3951
  }
4012
- computedString;
4013
3952
  setString(string) {
4014
3953
  this.computedString = string;
4015
3954
  return this;
@@ -4029,6 +3968,9 @@ class Compareable {
4029
3968
  }
4030
3969
  const cache = {};
4031
3970
 
3971
+ var __defProp$d = Object.defineProperty;
3972
+ var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3973
+ var __publicField$d = (obj, key, value) => __defNormalProp$d(obj, typeof key !== "symbol" ? key + "" : key, value);
4032
3974
  const defaultOptions$5 = {
4033
3975
  segment: {
4034
3976
  from: "start",
@@ -4041,11 +3983,14 @@ const defaultCompleteOptions = {
4041
3983
  select: "completionEnd"
4042
3984
  };
4043
3985
  class Completeable {
4044
- segmentFrom;
4045
- segmentTo;
4046
- divider;
4047
- computedDividerIndices;
4048
3986
  constructor(string, options = {}) {
3987
+ __publicField$d(this, "segmentFrom");
3988
+ __publicField$d(this, "segmentTo");
3989
+ __publicField$d(this, "divider");
3990
+ __publicField$d(this, "computedDividerIndices");
3991
+ __publicField$d(this, "computedStatus");
3992
+ __publicField$d(this, "computedString");
3993
+ __publicField$d(this, "computedSelection");
4049
3994
  this.constructing();
4050
3995
  this.segmentFrom = options?.segment?.from || defaultOptions$5.segment.from;
4051
3996
  this.segmentTo = options?.segment?.to || defaultOptions$5.segment.to;
@@ -4058,7 +4003,6 @@ class Completeable {
4058
4003
  constructing() {
4059
4004
  this.computedStatus = "constructing";
4060
4005
  }
4061
- computedStatus;
4062
4006
  ready() {
4063
4007
  this.computedStatus = "ready";
4064
4008
  }
@@ -4092,6 +4036,7 @@ class Completeable {
4092
4036
  return 0;
4093
4037
  case "selection":
4094
4038
  return this.selection.start;
4039
+ // No arithmetic needed, because the first character of the selection should be included
4095
4040
  case "divider":
4096
4041
  return this.dividerIndices.before + 1;
4097
4042
  }
@@ -4102,11 +4047,11 @@ class Completeable {
4102
4047
  return this.string.length;
4103
4048
  case "selection":
4104
4049
  return this.selection.end;
4050
+ // No arithmetic needed, because the browser sets selection end as the first character not highlighted in the selection
4105
4051
  case "divider":
4106
4052
  return this.dividerIndices.after;
4107
4053
  }
4108
4054
  }
4109
- computedString;
4110
4055
  setString(string) {
4111
4056
  this.computedString = string;
4112
4057
  switch (this.status) {
@@ -4118,7 +4063,6 @@ class Completeable {
4118
4063
  }
4119
4064
  return this;
4120
4065
  }
4121
- computedSelection;
4122
4066
  setSelection(selection) {
4123
4067
  this.computedSelection = selection;
4124
4068
  this.setDividerIndices();
@@ -4209,12 +4153,19 @@ function toNextMatch({ string, re, from }) {
4209
4153
  return indexOf;
4210
4154
  }
4211
4155
 
4156
+ var __defProp$c = Object.defineProperty;
4157
+ var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4158
+ var __publicField$c = (obj, key, value) => __defNormalProp$c(obj, typeof key !== "symbol" ? key + "" : key, value);
4212
4159
  class Copyable {
4213
- computedIsClipboardText;
4214
- copyListenable;
4215
- cutListenable;
4216
- copyAndCutEffect;
4217
4160
  constructor(string, options = {}) {
4161
+ __publicField$c(this, "computedIsClipboardText");
4162
+ __publicField$c(this, "copyListenable");
4163
+ __publicField$c(this, "cutListenable");
4164
+ __publicField$c(this, "copyAndCutEffect");
4165
+ __publicField$c(this, "computedStatus");
4166
+ __publicField$c(this, "computedString");
4167
+ __publicField$c(this, "computedResponse");
4168
+ __publicField$c(this, "computedError");
4218
4169
  this.computedIsClipboardText = false;
4219
4170
  this.copyListenable = new Listenable("copy");
4220
4171
  this.cutListenable = new Listenable("cut");
@@ -4225,7 +4176,6 @@ class Copyable {
4225
4176
  this.setString(string);
4226
4177
  this.ready();
4227
4178
  }
4228
- computedStatus;
4229
4179
  ready() {
4230
4180
  this.computedStatus = "ready";
4231
4181
  }
@@ -4247,13 +4197,10 @@ class Copyable {
4247
4197
  get error() {
4248
4198
  return this.computedError;
4249
4199
  }
4250
- computedString;
4251
4200
  setString(string) {
4252
4201
  this.computedString = string;
4253
4202
  return this;
4254
4203
  }
4255
- computedResponse;
4256
- computedError;
4257
4204
  async copy(options = { kind: "clipboard" }) {
4258
4205
  this.copying();
4259
4206
  const { kind } = options;
@@ -4301,13 +4248,19 @@ class Copyable {
4301
4248
  }
4302
4249
  }
4303
4250
 
4251
+ var __defProp$b = Object.defineProperty;
4252
+ var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4253
+ var __publicField$b = (obj, key, value) => __defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
4304
4254
  const defaultOptions$4 = {
4305
4255
  delay: 0,
4306
4256
  executions: 1
4307
4257
  };
4308
4258
  class Delayable {
4309
- animateable;
4310
4259
  constructor(effect, options = {}) {
4260
+ __publicField$b(this, "animateable");
4261
+ __publicField$b(this, "computedStatus");
4262
+ __publicField$b(this, "computedEffect");
4263
+ __publicField$b(this, "frameEffect");
4311
4264
  this.animateable = new Animateable(
4312
4265
  [
4313
4266
  { progress: 0, properties: { progress: 0 } },
@@ -4321,7 +4274,6 @@ class Delayable {
4321
4274
  this.setEffect(effect);
4322
4275
  this.ready();
4323
4276
  }
4324
- computedStatus;
4325
4277
  ready() {
4326
4278
  this.computedStatus = "ready";
4327
4279
  }
@@ -4343,14 +4295,12 @@ class Delayable {
4343
4295
  get progress() {
4344
4296
  return this.animateable.progress.time;
4345
4297
  }
4346
- computedEffect;
4347
4298
  setEffect(effect) {
4348
4299
  this.stop();
4349
4300
  this.computedEffect = effect;
4350
4301
  this.setFrameEffect(effect);
4351
4302
  return this;
4352
4303
  }
4353
- frameEffect;
4354
4304
  setFrameEffect(effect) {
4355
4305
  this.frameEffect = (frame) => {
4356
4306
  const { properties: { progress }, timestamp } = frame;
@@ -4448,18 +4398,22 @@ class Delayable {
4448
4398
  }
4449
4399
  }
4450
4400
 
4401
+ var __defProp$a = Object.defineProperty;
4402
+ var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4403
+ var __publicField$a = (obj, key, value) => __defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
4451
4404
  const defaultOptions$3 = {
4452
4405
  toD: (stroke) => stroke.length === 0 ? "" : toD(stroke)
4453
4406
  };
4454
4407
  class Drawable {
4455
- computedD;
4456
- toD;
4457
4408
  constructor(stroke, options = {}) {
4409
+ __publicField$a(this, "computedD");
4410
+ __publicField$a(this, "toD");
4411
+ __publicField$a(this, "computedStatus");
4412
+ __publicField$a(this, "computedStroke");
4458
4413
  this.toD = options?.toD || defaultOptions$3.toD;
4459
4414
  this.setStroke(stroke);
4460
4415
  this.ready();
4461
4416
  }
4462
- computedStatus;
4463
4417
  ready() {
4464
4418
  this.computedStatus = "ready";
4465
4419
  }
@@ -4475,7 +4429,6 @@ class Drawable {
4475
4429
  get d() {
4476
4430
  return this.computedD;
4477
4431
  }
4478
- computedStroke;
4479
4432
  setStroke(stroke) {
4480
4433
  this.computedStroke = stroke;
4481
4434
  this.computedD = this.toD(stroke);
@@ -4495,8 +4448,7 @@ class Drawable {
4495
4448
  }
4496
4449
  }
4497
4450
  function toD(stroke) {
4498
- if (stroke.length < 4)
4499
- return "";
4451
+ if (stroke.length < 4) return "";
4500
4452
  let a = stroke[0];
4501
4453
  let b = stroke[1];
4502
4454
  const c = stroke[2];
@@ -4509,8 +4461,7 @@ function toD(stroke) {
4509
4461
  return `${result}Z`;
4510
4462
  }
4511
4463
  function toFlattenedD(stroke) {
4512
- if (stroke.length === 0)
4513
- return "";
4464
+ if (stroke.length === 0) return "";
4514
4465
  const faces = polygonClipping.union([stroke]);
4515
4466
  const flattenedD = [];
4516
4467
  for (const face of faces) {
@@ -4522,12 +4473,18 @@ function toFlattenedD(stroke) {
4522
4473
  }
4523
4474
  const toSpaceSeparated = join(" ");
4524
4475
 
4476
+ var __defProp$9 = Object.defineProperty;
4477
+ var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4478
+ var __publicField$9 = (obj, key, value) => __defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
4525
4479
  class Resolveable {
4526
4480
  constructor(getPromise, options = {}) {
4481
+ __publicField$9(this, "computedStatus");
4482
+ __publicField$9(this, "computedGetPromise");
4483
+ __publicField$9(this, "computedValue");
4484
+ __publicField$9(this, "computedError");
4527
4485
  this.setGetPromise(getPromise);
4528
4486
  this.ready();
4529
4487
  }
4530
- computedStatus;
4531
4488
  ready() {
4532
4489
  this.computedStatus = "ready";
4533
4490
  }
@@ -4546,13 +4503,10 @@ class Resolveable {
4546
4503
  get error() {
4547
4504
  return this.computedError;
4548
4505
  }
4549
- computedGetPromise;
4550
4506
  setGetPromise(getPromise) {
4551
4507
  this.computedGetPromise = getPromise;
4552
4508
  return this;
4553
4509
  }
4554
- computedValue;
4555
- computedError;
4556
4510
  async resolve() {
4557
4511
  this.resolving();
4558
4512
  try {
@@ -4575,13 +4529,23 @@ class Resolveable {
4575
4529
  }
4576
4530
  }
4577
4531
 
4532
+ var __defProp$8 = Object.defineProperty;
4533
+ var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4534
+ var __publicField$8 = (obj, key, value) => __defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
4578
4535
  class Fetchable {
4579
- computedArrayBuffer;
4580
- computedBlob;
4581
- computedFormData;
4582
- computedJson;
4583
- computedText;
4584
4536
  constructor(resource, options = {}) {
4537
+ __publicField$8(this, "computedArrayBuffer");
4538
+ __publicField$8(this, "computedBlob");
4539
+ __publicField$8(this, "computedFormData");
4540
+ __publicField$8(this, "computedJson");
4541
+ __publicField$8(this, "computedText");
4542
+ __publicField$8(this, "computedStatus");
4543
+ __publicField$8(this, "computedKy");
4544
+ __publicField$8(this, "computedAbortController");
4545
+ __publicField$8(this, "computedRetryCount", 0);
4546
+ __publicField$8(this, "computedResource");
4547
+ __publicField$8(this, "computedResponse");
4548
+ __publicField$8(this, "computedError");
4585
4549
  this.setResource(resource);
4586
4550
  this.computedKy = ky.create(narrowOptions(options.ky));
4587
4551
  this.computedArrayBuffer = new Resolveable(async () => "arrayBuffer" in this.response ? await this.response.arrayBuffer() : void 0);
@@ -4591,7 +4555,6 @@ class Fetchable {
4591
4555
  this.computedText = new Resolveable(async () => "text" in this.response ? await this.response.text() : void 0);
4592
4556
  this.ready();
4593
4557
  }
4594
- computedStatus;
4595
4558
  ready() {
4596
4559
  this.computedStatus = "ready";
4597
4560
  }
@@ -4604,17 +4567,13 @@ class Fetchable {
4604
4567
  get status() {
4605
4568
  return this.computedStatus;
4606
4569
  }
4607
- computedKy;
4608
4570
  get ky() {
4609
4571
  return this.computedKy;
4610
4572
  }
4611
- computedAbortController;
4612
4573
  get abortController() {
4613
- if (!this.computedAbortController)
4614
- this.computedAbortController = new AbortController();
4574
+ if (!this.computedAbortController) this.computedAbortController = new AbortController();
4615
4575
  return this.computedAbortController;
4616
4576
  }
4617
- computedRetryCount = 0;
4618
4577
  get retryCount() {
4619
4578
  return this.computedRetryCount;
4620
4579
  }
@@ -4639,13 +4598,10 @@ class Fetchable {
4639
4598
  get text() {
4640
4599
  return this.computedText;
4641
4600
  }
4642
- computedResource;
4643
4601
  setResource(resource) {
4644
4602
  this.computedResource = resource;
4645
4603
  return this;
4646
4604
  }
4647
- computedResponse;
4648
- computedError;
4649
4605
  async fetch(options = {}) {
4650
4606
  this.fetching();
4651
4607
  try {
@@ -4669,10 +4625,8 @@ class Fetchable {
4669
4625
  this.fetched();
4670
4626
  } catch (error) {
4671
4627
  this.computedError = error;
4672
- if (error.name === "AbortError")
4673
- this.aborted();
4674
- else
4675
- this.errored();
4628
+ if (error.name === "AbortError") this.aborted();
4629
+ else this.errored();
4676
4630
  }
4677
4631
  return this;
4678
4632
  }
@@ -4721,17 +4675,21 @@ class Fetchable {
4721
4675
  }
4722
4676
  }
4723
4677
  function narrowOptions(options) {
4724
- if (!options)
4725
- return {};
4678
+ if (!options) return {};
4726
4679
  return predicateFunction(options) ? options({ stop: ky.stop }) : options;
4727
4680
  }
4728
4681
 
4682
+ var __defProp$7 = Object.defineProperty;
4683
+ var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4684
+ var __publicField$7 = (obj, key, value) => __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
4729
4685
  class Fullscreenable {
4730
4686
  constructor(getElement, options = {}) {
4687
+ __publicField$7(this, "computedStatus");
4688
+ __publicField$7(this, "computedGetElement");
4689
+ __publicField$7(this, "computedError");
4731
4690
  this.setGetElement(getElement);
4732
4691
  this.ready();
4733
4692
  }
4734
- computedStatus;
4735
4693
  ready() {
4736
4694
  this.computedStatus = "ready";
4737
4695
  }
@@ -4750,7 +4708,6 @@ class Fullscreenable {
4750
4708
  get error() {
4751
4709
  return this.computedError;
4752
4710
  }
4753
- computedGetElement;
4754
4711
  setGetElement(getElement) {
4755
4712
  this.computedGetElement = () => getElement();
4756
4713
  return this;
@@ -4759,7 +4716,6 @@ class Fullscreenable {
4759
4716
  await this.fullscreen(options);
4760
4717
  return this;
4761
4718
  }
4762
- computedError;
4763
4719
  async fullscreen(options = {}) {
4764
4720
  try {
4765
4721
  await this.element.requestFullscreen(options);
@@ -4791,12 +4747,18 @@ class Fullscreenable {
4791
4747
  }
4792
4748
  }
4793
4749
 
4750
+ var __defProp$6 = Object.defineProperty;
4751
+ var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4752
+ var __publicField$6 = (obj, key, value) => __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
4794
4753
  class Grantable {
4795
4754
  constructor(descriptor, options = {}) {
4755
+ __publicField$6(this, "computedStatus");
4756
+ __publicField$6(this, "computedDescriptor");
4757
+ __publicField$6(this, "computedPermission");
4758
+ __publicField$6(this, "computedError");
4796
4759
  this.setDescriptor(descriptor);
4797
4760
  this.ready();
4798
4761
  }
4799
- computedStatus;
4800
4762
  ready() {
4801
4763
  this.computedStatus = "ready";
4802
4764
  }
@@ -4815,13 +4777,10 @@ class Grantable {
4815
4777
  get status() {
4816
4778
  return this.computedStatus;
4817
4779
  }
4818
- computedDescriptor;
4819
4780
  setDescriptor(descriptor) {
4820
4781
  this.computedDescriptor = descriptor;
4821
4782
  return this;
4822
4783
  }
4823
- computedPermission;
4824
- computedError;
4825
4784
  async grant() {
4826
4785
  this.granting();
4827
4786
  try {
@@ -4844,6 +4803,9 @@ class Grantable {
4844
4803
  }
4845
4804
  }
4846
4805
 
4806
+ var __defProp$5 = Object.defineProperty;
4807
+ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4808
+ var __publicField$5 = (obj, key, value) => __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
4847
4809
  const defaultOptions$2 = {
4848
4810
  initialLocation: 0
4849
4811
  };
@@ -4854,22 +4816,22 @@ const defaultNextAndPreviousOptions = {
4854
4816
  };
4855
4817
  class Navigateable {
4856
4818
  constructor(array, options = {}) {
4819
+ __publicField$5(this, "computedStatus");
4820
+ __publicField$5(this, "computedArray");
4821
+ __publicField$5(this, "computedLocation");
4857
4822
  this.setArray(array);
4858
4823
  this.navigate(options?.initialLocation ?? defaultOptions$2.initialLocation);
4859
4824
  this.ready();
4860
4825
  }
4861
- computedStatus;
4862
4826
  ready() {
4863
4827
  this.computedStatus = "ready";
4864
4828
  }
4865
- computedArray;
4866
4829
  get array() {
4867
4830
  return this.computedArray;
4868
4831
  }
4869
4832
  set array(value) {
4870
4833
  this.setArray(value);
4871
4834
  }
4872
- computedLocation;
4873
4835
  get location() {
4874
4836
  return this.computedLocation;
4875
4837
  }
@@ -4988,6 +4950,183 @@ class Navigateable {
4988
4950
  }
4989
4951
  }
4990
4952
 
4953
+ var __defProp$4 = Object.defineProperty;
4954
+ var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4955
+ var __publicField$4 = (obj, key, value) => __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
4956
+ function createDefineObjectStore() {
4957
+ return (transaction, storeName) => {
4958
+ return transaction.objectStore(storeName);
4959
+ };
4960
+ }
4961
+ class Operateable {
4962
+ constructor(objectStore, options = {}) {
4963
+ __publicField$4(this, "listenables", []);
4964
+ __publicField$4(this, "computedObjectStore");
4965
+ __publicField$4(this, "computedStatus");
4966
+ __publicField$4(this, "computedError");
4967
+ this.computedObjectStore = objectStore;
4968
+ this.ready();
4969
+ }
4970
+ ready() {
4971
+ this.computedStatus = "ready";
4972
+ }
4973
+ get objectStore() {
4974
+ return this.computedObjectStore;
4975
+ }
4976
+ set objectStore(objectStore) {
4977
+ this.setObjectStore(objectStore);
4978
+ }
4979
+ get status() {
4980
+ return this.computedStatus;
4981
+ }
4982
+ get error() {
4983
+ return this.computedError;
4984
+ }
4985
+ setObjectStore(objectStore) {
4986
+ this.stop();
4987
+ this.computedObjectStore = objectStore;
4988
+ return this;
4989
+ }
4990
+ operate(descriptors) {
4991
+ if (!descriptors.length) {
4992
+ this.operated();
4993
+ return this;
4994
+ }
4995
+ this.operating();
4996
+ const [present, ...future] = descriptors, { operation } = present, request = (() => {
4997
+ switch (operation) {
4998
+ case "add": {
4999
+ const { value, key } = present;
5000
+ return this.objectStore.add(value, key);
5001
+ }
5002
+ case "put": {
5003
+ const { value, key } = present;
5004
+ return this.objectStore.put(value, key);
5005
+ }
5006
+ case "get": {
5007
+ const { query } = present;
5008
+ return this.objectStore.get(query);
5009
+ }
5010
+ case "getKey": {
5011
+ const { query } = present;
5012
+ return this.objectStore.getKey(query);
5013
+ }
5014
+ case "getAll": {
5015
+ const { query, count } = present;
5016
+ return this.objectStore.getAll(query, count);
5017
+ }
5018
+ case "getAllKeys": {
5019
+ const { query, count } = present;
5020
+ return this.objectStore.getAllKeys(query, count);
5021
+ }
5022
+ case "getAllRecords": {
5023
+ const { query, count } = present;
5024
+ return this.objectStore.getAllRecords(query, count);
5025
+ }
5026
+ case "delete": {
5027
+ const { query } = present;
5028
+ return this.objectStore.delete(query);
5029
+ }
5030
+ case "clear":
5031
+ return this.objectStore.clear();
5032
+ case "count": {
5033
+ const { query } = present;
5034
+ return this.objectStore.count(query);
5035
+ }
5036
+ case "openCursor": {
5037
+ const { query, direction } = present;
5038
+ return this.objectStore.openCursor(query, direction);
5039
+ }
5040
+ case "openKeyCursor": {
5041
+ const { query, direction } = present;
5042
+ return this.objectStore.openKeyCursor(query, direction);
5043
+ }
5044
+ }
5045
+ })(), listenables = [
5046
+ new Listenable("success").listen(
5047
+ () => {
5048
+ if (!operation.includes("Cursor") || !request.result) stopListenables();
5049
+ if ("effect" in present) present.effect?.(request.result);
5050
+ if (!future.length) {
5051
+ this.operated();
5052
+ return;
5053
+ }
5054
+ this.operate(future);
5055
+ },
5056
+ { target: request }
5057
+ ),
5058
+ new Listenable("error").listen(
5059
+ () => {
5060
+ stopListenables();
5061
+ this.computedError = request.error;
5062
+ this.errored();
5063
+ },
5064
+ { target: request }
5065
+ )
5066
+ ], stopListenables = () => this.stopListenables(listenables);
5067
+ this.listenables.push(...listenables);
5068
+ return this;
5069
+ }
5070
+ operating() {
5071
+ this.computedStatus = "operating";
5072
+ }
5073
+ operated() {
5074
+ this.computedStatus = "operated";
5075
+ }
5076
+ errored() {
5077
+ this.computedStatus = "errored";
5078
+ }
5079
+ add(descriptor) {
5080
+ return this.operate([{ ...descriptor, operation: "add" }]);
5081
+ }
5082
+ put(descriptor) {
5083
+ return this.operate([{ ...descriptor, operation: "put" }]);
5084
+ }
5085
+ get(descriptor) {
5086
+ return this.operate([{ ...descriptor, operation: "get" }]);
5087
+ }
5088
+ getKey(descriptor) {
5089
+ return this.operate([{ ...descriptor, operation: "getKey" }]);
5090
+ }
5091
+ getAll(descriptor) {
5092
+ return this.operate([{ ...descriptor, operation: "getAll" }]);
5093
+ }
5094
+ getAllKeys(descriptor) {
5095
+ return this.operate([{ ...descriptor, operation: "getAllKeys" }]);
5096
+ }
5097
+ getAllRecords(descriptor) {
5098
+ return this.operate([{ ...descriptor, operation: "getAllRecords" }]);
5099
+ }
5100
+ delete(descriptor) {
5101
+ return this.operate([{ ...descriptor, operation: "delete" }]);
5102
+ }
5103
+ clear(descriptor) {
5104
+ return this.operate([{ ...descriptor, operation: "clear" }]);
5105
+ }
5106
+ count(descriptor) {
5107
+ return this.operate([{ ...descriptor, operation: "count" }]);
5108
+ }
5109
+ openCursor(descriptor) {
5110
+ return this.operate([{ ...descriptor, operation: "openCursor" }]);
5111
+ }
5112
+ openKeyCursor(descriptor) {
5113
+ return this.operate([{ ...descriptor, operation: "openKeyCursor" }]);
5114
+ }
5115
+ stop() {
5116
+ this.stopListenables(this.listenables);
5117
+ return this;
5118
+ }
5119
+ stopListenables(listenables) {
5120
+ for (const listenable of listenables) listenable.stop();
5121
+ this.listenables = createFilter(
5122
+ (l) => !includes(l)(listenables)
5123
+ )(this.listenables);
5124
+ }
5125
+ }
5126
+
5127
+ var __defProp$3 = Object.defineProperty;
5128
+ var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5129
+ var __publicField$3 = (obj, key, value) => __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
4991
5130
  const defaultOptions$1 = {
4992
5131
  initialPicks: []
4993
5132
  };
@@ -4997,33 +5136,36 @@ const defaultPickOptions = {
4997
5136
  };
4998
5137
  class Pickable {
4999
5138
  constructor(array, options = {}) {
5139
+ __publicField$3(this, "computedStatus");
5140
+ __publicField$3(this, "computedArray");
5141
+ __publicField$3(this, "computedPicks");
5142
+ __publicField$3(this, "computedFirst");
5143
+ __publicField$3(this, "computedLast");
5144
+ __publicField$3(this, "toItems", createMap((index) => this.array[index]));
5145
+ __publicField$3(this, "computedMultiple");
5146
+ __publicField$3(this, "toPossiblePicks");
5000
5147
  this.setArray(array);
5001
5148
  this.pick(options.initialPicks ?? defaultOptions$1.initialPicks);
5002
5149
  this.ready();
5003
5150
  }
5004
- computedStatus;
5005
5151
  ready() {
5006
5152
  this.computedStatus = "ready";
5007
5153
  }
5008
- computedArray;
5009
5154
  get array() {
5010
5155
  return this.computedArray;
5011
5156
  }
5012
5157
  set array(array) {
5013
5158
  this.setArray(array);
5014
5159
  }
5015
- computedPicks;
5016
5160
  get picks() {
5017
5161
  return this.computedPicks;
5018
5162
  }
5019
5163
  set picks(indices) {
5020
5164
  this.pick(indices);
5021
5165
  }
5022
- computedFirst;
5023
5166
  get first() {
5024
5167
  return this.computedFirst;
5025
5168
  }
5026
- computedLast;
5027
5169
  get last() {
5028
5170
  return this.computedLast;
5029
5171
  }
@@ -5036,15 +5178,12 @@ class Pickable {
5036
5178
  get items() {
5037
5179
  return this.toItems(this.picks);
5038
5180
  }
5039
- toItems = createMap((index) => this.array[index]);
5040
- computedMultiple;
5041
5181
  get multiple() {
5042
5182
  return this.computedMultiple;
5043
5183
  }
5044
5184
  get status() {
5045
5185
  return this.computedStatus;
5046
5186
  }
5047
- toPossiblePicks;
5048
5187
  setArray(array) {
5049
5188
  this.computedArray = array;
5050
5189
  this.toPossiblePicks = createFilter((index) => index >= 0 && index < array.length);
@@ -5059,8 +5198,7 @@ class Pickable {
5059
5198
  narrowIndices,
5060
5199
  this.toPossiblePicks,
5061
5200
  (possiblePicks) => {
5062
- if (replace === "all")
5063
- return allowsDuplicates ? possiblePicks : toUnique(possiblePicks);
5201
+ if (replace === "all") return allowsDuplicates ? possiblePicks : toUnique(possiblePicks);
5064
5202
  const maybeWithoutDuplicates = allowsDuplicates ? possiblePicks : createFilter(
5065
5203
  (possiblePick) => typeof find((pick) => pick === possiblePick)(this.picks || []) !== "number"
5066
5204
  )(possiblePicks);
@@ -5137,12 +5275,18 @@ function narrowIndices(indexOrIndices) {
5137
5275
  }
5138
5276
  const toUnique = createUnique();
5139
5277
 
5278
+ var __defProp$2 = Object.defineProperty;
5279
+ var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5280
+ var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
5140
5281
  class Shareable {
5141
5282
  constructor(shareData, options = {}) {
5283
+ __publicField$2(this, "computedStatus");
5284
+ __publicField$2(this, "computedCan");
5285
+ __publicField$2(this, "computedError");
5286
+ __publicField$2(this, "computedState");
5142
5287
  this.setShareData(shareData);
5143
5288
  this.ready();
5144
5289
  }
5145
- computedStatus;
5146
5290
  ready() {
5147
5291
  this.computedStatus = "ready";
5148
5292
  }
@@ -5155,15 +5299,12 @@ class Shareable {
5155
5299
  get status() {
5156
5300
  return this.computedStatus;
5157
5301
  }
5158
- computedCan;
5159
5302
  get can() {
5160
5303
  return this.computedCan;
5161
5304
  }
5162
- computedError;
5163
5305
  get error() {
5164
5306
  return this.computedError;
5165
5307
  }
5166
- computedState;
5167
5308
  setShareData(shareData) {
5168
5309
  this.computedState = shareData;
5169
5310
  this.computedCan = new Resolveable(async () => await navigator.canShare(shareData));
@@ -5191,14 +5332,22 @@ class Shareable {
5191
5332
  }
5192
5333
  }
5193
5334
 
5335
+ var __defProp$1 = Object.defineProperty;
5336
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5337
+ var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
5194
5338
  const defaultOptions = {
5195
5339
  kind: "local",
5196
5340
  statusKeySuffix: " status"
5197
5341
  };
5198
5342
  class Storeable {
5199
- kind;
5200
- statusKeySuffix;
5201
5343
  constructor(key, options = {}) {
5344
+ __publicField$1(this, "kind");
5345
+ __publicField$1(this, "statusKeySuffix");
5346
+ __publicField$1(this, "computedStatus");
5347
+ __publicField$1(this, "computedKey");
5348
+ __publicField$1(this, "computedStatusKey");
5349
+ __publicField$1(this, "computedString");
5350
+ __publicField$1(this, "computedError");
5202
5351
  this.constructing();
5203
5352
  this.kind = options.kind ?? defaultOptions.kind;
5204
5353
  this.statusKeySuffix = options.statusKeySuffix ?? defaultOptions.statusKeySuffix;
@@ -5208,7 +5357,6 @@ class Storeable {
5208
5357
  constructing() {
5209
5358
  this.computedStatus = "constructing";
5210
5359
  }
5211
- computedStatus;
5212
5360
  ready() {
5213
5361
  this.computedStatus = "ready";
5214
5362
  if (getDomAvailability() === "available") {
@@ -5246,8 +5394,6 @@ class Storeable {
5246
5394
  get error() {
5247
5395
  return this.computedError;
5248
5396
  }
5249
- computedKey;
5250
- computedStatusKey;
5251
5397
  setKey(key) {
5252
5398
  let string;
5253
5399
  switch (this.status) {
@@ -5273,8 +5419,6 @@ class Storeable {
5273
5419
  }
5274
5420
  return this;
5275
5421
  }
5276
- computedString;
5277
- computedError;
5278
5422
  store(string) {
5279
5423
  try {
5280
5424
  this.storage.setItem(this.key, string);
@@ -5312,4 +5456,361 @@ class Storeable {
5312
5456
  }
5313
5457
  }
5314
5458
 
5315
- export { Animateable, Broadcastable, Compareable, Completeable, Copyable, Delayable, Drawable, Fetchable, Fullscreenable, Grantable, Keychord, Keypress, Keyrelease, Konami, Listenable, Navigateable, Pickable, Pointerhover, Pointerpress, Recognizeable, Resolveable, Shareable, Storeable, createFormat$2 as createArrayFormat, createClear$2 as createAssociativeArrayClear, createDelete$2 as createAssociativeArrayDelete, createHas$1 as createAssociativeArrayHas, createKeys$1 as createAssociativeArrayKeys, createSet$2 as createAssociativeArraySet, createValue$2 as createAssociativeArrayValue, createValues$1 as createAssociativeArrayValues, createBreadthPathConfig, createChildren, createClamp, createClear$1 as createClear, createClip, createClone, createComputedStyle, createConcat, createFormat$1 as createDateFormat, createAncestor$1 as createDecisionTreeAncestor, createCommonAncestors$1 as createDecisionTreeCommonAncestors, createNodeDepthFirstSteps$1 as createDecisionTreeNodeDepthFirstSteps, createPath$1 as createDecisionTreePath, createDepthFirstSteps$1 as createDecisionTreeSteps, createTree$1 as createDecisionTreeTree, createDeepEqual, createDeepMerge, createDelete$1 as createDelete, createDepthPathConfig, createDetermine, createAncestor$2 as createDirectedAcyclicAncestor, createAncestor as createDirectedAcyclicAsyncAncestor, createCommonAncestors as createDirectedAcyclicAsyncCommonAncestors, createDepthFirstSteps as createDirectedAcyclicAsyncDepthFirstSteps, createLayers as createDirectedAcyclicAsyncLayers, createNodeDepthFirstSteps as createDirectedAcyclicAsyncNodeDepthFirstSteps, createPath as createDirectedAcyclicAsyncPath, createTree as createDirectedAcyclicAsyncTree, createCommonAncestors$2 as createDirectedAcyclicCommonAncestors, createDepthFirstSteps$2 as createDirectedAcyclicDepthFirstSteps, createLayers$1 as createDirectedAcyclicLayers, createNodeDepthFirstSteps$2 as createDirectedAcyclicNodeDepthFirstSteps, createPath$2 as createDirectedAcyclicPath, createRoots as createDirectedAcyclicRoots, createTree$2 as createDirectedAcyclicTree, createEntries, createEqual, createEvery, createFilter, createFilterAsync, createFindAsync, createFindIndexAsync, createFocusable, createForEachAsync, createGraph, createGreater, createGreaterOrEqual, createHas, createIncoming, createIndegree, createInsert, createKeychord, createKeycomboMatch$1 as createKeycomboMatch, createKeypress, createKeyrelease, createKeys, createKonami, createLess, createLessOrEqual, createList, createMap, createMapAsync, createMix, createNumber, createFormat as createNumberFormat, createOmit, createOnlyChild, createOutdegree, createOutgoing, createPick, createPointerhover, createPointerpress, createReduce, createReduceAsync, createRemove, createReorder, createReplace, createResults, createReverse, createRoot, createSanitize, createSet$1 as createSet, createShuffle, createSiblings, createSlice, createSlug, createSome, createSort, createSwap, createTerminal, createTotalSiblings, createFind as createTreeFind, createTry, createTryAsync, createUnique, createValue$1 as createValue, defineAssociativeArray, defineGraph, defineGraphAsync, defineGraphAsyncEdge, defineGraphAsyncEdges, defineGraphEdge, defineGraphEdges, defineGraphNode, defineGraphNodes, easingsNetInBack, easingsNetInCirc, easingsNetInCubic, easingsNetInExpo, easingsNetInOutBack, easingsNetInOutCirc, easingsNetInOutCubic, easingsNetInOutExpo, easingsNetInOutQuad, easingsNetInOutQuint, easingsNetInOutSine, easingsNetInQuad, easingsNetInQuart, easingsNetInQuint, easingsNetInSine, easingsNetOutBack, easingsNetOutCirc, easingsNetOutCubic, easingsNetOutExpo, easingsNetOutQuad, easingsNetOutQuint, easingsNetOutSine, fromAliasToCode, fromCodeToAliases, fromKeyboardEventDescriptorToAliases, fromShorthandAliasToLonghandAlias, linear, materialAccelerated, materialDecelerated, materialStandard, toD, toFlattenedD, toMessageListenParams, verouEase, verouEaseIn, verouEaseInOut, verouEaseOut };
5459
+ var __defProp = Object.defineProperty;
5460
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5461
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5462
+ class Transactable {
5463
+ constructor(name, options = {}) {
5464
+ __publicField(this, "computedStatus");
5465
+ __publicField(this, "listenables", []);
5466
+ __publicField(this, "computedDb");
5467
+ __publicField(this, "computedError");
5468
+ __publicField(this, "computedName");
5469
+ this.constructing();
5470
+ this.computedName = name;
5471
+ this.ready();
5472
+ }
5473
+ constructing() {
5474
+ this.computedStatus = "constructing";
5475
+ }
5476
+ ready() {
5477
+ this.computedStatus = "ready";
5478
+ }
5479
+ get name() {
5480
+ return this.computedName;
5481
+ }
5482
+ set name(name) {
5483
+ this.setName(name);
5484
+ }
5485
+ get db() {
5486
+ return this.computedDb;
5487
+ }
5488
+ get error() {
5489
+ return this.computedError;
5490
+ }
5491
+ get status() {
5492
+ return this.computedStatus;
5493
+ }
5494
+ setName(name) {
5495
+ this.stop();
5496
+ this.computedName = name;
5497
+ return this;
5498
+ }
5499
+ open(options = {}) {
5500
+ const { version } = options, status = this.status;
5501
+ this.opening();
5502
+ switch (status) {
5503
+ // IDB is not open-ish, IDB is not expected to open
5504
+ case "constructing":
5505
+ case "ready":
5506
+ case "openerrored":
5507
+ case "closed":
5508
+ case "deleted":
5509
+ case "closing":
5510
+ case "deleteerrored":
5511
+ case "deleting":
5512
+ this.requestOpen(options);
5513
+ return this;
5514
+ // IDB is not open-ish, IDB is expected to open
5515
+ case "opening":
5516
+ return this;
5517
+ // IDB is open-ish
5518
+ case "openblocked":
5519
+ case "opened":
5520
+ case "transacting":
5521
+ case "transacted":
5522
+ case "transacterrored":
5523
+ case "transactaborted":
5524
+ case "upgradeneeded":
5525
+ if (version ?? -1 > this.db.version) {
5526
+ this.requestOpen(options);
5527
+ return this;
5528
+ }
5529
+ this[status]();
5530
+ return this;
5531
+ }
5532
+ }
5533
+ requestOpen(options) {
5534
+ const { version, upgradeEffect } = options, request = indexedDB.open(this.computedName, version), listenables = [
5535
+ new Listenable("success").listen(
5536
+ () => {
5537
+ stopListenables();
5538
+ switch (this.status) {
5539
+ case "closing":
5540
+ request.result.close();
5541
+ this.closed();
5542
+ return;
5543
+ case "deleting":
5544
+ const db = request.result;
5545
+ db.close();
5546
+ this.requestDelete();
5547
+ return;
5548
+ default:
5549
+ this.computedDb = request.result;
5550
+ this.opened();
5551
+ return;
5552
+ }
5553
+ },
5554
+ { target: request }
5555
+ ),
5556
+ new Listenable("blocked").listen(
5557
+ () => {
5558
+ switch (this.status) {
5559
+ case "closing":
5560
+ request.result.close();
5561
+ this.closed();
5562
+ stopListenables();
5563
+ return;
5564
+ case "deleting":
5565
+ const db = request.result;
5566
+ db.close();
5567
+ this.requestDelete();
5568
+ stopListenables();
5569
+ return;
5570
+ default:
5571
+ this.openblocked();
5572
+ return;
5573
+ }
5574
+ },
5575
+ { target: request }
5576
+ ),
5577
+ new Listenable("error").listen(
5578
+ () => {
5579
+ stopListenables();
5580
+ switch (this.status) {
5581
+ case "closing":
5582
+ request.result?.close();
5583
+ this.closed();
5584
+ return;
5585
+ case "deleting":
5586
+ const db = request.result;
5587
+ db?.close();
5588
+ this.requestDelete();
5589
+ return;
5590
+ default:
5591
+ this.computedError = request.error;
5592
+ this.openerrored();
5593
+ return;
5594
+ }
5595
+ },
5596
+ { target: request }
5597
+ ),
5598
+ new Listenable("upgradeneeded").listen(
5599
+ () => {
5600
+ switch (this.status) {
5601
+ case "closing":
5602
+ request.result.close();
5603
+ return;
5604
+ case "deleting":
5605
+ const db = request.result;
5606
+ db.close();
5607
+ this.requestDelete();
5608
+ return;
5609
+ default:
5610
+ this.computedDb = request.result;
5611
+ this.upgradeneeded();
5612
+ upgradeEffect?.(request.result);
5613
+ return;
5614
+ }
5615
+ },
5616
+ { target: request }
5617
+ )
5618
+ ], stopListenables = () => this.stopListenables(listenables);
5619
+ this.listenables.push(...listenables);
5620
+ }
5621
+ opening() {
5622
+ this.computedStatus = "opening";
5623
+ }
5624
+ opened() {
5625
+ this.computedStatus = "opened";
5626
+ }
5627
+ openblocked() {
5628
+ this.computedStatus = "openblocked";
5629
+ }
5630
+ openerrored() {
5631
+ this.computedStatus = "openerrored";
5632
+ }
5633
+ upgradeneeded() {
5634
+ this.computedStatus = "upgradeneeded";
5635
+ }
5636
+ transact(effect, options = {}) {
5637
+ const {
5638
+ storeNames = [],
5639
+ mode = "readonly",
5640
+ ...transactionOptions
5641
+ } = options, transaction = this.db.transaction(storeNames, mode, transactionOptions), listenables = [
5642
+ new Listenable("complete").listen(
5643
+ () => {
5644
+ switch (this.status) {
5645
+ case "closing":
5646
+ this.closed();
5647
+ break;
5648
+ default:
5649
+ this.transacted();
5650
+ break;
5651
+ }
5652
+ stopListenables();
5653
+ },
5654
+ { target: transaction }
5655
+ ),
5656
+ new Listenable("error").listen(
5657
+ () => {
5658
+ this.transacterrored();
5659
+ this.computedError = transaction.error;
5660
+ stopListenables();
5661
+ },
5662
+ { target: transaction }
5663
+ ),
5664
+ new Listenable("abort").listen(
5665
+ () => {
5666
+ this.transactaborted();
5667
+ stopListenables();
5668
+ },
5669
+ { target: transaction }
5670
+ )
5671
+ ], stopListenables = () => this.stopListenables(listenables);
5672
+ this.listenables.push(...listenables);
5673
+ this.transacting();
5674
+ effect(transaction);
5675
+ return this;
5676
+ }
5677
+ transacted() {
5678
+ this.computedStatus = "transacted";
5679
+ }
5680
+ transacterrored() {
5681
+ this.computedStatus = "transacterrored";
5682
+ }
5683
+ transactaborted() {
5684
+ this.computedStatus = "transactaborted";
5685
+ }
5686
+ transacting() {
5687
+ this.computedStatus = "transacting";
5688
+ }
5689
+ readonly(effect, options = {}) {
5690
+ return this.transact(effect, { ...options, mode: "readonly" });
5691
+ }
5692
+ readwrite(effect, options = {}) {
5693
+ return this.transact(effect, { ...options, mode: "readwrite" });
5694
+ }
5695
+ versionchange(effect, options = {}) {
5696
+ return this.transact(effect, { ...options, mode: "versionchange" });
5697
+ }
5698
+ close() {
5699
+ const status = this.status;
5700
+ this.closing();
5701
+ switch (status) {
5702
+ // IDB is not closed, IDB is not expected to close
5703
+ case "opened":
5704
+ case "transacting":
5705
+ case "transacted":
5706
+ case "transacterrored":
5707
+ case "transactaborted":
5708
+ this.db.close();
5709
+ this.closed();
5710
+ return this;
5711
+ // IDB is not closed, IDB is expected to close & update status
5712
+ case "opening":
5713
+ case "openblocked":
5714
+ case "upgradeneeded":
5715
+ case "closing":
5716
+ return this;
5717
+ // IDB is expected to close & delete
5718
+ case "deleting":
5719
+ this.deleting();
5720
+ return this;
5721
+ // IDB is closed
5722
+ case "constructing":
5723
+ case "ready":
5724
+ case "openerrored":
5725
+ case "closed":
5726
+ case "deleted":
5727
+ case "deleteerrored":
5728
+ this.closed();
5729
+ return this;
5730
+ }
5731
+ }
5732
+ closing() {
5733
+ this.computedStatus = "closing";
5734
+ }
5735
+ closed() {
5736
+ this.computedStatus = "closed";
5737
+ }
5738
+ delete() {
5739
+ const status = this.status;
5740
+ this.deleting();
5741
+ switch (status) {
5742
+ // IDB is neither closed nor deleted, IDB is not expected to close nor delete
5743
+ case "opened":
5744
+ case "transacting":
5745
+ case "transacted":
5746
+ case "transacterrored":
5747
+ case "transactaborted":
5748
+ this.db.close();
5749
+ this.closed();
5750
+ this.requestDelete();
5751
+ return this;
5752
+ // IDB is neither closed nor deleted, IDB is expected to close & delete & update status
5753
+ case "opening":
5754
+ case "openblocked":
5755
+ case "upgradeneeded":
5756
+ case "deleting":
5757
+ return this;
5758
+ // IDB is closed, not deleted, IDB is not expected to delete
5759
+ case "constructing":
5760
+ case "ready":
5761
+ case "openerrored":
5762
+ case "closed":
5763
+ case "deleteerrored":
5764
+ this.requestDelete();
5765
+ return this;
5766
+ // IDB is closed & deleted
5767
+ case "deleted":
5768
+ this.deleted();
5769
+ return this;
5770
+ // Precluded
5771
+ case "closing":
5772
+ return this;
5773
+ }
5774
+ }
5775
+ requestDelete() {
5776
+ const request = indexedDB.deleteDatabase(this.computedName), listenables = [
5777
+ new Listenable("success").listen(
5778
+ () => {
5779
+ this.deleted();
5780
+ stopListenables();
5781
+ },
5782
+ { target: request }
5783
+ ),
5784
+ new Listenable("error").listen(
5785
+ () => {
5786
+ this.computedError = request.error;
5787
+ this.deleteerrored();
5788
+ stopListenables();
5789
+ },
5790
+ { target: request }
5791
+ )
5792
+ ], stopListenables = () => this.stopListenables(listenables);
5793
+ this.listenables.push(...listenables);
5794
+ }
5795
+ deleting() {
5796
+ this.computedStatus = "deleting";
5797
+ }
5798
+ deleteerrored() {
5799
+ this.computedStatus = "deleteerrored";
5800
+ }
5801
+ deleted() {
5802
+ this.computedStatus = "deleted";
5803
+ }
5804
+ stop() {
5805
+ this.stopListenables(this.listenables);
5806
+ return this;
5807
+ }
5808
+ stopListenables(listenables) {
5809
+ for (const listenable of listenables) listenable.stop();
5810
+ this.listenables = createFilter(
5811
+ (l) => !includes(l)(listenables)
5812
+ )(this.listenables);
5813
+ }
5814
+ }
5815
+
5816
+ export { Animateable, Broadcastable, Compareable, Completeable, Copyable, Delayable, Drawable, Fetchable, Fullscreenable, Grantable, Keychord, Keypress, Keyrelease, Konami, Listenable, Navigateable, Operateable, Pickable, Pointerhover, Pointerpress, Recognizeable, Resolveable, Shareable, Storeable, Transactable, createFormat$2 as createArrayFormat, createClear$2 as createAssociativeArrayClear, createDelete$2 as createAssociativeArrayDelete, createHas$1 as createAssociativeArrayHas, createKeys$1 as createAssociativeArrayKeys, createSet$2 as createAssociativeArraySet, createValue$2 as createAssociativeArrayValue, createValues$1 as createAssociativeArrayValues, createBreadthPathConfig, createChildren, createClamp, createClear$1 as createClear, createClip, createClone, createComputedStyle, createConcat, createFormat$1 as createDateFormat, createAncestor$1 as createDecisionTreeAncestor, createCommonAncestors$1 as createDecisionTreeCommonAncestors, createNodeDepthFirstSteps$1 as createDecisionTreeNodeDepthFirstSteps, createPath$1 as createDecisionTreePath, createDepthFirstSteps$1 as createDecisionTreeSteps, createTree$1 as createDecisionTreeTree, createDeepEqual, createDeepMerge, createDefineObjectStore, createDelete$1 as createDelete, createDepthPathConfig, createDetermine, createAncestor$2 as createDirectedAcyclicAncestor, createAncestor as createDirectedAcyclicAsyncAncestor, createCommonAncestors as createDirectedAcyclicAsyncCommonAncestors, createDepthFirstSteps as createDirectedAcyclicAsyncDepthFirstSteps, createLayers as createDirectedAcyclicAsyncLayers, createNodeDepthFirstSteps as createDirectedAcyclicAsyncNodeDepthFirstSteps, createPath as createDirectedAcyclicAsyncPath, createTree as createDirectedAcyclicAsyncTree, createCommonAncestors$2 as createDirectedAcyclicCommonAncestors, createDepthFirstSteps$2 as createDirectedAcyclicDepthFirstSteps, createLayers$1 as createDirectedAcyclicLayers, createNodeDepthFirstSteps$2 as createDirectedAcyclicNodeDepthFirstSteps, createPath$2 as createDirectedAcyclicPath, createRoots as createDirectedAcyclicRoots, createTree$2 as createDirectedAcyclicTree, createEntries, createEqual, createEvery, createFilter, createFilterAsync, createFindAsync, createFindIndexAsync, createFocusable, createForEachAsync, createGraph, createGreater, createGreaterOrEqual, createHas, createIncoming, createIndegree, createInsert, createKeychord, createKeycomboMatch$1 as createKeycomboMatch, createKeypress, createKeyrelease, createKeys, createKonami, createLess, createLessOrEqual, createList, createMap, createMapAsync, createMix, createNumber, createFormat as createNumberFormat, createOmit, createOnlyChild, createOutdegree, createOutgoing, createPick, createPointerhover, createPointerpress, createReduce, createReduceAsync, createRemove, createReorder, createReplace, createResults, createReverse, createRoot, createSanitize, createSet$1 as createSet, createShuffle, createSiblings, createSlice, createSlug, createSome, createSort, createSwap, createTerminal, createTotalSiblings, createFind as createTreeFind, createTry, createTryAsync, createUnique, createValue$1 as createValue, defineAnimateableKeyframes, defineAssociativeArray, defineGraph, defineGraphAsync, defineGraphAsyncEdge, defineGraphAsyncEdges, defineGraphEdge, defineGraphEdges, defineGraphNode, defineGraphNodes, easingsNetInBack, easingsNetInCirc, easingsNetInCubic, easingsNetInExpo, easingsNetInOutBack, easingsNetInOutCirc, easingsNetInOutCubic, easingsNetInOutExpo, easingsNetInOutQuad, easingsNetInOutQuint, easingsNetInOutSine, easingsNetInQuad, easingsNetInQuart, easingsNetInQuint, easingsNetInSine, easingsNetOutBack, easingsNetOutCirc, easingsNetOutCubic, easingsNetOutExpo, easingsNetOutQuad, easingsNetOutQuint, easingsNetOutSine, fromAliasToCode, fromCodeToAliases, fromKeyboardEventDescriptorToAliases, fromShorthandAliasToLonghandAlias, linear, materialAccelerated, materialDecelerated, materialStandard, toD, toFlattenedD, toMessageListenParams, verouEase, verouEaseIn, verouEaseInOut, verouEaseOut };