watermark-js-plus 1.5.2 → 1.5.3

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 (47) hide show
  1. package/dist/ie/index.cjs.js +4451 -0
  2. package/dist/ie/index.cjs.js.map +1 -0
  3. package/dist/ie/index.cjs.min.js +1 -0
  4. package/dist/ie/index.esm.js +4447 -0
  5. package/dist/ie/index.esm.js.map +1 -0
  6. package/dist/ie/index.esm.min.js +1 -0
  7. package/dist/ie/index.iife.js +4456 -0
  8. package/dist/ie/index.iife.js.map +1 -0
  9. package/dist/ie/index.iife.min.js +1 -0
  10. package/dist/ie/index.umd.js +4457 -0
  11. package/dist/ie/index.umd.js.map +1 -0
  12. package/dist/ie/index.umd.min.js +1 -0
  13. package/dist/ie/types/src/core/blind.d.ts +18 -0
  14. package/dist/ie/types/src/core/canvas.d.ts +51 -0
  15. package/dist/ie/types/src/core/image.d.ts +22 -0
  16. package/dist/ie/types/src/core/layout/grid.d.ts +14 -0
  17. package/dist/ie/types/src/core/layout/index.d.ts +4 -0
  18. package/dist/ie/types/src/core/watermark.d.ts +48 -0
  19. package/dist/ie/types/src/index.d.ts +5 -0
  20. package/dist/ie/types/src/index.ie.d.ts +6 -0
  21. package/dist/ie/types/src/style/index.d.ts +1 -0
  22. package/dist/ie/types/src/types/index.d.ts +127 -0
  23. package/dist/ie/types/src/utils/bootstrap.d.ts +2 -0
  24. package/dist/ie/types/src/utils/index.d.ts +14 -0
  25. package/dist/ie/types/src/utils/initialization.d.ts +19 -0
  26. package/dist/ie/types/tests/core/blind.test.d.ts +1 -0
  27. package/dist/ie/types/tests/core/image.test.d.ts +1 -0
  28. package/dist/ie/types/tests/core/watermark.test.d.ts +1 -0
  29. package/dist/ie/types/tests/utils/index.d.ts +1 -0
  30. package/dist/ie/types/tests/utils/index.test.d.ts +1 -0
  31. package/dist/index.cjs.js +21 -10
  32. package/dist/index.cjs.js.map +1 -1
  33. package/dist/index.cjs.min.js +1 -1
  34. package/dist/index.esm.js +21 -10
  35. package/dist/index.esm.js.map +1 -1
  36. package/dist/index.esm.min.js +1 -1
  37. package/dist/index.iife.js +21 -10
  38. package/dist/index.iife.js.map +1 -1
  39. package/dist/index.iife.min.js +1 -1
  40. package/dist/index.umd.js +21 -10
  41. package/dist/index.umd.js.map +1 -1
  42. package/dist/index.umd.min.js +1 -1
  43. package/dist/types/src/core/watermark.d.ts +1 -0
  44. package/dist/types/src/index.ie.d.ts +6 -0
  45. package/package.json +31 -22
  46. package/dist/types/docs/components/config.d.ts +0 -72
  47. package/dist/types/jest.setup.d.ts +0 -1
