@tspro/ts-utils-lib 1.17.0 → 1.19.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/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /* TsUtilsLib v1.17.0 | (c) 2023 PahkaSoft | Licensed under the MIT License */
1
+ /* TsUtilsLib v1.19.0 | (c) 2023 PahkaSoft | Licensed under the MIT License */
2
2
  var __defProp = Object.defineProperty;
3
3
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
4
  var __export = (target, all) => {
@@ -7,55 +7,51 @@ var __export = (target, all) => {
7
7
  };
8
8
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
9
9
 
10
- // src/utils/index.ts
11
- var utils_exports = {};
12
- __export(utils_exports, {
13
- Arr: () => arr_exports,
14
- Dom: () => dom_exports,
15
- Enum: () => enum_exports,
16
- Is: () => is_exports,
17
- Map: () => map_exports,
18
- Math: () => math_exports,
19
- Obj: () => obj_exports,
20
- Str: () => str_exports
21
- });
22
-
23
- // src/utils/arr/index.ts
24
- var arr_exports = {};
25
- __export(arr_exports, {
26
- arrayContains: () => arrayContains,
27
- chunckArray: () => chunckArray,
28
- duplicate: () => duplicate,
29
- fillArray: () => fillArray,
30
- getRangeArray: () => getRangeArray,
31
- getSequenceArray: () => getSequenceArray,
32
- isArray: () => isArray,
33
- mapRangeArray: () => mapRangeArray,
34
- mapSequenceArray: () => mapSequenceArray,
35
- removeDuplicates: () => removeDuplicates,
36
- removeDuplicatesCmp: () => removeDuplicatesCmp,
37
- toArray: () => toArray
38
- });
39
-
40
- // src/utils/is/index.ts
41
- var is_exports = {};
42
- __export(is_exports, {
10
+ // src/assert/index.ts
11
+ var assert_exports = {};
12
+ __export(assert_exports, {
13
+ array_elem: () => array_elem,
14
+ array_id: () => array_id,
15
+ assert: () => assert,
16
+ assertEnum: () => assertEnum,
17
+ eq: () => eq,
18
+ even: () => even,
19
+ fail: () => fail,
20
+ finite: () => finite,
21
+ in_group: () => in_group,
22
+ int: () => int,
23
+ int_between: () => int_between,
24
+ int_between_exclusive: () => int_between_exclusive,
25
+ int_eq: () => int_eq,
26
+ int_gt: () => int_gt,
27
+ int_gte: () => int_gte,
28
+ int_lt: () => int_lt,
29
+ int_lte: () => int_lte,
30
+ interrupt: () => interrupt,
43
31
  isArray: () => isArray,
32
+ isArrayIndex: () => isArrayIndex,
44
33
  isArrayOrUndefined: () => isArrayOrUndefined,
45
34
  isBoolean: () => isBoolean,
46
35
  isBooleanOrUndefined: () => isBooleanOrUndefined,
36
+ isDeepEqual: () => isDeepEqual,
47
37
  isEmptyArray: () => isEmptyArray,
48
38
  isEmptyArrayOrUndefined: () => isEmptyArrayOrUndefined,
49
39
  isEmptyString: () => isEmptyString,
50
40
  isEmptyStringOrUndefined: () => isEmptyStringOrUndefined,
51
41
  isEnumValue: () => isEnumValue,
52
42
  isEnumValueOrUndefined: () => isEnumValueOrUndefined,
43
+ isEqual: () => isEqual,
44
+ isEvenNumber: () => isEvenNumber,
45
+ isFalse: () => isFalse,
46
+ isFalseOrUndefined: () => isFalseOrUndefined,
53
47
  isFinite: () => isFinite2,
54
48
  isFunction: () => isFunction,
55
49
  isFunctionOrUndefined: () => isFunctionOrUndefined,
50
+ isIncluded: () => isIncluded,
56
51
  isInfinity: () => isInfinity,
57
52
  isInteger: () => isInteger,
58
53
  isIntegerBetween: () => isIntegerBetween,
54
+ isIntegerBetweenExclusive: () => isIntegerBetweenExclusive,
59
55
  isIntegerEq: () => isIntegerEq,
60
56
  isIntegerGt: () => isIntegerGt,
61
57
  isIntegerGte: () => isIntegerGte,
@@ -71,161 +67,951 @@ __export(is_exports, {
71
67
  isNull: () => isNull,
72
68
  isNullish: () => isNullish,
73
69
  isNumber: () => isNumber,
70
+ isNumberBetween: () => isNumberBetween,
71
+ isNumberBetweenExclusive: () => isNumberBetweenExclusive,
74
72
  isNumberOrUndefined: () => isNumberOrUndefined,
75
73
  isObject: () => isObject,
76
74
  isObjectOrUndefined: () => isObjectOrUndefined,
75
+ isOddNumber: () => isOddNumber,
77
76
  isPosInfinity: () => isPosInfinity,
78
77
  isString: () => isString,
79
78
  isStringOrUndefined: () => isStringOrUndefined,
80
- isUndefined: () => isUndefined
79
+ isThrowing: () => isThrowing,
80
+ isTrue: () => isTrue,
81
+ isTrueOrUndefined: () => isTrueOrUndefined,
82
+ isTypedObject: () => isTypedObject,
83
+ isUndefined: () => isUndefined,
84
+ odd: () => odd,
85
+ require: () => require2,
86
+ requireDefined: () => requireDefined,
87
+ setErrorClass: () => setErrorClass
81
88
  });
89
+ var errorConstructor = Error;
90
+ function setErrorClass(errorClass) {
91
+ errorConstructor = errorClass ?? Error;
92
+ }
93
+ function _fail(...msgs) {
94
+ let msg = msgs.join(", ");
95
+ throw new errorConstructor("Assertion Failed!" + (msg === "" ? "" : " " + msg));
96
+ }
97
+ function interrupt(msg) {
98
+ _fail("Interrupted!");
99
+ }
100
+ function assertEnum(enumVal, enumObj, name = "value") {
101
+ if (!guard_exports.isEnumValue(enumVal, enumObj))
102
+ _fail(`Invalid enum value ${enumVal}.`);
103
+ }
104
+ function int(value, msg) {
105
+ if (!guard_exports.isInteger(value))
106
+ _fail(`Expected ${value} to be integer.`, msg);
107
+ return value;
108
+ }
109
+ function eq(value1, value2, msg) {
110
+ if (value1 !== value2)
111
+ _fail(`Expected ${value1} to equal ${value2}.`, msg);
112
+ return value1;
113
+ }
114
+ function int_eq(value, compareTo, msg) {
115
+ if (!guard_exports.isIntegerEq(value, compareTo))
116
+ _fail(`Expected ${value} to be integer equal to ${compareTo}.`, msg);
117
+ return value;
118
+ }
119
+ function int_lt(value, compareTo, msg) {
120
+ if (!guard_exports.isIntegerLt(value, compareTo))
121
+ _fail(`Expected ${value} to be integer less than ${compareTo}.`, msg);
122
+ return value;
123
+ }
124
+ function int_lte(value, compareTo, msg) {
125
+ if (!guard_exports.isIntegerLte(value, compareTo))
126
+ _fail(`Expected ${value} to be integer less than or equal to ${compareTo}.`, msg);
127
+ return value;
128
+ }
129
+ function int_gt(value, compareTo, msg) {
130
+ if (!guard_exports.isIntegerGt(value, compareTo))
131
+ _fail(`Expected ${value} to be integer greater than ${compareTo}.`, msg);
132
+ return value;
133
+ }
134
+ function int_gte(value, compareTo, msg) {
135
+ if (!guard_exports.isIntegerGte(value, compareTo))
136
+ _fail(`Expected ${value} to be integer greater than or equal to ${compareTo}.`, msg);
137
+ return value;
138
+ }
139
+ function int_between(value, min, max, msg) {
140
+ if (!guard_exports.isIntegerBetween(value, min, max))
141
+ _fail(`Expected integer between ${min} <= ${value} <= ${max}.`, msg);
142
+ return value;
143
+ }
144
+ function int_between_exclusive(value, min, max, msg) {
145
+ if (!guard_exports.isIntegerBetweenExclusive(value, min, max))
146
+ _fail(`Expected integer between ${min} < ${value} < ${max}.`, msg);
147
+ return value;
148
+ }
149
+ function odd(value, msg) {
150
+ if (!guard_exports.isOddNumber(value))
151
+ _fail(`Expected ${value} to be odd number.`, msg);
152
+ return value;
153
+ }
154
+ function even(value, msg) {
155
+ if (!guard_exports.isEvenNumber(value))
156
+ _fail(`Expected ${value} to be even number.`, msg);
157
+ return value;
158
+ }
159
+ function in_group(value, group, msg) {
160
+ if (!group.some((e) => e === value))
161
+ _fail(`Expected ${value} to be in group [${group.map((v) => String(v)).join(", ")}].`, msg);
162
+ return value;
163
+ }
164
+ function finite(value, msg) {
165
+ if (!guard_exports.isFinite(value))
166
+ _fail(`Expected ${value} to be finite number.`, msg);
167
+ return value;
168
+ }
169
+ function array_id(array, index, msg) {
170
+ if (!guard_exports.isInteger(index) || !guard_exports.isArray(array) || index < 0 || index >= array.length)
171
+ _fail(`Expected ${index} to be array index in bounds [0..${array.length - 1}].`, msg);
172
+ return index;
173
+ }
174
+ function array_elem(array, index, msg) {
175
+ return array[array_id(array, index, msg)];
176
+ }
177
+ function assert(condition, msg) {
178
+ if (!condition) {
179
+ _fail(msg);
180
+ }
181
+ }
182
+ function require2(value, msg) {
183
+ if (value == null) {
184
+ _fail(`Expected ${value} not to be nullish`, msg);
185
+ }
186
+ return value;
187
+ }
188
+ function requireDefined(value, msg) {
189
+ if (value === void 0) {
190
+ _fail(`Expected ${value} not to be undefined`, msg);
191
+ }
192
+ return value;
193
+ }
194
+ function fail(msg) {
195
+ _fail(msg);
196
+ }
197
+ function isEqual(value1, value2, msg) {
198
+ if (!guard_exports.isEqual(value1, value2))
199
+ _fail(`Expected ${value1} to equal with ${value2}`, msg);
200
+ return true;
201
+ }
202
+ function isDeepEqual(value1, value2, msg) {
203
+ if (!guard_exports.isDeepEqual(value1, value2))
204
+ _fail(`Expected ${value1} to deep equal with ${value2}`, msg);
205
+ return true;
206
+ }
207
+ function isUndefined(value, msg) {
208
+ if (!guard_exports.isUndefined(value))
209
+ _fail(`Expected ${value} to be undefined`, msg);
210
+ return true;
211
+ }
212
+ function isNull(value, msg) {
213
+ if (!guard_exports.isNull(value))
214
+ _fail(`Expected ${value} to be null`, msg);
215
+ return true;
216
+ }
217
+ function isNullish(value, msg) {
218
+ if (!guard_exports.isNullish(value))
219
+ _fail(`Expected ${value} to be null or undefined`, msg);
220
+ return true;
221
+ }
222
+ function isObject(value, msg) {
223
+ if (!guard_exports.isObject(value))
224
+ _fail(`Expected ${value} to be object`, msg);
225
+ return true;
226
+ }
227
+ function isObjectOrUndefined(value, msg) {
228
+ if (!guard_exports.isObjectOrUndefined(value))
229
+ _fail(`Expected ${value} to be object or undefined`, msg);
230
+ return true;
231
+ }
232
+ function isTypedObject(obj, keys, msg) {
233
+ if (!guard_exports.isTypedObject(obj, keys))
234
+ _fail(`Expected ${obj} to be object with keys [${keys.map((key) => `'${String(key)}'`).join(", ")}]`, msg);
235
+ return true;
236
+ }
237
+ function isArray(value, msg) {
238
+ if (!guard_exports.isArray(value))
239
+ _fail(`Expected ${value} to be array`, msg);
240
+ return true;
241
+ }
242
+ function isArrayOrUndefined(value, msg) {
243
+ if (!guard_exports.isArrayOrUndefined(value))
244
+ _fail(`Expected ${value} to be array or undefined`, msg);
245
+ return true;
246
+ }
247
+ function isEmptyArray(value, msg) {
248
+ if (!guard_exports.isEmptyArray(value))
249
+ _fail(`Expected ${value} to be empty array`, msg);
250
+ return true;
251
+ }
252
+ function isNonEmptyArray(value, msg) {
253
+ if (!guard_exports.isNonEmptyArray(value))
254
+ _fail(`Expected ${value} to be non-empty array`, msg);
255
+ return true;
256
+ }
257
+ function isEmptyArrayOrUndefined(value, msg) {
258
+ if (!guard_exports.isEmptyArrayOrUndefined(value))
259
+ _fail(`Expected ${value} to be empty array or undefined`, msg);
260
+ return true;
261
+ }
262
+ function isNonEmptyArrayOrUndefined(value, msg) {
263
+ if (!guard_exports.isNonEmptyArrayOrUndefined(value))
264
+ _fail(`Expected ${value} to be non-empty array or undefined`, msg);
265
+ return true;
266
+ }
267
+ function isString(value, msg) {
268
+ if (!guard_exports.isString(value))
269
+ _fail(`Expected ${value} to be string`, msg);
270
+ return true;
271
+ }
272
+ function isEmptyString(value, msg) {
273
+ if (!guard_exports.isEmptyString(value))
274
+ _fail(`Expected ${value} to be empty string`, msg);
275
+ return true;
276
+ }
277
+ function isNonEmptyString(value, msg) {
278
+ if (!guard_exports.isNonEmptyString(value))
279
+ _fail(`Expected ${value} to be non-empty string`, msg);
280
+ return true;
281
+ }
282
+ function isStringOrUndefined(value, msg) {
283
+ if (!guard_exports.isStringOrUndefined(value))
284
+ _fail(`Expected ${value} to be string or undefined`, msg);
285
+ return true;
286
+ }
287
+ function isEmptyStringOrUndefined(value, msg) {
288
+ if (!guard_exports.isEmptyStringOrUndefined(value))
289
+ _fail(`Expected ${value} to be empty string or undefined`, msg);
290
+ return true;
291
+ }
292
+ function isNonEmptyStringOrUndefined(value, msg) {
293
+ if (!guard_exports.isNonEmptyStringOrUndefined(value))
294
+ _fail(`Expected ${value} to be non-empty string or undefined`, msg);
295
+ return true;
296
+ }
297
+ function isBoolean(value, msg) {
298
+ if (!guard_exports.isBoolean(value))
299
+ _fail(`Expected ${value} to be boolean`, msg);
300
+ return true;
301
+ }
302
+ function isBooleanOrUndefined(value, msg) {
303
+ if (!guard_exports.isBooleanOrUndefined(value))
304
+ _fail(`Expected ${value} to be boolean or undefined`, msg);
305
+ return true;
306
+ }
307
+ function isTrue(value, msg) {
308
+ if (!guard_exports.isTrue(value))
309
+ _fail(`Expected ${value} to be true`, msg);
310
+ return true;
311
+ }
312
+ function isTrueOrUndefined(value, msg) {
313
+ if (!guard_exports.isTrueOrUndefined(value))
314
+ _fail(`Expected ${value} to be true or undefined`, msg);
315
+ return true;
316
+ }
317
+ function isFalse(value, msg) {
318
+ if (!guard_exports.isFalse(value))
319
+ _fail(`Expected ${value} to be false`, msg);
320
+ return true;
321
+ }
322
+ function isFalseOrUndefined(value, msg) {
323
+ if (!guard_exports.isFalseOrUndefined(value))
324
+ _fail(`Expected ${value} to be false or undefined`, msg);
325
+ return true;
326
+ }
327
+ function isFunction(value, msg) {
328
+ if (!guard_exports.isFunction(value))
329
+ _fail(`Expected ${value} to be function`, msg);
330
+ return true;
331
+ }
332
+ function isFunctionOrUndefined(value, msg) {
333
+ if (!guard_exports.isFunctionOrUndefined(value))
334
+ _fail(`Expected ${value} to be function or undefined`, msg);
335
+ return true;
336
+ }
337
+ function isEnumValue(enumValue, enumObject, msg) {
338
+ if (!guard_exports.isEnumValue(enumValue, enumObject))
339
+ _fail(`Expected ${enumValue} to be enum value`, msg);
340
+ return true;
341
+ }
342
+ function isEnumValueOrUndefined(enumValue, enumObject, msg) {
343
+ if (!guard_exports.isEnumValueOrUndefined(enumValue, enumObject))
344
+ _fail(`Expected ${enumValue} to be enum value or undefined`, msg);
345
+ return true;
346
+ }
347
+ function isNumber(value, msg) {
348
+ if (!guard_exports.isNumber(value))
349
+ _fail(`Expected ${value} to be number`, msg);
350
+ return true;
351
+ }
352
+ function isNumberOrUndefined(value, msg) {
353
+ if (!guard_exports.isNumberOrUndefined(value))
354
+ _fail(`Expected ${value} to be number or undefined`, msg);
355
+ return true;
356
+ }
357
+ function isFinite2(value, msg) {
358
+ if (!guard_exports.isFinite(value))
359
+ _fail(`Expected ${value} to be finite`, msg);
360
+ return true;
361
+ }
362
+ function isInteger(value, msg) {
363
+ if (!guard_exports.isInteger(value))
364
+ _fail(`Expected ${value} to be integer`, msg);
365
+ return true;
366
+ }
367
+ function isIntegerOrUndefined(value, msg) {
368
+ if (!guard_exports.isIntegerOrUndefined(value))
369
+ _fail(`Expected ${value} to be integer or undefined`, msg);
370
+ return true;
371
+ }
372
+ function isIntegerEq(value, compareTo, msg) {
373
+ if (!guard_exports.isIntegerEq(value, compareTo))
374
+ _fail(`Expected ${value} to be integer equal to ${compareTo}`, msg);
375
+ return true;
376
+ }
377
+ function isIntegerGt(value, compareTo, msg) {
378
+ if (!guard_exports.isIntegerGt(value, compareTo))
379
+ _fail(`Expected ${value} to be integer > ${compareTo}`, msg);
380
+ return true;
381
+ }
382
+ function isIntegerGte(value, compareTo, msg) {
383
+ if (!guard_exports.isIntegerGte(value, compareTo))
384
+ _fail(`Expected ${value} to be integer >= ${compareTo}`, msg);
385
+ return true;
386
+ }
387
+ function isIntegerLt(value, compareTo, msg) {
388
+ if (!guard_exports.isIntegerLt(value, compareTo))
389
+ _fail(`Expected ${value} to be integer < ${compareTo}`, msg);
390
+ return true;
391
+ }
392
+ function isIntegerLte(value, compareTo, msg) {
393
+ if (!guard_exports.isIntegerLte(value, compareTo))
394
+ _fail(`Expected ${value} to be integer <= ${compareTo}`, msg);
395
+ return true;
396
+ }
397
+ function isIntegerBetween(value, min, max, msg) {
398
+ if (!guard_exports.isIntegerBetween(value, min, max))
399
+ _fail(`Expected integer ${min} <= ${value} <= ${max}.`, msg);
400
+ return true;
401
+ }
402
+ function isIntegerBetweenExclusive(value, min, max, msg) {
403
+ if (!guard_exports.isIntegerBetweenExclusive(value, min, max))
404
+ _fail(`Expected integer ${min} < ${value} < ${max}.`, msg);
405
+ return true;
406
+ }
407
+ function isNumberBetween(value, min, max, msg) {
408
+ if (!guard_exports.isNumberBetween(value, min, max))
409
+ _fail(`Expected number ${min} <= ${value} <= ${max}.`, msg);
410
+ return true;
411
+ }
412
+ function isNumberBetweenExclusive(value, min, max, msg) {
413
+ if (!guard_exports.isNumberBetweenExclusive(value, min, max))
414
+ _fail(`Expected number ${min} < ${value} < ${max}.`, msg);
415
+ return true;
416
+ }
417
+ function isNaNValue(value, msg) {
418
+ if (!guard_exports.isNaNValue(value))
419
+ _fail(`Expected ${value} to be NaN.`, msg);
420
+ return true;
421
+ }
422
+ function isInfinity(value, msg) {
423
+ if (!guard_exports.isInfinity(value))
424
+ _fail(`Expected ${value} to be +-Infinity.`, msg);
425
+ return true;
426
+ }
427
+ function isPosInfinity(value, msg) {
428
+ if (!guard_exports.isPosInfinity(value))
429
+ _fail(`Expected ${value} to be +Infinity.`, msg);
430
+ return true;
431
+ }
432
+ function isNegInfinity(value, msg) {
433
+ if (!guard_exports.isNegInfinity(value))
434
+ _fail(`Expected ${value} to be -Infinity.`, msg);
435
+ return true;
436
+ }
437
+ function isOddNumber(value, msg) {
438
+ if (!guard_exports.isOddNumber(value))
439
+ _fail(`Expected ${value} to odd number.`, msg);
440
+ return true;
441
+ }
442
+ function isEvenNumber(value, msg) {
443
+ if (!guard_exports.isEvenNumber(value))
444
+ _fail(`Expected ${value} to even number.`, msg);
445
+ return true;
446
+ }
447
+ function isIncluded(value, array, msg) {
448
+ if (!guard_exports.isIncluded(value, array))
449
+ _fail(`Expected ${value} to be included in [${array.map((v) => String(v)).join(", ")}].`, msg);
450
+ return true;
451
+ }
452
+ function isArrayIndex(index, array, msg) {
453
+ if (!guard_exports.isArrayIndex(index, array))
454
+ _fail(`Expected ${index} to be index for array [${array.map((v) => String(v)).join(", ")}]`, msg);
455
+ return true;
456
+ }
457
+ function isThrowing(throwTestFn, msg) {
458
+ if (!guard_exports.isThrowing(throwTestFn))
459
+ _fail(`Expected to throw`, msg);
460
+ return true;
461
+ }
462
+
463
+ // src/web/cookies.ts
464
+ var cookies_exports = {};
465
+ __export(cookies_exports, {
466
+ accept: () => accept,
467
+ decline: () => decline,
468
+ erase: () => erase,
469
+ eraseAll: () => eraseAll,
470
+ isConsentPending: () => isConsentPending,
471
+ read: () => read,
472
+ readBool: () => readBool,
473
+ readInt: () => readInt,
474
+ save: () => save,
475
+ setExpireDays: () => setExpireDays
476
+ });
477
+ var ConsentCookieName = "ConsentCookie";
478
+ var _consent;
479
+ var _expires;
480
+ var str = _read(ConsentCookieName);
481
+ _consent = str === "accept" /* Accept */ || str === "decline" /* Decline */ ? str : void 0;
482
+ function _getList() {
483
+ let s = document.cookie;
484
+ return s.split(";").map((c) => c.trim());
485
+ }
486
+ function _save(name, value) {
487
+ let cookie = name + "=" + value.toString() + ";sameSite=Lax;";
488
+ if (_expires) {
489
+ cookie += "expires=" + _expires.toUTCString() + ";";
490
+ }
491
+ document.cookie = cookie;
492
+ return value;
493
+ }
494
+ function _read(name, defaultValue) {
495
+ let str2 = _getList().find((c) => c.startsWith(name + "="));
496
+ return str2 === void 0 ? defaultValue : str2.substring(name.length + 1);
497
+ }
498
+ function _erase(name) {
499
+ document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 UTC;";
500
+ }
501
+ function setExpireDays(days) {
502
+ _expires = /* @__PURE__ */ new Date();
503
+ _expires.setDate(_expires.getDate() + days);
504
+ }
505
+ function isConsentPending() {
506
+ return _consent === void 0;
507
+ }
508
+ function accept() {
509
+ _consent = "accept" /* Accept */;
510
+ _save(ConsentCookieName, _consent);
511
+ }
512
+ function decline() {
513
+ _consent = "decline" /* Decline */;
514
+ _save(ConsentCookieName, _consent);
515
+ }
516
+ function save(name, value) {
517
+ if (_consent === "accept" /* Accept */)
518
+ _save(name, value);
519
+ return value;
520
+ }
521
+ function read(name, defaultValue) {
522
+ if (_consent === "accept" /* Accept */)
523
+ return _read(name, defaultValue) ?? defaultValue;
524
+ else
525
+ return defaultValue;
526
+ }
527
+ function readInt(name, defaultValue) {
528
+ if (_consent === "accept" /* Accept */) {
529
+ let str2 = _read(name);
530
+ return str2 === void 0 ? defaultValue : parseInt(str2);
531
+ } else {
532
+ return defaultValue;
533
+ }
534
+ }
535
+ function readBool(name, defaultValue) {
536
+ if (_consent === "accept" /* Accept */) {
537
+ let str2 = _read(name);
538
+ return str2 === void 0 ? defaultValue : /true|1/i.test(str2);
539
+ } else {
540
+ return defaultValue;
541
+ }
542
+ }
543
+ function erase(name) {
544
+ if (_consent === "accept" /* Accept */ || name === ConsentCookieName)
545
+ _erase(name);
546
+ }
547
+ function eraseAll() {
548
+ document.cookie.split(";").forEach((c) => erase(c.trim().split("=")[0]));
549
+ }
550
+
551
+ // src/web/device.ts
552
+ var device_exports = {};
553
+ __export(device_exports, {
554
+ DPI: () => DPI,
555
+ FontSize: () => FontSize,
556
+ HostAddress: () => HostAddress,
557
+ IsMobileDevice: () => IsMobileDevice,
558
+ IsTouchDevice: () => IsTouchDevice,
559
+ PxPerMm: () => PxPerMm,
560
+ ScrollbarWidth: () => ScrollbarWidth,
561
+ mmToPx: () => mmToPx,
562
+ pxToMm: () => pxToMm,
563
+ toPx: () => toPx
564
+ });
565
+ function getDPI() {
566
+ let el = document.createElement("div");
567
+ el.style.width = "1in";
568
+ document.body.appendChild(el);
569
+ let dpi = el.offsetWidth;
570
+ el.remove();
571
+ return dpi || 96;
572
+ }
573
+ function getScrollBarWidth() {
574
+ try {
575
+ let outer = document.createElement("div");
576
+ outer.style.visibility = "hidden";
577
+ outer.style.width = "100px";
578
+ document.body.appendChild(outer);
579
+ let widthNoScroll = outer.offsetWidth;
580
+ outer.style.overflow = "scroll";
581
+ let inner = document.createElement("div");
582
+ inner.style.width = "100%";
583
+ outer.appendChild(inner);
584
+ let widthWithScroll = inner.offsetWidth;
585
+ if (outer.parentNode) {
586
+ outer.parentNode.removeChild(outer);
587
+ }
588
+ return widthNoScroll - widthWithScroll;
589
+ } catch (e) {
590
+ return 0;
591
+ }
592
+ }
593
+ function getSystemFontSize() {
594
+ let tmpDiv = document.createElement("div");
595
+ tmpDiv.style.cssText = "display:inline-block; padding:0; line-height:1; position:absolute; visibility:hidden; font-size:1em";
596
+ tmpDiv.appendChild(document.createTextNode("M"));
597
+ document.body.appendChild(tmpDiv);
598
+ let fontsize = tmpDiv.offsetHeight;
599
+ document.body.removeChild(tmpDiv);
600
+ return fontsize;
601
+ }
602
+ function getIsTouchDevice() {
603
+ if ("ontouchstart" in window || "DocumentTouch" in window || "createTouch" in document && "createTouchList" in document) {
604
+ return true;
605
+ }
606
+ var prefixes = " -webkit- -moz- -o- -ms- ".split(" ");
607
+ var mq = function(query2) {
608
+ return window.matchMedia(query2).matches;
609
+ };
610
+ var query = ["(", prefixes.join("touch-enabled),("), "heartz", ")"].join("");
611
+ return mq(query);
612
+ }
613
+ function getIsMobileDevice() {
614
+ let a = navigator.userAgent || navigator.vendor || window.opera;
615
+ return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4));
616
+ }
617
+ function getHostAddress() {
618
+ return location.protocol + "//" + location.host;
619
+ }
620
+ var UnitRegExp = /^(mm|cm|in|inch|px|em)$/;
621
+ var ValueUnitRegExp = /^([0-9\\.]+)(.*)$/;
622
+ var DPI = getDPI();
623
+ var PxPerMm = DPI / 25.4;
624
+ var ScrollbarWidth = getScrollBarWidth();
625
+ var FontSize = getSystemFontSize();
626
+ var IsTouchDevice = getIsTouchDevice();
627
+ var IsMobileDevice = getIsMobileDevice();
628
+ var HostAddress = getHostAddress();
629
+ function pxToMm(px) {
630
+ return px / PxPerMm;
631
+ }
632
+ function mmToPx(mm) {
633
+ return mm * PxPerMm;
634
+ }
635
+ function toPx(input) {
636
+ if (typeof input === "number") {
637
+ return input;
638
+ }
639
+ let value = NaN;
640
+ let unit = void 0;
641
+ let match = input.toString().match(ValueUnitRegExp);
642
+ if (match && match[1]) {
643
+ value = parseFloat(match[1]);
644
+ let unitStr = match[2] ? match[2].toLowerCase() : "undefined";
645
+ let unitStrOk = UnitRegExp.test(unitStr);
646
+ unit = unitStrOk ? unitStr : void 0;
647
+ if (!unit) {
648
+ console.log("Unknown unit '" + unitStr + "' => using 'px'.");
649
+ }
650
+ } else {
651
+ value = parseFloat(input);
652
+ }
653
+ assert_exports.isFinite(value, "value in function toPx");
654
+ switch (unit) {
655
+ case "mm":
656
+ return mmToPx(value);
657
+ case "cm":
658
+ return mmToPx(value) * 10;
659
+ case "in":
660
+ case "inch":
661
+ return mmToPx(value) * 25.4;
662
+ case "em":
663
+ return FontSize * value;
664
+ default:
665
+ case "px":
666
+ return value;
667
+ }
668
+ }
669
+
670
+ // src/guard/index.ts
671
+ var guard_exports = {};
672
+ __export(guard_exports, {
673
+ isArray: () => isArray2,
674
+ isArrayIndex: () => isArrayIndex2,
675
+ isArrayOrUndefined: () => isArrayOrUndefined2,
676
+ isBoolean: () => isBoolean2,
677
+ isBooleanOrUndefined: () => isBooleanOrUndefined2,
678
+ isDeepEqual: () => isDeepEqual2,
679
+ isEmptyArray: () => isEmptyArray2,
680
+ isEmptyArrayOrUndefined: () => isEmptyArrayOrUndefined2,
681
+ isEmptyString: () => isEmptyString2,
682
+ isEmptyStringOrUndefined: () => isEmptyStringOrUndefined2,
683
+ isEnumValue: () => isEnumValue3,
684
+ isEnumValueOrUndefined: () => isEnumValueOrUndefined2,
685
+ isEqual: () => isEqual2,
686
+ isEvenNumber: () => isEvenNumber2,
687
+ isFalse: () => isFalse2,
688
+ isFalseOrUndefined: () => isFalseOrUndefined2,
689
+ isFinite: () => isFinite3,
690
+ isFunction: () => isFunction2,
691
+ isFunctionOrUndefined: () => isFunctionOrUndefined2,
692
+ isIncluded: () => isIncluded2,
693
+ isInfinity: () => isInfinity2,
694
+ isInteger: () => isInteger2,
695
+ isIntegerBetween: () => isIntegerBetween2,
696
+ isIntegerBetweenExclusive: () => isIntegerBetweenExclusive2,
697
+ isIntegerEq: () => isIntegerEq2,
698
+ isIntegerGt: () => isIntegerGt2,
699
+ isIntegerGte: () => isIntegerGte2,
700
+ isIntegerLt: () => isIntegerLt2,
701
+ isIntegerLte: () => isIntegerLte2,
702
+ isIntegerOrUndefined: () => isIntegerOrUndefined2,
703
+ isNaNValue: () => isNaNValue2,
704
+ isNegInfinity: () => isNegInfinity2,
705
+ isNonEmptyArray: () => isNonEmptyArray2,
706
+ isNonEmptyArrayOrUndefined: () => isNonEmptyArrayOrUndefined2,
707
+ isNonEmptyString: () => isNonEmptyString2,
708
+ isNonEmptyStringOrUndefined: () => isNonEmptyStringOrUndefined2,
709
+ isNull: () => isNull2,
710
+ isNullish: () => isNullish2,
711
+ isNumber: () => isNumber2,
712
+ isNumberBetween: () => isNumberBetween2,
713
+ isNumberBetweenExclusive: () => isNumberBetweenExclusive2,
714
+ isNumberOrUndefined: () => isNumberOrUndefined2,
715
+ isObject: () => isObject2,
716
+ isObjectOrUndefined: () => isObjectOrUndefined2,
717
+ isOddNumber: () => isOddNumber2,
718
+ isPosInfinity: () => isPosInfinity2,
719
+ isString: () => isString2,
720
+ isStringOrUndefined: () => isStringOrUndefined2,
721
+ isThrowing: () => isThrowing2,
722
+ isTrue: () => isTrue2,
723
+ isTrueOrUndefined: () => isTrueOrUndefined2,
724
+ isTypedObject: () => isTypedObject2,
725
+ isUndefined: () => isUndefined2,
726
+ tryOr: () => tryOr
727
+ });
728
+
729
+ // src/utils/obj/index.ts
730
+ var obj_exports = {};
731
+ __export(obj_exports, {
732
+ deepEqual: () => deepEqual,
733
+ hasProperties: () => hasProperties,
734
+ isObject: () => isObject2
735
+ });
736
+ function hasProperties(obj, props) {
737
+ return isObject2(obj) && props.every((p) => p in obj);
738
+ }
739
+ function deepEqual(a, b) {
740
+ if (a === b) return true;
741
+ if (a === null || b === null) return false;
742
+ if (typeof a !== "object" || typeof b !== "object") return false;
743
+ if (Array.isArray(a) && Array.isArray(b)) {
744
+ if (a.length !== b.length) return false;
745
+ return a.every((val, i) => deepEqual(val, b[i]));
746
+ }
747
+ if (Array.isArray(a) !== Array.isArray(b)) return false;
748
+ const keysA = Object.keys(a);
749
+ const keysB = Object.keys(b);
750
+ if (keysA.length !== keysB.length) return false;
751
+ for (const key of keysA) {
752
+ if (!Object.prototype.hasOwnProperty.call(b, key)) return false;
753
+ if (!deepEqual(a[key], b[key])) return false;
754
+ }
755
+ return true;
756
+ }
82
757
 
83
758
  // src/utils/enum/index.ts
84
759
  var enum_exports = {};
85
760
  __export(enum_exports, {
86
- getEnumValues: () => getEnumValues
761
+ assertEnumValue: () => assertEnumValue,
762
+ forEachEnum: () => forEachEnum,
763
+ getEnumEntries: () => getEnumEntries,
764
+ getEnumKey: () => getEnumKey,
765
+ getEnumKeys: () => getEnumKeys,
766
+ getEnumValues: () => getEnumValues,
767
+ isEnumValue: () => isEnumValue2
87
768
  });
769
+ function getEnumKeys(e) {
770
+ return Object.keys(e).filter((k) => isNaN(Number(k)));
771
+ }
88
772
  function getEnumValues(e) {
89
- return Object.keys(e).filter((key) => Number.isNaN(Number(key))).map((key) => e[key]);
773
+ return getEnumKeys(e).map((k) => e[k]);
774
+ }
775
+ function getEnumEntries(e) {
776
+ return getEnumKeys(e).map((k) => [k, e[k]]);
777
+ }
778
+ function getEnumKey(e, value) {
779
+ return getEnumKeys(e).find((k) => e[k] === value);
780
+ }
781
+ function forEachEnum(e, callback) {
782
+ for (const [k, v] of getEnumEntries(e)) callback(k, v);
783
+ }
784
+ function isEnumValue2(e, value) {
785
+ return getEnumValues(e).includes(value);
786
+ }
787
+ function assertEnumValue(e, value) {
788
+ if (!isEnumValue2(e, value)) {
789
+ throw new TypeError(`Invalid enum value: ${String(value)}`);
790
+ }
90
791
  }
91
792
 
92
- // src/utils/is/index.ts
93
- function isUndefined(value) {
793
+ // src/guard/index.ts
794
+ function isEqual2(value1, value2) {
795
+ return value1 === value2;
796
+ }
797
+ function isDeepEqual2(value1, value2) {
798
+ return deepEqual(value1, value2);
799
+ }
800
+ function isUndefined2(value) {
94
801
  return value === void 0;
95
802
  }
96
- function isNull(value) {
803
+ function isNull2(value) {
97
804
  return value === null;
98
805
  }
99
- function isNullish(value) {
806
+ function isNullish2(value) {
100
807
  return value === void 0 || value === null;
101
808
  }
102
- function isObject(value) {
103
- return typeof value === "object" && value !== null && !isArray(value);
809
+ function isObject2(value) {
810
+ return typeof value === "object" && value !== null && !isArray2(value);
104
811
  }
105
- function isObjectOrUndefined(value) {
106
- return value === void 0 || isObject(value);
812
+ function isObjectOrUndefined2(value) {
813
+ return value === void 0 || isObject2(value);
107
814
  }
108
- function isArray(a) {
815
+ function isTypedObject2(obj, keys) {
816
+ return isObject2(obj) && keys.every((k) => k in obj);
817
+ }
818
+ function isArray2(a) {
109
819
  return !!a && Object.prototype.toString.call(a) === "[object Array]";
110
820
  }
111
- function isArrayOrUndefined(value) {
112
- return value === void 0 || isArray(value);
821
+ function isArrayOrUndefined2(value) {
822
+ return value === void 0 || isArray2(value);
113
823
  }
114
- function isEmptyArray(a) {
115
- return isArray(a) && a.length === 0;
824
+ function isEmptyArray2(a) {
825
+ return isArray2(a) && a.length === 0;
116
826
  }
117
- function isNonEmptyArray(a) {
118
- return isArray(a) && a.length > 0;
827
+ function isNonEmptyArray2(a) {
828
+ return isArray2(a) && a.length > 0;
119
829
  }
120
- function isEmptyArrayOrUndefined(a) {
121
- return isArray(a) && a.length === 0 || a === void 0;
830
+ function isEmptyArrayOrUndefined2(a) {
831
+ return isArray2(a) && a.length === 0 || a === void 0;
122
832
  }
123
- function isNonEmptyArrayOrUndefined(a) {
124
- return isArray(a) && a.length > 0 || a === void 0;
833
+ function isNonEmptyArrayOrUndefined2(a) {
834
+ return isArray2(a) && a.length > 0 || a === void 0;
125
835
  }
126
- function isString(value) {
836
+ function isString2(value) {
127
837
  return typeof value === "string";
128
838
  }
129
- function isEmptyString(value) {
839
+ function isEmptyString2(value) {
130
840
  return typeof value === "string" && value.length === 0;
131
841
  }
132
- function isNonEmptyString(value) {
842
+ function isNonEmptyString2(value) {
133
843
  return typeof value === "string" && value.length > 0;
134
844
  }
135
- function isStringOrUndefined(value) {
845
+ function isStringOrUndefined2(value) {
136
846
  return value === void 0 || typeof value === "string";
137
847
  }
138
- function isEmptyStringOrUndefined(value) {
848
+ function isEmptyStringOrUndefined2(value) {
139
849
  return typeof value === "string" && value.length === 0 || value === void 0;
140
850
  }
141
- function isNonEmptyStringOrUndefined(value) {
851
+ function isNonEmptyStringOrUndefined2(value) {
142
852
  return typeof value === "string" && value.length > 0 || value === void 0;
143
853
  }
144
- function isBoolean(value) {
854
+ function isBoolean2(value) {
145
855
  return typeof value === "boolean";
146
856
  }
147
- function isBooleanOrUndefined(value) {
857
+ function isBooleanOrUndefined2(value) {
148
858
  return value === void 0 || typeof value === "boolean";
149
859
  }
150
- function isFunction(value) {
860
+ function isTrue2(value) {
861
+ return value === true;
862
+ }
863
+ function isTrueOrUndefined2(value) {
864
+ return value === true || value === void 0;
865
+ }
866
+ function isFalse2(value) {
867
+ return value === false;
868
+ }
869
+ function isFalseOrUndefined2(value) {
870
+ return value === false || value === void 0;
871
+ }
872
+ function isFunction2(value) {
151
873
  return typeof value === "function";
152
874
  }
153
- function isFunctionOrUndefined(value) {
875
+ function isFunctionOrUndefined2(value) {
154
876
  return value === void 0 || typeof value === "function";
155
877
  }
156
- function isEnumValue(value, enumObj, name = "value") {
878
+ function isEnumValue3(value, enumObj, name = "value") {
157
879
  return getEnumValues(enumObj).some((v) => v === value);
158
880
  }
159
- function isEnumValueOrUndefined(value, enumObj, name = "value") {
881
+ function isEnumValueOrUndefined2(value, enumObj, name = "value") {
160
882
  return value === void 0 || getEnumValues(enumObj).some((v) => v === value);
161
883
  }
162
- function isNumber(value) {
884
+ function isNumber2(value) {
163
885
  return typeof value === "number";
164
886
  }
165
- function isNumberOrUndefined(value) {
887
+ function isNumberOrUndefined2(value) {
166
888
  return typeof value === "number" || value === void 0;
167
889
  }
168
- function isFinite2(value) {
890
+ function isFinite3(value) {
169
891
  return typeof value === "number" && Number.isFinite(value);
170
892
  }
171
- function isInteger(n) {
172
- return typeof n === "number" && isFinite2(n) && n === Math.trunc(n);
893
+ function isInteger2(n) {
894
+ return typeof n === "number" && isFinite3(n) && n === Math.trunc(n);
895
+ }
896
+ function isIntegerOrUndefined2(n) {
897
+ return typeof n === "number" && isFinite3(n) && n === Math.trunc(n) || n === void 0;
173
898
  }
174
- function isIntegerOrUndefined(n) {
175
- return typeof n === "number" && isFinite2(n) && n === Math.trunc(n) || n === void 0;
899
+ function isIntegerEq2(value, compareTo) {
900
+ return isInteger2(value) && value === compareTo;
176
901
  }
177
- function isIntegerEq(value, compareTo) {
178
- return isInteger(value) && value === compareTo;
902
+ function isIntegerGt2(value, compareTo) {
903
+ return isInteger2(value) && isNumber2(compareTo) && value > compareTo;
179
904
  }
180
- function isIntegerGt(value, compareTo) {
181
- return isInteger(value) && value > compareTo;
905
+ function isIntegerGte2(value, compareTo) {
906
+ return isInteger2(value) && isNumber2(compareTo) && value >= compareTo;
182
907
  }
183
- function isIntegerGte(value, compareTo) {
184
- return isInteger(value) && value >= compareTo;
908
+ function isIntegerLt2(value, compareTo) {
909
+ return isInteger2(value) && isNumber2(compareTo) && value < compareTo;
185
910
  }
186
- function isIntegerLt(value, compareTo) {
187
- return isInteger(value) && value < compareTo;
911
+ function isIntegerLte2(value, compareTo) {
912
+ return isInteger2(value) && isNumber2(compareTo) && value <= compareTo;
188
913
  }
189
- function isIntegerLte(value, compareTo) {
190
- return isInteger(value) && value <= compareTo;
914
+ function isIntegerBetween2(value, min, max) {
915
+ return isInteger2(value) && isNumber2(min) && isNumber2(max) && value >= min && value <= max;
191
916
  }
192
- function isIntegerBetween(value, min, max) {
193
- return isInteger(value) && value >= min && value <= max;
917
+ function isIntegerBetweenExclusive2(value, min, max) {
918
+ return isInteger2(value) && isNumber2(min) && isNumber2(max) && value > min && value < max;
194
919
  }
195
- function isNaNValue(value) {
920
+ function isNumberBetween2(value, min, max) {
921
+ return isNumber2(value) && isNumber2(min) && isNumber2(max) && value >= min && value <= max;
922
+ }
923
+ function isNumberBetweenExclusive2(value, min, max) {
924
+ return isNumber2(value) && isNumber2(min) && isNumber2(max) && value > min && value < max;
925
+ }
926
+ function isNaNValue2(value) {
196
927
  return typeof value === "number" && Number.isNaN(value);
197
928
  }
198
- function isInfinity(value) {
929
+ function isInfinity2(value) {
199
930
  return typeof value === "number" && Math.abs(value) === Infinity;
200
931
  }
201
- function isPosInfinity(value) {
932
+ function isPosInfinity2(value) {
202
933
  return typeof value === "number" && value === Infinity;
203
934
  }
204
- function isNegInfinity(value) {
935
+ function isNegInfinity2(value) {
205
936
  return typeof value === "number" && value === -Infinity;
206
937
  }
938
+ function isOddNumber2(value) {
939
+ return isInteger2(value) && value % 2 === 1;
940
+ }
941
+ function isEvenNumber2(value) {
942
+ return isInteger2(value) && value % 2 === 0;
943
+ }
944
+ function isIncluded2(value, array) {
945
+ return array.includes(value);
946
+ }
947
+ function isArrayIndex2(index, array) {
948
+ return isInteger2(index) && isArray2(array) && index >= 0 && index < array.length;
949
+ }
950
+ function isThrowing2(throwTestFn) {
951
+ try {
952
+ throwTestFn();
953
+ return false;
954
+ } catch (err) {
955
+ return true;
956
+ }
957
+ }
958
+ function tryOr(tryFn, orVal) {
959
+ try {
960
+ return tryFn();
961
+ } catch (err) {
962
+ return isFunction2(orVal) ? orVal() : orVal;
963
+ }
964
+ }
965
+
966
+ // src/utils/index.ts
967
+ var utils_exports = {};
968
+ __export(utils_exports, {
969
+ Arr: () => arr_exports,
970
+ Dom: () => dom_exports,
971
+ Enum: () => enum_exports,
972
+ Is: () => Is,
973
+ Map: () => map_exports,
974
+ Math: () => math_exports,
975
+ Obj: () => obj_exports,
976
+ Str: () => str_exports
977
+ });
207
978
 
208
979
  // src/utils/arr/index.ts
980
+ var arr_exports = {};
981
+ __export(arr_exports, {
982
+ arrayContains: () => arrayContains,
983
+ chunckArray: () => chunckArray,
984
+ duplicate: () => duplicate,
985
+ fillArray: () => fillArray,
986
+ getRangeArray: () => getRangeArray,
987
+ getSequenceArray: () => getSequenceArray,
988
+ isArray: () => isArray2,
989
+ mapRangeArray: () => mapRangeArray,
990
+ mapSequenceArray: () => mapSequenceArray,
991
+ removeDuplicates: () => removeDuplicates,
992
+ removeDuplicatesCmp: () => removeDuplicatesCmp,
993
+ toArray: () => toArray
994
+ });
209
995
  function toArray(a) {
210
- return isArray(a) ? a : [a];
996
+ return isArray2(a) ? a : [a];
211
997
  }
212
998
  function duplicate(a) {
213
999
  return a === void 0 ? a : a.slice();
214
1000
  }
215
- function removeDuplicates(a) {
216
- return a.filter((item, pos, arr) => arr.indexOf(item) === pos);
1001
+ function removeDuplicates(arr, compareFn) {
1002
+ return compareFn !== void 0 ? arr.filter((a, id, self) => id === self.findIndex((b) => compareFn(a, b))) : arr.filter((a, id, self) => id === self.indexOf(a));
217
1003
  }
218
- function removeDuplicatesCmp(arr, cmp2) {
219
- return arr.filter((t1, index, self) => index === self.findIndex((t2) => cmp2(t1, t2)));
1004
+ function removeDuplicatesCmp(arr, compareFn) {
1005
+ return arr.filter((a, id, self) => id === self.findIndex((b) => compareFn(a, b)));
220
1006
  }
221
1007
  function fillArray(fillValue, fillCount) {
222
- if (!isInteger(fillCount) || fillCount < 0) {
1008
+ if (!isInteger2(fillCount) || fillCount < 0) {
223
1009
  throw new Error("fillArray: Invalid fillCount = " + fillCount);
224
1010
  }
225
1011
  return new Array(fillCount).fill(fillValue);
226
1012
  }
227
1013
  function mapSequenceArray(len, fn) {
228
- if (!isInteger(len) || len < 0) {
1014
+ if (!isInteger2(len) || len < 0) {
229
1015
  throw new Error("mapSequenceArray: Invalid len = " + len);
230
1016
  }
231
1017
  let arr = new Array(len);
@@ -238,10 +1024,10 @@ function getSequenceArray(len) {
238
1024
  return mapSequenceArray(len, (i) => i);
239
1025
  }
240
1026
  function mapRangeArray(start, end, fn) {
241
- if (!isInteger(start)) {
1027
+ if (!isInteger2(start)) {
242
1028
  throw new Error("mapRangeArray: Invalid start = " + end);
243
1029
  }
244
- if (!isInteger(end)) {
1030
+ if (!isInteger2(end)) {
245
1031
  throw new Error("mapRangeArray: Invalid end = " + end);
246
1032
  }
247
1033
  let len = Math.abs(end - start) + 1;
@@ -258,7 +1044,7 @@ function arrayContains(arg, item) {
258
1044
  return arg.indexOf(item) >= 0;
259
1045
  }
260
1046
  function chunckArray(arr, chunckSize) {
261
- if (!isInteger(chunckSize) || chunckSize < 1) {
1047
+ if (!isInteger2(chunckSize) || chunckSize < 1) {
262
1048
  throw new Error("chunckArray: Invalid chunckSize = " + chunckSize);
263
1049
  }
264
1050
  let result = [];
@@ -291,261 +1077,8 @@ __export(dom_exports, {
291
1077
  setWidth: () => setWidth,
292
1078
  styleLayoutChanged: () => styleLayoutChanged
293
1079
  });
294
-
295
- // src/modules/assert.ts
296
- var Assert;
297
- ((Assert2) => {
298
- let errorConstructor = Error;
299
- function setErrorClass(ec) {
300
- errorConstructor = ec ?? Error;
301
- }
302
- Assert2.setErrorClass = setErrorClass;
303
- function throwError(errorMsg, userMsg) {
304
- throw new errorConstructor("Assertion Error: " + errorMsg + (userMsg ? " " + userMsg : ""));
305
- }
306
- function is_int(a) {
307
- return typeof a === "number" && isFinite(a) && a === Math.trunc(a);
308
- }
309
- function is_number(a) {
310
- return typeof a === "number";
311
- }
312
- function assert(a, userMsg) {
313
- if (!a) {
314
- throwError(userMsg ?? "Assertion failed!");
315
- }
316
- }
317
- Assert2.assert = assert;
318
- function assertEnum(value, enumObj, name = "value") {
319
- if (!getEnumValues(enumObj).some((v) => v === value)) {
320
- throw new TypeError(`Invalid ${name} enum value: ${value}`);
321
- }
322
- }
323
- Assert2.assertEnum = assertEnum;
324
- function interrupt(userMsg) {
325
- throwError(userMsg ?? "Interrupted!");
326
- }
327
- Assert2.interrupt = interrupt;
328
- function int(a, userMsg) {
329
- if (!is_int(a)) {
330
- throwError(`Expected ${a} to be integer.`, userMsg);
331
- }
332
- return a;
333
- }
334
- Assert2.int = int;
335
- function eq(a, b, userMsg) {
336
- if (a !== b) {
337
- throwError(`Expected ${a} to equal ${b}.`, userMsg);
338
- }
339
- return a;
340
- }
341
- Assert2.eq = eq;
342
- function int_eq(a, b, userMsg) {
343
- if (!(is_int(a) && is_number(b) && a === b)) {
344
- throwError(`Expected ${a} to be integer equal to ${b}.`, userMsg);
345
- }
346
- return a;
347
- }
348
- Assert2.int_eq = int_eq;
349
- function int_lt(a, b, userMsg) {
350
- if (!(is_int(a) && is_number(b) && a < b)) {
351
- throwError(`Expected ${a} to be integer less than ${b}.`, userMsg);
352
- }
353
- return a;
354
- }
355
- Assert2.int_lt = int_lt;
356
- function int_lte(a, b, userMsg) {
357
- if (!(is_int(a) && is_number(b) && a <= b)) {
358
- throwError(`Expected ${a} to be integer less than or equal to ${b}.`, userMsg);
359
- }
360
- return a;
361
- }
362
- Assert2.int_lte = int_lte;
363
- function int_gt(a, b, userMsg) {
364
- if (!(is_int(a) && is_number(b) && a > b)) {
365
- throwError(`Expected ${a} to be integer greater than ${b}.`, userMsg);
366
- }
367
- return a;
368
- }
369
- Assert2.int_gt = int_gt;
370
- function int_gte(a, b, userMsg) {
371
- if (!(is_int(a) && is_number(b) && a >= b)) {
372
- throwError(`Expected ${a} to be integer greater than or equal to ${b}.`, userMsg);
373
- }
374
- return a;
375
- }
376
- Assert2.int_gte = int_gte;
377
- function int_between(a, min, max, userMsg) {
378
- if (!(is_int(a) && is_number(min) && is_number(max) && a >= min && a <= max)) {
379
- throwError(`Expected ${a} to be integer between ${min} and ${max}.`, userMsg);
380
- }
381
- return a;
382
- }
383
- Assert2.int_between = int_between;
384
- function odd(a, userMsg) {
385
- if (!(is_int(a) && a % 2 === 1)) {
386
- throwError(`Expected ${a} to be odd number.`, userMsg);
387
- }
388
- return a;
389
- }
390
- Assert2.odd = odd;
391
- function even(a, userMsg) {
392
- if (!(is_int(a) && a % 2 === 0)) {
393
- throwError(`Expected ${a} to be even number.`, userMsg);
394
- }
395
- return a;
396
- }
397
- Assert2.even = even;
398
- function in_group(a, group, userMsg) {
399
- if (!group.some((e) => e === a)) {
400
- let strGroup = group.map((v) => String(v)).join(", ");
401
- throwError(`Expected ${a} to be in group [${strGroup}].`, userMsg);
402
- }
403
- return a;
404
- }
405
- Assert2.in_group = in_group;
406
- function finite(a, userMsg) {
407
- if (!(is_number(a) && isFinite(a))) {
408
- throwError(`Expected ${a} to be finite number.`, userMsg);
409
- }
410
- return a;
411
- }
412
- Assert2.finite = finite;
413
- function array_id(arr, id, userMsg) {
414
- if (!(is_int(id) && id >= 0 && id < arr.length)) {
415
- throwError(`Expected ${id} to be array index in bounds [0..${arr.length - 1}].`, userMsg);
416
- }
417
- return id;
418
- }
419
- Assert2.array_id = array_id;
420
- function array_elem(arr, id, userMsg) {
421
- return arr[array_id(arr, id, userMsg)];
422
- }
423
- Assert2.array_elem = array_elem;
424
- function require2(arg, userMsg) {
425
- if (arg === void 0) {
426
- throwError("Required value is undefined.", userMsg);
427
- } else {
428
- return arg;
429
- }
430
- }
431
- Assert2.require = require2;
432
- })(Assert || (Assert = {}));
433
-
434
- // src/modules/device.ts
435
- var Device;
436
- ((Device2) => {
437
- function getDPI() {
438
- let el = document.createElement("div");
439
- el.style.width = "1in";
440
- document.body.appendChild(el);
441
- let dpi = el.offsetWidth;
442
- el.remove();
443
- return dpi || 96;
444
- }
445
- function getScrollBarWidth() {
446
- try {
447
- let outer = document.createElement("div");
448
- outer.style.visibility = "hidden";
449
- outer.style.width = "100px";
450
- document.body.appendChild(outer);
451
- let widthNoScroll = outer.offsetWidth;
452
- outer.style.overflow = "scroll";
453
- let inner = document.createElement("div");
454
- inner.style.width = "100%";
455
- outer.appendChild(inner);
456
- let widthWithScroll = inner.offsetWidth;
457
- if (outer.parentNode) {
458
- outer.parentNode.removeChild(outer);
459
- }
460
- return widthNoScroll - widthWithScroll;
461
- } catch (e) {
462
- return 0;
463
- }
464
- }
465
- function getSystemFontSize() {
466
- let tmpDiv = document.createElement("div");
467
- tmpDiv.style.cssText = "display:inline-block; padding:0; line-height:1; position:absolute; visibility:hidden; font-size:1em";
468
- tmpDiv.appendChild(document.createTextNode("M"));
469
- document.body.appendChild(tmpDiv);
470
- let fontsize = tmpDiv.offsetHeight;
471
- document.body.removeChild(tmpDiv);
472
- return fontsize;
473
- }
474
- function getIsTouchDevice() {
475
- if ("ontouchstart" in window || "DocumentTouch" in window || "createTouch" in document && "createTouchList" in document) {
476
- return true;
477
- }
478
- var prefixes = " -webkit- -moz- -o- -ms- ".split(" ");
479
- var mq = function(query2) {
480
- return window.matchMedia(query2).matches;
481
- };
482
- var query = ["(", prefixes.join("touch-enabled),("), "heartz", ")"].join("");
483
- return mq(query);
484
- }
485
- function getIsMobileDevice() {
486
- let a = navigator.userAgent || navigator.vendor || window.opera;
487
- return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4));
488
- }
489
- function getHostAddress() {
490
- return location.protocol + "//" + location.host;
491
- }
492
- const UnitRegExp = /^(mm|cm|in|inch|px|em)$/;
493
- const ValueUnitRegExp = /^([0-9\\.]+)(.*)$/;
494
- Device2.DPI = getDPI();
495
- Device2.PxPerMm = Device2.DPI / 25.4;
496
- Device2.ScrollbarWidth = getScrollBarWidth();
497
- Device2.FontSize = getSystemFontSize();
498
- Device2.IsTouchDevice = getIsTouchDevice();
499
- Device2.IsMobileDevice = getIsMobileDevice();
500
- Device2.HostAddress = getHostAddress();
501
- function pxToMm(px) {
502
- return px / Device2.PxPerMm;
503
- }
504
- Device2.pxToMm = pxToMm;
505
- function mmToPx(mm) {
506
- return mm * Device2.PxPerMm;
507
- }
508
- Device2.mmToPx = mmToPx;
509
- function toPx2(input) {
510
- if (typeof input === "number") {
511
- return input;
512
- }
513
- let value = NaN;
514
- let unit = void 0;
515
- let match = input.toString().match(ValueUnitRegExp);
516
- if (match && match[1]) {
517
- value = parseFloat(match[1]);
518
- let unitStr = match[2] ? match[2].toLowerCase() : "undefined";
519
- let unitStrOk = UnitRegExp.test(unitStr);
520
- unit = unitStrOk ? unitStr : void 0;
521
- if (!unit) {
522
- console.log("Unknown unit '" + unitStr + "' => using 'px'.");
523
- }
524
- } else {
525
- value = parseFloat(input);
526
- }
527
- Assert.finite(value, "value in function toPx");
528
- switch (unit) {
529
- case "mm":
530
- return mmToPx(value);
531
- case "cm":
532
- return mmToPx(value) * 10;
533
- case "in":
534
- case "inch":
535
- return mmToPx(value) * 25.4;
536
- case "em":
537
- return Device2.FontSize * value;
538
- default:
539
- case "px":
540
- return value;
541
- }
542
- }
543
- Device2.toPx = toPx2;
544
- })(Device || (Device = {}));
545
-
546
- // src/utils/dom/index.ts
547
- function toPx(value) {
548
- return value === void 0 ? void 0 : Device.toPx(value);
1080
+ function toPx2(value) {
1081
+ return value === void 0 ? void 0 : device_exports.toPx(value);
549
1082
  }
550
1083
  function hasClass(el, className) {
551
1084
  if (className.length === 0) {
@@ -636,38 +1169,38 @@ function getPadding(style) {
636
1169
  if (!style) {
637
1170
  return { top: 0, right: 0, bottom: 0, left: 0 };
638
1171
  }
639
- let top = toPx(style.paddingTop);
640
- let right = toPx(style.paddingRight);
641
- let bottom = toPx(style.paddingBottom);
642
- let left = toPx(style.paddingLeft);
1172
+ let top = toPx2(style.paddingTop);
1173
+ let right = toPx2(style.paddingRight);
1174
+ let bottom = toPx2(style.paddingBottom);
1175
+ let left = toPx2(style.paddingLeft);
643
1176
  let padding = (style.padding ?? "").toString().split(" ").filter((s) => s.length > 0);
644
1177
  switch (padding.length) {
645
1178
  case 0:
646
1179
  break;
647
1180
  case 1:
648
- top ?? (top = toPx(padding[0]));
649
- right ?? (right = toPx(padding[0]));
650
- bottom ?? (bottom = toPx(padding[0]));
651
- left ?? (left = toPx(padding[0]));
1181
+ top ?? (top = toPx2(padding[0]));
1182
+ right ?? (right = toPx2(padding[0]));
1183
+ bottom ?? (bottom = toPx2(padding[0]));
1184
+ left ?? (left = toPx2(padding[0]));
652
1185
  break;
653
1186
  case 2:
654
- top ?? (top = toPx(padding[0]));
655
- right ?? (right = toPx(padding[1]));
656
- bottom ?? (bottom = toPx(padding[0]));
657
- left ?? (left = toPx(padding[1]));
1187
+ top ?? (top = toPx2(padding[0]));
1188
+ right ?? (right = toPx2(padding[1]));
1189
+ bottom ?? (bottom = toPx2(padding[0]));
1190
+ left ?? (left = toPx2(padding[1]));
658
1191
  break;
659
1192
  case 3:
660
- top ?? (top = toPx(padding[0]));
661
- right ?? (right = toPx(padding[1]));
662
- bottom ?? (bottom = toPx(padding[2]));
663
- left ?? (left = toPx(padding[1]));
1193
+ top ?? (top = toPx2(padding[0]));
1194
+ right ?? (right = toPx2(padding[1]));
1195
+ bottom ?? (bottom = toPx2(padding[2]));
1196
+ left ?? (left = toPx2(padding[1]));
664
1197
  break;
665
1198
  case 4:
666
1199
  default:
667
- top ?? (top = toPx(padding[0]));
668
- right ?? (right = toPx(padding[1]));
669
- bottom ?? (bottom = toPx(padding[2]));
670
- left ?? (left = toPx(padding[3]));
1200
+ top ?? (top = toPx2(padding[0]));
1201
+ right ?? (right = toPx2(padding[1]));
1202
+ bottom ?? (bottom = toPx2(padding[2]));
1203
+ left ?? (left = toPx2(padding[3]));
671
1204
  break;
672
1205
  }
673
1206
  top ?? (top = 0);
@@ -677,12 +1210,12 @@ function getPadding(style) {
677
1210
  return { top, right, bottom, left };
678
1211
  }
679
1212
  function getDimension(style) {
680
- let left = toPx(style?.left);
681
- let right = toPx(style?.right);
682
- let top = toPx(style?.top);
683
- let bottom = toPx(style?.bottom);
684
- let width = toPx(style?.width);
685
- let height = toPx(style?.height);
1213
+ let left = toPx2(style?.left);
1214
+ let right = toPx2(style?.right);
1215
+ let top = toPx2(style?.top);
1216
+ let bottom = toPx2(style?.bottom);
1217
+ let width = toPx2(style?.width);
1218
+ let height = toPx2(style?.height);
686
1219
  if (width === void 0 && left !== void 0 && right !== void 0) {
687
1220
  width = right - left;
688
1221
  }
@@ -717,9 +1250,7 @@ __export(map_exports, {
717
1250
  getMapKeys: () => getMapKeys
718
1251
  });
719
1252
  function getMapKeys(map) {
720
- let keys = [];
721
- map.forEach((value, key) => keys.push(key));
722
- return keys;
1253
+ return [...map.keys()];
723
1254
  }
724
1255
 
725
1256
  // src/utils/math/index.ts
@@ -731,8 +1262,8 @@ __export(math_exports, {
731
1262
  cmp: () => cmp,
732
1263
  interpolateCoord: () => interpolateCoord,
733
1264
  interpolateY: () => interpolateY,
734
- isInteger: () => isInteger,
735
- isNumber: () => isNumber,
1265
+ isInteger: () => isInteger2,
1266
+ isNumber: () => isNumber2,
736
1267
  linearToDecibels: () => linearToDecibels,
737
1268
  mod: () => mod,
738
1269
  romanize: () => romanize,
@@ -752,7 +1283,7 @@ function mod(m, n) {
752
1283
  return (m % n + n) % n;
753
1284
  }
754
1285
  function romanize(n) {
755
- if (!isInteger(n) || n < 0) {
1286
+ if (!isInteger2(n) || n < 0) {
756
1287
  throw new Error("romanize: Invalid n = " + n);
757
1288
  }
758
1289
  var digits = String(+n).split("");
@@ -793,7 +1324,7 @@ function romanize(n) {
793
1324
  return Array(+digits.join("") + 1).join("M") + roman;
794
1325
  }
795
1326
  function toOrdinalNumber(n) {
796
- if (!isInteger(n)) {
1327
+ if (!isInteger2(n)) {
797
1328
  throw new Error("toOrdinalNumber: Invalid n = " + n);
798
1329
  }
799
1330
  const nStr = n.toString();
@@ -846,87 +1377,58 @@ function cmp(a, b) {
846
1377
  return a < b ? -1 : a > b ? 1 : 0;
847
1378
  }
848
1379
 
849
- // src/utils/obj/index.ts
850
- var obj_exports = {};
851
- __export(obj_exports, {
852
- deepEqual: () => deepEqual,
853
- hasProperties: () => hasProperties,
854
- isObject: () => isObject
855
- });
856
- function hasProperties(obj, props) {
857
- return isObject(obj) && props.every((p) => p in obj);
858
- }
859
- function deepEqual(a, b) {
860
- if (a === b) return true;
861
- if (a === null || b === null) return false;
862
- if (typeof a !== "object" || typeof b !== "object") return false;
863
- if (Array.isArray(a) && Array.isArray(b)) {
864
- if (a.length !== b.length) return false;
865
- return a.every((val, i) => deepEqual(val, b[i]));
866
- }
867
- if (Array.isArray(a) !== Array.isArray(b)) return false;
868
- const keysA = Object.keys(a);
869
- const keysB = Object.keys(b);
870
- if (keysA.length !== keysB.length) return false;
871
- for (const key of keysA) {
872
- if (!Object.prototype.hasOwnProperty.call(b, key)) return false;
873
- if (!deepEqual(a[key], b[key])) return false;
874
- }
875
- return true;
876
- }
877
-
878
1380
  // src/utils/str/index.ts
879
1381
  var str_exports = {};
880
1382
  __export(str_exports, {
881
1383
  charCount: () => charCount,
882
1384
  chunkString: () => chunkString,
883
1385
  insertAt: () => insertAt,
884
- isString: () => isString,
1386
+ isString: () => isString2,
885
1387
  makeSentenceFromPascal: () => makeSentenceFromPascal,
886
1388
  removeAt: () => removeAt,
887
1389
  repeatString: () => repeatString,
888
1390
  replaceAt: () => replaceAt,
889
1391
  toCharArray: () => toCharArray
890
1392
  });
891
- function toCharArray(str) {
892
- return str.split("");
1393
+ function toCharArray(str2) {
1394
+ return str2.split("");
893
1395
  }
894
1396
  function repeatString(repeatString2, repeatCount) {
895
- if (!isInteger(repeatCount) || repeatCount < 0) {
1397
+ if (!isInteger2(repeatCount) || repeatCount < 0) {
896
1398
  throw new Error("repeatStr: Invalid repeatCount = " + repeatCount);
897
1399
  }
898
1400
  return new Array(repeatCount + 1).join(repeatString2);
899
1401
  }
900
- function chunkString(str, chunkSize) {
901
- if (!isInteger(chunkSize) || chunkSize < 1) {
1402
+ function chunkString(str2, chunkSize) {
1403
+ if (!isInteger2(chunkSize) || chunkSize < 1) {
902
1404
  throw new Error("chunckString: Invalid chuckSize = " + chunkSize);
903
1405
  }
904
1406
  let result = [];
905
- for (let i = 0; i < str.length; i += chunkSize) {
906
- result.push(str.slice(i, i + chunkSize));
1407
+ for (let i = 0; i < str2.length; i += chunkSize) {
1408
+ result.push(str2.slice(i, i + chunkSize));
907
1409
  }
908
1410
  return result;
909
1411
  }
910
- function replaceAt(str, pos, removeCount, insert) {
911
- if (!isInteger(removeCount) || removeCount < 0) {
1412
+ function replaceAt(str2, pos, removeCount, insert) {
1413
+ if (!isInteger2(removeCount) || removeCount < 0) {
912
1414
  throw new Error("replaceAt: Invalid removeCount = " + removeCount);
913
- } else if (!isInteger(pos) || pos < 0 || pos + removeCount > str.length) {
914
- throw new Error("replaceAt: Invalid pos = " + pos + ", removeCount = " + removeCount + ", str.length = " + str.length);
1415
+ } else if (!isInteger2(pos) || pos < 0 || pos + removeCount > str2.length) {
1416
+ throw new Error("replaceAt: Invalid pos = " + pos + ", removeCount = " + removeCount + ", str.length = " + str2.length);
915
1417
  } else {
916
- return str.substring(0, pos) + insert + str.substring(pos + removeCount);
1418
+ return str2.substring(0, pos) + insert + str2.substring(pos + removeCount);
917
1419
  }
918
1420
  }
919
- function insertAt(str, pos, insertStr) {
920
- return replaceAt(str, pos, 0, insertStr);
1421
+ function insertAt(str2, pos, insertStr) {
1422
+ return replaceAt(str2, pos, 0, insertStr);
921
1423
  }
922
- function removeAt(str, pos, removeCount) {
923
- return replaceAt(str, pos, removeCount, "");
1424
+ function removeAt(str2, pos, removeCount) {
1425
+ return replaceAt(str2, pos, removeCount, "");
924
1426
  }
925
- function charCount(str, ch) {
926
- if (ch.length !== 1 || str.length === 0) return 0;
1427
+ function charCount(str2, ch) {
1428
+ if (ch.length !== 1 || str2.length === 0) return 0;
927
1429
  let count = 0;
928
- for (let i = 0; i < str.length; i++) {
929
- if (str[i] === ch) count++;
1430
+ for (let i = 0; i < str2.length; i++) {
1431
+ if (str2[i] === ch) count++;
930
1432
  }
931
1433
  return count;
932
1434
  }
@@ -960,126 +1462,86 @@ function makeSentenceFromPascal(PascalString) {
960
1462
  return sentence;
961
1463
  }
962
1464
 
963
- // src/modules/cookies.ts
964
- var Cookies;
965
- ((Cookies2) => {
966
- const ConsentCookieName = "ConsentCookie";
967
- let ConsentState;
968
- ((ConsentState2) => {
969
- ConsentState2["Accept"] = "accept";
970
- ConsentState2["Decline"] = "decline";
971
- })(ConsentState || (ConsentState = {}));
972
- let _consent;
973
- let _expires;
974
- let str = _read(ConsentCookieName);
975
- _consent = str === "accept" /* Accept */ || str === "decline" /* Decline */ ? str : void 0;
976
- function setExpireDays(days) {
977
- _expires = /* @__PURE__ */ new Date();
978
- _expires.setDate(_expires.getDate() + days);
979
- }
980
- Cookies2.setExpireDays = setExpireDays;
981
- function isConsentPending() {
982
- return _consent === void 0;
983
- }
984
- Cookies2.isConsentPending = isConsentPending;
985
- function accept() {
986
- _consent = "accept" /* Accept */;
987
- _save(ConsentCookieName, _consent);
988
- }
989
- Cookies2.accept = accept;
990
- function decline() {
991
- _consent = "decline" /* Decline */;
992
- _save(ConsentCookieName, _consent);
993
- }
994
- Cookies2.decline = decline;
995
- function _getList() {
996
- let s = document.cookie;
997
- return s.split(";").map((c) => c.trim());
998
- }
999
- function _save(name, value) {
1000
- let cookie = name + "=" + value.toString() + ";sameSite=Lax;";
1001
- if (_expires) {
1002
- cookie += "expires=" + _expires.toUTCString() + ";";
1003
- }
1004
- document.cookie = cookie;
1005
- return value;
1465
+ // src/utils/index.ts
1466
+ var Is = guard_exports;
1467
+
1468
+ // src/core/format-value.ts
1469
+ function formatValue(value) {
1470
+ if (isString2(value)) {
1471
+ return `"${value}"`;
1472
+ } else if (isArray2(value)) {
1473
+ return `[ ${value.map((e) => formatValue(e)).join(", ")} ]`.replaceAll(" ", " ");
1474
+ } else if (isFunction2(value.toString)) {
1475
+ return value.toString();
1476
+ } else {
1477
+ return JSON.stringify(value);
1006
1478
  }
1007
- function _read(name, defaultValue) {
1008
- let str2 = _getList().find((c) => c.startsWith(name + "="));
1009
- return str2 === void 0 ? defaultValue : str2.substring(name.length + 1);
1479
+ }
1480
+
1481
+ // src/core/stack.ts
1482
+ var Stack = class {
1483
+ constructor() {
1484
+ __publicField(this, "data", []);
1010
1485
  }
1011
- function _erase(name) {
1012
- document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 UTC;";
1486
+ assertId(id) {
1487
+ assert_exports.isIntegerBetween(id, 0, this.length - 1, `Stack index ${id} out of range.`);
1488
+ return id;
1013
1489
  }
1014
- function save(name, value) {
1015
- if (_consent === "accept" /* Accept */) {
1016
- _save(name, value);
1017
- }
1018
- return value;
1490
+ get length() {
1491
+ return this.data.length;
1019
1492
  }
1020
- Cookies2.save = save;
1021
- function read(name, defaultValue) {
1022
- if (_consent === "accept" /* Accept */) {
1023
- return _read(name, defaultValue) || defaultValue;
1024
- } else {
1025
- return defaultValue;
1026
- }
1493
+ push(el) {
1494
+ this.data.push(el);
1495
+ return el;
1027
1496
  }
1028
- Cookies2.read = read;
1029
- function readInt(name, defaultValue) {
1030
- if (_consent === "accept" /* Accept */) {
1031
- let str2 = _read(name);
1032
- return str2 === void 0 ? defaultValue : parseInt(str2);
1033
- } else {
1034
- return defaultValue;
1035
- }
1497
+ pop() {
1498
+ this.assertId(this.length - 1);
1499
+ return this.data.pop();
1036
1500
  }
1037
- Cookies2.readInt = readInt;
1038
- function readBool(name, defaultValue) {
1039
- if (_consent === "accept" /* Accept */) {
1040
- let str2 = _read(name);
1041
- return str2 === void 0 ? defaultValue : /true|1/i.test(str2);
1042
- } else {
1043
- return defaultValue;
1044
- }
1501
+ popOrUndef() {
1502
+ return this.data.pop();
1045
1503
  }
1046
- Cookies2.readBool = readBool;
1047
- function erase(name) {
1048
- if (_consent === "accept" /* Accept */ || name === ConsentCookieName) {
1049
- _erase(name);
1050
- }
1504
+ popOr(defaultValueOrCreator) {
1505
+ return this.isEmpty() ? isFunction2(defaultValueOrCreator) ? defaultValueOrCreator() : defaultValueOrCreator : this.data.pop();
1051
1506
  }
1052
- Cookies2.erase = erase;
1053
- function eraseAll() {
1054
- document.cookie.split(";").forEach((c) => erase(c.trim().split("=")[0]));
1507
+ top() {
1508
+ return this.data[this.assertId(this.length - 1)];
1055
1509
  }
1056
- Cookies2.eraseAll = eraseAll;
1057
- })(Cookies || (Cookies = {}));
1058
-
1059
- // src/core/stack.ts
1060
- var Stack = class {
1061
- constructor() {
1062
- __publicField(this, "list", []);
1510
+ topOrUndef() {
1511
+ return this.data[this.length - 1];
1063
1512
  }
1064
- push(e) {
1065
- this.list.push(e);
1066
- return e;
1513
+ topOr(defaultValueOrCreator) {
1514
+ return this.isEmpty() ? isFunction2(defaultValueOrCreator) ? defaultValueOrCreator() : defaultValueOrCreator : this.data[this.length - 1];
1067
1515
  }
1068
- pop() {
1069
- Assert.int_gt(this.list.length, 0);
1070
- return this.list.pop();
1516
+ peek(depth = 0) {
1517
+ return this.data[this.assertId(this.data.length - 1 - depth)];
1071
1518
  }
1072
- top() {
1073
- return Assert.array_elem(this.list, this.list.length - 1, "Stack is empty!");
1519
+ peekOrUndef(depth = 0) {
1520
+ return this.data[this.data.length - 1 - depth];
1521
+ }
1522
+ peekOr(depth = 0, defaultValueOrCreator) {
1523
+ const id = this.data.length - 1 - depth;
1524
+ const value = id < 0 ? void 0 : this.data[id];
1525
+ return value === void 0 ? isFunction2(defaultValueOrCreator) ? defaultValueOrCreator() : defaultValueOrCreator : value;
1526
+ }
1527
+ *values() {
1528
+ for (let id = this.data.length - 1; id >= 0; id--)
1529
+ yield this.data[id];
1530
+ }
1531
+ *[Symbol.iterator]() {
1532
+ yield* this.values();
1074
1533
  }
1075
1534
  toArray() {
1076
- return this.list;
1535
+ return [...this.data];
1077
1536
  }
1078
- get length() {
1079
- return this.list.length;
1537
+ isEmpty() {
1538
+ return this.length === 0;
1080
1539
  }
1081
1540
  clear() {
1082
- this.list.length = 0;
1541
+ this.data.length = 0;
1542
+ }
1543
+ toString() {
1544
+ return `Stack(${this.length})${formatValue(this.data)}`;
1083
1545
  }
1084
1546
  };
1085
1547
 
@@ -1104,9 +1566,15 @@ var Vec = class _Vec {
1104
1566
  }
1105
1567
  return new _Vec(...Array(dim).fill(0));
1106
1568
  }
1569
+ get dim() {
1570
+ return this.coords.length;
1571
+ }
1107
1572
  get length() {
1108
1573
  return Math.hypot(...this.coords);
1109
1574
  }
1575
+ magnitude() {
1576
+ return this.length;
1577
+ }
1110
1578
  get x() {
1111
1579
  return this.coords[0];
1112
1580
  }
@@ -1158,6 +1626,38 @@ var Vec = class _Vec {
1158
1626
  }
1159
1627
  return this.div(len);
1160
1628
  }
1629
+ static lerp(a, b, t) {
1630
+ if (a.coords.length !== b.coords.length) {
1631
+ throw new TypeError("Coordinate length mismatch!");
1632
+ }
1633
+ if (!isFinite3(t)) {
1634
+ throw new TypeError("Lerp t is not finite!");
1635
+ }
1636
+ return a.add(b.sub(a).mul(t));
1637
+ }
1638
+ toLength(len) {
1639
+ const mag = this.length;
1640
+ return mag === 0 ? this : this.mul(len / mag);
1641
+ }
1642
+ clamp(minLength, maxLength, defaultDir) {
1643
+ const mag = this.length;
1644
+ if (mag === 0) {
1645
+ if (minLength !== void 0) {
1646
+ if (defaultDir && defaultDir.coords.length !== this.coords.length)
1647
+ throw new TypeError("Coordinate length mismatch!");
1648
+ const dir = defaultDir && defaultDir.length !== 0 ? defaultDir.normalize() : new _Vec(1, ...Array(this.coords.length - 1).fill(0));
1649
+ return dir.mul(minLength);
1650
+ }
1651
+ return this;
1652
+ }
1653
+ if (maxLength !== void 0 && mag > maxLength) {
1654
+ return this.normalize().mul(maxLength);
1655
+ }
1656
+ if (minLength !== void 0 && mag < minLength) {
1657
+ return this.normalize().mul(minLength);
1658
+ }
1659
+ return this;
1660
+ }
1161
1661
  equals(other) {
1162
1662
  return this.coords.length === other.coords.length && this.coords.every((v, i) => v === other.coords[i]);
1163
1663
  }
@@ -1179,28 +1679,28 @@ var Vec = class _Vec {
1179
1679
  var DivRect = class _DivRect {
1180
1680
  constructor(...args) {
1181
1681
  __publicField(this, "left");
1182
- __publicField(this, "centerX");
1682
+ __publicField(this, "anchorX");
1183
1683
  __publicField(this, "right");
1184
1684
  __publicField(this, "top");
1185
- __publicField(this, "centerY");
1685
+ __publicField(this, "anchorY");
1186
1686
  __publicField(this, "bottom");
1187
1687
  if (args.length === 6) {
1188
1688
  this.left = args[0];
1189
- this.centerX = args[1];
1689
+ this.anchorX = args[1];
1190
1690
  this.right = args[2];
1191
1691
  this.top = args[3];
1192
- this.centerY = args[4];
1692
+ this.anchorY = args[4];
1193
1693
  this.bottom = args[5];
1194
1694
  } else if (args.length === 4) {
1195
1695
  this.left = args[0];
1196
1696
  this.right = args[1];
1197
- this.centerX = (this.left + this.right) / 2;
1697
+ this.anchorX = (this.left + this.right) / 2;
1198
1698
  this.top = args[2];
1199
1699
  this.bottom = args[3];
1200
- this.centerY = (this.top + this.bottom) / 2;
1700
+ this.anchorY = (this.top + this.bottom) / 2;
1201
1701
  } else if (args.length === 0) {
1202
- this.left = this.centerX = this.right = 0;
1203
- this.top = this.centerY = this.bottom = 0;
1702
+ this.left = this.anchorX = this.right = 0;
1703
+ this.top = this.anchorY = this.bottom = 0;
1204
1704
  } else {
1205
1705
  throw new TypeError(`Invalid DivRect args: ${args}`);
1206
1706
  }
@@ -1218,7 +1718,7 @@ var DivRect = class _DivRect {
1218
1718
  return new _DivRect(left, left + width, top, top + height);
1219
1719
  }
1220
1720
  /**
1221
- * Create rect from centerX, centerY, width, height arguments.
1721
+ * Create rect from anchorX, anchorY, width, height arguments.
1222
1722
  *
1223
1723
  * @param centerX - Center x-coordinate.
1224
1724
  * @param centerY - Center y-coordinate.
@@ -1248,6 +1748,22 @@ var DivRect = class _DivRect {
1248
1748
  static createSections(leftw, rightw, toph, bottomh) {
1249
1749
  return new _DivRect(-leftw, 0, rightw, -toph, 0, bottomh);
1250
1750
  }
1751
+ /** @deprecated - Renamed to anchorX. */
1752
+ get centerX() {
1753
+ return this.anchorX;
1754
+ }
1755
+ /** @deprecated - Renamed to anchorX. */
1756
+ set centerX(x) {
1757
+ this.anchorX = x;
1758
+ }
1759
+ /** @deprecated - Renamed to anchorY. */
1760
+ get centerY() {
1761
+ return this.anchorY;
1762
+ }
1763
+ /** @deprecated - Renamed to anchorY. */
1764
+ set centerY(y) {
1765
+ this.anchorY = y;
1766
+ }
1251
1767
  /**
1252
1768
  * Width getter.
1253
1769
  */
@@ -1264,25 +1780,25 @@ var DivRect = class _DivRect {
1264
1780
  * Left section width getter.
1265
1781
  */
1266
1782
  get leftw() {
1267
- return this.centerX - this.left;
1783
+ return this.anchorX - this.left;
1268
1784
  }
1269
1785
  /**
1270
1786
  * Right section width getter.
1271
1787
  */
1272
1788
  get rightw() {
1273
- return this.right - this.centerX;
1789
+ return this.right - this.anchorX;
1274
1790
  }
1275
1791
  /**
1276
1792
  * Top section height getter.
1277
1793
  */
1278
1794
  get toph() {
1279
- return this.centerY - this.top;
1795
+ return this.anchorY - this.top;
1280
1796
  }
1281
1797
  /**
1282
1798
  * Bottom section height getter.
1283
1799
  */
1284
1800
  get bottomh() {
1285
- return this.bottom - this.centerY;
1801
+ return this.bottom - this.anchorY;
1286
1802
  }
1287
1803
  /**
1288
1804
  * Does this Rect contain given (x, y)-point?
@@ -1326,7 +1842,7 @@ var DivRect = class _DivRect {
1326
1842
  } else if (a == null || b == null) {
1327
1843
  return false;
1328
1844
  } else {
1329
- return a === b || a.left === b.left && a.centerX === b.centerX && a.right === b.right && a.top === b.top && a.centerY === b.centerY && a.bottom === b.bottom;
1845
+ return a === b || a.left === b.left && a.anchorX === b.anchorX && a.right === b.right && a.top === b.top && a.anchorY === b.anchorY && a.bottom === b.bottom;
1330
1846
  }
1331
1847
  }
1332
1848
  /**
@@ -1338,7 +1854,7 @@ var DivRect = class _DivRect {
1338
1854
  return _DivRect.equals(this, other);
1339
1855
  }
1340
1856
  /**
1341
- * Check if edges of given rects are equal, ignoring centerX and centerY.
1857
+ * Check if edges of given rects are equal, ignoring anchorX and anchorY.
1342
1858
  *
1343
1859
  * @param a - DivRect a.
1344
1860
  * @param b - DivRect b.
@@ -1354,7 +1870,7 @@ var DivRect = class _DivRect {
1354
1870
  }
1355
1871
  }
1356
1872
  /**
1357
- * Check if edges of this Rect equals with given Rect, ignoring centerX and centerY.
1873
+ * Check if edges of this Rect equals with given Rect, ignoring anchorX and anchorY.
1358
1874
  *
1359
1875
  * @param other - The other DivRect.
1360
1876
  * @returns - True/false.
@@ -1362,13 +1878,17 @@ var DivRect = class _DivRect {
1362
1878
  equalsEdges(other) {
1363
1879
  return _DivRect.equalsEdges(this, other);
1364
1880
  }
1881
+ /** @deprecated - Use `DivRect.equalsEdges()` instead. */
1882
+ static equalsFrame(a, b) {
1883
+ return _DivRect.equalsEdges(a, b);
1884
+ }
1365
1885
  /**
1366
1886
  * Created duplicate of this Rect.
1367
1887
  *
1368
1888
  * @returns - Duplicate.
1369
1889
  */
1370
1890
  copy() {
1371
- return new _DivRect(this.left, this.centerX, this.right, this.top, this.centerY, this.bottom);
1891
+ return new _DivRect(this.left, this.anchorX, this.right, this.top, this.anchorY, this.bottom);
1372
1892
  }
1373
1893
  /**
1374
1894
  * Move this rect by (dx, dy). Modifies this Rect.
@@ -1379,10 +1899,10 @@ var DivRect = class _DivRect {
1379
1899
  */
1380
1900
  offsetInPlace(dx, dy) {
1381
1901
  this.left += dx;
1382
- this.centerX += dx;
1902
+ this.anchorX += dx;
1383
1903
  this.right += dx;
1384
1904
  this.top += dy;
1385
- this.centerY += dy;
1905
+ this.anchorY += dy;
1386
1906
  this.bottom += dy;
1387
1907
  return this;
1388
1908
  }
@@ -1427,10 +1947,10 @@ var DivRect = class _DivRect {
1427
1947
  clipInPlace(clipRect) {
1428
1948
  this.left = Math.max(this.left, clipRect.left);
1429
1949
  this.right = Math.min(this.right, clipRect.right);
1430
- this.centerX = clamp(this.centerX, this.left, this.right);
1950
+ this.anchorX = clamp(this.anchorX, this.left, this.right);
1431
1951
  this.top = Math.max(this.top, clipRect.top);
1432
1952
  this.bottom = Math.min(this.bottom, clipRect.bottom);
1433
- this.centerY = clamp(this.centerY, this.top, this.bottom);
1953
+ this.anchorY = clamp(this.anchorY, this.top, this.bottom);
1434
1954
  return this;
1435
1955
  }
1436
1956
  /**
@@ -1443,7 +1963,7 @@ var DivRect = class _DivRect {
1443
1963
  return this.copy().clipInPlace(clipRect);
1444
1964
  }
1445
1965
  /**
1446
- * Scale Rect. Anchor pos is (centerX, centerY). Modifies this Rect.
1966
+ * Scale Rect. Anchor pos is (anchorX, anchorY). Modifies this Rect.
1447
1967
  *
1448
1968
  * @param scaleX - Scale x-amount.
1449
1969
  * @param scaleY - Scale y-amount. If undefined then scale x-amount is used.
@@ -1451,14 +1971,14 @@ var DivRect = class _DivRect {
1451
1971
  */
1452
1972
  scaleInPlace(scaleX, scaleY) {
1453
1973
  scaleY = scaleY ?? scaleX;
1454
- this.left = this.centerX - this.leftw * scaleX;
1455
- this.right = this.centerX + this.rightw * scaleX;
1456
- this.top = this.centerY - this.toph * scaleY;
1457
- this.bottom = this.centerY + this.bottomh * scaleY;
1974
+ this.left = this.anchorX - this.leftw * scaleX;
1975
+ this.right = this.anchorX + this.rightw * scaleX;
1976
+ this.top = this.anchorY - this.toph * scaleY;
1977
+ this.bottom = this.anchorY + this.bottomh * scaleY;
1458
1978
  return this;
1459
1979
  }
1460
1980
  /**
1461
- * Scale Rect. Anchor pos is (centerX, centerY). Immutable, returns modified copy.
1981
+ * Scale Rect. Anchor pos is (anchorX, anchorY). Immutable, returns modified copy.
1462
1982
  *
1463
1983
  * @param scaleX - Scale x-amount.
1464
1984
  * @param scaleY - Scale y-amount. If undefined then scale x-amount is used.
@@ -1596,7 +2116,7 @@ var IndexArray = class _IndexArray {
1596
2116
  }
1597
2117
  }
1598
2118
  static validateIndex(id) {
1599
- if (!isIntegerGte(id, 0)) throw new Error(`Invalid index ${id} - must be an integer >= 0!`);
2119
+ if (!isIntegerGte2(id, 0)) throw new Error(`Invalid index ${id} - must be an integer >= 0!`);
1600
2120
  return id;
1601
2121
  }
1602
2122
  get posLen() {
@@ -1605,6 +2125,14 @@ var IndexArray = class _IndexArray {
1605
2125
  get size() {
1606
2126
  return this.valCount;
1607
2127
  }
2128
+ get length() {
2129
+ return this.hasPos.length;
2130
+ }
2131
+ trimRight() {
2132
+ let newLength = this.length;
2133
+ while (newLength > 0 && this.hasPos[newLength - 1] !== true) newLength--;
2134
+ if (newLength < this.length) this.posVal.length = this.hasPos.length = newLength;
2135
+ }
1608
2136
  isEmpty() {
1609
2137
  return this.size === 0;
1610
2138
  }
@@ -1627,7 +2155,7 @@ var IndexArray = class _IndexArray {
1627
2155
  }
1628
2156
  getOrCreate(id, creatorOrValue) {
1629
2157
  if (!this.has(id)) {
1630
- const value = isFunction(creatorOrValue) ? creatorOrValue() : creatorOrValue;
2158
+ const value = isFunction2(creatorOrValue) ? creatorOrValue() : creatorOrValue;
1631
2159
  this.set(id, value);
1632
2160
  return value;
1633
2161
  }
@@ -1639,6 +2167,7 @@ var IndexArray = class _IndexArray {
1639
2167
  this.posVal[id] = void 0;
1640
2168
  this.hasPos[id] = false;
1641
2169
  this.valCount--;
2170
+ this.trimRight();
1642
2171
  return true;
1643
2172
  }
1644
2173
  clear() {
@@ -1763,22 +2292,24 @@ var IndexArray = class _IndexArray {
1763
2292
  }
1764
2293
  return result;
1765
2294
  }
1766
- equals(other, eq) {
2295
+ equals(other, eq2) {
1767
2296
  if (this.size !== other.size) return false;
1768
- eq ?? (eq = (a, b) => a === b);
2297
+ eq2 ?? (eq2 = (a, b) => a === b);
1769
2298
  const posLen = Math.max(this.posLen, other.posLen);
1770
2299
  for (let i = 0; i < posLen; ++i) {
1771
2300
  const hasA = this.hasPos[i];
1772
2301
  const hasB = other.hasPos[i];
1773
2302
  if (hasA !== hasB) return false;
1774
- if (hasA && !eq(this.posVal[i], other.posVal[i])) return false;
2303
+ if (hasA && !eq2(this.posVal[i], other.posVal[i])) return false;
1775
2304
  }
1776
2305
  return true;
1777
2306
  }
2307
+ toArray() {
2308
+ return this.valuesArray();
2309
+ }
1778
2310
  toString() {
1779
- if (this.size === 0) return `IndexArray[ ]`;
1780
- const entries = this.entriesArray().map(([id, value]) => `${id}: ${value}`).join(", ");
1781
- return `IndexArray[ ${entries} ]`;
2311
+ const entries = this.entriesArray().map(([id, v]) => `${formatValue(id)}: ${formatValue(v)}`).join(", ");
2312
+ return `IndexArray[ ${entries} ]`.replaceAll(" ", " ");
1782
2313
  }
1783
2314
  };
1784
2315
 
@@ -1816,7 +2347,7 @@ var SignedIndexArray = class _SignedIndexArray {
1816
2347
  return -id - 1;
1817
2348
  }
1818
2349
  static validateIndex(id) {
1819
- if (!isInteger(id)) throw new Error(`Invalid index ${id} - must be an integer!`);
2350
+ if (!isInteger2(id)) throw new Error(`Invalid index ${id} - must be an integer!`);
1820
2351
  return id;
1821
2352
  }
1822
2353
  get size() {
@@ -1866,7 +2397,7 @@ var SignedIndexArray = class _SignedIndexArray {
1866
2397
  }
1867
2398
  getOrCreate(id, creatorOrValue) {
1868
2399
  if (!this.has(id)) {
1869
- const value = isFunction(creatorOrValue) ? creatorOrValue() : creatorOrValue;
2400
+ const value = isFunction2(creatorOrValue) ? creatorOrValue() : creatorOrValue;
1870
2401
  this.set(id, value);
1871
2402
  return value;
1872
2403
  }
@@ -2017,29 +2548,31 @@ var SignedIndexArray = class _SignedIndexArray {
2017
2548
  }
2018
2549
  return result;
2019
2550
  }
2020
- equals(other, eq) {
2551
+ equals(other, eq2) {
2021
2552
  if (this.size !== other.size) return false;
2022
- eq ?? (eq = (a, b) => a === b);
2553
+ eq2 ?? (eq2 = (a, b) => a === b);
2023
2554
  const posLen = Math.max(this.posLen, other.posLen);
2024
2555
  for (let i = 0; i < posLen; ++i) {
2025
2556
  const hasA = this.hasPos[i];
2026
2557
  const hasB = other.hasPos[i];
2027
2558
  if (hasA !== hasB) return false;
2028
- if (hasA && !eq(this.posVal[i], other.posVal[i])) return false;
2559
+ if (hasA && !eq2(this.posVal[i], other.posVal[i])) return false;
2029
2560
  }
2030
2561
  const negLen = Math.max(this.negLen, other.negLen);
2031
2562
  for (let i = 0; i < negLen; ++i) {
2032
2563
  const hasA = this.hasNeg[i];
2033
2564
  const hasB = other.hasNeg[i];
2034
2565
  if (hasA !== hasB) return false;
2035
- if (hasA && !eq(this.negVal[i], other.negVal[i])) return false;
2566
+ if (hasA && !eq2(this.negVal[i], other.negVal[i])) return false;
2036
2567
  }
2037
2568
  return true;
2038
2569
  }
2570
+ toArray() {
2571
+ return this.valuesArray();
2572
+ }
2039
2573
  toString() {
2040
- if (this.size === 0) return `SignedIndexArray[ ]`;
2041
- const entries = this.entriesArray().map(([id, value]) => `${id}: ${value}`).join(", ");
2042
- return `SignedIndexArray[ ${entries} ]`;
2574
+ const entries = this.entriesArray().map(([id, v]) => `${formatValue(id)}: ${formatValue(v)}`).join(", ");
2575
+ return `SignedIndexArray[ ${entries} ]`.replaceAll(" ", " ");
2043
2576
  }
2044
2577
  };
2045
2578
 
@@ -2064,7 +2597,7 @@ var Map1 = class _Map1 {
2064
2597
  }
2065
2598
  getOrCreate(key1, creatorOrValue) {
2066
2599
  if (!this.has(key1)) {
2067
- const value = isFunction(creatorOrValue) ? creatorOrValue() : creatorOrValue;
2600
+ const value = isFunction2(creatorOrValue) ? creatorOrValue() : creatorOrValue;
2068
2601
  this.set(key1, value);
2069
2602
  return value;
2070
2603
  }
@@ -2196,8 +2729,8 @@ var Map1 = class _Map1 {
2196
2729
  return new Map(this.map1);
2197
2730
  }
2198
2731
  toString() {
2199
- const entries = [...this.map1].map(([k, v]) => `${k} => ${v}`).join(", ");
2200
- return entries.length === 0 ? `Map1(0){ }` : `Map1(${this.size}){ ${entries} }`;
2732
+ const entries = [...this.map1].map(([k, v]) => `${formatValue(k)} => ${formatValue(v)}`).join(", ");
2733
+ return `Map1(${this.size}){ ${entries} }`.replaceAll(" ", " ");
2201
2734
  }
2202
2735
  };
2203
2736
 
@@ -2231,7 +2764,7 @@ var Map2 = class _Map2 {
2231
2764
  }
2232
2765
  getOrCreate(key1, key2, creatorOrValue) {
2233
2766
  if (!this.has(key1, key2)) {
2234
- const value = isFunction(creatorOrValue) ? creatorOrValue() : creatorOrValue;
2767
+ const value = isFunction2(creatorOrValue) ? creatorOrValue() : creatorOrValue;
2235
2768
  this.set(key1, key2, value);
2236
2769
  return value;
2237
2770
  }
@@ -2390,10 +2923,10 @@ var Map2 = class _Map2 {
2390
2923
  toString() {
2391
2924
  const entries = [];
2392
2925
  for (const [key1, map2] of this.map1) {
2393
- const inner = [...map2].map(([key2, v]) => `${key2} => ${v}`).join(", ");
2394
- entries.push(`${key1} => { ${inner} }`);
2926
+ const inner = [...map2].map(([key2, v]) => `${formatValue(key2)} => ${formatValue(v)}`).join(", ");
2927
+ entries.push(`${formatValue(key1)} => { ${inner} }`);
2395
2928
  }
2396
- return entries.length === 0 ? `Map2(0){ }` : `Map2(${this.size}){ ${entries} }`;
2929
+ return `Map2(${this.size}){ ${entries} }`.replaceAll(" ", " ");
2397
2930
  }
2398
2931
  };
2399
2932
 
@@ -2434,7 +2967,7 @@ var Map3 = class _Map3 {
2434
2967
  }
2435
2968
  getOrCreate(key1, key2, key3, creatorOrValue) {
2436
2969
  if (!this.has(key1, key2, key3)) {
2437
- const value = isFunction(creatorOrValue) ? creatorOrValue() : creatorOrValue;
2970
+ const value = isFunction2(creatorOrValue) ? creatorOrValue() : creatorOrValue;
2438
2971
  this.set(key1, key2, key3, value);
2439
2972
  return value;
2440
2973
  }
@@ -2618,11 +3151,11 @@ var Map3 = class _Map3 {
2618
3151
  const entries = [];
2619
3152
  for (const [key1, map2] of this.map1) {
2620
3153
  for (const [key2, map3] of map2) {
2621
- const inner = [...map3].map(([key3, v]) => `${key3} => ${v}`).join(", ");
2622
- entries.push(`${key1} => ${key2} => { ${inner} }`);
3154
+ const inner = [...map3].map(([key3, v]) => `${formatValue(key3)} => ${formatValue(v)}`).join(", ");
3155
+ entries.push(`${formatValue(key1)} => ${formatValue(key2)} => { ${inner} }`);
2623
3156
  }
2624
3157
  }
2625
- return entries.length === 0 ? `Map3(0){ }` : `Map3(${this.size}){ ${entries.join(", ")} }`;
3158
+ return `Map3(${this.size}){ ${entries.join(", ")} }`.replaceAll(" ", " ");
2626
3159
  }
2627
3160
  };
2628
3161
 
@@ -2684,18 +3217,18 @@ var MultiContainer = class {
2684
3217
  const entries = [];
2685
3218
  for (const keys of this.keys()) {
2686
3219
  const arr = this.getAll(...keys);
2687
- const keyStr = Array.isArray(keys) ? `[${keys.map((k) => JSON.stringify(k)).join(", ")}]` : `[${JSON.stringify(keys)}]`;
2688
- const valuesStr = Array.isArray(arr) ? `[${arr.map((v) => JSON.stringify(v)).join(", ")}]` : "[]";
3220
+ const keyStr = Array.isArray(keys) ? formatValue(keys) : "[ ]";
3221
+ const valuesStr = Array.isArray(arr) ? formatValue(arr) : "[ ]";
2689
3222
  entries.push(`${keyStr} => ${valuesStr}`);
2690
3223
  }
2691
- return `MultiContainer{ ${entries.join(", ")} }`;
3224
+ return `MultiContainer{ ${entries.join(", ")} }`.replaceAll(" ", " ");
2692
3225
  }
2693
3226
  };
2694
3227
  function asMulti(base) {
2695
3228
  return new MultiContainer(base);
2696
3229
  }
2697
3230
 
2698
- // src/core/deprecated/vec2.ts
3231
+ // src/deprecated/vec2.ts
2699
3232
  var Vec2 = class _Vec2 {
2700
3233
  constructor(x, y) {
2701
3234
  __publicField(this, "x");
@@ -2720,7 +3253,7 @@ var Vec2 = class _Vec2 {
2720
3253
  }
2721
3254
  };
2722
3255
 
2723
- // src/core/deprecated/small-int-cache.ts
3256
+ // src/deprecated/small-int-cache.ts
2724
3257
  var SmallIntCache = class {
2725
3258
  // for keys < 0
2726
3259
  constructor() {
@@ -2731,7 +3264,7 @@ var SmallIntCache = class {
2731
3264
  this.neg = [];
2732
3265
  }
2733
3266
  set(key, value) {
2734
- if (!isInteger(key)) {
3267
+ if (!guard_exports.isInteger(key)) {
2735
3268
  throw new Error("Key must be an integer");
2736
3269
  } else if (key >= 0) {
2737
3270
  this.pos[key] = value;
@@ -2740,7 +3273,7 @@ var SmallIntCache = class {
2740
3273
  }
2741
3274
  }
2742
3275
  get(key) {
2743
- if (!isInteger(key)) {
3276
+ if (!guard_exports.isInteger(key)) {
2744
3277
  throw new Error("Key must be an integer");
2745
3278
  } else if (key >= 0) {
2746
3279
  return this.pos[key];
@@ -2749,7 +3282,7 @@ var SmallIntCache = class {
2749
3282
  }
2750
3283
  }
2751
3284
  has(key) {
2752
- if (!isInteger(key)) {
3285
+ if (!guard_exports.isInteger(key)) {
2753
3286
  return false;
2754
3287
  } else if (key >= 0) {
2755
3288
  return key in this.pos;
@@ -2758,7 +3291,7 @@ var SmallIntCache = class {
2758
3291
  }
2759
3292
  }
2760
3293
  delete(key) {
2761
- if (!isInteger(key)) {
3294
+ if (!guard_exports.isInteger(key)) {
2762
3295
  return;
2763
3296
  } else if (key >= 0) {
2764
3297
  delete this.pos[key];
@@ -2772,10 +3305,11 @@ var SmallIntCache = class {
2772
3305
  }
2773
3306
  };
2774
3307
  export {
2775
- Assert,
2776
- Cookies,
2777
- Device,
3308
+ assert_exports as Assert,
3309
+ cookies_exports as Cookies,
3310
+ device_exports as Device,
2778
3311
  DivRect,
3312
+ guard_exports as Guard,
2779
3313
  IndexArray,
2780
3314
  LRUCache,
2781
3315
  Map1,