@symbo.ls/sdk 2.33.41 → 2.34.1

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.
@@ -79,7 +79,7 @@ var init_set = __esm({
79
79
  });
80
80
 
81
81
  // ../../../node_modules/lib0/array.js
82
- var last, appendTo, from, isArray;
82
+ var last, appendTo, from, every, some, unfold, isArray;
83
83
  var init_array = __esm({
84
84
  "../../../node_modules/lib0/array.js"() {
85
85
  last = (arr) => arr[arr.length - 1];
@@ -89,6 +89,29 @@ var init_array = __esm({
89
89
  }
90
90
  };
91
91
  from = Array.from;
92
+ every = (arr, f) => {
93
+ for (let i = 0; i < arr.length; i++) {
94
+ if (!f(arr[i], i, arr)) {
95
+ return false;
96
+ }
97
+ }
98
+ return true;
99
+ };
100
+ some = (arr, f) => {
101
+ for (let i = 0; i < arr.length; i++) {
102
+ if (f(arr[i], i, arr)) {
103
+ return true;
104
+ }
105
+ }
106
+ return false;
107
+ };
108
+ unfold = (len, f) => {
109
+ const array = new Array(len);
110
+ for (let i = 0; i < len; i++) {
111
+ array[i] = f(i, array);
112
+ }
113
+ return array;
114
+ };
92
115
  isArray = Array.isArray;
93
116
  }
94
117
  });
@@ -284,23 +307,24 @@ var init_binary = __esm({
284
307
  });
285
308
 
286
309
  // ../../../node_modules/lib0/number.js
287
- var MAX_SAFE_INTEGER, MIN_SAFE_INTEGER, LOWEST_INT32, isInteger, isNaN3, parseInt2;
310
+ var MAX_SAFE_INTEGER, MIN_SAFE_INTEGER, LOWEST_INT32, isInteger2, isNaN3, parseInt2;
288
311
  var init_number = __esm({
289
312
  "../../../node_modules/lib0/number.js"() {
290
313
  init_math();
291
314
  MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER;
292
315
  MIN_SAFE_INTEGER = Number.MIN_SAFE_INTEGER;
293
316
  LOWEST_INT32 = 1 << 31;
294
- isInteger = Number.isInteger || ((num) => typeof num === "number" && isFinite(num) && floor(num) === num);
317
+ isInteger2 = Number.isInteger || ((num) => typeof num === "number" && isFinite(num) && floor(num) === num);
295
318
  isNaN3 = Number.isNaN;
296
319
  parseInt2 = Number.parseInt;
297
320
  }
298
321
  });
299
322
 
300
323
  // ../../../node_modules/lib0/string.js
