@mnykj/wangeditoroptimize-upload-image-module 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/css/style.css +0 -0
- package/dist/index.esm.js +3754 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/upload-image-module/src/constants/svg.d.ts +10 -0
- package/dist/upload-image-module/src/index.d.ts +8 -0
- package/dist/upload-image-module/src/locale/en.d.ts +11 -0
- package/dist/upload-image-module/src/locale/index.d.ts +5 -0
- package/dist/upload-image-module/src/locale/zh-CN.d.ts +11 -0
- package/dist/upload-image-module/src/module/index.d.ts +7 -0
- package/dist/upload-image-module/src/module/menu/UploadImageMenu.d.ts +16 -0
- package/dist/upload-image-module/src/module/menu/config.d.ts +15 -0
- package/dist/upload-image-module/src/module/menu/index.d.ts +10 -0
- package/dist/upload-image-module/src/module/plugin.d.ts +7 -0
- package/dist/upload-image-module/src/module/upload-images.d.ts +11 -0
- package/dist/upload-image-module/src/utils/dom.d.ts +7 -0
- package/package.json +53 -0
|
@@ -0,0 +1,3754 @@
|
|
|
1
|
+
import { i18nAddResources, createUploader, t } from '@mnykj/wangeditoroptimize-core';
|
|
2
|
+
import { insertImageNode, isInsertImageMenuDisabled } from '@mnykj/wangeditoroptimize-basic-modules';
|
|
3
|
+
import $, { append, on, remove, val, click, hide } from 'dom7';
|
|
4
|
+
|
|
5
|
+
var enResources = {
|
|
6
|
+
uploadImgModule: {
|
|
7
|
+
uploadImage: 'Upload Image',
|
|
8
|
+
uploadError: '{{fileName}} upload error'
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
var zhResources = {
|
|
13
|
+
uploadImgModule: {
|
|
14
|
+
uploadImage: '上传图片',
|
|
15
|
+
uploadError: '{{fileName}} 上传出错'
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
i18nAddResources('en', enResources);
|
|
20
|
+
i18nAddResources('zh-CN', zhResources);
|
|
21
|
+
|
|
22
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
23
|
+
|
|
24
|
+
function createCommonjsModule(fn) {
|
|
25
|
+
var module = { exports: {} };
|
|
26
|
+
return fn(module, module.exports), module.exports;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
var check = function (it) {
|
|
30
|
+
return it && it.Math == Math && it;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
|
|
34
|
+
var global$1 =
|
|
35
|
+
// eslint-disable-next-line es/no-global-this -- safe
|
|
36
|
+
check(typeof globalThis == 'object' && globalThis) ||
|
|
37
|
+
check(typeof window == 'object' && window) ||
|
|
38
|
+
// eslint-disable-next-line no-restricted-globals -- safe
|
|
39
|
+
check(typeof self == 'object' && self) ||
|
|
40
|
+
check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
|
|
41
|
+
// eslint-disable-next-line no-new-func -- fallback
|
|
42
|
+
(function () { return this; })() || Function('return this')();
|
|
43
|
+
|
|
44
|
+
var fails = function (exec) {
|
|
45
|
+
try {
|
|
46
|
+
return !!exec();
|
|
47
|
+
} catch (error) {
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// Detect IE8's incomplete defineProperty implementation
|
|
53
|
+
var descriptors = !fails(function () {
|
|
54
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
55
|
+
return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
var call$2 = Function.prototype.call;
|
|
59
|
+
|
|
60
|
+
var functionCall = call$2.bind ? call$2.bind(call$2) : function () {
|
|
61
|
+
return call$2.apply(call$2, arguments);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
var $propertyIsEnumerable = {}.propertyIsEnumerable;
|
|
65
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
66
|
+
var getOwnPropertyDescriptor$2 = Object.getOwnPropertyDescriptor;
|
|
67
|
+
|
|
68
|
+
// Nashorn ~ JDK8 bug
|
|
69
|
+
var NASHORN_BUG = getOwnPropertyDescriptor$2 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
|
|
70
|
+
|
|
71
|
+
// `Object.prototype.propertyIsEnumerable` method implementation
|
|
72
|
+
// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
|
|
73
|
+
var f$6 = NASHORN_BUG ? function propertyIsEnumerable(V) {
|
|
74
|
+
var descriptor = getOwnPropertyDescriptor$2(this, V);
|
|
75
|
+
return !!descriptor && descriptor.enumerable;
|
|
76
|
+
} : $propertyIsEnumerable;
|
|
77
|
+
|
|
78
|
+
var objectPropertyIsEnumerable = {
|
|
79
|
+
f: f$6
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
var createPropertyDescriptor = function (bitmap, value) {
|
|
83
|
+
return {
|
|
84
|
+
enumerable: !(bitmap & 1),
|
|
85
|
+
configurable: !(bitmap & 2),
|
|
86
|
+
writable: !(bitmap & 4),
|
|
87
|
+
value: value
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
var FunctionPrototype$3 = Function.prototype;
|
|
92
|
+
var bind$3 = FunctionPrototype$3.bind;
|
|
93
|
+
var call$1 = FunctionPrototype$3.call;
|
|
94
|
+
var callBind = bind$3 && bind$3.bind(call$1);
|
|
95
|
+
|
|
96
|
+
var functionUncurryThis = bind$3 ? function (fn) {
|
|
97
|
+
return fn && callBind(call$1, fn);
|
|
98
|
+
} : function (fn) {
|
|
99
|
+
return fn && function () {
|
|
100
|
+
return call$1.apply(fn, arguments);
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
var toString$2 = functionUncurryThis({}.toString);
|
|
105
|
+
var stringSlice$3 = functionUncurryThis(''.slice);
|
|
106
|
+
|
|
107
|
+
var classofRaw = function (it) {
|
|
108
|
+
return stringSlice$3(toString$2(it), 8, -1);
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
var Object$5 = global$1.Object;
|
|
112
|
+
var split = functionUncurryThis(''.split);
|
|
113
|
+
|
|
114
|
+
// fallback for non-array-like ES3 and non-enumerable old V8 strings
|
|
115
|
+
var indexedObject = fails(function () {
|
|
116
|
+
// throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
|
|
117
|
+
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
118
|
+
return !Object$5('z').propertyIsEnumerable(0);
|
|
119
|
+
}) ? function (it) {
|
|
120
|
+
return classofRaw(it) == 'String' ? split(it, '') : Object$5(it);
|
|
121
|
+
} : Object$5;
|
|
122
|
+
|
|
123
|
+
var TypeError$e = global$1.TypeError;
|
|
124
|
+
|
|
125
|
+
// `RequireObjectCoercible` abstract operation
|
|
126
|
+
// https://tc39.es/ecma262/#sec-requireobjectcoercible
|
|
127
|
+
var requireObjectCoercible = function (it) {
|
|
128
|
+
if (it == undefined) throw TypeError$e("Can't call method on " + it);
|
|
129
|
+
return it;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
// toObject with fallback for non-array-like ES3 strings
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
var toIndexedObject = function (it) {
|
|
137
|
+
return indexedObject(requireObjectCoercible(it));
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
// `IsCallable` abstract operation
|
|
141
|
+
// https://tc39.es/ecma262/#sec-iscallable
|
|
142
|
+
var isCallable = function (argument) {
|
|
143
|
+
return typeof argument == 'function';
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
var isObject = function (it) {
|
|
147
|
+
return typeof it == 'object' ? it !== null : isCallable(it);
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
var aFunction = function (argument) {
|
|
151
|
+
return isCallable(argument) ? argument : undefined;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
var getBuiltIn = function (namespace, method) {
|
|
155
|
+
return arguments.length < 2 ? aFunction(global$1[namespace]) : global$1[namespace] && global$1[namespace][method];
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
var objectIsPrototypeOf = functionUncurryThis({}.isPrototypeOf);
|
|
159
|
+
|
|
160
|
+
var engineUserAgent = getBuiltIn('navigator', 'userAgent') || '';
|
|
161
|
+
|
|
162
|
+
var process$3 = global$1.process;
|
|
163
|
+
var Deno = global$1.Deno;
|
|
164
|
+
var versions = process$3 && process$3.versions || Deno && Deno.version;
|
|
165
|
+
var v8 = versions && versions.v8;
|
|
166
|
+
var match, version;
|
|
167
|
+
|
|
168
|
+
if (v8) {
|
|
169
|
+
match = v8.split('.');
|
|
170
|
+
// in old Chrome, versions of V8 isn't V8 = Chrome / 10
|
|
171
|
+
// but their correct versions are not interesting for us
|
|
172
|
+
version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
|
|
176
|
+
// so check `userAgent` even if `.v8` exists, but 0
|
|
177
|
+
if (!version && engineUserAgent) {
|
|
178
|
+
match = engineUserAgent.match(/Edge\/(\d+)/);
|
|
179
|
+
if (!match || match[1] >= 74) {
|
|
180
|
+
match = engineUserAgent.match(/Chrome\/(\d+)/);
|
|
181
|
+
if (match) version = +match[1];
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
var engineV8Version = version;
|
|
186
|
+
|
|
187
|
+
/* eslint-disable es/no-symbol -- required for testing */
|
|
188
|
+
|
|
189
|
+
// eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
|
|
190
|
+
var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
|
|
191
|
+
var symbol = Symbol();
|
|
192
|
+
// Chrome 38 Symbol has incorrect toString conversion
|
|
193
|
+
// `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
|
|
194
|
+
return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
|
|
195
|
+
// Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
|
|
196
|
+
!Symbol.sham && engineV8Version && engineV8Version < 41;
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
/* eslint-disable es/no-symbol -- required for testing */
|
|
200
|
+
|
|
201
|
+
var useSymbolAsUid = nativeSymbol
|
|
202
|
+
&& !Symbol.sham
|
|
203
|
+
&& typeof Symbol.iterator == 'symbol';
|
|
204
|
+
|
|
205
|
+
var Object$4 = global$1.Object;
|
|
206
|
+
|
|
207
|
+
var isSymbol = useSymbolAsUid ? function (it) {
|
|
208
|
+
return typeof it == 'symbol';
|
|
209
|
+
} : function (it) {
|
|
210
|
+
var $Symbol = getBuiltIn('Symbol');
|
|
211
|
+
return isCallable($Symbol) && objectIsPrototypeOf($Symbol.prototype, Object$4(it));
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
var String$5 = global$1.String;
|
|
215
|
+
|
|
216
|
+
var tryToString = function (argument) {
|
|
217
|
+
try {
|
|
218
|
+
return String$5(argument);
|
|
219
|
+
} catch (error) {
|
|
220
|
+
return 'Object';
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
var TypeError$d = global$1.TypeError;
|
|
225
|
+
|
|
226
|
+
// `Assert: IsCallable(argument) is true`
|
|
227
|
+
var aCallable = function (argument) {
|
|
228
|
+
if (isCallable(argument)) return argument;
|
|
229
|
+
throw TypeError$d(tryToString(argument) + ' is not a function');
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
// `GetMethod` abstract operation
|
|
233
|
+
// https://tc39.es/ecma262/#sec-getmethod
|
|
234
|
+
var getMethod = function (V, P) {
|
|
235
|
+
var func = V[P];
|
|
236
|
+
return func == null ? undefined : aCallable(func);
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
var TypeError$c = global$1.TypeError;
|
|
240
|
+
|
|
241
|
+
// `OrdinaryToPrimitive` abstract operation
|
|
242
|
+
// https://tc39.es/ecma262/#sec-ordinarytoprimitive
|
|
243
|
+
var ordinaryToPrimitive = function (input, pref) {
|
|
244
|
+
var fn, val;
|
|
245
|
+
if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = functionCall(fn, input))) return val;
|
|
246
|
+
if (isCallable(fn = input.valueOf) && !isObject(val = functionCall(fn, input))) return val;
|
|
247
|
+
if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = functionCall(fn, input))) return val;
|
|
248
|
+
throw TypeError$c("Can't convert object to primitive value");
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
252
|
+
var defineProperty$2 = Object.defineProperty;
|
|
253
|
+
|
|
254
|
+
var setGlobal = function (key, value) {
|
|
255
|
+
try {
|
|
256
|
+
defineProperty$2(global$1, key, { value: value, configurable: true, writable: true });
|
|
257
|
+
} catch (error) {
|
|
258
|
+
global$1[key] = value;
|
|
259
|
+
} return value;
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
var SHARED = '__core-js_shared__';
|
|
263
|
+
var store$1 = global$1[SHARED] || setGlobal(SHARED, {});
|
|
264
|
+
|
|
265
|
+
var sharedStore = store$1;
|
|
266
|
+
|
|
267
|
+
var shared = createCommonjsModule(function (module) {
|
|
268
|
+
(module.exports = function (key, value) {
|
|
269
|
+
return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
|
|
270
|
+
})('versions', []).push({
|
|
271
|
+
version: '3.19.3',
|
|
272
|
+
mode: 'global',
|
|
273
|
+
copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
|
|
274
|
+
});
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
var Object$3 = global$1.Object;
|
|
278
|
+
|
|
279
|
+
// `ToObject` abstract operation
|
|
280
|
+
// https://tc39.es/ecma262/#sec-toobject
|
|
281
|
+
var toObject = function (argument) {
|
|
282
|
+
return Object$3(requireObjectCoercible(argument));
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
var hasOwnProperty = functionUncurryThis({}.hasOwnProperty);
|
|
286
|
+
|
|
287
|
+
// `HasOwnProperty` abstract operation
|
|
288
|
+
// https://tc39.es/ecma262/#sec-hasownproperty
|
|
289
|
+
var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
|
|
290
|
+
return hasOwnProperty(toObject(it), key);
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
var id$1 = 0;
|
|
294
|
+
var postfix = Math.random();
|
|
295
|
+
var toString$1 = functionUncurryThis(1.0.toString);
|
|
296
|
+
|
|
297
|
+
var uid = function (key) {
|
|
298
|
+
return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$1(++id$1 + postfix, 36);
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
var WellKnownSymbolsStore = shared('wks');
|
|
302
|
+
var Symbol$1 = global$1.Symbol;
|
|
303
|
+
var symbolFor = Symbol$1 && Symbol$1['for'];
|
|
304
|
+
var createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid;
|
|
305
|
+
|
|
306
|
+
var wellKnownSymbol = function (name) {
|
|
307
|
+
if (!hasOwnProperty_1(WellKnownSymbolsStore, name) || !(nativeSymbol || typeof WellKnownSymbolsStore[name] == 'string')) {
|
|
308
|
+
var description = 'Symbol.' + name;
|
|
309
|
+
if (nativeSymbol && hasOwnProperty_1(Symbol$1, name)) {
|
|
310
|
+
WellKnownSymbolsStore[name] = Symbol$1[name];
|
|
311
|
+
} else if (useSymbolAsUid && symbolFor) {
|
|
312
|
+
WellKnownSymbolsStore[name] = symbolFor(description);
|
|
313
|
+
} else {
|
|
314
|
+
WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
|
|
315
|
+
}
|
|
316
|
+
} return WellKnownSymbolsStore[name];
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
var TypeError$b = global$1.TypeError;
|
|
320
|
+
var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
|
|
321
|
+
|
|
322
|
+
// `ToPrimitive` abstract operation
|
|
323
|
+
// https://tc39.es/ecma262/#sec-toprimitive
|
|
324
|
+
var toPrimitive = function (input, pref) {
|
|
325
|
+
if (!isObject(input) || isSymbol(input)) return input;
|
|
326
|
+
var exoticToPrim = getMethod(input, TO_PRIMITIVE);
|
|
327
|
+
var result;
|
|
328
|
+
if (exoticToPrim) {
|
|
329
|
+
if (pref === undefined) pref = 'default';
|
|
330
|
+
result = functionCall(exoticToPrim, input, pref);
|
|
331
|
+
if (!isObject(result) || isSymbol(result)) return result;
|
|
332
|
+
throw TypeError$b("Can't convert object to primitive value");
|
|
333
|
+
}
|
|
334
|
+
if (pref === undefined) pref = 'number';
|
|
335
|
+
return ordinaryToPrimitive(input, pref);
|
|
336
|
+
};
|
|
337
|
+
|
|
338
|
+
// `ToPropertyKey` abstract operation
|
|
339
|
+
// https://tc39.es/ecma262/#sec-topropertykey
|
|
340
|
+
var toPropertyKey = function (argument) {
|
|
341
|
+
var key = toPrimitive(argument, 'string');
|
|
342
|
+
return isSymbol(key) ? key : key + '';
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
var document$3 = global$1.document;
|
|
346
|
+
// typeof document.createElement is 'object' in old IE
|
|
347
|
+
var EXISTS$1 = isObject(document$3) && isObject(document$3.createElement);
|
|
348
|
+
|
|
349
|
+
var documentCreateElement = function (it) {
|
|
350
|
+
return EXISTS$1 ? document$3.createElement(it) : {};
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
// Thank's IE8 for his funny defineProperty
|
|
354
|
+
var ie8DomDefine = !descriptors && !fails(function () {
|
|
355
|
+
// eslint-disable-next-line es/no-object-defineproperty -- requied for testing
|
|
356
|
+
return Object.defineProperty(documentCreateElement('div'), 'a', {
|
|
357
|
+
get: function () { return 7; }
|
|
358
|
+
}).a != 7;
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
362
|
+
var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
363
|
+
|
|
364
|
+
// `Object.getOwnPropertyDescriptor` method
|
|
365
|
+
// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
|
|
366
|
+
var f$5 = descriptors ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
|
|
367
|
+
O = toIndexedObject(O);
|
|
368
|
+
P = toPropertyKey(P);
|
|
369
|
+
if (ie8DomDefine) try {
|
|
370
|
+
return $getOwnPropertyDescriptor(O, P);
|
|
371
|
+
} catch (error) { /* empty */ }
|
|
372
|
+
if (hasOwnProperty_1(O, P)) return createPropertyDescriptor(!functionCall(objectPropertyIsEnumerable.f, O, P), O[P]);
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
var objectGetOwnPropertyDescriptor = {
|
|
376
|
+
f: f$5
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
var String$4 = global$1.String;
|
|
380
|
+
var TypeError$a = global$1.TypeError;
|
|
381
|
+
|
|
382
|
+
// `Assert: Type(argument) is Object`
|
|
383
|
+
var anObject = function (argument) {
|
|
384
|
+
if (isObject(argument)) return argument;
|
|
385
|
+
throw TypeError$a(String$4(argument) + ' is not an object');
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
var TypeError$9 = global$1.TypeError;
|
|
389
|
+
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
390
|
+
var $defineProperty = Object.defineProperty;
|
|
391
|
+
|
|
392
|
+
// `Object.defineProperty` method
|
|
393
|
+
// https://tc39.es/ecma262/#sec-object.defineproperty
|
|
394
|
+
var f$4 = descriptors ? $defineProperty : function defineProperty(O, P, Attributes) {
|
|
395
|
+
anObject(O);
|
|
396
|
+
P = toPropertyKey(P);
|
|
397
|
+
anObject(Attributes);
|
|
398
|
+
if (ie8DomDefine) try {
|
|
399
|
+
return $defineProperty(O, P, Attributes);
|
|
400
|
+
} catch (error) { /* empty */ }
|
|
401
|
+
if ('get' in Attributes || 'set' in Attributes) throw TypeError$9('Accessors not supported');
|
|
402
|
+
if ('value' in Attributes) O[P] = Attributes.value;
|
|
403
|
+
return O;
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
var objectDefineProperty = {
|
|
407
|
+
f: f$4
|
|
408
|
+
};
|
|
409
|
+
|
|
410
|
+
var createNonEnumerableProperty = descriptors ? function (object, key, value) {
|
|
411
|
+
return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
|
|
412
|
+
} : function (object, key, value) {
|
|
413
|
+
object[key] = value;
|
|
414
|
+
return object;
|
|
415
|
+
};
|
|
416
|
+
|
|
417
|
+
var functionToString$1 = functionUncurryThis(Function.toString);
|
|
418
|
+
|
|
419
|
+
// this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
|
|
420
|
+
if (!isCallable(sharedStore.inspectSource)) {
|
|
421
|
+
sharedStore.inspectSource = function (it) {
|
|
422
|
+
return functionToString$1(it);
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
var inspectSource = sharedStore.inspectSource;
|
|
427
|
+
|
|
428
|
+
var WeakMap$2 = global$1.WeakMap;
|
|
429
|
+
|
|
430
|
+
var nativeWeakMap = isCallable(WeakMap$2) && /native code/.test(inspectSource(WeakMap$2));
|
|
431
|
+
|
|
432
|
+
var keys = shared('keys');
|
|
433
|
+
|
|
434
|
+
var sharedKey = function (key) {
|
|
435
|
+
return keys[key] || (keys[key] = uid(key));
|
|
436
|
+
};
|
|
437
|
+
|
|
438
|
+
var hiddenKeys$1 = {};
|
|
439
|
+
|
|
440
|
+
var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
|
|
441
|
+
var TypeError$8 = global$1.TypeError;
|
|
442
|
+
var WeakMap$1 = global$1.WeakMap;
|
|
443
|
+
var set$1, get, has;
|
|
444
|
+
|
|
445
|
+
var enforce = function (it) {
|
|
446
|
+
return has(it) ? get(it) : set$1(it, {});
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
var getterFor = function (TYPE) {
|
|
450
|
+
return function (it) {
|
|
451
|
+
var state;
|
|
452
|
+
if (!isObject(it) || (state = get(it)).type !== TYPE) {
|
|
453
|
+
throw TypeError$8('Incompatible receiver, ' + TYPE + ' required');
|
|
454
|
+
} return state;
|
|
455
|
+
};
|
|
456
|
+
};
|
|
457
|
+
|
|
458
|
+
if (nativeWeakMap || sharedStore.state) {
|
|
459
|
+
var store = sharedStore.state || (sharedStore.state = new WeakMap$1());
|
|
460
|
+
var wmget = functionUncurryThis(store.get);
|
|
461
|
+
var wmhas = functionUncurryThis(store.has);
|
|
462
|
+
var wmset = functionUncurryThis(store.set);
|
|
463
|
+
set$1 = function (it, metadata) {
|
|
464
|
+
if (wmhas(store, it)) throw new TypeError$8(OBJECT_ALREADY_INITIALIZED);
|
|
465
|
+
metadata.facade = it;
|
|
466
|
+
wmset(store, it, metadata);
|
|
467
|
+
return metadata;
|
|
468
|
+
};
|
|
469
|
+
get = function (it) {
|
|
470
|
+
return wmget(store, it) || {};
|
|
471
|
+
};
|
|
472
|
+
has = function (it) {
|
|
473
|
+
return wmhas(store, it);
|
|
474
|
+
};
|
|
475
|
+
} else {
|
|
476
|
+
var STATE = sharedKey('state');
|
|
477
|
+
hiddenKeys$1[STATE] = true;
|
|
478
|
+
set$1 = function (it, metadata) {
|
|
479
|
+
if (hasOwnProperty_1(it, STATE)) throw new TypeError$8(OBJECT_ALREADY_INITIALIZED);
|
|
480
|
+
metadata.facade = it;
|
|
481
|
+
createNonEnumerableProperty(it, STATE, metadata);
|
|
482
|
+
return metadata;
|
|
483
|
+
};
|
|
484
|
+
get = function (it) {
|
|
485
|
+
return hasOwnProperty_1(it, STATE) ? it[STATE] : {};
|
|
486
|
+
};
|
|
487
|
+
has = function (it) {
|
|
488
|
+
return hasOwnProperty_1(it, STATE);
|
|
489
|
+
};
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
var internalState = {
|
|
493
|
+
set: set$1,
|
|
494
|
+
get: get,
|
|
495
|
+
has: has,
|
|
496
|
+
enforce: enforce,
|
|
497
|
+
getterFor: getterFor
|
|
498
|
+
};
|
|
499
|
+
|
|
500
|
+
var FunctionPrototype$2 = Function.prototype;
|
|
501
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
502
|
+
var getDescriptor = descriptors && Object.getOwnPropertyDescriptor;
|
|
503
|
+
|
|
504
|
+
var EXISTS = hasOwnProperty_1(FunctionPrototype$2, 'name');
|
|
505
|
+
// additional protection from minified / mangled / dropped function names
|
|
506
|
+
var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
|
|
507
|
+
var CONFIGURABLE = EXISTS && (!descriptors || (descriptors && getDescriptor(FunctionPrototype$2, 'name').configurable));
|
|
508
|
+
|
|
509
|
+
var functionName = {
|
|
510
|
+
EXISTS: EXISTS,
|
|
511
|
+
PROPER: PROPER,
|
|
512
|
+
CONFIGURABLE: CONFIGURABLE
|
|
513
|
+
};
|
|
514
|
+
|
|
515
|
+
var redefine = createCommonjsModule(function (module) {
|
|
516
|
+
var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
|
|
517
|
+
|
|
518
|
+
var getInternalState = internalState.get;
|
|
519
|
+
var enforceInternalState = internalState.enforce;
|
|
520
|
+
var TEMPLATE = String(String).split('String');
|
|
521
|
+
|
|
522
|
+
(module.exports = function (O, key, value, options) {
|
|
523
|
+
var unsafe = options ? !!options.unsafe : false;
|
|
524
|
+
var simple = options ? !!options.enumerable : false;
|
|
525
|
+
var noTargetGet = options ? !!options.noTargetGet : false;
|
|
526
|
+
var name = options && options.name !== undefined ? options.name : key;
|
|
527
|
+
var state;
|
|
528
|
+
if (isCallable(value)) {
|
|
529
|
+
if (String(name).slice(0, 7) === 'Symbol(') {
|
|
530
|
+
name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
|
|
531
|
+
}
|
|
532
|
+
if (!hasOwnProperty_1(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {
|
|
533
|
+
createNonEnumerableProperty(value, 'name', name);
|
|
534
|
+
}
|
|
535
|
+
state = enforceInternalState(value);
|
|
536
|
+
if (!state.source) {
|
|
537
|
+
state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
if (O === global$1) {
|
|
541
|
+
if (simple) O[key] = value;
|
|
542
|
+
else setGlobal(key, value);
|
|
543
|
+
return;
|
|
544
|
+
} else if (!unsafe) {
|
|
545
|
+
delete O[key];
|
|
546
|
+
} else if (!noTargetGet && O[key]) {
|
|
547
|
+
simple = true;
|
|
548
|
+
}
|
|
549
|
+
if (simple) O[key] = value;
|
|
550
|
+
else createNonEnumerableProperty(O, key, value);
|
|
551
|
+
// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
|
|
552
|
+
})(Function.prototype, 'toString', function toString() {
|
|
553
|
+
return isCallable(this) && getInternalState(this).source || inspectSource(this);
|
|
554
|
+
});
|
|
555
|
+
});
|
|
556
|
+
|
|
557
|
+
var ceil = Math.ceil;
|
|
558
|
+
var floor = Math.floor;
|
|
559
|
+
|
|
560
|
+
// `ToIntegerOrInfinity` abstract operation
|
|
561
|
+
// https://tc39.es/ecma262/#sec-tointegerorinfinity
|
|
562
|
+
var toIntegerOrInfinity = function (argument) {
|
|
563
|
+
var number = +argument;
|
|
564
|
+
// eslint-disable-next-line no-self-compare -- safe
|
|
565
|
+
return number !== number || number === 0 ? 0 : (number > 0 ? floor : ceil)(number);
|
|
566
|
+
};
|
|
567
|
+
|
|
568
|
+
var max$2 = Math.max;
|
|
569
|
+
var min$2 = Math.min;
|
|
570
|
+
|
|
571
|
+
// Helper for a popular repeating case of the spec:
|
|
572
|
+
// Let integer be ? ToInteger(index).
|
|
573
|
+
// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
|
|
574
|
+
var toAbsoluteIndex = function (index, length) {
|
|
575
|
+
var integer = toIntegerOrInfinity(index);
|
|
576
|
+
return integer < 0 ? max$2(integer + length, 0) : min$2(integer, length);
|
|
577
|
+
};
|
|
578
|
+
|
|
579
|
+
var min$1 = Math.min;
|
|
580
|
+
|
|
581
|
+
// `ToLength` abstract operation
|
|
582
|
+
// https://tc39.es/ecma262/#sec-tolength
|
|
583
|
+
var toLength = function (argument) {
|
|
584
|
+
return argument > 0 ? min$1(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
|
|
585
|
+
};
|
|
586
|
+
|
|
587
|
+
// `LengthOfArrayLike` abstract operation
|
|
588
|
+
// https://tc39.es/ecma262/#sec-lengthofarraylike
|
|
589
|
+
var lengthOfArrayLike = function (obj) {
|
|
590
|
+
return toLength(obj.length);
|
|
591
|
+
};
|
|
592
|
+
|
|
593
|
+
// `Array.prototype.{ indexOf, includes }` methods implementation
|
|
594
|
+
var createMethod$2 = function (IS_INCLUDES) {
|
|
595
|
+
return function ($this, el, fromIndex) {
|
|
596
|
+
var O = toIndexedObject($this);
|
|
597
|
+
var length = lengthOfArrayLike(O);
|
|
598
|
+
var index = toAbsoluteIndex(fromIndex, length);
|
|
599
|
+
var value;
|
|
600
|
+
// Array#includes uses SameValueZero equality algorithm
|
|
601
|
+
// eslint-disable-next-line no-self-compare -- NaN check
|
|
602
|
+
if (IS_INCLUDES && el != el) while (length > index) {
|
|
603
|
+
value = O[index++];
|
|
604
|
+
// eslint-disable-next-line no-self-compare -- NaN check
|
|
605
|
+
if (value != value) return true;
|
|
606
|
+
// Array#indexOf ignores holes, Array#includes - not
|
|
607
|
+
} else for (;length > index; index++) {
|
|
608
|
+
if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
|
|
609
|
+
} return !IS_INCLUDES && -1;
|
|
610
|
+
};
|
|
611
|
+
};
|
|
612
|
+
|
|
613
|
+
var arrayIncludes = {
|
|
614
|
+
// `Array.prototype.includes` method
|
|
615
|
+
// https://tc39.es/ecma262/#sec-array.prototype.includes
|
|
616
|
+
includes: createMethod$2(true),
|
|
617
|
+
// `Array.prototype.indexOf` method
|
|
618
|
+
// https://tc39.es/ecma262/#sec-array.prototype.indexof
|
|
619
|
+
indexOf: createMethod$2(false)
|
|
620
|
+
};
|
|
621
|
+
|
|
622
|
+
var indexOf$1 = arrayIncludes.indexOf;
|
|
623
|
+
|
|
624
|
+
|
|
625
|
+
var push$2 = functionUncurryThis([].push);
|
|
626
|
+
|
|
627
|
+
var objectKeysInternal = function (object, names) {
|
|
628
|
+
var O = toIndexedObject(object);
|
|
629
|
+
var i = 0;
|
|
630
|
+
var result = [];
|
|
631
|
+
var key;
|
|
632
|
+
for (key in O) !hasOwnProperty_1(hiddenKeys$1, key) && hasOwnProperty_1(O, key) && push$2(result, key);
|
|
633
|
+
// Don't enum bug & hidden keys
|
|
634
|
+
while (names.length > i) if (hasOwnProperty_1(O, key = names[i++])) {
|
|
635
|
+
~indexOf$1(result, key) || push$2(result, key);
|
|
636
|
+
}
|
|
637
|
+
return result;
|
|
638
|
+
};
|
|
639
|
+
|
|
640
|
+
// IE8- don't enum bug keys
|
|
641
|
+
var enumBugKeys = [
|
|
642
|
+
'constructor',
|
|
643
|
+
'hasOwnProperty',
|
|
644
|
+
'isPrototypeOf',
|
|
645
|
+
'propertyIsEnumerable',
|
|
646
|
+
'toLocaleString',
|
|
647
|
+
'toString',
|
|
648
|
+
'valueOf'
|
|
649
|
+
];
|
|
650
|
+
|
|
651
|
+
var hiddenKeys = enumBugKeys.concat('length', 'prototype');
|
|
652
|
+
|
|
653
|
+
// `Object.getOwnPropertyNames` method
|
|
654
|
+
// https://tc39.es/ecma262/#sec-object.getownpropertynames
|
|
655
|
+
// eslint-disable-next-line es/no-object-getownpropertynames -- safe
|
|
656
|
+
var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
|
|
657
|
+
return objectKeysInternal(O, hiddenKeys);
|
|
658
|
+
};
|
|
659
|
+
|
|
660
|
+
var objectGetOwnPropertyNames = {
|
|
661
|
+
f: f$3
|
|
662
|
+
};
|
|
663
|
+
|
|
664
|
+
// eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
|
|
665
|
+
var f$2 = Object.getOwnPropertySymbols;
|
|
666
|
+
|
|
667
|
+
var objectGetOwnPropertySymbols = {
|
|
668
|
+
f: f$2
|
|
669
|
+
};
|
|
670
|
+
|
|
671
|
+
var concat = functionUncurryThis([].concat);
|
|
672
|
+
|
|
673
|
+
// all object keys, includes non-enumerable and symbols
|
|
674
|
+
var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
|
|
675
|
+
var keys = objectGetOwnPropertyNames.f(anObject(it));
|
|
676
|
+
var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
|
|
677
|
+
return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
|
|
678
|
+
};
|
|
679
|
+
|
|
680
|
+
var copyConstructorProperties = function (target, source) {
|
|
681
|
+
var keys = ownKeys(source);
|
|
682
|
+
var defineProperty = objectDefineProperty.f;
|
|
683
|
+
var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
|
|
684
|
+
for (var i = 0; i < keys.length; i++) {
|
|
685
|
+
var key = keys[i];
|
|
686
|
+
if (!hasOwnProperty_1(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
|
|
687
|
+
}
|
|
688
|
+
};
|
|
689
|
+
|
|
690
|
+
var replacement = /#|\.prototype\./;
|
|
691
|
+
|
|
692
|
+
var isForced = function (feature, detection) {
|
|
693
|
+
var value = data[normalize(feature)];
|
|
694
|
+
return value == POLYFILL ? true
|
|
695
|
+
: value == NATIVE ? false
|
|
696
|
+
: isCallable(detection) ? fails(detection)
|
|
697
|
+
: !!detection;
|
|
698
|
+
};
|
|
699
|
+
|
|
700
|
+
var normalize = isForced.normalize = function (string) {
|
|
701
|
+
return String(string).replace(replacement, '.').toLowerCase();
|
|
702
|
+
};
|
|
703
|
+
|
|
704
|
+
var data = isForced.data = {};
|
|
705
|
+
var NATIVE = isForced.NATIVE = 'N';
|
|
706
|
+
var POLYFILL = isForced.POLYFILL = 'P';
|
|
707
|
+
|
|
708
|
+
var isForced_1 = isForced;
|
|
709
|
+
|
|
710
|
+
var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
|
|
711
|
+
|
|
712
|
+
|
|
713
|
+
|
|
714
|
+
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
/*
|
|
718
|
+
options.target - name of the target object
|
|
719
|
+
options.global - target is the global object
|
|
720
|
+
options.stat - export as static methods of target
|
|
721
|
+
options.proto - export as prototype methods of target
|
|
722
|
+
options.real - real prototype method for the `pure` version
|
|
723
|
+
options.forced - export even if the native feature is available
|
|
724
|
+
options.bind - bind methods to the target, required for the `pure` version
|
|
725
|
+
options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
|
|
726
|
+
options.unsafe - use the simple assignment of property instead of delete + defineProperty
|
|
727
|
+
options.sham - add a flag to not completely full polyfills
|
|
728
|
+
options.enumerable - export as enumerable property
|
|
729
|
+
options.noTargetGet - prevent calling a getter on target
|
|
730
|
+
options.name - the .name of the function if it does not match the key
|
|
731
|
+
*/
|
|
732
|
+
var _export = function (options, source) {
|
|
733
|
+
var TARGET = options.target;
|
|
734
|
+
var GLOBAL = options.global;
|
|
735
|
+
var STATIC = options.stat;
|
|
736
|
+
var FORCED, target, key, targetProperty, sourceProperty, descriptor;
|
|
737
|
+
if (GLOBAL) {
|
|
738
|
+
target = global$1;
|
|
739
|
+
} else if (STATIC) {
|
|
740
|
+
target = global$1[TARGET] || setGlobal(TARGET, {});
|
|
741
|
+
} else {
|
|
742
|
+
target = (global$1[TARGET] || {}).prototype;
|
|
743
|
+
}
|
|
744
|
+
if (target) for (key in source) {
|
|
745
|
+
sourceProperty = source[key];
|
|
746
|
+
if (options.noTargetGet) {
|
|
747
|
+
descriptor = getOwnPropertyDescriptor$1(target, key);
|
|
748
|
+
targetProperty = descriptor && descriptor.value;
|
|
749
|
+
} else targetProperty = target[key];
|
|
750
|
+
FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
|
|
751
|
+
// contained in target
|
|
752
|
+
if (!FORCED && targetProperty !== undefined) {
|
|
753
|
+
if (typeof sourceProperty == typeof targetProperty) continue;
|
|
754
|
+
copyConstructorProperties(sourceProperty, targetProperty);
|
|
755
|
+
}
|
|
756
|
+
// add a flag to not completely full polyfills
|
|
757
|
+
if (options.sham || (targetProperty && targetProperty.sham)) {
|
|
758
|
+
createNonEnumerableProperty(sourceProperty, 'sham', true);
|
|
759
|
+
}
|
|
760
|
+
// extend global
|
|
761
|
+
redefine(target, key, sourceProperty, options);
|
|
762
|
+
}
|
|
763
|
+
};
|
|
764
|
+
|
|
765
|
+
// `IsArray` abstract operation
|
|
766
|
+
// https://tc39.es/ecma262/#sec-isarray
|
|
767
|
+
// eslint-disable-next-line es/no-array-isarray -- safe
|
|
768
|
+
var isArray = Array.isArray || function isArray(argument) {
|
|
769
|
+
return classofRaw(argument) == 'Array';
|
|
770
|
+
};
|
|
771
|
+
|
|
772
|
+
var TO_STRING_TAG$3 = wellKnownSymbol('toStringTag');
|
|
773
|
+
var test = {};
|
|
774
|
+
|
|
775
|
+
test[TO_STRING_TAG$3] = 'z';
|
|
776
|
+
|
|
777
|
+
var toStringTagSupport = String(test) === '[object z]';
|
|
778
|
+
|
|
779
|
+
var TO_STRING_TAG$2 = wellKnownSymbol('toStringTag');
|
|
780
|
+
var Object$2 = global$1.Object;
|
|
781
|
+
|
|
782
|
+
// ES3 wrong here
|
|
783
|
+
var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
|
|
784
|
+
|
|
785
|
+
// fallback for IE11 Script Access Denied error
|
|
786
|
+
var tryGet = function (it, key) {
|
|
787
|
+
try {
|
|
788
|
+
return it[key];
|
|
789
|
+
} catch (error) { /* empty */ }
|
|
790
|
+
};
|
|
791
|
+
|
|
792
|
+
// getting tag from ES6+ `Object.prototype.toString`
|
|
793
|
+
var classof = toStringTagSupport ? classofRaw : function (it) {
|
|
794
|
+
var O, tag, result;
|
|
795
|
+
return it === undefined ? 'Undefined' : it === null ? 'Null'
|
|
796
|
+
// @@toStringTag case
|
|
797
|
+
: typeof (tag = tryGet(O = Object$2(it), TO_STRING_TAG$2)) == 'string' ? tag
|
|
798
|
+
// builtinTag case
|
|
799
|
+
: CORRECT_ARGUMENTS ? classofRaw(O)
|
|
800
|
+
// ES3 arguments fallback
|
|
801
|
+
: (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result;
|
|
802
|
+
};
|
|
803
|
+
|
|
804
|
+
var noop = function () { /* empty */ };
|
|
805
|
+
var empty = [];
|
|
806
|
+
var construct = getBuiltIn('Reflect', 'construct');
|
|
807
|
+
var constructorRegExp = /^\s*(?:class|function)\b/;
|
|
808
|
+
var exec$1 = functionUncurryThis(constructorRegExp.exec);
|
|
809
|
+
var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
|
|
810
|
+
|
|
811
|
+
var isConstructorModern = function (argument) {
|
|
812
|
+
if (!isCallable(argument)) return false;
|
|
813
|
+
try {
|
|
814
|
+
construct(noop, empty, argument);
|
|
815
|
+
return true;
|
|
816
|
+
} catch (error) {
|
|
817
|
+
return false;
|
|
818
|
+
}
|
|
819
|
+
};
|
|
820
|
+
|
|
821
|
+
var isConstructorLegacy = function (argument) {
|
|
822
|
+
if (!isCallable(argument)) return false;
|
|
823
|
+
switch (classof(argument)) {
|
|
824
|
+
case 'AsyncFunction':
|
|
825
|
+
case 'GeneratorFunction':
|
|
826
|
+
case 'AsyncGeneratorFunction': return false;
|
|
827
|
+
// we can't check .prototype since constructors produced by .bind haven't it
|
|
828
|
+
} return INCORRECT_TO_STRING || !!exec$1(constructorRegExp, inspectSource(argument));
|
|
829
|
+
};
|
|
830
|
+
|
|
831
|
+
// `IsConstructor` abstract operation
|
|
832
|
+
// https://tc39.es/ecma262/#sec-isconstructor
|
|
833
|
+
var isConstructor = !construct || fails(function () {
|
|
834
|
+
var called;
|
|
835
|
+
return isConstructorModern(isConstructorModern.call)
|
|
836
|
+
|| !isConstructorModern(Object)
|
|
837
|
+
|| !isConstructorModern(function () { called = true; })
|
|
838
|
+
|| called;
|
|
839
|
+
}) ? isConstructorLegacy : isConstructorModern;
|
|
840
|
+
|
|
841
|
+
var createProperty = function (object, key, value) {
|
|
842
|
+
var propertyKey = toPropertyKey(key);
|
|
843
|
+
if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
|
|
844
|
+
else object[propertyKey] = value;
|
|
845
|
+
};
|
|
846
|
+
|
|
847
|
+
var SPECIES$6 = wellKnownSymbol('species');
|
|
848
|
+
|
|
849
|
+
var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
|
|
850
|
+
// We can't use this feature detection in V8 since it causes
|
|
851
|
+
// deoptimization and serious performance degradation
|
|
852
|
+
// https://github.com/zloirock/core-js/issues/677
|
|
853
|
+
return engineV8Version >= 51 || !fails(function () {
|
|
854
|
+
var array = [];
|
|
855
|
+
var constructor = array.constructor = {};
|
|
856
|
+
constructor[SPECIES$6] = function () {
|
|
857
|
+
return { foo: 1 };
|
|
858
|
+
};
|
|
859
|
+
return array[METHOD_NAME](Boolean).foo !== 1;
|
|
860
|
+
});
|
|
861
|
+
};
|
|
862
|
+
|
|
863
|
+
var arraySlice = functionUncurryThis([].slice);
|
|
864
|
+
|
|
865
|
+
var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('slice');
|
|
866
|
+
|
|
867
|
+
var SPECIES$5 = wellKnownSymbol('species');
|
|
868
|
+
var Array$3 = global$1.Array;
|
|
869
|
+
var max$1 = Math.max;
|
|
870
|
+
|
|
871
|
+
// `Array.prototype.slice` method
|
|
872
|
+
// https://tc39.es/ecma262/#sec-array.prototype.slice
|
|
873
|
+
// fallback for not array-like ES3 strings and DOM objects
|
|
874
|
+
_export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
|
|
875
|
+
slice: function slice(start, end) {
|
|
876
|
+
var O = toIndexedObject(this);
|
|
877
|
+
var length = lengthOfArrayLike(O);
|
|
878
|
+
var k = toAbsoluteIndex(start, length);
|
|
879
|
+
var fin = toAbsoluteIndex(end === undefined ? length : end, length);
|
|
880
|
+
// inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
|
|
881
|
+
var Constructor, result, n;
|
|
882
|
+
if (isArray(O)) {
|
|
883
|
+
Constructor = O.constructor;
|
|
884
|
+
// cross-realm fallback
|
|
885
|
+
if (isConstructor(Constructor) && (Constructor === Array$3 || isArray(Constructor.prototype))) {
|
|
886
|
+
Constructor = undefined;
|
|
887
|
+
} else if (isObject(Constructor)) {
|
|
888
|
+
Constructor = Constructor[SPECIES$5];
|
|
889
|
+
if (Constructor === null) Constructor = undefined;
|
|
890
|
+
}
|
|
891
|
+
if (Constructor === Array$3 || Constructor === undefined) {
|
|
892
|
+
return arraySlice(O, k, fin);
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
result = new (Constructor === undefined ? Array$3 : Constructor)(max$1(fin - k, 0));
|
|
896
|
+
for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
|
|
897
|
+
result.length = n;
|
|
898
|
+
return result;
|
|
899
|
+
}
|
|
900
|
+
});
|
|
901
|
+
|
|
902
|
+
// `Object.prototype.toString` method implementation
|
|
903
|
+
// https://tc39.es/ecma262/#sec-object.prototype.tostring
|
|
904
|
+
var objectToString = toStringTagSupport ? {}.toString : function toString() {
|
|
905
|
+
return '[object ' + classof(this) + ']';
|
|
906
|
+
};
|
|
907
|
+
|
|
908
|
+
// `Object.prototype.toString` method
|
|
909
|
+
// https://tc39.es/ecma262/#sec-object.prototype.tostring
|
|
910
|
+
if (!toStringTagSupport) {
|
|
911
|
+
redefine(Object.prototype, 'toString', objectToString, { unsafe: true });
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
var String$3 = global$1.String;
|
|
915
|
+
|
|
916
|
+
var toString = function (argument) {
|
|
917
|
+
if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
|
|
918
|
+
return String$3(argument);
|
|
919
|
+
};
|
|
920
|
+
|
|
921
|
+
// `RegExp.prototype.flags` getter implementation
|
|
922
|
+
// https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
|
|
923
|
+
var regexpFlags = function () {
|
|
924
|
+
var that = anObject(this);
|
|
925
|
+
var result = '';
|
|
926
|
+
if (that.global) result += 'g';
|
|
927
|
+
if (that.ignoreCase) result += 'i';
|
|
928
|
+
if (that.multiline) result += 'm';
|
|
929
|
+
if (that.dotAll) result += 's';
|
|
930
|
+
if (that.unicode) result += 'u';
|
|
931
|
+
if (that.sticky) result += 'y';
|
|
932
|
+
return result;
|
|
933
|
+
};
|
|
934
|
+
|
|
935
|
+
// babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
|
|
936
|
+
var $RegExp$2 = global$1.RegExp;
|
|
937
|
+
|
|
938
|
+
var UNSUPPORTED_Y$2 = fails(function () {
|
|
939
|
+
var re = $RegExp$2('a', 'y');
|
|
940
|
+
re.lastIndex = 2;
|
|
941
|
+
return re.exec('abcd') != null;
|
|
942
|
+
});
|
|
943
|
+
|
|
944
|
+
// UC Browser bug
|
|
945
|
+
// https://github.com/zloirock/core-js/issues/1008
|
|
946
|
+
var MISSED_STICKY = UNSUPPORTED_Y$2 || fails(function () {
|
|
947
|
+
return !$RegExp$2('a', 'y').sticky;
|
|
948
|
+
});
|
|
949
|
+
|
|
950
|
+
var BROKEN_CARET = UNSUPPORTED_Y$2 || fails(function () {
|
|
951
|
+
// https://bugzilla.mozilla.org/show_bug.cgi?id=773687
|
|
952
|
+
var re = $RegExp$2('^r', 'gy');
|
|
953
|
+
re.lastIndex = 2;
|
|
954
|
+
return re.exec('str') != null;
|
|
955
|
+
});
|
|
956
|
+
|
|
957
|
+
var regexpStickyHelpers = {
|
|
958
|
+
BROKEN_CARET: BROKEN_CARET,
|
|
959
|
+
MISSED_STICKY: MISSED_STICKY,
|
|
960
|
+
UNSUPPORTED_Y: UNSUPPORTED_Y$2
|
|
961
|
+
};
|
|
962
|
+
|
|
963
|
+
// `Object.keys` method
|
|
964
|
+
// https://tc39.es/ecma262/#sec-object.keys
|
|
965
|
+
// eslint-disable-next-line es/no-object-keys -- safe
|
|
966
|
+
var objectKeys = Object.keys || function keys(O) {
|
|
967
|
+
return objectKeysInternal(O, enumBugKeys);
|
|
968
|
+
};
|
|
969
|
+
|
|
970
|
+
// `Object.defineProperties` method
|
|
971
|
+
// https://tc39.es/ecma262/#sec-object.defineproperties
|
|
972
|
+
// eslint-disable-next-line es/no-object-defineproperties -- safe
|
|
973
|
+
var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
|
|
974
|
+
anObject(O);
|
|
975
|
+
var props = toIndexedObject(Properties);
|
|
976
|
+
var keys = objectKeys(Properties);
|
|
977
|
+
var length = keys.length;
|
|
978
|
+
var index = 0;
|
|
979
|
+
var key;
|
|
980
|
+
while (length > index) objectDefineProperty.f(O, key = keys[index++], props[key]);
|
|
981
|
+
return O;
|
|
982
|
+
};
|
|
983
|
+
|
|
984
|
+
var html = getBuiltIn('document', 'documentElement');
|
|
985
|
+
|
|
986
|
+
/* global ActiveXObject -- old IE, WSH */
|
|
987
|
+
|
|
988
|
+
var GT = '>';
|
|
989
|
+
var LT = '<';
|
|
990
|
+
var PROTOTYPE = 'prototype';
|
|
991
|
+
var SCRIPT = 'script';
|
|
992
|
+
var IE_PROTO$1 = sharedKey('IE_PROTO');
|
|
993
|
+
|
|
994
|
+
var EmptyConstructor = function () { /* empty */ };
|
|
995
|
+
|
|
996
|
+
var scriptTag = function (content) {
|
|
997
|
+
return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
|
|
998
|
+
};
|
|
999
|
+
|
|
1000
|
+
// Create object with fake `null` prototype: use ActiveX Object with cleared prototype
|
|
1001
|
+
var NullProtoObjectViaActiveX = function (activeXDocument) {
|
|
1002
|
+
activeXDocument.write(scriptTag(''));
|
|
1003
|
+
activeXDocument.close();
|
|
1004
|
+
var temp = activeXDocument.parentWindow.Object;
|
|
1005
|
+
activeXDocument = null; // avoid memory leak
|
|
1006
|
+
return temp;
|
|
1007
|
+
};
|
|
1008
|
+
|
|
1009
|
+
// Create object with fake `null` prototype: use iframe Object with cleared prototype
|
|
1010
|
+
var NullProtoObjectViaIFrame = function () {
|
|
1011
|
+
// Thrash, waste and sodomy: IE GC bug
|
|
1012
|
+
var iframe = documentCreateElement('iframe');
|
|
1013
|
+
var JS = 'java' + SCRIPT + ':';
|
|
1014
|
+
var iframeDocument;
|
|
1015
|
+
iframe.style.display = 'none';
|
|
1016
|
+
html.appendChild(iframe);
|
|
1017
|
+
// https://github.com/zloirock/core-js/issues/475
|
|
1018
|
+
iframe.src = String(JS);
|
|
1019
|
+
iframeDocument = iframe.contentWindow.document;
|
|
1020
|
+
iframeDocument.open();
|
|
1021
|
+
iframeDocument.write(scriptTag('document.F=Object'));
|
|
1022
|
+
iframeDocument.close();
|
|
1023
|
+
return iframeDocument.F;
|
|
1024
|
+
};
|
|
1025
|
+
|
|
1026
|
+
// Check for document.domain and active x support
|
|
1027
|
+
// No need to use active x approach when document.domain is not set
|
|
1028
|
+
// see https://github.com/es-shims/es5-shim/issues/150
|
|
1029
|
+
// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
|
|
1030
|
+
// avoid IE GC bug
|
|
1031
|
+
var activeXDocument;
|
|
1032
|
+
var NullProtoObject = function () {
|
|
1033
|
+
try {
|
|
1034
|
+
activeXDocument = new ActiveXObject('htmlfile');
|
|
1035
|
+
} catch (error) { /* ignore */ }
|
|
1036
|
+
NullProtoObject = typeof document != 'undefined'
|
|
1037
|
+
? document.domain && activeXDocument
|
|
1038
|
+
? NullProtoObjectViaActiveX(activeXDocument) // old IE
|
|
1039
|
+
: NullProtoObjectViaIFrame()
|
|
1040
|
+
: NullProtoObjectViaActiveX(activeXDocument); // WSH
|
|
1041
|
+
var length = enumBugKeys.length;
|
|
1042
|
+
while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
|
|
1043
|
+
return NullProtoObject();
|
|
1044
|
+
};
|
|
1045
|
+
|
|
1046
|
+
hiddenKeys$1[IE_PROTO$1] = true;
|
|
1047
|
+
|
|
1048
|
+
// `Object.create` method
|
|
1049
|
+
// https://tc39.es/ecma262/#sec-object.create
|
|
1050
|
+
var objectCreate = Object.create || function create(O, Properties) {
|
|
1051
|
+
var result;
|
|
1052
|
+
if (O !== null) {
|
|
1053
|
+
EmptyConstructor[PROTOTYPE] = anObject(O);
|
|
1054
|
+
result = new EmptyConstructor();
|
|
1055
|
+
EmptyConstructor[PROTOTYPE] = null;
|
|
1056
|
+
// add "__proto__" for Object.getPrototypeOf polyfill
|
|
1057
|
+
result[IE_PROTO$1] = O;
|
|
1058
|
+
} else result = NullProtoObject();
|
|
1059
|
+
return Properties === undefined ? result : objectDefineProperties(result, Properties);
|
|
1060
|
+
};
|
|
1061
|
+
|
|
1062
|
+
// babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError
|
|
1063
|
+
var $RegExp$1 = global$1.RegExp;
|
|
1064
|
+
|
|
1065
|
+
var regexpUnsupportedDotAll = fails(function () {
|
|
1066
|
+
var re = $RegExp$1('.', 's');
|
|
1067
|
+
return !(re.dotAll && re.exec('\n') && re.flags === 's');
|
|
1068
|
+
});
|
|
1069
|
+
|
|
1070
|
+
// babel-minify and Closure Compiler transpiles RegExp('(?<a>b)', 'g') -> /(?<a>b)/g and it causes SyntaxError
|
|
1071
|
+
var $RegExp = global$1.RegExp;
|
|
1072
|
+
|
|
1073
|
+
var regexpUnsupportedNcg = fails(function () {
|
|
1074
|
+
var re = $RegExp('(?<a>b)', 'g');
|
|
1075
|
+
return re.exec('b').groups.a !== 'b' ||
|
|
1076
|
+
'b'.replace(re, '$<a>c') !== 'bc';
|
|
1077
|
+
});
|
|
1078
|
+
|
|
1079
|
+
/* eslint-disable regexp/no-empty-capturing-group, regexp/no-empty-group, regexp/no-lazy-ends -- testing */
|
|
1080
|
+
/* eslint-disable regexp/no-useless-quantifier -- testing */
|
|
1081
|
+
|
|
1082
|
+
|
|
1083
|
+
|
|
1084
|
+
|
|
1085
|
+
|
|
1086
|
+
|
|
1087
|
+
|
|
1088
|
+
var getInternalState$3 = internalState.get;
|
|
1089
|
+
|
|
1090
|
+
|
|
1091
|
+
|
|
1092
|
+
var nativeReplace = shared('native-string-replace', String.prototype.replace);
|
|
1093
|
+
var nativeExec = RegExp.prototype.exec;
|
|
1094
|
+
var patchedExec = nativeExec;
|
|
1095
|
+
var charAt$3 = functionUncurryThis(''.charAt);
|
|
1096
|
+
var indexOf = functionUncurryThis(''.indexOf);
|
|
1097
|
+
var replace = functionUncurryThis(''.replace);
|
|
1098
|
+
var stringSlice$2 = functionUncurryThis(''.slice);
|
|
1099
|
+
|
|
1100
|
+
var UPDATES_LAST_INDEX_WRONG = (function () {
|
|
1101
|
+
var re1 = /a/;
|
|
1102
|
+
var re2 = /b*/g;
|
|
1103
|
+
functionCall(nativeExec, re1, 'a');
|
|
1104
|
+
functionCall(nativeExec, re2, 'a');
|
|
1105
|
+
return re1.lastIndex !== 0 || re2.lastIndex !== 0;
|
|
1106
|
+
})();
|
|
1107
|
+
|
|
1108
|
+
var UNSUPPORTED_Y$1 = regexpStickyHelpers.BROKEN_CARET;
|
|
1109
|
+
|
|
1110
|
+
// nonparticipating capturing group, copied from es5-shim's String#split patch.
|
|
1111
|
+
var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
|
|
1112
|
+
|
|
1113
|
+
var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y$1 || regexpUnsupportedDotAll || regexpUnsupportedNcg;
|
|
1114
|
+
|
|
1115
|
+
if (PATCH) {
|
|
1116
|
+
patchedExec = function exec(string) {
|
|
1117
|
+
var re = this;
|
|
1118
|
+
var state = getInternalState$3(re);
|
|
1119
|
+
var str = toString(string);
|
|
1120
|
+
var raw = state.raw;
|
|
1121
|
+
var result, reCopy, lastIndex, match, i, object, group;
|
|
1122
|
+
|
|
1123
|
+
if (raw) {
|
|
1124
|
+
raw.lastIndex = re.lastIndex;
|
|
1125
|
+
result = functionCall(patchedExec, raw, str);
|
|
1126
|
+
re.lastIndex = raw.lastIndex;
|
|
1127
|
+
return result;
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
var groups = state.groups;
|
|
1131
|
+
var sticky = UNSUPPORTED_Y$1 && re.sticky;
|
|
1132
|
+
var flags = functionCall(regexpFlags, re);
|
|
1133
|
+
var source = re.source;
|
|
1134
|
+
var charsAdded = 0;
|
|
1135
|
+
var strCopy = str;
|
|
1136
|
+
|
|
1137
|
+
if (sticky) {
|
|
1138
|
+
flags = replace(flags, 'y', '');
|
|
1139
|
+
if (indexOf(flags, 'g') === -1) {
|
|
1140
|
+
flags += 'g';
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1143
|
+
strCopy = stringSlice$2(str, re.lastIndex);
|
|
1144
|
+
// Support anchored sticky behavior.
|
|
1145
|
+
if (re.lastIndex > 0 && (!re.multiline || re.multiline && charAt$3(str, re.lastIndex - 1) !== '\n')) {
|
|
1146
|
+
source = '(?: ' + source + ')';
|
|
1147
|
+
strCopy = ' ' + strCopy;
|
|
1148
|
+
charsAdded++;
|
|
1149
|
+
}
|
|
1150
|
+
// ^(? + rx + ) is needed, in combination with some str slicing, to
|
|
1151
|
+
// simulate the 'y' flag.
|
|
1152
|
+
reCopy = new RegExp('^(?:' + source + ')', flags);
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
if (NPCG_INCLUDED) {
|
|
1156
|
+
reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
|
|
1157
|
+
}
|
|
1158
|
+
if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
|
|
1159
|
+
|
|
1160
|
+
match = functionCall(nativeExec, sticky ? reCopy : re, strCopy);
|
|
1161
|
+
|
|
1162
|
+
if (sticky) {
|
|
1163
|
+
if (match) {
|
|
1164
|
+
match.input = stringSlice$2(match.input, charsAdded);
|
|
1165
|
+
match[0] = stringSlice$2(match[0], charsAdded);
|
|
1166
|
+
match.index = re.lastIndex;
|
|
1167
|
+
re.lastIndex += match[0].length;
|
|
1168
|
+
} else re.lastIndex = 0;
|
|
1169
|
+
} else if (UPDATES_LAST_INDEX_WRONG && match) {
|
|
1170
|
+
re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
|
|
1171
|
+
}
|
|
1172
|
+
if (NPCG_INCLUDED && match && match.length > 1) {
|
|
1173
|
+
// Fix browsers whose `exec` methods don't consistently return `undefined`
|
|
1174
|
+
// for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
|
|
1175
|
+
functionCall(nativeReplace, match[0], reCopy, function () {
|
|
1176
|
+
for (i = 1; i < arguments.length - 2; i++) {
|
|
1177
|
+
if (arguments[i] === undefined) match[i] = undefined;
|
|
1178
|
+
}
|
|
1179
|
+
});
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
if (match && groups) {
|
|
1183
|
+
match.groups = object = objectCreate(null);
|
|
1184
|
+
for (i = 0; i < groups.length; i++) {
|
|
1185
|
+
group = groups[i];
|
|
1186
|
+
object[group[0]] = match[group[1]];
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
return match;
|
|
1191
|
+
};
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
var regexpExec = patchedExec;
|
|
1195
|
+
|
|
1196
|
+
// `RegExp.prototype.exec` method
|
|
1197
|
+
// https://tc39.es/ecma262/#sec-regexp.prototype.exec
|
|
1198
|
+
_export({ target: 'RegExp', proto: true, forced: /./.exec !== regexpExec }, {
|
|
1199
|
+
exec: regexpExec
|
|
1200
|
+
});
|
|
1201
|
+
|
|
1202
|
+
var FunctionPrototype$1 = Function.prototype;
|
|
1203
|
+
var apply = FunctionPrototype$1.apply;
|
|
1204
|
+
var bind$2 = FunctionPrototype$1.bind;
|
|
1205
|
+
var call = FunctionPrototype$1.call;
|
|
1206
|
+
|
|
1207
|
+
// eslint-disable-next-line es/no-reflect -- safe
|
|
1208
|
+
var functionApply = typeof Reflect == 'object' && Reflect.apply || (bind$2 ? call.bind(apply) : function () {
|
|
1209
|
+
return call.apply(apply, arguments);
|
|
1210
|
+
});
|
|
1211
|
+
|
|
1212
|
+
// TODO: Remove from `core-js@4` since it's moved to entry points
|
|
1213
|
+
|
|
1214
|
+
|
|
1215
|
+
|
|
1216
|
+
|
|
1217
|
+
|
|
1218
|
+
|
|
1219
|
+
|
|
1220
|
+
|
|
1221
|
+
var SPECIES$4 = wellKnownSymbol('species');
|
|
1222
|
+
var RegExpPrototype$1 = RegExp.prototype;
|
|
1223
|
+
|
|
1224
|
+
var fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) {
|
|
1225
|
+
var SYMBOL = wellKnownSymbol(KEY);
|
|
1226
|
+
|
|
1227
|
+
var DELEGATES_TO_SYMBOL = !fails(function () {
|
|
1228
|
+
// String methods call symbol-named RegEp methods
|
|
1229
|
+
var O = {};
|
|
1230
|
+
O[SYMBOL] = function () { return 7; };
|
|
1231
|
+
return ''[KEY](O) != 7;
|
|
1232
|
+
});
|
|
1233
|
+
|
|
1234
|
+
var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {
|
|
1235
|
+
// Symbol-named RegExp methods call .exec
|
|
1236
|
+
var execCalled = false;
|
|
1237
|
+
var re = /a/;
|
|
1238
|
+
|
|
1239
|
+
if (KEY === 'split') {
|
|
1240
|
+
// We can't use real regex here since it causes deoptimization
|
|
1241
|
+
// and serious performance degradation in V8
|
|
1242
|
+
// https://github.com/zloirock/core-js/issues/306
|
|
1243
|
+
re = {};
|
|
1244
|
+
// RegExp[@@split] doesn't call the regex's exec method, but first creates
|
|
1245
|
+
// a new one. We need to return the patched regex when creating the new one.
|
|
1246
|
+
re.constructor = {};
|
|
1247
|
+
re.constructor[SPECIES$4] = function () { return re; };
|
|
1248
|
+
re.flags = '';
|
|
1249
|
+
re[SYMBOL] = /./[SYMBOL];
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1252
|
+
re.exec = function () { execCalled = true; return null; };
|
|
1253
|
+
|
|
1254
|
+
re[SYMBOL]('');
|
|
1255
|
+
return !execCalled;
|
|
1256
|
+
});
|
|
1257
|
+
|
|
1258
|
+
if (
|
|
1259
|
+
!DELEGATES_TO_SYMBOL ||
|
|
1260
|
+
!DELEGATES_TO_EXEC ||
|
|
1261
|
+
FORCED
|
|
1262
|
+
) {
|
|
1263
|
+
var uncurriedNativeRegExpMethod = functionUncurryThis(/./[SYMBOL]);
|
|
1264
|
+
var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
|
|
1265
|
+
var uncurriedNativeMethod = functionUncurryThis(nativeMethod);
|
|
1266
|
+
var $exec = regexp.exec;
|
|
1267
|
+
if ($exec === regexpExec || $exec === RegExpPrototype$1.exec) {
|
|
1268
|
+
if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
|
|
1269
|
+
// The native String method already delegates to @@method (this
|
|
1270
|
+
// polyfilled function), leasing to infinite recursion.
|
|
1271
|
+
// We avoid it by directly calling the native @@method method.
|
|
1272
|
+
return { done: true, value: uncurriedNativeRegExpMethod(regexp, str, arg2) };
|
|
1273
|
+
}
|
|
1274
|
+
return { done: true, value: uncurriedNativeMethod(str, regexp, arg2) };
|
|
1275
|
+
}
|
|
1276
|
+
return { done: false };
|
|
1277
|
+
});
|
|
1278
|
+
|
|
1279
|
+
redefine(String.prototype, KEY, methods[0]);
|
|
1280
|
+
redefine(RegExpPrototype$1, SYMBOL, methods[1]);
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1283
|
+
if (SHAM) createNonEnumerableProperty(RegExpPrototype$1[SYMBOL], 'sham', true);
|
|
1284
|
+
};
|
|
1285
|
+
|
|
1286
|
+
var MATCH = wellKnownSymbol('match');
|
|
1287
|
+
|
|
1288
|
+
// `IsRegExp` abstract operation
|
|
1289
|
+
// https://tc39.es/ecma262/#sec-isregexp
|
|
1290
|
+
var isRegexp = function (it) {
|
|
1291
|
+
var isRegExp;
|
|
1292
|
+
return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
|
|
1293
|
+
};
|
|
1294
|
+
|
|
1295
|
+
var TypeError$7 = global$1.TypeError;
|
|
1296
|
+
|
|
1297
|
+
// `Assert: IsConstructor(argument) is true`
|
|
1298
|
+
var aConstructor = function (argument) {
|
|
1299
|
+
if (isConstructor(argument)) return argument;
|
|
1300
|
+
throw TypeError$7(tryToString(argument) + ' is not a constructor');
|
|
1301
|
+
};
|
|
1302
|
+
|
|
1303
|
+
var SPECIES$3 = wellKnownSymbol('species');
|
|
1304
|
+
|
|
1305
|
+
// `SpeciesConstructor` abstract operation
|
|
1306
|
+
// https://tc39.es/ecma262/#sec-speciesconstructor
|
|
1307
|
+
var speciesConstructor = function (O, defaultConstructor) {
|
|
1308
|
+
var C = anObject(O).constructor;
|
|
1309
|
+
var S;
|
|
1310
|
+
return C === undefined || (S = anObject(C)[SPECIES$3]) == undefined ? defaultConstructor : aConstructor(S);
|
|
1311
|
+
};
|
|
1312
|
+
|
|
1313
|
+
var charAt$2 = functionUncurryThis(''.charAt);
|
|
1314
|
+
var charCodeAt = functionUncurryThis(''.charCodeAt);
|
|
1315
|
+
var stringSlice$1 = functionUncurryThis(''.slice);
|
|
1316
|
+
|
|
1317
|
+
var createMethod$1 = function (CONVERT_TO_STRING) {
|
|
1318
|
+
return function ($this, pos) {
|
|
1319
|
+
var S = toString(requireObjectCoercible($this));
|
|
1320
|
+
var position = toIntegerOrInfinity(pos);
|
|
1321
|
+
var size = S.length;
|
|
1322
|
+
var first, second;
|
|
1323
|
+
if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
|
|
1324
|
+
first = charCodeAt(S, position);
|
|
1325
|
+
return first < 0xD800 || first > 0xDBFF || position + 1 === size
|
|
1326
|
+
|| (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF
|
|
1327
|
+
? CONVERT_TO_STRING
|
|
1328
|
+
? charAt$2(S, position)
|
|
1329
|
+
: first
|
|
1330
|
+
: CONVERT_TO_STRING
|
|
1331
|
+
? stringSlice$1(S, position, position + 2)
|
|
1332
|
+
: (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
|
|
1333
|
+
};
|
|
1334
|
+
};
|
|
1335
|
+
|
|
1336
|
+
var stringMultibyte = {
|
|
1337
|
+
// `String.prototype.codePointAt` method
|
|
1338
|
+
// https://tc39.es/ecma262/#sec-string.prototype.codepointat
|
|
1339
|
+
codeAt: createMethod$1(false),
|
|
1340
|
+
// `String.prototype.at` method
|
|
1341
|
+
// https://github.com/mathiasbynens/String.prototype.at
|
|
1342
|
+
charAt: createMethod$1(true)
|
|
1343
|
+
};
|
|
1344
|
+
|
|
1345
|
+
var charAt$1 = stringMultibyte.charAt;
|
|
1346
|
+
|
|
1347
|
+
// `AdvanceStringIndex` abstract operation
|
|
1348
|
+
// https://tc39.es/ecma262/#sec-advancestringindex
|
|
1349
|
+
var advanceStringIndex = function (S, index, unicode) {
|
|
1350
|
+
return index + (unicode ? charAt$1(S, index).length : 1);
|
|
1351
|
+
};
|
|
1352
|
+
|
|
1353
|
+
var Array$2 = global$1.Array;
|
|
1354
|
+
var max = Math.max;
|
|
1355
|
+
|
|
1356
|
+
var arraySliceSimple = function (O, start, end) {
|
|
1357
|
+
var length = lengthOfArrayLike(O);
|
|
1358
|
+
var k = toAbsoluteIndex(start, length);
|
|
1359
|
+
var fin = toAbsoluteIndex(end === undefined ? length : end, length);
|
|
1360
|
+
var result = Array$2(max(fin - k, 0));
|
|
1361
|
+
for (var n = 0; k < fin; k++, n++) createProperty(result, n, O[k]);
|
|
1362
|
+
result.length = n;
|
|
1363
|
+
return result;
|
|
1364
|
+
};
|
|
1365
|
+
|
|
1366
|
+
var TypeError$6 = global$1.TypeError;
|
|
1367
|
+
|
|
1368
|
+
// `RegExpExec` abstract operation
|
|
1369
|
+
// https://tc39.es/ecma262/#sec-regexpexec
|
|
1370
|
+
var regexpExecAbstract = function (R, S) {
|
|
1371
|
+
var exec = R.exec;
|
|
1372
|
+
if (isCallable(exec)) {
|
|
1373
|
+
var result = functionCall(exec, R, S);
|
|
1374
|
+
if (result !== null) anObject(result);
|
|
1375
|
+
return result;
|
|
1376
|
+
}
|
|
1377
|
+
if (classofRaw(R) === 'RegExp') return functionCall(regexpExec, R, S);
|
|
1378
|
+
throw TypeError$6('RegExp#exec called on incompatible receiver');
|
|
1379
|
+
};
|
|
1380
|
+
|
|
1381
|
+
var UNSUPPORTED_Y = regexpStickyHelpers.UNSUPPORTED_Y;
|
|
1382
|
+
var MAX_UINT32 = 0xFFFFFFFF;
|
|
1383
|
+
var min = Math.min;
|
|
1384
|
+
var $push = [].push;
|
|
1385
|
+
var exec = functionUncurryThis(/./.exec);
|
|
1386
|
+
var push$1 = functionUncurryThis($push);
|
|
1387
|
+
var stringSlice = functionUncurryThis(''.slice);
|
|
1388
|
+
|
|
1389
|
+
// Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
|
|
1390
|
+
// Weex JS has frozen built-in prototypes, so use try / catch wrapper
|
|
1391
|
+
var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
|
|
1392
|
+
// eslint-disable-next-line regexp/no-empty-group -- required for testing
|
|
1393
|
+
var re = /(?:)/;
|
|
1394
|
+
var originalExec = re.exec;
|
|
1395
|
+
re.exec = function () { return originalExec.apply(this, arguments); };
|
|
1396
|
+
var result = 'ab'.split(re);
|
|
1397
|
+
return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
|
|
1398
|
+
});
|
|
1399
|
+
|
|
1400
|
+
// @@split logic
|
|
1401
|
+
fixRegexpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNative) {
|
|
1402
|
+
var internalSplit;
|
|
1403
|
+
if (
|
|
1404
|
+
'abbc'.split(/(b)*/)[1] == 'c' ||
|
|
1405
|
+
// eslint-disable-next-line regexp/no-empty-group -- required for testing
|
|
1406
|
+
'test'.split(/(?:)/, -1).length != 4 ||
|
|
1407
|
+
'ab'.split(/(?:ab)*/).length != 2 ||
|
|
1408
|
+
'.'.split(/(.?)(.?)/).length != 4 ||
|
|
1409
|
+
// eslint-disable-next-line regexp/no-empty-capturing-group, regexp/no-empty-group -- required for testing
|
|
1410
|
+
'.'.split(/()()/).length > 1 ||
|
|
1411
|
+
''.split(/.?/).length
|
|
1412
|
+
) {
|
|
1413
|
+
// based on es5-shim implementation, need to rework it
|
|
1414
|
+
internalSplit = function (separator, limit) {
|
|
1415
|
+
var string = toString(requireObjectCoercible(this));
|
|
1416
|
+
var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
|
|
1417
|
+
if (lim === 0) return [];
|
|
1418
|
+
if (separator === undefined) return [string];
|
|
1419
|
+
// If `separator` is not a regex, use native split
|
|
1420
|
+
if (!isRegexp(separator)) {
|
|
1421
|
+
return functionCall(nativeSplit, string, separator, lim);
|
|
1422
|
+
}
|
|
1423
|
+
var output = [];
|
|
1424
|
+
var flags = (separator.ignoreCase ? 'i' : '') +
|
|
1425
|
+
(separator.multiline ? 'm' : '') +
|
|
1426
|
+
(separator.unicode ? 'u' : '') +
|
|
1427
|
+
(separator.sticky ? 'y' : '');
|
|
1428
|
+
var lastLastIndex = 0;
|
|
1429
|
+
// Make `global` and avoid `lastIndex` issues by working with a copy
|
|
1430
|
+
var separatorCopy = new RegExp(separator.source, flags + 'g');
|
|
1431
|
+
var match, lastIndex, lastLength;
|
|
1432
|
+
while (match = functionCall(regexpExec, separatorCopy, string)) {
|
|
1433
|
+
lastIndex = separatorCopy.lastIndex;
|
|
1434
|
+
if (lastIndex > lastLastIndex) {
|
|
1435
|
+
push$1(output, stringSlice(string, lastLastIndex, match.index));
|
|
1436
|
+
if (match.length > 1 && match.index < string.length) functionApply($push, output, arraySliceSimple(match, 1));
|
|
1437
|
+
lastLength = match[0].length;
|
|
1438
|
+
lastLastIndex = lastIndex;
|
|
1439
|
+
if (output.length >= lim) break;
|
|
1440
|
+
}
|
|
1441
|
+
if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop
|
|
1442
|
+
}
|
|
1443
|
+
if (lastLastIndex === string.length) {
|
|
1444
|
+
if (lastLength || !exec(separatorCopy, '')) push$1(output, '');
|
|
1445
|
+
} else push$1(output, stringSlice(string, lastLastIndex));
|
|
1446
|
+
return output.length > lim ? arraySliceSimple(output, 0, lim) : output;
|
|
1447
|
+
};
|
|
1448
|
+
// Chakra, V8
|
|
1449
|
+
} else if ('0'.split(undefined, 0).length) {
|
|
1450
|
+
internalSplit = function (separator, limit) {
|
|
1451
|
+
return separator === undefined && limit === 0 ? [] : functionCall(nativeSplit, this, separator, limit);
|
|
1452
|
+
};
|
|
1453
|
+
} else internalSplit = nativeSplit;
|
|
1454
|
+
|
|
1455
|
+
return [
|
|
1456
|
+
// `String.prototype.split` method
|
|
1457
|
+
// https://tc39.es/ecma262/#sec-string.prototype.split
|
|
1458
|
+
function split(separator, limit) {
|
|
1459
|
+
var O = requireObjectCoercible(this);
|
|
1460
|
+
var splitter = separator == undefined ? undefined : getMethod(separator, SPLIT);
|
|
1461
|
+
return splitter
|
|
1462
|
+
? functionCall(splitter, separator, O, limit)
|
|
1463
|
+
: functionCall(internalSplit, toString(O), separator, limit);
|
|
1464
|
+
},
|
|
1465
|
+
// `RegExp.prototype[@@split]` method
|
|
1466
|
+
// https://tc39.es/ecma262/#sec-regexp.prototype-@@split
|
|
1467
|
+
//
|
|
1468
|
+
// NOTE: This cannot be properly polyfilled in engines that don't support
|
|
1469
|
+
// the 'y' flag.
|
|
1470
|
+
function (string, limit) {
|
|
1471
|
+
var rx = anObject(this);
|
|
1472
|
+
var S = toString(string);
|
|
1473
|
+
var res = maybeCallNative(internalSplit, rx, S, limit, internalSplit !== nativeSplit);
|
|
1474
|
+
|
|
1475
|
+
if (res.done) return res.value;
|
|
1476
|
+
|
|
1477
|
+
var C = speciesConstructor(rx, RegExp);
|
|
1478
|
+
|
|
1479
|
+
var unicodeMatching = rx.unicode;
|
|
1480
|
+
var flags = (rx.ignoreCase ? 'i' : '') +
|
|
1481
|
+
(rx.multiline ? 'm' : '') +
|
|
1482
|
+
(rx.unicode ? 'u' : '') +
|
|
1483
|
+
(UNSUPPORTED_Y ? 'g' : 'y');
|
|
1484
|
+
|
|
1485
|
+
// ^(? + rx + ) is needed, in combination with some S slicing, to
|
|
1486
|
+
// simulate the 'y' flag.
|
|
1487
|
+
var splitter = new C(UNSUPPORTED_Y ? '^(?:' + rx.source + ')' : rx, flags);
|
|
1488
|
+
var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
|
|
1489
|
+
if (lim === 0) return [];
|
|
1490
|
+
if (S.length === 0) return regexpExecAbstract(splitter, S) === null ? [S] : [];
|
|
1491
|
+
var p = 0;
|
|
1492
|
+
var q = 0;
|
|
1493
|
+
var A = [];
|
|
1494
|
+
while (q < S.length) {
|
|
1495
|
+
splitter.lastIndex = UNSUPPORTED_Y ? 0 : q;
|
|
1496
|
+
var z = regexpExecAbstract(splitter, UNSUPPORTED_Y ? stringSlice(S, q) : S);
|
|
1497
|
+
var e;
|
|
1498
|
+
if (
|
|
1499
|
+
z === null ||
|
|
1500
|
+
(e = min(toLength(splitter.lastIndex + (UNSUPPORTED_Y ? q : 0)), S.length)) === p
|
|
1501
|
+
) {
|
|
1502
|
+
q = advanceStringIndex(S, q, unicodeMatching);
|
|
1503
|
+
} else {
|
|
1504
|
+
push$1(A, stringSlice(S, p, q));
|
|
1505
|
+
if (A.length === lim) return A;
|
|
1506
|
+
for (var i = 1; i <= z.length - 1; i++) {
|
|
1507
|
+
push$1(A, z[i]);
|
|
1508
|
+
if (A.length === lim) return A;
|
|
1509
|
+
}
|
|
1510
|
+
q = p = e;
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
push$1(A, stringSlice(S, p));
|
|
1514
|
+
return A;
|
|
1515
|
+
}
|
|
1516
|
+
];
|
|
1517
|
+
}, !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC, UNSUPPORTED_Y);
|
|
1518
|
+
|
|
1519
|
+
/******************************************************************************
|
|
1520
|
+
Copyright (c) Microsoft Corporation.
|
|
1521
|
+
|
|
1522
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
1523
|
+
purpose with or without fee is hereby granted.
|
|
1524
|
+
|
|
1525
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
1526
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
1527
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
1528
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
1529
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
1530
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
1531
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
1532
|
+
***************************************************************************** */
|
|
1533
|
+
|
|
1534
|
+
var __assign = function() {
|
|
1535
|
+
__assign = Object.assign || function __assign(t) {
|
|
1536
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
1537
|
+
s = arguments[i];
|
|
1538
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
1539
|
+
}
|
|
1540
|
+
return t;
|
|
1541
|
+
};
|
|
1542
|
+
return __assign.apply(this, arguments);
|
|
1543
|
+
};
|
|
1544
|
+
|
|
1545
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
1546
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
1547
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
1548
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
1549
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
1550
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
1551
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
1552
|
+
});
|
|
1553
|
+
}
|
|
1554
|
+
|
|
1555
|
+
function __generator(thisArg, body) {
|
|
1556
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
1557
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
1558
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
1559
|
+
function step(op) {
|
|
1560
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
1561
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
1562
|
+
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;
|
|
1563
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
1564
|
+
switch (op[0]) {
|
|
1565
|
+
case 0: case 1: t = op; break;
|
|
1566
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
1567
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
1568
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
1569
|
+
default:
|
|
1570
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
1571
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
1572
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
1573
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
1574
|
+
if (t[2]) _.ops.pop();
|
|
1575
|
+
_.trys.pop(); continue;
|
|
1576
|
+
}
|
|
1577
|
+
op = body.call(thisArg, _);
|
|
1578
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
1579
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
|
|
1583
|
+
function __values(o) {
|
|
1584
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
1585
|
+
if (m) return m.call(o);
|
|
1586
|
+
if (o && typeof o.length === "number") return {
|
|
1587
|
+
next: function () {
|
|
1588
|
+
if (o && i >= o.length) o = void 0;
|
|
1589
|
+
return { value: o && o[i++], done: !o };
|
|
1590
|
+
}
|
|
1591
|
+
};
|
|
1592
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
1593
|
+
}
|
|
1594
|
+
|
|
1595
|
+
function __read(o, n) {
|
|
1596
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
1597
|
+
if (!m) return o;
|
|
1598
|
+
var i = m.call(o), r, ar = [], e;
|
|
1599
|
+
try {
|
|
1600
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
1601
|
+
}
|
|
1602
|
+
catch (error) { e = { error: error }; }
|
|
1603
|
+
finally {
|
|
1604
|
+
try {
|
|
1605
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
1606
|
+
}
|
|
1607
|
+
finally { if (e) throw e.error; }
|
|
1608
|
+
}
|
|
1609
|
+
return ar;
|
|
1610
|
+
}
|
|
1611
|
+
|
|
1612
|
+
function __asyncValues(o) {
|
|
1613
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
1614
|
+
var m = o[Symbol.asyncIterator], i;
|
|
1615
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
1616
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
1617
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
1621
|
+
var e = new Error(message);
|
|
1622
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
1623
|
+
};
|
|
1624
|
+
|
|
1625
|
+
var UNSCOPABLES = wellKnownSymbol('unscopables');
|
|
1626
|
+
var ArrayPrototype$1 = Array.prototype;
|
|
1627
|
+
|
|
1628
|
+
// Array.prototype[@@unscopables]
|
|
1629
|
+
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
1630
|
+
if (ArrayPrototype$1[UNSCOPABLES] == undefined) {
|
|
1631
|
+
objectDefineProperty.f(ArrayPrototype$1, UNSCOPABLES, {
|
|
1632
|
+
configurable: true,
|
|
1633
|
+
value: objectCreate(null)
|
|
1634
|
+
});
|
|
1635
|
+
}
|
|
1636
|
+
|
|
1637
|
+
// add a key to Array.prototype[@@unscopables]
|
|
1638
|
+
var addToUnscopables = function (key) {
|
|
1639
|
+
ArrayPrototype$1[UNSCOPABLES][key] = true;
|
|
1640
|
+
};
|
|
1641
|
+
|
|
1642
|
+
var iterators = {};
|
|
1643
|
+
|
|
1644
|
+
var correctPrototypeGetter = !fails(function () {
|
|
1645
|
+
function F() { /* empty */ }
|
|
1646
|
+
F.prototype.constructor = null;
|
|
1647
|
+
// eslint-disable-next-line es/no-object-getprototypeof -- required for testing
|
|
1648
|
+
return Object.getPrototypeOf(new F()) !== F.prototype;
|
|
1649
|
+
});
|
|
1650
|
+
|
|
1651
|
+
var IE_PROTO = sharedKey('IE_PROTO');
|
|
1652
|
+
var Object$1 = global$1.Object;
|
|
1653
|
+
var ObjectPrototype = Object$1.prototype;
|
|
1654
|
+
|
|
1655
|
+
// `Object.getPrototypeOf` method
|
|
1656
|
+
// https://tc39.es/ecma262/#sec-object.getprototypeof
|
|
1657
|
+
var objectGetPrototypeOf = correctPrototypeGetter ? Object$1.getPrototypeOf : function (O) {
|
|
1658
|
+
var object = toObject(O);
|
|
1659
|
+
if (hasOwnProperty_1(object, IE_PROTO)) return object[IE_PROTO];
|
|
1660
|
+
var constructor = object.constructor;
|
|
1661
|
+
if (isCallable(constructor) && object instanceof constructor) {
|
|
1662
|
+
return constructor.prototype;
|
|
1663
|
+
} return object instanceof Object$1 ? ObjectPrototype : null;
|
|
1664
|
+
};
|
|
1665
|
+
|
|
1666
|
+
var ITERATOR$5 = wellKnownSymbol('iterator');
|
|
1667
|
+
var BUGGY_SAFARI_ITERATORS$1 = false;
|
|
1668
|
+
|
|
1669
|
+
// `%IteratorPrototype%` object
|
|
1670
|
+
// https://tc39.es/ecma262/#sec-%iteratorprototype%-object
|
|
1671
|
+
var IteratorPrototype$2, PrototypeOfArrayIteratorPrototype, arrayIterator;
|
|
1672
|
+
|
|
1673
|
+
/* eslint-disable es/no-array-prototype-keys -- safe */
|
|
1674
|
+
if ([].keys) {
|
|
1675
|
+
arrayIterator = [].keys();
|
|
1676
|
+
// Safari 8 has buggy iterators w/o `next`
|
|
1677
|
+
if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS$1 = true;
|
|
1678
|
+
else {
|
|
1679
|
+
PrototypeOfArrayIteratorPrototype = objectGetPrototypeOf(objectGetPrototypeOf(arrayIterator));
|
|
1680
|
+
if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype$2 = PrototypeOfArrayIteratorPrototype;
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1684
|
+
var NEW_ITERATOR_PROTOTYPE = IteratorPrototype$2 == undefined || fails(function () {
|
|
1685
|
+
var test = {};
|
|
1686
|
+
// FF44- legacy iterators case
|
|
1687
|
+
return IteratorPrototype$2[ITERATOR$5].call(test) !== test;
|
|
1688
|
+
});
|
|
1689
|
+
|
|
1690
|
+
if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype$2 = {};
|
|
1691
|
+
|
|
1692
|
+
// `%IteratorPrototype%[@@iterator]()` method
|
|
1693
|
+
// https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
|
|
1694
|
+
if (!isCallable(IteratorPrototype$2[ITERATOR$5])) {
|
|
1695
|
+
redefine(IteratorPrototype$2, ITERATOR$5, function () {
|
|
1696
|
+
return this;
|
|
1697
|
+
});
|
|
1698
|
+
}
|
|
1699
|
+
|
|
1700
|
+
var iteratorsCore = {
|
|
1701
|
+
IteratorPrototype: IteratorPrototype$2,
|
|
1702
|
+
BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS$1
|
|
1703
|
+
};
|
|
1704
|
+
|
|
1705
|
+
var defineProperty$1 = objectDefineProperty.f;
|
|
1706
|
+
|
|
1707
|
+
|
|
1708
|
+
|
|
1709
|
+
var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
|
|
1710
|
+
|
|
1711
|
+
var setToStringTag = function (it, TAG, STATIC) {
|
|
1712
|
+
if (it && !hasOwnProperty_1(it = STATIC ? it : it.prototype, TO_STRING_TAG$1)) {
|
|
1713
|
+
defineProperty$1(it, TO_STRING_TAG$1, { configurable: true, value: TAG });
|
|
1714
|
+
}
|
|
1715
|
+
};
|
|
1716
|
+
|
|
1717
|
+
var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
|
|
1718
|
+
|
|
1719
|
+
|
|
1720
|
+
|
|
1721
|
+
|
|
1722
|
+
|
|
1723
|
+
var returnThis$1 = function () { return this; };
|
|
1724
|
+
|
|
1725
|
+
var createIteratorConstructor = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
|
|
1726
|
+
var TO_STRING_TAG = NAME + ' Iterator';
|
|
1727
|
+
IteratorConstructor.prototype = objectCreate(IteratorPrototype$1, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) });
|
|
1728
|
+
setToStringTag(IteratorConstructor, TO_STRING_TAG, false);
|
|
1729
|
+
iterators[TO_STRING_TAG] = returnThis$1;
|
|
1730
|
+
return IteratorConstructor;
|
|
1731
|
+
};
|
|
1732
|
+
|
|
1733
|
+
var String$2 = global$1.String;
|
|
1734
|
+
var TypeError$5 = global$1.TypeError;
|
|
1735
|
+
|
|
1736
|
+
var aPossiblePrototype = function (argument) {
|
|
1737
|
+
if (typeof argument == 'object' || isCallable(argument)) return argument;
|
|
1738
|
+
throw TypeError$5("Can't set " + String$2(argument) + ' as a prototype');
|
|
1739
|
+
};
|
|
1740
|
+
|
|
1741
|
+
/* eslint-disable no-proto -- safe */
|
|
1742
|
+
|
|
1743
|
+
// `Object.setPrototypeOf` method
|
|
1744
|
+
// https://tc39.es/ecma262/#sec-object.setprototypeof
|
|
1745
|
+
// Works with __proto__ only. Old v8 can't work with null proto objects.
|
|
1746
|
+
// eslint-disable-next-line es/no-object-setprototypeof -- safe
|
|
1747
|
+
var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
|
|
1748
|
+
var CORRECT_SETTER = false;
|
|
1749
|
+
var test = {};
|
|
1750
|
+
var setter;
|
|
1751
|
+
try {
|
|
1752
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
1753
|
+
setter = functionUncurryThis(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
|
|
1754
|
+
setter(test, []);
|
|
1755
|
+
CORRECT_SETTER = test instanceof Array;
|
|
1756
|
+
} catch (error) { /* empty */ }
|
|
1757
|
+
return function setPrototypeOf(O, proto) {
|
|
1758
|
+
anObject(O);
|
|
1759
|
+
aPossiblePrototype(proto);
|
|
1760
|
+
if (CORRECT_SETTER) setter(O, proto);
|
|
1761
|
+
else O.__proto__ = proto;
|
|
1762
|
+
return O;
|
|
1763
|
+
};
|
|
1764
|
+
}() : undefined);
|
|
1765
|
+
|
|
1766
|
+
var PROPER_FUNCTION_NAME$1 = functionName.PROPER;
|
|
1767
|
+
var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
|
|
1768
|
+
var IteratorPrototype = iteratorsCore.IteratorPrototype;
|
|
1769
|
+
var BUGGY_SAFARI_ITERATORS = iteratorsCore.BUGGY_SAFARI_ITERATORS;
|
|
1770
|
+
var ITERATOR$4 = wellKnownSymbol('iterator');
|
|
1771
|
+
var KEYS = 'keys';
|
|
1772
|
+
var VALUES = 'values';
|
|
1773
|
+
var ENTRIES = 'entries';
|
|
1774
|
+
|
|
1775
|
+
var returnThis = function () { return this; };
|
|
1776
|
+
|
|
1777
|
+
var defineIterator = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
|
|
1778
|
+
createIteratorConstructor(IteratorConstructor, NAME, next);
|
|
1779
|
+
|
|
1780
|
+
var getIterationMethod = function (KIND) {
|
|
1781
|
+
if (KIND === DEFAULT && defaultIterator) return defaultIterator;
|
|
1782
|
+
if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];
|
|
1783
|
+
switch (KIND) {
|
|
1784
|
+
case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
|
|
1785
|
+
case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
|
|
1786
|
+
case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
|
|
1787
|
+
} return function () { return new IteratorConstructor(this); };
|
|
1788
|
+
};
|
|
1789
|
+
|
|
1790
|
+
var TO_STRING_TAG = NAME + ' Iterator';
|
|
1791
|
+
var INCORRECT_VALUES_NAME = false;
|
|
1792
|
+
var IterablePrototype = Iterable.prototype;
|
|
1793
|
+
var nativeIterator = IterablePrototype[ITERATOR$4]
|
|
1794
|
+
|| IterablePrototype['@@iterator']
|
|
1795
|
+
|| DEFAULT && IterablePrototype[DEFAULT];
|
|
1796
|
+
var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
|
|
1797
|
+
var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
|
|
1798
|
+
var CurrentIteratorPrototype, methods, KEY;
|
|
1799
|
+
|
|
1800
|
+
// fix native
|
|
1801
|
+
if (anyNativeIterator) {
|
|
1802
|
+
CurrentIteratorPrototype = objectGetPrototypeOf(anyNativeIterator.call(new Iterable()));
|
|
1803
|
+
if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
|
|
1804
|
+
if (objectGetPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
|
|
1805
|
+
if (objectSetPrototypeOf) {
|
|
1806
|
+
objectSetPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
|
|
1807
|
+
} else if (!isCallable(CurrentIteratorPrototype[ITERATOR$4])) {
|
|
1808
|
+
redefine(CurrentIteratorPrototype, ITERATOR$4, returnThis);
|
|
1809
|
+
}
|
|
1810
|
+
}
|
|
1811
|
+
// Set @@toStringTag to native iterators
|
|
1812
|
+
setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true);
|
|
1813
|
+
}
|
|
1814
|
+
}
|
|
1815
|
+
|
|
1816
|
+
// fix Array.prototype.{ values, @@iterator }.name in V8 / FF
|
|
1817
|
+
if (PROPER_FUNCTION_NAME$1 && DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
|
|
1818
|
+
if (CONFIGURABLE_FUNCTION_NAME) {
|
|
1819
|
+
createNonEnumerableProperty(IterablePrototype, 'name', VALUES);
|
|
1820
|
+
} else {
|
|
1821
|
+
INCORRECT_VALUES_NAME = true;
|
|
1822
|
+
defaultIterator = function values() { return functionCall(nativeIterator, this); };
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
|
|
1826
|
+
// export additional methods
|
|
1827
|
+
if (DEFAULT) {
|
|
1828
|
+
methods = {
|
|
1829
|
+
values: getIterationMethod(VALUES),
|
|
1830
|
+
keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
|
|
1831
|
+
entries: getIterationMethod(ENTRIES)
|
|
1832
|
+
};
|
|
1833
|
+
if (FORCED) for (KEY in methods) {
|
|
1834
|
+
if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
|
|
1835
|
+
redefine(IterablePrototype, KEY, methods[KEY]);
|
|
1836
|
+
}
|
|
1837
|
+
} else _export({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1840
|
+
// define iterator
|
|
1841
|
+
if (IterablePrototype[ITERATOR$4] !== defaultIterator) {
|
|
1842
|
+
redefine(IterablePrototype, ITERATOR$4, defaultIterator, { name: DEFAULT });
|
|
1843
|
+
}
|
|
1844
|
+
iterators[NAME] = defaultIterator;
|
|
1845
|
+
|
|
1846
|
+
return methods;
|
|
1847
|
+
};
|
|
1848
|
+
|
|
1849
|
+
var ARRAY_ITERATOR = 'Array Iterator';
|
|
1850
|
+
var setInternalState$3 = internalState.set;
|
|
1851
|
+
var getInternalState$2 = internalState.getterFor(ARRAY_ITERATOR);
|
|
1852
|
+
|
|
1853
|
+
// `Array.prototype.entries` method
|
|
1854
|
+
// https://tc39.es/ecma262/#sec-array.prototype.entries
|
|
1855
|
+
// `Array.prototype.keys` method
|
|
1856
|
+
// https://tc39.es/ecma262/#sec-array.prototype.keys
|
|
1857
|
+
// `Array.prototype.values` method
|
|
1858
|
+
// https://tc39.es/ecma262/#sec-array.prototype.values
|
|
1859
|
+
// `Array.prototype[@@iterator]` method
|
|
1860
|
+
// https://tc39.es/ecma262/#sec-array.prototype-@@iterator
|
|
1861
|
+
// `CreateArrayIterator` internal method
|
|
1862
|
+
// https://tc39.es/ecma262/#sec-createarrayiterator
|
|
1863
|
+
var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) {
|
|
1864
|
+
setInternalState$3(this, {
|
|
1865
|
+
type: ARRAY_ITERATOR,
|
|
1866
|
+
target: toIndexedObject(iterated), // target
|
|
1867
|
+
index: 0, // next index
|
|
1868
|
+
kind: kind // kind
|
|
1869
|
+
});
|
|
1870
|
+
// `%ArrayIteratorPrototype%.next` method
|
|
1871
|
+
// https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
|
|
1872
|
+
}, function () {
|
|
1873
|
+
var state = getInternalState$2(this);
|
|
1874
|
+
var target = state.target;
|
|
1875
|
+
var kind = state.kind;
|
|
1876
|
+
var index = state.index++;
|
|
1877
|
+
if (!target || index >= target.length) {
|
|
1878
|
+
state.target = undefined;
|
|
1879
|
+
return { value: undefined, done: true };
|
|
1880
|
+
}
|
|
1881
|
+
if (kind == 'keys') return { value: index, done: false };
|
|
1882
|
+
if (kind == 'values') return { value: target[index], done: false };
|
|
1883
|
+
return { value: [index, target[index]], done: false };
|
|
1884
|
+
}, 'values');
|
|
1885
|
+
|
|
1886
|
+
// argumentsList[@@iterator] is %ArrayProto_values%
|
|
1887
|
+
// https://tc39.es/ecma262/#sec-createunmappedargumentsobject
|
|
1888
|
+
// https://tc39.es/ecma262/#sec-createmappedargumentsobject
|
|
1889
|
+
iterators.Arguments = iterators.Array;
|
|
1890
|
+
|
|
1891
|
+
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
1892
|
+
addToUnscopables('keys');
|
|
1893
|
+
addToUnscopables('values');
|
|
1894
|
+
addToUnscopables('entries');
|
|
1895
|
+
|
|
1896
|
+
var charAt = stringMultibyte.charAt;
|
|
1897
|
+
|
|
1898
|
+
|
|
1899
|
+
|
|
1900
|
+
|
|
1901
|
+
var STRING_ITERATOR = 'String Iterator';
|
|
1902
|
+
var setInternalState$2 = internalState.set;
|
|
1903
|
+
var getInternalState$1 = internalState.getterFor(STRING_ITERATOR);
|
|
1904
|
+
|
|
1905
|
+
// `String.prototype[@@iterator]` method
|
|
1906
|
+
// https://tc39.es/ecma262/#sec-string.prototype-@@iterator
|
|
1907
|
+
defineIterator(String, 'String', function (iterated) {
|
|
1908
|
+
setInternalState$2(this, {
|
|
1909
|
+
type: STRING_ITERATOR,
|
|
1910
|
+
string: toString(iterated),
|
|
1911
|
+
index: 0
|
|
1912
|
+
});
|
|
1913
|
+
// `%StringIteratorPrototype%.next` method
|
|
1914
|
+
// https://tc39.es/ecma262/#sec-%stringiteratorprototype%.next
|
|
1915
|
+
}, function next() {
|
|
1916
|
+
var state = getInternalState$1(this);
|
|
1917
|
+
var string = state.string;
|
|
1918
|
+
var index = state.index;
|
|
1919
|
+
var point;
|
|
1920
|
+
if (index >= string.length) return { value: undefined, done: true };
|
|
1921
|
+
point = charAt(string, index);
|
|
1922
|
+
state.index += point.length;
|
|
1923
|
+
return { value: point, done: false };
|
|
1924
|
+
});
|
|
1925
|
+
|
|
1926
|
+
var redefineAll = function (target, src, options) {
|
|
1927
|
+
for (var key in src) redefine(target, key, src[key], options);
|
|
1928
|
+
return target;
|
|
1929
|
+
};
|
|
1930
|
+
|
|
1931
|
+
/* eslint-disable es/no-object-getownpropertynames -- safe */
|
|
1932
|
+
|
|
1933
|
+
var $getOwnPropertyNames = objectGetOwnPropertyNames.f;
|
|
1934
|
+
|
|
1935
|
+
|
|
1936
|
+
var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
|
|
1937
|
+
? Object.getOwnPropertyNames(window) : [];
|
|
1938
|
+
|
|
1939
|
+
var getWindowNames = function (it) {
|
|
1940
|
+
try {
|
|
1941
|
+
return $getOwnPropertyNames(it);
|
|
1942
|
+
} catch (error) {
|
|
1943
|
+
return arraySliceSimple(windowNames);
|
|
1944
|
+
}
|
|
1945
|
+
};
|
|
1946
|
+
|
|
1947
|
+
// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
|
|
1948
|
+
var f$1 = function getOwnPropertyNames(it) {
|
|
1949
|
+
return windowNames && classofRaw(it) == 'Window'
|
|
1950
|
+
? getWindowNames(it)
|
|
1951
|
+
: $getOwnPropertyNames(toIndexedObject(it));
|
|
1952
|
+
};
|
|
1953
|
+
|
|
1954
|
+
var objectGetOwnPropertyNamesExternal = {
|
|
1955
|
+
f: f$1
|
|
1956
|
+
};
|
|
1957
|
+
|
|
1958
|
+
// FF26- bug: ArrayBuffers are non-extensible, but Object.isExtensible does not report it
|
|
1959
|
+
|
|
1960
|
+
|
|
1961
|
+
var arrayBufferNonExtensible = fails(function () {
|
|
1962
|
+
if (typeof ArrayBuffer == 'function') {
|
|
1963
|
+
var buffer = new ArrayBuffer(8);
|
|
1964
|
+
// eslint-disable-next-line es/no-object-isextensible, es/no-object-defineproperty -- safe
|
|
1965
|
+
if (Object.isExtensible(buffer)) Object.defineProperty(buffer, 'a', { value: 8 });
|
|
1966
|
+
}
|
|
1967
|
+
});
|
|
1968
|
+
|
|
1969
|
+
// eslint-disable-next-line es/no-object-isextensible -- safe
|
|
1970
|
+
var $isExtensible = Object.isExtensible;
|
|
1971
|
+
var FAILS_ON_PRIMITIVES = fails(function () { $isExtensible(1); });
|
|
1972
|
+
|
|
1973
|
+
// `Object.isExtensible` method
|
|
1974
|
+
// https://tc39.es/ecma262/#sec-object.isextensible
|
|
1975
|
+
var objectIsExtensible = (FAILS_ON_PRIMITIVES || arrayBufferNonExtensible) ? function isExtensible(it) {
|
|
1976
|
+
if (!isObject(it)) return false;
|
|
1977
|
+
if (arrayBufferNonExtensible && classofRaw(it) == 'ArrayBuffer') return false;
|
|
1978
|
+
return $isExtensible ? $isExtensible(it) : true;
|
|
1979
|
+
} : $isExtensible;
|
|
1980
|
+
|
|
1981
|
+
var freezing = !fails(function () {
|
|
1982
|
+
// eslint-disable-next-line es/no-object-isextensible, es/no-object-preventextensions -- required for testing
|
|
1983
|
+
return Object.isExtensible(Object.preventExtensions({}));
|
|
1984
|
+
});
|
|
1985
|
+
|
|
1986
|
+
var internalMetadata = createCommonjsModule(function (module) {
|
|
1987
|
+
var defineProperty = objectDefineProperty.f;
|
|
1988
|
+
|
|
1989
|
+
|
|
1990
|
+
|
|
1991
|
+
|
|
1992
|
+
|
|
1993
|
+
|
|
1994
|
+
var REQUIRED = false;
|
|
1995
|
+
var METADATA = uid('meta');
|
|
1996
|
+
var id = 0;
|
|
1997
|
+
|
|
1998
|
+
var setMetadata = function (it) {
|
|
1999
|
+
defineProperty(it, METADATA, { value: {
|
|
2000
|
+
objectID: 'O' + id++, // object ID
|
|
2001
|
+
weakData: {} // weak collections IDs
|
|
2002
|
+
} });
|
|
2003
|
+
};
|
|
2004
|
+
|
|
2005
|
+
var fastKey = function (it, create) {
|
|
2006
|
+
// return a primitive with prefix
|
|
2007
|
+
if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
|
|
2008
|
+
if (!hasOwnProperty_1(it, METADATA)) {
|
|
2009
|
+
// can't set metadata to uncaught frozen object
|
|
2010
|
+
if (!objectIsExtensible(it)) return 'F';
|
|
2011
|
+
// not necessary to add metadata
|
|
2012
|
+
if (!create) return 'E';
|
|
2013
|
+
// add missing metadata
|
|
2014
|
+
setMetadata(it);
|
|
2015
|
+
// return object ID
|
|
2016
|
+
} return it[METADATA].objectID;
|
|
2017
|
+
};
|
|
2018
|
+
|
|
2019
|
+
var getWeakData = function (it, create) {
|
|
2020
|
+
if (!hasOwnProperty_1(it, METADATA)) {
|
|
2021
|
+
// can't set metadata to uncaught frozen object
|
|
2022
|
+
if (!objectIsExtensible(it)) return true;
|
|
2023
|
+
// not necessary to add metadata
|
|
2024
|
+
if (!create) return false;
|
|
2025
|
+
// add missing metadata
|
|
2026
|
+
setMetadata(it);
|
|
2027
|
+
// return the store of weak collections IDs
|
|
2028
|
+
} return it[METADATA].weakData;
|
|
2029
|
+
};
|
|
2030
|
+
|
|
2031
|
+
// add metadata on freeze-family methods calling
|
|
2032
|
+
var onFreeze = function (it) {
|
|
2033
|
+
if (freezing && REQUIRED && objectIsExtensible(it) && !hasOwnProperty_1(it, METADATA)) setMetadata(it);
|
|
2034
|
+
return it;
|
|
2035
|
+
};
|
|
2036
|
+
|
|
2037
|
+
var enable = function () {
|
|
2038
|
+
meta.enable = function () { /* empty */ };
|
|
2039
|
+
REQUIRED = true;
|
|
2040
|
+
var getOwnPropertyNames = objectGetOwnPropertyNames.f;
|
|
2041
|
+
var splice = functionUncurryThis([].splice);
|
|
2042
|
+
var test = {};
|
|
2043
|
+
test[METADATA] = 1;
|
|
2044
|
+
|
|
2045
|
+
// prevent exposing of metadata key
|
|
2046
|
+
if (getOwnPropertyNames(test).length) {
|
|
2047
|
+
objectGetOwnPropertyNames.f = function (it) {
|
|
2048
|
+
var result = getOwnPropertyNames(it);
|
|
2049
|
+
for (var i = 0, length = result.length; i < length; i++) {
|
|
2050
|
+
if (result[i] === METADATA) {
|
|
2051
|
+
splice(result, i, 1);
|
|
2052
|
+
break;
|
|
2053
|
+
}
|
|
2054
|
+
} return result;
|
|
2055
|
+
};
|
|
2056
|
+
|
|
2057
|
+
_export({ target: 'Object', stat: true, forced: true }, {
|
|
2058
|
+
getOwnPropertyNames: objectGetOwnPropertyNamesExternal.f
|
|
2059
|
+
});
|
|
2060
|
+
}
|
|
2061
|
+
};
|
|
2062
|
+
|
|
2063
|
+
var meta = module.exports = {
|
|
2064
|
+
enable: enable,
|
|
2065
|
+
fastKey: fastKey,
|
|
2066
|
+
getWeakData: getWeakData,
|
|
2067
|
+
onFreeze: onFreeze
|
|
2068
|
+
};
|
|
2069
|
+
|
|
2070
|
+
hiddenKeys$1[METADATA] = true;
|
|
2071
|
+
});
|
|
2072
|
+
|
|
2073
|
+
var bind$1 = functionUncurryThis(functionUncurryThis.bind);
|
|
2074
|
+
|
|
2075
|
+
// optional / simple context binding
|
|
2076
|
+
var functionBindContext = function (fn, that) {
|
|
2077
|
+
aCallable(fn);
|
|
2078
|
+
return that === undefined ? fn : bind$1 ? bind$1(fn, that) : function (/* ...args */) {
|
|
2079
|
+
return fn.apply(that, arguments);
|
|
2080
|
+
};
|
|
2081
|
+
};
|
|
2082
|
+
|
|
2083
|
+
var ITERATOR$3 = wellKnownSymbol('iterator');
|
|
2084
|
+
var ArrayPrototype = Array.prototype;
|
|
2085
|
+
|
|
2086
|
+
// check on default Array iterator
|
|
2087
|
+
var isArrayIteratorMethod = function (it) {
|
|
2088
|
+
return it !== undefined && (iterators.Array === it || ArrayPrototype[ITERATOR$3] === it);
|
|
2089
|
+
};
|
|
2090
|
+
|
|
2091
|
+
var ITERATOR$2 = wellKnownSymbol('iterator');
|
|
2092
|
+
|
|
2093
|
+
var getIteratorMethod = function (it) {
|
|
2094
|
+
if (it != undefined) return getMethod(it, ITERATOR$2)
|
|
2095
|
+
|| getMethod(it, '@@iterator')
|
|
2096
|
+
|| iterators[classof(it)];
|
|
2097
|
+
};
|
|
2098
|
+
|
|
2099
|
+
var TypeError$4 = global$1.TypeError;
|
|
2100
|
+
|
|
2101
|
+
var getIterator = function (argument, usingIterator) {
|
|
2102
|
+
var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
|
|
2103
|
+
if (aCallable(iteratorMethod)) return anObject(functionCall(iteratorMethod, argument));
|
|
2104
|
+
throw TypeError$4(tryToString(argument) + ' is not iterable');
|
|
2105
|
+
};
|
|
2106
|
+
|
|
2107
|
+
var iteratorClose = function (iterator, kind, value) {
|
|
2108
|
+
var innerResult, innerError;
|
|
2109
|
+
anObject(iterator);
|
|
2110
|
+
try {
|
|
2111
|
+
innerResult = getMethod(iterator, 'return');
|
|
2112
|
+
if (!innerResult) {
|
|
2113
|
+
if (kind === 'throw') throw value;
|
|
2114
|
+
return value;
|
|
2115
|
+
}
|
|
2116
|
+
innerResult = functionCall(innerResult, iterator);
|
|
2117
|
+
} catch (error) {
|
|
2118
|
+
innerError = true;
|
|
2119
|
+
innerResult = error;
|
|
2120
|
+
}
|
|
2121
|
+
if (kind === 'throw') throw value;
|
|
2122
|
+
if (innerError) throw innerResult;
|
|
2123
|
+
anObject(innerResult);
|
|
2124
|
+
return value;
|
|
2125
|
+
};
|
|
2126
|
+
|
|
2127
|
+
var TypeError$3 = global$1.TypeError;
|
|
2128
|
+
|
|
2129
|
+
var Result = function (stopped, result) {
|
|
2130
|
+
this.stopped = stopped;
|
|
2131
|
+
this.result = result;
|
|
2132
|
+
};
|
|
2133
|
+
|
|
2134
|
+
var ResultPrototype = Result.prototype;
|
|
2135
|
+
|
|
2136
|
+
var iterate = function (iterable, unboundFunction, options) {
|
|
2137
|
+
var that = options && options.that;
|
|
2138
|
+
var AS_ENTRIES = !!(options && options.AS_ENTRIES);
|
|
2139
|
+
var IS_ITERATOR = !!(options && options.IS_ITERATOR);
|
|
2140
|
+
var INTERRUPTED = !!(options && options.INTERRUPTED);
|
|
2141
|
+
var fn = functionBindContext(unboundFunction, that);
|
|
2142
|
+
var iterator, iterFn, index, length, result, next, step;
|
|
2143
|
+
|
|
2144
|
+
var stop = function (condition) {
|
|
2145
|
+
if (iterator) iteratorClose(iterator, 'normal', condition);
|
|
2146
|
+
return new Result(true, condition);
|
|
2147
|
+
};
|
|
2148
|
+
|
|
2149
|
+
var callFn = function (value) {
|
|
2150
|
+
if (AS_ENTRIES) {
|
|
2151
|
+
anObject(value);
|
|
2152
|
+
return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
|
|
2153
|
+
} return INTERRUPTED ? fn(value, stop) : fn(value);
|
|
2154
|
+
};
|
|
2155
|
+
|
|
2156
|
+
if (IS_ITERATOR) {
|
|
2157
|
+
iterator = iterable;
|
|
2158
|
+
} else {
|
|
2159
|
+
iterFn = getIteratorMethod(iterable);
|
|
2160
|
+
if (!iterFn) throw TypeError$3(tryToString(iterable) + ' is not iterable');
|
|
2161
|
+
// optimisation for array iterators
|
|
2162
|
+
if (isArrayIteratorMethod(iterFn)) {
|
|
2163
|
+
for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
|
|
2164
|
+
result = callFn(iterable[index]);
|
|
2165
|
+
if (result && objectIsPrototypeOf(ResultPrototype, result)) return result;
|
|
2166
|
+
} return new Result(false);
|
|
2167
|
+
}
|
|
2168
|
+
iterator = getIterator(iterable, iterFn);
|
|
2169
|
+
}
|
|
2170
|
+
|
|
2171
|
+
next = iterator.next;
|
|
2172
|
+
while (!(step = functionCall(next, iterator)).done) {
|
|
2173
|
+
try {
|
|
2174
|
+
result = callFn(step.value);
|
|
2175
|
+
} catch (error) {
|
|
2176
|
+
iteratorClose(iterator, 'throw', error);
|
|
2177
|
+
}
|
|
2178
|
+
if (typeof result == 'object' && result && objectIsPrototypeOf(ResultPrototype, result)) return result;
|
|
2179
|
+
} return new Result(false);
|
|
2180
|
+
};
|
|
2181
|
+
|
|
2182
|
+
var TypeError$2 = global$1.TypeError;
|
|
2183
|
+
|
|
2184
|
+
var anInstance = function (it, Prototype) {
|
|
2185
|
+
if (objectIsPrototypeOf(Prototype, it)) return it;
|
|
2186
|
+
throw TypeError$2('Incorrect invocation');
|
|
2187
|
+
};
|
|
2188
|
+
|
|
2189
|
+
var ITERATOR$1 = wellKnownSymbol('iterator');
|
|
2190
|
+
var SAFE_CLOSING = false;
|
|
2191
|
+
|
|
2192
|
+
try {
|
|
2193
|
+
var called = 0;
|
|
2194
|
+
var iteratorWithReturn = {
|
|
2195
|
+
next: function () {
|
|
2196
|
+
return { done: !!called++ };
|
|
2197
|
+
},
|
|
2198
|
+
'return': function () {
|
|
2199
|
+
SAFE_CLOSING = true;
|
|
2200
|
+
}
|
|
2201
|
+
};
|
|
2202
|
+
iteratorWithReturn[ITERATOR$1] = function () {
|
|
2203
|
+
return this;
|
|
2204
|
+
};
|
|
2205
|
+
// eslint-disable-next-line es/no-array-from, no-throw-literal -- required for testing
|
|
2206
|
+
Array.from(iteratorWithReturn, function () { throw 2; });
|
|
2207
|
+
} catch (error) { /* empty */ }
|
|
2208
|
+
|
|
2209
|
+
var checkCorrectnessOfIteration = function (exec, SKIP_CLOSING) {
|
|
2210
|
+
if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
|
|
2211
|
+
var ITERATION_SUPPORT = false;
|
|
2212
|
+
try {
|
|
2213
|
+
var object = {};
|
|
2214
|
+
object[ITERATOR$1] = function () {
|
|
2215
|
+
return {
|
|
2216
|
+
next: function () {
|
|
2217
|
+
return { done: ITERATION_SUPPORT = true };
|
|
2218
|
+
}
|
|
2219
|
+
};
|
|
2220
|
+
};
|
|
2221
|
+
exec(object);
|
|
2222
|
+
} catch (error) { /* empty */ }
|
|
2223
|
+
return ITERATION_SUPPORT;
|
|
2224
|
+
};
|
|
2225
|
+
|
|
2226
|
+
// makes subclassing work correct for wrapped built-ins
|
|
2227
|
+
var inheritIfRequired = function ($this, dummy, Wrapper) {
|
|
2228
|
+
var NewTarget, NewTargetPrototype;
|
|
2229
|
+
if (
|
|
2230
|
+
// it can work only with native `setPrototypeOf`
|
|
2231
|
+
objectSetPrototypeOf &&
|
|
2232
|
+
// we haven't completely correct pre-ES6 way for getting `new.target`, so use this
|
|
2233
|
+
isCallable(NewTarget = dummy.constructor) &&
|
|
2234
|
+
NewTarget !== Wrapper &&
|
|
2235
|
+
isObject(NewTargetPrototype = NewTarget.prototype) &&
|
|
2236
|
+
NewTargetPrototype !== Wrapper.prototype
|
|
2237
|
+
) objectSetPrototypeOf($this, NewTargetPrototype);
|
|
2238
|
+
return $this;
|
|
2239
|
+
};
|
|
2240
|
+
|
|
2241
|
+
var collection = function (CONSTRUCTOR_NAME, wrapper, common) {
|
|
2242
|
+
var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;
|
|
2243
|
+
var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;
|
|
2244
|
+
var ADDER = IS_MAP ? 'set' : 'add';
|
|
2245
|
+
var NativeConstructor = global$1[CONSTRUCTOR_NAME];
|
|
2246
|
+
var NativePrototype = NativeConstructor && NativeConstructor.prototype;
|
|
2247
|
+
var Constructor = NativeConstructor;
|
|
2248
|
+
var exported = {};
|
|
2249
|
+
|
|
2250
|
+
var fixMethod = function (KEY) {
|
|
2251
|
+
var uncurriedNativeMethod = functionUncurryThis(NativePrototype[KEY]);
|
|
2252
|
+
redefine(NativePrototype, KEY,
|
|
2253
|
+
KEY == 'add' ? function add(value) {
|
|
2254
|
+
uncurriedNativeMethod(this, value === 0 ? 0 : value);
|
|
2255
|
+
return this;
|
|
2256
|
+
} : KEY == 'delete' ? function (key) {
|
|
2257
|
+
return IS_WEAK && !isObject(key) ? false : uncurriedNativeMethod(this, key === 0 ? 0 : key);
|
|
2258
|
+
} : KEY == 'get' ? function get(key) {
|
|
2259
|
+
return IS_WEAK && !isObject(key) ? undefined : uncurriedNativeMethod(this, key === 0 ? 0 : key);
|
|
2260
|
+
} : KEY == 'has' ? function has(key) {
|
|
2261
|
+
return IS_WEAK && !isObject(key) ? false : uncurriedNativeMethod(this, key === 0 ? 0 : key);
|
|
2262
|
+
} : function set(key, value) {
|
|
2263
|
+
uncurriedNativeMethod(this, key === 0 ? 0 : key, value);
|
|
2264
|
+
return this;
|
|
2265
|
+
}
|
|
2266
|
+
);
|
|
2267
|
+
};
|
|
2268
|
+
|
|
2269
|
+
var REPLACE = isForced_1(
|
|
2270
|
+
CONSTRUCTOR_NAME,
|
|
2271
|
+
!isCallable(NativeConstructor) || !(IS_WEAK || NativePrototype.forEach && !fails(function () {
|
|
2272
|
+
new NativeConstructor().entries().next();
|
|
2273
|
+
}))
|
|
2274
|
+
);
|
|
2275
|
+
|
|
2276
|
+
if (REPLACE) {
|
|
2277
|
+
// create collection constructor
|
|
2278
|
+
Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);
|
|
2279
|
+
internalMetadata.enable();
|
|
2280
|
+
} else if (isForced_1(CONSTRUCTOR_NAME, true)) {
|
|
2281
|
+
var instance = new Constructor();
|
|
2282
|
+
// early implementations not supports chaining
|
|
2283
|
+
var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance;
|
|
2284
|
+
// V8 ~ Chromium 40- weak-collections throws on primitives, but should return false
|
|
2285
|
+
var THROWS_ON_PRIMITIVES = fails(function () { instance.has(1); });
|
|
2286
|
+
// most early implementations doesn't supports iterables, most modern - not close it correctly
|
|
2287
|
+
// eslint-disable-next-line no-new -- required for testing
|
|
2288
|
+
var ACCEPT_ITERABLES = checkCorrectnessOfIteration(function (iterable) { new NativeConstructor(iterable); });
|
|
2289
|
+
// for early implementations -0 and +0 not the same
|
|
2290
|
+
var BUGGY_ZERO = !IS_WEAK && fails(function () {
|
|
2291
|
+
// V8 ~ Chromium 42- fails only with 5+ elements
|
|
2292
|
+
var $instance = new NativeConstructor();
|
|
2293
|
+
var index = 5;
|
|
2294
|
+
while (index--) $instance[ADDER](index, index);
|
|
2295
|
+
return !$instance.has(-0);
|
|
2296
|
+
});
|
|
2297
|
+
|
|
2298
|
+
if (!ACCEPT_ITERABLES) {
|
|
2299
|
+
Constructor = wrapper(function (dummy, iterable) {
|
|
2300
|
+
anInstance(dummy, NativePrototype);
|
|
2301
|
+
var that = inheritIfRequired(new NativeConstructor(), dummy, Constructor);
|
|
2302
|
+
if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP });
|
|
2303
|
+
return that;
|
|
2304
|
+
});
|
|
2305
|
+
Constructor.prototype = NativePrototype;
|
|
2306
|
+
NativePrototype.constructor = Constructor;
|
|
2307
|
+
}
|
|
2308
|
+
|
|
2309
|
+
if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) {
|
|
2310
|
+
fixMethod('delete');
|
|
2311
|
+
fixMethod('has');
|
|
2312
|
+
IS_MAP && fixMethod('get');
|
|
2313
|
+
}
|
|
2314
|
+
|
|
2315
|
+
if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER);
|
|
2316
|
+
|
|
2317
|
+
// weak collections should not contains .clear method
|
|
2318
|
+
if (IS_WEAK && NativePrototype.clear) delete NativePrototype.clear;
|
|
2319
|
+
}
|
|
2320
|
+
|
|
2321
|
+
exported[CONSTRUCTOR_NAME] = Constructor;
|
|
2322
|
+
_export({ global: true, forced: Constructor != NativeConstructor }, exported);
|
|
2323
|
+
|
|
2324
|
+
setToStringTag(Constructor, CONSTRUCTOR_NAME);
|
|
2325
|
+
|
|
2326
|
+
if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);
|
|
2327
|
+
|
|
2328
|
+
return Constructor;
|
|
2329
|
+
};
|
|
2330
|
+
|
|
2331
|
+
var SPECIES$2 = wellKnownSymbol('species');
|
|
2332
|
+
var Array$1 = global$1.Array;
|
|
2333
|
+
|
|
2334
|
+
// a part of `ArraySpeciesCreate` abstract operation
|
|
2335
|
+
// https://tc39.es/ecma262/#sec-arrayspeciescreate
|
|
2336
|
+
var arraySpeciesConstructor = function (originalArray) {
|
|
2337
|
+
var C;
|
|
2338
|
+
if (isArray(originalArray)) {
|
|
2339
|
+
C = originalArray.constructor;
|
|
2340
|
+
// cross-realm fallback
|
|
2341
|
+
if (isConstructor(C) && (C === Array$1 || isArray(C.prototype))) C = undefined;
|
|
2342
|
+
else if (isObject(C)) {
|
|
2343
|
+
C = C[SPECIES$2];
|
|
2344
|
+
if (C === null) C = undefined;
|
|
2345
|
+
}
|
|
2346
|
+
} return C === undefined ? Array$1 : C;
|
|
2347
|
+
};
|
|
2348
|
+
|
|
2349
|
+
// `ArraySpeciesCreate` abstract operation
|
|
2350
|
+
// https://tc39.es/ecma262/#sec-arrayspeciescreate
|
|
2351
|
+
var arraySpeciesCreate = function (originalArray, length) {
|
|
2352
|
+
return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
|
|
2353
|
+
};
|
|
2354
|
+
|
|
2355
|
+
var push = functionUncurryThis([].push);
|
|
2356
|
+
|
|
2357
|
+
// `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation
|
|
2358
|
+
var createMethod = function (TYPE) {
|
|
2359
|
+
var IS_MAP = TYPE == 1;
|
|
2360
|
+
var IS_FILTER = TYPE == 2;
|
|
2361
|
+
var IS_SOME = TYPE == 3;
|
|
2362
|
+
var IS_EVERY = TYPE == 4;
|
|
2363
|
+
var IS_FIND_INDEX = TYPE == 6;
|
|
2364
|
+
var IS_FILTER_REJECT = TYPE == 7;
|
|
2365
|
+
var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
|
|
2366
|
+
return function ($this, callbackfn, that, specificCreate) {
|
|
2367
|
+
var O = toObject($this);
|
|
2368
|
+
var self = indexedObject(O);
|
|
2369
|
+
var boundFunction = functionBindContext(callbackfn, that);
|
|
2370
|
+
var length = lengthOfArrayLike(self);
|
|
2371
|
+
var index = 0;
|
|
2372
|
+
var create = specificCreate || arraySpeciesCreate;
|
|
2373
|
+
var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined;
|
|
2374
|
+
var value, result;
|
|
2375
|
+
for (;length > index; index++) if (NO_HOLES || index in self) {
|
|
2376
|
+
value = self[index];
|
|
2377
|
+
result = boundFunction(value, index, O);
|
|
2378
|
+
if (TYPE) {
|
|
2379
|
+
if (IS_MAP) target[index] = result; // map
|
|
2380
|
+
else if (result) switch (TYPE) {
|
|
2381
|
+
case 3: return true; // some
|
|
2382
|
+
case 5: return value; // find
|
|
2383
|
+
case 6: return index; // findIndex
|
|
2384
|
+
case 2: push(target, value); // filter
|
|
2385
|
+
} else switch (TYPE) {
|
|
2386
|
+
case 4: return false; // every
|
|
2387
|
+
case 7: push(target, value); // filterReject
|
|
2388
|
+
}
|
|
2389
|
+
}
|
|
2390
|
+
}
|
|
2391
|
+
return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
|
|
2392
|
+
};
|
|
2393
|
+
};
|
|
2394
|
+
|
|
2395
|
+
var arrayIteration = {
|
|
2396
|
+
// `Array.prototype.forEach` method
|
|
2397
|
+
// https://tc39.es/ecma262/#sec-array.prototype.foreach
|
|
2398
|
+
forEach: createMethod(0),
|
|
2399
|
+
// `Array.prototype.map` method
|
|
2400
|
+
// https://tc39.es/ecma262/#sec-array.prototype.map
|
|
2401
|
+
map: createMethod(1),
|
|
2402
|
+
// `Array.prototype.filter` method
|
|
2403
|
+
// https://tc39.es/ecma262/#sec-array.prototype.filter
|
|
2404
|
+
filter: createMethod(2),
|
|
2405
|
+
// `Array.prototype.some` method
|
|
2406
|
+
// https://tc39.es/ecma262/#sec-array.prototype.some
|
|
2407
|
+
some: createMethod(3),
|
|
2408
|
+
// `Array.prototype.every` method
|
|
2409
|
+
// https://tc39.es/ecma262/#sec-array.prototype.every
|
|
2410
|
+
every: createMethod(4),
|
|
2411
|
+
// `Array.prototype.find` method
|
|
2412
|
+
// https://tc39.es/ecma262/#sec-array.prototype.find
|
|
2413
|
+
find: createMethod(5),
|
|
2414
|
+
// `Array.prototype.findIndex` method
|
|
2415
|
+
// https://tc39.es/ecma262/#sec-array.prototype.findIndex
|
|
2416
|
+
findIndex: createMethod(6),
|
|
2417
|
+
// `Array.prototype.filterReject` method
|
|
2418
|
+
// https://github.com/tc39/proposal-array-filtering
|
|
2419
|
+
filterReject: createMethod(7)
|
|
2420
|
+
};
|
|
2421
|
+
|
|
2422
|
+
var getWeakData = internalMetadata.getWeakData;
|
|
2423
|
+
|
|
2424
|
+
|
|
2425
|
+
|
|
2426
|
+
|
|
2427
|
+
|
|
2428
|
+
|
|
2429
|
+
|
|
2430
|
+
|
|
2431
|
+
var setInternalState$1 = internalState.set;
|
|
2432
|
+
var internalStateGetterFor = internalState.getterFor;
|
|
2433
|
+
var find = arrayIteration.find;
|
|
2434
|
+
var findIndex = arrayIteration.findIndex;
|
|
2435
|
+
var splice = functionUncurryThis([].splice);
|
|
2436
|
+
var id = 0;
|
|
2437
|
+
|
|
2438
|
+
// fallback for uncaught frozen keys
|
|
2439
|
+
var uncaughtFrozenStore = function (store) {
|
|
2440
|
+
return store.frozen || (store.frozen = new UncaughtFrozenStore());
|
|
2441
|
+
};
|
|
2442
|
+
|
|
2443
|
+
var UncaughtFrozenStore = function () {
|
|
2444
|
+
this.entries = [];
|
|
2445
|
+
};
|
|
2446
|
+
|
|
2447
|
+
var findUncaughtFrozen = function (store, key) {
|
|
2448
|
+
return find(store.entries, function (it) {
|
|
2449
|
+
return it[0] === key;
|
|
2450
|
+
});
|
|
2451
|
+
};
|
|
2452
|
+
|
|
2453
|
+
UncaughtFrozenStore.prototype = {
|
|
2454
|
+
get: function (key) {
|
|
2455
|
+
var entry = findUncaughtFrozen(this, key);
|
|
2456
|
+
if (entry) return entry[1];
|
|
2457
|
+
},
|
|
2458
|
+
has: function (key) {
|
|
2459
|
+
return !!findUncaughtFrozen(this, key);
|
|
2460
|
+
},
|
|
2461
|
+
set: function (key, value) {
|
|
2462
|
+
var entry = findUncaughtFrozen(this, key);
|
|
2463
|
+
if (entry) entry[1] = value;
|
|
2464
|
+
else this.entries.push([key, value]);
|
|
2465
|
+
},
|
|
2466
|
+
'delete': function (key) {
|
|
2467
|
+
var index = findIndex(this.entries, function (it) {
|
|
2468
|
+
return it[0] === key;
|
|
2469
|
+
});
|
|
2470
|
+
if (~index) splice(this.entries, index, 1);
|
|
2471
|
+
return !!~index;
|
|
2472
|
+
}
|
|
2473
|
+
};
|
|
2474
|
+
|
|
2475
|
+
var collectionWeak = {
|
|
2476
|
+
getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
|
|
2477
|
+
var Constructor = wrapper(function (that, iterable) {
|
|
2478
|
+
anInstance(that, Prototype);
|
|
2479
|
+
setInternalState$1(that, {
|
|
2480
|
+
type: CONSTRUCTOR_NAME,
|
|
2481
|
+
id: id++,
|
|
2482
|
+
frozen: undefined
|
|
2483
|
+
});
|
|
2484
|
+
if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP });
|
|
2485
|
+
});
|
|
2486
|
+
|
|
2487
|
+
var Prototype = Constructor.prototype;
|
|
2488
|
+
|
|
2489
|
+
var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
|
|
2490
|
+
|
|
2491
|
+
var define = function (that, key, value) {
|
|
2492
|
+
var state = getInternalState(that);
|
|
2493
|
+
var data = getWeakData(anObject(key), true);
|
|
2494
|
+
if (data === true) uncaughtFrozenStore(state).set(key, value);
|
|
2495
|
+
else data[state.id] = value;
|
|
2496
|
+
return that;
|
|
2497
|
+
};
|
|
2498
|
+
|
|
2499
|
+
redefineAll(Prototype, {
|
|
2500
|
+
// `{ WeakMap, WeakSet }.prototype.delete(key)` methods
|
|
2501
|
+
// https://tc39.es/ecma262/#sec-weakmap.prototype.delete
|
|
2502
|
+
// https://tc39.es/ecma262/#sec-weakset.prototype.delete
|
|
2503
|
+
'delete': function (key) {
|
|
2504
|
+
var state = getInternalState(this);
|
|
2505
|
+
if (!isObject(key)) return false;
|
|
2506
|
+
var data = getWeakData(key);
|
|
2507
|
+
if (data === true) return uncaughtFrozenStore(state)['delete'](key);
|
|
2508
|
+
return data && hasOwnProperty_1(data, state.id) && delete data[state.id];
|
|
2509
|
+
},
|
|
2510
|
+
// `{ WeakMap, WeakSet }.prototype.has(key)` methods
|
|
2511
|
+
// https://tc39.es/ecma262/#sec-weakmap.prototype.has
|
|
2512
|
+
// https://tc39.es/ecma262/#sec-weakset.prototype.has
|
|
2513
|
+
has: function has(key) {
|
|
2514
|
+
var state = getInternalState(this);
|
|
2515
|
+
if (!isObject(key)) return false;
|
|
2516
|
+
var data = getWeakData(key);
|
|
2517
|
+
if (data === true) return uncaughtFrozenStore(state).has(key);
|
|
2518
|
+
return data && hasOwnProperty_1(data, state.id);
|
|
2519
|
+
}
|
|
2520
|
+
});
|
|
2521
|
+
|
|
2522
|
+
redefineAll(Prototype, IS_MAP ? {
|
|
2523
|
+
// `WeakMap.prototype.get(key)` method
|
|
2524
|
+
// https://tc39.es/ecma262/#sec-weakmap.prototype.get
|
|
2525
|
+
get: function get(key) {
|
|
2526
|
+
var state = getInternalState(this);
|
|
2527
|
+
if (isObject(key)) {
|
|
2528
|
+
var data = getWeakData(key);
|
|
2529
|
+
if (data === true) return uncaughtFrozenStore(state).get(key);
|
|
2530
|
+
return data ? data[state.id] : undefined;
|
|
2531
|
+
}
|
|
2532
|
+
},
|
|
2533
|
+
// `WeakMap.prototype.set(key, value)` method
|
|
2534
|
+
// https://tc39.es/ecma262/#sec-weakmap.prototype.set
|
|
2535
|
+
set: function set(key, value) {
|
|
2536
|
+
return define(this, key, value);
|
|
2537
|
+
}
|
|
2538
|
+
} : {
|
|
2539
|
+
// `WeakSet.prototype.add(value)` method
|
|
2540
|
+
// https://tc39.es/ecma262/#sec-weakset.prototype.add
|
|
2541
|
+
add: function add(value) {
|
|
2542
|
+
return define(this, value, true);
|
|
2543
|
+
}
|
|
2544
|
+
});
|
|
2545
|
+
|
|
2546
|
+
return Constructor;
|
|
2547
|
+
}
|
|
2548
|
+
};
|
|
2549
|
+
|
|
2550
|
+
var enforceIternalState = internalState.enforce;
|
|
2551
|
+
|
|
2552
|
+
|
|
2553
|
+
var IS_IE11 = !global$1.ActiveXObject && 'ActiveXObject' in global$1;
|
|
2554
|
+
var InternalWeakMap;
|
|
2555
|
+
|
|
2556
|
+
var wrapper = function (init) {
|
|
2557
|
+
return function WeakMap() {
|
|
2558
|
+
return init(this, arguments.length ? arguments[0] : undefined);
|
|
2559
|
+
};
|
|
2560
|
+
};
|
|
2561
|
+
|
|
2562
|
+
// `WeakMap` constructor
|
|
2563
|
+
// https://tc39.es/ecma262/#sec-weakmap-constructor
|
|
2564
|
+
var $WeakMap = collection('WeakMap', wrapper, collectionWeak);
|
|
2565
|
+
|
|
2566
|
+
// IE11 WeakMap frozen keys fix
|
|
2567
|
+
// We can't use feature detection because it crash some old IE builds
|
|
2568
|
+
// https://github.com/zloirock/core-js/issues/485
|
|
2569
|
+
if (nativeWeakMap && IS_IE11) {
|
|
2570
|
+
InternalWeakMap = collectionWeak.getConstructor(wrapper, 'WeakMap', true);
|
|
2571
|
+
internalMetadata.enable();
|
|
2572
|
+
var WeakMapPrototype = $WeakMap.prototype;
|
|
2573
|
+
var nativeDelete = functionUncurryThis(WeakMapPrototype['delete']);
|
|
2574
|
+
var nativeHas = functionUncurryThis(WeakMapPrototype.has);
|
|
2575
|
+
var nativeGet = functionUncurryThis(WeakMapPrototype.get);
|
|
2576
|
+
var nativeSet = functionUncurryThis(WeakMapPrototype.set);
|
|
2577
|
+
redefineAll(WeakMapPrototype, {
|
|
2578
|
+
'delete': function (key) {
|
|
2579
|
+
if (isObject(key) && !objectIsExtensible(key)) {
|
|
2580
|
+
var state = enforceIternalState(this);
|
|
2581
|
+
if (!state.frozen) state.frozen = new InternalWeakMap();
|
|
2582
|
+
return nativeDelete(this, key) || state.frozen['delete'](key);
|
|
2583
|
+
} return nativeDelete(this, key);
|
|
2584
|
+
},
|
|
2585
|
+
has: function has(key) {
|
|
2586
|
+
if (isObject(key) && !objectIsExtensible(key)) {
|
|
2587
|
+
var state = enforceIternalState(this);
|
|
2588
|
+
if (!state.frozen) state.frozen = new InternalWeakMap();
|
|
2589
|
+
return nativeHas(this, key) || state.frozen.has(key);
|
|
2590
|
+
} return nativeHas(this, key);
|
|
2591
|
+
},
|
|
2592
|
+
get: function get(key) {
|
|
2593
|
+
if (isObject(key) && !objectIsExtensible(key)) {
|
|
2594
|
+
var state = enforceIternalState(this);
|
|
2595
|
+
if (!state.frozen) state.frozen = new InternalWeakMap();
|
|
2596
|
+
return nativeHas(this, key) ? nativeGet(this, key) : state.frozen.get(key);
|
|
2597
|
+
} return nativeGet(this, key);
|
|
2598
|
+
},
|
|
2599
|
+
set: function set(key, value) {
|
|
2600
|
+
if (isObject(key) && !objectIsExtensible(key)) {
|
|
2601
|
+
var state = enforceIternalState(this);
|
|
2602
|
+
if (!state.frozen) state.frozen = new InternalWeakMap();
|
|
2603
|
+
nativeHas(this, key) ? nativeSet(this, key, value) : state.frozen.set(key, value);
|
|
2604
|
+
} else nativeSet(this, key, value);
|
|
2605
|
+
return this;
|
|
2606
|
+
}
|
|
2607
|
+
});
|
|
2608
|
+
}
|
|
2609
|
+
|
|
2610
|
+
// iterable DOM collections
|
|
2611
|
+
// flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
|
|
2612
|
+
var domIterables = {
|
|
2613
|
+
CSSRuleList: 0,
|
|
2614
|
+
CSSStyleDeclaration: 0,
|
|
2615
|
+
CSSValueList: 0,
|
|
2616
|
+
ClientRectList: 0,
|
|
2617
|
+
DOMRectList: 0,
|
|
2618
|
+
DOMStringList: 0,
|
|
2619
|
+
DOMTokenList: 1,
|
|
2620
|
+
DataTransferItemList: 0,
|
|
2621
|
+
FileList: 0,
|
|
2622
|
+
HTMLAllCollection: 0,
|
|
2623
|
+
HTMLCollection: 0,
|
|
2624
|
+
HTMLFormElement: 0,
|
|
2625
|
+
HTMLSelectElement: 0,
|
|
2626
|
+
MediaList: 0,
|
|
2627
|
+
MimeTypeArray: 0,
|
|
2628
|
+
NamedNodeMap: 0,
|
|
2629
|
+
NodeList: 1,
|
|
2630
|
+
PaintRequestList: 0,
|
|
2631
|
+
Plugin: 0,
|
|
2632
|
+
PluginArray: 0,
|
|
2633
|
+
SVGLengthList: 0,
|
|
2634
|
+
SVGNumberList: 0,
|
|
2635
|
+
SVGPathSegList: 0,
|
|
2636
|
+
SVGPointList: 0,
|
|
2637
|
+
SVGStringList: 0,
|
|
2638
|
+
SVGTransformList: 0,
|
|
2639
|
+
SourceBufferList: 0,
|
|
2640
|
+
StyleSheetList: 0,
|
|
2641
|
+
TextTrackCueList: 0,
|
|
2642
|
+
TextTrackList: 0,
|
|
2643
|
+
TouchList: 0
|
|
2644
|
+
};
|
|
2645
|
+
|
|
2646
|
+
// in old WebKit versions, `element.classList` is not an instance of global `DOMTokenList`
|
|
2647
|
+
|
|
2648
|
+
|
|
2649
|
+
var classList = documentCreateElement('span').classList;
|
|
2650
|
+
var DOMTokenListPrototype = classList && classList.constructor && classList.constructor.prototype;
|
|
2651
|
+
|
|
2652
|
+
var domTokenListPrototype = DOMTokenListPrototype === Object.prototype ? undefined : DOMTokenListPrototype;
|
|
2653
|
+
|
|
2654
|
+
var ITERATOR = wellKnownSymbol('iterator');
|
|
2655
|
+
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
|
|
2656
|
+
var ArrayValues = es_array_iterator.values;
|
|
2657
|
+
|
|
2658
|
+
var handlePrototype$1 = function (CollectionPrototype, COLLECTION_NAME) {
|
|
2659
|
+
if (CollectionPrototype) {
|
|
2660
|
+
// some Chrome versions have non-configurable methods on DOMTokenList
|
|
2661
|
+
if (CollectionPrototype[ITERATOR] !== ArrayValues) try {
|
|
2662
|
+
createNonEnumerableProperty(CollectionPrototype, ITERATOR, ArrayValues);
|
|
2663
|
+
} catch (error) {
|
|
2664
|
+
CollectionPrototype[ITERATOR] = ArrayValues;
|
|
2665
|
+
}
|
|
2666
|
+
if (!CollectionPrototype[TO_STRING_TAG]) {
|
|
2667
|
+
createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME);
|
|
2668
|
+
}
|
|
2669
|
+
if (domIterables[COLLECTION_NAME]) for (var METHOD_NAME in es_array_iterator) {
|
|
2670
|
+
// some Chrome versions have non-configurable methods on DOMTokenList
|
|
2671
|
+
if (CollectionPrototype[METHOD_NAME] !== es_array_iterator[METHOD_NAME]) try {
|
|
2672
|
+
createNonEnumerableProperty(CollectionPrototype, METHOD_NAME, es_array_iterator[METHOD_NAME]);
|
|
2673
|
+
} catch (error) {
|
|
2674
|
+
CollectionPrototype[METHOD_NAME] = es_array_iterator[METHOD_NAME];
|
|
2675
|
+
}
|
|
2676
|
+
}
|
|
2677
|
+
}
|
|
2678
|
+
};
|
|
2679
|
+
|
|
2680
|
+
for (var COLLECTION_NAME$1 in domIterables) {
|
|
2681
|
+
handlePrototype$1(global$1[COLLECTION_NAME$1] && global$1[COLLECTION_NAME$1].prototype, COLLECTION_NAME$1);
|
|
2682
|
+
}
|
|
2683
|
+
|
|
2684
|
+
handlePrototype$1(domTokenListPrototype, 'DOMTokenList');
|
|
2685
|
+
|
|
2686
|
+
var arrayMethodIsStrict = function (METHOD_NAME, argument) {
|
|
2687
|
+
var method = [][METHOD_NAME];
|
|
2688
|
+
return !!method && fails(function () {
|
|
2689
|
+
// eslint-disable-next-line no-useless-call,no-throw-literal -- required for testing
|
|
2690
|
+
method.call(null, argument || function () { throw 1; }, 1);
|
|
2691
|
+
});
|
|
2692
|
+
};
|
|
2693
|
+
|
|
2694
|
+
var $forEach = arrayIteration.forEach;
|
|
2695
|
+
|
|
2696
|
+
|
|
2697
|
+
var STRICT_METHOD$1 = arrayMethodIsStrict('forEach');
|
|
2698
|
+
|
|
2699
|
+
// `Array.prototype.forEach` method implementation
|
|
2700
|
+
// https://tc39.es/ecma262/#sec-array.prototype.foreach
|
|
2701
|
+
var arrayForEach = !STRICT_METHOD$1 ? function forEach(callbackfn /* , thisArg */) {
|
|
2702
|
+
return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
|
2703
|
+
// eslint-disable-next-line es/no-array-prototype-foreach -- safe
|
|
2704
|
+
} : [].forEach;
|
|
2705
|
+
|
|
2706
|
+
var handlePrototype = function (CollectionPrototype) {
|
|
2707
|
+
// some Chrome versions have non-configurable methods on DOMTokenList
|
|
2708
|
+
if (CollectionPrototype && CollectionPrototype.forEach !== arrayForEach) try {
|
|
2709
|
+
createNonEnumerableProperty(CollectionPrototype, 'forEach', arrayForEach);
|
|
2710
|
+
} catch (error) {
|
|
2711
|
+
CollectionPrototype.forEach = arrayForEach;
|
|
2712
|
+
}
|
|
2713
|
+
};
|
|
2714
|
+
|
|
2715
|
+
for (var COLLECTION_NAME in domIterables) {
|
|
2716
|
+
if (domIterables[COLLECTION_NAME]) {
|
|
2717
|
+
handlePrototype(global$1[COLLECTION_NAME] && global$1[COLLECTION_NAME].prototype);
|
|
2718
|
+
}
|
|
2719
|
+
}
|
|
2720
|
+
|
|
2721
|
+
handlePrototype(domTokenListPrototype);
|
|
2722
|
+
|
|
2723
|
+
var nativePromiseConstructor = global$1.Promise;
|
|
2724
|
+
|
|
2725
|
+
var SPECIES$1 = wellKnownSymbol('species');
|
|
2726
|
+
|
|
2727
|
+
var setSpecies = function (CONSTRUCTOR_NAME) {
|
|
2728
|
+
var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
|
|
2729
|
+
var defineProperty = objectDefineProperty.f;
|
|
2730
|
+
|
|
2731
|
+
if (descriptors && Constructor && !Constructor[SPECIES$1]) {
|
|
2732
|
+
defineProperty(Constructor, SPECIES$1, {
|
|
2733
|
+
configurable: true,
|
|
2734
|
+
get: function () { return this; }
|
|
2735
|
+
});
|
|
2736
|
+
}
|
|
2737
|
+
};
|
|
2738
|
+
|
|
2739
|
+
var engineIsIos = /(?:ipad|iphone|ipod).*applewebkit/i.test(engineUserAgent);
|
|
2740
|
+
|
|
2741
|
+
var engineIsNode = classofRaw(global$1.process) == 'process';
|
|
2742
|
+
|
|
2743
|
+
var set = global$1.setImmediate;
|
|
2744
|
+
var clear = global$1.clearImmediate;
|
|
2745
|
+
var process$2 = global$1.process;
|
|
2746
|
+
var Dispatch = global$1.Dispatch;
|
|
2747
|
+
var Function$1 = global$1.Function;
|
|
2748
|
+
var MessageChannel = global$1.MessageChannel;
|
|
2749
|
+
var String$1 = global$1.String;
|
|
2750
|
+
var counter = 0;
|
|
2751
|
+
var queue = {};
|
|
2752
|
+
var ONREADYSTATECHANGE = 'onreadystatechange';
|
|
2753
|
+
var location, defer, channel, port;
|
|
2754
|
+
|
|
2755
|
+
try {
|
|
2756
|
+
// Deno throws a ReferenceError on `location` access without `--location` flag
|
|
2757
|
+
location = global$1.location;
|
|
2758
|
+
} catch (error) { /* empty */ }
|
|
2759
|
+
|
|
2760
|
+
var run = function (id) {
|
|
2761
|
+
if (hasOwnProperty_1(queue, id)) {
|
|
2762
|
+
var fn = queue[id];
|
|
2763
|
+
delete queue[id];
|
|
2764
|
+
fn();
|
|
2765
|
+
}
|
|
2766
|
+
};
|
|
2767
|
+
|
|
2768
|
+
var runner = function (id) {
|
|
2769
|
+
return function () {
|
|
2770
|
+
run(id);
|
|
2771
|
+
};
|
|
2772
|
+
};
|
|
2773
|
+
|
|
2774
|
+
var listener = function (event) {
|
|
2775
|
+
run(event.data);
|
|
2776
|
+
};
|
|
2777
|
+
|
|
2778
|
+
var post = function (id) {
|
|
2779
|
+
// old engines have not location.origin
|
|
2780
|
+
global$1.postMessage(String$1(id), location.protocol + '//' + location.host);
|
|
2781
|
+
};
|
|
2782
|
+
|
|
2783
|
+
// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
|
|
2784
|
+
if (!set || !clear) {
|
|
2785
|
+
set = function setImmediate(fn) {
|
|
2786
|
+
var args = arraySlice(arguments, 1);
|
|
2787
|
+
queue[++counter] = function () {
|
|
2788
|
+
functionApply(isCallable(fn) ? fn : Function$1(fn), undefined, args);
|
|
2789
|
+
};
|
|
2790
|
+
defer(counter);
|
|
2791
|
+
return counter;
|
|
2792
|
+
};
|
|
2793
|
+
clear = function clearImmediate(id) {
|
|
2794
|
+
delete queue[id];
|
|
2795
|
+
};
|
|
2796
|
+
// Node.js 0.8-
|
|
2797
|
+
if (engineIsNode) {
|
|
2798
|
+
defer = function (id) {
|
|
2799
|
+
process$2.nextTick(runner(id));
|
|
2800
|
+
};
|
|
2801
|
+
// Sphere (JS game engine) Dispatch API
|
|
2802
|
+
} else if (Dispatch && Dispatch.now) {
|
|
2803
|
+
defer = function (id) {
|
|
2804
|
+
Dispatch.now(runner(id));
|
|
2805
|
+
};
|
|
2806
|
+
// Browsers with MessageChannel, includes WebWorkers
|
|
2807
|
+
// except iOS - https://github.com/zloirock/core-js/issues/624
|
|
2808
|
+
} else if (MessageChannel && !engineIsIos) {
|
|
2809
|
+
channel = new MessageChannel();
|
|
2810
|
+
port = channel.port2;
|
|
2811
|
+
channel.port1.onmessage = listener;
|
|
2812
|
+
defer = functionBindContext(port.postMessage, port);
|
|
2813
|
+
// Browsers with postMessage, skip WebWorkers
|
|
2814
|
+
// IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
|
|
2815
|
+
} else if (
|
|
2816
|
+
global$1.addEventListener &&
|
|
2817
|
+
isCallable(global$1.postMessage) &&
|
|
2818
|
+
!global$1.importScripts &&
|
|
2819
|
+
location && location.protocol !== 'file:' &&
|
|
2820
|
+
!fails(post)
|
|
2821
|
+
) {
|
|
2822
|
+
defer = post;
|
|
2823
|
+
global$1.addEventListener('message', listener, false);
|
|
2824
|
+
// IE8-
|
|
2825
|
+
} else if (ONREADYSTATECHANGE in documentCreateElement('script')) {
|
|
2826
|
+
defer = function (id) {
|
|
2827
|
+
html.appendChild(documentCreateElement('script'))[ONREADYSTATECHANGE] = function () {
|
|
2828
|
+
html.removeChild(this);
|
|
2829
|
+
run(id);
|
|
2830
|
+
};
|
|
2831
|
+
};
|
|
2832
|
+
// Rest old browsers
|
|
2833
|
+
} else {
|
|
2834
|
+
defer = function (id) {
|
|
2835
|
+
setTimeout(runner(id), 0);
|
|
2836
|
+
};
|
|
2837
|
+
}
|
|
2838
|
+
}
|
|
2839
|
+
|
|
2840
|
+
var task$1 = {
|
|
2841
|
+
set: set,
|
|
2842
|
+
clear: clear
|
|
2843
|
+
};
|
|
2844
|
+
|
|
2845
|
+
var engineIsIosPebble = /ipad|iphone|ipod/i.test(engineUserAgent) && global$1.Pebble !== undefined;
|
|
2846
|
+
|
|
2847
|
+
var engineIsWebosWebkit = /web0s(?!.*chrome)/i.test(engineUserAgent);
|
|
2848
|
+
|
|
2849
|
+
var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
|
|
2850
|
+
var macrotask = task$1.set;
|
|
2851
|
+
|
|
2852
|
+
|
|
2853
|
+
|
|
2854
|
+
|
|
2855
|
+
|
|
2856
|
+
var MutationObserver = global$1.MutationObserver || global$1.WebKitMutationObserver;
|
|
2857
|
+
var document$2 = global$1.document;
|
|
2858
|
+
var process$1 = global$1.process;
|
|
2859
|
+
var Promise$1 = global$1.Promise;
|
|
2860
|
+
// Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`
|
|
2861
|
+
var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global$1, 'queueMicrotask');
|
|
2862
|
+
var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;
|
|
2863
|
+
|
|
2864
|
+
var flush, head, last, notify$1, toggle, node, promise, then;
|
|
2865
|
+
|
|
2866
|
+
// modern engines have queueMicrotask method
|
|
2867
|
+
if (!queueMicrotask) {
|
|
2868
|
+
flush = function () {
|
|
2869
|
+
var parent, fn;
|
|
2870
|
+
if (engineIsNode && (parent = process$1.domain)) parent.exit();
|
|
2871
|
+
while (head) {
|
|
2872
|
+
fn = head.fn;
|
|
2873
|
+
head = head.next;
|
|
2874
|
+
try {
|
|
2875
|
+
fn();
|
|
2876
|
+
} catch (error) {
|
|
2877
|
+
if (head) notify$1();
|
|
2878
|
+
else last = undefined;
|
|
2879
|
+
throw error;
|
|
2880
|
+
}
|
|
2881
|
+
} last = undefined;
|
|
2882
|
+
if (parent) parent.enter();
|
|
2883
|
+
};
|
|
2884
|
+
|
|
2885
|
+
// browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
|
|
2886
|
+
// also except WebOS Webkit https://github.com/zloirock/core-js/issues/898
|
|
2887
|
+
if (!engineIsIos && !engineIsNode && !engineIsWebosWebkit && MutationObserver && document$2) {
|
|
2888
|
+
toggle = true;
|
|
2889
|
+
node = document$2.createTextNode('');
|
|
2890
|
+
new MutationObserver(flush).observe(node, { characterData: true });
|
|
2891
|
+
notify$1 = function () {
|
|
2892
|
+
node.data = toggle = !toggle;
|
|
2893
|
+
};
|
|
2894
|
+
// environments with maybe non-completely correct, but existent Promise
|
|
2895
|
+
} else if (!engineIsIosPebble && Promise$1 && Promise$1.resolve) {
|
|
2896
|
+
// Promise.resolve without an argument throws an error in LG WebOS 2
|
|
2897
|
+
promise = Promise$1.resolve(undefined);
|
|
2898
|
+
// workaround of WebKit ~ iOS Safari 10.1 bug
|
|
2899
|
+
promise.constructor = Promise$1;
|
|
2900
|
+
then = functionBindContext(promise.then, promise);
|
|
2901
|
+
notify$1 = function () {
|
|
2902
|
+
then(flush);
|
|
2903
|
+
};
|
|
2904
|
+
// Node.js without promises
|
|
2905
|
+
} else if (engineIsNode) {
|
|
2906
|
+
notify$1 = function () {
|
|
2907
|
+
process$1.nextTick(flush);
|
|
2908
|
+
};
|
|
2909
|
+
// for other environments - macrotask based on:
|
|
2910
|
+
// - setImmediate
|
|
2911
|
+
// - MessageChannel
|
|
2912
|
+
// - window.postMessag
|
|
2913
|
+
// - onreadystatechange
|
|
2914
|
+
// - setTimeout
|
|
2915
|
+
} else {
|
|
2916
|
+
// strange IE + webpack dev server bug - use .bind(global)
|
|
2917
|
+
macrotask = functionBindContext(macrotask, global$1);
|
|
2918
|
+
notify$1 = function () {
|
|
2919
|
+
macrotask(flush);
|
|
2920
|
+
};
|
|
2921
|
+
}
|
|
2922
|
+
}
|
|
2923
|
+
|
|
2924
|
+
var microtask = queueMicrotask || function (fn) {
|
|
2925
|
+
var task = { fn: fn, next: undefined };
|
|
2926
|
+
if (last) last.next = task;
|
|
2927
|
+
if (!head) {
|
|
2928
|
+
head = task;
|
|
2929
|
+
notify$1();
|
|
2930
|
+
} last = task;
|
|
2931
|
+
};
|
|
2932
|
+
|
|
2933
|
+
var PromiseCapability = function (C) {
|
|
2934
|
+
var resolve, reject;
|
|
2935
|
+
this.promise = new C(function ($$resolve, $$reject) {
|
|
2936
|
+
if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
|
|
2937
|
+
resolve = $$resolve;
|
|
2938
|
+
reject = $$reject;
|
|
2939
|
+
});
|
|
2940
|
+
this.resolve = aCallable(resolve);
|
|
2941
|
+
this.reject = aCallable(reject);
|
|
2942
|
+
};
|
|
2943
|
+
|
|
2944
|
+
// `NewPromiseCapability` abstract operation
|
|
2945
|
+
// https://tc39.es/ecma262/#sec-newpromisecapability
|
|
2946
|
+
var f = function (C) {
|
|
2947
|
+
return new PromiseCapability(C);
|
|
2948
|
+
};
|
|
2949
|
+
|
|
2950
|
+
var newPromiseCapability$1 = {
|
|
2951
|
+
f: f
|
|
2952
|
+
};
|
|
2953
|
+
|
|
2954
|
+
var promiseResolve = function (C, x) {
|
|
2955
|
+
anObject(C);
|
|
2956
|
+
if (isObject(x) && x.constructor === C) return x;
|
|
2957
|
+
var promiseCapability = newPromiseCapability$1.f(C);
|
|
2958
|
+
var resolve = promiseCapability.resolve;
|
|
2959
|
+
resolve(x);
|
|
2960
|
+
return promiseCapability.promise;
|
|
2961
|
+
};
|
|
2962
|
+
|
|
2963
|
+
var hostReportErrors = function (a, b) {
|
|
2964
|
+
var console = global$1.console;
|
|
2965
|
+
if (console && console.error) {
|
|
2966
|
+
arguments.length == 1 ? console.error(a) : console.error(a, b);
|
|
2967
|
+
}
|
|
2968
|
+
};
|
|
2969
|
+
|
|
2970
|
+
var perform = function (exec) {
|
|
2971
|
+
try {
|
|
2972
|
+
return { error: false, value: exec() };
|
|
2973
|
+
} catch (error) {
|
|
2974
|
+
return { error: true, value: error };
|
|
2975
|
+
}
|
|
2976
|
+
};
|
|
2977
|
+
|
|
2978
|
+
var engineIsBrowser = typeof window == 'object';
|
|
2979
|
+
|
|
2980
|
+
var task = task$1.set;
|
|
2981
|
+
|
|
2982
|
+
|
|
2983
|
+
|
|
2984
|
+
|
|
2985
|
+
|
|
2986
|
+
|
|
2987
|
+
|
|
2988
|
+
|
|
2989
|
+
|
|
2990
|
+
|
|
2991
|
+
|
|
2992
|
+
|
|
2993
|
+
var SPECIES = wellKnownSymbol('species');
|
|
2994
|
+
var PROMISE = 'Promise';
|
|
2995
|
+
|
|
2996
|
+
var getInternalState = internalState.getterFor(PROMISE);
|
|
2997
|
+
var setInternalState = internalState.set;
|
|
2998
|
+
var getInternalPromiseState = internalState.getterFor(PROMISE);
|
|
2999
|
+
var NativePromisePrototype = nativePromiseConstructor && nativePromiseConstructor.prototype;
|
|
3000
|
+
var PromiseConstructor = nativePromiseConstructor;
|
|
3001
|
+
var PromisePrototype = NativePromisePrototype;
|
|
3002
|
+
var TypeError$1 = global$1.TypeError;
|
|
3003
|
+
var document$1 = global$1.document;
|
|
3004
|
+
var process = global$1.process;
|
|
3005
|
+
var newPromiseCapability = newPromiseCapability$1.f;
|
|
3006
|
+
var newGenericPromiseCapability = newPromiseCapability;
|
|
3007
|
+
|
|
3008
|
+
var DISPATCH_EVENT = !!(document$1 && document$1.createEvent && global$1.dispatchEvent);
|
|
3009
|
+
var NATIVE_REJECTION_EVENT = isCallable(global$1.PromiseRejectionEvent);
|
|
3010
|
+
var UNHANDLED_REJECTION = 'unhandledrejection';
|
|
3011
|
+
var REJECTION_HANDLED = 'rejectionhandled';
|
|
3012
|
+
var PENDING = 0;
|
|
3013
|
+
var FULFILLED = 1;
|
|
3014
|
+
var REJECTED = 2;
|
|
3015
|
+
var HANDLED = 1;
|
|
3016
|
+
var UNHANDLED = 2;
|
|
3017
|
+
var SUBCLASSING = false;
|
|
3018
|
+
|
|
3019
|
+
var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
|
|
3020
|
+
|
|
3021
|
+
var FORCED = isForced_1(PROMISE, function () {
|
|
3022
|
+
var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(PromiseConstructor);
|
|
3023
|
+
var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(PromiseConstructor);
|
|
3024
|
+
// V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
|
|
3025
|
+
// https://bugs.chromium.org/p/chromium/issues/detail?id=830565
|
|
3026
|
+
// We can't detect it synchronously, so just check versions
|
|
3027
|
+
if (!GLOBAL_CORE_JS_PROMISE && engineV8Version === 66) return true;
|
|
3028
|
+
// We can't use @@species feature detection in V8 since it causes
|
|
3029
|
+
// deoptimization and performance degradation
|
|
3030
|
+
// https://github.com/zloirock/core-js/issues/679
|
|
3031
|
+
if (engineV8Version >= 51 && /native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) return false;
|
|
3032
|
+
// Detect correctness of subclassing with @@species support
|
|
3033
|
+
var promise = new PromiseConstructor(function (resolve) { resolve(1); });
|
|
3034
|
+
var FakePromise = function (exec) {
|
|
3035
|
+
exec(function () { /* empty */ }, function () { /* empty */ });
|
|
3036
|
+
};
|
|
3037
|
+
var constructor = promise.constructor = {};
|
|
3038
|
+
constructor[SPECIES] = FakePromise;
|
|
3039
|
+
SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise;
|
|
3040
|
+
if (!SUBCLASSING) return true;
|
|
3041
|
+
// Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
|
|
3042
|
+
return !GLOBAL_CORE_JS_PROMISE && engineIsBrowser && !NATIVE_REJECTION_EVENT;
|
|
3043
|
+
});
|
|
3044
|
+
|
|
3045
|
+
var INCORRECT_ITERATION = FORCED || !checkCorrectnessOfIteration(function (iterable) {
|
|
3046
|
+
PromiseConstructor.all(iterable)['catch'](function () { /* empty */ });
|
|
3047
|
+
});
|
|
3048
|
+
|
|
3049
|
+
// helpers
|
|
3050
|
+
var isThenable = function (it) {
|
|
3051
|
+
var then;
|
|
3052
|
+
return isObject(it) && isCallable(then = it.then) ? then : false;
|
|
3053
|
+
};
|
|
3054
|
+
|
|
3055
|
+
var notify = function (state, isReject) {
|
|
3056
|
+
if (state.notified) return;
|
|
3057
|
+
state.notified = true;
|
|
3058
|
+
var chain = state.reactions;
|
|
3059
|
+
microtask(function () {
|
|
3060
|
+
var value = state.value;
|
|
3061
|
+
var ok = state.state == FULFILLED;
|
|
3062
|
+
var index = 0;
|
|
3063
|
+
// variable length - can't use forEach
|
|
3064
|
+
while (chain.length > index) {
|
|
3065
|
+
var reaction = chain[index++];
|
|
3066
|
+
var handler = ok ? reaction.ok : reaction.fail;
|
|
3067
|
+
var resolve = reaction.resolve;
|
|
3068
|
+
var reject = reaction.reject;
|
|
3069
|
+
var domain = reaction.domain;
|
|
3070
|
+
var result, then, exited;
|
|
3071
|
+
try {
|
|
3072
|
+
if (handler) {
|
|
3073
|
+
if (!ok) {
|
|
3074
|
+
if (state.rejection === UNHANDLED) onHandleUnhandled(state);
|
|
3075
|
+
state.rejection = HANDLED;
|
|
3076
|
+
}
|
|
3077
|
+
if (handler === true) result = value;
|
|
3078
|
+
else {
|
|
3079
|
+
if (domain) domain.enter();
|
|
3080
|
+
result = handler(value); // can throw
|
|
3081
|
+
if (domain) {
|
|
3082
|
+
domain.exit();
|
|
3083
|
+
exited = true;
|
|
3084
|
+
}
|
|
3085
|
+
}
|
|
3086
|
+
if (result === reaction.promise) {
|
|
3087
|
+
reject(TypeError$1('Promise-chain cycle'));
|
|
3088
|
+
} else if (then = isThenable(result)) {
|
|
3089
|
+
functionCall(then, result, resolve, reject);
|
|
3090
|
+
} else resolve(result);
|
|
3091
|
+
} else reject(value);
|
|
3092
|
+
} catch (error) {
|
|
3093
|
+
if (domain && !exited) domain.exit();
|
|
3094
|
+
reject(error);
|
|
3095
|
+
}
|
|
3096
|
+
}
|
|
3097
|
+
state.reactions = [];
|
|
3098
|
+
state.notified = false;
|
|
3099
|
+
if (isReject && !state.rejection) onUnhandled(state);
|
|
3100
|
+
});
|
|
3101
|
+
};
|
|
3102
|
+
|
|
3103
|
+
var dispatchEvent = function (name, promise, reason) {
|
|
3104
|
+
var event, handler;
|
|
3105
|
+
if (DISPATCH_EVENT) {
|
|
3106
|
+
event = document$1.createEvent('Event');
|
|
3107
|
+
event.promise = promise;
|
|
3108
|
+
event.reason = reason;
|
|
3109
|
+
event.initEvent(name, false, true);
|
|
3110
|
+
global$1.dispatchEvent(event);
|
|
3111
|
+
} else event = { promise: promise, reason: reason };
|
|
3112
|
+
if (!NATIVE_REJECTION_EVENT && (handler = global$1['on' + name])) handler(event);
|
|
3113
|
+
else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);
|
|
3114
|
+
};
|
|
3115
|
+
|
|
3116
|
+
var onUnhandled = function (state) {
|
|
3117
|
+
functionCall(task, global$1, function () {
|
|
3118
|
+
var promise = state.facade;
|
|
3119
|
+
var value = state.value;
|
|
3120
|
+
var IS_UNHANDLED = isUnhandled(state);
|
|
3121
|
+
var result;
|
|
3122
|
+
if (IS_UNHANDLED) {
|
|
3123
|
+
result = perform(function () {
|
|
3124
|
+
if (engineIsNode) {
|
|
3125
|
+
process.emit('unhandledRejection', value, promise);
|
|
3126
|
+
} else dispatchEvent(UNHANDLED_REJECTION, promise, value);
|
|
3127
|
+
});
|
|
3128
|
+
// Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
|
|
3129
|
+
state.rejection = engineIsNode || isUnhandled(state) ? UNHANDLED : HANDLED;
|
|
3130
|
+
if (result.error) throw result.value;
|
|
3131
|
+
}
|
|
3132
|
+
});
|
|
3133
|
+
};
|
|
3134
|
+
|
|
3135
|
+
var isUnhandled = function (state) {
|
|
3136
|
+
return state.rejection !== HANDLED && !state.parent;
|
|
3137
|
+
};
|
|
3138
|
+
|
|
3139
|
+
var onHandleUnhandled = function (state) {
|
|
3140
|
+
functionCall(task, global$1, function () {
|
|
3141
|
+
var promise = state.facade;
|
|
3142
|
+
if (engineIsNode) {
|
|
3143
|
+
process.emit('rejectionHandled', promise);
|
|
3144
|
+
} else dispatchEvent(REJECTION_HANDLED, promise, state.value);
|
|
3145
|
+
});
|
|
3146
|
+
};
|
|
3147
|
+
|
|
3148
|
+
var bind = function (fn, state, unwrap) {
|
|
3149
|
+
return function (value) {
|
|
3150
|
+
fn(state, value, unwrap);
|
|
3151
|
+
};
|
|
3152
|
+
};
|
|
3153
|
+
|
|
3154
|
+
var internalReject = function (state, value, unwrap) {
|
|
3155
|
+
if (state.done) return;
|
|
3156
|
+
state.done = true;
|
|
3157
|
+
if (unwrap) state = unwrap;
|
|
3158
|
+
state.value = value;
|
|
3159
|
+
state.state = REJECTED;
|
|
3160
|
+
notify(state, true);
|
|
3161
|
+
};
|
|
3162
|
+
|
|
3163
|
+
var internalResolve = function (state, value, unwrap) {
|
|
3164
|
+
if (state.done) return;
|
|
3165
|
+
state.done = true;
|
|
3166
|
+
if (unwrap) state = unwrap;
|
|
3167
|
+
try {
|
|
3168
|
+
if (state.facade === value) throw TypeError$1("Promise can't be resolved itself");
|
|
3169
|
+
var then = isThenable(value);
|
|
3170
|
+
if (then) {
|
|
3171
|
+
microtask(function () {
|
|
3172
|
+
var wrapper = { done: false };
|
|
3173
|
+
try {
|
|
3174
|
+
functionCall(then, value,
|
|
3175
|
+
bind(internalResolve, wrapper, state),
|
|
3176
|
+
bind(internalReject, wrapper, state)
|
|
3177
|
+
);
|
|
3178
|
+
} catch (error) {
|
|
3179
|
+
internalReject(wrapper, error, state);
|
|
3180
|
+
}
|
|
3181
|
+
});
|
|
3182
|
+
} else {
|
|
3183
|
+
state.value = value;
|
|
3184
|
+
state.state = FULFILLED;
|
|
3185
|
+
notify(state, false);
|
|
3186
|
+
}
|
|
3187
|
+
} catch (error) {
|
|
3188
|
+
internalReject({ done: false }, error, state);
|
|
3189
|
+
}
|
|
3190
|
+
};
|
|
3191
|
+
|
|
3192
|
+
// constructor polyfill
|
|
3193
|
+
if (FORCED) {
|
|
3194
|
+
// 25.4.3.1 Promise(executor)
|
|
3195
|
+
PromiseConstructor = function Promise(executor) {
|
|
3196
|
+
anInstance(this, PromisePrototype);
|
|
3197
|
+
aCallable(executor);
|
|
3198
|
+
functionCall(Internal, this);
|
|
3199
|
+
var state = getInternalState(this);
|
|
3200
|
+
try {
|
|
3201
|
+
executor(bind(internalResolve, state), bind(internalReject, state));
|
|
3202
|
+
} catch (error) {
|
|
3203
|
+
internalReject(state, error);
|
|
3204
|
+
}
|
|
3205
|
+
};
|
|
3206
|
+
PromisePrototype = PromiseConstructor.prototype;
|
|
3207
|
+
// eslint-disable-next-line no-unused-vars -- required for `.length`
|
|
3208
|
+
Internal = function Promise(executor) {
|
|
3209
|
+
setInternalState(this, {
|
|
3210
|
+
type: PROMISE,
|
|
3211
|
+
done: false,
|
|
3212
|
+
notified: false,
|
|
3213
|
+
parent: false,
|
|
3214
|
+
reactions: [],
|
|
3215
|
+
rejection: false,
|
|
3216
|
+
state: PENDING,
|
|
3217
|
+
value: undefined
|
|
3218
|
+
});
|
|
3219
|
+
};
|
|
3220
|
+
Internal.prototype = redefineAll(PromisePrototype, {
|
|
3221
|
+
// `Promise.prototype.then` method
|
|
3222
|
+
// https://tc39.es/ecma262/#sec-promise.prototype.then
|
|
3223
|
+
then: function then(onFulfilled, onRejected) {
|
|
3224
|
+
var state = getInternalPromiseState(this);
|
|
3225
|
+
var reactions = state.reactions;
|
|
3226
|
+
var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));
|
|
3227
|
+
reaction.ok = isCallable(onFulfilled) ? onFulfilled : true;
|
|
3228
|
+
reaction.fail = isCallable(onRejected) && onRejected;
|
|
3229
|
+
reaction.domain = engineIsNode ? process.domain : undefined;
|
|
3230
|
+
state.parent = true;
|
|
3231
|
+
reactions[reactions.length] = reaction;
|
|
3232
|
+
if (state.state != PENDING) notify(state, false);
|
|
3233
|
+
return reaction.promise;
|
|
3234
|
+
},
|
|
3235
|
+
// `Promise.prototype.catch` method
|
|
3236
|
+
// https://tc39.es/ecma262/#sec-promise.prototype.catch
|
|
3237
|
+
'catch': function (onRejected) {
|
|
3238
|
+
return this.then(undefined, onRejected);
|
|
3239
|
+
}
|
|
3240
|
+
});
|
|
3241
|
+
OwnPromiseCapability = function () {
|
|
3242
|
+
var promise = new Internal();
|
|
3243
|
+
var state = getInternalState(promise);
|
|
3244
|
+
this.promise = promise;
|
|
3245
|
+
this.resolve = bind(internalResolve, state);
|
|
3246
|
+
this.reject = bind(internalReject, state);
|
|
3247
|
+
};
|
|
3248
|
+
newPromiseCapability$1.f = newPromiseCapability = function (C) {
|
|
3249
|
+
return C === PromiseConstructor || C === PromiseWrapper
|
|
3250
|
+
? new OwnPromiseCapability(C)
|
|
3251
|
+
: newGenericPromiseCapability(C);
|
|
3252
|
+
};
|
|
3253
|
+
|
|
3254
|
+
if (isCallable(nativePromiseConstructor) && NativePromisePrototype !== Object.prototype) {
|
|
3255
|
+
nativeThen = NativePromisePrototype.then;
|
|
3256
|
+
|
|
3257
|
+
if (!SUBCLASSING) {
|
|
3258
|
+
// make `Promise#then` return a polyfilled `Promise` for native promise-based APIs
|
|
3259
|
+
redefine(NativePromisePrototype, 'then', function then(onFulfilled, onRejected) {
|
|
3260
|
+
var that = this;
|
|
3261
|
+
return new PromiseConstructor(function (resolve, reject) {
|
|
3262
|
+
functionCall(nativeThen, that, resolve, reject);
|
|
3263
|
+
}).then(onFulfilled, onRejected);
|
|
3264
|
+
// https://github.com/zloirock/core-js/issues/640
|
|
3265
|
+
}, { unsafe: true });
|
|
3266
|
+
|
|
3267
|
+
// makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
|
|
3268
|
+
redefine(NativePromisePrototype, 'catch', PromisePrototype['catch'], { unsafe: true });
|
|
3269
|
+
}
|
|
3270
|
+
|
|
3271
|
+
// make `.constructor === Promise` work for native promise-based APIs
|
|
3272
|
+
try {
|
|
3273
|
+
delete NativePromisePrototype.constructor;
|
|
3274
|
+
} catch (error) { /* empty */ }
|
|
3275
|
+
|
|
3276
|
+
// make `instanceof Promise` work for native promise-based APIs
|
|
3277
|
+
if (objectSetPrototypeOf) {
|
|
3278
|
+
objectSetPrototypeOf(NativePromisePrototype, PromisePrototype);
|
|
3279
|
+
}
|
|
3280
|
+
}
|
|
3281
|
+
}
|
|
3282
|
+
|
|
3283
|
+
_export({ global: true, wrap: true, forced: FORCED }, {
|
|
3284
|
+
Promise: PromiseConstructor
|
|
3285
|
+
});
|
|
3286
|
+
|
|
3287
|
+
setToStringTag(PromiseConstructor, PROMISE, false);
|
|
3288
|
+
setSpecies(PROMISE);
|
|
3289
|
+
|
|
3290
|
+
PromiseWrapper = getBuiltIn(PROMISE);
|
|
3291
|
+
|
|
3292
|
+
// statics
|
|
3293
|
+
_export({ target: PROMISE, stat: true, forced: FORCED }, {
|
|
3294
|
+
// `Promise.reject` method
|
|
3295
|
+
// https://tc39.es/ecma262/#sec-promise.reject
|
|
3296
|
+
reject: function reject(r) {
|
|
3297
|
+
var capability = newPromiseCapability(this);
|
|
3298
|
+
functionCall(capability.reject, undefined, r);
|
|
3299
|
+
return capability.promise;
|
|
3300
|
+
}
|
|
3301
|
+
});
|
|
3302
|
+
|
|
3303
|
+
_export({ target: PROMISE, stat: true, forced: FORCED }, {
|
|
3304
|
+
// `Promise.resolve` method
|
|
3305
|
+
// https://tc39.es/ecma262/#sec-promise.resolve
|
|
3306
|
+
resolve: function resolve(x) {
|
|
3307
|
+
return promiseResolve(this, x);
|
|
3308
|
+
}
|
|
3309
|
+
});
|
|
3310
|
+
|
|
3311
|
+
_export({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, {
|
|
3312
|
+
// `Promise.all` method
|
|
3313
|
+
// https://tc39.es/ecma262/#sec-promise.all
|
|
3314
|
+
all: function all(iterable) {
|
|
3315
|
+
var C = this;
|
|
3316
|
+
var capability = newPromiseCapability(C);
|
|
3317
|
+
var resolve = capability.resolve;
|
|
3318
|
+
var reject = capability.reject;
|
|
3319
|
+
var result = perform(function () {
|
|
3320
|
+
var $promiseResolve = aCallable(C.resolve);
|
|
3321
|
+
var values = [];
|
|
3322
|
+
var counter = 0;
|
|
3323
|
+
var remaining = 1;
|
|
3324
|
+
iterate(iterable, function (promise) {
|
|
3325
|
+
var index = counter++;
|
|
3326
|
+
var alreadyCalled = false;
|
|
3327
|
+
remaining++;
|
|
3328
|
+
functionCall($promiseResolve, C, promise).then(function (value) {
|
|
3329
|
+
if (alreadyCalled) return;
|
|
3330
|
+
alreadyCalled = true;
|
|
3331
|
+
values[index] = value;
|
|
3332
|
+
--remaining || resolve(values);
|
|
3333
|
+
}, reject);
|
|
3334
|
+
});
|
|
3335
|
+
--remaining || resolve(values);
|
|
3336
|
+
});
|
|
3337
|
+
if (result.error) reject(result.value);
|
|
3338
|
+
return capability.promise;
|
|
3339
|
+
},
|
|
3340
|
+
// `Promise.race` method
|
|
3341
|
+
// https://tc39.es/ecma262/#sec-promise.race
|
|
3342
|
+
race: function race(iterable) {
|
|
3343
|
+
var C = this;
|
|
3344
|
+
var capability = newPromiseCapability(C);
|
|
3345
|
+
var reject = capability.reject;
|
|
3346
|
+
var result = perform(function () {
|
|
3347
|
+
var $promiseResolve = aCallable(C.resolve);
|
|
3348
|
+
iterate(iterable, function (promise) {
|
|
3349
|
+
functionCall($promiseResolve, C, promise).then(capability.resolve, reject);
|
|
3350
|
+
});
|
|
3351
|
+
});
|
|
3352
|
+
if (result.error) reject(result.value);
|
|
3353
|
+
return capability.promise;
|
|
3354
|
+
}
|
|
3355
|
+
});
|
|
3356
|
+
|
|
3357
|
+
var PROPER_FUNCTION_NAME = functionName.PROPER;
|
|
3358
|
+
|
|
3359
|
+
|
|
3360
|
+
|
|
3361
|
+
|
|
3362
|
+
|
|
3363
|
+
|
|
3364
|
+
|
|
3365
|
+
var TO_STRING = 'toString';
|
|
3366
|
+
var RegExpPrototype = RegExp.prototype;
|
|
3367
|
+
var n$ToString = RegExpPrototype[TO_STRING];
|
|
3368
|
+
var getFlags = functionUncurryThis(regexpFlags);
|
|
3369
|
+
|
|
3370
|
+
var NOT_GENERIC = fails(function () { return n$ToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
|
|
3371
|
+
// FF44- RegExp#toString has a wrong name
|
|
3372
|
+
var INCORRECT_NAME = PROPER_FUNCTION_NAME && n$ToString.name != TO_STRING;
|
|
3373
|
+
|
|
3374
|
+
// `RegExp.prototype.toString` method
|
|
3375
|
+
// https://tc39.es/ecma262/#sec-regexp.prototype.tostring
|
|
3376
|
+
if (NOT_GENERIC || INCORRECT_NAME) {
|
|
3377
|
+
redefine(RegExp.prototype, TO_STRING, function toString$1() {
|
|
3378
|
+
var R = anObject(this);
|
|
3379
|
+
var p = toString(R.source);
|
|
3380
|
+
var rf = R.flags;
|
|
3381
|
+
var f = toString(rf === undefined && objectIsPrototypeOf(RegExpPrototype, R) && !('flags' in RegExpPrototype) ? getFlags(R) : rf);
|
|
3382
|
+
return '/' + p + '/' + f;
|
|
3383
|
+
}, { unsafe: true });
|
|
3384
|
+
}
|
|
3385
|
+
|
|
3386
|
+
var FUNCTION_NAME_EXISTS = functionName.EXISTS;
|
|
3387
|
+
|
|
3388
|
+
var defineProperty = objectDefineProperty.f;
|
|
3389
|
+
|
|
3390
|
+
var FunctionPrototype = Function.prototype;
|
|
3391
|
+
var functionToString = functionUncurryThis(FunctionPrototype.toString);
|
|
3392
|
+
var nameRE = /function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/;
|
|
3393
|
+
var regExpExec = functionUncurryThis(nameRE.exec);
|
|
3394
|
+
var NAME = 'name';
|
|
3395
|
+
|
|
3396
|
+
// Function instances `.name` property
|
|
3397
|
+
// https://tc39.es/ecma262/#sec-function-instances-name
|
|
3398
|
+
if (descriptors && !FUNCTION_NAME_EXISTS) {
|
|
3399
|
+
defineProperty(FunctionPrototype, NAME, {
|
|
3400
|
+
configurable: true,
|
|
3401
|
+
get: function () {
|
|
3402
|
+
try {
|
|
3403
|
+
return regExpExec(nameRE, functionToString(this))[1];
|
|
3404
|
+
} catch (error) {
|
|
3405
|
+
return '';
|
|
3406
|
+
}
|
|
3407
|
+
}
|
|
3408
|
+
});
|
|
3409
|
+
}
|
|
3410
|
+
|
|
3411
|
+
var EDITOR_TO_UPPY_MAP = new WeakMap();
|
|
3412
|
+
function getUppy(editor) {
|
|
3413
|
+
var uppy = EDITOR_TO_UPPY_MAP.get(editor);
|
|
3414
|
+
if (uppy != null) return uppy;
|
|
3415
|
+
var menuConfig = getMenuConfig(editor);
|
|
3416
|
+
var onSuccess = menuConfig.onSuccess,
|
|
3417
|
+
onProgress = menuConfig.onProgress,
|
|
3418
|
+
onFailed = menuConfig.onFailed,
|
|
3419
|
+
customInsert = menuConfig.customInsert,
|
|
3420
|
+
onError = menuConfig.onError;
|
|
3421
|
+
var successHandler = function successHandler(file, res) {
|
|
3422
|
+
if (customInsert) {
|
|
3423
|
+
customInsert(res, function (src, alt, href) {
|
|
3424
|
+
return insertImageNode(editor, src, alt, href);
|
|
3425
|
+
});
|
|
3426
|
+
onSuccess(file, res);
|
|
3427
|
+
return;
|
|
3428
|
+
}
|
|
3429
|
+
var _a = res.errno,
|
|
3430
|
+
errno = _a === void 0 ? 1 : _a,
|
|
3431
|
+
_b = res.data,
|
|
3432
|
+
data = _b === void 0 ? {} : _b;
|
|
3433
|
+
if (errno !== 0) {
|
|
3434
|
+
onFailed(file, res);
|
|
3435
|
+
return;
|
|
3436
|
+
}
|
|
3437
|
+
if (Array.isArray(data)) {
|
|
3438
|
+
data.forEach(function (item) {
|
|
3439
|
+
var _a = item.url,
|
|
3440
|
+
url = _a === void 0 ? '' : _a,
|
|
3441
|
+
_b = item.alt,
|
|
3442
|
+
alt = _b === void 0 ? '' : _b,
|
|
3443
|
+
_c = item.href,
|
|
3444
|
+
href = _c === void 0 ? '' : _c;
|
|
3445
|
+
insertImageNode(editor, url, alt, href);
|
|
3446
|
+
});
|
|
3447
|
+
} else {
|
|
3448
|
+
var _c = data.url,
|
|
3449
|
+
url = _c === void 0 ? '' : _c,
|
|
3450
|
+
_d = data.alt,
|
|
3451
|
+
alt = _d === void 0 ? '' : _d,
|
|
3452
|
+
_e = data.href,
|
|
3453
|
+
href = _e === void 0 ? '' : _e;
|
|
3454
|
+
insertImageNode(editor, url, alt, href);
|
|
3455
|
+
}
|
|
3456
|
+
onSuccess(file, res);
|
|
3457
|
+
};
|
|
3458
|
+
var progressHandler = function progressHandler(progress) {
|
|
3459
|
+
editor.showProgressBar(progress);
|
|
3460
|
+
onProgress && onProgress(progress);
|
|
3461
|
+
};
|
|
3462
|
+
var errorHandler = function errorHandler(file, err, res) {
|
|
3463
|
+
onError(file, err, res);
|
|
3464
|
+
};
|
|
3465
|
+
uppy = createUploader(__assign(__assign({}, menuConfig), {
|
|
3466
|
+
onProgress: progressHandler,
|
|
3467
|
+
onSuccess: successHandler,
|
|
3468
|
+
onError: errorHandler
|
|
3469
|
+
}));
|
|
3470
|
+
EDITOR_TO_UPPY_MAP.set(editor, uppy);
|
|
3471
|
+
return uppy;
|
|
3472
|
+
}
|
|
3473
|
+
function getMenuConfig(editor) {
|
|
3474
|
+
return editor.getMenuConfig('uploadImage');
|
|
3475
|
+
}
|
|
3476
|
+
function insertBase64(editor, file) {
|
|
3477
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3478
|
+
return __generator(this, function (_a) {
|
|
3479
|
+
return [2
|
|
3480
|
+
, new Promise(function (resolve) {
|
|
3481
|
+
var reader = new FileReader();
|
|
3482
|
+
reader.readAsDataURL(file);
|
|
3483
|
+
reader.onload = function () {
|
|
3484
|
+
var result = reader.result;
|
|
3485
|
+
if (!result) return;
|
|
3486
|
+
var src = result.toString();
|
|
3487
|
+
var href = src.indexOf('data:image') === 0 ? '' : src;
|
|
3488
|
+
insertImageNode(editor, src, file.name, href);
|
|
3489
|
+
resolve('ok');
|
|
3490
|
+
};
|
|
3491
|
+
})];
|
|
3492
|
+
});
|
|
3493
|
+
});
|
|
3494
|
+
}
|
|
3495
|
+
function uploadFile(editor, file) {
|
|
3496
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3497
|
+
var uppy, name, type, size;
|
|
3498
|
+
return __generator(this, function (_a) {
|
|
3499
|
+
switch (_a.label) {
|
|
3500
|
+
case 0:
|
|
3501
|
+
uppy = getUppy(editor);
|
|
3502
|
+
name = file.name, type = file.type, size = file.size;
|
|
3503
|
+
uppy.addFile({
|
|
3504
|
+
name: name,
|
|
3505
|
+
type: type,
|
|
3506
|
+
size: size,
|
|
3507
|
+
data: file
|
|
3508
|
+
});
|
|
3509
|
+
return [4
|
|
3510
|
+
, uppy.upload()];
|
|
3511
|
+
case 1:
|
|
3512
|
+
_a.sent();
|
|
3513
|
+
return [2
|
|
3514
|
+
];
|
|
3515
|
+
}
|
|
3516
|
+
});
|
|
3517
|
+
});
|
|
3518
|
+
}
|
|
3519
|
+
function uploadImages (editor, files) {
|
|
3520
|
+
var e_1, _a;
|
|
3521
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3522
|
+
var fileList, _b, customUpload, base64LimitSize, fileList_1, fileList_1_1, file, size, e_1_1;
|
|
3523
|
+
return __generator(this, function (_c) {
|
|
3524
|
+
switch (_c.label) {
|
|
3525
|
+
case 0:
|
|
3526
|
+
if (files == null) return [2
|
|
3527
|
+
];
|
|
3528
|
+
fileList = Array.prototype.slice.call(files);
|
|
3529
|
+
_b = getMenuConfig(editor), customUpload = _b.customUpload, base64LimitSize = _b.base64LimitSize;
|
|
3530
|
+
_c.label = 1;
|
|
3531
|
+
case 1:
|
|
3532
|
+
_c.trys.push([1, 11, 12, 17]);
|
|
3533
|
+
fileList_1 = __asyncValues(fileList);
|
|
3534
|
+
_c.label = 2;
|
|
3535
|
+
case 2:
|
|
3536
|
+
return [4
|
|
3537
|
+
, fileList_1.next()];
|
|
3538
|
+
case 3:
|
|
3539
|
+
if (!(fileList_1_1 = _c.sent(), !fileList_1_1.done)) return [3
|
|
3540
|
+
, 10];
|
|
3541
|
+
file = fileList_1_1.value;
|
|
3542
|
+
size = file.size
|
|
3543
|
+
;
|
|
3544
|
+
if (!(base64LimitSize && size <= base64LimitSize)) return [3
|
|
3545
|
+
, 5];
|
|
3546
|
+
return [4
|
|
3547
|
+
, insertBase64(editor, file)];
|
|
3548
|
+
case 4:
|
|
3549
|
+
_c.sent();
|
|
3550
|
+
return [3
|
|
3551
|
+
, 9];
|
|
3552
|
+
case 5:
|
|
3553
|
+
if (!customUpload) return [3
|
|
3554
|
+
, 7];
|
|
3555
|
+
return [4
|
|
3556
|
+
, customUpload(file, function (src, alt, href) {
|
|
3557
|
+
return insertImageNode(editor, src, alt, href);
|
|
3558
|
+
})];
|
|
3559
|
+
case 6:
|
|
3560
|
+
_c.sent();
|
|
3561
|
+
return [3
|
|
3562
|
+
, 9];
|
|
3563
|
+
case 7:
|
|
3564
|
+
return [4
|
|
3565
|
+
, uploadFile(editor, file)];
|
|
3566
|
+
case 8:
|
|
3567
|
+
_c.sent();
|
|
3568
|
+
_c.label = 9;
|
|
3569
|
+
case 9:
|
|
3570
|
+
return [3
|
|
3571
|
+
, 2];
|
|
3572
|
+
case 10:
|
|
3573
|
+
return [3
|
|
3574
|
+
, 17];
|
|
3575
|
+
case 11:
|
|
3576
|
+
e_1_1 = _c.sent();
|
|
3577
|
+
e_1 = {
|
|
3578
|
+
error: e_1_1
|
|
3579
|
+
};
|
|
3580
|
+
return [3
|
|
3581
|
+
, 17];
|
|
3582
|
+
case 12:
|
|
3583
|
+
_c.trys.push([12,, 15, 16]);
|
|
3584
|
+
if (!(fileList_1_1 && !fileList_1_1.done && (_a = fileList_1.return))) return [3
|
|
3585
|
+
, 14];
|
|
3586
|
+
return [4
|
|
3587
|
+
, _a.call(fileList_1)];
|
|
3588
|
+
case 13:
|
|
3589
|
+
_c.sent();
|
|
3590
|
+
_c.label = 14;
|
|
3591
|
+
case 14:
|
|
3592
|
+
return [3
|
|
3593
|
+
, 16];
|
|
3594
|
+
case 15:
|
|
3595
|
+
if (e_1) throw e_1.error;
|
|
3596
|
+
return [7
|
|
3597
|
+
];
|
|
3598
|
+
case 16:
|
|
3599
|
+
return [7
|
|
3600
|
+
];
|
|
3601
|
+
case 17:
|
|
3602
|
+
return [2
|
|
3603
|
+
];
|
|
3604
|
+
}
|
|
3605
|
+
});
|
|
3606
|
+
});
|
|
3607
|
+
}
|
|
3608
|
+
|
|
3609
|
+
function withUploadImage(editor) {
|
|
3610
|
+
var insertData = editor.insertData;
|
|
3611
|
+
var newEditor = editor;
|
|
3612
|
+
newEditor.insertData = function (data) {
|
|
3613
|
+
if (isInsertImageMenuDisabled(newEditor)) {
|
|
3614
|
+
insertData(data);
|
|
3615
|
+
return;
|
|
3616
|
+
}
|
|
3617
|
+
var text = data.getData('text/plain');
|
|
3618
|
+
if (text) {
|
|
3619
|
+
insertData(data);
|
|
3620
|
+
return;
|
|
3621
|
+
}
|
|
3622
|
+
var files = data.files;
|
|
3623
|
+
if (files.length <= 0) {
|
|
3624
|
+
insertData(data);
|
|
3625
|
+
return;
|
|
3626
|
+
}
|
|
3627
|
+
var fileList = Array.prototype.slice.call(files);
|
|
3628
|
+
var _hasImageFiles = fileList.some(function (file) {
|
|
3629
|
+
var _a = __read(file.type.split('/'), 1),
|
|
3630
|
+
mime = _a[0];
|
|
3631
|
+
return mime === 'image';
|
|
3632
|
+
});
|
|
3633
|
+
if (_hasImageFiles) {
|
|
3634
|
+
uploadImages(editor, files);
|
|
3635
|
+
} else {
|
|
3636
|
+
insertData(data);
|
|
3637
|
+
}
|
|
3638
|
+
};
|
|
3639
|
+
return newEditor;
|
|
3640
|
+
}
|
|
3641
|
+
|
|
3642
|
+
var un$Join = functionUncurryThis([].join);
|
|
3643
|
+
|
|
3644
|
+
var ES3_STRINGS = indexedObject != Object;
|
|
3645
|
+
var STRICT_METHOD = arrayMethodIsStrict('join', ',');
|
|
3646
|
+
|
|
3647
|
+
// `Array.prototype.join` method
|
|
3648
|
+
// https://tc39.es/ecma262/#sec-array.prototype.join
|
|
3649
|
+
_export({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD }, {
|
|
3650
|
+
join: function join(separator) {
|
|
3651
|
+
return un$Join(toIndexedObject(this), separator === undefined ? ',' : separator);
|
|
3652
|
+
}
|
|
3653
|
+
});
|
|
3654
|
+
|
|
3655
|
+
var UPLOAD_IMAGE_SVG = '<svg viewBox="0 0 1024 1024"><path d="M828.708571 585.045333a48.761905 48.761905 0 0 0-48.737523 48.761905v18.529524l-72.143238-72.167619a135.972571 135.972571 0 0 0-191.585524 0l-34.133334 34.133333-120.880762-120.953905a138.898286 138.898286 0 0 0-191.585523 0l-72.167619 72.167619V292.400762a48.786286 48.786286 0 0 1 48.761904-48.761905h341.23581a48.737524 48.737524 0 0 0 34.474667-83.285333 48.737524 48.737524 0 0 0-34.474667-14.287238H146.236952A146.212571 146.212571 0 0 0 0 292.400762v585.289143A146.358857 146.358857 0 0 0 146.236952 1024h584.996572a146.212571 146.212571 0 0 0 146.236952-146.310095V633.807238a48.786286 48.786286 0 0 0-48.761905-48.761905zM146.261333 926.45181a48.737524 48.737524 0 0 1-48.761904-48.761905v-174.128762l141.409523-141.458286a38.497524 38.497524 0 0 1 53.126096 0l154.526476 154.624 209.627428 209.724953H146.236952z m633.734096-48.761905c-0.073143 9.337905-3.145143 18.383238-8.777143 25.843809l-219.843048-220.94019 34.133333-34.133334a37.546667 37.546667 0 0 1 53.613715 0l140.873143 141.897143V877.714286zM1009.615238 160.231619L863.329524 13.897143a48.737524 48.737524 0 0 0-16.091429-10.24c-11.849143-4.87619-25.161143-4.87619-37.059047 0a48.761905 48.761905 0 0 0-16.067048 10.24l-146.236952 146.334476a49.005714 49.005714 0 0 0 69.217523 69.241905l62.902858-63.390476v272.627809a48.761905 48.761905 0 1 0 97.475047 0V166.083048l62.902857 63.390476a48.737524 48.737524 0 0 0 69.217524 0 48.761905 48.761905 0 0 0 0-69.241905z"></path></svg>';
|
|
3656
|
+
|
|
3657
|
+
if (append) $.fn.append = append;
|
|
3658
|
+
if (on) $.fn.on = on;
|
|
3659
|
+
if (remove) $.fn.remove = remove;
|
|
3660
|
+
if (val) $.fn.val = val;
|
|
3661
|
+
if (click) $.fn.click = click;
|
|
3662
|
+
if (hide) $.fn.hide = hide;
|
|
3663
|
+
|
|
3664
|
+
var UploadImage =
|
|
3665
|
+
function () {
|
|
3666
|
+
function UploadImage() {
|
|
3667
|
+
this.title = t('uploadImgModule.uploadImage');
|
|
3668
|
+
this.iconSvg = UPLOAD_IMAGE_SVG;
|
|
3669
|
+
this.tag = 'button';
|
|
3670
|
+
}
|
|
3671
|
+
UploadImage.prototype.getValue = function (editor) {
|
|
3672
|
+
return '';
|
|
3673
|
+
};
|
|
3674
|
+
UploadImage.prototype.isActive = function (editor) {
|
|
3675
|
+
return false;
|
|
3676
|
+
};
|
|
3677
|
+
UploadImage.prototype.isDisabled = function (editor) {
|
|
3678
|
+
return isInsertImageMenuDisabled(editor);
|
|
3679
|
+
};
|
|
3680
|
+
UploadImage.prototype.getMenuConfig = function (editor) {
|
|
3681
|
+
return editor.getMenuConfig('uploadImage');
|
|
3682
|
+
};
|
|
3683
|
+
UploadImage.prototype.exec = function (editor, value) {
|
|
3684
|
+
var _a = this.getMenuConfig(editor),
|
|
3685
|
+
_b = _a.allowedFileTypes,
|
|
3686
|
+
allowedFileTypes = _b === void 0 ? [] : _b,
|
|
3687
|
+
customBrowseAndUpload = _a.customBrowseAndUpload;
|
|
3688
|
+
if (customBrowseAndUpload) {
|
|
3689
|
+
customBrowseAndUpload(function (src, alt, href) {
|
|
3690
|
+
return insertImageNode(editor, src, alt, href);
|
|
3691
|
+
});
|
|
3692
|
+
return;
|
|
3693
|
+
}
|
|
3694
|
+
var acceptAttr = '';
|
|
3695
|
+
if (allowedFileTypes.length > 0) {
|
|
3696
|
+
acceptAttr = "accept=\"" + allowedFileTypes.join(', ') + "\"";
|
|
3697
|
+
}
|
|
3698
|
+
var $body = $('body');
|
|
3699
|
+
var $inputFile = $("<input type=\"file\" " + acceptAttr + " multiple/>");
|
|
3700
|
+
$inputFile.hide();
|
|
3701
|
+
$body.append($inputFile);
|
|
3702
|
+
$inputFile.click();
|
|
3703
|
+
$inputFile.on('change', function () {
|
|
3704
|
+
var files = $inputFile[0].files;
|
|
3705
|
+
uploadImages(editor, files);
|
|
3706
|
+
});
|
|
3707
|
+
};
|
|
3708
|
+
return UploadImage;
|
|
3709
|
+
}();
|
|
3710
|
+
|
|
3711
|
+
function genUploadImageConfig() {
|
|
3712
|
+
return {
|
|
3713
|
+
server: '',
|
|
3714
|
+
fieldName: 'wangeditor-uploaded-image',
|
|
3715
|
+
maxFileSize: 2 * 1024 * 1024,
|
|
3716
|
+
maxNumberOfFiles: 100,
|
|
3717
|
+
allowedFileTypes: ['image/*'],
|
|
3718
|
+
meta: {
|
|
3719
|
+
},
|
|
3720
|
+
metaWithUrl: false,
|
|
3721
|
+
withCredentials: false,
|
|
3722
|
+
timeout: 10 * 1000,
|
|
3723
|
+
onBeforeUpload: function onBeforeUpload(files) {
|
|
3724
|
+
return files;
|
|
3725
|
+
},
|
|
3726
|
+
onProgress: function onProgress(progress) {
|
|
3727
|
+
},
|
|
3728
|
+
onSuccess: function onSuccess(file, res) {
|
|
3729
|
+
},
|
|
3730
|
+
onFailed: function onFailed(file, res) {
|
|
3731
|
+
console.error("'" + file.name + "' upload failed", res);
|
|
3732
|
+
},
|
|
3733
|
+
onError: function onError(file, err, res) {
|
|
3734
|
+
console.error("'" + file.name + "' upload error", res);
|
|
3735
|
+
},
|
|
3736
|
+
base64LimitSize: 0
|
|
3737
|
+
};
|
|
3738
|
+
}
|
|
3739
|
+
|
|
3740
|
+
var uploadImageMenuConf = {
|
|
3741
|
+
key: 'uploadImage',
|
|
3742
|
+
factory: function factory() {
|
|
3743
|
+
return new UploadImage();
|
|
3744
|
+
},
|
|
3745
|
+
config: genUploadImageConfig()
|
|
3746
|
+
};
|
|
3747
|
+
|
|
3748
|
+
var uploadImage = {
|
|
3749
|
+
menus: [uploadImageMenuConf],
|
|
3750
|
+
editorPlugin: withUploadImage
|
|
3751
|
+
};
|
|
3752
|
+
|
|
3753
|
+
export { uploadImage as default };
|
|
3754
|
+
//# sourceMappingURL=index.esm.js.map
|