indexeddbshim 6.6.0 → 9.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 (35) hide show
  1. package/README.md +1 -6
  2. package/badges/coverage-badge.svg +1 -1
  3. package/badges/licenses-badge-dev.svg +1 -1
  4. package/badges/tests-badge.svg +1 -1
  5. package/dist/indexeddbshim-Key.js +34 -47
  6. package/dist/indexeddbshim-Key.js.map +1 -1
  7. package/dist/indexeddbshim-Key.min.js +2 -2
  8. package/dist/indexeddbshim-Key.min.js.map +1 -1
  9. package/dist/indexeddbshim-UnicodeIdentifiers-node.js +700 -570
  10. package/dist/indexeddbshim-UnicodeIdentifiers-node.js.map +1 -1
  11. package/dist/indexeddbshim-UnicodeIdentifiers.js +735 -631
  12. package/dist/indexeddbshim-UnicodeIdentifiers.js.map +1 -1
  13. package/dist/indexeddbshim-UnicodeIdentifiers.min.js +6 -6
  14. package/dist/indexeddbshim-UnicodeIdentifiers.min.js.map +1 -1
  15. package/dist/indexeddbshim-node.js +700 -570
  16. package/dist/indexeddbshim-node.js.map +1 -1
  17. package/dist/indexeddbshim-noninvasive.js +736 -632
  18. package/dist/indexeddbshim-noninvasive.js.map +1 -1
  19. package/dist/indexeddbshim-noninvasive.min.js +6 -6
  20. package/dist/indexeddbshim-noninvasive.min.js.map +1 -1
  21. package/dist/indexeddbshim.js +735 -631
  22. package/dist/indexeddbshim.js.map +1 -1
  23. package/dist/indexeddbshim.min.js +6 -6
  24. package/dist/indexeddbshim.min.js.map +1 -1
  25. package/examples/IDBKeyUtils.html +0 -1
  26. package/index.html +5 -4
  27. package/package.json +58 -65
  28. package/src/DOMStringList.js +3 -3
  29. package/src/IDBDatabase.js +1 -1
  30. package/src/IDBObjectStore.js +3 -2
  31. package/src/IDBRequest.js +2 -2
  32. package/src/Key.js +9 -8
  33. package/src/unicode-regex.js +2 -2
  34. package/src/util.js +13 -18
  35. package/CHANGES.md +0 -1173
@@ -1,9 +1,9 @@
1
- /*! indexeddbshim - v6.6.0 - 6/26/2020 */
1
+ /*! indexeddbshim - v9.0.0 - 1/5/2022 */
2
2
 
3
3
  (function (factory) {
4
4
  typeof define === 'function' && define.amd ? define(factory) :
5
5
  factory();
6
- }((function () { 'use strict';
6
+ })((function () { 'use strict';
7
7
 
8
8
  // ID_Start (includes Other_ID_Start)
9
9
  var UnicodeIDStart = "(?:[$A-Z_a-z\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B4\\u08B6-\\u08BD\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0AF9\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58-\\u0C5A\\u0C60\\u0C61\\u0C80\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D54-\\u0D56\\u0D5F-\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F5\\u13F8-\\u13FD\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1C80-\\u1C88\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2118-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309B-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FD5\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA7AE\\uA7B0-\\uA7B7\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA8FD\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB65\\uAB70-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]|\\uD800[\\uDC00-\\uDC0B\\uDC0D-\\uDC26\\uDC28-\\uDC3A\\uDC3C\\uDC3D\\uDC3F-\\uDC4D\\uDC50-\\uDC5D\\uDC80-\\uDCFA\\uDD40-\\uDD74\\uDE80-\\uDE9C\\uDEA0-\\uDED0\\uDF00-\\uDF1F\\uDF30-\\uDF4A\\uDF50-\\uDF75\\uDF80-\\uDF9D\\uDFA0-\\uDFC3\\uDFC8-\\uDFCF\\uDFD1-\\uDFD5]|\\uD801[\\uDC00-\\uDC9D\\uDCB0-\\uDCD3\\uDCD8-\\uDCFB\\uDD00-\\uDD27\\uDD30-\\uDD63\\uDE00-\\uDF36\\uDF40-\\uDF55\\uDF60-\\uDF67]|\\uD802[\\uDC00-\\uDC05\\uDC08\\uDC0A-\\uDC35\\uDC37\\uDC38\\uDC3C\\uDC3F-\\uDC55\\uDC60-\\uDC76\\uDC80-\\uDC9E\\uDCE0-\\uDCF2\\uDCF4\\uDCF5\\uDD00-\\uDD15\\uDD20-\\uDD39\\uDD80-\\uDDB7\\uDDBE\\uDDBF\\uDE00\\uDE10-\\uDE13\\uDE15-\\uDE17\\uDE19-\\uDE33\\uDE60-\\uDE7C\\uDE80-\\uDE9C\\uDEC0-\\uDEC7\\uDEC9-\\uDEE4\\uDF00-\\uDF35\\uDF40-\\uDF55\\uDF60-\\uDF72\\uDF80-\\uDF91]|\\uD803[\\uDC00-\\uDC48\\uDC80-\\uDCB2\\uDCC0-\\uDCF2]|\\uD804[\\uDC03-\\uDC37\\uDC83-\\uDCAF\\uDCD0-\\uDCE8\\uDD03-\\uDD26\\uDD50-\\uDD72\\uDD76\\uDD83-\\uDDB2\\uDDC1-\\uDDC4\\uDDDA\\uDDDC\\uDE00-\\uDE11\\uDE13-\\uDE2B\\uDE80-\\uDE86\\uDE88\\uDE8A-\\uDE8D\\uDE8F-\\uDE9D\\uDE9F-\\uDEA8\\uDEB0-\\uDEDE\\uDF05-\\uDF0C\\uDF0F\\uDF10\\uDF13-\\uDF28\\uDF2A-\\uDF30\\uDF32\\uDF33\\uDF35-\\uDF39\\uDF3D\\uDF50\\uDF5D-\\uDF61]|\\uD805[\\uDC00-\\uDC34\\uDC47-\\uDC4A\\uDC80-\\uDCAF\\uDCC4\\uDCC5\\uDCC7\\uDD80-\\uDDAE\\uDDD8-\\uDDDB\\uDE00-\\uDE2F\\uDE44\\uDE80-\\uDEAA\\uDF00-\\uDF19]|\\uD806[\\uDCA0-\\uDCDF\\uDCFF\\uDEC0-\\uDEF8]|\\uD807[\\uDC00-\\uDC08\\uDC0A-\\uDC2E\\uDC40\\uDC72-\\uDC8F]|\\uD808[\\uDC00-\\uDF99]|\\uD809[\\uDC00-\\uDC6E\\uDC80-\\uDD43]|[\\uD80C\\uD81C-\\uD820\\uD840-\\uD868\\uD86A-\\uD86C\\uD86F-\\uD872][\\uDC00-\\uDFFF]|\\uD80D[\\uDC00-\\uDC2E]|\\uD811[\\uDC00-\\uDE46]|\\uD81A[\\uDC00-\\uDE38\\uDE40-\\uDE5E\\uDED0-\\uDEED\\uDF00-\\uDF2F\\uDF40-\\uDF43\\uDF63-\\uDF77\\uDF7D-\\uDF8F]|\\uD81B[\\uDF00-\\uDF44\\uDF50\\uDF93-\\uDF9F\\uDFE0]|\\uD821[\\uDC00-\\uDFEC]|\\uD822[\\uDC00-\\uDEF2]|\\uD82C[\\uDC00\\uDC01]|\\uD82F[\\uDC00-\\uDC6A\\uDC70-\\uDC7C\\uDC80-\\uDC88\\uDC90-\\uDC99]|\\uD835[\\uDC00-\\uDC54\\uDC56-\\uDC9C\\uDC9E\\uDC9F\\uDCA2\\uDCA5\\uDCA6\\uDCA9-\\uDCAC\\uDCAE-\\uDCB9\\uDCBB\\uDCBD-\\uDCC3\\uDCC5-\\uDD05\\uDD07-\\uDD0A\\uDD0D-\\uDD14\\uDD16-\\uDD1C\\uDD1E-\\uDD39\\uDD3B-\\uDD3E\\uDD40-\\uDD44\\uDD46\\uDD4A-\\uDD50\\uDD52-\\uDEA5\\uDEA8-\\uDEC0\\uDEC2-\\uDEDA\\uDEDC-\\uDEFA\\uDEFC-\\uDF14\\uDF16-\\uDF34\\uDF36-\\uDF4E\\uDF50-\\uDF6E\\uDF70-\\uDF88\\uDF8A-\\uDFA8\\uDFAA-\\uDFC2\\uDFC4-\\uDFCB]|\\uD83A[\\uDC00-\\uDCC4\\uDD00-\\uDD43]|\\uD83B[\\uDE00-\\uDE03\\uDE05-\\uDE1F\\uDE21\\uDE22\\uDE24\\uDE27\\uDE29-\\uDE32\\uDE34-\\uDE37\\uDE39\\uDE3B\\uDE42\\uDE47\\uDE49\\uDE4B\\uDE4D-\\uDE4F\\uDE51\\uDE52\\uDE54\\uDE57\\uDE59\\uDE5B\\uDE5D\\uDE5F\\uDE61\\uDE62\\uDE64\\uDE67-\\uDE6A\\uDE6C-\\uDE72\\uDE74-\\uDE77\\uDE79-\\uDE7C\\uDE7E\\uDE80-\\uDE89\\uDE8B-\\uDE9B\\uDEA1-\\uDEA3\\uDEA5-\\uDEA9\\uDEAB-\\uDEBB]|\\uD869[\\uDC00-\\uDED6\\uDF00-\\uDFFF]|\\uD86D[\\uDC00-\\uDF34\\uDF40-\\uDFFF]|\\uD86E[\\uDC00-\\uDC1D\\uDC20-\\uDFFF]|\\uD873[\\uDC00-\\uDEA1]|\\uD87E[\\uDC00-\\uDE1D])"; // ID_Continue (includes Other_ID_Continue)
@@ -16,20 +16,40 @@
16
16
  UnicodeIDContinue: UnicodeIDContinue
17
17
  });
18
18
 
19
- function _typeof(obj) {
20
- "@babel/helpers - typeof";
19
+ function ownKeys(object, enumerableOnly) {
20
+ var keys = Object.keys(object);
21
21
 
22
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
23
- _typeof = function (obj) {
24
- return typeof obj;
25
- };
26
- } else {
27
- _typeof = function (obj) {
28
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
29
- };
22
+ if (Object.getOwnPropertySymbols) {
23
+ var symbols = Object.getOwnPropertySymbols(object);
24
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
25
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
26
+ })), keys.push.apply(keys, symbols);
30
27
  }
31
28
 
32
- return _typeof(obj);
29
+ return keys;
30
+ }
31
+
32
+ function _objectSpread2(target) {
33
+ for (var i = 1; i < arguments.length; i++) {
34
+ var source = null != arguments[i] ? arguments[i] : {};
35
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
36
+ _defineProperty(target, key, source[key]);
37
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
38
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
39
+ });
40
+ }
41
+
42
+ return target;
43
+ }
44
+
45
+ function _typeof$1(obj) {
46
+ "@babel/helpers - typeof";
47
+
48
+ return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
49
+ return typeof obj;
50
+ } : function (obj) {
51
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
52
+ }, _typeof$1(obj);
33
53
  }
34
54
 
35
55
  function _classCallCheck(instance, Constructor) {
@@ -51,6 +71,9 @@
51
71
  function _createClass(Constructor, protoProps, staticProps) {
52
72
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
53
73
  if (staticProps) _defineProperties(Constructor, staticProps);
74
+ Object.defineProperty(Constructor, "prototype", {
75
+ writable: false
76
+ });
54
77
  return Constructor;
55
78
  }
56
79
 
@@ -92,40 +115,6 @@
92
115
  return obj;
93
116
  }
94
117
 