301
- var fromCharCode, fromCodePoint, MAX_UTF16_CHARACTER, toLowerCase, trimLeftRegex, trimLeft, fromCamelCaseRegex, fromCamelCase, _encodeUtf8Polyfill, utf8TextEncoder, _encodeUtf8Native, encodeUtf8, utf8TextDecoder;
324
+ var fromCharCode, fromCodePoint, MAX_UTF16_CHARACTER, toLowerCase, trimLeftRegex, trimLeft, fromCamelCaseRegex, fromCamelCase, _encodeUtf8Polyfill, utf8TextEncoder, _encodeUtf8Native, encodeUtf8, utf8TextDecoder, repeat;
302
325
  var init_string = __esm({
303
326
  "../../../node_modules/lib0/string.js"() {
327
+ init_array();
304
328
  fromCharCode = String.fromCharCode;
305
329
  fromCodePoint = String.fromCodePoint;
306
330
  MAX_UTF16_CHARACTER = fromCharCode(65535);
@@ -308,7 +332,7 @@ var init_string = __esm({
308
332
  trimLeftRegex = /^\s*/g;
309
333
  trimLeft = (s) => s.replace(trimLeftRegex, "");
310
334
  fromCamelCaseRegex = /([A-Z])/g;
311
- fromCamelCase = (s, separator) => trimLeft(s.replace(fromCamelCaseRegex, (match) => `${separator}${toLowerCase(match)}`));
335
+ fromCamelCase = (s, separator) => trimLeft(s.replace(fromCamelCaseRegex, (match2) => `${separator}${toLowerCase(match2)}`));
312
336
  _encodeUtf8Polyfill = (str) => {
313
337
  const encodedString = unescape(encodeURIComponent(str));
314
338
  const len = encodedString.length;
@@ -327,6 +351,7 @@ var init_string = __esm({
327
351
  if (utf8TextDecoder && utf8TextDecoder.decode(new Uint8Array()).length === 1) {
328
352
  utf8TextDecoder = null;
329
353
  }
354
+ repeat = (source, n) => unfold(n, () => source).join("");
330
355
  }
331
356
  });
332
357
 
@@ -471,7 +496,7 @@ var init_encoding = __esm({
471
496
  writeVarString(encoder, data2);
472
497
  break;
473
498
  case "number":
474
- if (isInteger(data2) && abs(data2) <= BITS31) {
499
+ if (isInteger2(data2) && abs(data2) <= BITS31) {
475
500
  write(encoder, 125);
476
501
  writeVarInt(encoder, data2);
477
502
  } else if (isFloat32(data2)) {
@@ -674,7 +699,7 @@ var init_decoding = __esm({
674
699
  errorIntegerOutOfRange = create3("Integer out of Range");
675
700
  Decoder2 = class {
676
701
  /**
677
- * @param {Uint8Array} uint8Array Binary data to decode
702
+ * @param {Uint8Array<Buf>} uint8Array Binary data to decode
678
703
  */
679
704
  constructor(uint8Array) {
680
705
  this.arr = uint8Array;
@@ -1001,10 +1026,24 @@ var init_storage = __esm({
1001
1026
  }
1002
1027
  });
1003
1028
 
1029
+ // ../../../node_modules/lib0/trait/equality.js
1030
+ var EqualityTraitSymbol, equals;
1031
+ var init_equality = __esm({
1032
+ "../../../node_modules/lib0/trait/equality.js"() {
1033
+ EqualityTraitSymbol = Symbol("Equality");
1034
+ equals = (a, b) => {
1035
+ var _a;
1036
+ return a === b || !!((_a = a == null ? void 0 : a[EqualityTraitSymbol]) == null ? void 0 : _a.call(a, b)) || false;
1037
+ };
1038
+ }
1039
+ });
1040
+
1004
1041
  // ../../../node_modules/lib0/object.js
1005
- var assign, keys, forEach, size, isEmpty, every, hasProperty, equalFlat, freeze, deepFreeze;
1042
+ var isObject2, assign, keys, forEach, size, isEmpty, every2, hasProperty, equalFlat, freeze, deepFreeze;
1006
1043
  var init_object = __esm({
1007
1044
  "../../../node_modules/lib0/object.js"() {
1045
+ init_equality();
1046
+ isObject2 = (o) => typeof o === "object";
1008
1047
  assign = Object.assign;
1009
1048
  keys = Object.keys;
1010
1049
  forEach = (obj, f) => {
@@ -1019,7 +1058,7 @@ var init_object = __esm({
1019
1058
  }
1020
1059
  return true;
1021
1060
  };
1022
- every = (obj, f) => {
1061
+ every2 = (obj, f) => {
1023
1062
  for (const key in obj) {
1024
1063
  if (!f(obj[key], key)) {
1025
1064
  return false;
@@ -1028,7 +1067,7 @@ var init_object = __esm({
1028
1067
  return true;
1029
1068
  };
1030
1069
  hasProperty = (obj, key) => Object.prototype.hasOwnProperty.call(obj, key);
1031
- equalFlat = (a, b) => a === b || size(a) === size(b) && every(a, (val, key) => (val !== void 0 || hasProperty(b, key)) && b[key] === val);
1070
+ equalFlat = (a, b) => a === b || size(a) === size(b) && every2(a, (val, key) => (val !== void 0 || hasProperty(b, key)) && equals(b[key], val));
1032
1071
  freeze = Object.freeze;
1033
1072
  deepFreeze = (o) => {
1034
1073
  for (const key in o) {
@@ -1043,9 +1082,11 @@ var init_object = __esm({
1043
1082
  });
1044
1083
 
1045
1084
  // ../../../node_modules/lib0/function.js
1046
- var callAll, id, isOneOf;
1085
+ var callAll, id, equalityDeep, isOneOf;
1047
1086
  var init_function = __esm({
1048
1087
  "../../../node_modules/lib0/function.js"() {
1088
+ init_object();
1089
+ init_equality();
1049
1090
  callAll = (fs, args2, i = 0) => {
1050
1091
  try {
1051
1092
  for (; i < fs.length; i++) {
@@ -1058,6 +1099,80 @@ var init_function = __esm({
1058
1099
  }
1059
1100
  };
1060
1101
  id = (a) => a;
1102
+ equalityDeep = (a, b) => {
1103
+ if (a === b) {
1104
+ return true;
1105
+ }
1106
+ if (a == null || b == null || a.constructor !== b.constructor && (a.constructor || Object) !== (b.constructor || Object)) {
1107
+ return false;
1108
+ }
1109
+ if (a[EqualityTraitSymbol] != null) {
1110
+ return a[EqualityTraitSymbol](b);
1111
+ }
1112
+ switch (a.constructor) {
1113
+ case ArrayBuffer:
1114
+ a = new Uint8Array(a);
1115
+ b = new Uint8Array(b);
1116
+ // eslint-disable-next-line no-fallthrough
1117
+ case Uint8Array: {
1118
+ if (a.byteLength !== b.byteLength) {
1119
+ return false;
1120
+ }
1121
+ for (let i = 0; i < a.length; i++) {
1122
+ if (a[i] !== b[i]) {
1123
+ return false;
1124
+ }
1125
+ }
1126
+ break;
1127
+ }
1128
+ case Set: {
1129
+ if (a.size !== b.size) {
1130
+ return false;
1131
+ }
1132
+ for (const value2 of a) {
1133
+ if (!b.has(value2)) {
1134
+ return false;
1135
+ }
1136
+ }
1137
+ break;
1138
+ }
1139
+ case Map: {
1140
+ if (a.size !== b.size) {
1141
+ return false;
1142
+ }
1143
+ for (const key of a.keys()) {
1144
+ if (!b.has(key) || !equalityDeep(a.get(key), b.get(key))) {
1145
+ return false;
1146
+ }
1147
+ }
1148
+ break;
1149
+ }
1150
+ case void 0:
1151
+ case Object:
1152
+ if (size(a) !== size(b)) {
1153
+ return false;
1154
+ }
1155
+ for (const key in a) {
1156
+ if (!hasProperty(a, key) || !equalityDeep(a[key], b[key])) {
1157
+ return false;
1158
+ }
1159
+ }
1160
+ break;
1161
+ case Array:
1162
+ if (a.length !== b.length) {
1163
+ return false;
1164
+ }
1165
+ for (let i = 0; i < a.length; i++) {
1166
+ if (!equalityDeep(a[i], b[i])) {
1167
+ return false;
1168
+ }
1169
+ }
1170
+ break;
1171
+ default:
1172
+ return false;
1173
+ }
1174
+ return true;
1175
+ };
1061
1176
  isOneOf = (value2, options) => options.includes(value2);
1062
1177
  }
1063
1178
  });
@@ -1155,15 +1270,769 @@ var init_pair = __esm({
1155
1270
  }
1156
1271
  });
1157
1272
 
1273
+ // ../../../node_modules/lib0/prng.js
1274
+ var bool, int53, int32, int31, letter, word, oneOf;
1275
+ var init_prng = __esm({
1276
+ "../../../node_modules/lib0/prng.js"() {
1277
+ init_string();
1278
+ init_math();
1279
+ bool = (gen) => gen.next() >= 0.5;
1280
+ int53 = (gen, min2, max2) => floor(gen.next() * (max2 + 1 - min2) + min2);
1281
+ int32 = (gen, min2, max2) => floor(gen.next() * (max2 + 1 - min2) + min2);
1282
+ int31 = (gen, min2, max2) => int32(gen, min2, max2);
1283
+ letter = (gen) => fromCharCode(int31(gen, 97, 122));
1284
+ word = (gen, minLen = 0, maxLen = 20) => {
1285
+ const len = int31(gen, minLen, maxLen);
1286
+ let str = "";
1287
+ for (let i = 0; i < len; i++) {
1288
+ str += letter(gen);
1289
+ }
1290
+ return str;
1291
+ };
1292
+ oneOf = (gen, array) => array[int31(gen, 0, array.length - 1)];
1293
+ }
1294
+ });
1295
+
1296
+ // ../../../node_modules/lib0/schema.js
1297
+ var schemaSymbol, ValidationError, shapeExtends, Schema, $ConstructedBy, $constructedBy, $$constructedBy, $Custom, $custom, $$custom, $Literal, $literal, $$literal, _regexEscape, _schemaStringTemplateToRegex, $StringTemplate, $$stringTemplate, isOptionalSymbol, $Optional, $$optional, $Never, $never, $$never, _$Object, $Object, $object, $$object, $objectAny, $Record, $record, $$record, $Tuple, $tuple, $$tuple, $Array, $array, $$array, $arrayAny, $InstanceOf, $instanceOf, $$instanceOf, $$schema, $Lambda, $$lambda, $function, $Intersection, $$intersect, $Union, $union, $$union, _t, $any, $$any, $bigint, $$bigint, $symbol, $$symbol, $number, $$number, $string, $$string, $boolean, $$boolean, $undefined, $$undefined, $void, $null, $$null, $uint8Array, $$uint8Array, $primitive, $json, $, assert, PatternMatcher, match, _random, random;
1298
+ var init_schema = __esm({
1299
+ "../../../node_modules/lib0/schema.js"() {
1300
+ init_object();
1301
+ init_array();
1302
+ init_error();
1303
+ init_environment();
1304
+ init_equality();
1305
+ init_function();
1306
+ init_string();
1307
+ init_prng();
1308
+ init_number();
1309
+ schemaSymbol = Symbol("0schema");
1310
+ ValidationError = class {
1311
+ constructor() {
1312
+ this._rerrs = [];
1313
+ }
1314
+ /**
1315
+ * @param {string?} path
1316
+ * @param {string} expected
1317
+ * @param {string} has
1318
+ * @param {string?} message
1319
+ */
1320
+ extend(path, expected, has, message = null) {
1321
+ this._rerrs.push({ path, expected, has, message });
1322
+ }
1323
+ toString() {
1324
+ const s = [];
1325
+ for (let i = this._rerrs.length - 1; i > 0; i--) {
1326
+ const r = this._rerrs[i];
1327
+ s.push(repeat(" ", (this._rerrs.length - i) * 2) + `${r.path != null ? `[${r.path}] ` : ""}${r.has} doesn't match ${r.expected}. ${r.message}`);
1328
+ }
1329
+ return s.join("\n");
1330
+ }
1331
+ };
1332
+ shapeExtends = (a, b) => {
1333
+ if (a === b) return true;
1334
+ if (a == null || b == null || a.constructor !== b.constructor) return false;
1335
+ if (a[EqualityTraitSymbol]) return equals(a, b);
1336
+ if (isArray(a)) {
1337
+ return every(
1338
+ a,
1339
+ (aitem) => some(b, (bitem) => shapeExtends(aitem, bitem))
1340
+ );
1341
+ } else if (isObject2(a)) {
1342
+ return every2(
1343
+ a,
1344
+ (aitem, akey) => shapeExtends(aitem, b[akey])
1345
+ );
1346
+ }
1347
+ return false;
1348
+ };
1349
+ Schema = class {
1350
+ /**
1351
+ * @param {Schema<any>} other
1352
+ */
1353
+ extends(other) {
1354
+ let [a, b] = [
1355
+ /** @type {any} */
1356
+ this.shape,
1357
+ /** @type {any} */
1358
+ other.shape
1359
+ ];
1360
+ if (
1361
+ /** @type {typeof Schema<any>} */
1362
+ this.constructor._dilutes
1363
+ ) [b, a] = [a, b];
1364
+ return shapeExtends(a, b);
1365
+ }
1366
+ /**
1367
+ * Overwrite this when necessary. By default, we only check the `shape` property which every shape
1368
+ * should have.
1369
+ * @param {Schema<any>} other
1370
+ */
1371
+ equals(other) {
1372
+ return this.constructor === other.constructor && equalityDeep(this.shape, other.shape);
1373
+ }
1374
+ [schemaSymbol]() {
1375
+ return true;
1376
+ }
1377
+ /**
1378
+ * @param {object} other
1379
+ */
1380
+ [EqualityTraitSymbol](other) {
1381
+ return this.equals(
1382
+ /** @type {any} */
1383
+ other
1384
+ );
1385
+ }
1386
+ /**
1387
+ * Use `schema.validate(obj)` with a typed parameter that is already of typed to be an instance of
1388
+ * Schema. Validate will check the structure of the parameter and return true iff the instance
1389
+ * really is an instance of Schema.
1390
+ *
1391
+ * @param {T} o
1392
+ * @return {boolean}
1393
+ */
1394
+ validate(o) {
1395
+ return this.check(o);
1396
+ }
1397
+ /* c8 ignore start */
1398
+ /**
1399
+ * Similar to validate, but this method accepts untyped parameters.
1400
+ *
1401
+ * @param {any} _o
1402
+ * @param {ValidationError} [_err]
1403
+ * @return {_o is T}
1404
+ */
1405
+ check(_o, _err) {
1406
+ methodUnimplemented();
1407
+ }
1408
+ /* c8 ignore stop */
1409
+ /**
1410
+ * @type {Schema<T?>}
1411
+ */
1412
+ get nullable() {
1413
+ return $union(this, $null);
1414
+ }
1415
+ /**
1416
+ * @type {$Optional<Schema<T>>}
1417
+ */
1418
+ get optional() {
1419
+ return new $Optional(
1420
+ /** @type {Schema<T>} */
1421
+ this
1422
+ );
1423
+ }
1424
+ /**
1425
+ * Cast a variable to a specific type. Returns the casted value, or throws an exception otherwise.
1426
+ * Use this if you know that the type is of a specific type and you just want to convince the type
1427
+ * system.
1428
+ *
1429
+ * **Do not rely on these error messages!**
1430
+ * Performs an assertion check only if not in a production environment.
1431
+ *
1432
+ * @template OO
1433
+ * @param {OO} o
1434
+ * @return {Extract<OO, T> extends never ? T : (OO extends Array<never> ? T : Extract<OO,T>)}
1435
+ */
1436
+ cast(o) {
1437
+ assert(o, this);
1438
+ return (
1439
+ /** @type {any} */
1440
+ o
1441
+ );
1442
+ }
1443
+ /**
1444
+ * EXPECTO PATRONUM!! 🪄
1445
+ * This function protects against type errors. Though it may not work in the real world.
1446
+ *
1447
+ * "After all this time?"
1448
+ * "Always." - Snape, talking about type safety
1449
+ *
1450
+ * Ensures that a variable is a a specific type. Returns the value, or throws an exception if the assertion check failed.
1451
+ * Use this if you know that the type is of a specific type and you just want to convince the type
1452
+ * system.
1453
+ *
1454
+ * Can be useful when defining lambdas: `s.lambda(s.$number, s.$void).expect((n) => n + 1)`
1455
+ *
1456
+ * **Do not rely on these error messages!**
1457
+ * Performs an assertion check if not in a production environment.
1458
+ *
1459
+ * @param {T} o
1460
+ * @return {o extends T ? T : never}
1461
+ */
1462
+ expect(o) {
1463
+ assert(o, this);
1464
+ return o;
1465
+ }
1466
+ };
1467
+ // this.shape must not be defined on Schema. Otherwise typecheck on metatypes (e.g. $$object) won't work as expected anymore
1468
+ /**
1469
+ * If true, the more things are added to the shape the more objects this schema will accept (e.g.
1470
+ * union). By default, the more objects are added, the the fewer objects this schema will accept.
1471
+ * @protected
1472
+ */
1473
+ __publicField(Schema, "_dilutes", false);
1474
+ $ConstructedBy = class extends Schema {
1475
+ /**
1476
+ * @param {C} c
1477
+ * @param {((o:Instance<C>)=>boolean)|null} check
1478
+ */
1479
+ constructor(c, check) {
1480
+ super();
1481
+ this.shape = c;
1482
+ this._c = check;
1483
+ }
1484
+ /**
1485
+ * @param {any} o
1486
+ * @param {ValidationError} [err]
1487
+ * @return {o is C extends ((...args:any[]) => infer T) ? T : (C extends (new (...args:any[]) => any) ? InstanceType<C> : never)} o
1488
+ */
1489
+ check(o, err = void 0) {
1490
+ const c = (o == null ? void 0 : o.constructor) === this.shape && (this._c == null || this._c(o));
1491
+ !c && (err == null ? void 0 : err.extend(null, this.shape.name, o == null ? void 0 : o.constructor.name, (o == null ? void 0 : o.constructor) !== this.shape ? "Constructor match failed" : "Check failed"));
1492
+ return c;
1493
+ }
1494
+ };
1495
+ $constructedBy = (c, check = null) => new $ConstructedBy(c, check);
1496
+ $$constructedBy = $constructedBy($ConstructedBy);
1497
+ $Custom = class extends Schema {
1498
+ /**
1499
+ * @param {(o:any) => boolean} check
1500
+ */
1501
+ constructor(check) {
1502
+ super();
1503
+ this.shape = check;
1504
+ }
1505
+ /**
1506
+ * @param {any} o
1507
+ * @param {ValidationError} err
1508
+ * @return {o is any}
1509
+ */
1510
+ check(o, err) {
1511
+ const c = this.shape(o);
1512
+ !c && (err == null ? void 0 : err.extend(null, "custom prop", o == null ? void 0 : o.constructor.name, "failed to check custom prop"));
1513
+ return c;
1514
+ }
1515
+ };
1516
+ $custom = (check) => new $Custom(check);
1517
+ $$custom = $constructedBy($Custom);
1518
+ $Literal = class extends Schema {
1519
+ /**
1520
+ * @param {Array<T>} literals
1521
+ */
1522
+ constructor(literals) {
1523
+ super();
1524
+ this.shape = literals;
1525
+ }
1526
+ /**
1527
+ *
1528
+ * @param {any} o
1529
+ * @param {ValidationError} [err]
1530
+ * @return {o is T}
1531
+ */
1532
+ check(o, err) {
1533
+ const c = this.shape.some((a) => a === o);
1534
+ !c && (err == null ? void 0 : err.extend(null, this.shape.join(" | "), o.toString()));
1535
+ return c;
1536
+ }
1537
+ };
1538
+ $literal = (...literals) => new $Literal(literals);
1539
+ $$literal = $constructedBy($Literal);
1540
+ _regexEscape = /** @type {any} */
1541
+ RegExp.escape || /** @type {(str:string) => string} */
1542
+ ((str) => str.replace(/[().|&,$^[\]]/g, (s) => "\\" + s));
1543
+ _schemaStringTemplateToRegex = (s) => {
1544
+ if ($string.check(s)) {
1545
+ return [_regexEscape(s)];
1546
+ }
1547
+ if ($$literal.check(s)) {
1548
+ return (
1549
+ /** @type {Array<string|number>} */
1550
+ s.shape.map((v) => v + "")
1551
+ );
1552
+ }
1553
+ if ($$number.check(s)) {
1554
+ return ["[+-]?\\d+.?\\d*"];
1555
+ }
1556
+ if ($$string.check(s)) {
1557
+ return [".*"];
1558
+ }
1559
+ if ($$union.check(s)) {
1560
+ return s.shape.map(_schemaStringTemplateToRegex).flat(1);
1561
+ }
1562
+ unexpectedCase();
1563
+ };
1564
+ $StringTemplate = class extends Schema {
1565
+ /**
1566
+ * @param {T} shape
1567
+ */
1568
+ constructor(shape) {
1569
+ super();
1570
+ this.shape = shape;
1571
+ this._r = new RegExp("^" + shape.map(_schemaStringTemplateToRegex).map((opts) => `(${opts.join("|")})`).join("") + "$");
1572
+ }
1573
+ /**
1574
+ * @param {any} o
1575
+ * @param {ValidationError} [err]
1576
+ * @return {o is CastStringTemplateArgsToTemplate<T>}
1577
+ */
1578
+ check(o, err) {
1579
+ const c = this._r.exec(o) != null;
1580
+ !c && (err == null ? void 0 : err.extend(null, this._r.toString(), o.toString(), "String doesn't match string template."));
1581
+ return c;
1582
+ }
1583
+ };
1584
+ $$stringTemplate = $constructedBy($StringTemplate);
1585
+ isOptionalSymbol = Symbol("optional");
1586
+ $Optional = class extends Schema {
1587
+ /**
1588
+ * @param {S} shape
1589
+ */
1590
+ constructor(shape) {
1591
+ super();
1592
+ this.shape = shape;
1593
+ }
1594
+ /**
1595
+ * @param {any} o
1596
+ * @param {ValidationError} [err]
1597
+ * @return {o is (Unwrap<S>|undefined)}
1598
+ */
1599
+ check(o, err) {
1600
+ const c = o === void 0 || this.shape.check(o);
1601
+ !c && (err == null ? void 0 : err.extend(null, "undefined (optional)", "()"));
1602
+ return c;
1603
+ }
1604
+ get [isOptionalSymbol]() {
1605
+ return true;
1606
+ }
1607
+ };
1608
+ $$optional = $constructedBy($Optional);
1609
+ $Never = class extends Schema {
1610
+ /**
1611
+ * @param {any} _o
1612
+ * @param {ValidationError} [err]
1613
+ * @return {_o is never}
1614
+ */
1615
+ check(_o, err) {
1616
+ err == null ? void 0 : err.extend(null, "never", typeof _o);
1617
+ return false;
1618
+ }
1619
+ };
1620
+ $never = new $Never();
1621
+ $$never = $constructedBy($Never);
1622
+ _$Object = class _$Object extends Schema {
1623
+ /**
1624
+ * @param {S} shape
1625
+ * @param {boolean} partial
1626
+ */
1627
+ constructor(shape, partial = false) {
1628
+ super();
1629
+ this.shape = shape;
1630
+ this._isPartial = partial;
1631
+ }
1632
+ /**
1633
+ * @type {Schema<Partial<$ObjectToType<S>>>}
1634
+ */
1635
+ get partial() {
1636
+ return new _$Object(this.shape, true);
1637
+ }
1638
+ /**
1639
+ * @param {any} o
1640
+ * @param {ValidationError} err
1641
+ * @return {o is $ObjectToType<S>}
1642
+ */
1643
+ check(o, err) {
1644
+ if (o == null) {
1645
+ err == null ? void 0 : err.extend(null, "object", "null");
1646
+ return false;
1647
+ }
1648
+ return every2(this.shape, (vv, vk) => {
1649
+ const c = this._isPartial && !hasProperty(o, vk) || vv.check(o[vk], err);
1650
+ !c && (err == null ? void 0 : err.extend(vk.toString(), vv.toString(), typeof o[vk], "Object property does not match"));
1651
+ return c;
1652
+ });
1653
+ }
1654
+ };
1655
+ __publicField(_$Object, "_dilutes", true);
1656
+ $Object = _$Object;
1657
+ $object = (def) => (
1658
+ /** @type {any} */
1659
+ new $Object(def)
1660
+ );
1661
+ $$object = $constructedBy($Object);
1662
+ $objectAny = $custom((o) => o != null && (o.constructor === Object || o.constructor == null));
1663
+ $Record = class extends Schema {
1664
+ /**
1665
+ * @param {Keys} keys
1666
+ * @param {Values} values
1667
+ */
1668
+ constructor(keys2, values) {
1669
+ super();
1670
+ this.shape = {
1671
+ keys: keys2,
1672
+ values
1673
+ };
1674
+ }
1675
+ /**
1676
+ * @param {any} o
1677
+ * @param {ValidationError} err
1678
+ * @return {o is { [key in Unwrap<Keys>]: Unwrap<Values> }}
1679
+ */
1680
+ check(o, err) {
1681
+ return o != null && every2(o, (vv, vk) => {
1682
+ const ck = this.shape.keys.check(vk, err);
1683
+ !ck && (err == null ? void 0 : err.extend(vk + "", "Record", typeof o, ck ? "Key doesn't match schema" : "Value doesn't match value"));
1684
+ return ck && this.shape.values.check(vv, err);
1685
+ });
1686
+ }
1687
+ };
1688
+ $record = (keys2, values) => new $Record(keys2, values);
1689
+ $$record = $constructedBy($Record);
1690
+ $Tuple = class extends Schema {
1691
+ /**
1692
+ * @param {S} shape
1693
+ */
1694
+ constructor(shape) {
1695
+ super();
1696
+ this.shape = shape;
1697
+ }
1698
+ /**
1699
+ * @param {any} o
1700
+ * @param {ValidationError} err
1701
+ * @return {o is { [K in keyof S]: S[K] extends Schema<infer Type> ? Type : never }}
1702
+ */
1703
+ check(o, err) {
1704
+ return o != null && every2(this.shape, (vv, vk) => {
1705
+ const c = (
1706
+ /** @type {Schema<any>} */
1707
+ vv.check(o[vk], err)
1708
+ );
1709
+ !c && (err == null ? void 0 : err.extend(vk.toString(), "Tuple", typeof vv));
1710
+ return c;
1711
+ });
1712
+ }
1713
+ };
1714
+ $tuple = (...def) => new $Tuple(def);
1715
+ $$tuple = $constructedBy($Tuple);
1716
+ $Array = class extends Schema {
1717
+ /**
1718
+ * @param {Array<S>} v
1719
+ */
1720
+ constructor(v) {
1721
+ super();
1722
+ this.shape = v.length === 1 ? v[0] : new $Union(v);
1723
+ }
1724
+ /**
1725
+ * @param {any} o
1726
+ * @param {ValidationError} [err]
1727
+ * @return {o is Array<S extends Schema<infer T> ? T : never>} o
1728
+ */
1729
+ check(o, err) {
1730
+ const c = isArray(o) && every(o, (oi) => this.shape.check(oi));
1731
+ !c && (err == null ? void 0 : err.extend(null, "Array", ""));
1732
+ return c;
1733
+ }
1734
+ };
1735
+ $array = (...def) => new $Array(def);
1736
+ $$array = $constructedBy($Array);
1737
+ $arrayAny = $custom((o) => isArray(o));
1738
+ $InstanceOf = class extends Schema {
1739
+ /**
1740
+ * @param {new (...args:any) => T} constructor
1741
+ * @param {((o:T) => boolean)|null} check
1742
+ */
1743
+ constructor(constructor, check) {
1744
+ super();
1745
+ this.shape = constructor;
1746
+ this._c = check;
1747
+ }
1748
+ /**
1749
+ * @param {any} o
1750
+ * @param {ValidationError} err
1751
+ * @return {o is T}
1752
+ */
1753
+ check(o, err) {
1754
+ const c = o instanceof this.shape && (this._c == null || this._c(o));
1755
+ !c && (err == null ? void 0 : err.extend(null, this.shape.name, o == null ? void 0 : o.constructor.name));
1756
+ return c;
1757
+ }
1758
+ };
1759
+ $instanceOf = (c, check = null) => new $InstanceOf(c, check);
1760
+ $$instanceOf = $constructedBy($InstanceOf);
1761
+ $$schema = $instanceOf(Schema);
1762
+ $Lambda = class extends Schema {
1763
+ /**
1764
+ * @param {Args} args
1765
+ */
1766
+ constructor(args2) {
1767
+ super();
1768
+ this.len = args2.length - 1;
1769
+ this.args = $tuple(...args2.slice(-1));
1770
+ this.res = args2[this.len];
1771
+ }
1772
+ /**
1773
+ * @param {any} f
1774
+ * @param {ValidationError} err
1775
+ * @return {f is _LArgsToLambdaDef<Args>}
1776
+ */
1777
+ check(f, err) {
1778
+ const c = f.constructor === Function && f.length <= this.len;
1779
+ !c && (err == null ? void 0 : err.extend(null, "function", typeof f));
1780
+ return c;
1781
+ }
1782
+ };
1783
+ $$lambda = $constructedBy($Lambda);
1784
+ $function = $custom((o) => typeof o === "function");
1785
+ $Intersection = class extends Schema {
1786
+ /**
1787
+ * @param {T} v
1788
+ */
1789
+ constructor(v) {
1790
+ super();
1791
+ this.shape = v;
1792
+ }
1793
+ /**
1794
+ * @param {any} o
1795
+ * @param {ValidationError} [err]
1796
+ * @return {o is Intersect<UnwrapArray<T>>}
1797
+ */
1798
+ check(o, err) {
1799
+ const c = every(this.shape, (check) => check.check(o, err));
1800
+ !c && (err == null ? void 0 : err.extend(null, "Intersectinon", typeof o));
1801
+ return c;
1802
+ }
1803
+ };
1804
+ $$intersect = $constructedBy($Intersection, (o) => o.shape.length > 0);
1805
+ $Union = class extends Schema {
1806
+ /**
1807
+ * @param {Array<Schema<S>>} v
1808
+ */
1809
+ constructor(v) {
1810
+ super();
1811
+ this.shape = v;
1812
+ }
1813
+ /**
1814
+ * @param {any} o
1815
+ * @param {ValidationError} [err]
1816
+ * @return {o is S}
1817
+ */
1818
+ check(o, err) {
1819
+ const c = some(this.shape, (vv) => vv.check(o, err));
1820
+ err == null ? void 0 : err.extend(null, "Union", typeof o);
1821
+ return c;
1822
+ }
1823
+ };
1824
+ __publicField($Union, "_dilutes", true);
1825
+ $union = (...schemas) => schemas.findIndex(($s) => $$union.check($s)) >= 0 ? $union(...schemas.map(($s) => $($s)).map(($s) => $$union.check($s) ? $s.shape : [$s]).flat(1)) : schemas.length === 1 ? schemas[0] : new $Union(schemas);
1826
+ $$union = /** @type {Schema<$Union<any>>} */
1827
+ $constructedBy($Union);
1828
+ _t = () => true;
1829
+ $any = $custom(_t);
1830
+ $$any = /** @type {Schema<Schema<any>>} */
1831
+ $constructedBy($Custom, (o) => o.shape === _t);
1832
+ $bigint = $custom((o) => typeof o === "bigint");
1833
+ $$bigint = /** @type {Schema<Schema<BigInt>>} */
1834
+ $custom((o) => o === $bigint);
1835
+ $symbol = $custom((o) => typeof o === "symbol");
1836
+ $$symbol = /** @type {Schema<Schema<Symbol>>} */
1837
+ $custom((o) => o === $symbol);
1838
+ $number = $custom((o) => typeof o === "number");
1839
+ $$number = /** @type {Schema<Schema<number>>} */
1840
+ $custom((o) => o === $number);
1841
+ $string = $custom((o) => typeof o === "string");
1842
+ $$string = /** @type {Schema<Schema<string>>} */
1843
+ $custom((o) => o === $string);
1844
+ $boolean = $custom((o) => typeof o === "boolean");
1845
+ $$boolean = /** @type {Schema<Schema<Boolean>>} */
1846
+ $custom((o) => o === $boolean);
1847
+ $undefined = $literal(void 0);
1848
+ $$undefined = /** @type {Schema<Schema<undefined>>} */
1849
+ $constructedBy($Literal, (o) => o.shape.length === 1 && o.shape[0] === void 0);
1850
+ $void = $literal(void 0);
1851
+ $null = $literal(null);
1852
+ $$null = /** @type {Schema<Schema<null>>} */
1853
+ $constructedBy($Literal, (o) => o.shape.length === 1 && o.shape[0] === null);
1854
+ $uint8Array = $constructedBy(Uint8Array);
1855
+ $$uint8Array = /** @type {Schema<Schema<Uint8Array>>} */
1856
+ $constructedBy($ConstructedBy, (o) => o.shape === Uint8Array);
1857
+ $primitive = $union($number, $string, $null, $undefined, $bigint, $boolean, $symbol);
1858
+ $json = (() => {
1859
+ const $jsonArr = (
1860
+ /** @type {$Array<$any>} */
1861
+ $array($any)
1862
+ );
1863
+ const $jsonRecord = (
1864
+ /** @type {$Record<$string,$any>} */
1865
+ $record($string, $any)
1866
+ );
1867
+ const $json2 = $union($number, $string, $null, $boolean, $jsonArr, $jsonRecord);
1868
+ $jsonArr.shape = $json2;
1869
+ $jsonRecord.shape.values = $json2;
1870
+ return $json2;
1871
+ })();
1872
+ $ = (o) => {
1873
+ if ($$schema.check(o)) {
1874
+ return (
1875
+ /** @type {any} */
1876
+ o
1877
+ );
1878
+ } else if ($objectAny.check(o)) {
1879
+ const o2 = {};
1880
+ for (const k in o) {
1881
+ o2[k] = $(o[k]);
1882
+ }
1883
+ return (
1884
+ /** @type {any} */
1885
+ $object(o2)
1886
+ );
1887
+ } else if ($arrayAny.check(o)) {
1888
+ return (
1889
+ /** @type {any} */
1890
+ $union(...o.map($))
1891
+ );
1892
+ } else if ($primitive.check(o)) {
1893
+ return (
1894
+ /** @type {any} */
1895
+ $literal(o)
1896
+ );
1897
+ } else if ($function.check(o)) {
1898
+ return (
1899
+ /** @type {any} */
1900
+ $constructedBy(
1901
+ /** @type {any} */
1902
+ o
1903
+ )
1904
+ );
1905
+ }
1906
+ unexpectedCase();
1907
+ };
1908
+ assert = production ? () => {
1909
+ } : (o, schema) => {
1910
+ const err = new ValidationError();
1911
+ if (!schema.check(o, err)) {
1912
+ throw create3(`Expected value to be of type ${schema.constructor.name}.
1913
+ ${err.toString()}`);
1914
+ }
1915
+ };
1916
+ PatternMatcher = class {
1917
+ /**
1918
+ * @param {Schema<State>} [$state]
1919
+ */
1920
+ constructor($state) {
1921
+ this.patterns = [];
1922
+ this.$state = $state;
1923
+ }
1924
+ /**
1925
+ * @template P
1926
+ * @template R
1927
+ * @param {P} pattern
1928
+ * @param {(o:NoInfer<Unwrap<ReadSchema<P>>>,s:State)=>R} handler
1929
+ * @return {PatternMatcher<State,Patterns|Pattern<Unwrap<ReadSchema<P>>,R>>}
1930
+ */
1931
+ if(pattern, handler) {
1932
+ this.patterns.push({ if: $(pattern), h: handler });
1933
+ return this;
1934
+ }
1935
+ /**
1936
+ * @template R
1937
+ * @param {(o:any,s:State)=>R} h
1938
+ */
1939
+ else(h) {
1940
+ return this.if($any, h);
1941
+ }
1942
+ /**
1943
+ * @return {State extends undefined
1944
+ * ? <In extends Unwrap<Patterns['if']>>(o:In,state?:undefined)=>PatternMatchResult<Patterns,In>
1945
+ * : <In extends Unwrap<Patterns['if']>>(o:In,state:State)=>PatternMatchResult<Patterns,In>}
1946
+ */
1947
+ done() {
1948
+ return (
1949
+ /** @type {any} */
1950
+ (o, s) => {
1951
+ for (let i = 0; i < this.patterns.length; i++) {
1952
+ const p = this.patterns[i];
1953
+ if (p.if.check(o)) {
1954
+ return p.h(o, s);
1955
+ }
1956
+ }
1957
+ throw create3("Unhandled pattern");
1958
+ }
1959
+ );
1960
+ }
1961
+ };
1962
+ match = (state) => new PatternMatcher(
1963
+ /** @type {any} */
1964
+ state
1965
+ );
1966
+ _random = /** @type {any} */
1967
+ match(
1968
+ /** @type {Schema<prng.PRNG>} */
1969
+ $any
1970
+ ).if($$number, (_o, gen) => int53(gen, MIN_SAFE_INTEGER, MAX_SAFE_INTEGER)).if($$string, (_o, gen) => word(gen)).if($$boolean, (_o, gen) => bool(gen)).if($$bigint, (_o, gen) => BigInt(int53(gen, MIN_SAFE_INTEGER, MAX_SAFE_INTEGER))).if($$union, (o, gen) => random(gen, oneOf(gen, o.shape))).if($$object, (o, gen) => {
1971
+ const res = {};
1972
+ for (const k in o.shape) {
1973
+ let prop = o.shape[k];
1974
+ if ($$optional.check(prop)) {
1975
+ if (bool(gen)) {
1976
+ continue;
1977
+ }
1978
+ prop = prop.shape;
1979
+ }
1980
+ res[k] = _random(prop, gen);
1981
+ }
1982
+ return res;
1983
+ }).if($$array, (o, gen) => {
1984
+ const arr = [];
1985
+ const n = int32(gen, 0, 42);
1986
+ for (let i = 0; i < n; i++) {
1987
+ arr.push(random(gen, o.shape));
1988
+ }
1989
+ return arr;
1990
+ }).if($$literal, (o, gen) => {
1991
+ return oneOf(gen, o.shape);
1992
+ }).if($$null, (o, gen) => {
1993
+ return null;
1994
+ }).if($$lambda, (o, gen) => {
1995
+ const res = random(gen, o.res);
1996
+ return () => res;
1997
+ }).if($$any, (o, gen) => random(gen, oneOf(gen, [
1998
+ $number,
1999
+ $string,
2000
+ $null,
2001
+ $undefined,
2002
+ $bigint,
2003
+ $boolean,
2004
+ $array($number),
2005
+ $record($union("a", "b", "c"), $number)
2006
+ ]))).if($$record, (o, gen) => {
2007
+ const res = {};
2008
+ const keysN = int53(gen, 0, 3);
2009
+ for (let i = 0; i < keysN; i++) {
2010
+ const key = random(gen, o.shape.keys);
2011
+ const val = random(gen, o.shape.values);
2012
+ res[key] = val;
2013
+ }
2014
+ return res;
2015
+ }).done();
2016
+ random = (gen, schema) => (
2017
+ /** @type {any} */
2018
+ _random($(schema), gen)
2019
+ );
2020
+ }
2021
+ });
2022
+
1158
2023
  // ../../../node_modules/lib0/dom.js
1159
- var doc, domParser, mapToStyleString, ELEMENT_NODE, TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, DOCUMENT_FRAGMENT_NODE;
2024
+ var doc, $fragment, domParser, $element, $text, mapToStyleString, ELEMENT_NODE, TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, DOCUMENT_FRAGMENT_NODE, $node;
1160
2025
  var init_dom = __esm({
1161
2026
  "../../../node_modules/lib0/dom.js"() {
1162
2027
  init_map();
2028
+ init_schema();
1163
2029
  doc = /** @type {Document} */
1164
2030
  typeof document !== "undefined" ? document : {};
2031
+ $fragment = $custom((el) => el.nodeType === DOCUMENT_FRAGMENT_NODE);
1165
2032
  domParser = /** @type {DOMParser} */
1166
2033
  typeof DOMParser !== "undefined" ? new DOMParser() : null;
2034
+ $element = $custom((el) => el.nodeType === ELEMENT_NODE);
2035
+ $text = $custom((el) => el.nodeType === TEXT_NODE);
1167
2036
  mapToStyleString = (m) => map(m, (value2, key) => `${key}:${value2};`).join("");
1168
2037
  ELEMENT_NODE = doc.ELEMENT_NODE;
1169
2038
  TEXT_NODE = doc.TEXT_NODE;
@@ -1172,6 +2041,7 @@ var init_dom = __esm({
1172
2041
  DOCUMENT_NODE = doc.DOCUMENT_NODE;
1173
2042
  DOCUMENT_TYPE_NODE = doc.DOCUMENT_TYPE_NODE;
1174
2043
  DOCUMENT_FRAGMENT_NODE = doc.DOCUMENT_FRAGMENT_NODE;
2044
+ $node = $custom((el) => el.nodeType === DOCUMENT_NODE);
1175
2045
  }
1176
2046
  });
1177
2047
 
@@ -2962,15 +3832,19 @@ var init_yjs = __esm({
2962
3832
  event._path = null;
2963
3833
  });
2964
3834
  events.sort((event1, event2) => event1.path.length - event2.path.length);
2965
- callEventHandlerListeners(type._dEH, events, transaction);
3835
+ fs.push(() => {
3836
+ callEventHandlerListeners(type._dEH, events, transaction);
3837
+ });
3838
+ }
3839
+ });
3840
+ fs.push(() => doc2.emit("afterTransaction", [transaction, doc2]));
3841
+ fs.push(() => {
3842
+ if (transaction._needFormattingCleanup) {
3843
+ cleanupYTextAfterTransaction(transaction);
2966
3844
  }
2967
3845
  });
2968
3846
  });
2969
- fs.push(() => doc2.emit("afterTransaction", [transaction, doc2]));
2970
3847
  callAll(fs, []);
2971
- if (transaction._needFormattingCleanup) {
2972
- cleanupYTextAfterTransaction(transaction);
2973
- }
2974
3848
  } finally {
2975
3849
  if (doc2.gc) {
2976
3850
  tryGcDeleteSet(ds, store, doc2.gcFilter);
@@ -3354,7 +4228,7 @@ var init_yjs = __esm({
3354
4228
  return isDeleted(this.transaction.deleteSet, struct.id);
3355
4229
  }
3356
4230
  /**
3357
- * @type {Map<string, { action: 'add' | 'update' | 'delete', oldValue: any, newValue: any }>}
4231
+ * @type {Map<string, { action: 'add' | 'update' | 'delete', oldValue: any }>}
3358
4232
  */
3359
4233
  get keys() {
3360
4234
  if (this._keys === null) {
@@ -6060,11 +6934,13 @@ var init_yjs = __esm({
6060
6934
  const el = new _YXmlElement(this.nodeName);
6061
6935
  const attrs = this.getAttributes();
6062
6936
  forEach(attrs, (value2, key) => {
6063
- if (typeof value2 === "string") {
6064
- el.setAttribute(key, value2);
6065
- }
6937
+ el.setAttribute(
6938
+ key,
6939
+ /** @type {any} */
6940
+ value2
6941
+ );
6066
6942
  });
6067
- el.insert(0, this.toArray().map((item) => item instanceof AbstractType ? item.clone() : item));
6943
+ el.insert(0, this.toArray().map((v) => v instanceof AbstractType ? v.clone() : v));
6068
6944
  return el;
6069
6945
  }
6070
6946
  /**
@@ -8117,7 +8993,7 @@ var require_dexie = __commonJS({
8117
8993
  function override(origFunc, overridedFactory) {
8118
8994
  return overridedFactory(origFunc);
8119
8995
  }
8120
- function assert(b) {
8996
+ function assert2(b) {
8121
8997
  if (!b)
8122
8998
  throw new Error("Assertion Failed");
8123
8999
  }
@@ -8161,7 +9037,7 @@ var require_dexie = __commonJS({
8161
9037
  if ("isFrozen" in Object && Object.isFrozen(obj))
8162
9038
  return;
8163
9039
  if (typeof keyPath !== "string" && "length" in keyPath) {
8164
- assert(typeof value2 !== "string" && "length" in value2);
9040
+ assert2(typeof value2 !== "string" && "length" in value2);
8165
9041
  for (var i = 0, l = keyPath.length; i < l; ++i) {
8166
9042
  setByKeyPath(obj, keyPath[i], value2[i]);
8167
9043
  }
@@ -9431,7 +10307,7 @@ var require_dexie = __commonJS({
9431
10307
  if (!compoundIndex && debug)
9432
10308
  console.warn("The query ".concat(JSON.stringify(indexOrCrit), " on ").concat(this.name, " would benefit from a ") + "compound index [".concat(keyPaths.join("+"), "]"));
9433
10309
  var idxByName = this.schema.idxByName;
9434
- function equals(a, b) {
10310
+ function equals2(a, b) {
9435
10311
  return cmp2(a, b) === 0;
9436
10312
  }
9437
10313
  var _a2 = keyPaths.reduce(function(_a3, keyPath) {
@@ -9443,10 +10319,10 @@ var require_dexie = __commonJS({
9443
10319
  prevIndex || !index ? combine(prevFilterFn, index && index.multi ? function(x) {
9444
10320
  var prop = getByKeyPath(x, keyPath);
9445
10321
  return isArray3(prop) && prop.some(function(item) {
9446
- return equals(value2, item);
10322
+ return equals2(value2, item);
9447
10323
  });
9448
10324
  } : function(x) {
9449
- return equals(value2, getByKeyPath(x, keyPath));
10325
+ return equals2(value2, getByKeyPath(x, keyPath));
9450
10326
  }) : prevFilterFn
9451
10327
  ];
9452
10328
  }, [null, null]), idx = _a2[0], filterFunction = _a2[1];
@@ -10434,7 +11310,7 @@ var require_dexie = __commonJS({
10434
11310
  return key.substr(0, upperNeedle.length);
10435
11311
  return llp < 0 ? null : key.substr(0, llp) + lowerNeedle[llp] + upperNeedle.substr(llp + 1);
10436
11312
  }
10437
- function addIgnoreCaseAlgorithm(whereClause, match, needles, suffix) {
11313
+ function addIgnoreCaseAlgorithm(whereClause, match2, needles, suffix) {
10438
11314
  var upper, lower, compare, upperNeedles, lowerNeedles, direction, nextKeySuffix, needlesLen = needles.length;
10439
11315
  if (!needles.every(function(s) {
10440
11316
  return typeof s === "string";
@@ -10472,7 +11348,7 @@ var require_dexie = __commonJS({
10472
11348
  if (typeof key !== "string")
10473
11349
  return false;
10474
11350
  var lowerKey = lower(key);
10475
- if (match(lowerKey, lowerNeedles, firstPossibleNeedle)) {
11351
+ if (match2(lowerKey, lowerNeedles, firstPossibleNeedle)) {
10476
11352
  return true;
10477
11353
  } else {
10478
11354
  var lowestPossibleCasing = null;
@@ -10810,14 +11686,14 @@ var require_dexie = __commonJS({
10810
11686
  function Transaction3() {
10811
11687
  }
10812
11688
  Transaction3.prototype._lock = function() {
10813
- assert(!PSD.global);
11689
+ assert2(!PSD.global);
10814
11690
  ++this._reculock;
10815
11691
  if (this._reculock === 1 && !PSD.global)
10816
11692
  PSD.lockOwnerFor = this;
10817
11693
  return this;
10818
11694
  };
10819
11695
  Transaction3.prototype._unlock = function() {
10820
- assert(!PSD.global);
11696
+ assert2(!PSD.global);
10821
11697
  if (--this._reculock === 0) {
10822
11698
  if (!PSD.global)
10823
11699
  PSD.lockOwnerFor = null;
@@ -10840,7 +11716,7 @@ var require_dexie = __commonJS({
10840
11716
  return this;
10841
11717
  var idbdb = this.db.idbdb;
10842
11718
  var dbOpenError = this.db._state.dbOpenError;
10843
- assert(!this.idbtrans);
11719
+ assert2(!this.idbtrans);
10844
11720
  if (!idbtrans && !idbdb) {
10845
11721
  switch (dbOpenError && dbOpenError.name) {
10846
11722
  case "DatabaseClosedError":
@@ -10853,7 +11729,7 @@ var require_dexie = __commonJS({
10853
11729
  }
10854
11730
  if (!this.active)
10855
11731
  throw new exceptions.TransactionInactive();
10856
- assert(this._completion._state === null);
11732
+ assert2(this._completion._state === null);
10857
11733
  idbtrans = this.idbtrans = idbtrans || (this.db.core ? this.db.core.transaction(this.storeNames, this.mode, { durability: this.chromeTransactionDurability }) : idbdb.transaction(this.storeNames, this.mode, { durability: this.chromeTransactionDurability }));
10858
11734
  idbtrans.onerror = wrap(function(ev) {
10859
11735
  preventDefault(ev);
@@ -15454,7 +16330,7 @@ var Transport = class extends Emitter {
15454
16330
  return hostname.indexOf(":") === -1 ? hostname : "[" + hostname + "]";
15455
16331
  }
15456
16332
  _port() {
15457
- if (this.opts.port && (this.opts.secure && Number(this.opts.port !== 443) || !this.opts.secure && Number(this.opts.port) !== 80)) {
16333
+ if (this.opts.port && (this.opts.secure && Number(this.opts.port) !== 443 || !this.opts.secure && Number(this.opts.port) !== 80)) {
15458
16334
  return ":" + this.opts.port;
15459
16335
  } else {
15460
16336
  return "";
@@ -16685,6 +17561,7 @@ __export(esm_exports, {
16685
17561
  Decoder: () => Decoder,
16686
17562
  Encoder: () => Encoder,
16687
17563
  PacketType: () => PacketType,
17564
+ isPacketValid: () => isPacketValid,
16688
17565
  protocol: () => protocol3
16689
17566
  });
16690
17567
 
@@ -16790,10 +17667,15 @@ function _reconstructPacket(data2, buffers) {
16790
17667
  // ../../../node_modules/socket.io-parser/build/esm/index.js
16791
17668
  var RESERVED_EVENTS = [
16792
17669
  "connect",
17670
+ // used on the client side
16793
17671
  "connect_error",
17672
+ // used on the client side
16794
17673
  "disconnect",
17674
+ // used on both sides
16795
17675
  "disconnecting",
17676
+ // used on the server side
16796
17677
  "newListener",
17678
+ // used by the Node.js EventEmitter
16797
17679
  "removeListener"
16798
17680
  // used by the Node.js EventEmitter
16799
17681
  ];
@@ -16868,9 +17750,6 @@ var Encoder = class {
16868
17750
  return buffers;
16869
17751
  }
16870
17752
  };
16871
- function isObject(value2) {
16872
- return Object.prototype.toString.call(value2) === "[object Object]";
16873
- }
16874
17753
  var Decoder = class _Decoder extends Emitter {
16875
17754
  /**
16876
17755
  * Decoder constructor
@@ -17042,6 +17921,37 @@ var BinaryReconstructor = class {
17042
17921
  this.buffers = [];
17043
17922
  }
17044
17923
  };
17924
+ function isNamespaceValid(nsp) {
17925
+ return typeof nsp === "string";
17926
+ }
17927
+ var isInteger = Number.isInteger || function(value2) {
17928
+ return typeof value2 === "number" && isFinite(value2) && Math.floor(value2) === value2;
17929
+ };
17930
+ function isAckIdValid(id2) {
17931
+ return id2 === void 0 || isInteger(id2);
17932
+ }
17933
+ function isObject(value2) {
17934
+ return Object.prototype.toString.call(value2) === "[object Object]";
17935
+ }
17936
+ function isDataValid(type, payload) {
17937
+ switch (type) {
17938
+ case PacketType.CONNECT:
17939
+ return payload === void 0 || isObject(payload);
17940
+ case PacketType.DISCONNECT:
17941
+ return payload === void 0;
17942
+ case PacketType.EVENT:
17943
+ return Array.isArray(payload) && (typeof payload[0] === "number" || typeof payload[0] === "string" && RESERVED_EVENTS.indexOf(payload[0]) === -1);
17944
+ case PacketType.ACK:
17945
+ return Array.isArray(payload);
17946
+ case PacketType.CONNECT_ERROR:
17947
+ return typeof payload === "string" || isObject(payload);
17948
+ default:
17949
+ return false;
17950
+ }
17951
+ }
17952
+ function isPacketValid(packet) {
17953
+ return isNamespaceValid(packet.nsp) && isAckIdValid(packet.id) && isDataValid(packet.type, packet.data);
17954
+ }
17045
17955
 
17046
17956
  // ../../../node_modules/socket.io-client/build/esm/on.js
17047
17957
  function on(obj, ev, fn) {
@@ -17307,7 +18217,6 @@ var Socket2 = class extends Emitter {
17307
18217
  };
17308
18218
  args2.push((err, ...responseArgs) => {
17309
18219
  if (packet !== this._queue[0]) {
17310
- return;
17311
18220
  }
17312
18221
  const hasError = err !== null;
17313
18222
  if (hasError) {
@@ -17539,8 +18448,8 @@ var Socket2 = class extends Emitter {
17539
18448
  this._pid = pid;
17540
18449
  this.connected = true;
17541
18450
  this.emitBuffered();
17542
- this.emitReserved("connect");
17543
18451
  this._drainQueue(true);
18452
+ this.emitReserved("connect");
17544
18453
  }
17545
18454
  /**
17546
18455
  * Emit buffered events (received and emitted).
@@ -19208,17 +20117,17 @@ pp$9.strictDirective = function(start) {
19208
20117
  for (; ; ) {
19209
20118
  skipWhiteSpace.lastIndex = start;
19210
20119
  start += skipWhiteSpace.exec(this.input)[0].length;
19211
- var match = literal.exec(this.input.slice(start));
19212
- if (!match) {
20120
+ var match2 = literal.exec(this.input.slice(start));
20121
+ if (!match2) {
19213
20122
  return false;
19214
20123
  }
19215
- if ((match[1] || match[2]) === "use strict") {
19216
- skipWhiteSpace.lastIndex = start + match[0].length;
20124
+ if ((match2[1] || match2[2]) === "use strict") {
20125
+ skipWhiteSpace.lastIndex = start + match2[0].length;
19217
20126
  var spaceAfter = skipWhiteSpace.exec(this.input), end = spaceAfter.index + spaceAfter[0].length;
19218
20127
  var next = this.input.charAt(end);
19219
20128
  return next === ";" || next === "}" || lineBreak.test(spaceAfter[0]) && !(/[(`.[+\-/*%<>=,?^&]/.test(next) || next === "!" && this.input.charAt(end + 1) === "=");
19220
20129
  }
19221
- start += match[0].length;
20130
+ start += match2[0].length;
19222
20131
  skipWhiteSpace.lastIndex = start;
19223
20132
  start += skipWhiteSpace.exec(this.input)[0].length;
19224
20133
  if (this.input[start] === ";") {
@@ -24198,7 +25107,7 @@ pp.readHexChar = function(len) {
24198
25107
  };
24199
25108
  pp.readWord1 = function() {
24200
25109
  this.containsEsc = false;
24201
- var word = "", first = true, chunkStart = this.pos;
25110
+ var word2 = "", first = true, chunkStart = this.pos;
24202
25111
  var astral = this.options.ecmaVersion >= 6;
24203
25112
  while (this.pos < this.input.length) {
24204
25113
  var ch = this.fullCharCodeAtPos();
@@ -24206,7 +25115,7 @@ pp.readWord1 = function() {
24206
25115
  this.pos += ch <= 65535 ? 1 : 2;
24207
25116
  } else if (ch === 92) {
24208
25117
  this.containsEsc = true;
24209
- word += this.input.slice(chunkStart, this.pos);
25118
+ word2 += this.input.slice(chunkStart, this.pos);
24210
25119
  var escStart = this.pos;
24211
25120
  if (this.input.charCodeAt(++this.pos) !== 117) {
24212
25121
  this.invalidStringToken(this.pos, "Expecting Unicode escape sequence \\uXXXX");
@@ -24216,22 +25125,22 @@ pp.readWord1 = function() {
24216
25125
  if (!(first ? isIdentifierStart : isIdentifierChar)(esc, astral)) {
24217
25126
  this.invalidStringToken(escStart, "Invalid Unicode escape");
24218
25127
  }
24219
- word += codePointToString(esc);
25128
+ word2 += codePointToString(esc);
24220
25129
  chunkStart = this.pos;
24221
25130
  } else {
24222
25131
  break;
24223
25132
  }
24224
25133
  first = false;
24225
25134
  }
24226
- return word + this.input.slice(chunkStart, this.pos);
25135
+ return word2 + this.input.slice(chunkStart, this.pos);
24227
25136
  };
24228
25137
  pp.readWord = function() {
24229
- var word = this.readWord1();
25138
+ var word2 = this.readWord1();
24230
25139
  var type = types$1.name;
24231
- if (this.keywords.test(word)) {
24232
- type = keywords[word];
25140
+ if (this.keywords.test(word2)) {
25141
+ type = keywords[word2];
24233
25142
  }
24234
- return this.finishToken(type, word);
25143
+ return this.finishToken(type, word2);
24235
25144
  };
24236
25145
  var version = "8.15.0";
24237
25146
  Parser.acorn = {