@leapdev/auth-agent 2.3.0 → 2.3.1-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/index.umd.js CHANGED
@@ -4317,1844 +4317,1913 @@
4317
4317
  parseInt: $parseInt
4318
4318
  });
4319
4319
 
4320
- var _Notification_pubnubKeys, _Notification_pubnub, _Notification_eventListeners, _Notification_uniqueSessionTriggerHook, _Notification_userPresenceTriggerHook, _Notification_currentUUIDString, _Notification_joinTimeToken, _Notification_initFirmChannel, _Notification_initUserChannel, _Notification_initUniqueSessionChannel;
4321
- const EMPTY_GUID = '00000000-0000-0000-0000-000000000000';
4322
- const WEB_GUID = '1111111-1111-1111-1111-111111111111';
4323
- const USER_ACTION = {
4324
- USERNAME_CHANGED: '1',
4325
- PASSWORD_CHANGED: '2',
4326
- USER_DISABLED: '3',
4327
- WEB_RESTRICTED: '401'
4320
+ var uncurryThis$7 = functionUncurryThis;
4321
+ var toObject$3 = toObject$7;
4322
+
4323
+ var floor$2 = Math.floor;
4324
+ var charAt = uncurryThis$7(''.charAt);
4325
+ var replace = uncurryThis$7(''.replace);
4326
+ var stringSlice$2 = uncurryThis$7(''.slice);
4327
+ var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g;
4328
+ var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g;
4329
+
4330
+ // `GetSubstitution` abstract operation
4331
+ // https://tc39.es/ecma262/#sec-getsubstitution
4332
+ var getSubstitution$1 = function (matched, str, position, captures, namedCaptures, replacement) {
4333
+ var tailPos = position + matched.length;
4334
+ var m = captures.length;
4335
+ var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
4336
+ if (namedCaptures !== undefined) {
4337
+ namedCaptures = toObject$3(namedCaptures);
4338
+ symbols = SUBSTITUTION_SYMBOLS;
4339
+ }
4340
+ return replace(replacement, symbols, function (match, ch) {
4341
+ var capture;
4342
+ switch (charAt(ch, 0)) {
4343
+ case '$': return '$';
4344
+ case '&': return matched;
4345
+ case '`': return stringSlice$2(str, 0, position);
4346
+ case "'": return stringSlice$2(str, tailPos);
4347
+ case '<':
4348
+ capture = namedCaptures[stringSlice$2(ch, 1, -1)];
4349
+ break;
4350
+ default: // \d\d?
4351
+ var n = +ch;
4352
+ if (n === 0) return match;
4353
+ if (n > m) {
4354
+ var f = floor$2(n / 10);
4355
+ if (f === 0) return match;
4356
+ if (f <= m) return captures[f - 1] === undefined ? charAt(ch, 1) : captures[f - 1] + charAt(ch, 1);
4357
+ return match;
4358
+ }
4359
+ capture = captures[n - 1];
4360
+ }
4361
+ return capture === undefined ? '' : capture;
4362
+ });
4328
4363
  };
4329
- class Notification {
4330
- constructor() {
4331
- _Notification_pubnubKeys.set(this, void 0);
4332
4364
 
4333
- _Notification_pubnub.set(this, void 0);
4365
+ var apply$1 = functionApply;
4366
+ var call$3 = functionCall;
4367
+ var uncurryThis$6 = functionUncurryThis;
4368
+ var fixRegExpWellKnownSymbolLogic = fixRegexpWellKnownSymbolLogic;
4369
+ var fails$6 = fails$r;
4370
+ var anObject$1 = anObject$h;
4371
+ var isCallable$2 = isCallable$p;
4372
+ var toIntegerOrInfinity$3 = toIntegerOrInfinity$7;
4373
+ var toLength$6 = toLength$9;
4374
+ var toString$2 = toString$9;
4375
+ var requireObjectCoercible$2 = requireObjectCoercible$9;
4376
+ var advanceStringIndex = advanceStringIndex$2;
4377
+ var getMethod = getMethod$6;
4378
+ var getSubstitution = getSubstitution$1;
4379
+ var regExpExec = regexpExecAbstract;
4380
+ var wellKnownSymbol$3 = wellKnownSymbol$m;
4334
4381
 
4335
- _Notification_eventListeners.set(this, []);
4382
+ var REPLACE = wellKnownSymbol$3('replace');
4383
+ var max = Math.max;
4384
+ var min$2 = Math.min;
4385
+ var concat = uncurryThis$6([].concat);
4386
+ var push$1 = uncurryThis$6([].push);
4387
+ var stringIndexOf = uncurryThis$6(''.indexOf);
4388
+ var stringSlice$1 = uncurryThis$6(''.slice);
4336
4389
 
4337
- _Notification_uniqueSessionTriggerHook.set(this, undefined);
4390
+ var maybeToString = function (it) {
4391
+ return it === undefined ? it : String(it);
4392
+ };
4338
4393
 
4339
- _Notification_userPresenceTriggerHook.set(this, undefined);
4394
+ // IE <= 11 replaces $0 with the whole match, as if it was $&
4395
+ // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
4396
+ var REPLACE_KEEPS_$0 = (function () {
4397
+ // eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing
4398
+ return 'a'.replace(/./, '$0') === '$0';
4399
+ })();
4340
4400
 
4341
- _Notification_currentUUIDString.set(this, '');
4401
+ // Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
4402
+ var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
4403
+ if (/./[REPLACE]) {
4404
+ return /./[REPLACE]('a', '$0') === '';
4405
+ }
4406
+ return false;
4407
+ })();
4342
4408
 
4343
- _Notification_joinTimeToken.set(this, 0);
4409
+ var REPLACE_SUPPORTS_NAMED_GROUPS = !fails$6(function () {
4410
+ var re = /./;
4411
+ re.exec = function () {
4412
+ var result = [];
4413
+ result.groups = { a: '7' };
4414
+ return result;
4415
+ };
4416
+ // eslint-disable-next-line regexp/no-useless-dollar-replacements -- false positive
4417
+ return ''.replace(re, '$<a>') !== '7';
4418
+ });
4344
4419
 
4345
- this.init = params => __awaiter(this, void 0, void 0, function* () {
4346
- const {
4347
- authHost,
4348
- clientId,
4349
- firmId,
4350
- userId,
4351
- uniqueSession,
4352
- userPresence,
4353
- listenToRestrictWebFlag,
4354
- hooks
4355
- } = params;
4420
+ // @@replace logic
4421
+ fixRegExpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNative) {
4422
+ var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';
4356
4423
 
4357
- if (!!hooks && hooks.uniqueSessionTrigger) {
4358
- __classPrivateFieldSet(this, _Notification_uniqueSessionTriggerHook, hooks.uniqueSessionTrigger, "f");
4359
- }
4424
+ return [
4425
+ // `String.prototype.replace` method
4426
+ // https://tc39.es/ecma262/#sec-string.prototype.replace
4427
+ function replace(searchValue, replaceValue) {
4428
+ var O = requireObjectCoercible$2(this);
4429
+ var replacer = searchValue == undefined ? undefined : getMethod(searchValue, REPLACE);
4430
+ return replacer
4431
+ ? call$3(replacer, searchValue, O, replaceValue)
4432
+ : call$3(nativeReplace, toString$2(O), searchValue, replaceValue);
4433
+ },
4434
+ // `RegExp.prototype[@@replace]` method
4435
+ // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
4436
+ function (string, replaceValue) {
4437
+ var rx = anObject$1(this);
4438
+ var S = toString$2(string);
4360
4439
 
4361
- if (!!hooks && hooks.userPresenceTrigger) {
4362
- __classPrivateFieldSet(this, _Notification_userPresenceTriggerHook, hooks.userPresenceTrigger, "f");
4440
+ if (
4441
+ typeof replaceValue == 'string' &&
4442
+ stringIndexOf(replaceValue, UNSAFE_SUBSTITUTE) === -1 &&
4443
+ stringIndexOf(replaceValue, '$<') === -1
4444
+ ) {
4445
+ var res = maybeCallNative(nativeReplace, rx, S, replaceValue);
4446
+ if (res.done) return res.value;
4363
4447
  }
4364
4448
 
4365
- __classPrivateFieldSet(this, _Notification_currentUUIDString, `${userId}~${WEB_GUID}~~${Math.floor(Math.random() * 100 + 1)}`, "f");
4366
-
4367
- if (userPresence) {
4368
- __classPrivateFieldGet(this, _Notification_pubnub, "f").setUUID(__classPrivateFieldGet(this, _Notification_currentUUIDString, "f"));
4449
+ var functionalReplace = isCallable$2(replaceValue);
4450
+ if (!functionalReplace) replaceValue = toString$2(replaceValue);
4369
4451
 
4370
- __classPrivateFieldGet(this, _Notification_pubnubKeys, "f").uuid = __classPrivateFieldGet(this, _Notification_currentUUIDString, "f");
4452
+ var global = rx.global;
4453
+ if (global) {
4454
+ var fullUnicode = rx.unicode;
4455
+ rx.lastIndex = 0;
4371
4456
  }
4457
+ var results = [];
4458
+ while (true) {
4459
+ var result = regExpExec(rx, S);
4460
+ if (result === null) break;
4372
4461
 
4373
- __classPrivateFieldGet(this, _Notification_initFirmChannel, "f").call(this, {
4374
- firmId,
4375
- userId,
4376
- userPresence,
4377
- listenToRestrictWebFlag
4378
- });
4379
-
4380
- __classPrivateFieldGet(this, _Notification_initUserChannel, "f").call(this, userId);
4462
+ push$1(results, result);
4463
+ if (!global) break;
4381
4464
 
4382
- if (uniqueSession) {
4383
- yield __classPrivateFieldGet(this, _Notification_initUniqueSessionChannel, "f").call(this, {
4384
- authHost,
4385
- clientId
4386
- });
4465
+ var matchStr = toString$2(result[0]);
4466
+ if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength$6(rx.lastIndex), fullUnicode);
4387
4467
  }
4388
- });
4389
4468
 
4390
- this.destroy = () => {
4391
- if (__classPrivateFieldGet(this, _Notification_pubnub, "f")) {
4392
- __classPrivateFieldGet(this, _Notification_pubnub, "f").unsubscribeAll();
4469
+ var accumulatedResult = '';
4470
+ var nextSourcePosition = 0;
4471
+ for (var i = 0; i < results.length; i++) {
4472
+ result = results[i];
4393
4473
 
4394
- __classPrivateFieldSet(this, _Notification_eventListeners, [], "f");
4474
+ var matched = toString$2(result[0]);
4475
+ var position = max(min$2(toIntegerOrInfinity$3(result.index), S.length), 0);
4476
+ var captures = [];
4477
+ // NOTE: This is equivalent to
4478
+ // captures = result.slice(1).map(maybeToString)
4479
+ // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
4480
+ // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
4481
+ // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
4482
+ for (var j = 1; j < result.length; j++) push$1(captures, maybeToString(result[j]));
4483
+ var namedCaptures = result.groups;
4484
+ if (functionalReplace) {
4485
+ var replacerArgs = concat([matched], captures, position, S);
4486
+ if (namedCaptures !== undefined) push$1(replacerArgs, namedCaptures);
4487
+ var replacement = toString$2(apply$1(replaceValue, undefined, replacerArgs));
4488
+ } else {
4489
+ replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
4490
+ }
4491
+ if (position >= nextSourcePosition) {
4492
+ accumulatedResult += stringSlice$1(S, nextSourcePosition, position) + replacement;
4493
+ nextSourcePosition = position + matched.length;
4494
+ }
4395
4495
  }
4396
- };
4496
+ return accumulatedResult + stringSlice$1(S, nextSourcePosition);
4497
+ }
4498
+ ];
4499
+ }, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);
4397
4500
 
4398
- this.registerEventListenerForUserChannel = params => {
4399
- const {
4400
- topic,
4401
- messageType,
4402
- callback
4403
- } = params;
4501
+ // eslint-disable-next-line es-x/no-typed-arrays -- safe
4502
+ var arrayBufferNative = typeof ArrayBuffer != 'undefined' && typeof DataView != 'undefined';
4404
4503
 
4405
- if (!lodash.isFunction(callback)) {
4406
- throw Error(`Registering Event Listener ${topic} ${messageType}: callback needs to be a function`);
4407
- }
4504
+ var global$d = global$W;
4505
+ var toIntegerOrInfinity$2 = toIntegerOrInfinity$7;
4506
+ var toLength$5 = toLength$9;
4408
4507
 
4409
- __classPrivateFieldGet(this, _Notification_eventListeners, "f").push({
4410
- topic,
4411
- messageType,
4412
- callback
4413
- });
4414
- };
4508
+ var RangeError$5 = global$d.RangeError;
4415
4509
 
4416
- this.setUniqueSessionTriggerHook = hook => {
4417
- __classPrivateFieldSet(this, _Notification_uniqueSessionTriggerHook, hook, "f");
4418
- };
4510
+ // `ToIndex` abstract operation
4511
+ // https://tc39.es/ecma262/#sec-toindex
4512
+ var toIndex$2 = function (it) {
4513
+ if (it === undefined) return 0;
4514
+ var number = toIntegerOrInfinity$2(it);
4515
+ var length = toLength$5(number);
4516
+ if (number !== length) throw RangeError$5('Wrong length or index');
4517
+ return length;
4518
+ };
4419
4519
 
4420
- this.setUserPresenceTriggerHook = hook => {
4421
- __classPrivateFieldSet(this, _Notification_userPresenceTriggerHook, hook, "f");
4422
- };
4520
+ // IEEE754 conversions based on https://github.com/feross/ieee754
4521
+ var global$c = global$W;
4423
4522
 
4424
- _Notification_initFirmChannel.set(this, params => {
4425
- const {
4426
- firmId,
4427
- userId,
4428
- userPresence,
4429
- listenToRestrictWebFlag
4430
- } = params;
4523
+ var Array$3 = global$c.Array;
4524
+ var abs = Math.abs;
4525
+ var pow = Math.pow;
4526
+ var floor$1 = Math.floor;
4527
+ var log = Math.log;
4528
+ var LN2 = Math.LN2;
4431
4529
 
4432
- __classPrivateFieldGet(this, _Notification_pubnub, "f").addListener({
4433
- presence: presenceEvent => {
4434
- const {
4435
- action,
4436
- uuid,
4437
- timetoken
4438
- } = presenceEvent;
4530
+ var pack = function (number, mantissaLength, bytes) {
4531
+ var buffer = Array$3(bytes);
4532
+ var exponentLength = bytes * 8 - mantissaLength - 1;
4533
+ var eMax = (1 << exponentLength) - 1;
4534
+ var eBias = eMax >> 1;
4535
+ var rt = mantissaLength === 23 ? pow(2, -24) - pow(2, -77) : 0;
4536
+ var sign = number < 0 || number === 0 && 1 / number < 0 ? 1 : 0;
4537
+ var index = 0;
4538
+ var exponent, mantissa, c;
4539
+ number = abs(number);
4540
+ // eslint-disable-next-line no-self-compare -- NaN check
4541
+ if (number != number || number === Infinity) {
4542
+ // eslint-disable-next-line no-self-compare -- NaN check
4543
+ mantissa = number != number ? 1 : 0;
4544
+ exponent = eMax;
4545
+ } else {
4546
+ exponent = floor$1(log(number) / LN2);
4547
+ c = pow(2, -exponent);
4548
+ if (number * c < 1) {
4549
+ exponent--;
4550
+ c *= 2;
4551
+ }
4552
+ if (exponent + eBias >= 1) {
4553
+ number += rt / c;
4554
+ } else {
4555
+ number += rt * pow(2, 1 - eBias);
4556
+ }
4557
+ if (number * c >= 2) {
4558
+ exponent++;
4559
+ c /= 2;
4560
+ }
4561
+ if (exponent + eBias >= eMax) {
4562
+ mantissa = 0;
4563
+ exponent = eMax;
4564
+ } else if (exponent + eBias >= 1) {
4565
+ mantissa = (number * c - 1) * pow(2, mantissaLength);
4566
+ exponent = exponent + eBias;
4567
+ } else {
4568
+ mantissa = number * pow(2, eBias - 1) * pow(2, mantissaLength);
4569
+ exponent = 0;
4570
+ }
4571
+ }
4572
+ while (mantissaLength >= 8) {
4573
+ buffer[index++] = mantissa & 255;
4574
+ mantissa /= 256;
4575
+ mantissaLength -= 8;
4576
+ }
4577
+ exponent = exponent << mantissaLength | mantissa;
4578
+ exponentLength += mantissaLength;
4579
+ while (exponentLength > 0) {
4580
+ buffer[index++] = exponent & 255;
4581
+ exponent /= 256;
4582
+ exponentLength -= 8;
4583
+ }
4584
+ buffer[--index] |= sign * 128;
4585
+ return buffer;
4586
+ };
4439
4587
 
4440
- if (uuid === __classPrivateFieldGet(this, _Notification_pubnubKeys, "f").uuid) {
4441
- return;
4442
- }
4588
+ var unpack = function (buffer, mantissaLength) {
4589
+ var bytes = buffer.length;
4590
+ var exponentLength = bytes * 8 - mantissaLength - 1;
4591
+ var eMax = (1 << exponentLength) - 1;
4592
+ var eBias = eMax >> 1;
4593
+ var nBits = exponentLength - 7;
4594
+ var index = bytes - 1;
4595
+ var sign = buffer[index--];
4596
+ var exponent = sign & 127;
4597
+ var mantissa;
4598
+ sign >>= 7;
4599
+ while (nBits > 0) {
4600
+ exponent = exponent * 256 + buffer[index--];
4601
+ nBits -= 8;
4602
+ }
4603
+ mantissa = exponent & (1 << -nBits) - 1;
4604
+ exponent >>= -nBits;
4605
+ nBits += mantissaLength;
4606
+ while (nBits > 0) {
4607
+ mantissa = mantissa * 256 + buffer[index--];
4608
+ nBits -= 8;
4609
+ }
4610
+ if (exponent === 0) {
4611
+ exponent = 1 - eBias;
4612
+ } else if (exponent === eMax) {
4613
+ return mantissa ? NaN : sign ? -Infinity : Infinity;
4614
+ } else {
4615
+ mantissa = mantissa + pow(2, mantissaLength);
4616
+ exponent = exponent - eBias;
4617
+ } return (sign ? -1 : 1) * mantissa * pow(2, exponent - mantissaLength);
4618
+ };
4443
4619
 
4444
- const valuesUUID = uuid.split('~');
4445
- const userIdFromPresence = valuesUUID[0] || '';
4446
- const instanceGuidFromPresence = valuesUUID[1] || '';
4447
- let timeTokenPresence = 0;
4620
+ var ieee754 = {
4621
+ pack: pack,
4622
+ unpack: unpack
4623
+ };
4448
4624
 
4449
- try {
4450
- timeTokenPresence = parseInt(timetoken);
4451
- } catch (e) {
4452
- timeTokenPresence = 0;
4453
- }
4625
+ var toObject$2 = toObject$7;
4626
+ var toAbsoluteIndex$1 = toAbsoluteIndex$4;
4627
+ var lengthOfArrayLike$3 = lengthOfArrayLike$7;
4454
4628
 
4455
- if (userPresence && action === 'join' && userIdFromPresence === userId && instanceGuidFromPresence !== WEB_GUID && instanceGuidFromPresence !== EMPTY_GUID && __classPrivateFieldGet(this, _Notification_joinTimeToken, "f") < timeTokenPresence) {
4456
- if (!!__classPrivateFieldGet(this, _Notification_userPresenceTriggerHook, "f") && lodash.isFunction(__classPrivateFieldGet(this, _Notification_userPresenceTriggerHook, "f"))) {
4457
- __classPrivateFieldGet(this, _Notification_userPresenceTriggerHook, "f").call(this);
4458
- } else {
4459
- AuthAgent.logout(true);
4460
- }
4629
+ // `Array.prototype.fill` method implementation
4630
+ // https://tc39.es/ecma262/#sec-array.prototype.fill
4631
+ var arrayFill$1 = function fill(value /* , start = 0, end = @length */) {
4632
+ var O = toObject$2(this);
4633
+ var length = lengthOfArrayLike$3(O);
4634
+ var argumentsLength = arguments.length;
4635
+ var index = toAbsoluteIndex$1(argumentsLength > 1 ? arguments[1] : undefined, length);
4636
+ var end = argumentsLength > 2 ? arguments[2] : undefined;
4637
+ var endPos = end === undefined ? length : toAbsoluteIndex$1(end, length);
4638
+ while (endPos > index) O[index++] = value;
4639
+ return O;
4640
+ };
4461
4641
 
4462
- return;
4463
- }
4642
+ var global$b = global$W;
4643
+ var uncurryThis$5 = functionUncurryThis;
4644
+ var DESCRIPTORS$2 = descriptors;
4645
+ var NATIVE_ARRAY_BUFFER$1 = arrayBufferNative;
4646
+ var FunctionName = functionName;
4647
+ var createNonEnumerableProperty$2 = createNonEnumerableProperty$9;
4648
+ var defineBuiltIns = defineBuiltIns$2;
4649
+ var fails$5 = fails$r;
4650
+ var anInstance$1 = anInstance$4;
4651
+ var toIntegerOrInfinity$1 = toIntegerOrInfinity$7;
4652
+ var toLength$4 = toLength$9;
4653
+ var toIndex$1 = toIndex$2;
4654
+ var IEEE754 = ieee754;
4655
+ var getPrototypeOf$1 = objectGetPrototypeOf;
4656
+ var setPrototypeOf$3 = objectSetPrototypeOf;
4657
+ var getOwnPropertyNames$1 = objectGetOwnPropertyNames.f;
4658
+ var defineProperty$1 = objectDefineProperty.f;
4659
+ var arrayFill = arrayFill$1;
4660
+ var arraySlice$1 = arraySliceSimple;
4661
+ var setToStringTag = setToStringTag$5;
4662
+ var InternalStateModule$1 = internalState;
4464
4663
 
4465
- if (listenToRestrictWebFlag && action === 'join' && userIdFromPresence === userId && instanceGuidFromPresence === EMPTY_GUID && __classPrivateFieldGet(this, _Notification_joinTimeToken, "f") < timeTokenPresence) {
4466
- AuthAgent.logout(true);
4467
- return;
4468
- }
4664
+ var PROPER_FUNCTION_NAME = FunctionName.PROPER;
4665
+ var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
4666
+ var getInternalState$1 = InternalStateModule$1.get;
4667
+ var setInternalState$1 = InternalStateModule$1.set;
4668
+ var ARRAY_BUFFER = 'ArrayBuffer';
4669
+ var DATA_VIEW = 'DataView';
4670
+ var PROTOTYPE = 'prototype';
4671
+ var WRONG_LENGTH$1 = 'Wrong length';
4672
+ var WRONG_INDEX = 'Wrong index';
4673
+ var NativeArrayBuffer = global$b[ARRAY_BUFFER];
4674
+ var $ArrayBuffer = NativeArrayBuffer;
4675
+ var ArrayBufferPrototype$1 = $ArrayBuffer && $ArrayBuffer[PROTOTYPE];
4676
+ var $DataView = global$b[DATA_VIEW];
4677
+ var DataViewPrototype$1 = $DataView && $DataView[PROTOTYPE];
4678
+ var ObjectPrototype$1 = Object.prototype;
4679
+ var Array$2 = global$b.Array;
4680
+ var RangeError$4 = global$b.RangeError;
4681
+ var fill = uncurryThis$5(arrayFill);
4682
+ var reverse = uncurryThis$5([].reverse);
4469
4683
 
4470
- if (action === 'leave' || action === 'timeout') {
4471
- const userActionFromPresence = valuesUUID[2] || '';
4472
- const isUserActionRequiredLogout = userActionFromPresence === USER_ACTION.USERNAME_CHANGED || userActionFromPresence === USER_ACTION.PASSWORD_CHANGED || userActionFromPresence === USER_ACTION.USER_DISABLED;
4684
+ var packIEEE754 = IEEE754.pack;
4685
+ var unpackIEEE754 = IEEE754.unpack;
4473
4686
 
4474
- if (userIdFromPresence === userId && instanceGuidFromPresence === EMPTY_GUID && isUserActionRequiredLogout) {
4475
- AuthAgent.logout(true);
4476
- }
4477
- }
4478
- }
4479
- });
4687
+ var packInt8 = function (number) {
4688
+ return [number & 0xFF];
4689
+ };
4480
4690
 
4481
- __classPrivateFieldGet(this, _Notification_pubnub, "f").time((result, response) => {
4482
- __classPrivateFieldSet(this, _Notification_joinTimeToken, response.timetoken, "f");
4691
+ var packInt16 = function (number) {
4692
+ return [number & 0xFF, number >> 8 & 0xFF];
4693
+ };
4483
4694
 
4484
- __classPrivateFieldGet(this, _Notification_pubnub, "f").setState({
4485
- state: {
4486
- joinTimeToken: __classPrivateFieldGet(this, _Notification_joinTimeToken, "f")
4487
- },
4488
- channels: [firmId]
4489
- });
4695
+ var packInt32 = function (number) {
4696
+ return [number & 0xFF, number >> 8 & 0xFF, number >> 16 & 0xFF, number >> 24 & 0xFF];
4697
+ };
4490
4698
 
4491
- __classPrivateFieldGet(this, _Notification_pubnub, "f").subscribe({
4492
- channels: [firmId],
4493
- withPresence: true
4494
- });
4495
- });
4496
- });
4699
+ var unpackInt32 = function (buffer) {
4700
+ return buffer[3] << 24 | buffer[2] << 16 | buffer[1] << 8 | buffer[0];
4701
+ };
4497
4702
 
4498
- _Notification_initUserChannel.set(this, userId => {
4499
- __classPrivateFieldGet(this, _Notification_pubnub, "f").addListener({
4500
- message: data => {
4501
- const {
4502
- content
4503
- } = data.message;
4703
+ var packFloat32 = function (number) {
4704
+ return packIEEE754(number, 23, 4);
4705
+ };
4504
4706
 
4505
- if (content && content.topic && content.messageType && content.data) {
4506
- for (const eventListener of __classPrivateFieldGet(this, _Notification_eventListeners, "f")) {
4507
- if (eventListener.topic === content.topic && eventListener.messageType === content.messageType && eventListener.callback && lodash.isFunction(eventListener.callback)) {
4508
- return eventListener.callback(content.data);
4509
- }
4510
- }
4511
- }
4512
- }
4513
- });
4707
+ var packFloat64 = function (number) {
4708
+ return packIEEE754(number, 52, 8);
4709
+ };
4514
4710
 
4515
- __classPrivateFieldGet(this, _Notification_pubnub, "f").subscribe({
4516
- channels: [`user_${userId}`],
4517
- withPresence: false
4518
- });
4519
- });
4711
+ var addGetter$1 = function (Constructor, key) {
4712
+ defineProperty$1(Constructor[PROTOTYPE], key, { get: function () { return getInternalState$1(this)[key]; } });
4713
+ };
4520
4714
 
4521
- _Notification_initUniqueSessionChannel.set(this, params => __awaiter(this, void 0, void 0, function* () {
4522
- const decodedToken = yield AuthAgent.getDecodedAccessToken();
4523
- const {
4524
- authHost: myAuthHost,
4525
- clientId: myClientId
4526
- } = params;
4527
- const {
4528
- userId: myUserId,
4529
- sessionId: mySessionId,
4530
- impersonatorId: myImpersonatorId
4531
- } = decodedToken;
4532
-
4533
- if (!decodedToken) {
4534
- return;
4535
- }
4715
+ var get = function (view, count, index, isLittleEndian) {
4716
+ var intIndex = toIndex$1(index);
4717
+ var store = getInternalState$1(view);
4718
+ if (intIndex + count > store.byteLength) throw RangeError$4(WRONG_INDEX);
4719
+ var bytes = getInternalState$1(store.buffer).bytes;
4720
+ var start = intIndex + store.byteOffset;
4721
+ var pack = arraySlice$1(bytes, start, start + count);
4722
+ return isLittleEndian ? pack : reverse(pack);
4723
+ };
4536
4724
 
4537
- const channel = `auth-session-${myUserId}`;
4725
+ var set = function (view, count, index, conversion, value, isLittleEndian) {
4726
+ var intIndex = toIndex$1(index);
4727
+ var store = getInternalState$1(view);
4728
+ if (intIndex + count > store.byteLength) throw RangeError$4(WRONG_INDEX);
4729
+ var bytes = getInternalState$1(store.buffer).bytes;
4730
+ var start = intIndex + store.byteOffset;
4731
+ var pack = conversion(+value);
4732
+ for (var i = 0; i < count; i++) bytes[start + i] = pack[isLittleEndian ? i : count - i - 1];
4733
+ };
4538
4734
 
4539
- __classPrivateFieldGet(this, _Notification_pubnub, "f").addListener({
4540
- message: data => __awaiter(this, void 0, void 0, function* () {
4541
- const decodedToken = yield AuthAgent.getDecodedAccessToken();
4735
+ if (!NATIVE_ARRAY_BUFFER$1) {
4736
+ $ArrayBuffer = function ArrayBuffer(length) {
4737
+ anInstance$1(this, ArrayBufferPrototype$1);
4738
+ var byteLength = toIndex$1(length);
4739
+ setInternalState$1(this, {
4740
+ bytes: fill(Array$2(byteLength), 0),
4741
+ byteLength: byteLength
4742
+ });
4743
+ if (!DESCRIPTORS$2) this.byteLength = byteLength;
4744
+ };
4542
4745
 
4543
- if (!decodedToken) {
4544
- AuthAgent.logout(true);
4545
- }
4746
+ ArrayBufferPrototype$1 = $ArrayBuffer[PROTOTYPE];
4546
4747
 
4547
- const {
4548
- sessionId: mySessionId,
4549
- impersonatorId: myImpersonatorId,
4550
- userId: myUserId
4551
- } = decodedToken;
4552
- const myAgentId = localStorage.getItem('leap-auth-agent-id');
4748
+ $DataView = function DataView(buffer, byteOffset, byteLength) {
4749
+ anInstance$1(this, DataViewPrototype$1);
4750
+ anInstance$1(buffer, ArrayBufferPrototype$1);
4751
+ var bufferLength = getInternalState$1(buffer).byteLength;
4752
+ var offset = toIntegerOrInfinity$1(byteOffset);
4753
+ if (offset < 0 || offset > bufferLength) throw RangeError$4('Wrong offset');
4754
+ byteLength = byteLength === undefined ? bufferLength - offset : toLength$4(byteLength);
4755
+ if (offset + byteLength > bufferLength) throw RangeError$4(WRONG_LENGTH$1);
4756
+ setInternalState$1(this, {
4757
+ buffer: buffer,
4758
+ byteLength: byteLength,
4759
+ byteOffset: offset
4760
+ });
4761
+ if (!DESCRIPTORS$2) {
4762
+ this.buffer = buffer;
4763
+ this.byteLength = byteLength;
4764
+ this.byteOffset = offset;
4765
+ }
4766
+ };
4553
4767
 
4554
- if (myAgentId && data && data.message) {
4555
- const sessionId = data.message.sessionId,
4556
- authHost = data.message.authHost,
4557
- clientId = data.message.clientId,
4558
- logout = data.message.logout;
4559
- data.message.agentId;
4560
- const impersonatorId = myImpersonatorId ? myImpersonatorId : data.message.impersonatorId;
4768
+ DataViewPrototype$1 = $DataView[PROTOTYPE];
4561
4769
 
4562
- if (authHost === myAuthHost) {
4563
- if (clientId === myClientId && sessionId !== mySessionId || clientId !== myClientId && sessionId === mySessionId && logout) {
4564
- if (impersonatorId !== undefined && impersonatorId !== '') {
4565
- console.log('user ' + impersonatorId + ' impersonating user ' + myUserId);
4566
- } else {
4567
- if (!!__classPrivateFieldGet(this, _Notification_uniqueSessionTriggerHook, "f") && lodash.isFunction(__classPrivateFieldGet(this, _Notification_uniqueSessionTriggerHook, "f"))) {
4568
- __classPrivateFieldGet(this, _Notification_uniqueSessionTriggerHook, "f").call(this);
4569
- } else {
4570
- AuthAgent.logout(true);
4571
- }
4572
- }
4573
- }
4574
- }
4575
- }
4576
- })
4577
- });
4770
+ if (DESCRIPTORS$2) {
4771
+ addGetter$1($ArrayBuffer, 'byteLength');
4772
+ addGetter$1($DataView, 'buffer');
4773
+ addGetter$1($DataView, 'byteLength');
4774
+ addGetter$1($DataView, 'byteOffset');
4775
+ }
4578
4776
 
4579
- __classPrivateFieldGet(this, _Notification_pubnub, "f").subscribe({
4580
- channels: [channel],
4581
- withPresence: true
4582
- });
4777
+ defineBuiltIns(DataViewPrototype$1, {
4778
+ getInt8: function getInt8(byteOffset) {
4779
+ return get(this, 1, byteOffset)[0] << 24 >> 24;
4780
+ },
4781
+ getUint8: function getUint8(byteOffset) {
4782
+ return get(this, 1, byteOffset)[0];
4783
+ },
4784
+ getInt16: function getInt16(byteOffset /* , littleEndian */) {
4785
+ var bytes = get(this, 2, byteOffset, arguments.length > 1 ? arguments[1] : undefined);
4786
+ return (bytes[1] << 8 | bytes[0]) << 16 >> 16;
4787
+ },
4788
+ getUint16: function getUint16(byteOffset /* , littleEndian */) {
4789
+ var bytes = get(this, 2, byteOffset, arguments.length > 1 ? arguments[1] : undefined);
4790
+ return bytes[1] << 8 | bytes[0];
4791
+ },
4792
+ getInt32: function getInt32(byteOffset /* , littleEndian */) {
4793
+ return unpackInt32(get(this, 4, byteOffset, arguments.length > 1 ? arguments[1] : undefined));
4794
+ },
4795
+ getUint32: function getUint32(byteOffset /* , littleEndian */) {
4796
+ return unpackInt32(get(this, 4, byteOffset, arguments.length > 1 ? arguments[1] : undefined)) >>> 0;
4797
+ },
4798
+ getFloat32: function getFloat32(byteOffset /* , littleEndian */) {
4799
+ return unpackIEEE754(get(this, 4, byteOffset, arguments.length > 1 ? arguments[1] : undefined), 23);
4800
+ },
4801
+ getFloat64: function getFloat64(byteOffset /* , littleEndian */) {
4802
+ return unpackIEEE754(get(this, 8, byteOffset, arguments.length > 1 ? arguments[1] : undefined), 52);
4803
+ },
4804
+ setInt8: function setInt8(byteOffset, value) {
4805
+ set(this, 1, byteOffset, packInt8, value);
4806
+ },
4807
+ setUint8: function setUint8(byteOffset, value) {
4808
+ set(this, 1, byteOffset, packInt8, value);
4809
+ },
4810
+ setInt16: function setInt16(byteOffset, value /* , littleEndian */) {
4811
+ set(this, 2, byteOffset, packInt16, value, arguments.length > 2 ? arguments[2] : undefined);
4812
+ },
4813
+ setUint16: function setUint16(byteOffset, value /* , littleEndian */) {
4814
+ set(this, 2, byteOffset, packInt16, value, arguments.length > 2 ? arguments[2] : undefined);
4815
+ },
4816
+ setInt32: function setInt32(byteOffset, value /* , littleEndian */) {
4817
+ set(this, 4, byteOffset, packInt32, value, arguments.length > 2 ? arguments[2] : undefined);
4818
+ },
4819
+ setUint32: function setUint32(byteOffset, value /* , littleEndian */) {
4820
+ set(this, 4, byteOffset, packInt32, value, arguments.length > 2 ? arguments[2] : undefined);
4821
+ },
4822
+ setFloat32: function setFloat32(byteOffset, value /* , littleEndian */) {
4823
+ set(this, 4, byteOffset, packFloat32, value, arguments.length > 2 ? arguments[2] : undefined);
4824
+ },
4825
+ setFloat64: function setFloat64(byteOffset, value /* , littleEndian */) {
4826
+ set(this, 8, byteOffset, packFloat64, value, arguments.length > 2 ? arguments[2] : undefined);
4827
+ }
4828
+ });
4829
+ } else {
4830
+ var INCORRECT_ARRAY_BUFFER_NAME = PROPER_FUNCTION_NAME && NativeArrayBuffer.name !== ARRAY_BUFFER;
4831
+ /* eslint-disable no-new -- required for testing */
4832
+ if (!fails$5(function () {
4833
+ NativeArrayBuffer(1);
4834
+ }) || !fails$5(function () {
4835
+ new NativeArrayBuffer(-1);
4836
+ }) || fails$5(function () {
4837
+ new NativeArrayBuffer();
4838
+ new NativeArrayBuffer(1.5);
4839
+ new NativeArrayBuffer(NaN);
4840
+ return INCORRECT_ARRAY_BUFFER_NAME && !CONFIGURABLE_FUNCTION_NAME;
4841
+ })) {
4842
+ /* eslint-enable no-new -- required for testing */
4843
+ $ArrayBuffer = function ArrayBuffer(length) {
4844
+ anInstance$1(this, ArrayBufferPrototype$1);
4845
+ return new NativeArrayBuffer(toIndex$1(length));
4846
+ };
4583
4847
 
4584
- let agentId = localStorage.getItem('leap-auth-agent-id');
4848
+ $ArrayBuffer[PROTOTYPE] = ArrayBufferPrototype$1;
4585
4849
 
4586
- if (!agentId) {
4587
- agentId = uuid.v4();
4588
- localStorage.setItem('leap-auth-agent-id', agentId);
4850
+ for (var keys = getOwnPropertyNames$1(NativeArrayBuffer), j = 0, key; keys.length > j;) {
4851
+ if (!((key = keys[j++]) in $ArrayBuffer)) {
4852
+ createNonEnumerableProperty$2($ArrayBuffer, key, NativeArrayBuffer[key]);
4589
4853
  }
4854
+ }
4590
4855
 
4591
- __classPrivateFieldGet(this, _Notification_pubnub, "f").publish({
4592
- message: {
4593
- authHost: myAuthHost,
4594
- clientId: myClientId,
4595
- sessionId: mySessionId,
4596
- agentId: agentId,
4597
- impersonatorId: myImpersonatorId
4598
- },
4599
- channel: channel
4600
- }, status => {
4601
- if (status.error) {
4602
- console.log('pubnub error');
4603
- }
4604
- });
4605
- }));
4606
-
4607
- __classPrivateFieldSet(this, _Notification_pubnubKeys, {
4608
- publishKey: 'pub-13f5288e-cd88-4ef9-9e68-0c11cd03ddb8',
4609
- subscribeKey: 'sub-a456f002-0095-11e2-9638-9581afc33ebf',
4610
- uuid: uuid.v4()
4611
- }, "f");
4856
+ ArrayBufferPrototype$1.constructor = $ArrayBuffer;
4857
+ } else if (INCORRECT_ARRAY_BUFFER_NAME && CONFIGURABLE_FUNCTION_NAME) {
4858
+ createNonEnumerableProperty$2(NativeArrayBuffer, 'name', ARRAY_BUFFER);
4859
+ }
4612
4860
 
4613
- __classPrivateFieldSet(this, _Notification_pubnub, new Pubnub__default["default"](__classPrivateFieldGet(this, _Notification_pubnubKeys, "f")), "f");
4861
+ // WebKit bug - the same parent prototype for typed arrays and data view
4862
+ if (setPrototypeOf$3 && getPrototypeOf$1(DataViewPrototype$1) !== ObjectPrototype$1) {
4863
+ setPrototypeOf$3(DataViewPrototype$1, ObjectPrototype$1);
4614
4864
  }
4615
4865
 
4866
+ // iOS Safari 7.x bug
4867
+ var testView = new $DataView(new $ArrayBuffer(2));
4868
+ var $setInt8 = uncurryThis$5(DataViewPrototype$1.setInt8);
4869
+ testView.setInt8(0, 2147483648);
4870
+ testView.setInt8(1, 2147483649);
4871
+ if (testView.getInt8(0) || !testView.getInt8(1)) defineBuiltIns(DataViewPrototype$1, {
4872
+ setInt8: function setInt8(byteOffset, value) {
4873
+ $setInt8(this, byteOffset, value << 24 >> 24);
4874
+ },
4875
+ setUint8: function setUint8(byteOffset, value) {
4876
+ $setInt8(this, byteOffset, value << 24 >> 24);
4877
+ }
4878
+ }, { unsafe: true });
4616
4879
  }
4617
- _Notification_pubnubKeys = new WeakMap(), _Notification_pubnub = new WeakMap(), _Notification_eventListeners = new WeakMap(), _Notification_uniqueSessionTriggerHook = new WeakMap(), _Notification_userPresenceTriggerHook = new WeakMap(), _Notification_currentUUIDString = new WeakMap(), _Notification_joinTimeToken = new WeakMap(), _Notification_initFirmChannel = new WeakMap(), _Notification_initUserChannel = new WeakMap(), _Notification_initUniqueSessionChannel = new WeakMap();
4618
4880
 
4619
- var uncurryThis$7 = functionUncurryThis;
4620
- var toObject$3 = toObject$7;
4881
+ setToStringTag($ArrayBuffer, ARRAY_BUFFER);
4882
+ setToStringTag($DataView, DATA_VIEW);
4621
4883
 
4622
- var floor$2 = Math.floor;
4623
- var charAt = uncurryThis$7(''.charAt);
4624
- var replace = uncurryThis$7(''.replace);
4625
- var stringSlice$2 = uncurryThis$7(''.slice);
4626
- var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g;
4627
- var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g;
4884
+ var arrayBuffer = {
4885
+ ArrayBuffer: $ArrayBuffer,
4886
+ DataView: $DataView
4887
+ };
4628
4888
 
4629
- // `GetSubstitution` abstract operation
4630
- // https://tc39.es/ecma262/#sec-getsubstitution
4631
- var getSubstitution$1 = function (matched, str, position, captures, namedCaptures, replacement) {
4632
- var tailPos = position + matched.length;
4633
- var m = captures.length;
4634
- var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
4635
- if (namedCaptures !== undefined) {
4636
- namedCaptures = toObject$3(namedCaptures);
4637
- symbols = SUBSTITUTION_SYMBOLS;
4638
- }
4639
- return replace(replacement, symbols, function (match, ch) {
4640
- var capture;
4641
- switch (charAt(ch, 0)) {
4642
- case '$': return '$';
4643
- case '&': return matched;
4644
- case '`': return stringSlice$2(str, 0, position);
4645
- case "'": return stringSlice$2(str, tailPos);
4646
- case '<':
4647
- capture = namedCaptures[stringSlice$2(ch, 1, -1)];
4648
- break;
4649
- default: // \d\d?
4650
- var n = +ch;
4651
- if (n === 0) return match;
4652
- if (n > m) {
4653
- var f = floor$2(n / 10);
4654
- if (f === 0) return match;
4655
- if (f <= m) return captures[f - 1] === undefined ? charAt(ch, 1) : captures[f - 1] + charAt(ch, 1);
4656
- return match;
4657
- }
4658
- capture = captures[n - 1];
4659
- }
4660
- return capture === undefined ? '' : capture;
4661
- });
4662
- };
4663
-
4664
- var apply$1 = functionApply;
4665
- var call$3 = functionCall;
4666
- var uncurryThis$6 = functionUncurryThis;
4667
- var fixRegExpWellKnownSymbolLogic = fixRegexpWellKnownSymbolLogic;
4668
- var fails$6 = fails$r;
4669
- var anObject$1 = anObject$h;
4670
- var isCallable$2 = isCallable$p;
4671
- var toIntegerOrInfinity$3 = toIntegerOrInfinity$7;
4672
- var toLength$6 = toLength$9;
4673
- var toString$2 = toString$9;
4674
- var requireObjectCoercible$2 = requireObjectCoercible$9;
4675
- var advanceStringIndex = advanceStringIndex$2;
4676
- var getMethod = getMethod$6;
4677
- var getSubstitution = getSubstitution$1;
4678
- var regExpExec = regexpExecAbstract;
4679
- var wellKnownSymbol$3 = wellKnownSymbol$m;
4680
-
4681
- var REPLACE = wellKnownSymbol$3('replace');
4682
- var max = Math.max;
4683
- var min$2 = Math.min;
4684
- var concat = uncurryThis$6([].concat);
4685
- var push$1 = uncurryThis$6([].push);
4686
- var stringIndexOf = uncurryThis$6(''.indexOf);
4687
- var stringSlice$1 = uncurryThis$6(''.slice);
4889
+ var $$3 = _export;
4890
+ var uncurryThis$4 = functionUncurryThis;
4891
+ var fails$4 = fails$r;
4892
+ var ArrayBufferModule$1 = arrayBuffer;
4893
+ var anObject = anObject$h;
4894
+ var toAbsoluteIndex = toAbsoluteIndex$4;
4895
+ var toLength$3 = toLength$9;
4896
+ var speciesConstructor = speciesConstructor$3;
4688
4897
 
4689
- var maybeToString = function (it) {
4690
- return it === undefined ? it : String(it);
4691
- };
4898
+ var ArrayBuffer$3 = ArrayBufferModule$1.ArrayBuffer;
4899
+ var DataView$2 = ArrayBufferModule$1.DataView;
4900
+ var DataViewPrototype = DataView$2.prototype;
4901
+ var un$ArrayBufferSlice = uncurryThis$4(ArrayBuffer$3.prototype.slice);
4902
+ var getUint8 = uncurryThis$4(DataViewPrototype.getUint8);
4903
+ var setUint8 = uncurryThis$4(DataViewPrototype.setUint8);
4692
4904
 
4693
- // IE <= 11 replaces $0 with the whole match, as if it was $&
4694
- // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
4695
- var REPLACE_KEEPS_$0 = (function () {
4696
- // eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing
4697
- return 'a'.replace(/./, '$0') === '$0';
4698
- })();
4905
+ var INCORRECT_SLICE = fails$4(function () {
4906
+ return !new ArrayBuffer$3(2).slice(1, undefined).byteLength;
4907
+ });
4699
4908
 
4700
- // Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
4701
- var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
4702
- if (/./[REPLACE]) {
4703
- return /./[REPLACE]('a', '$0') === '';
4909
+ // `ArrayBuffer.prototype.slice` method
4910
+ // https://tc39.es/ecma262/#sec-arraybuffer.prototype.slice
4911
+ $$3({ target: 'ArrayBuffer', proto: true, unsafe: true, forced: INCORRECT_SLICE }, {
4912
+ slice: function slice(start, end) {
4913
+ if (un$ArrayBufferSlice && end === undefined) {
4914
+ return un$ArrayBufferSlice(anObject(this), start); // FF fix
4915
+ }
4916
+ var length = anObject(this).byteLength;
4917
+ var first = toAbsoluteIndex(start, length);
4918
+ var fin = toAbsoluteIndex(end === undefined ? length : end, length);
4919
+ var result = new (speciesConstructor(this, ArrayBuffer$3))(toLength$3(fin - first));
4920
+ var viewSource = new DataView$2(this);
4921
+ var viewTarget = new DataView$2(result);
4922
+ var index = 0;
4923
+ while (first < fin) {
4924
+ setUint8(viewTarget, index++, getUint8(viewSource, first++));
4925
+ } return result;
4704
4926
  }
4705
- return false;
4706
- })();
4707
-
4708
- var REPLACE_SUPPORTS_NAMED_GROUPS = !fails$6(function () {
4709
- var re = /./;
4710
- re.exec = function () {
4711
- var result = [];
4712
- result.groups = { a: '7' };
4713
- return result;
4714
- };
4715
- // eslint-disable-next-line regexp/no-useless-dollar-replacements -- false positive
4716
- return ''.replace(re, '$<a>') !== '7';
4717
4927
  });
4718
4928
 
4719
- // @@replace logic
4720
- fixRegExpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNative) {
4721
- var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';
4722
-
4723
- return [
4724
- // `String.prototype.replace` method
4725
- // https://tc39.es/ecma262/#sec-string.prototype.replace
4726
- function replace(searchValue, replaceValue) {
4727
- var O = requireObjectCoercible$2(this);
4728
- var replacer = searchValue == undefined ? undefined : getMethod(searchValue, REPLACE);
4729
- return replacer
4730
- ? call$3(replacer, searchValue, O, replaceValue)
4731
- : call$3(nativeReplace, toString$2(O), searchValue, replaceValue);
4732
- },
4733
- // `RegExp.prototype[@@replace]` method
4734
- // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
4735
- function (string, replaceValue) {
4736
- var rx = anObject$1(this);
4737
- var S = toString$2(string);
4738
-
4739
- if (
4740
- typeof replaceValue == 'string' &&
4741
- stringIndexOf(replaceValue, UNSAFE_SUBSTITUTE) === -1 &&
4742
- stringIndexOf(replaceValue, '$<') === -1
4743
- ) {
4744
- var res = maybeCallNative(nativeReplace, rx, S, replaceValue);
4745
- if (res.done) return res.value;
4746
- }
4929
+ var typedArrayConstructor = {exports: {}};
4747
4930
 
4748
- var functionalReplace = isCallable$2(replaceValue);
4749
- if (!functionalReplace) replaceValue = toString$2(replaceValue);
4931
+ var NATIVE_ARRAY_BUFFER = arrayBufferNative;
4932
+ var DESCRIPTORS$1 = descriptors;
4933
+ var global$a = global$W;
4934
+ var isCallable$1 = isCallable$p;
4935
+ var isObject$4 = isObject$e;
4936
+ var hasOwn$1 = hasOwnProperty_1;
4937
+ var classof$2 = classof$a;
4938
+ var tryToString = tryToString$5;
4939
+ var createNonEnumerableProperty$1 = createNonEnumerableProperty$9;
4940
+ var defineBuiltIn = defineBuiltIn$9;
4941
+ var defineProperty = objectDefineProperty.f;
4942
+ var isPrototypeOf$1 = objectIsPrototypeOf;
4943
+ var getPrototypeOf = objectGetPrototypeOf;
4944
+ var setPrototypeOf$2 = objectSetPrototypeOf;
4945
+ var wellKnownSymbol$2 = wellKnownSymbol$m;
4946
+ var uid = uid$3;
4750
4947
 
4751
- var global = rx.global;
4752
- if (global) {
4753
- var fullUnicode = rx.unicode;
4754
- rx.lastIndex = 0;
4755
- }
4756
- var results = [];
4757
- while (true) {
4758
- var result = regExpExec(rx, S);
4759
- if (result === null) break;
4948
+ var Int8Array$3 = global$a.Int8Array;
4949
+ var Int8ArrayPrototype$1 = Int8Array$3 && Int8Array$3.prototype;
4950
+ var Uint8ClampedArray$1 = global$a.Uint8ClampedArray;
4951
+ var Uint8ClampedArrayPrototype = Uint8ClampedArray$1 && Uint8ClampedArray$1.prototype;
4952
+ var TypedArray$1 = Int8Array$3 && getPrototypeOf(Int8Array$3);
4953
+ var TypedArrayPrototype$1 = Int8ArrayPrototype$1 && getPrototypeOf(Int8ArrayPrototype$1);
4954
+ var ObjectPrototype = Object.prototype;
4955
+ var TypeError$2 = global$a.TypeError;
4760
4956
 
4761
- push$1(results, result);
4762
- if (!global) break;
4957
+ var TO_STRING_TAG = wellKnownSymbol$2('toStringTag');
4958
+ var TYPED_ARRAY_TAG$1 = uid('TYPED_ARRAY_TAG');
4959
+ var TYPED_ARRAY_CONSTRUCTOR$1 = uid('TYPED_ARRAY_CONSTRUCTOR');
4960
+ // Fixing native typed arrays in Opera Presto crashes the browser, see #595
4961
+ var NATIVE_ARRAY_BUFFER_VIEWS$2 = NATIVE_ARRAY_BUFFER && !!setPrototypeOf$2 && classof$2(global$a.opera) !== 'Opera';
4962
+ var TYPED_ARRAY_TAG_REQUIRED = false;
4963
+ var NAME, Constructor, Prototype;
4763
4964
 
4764
- var matchStr = toString$2(result[0]);
4765
- if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength$6(rx.lastIndex), fullUnicode);
4766
- }
4965
+ var TypedArrayConstructorsList = {
4966
+ Int8Array: 1,
4967
+ Uint8Array: 1,
4968
+ Uint8ClampedArray: 1,
4969
+ Int16Array: 2,
4970
+ Uint16Array: 2,
4971
+ Int32Array: 4,
4972
+ Uint32Array: 4,
4973
+ Float32Array: 4,
4974
+ Float64Array: 8
4975
+ };
4767
4976
 
4768
- var accumulatedResult = '';
4769
- var nextSourcePosition = 0;
4770
- for (var i = 0; i < results.length; i++) {
4771
- result = results[i];
4977
+ var BigIntArrayConstructorsList = {
4978
+ BigInt64Array: 8,
4979
+ BigUint64Array: 8
4980
+ };
4772
4981
 
4773
- var matched = toString$2(result[0]);
4774
- var position = max(min$2(toIntegerOrInfinity$3(result.index), S.length), 0);
4775
- var captures = [];
4776
- // NOTE: This is equivalent to
4777
- // captures = result.slice(1).map(maybeToString)
4778
- // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
4779
- // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
4780
- // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
4781
- for (var j = 1; j < result.length; j++) push$1(captures, maybeToString(result[j]));
4782
- var namedCaptures = result.groups;
4783
- if (functionalReplace) {
4784
- var replacerArgs = concat([matched], captures, position, S);
4785
- if (namedCaptures !== undefined) push$1(replacerArgs, namedCaptures);
4786
- var replacement = toString$2(apply$1(replaceValue, undefined, replacerArgs));
4787
- } else {
4788
- replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
4789
- }
4790
- if (position >= nextSourcePosition) {
4791
- accumulatedResult += stringSlice$1(S, nextSourcePosition, position) + replacement;
4792
- nextSourcePosition = position + matched.length;
4793
- }
4794
- }
4795
- return accumulatedResult + stringSlice$1(S, nextSourcePosition);
4796
- }
4797
- ];
4798
- }, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);
4982
+ var isView = function isView(it) {
4983
+ if (!isObject$4(it)) return false;
4984
+ var klass = classof$2(it);
4985
+ return klass === 'DataView'
4986
+ || hasOwn$1(TypedArrayConstructorsList, klass)
4987
+ || hasOwn$1(BigIntArrayConstructorsList, klass);
4988
+ };
4799
4989
 
4800
- // eslint-disable-next-line es-x/no-typed-arrays -- safe
4801
- var arrayBufferNative = typeof ArrayBuffer != 'undefined' && typeof DataView != 'undefined';
4990
+ var isTypedArray$1 = function (it) {
4991
+ if (!isObject$4(it)) return false;
4992
+ var klass = classof$2(it);
4993
+ return hasOwn$1(TypedArrayConstructorsList, klass)
4994
+ || hasOwn$1(BigIntArrayConstructorsList, klass);
4995
+ };
4802
4996
 
4803
- var global$d = global$W;
4804
- var toIntegerOrInfinity$2 = toIntegerOrInfinity$7;
4805
- var toLength$5 = toLength$9;
4997
+ var aTypedArray$3 = function (it) {
4998
+ if (isTypedArray$1(it)) return it;
4999
+ throw TypeError$2('Target is not a typed array');
5000
+ };
4806
5001
 
4807
- var RangeError$5 = global$d.RangeError;
5002
+ var aTypedArrayConstructor$2 = function (C) {
5003
+ if (isCallable$1(C) && (!setPrototypeOf$2 || isPrototypeOf$1(TypedArray$1, C))) return C;
5004
+ throw TypeError$2(tryToString(C) + ' is not a typed array constructor');
5005
+ };
4808
5006
 
4809
- // `ToIndex` abstract operation
4810
- // https://tc39.es/ecma262/#sec-toindex
4811
- var toIndex$2 = function (it) {
4812
- if (it === undefined) return 0;
4813
- var number = toIntegerOrInfinity$2(it);
4814
- var length = toLength$5(number);
4815
- if (number !== length) throw RangeError$5('Wrong length or index');
4816
- return length;
4817
- };
4818
-
4819
- // IEEE754 conversions based on https://github.com/feross/ieee754
4820
- var global$c = global$W;
4821
-
4822
- var Array$3 = global$c.Array;
4823
- var abs = Math.abs;
4824
- var pow = Math.pow;
4825
- var floor$1 = Math.floor;
4826
- var log = Math.log;
4827
- var LN2 = Math.LN2;
4828
-
4829
- var pack = function (number, mantissaLength, bytes) {
4830
- var buffer = Array$3(bytes);
4831
- var exponentLength = bytes * 8 - mantissaLength - 1;
4832
- var eMax = (1 << exponentLength) - 1;
4833
- var eBias = eMax >> 1;
4834
- var rt = mantissaLength === 23 ? pow(2, -24) - pow(2, -77) : 0;
4835
- var sign = number < 0 || number === 0 && 1 / number < 0 ? 1 : 0;
4836
- var index = 0;
4837
- var exponent, mantissa, c;
4838
- number = abs(number);
4839
- // eslint-disable-next-line no-self-compare -- NaN check
4840
- if (number != number || number === Infinity) {
4841
- // eslint-disable-next-line no-self-compare -- NaN check
4842
- mantissa = number != number ? 1 : 0;
4843
- exponent = eMax;
4844
- } else {
4845
- exponent = floor$1(log(number) / LN2);
4846
- c = pow(2, -exponent);
4847
- if (number * c < 1) {
4848
- exponent--;
4849
- c *= 2;
4850
- }
4851
- if (exponent + eBias >= 1) {
4852
- number += rt / c;
4853
- } else {
4854
- number += rt * pow(2, 1 - eBias);
4855
- }
4856
- if (number * c >= 2) {
4857
- exponent++;
4858
- c /= 2;
4859
- }
4860
- if (exponent + eBias >= eMax) {
4861
- mantissa = 0;
4862
- exponent = eMax;
4863
- } else if (exponent + eBias >= 1) {
4864
- mantissa = (number * c - 1) * pow(2, mantissaLength);
4865
- exponent = exponent + eBias;
4866
- } else {
4867
- mantissa = number * pow(2, eBias - 1) * pow(2, mantissaLength);
4868
- exponent = 0;
5007
+ var exportTypedArrayMethod$3 = function (KEY, property, forced, options) {
5008
+ if (!DESCRIPTORS$1) return;
5009
+ if (forced) for (var ARRAY in TypedArrayConstructorsList) {
5010
+ var TypedArrayConstructor = global$a[ARRAY];
5011
+ if (TypedArrayConstructor && hasOwn$1(TypedArrayConstructor.prototype, KEY)) try {
5012
+ delete TypedArrayConstructor.prototype[KEY];
5013
+ } catch (error) {
5014
+ // old WebKit bug - some methods are non-configurable
5015
+ try {
5016
+ TypedArrayConstructor.prototype[KEY] = property;
5017
+ } catch (error2) { /* empty */ }
4869
5018
  }
4870
5019
  }
4871
- while (mantissaLength >= 8) {
4872
- buffer[index++] = mantissa & 255;
4873
- mantissa /= 256;
4874
- mantissaLength -= 8;
4875
- }
4876
- exponent = exponent << mantissaLength | mantissa;
4877
- exponentLength += mantissaLength;
4878
- while (exponentLength > 0) {
4879
- buffer[index++] = exponent & 255;
4880
- exponent /= 256;
4881
- exponentLength -= 8;
5020
+ if (!TypedArrayPrototype$1[KEY] || forced) {
5021
+ defineBuiltIn(TypedArrayPrototype$1, KEY, forced ? property
5022
+ : NATIVE_ARRAY_BUFFER_VIEWS$2 && Int8ArrayPrototype$1[KEY] || property, options);
4882
5023
  }
4883
- buffer[--index] |= sign * 128;
4884
- return buffer;
4885
5024
  };
4886
5025
 
4887
- var unpack = function (buffer, mantissaLength) {
4888
- var bytes = buffer.length;
4889
- var exponentLength = bytes * 8 - mantissaLength - 1;
4890
- var eMax = (1 << exponentLength) - 1;
4891
- var eBias = eMax >> 1;
4892
- var nBits = exponentLength - 7;
4893
- var index = bytes - 1;
4894
- var sign = buffer[index--];
4895
- var exponent = sign & 127;
4896
- var mantissa;
4897
- sign >>= 7;
4898
- while (nBits > 0) {
4899
- exponent = exponent * 256 + buffer[index--];
4900
- nBits -= 8;
5026
+ var exportTypedArrayStaticMethod = function (KEY, property, forced) {
5027
+ var ARRAY, TypedArrayConstructor;
5028
+ if (!DESCRIPTORS$1) return;
5029
+ if (setPrototypeOf$2) {
5030
+ if (forced) for (ARRAY in TypedArrayConstructorsList) {
5031
+ TypedArrayConstructor = global$a[ARRAY];
5032
+ if (TypedArrayConstructor && hasOwn$1(TypedArrayConstructor, KEY)) try {
5033
+ delete TypedArrayConstructor[KEY];
5034
+ } catch (error) { /* empty */ }
5035
+ }
5036
+ if (!TypedArray$1[KEY] || forced) {
5037
+ // V8 ~ Chrome 49-50 `%TypedArray%` methods are non-writable non-configurable
5038
+ try {
5039
+ return defineBuiltIn(TypedArray$1, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS$2 && TypedArray$1[KEY] || property);
5040
+ } catch (error) { /* empty */ }
5041
+ } else return;
4901
5042
  }
4902
- mantissa = exponent & (1 << -nBits) - 1;
4903
- exponent >>= -nBits;
4904
- nBits += mantissaLength;
4905
- while (nBits > 0) {
4906
- mantissa = mantissa * 256 + buffer[index--];
4907
- nBits -= 8;
5043
+ for (ARRAY in TypedArrayConstructorsList) {
5044
+ TypedArrayConstructor = global$a[ARRAY];
5045
+ if (TypedArrayConstructor && (!TypedArrayConstructor[KEY] || forced)) {
5046
+ defineBuiltIn(TypedArrayConstructor, KEY, property);
5047
+ }
4908
5048
  }
4909
- if (exponent === 0) {
4910
- exponent = 1 - eBias;
4911
- } else if (exponent === eMax) {
4912
- return mantissa ? NaN : sign ? -Infinity : Infinity;
4913
- } else {
4914
- mantissa = mantissa + pow(2, mantissaLength);
4915
- exponent = exponent - eBias;
4916
- } return (sign ? -1 : 1) * mantissa * pow(2, exponent - mantissaLength);
4917
- };
4918
-
4919
- var ieee754 = {
4920
- pack: pack,
4921
- unpack: unpack
4922
5049
  };
4923
5050
 
4924
- var toObject$2 = toObject$7;
4925
- var toAbsoluteIndex$1 = toAbsoluteIndex$4;
4926
- var lengthOfArrayLike$3 = lengthOfArrayLike$7;
5051
+ for (NAME in TypedArrayConstructorsList) {
5052
+ Constructor = global$a[NAME];
5053
+ Prototype = Constructor && Constructor.prototype;
5054
+ if (Prototype) createNonEnumerableProperty$1(Prototype, TYPED_ARRAY_CONSTRUCTOR$1, Constructor);
5055
+ else NATIVE_ARRAY_BUFFER_VIEWS$2 = false;
5056
+ }
4927
5057
 
4928
- // `Array.prototype.fill` method implementation
4929
- // https://tc39.es/ecma262/#sec-array.prototype.fill
4930
- var arrayFill$1 = function fill(value /* , start = 0, end = @length */) {
4931
- var O = toObject$2(this);
4932
- var length = lengthOfArrayLike$3(O);
4933
- var argumentsLength = arguments.length;
4934
- var index = toAbsoluteIndex$1(argumentsLength > 1 ? arguments[1] : undefined, length);
4935
- var end = argumentsLength > 2 ? arguments[2] : undefined;
4936
- var endPos = end === undefined ? length : toAbsoluteIndex$1(end, length);
4937
- while (endPos > index) O[index++] = value;
4938
- return O;
4939
- };
5058
+ for (NAME in BigIntArrayConstructorsList) {
5059
+ Constructor = global$a[NAME];
5060
+ Prototype = Constructor && Constructor.prototype;
5061
+ if (Prototype) createNonEnumerableProperty$1(Prototype, TYPED_ARRAY_CONSTRUCTOR$1, Constructor);
5062
+ }
4940
5063
 
4941
- var global$b = global$W;
4942
- var uncurryThis$5 = functionUncurryThis;
4943
- var DESCRIPTORS$2 = descriptors;
4944
- var NATIVE_ARRAY_BUFFER$1 = arrayBufferNative;
4945
- var FunctionName = functionName;
4946
- var createNonEnumerableProperty$2 = createNonEnumerableProperty$9;
4947
- var defineBuiltIns = defineBuiltIns$2;
4948
- var fails$5 = fails$r;
4949
- var anInstance$1 = anInstance$4;
4950
- var toIntegerOrInfinity$1 = toIntegerOrInfinity$7;
4951
- var toLength$4 = toLength$9;
4952
- var toIndex$1 = toIndex$2;
4953
- var IEEE754 = ieee754;
4954
- var getPrototypeOf$1 = objectGetPrototypeOf;
4955
- var setPrototypeOf$3 = objectSetPrototypeOf;
4956
- var getOwnPropertyNames$1 = objectGetOwnPropertyNames.f;
4957
- var defineProperty$1 = objectDefineProperty.f;
4958
- var arrayFill = arrayFill$1;
4959
- var arraySlice$1 = arraySliceSimple;
4960
- var setToStringTag = setToStringTag$5;
4961
- var InternalStateModule$1 = internalState;
5064
+ // WebKit bug - typed arrays constructors prototype is Object.prototype
5065
+ if (!NATIVE_ARRAY_BUFFER_VIEWS$2 || !isCallable$1(TypedArray$1) || TypedArray$1 === Function.prototype) {
5066
+ // eslint-disable-next-line no-shadow -- safe
5067
+ TypedArray$1 = function TypedArray() {
5068
+ throw TypeError$2('Incorrect invocation');
5069
+ };
5070
+ if (NATIVE_ARRAY_BUFFER_VIEWS$2) for (NAME in TypedArrayConstructorsList) {
5071
+ if (global$a[NAME]) setPrototypeOf$2(global$a[NAME], TypedArray$1);
5072
+ }
5073
+ }
4962
5074
 
4963
- var PROPER_FUNCTION_NAME = FunctionName.PROPER;
4964
- var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
4965
- var getInternalState$1 = InternalStateModule$1.get;
4966
- var setInternalState$1 = InternalStateModule$1.set;
4967
- var ARRAY_BUFFER = 'ArrayBuffer';
4968
- var DATA_VIEW = 'DataView';
4969
- var PROTOTYPE = 'prototype';
4970
- var WRONG_LENGTH$1 = 'Wrong length';
4971
- var WRONG_INDEX = 'Wrong index';
4972
- var NativeArrayBuffer = global$b[ARRAY_BUFFER];
4973
- var $ArrayBuffer = NativeArrayBuffer;
4974
- var ArrayBufferPrototype$1 = $ArrayBuffer && $ArrayBuffer[PROTOTYPE];
4975
- var $DataView = global$b[DATA_VIEW];
4976
- var DataViewPrototype$1 = $DataView && $DataView[PROTOTYPE];
4977
- var ObjectPrototype$1 = Object.prototype;
4978
- var Array$2 = global$b.Array;
4979
- var RangeError$4 = global$b.RangeError;
4980
- var fill = uncurryThis$5(arrayFill);
4981
- var reverse = uncurryThis$5([].reverse);
5075
+ if (!NATIVE_ARRAY_BUFFER_VIEWS$2 || !TypedArrayPrototype$1 || TypedArrayPrototype$1 === ObjectPrototype) {
5076
+ TypedArrayPrototype$1 = TypedArray$1.prototype;
5077
+ if (NATIVE_ARRAY_BUFFER_VIEWS$2) for (NAME in TypedArrayConstructorsList) {
5078
+ if (global$a[NAME]) setPrototypeOf$2(global$a[NAME].prototype, TypedArrayPrototype$1);
5079
+ }
5080
+ }
4982
5081
 
4983
- var packIEEE754 = IEEE754.pack;
4984
- var unpackIEEE754 = IEEE754.unpack;
5082
+ // WebKit bug - one more object in Uint8ClampedArray prototype chain
5083
+ if (NATIVE_ARRAY_BUFFER_VIEWS$2 && getPrototypeOf(Uint8ClampedArrayPrototype) !== TypedArrayPrototype$1) {
5084
+ setPrototypeOf$2(Uint8ClampedArrayPrototype, TypedArrayPrototype$1);
5085
+ }
4985
5086
 
4986
- var packInt8 = function (number) {
4987
- return [number & 0xFF];
4988
- };
5087
+ if (DESCRIPTORS$1 && !hasOwn$1(TypedArrayPrototype$1, TO_STRING_TAG)) {
5088
+ TYPED_ARRAY_TAG_REQUIRED = true;
5089
+ defineProperty(TypedArrayPrototype$1, TO_STRING_TAG, { get: function () {
5090
+ return isObject$4(this) ? this[TYPED_ARRAY_TAG$1] : undefined;
5091
+ } });
5092
+ for (NAME in TypedArrayConstructorsList) if (global$a[NAME]) {
5093
+ createNonEnumerableProperty$1(global$a[NAME], TYPED_ARRAY_TAG$1, NAME);
5094
+ }
5095
+ }
4989
5096
 
4990
- var packInt16 = function (number) {
4991
- return [number & 0xFF, number >> 8 & 0xFF];
5097
+ var arrayBufferViewCore = {
5098
+ NATIVE_ARRAY_BUFFER_VIEWS: NATIVE_ARRAY_BUFFER_VIEWS$2,
5099
+ TYPED_ARRAY_CONSTRUCTOR: TYPED_ARRAY_CONSTRUCTOR$1,
5100
+ TYPED_ARRAY_TAG: TYPED_ARRAY_TAG_REQUIRED && TYPED_ARRAY_TAG$1,
5101
+ aTypedArray: aTypedArray$3,
5102
+ aTypedArrayConstructor: aTypedArrayConstructor$2,
5103
+ exportTypedArrayMethod: exportTypedArrayMethod$3,
5104
+ exportTypedArrayStaticMethod: exportTypedArrayStaticMethod,
5105
+ isView: isView,
5106
+ isTypedArray: isTypedArray$1,
5107
+ TypedArray: TypedArray$1,
5108
+ TypedArrayPrototype: TypedArrayPrototype$1
4992
5109
  };
4993
5110
 
4994
- var packInt32 = function (number) {
4995
- return [number & 0xFF, number >> 8 & 0xFF, number >> 16 & 0xFF, number >> 24 & 0xFF];
4996
- };
5111
+ /* eslint-disable no-new -- required for testing */
4997
5112
 
4998
- var unpackInt32 = function (buffer) {
4999
- return buffer[3] << 24 | buffer[2] << 16 | buffer[1] << 8 | buffer[0];
5000
- };
5113
+ var global$9 = global$W;
5114
+ var fails$3 = fails$r;
5115
+ var checkCorrectnessOfIteration = checkCorrectnessOfIteration$2;
5116
+ var NATIVE_ARRAY_BUFFER_VIEWS$1 = arrayBufferViewCore.NATIVE_ARRAY_BUFFER_VIEWS;
5001
5117
 
5002
- var packFloat32 = function (number) {
5003
- return packIEEE754(number, 23, 4);
5004
- };
5118
+ var ArrayBuffer$2 = global$9.ArrayBuffer;
5119
+ var Int8Array$2 = global$9.Int8Array;
5005
5120
 
5006
- var packFloat64 = function (number) {
5007
- return packIEEE754(number, 52, 8);
5008
- };
5121
+ var typedArrayConstructorsRequireWrappers = !NATIVE_ARRAY_BUFFER_VIEWS$1 || !fails$3(function () {
5122
+ Int8Array$2(1);
5123
+ }) || !fails$3(function () {
5124
+ new Int8Array$2(-1);
5125
+ }) || !checkCorrectnessOfIteration(function (iterable) {
5126
+ new Int8Array$2();
5127
+ new Int8Array$2(null);
5128
+ new Int8Array$2(1.5);
5129
+ new Int8Array$2(iterable);
5130
+ }, true) || fails$3(function () {
5131
+ // Safari (11+) bug - a reason why even Safari 13 should load a typed array polyfill
5132
+ return new Int8Array$2(new ArrayBuffer$2(2), 1, undefined).length !== 1;
5133
+ });
5009
5134
 
5010
- var addGetter$1 = function (Constructor, key) {
5011
- defineProperty$1(Constructor[PROTOTYPE], key, { get: function () { return getInternalState$1(this)[key]; } });
5012
- };
5135
+ var isObject$3 = isObject$e;
5013
5136
 
5014
- var get = function (view, count, index, isLittleEndian) {
5015
- var intIndex = toIndex$1(index);
5016
- var store = getInternalState$1(view);
5017
- if (intIndex + count > store.byteLength) throw RangeError$4(WRONG_INDEX);
5018
- var bytes = getInternalState$1(store.buffer).bytes;
5019
- var start = intIndex + store.byteOffset;
5020
- var pack = arraySlice$1(bytes, start, start + count);
5021
- return isLittleEndian ? pack : reverse(pack);
5022
- };
5137
+ var floor = Math.floor;
5023
5138
 
5024
- var set = function (view, count, index, conversion, value, isLittleEndian) {
5025
- var intIndex = toIndex$1(index);
5026
- var store = getInternalState$1(view);
5027
- if (intIndex + count > store.byteLength) throw RangeError$4(WRONG_INDEX);
5028
- var bytes = getInternalState$1(store.buffer).bytes;
5029
- var start = intIndex + store.byteOffset;
5030
- var pack = conversion(+value);
5031
- for (var i = 0; i < count; i++) bytes[start + i] = pack[isLittleEndian ? i : count - i - 1];
5139
+ // `IsIntegralNumber` abstract operation
5140
+ // https://tc39.es/ecma262/#sec-isintegralnumber
5141
+ // eslint-disable-next-line es-x/no-number-isinteger -- safe
5142
+ var isIntegralNumber$1 = Number.isInteger || function isInteger(it) {
5143
+ return !isObject$3(it) && isFinite(it) && floor(it) === it;
5032
5144
  };
5033
5145
 
5034
- if (!NATIVE_ARRAY_BUFFER$1) {
5035
- $ArrayBuffer = function ArrayBuffer(length) {
5036
- anInstance$1(this, ArrayBufferPrototype$1);
5037
- var byteLength = toIndex$1(length);
5038
- setInternalState$1(this, {
5039
- bytes: fill(Array$2(byteLength), 0),
5040
- byteLength: byteLength
5041
- });
5042
- if (!DESCRIPTORS$2) this.byteLength = byteLength;
5043
- };
5146
+ var global$8 = global$W;
5147
+ var toIntegerOrInfinity = toIntegerOrInfinity$7;
5044
5148
 
5045
- ArrayBufferPrototype$1 = $ArrayBuffer[PROTOTYPE];
5149
+ var RangeError$3 = global$8.RangeError;
5046
5150
 
5047
- $DataView = function DataView(buffer, byteOffset, byteLength) {
5048
- anInstance$1(this, DataViewPrototype$1);
5049
- anInstance$1(buffer, ArrayBufferPrototype$1);
5050
- var bufferLength = getInternalState$1(buffer).byteLength;
5051
- var offset = toIntegerOrInfinity$1(byteOffset);
5052
- if (offset < 0 || offset > bufferLength) throw RangeError$4('Wrong offset');
5053
- byteLength = byteLength === undefined ? bufferLength - offset : toLength$4(byteLength);
5054
- if (offset + byteLength > bufferLength) throw RangeError$4(WRONG_LENGTH$1);
5055
- setInternalState$1(this, {
5056
- buffer: buffer,
5057
- byteLength: byteLength,
5058
- byteOffset: offset
5059
- });
5060
- if (!DESCRIPTORS$2) {
5061
- this.buffer = buffer;
5062
- this.byteLength = byteLength;
5063
- this.byteOffset = offset;
5064
- }
5065
- };
5151
+ var toPositiveInteger$1 = function (it) {
5152
+ var result = toIntegerOrInfinity(it);
5153
+ if (result < 0) throw RangeError$3("The argument can't be less than 0");
5154
+ return result;
5155
+ };
5066
5156
 
5067
- DataViewPrototype$1 = $DataView[PROTOTYPE];
5157
+ var global$7 = global$W;
5158
+ var toPositiveInteger = toPositiveInteger$1;
5068
5159
 
5069
- if (DESCRIPTORS$2) {
5070
- addGetter$1($ArrayBuffer, 'byteLength');
5071
- addGetter$1($DataView, 'buffer');
5072
- addGetter$1($DataView, 'byteLength');
5073
- addGetter$1($DataView, 'byteOffset');
5074
- }
5160
+ var RangeError$2 = global$7.RangeError;
5075
5161
 
5076
- defineBuiltIns(DataViewPrototype$1, {
5077
- getInt8: function getInt8(byteOffset) {
5078
- return get(this, 1, byteOffset)[0] << 24 >> 24;
5079
- },
5080
- getUint8: function getUint8(byteOffset) {
5081
- return get(this, 1, byteOffset)[0];
5082
- },
5083
- getInt16: function getInt16(byteOffset /* , littleEndian */) {
5084
- var bytes = get(this, 2, byteOffset, arguments.length > 1 ? arguments[1] : undefined);
5085
- return (bytes[1] << 8 | bytes[0]) << 16 >> 16;
5086
- },
5087
- getUint16: function getUint16(byteOffset /* , littleEndian */) {
5088
- var bytes = get(this, 2, byteOffset, arguments.length > 1 ? arguments[1] : undefined);
5089
- return bytes[1] << 8 | bytes[0];
5090
- },
5091
- getInt32: function getInt32(byteOffset /* , littleEndian */) {
5092
- return unpackInt32(get(this, 4, byteOffset, arguments.length > 1 ? arguments[1] : undefined));
5093
- },
5094
- getUint32: function getUint32(byteOffset /* , littleEndian */) {
5095
- return unpackInt32(get(this, 4, byteOffset, arguments.length > 1 ? arguments[1] : undefined)) >>> 0;
5096
- },
5097
- getFloat32: function getFloat32(byteOffset /* , littleEndian */) {
5098
- return unpackIEEE754(get(this, 4, byteOffset, arguments.length > 1 ? arguments[1] : undefined), 23);
5099
- },
5100
- getFloat64: function getFloat64(byteOffset /* , littleEndian */) {
5101
- return unpackIEEE754(get(this, 8, byteOffset, arguments.length > 1 ? arguments[1] : undefined), 52);
5102
- },
5103
- setInt8: function setInt8(byteOffset, value) {
5104
- set(this, 1, byteOffset, packInt8, value);
5105
- },
5106
- setUint8: function setUint8(byteOffset, value) {
5107
- set(this, 1, byteOffset, packInt8, value);
5108
- },
5109
- setInt16: function setInt16(byteOffset, value /* , littleEndian */) {
5110
- set(this, 2, byteOffset, packInt16, value, arguments.length > 2 ? arguments[2] : undefined);
5111
- },
5112
- setUint16: function setUint16(byteOffset, value /* , littleEndian */) {
5113
- set(this, 2, byteOffset, packInt16, value, arguments.length > 2 ? arguments[2] : undefined);
5114
- },
5115
- setInt32: function setInt32(byteOffset, value /* , littleEndian */) {
5116
- set(this, 4, byteOffset, packInt32, value, arguments.length > 2 ? arguments[2] : undefined);
5117
- },
5118
- setUint32: function setUint32(byteOffset, value /* , littleEndian */) {
5119
- set(this, 4, byteOffset, packInt32, value, arguments.length > 2 ? arguments[2] : undefined);
5120
- },
5121
- setFloat32: function setFloat32(byteOffset, value /* , littleEndian */) {
5122
- set(this, 4, byteOffset, packFloat32, value, arguments.length > 2 ? arguments[2] : undefined);
5123
- },
5124
- setFloat64: function setFloat64(byteOffset, value /* , littleEndian */) {
5125
- set(this, 8, byteOffset, packFloat64, value, arguments.length > 2 ? arguments[2] : undefined);
5126
- }
5127
- });
5128
- } else {
5129
- var INCORRECT_ARRAY_BUFFER_NAME = PROPER_FUNCTION_NAME && NativeArrayBuffer.name !== ARRAY_BUFFER;
5130
- /* eslint-disable no-new -- required for testing */
5131
- if (!fails$5(function () {
5132
- NativeArrayBuffer(1);
5133
- }) || !fails$5(function () {
5134
- new NativeArrayBuffer(-1);
5135
- }) || fails$5(function () {
5136
- new NativeArrayBuffer();
5137
- new NativeArrayBuffer(1.5);
5138
- new NativeArrayBuffer(NaN);
5139
- return INCORRECT_ARRAY_BUFFER_NAME && !CONFIGURABLE_FUNCTION_NAME;
5140
- })) {
5141
- /* eslint-enable no-new -- required for testing */
5142
- $ArrayBuffer = function ArrayBuffer(length) {
5143
- anInstance$1(this, ArrayBufferPrototype$1);
5144
- return new NativeArrayBuffer(toIndex$1(length));
5145
- };
5162
+ var toOffset$2 = function (it, BYTES) {
5163
+ var offset = toPositiveInteger(it);
5164
+ if (offset % BYTES) throw RangeError$2('Wrong offset');
5165
+ return offset;
5166
+ };
5146
5167
 
5147
- $ArrayBuffer[PROTOTYPE] = ArrayBufferPrototype$1;
5168
+ var bind$1 = functionBindContext;
5169
+ var call$2 = functionCall;
5170
+ var aConstructor = aConstructor$2;
5171
+ var toObject$1 = toObject$7;
5172
+ var lengthOfArrayLike$2 = lengthOfArrayLike$7;
5173
+ var getIterator = getIterator$3;
5174
+ var getIteratorMethod = getIteratorMethod$4;
5175
+ var isArrayIteratorMethod = isArrayIteratorMethod$2;
5176
+ var aTypedArrayConstructor$1 = arrayBufferViewCore.aTypedArrayConstructor;
5148
5177
 
5149
- for (var keys = getOwnPropertyNames$1(NativeArrayBuffer), j = 0, key; keys.length > j;) {
5150
- if (!((key = keys[j++]) in $ArrayBuffer)) {
5151
- createNonEnumerableProperty$2($ArrayBuffer, key, NativeArrayBuffer[key]);
5152
- }
5178
+ var typedArrayFrom$1 = function from(source /* , mapfn, thisArg */) {
5179
+ var C = aConstructor(this);
5180
+ var O = toObject$1(source);
5181
+ var argumentsLength = arguments.length;
5182
+ var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
5183
+ var mapping = mapfn !== undefined;
5184
+ var iteratorMethod = getIteratorMethod(O);
5185
+ var i, length, result, step, iterator, next;
5186
+ if (iteratorMethod && !isArrayIteratorMethod(iteratorMethod)) {
5187
+ iterator = getIterator(O, iteratorMethod);
5188
+ next = iterator.next;
5189
+ O = [];
5190
+ while (!(step = call$2(next, iterator)).done) {
5191
+ O.push(step.value);
5153
5192
  }
5154
-
5155
- ArrayBufferPrototype$1.constructor = $ArrayBuffer;
5156
- } else if (INCORRECT_ARRAY_BUFFER_NAME && CONFIGURABLE_FUNCTION_NAME) {
5157
- createNonEnumerableProperty$2(NativeArrayBuffer, 'name', ARRAY_BUFFER);
5158
5193
  }
5159
-
5160
- // WebKit bug - the same parent prototype for typed arrays and data view
5161
- if (setPrototypeOf$3 && getPrototypeOf$1(DataViewPrototype$1) !== ObjectPrototype$1) {
5162
- setPrototypeOf$3(DataViewPrototype$1, ObjectPrototype$1);
5194
+ if (mapping && argumentsLength > 2) {
5195
+ mapfn = bind$1(mapfn, arguments[2]);
5163
5196
  }
5197
+ length = lengthOfArrayLike$2(O);
5198
+ result = new (aTypedArrayConstructor$1(C))(length);
5199
+ for (i = 0; length > i; i++) {
5200
+ result[i] = mapping ? mapfn(O[i], i) : O[i];
5201
+ }
5202
+ return result;
5203
+ };
5164
5204
 
5165
- // iOS Safari 7.x bug
5166
- var testView = new $DataView(new $ArrayBuffer(2));
5167
- var $setInt8 = uncurryThis$5(DataViewPrototype$1.setInt8);
5168
- testView.setInt8(0, 2147483648);
5169
- testView.setInt8(1, 2147483649);
5170
- if (testView.getInt8(0) || !testView.getInt8(1)) defineBuiltIns(DataViewPrototype$1, {
5171
- setInt8: function setInt8(byteOffset, value) {
5172
- $setInt8(this, byteOffset, value << 24 >> 24);
5173
- },
5174
- setUint8: function setUint8(byteOffset, value) {
5175
- $setInt8(this, byteOffset, value << 24 >> 24);
5176
- }
5177
- }, { unsafe: true });
5178
- }
5205
+ var classof$1 = classofRaw$1;
5179
5206
 
5180
- setToStringTag($ArrayBuffer, ARRAY_BUFFER);
5181
- setToStringTag($DataView, DATA_VIEW);
5207
+ // `IsArray` abstract operation
5208
+ // https://tc39.es/ecma262/#sec-isarray
5209
+ // eslint-disable-next-line es-x/no-array-isarray -- safe
5210
+ var isArray$1 = Array.isArray || function isArray(argument) {
5211
+ return classof$1(argument) == 'Array';
5212
+ };
5182
5213
 
5183
- var arrayBuffer = {
5184
- ArrayBuffer: $ArrayBuffer,
5185
- DataView: $DataView
5214
+ var global$6 = global$W;
5215
+ var isArray = isArray$1;
5216
+ var isConstructor = isConstructor$2;
5217
+ var isObject$2 = isObject$e;
5218
+ var wellKnownSymbol$1 = wellKnownSymbol$m;
5219
+
5220
+ var SPECIES = wellKnownSymbol$1('species');
5221
+ var Array$1 = global$6.Array;
5222
+
5223
+ // a part of `ArraySpeciesCreate` abstract operation
5224
+ // https://tc39.es/ecma262/#sec-arrayspeciescreate
5225
+ var arraySpeciesConstructor$1 = function (originalArray) {
5226
+ var C;
5227
+ if (isArray(originalArray)) {
5228
+ C = originalArray.constructor;
5229
+ // cross-realm fallback
5230
+ if (isConstructor(C) && (C === Array$1 || isArray(C.prototype))) C = undefined;
5231
+ else if (isObject$2(C)) {
5232
+ C = C[SPECIES];
5233
+ if (C === null) C = undefined;
5234
+ }
5235
+ } return C === undefined ? Array$1 : C;
5186
5236
  };
5187
5237
 
5188
- var $$3 = _export;
5189
- var uncurryThis$4 = functionUncurryThis;
5190
- var fails$4 = fails$r;
5191
- var ArrayBufferModule$1 = arrayBuffer;
5192
- var anObject = anObject$h;
5193
- var toAbsoluteIndex = toAbsoluteIndex$4;
5194
- var toLength$3 = toLength$9;
5195
- var speciesConstructor = speciesConstructor$3;
5238
+ var arraySpeciesConstructor = arraySpeciesConstructor$1;
5196
5239
 
5197
- var ArrayBuffer$3 = ArrayBufferModule$1.ArrayBuffer;
5198
- var DataView$2 = ArrayBufferModule$1.DataView;
5199
- var DataViewPrototype = DataView$2.prototype;
5200
- var un$ArrayBufferSlice = uncurryThis$4(ArrayBuffer$3.prototype.slice);
5201
- var getUint8 = uncurryThis$4(DataViewPrototype.getUint8);
5202
- var setUint8 = uncurryThis$4(DataViewPrototype.setUint8);
5240
+ // `ArraySpeciesCreate` abstract operation
5241
+ // https://tc39.es/ecma262/#sec-arrayspeciescreate
5242
+ var arraySpeciesCreate$1 = function (originalArray, length) {
5243
+ return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
5244
+ };
5203
5245
 
5204
- var INCORRECT_SLICE = fails$4(function () {
5205
- return !new ArrayBuffer$3(2).slice(1, undefined).byteLength;
5206
- });
5246
+ var bind = functionBindContext;
5247
+ var uncurryThis$3 = functionUncurryThis;
5248
+ var IndexedObject = indexedObject;
5249
+ var toObject = toObject$7;
5250
+ var lengthOfArrayLike$1 = lengthOfArrayLike$7;
5251
+ var arraySpeciesCreate = arraySpeciesCreate$1;
5207
5252
 
5208
- // `ArrayBuffer.prototype.slice` method
5209
- // https://tc39.es/ecma262/#sec-arraybuffer.prototype.slice
5210
- $$3({ target: 'ArrayBuffer', proto: true, unsafe: true, forced: INCORRECT_SLICE }, {
5211
- slice: function slice(start, end) {
5212
- if (un$ArrayBufferSlice && end === undefined) {
5213
- return un$ArrayBufferSlice(anObject(this), start); // FF fix
5214
- }
5215
- var length = anObject(this).byteLength;
5216
- var first = toAbsoluteIndex(start, length);
5217
- var fin = toAbsoluteIndex(end === undefined ? length : end, length);
5218
- var result = new (speciesConstructor(this, ArrayBuffer$3))(toLength$3(fin - first));
5219
- var viewSource = new DataView$2(this);
5220
- var viewTarget = new DataView$2(result);
5253
+ var push = uncurryThis$3([].push);
5254
+
5255
+ // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation
5256
+ var createMethod = function (TYPE) {
5257
+ var IS_MAP = TYPE == 1;
5258
+ var IS_FILTER = TYPE == 2;
5259
+ var IS_SOME = TYPE == 3;
5260
+ var IS_EVERY = TYPE == 4;
5261
+ var IS_FIND_INDEX = TYPE == 6;
5262
+ var IS_FILTER_REJECT = TYPE == 7;
5263
+ var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
5264
+ return function ($this, callbackfn, that, specificCreate) {
5265
+ var O = toObject($this);
5266
+ var self = IndexedObject(O);
5267
+ var boundFunction = bind(callbackfn, that);
5268
+ var length = lengthOfArrayLike$1(self);
5221
5269
  var index = 0;
5222
- while (first < fin) {
5223
- setUint8(viewTarget, index++, getUint8(viewSource, first++));
5224
- } return result;
5225
- }
5226
- });
5270
+ var create = specificCreate || arraySpeciesCreate;
5271
+ var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined;
5272
+ var value, result;
5273
+ for (;length > index; index++) if (NO_HOLES || index in self) {
5274
+ value = self[index];
5275
+ result = boundFunction(value, index, O);
5276
+ if (TYPE) {
5277
+ if (IS_MAP) target[index] = result; // map
5278
+ else if (result) switch (TYPE) {
5279
+ case 3: return true; // some
5280
+ case 5: return value; // find
5281
+ case 6: return index; // findIndex
5282
+ case 2: push(target, value); // filter
5283
+ } else switch (TYPE) {
5284
+ case 4: return false; // every
5285
+ case 7: push(target, value); // filterReject
5286
+ }
5287
+ }
5288
+ }
5289
+ return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
5290
+ };
5291
+ };
5292
+
5293
+ var arrayIteration = {
5294
+ // `Array.prototype.forEach` method
5295
+ // https://tc39.es/ecma262/#sec-array.prototype.foreach
5296
+ forEach: createMethod(0),
5297
+ // `Array.prototype.map` method
5298
+ // https://tc39.es/ecma262/#sec-array.prototype.map
5299
+ map: createMethod(1),
5300
+ // `Array.prototype.filter` method
5301
+ // https://tc39.es/ecma262/#sec-array.prototype.filter
5302
+ filter: createMethod(2),
5303
+ // `Array.prototype.some` method
5304
+ // https://tc39.es/ecma262/#sec-array.prototype.some
5305
+ some: createMethod(3),
5306
+ // `Array.prototype.every` method
5307
+ // https://tc39.es/ecma262/#sec-array.prototype.every
5308
+ every: createMethod(4),
5309
+ // `Array.prototype.find` method
5310
+ // https://tc39.es/ecma262/#sec-array.prototype.find
5311
+ find: createMethod(5),
5312
+ // `Array.prototype.findIndex` method
5313
+ // https://tc39.es/ecma262/#sec-array.prototype.findIndex
5314
+ findIndex: createMethod(6),
5315
+ // `Array.prototype.filterReject` method
5316
+ // https://github.com/tc39/proposal-array-filtering
5317
+ filterReject: createMethod(7)
5318
+ };
5227
5319
 
5228
- var typedArrayConstructor = {exports: {}};
5320
+ var isCallable = isCallable$p;
5321
+ var isObject$1 = isObject$e;
5322
+ var setPrototypeOf$1 = objectSetPrototypeOf;
5229
5323
 
5230
- var NATIVE_ARRAY_BUFFER = arrayBufferNative;
5231
- var DESCRIPTORS$1 = descriptors;
5232
- var global$a = global$W;
5233
- var isCallable$1 = isCallable$p;
5234
- var isObject$4 = isObject$e;
5235
- var hasOwn$1 = hasOwnProperty_1;
5236
- var classof$2 = classof$a;
5237
- var tryToString = tryToString$5;
5238
- var createNonEnumerableProperty$1 = createNonEnumerableProperty$9;
5239
- var defineBuiltIn = defineBuiltIn$9;
5240
- var defineProperty = objectDefineProperty.f;
5241
- var isPrototypeOf$1 = objectIsPrototypeOf;
5242
- var getPrototypeOf = objectGetPrototypeOf;
5243
- var setPrototypeOf$2 = objectSetPrototypeOf;
5244
- var wellKnownSymbol$2 = wellKnownSymbol$m;
5245
- var uid = uid$3;
5324
+ // makes subclassing work correct for wrapped built-ins
5325
+ var inheritIfRequired$1 = function ($this, dummy, Wrapper) {
5326
+ var NewTarget, NewTargetPrototype;
5327
+ if (
5328
+ // it can work only with native `setPrototypeOf`
5329
+ setPrototypeOf$1 &&
5330
+ // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
5331
+ isCallable(NewTarget = dummy.constructor) &&
5332
+ NewTarget !== Wrapper &&
5333
+ isObject$1(NewTargetPrototype = NewTarget.prototype) &&
5334
+ NewTargetPrototype !== Wrapper.prototype
5335
+ ) setPrototypeOf$1($this, NewTargetPrototype);
5336
+ return $this;
5337
+ };
5246
5338
 
5247
- var Int8Array$3 = global$a.Int8Array;
5248
- var Int8ArrayPrototype$1 = Int8Array$3 && Int8Array$3.prototype;
5249
- var Uint8ClampedArray$1 = global$a.Uint8ClampedArray;
5250
- var Uint8ClampedArrayPrototype = Uint8ClampedArray$1 && Uint8ClampedArray$1.prototype;
5251
- var TypedArray$1 = Int8Array$3 && getPrototypeOf(Int8Array$3);
5252
- var TypedArrayPrototype$1 = Int8ArrayPrototype$1 && getPrototypeOf(Int8ArrayPrototype$1);
5253
- var ObjectPrototype = Object.prototype;
5254
- var TypeError$2 = global$a.TypeError;
5339
+ var $$2 = _export;
5340
+ var global$5 = global$W;
5341
+ var call$1 = functionCall;
5342
+ var DESCRIPTORS = descriptors;
5343
+ var TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS = typedArrayConstructorsRequireWrappers;
5344
+ var ArrayBufferViewCore$3 = arrayBufferViewCore;
5345
+ var ArrayBufferModule = arrayBuffer;
5346
+ var anInstance = anInstance$4;
5347
+ var createPropertyDescriptor = createPropertyDescriptor$6;
5348
+ var createNonEnumerableProperty = createNonEnumerableProperty$9;
5349
+ var isIntegralNumber = isIntegralNumber$1;
5350
+ var toLength$2 = toLength$9;
5351
+ var toIndex = toIndex$2;
5352
+ var toOffset$1 = toOffset$2;
5353
+ var toPropertyKey = toPropertyKey$4;
5354
+ var hasOwn = hasOwnProperty_1;
5355
+ var classof = classof$a;
5356
+ var isObject = isObject$e;
5357
+ var isSymbol = isSymbol$3;
5358
+ var create = objectCreate;
5359
+ var isPrototypeOf = objectIsPrototypeOf;
5360
+ var setPrototypeOf = objectSetPrototypeOf;
5361
+ var getOwnPropertyNames = objectGetOwnPropertyNames.f;
5362
+ var typedArrayFrom = typedArrayFrom$1;
5363
+ var forEach = arrayIteration.forEach;
5364
+ var setSpecies = setSpecies$2;
5365
+ var definePropertyModule = objectDefineProperty;
5366
+ var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor;
5367
+ var InternalStateModule = internalState;
5368
+ var inheritIfRequired = inheritIfRequired$1;
5255
5369
 
5256
- var TO_STRING_TAG = wellKnownSymbol$2('toStringTag');
5257
- var TYPED_ARRAY_TAG$1 = uid('TYPED_ARRAY_TAG');
5258
- var TYPED_ARRAY_CONSTRUCTOR$1 = uid('TYPED_ARRAY_CONSTRUCTOR');
5259
- // Fixing native typed arrays in Opera Presto crashes the browser, see #595
5260
- var NATIVE_ARRAY_BUFFER_VIEWS$2 = NATIVE_ARRAY_BUFFER && !!setPrototypeOf$2 && classof$2(global$a.opera) !== 'Opera';
5261
- var TYPED_ARRAY_TAG_REQUIRED = false;
5262
- var NAME, Constructor, Prototype;
5370
+ var getInternalState = InternalStateModule.get;
5371
+ var setInternalState = InternalStateModule.set;
5372
+ var nativeDefineProperty = definePropertyModule.f;
5373
+ var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
5374
+ var round = Math.round;
5375
+ var RangeError$1 = global$5.RangeError;
5376
+ var ArrayBuffer$1 = ArrayBufferModule.ArrayBuffer;
5377
+ var ArrayBufferPrototype = ArrayBuffer$1.prototype;
5378
+ var DataView$1 = ArrayBufferModule.DataView;
5379
+ var NATIVE_ARRAY_BUFFER_VIEWS = ArrayBufferViewCore$3.NATIVE_ARRAY_BUFFER_VIEWS;
5380
+ var TYPED_ARRAY_CONSTRUCTOR = ArrayBufferViewCore$3.TYPED_ARRAY_CONSTRUCTOR;
5381
+ var TYPED_ARRAY_TAG = ArrayBufferViewCore$3.TYPED_ARRAY_TAG;
5382
+ var TypedArray = ArrayBufferViewCore$3.TypedArray;
5383
+ var TypedArrayPrototype = ArrayBufferViewCore$3.TypedArrayPrototype;
5384
+ var aTypedArrayConstructor = ArrayBufferViewCore$3.aTypedArrayConstructor;
5385
+ var isTypedArray = ArrayBufferViewCore$3.isTypedArray;
5386
+ var BYTES_PER_ELEMENT = 'BYTES_PER_ELEMENT';
5387
+ var WRONG_LENGTH = 'Wrong length';
5263
5388
 
5264
- var TypedArrayConstructorsList = {
5265
- Int8Array: 1,
5266
- Uint8Array: 1,
5267
- Uint8ClampedArray: 1,
5268
- Int16Array: 2,
5269
- Uint16Array: 2,
5270
- Int32Array: 4,
5271
- Uint32Array: 4,
5272
- Float32Array: 4,
5273
- Float64Array: 8
5389
+ var fromList = function (C, list) {
5390
+ aTypedArrayConstructor(C);
5391
+ var index = 0;
5392
+ var length = list.length;
5393
+ var result = new C(length);
5394
+ while (length > index) result[index] = list[index++];
5395
+ return result;
5274
5396
  };
5275
5397
 
5276
- var BigIntArrayConstructorsList = {
5277
- BigInt64Array: 8,
5278
- BigUint64Array: 8
5398
+ var addGetter = function (it, key) {
5399
+ nativeDefineProperty(it, key, { get: function () {
5400
+ return getInternalState(this)[key];
5401
+ } });
5279
5402
  };
5280
5403
 
5281
- var isView = function isView(it) {
5282
- if (!isObject$4(it)) return false;
5283
- var klass = classof$2(it);
5284
- return klass === 'DataView'
5285
- || hasOwn$1(TypedArrayConstructorsList, klass)
5286
- || hasOwn$1(BigIntArrayConstructorsList, klass);
5404
+ var isArrayBuffer = function (it) {
5405
+ var klass;
5406
+ return isPrototypeOf(ArrayBufferPrototype, it) || (klass = classof(it)) == 'ArrayBuffer' || klass == 'SharedArrayBuffer';
5287
5407
  };
5288
5408
 
5289
- var isTypedArray$1 = function (it) {
5290
- if (!isObject$4(it)) return false;
5291
- var klass = classof$2(it);
5292
- return hasOwn$1(TypedArrayConstructorsList, klass)
5293
- || hasOwn$1(BigIntArrayConstructorsList, klass);
5409
+ var isTypedArrayIndex = function (target, key) {
5410
+ return isTypedArray(target)
5411
+ && !isSymbol(key)
5412
+ && key in target
5413
+ && isIntegralNumber(+key)
5414
+ && key >= 0;
5294
5415
  };
5295
5416
 
5296
- var aTypedArray$3 = function (it) {
5297
- if (isTypedArray$1(it)) return it;
5298
- throw TypeError$2('Target is not a typed array');
5417
+ var wrappedGetOwnPropertyDescriptor = function getOwnPropertyDescriptor(target, key) {
5418
+ key = toPropertyKey(key);
5419
+ return isTypedArrayIndex(target, key)
5420
+ ? createPropertyDescriptor(2, target[key])
5421
+ : nativeGetOwnPropertyDescriptor(target, key);
5299
5422
  };
5300
5423
 
5301
- var aTypedArrayConstructor$2 = function (C) {
5302
- if (isCallable$1(C) && (!setPrototypeOf$2 || isPrototypeOf$1(TypedArray$1, C))) return C;
5303
- throw TypeError$2(tryToString(C) + ' is not a typed array constructor');
5424
+ var wrappedDefineProperty = function defineProperty(target, key, descriptor) {
5425
+ key = toPropertyKey(key);
5426
+ if (isTypedArrayIndex(target, key)
5427
+ && isObject(descriptor)
5428
+ && hasOwn(descriptor, 'value')
5429
+ && !hasOwn(descriptor, 'get')
5430
+ && !hasOwn(descriptor, 'set')
5431
+ // TODO: add validation descriptor w/o calling accessors
5432
+ && !descriptor.configurable
5433
+ && (!hasOwn(descriptor, 'writable') || descriptor.writable)
5434
+ && (!hasOwn(descriptor, 'enumerable') || descriptor.enumerable)
5435
+ ) {
5436
+ target[key] = descriptor.value;
5437
+ return target;
5438
+ } return nativeDefineProperty(target, key, descriptor);
5304
5439
  };
5305
5440
 
5306
- var exportTypedArrayMethod$3 = function (KEY, property, forced, options) {
5307
- if (!DESCRIPTORS$1) return;
5308
- if (forced) for (var ARRAY in TypedArrayConstructorsList) {
5309
- var TypedArrayConstructor = global$a[ARRAY];
5310
- if (TypedArrayConstructor && hasOwn$1(TypedArrayConstructor.prototype, KEY)) try {
5311
- delete TypedArrayConstructor.prototype[KEY];
5312
- } catch (error) {
5313
- // old WebKit bug - some methods are non-configurable
5314
- try {
5315
- TypedArrayConstructor.prototype[KEY] = property;
5316
- } catch (error2) { /* empty */ }
5317
- }
5318
- }
5319
- if (!TypedArrayPrototype$1[KEY] || forced) {
5320
- defineBuiltIn(TypedArrayPrototype$1, KEY, forced ? property
5321
- : NATIVE_ARRAY_BUFFER_VIEWS$2 && Int8ArrayPrototype$1[KEY] || property, options);
5441
+ if (DESCRIPTORS) {
5442
+ if (!NATIVE_ARRAY_BUFFER_VIEWS) {
5443
+ getOwnPropertyDescriptorModule.f = wrappedGetOwnPropertyDescriptor;
5444
+ definePropertyModule.f = wrappedDefineProperty;
5445
+ addGetter(TypedArrayPrototype, 'buffer');
5446
+ addGetter(TypedArrayPrototype, 'byteOffset');
5447
+ addGetter(TypedArrayPrototype, 'byteLength');
5448
+ addGetter(TypedArrayPrototype, 'length');
5322
5449
  }
5323
- };
5324
5450
 
5325
- var exportTypedArrayStaticMethod = function (KEY, property, forced) {
5326
- var ARRAY, TypedArrayConstructor;
5327
- if (!DESCRIPTORS$1) return;
5328
- if (setPrototypeOf$2) {
5329
- if (forced) for (ARRAY in TypedArrayConstructorsList) {
5330
- TypedArrayConstructor = global$a[ARRAY];
5331
- if (TypedArrayConstructor && hasOwn$1(TypedArrayConstructor, KEY)) try {
5332
- delete TypedArrayConstructor[KEY];
5333
- } catch (error) { /* empty */ }
5334
- }
5335
- if (!TypedArray$1[KEY] || forced) {
5336
- // V8 ~ Chrome 49-50 `%TypedArray%` methods are non-writable non-configurable
5337
- try {
5338
- return defineBuiltIn(TypedArray$1, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS$2 && TypedArray$1[KEY] || property);
5339
- } catch (error) { /* empty */ }
5340
- } else return;
5341
- }
5342
- for (ARRAY in TypedArrayConstructorsList) {
5343
- TypedArrayConstructor = global$a[ARRAY];
5344
- if (TypedArrayConstructor && (!TypedArrayConstructor[KEY] || forced)) {
5345
- defineBuiltIn(TypedArrayConstructor, KEY, property);
5346
- }
5347
- }
5348
- };
5451
+ $$2({ target: 'Object', stat: true, forced: !NATIVE_ARRAY_BUFFER_VIEWS }, {
5452
+ getOwnPropertyDescriptor: wrappedGetOwnPropertyDescriptor,
5453
+ defineProperty: wrappedDefineProperty
5454
+ });
5349
5455
 
5350
- for (NAME in TypedArrayConstructorsList) {
5351
- Constructor = global$a[NAME];
5352
- Prototype = Constructor && Constructor.prototype;
5353
- if (Prototype) createNonEnumerableProperty$1(Prototype, TYPED_ARRAY_CONSTRUCTOR$1, Constructor);
5354
- else NATIVE_ARRAY_BUFFER_VIEWS$2 = false;
5355
- }
5456
+ typedArrayConstructor.exports = function (TYPE, wrapper, CLAMPED) {
5457
+ var BYTES = TYPE.match(/\d+$/)[0] / 8;
5458
+ var CONSTRUCTOR_NAME = TYPE + (CLAMPED ? 'Clamped' : '') + 'Array';
5459
+ var GETTER = 'get' + TYPE;
5460
+ var SETTER = 'set' + TYPE;
5461
+ var NativeTypedArrayConstructor = global$5[CONSTRUCTOR_NAME];
5462
+ var TypedArrayConstructor = NativeTypedArrayConstructor;
5463
+ var TypedArrayConstructorPrototype = TypedArrayConstructor && TypedArrayConstructor.prototype;
5464
+ var exported = {};
5356
5465
 
5357
- for (NAME in BigIntArrayConstructorsList) {
5358
- Constructor = global$a[NAME];
5359
- Prototype = Constructor && Constructor.prototype;
5360
- if (Prototype) createNonEnumerableProperty$1(Prototype, TYPED_ARRAY_CONSTRUCTOR$1, Constructor);
5361
- }
5466
+ var getter = function (that, index) {
5467
+ var data = getInternalState(that);
5468
+ return data.view[GETTER](index * BYTES + data.byteOffset, true);
5469
+ };
5362
5470
 
5363
- // WebKit bug - typed arrays constructors prototype is Object.prototype
5364
- if (!NATIVE_ARRAY_BUFFER_VIEWS$2 || !isCallable$1(TypedArray$1) || TypedArray$1 === Function.prototype) {
5365
- // eslint-disable-next-line no-shadow -- safe
5366
- TypedArray$1 = function TypedArray() {
5367
- throw TypeError$2('Incorrect invocation');
5368
- };
5369
- if (NATIVE_ARRAY_BUFFER_VIEWS$2) for (NAME in TypedArrayConstructorsList) {
5370
- if (global$a[NAME]) setPrototypeOf$2(global$a[NAME], TypedArray$1);
5371
- }
5372
- }
5471
+ var setter = function (that, index, value) {
5472
+ var data = getInternalState(that);
5473
+ if (CLAMPED) value = (value = round(value)) < 0 ? 0 : value > 0xFF ? 0xFF : value & 0xFF;
5474
+ data.view[SETTER](index * BYTES + data.byteOffset, value, true);
5475
+ };
5373
5476
 
5374
- if (!NATIVE_ARRAY_BUFFER_VIEWS$2 || !TypedArrayPrototype$1 || TypedArrayPrototype$1 === ObjectPrototype) {
5375
- TypedArrayPrototype$1 = TypedArray$1.prototype;
5376
- if (NATIVE_ARRAY_BUFFER_VIEWS$2) for (NAME in TypedArrayConstructorsList) {
5377
- if (global$a[NAME]) setPrototypeOf$2(global$a[NAME].prototype, TypedArrayPrototype$1);
5378
- }
5379
- }
5477
+ var addElement = function (that, index) {
5478
+ nativeDefineProperty(that, index, {
5479
+ get: function () {
5480
+ return getter(this, index);
5481
+ },
5482
+ set: function (value) {
5483
+ return setter(this, index, value);
5484
+ },
5485
+ enumerable: true
5486
+ });
5487
+ };
5380
5488
 
5381
- // WebKit bug - one more object in Uint8ClampedArray prototype chain
5382
- if (NATIVE_ARRAY_BUFFER_VIEWS$2 && getPrototypeOf(Uint8ClampedArrayPrototype) !== TypedArrayPrototype$1) {
5383
- setPrototypeOf$2(Uint8ClampedArrayPrototype, TypedArrayPrototype$1);
5384
- }
5489
+ if (!NATIVE_ARRAY_BUFFER_VIEWS) {
5490
+ TypedArrayConstructor = wrapper(function (that, data, offset, $length) {
5491
+ anInstance(that, TypedArrayConstructorPrototype);
5492
+ var index = 0;
5493
+ var byteOffset = 0;
5494
+ var buffer, byteLength, length;
5495
+ if (!isObject(data)) {
5496
+ length = toIndex(data);
5497
+ byteLength = length * BYTES;
5498
+ buffer = new ArrayBuffer$1(byteLength);
5499
+ } else if (isArrayBuffer(data)) {
5500
+ buffer = data;
5501
+ byteOffset = toOffset$1(offset, BYTES);
5502
+ var $len = data.byteLength;
5503
+ if ($length === undefined) {
5504
+ if ($len % BYTES) throw RangeError$1(WRONG_LENGTH);
5505
+ byteLength = $len - byteOffset;
5506
+ if (byteLength < 0) throw RangeError$1(WRONG_LENGTH);
5507
+ } else {
5508
+ byteLength = toLength$2($length) * BYTES;
5509
+ if (byteLength + byteOffset > $len) throw RangeError$1(WRONG_LENGTH);
5510
+ }
5511
+ length = byteLength / BYTES;
5512
+ } else if (isTypedArray(data)) {
5513
+ return fromList(TypedArrayConstructor, data);
5514
+ } else {
5515
+ return call$1(typedArrayFrom, TypedArrayConstructor, data);
5516
+ }
5517
+ setInternalState(that, {
5518
+ buffer: buffer,
5519
+ byteOffset: byteOffset,
5520
+ byteLength: byteLength,
5521
+ length: length,
5522
+ view: new DataView$1(buffer)
5523
+ });
5524
+ while (index < length) addElement(that, index++);
5525
+ });
5385
5526
 
5386
- if (DESCRIPTORS$1 && !hasOwn$1(TypedArrayPrototype$1, TO_STRING_TAG)) {
5387
- TYPED_ARRAY_TAG_REQUIRED = true;
5388
- defineProperty(TypedArrayPrototype$1, TO_STRING_TAG, { get: function () {
5389
- return isObject$4(this) ? this[TYPED_ARRAY_TAG$1] : undefined;
5390
- } });
5391
- for (NAME in TypedArrayConstructorsList) if (global$a[NAME]) {
5392
- createNonEnumerableProperty$1(global$a[NAME], TYPED_ARRAY_TAG$1, NAME);
5393
- }
5394
- }
5527
+ if (setPrototypeOf) setPrototypeOf(TypedArrayConstructor, TypedArray);
5528
+ TypedArrayConstructorPrototype = TypedArrayConstructor.prototype = create(TypedArrayPrototype);
5529
+ } else if (TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS) {
5530
+ TypedArrayConstructor = wrapper(function (dummy, data, typedArrayOffset, $length) {
5531
+ anInstance(dummy, TypedArrayConstructorPrototype);
5532
+ return inheritIfRequired(function () {
5533
+ if (!isObject(data)) return new NativeTypedArrayConstructor(toIndex(data));
5534
+ if (isArrayBuffer(data)) return $length !== undefined
5535
+ ? new NativeTypedArrayConstructor(data, toOffset$1(typedArrayOffset, BYTES), $length)
5536
+ : typedArrayOffset !== undefined
5537
+ ? new NativeTypedArrayConstructor(data, toOffset$1(typedArrayOffset, BYTES))
5538
+ : new NativeTypedArrayConstructor(data);
5539
+ if (isTypedArray(data)) return fromList(TypedArrayConstructor, data);
5540
+ return call$1(typedArrayFrom, TypedArrayConstructor, data);
5541
+ }(), dummy, TypedArrayConstructor);
5542
+ });
5395
5543
 
5396
- var arrayBufferViewCore = {
5397
- NATIVE_ARRAY_BUFFER_VIEWS: NATIVE_ARRAY_BUFFER_VIEWS$2,
5398
- TYPED_ARRAY_CONSTRUCTOR: TYPED_ARRAY_CONSTRUCTOR$1,
5399
- TYPED_ARRAY_TAG: TYPED_ARRAY_TAG_REQUIRED && TYPED_ARRAY_TAG$1,
5400
- aTypedArray: aTypedArray$3,
5401
- aTypedArrayConstructor: aTypedArrayConstructor$2,
5402
- exportTypedArrayMethod: exportTypedArrayMethod$3,
5403
- exportTypedArrayStaticMethod: exportTypedArrayStaticMethod,
5404
- isView: isView,
5405
- isTypedArray: isTypedArray$1,
5406
- TypedArray: TypedArray$1,
5407
- TypedArrayPrototype: TypedArrayPrototype$1
5408
- };
5544
+ if (setPrototypeOf) setPrototypeOf(TypedArrayConstructor, TypedArray);
5545
+ forEach(getOwnPropertyNames(NativeTypedArrayConstructor), function (key) {
5546
+ if (!(key in TypedArrayConstructor)) {
5547
+ createNonEnumerableProperty(TypedArrayConstructor, key, NativeTypedArrayConstructor[key]);
5548
+ }
5549
+ });
5550
+ TypedArrayConstructor.prototype = TypedArrayConstructorPrototype;
5551
+ }
5409
5552
 
5410
- /* eslint-disable no-new -- required for testing */
5553
+ if (TypedArrayConstructorPrototype.constructor !== TypedArrayConstructor) {
5554
+ createNonEnumerableProperty(TypedArrayConstructorPrototype, 'constructor', TypedArrayConstructor);
5555
+ }
5411
5556
 
5412
- var global$9 = global$W;
5413
- var fails$3 = fails$r;
5414
- var checkCorrectnessOfIteration = checkCorrectnessOfIteration$2;
5415
- var NATIVE_ARRAY_BUFFER_VIEWS$1 = arrayBufferViewCore.NATIVE_ARRAY_BUFFER_VIEWS;
5557
+ createNonEnumerableProperty(TypedArrayConstructorPrototype, TYPED_ARRAY_CONSTRUCTOR, TypedArrayConstructor);
5416
5558
 
5417
- var ArrayBuffer$2 = global$9.ArrayBuffer;
5418
- var Int8Array$2 = global$9.Int8Array;
5559
+ if (TYPED_ARRAY_TAG) {
5560
+ createNonEnumerableProperty(TypedArrayConstructorPrototype, TYPED_ARRAY_TAG, CONSTRUCTOR_NAME);
5561
+ }
5419
5562
 
5420
- var typedArrayConstructorsRequireWrappers = !NATIVE_ARRAY_BUFFER_VIEWS$1 || !fails$3(function () {
5421
- Int8Array$2(1);
5422
- }) || !fails$3(function () {
5423
- new Int8Array$2(-1);
5424
- }) || !checkCorrectnessOfIteration(function (iterable) {
5425
- new Int8Array$2();
5426
- new Int8Array$2(null);
5427
- new Int8Array$2(1.5);
5428
- new Int8Array$2(iterable);
5429
- }, true) || fails$3(function () {
5430
- // Safari (11+) bug - a reason why even Safari 13 should load a typed array polyfill
5431
- return new Int8Array$2(new ArrayBuffer$2(2), 1, undefined).length !== 1;
5432
- });
5563
+ var FORCED = TypedArrayConstructor != NativeTypedArrayConstructor;
5433
5564
 
5434
- var isObject$3 = isObject$e;
5565
+ exported[CONSTRUCTOR_NAME] = TypedArrayConstructor;
5435
5566
 
5436
- var floor = Math.floor;
5567
+ $$2({ global: true, constructor: true, forced: FORCED, sham: !NATIVE_ARRAY_BUFFER_VIEWS }, exported);
5437
5568
 
5438
- // `IsIntegralNumber` abstract operation
5439
- // https://tc39.es/ecma262/#sec-isintegralnumber
5440
- // eslint-disable-next-line es-x/no-number-isinteger -- safe
5441
- var isIntegralNumber$1 = Number.isInteger || function isInteger(it) {
5442
- return !isObject$3(it) && isFinite(it) && floor(it) === it;
5443
- };
5569
+ if (!(BYTES_PER_ELEMENT in TypedArrayConstructor)) {
5570
+ createNonEnumerableProperty(TypedArrayConstructor, BYTES_PER_ELEMENT, BYTES);
5571
+ }
5444
5572
 
5445
- var global$8 = global$W;
5446
- var toIntegerOrInfinity = toIntegerOrInfinity$7;
5573
+ if (!(BYTES_PER_ELEMENT in TypedArrayConstructorPrototype)) {
5574
+ createNonEnumerableProperty(TypedArrayConstructorPrototype, BYTES_PER_ELEMENT, BYTES);
5575
+ }
5447
5576
 
5448
- var RangeError$3 = global$8.RangeError;
5577
+ setSpecies(CONSTRUCTOR_NAME);
5578
+ };
5579
+ } else typedArrayConstructor.exports = function () { /* empty */ };
5449
5580
 
5450
- var toPositiveInteger$1 = function (it) {
5451
- var result = toIntegerOrInfinity(it);
5452
- if (result < 0) throw RangeError$3("The argument can't be less than 0");
5453
- return result;
5454
- };
5581
+ var createTypedArrayConstructor = typedArrayConstructor.exports;
5455
5582
 
5456
- var global$7 = global$W;
5457
- var toPositiveInteger = toPositiveInteger$1;
5583
+ // `Uint8Array` constructor
5584
+ // https://tc39.es/ecma262/#sec-typedarray-objects
5585
+ createTypedArrayConstructor('Uint8', function (init) {
5586
+ return function Uint8Array(data, byteOffset, length) {
5587
+ return init(this, data, byteOffset, length);
5588
+ };
5589
+ });
5458
5590
 
5459
- var RangeError$2 = global$7.RangeError;
5591
+ var global$4 = global$W;
5592
+ var call = functionCall;
5593
+ var ArrayBufferViewCore$2 = arrayBufferViewCore;
5594
+ var lengthOfArrayLike = lengthOfArrayLike$7;
5595
+ var toOffset = toOffset$2;
5596
+ var toIndexedObject = toObject$7;
5597
+ var fails$2 = fails$r;
5460
5598
 
5461
- var toOffset$2 = function (it, BYTES) {
5462
- var offset = toPositiveInteger(it);
5463
- if (offset % BYTES) throw RangeError$2('Wrong offset');
5464
- return offset;
5465
- };
5599
+ var RangeError = global$4.RangeError;
5600
+ var Int8Array$1 = global$4.Int8Array;
5601
+ var Int8ArrayPrototype = Int8Array$1 && Int8Array$1.prototype;
5602
+ var $set = Int8ArrayPrototype && Int8ArrayPrototype.set;
5603
+ var aTypedArray$2 = ArrayBufferViewCore$2.aTypedArray;
5604
+ var exportTypedArrayMethod$2 = ArrayBufferViewCore$2.exportTypedArrayMethod;
5466
5605
 
5467
- var bind$1 = functionBindContext;
5468
- var call$2 = functionCall;
5469
- var aConstructor = aConstructor$2;
5470
- var toObject$1 = toObject$7;
5471
- var lengthOfArrayLike$2 = lengthOfArrayLike$7;
5472
- var getIterator = getIterator$3;
5473
- var getIteratorMethod = getIteratorMethod$4;
5474
- var isArrayIteratorMethod = isArrayIteratorMethod$2;
5475
- var aTypedArrayConstructor$1 = arrayBufferViewCore.aTypedArrayConstructor;
5606
+ var WORKS_WITH_OBJECTS_AND_GEERIC_ON_TYPED_ARRAYS = !fails$2(function () {
5607
+ // eslint-disable-next-line es-x/no-typed-arrays -- required for testing
5608
+ var array = new Uint8ClampedArray(2);
5609
+ call($set, array, { length: 1, 0: 3 }, 1);
5610
+ return array[1] !== 3;
5611
+ });
5476
5612
 
5477
- var typedArrayFrom$1 = function from(source /* , mapfn, thisArg */) {
5478
- var C = aConstructor(this);
5479
- var O = toObject$1(source);
5480
- var argumentsLength = arguments.length;
5481
- var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
5482
- var mapping = mapfn !== undefined;
5483
- var iteratorMethod = getIteratorMethod(O);
5484
- var i, length, result, step, iterator, next;
5485
- if (iteratorMethod && !isArrayIteratorMethod(iteratorMethod)) {
5486
- iterator = getIterator(O, iteratorMethod);
5487
- next = iterator.next;
5488
- O = [];
5489
- while (!(step = call$2(next, iterator)).done) {
5490
- O.push(step.value);
5491
- }
5492
- }
5493
- if (mapping && argumentsLength > 2) {
5494
- mapfn = bind$1(mapfn, arguments[2]);
5495
- }
5496
- length = lengthOfArrayLike$2(O);
5497
- result = new (aTypedArrayConstructor$1(C))(length);
5498
- for (i = 0; length > i; i++) {
5499
- result[i] = mapping ? mapfn(O[i], i) : O[i];
5500
- }
5501
- return result;
5502
- };
5613
+ // https://bugs.chromium.org/p/v8/issues/detail?id=11294 and other
5614
+ var TO_OBJECT_BUG = WORKS_WITH_OBJECTS_AND_GEERIC_ON_TYPED_ARRAYS && ArrayBufferViewCore$2.NATIVE_ARRAY_BUFFER_VIEWS && fails$2(function () {
5615
+ var array = new Int8Array$1(2);
5616
+ array.set(1);
5617
+ array.set('2', 1);
5618
+ return array[0] !== 0 || array[1] !== 2;
5619
+ });
5620
+
5621
+ // `%TypedArray%.prototype.set` method
5622
+ // https://tc39.es/ecma262/#sec-%typedarray%.prototype.set
5623
+ exportTypedArrayMethod$2('set', function set(arrayLike /* , offset */) {
5624
+ aTypedArray$2(this);
5625
+ var offset = toOffset(arguments.length > 1 ? arguments[1] : undefined, 1);
5626
+ var src = toIndexedObject(arrayLike);
5627
+ if (WORKS_WITH_OBJECTS_AND_GEERIC_ON_TYPED_ARRAYS) return call($set, this, src, offset);
5628
+ var length = this.length;
5629
+ var len = lengthOfArrayLike(src);
5630
+ var index = 0;
5631
+ if (len + offset > length) throw RangeError('Wrong length');
5632
+ while (index < len) this[offset + index] = src[index++];
5633
+ }, !WORKS_WITH_OBJECTS_AND_GEERIC_ON_TYPED_ARRAYS || TO_OBJECT_BUG);
5503
5634
 
5504
- var classof$1 = classofRaw$1;
5635
+ var userAgent$1 = engineUserAgent;
5505
5636
 
5506
- // `IsArray` abstract operation
5507
- // https://tc39.es/ecma262/#sec-isarray
5508
- // eslint-disable-next-line es-x/no-array-isarray -- safe
5509
- var isArray$1 = Array.isArray || function isArray(argument) {
5510
- return classof$1(argument) == 'Array';
5511
- };
5637
+ var firefox = userAgent$1.match(/firefox\/(\d+)/i);
5512
5638
 
5513
- var global$6 = global$W;
5514
- var isArray = isArray$1;
5515
- var isConstructor = isConstructor$2;
5516
- var isObject$2 = isObject$e;
5517
- var wellKnownSymbol$1 = wellKnownSymbol$m;
5639
+ var engineFfVersion = !!firefox && +firefox[1];
5518
5640
 
5519
- var SPECIES = wellKnownSymbol$1('species');
5520
- var Array$1 = global$6.Array;
5641
+ var UA = engineUserAgent;
5521
5642
 
5522
- // a part of `ArraySpeciesCreate` abstract operation
5523
- // https://tc39.es/ecma262/#sec-arrayspeciescreate
5524
- var arraySpeciesConstructor$1 = function (originalArray) {
5525
- var C;
5526
- if (isArray(originalArray)) {
5527
- C = originalArray.constructor;
5528
- // cross-realm fallback
5529
- if (isConstructor(C) && (C === Array$1 || isArray(C.prototype))) C = undefined;
5530
- else if (isObject$2(C)) {
5531
- C = C[SPECIES];
5532
- if (C === null) C = undefined;
5533
- }
5534
- } return C === undefined ? Array$1 : C;
5535
- };
5643
+ var engineIsIeOrEdge = /MSIE|Trident/.test(UA);
5536
5644
 
5537
- var arraySpeciesConstructor = arraySpeciesConstructor$1;
5645
+ var userAgent = engineUserAgent;
5538
5646
 
5539
- // `ArraySpeciesCreate` abstract operation
5540
- // https://tc39.es/ecma262/#sec-arrayspeciescreate
5541
- var arraySpeciesCreate$1 = function (originalArray, length) {
5542
- return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
5543
- };
5647
+ var webkit = userAgent.match(/AppleWebKit\/(\d+)\./);
5544
5648
 
5545
- var bind = functionBindContext;
5546
- var uncurryThis$3 = functionUncurryThis;
5547
- var IndexedObject = indexedObject;
5548
- var toObject = toObject$7;
5549
- var lengthOfArrayLike$1 = lengthOfArrayLike$7;
5550
- var arraySpeciesCreate = arraySpeciesCreate$1;
5649
+ var engineWebkitVersion = !!webkit && +webkit[1];
5551
5650
 
5552
- var push = uncurryThis$3([].push);
5651
+ var global$3 = global$W;
5652
+ var uncurryThis$2 = functionUncurryThis;
5653
+ var fails$1 = fails$r;
5654
+ var aCallable = aCallable$8;
5655
+ var internalSort = arraySort$1;
5656
+ var ArrayBufferViewCore$1 = arrayBufferViewCore;
5657
+ var FF = engineFfVersion;
5658
+ var IE_OR_EDGE = engineIsIeOrEdge;
5659
+ var V8 = engineV8Version;
5660
+ var WEBKIT = engineWebkitVersion;
5553
5661
 
5554
- // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation
5555
- var createMethod = function (TYPE) {
5556
- var IS_MAP = TYPE == 1;
5557
- var IS_FILTER = TYPE == 2;
5558
- var IS_SOME = TYPE == 3;
5559
- var IS_EVERY = TYPE == 4;
5560
- var IS_FIND_INDEX = TYPE == 6;
5561
- var IS_FILTER_REJECT = TYPE == 7;
5562
- var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
5563
- return function ($this, callbackfn, that, specificCreate) {
5564
- var O = toObject($this);
5565
- var self = IndexedObject(O);
5566
- var boundFunction = bind(callbackfn, that);
5567
- var length = lengthOfArrayLike$1(self);
5568
- var index = 0;
5569
- var create = specificCreate || arraySpeciesCreate;
5570
- var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined;
5571
- var value, result;
5572
- for (;length > index; index++) if (NO_HOLES || index in self) {
5573
- value = self[index];
5574
- result = boundFunction(value, index, O);
5575
- if (TYPE) {
5576
- if (IS_MAP) target[index] = result; // map
5577
- else if (result) switch (TYPE) {
5578
- case 3: return true; // some
5579
- case 5: return value; // find
5580
- case 6: return index; // findIndex
5581
- case 2: push(target, value); // filter
5582
- } else switch (TYPE) {
5583
- case 4: return false; // every
5584
- case 7: push(target, value); // filterReject
5585
- }
5586
- }
5587
- }
5588
- return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
5589
- };
5590
- };
5662
+ var aTypedArray$1 = ArrayBufferViewCore$1.aTypedArray;
5663
+ var exportTypedArrayMethod$1 = ArrayBufferViewCore$1.exportTypedArrayMethod;
5664
+ var Uint16Array = global$3.Uint16Array;
5665
+ var un$Sort = Uint16Array && uncurryThis$2(Uint16Array.prototype.sort);
5591
5666
 
5592
- var arrayIteration = {
5593
- // `Array.prototype.forEach` method
5594
- // https://tc39.es/ecma262/#sec-array.prototype.foreach
5595
- forEach: createMethod(0),
5596
- // `Array.prototype.map` method
5597
- // https://tc39.es/ecma262/#sec-array.prototype.map
5598
- map: createMethod(1),
5599
- // `Array.prototype.filter` method
5600
- // https://tc39.es/ecma262/#sec-array.prototype.filter
5601
- filter: createMethod(2),
5602
- // `Array.prototype.some` method
5603
- // https://tc39.es/ecma262/#sec-array.prototype.some
5604
- some: createMethod(3),
5605
- // `Array.prototype.every` method
5606
- // https://tc39.es/ecma262/#sec-array.prototype.every
5607
- every: createMethod(4),
5608
- // `Array.prototype.find` method
5609
- // https://tc39.es/ecma262/#sec-array.prototype.find
5610
- find: createMethod(5),
5611
- // `Array.prototype.findIndex` method
5612
- // https://tc39.es/ecma262/#sec-array.prototype.findIndex
5613
- findIndex: createMethod(6),
5614
- // `Array.prototype.filterReject` method
5615
- // https://github.com/tc39/proposal-array-filtering
5616
- filterReject: createMethod(7)
5617
- };
5667
+ // WebKit
5668
+ var ACCEPT_INCORRECT_ARGUMENTS = !!un$Sort && !(fails$1(function () {
5669
+ un$Sort(new Uint16Array(2), null);
5670
+ }) && fails$1(function () {
5671
+ un$Sort(new Uint16Array(2), {});
5672
+ }));
5618
5673
 
5619
- var isCallable = isCallable$p;
5620
- var isObject$1 = isObject$e;
5621
- var setPrototypeOf$1 = objectSetPrototypeOf;
5674
+ var STABLE_SORT = !!un$Sort && !fails$1(function () {
5675
+ // feature detection can be too slow, so check engines versions
5676
+ if (V8) return V8 < 74;
5677
+ if (FF) return FF < 67;
5678
+ if (IE_OR_EDGE) return true;
5679
+ if (WEBKIT) return WEBKIT < 602;
5622
5680
 
5623
- // makes subclassing work correct for wrapped built-ins
5624
- var inheritIfRequired$1 = function ($this, dummy, Wrapper) {
5625
- var NewTarget, NewTargetPrototype;
5626
- if (
5627
- // it can work only with native `setPrototypeOf`
5628
- setPrototypeOf$1 &&
5629
- // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
5630
- isCallable(NewTarget = dummy.constructor) &&
5631
- NewTarget !== Wrapper &&
5632
- isObject$1(NewTargetPrototype = NewTarget.prototype) &&
5633
- NewTargetPrototype !== Wrapper.prototype
5634
- ) setPrototypeOf$1($this, NewTargetPrototype);
5635
- return $this;
5681
+ var array = new Uint16Array(516);
5682
+ var expected = Array(516);
5683
+ var index, mod;
5684
+
5685
+ for (index = 0; index < 516; index++) {
5686
+ mod = index % 4;
5687
+ array[index] = 515 - index;
5688
+ expected[index] = index - 2 * mod + 3;
5689
+ }
5690
+
5691
+ un$Sort(array, function (a, b) {
5692
+ return (a / 4 | 0) - (b / 4 | 0);
5693
+ });
5694
+
5695
+ for (index = 0; index < 516; index++) {
5696
+ if (array[index] !== expected[index]) return true;
5697
+ }
5698
+ });
5699
+
5700
+ var getSortCompare = function (comparefn) {
5701
+ return function (x, y) {
5702
+ if (comparefn !== undefined) return +comparefn(x, y) || 0;
5703
+ // eslint-disable-next-line no-self-compare -- NaN check
5704
+ if (y !== y) return -1;
5705
+ // eslint-disable-next-line no-self-compare -- NaN check
5706
+ if (x !== x) return 1;
5707
+ if (x === 0 && y === 0) return 1 / x > 0 && 1 / y < 0 ? 1 : -1;
5708
+ return x > y;
5709
+ };
5636
5710
  };
5637
5711
 
5638
- var $$2 = _export;
5639
- var global$5 = global$W;
5640
- var call$1 = functionCall;
5641
- var DESCRIPTORS = descriptors;
5642
- var TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS = typedArrayConstructorsRequireWrappers;
5643
- var ArrayBufferViewCore$3 = arrayBufferViewCore;
5644
- var ArrayBufferModule = arrayBuffer;
5645
- var anInstance = anInstance$4;
5646
- var createPropertyDescriptor = createPropertyDescriptor$6;
5647
- var createNonEnumerableProperty = createNonEnumerableProperty$9;
5648
- var isIntegralNumber = isIntegralNumber$1;
5649
- var toLength$2 = toLength$9;
5650
- var toIndex = toIndex$2;
5651
- var toOffset$1 = toOffset$2;
5652
- var toPropertyKey = toPropertyKey$4;
5653
- var hasOwn = hasOwnProperty_1;
5654
- var classof = classof$a;
5655
- var isObject = isObject$e;
5656
- var isSymbol = isSymbol$3;
5657
- var create = objectCreate;
5658
- var isPrototypeOf = objectIsPrototypeOf;
5659
- var setPrototypeOf = objectSetPrototypeOf;
5660
- var getOwnPropertyNames = objectGetOwnPropertyNames.f;
5661
- var typedArrayFrom = typedArrayFrom$1;
5662
- var forEach = arrayIteration.forEach;
5663
- var setSpecies = setSpecies$2;
5664
- var definePropertyModule = objectDefineProperty;
5665
- var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor;
5666
- var InternalStateModule = internalState;
5667
- var inheritIfRequired = inheritIfRequired$1;
5712
+ // `%TypedArray%.prototype.sort` method
5713
+ // https://tc39.es/ecma262/#sec-%typedarray%.prototype.sort
5714
+ exportTypedArrayMethod$1('sort', function sort(comparefn) {
5715
+ if (comparefn !== undefined) aCallable(comparefn);
5716
+ if (STABLE_SORT) return un$Sort(this, comparefn);
5668
5717
 
5669
- var getInternalState = InternalStateModule.get;
5670
- var setInternalState = InternalStateModule.set;
5671
- var nativeDefineProperty = definePropertyModule.f;
5672
- var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
5673
- var round = Math.round;
5674
- var RangeError$1 = global$5.RangeError;
5675
- var ArrayBuffer$1 = ArrayBufferModule.ArrayBuffer;
5676
- var ArrayBufferPrototype = ArrayBuffer$1.prototype;
5677
- var DataView$1 = ArrayBufferModule.DataView;
5678
- var NATIVE_ARRAY_BUFFER_VIEWS = ArrayBufferViewCore$3.NATIVE_ARRAY_BUFFER_VIEWS;
5679
- var TYPED_ARRAY_CONSTRUCTOR = ArrayBufferViewCore$3.TYPED_ARRAY_CONSTRUCTOR;
5680
- var TYPED_ARRAY_TAG = ArrayBufferViewCore$3.TYPED_ARRAY_TAG;
5681
- var TypedArray = ArrayBufferViewCore$3.TypedArray;
5682
- var TypedArrayPrototype = ArrayBufferViewCore$3.TypedArrayPrototype;
5683
- var aTypedArrayConstructor = ArrayBufferViewCore$3.aTypedArrayConstructor;
5684
- var isTypedArray = ArrayBufferViewCore$3.isTypedArray;
5685
- var BYTES_PER_ELEMENT = 'BYTES_PER_ELEMENT';
5686
- var WRONG_LENGTH = 'Wrong length';
5718
+ return internalSort(aTypedArray$1(this), getSortCompare(comparefn));
5719
+ }, !STABLE_SORT || ACCEPT_INCORRECT_ARGUMENTS);
5720
+
5721
+ var global$2 = global$W;
5722
+ var apply = functionApply;
5723
+ var ArrayBufferViewCore = arrayBufferViewCore;
5724
+ var fails = fails$r;
5725
+ var arraySlice = arraySlice$4;
5726
+
5727
+ var Int8Array = global$2.Int8Array;
5728
+ var aTypedArray = ArrayBufferViewCore.aTypedArray;
5729
+ var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
5730
+ var $toLocaleString = [].toLocaleString;
5687
5731
 
5688
- var fromList = function (C, list) {
5689
- aTypedArrayConstructor(C);
5690
- var index = 0;
5691
- var length = list.length;
5692
- var result = new C(length);
5693
- while (length > index) result[index] = list[index++];
5694
- return result;
5695
- };
5732
+ // iOS Safari 6.x fails here
5733
+ var TO_LOCALE_STRING_BUG = !!Int8Array && fails(function () {
5734
+ $toLocaleString.call(new Int8Array(1));
5735
+ });
5696
5736
 
5697
- var addGetter = function (it, key) {
5698
- nativeDefineProperty(it, key, { get: function () {
5699
- return getInternalState(this)[key];
5700
- } });
5701
- };
5737
+ var FORCED = fails(function () {
5738
+ return [1, 2].toLocaleString() != new Int8Array([1, 2]).toLocaleString();
5739
+ }) || !fails(function () {
5740
+ Int8Array.prototype.toLocaleString.call([1, 2]);
5741
+ });
5702
5742
 
5703
- var isArrayBuffer = function (it) {
5704
- var klass;
5705
- return isPrototypeOf(ArrayBufferPrototype, it) || (klass = classof(it)) == 'ArrayBuffer' || klass == 'SharedArrayBuffer';
5706
- };
5743
+ // `%TypedArray%.prototype.toLocaleString` method
5744
+ // https://tc39.es/ecma262/#sec-%typedarray%.prototype.tolocalestring
5745
+ exportTypedArrayMethod('toLocaleString', function toLocaleString() {
5746
+ return apply(
5747
+ $toLocaleString,
5748
+ TO_LOCALE_STRING_BUG ? arraySlice(aTypedArray(this)) : aTypedArray(this),
5749
+ arraySlice(arguments)
5750
+ );
5751
+ }, FORCED);
5707
5752
 
5708
- var isTypedArrayIndex = function (target, key) {
5709
- return isTypedArray(target)
5710
- && !isSymbol(key)
5711
- && key in target
5712
- && isIntegralNumber(+key)
5713
- && key >= 0;
5714
- };
5753
+ const deleteQueryParameter = (windowLocation, name, value) => {
5754
+ const nameValue = name + '=' + value;
5755
+ let toReplace = nameValue;
5715
5756
 
5716
- var wrappedGetOwnPropertyDescriptor = function getOwnPropertyDescriptor(target, key) {
5717
- key = toPropertyKey(key);
5718
- return isTypedArrayIndex(target, key)
5719
- ? createPropertyDescriptor(2, target[key])
5720
- : nativeGetOwnPropertyDescriptor(target, key);
5757
+ if (windowLocation.indexOf('?' + nameValue) >= 0) {
5758
+ if (windowLocation.indexOf('?' + nameValue + '&') >= 0) {
5759
+ toReplace += '&';
5760
+ } else {
5761
+ toReplace = '?' + toReplace;
5762
+ }
5763
+ } else if (windowLocation.indexOf('&' + nameValue) >= 0) {
5764
+ toReplace = '&' + toReplace;
5765
+ }
5766
+
5767
+ return windowLocation.replace(toReplace, '');
5721
5768
  };
5769
+ const getQueryParameter = name => {
5770
+ const paramsForSearch = parseParams(window.location.search.substring(1));
5722
5771
 
5723
- var wrappedDefineProperty = function defineProperty(target, key, descriptor) {
5724
- key = toPropertyKey(key);
5725
- if (isTypedArrayIndex(target, key)
5726
- && isObject(descriptor)
5727
- && hasOwn(descriptor, 'value')
5728
- && !hasOwn(descriptor, 'get')
5729
- && !hasOwn(descriptor, 'set')
5730
- // TODO: add validation descriptor w/o calling accessors
5731
- && !descriptor.configurable
5732
- && (!hasOwn(descriptor, 'writable') || descriptor.writable)
5733
- && (!hasOwn(descriptor, 'enumerable') || descriptor.enumerable)
5734
- ) {
5735
- target[key] = descriptor.value;
5736
- return target;
5737
- } return nativeDefineProperty(target, key, descriptor);
5772
+ if (paramsForSearch[name]) {
5773
+ return paramsForSearch[name];
5774
+ }
5775
+
5776
+ return undefined;
5738
5777
  };
5778
+ const createCodeChallenge = verifier => __awaiter(void 0, void 0, void 0, function* () {
5779
+ if (getCryptoSubtle()) {
5780
+ const code_challengeBuffer = yield sha256(verifier);
5781
+ const code_challenge = bufferToBase64UrlEncoded(code_challengeBuffer);
5782
+ return {
5783
+ code_challenge,
5784
+ code_challenge_method: 'S256'
5785
+ };
5786
+ } else {
5787
+ return {
5788
+ code_challenge: verifier,
5789
+ code_challenge_method: undefined
5790
+ };
5791
+ }
5792
+ });
5793
+ const createLoginUrl = params => __awaiter(void 0, void 0, void 0, function* () {
5794
+ const {
5795
+ noPrompt,
5796
+ force_2fa,
5797
+ scopes,
5798
+ authHost,
5799
+ clientId,
5800
+ rememberMe,
5801
+ login_hint,
5802
+ reauthenticate_mode
5803
+ } = params;
5804
+ const code_verifier = createRandomString(64);
5805
+ const state = createRandomString(6);
5806
+ const nonce = createRandomString(6);
5807
+ const {
5808
+ code_challenge,
5809
+ code_challenge_method
5810
+ } = yield createCodeChallenge(code_verifier);
5811
+ const scope = scopes.join(',');
5812
+ const prompt = noPrompt ? 'none' : '';
5813
+ let url = `${authHost}/oauth/authorize?response_type=code&scope=${scope}&client_id=${clientId}&redirect_uri=${encodeURIComponent(window.location.href)}&code_challenge=${encodeURIComponent(code_challenge)}&code_challenge_method=${code_challenge_method}&force_2fa=${force_2fa}&nonce=${nonce}&state=${state}&prompt=${prompt}&remember_me=${rememberMe}`;
5814
+
5815
+ if (login_hint) {
5816
+ url = `${url}&login_hint=${login_hint}`;
5817
+ }
5739
5818
 
5740
- if (DESCRIPTORS) {
5741
- if (!NATIVE_ARRAY_BUFFER_VIEWS) {
5742
- getOwnPropertyDescriptorModule.f = wrappedGetOwnPropertyDescriptor;
5743
- definePropertyModule.f = wrappedDefineProperty;
5744
- addGetter(TypedArrayPrototype, 'buffer');
5745
- addGetter(TypedArrayPrototype, 'byteOffset');
5746
- addGetter(TypedArrayPrototype, 'byteLength');
5747
- addGetter(TypedArrayPrototype, 'length');
5819
+ if (reauthenticate_mode !== undefined) {
5820
+ url = `${url}&reauthenticate_mode=${reauthenticate_mode}`;
5748
5821
  }
5749
5822
 
5750
- $$2({ target: 'Object', stat: true, forced: !NATIVE_ARRAY_BUFFER_VIEWS }, {
5751
- getOwnPropertyDescriptor: wrappedGetOwnPropertyDescriptor,
5752
- defineProperty: wrappedDefineProperty
5753
- });
5823
+ return {
5824
+ url,
5825
+ state,
5826
+ code_verifier
5827
+ };
5828
+ });
5829
+ const getCrypto = () => {
5830
+ return window.crypto || window.msCrypto;
5831
+ };
5832
+ const createRandomString = size => {
5833
+ const charset = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
5834
+ let random = '';
5835
+ const randomValues = Array.from(getCrypto().getRandomValues(new Uint8Array(size)));
5836
+ randomValues.forEach(v => random += charset[v % charset.length]);
5837
+ return random;
5838
+ };
5754
5839
 
5755
- typedArrayConstructor.exports = function (TYPE, wrapper, CLAMPED) {
5756
- var BYTES = TYPE.match(/\d+$/)[0] / 8;
5757
- var CONSTRUCTOR_NAME = TYPE + (CLAMPED ? 'Clamped' : '') + 'Array';
5758
- var GETTER = 'get' + TYPE;
5759
- var SETTER = 'set' + TYPE;
5760
- var NativeTypedArrayConstructor = global$5[CONSTRUCTOR_NAME];
5761
- var TypedArrayConstructor = NativeTypedArrayConstructor;
5762
- var TypedArrayConstructorPrototype = TypedArrayConstructor && TypedArrayConstructor.prototype;
5763
- var exported = {};
5840
+ const sha256 = s => __awaiter(void 0, void 0, void 0, function* () {
5841
+ const digestOp = getCryptoSubtle().digest({
5842
+ name: 'SHA-256'
5843
+ }, new TextEncoder().encode(s));
5764
5844
 
5765
- var getter = function (that, index) {
5766
- var data = getInternalState(that);
5767
- return data.view[GETTER](index * BYTES + data.byteOffset, true);
5768
- };
5845
+ if (window.msCrypto) {
5846
+ return new Promise((res, rej) => {
5847
+ digestOp.oncomplete = e => {
5848
+ res(e.target.result);
5849
+ };
5769
5850
 
5770
- var setter = function (that, index, value) {
5771
- var data = getInternalState(that);
5772
- if (CLAMPED) value = (value = round(value)) < 0 ? 0 : value > 0xFF ? 0xFF : value & 0xFF;
5773
- data.view[SETTER](index * BYTES + data.byteOffset, value, true);
5774
- };
5851
+ digestOp.onerror = e => {
5852
+ rej(e.error);
5853
+ };
5775
5854
 
5776
- var addElement = function (that, index) {
5777
- nativeDefineProperty(that, index, {
5778
- get: function () {
5779
- return getter(this, index);
5780
- },
5781
- set: function (value) {
5782
- return setter(this, index, value);
5783
- },
5784
- enumerable: true
5785
- });
5786
- };
5855
+ digestOp.onabort = () => {
5856
+ rej('The digest operation was aborted');
5857
+ };
5858
+ });
5859
+ }
5787
5860
 
5788
- if (!NATIVE_ARRAY_BUFFER_VIEWS) {
5789
- TypedArrayConstructor = wrapper(function (that, data, offset, $length) {
5790
- anInstance(that, TypedArrayConstructorPrototype);
5791
- var index = 0;
5792
- var byteOffset = 0;
5793
- var buffer, byteLength, length;
5794
- if (!isObject(data)) {
5795
- length = toIndex(data);
5796
- byteLength = length * BYTES;
5797
- buffer = new ArrayBuffer$1(byteLength);
5798
- } else if (isArrayBuffer(data)) {
5799
- buffer = data;
5800
- byteOffset = toOffset$1(offset, BYTES);
5801
- var $len = data.byteLength;
5802
- if ($length === undefined) {
5803
- if ($len % BYTES) throw RangeError$1(WRONG_LENGTH);
5804
- byteLength = $len - byteOffset;
5805
- if (byteLength < 0) throw RangeError$1(WRONG_LENGTH);
5806
- } else {
5807
- byteLength = toLength$2($length) * BYTES;
5808
- if (byteLength + byteOffset > $len) throw RangeError$1(WRONG_LENGTH);
5809
- }
5810
- length = byteLength / BYTES;
5811
- } else if (isTypedArray(data)) {
5812
- return fromList(TypedArrayConstructor, data);
5813
- } else {
5814
- return call$1(typedArrayFrom, TypedArrayConstructor, data);
5815
- }
5816
- setInternalState(that, {
5817
- buffer: buffer,
5818
- byteOffset: byteOffset,
5819
- byteLength: byteLength,
5820
- length: length,
5821
- view: new DataView$1(buffer)
5822
- });
5823
- while (index < length) addElement(that, index++);
5824
- });
5861
+ return yield digestOp;
5862
+ });
5825
5863
 
5826
- if (setPrototypeOf) setPrototypeOf(TypedArrayConstructor, TypedArray);
5827
- TypedArrayConstructorPrototype = TypedArrayConstructor.prototype = create(TypedArrayPrototype);
5828
- } else if (TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS) {
5829
- TypedArrayConstructor = wrapper(function (dummy, data, typedArrayOffset, $length) {
5830
- anInstance(dummy, TypedArrayConstructorPrototype);
5831
- return inheritIfRequired(function () {
5832
- if (!isObject(data)) return new NativeTypedArrayConstructor(toIndex(data));
5833
- if (isArrayBuffer(data)) return $length !== undefined
5834
- ? new NativeTypedArrayConstructor(data, toOffset$1(typedArrayOffset, BYTES), $length)
5835
- : typedArrayOffset !== undefined
5836
- ? new NativeTypedArrayConstructor(data, toOffset$1(typedArrayOffset, BYTES))
5837
- : new NativeTypedArrayConstructor(data);
5838
- if (isTypedArray(data)) return fromList(TypedArrayConstructor, data);
5839
- return call$1(typedArrayFrom, TypedArrayConstructor, data);
5840
- }(), dummy, TypedArrayConstructor);
5841
- });
5864
+ const getCryptoSubtle = () => {
5865
+ const crypto = getCrypto();
5866
+ return crypto.subtle || crypto.webkitSubtle;
5867
+ };
5842
5868
 
5843
- if (setPrototypeOf) setPrototypeOf(TypedArrayConstructor, TypedArray);
5844
- forEach(getOwnPropertyNames(NativeTypedArrayConstructor), function (key) {
5845
- if (!(key in TypedArrayConstructor)) {
5846
- createNonEnumerableProperty(TypedArrayConstructor, key, NativeTypedArrayConstructor[key]);
5847
- }
5848
- });
5849
- TypedArrayConstructor.prototype = TypedArrayConstructorPrototype;
5850
- }
5869
+ const bufferToBase64UrlEncoded = input => {
5870
+ const ie11SafeInput = new Uint8Array(input);
5871
+ return urlEncodeB64(window.btoa(String.fromCharCode(...Array.from(ie11SafeInput))));
5872
+ };
5873
+
5874
+ const urlEncodeB64 = input => {
5875
+ const b64Chars = {
5876
+ '+': '-',
5877
+ '/': '_',
5878
+ '=': ''
5879
+ };
5880
+ return input.replace(/[+/=]/g, m => b64Chars[m]);
5881
+ };
5851
5882
 
5852
- if (TypedArrayConstructorPrototype.constructor !== TypedArrayConstructor) {
5853
- createNonEnumerableProperty(TypedArrayConstructorPrototype, 'constructor', TypedArrayConstructor);
5854
- }
5883
+ const parseParams = url => {
5884
+ const result = {};
5885
+ const params = url.split('&');
5855
5886
 
5856
- createNonEnumerableProperty(TypedArrayConstructorPrototype, TYPED_ARRAY_CONSTRUCTOR, TypedArrayConstructor);
5887
+ for (let i = 0; i < params.length; i++) {
5888
+ const param = params[i].split('=', 2);
5889
+ if (param.length !== 2) continue;
5890
+ result[param[0]] = decodeURIComponent(param[1].replace(/\+/g, ' '));
5891
+ }
5857
5892
 
5858
- if (TYPED_ARRAY_TAG) {
5859
- createNonEnumerableProperty(TypedArrayConstructorPrototype, TYPED_ARRAY_TAG, CONSTRUCTOR_NAME);
5860
- }
5893
+ return result;
5894
+ };
5861
5895
 
5862
- var FORCED = TypedArrayConstructor != NativeTypedArrayConstructor;
5896
+ var _Notification_pubnubKeys, _Notification_pubnub, _Notification_eventListeners, _Notification_uniqueSessionTriggerHook, _Notification_userPresenceTriggerHook, _Notification_currentUUIDString, _Notification_joinTimeToken, _Notification_initFirmChannel, _Notification_initUserChannel, _Notification_initUniqueSessionChannel;
5897
+ const EMPTY_GUID = '00000000-0000-0000-0000-000000000000';
5898
+ const WEB_GUID = '1111111-1111-1111-1111-111111111111';
5899
+ const USER_ACTION = {
5900
+ USERNAME_CHANGED: '1',
5901
+ PASSWORD_CHANGED: '2',
5902
+ USER_DISABLED: '3',
5903
+ WEB_RESTRICTED: '401'
5904
+ };
5905
+ class Notification {
5906
+ constructor() {
5907
+ _Notification_pubnubKeys.set(this, void 0);
5863
5908
 
5864
- exported[CONSTRUCTOR_NAME] = TypedArrayConstructor;
5909
+ _Notification_pubnub.set(this, void 0);
5865
5910
 
5866
- $$2({ global: true, constructor: true, forced: FORCED, sham: !NATIVE_ARRAY_BUFFER_VIEWS }, exported);
5911
+ _Notification_eventListeners.set(this, []);
5867
5912
 
5868
- if (!(BYTES_PER_ELEMENT in TypedArrayConstructor)) {
5869
- createNonEnumerableProperty(TypedArrayConstructor, BYTES_PER_ELEMENT, BYTES);
5870
- }
5913
+ _Notification_uniqueSessionTriggerHook.set(this, undefined);
5871
5914
 
5872
- if (!(BYTES_PER_ELEMENT in TypedArrayConstructorPrototype)) {
5873
- createNonEnumerableProperty(TypedArrayConstructorPrototype, BYTES_PER_ELEMENT, BYTES);
5874
- }
5915
+ _Notification_userPresenceTriggerHook.set(this, undefined);
5875
5916
 
5876
- setSpecies(CONSTRUCTOR_NAME);
5877
- };
5878
- } else typedArrayConstructor.exports = function () { /* empty */ };
5917
+ _Notification_currentUUIDString.set(this, '');
5879
5918
 
5880
- var createTypedArrayConstructor = typedArrayConstructor.exports;
5919
+ _Notification_joinTimeToken.set(this, 0);
5881
5920
 
5882
- // `Uint8Array` constructor
5883
- // https://tc39.es/ecma262/#sec-typedarray-objects
5884
- createTypedArrayConstructor('Uint8', function (init) {
5885
- return function Uint8Array(data, byteOffset, length) {
5886
- return init(this, data, byteOffset, length);
5887
- };
5888
- });
5921
+ this.init = params => __awaiter(this, void 0, void 0, function* () {
5922
+ const {
5923
+ authHost,
5924
+ clientId,
5925
+ firmId,
5926
+ userId,
5927
+ userEmail,
5928
+ uniqueSession,
5929
+ userPresence,
5930
+ listenToRestrictWebFlag,
5931
+ hooks
5932
+ } = params;
5889
5933
 
5890
- var global$4 = global$W;
5891
- var call = functionCall;
5892
- var ArrayBufferViewCore$2 = arrayBufferViewCore;
5893
- var lengthOfArrayLike = lengthOfArrayLike$7;
5894
- var toOffset = toOffset$2;
5895
- var toIndexedObject = toObject$7;
5896
- var fails$2 = fails$r;
5934
+ if (!!hooks && hooks.uniqueSessionTrigger) {
5935
+ __classPrivateFieldSet(this, _Notification_uniqueSessionTriggerHook, hooks.uniqueSessionTrigger, "f");
5936
+ }
5897
5937
 
5898
- var RangeError = global$4.RangeError;
5899
- var Int8Array$1 = global$4.Int8Array;
5900
- var Int8ArrayPrototype = Int8Array$1 && Int8Array$1.prototype;
5901
- var $set = Int8ArrayPrototype && Int8ArrayPrototype.set;
5902
- var aTypedArray$2 = ArrayBufferViewCore$2.aTypedArray;
5903
- var exportTypedArrayMethod$2 = ArrayBufferViewCore$2.exportTypedArrayMethod;
5938
+ if (!!hooks && hooks.userPresenceTrigger) {
5939
+ __classPrivateFieldSet(this, _Notification_userPresenceTriggerHook, hooks.userPresenceTrigger, "f");
5940
+ }
5904
5941
 
5905
- var WORKS_WITH_OBJECTS_AND_GEERIC_ON_TYPED_ARRAYS = !fails$2(function () {
5906
- // eslint-disable-next-line es-x/no-typed-arrays -- required for testing
5907
- var array = new Uint8ClampedArray(2);
5908
- call($set, array, { length: 1, 0: 3 }, 1);
5909
- return array[1] !== 3;
5910
- });
5942
+ __classPrivateFieldSet(this, _Notification_currentUUIDString, `${userId}~${WEB_GUID}~~${Math.floor(Math.random() * 100 + 1)}`, "f");
5911
5943
 
5912
- // https://bugs.chromium.org/p/v8/issues/detail?id=11294 and other
5913
- var TO_OBJECT_BUG = WORKS_WITH_OBJECTS_AND_GEERIC_ON_TYPED_ARRAYS && ArrayBufferViewCore$2.NATIVE_ARRAY_BUFFER_VIEWS && fails$2(function () {
5914
- var array = new Int8Array$1(2);
5915
- array.set(1);
5916
- array.set('2', 1);
5917
- return array[0] !== 0 || array[1] !== 2;
5918
- });
5944
+ if (userPresence) {
5945
+ __classPrivateFieldGet(this, _Notification_pubnub, "f").setUUID(__classPrivateFieldGet(this, _Notification_currentUUIDString, "f"));
5919
5946
 
5920
- // `%TypedArray%.prototype.set` method
5921
- // https://tc39.es/ecma262/#sec-%typedarray%.prototype.set
5922
- exportTypedArrayMethod$2('set', function set(arrayLike /* , offset */) {
5923
- aTypedArray$2(this);
5924
- var offset = toOffset(arguments.length > 1 ? arguments[1] : undefined, 1);
5925
- var src = toIndexedObject(arrayLike);
5926
- if (WORKS_WITH_OBJECTS_AND_GEERIC_ON_TYPED_ARRAYS) return call($set, this, src, offset);
5927
- var length = this.length;
5928
- var len = lengthOfArrayLike(src);
5929
- var index = 0;
5930
- if (len + offset > length) throw RangeError('Wrong length');
5931
- while (index < len) this[offset + index] = src[index++];
5932
- }, !WORKS_WITH_OBJECTS_AND_GEERIC_ON_TYPED_ARRAYS || TO_OBJECT_BUG);
5947
+ __classPrivateFieldGet(this, _Notification_pubnubKeys, "f").uuid = __classPrivateFieldGet(this, _Notification_currentUUIDString, "f");
5948
+ }
5933
5949
 
5934
- var userAgent$1 = engineUserAgent;
5950
+ __classPrivateFieldGet(this, _Notification_initFirmChannel, "f").call(this, {
5951
+ authHost,
5952
+ clientId,
5953
+ userEmail,
5954
+ firmId,
5955
+ userId,
5956
+ userPresence,
5957
+ listenToRestrictWebFlag
5958
+ });
5935
5959
 
5936
- var firefox = userAgent$1.match(/firefox\/(\d+)/i);
5960
+ __classPrivateFieldGet(this, _Notification_initUserChannel, "f").call(this, userId);
5937
5961
 
5938
- var engineFfVersion = !!firefox && +firefox[1];
5962
+ if (uniqueSession) {
5963
+ yield __classPrivateFieldGet(this, _Notification_initUniqueSessionChannel, "f").call(this, {
5964
+ authHost,
5965
+ clientId,
5966
+ userEmail
5967
+ });
5968
+ }
5969
+ });
5939
5970
 
5940
- var UA = engineUserAgent;
5971
+ this.destroy = () => {
5972
+ if (__classPrivateFieldGet(this, _Notification_pubnub, "f")) {
5973
+ __classPrivateFieldGet(this, _Notification_pubnub, "f").unsubscribeAll();
5941
5974
 
5942
- var engineIsIeOrEdge = /MSIE|Trident/.test(UA);
5975
+ __classPrivateFieldSet(this, _Notification_eventListeners, [], "f");
5976
+ }
5977
+ };
5943
5978
 
5944
- var userAgent = engineUserAgent;
5979
+ this.registerEventListenerForUserChannel = params => {
5980
+ const {
5981
+ topic,
5982
+ messageType,
5983
+ callback
5984
+ } = params;
5945
5985
 
5946
- var webkit = userAgent.match(/AppleWebKit\/(\d+)\./);
5986
+ if (!lodash.isFunction(callback)) {
5987
+ throw Error(`Registering Event Listener ${topic} ${messageType}: callback needs to be a function`);
5988
+ }
5947
5989
 
5948
- var engineWebkitVersion = !!webkit && +webkit[1];
5990
+ __classPrivateFieldGet(this, _Notification_eventListeners, "f").push({
5991
+ topic,
5992
+ messageType,
5993
+ callback
5994
+ });
5995
+ };
5949
5996
 
5950
- var global$3 = global$W;
5951
- var uncurryThis$2 = functionUncurryThis;
5952
- var fails$1 = fails$r;
5953
- var aCallable = aCallable$8;
5954
- var internalSort = arraySort$1;
5955
- var ArrayBufferViewCore$1 = arrayBufferViewCore;
5956
- var FF = engineFfVersion;
5957
- var IE_OR_EDGE = engineIsIeOrEdge;
5958
- var V8 = engineV8Version;
5959
- var WEBKIT = engineWebkitVersion;
5997
+ this.setUniqueSessionTriggerHook = hook => {
5998
+ __classPrivateFieldSet(this, _Notification_uniqueSessionTriggerHook, hook, "f");
5999
+ };
5960
6000
 
5961
- var aTypedArray$1 = ArrayBufferViewCore$1.aTypedArray;
5962
- var exportTypedArrayMethod$1 = ArrayBufferViewCore$1.exportTypedArrayMethod;
5963
- var Uint16Array = global$3.Uint16Array;
5964
- var un$Sort = Uint16Array && uncurryThis$2(Uint16Array.prototype.sort);
6001
+ this.setUserPresenceTriggerHook = hook => {
6002
+ __classPrivateFieldSet(this, _Notification_userPresenceTriggerHook, hook, "f");
6003
+ };
5965
6004
 
5966
- // WebKit
5967
- var ACCEPT_INCORRECT_ARGUMENTS = !!un$Sort && !(fails$1(function () {
5968
- un$Sort(new Uint16Array(2), null);
5969
- }) && fails$1(function () {
5970
- un$Sort(new Uint16Array(2), {});
5971
- }));
6005
+ _Notification_initFirmChannel.set(this, params => {
6006
+ const {
6007
+ authHost,
6008
+ clientId,
6009
+ userEmail,
6010
+ firmId,
6011
+ userId,
6012
+ userPresence,
6013
+ listenToRestrictWebFlag
6014
+ } = params;
5972
6015
 
5973
- var STABLE_SORT = !!un$Sort && !fails$1(function () {
5974
- // feature detection can be too slow, so check engines versions
5975
- if (V8) return V8 < 74;
5976
- if (FF) return FF < 67;
5977
- if (IE_OR_EDGE) return true;
5978
- if (WEBKIT) return WEBKIT < 602;
6016
+ __classPrivateFieldGet(this, _Notification_pubnub, "f").addListener({
6017
+ presence: presenceEvent => __awaiter(this, void 0, void 0, function* () {
6018
+ const {
6019
+ action,
6020
+ uuid,
6021
+ timetoken
6022
+ } = presenceEvent;
5979
6023
 
5980
- var array = new Uint16Array(516);
5981
- var expected = Array(516);
5982
- var index, mod;
6024
+ if (uuid === __classPrivateFieldGet(this, _Notification_pubnubKeys, "f").uuid) {
6025
+ return;
6026
+ }
5983
6027
 
5984
- for (index = 0; index < 516; index++) {
5985
- mod = index % 4;
5986
- array[index] = 515 - index;
5987
- expected[index] = index - 2 * mod + 3;
5988
- }
6028
+ const valuesUUID = uuid.split('~');
6029
+ const userIdFromPresence = valuesUUID[0] || '';
6030
+ const instanceGuidFromPresence = valuesUUID[1] || '';
6031
+ let timeTokenPresence = 0;
5989
6032
 
5990
- un$Sort(array, function (a, b) {
5991
- return (a / 4 | 0) - (b / 4 | 0);
5992
- });
6033
+ try {
6034
+ timeTokenPresence = parseInt(timetoken);
6035
+ } catch (e) {
6036
+ timeTokenPresence = 0;
6037
+ }
5993
6038
 
5994
- for (index = 0; index < 516; index++) {
5995
- if (array[index] !== expected[index]) return true;
5996
- }
5997
- });
6039
+ if (userPresence && action === 'join' && userIdFromPresence === userId && instanceGuidFromPresence !== WEB_GUID && instanceGuidFromPresence !== EMPTY_GUID && __classPrivateFieldGet(this, _Notification_joinTimeToken, "f") < timeTokenPresence) {
6040
+ if (!!__classPrivateFieldGet(this, _Notification_userPresenceTriggerHook, "f") && lodash.isFunction(__classPrivateFieldGet(this, _Notification_userPresenceTriggerHook, "f"))) {
6041
+ __classPrivateFieldGet(this, _Notification_userPresenceTriggerHook, "f").call(this);
6042
+ } else {
6043
+ const {
6044
+ url
6045
+ } = yield createLoginUrl({
6046
+ authHost,
6047
+ clientId,
6048
+ noPrompt: false,
6049
+ rememberMe: false,
6050
+ force_2fa: false,
6051
+ scopes: [],
6052
+ login_hint: userEmail,
6053
+ reauthenticate_mode: 0
6054
+ });
6055
+ AuthAgent.logout(true, url);
6056
+ }
5998
6057
 
5999
- var getSortCompare = function (comparefn) {
6000
- return function (x, y) {
6001
- if (comparefn !== undefined) return +comparefn(x, y) || 0;
6002
- // eslint-disable-next-line no-self-compare -- NaN check
6003
- if (y !== y) return -1;
6004
- // eslint-disable-next-line no-self-compare -- NaN check
6005
- if (x !== x) return 1;
6006
- if (x === 0 && y === 0) return 1 / x > 0 && 1 / y < 0 ? 1 : -1;
6007
- return x > y;
6008
- };
6009
- };
6058
+ return;
6059
+ }
6060
+
6061
+ if (listenToRestrictWebFlag && action === 'join' && userIdFromPresence === userId && instanceGuidFromPresence === EMPTY_GUID && __classPrivateFieldGet(this, _Notification_joinTimeToken, "f") < timeTokenPresence) {
6062
+ AuthAgent.logout(true);
6063
+ return;
6064
+ }
6010
6065
 
6011
- // `%TypedArray%.prototype.sort` method
6012
- // https://tc39.es/ecma262/#sec-%typedarray%.prototype.sort
6013
- exportTypedArrayMethod$1('sort', function sort(comparefn) {
6014
- if (comparefn !== undefined) aCallable(comparefn);
6015
- if (STABLE_SORT) return un$Sort(this, comparefn);
6066
+ if (action === 'leave' || action === 'timeout') {
6067
+ const userActionFromPresence = valuesUUID[2] || '';
6068
+ const isUserActionRequiredLogout = userActionFromPresence === USER_ACTION.USERNAME_CHANGED || userActionFromPresence === USER_ACTION.PASSWORD_CHANGED || userActionFromPresence === USER_ACTION.USER_DISABLED;
6016
6069
 
6017
- return internalSort(aTypedArray$1(this), getSortCompare(comparefn));
6018
- }, !STABLE_SORT || ACCEPT_INCORRECT_ARGUMENTS);
6070
+ if (userIdFromPresence === userId && instanceGuidFromPresence === EMPTY_GUID && isUserActionRequiredLogout) {
6071
+ AuthAgent.logout(true);
6072
+ }
6073
+ }
6074
+ })
6075
+ });
6019
6076
 
6020
- var global$2 = global$W;
6021
- var apply = functionApply;
6022
- var ArrayBufferViewCore = arrayBufferViewCore;
6023
- var fails = fails$r;
6024
- var arraySlice = arraySlice$4;
6077
+ __classPrivateFieldGet(this, _Notification_pubnub, "f").time((result, response) => {
6078
+ __classPrivateFieldSet(this, _Notification_joinTimeToken, response.timetoken, "f");
6025
6079
 
6026
- var Int8Array = global$2.Int8Array;
6027
- var aTypedArray = ArrayBufferViewCore.aTypedArray;
6028
- var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
6029
- var $toLocaleString = [].toLocaleString;
6080
+ __classPrivateFieldGet(this, _Notification_pubnub, "f").setState({
6081
+ state: {
6082
+ joinTimeToken: __classPrivateFieldGet(this, _Notification_joinTimeToken, "f")
6083
+ },
6084
+ channels: [firmId]
6085
+ });
6030
6086
 
6031
- // iOS Safari 6.x fails here
6032
- var TO_LOCALE_STRING_BUG = !!Int8Array && fails(function () {
6033
- $toLocaleString.call(new Int8Array(1));
6034
- });
6087
+ __classPrivateFieldGet(this, _Notification_pubnub, "f").subscribe({
6088
+ channels: [firmId],
6089
+ withPresence: true
6090
+ });
6091
+ });
6092
+ });
6035
6093
 
6036
- var FORCED = fails(function () {
6037
- return [1, 2].toLocaleString() != new Int8Array([1, 2]).toLocaleString();
6038
- }) || !fails(function () {
6039
- Int8Array.prototype.toLocaleString.call([1, 2]);
6040
- });
6094
+ _Notification_initUserChannel.set(this, userId => {
6095
+ __classPrivateFieldGet(this, _Notification_pubnub, "f").addListener({
6096
+ message: data => {
6097
+ const {
6098
+ content
6099
+ } = data.message;
6041
6100
 
6042
- // `%TypedArray%.prototype.toLocaleString` method
6043
- // https://tc39.es/ecma262/#sec-%typedarray%.prototype.tolocalestring
6044
- exportTypedArrayMethod('toLocaleString', function toLocaleString() {
6045
- return apply(
6046
- $toLocaleString,
6047
- TO_LOCALE_STRING_BUG ? arraySlice(aTypedArray(this)) : aTypedArray(this),
6048
- arraySlice(arguments)
6049
- );
6050
- }, FORCED);
6101
+ if (content && content.topic && content.messageType && content.data) {
6102
+ for (const eventListener of __classPrivateFieldGet(this, _Notification_eventListeners, "f")) {
6103
+ if (eventListener.topic === content.topic && eventListener.messageType === content.messageType && eventListener.callback && lodash.isFunction(eventListener.callback)) {
6104
+ return eventListener.callback(content.data);
6105
+ }
6106
+ }
6107
+ }
6108
+ }
6109
+ });
6051
6110
 
6052
- const deleteQueryParameter = (windowLocation, name, value) => {
6053
- const nameValue = name + '=' + value;
6054
- let toReplace = nameValue;
6111
+ __classPrivateFieldGet(this, _Notification_pubnub, "f").subscribe({
6112
+ channels: [`user_${userId}`],
6113
+ withPresence: false
6114
+ });
6115
+ });
6055
6116
 
6056
- if (windowLocation.indexOf('?' + nameValue) >= 0) {
6057
- if (windowLocation.indexOf('?' + nameValue + '&') >= 0) {
6058
- toReplace += '&';
6059
- } else {
6060
- toReplace = '?' + toReplace;
6061
- }
6062
- } else if (windowLocation.indexOf('&' + nameValue) >= 0) {
6063
- toReplace = '&' + toReplace;
6064
- }
6117
+ _Notification_initUniqueSessionChannel.set(this, params => __awaiter(this, void 0, void 0, function* () {
6118
+ const decodedToken = yield AuthAgent.getDecodedAccessToken();
6119
+ const {
6120
+ authHost: myAuthHost,
6121
+ clientId: myClientId,
6122
+ userEmail
6123
+ } = params;
6124
+ const {
6125
+ userId: myUserId,
6126
+ sessionId: mySessionId,
6127
+ impersonatorId: myImpersonatorId
6128
+ } = decodedToken;
6065
6129
 
6066
- return windowLocation.replace(toReplace, '');
6067
- };
6068
- const getQueryParameter = name => {
6069
- const paramsForSearch = parseParams(window.location.search.substring(1));
6130
+ if (!decodedToken) {
6131
+ return;
6132
+ }
6070
6133
 
6071
- if (paramsForSearch[name]) {
6072
- return paramsForSearch[name];
6073
- }
6134
+ const channel = `auth-session-${myUserId}`;
6074
6135
 
6075
- return undefined;
6076
- };
6077
- const createCodeChallenge = verifier => __awaiter(void 0, void 0, void 0, function* () {
6078
- if (getCryptoSubtle()) {
6079
- const code_challengeBuffer = yield sha256(verifier);
6080
- const code_challenge = bufferToBase64UrlEncoded(code_challengeBuffer);
6081
- return {
6082
- code_challenge,
6083
- code_challenge_method: 'S256'
6084
- };
6085
- } else {
6086
- return {
6087
- code_challenge: verifier,
6088
- code_challenge_method: undefined
6089
- };
6090
- }
6091
- });
6092
- const getCrypto = () => {
6093
- return window.crypto || window.msCrypto;
6094
- };
6095
- const createRandomString = size => {
6096
- const charset = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
6097
- let random = '';
6098
- const randomValues = Array.from(getCrypto().getRandomValues(new Uint8Array(size)));
6099
- randomValues.forEach(v => random += charset[v % charset.length]);
6100
- return random;
6101
- };
6136
+ __classPrivateFieldGet(this, _Notification_pubnub, "f").addListener({
6137
+ message: data => __awaiter(this, void 0, void 0, function* () {
6138
+ const decodedToken = yield AuthAgent.getDecodedAccessToken();
6102
6139
 
6103
- const sha256 = s => __awaiter(void 0, void 0, void 0, function* () {
6104
- const digestOp = getCryptoSubtle().digest({
6105
- name: 'SHA-256'
6106
- }, new TextEncoder().encode(s));
6140
+ if (!decodedToken) {
6141
+ AuthAgent.logout(true);
6142
+ }
6107
6143
 
6108
- if (window.msCrypto) {
6109
- return new Promise((res, rej) => {
6110
- digestOp.oncomplete = e => {
6111
- res(e.target.result);
6112
- };
6144
+ const {
6145
+ sessionId: mySessionId,
6146
+ impersonatorId: myImpersonatorId,
6147
+ userId: myUserId
6148
+ } = decodedToken;
6149
+ const myAgentId = localStorage.getItem('leap-auth-agent-id');
6113
6150
 
6114
- digestOp.onerror = e => {
6115
- rej(e.error);
6116
- };
6151
+ if (myAgentId && data && data.message) {
6152
+ const sessionId = data.message.sessionId,
6153
+ authHost = data.message.authHost,
6154
+ clientId = data.message.clientId,
6155
+ logout = data.message.logout;
6156
+ data.message.agentId;
6157
+ const impersonatorId = myImpersonatorId ? myImpersonatorId : data.message.impersonatorId;
6117
6158
 
6118
- digestOp.onabort = () => {
6119
- rej('The digest operation was aborted');
6120
- };
6121
- });
6122
- }
6159
+ if (authHost === myAuthHost) {
6160
+ if (clientId === myClientId && sessionId !== mySessionId || clientId !== myClientId && sessionId === mySessionId && logout) {
6161
+ if (impersonatorId !== undefined && impersonatorId !== '') {
6162
+ console.log('user ' + impersonatorId + ' impersonating user ' + myUserId);
6163
+ } else {
6164
+ if (!!__classPrivateFieldGet(this, _Notification_uniqueSessionTriggerHook, "f") && lodash.isFunction(__classPrivateFieldGet(this, _Notification_uniqueSessionTriggerHook, "f"))) {
6165
+ __classPrivateFieldGet(this, _Notification_uniqueSessionTriggerHook, "f").call(this);
6166
+ } else {
6167
+ const {
6168
+ url
6169
+ } = yield createLoginUrl({
6170
+ authHost,
6171
+ clientId,
6172
+ noPrompt: false,
6173
+ rememberMe: false,
6174
+ force_2fa: false,
6175
+ scopes: [],
6176
+ login_hint: userEmail,
6177
+ reauthenticate_mode: 1
6178
+ });
6179
+ AuthAgent.logout(true, url);
6180
+ }
6181
+ }
6182
+ }
6183
+ }
6184
+ }
6185
+ })
6186
+ });
6123
6187
 
6124
- return yield digestOp;
6125
- });
6188
+ __classPrivateFieldGet(this, _Notification_pubnub, "f").subscribe({
6189
+ channels: [channel],
6190
+ withPresence: true
6191
+ });
6126
6192
 
6127
- const getCryptoSubtle = () => {
6128
- const crypto = getCrypto();
6129
- return crypto.subtle || crypto.webkitSubtle;
6130
- };
6193
+ let agentId = localStorage.getItem('leap-auth-agent-id');
6131
6194
 
6132
- const bufferToBase64UrlEncoded = input => {
6133
- const ie11SafeInput = new Uint8Array(input);
6134
- return urlEncodeB64(window.btoa(String.fromCharCode(...Array.from(ie11SafeInput))));
6135
- };
6195
+ if (!agentId) {
6196
+ agentId = uuid.v4();
6197
+ localStorage.setItem('leap-auth-agent-id', agentId);
6198
+ }
6136
6199
 
6137
- const urlEncodeB64 = input => {
6138
- const b64Chars = {
6139
- '+': '-',
6140
- '/': '_',
6141
- '=': ''
6142
- };
6143
- return input.replace(/[+/=]/g, m => b64Chars[m]);
6144
- };
6200
+ __classPrivateFieldGet(this, _Notification_pubnub, "f").publish({
6201
+ message: {
6202
+ authHost: myAuthHost,
6203
+ clientId: myClientId,
6204
+ sessionId: mySessionId,
6205
+ agentId: agentId,
6206
+ impersonatorId: myImpersonatorId
6207
+ },
6208
+ channel: channel
6209
+ }, status => {
6210
+ if (status.error) {
6211
+ console.log('pubnub error');
6212
+ }
6213
+ });
6214
+ }));
6145
6215
 
6146
- const parseParams = url => {
6147
- const result = {};
6148
- const params = url.split('&');
6216
+ __classPrivateFieldSet(this, _Notification_pubnubKeys, {
6217
+ publishKey: 'pub-13f5288e-cd88-4ef9-9e68-0c11cd03ddb8',
6218
+ subscribeKey: 'sub-a456f002-0095-11e2-9638-9581afc33ebf',
6219
+ uuid: uuid.v4()
6220
+ }, "f");
6149
6221
 
6150
- for (let i = 0; i < params.length; i++) {
6151
- const param = params[i].split('=', 2);
6152
- if (param.length !== 2) continue;
6153
- result[param[0]] = decodeURIComponent(param[1].replace(/\+/g, " "));
6222
+ __classPrivateFieldSet(this, _Notification_pubnub, new Pubnub__default["default"](__classPrivateFieldGet(this, _Notification_pubnubKeys, "f")), "f");
6154
6223
  }
6155
6224
 
6156
- return result;
6157
- };
6225
+ }
6226
+ _Notification_pubnubKeys = new WeakMap(), _Notification_pubnub = new WeakMap(), _Notification_eventListeners = new WeakMap(), _Notification_uniqueSessionTriggerHook = new WeakMap(), _Notification_userPresenceTriggerHook = new WeakMap(), _Notification_currentUUIDString = new WeakMap(), _Notification_joinTimeToken = new WeakMap(), _Notification_initFirmChannel = new WeakMap(), _Notification_initUserChannel = new WeakMap(), _Notification_initUniqueSessionChannel = new WeakMap();
6158
6227
 
6159
6228
  var global$1 = global$W;
6160
6229
  var isRegExp = isRegexp;
@@ -6347,13 +6416,15 @@
6347
6416
 
6348
6417
  this.initNotification = () => __awaiter(this, void 0, void 0, function* () {
6349
6418
  const decodedToken = yield this.getDecodedRefreshedAccessToken();
6419
+ const userInfo = yield this.getUserInfo();
6350
6420
 
6351
- if (decodedToken) {
6421
+ if (decodedToken && userInfo) {
6352
6422
  yield __classPrivateFieldGet(this, _Authentication_notification, "f").init({
6353
6423
  authHost: __classPrivateFieldGet(this, _Authentication_config, "f").authHost,
6354
6424
  clientId: __classPrivateFieldGet(this, _Authentication_config, "f").clientId,
6355
6425
  firmId: decodedToken.firmId,
6356
6426
  userId: decodedToken.userId,
6427
+ userEmail: userInfo.email,
6357
6428
  uniqueSession: !!__classPrivateFieldGet(this, _Authentication_config, "f").uniqueSession,
6358
6429
  userPresence: !!__classPrivateFieldGet(this, _Authentication_config, "f").userPresence,
6359
6430
  listenToRestrictWebFlag: !!__classPrivateFieldGet(this, _Authentication_config, "f").listenToRestrictWebFlag,
@@ -6376,19 +6447,19 @@
6376
6447
  noPrompt,
6377
6448
  force_2fa
6378
6449
  } = params;
6379
- const code_verifier = createRandomString(64);
6380
- const state = createRandomString(6);
6381
- const nonce = createRandomString(6);
6382
- window.sessionStorage.setItem(state, code_verifier);
6383
6450
  const {
6384
- code_challenge,
6385
- code_challenge_method
6386
- } = yield createCodeChallenge(code_verifier);
6387
-
6388
- const scope = __classPrivateFieldGet(this, _Authentication_config, "f").scopes.join(',');
6389
-
6390
- const prompt = noPrompt ? 'none' : '';
6391
- const url = `${__classPrivateFieldGet(this, _Authentication_config, "f").authHost}/oauth/authorize?response_type=code&scope=${scope}&client_id=${__classPrivateFieldGet(this, _Authentication_config, "f").clientId}&redirect_uri=${encodeURIComponent(window.location.href)}&code_challenge=${encodeURIComponent(code_challenge)}&code_challenge_method=${code_challenge_method}&force_2fa=${force_2fa}&nonce=${nonce}&state=${state}&prompt=${prompt}&remember_me=${__classPrivateFieldGet(this, _Authentication_config, "f").rememberMe}`;
6451
+ url,
6452
+ state,
6453
+ code_verifier
6454
+ } = yield createLoginUrl({
6455
+ authHost: __classPrivateFieldGet(this, _Authentication_config, "f").authHost,
6456
+ clientId: __classPrivateFieldGet(this, _Authentication_config, "f").clientId,
6457
+ noPrompt,
6458
+ rememberMe: !!__classPrivateFieldGet(this, _Authentication_config, "f").rememberMe,
6459
+ scopes: __classPrivateFieldGet(this, _Authentication_config, "f").scopes,
6460
+ force_2fa
6461
+ });
6462
+ window.sessionStorage.setItem(state, code_verifier);
6392
6463
  window.location.assign(url);
6393
6464
  return;
6394
6465
  }