95
- function ownKeys(object, enumerableOnly) {
96
- var keys = Object.keys(object);
97
-
98
- if (Object.getOwnPropertySymbols) {
99
- var symbols = Object.getOwnPropertySymbols(object);
100
- if (enumerableOnly) symbols = symbols.filter(function (sym) {
101
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
102
- });
103
- keys.push.apply(keys, symbols);
104
- }
105
-
106
- return keys;
107
- }
108
-
109
- function _objectSpread2(target) {
110
- for (var i = 1; i < arguments.length; i++) {
111
- var source = arguments[i] != null ? arguments[i] : {};
112
-
113
- if (i % 2) {
114
- ownKeys(Object(source), true).forEach(function (key) {
115
- _defineProperty(target, key, source[key]);
116
- });
117
- } else if (Object.getOwnPropertyDescriptors) {
118
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
119
- } else {
120
- ownKeys(Object(source)).forEach(function (key) {
121
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
122
- });
123
- }
124
- }
125
-
126
- return target;
127
- }
128
-
129
118
  function _setPrototypeOf(o, p) {
130
119
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
131
120
  o.__proto__ = p;
@@ -141,7 +130,7 @@
141
130
  if (typeof Proxy === "function") return true;
142
131
 
143
132
  try {
144
- Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
133
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
145
134
  return true;
146
135
  } catch (e) {
147
136
  return false;
@@ -182,18 +171,21 @@
182
171
  }
183
172
 
184
173
  function _iterableToArray(iter) {
185
- if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
174
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
186
175
  }
187
176
 
188
177
  function _iterableToArrayLimit(arr, i) {
189
- if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
178
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
179
+
180
+ if (_i == null) return;
190
181
  var _arr = [];
191
182
  var _n = true;
192
183
  var _d = false;
193
- var _e = undefined;
184
+
185
+ var _s, _e;
194
186
 
195
187
  try {
196
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
188
+ for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
197
189
  _arr.push(_s.value);
198
190
 
199
191
  if (i && _arr.length === i) break;
@@ -238,9 +230,9 @@
238
230
  }
239
231
 
240
232
  function _createForOfIteratorHelper(o, allowArrayLike) {
241
- var it;
233
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
242
234
 
243
- if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
235
+ if (!it) {
244
236
  if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
245
237
  if (it) o = it;
246
238
  var i = 0;
@@ -273,7 +265,7 @@
273
265
  err;
274
266
  return {
275
267
  s: function () {
276
- it = o[Symbol.iterator]();
268
+ it = it.call(o);
277
269
  },
278
270
  n: function () {
279
271
  var step = it.next();
@@ -294,24 +286,24 @@
294
286
  };
295
287
  }
296
288
 
297
- var global$1 = typeof global$2 !== "undefined" ? global$2 : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};
298
-
299
289
  var global$2 = typeof global$1 !== "undefined" ? global$1 : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};
300
290
 
301
- function _typeof$1(obj) {
291
+ var global$1 = typeof global$2 !== "undefined" ? global$2 : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};
292
+
293
+ function _typeof(obj) {
302
294
  "@babel/helpers - typeof";
303
295
 
304
296
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
305
- _typeof$1 = function _typeof(obj) {
297
+ _typeof = function _typeof(obj) {
306
298
  return typeof obj;
307
299
  };
308
300
  } else {
309
- _typeof$1 = function _typeof(obj) {
301
+ _typeof = function _typeof(obj) {
310
302
  return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
311
303
  };
312
304
  }
313
305
 
314
- return _typeof$1(obj);
306
+ return _typeof(obj);
315
307
  }
316
308
  /* eslint-disable no-sync, no-restricted-syntax */
317
309
  // Todo: Switch to ES6 classes
@@ -323,7 +315,7 @@
323
315
  AT_TARGET: 2,
324
316
  BUBBLING_PHASE: 3
325
317
  };
326
- var ShimDOMException = typeof DOMException === 'undefined' // Todo: Better polyfill (if even needed here)
318
+ var ShimDOMException$1 = typeof DOMException === 'undefined' // Todo: Better polyfill (if even needed here)
327
319
  // eslint-disable-next-line no-shadow
328
320
  ? function DOMException(msg, name) {
329
321
  // No need for `toString` as same as for `Error`
@@ -707,7 +699,7 @@
707
699
  if (arguments.length < 2) throw new TypeError('2 or more arguments required');
708
700
 
709
701
  if (typeof type !== 'string') {
710
- throw new ShimDOMException('UNSPECIFIED_EVENT_TYPE_ERR', 'UNSPECIFIED_EVENT_TYPE_ERR');
702
+ throw new ShimDOMException$1('UNSPECIFIED_EVENT_TYPE_ERR', 'UNSPECIFIED_EVENT_TYPE_ERR');
711
703
  }
712
704
 
713
705
  try {
@@ -768,7 +760,7 @@
768
760
  var _evCfg = evCfg.get(e);
769
761
 
770
762
  if (_evCfg && setTarget && _evCfg._dispatched) {
771
- throw new ShimDOMException('The object is in an invalid state.', 'InvalidStateError');
763
+ throw new ShimDOMException$1('The object is in an invalid state.', 'InvalidStateError');
772
764
  }
773
765
 
774
766
  var eventCopy;
@@ -1010,7 +1002,7 @@
1010
1002
  var triggerGlobalErrorEvent;
1011
1003
  var useNodeImpl = false;
1012
1004
 
1013
- if (typeof window === 'undefined' || typeof ErrorEvent === 'undefined' || window && (typeof window === "undefined" ? "undefined" : _typeof$1(window)) === 'object' && !window.dispatchEvent) {
1005
+ if (typeof window === 'undefined' || typeof ErrorEvent === 'undefined' || window && (typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object' && !window.dispatchEvent) {
1014
1006
  useNodeImpl = true;
1015
1007
 
1016
1008
  triggerGlobalErrorEvent = function triggerGlobalErrorEvent() {
@@ -1079,7 +1071,7 @@
1079
1071
  };
1080
1072
  EventTarget.ShimEvent = ShimEvent;
1081
1073
  EventTarget.ShimCustomEvent = ShimCustomEvent;
1082
- EventTarget.ShimDOMException = ShimDOMException;
1074
+ EventTarget.ShimDOMException = ShimDOMException$1;
1083
1075
  EventTarget.ShimEventTarget = EventTarget;
1084
1076
  EventTarget.EventTargetFactory = EventTargetFactory;
1085
1077
  /**
@@ -1092,7 +1084,7 @@
1092
1084
  Object.setPrototypeOf(ShimCustomEvent.prototype, ShimEvent.prototype);
1093
1085
  } // Todo: Move to own library (but allowing WeakMaps to be passed in for sharing here)
1094
1086
 
1095
- var map = {};
1087
+ var map$1 = {};
1096
1088
  var CFG = {};
1097
1089
  [// Boolean for verbose reporting
1098
1090
  'DEBUG', // Effectively defaults to false (ignored unless `true`)
@@ -1178,7 +1170,7 @@
1178
1170
  // defaults to `true`
1179
1171
  'addSQLiteExtension', // Various types of in-memory databases that can auto-delete
1180
1172
  ['memoryDatabase', function (val) {
1181
- if (!/^(?::memory:|file::memory:(\?(?:[\0-"\$-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?(#(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?)?$/.test(val)) {
1173
+ if (!/^(?::memory:|file::memory:(\?(?:(?!#)[\s\S])*)?(#(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?)?$/.test(val)) {
1182
1174
  throw new TypeError('`memoryDatabase` must be the empty string, ":memory:", or a ' + '"file::memory:[?queryString][#hash] URL".');
1183
1175
  }
1184
1176
  }], // NODE-SPECIFIC CONFIG
@@ -1202,30 +1194,30 @@
1202
1194
 
1203
1195
  Object.defineProperty(CFG, prop, {
1204
1196
  get: function get() {
1205
- return map[prop];
1197
+ return map$1[prop];
1206
1198
  },
1207
1199
  set: function set(val) {
1208
1200
  if (validator) {
1209
1201
  validator(val);
1210
1202
  }
1211
1203
 
1212
- map[prop] = val;
1204
+ map$1[prop] = val;
1213
1205
  }
1214
1206
  });
1215
1207
  });
1216
1208
 
1217
- var regex = /[\xC0-\xC5\xC7-\xCF\xD1-\xD6\xD9-\xDD\xE0-\xE5\xE7-\xEF\xF1-\xF6\xF9-\xFD\xFF-\u010F\u0112-\u0125\u0128-\u0130\u0134-\u0137\u0139-\u013E\u0143-\u0148\u014C-\u0151\u0154-\u0165\u0168-\u017E\u01A0\u01A1\u01AF\u01B0\u01CD-\u01DC\u01DE-\u01E3\u01E6-\u01F0\u01F4\u01F5\u01F8-\u021B\u021E\u021F\u0226-\u0233\u0344\u0385\u0386\u0388-\u038A\u038C\u038E-\u0390\u03AA-\u03B0\u03CA-\u03CE\u03D3\u03D4\u0400\u0401\u0403\u0407\u040C-\u040E\u0419\u0439\u0450\u0451\u0453\u0457\u045C-\u045E\u0476\u0477\u04C1\u04C2\u04D0-\u04D3\u04D6\u04D7\u04DA-\u04DF\u04E2-\u04E7\u04EA-\u04F5\u04F8\u04F9\u0622-\u0626\u06C0\u06C2\u06D3\u0929\u0931\u0934\u0958-\u095F\u09CB\u09CC\u09DC\u09DD\u09DF\u0A33\u0A36\u0A59-\u0A5B\u0A5E\u0B48\u0B4B\u0B4C\u0B5C\u0B5D\u0B94\u0BCA-\u0BCC\u0C48\u0CC0\u0CC7\u0CC8\u0CCA\u0CCB\u0D4A-\u0D4C\u0DDA\u0DDC-\u0DDE\u0F43\u0F4D\u0F52\u0F57\u0F5C\u0F69\u0F73\u0F75\u0F76\u0F78\u0F81\u0F93\u0F9D\u0FA2\u0FA7\u0FAC\u0FB9\u1026\u1B06\u1B08\u1B0A\u1B0C\u1B0E\u1B12\u1B3B\u1B3D\u1B40\u1B41\u1B43\u1E00-\u1E99\u1E9B\u1EA0-\u1EF9\u1F00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FC1-\u1FC4\u1FC6-\u1FD3\u1FD6-\u1FDB\u1FDD-\u1FEE\u1FF2-\u1FF4\u1FF6-\u1FFC\u212B\u219A\u219B\u21AE\u21CD-\u21CF\u2204\u2209\u220C\u2224\u2226\u2241\u2244\u2247\u2249\u2260\u2262\u226D-\u2271\u2274\u2275\u2278\u2279\u2280\u2281\u2284\u2285\u2288\u2289\u22AC-\u22AF\u22E0-\u22E3\u22EA-\u22ED\u2ADC\u304C\u304E\u3050\u3052\u3054\u3056\u3058\u305A\u305C\u305E\u3060\u3062\u3065\u3067\u3069\u3070\u3071\u3073\u3074\u3076\u3077\u3079\u307A\u307C\u307D\u3094\u309E\u30AC\u30AE\u30B0\u30B2\u30B4\u30B6\u30B8\u30BA\u30BC\u30BE\u30C0\u30C2\u30C5\u30C7\u30C9\u30D0\u30D1\u30D3\u30D4\u30D6\u30D7\u30D9\u30DA\u30DC\u30DD\u30F4\u30F7-\u30FA\u30FE\uAC00-\uD7A3\uFB1D\uFB1F\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFB4E]|\uD804[\uDC9A\uDC9C\uDCAB\uDD2E\uDD2F\uDF4B\uDF4C]|\uD805[\uDCBB\uDCBC\uDCBE\uDDBA\uDDBB]|\uD834[\uDD5E-\uDD64\uDDBB-\uDDC0]/;
1209
+ var regex = /[\xC0-\xC5\xC7-\xCF\xD1-\xD6\xD9-\xDD\xE0-\xE5\xE7-\xEF\xF1-\xF6\xF9-\xFD\xFF-\u010F\u0112-\u0125\u0128-\u0130\u0134-\u0137\u0139-\u013E\u0143-\u0148\u014C-\u0151\u0154-\u0165\u0168-\u017E\u01A0\u01A1\u01AF\u01B0\u01CD-\u01DC\u01DE-\u01E3\u01E6-\u01F0\u01F4\u01F5\u01F8-\u021B\u021E\u021F\u0226-\u0233\u0344\u0385\u0386\u0388-\u038A\u038C\u038E-\u0390\u03AA-\u03B0\u03CA-\u03CE\u03D3\u03D4\u0400\u0401\u0403\u0407\u040C-\u040E\u0419\u0439\u0450\u0451\u0453\u0457\u045C-\u045E\u0476\u0477\u04C1\u04C2\u04D0-\u04D3\u04D6\u04D7\u04DA-\u04DF\u04E2-\u04E7\u04EA-\u04F5\u04F8\u04F9\u0622-\u0626\u06C0\u06C2\u06D3\u0929\u0931\u0934\u0958-\u095F\u09CB\u09CC\u09DC\u09DD\u09DF\u0A33\u0A36\u0A59-\u0A5B\u0A5E\u0B48\u0B4B\u0B4C\u0B5C\u0B5D\u0B94\u0BCA-\u0BCC\u0C48\u0CC0\u0CC7\u0CC8\u0CCA\u0CCB\u0D4A-\u0D4C\u0DDA\u0DDC-\u0DDE\u0F43\u0F4D\u0F52\u0F57\u0F5C\u0F69\u0F73\u0F75\u0F76\u0F78\u0F81\u0F93\u0F9D\u0FA2\u0FA7\u0FAC\u0FB9\u1026\u1B06\u1B08\u1B0A\u1B0C\u1B0E\u1B12\u1B3B\u1B3D\u1B40\u1B41\u1B43\u1E00-\u1E99\u1E9B\u1EA0-\u1EF9\u1F00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FC1-\u1FC4\u1FC6-\u1FD3\u1FD6-\u1FDB\u1FDD-\u1FEE\u1FF2-\u1FF4\u1FF6-\u1FFC\u212B\u219A\u219B\u21AE\u21CD-\u21CF\u2204\u2209\u220C\u2224\u2226\u2241\u2244\u2247\u2249\u2260\u2262\u226D-\u2271\u2274\u2275\u2278\u2279\u2280\u2281\u2284\u2285\u2288\u2289\u22AC-\u22AF\u22E0-\u22E3\u22EA-\u22ED\u2ADC\u304C\u304E\u3050\u3052\u3054\u3056\u3058\u305A\u305C\u305E\u3060\u3062\u3065\u3067\u3069\u3070\u3071\u3073\u3074\u3076\u3077\u3079\u307A\u307C\u307D\u3094\u309E\u30AC\u30AE\u30B0\u30B2\u30B4\u30B6\u30B8\u30BA\u30BC\u30BE\u30C0\u30C2\u30C5\u30C7\u30C9\u30D0\u30D1\u30D3\u30D4\u30D6\u30D7\u30D9\u30DA\u30DC\u30DD\u30F4\u30F7-\u30FA\u30FE\uAC00-\uD7A3\uFB1D\uFB1F\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFB4E]|\uD804[\uDC9A\uDC9C\uDCAB\uDD2E\uDD2F\uDF4B\uDF4C]|\uD805[\uDCBB\uDCBC\uDCBE\uDDBA\uDDBB]|\uD806\uDD38|\uD834[\uDD5E-\uDD64\uDDBB-\uDDC0]/;
1218
1210
 
1219
1211
  function escapeUnmatchedSurrogates(arg) {
1220
1212
  // http://stackoverflow.com/a/6701665/271577
1221
- return arg.replace(/((?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])))(?!(?:(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]))|(^|(?:[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]))((?:(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]))/g, function (_, unmatchedHighSurrogate, precedingLow, unmatchedLowSurrogate) {
1213
+ return arg.replace(/((?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])))(?!(?:(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]))|(^|(?:(?![\uD800-\uDBFF](?![\uDC00-\uDFFF]))[\s\S]))((?:(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]))/g, function (_, unmatchedHighSurrogate, precedingLow, unmatchedLowSurrogate) {
1222
1214
  // Could add a corresponding surrogate for compatibility with `node-sqlite3`: http://bugs.python.org/issue12569 and http://stackoverflow.com/a/6701665/271577
1223
1215
  // but Chrome having problems
1224
1216
  if (unmatchedHighSurrogate) {
1225
- return '^2' + padStart(unmatchedHighSurrogate.charCodeAt().toString(16), 4, '0');
1217
+ return '^2' + unmatchedHighSurrogate.codePointAt().toString(16).padStart(4, '0');
1226
1218
  }
1227
1219
 
1228
- return (precedingLow || '') + '^3' + padStart(unmatchedLowSurrogate.charCodeAt().toString(16), 4, '0');
1220
+ return (precedingLow || '') + '^3' + unmatchedLowSurrogate.codePointAt().toString(16).padStart(4, '0');
1229
1221
  });
1230
1222
  }
1231
1223
 
@@ -1277,18 +1269,16 @@
1277
1269
 
1278
1270
  if (CFG.escapeNFDForDatabaseNames !== false) {
1279
1271
  // ES6 copying of regex with different flags
1280
- // Todo: Remove `.source` when
1281
- // https://github.com/babel/babel/issues/5978 completed (see also
1282
- // https://github.com/axemclion/IndexedDBShim/issues/311#issuecomment-316090147 )
1283
- db = db.replace(new RegExp(regex.source, 'gu'), function (expandable) {
1284
- return '^4' + padStart(expandable.codePointAt().toString(16), 6, '0');
1272
+ db = db.replace(new RegExp(regex, 'gu'), function (expandable) {
1273
+ return '^4' + expandable.codePointAt().toString(16).padStart(6, '0');
1285
1274
  });
1286
1275
  }
1287
1276
 
1288
1277
  if (CFG.databaseCharacterEscapeList !== false) {
1289
1278
  db = db.replace(CFG.databaseCharacterEscapeList ? new RegExp(CFG.databaseCharacterEscapeList, 'gu') : /[\0-\x1F"\*\/:<>\?\\\|\x7F]/g, // eslint-disable-line no-control-regex
1290
1279
  function (n0) {
1291
- return '^1' + padStart(n0.charCodeAt().toString(16), 2, '0');
1280
+ // eslint-disable-next-line unicorn/prefer-code-point -- Switch to `codePointAt`?
1281
+ return '^1' + n0.charCodeAt().toString(16).padStart(2, '0');
1292
1282
  });
1293
1283
  }
1294
1284
 
@@ -1303,9 +1293,9 @@
1303
1293
 
1304
1294
  function unescapeUnmatchedSurrogates(arg) {
1305
1295
  return arg.replace(/(\^+)3(d[0-9a-f]{3})/g, function (_, esc, lowSurr) {
1306
- return esc.length % 2 ? esc.slice(1) + String.fromCharCode(Number.parseInt(lowSurr, 16)) : _;
1296
+ return esc.length % 2 ? esc.slice(1) + String.fromCodePoint(Number.parseInt(lowSurr, 16)) : _;
1307
1297
  }).replace(/(\^+)2(d[0-9a-f]{3})/g, function (_, esc, highSurr) {
1308
- return esc.length % 2 ? esc.slice(1) + String.fromCharCode(Number.parseInt(highSurr, 16)) : _;
1298
+ return esc.length % 2 ? esc.slice(1) + String.fromCodePoint(Number.parseInt(highSurr, 16)) : _;
1309
1299
  });
1310
1300
  } // Not in use internally but supplied for convenience
1311
1301
 
@@ -1332,7 +1322,7 @@
1332
1322
  }
1333
1323
 
1334
1324
  function isObj(obj) {
1335
- return obj && _typeof(obj) === 'object';
1325
+ return obj && _typeof$1(obj) === 'object';
1336
1326
  }
1337
1327
 
1338
1328
  function isDate(obj) {
@@ -1520,12 +1510,7 @@
1520
1510
  }
1521
1511
 
1522
1512
  function hasOwn(obj, prop) {
1523
- return {}.hasOwnProperty.call(obj, prop);
1524
- } // Todo: Replace with `String.prototype.padStart` when targeting supporting Node version
1525
-
1526
-
1527
- function padStart(str, ct, fill) {
1528
- return new Array(ct - String(str).length + 1).join(fill) + str;
1513
+ return Object.prototype.hasOwnProperty.call(obj, prop);
1529
1514
  }
1530
1515
 
1531
1516
  /**
@@ -1549,7 +1534,7 @@
1549
1534
  }
1550
1535
  });
1551
1536
 
1552
- var readonlyProperties = ['oldVersion', 'newVersion']; // Babel apparently having a problem adding `hasInstance` to a class, so we are redefining as a function
1537
+ var readonlyProperties$6 = ['oldVersion', 'newVersion']; // Babel apparently having a problem adding `hasInstance` to a class, so we are redefining as a function
1553
1538
 
1554
1539
  function IDBVersionChangeEvent(type
1555
1540
  /* , eventInitDict */
@@ -1568,7 +1553,7 @@
1568
1553
 
1569
1554
  IDBVersionChangeEvent.prototype = Object.create(ShimEvent.prototype);
1570
1555
  IDBVersionChangeEvent.prototype[Symbol.toStringTag] = 'IDBVersionChangeEventPrototype';
1571
- readonlyProperties.forEach(function (prop) {
1556
+ readonlyProperties$6.forEach(function (prop) {
1572
1557
  var _o, _mutatorMap;
1573
1558
 
1574
1559
  // Ensure for proper interface testing that "get <name>" is the function name
@@ -1812,7 +1797,7 @@
1812
1797
  }
1813
1798
 
1814
1799
  function isErrorOrDOMErrorOrDOMException(obj) {
1815
- return obj && _typeof(obj) === 'object' && // We don't use util.isObj here as mutual dependency causing problems in Babel with browser
1800
+ return obj && _typeof$1(obj) === 'object' && // We don't use util.isObj here as mutual dependency causing problems in Babel with browser
1816
1801
  typeof obj.name === 'string';
1817
1802
  }
1818
1803
  /**
@@ -1918,10 +1903,10 @@
1918
1903
  logError(name, message, error);
1919
1904
  return createNonNativeDOMException(name, message);
1920
1905
  };
1921
- var ShimDOMException$1 = useNativeDOMException ? DOMException : ShimNonNativeDOMException;
1906
+ var ShimDOMException = useNativeDOMException ? DOMException : ShimNonNativeDOMException;
1922
1907
 
1923
- var listeners = ['onsuccess', 'onerror'];
1924
- var readonlyProperties$1 = ['source', 'transaction', 'readyState'];
1908
+ var listeners$2 = ['onsuccess', 'onerror'];
1909
+ var readonlyProperties$5 = ['source', 'transaction', 'readyState'];
1925
1910
  var doneFlagGetters = ['result', 'error'];
1926
1911
  /**
1927
1912
  * The IDBRequest Object that is returns for all async calls.
@@ -1935,6 +1920,8 @@
1935
1920
 
1936
1921
 
1937
1922
  IDBRequest.__super = function IDBRequest() {
1923
+ var _this = this;
1924
+
1938
1925
  this[Symbol.toStringTag] = 'IDBRequest';
1939
1926
 
1940
1927
  this.__setOptions({
@@ -1943,12 +1930,12 @@
1943
1930
  });
1944
1931
 
1945
1932
  doneFlagGetters.forEach(function (prop) {
1946
- Object.defineProperty(this, '__' + prop, {
1933
+ Object.defineProperty(_this, '__' + prop, {
1947
1934
  enumerable: false,
1948
1935
  configurable: false,
1949
1936
  writable: true
1950
1937
  });
1951
- Object.defineProperty(this, prop, {
1938
+ Object.defineProperty(_this, prop, {
1952
1939
  enumerable: true,
1953
1940
  configurable: true,
1954
1941
  get: function get() {
@@ -1959,8 +1946,8 @@
1959
1946
  return this['__' + prop];
1960
1947
  }
1961
1948
  });
1962
- }, this);
1963
- defineReadonlyProperties(this, readonlyProperties$1, {
1949
+ });
1950
+ defineReadonlyProperties(this, readonlyProperties$5, {
1964
1951
  readyState: {
1965
1952
  get readyState() {
1966
1953
  return this.__done ? 'done' : 'pending';
@@ -1968,7 +1955,7 @@
1968
1955
 
1969
1956
  }
1970
1957
  });
1971
- defineListenerProperties(this, listeners);
1958
+ defineListenerProperties(this, listeners$2);
1972
1959
  this.__result = undefined;
1973
1960
  this.__error = this.__source = this.__transaction = null;
1974
1961
  this.__done = false;
@@ -1992,9 +1979,9 @@
1992
1979
  }; // Illegal invocations
1993
1980
 
1994
1981
 
1995
- defineReadonlyOuterInterface(IDBRequest.prototype, readonlyProperties$1);
1982
+ defineReadonlyOuterInterface(IDBRequest.prototype, readonlyProperties$5);
1996
1983
  defineReadonlyOuterInterface(IDBRequest.prototype, doneFlagGetters);
1997
- defineOuterInterface(IDBRequest.prototype, listeners);
1984
+ defineOuterInterface(IDBRequest.prototype, listeners$2);
1998
1985
  Object.defineProperty(IDBRequest.prototype, 'constructor', {
1999
1986
  enumerable: false,
2000
1987
  writable: true,
@@ -2050,9 +2037,11 @@
2050
2037
  writable: false
2051
2038
  });
2052
2039
 
2053
- // Since [immediate](https://github.com/calvinmetcalf/immediate) is
2040
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
2041
+
2054
2042
  // not doing the trick for our WebSQL transactions (at least in Node),
2055
2043
  // we are forced to make the promises run fully synchronously.
2044
+
2056
2045
  function isPromise(p) {
2057
2046
  return p && typeof p.then === 'function';
2058
2047
  }
@@ -2236,12 +2225,12 @@
2236
2225
  var decodedKey1 = _decode(encodedKey1);
2237
2226
  var decodedKey2 = _decode(encodedKey2);
2238
2227
 
2239
- if (_typeof(first) === 'object') {
2228
+ if (_typeof$1(first) === 'object') {
2240
2229
  first = JSON.stringify(first);
2241
2230
  decodedKey1 = JSON.stringify(decodedKey1);
2242
2231
  }
2243
2232
 
2244
- if (_typeof(second) === 'object') {
2233
+ if (_typeof$1(second) === 'object') {
2245
2234
  second = JSON.stringify(second);
2246
2235
  decodedKey2 = JSON.stringify(decodedKey2);
2247
2236
  } // Encoding/decoding mismatches are usually due to a loss of
@@ -2279,7 +2268,7 @@
2279
2268
  };
2280
2269
  var keyTypes = Object.keys(keyTypeToEncodedChar);
2281
2270
  keyTypes.forEach(function (k) {
2282
- keyTypeToEncodedChar[k] = String.fromCharCode(keyTypeToEncodedChar[k]);
2271
+ keyTypeToEncodedChar[k] = String.fromCodePoint(keyTypeToEncodedChar[k]);
2283
2272
  });
2284
2273
  var encodedCharToKeyType = keyTypes.reduce(function (o, k) {
2285
2274
  o[keyTypeToEncodedChar[k]] = k;
@@ -2329,7 +2318,7 @@
2329
2318
 
2330
2319
  key32 = decimalIndex !== -1 ? key32.replace('.', '') : key32; // Get the index of the first significant digit.
2331
2320
 
2332
- var significantDigitIndex = key32.search(/(?:[\0-\/1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/); // Truncate leading zeros.
2321
+ var significantDigitIndex = key32.search(/(?:(?!0)[\s\S])/); // Truncate leading zeros.
2333
2322
 
2334
2323
  key32 = key32.slice(significantDigitIndex);
2335
2324
  var sign, exponent, mantissa; // Finite cases:
@@ -2377,10 +2366,10 @@
2377
2366
 
2378
2367
  switch (signValues[sign]) {
2379
2368
  case 'negativeInfinity':
2380
- return -Infinity;
2369
+ return Number.NEGATIVE_INFINITY;
2381
2370
 
2382
2371
  case 'positiveInfinity':
2383
- return Infinity;
2372
+ return Number.POSITIVE_INFINITY;
2384
2373
 
2385
2374
  case 'bigPositive':
2386
2375
  return pow32(mantissa, exponent);
@@ -2492,7 +2481,7 @@
2492
2481
  // `ArrayBuffer`/Views on buffers (`TypedArray` or `DataView`)
2493
2482
  encode: function encode(key) {
2494
2483
  return keyTypeToEncodedChar.binary + '-' + (key.byteLength ? _toConsumableArray(getCopyBytesHeldByBufferSource(key)).map(function (b) {
2495
- return padStart(b, 3, '0');
2484
+ return String(b).padStart(3, '0');
2496
2485
  }) // e.g., '255,005,254,000,001,033'
2497
2486
  : '');
2498
2487
  },
@@ -2589,13 +2578,13 @@
2589
2578
  }
2590
2579
  /**
2591
2580
  * @param {Float} num
2592
- * @param {Float} precision
2581
+ * @param {Float} [precision=16]
2593
2582
  * @returns {Float}
2594
2583
  */
2595
2584
 
2596
2585
 
2597
- function roundToPrecision(num, precision) {
2598
- precision = precision || 16;
2586
+ function roundToPrecision(num) {
2587
+ var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 16;
2599
2588
  return Number.parseFloat(num.toPrecision(precision));
2600
2589
  }
2601
2590
  /**
@@ -2633,7 +2622,7 @@
2633
2622
  if (isDate(key)) return 'date';
2634
2623
  if (isBinary(key)) return 'binary';
2635
2624
 
2636
- var keyType = _typeof(key);
2625
+ var keyType = _typeof$1(key);
2637
2626
 
2638
2627
  return ['string', 'number'].includes(keyType) ? keyType : 'invalid';
2639
2628
  }
@@ -2807,13 +2796,8 @@
2807
2796
  }
2808
2797
  }();
2809
2798
 
2810
- switch (_ret) {
2811
- case "continue":
2812
- continue;
2813
-
2814
- default:
2815
- if (_typeof(_ret) === "object") return _ret.v;
2816
- }
2799
+ if (_ret === "continue") continue;
2800
+ if (_typeof$1(_ret) === "object") return _ret.v;
2817
2801
  } catch (err) {
2818
2802
  if (!multiEntry) {
2819
2803
  throw err;
@@ -2851,7 +2835,7 @@
2851
2835
  {
2852
2836
  // Other `typeof` types which are not valid keys:
2853
2837
  // 'undefined', 'boolean', 'object' (including `null`), 'symbol', 'function
2854
- var _type = input === null ? 'null' : _typeof(input); // Convert `null` for convenience of consumers in reporting errors
2838
+ var _type = input === null ? 'null' : _typeof$1(input); // Convert `null` for convenience of consumers in reporting errors
2855
2839
 
2856
2840
 
2857
2841
  return {
@@ -3408,7 +3392,7 @@
3408
3392
  getCurrentNumber(tx, store, function (key) {
3409
3393
  if (key > MAX_ALLOWED_CURRENT_NUMBER) {
3410
3394
  // 2 ^ 53 (See <https://github.com/w3c/IndexedDB/issues/147>)
3411
- cb('failure'); // eslint-disable-line standard/no-callback-literal
3395
+ cb('failure'); // eslint-disable-line node/no-callback-literal
3412
3396
 
3413
3397
  return;
3414
3398
  } // Increment current number by 1 (we cannot leverage SQLite's
@@ -3489,7 +3473,7 @@
3489
3473
  possiblyUpdateKeyGenerator: possiblyUpdateKeyGenerator
3490
3474
  });
3491
3475
 
3492
- var readonlyProperties$2 = ['lower', 'upper', 'lowerOpen', 'upperOpen'];
3476
+ var readonlyProperties$4 = ['lower', 'upper', 'lowerOpen', 'upperOpen'];
3493
3477
  /* eslint-disable jsdoc/check-param-names */
3494
3478
 
3495
3479
  /**
@@ -3604,7 +3588,7 @@
3604
3588
  };
3605
3589
 
3606
3590
  IDBKeyRange.prototype[Symbol.toStringTag] = 'IDBKeyRangePrototype';
3607
- readonlyProperties$2.forEach(function (prop) {
3591
+ readonlyProperties$4.forEach(function (prop) {
3608
3592
  var _o, _mutatorMap;
3609
3593
 
3610
3594
  Object.defineProperty(IDBKeyRange.prototype, '__' + prop, {
@@ -3766,11 +3750,11 @@
3766
3750
  return this._items;
3767
3751
  },
3768
3752
  forEach: function forEach(cb, thisArg) {
3769
- // eslint-disable-next-line unicorn/no-fn-reference-in-iterator
3753
+ // eslint-disable-next-line unicorn/no-array-callback-reference, unicorn/no-array-method-this-argument
3770
3754
  this._items.forEach(cb, thisArg);
3771
3755
  },
3772
3756
  map: function map(cb, thisArg) {
3773
- // eslint-disable-next-line unicorn/no-fn-reference-in-iterator
3757
+ // eslint-disable-next-line unicorn/no-array-callback-reference, unicorn/no-array-method-this-argument
3774
3758
  return this._items.map(cb, thisArg);
3775
3759
  },
3776
3760
  indexOf: function indexOf(str) {
@@ -3782,9 +3766,7 @@
3782
3766
  this._length++;
3783
3767
  this.sortList();
3784
3768
  },
3785
- splice: function splice()
3786
- /* index, howmany, item1, ..., itemX */
3787
- {
3769
+ splice: function splice() {
3788
3770
  var _this$_items;
3789
3771
 
3790
3772
  (_this$_items = this._items).splice.apply(_this$_items, arguments);
@@ -3829,7 +3811,7 @@
3829
3811
  })), _DOMStringList$protot);
3830
3812
  Object.defineProperty(DOMStringList, Symbol.hasInstance, {
3831
3813
  value: function value(obj) {
3832
- return {}.toString.call(obj) === 'DOMStringListPrototype';
3814
+ return Object.prototype.toString.call(obj) === 'DOMStringListPrototype';
3833
3815
  }
3834
3816
  });
3835
3817
  var DOMStringListAlias = DOMStringList;
@@ -4003,9 +3985,7 @@
4003
3985
  executeNextRequest();
4004
3986
  }
4005
3987
 
4006
- function error()
4007
- /* tx, err */
4008
- {
3988
+ function error() {
4009
3989
  if (me.__errored || me.__requestsFinished) {
4010
3990
  // We've already called "onerror", "onabort", or thrown within
4011
3991
  // the transaction, so don't do it again.
@@ -4331,8 +4311,8 @@
4331
4311
  // Store was already created so we restore to name before the rename
4332
4312
  if ('__pendingName' in store && me.db.__oldObjectStoreNames.indexOf(store.__pendingName) > -1 // eslint-disable-line unicorn/prefer-includes
4333
4313
  ) {
4334
- store.__name = store.__originalName;
4335
- }
4314
+ store.__name = store.__originalName;
4315
+ }
4336
4316
 
4337
4317
  store.__indexNames = store.__oldIndexNames;
4338
4318
  delete store.__pendingDelete;
@@ -4340,8 +4320,8 @@
4340
4320
  // Index was already created so we restore to name before the rename
4341
4321
  if ('__pendingName' in index && store.__oldIndexNames.indexOf(index.__pendingName) > -1 // eslint-disable-line unicorn/prefer-includes
4342
4322
  ) {
4343
- index.__name = index.__originalName;
4344
- }
4323
+ index.__name = index.__originalName;
4324
+ }
4345
4325
 
4346
4326
  delete index.__pendingDelete;
4347
4327
  });
@@ -4523,75 +4503,27 @@
4523
4503
  writable: false
4524
4504
  });
4525
4505
 
4526
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
4527
-
4528
- function createCommonjsModule(fn, basedir, module) {
4529
- return module = {
4530
- path: basedir,
4531
- exports: {},
4532
- require: function (path, base) {
4533
- return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
4534
- }
4535
- }, fn(module, module.exports), module.exports;
4536
- }
4537
-
4538
- function commonjsRequire () {
4539
- throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
4540
- }
4506
+ var typeson$1 = {exports: {}};
4541
4507
 
4542
- var typeson = createCommonjsModule(function (module, exports) {
4508
+ (function (module, exports) {
4543
4509
  (function (global, factory) {
4544
- module.exports = factory() ;
4510
+ module.exports = factory() ;
4545
4511
  })(commonjsGlobal, function () {
4546
4512
 
4547
- function _typeof$1(obj) {
4548
- if (typeof Symbol === "function" && _typeof(Symbol.iterator) === "symbol") {
4549
- _typeof$1 = function _typeof$1(obj) {
4550
- return _typeof(obj);
4513
+ function _typeof(obj) {
4514
+ "@babel/helpers - typeof";
4515
+
4516
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
4517
+ _typeof = function _typeof(obj) {
4518
+ return typeof obj;
4551
4519
  };
4552
4520
  } else {
4553
- _typeof$1 = function _typeof$1(obj) {
4554
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof(obj);
4521
+ _typeof = function _typeof(obj) {
4522
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
4555
4523
  };
4556
4524
  }
4557
4525
 
4558
- return _typeof$1(obj);
4559
- }
4560
-
4561
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
4562
- try {
4563
- var info = gen[key](arg);
4564
- var value = info.value;
4565
- } catch (error) {
4566
- reject(error);
4567
- return;
4568
- }
4569
-
4570
- if (info.done) {
4571
- resolve(value);
4572
- } else {
4573
- Promise.resolve(value).then(_next, _throw);
4574
- }
4575
- }
4576
-
4577
- function _asyncToGenerator(fn) {
4578
- return function () {
4579
- var self = this,
4580
- args = arguments;
4581
- return new Promise(function (resolve, reject) {
4582
- var gen = fn.apply(self, args);
4583
-
4584
- function _next(value) {
4585
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
4586
- }
4587
-
4588
- function _throw(err) {
4589
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
4590
- }
4591
-
4592
- _next(undefined);
4593
- });
4594
- };
4526
+ return _typeof(obj);
4595
4527
  }
4596
4528
 
4597
4529
  function _classCallCheck(instance, Constructor) {
@@ -4666,21 +4598,15 @@
4666
4598
  }
4667
4599
 
4668
4600
  function _slicedToArray(arr, i) {
4669
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
4601
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
4670
4602
  }
4671
4603
 
4672
4604
  function _toConsumableArray(arr) {
4673
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
4605
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
4674
4606
  }
4675
4607
 
4676
4608
  function _arrayWithoutHoles(arr) {
4677
- if (Array.isArray(arr)) {
4678
- for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
4679
- arr2[i] = arr[i];
4680
- }
4681
-
4682
- return arr2;
4683
- }
4609
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
4684
4610
  }
4685
4611
 
4686
4612
  function _arrayWithHoles(arr) {
@@ -4688,14 +4614,11 @@
4688
4614
  }
4689
4615
 
4690
4616
  function _iterableToArray(iter) {
4691
- if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
4617
+ if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
4692
4618
  }
4693
4619
 
4694
4620
  function _iterableToArrayLimit(arr, i) {
4695
- if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
4696
- return;
4697
- }
4698
-
4621
+ if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
4699
4622
  var _arr = [];
4700
4623
  var _n = true;
4701
4624
  var _d = false;
@@ -4721,30 +4644,84 @@
4721
4644
  return _arr;
4722
4645
  }
4723
4646
 
4647
+ function _unsupportedIterableToArray(o, minLen) {
4648
+ if (!o) return;
4649
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
4650
+ var n = Object.prototype.toString.call(o).slice(8, -1);
4651
+ if (n === "Object" && o.constructor) n = o.constructor.name;
4652
+ if (n === "Map" || n === "Set") return Array.from(o);
4653
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
4654
+ }
4655
+
4656
+ function _arrayLikeToArray(arr, len) {
4657
+ if (len == null || len > arr.length) len = arr.length;
4658
+
4659
+ for (var i = 0, arr2 = new Array(len); i < len; i++) {
4660
+ arr2[i] = arr[i];
4661
+ }
4662
+
4663
+ return arr2;
4664
+ }
4665
+
4724
4666
  function _nonIterableSpread() {
4725
- throw new TypeError("Invalid attempt to spread non-iterable instance");
4667
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
4726
4668
  }
4727
4669
 
4728
4670
  function _nonIterableRest() {
4729
- throw new TypeError("Invalid attempt to destructure non-iterable instance");
4671
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
4730
4672
  }
4673
+ /**
4674
+ * @callback TypesonFulfilled
4675
+ * @returns {Promise<any>|any}
4676
+ */
4677
+
4678
+ /**
4679
+ * @callback TypesonRejected
4680
+ * @returns {Promise<any>|any}
4681
+ */
4682
+
4683
+ /**
4684
+ * @callback TypesonResolve
4685
+ * @param {any} value
4686
+ * @returns {Promise<any>}
4687
+ */
4688
+
4689
+ /**
4690
+ * @callback TypesonReject
4691
+ * @param {Error|any} error
4692
+ * @returns {Promise<any>}
4693
+ */
4694
+
4695
+ /**
4696
+ * @callback TypesonResolveReject
4697
+ * @param {TypesonResolve} typesonResolve
4698
+ * @param {TypesonReject} typesonReject
4699
+ * @returns {Promise<any>}
4700
+ */
4701
+
4702
+ /* eslint-disable block-spacing, space-before-function-paren,
4703
+ space-before-blocks, space-infix-ops, semi, promise/avoid-new,
4704
+ jsdoc/require-jsdoc */
4705
+
4731
4706
  /**
4732
4707
  * We keep this function minimized so if using two instances of this
4733
4708
  * library, where one is minimized and one is not, it will still work
4734
4709
  * with `hasConstructorOf`.
4735
4710
  * With ES6 classes, we may be able to simply use `class TypesonPromise
4736
4711
  * extends Promise` and add a string tag for detection.
4737
- * @param {function} f
4712
+ * @param {TypesonResolveReject} f
4738
4713
  */
4739
- // eslint-disable-next-line max-len
4740
- // eslint-disable-next-line block-spacing, space-before-function-paren, space-before-blocks, space-infix-ops, semi, promise/avoid-new
4741
4714
 
4742
4715
 
4743
4716
  var TypesonPromise = function TypesonPromise(f) {
4744
4717
  _classCallCheck(this, TypesonPromise);
4745
4718
 
4746
4719
  this.p = new Promise(f);
4747
- }; // eslint-disable-next-line max-len
4720
+ };
4721
+ /* eslint-enable block-spacing, space-before-function-paren,
4722
+ space-before-blocks, space-infix-ops, semi, promise/avoid-new,
4723
+ jsdoc/require-jsdoc */
4724
+ // eslint-disable-next-line max-len
4748
4725
  // class TypesonPromise extends Promise {get[Symbol.toStringTag](){return 'TypesonPromise'};} // eslint-disable-line keyword-spacing, space-before-function-paren, space-before-blocks, block-spacing, semi
4749
4726
 
4750
4727
 
@@ -4758,8 +4735,8 @@
4758
4735
  }
4759
4736
  /**
4760
4737
  *
4761
- * @param {function} [onFulfilled]
4762
- * @param {function} [onRejected]
4738
+ * @param {TypesonFulfilled} [onFulfilled]
4739
+ * @param {TypesonRejected} [onRejected]
4763
4740
  * @returns {TypesonPromise}
4764
4741
  */
4765
4742
 
@@ -4779,7 +4756,7 @@
4779
4756
  };
4780
4757
  /**
4781
4758
  *
4782
- * @param {function} onRejected
4759
+ * @param {TypesonRejected} onRejected
4783
4760
  * @returns {TypesonPromise}
4784
4761
  */
4785
4762
 
@@ -4789,7 +4766,7 @@
4789
4766
  };
4790
4767
  /**
4791
4768
  *
4792
- * @param {Any} v
4769
+ * @param {any} v
4793
4770
  * @returns {TypesonPromise}
4794
4771
  */
4795
4772
 
@@ -4801,7 +4778,7 @@
4801
4778
  };
4802
4779
  /**
4803
4780
  *
4804
- * @param {Any} v
4781
+ * @param {any} v
4805
4782
  * @returns {TypesonPromise}
4806
4783
  */
4807
4784
 
@@ -4812,10 +4789,10 @@
4812
4789
  });
4813
4790
  };
4814
4791
 
4815
- ['all', 'race'].forEach(function (meth) {
4792
+ ['all', 'race', 'allSettled'].forEach(function (meth) {
4816
4793
  /**
4817
4794
  *
4818
- * @param {Promise[]} promArr
4795
+ * @param {Promise<any>[]} promArr
4819
4796
  * @returns {TypesonPromise}
4820
4797
  */
4821
4798
  TypesonPromise[meth] = function (promArr) {
@@ -4829,12 +4806,12 @@
4829
4806
  });
4830
4807
  var _ref = {},
4831
4808
  toStr = _ref.toString,
4832
- hasOwn = {}.hasOwnProperty,
4809
+ hasOwn$1 = {}.hasOwnProperty,
4833
4810
  getProto = Object.getPrototypeOf,
4834
- fnToString = hasOwn.toString;
4811
+ fnToString = hasOwn$1.toString;
4835
4812
  /**
4836
4813
  * Second argument not in use internally, but provided for utility.
4837
- * @param {Any} v
4814
+ * @param {any} v
4838
4815
  * @param {boolean} catchCheck
4839
4816
  * @returns {boolean}
4840
4817
  */
@@ -4844,7 +4821,7 @@
4844
4821
  }
4845
4822
  /**
4846
4823
  *
4847
- * @param {Any} val
4824
+ * @param {any} val
4848
4825
  * @returns {string}
4849
4826
  */
4850
4827
 
@@ -4855,14 +4832,14 @@
4855
4832
  /**
4856
4833
  * This function is dependent on both constructors
4857
4834
  * being identical so any minimization is expected of both.
4858
- * @param {Any} a
4859
- * @param {function} b
4835
+ * @param {any} a
4836
+ * @param {GenericFunction} b
4860
4837
  * @returns {boolean}
4861
4838
  */
4862
4839
 
4863
4840
 
4864
4841
  function hasConstructorOf(a, b) {
4865
- if (!a || _typeof$1(a) !== 'object') {
4842
+ if (!a || _typeof(a) !== 'object') {
4866
4843
  return false;
4867
4844
  }
4868
4845
 
@@ -4872,7 +4849,7 @@
4872
4849
  return b === null;
4873
4850
  }
4874
4851
 
4875
- var Ctor = hasOwn.call(proto, 'constructor') && proto.constructor;
4852
+ var Ctor = hasOwn$1.call(proto, 'constructor') && proto.constructor;
4876
4853
 
4877
4854
  if (typeof Ctor !== 'function') {
4878
4855
  return b === null;
@@ -4894,7 +4871,7 @@
4894
4871
  }
4895
4872
  /**
4896
4873
  *
4897
- * @param {Any} val
4874
+ * @param {any} val
4898
4875
  * @returns {boolean}
4899
4876
  */
4900
4877
 
@@ -4916,7 +4893,7 @@
4916
4893
  }
4917
4894
  /**
4918
4895
  *
4919
- * @param {Any} val
4896
+ * @param {any} val
4920
4897
  * @returns {boolean}
4921
4898
  */
4922
4899
 
@@ -4937,13 +4914,13 @@
4937
4914
  }
4938
4915
  /**
4939
4916
  *
4940
- * @param {Any} v
4917
+ * @param {any} v
4941
4918
  * @returns {boolean}
4942
4919
  */
4943
4920
 
4944
4921
 
4945
4922
  function isObject(v) {
4946
- return v && _typeof$1(v) === 'object';
4923
+ return v && _typeof(v) === 'object';
4947
4924
  }
4948
4925
  /**
4949
4926
  *
@@ -4968,7 +4945,7 @@
4968
4945
  /**
4969
4946
  * @param {PlainObject|GenericArray} obj
4970
4947
  * @param {string} keyPath
4971
- * @returns {Any}
4948
+ * @returns {any}
4972
4949
  */
4973
4950
 
4974
4951
 
@@ -4990,8 +4967,8 @@
4990
4967
  *
4991
4968
  * @param {PlainObject} obj
4992
4969
  * @param {string} keyPath
4993
- * @param {Any} value
4994
- * @returns {Any}
4970
+ * @param {any} value
4971
+ * @returns {any}
4995
4972
  */
4996
4973
 
4997
4974
 
@@ -5019,12 +4996,24 @@
5019
4996
 
5020
4997
 
5021
4998
  function getJSONType(value) {
5022
- return value === null ? 'null' : Array.isArray(value) ? 'array' : _typeof$1(value);
4999
+ return value === null ? 'null' : Array.isArray(value) ? 'array' : _typeof(value);
5000
+ }
5001
+
5002
+ function _await(value, then, direct) {
5003
+ if (direct) {
5004
+ return then ? then(value) : value;
5005
+ }
5006
+
5007
+ if (!value || !value.then) {
5008
+ value = Promise.resolve(value);
5009
+ }
5010
+
5011
+ return then ? value.then(then) : value;
5023
5012
  }
5024
5013
 
5025
5014
  var keys = Object.keys,
5026
5015
  isArray = Array.isArray,
5027
- hasOwn$1 = {}.hasOwnProperty,
5016
+ hasOwn = {}.hasOwnProperty,
5028
5017
  internalStateObjPropsToIgnore = ['type', 'replaced', 'iterateIn', 'iterateUnsetNumeric'];
5029
5018
  /**
5030
5019
  * Handle plain object revivers first so reference setting can use
@@ -5035,6 +5024,66 @@
5035
5024
  * @returns {1|-1|boolean}
5036
5025
  */
5037
5026
 
5027
+ function _async(f) {
5028
+ return function () {
5029
+ for (var args = [], i = 0; i < arguments.length; i++) {
5030
+ args[i] = arguments[i];
5031
+ }
5032
+
5033
+ try {
5034
+ return Promise.resolve(f.apply(this, args));
5035
+ } catch (e) {
5036
+ return Promise.reject(e);
5037
+ }
5038
+ };
5039
+ }
5040
+ /**
5041
+ * @callback Tester
5042
+ * @param {any} value
5043
+ * @param {StateObject} stateobj
5044
+ * @returns {boolean}
5045
+ */
5046
+
5047
+ /**
5048
+ * @callback Replacer
5049
+ * @param {any} value
5050
+ * @param {StateObject} stateObj
5051
+ * @returns {any} Should be JSON-stringifiable
5052
+ */
5053
+
5054
+ /**
5055
+ * @callback Reviver
5056
+ * @param {JSON} value
5057
+ * @param {StateObject} stateObj
5058
+ * @returns {any}
5059
+ */
5060
+
5061
+ /**
5062
+ * @typedef {PlainObject} TypesonOptions
5063
+ * @property {boolean} stringification Auto-set by `stringify`
5064
+ */
5065
+
5066
+ /**
5067
+ * An instance of this class can be used to call `stringify()` and `parse()`.
5068
+ * Typeson resolves cyclic references by default. Can also be extended to
5069
+ * support custom types using the register() method.
5070
+ *
5071
+ * @class
5072
+ * @param {{cyclic: boolean}} [options] - if cyclic (default true),
5073
+ * cyclic references will be handled gracefully.
5074
+ */
5075
+
5076
+
5077
+ function _invoke(body, then) {
5078
+ var result = body();
5079
+
5080
+ if (result && result.then) {
5081
+ return result.then(then);
5082
+ }
5083
+
5084
+ return then(result);
5085
+ }
5086
+
5038
5087
  function nestedPathsFirst(a, b) {
5039
5088
  if (a.keypath === '') {
5040
5089
  return -1;
@@ -5053,18 +5102,11 @@
5053
5102
 
5054
5103
  return as > bs ? -1 : as < bs ? 1 : a.keypath < b.keypath ? -1 : a.keypath > b.keypath;
5055
5104
  }
5056
- /**
5057
- * An instance of this class can be used to call `stringify()` and `parse()`.
5058
- * Typeson resolves cyclic references by default. Can also be extended to
5059
- * support custom types using the register() method.
5060
- *
5061
- * @class
5062
- * @param {{cyclic: boolean}} [options] - if cyclic (default true),
5063
- * cyclic references will be handled gracefully.
5064
- */
5065
-
5066
5105
 
5067
5106
  var Typeson = /*#__PURE__*/function () {
5107
+ /**
5108
+ * @param {TypesonOptions} options
5109
+ */
5068
5110
  function Typeson(options) {
5069
5111
  _classCallCheck(this, Typeson);
5070
5112
 
@@ -5096,18 +5138,18 @@
5096
5138
  * Serialize given object to Typeson.
5097
5139
  * Initial arguments work identical to those of `JSON.stringify`.
5098
5140
  * The `replacer` argument has nothing to do with our replacers.
5099
- * @param {Any} obj
5141
+ * @param {any} obj
5100
5142
  * @param {JSONReplacer|string[]} replacer
5101
5143
  * @param {number|string} space
5102
- * @param {object} opts
5103
- * @returns {string|Promise} Promise resolves to a string
5144
+ * @param {TypesonOptions} opts
5145
+ * @returns {string|Promise<string>} Promise resolves to a string
5104
5146
  */
5105
5147
 
5106
5148
 
5107
5149
  _createClass(Typeson, [{
5108
5150
  key: "stringify",
5109
5151
  value: function stringify(obj, replacer, space, opts) {
5110
- opts = _objectSpread2({}, this.options, {}, opts, {
5152
+ opts = _objectSpread2(_objectSpread2(_objectSpread2({}, this.options), opts), {}, {
5111
5153
  stringification: true
5112
5154
  });
5113
5155
  var encapsulated = this.encapsulate(obj, null, opts);
@@ -5122,54 +5164,61 @@
5122
5164
  }
5123
5165
  /**
5124
5166
  * Also sync but throws on non-sync result.
5125
- * @param {Any} obj
5167
+ * @param {any} obj
5126
5168
  * @param {JSONReplacer|string[]} replacer
5127
5169
  * @param {number|string} space
5128
- * @param {object} opts
5170
+ * @param {TypesonOptions} opts
5129
5171
  * @returns {string}
5130
5172
  */
5131
5173
 
5132
5174
  }, {
5133
5175
  key: "stringifySync",
5134
5176
  value: function stringifySync(obj, replacer, space, opts) {
5135
- return this.stringify(obj, replacer, space, _objectSpread2({
5177
+ return this.stringify(obj, replacer, space, _objectSpread2(_objectSpread2({
5136
5178
  throwOnBadSyncType: true
5137
- }, opts, {
5179
+ }, opts), {}, {
5138
5180
  sync: true
5139
5181
  }));
5140
5182
  }
5141
5183
  /**
5142
5184
  *
5143
- * @param {Any} obj
5185
+ * @param {any} obj
5144
5186
  * @param {JSONReplacer|string[]} replacer
5145
5187
  * @param {number|string} space
5146
- * @param {object} opts
5188
+ * @param {TypesonOptions} opts
5147
5189
  * @returns {Promise<string>}
5148
5190
  */
5149
5191
 
5150
5192
  }, {
5151
5193
  key: "stringifyAsync",
5152
5194
  value: function stringifyAsync(obj, replacer, space, opts) {
5153
- return this.stringify(obj, replacer, space, _objectSpread2({
5195
+ return this.stringify(obj, replacer, space, _objectSpread2(_objectSpread2({
5154
5196
  throwOnBadSyncType: true
5155
- }, opts, {
5197
+ }, opts), {}, {
5156
5198
  sync: false
5157
5199
  }));
5158
5200
  }
5201
+ /**
5202
+ * @callback JSONReviver
5203
+ * @param {string} key
5204
+ * @param {JSON} value
5205
+ * @returns {JSON}
5206
+ */
5207
+
5159
5208
  /**
5160
5209
  * Parse Typeson back into an obejct.
5161
5210
  * Initial arguments works identical to those of `JSON.parse()`.
5162
5211
  * @param {string} text
5163
- * @param {function} reviver This JSON reviver has nothing to do with
5212
+ * @param {JSONReviver} reviver This JSON reviver has nothing to do with
5164
5213
  * our revivers.
5165
- * @param {object} opts
5214
+ * @param {TypesonOptions} opts
5166
5215
  * @returns {external:JSON}
5167
5216
  */
5168
5217
 
5169
5218
  }, {
5170
5219
  key: "parse",
5171
5220
  value: function parse(text, reviver, opts) {
5172
- opts = _objectSpread2({}, this.options, {}, opts, {
5221
+ opts = _objectSpread2(_objectSpread2(_objectSpread2({}, this.options), opts), {}, {
5173
5222
  parse: true
5174
5223
  });
5175
5224
  return this.revive(JSON.parse(text, reviver), opts);
@@ -5177,43 +5226,47 @@
5177
5226
  /**
5178
5227
  * Also sync but throws on non-sync result.
5179
5228
  * @param {string} text
5180
- * @param {function} reviver This JSON reviver has nothing to do with
5229
+ * @param {JSONReviver} reviver This JSON reviver has nothing to do with
5181
5230
  * our revivers.
5182
- * @param {object} opts
5231
+ * @param {TypesonOptions} opts
5183
5232
  * @returns {external:JSON}
5184
5233
  */
5185
5234
 
5186
5235
  }, {
5187
5236
  key: "parseSync",
5188
5237
  value: function parseSync(text, reviver, opts) {
5189
- return this.parse(text, reviver, _objectSpread2({
5238
+ return this.parse(text, reviver, _objectSpread2(_objectSpread2({
5190
5239
  throwOnBadSyncType: true
5191
- }, opts, {
5240
+ }, opts), {}, {
5192
5241
  sync: true
5193
5242
  }));
5194
5243
  }
5195
5244
  /**
5196
5245
  * @param {string} text
5197
- * @param {function} reviver This JSON reviver has nothing to do with
5246
+ * @param {JSONReviver} reviver This JSON reviver has nothing to do with
5198
5247
  * our revivers.
5199
- * @param {object} opts
5200
- * @returns {Promise} Resolves to `external:JSON`
5248
+ * @param {TypesonOptions} opts
5249
+ * @returns {Promise<external:JSON>} Resolves to `external:JSON`
5201
5250
  */
5202
5251
 
5203
5252
  }, {
5204
5253
  key: "parseAsync",
5205
5254
  value: function parseAsync(text, reviver, opts) {
5206
- return this.parse(text, reviver, _objectSpread2({
5255
+ return this.parse(text, reviver, _objectSpread2(_objectSpread2({
5207
5256
  throwOnBadSyncType: true
5208
- }, opts, {
5257
+ }, opts), {}, {
5209
5258
  sync: false
5210
5259
  }));
5211
5260
  }
5261
+ /**
5262
+ * @typedef {} StateObject
5263
+ */
5264
+
5212
5265
  /**
5213
5266
  *
5214
- * @param {Any} obj
5215
- * @param {object} stateObj
5216
- * @param {object} [opts={}]
5267
+ * @param {any} obj
5268
+ * @param {StateObject} stateObj
5269
+ * @param {TypesonOptions} [opts={}]
5217
5270
  * @returns {string[]|false}
5218
5271
  */
5219
5272
 
@@ -5226,10 +5279,10 @@
5226
5279
  }
5227
5280
  /**
5228
5281
  *
5229
- * @param {Any} obj
5282
+ * @param {any} obj
5230
5283
  * @param {PlainObject} stateObj
5231
5284
  * @param {PlainObject} [opts={}]
5232
- * @returns {Promise|GenericArray|PlainObject|string|false}
5285
+ * @returns {Promise<any>|GenericArray|PlainObject|string|false}
5233
5286
  */
5234
5287
 
5235
5288
  }, {
@@ -5244,18 +5297,101 @@
5244
5297
  * registered types with plain objects representing the types data.
5245
5298
  *
5246
5299
  * This method is used internally by `Typeson.stringify()`.
5247
- * @param {Any} obj - Object to encapsulate.
5300
+ * @param {any} obj - Object to encapsulate.
5248
5301
  * @param {PlainObject} stateObj
5249
5302
  * @param {PlainObject} opts
5250
- * @returns {Promise|GenericArray|PlainObject|string|false}
5303
+ * @returns {Promise<any>|GenericArray|PlainObject|string|false}
5251
5304
  */
5252
5305
 
5253
5306
  }, {
5254
5307
  key: "encapsulate",
5255
5308
  value: function encapsulate(obj, stateObj, opts) {
5256
- opts = _objectSpread2({
5309
+ /**
5310
+ *
5311
+ * @param {any} ret
5312
+ * @param {GenericArray} promisesData
5313
+ * @returns {Promise<any>}
5314
+ */
5315
+ var checkPromises = _async(function (ret, promisesData) {
5316
+ return _await(Promise.all(promisesData.map(function (pd) {
5317
+ return pd[1].p;
5318
+ })), function (promResults) {
5319
+ return _await(Promise.all(promResults.map(_async(function (promResult) {
5320
+ var _exit = false;
5321
+ var newPromisesData = [];
5322
+
5323
+ var _promisesData$splice = promisesData.splice(0, 1),
5324
+ _promisesData$splice2 = _slicedToArray(_promisesData$splice, 1),
5325
+ prData = _promisesData$splice2[0];
5326
+
5327
+ var _prData = _slicedToArray(prData, 7),
5328
+ keyPath = _prData[0],
5329
+ cyclic = _prData[2],
5330
+ stateObj = _prData[3],
5331
+ parentObj = _prData[4],
5332
+ key = _prData[5],
5333
+ detectedType = _prData[6];
5334
+
5335
+ var encaps = _encapsulate(keyPath, promResult, cyclic, stateObj, newPromisesData, true, detectedType);
5336
+
5337
+ var isTypesonPromise = hasConstructorOf(encaps, TypesonPromise); // Handle case where an embedded custom type itself
5338
+ // returns a `Typeson.Promise`
5339
+
5340
+ return _invoke(function () {
5341
+ if (keyPath && isTypesonPromise) {
5342
+ return _await(encaps.p, function (encaps2) {
5343
+ parentObj[key] = encaps2;
5344
+ _exit = true;
5345
+ return checkPromises(ret, newPromisesData);
5346
+ });
5347
+ }
5348
+ }, function (_result) {
5349
+ if (_exit) return _result;
5350
+
5351
+ if (keyPath) {
5352
+ parentObj[key] = encaps;
5353
+ } else if (isTypesonPromise) {
5354
+ ret = encaps.p;
5355
+ } else {
5356
+ // If this is itself a `Typeson.Promise` (because the
5357
+ // original value supplied was a `Promise` or
5358
+ // because the supplied custom type value resolved
5359
+ // to one), returning it below will be fine since
5360
+ // a `Promise` is expected anyways given current
5361
+ // config (and if not a `Promise`, it will be ready
5362
+ // as the resolve value)
5363
+ ret = encaps;
5364
+ }
5365
+
5366
+ return checkPromises(ret, newPromisesData);
5367
+ });
5368
+ }))), function () {
5369
+ return ret;
5370
+ });
5371
+ });
5372
+ });
5373
+ /**
5374
+ * @typedef {PlainObject} OwnKeysObject
5375
+ * @property {boolean} ownKeys
5376
+ */
5377
+
5378
+ /**
5379
+ * @callback BuiltinStateObjectPropertiesCallback
5380
+ * @returns {void}
5381
+ */
5382
+
5383
+ /**
5384
+ *
5385
+ * @param {StateObject} stateObj
5386
+ * @param {OwnKeysObject} ownKeysObj
5387
+ * @param {BuiltinStateObjectPropertiesCallback} cb
5388
+ * @returns {undefined}
5389
+ */
5390
+
5391
+
5392
+ opts = _objectSpread2(_objectSpread2({
5257
5393
  sync: true
5258
- }, this.options, {}, opts);
5394
+ }, this.options), opts);
5259
5395
  var _opts = opts,
5260
5396
  sync = _opts.sync;
5261
5397
  var that = this,
@@ -5274,7 +5410,7 @@
5274
5410
  var ret = _encapsulate('', obj, cyclic, stateObj || {}, promisesDataRoot);
5275
5411
  /**
5276
5412
  *
5277
- * @param {Any} ret
5413
+ * @param {any} ret
5278
5414
  * @returns {GenericArray|PlainObject|string|false}
5279
5415
  */
5280
5416
 
@@ -5301,7 +5437,7 @@
5301
5437
 
5302
5438
  if (!ret || !isPlainObject(ret) || // Also need to handle if this is an object with its
5303
5439
  // own `$types` property (to avoid ambiguity)
5304
- hasOwn$1.call(ret, '$types')) {
5440
+ hasOwn.call(ret, '$types')) {
5305
5441
  ret = {
5306
5442
  $: ret,
5307
5443
  $types: {
@@ -5312,7 +5448,7 @@
5312
5448
  ret.$types = types;
5313
5449
  } // No special types
5314
5450
 
5315
- } else if (isObject(ret) && hasOwn$1.call(ret, '$types')) {
5451
+ } else if (isObject(ret) && hasOwn.call(ret, '$types')) {
5316
5452
  ret = {
5317
5453
  $: ret,
5318
5454
  $types: true
@@ -5325,112 +5461,6 @@
5325
5461
 
5326
5462
  return ret;
5327
5463
  }
5328
- /**
5329
- *
5330
- * @param {Any} ret
5331
- * @param {GenericArray} promisesData
5332
- * @returns {Promise<Any>}
5333
- */
5334
-
5335
-
5336
- function checkPromises(_x, _x2) {
5337
- return _checkPromises.apply(this, arguments);
5338
- }
5339
- /**
5340
- *
5341
- * @param {object} stateObj
5342
- * @param {object} ownKeysObj
5343
- * @param {function} cb
5344
- * @returns {undefined}
5345
- */
5346
-
5347
-
5348
- function _checkPromises() {
5349
- _checkPromises = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(ret, promisesData) {
5350
- var promResults;
5351
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
5352
- while (1) {
5353
- switch (_context2.prev = _context2.next) {
5354
- case 0:
5355
- _context2.next = 2;
5356
- return Promise.all(promisesData.map(function (pd) {
5357
- return pd[1].p;
5358
- }));
5359
-
5360
- case 2:
5361
- promResults = _context2.sent;
5362
- _context2.next = 5;
5363
- return Promise.all(promResults.map( /*#__PURE__*/function () {
5364
- var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(promResult) {
5365
- var newPromisesData, _promisesData$splice, _promisesData$splice2, prData, _prData, keyPath, cyclic, stateObj, parentObj, key, detectedType, encaps, isTypesonPromise, encaps2;
5366
-
5367
- return regeneratorRuntime.wrap(function _callee$(_context) {
5368
- while (1) {
5369
- switch (_context.prev = _context.next) {
5370
- case 0:
5371
- newPromisesData = [];
5372
- _promisesData$splice = promisesData.splice(0, 1), _promisesData$splice2 = _slicedToArray(_promisesData$splice, 1), prData = _promisesData$splice2[0];
5373
- _prData = _slicedToArray(prData, 7), keyPath = _prData[0], cyclic = _prData[2], stateObj = _prData[3], parentObj = _prData[4], key = _prData[5], detectedType = _prData[6];
5374
- encaps = _encapsulate(keyPath, promResult, cyclic, stateObj, newPromisesData, true, detectedType);
5375
- isTypesonPromise = hasConstructorOf(encaps, TypesonPromise); // Handle case where an embedded custom type itself
5376
- // returns a `Typeson.Promise`
5377
-
5378
- if (!(keyPath && isTypesonPromise)) {
5379
- _context.next = 11;
5380
- break;
5381
- }
5382
-
5383
- _context.next = 8;
5384
- return encaps.p;
5385
-
5386
- case 8:
5387
- encaps2 = _context.sent;
5388
- parentObj[key] = encaps2;
5389
- return _context.abrupt("return", checkPromises(ret, newPromisesData));
5390
-
5391
- case 11:
5392
- if (keyPath) {
5393
- parentObj[key] = encaps;
5394
- } else if (isTypesonPromise) {
5395
- ret = encaps.p;
5396
- } else {
5397
- // If this is itself a `Typeson.Promise` (because the
5398
- // original value supplied was a `Promise` or
5399
- // because the supplied custom type value resolved
5400
- // to one), returning it below will be fine since
5401
- // a `Promise` is expected anyways given current
5402
- // config (and if not a `Promise`, it will be ready
5403
- // as the resolve value)
5404
- ret = encaps;
5405
- }
5406
-
5407
- return _context.abrupt("return", checkPromises(ret, newPromisesData));
5408
-
5409
- case 13:
5410
- case "end":
5411
- return _context.stop();
5412
- }
5413
- }
5414
- }, _callee);
5415
- }));
5416
-
5417
- return function (_x3) {
5418
- return _ref.apply(this, arguments);
5419
- };
5420
- }()));
5421
-
5422
- case 5:
5423
- return _context2.abrupt("return", ret);
5424
-
5425
- case 6:
5426
- case "end":
5427
- return _context2.stop();
5428
- }
5429
- }
5430
- }, _callee2);
5431
- }));
5432
- return _checkPromises.apply(this, arguments);
5433
- }
5434
5464
 
5435
5465
  function _adaptBuiltinStateObjectProperties(stateObj, ownKeysObj, cb) {
5436
5466
  Object.assign(stateObj, ownKeysObj);
@@ -5438,7 +5468,7 @@
5438
5468
  var tmp = stateObj[prop];
5439
5469
  delete stateObj[prop];
5440
5470
  return tmp;
5441
- }); // eslint-disable-next-line callback-return
5471
+ }); // eslint-disable-next-line node/callback-return
5442
5472
 
5443
5473
  cb();
5444
5474
  internalStateObjPropsToIgnore.forEach(function (prop, i) {
@@ -5448,13 +5478,13 @@
5448
5478
  /**
5449
5479
  *
5450
5480
  * @param {string} keypath
5451
- * @param {Any} value
5481
+ * @param {any} value
5452
5482
  * @param {boolean} cyclic
5453
5483
  * @param {PlainObject} stateObj
5454
5484
  * @param {boolean} promisesData
5455
5485
  * @param {boolean} resolvingTypesonPromise
5456
5486
  * @param {string} detectedType
5457
- * @returns {Any}
5487
+ * @returns {any}
5458
5488
  */
5459
5489
 
5460
5490
 
@@ -5462,7 +5492,7 @@
5462
5492
  var ret;
5463
5493
  var observerData = {};
5464
5494
 
5465
- var $typeof = _typeof$1(value);
5495
+ var $typeof = _typeof(value);
5466
5496
 
5467
5497
  var runObserver = encapsulateObserver ? function (obj) {
5468
5498
  var type = detectedType || stateObj.type || Typeson.getJSONType(value);
@@ -5480,12 +5510,8 @@
5480
5510
  } : null;
5481
5511
 
5482
5512
  if (['string', 'boolean', 'number', 'undefined'].includes($typeof)) {
5483
- if (value === undefined || $typeof === 'number' && (isNaN(value) || value === -Infinity || value === Infinity)) {
5484
- if (stateObj.replaced) {
5485
- ret = value;
5486
- } else {
5487
- ret = replace(keypath, value, stateObj, promisesData, false, resolvingTypesonPromise, runObserver);
5488
- }
5513
+ if (value === undefined || Number.isNaN(value) || value === Number.NEGATIVE_INFINITY || value === Number.POSITIVE_INFINITY) {
5514
+ ret = stateObj.replaced ? value : replace(keypath, value, stateObj, promisesData, false, resolvingTypesonPromise, runObserver);
5489
5515
 
5490
5516
  if (ret !== value) {
5491
5517
  observerData = {
@@ -5511,7 +5537,7 @@
5511
5537
  return value;
5512
5538
  }
5513
5539
 
5514
- if (cyclic && !stateObj.iterateIn && !stateObj.iterateUnsetNumeric && value && _typeof$1(value) === 'object') {
5540
+ if (cyclic && !stateObj.iterateIn && !stateObj.iterateUnsetNumeric && value && _typeof(value) === 'object') {
5515
5541
  // Options set to detect cyclic references and be able
5516
5542
  // to rewrite them.
5517
5543
  var refIndex = refObjs.indexOf(value);
@@ -5554,11 +5580,12 @@
5554
5580
  promisesData.push([keypath, value, cyclic, stateObj, undefined, undefined, stateObj.type]);
5555
5581
  ret = value;
5556
5582
  } else if (isArr && stateObj.iterateIn !== 'object' || stateObj.iterateIn === 'array') {
5583
+ // eslint-disable-next-line unicorn/no-new-array -- Sparse
5557
5584
  clone = new Array(value.length);
5558
5585
  observerData = {
5559
5586
  clone: clone
5560
5587
  };
5561
- } else if (!['function', 'symbol'].includes(_typeof$1(value)) && !('toJSON' in value) && !hasConstructorOf(value, TypesonPromise) && !hasConstructorOf(value, Promise) && !hasConstructorOf(value, ArrayBuffer) || isPlainObj || stateObj.iterateIn === 'object') {
5588
+ } else if (!['function', 'symbol'].includes(_typeof(value)) && !('toJSON' in value) && !hasConstructorOf(value, TypesonPromise) && !hasConstructorOf(value, Promise) && !hasConstructorOf(value, ArrayBuffer) || isPlainObj || stateObj.iterateIn === 'object') {
5562
5589
  clone = {};
5563
5590
 
5564
5591
  if (stateObj.addLength) {
@@ -5589,7 +5616,7 @@
5589
5616
  if (stateObj.iterateIn) {
5590
5617
  var _loop = function _loop(key) {
5591
5618
  var ownKeysObj = {
5592
- ownKeys: hasOwn$1.call(value, key)
5619
+ ownKeys: hasOwn.call(value, key)
5593
5620
  };
5594
5621
 
5595
5622
  _adaptBuiltinStateObjectProperties(stateObj, ownKeysObj, function () {
@@ -5686,16 +5713,50 @@
5686
5713
 
5687
5714
  return clone;
5688
5715
  }
5716
+ /**
5717
+ * @typedef {PlainObject} KeyPathEvent
5718
+ * @property {string} cyclicKeypath
5719
+ */
5720
+
5721
+ /**
5722
+ * @typedef {PlainObject} EndIterateInEvent
5723
+ * @property {boolean} endIterateIn
5724
+ * @property {boolean} end
5725
+ */
5726
+
5727
+ /**
5728
+ * @typedef {PlainObject} EndIterateUnsetNumericEvent
5729
+ * @property {boolean} endIterateUnsetNumeric
5730
+ * @property {boolean} end
5731
+ */
5732
+
5733
+ /**
5734
+ * @typedef {PlainObject} TypeDetectedEvent
5735
+ * @property {boolean} typeDetected
5736
+ */
5737
+
5738
+ /**
5739
+ * @typedef {PlainObject} ReplacingEvent
5740
+ * @property {boolean} replacing
5741
+ */
5742
+
5743
+ /**
5744
+ * @callback Observer
5745
+ * @param {KeyPathEvent|EndIterateInEvent|EndIterateUnsetNumericEvent|
5746
+ * TypeDetectedEvent|ReplacingEvent} [event]
5747
+ * @returns {void}
5748
+ */
5749
+
5689
5750
  /**
5690
5751
  *
5691
5752
  * @param {string} keypath
5692
- * @param {Any} value
5753
+ * @param {any} value
5693
5754
  * @param {PlainObject} stateObj
5694
5755
  * @param {GenericArray} promisesData
5695
5756
  * @param {boolean} plainObject
5696
5757
  * @param {boolean} resolvingTypesonPromise
5697
- * @param {function} [runObserver]
5698
- * @returns {*}
5758
+ * @param {Observer} [runObserver]
5759
+ * @returns {any}
5699
5760
  */
5700
5761
 
5701
5762
 
@@ -5766,46 +5827,47 @@
5766
5827
  }
5767
5828
  /**
5768
5829
  * Also sync but throws on non-sync result.
5769
- * @param {*} obj
5770
- * @param {object} stateObj
5771
- * @param {object} opts
5772
- * @returns {*}
5830
+ * @param {any} obj
5831
+ * @param {StateObject} stateObj
5832
+ * @param {TypesonOptions} opts
5833
+ * @returns {any}
5773
5834
  */
5774
5835
 
5775
5836
  }, {
5776
5837
  key: "encapsulateSync",
5777
5838
  value: function encapsulateSync(obj, stateObj, opts) {
5778
- return this.encapsulate(obj, stateObj, _objectSpread2({
5839
+ return this.encapsulate(obj, stateObj, _objectSpread2(_objectSpread2({
5779
5840
  throwOnBadSyncType: true
5780
- }, opts, {
5841
+ }, opts), {}, {
5781
5842
  sync: true
5782
5843
  }));
5783
5844
  }
5784
5845
  /**
5785
- * @param {*} obj
5786
- * @param {object} stateObj
5787
- * @param {object} opts
5788
- * @returns {*}
5846
+ * @param {any} obj
5847
+ * @param {StateObject} stateObj
5848
+ * @param {TypesonOptions} opts
5849
+ * @returns {any}
5789
5850
  */
5790
5851
 
5791
5852
  }, {
5792
5853
  key: "encapsulateAsync",
5793
5854
  value: function encapsulateAsync(obj, stateObj, opts) {
5794
- return this.encapsulate(obj, stateObj, _objectSpread2({
5855
+ return this.encapsulate(obj, stateObj, _objectSpread2(_objectSpread2({
5795
5856
  throwOnBadSyncType: true
5796
- }, opts, {
5857
+ }, opts), {}, {
5797
5858
  sync: false
5798
5859
  }));
5799
5860
  }
5800
5861
  /**
5801
5862
  * Revive an encapsulated object.
5802
5863
  * This method is used internally by `Typeson.parse()`.
5803
- * @param {object} obj - Object to revive. If it has `$types` member, the
5804
- * properties that are listed there will be replaced with its true type
5805
- * instead of just plain objects.
5806
- * @param {object} opts
5864
+ * @param {PlainObject} obj - Object to revive. If it has `$types` member,
5865
+ * the properties that are listed there will be replaced with its true
5866
+ * type instead of just plain objects.
5867
+ * @param {TypesonOptions} opts
5807
5868
  * @throws TypeError If mismatch between sync/async type and result
5808
- * @returns {Promise|*} If async, returns a Promise that resolves to `*`
5869
+ * @returns {Promise<any>|any} If async, returns a Promise that resolves
5870
+ * to `any`.
5809
5871
  */
5810
5872
 
5811
5873
  }, {
@@ -5823,9 +5885,9 @@
5823
5885
  return obj.$;
5824
5886
  }
5825
5887
 
5826
- opts = _objectSpread2({
5888
+ opts = _objectSpread2(_objectSpread2({
5827
5889
  sync: true
5828
- }, this.options, {}, opts);
5890
+ }, this.options), opts);
5829
5891
  var _opts3 = opts,
5830
5892
  sync = _opts3.sync;
5831
5893
  var keyPathResolutions = [];
@@ -5843,22 +5905,23 @@
5843
5905
  var that = this;
5844
5906
  /**
5845
5907
  * @callback RevivalReducer
5846
- * @param {Any} value
5908
+ * @param {any} value
5847
5909
  * @param {string} type
5848
- * @returns {Any}
5910
+ * @returns {any}
5849
5911
  */
5850
5912
 
5851
5913
  /**
5852
5914
  *
5853
5915
  * @param {string} type
5854
- * @param {Any} val
5855
- * @returns {[type]} [description]
5916
+ * @param {any} val
5917
+ * @throws {Error}
5918
+ * @returns {any}
5856
5919
  */
5857
5920
 
5858
5921
  function executeReviver(type, val) {
5859
- var _ref2 = that.revivers[type] || [],
5860
- _ref3 = _slicedToArray(_ref2, 1),
5861
- reviver = _ref3[0];
5922
+ var _ref = that.revivers[type] || [],
5923
+ _ref2 = _slicedToArray(_ref, 1),
5924
+ reviver = _ref2[0];
5862
5925
 
5863
5926
  if (!reviver) {
5864
5927
  throw new Error('Unregistered type: ' + type);
@@ -5885,10 +5948,10 @@
5885
5948
  // const references = [];
5886
5949
  // const reviveTypes = [];
5887
5950
  var plainObjectTypes = [];
5888
- Object.entries(types).forEach(function (_ref4) {
5889
- var _ref5 = _slicedToArray(_ref4, 2),
5890
- keypath = _ref5[0],
5891
- type = _ref5[1];
5951
+ Object.entries(types).forEach(function (_ref3) {
5952
+ var _ref4 = _slicedToArray(_ref3, 2),
5953
+ keypath = _ref4[0],
5954
+ type = _ref4[1];
5892
5955
 
5893
5956
  if (type === '#') {
5894
5957
  /*
@@ -5901,9 +5964,9 @@
5901
5964
  }
5902
5965
 
5903
5966
  [].concat(type).forEach(function (type) {
5904
- var _ref6 = that.revivers[type] || [null, {}],
5905
- _ref7 = _slicedToArray(_ref6, 2),
5906
- plain = _ref7[1].plain;
5967
+ var _ref5 = that.revivers[type] || [null, {}],
5968
+ _ref6 = _slicedToArray(_ref5, 2),
5969
+ plain = _ref6[1].plain;
5907
5970
 
5908
5971
  if (!plain) {
5909
5972
  // reviveTypes.push({keypath, type});
@@ -5929,9 +5992,9 @@
5929
5992
  */
5930
5993
 
5931
5994
 
5932
- return plainObjectTypes.sort(nestedPathsFirst).reduce(function reducer(possibleTypesonPromise, _ref8) {
5933
- var keypath = _ref8.keypath,
5934
- type = _ref8.type;
5995
+ return plainObjectTypes.sort(nestedPathsFirst).reduce(function reducer(possibleTypesonPromise, _ref7) {
5996
+ var keypath = _ref7.keypath,
5997
+ type = _ref7.type;
5935
5998
 
5936
5999
  if (isThenable(possibleTypesonPromise)) {
5937
6000
  return possibleTypesonPromise.then(function (val) {
@@ -5974,11 +6037,11 @@
5974
6037
  /**
5975
6038
  *
5976
6039
  * @param {string} keypath
5977
- * @param {Any} value
5978
- * @param {?(Array|object)} target
5979
- * @param {Array|object} [clone]
6040
+ * @param {any} value
6041
+ * @param {?(GenericArray|PlainObject)} target
6042
+ * @param {GenericArray|PlainObject} [clone]
5980
6043
  * @param {string} [key]
5981
- * @returns {Any}
6044
+ * @returns {any}
5982
6045
  */
5983
6046
 
5984
6047
  function _revive(keypath, value, target, clone, key) {
@@ -5990,6 +6053,7 @@
5990
6053
  var isArr = isArray(value);
5991
6054
 
5992
6055
  if (isArr || isPlainObject(value)) {
6056
+ // eslint-disable-next-line unicorn/no-new-array -- Sparse
5993
6057
  var _clone = isArr ? new Array(value.length) : {}; // Iterate object or array
5994
6058
 
5995
6059
 
@@ -6065,8 +6129,8 @@
6065
6129
  }
6066
6130
  /**
6067
6131
  *
6068
- * @param {Any} retrn
6069
- * @returns {undefined|Any}
6132
+ * @param {any} retrn
6133
+ * @returns {undefined|any}
6070
6134
  */
6071
6135
 
6072
6136
 
@@ -6089,9 +6153,9 @@
6089
6153
  ret = TypesonPromise.resolve(ret).then(function (r) {
6090
6154
  return TypesonPromise.all([// May be a TypesonPromise or not
6091
6155
  r].concat(revivalPromises));
6092
- }).then(function (_ref9) {
6093
- var _ref10 = _slicedToArray(_ref9, 1),
6094
- r = _ref10[0];
6156
+ }).then(function (_ref8) {
6157
+ var _ref9 = _slicedToArray(_ref8, 1),
6158
+ r = _ref9[0];
6095
6159
 
6096
6160
  return r;
6097
6161
  });
@@ -6106,42 +6170,46 @@
6106
6170
  }
6107
6171
  /**
6108
6172
  * Also sync but throws on non-sync result.
6109
- * @param {Any} obj
6110
- * @param {object} opts
6111
- * @returns {Any}
6173
+ * @param {any} obj
6174
+ * @param {TypesonOptions} opts
6175
+ * @returns {any}
6112
6176
  */
6113
6177
 
6114
6178
  }, {
6115
6179
  key: "reviveSync",
6116
6180
  value: function reviveSync(obj, opts) {
6117
- return this.revive(obj, _objectSpread2({
6181
+ return this.revive(obj, _objectSpread2(_objectSpread2({
6118
6182
  throwOnBadSyncType: true
6119
- }, opts, {
6183
+ }, opts), {}, {
6120
6184
  sync: true
6121
6185
  }));
6122
6186
  }
6123
6187
  /**
6124
- * @param {Any} obj
6125
- * @param {object} opts
6126
- * @returns {Promise} Resolves to `*`
6188
+ * @param {any} obj
6189
+ * @param {TypesonOptions} opts
6190
+ * @returns {Promise<any>}
6127
6191
  */
6128
6192
 
6129
6193
  }, {
6130
6194
  key: "reviveAsync",
6131
6195
  value: function reviveAsync(obj, opts) {
6132
- return this.revive(obj, _objectSpread2({
6196
+ return this.revive(obj, _objectSpread2(_objectSpread2({
6133
6197
  throwOnBadSyncType: true
6134
- }, opts, {
6198
+ }, opts), {}, {
6135
6199
  sync: false
6136
6200
  }));
6137
6201
  }
6202
+ /**
6203
+ * @typedef {Tester|Replacer|Reviver} Spec
6204
+ */
6205
+
6138
6206
  /**
6139
6207
  * Register types.
6140
6208
  * For examples on how to use this method, see
6141
6209
  * {@link https://github.com/dfahlander/typeson-registry/tree/master/types}.
6142
- * @param {object.<string,Function[]>[]} typeSpecSets - Types and
6143
- * their functions [test, encapsulate, revive];
6144
- * @param {object} opts
6210
+ * @param {object<string,Spec[]>[]} typeSpecSets -
6211
+ * Types and their functions [test, encapsulate, revive];
6212
+ * @param {TypesonOptions} opts
6145
6213
  * @returns {Typeson}
6146
6214
  */
6147
6215
 
@@ -6224,7 +6292,7 @@
6224
6292
  replacerObj.replaceAsync = spec.replaceAsync.bind(spec);
6225
6293
  }
6226
6294
 
6227
- var start = typeof opts.fallback === 'number' ? opts.fallback : opts.fallback ? 0 : Infinity;
6295
+ var start = typeof opts.fallback === 'number' ? opts.fallback : opts.fallback ? 0 : Number.POSITIVE_INFINITY;
6228
6296
 
6229
6297
  if (spec.testPlainObjects) {
6230
6298
  this.plainObjectReplacers.splice(start, 0, replacerObj);
@@ -6292,9 +6360,9 @@
6292
6360
  Typeson.JSON_TYPES = ['null', 'boolean', 'number', 'string', 'array', 'object'];
6293
6361
  return Typeson;
6294
6362
  });
6295
- });
6363
+ })(typeson$1);
6296
6364
 
6297
- /* eslint-disable node/no-unsupported-features/es-syntax */
6365
+ var Typeson = typeson$1.exports;
6298
6366
 
6299
6367
  /*
6300
6368
  * base64-arraybuffer
@@ -6318,7 +6386,7 @@
6318
6386
  */
6319
6387
 
6320
6388
 
6321
- var encode = function encode(arraybuffer, byteOffset, lngth) {
6389
+ var encode$1 = function encode(arraybuffer, byteOffset, lngth) {
6322
6390
  if (lngth === null || lngth === undefined) {
6323
6391
  lngth = arraybuffer.byteLength; // Needed for Safari
6324
6392
  }
@@ -6349,7 +6417,7 @@
6349
6417
  */
6350
6418
 
6351
6419
 
6352
- var decode = function decode(base64) {
6420
+ var decode$1 = function decode(base64) {
6353
6421
  var len = base64.length;
6354
6422
  var bufferLength = base64.length * 0.75;
6355
6423
  var p = 0;
@@ -6382,7 +6450,7 @@
6382
6450
  var arraybuffer = {
6383
6451
  arraybuffer: {
6384
6452
  test: function test(x) {
6385
- return typeson.toStringTag(x) === 'ArrayBuffer';
6453
+ return Typeson.toStringTag(x) === 'ArrayBuffer';
6386
6454
  },
6387
6455
  replace: function replace(b, stateObj) {
6388
6456
  if (!stateObj.buffers) {
@@ -6398,18 +6466,18 @@
6398
6466
  }
6399
6467
 
6400
6468
  stateObj.buffers.push(b);
6401
- return encode(b);
6469
+ return encode$1(b);
6402
6470
  },
6403
6471
  revive: function revive(b64, stateObj) {
6404
6472
  if (!stateObj.buffers) {
6405
6473
  stateObj.buffers = [];
6406
6474
  }
6407
6475
 
6408
- if (_typeof(b64) === 'object') {
6476
+ if (_typeof$1(b64) === 'object') {
6409
6477
  return stateObj.buffers[b64.index];
6410
6478
  }
6411
6479
 
6412
- var buffer = decode(b64);
6480
+ var buffer = decode$1(b64);
6413
6481
  stateObj.buffers.push(buffer);
6414
6482
  return buffer;
6415
6483
  }
@@ -6420,7 +6488,7 @@
6420
6488
  var bigintObject = {
6421
6489
  bigintObject: {
6422
6490
  test: function test(x) {
6423
- return _typeof(x) === 'object' && typeson.hasConstructorOf(x, BigInt);
6491
+ return _typeof$1(x) === 'object' && Typeson.hasConstructorOf(x, BigInt);
6424
6492
  },
6425
6493
  replace: function replace(n) {
6426
6494
  return String(n);
@@ -6519,14 +6587,12 @@
6519
6587
  var blob = {
6520
6588
  blob: {
6521
6589
  test: function test(x) {
6522
- return typeson.toStringTag(x) === 'Blob';
6590
+ return Typeson.toStringTag(x) === 'Blob';
6523
6591
  },
6524
6592
  replace: function replace(b) {
6525
6593
  // Sync
6526
6594
  var req = new XMLHttpRequest();
6527
- req.overrideMimeType('text/plain; charset=x-user-defined'); // eslint-disable-next-line max-len
6528
- // eslint-disable-next-line node/no-unsupported-features/node-builtins
6529
-
6595
+ req.overrideMimeType('text/plain; charset=x-user-defined');
6530
6596
  req.open('GET', URL.createObjectURL(b), false); // Sync
6531
6597
 
6532
6598
  req.send(); // Seems not feasible to accurately simulate
@@ -6550,7 +6616,7 @@
6550
6616
  });
6551
6617
  },
6552
6618
  replaceAsync: function replaceAsync(b) {
6553
- return new typeson.Promise(function (resolve, reject) {
6619
+ return new Typeson.Promise(function (resolve, reject) {
6554
6620
  /*
6555
6621
  if (b.isClosed) { // On MDN, but not in https://w3c.github.io/FileAPI/#dfn-Blob
6556
6622
  reject(new Error('The Blob is closed'));
@@ -6590,11 +6656,12 @@
6590
6656
  // Adapted from original: public domain/MIT: http://stackoverflow.com/a/8809472/271577
6591
6657
 
6592
6658
  /* istanbul ignore next */
6593
- var d = new Date().getTime() + ( // use high-precision timer if available
6659
+ var d = Date.now() + ( // use high-precision timer if available
6660
+ // istanbul ignore next
6594
6661
  typeof performance !== 'undefined' && typeof performance.now === 'function' ? performance.now() : 0);
6595
6662
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
6596
6663
  /* eslint-disable no-bitwise */
6597
- var r = (d + Math.random() * 16) % 16 | 0;
6664
+ var r = Math.trunc((d + Math.random() * 16) % 16);
6598
6665
  d = Math.floor(d / 16);
6599
6666
  return (c === 'x' ? r : r & 0x3 | 0x8).toString(16);
6600
6667
  /* eslint-enable no-bitwise */
@@ -6605,7 +6672,7 @@
6605
6672
  var cloneable = {
6606
6673
  cloneable: {
6607
6674
  test: function test(x) {
6608
- return x && _typeof(x) === 'object' && typeof x[Symbol["for"]('cloneEncapsulate')] === 'function';
6675
+ return x && _typeof$1(x) === 'object' && typeof x[Symbol["for"]('cloneEncapsulate')] === 'function';
6609
6676
  },
6610
6677
  replace: function replace(clonable) {
6611
6678
  var encapsulated = clonable[Symbol["for"]('cloneEncapsulate')]();
@@ -6624,10 +6691,47 @@
6624
6691
  }
6625
6692
  };
6626
6693
 
6694
+ /* globals crypto */
6695
+ var cryptokey = {
6696
+ cryptokey: {
6697
+ test: function test(x) {
6698
+ return Typeson.toStringTag(x) === 'CryptoKey' && x.extractable;
6699
+ },
6700
+ replaceAsync: function replaceAsync(key) {
6701
+ return new Typeson.Promise(function (resolve, reject) {
6702
+ // eslint-disable-next-line promise/catch-or-return
6703
+ crypto.subtle.exportKey('jwk', key)["catch"](
6704
+ /* eslint-disable promise/prefer-await-to-callbacks */
6705
+ // istanbul ignore next
6706
+ function (err) {
6707
+ /* eslint-enable promise/prefer-await-to-callbacks */
6708
+ // eslint-disable-next-line max-len
6709
+ // istanbul ignore next -- Our format should be valid and our key extractable
6710
+ reject(err);
6711
+ } // eslint-disable-next-line max-len
6712
+ // eslint-disable-next-line promise/always-return, promise/prefer-await-to-then
6713
+ ).then(function (jwk) {
6714
+ resolve({
6715
+ jwk: jwk,
6716
+ algorithm: key.algorithm,
6717
+ usages: key.usages
6718
+ });
6719
+ });
6720
+ });
6721
+ },
6722
+ revive: function revive(_ref) {
6723
+ var jwk = _ref.jwk,
6724
+ algorithm = _ref.algorithm,
6725
+ usages = _ref.usages;
6726
+ return crypto.subtle.importKey('jwk', jwk, algorithm, true, usages);
6727
+ }
6728
+ }
6729
+ };
6730
+
6627
6731
  var dataview = {
6628
6732
  dataview: {
6629
6733
  test: function test(x) {
6630
- return typeson.toStringTag(x) === 'DataView';
6734
+ return Typeson.toStringTag(x) === 'DataView';
6631
6735
  },
6632
6736
  replace: function replace(_ref, stateObj) {
6633
6737
  var buffer = _ref.buffer,
@@ -6650,7 +6754,7 @@
6650
6754
 
6651
6755
  stateObj.buffers.push(buffer);
6652
6756
  return {
6653
- encoded: encode(buffer),
6757
+ encoded: encode$1(buffer),
6654
6758
  byteOffset: byteOffset,
6655
6759
  byteLength: byteLength
6656
6760
  };
@@ -6669,7 +6773,7 @@
6669
6773
  if ('index' in b64Obj) {
6670
6774
  buffer = stateObj.buffers[index];
6671
6775
  } else {
6672
- buffer = decode(encoded);
6776
+ buffer = decode$1(encoded);
6673
6777
  stateObj.buffers.push(buffer);
6674
6778
  }
6675
6779
 
@@ -6681,7 +6785,7 @@
6681
6785
  var date = {
6682
6786
  date: {
6683
6787
  test: function test(x) {
6684
- return typeson.toStringTag(x) === 'Date';
6788
+ return Typeson.toStringTag(x) === 'Date';
6685
6789
  },
6686
6790
  replace: function replace(dt) {
6687
6791
  var time = dt.getTime();
@@ -6705,7 +6809,7 @@
6705
6809
  var error = {
6706
6810
  error: {
6707
6811
  test: function test(x) {
6708
- return typeson.toStringTag(x) === 'Error';
6812
+ return Typeson.toStringTag(x) === 'Error';
6709
6813
  },
6710
6814
  replace: function replace(_ref) {
6711
6815
  var name = _ref.name,
@@ -6727,18 +6831,18 @@
6727
6831
 
6728
6832
  /* istanbul ignore next */
6729
6833
 
6730
- var _global = typeof self === 'undefined' ? global$2 : self;
6834
+ var _global$2 = typeof self === 'undefined' ? global$1 : self;
6731
6835
 
6732
6836
  var errors = {}; // Comprises all built-in errors.
6733
6837
 
6734
6838
  ['TypeError', 'RangeError', 'SyntaxError', 'ReferenceError', 'EvalError', 'URIError', 'InternalError' // non-standard
6735
6839
  ].forEach(function (errName) {
6736
- var Cnstrctr = _global[errName];
6840
+ var Cnstrctr = _global$2[errName];
6737
6841
 
6738
6842
  if (Cnstrctr) {
6739
6843
  errors[errName.toLowerCase()] = {
6740
6844
  test: function test(x) {
6741
- return typeson.hasConstructorOf(x, Cnstrctr);
6845
+ return Typeson.hasConstructorOf(x, Cnstrctr);
6742
6846
  },
6743
6847
  replace: function replace(e) {
6744
6848
  return e.message;
@@ -6754,14 +6858,12 @@
6754
6858
  var file = {
6755
6859
  file: {
6756
6860
  test: function test(x) {
6757
- return typeson.toStringTag(x) === 'File';
6861
+ return Typeson.toStringTag(x) === 'File';
6758
6862
  },
6759
6863
  replace: function replace(f) {
6760
6864
  // Sync
6761
6865
  var req = new XMLHttpRequest();
6762
- req.overrideMimeType('text/plain; charset=x-user-defined'); // eslint-disable-next-line max-len
6763
- // eslint-disable-next-line node/no-unsupported-features/node-builtins
6764
-
6866
+ req.overrideMimeType('text/plain; charset=x-user-defined');
6765
6867
  req.open('GET', URL.createObjectURL(f), false); // Sync
6766
6868
 
6767
6869
  req.send(); // Seems not feasible to accurately simulate
@@ -6790,7 +6892,7 @@
6790
6892
  });
6791
6893
  },
6792
6894
  replaceAsync: function replaceAsync(f) {
6793
- return new typeson.Promise(function (resolve, reject) {
6895
+ return new Typeson.Promise(function (resolve, reject) {
6794
6896
  /*
6795
6897
  if (f.isClosed) { // On MDN, but not in https://w3c.github.io/FileAPI/#dfn-Blob
6796
6898
  reject(new Error('The File is closed'));
@@ -6822,7 +6924,7 @@
6822
6924
  file: file.file,
6823
6925
  filelist: {
6824
6926
  test: function test(x) {
6825
- return typeson.toStringTag(x) === 'FileList';
6927
+ return Typeson.toStringTag(x) === 'FileList';
6826
6928
  },
6827
6929
  replace: function replace(fl) {
6828
6930
  var arr = [];
@@ -6837,7 +6939,7 @@
6837
6939
  /**
6838
6940
  * `FileList` polyfill.
6839
6941
  */
6840
- var FileList = /*#__PURE__*/function () {
6942
+ var FileList = /*#__PURE__*/function (_Symbol$toStringTag) {
6841
6943
  /**
6842
6944
  * Set private properties and length.
6843
6945
  */
@@ -6866,7 +6968,7 @@
6866
6968
  */
6867
6969
 
6868
6970
  }, {
6869
- key: Symbol.toStringTag,
6971
+ key: _Symbol$toStringTag,
6870
6972
  get: function get() {
6871
6973
  /* eslint-enable class-methods-use-this */
6872
6974
  return 'FileList';
@@ -6874,7 +6976,7 @@
6874
6976
  }]);
6875
6977
 
6876
6978
  return FileList;
6877
- }();
6979
+ }(Symbol.toStringTag);
6878
6980
 
6879
6981
  return new FileList(o);
6880
6982
  }
@@ -6885,7 +6987,7 @@
6885
6987
  var imagebitmap = {
6886
6988
  imagebitmap: {
6887
6989
  test: function test(x) {
6888
- return typeson.toStringTag(x) === 'ImageBitmap' || // In Node, our polyfill sets the dataset on a canvas
6990
+ return Typeson.toStringTag(x) === 'ImageBitmap' || // In Node, our polyfill sets the dataset on a canvas
6889
6991
  // element as JSDom no longer allows overriding toStringTag
6890
6992
  x && x.dataset && x.dataset.toStringTag === 'ImageBitmap';
6891
6993
  },
@@ -6941,7 +7043,7 @@
6941
7043
  var imagedata = {
6942
7044
  imagedata: {
6943
7045
  test: function test(x) {
6944
- return typeson.toStringTag(x) === 'ImageData';
7046
+ return Typeson.toStringTag(x) === 'ImageData';
6945
7047
  },
6946
7048
  replace: function replace(d) {
6947
7049
  return {
@@ -6960,20 +7062,20 @@
6960
7062
  var infinity = {
6961
7063
  infinity: {
6962
7064
  test: function test(x) {
6963
- return x === Infinity;
7065
+ return x === Number.POSITIVE_INFINITY;
6964
7066
  },
6965
7067
  replace: function replace(n) {
6966
7068
  return 'Infinity';
6967
7069
  },
6968
7070
  revive: function revive(s) {
6969
- return Infinity;
7071
+ return Number.POSITIVE_INFINITY;
6970
7072
  }
6971
7073
  }
6972
7074
  };
6973
7075
 
6974
7076
  var IntlCollator = {
6975
7077
  test: function test(x) {
6976
- return typeson.hasConstructorOf(x, Intl.Collator);
7078
+ return Typeson.hasConstructorOf(x, Intl.Collator);
6977
7079
  },
6978
7080
  replace: function replace(c) {
6979
7081
  return c.resolvedOptions();
@@ -6984,7 +7086,7 @@
6984
7086
  };
6985
7087
  var IntlDateTimeFormat = {
6986
7088
  test: function test(x) {
6987
- return typeson.hasConstructorOf(x, Intl.DateTimeFormat);
7089
+ return Typeson.hasConstructorOf(x, Intl.DateTimeFormat);
6988
7090
  },
6989
7091
  replace: function replace(dtf) {
6990
7092
  return dtf.resolvedOptions();
@@ -6995,7 +7097,7 @@
6995
7097
  };
6996
7098
  var IntlNumberFormat = {
6997
7099
  test: function test(x) {
6998
- return typeson.hasConstructorOf(x, Intl.NumberFormat);
7100
+ return Typeson.hasConstructorOf(x, Intl.NumberFormat);
6999
7101
  },
7000
7102
  replace: function replace(nf) {
7001
7103
  return nf.resolvedOptions();
@@ -7010,10 +7112,10 @@
7010
7112
  IntlNumberFormat: IntlNumberFormat
7011
7113
  };
7012
7114
 
7013
- var map$1 = {
7115
+ var map = {
7014
7116
  map: {
7015
7117
  test: function test(x) {
7016
- return typeson.toStringTag(x) === 'Map';
7118
+ return Typeson.toStringTag(x) === 'Map';
7017
7119
  },
7018
7120
  replace: function replace(mp) {
7019
7121
  return _toConsumableArray(mp.entries());
@@ -7041,13 +7143,13 @@
7041
7143
  var negativeInfinity = {
7042
7144
  negativeInfinity: {
7043
7145
  test: function test(x) {
7044
- return x === -Infinity;
7146
+ return x === Number.NEGATIVE_INFINITY;
7045
7147
  },
7046
7148
  replace: function replace(n) {
7047
7149
  return '-Infinity';
7048
7150
  },
7049
7151
  revive: function revive(s) {
7050
- return -Infinity;
7152
+ return Number.NEGATIVE_INFINITY;
7051
7153
  }
7052
7154
  }
7053
7155
  };
@@ -7055,10 +7157,10 @@
7055
7157
  var nonbuiltinIgnore = {
7056
7158
  nonbuiltinIgnore: {
7057
7159
  test: function test(x) {
7058
- return x && _typeof(x) === 'object' && !Array.isArray(x) && !['Object', // `Proxy` and `Reflect`, two other built-in objects, will also
7160
+ return x && _typeof$1(x) === 'object' && !Array.isArray(x) && !['Object', // `Proxy` and `Reflect`, two other built-in objects, will also
7059
7161
  // have a `toStringTag` of `Object`; we don't want built-in
7060
7162
  // function objects, however
7061
- 'Boolean', 'Number', 'String', 'Error', 'RegExp', 'Math', 'Date', 'Map', 'Set', 'JSON', 'ArrayBuffer', 'SharedArrayBuffer', 'DataView', 'Int8Array', 'Uint8Array', 'Uint8ClampedArray', 'Int16Array', 'Uint16Array', 'Int32Array', 'Uint32Array', 'Float32Array', 'Float64Array', 'Promise', 'String Iterator', 'Array Iterator', 'Map Iterator', 'Set Iterator', 'WeakMap', 'WeakSet', 'Atomics', 'Module'].includes(typeson.toStringTag(x));
7163
+ 'Boolean', 'Number', 'String', 'Error', 'RegExp', 'Math', 'Date', 'Map', 'Set', 'JSON', 'ArrayBuffer', 'SharedArrayBuffer', 'DataView', 'Int8Array', 'Uint8Array', 'Uint8ClampedArray', 'Int16Array', 'Uint16Array', 'Int32Array', 'Uint32Array', 'Float32Array', 'Float64Array', 'Promise', 'String Iterator', 'Array Iterator', 'Map Iterator', 'Set Iterator', 'WeakMap', 'WeakSet', 'Atomics', 'Module'].includes(Typeson.toStringTag(x));
7062
7164
  },
7063
7165
  replace: function replace(rexp) {// Not in use
7064
7166
  }
@@ -7069,7 +7171,7 @@
7069
7171
  // String Object (not primitive string which need no type spec)
7070
7172
  StringObject: {
7071
7173
  test: function test(x) {
7072
- return typeson.toStringTag(x) === 'String' && _typeof(x) === 'object';
7174
+ return Typeson.toStringTag(x) === 'String' && _typeof$1(x) === 'object';
7073
7175
  },
7074
7176
  replace: function replace(s) {
7075
7177
  return String(s);
@@ -7083,7 +7185,7 @@
7083
7185
  // Boolean Object (not primitive boolean which need no type spec)
7084
7186
  BooleanObject: {
7085
7187
  test: function test(x) {
7086
- return typeson.toStringTag(x) === 'Boolean' && _typeof(x) === 'object';
7188
+ return Typeson.toStringTag(x) === 'Boolean' && _typeof$1(x) === 'object';
7087
7189
  },
7088
7190
  replace: function replace(b) {
7089
7191
  return Boolean(b);
@@ -7097,7 +7199,7 @@
7097
7199
  // Number Object (not primitive number which need no type spec)
7098
7200
  NumberObject: {
7099
7201
  test: function test(x) {
7100
- return typeson.toStringTag(x) === 'Number' && _typeof(x) === 'object';
7202
+ return Typeson.toStringTag(x) === 'Number' && _typeof$1(x) === 'object';
7101
7203
  },
7102
7204
  replace: function replace(n) {
7103
7205
  return Number(n);
@@ -7113,7 +7215,7 @@
7113
7215
  var regexp = {
7114
7216
  regexp: {
7115
7217
  test: function test(x) {
7116
- return typeson.toStringTag(x) === 'RegExp';
7218
+ return Typeson.toStringTag(x) === 'RegExp';
7117
7219
  },
7118
7220
  replace: function replace(rexp) {
7119
7221
  return {
@@ -7133,7 +7235,7 @@
7133
7235
  var resurrectable = {
7134
7236
  resurrectable: {
7135
7237
  test: function test(x) {
7136
- return x && !Array.isArray(x) && ['object', 'function', 'symbol'].includes(_typeof(x));
7238
+ return x && !Array.isArray(x) && ['object', 'function', 'symbol'].includes(_typeof$1(x));
7137
7239
  },
7138
7240
  replace: function replace(rsrrctble) {
7139
7241
  var uuid = generateUUID();
@@ -7149,7 +7251,7 @@
7149
7251
  var set = {
7150
7252
  set: {
7151
7253
  test: function test(x) {
7152
- return typeson.toStringTag(x) === 'Set';
7254
+ return Typeson.toStringTag(x) === 'Set';
7153
7255
  },
7154
7256
  replace: function replace(st) {
7155
7257
  return _toConsumableArray(st.values());
@@ -7162,7 +7264,7 @@
7162
7264
 
7163
7265
  /* istanbul ignore next */
7164
7266
 
7165
- var _global$1 = typeof self === 'undefined' ? global$2 : self; // Support all kinds of typed arrays (views of ArrayBuffers)
7267
+ var _global$1 = typeof self === 'undefined' ? global$1 : self; // Support all kinds of typed arrays (views of ArrayBuffers)
7166
7268
 
7167
7269
 
7168
7270
  var typedArraysSocketIO = {};
@@ -7177,7 +7279,7 @@
7177
7279
 
7178
7280
  typedArraysSocketIO[typeName.toLowerCase()] = {
7179
7281
  test: function test(x) {
7180
- return typeson.toStringTag(x) === arrType;
7282
+ return Typeson.toStringTag(x) === arrType;
7181
7283
  },
7182
7284
  replace: function replace(a) {
7183
7285
  return (a.byteOffset === 0 && a.byteLength === a.buffer.byteLength ? a // socket.io supports streaming ArrayBuffers.
@@ -7193,19 +7295,19 @@
7193
7295
  // get here is an ArrayBuffer
7194
7296
  // If not, let's assume user wants to receive it as
7195
7297
  // configured with socket.io.
7196
- return typeson.toStringTag(buf) === 'ArrayBuffer' ? new TypedArray(buf) : buf;
7298
+ return Typeson.toStringTag(buf) === 'ArrayBuffer' ? new TypedArray(buf) : buf;
7197
7299
  }
7198
7300
  };
7199
7301
  });
7200
7302
 
7201
7303
  /* istanbul ignore next */
7202
7304
 
7203
- var _global$2 = typeof self === 'undefined' ? global$2 : self;
7305
+ var _global = typeof self === 'undefined' ? global$1 : self;
7204
7306
 
7205
7307
  var typedArrays = {};
7206
7308
  ['Int8Array', 'Uint8Array', 'Uint8ClampedArray', 'Int16Array', 'Uint16Array', 'Int32Array', 'Uint32Array', 'Float32Array', 'Float64Array'].forEach(function (typeName) {
7207
7309
  var arrType = typeName;
7208
- var TypedArray = _global$2[arrType];
7310
+ var TypedArray = _global[arrType];
7209
7311
  /* istanbul ignore if */
7210
7312
 
7211
7313
  if (!TypedArray) {
@@ -7214,7 +7316,7 @@
7214
7316
 
7215
7317
  typedArrays[typeName.toLowerCase()] = {
7216
7318
  test: function test(x) {
7217
- return typeson.toStringTag(x) === arrType;
7319
+ return Typeson.toStringTag(x) === arrType;
7218
7320
  },
7219
7321
  replace: function replace(_ref, stateObj) {
7220
7322
  var buffer = _ref.buffer,
@@ -7237,7 +7339,7 @@
7237
7339
 
7238
7340
  stateObj.buffers.push(buffer);
7239
7341
  return {
7240
- encoded: encode(buffer),
7342
+ encoded: encode$1(buffer),
7241
7343
  byteOffset: byteOffset,
7242
7344
  length: l
7243
7345
  };
@@ -7256,7 +7358,7 @@
7256
7358
  if ('index' in b64Obj) {
7257
7359
  buffer = stateObj.buffers[index];
7258
7360
  } else {
7259
- buffer = decode(encoded);
7361
+ buffer = decode$1(encoded);
7260
7362
  stateObj.buffers.push(buffer);
7261
7363
  }
7262
7364
 
@@ -7266,7 +7368,7 @@
7266
7368
  });
7267
7369
 
7268
7370
  // This does not preserve `undefined` in sparse arrays; see the `undefined`
7269
- var undef = {
7371
+ var undef$1 = {
7270
7372
  undef: {
7271
7373
  test: function test(x, stateObj) {
7272
7374
  return typeof x === 'undefined' && (stateObj.ownKeys || !('ownKeys' in stateObj));
@@ -7277,7 +7379,7 @@
7277
7379
  revive: function revive(s) {
7278
7380
  // Will add `undefined` (returning `undefined` would instead
7279
7381
  // avoid explicitly setting)
7280
- return new typeson.Undefined();
7382
+ return new Typeson.Undefined();
7281
7383
  }
7282
7384
  }
7283
7385
  };
@@ -7285,7 +7387,7 @@
7285
7387
  var userObject = {
7286
7388
  userObject: {
7287
7389
  test: function test(x, stateObj) {
7288
- return typeson.isUserObject(x);
7390
+ return Typeson.isUserObject(x);
7289
7391
  },
7290
7392
  replace: function replace(n) {
7291
7393
  return _objectSpread2({}, n);
@@ -7378,11 +7480,11 @@
7378
7480
 
7379
7481
  Symbols are similarly not included.
7380
7482
  */
7381
- var expObj = [undef, // ES5
7483
+ var expObj$1 = [undef$1, // ES5
7382
7484
  arrayNonindexKeys, primitiveObjects, specialNumbers, date, error, errors, regexp].concat( // ES2015 (ES6)
7383
7485
 
7384
7486
  /* istanbul ignore next */
7385
- typeof Map === 'function' ? map$1 : [],
7487
+ typeof Map === 'function' ? map : [],
7386
7488
  /* istanbul ignore next */
7387
7489
  typeof Set === 'function' ? set : [],
7388
7490
  /* istanbul ignore next */
@@ -7413,7 +7515,7 @@
7413
7515
  */
7414
7516
  var postmessage = [error, errors];
7415
7517
 
7416
- var socketio = [expObj, // Leave ArrayBuffer as is, and let socket.io stream it instead.
7518
+ var socketio = [expObj$1, // Leave ArrayBuffer as is, and let socket.io stream it instead.
7417
7519
  {
7418
7520
  arraybuffer: null
7419
7521
  }, // Encapsulate TypedArrays in ArrayBuffers instead of base64 strings.
@@ -7446,16 +7548,16 @@
7446
7548
  }];
7447
7549
 
7448
7550
  /* This preset includes types for the Structured Cloning Algorithm. */
7449
- var expObj$1 = [// Todo: Might also register synchronous `ImageBitmap` and
7551
+ var expObj = [// Todo: Might also register synchronous `ImageBitmap` and
7450
7552
  // `Blob`/`File`/`FileList`?
7451
7553
  // ES5
7452
7554
  userObject, // Processed last (non-builtin)
7453
- undef, arrayNonindexKeys, primitiveObjects, specialNumbers, date, regexp, // Non-built-ins
7555
+ undef$1, arrayNonindexKeys, primitiveObjects, specialNumbers, date, regexp, // Non-built-ins
7454
7556
  imagedata, imagebitmap, // Async return
7455
7557
  file, filelist, blob].concat( // ES2015 (ES6)
7456
7558
 
7457
7559
  /* istanbul ignore next */
7458
- typeof Map === 'function' ? map$1 : [],
7560
+ typeof Map === 'function' ? map : [],
7459
7561
  /* istanbul ignore next */
7460
7562
  typeof Set === 'function' ? set : [],
7461
7563
  /* istanbul ignore next */
@@ -7467,9 +7569,11 @@
7467
7569
  /* istanbul ignore next */
7468
7570
  typeof Intl !== 'undefined' ? intlTypes : [],
7469
7571
  /* istanbul ignore next */
7572
+ typeof crypto !== 'undefined' ? cryptokey : [],
7573
+ /* istanbul ignore next */
7470
7574
  typeof BigInt !== 'undefined' ? [bigint, bigintObject] : []);
7471
7575
 
7472
- var structuredCloningThrowing = expObj$1.concat({
7576
+ var structuredCloningThrowing = expObj.concat({
7473
7577
  checkDataCloneException: {
7474
7578
  test: function test(val) {
7475
7579
  // Should also throw with:
@@ -7497,7 +7601,7 @@
7497
7601
  if ([// Symbol's `toStringTag` is only "Symbol" for its initial
7498
7602
  // value, so we check `typeof`
7499
7603
  'symbol', // All functions including bound function exotic objects
7500
- 'function'].includes(_typeof(val)) || [// A non-array exotic object
7604
+ 'function'].includes(_typeof$1(val)) || [// A non-array exotic object
7501
7605
  'Arguments', // A non-array exotic object
7502
7606
  'Module', // `Error` and other errors have the [[ErrorData]] internal
7503
7607
  // slot and give "Error"
@@ -7515,7 +7619,7 @@
7515
7619
  ((stringTag === 'Blob' || stringTag === 'File') &&
7516
7620
  val.isClosed) ||
7517
7621
  */
7518
- val && _typeof(val) === 'object' && // Duck-type DOM node objects (non-array exotic?
7622
+ val && _typeof$1(val) === 'object' && // Duck-type DOM node objects (non-array exotic?
7519
7623
  // objects which cannot be cloned by the SCA)
7520
7624
  typeof val.nodeType === 'number' && typeof val.insertBefore === 'function') {
7521
7625
  throw new DOMException('The object cannot be cloned.', 'DataCloneError');
@@ -7526,19 +7630,20 @@
7526
7630
  }
7527
7631
  });
7528
7632
 
7529
- var undef$1 = [sparseUndefined, undef];
7633
+ var undef = [sparseUndefined, undef$1];
7530
7634
 
7531
- var universal = [expObj // TODO: Add types that are de-facto universal even though not
7635
+ var universal = [expObj$1 // TODO: Add types that are de-facto universal even though not
7532
7636
  // built-in into ecmasript standard.
7533
7637
  ];
7534
7638
 
7535
7639
  // This file is auto-generated from `build.js`
7536
- typeson.types = {
7640
+ Typeson.types = {
7537
7641
  arraybuffer: arraybuffer,
7538
7642
  bigintObject: bigintObject,
7539
7643
  bigint: bigint,
7540
7644
  blob: blob,
7541
7645
  cloneable: cloneable,
7646
+ cryptokey: cryptokey,
7542
7647
  dataview: dataview,
7543
7648
  date: date,
7544
7649
  error: error,
@@ -7549,7 +7654,7 @@
7549
7654
  imagedata: imagedata,
7550
7655
  infinity: infinity,
7551
7656
  intlTypes: intlTypes,
7552
- map: map$1,
7657
+ map: map,
7553
7658
  nan: nan,
7554
7659
  negativeInfinity: negativeInfinity,
7555
7660
  nonbuiltinIgnore: nonbuiltinIgnore,
@@ -7559,44 +7664,44 @@
7559
7664
  set: set,
7560
7665
  typedArraysSocketio: typedArraysSocketIO,
7561
7666
  typedArrays: typedArrays,
7562
- undef: undef,
7667
+ undef: undef$1,
7563
7668
  userObject: userObject
7564
7669
  };
7565
- typeson.presets = {
7670
+ Typeson.presets = {
7566
7671
  arrayNonindexKeys: arrayNonindexKeys,
7567
- builtin: expObj,
7672
+ builtin: expObj$1,
7568
7673
  postmessage: postmessage,
7569
7674
  socketio: socketio,
7570
7675
  sparseUndefined: sparseUndefined,
7571
7676
  specialNumbers: specialNumbers,
7572
7677
  structuredCloningThrowing: structuredCloningThrowing,
7573
- structuredCloning: expObj$1,
7574
- undef: undef$1,
7678
+ structuredCloning: expObj,
7679
+ undef: undef,
7575
7680
  universal: universal
7576
7681
  };
7577
7682
 
7578
- var typeson$1 = new typeson().register(typeson.presets.structuredCloningThrowing);
7683
+ var typeson = new Typeson().register(Typeson.presets.structuredCloningThrowing);
7579
7684
 
7580
7685
  function register(func) {
7581
- typeson$1 = new typeson().register(func(typeson.presets.structuredCloningThrowing));
7686
+ typeson = new Typeson().register(func(Typeson.presets.structuredCloningThrowing));
7582
7687
  } // We are keeping the callback approach for now in case we wish to reexpose
7583
7688
  // `Blob`, `File`, `FileList` asynchronously (though in such a case, we
7584
7689
  // should probably refactor as a Promise)
7585
7690
 
7586
7691
 
7587
- function encode$1(obj, func) {
7692
+ function encode(obj, func) {
7588
7693
  var ret;
7589
7694
 
7590
7695
  try {
7591
7696
  // eslint-disable-next-line node/no-sync
7592
- ret = typeson$1.stringifySync(obj);
7697
+ ret = typeson.stringifySync(obj);
7593
7698
  } catch (err) {
7594
7699
  // SCA in typeson-registry using `DOMException` which is not defined (e.g., in Node)
7595
- if (typeson.hasConstructorOf(err, ReferenceError) || // SCA in typeson-registry threw a cloning error and we are in a
7700
+ if (Typeson.hasConstructorOf(err, ReferenceError) || // SCA in typeson-registry threw a cloning error and we are in a
7596
7701
  // supporting environment (e.g., the browser) where `ShimDOMException` is
7597
7702
  // an alias for `DOMException`; if typeson-registry ever uses our shim
7598
7703
  // to throw, we can use this condition alone.
7599
- typeson.hasConstructorOf(err, ShimDOMException$1)) {
7704
+ Typeson.hasConstructorOf(err, ShimDOMException)) {
7600
7705
  throw createDOMException('DataCloneError', 'The object cannot be cloned.');
7601
7706
  } // We should rethrow non-cloning exceptions like from
7602
7707
  // throwing getters (as in the W3C test, key-conversion-exceptions.htm)
@@ -7609,25 +7714,25 @@
7609
7714
  return ret;
7610
7715
  }
7611
7716
 
7612
- function decode$1(obj) {
7613
- return typeson$1.parse(obj);
7717
+ function decode(obj) {
7718
+ return typeson.parse(obj);
7614
7719
  }
7615
7720
 
7616
7721
  function clone(val) {
7617
7722
  // We don't return the intermediate `encode` as we'll need to reencode
7618
7723
  // the clone as it may differ
7619
- return decode$1(encode$1(val));
7724
+ return decode(encode(val));
7620
7725
  }
7621
7726
 
7622
7727
  var Sca = /*#__PURE__*/Object.freeze({
7623
7728
  __proto__: null,
7624
- encode: encode$1,
7625
- decode: decode$1,
7729
+ encode: encode,
7730
+ decode: decode,
7626
7731
  clone: clone,
7627
7732
  register: register
7628
7733
  });
7629
7734
 
7630
- var readonlyProperties$4 = ['objectStore', 'keyPath', 'multiEntry', 'unique'];
7735
+ var readonlyProperties$2 = ['objectStore', 'keyPath', 'multiEntry', 'unique'];
7631
7736
  /* eslint-disable jsdoc/check-param-names */
7632
7737
 
7633
7738
  /**
@@ -7649,7 +7754,7 @@
7649
7754
  function IDBIndex() {
7650
7755
  var me = this;
7651
7756
  me[Symbol.toStringTag] = 'IDBIndex';
7652
- defineReadonlyProperties(me, readonlyProperties$4);
7757
+ defineReadonlyProperties(me, readonlyProperties$2);
7653
7758
  me.__objectStore = store;
7654
7759
  me.__name = me.__originalName = indexProperties.columnName;
7655
7760
  me.__keyPath = Array.isArray(indexProperties.keyPath) ? indexProperties.keyPath.slice() : indexProperties.keyPath;
@@ -7798,7 +7903,7 @@
7798
7903
  function addIndexEntry(i) {
7799
7904
  if (i < data.rows.length) {
7800
7905
  try {
7801
- var value = decode$1(unescapeSQLiteResponse(data.rows.item(i).value));
7906
+ var value = decode(unescapeSQLiteResponse(data.rows.item(i).value));
7802
7907
  var indexKey = extractKeyValueDecodedFromValueUsingKeyPath(value, index.keyPath, index.multiEntry); // Todo: Do we need this stricter error checking?
7803
7908
 
7804
7909
  if (indexKey.invalid || indexKey.failure) {
@@ -8007,9 +8112,9 @@
8007
8112
  */
8008
8113
 
8009
8114
 
8010
- IDBIndex.prototype.openCursor = function ()
8011
- /* query, direction */
8012
- {
8115
+ IDBIndex.prototype.openCursor = function
8116
+ /* query, direction */
8117
+ () {
8013
8118
  /* eslint-enable jsdoc/check-param-names */
8014
8119
  var me = this; // eslint-disable-next-line prefer-rest-params
8015
8120
 
@@ -8033,9 +8138,9 @@
8033
8138
  */
8034
8139
 
8035
8140
 
8036
- IDBIndex.prototype.openKeyCursor = function ()
8037
- /* query, direction */
8038
- {
8141
+ IDBIndex.prototype.openKeyCursor = function
8142
+ /* query, direction */
8143
+ () {
8039
8144
  /* eslint-enable jsdoc/check-param-names */
8040
8145
  var me = this; // eslint-disable-next-line prefer-rest-params
8041
8146
 
@@ -8068,9 +8173,9 @@
8068
8173
  return this.__fetchIndexData(query, 'key', true);
8069
8174
  };
8070
8175
 
8071
- IDBIndex.prototype.getAll = function ()
8072
- /* query, count */
8073
- {
8176
+ IDBIndex.prototype.getAll = function
8177
+ /* query, count */
8178
+ () {
8074
8179
  // eslint-disable-next-line prefer-rest-params
8075
8180
  var _arguments3 = Array.prototype.slice.call(arguments),
8076
8181
  query = _arguments3[0],
@@ -8079,9 +8184,9 @@
8079
8184
  return this.__fetchIndexData(query, 'value', false, count);
8080
8185
  };
8081
8186
 
8082
- IDBIndex.prototype.getAllKeys = function ()
8083
- /* query, count */
8084
- {
8187
+ IDBIndex.prototype.getAllKeys = function
8188
+ /* query, count */
8189
+ () {
8085
8190
  // eslint-disable-next-line prefer-rest-params
8086
8191
  var _arguments4 = Array.prototype.slice.call(arguments),
8087
8192
  query = _arguments4[0],
@@ -8090,9 +8195,9 @@
8090
8195
  return this.__fetchIndexData(query, 'key', false, count);
8091
8196
  };
8092
8197
 
8093
- IDBIndex.prototype.count = function ()
8094
- /* query */
8095
- {
8198
+ IDBIndex.prototype.count = function
8199
+ /* query */
8200
+ () {
8096
8201
  var me = this; // eslint-disable-next-line prefer-rest-params
8097
8202
 
8098
8203
  var query = arguments[0]; // With the exception of needing to check whether the index has been
@@ -8208,7 +8313,7 @@
8208
8313
  return isObj(obj) && typeof obj.openCursor === 'function' && typeof obj.multiEntry === 'boolean';
8209
8314
  }
8210
8315
  });
8211
- defineReadonlyOuterInterface(IDBIndex.prototype, readonlyProperties$4);
8316
+ defineReadonlyOuterInterface(IDBIndex.prototype, readonlyProperties$2);
8212
8317
  defineOuterInterface(IDBIndex.prototype, ['name']);
8213
8318
  IDBIndex.prototype[Symbol.toStringTag] = 'IDBIndexPrototype';
8214
8319
  Object.defineProperty(IDBIndex, 'prototype', {
@@ -8229,14 +8334,14 @@
8229
8334
  tx.executeSql(sql.join(' '), sqlValues, function (tx, data) {
8230
8335
  var records = [];
8231
8336
  var recordCount = 0;
8232
- var decode = isCount ? function () {
8337
+ var decode$1 = isCount ? function () {
8233
8338
  /* */
8234
8339
  } : opType === 'key' ? function (record) {
8235
8340
  // Key.convertValueToKey(record.key); // Already validated before storage
8236
8341
  return _decode(unescapeSQLiteResponse(record.key));
8237
8342
  } : function (record) {
8238
8343
  // when opType is value
8239
- return decode$1(unescapeSQLiteResponse(record.value));
8344
+ return decode(unescapeSQLiteResponse(record.value));
8240
8345
  };
8241
8346
 
8242
8347
  if (index.multiEntry) {
@@ -8262,7 +8367,7 @@
8262
8367
  }
8263
8368
 
8264
8369
  if (record) {
8265
- records.push(decode(record));
8370
+ records.push(decode$1(record));
8266
8371
 
8267
8372
  if (unboundedDisallowed) {
8268
8373
  return "break";
@@ -8280,7 +8385,7 @@
8280
8385
  var record = data.rows.item(_i);
8281
8386
 
8282
8387
  if (record) {
8283
- records.push(decode(record));
8388
+ records.push(decode$1(record));
8284
8389
  }
8285
8390
  }
8286
8391
 
@@ -8325,7 +8430,7 @@
8325
8430
  return [nullDisallowed, index, hasRange, range, opType, multiChecks, sql, sqlValues];
8326
8431
  }
8327
8432
 
8328
- var readonlyProperties$5 = ['keyPath', 'indexNames', 'transaction', 'autoIncrement'];
8433
+ var readonlyProperties$1 = ['keyPath', 'indexNames', 'transaction', 'autoIncrement'];
8329
8434
  /* eslint-disable jsdoc/check-param-names */
8330
8435
 
8331
8436
  /**
@@ -8347,7 +8452,7 @@
8347
8452
  function IDBObjectStore() {
8348
8453
  var me = this;
8349
8454
  me[Symbol.toStringTag] = 'IDBObjectStore';
8350
- defineReadonlyProperties(this, readonlyProperties$5);
8455
+ defineReadonlyProperties(this, readonlyProperties$1);
8351
8456
  me.__name = me.__originalName = storeProperties.name;
8352
8457
  me.__keyPath = Array.isArray(storeProperties.keyPath) ? storeProperties.keyPath.slice() : storeProperties.keyPath;
8353
8458
  me.__transaction = transaction;
@@ -8681,8 +8786,8 @@
8681
8786
 
8682
8787
  function keyCloneThenSuccess(oldCn) {
8683
8788
  // We want to return the original key, so we don't need to accept an argument here
8684
- encode$1(key, function (key) {
8685
- key = decode$1(key);
8789
+ encode(key, function (key) {
8790
+ key = decode(key);
8686
8791
  success(key, oldCn);
8687
8792
  });
8688
8793
  }
@@ -8821,7 +8926,8 @@
8821
8926
  return undefined;
8822
8927
  })["catch"](function (err) {
8823
8928
  function fail() {
8824
- // Todo: Add a different error object here if `assignCurrentNumber` fails in reverting?
8929
+ // Todo: Add a different error object here if `assignCurrentNumber`
8930
+ // fails in reverting?
8825
8931
  error(err);
8826
8932
  }
8827
8933
 
@@ -8922,7 +9028,7 @@
8922
9028
 
8923
9029
  store.transaction.__pushToQueue(request, function (tx, args, success, error) {
8924
9030
  store.__deriveKey(tx, value, key, function (clonedKeyOrCurrentNumber, oldCn) {
8925
- encode$1(value, function (encoded) {
9031
+ encode(value, function (encoded) {
8926
9032
  function insert(tx) {
8927
9033
  store.__insertData(tx, encoded, value, clonedKeyOrCurrentNumber, oldCn, function () {
8928
9034
  if (invalidateCache) {
@@ -9008,7 +9114,7 @@
9008
9114
  }
9009
9115
  } else {
9010
9116
  for (var _i = 0; _i < data.rows.length; _i++) {
9011
- ret.push(decode$1(unescapeSQLiteResponse(data.rows.item(_i).value)));
9117
+ ret.push(decode(unescapeSQLiteResponse(data.rows.item(_i).value)));
9012
9118
  }
9013
9119
  }
9014
9120
 
@@ -9043,9 +9149,9 @@
9043
9149
  return this.__get(query, true);
9044
9150
  };
9045
9151
 
9046
- IDBObjectStore.prototype.getAll = function ()
9047
- /* query, count */
9048
- {
9152
+ IDBObjectStore.prototype.getAll = function
9153
+ /* query, count */
9154
+ () {
9049
9155
  // eslint-disable-next-line prefer-rest-params
9050
9156
  var _arguments = Array.prototype.slice.call(arguments),
9051
9157
  query = _arguments[0],
@@ -9054,9 +9160,9 @@
9054
9160
  return this.__get(query, false, true, count);
9055
9161
  };
9056
9162
 
9057
- IDBObjectStore.prototype.getAllKeys = function ()
9058
- /* query, count */
9059
- {
9163
+ IDBObjectStore.prototype.getAllKeys = function
9164
+ /* query, count */
9165
+ () {
9060
9166
  // eslint-disable-next-line prefer-rest-params
9061
9167
  var _arguments2 = Array.prototype.slice.call(arguments),
9062
9168
  query = _arguments2[0],
@@ -9133,9 +9239,9 @@
9133
9239
  }, undefined, me);
9134
9240
  };
9135
9241
 
9136
- IDBObjectStore.prototype.count = function ()
9137
- /* query */
9138
- {
9242
+ IDBObjectStore.prototype.count = function
9243
+ /* query */
9244
+ () {
9139
9245
  var me = this; // eslint-disable-next-line prefer-rest-params
9140
9246
 
9141
9247
  var query = arguments[0];
@@ -9152,9 +9258,9 @@
9152
9258
  return IDBCursorWithValue.__createInstance(query, 'next', me, me, 'key', 'value', true).__request;
9153
9259
  };
9154
9260
 
9155
- IDBObjectStore.prototype.openCursor = function ()
9156
- /* query, direction */
9157
- {
9261
+ IDBObjectStore.prototype.openCursor = function
9262
+ /* query, direction */
9263
+ () {
9158
9264
  var me = this; // eslint-disable-next-line prefer-rest-params
9159
9265
 
9160
9266
  var _arguments3 = Array.prototype.slice.call(arguments),
@@ -9174,9 +9280,9 @@
9174
9280
  return cursor.__request;
9175
9281
  };
9176
9282
 
9177
- IDBObjectStore.prototype.openKeyCursor = function ()
9178
- /* query, direction */
9179
- {
9283
+ IDBObjectStore.prototype.openKeyCursor = function
9284
+ /* query, direction */
9285
+ () {
9180
9286
  var me = this;
9181
9287
 
9182
9288
  if (!(me instanceof IDBObjectStore)) {
@@ -9278,7 +9384,7 @@
9278
9384
  }
9279
9385
 
9280
9386
  optionalParameters = optionalParameters || {};
9281
- /** @name IDBIndexProperties **/
9387
+ /** @name IDBIndexProperties */
9282
9388
 
9283
9389
  var indexProperties = {
9284
9390
  columnName: indexName,
@@ -9322,7 +9428,7 @@
9322
9428
  IDBIndex.__deleteIndex(me, index);
9323
9429
  };
9324
9430
 
9325
- defineReadonlyOuterInterface(IDBObjectStore.prototype, readonlyProperties$5);
9431
+ defineReadonlyOuterInterface(IDBObjectStore.prototype, readonlyProperties$1);
9326
9432
  defineOuterInterface(IDBObjectStore.prototype, ['name']);
9327
9433
  IDBObjectStore.prototype[Symbol.toStringTag] = 'IDBObjectStorePrototype';
9328
9434
  Object.defineProperty(IDBObjectStore, 'prototype', {
@@ -9558,8 +9664,8 @@
9558
9664
  return str.substr(start, len);
9559
9665
  };
9560
9666
 
9561
- var listeners$2 = ['onabort', 'onclose', 'onerror', 'onversionchange'];
9562
- var readonlyProperties$6 = ['name', 'version', 'objectStoreNames'];
9667
+ var listeners = ['onabort', 'onclose', 'onerror', 'onversionchange'];
9668
+ var readonlyProperties = ['name', 'version', 'objectStoreNames'];
9563
9669
  /**
9564
9670
  * IDB Database Object.
9565
9671
  * @see http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#database-interface
@@ -9577,14 +9683,14 @@
9577
9683
  var _this = this;
9578
9684
 
9579
9685
  this[Symbol.toStringTag] = 'IDBDatabase';
9580
- defineReadonlyProperties(this, readonlyProperties$6);
9686
+ defineReadonlyProperties(this, readonlyProperties);
9581
9687
  this.__db = db;
9582
9688
  this.__closePending = false;
9583
9689
  this.__oldVersion = oldVersion;
9584
9690
  this.__version = version;
9585
9691
  this.__name = name;
9586
9692
  this.__upgradeTransaction = null;
9587
- defineListenerProperties(this, listeners$2);
9693
+ defineListenerProperties(this, listeners);
9588
9694
 
9589
9695
  this.__setOptions({
9590
9696
  legacyOutputDidListenersThrowFlag: true // Event hook for IndexedB
@@ -9683,7 +9789,7 @@
9683
9789
  if (autoInc && (keyPath === '' || Array.isArray(keyPath))) {
9684
9790
  throw createDOMException('InvalidAccessError', 'With autoIncrement set, the keyPath argument must not be an array or empty string.');
9685
9791
  }
9686
- /** @name IDBObjectStoreProperties **/
9792
+ /** @name IDBObjectStoreProperties */
9687
9793
 
9688
9794
 
9689
9795
  var storeProperties = {
@@ -9851,8 +9957,8 @@
9851
9957
  });
9852
9958
  };
9853
9959
 
9854
- defineOuterInterface(IDBDatabase.prototype, listeners$2);
9855
- defineReadonlyOuterInterface(IDBDatabase.prototype, readonlyProperties$6);
9960
+ defineOuterInterface(IDBDatabase.prototype, listeners);
9961
+ defineReadonlyOuterInterface(IDBDatabase.prototype, readonlyProperties);
9856
9962
  Object.defineProperty(IDBDatabase.prototype, 'constructor', {
9857
9963
  enumerable: false,
9858
9964
  writable: true,
@@ -9870,7 +9976,7 @@
9870
9976
  };
9871
9977
 
9872
9978
  var getOrigin = function getOrigin() {
9873
- return (typeof location === "undefined" ? "undefined" : _typeof(location)) !== 'object' || !location ? 'null' : location.origin;
9979
+ return (typeof location === "undefined" ? "undefined" : _typeof$1(location)) !== 'object' || !location ? 'null' : location.origin;
9874
9980
  };
9875
9981
 
9876
9982
  var hasNullOrigin = function hasNullOrigin() {
@@ -10832,9 +10938,7 @@
10832
10938
  return _construct(IDBCursor, args);
10833
10939
  };
10834
10940
 
10835
- IDBCursor.prototype.__find = function ()
10836
- /* key, tx, success, error, recordsToLoad */
10837
- {
10941
+ IDBCursor.prototype.__find = function () {
10838
10942
  if (this.__multiEntryIndex) {
10839
10943
  this.__findMultiEntry.apply(this, arguments);
10840
10944
  } else {
@@ -11246,9 +11350,9 @@
11246
11350
  });
11247
11351
  };
11248
11352
 
11249
- IDBCursor.prototype["continue"] = function ()
11250
- /* key */
11251
- {
11353
+ IDBCursor.prototype["continue"] = function
11354
+ /* key */
11355
+ () {
11252
11356
  // eslint-disable-next-line prefer-rest-params
11253
11357
  this.__continue(arguments[0]);
11254
11358
  };
@@ -11285,8 +11389,8 @@
11285
11389
  }
11286
11390
 
11287
11391
  if (cmpResult === 0) {
11288
- encode$1(primaryKey, function (encPrimaryKey) {
11289
- encode$1(me.primaryKey, function (encObjectStorePos) {
11392
+ encode(primaryKey, function (encPrimaryKey) {
11393
+ encode(me.primaryKey, function (encObjectStorePos) {
11290
11394
  if (encPrimaryKey === encObjectStorePos || me.direction === 'next' && encPrimaryKey < encObjectStorePos || me.direction === 'prev' && encPrimaryKey > encObjectStorePos) {
11291
11395
  throw createDOMException('DataError', 'Cannot continue the cursor in an unexpected direction');
11292
11396
  }
@@ -11443,7 +11547,7 @@
11443
11547
  });
11444
11548
 
11445
11549
  function setConfig(prop, val) {
11446
- if (prop && _typeof(prop) === 'object') {
11550
+ if (prop && _typeof$1(prop) === 'object') {
11447
11551
  Object.entries(prop).forEach(function (_ref) {
11448
11552
  var _ref2 = _slicedToArray(_ref, 2),
11449
11553
  p = _ref2[0],
@@ -11470,7 +11574,7 @@
11470
11574
  setConfig(initialConfig);
11471
11575
  }
11472
11576
 
11473
- var IDB = idb || (typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : typeof global$2 !== 'undefined' ? global$2 : {});
11577
+ var IDB = idb || (typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : typeof global$1 !== 'undefined' ? global$1 : {});
11474
11578
 
11475
11579
  function shim(name, value, propDesc) {
11476
11580
  if (!propDesc || !Object.defineProperty) {
@@ -11527,7 +11631,7 @@
11527
11631
  IDB.shimIndexedDB.__useShim = function () {
11528
11632
  function setNonIDBGlobals() {
11529
11633
  var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
11530
- shim(prefix + 'DOMException', ShimDOMException$1);
11634
+ shim(prefix + 'DOMException', ShimDOMException);
11531
11635
  shim(prefix + 'DOMStringList', DOMStringList, {
11532
11636
  enumerable: false,
11533
11637
  configurable: true,
@@ -11595,8 +11699,8 @@
11595
11699
  Object.setPrototypeOf(IDBRequest, EventTarget);
11596
11700
  Object.setPrototypeOf(IDBTransaction, EventTarget);
11597
11701
  Object.setPrototypeOf(IDBVersionChangeEvent, ShimEvent);
11598
- Object.setPrototypeOf(ShimDOMException$1, Error);
11599
- Object.setPrototypeOf(ShimDOMException$1.prototype, Error.prototype);
11702
+ Object.setPrototypeOf(ShimDOMException, Error);
11703
+ Object.setPrototypeOf(ShimDOMException.prototype, Error.prototype);
11600
11704
  setPrototypeOfCustomEvent();
11601
11705
  }
11602
11706
 
@@ -11705,5 +11809,5 @@
11705
11809
 
11706
11810
  shimIndexedDB.__setUnicodeIdentifiers();
11707
11811
 
11708
- })));
11812
+ }));
11709
11813
  //# sourceMappingURL=indexeddbshim-UnicodeIdentifiers.js.map