indexeddbshim 16.1.0 → 17.0.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.
Files changed (75) hide show
  1. package/README.md +3 -3
  2. package/badges/licenses-badge-dev.svg +1 -1
  3. package/badges/licenses-badge.svg +1 -1
  4. package/dist/CFG.d.ts.map +1 -1
  5. package/dist/DOMException.d.ts.map +1 -1
  6. package/dist/DOMStringList.d.ts.map +1 -1
  7. package/dist/IDBCursor.d.ts +3 -1
  8. package/dist/IDBCursor.d.ts.map +1 -1
  9. package/dist/IDBDatabase.d.ts +2 -1
  10. package/dist/IDBDatabase.d.ts.map +1 -1
  11. package/dist/IDBFactory.d.ts +2 -1
  12. package/dist/IDBFactory.d.ts.map +1 -1
  13. package/dist/IDBIndex.d.ts +2 -1
  14. package/dist/IDBIndex.d.ts.map +1 -1
  15. package/dist/IDBKeyRange.d.ts +1 -1
  16. package/dist/IDBKeyRange.d.ts.map +1 -1
  17. package/dist/IDBObjectStore.d.ts +2 -1
  18. package/dist/IDBObjectStore.d.ts.map +1 -1
  19. package/dist/IDBRequest.d.ts +5 -3
  20. package/dist/IDBRequest.d.ts.map +1 -1
  21. package/dist/IDBTransaction.d.ts +2 -1
  22. package/dist/IDBTransaction.d.ts.map +1 -1
  23. package/dist/Key.d.ts.map +1 -1
  24. package/dist/Sca.d.ts.map +1 -1
  25. package/dist/UnicodeIdentifiers.d.ts.map +1 -1
  26. package/dist/browser-noninvasive.d.ts.map +1 -1
  27. package/dist/indexeddbshim-Key.js +1844 -1669
  28. package/dist/indexeddbshim-Key.js.map +1 -1
  29. package/dist/indexeddbshim-Key.min.js +2 -2
  30. package/dist/indexeddbshim-Key.min.js.map +1 -1
  31. package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs +972 -1076
  32. package/dist/indexeddbshim-UnicodeIdentifiers-node.cjs.map +1 -1
  33. package/dist/indexeddbshim-UnicodeIdentifiers.js +2704 -2034
  34. package/dist/indexeddbshim-UnicodeIdentifiers.js.map +1 -1
  35. package/dist/indexeddbshim-UnicodeIdentifiers.min.js +9 -2
  36. package/dist/indexeddbshim-UnicodeIdentifiers.min.js.map +1 -1
  37. package/dist/indexeddbshim-node.cjs +972 -1076
  38. package/dist/indexeddbshim-node.cjs.map +1 -1
  39. package/dist/indexeddbshim-noninvasive.js +2703 -2033
  40. package/dist/indexeddbshim-noninvasive.js.map +1 -1
  41. package/dist/indexeddbshim-noninvasive.min.js +9 -2
  42. package/dist/indexeddbshim-noninvasive.min.js.map +1 -1
  43. package/dist/indexeddbshim.js +2676 -2014
  44. package/dist/indexeddbshim.js.map +1 -1
  45. package/dist/indexeddbshim.min.js +9 -2
  46. package/dist/indexeddbshim.min.js.map +1 -1
  47. package/dist/node-UnicodeIdentifiers.d.ts +2 -2
  48. package/dist/node-UnicodeIdentifiers.d.ts.map +1 -1
  49. package/dist/node.d.ts +2 -2
  50. package/dist/node.d.ts.map +1 -1
  51. package/dist/util.d.ts.map +1 -1
  52. package/package.json +111 -103
  53. package/src/CFG.js +2 -3
  54. package/src/DOMException.js +11 -9
  55. package/src/DOMStringList.js +8 -3
  56. package/src/Event.js +2 -0
  57. package/src/IDBCursor.js +16 -9
  58. package/src/IDBDatabase.js +9 -6
  59. package/src/IDBFactory.js +21 -14
  60. package/src/IDBIndex.js +82 -77
  61. package/src/IDBKeyRange.js +42 -35
  62. package/src/IDBObjectStore.js +83 -77
  63. package/src/IDBRequest.js +28 -15
  64. package/src/IDBTransaction.js +8 -4
  65. package/src/IDBVersionChangeEvent.js +2 -0
  66. package/src/Key.js +18 -12
  67. package/src/Sca.js +2 -1
  68. package/src/UnicodeIdentifiers.js +2 -2
  69. package/src/browser-UnicodeIdentifiers.js +0 -1
  70. package/src/browser-noninvasive.js +0 -1
  71. package/src/browser.js +0 -1
  72. package/src/node-UnicodeIdentifiers.js +1 -1
  73. package/src/node.js +1 -1
  74. package/src/setGlobalVars.js +13 -13
  75. package/src/util.js +13 -12
@@ -1,4 +1,4 @@
1
- /*! indexeddbshim - v16.1.0 - 9/1/2025 */
1
+ /*! indexeddbshim - v17.0.0 - 7/28/2026 */
2
2
 
3
3
  'use strict';
4
4
 
@@ -8,14 +8,14 @@ var require$$0 = require('fs');
8
8
  var require$$2 = require('events');
9
9
  var require$$0$1 = require('util');
10
10
 
11
- function _typeof$1(obj) {
11
+ function _typeof(obj) {
12
12
  "@babel/helpers - typeof";
13
13
 
14
- return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
14
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
15
15
  return typeof obj;
16
16
  } : function (obj) {
17
17
  return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
18
- }, _typeof$1(obj);
18
+ }, _typeof(obj);
19
19
  }
20
20
 
21
21
  /* eslint-disable n/no-sync -- Want sync naming */
