forked from Shopify/js-buy-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpolyfilled.js
More file actions
4464 lines (3911 loc) · 123 KB
/
polyfilled.js
File metadata and controls
4464 lines (3911 loc) · 123 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
'use strict';
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
(function () {
'use strict';
if (self.fetch) {
return;
}
function normalizeName(name) {
if (typeof name !== 'string') {
name = String(name);
}
if (/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(name)) {
throw new TypeError('Invalid character in header field name');
}
return name.toLowerCase();
}
function normalizeValue(value) {
if (typeof value !== 'string') {
value = String(value);
}
return value;
}
function Headers(headers) {
this.map = {};
if (headers instanceof Headers) {
headers.forEach(function (value, name) {
this.append(name, value);
}, this);
} else if (headers) {
Object.getOwnPropertyNames(headers).forEach(function (name) {
this.append(name, headers[name]);
}, this);
}
}
Headers.prototype.append = function (name, value) {
name = normalizeName(name);
value = normalizeValue(value);
var list = this.map[name];
if (!list) {
list = [];
this.map[name] = list;
}
list.push(value);
};
Headers.prototype['delete'] = function (name) {
delete this.map[normalizeName(name)];
};
Headers.prototype.get = function (name) {
var values = this.map[normalizeName(name)];
return values ? values[0] : null;
};
Headers.prototype.getAll = function (name) {
return this.map[normalizeName(name)] || [];
};
Headers.prototype.has = function (name) {
return this.map.hasOwnProperty(normalizeName(name));
};
Headers.prototype.set = function (name, value) {
this.map[normalizeName(name)] = [normalizeValue(value)];
};
Headers.prototype.forEach = function (callback, thisArg) {
Object.getOwnPropertyNames(this.map).forEach(function (name) {
this.map[name].forEach(function (value) {
callback.call(thisArg, value, name, this);
}, this);
}, this);
};
function consumed(body) {
if (body.bodyUsed) {
return Promise.reject(new TypeError('Already read'));
}
body.bodyUsed = true;
}
function fileReaderReady(reader) {
return new Promise(function (resolve, reject) {
reader.onload = function () {
resolve(reader.result);
};
reader.onerror = function () {
reject(reader.error);
};
});
}
function readBlobAsArrayBuffer(blob) {
var reader = new FileReader();
reader.readAsArrayBuffer(blob);
return fileReaderReady(reader);
}
function readBlobAsText(blob) {
var reader = new FileReader();
reader.readAsText(blob);
return fileReaderReady(reader);
}
var support = {
blob: 'FileReader' in self && 'Blob' in self && function () {
try {
new Blob();
return true;
} catch (e) {
return false;
}
}(),
formData: 'FormData' in self,
arrayBuffer: 'ArrayBuffer' in self
};
function Body() {
this.bodyUsed = false;
this._initBody = function (body) {
this._bodyInit = body;
if (typeof body === 'string') {
this._bodyText = body;
} else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
this._bodyBlob = body;
} else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
this._bodyFormData = body;
} else if (!body) {
this._bodyText = '';
} else if (support.arrayBuffer && ArrayBuffer.prototype.isPrototypeOf(body)) {
// Only support ArrayBuffers for POST method.
// Receiving ArrayBuffers happens via Blobs, instead.
} else {
throw new Error('unsupported BodyInit type');
}
};
if (support.blob) {
this.blob = function () {
var rejected = consumed(this);
if (rejected) {
return rejected;
}
if (this._bodyBlob) {
return Promise.resolve(this._bodyBlob);
} else if (this._bodyFormData) {
throw new Error('could not read FormData body as blob');
} else {
return Promise.resolve(new Blob([this._bodyText]));
}
};
this.arrayBuffer = function () {
return this.blob().then(readBlobAsArrayBuffer);
};
this.text = function () {
var rejected = consumed(this);
if (rejected) {
return rejected;
}
if (this._bodyBlob) {
return readBlobAsText(this._bodyBlob);
} else if (this._bodyFormData) {
throw new Error('could not read FormData body as text');
} else {
return Promise.resolve(this._bodyText);
}
};
} else {
this.text = function () {
var rejected = consumed(this);
return rejected ? rejected : Promise.resolve(this._bodyText);
};
}
if (support.formData) {
this.formData = function () {
return this.text().then(decode);
};
}
this.json = function () {
return this.text().then(JSON.parse);
};
return this;
}
// HTTP methods whose capitalization should be normalized
var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'];
function normalizeMethod(method) {
var upcased = method.toUpperCase();
return methods.indexOf(upcased) > -1 ? upcased : method;
}
function Request(input, options) {
options = options || {};
var body = options.body;
if (Request.prototype.isPrototypeOf(input)) {
if (input.bodyUsed) {
throw new TypeError('Already read');
}
this.url = input.url;
this.credentials = input.credentials;
if (!options.headers) {
this.headers = new Headers(input.headers);
}
this.method = input.method;
this.mode = input.mode;
if (!body) {
body = input._bodyInit;
input.bodyUsed = true;
}
} else {
this.url = input;
}
this.credentials = options.credentials || this.credentials || 'omit';
if (options.headers || !this.headers) {
this.headers = new Headers(options.headers);
}
this.method = normalizeMethod(options.method || this.method || 'GET');
this.mode = options.mode || this.mode || null;
this.referrer = null;
if ((this.method === 'GET' || this.method === 'HEAD') && body) {
throw new TypeError('Body not allowed for GET or HEAD requests');
}
this._initBody(body);
}
Request.prototype.clone = function () {
return new Request(this);
};
function decode(body) {
var form = new FormData();
body.trim().split('&').forEach(function (bytes) {
if (bytes) {
var split = bytes.split('=');
var name = split.shift().replace(/\+/g, ' ');
var value = split.join('=').replace(/\+/g, ' ');
form.append(decodeURIComponent(name), decodeURIComponent(value));
}
});
return form;
}
function headers(xhr) {
var head = new Headers();
var pairs = xhr.getAllResponseHeaders().trim().split('\n');
pairs.forEach(function (header) {
var split = header.trim().split(':');
var key = split.shift().trim();
var value = split.join(':').trim();
head.append(key, value);
});
return head;
}
Body.call(Request.prototype);
function Response(bodyInit, options) {
if (!options) {
options = {};
}
this._initBody(bodyInit);
this.type = 'default';
this.status = options.status;
this.ok = this.status >= 200 && this.status < 300;
this.statusText = options.statusText;
this.headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
this.url = options.url || '';
}
Body.call(Response.prototype);
Response.prototype.clone = function () {
return new Response(this._bodyInit, {
status: this.status,
statusText: this.statusText,
headers: new Headers(this.headers),
url: this.url
});
};
Response.error = function () {
var response = new Response(null, { status: 0, statusText: '' });
response.type = 'error';
return response;
};
var redirectStatuses = [301, 302, 303, 307, 308];
Response.redirect = function (url, status) {
if (redirectStatuses.indexOf(status) === -1) {
throw new RangeError('Invalid status code');
}
return new Response(null, { status: status, headers: { location: url } });
};
self.Headers = Headers;
self.Request = Request;
self.Response = Response;
self.fetch = function (input, init) {
return new Promise(function (resolve, reject) {
var request;
if (Request.prototype.isPrototypeOf(input) && !init) {
request = input;
} else {
request = new Request(input, init);
}
var xhr = new XMLHttpRequest();
function responseURL() {
if ('responseURL' in xhr) {
return xhr.responseURL;
}
// Avoid security warnings on getResponseHeader when not allowed by CORS
if (/^X-Request-URL:/m.test(xhr.getAllResponseHeaders())) {
return xhr.getResponseHeader('X-Request-URL');
}
return;
}
xhr.onload = function () {
var status = xhr.status === 1223 ? 204 : xhr.status;
if (status < 100 || status > 599) {
reject(new TypeError('Network request failed'));
return;
}
var options = {
status: status,
statusText: xhr.statusText,
headers: headers(xhr),
url: responseURL()
};
var body = 'response' in xhr ? xhr.response : xhr.responseText;
resolve(new Response(body, options));
};
xhr.onerror = function () {
reject(new TypeError('Network request failed'));
};
xhr.open(request.method, request.url, true);
if (request.credentials === 'include') {
xhr.withCredentials = true;
}
if ('responseType' in xhr && support.blob) {
xhr.responseType = 'blob';
}
request.headers.forEach(function (value, name) {
xhr.setRequestHeader(name, value);
});
xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);
});
};
self.fetch.polyfill = true;
})();
var toString$1 = {}.toString;
var _cof = function _cof(it) {
return toString$1.call(it).slice(8, -1);
};
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
var _global = createCommonjsModule(function (module) {
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
var global = module.exports = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
});
var global$1 = _global;
var SHARED = '__core-js_shared__';
var store = global$1[SHARED] || (global$1[SHARED] = {});
var _shared = function _shared(key) {
return store[key] || (store[key] = {});
};
var id = 0;
var px = Math.random();
var _uid = function _uid(key) {
return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
};
var _wks = createCommonjsModule(function (module) {
var store = _shared('wks'),
uid = _uid,
_Symbol = _global.Symbol,
USE_SYMBOL = typeof _Symbol == 'function';
var $exports = module.exports = function (name) {
return store[name] || (store[name] = USE_SYMBOL && _Symbol[name] || (USE_SYMBOL ? _Symbol : uid)('Symbol.' + name));
};
$exports.store = store;
});
// getting tag from 19.1.3.6 Object.prototype.toString()
var cof = _cof;
var TAG = _wks('toStringTag');
var ARG = cof(function () {
return arguments;
}()) == 'Arguments';
// fallback for IE11 Script Access Denied error
var tryGet = function tryGet(it, key) {
try {
return it[key];
} catch (e) {/* empty */}
};
var _classof = function _classof(it) {
var O, T, B;
return it === undefined ? 'Undefined' : it === null ? 'Null'
// @@toStringTag case
: typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T
// builtinTag case
: ARG ? cof(O)
// ES3 arguments fallback
: (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
};
var _isObject = function _isObject(it) {
return (typeof it === 'undefined' ? 'undefined' : _typeof(it)) === 'object' ? it !== null : typeof it === 'function';
};
var isObject = _isObject;
var _anObject = function _anObject(it) {
if (!isObject(it)) throw TypeError(it + ' is not an object!');
return it;
};
var _fails = function _fails(exec) {
try {
return !!exec();
} catch (e) {
return true;
}
};
// Thank's IE8 for his funny defineProperty
var _descriptors = !_fails(function () {
return Object.defineProperty({}, 'a', { get: function get() {
return 7;
} }).a != 7;
});
var isObject$1 = _isObject;
var document$1 = _global.document;
var is = isObject$1(document$1) && isObject$1(document$1.createElement);
var _domCreate = function _domCreate(it) {
return is ? document$1.createElement(it) : {};
};
var _ie8DomDefine = !_descriptors && !_fails(function () {
return Object.defineProperty(_domCreate('div'), 'a', { get: function get() {
return 7;
} }).a != 7;
});
// 7.1.1 ToPrimitive(input [, PreferredType])
var isObject$2 = _isObject;
// instead of the ES6 spec version, we didn't implement @@toPrimitive case
// and the second argument - flag - preferred type is a string
var _toPrimitive = function _toPrimitive(it, S) {
if (!isObject$2(it)) return it;
var fn, val;
if (S && typeof (fn = it.toString) == 'function' && !isObject$2(val = fn.call(it))) return val;
if (typeof (fn = it.valueOf) == 'function' && !isObject$2(val = fn.call(it))) return val;
if (!S && typeof (fn = it.toString) == 'function' && !isObject$2(val = fn.call(it))) return val;
throw TypeError("Can't convert object to primitive value");
};
var anObject = _anObject;
var IE8_DOM_DEFINE = _ie8DomDefine;
var toPrimitive = _toPrimitive;
var dP$1 = Object.defineProperty;
var f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) {
anObject(O);
P = toPrimitive(P, true);
anObject(Attributes);
if (IE8_DOM_DEFINE) try {
return dP$1(O, P, Attributes);
} catch (e) {/* empty */}
if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
if ('value' in Attributes) O[P] = Attributes.value;
return O;
};
var _objectDp = {
f: f
};
var _propertyDesc = function _propertyDesc(bitmap, value) {
return {
enumerable: !(bitmap & 1),
configurable: !(bitmap & 2),
writable: !(bitmap & 4),
value: value
};
};
var dP = _objectDp;
var createDesc = _propertyDesc;
var _hide = _descriptors ? function (object, key, value) {
return dP.f(object, key, createDesc(1, value));
} : function (object, key, value) {
object[key] = value;
return object;
};
var hasOwnProperty = {}.hasOwnProperty;
var _has = function _has(it, key) {
return hasOwnProperty.call(it, key);
};
var _core = createCommonjsModule(function (module) {
var core = module.exports = { version: '2.4.0' };
if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
});
var _redefine = createCommonjsModule(function (module) {
var global = _global,
hide = _hide,
has = _has,
SRC = _uid('src'),
TO_STRING = 'toString',
$toString = Function[TO_STRING],
TPL = ('' + $toString).split(TO_STRING);
_core.inspectSource = function (it) {
return $toString.call(it);
};
(module.exports = function (O, key, val, safe) {
var isFunction = typeof val == 'function';
if (isFunction) has(val, 'name') || hide(val, 'name', key);
if (O[key] === val) return;
if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));
if (O === global) {
O[key] = val;
} else {
if (!safe) {
delete O[key];
hide(O, key, val);
} else {
if (O[key]) O[key] = val;else hide(O, key, val);
}
}
// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
})(Function.prototype, TO_STRING, function toString() {
return typeof this == 'function' && this[SRC] || $toString.call(this);
});
});
// 19.1.3.6 Object.prototype.toString()
var classof = _classof;
var test = {};
test[_wks('toStringTag')] = 'z';
if (test + '' != '[object z]') {
_redefine(Object.prototype, 'toString', function toString() {
return '[object ' + classof(this) + ']';
}, true);
}
// 7.1.4 ToInteger
var ceil = Math.ceil;
var floor = Math.floor;
var _toInteger = function _toInteger(it) {
return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
};
// 7.2.1 RequireObjectCoercible(argument)
var _defined = function _defined(it) {
if (it == undefined) throw TypeError("Can't call method on " + it);
return it;
};
var toInteger = _toInteger;
var defined = _defined;
// true -> String#at
// false -> String#codePointAt
var _stringAt = function _stringAt(TO_STRING) {
return function (that, pos) {
var s = String(defined(that)),
i = toInteger(pos),
l = s.length,
a,
b;
if (i < 0 || i >= l) return TO_STRING ? '' : undefined;
a = s.charCodeAt(i);
return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff ? TO_STRING ? s.charAt(i) : a : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
};
};
var _library = false;
var _aFunction = function _aFunction(it) {
if (typeof it != 'function') throw TypeError(it + ' is not a function!');
return it;
};
// optional / simple context binding
var aFunction = _aFunction;
var _ctx = function _ctx(fn, that, length) {
aFunction(fn);
if (that === undefined) return fn;
switch (length) {
case 1:
return function (a) {
return fn.call(that, a);
};
case 2:
return function (a, b) {
return fn.call(that, a, b);
};
case 3:
return function (a, b, c) {
return fn.call(that, a, b, c);
};
}
return function () /* ...args */{
return fn.apply(that, arguments);
};
};
var global$2 = _global;
var core = _core;
var hide$1 = _hide;
var redefine$1 = _redefine;
var ctx = _ctx;
var PROTOTYPE = 'prototype';
var $export$1 = function $export$1(type, name, source) {
var IS_FORCED = type & $export$1.F,
IS_GLOBAL = type & $export$1.G,
IS_STATIC = type & $export$1.S,
IS_PROTO = type & $export$1.P,
IS_BIND = type & $export$1.B,
target = IS_GLOBAL ? global$2 : IS_STATIC ? global$2[name] || (global$2[name] = {}) : (global$2[name] || {})[PROTOTYPE],
exports = IS_GLOBAL ? core : core[name] || (core[name] = {}),
expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {}),
key,
own,
out,
exp;
if (IS_GLOBAL) source = name;
for (key in source) {
// contains in native
own = !IS_FORCED && target && target[key] !== undefined;
// export native or passed
out = (own ? target : source)[key];
// bind timers to global for call from export context
exp = IS_BIND && own ? ctx(out, global$2) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
// extend global
if (target) redefine$1(target, key, out, type & $export$1.U);
// export
if (exports[key] != out) hide$1(exports, key, exp);
if (IS_PROTO && expProto[key] != out) expProto[key] = out;
}
};
global$2.core = core;
// type bitmap
$export$1.F = 1; // forced
$export$1.G = 2; // global
$export$1.S = 4; // static
$export$1.P = 8; // proto
$export$1.B = 16; // bind
$export$1.W = 32; // wrap
$export$1.U = 64; // safe
$export$1.R = 128; // real proto method for `library`
var _export = $export$1;
var _iterators = {};
// fallback for non-array-like ES3 and non-enumerable old V8 strings
var cof$1 = _cof;
var _iobject = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
return cof$1(it) == 'String' ? it.split('') : Object(it);
};
// to indexed object, toObject with fallback for non-array-like ES3 strings
var IObject = _iobject;
var defined$1 = _defined;
var _toIobject = function _toIobject(it) {
return IObject(defined$1(it));
};
// 7.1.15 ToLength
var toInteger$1 = _toInteger;
var min = Math.min;
var _toLength = function _toLength(it) {
return it > 0 ? min(toInteger$1(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
};
var toInteger$2 = _toInteger;
var max = Math.max;
var min$1 = Math.min;
var _toIndex = function _toIndex(index, length) {
index = toInteger$2(index);
return index < 0 ? max(index + length, 0) : min$1(index, length);
};
// false -> Array#indexOf
// true -> Array#includes
var toIObject$1 = _toIobject;
var toLength = _toLength;
var toIndex = _toIndex;
var _arrayIncludes = function _arrayIncludes(IS_INCLUDES) {
return function ($this, el, fromIndex) {
var O = toIObject$1($this),
length = toLength(O.length),
index = toIndex(fromIndex, length),
value;
// Array#includes uses SameValueZero equality algorithm
if (IS_INCLUDES && el != el) while (length > index) {
value = O[index++];
if (value != value) return true;
// Array#toIndex ignores holes, Array#includes - not
} else for (; length > index; index++) {
if (IS_INCLUDES || index in O) {
if (O[index] === el) return IS_INCLUDES || index || 0;
}
}return !IS_INCLUDES && -1;
};
};
var shared = _shared('keys');
var uid = _uid;
var _sharedKey = function _sharedKey(key) {
return shared[key] || (shared[key] = uid(key));
};
var has$1 = _has;
var toIObject = _toIobject;
var arrayIndexOf = _arrayIncludes(false);
var IE_PROTO$1 = _sharedKey('IE_PROTO');
var _objectKeysInternal = function _objectKeysInternal(object, names) {
var O = toIObject(object),
i = 0,
result = [],
key;
for (key in O) {
if (key != IE_PROTO$1) has$1(O, key) && result.push(key);
} // Don't enum bug & hidden keys
while (names.length > i) {
if (has$1(O, key = names[i++])) {
~arrayIndexOf(result, key) || result.push(key);
}
}return result;
};
// IE 8- don't enum bug keys
var _enumBugKeys = 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'.split(',');
// 19.1.2.14 / 15.2.3.14 Object.keys(O)
var $keys = _objectKeysInternal;
var enumBugKeys$1 = _enumBugKeys;
var _objectKeys = Object.keys || function keys(O) {
return $keys(O, enumBugKeys$1);
};
var dP$2 = _objectDp;
var anObject$2 = _anObject;
var getKeys = _objectKeys;
var _objectDps = _descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
anObject$2(O);
var keys = getKeys(Properties),
length = keys.length,
i = 0,
P;
while (length > i) {
dP$2.f(O, P = keys[i++], Properties[P]);
}return O;
};
var _html = _global.document && document.documentElement;
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
var anObject$1 = _anObject;
var dPs = _objectDps;
var enumBugKeys = _enumBugKeys;
var IE_PROTO = _sharedKey('IE_PROTO');
var Empty = function Empty() {/* empty */};
var PROTOTYPE$1 = 'prototype';
// Create object with fake `null` prototype: use iframe Object with cleared prototype
var _createDict = function createDict() {
// Thrash, waste and sodomy: IE GC bug
var iframe = _domCreate('iframe'),
i = enumBugKeys.length,
lt = '<',
gt = '>',
iframeDocument;
iframe.style.display = 'none';
_html.appendChild(iframe);
iframe.src = 'javascript:'; // eslint-disable-line no-script-url
// createDict = iframe.contentWindow.Object;
// html.removeChild(iframe);
iframeDocument = iframe.contentWindow.document;
iframeDocument.open();
iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
iframeDocument.close();
_createDict = iframeDocument.F;
while (i--) {
delete _createDict[PROTOTYPE$1][enumBugKeys[i]];
}return _createDict();
};
var _objectCreate = Object.create || function create(O, Properties) {
var result;
if (O !== null) {
Empty[PROTOTYPE$1] = anObject$1(O);
result = new Empty();
Empty[PROTOTYPE$1] = null;
// add "__proto__" for Object.getPrototypeOf polyfill
result[IE_PROTO] = O;
} else result = _createDict();
return Properties === undefined ? result : dPs(result, Properties);
};
var def = _objectDp.f;
var has$2 = _has;
var TAG$1 = _wks('toStringTag');
var _setToStringTag = function _setToStringTag(it, tag, stat) {
if (it && !has$2(it = stat ? it : it.prototype, TAG$1)) def(it, TAG$1, { configurable: true, value: tag });
};
var create$1 = _objectCreate;
var descriptor = _propertyDesc;
var setToStringTag$1 = _setToStringTag;
var IteratorPrototype = {};
// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
_hide(IteratorPrototype, _wks('iterator'), function () {
return this;
});
var _iterCreate = function _iterCreate(Constructor, NAME, next) {
Constructor.prototype = create$1(IteratorPrototype, { next: descriptor(1, next) });
setToStringTag$1(Constructor, NAME + ' Iterator');
};
// 7.1.13 ToObject(argument)
var defined$2 = _defined;
var _toObject = function _toObject(it) {
return Object(defined$2(it));
};
// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
var has$3 = _has;
var toObject = _toObject;
var IE_PROTO$2 = _sharedKey('IE_PROTO');
var ObjectProto = Object.prototype;
var _objectGpo = Object.getPrototypeOf || function (O) {
O = toObject(O);
if (has$3(O, IE_PROTO$2)) return O[IE_PROTO$2];
if (typeof O.constructor == 'function' && O instanceof O.constructor) {
return O.constructor.prototype;
}return O instanceof Object ? ObjectProto : null;
};
var LIBRARY = _library;
var $export = _export;
var redefine = _redefine;
var hide = _hide;
var has = _has;
var Iterators = _iterators;
var $iterCreate = _iterCreate;
var setToStringTag = _setToStringTag;
var getPrototypeOf = _objectGpo;
var ITERATOR = _wks('iterator');
var BUGGY = !([].keys && 'next' in [].keys());
var FF_ITERATOR = '@@iterator';
var KEYS = 'keys';
var VALUES = 'values';
var returnThis = function returnThis() {
return this;
};
var _iterDefine = function _iterDefine(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {
$iterCreate(Constructor, NAME, next);
var getMethod = function getMethod(kind) {
if (!BUGGY && kind in proto) return proto[kind];
switch (kind) {
case KEYS:
return function keys() {
return new Constructor(this, kind);
};
case VALUES:
return function values() {
return new Constructor(this, kind);
};
}return function entries() {
return new Constructor(this, kind);
};
};
var TAG = NAME + ' Iterator',
DEF_VALUES = DEFAULT == VALUES,
VALUES_BUG = false,
proto = Base.prototype,
$native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT],
$default = $native || getMethod(DEFAULT),
$entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined,
$anyNative = NAME == 'Array' ? proto.entries || $native : $native,
methods,
key,
IteratorPrototype;
// Fix native
if ($anyNative) {
IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));
if (IteratorPrototype !== Object.prototype) {
// Set @@toStringTag to native iterators
setToStringTag(IteratorPrototype, TAG, true);
// fix for some old engines
if (!LIBRARY && !has(IteratorPrototype, ITERATOR)) hide(IteratorPrototype, ITERATOR, returnThis);
}
}
// fix Array#{values, @@iterator}.name in V8 / FF
if (DEF_VALUES && $native && $native.name !== VALUES) {
VALUES_BUG = true;
$default = function values() {
return $native.call(this);
};
}
// Define iterator
if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {
hide(proto, ITERATOR, $default);
}
// Plug for library
Iterators[NAME] = $default;
Iterators[TAG] = returnThis;
if (DEFAULT) {
methods = {
values: DEF_VALUES ? $default : getMethod(VALUES),
keys: IS_SET ? $default : getMethod(KEYS),
entries: $entries
};
if (FORCED) for (key in methods) {
if (!(key in proto)) redefine(proto, key, methods[key]);
} else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
}
return methods;
};
var $at = _stringAt(true);
// 21.1.3.27 String.prototype[@@iterator]()
_iterDefine(String, 'String', function (iterated) {
this._t = String(iterated); // target
this._i = 0; // next index
// 21.1.5.2.1 %StringIteratorPrototype%.next()
}, function () {
var O = this._t,
index = this._i,
point;
if (index >= O.length) return { value: undefined, done: true };
point = $at(O, index);
this._i += point.length;
return { value: point, done: false };
});