@baleada/logic 0.20.30 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { reduce, pipe, filter, toArray, findIndex, slice, concat, unique, map, find, some, join, every } from 'lazy-collections';
1
+ import { reduce, pipe, filter, toArray, slice, concat, unique, map, find, findIndex, some, join, every } from 'lazy-collections';
2
2
  import slugify from '@sindresorhus/slugify';
3
3
  import BezierEasing from 'bezier-easing';
4
4
  import { mix } from '@snigo.dev/color';
@@ -39,34 +39,30 @@ function createFilterAsync(condition) {
39
39
  return createFilter((_, index) => transformedAsync[index])(array);
40
40
  };
41
41
  }
42
- function createDelete(required) {
42
+ function createDelete(index) {
43
43
  return (array) => {
44
- const deleteIndex = "index" in required ? required.index : findIndex((element) => element === required?.item)(array);
45
- return createConcat(createSlice({ from: 0, to: deleteIndex })(array), createSlice({ from: deleteIndex + 1 })(array))([]);
44
+ return createConcat(createSlice(0, index)(array), createSlice(index + 1)(array))([]);
46
45
  };
47
46
  }
48
- function createInsert(required) {
47
+ function createInsert(item, index) {
49
48
  return (array) => {
50
- const itemsToInsert = "items" in required ? required.items : [required.item], withItems = createConcat(array, itemsToInsert)([]);
51
- return createReorder({
52
- from: { start: array.length, itemCount: itemsToInsert.length },
53
- to: required.index
54
- })(withItems);
49
+ const withItems = createConcat(array, [item])([]);
50
+ return createReorder({ start: array.length, itemCount: 1 }, index)(withItems);
55
51
  };
56
52
  }
57
- function createReorder({ from, to }) {
53
+ function createReorder(from, to) {
58
54
  return (array) => {
59
55
  const [itemsToMoveStartIndex, itemsToMoveCount] = isObject(from) ? [from.start, from.itemCount] : [from, 1], insertIndex = to;
60
56
  if (insertIndex > itemsToMoveStartIndex && insertIndex < itemsToMoveStartIndex + itemsToMoveCount) {
61
57
  return array;
62
58
  }
63
- const itemsToMove = createSlice({ from: itemsToMoveStartIndex, to: itemsToMoveStartIndex + itemsToMoveCount })(array);
59
+ const itemsToMove = createSlice(itemsToMoveStartIndex, itemsToMoveStartIndex + itemsToMoveCount)(array);
64
60
  if (itemsToMoveStartIndex < insertIndex) {
65
- const beforeItemsToMove = itemsToMoveStartIndex === 0 ? [] : createSlice({ from: 0, to: itemsToMoveStartIndex })(array), betweenItemsToMoveAndInsertIndex = createSlice({ from: itemsToMoveStartIndex + itemsToMoveCount, to: insertIndex + 1 })(array), afterInsertIndex = createSlice({ from: insertIndex + 1 })(array);
61
+ const beforeItemsToMove = itemsToMoveStartIndex === 0 ? [] : createSlice(0, itemsToMoveStartIndex)(array), betweenItemsToMoveAndInsertIndex = createSlice(itemsToMoveStartIndex + itemsToMoveCount, insertIndex + 1)(array), afterInsertIndex = createSlice(insertIndex + 1)(array);
66
62
  return createConcat(beforeItemsToMove, betweenItemsToMoveAndInsertIndex, itemsToMove, afterInsertIndex)([]);
67
63
  }
68
64
  if (itemsToMoveStartIndex > insertIndex) {
69
- const beforeInsertion = insertIndex === 0 ? [] : createSlice({ from: 0, to: insertIndex })(array), betweenInsertionAndItemsToMove = createSlice({ from: insertIndex, to: itemsToMoveStartIndex })(array), afterItemsToMove = createSlice({ from: itemsToMoveStartIndex + itemsToMoveCount })(array);
65
+ const beforeInsertion = insertIndex === 0 ? [] : createSlice(0, insertIndex)(array), betweenInsertionAndItemsToMove = createSlice(insertIndex, itemsToMoveStartIndex)(array), afterItemsToMove = createSlice(itemsToMoveStartIndex + itemsToMoveCount)(array);
70
66
  return createConcat(beforeInsertion, itemsToMove, betweenInsertionAndItemsToMove, afterItemsToMove)([]);
71
67
  }
72
68
  return array;
@@ -75,19 +71,19 @@ function createReorder({ from, to }) {
75
71
  function isObject(value) {
76
72
  return typeof value === "object";
77
73
  }
78
- function createSwap({ indices }) {
74
+ function createSwap(indices) {
79
75
  return (array) => {
80
76
  const { 0: from, 1: to } = indices, { reorderFrom, reorderTo } = (() => {
81
77
  if (from < to) {
82
78
  return {
83
- reorderFrom: createReorder({ from, to }),
84
- reorderTo: createReorder({ from: to - 1, to: from })
79
+ reorderFrom: createReorder(from, to),
80
+ reorderTo: createReorder(to - 1, from)
85
81
  };
86
82
  }
87
83
  if (from > to) {
88
84
  return {
89
- reorderFrom: createReorder({ from, to }),
90
- reorderTo: createReorder({ from: to + 1, to: from })
85
+ reorderFrom: createReorder(from, to),
86
+ reorderTo: createReorder(to + 1, from)
91
87
  };
92
88
  }
93
89
  return {
@@ -98,15 +94,15 @@ function createSwap({ indices }) {
98
94
  return new Pipeable(array).pipe(reorderFrom, reorderTo);
99
95
  };
100
96
  }
101
- function createReplace({ index, item }) {
97
+ function createReplace(index, item) {
102
98
  return (array) => {
103
- return createConcat(createSlice({ from: 0, to: index })(array), [item], createSlice({ from: index + 1 })(array))([]);
99
+ return createConcat(createSlice(0, index)(array), [item], createSlice(index + 1)(array))([]);
104
100
  };
105
101
  }
106
102
  function createUnique() {
107
103
  return (array) => pipe(unique(), toArray())(array);
108
104
  }
109
- function createSlice({ from, to }) {
105
+ function createSlice(from, to) {
110
106
  return (array) => {
111
107
  return from === to ? [] : pipe(slice(from, to - 1), toArray())(array);
112
108
  };
@@ -129,6 +125,11 @@ function createReverse() {
129
125
  return reversed;
130
126
  };
131
127
  }
128
+ function createSort(compare) {
129
+ return (array) => {
130
+ return new Pipeable(array).pipe(createSlice(0), (sliced) => sliced.sort(compare));
131
+ };
132
+ }
132
133
  function createSlug(options) {
133
134
  return (string) => {
134
135
  return slugify(string, options);
@@ -139,7 +140,7 @@ function createClip(required) {
139
140
  return string.replace(required, "");
140
141
  };
141
142
  }
142
- function createClamp({ min, max }) {
143
+ function createClamp(min, max) {
143
144
  return (number) => {
144
145
  const maxed = Math.max(number, min);
145
146
  return Math.min(maxed, max);
@@ -155,10 +156,10 @@ function createDetermine(potentialities) {
155
156
  })(potentialities);
156
157
  return (determinant) => find(({ predicate }) => predicate(determinant))(predicates).outcome;
157
158
  }
158
- function createRename({ from, to }) {
159
+ function createRename(from, to) {
159
160
  return (map2) => {
160
- const keys = [...map2.keys()], keyToRenameIndex = findIndex((k) => k === from)(keys), newKeys = createReplace({ index: keyToRenameIndex, item: to })(keys), values = [...map2.values()];
161
- return createReduce((renamed, key, index) => renamed.set(key, values[index]), new Map())(newKeys);
161
+ const keys = [...map2.keys()], keyToRenameIndex = findIndex((k) => k === from)(keys), newKeys = createReplace(keyToRenameIndex, to)(keys), values = [...map2.values()];
162
+ return createReduce((renamed, key, index) => renamed.set(key, values[index]), /* @__PURE__ */ new Map())(newKeys);
162
163
  };
163
164
  }
164
165
  function createToEntries() {
@@ -186,7 +187,7 @@ function toEvent(eventType, options) {
186
187
  const implementation = toImplementation(eventType);
187
188
  switch (implementation) {
188
189
  case "keycombo": {
189
- const combo = toCombo(eventType), modifiers = createSlice({ from: 0, to: combo.length - 1 })(combo), { 0: name } = createSlice({ from: combo.length - 1 })(combo);
190
+ const combo = toCombo(eventType), modifiers = createSlice(0, combo.length - 1)(combo), { 0: name } = createSlice(combo.length - 1)(combo);
190
191
  return new KeyboardEvent("keyDirection" in options ? `key${options.keyDirection}` : "keydown", {
191
192
  ...options.init || {},
192
193
  key: toKey(name),
@@ -198,7 +199,7 @@ function toEvent(eventType, options) {
198
199
  }
199
200
  case "leftclickcombo":
200
201
  case "rightclickcombo": {
201
- const combo = toCombo(eventType), modifiers = createSlice({ from: 0, to: combo.length - 1 })(combo), { 0: name } = createSlice({ from: combo.length - 1 })(combo);
202
+ const combo = toCombo(eventType), modifiers = createSlice(0, combo.length - 1)(combo), { 0: name } = createSlice(combo.length - 1)(combo);
202
203
  return new MouseEvent(name === "rightclick" ? "contextmenu" : name, {
203
204
  ...options.init || {},
204
205
  ...createReduce((flags, alias) => {
@@ -208,7 +209,7 @@ function toEvent(eventType, options) {
208
209
  });
209
210
  }
210
211
  case "pointercombo": {
211
- const combo = toCombo(eventType), modifiers = createSlice({ from: 0, to: combo.length - 1 })(combo), { 0: name } = createSlice({ from: combo.length - 1 })(combo);
212
+ const combo = toCombo(eventType), modifiers = createSlice(0, combo.length - 1)(combo), { 0: name } = createSlice(combo.length - 1)(combo);
212
213
  return new PointerEvent(name === "rightclick" ? "contextmenu" : name, {
213
214
  ...options.init || {},
214
215
  ...createReduce((flags, alias) => {
@@ -235,8 +236,6 @@ function toEvent(eventType, options) {
235
236
  return new InputEvent(eventType, options.init);
236
237
  if (eventType === "blur")
237
238
  return new FocusEvent(eventType, options.init);
238
- if (eventType === "cancel")
239
- return new Event(eventType, options.init);
240
239
  if (eventType === "canplay")
241
240
  return new Event(eventType, options.init);
242
241
  if (eventType === "canplaythrough")
@@ -265,8 +264,6 @@ function toEvent(eventType, options) {
265
264
  return new DragEvent(eventType, options.init);
266
265
  if (eventType === "dragenter")
267
266
  return new DragEvent(eventType, options.init);
268
- if (eventType === "dragexit")
269
- return new Event(eventType, options.init);
270
267
  if (eventType === "dragleave")
271
268
  return new DragEvent(eventType, options.init);
272
269
  if (eventType === "dragover")
@@ -489,7 +486,7 @@ function toCombo(type) {
489
486
  function fromComboItemNameToType(name) {
490
487
  return find((type) => predicatesByType[type](name))(listenableComboItemTypes) ?? "custom";
491
488
  }
492
- const listenableComboItemTypes = new Set(["singleCharacter", "arrow", "other", "modifier", "click", "pointer"]);
489
+ const listenableComboItemTypes = /* @__PURE__ */ new Set(["singleCharacter", "arrow", "other", "modifier", "click", "pointer"]);
493
490
  const predicatesByType = {
494
491
  singleCharacter: (name) => typeREs["singleCharacter"].test(name),
495
492
  arrow: (name) => typeREs["arrow"].test(name),
@@ -585,6 +582,10 @@ function isString(value) {
585
582
  }
586
583
 
587
584
  class Recognizeable {
585
+ maxSequenceLength;
586
+ effects;
587
+ effectApi;
588
+ toType;
588
589
  constructor(sequence, options = { effectsIncludeCombos: true }) {
589
590
  const defaultOptions = {
590
591
  maxSequenceLength: true,
@@ -608,6 +609,7 @@ class Recognizeable {
608
609
  };
609
610
  this.ready();
610
611
  }
612
+ computedMetadata;
611
613
  resetComputedMetadata() {
612
614
  this.computedMetadata = {};
613
615
  }
@@ -617,6 +619,7 @@ class Recognizeable {
617
619
  denied() {
618
620
  this.computedStatus = "denied";
619
621
  }
622
+ computedStatus;
620
623
  ready() {
621
624
  this.computedStatus = "ready";
622
625
  }
@@ -632,13 +635,14 @@ class Recognizeable {
632
635
  get metadata() {
633
636
  return this.computedMetadata;
634
637
  }
638
+ computedSequence;
635
639
  setSequence(sequence) {
636
640
  this.computedSequence = sequence;
637
641
  return this;
638
642
  }
639
643
  recognize(sequenceItem, { onRecognized } = {}) {
640
644
  this.recognizing();
641
- const type = this.toType(sequenceItem), excess = isNumber(this.maxSequenceLength) ? Math.max(0, this.sequence.length - this.maxSequenceLength) : 0, newSequence = createConcat(createSlice({ from: excess })(this.sequence), [sequenceItem])([]);
645
+ const type = this.toType(sequenceItem), excess = isNumber(this.maxSequenceLength) ? Math.max(0, this.sequence.length - this.maxSequenceLength) : 0, newSequence = createConcat(createSlice(excess)(this.sequence), [sequenceItem])([]);
642
646
  this.effectApi.sequenceItem = sequenceItem;
643
647
  this.effectApi.getSequence = () => newSequence;
644
648
  this.effectApi.onRecognized = onRecognized || (() => {
@@ -735,9 +739,12 @@ function createToType({
735
739
  }
736
740
  };
737
741
  }
738
- const leftclickcomboEventTypes = new Set(["click", "mousedown", "mouseup", "dblclick"]), rightclickComboEventTypes = new Set(["contextmenu"]), keycomboEventTypes = new Set(["keydown", "keyup"]), toJoinedClickcombo = join("+"), toJoinedKeycombo = pipe(map(({ name }) => name), toJoinedClickcombo);
742
+ const leftclickcomboEventTypes = /* @__PURE__ */ new Set(["click", "mousedown", "mouseup", "dblclick"]), rightclickComboEventTypes = /* @__PURE__ */ new Set(["contextmenu"]), keycomboEventTypes = /* @__PURE__ */ new Set(["keydown", "keyup"]), toJoinedClickcombo = join("+"), toJoinedKeycombo = pipe(map(({ name }) => name), toJoinedClickcombo);
739
743
 
740
744
  class Listenable {
745
+ computedRecognizeable;
746
+ recognizeableEffectsKeys;
747
+ computedActive;
741
748
  constructor(type, options) {
742
749
  if (type === "recognizeable") {
743
750
  const recognizeableOptions = {
@@ -750,10 +757,11 @@ class Listenable {
750
757
  this.computedRecognizeable = new Recognizeable([], recognizeableOptions);
751
758
  this.recognizeableEffectsKeys = Object.keys(recognizeableOptions.effects);
752
759
  }
753
- this.computedActive = new Set();
760
+ this.computedActive = /* @__PURE__ */ new Set();
754
761
  this.setType(type);
755
762
  this.ready();
756
763
  }
764
+ computedStatus;
757
765
  ready() {
758
766
  this.computedStatus = "ready";
759
767
  }
@@ -772,6 +780,8 @@ class Listenable {
772
780
  get recognizeable() {
773
781
  return this.computedRecognizeable;
774
782
  }
783
+ computedType;
784
+ implementation;
775
785
  setType(type) {
776
786
  this.stop();
777
787
  this.computedType = type;
@@ -964,7 +974,7 @@ function stop(stoppable) {
964
974
  function toImplementation(type) {
965
975
  return find((implementation) => predicatesByImplementation.get(implementation)(type))(predicatesByImplementation.keys());
966
976
  }
967
- const predicatesByImplementation = new Map([
977
+ const predicatesByImplementation = /* @__PURE__ */ new Map([
968
978
  [
969
979
  "recognizeable",
970
980
  (type) => type === "recognizeable"
@@ -1014,7 +1024,7 @@ const predicatesByImplementation = new Map([
1014
1024
  () => true
1015
1025
  ]
1016
1026
  ]);
1017
- const documentEvents = new Set([
1027
+ const documentEvents = /* @__PURE__ */ new Set([
1018
1028
  "fullscreenchange",
1019
1029
  "fullscreenerror",
1020
1030
  "pointerlockchange",
@@ -1037,6 +1047,11 @@ function eventMatchesKeycombo({ event, keycombo }) {
1037
1047
  return every(({ name, type }, index) => {
1038
1048
  switch (type) {
1039
1049
  case "singleCharacter":
1050
+ if (name === "!") {
1051
+ return event.key === "!";
1052
+ }
1053
+ const keyToTest = event.altKey && fromComboItemNameToType(event.key) === "custom" ? fromCodeToSingleCharacter(event.code) : event.key.toLowerCase();
1054
+ return name.startsWith("!") ? keyToTest !== toKey(name.slice(1)).toLowerCase() : keyToTest === toKey(name).toLowerCase();
1040
1055
  case "other":
1041
1056
  if (name === "!") {
1042
1057
  return event.key === "!";
@@ -1052,7 +1067,34 @@ function eventMatchesKeycombo({ event, keycombo }) {
1052
1067
  }
1053
1068
  })(keycombo);
1054
1069
  }
1055
- const predicatesByArrow = new Map([
1070
+ function fromCodeToSingleCharacter(code) {
1071
+ for (const c in aliasesByCode) {
1072
+ if (c === code) {
1073
+ return aliasesByCode[c];
1074
+ }
1075
+ }
1076
+ for (const prefix of ["Key", "Digit"]) {
1077
+ const re = new RegExp(`^${prefix}`);
1078
+ if (re.test(code)) {
1079
+ return createClip(re)(code).toLowerCase();
1080
+ }
1081
+ }
1082
+ return code;
1083
+ }
1084
+ const aliasesByCode = {
1085
+ "Backquote": "`",
1086
+ "Minus": "-",
1087
+ "Equal": "=",
1088
+ "BracketLeft": "[",
1089
+ "BracketRight": "]",
1090
+ "Backslash": "\\",
1091
+ "Semicolon": ";",
1092
+ "Quote": "'",
1093
+ "Comma": ",",
1094
+ "Period": ".",
1095
+ "Slash": "/"
1096
+ };
1097
+ const predicatesByArrow = /* @__PURE__ */ new Map([
1056
1098
  [
1057
1099
  "arrow",
1058
1100
  ({ event }) => arrows.has(event.key.toLowerCase())
@@ -1082,9 +1124,9 @@ const predicatesByArrow = new Map([
1082
1124
  ({ event, name }) => name.startsWith("!") ? event.key.toLowerCase() !== `arrow${name.toLowerCase()}` : event.key.toLowerCase() === `arrow${name.toLowerCase()}`
1083
1125
  ]
1084
1126
  ]);
1085
- const arrows = new Set(["arrowup", "arrowright", "arrowdown", "arrowleft"]);
1086
- const verticalArrows = new Set(["arrowup", "arrowdown"]);
1087
- const horizontalArrows = new Set(["arrowright", "arrowleft"]);
1127
+ const arrows = /* @__PURE__ */ new Set(["arrowup", "arrowright", "arrowdown", "arrowleft"]);
1128
+ const verticalArrows = /* @__PURE__ */ new Set(["arrowup", "arrowdown"]);
1129
+ const horizontalArrows = /* @__PURE__ */ new Set(["arrowright", "arrowleft"]);
1088
1130
  function eventMatchesClickcombo({ event, clickcombo }) {
1089
1131
  return every((name) => fromComboItemNameToType(name) === "click" || name.startsWith("!") && !isModified({ alias: name.slice(1), event }) || !name.startsWith("!") && isModified({ alias: name, event }))(clickcombo);
1090
1132
  }
@@ -1109,6 +1151,21 @@ const defaultOptions$6 = {
1109
1151
  alternates: false
1110
1152
  };
1111
1153
  class Animateable {
1154
+ initialDuration;
1155
+ iterationLimit;
1156
+ alternates;
1157
+ controlPoints;
1158
+ reversedControlPoints;
1159
+ toAnimationProgress;
1160
+ reversedToAnimationProgress;
1161
+ playCache;
1162
+ reverseCache;
1163
+ pauseCache;
1164
+ seekCache;
1165
+ alternateCache;
1166
+ visibilitychange;
1167
+ getEaseables;
1168
+ getReversedEaseables;
1112
1169
  constructor(keyframes, options = {}) {
1113
1170
  this.initialDuration = options?.duration || defaultOptions$6.duration;
1114
1171
  this.controlPoints = fromTimingToControlPoints(options?.timing || defaultOptions$6.timing);
@@ -1132,21 +1189,25 @@ class Animateable {
1132
1189
  this.resetProgress();
1133
1190
  this.resetIterations();
1134
1191
  }
1192
+ computedStatus;
1135
1193
  ready() {
1136
1194
  this.computedStatus = "ready";
1137
1195
  }
1196
+ computedTime;
1138
1197
  resetTime() {
1139
1198
  this.computedTime = {
1140
1199
  elapsed: 0,
1141
1200
  remaining: this.duration
1142
1201
  };
1143
1202
  }
1203
+ computedProgress;
1144
1204
  resetProgress() {
1145
1205
  this.computedProgress = {
1146
1206
  time: 0,
1147
1207
  animation: 0
1148
1208
  };
1149
1209
  }
1210
+ computedIterations;
1150
1211
  resetIterations() {
1151
1212
  this.computedIterations = 0;
1152
1213
  }
@@ -1177,6 +1238,11 @@ class Animateable {
1177
1238
  get progress() {
1178
1239
  return this.computedProgress;
1179
1240
  }
1241
+ computedKeyframes;
1242
+ reversedKeyframes;
1243
+ properties;
1244
+ easeables;
1245
+ reversedEaseables;
1180
1246
  setKeyframes(keyframes) {
1181
1247
  this.stop();
1182
1248
  this.computedKeyframes = Array.from(keyframes).sort(({ progress: progressA }, { progress: progressB }) => progressA - progressB);
@@ -1186,6 +1252,9 @@ class Animateable {
1186
1252
  this.reversedEaseables = this.getReversedEaseables({ keyframes: this.reversedKeyframes, properties: this.properties });
1187
1253
  return this;
1188
1254
  }
1255
+ computedPlaybackRate;
1256
+ duration;
1257
+ totalTimeInvisible;
1189
1258
  setPlaybackRate(playbackRate) {
1190
1259
  const ensuredPlaybackRate = Math.max(0, playbackRate);
1191
1260
  this.computedPlaybackRate = ensuredPlaybackRate;
@@ -1331,6 +1400,7 @@ class Animateable {
1331
1400
  reversed() {
1332
1401
  this.computedStatus = "reversed";
1333
1402
  }
1403
+ invisibleAt;
1334
1404
  listenForVisibilitychange() {
1335
1405
  if (this.visibilitychange.active.size === 0) {
1336
1406
  this.totalTimeInvisible = 0;
@@ -1346,6 +1416,7 @@ class Animateable {
1346
1416
  });
1347
1417
  }
1348
1418
  }
1419
+ computedRequest;
1349
1420
  createAnimate(type) {
1350
1421
  return (effect, options = {}) => {
1351
1422
  const { interpolate: interpolateOptions } = options;
@@ -1366,6 +1437,7 @@ class Animateable {
1366
1437
  return this;
1367
1438
  };
1368
1439
  }
1440
+ startTime;
1369
1441
  setStartTimeAndStatus(type, timestamp) {
1370
1442
  switch (type) {
1371
1443
  case "play":
@@ -1732,7 +1804,7 @@ function createGetEaseables(fromKeyframeToControlPoints) {
1732
1804
  };
1733
1805
  }
1734
1806
  function toProperties(keyframes) {
1735
- const properties = new Set();
1807
+ const properties = /* @__PURE__ */ new Set();
1736
1808
  for (const keyframe of keyframes) {
1737
1809
  for (const property in keyframe.properties) {
1738
1810
  if (!properties.has(property)) {
@@ -1775,7 +1847,7 @@ function toInterpolated({ previous, next, progress }, options = {}) {
1775
1847
  }
1776
1848
  if (isArray(previous) && isArray(next)) {
1777
1849
  const exactSliceEnd = (next.length - previous.length) * progress + previous.length, nextIsLonger = next.length > previous.length, sliceEnd = nextIsLonger ? Math.floor(exactSliceEnd) : Math.ceil(exactSliceEnd), sliceTarget = nextIsLonger ? next : previous;
1778
- return createSlice({ from: 0, to: sliceEnd })(sliceTarget);
1850
+ return createSlice(0, sliceEnd)(sliceTarget);
1779
1851
  }
1780
1852
  }
1781
1853
  const linear = [
@@ -1970,6 +2042,10 @@ const defaultCompleteOptions = {
1970
2042
  select: "completionEnd"
1971
2043
  };
1972
2044
  class Completeable {
2045
+ segmentFrom;
2046
+ segmentTo;
2047
+ divider;
2048
+ computedDividerIndices;
1973
2049
  constructor(string, options = {}) {
1974
2050
  this.constructing();
1975
2051
  this.segmentFrom = options?.segment?.from || defaultOptions$5.segment.from;
@@ -1983,6 +2059,7 @@ class Completeable {
1983
2059
  constructing() {
1984
2060
  this.computedStatus = "constructing";
1985
2061
  }
2062
+ computedStatus;
1986
2063
  ready() {
1987
2064
  this.computedStatus = "ready";
1988
2065
  }
@@ -2027,6 +2104,7 @@ class Completeable {
2027
2104
  return this.dividerIndices.after;
2028
2105
  }
2029
2106
  }
2107
+ computedString;
2030
2108
  setString(string) {
2031
2109
  this.computedString = string;
2032
2110
  switch (this.status) {
@@ -2038,6 +2116,7 @@ class Completeable {
2038
2116
  }
2039
2117
  return this;
2040
2118
  }
2119
+ computedSelection;
2041
2120
  setSelection(selection) {
2042
2121
  this.computedSelection = selection;
2043
2122
  this.setDividerIndices();
@@ -2124,6 +2203,10 @@ function toNextMatch({ string, re, from }) {
2124
2203
  }
2125
2204
 
2126
2205
  class Copyable {
2206
+ computedIsClipboardText;
2207
+ copyListenable;
2208
+ cutListenable;
2209
+ copyAndCutEffect;
2127
2210
  constructor(string, options = {}) {
2128
2211
  this.computedIsClipboardText = false;
2129
2212
  this.copyListenable = new Listenable("copy");
@@ -2135,6 +2218,7 @@ class Copyable {
2135
2218
  this.setString(string);
2136
2219
  this.ready();
2137
2220
  }
2221
+ computedStatus;
2138
2222
  ready() {
2139
2223
  this.computedStatus = "ready";
2140
2224
  }
@@ -2156,10 +2240,13 @@ class Copyable {
2156
2240
  get error() {
2157
2241
  return this.computedError;
2158
2242
  }
2243
+ computedString;
2159
2244
  setString(string) {
2160
2245
  this.computedString = string;
2161
2246
  return this;
2162
2247
  }
2248
+ computedResponse;
2249
+ computedError;
2163
2250
  async copy(options = { type: "clipboard" }) {
2164
2251
  this.copying();
2165
2252
  const { type } = options;
@@ -2212,6 +2299,7 @@ const defaultOptions$4 = {
2212
2299
  executions: 1
2213
2300
  };
2214
2301
  class Delayable {
2302
+ animateable;
2215
2303
  constructor(effect, options = {}) {
2216
2304
  this.animateable = new Animateable([
2217
2305
  { progress: 0, properties: { progress: 0 } },
@@ -2223,6 +2311,7 @@ class Delayable {
2223
2311
  this.setEffect(effect);
2224
2312
  this.ready();
2225
2313
  }
2314
+ computedStatus;
2226
2315
  ready() {
2227
2316
  this.computedStatus = "ready";
2228
2317
  }
@@ -2244,12 +2333,14 @@ class Delayable {
2244
2333
  get progress() {
2245
2334
  return this.animateable.progress.time;
2246
2335
  }
2336
+ computedEffect;
2247
2337
  setEffect(effect) {
2248
2338
  this.stop();
2249
2339
  this.computedEffect = effect;
2250
2340
  this.setFrameEffect(effect);
2251
2341
  return this;
2252
2342
  }
2343
+ frameEffect;
2253
2344
  setFrameEffect(effect) {
2254
2345
  this.frameEffect = (frame) => {
2255
2346
  const { properties: { progress }, timestamp } = frame;
@@ -2352,6 +2443,7 @@ class Dispatchable {
2352
2443
  this.setType(type);
2353
2444
  this.ready();
2354
2445
  }
2446
+ computedStatus;
2355
2447
  ready() {
2356
2448
  this.computedStatus = "ready";
2357
2449
  }
@@ -2367,10 +2459,12 @@ class Dispatchable {
2367
2459
  get status() {
2368
2460
  return this.computedStatus;
2369
2461
  }
2462
+ computedType;
2370
2463
  setType(type) {
2371
2464
  this.computedType = type;
2372
2465
  return this;
2373
2466
  }
2467
+ computedCancelled;
2374
2468
  dispatch(options = {}) {
2375
2469
  const { target = window, ...rest } = options, event = toEvent(this.type, rest);
2376
2470
  this.computedCancelled = !target.dispatchEvent(event);
@@ -2386,11 +2480,14 @@ const defaultOptions$3 = {
2386
2480
  toD: (stroke) => stroke.length === 0 ? "" : toD(stroke)
2387
2481
  };
2388
2482
  class Drawable {
2483
+ computedD;
2484
+ toD;
2389
2485
  constructor(stroke, options = {}) {
2390
2486
  this.toD = options?.toD || defaultOptions$3.toD;
2391
2487
  this.setStroke(stroke);
2392
2488
  this.ready();
2393
2489
  }
2490
+ computedStatus;
2394
2491
  ready() {
2395
2492
  this.computedStatus = "ready";
2396
2493
  }
@@ -2406,6 +2503,7 @@ class Drawable {
2406
2503
  get d() {
2407
2504
  return this.computedD;
2408
2505
  }
2506
+ computedStroke;
2409
2507
  setStroke(stroke) {
2410
2508
  this.computedStroke = stroke;
2411
2509
  this.computedD = this.toD(stroke);
@@ -2447,6 +2545,7 @@ class Resolveable {
2447
2545
  this.setGetPromise(getPromise);
2448
2546
  this.ready();
2449
2547
  }
2548
+ computedStatus;
2450
2549
  ready() {
2451
2550
  this.computedStatus = "ready";
2452
2551
  }
@@ -2462,10 +2561,12 @@ class Resolveable {
2462
2561
  get value() {
2463
2562
  return this.computedValue;
2464
2563
  }
2564
+ computedGetPromise;
2465
2565
  setGetPromise(getPromise) {
2466
2566
  this.computedGetPromise = getPromise;
2467
2567
  return this;
2468
2568
  }
2569
+ computedValue;
2469
2570
  async resolve(...args) {
2470
2571
  this.resolving();
2471
2572
  try {
@@ -2490,6 +2591,11 @@ class Resolveable {
2490
2591
  }
2491
2592
 
2492
2593
  class Fetchable {
2594
+ computedArrayBuffer;
2595
+ computedBlob;
2596
+ computedFormData;
2597
+ computedJson;
2598
+ computedText;
2493
2599
  constructor(resource, options = {}) {
2494
2600
  this.setResource(resource);
2495
2601
  this.computedArrayBuffer = new Resolveable(async () => "arrayBuffer" in this.response ? await this.response.arrayBuffer() : await void 0);
@@ -2499,6 +2605,7 @@ class Fetchable {
2499
2605
  this.computedText = new Resolveable(async () => "text" in this.response ? await this.response.text() : await void 0);
2500
2606
  this.ready();
2501
2607
  }
2608
+ computedStatus;
2502
2609
  ready() {
2503
2610
  this.computedStatus = "ready";
2504
2611
  }
@@ -2508,6 +2615,7 @@ class Fetchable {
2508
2615
  set resource(resource) {
2509
2616
  this.setResource(resource);
2510
2617
  }
2618
+ computedAbortController;
2511
2619
  get abortController() {
2512
2620
  if (!this.computedAbortController) {
2513
2621
  this.computedAbortController = new AbortController();
@@ -2553,10 +2661,13 @@ class Fetchable {
2553
2661
  return resolveable;
2554
2662
  }
2555
2663
  }
2664
+ computedResource;
2556
2665
  setResource(resource) {
2557
2666
  this.computedResource = resource;
2558
2667
  return this;
2559
2668
  }
2669
+ computedResponse;
2670
+ computedError;
2560
2671
  async fetch(options = {}) {
2561
2672
  this.computedStatus = "fetching";
2562
2673
  try {
@@ -2611,6 +2722,7 @@ class Fullscreenable {
2611
2722
  this.setGetElement(getElement);
2612
2723
  this.ready();
2613
2724
  }
2725
+ computedStatus;
2614
2726
  ready() {
2615
2727
  this.computedStatus = "ready";
2616
2728
  }
@@ -2629,6 +2741,7 @@ class Fullscreenable {
2629
2741
  get error() {
2630
2742
  return this.computedError;
2631
2743
  }
2744
+ computedGetElement;
2632
2745
  setGetElement(getElement) {
2633
2746
  this.computedGetElement = () => getElement();
2634
2747
  return this;
@@ -2637,6 +2750,7 @@ class Fullscreenable {
2637
2750
  await this.fullscreen(options);
2638
2751
  return this;
2639
2752
  }
2753
+ computedError;
2640
2754
  async fullscreen(options = {}) {
2641
2755
  try {
2642
2756
  await this.element.requestFullscreen(options);
@@ -2673,6 +2787,7 @@ class Grantable {
2673
2787
  this.setDescriptor(descriptor);
2674
2788
  this.ready();
2675
2789
  }
2790
+ computedStatus;
2676
2791
  ready() {
2677
2792
  this.computedStatus = "ready";
2678
2793
  }
@@ -2688,10 +2803,12 @@ class Grantable {
2688
2803
  get status() {
2689
2804
  return this.computedStatus;
2690
2805
  }
2806
+ computedDescriptor;
2691
2807
  setDescriptor(descriptor) {
2692
2808
  this.computedDescriptor = descriptor;
2693
2809
  return this;
2694
2810
  }
2811
+ computedPermission;
2695
2812
  async query() {
2696
2813
  this.querying();
2697
2814
  try {
@@ -2728,15 +2845,18 @@ class Navigateable {
2728
2845
  this.navigate(options?.initialLocation ?? defaultOptions$2.initialLocation);
2729
2846
  this.ready();
2730
2847
  }
2848
+ computedStatus;
2731
2849
  ready() {
2732
2850
  this.computedStatus = "ready";
2733
2851
  }
2852
+ computedArray;
2734
2853
  get array() {
2735
2854
  return this.computedArray;
2736
2855
  }
2737
2856
  set array(value) {
2738
2857
  this.setArray(value);
2739
2858
  }
2859
+ computedLocation;
2740
2860
  get location() {
2741
2861
  return this.computedLocation;
2742
2862
  }
@@ -2860,29 +2980,33 @@ const defaultOptions$1 = {
2860
2980
  };
2861
2981
  class Pickable {
2862
2982
  constructor(array, options = {}) {
2863
- this.toItems = createMap((index) => this.array[index]);
2864
2983
  this.setArray(array);
2865
2984
  this.pick(options.initialPicks ?? defaultOptions$1.initialPicks);
2866
2985
  this.ready();
2867
2986
  }
2987
+ computedStatus;
2868
2988
  ready() {
2869
2989
  this.computedStatus = "ready";
2870
2990
  }
2991
+ computedArray;
2871
2992
  get array() {
2872
2993
  return this.computedArray;
2873
2994
  }
2874
2995
  set array(array) {
2875
2996
  this.setArray(array);
2876
2997
  }
2998
+ computedPicks;
2877
2999
  get picks() {
2878
3000
  return this.computedPicks;
2879
3001
  }
2880
3002
  set picks(indices) {
2881
3003
  this.pick(indices);
2882
3004
  }
3005
+ computedFirst;
2883
3006
  get first() {
2884
3007
  return this.computedFirst;
2885
3008
  }
3009
+ computedLast;
2886
3010
  get last() {
2887
3011
  return this.computedLast;
2888
3012
  }
@@ -2898,9 +3022,11 @@ class Pickable {
2898
3022
  get items() {
2899
3023
  return this.toItems(this.picks);
2900
3024
  }
3025
+ toItems = createMap((index) => this.array[index]);
2901
3026
  get multiple() {
2902
3027
  return this.picks.length > 1;
2903
3028
  }
3029
+ toPossiblePicks;
2904
3030
  setArray(array) {
2905
3031
  this.computedArray = array;
2906
3032
  this.toPossiblePicks = createFilter((index) => index >= 0 && index < array.length);
@@ -2915,7 +3041,7 @@ class Pickable {
2915
3041
  if (replace === "all") {
2916
3042
  return toUnique(possiblePicks);
2917
3043
  }
2918
- const possibleWithoutDuplicates = createFilter((possiblePick) => !find((pick) => pick === possiblePick)(this.picks || []))(possiblePicks);
3044
+ const possibleWithoutDuplicates = createFilter((possiblePick) => typeof find((pick) => pick === possiblePick)(this.picks || []) !== "number")(possiblePicks);
2919
3045
  switch (replace) {
2920
3046
  case "none":
2921
3047
  return createConcat(this.picks || [], possibleWithoutDuplicates)([]);
@@ -2927,9 +3053,9 @@ class Pickable {
2927
3053
  return possibleWithoutDuplicates;
2928
3054
  }
2929
3055
  if (possibleWithoutDuplicates.length > this.picks.length) {
2930
- return createSlice({ from: possibleWithoutDuplicates.length - this.picks.length })(possibleWithoutDuplicates);
3056
+ return createSlice(possibleWithoutDuplicates.length - this.picks.length)(possibleWithoutDuplicates);
2931
3057
  }
2932
- return new Pipeable(this.picks).pipe(createSlice({ from: possibleWithoutDuplicates.length }), createConcat(possibleWithoutDuplicates));
3058
+ return new Pipeable(this.picks).pipe(createSlice(possibleWithoutDuplicates.length), createConcat(possibleWithoutDuplicates));
2933
3059
  case "lifo":
2934
3060
  if (possibleWithoutDuplicates.length === 0) {
2935
3061
  return this.picks;
@@ -2938,9 +3064,9 @@ class Pickable {
2938
3064
  return possibleWithoutDuplicates;
2939
3065
  }
2940
3066
  if (possibleWithoutDuplicates.length > this.picks.length) {
2941
- return createSlice({ from: 0, to: possibleWithoutDuplicates.length - this.picks.length + 1 })(possibleWithoutDuplicates);
3067
+ return createSlice(0, possibleWithoutDuplicates.length - this.picks.length + 1)(possibleWithoutDuplicates);
2942
3068
  }
2943
- return new Pipeable(this.picks).pipe(createSlice({ from: 0, to: this.picks.length - possibleWithoutDuplicates.length }), createConcat(possibleWithoutDuplicates));
3069
+ return new Pipeable(this.picks).pipe(createSlice(0, this.picks.length - possibleWithoutDuplicates.length), createConcat(possibleWithoutDuplicates));
2944
3070
  }
2945
3071
  });
2946
3072
  this.computedFirst = Math.min(...this.picks);
@@ -2976,11 +3102,14 @@ function ensureIndices(indexOrIndices) {
2976
3102
  const toUnique = createUnique();
2977
3103
 
2978
3104
  class Sanitizeable {
3105
+ domPurifyConfig;
2979
3106
  constructor(html, options) {
2980
3107
  this.computedHtml = html;
2981
3108
  this.domPurifyConfig = options;
2982
3109
  this.ready();
2983
3110
  }
3111
+ computedDompurify;
3112
+ computedStatus;
2984
3113
  ready() {
2985
3114
  if (domIsAvailable()) {
2986
3115
  this.computedDompurify = createDOMPurify();
@@ -3004,6 +3133,7 @@ class Sanitizeable {
3004
3133
  get status() {
3005
3134
  return this.computedStatus;
3006
3135
  }
3136
+ computedHtml;
3007
3137
  setHtml(html) {
3008
3138
  this.computedHtml = html;
3009
3139
  return this;
@@ -3019,15 +3149,19 @@ class Sanitizeable {
3019
3149
  }
3020
3150
 
3021
3151
  class Searchable {
3152
+ searcherOptions;
3153
+ computedResults;
3022
3154
  constructor(candidates, options = {}) {
3023
3155
  this.searcherOptions = options;
3024
3156
  this.setCandidates(candidates);
3025
3157
  this.computedResults = [];
3026
3158
  this.ready();
3027
3159
  }
3160
+ computedStatus;
3028
3161
  ready() {
3029
3162
  this.computedStatus = "ready";
3030
3163
  }
3164
+ computedCandidates;
3031
3165
  get candidates() {
3032
3166
  return this.computedCandidates;
3033
3167
  }
@@ -3043,6 +3177,7 @@ class Searchable {
3043
3177
  get status() {
3044
3178
  return this.computedStatus;
3045
3179
  }
3180
+ computedSearcher;
3046
3181
  setCandidates(candidates) {
3047
3182
  this.computedCandidates = Array.from(candidates);
3048
3183
  this.computedSearcher = new Searcher(candidates, this.searcherOptions);
@@ -3063,6 +3198,8 @@ const defaultOptions = {
3063
3198
  statusKeySuffix: " status"
3064
3199
  };
3065
3200
  class Storeable {
3201
+ type;
3202
+ statusKeySuffix;
3066
3203
  constructor(key, options = {}) {
3067
3204
  this.constructing();
3068
3205
  this.type = options.type ?? defaultOptions.type;
@@ -3073,6 +3210,7 @@ class Storeable {
3073
3210
  constructing() {
3074
3211
  this.computedStatus = "constructing";
3075
3212
  }
3213
+ computedStatus;
3076
3214
  ready() {
3077
3215
  this.computedStatus = "ready";
3078
3216
  if (domIsAvailable()) {
@@ -3110,6 +3248,8 @@ class Storeable {
3110
3248
  get error() {
3111
3249
  return this.computedError;
3112
3250
  }
3251
+ computedKey;
3252
+ computedStatusKey;
3113
3253
  setKey(key) {
3114
3254
  let string;
3115
3255
  switch (this.status) {
@@ -3135,6 +3275,8 @@ class Storeable {
3135
3275
  }
3136
3276
  return this;
3137
3277
  }
3278
+ computedString;
3279
+ computedError;
3138
3280
  store(string) {
3139
3281
  try {
3140
3282
  this.storage.setItem(this.key, string);
@@ -3172,4 +3314,4 @@ class Storeable {
3172
3314
  }
3173
3315
  }
3174
3316
 
3175
- export { Animateable, Completeable, Copyable, Delayable, Dispatchable, Drawable, Fetchable, Fullscreenable, Grantable, Listenable, Navigateable, Pickable, Pipeable, Recognizeable, Resolveable, Sanitizeable, Searchable, Storeable, createClamp, createClip, createConcat, createDelete, createDetermine, createFilter, createFilterAsync, createForEachAsync, createInsert, createMap, createMapAsync, createReduce, createReduceAsync, createRename, createReorder, createReplace, createReverse, createSlice, createSlug, createSwap, createToEntries, createUnique, easingsNetInBack, easingsNetInCirc, easingsNetInCubic, easingsNetInExpo, easingsNetInOutBack, easingsNetInOutCirc, easingsNetInOutCubic, easingsNetInOutExpo, easingsNetInOutQuad, easingsNetInOutQuint, easingsNetInOutSine, easingsNetInQuad, easingsNetInQuart, easingsNetInQuint, easingsNetInSine, easingsNetOutBack, easingsNetOutCirc, easingsNetOutCubic, easingsNetOutExpo, easingsNetOutQuad, easingsNetOutQuint, easingsNetOutSine, ensureKeycombo, eventMatchesKeycombo, linear, materialAccelerated, materialDecelerated, materialStandard, toD, toFlattenedD, verouEase, verouEaseIn, verouEaseInOut, verouEaseOut };
3317
+ export { Animateable, Completeable, Copyable, Delayable, Dispatchable, Drawable, Fetchable, Fullscreenable, Grantable, Listenable, Navigateable, Pickable, Pipeable, Recognizeable, Resolveable, Sanitizeable, Searchable, Storeable, createClamp, createClip, createConcat, createDelete, createDetermine, createFilter, createFilterAsync, createForEachAsync, createInsert, createMap, createMapAsync, createReduce, createReduceAsync, createRename, createReorder, createReplace, createReverse, createSlice, createSlug, createSort, createSwap, createToEntries, createUnique, easingsNetInBack, easingsNetInCirc, easingsNetInCubic, easingsNetInExpo, easingsNetInOutBack, easingsNetInOutCirc, easingsNetInOutCubic, easingsNetInOutExpo, easingsNetInOutQuad, easingsNetInOutQuint, easingsNetInOutSine, easingsNetInQuad, easingsNetInQuart, easingsNetInQuint, easingsNetInSine, easingsNetOutBack, easingsNetOutCirc, easingsNetOutCubic, easingsNetOutExpo, easingsNetOutQuad, easingsNetOutQuint, easingsNetOutSine, ensureKeycombo, eventMatchesKeycombo, linear, materialAccelerated, materialDecelerated, materialStandard, toD, toFlattenedD, verouEase, verouEaseIn, verouEaseInOut, verouEaseOut };