@baleada/logic 0.24.19 → 0.24.20

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