@@ -0,0 +1,4457 @@
1
+ /*!
2
+ * watermark-js-plus v1.5.3
3
+ * (c) 2022-2024 Michael Sun
4
+ * Released under the MIT License.
5
+ */
6
+ (function (global, factory) {
7
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
8
+ typeof define === 'function' && define.amd ? define(['exports'], factory) :
9
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.WatermarkPlus = {}));
10
+ })(this, (function (exports) { 'use strict';
11
+
12
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
13
+
14
+ var check = function (it) {
15
+ return it && it.Math === Math && it;
16
+ };
17
+
18
+ // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
19
+ var globalThis_1 =
20
+ // eslint-disable-next-line es/no-global-this -- safe
21
+ check(typeof globalThis == 'object' && globalThis) ||
22
+ check(typeof window == 'object' && window) ||
23
+ // eslint-disable-next-line no-restricted-globals -- safe
24
+ check(typeof self == 'object' && self) ||
25
+ check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
26
+ check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
27
+ // eslint-disable-next-line no-new-func -- fallback
28
+ (function () { return this; })() || Function('return this')();
29
+
30
+ var objectGetOwnPropertyDescriptor = {};
31
+
32
+ var fails$b = function (exec) {
33
+ try {
34
+ return !!exec();
35
+ } catch (error) {
36
+ return true;
37
+ }
38
+ };
39
+
40
+ var fails$a = fails$b;
41
+
42
+ // Detect IE8's incomplete defineProperty implementation
43
+ var descriptors = !fails$a(function () {
44
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
45
+ return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] !== 7;
46
+ });
47
+
48
+ var fails$9 = fails$b;
49
+
50
+ var functionBindNative = !fails$9(function () {
51
+ // eslint-disable-next-line es/no-function-prototype-bind -- safe
52
+ var test = (function () { /* empty */ }).bind();
53
+ // eslint-disable-next-line no-prototype-builtins -- safe
54
+ return typeof test != 'function' || test.hasOwnProperty('prototype');
55
+ });
56
+
57
+ var NATIVE_BIND$3 = functionBindNative;
58
+
59
+ var call$c = Function.prototype.call;
60
+
61
+ var functionCall = NATIVE_BIND$3 ? call$c.bind(call$c) : function () {
62
+ return call$c.apply(call$c, arguments);
63
+ };
64
+
65
+ var objectPropertyIsEnumerable = {};
66
+
67
+ var $propertyIsEnumerable = {}.propertyIsEnumerable;
68
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
69
+ var getOwnPropertyDescriptor$2 = Object.getOwnPropertyDescriptor;
70
+
71
+ // Nashorn ~ JDK8 bug
72
+ var NASHORN_BUG = getOwnPropertyDescriptor$2 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
73
+
74
+ // `Object.prototype.propertyIsEnumerable` method implementation
75
+ // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
76
+ objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
77
+ var descriptor = getOwnPropertyDescriptor$2(this, V);
78
+ return !!descriptor && descriptor.enumerable;
79
+ } : $propertyIsEnumerable;
80
+
81
+ var createPropertyDescriptor$3 = function (bitmap, value) {
82
+ return {
83
+ enumerable: !(bitmap & 1),
84
+ configurable: !(bitmap & 2),
85
+ writable: !(bitmap & 4),
86
+ value: value
87
+ };
88
+ };
89
+
90
+ var NATIVE_BIND$2 = functionBindNative;
91
+
92
+ var FunctionPrototype$2 = Function.prototype;
93
+ var call$b = FunctionPrototype$2.call;
94
+ var uncurryThisWithBind = NATIVE_BIND$2 && FunctionPrototype$2.bind.bind(call$b, call$b);
95
+
96
+ var functionUncurryThis = NATIVE_BIND$2 ? uncurryThisWithBind : function (fn) {
97
+ return function () {
98
+ return call$b.apply(fn, arguments);
99
+ };
100
+ };
101
+
102
+ var uncurryThis$d = functionUncurryThis;
103
+
104
+ var toString$1 = uncurryThis$d({}.toString);
105
+ var stringSlice$1 = uncurryThis$d(''.slice);
106
+
107
+ var classofRaw$2 = function (it) {
108
+ return stringSlice$1(toString$1(it), 8, -1);
109
+ };
110
+
111
+ var uncurryThis$c = functionUncurryThis;
112
+ var fails$8 = fails$b;
113
+ var classof$4 = classofRaw$2;
114
+
115
+ var $Object$3 = Object;
116
+ var split = uncurryThis$c(''.split);
117
+
118
+ // fallback for non-array-like ES3 and non-enumerable old V8 strings
119
+ var indexedObject = fails$8(function () {
120
+ // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
121
+ // eslint-disable-next-line no-prototype-builtins -- safe
122
+ return !$Object$3('z').propertyIsEnumerable(0);
123
+ }) ? function (it) {
124
+ return classof$4(it) === 'String' ? split(it, '') : $Object$3(it);
125
+ } : $Object$3;
126
+
127
+ // we can't use just `it == null` since of `document.all` special case
128
+ // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
129
+ var isNullOrUndefined$4 = function (it) {
130
+ return it === null || it === undefined;
131
+ };
132
+
133
+ var isNullOrUndefined$3 = isNullOrUndefined$4;
134
+
135
+ var $TypeError$c = TypeError;
136
+
137
+ // `RequireObjectCoercible` abstract operation
138
+ // https://tc39.es/ecma262/#sec-requireobjectcoercible
139
+ var requireObjectCoercible$3 = function (it) {
140
+ if (isNullOrUndefined$3(it)) throw new $TypeError$c("Can't call method on " + it);
141
+ return it;
142
+ };
143
+
144
+ // toObject with fallback for non-array-like ES3 strings
145
+ var IndexedObject = indexedObject;
146
+ var requireObjectCoercible$2 = requireObjectCoercible$3;
147
+
148
+ var toIndexedObject$4 = function (it) {
149
+ return IndexedObject(requireObjectCoercible$2(it));
150
+ };
151
+
152
+ // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
153
+ var documentAll = typeof document == 'object' && document.all;
154
+
155
+ // `IsCallable` abstract operation
156
+ // https://tc39.es/ecma262/#sec-iscallable
157
+ // eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing
158
+ var isCallable$g = typeof documentAll == 'undefined' && documentAll !== undefined ? function (argument) {
159
+ return typeof argument == 'function' || argument === documentAll;
160
+ } : function (argument) {
161
+ return typeof argument == 'function';
162
+ };
163
+
164
+ var isCallable$f = isCallable$g;
165
+
166
+ var isObject$9 = function (it) {
167
+ return typeof it == 'object' ? it !== null : isCallable$f(it);
168
+ };
169
+
170
+ var globalThis$i = globalThis_1;
171
+ var isCallable$e = isCallable$g;
172
+
173
+ var aFunction = function (argument) {
174
+ return isCallable$e(argument) ? argument : undefined;
175
+ };
176
+
177
+ var getBuiltIn$7 = function (namespace, method) {
178
+ return arguments.length < 2 ? aFunction(globalThis$i[namespace]) : globalThis$i[namespace] && globalThis$i[namespace][method];
179
+ };
180
+
181
+ var uncurryThis$b = functionUncurryThis;
182
+
183
+ var objectIsPrototypeOf = uncurryThis$b({}.isPrototypeOf);
184
+
185
+ var globalThis$h = globalThis_1;
186
+
187
+ var navigator = globalThis$h.navigator;
188
+ var userAgent$5 = navigator && navigator.userAgent;
189
+
190
+ var environmentUserAgent = userAgent$5 ? String(userAgent$5) : '';
191
+
192
+ var globalThis$g = globalThis_1;
193
+ var userAgent$4 = environmentUserAgent;
194
+
195
+ var process$3 = globalThis$g.process;
196
+ var Deno$1 = globalThis$g.Deno;
197
+ var versions = process$3 && process$3.versions || Deno$1 && Deno$1.version;
198
+ var v8 = versions && versions.v8;
199
+ var match, version;
200
+
201
+ if (v8) {
202
+ match = v8.split('.');
203
+ // in old Chrome, versions of V8 isn't V8 = Chrome / 10
204
+ // but their correct versions are not interesting for us
205
+ version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
206
+ }
207
+
208
+ // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
209
+ // so check `userAgent` even if `.v8` exists, but 0
210
+ if (!version && userAgent$4) {
211
+ match = userAgent$4.match(/Edge\/(\d+)/);
212
+ if (!match || match[1] >= 74) {
213
+ match = userAgent$4.match(/Chrome\/(\d+)/);
214
+ if (match) version = +match[1];
215
+ }
216
+ }
217
+
218
+ var environmentV8Version = version;
219
+
220
+ /* eslint-disable es/no-symbol -- required for testing */
221
+ var V8_VERSION$1 = environmentV8Version;
222
+ var fails$7 = fails$b;
223
+ var globalThis$f = globalThis_1;
224
+
225
+ var $String$4 = globalThis$f.String;
226
+
227
+ // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
228
+ var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$7(function () {
229
+ var symbol = Symbol('symbol detection');
230
+ // Chrome 38 Symbol has incorrect toString conversion
231
+ // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
232
+ // nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will,
233
+ // of course, fail.
234
+ return !$String$4(symbol) || !(Object(symbol) instanceof Symbol) ||
235
+ // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
236
+ !Symbol.sham && V8_VERSION$1 && V8_VERSION$1 < 41;
237
+ });
238
+
239
+ /* eslint-disable es/no-symbol -- required for testing */
240
+ var NATIVE_SYMBOL$1 = symbolConstructorDetection;
241
+
242
+ var useSymbolAsUid = NATIVE_SYMBOL$1
243
+ && !Symbol.sham
244
+ && typeof Symbol.iterator == 'symbol';
245
+
246
+ var getBuiltIn$6 = getBuiltIn$7;
247
+ var isCallable$d = isCallable$g;
248
+ var isPrototypeOf$2 = objectIsPrototypeOf;
249
+ var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
250
+
251
+ var $Object$2 = Object;
252
+
253
+ var isSymbol$2 = USE_SYMBOL_AS_UID$1 ? function (it) {
254
+ return typeof it == 'symbol';
255
+ } : function (it) {
256
+ var $Symbol = getBuiltIn$6('Symbol');
257
+ return isCallable$d($Symbol) && isPrototypeOf$2($Symbol.prototype, $Object$2(it));
258
+ };
259
+
260
+ var $String$3 = String;
261
+
262
+ var tryToString$4 = function (argument) {
263
+ try {
264
+ return $String$3(argument);
265
+ } catch (error) {
266
+ return 'Object';
267
+ }
268
+ };
269
+
270
+ var isCallable$c = isCallable$g;
271
+ var tryToString$3 = tryToString$4;
272
+
273
+ var $TypeError$b = TypeError;
274
+
275
+ // `Assert: IsCallable(argument) is true`
276
+ var aCallable$8 = function (argument) {
277
+ if (isCallable$c(argument)) return argument;
278
+ throw new $TypeError$b(tryToString$3(argument) + ' is not a function');
279
+ };
280
+
281
+ var aCallable$7 = aCallable$8;
282
+ var isNullOrUndefined$2 = isNullOrUndefined$4;
283
+
284
+ // `GetMethod` abstract operation
285
+ // https://tc39.es/ecma262/#sec-getmethod
286
+ var getMethod$3 = function (V, P) {
287
+ var func = V[P];
288
+ return isNullOrUndefined$2(func) ? undefined : aCallable$7(func);
289
+ };
290
+
291
+ var call$a = functionCall;
292
+ var isCallable$b = isCallable$g;
293
+ var isObject$8 = isObject$9;
294
+
295
+ var $TypeError$a = TypeError;
296
+
297
+ // `OrdinaryToPrimitive` abstract operation
298
+ // https://tc39.es/ecma262/#sec-ordinarytoprimitive
299
+ var ordinaryToPrimitive$1 = function (input, pref) {
300
+ var fn, val;
301
+ if (pref === 'string' && isCallable$b(fn = input.toString) && !isObject$8(val = call$a(fn, input))) return val;
302
+ if (isCallable$b(fn = input.valueOf) && !isObject$8(val = call$a(fn, input))) return val;
303
+ if (pref !== 'string' && isCallable$b(fn = input.toString) && !isObject$8(val = call$a(fn, input))) return val;
304
+ throw new $TypeError$a("Can't convert object to primitive value");
305
+ };
306
+
307
+ var sharedStore = {exports: {}};
308
+
309
+ var globalThis$e = globalThis_1;
310
+
311
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
312
+ var defineProperty$4 = Object.defineProperty;
313
+
314
+ var defineGlobalProperty$3 = function (key, value) {
315
+ try {
316
+ defineProperty$4(globalThis$e, key, { value: value, configurable: true, writable: true });
317
+ } catch (error) {
318
+ globalThis$e[key] = value;
319
+ } return value;
320
+ };
321
+
322
+ var globalThis$d = globalThis_1;
323
+ var defineGlobalProperty$2 = defineGlobalProperty$3;
324
+
325
+ var SHARED = '__core-js_shared__';
326
+ var store$3 = sharedStore.exports = globalThis$d[SHARED] || defineGlobalProperty$2(SHARED, {});
327
+
328
+ (store$3.versions || (store$3.versions = [])).push({
329
+ version: '3.38.0',
330
+ mode: 'global',
331
+ copyright: '© 2014-2024 Denis Pushkarev (zloirock.ru)',
332
+ license: 'https://github.com/zloirock/core-js/blob/v3.38.0/LICENSE',
333
+ source: 'https://github.com/zloirock/core-js'
334
+ });
335
+
336
+ var sharedStoreExports = sharedStore.exports;
337
+
338
+ var store$2 = sharedStoreExports;
339
+
340
+ var shared$3 = function (key, value) {
341
+ return store$2[key] || (store$2[key] = value || {});
342
+ };
343
+
344
+ var requireObjectCoercible$1 = requireObjectCoercible$3;
345
+
346
+ var $Object$1 = Object;
347
+
348
+ // `ToObject` abstract operation
349
+ // https://tc39.es/ecma262/#sec-toobject
350
+ var toObject$3 = function (argument) {
351
+ return $Object$1(requireObjectCoercible$1(argument));
352
+ };
353
+
354
+ var uncurryThis$a = functionUncurryThis;
355
+ var toObject$2 = toObject$3;
356
+
357
+ var hasOwnProperty = uncurryThis$a({}.hasOwnProperty);
358
+
359
+ // `HasOwnProperty` abstract operation
360
+ // https://tc39.es/ecma262/#sec-hasownproperty
361
+ // eslint-disable-next-line es/no-object-hasown -- safe
362
+ var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
363
+ return hasOwnProperty(toObject$2(it), key);
364
+ };
365
+
366
+ var uncurryThis$9 = functionUncurryThis;
367
+
368
+ var id = 0;
369
+ var postfix = Math.random();
370
+ var toString = uncurryThis$9(1.0.toString);
371
+
372
+ var uid$2 = function (key) {
373
+ return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
374
+ };
375
+
376
+ var globalThis$c = globalThis_1;
377
+ var shared$2 = shared$3;
378
+ var hasOwn$8 = hasOwnProperty_1;
379
+ var uid$1 = uid$2;
380
+ var NATIVE_SYMBOL = symbolConstructorDetection;
381
+ var USE_SYMBOL_AS_UID = useSymbolAsUid;
382
+
383
+ var Symbol$1 = globalThis$c.Symbol;
384
+ var WellKnownSymbolsStore = shared$2('wks');
385
+ var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$1['for'] || Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$1;
386
+
387
+ var wellKnownSymbol$b = function (name) {
388
+ if (!hasOwn$8(WellKnownSymbolsStore, name)) {
389
+ WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn$8(Symbol$1, name)
390
+ ? Symbol$1[name]
391
+ : createWellKnownSymbol('Symbol.' + name);
392
+ } return WellKnownSymbolsStore[name];
393
+ };
394
+
395
+ var call$9 = functionCall;
396
+ var isObject$7 = isObject$9;
397
+ var isSymbol$1 = isSymbol$2;
398
+ var getMethod$2 = getMethod$3;
399
+ var ordinaryToPrimitive = ordinaryToPrimitive$1;
400
+ var wellKnownSymbol$a = wellKnownSymbol$b;
401
+
402
+ var $TypeError$9 = TypeError;
403
+ var TO_PRIMITIVE = wellKnownSymbol$a('toPrimitive');
404
+
405
+ // `ToPrimitive` abstract operation
406
+ // https://tc39.es/ecma262/#sec-toprimitive
407
+ var toPrimitive$1 = function (input, pref) {
408
+ if (!isObject$7(input) || isSymbol$1(input)) return input;
409
+ var exoticToPrim = getMethod$2(input, TO_PRIMITIVE);
410
+ var result;
411
+ if (exoticToPrim) {
412
+ if (pref === undefined) pref = 'default';
413
+ result = call$9(exoticToPrim, input, pref);
414
+ if (!isObject$7(result) || isSymbol$1(result)) return result;
415
+ throw new $TypeError$9("Can't convert object to primitive value");
416
+ }
417
+ if (pref === undefined) pref = 'number';
418
+ return ordinaryToPrimitive(input, pref);
419
+ };
420
+
421
+ var toPrimitive = toPrimitive$1;
422
+ var isSymbol = isSymbol$2;
423
+
424
+ // `ToPropertyKey` abstract operation
425
+ // https://tc39.es/ecma262/#sec-topropertykey
426
+ var toPropertyKey$2 = function (argument) {
427
+ var key = toPrimitive(argument, 'string');
428
+ return isSymbol(key) ? key : key + '';
429
+ };
430
+
431
+ var globalThis$b = globalThis_1;
432
+ var isObject$6 = isObject$9;
433
+
434
+ var document$3 = globalThis$b.document;
435
+ // typeof document.createElement is 'object' in old IE
436
+ var EXISTS$1 = isObject$6(document$3) && isObject$6(document$3.createElement);
437
+
438
+ var documentCreateElement$1 = function (it) {
439
+ return EXISTS$1 ? document$3.createElement(it) : {};
440
+ };
441
+
442
+ var DESCRIPTORS$a = descriptors;
443
+ var fails$6 = fails$b;
444
+ var createElement$1 = documentCreateElement$1;
445
+
446
+ // Thanks to IE8 for its funny defineProperty
447
+ var ie8DomDefine = !DESCRIPTORS$a && !fails$6(function () {
448
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
449
+ return Object.defineProperty(createElement$1('div'), 'a', {
450
+ get: function () { return 7; }
451
+ }).a !== 7;
452
+ });
453
+
454
+ var DESCRIPTORS$9 = descriptors;
455
+ var call$8 = functionCall;
456
+ var propertyIsEnumerableModule = objectPropertyIsEnumerable;
457
+ var createPropertyDescriptor$2 = createPropertyDescriptor$3;
458
+ var toIndexedObject$3 = toIndexedObject$4;
459
+ var toPropertyKey$1 = toPropertyKey$2;
460
+ var hasOwn$7 = hasOwnProperty_1;
461
+ var IE8_DOM_DEFINE$1 = ie8DomDefine;
462
+
463
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
464
+ var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
465
+
466
+ // `Object.getOwnPropertyDescriptor` method
467
+ // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
468
+ objectGetOwnPropertyDescriptor.f = DESCRIPTORS$9 ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
469
+ O = toIndexedObject$3(O);
470
+ P = toPropertyKey$1(P);
471
+ if (IE8_DOM_DEFINE$1) try {
472
+ return $getOwnPropertyDescriptor$1(O, P);
473
+ } catch (error) { /* empty */ }
474
+ if (hasOwn$7(O, P)) return createPropertyDescriptor$2(!call$8(propertyIsEnumerableModule.f, O, P), O[P]);
475
+ };
476
+
477
+ var objectDefineProperty = {};
478
+
479
+ var DESCRIPTORS$8 = descriptors;
480
+ var fails$5 = fails$b;
481
+
482
+ // V8 ~ Chrome 36-
483
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3334
484
+ var v8PrototypeDefineBug = DESCRIPTORS$8 && fails$5(function () {
485
+ // eslint-disable-next-line es/no-object-defineproperty -- required for testing
486
+ return Object.defineProperty(function () { /* empty */ }, 'prototype', {
487
+ value: 42,
488
+ writable: false
489
+ }).prototype !== 42;
490
+ });
491
+
492
+ var isObject$5 = isObject$9;
493
+
494
+ var $String$2 = String;
495
+ var $TypeError$8 = TypeError;
496
+
497
+ // `Assert: Type(argument) is Object`
498
+ var anObject$a = function (argument) {
499
+ if (isObject$5(argument)) return argument;
500
+ throw new $TypeError$8($String$2(argument) + ' is not an object');
501
+ };
502
+
503
+ var DESCRIPTORS$7 = descriptors;
504
+ var IE8_DOM_DEFINE = ie8DomDefine;
505
+ var V8_PROTOTYPE_DEFINE_BUG$1 = v8PrototypeDefineBug;
506
+ var anObject$9 = anObject$a;
507
+ var toPropertyKey = toPropertyKey$2;
508
+
509
+ var $TypeError$7 = TypeError;
510
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
511
+ var $defineProperty = Object.defineProperty;
512
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
513
+ var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
514
+ var ENUMERABLE = 'enumerable';
515
+ var CONFIGURABLE$1 = 'configurable';
516
+ var WRITABLE = 'writable';
517
+
518
+ // `Object.defineProperty` method
519
+ // https://tc39.es/ecma262/#sec-object.defineproperty
520
+ objectDefineProperty.f = DESCRIPTORS$7 ? V8_PROTOTYPE_DEFINE_BUG$1 ? function defineProperty(O, P, Attributes) {
521
+ anObject$9(O);
522
+ P = toPropertyKey(P);
523
+ anObject$9(Attributes);
524
+ if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
525
+ var current = $getOwnPropertyDescriptor(O, P);
526
+ if (current && current[WRITABLE]) {
527
+ O[P] = Attributes.value;
528
+ Attributes = {
529
+ configurable: CONFIGURABLE$1 in Attributes ? Attributes[CONFIGURABLE$1] : current[CONFIGURABLE$1],
530
+ enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
531
+ writable: false
532
+ };
533
+ }
534
+ } return $defineProperty(O, P, Attributes);
535
+ } : $defineProperty : function defineProperty(O, P, Attributes) {
536
+ anObject$9(O);
537
+ P = toPropertyKey(P);
538
+ anObject$9(Attributes);
539
+ if (IE8_DOM_DEFINE) try {
540
+ return $defineProperty(O, P, Attributes);
541
+ } catch (error) { /* empty */ }
542
+ if ('get' in Attributes || 'set' in Attributes) throw new $TypeError$7('Accessors not supported');
543
+ if ('value' in Attributes) O[P] = Attributes.value;
544
+ return O;
545
+ };
546
+
547
+ var DESCRIPTORS$6 = descriptors;
548
+ var definePropertyModule$4 = objectDefineProperty;
549
+ var createPropertyDescriptor$1 = createPropertyDescriptor$3;
550
+
551
+ var createNonEnumerableProperty$2 = DESCRIPTORS$6 ? function (object, key, value) {
552
+ return definePropertyModule$4.f(object, key, createPropertyDescriptor$1(1, value));
553
+ } : function (object, key, value) {
554
+ object[key] = value;
555
+ return object;
556
+ };
557
+
558
+ var makeBuiltIn$3 = {exports: {}};
559
+
560
+ var DESCRIPTORS$5 = descriptors;
561
+ var hasOwn$6 = hasOwnProperty_1;
562
+
563
+ var FunctionPrototype$1 = Function.prototype;
564
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
565
+ var getDescriptor = DESCRIPTORS$5 && Object.getOwnPropertyDescriptor;
566
+
567
+ var EXISTS = hasOwn$6(FunctionPrototype$1, 'name');
568
+ // additional protection from minified / mangled / dropped function names
569
+ var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
570
+ var CONFIGURABLE = EXISTS && (!DESCRIPTORS$5 || (DESCRIPTORS$5 && getDescriptor(FunctionPrototype$1, 'name').configurable));
571
+
572
+ var functionName = {
573
+ EXISTS: EXISTS,
574
+ PROPER: PROPER,
575
+ CONFIGURABLE: CONFIGURABLE
576
+ };
577
+
578
+ var uncurryThis$8 = functionUncurryThis;
579
+ var isCallable$a = isCallable$g;
580
+ var store$1 = sharedStoreExports;
581
+
582
+ var functionToString = uncurryThis$8(Function.toString);
583
+
584
+ // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
585
+ if (!isCallable$a(store$1.inspectSource)) {
586
+ store$1.inspectSource = function (it) {
587
+ return functionToString(it);
588
+ };
589
+ }
590
+
591
+ var inspectSource$3 = store$1.inspectSource;
592
+
593
+ var globalThis$a = globalThis_1;
594
+ var isCallable$9 = isCallable$g;
595
+
596
+ var WeakMap$1 = globalThis$a.WeakMap;
597
+
598
+ var weakMapBasicDetection = isCallable$9(WeakMap$1) && /native code/.test(String(WeakMap$1));
599
+
600
+ var shared$1 = shared$3;
601
+ var uid = uid$2;
602
+
603
+ var keys = shared$1('keys');
604
+
605
+ var sharedKey$2 = function (key) {
606
+ return keys[key] || (keys[key] = uid(key));
607
+ };
608
+
609
+ var hiddenKeys$4 = {};
610
+
611
+ var NATIVE_WEAK_MAP = weakMapBasicDetection;
612
+ var globalThis$9 = globalThis_1;
613
+ var isObject$4 = isObject$9;
614
+ var createNonEnumerableProperty$1 = createNonEnumerableProperty$2;
615
+ var hasOwn$5 = hasOwnProperty_1;
616
+ var shared = sharedStoreExports;
617
+ var sharedKey$1 = sharedKey$2;
618
+ var hiddenKeys$3 = hiddenKeys$4;
619
+
620
+ var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
621
+ var TypeError$2 = globalThis$9.TypeError;
622
+ var WeakMap = globalThis$9.WeakMap;
623
+ var set$1, get, has;
624
+
625
+ var enforce = function (it) {
626
+ return has(it) ? get(it) : set$1(it, {});
627
+ };
628
+
629
+ var getterFor = function (TYPE) {
630
+ return function (it) {
631
+ var state;
632
+ if (!isObject$4(it) || (state = get(it)).type !== TYPE) {
633
+ throw new TypeError$2('Incompatible receiver, ' + TYPE + ' required');
634
+ } return state;
635
+ };
636
+ };
637
+
638
+ if (NATIVE_WEAK_MAP || shared.state) {
639
+ var store = shared.state || (shared.state = new WeakMap());
640
+ /* eslint-disable no-self-assign -- prototype methods protection */
641
+ store.get = store.get;
642
+ store.has = store.has;
643
+ store.set = store.set;
644
+ /* eslint-enable no-self-assign -- prototype methods protection */
645
+ set$1 = function (it, metadata) {
646
+ if (store.has(it)) throw new TypeError$2(OBJECT_ALREADY_INITIALIZED);
647
+ metadata.facade = it;
648
+ store.set(it, metadata);
649
+ return metadata;
650
+ };
651
+ get = function (it) {
652
+ return store.get(it) || {};
653
+ };
654
+ has = function (it) {
655
+ return store.has(it);
656
+ };
657
+ } else {
658
+ var STATE = sharedKey$1('state');
659
+ hiddenKeys$3[STATE] = true;
660
+ set$1 = function (it, metadata) {
661
+ if (hasOwn$5(it, STATE)) throw new TypeError$2(OBJECT_ALREADY_INITIALIZED);
662
+ metadata.facade = it;
663
+ createNonEnumerableProperty$1(it, STATE, metadata);
664
+ return metadata;
665
+ };
666
+ get = function (it) {
667
+ return hasOwn$5(it, STATE) ? it[STATE] : {};
668
+ };
669
+ has = function (it) {
670
+ return hasOwn$5(it, STATE);
671
+ };
672
+ }
673
+
674
+ var internalState = {
675
+ set: set$1,
676
+ get: get,
677
+ has: has,
678
+ enforce: enforce,
679
+ getterFor: getterFor
680
+ };
681
+
682
+ var uncurryThis$7 = functionUncurryThis;
683
+ var fails$4 = fails$b;
684
+ var isCallable$8 = isCallable$g;
685
+ var hasOwn$4 = hasOwnProperty_1;
686
+ var DESCRIPTORS$4 = descriptors;
687
+ var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
688
+ var inspectSource$2 = inspectSource$3;
689
+ var InternalStateModule$1 = internalState;
690
+
691
+ var enforceInternalState = InternalStateModule$1.enforce;
692
+ var getInternalState = InternalStateModule$1.get;
693
+ var $String$1 = String;
694
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
695
+ var defineProperty$3 = Object.defineProperty;
696
+ var stringSlice = uncurryThis$7(''.slice);
697
+ var replace = uncurryThis$7(''.replace);
698
+ var join = uncurryThis$7([].join);
699
+
700
+ var CONFIGURABLE_LENGTH = DESCRIPTORS$4 && !fails$4(function () {
701
+ return defineProperty$3(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
702
+ });
703
+
704
+ var TEMPLATE = String(String).split('String');
705
+
706
+ var makeBuiltIn$2 = makeBuiltIn$3.exports = function (value, name, options) {
707
+ if (stringSlice($String$1(name), 0, 7) === 'Symbol(') {
708
+ name = '[' + replace($String$1(name), /^Symbol\(([^)]*)\).*$/, '$1') + ']';
709
+ }
710
+ if (options && options.getter) name = 'get ' + name;
711
+ if (options && options.setter) name = 'set ' + name;
712
+ if (!hasOwn$4(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {
713
+ if (DESCRIPTORS$4) defineProperty$3(value, 'name', { value: name, configurable: true });
714
+ else value.name = name;
715
+ }
716
+ if (CONFIGURABLE_LENGTH && options && hasOwn$4(options, 'arity') && value.length !== options.arity) {
717
+ defineProperty$3(value, 'length', { value: options.arity });
718
+ }
719
+ try {
720
+ if (options && hasOwn$4(options, 'constructor') && options.constructor) {
721
+ if (DESCRIPTORS$4) defineProperty$3(value, 'prototype', { writable: false });
722
+ // in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable
723
+ } else if (value.prototype) value.prototype = undefined;
724
+ } catch (error) { /* empty */ }
725
+ var state = enforceInternalState(value);
726
+ if (!hasOwn$4(state, 'source')) {
727
+ state.source = join(TEMPLATE, typeof name == 'string' ? name : '');
728
+ } return value;
729
+ };
730
+
731
+ // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
732
+ // eslint-disable-next-line no-extend-native -- required
733
+ Function.prototype.toString = makeBuiltIn$2(function toString() {
734
+ return isCallable$8(this) && getInternalState(this).source || inspectSource$2(this);
735
+ }, 'toString');
736
+
737
+ var makeBuiltInExports = makeBuiltIn$3.exports;
738
+
739
+ var isCallable$7 = isCallable$g;
740
+ var definePropertyModule$3 = objectDefineProperty;
741
+ var makeBuiltIn$1 = makeBuiltInExports;
742
+ var defineGlobalProperty$1 = defineGlobalProperty$3;
743
+
744
+ var defineBuiltIn$3 = function (O, key, value, options) {
745
+ if (!options) options = {};
746
+ var simple = options.enumerable;
747
+ var name = options.name !== undefined ? options.name : key;
748
+ if (isCallable$7(value)) makeBuiltIn$1(value, name, options);
749
+ if (options.global) {
750
+ if (simple) O[key] = value;
751
+ else defineGlobalProperty$1(key, value);
752
+ } else {
753
+ try {
754
+ if (!options.unsafe) delete O[key];
755
+ else if (O[key]) simple = true;
756
+ } catch (error) { /* empty */ }
757
+ if (simple) O[key] = value;
758
+ else definePropertyModule$3.f(O, key, {
759
+ value: value,
760
+ enumerable: false,
761
+ configurable: !options.nonConfigurable,
762
+ writable: !options.nonWritable
763
+ });
764
+ } return O;
765
+ };
766
+
767
+ var objectGetOwnPropertyNames = {};
768
+
769
+ var ceil = Math.ceil;
770
+ var floor = Math.floor;
771
+
772
+ // `Math.trunc` method
773
+ // https://tc39.es/ecma262/#sec-math.trunc
774
+ // eslint-disable-next-line es/no-math-trunc -- safe
775
+ var mathTrunc = Math.trunc || function trunc(x) {
776
+ var n = +x;
777
+ return (n > 0 ? floor : ceil)(n);
778
+ };
779
+
780
+ var trunc = mathTrunc;
781
+
782
+ // `ToIntegerOrInfinity` abstract operation
783
+ // https://tc39.es/ecma262/#sec-tointegerorinfinity
784
+ var toIntegerOrInfinity$2 = function (argument) {
785
+ var number = +argument;
786
+ // eslint-disable-next-line no-self-compare -- NaN check
787
+ return number !== number || number === 0 ? 0 : trunc(number);
788
+ };
789
+
790
+ var toIntegerOrInfinity$1 = toIntegerOrInfinity$2;
791
+
792
+ var max = Math.max;
793
+ var min$1 = Math.min;
794
+
795
+ // Helper for a popular repeating case of the spec:
796
+ // Let integer be ? ToInteger(index).
797
+ // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
798
+ var toAbsoluteIndex$2 = function (index, length) {
799
+ var integer = toIntegerOrInfinity$1(index);
800
+ return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
801
+ };
802
+
803
+ var toIntegerOrInfinity = toIntegerOrInfinity$2;
804
+
805
+ var min = Math.min;
806
+
807
+ // `ToLength` abstract operation
808
+ // https://tc39.es/ecma262/#sec-tolength
809
+ var toLength$1 = function (argument) {
810
+ var len = toIntegerOrInfinity(argument);
811
+ return len > 0 ? min(len, 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
812
+ };
813
+
814
+ var toLength = toLength$1;
815
+
816
+ // `LengthOfArrayLike` abstract operation
817
+ // https://tc39.es/ecma262/#sec-lengthofarraylike
818
+ var lengthOfArrayLike$4 = function (obj) {
819
+ return toLength(obj.length);
820
+ };
821
+
822
+ var toIndexedObject$2 = toIndexedObject$4;
823
+ var toAbsoluteIndex$1 = toAbsoluteIndex$2;
824
+ var lengthOfArrayLike$3 = lengthOfArrayLike$4;
825
+
826
+ // `Array.prototype.{ indexOf, includes }` methods implementation
827
+ var createMethod = function (IS_INCLUDES) {
828
+ return function ($this, el, fromIndex) {
829
+ var O = toIndexedObject$2($this);
830
+ var length = lengthOfArrayLike$3(O);
831
+ if (length === 0) return !IS_INCLUDES && -1;
832
+ var index = toAbsoluteIndex$1(fromIndex, length);
833
+ var value;
834
+ // Array#includes uses SameValueZero equality algorithm
835
+ // eslint-disable-next-line no-self-compare -- NaN check
836
+ if (IS_INCLUDES && el !== el) while (length > index) {
837
+ value = O[index++];
838
+ // eslint-disable-next-line no-self-compare -- NaN check
839
+ if (value !== value) return true;
840
+ // Array#indexOf ignores holes, Array#includes - not
841
+ } else for (;length > index; index++) {
842
+ if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
843
+ } return !IS_INCLUDES && -1;
844
+ };
845
+ };
846
+
847
+ var arrayIncludes = {
848
+ // `Array.prototype.includes` method
849
+ // https://tc39.es/ecma262/#sec-array.prototype.includes
850
+ includes: createMethod(true),
851
+ // `Array.prototype.indexOf` method
852
+ // https://tc39.es/ecma262/#sec-array.prototype.indexof
853
+ indexOf: createMethod(false)
854
+ };
855
+
856
+ var uncurryThis$6 = functionUncurryThis;
857
+ var hasOwn$3 = hasOwnProperty_1;
858
+ var toIndexedObject$1 = toIndexedObject$4;
859
+ var indexOf = arrayIncludes.indexOf;
860
+ var hiddenKeys$2 = hiddenKeys$4;
861
+
862
+ var push = uncurryThis$6([].push);
863
+
864
+ var objectKeysInternal = function (object, names) {
865
+ var O = toIndexedObject$1(object);
866
+ var i = 0;
867
+ var result = [];
868
+ var key;
869
+ for (key in O) !hasOwn$3(hiddenKeys$2, key) && hasOwn$3(O, key) && push(result, key);
870
+ // Don't enum bug & hidden keys
871
+ while (names.length > i) if (hasOwn$3(O, key = names[i++])) {
872
+ ~indexOf(result, key) || push(result, key);
873
+ }
874
+ return result;
875
+ };
876
+
877
+ // IE8- don't enum bug keys
878
+ var enumBugKeys$3 = [
879
+ 'constructor',
880
+ 'hasOwnProperty',
881
+ 'isPrototypeOf',
882
+ 'propertyIsEnumerable',
883
+ 'toLocaleString',
884
+ 'toString',
885
+ 'valueOf'
886
+ ];
887
+
888
+ var internalObjectKeys$1 = objectKeysInternal;
889
+ var enumBugKeys$2 = enumBugKeys$3;
890
+
891
+ var hiddenKeys$1 = enumBugKeys$2.concat('length', 'prototype');
892
+
893
+ // `Object.getOwnPropertyNames` method
894
+ // https://tc39.es/ecma262/#sec-object.getownpropertynames
895
+ // eslint-disable-next-line es/no-object-getownpropertynames -- safe
896
+ objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
897
+ return internalObjectKeys$1(O, hiddenKeys$1);
898
+ };
899
+
900
+ var objectGetOwnPropertySymbols = {};
901
+
902
+ // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
903
+ objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
904
+
905
+ var getBuiltIn$5 = getBuiltIn$7;
906
+ var uncurryThis$5 = functionUncurryThis;
907
+ var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
908
+ var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
909
+ var anObject$8 = anObject$a;
910
+
911
+ var concat = uncurryThis$5([].concat);
912
+
913
+ // all object keys, includes non-enumerable and symbols
914
+ var ownKeys$1 = getBuiltIn$5('Reflect', 'ownKeys') || function ownKeys(it) {
915
+ var keys = getOwnPropertyNamesModule.f(anObject$8(it));
916
+ var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
917
+ return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
918
+ };
919
+
920
+ var hasOwn$2 = hasOwnProperty_1;
921
+ var ownKeys = ownKeys$1;
922
+ var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor;
923
+ var definePropertyModule$2 = objectDefineProperty;
924
+
925
+ var copyConstructorProperties$1 = function (target, source, exceptions) {
926
+ var keys = ownKeys(source);
927
+ var defineProperty = definePropertyModule$2.f;
928
+ var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
929
+ for (var i = 0; i < keys.length; i++) {
930
+ var key = keys[i];
931
+ if (!hasOwn$2(target, key) && !(exceptions && hasOwn$2(exceptions, key))) {
932
+ defineProperty(target, key, getOwnPropertyDescriptor(source, key));
933
+ }
934
+ }
935
+ };
936
+
937
+ var fails$3 = fails$b;
938
+ var isCallable$6 = isCallable$g;
939
+
940
+ var replacement = /#|\.prototype\./;
941
+
942
+ var isForced$2 = function (feature, detection) {
943
+ var value = data[normalize(feature)];
944
+ return value === POLYFILL ? true
945
+ : value === NATIVE ? false
946
+ : isCallable$6(detection) ? fails$3(detection)
947
+ : !!detection;
948
+ };
949
+
950
+ var normalize = isForced$2.normalize = function (string) {
951
+ return String(string).replace(replacement, '.').toLowerCase();
952
+ };
953
+
954
+ var data = isForced$2.data = {};
955
+ var NATIVE = isForced$2.NATIVE = 'N';
956
+ var POLYFILL = isForced$2.POLYFILL = 'P';
957
+
958
+ var isForced_1 = isForced$2;
959
+
960
+ var globalThis$8 = globalThis_1;
961
+ var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
962
+ var createNonEnumerableProperty = createNonEnumerableProperty$2;
963
+ var defineBuiltIn$2 = defineBuiltIn$3;
964
+ var defineGlobalProperty = defineGlobalProperty$3;
965
+ var copyConstructorProperties = copyConstructorProperties$1;
966
+ var isForced$1 = isForced_1;
967
+
968
+ /*
969
+ options.target - name of the target object
970
+ options.global - target is the global object
971
+ options.stat - export as static methods of target
972
+ options.proto - export as prototype methods of target
973
+ options.real - real prototype method for the `pure` version
974
+ options.forced - export even if the native feature is available
975
+ options.bind - bind methods to the target, required for the `pure` version
976
+ options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
977
+ options.unsafe - use the simple assignment of property instead of delete + defineProperty
978
+ options.sham - add a flag to not completely full polyfills
979
+ options.enumerable - export as enumerable property
980
+ options.dontCallGetSet - prevent calling a getter on target
981
+ options.name - the .name of the function if it does not match the key
982
+ */
983
+ var _export = function (options, source) {
984
+ var TARGET = options.target;
985
+ var GLOBAL = options.global;
986
+ var STATIC = options.stat;
987
+ var FORCED, target, key, targetProperty, sourceProperty, descriptor;
988
+ if (GLOBAL) {
989
+ target = globalThis$8;
990
+ } else if (STATIC) {
991
+ target = globalThis$8[TARGET] || defineGlobalProperty(TARGET, {});
992
+ } else {
993
+ target = globalThis$8[TARGET] && globalThis$8[TARGET].prototype;
994
+ }
995
+ if (target) for (key in source) {
996
+ sourceProperty = source[key];
997
+ if (options.dontCallGetSet) {
998
+ descriptor = getOwnPropertyDescriptor$1(target, key);
999
+ targetProperty = descriptor && descriptor.value;
1000
+ } else targetProperty = target[key];
1001
+ FORCED = isForced$1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
1002
+ // contained in target
1003
+ if (!FORCED && targetProperty !== undefined) {
1004
+ if (typeof sourceProperty == typeof targetProperty) continue;
1005
+ copyConstructorProperties(sourceProperty, targetProperty);
1006
+ }
1007
+ // add a flag to not completely full polyfills
1008
+ if (options.sham || (targetProperty && targetProperty.sham)) {
1009
+ createNonEnumerableProperty(sourceProperty, 'sham', true);
1010
+ }
1011
+ defineBuiltIn$2(target, key, sourceProperty, options);
1012
+ }
1013
+ };
1014
+
1015
+ var classofRaw$1 = classofRaw$2;
1016
+ var uncurryThis$4 = functionUncurryThis;
1017
+
1018
+ var functionUncurryThisClause = function (fn) {
1019
+ // Nashorn bug:
1020
+ // https://github.com/zloirock/core-js/issues/1128
1021
+ // https://github.com/zloirock/core-js/issues/1130
1022
+ if (classofRaw$1(fn) === 'Function') return uncurryThis$4(fn);
1023
+ };
1024
+
1025
+ var uncurryThis$3 = functionUncurryThisClause;
1026
+ var aCallable$6 = aCallable$8;
1027
+ var NATIVE_BIND$1 = functionBindNative;
1028
+
1029
+ var bind$5 = uncurryThis$3(uncurryThis$3.bind);
1030
+
1031
+ // optional / simple context binding
1032
+ var functionBindContext = function (fn, that) {
1033
+ aCallable$6(fn);
1034
+ return that === undefined ? fn : NATIVE_BIND$1 ? bind$5(fn, that) : function (/* ...args */) {
1035
+ return fn.apply(that, arguments);
1036
+ };
1037
+ };
1038
+
1039
+ var call$7 = functionCall;
1040
+ var anObject$7 = anObject$a;
1041
+ var getMethod$1 = getMethod$3;
1042
+
1043
+ var iteratorClose$2 = function (iterator, kind, value) {
1044
+ var innerResult, innerError;
1045
+ anObject$7(iterator);
1046
+ try {
1047
+ innerResult = getMethod$1(iterator, 'return');
1048
+ if (!innerResult) {
1049
+ if (kind === 'throw') throw value;
1050
+ return value;
1051
+ }
1052
+ innerResult = call$7(innerResult, iterator);
1053
+ } catch (error) {
1054
+ innerError = true;
1055
+ innerResult = error;
1056
+ }
1057
+ if (kind === 'throw') throw value;
1058
+ if (innerError) throw innerResult;
1059
+ anObject$7(innerResult);
1060
+ return value;
1061
+ };
1062
+
1063
+ var anObject$6 = anObject$a;
1064
+ var iteratorClose$1 = iteratorClose$2;
1065
+
1066
+ // call something on iterator step with safe closing on error
1067
+ var callWithSafeIterationClosing$1 = function (iterator, fn, value, ENTRIES) {
1068
+ try {
1069
+ return ENTRIES ? fn(anObject$6(value)[0], value[1]) : fn(value);
1070
+ } catch (error) {
1071
+ iteratorClose$1(iterator, 'throw', error);
1072
+ }
1073
+ };
1074
+
1075
+ var iterators = {};
1076
+
1077
+ var wellKnownSymbol$9 = wellKnownSymbol$b;
1078
+ var Iterators$1 = iterators;
1079
+
1080
+ var ITERATOR$2 = wellKnownSymbol$9('iterator');
1081
+ var ArrayPrototype$1 = Array.prototype;
1082
+
1083
+ // check on default Array iterator
1084
+ var isArrayIteratorMethod$2 = function (it) {
1085
+ return it !== undefined && (Iterators$1.Array === it || ArrayPrototype$1[ITERATOR$2] === it);
1086
+ };
1087
+
1088
+ var wellKnownSymbol$8 = wellKnownSymbol$b;
1089
+
1090
+ var TO_STRING_TAG$2 = wellKnownSymbol$8('toStringTag');
1091
+ var test = {};
1092
+
1093
+ test[TO_STRING_TAG$2] = 'z';
1094
+
1095
+ var toStringTagSupport = String(test) === '[object z]';
1096
+
1097
+ var TO_STRING_TAG_SUPPORT = toStringTagSupport;
1098
+ var isCallable$5 = isCallable$g;
1099
+ var classofRaw = classofRaw$2;
1100
+ var wellKnownSymbol$7 = wellKnownSymbol$b;
1101
+
1102
+ var TO_STRING_TAG$1 = wellKnownSymbol$7('toStringTag');
1103
+ var $Object = Object;
1104
+
1105
+ // ES3 wrong here
1106
+ var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) === 'Arguments';
1107
+
1108
+ // fallback for IE11 Script Access Denied error
1109
+ var tryGet = function (it, key) {
1110
+ try {
1111
+ return it[key];
1112
+ } catch (error) { /* empty */ }
1113
+ };
1114
+
1115
+ // getting tag from ES6+ `Object.prototype.toString`
1116
+ var classof$3 = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
1117
+ var O, tag, result;
1118
+ return it === undefined ? 'Undefined' : it === null ? 'Null'
1119
+ // @@toStringTag case
1120
+ : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG$1)) == 'string' ? tag
1121
+ // builtinTag case
1122
+ : CORRECT_ARGUMENTS ? classofRaw(O)
1123
+ // ES3 arguments fallback
1124
+ : (result = classofRaw(O)) === 'Object' && isCallable$5(O.callee) ? 'Arguments' : result;
1125
+ };
1126
+
1127
+ var uncurryThis$2 = functionUncurryThis;
1128
+ var fails$2 = fails$b;
1129
+ var isCallable$4 = isCallable$g;
1130
+ var classof$2 = classof$3;
1131
+ var getBuiltIn$4 = getBuiltIn$7;
1132
+ var inspectSource$1 = inspectSource$3;
1133
+
1134
+ var noop = function () { /* empty */ };
1135
+ var construct = getBuiltIn$4('Reflect', 'construct');
1136
+ var constructorRegExp = /^\s*(?:class|function)\b/;
1137
+ var exec = uncurryThis$2(constructorRegExp.exec);
1138
+ var INCORRECT_TO_STRING = !constructorRegExp.test(noop);
1139
+
1140
+ var isConstructorModern = function isConstructor(argument) {
1141
+ if (!isCallable$4(argument)) return false;
1142
+ try {
1143
+ construct(noop, [], argument);
1144
+ return true;
1145
+ } catch (error) {
1146
+ return false;
1147
+ }
1148
+ };
1149
+
1150
+ var isConstructorLegacy = function isConstructor(argument) {
1151
+ if (!isCallable$4(argument)) return false;
1152
+ switch (classof$2(argument)) {
1153
+ case 'AsyncFunction':
1154
+ case 'GeneratorFunction':
1155
+ case 'AsyncGeneratorFunction': return false;
1156
+ }
1157
+ try {
1158
+ // we can't check .prototype since constructors produced by .bind haven't it
1159
+ // `Function#toString` throws on some built-it function in some legacy engines
1160
+ // (for example, `DOMQuad` and similar in FF41-)
1161
+ return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource$1(argument));
1162
+ } catch (error) {
1163
+ return true;
1164
+ }
1165
+ };
1166
+
1167
+ isConstructorLegacy.sham = true;
1168
+
1169
+ // `IsConstructor` abstract operation
1170
+ // https://tc39.es/ecma262/#sec-isconstructor
1171
+ var isConstructor$2 = !construct || fails$2(function () {
1172
+ var called;
1173
+ return isConstructorModern(isConstructorModern.call)
1174
+ || !isConstructorModern(Object)
1175
+ || !isConstructorModern(function () { called = true; })
1176
+ || called;
1177
+ }) ? isConstructorLegacy : isConstructorModern;
1178
+
1179
+ var DESCRIPTORS$3 = descriptors;
1180
+ var definePropertyModule$1 = objectDefineProperty;
1181
+ var createPropertyDescriptor = createPropertyDescriptor$3;
1182
+
1183
+ var createProperty$1 = function (object, key, value) {
1184
+ if (DESCRIPTORS$3) definePropertyModule$1.f(object, key, createPropertyDescriptor(0, value));
1185
+ else object[key] = value;
1186
+ };
1187
+
1188
+ var classof$1 = classof$3;
1189
+ var getMethod = getMethod$3;
1190
+ var isNullOrUndefined$1 = isNullOrUndefined$4;
1191
+ var Iterators = iterators;
1192
+ var wellKnownSymbol$6 = wellKnownSymbol$b;
1193
+
1194
+ var ITERATOR$1 = wellKnownSymbol$6('iterator');
1195
+
1196
+ var getIteratorMethod$3 = function (it) {
1197
+ if (!isNullOrUndefined$1(it)) return getMethod(it, ITERATOR$1)
1198
+ || getMethod(it, '@@iterator')
1199
+ || Iterators[classof$1(it)];
1200
+ };
1201
+
1202
+ var call$6 = functionCall;
1203
+ var aCallable$5 = aCallable$8;
1204
+ var anObject$5 = anObject$a;
1205
+ var tryToString$2 = tryToString$4;
1206
+ var getIteratorMethod$2 = getIteratorMethod$3;
1207
+
1208
+ var $TypeError$6 = TypeError;
1209
+
1210
+ var getIterator$2 = function (argument, usingIterator) {
1211
+ var iteratorMethod = arguments.length < 2 ? getIteratorMethod$2(argument) : usingIterator;
1212
+ if (aCallable$5(iteratorMethod)) return anObject$5(call$6(iteratorMethod, argument));
1213
+ throw new $TypeError$6(tryToString$2(argument) + ' is not iterable');
1214
+ };
1215
+
1216
+ var bind$4 = functionBindContext;
1217
+ var call$5 = functionCall;
1218
+ var toObject$1 = toObject$3;
1219
+ var callWithSafeIterationClosing = callWithSafeIterationClosing$1;
1220
+ var isArrayIteratorMethod$1 = isArrayIteratorMethod$2;
1221
+ var isConstructor$1 = isConstructor$2;
1222
+ var lengthOfArrayLike$2 = lengthOfArrayLike$4;
1223
+ var createProperty = createProperty$1;
1224
+ var getIterator$1 = getIterator$2;
1225
+ var getIteratorMethod$1 = getIteratorMethod$3;
1226
+
1227
+ var $Array = Array;
1228
+
1229
+ // `Array.from` method implementation
1230
+ // https://tc39.es/ecma262/#sec-array.from
1231
+ var arrayFrom = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
1232
+ var O = toObject$1(arrayLike);
1233
+ var IS_CONSTRUCTOR = isConstructor$1(this);
1234
+ var argumentsLength = arguments.length;
1235
+ var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
1236
+ var mapping = mapfn !== undefined;
1237
+ if (mapping) mapfn = bind$4(mapfn, argumentsLength > 2 ? arguments[2] : undefined);
1238
+ var iteratorMethod = getIteratorMethod$1(O);
1239
+ var index = 0;
1240
+ var length, result, step, iterator, next, value;
1241
+ // if the target is not iterable or it's an array with the default iterator - use a simple case
1242
+ if (iteratorMethod && !(this === $Array && isArrayIteratorMethod$1(iteratorMethod))) {
1243
+ result = IS_CONSTRUCTOR ? new this() : [];
1244
+ iterator = getIterator$1(O, iteratorMethod);
1245
+ next = iterator.next;
1246
+ for (;!(step = call$5(next, iterator)).done; index++) {
1247
+ value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;
1248
+ createProperty(result, index, value);
1249
+ }
1250
+ } else {
1251
+ length = lengthOfArrayLike$2(O);
1252
+ result = IS_CONSTRUCTOR ? new this(length) : $Array(length);
1253
+ for (;length > index; index++) {
1254
+ value = mapping ? mapfn(O[index], index) : O[index];
1255
+ createProperty(result, index, value);
1256
+ }
1257
+ }
1258
+ result.length = index;
1259
+ return result;
1260
+ };
1261
+
1262
+ var wellKnownSymbol$5 = wellKnownSymbol$b;
1263
+
1264
+ var ITERATOR = wellKnownSymbol$5('iterator');
1265
+ var SAFE_CLOSING = false;
1266
+
1267
+ try {
1268
+ var called = 0;
1269
+ var iteratorWithReturn = {
1270
+ next: function () {
1271
+ return { done: !!called++ };
1272
+ },
1273
+ 'return': function () {
1274
+ SAFE_CLOSING = true;
1275
+ }
1276
+ };
1277
+ iteratorWithReturn[ITERATOR] = function () {
1278
+ return this;
1279
+ };
1280
+ // eslint-disable-next-line es/no-array-from, no-throw-literal -- required for testing
1281
+ Array.from(iteratorWithReturn, function () { throw 2; });
1282
+ } catch (error) { /* empty */ }
1283
+
1284
+ var checkCorrectnessOfIteration$2 = function (exec, SKIP_CLOSING) {
1285
+ try {
1286
+ if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
1287
+ } catch (error) { return false; } // workaround of old WebKit + `eval` bug
1288
+ var ITERATION_SUPPORT = false;
1289
+ try {
1290
+ var object = {};
1291
+ object[ITERATOR] = function () {
1292
+ return {
1293
+ next: function () {
1294
+ return { done: ITERATION_SUPPORT = true };
1295
+ }
1296
+ };
1297
+ };
1298
+ exec(object);
1299
+ } catch (error) { /* empty */ }
1300
+ return ITERATION_SUPPORT;
1301
+ };
1302
+
1303
+ var $$8 = _export;
1304
+ var from = arrayFrom;
1305
+ var checkCorrectnessOfIteration$1 = checkCorrectnessOfIteration$2;
1306
+
1307
+ var INCORRECT_ITERATION = !checkCorrectnessOfIteration$1(function (iterable) {
1308
+ // eslint-disable-next-line es/no-array-from -- required for testing
1309
+ Array.from(iterable);
1310
+ });
1311
+
1312
+ // `Array.from` method
1313
+ // https://tc39.es/ecma262/#sec-array.from
1314
+ $$8({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, {
1315
+ from: from
1316
+ });
1317
+
1318
+ /* global Bun, Deno -- detection */
1319
+ var globalThis$7 = globalThis_1;
1320
+ var userAgent$3 = environmentUserAgent;
1321
+ var classof = classofRaw$2;
1322
+
1323
+ var userAgentStartsWith = function (string) {
1324
+ return userAgent$3.slice(0, string.length) === string;
1325
+ };
1326
+
1327
+ var environment = (function () {
1328
+ if (userAgentStartsWith('Bun/')) return 'BUN';
1329
+ if (userAgentStartsWith('Cloudflare-Workers')) return 'CLOUDFLARE';
1330
+ if (userAgentStartsWith('Deno/')) return 'DENO';
1331
+ if (userAgentStartsWith('Node.js/')) return 'NODE';
1332
+ if (globalThis$7.Bun && typeof Bun.version == 'string') return 'BUN';
1333
+ if (globalThis$7.Deno && typeof Deno.version == 'object') return 'DENO';
1334
+ if (classof(globalThis$7.process) === 'process') return 'NODE';
1335
+ if (globalThis$7.window && globalThis$7.document) return 'BROWSER';
1336
+ return 'REST';
1337
+ })();
1338
+
1339
+ var ENVIRONMENT$1 = environment;
1340
+
1341
+ var environmentIsNode = ENVIRONMENT$1 === 'NODE';
1342
+
1343
+ var uncurryThis$1 = functionUncurryThis;
1344
+ var aCallable$4 = aCallable$8;
1345
+
1346
+ var functionUncurryThisAccessor = function (object, key, method) {
1347
+ try {
1348
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
1349
+ return uncurryThis$1(aCallable$4(Object.getOwnPropertyDescriptor(object, key)[method]));
1350
+ } catch (error) { /* empty */ }
1351
+ };
1352
+
1353
+ var isObject$3 = isObject$9;
1354
+
1355
+ var isPossiblePrototype$1 = function (argument) {
1356
+ return isObject$3(argument) || argument === null;
1357
+ };
1358
+
1359
+ var isPossiblePrototype = isPossiblePrototype$1;
1360
+
1361
+ var $String = String;
1362
+ var $TypeError$5 = TypeError;
1363
+
1364
+ var aPossiblePrototype$1 = function (argument) {
1365
+ if (isPossiblePrototype(argument)) return argument;
1366
+ throw new $TypeError$5("Can't set " + $String(argument) + ' as a prototype');
1367
+ };
1368
+
1369
+ /* eslint-disable no-proto -- safe */
1370
+ var uncurryThisAccessor = functionUncurryThisAccessor;
1371
+ var isObject$2 = isObject$9;
1372
+ var requireObjectCoercible = requireObjectCoercible$3;
1373
+ var aPossiblePrototype = aPossiblePrototype$1;
1374
+
1375
+ // `Object.setPrototypeOf` method
1376
+ // https://tc39.es/ecma262/#sec-object.setprototypeof
1377
+ // Works with __proto__ only. Old v8 can't work with null proto objects.
1378
+ // eslint-disable-next-line es/no-object-setprototypeof -- safe
1379
+ var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
1380
+ var CORRECT_SETTER = false;
1381
+ var test = {};
1382
+ var setter;
1383
+ try {
1384
+ setter = uncurryThisAccessor(Object.prototype, '__proto__', 'set');
1385
+ setter(test, []);
1386
+ CORRECT_SETTER = test instanceof Array;
1387
+ } catch (error) { /* empty */ }
1388
+ return function setPrototypeOf(O, proto) {
1389
+ requireObjectCoercible(O);
1390
+ aPossiblePrototype(proto);
1391
+ if (!isObject$2(O)) return O;
1392
+ if (CORRECT_SETTER) setter(O, proto);
1393
+ else O.__proto__ = proto;
1394
+ return O;
1395
+ };
1396
+ }() : undefined);
1397
+
1398
+ var defineProperty$2 = objectDefineProperty.f;
1399
+ var hasOwn$1 = hasOwnProperty_1;
1400
+ var wellKnownSymbol$4 = wellKnownSymbol$b;
1401
+
1402
+ var TO_STRING_TAG = wellKnownSymbol$4('toStringTag');
1403
+
1404
+ var setToStringTag$1 = function (target, TAG, STATIC) {
1405
+ if (target && !STATIC) target = target.prototype;
1406
+ if (target && !hasOwn$1(target, TO_STRING_TAG)) {
1407
+ defineProperty$2(target, TO_STRING_TAG, { configurable: true, value: TAG });
1408
+ }
1409
+ };
1410
+
1411
+ var makeBuiltIn = makeBuiltInExports;
1412
+ var defineProperty$1 = objectDefineProperty;
1413
+
1414
+ var defineBuiltInAccessor$1 = function (target, name, descriptor) {
1415
+ if (descriptor.get) makeBuiltIn(descriptor.get, name, { getter: true });
1416
+ if (descriptor.set) makeBuiltIn(descriptor.set, name, { setter: true });
1417
+ return defineProperty$1.f(target, name, descriptor);
1418
+ };
1419
+
1420
+ var getBuiltIn$3 = getBuiltIn$7;
1421
+ var defineBuiltInAccessor = defineBuiltInAccessor$1;
1422
+ var wellKnownSymbol$3 = wellKnownSymbol$b;
1423
+ var DESCRIPTORS$2 = descriptors;
1424
+
1425
+ var SPECIES$2 = wellKnownSymbol$3('species');
1426
+
1427
+ var setSpecies$1 = function (CONSTRUCTOR_NAME) {
1428
+ var Constructor = getBuiltIn$3(CONSTRUCTOR_NAME);
1429
+
1430
+ if (DESCRIPTORS$2 && Constructor && !Constructor[SPECIES$2]) {
1431
+ defineBuiltInAccessor(Constructor, SPECIES$2, {
1432
+ configurable: true,
1433
+ get: function () { return this; }
1434
+ });
1435
+ }
1436
+ };
1437
+
1438
+ var isPrototypeOf$1 = objectIsPrototypeOf;
1439
+
1440
+ var $TypeError$4 = TypeError;
1441
+
1442
+ var anInstance$1 = function (it, Prototype) {
1443
+ if (isPrototypeOf$1(Prototype, it)) return it;
1444
+ throw new $TypeError$4('Incorrect invocation');
1445
+ };
1446
+
1447
+ var isConstructor = isConstructor$2;
1448
+ var tryToString$1 = tryToString$4;
1449
+
1450
+ var $TypeError$3 = TypeError;
1451
+
1452
+ // `Assert: IsConstructor(argument) is true`
1453
+ var aConstructor$1 = function (argument) {
1454
+ if (isConstructor(argument)) return argument;
1455
+ throw new $TypeError$3(tryToString$1(argument) + ' is not a constructor');
1456
+ };
1457
+
1458
+ var anObject$4 = anObject$a;
1459
+ var aConstructor = aConstructor$1;
1460
+ var isNullOrUndefined = isNullOrUndefined$4;
1461
+ var wellKnownSymbol$2 = wellKnownSymbol$b;
1462
+
1463
+ var SPECIES$1 = wellKnownSymbol$2('species');
1464
+
1465
+ // `SpeciesConstructor` abstract operation
1466
+ // https://tc39.es/ecma262/#sec-speciesconstructor
1467
+ var speciesConstructor$1 = function (O, defaultConstructor) {
1468
+ var C = anObject$4(O).constructor;
1469
+ var S;
1470
+ return C === undefined || isNullOrUndefined(S = anObject$4(C)[SPECIES$1]) ? defaultConstructor : aConstructor(S);
1471
+ };
1472
+
1473
+ var NATIVE_BIND = functionBindNative;
1474
+
1475
+ var FunctionPrototype = Function.prototype;
1476
+ var apply$1 = FunctionPrototype.apply;
1477
+ var call$4 = FunctionPrototype.call;
1478
+
1479
+ // eslint-disable-next-line es/no-reflect -- safe
1480
+ var functionApply = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call$4.bind(apply$1) : function () {
1481
+ return call$4.apply(apply$1, arguments);
1482
+ });
1483
+
1484
+ var getBuiltIn$2 = getBuiltIn$7;
1485
+
1486
+ var html$2 = getBuiltIn$2('document', 'documentElement');
1487
+
1488
+ var uncurryThis = functionUncurryThis;
1489
+
1490
+ var arraySlice$1 = uncurryThis([].slice);
1491
+
1492
+ var $TypeError$2 = TypeError;
1493
+
1494
+ var validateArgumentsLength$1 = function (passed, required) {
1495
+ if (passed < required) throw new $TypeError$2('Not enough arguments');
1496
+ return passed;
1497
+ };
1498
+
1499
+ var userAgent$2 = environmentUserAgent;
1500
+
1501
+ // eslint-disable-next-line redos/no-vulnerable -- safe
1502
+ var environmentIsIos = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent$2);
1503
+
1504
+ var globalThis$6 = globalThis_1;
1505
+ var apply = functionApply;
1506
+ var bind$3 = functionBindContext;
1507
+ var isCallable$3 = isCallable$g;
1508
+ var hasOwn = hasOwnProperty_1;
1509
+ var fails$1 = fails$b;
1510
+ var html$1 = html$2;
1511
+ var arraySlice = arraySlice$1;
1512
+ var createElement = documentCreateElement$1;
1513
+ var validateArgumentsLength = validateArgumentsLength$1;
1514
+ var IS_IOS$1 = environmentIsIos;
1515
+ var IS_NODE$2 = environmentIsNode;
1516
+
1517
+ var set = globalThis$6.setImmediate;
1518
+ var clear = globalThis$6.clearImmediate;
1519
+ var process$2 = globalThis$6.process;
1520
+ var Dispatch = globalThis$6.Dispatch;
1521
+ var Function$1 = globalThis$6.Function;
1522
+ var MessageChannel = globalThis$6.MessageChannel;
1523
+ var String$1 = globalThis$6.String;
1524
+ var counter = 0;
1525
+ var queue$2 = {};
1526
+ var ONREADYSTATECHANGE = 'onreadystatechange';
1527
+ var $location, defer, channel, port;
1528
+
1529
+ fails$1(function () {
1530
+ // Deno throws a ReferenceError on `location` access without `--location` flag
1531
+ $location = globalThis$6.location;
1532
+ });
1533
+
1534
+ var run = function (id) {
1535
+ if (hasOwn(queue$2, id)) {
1536
+ var fn = queue$2[id];
1537
+ delete queue$2[id];
1538
+ fn();
1539
+ }
1540
+ };
1541
+
1542
+ var runner = function (id) {
1543
+ return function () {
1544
+ run(id);
1545
+ };
1546
+ };
1547
+
1548
+ var eventListener = function (event) {
1549
+ run(event.data);
1550
+ };
1551
+
1552
+ var globalPostMessageDefer = function (id) {
1553
+ // old engines have not location.origin
1554
+ globalThis$6.postMessage(String$1(id), $location.protocol + '//' + $location.host);
1555
+ };
1556
+
1557
+ // Node.js 0.9+ & IE10+ has setImmediate, otherwise:
1558
+ if (!set || !clear) {
1559
+ set = function setImmediate(handler) {
1560
+ validateArgumentsLength(arguments.length, 1);
1561
+ var fn = isCallable$3(handler) ? handler : Function$1(handler);
1562
+ var args = arraySlice(arguments, 1);
1563
+ queue$2[++counter] = function () {
1564
+ apply(fn, undefined, args);
1565
+ };
1566
+ defer(counter);
1567
+ return counter;
1568
+ };
1569
+ clear = function clearImmediate(id) {
1570
+ delete queue$2[id];
1571
+ };
1572
+ // Node.js 0.8-
1573
+ if (IS_NODE$2) {
1574
+ defer = function (id) {
1575
+ process$2.nextTick(runner(id));
1576
+ };
1577
+ // Sphere (JS game engine) Dispatch API
1578
+ } else if (Dispatch && Dispatch.now) {
1579
+ defer = function (id) {
1580
+ Dispatch.now(runner(id));
1581
+ };
1582
+ // Browsers with MessageChannel, includes WebWorkers
1583
+ // except iOS - https://github.com/zloirock/core-js/issues/624
1584
+ } else if (MessageChannel && !IS_IOS$1) {
1585
+ channel = new MessageChannel();
1586
+ port = channel.port2;
1587
+ channel.port1.onmessage = eventListener;
1588
+ defer = bind$3(port.postMessage, port);
1589
+ // Browsers with postMessage, skip WebWorkers
1590
+ // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
1591
+ } else if (
1592
+ globalThis$6.addEventListener &&
1593
+ isCallable$3(globalThis$6.postMessage) &&
1594
+ !globalThis$6.importScripts &&
1595
+ $location && $location.protocol !== 'file:' &&
1596
+ !fails$1(globalPostMessageDefer)
1597
+ ) {
1598
+ defer = globalPostMessageDefer;
1599
+ globalThis$6.addEventListener('message', eventListener, false);
1600
+ // IE8-
1601
+ } else if (ONREADYSTATECHANGE in createElement('script')) {
1602
+ defer = function (id) {
1603
+ html$1.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () {
1604
+ html$1.removeChild(this);
1605
+ run(id);
1606
+ };
1607
+ };
1608
+ // Rest old browsers
1609
+ } else {
1610
+ defer = function (id) {
1611
+ setTimeout(runner(id), 0);
1612
+ };
1613
+ }
1614
+ }
1615
+
1616
+ var task$1 = {
1617
+ set: set,
1618
+ clear: clear
1619
+ };
1620
+
1621
+ var globalThis$5 = globalThis_1;
1622
+ var DESCRIPTORS$1 = descriptors;
1623
+
1624
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
1625
+ var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
1626
+
1627
+ // Avoid NodeJS experimental warning
1628
+ var safeGetBuiltIn$1 = function (name) {
1629
+ if (!DESCRIPTORS$1) return globalThis$5[name];
1630
+ var descriptor = getOwnPropertyDescriptor(globalThis$5, name);
1631
+ return descriptor && descriptor.value;
1632
+ };
1633
+
1634
+ var Queue$2 = function () {
1635
+ this.head = null;
1636
+ this.tail = null;
1637
+ };
1638
+
1639
+ Queue$2.prototype = {
1640
+ add: function (item) {
1641
+ var entry = { item: item, next: null };
1642
+ var tail = this.tail;
1643
+ if (tail) tail.next = entry;
1644
+ else this.head = entry;
1645
+ this.tail = entry;
1646
+ },
1647
+ get: function () {
1648
+ var entry = this.head;
1649
+ if (entry) {
1650
+ var next = this.head = entry.next;
1651
+ if (next === null) this.tail = null;
1652
+ return entry.item;
1653
+ }
1654
+ }
1655
+ };
1656
+
1657
+ var queue$1 = Queue$2;
1658
+
1659
+ var userAgent$1 = environmentUserAgent;
1660
+
1661
+ var environmentIsIosPebble = /ipad|iphone|ipod/i.test(userAgent$1) && typeof Pebble != 'undefined';
1662
+
1663
+ var userAgent = environmentUserAgent;
1664
+
1665
+ var environmentIsWebosWebkit = /web0s(?!.*chrome)/i.test(userAgent);
1666
+
1667
+ var globalThis$4 = globalThis_1;
1668
+ var safeGetBuiltIn = safeGetBuiltIn$1;
1669
+ var bind$2 = functionBindContext;
1670
+ var macrotask = task$1.set;
1671
+ var Queue$1 = queue$1;
1672
+ var IS_IOS = environmentIsIos;
1673
+ var IS_IOS_PEBBLE = environmentIsIosPebble;
1674
+ var IS_WEBOS_WEBKIT = environmentIsWebosWebkit;
1675
+ var IS_NODE$1 = environmentIsNode;
1676
+
1677
+ var MutationObserver$1 = globalThis$4.MutationObserver || globalThis$4.WebKitMutationObserver;
1678
+ var document$2 = globalThis$4.document;
1679
+ var process$1 = globalThis$4.process;
1680
+ var Promise$1 = globalThis$4.Promise;
1681
+ var microtask$1 = safeGetBuiltIn('queueMicrotask');
1682
+ var notify$1, toggle, node, promise, then;
1683
+
1684
+ // modern engines have queueMicrotask method
1685
+ if (!microtask$1) {
1686
+ var queue = new Queue$1();
1687
+
1688
+ var flush = function () {
1689
+ var parent, fn;
1690
+ if (IS_NODE$1 && (parent = process$1.domain)) parent.exit();
1691
+ while (fn = queue.get()) try {
1692
+ fn();
1693
+ } catch (error) {
1694
+ if (queue.head) notify$1();
1695
+ throw error;
1696
+ }
1697
+ if (parent) parent.enter();
1698
+ };
1699
+
1700
+ // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
1701
+ // also except WebOS Webkit https://github.com/zloirock/core-js/issues/898
1702
+ if (!IS_IOS && !IS_NODE$1 && !IS_WEBOS_WEBKIT && MutationObserver$1 && document$2) {
1703
+ toggle = true;
1704
+ node = document$2.createTextNode('');
1705
+ new MutationObserver$1(flush).observe(node, { characterData: true });
1706
+ notify$1 = function () {
1707
+ node.data = toggle = !toggle;
1708
+ };
1709
+ // environments with maybe non-completely correct, but existent Promise
1710
+ } else if (!IS_IOS_PEBBLE && Promise$1 && Promise$1.resolve) {
1711
+ // Promise.resolve without an argument throws an error in LG WebOS 2
1712
+ promise = Promise$1.resolve(undefined);
1713
+ // workaround of WebKit ~ iOS Safari 10.1 bug
1714
+ promise.constructor = Promise$1;
1715
+ then = bind$2(promise.then, promise);
1716
+ notify$1 = function () {
1717
+ then(flush);
1718
+ };
1719
+ // Node.js without promises
1720
+ } else if (IS_NODE$1) {
1721
+ notify$1 = function () {
1722
+ process$1.nextTick(flush);
1723
+ };
1724
+ // for other environments - macrotask based on:
1725
+ // - setImmediate
1726
+ // - MessageChannel
1727
+ // - window.postMessage
1728
+ // - onreadystatechange
1729
+ // - setTimeout
1730
+ } else {
1731
+ // `webpack` dev server bug on IE global methods - use bind(fn, global)
1732
+ macrotask = bind$2(macrotask, globalThis$4);
1733
+ notify$1 = function () {
1734
+ macrotask(flush);
1735
+ };
1736
+ }
1737
+
1738
+ microtask$1 = function (fn) {
1739
+ if (!queue.head) notify$1();
1740
+ queue.add(fn);
1741
+ };
1742
+ }
1743
+
1744
+ var microtask_1 = microtask$1;
1745
+
1746
+ var hostReportErrors$1 = function (a, b) {
1747
+ try {
1748
+ // eslint-disable-next-line no-console -- safe
1749
+ arguments.length === 1 ? (void 0) : (void 0);
1750
+ } catch (error) { /* empty */ }
1751
+ };
1752
+
1753
+ var perform$3 = function (exec) {
1754
+ try {
1755
+ return { error: false, value: exec() };
1756
+ } catch (error) {
1757
+ return { error: true, value: error };
1758
+ }
1759
+ };
1760
+
1761
+ var globalThis$3 = globalThis_1;
1762
+
1763
+ var promiseNativeConstructor = globalThis$3.Promise;
1764
+
1765
+ var globalThis$2 = globalThis_1;
1766
+ var NativePromiseConstructor$3 = promiseNativeConstructor;
1767
+ var isCallable$2 = isCallable$g;
1768
+ var isForced = isForced_1;
1769
+ var inspectSource = inspectSource$3;
1770
+ var wellKnownSymbol$1 = wellKnownSymbol$b;
1771
+ var ENVIRONMENT = environment;
1772
+ var V8_VERSION = environmentV8Version;
1773
+
1774
+ NativePromiseConstructor$3 && NativePromiseConstructor$3.prototype;
1775
+ var SPECIES = wellKnownSymbol$1('species');
1776
+ var SUBCLASSING = false;
1777
+ var NATIVE_PROMISE_REJECTION_EVENT$1 = isCallable$2(globalThis$2.PromiseRejectionEvent);
1778
+
1779
+ var FORCED_PROMISE_CONSTRUCTOR$5 = isForced('Promise', function () {
1780
+ var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(NativePromiseConstructor$3);
1781
+ var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(NativePromiseConstructor$3);
1782
+ // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
1783
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
1784
+ // We can't detect it synchronously, so just check versions
1785
+ if (!GLOBAL_CORE_JS_PROMISE && V8_VERSION === 66) return true;
1786
+ // We can't use @@species feature detection in V8 since it causes
1787
+ // deoptimization and performance degradation
1788
+ // https://github.com/zloirock/core-js/issues/679
1789
+ if (!V8_VERSION || V8_VERSION < 51 || !/native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) {
1790
+ // Detect correctness of subclassing with @@species support
1791
+ var promise = new NativePromiseConstructor$3(function (resolve) { resolve(1); });
1792
+ var FakePromise = function (exec) {
1793
+ exec(function () { /* empty */ }, function () { /* empty */ });
1794
+ };
1795
+ var constructor = promise.constructor = {};
1796
+ constructor[SPECIES] = FakePromise;
1797
+ SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise;
1798
+ if (!SUBCLASSING) return true;
1799
+ // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
1800
+ } return !GLOBAL_CORE_JS_PROMISE && (ENVIRONMENT === 'BROWSER' || ENVIRONMENT === 'DENO') && !NATIVE_PROMISE_REJECTION_EVENT$1;
1801
+ });
1802
+
1803
+ var promiseConstructorDetection = {
1804
+ CONSTRUCTOR: FORCED_PROMISE_CONSTRUCTOR$5,
1805
+ REJECTION_EVENT: NATIVE_PROMISE_REJECTION_EVENT$1,
1806
+ SUBCLASSING: SUBCLASSING
1807
+ };
1808
+
1809
+ var newPromiseCapability$2 = {};
1810
+
1811
+ var aCallable$3 = aCallable$8;
1812
+
1813
+ var $TypeError$1 = TypeError;
1814
+
1815
+ var PromiseCapability = function (C) {
1816
+ var resolve, reject;
1817
+ this.promise = new C(function ($$resolve, $$reject) {
1818
+ if (resolve !== undefined || reject !== undefined) throw new $TypeError$1('Bad Promise constructor');
1819
+ resolve = $$resolve;
1820
+ reject = $$reject;
1821
+ });
1822
+ this.resolve = aCallable$3(resolve);
1823
+ this.reject = aCallable$3(reject);
1824
+ };
1825
+
1826
+ // `NewPromiseCapability` abstract operation
1827
+ // https://tc39.es/ecma262/#sec-newpromisecapability
1828
+ newPromiseCapability$2.f = function (C) {
1829
+ return new PromiseCapability(C);
1830
+ };
1831
+
1832
+ var $$7 = _export;
1833
+ var IS_NODE = environmentIsNode;
1834
+ var globalThis$1 = globalThis_1;
1835
+ var call$3 = functionCall;
1836
+ var defineBuiltIn$1 = defineBuiltIn$3;
1837
+ var setPrototypeOf = objectSetPrototypeOf;
1838
+ var setToStringTag = setToStringTag$1;
1839
+ var setSpecies = setSpecies$1;
1840
+ var aCallable$2 = aCallable$8;
1841
+ var isCallable$1 = isCallable$g;
1842
+ var isObject$1 = isObject$9;
1843
+ var anInstance = anInstance$1;
1844
+ var speciesConstructor = speciesConstructor$1;
1845
+ var task = task$1.set;
1846
+ var microtask = microtask_1;
1847
+ var hostReportErrors = hostReportErrors$1;
1848
+ var perform$2 = perform$3;
1849
+ var Queue = queue$1;
1850
+ var InternalStateModule = internalState;
1851
+ var NativePromiseConstructor$2 = promiseNativeConstructor;
1852
+ var PromiseConstructorDetection = promiseConstructorDetection;
1853
+ var newPromiseCapabilityModule$3 = newPromiseCapability$2;
1854
+
1855
+ var PROMISE = 'Promise';
1856
+ var FORCED_PROMISE_CONSTRUCTOR$4 = PromiseConstructorDetection.CONSTRUCTOR;
1857
+ var NATIVE_PROMISE_REJECTION_EVENT = PromiseConstructorDetection.REJECTION_EVENT;
1858
+ var NATIVE_PROMISE_SUBCLASSING = PromiseConstructorDetection.SUBCLASSING;
1859
+ var getInternalPromiseState = InternalStateModule.getterFor(PROMISE);
1860
+ var setInternalState = InternalStateModule.set;
1861
+ var NativePromisePrototype$1 = NativePromiseConstructor$2 && NativePromiseConstructor$2.prototype;
1862
+ var PromiseConstructor = NativePromiseConstructor$2;
1863
+ var PromisePrototype = NativePromisePrototype$1;
1864
+ var TypeError$1 = globalThis$1.TypeError;
1865
+ var document$1 = globalThis$1.document;
1866
+ var process = globalThis$1.process;
1867
+ var newPromiseCapability$1 = newPromiseCapabilityModule$3.f;
1868
+ var newGenericPromiseCapability = newPromiseCapability$1;
1869
+
1870
+ var DISPATCH_EVENT = !!(document$1 && document$1.createEvent && globalThis$1.dispatchEvent);
1871
+ var UNHANDLED_REJECTION = 'unhandledrejection';
1872
+ var REJECTION_HANDLED = 'rejectionhandled';
1873
+ var PENDING = 0;
1874
+ var FULFILLED = 1;
1875
+ var REJECTED = 2;
1876
+ var HANDLED = 1;
1877
+ var UNHANDLED = 2;
1878
+
1879
+ var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
1880
+
1881
+ // helpers
1882
+ var isThenable = function (it) {
1883
+ var then;
1884
+ return isObject$1(it) && isCallable$1(then = it.then) ? then : false;
1885
+ };
1886
+
1887
+ var callReaction = function (reaction, state) {
1888
+ var value = state.value;
1889
+ var ok = state.state === FULFILLED;
1890
+ var handler = ok ? reaction.ok : reaction.fail;
1891
+ var resolve = reaction.resolve;
1892
+ var reject = reaction.reject;
1893
+ var domain = reaction.domain;
1894
+ var result, then, exited;
1895
+ try {
1896
+ if (handler) {
1897
+ if (!ok) {
1898
+ if (state.rejection === UNHANDLED) onHandleUnhandled(state);
1899
+ state.rejection = HANDLED;
1900
+ }
1901
+ if (handler === true) result = value;
1902
+ else {
1903
+ if (domain) domain.enter();
1904
+ result = handler(value); // can throw
1905
+ if (domain) {
1906
+ domain.exit();
1907
+ exited = true;
1908
+ }
1909
+ }
1910
+ if (result === reaction.promise) {
1911
+ reject(new TypeError$1('Promise-chain cycle'));
1912
+ } else if (then = isThenable(result)) {
1913
+ call$3(then, result, resolve, reject);
1914
+ } else resolve(result);
1915
+ } else reject(value);
1916
+ } catch (error) {
1917
+ if (domain && !exited) domain.exit();
1918
+ reject(error);
1919
+ }
1920
+ };
1921
+
1922
+ var notify = function (state, isReject) {
1923
+ if (state.notified) return;
1924
+ state.notified = true;
1925
+ microtask(function () {
1926
+ var reactions = state.reactions;
1927
+ var reaction;
1928
+ while (reaction = reactions.get()) {
1929
+ callReaction(reaction, state);
1930
+ }
1931
+ state.notified = false;
1932
+ if (isReject && !state.rejection) onUnhandled(state);
1933
+ });
1934
+ };
1935
+
1936
+ var dispatchEvent = function (name, promise, reason) {
1937
+ var event, handler;
1938
+ if (DISPATCH_EVENT) {
1939
+ event = document$1.createEvent('Event');
1940
+ event.promise = promise;
1941
+ event.reason = reason;
1942
+ event.initEvent(name, false, true);
1943
+ globalThis$1.dispatchEvent(event);
1944
+ } else event = { promise: promise, reason: reason };
1945
+ if (!NATIVE_PROMISE_REJECTION_EVENT && (handler = globalThis$1['on' + name])) handler(event);
1946
+ else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);
1947
+ };
1948
+
1949
+ var onUnhandled = function (state) {
1950
+ call$3(task, globalThis$1, function () {
1951
+ var promise = state.facade;
1952
+ var value = state.value;
1953
+ var IS_UNHANDLED = isUnhandled(state);
1954
+ var result;
1955
+ if (IS_UNHANDLED) {
1956
+ result = perform$2(function () {
1957
+ if (IS_NODE) {
1958
+ process.emit('unhandledRejection', value, promise);
1959
+ } else dispatchEvent(UNHANDLED_REJECTION, promise, value);
1960
+ });
1961
+ // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
1962
+ state.rejection = IS_NODE || isUnhandled(state) ? UNHANDLED : HANDLED;
1963
+ if (result.error) throw result.value;
1964
+ }
1965
+ });
1966
+ };
1967
+
1968
+ var isUnhandled = function (state) {
1969
+ return state.rejection !== HANDLED && !state.parent;
1970
+ };
1971
+
1972
+ var onHandleUnhandled = function (state) {
1973
+ call$3(task, globalThis$1, function () {
1974
+ var promise = state.facade;
1975
+ if (IS_NODE) {
1976
+ process.emit('rejectionHandled', promise);
1977
+ } else dispatchEvent(REJECTION_HANDLED, promise, state.value);
1978
+ });
1979
+ };
1980
+
1981
+ var bind$1 = function (fn, state, unwrap) {
1982
+ return function (value) {
1983
+ fn(state, value, unwrap);
1984
+ };
1985
+ };
1986
+
1987
+ var internalReject = function (state, value, unwrap) {
1988
+ if (state.done) return;
1989
+ state.done = true;
1990
+ if (unwrap) state = unwrap;
1991
+ state.value = value;
1992
+ state.state = REJECTED;
1993
+ notify(state, true);
1994
+ };
1995
+
1996
+ var internalResolve = function (state, value, unwrap) {
1997
+ if (state.done) return;
1998
+ state.done = true;
1999
+ if (unwrap) state = unwrap;
2000
+ try {
2001
+ if (state.facade === value) throw new TypeError$1("Promise can't be resolved itself");
2002
+ var then = isThenable(value);
2003
+ if (then) {
2004
+ microtask(function () {
2005
+ var wrapper = { done: false };
2006
+ try {
2007
+ call$3(then, value,
2008
+ bind$1(internalResolve, wrapper, state),
2009
+ bind$1(internalReject, wrapper, state)
2010
+ );
2011
+ } catch (error) {
2012
+ internalReject(wrapper, error, state);
2013
+ }
2014
+ });
2015
+ } else {
2016
+ state.value = value;
2017
+ state.state = FULFILLED;
2018
+ notify(state, false);
2019
+ }
2020
+ } catch (error) {
2021
+ internalReject({ done: false }, error, state);
2022
+ }
2023
+ };
2024
+
2025
+ // constructor polyfill
2026
+ if (FORCED_PROMISE_CONSTRUCTOR$4) {
2027
+ // 25.4.3.1 Promise(executor)
2028
+ PromiseConstructor = function Promise(executor) {
2029
+ anInstance(this, PromisePrototype);
2030
+ aCallable$2(executor);
2031
+ call$3(Internal, this);
2032
+ var state = getInternalPromiseState(this);
2033
+ try {
2034
+ executor(bind$1(internalResolve, state), bind$1(internalReject, state));
2035
+ } catch (error) {
2036
+ internalReject(state, error);
2037
+ }
2038
+ };
2039
+
2040
+ PromisePrototype = PromiseConstructor.prototype;
2041
+
2042
+ // eslint-disable-next-line no-unused-vars -- required for `.length`
2043
+ Internal = function Promise(executor) {
2044
+ setInternalState(this, {
2045
+ type: PROMISE,
2046
+ done: false,
2047
+ notified: false,
2048
+ parent: false,
2049
+ reactions: new Queue(),
2050
+ rejection: false,
2051
+ state: PENDING,
2052
+ value: undefined
2053
+ });
2054
+ };
2055
+
2056
+ // `Promise.prototype.then` method
2057
+ // https://tc39.es/ecma262/#sec-promise.prototype.then
2058
+ Internal.prototype = defineBuiltIn$1(PromisePrototype, 'then', function then(onFulfilled, onRejected) {
2059
+ var state = getInternalPromiseState(this);
2060
+ var reaction = newPromiseCapability$1(speciesConstructor(this, PromiseConstructor));
2061
+ state.parent = true;
2062
+ reaction.ok = isCallable$1(onFulfilled) ? onFulfilled : true;
2063
+ reaction.fail = isCallable$1(onRejected) && onRejected;
2064
+ reaction.domain = IS_NODE ? process.domain : undefined;
2065
+ if (state.state === PENDING) state.reactions.add(reaction);
2066
+ else microtask(function () {
2067
+ callReaction(reaction, state);
2068
+ });
2069
+ return reaction.promise;
2070
+ });
2071
+
2072
+ OwnPromiseCapability = function () {
2073
+ var promise = new Internal();
2074
+ var state = getInternalPromiseState(promise);
2075
+ this.promise = promise;
2076
+ this.resolve = bind$1(internalResolve, state);
2077
+ this.reject = bind$1(internalReject, state);
2078
+ };
2079
+
2080
+ newPromiseCapabilityModule$3.f = newPromiseCapability$1 = function (C) {
2081
+ return C === PromiseConstructor || C === PromiseWrapper
2082
+ ? new OwnPromiseCapability(C)
2083
+ : newGenericPromiseCapability(C);
2084
+ };
2085
+
2086
+ if (isCallable$1(NativePromiseConstructor$2) && NativePromisePrototype$1 !== Object.prototype) {
2087
+ nativeThen = NativePromisePrototype$1.then;
2088
+
2089
+ if (!NATIVE_PROMISE_SUBCLASSING) {
2090
+ // make `Promise#then` return a polyfilled `Promise` for native promise-based APIs
2091
+ defineBuiltIn$1(NativePromisePrototype$1, 'then', function then(onFulfilled, onRejected) {
2092
+ var that = this;
2093
+ return new PromiseConstructor(function (resolve, reject) {
2094
+ call$3(nativeThen, that, resolve, reject);
2095
+ }).then(onFulfilled, onRejected);
2096
+ // https://github.com/zloirock/core-js/issues/640
2097
+ }, { unsafe: true });
2098
+ }
2099
+
2100
+ // make `.constructor === Promise` work for native promise-based APIs
2101
+ try {
2102
+ delete NativePromisePrototype$1.constructor;
2103
+ } catch (error) { /* empty */ }
2104
+
2105
+ // make `instanceof Promise` work for native promise-based APIs
2106
+ if (setPrototypeOf) {
2107
+ setPrototypeOf(NativePromisePrototype$1, PromisePrototype);
2108
+ }
2109
+ }
2110
+ }
2111
+
2112
+ $$7({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR$4 }, {
2113
+ Promise: PromiseConstructor
2114
+ });
2115
+
2116
+ setToStringTag(PromiseConstructor, PROMISE, false);
2117
+ setSpecies(PROMISE);
2118
+
2119
+ var bind = functionBindContext;
2120
+ var call$2 = functionCall;
2121
+ var anObject$3 = anObject$a;
2122
+ var tryToString = tryToString$4;
2123
+ var isArrayIteratorMethod = isArrayIteratorMethod$2;
2124
+ var lengthOfArrayLike$1 = lengthOfArrayLike$4;
2125
+ var isPrototypeOf = objectIsPrototypeOf;
2126
+ var getIterator = getIterator$2;
2127
+ var getIteratorMethod = getIteratorMethod$3;
2128
+ var iteratorClose = iteratorClose$2;
2129
+
2130
+ var $TypeError = TypeError;
2131
+
2132
+ var Result = function (stopped, result) {
2133
+ this.stopped = stopped;
2134
+ this.result = result;
2135
+ };
2136
+
2137
+ var ResultPrototype = Result.prototype;
2138
+
2139
+ var iterate$2 = function (iterable, unboundFunction, options) {
2140
+ var that = options && options.that;
2141
+ var AS_ENTRIES = !!(options && options.AS_ENTRIES);
2142
+ var IS_RECORD = !!(options && options.IS_RECORD);
2143
+ var IS_ITERATOR = !!(options && options.IS_ITERATOR);
2144
+ var INTERRUPTED = !!(options && options.INTERRUPTED);
2145
+ var fn = bind(unboundFunction, that);
2146
+ var iterator, iterFn, index, length, result, next, step;
2147
+
2148
+ var stop = function (condition) {
2149
+ if (iterator) iteratorClose(iterator, 'normal', condition);
2150
+ return new Result(true, condition);
2151
+ };
2152
+
2153
+ var callFn = function (value) {
2154
+ if (AS_ENTRIES) {
2155
+ anObject$3(value);
2156
+ return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
2157
+ } return INTERRUPTED ? fn(value, stop) : fn(value);
2158
+ };
2159
+
2160
+ if (IS_RECORD) {
2161
+ iterator = iterable.iterator;
2162
+ } else if (IS_ITERATOR) {
2163
+ iterator = iterable;
2164
+ } else {
2165
+ iterFn = getIteratorMethod(iterable);
2166
+ if (!iterFn) throw new $TypeError(tryToString(iterable) + ' is not iterable');
2167
+ // optimisation for array iterators
2168
+ if (isArrayIteratorMethod(iterFn)) {
2169
+ for (index = 0, length = lengthOfArrayLike$1(iterable); length > index; index++) {
2170
+ result = callFn(iterable[index]);
2171
+ if (result && isPrototypeOf(ResultPrototype, result)) return result;
2172
+ } return new Result(false);
2173
+ }
2174
+ iterator = getIterator(iterable, iterFn);
2175
+ }
2176
+
2177
+ next = IS_RECORD ? iterable.next : iterator.next;
2178
+ while (!(step = call$2(next, iterator)).done) {
2179
+ try {
2180
+ result = callFn(step.value);
2181
+ } catch (error) {
2182
+ iteratorClose(iterator, 'throw', error);
2183
+ }
2184
+ if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result)) return result;
2185
+ } return new Result(false);
2186
+ };
2187
+
2188
+ var NativePromiseConstructor$1 = promiseNativeConstructor;
2189
+ var checkCorrectnessOfIteration = checkCorrectnessOfIteration$2;
2190
+ var FORCED_PROMISE_CONSTRUCTOR$3 = promiseConstructorDetection.CONSTRUCTOR;
2191
+
2192
+ var promiseStaticsIncorrectIteration = FORCED_PROMISE_CONSTRUCTOR$3 || !checkCorrectnessOfIteration(function (iterable) {
2193
+ NativePromiseConstructor$1.all(iterable).then(undefined, function () { /* empty */ });
2194
+ });
2195
+
2196
+ var $$6 = _export;
2197
+ var call$1 = functionCall;
2198
+ var aCallable$1 = aCallable$8;
2199
+ var newPromiseCapabilityModule$2 = newPromiseCapability$2;
2200
+ var perform$1 = perform$3;
2201
+ var iterate$1 = iterate$2;
2202
+ var PROMISE_STATICS_INCORRECT_ITERATION$1 = promiseStaticsIncorrectIteration;
2203
+
2204
+ // `Promise.all` method
2205
+ // https://tc39.es/ecma262/#sec-promise.all
2206
+ $$6({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION$1 }, {
2207
+ all: function all(iterable) {
2208
+ var C = this;
2209
+ var capability = newPromiseCapabilityModule$2.f(C);
2210
+ var resolve = capability.resolve;
2211
+ var reject = capability.reject;
2212
+ var result = perform$1(function () {
2213
+ var $promiseResolve = aCallable$1(C.resolve);
2214
+ var values = [];
2215
+ var counter = 0;
2216
+ var remaining = 1;
2217
+ iterate$1(iterable, function (promise) {
2218
+ var index = counter++;
2219
+ var alreadyCalled = false;
2220
+ remaining++;
2221
+ call$1($promiseResolve, C, promise).then(function (value) {
2222
+ if (alreadyCalled) return;
2223
+ alreadyCalled = true;
2224
+ values[index] = value;
2225
+ --remaining || resolve(values);
2226
+ }, reject);
2227
+ });
2228
+ --remaining || resolve(values);
2229
+ });
2230
+ if (result.error) reject(result.value);
2231
+ return capability.promise;
2232
+ }
2233
+ });
2234
+
2235
+ var $$5 = _export;
2236
+ var FORCED_PROMISE_CONSTRUCTOR$2 = promiseConstructorDetection.CONSTRUCTOR;
2237
+ var NativePromiseConstructor = promiseNativeConstructor;
2238
+ var getBuiltIn$1 = getBuiltIn$7;
2239
+ var isCallable = isCallable$g;
2240
+ var defineBuiltIn = defineBuiltIn$3;
2241
+
2242
+ var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
2243
+
2244
+ // `Promise.prototype.catch` method
2245
+ // https://tc39.es/ecma262/#sec-promise.prototype.catch
2246
+ $$5({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR$2, real: true }, {
2247
+ 'catch': function (onRejected) {
2248
+ return this.then(undefined, onRejected);
2249
+ }
2250
+ });
2251
+
2252
+ // makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
2253
+ if (isCallable(NativePromiseConstructor)) {
2254
+ var method = getBuiltIn$1('Promise').prototype['catch'];
2255
+ if (NativePromisePrototype['catch'] !== method) {
2256
+ defineBuiltIn(NativePromisePrototype, 'catch', method, { unsafe: true });
2257
+ }
2258
+ }
2259
+
2260
+ var $$4 = _export;
2261
+ var call = functionCall;
2262
+ var aCallable = aCallable$8;
2263
+ var newPromiseCapabilityModule$1 = newPromiseCapability$2;
2264
+ var perform = perform$3;
2265
+ var iterate = iterate$2;
2266
+ var PROMISE_STATICS_INCORRECT_ITERATION = promiseStaticsIncorrectIteration;
2267
+
2268
+ // `Promise.race` method
2269
+ // https://tc39.es/ecma262/#sec-promise.race
2270
+ $$4({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
2271
+ race: function race(iterable) {
2272
+ var C = this;
2273
+ var capability = newPromiseCapabilityModule$1.f(C);
2274
+ var reject = capability.reject;
2275
+ var result = perform(function () {
2276
+ var $promiseResolve = aCallable(C.resolve);
2277
+ iterate(iterable, function (promise) {
2278
+ call($promiseResolve, C, promise).then(capability.resolve, reject);
2279
+ });
2280
+ });
2281
+ if (result.error) reject(result.value);
2282
+ return capability.promise;
2283
+ }
2284
+ });
2285
+
2286
+ var $$3 = _export;
2287
+ var newPromiseCapabilityModule = newPromiseCapability$2;
2288
+ var FORCED_PROMISE_CONSTRUCTOR$1 = promiseConstructorDetection.CONSTRUCTOR;
2289
+
2290
+ // `Promise.reject` method
2291
+ // https://tc39.es/ecma262/#sec-promise.reject
2292
+ $$3({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR$1 }, {
2293
+ reject: function reject(r) {
2294
+ var capability = newPromiseCapabilityModule.f(this);
2295
+ var capabilityReject = capability.reject;
2296
+ capabilityReject(r);
2297
+ return capability.promise;
2298
+ }
2299
+ });
2300
+
2301
+ var anObject$2 = anObject$a;
2302
+ var isObject = isObject$9;
2303
+ var newPromiseCapability = newPromiseCapability$2;
2304
+
2305
+ var promiseResolve$1 = function (C, x) {
2306
+ anObject$2(C);
2307
+ if (isObject(x) && x.constructor === C) return x;
2308
+ var promiseCapability = newPromiseCapability.f(C);
2309
+ var resolve = promiseCapability.resolve;
2310
+ resolve(x);
2311
+ return promiseCapability.promise;
2312
+ };
2313
+
2314
+ var $$2 = _export;
2315
+ var getBuiltIn = getBuiltIn$7;
2316
+ var FORCED_PROMISE_CONSTRUCTOR = promiseConstructorDetection.CONSTRUCTOR;
2317
+ var promiseResolve = promiseResolve$1;
2318
+
2319
+ getBuiltIn('Promise');
2320
+
2321
+ // `Promise.resolve` method
2322
+ // https://tc39.es/ecma262/#sec-promise.resolve
2323
+ $$2({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
2324
+ resolve: function resolve(x) {
2325
+ return promiseResolve(this, x);
2326
+ }
2327
+ });
2328
+
2329
+ var objectDefineProperties = {};
2330
+
2331
+ var internalObjectKeys = objectKeysInternal;
2332
+ var enumBugKeys$1 = enumBugKeys$3;
2333
+
2334
+ // `Object.keys` method
2335
+ // https://tc39.es/ecma262/#sec-object.keys
2336
+ // eslint-disable-next-line es/no-object-keys -- safe
2337
+ var objectKeys$1 = Object.keys || function keys(O) {
2338
+ return internalObjectKeys(O, enumBugKeys$1);
2339
+ };
2340
+
2341
+ var DESCRIPTORS = descriptors;
2342
+ var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
2343
+ var definePropertyModule = objectDefineProperty;
2344
+ var anObject$1 = anObject$a;
2345
+ var toIndexedObject = toIndexedObject$4;
2346
+ var objectKeys = objectKeys$1;
2347
+
2348
+ // `Object.defineProperties` method
2349
+ // https://tc39.es/ecma262/#sec-object.defineproperties
2350
+ // eslint-disable-next-line es/no-object-defineproperties -- safe
2351
+ objectDefineProperties.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
2352
+ anObject$1(O);
2353
+ var props = toIndexedObject(Properties);
2354
+ var keys = objectKeys(Properties);
2355
+ var length = keys.length;
2356
+ var index = 0;
2357
+ var key;
2358
+ while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]);
2359
+ return O;
2360
+ };
2361
+
2362
+ /* global ActiveXObject -- old IE, WSH */
2363
+ var anObject = anObject$a;
2364
+ var definePropertiesModule = objectDefineProperties;
2365
+ var enumBugKeys = enumBugKeys$3;
2366
+ var hiddenKeys = hiddenKeys$4;
2367
+ var html = html$2;
2368
+ var documentCreateElement = documentCreateElement$1;
2369
+ var sharedKey = sharedKey$2;
2370
+
2371
+ var GT = '>';
2372
+ var LT = '<';
2373
+ var PROTOTYPE = 'prototype';
2374
+ var SCRIPT = 'script';
2375
+ var IE_PROTO = sharedKey('IE_PROTO');
2376
+
2377
+ var EmptyConstructor = function () { /* empty */ };
2378
+
2379
+ var scriptTag = function (content) {
2380
+ return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
2381
+ };
2382
+
2383
+ // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
2384
+ var NullProtoObjectViaActiveX = function (activeXDocument) {
2385
+ activeXDocument.write(scriptTag(''));
2386
+ activeXDocument.close();
2387
+ var temp = activeXDocument.parentWindow.Object;
2388
+ // eslint-disable-next-line no-useless-assignment -- avoid memory leak
2389
+ activeXDocument = null;
2390
+ return temp;
2391
+ };
2392
+
2393
+ // Create object with fake `null` prototype: use iframe Object with cleared prototype
2394
+ var NullProtoObjectViaIFrame = function () {
2395
+ // Thrash, waste and sodomy: IE GC bug
2396
+ var iframe = documentCreateElement('iframe');
2397
+ var JS = 'java' + SCRIPT + ':';
2398
+ var iframeDocument;
2399
+ iframe.style.display = 'none';
2400
+ html.appendChild(iframe);
2401
+ // https://github.com/zloirock/core-js/issues/475
2402
+ iframe.src = String(JS);
2403
+ iframeDocument = iframe.contentWindow.document;
2404
+ iframeDocument.open();
2405
+ iframeDocument.write(scriptTag('document.F=Object'));
2406
+ iframeDocument.close();
2407
+ return iframeDocument.F;
2408
+ };
2409
+
2410
+ // Check for document.domain and active x support
2411
+ // No need to use active x approach when document.domain is not set
2412
+ // see https://github.com/es-shims/es5-shim/issues/150
2413
+ // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
2414
+ // avoid IE GC bug
2415
+ var activeXDocument;
2416
+ var NullProtoObject = function () {
2417
+ try {
2418
+ activeXDocument = new ActiveXObject('htmlfile');
2419
+ } catch (error) { /* ignore */ }
2420
+ NullProtoObject = typeof document != 'undefined'
2421
+ ? document.domain && activeXDocument
2422
+ ? NullProtoObjectViaActiveX(activeXDocument) // old IE
2423
+ : NullProtoObjectViaIFrame()
2424
+ : NullProtoObjectViaActiveX(activeXDocument); // WSH
2425
+ var length = enumBugKeys.length;
2426
+ while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
2427
+ return NullProtoObject();
2428
+ };
2429
+
2430
+ hiddenKeys[IE_PROTO] = true;
2431
+
2432
+ // `Object.create` method
2433
+ // https://tc39.es/ecma262/#sec-object.create
2434
+ // eslint-disable-next-line es/no-object-create -- safe
2435
+ var objectCreate = Object.create || function create(O, Properties) {
2436
+ var result;
2437
+ if (O !== null) {
2438
+ EmptyConstructor[PROTOTYPE] = anObject(O);
2439
+ result = new EmptyConstructor();
2440
+ EmptyConstructor[PROTOTYPE] = null;
2441
+ // add "__proto__" for Object.getPrototypeOf polyfill
2442
+ result[IE_PROTO] = O;
2443
+ } else result = NullProtoObject();
2444
+ return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
2445
+ };
2446
+
2447
+ var wellKnownSymbol = wellKnownSymbol$b;
2448
+ var create = objectCreate;
2449
+ var defineProperty = objectDefineProperty.f;
2450
+
2451
+ var UNSCOPABLES = wellKnownSymbol('unscopables');
2452
+ var ArrayPrototype = Array.prototype;
2453
+
2454
+ // Array.prototype[@@unscopables]
2455
+ // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
2456
+ if (ArrayPrototype[UNSCOPABLES] === undefined) {
2457
+ defineProperty(ArrayPrototype, UNSCOPABLES, {
2458
+ configurable: true,
2459
+ value: create(null)
2460
+ });
2461
+ }
2462
+
2463
+ // add a key to Array.prototype[@@unscopables]
2464
+ var addToUnscopables$2 = function (key) {
2465
+ ArrayPrototype[UNSCOPABLES][key] = true;
2466
+ };
2467
+
2468
+ var $$1 = _export;
2469
+ var $includes = arrayIncludes.includes;
2470
+ var fails = fails$b;
2471
+ var addToUnscopables$1 = addToUnscopables$2;
2472
+
2473
+ // FF99+ bug
2474
+ var BROKEN_ON_SPARSE = fails(function () {
2475
+ // eslint-disable-next-line es/no-array-prototype-includes -- detection
2476
+ return !Array(1).includes();
2477
+ });
2478
+
2479
+ // `Array.prototype.includes` method
2480
+ // https://tc39.es/ecma262/#sec-array.prototype.includes
2481
+ $$1({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
2482
+ includes: function includes(el /* , fromIndex = 0 */) {
2483
+ return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
2484
+ }
2485
+ });
2486
+
2487
+ // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
2488
+ addToUnscopables$1('includes');
2489
+
2490
+ var toObject = toObject$3;
2491
+ var toAbsoluteIndex = toAbsoluteIndex$2;
2492
+ var lengthOfArrayLike = lengthOfArrayLike$4;
2493
+
2494
+ // `Array.prototype.fill` method implementation
2495
+ // https://tc39.es/ecma262/#sec-array.prototype.fill
2496
+ var arrayFill = function fill(value /* , start = 0, end = @length */) {
2497
+ var O = toObject(this);
2498
+ var length = lengthOfArrayLike(O);
2499
+ var argumentsLength = arguments.length;
2500
+ var index = toAbsoluteIndex(argumentsLength > 1 ? arguments[1] : undefined, length);
2501
+ var end = argumentsLength > 2 ? arguments[2] : undefined;
2502
+ var endPos = end === undefined ? length : toAbsoluteIndex(end, length);
2503
+ while (endPos > index) O[index++] = value;
2504
+ return O;
2505
+ };
2506
+
2507
+ var $ = _export;
2508
+ var fill = arrayFill;
2509
+ var addToUnscopables = addToUnscopables$2;
2510
+
2511
+ // `Array.prototype.fill` method
2512
+ // https://tc39.es/ecma262/#sec-array.prototype.fill
2513
+ $({ target: 'Array', proto: true }, {
2514
+ fill: fill
2515
+ });
2516
+
2517
+ // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
2518
+ addToUnscopables('fill');
2519
+
2520
+ /* eslint-disable no-prototype-builtins */
2521
+ var g =
2522
+ (typeof globalThis !== 'undefined' && globalThis) ||
2523
+ (typeof self !== 'undefined' && self) ||
2524
+ // eslint-disable-next-line no-undef
2525
+ (typeof global !== 'undefined' && global) ||
2526
+ {};
2527
+
2528
+ var support = {
2529
+ searchParams: 'URLSearchParams' in g,
2530
+ iterable: 'Symbol' in g && 'iterator' in Symbol,
2531
+ blob:
2532
+ 'FileReader' in g &&
2533
+ 'Blob' in g &&
2534
+ (function() {
2535
+ try {
2536
+ new Blob();
2537
+ return true
2538
+ } catch (e) {
2539
+ return false
2540
+ }
2541
+ })(),
2542
+ formData: 'FormData' in g,
2543
+ arrayBuffer: 'ArrayBuffer' in g
2544
+ };
2545
+
2546
+ function isDataView(obj) {
2547
+ return obj && DataView.prototype.isPrototypeOf(obj)
2548
+ }
2549
+
2550
+ if (support.arrayBuffer) {
2551
+ var viewClasses = [
2552
+ '[object Int8Array]',
2553
+ '[object Uint8Array]',
2554
+ '[object Uint8ClampedArray]',
2555
+ '[object Int16Array]',
2556
+ '[object Uint16Array]',
2557
+ '[object Int32Array]',
2558
+ '[object Uint32Array]',
2559
+ '[object Float32Array]',
2560
+ '[object Float64Array]'
2561
+ ];
2562
+
2563
+ var isArrayBufferView =
2564
+ ArrayBuffer.isView ||
2565
+ function(obj) {
2566
+ return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1
2567
+ };
2568
+ }
2569
+
2570
+ function normalizeName(name) {
2571
+ if (typeof name !== 'string') {
2572
+ name = String(name);
2573
+ }
2574
+ if (/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(name) || name === '') {
2575
+ throw new TypeError('Invalid character in header field name: "' + name + '"')
2576
+ }
2577
+ return name.toLowerCase()
2578
+ }
2579
+
2580
+ function normalizeValue(value) {
2581
+ if (typeof value !== 'string') {
2582
+ value = String(value);
2583
+ }
2584
+ return value
2585
+ }
2586
+
2587
+ // Build a destructive iterator for the value list
2588
+ function iteratorFor(items) {
2589
+ var iterator = {
2590
+ next: function() {
2591
+ var value = items.shift();
2592
+ return {done: value === undefined, value: value}
2593
+ }
2594
+ };
2595
+
2596
+ if (support.iterable) {
2597
+ iterator[Symbol.iterator] = function() {
2598
+ return iterator
2599
+ };
2600
+ }
2601
+
2602
+ return iterator
2603
+ }
2604
+
2605
+ function Headers(headers) {
2606
+ this.map = {};
2607
+
2608
+ if (headers instanceof Headers) {
2609
+ headers.forEach(function(value, name) {
2610
+ this.append(name, value);
2611
+ }, this);
2612
+ } else if (Array.isArray(headers)) {
2613
+ headers.forEach(function(header) {
2614
+ if (header.length != 2) {
2615
+ throw new TypeError('Headers constructor: expected name/value pair to be length 2, found' + header.length)
2616
+ }
2617
+ this.append(header[0], header[1]);
2618
+ }, this);
2619
+ } else if (headers) {
2620
+ Object.getOwnPropertyNames(headers).forEach(function(name) {
2621
+ this.append(name, headers[name]);
2622
+ }, this);
2623
+ }
2624
+ }
2625
+
2626
+ Headers.prototype.append = function(name, value) {
2627
+ name = normalizeName(name);
2628
+ value = normalizeValue(value);
2629
+ var oldValue = this.map[name];
2630
+ this.map[name] = oldValue ? oldValue + ', ' + value : value;
2631
+ };
2632
+
2633
+ Headers.prototype['delete'] = function(name) {
2634
+ delete this.map[normalizeName(name)];
2635
+ };
2636
+
2637
+ Headers.prototype.get = function(name) {
2638
+ name = normalizeName(name);
2639
+ return this.has(name) ? this.map[name] : null
2640
+ };
2641
+
2642
+ Headers.prototype.has = function(name) {
2643
+ return this.map.hasOwnProperty(normalizeName(name))
2644
+ };
2645
+
2646
+ Headers.prototype.set = function(name, value) {
2647
+ this.map[normalizeName(name)] = normalizeValue(value);
2648
+ };
2649
+
2650
+ Headers.prototype.forEach = function(callback, thisArg) {
2651
+ for (var name in this.map) {
2652
+ if (this.map.hasOwnProperty(name)) {
2653
+ callback.call(thisArg, this.map[name], name, this);
2654
+ }
2655
+ }
2656
+ };
2657
+
2658
+ Headers.prototype.keys = function() {
2659
+ var items = [];
2660
+ this.forEach(function(value, name) {
2661
+ items.push(name);
2662
+ });
2663
+ return iteratorFor(items)
2664
+ };
2665
+
2666
+ Headers.prototype.values = function() {
2667
+ var items = [];
2668
+ this.forEach(function(value) {
2669
+ items.push(value);
2670
+ });
2671
+ return iteratorFor(items)
2672
+ };
2673
+
2674
+ Headers.prototype.entries = function() {
2675
+ var items = [];
2676
+ this.forEach(function(value, name) {
2677
+ items.push([name, value]);
2678
+ });
2679
+ return iteratorFor(items)
2680
+ };
2681
+
2682
+ if (support.iterable) {
2683
+ Headers.prototype[Symbol.iterator] = Headers.prototype.entries;
2684
+ }
2685
+
2686
+ function consumed(body) {
2687
+ if (body._noBody) return
2688
+ if (body.bodyUsed) {
2689
+ return Promise.reject(new TypeError('Already read'))
2690
+ }
2691
+ body.bodyUsed = true;
2692
+ }
2693
+
2694
+ function fileReaderReady(reader) {
2695
+ return new Promise(function(resolve, reject) {
2696
+ reader.onload = function() {
2697
+ resolve(reader.result);
2698
+ };
2699
+ reader.onerror = function() {
2700
+ reject(reader.error);
2701
+ };
2702
+ })
2703
+ }
2704
+
2705
+ function readBlobAsArrayBuffer(blob) {
2706
+ var reader = new FileReader();
2707
+ var promise = fileReaderReady(reader);
2708
+ reader.readAsArrayBuffer(blob);
2709
+ return promise
2710
+ }
2711
+
2712
+ function readBlobAsText(blob) {
2713
+ var reader = new FileReader();
2714
+ var promise = fileReaderReady(reader);
2715
+ var match = /charset=([A-Za-z0-9_-]+)/.exec(blob.type);
2716
+ var encoding = match ? match[1] : 'utf-8';
2717
+ reader.readAsText(blob, encoding);
2718
+ return promise
2719
+ }
2720
+
2721
+ function readArrayBufferAsText(buf) {
2722
+ var view = new Uint8Array(buf);
2723
+ var chars = new Array(view.length);
2724
+
2725
+ for (var i = 0; i < view.length; i++) {
2726
+ chars[i] = String.fromCharCode(view[i]);
2727
+ }
2728
+ return chars.join('')
2729
+ }
2730
+
2731
+ function bufferClone(buf) {
2732
+ if (buf.slice) {
2733
+ return buf.slice(0)
2734
+ } else {
2735
+ var view = new Uint8Array(buf.byteLength);
2736
+ view.set(new Uint8Array(buf));
2737
+ return view.buffer
2738
+ }
2739
+ }
2740
+
2741
+ function Body() {
2742
+ this.bodyUsed = false;
2743
+
2744
+ this._initBody = function(body) {
2745
+ /*
2746
+ fetch-mock wraps the Response object in an ES6 Proxy to
2747
+ provide useful test harness features such as flush. However, on
2748
+ ES5 browsers without fetch or Proxy support pollyfills must be used;
2749
+ the proxy-pollyfill is unable to proxy an attribute unless it exists
2750
+ on the object before the Proxy is created. This change ensures
2751
+ Response.bodyUsed exists on the instance, while maintaining the
2752
+ semantic of setting Request.bodyUsed in the constructor before
2753
+ _initBody is called.
2754
+ */
2755
+ // eslint-disable-next-line no-self-assign
2756
+ this.bodyUsed = this.bodyUsed;
2757
+ this._bodyInit = body;
2758
+ if (!body) {
2759
+ this._noBody = true;
2760
+ this._bodyText = '';
2761
+ } else if (typeof body === 'string') {
2762
+ this._bodyText = body;
2763
+ } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
2764
+ this._bodyBlob = body;
2765
+ } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
2766
+ this._bodyFormData = body;
2767
+ } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
2768
+ this._bodyText = body.toString();
2769
+ } else if (support.arrayBuffer && support.blob && isDataView(body)) {
2770
+ this._bodyArrayBuffer = bufferClone(body.buffer);
2771
+ // IE 10-11 can't handle a DataView body.
2772
+ this._bodyInit = new Blob([this._bodyArrayBuffer]);
2773
+ } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {
2774
+ this._bodyArrayBuffer = bufferClone(body);
2775
+ } else {
2776
+ this._bodyText = body = Object.prototype.toString.call(body);
2777
+ }
2778
+
2779
+ if (!this.headers.get('content-type')) {
2780
+ if (typeof body === 'string') {
2781
+ this.headers.set('content-type', 'text/plain;charset=UTF-8');
2782
+ } else if (this._bodyBlob && this._bodyBlob.type) {
2783
+ this.headers.set('content-type', this._bodyBlob.type);
2784
+ } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
2785
+ this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');
2786
+ }
2787
+ }
2788
+ };
2789
+
2790
+ if (support.blob) {
2791
+ this.blob = function() {
2792
+ var rejected = consumed(this);
2793
+ if (rejected) {
2794
+ return rejected
2795
+ }
2796
+
2797
+ if (this._bodyBlob) {
2798
+ return Promise.resolve(this._bodyBlob)
2799
+ } else if (this._bodyArrayBuffer) {
2800
+ return Promise.resolve(new Blob([this._bodyArrayBuffer]))
2801
+ } else if (this._bodyFormData) {
2802
+ throw new Error('could not read FormData body as blob')
2803
+ } else {
2804
+ return Promise.resolve(new Blob([this._bodyText]))
2805
+ }
2806
+ };
2807
+ }
2808
+
2809
+ this.arrayBuffer = function() {
2810
+ if (this._bodyArrayBuffer) {
2811
+ var isConsumed = consumed(this);
2812
+ if (isConsumed) {
2813
+ return isConsumed
2814
+ } else if (ArrayBuffer.isView(this._bodyArrayBuffer)) {
2815
+ return Promise.resolve(
2816
+ this._bodyArrayBuffer.buffer.slice(
2817
+ this._bodyArrayBuffer.byteOffset,
2818
+ this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength
2819
+ )
2820
+ )
2821
+ } else {
2822
+ return Promise.resolve(this._bodyArrayBuffer)
2823
+ }
2824
+ } else if (support.blob) {
2825
+ return this.blob().then(readBlobAsArrayBuffer)
2826
+ } else {
2827
+ throw new Error('could not read as ArrayBuffer')
2828
+ }
2829
+ };
2830
+
2831
+ this.text = function() {
2832
+ var rejected = consumed(this);
2833
+ if (rejected) {
2834
+ return rejected
2835
+ }
2836
+
2837
+ if (this._bodyBlob) {
2838
+ return readBlobAsText(this._bodyBlob)
2839
+ } else if (this._bodyArrayBuffer) {
2840
+ return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))
2841
+ } else if (this._bodyFormData) {
2842
+ throw new Error('could not read FormData body as text')
2843
+ } else {
2844
+ return Promise.resolve(this._bodyText)
2845
+ }
2846
+ };
2847
+
2848
+ if (support.formData) {
2849
+ this.formData = function() {
2850
+ return this.text().then(decode)
2851
+ };
2852
+ }
2853
+
2854
+ this.json = function() {
2855
+ return this.text().then(JSON.parse)
2856
+ };
2857
+
2858
+ return this
2859
+ }
2860
+
2861
+ // HTTP methods whose capitalization should be normalized
2862
+ var methods = ['CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'];
2863
+
2864
+ function normalizeMethod(method) {
2865
+ var upcased = method.toUpperCase();
2866
+ return methods.indexOf(upcased) > -1 ? upcased : method
2867
+ }
2868
+
2869
+ function Request(input, options) {
2870
+ if (!(this instanceof Request)) {
2871
+ throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.')
2872
+ }
2873
+
2874
+ options = options || {};
2875
+ var body = options.body;
2876
+
2877
+ if (input instanceof Request) {
2878
+ if (input.bodyUsed) {
2879
+ throw new TypeError('Already read')
2880
+ }
2881
+ this.url = input.url;
2882
+ this.credentials = input.credentials;
2883
+ if (!options.headers) {
2884
+ this.headers = new Headers(input.headers);
2885
+ }
2886
+ this.method = input.method;
2887
+ this.mode = input.mode;
2888
+ this.signal = input.signal;
2889
+ if (!body && input._bodyInit != null) {
2890
+ body = input._bodyInit;
2891
+ input.bodyUsed = true;
2892
+ }
2893
+ } else {
2894
+ this.url = String(input);
2895
+ }
2896
+
2897
+ this.credentials = options.credentials || this.credentials || 'same-origin';
2898
+ if (options.headers || !this.headers) {
2899
+ this.headers = new Headers(options.headers);
2900
+ }
2901
+ this.method = normalizeMethod(options.method || this.method || 'GET');
2902
+ this.mode = options.mode || this.mode || null;
2903
+ this.signal = options.signal || this.signal || (function () {
2904
+ if ('AbortController' in g) {
2905
+ var ctrl = new AbortController();
2906
+ return ctrl.signal;
2907
+ }
2908
+ }());
2909
+ this.referrer = null;
2910
+
2911
+ if ((this.method === 'GET' || this.method === 'HEAD') && body) {
2912
+ throw new TypeError('Body not allowed for GET or HEAD requests')
2913
+ }
2914
+ this._initBody(body);
2915
+
2916
+ if (this.method === 'GET' || this.method === 'HEAD') {
2917
+ if (options.cache === 'no-store' || options.cache === 'no-cache') {
2918
+ // Search for a '_' parameter in the query string
2919
+ var reParamSearch = /([?&])_=[^&]*/;
2920
+ if (reParamSearch.test(this.url)) {
2921
+ // If it already exists then set the value with the current time
2922
+ this.url = this.url.replace(reParamSearch, '$1_=' + new Date().getTime());
2923
+ } else {
2924
+ // Otherwise add a new '_' parameter to the end with the current time
2925
+ var reQueryString = /\?/;
2926
+ this.url += (reQueryString.test(this.url) ? '&' : '?') + '_=' + new Date().getTime();
2927
+ }
2928
+ }
2929
+ }
2930
+ }
2931
+
2932
+ Request.prototype.clone = function() {
2933
+ return new Request(this, {body: this._bodyInit})
2934
+ };
2935
+
2936
+ function decode(body) {
2937
+ var form = new FormData();
2938
+ body
2939
+ .trim()
2940
+ .split('&')
2941
+ .forEach(function(bytes) {
2942
+ if (bytes) {
2943
+ var split = bytes.split('=');
2944
+ var name = split.shift().replace(/\+/g, ' ');
2945
+ var value = split.join('=').replace(/\+/g, ' ');
2946
+ form.append(decodeURIComponent(name), decodeURIComponent(value));
2947
+ }
2948
+ });
2949
+ return form
2950
+ }
2951
+
2952
+ function parseHeaders(rawHeaders) {
2953
+ var headers = new Headers();
2954
+ // Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space
2955
+ // https://tools.ietf.org/html/rfc7230#section-3.2
2956
+ var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, ' ');
2957
+ // Avoiding split via regex to work around a common IE11 bug with the core-js 3.6.0 regex polyfill
2958
+ // https://github.com/github/fetch/issues/748
2959
+ // https://github.com/zloirock/core-js/issues/751
2960
+ preProcessedHeaders
2961
+ .split('\r')
2962
+ .map(function(header) {
2963
+ return header.indexOf('\n') === 0 ? header.substr(1, header.length) : header
2964
+ })
2965
+ .forEach(function(line) {
2966
+ var parts = line.split(':');
2967
+ var key = parts.shift().trim();
2968
+ if (key) {
2969
+ var value = parts.join(':').trim();
2970
+ try {
2971
+ headers.append(key, value);
2972
+ } catch (error) {
2973
+ }
2974
+ }
2975
+ });
2976
+ return headers
2977
+ }
2978
+
2979
+ Body.call(Request.prototype);
2980
+
2981
+ function Response(bodyInit, options) {
2982
+ if (!(this instanceof Response)) {
2983
+ throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.')
2984
+ }
2985
+ if (!options) {
2986
+ options = {};
2987
+ }
2988
+
2989
+ this.type = 'default';
2990
+ this.status = options.status === undefined ? 200 : options.status;
2991
+ if (this.status < 200 || this.status > 599) {
2992
+ throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].")
2993
+ }
2994
+ this.ok = this.status >= 200 && this.status < 300;
2995
+ this.statusText = options.statusText === undefined ? '' : '' + options.statusText;
2996
+ this.headers = new Headers(options.headers);
2997
+ this.url = options.url || '';
2998
+ this._initBody(bodyInit);
2999
+ }
3000
+
3001
+ Body.call(Response.prototype);
3002
+
3003
+ Response.prototype.clone = function() {
3004
+ return new Response(this._bodyInit, {
3005
+ status: this.status,
3006
+ statusText: this.statusText,
3007
+ headers: new Headers(this.headers),
3008
+ url: this.url
3009
+ })
3010
+ };
3011
+
3012
+ Response.error = function() {
3013
+ var response = new Response(null, {status: 200, statusText: ''});
3014
+ response.ok = false;
3015
+ response.status = 0;
3016
+ response.type = 'error';
3017
+ return response
3018
+ };
3019
+
3020
+ var redirectStatuses = [301, 302, 303, 307, 308];
3021
+
3022
+ Response.redirect = function(url, status) {
3023
+ if (redirectStatuses.indexOf(status) === -1) {
3024
+ throw new RangeError('Invalid status code')
3025
+ }
3026
+
3027
+ return new Response(null, {status: status, headers: {location: url}})
3028
+ };
3029
+
3030
+ var DOMException = g.DOMException;
3031
+ try {
3032
+ new DOMException();
3033
+ } catch (err) {
3034
+ DOMException = function(message, name) {
3035
+ this.message = message;
3036
+ this.name = name;
3037
+ var error = Error(message);
3038
+ this.stack = error.stack;
3039
+ };
3040
+ DOMException.prototype = Object.create(Error.prototype);
3041
+ DOMException.prototype.constructor = DOMException;
3042
+ }
3043
+
3044
+ function fetch$1(input, init) {
3045
+ return new Promise(function(resolve, reject) {
3046
+ var request = new Request(input, init);
3047
+
3048
+ if (request.signal && request.signal.aborted) {
3049
+ return reject(new DOMException('Aborted', 'AbortError'))
3050
+ }
3051
+
3052
+ var xhr = new XMLHttpRequest();
3053
+
3054
+ function abortXhr() {
3055
+ xhr.abort();
3056
+ }
3057
+
3058
+ xhr.onload = function() {
3059
+ var options = {
3060
+ statusText: xhr.statusText,
3061
+ headers: parseHeaders(xhr.getAllResponseHeaders() || '')
3062
+ };
3063
+ // This check if specifically for when a user fetches a file locally from the file system
3064
+ // Only if the status is out of a normal range
3065
+ if (request.url.indexOf('file://') === 0 && (xhr.status < 200 || xhr.status > 599)) {
3066
+ options.status = 200;
3067
+ } else {
3068
+ options.status = xhr.status;
3069
+ }
3070
+ options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');
3071
+ var body = 'response' in xhr ? xhr.response : xhr.responseText;
3072
+ setTimeout(function() {
3073
+ resolve(new Response(body, options));
3074
+ }, 0);
3075
+ };
3076
+
3077
+ xhr.onerror = function() {
3078
+ setTimeout(function() {
3079
+ reject(new TypeError('Network request failed'));
3080
+ }, 0);
3081
+ };
3082
+
3083
+ xhr.ontimeout = function() {
3084
+ setTimeout(function() {
3085
+ reject(new TypeError('Network request timed out'));
3086
+ }, 0);
3087
+ };
3088
+
3089
+ xhr.onabort = function() {
3090
+ setTimeout(function() {
3091
+ reject(new DOMException('Aborted', 'AbortError'));
3092
+ }, 0);
3093
+ };
3094
+
3095
+ function fixUrl(url) {
3096
+ try {
3097
+ return url === '' && g.location.href ? g.location.href : url
3098
+ } catch (e) {
3099
+ return url
3100
+ }
3101
+ }
3102
+
3103
+ xhr.open(request.method, fixUrl(request.url), true);
3104
+
3105
+ if (request.credentials === 'include') {
3106
+ xhr.withCredentials = true;
3107
+ } else if (request.credentials === 'omit') {
3108
+ xhr.withCredentials = false;
3109
+ }
3110
+
3111
+ if ('responseType' in xhr) {
3112
+ if (support.blob) {
3113
+ xhr.responseType = 'blob';
3114
+ } else if (
3115
+ support.arrayBuffer
3116
+ ) {
3117
+ xhr.responseType = 'arraybuffer';
3118
+ }
3119
+ }
3120
+
3121
+ if (init && typeof init.headers === 'object' && !(init.headers instanceof Headers || (g.Headers && init.headers instanceof g.Headers))) {
3122
+ var names = [];
3123
+ Object.getOwnPropertyNames(init.headers).forEach(function(name) {
3124
+ names.push(normalizeName(name));
3125
+ xhr.setRequestHeader(name, normalizeValue(init.headers[name]));
3126
+ });
3127
+ request.headers.forEach(function(value, name) {
3128
+ if (names.indexOf(name) === -1) {
3129
+ xhr.setRequestHeader(name, value);
3130
+ }
3131
+ });
3132
+ } else {
3133
+ request.headers.forEach(function(value, name) {
3134
+ xhr.setRequestHeader(name, value);
3135
+ });
3136
+ }
3137
+
3138
+ if (request.signal) {
3139
+ request.signal.addEventListener('abort', abortXhr);
3140
+
3141
+ xhr.onreadystatechange = function() {
3142
+ // DONE (success or failure)
3143
+ if (xhr.readyState === 4) {
3144
+ request.signal.removeEventListener('abort', abortXhr);
3145
+ }
3146
+ };
3147
+ }
3148
+
3149
+ xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);
3150
+ })
3151
+ }
3152
+
3153
+ fetch$1.polyfill = true;
3154
+
3155
+ if (!g.fetch) {
3156
+ g.fetch = fetch$1;
3157
+ g.Headers = Headers;
3158
+ g.Request = Request;
3159
+ g.Response = Response;
3160
+ }
3161
+
3162
+ function styleInject(css, ref) {
3163
+ if ( ref === void 0 ) ref = {};
3164
+ var insertAt = ref.insertAt;
3165
+
3166
+ if (typeof document === 'undefined') { return; }
3167
+
3168
+ var head = document.head || document.getElementsByTagName('head')[0];
3169
+ var style = document.createElement('style');
3170
+ style.type = 'text/css';
3171
+
3172
+ if (insertAt === 'top') {
3173
+ if (head.firstChild) {
3174
+ head.insertBefore(style, head.firstChild);
3175
+ } else {
3176
+ head.appendChild(style);
3177
+ }
3178
+ } else {
3179
+ head.appendChild(style);
3180
+ }
3181
+
3182
+ if (style.styleSheet) {
3183
+ style.styleSheet.cssText = css;
3184
+ } else {
3185
+ style.appendChild(document.createTextNode(css));
3186
+ }
3187
+ }
3188
+
3189
+ var css_248z = "@keyframes watermark{0%{background-position:0 0}25%{background-position:100% 100%}50%{background-position:0 0}75%{background-position:100% -100%}to{background-position:0 0}}";
3190
+ styleInject(css_248z);
3191
+
3192
+ /******************************************************************************
3193
+ Copyright (c) Microsoft Corporation.
3194
+
3195
+ Permission to use, copy, modify, and/or distribute this software for any
3196
+ purpose with or without fee is hereby granted.
3197
+
3198
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
3199
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
3200
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
3201
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
3202
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
3203
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
3204
+ PERFORMANCE OF THIS SOFTWARE.
3205
+ ***************************************************************************** */
3206
+ /* global Reflect, Promise */
3207
+
3208
+ var extendStatics = function(d, b) {
3209
+ extendStatics = Object.setPrototypeOf ||
3210
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
3211
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
3212
+ return extendStatics(d, b);
3213
+ };
3214
+
3215
+ function __extends(d, b) {
3216
+ if (typeof b !== "function" && b !== null)
3217
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
3218
+ extendStatics(d, b);
3219
+ function __() { this.constructor = d; }
3220
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
3221
+ }
3222
+
3223
+ var __assign = function() {
3224
+ __assign = Object.assign || function __assign(t) {
3225
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
3226
+ s = arguments[i];
3227
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
3228
+ }
3229
+ return t;
3230
+ };
3231
+ return __assign.apply(this, arguments);
3232
+ };
3233
+
3234
+ function __awaiter(thisArg, _arguments, P, generator) {
3235
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3236
+ return new (P || (P = Promise))(function (resolve, reject) {
3237
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
3238
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
3239
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
3240
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
3241
+ });
3242
+ }
3243
+
3244
+ function __generator(thisArg, body) {
3245
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
3246
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
3247
+ function verb(n) { return function (v) { return step([n, v]); }; }
3248
+ function step(op) {
3249
+ if (f) throw new TypeError("Generator is already executing.");
3250
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
3251
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
3252
+ if (y = 0, t) op = [op[0] & 2, t.value];
3253
+ switch (op[0]) {
3254
+ case 0: case 1: t = op; break;
3255
+ case 4: _.label++; return { value: op[1], done: false };
3256
+ case 5: _.label++; y = op[1]; op = [0]; continue;
3257
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
3258
+ default:
3259
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
3260
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
3261
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
3262
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
3263
+ if (t[2]) _.ops.pop();
3264
+ _.trys.pop(); continue;
3265
+ }
3266
+ op = body.call(thisArg, _);
3267
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
3268
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
3269
+ }
3270
+ }
3271
+
3272
+ var convertImage = function (canvas) {
3273
+ return canvas.toDataURL('image/png', 1);
3274
+ };
3275
+ var isFunction = function (value) {
3276
+ return typeof value === 'function';
3277
+ };
3278
+ var isUndefined = function (value) {
3279
+ return value === undefined;
3280
+ };
3281
+ var isString = function (value) {
3282
+ return typeof value === 'string';
3283
+ };
3284
+ var createSVGElement = function (tagName, attrs, namespaceURI) {
3285
+ if (attrs === void 0) { attrs = {}; }
3286
+ if (namespaceURI === void 0) { namespaceURI = 'http://www.w3.org/2000/svg'; }
3287
+ var element = document.createElementNS(namespaceURI, tagName);
3288
+ for (var attr in attrs) {
3289
+ element.setAttribute(attr, attrs[attr]);
3290
+ }
3291
+ return element;
3292
+ };
3293
+ var getMultiLineData = function (ctx, text, maxWidth) {
3294
+ var result = [];
3295
+ var str = '';
3296
+ for (var i = 0, len = text.length; i < len; i++) {
3297
+ str += text.charAt(i);
3298
+ if (ctx.measureText(str).width > maxWidth) {
3299
+ result.push(str.substring(0, str.length - 1));
3300
+ str = '';
3301
+ i--;
3302
+ }
3303
+ }
3304
+ result.push(str);
3305
+ return result;
3306
+ };
3307
+ var createCustomContentSVG = function (ctx, options) { return __awaiter(void 0, void 0, void 0, function () {
3308
+ var svgElement, bodyElement, rect, rectWidth, rectHeight, width, height, foreignObjectElement;
3309
+ var _a;
3310
+ return __generator(this, function (_b) {
3311
+ switch (_b.label) {
3312
+ case 0:
3313
+ svgElement = createSVGElement('svg', {
3314
+ xmlns: 'http://www.w3.org/2000/svg'
3315
+ });
3316
+ bodyElement = document.createElement('div');
3317
+ bodyElement.setAttribute('xmlns', 'http://www.w3.org/1999/xhtml');
3318
+ bodyElement.style.cssText = "\n text-align: center;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: 100%;\n font: ".concat(ctx.font, ";\n color: ").concat(options.fontColor, ";\n");
3319
+ bodyElement.innerHTML = "<div class='rich-text-content'>".concat(options.content, "</div>");
3320
+ document.body.appendChild(bodyElement);
3321
+ // convert all images to base64
3322
+ return [4 /*yield*/, convertImgToBase64(bodyElement)];
3323
+ case 1:
3324
+ // convert all images to base64
3325
+ _b.sent();
3326
+ rect = (_a = bodyElement.querySelector('.rich-text-content')) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
3327
+ rectWidth = rect === null || rect === void 0 ? void 0 : rect.width;
3328
+ rectHeight = rect === null || rect === void 0 ? void 0 : rect.height;
3329
+ document.body.removeChild(bodyElement);
3330
+ width = options.richTextWidth || rectWidth || options.width;
3331
+ height = options.richTextHeight || rectHeight || options.height;
3332
+ svgElement.setAttribute('width', width.toString());
3333
+ svgElement.setAttribute('height', height.toString());
3334
+ foreignObjectElement = createSVGElement('foreignObject', {
3335
+ width: width.toString(),
3336
+ height: height.toString()
3337
+ });
3338
+ foreignObjectElement.appendChild(bodyElement);
3339
+ svgElement.appendChild(foreignObjectElement);
3340
+ return [2 /*return*/, {
3341
+ element: svgElement,
3342
+ width: width,
3343
+ height: height
3344
+ }];
3345
+ }
3346
+ });
3347
+ }); };
3348
+ function convertImgToBase64(bodyElement) {
3349
+ return __awaiter(this, void 0, void 0, function () {
3350
+ var imgElements, _loop_1, _i, _a, img;
3351
+ return __generator(this, function (_b) {
3352
+ switch (_b.label) {
3353
+ case 0:
3354
+ imgElements = bodyElement.querySelectorAll('img');
3355
+ _loop_1 = function (img) {
3356
+ var src, response, blob_1, imgData, error_1;
3357
+ return __generator(this, function (_c) {
3358
+ switch (_c.label) {
3359
+ case 0:
3360
+ src = img.getAttribute('src');
3361
+ if (!src) return [3 /*break*/, 6];
3362
+ _c.label = 1;
3363
+ case 1:
3364
+ _c.trys.push([1, 5, , 6]);
3365
+ return [4 /*yield*/, fetch(src)];
3366
+ case 2:
3367
+ response = _c.sent();
3368
+ return [4 /*yield*/, response.blob()];
3369
+ case 3:
3370
+ blob_1 = _c.sent();
3371
+ return [4 /*yield*/, new Promise(function (resolve, reject) {
3372
+ var reader = new FileReader();
3373
+ reader.onloadend = function () { return resolve(reader.result); };
3374
+ reader.onerror = reject;
3375
+ reader.readAsDataURL(blob_1);
3376
+ })];
3377
+ case 4:
3378
+ imgData = _c.sent();
3379
+ if (isString(imgData)) {
3380
+ img.setAttribute('src', imgData);
3381
+ }
3382
+ return [3 /*break*/, 6];
3383
+ case 5:
3384
+ error_1 = _c.sent();
3385
+ console.error("Error converting ".concat(src, " to base64:"), error_1);
3386
+ return [3 /*break*/, 6];
3387
+ case 6: return [2 /*return*/];
3388
+ }
3389
+ });
3390
+ };
3391
+ _i = 0, _a = Array.from(imgElements);
3392
+ _b.label = 1;
3393
+ case 1:
3394
+ if (!(_i < _a.length)) return [3 /*break*/, 4];
3395
+ img = _a[_i];
3396
+ return [5 /*yield**/, _loop_1(img)];
3397
+ case 2:
3398
+ _b.sent();
3399
+ _b.label = 3;
3400
+ case 3:
3401
+ _i++;
3402
+ return [3 /*break*/, 1];
3403
+ case 4: return [2 /*return*/];
3404
+ }
3405
+ });
3406
+ });
3407
+ }
3408
+ var convertSVGToImage = function (svg) {
3409
+ var richContent = svg.outerHTML.replace(/<img(.*?)>/g, '<img$1/>').replace(/\n/g, '').replace(/\t/g, '').replace(/#/g, '%23');
3410
+ return "data:image/svg+xml;charset=utf-8,".concat(richContent);
3411
+ };
3412
+ var getValue = function (v1, v2) {
3413
+ if (isUndefined(v1)) {
3414
+ return v2;
3415
+ }
3416
+ else {
3417
+ return v1;
3418
+ }
3419
+ };
3420
+ var loadImage = function (url, width, height) {
3421
+ if (width === void 0) { width = undefined; }
3422
+ if (height === void 0) { height = undefined; }
3423
+ var image = new Image();
3424
+ image.setAttribute('crossOrigin', 'Anonymous');
3425
+ !isUndefined(width) && (image.width = width);
3426
+ !isUndefined(height) && (image.height = height);
3427
+ image.src = url;
3428
+ return new Promise(function (resolve) {
3429
+ image.onload = function () {
3430
+ resolve(image);
3431
+ };
3432
+ });
3433
+ };
3434
+ var generateMatrix = function (rows, columns, value) {
3435
+ return Array.from({ length: rows }, function () { return new Array(columns).fill(value); });
3436
+ };
3437
+
3438
+ var initialOptions = {
3439
+ width: 300,
3440
+ height: 300,
3441
+ rotate: 45,
3442
+ layout: 'default',
3443
+ auxiliaryLine: false,
3444
+ translatePlacement: 'middle',
3445
+ contentType: 'text',
3446
+ content: 'hello watermark-js-plus',
3447
+ textType: 'fill',
3448
+ imageWidth: 0,
3449
+ imageHeight: 0,
3450
+ lineHeight: 30,
3451
+ zIndex: 2147483647,
3452
+ backgroundPosition: '0 0',
3453
+ backgroundRepeat: 'repeat',
3454
+ fontSize: '20px',
3455
+ fontFamily: 'sans-serif',
3456
+ fontStyle: '',
3457
+ fontVariant: '',
3458
+ fontColor: '#000',
3459
+ fontWeight: 'normal',
3460
+ filter: 'none',
3461
+ letterSpacing: '0px',
3462
+ wordSpacing: '0px',
3463
+ globalAlpha: 0.5,
3464
+ mode: 'default',
3465
+ mutationObserve: true,
3466
+ movable: false,
3467
+ parent: 'body',
3468
+ onSuccess: function () { },
3469
+ onBeforeDestroy: function () { },
3470
+ onDestroyed: function () { },
3471
+ onObserveError: function () { }
3472
+ };
3473
+ var generateRecommendOptions = function (canvas, options, args) {
3474
+ var ctx = canvas.getContext('2d');
3475
+ if (ctx === null) {
3476
+ throw new Error('get context error');
3477
+ }
3478
+ ctx.font = "".concat(options.fontStyle, " ").concat(options.fontVariant, " ").concat(options.fontWeight, " ").concat(options.fontSize, " ").concat(options.fontFamily);
3479
+ ctx.filter = options.filter;
3480
+ // @ts-ignore
3481
+ ctx.letterSpacing = options.letterSpacing;
3482
+ ctx.wordSpacing = options.wordSpacing;
3483
+ if (options === null || options === void 0 ? void 0 : options.rotate) {
3484
+ options.rotate = (360 - options.rotate % 360) * (Math.PI / 180);
3485
+ }
3486
+ if (isUndefined(args.textRowMaxWidth)) {
3487
+ options.textRowMaxWidth = options.width;
3488
+ }
3489
+ var result = {
3490
+ image: {
3491
+ rect: {
3492
+ width: options.imageWidth,
3493
+ height: options.imageHeight
3494
+ },
3495
+ position: {
3496
+ x: 0,
3497
+ y: 0
3498
+ }
3499
+ },
3500
+ textLine: {
3501
+ data: [],
3502
+ yOffsetValue: 0
3503
+ },
3504
+ advancedStyleParams: {
3505
+ linear: {
3506
+ x0: 0,
3507
+ x1: 0
3508
+ },
3509
+ radial: {
3510
+ x0: 0,
3511
+ y0: 0,
3512
+ r0: 0,
3513
+ x1: 0,
3514
+ y1: 0,
3515
+ r1: 0
3516
+ },
3517
+ conic: {
3518
+ x: 0,
3519
+ y: 0,
3520
+ startAngle: 0
3521
+ },
3522
+ pattern: {}
3523
+ }
3524
+ };
3525
+ switch (options.contentType) {
3526
+ case 'text':
3527
+ result.textLine.data = [options.content];
3528
+ break;
3529
+ case 'multi-line-text':
3530
+ result.textLine.data = getMultiLineData(ctx, options.content, options.textRowMaxWidth);
3531
+ break;
3532
+ // case 'image':
3533
+ // break
3534
+ // case 'rich-text':
3535
+ // break
3536
+ }
3537
+ var translateX = options.width / 2;
3538
+ var translateY = options.height / 2;
3539
+ var textBaseline = 'middle';
3540
+ var textAlign = 'center';
3541
+ if (!isUndefined(args === null || args === void 0 ? void 0 : args.translateX) && !isUndefined(args === null || args === void 0 ? void 0 : args.translateY)) {
3542
+ translateX = args === null || args === void 0 ? void 0 : args.translateX;
3543
+ translateY = args === null || args === void 0 ? void 0 : args.translateY;
3544
+ textBaseline = 'top';
3545
+ textAlign = 'left';
3546
+ }
3547
+ else {
3548
+ // default middle
3549
+ // translateX = options.width / 2
3550
+ // translateY = options.height / 2
3551
+ // TextBaselineType = 'middle'
3552
+ // textAlign = 'center'
3553
+ result.advancedStyleParams.linear.x0 = -options.width / 2;
3554
+ result.advancedStyleParams.linear.x1 = options.width / 2;
3555
+ // result.advancedStyleParams.radial.x0 = 0
3556
+ // result.advancedStyleParams.radial.y0 = 0
3557
+ result.advancedStyleParams.radial.r0 = 0;
3558
+ // result.advancedStyleParams.radial.x1 = 0
3559
+ // result.advancedStyleParams.radial.y1 = 0
3560
+ result.advancedStyleParams.radial.r1 = options.width / 2;
3561
+ // result.advancedStyleParams.conic.x = 0
3562
+ // result.advancedStyleParams.conic.y = 0
3563
+ }
3564
+ switch (args.translatePlacement) {
3565
+ case 'top':
3566
+ translateX = options.width / 2;
3567
+ translateY = 0;
3568
+ textBaseline = 'top';
3569
+ // textAlign = 'center'
3570
+ result.advancedStyleParams.linear.x0 = -options.width / 2;
3571
+ result.advancedStyleParams.linear.x1 = options.width / 2;
3572
+ // result.advancedStyleParams.radial.x0 = 0
3573
+ result.advancedStyleParams.radial.y0 = result.textLine.data.length * options.lineHeight / 2;
3574
+ // result.advancedStyleParams.radial.r0 = 0
3575
+ // result.advancedStyleParams.radial.x1 = 0
3576
+ // result.advancedStyleParams.radial.y1 = 0
3577
+ result.advancedStyleParams.radial.y1 = result.textLine.data.length * options.lineHeight / 2;
3578
+ // result.advancedStyleParams.radial.r1 = options.width / 2
3579
+ // result.advancedStyleParams.conic.x = 0
3580
+ result.advancedStyleParams.conic.y = result.textLine.data.length * options.lineHeight / 2;
3581
+ break;
3582
+ case 'top-start':
3583
+ translateX = 0;
3584
+ translateY = 0;
3585
+ textBaseline = 'top';
3586
+ textAlign = 'start';
3587
+ result.advancedStyleParams.linear.x0 = 0;
3588
+ result.advancedStyleParams.linear.x1 = options.width;
3589
+ result.advancedStyleParams.radial.x0 = options.width / 2;
3590
+ result.advancedStyleParams.radial.y0 = result.textLine.data.length * options.lineHeight / 2;
3591
+ // result.advancedStyleParams.radial.r0 = 0
3592
+ result.advancedStyleParams.radial.x1 = options.width / 2;
3593
+ result.advancedStyleParams.radial.y1 = result.textLine.data.length * options.lineHeight / 2;
3594
+ // result.advancedStyleParams.radial.r1 = options.width / 2
3595
+ result.advancedStyleParams.conic.x = options.width / 2;
3596
+ result.advancedStyleParams.conic.y = result.textLine.data.length * options.lineHeight / 2;
3597
+ break;
3598
+ case 'top-end':
3599
+ translateX = options.width;
3600
+ translateY = 0;
3601
+ textBaseline = 'top';
3602
+ textAlign = 'end';
3603
+ result.advancedStyleParams.linear.x0 = 0;
3604
+ result.advancedStyleParams.linear.x1 = -options.width;
3605
+ result.advancedStyleParams.radial.x0 = -options.width / 2;
3606
+ result.advancedStyleParams.radial.y0 = result.textLine.data.length * options.lineHeight / 2;
3607
+ // result.advancedStyleParams.radial.r0 = 0
3608
+ result.advancedStyleParams.radial.x1 = -options.width / 2;
3609
+ result.advancedStyleParams.radial.y1 = result.textLine.data.length * options.lineHeight / 2;
3610
+ // result.advancedStyleParams.radial.r1 = options.width / 2
3611
+ result.advancedStyleParams.conic.x = -options.width / 2;
3612
+ result.advancedStyleParams.conic.y = result.textLine.data.length * options.lineHeight / 2;
3613
+ break;
3614
+ case 'bottom':
3615
+ translateX = options.width / 2;
3616
+ translateY = options.height;
3617
+ textBaseline = 'bottom';
3618
+ // textAlign = 'center'
3619
+ result.advancedStyleParams.linear.x0 = -options.width / 2;
3620
+ result.advancedStyleParams.linear.x1 = options.width / 2;
3621
+ // result.advancedStyleParams.radial.x0 = 0
3622
+ result.advancedStyleParams.radial.y0 = -result.textLine.data.length * options.lineHeight / 2;
3623
+ // result.advancedStyleParams.radial.r0 = 0
3624
+ // result.advancedStyleParams.radial.x1 = 0
3625
+ result.advancedStyleParams.radial.y1 = -result.textLine.data.length * options.lineHeight / 2;
3626
+ // result.advancedStyleParams.radial.r1 = options.width / 2
3627
+ result.advancedStyleParams.conic.x = 0;
3628
+ result.advancedStyleParams.conic.y = -result.textLine.data.length * options.lineHeight / 2;
3629
+ break;
3630
+ case 'bottom-start':
3631
+ translateX = 0;
3632
+ translateY = options.height;
3633
+ textBaseline = 'bottom';
3634
+ textAlign = 'start';
3635
+ result.advancedStyleParams.linear.x0 = 0;
3636
+ result.advancedStyleParams.linear.x1 = options.width;
3637
+ result.advancedStyleParams.radial.x0 = options.width / 2;
3638
+ result.advancedStyleParams.radial.y0 = -result.textLine.data.length * options.lineHeight / 2;
3639
+ // result.advancedStyleParams.radial.r0 = 0
3640
+ result.advancedStyleParams.radial.x1 = options.width / 2;
3641
+ result.advancedStyleParams.radial.y1 = -result.textLine.data.length * options.lineHeight / 2;
3642
+ // result.advancedStyleParams.radial.r1 = options.width / 2
3643
+ result.advancedStyleParams.conic.x = options.width / 2;
3644
+ result.advancedStyleParams.conic.y = -result.textLine.data.length * options.lineHeight / 2;
3645
+ break;
3646
+ case 'bottom-end':
3647
+ translateX = options.width;
3648
+ translateY = options.height;
3649
+ textBaseline = 'bottom';
3650
+ textAlign = 'end';
3651
+ result.advancedStyleParams.linear.x0 = 0;
3652
+ result.advancedStyleParams.linear.x1 = -options.width;
3653
+ result.advancedStyleParams.radial.x0 = -options.width / 2;
3654
+ result.advancedStyleParams.radial.y0 = -result.textLine.data.length * options.lineHeight / 2;
3655
+ // result.advancedStyleParams.radial.r0 = 0
3656
+ result.advancedStyleParams.radial.x1 = -options.width / 2;
3657
+ result.advancedStyleParams.radial.y1 = -result.textLine.data.length * options.lineHeight / 2;
3658
+ // result.advancedStyleParams.radial.r1 = options.width / 2
3659
+ result.advancedStyleParams.conic.x = -options.width / 2;
3660
+ result.advancedStyleParams.conic.y = -result.textLine.data.length * options.lineHeight / 2;
3661
+ break;
3662
+ case 'left':
3663
+ translateX = 0;
3664
+ translateY = options.height / 2;
3665
+ // TextBaselineType = 'middle'
3666
+ textAlign = 'start';
3667
+ result.advancedStyleParams.linear.x0 = 0;
3668
+ result.advancedStyleParams.linear.x1 = options.width;
3669
+ result.advancedStyleParams.radial.x0 = options.width / 2;
3670
+ // result.advancedStyleParams.radial.y0 = 0
3671
+ // result.advancedStyleParams.radial.r0 = 0
3672
+ result.advancedStyleParams.radial.x1 = options.width / 2;
3673
+ // result.advancedStyleParams.radial.y1 = 0
3674
+ // result.advancedStyleParams.radial.r1 = options.width / 2
3675
+ result.advancedStyleParams.conic.x = options.width / 2;
3676
+ result.advancedStyleParams.conic.y = 0;
3677
+ break;
3678
+ case 'right':
3679
+ translateX = options.width;
3680
+ translateY = options.height / 2;
3681
+ // TextBaselineType = 'middle'
3682
+ textAlign = 'end';
3683
+ result.advancedStyleParams.linear.x0 = 0;
3684
+ result.advancedStyleParams.linear.x1 = -options.width;
3685
+ result.advancedStyleParams.radial.x0 = -options.width / 2;
3686
+ // result.advancedStyleParams.radial.y0 = 0
3687
+ // result.advancedStyleParams.radial.r0 = 0
3688
+ result.advancedStyleParams.radial.x1 = -options.width / 2;
3689
+ // result.advancedStyleParams.radial.y1 = 0
3690
+ // result.advancedStyleParams.radial.r1 = options.width / 2
3691
+ result.advancedStyleParams.conic.x = -options.width / 2;
3692
+ result.advancedStyleParams.conic.y = 0;
3693
+ break;
3694
+ }
3695
+ options.translateX = translateX;
3696
+ options.translateY = translateY;
3697
+ isUndefined(args === null || args === void 0 ? void 0 : args.textBaseline) && (options.textBaseline = textBaseline);
3698
+ isUndefined(args === null || args === void 0 ? void 0 : args.textAlign) && (options.textAlign = textAlign);
3699
+ if (['text', 'multi-line-text'].includes(options.contentType)) {
3700
+ switch (options.textBaseline) {
3701
+ case 'middle':
3702
+ result.textLine.yOffsetValue = (result.textLine.data.length - 1) * options.lineHeight / 2;
3703
+ break;
3704
+ case 'bottom':
3705
+ case 'alphabetic':
3706
+ case 'ideographic':
3707
+ result.textLine.yOffsetValue = (result.textLine.data.length - 1) * options.lineHeight + (options.lineHeight - parseInt(options.fontSize)) / 2;
3708
+ break;
3709
+ case 'top':
3710
+ case 'hanging':
3711
+ result.textLine.yOffsetValue = -options.lineHeight / 2 + parseInt(options.fontSize) / 2;
3712
+ break;
3713
+ }
3714
+ }
3715
+ return result;
3716
+ };
3717
+
3718
+ var bootstrap = (function () {
3719
+ if (typeof window !== 'undefined') {
3720
+ Object.defineProperty(window, 'MutationObserver', {
3721
+ writable: false,
3722
+ configurable: false
3723
+ });
3724
+ Object.defineProperty(window, 'requestAnimationFrame', {
3725
+ writable: false,
3726
+ configurable: false
3727
+ });
3728
+ }
3729
+ });
3730
+
3731
+ var WatermarkCanvas = /** @class */ (function () {
3732
+ function WatermarkCanvas(args, options) {
3733
+ this.props = args;
3734
+ this.options = options;
3735
+ this.canvas = WatermarkCanvas.createCanvas(this.options.width, this.options.height);
3736
+ this.recommendOptions = generateRecommendOptions(this.canvas, this.options, this.props);
3737
+ }
3738
+ /**
3739
+ * Create an HD canvas.
3740
+ * @param width - width of canvas
3741
+ * @param height - height of canvas
3742
+ */
3743
+ WatermarkCanvas.createCanvas = function (width, height) {
3744
+ var _a;
3745
+ var ratio = window.devicePixelRatio || 1;
3746
+ var canvas = document.createElement('canvas');
3747
+ canvas.width = width * ratio; // actual rendered pixel
3748
+ canvas.height = height * ratio; // actual rendered pixel
3749
+ canvas.style.width = "".concat(width, "px"); // control display size
3750
+ canvas.style.height = "".concat(height, "px"); // control display size
3751
+ (_a = canvas.getContext('2d')) === null || _a === void 0 ? void 0 : _a.setTransform(ratio, 0, 0, ratio, 0, 0);
3752
+ return canvas;
3753
+ };
3754
+ /**
3755
+ * Clean the canvas
3756
+ * @param canvas
3757
+ */
3758
+ WatermarkCanvas.clearCanvas = function (canvas) {
3759
+ var ctx = canvas.getContext('2d');
3760
+ if (ctx === null) {
3761
+ throw new Error('get context error');
3762
+ }
3763
+ ctx.restore();
3764
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
3765
+ };
3766
+ WatermarkCanvas.prototype.getCanvas = function () {
3767
+ return this.canvas;
3768
+ };
3769
+ WatermarkCanvas.prototype.clear = function () {
3770
+ WatermarkCanvas.clearCanvas(this.canvas);
3771
+ };
3772
+ WatermarkCanvas.prototype.draw = function () {
3773
+ var _this = this;
3774
+ var ctx = this.canvas.getContext('2d');
3775
+ if (ctx === null) {
3776
+ throw new Error('get context error');
3777
+ }
3778
+ if (this.options.auxiliaryLine) {
3779
+ ctx.beginPath();
3780
+ ctx.rect(0, 0, this.options.width, this.options.height);
3781
+ ctx.lineWidth = 1;
3782
+ ctx.strokeStyle = '#000';
3783
+ ctx.stroke();
3784
+ ctx.closePath();
3785
+ ctx.beginPath();
3786
+ ctx.rect(this.options.translateX, this.options.translateY, 1, 1);
3787
+ ctx.lineWidth = 1;
3788
+ ctx.strokeStyle = '#f00';
3789
+ ctx.stroke();
3790
+ ctx.closePath();
3791
+ }
3792
+ this.setStyle(ctx);
3793
+ ctx.save();
3794
+ ctx.translate(this.options.translateX, this.options.translateY);
3795
+ ctx.rotate(this.options.rotate);
3796
+ return new Promise(function (resolve) {
3797
+ switch (_this.options.contentType) {
3798
+ case 'text':
3799
+ _this.drawText(ctx, resolve);
3800
+ break;
3801
+ case 'image':
3802
+ _this.drawImage(ctx, resolve);
3803
+ break;
3804
+ case 'multi-line-text':
3805
+ _this.drawMultiLineText(ctx, resolve);
3806
+ break;
3807
+ case 'rich-text':
3808
+ _this.drawRichText(ctx, resolve);
3809
+ break;
3810
+ }
3811
+ });
3812
+ };
3813
+ WatermarkCanvas.prototype.setStyle = function (ctx) {
3814
+ var _a;
3815
+ var propName = 'fillStyle';
3816
+ if (this.options.textType === 'stroke') {
3817
+ propName = 'strokeStyle';
3818
+ }
3819
+ var style = this.options.fontColor;
3820
+ if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.advancedStyle) {
3821
+ switch (this.options.advancedStyle.type) {
3822
+ case 'linear':
3823
+ style = this.createLinearGradient(ctx);
3824
+ break;
3825
+ case 'radial':
3826
+ style = this.createRadialGradient(ctx);
3827
+ break;
3828
+ case 'conic':
3829
+ style = this.createConicGradient(ctx);
3830
+ break;
3831
+ case 'pattern':
3832
+ style = this.createPattern(ctx);
3833
+ break;
3834
+ }
3835
+ }
3836
+ ctx[propName] && style && (ctx[propName] = style);
3837
+ this.options.textAlign && (ctx.textAlign = this.options.textAlign);
3838
+ this.options.textBaseline && (ctx.textBaseline = this.options.textBaseline);
3839
+ ctx.globalAlpha = this.options.globalAlpha;
3840
+ if (this.options.shadowStyle) {
3841
+ ctx.shadowBlur = getValue(this.options.shadowStyle.shadowBlur, 0);
3842
+ ctx.shadowColor = getValue(this.options.shadowStyle.shadowColor, '#00000000');
3843
+ ctx.shadowOffsetX = getValue(this.options.shadowStyle.shadowOffsetX, 0);
3844
+ ctx.shadowOffsetY = getValue(this.options.shadowStyle.shadowOffsetY, 0);
3845
+ }
3846
+ if (isFunction(this.options.extraDrawFunc)) {
3847
+ this.options.extraDrawFunc(ctx);
3848
+ }
3849
+ };
3850
+ WatermarkCanvas.prototype.createLinearGradient = function (ctx) {
3851
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
3852
+ var gradient = ctx.createLinearGradient(getValue((_c = (_b = (_a = this.options.advancedStyle) === null || _a === void 0 ? void 0 : _a.params) === null || _b === void 0 ? void 0 : _b.linear) === null || _c === void 0 ? void 0 : _c.x0, this.recommendOptions.advancedStyleParams.linear.x0), getValue((_f = (_e = (_d = this.options.advancedStyle) === null || _d === void 0 ? void 0 : _d.params) === null || _e === void 0 ? void 0 : _e.linear) === null || _f === void 0 ? void 0 : _f.y0, 0), getValue((_j = (_h = (_g = this.options.advancedStyle) === null || _g === void 0 ? void 0 : _g.params) === null || _h === void 0 ? void 0 : _h.linear) === null || _j === void 0 ? void 0 : _j.x1, this.recommendOptions.advancedStyleParams.linear.x1), getValue((_m = (_l = (_k = this.options.advancedStyle) === null || _k === void 0 ? void 0 : _k.params) === null || _l === void 0 ? void 0 : _l.linear) === null || _m === void 0 ? void 0 : _m.y1, 0));
3853
+ (_q = (_p = (_o = this.options) === null || _o === void 0 ? void 0 : _o.advancedStyle) === null || _p === void 0 ? void 0 : _p.colorStops) === null || _q === void 0 ? void 0 : _q.forEach(function (item) {
3854
+ gradient.addColorStop(item.offset, item.color);
3855
+ });
3856
+ return gradient;
3857
+ };
3858
+ WatermarkCanvas.prototype.createConicGradient = function (ctx) {
3859
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
3860
+ var gradient = ctx.createConicGradient(getValue((_d = (_c = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.advancedStyle) === null || _b === void 0 ? void 0 : _b.params) === null || _c === void 0 ? void 0 : _c.conic) === null || _d === void 0 ? void 0 : _d.startAngle, 0), getValue((_h = (_g = (_f = (_e = this.options) === null || _e === void 0 ? void 0 : _e.advancedStyle) === null || _f === void 0 ? void 0 : _f.params) === null || _g === void 0 ? void 0 : _g.conic) === null || _h === void 0 ? void 0 : _h.x, this.recommendOptions.advancedStyleParams.conic.x), getValue((_m = (_l = (_k = (_j = this.options) === null || _j === void 0 ? void 0 : _j.advancedStyle) === null || _k === void 0 ? void 0 : _k.params) === null || _l === void 0 ? void 0 : _l.conic) === null || _m === void 0 ? void 0 : _m.y, this.recommendOptions.advancedStyleParams.conic.y));
3861
+ (_q = (_p = (_o = this.options) === null || _o === void 0 ? void 0 : _o.advancedStyle) === null || _p === void 0 ? void 0 : _p.colorStops) === null || _q === void 0 ? void 0 : _q.forEach(function (item) {
3862
+ gradient.addColorStop(item.offset, item.color);
3863
+ });
3864
+ return gradient;
3865
+ };
3866
+ WatermarkCanvas.prototype.createRadialGradient = function (ctx) {
3867
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
3868
+ var gradient = ctx.createRadialGradient(getValue((_d = (_c = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.advancedStyle) === null || _b === void 0 ? void 0 : _b.params) === null || _c === void 0 ? void 0 : _c.radial) === null || _d === void 0 ? void 0 : _d.x0, this.recommendOptions.advancedStyleParams.radial.x0), getValue((_h = (_g = (_f = (_e = this.options) === null || _e === void 0 ? void 0 : _e.advancedStyle) === null || _f === void 0 ? void 0 : _f.params) === null || _g === void 0 ? void 0 : _g.radial) === null || _h === void 0 ? void 0 : _h.y0, this.recommendOptions.advancedStyleParams.radial.y0), getValue((_m = (_l = (_k = (_j = this.options) === null || _j === void 0 ? void 0 : _j.advancedStyle) === null || _k === void 0 ? void 0 : _k.params) === null || _l === void 0 ? void 0 : _l.radial) === null || _m === void 0 ? void 0 : _m.r0, this.recommendOptions.advancedStyleParams.radial.r0), getValue((_r = (_q = (_p = (_o = this.options) === null || _o === void 0 ? void 0 : _o.advancedStyle) === null || _p === void 0 ? void 0 : _p.params) === null || _q === void 0 ? void 0 : _q.radial) === null || _r === void 0 ? void 0 : _r.x1, this.recommendOptions.advancedStyleParams.radial.x1), getValue((_v = (_u = (_t = (_s = this.options) === null || _s === void 0 ? void 0 : _s.advancedStyle) === null || _t === void 0 ? void 0 : _t.params) === null || _u === void 0 ? void 0 : _u.radial) === null || _v === void 0 ? void 0 : _v.y1, this.recommendOptions.advancedStyleParams.radial.y1), getValue((_z = (_y = (_x = (_w = this.options) === null || _w === void 0 ? void 0 : _w.advancedStyle) === null || _x === void 0 ? void 0 : _x.params) === null || _y === void 0 ? void 0 : _y.radial) === null || _z === void 0 ? void 0 : _z.r1, this.recommendOptions.advancedStyleParams.radial.r1));
3869
+ (_2 = (_1 = (_0 = this.options) === null || _0 === void 0 ? void 0 : _0.advancedStyle) === null || _1 === void 0 ? void 0 : _1.colorStops) === null || _2 === void 0 ? void 0 : _2.forEach(function (item) {
3870
+ gradient.addColorStop(item.offset, item.color);
3871
+ });
3872
+ return gradient;
3873
+ };
3874
+ WatermarkCanvas.prototype.createPattern = function (ctx) {
3875
+ var _a, _b, _c, _d, _e, _f, _g, _h;
3876
+ return ctx.createPattern((_d = (_c = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.advancedStyle) === null || _b === void 0 ? void 0 : _b.params) === null || _c === void 0 ? void 0 : _c.pattern) === null || _d === void 0 ? void 0 : _d.image, ((_h = (_g = (_f = (_e = this.options) === null || _e === void 0 ? void 0 : _e.advancedStyle) === null || _f === void 0 ? void 0 : _f.params) === null || _g === void 0 ? void 0 : _g.pattern) === null || _h === void 0 ? void 0 : _h.repetition) || '');
3877
+ };
3878
+ WatermarkCanvas.prototype.setText = function (ctx, params) {
3879
+ var methodName = 'fillText';
3880
+ if (this.options.textType === 'stroke') {
3881
+ methodName = 'strokeText';
3882
+ }
3883
+ ctx[methodName] && ctx[methodName](params.text, params.x, params.y, params.maxWidth);
3884
+ };
3885
+ WatermarkCanvas.prototype.drawText = function (ctx, resolve) {
3886
+ this.setText(ctx, {
3887
+ text: this.options.content,
3888
+ x: 0,
3889
+ y: 0 - this.recommendOptions.textLine.yOffsetValue,
3890
+ maxWidth: this.options.textRowMaxWidth || this.options.width
3891
+ });
3892
+ resolve(ctx.canvas);
3893
+ };
3894
+ WatermarkCanvas.prototype.drawImage = function (ctx, resolve) {
3895
+ var _this = this;
3896
+ loadImage(this.options.image).then(function (image) {
3897
+ var _a = _this.getImageRect(image), imageWidth = _a.width, imageHeight = _a.height;
3898
+ var imagePosition = _this.getDrawImagePosition(imageWidth, imageHeight);
3899
+ ctx.drawImage(image, imagePosition.x, imagePosition.y, imageWidth, imageHeight);
3900
+ resolve(ctx.canvas);
3901
+ });
3902
+ };
3903
+ WatermarkCanvas.prototype.drawMultiLineText = function (ctx, resolve) {
3904
+ var _this = this;
3905
+ // image.width = this.options.width
3906
+ // image.height = this.options.height
3907
+ // const element = createCustomContentSvg(context, this.options)
3908
+ // image.src = convertSVGToImage(element)
3909
+ // image.onload = () => {
3910
+ // context.translate(this.options.width / 2, this.options.height / 2)
3911
+ // context.rotate(this.options.rotate)
3912
+ // context.drawImage(
3913
+ // image,
3914
+ // -this.options.width / 2,
3915
+ // -this.options.height / 2,
3916
+ // context.canvas.width,
3917
+ // context.canvas.height
3918
+ // )
3919
+ // resolve(canvas)
3920
+ // }
3921
+ var lines = this.recommendOptions.textLine.data;
3922
+ var yOffsetValue = this.recommendOptions.textLine.yOffsetValue;
3923
+ lines.forEach(function (text, index) {
3924
+ _this.setText(ctx, { text: text, x: 0, y: _this.options.lineHeight * index - yOffsetValue, maxWidth: _this.options.textRowMaxWidth || _this.options.width });
3925
+ });
3926
+ resolve(ctx.canvas);
3927
+ };
3928
+ WatermarkCanvas.prototype.drawRichText = function (ctx, resolve) {
3929
+ return __awaiter(this, void 0, void 0, function () {
3930
+ var obj;
3931
+ var _this = this;
3932
+ return __generator(this, function (_a) {
3933
+ switch (_a.label) {
3934
+ case 0: return [4 /*yield*/, createCustomContentSVG(ctx, this.options)];
3935
+ case 1:
3936
+ obj = _a.sent();
3937
+ loadImage(convertSVGToImage(obj.element), obj.width, obj.height).then(function (image) {
3938
+ var imagePosition = _this.getDrawImagePosition(image.width, image.height);
3939
+ ctx.drawImage(image, imagePosition.x, imagePosition.y, image.width, image.height);
3940
+ resolve(ctx.canvas);
3941
+ });
3942
+ return [2 /*return*/];
3943
+ }
3944
+ });
3945
+ });
3946
+ };
3947
+ WatermarkCanvas.prototype.getImageRect = function (image) {
3948
+ var rect = { width: this.options.imageWidth || 0, height: this.options.imageHeight || 0 };
3949
+ switch (true) {
3950
+ case rect.width !== 0 && rect.height === 0:
3951
+ rect.height = rect.width * image.height / image.width;
3952
+ break;
3953
+ case rect.width === 0 && rect.height !== 0:
3954
+ rect.width = rect.height * image.width / image.height;
3955
+ break;
3956
+ case rect.width === 0 && rect.height === 0:
3957
+ rect.width = image.width;
3958
+ rect.height = image.height;
3959
+ break;
3960
+ }
3961
+ return rect;
3962
+ };
3963
+ WatermarkCanvas.prototype.getDrawImagePosition = function (imageWidth, imageHeight) {
3964
+ var _a, _b;
3965
+ var result = {
3966
+ x: -imageWidth / 2,
3967
+ y: -imageHeight / 2
3968
+ };
3969
+ switch (this.options.translatePlacement) {
3970
+ case 'top':
3971
+ result.x = -imageWidth / 2;
3972
+ result.y = 0;
3973
+ break;
3974
+ case 'top-start':
3975
+ result.x = 0;
3976
+ result.y = 0;
3977
+ break;
3978
+ case 'top-end':
3979
+ result.x = -imageWidth;
3980
+ result.y = 0;
3981
+ break;
3982
+ case 'bottom':
3983
+ result.x = -imageWidth / 2;
3984
+ result.y = -imageHeight;
3985
+ break;
3986
+ case 'bottom-start':
3987
+ result.x = 0;
3988
+ result.y = -imageHeight;
3989
+ break;
3990
+ case 'bottom-end':
3991
+ result.x = -imageWidth;
3992
+ result.y = -imageHeight;
3993
+ break;
3994
+ case 'left':
3995
+ result.x = 0;
3996
+ result.y = -imageHeight / 2;
3997
+ break;
3998
+ case 'right':
3999
+ result.x = -imageWidth;
4000
+ result.y = -imageHeight / 2;
4001
+ break;
4002
+ }
4003
+ !isUndefined((_a = this.props) === null || _a === void 0 ? void 0 : _a.translateX) && (result.x = 0);
4004
+ !isUndefined((_b = this.props) === null || _b === void 0 ? void 0 : _b.translateY) && (result.y = 0);
4005
+ return result;
4006
+ };
4007
+ return WatermarkCanvas;
4008
+ }());
4009
+
4010
+ var GridLayout = /** @class */ (function () {
4011
+ function GridLayout(args, partialCanvas) {
4012
+ var _a, _b, _c, _d;
4013
+ this.options = args;
4014
+ this.partialWidth = this.options.width;
4015
+ this.partialHeight = this.options.height;
4016
+ this.rows = ((_a = this.options.gridLayoutOptions) === null || _a === void 0 ? void 0 : _a.rows) || 1;
4017
+ this.cols = ((_b = this.options.gridLayoutOptions) === null || _b === void 0 ? void 0 : _b.cols) || 1;
4018
+ this.matrix = ((_c = this.options.gridLayoutOptions) === null || _c === void 0 ? void 0 : _c.matrix) || generateMatrix(this.rows, this.cols, 1);
4019
+ this.gap = ((_d = this.options.gridLayoutOptions) === null || _d === void 0 ? void 0 : _d.gap) || [0, 0];
4020
+ this.partialCanvas = partialCanvas;
4021
+ }
4022
+ GridLayout.prototype.draw = function () {
4023
+ var _a, _b, _c, _d, _e, _f, _g, _h;
4024
+ var layoutCanvas = WatermarkCanvas.createCanvas(((_a = this.options.gridLayoutOptions) === null || _a === void 0 ? void 0 : _a.width) || (this.partialWidth * this.cols + this.gap[0] * this.cols), ((_b = this.options.gridLayoutOptions) === null || _b === void 0 ? void 0 : _b.height) || (this.partialHeight * this.rows + this.gap[1] * this.rows));
4025
+ var layoutContext = layoutCanvas.getContext('2d');
4026
+ if ((_c = this.options.gridLayoutOptions) === null || _c === void 0 ? void 0 : _c.backgroundImage) {
4027
+ layoutContext === null || layoutContext === void 0 ? void 0 : layoutContext.drawImage((_d = this.options.gridLayoutOptions) === null || _d === void 0 ? void 0 : _d.backgroundImage, 0, 0, (_e = this.options.gridLayoutOptions) === null || _e === void 0 ? void 0 : _e.width, (_f = this.options.gridLayoutOptions) === null || _f === void 0 ? void 0 : _f.height);
4028
+ }
4029
+ for (var rowIndex = 0; rowIndex < this.rows; rowIndex++) {
4030
+ for (var colIndex = 0; colIndex < this.cols; colIndex++) {
4031
+ if (!((_h = (_g = this.matrix) === null || _g === void 0 ? void 0 : _g[rowIndex]) === null || _h === void 0 ? void 0 : _h[colIndex])) {
4032
+ continue;
4033
+ }
4034
+ layoutContext === null || layoutContext === void 0 ? void 0 : layoutContext.drawImage(this.partialCanvas, this.partialWidth * colIndex + this.gap[0] * colIndex, this.partialHeight * rowIndex + this.gap[1] * rowIndex, this.partialWidth, this.partialHeight);
4035
+ }
4036
+ }
4037
+ return layoutCanvas;
4038
+ };
4039
+ return GridLayout;
4040
+ }());
4041
+
4042
+ var renderLayout = function (options, partialCanvas) {
4043
+ switch (options.layout) {
4044
+ case 'grid':
4045
+ return new GridLayout(options, partialCanvas).draw();
4046
+ default:
4047
+ return partialCanvas;
4048
+ }
4049
+ };
4050
+ var generateBackgroundSize = function (options) {
4051
+ var _a, _b, _c;
4052
+ switch (options.layout) {
4053
+ case 'grid':
4054
+ {
4055
+ var cols = ((_a = options.gridLayoutOptions) === null || _a === void 0 ? void 0 : _a.cols) || 1;
4056
+ var rows = ((_b = options.gridLayoutOptions) === null || _b === void 0 ? void 0 : _b.rows) || 1;
4057
+ var gap = ((_c = options.gridLayoutOptions) === null || _c === void 0 ? void 0 : _c.gap) || [0, 0];
4058
+ return [
4059
+ options.width * cols + gap[0] * cols,
4060
+ options.height * rows + gap[1] * rows
4061
+ ];
4062
+ }
4063
+ default:
4064
+ return [
4065
+ options.width,
4066
+ options.height
4067
+ ];
4068
+ }
4069
+ };
4070
+
4071
+ /**
4072
+ * Watermark class
4073
+ */
4074
+ var Watermark = /** @class */ (function () {
4075
+ /**
4076
+ * Watermark constructor
4077
+ * @param args - watermark args
4078
+ */
4079
+ function Watermark(args) {
4080
+ if (args === void 0) { args = {}; }
4081
+ this.parentElement = document.body;
4082
+ this.isCreating = false;
4083
+ this.props = args;
4084
+ this.options = __assign(__assign({}, initialOptions), args);
4085
+ this.changeParentElement(this.options.parent);
4086
+ this.watermarkCanvas = new WatermarkCanvas(this.props, this.options);
4087
+ bootstrap();
4088
+ }
4089
+ /**
4090
+ * Change watermark options
4091
+ * @param args
4092
+ * @param mode
4093
+ * @param redraw
4094
+ */
4095
+ Watermark.prototype.changeOptions = function () {
4096
+ return __awaiter(this, arguments, void 0, function (args, mode, redraw) {
4097
+ if (args === void 0) { args = {}; }
4098
+ if (mode === void 0) { mode = 'overwrite'; }
4099
+ if (redraw === void 0) { redraw = true; }
4100
+ return __generator(this, function (_a) {
4101
+ switch (_a.label) {
4102
+ case 0:
4103
+ this.initConfigData(args, mode);
4104
+ if (!redraw) return [3 /*break*/, 2];
4105
+ this.remove();
4106
+ return [4 /*yield*/, this.create()];
4107
+ case 1:
4108
+ _a.sent();
4109
+ _a.label = 2;
4110
+ case 2: return [2 /*return*/];
4111
+ }
4112
+ });
4113
+ });
4114
+ };
4115
+ /**
4116
+ * Creating a watermark.
4117
+ */
4118
+ Watermark.prototype.create = function () {
4119
+ return __awaiter(this, void 0, void 0, function () {
4120
+ var firstDraw, image, watermarkInnerDom, parentElementType, backgroundSize;
4121
+ var _a, _b, _c, _d, _e, _f, _g;
4122
+ return __generator(this, function (_h) {
4123
+ switch (_h.label) {
4124
+ case 0:
4125
+ if (this.isCreating) {
4126
+ return [2 /*return*/];
4127
+ }
4128
+ this.isCreating = true;
4129
+ if (!this.validateUnique()) {
4130
+ this.isCreating = false;
4131
+ return [2 /*return*/];
4132
+ }
4133
+ if (!this.validateContent()) {
4134
+ this.isCreating = false;
4135
+ return [2 /*return*/];
4136
+ }
4137
+ firstDraw = isUndefined(this.watermarkDom);
4138
+ return [4 /*yield*/, ((_a = this.watermarkCanvas) === null || _a === void 0 ? void 0 : _a.draw())];
4139
+ case 1:
4140
+ _h.sent();
4141
+ this.layoutCanvas = renderLayout(this.options, (_b = this.watermarkCanvas) === null || _b === void 0 ? void 0 : _b.getCanvas());
4142
+ image = convertImage(this.layoutCanvas);
4143
+ (_c = this.watermarkCanvas) === null || _c === void 0 ? void 0 : _c.clear();
4144
+ this.watermarkDom = document.createElement('div');
4145
+ watermarkInnerDom = document.createElement('div');
4146
+ this.watermarkDom.__WATERMARK__ = 'watermark';
4147
+ this.watermarkDom.__WATERMARK__INSTANCE__ = this;
4148
+ parentElementType = this.checkParentElementType();
4149
+ this.watermarkDom.style.cssText = "\n z-index:".concat(this.options.zIndex, "!important;display:block!important;visibility:visible!important;transform:none!important;scale:none!important;\n ").concat(parentElementType === 'custom' ? 'top:0!important;bottom:0!important;left:0!important;right:0!important;height:100%!important;pointer-events:none!important;position:absolute!important;' : 'position:relative!important;', "\n ");
4150
+ backgroundSize = generateBackgroundSize(this.options);
4151
+ watermarkInnerDom.style.cssText = "\n display:block!important;visibility:visible!important;pointer-events:none;top:0;bottom:0;left:0;right:0;transform:none!important;scale:none!important;\n position:".concat(parentElementType === 'root' ? 'fixed' : 'absolute', "!important;-webkit-print-color-adjust:exact!important;width:100%!important;height:100%!important;\n z-index:").concat(this.options.zIndex, "!important;background-image:url(").concat(image, ")!important;background-repeat:").concat(this.options.backgroundRepeat, "!important;\n background-size:").concat(backgroundSize[0], "px ").concat(backgroundSize[1], "px!important;background-position:").concat(this.options.backgroundPosition, ";\n ").concat(this.options.movable ? 'animation: 200s ease 0s infinite normal none running watermark !important;' : '', "\n ");
4152
+ this.watermarkDom.appendChild(watermarkInnerDom);
4153
+ this.parentElement.appendChild(this.watermarkDom);
4154
+ if (this.options.mutationObserve) {
4155
+ try {
4156
+ this.bindMutationObserve();
4157
+ }
4158
+ catch (e) {
4159
+ (_e = (_d = this.options).onObserveError) === null || _e === void 0 ? void 0 : _e.call(_d);
4160
+ }
4161
+ }
4162
+ firstDraw && ((_g = (_f = this.options).onSuccess) === null || _g === void 0 ? void 0 : _g.call(_f));
4163
+ this.isCreating = false;
4164
+ return [2 /*return*/];
4165
+ }
4166
+ });
4167
+ });
4168
+ };
4169
+ /**
4170
+ * Delete this watermark.
4171
+ */
4172
+ Watermark.prototype.destroy = function () {
4173
+ this.remove();
4174
+ this.watermarkDom = undefined;
4175
+ };
4176
+ Watermark.prototype.check = function () {
4177
+ return __awaiter(this, void 0, void 0, function () {
4178
+ return __generator(this, function (_a) {
4179
+ switch (_a.label) {
4180
+ case 0:
4181
+ if (!!this.parentElement.contains(this.watermarkDom)) return [3 /*break*/, 2];
4182
+ this.remove();
4183
+ return [4 /*yield*/, this.create()];
4184
+ case 1:
4185
+ _a.sent();
4186
+ _a.label = 2;
4187
+ case 2: return [2 /*return*/];
4188
+ }
4189
+ });
4190
+ });
4191
+ };
4192
+ Watermark.prototype.remove = function () {
4193
+ var _a, _b, _c, _d, _e, _f, _g, _h;
4194
+ (_b = (_a = this.options).onBeforeDestroy) === null || _b === void 0 ? void 0 : _b.call(_a);
4195
+ (_c = this.observer) === null || _c === void 0 ? void 0 : _c.disconnect();
4196
+ (_d = this.parentObserve) === null || _d === void 0 ? void 0 : _d.disconnect();
4197
+ this.unbindCheckWatermarkElementEvent();
4198
+ (_f = (_e = this.watermarkDom) === null || _e === void 0 ? void 0 : _e.parentNode) === null || _f === void 0 ? void 0 : _f.removeChild(this.watermarkDom);
4199
+ (_h = (_g = this.options).onDestroyed) === null || _h === void 0 ? void 0 : _h.call(_g);
4200
+ };
4201
+ Watermark.prototype.initConfigData = function (args, mode) {
4202
+ var _this = this;
4203
+ if (mode === void 0) { mode = 'overwrite'; }
4204
+ if (mode === 'append') {
4205
+ Object.keys(args).forEach(function (key) {
4206
+ _this.props && (_this.props[key] = args[key]);
4207
+ });
4208
+ }
4209
+ else {
4210
+ this.props = args;
4211
+ }
4212
+ this.options = __assign(__assign({}, initialOptions), this.props);
4213
+ this.changeParentElement(this.options.parent);
4214
+ this.watermarkCanvas = new WatermarkCanvas(this.props, this.options);
4215
+ };
4216
+ Watermark.prototype.changeParentElement = function (parent) {
4217
+ if (typeof parent === 'string') {
4218
+ var parentElement = document.querySelector(parent);
4219
+ parentElement && (this.parentElement = parentElement);
4220
+ }
4221
+ else {
4222
+ this.parentElement = parent;
4223
+ }
4224
+ if (!this.parentElement) {
4225
+ console.error('[WatermarkJsPlus]: please pass a valid parent element.');
4226
+ }
4227
+ };
4228
+ Watermark.prototype.validateUnique = function () {
4229
+ var result = true;
4230
+ Array.from(this.parentElement.childNodes).forEach(function (node) {
4231
+ if (!result) {
4232
+ return;
4233
+ }
4234
+ if (Object.hasOwnProperty.call(node, '__WATERMARK__')) {
4235
+ result = false;
4236
+ // throw new Error('duplicate watermark error')
4237
+ }
4238
+ });
4239
+ return result;
4240
+ };
4241
+ Watermark.prototype.validateContent = function () {
4242
+ switch (this.options.contentType) {
4243
+ case 'image':
4244
+ return Object.hasOwnProperty.call(this.options, 'image');
4245
+ case 'multi-line-text':
4246
+ case 'rich-text':
4247
+ case 'text':
4248
+ return this.options.content.length > 0;
4249
+ }
4250
+ return false;
4251
+ };
4252
+ Watermark.prototype.checkParentElementType = function () {
4253
+ if (['html', 'body'].includes(this.parentElement.tagName.toLocaleLowerCase())) {
4254
+ return 'root';
4255
+ }
4256
+ return 'custom';
4257
+ };
4258
+ Watermark.prototype.checkWatermarkElement = function () {
4259
+ return __awaiter(this, void 0, void 0, function () {
4260
+ return __generator(this, function (_a) {
4261
+ switch (_a.label) {
4262
+ case 0:
4263
+ if (!!this.parentElement.contains(this.watermarkDom)) return [3 /*break*/, 2];
4264
+ this.remove();
4265
+ return [4 /*yield*/, this.create()];
4266
+ case 1:
4267
+ _a.sent();
4268
+ _a.label = 2;
4269
+ case 2:
4270
+ this.bindCheckWatermarkElementEvent();
4271
+ return [2 /*return*/];
4272
+ }
4273
+ });
4274
+ });
4275
+ };
4276
+ Watermark.prototype.bindMutationObserve = function () {
4277
+ var _this = this;
4278
+ if (!this.watermarkDom) {
4279
+ return;
4280
+ }
4281
+ this.bindCheckWatermarkElementEvent();
4282
+ this.observer = new MutationObserver(function (mutationsList) { return __awaiter(_this, void 0, void 0, function () {
4283
+ return __generator(this, function (_a) {
4284
+ switch (_a.label) {
4285
+ case 0:
4286
+ if (!(mutationsList.length > 0)) return [3 /*break*/, 2];
4287
+ this.remove();
4288
+ return [4 /*yield*/, this.create()];
4289
+ case 1:
4290
+ _a.sent();
4291
+ _a.label = 2;
4292
+ case 2: return [2 /*return*/];
4293
+ }
4294
+ });
4295
+ }); });
4296
+ this.observer.observe(this.watermarkDom, {
4297
+ attributes: true, // 属性的变动
4298
+ childList: true, // 子节点的变动(指新增,删除或者更改)
4299
+ subtree: true, // 布尔值,表示是否将该观察器应用于该节点的所有后代节点。
4300
+ characterData: true // 节点内容或节点文本的变动。
4301
+ });
4302
+ this.parentObserve = new MutationObserver(function (mutationsList) { return __awaiter(_this, void 0, void 0, function () {
4303
+ var _i, mutationsList_1, item;
4304
+ var _a;
4305
+ return __generator(this, function (_b) {
4306
+ switch (_b.label) {
4307
+ case 0:
4308
+ _i = 0, mutationsList_1 = mutationsList;
4309
+ _b.label = 1;
4310
+ case 1:
4311
+ if (!(_i < mutationsList_1.length)) return [3 /*break*/, 4];
4312
+ item = mutationsList_1[_i];
4313
+ if (!((item === null || item === void 0 ? void 0 : item.target) === this.watermarkDom ||
4314
+ ((_a = item === null || item === void 0 ? void 0 : item.removedNodes) === null || _a === void 0 ? void 0 : _a[0]) === this.watermarkDom ||
4315
+ (item.type === 'childList' && item.target === this.parentElement && item.target.lastChild !== this.watermarkDom))) return [3 /*break*/, 3];
4316
+ this.remove();
4317
+ return [4 /*yield*/, this.create()];
4318
+ case 2:
4319
+ _b.sent();
4320
+ _b.label = 3;
4321
+ case 3:
4322
+ _i++;
4323
+ return [3 /*break*/, 1];
4324
+ case 4: return [2 /*return*/];
4325
+ }
4326
+ });
4327
+ }); });
4328
+ this.parentObserve.observe(this.parentElement, {
4329
+ attributes: true, // 属性的变动
4330
+ childList: true, // 子节点的变动(指新增,删除或者更改)
4331
+ subtree: true, // 布尔值,表示是否将该观察器应用于该节点的所有后代节点。
4332
+ characterData: true // 节点内容或节点文本的变动。
4333
+ });
4334
+ };
4335
+ Watermark.prototype.bindCheckWatermarkElementEvent = function () {
4336
+ this.unbindCheckWatermarkElementEvent();
4337
+ this.checkWatermarkElementRequestID = requestAnimationFrame(this.checkWatermarkElement.bind(this));
4338
+ };
4339
+ Watermark.prototype.unbindCheckWatermarkElementEvent = function () {
4340
+ if (!isUndefined(this.checkWatermarkElementRequestID)) {
4341
+ cancelAnimationFrame(this.checkWatermarkElementRequestID);
4342
+ }
4343
+ };
4344
+ return Watermark;
4345
+ }());
4346
+
4347
+ /**
4348
+ * BlindWatermark class
4349
+ */
4350
+ var BlindWatermark = /** @class */ (function (_super) {
4351
+ __extends(BlindWatermark, _super);
4352
+ /**
4353
+ * BlindWatermark constructor
4354
+ * @param props - blind watermark options
4355
+ */
4356
+ function BlindWatermark(props) {
4357
+ if (props === void 0) { props = {}; }
4358
+ var defaultProps = {
4359
+ globalAlpha: 0.005,
4360
+ mode: 'blind'
4361
+ };
4362
+ return _super.call(this, __assign(__assign({}, props), defaultProps)) || this;
4363
+ }
4364
+ /**
4365
+ * Decode blind watermark.
4366
+ * @param props - decode options
4367
+ */
4368
+ BlindWatermark.decode = function (props) {
4369
+ var _a = props.url, url = _a === void 0 ? '' : _a, _b = props.fillColor, fillColor = _b === void 0 ? '#000' : _b, _c = props.compositeOperation, compositeOperation = _c === void 0 ? 'color-burn' : _c, _d = props.mode, mode = _d === void 0 ? 'canvas' : _d, _e = props.compositeTimes, compositeTimes = _e === void 0 ? 3 : _e, onSuccess = props.onSuccess;
4370
+ if (!url) {
4371
+ return;
4372
+ }
4373
+ if (mode === 'canvas') {
4374
+ var img_1 = new Image();
4375
+ img_1.src = url;
4376
+ img_1.addEventListener('load', function () {
4377
+ var width = img_1.width, height = img_1.height;
4378
+ var canvas = WatermarkCanvas.createCanvas(width, height);
4379
+ var ctx = canvas.getContext('2d');
4380
+ if (!ctx) {
4381
+ throw new Error('get context error');
4382
+ }
4383
+ ctx.drawImage(img_1, 0, 0, width, height);
4384
+ ctx.globalCompositeOperation = compositeOperation;
4385
+ ctx.fillStyle = fillColor;
4386
+ for (var i = 0; i < compositeTimes; i++) {
4387
+ ctx.fillRect(0, 0, width, height);
4388
+ }
4389
+ var resultImage = convertImage(canvas);
4390
+ if (isFunction(onSuccess)) {
4391
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(resultImage);
4392
+ }
4393
+ });
4394
+ }
4395
+ };
4396
+ return BlindWatermark;
4397
+ }(Watermark));
4398
+
4399
+ /**
4400
+ * ImageWatermark class
4401
+ */
4402
+ var ImageWatermark = /** @class */ (function () {
4403
+ /**
4404
+ * ImageWatermark constructor
4405
+ * @param args - image watermark args
4406
+ */
4407
+ function ImageWatermark(args) {
4408
+ if (args === void 0) { args = {}; }
4409
+ var _a;
4410
+ this.drew = false;
4411
+ this.props = args;
4412
+ this.options = __assign(__assign({}, initialOptions), args);
4413
+ this.watermarkCanvas = new WatermarkCanvas(this.props, this.options);
4414
+ this.originalSrc = (_a = this.props.dom) === null || _a === void 0 ? void 0 : _a.src;
4415
+ this.backgroundImage = this.getBackgroundImage();
4416
+ }
4417
+ ImageWatermark.prototype.create = function () {
4418
+ return __awaiter(this, void 0, void 0, function () {
4419
+ var _a, _b, _c, _d, _e;
4420
+ return __generator(this, function (_f) {
4421
+ switch (_f.label) {
4422
+ case 0:
4423
+ if (this.drew) {
4424
+ return [2 /*return*/];
4425
+ }
4426
+ return [4 /*yield*/, ((_a = this.watermarkCanvas) === null || _a === void 0 ? void 0 : _a.draw())];
4427
+ case 1:
4428
+ _f.sent();
4429
+ this.options.layout = 'grid';
4430
+ this.options.gridLayoutOptions = __assign(__assign({}, this.options.gridLayoutOptions), { width: (_b = this.backgroundImage) === null || _b === void 0 ? void 0 : _b.width, height: (_c = this.backgroundImage) === null || _c === void 0 ? void 0 : _c.height, backgroundImage: this.backgroundImage });
4431
+ this.layoutCanvas = renderLayout(this.options, (_d = this.watermarkCanvas) === null || _d === void 0 ? void 0 : _d.getCanvas());
4432
+ this.options.dom.src = convertImage(this.layoutCanvas);
4433
+ (_e = this.watermarkCanvas) === null || _e === void 0 ? void 0 : _e.clear();
4434
+ this.drew = true;
4435
+ return [2 /*return*/];
4436
+ }
4437
+ });
4438
+ });
4439
+ };
4440
+ ImageWatermark.prototype.destroy = function () {
4441
+ this.options.dom.src = this.originalSrc;
4442
+ this.drew = false;
4443
+ };
4444
+ ImageWatermark.prototype.getBackgroundImage = function () {
4445
+ if (this.options.dom) {
4446
+ return this.options.dom;
4447
+ }
4448
+ };
4449
+ return ImageWatermark;
4450
+ }());
4451
+
4452
+ exports.BlindWatermark = BlindWatermark;
4453
+ exports.ImageWatermark = ImageWatermark;
4454
+ exports.Watermark = Watermark;
4455
+
4456
+ }));
4457
+ //# sourceMappingURL=index.umd.js.map