typeson-registry 12.0.0 → 13.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +57 -51
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +6 -1
- package/dist/index.min.js.map +1 -1
- package/dist/index.umd.cjs +724 -765
- package/dist/index.umd.cjs.map +1 -1
- package/dist/index.umd.min.cjs +7 -2
- package/dist/index.umd.min.cjs.map +1 -1
- package/dist/polyfills/createObjectURL.d.ts.map +1 -1
- package/dist/presets/array-nonindex-keys.umd.cjs +1 -1
- package/dist/presets/array-nonindex-keys.umd.cjs.map +1 -1
- package/dist/presets/builtin.umd.cjs +1 -1
- package/dist/presets/builtin.umd.cjs.map +1 -1
- package/dist/presets/postmessage.umd.cjs +1 -1
- package/dist/presets/postmessage.umd.cjs.map +1 -1
- package/dist/presets/socketio.umd.cjs +1 -1
- package/dist/presets/socketio.umd.cjs.map +1 -1
- package/dist/presets/sparse-undefined.umd.cjs +1 -1
- package/dist/presets/sparse-undefined.umd.cjs.map +1 -1
- package/dist/presets/special-numbers.umd.cjs +1 -1
- package/dist/presets/special-numbers.umd.cjs.map +1 -1
- package/dist/presets/structured-cloning-throwing.umd.cjs +2 -2
- package/dist/presets/structured-cloning-throwing.umd.cjs.map +1 -1
- package/dist/presets/structured-cloning.umd.cjs +2 -2
- package/dist/presets/structured-cloning.umd.cjs.map +1 -1
- package/dist/presets/undef.umd.cjs +1 -1
- package/dist/presets/undef.umd.cjs.map +1 -1
- package/dist/presets/universal.umd.cjs +1 -1
- package/dist/presets/universal.umd.cjs.map +1 -1
- package/dist/types/arraybuffer.umd.cjs +1 -1
- package/dist/types/arraybuffer.umd.cjs.map +1 -1
- package/dist/types/bigint-object.umd.cjs +1 -1
- package/dist/types/bigint-object.umd.cjs.map +1 -1
- package/dist/types/bigint.umd.cjs +1 -1
- package/dist/types/bigint.umd.cjs.map +1 -1
- package/dist/types/blob.umd.cjs +1 -1
- package/dist/types/blob.umd.cjs.map +1 -1
- package/dist/types/cloneable.umd.cjs +1 -1
- package/dist/types/cloneable.umd.cjs.map +1 -1
- package/dist/types/cryptokey.umd.cjs +2 -2
- package/dist/types/cryptokey.umd.cjs.map +1 -1
- package/dist/types/dataview.umd.cjs +1 -1
- package/dist/types/dataview.umd.cjs.map +1 -1
- package/dist/types/date.umd.cjs +1 -1
- package/dist/types/date.umd.cjs.map +1 -1
- package/dist/types/domexception.umd.cjs +1 -1
- package/dist/types/domexception.umd.cjs.map +1 -1
- package/dist/types/dommatrix.umd.cjs +1 -1
- package/dist/types/dommatrix.umd.cjs.map +1 -1
- package/dist/types/dompoint.umd.cjs +1 -1
- package/dist/types/dompoint.umd.cjs.map +1 -1
- package/dist/types/domquad.umd.cjs +1 -1
- package/dist/types/domquad.umd.cjs.map +1 -1
- package/dist/types/domrect.umd.cjs +1 -1
- package/dist/types/domrect.umd.cjs.map +1 -1
- package/dist/types/error.d.ts.map +1 -1
- package/dist/types/error.umd.cjs +1 -1
- package/dist/types/error.umd.cjs.map +1 -1
- package/dist/types/errors.umd.cjs +1 -1
- package/dist/types/errors.umd.cjs.map +1 -1
- package/dist/types/file.umd.cjs +1 -1
- package/dist/types/file.umd.cjs.map +1 -1
- package/dist/types/filelist.umd.cjs +1 -1
- package/dist/types/filelist.umd.cjs.map +1 -1
- package/dist/types/imagebitmap.umd.cjs +2 -2
- package/dist/types/imagebitmap.umd.cjs.map +1 -1
- package/dist/types/imagedata.umd.cjs +1 -1
- package/dist/types/imagedata.umd.cjs.map +1 -1
- package/dist/types/infinity.umd.cjs +1 -1
- package/dist/types/infinity.umd.cjs.map +1 -1
- package/dist/types/intl-types.umd.cjs +1 -1
- package/dist/types/intl-types.umd.cjs.map +1 -1
- package/dist/types/map.umd.cjs +1 -1
- package/dist/types/map.umd.cjs.map +1 -1
- package/dist/types/nan.umd.cjs +1 -1
- package/dist/types/nan.umd.cjs.map +1 -1
- package/dist/types/negative-infinity.umd.cjs +1 -1
- package/dist/types/negative-infinity.umd.cjs.map +1 -1
- package/dist/types/negative-zero.umd.cjs +1 -1
- package/dist/types/negative-zero.umd.cjs.map +1 -1
- package/dist/types/nonbuiltin-ignore.umd.cjs +1 -1
- package/dist/types/nonbuiltin-ignore.umd.cjs.map +1 -1
- package/dist/types/primitive-objects.umd.cjs +1 -1
- package/dist/types/primitive-objects.umd.cjs.map +1 -1
- package/dist/types/promise.umd.cjs +2 -2
- package/dist/types/promise.umd.cjs.map +1 -1
- package/dist/types/regexp.umd.cjs +1 -1
- package/dist/types/regexp.umd.cjs.map +1 -1
- package/dist/types/resurrectable.umd.cjs +1 -1
- package/dist/types/resurrectable.umd.cjs.map +1 -1
- package/dist/types/set.umd.cjs +1 -1
- package/dist/types/set.umd.cjs.map +1 -1
- package/dist/types/symbol.umd.cjs +1 -1
- package/dist/types/symbol.umd.cjs.map +1 -1
- package/dist/types/typed-arrays-socketio.umd.cjs +1 -1
- package/dist/types/typed-arrays-socketio.umd.cjs.map +1 -1
- package/dist/types/typed-arrays.umd.cjs +1 -1
- package/dist/types/typed-arrays.umd.cjs.map +1 -1
- package/dist/types/undef.umd.cjs +1 -1
- package/dist/types/undef.umd.cjs.map +1 -1
- package/dist/types/user-object.umd.cjs +1 -1
- package/dist/types/user-object.umd.cjs.map +1 -1
- package/package.json +30 -28
- package/polyfills/createObjectURL.js +7 -3
- package/polyfills/createObjectURL.umd.cjs +2 -2
- package/polyfills/createObjectURL.umd.cjs.map +1 -1
- package/utils/generateUUID.js +1 -1
package/dist/index.umd.cjs
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TypesonNamespace = {}));
|
|
5
5
|
})(this, (function (exports) { 'use strict';
|
|
6
6
|
|
|
7
|
-
function _arrayLikeToArray
|
|
7
|
+
function _arrayLikeToArray(r, a) {
|
|
8
8
|
(null == a || a > r.length) && (a = r.length);
|
|
9
9
|
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
10
10
|
return n;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
if (Array.isArray(r)) return r;
|
|
14
14
|
}
|
|
15
15
|
function _arrayWithoutHoles(r) {
|
|
16
|
-
if (Array.isArray(r)) return _arrayLikeToArray
|
|
16
|
+
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
17
17
|
}
|
|
18
18
|
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
19
19
|
try {
|
|
@@ -40,22 +40,22 @@
|
|
|
40
40
|
});
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
function _classCallCheck
|
|
43
|
+
function _classCallCheck(a, n) {
|
|
44
44
|
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
45
45
|
}
|
|
46
46
|
function _defineProperties(e, r) {
|
|
47
47
|
for (var t = 0; t < r.length; t++) {
|
|
48
48
|
var o = r[t];
|
|
49
|
-
o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey
|
|
49
|
+
o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey(o.key), o);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
function _createClass
|
|
52
|
+
function _createClass(e, r, t) {
|
|
53
53
|
return r && _defineProperties(e.prototype, r), Object.defineProperty(e, "prototype", {
|
|
54
54
|
writable: false
|
|
55
55
|
}), e;
|
|
56
56
|
}
|
|
57
|
-
function _defineProperty
|
|
58
|
-
return (r = _toPropertyKey
|
|
57
|
+
function _defineProperty(e, r, t) {
|
|
58
|
+
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
59
59
|
value: t,
|
|
60
60
|
enumerable: true,
|
|
61
61
|
configurable: true,
|
|
@@ -76,7 +76,10 @@
|
|
|
76
76
|
f = true,
|
|
77
77
|
o = false;
|
|
78
78
|
try {
|
|
79
|
-
if (i = (t = t.call(r)).next, 0 === l)
|
|
79
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
|
80
|
+
if (Object(t) !== t) return;
|
|
81
|
+
f = !1;
|
|
82
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
80
83
|
} catch (r) {
|
|
81
84
|
o = true, n = r;
|
|
82
85
|
} finally {
|
|
@@ -95,7 +98,7 @@
|
|
|
95
98
|
function _nonIterableSpread() {
|
|
96
99
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
97
100
|
}
|
|
98
|
-
function ownKeys
|
|
101
|
+
function ownKeys(e, r) {
|
|
99
102
|
var t = Object.keys(e);
|
|
100
103
|
if (Object.getOwnPropertySymbols) {
|
|
101
104
|
var o = Object.getOwnPropertySymbols(e);
|
|
@@ -105,12 +108,12 @@
|
|
|
105
108
|
}
|
|
106
109
|
return t;
|
|
107
110
|
}
|
|
108
|
-
function _objectSpread2
|
|
111
|
+
function _objectSpread2(e) {
|
|
109
112
|
for (var r = 1; r < arguments.length; r++) {
|
|
110
113
|
var t = null != arguments[r] ? arguments[r] : {};
|
|
111
|
-
r % 2 ? ownKeys
|
|
112
|
-
_defineProperty
|
|
113
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys
|
|
114
|
+
r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
|
|
115
|
+
_defineProperty(e, r, t[r]);
|
|
116
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
114
117
|
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
115
118
|
});
|
|
116
119
|
}
|
|
@@ -224,11 +227,11 @@
|
|
|
224
227
|
}) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
|
|
225
228
|
}, _regeneratorDefine(e, r, n, t);
|
|
226
229
|
}
|
|
227
|
-
function _slicedToArray
|
|
228
|
-
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray
|
|
230
|
+
function _slicedToArray(r, e) {
|
|
231
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
229
232
|
}
|
|
230
|
-
function _toConsumableArray
|
|
231
|
-
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray
|
|
233
|
+
function _toConsumableArray(r) {
|
|
234
|
+
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
232
235
|
}
|
|
233
236
|
function _toPrimitive(t, r) {
|
|
234
237
|
if ("object" != typeof t || !t) return t;
|
|
@@ -240,213 +243,99 @@
|
|
|
240
243
|
}
|
|
241
244
|
return ("string" === r ? String : Number)(t);
|
|
242
245
|
}
|
|
243
|
-
function _toPropertyKey
|
|
246
|
+
function _toPropertyKey(t) {
|
|
244
247
|
var i = _toPrimitive(t, "string");
|
|
245
248
|
return "symbol" == typeof i ? i : i + "";
|
|
246
249
|
}
|
|
247
|
-
function _typeof
|
|
250
|
+
function _typeof(o) {
|
|
248
251
|
"@babel/helpers - typeof";
|
|
249
252
|
|
|
250
|
-
return _typeof
|
|
253
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
251
254
|
return typeof o;
|
|
252
255
|
} : function (o) {
|
|
253
256
|
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
254
|
-
}, _typeof
|
|
257
|
+
}, _typeof(o);
|
|
255
258
|
}
|
|
256
|
-
function _unsupportedIterableToArray
|
|
259
|
+
function _unsupportedIterableToArray(r, a) {
|
|
257
260
|
if (r) {
|
|
258
|
-
if ("string" == typeof r) return _arrayLikeToArray
|
|
261
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
259
262
|
var t = {}.toString.call(r).slice(8, -1);
|
|
260
|
-
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray
|
|
263
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
261
264
|
}
|
|
262
265
|
}
|
|
263
266
|
|
|
264
|
-
function
|
|
265
|
-
(
|
|
266
|
-
|
|
267
|
-
return n;
|
|
268
|
-
}
|
|
269
|
-
function _classCallCheck(e, t) {
|
|
270
|
-
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
|
|
271
|
-
}
|
|
272
|
-
function _createClass(e, t, r) {
|
|
273
|
-
return t && function _defineProperties(e, t) {
|
|
274
|
-
for (var r = 0; r < t.length; r++) {
|
|
275
|
-
var n = t[r];
|
|
276
|
-
n.enumerable = n.enumerable || false, n.configurable = true, "value" in n && (n.writable = true), Object.defineProperty(e, _toPropertyKey(n.key), n);
|
|
277
|
-
}
|
|
278
|
-
}(e.prototype, t), Object.defineProperty(e, "prototype", {
|
|
279
|
-
writable: false
|
|
280
|
-
}), e;
|
|
281
|
-
}
|
|
282
|
-
function _defineProperty(e, t, r) {
|
|
283
|
-
return (t = _toPropertyKey(t)) in e ? Object.defineProperty(e, t, {
|
|
284
|
-
value: r,
|
|
285
|
-
enumerable: true,
|
|
286
|
-
configurable: true,
|
|
287
|
-
writable: true
|
|
288
|
-
}) : e[t] = r, e;
|
|
289
|
-
}
|
|
290
|
-
function ownKeys(e, t) {
|
|
291
|
-
var r = Object.keys(e);
|
|
292
|
-
if (Object.getOwnPropertySymbols) {
|
|
293
|
-
var n = Object.getOwnPropertySymbols(e);
|
|
294
|
-
t && (n = n.filter(function (t) {
|
|
295
|
-
return Object.getOwnPropertyDescriptor(e, t).enumerable;
|
|
296
|
-
})), r.push.apply(r, n);
|
|
297
|
-
}
|
|
298
|
-
return r;
|
|
299
|
-
}
|
|
300
|
-
function _objectSpread2(e) {
|
|
301
|
-
for (var t = 1; t < arguments.length; t++) {
|
|
302
|
-
var r = null != arguments[t] ? arguments[t] : {};
|
|
303
|
-
t % 2 ? ownKeys(Object(r), true).forEach(function (t) {
|
|
304
|
-
_defineProperty(e, t, r[t]);
|
|
305
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : ownKeys(Object(r)).forEach(function (t) {
|
|
306
|
-
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t));
|
|
307
|
-
});
|
|
308
|
-
}
|
|
309
|
-
return e;
|
|
310
|
-
}
|
|
311
|
-
function _slicedToArray(e, t) {
|
|
312
|
-
return function _arrayWithHoles(e) {
|
|
313
|
-
if (Array.isArray(e)) return e;
|
|
314
|
-
}(e) || function _iterableToArrayLimit(e, t) {
|
|
315
|
-
var r = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
|
|
316
|
-
if (null != r) {
|
|
317
|
-
var n,
|
|
318
|
-
o,
|
|
319
|
-
i,
|
|
320
|
-
a,
|
|
321
|
-
c = [],
|
|
322
|
-
s = true,
|
|
323
|
-
u = false;
|
|
324
|
-
try {
|
|
325
|
-
if (i = (r = r.call(e)).next, 0 === t) {
|
|
326
|
-
if (Object(r) !== r) return;
|
|
327
|
-
s = !1;
|
|
328
|
-
} else for (; !(s = (n = i.call(r)).done) && (c.push(n.value), c.length !== t); s = !0);
|
|
329
|
-
} catch (e) {
|
|
330
|
-
u = true, o = e;
|
|
331
|
-
} finally {
|
|
332
|
-
try {
|
|
333
|
-
if (!s && null != r["return"] && (a = r["return"](), Object(a) !== a)) return;
|
|
334
|
-
} finally {
|
|
335
|
-
if (u) throw o;
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
return c;
|
|
339
|
-
}
|
|
340
|
-
}(e, t) || _unsupportedIterableToArray(e, t) || function _nonIterableRest() {
|
|
341
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
342
|
-
}();
|
|
343
|
-
}
|
|
344
|
-
function _toConsumableArray(e) {
|
|
345
|
-
return function _arrayWithoutHoles(e) {
|
|
346
|
-
if (Array.isArray(e)) return _arrayLikeToArray(e);
|
|
347
|
-
}(e) || function _iterableToArray(e) {
|
|
348
|
-
if ("undefined" != typeof Symbol && null != e[Symbol.iterator] || null != e["@@iterator"]) return Array.from(e);
|
|
349
|
-
}(e) || _unsupportedIterableToArray(e) || function _nonIterableSpread() {
|
|
350
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
351
|
-
}();
|
|
352
|
-
}
|
|
353
|
-
function _toPropertyKey(e) {
|
|
354
|
-
var t = function _toPrimitive(e, t) {
|
|
355
|
-
if ("object" != _typeof$1(e) || !e) return e;
|
|
356
|
-
var r = e[Symbol.toPrimitive];
|
|
357
|
-
if (void 0 !== r) {
|
|
358
|
-
var n = r.call(e, t);
|
|
359
|
-
if ("object" != _typeof$1(n)) return n;
|
|
360
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
361
|
-
}
|
|
362
|
-
return String(e);
|
|
363
|
-
}(e, "string");
|
|
364
|
-
return "symbol" == _typeof$1(t) ? t : t + "";
|
|
365
|
-
}
|
|
366
|
-
function _typeof(e) {
|
|
367
|
-
return _typeof = "function" == typeof Symbol && "symbol" == _typeof$1(Symbol.iterator) ? function (e) {
|
|
368
|
-
return _typeof$1(e);
|
|
369
|
-
} : function (e) {
|
|
370
|
-
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : _typeof$1(e);
|
|
371
|
-
}, _typeof(e);
|
|
372
|
-
}
|
|
373
|
-
function _unsupportedIterableToArray(e, t) {
|
|
374
|
-
if (e) {
|
|
375
|
-
if ("string" == typeof e) return _arrayLikeToArray(e, t);
|
|
376
|
-
var r = {}.toString.call(e).slice(8, -1);
|
|
377
|
-
return "Object" === r && e.constructor && (r = e.constructor.name), "Map" === r || "Set" === r ? Array.from(e) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? _arrayLikeToArray(e, t) : void 0;
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
var e = _createClass(function TypesonPromise(e) {
|
|
381
|
-
_classCallCheck(this, TypesonPromise), this.p = new Promise(e);
|
|
267
|
+
var TypesonPromise = /*#__PURE__*/_createClass(function TypesonPromise(e) {
|
|
268
|
+
_classCallCheck(this, TypesonPromise);
|
|
269
|
+
this.p = new Promise(e);
|
|
382
270
|
});
|
|
383
|
-
|
|
271
|
+
TypesonPromise.__typeson__type__ = "TypesonPromise", "undefined" != typeof Symbol && Object.defineProperty(TypesonPromise.prototype, Symbol.toStringTag, {
|
|
384
272
|
get: function get() {
|
|
385
273
|
return "TypesonPromise";
|
|
386
274
|
}
|
|
387
|
-
}),
|
|
388
|
-
var
|
|
389
|
-
return new
|
|
390
|
-
|
|
391
|
-
e
|
|
275
|
+
}), TypesonPromise.prototype.then = function (e, t) {
|
|
276
|
+
var _this = this;
|
|
277
|
+
return new TypesonPromise(function (n, r) {
|
|
278
|
+
_this.p.then(function (t) {
|
|
279
|
+
n(e ? e(t) : t);
|
|
392
280
|
})["catch"](function (e) {
|
|
393
|
-
return
|
|
394
|
-
}).then(
|
|
281
|
+
return t ? t(e) : Promise.reject(e);
|
|
282
|
+
}).then(n, r);
|
|
395
283
|
});
|
|
396
|
-
},
|
|
284
|
+
}, TypesonPromise.prototype["catch"] = function (e) {
|
|
397
285
|
return this.then(function () {}, e);
|
|
398
|
-
},
|
|
399
|
-
return new
|
|
400
|
-
e
|
|
286
|
+
}, TypesonPromise.resolve = function (e) {
|
|
287
|
+
return new TypesonPromise(function (t) {
|
|
288
|
+
t(e);
|
|
401
289
|
});
|
|
402
|
-
},
|
|
403
|
-
return new
|
|
404
|
-
|
|
290
|
+
}, TypesonPromise.reject = function (e) {
|
|
291
|
+
return new TypesonPromise(function (t, n) {
|
|
292
|
+
n(e);
|
|
405
293
|
});
|
|
406
|
-
},
|
|
407
|
-
return new
|
|
408
|
-
Promise.all(
|
|
409
|
-
return null
|
|
410
|
-
})).then(
|
|
294
|
+
}, TypesonPromise.all = function (e) {
|
|
295
|
+
return new TypesonPromise(function (t, n) {
|
|
296
|
+
Promise.all(e.map(function (e) {
|
|
297
|
+
return e !== null && e !== void 0 && e.constructor && "__typeson__type__" in e.constructor && "TypesonPromise" === e.constructor.__typeson__type__ ? e.p : e;
|
|
298
|
+
})).then(t, n);
|
|
411
299
|
});
|
|
412
|
-
},
|
|
413
|
-
return new
|
|
414
|
-
Promise.race(
|
|
415
|
-
return null
|
|
416
|
-
})).then(
|
|
300
|
+
}, TypesonPromise.race = function (e) {
|
|
301
|
+
return new TypesonPromise(function (t, n) {
|
|
302
|
+
Promise.race(e.map(function (e) {
|
|
303
|
+
return e !== null && e !== void 0 && e.constructor && "__typeson__type__" in e.constructor && "TypesonPromise" === e.constructor.__typeson__type__ ? e.p : e;
|
|
304
|
+
})).then(t, n);
|
|
417
305
|
});
|
|
418
|
-
},
|
|
419
|
-
return new
|
|
420
|
-
Promise.allSettled(
|
|
421
|
-
return null
|
|
422
|
-
})).then(
|
|
306
|
+
}, TypesonPromise.allSettled = function (e) {
|
|
307
|
+
return new TypesonPromise(function (t, n) {
|
|
308
|
+
Promise.allSettled(e.map(function (e) {
|
|
309
|
+
return e !== null && e !== void 0 && e.constructor && "__typeson__type__" in e.constructor && "TypesonPromise" === e.constructor.__typeson__type__ ? e.p : e;
|
|
310
|
+
})).then(t, n);
|
|
423
311
|
});
|
|
424
312
|
};
|
|
425
|
-
var
|
|
426
|
-
|
|
313
|
+
var e = Object.hasOwn,
|
|
314
|
+
t = Object.getPrototypeOf;
|
|
427
315
|
function isThenable(e, t) {
|
|
428
316
|
return isObject(e) && "function" == typeof e.then && (!t || "function" == typeof e["catch"]);
|
|
429
317
|
}
|
|
430
318
|
function toStringTag(e) {
|
|
431
319
|
return Object.prototype.toString.call(e).slice(8, -1);
|
|
432
320
|
}
|
|
433
|
-
function hasConstructorOf(
|
|
434
|
-
if (!
|
|
435
|
-
var
|
|
436
|
-
if (!
|
|
437
|
-
var
|
|
438
|
-
return "function" != typeof
|
|
321
|
+
function hasConstructorOf(n, r) {
|
|
322
|
+
if (!n || "object" != _typeof(n)) return false;
|
|
323
|
+
var s = t(n);
|
|
324
|
+
if (!s) return null === r;
|
|
325
|
+
var o = e(s, "constructor") && s.constructor;
|
|
326
|
+
return "function" != typeof o ? null === r : r === o || null !== r && Function.prototype.toString.call(o) === Function.prototype.toString.call(r) || "function" == typeof r && "string" == typeof o.__typeson__type__ && o.__typeson__type__ === r.__typeson__type__;
|
|
439
327
|
}
|
|
440
328
|
function isPlainObject(e) {
|
|
441
|
-
|
|
329
|
+
if (!e || "Object" !== toStringTag(e)) return false;
|
|
330
|
+
return !t(e) || hasConstructorOf(e, Object);
|
|
442
331
|
}
|
|
443
332
|
function isUserObject(e) {
|
|
444
333
|
if (!e || "Object" !== toStringTag(e)) return false;
|
|
445
|
-
var
|
|
446
|
-
return !
|
|
334
|
+
var n = t(e);
|
|
335
|
+
return !n || hasConstructorOf(e, Object) || isUserObject(n);
|
|
447
336
|
}
|
|
448
337
|
function isObject(e) {
|
|
449
|
-
return null !== e && "object"
|
|
338
|
+
return null !== e && "object" == _typeof(e);
|
|
450
339
|
}
|
|
451
340
|
function escapeKeyPathComponent(e) {
|
|
452
341
|
return e.replaceAll("''", "''''").replace(/^$/, "''").replaceAll("~", "~0").replaceAll(".", "~1");
|
|
@@ -456,535 +345,604 @@
|
|
|
456
345
|
}
|
|
457
346
|
function getByKeyPath(e, t) {
|
|
458
347
|
if ("" === t) return e;
|
|
459
|
-
if (null === e || "object"
|
|
460
|
-
var
|
|
461
|
-
if (-1 !==
|
|
462
|
-
var
|
|
463
|
-
return void 0 ===
|
|
348
|
+
if (null === e || "object" != _typeof(e)) throw new TypeError("Unexpected non-object type");
|
|
349
|
+
var n = t.indexOf(".");
|
|
350
|
+
if (-1 !== n) {
|
|
351
|
+
var _r = e[unescapeKeyPathComponent(t.slice(0, n))];
|
|
352
|
+
return void 0 === _r ? void 0 : getByKeyPath(_r, t.slice(n + 1));
|
|
464
353
|
}
|
|
465
354
|
return e[unescapeKeyPathComponent(t)];
|
|
466
355
|
}
|
|
467
|
-
function setAtKeyPath(e, t,
|
|
468
|
-
if ("" === t) return
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
356
|
+
function setAtKeyPath(e, t, n) {
|
|
357
|
+
if ("" === t) return n;
|
|
358
|
+
var r = e,
|
|
359
|
+
s = t;
|
|
360
|
+
for (;;) {
|
|
361
|
+
if (!r || "object" != _typeof(r)) throw new TypeError("Unexpected non-object type");
|
|
362
|
+
if ("__proto__" === s) throw new TypeError("Invalid property");
|
|
363
|
+
var _t = s.indexOf(".");
|
|
364
|
+
if (-1 === _t) return r[unescapeKeyPathComponent(s)] = n, e;
|
|
365
|
+
r = r[unescapeKeyPathComponent(s.slice(0, _t))], s = s.slice(_t + 1);
|
|
366
|
+
}
|
|
473
367
|
}
|
|
474
368
|
function getJSONType(e) {
|
|
475
369
|
return null === e ? "null" : Array.isArray(e) ? "array" : _typeof(e);
|
|
476
370
|
}
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
371
|
+
/**
|
|
372
|
+
* @file Typeson - JSON with types.
|
|
373
|
+
* @license The MIT License (MIT)
|
|
374
|
+
* @copyright (c) 2016-2018 David Fahlander, Brett Zamir
|
|
375
|
+
*/
|
|
480
376
|
var n = Object.keys,
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
function _async(e) {
|
|
485
|
-
return function () {
|
|
486
|
-
for (var t = [], r = 0; r < arguments.length; r++) t[r] = arguments[r];
|
|
487
|
-
try {
|
|
488
|
-
return Promise.resolve(e.apply(this, t));
|
|
489
|
-
} catch (e) {
|
|
490
|
-
return Promise.reject(e);
|
|
491
|
-
}
|
|
492
|
-
};
|
|
493
|
-
}
|
|
377
|
+
r = Object.hasOwn,
|
|
378
|
+
s = Array.isArray,
|
|
379
|
+
o = ["type", "replaced", "iterateIn", "iterateUnsetNumeric", "addLength"];
|
|
494
380
|
function nestedPathsFirst(e, t) {
|
|
495
|
-
var
|
|
381
|
+
var _e$keypath$match, _t$keypath$match;
|
|
496
382
|
if ("" === e.keypath) return -1;
|
|
497
|
-
var
|
|
498
|
-
|
|
499
|
-
return
|
|
500
|
-
}
|
|
501
|
-
var
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
383
|
+
var n = (_e$keypath$match = e.keypath.match(/\./g)) !== null && _e$keypath$match !== void 0 ? _e$keypath$match : 0,
|
|
384
|
+
r = (_t$keypath$match = t.keypath.match(/\./g)) !== null && _t$keypath$match !== void 0 ? _t$keypath$match : 0;
|
|
385
|
+
return n && (n = n.length), r && (r = r.length), n > r ? -1 : n < r ? 1 : e.keypath < t.keypath ? -1 : e.keypath > t.keypath ? 1 : 0;
|
|
386
|
+
}
|
|
387
|
+
var Typeson = /*#__PURE__*/function () {
|
|
388
|
+
function Typeson(e) {
|
|
389
|
+
_classCallCheck(this, Typeson);
|
|
390
|
+
this.options = e, this.plainObjectReplacers = [], this.nonplainObjectReplacers = [], this.revivers = {}, this.types = {};
|
|
391
|
+
}
|
|
392
|
+
return _createClass(Typeson, [{
|
|
393
|
+
key: "stringify",
|
|
394
|
+
value: function stringify(e, t, n, r) {
|
|
395
|
+
r = _objectSpread2(_objectSpread2(_objectSpread2({}, this.options), r), {}, {
|
|
396
|
+
stringification: true
|
|
397
|
+
});
|
|
398
|
+
var o = this.encapsulate(e, null, r);
|
|
399
|
+
return s(o) ? JSON.stringify(o[0], t, n) : o.then(function (e) {
|
|
400
|
+
return JSON.stringify(e, t, n);
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
}, {
|
|
404
|
+
key: "stringifySync",
|
|
405
|
+
value: function stringifySync(e, t, n, r) {
|
|
406
|
+
return this.stringify(e, t, n, _objectSpread2(_objectSpread2({
|
|
407
|
+
throwOnBadSyncType: true
|
|
408
|
+
}, r), {}, {
|
|
409
|
+
sync: true
|
|
410
|
+
}));
|
|
411
|
+
}
|
|
412
|
+
}, {
|
|
413
|
+
key: "stringifyAsync",
|
|
414
|
+
value: function stringifyAsync(e, t, n, r) {
|
|
415
|
+
return this.stringify(e, t, n, _objectSpread2(_objectSpread2({
|
|
416
|
+
throwOnBadSyncType: true
|
|
417
|
+
}, r), {}, {
|
|
418
|
+
sync: false
|
|
419
|
+
}));
|
|
420
|
+
}
|
|
421
|
+
}, {
|
|
422
|
+
key: "parse",
|
|
423
|
+
value: function parse(e, t, n) {
|
|
424
|
+
return n = _objectSpread2(_objectSpread2(_objectSpread2({}, this.options), n), {}, {
|
|
425
|
+
parse: true
|
|
426
|
+
}), this.revive(JSON.parse(e, t), n);
|
|
427
|
+
}
|
|
428
|
+
}, {
|
|
429
|
+
key: "parseSync",
|
|
430
|
+
value: function parseSync(e, t, n) {
|
|
431
|
+
return this.parse(e, t, _objectSpread2(_objectSpread2({
|
|
432
|
+
throwOnBadSyncType: true
|
|
433
|
+
}, n), {}, {
|
|
434
|
+
sync: true
|
|
435
|
+
}));
|
|
436
|
+
}
|
|
437
|
+
}, {
|
|
438
|
+
key: "parseAsync",
|
|
439
|
+
value: function parseAsync(e, t, n) {
|
|
440
|
+
return this.parse(e, t, _objectSpread2(_objectSpread2({
|
|
441
|
+
throwOnBadSyncType: true
|
|
442
|
+
}, n), {}, {
|
|
443
|
+
sync: false
|
|
444
|
+
}));
|
|
445
|
+
}
|
|
446
|
+
}, {
|
|
447
|
+
key: "specialTypeNames",
|
|
448
|
+
value: function specialTypeNames(e, t) {
|
|
449
|
+
var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
450
|
+
return n.returnTypeNames = true, this.encapsulate(e, t, n);
|
|
451
|
+
}
|
|
452
|
+
}, {
|
|
453
|
+
key: "rootTypeName",
|
|
454
|
+
value: function rootTypeName(e, t) {
|
|
455
|
+
var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
456
|
+
return n.iterateNone = true, this.encapsulate(e, t, n);
|
|
457
|
+
}
|
|
458
|
+
}, {
|
|
459
|
+
key: "encapsulate",
|
|
460
|
+
value: function encapsulate(e, t, i) {
|
|
461
|
+
var _this2 = this;
|
|
462
|
+
var c = _objectSpread2(_objectSpread2({
|
|
546
463
|
sync: true
|
|
547
|
-
}))
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
return r.returnTypeNames = true, this.encapsulate(e, t, r);
|
|
563
|
-
}
|
|
564
|
-
}, {
|
|
565
|
-
key: "rootTypeName",
|
|
566
|
-
value: function rootTypeName(e, t) {
|
|
567
|
-
var r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
|
|
568
|
-
return r.iterateNone = true, this.encapsulate(e, t, r);
|
|
569
|
-
}
|
|
570
|
-
}, {
|
|
571
|
-
key: "encapsulate",
|
|
572
|
-
value: function encapsulate(t, r, c) {
|
|
573
|
-
var s = this,
|
|
574
|
-
u = _objectSpread2(_objectSpread2({
|
|
575
|
-
sync: true
|
|
576
|
-
}, this.options), c),
|
|
577
|
-
y = u.sync,
|
|
578
|
-
l = {},
|
|
579
|
-
p = [],
|
|
580
|
-
f = [],
|
|
581
|
-
v = [],
|
|
582
|
-
h = !("cyclic" in u) || u.cyclic,
|
|
583
|
-
d = u.encapsulateObserver,
|
|
584
|
-
b = function finish(e) {
|
|
585
|
-
var t = Object.values(l);
|
|
586
|
-
if (u.iterateNone) return t.length ? t[0] : getJSONType(e);
|
|
587
|
-
if (t.length) {
|
|
588
|
-
if (u.returnTypeNames) return _toConsumableArray(new Set(t));
|
|
589
|
-
e && isPlainObject(e) && !o(e, "$types") ? e.$types = l : e = {
|
|
590
|
-
$: e,
|
|
591
|
-
$types: {
|
|
592
|
-
$: l
|
|
593
|
-
}
|
|
594
|
-
};
|
|
595
|
-
} else isObject(e) && o(e, "$types") && (e = {
|
|
464
|
+
}, this.options), i),
|
|
465
|
+
a = c.sync,
|
|
466
|
+
p = {},
|
|
467
|
+
y = [],
|
|
468
|
+
u = [],
|
|
469
|
+
l = [],
|
|
470
|
+
h = !("cyclic" in c) || c.cyclic,
|
|
471
|
+
f = c.encapsulateObserver,
|
|
472
|
+
d = c.encapsulateError,
|
|
473
|
+
finish = function finish(e) {
|
|
474
|
+
var t = Object.values(p);
|
|
475
|
+
if (c.iterateNone) return t.length ? t[0] : getJSONType(e);
|
|
476
|
+
if (t.length) {
|
|
477
|
+
if (c.returnTypeNames) return _toConsumableArray(new Set(t));
|
|
478
|
+
e && isPlainObject(e) && !r(e, "$types") ? e.$types = p : e = {
|
|
596
479
|
$: e,
|
|
597
|
-
$types:
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
return
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
480
|
+
$types: {
|
|
481
|
+
$: p
|
|
482
|
+
}
|
|
483
|
+
};
|
|
484
|
+
} else isObject(e) && r(e, "$types") && (e = {
|
|
485
|
+
$: e,
|
|
486
|
+
$types: true
|
|
487
|
+
});
|
|
488
|
+
return !c.returnTypeNames && e;
|
|
489
|
+
},
|
|
490
|
+
_checkPromises = /*#__PURE__*/function () {
|
|
491
|
+
var _checkPromises2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(e, t) {
|
|
492
|
+
var n;
|
|
493
|
+
return _regenerator().w(function (_context2) {
|
|
494
|
+
while (1) switch (_context2.n) {
|
|
495
|
+
case 0:
|
|
496
|
+
_context2.n = 1;
|
|
497
|
+
return Promise.all(t.map(function (e) {
|
|
498
|
+
return e[1].p;
|
|
499
|
+
}));
|
|
500
|
+
case 1:
|
|
501
|
+
n = _context2.v;
|
|
502
|
+
_context2.n = 2;
|
|
503
|
+
return Promise.all(n.map(/*#__PURE__*/function () {
|
|
504
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(n) {
|
|
505
|
+
var r, _t$splice, _t$splice2, s, _s, o, i, c, a, p, y, u, l, _t2;
|
|
506
|
+
return _regenerator().w(function (_context) {
|
|
507
|
+
while (1) switch (_context.n) {
|
|
508
|
+
case 0:
|
|
509
|
+
r = [], _t$splice = t.splice(0, 1), _t$splice2 = _slicedToArray(_t$splice, 1), s = _t$splice2[0], _s = _slicedToArray(s, 7), o = _s[0], i = _s[2], c = _s[3], a = _s[4], p = _s[5], y = _s[6], u = _encapsulate2(o, n, i, c, r, true, y), l = hasConstructorOf(u, TypesonPromise);
|
|
510
|
+
if (!(o && l)) {
|
|
511
|
+
_context.n = 2;
|
|
512
|
+
break;
|
|
513
|
+
}
|
|
514
|
+
_context.n = 1;
|
|
515
|
+
return u.p;
|
|
516
|
+
case 1:
|
|
517
|
+
_t2 = _context.v;
|
|
518
|
+
return _context.a(2, (a[p] = _t2, _checkPromises(e, r)));
|
|
519
|
+
case 2:
|
|
520
|
+
return _context.a(2, (o ? a[p] = u : e = l ? u.p : u, _checkPromises(e, r)));
|
|
521
|
+
}
|
|
522
|
+
}, _callee);
|
|
523
|
+
}));
|
|
524
|
+
return function (_x3) {
|
|
525
|
+
return _ref.apply(this, arguments);
|
|
526
|
+
};
|
|
527
|
+
}()));
|
|
528
|
+
case 2:
|
|
529
|
+
return _context2.a(2, e);
|
|
530
|
+
}
|
|
531
|
+
}, _callee2);
|
|
532
|
+
}));
|
|
533
|
+
function checkPromises(_x, _x2) {
|
|
534
|
+
return _checkPromises2.apply(this, arguments);
|
|
535
|
+
}
|
|
536
|
+
return checkPromises;
|
|
537
|
+
}(),
|
|
538
|
+
_adaptBuiltinStateObjectProperties = function _adaptBuiltinStateObjectProperties(e, t, n) {
|
|
539
|
+
Object.assign(e, t);
|
|
540
|
+
var r = o.map(function (t) {
|
|
541
|
+
var n = e[t];
|
|
542
|
+
return delete e[t], n;
|
|
543
|
+
});
|
|
544
|
+
n(), o.forEach(function (t, n) {
|
|
545
|
+
e[t] = r[n];
|
|
546
|
+
});
|
|
547
|
+
},
|
|
548
|
+
_encapsulate2 = function _encapsulate(e, t, o, i, a, l, h) {
|
|
549
|
+
var v,
|
|
550
|
+
O = {};
|
|
551
|
+
var b = f ? function (n) {
|
|
552
|
+
var _ref2;
|
|
553
|
+
var r = (_ref2 = h !== null && h !== void 0 ? h : i.type) !== null && _ref2 !== void 0 ? _ref2 : getJSONType(t);
|
|
554
|
+
f(Object.assign(n !== null && n !== void 0 ? n : O, {
|
|
555
|
+
keypath: e,
|
|
556
|
+
value: t,
|
|
557
|
+
cyclic: o,
|
|
558
|
+
stateObj: i,
|
|
559
|
+
promisesData: a,
|
|
560
|
+
resolvingTypesonPromise: l,
|
|
561
|
+
awaitingTypesonPromise: hasConstructorOf(t, TypesonPromise)
|
|
562
|
+
}, {
|
|
563
|
+
type: r
|
|
564
|
+
}));
|
|
565
|
+
} : null,
|
|
566
|
+
getEncapsulatedValue = function getEncapsulatedValue(e, t, n) {
|
|
567
|
+
try {
|
|
568
|
+
return {
|
|
569
|
+
value: _encapsulate2(e, t[n], Boolean(o), i, a, l)
|
|
570
|
+
};
|
|
571
|
+
} catch (r) {
|
|
572
|
+
var _ref3;
|
|
573
|
+
if (!d) throw r;
|
|
574
|
+
var s = (_ref3 = h !== null && h !== void 0 ? h : i.type) !== null && _ref3 !== void 0 ? _ref3 : getJSONType(t),
|
|
575
|
+
_o = d({
|
|
576
|
+
keypath: e,
|
|
577
|
+
error: r,
|
|
578
|
+
parent: t,
|
|
579
|
+
key: n,
|
|
580
|
+
stateObj: i,
|
|
581
|
+
type: s
|
|
626
582
|
});
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
return t;
|
|
632
|
-
});
|
|
633
|
-
});
|
|
634
|
-
}),
|
|
635
|
-
O = function _adaptBuiltinStateObjectProperties(e, t, r) {
|
|
636
|
-
Object.assign(e, t);
|
|
637
|
-
var n = a.map(function (t) {
|
|
638
|
-
var r = e[t];
|
|
639
|
-
return delete e[t], r;
|
|
640
|
-
});
|
|
641
|
-
r(), a.forEach(function (t, r) {
|
|
642
|
-
e[t] = n[r];
|
|
643
|
-
});
|
|
644
|
-
},
|
|
645
|
-
m = function _encapsulate(t, r, a, c, y, v, h) {
|
|
646
|
-
var b,
|
|
647
|
-
_ = {},
|
|
648
|
-
g = _typeof(r),
|
|
649
|
-
S = d ? function (n) {
|
|
650
|
-
var o,
|
|
651
|
-
i = null !== (o = null != h ? h : c.type) && void 0 !== o ? o : getJSONType(r);
|
|
652
|
-
d(Object.assign(null != n ? n : _, {
|
|
653
|
-
keypath: t,
|
|
654
|
-
value: r,
|
|
655
|
-
cyclic: a,
|
|
656
|
-
stateObj: c,
|
|
657
|
-
promisesData: y,
|
|
658
|
-
resolvingTypesonPromise: v,
|
|
659
|
-
awaitingTypesonPromise: hasConstructorOf(r, e)
|
|
660
|
-
}, {
|
|
661
|
-
type: i
|
|
662
|
-
}));
|
|
663
|
-
} : null;
|
|
664
|
-
if (["string", "boolean", "number", "undefined"].includes(g)) return void 0 === r || Number.isNaN(r) || r === Number.NEGATIVE_INFINITY || r === Number.POSITIVE_INFINITY || 0 === r ? (b = c.replaced ? r : j(t, r, c, y, false, v, S)) !== r && (_ = {
|
|
665
|
-
replaced: b
|
|
666
|
-
}) : b = r, S && S(), b;
|
|
667
|
-
if (null === r) return S && S(), r;
|
|
668
|
-
if (a && !c.iterateIn && !c.iterateUnsetNumeric && r && "object" === _typeof(r)) {
|
|
669
|
-
var w = p.indexOf(r);
|
|
670
|
-
if (-1 !== w) return l[t] = "#", S && S({
|
|
671
|
-
cyclicKeypath: f[w]
|
|
672
|
-
}), "#" + f[w];
|
|
673
|
-
true === a && (p.push(r), f.push(t));
|
|
674
|
-
}
|
|
675
|
-
var T,
|
|
676
|
-
P = isPlainObject(r),
|
|
677
|
-
A = i$1(r),
|
|
678
|
-
C = (P || A) && (!s.plainObjectReplacers.length || c.replaced) || c.iterateIn ? r : j(t, r, c, y, P || A, null, S);
|
|
679
|
-
if (C !== r ? (b = C, _ = {
|
|
680
|
-
replaced: C
|
|
681
|
-
}) : "" === t && hasConstructorOf(r, e) ? (y.push([t, r, a, c, void 0, void 0, c.type]), b = r) : A && "object" !== c.iterateIn || "array" === c.iterateIn ? (T = new Array(r.length), _ = {
|
|
682
|
-
clone: T
|
|
683
|
-
}) : (["function", "symbol"].includes(_typeof(r)) || "toJSON" in r || hasConstructorOf(r, e) || hasConstructorOf(r, Promise) || hasConstructorOf(r, ArrayBuffer)) && !P && "object" !== c.iterateIn ? b = r : (T = {}, c.addLength && (T.length = r.length), _ = {
|
|
684
|
-
clone: T
|
|
685
|
-
}), S && S(), u.iterateNone) return null != T ? T : b;
|
|
686
|
-
if (!T) return b;
|
|
687
|
-
if (c.iterateIn) {
|
|
688
|
-
var k = function _loop(n) {
|
|
689
|
-
var i = {
|
|
690
|
-
ownKeys: o(r, n)
|
|
583
|
+
if (!_o) throw r;
|
|
584
|
+
if ("substitute" in _o) return {
|
|
585
|
+
value: _o.substitute,
|
|
586
|
+
substitute: true
|
|
691
587
|
};
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
588
|
+
if (_o.ignore) return;
|
|
589
|
+
throw r;
|
|
590
|
+
}
|
|
591
|
+
};
|
|
592
|
+
if (["string", "boolean", "number", "undefined"].includes(_typeof(t))) return void 0 === t || t === 1 / 0 || 0 === t || t === -1 / 0 || Number.isNaN(t) ? (v = i.replaced ? t : replace(e, t, i, a, false, l, b), v !== t && (O = {
|
|
593
|
+
replaced: v
|
|
594
|
+
})) : v = t, b && b(), v;
|
|
595
|
+
if (null === t) return b && b(), t;
|
|
596
|
+
if (o && t && "object" == _typeof(t) && !i.iterateIn && !i.iterateUnsetNumeric) {
|
|
597
|
+
var _n = y.indexOf(t);
|
|
598
|
+
if (-1 !== _n) return p[e] = "#", b && b({
|
|
599
|
+
cyclicKeypath: u[_n]
|
|
600
|
+
}), "#" + u[_n];
|
|
601
|
+
true === o && (y.push(t), u.push(e));
|
|
602
|
+
}
|
|
603
|
+
var m = isPlainObject(t),
|
|
604
|
+
P = s(t),
|
|
605
|
+
T = (m || P) && (!_this2.plainObjectReplacers.length || i.replaced) || i.iterateIn ? t : replace(e, t, i, a, m || P, null, b);
|
|
606
|
+
var g;
|
|
607
|
+
if (T !== t ? (v = T, O = {
|
|
608
|
+
replaced: T
|
|
609
|
+
}) : "" === e && hasConstructorOf(t, TypesonPromise) ? (a.push([e, t, o, i, void 0, void 0, i.type]), v = t) : P && "object" !== i.iterateIn || "array" === i.iterateIn ? (g = new Array(t.length), O = {
|
|
610
|
+
clone: g
|
|
611
|
+
}) : !m && ("object" != _typeof(t) || "toJSON" in t || hasConstructorOf(t, TypesonPromise) || hasConstructorOf(t, Promise) || hasConstructorOf(t, ArrayBuffer)) && "object" !== i.iterateIn ? v = t : (g = {}, i.addLength && (g.length = t.length), O = {
|
|
612
|
+
clone: g
|
|
613
|
+
}), b && b(), c.iterateNone) return g !== null && g !== void 0 ? g : v;
|
|
614
|
+
if (!g) return v;
|
|
615
|
+
if (i.iterateIn) {
|
|
616
|
+
var _loop = function _loop(_n2) {
|
|
617
|
+
var s = {
|
|
618
|
+
ownKeys: r(t, _n2)
|
|
697
619
|
};
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
} else n(r).forEach(function (n) {
|
|
704
|
-
var o = t + (t ? "." : "") + escapeKeyPathComponent(n);
|
|
705
|
-
O(c, {
|
|
706
|
-
ownKeys: true
|
|
707
|
-
}, function () {
|
|
708
|
-
var t = m(o, r[n], Boolean(a), c, y, v);
|
|
709
|
-
hasConstructorOf(t, e) ? y.push([o, t, Boolean(a), c, T, n, c.type]) : void 0 !== t && (T[n] = t);
|
|
620
|
+
_adaptBuiltinStateObjectProperties(i, s, function () {
|
|
621
|
+
var r = e + (e ? "." : "") + escapeKeyPathComponent(_n2),
|
|
622
|
+
s = getEncapsulatedValue(r, t, _n2),
|
|
623
|
+
c = s && s.value;
|
|
624
|
+
hasConstructorOf(c, TypesonPromise) ? a.push([r, c, Boolean(o), i, g, _n2, i.type]) : s && (void 0 !== c || "substitute" in s) && (g[_n2] = c);
|
|
710
625
|
});
|
|
711
|
-
}
|
|
712
|
-
|
|
626
|
+
};
|
|
627
|
+
for (var _n2 in t) {
|
|
628
|
+
_loop(_n2);
|
|
629
|
+
}
|
|
630
|
+
b && b({
|
|
631
|
+
endIterateIn: true,
|
|
713
632
|
end: true
|
|
714
633
|
});
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
634
|
+
} else n(t).forEach(function (n) {
|
|
635
|
+
var r = e + (e ? "." : "") + escapeKeyPathComponent(n);
|
|
636
|
+
_adaptBuiltinStateObjectProperties(i, {
|
|
637
|
+
ownKeys: true
|
|
638
|
+
}, function () {
|
|
639
|
+
var e = getEncapsulatedValue(r, t, n),
|
|
640
|
+
s = e && e.value;
|
|
641
|
+
hasConstructorOf(s, TypesonPromise) ? a.push([r, s, Boolean(o), i, g, n, i.type]) : e && (void 0 !== s || "substitute" in e) && (g[n] = s);
|
|
642
|
+
});
|
|
643
|
+
}), b && b({
|
|
644
|
+
endIterateOwn: true,
|
|
645
|
+
end: true
|
|
646
|
+
});
|
|
647
|
+
if (i.iterateUnsetNumeric) {
|
|
648
|
+
var _n3 = t.length;
|
|
649
|
+
var _loop2 = function _loop2(_r2) {
|
|
650
|
+
if (_r2 in t) return 1; // continue
|
|
651
|
+
var n = "".concat(e).concat(e ? "." : "").concat(String(_r2));
|
|
652
|
+
_adaptBuiltinStateObjectProperties(i, {
|
|
653
|
+
ownKeys: false
|
|
654
|
+
}, function () {
|
|
655
|
+
var e = _encapsulate2(n, void 0, Boolean(o), i, a, l);
|
|
656
|
+
hasConstructorOf(e, TypesonPromise) ? a.push([n, e, Boolean(o), i, g, _r2, i.type]) : void 0 !== e && (g[_r2] = e);
|
|
730
657
|
});
|
|
658
|
+
};
|
|
659
|
+
for (var _r2 = 0; _r2 < _n3; _r2++) {
|
|
660
|
+
if (_loop2(_r2)) continue;
|
|
731
661
|
}
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
a && a({
|
|
750
|
-
replacing: true
|
|
751
|
-
});
|
|
752
|
-
var d = void 0;
|
|
753
|
-
if (y || !p.replaceAsync) {
|
|
754
|
-
if (void 0 === p.replace) throw new TypeError("Missing replacer");
|
|
755
|
-
d = p.replace(t, r);
|
|
756
|
-
} else d = p.replaceAsync(t, r);
|
|
757
|
-
return m(e, d, h && "readonly", r, n, i, f);
|
|
662
|
+
b && b({
|
|
663
|
+
endIterateUnsetNumeric: true,
|
|
664
|
+
end: true
|
|
665
|
+
});
|
|
666
|
+
}
|
|
667
|
+
return g;
|
|
668
|
+
},
|
|
669
|
+
replace = function replace(e, t, n, r, s, o, i) {
|
|
670
|
+
var c = s ? _this2.plainObjectReplacers : _this2.nonplainObjectReplacers;
|
|
671
|
+
var y = c.length;
|
|
672
|
+
for (; y--;) {
|
|
673
|
+
var _s2 = c[y];
|
|
674
|
+
if (_s2.test(t, n)) {
|
|
675
|
+
var _c = _s2.type;
|
|
676
|
+
if (Object.hasOwn(_this2.revivers, _c)) {
|
|
677
|
+
var _t3 = p[e];
|
|
678
|
+
p[e] = _t3 ? [_c].concat(_t3) : _c;
|
|
758
679
|
}
|
|
680
|
+
if (Object.assign(n, {
|
|
681
|
+
type: _c,
|
|
682
|
+
replaced: true
|
|
683
|
+
}), (a || !_s2.replaceAsync) && !_s2.replace) return i && i({
|
|
684
|
+
typeDetected: true
|
|
685
|
+
}), _encapsulate2(e, t, h && "readonly", n, r, o, _c);
|
|
686
|
+
var _y = void 0;
|
|
687
|
+
if (i && i({
|
|
688
|
+
replacing: true
|
|
689
|
+
}), a || !_s2.replaceAsync) {
|
|
690
|
+
if (void 0 === _s2.replace) throw new TypeError("Missing replacer");
|
|
691
|
+
_y = _s2.replace(t, n);
|
|
692
|
+
} else _y = _s2.replaceAsync(t, n);
|
|
693
|
+
return _encapsulate2(e, _y, h && "readonly", n, r, o, _c);
|
|
759
694
|
}
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
}
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
695
|
+
}
|
|
696
|
+
return t;
|
|
697
|
+
},
|
|
698
|
+
v = _encapsulate2("", e, h, t !== null && t !== void 0 ? t : {}, l);
|
|
699
|
+
if (l.length) return a && c.throwOnBadSyncType ? function () {
|
|
700
|
+
throw new TypeError("Sync method requested but async result obtained");
|
|
701
|
+
}() : Promise.resolve(_checkPromises(v, l)).then(finish);
|
|
702
|
+
if (!a && c.throwOnBadSyncType) throw new TypeError("Async method requested but sync result obtained");
|
|
703
|
+
return a && c.stringification ? [finish(v)] : a ? finish(v) : Promise.resolve(finish(v));
|
|
704
|
+
}
|
|
705
|
+
}, {
|
|
706
|
+
key: "encapsulateSync",
|
|
707
|
+
value: function encapsulateSync(e, t, n) {
|
|
708
|
+
return this.encapsulate(e, t, _objectSpread2(_objectSpread2({
|
|
709
|
+
throwOnBadSyncType: true
|
|
710
|
+
}, n), {}, {
|
|
711
|
+
sync: true
|
|
712
|
+
}));
|
|
713
|
+
}
|
|
714
|
+
}, {
|
|
715
|
+
key: "encapsulateAsync",
|
|
716
|
+
value: function encapsulateAsync(e, t, n) {
|
|
717
|
+
return this.encapsulate(e, t, _objectSpread2(_objectSpread2({
|
|
718
|
+
throwOnBadSyncType: true
|
|
719
|
+
}, n), {}, {
|
|
720
|
+
sync: false
|
|
721
|
+
}));
|
|
722
|
+
}
|
|
723
|
+
}, {
|
|
724
|
+
key: "revive",
|
|
725
|
+
value: function revive(e, t) {
|
|
726
|
+
var _this3 = this;
|
|
727
|
+
var o = _objectSpread2(_objectSpread2({
|
|
775
728
|
sync: true
|
|
776
|
-
}))
|
|
729
|
+
}, this.options), t),
|
|
730
|
+
i = o.sync;
|
|
731
|
+
function finishRevival(e) {
|
|
732
|
+
if (i) return e;
|
|
733
|
+
if (o.throwOnBadSyncType) throw new TypeError("Async method requested but sync result obtained");
|
|
734
|
+
return Promise.resolve(e);
|
|
777
735
|
}
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
736
|
+
if (!e || "object" != _typeof(e) || Array.isArray(e)) return finishRevival(e);
|
|
737
|
+
var c = e.$types;
|
|
738
|
+
if (true === c) return finishRevival(e.$);
|
|
739
|
+
if (!c || "object" != _typeof(c) || Array.isArray(c)) return finishRevival(e);
|
|
740
|
+
var a = [],
|
|
741
|
+
p = Object.create(null),
|
|
742
|
+
y = {};
|
|
743
|
+
var u = true;
|
|
744
|
+
c.$ && isPlainObject(c.$) && (e = e.$, c = c.$, u = false);
|
|
745
|
+
var executeReviver = function executeReviver(e, t) {
|
|
746
|
+
var _this3$revivers$e;
|
|
747
|
+
var _ref4 = (_this3$revivers$e = _this3.revivers[e]) !== null && _this3$revivers$e !== void 0 ? _this3$revivers$e : [],
|
|
748
|
+
_ref5 = _slicedToArray(_ref4, 1),
|
|
749
|
+
n = _ref5[0];
|
|
750
|
+
if (!n) throw new Error("Unregistered type: " + e);
|
|
751
|
+
if (i && !("revive" in n)) return t;
|
|
752
|
+
if (!i && n.reviveAsync) return n.reviveAsync(t, y);
|
|
753
|
+
if (n.revive) return n.revive(t, y);
|
|
754
|
+
throw new Error("Missing reviver");
|
|
755
|
+
},
|
|
756
|
+
l = [];
|
|
757
|
+
function checkUndefined(e) {
|
|
758
|
+
return hasConstructorOf(e, Undefined) ? void 0 : e;
|
|
786
759
|
}
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
760
|
+
var h = function () {
|
|
761
|
+
if (!c) throw new Error("Found bad `types`");
|
|
762
|
+
var t = [];
|
|
763
|
+
if (Object.entries(c).forEach(function (_ref6) {
|
|
764
|
+
var _ref7 = _slicedToArray(_ref6, 2),
|
|
765
|
+
e = _ref7[0],
|
|
766
|
+
n = _ref7[1];
|
|
767
|
+
"#" !== n && [].concat(n).forEach(function (n) {
|
|
768
|
+
var _this3$revivers$n;
|
|
769
|
+
var _ref8 = (_this3$revivers$n = _this3.revivers[n]) !== null && _this3$revivers$n !== void 0 ? _this3$revivers$n : [null, {}],
|
|
770
|
+
_ref9 = _slicedToArray(_ref8, 2),
|
|
771
|
+
r = _ref9[1].plain;
|
|
772
|
+
r && (t.push({
|
|
773
|
+
keypath: e,
|
|
774
|
+
type: n
|
|
775
|
+
}), delete c[e]);
|
|
776
|
+
});
|
|
777
|
+
}), t.length) return t.sort(nestedPathsFirst), t.reduce(function reducer(t, _ref0) {
|
|
778
|
+
var n = _ref0.keypath,
|
|
779
|
+
r = _ref0.type;
|
|
780
|
+
if (isThenable(t)) return t.then(function (e) {
|
|
781
|
+
return reducer(e, {
|
|
782
|
+
keypath: n,
|
|
783
|
+
type: r
|
|
784
|
+
});
|
|
785
|
+
});
|
|
786
|
+
var s = getByKeyPath(e, n);
|
|
787
|
+
if (s = executeReviver(r, s), hasConstructorOf(s, TypesonPromise)) return s.then(function (t) {
|
|
788
|
+
var r = setAtKeyPath(e, n, t);
|
|
789
|
+
r === t && (e = r);
|
|
790
|
+
});
|
|
791
|
+
var o = setAtKeyPath(e, n, s);
|
|
792
|
+
o === s && (e = o);
|
|
793
|
+
}, void 0);
|
|
794
|
+
}();
|
|
795
|
+
var f;
|
|
796
|
+
return hasConstructorOf(h, TypesonPromise) ? f = h.then(function () {
|
|
797
|
+
return e;
|
|
798
|
+
}) : (f = function _revive(e, t, o, y, h) {
|
|
799
|
+
if (u && "$types" === e) return;
|
|
800
|
+
var f = l.length,
|
|
801
|
+
d = c[e],
|
|
802
|
+
v = s(t);
|
|
803
|
+
if (v || isPlainObject(t)) {
|
|
804
|
+
var _s3 = v ? new Array(t.length) : {};
|
|
805
|
+
for (n(t).forEach(function (n) {
|
|
806
|
+
var r = _revive(e + (e ? "." : "") + escapeKeyPathComponent(n), t[n], o !== null && o !== void 0 ? o : _s3, _s3, n),
|
|
807
|
+
set = function set(e) {
|
|
808
|
+
return hasConstructorOf(e, Undefined) ? _s3[n] = void 0 : void 0 !== e && (_s3[n] = e), e;
|
|
809
|
+
};
|
|
810
|
+
hasConstructorOf(r, TypesonPromise) ? l.push(r.then(function (e) {
|
|
811
|
+
return set(e);
|
|
812
|
+
})) : set(r);
|
|
813
|
+
}), t = _s3; a.length;) {
|
|
814
|
+
var _a$ = _slicedToArray(a[0], 4),
|
|
815
|
+
_e = _a$[0],
|
|
816
|
+
_t4 = _a$[1],
|
|
817
|
+
_n4 = _a$[2],
|
|
818
|
+
_s4 = _a$[3],
|
|
819
|
+
_o2 = r(p, _t4),
|
|
820
|
+
_i = _o2 ? p[_t4] : getByKeyPath(_e, _t4);
|
|
821
|
+
if (!_o2 && void 0 === _i) break;
|
|
822
|
+
_n4[_s4] = _i, a.shift();
|
|
823
|
+
}
|
|
799
824
|
}
|
|
800
|
-
if (!
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
p = true;
|
|
807
|
-
u.$ && isPlainObject(u.$) && (t = t.$, u = u.$, p = false);
|
|
808
|
-
var f = function executeReviver(e, t) {
|
|
809
|
-
var r,
|
|
810
|
-
n = _slicedToArray(null !== (r = o.revivers[e]) && void 0 !== r ? r : [], 1)[0];
|
|
811
|
-
if (!n) throw new Error("Unregistered type: " + e);
|
|
812
|
-
if (c && !("revive" in n)) return t;
|
|
813
|
-
if (!c && n.reviveAsync) return n.reviveAsync(t, l);
|
|
814
|
-
if (n.revive) return n.revive(t, l);
|
|
815
|
-
throw new Error("Missing reviver");
|
|
816
|
-
},
|
|
817
|
-
v = [];
|
|
818
|
-
function checkUndefined(e) {
|
|
819
|
-
return hasConstructorOf(e, s) ? void 0 : e;
|
|
825
|
+
if (!d) return p[e] = t, t;
|
|
826
|
+
if ("#" === d) {
|
|
827
|
+
var _e2 = t.slice(1),
|
|
828
|
+
_n5 = r(p, _e2),
|
|
829
|
+
_s5 = _n5 ? p[_e2] : getByKeyPath(o, _e2);
|
|
830
|
+
return _n5 || void 0 !== _s5 || a.push([o, _e2, y, h]), _s5;
|
|
820
831
|
}
|
|
821
|
-
var
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
832
|
+
var applyType = function applyType(t) {
|
|
833
|
+
var n = [].concat(d).reduce(function reducer(e, t) {
|
|
834
|
+
if (hasConstructorOf(e, TypesonPromise)) return e.then(function (e) {
|
|
835
|
+
return reducer(e, t);
|
|
836
|
+
});
|
|
837
|
+
if ("string" != typeof t) throw new TypeError("Bad type JSON");
|
|
838
|
+
return executeReviver(t, e);
|
|
839
|
+
}, t);
|
|
840
|
+
return hasConstructorOf(n, TypesonPromise) ? n.then(function (t) {
|
|
841
|
+
return p[e] = t, t;
|
|
842
|
+
}) : (p[e] = n, n);
|
|
843
|
+
};
|
|
844
|
+
return !i && l.length > f ? TypesonPromise.all(l.slice(f)).then(function () {
|
|
845
|
+
return applyType(t);
|
|
846
|
+
}) : applyType(t);
|
|
847
|
+
}("", e, null), l.length && (f = TypesonPromise.resolve(f).then(function (e) {
|
|
848
|
+
return TypesonPromise.all([e].concat(l));
|
|
849
|
+
}).then(function (_ref1) {
|
|
850
|
+
var _ref10 = _slicedToArray(_ref1, 1),
|
|
851
|
+
e = _ref10[0];
|
|
852
|
+
return e;
|
|
853
|
+
}))), isThenable(f) ? i && o.throwOnBadSyncType ? function () {
|
|
854
|
+
throw new TypeError("Sync method requested but async result obtained");
|
|
855
|
+
}() : hasConstructorOf(f, TypesonPromise) ? f.p.then(checkUndefined) : f : !i && o.throwOnBadSyncType ? function () {
|
|
856
|
+
throw new TypeError("Async method requested but sync result obtained");
|
|
857
|
+
}() : i ? checkUndefined(f) : Promise.resolve(checkUndefined(f));
|
|
858
|
+
}
|
|
859
|
+
}, {
|
|
860
|
+
key: "reviveSync",
|
|
861
|
+
value: function reviveSync(e, t) {
|
|
862
|
+
return this.revive(e, _objectSpread2(_objectSpread2({
|
|
863
|
+
throwOnBadSyncType: true
|
|
864
|
+
}, t), {}, {
|
|
865
|
+
sync: true
|
|
866
|
+
}));
|
|
867
|
+
}
|
|
868
|
+
}, {
|
|
869
|
+
key: "reviveAsync",
|
|
870
|
+
value: function reviveAsync(e, t) {
|
|
871
|
+
return this.revive(e, _objectSpread2(_objectSpread2({
|
|
872
|
+
throwOnBadSyncType: true
|
|
873
|
+
}, t), {}, {
|
|
874
|
+
sync: false
|
|
875
|
+
}));
|
|
876
|
+
}
|
|
877
|
+
}, {
|
|
878
|
+
key: "register",
|
|
879
|
+
value: function register(e, t) {
|
|
880
|
+
var _this4 = this;
|
|
881
|
+
var r = t !== null && t !== void 0 ? t : {},
|
|
882
|
+
_reg = function reg(e) {
|
|
883
|
+
s(e) ? e.forEach(function (e) {
|
|
884
|
+
_reg(e);
|
|
885
|
+
}) : n(e).forEach(function (t) {
|
|
886
|
+
var _n8;
|
|
887
|
+
if ("#" === t) throw new TypeError("# cannot be used as a type name as it is reserved for cyclic objects");
|
|
888
|
+
if (i$1.includes(t)) throw new TypeError("Plain JSON object types are reserved as type names");
|
|
889
|
+
var n = e[t];
|
|
890
|
+
var o = n && "function" != typeof n && !Array.isArray(n) && n.testPlainObjects ? _this4.plainObjectReplacers : _this4.nonplainObjectReplacers,
|
|
891
|
+
c = o.filter(function (e) {
|
|
892
|
+
return e.type === t;
|
|
849
893
|
});
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
m = b[2],
|
|
875
|
-
j = b[3],
|
|
876
|
-
g = getByKeyPath(_, O);
|
|
877
|
-
if (void 0 === g) break;
|
|
878
|
-
m[j] = g, y.splice(0, 1);
|
|
879
|
-
}
|
|
894
|
+
if (c.length && (o.splice(o.indexOf(c[0]), 1), delete _this4.revivers[t], delete _this4.types[t]), "function" == typeof n) {
|
|
895
|
+
var _e3 = n;
|
|
896
|
+
n = {
|
|
897
|
+
test: function test(t) {
|
|
898
|
+
return t && t.constructor === _e3;
|
|
899
|
+
},
|
|
900
|
+
replace: function replace(e) {
|
|
901
|
+
return _objectSpread2({}, e);
|
|
902
|
+
},
|
|
903
|
+
revive: function revive(t) {
|
|
904
|
+
return Object.assign(Object.create(_e3.prototype), t);
|
|
905
|
+
}
|
|
906
|
+
};
|
|
907
|
+
} else if (s(n)) {
|
|
908
|
+
var _n6 = n,
|
|
909
|
+
_n7 = _slicedToArray(_n6, 3),
|
|
910
|
+
_e4 = _n7[0],
|
|
911
|
+
_t5 = _n7[1],
|
|
912
|
+
_r3 = _n7[2];
|
|
913
|
+
n = {
|
|
914
|
+
test: _e4,
|
|
915
|
+
replace: _t5,
|
|
916
|
+
revive: _r3
|
|
917
|
+
};
|
|
880
918
|
}
|
|
881
|
-
if (!
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
919
|
+
if (!((_n8 = n) !== null && _n8 !== void 0 && _n8.test)) return;
|
|
920
|
+
var a = {
|
|
921
|
+
type: t,
|
|
922
|
+
test: n.test.bind(n)
|
|
923
|
+
};
|
|
924
|
+
n.replace && (a.replace = n.replace.bind(n)), n.replaceAsync && (a.replaceAsync = n.replaceAsync.bind(n));
|
|
925
|
+
var p = "number" == typeof r.fallback ? r.fallback : r.fallback ? 0 : 1 / 0;
|
|
926
|
+
if (n.testPlainObjects ? _this4.plainObjectReplacers.splice(p, 0, a) : _this4.nonplainObjectReplacers.splice(p, 0, a), n.revive || n.reviveAsync) {
|
|
927
|
+
var _e5 = {};
|
|
928
|
+
n.revive && (_e5.revive = n.revive.bind(n)), n.reviveAsync && (_e5.reviveAsync = n.reviveAsync.bind(n)), _this4.revivers[t] = [_e5, {
|
|
929
|
+
plain: n.testPlainObjects
|
|
930
|
+
}];
|
|
885
931
|
}
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
}() : hasConstructorOf(h, e) ? h.p.then(checkUndefined) : h : !c && a.throwOnBadSyncType ? function () {
|
|
901
|
-
throw new TypeError("Async method requested but sync result obtained");
|
|
902
|
-
}() : c ? checkUndefined(h) : Promise.resolve(checkUndefined(h));
|
|
903
|
-
}
|
|
904
|
-
}, {
|
|
905
|
-
key: "reviveSync",
|
|
906
|
-
value: function reviveSync(e, t) {
|
|
907
|
-
return this.revive(e, _objectSpread2(_objectSpread2({
|
|
908
|
-
throwOnBadSyncType: true
|
|
909
|
-
}, t), {}, {
|
|
910
|
-
sync: true
|
|
911
|
-
}));
|
|
912
|
-
}
|
|
913
|
-
}, {
|
|
914
|
-
key: "reviveAsync",
|
|
915
|
-
value: function reviveAsync(e, t) {
|
|
916
|
-
return this.revive(e, _objectSpread2(_objectSpread2({
|
|
917
|
-
throwOnBadSyncType: true
|
|
918
|
-
}, t), {}, {
|
|
919
|
-
sync: false
|
|
920
|
-
}));
|
|
921
|
-
}
|
|
922
|
-
}, {
|
|
923
|
-
key: "register",
|
|
924
|
-
value: function register(e, t) {
|
|
925
|
-
var r = this,
|
|
926
|
-
o = null != t ? t : {},
|
|
927
|
-
a = function reg(e) {
|
|
928
|
-
i$1(e) ? e.forEach(function (e) {
|
|
929
|
-
a(e);
|
|
930
|
-
}) : n(e).forEach(function (t) {
|
|
931
|
-
var n;
|
|
932
|
-
if ("#" === t) throw new TypeError("# cannot be used as a type name as it is reserved for cyclic objects");
|
|
933
|
-
if (u.includes(t)) throw new TypeError("Plain JSON object types are reserved as type names");
|
|
934
|
-
var a = e[t],
|
|
935
|
-
c = a && "function" != typeof a && !Array.isArray(a) && a.testPlainObjects ? r.plainObjectReplacers : r.nonplainObjectReplacers,
|
|
936
|
-
s = c.filter(function (e) {
|
|
937
|
-
return e.type === t;
|
|
938
|
-
});
|
|
939
|
-
if (s.length && (c.splice(c.indexOf(s[0]), 1), delete r.revivers[t], delete r.types[t]), "function" == typeof a) {
|
|
940
|
-
var y = a;
|
|
941
|
-
a = {
|
|
942
|
-
test: function test(e) {
|
|
943
|
-
return e && e.constructor === y;
|
|
944
|
-
},
|
|
945
|
-
replace: function replace(e) {
|
|
946
|
-
return _objectSpread2({}, e);
|
|
947
|
-
},
|
|
948
|
-
revive: function revive(e) {
|
|
949
|
-
return Object.assign(Object.create(y.prototype), e);
|
|
950
|
-
}
|
|
951
|
-
};
|
|
952
|
-
} else if (i$1(a)) {
|
|
953
|
-
var l = _slicedToArray(a, 3);
|
|
954
|
-
a = {
|
|
955
|
-
test: l[0],
|
|
956
|
-
replace: l[1],
|
|
957
|
-
revive: l[2]
|
|
958
|
-
};
|
|
959
|
-
}
|
|
960
|
-
if (null !== (n = a) && void 0 !== n && n.test) {
|
|
961
|
-
var p = {
|
|
962
|
-
type: t,
|
|
963
|
-
test: a.test.bind(a)
|
|
964
|
-
};
|
|
965
|
-
a.replace && (p.replace = a.replace.bind(a)), a.replaceAsync && (p.replaceAsync = a.replaceAsync.bind(a));
|
|
966
|
-
var f = "number" == typeof o.fallback ? o.fallback : o.fallback ? 0 : Number.POSITIVE_INFINITY;
|
|
967
|
-
if (a.testPlainObjects ? r.plainObjectReplacers.splice(f, 0, p) : r.nonplainObjectReplacers.splice(f, 0, p), a.revive || a.reviveAsync) {
|
|
968
|
-
var v = {};
|
|
969
|
-
a.revive && (v.revive = a.revive.bind(a)), a.reviveAsync && (v.reviveAsync = a.reviveAsync.bind(a)), r.revivers[t] = [v, {
|
|
970
|
-
plain: a.testPlainObjects
|
|
971
|
-
}];
|
|
972
|
-
}
|
|
973
|
-
r.types[t] = a;
|
|
974
|
-
}
|
|
975
|
-
});
|
|
976
|
-
};
|
|
977
|
-
return [].concat(e).forEach(function (e) {
|
|
978
|
-
a(e);
|
|
979
|
-
}), this;
|
|
980
|
-
}
|
|
981
|
-
}]);
|
|
982
|
-
}(),
|
|
983
|
-
s = _createClass(function Undefined() {
|
|
984
|
-
_classCallCheck(this, Undefined);
|
|
985
|
-
});
|
|
986
|
-
s.__typeson__type__ = "TypesonUndefined";
|
|
987
|
-
var u = ["null", "boolean", "number", "string", "array", "object"];
|
|
932
|
+
_this4.types[t] = n;
|
|
933
|
+
});
|
|
934
|
+
};
|
|
935
|
+
return [].concat(e).forEach(function (e) {
|
|
936
|
+
_reg(e);
|
|
937
|
+
}), this;
|
|
938
|
+
}
|
|
939
|
+
}]);
|
|
940
|
+
}();
|
|
941
|
+
var Undefined = /*#__PURE__*/_createClass(function Undefined() {
|
|
942
|
+
_classCallCheck(this, Undefined);
|
|
943
|
+
});
|
|
944
|
+
Undefined.__typeson__type__ = "TypesonUndefined";
|
|
945
|
+
var i$1 = ["null", "boolean", "number", "string", "array", "object"];
|
|
988
946
|
|
|
989
947
|
/*
|
|
990
948
|
* base64-arraybuffer
|
|
@@ -1137,7 +1095,7 @@
|
|
|
1137
1095
|
var bigintObject = {
|
|
1138
1096
|
bigintObject: {
|
|
1139
1097
|
test: function test(x) {
|
|
1140
|
-
return _typeof
|
|
1098
|
+
return _typeof(x) === 'object' && hasConstructorOf(x, BigInt);
|
|
1141
1099
|
},
|
|
1142
1100
|
replace: String,
|
|
1143
1101
|
revive: function revive(s) {
|
|
@@ -1269,7 +1227,7 @@
|
|
|
1269
1227
|
});
|
|
1270
1228
|
},
|
|
1271
1229
|
replaceAsync: function replaceAsync(b) {
|
|
1272
|
-
return new
|
|
1230
|
+
return new TypesonPromise(function (resolve, reject) {
|
|
1273
1231
|
/*
|
|
1274
1232
|
if (b.isClosed) { // On MDN, but not in https://w3c.github.io/FileAPI/#dfn-Blob
|
|
1275
1233
|
reject(new Error('The Blob is closed'));
|
|
@@ -1304,7 +1262,7 @@
|
|
|
1304
1262
|
* @returns {string}
|
|
1305
1263
|
*/
|
|
1306
1264
|
function generateUUID() {
|
|
1307
|
-
// Adapted from original: public domain/MIT:
|
|
1265
|
+
// Adapted from original: public domain/MIT: https://stackoverflow.com/a/8809472/271577
|
|
1308
1266
|
/* c8 ignore next */
|
|
1309
1267
|
var d = Date.now();
|
|
1310
1268
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replaceAll(/[xy]/g, function (c) {
|
|
@@ -1327,7 +1285,7 @@
|
|
|
1327
1285
|
var cloneable = {
|
|
1328
1286
|
cloneable: {
|
|
1329
1287
|
test: function test(x) {
|
|
1330
|
-
return x && _typeof
|
|
1288
|
+
return x && _typeof(x) === 'object' && typeof x[Symbol["for"]('cloneEncapsulate')] === 'function';
|
|
1331
1289
|
},
|
|
1332
1290
|
replace: function replace(clonable) {
|
|
1333
1291
|
var encapsulated = clonable[Symbol["for"]('cloneEncapsulate')]();
|
|
@@ -1356,7 +1314,7 @@
|
|
|
1356
1314
|
},
|
|
1357
1315
|
replaceAsync: function replaceAsync(/** @type {CryptoKey} */
|
|
1358
1316
|
key) {
|
|
1359
|
-
return new
|
|
1317
|
+
return new TypesonPromise(/*#__PURE__*/function () {
|
|
1360
1318
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(resolve, reject) {
|
|
1361
1319
|
var jwk, _t;
|
|
1362
1320
|
return _regenerator().w(function (_context) {
|
|
@@ -1393,30 +1351,30 @@
|
|
|
1393
1351
|
revive: function revive(obj) {
|
|
1394
1352
|
var jwk = (
|
|
1395
1353
|
/**
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1354
|
+
* @type {{
|
|
1355
|
+
* jwk: JsonWebKey,
|
|
1356
|
+
* algorithm: KeyAlgorithm,
|
|
1357
|
+
* usages: KeyUsage[]
|
|
1358
|
+
* }}
|
|
1359
|
+
*/
|
|
1402
1360
|
obj).jwk,
|
|
1403
1361
|
algorithm = (
|
|
1404
1362
|
/**
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1363
|
+
* @type {{
|
|
1364
|
+
* jwk: JsonWebKey,
|
|
1365
|
+
* algorithm: KeyAlgorithm,
|
|
1366
|
+
* usages: KeyUsage[]
|
|
1367
|
+
* }}
|
|
1368
|
+
*/
|
|
1411
1369
|
obj).algorithm,
|
|
1412
1370
|
usages = (
|
|
1413
1371
|
/**
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1372
|
+
* @type {{
|
|
1373
|
+
* jwk: JsonWebKey,
|
|
1374
|
+
* algorithm: KeyAlgorithm,
|
|
1375
|
+
* usages: KeyUsage[]
|
|
1376
|
+
* }}
|
|
1377
|
+
*/
|
|
1420
1378
|
obj).usages;
|
|
1421
1379
|
return crypto.subtle.importKey('jwk', jwk, algorithm, true, usages);
|
|
1422
1380
|
}
|
|
@@ -1508,7 +1466,7 @@
|
|
|
1508
1466
|
},
|
|
1509
1467
|
revive: function revive(time) {
|
|
1510
1468
|
if (time === 'NaN') {
|
|
1511
|
-
return new Date(
|
|
1469
|
+
return new Date(NaN);
|
|
1512
1470
|
}
|
|
1513
1471
|
return new Date(time);
|
|
1514
1472
|
}
|
|
@@ -1746,19 +1704,21 @@
|
|
|
1746
1704
|
revive: function revive(obj) {
|
|
1747
1705
|
var e =
|
|
1748
1706
|
/**
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1707
|
+
* @type {{
|
|
1708
|
+
* name: string,
|
|
1709
|
+
* cause: Error,
|
|
1710
|
+
* stack: string,
|
|
1711
|
+
* fileName?: string,
|
|
1712
|
+
* lineNumber?: import('typeson').Integer,
|
|
1713
|
+
* columnNumber?: import('typeson').Integer
|
|
1714
|
+
* }}
|
|
1715
|
+
*/
|
|
1758
1716
|
new Error(obj.message);
|
|
1717
|
+
/* eslint-disable unicorn/no-error-property-assignment -- Ok */
|
|
1759
1718
|
e.name = obj.name;
|
|
1760
1719
|
e.cause = obj.cause;
|
|
1761
1720
|
e.stack = obj.stack;
|
|
1721
|
+
/* eslint-enable unicorn/no-error-property-assignment -- Ok */
|
|
1762
1722
|
e.fileName = obj.fileName;
|
|
1763
1723
|
e.lineNumber = obj.lineNumber;
|
|
1764
1724
|
e.columnNumber = obj.columnNumber;
|
|
@@ -1775,6 +1735,7 @@
|
|
|
1775
1735
|
var errors = {};
|
|
1776
1736
|
|
|
1777
1737
|
// JS standard
|
|
1738
|
+
// eslint-disable-next-line unicorn/no-top-level-side-effects -- Too cumbersome
|
|
1778
1739
|
[TypeError, RangeError, SyntaxError, ReferenceError, EvalError, URIError].forEach(function (error) {
|
|
1779
1740
|
return create$2(error);
|
|
1780
1741
|
});
|
|
@@ -1791,7 +1752,6 @@
|
|
|
1791
1752
|
create$2(InternalError);
|
|
1792
1753
|
}
|
|
1793
1754
|
|
|
1794
|
-
/* eslint-disable jsdoc/valid-types -- https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/131 */
|
|
1795
1755
|
/**
|
|
1796
1756
|
* Non-standard.
|
|
1797
1757
|
* @typedef {{
|
|
@@ -1799,7 +1759,6 @@
|
|
|
1799
1759
|
* (message?: string, options?: ErrorOptions): EvalError;
|
|
1800
1760
|
* }} InternalErrorConstructor
|
|
1801
1761
|
*/
|
|
1802
|
-
/* eslint-enable jsdoc/valid-types -- https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/131 */
|
|
1803
1762
|
|
|
1804
1763
|
/**
|
|
1805
1764
|
* Comprises all built-in errors.
|
|
@@ -1839,23 +1798,23 @@
|
|
|
1839
1798
|
var isAggregateError = typeof AggregateError !== 'undefined' && Ctor === AggregateError;
|
|
1840
1799
|
var e =
|
|
1841
1800
|
/**
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1801
|
+
* @type {{
|
|
1802
|
+
* name: string,
|
|
1803
|
+
* cause: Error,
|
|
1804
|
+
* stack: string,
|
|
1805
|
+
* fileName?: string,
|
|
1806
|
+
* lineNumber?: import('typeson').Integer,
|
|
1807
|
+
* columnNumber?: import('typeson').Integer
|
|
1808
|
+
* }}
|
|
1809
|
+
*/
|
|
1851
1810
|
isAggregateError ? new (/** @type {AggregateErrorConstructor} */
|
|
1852
1811
|
Ctor)(obj.errors, obj.message) : new (
|
|
1853
1812
|
/**
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1813
|
+
* @type {TypeErrorConstructor|RangeErrorConstructor|
|
|
1814
|
+
* SyntaxErrorConstructor|ReferenceErrorConstructor|
|
|
1815
|
+
* EvalErrorConstructor|URIErrorConstructor|
|
|
1816
|
+
* InternalErrorConstructor}
|
|
1817
|
+
*/
|
|
1859
1818
|
Ctor)(obj.message);
|
|
1860
1819
|
e.name = obj.name;
|
|
1861
1820
|
e.cause = obj.cause;
|
|
@@ -1908,7 +1867,7 @@
|
|
|
1908
1867
|
});
|
|
1909
1868
|
},
|
|
1910
1869
|
replaceAsync: function replaceAsync(f) {
|
|
1911
|
-
return new
|
|
1870
|
+
return new TypesonPromise(function (resolve, reject) {
|
|
1912
1871
|
/*
|
|
1913
1872
|
if (f.isClosed) { // On MDN, but not in https://w3c.github.io/FileAPI/#dfn-Blob
|
|
1914
1873
|
reject(new Error('The File is closed'));
|
|
@@ -1962,7 +1921,7 @@
|
|
|
1962
1921
|
* Set private properties and length.
|
|
1963
1922
|
*/
|
|
1964
1923
|
function FileList() {
|
|
1965
|
-
_classCallCheck
|
|
1924
|
+
_classCallCheck(this, FileList);
|
|
1966
1925
|
// eslint-disable-next-line prefer-rest-params -- API
|
|
1967
1926
|
this._files = arguments[0];
|
|
1968
1927
|
this.length = this._files.length;
|
|
@@ -1971,7 +1930,7 @@
|
|
|
1971
1930
|
* @param {import('typeson').Integer} index
|
|
1972
1931
|
* @returns {File}
|
|
1973
1932
|
*/
|
|
1974
|
-
return _createClass
|
|
1933
|
+
return _createClass(FileList, [{
|
|
1975
1934
|
key: "item",
|
|
1976
1935
|
value: function item(index) {
|
|
1977
1936
|
return this._files[index];
|
|
@@ -2030,7 +1989,7 @@
|
|
|
2030
1989
|
var ctx = /** @type {CanvasRenderingContext2D} */
|
|
2031
1990
|
canvas.getContext('2d');
|
|
2032
1991
|
var img = document.createElement('img');
|
|
2033
|
-
// The onload is needed by some browsers per
|
|
1992
|
+
// The onload is needed by some browsers per https://stackoverflow.com/a/4776378/271577
|
|
2034
1993
|
img.addEventListener('load', function () {
|
|
2035
1994
|
ctx.drawImage(img, 0, 0);
|
|
2036
1995
|
});
|
|
@@ -2045,12 +2004,12 @@
|
|
|
2045
2004
|
var ctx = /** @type {CanvasRenderingContext2D} */
|
|
2046
2005
|
canvas.getContext('2d');
|
|
2047
2006
|
var img = document.createElement('img');
|
|
2048
|
-
// The onload is needed by some browsers per
|
|
2007
|
+
// The onload is needed by some browsers per https://stackoverflow.com/a/4776378/271577
|
|
2049
2008
|
img.addEventListener('load', function () {
|
|
2050
2009
|
ctx.drawImage(img, 0, 0);
|
|
2051
2010
|
});
|
|
2052
2011
|
img.src = o.dataURL;
|
|
2053
|
-
return new
|
|
2012
|
+
return new TypesonPromise(/*#__PURE__*/function () {
|
|
2054
2013
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(resolve, reject) {
|
|
2055
2014
|
var resp, _t;
|
|
2056
2015
|
return _regenerator().w(function (_context) {
|
|
@@ -2093,7 +2052,7 @@
|
|
|
2093
2052
|
replace: function replace(d) {
|
|
2094
2053
|
return {
|
|
2095
2054
|
// Ensure `length` gets preserved for revival
|
|
2096
|
-
array: _toConsumableArray
|
|
2055
|
+
array: _toConsumableArray(d.data),
|
|
2097
2056
|
width: d.width,
|
|
2098
2057
|
height: d.height
|
|
2099
2058
|
};
|
|
@@ -2110,13 +2069,13 @@
|
|
|
2110
2069
|
var infinity = {
|
|
2111
2070
|
infinity: {
|
|
2112
2071
|
test: function test(x) {
|
|
2113
|
-
return x ===
|
|
2072
|
+
return x === Infinity;
|
|
2114
2073
|
},
|
|
2115
2074
|
replace: function replace() {
|
|
2116
2075
|
return 'Infinity';
|
|
2117
2076
|
} /* n */,
|
|
2118
2077
|
revive: function revive() {
|
|
2119
|
-
return
|
|
2078
|
+
return Infinity;
|
|
2120
2079
|
} /* s */
|
|
2121
2080
|
}
|
|
2122
2081
|
};
|
|
@@ -2180,7 +2139,7 @@
|
|
|
2180
2139
|
return toStringTag(x) === 'Map';
|
|
2181
2140
|
},
|
|
2182
2141
|
replace: function replace(mp) {
|
|
2183
|
-
return
|
|
2142
|
+
return mp.entries().toArray();
|
|
2184
2143
|
},
|
|
2185
2144
|
revive: function revive(entries) {
|
|
2186
2145
|
return new Map(entries);
|
|
@@ -2200,7 +2159,7 @@
|
|
|
2200
2159
|
return 'NaN';
|
|
2201
2160
|
} /* n */,
|
|
2202
2161
|
revive: function revive() {
|
|
2203
|
-
return
|
|
2162
|
+
return NaN;
|
|
2204
2163
|
} /* s */
|
|
2205
2164
|
}
|
|
2206
2165
|
};
|
|
@@ -2211,13 +2170,13 @@
|
|
|
2211
2170
|
var negativeInfinity = {
|
|
2212
2171
|
negativeInfinity: {
|
|
2213
2172
|
test: function test(x) {
|
|
2214
|
-
return x ===
|
|
2173
|
+
return x === -Infinity;
|
|
2215
2174
|
},
|
|
2216
2175
|
replace: function replace() {
|
|
2217
2176
|
return '-Infinity';
|
|
2218
2177
|
} /* n */,
|
|
2219
2178
|
revive: function revive() {
|
|
2220
|
-
return
|
|
2179
|
+
return -Infinity;
|
|
2221
2180
|
} /* s */
|
|
2222
2181
|
}
|
|
2223
2182
|
};
|
|
@@ -2246,7 +2205,7 @@
|
|
|
2246
2205
|
var nonbuiltinIgnore = {
|
|
2247
2206
|
nonbuiltinIgnore: {
|
|
2248
2207
|
test: function test(x) {
|
|
2249
|
-
return x && _typeof
|
|
2208
|
+
return x && _typeof(x) === 'object' && !Array.isArray(x) && !['Object',
|
|
2250
2209
|
// `Proxy` and `Reflect`, two other built-in objects, will also
|
|
2251
2210
|
// have a `toStringTag` of `Object`; we don't want built-in
|
|
2252
2211
|
// function objects, however
|
|
@@ -2265,7 +2224,7 @@
|
|
|
2265
2224
|
// String Object (not primitive string which need no type spec)
|
|
2266
2225
|
StringObject: {
|
|
2267
2226
|
test: function test(x) {
|
|
2268
|
-
return toStringTag(x) === 'String' && _typeof
|
|
2227
|
+
return toStringTag(x) === 'String' && _typeof(x) === 'object';
|
|
2269
2228
|
},
|
|
2270
2229
|
replace: String,
|
|
2271
2230
|
// convert to primitive string
|
|
@@ -2276,7 +2235,7 @@
|
|
|
2276
2235
|
// Boolean Object (not primitive boolean which need no type spec)
|
|
2277
2236
|
BooleanObject: {
|
|
2278
2237
|
test: function test(x) {
|
|
2279
|
-
return toStringTag(x) === 'Boolean' && _typeof
|
|
2238
|
+
return toStringTag(x) === 'Boolean' && _typeof(x) === 'object';
|
|
2280
2239
|
},
|
|
2281
2240
|
replace: function replace(o) {
|
|
2282
2241
|
// convert to primitive boolean
|
|
@@ -2290,7 +2249,7 @@
|
|
|
2290
2249
|
// Number Object (not primitive number which need no type spec)
|
|
2291
2250
|
NumberObject: {
|
|
2292
2251
|
test: function test(x) {
|
|
2293
|
-
return toStringTag(x) === 'Number' && _typeof
|
|
2252
|
+
return toStringTag(x) === 'Number' && _typeof(x) === 'object';
|
|
2294
2253
|
},
|
|
2295
2254
|
replace: Number,
|
|
2296
2255
|
// convert to primitive number
|
|
@@ -2309,7 +2268,7 @@
|
|
|
2309
2268
|
return toStringTag(x) === 'Promise';
|
|
2310
2269
|
},
|
|
2311
2270
|
replaceAsync: function replaceAsync(prom) {
|
|
2312
|
-
return new
|
|
2271
|
+
return new TypesonPromise(/*#__PURE__*/function () {
|
|
2313
2272
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(resolve) {
|
|
2314
2273
|
var _t, _t2, _t3;
|
|
2315
2274
|
return _regenerator().w(function (_context) {
|
|
@@ -2381,7 +2340,7 @@
|
|
|
2381
2340
|
var resurrectable = {
|
|
2382
2341
|
resurrectable: {
|
|
2383
2342
|
test: function test(x) {
|
|
2384
|
-
return x && !Array.isArray(x) && ['object', 'function', 'symbol'].includes(_typeof
|
|
2343
|
+
return x && !Array.isArray(x) && ['object', 'function', 'symbol'].includes(_typeof(x));
|
|
2385
2344
|
},
|
|
2386
2345
|
replace: function replace(rsrrctble) {
|
|
2387
2346
|
var uuid = generateUUID();
|
|
@@ -2403,7 +2362,7 @@
|
|
|
2403
2362
|
return toStringTag(x) === 'Set';
|
|
2404
2363
|
},
|
|
2405
2364
|
replace: function replace(st) {
|
|
2406
|
-
return
|
|
2365
|
+
return st.values().toArray();
|
|
2407
2366
|
},
|
|
2408
2367
|
revive: function revive(values) {
|
|
2409
2368
|
return new Set(values);
|
|
@@ -2417,7 +2376,7 @@
|
|
|
2417
2376
|
var symbol = {
|
|
2418
2377
|
symbol: {
|
|
2419
2378
|
test: function test(x) {
|
|
2420
|
-
return _typeof
|
|
2379
|
+
return _typeof(x) === 'symbol';
|
|
2421
2380
|
},
|
|
2422
2381
|
replace: function replace(sym) {
|
|
2423
2382
|
return {
|
|
@@ -2477,7 +2436,7 @@
|
|
|
2477
2436
|
// Those constructors are added in ES6 as a group.
|
|
2478
2437
|
// If we have Int8Array, we can assume the rest also exists.
|
|
2479
2438
|
|
|
2480
|
-
[Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array].concat(_toConsumableArray
|
|
2439
|
+
[Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array].concat(_toConsumableArray(typeof BigInt64Array === 'function' ? [BigInt64Array, BigUint64Array]
|
|
2481
2440
|
/* c8 ignore next */ : [])).forEach(function (TypedArray) {
|
|
2482
2441
|
return create$1(TypedArray);
|
|
2483
2442
|
});
|
|
@@ -2570,7 +2529,7 @@
|
|
|
2570
2529
|
if (typeof Int8Array === 'function') {
|
|
2571
2530
|
// Those constructors are added in ES6 as a group.
|
|
2572
2531
|
// If we have Int8Array, we can assume the rest also exists.
|
|
2573
|
-
[Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array].concat(_toConsumableArray
|
|
2532
|
+
[Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array].concat(_toConsumableArray(typeof BigInt64Array === 'function' ? [BigInt64Array, BigUint64Array]
|
|
2574
2533
|
/* c8 ignore next */ : [])).forEach(function (TypedArray) {
|
|
2575
2534
|
return create(TypedArray);
|
|
2576
2535
|
});
|
|
@@ -2593,7 +2552,7 @@
|
|
|
2593
2552
|
revive: function revive() {
|
|
2594
2553
|
// Will add `undefined` (returning `undefined` would instead
|
|
2595
2554
|
// avoid explicitly setting)
|
|
2596
|
-
return new
|
|
2555
|
+
return new Undefined();
|
|
2597
2556
|
} /* s */
|
|
2598
2557
|
}
|
|
2599
2558
|
};
|
|
@@ -2607,7 +2566,7 @@
|
|
|
2607
2566
|
return isUserObject(x);
|
|
2608
2567
|
},
|
|
2609
2568
|
replace: function replace(n) {
|
|
2610
|
-
return _objectSpread2
|
|
2569
|
+
return _objectSpread2({}, n);
|
|
2611
2570
|
},
|
|
2612
2571
|
revive: function revive(s) {
|
|
2613
2572
|
return s;
|
|
@@ -2636,7 +2595,7 @@
|
|
|
2636
2595
|
// `Number.parseInt(Number())` since scientific
|
|
2637
2596
|
// notation will be pre-resolved if a number
|
|
2638
2597
|
// was given, and it will otherwise be a string
|
|
2639
|
-
return String(Number
|
|
2598
|
+
return String(Number(k)) !== k;
|
|
2640
2599
|
})) {
|
|
2641
2600
|
stateObj.iterateIn = 'object';
|
|
2642
2601
|
stateObj.addLength = true;
|
|
@@ -2662,7 +2621,7 @@
|
|
|
2662
2621
|
// No map here as may be a sparse array (including
|
|
2663
2622
|
// with `length` set)
|
|
2664
2623
|
Object.entries(o).forEach(function (_ref) {
|
|
2665
|
-
var _ref2 = _slicedToArray
|
|
2624
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
2666
2625
|
key = _ref2[0],
|
|
2667
2626
|
val = _ref2[1];
|
|
2668
2627
|
arr[key] = val;
|
|
@@ -2846,7 +2805,7 @@
|
|
|
2846
2805
|
// value, so we check `typeof`
|
|
2847
2806
|
'symbol',
|
|
2848
2807
|
// All functions including bound function exotic objects
|
|
2849
|
-
'function'].includes(_typeof
|
|
2808
|
+
'function'].includes(_typeof(val)) || [
|
|
2850
2809
|
// A non-array exotic object
|
|
2851
2810
|
'Arguments',
|
|
2852
2811
|
// A non-array exotic object
|
|
@@ -2869,7 +2828,7 @@
|
|
|
2869
2828
|
((stringTag === 'Blob' || stringTag === 'File') &&
|
|
2870
2829
|
val.isClosed) ||
|
|
2871
2830
|
*/
|
|
2872
|
-
val && _typeof
|
|
2831
|
+
val && _typeof(val) === 'object' &&
|
|
2873
2832
|
// Duck-type DOM node objects (non-array exotic?
|
|
2874
2833
|
// objects which cannot be cloned by the SCA)
|
|
2875
2834
|
typeof val.nodeType === 'number' && typeof val.insertBefore === 'function')) {
|
|
@@ -2893,10 +2852,10 @@
|
|
|
2893
2852
|
// built-in into ecmasript standard.
|
|
2894
2853
|
];
|
|
2895
2854
|
|
|
2896
|
-
exports.JSON_TYPES =
|
|
2897
|
-
exports.Typeson =
|
|
2898
|
-
exports.TypesonPromise =
|
|
2899
|
-
exports.Undefined =
|
|
2855
|
+
exports.JSON_TYPES = i$1;
|
|
2856
|
+
exports.Typeson = Typeson;
|
|
2857
|
+
exports.TypesonPromise = TypesonPromise;
|
|
2858
|
+
exports.Undefined = Undefined;
|
|
2900
2859
|
exports.arrayNonindexKeys = arrayNonindexKeys;
|
|
2901
2860
|
exports.arraybuffer = arraybuffer;
|
|
2902
2861
|
exports.bigint = bigint;
|