16
|
1 |
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
|
2 |
module.exports = function (it) {
|
|
3 |
if (typeof it != 'function') {
|
|
4 |
throw TypeError(String(it) + ' is not a function');
|
|
5 |
} return it;
|
|
6 |
};
|
|
7 |
|
|
8 |
},{}],2:[function(require,module,exports){
|
|
9 |
var isObject = require('../internals/is-object');
|
|
10 |
|
|
11 |
module.exports = function (it) {
|
|
12 |
if (!isObject(it) && it !== null) {
|
|
13 |
throw TypeError("Can't set " + String(it) + ' as a prototype');
|
|
14 |
} return it;
|
|
15 |
};
|
|
16 |
|
|
17 |
},{"../internals/is-object":37}],3:[function(require,module,exports){
|
|
18 |
var wellKnownSymbol = require('../internals/well-known-symbol');
|
|
19 |
var create = require('../internals/object-create');
|
|
20 |
var definePropertyModule = require('../internals/object-define-property');
|
|
21 |
|
|
22 |
var UNSCOPABLES = wellKnownSymbol('unscopables');
|
|
23 |
var ArrayPrototype = Array.prototype;
|
|
24 |
|
|
25 |
// Array.prototype[@@unscopables]
|
|
26 |
// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
|
|
27 |
if (ArrayPrototype[UNSCOPABLES] == undefined) {
|
|
28 |
definePropertyModule.f(ArrayPrototype, UNSCOPABLES, {
|
|
29 |
configurable: true,
|
|
30 |
value: create(null)
|
|
31 |
});
|
|
32 |
}
|
|
33 |
|
|
34 |
// add a key to Array.prototype[@@unscopables]
|
|
35 |
module.exports = function (key) {
|
|
36 |
ArrayPrototype[UNSCOPABLES][key] = true;
|
|
37 |
};
|
|
38 |
|
|
39 |
},{"../internals/object-create":45,"../internals/object-define-property":47,"../internals/well-known-symbol":77}],4:[function(require,module,exports){
|
|
40 |
module.exports = function (it, Constructor, name) {
|
|
41 |
if (!(it instanceof Constructor)) {
|
|
42 |
throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation');
|
|
43 |
} return it;
|
|
44 |
};
|
|
45 |
|
|
46 |
},{}],5:[function(require,module,exports){
|
|
47 |
var isObject = require('../internals/is-object');
|
|
48 |
|
|
49 |
module.exports = function (it) {
|
|
50 |
if (!isObject(it)) {
|
|
51 |
throw TypeError(String(it) + ' is not an object');
|
|
52 |
} return it;
|
|
53 |
};
|
|
54 |
|
|
55 |
},{"../internals/is-object":37}],6:[function(require,module,exports){
|
|
56 |
'use strict';
|
|
57 |
var bind = require('../internals/function-bind-context');
|
|
58 |
var toObject = require('../internals/to-object');
|
|
59 |
var callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing');
|
|
60 |
var isArrayIteratorMethod = require('../internals/is-array-iterator-method');
|
|
61 |
var toLength = require('../internals/to-length');
|
|
62 |
var createProperty = require('../internals/create-property');
|
|
63 |
var getIteratorMethod = require('../internals/get-iterator-method');
|
|
64 |
|
|
65 |
// `Array.from` method implementation
|
|
66 |
// https://tc39.github.io/ecma262/#sec-array.from
|
|
67 |
module.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
|
|
68 |
var O = toObject(arrayLike);
|
|
69 |
var C = typeof this == 'function' ? this : Array;
|
|
70 |
var argumentsLength = arguments.length;
|
|
71 |
var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
|
|
72 |
var mapping = mapfn !== undefined;
|
|
73 |
var iteratorMethod = getIteratorMethod(O);
|
|
74 |
var index = 0;
|
|
75 |
var length, result, step, iterator, next, value;
|
|
76 |
if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2);
|
|
77 |
// if the target is not iterable or it's an array with the default iterator - use a simple case
|
|
78 |
if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod(iteratorMethod))) {
|
|
79 |
iterator = iteratorMethod.call(O);
|
|
80 |
next = iterator.next;
|
|
81 |
result = new C();
|
|
82 |
for (;!(step = next.call(iterator)).done; index++) {
|
|
83 |
value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;
|
|
84 |
createProperty(result, index, value);
|
|
85 |
}
|
|
86 |
} else {
|
|
87 |
length = toLength(O.length);
|
|
88 |
result = new C(length);
|
|
89 |
for (;length > index; index++) {
|
|
90 |
value = mapping ? mapfn(O[index], index) : O[index];
|
|
91 |
createProperty(result, index, value);
|
|
92 |
}
|
|
93 |
}
|
|
94 |
result.length = index;
|
|
95 |
return result;
|
|
96 |
};
|
|
97 |
|
|
98 |
},{"../internals/call-with-safe-iteration-closing":8,"../internals/create-property":16,"../internals/function-bind-context":23,"../internals/get-iterator-method":25,"../internals/is-array-iterator-method":35,"../internals/to-length":71,"../internals/to-object":72}],7:[function(require,module,exports){
|
|
99 |
var toIndexedObject = require('../internals/to-indexed-object');
|
|
100 |
var toLength = require('../internals/to-length');
|
|
101 |
var toAbsoluteIndex = require('../internals/to-absolute-index');
|
|
102 |
|
|
103 |
// `Array.prototype.{ indexOf, includes }` methods implementation
|
|
104 |
var createMethod = function (IS_INCLUDES) {
|
|
105 |
return function ($this, el, fromIndex) {
|
|
106 |
var O = toIndexedObject($this);
|
|
107 |
var length = toLength(O.length);
|
|
108 |
var index = toAbsoluteIndex(fromIndex, length);
|
|
109 |
var value;
|
|
110 |
// Array#includes uses SameValueZero equality algorithm
|
|
111 |
// eslint-disable-next-line no-self-compare
|
|
112 |
if (IS_INCLUDES && el != el) while (length > index) {
|
|
113 |
value = O[index++];
|
|
114 |
// eslint-disable-next-line no-self-compare
|
|
115 |
if (value != value) return true;
|
|
116 |
// Array#indexOf ignores holes, Array#includes - not
|
|
117 |
} else for (;length > index; index++) {
|
|
118 |
if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
|
|
119 |
} return !IS_INCLUDES && -1;
|
|
120 |
};
|
|
121 |
};
|
|
122 |
|
|
123 |
module.exports = {
|
|
124 |
// `Array.prototype.includes` method
|
|
125 |
// https://tc39.github.io/ecma262/#sec-array.prototype.includes
|
|
126 |
includes: createMethod(true),
|
|
127 |
// `Array.prototype.indexOf` method
|
|
128 |
// https://tc39.github.io/ecma262/#sec-array.prototype.indexof
|
|
129 |
indexOf: createMethod(false)
|
|
130 |
};
|
|
131 |
|
|
132 |
},{"../internals/to-absolute-index":68,"../internals/to-indexed-object":69,"../internals/to-length":71}],8:[function(require,module,exports){
|
|
133 |
var anObject = require('../internals/an-object');
|
|
134 |
|
|
135 |
// call something on iterator step with safe closing on error
|
|
136 |
module.exports = function (iterator, fn, value, ENTRIES) {
|
|
137 |
try {
|
|
138 |
return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
|
|
139 |
// 7.4.6 IteratorClose(iterator, completion)
|
|
140 |
} catch (error) {
|
|
141 |
var returnMethod = iterator['return'];
|
|
142 |
if (returnMethod !== undefined) anObject(returnMethod.call(iterator));
|
|
143 |
throw error;
|
|
144 |
}
|
|
145 |
};
|
|
146 |
|
|
147 |
},{"../internals/an-object":5}],9:[function(require,module,exports){
|
|
148 |
var toString = {}.toString;
|
|
149 |
|
|
150 |
module.exports = function (it) {
|
|
151 |
return toString.call(it).slice(8, -1);
|
|
152 |
};
|
|
153 |
|
|
154 |
},{}],10:[function(require,module,exports){
|
|
155 |
var TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support');
|
|
156 |
var classofRaw = require('../internals/classof-raw');
|
|
157 |
var wellKnownSymbol = require('../internals/well-known-symbol');
|
|
158 |
|
|
159 |
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
|
|
160 |
// ES3 wrong here
|
|
161 |
var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
|
|
162 |
|
|
163 |
// fallback for IE11 Script Access Denied error
|
|
164 |
var tryGet = function (it, key) {
|
|
165 |
try {
|
|
166 |
return it[key];
|
|
167 |
} catch (error) { /* empty */ }
|
|
168 |
};
|
|
169 |
|
|
170 |
// getting tag from ES6+ `Object.prototype.toString`
|
|
171 |
module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
|
|
172 |
var O, tag, result;
|
|
173 |
return it === undefined ? 'Undefined' : it === null ? 'Null'
|
|
174 |
// @@toStringTag case
|
|
175 |
: typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag
|
|
176 |
// builtinTag case
|
|
177 |
: CORRECT_ARGUMENTS ? classofRaw(O)
|
|
178 |
// ES3 arguments fallback
|
|
179 |
: (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
|
|
180 |
};
|
|
181 |
|
|
182 |
},{"../internals/classof-raw":9,"../internals/to-string-tag-support":74,"../internals/well-known-symbol":77}],11:[function(require,module,exports){
|
|
183 |
var has = require('../internals/has');
|
|
184 |
var ownKeys = require('../internals/own-keys');
|
|
185 |
var getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor');
|
|
186 |
var definePropertyModule = require('../internals/object-define-property');
|
|
187 |
|
|
188 |
module.exports = function (target, source) {
|
|
189 |
var keys = ownKeys(source);
|
|
190 |
var defineProperty = definePropertyModule.f;
|
|
191 |
var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
|
|
192 |
for (var i = 0; i < keys.length; i++) {
|
|
193 |
var key = keys[i];
|
|
194 |
if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
|
|
195 |
}
|
|
196 |
};
|
|
197 |
|
|
198 |
},{"../internals/has":28,"../internals/object-define-property":47,"../internals/object-get-own-property-descriptor":48,"../internals/own-keys":56}],12:[function(require,module,exports){
|
|
199 |
var fails = require('../internals/fails');
|
|
200 |
|
|
201 |
module.exports = !fails(function () {
|
|
202 |
function F() { /* empty */ }
|
|
203 |
F.prototype.constructor = null;
|
|
204 |
return Object.getPrototypeOf(new F()) !== F.prototype;
|
|
205 |
});
|
|
206 |
|
|
207 |
},{"../internals/fails":22}],13:[function(require,module,exports){
|
|
208 |
'use strict';
|
|
209 |
var IteratorPrototype = require('../internals/iterators-core').IteratorPrototype;
|
|
210 |
var create = require('../internals/object-create');
|
|
211 |
var createPropertyDescriptor = require('../internals/create-property-descriptor');
|
|
212 |
var setToStringTag = require('../internals/set-to-string-tag');
|
|
213 |
var Iterators = require('../internals/iterators');
|
|
214 |
|
|
215 |
var returnThis = function () { return this; };
|
|
216 |
|
|
217 |
module.exports = function (IteratorConstructor, NAME, next) {
|
|
218 |
var TO_STRING_TAG = NAME + ' Iterator';
|
|
219 |
IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(1, next) });
|
|
220 |
setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
|
|
221 |
Iterators[TO_STRING_TAG] = returnThis;
|
|
222 |
return IteratorConstructor;
|
|
223 |
};
|
|
224 |
|
|
225 |
},{"../internals/create-property-descriptor":15,"../internals/iterators":40,"../internals/iterators-core":39,"../internals/object-create":45,"../internals/set-to-string-tag":62}],14:[function(require,module,exports){
|
|
226 |
var DESCRIPTORS = require('../internals/descriptors');
|
|
227 |
var definePropertyModule = require('../internals/object-define-property');
|
|
228 |
var createPropertyDescriptor = require('../internals/create-property-descriptor');
|
|
229 |
|
|
230 |
module.exports = DESCRIPTORS ? function (object, key, value) {
|
|
231 |
return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
|
|
232 |
} : function (object, key, value) {
|
|
233 |
object[key] = value;
|
|
234 |
return object;
|
|
235 |
};
|
|
236 |
|
|
237 |
},{"../internals/create-property-descriptor":15,"../internals/descriptors":18,"../internals/object-define-property":47}],15:[function(require,module,exports){
|
|
238 |
module.exports = function (bitmap, value) {
|
|
239 |
return {
|
|
240 |
enumerable: !(bitmap & 1),
|
|
241 |
configurable: !(bitmap & 2),
|
|
242 |
writable: !(bitmap & 4),
|
|
243 |
value: value
|
|
244 |
};
|
|
245 |
};
|
|
246 |
|
|
247 |
},{}],16:[function(require,module,exports){
|
|
248 |
'use strict';
|
|
249 |
var toPrimitive = require('../internals/to-primitive');
|
|
250 |
var definePropertyModule = require('../internals/object-define-property');
|
|
251 |
var createPropertyDescriptor = require('../internals/create-property-descriptor');
|
|
252 |
|
|
253 |
module.exports = function (object, key, value) {
|
|
254 |
var propertyKey = toPrimitive(key);
|
|
255 |
if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
|
|
256 |
else object[propertyKey] = value;
|
|
257 |
};
|
|
258 |
|
|
259 |
},{"../internals/create-property-descriptor":15,"../internals/object-define-property":47,"../internals/to-primitive":73}],17:[function(require,module,exports){
|
|
260 |
'use strict';
|
|
261 |
var $ = require('../internals/export');
|
|
262 |
var createIteratorConstructor = require('../internals/create-iterator-constructor');
|
|
263 |
var getPrototypeOf = require('../internals/object-get-prototype-of');
|
|
264 |
var setPrototypeOf = require('../internals/object-set-prototype-of');
|
|
265 |
var setToStringTag = require('../internals/set-to-string-tag');
|
|
266 |
var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
|
|
267 |
var redefine = require('../internals/redefine');
|
|
268 |
var wellKnownSymbol = require('../internals/well-known-symbol');
|
|
269 |
var IS_PURE = require('../internals/is-pure');
|
|
270 |
var Iterators = require('../internals/iterators');
|
|
271 |
var IteratorsCore = require('../internals/iterators-core');
|
|
272 |
|
|
273 |
var IteratorPrototype = IteratorsCore.IteratorPrototype;
|
|
274 |
var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
|
|
275 |
var ITERATOR = wellKnownSymbol('iterator');
|
|
276 |
var KEYS = 'keys';
|
|
277 |
var VALUES = 'values';
|
|
278 |
var ENTRIES = 'entries';
|
|
279 |
|
|
280 |
var returnThis = function () { return this; };
|
|
281 |
|
|
282 |
module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
|
|
283 |
createIteratorConstructor(IteratorConstructor, NAME, next);
|
|
284 |
|
|
285 |
var getIterationMethod = function (KIND) {
|
|
286 |
if (KIND === DEFAULT && defaultIterator) return defaultIterator;
|
|
287 |
if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];
|
|
288 |
switch (KIND) {
|
|
289 |
case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
|
|
290 |
case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
|
|
291 |
case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
|
|
292 |
} return function () { return new IteratorConstructor(this); };
|
|
293 |
};
|
|
294 |
|
|
295 |
var TO_STRING_TAG = NAME + ' Iterator';
|
|
296 |
var INCORRECT_VALUES_NAME = false;
|
|
297 |
var IterablePrototype = Iterable.prototype;
|
|
298 |
var nativeIterator = IterablePrototype[ITERATOR]
|
|
299 |
|| IterablePrototype['@@iterator']
|
|
300 |
|| DEFAULT && IterablePrototype[DEFAULT];
|
|
301 |
var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
|
|
302 |
var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
|
|
303 |
var CurrentIteratorPrototype, methods, KEY;
|
|
304 |
|
|
305 |
// fix native
|
|
306 |
if (anyNativeIterator) {
|
|
307 |
CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
|
|
308 |
if (IteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
|
|
309 |
if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
|
|
310 |
if (setPrototypeOf) {
|
|
311 |
setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
|
|
312 |
} else if (typeof CurrentIteratorPrototype[ITERATOR] != 'function') {
|
|
313 |
createNonEnumerableProperty(CurrentIteratorPrototype, ITERATOR, returnThis);
|
|
314 |
}
|
|
315 |
}
|
|
316 |
// Set @@toStringTag to native iterators
|
|
317 |
setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
|
|
318 |
if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis;
|
|
319 |
}
|
|
320 |
}
|
|
321 |
|
|
322 |
// fix Array#{values, @@iterator}.name in V8 / FF
|
|
323 |
if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
|
|
324 |
INCORRECT_VALUES_NAME = true;
|
|
325 |
defaultIterator = function values() { return nativeIterator.call(this); };
|
|
326 |
}
|
|
327 |
|
|
328 |
// define iterator
|
|
329 |
if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {
|
|
330 |
createNonEnumerableProperty(IterablePrototype, ITERATOR, defaultIterator);
|
|
331 |
}
|
|
332 |
Iterators[NAME] = defaultIterator;
|
|
333 |
|
|
334 |
// export additional methods
|
|
335 |
if (DEFAULT) {
|
|
336 |
methods = {
|
|
337 |
values: getIterationMethod(VALUES),
|
|
338 |
keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
|
|
339 |
entries: getIterationMethod(ENTRIES)
|
|
340 |
};
|
|
341 |
if (FORCED) for (KEY in methods) {
|
|
342 |
if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
|
|
343 |
redefine(IterablePrototype, KEY, methods[KEY]);
|
|
344 |
}
|
|
345 |
} else $({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
|
|
346 |
}
|
|
347 |
|
|
348 |
return methods;
|
|
349 |
};
|
|
350 |
|
|
351 |
},{"../internals/create-iterator-constructor":13,"../internals/create-non-enumerable-property":14,"../internals/export":21,"../internals/is-pure":38,"../internals/iterators":40,"../internals/iterators-core":39,"../internals/object-get-prototype-of":51,"../internals/object-set-prototype-of":55,"../internals/redefine":59,"../internals/set-to-string-tag":62,"../internals/well-known-symbol":77}],18:[function(require,module,exports){
|
|
352 |
var fails = require('../internals/fails');
|
|
353 |
|
|
354 |
// Thank's IE8 for his funny defineProperty
|
|
355 |
module.exports = !fails(function () {
|
|
356 |
return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
|
|
357 |
});
|
|
358 |
|
|
359 |
},{"../internals/fails":22}],19:[function(require,module,exports){
|
|
360 |
var global = require('../internals/global');
|
|
361 |
var isObject = require('../internals/is-object');
|
|
362 |
|
|
363 |
var document = global.document;
|
|
364 |
// typeof document.createElement is 'object' in old IE
|
|
365 |
var EXISTS = isObject(document) && isObject(document.createElement);
|
|
366 |
|
|
367 |
module.exports = function (it) {
|
|
368 |
return EXISTS ? document.createElement(it) : {};
|
|
369 |
};
|
|
370 |
|
|
371 |
},{"../internals/global":27,"../internals/is-object":37}],20:[function(require,module,exports){
|
|
372 |
// IE8- don't enum bug keys
|
|
373 |
module.exports = [
|
|
374 |
'constructor',
|
|
375 |
'hasOwnProperty',
|
|
376 |
'isPrototypeOf',
|
|
377 |
'propertyIsEnumerable',
|
|
378 |
'toLocaleString',
|
|
379 |
'toString',
|
|
380 |
'valueOf'
|
|
381 |
];
|
|
382 |
|
|
383 |
},{}],21:[function(require,module,exports){
|
|
384 |
var global = require('../internals/global');
|
|
385 |
var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;
|
|
386 |
var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
|
|
387 |
var redefine = require('../internals/redefine');
|
|
388 |
var setGlobal = require('../internals/set-global');
|
|
389 |
var copyConstructorProperties = require('../internals/copy-constructor-properties');
|
|
390 |
var isForced = require('../internals/is-forced');
|
|
391 |
|
|
392 |
/*
|
|
393 |
options.target - name of the target object
|
|
394 |
options.global - target is the global object
|
|
395 |
options.stat - export as static methods of target
|
|
396 |
options.proto - export as prototype methods of target
|
|
397 |
options.real - real prototype method for the `pure` version
|
|
398 |
options.forced - export even if the native feature is available
|
|
399 |
options.bind - bind methods to the target, required for the `pure` version
|
|
400 |
options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
|
|
401 |
options.unsafe - use the simple assignment of property instead of delete + defineProperty
|
|
402 |
options.sham - add a flag to not completely full polyfills
|
|
403 |
options.enumerable - export as enumerable property
|
|
404 |
options.noTargetGet - prevent calling a getter on target
|
|
405 |
*/
|
|
406 |
module.exports = function (options, source) {
|
|
407 |
var TARGET = options.target;
|
|
408 |
var GLOBAL = options.global;
|
|
409 |
var STATIC = options.stat;
|
|
410 |
var FORCED, target, key, targetProperty, sourceProperty, descriptor;
|
|
411 |
if (GLOBAL) {
|
|
412 |
target = global;
|
|
413 |
} else if (STATIC) {
|
|
414 |
target = global[TARGET] || setGlobal(TARGET, {});
|
|
415 |
} else {
|
|
416 |
target = (global[TARGET] || {}).prototype;
|
|
417 |
}
|
|
418 |
if (target) for (key in source) {
|
|
419 |
sourceProperty = source[key];
|
|
420 |
if (options.noTargetGet) {
|
|
421 |
descriptor = getOwnPropertyDescriptor(target, key);
|
|
422 |
targetProperty = descriptor && descriptor.value;
|
|
423 |
} else targetProperty = target[key];
|
|
424 |
FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
|
|
425 |
// contained in target
|
|
426 |
if (!FORCED && targetProperty !== undefined) {
|
|
427 |
if (typeof sourceProperty === typeof targetProperty) continue;
|
|
428 |
copyConstructorProperties(sourceProperty, targetProperty);
|
|
429 |
}
|
|
430 |
// add a flag to not completely full polyfills
|
|
431 |
if (options.sham || (targetProperty && targetProperty.sham)) {
|
|
432 |
createNonEnumerableProperty(sourceProperty, 'sham', true);
|
|
433 |
}
|
|
434 |
// extend global
|
|
435 |
redefine(target, key, sourceProperty, options);
|
|
436 |
}
|
|
437 |
};
|
|
438 |
|
|
439 |
},{"../internals/copy-constructor-properties":11,"../internals/create-non-enumerable-property":14,"../internals/global":27,"../internals/is-forced":36,"../internals/object-get-own-property-descriptor":48,"../internals/redefine":59,"../internals/set-global":61}],22:[function(require,module,exports){
|
|
440 |
module.exports = function (exec) {
|
|
441 |
try {
|
|
442 |
return !!exec();
|
|
443 |
} catch (error) {
|
|
444 |
return true;
|
|
445 |
}
|
|
446 |
};
|
|
447 |
|
|
448 |
},{}],23:[function(require,module,exports){
|
|
449 |
var aFunction = require('../internals/a-function');
|
|
450 |
|
|
451 |
// optional / simple context binding
|
|
452 |
module.exports = function (fn, that, length) {
|
|
453 |
aFunction(fn);
|
|
454 |
if (that === undefined) return fn;
|
|
455 |
switch (length) {
|
|
456 |
case 0: return function () {
|
|
457 |
return fn.call(that);
|
|
458 |
};
|
|
459 |
case 1: return function (a) {
|
|
460 |
return fn.call(that, a);
|
|
461 |
};
|
|
462 |
case 2: return function (a, b) {
|
|
463 |
return fn.call(that, a, b);
|
|
464 |
};
|
|
465 |
case 3: return function (a, b, c) {
|
|
466 |
return fn.call(that, a, b, c);
|
|
467 |
};
|
|
468 |
}
|
|
469 |
return function (/* ...args */) {
|
|
470 |
return fn.apply(that, arguments);
|
|
471 |
};
|
|
472 |
};
|
|
473 |
|
|
474 |
},{"../internals/a-function":1}],24:[function(require,module,exports){
|
|
475 |
var path = require('../internals/path');
|
|
476 |
var global = require('../internals/global');
|
|
477 |
|
|
478 |
var aFunction = function (variable) {
|
|
479 |
return typeof variable == 'function' ? variable : undefined;
|
|
480 |
};
|
|
481 |
|
|
482 |
module.exports = function (namespace, method) {
|
|
483 |
return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global[namespace])
|
|
484 |
: path[namespace] && path[namespace][method] || global[namespace] && global[namespace][method];
|
|
485 |
};
|
|
486 |
|
|
487 |
},{"../internals/global":27,"../internals/path":57}],25:[function(require,module,exports){
|
|
488 |
var classof = require('../internals/classof');
|
|
489 |
var Iterators = require('../internals/iterators');
|
|
490 |
var wellKnownSymbol = require('../internals/well-known-symbol');
|
|
491 |
|
|
492 |
var ITERATOR = wellKnownSymbol('iterator');
|
|
493 |
|
|
494 |
module.exports = function (it) {
|
|
495 |
if (it != undefined) return it[ITERATOR]
|
|
496 |
|| it['@@iterator']
|
|
497 |
|| Iterators[classof(it)];
|
|
498 |
};
|
|
499 |
|
|
500 |
},{"../internals/classof":10,"../internals/iterators":40,"../internals/well-known-symbol":77}],26:[function(require,module,exports){
|
|
501 |
var anObject = require('../internals/an-object');
|
|
502 |
var getIteratorMethod = require('../internals/get-iterator-method');
|
|
503 |
|
|
504 |
module.exports = function (it) {
|
|
505 |
var iteratorMethod = getIteratorMethod(it);
|
|
506 |
if (typeof iteratorMethod != 'function') {
|
|
507 |
throw TypeError(String(it) + ' is not iterable');
|
|
508 |
} return anObject(iteratorMethod.call(it));
|
|
509 |
};
|
|
510 |
|
|
511 |
},{"../internals/an-object":5,"../internals/get-iterator-method":25}],27:[function(require,module,exports){
|
|
512 |
(function (global){
|
|
513 |
var check = function (it) {
|
|
514 |
return it && it.Math == Math && it;
|
|
515 |
};
|
|
516 |
|
|
517 |
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
|
|
518 |
module.exports =
|
|
519 |
// eslint-disable-next-line no-undef
|
|
520 |
check(typeof globalThis == 'object' && globalThis) ||
|
|
521 |
check(typeof window == 'object' && window) ||
|
|
522 |
check(typeof self == 'object' && self) ||
|
|
523 |
check(typeof global == 'object' && global) ||
|
|
524 |
// eslint-disable-next-line no-new-func
|
|
525 |
Function('return this')();
|
|
526 |
|
|
527 |
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
528 |
},{}],28:[function(require,module,exports){
|
|
529 |
var hasOwnProperty = {}.hasOwnProperty;
|
|
530 |
|
|
531 |
module.exports = function (it, key) {
|
|
532 |
return hasOwnProperty.call(it, key);
|
|
533 |
};
|
|
534 |
|
|
535 |
},{}],29:[function(require,module,exports){
|
|
536 |
module.exports = {};
|
|
537 |
|
|
538 |
},{}],30:[function(require,module,exports){
|
|
539 |
var getBuiltIn = require('../internals/get-built-in');
|
|
540 |
|
|
541 |
module.exports = getBuiltIn('document', 'documentElement');
|
|
542 |
|
|
543 |
},{"../internals/get-built-in":24}],31:[function(require,module,exports){
|
|
544 |
var DESCRIPTORS = require('../internals/descriptors');
|
|
545 |
var fails = require('../internals/fails');
|
|
546 |
var createElement = require('../internals/document-create-element');
|
|
547 |
|
|
548 |
// Thank's IE8 for his funny defineProperty
|
|
549 |
module.exports = !DESCRIPTORS && !fails(function () {
|
|
550 |
return Object.defineProperty(createElement('div'), 'a', {
|
|
551 |
get: function () { return 7; }
|
|
552 |
}).a != 7;
|
|
553 |
});
|
|
554 |
|
|
555 |
},{"../internals/descriptors":18,"../internals/document-create-element":19,"../internals/fails":22}],32:[function(require,module,exports){
|
|
556 |
var fails = require('../internals/fails');
|
|
557 |
var classof = require('../internals/classof-raw');
|
|
558 |
|
|
559 |
var split = ''.split;
|
|
560 |
|
|
561 |
// fallback for non-array-like ES3 and non-enumerable old V8 strings
|
|
562 |
module.exports = fails(function () {
|
|
563 |
// throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
|
|
564 |
// eslint-disable-next-line no-prototype-builtins
|
|
565 |
return !Object('z').propertyIsEnumerable(0);
|
|
566 |
}) ? function (it) {
|
|
567 |
return classof(it) == 'String' ? split.call(it, '') : Object(it);
|
|
568 |
} : Object;
|
|
569 |
|
|
570 |
},{"../internals/classof-raw":9,"../internals/fails":22}],33:[function(require,module,exports){
|
|
571 |
var store = require('../internals/shared-store');
|
|
572 |
|
|
573 |
var functionToString = Function.toString;
|
|
574 |
|
|
575 |
// this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper
|
|
576 |
if (typeof store.inspectSource != 'function') {
|
|
577 |
store.inspectSource = function (it) {
|
|
578 |
return functionToString.call(it);
|
|
579 |
};
|
|
580 |
}
|
|
581 |
|
|
582 |
module.exports = store.inspectSource;
|
|
583 |
|
|
584 |
},{"../internals/shared-store":64}],34:[function(require,module,exports){
|
|
585 |
var NATIVE_WEAK_MAP = require('../internals/native-weak-map');
|
|
586 |
var global = require('../internals/global');
|
|
587 |
var isObject = require('../internals/is-object');
|
|
588 |
var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
|
|
589 |
var objectHas = require('../internals/has');
|
|
590 |
var sharedKey = require('../internals/shared-key');
|
|
591 |
var hiddenKeys = require('../internals/hidden-keys');
|
|
592 |
|
|
593 |
var WeakMap = global.WeakMap;
|
|
594 |
var set, get, has;
|
|
595 |
|
|
596 |
var enforce = function (it) {
|
|
597 |
return has(it) ? get(it) : set(it, {});
|
|
598 |
};
|
|
599 |
|
|
600 |
var getterFor = function (TYPE) {
|
|
601 |
return function (it) {
|
|
602 |
var state;
|
|
603 |
if (!isObject(it) || (state = get(it)).type !== TYPE) {
|
|
604 |
throw TypeError('Incompatible receiver, ' + TYPE + ' required');
|
|
605 |
} return state;
|
|
606 |
};
|
|
607 |
};
|
|
608 |
|
|
609 |
if (NATIVE_WEAK_MAP) {
|
|
610 |
var store = new WeakMap();
|
|
611 |
var wmget = store.get;
|
|
612 |
var wmhas = store.has;
|
|
613 |
var wmset = store.set;
|
|
614 |
set = function (it, metadata) {
|
|
615 |
wmset.call(store, it, metadata);
|
|
616 |
return metadata;
|
|
617 |
};
|
|
618 |
get = function (it) {
|
|
619 |
return wmget.call(store, it) || {};
|
|
620 |
};
|
|
621 |
has = function (it) {
|
|
622 |
return wmhas.call(store, it);
|
|
623 |
};
|
|
624 |
} else {
|
|
625 |
var STATE = sharedKey('state');
|
|
626 |
hiddenKeys[STATE] = true;
|
|
627 |
set = function (it, metadata) {
|
|
628 |
createNonEnumerableProperty(it, STATE, metadata);
|
|
629 |
return metadata;
|
|
630 |
};
|
|
631 |
get = function (it) {
|
|
632 |
return objectHas(it, STATE) ? it[STATE] : {};
|
|
633 |
};
|
|
634 |
has = function (it) {
|
|
635 |
return objectHas(it, STATE);
|
|
636 |
};
|
|
637 |
}
|
|
638 |
|
|
639 |
module.exports = {
|
|
640 |
set: set,
|
|
641 |
get: get,
|
|
642 |
has: has,
|
|
643 |
enforce: enforce,
|
|
644 |
getterFor: getterFor
|
|
645 |
};
|
|
646 |
|
|
647 |
},{"../internals/create-non-enumerable-property":14,"../internals/global":27,"../internals/has":28,"../internals/hidden-keys":29,"../internals/is-object":37,"../internals/native-weak-map":43,"../internals/shared-key":63}],35:[function(require,module,exports){
|
|
648 |
var wellKnownSymbol = require('../internals/well-known-symbol');
|
|
649 |
var Iterators = require('../internals/iterators');
|
|
650 |
|
|
651 |
var ITERATOR = wellKnownSymbol('iterator');
|
|
652 |
var ArrayPrototype = Array.prototype;
|
|
653 |
|
|
654 |
// check on default Array iterator
|
|
655 |
module.exports = function (it) {
|
|
656 |
return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
|
|
657 |
};
|
|
658 |
|
|
659 |
},{"../internals/iterators":40,"../internals/well-known-symbol":77}],36:[function(require,module,exports){
|
|
660 |
var fails = require('../internals/fails');
|
|
661 |
|
|
662 |
var replacement = /#|\.prototype\./;
|
|
663 |
|
|
664 |
var isForced = function (feature, detection) {
|
|
665 |
var value = data[normalize(feature)];
|
|
666 |
return value == POLYFILL ? true
|
|
667 |
: value == NATIVE ? false
|
|
668 |
: typeof detection == 'function' ? fails(detection)
|
|
669 |
: !!detection;
|
|
670 |
};
|
|
671 |
|
|
672 |
var normalize = isForced.normalize = function (string) {
|
|
673 |
return String(string).replace(replacement, '.').toLowerCase();
|
|
674 |
};
|
|
675 |
|
|
676 |
var data = isForced.data = {};
|
|
677 |
var NATIVE = isForced.NATIVE = 'N';
|
|
678 |
var POLYFILL = isForced.POLYFILL = 'P';
|
|
679 |
|
|
680 |
module.exports = isForced;
|
|
681 |
|
|
682 |
},{"../internals/fails":22}],37:[function(require,module,exports){
|
|
683 |
module.exports = function (it) {
|
|
684 |
return typeof it === 'object' ? it !== null : typeof it === 'function';
|
|
685 |
};
|
|
686 |
|
|
687 |
},{}],38:[function(require,module,exports){
|
|
688 |
module.exports = false;
|
|
689 |
|
|
690 |
},{}],39:[function(require,module,exports){
|
|
691 |
'use strict';
|
|
692 |
var getPrototypeOf = require('../internals/object-get-prototype-of');
|
|
693 |
var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
|
|
694 |
var has = require('../internals/has');
|
|
695 |
var wellKnownSymbol = require('../internals/well-known-symbol');
|
|
696 |
var IS_PURE = require('../internals/is-pure');
|
|
697 |
|
|
698 |
var ITERATOR = wellKnownSymbol('iterator');
|
|
699 |
var BUGGY_SAFARI_ITERATORS = false;
|
|
700 |
|
|
701 |
var returnThis = function () { return this; };
|
|
702 |
|
|
703 |
// `%IteratorPrototype%` object
|
|
704 |
// https://tc39.github.io/ecma262/#sec-%iteratorprototype%-object
|
|
705 |
var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
|
|
706 |
|
|
707 |
if ([].keys) {
|
|
708 |
arrayIterator = [].keys();
|
|
709 |
// Safari 8 has buggy iterators w/o `next`
|
|
710 |
if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
|
|
711 |
else {
|
|
712 |
PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));
|
|
713 |
if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
|
|
714 |
}
|
|
715 |
}
|
|
716 |
|
|
717 |
if (IteratorPrototype == undefined) IteratorPrototype = {};
|
|
718 |
|
|
719 |
// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
|
|
720 |
if (!IS_PURE && !has(IteratorPrototype, ITERATOR)) {
|
|
721 |
createNonEnumerableProperty(IteratorPrototype, ITERATOR, returnThis);
|
|
722 |
}
|
|
723 |
|
|
724 |
module.exports = {
|
|
725 |
IteratorPrototype: IteratorPrototype,
|
|
726 |
BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
|
|
727 |
};
|
|
728 |
|
|
729 |
},{"../internals/create-non-enumerable-property":14,"../internals/has":28,"../internals/is-pure":38,"../internals/object-get-prototype-of":51,"../internals/well-known-symbol":77}],40:[function(require,module,exports){
|
|
730 |
arguments[4][29][0].apply(exports,arguments)
|
|
731 |
},{"dup":29}],41:[function(require,module,exports){
|
|
732 |
var fails = require('../internals/fails');
|
|
733 |
|
|
734 |
module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
|
|
735 |
// Chrome 38 Symbol has incorrect toString conversion
|
|
736 |
// eslint-disable-next-line no-undef
|
|
737 |
return !String(Symbol());
|
|
738 |
});
|
|
739 |
|
|
740 |
},{"../internals/fails":22}],42:[function(require,module,exports){
|
|
741 |
var fails = require('../internals/fails');
|
|
742 |
var wellKnownSymbol = require('../internals/well-known-symbol');
|
|
743 |
var IS_PURE = require('../internals/is-pure');
|
|
744 |
|
|
745 |
var ITERATOR = wellKnownSymbol('iterator');
|
|
746 |
|
|
747 |
module.exports = !fails(function () {
|
|
748 |
var url = new URL('b?a=1&b=2&c=3', 'http://a');
|
|
749 |
var searchParams = url.searchParams;
|
|
750 |
var result = '';
|
|
751 |
url.pathname = 'c%20d';
|
|
752 |
searchParams.forEach(function (value, key) {
|
|
753 |
searchParams['delete']('b');
|
|
754 |
result += key + value;
|
|
755 |
});
|
|
756 |
return (IS_PURE && !url.toJSON)
|
|
757 |
|| !searchParams.sort
|
|
758 |
|| url.href !== 'http://a/c%20d?a=1&c=3'
|
|
759 |
|| searchParams.get('c') !== '3'
|
|
760 |
|| String(new URLSearchParams('?a=1')) !== 'a=1'
|
|
761 |
|| !searchParams[ITERATOR]
|
|
762 |
// throws in Edge
|
|
763 |
|| new URL('https://a@b').username !== 'a'
|
|
764 |
|| new URLSearchParams(new URLSearchParams('a=b')).get('a') !== 'b'
|
|
765 |
// not punycoded in Edge
|
|
766 |
|| new URL('http://тест').host !== 'xn--e1aybc'
|
|
767 |
// not escaped in Chrome 62-
|
|
768 |
|| new URL('http://a#б').hash !== '#%D0%B1'
|
|
769 |
// fails in Chrome 66-
|
|
770 |
|| result !== 'a1c3'
|
|
771 |
// throws in Safari
|
|
772 |
|| new URL('http://x', undefined).host !== 'x';
|
|
773 |
});
|
|
774 |
|
|
775 |
},{"../internals/fails":22,"../internals/is-pure":38,"../internals/well-known-symbol":77}],43:[function(require,module,exports){
|
|
776 |
var global = require('../internals/global');
|
|
777 |
var inspectSource = require('../internals/inspect-source');
|
|
778 |
|
|
779 |
var WeakMap = global.WeakMap;
|
|
780 |
|
|
781 |
module.exports = typeof WeakMap === 'function' && /native code/.test(inspectSource(WeakMap));
|
|
782 |
|
|
783 |
},{"../internals/global":27,"../internals/inspect-source":33}],44:[function(require,module,exports){
|
|
784 |
'use strict';
|
|
785 |
var DESCRIPTORS = require('../internals/descriptors');
|
|
786 |
var fails = require('../internals/fails');
|
|
787 |
var objectKeys = require('../internals/object-keys');
|
|
788 |
var getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');
|
|
789 |
var propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');
|
|
790 |
var toObject = require('../internals/to-object');
|
|
791 |
var IndexedObject = require('../internals/indexed-object');
|
|
792 |
|
|
793 |
var nativeAssign = Object.assign;
|
|
794 |
var defineProperty = Object.defineProperty;
|
|
795 |
|
|
796 |
// `Object.assign` method
|
|
797 |
// https://tc39.github.io/ecma262/#sec-object.assign
|
|
798 |
module.exports = !nativeAssign || fails(function () {
|
|
799 |
// should have correct order of operations (Edge bug)
|
|
800 |
if (DESCRIPTORS && nativeAssign({ b: 1 }, nativeAssign(defineProperty({}, 'a', {
|
|
801 |
enumerable: true,
|
|
802 |
get: function () {
|
|
803 |
defineProperty(this, 'b', {
|
|
804 |
value: 3,
|
|
805 |
enumerable: false
|
|
806 |
});
|
|
807 |
}
|
|
808 |
}), { b: 2 })).b !== 1) return true;
|
|
809 |
// should work with symbols and should have deterministic property order (V8 bug)
|
|
810 |
var A = {};
|
|
811 |
var B = {};
|
|
812 |
// eslint-disable-next-line no-undef
|
|
813 |
var symbol = Symbol();
|
|
814 |
var alphabet = 'abcdefghijklmnopqrst';
|
|
815 |
A[symbol] = 7;
|
|
816 |
alphabet.split('').forEach(function (chr) { B[chr] = chr; });
|
|
817 |
return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet;
|
|
818 |
}) ? function assign(target, source) { // eslint-disable-line no-unused-vars
|
|
819 |
var T = toObject(target);
|
|
820 |
var argumentsLength = arguments.length;
|
|
821 |
var index = 1;
|
|
822 |
var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
|
|
823 |
var propertyIsEnumerable = propertyIsEnumerableModule.f;
|
|
824 |
while (argumentsLength > index) {
|
|
825 |
var S = IndexedObject(arguments[index++]);
|
|
826 |
var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);
|
|
827 |
var length = keys.length;
|
|
828 |
var j = 0;
|
|
829 |
var key;
|
|
830 |
while (length > j) {
|
|
831 |
key = keys[j++];
|
|
832 |
if (!DESCRIPTORS || propertyIsEnumerable.call(S, key)) T[key] = S[key];
|
|
833 |
}
|
|
834 |
} return T;
|
|
835 |
} : nativeAssign;
|
|
836 |
|
|
837 |
},{"../internals/descriptors":18,"../internals/fails":22,"../internals/indexed-object":32,"../internals/object-get-own-property-symbols":50,"../internals/object-keys":53,"../internals/object-property-is-enumerable":54,"../internals/to-object":72}],45:[function(require,module,exports){
|
|
838 |
var anObject = require('../internals/an-object');
|
|
839 |
var defineProperties = require('../internals/object-define-properties');
|
|
840 |
var enumBugKeys = require('../internals/enum-bug-keys');
|
|
841 |
var hiddenKeys = require('../internals/hidden-keys');
|
|
842 |
var html = require('../internals/html');
|
|
843 |
var documentCreateElement = require('../internals/document-create-element');
|
|
844 |
var sharedKey = require('../internals/shared-key');
|
|
845 |
|
|
846 |
var GT = '>';
|
|
847 |
var LT = '<';
|
|
848 |
var PROTOTYPE = 'prototype';
|
|
849 |
var SCRIPT = 'script';
|
|
850 |
var IE_PROTO = sharedKey('IE_PROTO');
|
|
851 |
|
|
852 |
var EmptyConstructor = function () { /* empty */ };
|
|
853 |
|
|
854 |
var scriptTag = function (content) {
|
|
855 |
return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
|
|
856 |
};
|
|
857 |
|
|
858 |
// Create object with fake `null` prototype: use ActiveX Object with cleared prototype
|
|
859 |
var NullProtoObjectViaActiveX = function (activeXDocument) {
|
|
860 |
activeXDocument.write(scriptTag(''));
|
|
861 |
activeXDocument.close();
|
|
862 |
var temp = activeXDocument.parentWindow.Object;
|
|
863 |
activeXDocument = null; // avoid memory leak
|
|
864 |
return temp;
|
|
865 |
};
|
|
866 |
|
|
867 |
// Create object with fake `null` prototype: use iframe Object with cleared prototype
|
|
868 |
var NullProtoObjectViaIFrame = function () {
|
|
869 |
// Thrash, waste and sodomy: IE GC bug
|
|
870 |
var iframe = documentCreateElement('iframe');
|
|
871 |
var JS = 'java' + SCRIPT + ':';
|
|
872 |
var iframeDocument;
|
|
873 |
iframe.style.display = 'none';
|
|
874 |
html.appendChild(iframe);
|
|
875 |
// https://github.com/zloirock/core-js/issues/475
|
|
876 |
iframe.src = String(JS);
|
|
877 |
iframeDocument = iframe.contentWindow.document;
|
|
878 |
iframeDocument.open();
|
|
879 |
iframeDocument.write(scriptTag('document.F=Object'));
|
|
880 |
iframeDocument.close();
|
|
881 |
return iframeDocument.F;
|
|
882 |
};
|
|
883 |
|
|
884 |
// Check for document.domain and active x support
|
|
885 |
// No need to use active x approach when document.domain is not set
|
|
886 |
// see https://github.com/es-shims/es5-shim/issues/150
|
|
887 |
// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
|
|
888 |
// avoid IE GC bug
|
|
889 |
var activeXDocument;
|
|
890 |
var NullProtoObject = function () {
|
|
891 |
try {
|
|
892 |
/* global ActiveXObject */
|
|
893 |
activeXDocument = document.domain && new ActiveXObject('htmlfile');
|
|
894 |
} catch (error) { /* ignore */ }
|
|
895 |
NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame();
|
|
896 |
var length = enumBugKeys.length;
|
|
897 |
while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
|
|
898 |
return NullProtoObject();
|
|
899 |
};
|
|
900 |
|
|
901 |
hiddenKeys[IE_PROTO] = true;
|
|
902 |
|
|
903 |
// `Object.create` method
|
|
904 |
// https://tc39.github.io/ecma262/#sec-object.create
|
|
905 |
module.exports = Object.create || function create(O, Properties) {
|
|
906 |
var result;
|
|
907 |
if (O !== null) {
|
|
908 |
EmptyConstructor[PROTOTYPE] = anObject(O);
|
|
909 |
result = new EmptyConstructor();
|
|
910 |
EmptyConstructor[PROTOTYPE] = null;
|
|
911 |
// add "__proto__" for Object.getPrototypeOf polyfill
|
|
912 |
result[IE_PROTO] = O;
|
|
913 |
} else result = NullProtoObject();
|
|
914 |
return Properties === undefined ? result : defineProperties(result, Properties);
|
|
915 |
};
|
|
916 |
|
|
917 |
},{"../internals/an-object":5,"../internals/document-create-element":19,"../internals/enum-bug-keys":20,"../internals/hidden-keys":29,"../internals/html":30,"../internals/object-define-properties":46,"../internals/shared-key":63}],46:[function(require,module,exports){
|
|
918 |
var DESCRIPTORS = require('../internals/descriptors');
|
|
919 |
var definePropertyModule = require('../internals/object-define-property');
|
|
920 |
var anObject = require('../internals/an-object');
|
|
921 |
var objectKeys = require('../internals/object-keys');
|
|
922 |
|
|
923 |
// `Object.defineProperties` method
|
|
924 |
// https://tc39.github.io/ecma262/#sec-object.defineproperties
|
|
925 |
module.exports = DESCRIPTORS ? Object.defineProperties : function defineProperties(O, Properties) {
|
|
926 |
anObject(O);
|
|
927 |
var keys = objectKeys(Properties);
|
|
928 |
var length = keys.length;
|
|
929 |
var index = 0;
|
|
930 |
var key;
|
|
931 |
while (length > index) definePropertyModule.f(O, key = keys[index++], Properties[key]);
|
|
932 |
return O;
|
|
933 |
};
|
|
934 |
|
|
935 |
},{"../internals/an-object":5,"../internals/descriptors":18,"../internals/object-define-property":47,"../internals/object-keys":53}],47:[function(require,module,exports){
|
|
936 |
var DESCRIPTORS = require('../internals/descriptors');
|
|
937 |
var IE8_DOM_DEFINE = require('../internals/ie8-dom-define');
|
|
938 |
var anObject = require('../internals/an-object');
|
|
939 |
var toPrimitive = require('../internals/to-primitive');
|
|
940 |
|
|
941 |
var nativeDefineProperty = Object.defineProperty;
|
|
942 |
|
|
943 |
// `Object.defineProperty` method
|
|
944 |
// https://tc39.github.io/ecma262/#sec-object.defineproperty
|
|
945 |
exports.f = DESCRIPTORS ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
|
|
946 |
anObject(O);
|
|
947 |
P = toPrimitive(P, true);
|
|
948 |
anObject(Attributes);
|
|
949 |
if (IE8_DOM_DEFINE) try {
|
|
950 |
return nativeDefineProperty(O, P, Attributes);
|
|
951 |
} catch (error) { /* empty */ }
|
|
952 |
if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
|
|
953 |
if ('value' in Attributes) O[P] = Attributes.value;
|
|
954 |
return O;
|
|
955 |
};
|
|
956 |
|
|
957 |
},{"../internals/an-object":5,"../internals/descriptors":18,"../internals/ie8-dom-define":31,"../internals/to-primitive":73}],48:[function(require,module,exports){
|
|
958 |
var DESCRIPTORS = require('../internals/descriptors');
|
|
959 |
var propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');
|
|
960 |
var createPropertyDescriptor = require('../internals/create-property-descriptor');
|
|
961 |
var toIndexedObject = require('../internals/to-indexed-object');
|
|
962 |
var toPrimitive = require('../internals/to-primitive');
|
|
963 |
var has = require('../internals/has');
|
|
964 |
var IE8_DOM_DEFINE = require('../internals/ie8-dom-define');
|
|
965 |
|
|
966 |
var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
967 |
|
|
968 |
// `Object.getOwnPropertyDescriptor` method
|
|
969 |
// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
|
|
970 |
exports.f = DESCRIPTORS ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
|
|
971 |
O = toIndexedObject(O);
|
|
972 |
P = toPrimitive(P, true);
|
|
973 |
if (IE8_DOM_DEFINE) try {
|
|
974 |
return nativeGetOwnPropertyDescriptor(O, P);
|
|
975 |
} catch (error) { /* empty */ }
|
|
976 |
if (has(O, P)) return createPropertyDescriptor(!propertyIsEnumerableModule.f.call(O, P), O[P]);
|
|
977 |
};
|
|
978 |
|
|
979 |
},{"../internals/create-property-descriptor":15,"../internals/descriptors":18,"../internals/has":28,"../internals/ie8-dom-define":31,"../internals/object-property-is-enumerable":54,"../internals/to-indexed-object":69,"../internals/to-primitive":73}],49:[function(require,module,exports){
|
|
980 |
var internalObjectKeys = require('../internals/object-keys-internal');
|
|
981 |
var enumBugKeys = require('../internals/enum-bug-keys');
|
|
982 |
|
|
983 |
var hiddenKeys = enumBugKeys.concat('length', 'prototype');
|
|
984 |
|
|
985 |
// `Object.getOwnPropertyNames` method
|
|
986 |
// https://tc39.github.io/ecma262/#sec-object.getownpropertynames
|
|
987 |
exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
|
|
988 |
return internalObjectKeys(O, hiddenKeys);
|
|
989 |
};
|
|
990 |
|
|
991 |
},{"../internals/enum-bug-keys":20,"../internals/object-keys-internal":52}],50:[function(require,module,exports){
|
|
992 |
exports.f = Object.getOwnPropertySymbols;
|
|
993 |
|
|
994 |
},{}],51:[function(require,module,exports){
|
|
995 |
var has = require('../internals/has');
|
|
996 |
var toObject = require('../internals/to-object');
|
|
997 |
var sharedKey = require('../internals/shared-key');
|
|
998 |
var CORRECT_PROTOTYPE_GETTER = require('../internals/correct-prototype-getter');
|
|
999 |
|
|
1000 |
var IE_PROTO = sharedKey('IE_PROTO');
|
|
1001 |
var ObjectPrototype = Object.prototype;
|
|
1002 |
|
|
1003 |
// `Object.getPrototypeOf` method
|
|
1004 |
// https://tc39.github.io/ecma262/#sec-object.getprototypeof
|
|
1005 |
module.exports = CORRECT_PROTOTYPE_GETTER ? Object.getPrototypeOf : function (O) {
|
|
1006 |
O = toObject(O);
|
|
1007 |
if (has(O, IE_PROTO)) return O[IE_PROTO];
|
|
1008 |
if (typeof O.constructor == 'function' && O instanceof O.constructor) {
|
|
1009 |
return O.constructor.prototype;
|
|
1010 |
} return O instanceof Object ? ObjectPrototype : null;
|
|
1011 |
};
|
|
1012 |
|
|
1013 |
},{"../internals/correct-prototype-getter":12,"../internals/has":28,"../internals/shared-key":63,"../internals/to-object":72}],52:[function(require,module,exports){
|
|
1014 |
var has = require('../internals/has');
|
|
1015 |
var toIndexedObject = require('../internals/to-indexed-object');
|
|
1016 |
var indexOf = require('../internals/array-includes').indexOf;
|
|
1017 |
var hiddenKeys = require('../internals/hidden-keys');
|
|
1018 |
|
|
1019 |
module.exports = function (object, names) {
|
|
1020 |
var O = toIndexedObject(object);
|
|
1021 |
var i = 0;
|
|
1022 |
var result = [];
|
|
1023 |
var key;
|
|
1024 |
for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
|
|
1025 |
// Don't enum bug & hidden keys
|
|
1026 |
while (names.length > i) if (has(O, key = names[i++])) {
|
|
1027 |
~indexOf(result, key) || result.push(key);
|
|
1028 |
}
|
|
1029 |
return result;
|
|
1030 |
};
|
|
1031 |
|
|
1032 |
},{"../internals/array-includes":7,"../internals/has":28,"../internals/hidden-keys":29,"../internals/to-indexed-object":69}],53:[function(require,module,exports){
|
|
1033 |
var internalObjectKeys = require('../internals/object-keys-internal');
|
|
1034 |
var enumBugKeys = require('../internals/enum-bug-keys');
|
|
1035 |
|
|
1036 |
// `Object.keys` method
|
|
1037 |
// https://tc39.github.io/ecma262/#sec-object.keys
|
|
1038 |
module.exports = Object.keys || function keys(O) {
|
|
1039 |
return internalObjectKeys(O, enumBugKeys);
|
|
1040 |
};
|
|
1041 |
|
|
1042 |
},{"../internals/enum-bug-keys":20,"../internals/object-keys-internal":52}],54:[function(require,module,exports){
|
|
1043 |
'use strict';
|
|
1044 |
var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
|
|
1045 |
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
1046 |
|
|
1047 |
// Nashorn ~ JDK8 bug
|
|
1048 |
var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
|
|
1049 |
|
|
1050 |
// `Object.prototype.propertyIsEnumerable` method implementation
|
|
1051 |
// https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable
|
|
1052 |
exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
|
|
1053 |
var descriptor = getOwnPropertyDescriptor(this, V);
|
|
1054 |
return !!descriptor && descriptor.enumerable;
|
|
1055 |
} : nativePropertyIsEnumerable;
|
|
1056 |
|
|
1057 |
},{}],55:[function(require,module,exports){
|
|
1058 |
var anObject = require('../internals/an-object');
|
|
1059 |
var aPossiblePrototype = require('../internals/a-possible-prototype');
|
|
1060 |
|
|
1061 |
// `Object.setPrototypeOf` method
|
|
1062 |
// https://tc39.github.io/ecma262/#sec-object.setprototypeof
|
|
1063 |
// Works with __proto__ only. Old v8 can't work with null proto objects.
|
|
1064 |
/* eslint-disable no-proto */
|
|
1065 |
module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {
|
|
1066 |
var CORRECT_SETTER = false;
|
|
1067 |
var test = {};
|
|
1068 |
var setter;
|
|
1069 |
try {
|
|
1070 |
setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
|
|
1071 |
setter.call(test, []);
|
|
1072 |
CORRECT_SETTER = test instanceof Array;
|
|
1073 |
} catch (error) { /* empty */ }
|
|
1074 |
return function setPrototypeOf(O, proto) {
|
|
1075 |
anObject(O);
|
|
1076 |
aPossiblePrototype(proto);
|
|
1077 |
if (CORRECT_SETTER) setter.call(O, proto);
|
|
1078 |
else O.__proto__ = proto;
|
|
1079 |
return O;
|
|
1080 |
};
|
|
1081 |
}() : undefined);
|
|
1082 |
|
|
1083 |
},{"../internals/a-possible-prototype":2,"../internals/an-object":5}],56:[function(require,module,exports){
|
|
1084 |
var getBuiltIn = require('../internals/get-built-in');
|
|
1085 |
var getOwnPropertyNamesModule = require('../internals/object-get-own-property-names');
|
|
1086 |
var getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');
|
|
1087 |
var anObject = require('../internals/an-object');
|
|
1088 |
|
|
1089 |
// all object keys, includes non-enumerable and symbols
|
|
1090 |
module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
|
|
1091 |
var keys = getOwnPropertyNamesModule.f(anObject(it));
|
|
1092 |
var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
|
|
1093 |
return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
|
|
1094 |
};
|
|
1095 |
|
|
1096 |
},{"../internals/an-object":5,"../internals/get-built-in":24,"../internals/object-get-own-property-names":49,"../internals/object-get-own-property-symbols":50}],57:[function(require,module,exports){
|
|
1097 |
var global = require('../internals/global');
|
|
1098 |
|
|
1099 |
module.exports = global;
|
|
1100 |
|
|
1101 |
},{"../internals/global":27}],58:[function(require,module,exports){
|
|
1102 |
var redefine = require('../internals/redefine');
|
|
1103 |
|
|
1104 |
module.exports = function (target, src, options) {
|
|
1105 |
for (var key in src) redefine(target, key, src[key], options);
|
|
1106 |
return target;
|
|
1107 |
};
|
|
1108 |
|
|
1109 |
},{"../internals/redefine":59}],59:[function(require,module,exports){
|
|
1110 |
var global = require('../internals/global');
|
|
1111 |
var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
|
|
1112 |
var has = require('../internals/has');
|
|
1113 |
var setGlobal = require('../internals/set-global');
|
|
1114 |
var inspectSource = require('../internals/inspect-source');
|
|
1115 |
var InternalStateModule = require('../internals/internal-state');
|
|
1116 |
|
|
1117 |
var getInternalState = InternalStateModule.get;
|
|
1118 |
var enforceInternalState = InternalStateModule.enforce;
|
|
1119 |
var TEMPLATE = String(String).split('String');
|
|
1120 |
|
|
1121 |
(module.exports = function (O, key, value, options) {
|
|
1122 |
var unsafe = options ? !!options.unsafe : false;
|
|
1123 |
var simple = options ? !!options.enumerable : false;
|
|
1124 |
var noTargetGet = options ? !!options.noTargetGet : false;
|
|
1125 |
if (typeof value == 'function') {
|
|
1126 |
if (typeof key == 'string' && !has(value, 'name')) createNonEnumerableProperty(value, 'name', key);
|
|
1127 |
enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
|
|
1128 |
}
|
|
1129 |
if (O === global) {
|
|
1130 |
if (simple) O[key] = value;
|
|
1131 |
else setGlobal(key, value);
|
|
1132 |
return;
|
|
1133 |
} else if (!unsafe) {
|
|
1134 |
delete O[key];
|
|
1135 |
} else if (!noTargetGet && O[key]) {
|
|
1136 |
simple = true;
|
|
1137 |
}
|
|
1138 |
if (simple) O[key] = value;
|
|
1139 |
else createNonEnumerableProperty(O, key, value);
|
|
1140 |
// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
|
|
1141 |
})(Function.prototype, 'toString', function toString() {
|
|
1142 |
return typeof this == 'function' && getInternalState(this).source || inspectSource(this);
|
|
1143 |
});
|
|
1144 |
|
|
1145 |
},{"../internals/create-non-enumerable-property":14,"../internals/global":27,"../internals/has":28,"../internals/inspect-source":33,"../internals/internal-state":34,"../internals/set-global":61}],60:[function(require,module,exports){
|
|
1146 |
// `RequireObjectCoercible` abstract operation
|
|
1147 |
// https://tc39.github.io/ecma262/#sec-requireobjectcoercible
|
|
1148 |
module.exports = function (it) {
|
|
1149 |
if (it == undefined) throw TypeError("Can't call method on " + it);
|
|
1150 |
return it;
|
|
1151 |
};
|
|
1152 |
|
|
1153 |
},{}],61:[function(require,module,exports){
|
|
1154 |
var global = require('../internals/global');
|
|
1155 |
var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
|
|
1156 |
|
|
1157 |
module.exports = function (key, value) {
|
|
1158 |
try {
|
|
1159 |
createNonEnumerableProperty(global, key, value);
|
|
1160 |
} catch (error) {
|
|
1161 |
global[key] = value;
|
|
1162 |
} return value;
|
|
1163 |
};
|
|
1164 |
|
|
1165 |
},{"../internals/create-non-enumerable-property":14,"../internals/global":27}],62:[function(require,module,exports){
|
|
1166 |
var defineProperty = require('../internals/object-define-property').f;
|
|
1167 |
var has = require('../internals/has');
|
|
1168 |
var wellKnownSymbol = require('../internals/well-known-symbol');
|
|
1169 |
|
|
1170 |
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
|
|
1171 |
|
|
1172 |
module.exports = function (it, TAG, STATIC) {
|
|
1173 |
if (it && !has(it = STATIC ? it : it.prototype, TO_STRING_TAG)) {
|
|
1174 |
defineProperty(it, TO_STRING_TAG, { configurable: true, value: TAG });
|
|
1175 |
}
|
|
1176 |
};
|
|
1177 |
|
|
1178 |
},{"../internals/has":28,"../internals/object-define-property":47,"../internals/well-known-symbol":77}],63:[function(require,module,exports){
|
|
1179 |
var shared = require('../internals/shared');
|
|
1180 |
var uid = require('../internals/uid');
|
|
1181 |
|
|
1182 |
var keys = shared('keys');
|
|
1183 |
|
|
1184 |
module.exports = function (key) {
|
|
1185 |
return keys[key] || (keys[key] = uid(key));
|
|
1186 |
};
|
|
1187 |
|
|
1188 |
},{"../internals/shared":65,"../internals/uid":75}],64:[function(require,module,exports){
|
|
1189 |
var global = require('../internals/global');
|
|
1190 |
var setGlobal = require('../internals/set-global');
|
|
1191 |
|
|
1192 |
var SHARED = '__core-js_shared__';
|
|
1193 |
var store = global[SHARED] || setGlobal(SHARED, {});
|
|
1194 |
|
|
1195 |
module.exports = store;
|
|
1196 |
|
|
1197 |
},{"../internals/global":27,"../internals/set-global":61}],65:[function(require,module,exports){
|
|
1198 |
var IS_PURE = require('../internals/is-pure');
|
|
1199 |
var store = require('../internals/shared-store');
|
|
1200 |
|
|
1201 |
(module.exports = function (key, value) {
|
|
1202 |
return store[key] || (store[key] = value !== undefined ? value : {});
|
|
1203 |
})('versions', []).push({
|
|
1204 |
version: '3.6.4',
|
|
1205 |
mode: IS_PURE ? 'pure' : 'global',
|
|
1206 |
copyright: '© 2020 Denis Pushkarev (zloirock.ru)'
|
|
1207 |
});
|
|
1208 |
|
|
1209 |
},{"../internals/is-pure":38,"../internals/shared-store":64}],66:[function(require,module,exports){
|
|
1210 |
var toInteger = require('../internals/to-integer');
|
|
1211 |
var requireObjectCoercible = require('../internals/require-object-coercible');
|
|
1212 |
|
|
1213 |
// `String.prototype.{ codePointAt, at }` methods implementation
|
|
1214 |
var createMethod = function (CONVERT_TO_STRING) {
|
|
1215 |
return function ($this, pos) {
|
|
1216 |
var S = String(requireObjectCoercible($this));
|
|
1217 |
var position = toInteger(pos);
|
|
1218 |
var size = S.length;
|
|
1219 |
var first, second;
|
|
1220 |
if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
|
|
1221 |
first = S.charCodeAt(position);
|
|
1222 |
return first < 0xD800 || first > 0xDBFF || position + 1 === size
|
|
1223 |
|| (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF
|
|
1224 |
? CONVERT_TO_STRING ? S.charAt(position) : first
|
|
1225 |
: CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
|
|
1226 |
};
|
|
1227 |
};
|
|
1228 |
|
|
1229 |
module.exports = {
|
|
1230 |
// `String.prototype.codePointAt` method
|
|
1231 |
// https://tc39.github.io/ecma262/#sec-string.prototype.codepointat
|
|
1232 |
codeAt: createMethod(false),
|
|
1233 |
// `String.prototype.at` method
|
|
1234 |
// https://github.com/mathiasbynens/String.prototype.at
|
|
1235 |
charAt: createMethod(true)
|
|
1236 |
};
|
|
1237 |
|
|
1238 |
},{"../internals/require-object-coercible":60,"../internals/to-integer":70}],67:[function(require,module,exports){
|
|
1239 |
'use strict';
|
|
1240 |
// based on https://github.com/bestiejs/punycode.js/blob/master/punycode.js
|
|
1241 |
var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1
|
|
1242 |
var base = 36;
|
|
1243 |
var tMin = 1;
|
|
1244 |
var tMax = 26;
|
|
1245 |
var skew = 38;
|
|
1246 |
var damp = 700;
|
|
1247 |
var initialBias = 72;
|
|
1248 |
var initialN = 128; // 0x80
|
|
1249 |
var delimiter = '-'; // '\x2D'
|
|
1250 |
var regexNonASCII = /[^\0-\u007E]/; // non-ASCII chars
|
|
1251 |
var regexSeparators = /[.\u3002\uFF0E\uFF61]/g; // RFC 3490 separators
|
|
1252 |
var OVERFLOW_ERROR = 'Overflow: input needs wider integers to process';
|
|
1253 |
var baseMinusTMin = base - tMin;
|
|
1254 |
var floor = Math.floor;
|
|
1255 |
var stringFromCharCode = String.fromCharCode;
|
|
1256 |
|
|
1257 |
/**
|
|
1258 |
* Creates an array containing the numeric code points of each Unicode
|
|
1259 |
* character in the string. While JavaScript uses UCS-2 internally,
|
|
1260 |
* this function will convert a pair of surrogate halves (each of which
|
|
1261 |
* UCS-2 exposes as separate characters) into a single code point,
|
|
1262 |
* matching UTF-16.
|
|
1263 |
*/
|
|
1264 |
var ucs2decode = function (string) {
|
|
1265 |
var output = [];
|
|
1266 |
var counter = 0;
|
|
1267 |
var length = string.length;
|
|
1268 |
while (counter < length) {
|
|
1269 |
var value = string.charCodeAt(counter++);
|
|
1270 |
if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
|
|
1271 |
// It's a high surrogate, and there is a next character.
|
|
1272 |
var extra = string.charCodeAt(counter++);
|
|
1273 |
if ((extra & 0xFC00) == 0xDC00) { // Low surrogate.
|
|
1274 |
output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
|
|
1275 |
} else {
|
|
1276 |
// It's an unmatched surrogate; only append this code unit, in case the
|
|
1277 |
// next code unit is the high surrogate of a surrogate pair.
|
|
1278 |
output.push(value);
|
|
1279 |
counter--;
|
|
1280 |
}
|
|
1281 |
} else {
|
|
1282 |
output.push(value);
|
|
1283 |
}
|
|
1284 |
}
|
|
1285 |
return output;
|
|
1286 |
};
|
|
1287 |
|
|
1288 |
/**
|
|
1289 |
* Converts a digit/integer into a basic code point.
|
|
1290 |
*/
|
|
1291 |
var digitToBasic = function (digit) {
|
|
1292 |
// 0..25 map to ASCII a..z or A..Z
|
|
1293 |
// 26..35 map to ASCII 0..9
|
|
1294 |
return digit + 22 + 75 * (digit < 26);
|
|
1295 |
};
|
|
1296 |
|
|
1297 |
/**
|
|
1298 |
* Bias adaptation function as per section 3.4 of RFC 3492.
|
|
1299 |
* https://tools.ietf.org/html/rfc3492#section-3.4
|
|
1300 |
*/
|
|
1301 |
var adapt = function (delta, numPoints, firstTime) {
|
|
1302 |
var k = 0;
|
|
1303 |
delta = firstTime ? floor(delta / damp) : delta >> 1;
|
|
1304 |
delta += floor(delta / numPoints);
|
|
1305 |
for (; delta > baseMinusTMin * tMax >> 1; k += base) {
|
|
1306 |
delta = floor(delta / baseMinusTMin);
|
|
1307 |
}
|
|
1308 |
return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
|
|
1309 |
};
|
|
1310 |
|
|
1311 |
/**
|
|
1312 |
* Converts a string of Unicode symbols (e.g. a domain name label) to a
|
|
1313 |
* Punycode string of ASCII-only symbols.
|
|
1314 |
*/
|
|
1315 |
// eslint-disable-next-line max-statements
|
|
1316 |
var encode = function (input) {
|
|
1317 |
var output = [];
|
|
1318 |
|
|
1319 |
// Convert the input in UCS-2 to an array of Unicode code points.
|
|
1320 |
input = ucs2decode(input);
|
|
1321 |
|
|
1322 |
// Cache the length.
|
|
1323 |
var inputLength = input.length;
|
|
1324 |
|
|
1325 |
// Initialize the state.
|
|
1326 |
var n = initialN;
|
|
1327 |
var delta = 0;
|
|
1328 |
var bias = initialBias;
|
|
1329 |
var i, currentValue;
|
|
1330 |
|
|
1331 |
// Handle the basic code points.
|
|
1332 |
for (i = 0; i < input.length; i++) {
|
|
1333 |
currentValue = input[i];
|
|
1334 |
if (currentValue < 0x80) {
|
|
1335 |
output.push(stringFromCharCode(currentValue));
|
|
1336 |
}
|
|
1337 |
}
|
|
1338 |
|
|
1339 |
var basicLength = output.length; // number of basic code points.
|
|
1340 |
var handledCPCount = basicLength; // number of code points that have been handled;
|
|
1341 |
|
|
1342 |
// Finish the basic string with a delimiter unless it's empty.
|
|
1343 |
if (basicLength) {
|
|
1344 |
output.push(delimiter);
|
|
1345 |
}
|
|
1346 |
|
|
1347 |
// Main encoding loop:
|
|
1348 |
while (handledCPCount < inputLength) {
|
|
1349 |
// All non-basic code points < n have been handled already. Find the next larger one:
|
|
1350 |
var m = maxInt;
|
|
1351 |
for (i = 0; i < input.length; i++) {
|
|
1352 |
currentValue = input[i];
|
|
1353 |
if (currentValue >= n && currentValue < m) {
|
|
1354 |
m = currentValue;
|
|
1355 |
}
|
|
1356 |
}
|
|
1357 |
|
|
1358 |
// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>, but guard against overflow.
|
|
1359 |
var handledCPCountPlusOne = handledCPCount + 1;
|
|
1360 |
if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
|
|
1361 |
throw RangeError(OVERFLOW_ERROR);
|
|
1362 |
}
|
|
1363 |
|
|
1364 |
delta += (m - n) * handledCPCountPlusOne;
|
|
1365 |
n = m;
|
|
1366 |
|
|
1367 |
for (i = 0; i < input.length; i++) {
|
|
1368 |
currentValue = input[i];
|
|
1369 |
if (currentValue < n && ++delta > maxInt) {
|
|
1370 |
throw RangeError(OVERFLOW_ERROR);
|
|
1371 |
}
|
|
1372 |
if (currentValue == n) {
|
|
1373 |
// Represent delta as a generalized variable-length integer.
|
|
1374 |
var q = delta;
|
|
1375 |
for (var k = base; /* no condition */; k += base) {
|
|
1376 |
var t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
|
|
1377 |
if (q < t) break;
|
|
1378 |
var qMinusT = q - t;
|
|
1379 |
var baseMinusT = base - t;
|
|
1380 |
output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT)));
|
|
1381 |
q = floor(qMinusT / baseMinusT);
|
|
1382 |
}
|
|
1383 |
|
|
1384 |
output.push(stringFromCharCode(digitToBasic(q)));
|
|
1385 |
bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
|
|
1386 |
delta = 0;
|
|
1387 |
++handledCPCount;
|
|
1388 |
}
|
|
1389 |
}
|
|
1390 |
|
|
1391 |
++delta;
|
|
1392 |
++n;
|
|
1393 |
}
|
|
1394 |
return output.join('');
|
|
1395 |
};
|
|
1396 |
|
|
1397 |
module.exports = function (input) {
|
|
1398 |
var encoded = [];
|
|
1399 |
var labels = input.toLowerCase().replace(regexSeparators, '\u002E').split('.');
|
|
1400 |
var i, label;
|
|
1401 |
for (i = 0; i < labels.length; i++) {
|
|
1402 |
label = labels[i];
|
|
1403 |
encoded.push(regexNonASCII.test(label) ? 'xn--' + encode(label) : label);
|
|
1404 |
}
|
|
1405 |
return encoded.join('.');
|
|
1406 |
};
|
|
1407 |
|
|
1408 |
},{}],68:[function(require,module,exports){
|
|
1409 |
var toInteger = require('../internals/to-integer');
|
|
1410 |
|
|
1411 |
var max = Math.max;
|
|
1412 |
var min = Math.min;
|
|
1413 |
|
|
1414 |
// Helper for a popular repeating case of the spec:
|
|
1415 |
// Let integer be ? ToInteger(index).
|
|
1416 |
// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
|
|
1417 |
module.exports = function (index, length) {
|
|
1418 |
var integer = toInteger(index);
|
|
1419 |
return integer < 0 ? max(integer + length, 0) : min(integer, length);
|
|
1420 |
};
|
|
1421 |
|
|
1422 |
},{"../internals/to-integer":70}],69:[function(require,module,exports){
|
|
1423 |
// toObject with fallback for non-array-like ES3 strings
|
|
1424 |
var IndexedObject = require('../internals/indexed-object');
|
|
1425 |
var requireObjectCoercible = require('../internals/require-object-coercible');
|
|
1426 |
|
|
1427 |
module.exports = function (it) {
|
|
1428 |
return IndexedObject(requireObjectCoercible(it));
|
|
1429 |
};
|
|
1430 |
|
|
1431 |
},{"../internals/indexed-object":32,"../internals/require-object-coercible":60}],70:[function(require,module,exports){
|
|
1432 |
var ceil = Math.ceil;
|
|
1433 |
var floor = Math.floor;
|
|
1434 |
|
|
1435 |
// `ToInteger` abstract operation
|
|
1436 |
// https://tc39.github.io/ecma262/#sec-tointeger
|
|
1437 |
module.exports = function (argument) {
|
|
1438 |
return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
|
|
1439 |
};
|
|
1440 |
|
|
1441 |
},{}],71:[function(require,module,exports){
|
|
1442 |
var toInteger = require('../internals/to-integer');
|
|
1443 |
|
|
1444 |
var min = Math.min;
|
|
1445 |
|
|
1446 |
// `ToLength` abstract operation
|
|
1447 |
// https://tc39.github.io/ecma262/#sec-tolength
|
|
1448 |
module.exports = function (argument) {
|
|
1449 |
return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
|
|
1450 |
};
|
|
1451 |
|
|
1452 |
},{"../internals/to-integer":70}],72:[function(require,module,exports){
|
|
1453 |
var requireObjectCoercible = require('../internals/require-object-coercible');
|
|
1454 |
|
|
1455 |
// `ToObject` abstract operation
|
|
1456 |
// https://tc39.github.io/ecma262/#sec-toobject
|
|
1457 |
module.exports = function (argument) {
|
|
1458 |
return Object(requireObjectCoercible(argument));
|
|
1459 |
};
|
|
1460 |
|
|
1461 |
},{"../internals/require-object-coercible":60}],73:[function(require,module,exports){
|
|
1462 |
var isObject = require('../internals/is-object');
|
|
1463 |
|
|
1464 |
// `ToPrimitive` abstract operation
|
|
1465 |
// https://tc39.github.io/ecma262/#sec-toprimitive
|
|
1466 |
// instead of the ES6 spec version, we didn't implement @@toPrimitive case
|
|
1467 |
// and the second argument - flag - preferred type is a string
|
|
1468 |
module.exports = function (input, PREFERRED_STRING) {
|
|
1469 |
if (!isObject(input)) return input;
|
|
1470 |
var fn, val;
|
|
1471 |
if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
|
|
1472 |
if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
|
|
1473 |
if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
|
|
1474 |
throw TypeError("Can't convert object to primitive value");
|
|
1475 |
};
|
|
1476 |
|
|
1477 |
},{"../internals/is-object":37}],74:[function(require,module,exports){
|
|
1478 |
var wellKnownSymbol = require('../internals/well-known-symbol');
|
|
1479 |
|
|
1480 |
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
|
|
1481 |
var test = {};
|
|
1482 |
|
|
1483 |
test[TO_STRING_TAG] = 'z';
|
|
1484 |
|
|
1485 |
module.exports = String(test) === '[object z]';
|
|
1486 |
|
|
1487 |
},{"../internals/well-known-symbol":77}],75:[function(require,module,exports){
|
|
1488 |
var id = 0;
|
|
1489 |
var postfix = Math.random();
|
|
1490 |
|
|
1491 |
module.exports = function (key) {
|
|
1492 |
return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
|
|
1493 |
};
|
|
1494 |
|
|
1495 |
},{}],76:[function(require,module,exports){
|
|
1496 |
var NATIVE_SYMBOL = require('../internals/native-symbol');
|
|
1497 |
|
|
1498 |
module.exports = NATIVE_SYMBOL
|
|
1499 |
// eslint-disable-next-line no-undef
|
|
1500 |
&& !Symbol.sham
|
|
1501 |
// eslint-disable-next-line no-undef
|
|
1502 |
&& typeof Symbol.iterator == 'symbol';
|
|
1503 |
|
|
1504 |
},{"../internals/native-symbol":41}],77:[function(require,module,exports){
|
|
1505 |
var global = require('../internals/global');
|
|
1506 |
var shared = require('../internals/shared');
|
|
1507 |
var has = require('../internals/has');
|
|
1508 |
var uid = require('../internals/uid');
|
|
1509 |
var NATIVE_SYMBOL = require('../internals/native-symbol');
|
|
1510 |
var USE_SYMBOL_AS_UID = require('../internals/use-symbol-as-uid');
|
|
1511 |
|
|
1512 |
var WellKnownSymbolsStore = shared('wks');
|
|
1513 |
var Symbol = global.Symbol;
|
|
1514 |
var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid;
|
|
1515 |
|
|
1516 |
module.exports = function (name) {
|
|
1517 |
if (!has(WellKnownSymbolsStore, name)) {
|
|
1518 |
if (NATIVE_SYMBOL && has(Symbol, name)) WellKnownSymbolsStore[name] = Symbol[name];
|
|
1519 |
else WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);
|
|
1520 |
} return WellKnownSymbolsStore[name];
|
|
1521 |
};
|
|
1522 |
|
|
1523 |
},{"../internals/global":27,"../internals/has":28,"../internals/native-symbol":41,"../internals/shared":65,"../internals/uid":75,"../internals/use-symbol-as-uid":76}],78:[function(require,module,exports){
|
|
1524 |
'use strict';
|
|
1525 |
var toIndexedObject = require('../internals/to-indexed-object');
|
|
1526 |
var addToUnscopables = require('../internals/add-to-unscopables');
|
|
1527 |
var Iterators = require('../internals/iterators');
|
|
1528 |
var InternalStateModule = require('../internals/internal-state');
|
|
1529 |
var defineIterator = require('../internals/define-iterator');
|
|
1530 |
|
|
1531 |
var ARRAY_ITERATOR = 'Array Iterator';
|
|
1532 |
var setInternalState = InternalStateModule.set;
|
|
1533 |
var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR);
|
|
1534 |
|
|
1535 |
// `Array.prototype.entries` method
|
|
1536 |
// https://tc39.github.io/ecma262/#sec-array.prototype.entries
|
|
1537 |
// `Array.prototype.keys` method
|
|
1538 |
// https://tc39.github.io/ecma262/#sec-array.prototype.keys
|
|
1539 |
// `Array.prototype.values` method
|
|
1540 |
// https://tc39.github.io/ecma262/#sec-array.prototype.values
|
|
1541 |
// `Array.prototype[@@iterator]` method
|
|
1542 |
// https://tc39.github.io/ecma262/#sec-array.prototype-@@iterator
|
|
1543 |
// `CreateArrayIterator` internal method
|
|
1544 |
// https://tc39.github.io/ecma262/#sec-createarrayiterator
|
|
1545 |
module.exports = defineIterator(Array, 'Array', function (iterated, kind) {
|
|
1546 |
setInternalState(this, {
|
|
1547 |
type: ARRAY_ITERATOR,
|
|
1548 |
target: toIndexedObject(iterated), // target
|
|
1549 |
index: 0, // next index
|
|
1550 |
kind: kind // kind
|
|
1551 |
});
|
|
1552 |
// `%ArrayIteratorPrototype%.next` method
|
|
1553 |
// https://tc39.github.io/ecma262/#sec-%arrayiteratorprototype%.next
|
|
1554 |
}, function () {
|
|
1555 |
var state = getInternalState(this);
|
|
1556 |
var target = state.target;
|
|
1557 |
var kind = state.kind;
|
|
1558 |
var index = state.index++;
|
|
1559 |
if (!target || index >= target.length) {
|
|
1560 |
state.target = undefined;
|
|
1561 |
return { value: undefined, done: true };
|
|
1562 |
}
|
|
1563 |
if (kind == 'keys') return { value: index, done: false };
|
|
1564 |
if (kind == 'values') return { value: target[index], done: false };
|
|
1565 |
return { value: [index, target[index]], done: false };
|
|
1566 |
}, 'values');
|
|
1567 |
|
|
1568 |
// argumentsList[@@iterator] is %ArrayProto_values%
|
|
1569 |
// https://tc39.github.io/ecma262/#sec-createunmappedargumentsobject
|
|
1570 |
// https://tc39.github.io/ecma262/#sec-createmappedargumentsobject
|
|
1571 |
Iterators.Arguments = Iterators.Array;
|
|
1572 |
|
|
1573 |
// https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
|
|
1574 |
addToUnscopables('keys');
|
|
1575 |
addToUnscopables('values');
|
|
1576 |
addToUnscopables('entries');
|
|
1577 |
|
|
1578 |
},{"../internals/add-to-unscopables":3,"../internals/define-iterator":17,"../internals/internal-state":34,"../internals/iterators":40,"../internals/to-indexed-object":69}],79:[function(require,module,exports){
|
|
1579 |
'use strict';
|
|
1580 |
var charAt = require('../internals/string-multibyte').charAt;
|
|
1581 |
var InternalStateModule = require('../internals/internal-state');
|
|
1582 |
var defineIterator = require('../internals/define-iterator');
|
|
1583 |
|
|
1584 |
var STRING_ITERATOR = 'String Iterator';
|
|
1585 |
var setInternalState = InternalStateModule.set;
|
|
1586 |
var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR);
|
|
1587 |
|
|
1588 |
// `String.prototype[@@iterator]` method
|
|
1589 |
// https://tc39.github.io/ecma262/#sec-string.prototype-@@iterator
|
|
1590 |
defineIterator(String, 'String', function (iterated) {
|
|
1591 |
setInternalState(this, {
|
|
1592 |
type: STRING_ITERATOR,
|
|
1593 |
string: String(iterated),
|
|
1594 |
index: 0
|
|
1595 |
});
|
|
1596 |
// `%StringIteratorPrototype%.next` method
|
|
1597 |
// https://tc39.github.io/ecma262/#sec-%stringiteratorprototype%.next
|
|
1598 |
}, function next() {
|
|
1599 |
var state = getInternalState(this);
|
|
1600 |
var string = state.string;
|
|
1601 |
var index = state.index;
|
|
1602 |
var point;
|
|
1603 |
if (index >= string.length) return { value: undefined, done: true };
|
|
1604 |
point = charAt(string, index);
|
|
1605 |
state.index += point.length;
|
|
1606 |
return { value: point, done: false };
|
|
1607 |
});
|
|
1608 |
|
|
1609 |
},{"../internals/define-iterator":17,"../internals/internal-state":34,"../internals/string-multibyte":66}],80:[function(require,module,exports){
|
|
1610 |
'use strict';
|
|
1611 |
// TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env`
|
|
1612 |
require('../modules/es.array.iterator');
|
|
1613 |
var $ = require('../internals/export');
|
|
1614 |
var getBuiltIn = require('../internals/get-built-in');
|
|
1615 |
var USE_NATIVE_URL = require('../internals/native-url');
|
|
1616 |
var redefine = require('../internals/redefine');
|
|
1617 |
var redefineAll = require('../internals/redefine-all');
|
|
1618 |
var setToStringTag = require('../internals/set-to-string-tag');
|
|
1619 |
var createIteratorConstructor = require('../internals/create-iterator-constructor');
|
|
1620 |
var InternalStateModule = require('../internals/internal-state');
|
|
1621 |
var anInstance = require('../internals/an-instance');
|
|
1622 |
var hasOwn = require('../internals/has');
|
|
1623 |
var bind = require('../internals/function-bind-context');
|
|
1624 |
var classof = require('../internals/classof');
|
|
1625 |
var anObject = require('../internals/an-object');
|
|
1626 |
var isObject = require('../internals/is-object');
|
|
1627 |
var create = require('../internals/object-create');
|
|
1628 |
var createPropertyDescriptor = require('../internals/create-property-descriptor');
|
|
1629 |
var getIterator = require('../internals/get-iterator');
|
|
1630 |
var getIteratorMethod = require('../internals/get-iterator-method');
|
|
1631 |
var wellKnownSymbol = require('../internals/well-known-symbol');
|
|
1632 |
|
|
1633 |
var $fetch = getBuiltIn('fetch');
|
|
1634 |
var Headers = getBuiltIn('Headers');
|
|
1635 |
var ITERATOR = wellKnownSymbol('iterator');
|
|
1636 |
var URL_SEARCH_PARAMS = 'URLSearchParams';
|
|
1637 |
var URL_SEARCH_PARAMS_ITERATOR = URL_SEARCH_PARAMS + 'Iterator';
|
|
1638 |
var setInternalState = InternalStateModule.set;
|
|
1639 |
var getInternalParamsState = InternalStateModule.getterFor(URL_SEARCH_PARAMS);
|
|
1640 |
var getInternalIteratorState = InternalStateModule.getterFor(URL_SEARCH_PARAMS_ITERATOR);
|
|
1641 |
|
|
1642 |
var plus = /\+/g;
|
|
1643 |
var sequences = Array(4);
|
|
1644 |
|
|
1645 |
var percentSequence = function (bytes) {
|
|
1646 |
return sequences[bytes - 1] || (sequences[bytes - 1] = RegExp('((?:%[\\da-f]{2}){' + bytes + '})', 'gi'));
|
|
1647 |
};
|
|
1648 |
|
|
1649 |
var percentDecode = function (sequence) {
|
|
1650 |
try {
|
|
1651 |
return decodeURIComponent(sequence);
|
|
1652 |
} catch (error) {
|
|
1653 |
return sequence;
|
|
1654 |
}
|
|
1655 |
};
|
|
1656 |
|
|
1657 |
var deserialize = function (it) {
|
|
1658 |
var result = it.replace(plus, ' ');
|
|
1659 |
var bytes = 4;
|
|
1660 |
try {
|
|
1661 |
return decodeURIComponent(result);
|
|
1662 |
} catch (error) {
|
|
1663 |
while (bytes) {
|
|
1664 |
result = result.replace(percentSequence(bytes--), percentDecode);
|
|
1665 |
}
|
|
1666 |
return result;
|
|
1667 |
}
|
|
1668 |
};
|
|
1669 |
|
|
1670 |
var find = /[!'()~]|%20/g;
|
|
1671 |
|
|
1672 |
var replace = {
|
|
1673 |
'!': '%21',
|
|
1674 |
"'": '%27',
|
|
1675 |
'(': '%28',
|
|
1676 |
')': '%29',
|
|
1677 |
'~': '%7E',
|
|
1678 |
'%20': '+'
|
|
1679 |
};
|
|
1680 |
|
|
1681 |
var replacer = function (match) {
|
|
1682 |
return replace[match];
|
|
1683 |
};
|
|
1684 |
|
|
1685 |
var serialize = function (it) {
|
|
1686 |
return encodeURIComponent(it).replace(find, replacer);
|
|
1687 |
};
|
|
1688 |
|
|
1689 |
var parseSearchParams = function (result, query) {
|
|
1690 |
if (query) {
|
|
1691 |
var attributes = query.split('&');
|
|
1692 |
var index = 0;
|
|
1693 |
var attribute, entry;
|
|
1694 |
while (index < attributes.length) {
|
|
1695 |
attribute = attributes[index++];
|
|
1696 |
if (attribute.length) {
|
|
1697 |
entry = attribute.split('=');
|
|
1698 |
result.push({
|
|
1699 |
key: deserialize(entry.shift()),
|
|
1700 |
value: deserialize(entry.join('='))
|
|
1701 |
});
|
|
1702 |
}
|
|
1703 |
}
|
|
1704 |
}
|
|
1705 |
};
|
|
1706 |
|
|
1707 |
var updateSearchParams = function (query) {
|
|
1708 |
this.entries.length = 0;
|
|
1709 |
parseSearchParams(this.entries, query);
|
|
1710 |
};
|
|
1711 |
|
|
1712 |
var validateArgumentsLength = function (passed, required) {
|
|
1713 |
if (passed < required) throw TypeError('Not enough arguments');
|
|
1714 |
};
|
|
1715 |
|
|
1716 |
var URLSearchParamsIterator = createIteratorConstructor(function Iterator(params, kind) {
|
|
1717 |
setInternalState(this, {
|
|
1718 |
type: URL_SEARCH_PARAMS_ITERATOR,
|
|
1719 |
iterator: getIterator(getInternalParamsState(params).entries),
|
|
1720 |
kind: kind
|
|
1721 |
});
|
|
1722 |
}, 'Iterator', function next() {
|
|
1723 |
var state = getInternalIteratorState(this);
|
|
1724 |
var kind = state.kind;
|
|
1725 |
var step = state.iterator.next();
|
|
1726 |
var entry = step.value;
|
|
1727 |
if (!step.done) {
|
|
1728 |
step.value = kind === 'keys' ? entry.key : kind === 'values' ? entry.value : [entry.key, entry.value];
|
|
1729 |
} return step;
|
|
1730 |
});
|
|
1731 |
|
|
1732 |
// `URLSearchParams` constructor
|
|
1733 |
// https://url.spec.whatwg.org/#interface-urlsearchparams
|
|
1734 |
var URLSearchParamsConstructor = function URLSearchParams(/* init */) {
|
|
1735 |
anInstance(this, URLSearchParamsConstructor, URL_SEARCH_PARAMS);
|
|
1736 |
var init = arguments.length > 0 ? arguments[0] : undefined;
|
|
1737 |
var that = this;
|
|
1738 |
var entries = [];
|
|
1739 |
var iteratorMethod, iterator, next, step, entryIterator, entryNext, first, second, key;
|
|
1740 |
|
|
1741 |
setInternalState(that, {
|
|
1742 |
type: URL_SEARCH_PARAMS,
|
|
1743 |
entries: entries,
|
|
1744 |
updateURL: function () { /* empty */ },
|
|
1745 |
updateSearchParams: updateSearchParams
|
|
1746 |
});
|
|
1747 |
|
|
1748 |
if (init !== undefined) {
|
|
1749 |
if (isObject(init)) {
|
|
1750 |
iteratorMethod = getIteratorMethod(init);
|
|
1751 |
if (typeof iteratorMethod === 'function') {
|
|
1752 |
iterator = iteratorMethod.call(init);
|
|
1753 |
next = iterator.next;
|
|
1754 |
while (!(step = next.call(iterator)).done) {
|
|
1755 |
entryIterator = getIterator(anObject(step.value));
|
|
1756 |
entryNext = entryIterator.next;
|
|
1757 |
if (
|
|
1758 |
(first = entryNext.call(entryIterator)).done ||
|
|
1759 |
(second = entryNext.call(entryIterator)).done ||
|
|
1760 |
!entryNext.call(entryIterator).done
|
|
1761 |
) throw TypeError('Expected sequence with length 2');
|
|
1762 |
entries.push({ key: first.value + '', value: second.value + '' });
|
|
1763 |
}
|
|
1764 |
} else for (key in init) if (hasOwn(init, key)) entries.push({ key: key, value: init[key] + '' });
|
|
1765 |
} else {
|
|
1766 |
parseSearchParams(entries, typeof init === 'string' ? init.charAt(0) === '?' ? init.slice(1) : init : init + '');
|
|
1767 |
}
|
|
1768 |
}
|
|
1769 |
};
|
|
1770 |
|
|
1771 |
var URLSearchParamsPrototype = URLSearchParamsConstructor.prototype;
|
|
1772 |
|
|
1773 |
redefineAll(URLSearchParamsPrototype, {
|
|
1774 |
// `URLSearchParams.prototype.appent` method
|
|
1775 |
// https://url.spec.whatwg.org/#dom-urlsearchparams-append
|
|
1776 |
append: function append(name, value) {
|
|
1777 |
validateArgumentsLength(arguments.length, 2);
|
|
1778 |
var state = getInternalParamsState(this);
|
|
1779 |
state.entries.push({ key: name + '', value: value + '' });
|
|
1780 |
state.updateURL();
|
|
1781 |
},
|
|
1782 |
// `URLSearchParams.prototype.delete` method
|
|
1783 |
// https://url.spec.whatwg.org/#dom-urlsearchparams-delete
|
|
1784 |
'delete': function (name) {
|
|
1785 |
validateArgumentsLength(arguments.length, 1);
|
|
1786 |
var state = getInternalParamsState(this);
|
|
1787 |
var entries = state.entries;
|
|
1788 |
var key = name + '';
|
|
1789 |
var index = 0;
|
|
1790 |
while (index < entries.length) {
|
|
1791 |
if (entries[index].key === key) entries.splice(index, 1);
|
|
1792 |
else index++;
|
|
1793 |
}
|
|
1794 |
state.updateURL();
|
|
1795 |
},
|
|
1796 |
// `URLSearchParams.prototype.get` method
|
|
1797 |
// https://url.spec.whatwg.org/#dom-urlsearchparams-get
|
|
1798 |
get: function get(name) {
|
|
1799 |
validateArgumentsLength(arguments.length, 1);
|
|
1800 |
var entries = getInternalParamsState(this).entries;
|
|
1801 |
var key = name + '';
|
|
1802 |
var index = 0;
|
|
1803 |
for (; index < entries.length; index++) {
|
|
1804 |
if (entries[index].key === key) return entries[index].value;
|
|
1805 |
}
|
|
1806 |
return null;
|
|
1807 |
},
|
|
1808 |
// `URLSearchParams.prototype.getAll` method
|
|
1809 |
// https://url.spec.whatwg.org/#dom-urlsearchparams-getall
|
|
1810 |
getAll: function getAll(name) {
|
|
1811 |
validateArgumentsLength(arguments.length, 1);
|
|
1812 |
var entries = getInternalParamsState(this).entries;
|
|
1813 |
var key = name + '';
|
|
1814 |
var result = [];
|
|
1815 |
var index = 0;
|
|
1816 |
for (; index < entries.length; index++) {
|
|
1817 |
if (entries[index].key === key) result.push(entries[index].value);
|
|
1818 |
}
|
|
1819 |
return result;
|
|
1820 |
},
|
|
1821 |
// `URLSearchParams.prototype.has` method
|
|
1822 |
// https://url.spec.whatwg.org/#dom-urlsearchparams-has
|
|
1823 |
has: function has(name) {
|
|
1824 |
validateArgumentsLength(arguments.length, 1);
|
|
1825 |
var entries = getInternalParamsState(this).entries;
|
|
1826 |
var key = name + '';
|
|
1827 |
var index = 0;
|
|
1828 |
while (index < entries.length) {
|
|
1829 |
if (entries[index++].key === key) return true;
|
|
1830 |
}
|
|
1831 |
return false;
|
|
1832 |
},
|
|
1833 |
// `URLSearchParams.prototype.set` method
|
|
1834 |
// https://url.spec.whatwg.org/#dom-urlsearchparams-set
|
|
1835 |
set: function set(name, value) {
|
|
1836 |
validateArgumentsLength(arguments.length, 1);
|
|
1837 |
var state = getInternalParamsState(this);
|
|
1838 |
var entries = state.entries;
|
|
1839 |
var found = false;
|
|
1840 |
var key = name + '';
|
|
1841 |
var val = value + '';
|
|
1842 |
var index = 0;
|
|
1843 |
var entry;
|
|
1844 |
for (; index < entries.length; index++) {
|
|
1845 |
entry = entries[index];
|
|
1846 |
if (entry.key === key) {
|
|
1847 |
if (found) entries.splice(index--, 1);
|
|
1848 |
else {
|
|
1849 |
found = true;
|
|
1850 |
entry.value = val;
|
|
1851 |
}
|
|
1852 |
}
|
|
1853 |
}
|
|
1854 |
if (!found) entries.push({ key: key, value: val });
|
|
1855 |
state.updateURL();
|
|
1856 |
},
|
|
1857 |
// `URLSearchParams.prototype.sort` method
|
|
1858 |
// https://url.spec.whatwg.org/#dom-urlsearchparams-sort
|
|
1859 |
sort: function sort() {
|
|
1860 |
var state = getInternalParamsState(this);
|
|
1861 |
var entries = state.entries;
|
|
1862 |
// Array#sort is not stable in some engines
|
|
1863 |
var slice = entries.slice();
|
|
1864 |
var entry, entriesIndex, sliceIndex;
|
|
1865 |
entries.length = 0;
|
|
1866 |
for (sliceIndex = 0; sliceIndex < slice.length; sliceIndex++) {
|
|
1867 |
entry = slice[sliceIndex];
|
|
1868 |
for (entriesIndex = 0; entriesIndex < sliceIndex; entriesIndex++) {
|
|
1869 |
if (entries[entriesIndex].key > entry.key) {
|
|
1870 |
entries.splice(entriesIndex, 0, entry);
|
|
1871 |
break;
|
|
1872 |
}
|
|
1873 |
}
|
|
1874 |
if (entriesIndex === sliceIndex) entries.push(entry);
|
|
1875 |
}
|
|
1876 |
state.updateURL();
|
|
1877 |
},
|
|
1878 |
// `URLSearchParams.prototype.forEach` method
|
|
1879 |
forEach: function forEach(callback /* , thisArg */) {
|
|
1880 |
var entries = getInternalParamsState(this).entries;
|
|
1881 |
var boundFunction = bind(callback, arguments.length > 1 ? arguments[1] : undefined, 3);
|
|
1882 |
var index = 0;
|
|
1883 |
var entry;
|
|
1884 |
while (index < entries.length) {
|
|
1885 |
entry = entries[index++];
|
|
1886 |
boundFunction(entry.value, entry.key, this);
|
|
1887 |
}
|
|
1888 |
},
|
|
1889 |
// `URLSearchParams.prototype.keys` method
|
|
1890 |
keys: function keys() {
|
|
1891 |
return new URLSearchParamsIterator(this, 'keys');
|
|
1892 |
},
|
|
1893 |
// `URLSearchParams.prototype.values` method
|
|
1894 |
values: function values() {
|
|
1895 |
return new URLSearchParamsIterator(this, 'values');
|
|
1896 |
},
|
|
1897 |
// `URLSearchParams.prototype.entries` method
|
|
1898 |
entries: function entries() {
|
|
1899 |
return new URLSearchParamsIterator(this, 'entries');
|
|
1900 |
}
|
|
1901 |
}, { enumerable: true });
|
|
1902 |
|
|
1903 |
// `URLSearchParams.prototype[@@iterator]` method
|
|
1904 |
redefine(URLSearchParamsPrototype, ITERATOR, URLSearchParamsPrototype.entries);
|
|
1905 |
|
|
1906 |
// `URLSearchParams.prototype.toString` method
|
|
1907 |
// https://url.spec.whatwg.org/#urlsearchparams-stringification-behavior
|
|
1908 |
redefine(URLSearchParamsPrototype, 'toString', function toString() {
|
|
1909 |
var entries = getInternalParamsState(this).entries;
|
|
1910 |
var result = [];
|
|
1911 |
var index = 0;
|
|
1912 |
var entry;
|
|
1913 |
while (index < entries.length) {
|
|
1914 |
entry = entries[index++];
|
|
1915 |
result.push(serialize(entry.key) + '=' + serialize(entry.value));
|
|
1916 |
} return result.join('&');
|
|
1917 |
}, { enumerable: true });
|
|
1918 |
|
|
1919 |
setToStringTag(URLSearchParamsConstructor, URL_SEARCH_PARAMS);
|
|
1920 |
|
|
1921 |
$({ global: true, forced: !USE_NATIVE_URL }, {
|
|
1922 |
URLSearchParams: URLSearchParamsConstructor
|
|
1923 |
});
|
|
1924 |
|
|
1925 |
// Wrap `fetch` for correct work with polyfilled `URLSearchParams`
|
|
1926 |
// https://github.com/zloirock/core-js/issues/674
|
|
1927 |
if (!USE_NATIVE_URL && typeof $fetch == 'function' && typeof Headers == 'function') {
|
|
1928 |
$({ global: true, enumerable: true, forced: true }, {
|
|
1929 |
fetch: function fetch(input /* , init */) {
|
|
1930 |
var args = [input];
|
|
1931 |
var init, body, headers;
|
|
1932 |
if (arguments.length > 1) {
|
|
1933 |
init = arguments[1];
|
|
1934 |
if (isObject(init)) {
|
|
1935 |
body = init.body;
|
|
1936 |
if (classof(body) === URL_SEARCH_PARAMS) {
|
|
1937 |
headers = init.headers ? new Headers(init.headers) : new Headers();
|
|
1938 |
if (!headers.has('content-type')) {
|
|
1939 |
headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');
|
|
1940 |
}
|
|
1941 |
init = create(init, {
|
|
1942 |
body: createPropertyDescriptor(0, String(body)),
|
|
1943 |
headers: createPropertyDescriptor(0, headers)
|
|
1944 |
});
|
|
1945 |
}
|
|
1946 |
}
|
|
1947 |
args.push(init);
|
|
1948 |
} return $fetch.apply(this, args);
|
|
1949 |
}
|
|
1950 |
});
|
|
1951 |
}
|
|
1952 |
|
|
1953 |
module.exports = {
|
|
1954 |
URLSearchParams: URLSearchParamsConstructor,
|
|
1955 |
getState: getInternalParamsState
|
|
1956 |
};
|
|
1957 |
|
|
1958 |
},{"../internals/an-instance":4,"../internals/an-object":5,"../internals/classof":10,"../internals/create-iterator-constructor":13,"../internals/create-property-descriptor":15,"../internals/export":21,"../internals/function-bind-context":23,"../internals/get-built-in":24,"../internals/get-iterator":26,"../internals/get-iterator-method":25,"../internals/has":28,"../internals/internal-state":34,"../internals/is-object":37,"../internals/native-url":42,"../internals/object-create":45,"../internals/redefine":59,"../internals/redefine-all":58,"../internals/set-to-string-tag":62,"../internals/well-known-symbol":77,"../modules/es.array.iterator":78}],81:[function(require,module,exports){
|
|
1959 |
'use strict';
|
|
1960 |
// TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env`
|
|
1961 |
require('../modules/es.string.iterator');
|
|
1962 |
var $ = require('../internals/export');
|
|
1963 |
var DESCRIPTORS = require('../internals/descriptors');
|
|
1964 |
var USE_NATIVE_URL = require('../internals/native-url');
|
|
1965 |
var global = require('../internals/global');
|
|
1966 |
var defineProperties = require('../internals/object-define-properties');
|
|
1967 |
var redefine = require('../internals/redefine');
|
|
1968 |
var anInstance = require('../internals/an-instance');
|
|
1969 |
var has = require('../internals/has');
|
|
1970 |
var assign = require('../internals/object-assign');
|
|
1971 |
var arrayFrom = require('../internals/array-from');
|
|
1972 |
var codeAt = require('../internals/string-multibyte').codeAt;
|
|
1973 |
var toASCII = require('../internals/string-punycode-to-ascii');
|
|
1974 |
var setToStringTag = require('../internals/set-to-string-tag');
|
|
1975 |
var URLSearchParamsModule = require('../modules/web.url-search-params');
|
|
1976 |
var InternalStateModule = require('../internals/internal-state');
|
|
1977 |
|
|
1978 |
var NativeURL = global.URL;
|
|
1979 |
var URLSearchParams = URLSearchParamsModule.URLSearchParams;
|
|
1980 |
var getInternalSearchParamsState = URLSearchParamsModule.getState;
|
|
1981 |
var setInternalState = InternalStateModule.set;
|
|
1982 |
var getInternalURLState = InternalStateModule.getterFor('URL');
|
|
1983 |
var floor = Math.floor;
|
|
1984 |
var pow = Math.pow;
|
|
1985 |
|
|
1986 |
var INVALID_AUTHORITY = 'Invalid authority';
|
|
1987 |
var INVALID_SCHEME = 'Invalid scheme';
|
|
1988 |
var INVALID_HOST = 'Invalid host';
|
|
1989 |
var INVALID_PORT = 'Invalid port';
|
|
1990 |
|
|
1991 |
var ALPHA = /[A-Za-z]/;
|
|
1992 |
var ALPHANUMERIC = /[\d+\-.A-Za-z]/;
|
|
1993 |
var DIGIT = /\d/;
|
|
1994 |
var HEX_START = /^(0x|0X)/;
|
|
1995 |
var OCT = /^[0-7]+$/;
|
|
1996 |
var DEC = /^\d+$/;
|
|
1997 |
var HEX = /^[\dA-Fa-f]+$/;
|
|
1998 |
// eslint-disable-next-line no-control-regex
|
|
1999 |
var FORBIDDEN_HOST_CODE_POINT = /[\u0000\u0009\u000A\u000D #%/:?@[\\]]/;
|
|
2000 |
// eslint-disable-next-line no-control-regex
|
|
2001 |
var FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT = /[\u0000\u0009\u000A\u000D #/:?@[\\]]/;
|
|
2002 |
// eslint-disable-next-line no-control-regex
|
|
2003 |
var LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE = /^[\u0000-\u001F ]+|[\u0000-\u001F ]+$/g;
|
|
2004 |
// eslint-disable-next-line no-control-regex
|
|
2005 |
var TAB_AND_NEW_LINE = /[\u0009\u000A\u000D]/g;
|
|
2006 |
var EOF;
|
|
2007 |
|
|
2008 |
var parseHost = function (url, input) {
|
|
2009 |
var result, codePoints, index;
|
|
2010 |
if (input.charAt(0) == '[') {
|
|
2011 |
if (input.charAt(input.length - 1) != ']') return INVALID_HOST;
|
|
2012 |
result = parseIPv6(input.slice(1, -1));
|
|
2013 |
if (!result) return INVALID_HOST;
|
|
2014 |
url.host = result;
|
|
2015 |
// opaque host
|
|
2016 |
} else if (!isSpecial(url)) {
|
|
2017 |
if (FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT.test(input)) return INVALID_HOST;
|
|
2018 |
result = '';
|
|
2019 |
codePoints = arrayFrom(input);
|
|
2020 |
for (index = 0; index < codePoints.length; index++) {
|
|
2021 |
result += percentEncode(codePoints[index], C0ControlPercentEncodeSet);
|
|
2022 |
}
|
|
2023 |
url.host = result;
|
|
2024 |
} else {
|
|
2025 |
input = toASCII(input);
|
|
2026 |
if (FORBIDDEN_HOST_CODE_POINT.test(input)) return INVALID_HOST;
|
|
2027 |
result = parseIPv4(input);
|
|
2028 |
if (result === null) return INVALID_HOST;
|
|
2029 |
url.host = result;
|
|
2030 |
}
|
|
2031 |
};
|
|
2032 |
|
|
2033 |
var parseIPv4 = function (input) {
|
|
2034 |
var parts = input.split('.');
|
|
2035 |
var partsLength, numbers, index, part, radix, number, ipv4;
|
|
2036 |
if (parts.length && parts[parts.length - 1] == '') {
|
|
2037 |
parts.pop();
|
|
2038 |
}
|
|
2039 |
partsLength = parts.length;
|
|
2040 |
if (partsLength > 4) return input;
|
|
2041 |
numbers = [];
|
|
2042 |
for (index = 0; index < partsLength; index++) {
|
|
2043 |
part = parts[index];
|
|
2044 |
if (part == '') return input;
|
|
2045 |
radix = 10;
|
|
2046 |
if (part.length > 1 && part.charAt(0) == '0') {
|
|
2047 |
radix = HEX_START.test(part) ? 16 : 8;
|
|
2048 |
part = part.slice(radix == 8 ? 1 : 2);
|
|
2049 |
}
|
|
2050 |
if (part === '') {
|
|
2051 |
number = 0;
|
|
2052 |
} else {
|
|
2053 |
if (!(radix == 10 ? DEC : radix == 8 ? OCT : HEX).test(part)) return input;
|
|
2054 |
number = parseInt(part, radix);
|
|
2055 |
}
|
|
2056 |
numbers.push(number);
|
|
2057 |
}
|
|
2058 |
for (index = 0; index < partsLength; index++) {
|
|
2059 |
number = numbers[index];
|
|
2060 |
if (index == partsLength - 1) {
|
|
2061 |
if (number >= pow(256, 5 - partsLength)) return null;
|
|
2062 |
} else if (number > 255) return null;
|
|
2063 |
}
|
|
2064 |
ipv4 = numbers.pop();
|
|
2065 |
for (index = 0; index < numbers.length; index++) {
|
|
2066 |
ipv4 += numbers[index] * pow(256, 3 - index);
|
|
2067 |
}
|
|
2068 |
return ipv4;
|
|
2069 |
};
|
|
2070 |
|
|
2071 |
// eslint-disable-next-line max-statements
|
|
2072 |
var parseIPv6 = function (input) {
|
|
2073 |
var address = [0, 0, 0, 0, 0, 0, 0, 0];
|
|
2074 |
var pieceIndex = 0;
|
|
2075 |
var compress = null;
|
|
2076 |
var pointer = 0;
|
|
2077 |
var value, length, numbersSeen, ipv4Piece, number, swaps, swap;
|
|
2078 |
|
|
2079 |
var char = function () {
|
|
2080 |
return input.charAt(pointer);
|
|
2081 |
};
|
|
2082 |
|
|
2083 |
if (char() == ':') {
|
|
2084 |
if (input.charAt(1) != ':') return;
|
|
2085 |
pointer += 2;
|
|
2086 |
pieceIndex++;
|
|
2087 |
compress = pieceIndex;
|
|
2088 |
}
|
|
2089 |
while (char()) {
|
|
2090 |
if (pieceIndex == 8) return;
|
|
2091 |
if (char() == ':') {
|
|
2092 |
if (compress !== null) return;
|
|
2093 |
pointer++;
|
|
2094 |
pieceIndex++;
|
|
2095 |
compress = pieceIndex;
|
|
2096 |
continue;
|
|
2097 |
}
|
|
2098 |
value = length = 0;
|
|
2099 |
while (length < 4 && HEX.test(char())) {
|
|
2100 |
value = value * 16 + parseInt(char(), 16);
|
|
2101 |
pointer++;
|
|
2102 |
length++;
|
|
2103 |
}
|
|
2104 |
if (char() == '.') {
|
|
2105 |
if (length == 0) return;
|
|
2106 |
pointer -= length;
|
|
2107 |
if (pieceIndex > 6) return;
|
|
2108 |
numbersSeen = 0;
|
|
2109 |
while (char()) {
|
|
2110 |
ipv4Piece = null;
|
|
2111 |
if (numbersSeen > 0) {
|
|
2112 |
if (char() == '.' && numbersSeen < 4) pointer++;
|
|
2113 |
else return;
|
|
2114 |
}
|
|
2115 |
if (!DIGIT.test(char())) return;
|
|
2116 |
while (DIGIT.test(char())) {
|
|
2117 |
number = parseInt(char(), 10);
|
|
2118 |
if (ipv4Piece === null) ipv4Piece = number;
|
|
2119 |
else if (ipv4Piece == 0) return;
|
|
2120 |
else ipv4Piece = ipv4Piece * 10 + number;
|
|
2121 |
if (ipv4Piece > 255) return;
|
|
2122 |
pointer++;
|
|
2123 |
}
|
|
2124 |
address[pieceIndex] = address[pieceIndex] * 256 + ipv4Piece;
|
|
2125 |
numbersSeen++;
|
|
2126 |
if (numbersSeen == 2 || numbersSeen == 4) pieceIndex++;
|
|
2127 |
}
|
|
2128 |
if (numbersSeen != 4) return;
|
|
2129 |
break;
|
|
2130 |
} else if (char() == ':') {
|
|
2131 |
pointer++;
|
|
2132 |
if (!char()) return;
|
|
2133 |
} else if (char()) return;
|
|
2134 |
address[pieceIndex++] = value;
|
|
2135 |
}
|
|
2136 |
if (compress !== null) {
|
|
2137 |
swaps = pieceIndex - compress;
|
|
2138 |
pieceIndex = 7;
|
|
2139 |
while (pieceIndex != 0 && swaps > 0) {
|
|
2140 |
swap = address[pieceIndex];
|
|
2141 |
address[pieceIndex--] = address[compress + swaps - 1];
|
|
2142 |
address[compress + --swaps] = swap;
|
|
2143 |
}
|
|
2144 |
} else if (pieceIndex != 8) return;
|
|
2145 |
return address;
|
|
2146 |
};
|
|
2147 |
|
|
2148 |
var findLongestZeroSequence = function (ipv6) {
|
|
2149 |
var maxIndex = null;
|
|
2150 |
var maxLength = 1;
|
|
2151 |
var currStart = null;
|
|
2152 |
var currLength = 0;
|
|
2153 |
var index = 0;
|
|
2154 |
for (; index < 8; index++) {
|
|
2155 |
if (ipv6[index] !== 0) {
|
|
2156 |
if (currLength > maxLength) {
|
|
2157 |
maxIndex = currStart;
|
|
2158 |
maxLength = currLength;
|
|
2159 |
}
|
|
2160 |
currStart = null;
|
|
2161 |
currLength = 0;
|
|
2162 |
} else {
|
|
2163 |
if (currStart === null) currStart = index;
|
|
2164 |
++currLength;
|
|
2165 |
}
|
|
2166 |
}
|
|
2167 |
if (currLength > maxLength) {
|
|
2168 |
maxIndex = currStart;
|
|
2169 |
maxLength = currLength;
|
|
2170 |
}
|
|
2171 |
return maxIndex;
|
|
2172 |
};
|
|
2173 |
|
|
2174 |
var serializeHost = function (host) {
|
|
2175 |
var result, index, compress, ignore0;
|
|
2176 |
// ipv4
|
|
2177 |
if (typeof host == 'number') {
|
|
2178 |
result = [];
|
|
2179 |
for (index = 0; index < 4; index++) {
|
|
2180 |
result.unshift(host % 256);
|
|
2181 |
host = floor(host / 256);
|
|
2182 |
} return result.join('.');
|
|
2183 |
// ipv6
|
|
2184 |
} else if (typeof host == 'object') {
|
|
2185 |
result = '';
|
|
2186 |
compress = findLongestZeroSequence(host);
|
|
2187 |
for (index = 0; index < 8; index++) {
|
|
2188 |
if (ignore0 && host[index] === 0) continue;
|
|
2189 |
if (ignore0) ignore0 = false;
|
|
2190 |
if (compress === index) {
|
|
2191 |
result += index ? ':' : '::';
|
|
2192 |
ignore0 = true;
|
|
2193 |
} else {
|
|
2194 |
result += host[index].toString(16);
|
|
2195 |
if (index < 7) result += ':';
|
|
2196 |
}
|
|
2197 |
}
|
|
2198 |
return '[' + result + ']';
|
|
2199 |
} return host;
|
|
2200 |
};
|
|
2201 |
|
|
2202 |
var C0ControlPercentEncodeSet = {};
|
|
2203 |
var fragmentPercentEncodeSet = assign({}, C0ControlPercentEncodeSet, {
|
|
2204 |
' ': 1, '"': 1, '<': 1, '>': 1, '`': 1
|
|
2205 |
});
|
|
2206 |
var pathPercentEncodeSet = assign({}, fragmentPercentEncodeSet, {
|
|
2207 |
'#': 1, '?': 1, '{': 1, '}': 1
|
|
2208 |
});
|
|
2209 |
var userinfoPercentEncodeSet = assign({}, pathPercentEncodeSet, {
|
|
2210 |
'/': 1, ':': 1, ';': 1, '=': 1, '@': 1, '[': 1, '\\': 1, ']': 1, '^': 1, '|': 1
|
|
2211 |
});
|
|
2212 |
|
|
2213 |
var percentEncode = function (char, set) {
|
|
2214 |
var code = codeAt(char, 0);
|
|
2215 |
return code > 0x20 && code < 0x7F && !has(set, char) ? char : encodeURIComponent(char);
|
|
2216 |
};
|
|
2217 |
|
|
2218 |
var specialSchemes = {
|
|
2219 |
ftp: 21,
|
|
2220 |
file: null,
|
|
2221 |
http: 80,
|
|
2222 |
https: 443,
|
|
2223 |
ws: 80,
|
|
2224 |
wss: 443
|
|
2225 |
};
|
|
2226 |
|
|
2227 |
var isSpecial = function (url) {
|
|
2228 |
return has(specialSchemes, url.scheme);
|
|
2229 |
};
|
|
2230 |
|
|
2231 |
var includesCredentials = function (url) {
|
|
2232 |
return url.username != '' || url.password != '';
|
|
2233 |
};
|
|
2234 |
|
|
2235 |
var cannotHaveUsernamePasswordPort = function (url) {
|
|
2236 |
return !url.host || url.cannotBeABaseURL || url.scheme == 'file';
|
|
2237 |
};
|
|
2238 |
|
|
2239 |
var isWindowsDriveLetter = function (string, normalized) {
|
|
2240 |
var second;
|
|
2241 |
return string.length == 2 && ALPHA.test(string.charAt(0))
|
|
2242 |
&& ((second = string.charAt(1)) == ':' || (!normalized && second == '|'));
|
|
2243 |
};
|
|
2244 |
|
|
2245 |
var startsWithWindowsDriveLetter = function (string) {
|
|
2246 |
var third;
|
|
2247 |
return string.length > 1 && isWindowsDriveLetter(string.slice(0, 2)) && (
|
|
2248 |
string.length == 2 ||
|
|
2249 |
((third = string.charAt(2)) === '/' || third === '\\' || third === '?' || third === '#')
|
|
2250 |
);
|
|
2251 |
};
|
|
2252 |
|
|
2253 |
var shortenURLsPath = function (url) {
|
|
2254 |
var path = url.path;
|
|
2255 |
var pathSize = path.length;
|
|
2256 |
if (pathSize && (url.scheme != 'file' || pathSize != 1 || !isWindowsDriveLetter(path[0], true))) {
|
|
2257 |
path.pop();
|
|
2258 |
}
|
|
2259 |
};
|
|
2260 |
|
|
2261 |
var isSingleDot = function (segment) {
|
|
2262 |
return segment === '.' || segment.toLowerCase() === '%2e';
|
|
2263 |
};
|
|
2264 |
|
|
2265 |
var isDoubleDot = function (segment) {
|
|
2266 |
segment = segment.toLowerCase();
|
|
2267 |
return segment === '..' || segment === '%2e.' || segment === '.%2e' || segment === '%2e%2e';
|
|
2268 |
};
|
|
2269 |
|
|
2270 |
// States:
|
|
2271 |
var SCHEME_START = {};
|
|
2272 |
var SCHEME = {};
|
|
2273 |
var NO_SCHEME = {};
|
|
2274 |
var SPECIAL_RELATIVE_OR_AUTHORITY = {};
|
|
2275 |
var PATH_OR_AUTHORITY = {};
|
|
2276 |
var RELATIVE = {};
|
|
2277 |
var RELATIVE_SLASH = {};
|
|
2278 |
var SPECIAL_AUTHORITY_SLASHES = {};
|
|
2279 |
var SPECIAL_AUTHORITY_IGNORE_SLASHES = {};
|
|
2280 |
var AUTHORITY = {};
|
|
2281 |
var HOST = {};
|
|
2282 |
var HOSTNAME = {};
|
|
2283 |
var PORT = {};
|
|
2284 |
var FILE = {};
|
|
2285 |
var FILE_SLASH = {};
|
|
2286 |
var FILE_HOST = {};
|
|
2287 |
var PATH_START = {};
|
|
2288 |
var PATH = {};
|
|
2289 |
var CANNOT_BE_A_BASE_URL_PATH = {};
|
|
2290 |
var QUERY = {};
|
|
2291 |
var FRAGMENT = {};
|
|
2292 |
|
|
2293 |
// eslint-disable-next-line max-statements
|
|
2294 |
var parseURL = function (url, input, stateOverride, base) {
|
|
2295 |
var state = stateOverride || SCHEME_START;
|
|
2296 |
var pointer = 0;
|
|
2297 |
var buffer = '';
|
|
2298 |
var seenAt = false;
|
|
2299 |
var seenBracket = false;
|
|
2300 |
var seenPasswordToken = false;
|
|
2301 |
var codePoints, char, bufferCodePoints, failure;
|
|
2302 |
|
|
2303 |
if (!stateOverride) {
|
|
2304 |
url.scheme = '';
|
|
2305 |
url.username = '';
|
|
2306 |
url.password = '';
|
|
2307 |
url.host = null;
|
|
2308 |
url.port = null;
|
|
2309 |
url.path = [];
|
|
2310 |
url.query = null;
|
|
2311 |
url.fragment = null;
|
|
2312 |
url.cannotBeABaseURL = false;
|
|
2313 |
input = input.replace(LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE, '');
|
|
2314 |
}
|
|
2315 |
|
|
2316 |
input = input.replace(TAB_AND_NEW_LINE, '');
|
|
2317 |
|
|
2318 |
codePoints = arrayFrom(input);
|
|
2319 |
|
|
2320 |
while (pointer <= codePoints.length) {
|
|
2321 |
char = codePoints[pointer];
|
|
2322 |
switch (state) {
|
|
2323 |
case SCHEME_START:
|
|
2324 |
if (char && ALPHA.test(char)) {
|
|
2325 |
buffer += char.toLowerCase();
|
|
2326 |
state = SCHEME;
|
|
2327 |
} else if (!stateOverride) {
|
|
2328 |
state = NO_SCHEME;
|
|
2329 |
continue;
|
|
2330 |
} else return INVALID_SCHEME;
|
|
2331 |
break;
|
|
2332 |
|
|
2333 |
case SCHEME:
|
|
2334 |
if (char && (ALPHANUMERIC.test(char) || char == '+' || char == '-' || char == '.')) {
|
|
2335 |
buffer += char.toLowerCase();
|
|
2336 |
} else if (char == ':') {
|
|
2337 |
if (stateOverride && (
|
|
2338 |
(isSpecial(url) != has(specialSchemes, buffer)) ||
|
|
2339 |
(buffer == 'file' && (includesCredentials(url) || url.port !== null)) ||
|
|
2340 |
(url.scheme == 'file' && !url.host)
|
|
2341 |
)) return;
|
|
2342 |
url.scheme = buffer;
|
|
2343 |
if (stateOverride) {
|
|
2344 |
if (isSpecial(url) && specialSchemes[url.scheme] == url.port) url.port = null;
|
|
2345 |
return;
|
|
2346 |
}
|
|
2347 |
buffer = '';
|
|
2348 |
if (url.scheme == 'file') {
|
|
2349 |
state = FILE;
|
|
2350 |
} else if (isSpecial(url) && base && base.scheme == url.scheme) {
|
|
2351 |
state = SPECIAL_RELATIVE_OR_AUTHORITY;
|
|
2352 |
} else if (isSpecial(url)) {
|
|
2353 |
state = SPECIAL_AUTHORITY_SLASHES;
|
|
2354 |
} else if (codePoints[pointer + 1] == '/') {
|
|
2355 |
state = PATH_OR_AUTHORITY;
|
|
2356 |
pointer++;
|
|
2357 |
} else {
|
|
2358 |
url.cannotBeABaseURL = true;
|
|
2359 |
url.path.push('');
|
|
2360 |
state = CANNOT_BE_A_BASE_URL_PATH;
|
|
2361 |
}
|
|
2362 |
} else if (!stateOverride) {
|
|
2363 |
buffer = '';
|
|
2364 |
state = NO_SCHEME;
|
|
2365 |
pointer = 0;
|
|
2366 |
continue;
|
|
2367 |
} else return INVALID_SCHEME;
|
|
2368 |
break;
|
|
2369 |
|
|
2370 |
case NO_SCHEME:
|
|
2371 |
if (!base || (base.cannotBeABaseURL && char != '#')) return INVALID_SCHEME;
|
|
2372 |
if (base.cannotBeABaseURL && char == '#') {
|
|
2373 |
url.scheme = base.scheme;
|
|
2374 |
url.path = base.path.slice();
|
|
2375 |
url.query = base.query;
|
|
2376 |
url.fragment = '';
|
|
2377 |
url.cannotBeABaseURL = true;
|
|
2378 |
state = FRAGMENT;
|
|
2379 |
break;
|
|
2380 |
}
|
|
2381 |
state = base.scheme == 'file' ? FILE : RELATIVE;
|
|
2382 |
continue;
|
|
2383 |
|
|
2384 |
case SPECIAL_RELATIVE_OR_AUTHORITY:
|
|
2385 |
if (char == '/' && codePoints[pointer + 1] == '/') {
|
|
2386 |
state = SPECIAL_AUTHORITY_IGNORE_SLASHES;
|
|
2387 |
pointer++;
|
|
2388 |
} else {
|
|
2389 |
state = RELATIVE;
|
|
2390 |
continue;
|
|
2391 |
} break;
|
|
2392 |
|
|
2393 |
case PATH_OR_AUTHORITY:
|
|
2394 |
if (char == '/') {
|
|
2395 |
state = AUTHORITY;
|
|
2396 |
break;
|
|
2397 |
} else {
|
|
2398 |
state = PATH;
|
|
2399 |
continue;
|
|
2400 |
}
|
|
2401 |
|
|
2402 |
case RELATIVE:
|
|
2403 |
url.scheme = base.scheme;
|
|
2404 |
if (char == EOF) {
|
|
2405 |
url.username = base.username;
|
|
2406 |
url.password = base.password;
|
|
2407 |
url.host = base.host;
|
|
2408 |
url.port = base.port;
|
|
2409 |
url.path = base.path.slice();
|
|
2410 |
url.query = base.query;
|
|
2411 |
} else if (char == '/' || (char == '\\' && isSpecial(url))) {
|
|
2412 |
state = RELATIVE_SLASH;
|
|
2413 |
} else if (char == '?') {
|
|
2414 |
url.username = base.username;
|
|
2415 |
url.password = base.password;
|
|
2416 |
url.host = base.host;
|
|
2417 |
url.port = base.port;
|
|
2418 |
url.path = base.path.slice();
|
|
2419 |
url.query = '';
|
|
2420 |
state = QUERY;
|
|
2421 |
} else if (char == '#') {
|
|
2422 |
url.username = base.username;
|
|
2423 |
url.password = base.password;
|
|
2424 |
url.host = base.host;
|
|
2425 |
url.port = base.port;
|
|
2426 |
url.path = base.path.slice();
|
|
2427 |
url.query = base.query;
|
|
2428 |
url.fragment = '';
|
|
2429 |
state = FRAGMENT;
|
|
2430 |
} else {
|
|
2431 |
url.username = base.username;
|
|
2432 |
url.password = base.password;
|
|
2433 |
url.host = base.host;
|
|
2434 |
url.port = base.port;
|
|
2435 |
url.path = base.path.slice();
|
|
2436 |
url.path.pop();
|
|
2437 |
state = PATH;
|
|
2438 |
continue;
|
|
2439 |
} break;
|
|
2440 |
|
|
2441 |
case RELATIVE_SLASH:
|
|
2442 |
if (isSpecial(url) && (char == '/' || char == '\\')) {
|
|
2443 |
state = SPECIAL_AUTHORITY_IGNORE_SLASHES;
|
|
2444 |
} else if (char == '/') {
|
|
2445 |
state = AUTHORITY;
|
|
2446 |
} else {
|
|
2447 |
url.username = base.username;
|
|
2448 |
url.password = base.password;
|
|
2449 |
url.host = base.host;
|
|
2450 |
url.port = base.port;
|
|
2451 |
state = PATH;
|
|
2452 |
continue;
|
|
2453 |
} break;
|
|
2454 |
|
|
2455 |
case SPECIAL_AUTHORITY_SLASHES:
|
|
2456 |
state = SPECIAL_AUTHORITY_IGNORE_SLASHES;
|
|
2457 |
if (char != '/' || buffer.charAt(pointer + 1) != '/') continue;
|
|
2458 |
pointer++;
|
|
2459 |
break;
|
|
2460 |
|
|
2461 |
case SPECIAL_AUTHORITY_IGNORE_SLASHES:
|
|
2462 |
if (char != '/' && char != '\\') {
|
|
2463 |
state = AUTHORITY;
|
|
2464 |
continue;
|
|
2465 |
} break;
|
|
2466 |
|
|
2467 |
case AUTHORITY:
|
|
2468 |
if (char == '@') {
|
|
2469 |
if (seenAt) buffer = '%40' + buffer;
|
|
2470 |
seenAt = true;
|
|
2471 |
bufferCodePoints = arrayFrom(buffer);
|
|
2472 |
for (var i = 0; i < bufferCodePoints.length; i++) {
|
|
2473 |
var codePoint = bufferCodePoints[i];
|
|
2474 |
if (codePoint == ':' && !seenPasswordToken) {
|
|
2475 |
seenPasswordToken = true;
|
|
2476 |
continue;
|
|
2477 |
}
|
|
2478 |
var encodedCodePoints = percentEncode(codePoint, userinfoPercentEncodeSet);
|
|
2479 |
if (seenPasswordToken) url.password += encodedCodePoints;
|
|
2480 |
else url.username += encodedCodePoints;
|
|
2481 |
}
|
|
2482 |
buffer = '';
|
|
2483 |
} else if (
|
|
2484 |
char == EOF || char == '/' || char == '?' || char == '#' ||
|
|
2485 |
(char == '\\' && isSpecial(url))
|
|
2486 |
) {
|
|
2487 |
if (seenAt && buffer == '') return INVALID_AUTHORITY;
|
|
2488 |
pointer -= arrayFrom(buffer).length + 1;
|
|
2489 |
buffer = '';
|
|
2490 |
state = HOST;
|
|
2491 |
} else buffer += char;
|
|
2492 |
break;
|
|
2493 |
|
|
2494 |
case HOST:
|
|
2495 |
case HOSTNAME:
|
|
2496 |
if (stateOverride && url.scheme == 'file') {
|
|
2497 |
state = FILE_HOST;
|
|
2498 |
continue;
|
|
2499 |
} else if (char == ':' && !seenBracket) {
|
|
2500 |
if (buffer == '') return INVALID_HOST;
|
|
2501 |
failure = parseHost(url, buffer);
|
|
2502 |
if (failure) return failure;
|
|
2503 |
buffer = '';
|
|
2504 |
state = PORT;
|
|
2505 |
if (stateOverride == HOSTNAME) return;
|
|
2506 |
} else if (
|
|
2507 |
char == EOF || char == '/' || char == '?' || char == '#' ||
|
|
2508 |
(char == '\\' && isSpecial(url))
|
|
2509 |
) {
|
|
2510 |
if (isSpecial(url) && buffer == '') return INVALID_HOST;
|
|
2511 |
if (stateOverride && buffer == '' && (includesCredentials(url) || url.port !== null)) return;
|
|
2512 |
failure = parseHost(url, buffer);
|
|
2513 |
if (failure) return failure;
|
|
2514 |
buffer = '';
|
|
2515 |
state = PATH_START;
|
|
2516 |
if (stateOverride) return;
|
|
2517 |
continue;
|
|
2518 |
} else {
|
|
2519 |
if (char == '[') seenBracket = true;
|
|
2520 |
else if (char == ']') seenBracket = false;
|
|
2521 |
buffer += char;
|
|
2522 |
} break;
|
|
2523 |
|
|
2524 |
case PORT:
|
|
2525 |
if (DIGIT.test(char)) {
|
|
2526 |
buffer += char;
|
|
2527 |
} else if (
|
|
2528 |
char == EOF || char == '/' || char == '?' || char == '#' ||
|
|
2529 |
(char == '\\' && isSpecial(url)) ||
|
|
2530 |
stateOverride
|
|
2531 |
) {
|
|
2532 |
if (buffer != '') {
|
|
2533 |
var port = parseInt(buffer, 10);
|
|
2534 |
if (port > 0xFFFF) return INVALID_PORT;
|
|
2535 |
url.port = (isSpecial(url) && port === specialSchemes[url.scheme]) ? null : port;
|
|
2536 |
buffer = '';
|
|
2537 |
}
|
|
2538 |
if (stateOverride) return;
|
|
2539 |
state = PATH_START;
|
|
2540 |
continue;
|
|
2541 |
} else return INVALID_PORT;
|
|
2542 |
break;
|
|
2543 |
|
|
2544 |
case FILE:
|
|
2545 |
url.scheme = 'file';
|
|
2546 |
if (char == '/' || char == '\\') state = FILE_SLASH;
|
|
2547 |
else if (base && base.scheme == 'file') {
|
|
2548 |
if (char == EOF) {
|
|
2549 |
url.host = base.host;
|
|
2550 |
url.path = base.path.slice();
|
|
2551 |
url.query = base.query;
|
|
2552 |
} else if (char == '?') {
|
|
2553 |
url.host = base.host;
|
|
2554 |
url.path = base.path.slice();
|
|
2555 |
url.query = '';
|
|
2556 |
state = QUERY;
|
|
2557 |
} else if (char == '#') {
|
|
2558 |
url.host = base.host;
|
|
2559 |
url.path = base.path.slice();
|
|
2560 |
url.query = base.query;
|
|
2561 |
url.fragment = '';
|
|
2562 |
state = FRAGMENT;
|
|
2563 |
} else {
|
|
2564 |
if (!startsWithWindowsDriveLetter(codePoints.slice(pointer).join(''))) {
|
|
2565 |
url.host = base.host;
|
|
2566 |
url.path = base.path.slice();
|
|
2567 |
shortenURLsPath(url);
|
|
2568 |
}
|
|
2569 |
state = PATH;
|
|
2570 |
continue;
|
|
2571 |
}
|
|
2572 |
} else {
|
|
2573 |
state = PATH;
|
|
2574 |
continue;
|
|
2575 |
} break;
|
|
2576 |
|
|
2577 |
case FILE_SLASH:
|
|
2578 |
if (char == '/' || char == '\\') {
|
|
2579 |
state = FILE_HOST;
|
|
2580 |
break;
|
|
2581 |
}
|
|
2582 |
if (base && base.scheme == 'file' && !startsWithWindowsDriveLetter(codePoints.slice(pointer).join(''))) {
|
|
2583 |
if (isWindowsDriveLetter(base.path[0], true)) url.path.push(base.path[0]);
|
|
2584 |
else url.host = base.host;
|
|
2585 |
}
|
|
2586 |
state = PATH;
|
|
2587 |
continue;
|
|
2588 |
|
|
2589 |
case FILE_HOST:
|
|
2590 |
if (char == EOF || char == '/' || char == '\\' || char == '?' || char == '#') {
|
|
2591 |
if (!stateOverride && isWindowsDriveLetter(buffer)) {
|
|
2592 |
state = PATH;
|
|
2593 |
} else if (buffer == '') {
|
|
2594 |
url.host = '';
|
|
2595 |
if (stateOverride) return;
|
|
2596 |
state = PATH_START;
|
|
2597 |
} else {
|
|
2598 |
failure = parseHost(url, buffer);
|
|
2599 |
if (failure) return failure;
|
|
2600 |
if (url.host == 'localhost') url.host = '';
|
|
2601 |
if (stateOverride) return;
|
|
2602 |
buffer = '';
|
|
2603 |
state = PATH_START;
|
|
2604 |
} continue;
|
|
2605 |
} else buffer += char;
|
|
2606 |
break;
|
|
2607 |
|
|
2608 |
case PATH_START:
|
|
2609 |
if (isSpecial(url)) {
|
|
2610 |
state = PATH;
|
|
2611 |
if (char != '/' && char != '\\') continue;
|
|
2612 |
} else if (!stateOverride && char == '?') {
|
|
2613 |
url.query = '';
|
|
2614 |
state = QUERY;
|
|
2615 |
} else if (!stateOverride && char == '#') {
|
|
2616 |
url.fragment = '';
|
|
2617 |
state = FRAGMENT;
|
|
2618 |
} else if (char != EOF) {
|
|
2619 |
state = PATH;
|
|
2620 |
if (char != '/') continue;
|
|
2621 |
} break;
|
|
2622 |
|
|
2623 |
case PATH:
|
|
2624 |
if (
|
|
2625 |
char == EOF || char == '/' ||
|
|
2626 |
(char == '\\' && isSpecial(url)) ||
|
|
2627 |
(!stateOverride && (char == '?' || char == '#'))
|
|
2628 |
) {
|
|
2629 |
if (isDoubleDot(buffer)) {
|
|
2630 |
shortenURLsPath(url);
|
|
2631 |
if (char != '/' && !(char == '\\' && isSpecial(url))) {
|
|
2632 |
url.path.push('');
|
|
2633 |
}
|
|
2634 |
} else if (isSingleDot(buffer)) {
|
|
2635 |
if (char != '/' && !(char == '\\' && isSpecial(url))) {
|
|
2636 |
url.path.push('');
|
|
2637 |
}
|
|
2638 |
} else {
|
|
2639 |
if (url.scheme == 'file' && !url.path.length && isWindowsDriveLetter(buffer)) {
|
|
2640 |
if (url.host) url.host = '';
|
|
2641 |
buffer = buffer.charAt(0) + ':'; // normalize windows drive letter
|
|
2642 |
}
|
|
2643 |
url.path.push(buffer);
|
|
2644 |
}
|
|
2645 |
buffer = '';
|
|
2646 |
if (url.scheme == 'file' && (char == EOF || char == '?' || char == '#')) {
|
|
2647 |
while (url.path.length > 1 && url.path[0] === '') {
|
|
2648 |
url.path.shift();
|
|
2649 |
}
|
|
2650 |
}
|
|
2651 |
if (char == '?') {
|
|
2652 |
url.query = '';
|
|
2653 |
state = QUERY;
|
|
2654 |
} else if (char == '#') {
|
|
2655 |
url.fragment = '';
|
|
2656 |
state = FRAGMENT;
|
|
2657 |
}
|
|
2658 |
} else {
|
|
2659 |
buffer += percentEncode(char, pathPercentEncodeSet);
|
|
2660 |
} break;
|
|
2661 |
|
|
2662 |
case CANNOT_BE_A_BASE_URL_PATH:
|
|
2663 |
if (char == '?') {
|
|
2664 |
url.query = '';
|
|
2665 |
state = QUERY;
|
|
2666 |
} else if (char == '#') {
|
|
2667 |
url.fragment = '';
|
|
2668 |
state = FRAGMENT;
|
|
2669 |
} else if (char != EOF) {
|
|
2670 |
url.path[0] += percentEncode(char, C0ControlPercentEncodeSet);
|
|
2671 |
} break;
|
|
2672 |
|
|
2673 |
case QUERY:
|
|
2674 |
if (!stateOverride && char == '#') {
|
|
2675 |
url.fragment = '';
|
|
2676 |
state = FRAGMENT;
|
|
2677 |
} else if (char != EOF) {
|
|
2678 |
if (char == "'" && isSpecial(url)) url.query += '%27';
|
|
2679 |
else if (char == '#') url.query += '%23';
|
|
2680 |
else url.query += percentEncode(char, C0ControlPercentEncodeSet);
|
|
2681 |
} break;
|
|
2682 |
|
|
2683 |
case FRAGMENT:
|
|
2684 |
if (char != EOF) url.fragment += percentEncode(char, fragmentPercentEncodeSet);
|
|
2685 |
break;
|
|
2686 |
}
|
|
2687 |
|
|
2688 |
pointer++;
|
|
2689 |
}
|
|
2690 |
};
|
|
2691 |
|
|
2692 |
// `URL` constructor
|
|
2693 |
// https://url.spec.whatwg.org/#url-class
|
|
2694 |
var URLConstructor = function URL(url /* , base */) {
|
|
2695 |
var that = anInstance(this, URLConstructor, 'URL');
|
|
2696 |
var base = arguments.length > 1 ? arguments[1] : undefined;
|
|
2697 |
var urlString = String(url);
|
|
2698 |
var state = setInternalState(that, { type: 'URL' });
|
|
2699 |
var baseState, failure;
|
|
2700 |
if (base !== undefined) {
|
|
2701 |
if (base instanceof URLConstructor) baseState = getInternalURLState(base);
|
|
2702 |
else {
|
|
2703 |
failure = parseURL(baseState = {}, String(base));
|
|
2704 |
if (failure) throw TypeError(failure);
|
|
2705 |
}
|
|
2706 |
}
|
|
2707 |
failure = parseURL(state, urlString, null, baseState);
|
|
2708 |
if (failure) throw TypeError(failure);
|
|
2709 |
var searchParams = state.searchParams = new URLSearchParams();
|
|
2710 |
var searchParamsState = getInternalSearchParamsState(searchParams);
|
|
2711 |
searchParamsState.updateSearchParams(state.query);
|
|
2712 |
searchParamsState.updateURL = function () {
|
|
2713 |
state.query = String(searchParams) || null;
|
|
2714 |
};
|
|
2715 |
if (!DESCRIPTORS) {
|
|
2716 |
that.href = serializeURL.call(that);
|
|
2717 |
that.origin = getOrigin.call(that);
|
|
2718 |
that.protocol = getProtocol.call(that);
|
|
2719 |
that.username = getUsername.call(that);
|
|
2720 |
that.password = getPassword.call(that);
|
|
2721 |
that.host = getHost.call(that);
|
|
2722 |
that.hostname = getHostname.call(that);
|
|
2723 |
that.port = getPort.call(that);
|
|
2724 |
that.pathname = getPathname.call(that);
|
|
2725 |
that.search = getSearch.call(that);
|
|
2726 |
that.searchParams = getSearchParams.call(that);
|
|
2727 |
that.hash = getHash.call(that);
|
|
2728 |
}
|
|
2729 |
};
|
|
2730 |
|
|
2731 |
var URLPrototype = URLConstructor.prototype;
|
|
2732 |
|
|
2733 |
var serializeURL = function () {
|
|
2734 |
var url = getInternalURLState(this);
|
|
2735 |
var scheme = url.scheme;
|
|
2736 |
var username = url.username;
|
|
2737 |
var password = url.password;
|
|
2738 |
var host = url.host;
|
|
2739 |
var port = url.port;
|
|
2740 |
var path = url.path;
|
|
2741 |
var query = url.query;
|
|
2742 |
var fragment = url.fragment;
|
|
2743 |
var output = scheme + ':';
|
|
2744 |
if (host !== null) {
|
|
2745 |
output += '//';
|
|
2746 |
if (includesCredentials(url)) {
|
|
2747 |
output += username + (password ? ':' + password : '') + '@';
|
|
2748 |
}
|
|
2749 |
output += serializeHost(host);
|
|
2750 |
if (port !== null) output += ':' + port;
|
|
2751 |
} else if (scheme == 'file') output += '//';
|
|
2752 |
output += url.cannotBeABaseURL ? path[0] : path.length ? '/' + path.join('/') : '';
|
|
2753 |
if (query !== null) output += '?' + query;
|
|
2754 |
if (fragment !== null) output += '#' + fragment;
|
|
2755 |
return output;
|
|
2756 |
};
|
|
2757 |
|
|
2758 |
var getOrigin = function () {
|
|
2759 |
var url = getInternalURLState(this);
|
|
2760 |
var scheme = url.scheme;
|
|
2761 |
var port = url.port;
|
|
2762 |
if (scheme == 'blob') try {
|
|
2763 |
return new URL(scheme.path[0]).origin;
|
|
2764 |
} catch (error) {
|
|
2765 |
return 'null';
|
|
2766 |
}
|
|
2767 |
if (scheme == 'file' || !isSpecial(url)) return 'null';
|
|
2768 |
return scheme + '://' + serializeHost(url.host) + (port !== null ? ':' + port : '');
|
|
2769 |
};
|
|
2770 |
|
|
2771 |
var getProtocol = function () {
|
|
2772 |
return getInternalURLState(this).scheme + ':';
|
|
2773 |
};
|
|
2774 |
|
|
2775 |
var getUsername = function () {
|
|
2776 |
return getInternalURLState(this).username;
|
|
2777 |
};
|
|
2778 |
|
|
2779 |
var getPassword = function () {
|
|
2780 |
return getInternalURLState(this).password;
|
|
2781 |
};
|
|
2782 |
|
|
2783 |
var getHost = function () {
|
|
2784 |
var url = getInternalURLState(this);
|
|
2785 |
var host = url.host;
|
|
2786 |
var port = url.port;
|
|
2787 |
return host === null ? ''
|
|
2788 |
: port === null ? serializeHost(host)
|
|
2789 |
: serializeHost(host) + ':' + port;
|
|
2790 |
};
|
|
2791 |
|
|
2792 |
var getHostname = function () {
|
|
2793 |
var host = getInternalURLState(this).host;
|
|
2794 |
return host === null ? '' : serializeHost(host);
|
|
2795 |
};
|
|
2796 |
|
|
2797 |
var getPort = function () {
|
|
2798 |
var port = getInternalURLState(this).port;
|
|
2799 |
return port === null ? '' : String(port);
|
|
2800 |
};
|
|
2801 |
|
|
2802 |
var getPathname = function () {
|
|
2803 |
var url = getInternalURLState(this);
|
|
2804 |
var path = url.path;
|
|
2805 |
return url.cannotBeABaseURL ? path[0] : path.length ? '/' + path.join('/') : '';
|
|
2806 |
};
|
|
2807 |
|
|
2808 |
var getSearch = function () {
|
|
2809 |
var query = getInternalURLState(this).query;
|
|
2810 |
return query ? '?' + query : '';
|
|
2811 |
};
|
|
2812 |
|
|
2813 |
var getSearchParams = function () {
|
|
2814 |
return getInternalURLState(this).searchParams;
|
|
2815 |
};
|
|
2816 |
|
|
2817 |
var getHash = function () {
|
|
2818 |
var fragment = getInternalURLState(this).fragment;
|
|
2819 |
return fragment ? '#' + fragment : '';
|
|
2820 |
};
|
|
2821 |
|
|
2822 |
var accessorDescriptor = function (getter, setter) {
|
|
2823 |
return { get: getter, set: setter, configurable: true, enumerable: true };
|
|
2824 |
};
|
|
2825 |
|
|
2826 |
if (DESCRIPTORS) {
|
|
2827 |
defineProperties(URLPrototype, {
|
|
2828 |
// `URL.prototype.href` accessors pair
|
|
2829 |
// https://url.spec.whatwg.org/#dom-url-href
|
|
2830 |
href: accessorDescriptor(serializeURL, function (href) {
|
|
2831 |
var url = getInternalURLState(this);
|
|
2832 |
var urlString = String(href);
|
|
2833 |
var failure = parseURL(url, urlString);
|
|
2834 |
if (failure) throw TypeError(failure);
|
|
2835 |
getInternalSearchParamsState(url.searchParams).updateSearchParams(url.query);
|
|
2836 |
}),
|
|
2837 |
// `URL.prototype.origin` getter
|
|
2838 |
// https://url.spec.whatwg.org/#dom-url-origin
|
|
2839 |
origin: accessorDescriptor(getOrigin),
|
|
2840 |
// `URL.prototype.protocol` accessors pair
|
|
2841 |
// https://url.spec.whatwg.org/#dom-url-protocol
|
|
2842 |
protocol: accessorDescriptor(getProtocol, function (protocol) {
|
|
2843 |
var url = getInternalURLState(this);
|
|
2844 |
parseURL(url, String(protocol) + ':', SCHEME_START);
|
|
2845 |
}),
|
|
2846 |
// `URL.prototype.username` accessors pair
|
|
2847 |
// https://url.spec.whatwg.org/#dom-url-username
|
|
2848 |
username: accessorDescriptor(getUsername, function (username) {
|
|
2849 |
var url = getInternalURLState(this);
|
|
2850 |
var codePoints = arrayFrom(String(username));
|
|
2851 |
if (cannotHaveUsernamePasswordPort(url)) return;
|
|
2852 |
url.username = '';
|
|
2853 |
for (var i = 0; i < codePoints.length; i++) {
|
|
2854 |
url.username += percentEncode(codePoints[i], userinfoPercentEncodeSet);
|
|
2855 |
}
|
|
2856 |
}),
|
|
2857 |
// `URL.prototype.password` accessors pair
|
|
2858 |
// https://url.spec.whatwg.org/#dom-url-password
|
|
2859 |
password: accessorDescriptor(getPassword, function (password) {
|
|
2860 |
var url = getInternalURLState(this);
|
|
2861 |
var codePoints = arrayFrom(String(password));
|
|
2862 |
if (cannotHaveUsernamePasswordPort(url)) return;
|
|
2863 |
url.password = '';
|
|
2864 |
for (var i = 0; i < codePoints.length; i++) {
|
|
2865 |
url.password += percentEncode(codePoints[i], userinfoPercentEncodeSet);
|
|
2866 |
}
|
|
2867 |
}),
|
|
2868 |
// `URL.prototype.host` accessors pair
|
|
2869 |
// https://url.spec.whatwg.org/#dom-url-host
|
|
2870 |
host: accessorDescriptor(getHost, function (host) {
|
|
2871 |
var url = getInternalURLState(this);
|
|
2872 |
if (url.cannotBeABaseURL) return;
|
|
2873 |
parseURL(url, String(host), HOST);
|
|
2874 |
}),
|
|
2875 |
// `URL.prototype.hostname` accessors pair
|
|
2876 |
// https://url.spec.whatwg.org/#dom-url-hostname
|
|
2877 |
hostname: accessorDescriptor(getHostname, function (hostname) {
|
|
2878 |
var url = getInternalURLState(this);
|
|
2879 |
if (url.cannotBeABaseURL) return;
|
|
2880 |
parseURL(url, String(hostname), HOSTNAME);
|
|
2881 |
}),
|
|
2882 |
// `URL.prototype.port` accessors pair
|
|
2883 |
// https://url.spec.whatwg.org/#dom-url-port
|
|
2884 |
port: accessorDescriptor(getPort, function (port) {
|
|
2885 |
var url = getInternalURLState(this);
|
|
2886 |
if (cannotHaveUsernamePasswordPort(url)) return;
|
|
2887 |
port = String(port);
|
|
2888 |
if (port == '') url.port = null;
|
|
2889 |
else parseURL(url, port, PORT);
|
|
2890 |
}),
|
|
2891 |
// `URL.prototype.pathname` accessors pair
|
|
2892 |
// https://url.spec.whatwg.org/#dom-url-pathname
|
|
2893 |
pathname: accessorDescriptor(getPathname, function (pathname) {
|
|
2894 |
var url = getInternalURLState(this);
|
|
2895 |
if (url.cannotBeABaseURL) return;
|
|
2896 |
url.path = [];
|
|
2897 |
parseURL(url, pathname + '', PATH_START);
|
|
2898 |
}),
|
|
2899 |
// `URL.prototype.search` accessors pair
|
|
2900 |
// https://url.spec.whatwg.org/#dom-url-search
|
|
2901 |
search: accessorDescriptor(getSearch, function (search) {
|
|
2902 |
var url = getInternalURLState(this);
|
|
2903 |
search = String(search);
|
|
2904 |
if (search == '') {
|
|
2905 |
url.query = null;
|
|
2906 |
} else {
|
|
2907 |
if ('?' == search.charAt(0)) search = search.slice(1);
|
|
2908 |
url.query = '';
|
|
2909 |
parseURL(url, search, QUERY);
|
|
2910 |
}
|
|
2911 |
getInternalSearchParamsState(url.searchParams).updateSearchParams(url.query);
|
|
2912 |
}),
|
|
2913 |
// `URL.prototype.searchParams` getter
|
|
2914 |
// https://url.spec.whatwg.org/#dom-url-searchparams
|
|
2915 |
searchParams: accessorDescriptor(getSearchParams),
|
|
2916 |
// `URL.prototype.hash` accessors pair
|
|
2917 |
// https://url.spec.whatwg.org/#dom-url-hash
|
|
2918 |
hash: accessorDescriptor(getHash, function (hash) {
|
|
2919 |
var url = getInternalURLState(this);
|
|
2920 |
hash = String(hash);
|
|
2921 |
if (hash == '') {
|
|
2922 |
url.fragment = null;
|
|
2923 |
return;
|
|
2924 |
}
|
|
2925 |
if ('#' == hash.charAt(0)) hash = hash.slice(1);
|
|
2926 |
url.fragment = '';
|
|
2927 |
parseURL(url, hash, FRAGMENT);
|
|
2928 |
})
|
|
2929 |
});
|
|
2930 |
}
|
|
2931 |
|
|
2932 |
// `URL.prototype.toJSON` method
|
|
2933 |
// https://url.spec.whatwg.org/#dom-url-tojson
|
|
2934 |
redefine(URLPrototype, 'toJSON', function toJSON() {
|
|
2935 |
return serializeURL.call(this);
|
|
2936 |
}, { enumerable: true });
|
|
2937 |
|
|
2938 |
// `URL.prototype.toString` method
|
|
2939 |
// https://url.spec.whatwg.org/#URL-stringification-behavior
|
|
2940 |
redefine(URLPrototype, 'toString', function toString() {
|
|
2941 |
return serializeURL.call(this);
|
|
2942 |
}, { enumerable: true });
|
|
2943 |
|
|
2944 |
if (NativeURL) {
|
|
2945 |
var nativeCreateObjectURL = NativeURL.createObjectURL;
|
|
2946 |
var nativeRevokeObjectURL = NativeURL.revokeObjectURL;
|
|
2947 |
// `URL.createObjectURL` method
|
|
2948 |
// https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL
|
|
2949 |
// eslint-disable-next-line no-unused-vars
|
|
2950 |
if (nativeCreateObjectURL) redefine(URLConstructor, 'createObjectURL', function createObjectURL(blob) {
|
|
2951 |
return nativeCreateObjectURL.apply(NativeURL, arguments);
|
|
2952 |
});
|
|
2953 |
// `URL.revokeObjectURL` method
|
|
2954 |
// https://developer.mozilla.org/en-US/docs/Web/API/URL/revokeObjectURL
|
|
2955 |
// eslint-disable-next-line no-unused-vars
|
|
2956 |
if (nativeRevokeObjectURL) redefine(URLConstructor, 'revokeObjectURL', function revokeObjectURL(url) {
|
|
2957 |
return nativeRevokeObjectURL.apply(NativeURL, arguments);
|
|
2958 |
});
|
|
2959 |
}
|
|
2960 |
|
|
2961 |
setToStringTag(URLConstructor, 'URL');
|
|
2962 |
|
|
2963 |
$({ global: true, forced: !USE_NATIVE_URL, sham: !DESCRIPTORS }, {
|
|
2964 |
URL: URLConstructor
|
|
2965 |
});
|
|
2966 |
|
|
2967 |
},{"../internals/an-instance":4,"../internals/array-from":6,"../internals/descriptors":18,"../internals/export":21,"../internals/global":27,"../internals/has":28,"../internals/internal-state":34,"../internals/native-url":42,"../internals/object-assign":44,"../internals/object-define-properties":46,"../internals/redefine":59,"../internals/set-to-string-tag":62,"../internals/string-multibyte":66,"../internals/string-punycode-to-ascii":67,"../modules/es.string.iterator":79,"../modules/web.url-search-params":80}],82:[function(require,module,exports){
|
|
2968 |
'use strict';
|
|
2969 |
var $ = require('../internals/export');
|
|
2970 |
|
|
2971 |
// `URL.prototype.toJSON` method
|
|
2972 |
// https://url.spec.whatwg.org/#dom-url-tojson
|
|
2973 |
$({ target: 'URL', proto: true, enumerable: true }, {
|
|
2974 |
toJSON: function toJSON() {
|
|
2975 |
return URL.prototype.toString.call(this);
|
|
2976 |
}
|
|
2977 |
});
|
|
2978 |
|
|
2979 |
},{"../internals/export":21}],83:[function(require,module,exports){
|
|
2980 |
require('../modules/web.url');
|
|
2981 |
require('../modules/web.url.to-json');
|
|
2982 |
require('../modules/web.url-search-params');
|
|
2983 |
var path = require('../internals/path');
|
|
2984 |
|
|
2985 |
module.exports = path.URL;
|
|
2986 |
|
|
2987 |
},{"../internals/path":57,"../modules/web.url":81,"../modules/web.url-search-params":80,"../modules/web.url.to-json":82}]},{},[83]);
|