@@ -843,7 +843,7 @@ Object.assign(EventTarget.prototype, {
843
843
  }
844
844
  var triggerGlobalErrorEvent;
845
845
  var useNodeImpl = false;
846
- if (typeof window === 'undefined' || typeof ErrorEvent === 'undefined' || window && (typeof window === "undefined" ? "undefined" : _typeof$1(window)) === 'object' && !window.dispatchEvent) {
846
+ if (typeof window === 'undefined' || typeof ErrorEvent === 'undefined' || window && (typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object' && !window.dispatchEvent) {
847
847
  useNodeImpl = true;
848
848
  triggerGlobalErrorEvent = function triggerGlobalErrorEvent() {
849
849
  setTimeout(function () {
@@ -936,12 +936,10 @@ function setPrototypeOfCustomEvent() {
936
936
  Object.setPrototypeOf(ShimCustomEvent.prototype, ShimEvent.prototype);
937
937
  }
938
938
 
939
- /* eslint-disable jsdoc/valid-types -- https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/147 */
940
939
  /**
941
940
  * @typedef {T[keyof T]} ValueOf<T>
942
941
  * @template T
943
942
  */
944
- /* eslint-enable jsdoc/valid-types -- https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/147 */
945
943
 
946
944
  /**
947
945
  * @typedef {{unlink: (path: string, cb: import('fs').NoParamCallback) => void}} FSApi
@@ -1003,6 +1001,7 @@ const CFG = /** @type {ConfigValues} */{};
1003
1001
  */
1004
1002
 
1005
1003
  /** @type {Config} */
1004
+ // eslint-disable-next-line unicorn/no-top-level-side-effects -- Would be good
1006
1005
  [
1007
1006
  // Boolean for verbose reporting
1008
1007
  'DEBUG',
@@ -1020,7 +1019,7 @@ const CFG = /** @type {ConfigValues} */{};
1020
1019
  // calls required for full WebIDL compliance will be used. Probably
1021
1020
  // only needed for testing or environments where full introspection
1022
1021
  // on class relationships is required; see
1023
- // http://stackoverflow.com/questions/41927589/rationales-consequences-of-webidl-class-inheritance-requirements
1022
+ // https://stackoverflow.com/questions/41927589/rationales-consequences-of-webidl-class-inheritance-requirements
1024
1023
  'fullIDLSupport',
1025
1024
  // Effectively defaults to false (ignored unless `true`)
1026
1025
 
@@ -1172,7 +1171,6 @@ var regexExports = requireRegex();
1172
1171
  var regex = /*@__PURE__*/getDefaultExportFromCjs$1(regexExports);
1173
1172
 
1174
1173
  /* eslint-disable new-cap -- ToString is how it is defined */
1175
- /* eslint-disable sonarjs/no-control-regex -- Needed */
1176
1174
 
1177
1175
  /**
1178
1176
  * @typedef {number} Integer
@@ -1183,9 +1181,9 @@ var regex = /*@__PURE__*/getDefaultExportFromCjs$1(regexExports);
1183
1181
  * @returns {string}
1184
1182
  */
1185
1183
  function escapeUnmatchedSurrogates(arg) {
1186
- // http://stackoverflow.com/a/6701665/271577
1184
+ // https://stackoverflow.com/a/6701665/271577
1187
1185
  return arg.replaceAll(/([\uD800-\uDBFF])(?![\uDC00-\uDFFF])|(^|[^\uD800-\uDBFF])([\uDC00-\uDFFF])/gu, function (_, unmatchedHighSurrogate, precedingLow, unmatchedLowSurrogate) {
1188
- // Could add a corresponding surrogate for compatibility with `node-sqlite3`: http://bugs.python.org/issue12569 and http://stackoverflow.com/a/6701665/271577
1186
+ // Could add a corresponding surrogate for compatibility with `node-sqlite3`: https://bugs.python.org/issue12569 and https://stackoverflow.com/a/6701665/271577
1189
1187
  // but Chrome having problems
1190
1188
  if (unmatchedHighSurrogate) {
1191
1189
  return '^2' + unmatchedHighSurrogate.codePointAt().toString(16).padStart(4, '0');
@@ -1199,14 +1197,14 @@ function escapeUnmatchedSurrogates(arg) {
1199
1197
  * @returns {string}
1200
1198
  */
1201
1199
  function escapeNameForSQLiteIdentifier(arg) {
1202
- // http://stackoverflow.com/a/6701665/271577
1200
+ // https://stackoverflow.com/a/6701665/271577
1203
1201
  return '_' +
1204
1202
  // Prevent empty string
1205
1203
  escapeUnmatchedSurrogates(arg.replaceAll('^', '^^') // Escape our escape
1206
- // http://www.sqlite.org/src/tktview?name=57c971fc74
1204
+ // https://www.sqlite.org/src/tktview?name=57c971fc74
1207
1205
  .replaceAll('\0', '^0')
1208
1206
  // We need to avoid identifiers being treated as duplicates based on SQLite's ASCII-only case-insensitive table and column names
1209
- // (For SQL in general, however, see http://stackoverflow.com/a/17215009/271577
1207
+ // (For SQL in general, however, see https://stackoverflow.com/a/17215009/271577
1210
1208
  // See also https://www.sqlite.org/faq.html#q18 re: Unicode (non-ASCII) case-insensitive not working
1211
1209
  .replaceAll(/([A-Z])/gu, '^$1'));
1212
1210
  }
@@ -1236,7 +1234,7 @@ function unescapeSQLiteResponse(arg) {
1236
1234
  */
1237
1235
  function sqlEscape(arg) {
1238
1236
  // https://www.sqlite.org/lang_keywords.html
1239
- // http://stackoverflow.com/a/6701665/271577
1237
+ // https://stackoverflow.com/a/6701665/271577
1240
1238
  // There is no need to escape ', `, or [], as
1241
1239
  // we should always be within double quotes
1242
1240
  // NUL should have already been stripped
@@ -1272,7 +1270,7 @@ function escapeDatabaseNameForSQLAndFiles(db) {
1272
1270
  });
1273
1271
  }
1274
1272
  if (CFG.databaseCharacterEscapeList !== false) {
1275
- db = db.replace(CFG.databaseCharacterEscapeList ? new RegExp(CFG.databaseCharacterEscapeList, 'gu') : /[\u0000-\u001F\u007F"*/:<>?\\|]/gu,
1273
+ db = db.replace(CFG.databaseCharacterEscapeList ? new RegExp(CFG.databaseCharacterEscapeList, 'gu') : /[\u{0000}-\u{001F}\u{007F}"*/:<>?\\|]/gu,
1276
1274
  // eslint-disable-line no-control-regex -- Controls needed
1277
1275
  function (n0) {
1278
1276
  // eslint-disable-next-line unicorn/prefer-code-point -- Switch to `codePointAt`?
@@ -1400,7 +1398,9 @@ function isBinary(obj) {
1400
1398
  * @returns {boolean}
1401
1399
  */
1402
1400
  function isIterable(obj) {
1403
- return isObj(obj) && Symbol.iterator in obj && typeof obj[Symbol.iterator] === 'function';
1401
+ return isObj(obj) &&
1402
+ // eslint-disable-next-line unicorn/no-computed-property-existence-check -- May not be "own"
1403
+ Symbol.iterator in obj && typeof obj[Symbol.iterator] === 'function';
1404
1404
  }
1405
1405
 
1406
1406
  /**
@@ -1492,7 +1492,7 @@ function defineReadonlyProperties(obj, props, getter = null) {
1492
1492
  props = typeof props === 'string' ? [props] : props;
1493
1493
  props.forEach(function (prop) {
1494
1494
  let o;
1495
- if (getter && prop in getter) {
1495
+ if (getter && Object.hasOwn(getter, prop)) {
1496
1496
  o = getter[prop];
1497
1497
  } else {
1498
1498
  Object.defineProperty(obj, '__' + prop, {
@@ -1530,7 +1530,7 @@ function isIdentifier(item) {
1530
1530
  // ID_Continue (includes Other_ID_Continue)
1531
1531
  const UnicodeIDContinue = CFG.UnicodeIDContinue || '[$0-9A-Z_a-z]';
1532
1532
  const IdentifierStart = '(?:' + UnicodeIDStart + '|[$_])';
1533
- const IdentifierPart = '(?:' + UnicodeIDContinue + '|[$_\u200C\u200D])';
1533
+ const IdentifierPart = '(?:' + UnicodeIDContinue + '|[$_\u{200C}\u{200D}])';
1534
1534
  return new RegExp('^' + IdentifierStart + IdentifierPart + '*$', 'u').test(item);
1535
1535
  }
1536
1536
 
@@ -1552,7 +1552,7 @@ function isValidKeyPathString(keyPathString) {
1552
1552
  */
1553
1553
  function isValidKeyPath(keyPath) {
1554
1554
  return isValidKeyPathString(keyPath) || Array.isArray(keyPath) && Boolean(keyPath.length) &&
1555
- // Convert array from sparse to dense http://www.2ality.com/2012/06/dense-arrays.html
1555
+ // Convert array from sparse to dense https://www.2ality.com/2012/06/dense-arrays.html
1556
1556
  // See also https://heycam.github.io/webidl/#idl-DOMString
1557
1557
  [...keyPath].every(pathComponent => {
1558
1558
  return isValidKeyPathString(pathComponent);
@@ -1658,8 +1658,10 @@ function createEvent(type, debug, evInit) {
1658
1658
  return ev;
1659
1659
  }
1660
1660
 
1661
+ /* eslint-disable unicorn/no-top-level-side-effects -- Would be good */
1661
1662
  // We don't add within polyfill repo as might not always be the desired implementation
1662
1663
  Object.defineProperty(ShimEvent, Symbol.hasInstance, {
1664
+ /* eslint-enable unicorn/no-top-level-side-effects -- Would be good */
1663
1665
  /**
1664
1666
  * @typedef {any} AnyValue
1665
1667
  */
@@ -1699,6 +1701,7 @@ IDBVersionChangeEvent.prototype[Symbol.toStringTag] = 'IDBVersionChangeEventProt
1699
1701
  * @typedef {number} Integer
1700
1702
  */
1701
1703
 
1704
+ /* eslint-disable unicorn/no-top-level-side-effects -- Would be good */
1702
1705
  readonlyProperties$6.forEach(prop => {
1703
1706
  // Ensure for proper interface testing that "get <name>" is the function name
1704
1707
  const o = {
@@ -1852,7 +1855,7 @@ function createNonNativeDOMExceptionClass() {
1852
1855
  function DOMException(message, name) {
1853
1856
  // const err = Error.prototype.constructor.call(this, message); // Any use to this? Won't set this.message
1854
1857
  this[Symbol.toStringTag] = 'DOMException';
1855
- this._code = name in codes ? codes[(/** @type {Code} */name)] : legacyCodes[(/** @type {LegacyCode} */name)] || 0;
1858
+ this._code = Object.hasOwn(codes, name) ? codes[(/** @type {Code} */name)] : legacyCodes[(/** @type {LegacyCode} */name)] || 0;
1856
1859
  this._name = name || 'Error';
1857
1860
  // We avoid `String()` in this next line as it converts Symbols
1858
1861
  this._message = message === undefined ? '' : '' + message; // eslint-disable-line no-implicit-coercion -- Don't convert symbols
@@ -1988,13 +1991,14 @@ function createNonNativeDOMException(name, message) {
1988
1991
  * @returns {void}
1989
1992
  */
1990
1993
  function logError(name, message, error) {
1991
- if (CFG.DEBUG) {
1992
- const msg = error && typeof error === 'object' && error.message ? error.message : (/** @type {string} */error);
1993
- const method = typeof console.error === 'function' ? 'error' : 'log';
1994
- console[method](name + ': ' + message + '. ' + (msg || ''));
1995
- if (console.trace) {
1996
- console.trace();
1997
- }
1994
+ if (!CFG.DEBUG) {
1995
+ return;
1996
+ }
1997
+ const msg = error && typeof error === 'object' && error.message ? error.message : (/** @type {string} */error);
1998
+ const method = typeof console.error === 'function' ? 'error' : 'log';
1999
+ console[method](name + ': ' + message + '. ' + (msg || ''));
2000
+ if (console.trace) {
2001
+ console.trace();
1998
2002
  }
1999
2003
  }
2000
2004
 
@@ -2125,8 +2129,9 @@ const doneFlagGetters = ['result', 'error'];
2125
2129
 
2126
2130
  /**
2127
2131
  * The IDBRequest Object that is returns for all async calls.
2128
- * @see http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#request-api
2132
+ * @see https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#request-api
2129
2133
  * @class
2134
+ * @throws {TypeError}
2130
2135
  */
2131
2136
  function IDBRequest() {
2132
2137
  throw new TypeError('Illegal constructor');
@@ -2165,19 +2170,21 @@ IDBRequest.__super = function IDBRequest() {
2165
2170
  legacyOutputDidListenersThrowFlag: true // Event hook for IndexedB
2166
2171
  });
2167
2172
  doneFlagGetters.forEach(prop => {
2168
- Object.defineProperty(this, '__' + prop, {
2169
- enumerable: false,
2170
- configurable: false,
2171
- writable: true
2172
- });
2173
- Object.defineProperty(this, prop, {
2174
- enumerable: true,
2175
- configurable: true,
2176
- get() {
2177
- if (!this.__done) {
2178
- throw createDOMException('InvalidStateError', "Can't get " + prop + '; the request is still pending.');
2173
+ Object.defineProperties(this, {
2174
+ ['__' + prop]: {
2175
+ enumerable: false,
2176
+ configurable: false,
2177
+ writable: true
2178
+ },
2179
+ [prop]: {
2180
+ enumerable: true,
2181
+ configurable: true,
2182
+ get() {
2183
+ if (!this.__done) {
2184
+ throw createDOMException('InvalidStateError', "Can't get " + prop + '; the request is still pending.');
2185
+ }
2186
+ return this['__' + prop];
2179
2187
  }
2180
- return this['__' + prop];
2181
2188
  }
2182
2189
  });
2183
2190
  });
@@ -2224,6 +2231,7 @@ IDBRequest.prototype.__getParent = function () {
2224
2231
  return this.__transaction;
2225
2232
  };
2226
2233
 
2234
+ /* eslint-disable unicorn/no-top-level-side-effects -- Would be good */
2227
2235
  // Illegal invocations
2228
2236
  defineReadonlyOuterInterface(IDBRequest.prototype, readonlyProperties$5);
2229
2237
  defineReadonlyOuterInterface(IDBRequest.prototype, doneFlagGetters);
@@ -2238,15 +2246,18 @@ IDBRequest.__super.prototype = IDBRequest.prototype;
2238
2246
  Object.defineProperty(IDBRequest, 'prototype', {
2239
2247
  writable: false
2240
2248
  });
2249
+ /* eslint-enable unicorn/no-top-level-side-effects -- Would be good */
2250
+
2241
2251
  const openListeners = ['onblocked', 'onupgradeneeded'];
2242
2252
 
2243
2253
  /**
2244
- * @typedef {IDBRequestFull & IDBOpenDBRequest & {}} IDBOpenDBRequestFull
2254
+ * @typedef {IDBRequestFull & IDBOpenDBRequest} IDBOpenDBRequestFull
2245
2255
  */
2246
2256
 
2247
2257
  /**
2248
2258
  * The IDBOpenDBRequest called when a database is opened.
2249
2259
  * @class
2260
+ * @throws {TypeError}
2250
2261
  */
2251
2262
  function IDBOpenDBRequest() {
2252
2263
  throw new TypeError('Illegal constructor');
@@ -2254,12 +2265,16 @@ function IDBOpenDBRequest() {
2254
2265
 
2255
2266
  // @ts-expect-error It's ok
2256
2267
  IDBOpenDBRequest.prototype = Object.create(IDBRequest.prototype);
2268
+
2269
+ /* eslint-disable unicorn/no-top-level-side-effects -- Would be good */
2257
2270
  Object.defineProperty(IDBOpenDBRequest.prototype, 'constructor', {
2258
2271
  enumerable: false,
2259
2272
  writable: true,
2260
2273
  configurable: true,
2261
2274
  value: IDBOpenDBRequest
2262
2275
  });
2276
+ /* eslint-enable unicorn/no-top-level-side-effects -- Would be good */
2277
+
2263
2278
  const IDBOpenDBRequestAlias = IDBOpenDBRequest;
2264
2279
  /**
2265
2280
  * @returns {IDBRequestFull & IDBOpenDBRequest}
@@ -2287,6 +2302,8 @@ IDBOpenDBRequest.__createInstance = function () {
2287
2302
  // @ts-expect-error It's ok
2288
2303
  return new IDBOpenDBRequest();
2289
2304
  };
2305
+
2306
+ /* eslint-disable unicorn/no-top-level-side-effects -- Would be good */
2290
2307
  defineOuterInterface(IDBOpenDBRequest.prototype, openListeners);
2291
2308
  IDBOpenDBRequest.prototype[Symbol.toStringTag] = 'IDBOpenDBRequestPrototype';
2292
2309
  Object.defineProperty(IDBOpenDBRequest, 'prototype', {
@@ -2665,10 +2682,14 @@ const keyTypeToEncodedChar = {
2665
2682
  binary: 500,
2666
2683
  array: 600
2667
2684
  };
2685
+
2686
+ /* eslint-disable unicorn/no-top-level-side-effects -- Would be good */
2668
2687
  const keyTypes = /** @type {(KeyType|"invalid")[]} */Object.keys(keyTypeToEncodedChar);
2669
2688
  keyTypes.forEach(k => {
2670
2689
  keyTypeToEncodedChar[k] = String.fromCodePoint(/** @type {number} */keyTypeToEncodedChar[k]);
2671
2690
  });
2691
+ /* eslint-enable unicorn/no-top-level-side-effects -- Would be good */
2692
+
2672
2693
  const encodedCharToKeyType = keyTypes.reduce((o, k) => {
2673
2694
  o[keyTypeToEncodedChar[k]] = k;
2674
2695
  return o;
@@ -2754,13 +2775,12 @@ const types = {
2754
2775
  if (key > -1) {
2755
2776
  sign = signValues.indexOf('smallNegative');
2756
2777
  exponent = padBase32Exponent(significantDigitIndex);
2757
- mantissa = flipBase32(padBase32Mantissa(key32));
2758
2778
  // Non-negative exponent case:
2759
2779
  } else {
2760
2780
  sign = signValues.indexOf('bigNegative');
2761
2781
  exponent = flipBase32(padBase32Exponent(decimalIndex !== -1 ? decimalIndex : key32.length));
2762
- mantissa = flipBase32(padBase32Mantissa(key32));
2763
2782
  }
2783
+ mantissa = flipBase32(padBase32Mantissa(key32));
2764
2784
  // Non-negative cases:
2765
2785
  // Negative exponent case:
2766
2786
  } else if (key < 1) {
@@ -2794,9 +2814,9 @@ const types = {
2794
2814
  let mantissa = key.slice(5, 16);
2795
2815
  switch (signValues[sign]) {
2796
2816
  case 'negativeInfinity':
2797
- return Number.NEGATIVE_INFINITY;
2817
+ return -Infinity;
2798
2818
  case 'positiveInfinity':
2799
- return Number.POSITIVE_INFINITY;
2819
+ return Infinity;
2800
2820
  case 'bigPositive':
2801
2821
  return pow32(mantissa, exponent);
2802
2822
  case 'smallPositive':
@@ -2916,7 +2936,7 @@ const types = {
2916
2936
  decode(key) {
2917
2937
  // Set the entries in buffer's [[ArrayBufferData]] to those in `value`
2918
2938
  const k = key.slice(2);
2919
- const arr = k.length ? k.split(',').map(s => Number.parseInt(s)) : [];
2939
+ const arr = k.length ? k.split(',').map(Number) : [];
2920
2940
  const buffer = new ArrayBuffer(arr.length);
2921
2941
  const uint8 = new Uint8Array(buffer);
2922
2942
  uint8.set(arr);
@@ -2995,7 +3015,7 @@ function pow32(mantissa, exponent) {
2995
3015
  * @returns {Float}
2996
3016
  */
2997
3017
  function roundToPrecision(num, precision = 16) {
2998
- return Number.parseFloat(num.toPrecision(precision));
3018
+ return Number(num.toPrecision(precision));
2999
3019
  }
3000
3020
 
3001
3021
  /**
@@ -3063,7 +3083,7 @@ function convertValueToMultiEntryKey(input) {
3063
3083
  */
3064
3084
  function getCopyBytesHeldByBufferSource(O) {
3065
3085
  let offset = 0;
3066
- let length = 0;
3086
+ let length;
3067
3087
  if (ArrayBuffer.isView(O)) {
3068
3088
  // Has [[ViewedArrayBuffer]] internal slot
3069
3089
  const arrayBuffer = O.buffer;
@@ -3096,7 +3116,7 @@ function getCopyBytesHeldByBufferSource(O) {
3096
3116
  * @returns {KeyValueObject}
3097
3117
  */
3098
3118
  function convertValueToKeyValueDecoded(input, seen, multiEntry, fullKeys) {
3099
- seen = seen || [];
3119
+ seen ||= [];
3100
3120
  if (seen.includes(input)) {
3101
3121
  return {
3102
3122
  type: 'array',
@@ -3473,7 +3493,6 @@ function findMultiEntryMatches(keyEntry, range) {
3473
3493
  continue;
3474
3494
  }
3475
3495
  if (key.length === 1) {
3476
- // eslint-disable-next-line sonarjs/updated-loop-counter -- Convenient
3477
3496
  key = key[0];
3478
3497
  } else {
3479
3498
  const nested = findMultiEntryMatches(key, range);
@@ -3653,8 +3672,13 @@ function assignCurrentNumber(tx, store, num, successCb, failCb) {
3653
3672
  * @returns {void}
3654
3673
  */
3655
3674
  function setCurrentNumber(tx, store, num, successCb, failCb) {
3656
- num = num === MAX_ALLOWED_CURRENT_NUMBER ? num + 2 // Since incrementing by one will have no effect in JavaScript on this unsafe max, we represent the max as a number incremented by two. The getting of the current number is never returned to the user and is only used in safe comparisons, so it is safe for us to represent it in this manner
3657
- : num + 1;
3675
+ num = 1 + (num === MAX_ALLOWED_CURRENT_NUMBER
3676
+ // Since incrementing by one will have no effect in JavaScript on this
3677
+ // unsafe max, we represent the max as a number incremented by two.
3678
+ // The getting of the current number is never returned to the user and
3679
+ // is only used in safe comparisons, so it is safe for us to represent
3680
+ // it in this manner
3681
+ ? num + 1 : num);
3658
3682
  return assignCurrentNumber(tx, store, num, successCb, failCb);
3659
3683
  }
3660
3684
 
@@ -3767,7 +3791,7 @@ const readonlyProperties$4 = /** @type {const} */['lower', 'upper', 'lowerOpen',
3767
3791
 
3768
3792
  /**
3769
3793
  * The IndexedDB KeyRange object.
3770
- * @see http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#dfn-key-range
3794
+ * @see https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#dfn-key-range
3771
3795
  * @throws {TypeError}
3772
3796
  * @class
3773
3797
  */
@@ -3788,6 +3812,7 @@ const IDBKeyRangeAlias = IDBKeyRange;
3788
3812
  IDBKeyRange.__createInstance = function (lower, upper, lowerOpen, upperOpen) {
3789
3813
  /**
3790
3814
  * @class
3815
+ * @throws {DOMException|Error}
3791
3816
  */
3792
3817
  function IDBKeyRange() {
3793
3818
  this[Symbol.toStringTag] = 'IDBKeyRange';
@@ -3884,6 +3909,8 @@ IDBKeyRange.bound = function (lower, upper /* , lowerOpen, upperOpen */) {
3884
3909
  return IDBKeyRange.__createInstance(lower, upper, arguments[2], arguments[3]);
3885
3910
  };
3886
3911
  IDBKeyRange.prototype[Symbol.toStringTag] = 'IDBKeyRangePrototype';
3912
+
3913
+ /* eslint-disable unicorn/no-top-level-side-effects -- Would be good */
3887
3914
  readonlyProperties$4.forEach(prop => {
3888
3915
  Object.defineProperty(IDBKeyRange.prototype, '__' + prop, {
3889
3916
  enumerable: false,
@@ -3909,18 +3936,22 @@ readonlyProperties$4.forEach(prop => {
3909
3936
  // desc.configurable = true; // Default
3910
3937
  Object.defineProperty(IDBKeyRange.prototype, prop, desc);
3911
3938
  });
3912
- Object.defineProperty(IDBKeyRange, Symbol.hasInstance, {
3913
- value:
3914
- /**
3915
- * @param {object} obj
3916
- * @returns {boolean}
3917
- */
3918
- obj => isObj(obj) && 'upper' in obj && 'lowerOpen' in obj && typeof obj.lowerOpen === 'boolean'
3919
- });
3920
- Object.defineProperty(IDBKeyRange, 'prototype', {
3921
- writable: false
3939
+ Object.defineProperties(IDBKeyRange, {
3940
+ [Symbol.hasInstance]: {
3941
+ value:
3942
+ /**
3943
+ * @param {object} obj
3944
+ * @returns {boolean}
3945
+ */
3946
+ obj => isObj(obj) && 'upper' in obj && 'lowerOpen' in obj && typeof obj.lowerOpen === 'boolean'
3947
+ },
3948
+ prototype: {
3949
+ writable: false
3950
+ }
3922
3951
  });
3923
3952
 
3953
+ /* eslint-enable unicorn/no-top-level-side-effects -- Would be good */
3954
+
3924
3955
  /**
3925
3956
  * @param {IDBKeyRangeFull|undefined} range
3926
3957
  * @param {string} quotedKeyColumnName
@@ -3931,34 +3962,35 @@ Object.defineProperty(IDBKeyRange, 'prototype', {
3931
3962
  * @returns {void}
3932
3963
  */
3933
3964
  function setSQLForKeyRange(range, quotedKeyColumnName, sql, sqlValues, addAnd, checkCached) {
3934
- if (range && (range.lower !== undefined || range.upper !== undefined)) {
3935
- if (addAnd) {
3936
- sql.push('AND');
3937
- }
3938
- let encodedLowerKey, encodedUpperKey;
3939
- const hasLower = range.lower !== undefined;
3940
- const hasUpper = range.upper !== undefined;
3941
- if (hasLower) {
3942
- encodedLowerKey = checkCached ? range.__lowerCached : encode$1(range.lower);
3943
- }
3944
- if (hasUpper) {
3945
- encodedUpperKey = checkCached ? range.__upperCached : encode$1(range.upper);
3946
- }
3947
- if (hasLower) {
3948
- sqlValues.push(escapeSQLiteStatement(/** @type {string} */encodedLowerKey));
3949
- if (hasUpper && encodedLowerKey === encodedUpperKey && !range.lowerOpen && !range.upperOpen) {
3950
- sql.push(quotedKeyColumnName, '=', '?');
3951
- return;
3952
- }
3953
- sql.push(quotedKeyColumnName, range.lowerOpen ? '>' : '>=', '?');
3954
- }
3955
- if (hasLower && hasUpper) {
3956
- sql.push('AND');
3957
- }
3958
- if (hasUpper) {
3959
- sql.push(quotedKeyColumnName, range.upperOpen ? '<' : '<=', '?');
3960
- sqlValues.push(escapeSQLiteStatement(/** @type {string} */encodedUpperKey));
3965
+ if (!(range && (range.lower !== undefined || range.upper !== undefined))) {
3966
+ return;
3967
+ }
3968
+ if (addAnd) {
3969
+ sql.push('AND');
3970
+ }
3971
+ let encodedLowerKey, encodedUpperKey;
3972
+ const hasLower = range.lower !== undefined;
3973
+ const hasUpper = range.upper !== undefined;
3974
+ if (hasLower) {
3975
+ encodedLowerKey = checkCached ? range.__lowerCached : encode$1(range.lower);
3976
+ }
3977
+ if (hasUpper) {
3978
+ encodedUpperKey = checkCached ? range.__upperCached : encode$1(range.upper);
3979
+ }
3980
+ if (hasLower) {
3981
+ sqlValues.push(escapeSQLiteStatement(/** @type {string} */encodedLowerKey));
3982
+ if (hasUpper && encodedLowerKey === encodedUpperKey && !range.lowerOpen && !range.upperOpen) {
3983
+ sql.push(quotedKeyColumnName, '=', '?');
3984
+ return;
3961
3985
  }
3986
+ sql.push(quotedKeyColumnName, range.lowerOpen ? '>' : '>=', '?');
3987
+ }
3988
+ if (hasLower && hasUpper) {
3989
+ sql.push('AND');
3990
+ }
3991
+ if (hasUpper) {
3992
+ sql.push(quotedKeyColumnName, range.upperOpen ? '<' : '<=', '?');
3993
+ sqlValues.push(escapeSQLiteStatement(/** @type {string} */encodedUpperKey));
3962
3994
  }
3963
3995
  }
3964
3996
 
@@ -4060,7 +4092,9 @@ DOMStringList.prototype = {
4060
4092
  if (!arguments.length) {
4061
4093
  throw new TypeError('DOMStringList.item must be supplied a value');
4062
4094
  }
4063
- if (key < 0 || key >= this.length || !Number.isInteger(key)) {
4095
+ if (key < 0 || key >= this.length ||
4096
+ // eslint-disable-next-line unicorn/prefer-number-is-safe-integer -- We want all
4097
+ !Number.isInteger(key)) {
4064
4098
  return null;
4065
4099
  }
4066
4100
  return this._items[key];
@@ -4090,8 +4124,9 @@ DOMStringList.prototype = {
4090
4124
  * @returns {string[]}
4091
4125
  */
4092
4126
  sortList() {
4093
- // http://w3c.github.io/IndexedDB/#sorted-list
4127
+ // https://w3c.github.io/IndexedDB/#sorted-list
4094
4128
  // https://tc39.github.io/ecma262/#sec-abstract-relational-comparison
4129
+ // eslint-disable-next-line unicorn/require-array-sort-compare -- IndexedDB requires code unit comparison (default behavior)
4095
4130
  this._items.sort();
4096
4131
  this.addIndexes();
4097
4132
  return this._items;
@@ -4143,7 +4178,7 @@ DOMStringList.prototype = {
4143
4178
  this._items.splice(...args);
4144
4179
  this._length = this._items.length;
4145
4180
  for (const i in this) {
4146
- if (i === String(Number.parseInt(i))) {
4181
+ if (i === String(Math.trunc(Number(i)))) {
4147
4182
  delete this[i];
4148
4183
  }
4149
4184
  }
@@ -4163,6 +4198,7 @@ DOMStringList.prototype = {
4163
4198
  }
4164
4199
  };
4165
4200
 
4201
+ /* eslint-disable unicorn/no-top-level-side-effects -- Would be good */
4166
4202
  /**
4167
4203
  * @typedef {any} AnyValue
4168
4204
  */
@@ -4177,6 +4213,7 @@ Object.defineProperty(DOMStringList, Symbol.hasInstance, {
4177
4213
  });
4178
4214
  const DOMStringListAlias = DOMStringList;
4179
4215
  Object.defineProperty(DOMStringList, '__createInstance', {
4216
+ /* eslint-enable unicorn/no-top-level-side-effects -- Would be good */
4180
4217
  /**
4181
4218
  * @returns {DOMStringListFull}
4182
4219
  */
@@ -4310,8 +4347,9 @@ const readonlyProperties$3 = ['objectStoreNames', 'mode', 'db', 'error'];
4310
4347
 
4311
4348
  /**
4312
4349
  * The IndexedDB Transaction.
4313
- * @see http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBTransaction
4350
+ * @see https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBTransaction
4314
4351
  * @class
4352
+ * @throws {TypeError}
4315
4353
  */
4316
4354
  function IDBTransaction() {
4317
4355
  throw new TypeError('Illegal constructor');
@@ -4333,6 +4371,7 @@ IDBTransaction.__createInstance = function (db, storeNames, mode) {
4333
4371
  // @ts-expect-error It's ok
4334
4372
  me[Symbol.toStringTag] = 'IDBTransaction';
4335
4373
  defineReadonlyProperties(me, readonlyProperties$3);
4374
+ // eslint-disable-next-line unicorn/no-top-level-assignment-in-function -- Debugging only
4336
4375
  me.__id = ++uniqueID; // for debugging simultaneous transactions
4337
4376
  me.__active = true;
4338
4377
  me.__running = false;
@@ -4740,7 +4779,7 @@ IDBTransaction.prototype.objectStore = function (objectStoreName) {
4740
4779
  if (!store) {
4741
4780
  throw createDOMException('NotFoundError', objectStoreName + ' does not exist in ' + me.db.name);
4742
4781
  }
4743
- if (!me.__storeHandles[objectStoreName] ||
4782
+ if (!Object.hasOwn(me.__storeHandles, objectStoreName) ||
4744
4783
  // These latter conditions are to allow store
4745
4784
  // recreation to create new clone object
4746
4785
  me.__storeHandles[objectStoreName].__pendingDelete || me.__storeHandles[objectStoreName].__deleted) {
@@ -4846,7 +4885,7 @@ IDBTransaction.prototype.__abortTransaction = function (err) {
4846
4885
  }
4847
4886
  q.req.dispatchEvent(reqEvt); // No need to catch errors
4848
4887
  resolve();
4849
- });
4888
+ }, 0);
4850
4889
  });
4851
4890
  });
4852
4891
  }, SyncPromise.resolve(undefined)).then(function () {
@@ -4860,7 +4899,7 @@ IDBTransaction.prototype.__abortTransaction = function (err) {
4860
4899
  me.dispatchEvent(evt);
4861
4900
  me.__storeHandles = {};
4862
4901
  me.dispatchEvent(createEvent('__abort'));
4863
- });
4902
+ }, 0);
4864
4903
  return undefined;
4865
4904
  }).catch(err => {
4866
4905
  console.log('Abort error');
@@ -4983,6 +5022,8 @@ IDBTransaction.__assertActive = function (tx) {
4983
5022
  IDBTransaction.prototype.__getParent = function () {
4984
5023
  return this.db;
4985
5024
  };
5025
+
5026
+ /* eslint-disable unicorn/no-top-level-side-effects -- Would be good */
4986
5027
  defineOuterInterface(IDBTransaction.prototype, listeners$1);
4987
5028
  defineReadonlyOuterInterface(IDBTransaction.prototype, readonlyProperties$3);
4988
5029
  Object.defineProperty(IDBTransaction.prototype, 'constructor', {
@@ -4995,746 +5036,568 @@ Object.defineProperty(IDBTransaction, 'prototype', {
4995
5036
  writable: false
4996
5037
  });
4997
5038
 
4998
- function _arrayLikeToArray(e, t) {
4999
- (null == t || t > e.length) && (t = e.length);
5000
- for (var r = 0, n = Array(t); r < t; r++) n[r] = e[r];
5001
- return n;
5002
- }
5003
- function _classCallCheck(e, t) {
5004
- if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
5005
- }
5006
- function _createClass(e, t, r) {
5007
- return t && function _defineProperties(e, t) {
5008
- for (var r = 0; r < t.length; r++) {
5009
- var n = t[r];
5010
- n.enumerable = n.enumerable || false, n.configurable = true, "value" in n && (n.writable = true), Object.defineProperty(e, _toPropertyKey(n.key), n);
5011
- }
5012
- }(e.prototype, t), Object.defineProperty(e, "prototype", {
5013
- writable: false
5014
- }), e;
5015
- }
5016
- function _defineProperty(e, t, r) {
5017
- return (t = _toPropertyKey(t)) in e ? Object.defineProperty(e, t, {
5018
- value: r,
5019
- enumerable: true,
5020
- configurable: true,
5021
- writable: true
5022
- }) : e[t] = r, e;
5023
- }
5024
- function ownKeys(e, t) {
5025
- var r = Object.keys(e);
5026
- if (Object.getOwnPropertySymbols) {
5027
- var n = Object.getOwnPropertySymbols(e);
5028
- t && (n = n.filter(function (t) {
5029
- return Object.getOwnPropertyDescriptor(e, t).enumerable;
5030
- })), r.push.apply(r, n);
5031
- }
5032
- return r;
5033
- }
5034
- function _objectSpread2(e) {
5035
- for (var t = 1; t < arguments.length; t++) {
5036
- var r = null != arguments[t] ? arguments[t] : {};
5037
- t % 2 ? ownKeys(Object(r), true).forEach(function (t) {
5038
- _defineProperty(e, t, r[t]);
5039
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : ownKeys(Object(r)).forEach(function (t) {
5040
- Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t));
5041
- });
5042
- }
5043
- return e;
5044
- }
5045
- function _slicedToArray(e, t) {
5046
- return function _arrayWithHoles(e) {
5047
- if (Array.isArray(e)) return e;
5048
- }(e) || function _iterableToArrayLimit(e, t) {
5049
- var r = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
5050
- if (null != r) {
5051
- var n,
5052
- a,
5053
- o,
5054
- i,
5055
- c = [],
5056
- s = true,
5057
- u = false;
5058
- try {
5059
- if (o = (r = r.call(e)).next, 0 === t) {
5060
- if (Object(r) !== r) return;
5061
- s = !1;
5062
- } else for (; !(s = (n = o.call(r)).done) && (c.push(n.value), c.length !== t); s = !0);
5063
- } catch (e) {
5064
- u = true, a = e;
5065
- } finally {
5066
- try {
5067
- if (!s && null != r.return && (i = r.return(), Object(i) !== i)) return;
5068
- } finally {
5069
- if (u) throw a;
5070
- }
5071
- }
5072
- return c;
5073
- }
5074
- }(e, t) || _unsupportedIterableToArray(e, t) || function _nonIterableRest() {
5075
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5076
- }();
5077
- }
5078
- function _toPropertyKey(e) {
5079
- var t = function _toPrimitive(e, t) {
5080
- if ("object" != typeof e || !e) return e;
5081
- var r = e[Symbol.toPrimitive];
5082
- if (void 0 !== r) {
5083
- var n = r.call(e, t);
5084
- if ("object" != typeof n) return n;
5085
- throw new TypeError("@@toPrimitive must return a primitive value.");
5086
- }
5087
- return String(e);
5088
- }(e, "string");
5089
- return "symbol" == typeof t ? t : t + "";
5090
- }
5091
- function _typeof(e) {
5092
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) {
5093
- return typeof e;
5094
- } : function (e) {
5095
- return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
5096
- }, _typeof(e);
5097
- }
5098
- function _unsupportedIterableToArray(e, t) {
5099
- if (e) {
5100
- if ("string" == typeof e) return _arrayLikeToArray(e, t);
5101
- var r = {}.toString.call(e).slice(8, -1);
5102
- return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? _arrayLikeToArray(e, t) : void 0;
5103
- }
5104
- }
5105
- var e = _createClass(function TypesonPromise(e) {
5106
- _classCallCheck(this, TypesonPromise), this.p = new Promise(e);
5107
- });
5108
- e.__typeson__type__ = "TypesonPromise", "undefined" != typeof Symbol && Object.defineProperty(e.prototype, Symbol.toStringTag, {
5109
- get: function get() {
5110
- return "TypesonPromise";
5039
+ class TypesonPromise {
5040
+ constructor(e) {
5041
+ this.p = new Promise(e);
5111
5042
  }
5112
- }), e.prototype.then = function (t, r) {
5113
- var n = this;
5114
- return new e(function (e, a) {
5115
- n.p.then(function (r) {
5116
- e(t ? t(r) : r);
5043
+ }
5044
+ TypesonPromise.__typeson__type__ = "TypesonPromise", "undefined" != typeof Symbol && Object.defineProperty(TypesonPromise.prototype, Symbol.toStringTag, {
5045
+ get: () => "TypesonPromise"
5046
+ }), TypesonPromise.prototype.then = function (e, t) {
5047
+ return new TypesonPromise((r, n) => {
5048
+ this.p.then(function (t) {
5049
+ r(e ? e(t) : t);
5117
5050
  }).catch(function (e) {
5118
- return r ? r(e) : Promise.reject(e);
5119
- }).then(e, a);
5051
+ return t ? t(e) : Promise.reject(e);
5052
+ }).then(r, n);
5120
5053
  });
5121
- }, e.prototype.catch = function (e) {
5122
- return this.then(function () {}, e);
5123
- }, e.resolve = function (t) {
5124
- return new e(function (e) {
5125
- e(t);
5054
+ }, TypesonPromise.prototype.catch = function (e) {
5055
+ return this.then(() => {}, e);
5056
+ }, TypesonPromise.resolve = function (e) {
5057
+ return new TypesonPromise(t => {
5058
+ t(e);
5126
5059
  });
5127
- }, e.reject = function (t) {
5128
- return new e(function (e, r) {
5129
- r(t);
5060
+ }, TypesonPromise.reject = function (e) {
5061
+ return new TypesonPromise((t, r) => {
5062
+ r(e);
5130
5063
  });
5131
- }, e.all = function (t) {
5132
- return new e(function (e, r) {
5133
- Promise.all(t.map(function (e) {
5134
- return null != e && e.constructor && "__typeson__type__" in e.constructor && "TypesonPromise" === e.constructor.__typeson__type__ ? e.p : e;
5135
- })).then(e, r);
5064
+ }, TypesonPromise.all = function (e) {
5065
+ return new TypesonPromise(function (t, r) {
5066
+ Promise.all(e.map(e => e?.constructor && "__typeson__type__" in e.constructor && "TypesonPromise" === e.constructor.__typeson__type__ ? e.p : e)).then(t, r);
5136
5067
  });
5137
- }, e.race = function (t) {
5138
- return new e(function (e, r) {
5139
- Promise.race(t.map(function (e) {
5140
- return null != e && e.constructor && "__typeson__type__" in e.constructor && "TypesonPromise" === e.constructor.__typeson__type__ ? e.p : e;
5141
- })).then(e, r);
5068
+ }, TypesonPromise.race = function (e) {
5069
+ return new TypesonPromise(function (t, r) {
5070
+ Promise.race(e.map(e => e?.constructor && "__typeson__type__" in e.constructor && "TypesonPromise" === e.constructor.__typeson__type__ ? e.p : e)).then(t, r);
5142
5071
  });
5143
- }, e.allSettled = function (t) {
5144
- return new e(function (e, r) {
5145
- Promise.allSettled(t.map(function (e) {
5146
- return null != e && e.constructor && "__typeson__type__" in e.constructor && "TypesonPromise" === e.constructor.__typeson__type__ ? e.p : e;
5147
- })).then(e, r);
5072
+ }, TypesonPromise.allSettled = function (e) {
5073
+ return new TypesonPromise(function (t, r) {
5074
+ Promise.allSettled(e.map(e => e?.constructor && "__typeson__type__" in e.constructor && "TypesonPromise" === e.constructor.__typeson__type__ ? e.p : e)).then(t, r);
5148
5075
  });
5149
5076
  };
5150
- var t = Object.hasOwn,
5151
- r = Object.getPrototypeOf;
5077
+ const {
5078
+ hasOwn: e
5079
+ } = Object,
5080
+ t = Object.getPrototypeOf;
5152
5081
  function isThenable(e, t) {
5153
5082
  return isObject(e) && "function" == typeof e.then && (true || "function" == typeof e.catch);
5154
5083
  }
5155
5084
  function toStringTag(e) {
5156
5085
  return Object.prototype.toString.call(e).slice(8, -1);
5157
5086
  }
5158
- function hasConstructorOf(e, n) {
5159
- if (!e || "object" !== _typeof(e)) return false;
5160
- var a = r(e);
5161
- if (!a) return null === n;
5162
- var o = t(a, "constructor") && a.constructor;
5163
- return "function" != typeof o ? null === n : n === o || null !== n && Function.prototype.toString.call(o) === Function.prototype.toString.call(n) || "function" == typeof n && "string" == typeof o.__typeson__type__ && o.__typeson__type__ === n.__typeson__type__;
5087
+ function hasConstructorOf(r, n) {
5088
+ if (!r || "object" != typeof r) return false;
5089
+ const o = t(r);
5090
+ if (!o) return null === n;
5091
+ const s = e(o, "constructor") && o.constructor;
5092
+ return "function" != typeof s ? null === n : n === s || null !== n && Function.prototype.toString.call(s) === Function.prototype.toString.call(n) || "function" == typeof n && "string" == typeof s.__typeson__type__ && s.__typeson__type__ === n.__typeson__type__;
5164
5093
  }
5165
5094
  function isPlainObject(e) {
5166
- return !(!e || "Object" !== toStringTag(e)) && (!r(e) || hasConstructorOf(e, Object));
5095
+ return !(!e || "Object" !== toStringTag(e)) && (!t(e) || hasConstructorOf(e, Object));
5167
5096
  }
5168
5097
  function isUserObject(e) {
5169
5098
  if (!e || "Object" !== toStringTag(e)) return false;
5170
- var t = r(e);
5171
- return !t || hasConstructorOf(e, Object) || isUserObject(t);
5099
+ const r = t(e);
5100
+ return !r || hasConstructorOf(e, Object) || isUserObject(r);
5172
5101
  }
5173
5102
  function isObject(e) {
5174
- return null !== e && "object" === _typeof(e);
5103
+ return null !== e && "object" == typeof e;
5175
5104
  }
5176
5105
  function escapeKeyPathComponent(e) {
5177
- return e.replaceAll("''", "''''").replace(/^$/, "''").replaceAll("~", "~0").replaceAll(".", "~1");
5106
+ return e.replaceAll("''", "''''").replace(/^$/u, "''").replaceAll("~", "~0").replaceAll(".", "~1");
5178
5107
  }
5179
5108
  function unescapeKeyPathComponent(e) {
5180
- return e.replaceAll("~1", ".").replaceAll("~0", "~").replace(/^''$/, "").replaceAll("''''", "''");
5109
+ return e.replaceAll("~1", ".").replaceAll("~0", "~").replace(/^''$/u, "").replaceAll("''''", "''");
5181
5110
  }
5182
5111
  function getByKeyPath(e, t) {
5183
5112
  if ("" === t) return e;
5184
- if (null === e || "object" !== _typeof(e)) throw new TypeError("Unexpected non-object type");
5185
- var r = t.indexOf(".");
5113
+ if (null === e || "object" != typeof e) throw new TypeError("Unexpected non-object type");
5114
+ const r = t.indexOf(".");
5186
5115
  if (-1 !== r) {
5187
- var n = e[unescapeKeyPathComponent(t.slice(0, r))];
5116
+ const n = e[unescapeKeyPathComponent(t.slice(0, r))];
5188
5117
  return void 0 === n ? void 0 : getByKeyPath(n, t.slice(r + 1));
5189
5118
  }
5190
5119
  return e[unescapeKeyPathComponent(t)];
5191
5120
  }
5192
5121
  function setAtKeyPath(e, t, r) {
5193
5122
  if ("" === t) return r;
5194
- if (!e || "object" !== _typeof(e)) throw new TypeError("Unexpected non-object type");
5195
- if ("__proto__" === t) throw new TypeError("Invalid property");
5196
- var n = t.indexOf(".");
5197
- return -1 !== n ? setAtKeyPath(e[unescapeKeyPathComponent(t.slice(0, n))], t.slice(n + 1), r) : (e[unescapeKeyPathComponent(t)] = r, e);
5123
+ let n = e,
5124
+ o = t;
5125
+ for (;;) {
5126
+ if (!n || "object" != typeof n) throw new TypeError("Unexpected non-object type");
5127
+ if ("__proto__" === o) throw new TypeError("Invalid property");
5128
+ const t = o.indexOf(".");
5129
+ if (-1 === t) return n[unescapeKeyPathComponent(o)] = r, e;
5130
+ n = n[unescapeKeyPathComponent(o.slice(0, t))], o = o.slice(t + 1);
5131
+ }
5198
5132
  }
5199
5133
  function getJSONType(e) {
5200
- return null === e ? "null" : Array.isArray(e) ? "array" : _typeof(e);
5201
- }
5202
- function _await(e, t, r) {
5203
- return e && e.then || (e = Promise.resolve(e)), t ? e.then(t) : e;
5204
- }
5205
- var n = Object.keys,
5206
- a = Object.hasOwn,
5207
- o = Array.isArray,
5208
- i = ["type", "replaced", "iterateIn", "iterateUnsetNumeric", "addLength"];
5209
- function _async(e) {
5210
- return function () {
5211
- for (var t = [], r = 0; r < arguments.length; r++) t[r] = arguments[r];
5212
- try {
5213
- return Promise.resolve(e.apply(this, t));
5214
- } catch (e) {
5215
- return Promise.reject(e);
5216
- }
5217
- };
5134
+ return null === e ? "null" : Array.isArray(e) ? "array" : typeof e;
5218
5135
  }
5136
+ /**
5137
+ * @file Typeson - JSON with types.
5138
+ * @license The MIT License (MIT)
5139
+ * @copyright (c) 2016-2018 David Fahlander, Brett Zamir
5140
+ */
5141
+ const {
5142
+ keys: r,
5143
+ hasOwn: n
5144
+ } = Object,
5145
+ {
5146
+ isArray: o
5147
+ } = Array,
5148
+ s = ["type", "replaced", "iterateIn", "iterateUnsetNumeric", "addLength"];
5219
5149
  function nestedPathsFirst(e, t) {
5220
- var r, n;
5221
5150
  if ("" === e.keypath) return -1;
5222
- var a = null !== (r = e.keypath.match(/\./g)) && void 0 !== r ? r : 0,
5223
- o = null !== (n = t.keypath.match(/\./g)) && void 0 !== n ? n : 0;
5224
- return a && (a = a.length), o && (o = o.length), a > o ? -1 : a < o ? 1 : e.keypath < t.keypath ? -1 : e.keypath > t.keypath ? 1 : 0;
5225
- }
5226
- var c = _createClass(function Typeson(e) {
5227
- _classCallCheck(this, Typeson), this.options = e, this.plainObjectReplacers = [], this.nonplainObjectReplacers = [], this.revivers = {}, this.types = {};
5228
- }, [{
5229
- key: "stringify",
5230
- value: function stringify(e, t, r, n) {
5231
- n = _objectSpread2(_objectSpread2(_objectSpread2({}, this.options), n), {}, {
5232
- stringification: true
5233
- });
5234
- var a = this.encapsulate(e, null, n);
5235
- return o(a) ? JSON.stringify(a[0], t, r) : a.then(function (e) {
5236
- return JSON.stringify(e, t, r);
5237
- });
5238
- }
5239
- }, {
5240
- key: "stringifySync",
5241
- value: function stringifySync(e, t, r, n) {
5242
- return this.stringify(e, t, r, _objectSpread2(_objectSpread2({
5243
- throwOnBadSyncType: true
5244
- }, n), {}, {
5245
- sync: true
5246
- }));
5247
- }
5248
- }, {
5249
- key: "stringifyAsync",
5250
- value: function stringifyAsync(e, t, r, n) {
5251
- return this.stringify(e, t, r, _objectSpread2(_objectSpread2({
5252
- throwOnBadSyncType: true
5253
- }, n), {}, {
5254
- sync: false
5255
- }));
5256
- }
5257
- }, {
5258
- key: "parse",
5259
- value: function parse(e, t, r) {
5260
- return r = _objectSpread2(_objectSpread2(_objectSpread2({}, this.options), r), {}, {
5261
- parse: true
5262
- }), this.revive(JSON.parse(e, t), r);
5263
- }
5264
- }, {
5265
- key: "parseSync",
5266
- value: function parseSync(e, t, r) {
5267
- return this.parse(e, t, _objectSpread2(_objectSpread2({
5268
- throwOnBadSyncType: true
5269
- }, r), {}, {
5270
- sync: true
5271
- }));
5272
- }
5273
- }, {
5274
- key: "parseAsync",
5275
- value: function parseAsync(e, t, r) {
5276
- return this.parse(e, t, _objectSpread2(_objectSpread2({
5277
- throwOnBadSyncType: true
5278
- }, r), {}, {
5279
- sync: false
5280
- }));
5281
- }
5282
- }, {
5283
- key: "specialTypeNames",
5284
- value: function specialTypeNames(e, t) {
5285
- var r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
5286
- return r.returnTypeNames = true, this.encapsulate(e, t, r);
5287
- }
5288
- }, {
5289
- key: "rootTypeName",
5290
- value: function rootTypeName(e, t) {
5291
- var r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
5292
- return r.iterateNone = true, this.encapsulate(e, t, r);
5293
- }
5294
- }, {
5295
- key: "encapsulate",
5296
- value: function encapsulate(t, r, c) {
5297
- var s = this,
5298
- u = _objectSpread2(_objectSpread2({
5299
- sync: true
5300
- }, this.options), c),
5301
- l = u.sync,
5302
- f = {},
5303
- y = [],
5304
- p = [],
5305
- d = [],
5306
- v = !("cyclic" in u) || u.cyclic,
5307
- b = u.encapsulateObserver,
5308
- m = function finish(e) {
5309
- var t = Object.values(f);
5310
- if (u.iterateNone) return t.length ? t[0] : getJSONType(e);
5311
- if (t.length) {
5312
- if (u.returnTypeNames) return function _toConsumableArray(e) {
5313
- return function _arrayWithoutHoles(e) {
5314
- if (Array.isArray(e)) return _arrayLikeToArray(e);
5315
- }(e) || function _iterableToArray(e) {
5316
- if ("undefined" != typeof Symbol && null != e[Symbol.iterator] || null != e["@@iterator"]) return Array.from(e);
5317
- }(e) || _unsupportedIterableToArray(e) || function _nonIterableSpread() {
5318
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5319
- }();
5320
- }(new Set(t));
5321
- e && isPlainObject(e) && !a(e, "$types") ? e.$types = f : e = {
5322
- $: e,
5323
- $types: {
5324
- $: f
5325
- }
5326
- };
5327
- } else isObject(e) && a(e, "$types") && (e = {
5151
+ let r = e.keypath.match(/\./gu) ?? 0,
5152
+ n = t.keypath.match(/\./gu) ?? 0;
5153
+ return r && (r = r.length), n && (n = n.length), r > n ? -1 : r < n ? 1 : e.keypath < t.keypath ? -1 : e.keypath > t.keypath ? 1 : 0;
5154
+ }
5155
+ class Typeson {
5156
+ constructor(e) {
5157
+ this.options = e, this.plainObjectReplacers = [], this.nonplainObjectReplacers = [], this.revivers = {}, this.types = {};
5158
+ }
5159
+ stringify(e, t, r, n) {
5160
+ n = {
5161
+ ...this.options,
5162
+ ...n,
5163
+ stringification: true
5164
+ };
5165
+ const s = this.encapsulate(e, null, n);
5166
+ return o(s) ? JSON.stringify(s[0], t, r) : s.then(e => JSON.stringify(e, t, r));
5167
+ }
5168
+ stringifySync(e, t, r, n) {
5169
+ return this.stringify(e, t, r, {
5170
+ throwOnBadSyncType: true,
5171
+ ...n,
5172
+ sync: true
5173
+ });
5174
+ }
5175
+ stringifyAsync(e, t, r, n) {
5176
+ return this.stringify(e, t, r, {
5177
+ throwOnBadSyncType: true,
5178
+ ...n,
5179
+ sync: false
5180
+ });
5181
+ }
5182
+ parse(e, t, r) {
5183
+ return r = {
5184
+ ...this.options,
5185
+ ...r,
5186
+ parse: true
5187
+ }, this.revive(JSON.parse(e, t), r);
5188
+ }
5189
+ parseSync(e, t, r) {
5190
+ return this.parse(e, t, {
5191
+ throwOnBadSyncType: true,
5192
+ ...r,
5193
+ sync: true
5194
+ });
5195
+ }
5196
+ parseAsync(e, t, r) {
5197
+ return this.parse(e, t, {
5198
+ throwOnBadSyncType: true,
5199
+ ...r,
5200
+ sync: false
5201
+ });
5202
+ }
5203
+ specialTypeNames(e, t, r = {}) {
5204
+ return r.returnTypeNames = true, this.encapsulate(e, t, r);
5205
+ }
5206
+ rootTypeName(e, t, r = {}) {
5207
+ return r.iterateNone = true, this.encapsulate(e, t, r);
5208
+ }
5209
+ encapsulate(e, t, a) {
5210
+ const i = {
5211
+ sync: true,
5212
+ ...this.options,
5213
+ ...a
5214
+ },
5215
+ {
5216
+ sync: c
5217
+ } = i,
5218
+ y = {},
5219
+ l = [],
5220
+ u = [],
5221
+ p = [],
5222
+ f = !("cyclic" in i) || i.cyclic,
5223
+ {
5224
+ encapsulateObserver: d
5225
+ } = i,
5226
+ finish = e => {
5227
+ const t = Object.values(y);
5228
+ if (i.iterateNone) return t.length ? t[0] : getJSONType(e);
5229
+ if (t.length) {
5230
+ if (i.returnTypeNames) return [...new Set(t)];
5231
+ e && isPlainObject(e) && !n(e, "$types") ? e.$types = y : e = {
5328
5232
  $: e,
5329
- $types: true
5330
- });
5331
- return !u.returnTypeNames && e;
5332
- },
5333
- h = _async(function (t, r) {
5334
- return _await(Promise.all(r.map(function (e) {
5335
- return e[1].p;
5336
- })), function (n) {
5337
- return _await(Promise.all(n.map(_async(function (n) {
5338
- var a = false,
5339
- o = [],
5340
- i = _slicedToArray(r.splice(0, 1), 1),
5341
- c = _slicedToArray(i[0], 7),
5342
- s = c[0],
5343
- u = c[2],
5344
- l = c[3],
5345
- f = c[4],
5346
- y = c[5],
5347
- p = c[6],
5348
- d = O(s, n, u, l, o, true, p),
5349
- v = hasConstructorOf(d, e);
5350
- return function _invoke(e, t) {
5351
- var r = e();
5352
- return r && r.then ? r.then(t) : t(r);
5353
- }(function () {
5354
- if (s && v) return _await(d.p, function (e) {
5355
- f[y] = e;
5356
- var r = h(t, o);
5357
- return a = true, r;
5358
- });
5359
- }, function (e) {
5360
- return a ? e : (s ? f[y] = d : t = v ? d.p : d, h(t, o));
5361
- });
5362
- }))), function () {
5363
- return t;
5364
- });
5365
- });
5366
- }),
5367
- g = function _adaptBuiltinStateObjectProperties(e, t, r) {
5368
- Object.assign(e, t);
5369
- var n = i.map(function (t) {
5370
- var r = e[t];
5371
- return delete e[t], r;
5372
- });
5373
- r(), i.forEach(function (t, r) {
5374
- e[t] = n[r];
5375
- });
5376
- },
5377
- O = function _encapsulate(t, r, i, c, l, d, v) {
5378
- var m,
5379
- h = {},
5380
- _ = _typeof(r),
5381
- A = b ? function (n) {
5382
- var a,
5383
- o = null !== (a = null != v ? v : c.type) && void 0 !== a ? a : getJSONType(r);
5384
- b(Object.assign(null != n ? n : h, {
5385
- keypath: t,
5386
- value: r,
5387
- cyclic: i,
5388
- stateObj: c,
5389
- promisesData: l,
5390
- resolvingTypesonPromise: d,
5391
- awaitingTypesonPromise: hasConstructorOf(r, e)
5392
- }, {
5393
- type: o
5394
- }));
5395
- } : null;
5396
- if (["string", "boolean", "number", "undefined"].includes(_)) return void 0 === r || Number.isNaN(r) || r === Number.NEGATIVE_INFINITY || r === Number.POSITIVE_INFINITY || 0 === r ? (m = c.replaced ? r : w(t, r, c, l, false, d, A)) !== r && (h = {
5397
- replaced: m
5398
- }) : m = r, A && A(), m;
5399
- if (null === r) return A && A(), r;
5400
- if (i && !c.iterateIn && !c.iterateUnsetNumeric && r && "object" === _typeof(r)) {
5401
- var S = y.indexOf(r);
5402
- if (-1 !== S) return f[t] = "#", A && A({
5403
- cyclicKeypath: p[S]
5404
- }), "#" + p[S];
5405
- true === i && (y.push(r), p.push(t));
5233
+ $types: {
5234
+ $: y
5235
+ }
5236
+ };
5237
+ } else isObject(e) && n(e, "$types") && (e = {
5238
+ $: e,
5239
+ $types: true
5240
+ });
5241
+ return !i.returnTypeNames && e;
5242
+ },
5243
+ checkPromises = async (e, t) => {
5244
+ const r = await Promise.all(t.map(e => e[1].p));
5245
+ return await Promise.all(r.map(async function (r) {
5246
+ const n = [],
5247
+ [o] = t.splice(0, 1),
5248
+ [s,, a, i, c, y, l] = o,
5249
+ u = _encapsulate(s, r, a, i, n, true, l),
5250
+ p = hasConstructorOf(u, TypesonPromise);
5251
+ if (s && p) {
5252
+ const t = await u.p;
5253
+ return c[y] = t, checkPromises(e, n);
5406
5254
  }
5407
- var j,
5408
- T = isPlainObject(r),
5409
- I = o(r),
5410
- N = (T || I) && (!s.plainObjectReplacers.length || c.replaced) || c.iterateIn ? r : w(t, r, c, l, T || I, null, A);
5411
- if (N !== r ? (m = N, h = {
5412
- replaced: N
5413
- }) : "" === t && hasConstructorOf(r, e) ? (l.push([t, r, i, c, void 0, void 0, c.type]), m = r) : I && "object" !== c.iterateIn || "array" === c.iterateIn ? (j = new Array(r.length), h = {
5414
- clone: j
5415
- }) : (["function", "symbol"].includes(_typeof(r)) || "toJSON" in r || hasConstructorOf(r, e) || hasConstructorOf(r, Promise) || hasConstructorOf(r, ArrayBuffer)) && !T && "object" !== c.iterateIn ? m = r : (j = {}, c.addLength && (j.length = r.length), h = {
5416
- clone: j
5417
- }), A && A(), u.iterateNone) return null != j ? j : m;
5418
- if (!j) return m;
5419
- if (c.iterateIn) {
5420
- var P = function _loop(n) {
5421
- var o = {
5422
- ownKeys: a(r, n)
5423
- };
5424
- g(c, o, function () {
5425
- var a = t + (t ? "." : "") + escapeKeyPathComponent(n),
5426
- o = O(a, r[n], Boolean(i), c, l, d);
5427
- hasConstructorOf(o, e) ? l.push([a, o, Boolean(i), c, j, n, c.type]) : void 0 !== o && (j[n] = o);
5428
- });
5255
+ return s ? c[y] = u : e = p ? u.p : u, checkPromises(e, n);
5256
+ })), e;
5257
+ },
5258
+ _adaptBuiltinStateObjectProperties = (e, t, r) => {
5259
+ Object.assign(e, t);
5260
+ const n = s.map(t => {
5261
+ const r = e[t];
5262
+ return delete e[t], r;
5263
+ });
5264
+ r(), s.forEach((t, r) => {
5265
+ e[t] = n[r];
5266
+ });
5267
+ },
5268
+ _encapsulate = (e, t, s, a, c, p, f) => {
5269
+ let m,
5270
+ h = {};
5271
+ const g = d ? function (r) {
5272
+ const n = f ?? a.type ?? getJSONType(t);
5273
+ d(Object.assign(r ?? h, {
5274
+ keypath: e,
5275
+ value: t,
5276
+ cyclic: s,
5277
+ stateObj: a,
5278
+ promisesData: c,
5279
+ resolvingTypesonPromise: p,
5280
+ awaitingTypesonPromise: hasConstructorOf(t, TypesonPromise)
5281
+ }, {
5282
+ type: n
5283
+ }));
5284
+ } : null;
5285
+ if (["string", "boolean", "number", "undefined"].includes(typeof t)) return void 0 === t || t === 1 / 0 || 0 === t || t === -1 / 0 || Number.isNaN(t) ? (m = a.replaced ? t : replace(e, t, a, c, false, p, g), m !== t && (h = {
5286
+ replaced: m
5287
+ })) : m = t, g && g(), m;
5288
+ if (null === t) return g && g(), t;
5289
+ if (s && t && "object" == typeof t && !a.iterateIn && !a.iterateUnsetNumeric) {
5290
+ const r = l.indexOf(t);
5291
+ if (-1 !== r) return y[e] = "#", g && g({
5292
+ cyclicKeypath: u[r]
5293
+ }), "#" + u[r];
5294
+ true === s && (l.push(t), u.push(e));
5295
+ }
5296
+ const b = isPlainObject(t),
5297
+ v = o(t),
5298
+ O = (b || v) && (!this.plainObjectReplacers.length || a.replaced) || a.iterateIn ? t : replace(e, t, a, c, b || v, null, g);
5299
+ let w;
5300
+ if (O !== t ? (m = O, h = {
5301
+ replaced: O
5302
+ }) : "" === e && hasConstructorOf(t, TypesonPromise) ? (c.push([e, t, s, a, void 0, void 0, a.type]), m = t) : v && "object" !== a.iterateIn || "array" === a.iterateIn ? (w = new Array(t.length), h = {
5303
+ clone: w
5304
+ }) : !b && (["function", "symbol"].includes(typeof t) || "toJSON" in t || hasConstructorOf(t, TypesonPromise) || hasConstructorOf(t, Promise) || hasConstructorOf(t, ArrayBuffer)) && "object" !== a.iterateIn ? m = t : (w = {}, a.addLength && (w.length = t.length), h = {
5305
+ clone: w
5306
+ }), g && g(), i.iterateNone) return w ?? m;
5307
+ if (!w) return m;
5308
+ if (a.iterateIn) {
5309
+ for (const r in t) {
5310
+ const o = {
5311
+ ownKeys: n(t, r)
5429
5312
  };
5430
- for (var x in r) P(x);
5431
- A && A({
5432
- endIterateIn: true,
5433
- end: true
5434
- });
5435
- } else n(r).forEach(function (n) {
5436
- var a = t + (t ? "." : "") + escapeKeyPathComponent(n);
5437
- g(c, {
5438
- ownKeys: true
5439
- }, function () {
5440
- var t = O(a, r[n], Boolean(i), c, l, d);
5441
- hasConstructorOf(t, e) ? l.push([a, t, Boolean(i), c, j, n, c.type]) : void 0 !== t && (j[n] = t);
5313
+ _adaptBuiltinStateObjectProperties(a, o, () => {
5314
+ const n = e + (e ? "." : "") + escapeKeyPathComponent(r),
5315
+ o = _encapsulate(n, t[r], Boolean(s), a, c, p);
5316
+ hasConstructorOf(o, TypesonPromise) ? c.push([n, o, Boolean(s), a, w, r, a.type]) : void 0 !== o && (w[r] = o);
5442
5317
  });
5443
- }), A && A({
5444
- endIterateOwn: true,
5318
+ }
5319
+ g && g({
5320
+ endIterateIn: true,
5445
5321
  end: true
5446
5322
  });
5447
- if (c.iterateUnsetNumeric) {
5448
- for (var E = r.length, C = function _loop2(n) {
5449
- if (!(n in r)) {
5450
- var a = "".concat(t).concat(t ? "." : "").concat(String(n));
5451
- g(c, {
5452
- ownKeys: false
5453
- }, function () {
5454
- var t = O(a, void 0, Boolean(i), c, l, d);
5455
- hasConstructorOf(t, e) ? l.push([a, t, Boolean(i), c, j, n, c.type]) : void 0 !== t && (j[n] = t);
5456
- });
5457
- }
5458
- }, B = 0; B < E; B++) C(B);
5459
- A && A({
5460
- endIterateUnsetNumeric: true,
5461
- end: true
5323
+ } else r(t).forEach(function (r) {
5324
+ const n = e + (e ? "." : "") + escapeKeyPathComponent(r);
5325
+ _adaptBuiltinStateObjectProperties(a, {
5326
+ ownKeys: true
5327
+ }, () => {
5328
+ const e = _encapsulate(n, t[r], Boolean(s), a, c, p);
5329
+ hasConstructorOf(e, TypesonPromise) ? c.push([n, e, Boolean(s), a, w, r, a.type]) : void 0 !== e && (w[r] = e);
5330
+ });
5331
+ }), g && g({
5332
+ endIterateOwn: true,
5333
+ end: true
5334
+ });
5335
+ if (a.iterateUnsetNumeric) {
5336
+ const r = t.length;
5337
+ for (let n = 0; n < r; n++) {
5338
+ if (n in t) continue;
5339
+ const r = `${e}${e ? "." : ""}${String(n)}`;
5340
+ _adaptBuiltinStateObjectProperties(a, {
5341
+ ownKeys: false
5342
+ }, () => {
5343
+ const e = _encapsulate(r, void 0, Boolean(s), a, c, p);
5344
+ hasConstructorOf(e, TypesonPromise) ? c.push([r, e, Boolean(s), a, w, n, a.type]) : void 0 !== e && (w[n] = e);
5462
5345
  });
5463
5346
  }
5464
- return j;
5465
- },
5466
- w = function replace(e, t, r, n, a, o, i) {
5467
- for (var c = a ? s.plainObjectReplacers : s.nonplainObjectReplacers, u = c.length; u--;) {
5468
- var y = c[u];
5469
- if (y.test(t, r)) {
5470
- var p = y.type;
5471
- if (s.revivers[p]) {
5472
- var d = f[e];
5473
- f[e] = d ? [p].concat(d) : p;
5474
- }
5475
- if (Object.assign(r, {
5476
- type: p,
5477
- replaced: true
5478
- }), (l || !y.replaceAsync) && !y.replace) return i && i({
5479
- typeDetected: true
5480
- }), O(e, t, v && "readonly", r, n, o, p);
5481
- i && i({
5482
- replacing: true
5483
- });
5484
- var b = void 0;
5485
- if (l || !y.replaceAsync) {
5486
- if (void 0 === y.replace) throw new TypeError("Missing replacer");
5487
- b = y.replace(t, r);
5488
- } else b = y.replaceAsync(t, r);
5489
- return O(e, b, v && "readonly", r, n, o, p);
5347
+ g && g({
5348
+ endIterateUnsetNumeric: true,
5349
+ end: true
5350
+ });
5351
+ }
5352
+ return w;
5353
+ },
5354
+ replace = (e, t, r, n, o, s, a) => {
5355
+ const i = o ? this.plainObjectReplacers : this.nonplainObjectReplacers;
5356
+ let l = i.length;
5357
+ for (; l--;) {
5358
+ const o = i[l];
5359
+ if (o.test(t, r)) {
5360
+ const {
5361
+ type: i
5362
+ } = o;
5363
+ if (Object.hasOwn(this.revivers, i)) {
5364
+ const t = y[e];
5365
+ y[e] = t ? [i].concat(t) : i;
5490
5366
  }
5367
+ if (Object.assign(r, {
5368
+ type: i,
5369
+ replaced: true
5370
+ }), (c || !o.replaceAsync) && !o.replace) return a && a({
5371
+ typeDetected: true
5372
+ }), _encapsulate(e, t, f && "readonly", r, n, s, i);
5373
+ let l;
5374
+ if (a && a({
5375
+ replacing: true
5376
+ }), c || !o.replaceAsync) {
5377
+ if (void 0 === o.replace) throw new TypeError("Missing replacer");
5378
+ l = o.replace(t, r);
5379
+ } else l = o.replaceAsync(t, r);
5380
+ return _encapsulate(e, l, f && "readonly", r, n, s, i);
5491
5381
  }
5492
- return t;
5493
- },
5494
- _ = O("", t, v, null != r ? r : {}, d);
5495
- if (d.length) return l && u.throwOnBadSyncType ? function () {
5496
- throw new TypeError("Sync method requested but async result obtained");
5497
- }() : Promise.resolve(h(_, d)).then(m);
5498
- if (!l && u.throwOnBadSyncType) throw new TypeError("Async method requested but sync result obtained");
5499
- return u.stringification && l ? [m(_)] : l ? m(_) : Promise.resolve(m(_));
5500
- }
5501
- }, {
5502
- key: "encapsulateSync",
5503
- value: function encapsulateSync(e, t, r) {
5504
- return this.encapsulate(e, t, _objectSpread2(_objectSpread2({
5505
- throwOnBadSyncType: true
5506
- }, r), {}, {
5507
- sync: true
5508
- }));
5509
- }
5510
- }, {
5511
- key: "encapsulateAsync",
5512
- value: function encapsulateAsync(e, t, r) {
5513
- return this.encapsulate(e, t, _objectSpread2(_objectSpread2({
5514
- throwOnBadSyncType: true
5515
- }, r), {}, {
5516
- sync: false
5517
- }));
5518
- }
5519
- }, {
5520
- key: "revive",
5521
- value: function revive(t, r) {
5522
- var a = this,
5523
- i = _objectSpread2(_objectSpread2({
5524
- sync: true
5525
- }, this.options), r),
5526
- c = i.sync;
5527
- function finishRevival(e) {
5528
- if (c) return e;
5529
- if (i.throwOnBadSyncType) throw new TypeError("Async method requested but sync result obtained");
5530
- return Promise.resolve(e);
5531
- }
5532
- if (!t || "object" !== _typeof(t) || Array.isArray(t)) return finishRevival(t);
5533
- var u = t.$types;
5534
- if (true === u) return finishRevival(t.$);
5535
- if (!u || "object" !== _typeof(u) || Array.isArray(u)) return finishRevival(t);
5536
- var l = [],
5537
- f = {},
5538
- y = true;
5539
- u.$ && isPlainObject(u.$) && (t = t.$, u = u.$, y = false);
5540
- var p = function executeReviver(e, t) {
5541
- var r,
5542
- n = _slicedToArray(null !== (r = a.revivers[e]) && void 0 !== r ? r : [], 1)[0];
5543
- if (!n) throw new Error("Unregistered type: " + e);
5544
- if (c && !("revive" in n)) return t;
5545
- if (!c && n.reviveAsync) return n.reviveAsync(t, f);
5546
- if (n.revive) return n.revive(t, f);
5547
- throw new Error("Missing reviver");
5548
- },
5549
- d = [];
5550
- function checkUndefined(e) {
5551
- return hasConstructorOf(e, s) ? void 0 : e;
5552
- }
5553
- var v,
5554
- b = function revivePlainObjects() {
5555
- var r = [];
5556
- if (!u) throw new Error("Found bad `types`");
5557
- if (Object.entries(u).forEach(function (e) {
5558
- var t = _slicedToArray(e, 2),
5559
- n = t[0],
5560
- o = t[1];
5561
- "#" !== o && [].concat(o).forEach(function (e) {
5562
- var t;
5563
- _slicedToArray(null !== (t = a.revivers[e]) && void 0 !== t ? t : [null, {}], 2)[1].plain && (r.push({
5564
- keypath: n,
5565
- type: e
5566
- }), delete u[n]);
5567
- });
5568
- }), r.length) return r.sort(nestedPathsFirst), r.reduce(function reducer(r, n) {
5569
- var a = n.keypath,
5570
- o = n.type;
5571
- if (isThenable(r)) return r.then(function (e) {
5572
- return reducer(e, {
5573
- keypath: a,
5574
- type: o
5575
- });
5576
- });
5577
- var i = getByKeyPath(t, a);
5578
- if (hasConstructorOf(i = p(o, i), e)) return i.then(function (e) {
5579
- var r = setAtKeyPath(t, a, e);
5580
- r === e && (t = r);
5581
- });
5582
- var c = setAtKeyPath(t, a, i);
5583
- c === i && (t = c);
5584
- }, void 0);
5585
- }();
5586
- return hasConstructorOf(b, e) ? v = b.then(function () {
5382
+ }
5587
5383
  return t;
5588
- }) : (v = function _revive(t, r, a, i, c) {
5589
- if (!y || "$types" !== t) {
5590
- var f = u[t],
5591
- v = o(r);
5592
- if (v || isPlainObject(r)) {
5593
- var b = v ? new Array(r.length) : {};
5594
- for (n(r).forEach(function (n) {
5595
- var o = _revive(t + (t ? "." : "") + escapeKeyPathComponent(n), r[n], null != a ? a : b, b, n),
5596
- i = function set(e) {
5597
- return hasConstructorOf(e, s) ? b[n] = void 0 : void 0 !== e && (b[n] = e), e;
5598
- };
5599
- hasConstructorOf(o, e) ? d.push(o.then(function (e) {
5600
- return i(e);
5601
- })) : i(o);
5602
- }), r = b; l.length;) {
5603
- var m = _slicedToArray(l[0], 4),
5604
- h = m[0],
5605
- g = m[1],
5606
- O = m[2],
5607
- w = m[3],
5608
- _ = getByKeyPath(h, g);
5609
- if (void 0 === _) break;
5610
- O[w] = _, l.splice(0, 1);
5611
- }
5384
+ },
5385
+ m = _encapsulate("", e, f, t ?? {}, p);
5386
+ if (p.length) return c && i.throwOnBadSyncType ? (() => {
5387
+ throw new TypeError("Sync method requested but async result obtained");
5388
+ })() : Promise.resolve(checkPromises(m, p)).then(finish);
5389
+ if (!c && i.throwOnBadSyncType) throw new TypeError("Async method requested but sync result obtained");
5390
+ return c && i.stringification ? [finish(m)] : c ? finish(m) : Promise.resolve(finish(m));
5391
+ }
5392
+ encapsulateSync(e, t, r) {
5393
+ return this.encapsulate(e, t, {
5394
+ throwOnBadSyncType: true,
5395
+ ...r,
5396
+ sync: true
5397
+ });
5398
+ }
5399
+ encapsulateAsync(e, t, r) {
5400
+ return this.encapsulate(e, t, {
5401
+ throwOnBadSyncType: true,
5402
+ ...r,
5403
+ sync: false
5404
+ });
5405
+ }
5406
+ revive(e, t) {
5407
+ const s = {
5408
+ sync: true,
5409
+ ...this.options,
5410
+ ...t
5411
+ },
5412
+ {
5413
+ sync: a
5414
+ } = s;
5415
+ function finishRevival(e) {
5416
+ if (a) return e;
5417
+ if (s.throwOnBadSyncType) throw new TypeError("Async method requested but sync result obtained");
5418
+ return Promise.resolve(e);
5419
+ }
5420
+ if (!e || "object" != typeof e || Array.isArray(e)) return finishRevival(e);
5421
+ let i = e.$types;
5422
+ if (true === i) return finishRevival(e.$);
5423
+ if (!i || "object" != typeof i || Array.isArray(i)) return finishRevival(e);
5424
+ const c = [],
5425
+ y = Object.create(null),
5426
+ l = {};
5427
+ let u = true;
5428
+ i.$ && isPlainObject(i.$) && (e = e.$, i = i.$, u = false);
5429
+ const executeReviver = (e, t) => {
5430
+ const [r] = this.revivers[e] ?? [];
5431
+ if (!r) throw new Error("Unregistered type: " + e);
5432
+ if (a && !("revive" in r)) return t;
5433
+ if (!a && r.reviveAsync) return r.reviveAsync(t, l);
5434
+ if (r.revive) return r.revive(t, l);
5435
+ throw new Error("Missing reviver");
5436
+ },
5437
+ p = [];
5438
+ function checkUndefined(e) {
5439
+ return hasConstructorOf(e, Undefined) ? void 0 : e;
5440
+ }
5441
+ const f = (() => {
5442
+ if (!i) throw new Error("Found bad `types`");
5443
+ const t = [];
5444
+ if (Object.entries(i).forEach(([e, r]) => {
5445
+ "#" !== r && [].concat(r).forEach(r => {
5446
+ const [, {
5447
+ plain: n
5448
+ }] = this.revivers[r] ?? [null, {}];
5449
+ n && (t.push({
5450
+ keypath: e,
5451
+ type: r
5452
+ }), delete i[e]);
5453
+ });
5454
+ }), t.length) return t.sort(nestedPathsFirst), t.reduce(function reducer(t, {
5455
+ keypath: r,
5456
+ type: n
5457
+ }) {
5458
+ if (isThenable(t)) return t.then(e => reducer(e, {
5459
+ keypath: r,
5460
+ type: n
5461
+ }));
5462
+ let o = getByKeyPath(e, r);
5463
+ if (o = executeReviver(n, o), hasConstructorOf(o, TypesonPromise)) return o.then(t => {
5464
+ const n = setAtKeyPath(e, r, t);
5465
+ n === t && (e = n);
5466
+ });
5467
+ const s = setAtKeyPath(e, r, o);
5468
+ s === o && (e = s);
5469
+ }, void 0);
5470
+ })();
5471
+ let d;
5472
+ return hasConstructorOf(f, TypesonPromise) ? d = f.then(() => e) : (d = function _revive(e, t, s, l, f) {
5473
+ if (u && "$types" === e) return;
5474
+ const d = p.length,
5475
+ m = i[e],
5476
+ h = o(t);
5477
+ if (h || isPlainObject(t)) {
5478
+ const o = h ? new Array(t.length) : {};
5479
+ for (r(t).forEach(r => {
5480
+ const n = _revive(e + (e ? "." : "") + escapeKeyPathComponent(r), t[r], s ?? o, o, r),
5481
+ set = e => (hasConstructorOf(e, Undefined) ? o[r] = void 0 : void 0 !== e && (o[r] = e), e);
5482
+ hasConstructorOf(n, TypesonPromise) ? p.push(n.then(e => set(e))) : set(n);
5483
+ }), t = o; c.length;) {
5484
+ const [[e, t, r, o]] = c,
5485
+ s = n(y, t),
5486
+ a = s ? y[t] : getByKeyPath(e, t);
5487
+ if (!s && void 0 === a) break;
5488
+ r[o] = a, c.shift();
5489
+ }
5490
+ }
5491
+ if (!m) return y[e] = t, t;
5492
+ if ("#" === m) {
5493
+ const e = t.slice(1),
5494
+ r = n(y, e),
5495
+ o = r ? y[e] : getByKeyPath(s, e);
5496
+ return r || void 0 !== o || c.push([s, e, l, f]), o;
5497
+ }
5498
+ const applyType = t => {
5499
+ const r = [].concat(m).reduce(function reducer(e, t) {
5500
+ if (hasConstructorOf(e, TypesonPromise)) return e.then(e => reducer(e, t));
5501
+ if ("string" != typeof t) throw new TypeError("Bad type JSON");
5502
+ return executeReviver(t, e);
5503
+ }, t);
5504
+ return hasConstructorOf(r, TypesonPromise) ? r.then(t => (y[e] = t, t)) : (y[e] = r, r);
5505
+ };
5506
+ return !a && p.length > d ? TypesonPromise.all(p.slice(d)).then(() => applyType(t)) : applyType(t);
5507
+ }("", e, null), p.length && (d = TypesonPromise.resolve(d).then(e => TypesonPromise.all([e, ...p])).then(([e]) => e))), isThenable(d) ? a && s.throwOnBadSyncType ? (() => {
5508
+ throw new TypeError("Sync method requested but async result obtained");
5509
+ })() : hasConstructorOf(d, TypesonPromise) ? d.p.then(checkUndefined) : d : !a && s.throwOnBadSyncType ? (() => {
5510
+ throw new TypeError("Async method requested but sync result obtained");
5511
+ })() : a ? checkUndefined(d) : Promise.resolve(checkUndefined(d));
5512
+ }
5513
+ reviveSync(e, t) {
5514
+ return this.revive(e, {
5515
+ throwOnBadSyncType: true,
5516
+ ...t,
5517
+ sync: true
5518
+ });
5519
+ }
5520
+ reviveAsync(e, t) {
5521
+ return this.revive(e, {
5522
+ throwOnBadSyncType: true,
5523
+ ...t,
5524
+ sync: false
5525
+ });
5526
+ }
5527
+ register(e, t) {
5528
+ const n = t ?? {},
5529
+ reg = e => {
5530
+ o(e) ? e.forEach(e => {
5531
+ reg(e);
5532
+ }) : r(e).forEach(t => {
5533
+ if ("#" === t) throw new TypeError("# cannot be used as a type name as it is reserved for cyclic objects");
5534
+ if (a.includes(t)) throw new TypeError("Plain JSON object types are reserved as type names");
5535
+ let r = e[t];
5536
+ const s = r && "function" != typeof r && !Array.isArray(r) && r.testPlainObjects ? this.plainObjectReplacers : this.nonplainObjectReplacers,
5537
+ i = s.filter(function (e) {
5538
+ return e.type === t;
5539
+ });
5540
+ if (i.length && (s.splice(s.indexOf(i[0]), 1), delete this.revivers[t], delete this.types[t]), "function" == typeof r) {
5541
+ const e = r;
5542
+ r = {
5543
+ test: t => t && t.constructor === e,
5544
+ replace: e => ({
5545
+ ...e
5546
+ }),
5547
+ revive: t => Object.assign(Object.create(e.prototype), t)
5548
+ };
5549
+ } else if (o(r)) {
5550
+ const [e, t, n] = r;
5551
+ r = {
5552
+ test: e,
5553
+ replace: t,
5554
+ revive: n
5555
+ };
5612
5556
  }
5613
- if (!f) return r;
5614
- if ("#" === f) {
5615
- var A = getByKeyPath(a, r.slice(1));
5616
- return void 0 === A && l.push([a, r.slice(1), i, c]), A;
5557
+ if (!r?.test) return;
5558
+ const c = {
5559
+ type: t,
5560
+ test: r.test.bind(r)
5561
+ };
5562
+ r.replace && (c.replace = r.replace.bind(r)), r.replaceAsync && (c.replaceAsync = r.replaceAsync.bind(r));
5563
+ const y = "number" == typeof n.fallback ? n.fallback : n.fallback ? 0 : 1 / 0;
5564
+ if (r.testPlainObjects ? this.plainObjectReplacers.splice(y, 0, c) : this.nonplainObjectReplacers.splice(y, 0, c), r.revive || r.reviveAsync) {
5565
+ const e = {};
5566
+ r.revive && (e.revive = r.revive.bind(r)), r.reviveAsync && (e.reviveAsync = r.reviveAsync.bind(r)), this.revivers[t] = [e, {
5567
+ plain: r.testPlainObjects
5568
+ }];
5617
5569
  }
5618
- return [].concat(f).reduce(function reducer(t, r) {
5619
- if (hasConstructorOf(t, e)) return t.then(function (e) {
5620
- return reducer(e, r);
5621
- });
5622
- if ("string" != typeof r) throw new TypeError("Bad type JSON");
5623
- return p(r, t);
5624
- }, r);
5625
- }
5626
- }("", t, null), d.length && (v = e.resolve(v).then(function (t) {
5627
- return e.all([t].concat(d));
5628
- }).then(function (e) {
5629
- return _slicedToArray(e, 1)[0];
5630
- }))), isThenable(v) ? c && i.throwOnBadSyncType ? function () {
5631
- throw new TypeError("Sync method requested but async result obtained");
5632
- }() : hasConstructorOf(v, e) ? v.p.then(checkUndefined) : v : !c && i.throwOnBadSyncType ? function () {
5633
- throw new TypeError("Async method requested but sync result obtained");
5634
- }() : c ? checkUndefined(v) : Promise.resolve(checkUndefined(v));
5635
- }
5636
- }, {
5637
- key: "reviveSync",
5638
- value: function reviveSync(e, t) {
5639
- return this.revive(e, _objectSpread2(_objectSpread2({
5640
- throwOnBadSyncType: true
5641
- }, t), {}, {
5642
- sync: true
5643
- }));
5644
- }
5645
- }, {
5646
- key: "reviveAsync",
5647
- value: function reviveAsync(e, t) {
5648
- return this.revive(e, _objectSpread2(_objectSpread2({
5649
- throwOnBadSyncType: true
5650
- }, t), {}, {
5651
- sync: false
5652
- }));
5653
- }
5654
- }, {
5655
- key: "register",
5656
- value: function register(e, t) {
5657
- var r = this,
5658
- a = null != t ? t : {},
5659
- i = function reg(e) {
5660
- o(e) ? e.forEach(function (e) {
5661
- i(e);
5662
- }) : n(e).forEach(function (t) {
5663
- var n;
5664
- if ("#" === t) throw new TypeError("# cannot be used as a type name as it is reserved for cyclic objects");
5665
- if (u.includes(t)) throw new TypeError("Plain JSON object types are reserved as type names");
5666
- var i = e[t],
5667
- c = i && "function" != typeof i && !Array.isArray(i) && i.testPlainObjects ? r.plainObjectReplacers : r.nonplainObjectReplacers,
5668
- s = c.filter(function (e) {
5669
- return e.type === t;
5670
- });
5671
- if (s.length && (c.splice(c.indexOf(s[0]), 1), delete r.revivers[t], delete r.types[t]), "function" == typeof i) {
5672
- var l = i;
5673
- i = {
5674
- test: function test(e) {
5675
- return e && e.constructor === l;
5676
- },
5677
- replace: function replace(e) {
5678
- return _objectSpread2({}, e);
5679
- },
5680
- revive: function revive(e) {
5681
- return Object.assign(Object.create(l.prototype), e);
5682
- }
5683
- };
5684
- } else if (o(i)) {
5685
- var f = _slicedToArray(i, 3);
5686
- i = {
5687
- test: f[0],
5688
- replace: f[1],
5689
- revive: f[2]
5690
- };
5691
- }
5692
- if (null !== (n = i) && void 0 !== n && n.test) {
5693
- var y = {
5694
- type: t,
5695
- test: i.test.bind(i)
5696
- };
5697
- i.replace && (y.replace = i.replace.bind(i)), i.replaceAsync && (y.replaceAsync = i.replaceAsync.bind(i));
5698
- var p = "number" == typeof a.fallback ? a.fallback : a.fallback ? 0 : Number.POSITIVE_INFINITY;
5699
- if (i.testPlainObjects ? r.plainObjectReplacers.splice(p, 0, y) : r.nonplainObjectReplacers.splice(p, 0, y), i.revive || i.reviveAsync) {
5700
- var d = {};
5701
- i.revive && (d.revive = i.revive.bind(i)), i.reviveAsync && (d.reviveAsync = i.reviveAsync.bind(i)), r.revivers[t] = [d, {
5702
- plain: i.testPlainObjects
5703
- }];
5704
- }
5705
- r.types[t] = i;
5706
- }
5707
- });
5708
- };
5709
- return [].concat(e).forEach(function (e) {
5710
- i(e);
5711
- }), this;
5712
- }
5713
- }]),
5714
- s = _createClass(function Undefined() {
5715
- _classCallCheck(this, Undefined);
5716
- });
5717
- s.__typeson__type__ = "TypesonUndefined";
5718
- for (var u = ["null", "boolean", "number", "string", "array", "object"], l = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", f = new Uint8Array(256), y = 0; y < 64; y++) f[l.codePointAt(y)] = y;
5719
- var p = function encode(e, t, r) {
5570
+ this.types[t] = r;
5571
+ });
5572
+ };
5573
+ return [].concat(e).forEach(e => {
5574
+ reg(e);
5575
+ }), this;
5576
+ }
5577
+ }
5578
+ class Undefined {}
5579
+ Undefined.__typeson__type__ = "TypesonUndefined";
5580
+ const a = ["null", "boolean", "number", "string", "array", "object"];
5581
+ for (var i = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", c = new Uint8Array(256), y = 0; y < 64; y++) c[i.codePointAt(y)] = y;
5582
+ var l = function encode(e, t, r) {
5720
5583
  null == r && (r = e.byteLength);
5721
- for (var n = new Uint8Array(e, 0, r), a = n.length, o = "", i = 0; i < a; i += 3) o += l[n[i] >> 2], o += l[(3 & n[i]) << 4 | n[i + 1] >> 4], o += l[(15 & n[i + 1]) << 2 | n[i + 2] >> 6], o += l[63 & n[i + 2]];
5722
- return a % 3 == 2 ? o = o.slice(0, -1) + "=" : a % 3 == 1 && (o = o.slice(0, -2) + "=="), o;
5584
+ for (var n = new Uint8Array(e, 0, r), o = n.length, s = "", a = 0; a < o; a += 3) s += i[n[a] >> 2], s += i[(3 & n[a]) << 4 | n[a + 1] >> 4], s += i[(15 & n[a + 1]) << 2 | n[a + 2] >> 6], s += i[63 & n[a + 2]];
5585
+ return o % 3 == 2 ? s = s.slice(0, -1) + "=" : o % 3 == 1 && (s = s.slice(0, -2) + "=="), s;
5723
5586
  },
5724
- d = function decode(e, t) {
5587
+ u = function decode(e, t) {
5725
5588
  var r = e.length;
5726
5589
  if (r % 4) throw new Error("Bad base64 length: not divisible by four");
5727
5590
  var n,
5728
- a,
5729
5591
  o,
5730
- i,
5731
- c = .75 * e.length,
5732
- s = 0;
5733
- "=" === e[e.length - 1] && (c--, "=" === e[e.length - 2] && c--);
5734
- for (var u = new ArrayBuffer(c, t), l = new Uint8Array(u), y = 0; y < r; y += 4) n = f[e.codePointAt(y)], a = f[e.codePointAt(y + 1)], o = f[e.codePointAt(y + 2)], i = f[e.codePointAt(y + 3)], l[s++] = n << 2 | a >> 4, l[s++] = (15 & a) << 4 | o >> 2, l[s++] = (3 & o) << 6 | 63 & i;
5735
- return u;
5592
+ s,
5593
+ a,
5594
+ i = .75 * e.length,
5595
+ y = 0;
5596
+ "=" === e[e.length - 1] && (i--, "=" === e[e.length - 2] && i--);
5597
+ for (var l = new ArrayBuffer(i, t), u = new Uint8Array(l), p = 0; p < r; p += 4) n = c[e.codePointAt(p)], o = c[e.codePointAt(p + 1)], s = c[e.codePointAt(p + 2)], a = c[e.codePointAt(p + 3)], u[y++] = n << 2 | o >> 4, u[y++] = (15 & o) << 4 | s >> 2, u[y++] = (3 & s) << 6 | 63 & a;
5598
+ return l;
5736
5599
  };
5737
- const v = {
5600
+ const p = {
5738
5601
  arraybuffer: {
5739
5602
  test: e => "ArrayBuffer" === toStringTag(e),
5740
5603
  replace(e, t) {
@@ -5743,28 +5606,28 @@ const v = {
5743
5606
  return -1 !== r ? {
5744
5607
  index: r
5745
5608
  } : (t.buffers.push(e), {
5746
- s: p(e),
5609
+ s: l(e),
5747
5610
  maxByteLength: e.maxByteLength,
5748
5611
  resizable: e.resizable
5749
5612
  });
5750
5613
  },
5751
5614
  revive(e, t) {
5752
5615
  if (t.buffers || (t.buffers = []), Object.hasOwn(e, "index")) return t.buffers[e.index];
5753
- const r = d(e.s, e.resizable ? {
5616
+ const r = u(e.s, e.resizable ? {
5754
5617
  maxByteLength: e.maxByteLength
5755
5618
  } : void 0);
5756
5619
  return t.buffers.push(r), r;
5757
5620
  }
5758
5621
  }
5759
5622
  },
5760
- b = {
5623
+ f = {
5761
5624
  bigintObject: {
5762
5625
  test: e => "object" == typeof e && hasConstructorOf(e, BigInt),
5763
5626
  replace: String,
5764
5627
  revive: e => new Object(BigInt(e))
5765
5628
  }
5766
5629
  },
5767
- m = {
5630
+ d = {
5768
5631
  bigint: {
5769
5632
  test: e => "bigint" == typeof e,
5770
5633
  replace: String,
@@ -5779,7 +5642,7 @@ function string2arraybuffer(e) {
5779
5642
  for (let r = 0; r < e.length; r++) t[r] = e.charCodeAt(r);
5780
5643
  return t.buffer;
5781
5644
  }
5782
- const h = {
5645
+ const m = {
5783
5646
  blob: {
5784
5647
  test: e => "Blob" === toStringTag(e),
5785
5648
  replace(e) {
@@ -5799,33 +5662,33 @@ const h = {
5799
5662
  type: t
5800
5663
  });
5801
5664
  },
5802
- replaceAsync: t => new e((e, r) => {
5665
+ replaceAsync: e => new TypesonPromise((t, r) => {
5803
5666
  const n = new FileReader();
5804
5667
  n.addEventListener("load", () => {
5805
- e({
5806
- type: t.type,
5668
+ t({
5669
+ type: e.type,
5807
5670
  stringContents: arraybuffer2string(n.result)
5808
5671
  });
5809
5672
  }), n.addEventListener("error", () => {
5810
5673
  r(n.error);
5811
- }), n.readAsArrayBuffer(t);
5674
+ }), n.readAsArrayBuffer(e);
5812
5675
  })
5813
5676
  }
5814
5677
  };
5815
- const w = {
5678
+ const b = {
5816
5679
  cryptokey: {
5817
5680
  test: e => "CryptoKey" === toStringTag(e) && e.extractable,
5818
- replaceAsync: t => new e(async (e, r) => {
5681
+ replaceAsync: e => new TypesonPromise(async (t, r) => {
5819
5682
  let n;
5820
5683
  try {
5821
- n = await crypto.subtle.exportKey("jwk", t);
5684
+ n = await crypto.subtle.exportKey("jwk", e);
5822
5685
  } catch (e) {
5823
5686
  return void r(e);
5824
5687
  }
5825
- e({
5688
+ t({
5826
5689
  jwk: n,
5827
- algorithm: t.algorithm,
5828
- usages: t.usages
5690
+ algorithm: e.algorithm,
5691
+ usages: e.usages
5829
5692
  });
5830
5693
  }),
5831
5694
  revive(e) {
@@ -5838,7 +5701,7 @@ const w = {
5838
5701
  }
5839
5702
  }
5840
5703
  },
5841
- _ = {
5704
+ v = {
5842
5705
  dataview: {
5843
5706
  test: e => "DataView" === toStringTag(e),
5844
5707
  replace({
@@ -5847,13 +5710,13 @@ const w = {
5847
5710
  byteLength: r
5848
5711
  }, n) {
5849
5712
  n.buffers || (n.buffers = []);
5850
- const a = n.buffers.indexOf(e);
5851
- return -1 !== a ? {
5852
- index: a,
5713
+ const o = n.buffers.indexOf(e);
5714
+ return -1 !== o ? {
5715
+ index: o,
5853
5716
  byteOffset: t,
5854
5717
  byteLength: r
5855
5718
  } : (n.buffers.push(e), {
5856
- encoded: p(e),
5719
+ encoded: l(e),
5857
5720
  maxByteLength: e.maxByteLength,
5858
5721
  resizable: e.resizable,
5859
5722
  byteOffset: t,
@@ -5865,29 +5728,29 @@ const w = {
5865
5728
  const {
5866
5729
  byteOffset: r,
5867
5730
  byteLength: n,
5868
- encoded: a,
5869
- index: o,
5870
- maxByteLength: i,
5871
- resizable: c
5731
+ encoded: o,
5732
+ index: s,
5733
+ maxByteLength: a,
5734
+ resizable: i
5872
5735
  } = e;
5873
- let s;
5874
- return "index" in e ? s = t.buffers[o] : (s = d(a, c ? {
5875
- maxByteLength: i
5876
- } : i), t.buffers.push(s)), new DataView(s, r, n);
5736
+ let c;
5737
+ return "index" in e ? c = t.buffers[s] : (c = u(o, i ? {
5738
+ maxByteLength: a
5739
+ } : a), t.buffers.push(c)), new DataView(c, r, n);
5877
5740
  }
5878
5741
  }
5879
5742
  },
5880
- A = {
5743
+ O = {
5881
5744
  date: {
5882
5745
  test: e => "Date" === toStringTag(e),
5883
5746
  replace(e) {
5884
5747
  const t = e.getTime();
5885
5748
  return Number.isNaN(t) ? "NaN" : t;
5886
5749
  },
5887
- revive: e => "NaN" === e ? new Date(Number.NaN) : new Date(e)
5750
+ revive: e => "NaN" === e ? new Date(NaN) : new Date(e)
5888
5751
  }
5889
5752
  },
5890
- S = {
5753
+ w = {
5891
5754
  domexception: {
5892
5755
  test: e => "DOMException" === toStringTag(e),
5893
5756
  replace: e => ({
@@ -5900,9 +5763,9 @@ const w = {
5900
5763
  }) => new DOMException(e, t)
5901
5764
  }
5902
5765
  },
5903
- j = {};
5766
+ T = {};
5904
5767
  function create$5(e) {
5905
- j[e.name.toLowerCase()] = {
5768
+ T[e.name.toLowerCase()] = {
5906
5769
  test: t => toStringTag(t) === e.name,
5907
5770
  replace: e => e.is2D ? {
5908
5771
  a: e.a,
@@ -5933,9 +5796,9 @@ function create$5(e) {
5933
5796
  };
5934
5797
  }
5935
5798
  "undefined" != typeof DOMMatrix && create$5(DOMMatrix), "undefined" != typeof DOMMatrixReadOnly && create$5(DOMMatrixReadOnly);
5936
- const T = {};
5799
+ const A = {};
5937
5800
  function create$4(e) {
5938
- T[e.name.toLowerCase()] = {
5801
+ A[e.name.toLowerCase()] = {
5939
5802
  test: t => toStringTag(t) === e.name,
5940
5803
  replace: e => ({
5941
5804
  x: e.x,
@@ -5947,12 +5810,12 @@ function create$4(e) {
5947
5810
  x: t,
5948
5811
  y: r,
5949
5812
  z: n,
5950
- w: a
5951
- }) => new e(t, r, n, a)
5813
+ w: o
5814
+ }) => new e(t, r, n, o)
5952
5815
  };
5953
5816
  }
5954
5817
  "undefined" != typeof DOMPoint && create$4(DOMPoint), "undefined" != typeof DOMPointReadOnly && create$4(DOMPointReadOnly);
5955
- const I = {
5818
+ const P = {
5956
5819
  domquad: {
5957
5820
  test: e => "DOMQuad" === toStringTag(e),
5958
5821
  replace: e => ({
@@ -5969,9 +5832,9 @@ const I = {
5969
5832
  }) => new DOMQuad(e, t, r, n)
5970
5833
  }
5971
5834
  },
5972
- N = {};
5835
+ S = {};
5973
5836
  function create$3(e) {
5974
- N[e.name.toLowerCase()] = {
5837
+ S[e.name.toLowerCase()] = {
5975
5838
  test: t => toStringTag(t) === e.name,
5976
5839
  replace: e => ({
5977
5840
  x: e.x,
@@ -5983,12 +5846,12 @@ function create$3(e) {
5983
5846
  x: t,
5984
5847
  y: r,
5985
5848
  width: n,
5986
- height: a
5987
- }) => new e(t, r, n, a)
5849
+ height: o
5850
+ }) => new e(t, r, n, o)
5988
5851
  };
5989
5852
  }
5990
5853
  "undefined" != typeof DOMRect && create$3(DOMRect), "undefined" != typeof DOMRectReadOnly && create$3(DOMRectReadOnly);
5991
- const P = {
5854
+ const x = {
5992
5855
  error: {
5993
5856
  test: e => "Error" === toStringTag(e),
5994
5857
  replace: ({
@@ -5996,17 +5859,17 @@ const P = {
5996
5859
  message: t,
5997
5860
  cause: r,
5998
5861
  stack: n,
5999
- fileName: a,
6000
- lineNumber: o,
6001
- columnNumber: i
5862
+ fileName: o,
5863
+ lineNumber: s,
5864
+ columnNumber: a
6002
5865
  }) => ({
6003
5866
  name: e,
6004
5867
  message: t,
6005
5868
  cause: r,
6006
5869
  stack: n,
6007
- fileName: a,
6008
- lineNumber: o,
6009
- columnNumber: i
5870
+ fileName: o,
5871
+ lineNumber: s,
5872
+ columnNumber: a
6010
5873
  }),
6011
5874
  revive(e) {
6012
5875
  const t = new Error(e.message);
@@ -6014,28 +5877,28 @@ const P = {
6014
5877
  }
6015
5878
  }
6016
5879
  },
6017
- x = {};
5880
+ j = {};
6018
5881
  function create$2(e) {
6019
- x[e.name.toLowerCase()] = {
5882
+ j[e.name.toLowerCase()] = {
6020
5883
  test: t => hasConstructorOf(t, e),
6021
5884
  replace: ({
6022
5885
  name: e,
6023
5886
  message: t,
6024
5887
  cause: r,
6025
5888
  stack: n,
6026
- fileName: a,
6027
- lineNumber: o,
6028
- columnNumber: i,
6029
- errors: c
5889
+ fileName: o,
5890
+ lineNumber: s,
5891
+ columnNumber: a,
5892
+ errors: i
6030
5893
  }) => ({
6031
5894
  name: e,
6032
5895
  message: t,
6033
5896
  cause: r,
6034
5897
  stack: n,
6035
- fileName: a,
6036
- lineNumber: o,
6037
- columnNumber: i,
6038
- errors: c
5898
+ fileName: o,
5899
+ lineNumber: s,
5900
+ columnNumber: a,
5901
+ errors: i
6039
5902
  }),
6040
5903
  revive(t) {
6041
5904
  const r = "undefined" != typeof AggregateError && e === AggregateError ? new e(t.errors, t.message) : new e(t.message);
@@ -6044,7 +5907,7 @@ function create$2(e) {
6044
5907
  };
6045
5908
  }
6046
5909
  [TypeError, RangeError, SyntaxError, ReferenceError, EvalError, URIError].forEach(e => create$2(e)), "undefined" != typeof AggregateError && create$2(AggregateError), "function" == typeof InternalError && create$2(InternalError);
6047
- const E = {
5910
+ const N = {
6048
5911
  file: {
6049
5912
  test: e => "File" === toStringTag(e),
6050
5913
  replace(e) {
@@ -6066,23 +5929,23 @@ const E = {
6066
5929
  type: t,
6067
5930
  lastModified: n
6068
5931
  }),
6069
- replaceAsync: t => new e(function (e, r) {
5932
+ replaceAsync: e => new TypesonPromise(function (t, r) {
6070
5933
  const n = new FileReader();
6071
5934
  n.addEventListener("load", function () {
6072
- e({
6073
- type: t.type,
5935
+ t({
5936
+ type: e.type,
6074
5937
  stringContents: arraybuffer2string(n.result),
6075
- name: t.name,
6076
- lastModified: t.lastModified
5938
+ name: e.name,
5939
+ lastModified: e.lastModified
6077
5940
  });
6078
5941
  }), n.addEventListener("error", function () {
6079
5942
  r(n.error);
6080
- }), n.readAsArrayBuffer(t);
5943
+ }), n.readAsArrayBuffer(e);
6081
5944
  })
6082
5945
  }
6083
5946
  },
6084
- C = {
6085
- file: E.file,
5947
+ _ = {
5948
+ file: N.file,
6086
5949
  filelist: {
6087
5950
  test: e => "FileList" === toStringTag(e),
6088
5951
  replace(e) {
@@ -6125,23 +5988,23 @@ const E = {
6125
5988
  r.drawImage(n, 0, 0);
6126
5989
  }), n.src = e.dataURL, "undefined" == typeof OffscreenCanvas ? t : t.transferToImageBitmap();
6127
5990
  },
6128
- reviveAsync(t) {
6129
- const r = document.createElement("canvas"),
6130
- n = r.getContext("2d"),
6131
- a = document.createElement("img");
6132
- return a.addEventListener("load", function () {
6133
- n.drawImage(a, 0, 0);
6134
- }), a.src = t.dataURL, new e(async (e, t) => {
5991
+ reviveAsync(e) {
5992
+ const t = document.createElement("canvas"),
5993
+ r = t.getContext("2d"),
5994
+ n = document.createElement("img");
5995
+ return n.addEventListener("load", function () {
5996
+ r.drawImage(n, 0, 0);
5997
+ }), n.src = e.dataURL, new TypesonPromise(async (e, r) => {
6135
5998
  try {
6136
- e(await createImageBitmap(r));
5999
+ e(await createImageBitmap(t));
6137
6000
  } catch (e) {
6138
- t(e);
6001
+ r(e);
6139
6002
  }
6140
6003
  });
6141
6004
  }
6142
6005
  }
6143
6006
  },
6144
- k = {
6007
+ E = {
6145
6008
  imagedata: {
6146
6009
  test: e => "ImageData" === toStringTag(e),
6147
6010
  replace: e => ({
@@ -6152,42 +6015,42 @@ const E = {
6152
6015
  revive: e => new ImageData(new Uint8ClampedArray(e.array), e.width, e.height)
6153
6016
  }
6154
6017
  },
6155
- U = {
6018
+ C = {
6156
6019
  infinity: {
6157
- test: e => e === Number.POSITIVE_INFINITY,
6020
+ test: e => e === 1 / 0,
6158
6021
  replace: () => "Infinity",
6159
- revive: () => Number.POSITIVE_INFINITY
6022
+ revive: () => 1 / 0
6160
6023
  }
6161
6024
  },
6162
- D = {
6025
+ U = {
6163
6026
  map: {
6164
6027
  test: e => "Map" === toStringTag(e),
6165
- replace: e => [...e.entries()],
6028
+ replace: e => e.entries().toArray(),
6166
6029
  revive: e => new Map(e)
6167
6030
  }
6168
6031
  },
6169
- R = {
6032
+ M = {
6170
6033
  nan: {
6171
6034
  test: e => Number.isNaN(e),
6172
6035
  replace: () => "NaN",
6173
- revive: () => Number.NaN
6036
+ revive: () => NaN
6174
6037
  }
6175
6038
  },
6176
- K = {
6039
+ L = {
6177
6040
  negativeInfinity: {
6178
- test: e => e === Number.NEGATIVE_INFINITY,
6041
+ test: e => e === -1 / 0,
6179
6042
  replace: () => "-Infinity",
6180
- revive: () => Number.NEGATIVE_INFINITY
6043
+ revive: () => -1 / 0
6181
6044
  }
6182
6045
  },
6183
- F = {
6046
+ D = {
6184
6047
  negativeZero: {
6185
6048
  test: e => Object.is(e, -0),
6186
6049
  replace: () => 0,
6187
6050
  revive: () => -0
6188
6051
  }
6189
6052
  },
6190
- z = {
6053
+ k = {
6191
6054
  StringObject: {
6192
6055
  test: e => "String" === toStringTag(e) && "object" == typeof e,
6193
6056
  replace: String,
@@ -6204,7 +6067,7 @@ const E = {
6204
6067
  revive: e => new Number(e)
6205
6068
  }
6206
6069
  },
6207
- V = {
6070
+ $ = {
6208
6071
  regexp: {
6209
6072
  test: e => "RegExp" === toStringTag(e),
6210
6073
  replace: e => ({
@@ -6217,26 +6080,26 @@ const E = {
6217
6080
  }) => new RegExp(e, t)
6218
6081
  }
6219
6082
  },
6220
- W = {
6083
+ J = {
6221
6084
  set: {
6222
6085
  test: e => "Set" === toStringTag(e),
6223
- replace: e => [...e.values()],
6086
+ replace: e => e.values().toArray(),
6224
6087
  revive: e => new Set(e)
6225
6088
  }
6226
6089
  },
6227
- H = {};
6090
+ V = {};
6228
6091
  "function" == typeof Int8Array && [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array, ...("function" == typeof BigInt64Array ? [BigInt64Array, BigUint64Array] : [])].forEach(e => function create$1(e) {
6229
6092
  const t = e.name;
6230
- H[t.toLowerCase()] = {
6093
+ V[t.toLowerCase()] = {
6231
6094
  test: e => toStringTag(e) === t,
6232
6095
  replace: e => (0 === e.byteOffset && e.byteLength === e.buffer.byteLength ? e : e.slice(0)).buffer,
6233
6096
  revive: t => "ArrayBuffer" === toStringTag(t) ? new e(t) : t
6234
6097
  };
6235
6098
  }(e));
6236
- const Q = {};
6099
+ const W = {};
6237
6100
  "function" == typeof Int8Array && [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array, ...("function" == typeof BigInt64Array ? [BigInt64Array, BigUint64Array] : [])].forEach(e => function create(e) {
6238
6101
  const t = e.name;
6239
- Q[t.toLowerCase()] = {
6102
+ W[t.toLowerCase()] = {
6240
6103
  test: e => toStringTag(e) === t,
6241
6104
  replace({
6242
6105
  buffer: e,
@@ -6244,15 +6107,15 @@ const Q = {};
6244
6107
  length: r
6245
6108
  }, n) {
6246
6109
  n.buffers || (n.buffers = []);
6247
- const a = n.buffers.indexOf(e);
6248
- return -1 !== a ? {
6249
- index: a,
6110
+ const o = n.buffers.indexOf(e);
6111
+ return -1 !== o ? {
6112
+ index: o,
6250
6113
  byteOffset: t,
6251
6114
  length: r
6252
6115
  } : (n.buffers.push(e), {
6253
6116
  maxByteLength: e.maxByteLength,
6254
6117
  resizable: e.resizable,
6255
- encoded: p(e),
6118
+ encoded: l(e),
6256
6119
  byteOffset: t,
6257
6120
  length: r
6258
6121
  });
@@ -6261,27 +6124,27 @@ const Q = {};
6261
6124
  r.buffers || (r.buffers = []);
6262
6125
  const {
6263
6126
  byteOffset: n,
6264
- length: a,
6265
- encoded: o,
6266
- index: i,
6267
- maxByteLength: c,
6268
- resizable: s
6127
+ length: o,
6128
+ encoded: s,
6129
+ index: a,
6130
+ maxByteLength: i,
6131
+ resizable: c
6269
6132
  } = t;
6270
- let u;
6271
- return "index" in t ? u = r.buffers[i] : (u = d(o, s ? {
6272
- maxByteLength: c
6273
- } : void 0), r.buffers.push(u)), new e(u, n, a);
6133
+ let y;
6134
+ return "index" in t ? y = r.buffers[a] : (y = u(s, c ? {
6135
+ maxByteLength: i
6136
+ } : void 0), r.buffers.push(y)), new e(y, n, o);
6274
6137
  }
6275
6138
  };
6276
6139
  }(e));
6277
- const X = {
6140
+ const Q = {
6278
6141
  undef: {
6279
6142
  test: (e, t) => void 0 === e && (t.ownKeys || !("ownKeys" in t)),
6280
6143
  replace: () => 0,
6281
- revive: () => new s()
6144
+ revive: () => new Undefined()
6282
6145
  }
6283
6146
  },
6284
- Z = {
6147
+ G = {
6285
6148
  userObject: {
6286
6149
  test: e => isUserObject(e),
6287
6150
  replace: e => ({
@@ -6290,10 +6153,10 @@ const X = {
6290
6153
  revive: e => e
6291
6154
  }
6292
6155
  },
6293
- ee = [{
6156
+ H = [{
6294
6157
  arrayNonindexKeys: {
6295
6158
  testPlainObjects: true,
6296
- test: (e, t) => !!Array.isArray(e) && (Object.keys(e).some(e => String(Number.parseInt(e)) !== e) && (t.iterateIn = "object", t.addLength = true), true),
6159
+ test: (e, t) => !!Array.isArray(e) && (Object.keys(e).some(e => String(Number(e)) !== e) && (t.iterateIn = "object", t.addLength = true), true),
6297
6160
  replace: (e, t) => (t.iterateUnsetNumeric = true, e),
6298
6161
  revive(e) {
6299
6162
  if (Array.isArray(e)) return e;
@@ -6310,9 +6173,9 @@ const X = {
6310
6173
  revive() {}
6311
6174
  }
6312
6175
  }],
6313
- te = [R, U, K, F],
6314
- ie = [Z, X, ee, z, te, A, V, k, B, E, C, h, P, x].concat("function" == typeof Map ? D : [], "function" == typeof Set ? W : [], "function" == typeof ArrayBuffer ? v : [], "function" == typeof Uint8Array ? Q : [], "function" == typeof DataView ? _ : [], "undefined" != typeof crypto ? w : [], "undefined" != typeof BigInt ? [m, b] : [], "undefined" != typeof DOMException ? S : [], "undefined" != typeof DOMRect ? N : [], "undefined" != typeof DOMPoint ? T : [], "undefined" != typeof DOMQuad ? I : [], "undefined" != typeof DOMMatrix ? j : []),
6315
- ce = ie.concat({
6176
+ X = [M, C, L, D],
6177
+ re = [G, Q, H, k, X, O, $, E, B, N, _, m, x, j].concat("function" == typeof Map ? U : [], "function" == typeof Set ? J : [], "function" == typeof ArrayBuffer ? p : [], "function" == typeof Uint8Array ? W : [], "function" == typeof DataView ? v : [], "undefined" != typeof crypto ? b : [], "undefined" != typeof BigInt ? [d, f] : [], "undefined" != typeof DOMException ? w : [], "undefined" != typeof DOMRect ? S : [], "undefined" != typeof DOMPoint ? A : [], "undefined" != typeof DOMQuad ? P : [], "undefined" != typeof DOMMatrix ? T : []),
6178
+ ne = re.concat({
6316
6179
  checkDataCloneException: {
6317
6180
  test(e) {
6318
6181
  const t = {}.toString.call(e).slice(8, -1);
@@ -6322,9 +6185,9 @@ const X = {
6322
6185
  }
6323
6186
  });
6324
6187
 
6325
- // See: http://stackoverflow.com/questions/42170826/categories-for-rejection-by-the-structured-cloning-algorithm
6188
+ // See: https://stackoverflow.com/questions/42170826/categories-for-rejection-by-the-structured-cloning-algorithm
6326
6189
 
6327
- let typeson = new c().register(ce);
6190
+ let typeson = new Typeson().register(ne);
6328
6191
 
6329
6192
  /**
6330
6193
  * @param {(preset: import('typeson-registry').Preset) =>
@@ -6332,7 +6195,8 @@ let typeson = new c().register(ce);
6332
6195
  * @returns {void}
6333
6196
  */
6334
6197
  function register(func) {
6335
- typeson = new c().register(func(ce));
6198
+ // eslint-disable-next-line unicorn/no-top-level-assignment-in-function -- Should be one-time cache
6199
+ typeson = new Typeson().register(func(ne));
6336
6200
  }
6337
6201
 
6338
6202
  /**
@@ -6420,7 +6284,8 @@ const readonlyProperties$2 = ['objectStore', 'keyPath', 'multiEntry', 'unique'];
6420
6284
 
6421
6285
  /**
6422
6286
  * IDB Index.
6423
- * @see http://www.w3.org/TR/IndexedDB/#idl-def-IDBIndex
6287
+ * @see https://www.w3.org/TR/IndexedDB/#idl-def-IDBIndex
6288
+ * @throws {TypeError}
6424
6289
  * @class
6425
6290
  */
6426
6291
  function IDBIndex() {
@@ -6476,65 +6341,67 @@ IDBIndex.__createInstance = function (store, indexProperties) {
6476
6341
  me.__unique = Boolean(optionalParams && optionalParams.unique);
6477
6342
  me.__deleted = Boolean(indexProperties.__deleted);
6478
6343
  me.__objectStore.__cursors = indexProperties.cursors || [];
6479
- Object.defineProperty(me, '__currentName', {
6480
- /**
6481
- * @this {IDBIndexFull}
6482
- * @returns {string}
6483
- */
6484
- get() {
6485
- return '__pendingName' in me ? (/** @type {string} */me.__pendingName) : me.name;
6486
- }
6487
- });
6488
- Object.defineProperty(me, 'name', {
6489
- enumerable: false,
6490
- configurable: false,
6491
- /**
6492
- * @this {IDBIndexFull}
6493
- * @returns {string}
6494
- */
6495
- get() {
6496
- return this.__name;
6497
- },
6498
- /**
6499
- * @param {string} newName
6500
- * @this {IDBIndexFull}
6501
- * @returns {void}
6502
- */
6503
- set(newName) {
6504
- const me = this;
6505
- newName = convertToDOMString(newName);
6506
- const oldName = me.name;
6507
- IDBTransaction.__assertVersionChange(me.objectStore.transaction);
6508
- IDBTransaction.__assertActive(me.objectStore.transaction);
6509
- IDBIndexAlias.__invalidStateIfDeleted(me);
6510
- IDBObjectStore.__invalidStateIfDeleted(me);
6511
- if (newName === oldName) {
6512
- return;
6513
- }
6514
- if (me.objectStore.__indexes[newName] && !me.objectStore.__indexes[newName].__deleted && !me.objectStore.__indexes[newName].__pendingDelete) {
6515
- throw createDOMException('ConstraintError', 'Index "' + newName + '" already exists on ' + me.objectStore.__currentName);
6344
+ Object.defineProperties(me, {
6345
+ __currentName: {
6346
+ /**
6347
+ * @this {IDBIndexFull}
6348
+ * @returns {string}
6349
+ */
6350
+ get() {
6351
+ return '__pendingName' in me ? (/** @type {string} */me.__pendingName) : me.name;
6516
6352
  }
6517
- me.__name = newName;
6518
- const {
6519
- objectStore
6520
- } = me;
6521
- delete objectStore.__indexes[oldName];
6522
- objectStore.__indexes[newName] = me;
6523
- objectStore.indexNames.splice(objectStore.indexNames.indexOf(oldName), 1, newName);
6524
- const storeHandle = /** @type {import('./IDBTransaction.js').IDBTransactionFull} */objectStore.transaction.__storeHandles[objectStore.name];
6525
- const oldIndexHandle = storeHandle.__indexHandles[oldName];
6526
- oldIndexHandle.__name = newName; // Fix old references
6527
- storeHandle.__indexHandles[newName] = oldIndexHandle; // Ensure new reference accessible
6528
- me.__pendingName = oldName;
6529
- const colInfoToPreserveArr = [['key', 'BLOB ' + (objectStore.autoIncrement ? 'UNIQUE, inc INTEGER PRIMARY KEY AUTOINCREMENT' : 'PRIMARY KEY')], ['value', 'BLOB']].concat(
6530
- // @ts-expect-error Has numeric indexes instead of iterator
6531
- [...objectStore.indexNames].filter(indexName => indexName !== newName).map(indexName => [escapeIndexNameForSQL(indexName), 'BLOB']));
6532
- me.__renameIndex(objectStore, oldName, newName, colInfoToPreserveArr, function (tx, success) {
6533
- IDBIndexAlias.__updateIndexList(store, tx, function (store) {
6534
- delete storeHandle.__pendingName;
6535
- success(store);
6353
+ },
6354
+ name: {
6355
+ enumerable: false,
6356
+ configurable: false,
6357
+ /**
6358
+ * @this {IDBIndexFull}
6359
+ * @returns {string}
6360
+ */
6361
+ get() {
6362
+ return this.__name;
6363
+ },
6364
+ /**
6365
+ * @param {string} newName
6366
+ * @this {IDBIndexFull}
6367
+ * @returns {void}
6368
+ */
6369
+ set(newName) {
6370
+ const me = this;
6371
+ newName = convertToDOMString(newName);
6372
+ const oldName = me.name;
6373
+ IDBTransaction.__assertVersionChange(me.objectStore.transaction);
6374
+ IDBTransaction.__assertActive(me.objectStore.transaction);
6375
+ IDBIndexAlias.__invalidStateIfDeleted(me);
6376
+ IDBObjectStore.__invalidStateIfDeleted(me);
6377
+ if (newName === oldName) {
6378
+ return;
6379
+ }
6380
+ if (Object.hasOwn(me.objectStore.__indexes, newName) && !me.objectStore.__indexes[newName].__deleted && !me.objectStore.__indexes[newName].__pendingDelete) {
6381
+ throw createDOMException('ConstraintError', 'Index "' + newName + '" already exists on ' + me.objectStore.__currentName);
6382
+ }
6383
+ me.__name = newName;
6384
+ const {
6385
+ objectStore
6386
+ } = me;
6387
+ delete objectStore.__indexes[oldName];
6388
+ objectStore.__indexes[newName] = me;
6389
+ objectStore.indexNames.splice(objectStore.indexNames.indexOf(oldName), 1, newName);
6390
+ const storeHandle = /** @type {import('./IDBTransaction.js').IDBTransactionFull} */objectStore.transaction.__storeHandles[objectStore.name];
6391
+ const oldIndexHandle = storeHandle.__indexHandles[oldName];
6392
+ oldIndexHandle.__name = newName; // Fix old references
6393
+ storeHandle.__indexHandles[newName] = oldIndexHandle; // Ensure new reference accessible
6394
+ me.__pendingName = oldName;
6395
+ const colInfoToPreserveArr = [['key', 'BLOB ' + (objectStore.autoIncrement ? 'UNIQUE, inc INTEGER PRIMARY KEY AUTOINCREMENT' : 'PRIMARY KEY')], ['value', 'BLOB']].concat(
6396
+ // @ts-expect-error Has numeric indexes instead of iterator
6397
+ [...objectStore.indexNames].filter(indexName => indexName !== newName).map(indexName => [escapeIndexNameForSQL(indexName), 'BLOB']));
6398
+ me.__renameIndex(objectStore, oldName, newName, colInfoToPreserveArr, function (tx, success) {
6399
+ IDBIndexAlias.__updateIndexList(store, tx, function (store) {
6400
+ delete storeHandle.__pendingName;
6401
+ success(store);
6402
+ });
6536
6403
  });
6537
- });
6404
+ }
6538
6405
  }
6539
6406
  });
6540
6407
  }
@@ -6651,7 +6518,7 @@ IDBIndex.__createIndex = function (store, index) {
6651
6518
  const indexKeyStr = /** @type {string} */
6652
6519
  encode$1(indexKey.value, index.multiEntry);
6653
6520
  if (index.unique) {
6654
- if (indexValues[indexKeyStr]) {
6521
+ if (Object.hasOwn(indexValues, indexKeyStr)) {
6655
6522
  indexValues = {};
6656
6523
  failure(createDOMException('ConstraintError', 'Duplicate values already exist within the store'));
6657
6524
  return;
@@ -6970,7 +6837,7 @@ IDBIndex.prototype.__renameIndex = function (store, oldName, newName, colInfoToP
6970
6837
  const listColInfoToPreserve = colInfoToPreserve.length ? colInfoToPreserve.join(', ') + ', ' : '';
6971
6838
  const listColsToPreserve = colNamesToPreserve.length ? colNamesToPreserve.join(', ') + ', ' : '';
6972
6839
 
6973
- // We could adapt the approach at http://stackoverflow.com/a/8430746/271577
6840
+ // We could adapt the approach at https://stackoverflow.com/a/8430746/271577
6974
6841
  // to make the approach reusable without passing column names, but it is a bit fragile
6975
6842
  /** @type {import('./IDBTransaction.js').IDBTransactionFull} */
6976
6843
  store.transaction.__addNonRequestToTransactionQueue(function renameIndex(tx, args, success, error) {
@@ -7074,6 +6941,7 @@ IDBIndex.prototype.__renameIndex = function (store, oldName, newName, colInfoToP
7074
6941
  * @typedef {any} AnyValue
7075
6942
  */
7076
6943
 
6944
+ /* eslint-disable unicorn/no-top-level-side-effects -- Would be good */
7077
6945
  Object.defineProperty(IDBIndex, Symbol.hasInstance, {
7078
6946
  /**
7079
6947
  * @param {AnyValue} obj
@@ -7087,6 +6955,7 @@ IDBIndex.prototype[Symbol.toStringTag] = 'IDBIndexPrototype';
7087
6955
  Object.defineProperty(IDBIndex, 'prototype', {
7088
6956
  writable: false
7089
6957
  });
6958
+ /* eslint-enable unicorn/no-top-level-side-effects -- Would be good */
7090
6959
 
7091
6960
  /**
7092
6961
  * @param {number|null} count
@@ -7258,8 +7127,9 @@ const readonlyProperties$1 = ['keyPath', 'indexNames', 'transaction', 'autoIncre
7258
7127
 
7259
7128
  /**
7260
7129
  * IndexedDB Object Store.
7261
- * @see http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBObjectStore
7130
+ * @see https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBObjectStore
7262
7131
  * @class
7132
+ * @throws {TypeError}
7263
7133
  */
7264
7134
  function IDBObjectStore() {
7265
7135
  throw new TypeError('Illegal constructor');
@@ -7326,84 +7196,87 @@ IDBObjectStore.__createInstance = function (storeProperties, transaction) {
7326
7196
  indexList
7327
7197
  } = storeProperties;
7328
7198
  for (const indexName in indexList) {
7329
- if (Object.hasOwn(indexList, indexName)) {
7330
- const index = IDBIndex.__createInstance(me, indexList[indexName]);
7331
- me.__indexes[index.name] = index;
7332
- if (!index.__deleted) {
7333
- me.indexNames.push(index.name);
7334
- }
7199
+ if (!Object.hasOwn(indexList, indexName)) {
7200
+ continue;
7201
+ }
7202
+ const index = IDBIndex.__createInstance(me, indexList[indexName]);
7203
+ me.__indexes[index.name] = index;
7204
+ if (!index.__deleted) {
7205
+ me.indexNames.push(index.name);
7335
7206
  }
7336
7207
  }
7337
7208
  me.__oldIndexNames = me.indexNames.clone();
7338
- Object.defineProperty(this, '__currentName', {
7339
- get() {
7340
- return '__pendingName' in this ? this.__pendingName : this.name;
7341
- }
7342
- });
7343
- Object.defineProperty(this, 'name', {
7344
- enumerable: false,
7345
- configurable: false,
7346
- /**
7347
- * @this {IDBObjectStoreFull}
7348
- * @returns {string}
7349
- */
7350
- get() {
7351
- return this.__name;
7352
- },
7353
- /**
7354
- * @param {string} name
7355
- * @this {IDBObjectStoreFull}
7356
- * @returns {void}
7357
- */
7358
- set(name) {
7359
- const me = this;
7360
- name = convertToDOMString(name);
7361
- const oldName = me.name;
7362
- IDBObjectStoreAlias.__invalidStateIfDeleted(me);
7363
- IDBTransaction.__assertVersionChange(me.transaction);
7364
- IDBTransaction.__assertActive(me.transaction);
7365
- if (oldName === name) {
7366
- return;
7367
- }
7368
- if (me.__idbdb.__objectStores[name] && !me.__idbdb.__objectStores[name].__pendingDelete) {
7369
- throw createDOMException('ConstraintError', 'Object store "' + name + '" already exists in ' + me.__idbdb.name);
7370
- }
7371
- me.__name = name;
7372
- const oldStore = me.__idbdb.__objectStores[oldName];
7373
- oldStore.__name = name; // Fix old references
7374
- me.__idbdb.__objectStores[name] = oldStore; // Ensure new reference accessible
7375
- delete me.__idbdb.__objectStores[oldName]; // Ensure won't be found
7376
-
7377
- me.__idbdb.objectStoreNames.splice(me.__idbdb.objectStoreNames.indexOf(oldName), 1, name);
7378
- const oldHandle = /** @type {IDBObjectStoreFull} */
7379
- /** @type {import('./IDBTransaction.js').IDBTransactionFull} */me.transaction.__storeHandles[oldName];
7380
- oldHandle.__name = name; // Fix old references
7381
- /** @type {import('./IDBTransaction.js').IDBTransactionFull} */
7382
- me.transaction.__storeHandles[name] = oldHandle; // Ensure new reference accessible
7383
-
7384
- me.__pendingName = oldName;
7385
- const sql = 'UPDATE __sys__ SET "name" = ? WHERE "name" = ?';
7386
- const sqlValues = [escapeSQLiteStatement(name), escapeSQLiteStatement(oldName)];
7387
- if (CFG.DEBUG) {
7388
- console.log(sql, sqlValues);
7209
+ Object.defineProperties(this, {
7210
+ __currentName: {
7211
+ get() {
7212
+ return '__pendingName' in this ? this.__pendingName : this.name;
7389
7213
  }
7390
- /** @type {import('./IDBTransaction.js').IDBTransactionFull} */
7391
- me.transaction.__addNonRequestToTransactionQueue(function objectStoreClear(tx, args, success, error) {
7392
- tx.executeSql(sql, sqlValues, function (tx) {
7393
- // This SQL preserves indexes per https://www.sqlite.org/lang_altertable.html
7394
- const sql = 'ALTER TABLE ' + escapeStoreNameForSQL(oldName) + ' RENAME TO ' + escapeStoreNameForSQL(name);
7395
- if (CFG.DEBUG) {
7396
- console.log(sql);
7397
- }
7398
- tx.executeSql(sql, [], function () {
7399
- delete me.__pendingName;
7400
- success();
7214
+ },
7215
+ name: {
7216
+ enumerable: false,
7217
+ configurable: false,
7218
+ /**
7219
+ * @this {IDBObjectStoreFull}
7220
+ * @returns {string}
7221
+ */
7222
+ get() {
7223
+ return this.__name;
7224
+ },
7225
+ /**
7226
+ * @param {string} name
7227
+ * @this {IDBObjectStoreFull}
7228
+ * @returns {void}
7229
+ */
7230
+ set(name) {
7231
+ const me = this;
7232
+ name = convertToDOMString(name);
7233
+ const oldName = me.name;
7234
+ IDBObjectStoreAlias.__invalidStateIfDeleted(me);
7235
+ IDBTransaction.__assertVersionChange(me.transaction);
7236
+ IDBTransaction.__assertActive(me.transaction);
7237
+ if (oldName === name) {
7238
+ return;
7239
+ }
7240
+ if (Object.hasOwn(me.__idbdb.__objectStores, name) && !me.__idbdb.__objectStores[name].__pendingDelete) {
7241
+ throw createDOMException('ConstraintError', 'Object store "' + name + '" already exists in ' + me.__idbdb.name);
7242
+ }
7243
+ me.__name = name;
7244
+ const oldStore = me.__idbdb.__objectStores[oldName];
7245
+ oldStore.__name = name; // Fix old references
7246
+ me.__idbdb.__objectStores[name] = oldStore; // Ensure new reference accessible
7247
+ delete me.__idbdb.__objectStores[oldName]; // Ensure won't be found
7248
+
7249
+ me.__idbdb.objectStoreNames.splice(me.__idbdb.objectStoreNames.indexOf(oldName), 1, name);
7250
+ const oldHandle = /** @type {IDBObjectStoreFull} */
7251
+ /** @type {import('./IDBTransaction.js').IDBTransactionFull} */me.transaction.__storeHandles[oldName];
7252
+ oldHandle.__name = name; // Fix old references
7253
+ /** @type {import('./IDBTransaction.js').IDBTransactionFull} */
7254
+ me.transaction.__storeHandles[name] = oldHandle; // Ensure new reference accessible
7255
+
7256
+ me.__pendingName = oldName;
7257
+ const sql = 'UPDATE __sys__ SET "name" = ? WHERE "name" = ?';
7258
+ const sqlValues = [escapeSQLiteStatement(name), escapeSQLiteStatement(oldName)];
7259
+ if (CFG.DEBUG) {
7260
+ console.log(sql, sqlValues);
7261
+ }
7262
+ /** @type {import('./IDBTransaction.js').IDBTransactionFull} */
7263
+ me.transaction.__addNonRequestToTransactionQueue(function objectStoreClear(tx, args, success, error) {
7264
+ tx.executeSql(sql, sqlValues, function (tx) {
7265
+ // This SQL preserves indexes per https://www.sqlite.org/lang_altertable.html
7266
+ const sql = 'ALTER TABLE ' + escapeStoreNameForSQL(oldName) + ' RENAME TO ' + escapeStoreNameForSQL(name);
7267
+ if (CFG.DEBUG) {
7268
+ console.log(sql);
7269
+ }
7270
+ tx.executeSql(sql, [], function () {
7271
+ delete me.__pendingName;
7272
+ success();
7273
+ });
7274
+ }, function (tx, err) {
7275
+ error(err);
7276
+ return false;
7401
7277
  });
7402
- }, function (tx, err) {
7403
- error(err);
7404
- return false;
7405
7278
  });
7406
- });
7279
+ }
7407
7280
  }
7408
7281
  });
7409
7282
  }
@@ -7467,7 +7340,7 @@ IDBObjectStore.__createObjectStore = function (db, store) {
7467
7340
  const transaction = /** @type {import('./IDBTransaction.js').IDBTransactionFull} */
7468
7341
  db.__versionTransaction;
7469
7342
  const storeHandles = transaction.__storeHandles;
7470
- if (!storeHandles[storeName] ||
7343
+ if (!Object.hasOwn(storeHandles, storeName) ||
7471
7344
  // These latter conditions are to allow store
7472
7345
  // recreation to create new clone object
7473
7346
  storeHandles[storeName].__pendingDelete || storeHandles[storeName].__deleted) {
@@ -7810,7 +7683,6 @@ IDBObjectStore.prototype.__insertData = function (tx, encoded, value, clonedKeyO
7810
7683
  return false;
7811
7684
  });
7812
7685
  return undefined;
7813
- // eslint-disable-next-line sonarjs/no-invariant-returns -- Convenient
7814
7686
  }).catch(function (err) {
7815
7687
  /**
7816
7688
  * @returns {void}
@@ -8227,7 +8099,7 @@ IDBObjectStore.prototype.index = function (indexName) {
8227
8099
  if (!index || index.__deleted) {
8228
8100
  throw createDOMException('NotFoundError', 'Index "' + indexName + '" does not exist on ' + me.__currentName);
8229
8101
  }
8230
- if (!me.__indexHandles[indexName] || me.__indexes[indexName].__pendingDelete || me.__indexes[indexName].__deleted) {
8102
+ if (!Object.hasOwn(me.__indexHandles, indexName) || me.__indexes[indexName].__pendingDelete || me.__indexes[indexName].__deleted) {
8231
8103
  me.__indexHandles[indexName] = IDBIndex.__clone(index, me);
8232
8104
  }
8233
8105
  return me.__indexHandles[indexName];
@@ -8257,7 +8129,7 @@ IDBObjectStore.prototype.createIndex = function (indexName, keyPath /* , optiona
8257
8129
  IDBTransaction.__assertVersionChange(me.transaction);
8258
8130
  IDBObjectStore.__invalidStateIfDeleted(me);
8259
8131
  IDBTransaction.__assertActive(me.transaction);
8260
- if (me.__indexes[indexName] && !me.__indexes[indexName].__deleted && !me.__indexes[indexName].__pendingDelete) {
8132
+ if (Object.hasOwn(me.__indexes, indexName) && !me.__indexes[indexName].__deleted && !me.__indexes[indexName].__pendingDelete) {
8261
8133
  throw createDOMException('ConstraintError', 'Index "' + indexName + '" already exists on ' + me.__currentName);
8262
8134
  }
8263
8135
  keyPath = convertToSequenceDOMString(keyPath);
@@ -8267,7 +8139,7 @@ IDBObjectStore.prototype.createIndex = function (indexName, keyPath /* , optiona
8267
8139
  if (Array.isArray(keyPath) && optionalParameters && optionalParameters.multiEntry) {
8268
8140
  throw createDOMException('InvalidAccessError', 'The keyPath argument was an array and the multiEntry option is true.');
8269
8141
  }
8270
- optionalParameters = optionalParameters || {};
8142
+ optionalParameters ||= {};
8271
8143
  /** @type {import('./IDBIndex.js').IDBIndexProperties} */
8272
8144
  const indexProperties = {
8273
8145
  columnName: indexName,
@@ -8305,6 +8177,8 @@ IDBObjectStore.prototype.deleteIndex = function (name) {
8305
8177
  }
8306
8178
  IDBIndex.__deleteIndex(me, index);
8307
8179
  };
8180
+
8181
+ /* eslint-disable unicorn/no-top-level-side-effects -- Would be good */
8308
8182
  defineReadonlyOuterInterface(IDBObjectStore.prototype, readonlyProperties$1);
8309
8183
  defineOuterInterface(IDBObjectStore.prototype, ['name']);
8310
8184
  IDBObjectStore.prototype[Symbol.toStringTag] = 'IDBObjectStorePrototype';
@@ -8329,8 +8203,9 @@ const readonlyProperties = ['name', 'version', 'objectStoreNames'];
8329
8203
 
8330
8204
  /**
8331
8205
  * IDB Database Object.
8332
- * @see http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#database-interface
8206
+ * @see https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#database-interface
8333
8207
  * @class
8208
+ * @throws {TypeError}
8334
8209
  */
8335
8210
  function IDBDatabase() {
8336
8211
  this.__versionTransaction = null;
@@ -8473,7 +8348,7 @@ IDBDatabase.prototype.createObjectStore = function (storeName /* , createOptions
8473
8348
  if (keyPath !== null && !isValidKeyPath(keyPath)) {
8474
8349
  throw createDOMException('SyntaxError', 'The keyPath argument contains an invalid key path.');
8475
8350
  }
8476
- if (this.__objectStores[storeName] && !this.__objectStores[storeName].__pendingDelete) {
8351
+ if (Object.hasOwn(this.__objectStores, storeName) && !this.__objectStores[storeName].__pendingDelete) {
8477
8352
  throw createDOMException('ConstraintError', 'Object store "' + storeName + '" already exists in ' + this.name);
8478
8353
  }
8479
8354
  const autoInc = createOptions.autoIncrement;
@@ -8550,7 +8425,8 @@ IDBDatabase.prototype.transaction = function (storeNames /* , mode */) {
8550
8425
  ? [...new Set(
8551
8426
  // to be unique
8552
8427
  convertToSequenceDOMString(storeNames) // iterables have `ToString` applied (and we convert to array for convenience)
8553
- )].sort() // must be sorted
8428
+ // eslint-disable-next-line unicorn/require-array-sort-compare -- IndexedDB requires code unit comparison (default behavior)
8429
+ )].toSorted() // must be sorted
8554
8430
  : [convertToDOMString(storeNames)];
8555
8431
 
8556
8432
  /* (function () {
@@ -8564,7 +8440,7 @@ IDBDatabase.prototype.transaction = function (storeNames /* , mode */) {
8564
8440
  // prioritizing readonly but not starving readwrite).
8565
8441
  // Even for readonly transactions, due to [issue 17](https://github.com/nolanlawson/node-websql/issues/17),
8566
8442
  // we're not currently actually running the SQL requests in parallel.
8567
- mode = mode || 'readonly';
8443
+ mode ||= 'readonly';
8568
8444
  IDBTransaction.__assertNotVersionChange(this.__versionTransaction);
8569
8445
  if (this.__closePending) {
8570
8446
  throw createDOMException('InvalidStateError', 'An attempt was made to start a new transaction on a database connection that is not open');
@@ -8623,13 +8499,14 @@ IDBDatabase.prototype.__forceClose = function (msg) {
8623
8499
  const evt = createEvent('close');
8624
8500
  setTimeout(() => {
8625
8501
  me.dispatchEvent(evt);
8626
- });
8502
+ }, 0);
8627
8503
  }
8628
8504
  };
8629
8505
  trans.__abortTransaction(createDOMException('AbortError', 'The connection was force-closed: ' + (msg || '')));
8630
8506
  });
8631
8507
  me.__transactions = [];
8632
8508
  };
8509
+ /* eslint-disable unicorn/no-top-level-side-effects -- Would be good */
8633
8510
  defineOuterInterface(IDBDatabase.prototype, listeners);
8634
8511
  defineReadonlyOuterInterface(IDBDatabase.prototype, readonlyProperties);
8635
8512
  Object.defineProperty(IDBDatabase.prototype, 'constructor', {
@@ -8662,6 +8539,7 @@ let fs;
8662
8539
  * @returns {void}
8663
8540
  */
8664
8541
  const setFS = _fs => {
8542
+ // eslint-disable-next-line unicorn/no-top-level-assignment-in-function -- Necessary?
8665
8543
  fs = _fs;
8666
8544
  };
8667
8545
 
@@ -8728,7 +8606,7 @@ function processNextInConnectionQueue(name, origin = getOrigin()) {
8728
8606
  */
8729
8607
  function addRequestToConnectionQueue(req, name, origin = getOrigin(), cb) {
8730
8608
  /* eslint-enable default-param-last -- Keep cb at end */
8731
- if (!connectionQueue[origin][name]) {
8609
+ if (!Object.hasOwn(connectionQueue[origin], name)) {
8732
8610
  connectionQueue[origin][name] = [];
8733
8611
  }
8734
8612
  connectionQueue[origin][name].push({
@@ -8779,7 +8657,7 @@ function triggerAnyVersionChangeAndBlockedEvents(openConnections, req, oldVersio
8779
8657
  setTimeout(() => {
8780
8658
  entry.dispatchEvent(e); // No need to catch errors
8781
8659
  resolve(undefined);
8782
- });
8660
+ }, 0);
8783
8661
  });
8784
8662
  });
8785
8663
  }, SyncPromise.resolve(undefined)).then(function () {
@@ -8810,7 +8688,7 @@ function triggerAnyVersionChangeAndBlockedEvents(openConnections, req, oldVersio
8810
8688
  } else {
8811
8689
  resolve(undefined);
8812
8690
  }
8813
- });
8691
+ }, 0);
8814
8692
  });
8815
8693
  });
8816
8694
  }
@@ -8867,7 +8745,7 @@ function getLatestCachedWebSQLDB(name) {
8867
8745
  function cleanupDatabaseResources(__openDatabase, name, escapedDatabaseName, databaseDeleted, dbError) {
8868
8746
  const useMemoryDatabase = typeof CFG.memoryDatabase === 'string';
8869
8747
  if (useMemoryDatabase) {
8870
- const latestSQLiteDBCached = websqlDBCache[name] ? getLatestCachedWebSQLDB(name) : null;
8748
+ const latestSQLiteDBCached = Object.hasOwn(websqlDBCache, name) ? getLatestCachedWebSQLDB(name) : null;
8871
8749
  if (!latestSQLiteDBCached) {
8872
8750
  console.warn('Could not find a memory database instance to delete.');
8873
8751
  databaseDeleted();
@@ -8965,6 +8843,7 @@ function createSysDB(__openDatabase, success, failure) {
8965
8843
  if (sysdb) {
8966
8844
  success();
8967
8845
  } else {
8846
+ // eslint-disable-next-line unicorn/no-top-level-assignment-in-function -- Necessary?
8968
8847
  sysdb = __openDatabase(typeof CFG.memoryDatabase === 'string' ? CFG.memoryDatabase : path.join(typeof CFG.sysDatabaseBasePath === 'string' ? CFG.sysDatabaseBasePath : CFG.databaseBasePath || '', '__sysdb__' + (CFG.addSQLiteExtension !== false ? '.sqlite' : '')), '1', 'System Database', CFG.DEFAULT_DB_SIZE);
8969
8848
  sysdb.transaction(function (systx) {
8970
8849
  systx.executeSql('CREATE TABLE IF NOT EXISTS dbVersions (name BLOB, version INT);', [], function (systx) {
@@ -8981,6 +8860,7 @@ function createSysDB(__openDatabase, success, failure) {
8981
8860
  /**
8982
8861
  * IDBFactory Class.
8983
8862
  * @see https://w3c.github.io/IndexedDB/#idl-def-IDBFactory
8863
+ * @throws {TypeError}
8984
8864
  * @class
8985
8865
  */
8986
8866
  function IDBFactory() {
@@ -9049,6 +8929,7 @@ IDBFactory.prototype.open = function (name /* , version */) {
9049
8929
  const req = IDBOpenDBRequest.__createInstance();
9050
8930
  let calledDbCreateError = false;
9051
8931
  if (CFG.autoName && name === '') {
8932
+ // eslint-disable-next-line unicorn/no-top-level-assignment-in-function -- Necessary?
9052
8933
  name = 'autoNamedDatabase_' + nameCounter++;
9053
8934
  }
9054
8935
  name = String(name); // cast to a string
@@ -9107,7 +8988,7 @@ IDBFactory.prototype.open = function (name /* , version */) {
9107
8988
  req.__done = true;
9108
8989
  }
9109
8990
  const connection = IDBDatabase.__createInstance(db, name, oldVersion, version, data);
9110
- if (!me.__connections[name]) {
8991
+ if (!Object.hasOwn(me.__connections, name)) {
9111
8992
  me.__connections[name] = [];
9112
8993
  }
9113
8994
  me.__connections[name].push(connection);
@@ -9202,7 +9083,7 @@ IDBFactory.prototype.open = function (name /* , version */) {
9202
9083
  connection.__upgradeTransaction = null;
9203
9084
  // We ensure any cache is deleted before any request error events fire and try to reopen
9204
9085
  if (useDatabaseCache) {
9205
- if (name in websqlDBCache) {
9086
+ if (Object.hasOwn(websqlDBCache, name)) {
9206
9087
  delete websqlDBCache[name][version];
9207
9088
  }
9208
9089
  }
@@ -9227,7 +9108,7 @@ IDBFactory.prototype.open = function (name /* , version */) {
9227
9108
  dbCreateError(err);
9228
9109
  return false;
9229
9110
  });
9230
- });
9111
+ }, 0);
9231
9112
  };
9232
9113
 
9233
9114
  // eslint-disable-next-line camelcase -- Clear API
@@ -9300,12 +9181,12 @@ IDBFactory.prototype.open = function (name /* , version */) {
9300
9181
  function openDB(oldVersion) {
9301
9182
  /** @type {DatabaseFull} */
9302
9183
  let db;
9303
- if ((useMemoryDatabase || useDatabaseCache) && name in websqlDBCache && websqlDBCache[name][version]) {
9184
+ if ((useMemoryDatabase || useDatabaseCache) && Object.hasOwn(websqlDBCache, name) && Object.hasOwn(websqlDBCache[name], version)) {
9304
9185
  db = websqlDBCache[name][version];
9305
9186
  } else {
9306
9187
  db = me.__openDatabase(useMemoryDatabase ? CFG.memoryDatabase : path.join(CFG.databaseBasePath || '', escapedDatabaseName), '1', name, CFG.DEFAULT_DB_SIZE);
9307
9188
  if (useDatabaseCache) {
9308
- if (!(name in websqlDBCache)) {
9189
+ if (!Object.hasOwn(websqlDBCache, name)) {
9309
9190
  websqlDBCache[name] = {};
9310
9191
  }
9311
9192
  websqlDBCache[name][version] = db;
@@ -9319,7 +9200,7 @@ IDBFactory.prototype.open = function (name /* , version */) {
9319
9200
  if (useDatabaseCache) {
9320
9201
  setTimeout(() => {
9321
9202
  dbCreateError(err);
9322
- });
9203
+ }, 0);
9323
9204
  } else {
9324
9205
  dbCreateError(err);
9325
9206
  }
@@ -9344,7 +9225,7 @@ IDBFactory.prototype.open = function (name /* , version */) {
9344
9225
  addRequestToConnectionQueue(req, name, /* origin */undefined, function () {
9345
9226
  let latestCachedVersion;
9346
9227
  if (useDatabaseCache) {
9347
- if (!(name in websqlDBCache)) {
9228
+ if (!Object.hasOwn(websqlDBCache, name)) {
9348
9229
  websqlDBCache[name] = {};
9349
9230
  }
9350
9231
  latestCachedVersion = getLatestCachedWebSQLVersion(name);
@@ -9464,7 +9345,7 @@ IDBFactory.prototype.deleteDatabase = function (name) {
9464
9345
  /** @type {DatabaseDeleted} */
9465
9346
  function databaseDeleted() {
9466
9347
  sysdbFinishedCbDelete(false, function () {
9467
- if (useDatabaseCache && name in websqlDBCache) {
9348
+ if (useDatabaseCache && Object.hasOwn(websqlDBCache, name)) {
9468
9349
  delete websqlDBCache[name]; // New calls will treat as though never existed
9469
9350
  }
9470
9351
  delete me.__connections[name];
@@ -9601,7 +9482,7 @@ IDBFactory.prototype.databases = function () {
9601
9482
  * @todo forceClose: Test
9602
9483
  * This is provided to facilitate unit-testing of the
9603
9484
  * closing of a database connection with a forced flag:
9604
- * <http://w3c.github.io/IndexedDB/#steps-for-closing-a-database-connection>
9485
+ * <https://w3c.github.io/IndexedDB/#steps-for-closing-a-database-connection>
9605
9486
  * @param {string} dbName
9606
9487
  * @param {Integer} connIdx
9607
9488
  * @param {string} msg
@@ -9625,12 +9506,13 @@ IDBFactory.prototype.__forceClose = function (dbName, connIdx, msg) {
9625
9506
  forceClose(connection);
9626
9507
  });
9627
9508
  });
9628
- } else if (!me.__connections[dbName]) {
9509
+ } else if (!Object.hasOwn(me.__connections, dbName)) {
9629
9510
  console.log('No database connections with that name to force close');
9630
9511
  } else if (isNullish(connIdx)) {
9631
9512
  me.__connections[dbName].forEach(conn => {
9632
9513
  forceClose(conn);
9633
9514
  });
9515
+ // eslint-disable-next-line unicorn/prefer-number-is-safe-integer -- Ok
9634
9516
  } else if (!Number.isInteger(connIdx) || connIdx < 0 || connIdx > me.__connections[dbName].length - 1) {
9635
9517
  throw new TypeError('If providing an argument, __forceClose must be called with a ' + 'numeric index to indicate a specific connection to close');
9636
9518
  } else {
@@ -9647,9 +9529,13 @@ IDBFactory.prototype.__setConnectionQueueOrigin = function (origin = getOrigin()
9647
9529
  connectionQueue[origin] = {};
9648
9530
  };
9649
9531
  IDBFactory.prototype[Symbol.toStringTag] = 'IDBFactoryPrototype';
9532
+
9533
+ /* eslint-disable unicorn/no-top-level-side-effects -- Would be good */
9650
9534
  Object.defineProperty(IDBFactory, 'prototype', {
9651
9535
  writable: false
9652
9536
  });
9537
+ /* eslint-enable unicorn/no-top-level-side-effects -- Would be good */
9538
+
9653
9539
  const shimIndexedDB = IDBFactory.__createInstance();
9654
9540
 
9655
9541
  /**
@@ -9700,6 +9586,7 @@ const shimIndexedDB = IDBFactory.__createInstance();
9700
9586
 
9701
9587
  /**
9702
9588
  * @class
9589
+ * @throws {TypeError}
9703
9590
  */
9704
9591
  function IDBCursor() {
9705
9592
  throw new TypeError('Illegal constructor');
@@ -9709,7 +9596,7 @@ const IDBCursorAlias = IDBCursor;
9709
9596
  /* eslint-disable func-name-matching -- API */
9710
9597
  /**
9711
9598
  * The IndexedDB Cursor Object.
9712
- * @see http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBCursor
9599
+ * @see https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#idl-def-IDBCursor
9713
9600
  * @param {IDBKeyRange} query
9714
9601
  * @param {string} direction
9715
9602
  * @param {import('./IDBObjectStore.js').IDBObjectStoreFull} store
@@ -9792,11 +9679,10 @@ IDBCursor.__createInstance = function (...args) {
9792
9679
  * @returns {void}
9793
9680
  */
9794
9681
  IDBCursor.prototype.__find = function (...args /* key, tx, success, error, recordsToLoad */) {
9682
+ const [key, primaryKey, tx, success, error, recordsToLoad] = args;
9795
9683
  if (this.__multiEntryIndex) {
9796
- const [key, primaryKey, tx, success, error, recordsToLoad] = args;
9797
9684
  this.__findMultiEntry(key, primaryKey, tx, success, error, recordsToLoad);
9798
9685
  } else {
9799
- const [key, primaryKey, tx, success, error, recordsToLoad] = args;
9800
9686
  this.__findBasic(key, primaryKey, tx, success, error, recordsToLoad);
9801
9687
  }
9802
9688
  };
@@ -9826,7 +9712,7 @@ IDBCursor.prototype.__find = function (...args /* key, tx, success, error, recor
9826
9712
  */
9827
9713
  IDBCursor.prototype.__findBasic = function (key, primaryKey, tx, success, error, recordsToLoad) {
9828
9714
  const continueCall = recordsToLoad !== undefined;
9829
- recordsToLoad = recordsToLoad || 1;
9715
+ recordsToLoad ||= 1;
9830
9716
  const me = this;
9831
9717
  const quotedKeyColumnName = sqlQuote(me.__keyColumnName);
9832
9718
  const quotedKey = sqlQuote('key');
@@ -10004,10 +9890,10 @@ IDBCursor.prototype.__findMultiEntry = function (key, primaryKey, tx, success, e
10004
9890
  const clone = {
10005
9891
  matchingKey: (/** @type {string} */
10006
9892
  encode$1(matchingKey, true)),
10007
- key: rowItem.key
9893
+ key: rowItem.key,
9894
+ [me.__keyColumnName]: rowItem[me.__keyColumnName],
9895
+ [me.__valueColumnName]: rowItem[me.__valueColumnName]
10008
9896
  };
10009
- clone[me.__keyColumnName] = rowItem[me.__keyColumnName];
10010
- clone[me.__valueColumnName] = rowItem[me.__valueColumnName];
10011
9897
  rows.push(clone);
10012
9898
  }
10013
9899
  }
@@ -10143,7 +10029,7 @@ IDBCursor.prototype.__decode = function (rowItem, callback) {
10143
10029
  if (!me.__matchedKeys) {
10144
10030
  me.__matchedKeys = {};
10145
10031
  }
10146
- if (me.__matchedKeys[rowItem.matchingKey]) {
10032
+ if (me.__matchedKeys[rowItem.matchingKey] === true) {
10147
10033
  callback(undefined, undefined, undefined);
10148
10034
  return;
10149
10035
  }
@@ -10394,6 +10280,7 @@ IDBCursor.prototype.update = function (valueToUpdate) {
10394
10280
  if (cmp(me.primaryKey, evaluatedKey) !== 0) {
10395
10281
  throw createDOMException('DataError', 'The key of the supplied value to `update` is not equal to the cursor\'s effective key');
10396
10282
  }
10283
+ // eslint-disable-next-line unicorn/prefer-hoisting-branch-code -- Different
10397
10284
  addToQueue(clonedValue);
10398
10285
  } else {
10399
10286
  const clonedValue = clone(valueToUpdate);
@@ -10443,18 +10330,23 @@ IDBCursor.prototype.delete = function () {
10443
10330
  }, undefined, me);
10444
10331
  };
10445
10332
  IDBCursor.prototype[Symbol.toStringTag] = 'IDBCursorPrototype';
10333
+
10334
+ /* eslint-disable unicorn/no-top-level-side-effects -- Would be good */
10446
10335
  defineReadonlyOuterInterface(IDBCursor.prototype, ['source', 'direction', 'key', 'primaryKey', 'request']);
10447
10336
  Object.defineProperty(IDBCursor, 'prototype', {
10448
10337
  writable: false
10449
10338
  });
10339
+ /* eslint-enable unicorn/no-top-level-side-effects -- Would be good */
10450
10340
 
10451
10341
  /**
10452
10342
  * @class
10343
+ * @throws {TypeError}
10453
10344
  */
10454
10345
  function IDBCursorWithValue() {
10455
10346
  throw new TypeError('Illegal constructor');
10456
10347
  }
10457
10348
 
10349
+ /* eslint-disable unicorn/no-top-level-side-effects -- Would be good */
10458
10350
  // @ts-expect-error It's ok
10459
10351
  IDBCursorWithValue.prototype = Object.create(IDBCursor.prototype);
10460
10352
  Object.defineProperty(IDBCursorWithValue.prototype, 'constructor', {
@@ -10463,6 +10355,8 @@ Object.defineProperty(IDBCursorWithValue.prototype, 'constructor', {
10463
10355
  configurable: true,
10464
10356
  value: IDBCursorWithValue
10465
10357
  });
10358
+ /* eslint-enable unicorn/no-top-level-side-effects -- Would be good */
10359
+
10466
10360
  const IDBCursorWithValueAlias = IDBCursorWithValue;
10467
10361
  /**
10468
10362
  *
@@ -10486,6 +10380,8 @@ IDBCursorWithValue.__createInstance = function (...args) {
10486
10380
  // @ts-expect-error It's ok
10487
10381
  return new IDBCursorWithValue();
10488
10382
  };
10383
+
10384
+ /* eslint-disable unicorn/no-top-level-side-effects -- Would be good */
10489
10385
  defineReadonlyOuterInterface(IDBCursorWithValue.prototype, ['value']);
10490
10386
  IDBCursorWithValue.prototype[Symbol.toStringTag] = 'IDBCursorWithValuePrototype';
10491
10387
  Object.defineProperty(IDBCursorWithValue, 'prototype', {
@@ -10514,7 +10410,7 @@ function setConfig(prop, val) {
10514
10410
  });
10515
10411
  return;
10516
10412
  }
10517
- if (!(prop in CFG)) {
10413
+ if (!Object.hasOwn(CFG, prop)) {
10518
10414
  throw new Error(prop + ' is not a valid configuration property');
10519
10415
  }
10520
10416
  // @ts-expect-error Should not be `never` here!
@@ -10718,7 +10614,7 @@ function setGlobalVars(idb, initialConfig) {
10718
10614
  setFS(CFG.fs);
10719
10615
  }
10720
10616
  if (CFG.fullIDLSupport) {
10721
- // Slow per MDN so off by default! Though apparently needed for WebIDL: http://stackoverflow.com/questions/41927589/rationales-consequences-of-webidl-class-inheritance-requirements
10617
+ // Slow per MDN so off by default! Though apparently needed for WebIDL: https://stackoverflow.com/questions/41927589/rationales-consequences-of-webidl-class-inheritance-requirements
10722
10618
 
10723
10619
  Object.setPrototypeOf(IDB.IDBOpenDBRequest, IDB.IDBRequest);
10724
10620
  Object.setPrototypeOf(IDB.IDBCursorWithValue, IDB.IDBCursor);
@@ -10755,7 +10651,7 @@ function setGlobalVars(idb, initialConfig) {
10755
10651
 
10756
10652
  /** @type {GetConfig} */
10757
10653
  IDB.shimIndexedDB.__getConfig = function (prop) {
10758
- if (!(prop in CFG)) {
10654
+ if (!Object.hasOwn(CFG, prop)) {
10759
10655
  throw new Error(prop + ' is not a valid configuration property');
10760
10656
  }
10761
10657
  return CFG[prop];
@@ -10787,12 +10683,12 @@ function setGlobalVars(idb, initialConfig) {
10787
10683
  // Workaround to prevent an error in Firefox
10788
10684
  if (!('indexedDB' in IDB) && typeof window !== 'undefined') {
10789
10685
  // 2nd condition avoids problems in Node
10790
- IDB.indexedDB = /** @type {IDBFactory} */IDB.indexedDB || 'webkitIndexedDB' in IDB && IDB.webkitIndexedDB || 'mozIndexedDB' in IDB && IDB.mozIndexedDB || 'oIndexedDB' in IDB && IDB.oIndexedDB || 'msIndexedDB' in IDB && IDB.msIndexedDB;
10686
+ IDB.indexedDB ||= /** @type {IDBFactory} */
10687
+ 'webkitIndexedDB' in IDB && IDB.webkitIndexedDB || 'mozIndexedDB' in IDB && IDB.mozIndexedDB || 'oIndexedDB' in IDB && IDB.oIndexedDB || 'msIndexedDB' in IDB && IDB.msIndexedDB;
10791
10688
  }
10792
10689
 
10793
10690
  // Detect browsers with known IndexedDB issues (e.g. Android pre-4.4)
10794
- let poorIndexedDbSupport = false;
10795
- if (typeof navigator !== 'undefined' &&
10691
+ const poorIndexedDbSupport = typeof navigator !== 'undefined' &&
10796
10692
  // Not apparently defined in React Native
10797
10693
  navigator.userAgent && (
10798
10694
  // Ignore Node or other environments
@@ -10800,13 +10696,11 @@ function setGlobalVars(idb, initialConfig) {
10800
10696
  /Android (?:2|3|4\.[0-3])/u.test(navigator.userAgent) && !navigator.userAgent.includes('Chrome') ||
10801
10697
  // Bad non-Safari iOS9 support (see <https://github.com/axemclion/IndexedDBShim/issues/252>)
10802
10698
  (!navigator.userAgent.includes('Safari') || navigator.userAgent.includes('Chrome')) &&
10803
- // Exclude genuine Safari: http://stackoverflow.com/a/7768006/271577
10804
- // Detect iOS: http://stackoverflow.com/questions/9038625/detect-if-device-is-ios/9039885#9039885
10805
- // and detect version 9: http://stackoverflow.com/a/26363560/271577
10699
+ // Exclude genuine Safari: https://stackoverflow.com/a/7768006/271577
10700
+ // Detect iOS: https://stackoverflow.com/questions/9038625/detect-if-device-is-ios/9039885#9039885
10701
+ // and detect version 9: https://stackoverflow.com/a/26363560/271577
10806
10702
  /(iPad|iPhone|iPod).* os 9_/ui.test(navigator.userAgent) && typeof window !== 'undefined' && !('MSStream' in window) // But avoid IE11
10807
- )) {
10808
- poorIndexedDbSupport = true;
10809
- }
10703
+ );
10810
10704
  if (!CFG.DEFAULT_DB_SIZE) {
10811
10705
  CFG.DEFAULT_DB_SIZE = (
10812
10706
  // Safari currently requires larger size: (We don't need a larger size for Node as node-websql doesn't use this info)
@@ -10819,10 +10713,12 @@ function setGlobalVars(idb, initialConfig) {
10819
10713
  if (!CFG.avoidAutoShim && (!IDB.indexedDB || poorIndexedDbSupport) && CFG.win.openDatabase !== undefined) {
10820
10714
  IDB.shimIndexedDB.__useShim();
10821
10715
  } else {
10716
+ /* eslint-disable unicorn/logical-assignment-operators -- TS */
10822
10717
  IDB.IDBDatabase = IDB.IDBDatabase || 'webkitIDBDatabase' in IDB && IDB.webkitIDBDatabase;
10823
10718
  IDB.IDBTransaction = IDB.IDBTransaction || 'webkitIDBTransaction' in IDB && IDB.webkitIDBTransaction || {};
10824
10719
  IDB.IDBCursor = IDB.IDBCursor || 'webkitIDBCursor' in IDB && IDB.webkitIDBCursor;
10825
10720
  IDB.IDBKeyRange = IDB.IDBKeyRange || 'webkitIDBKeyRange' in IDB && IDB.webkitIDBKeyRange;
10721
+ /* eslint-enable unicorn/logical-assignment-operators -- TS */
10826
10722
  }
10827
10723
  return /** @type {ShimmedObject} */IDB;
10828
10724
  }
@@ -12038,7 +11934,7 @@ CFG.win = {
12038
11934
  /**
12039
11935
  * @param {import('./setGlobalVars.js').ShimmedObject} idb
12040
11936
  * @param {import('./CFG.js').default} initialConfig
12041
- * @returns {{}|Window}
11937
+ * @returns {import('./setGlobalVars.js').ShimmedObject|Window}
12042
11938
  */
12043
11939
  const __setGlobalVars = function (idb, initialConfig = {}) {
12044
11940
  const obj = setGlobalVars(idb, {