genesys-cloud-webrtc-sdk 11.3.1-STREAM-913-snyk.2 → 11.3.1-STREAM-913-snyk.5
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/dist/deploy-info.json +2 -2
- package/dist/es/index.bundle.js +233 -248
- package/dist/manifest.json +2 -2
- package/package.json +1 -1
package/dist/deploy-info.json
CHANGED
package/dist/es/index.bundle.js
CHANGED
|
@@ -2612,7 +2612,7 @@ var INSPECT_MAX_BYTES = 50;
|
|
|
2612
2612
|
* We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
|
|
2613
2613
|
* get the Object implementation, which is slower but behaves correctly.
|
|
2614
2614
|
*/
|
|
2615
|
-
Buffer.TYPED_ARRAY_SUPPORT = global$1.TYPED_ARRAY_SUPPORT !== undefined
|
|
2615
|
+
Buffer$1.TYPED_ARRAY_SUPPORT = global$1.TYPED_ARRAY_SUPPORT !== undefined
|
|
2616
2616
|
? global$1.TYPED_ARRAY_SUPPORT
|
|
2617
2617
|
: true;
|
|
2618
2618
|
|
|
@@ -2622,7 +2622,7 @@ Buffer.TYPED_ARRAY_SUPPORT = global$1.TYPED_ARRAY_SUPPORT !== undefined
|
|
|
2622
2622
|
kMaxLength();
|
|
2623
2623
|
|
|
2624
2624
|
function kMaxLength () {
|
|
2625
|
-
return Buffer.TYPED_ARRAY_SUPPORT
|
|
2625
|
+
return Buffer$1.TYPED_ARRAY_SUPPORT
|
|
2626
2626
|
? 0x7fffffff
|
|
2627
2627
|
: 0x3fffffff
|
|
2628
2628
|
}
|
|
@@ -2631,14 +2631,14 @@ function createBuffer (that, length) {
|
|
|
2631
2631
|
if (kMaxLength() < length) {
|
|
2632
2632
|
throw new RangeError('Invalid typed array length')
|
|
2633
2633
|
}
|
|
2634
|
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
2634
|
+
if (Buffer$1.TYPED_ARRAY_SUPPORT) {
|
|
2635
2635
|
// Return an augmented `Uint8Array` instance, for best performance
|
|
2636
2636
|
that = new Uint8Array(length);
|
|
2637
|
-
that.__proto__ = Buffer.prototype;
|
|
2637
|
+
that.__proto__ = Buffer$1.prototype;
|
|
2638
2638
|
} else {
|
|
2639
2639
|
// Fallback: Return an object instance of the Buffer class
|
|
2640
2640
|
if (that === null) {
|
|
2641
|
-
that = new Buffer(length);
|
|
2641
|
+
that = new Buffer$1(length);
|
|
2642
2642
|
}
|
|
2643
2643
|
that.length = length;
|
|
2644
2644
|
}
|
|
@@ -2656,9 +2656,9 @@ function createBuffer (that, length) {
|
|
|
2656
2656
|
* The `Uint8Array` prototype remains unmodified.
|
|
2657
2657
|
*/
|
|
2658
2658
|
|
|
2659
|
-
function Buffer (arg, encodingOrOffset, length) {
|
|
2660
|
-
if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
|
|
2661
|
-
return new Buffer(arg, encodingOrOffset, length)
|
|
2659
|
+
function Buffer$1 (arg, encodingOrOffset, length) {
|
|
2660
|
+
if (!Buffer$1.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer$1)) {
|
|
2661
|
+
return new Buffer$1(arg, encodingOrOffset, length)
|
|
2662
2662
|
}
|
|
2663
2663
|
|
|
2664
2664
|
// Common case.
|
|
@@ -2673,11 +2673,11 @@ function Buffer (arg, encodingOrOffset, length) {
|
|
|
2673
2673
|
return from(this, arg, encodingOrOffset, length)
|
|
2674
2674
|
}
|
|
2675
2675
|
|
|
2676
|
-
Buffer.poolSize = 8192; // not used by this implementation
|
|
2676
|
+
Buffer$1.poolSize = 8192; // not used by this implementation
|
|
2677
2677
|
|
|
2678
2678
|
// TODO: Legacy, not needed anymore. Remove in next major version.
|
|
2679
|
-
Buffer._augment = function (arr) {
|
|
2680
|
-
arr.__proto__ = Buffer.prototype;
|
|
2679
|
+
Buffer$1._augment = function (arr) {
|
|
2680
|
+
arr.__proto__ = Buffer$1.prototype;
|
|
2681
2681
|
return arr
|
|
2682
2682
|
};
|
|
2683
2683
|
|
|
@@ -2705,15 +2705,15 @@ function from (that, value, encodingOrOffset, length) {
|
|
|
2705
2705
|
* Buffer.from(buffer)
|
|
2706
2706
|
* Buffer.from(arrayBuffer[, byteOffset[, length]])
|
|
2707
2707
|
**/
|
|
2708
|
-
Buffer.from = function (value, encodingOrOffset, length) {
|
|
2708
|
+
Buffer$1.from = function (value, encodingOrOffset, length) {
|
|
2709
2709
|
return from(null, value, encodingOrOffset, length)
|
|
2710
2710
|
};
|
|
2711
2711
|
|
|
2712
|
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
2713
|
-
Buffer.prototype.__proto__ = Uint8Array.prototype;
|
|
2714
|
-
Buffer.__proto__ = Uint8Array;
|
|
2712
|
+
if (Buffer$1.TYPED_ARRAY_SUPPORT) {
|
|
2713
|
+
Buffer$1.prototype.__proto__ = Uint8Array.prototype;
|
|
2714
|
+
Buffer$1.__proto__ = Uint8Array;
|
|
2715
2715
|
if (typeof Symbol !== 'undefined' && Symbol.species &&
|
|
2716
|
-
Buffer[Symbol.species] === Buffer) ;
|
|
2716
|
+
Buffer$1[Symbol.species] === Buffer$1) ;
|
|
2717
2717
|
}
|
|
2718
2718
|
|
|
2719
2719
|
function assertSize (size) {
|
|
@@ -2744,14 +2744,14 @@ function alloc (that, size, fill, encoding) {
|
|
|
2744
2744
|
* Creates a new filled Buffer instance.
|
|
2745
2745
|
* alloc(size[, fill[, encoding]])
|
|
2746
2746
|
**/
|
|
2747
|
-
Buffer.alloc = function (size, fill, encoding) {
|
|
2747
|
+
Buffer$1.alloc = function (size, fill, encoding) {
|
|
2748
2748
|
return alloc(null, size, fill, encoding)
|
|
2749
2749
|
};
|
|
2750
2750
|
|
|
2751
2751
|
function allocUnsafe (that, size) {
|
|
2752
2752
|
assertSize(size);
|
|
2753
2753
|
that = createBuffer(that, size < 0 ? 0 : checked(size) | 0);
|
|
2754
|
-
if (!Buffer.TYPED_ARRAY_SUPPORT) {
|
|
2754
|
+
if (!Buffer$1.TYPED_ARRAY_SUPPORT) {
|
|
2755
2755
|
for (var i = 0; i < size; ++i) {
|
|
2756
2756
|
that[i] = 0;
|
|
2757
2757
|
}
|
|
@@ -2762,13 +2762,13 @@ function allocUnsafe (that, size) {
|
|
|
2762
2762
|
/**
|
|
2763
2763
|
* Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
|
|
2764
2764
|
* */
|
|
2765
|
-
Buffer.allocUnsafe = function (size) {
|
|
2765
|
+
Buffer$1.allocUnsafe = function (size) {
|
|
2766
2766
|
return allocUnsafe(null, size)
|
|
2767
2767
|
};
|
|
2768
2768
|
/**
|
|
2769
2769
|
* Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
|
|
2770
2770
|
*/
|
|
2771
|
-
Buffer.allocUnsafeSlow = function (size) {
|
|
2771
|
+
Buffer$1.allocUnsafeSlow = function (size) {
|
|
2772
2772
|
return allocUnsafe(null, size)
|
|
2773
2773
|
};
|
|
2774
2774
|
|
|
@@ -2777,7 +2777,7 @@ function fromString (that, string, encoding) {
|
|
|
2777
2777
|
encoding = 'utf8';
|
|
2778
2778
|
}
|
|
2779
2779
|
|
|
2780
|
-
if (!Buffer.isEncoding(encoding)) {
|
|
2780
|
+
if (!Buffer$1.isEncoding(encoding)) {
|
|
2781
2781
|
throw new TypeError('"encoding" must be a valid string encoding')
|
|
2782
2782
|
}
|
|
2783
2783
|
|
|
@@ -2824,10 +2824,10 @@ function fromArrayBuffer (that, array, byteOffset, length) {
|
|
|
2824
2824
|
array = new Uint8Array(array, byteOffset, length);
|
|
2825
2825
|
}
|
|
2826
2826
|
|
|
2827
|
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
2827
|
+
if (Buffer$1.TYPED_ARRAY_SUPPORT) {
|
|
2828
2828
|
// Return an augmented `Uint8Array` instance, for best performance
|
|
2829
2829
|
that = array;
|
|
2830
|
-
that.__proto__ = Buffer.prototype;
|
|
2830
|
+
that.__proto__ = Buffer$1.prototype;
|
|
2831
2831
|
} else {
|
|
2832
2832
|
// Fallback: Return an object instance of the Buffer class
|
|
2833
2833
|
that = fromArrayLike$1(that, array);
|
|
@@ -2874,12 +2874,12 @@ function checked (length) {
|
|
|
2874
2874
|
}
|
|
2875
2875
|
return length | 0
|
|
2876
2876
|
}
|
|
2877
|
-
Buffer.isBuffer = isBuffer;
|
|
2877
|
+
Buffer$1.isBuffer = isBuffer;
|
|
2878
2878
|
function internalIsBuffer (b) {
|
|
2879
2879
|
return !!(b != null && b._isBuffer)
|
|
2880
2880
|
}
|
|
2881
2881
|
|
|
2882
|
-
Buffer.compare = function compare (a, b) {
|
|
2882
|
+
Buffer$1.compare = function compare (a, b) {
|
|
2883
2883
|
if (!internalIsBuffer(a) || !internalIsBuffer(b)) {
|
|
2884
2884
|
throw new TypeError('Arguments must be Buffers')
|
|
2885
2885
|
}
|
|
@@ -2902,7 +2902,7 @@ Buffer.compare = function compare (a, b) {
|
|
|
2902
2902
|
return 0
|
|
2903
2903
|
};
|
|
2904
2904
|
|
|
2905
|
-
Buffer.isEncoding = function isEncoding (encoding) {
|
|
2905
|
+
Buffer$1.isEncoding = function isEncoding (encoding) {
|
|
2906
2906
|
switch (String(encoding).toLowerCase()) {
|
|
2907
2907
|
case 'hex':
|
|
2908
2908
|
case 'utf8':
|
|
@@ -2921,13 +2921,13 @@ Buffer.isEncoding = function isEncoding (encoding) {
|
|
|
2921
2921
|
}
|
|
2922
2922
|
};
|
|
2923
2923
|
|
|
2924
|
-
Buffer.concat = function concat (list, length) {
|
|
2924
|
+
Buffer$1.concat = function concat (list, length) {
|
|
2925
2925
|
if (!isArray$1(list)) {
|
|
2926
2926
|
throw new TypeError('"list" argument must be an Array of Buffers')
|
|
2927
2927
|
}
|
|
2928
2928
|
|
|
2929
2929
|
if (list.length === 0) {
|
|
2930
|
-
return Buffer.alloc(0)
|
|
2930
|
+
return Buffer$1.alloc(0)
|
|
2931
2931
|
}
|
|
2932
2932
|
|
|
2933
2933
|
var i;
|
|
@@ -2938,7 +2938,7 @@ Buffer.concat = function concat (list, length) {
|
|
|
2938
2938
|
}
|
|
2939
2939
|
}
|
|
2940
2940
|
|
|
2941
|
-
var buffer = Buffer.allocUnsafe(length);
|
|
2941
|
+
var buffer = Buffer$1.allocUnsafe(length);
|
|
2942
2942
|
var pos = 0;
|
|
2943
2943
|
for (i = 0; i < list.length; ++i) {
|
|
2944
2944
|
var buf = list[i];
|
|
@@ -2994,7 +2994,7 @@ function byteLength$1 (string, encoding) {
|
|
|
2994
2994
|
}
|
|
2995
2995
|
}
|
|
2996
2996
|
}
|
|
2997
|
-
Buffer.byteLength = byteLength$1;
|
|
2997
|
+
Buffer$1.byteLength = byteLength$1;
|
|
2998
2998
|
|
|
2999
2999
|
function slowToString (encoding, start, end) {
|
|
3000
3000
|
var loweredCase = false;
|
|
@@ -3068,7 +3068,7 @@ function slowToString (encoding, start, end) {
|
|
|
3068
3068
|
|
|
3069
3069
|
// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
|
|
3070
3070
|
// Buffer instances.
|
|
3071
|
-
Buffer.prototype._isBuffer = true;
|
|
3071
|
+
Buffer$1.prototype._isBuffer = true;
|
|
3072
3072
|
|
|
3073
3073
|
function swap (b, n, m) {
|
|
3074
3074
|
var i = b[n];
|
|
@@ -3076,7 +3076,7 @@ function swap (b, n, m) {
|
|
|
3076
3076
|
b[m] = i;
|
|
3077
3077
|
}
|
|
3078
3078
|
|
|
3079
|
-
Buffer.prototype.swap16 = function swap16 () {
|
|
3079
|
+
Buffer$1.prototype.swap16 = function swap16 () {
|
|
3080
3080
|
var len = this.length;
|
|
3081
3081
|
if (len % 2 !== 0) {
|
|
3082
3082
|
throw new RangeError('Buffer size must be a multiple of 16-bits')
|
|
@@ -3087,7 +3087,7 @@ Buffer.prototype.swap16 = function swap16 () {
|
|
|
3087
3087
|
return this
|
|
3088
3088
|
};
|
|
3089
3089
|
|
|
3090
|
-
Buffer.prototype.swap32 = function swap32 () {
|
|
3090
|
+
Buffer$1.prototype.swap32 = function swap32 () {
|
|
3091
3091
|
var len = this.length;
|
|
3092
3092
|
if (len % 4 !== 0) {
|
|
3093
3093
|
throw new RangeError('Buffer size must be a multiple of 32-bits')
|
|
@@ -3099,7 +3099,7 @@ Buffer.prototype.swap32 = function swap32 () {
|
|
|
3099
3099
|
return this
|
|
3100
3100
|
};
|
|
3101
3101
|
|
|
3102
|
-
Buffer.prototype.swap64 = function swap64 () {
|
|
3102
|
+
Buffer$1.prototype.swap64 = function swap64 () {
|
|
3103
3103
|
var len = this.length;
|
|
3104
3104
|
if (len % 8 !== 0) {
|
|
3105
3105
|
throw new RangeError('Buffer size must be a multiple of 64-bits')
|
|
@@ -3113,20 +3113,20 @@ Buffer.prototype.swap64 = function swap64 () {
|
|
|
3113
3113
|
return this
|
|
3114
3114
|
};
|
|
3115
3115
|
|
|
3116
|
-
Buffer.prototype.toString = function toString () {
|
|
3116
|
+
Buffer$1.prototype.toString = function toString () {
|
|
3117
3117
|
var length = this.length | 0;
|
|
3118
3118
|
if (length === 0) return ''
|
|
3119
3119
|
if (arguments.length === 0) return utf8Slice(this, 0, length)
|
|
3120
3120
|
return slowToString.apply(this, arguments)
|
|
3121
3121
|
};
|
|
3122
3122
|
|
|
3123
|
-
Buffer.prototype.equals = function equals (b) {
|
|
3123
|
+
Buffer$1.prototype.equals = function equals (b) {
|
|
3124
3124
|
if (!internalIsBuffer(b)) throw new TypeError('Argument must be a Buffer')
|
|
3125
3125
|
if (this === b) return true
|
|
3126
|
-
return Buffer.compare(this, b) === 0
|
|
3126
|
+
return Buffer$1.compare(this, b) === 0
|
|
3127
3127
|
};
|
|
3128
3128
|
|
|
3129
|
-
Buffer.prototype.inspect = function inspect () {
|
|
3129
|
+
Buffer$1.prototype.inspect = function inspect () {
|
|
3130
3130
|
var str = '';
|
|
3131
3131
|
var max = INSPECT_MAX_BYTES;
|
|
3132
3132
|
if (this.length > 0) {
|
|
@@ -3136,7 +3136,7 @@ Buffer.prototype.inspect = function inspect () {
|
|
|
3136
3136
|
return '<Buffer ' + str + '>'
|
|
3137
3137
|
};
|
|
3138
3138
|
|
|
3139
|
-
Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
|
|
3139
|
+
Buffer$1.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
|
|
3140
3140
|
if (!internalIsBuffer(target)) {
|
|
3141
3141
|
throw new TypeError('Argument must be a Buffer')
|
|
3142
3142
|
}
|
|
@@ -3235,7 +3235,7 @@ function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
|
|
|
3235
3235
|
|
|
3236
3236
|
// Normalize val
|
|
3237
3237
|
if (typeof val === 'string') {
|
|
3238
|
-
val = Buffer.from(val, encoding);
|
|
3238
|
+
val = Buffer$1.from(val, encoding);
|
|
3239
3239
|
}
|
|
3240
3240
|
|
|
3241
3241
|
// Finally, search either indexOf (if dir is true) or lastIndexOf
|
|
@@ -3247,7 +3247,7 @@ function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
|
|
|
3247
3247
|
return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
|
|
3248
3248
|
} else if (typeof val === 'number') {
|
|
3249
3249
|
val = val & 0xFF; // Search for a byte value [0-255]
|
|
3250
|
-
if (Buffer.TYPED_ARRAY_SUPPORT &&
|
|
3250
|
+
if (Buffer$1.TYPED_ARRAY_SUPPORT &&
|
|
3251
3251
|
typeof Uint8Array.prototype.indexOf === 'function') {
|
|
3252
3252
|
if (dir) {
|
|
3253
3253
|
return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
|
|
@@ -3317,15 +3317,15 @@ function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
|
|
|
3317
3317
|
return -1
|
|
3318
3318
|
}
|
|
3319
3319
|
|
|
3320
|
-
Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
|
|
3320
|
+
Buffer$1.prototype.includes = function includes (val, byteOffset, encoding) {
|
|
3321
3321
|
return this.indexOf(val, byteOffset, encoding) !== -1
|
|
3322
3322
|
};
|
|
3323
3323
|
|
|
3324
|
-
Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
|
|
3324
|
+
Buffer$1.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
|
|
3325
3325
|
return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
|
|
3326
3326
|
};
|
|
3327
3327
|
|
|
3328
|
-
Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
|
|
3328
|
+
Buffer$1.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
|
|
3329
3329
|
return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
|
|
3330
3330
|
};
|
|
3331
3331
|
|
|
@@ -3376,7 +3376,7 @@ function ucs2Write (buf, string, offset, length) {
|
|
|
3376
3376
|
return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
|
|
3377
3377
|
}
|
|
3378
3378
|
|
|
3379
|
-
Buffer.prototype.write = function write (string, offset, length, encoding) {
|
|
3379
|
+
Buffer$1.prototype.write = function write (string, offset, length, encoding) {
|
|
3380
3380
|
// Buffer#write(string)
|
|
3381
3381
|
if (offset === undefined) {
|
|
3382
3382
|
encoding = 'utf8';
|
|
@@ -3448,7 +3448,7 @@ Buffer.prototype.write = function write (string, offset, length, encoding) {
|
|
|
3448
3448
|
}
|
|
3449
3449
|
};
|
|
3450
3450
|
|
|
3451
|
-
Buffer.prototype.toJSON = function toJSON () {
|
|
3451
|
+
Buffer$1.prototype.toJSON = function toJSON () {
|
|
3452
3452
|
return {
|
|
3453
3453
|
type: 'Buffer',
|
|
3454
3454
|
data: Array.prototype.slice.call(this._arr || this, 0)
|
|
@@ -3601,7 +3601,7 @@ function utf16leSlice (buf, start, end) {
|
|
|
3601
3601
|
return res
|
|
3602
3602
|
}
|
|
3603
3603
|
|
|
3604
|
-
Buffer.prototype.slice = function slice (start, end) {
|
|
3604
|
+
Buffer$1.prototype.slice = function slice (start, end) {
|
|
3605
3605
|
var len = this.length;
|
|
3606
3606
|
start = ~~start;
|
|
3607
3607
|
end = end === undefined ? len : ~~end;
|
|
@@ -3623,12 +3623,12 @@ Buffer.prototype.slice = function slice (start, end) {
|
|
|
3623
3623
|
if (end < start) end = start;
|
|
3624
3624
|
|
|
3625
3625
|
var newBuf;
|
|
3626
|
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
3626
|
+
if (Buffer$1.TYPED_ARRAY_SUPPORT) {
|
|
3627
3627
|
newBuf = this.subarray(start, end);
|
|
3628
|
-
newBuf.__proto__ = Buffer.prototype;
|
|
3628
|
+
newBuf.__proto__ = Buffer$1.prototype;
|
|
3629
3629
|
} else {
|
|
3630
3630
|
var sliceLen = end - start;
|
|
3631
|
-
newBuf = new Buffer(sliceLen, undefined);
|
|
3631
|
+
newBuf = new Buffer$1(sliceLen, undefined);
|
|
3632
3632
|
for (var i = 0; i < sliceLen; ++i) {
|
|
3633
3633
|
newBuf[i] = this[i + start];
|
|
3634
3634
|
}
|
|
@@ -3645,7 +3645,7 @@ function checkOffset (offset, ext, length) {
|
|
|
3645
3645
|
if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
|
|
3646
3646
|
}
|
|
3647
3647
|
|
|
3648
|
-
Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
|
|
3648
|
+
Buffer$1.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
|
|
3649
3649
|
offset = offset | 0;
|
|
3650
3650
|
byteLength = byteLength | 0;
|
|
3651
3651
|
if (!noAssert) checkOffset(offset, byteLength, this.length);
|
|
@@ -3660,7 +3660,7 @@ Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert)
|
|
|
3660
3660
|
return val
|
|
3661
3661
|
};
|
|
3662
3662
|
|
|
3663
|
-
Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
|
|
3663
|
+
Buffer$1.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
|
|
3664
3664
|
offset = offset | 0;
|
|
3665
3665
|
byteLength = byteLength | 0;
|
|
3666
3666
|
if (!noAssert) {
|
|
@@ -3676,22 +3676,22 @@ Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert)
|
|
|
3676
3676
|
return val
|
|
3677
3677
|
};
|
|
3678
3678
|
|
|
3679
|
-
Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
|
|
3679
|
+
Buffer$1.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
|
|
3680
3680
|
if (!noAssert) checkOffset(offset, 1, this.length);
|
|
3681
3681
|
return this[offset]
|
|
3682
3682
|
};
|
|
3683
3683
|
|
|
3684
|
-
Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
|
|
3684
|
+
Buffer$1.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
|
|
3685
3685
|
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
3686
3686
|
return this[offset] | (this[offset + 1] << 8)
|
|
3687
3687
|
};
|
|
3688
3688
|
|
|
3689
|
-
Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
|
|
3689
|
+
Buffer$1.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
|
|
3690
3690
|
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
3691
3691
|
return (this[offset] << 8) | this[offset + 1]
|
|
3692
3692
|
};
|
|
3693
3693
|
|
|
3694
|
-
Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
|
|
3694
|
+
Buffer$1.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
|
|
3695
3695
|
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
3696
3696
|
|
|
3697
3697
|
return ((this[offset]) |
|
|
@@ -3700,7 +3700,7 @@ Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
|
|
|
3700
3700
|
(this[offset + 3] * 0x1000000)
|
|
3701
3701
|
};
|
|
3702
3702
|
|
|
3703
|
-
Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
|
|
3703
|
+
Buffer$1.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
|
|
3704
3704
|
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
3705
3705
|
|
|
3706
3706
|
return (this[offset] * 0x1000000) +
|
|
@@ -3709,7 +3709,7 @@ Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
|
|
|
3709
3709
|
this[offset + 3])
|
|
3710
3710
|
};
|
|
3711
3711
|
|
|
3712
|
-
Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
|
|
3712
|
+
Buffer$1.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
|
|
3713
3713
|
offset = offset | 0;
|
|
3714
3714
|
byteLength = byteLength | 0;
|
|
3715
3715
|
if (!noAssert) checkOffset(offset, byteLength, this.length);
|
|
@@ -3727,7 +3727,7 @@ Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
|
|
|
3727
3727
|
return val
|
|
3728
3728
|
};
|
|
3729
3729
|
|
|
3730
|
-
Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
|
|
3730
|
+
Buffer$1.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
|
|
3731
3731
|
offset = offset | 0;
|
|
3732
3732
|
byteLength = byteLength | 0;
|
|
3733
3733
|
if (!noAssert) checkOffset(offset, byteLength, this.length);
|
|
@@ -3745,25 +3745,25 @@ Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
|
|
|
3745
3745
|
return val
|
|
3746
3746
|
};
|
|
3747
3747
|
|
|
3748
|
-
Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
|
|
3748
|
+
Buffer$1.prototype.readInt8 = function readInt8 (offset, noAssert) {
|
|
3749
3749
|
if (!noAssert) checkOffset(offset, 1, this.length);
|
|
3750
3750
|
if (!(this[offset] & 0x80)) return (this[offset])
|
|
3751
3751
|
return ((0xff - this[offset] + 1) * -1)
|
|
3752
3752
|
};
|
|
3753
3753
|
|
|
3754
|
-
Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
|
|
3754
|
+
Buffer$1.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
|
|
3755
3755
|
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
3756
3756
|
var val = this[offset] | (this[offset + 1] << 8);
|
|
3757
3757
|
return (val & 0x8000) ? val | 0xFFFF0000 : val
|
|
3758
3758
|
};
|
|
3759
3759
|
|
|
3760
|
-
Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
|
|
3760
|
+
Buffer$1.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
|
|
3761
3761
|
if (!noAssert) checkOffset(offset, 2, this.length);
|
|
3762
3762
|
var val = this[offset + 1] | (this[offset] << 8);
|
|
3763
3763
|
return (val & 0x8000) ? val | 0xFFFF0000 : val
|
|
3764
3764
|
};
|
|
3765
3765
|
|
|
3766
|
-
Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
|
|
3766
|
+
Buffer$1.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
|
|
3767
3767
|
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
3768
3768
|
|
|
3769
3769
|
return (this[offset]) |
|
|
@@ -3772,7 +3772,7 @@ Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
|
|
|
3772
3772
|
(this[offset + 3] << 24)
|
|
3773
3773
|
};
|
|
3774
3774
|
|
|
3775
|
-
Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
|
|
3775
|
+
Buffer$1.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
|
|
3776
3776
|
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
3777
3777
|
|
|
3778
3778
|
return (this[offset] << 24) |
|
|
@@ -3781,22 +3781,22 @@ Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
|
|
|
3781
3781
|
(this[offset + 3])
|
|
3782
3782
|
};
|
|
3783
3783
|
|
|
3784
|
-
Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
|
|
3784
|
+
Buffer$1.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
|
|
3785
3785
|
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
3786
3786
|
return read(this, offset, true, 23, 4)
|
|
3787
3787
|
};
|
|
3788
3788
|
|
|
3789
|
-
Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
|
|
3789
|
+
Buffer$1.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
|
|
3790
3790
|
if (!noAssert) checkOffset(offset, 4, this.length);
|
|
3791
3791
|
return read(this, offset, false, 23, 4)
|
|
3792
3792
|
};
|
|
3793
3793
|
|
|
3794
|
-
Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
|
|
3794
|
+
Buffer$1.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
|
|
3795
3795
|
if (!noAssert) checkOffset(offset, 8, this.length);
|
|
3796
3796
|
return read(this, offset, true, 52, 8)
|
|
3797
3797
|
};
|
|
3798
3798
|
|
|
3799
|
-
Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
|
|
3799
|
+
Buffer$1.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
|
|
3800
3800
|
if (!noAssert) checkOffset(offset, 8, this.length);
|
|
3801
3801
|
return read(this, offset, false, 52, 8)
|
|
3802
3802
|
};
|
|
@@ -3807,7 +3807,7 @@ function checkInt (buf, value, offset, ext, max, min) {
|
|
|
3807
3807
|
if (offset + ext > buf.length) throw new RangeError('Index out of range')
|
|
3808
3808
|
}
|
|
3809
3809
|
|
|
3810
|
-
Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
|
|
3810
|
+
Buffer$1.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
|
|
3811
3811
|
value = +value;
|
|
3812
3812
|
offset = offset | 0;
|
|
3813
3813
|
byteLength = byteLength | 0;
|
|
@@ -3826,7 +3826,7 @@ Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength,
|
|
|
3826
3826
|
return offset + byteLength
|
|
3827
3827
|
};
|
|
3828
3828
|
|
|
3829
|
-
Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
|
|
3829
|
+
Buffer$1.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
|
|
3830
3830
|
value = +value;
|
|
3831
3831
|
offset = offset | 0;
|
|
3832
3832
|
byteLength = byteLength | 0;
|
|
@@ -3845,11 +3845,11 @@ Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength,
|
|
|
3845
3845
|
return offset + byteLength
|
|
3846
3846
|
};
|
|
3847
3847
|
|
|
3848
|
-
Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
|
|
3848
|
+
Buffer$1.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
|
|
3849
3849
|
value = +value;
|
|
3850
3850
|
offset = offset | 0;
|
|
3851
3851
|
if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0);
|
|
3852
|
-
if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
|
|
3852
|
+
if (!Buffer$1.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
|
|
3853
3853
|
this[offset] = (value & 0xff);
|
|
3854
3854
|
return offset + 1
|
|
3855
3855
|
};
|
|
@@ -3862,11 +3862,11 @@ function objectWriteUInt16 (buf, value, offset, littleEndian) {
|
|
|
3862
3862
|
}
|
|
3863
3863
|
}
|
|
3864
3864
|
|
|
3865
|
-
Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
|
|
3865
|
+
Buffer$1.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
|
|
3866
3866
|
value = +value;
|
|
3867
3867
|
offset = offset | 0;
|
|
3868
3868
|
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
|
|
3869
|
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
3869
|
+
if (Buffer$1.TYPED_ARRAY_SUPPORT) {
|
|
3870
3870
|
this[offset] = (value & 0xff);
|
|
3871
3871
|
this[offset + 1] = (value >>> 8);
|
|
3872
3872
|
} else {
|
|
@@ -3875,11 +3875,11 @@ Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert
|
|
|
3875
3875
|
return offset + 2
|
|
3876
3876
|
};
|
|
3877
3877
|
|
|
3878
|
-
Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
|
|
3878
|
+
Buffer$1.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
|
|
3879
3879
|
value = +value;
|
|
3880
3880
|
offset = offset | 0;
|
|
3881
3881
|
if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
|
|
3882
|
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
3882
|
+
if (Buffer$1.TYPED_ARRAY_SUPPORT) {
|
|
3883
3883
|
this[offset] = (value >>> 8);
|
|
3884
3884
|
this[offset + 1] = (value & 0xff);
|
|
3885
3885
|
} else {
|
|
@@ -3895,11 +3895,11 @@ function objectWriteUInt32 (buf, value, offset, littleEndian) {
|
|
|
3895
3895
|
}
|
|
3896
3896
|
}
|
|
3897
3897
|
|
|
3898
|
-
Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
|
|
3898
|
+
Buffer$1.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
|
|
3899
3899
|
value = +value;
|
|
3900
3900
|
offset = offset | 0;
|
|
3901
3901
|
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
|
|
3902
|
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
3902
|
+
if (Buffer$1.TYPED_ARRAY_SUPPORT) {
|
|
3903
3903
|
this[offset + 3] = (value >>> 24);
|
|
3904
3904
|
this[offset + 2] = (value >>> 16);
|
|
3905
3905
|
this[offset + 1] = (value >>> 8);
|
|
@@ -3910,11 +3910,11 @@ Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert
|
|
|
3910
3910
|
return offset + 4
|
|
3911
3911
|
};
|
|
3912
3912
|
|
|
3913
|
-
Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
|
|
3913
|
+
Buffer$1.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
|
|
3914
3914
|
value = +value;
|
|
3915
3915
|
offset = offset | 0;
|
|
3916
3916
|
if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
|
|
3917
|
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
3917
|
+
if (Buffer$1.TYPED_ARRAY_SUPPORT) {
|
|
3918
3918
|
this[offset] = (value >>> 24);
|
|
3919
3919
|
this[offset + 1] = (value >>> 16);
|
|
3920
3920
|
this[offset + 2] = (value >>> 8);
|
|
@@ -3925,7 +3925,7 @@ Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert
|
|
|
3925
3925
|
return offset + 4
|
|
3926
3926
|
};
|
|
3927
3927
|
|
|
3928
|
-
Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
|
|
3928
|
+
Buffer$1.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
|
|
3929
3929
|
value = +value;
|
|
3930
3930
|
offset = offset | 0;
|
|
3931
3931
|
if (!noAssert) {
|
|
@@ -3948,7 +3948,7 @@ Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, no
|
|
|
3948
3948
|
return offset + byteLength
|
|
3949
3949
|
};
|
|
3950
3950
|
|
|
3951
|
-
Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
|
|
3951
|
+
Buffer$1.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
|
|
3952
3952
|
value = +value;
|
|
3953
3953
|
offset = offset | 0;
|
|
3954
3954
|
if (!noAssert) {
|
|
@@ -3971,21 +3971,21 @@ Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, no
|
|
|
3971
3971
|
return offset + byteLength
|
|
3972
3972
|
};
|
|
3973
3973
|
|
|
3974
|
-
Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
|
|
3974
|
+
Buffer$1.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
|
|
3975
3975
|
value = +value;
|
|
3976
3976
|
offset = offset | 0;
|
|
3977
3977
|
if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -128);
|
|
3978
|
-
if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
|
|
3978
|
+
if (!Buffer$1.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
|
|
3979
3979
|
if (value < 0) value = 0xff + value + 1;
|
|
3980
3980
|
this[offset] = (value & 0xff);
|
|
3981
3981
|
return offset + 1
|
|
3982
3982
|
};
|
|
3983
3983
|
|
|
3984
|
-
Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
|
|
3984
|
+
Buffer$1.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
|
|
3985
3985
|
value = +value;
|
|
3986
3986
|
offset = offset | 0;
|
|
3987
3987
|
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -32768);
|
|
3988
|
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
3988
|
+
if (Buffer$1.TYPED_ARRAY_SUPPORT) {
|
|
3989
3989
|
this[offset] = (value & 0xff);
|
|
3990
3990
|
this[offset + 1] = (value >>> 8);
|
|
3991
3991
|
} else {
|
|
@@ -3994,11 +3994,11 @@ Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert)
|
|
|
3994
3994
|
return offset + 2
|
|
3995
3995
|
};
|
|
3996
3996
|
|
|
3997
|
-
Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
|
|
3997
|
+
Buffer$1.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
|
|
3998
3998
|
value = +value;
|
|
3999
3999
|
offset = offset | 0;
|
|
4000
4000
|
if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -32768);
|
|
4001
|
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
4001
|
+
if (Buffer$1.TYPED_ARRAY_SUPPORT) {
|
|
4002
4002
|
this[offset] = (value >>> 8);
|
|
4003
4003
|
this[offset + 1] = (value & 0xff);
|
|
4004
4004
|
} else {
|
|
@@ -4007,11 +4007,11 @@ Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert)
|
|
|
4007
4007
|
return offset + 2
|
|
4008
4008
|
};
|
|
4009
4009
|
|
|
4010
|
-
Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
|
|
4010
|
+
Buffer$1.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
|
|
4011
4011
|
value = +value;
|
|
4012
4012
|
offset = offset | 0;
|
|
4013
4013
|
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -2147483648);
|
|
4014
|
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
4014
|
+
if (Buffer$1.TYPED_ARRAY_SUPPORT) {
|
|
4015
4015
|
this[offset] = (value & 0xff);
|
|
4016
4016
|
this[offset + 1] = (value >>> 8);
|
|
4017
4017
|
this[offset + 2] = (value >>> 16);
|
|
@@ -4022,12 +4022,12 @@ Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert)
|
|
|
4022
4022
|
return offset + 4
|
|
4023
4023
|
};
|
|
4024
4024
|
|
|
4025
|
-
Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
|
|
4025
|
+
Buffer$1.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
|
|
4026
4026
|
value = +value;
|
|
4027
4027
|
offset = offset | 0;
|
|
4028
4028
|
if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -2147483648);
|
|
4029
4029
|
if (value < 0) value = 0xffffffff + value + 1;
|
|
4030
|
-
if (Buffer.TYPED_ARRAY_SUPPORT) {
|
|
4030
|
+
if (Buffer$1.TYPED_ARRAY_SUPPORT) {
|
|
4031
4031
|
this[offset] = (value >>> 24);
|
|
4032
4032
|
this[offset + 1] = (value >>> 16);
|
|
4033
4033
|
this[offset + 2] = (value >>> 8);
|
|
@@ -4051,11 +4051,11 @@ function writeFloat (buf, value, offset, littleEndian, noAssert) {
|
|
|
4051
4051
|
return offset + 4
|
|
4052
4052
|
}
|
|
4053
4053
|
|
|
4054
|
-
Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
|
|
4054
|
+
Buffer$1.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
|
|
4055
4055
|
return writeFloat(this, value, offset, true, noAssert)
|
|
4056
4056
|
};
|
|
4057
4057
|
|
|
4058
|
-
Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
|
|
4058
|
+
Buffer$1.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
|
|
4059
4059
|
return writeFloat(this, value, offset, false, noAssert)
|
|
4060
4060
|
};
|
|
4061
4061
|
|
|
@@ -4067,16 +4067,16 @@ function writeDouble (buf, value, offset, littleEndian, noAssert) {
|
|
|
4067
4067
|
return offset + 8
|
|
4068
4068
|
}
|
|
4069
4069
|
|
|
4070
|
-
Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
|
|
4070
|
+
Buffer$1.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
|
|
4071
4071
|
return writeDouble(this, value, offset, true, noAssert)
|
|
4072
4072
|
};
|
|
4073
4073
|
|
|
4074
|
-
Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
|
|
4074
|
+
Buffer$1.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
|
|
4075
4075
|
return writeDouble(this, value, offset, false, noAssert)
|
|
4076
4076
|
};
|
|
4077
4077
|
|
|
4078
4078
|
// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
|
|
4079
|
-
Buffer.prototype.copy = function copy (target, targetStart, start, end) {
|
|
4079
|
+
Buffer$1.prototype.copy = function copy (target, targetStart, start, end) {
|
|
4080
4080
|
if (!start) start = 0;
|
|
4081
4081
|
if (!end && end !== 0) end = this.length;
|
|
4082
4082
|
if (targetStart >= target.length) targetStart = target.length;
|
|
@@ -4108,7 +4108,7 @@ Buffer.prototype.copy = function copy (target, targetStart, start, end) {
|
|
|
4108
4108
|
for (i = len - 1; i >= 0; --i) {
|
|
4109
4109
|
target[i + targetStart] = this[i + start];
|
|
4110
4110
|
}
|
|
4111
|
-
} else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
|
|
4111
|
+
} else if (len < 1000 || !Buffer$1.TYPED_ARRAY_SUPPORT) {
|
|
4112
4112
|
// ascending copy from start
|
|
4113
4113
|
for (i = 0; i < len; ++i) {
|
|
4114
4114
|
target[i + targetStart] = this[i + start];
|
|
@@ -4128,7 +4128,7 @@ Buffer.prototype.copy = function copy (target, targetStart, start, end) {
|
|
|
4128
4128
|
// buffer.fill(number[, offset[, end]])
|
|
4129
4129
|
// buffer.fill(buffer[, offset[, end]])
|
|
4130
4130
|
// buffer.fill(string[, offset[, end]][, encoding])
|
|
4131
|
-
Buffer.prototype.fill = function fill (val, start, end, encoding) {
|
|
4131
|
+
Buffer$1.prototype.fill = function fill (val, start, end, encoding) {
|
|
4132
4132
|
// Handle string cases:
|
|
4133
4133
|
if (typeof val === 'string') {
|
|
4134
4134
|
if (typeof start === 'string') {
|
|
@@ -4148,7 +4148,7 @@ Buffer.prototype.fill = function fill (val, start, end, encoding) {
|
|
|
4148
4148
|
if (encoding !== undefined && typeof encoding !== 'string') {
|
|
4149
4149
|
throw new TypeError('encoding must be a string')
|
|
4150
4150
|
}
|
|
4151
|
-
if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
|
|
4151
|
+
if (typeof encoding === 'string' && !Buffer$1.isEncoding(encoding)) {
|
|
4152
4152
|
throw new TypeError('Unknown encoding: ' + encoding)
|
|
4153
4153
|
}
|
|
4154
4154
|
} else if (typeof val === 'number') {
|
|
@@ -4177,7 +4177,7 @@ Buffer.prototype.fill = function fill (val, start, end, encoding) {
|
|
|
4177
4177
|
} else {
|
|
4178
4178
|
var bytes = internalIsBuffer(val)
|
|
4179
4179
|
? val
|
|
4180
|
-
: utf8ToBytes(new Buffer(val, encoding).toString());
|
|
4180
|
+
: utf8ToBytes(new Buffer$1(val, encoding).toString());
|
|
4181
4181
|
var len = bytes.length;
|
|
4182
4182
|
for (i = 0; i < end - start; ++i) {
|
|
4183
4183
|
this[i + start] = bytes[i % len];
|
|
@@ -4578,7 +4578,7 @@ function toFormData$1(obj, formData, options) {
|
|
|
4578
4578
|
}
|
|
4579
4579
|
|
|
4580
4580
|
if (utils$2.isArrayBuffer(value) || utils$2.isTypedArray(value)) {
|
|
4581
|
-
return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
|
|
4581
|
+
return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer$1.from(value);
|
|
4582
4582
|
}
|
|
4583
4583
|
|
|
4584
4584
|
return value;
|
|
@@ -15751,150 +15751,135 @@ util$2.inherits = function inherits(ctor, superCtor) {
|
|
|
15751
15751
|
|
|
15752
15752
|
var BufferList = {};
|
|
15753
15753
|
|
|
15754
|
-
var
|
|
15755
|
-
|
|
15756
|
-
|
|
15757
|
-
if (hasRequiredBufferList) return BufferList;
|
|
15758
|
-
hasRequiredBufferList = 1;
|
|
15759
|
-
var Buffer = buffer.Buffer;
|
|
15760
|
-
function copyBuffer(src, target, offset) {
|
|
15761
|
-
src.copy(target, offset);
|
|
15762
|
-
}
|
|
15763
|
-
BufferList.BufferList = class BufferList {
|
|
15764
|
-
constructor() {
|
|
15765
|
-
this.head = null;
|
|
15766
|
-
this.tail = null;
|
|
15767
|
-
this.length = 0;
|
|
15768
|
-
}
|
|
15769
|
-
push(v) {
|
|
15770
|
-
var entry = { data: v, next: null };
|
|
15771
|
-
if (this.length > 0)
|
|
15772
|
-
this.tail.next = entry;
|
|
15773
|
-
else
|
|
15774
|
-
this.head = entry;
|
|
15775
|
-
this.tail = entry;
|
|
15776
|
-
++this.length;
|
|
15777
|
-
}
|
|
15778
|
-
unshift(v) {
|
|
15779
|
-
var entry = { data: v, next: this.head };
|
|
15780
|
-
if (this.length === 0)
|
|
15781
|
-
this.tail = entry;
|
|
15782
|
-
this.head = entry;
|
|
15783
|
-
++this.length;
|
|
15784
|
-
}
|
|
15785
|
-
shift() {
|
|
15786
|
-
if (this.length === 0)
|
|
15787
|
-
return;
|
|
15788
|
-
var ret = this.head.data;
|
|
15789
|
-
if (this.length === 1)
|
|
15790
|
-
this.head = this.tail = null;
|
|
15791
|
-
else
|
|
15792
|
-
this.head = this.head.next;
|
|
15793
|
-
--this.length;
|
|
15794
|
-
return ret;
|
|
15795
|
-
}
|
|
15796
|
-
clear() {
|
|
15797
|
-
this.head = this.tail = null;
|
|
15798
|
-
this.length = 0;
|
|
15799
|
-
}
|
|
15800
|
-
join(s) {
|
|
15801
|
-
if (this.length === 0)
|
|
15802
|
-
return '';
|
|
15803
|
-
var p = this.head;
|
|
15804
|
-
var ret = '' + p.data;
|
|
15805
|
-
while ((p = p.next)) {
|
|
15806
|
-
ret += s + p.data;
|
|
15807
|
-
}
|
|
15808
|
-
return ret;
|
|
15809
|
-
}
|
|
15810
|
-
concat(n) {
|
|
15811
|
-
if (this.length === 0)
|
|
15812
|
-
return Buffer.alloc(0);
|
|
15813
|
-
if (this.length === 1)
|
|
15814
|
-
return this.head.data;
|
|
15815
|
-
var ret = Buffer.allocUnsafe(n >>> 0);
|
|
15816
|
-
var p = this.head;
|
|
15817
|
-
var i = 0;
|
|
15818
|
-
while (p) {
|
|
15819
|
-
copyBuffer(p.data, ret, i);
|
|
15820
|
-
i += p.data.length;
|
|
15821
|
-
p = p.next;
|
|
15822
|
-
}
|
|
15823
|
-
return ret;
|
|
15824
|
-
}
|
|
15825
|
-
};
|
|
15826
|
-
return BufferList;
|
|
15754
|
+
var Buffer = buffer.Buffer;
|
|
15755
|
+
function copyBuffer(src, target, offset) {
|
|
15756
|
+
src.copy(target, offset);
|
|
15827
15757
|
}
|
|
15758
|
+
BufferList.BufferList = class BufferList {
|
|
15759
|
+
constructor() {
|
|
15760
|
+
this.head = null;
|
|
15761
|
+
this.tail = null;
|
|
15762
|
+
this.length = 0;
|
|
15763
|
+
}
|
|
15764
|
+
push(v) {
|
|
15765
|
+
var entry = { data: v, next: null };
|
|
15766
|
+
if (this.length > 0)
|
|
15767
|
+
this.tail.next = entry;
|
|
15768
|
+
else
|
|
15769
|
+
this.head = entry;
|
|
15770
|
+
this.tail = entry;
|
|
15771
|
+
++this.length;
|
|
15772
|
+
}
|
|
15773
|
+
unshift(v) {
|
|
15774
|
+
var entry = { data: v, next: this.head };
|
|
15775
|
+
if (this.length === 0)
|
|
15776
|
+
this.tail = entry;
|
|
15777
|
+
this.head = entry;
|
|
15778
|
+
++this.length;
|
|
15779
|
+
}
|
|
15780
|
+
shift() {
|
|
15781
|
+
if (this.length === 0)
|
|
15782
|
+
return;
|
|
15783
|
+
var ret = this.head.data;
|
|
15784
|
+
if (this.length === 1)
|
|
15785
|
+
this.head = this.tail = null;
|
|
15786
|
+
else
|
|
15787
|
+
this.head = this.head.next;
|
|
15788
|
+
--this.length;
|
|
15789
|
+
return ret;
|
|
15790
|
+
}
|
|
15791
|
+
clear() {
|
|
15792
|
+
this.head = this.tail = null;
|
|
15793
|
+
this.length = 0;
|
|
15794
|
+
}
|
|
15795
|
+
join(s) {
|
|
15796
|
+
if (this.length === 0)
|
|
15797
|
+
return '';
|
|
15798
|
+
var p = this.head;
|
|
15799
|
+
var ret = '' + p.data;
|
|
15800
|
+
while ((p = p.next)) {
|
|
15801
|
+
ret += s + p.data;
|
|
15802
|
+
}
|
|
15803
|
+
return ret;
|
|
15804
|
+
}
|
|
15805
|
+
concat(n) {
|
|
15806
|
+
if (this.length === 0)
|
|
15807
|
+
return Buffer.alloc(0);
|
|
15808
|
+
if (this.length === 1)
|
|
15809
|
+
return this.head.data;
|
|
15810
|
+
var ret = Buffer.allocUnsafe(n >>> 0);
|
|
15811
|
+
var p = this.head;
|
|
15812
|
+
var i = 0;
|
|
15813
|
+
while (p) {
|
|
15814
|
+
copyBuffer(p.data, ret, i);
|
|
15815
|
+
i += p.data.length;
|
|
15816
|
+
p = p.next;
|
|
15817
|
+
}
|
|
15818
|
+
return ret;
|
|
15819
|
+
}
|
|
15820
|
+
};
|
|
15828
15821
|
|
|
15829
|
-
|
|
15830
|
-
var
|
|
15831
|
-
|
|
15832
|
-
|
|
15833
|
-
|
|
15834
|
-
|
|
15835
|
-
|
|
15836
|
-
|
|
15837
|
-
|
|
15838
|
-
|
|
15839
|
-
|
|
15840
|
-
|
|
15841
|
-
|
|
15842
|
-
|
|
15843
|
-
|
|
15844
|
-
|
|
15845
|
-
|
|
15846
|
-
|
|
15847
|
-
|
|
15848
|
-
|
|
15849
|
-
|
|
15850
|
-
|
|
15851
|
-
|
|
15852
|
-
|
|
15853
|
-
|
|
15854
|
-
|
|
15855
|
-
|
|
15856
|
-
|
|
15857
|
-
|
|
15858
|
-
|
|
15859
|
-
|
|
15860
|
-
|
|
15861
|
-
|
|
15862
|
-
|
|
15863
|
-
|
|
15864
|
-
|
|
15865
|
-
|
|
15866
|
-
|
|
15867
|
-
|
|
15868
|
-
|
|
15869
|
-
|
|
15870
|
-
|
|
15871
|
-
|
|
15872
|
-
|
|
15873
|
-
|
|
15874
|
-
|
|
15875
|
-
|
|
15876
|
-
|
|
15877
|
-
|
|
15878
|
-
|
|
15879
|
-
|
|
15880
|
-
|
|
15881
|
-
|
|
15882
|
-
this._writableState.destroyed = false;
|
|
15883
|
-
this._writableState.ended = false;
|
|
15884
|
-
this._writableState.ending = false;
|
|
15885
|
-
this._writableState.finished = false;
|
|
15886
|
-
this._writableState.errorEmitted = false;
|
|
15887
|
-
}
|
|
15888
|
-
}
|
|
15889
|
-
function emitErrorNT(self, err) {
|
|
15890
|
-
self.emit('error', err);
|
|
15891
|
-
}
|
|
15892
|
-
destroy_1 = {
|
|
15893
|
-
destroy: destroy,
|
|
15894
|
-
undestroy: undestroy
|
|
15895
|
-
};
|
|
15896
|
-
return destroy_1;
|
|
15822
|
+
/*<replacement>*/
|
|
15823
|
+
var pna = process$2;
|
|
15824
|
+
/*</replacement>*/
|
|
15825
|
+
// undocumented cb() API, needed for core, not for public API
|
|
15826
|
+
function destroy(err, cb) {
|
|
15827
|
+
var _this = this;
|
|
15828
|
+
var readableDestroyed = this._readableState && this._readableState.destroyed;
|
|
15829
|
+
var writableDestroyed = this._writableState && this._writableState.destroyed;
|
|
15830
|
+
if (readableDestroyed || writableDestroyed) {
|
|
15831
|
+
if (cb) {
|
|
15832
|
+
cb(err);
|
|
15833
|
+
}
|
|
15834
|
+
else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
|
|
15835
|
+
pna.nextTick(emitErrorNT, this, err);
|
|
15836
|
+
}
|
|
15837
|
+
return this;
|
|
15838
|
+
}
|
|
15839
|
+
// we set destroyed to true before firing error callbacks in order
|
|
15840
|
+
// to make it re-entrance safe in case destroy() is called within callbacks
|
|
15841
|
+
if (this._readableState) {
|
|
15842
|
+
this._readableState.destroyed = true;
|
|
15843
|
+
}
|
|
15844
|
+
// if this is a duplex stream mark the writable part as destroyed as well
|
|
15845
|
+
if (this._writableState) {
|
|
15846
|
+
this._writableState.destroyed = true;
|
|
15847
|
+
}
|
|
15848
|
+
this._destroy(err || null, function (err) {
|
|
15849
|
+
if (!cb && err) {
|
|
15850
|
+
pna.nextTick(emitErrorNT, _this, err);
|
|
15851
|
+
if (_this._writableState) {
|
|
15852
|
+
_this._writableState.errorEmitted = true;
|
|
15853
|
+
}
|
|
15854
|
+
}
|
|
15855
|
+
else if (cb) {
|
|
15856
|
+
cb(err);
|
|
15857
|
+
}
|
|
15858
|
+
});
|
|
15859
|
+
return this;
|
|
15860
|
+
}
|
|
15861
|
+
function undestroy() {
|
|
15862
|
+
if (this._readableState) {
|
|
15863
|
+
this._readableState.destroyed = false;
|
|
15864
|
+
this._readableState.reading = false;
|
|
15865
|
+
this._readableState.ended = false;
|
|
15866
|
+
this._readableState.endEmitted = false;
|
|
15867
|
+
}
|
|
15868
|
+
if (this._writableState) {
|
|
15869
|
+
this._writableState.destroyed = false;
|
|
15870
|
+
this._writableState.ended = false;
|
|
15871
|
+
this._writableState.ending = false;
|
|
15872
|
+
this._writableState.finished = false;
|
|
15873
|
+
this._writableState.errorEmitted = false;
|
|
15874
|
+
}
|
|
15897
15875
|
}
|
|
15876
|
+
function emitErrorNT(self, err) {
|
|
15877
|
+
self.emit('error', err);
|
|
15878
|
+
}
|
|
15879
|
+
var destroy_1 = {
|
|
15880
|
+
destroy: destroy,
|
|
15881
|
+
undestroy: undestroy
|
|
15882
|
+
};
|
|
15898
15883
|
|
|
15899
15884
|
var _stream_writable;
|
|
15900
15885
|
var hasRequired_stream_writable;
|
|
@@ -15940,7 +15925,7 @@ function require_stream_writable () {
|
|
|
15940
15925
|
return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
|
|
15941
15926
|
}
|
|
15942
15927
|
/*</replacement>*/
|
|
15943
|
-
var destroyImpl =
|
|
15928
|
+
var destroyImpl = destroy_1;
|
|
15944
15929
|
util.inherits(Writable, Stream);
|
|
15945
15930
|
function nop() { }
|
|
15946
15931
|
function WritableState(options, stream) {
|
|
@@ -16944,8 +16929,8 @@ function require_stream_readable () {
|
|
|
16944
16929
|
/*<replacement>*/
|
|
16945
16930
|
var debug = function () { };
|
|
16946
16931
|
/*</replacement>*/
|
|
16947
|
-
var BufferList =
|
|
16948
|
-
var destroyImpl =
|
|
16932
|
+
var BufferList$1 = BufferList.BufferList;
|
|
16933
|
+
var destroyImpl = destroy_1;
|
|
16949
16934
|
var StringDecoder;
|
|
16950
16935
|
util.inherits(Readable, Stream);
|
|
16951
16936
|
var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
|
|
@@ -16995,7 +16980,7 @@ function require_stream_readable () {
|
|
|
16995
16980
|
// A linked list is used to store data chunks instead of an array because the
|
|
16996
16981
|
// linked list can remove elements from the beginning faster than
|
|
16997
16982
|
// array.shift()
|
|
16998
|
-
this.buffer = new BufferList();
|
|
16983
|
+
this.buffer = new BufferList$1();
|
|
16999
16984
|
this.length = 0;
|
|
17000
16985
|
this.pipes = null;
|
|
17001
16986
|
this.pipesCount = 0;
|
|
@@ -68753,7 +68738,7 @@ var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Arr
|
|
|
68753
68738
|
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
68754
68739
|
** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
68755
68740
|
*/
|
|
68756
|
-
t.exports=function(){var t=function(t,e,n,r,i,o){for(var s=function(t,e){var n=t.toString(16);return n.length<2&&(n="0"+n),e&&(n=n.toUpperCase()),n},a=e;a<=n;a++)i[o++]=s(t[a],r);return i},e=function(t,e,n,r,i){for(var o=e;o<=n;o+=2)r[i++]=parseInt(t.substr(o,2),16);},n="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-:+=^!/*?&<>()[]{}@%$#".split(""),r=[0,68,0,84,83,82,72,0,75,76,70,65,0,63,62,69,0,1,2,3,4,5,6,7,8,9,64,0,73,66,74,71,81,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,77,0,78,67,0,0,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,79,0,80,0,0],i=function(t,e){for(var r="",i=0,o=0;i<e;)if(o=256*o+t[i++],i%4==0){for(var s=52200625;s>=1;){var a=Math.floor(o/s)%85;r+=n[a],s/=85;}o=0;}return r},o=function(t,e){var n=t.length;if(n%5!=0)throw new Error("z85_decode: invalid input length (multiple of 5 expected)");void 0===e&&(e=new Array(4*n/5));for(var i=0,o=0,s=0;i<n;){var a=t.charCodeAt(i++)-32;if(a<0||a>=r.length)break;if(s=85*s+r[a],i%5==0){for(var c=16777216;c>=1;)e[o++]=Math.trunc(s/c%256),c/=256;s=0;}}return e},s=function(t,e){var n={ibits:8,obits:8,obigendian:true};for(var r in e) void 0!==n[r]&&(n[r]=e[r]);for(var i,o,s,a=[],c=0,u=0,l=0,h=t.length;0===u&&(o=t.charCodeAt(c++)),i=o>>n.ibits-(u+8)&255,u=(u+8)%n.ibits,n.obigendian?0===l?s=i<<n.obits-8:s|=i<<n.obits-8-l:0===l?s=i:s|=i<<l,!(0==(l=(l+8)%n.obits)&&(a.push(s),c>=h)););return a},a=function(t,e){var n={ibits:32,ibigendian:true};for(var r in e) void 0!==n[r]&&(n[r]=e[r]);var i="",o=4294967295;n.ibits<32&&(o=(1<<n.ibits)-1);for(var s=t.length,a=0;a<s;a++)for(var c=t[a]&o,u=0;u<n.ibits;u+=8)n.ibigendian?i+=String.fromCharCode(c>>n.ibits-8-u&255):i+=String.fromCharCode(c>>u&255);return i},c=8,u=8,l=256,h=function(t,e,n,r,i,o,s,a){return [a,s,o,i,r,n,e,t]},d=function(){return h(0,0,0,0,0,0,0,0)},p=function(t){return t.slice(0)},f=function(t){for(var e=d(),n=0;n<c;n++)e[n]=Math.floor(t%l),t/=l;return e},v=function(t){for(var e=0,n=c-1;n>=0;n--)e*=l,e+=t[n];return Math.floor(e)},E=function(t,e){for(var n=0,r=0;r<c;r++)n+=t[r]+e[r],t[r]=Math.floor(n%l),n=Math.floor(n/l);return n},g=function(t,e){for(var n=0,r=0;r<c;r++)n+=t[r]*e,t[r]=Math.floor(n%l),n=Math.floor(n/l);return n},_=function(t,e){var n,r,i,o=new Array(c+c);for(n=0;n<c+c;n++)o[n]=0;for(n=0;n<c;n++){for(i=0,r=0;r<c;r++)i+=t[n]*e[r]+o[n+r],o[n+r]=i%l,i/=l;for(;r<c+c-n;r++)i+=o[n+r],o[n+r]=i%l,i/=l;}for(n=0;n<c;n++)t[n]=o[n];return o.slice(c,c)},m=function(t,e){for(var n=0;n<c;n++)t[n]&=e[n];return t},b=function(t,e){for(var n=0;n<c;n++)t[n]|=e[n];return t},y=function(t,e){var n=d();for(var r=Math.floor(e/u),i=0;i<r;i++){for(var o=c-1-1;o>=0;o--)n[o+1]=n[o];for(n[0]=t[0],o=0;o<c-1;o++)t[o]=t[o+1];t[o]=0;}return v(n)},O=function(t,e){if(e>c*u)throw new Error("ui64_ror: invalid number of bits to shift");var n,r=new Array(c+c);for(n=0;n<c;n++)r[n+c]=t[n],r[n]=0;var i=Math.floor(e/u),o=e%u;for(n=i;n<c+c-1;n++)r[n-i]=(r[n]>>>o|r[n+1]<<u-o)&(1<<u)-1;for(r[c+c-1-i]=r[c+c-1]>>>o&(1<<u)-1,n=c+c-1-i+1;n<c+c;n++)r[n]=0;for(n=0;n<c;n++)t[n]=r[n+c];return r.slice(0,c)},w=function(t,e){if(e>c*u)throw new Error("ui64_rol: invalid number of bits to shift");var n,r=new Array(c+c);for(n=0;n<c;n++)r[n+c]=0,r[n]=t[n];var i=Math.floor(e/u),o=e%u;for(n=c-1-i;n>0;n--)r[n+i]=(r[n]<<o|r[n-1]>>>u-o)&(1<<u)-1;for(r[0+i]=r[0]<<o&(1<<u)-1,n=0+i-1;n>=0;n--)r[n]=0;for(n=0;n<c;n++)t[n]=r[n];return r.slice(c,c)},N=function(t,e){for(var n=0;n<c;n++)t[n]^=e[n];},C=function(t,e){var n=(65535&t)+(65535&e);return (t>>16)+(e>>16)+(n>>16)<<16|65535&n},T=function(t,e){return t<<e&4294967295|t>>>32-e&4294967295},S=function(t,e){function n(t,e,n,r){return t<20?e&n|~e&r:t<40?e^n^r:t<60?e&n|e&r|n&r:e^n^r}function r(t){return t<20?1518500249:t<40?1859775393:t<60?-1894007588:-899497514}t[e>>5]|=128<<24-e%32,t[15+(e+64>>9<<4)]=e;for(var i=Array(80),o=1732584193,s=-271733879,a=-1732584194,c=271733878,u=-1009589776,l=0;l<t.length;l+=16){for(var h=o,d=s,p=a,f=c,v=u,E=0;E<80;E++){i[E]=E<16?t[l+E]:T(i[E-3]^i[E-8]^i[E-14]^i[E-16],1);var g=C(C(T(o,5),n(E,s,a,c)),C(C(u,i[E]),r(E)));u=c,c=a,a=T(s,30),s=o,o=g;}o=C(o,h),s=C(s,d),a=C(a,p),c=C(c,f),u=C(u,v);}return [o,s,a,c,u]},A=function(t){return a(S(s(t,{ibits:8,obits:32,obigendian:true}),8*t.length),{ibits:32,ibigendian:true})},I=function(t,e){function n(t,e,n,r,i,o){return C(T(C(C(e,t),C(r,o)),i),n)}function r(t,e,r,i,o,s,a){return n(e&r|~e&i,t,e,o,s,a)}function i(t,e,r,i,o,s,a){return n(e&i|r&~i,t,e,o,s,a)}function o(t,e,r,i,o,s,a){return n(e^r^i,t,e,o,s,a)}function s(t,e,r,i,o,s,a){return n(r^(e|~i),t,e,o,s,a)}t[e>>5]|=128<<e%32,t[14+(e+64>>>9<<4)]=e;for(var a=1732584193,c=-271733879,u=-1732584194,l=271733878,h=0;h<t.length;h+=16){var d=a,p=c,f=u,v=l;a=r(a,c,u,l,t[h+0],7,-680876936),l=r(l,a,c,u,t[h+1],12,-389564586),u=r(u,l,a,c,t[h+2],17,606105819),c=r(c,u,l,a,t[h+3],22,-1044525330),a=r(a,c,u,l,t[h+4],7,-176418897),l=r(l,a,c,u,t[h+5],12,1200080426),u=r(u,l,a,c,t[h+6],17,-1473231341),c=r(c,u,l,a,t[h+7],22,-45705983),a=r(a,c,u,l,t[h+8],7,1770035416),l=r(l,a,c,u,t[h+9],12,-1958414417),u=r(u,l,a,c,t[h+10],17,-42063),c=r(c,u,l,a,t[h+11],22,-1990404162),a=r(a,c,u,l,t[h+12],7,1804603682),l=r(l,a,c,u,t[h+13],12,-40341101),u=r(u,l,a,c,t[h+14],17,-1502002290),a=i(a,c=r(c,u,l,a,t[h+15],22,1236535329),u,l,t[h+1],5,-165796510),l=i(l,a,c,u,t[h+6],9,-1069501632),u=i(u,l,a,c,t[h+11],14,643717713),c=i(c,u,l,a,t[h+0],20,-373897302),a=i(a,c,u,l,t[h+5],5,-701558691),l=i(l,a,c,u,t[h+10],9,38016083),u=i(u,l,a,c,t[h+15],14,-660478335),c=i(c,u,l,a,t[h+4],20,-405537848),a=i(a,c,u,l,t[h+9],5,568446438),l=i(l,a,c,u,t[h+14],9,-1019803690),u=i(u,l,a,c,t[h+3],14,-187363961),c=i(c,u,l,a,t[h+8],20,1163531501),a=i(a,c,u,l,t[h+13],5,-1444681467),l=i(l,a,c,u,t[h+2],9,-51403784),u=i(u,l,a,c,t[h+7],14,1735328473),a=o(a,c=i(c,u,l,a,t[h+12],20,-1926607734),u,l,t[h+5],4,-378558),l=o(l,a,c,u,t[h+8],11,-2022574463),u=o(u,l,a,c,t[h+11],16,1839030562),c=o(c,u,l,a,t[h+14],23,-35309556),a=o(a,c,u,l,t[h+1],4,-1530992060),l=o(l,a,c,u,t[h+4],11,1272893353),u=o(u,l,a,c,t[h+7],16,-155497632),c=o(c,u,l,a,t[h+10],23,-1094730640),a=o(a,c,u,l,t[h+13],4,681279174),l=o(l,a,c,u,t[h+0],11,-358537222),u=o(u,l,a,c,t[h+3],16,-722521979),c=o(c,u,l,a,t[h+6],23,76029189),a=o(a,c,u,l,t[h+9],4,-640364487),l=o(l,a,c,u,t[h+12],11,-421815835),u=o(u,l,a,c,t[h+15],16,530742520),a=s(a,c=o(c,u,l,a,t[h+2],23,-995338651),u,l,t[h+0],6,-198630844),l=s(l,a,c,u,t[h+7],10,1126891415),u=s(u,l,a,c,t[h+14],15,-1416354905),c=s(c,u,l,a,t[h+5],21,-57434055),a=s(a,c,u,l,t[h+12],6,1700485571),l=s(l,a,c,u,t[h+3],10,-1894986606),u=s(u,l,a,c,t[h+10],15,-1051523),c=s(c,u,l,a,t[h+1],21,-2054922799),a=s(a,c,u,l,t[h+8],6,1873313359),l=s(l,a,c,u,t[h+15],10,-30611744),u=s(u,l,a,c,t[h+6],15,-1560198380),c=s(c,u,l,a,t[h+13],21,1309151649),a=s(a,c,u,l,t[h+4],6,-145523070),l=s(l,a,c,u,t[h+11],10,-1120210379),u=s(u,l,a,c,t[h+2],15,718787259),c=s(c,u,l,a,t[h+9],21,-343485551),a=C(a,d),c=C(c,p),u=C(u,f),l=C(l,v);}return [a,c,u,l]},R=function(t){return a(I(s(t,{ibits:8,obits:32,obigendian:false}),8*t.length),{ibits:32,ibigendian:false})},D=function(t){this.mul=h(88,81,244,45,76,149,127,45),this.inc=h(20,5,123,126,247,103,129,79),this.mask=h(0,0,0,0,255,255,255,255),this.state=p(this.inc),this.next(),m(this.state,this.mask),t=f(void 0!==t?t>>>0:4294967295*Math.random()>>>0),b(this.state,t),this.next();};D.prototype.next=function(){var t=p(this.state);_(this.state,this.mul),E(this.state,this.inc);var e=p(t);O(e,18),N(e,t),O(e,27);var n=p(t);O(n,59),m(e,this.mask);var r=v(n),i=p(e);return w(i,32-r),O(e,r),N(e,i),v(e)};var H=new D,L=function(t,e){for(var n=[],r=0;r<t;r++)n[r]=H.next()%e;return n},P=0,U=0,k=function(){if(1===arguments.length&&"string"==typeof arguments[0])this.parse.apply(this,arguments);else if(arguments.length>=1&&"number"==typeof arguments[0])this.make.apply(this,arguments);else {if(arguments.length>=1)throw new Error("UUID: constructor: invalid arguments");for(var t=0;t<16;t++)this[t]=0;}};return "undefined"!=typeof Uint8Array?k.prototype=new Uint8Array(16):Buffer?k.prototype=Buffer.alloc(16):k.prototype=new Array(16),k.prototype.constructor=k,k.prototype.make=function(t){var e,n=this;if(1===t){var r=(new Date).getTime();r!==P?U=0:U++,P=r;var i,o=f(r);g(o,1e4),E(o,h(1,178,29,210,19,129,64,0)),U>0&&E(o,f(U)),i=y(o,8),n[3]=255&i,i=y(o,8),n[2]=255&i,i=y(o,8),n[1]=255&i,i=y(o,8),n[0]=255&i,i=y(o,8),n[5]=255&i,i=y(o,8),n[4]=255&i,i=y(o,8),n[7]=255&i,i=y(o,8),n[6]=15&i;var s=L(2,255);n[8]=s[0],n[9]=s[1];var a=L(6,255);for(a[0]|=1,a[0]|=2,e=0;e<6;e++)n[10+e]=a[e];}else if(4===t){var c=L(16,255);for(e=0;e<16;e++)this[e]=c[e];}else {if(3!==t&&5!==t)throw new Error("UUID: make: invalid version");var u="",l="object"==typeof arguments[1]&&arguments[1]instanceof k?arguments[1]:(new k).parse(arguments[1]);for(e=0;e<16;e++)u+=String.fromCharCode(l[e]);u+=arguments[2];var d=3===t?R(u):A(u);for(e=0;e<16;e++)n[e]=d.charCodeAt(e);}return n[6]&=15,n[6]|=t<<4,n[8]&=63,n[8]|=128,n},k.prototype.format=function(e){var n,r;return "z85"===e?n=i(this,16):"b16"===e?(r=Array(32),t(this,0,15,true,r,0),n=r.join("")):void 0!==e&&"std"!==e||(r=new Array(36),t(this,0,3,false,r,0),r[8]="-",t(this,4,5,false,r,9),r[13]="-",t(this,6,7,false,r,14),r[18]="-",t(this,8,9,false,r,19),r[23]="-",t(this,10,15,false,r,24),n=r.join("")),n},k.prototype.toString=function(t){return this.format(t)},k.prototype.toJSON=function(){return this.format("std")},k.prototype.parse=function(t,n){if("string"!=typeof t)throw new Error("UUID: parse: invalid argument (type string expected)");if("z85"===n)o(t,this);else if("b16"===n)e(t,0,35,this,0);else if(void 0===n||"std"===n){var r={nil:"00000000-0000-0000-0000-000000000000","ns:DNS":"6ba7b810-9dad-11d1-80b4-00c04fd430c8","ns:URL":"6ba7b811-9dad-11d1-80b4-00c04fd430c8","ns:OID":"6ba7b812-9dad-11d1-80b4-00c04fd430c8","ns:X500":"6ba7b814-9dad-11d1-80b4-00c04fd430c8"};if(void 0!==r[t])t=r[t];else if(!t.match(/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/))throw new Error('UUID: parse: invalid string representation (expected "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")');e(t,0,7,this,0),e(t,9,12,this,4),e(t,14,17,this,6),e(t,19,22,this,8),e(t,24,35,this,10);}return this},k.prototype.export=function(){for(var t=Array(16),e=0;e<16;e++)t[e]=this[e];return t},k.prototype.import=function(t){if(!("object"==typeof t&&t instanceof Array))throw new Error("UUID: import: invalid argument (type Array expected)");if(16!==t.length)throw new Error("UUID: import: invalid argument (Array of length 16 expected)");for(var e=0;e<16;e++){if("number"!=typeof t[e])throw new Error("UUID: import: invalid array element #"+e+" (type Number expected)");if(!isFinite(t[e])||Math.floor(t[e])!==t[e])throw new Error("UUID: import: invalid array element #"+e+" (Number with integer value expected)");if(!(t[e]>=0&&t[e]<=255))throw new Error("UUID: import: invalid array element #"+e+" (Number with integer value in range 0...255 expected)");this[e]=t[e];}return this},k.prototype.compare=function(t){if("object"!=typeof t)throw new Error("UUID: compare: invalid argument (type UUID expected)");if(!(t instanceof k))throw new Error("UUID: compare: invalid argument (type UUID expected)");for(var e=0;e<16;e++){if(this[e]<t[e])return -1;if(this[e]>t[e])return 1}return 0},k.prototype.equal=function(t){return 0===this.compare(t)},k.prototype.fold=function(t){if(void 0===t)throw new Error("UUID: fold: invalid argument (number of fold operations expected)");if(t<1||t>4)throw new Error("UUID: fold: invalid argument (1-4 fold operations expected)");for(var e=16/Math.pow(2,t),n=new Array(e),r=0;r<e;r++){for(var i=0,o=0;r+o<16;o+=e)i^=this[r+o];n[r]=i;}return n},k.PCG=D,k}(),t.exports.default=t.exports;}));class Ze{constructor(t){this.transport=t,this.gnpLockAcquired=t.consoleAppEvent.pipe(Jt((t=>"response-gnp-lock"===t.event)),Lt((t=>t.token)),fe(1)),this.gnpLockAcquired.subscribe();}acquireGnpLock(t){const e=new Xe(4).toString(),n={action:"request-gnp-lock",id:t,token:e},r=this.gnpLockAcquired.pipe(ue((t=>t===e)));return this.transport.writeAction(n),r}releaseGnpLock(t,e){const n={action:"release-gnp-lock",id:t,token:e};this.transport.writeAction(n);}}!function(t){t[t.INPUT=0]="INPUT",t[t.OUTPUT=1]="OUTPUT",t[t.FEATURE=2]="FEATURE";}(Qe||(Qe={})),function(t){t.ABSOLUTE="absolute",t.RELATIVE="relative";}(Je||(Je={}));class tn{constructor(t){this.id=t;}equals(t){return this.id===t.id}startsWith(t){return this.id.startsWith(t.id)}toString(){return this.id}}function en(t,e,n){const r=t.toString(16).padStart(4,"0"),i=e.toString(16).padStart(4,"0");return new tn(`${r}:${i}:${n}`)}class nn{constructor(t,e,n,r){this.id=t,this.usagePage=e,this.usage=n,this.value=r;}isArray(){return Array.isArray(this.value)}static deserialize(t,e){return new nn(new tn(t),e.usagePage,e.usage,e.value)}}class rn{constructor(t,e,n){this.descriptor=e,this.transport=n,this.transportId=t.transportId,this.input=n.consoleAppEvent.pipe(Jt((t=>t.id===this.transportId)),rn.inputReportsFilter);}output(t,e,n){const r={action:"hid-output",id:this.transportId,usagePage:t,usage:e,value:n};this.transport.writeAction(r);}getFeatureReport(t,e){const n=new Xe(4).toString(),r={action:"request-hid-feature",id:this.transportId,token:n,usagePage:t,usage:e};return this.transport.writeAction(r),this.transport.consoleAppEvent.pipe(ue((t=>"response-hid-feature"===t.event&&t.token===n)),Lt((t=>t.value)))}setFeatureReport(t,e,n){const r={action:"set-hid-feature",id:this.transportId,usagePage:t,usage:e,value:n};this.transport.writeAction(r);}findDescriptor(t,e,n){return this.descriptor.find((r=>r.usagePage===t&&r.usage===e&&r.reportType===n))}}function on(t){return e=>e.pipe(function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=it(t);return M$1((function(e,r){for(var i=t.length,a=new Array(i),c=t.map((function(){return !1})),u=!1,l=function(e){Et(t[e]).subscribe(B$1(r,(function(t){a[e]=t,u||c[e]||(c[e]=!0,(u=c.every(k$1))&&(c=null));}),w));},h=0;h<i;h++)l(h);e.subscribe(B$1(r,(function(t){if(u){var e=s([t],o(a));r.next(n?n.apply(void 0,s([],o(e))):e);}})));}))}(t),Jt((([t,e])=>e)),Lt((([t,e])=>t)))}rn.inputReportsFilter=t=>t.pipe(Jt((t=>"hid-input"===t.event)),Lt((t=>nn.deserialize(t.id,t))));class sn{static typeFromAttr(t){return t>>6}static packetLengthFromAttr(t){return t&this.lengthMask}static deserialize(t){const e=t[0],n=t[1],r=t[2],i=this.typeFromAttr(t[3]),o=t[4],s=t[5],a=this.packetLengthFromAttr(t[3]),c=t.slice(6,a);return new Me(e,n,i,o,s,c,r)}}sn.lengthMask=63;class an{constructor(){this.data=[];}hasHeader(){return this.data.length>=an.gnpPacketHeaderLength}expectedPacketLength(){if(!this.hasHeader())throw new be("Unable to get expected packet length without a full header",Kt.UNEXPECTED_ERROR);return sn.packetLengthFromAttr(this.data[3])}appendData(t){this.hasHeader()&&this.expectedPacketLength()>an.gnpPacketMaxLength&&(this.data=[]),this.data=this.data.concat(t);}hasFullPacket(){if(!this.hasHeader())return false;const t=this.expectedPacketLength();return this.data.length>=t}getPacketAndReset(){if(!this.hasFullPacket())throw new be("Trying to get packet but buffer is not complete",Kt.UNEXPECTED_ERROR);const t=sn.deserialize(Uint8Array.from(this.data));return this.data=[],t}}an.gnpPacketHeaderLength=6,an.gnpPacketMaxLength=63;class cn{static attrFromTypeAndPayloadLength(t,e){return (t<<6)+(e+6)}static serialize(t){const e=new Uint8Array(6);e[0]=t.destination,e[1]=t.source,e[2]=t.sequenceNumber,e[3]=this.attrFromTypeAndPayloadLength(t.type,t.payload.length),e[4]=t.command,e[5]=t.subCommand;const n=new Uint8Array(e.length+t.payload.length);return n.set(e),n.set(t.payload,e.length),n}}const un=()=>{};function ln(t){return me((e=>t()),(e=>t()),(()=>un))}const hn=()=>{return t=t=>t.command===ke.NACK,e=t=>{const e=t.subCommand in Ge?Ge[t.subCommand]:t.subCommand;return new be(`Got NACK response. Reason: ${e}`,Kt.DEVICE_ERROR)},n=>n.pipe(Lt((n=>t(n)?Ct(e(n)):Nt(n))),ge());var t,e;},dn=t=>ue((e=>e.type===Ue.REPLY&&e.sequenceNumber===t.sequenceNumber&&e.destination===t.source&&e.source===t.destination));class pn{constructor(t,e,n,r,i=0){this.hidChannel=t,this.gnpLock=e,this.transportId=n,this.primaryAddress=r,this.lockQueue=[],this.packets=t.input.pipe(pn.inputFilter),this.events=this.packets.pipe(pn.eventsFilter),this.nextSequenceNumber=i;}static get inputFilter(){return t=>{const e=t.pipe(Jt((t=>t.usagePage===He.GN_PROTOCOL&&t.usage===Le.DATA&&t.isArray()))),n=new an;return e.pipe(Pt((t=>{const e=t.value;if(n.appendData(e),n.hasFullPacket()){return Nt(n.getPacketAndReset())}return qt})),de())}}static supportsGnpOverHid(t){return void 0!==t.findDescriptor(He.GN_PROTOCOL,Le.DATA,Qe.OUTPUT)}getNextSequenceNumber(){const t=this.nextSequenceNumber;return this.nextSequenceNumber=(this.nextSequenceNumber+1)%255,t}doWithGnpLockHeld(t){this.lockQueue.push(t),this.lockQueue.length>1||this.processLockQueue();}processLockQueue(){this.gnpLock.acquireGnpLock(this.transportId).subscribe((t=>{(0, this.lockQueue[0])((t=>{var e;const n=null===(e=this.hidChannel.findDescriptor(He.GN_PROTOCOL,Le.DATA,Qe.OUTPUT))||void 0===e?void 0:e.reportSize;if(!n)throw new be("Cannot send GNP packets to this device.",Kt.DEVICE_ERROR);const r=cn.serialize(t);let i=0;do{const t=Math.min(r.length-i,n),e=r.subarray(i,i+t);i+=e.length,this.hidChannel.output(He.GN_PROTOCOL,Le.DATA,Array.from(e));}while(i<r.length)}),this.packets,(()=>{this.gnpLock.releaseGnpLock(this.transportId,t),this.lockQueue.splice(0,1),this.lockQueue.length>0&&this.processLockQueue();}));}));}sendEvent(t,e,n=this.primaryAddress){const r=new Me(n,Pe.PC_ADDR,Ue.EVENT,t.command,t.subCommand,t.serialize(e),0);this.doWithGnpLockHeld(((t,e,n)=>{t(r),n();}));}read(t,e=this.primaryAddress,n=2500){const r=new Fe(t,(t=>new Uint8Array));return this.readWithParams(r,null,e,n)}readWithParams(t,e,n=this.primaryAddress,r=2500){const i=new Me(n,Pe.PC_ADDR,Ue.READ,t.command,t.subCommand,t.serialize(e),this.getNextSequenceNumber()),o=new Y;return this.doWithGnpLockHeld(((e,n,s)=>{n.pipe(dn(i),hn(),ue((t=>t.command===i.command&&t.subCommand===i.subCommand)),Dt(r),ln(s),Lt((e=>t.deserialize(e)))).subscribe(o),e(i);})),o}write(t,e,n=this.primaryAddress,r=2500){const i=new Me(n,Pe.PC_ADDR,Ue.WRITE,t.command,t.subCommand,t.serialize(e),this.getNextSequenceNumber()),o=new Y;return this.doWithGnpLockHeld(((t,e,n)=>{e.pipe(dn(i),hn(),ue((t=>t.command===ke.ACK)),Dt(r),ln(n),Lt((()=>true))).subscribe(o),t(i);})),o}}pn.eventsFilter=t=>t.pipe(Jt((t=>t.type===Ue.EVENT)));class fn{constructor(t,e){this.parentGnpChannel=t,this.primaryAddress=e,this.events=t.events.pipe(Jt((t=>t.source===this.primaryAddress)));}sendEvent(t,e,n){this.parentGnpChannel.sendEvent(t,e,this.primaryAddress);}read(t,e,n){return this.parentGnpChannel.read(t,this.primaryAddress,n)}readWithParams(t,e,n,r){return this.parentGnpChannel.readWithParams(t,e,this.primaryAddress,r)}write(t,e,n,r){return this.parentGnpChannel.write(t,e,this.primaryAddress,r)}}function vn(t,e,n,r){if(!pn.supportsGnpOverHid(t))return Ct((()=>new be("Device does not support GNP commands.",Kt.DEVICE_ERROR)));const i=Nt(Pe.HS_BT_USB_ADDR,Pe.BASE_ADDR,Pe.CRADLE_ADDR,Pe.HS1_ADDR,Pe.HS_CRADLE_ADDR).pipe(Lt(((r,i)=>Gt((()=>{const o=new pn(t,new Ze(e),n,r,i);return o.read(qe,r,500).pipe(Lt((t=>o)),ee((()=>et)))})))),kt(),ie(1),ae((()=>new be("GNP probe failed.",Kt.DEVICE_ERROR))));return Xt(r.pipe(Pt((t=>Ct((()=>new be("Device was suddenly disconnected.",Kt.DEVICE_ERROR)))))),i).pipe(de())}function En(t,e){return new fn(t,e)}class gn{constructor(){this.primaryAddress=Pe.BASE_ADDR,this.events=qt;}subscribeToEvent(t,e){return Ct((()=>new be("This device does not support GNP commands.",Kt.FEATURE_NOT_SUPPORTED)))}sendEvent(t,e,n){throw new be("This device does not support GNP commands.",Kt.FEATURE_NOT_SUPPORTED)}read(t,e,n){return Ct((()=>new be("This device does not support GNP commands.",Kt.FEATURE_NOT_SUPPORTED)))}readWithParams(t,e,n,r){return Ct((()=>new be("This device does not support GNP commands.",Kt.FEATURE_NOT_SUPPORTED)))}write(t,e,n,r){return Ct((()=>new be("This device does not support GNP commands.",Kt.FEATURE_NOT_SUPPORTED)))}}class _n{constructor(t){this.transportId=t,this.isChild=false;}equals(t){return this.isChild===t.isChild&&this.transportId===t.transportId}toString(){return this.transportId}}class mn{constructor(t,e){this.parentId=t,this.gnpAddress=e,this.isChild=true,this.transportId=t.transportId;}equals(t){if(this.isChild===t.isChild){const e=t;return this.parentId.equals(e.parentId)&&this.gnpAddress===e.gnpAddress}return false}toString(){return `0x${t=this.gnpAddress,t.toString(16).padStart(2,"0").toUpperCase()}@${this.transportId}`;var t;}}var bn,yn,On;!function(t){t.NO_TRACKING="no-tracking",t.TRACK_ERRORS="track-errors",t.TRACK_USAGE="track-usage",t.TRACK_ALL="track-all";}(bn||(bn={})),function(t){t[t.BLUETOOTH=0]="BLUETOOTH",t[t.INDIRECT=1]="INDIRECT",t[t.USB=2]="USB";}(yn||(yn={})),function(t){t[t.BASE=0]="BASE",t[t.HEADSET=1]="HEADSET",t[t.DESKSTAND=2]="DESKSTAND",t[t.OTHER=3]="OTHER",t[t.DONGLE=4]="DONGLE",t[t.PC=5]="PC",t[t.EHS=6]="EHS",t[t.USB=7]="USB",t[t.SPEAKER_PHONE=8]="SPEAKER_PHONE",t[t.INDICATOR=9]="INDICATOR",t[t.MOBILE=10]="MOBILE",t[t.NONE=11]="NONE",t[t.LOCAL=12]="LOCAL",t[t.DISPLAY=13]="DISPLAY",t[t.HS_CRADLE=14]="HS_CRADLE",t[t.HS_CRADLE2=15]="HS_CRADLE2",t[t.MOBILE_IAP=16]="MOBILE_IAP",t[t.CRADLE=17]="CRADLE",t[t.VIDEO=18]="VIDEO",t[t.NOT_GN=252]="NOT_GN",t[t.ANY_GN=253]="ANY_GN",t[t.NOT_INIT=254]="NOT_INIT",t[t.ANY=255]="ANY";}(On||(On={}));class wn{constructor(t,e,n,r,i,o,s,a,c,u,l){this.id=t,this.type=e,this.hidChannel=n,this.events=r,this.primaryAddress=i,this.sendEvent=o,this.read=s,this.readWithParams=a,this.write=c,this.onDisconnect=u,this.parentConnectionId=l,this.onDisconnect.subscribe({error:w});}static createConnection(t,e,n,r,i,o){const s=r.sendEvent.bind(r),a=r.read.bind(r),c=r.readWithParams.bind(r),u=r.write.bind(r);return new wn(t,e,n,r.events,r.primaryAddress,s,a,c,u,i,o)}}const Nn=(t=3,e=500)=>n=>n.pipe(Pt(((n,r)=>{const i=r+1;return i>t?Ct((()=>n)):Ft(i*i*e)})));function Cn(t,e,n,r=1e3,i=3,o=100){return Gt((()=>t.read(e,n,r))).pipe(he(Nn(i,o)))}function Tn(t,e,n){const{deviceType:r,address:i}=n;return {transportId:e.transportId,vid:e.vid,pid:Cn(t,Ve,i),name:Cn(t,Ye,i),serialNumber:Cn(t,$e,i),capabilities:e.capabilities,deviceType:r,connectionGnpAddress:i}}class Sn{constructor(t,e,n=Tn,r=wn.createConnection,i=En){this.parentConnection=e,this.connectionCreator=r,this.createChildGnpChannel=i;const o=e.events.pipe(Jt((t=>t.command===ke.DEVICE&&t.subCommand===xe.ATTACH_EVENT)),Lt((t=>({deviceType:t.payload[0],address:t.payload[1]})))).pipe(Lt(n.bind(null,e,t)));this.connectionEvents=o.pipe(Lt((t=>{const n=Xt(e.events.pipe(ue((e=>e.command===ke.DEVICE&&e.subCommand===xe.DETACH_EVENT&&e.payload[1]===t.connectionGnpAddress)),Lt(w)),e.onDisconnect);return {attach:t,detach:n}})),Pt((t=>te(Nt(t.attach),this.createConnection(t.attach,t.detach)))),Lt((([t,e])=>({event:t,connection:e}))),_e(e.onDisconnect)),e.sendEvent(Be,[]);}createConnection(t,e){const n=t.connectionGnpAddress,r=this.createChildGnpChannel(this.parentConnection,n),i=new mn(this.parentConnection.id,n);return Nt(this.connectionCreator(i,yn.INDIRECT,this.parentConnection.hidChannel,r,e,this.parentConnection.id))}}const An={command:ke.IDENT,subCommand:xe.TYPE,deserialize:t=>{const{payload:e}=t,n=e[0];if(n<1||n>=e.length)throw new be("Cannot get device type.",Kt.DEVICE_ERROR);return e[1]}};function In(t,e,n,r=Bt.ERROR,i=Wt.JS_LIB){const o=`${t} ${function(t){if(t instanceof be){const e=t;return `JabraError: ${e.message} (type: ${e.type})`}if(t instanceof Error){const e=t;return `Error: ${e.message} (name: ${e.name})`}return `Unknown error: ${t}`}(e)}`;ye(o,n,r,i);}function Rn(t){return new Sn(t.event,t.connection).connectionEvents}class Dn{constructor(t,e,n=((t,e,n)=>new rn(t,e,n)),r=vn,i=Rn,o=wn.createConnection){this.transport=t,this.logger=e,this.createHidChannel=n,this.createRootGnpChannel=r,this.connectionCreator=o;const s=this.transport.consoleAppEvent.pipe(Jt((t=>"attach"===t.event)),Lt(Dn.createAttachEvent),ee(((t,e)=>(In("",t,this.logger),e)))).pipe(Lt((t=>{const e=this.transport.consoleAppEvent.pipe(Jt((t=>"detach"===t.event)),ue((e=>Dn.getTransportId(e)===t.transportId)),Lt(w),fe());return e.subscribe(),{attach:t,detach:e}})),Pt((t=>this.createConnection(t.attach,t.detach))),de()),a=s.pipe(Jt((t=>t.event.deviceType===On.DONGLE)),Jt((t=>pn.supportsGnpOverHid(t.connection.hidChannel))),Pt((t=>i(t))));this.connectionEvents=Mt(s,a).pipe(de());}static convertToReportType(t){switch(t){case "input":return Qe.INPUT;case "output":return Qe.OUTPUT;case "feature":return Qe.FEATURE;default:throw new be(`${t} is not a valid ReportType`,Kt.UNEXPECTED_ERROR)}}static convertToValueType(t){switch(t){case "absolute":return Je.ABSOLUTE;case "relative":return Je.RELATIVE;default:throw new be(`${t} Not a valid ValueType`,Kt.UNEXPECTED_ERROR)}}static createDescriptor(t){return t.map((t=>({reportType:Dn.convertToReportType(t.reportType),usagePage:t.usagePage,usage:t.usage,valueType:Dn.convertToValueType(t.valueType),reportSize:t.reportSize})))}static getMandatoryField(t,e){const n=t[e];if(void 0===n)throw new be(`JSON event lacks required field "${e}: ${JSON.stringify(t)}`,Kt.UNEXPECTED_ERROR);return n}static getTransportId(t){return Dn.getMandatoryField(t,"id")}static createAttachEvent(t){return {transportId:Dn.getTransportId(t),vid:Dn.getMandatoryField(t,"vid"),pid:Nt(Dn.getMandatoryField(t,"pid")),name:Nt(Dn.getMandatoryField(t,"name")),serialNumber:Nt(Dn.getMandatoryField(t,"serialNumber")),capabilities:Dn.createDescriptor(Dn.getMandatoryField(t,"descriptor"))}}createConnection(t,e,n=3,r=100){const{capabilities:i,transportId:o}=t,s=new _n(o),a=this.createHidChannel(s,i,this.transport),c=this.createRootGnpChannel(a,this.transport,o,e).pipe(ee(((t,e)=>(t.type&&t.type===Kt.DEVICE_ERROR&&this.transport.context===Vt.WEB_HID&&ye("Child devices are not yet supported when using WebHID.",this.logger,Bt.WARNING,Wt.JS_LIB),Nt(new gn)))),de()),u=c.pipe(Pt((t=>t.read(An))),he(Nn(n,r)),ee((t=>Nt(On.ANY))));return te(c,u).pipe(_e(e),Lt((([n,r])=>({event:Object.assign(Object.assign({},t),{deviceType:r,connectionGnpAddress:n.primaryAddress}),connection:this.connectionCreator(s,yn.USB,a,n,e)}))))}}var Hn,Ln,Pn,Un,kn;class xn{constructor(t,e,n,r,i,o){this.vendorId=t,this.productId=e,this.serialNumber=n,this.name=r,this.type=i,Ln.set(this,void 0),h$1(this,Ln,new we(o,l$1(xn,Hn,"m",Un))),this.connectionAdded=l$1(this,Ln,"f").itemAdded,this.connectionRemoved=l$1(this,Ln,"f").itemRemoved,this.connectionList=l$1(this,Ln,"f").itemList,this.onDisconnect=l$1(this,Ln,"f").itemList.pipe(ve(1),ue((t=>0===t.length)),Lt(w),de());}get id(){return en(this.vendorId,this.productId,this.serialNumber)}get currentConnections(){return l$1(this,Ln,"f").getValue()}get browserLabel(){return `${this.vendorId.toString(16).padStart(4,"0")}:${this.productId.toString(16).padStart(4,"0")}`}}Hn=xn,Ln=new WeakMap,Un=function(t,e){return l$1(xn,Hn,"f",Pn).indexOf(t.type)-l$1(xn,Hn,"f",Pn).indexOf(e.type)},Pn={value:[yn.USB,yn.INDIRECT,yn.BLUETOOTH]};class Gn{constructor(t){this.deviceObservables=new we(t);}static exceptionToUndefined(t){try{return t()}catch(t){if(t instanceof be)return;throw t}}connectionExists(t){return void 0!==Gn.exceptionToUndefined((()=>this.findConnectionById(t)))}findConnectionById(t){for(const e of this.deviceObservables.getValue())for(const n of e.currentConnections)if(n.id.equals(t))return n;throw new be(`Could not find connection with id ${t.toString()}`,Kt.UNEXPECTED_ERROR)}findDeviceByDeviceId(t){return this.deviceObservables.getValue().find((e=>e.id.startsWith(t)||t.startsWith(e.id)))}}class Fn{constructor(t,e){this.logger=e;const[n,r]=(i=t.pipe(Jt((t=>!this.deviceCollection.connectionExists(t.connection.id))),ne((t=>this.force(t)))),[Jt(o=({event:t,pid:e,serialNumber:n})=>!this.deviceCollection.findDeviceByDeviceId(en(t.event.vid,e,n)),s)(Et(i)),Jt(Qt(o,s))(Et(i))]);var i,o,s;const a=n.pipe(Lt((t=>Fn.createDevice(t,r))));this.deviceCollection=new Gn(a),this.deviceObservables=this.deviceCollection.deviceObservables;}force(t){const{name:e,pid:n,serialNumber:r}=t.event,i=t.connection.onDisconnect.pipe((a=Ct((()=>new Error(`Connection with ID ${t.connection.id} disconnected`))),d$2(c)?ne((function(){return a}),c):ne((function(){return a}))));var a,c;return te(e,n,r).pipe(Lt((([e,n,r])=>({event:t,name:e,pid:n,serialNumber:r}))),function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.length?M$1((function(e,n){Zt(s([e],o(t)))(n);})):k$1}(i),ee((t=>(ye(`Failed to retrieve child connection information. Error: ${t}`,this.logger,Bt.WARNING,Wt.JS_LIB),et))))}static createDevice(t,e){const{event:n,pid:r,name:i,serialNumber:o}=t,{vid:s,deviceType:a}=n.event,c=e.pipe(Jt((e=>Fn.isSameDevice(t,e))),Lt((t=>t.event.connection))),u=xt(Nt(n.connection),c);return new xn(s,r,o,i,a,u)}static isSameDevice(t,e){const n=en(t.event.event.vid,t.pid,t.serialNumber),r=en(e.event.event.vid,e.pid,e.serialNumber);return n.startsWith(r)||r.startsWith(n)}static create(t,e){const n=new Dn(t,e);return new Fn(n.connectionEvents)}}function Mn(t){var e,r,i;return n(this,void 0,void 0,(function*(){const n=null==t?void 0:t.logger;ye("Jabra SDK JS starting up...",n,Bt.INFO);const o=new Re(t);o.validateOrganizationKey(),o.validateAppId(),o.validateAppName();const s=null!==(r=null===(e=null==t?void 0:t.internal)||void 0===e?void 0:e.testDeviceTransport)&&void 0!==r?r:yield Se(n,null==t?void 0:t.transport,null===(i=null==t?void 0:t.internal)||void 0===i?void 0:i.recorder);new Ae(s,n);const a=Fn.create(s,n),c=new Ce(a,s,t);return yield s.connect(),c}))}class Bn{constructor(t,e,n,r){this.deviceId=t,this.usagePage=e,this.usage=n,this.value=r;}}class Wn{constructor(t,e){this.token=t,this.value=e;}}!function(t){t.UsageReport=class{constructor(t,e){this.usage=t,this.value=e;}};}(kn||(kn={}));var Kn,Yn,Vn,jn,qn,$n,zn,Qn,Jn,Xn,Zn=ze((function(t){!function(e){var n=function(t,e,n){if(!(t instanceof ArrayBuffer||"undefined"!=typeof Buffer&&t instanceof Buffer))throw new Error("Must specify a valid ArrayBuffer or Buffer.");e=e||0,n=n||t.byteLength||t.length,this._view=new Uint8Array(t.buffer||t,e,n),this.bigEndian=false;};n._scratch=new DataView(new ArrayBuffer(8)),Object.defineProperty(n.prototype,"buffer",{get:function(){return "undefined"!=typeof Buffer?Buffer.from(this._view.buffer):this._view.buffer},enumerable:true,configurable:false}),Object.defineProperty(n.prototype,"byteLength",{get:function(){return this._view.length},enumerable:true,configurable:false}),n.prototype._setBit=function(t,e){e?this._view[t>>3]|=1<<(7&t):this._view[t>>3]&=~(1<<(7&t));},n.prototype.getBits=function(t,e,n){var r=8*this._view.length-t;if(e>r)throw new Error("Cannot get "+e+" bit(s) from offset "+t+", "+r+" available");for(var i=0,o=0;o<e;){var s=e-o,a=7&t,c=this._view[t>>3],u=Math.min(s,8-a);this.bigEndian?(i<<=u,i|=c>>8-u-a&~(255<<u)):i|=(c>>a&~(255<<u))<<o,t+=u,o+=u;}return n?(32!==e&&i&1<<e-1&&(i|=-1^(1<<e)-1),i):i>>>0},n.prototype.setBits=function(t,e,n){var r=8*this._view.length-t;if(n>r)throw new Error("Cannot set "+n+" bit(s) from offset "+t+", "+r+" available");for(var i=0;i<n;){var o,s,a,c=n-i,u=7&t,l=t>>3,h=Math.min(c,8-u);if(this.bigEndian){s=e>>n-i-h&(o=~(-1<<h));var d=8-u-h;a=~(o<<d),this._view[l]=this._view[l]&a|s<<d;}else s=e&(o=~(255<<h)),e>>=h,a=~(o<<u),this._view[l]=this._view[l]&a|s<<u;t+=h,i+=h;}},n.prototype.getBoolean=function(t){return 0!==this.getBits(t,1,false)},n.prototype.getInt8=function(t){return this.getBits(t,8,true)},n.prototype.getUint8=function(t){return this.getBits(t,8,false)},n.prototype.getInt16=function(t){return this.getBits(t,16,true)},n.prototype.getUint16=function(t){return this.getBits(t,16,false)},n.prototype.getInt32=function(t){return this.getBits(t,32,true)},n.prototype.getUint32=function(t){return this.getBits(t,32,false)},n.prototype.getFloat32=function(t){return n._scratch.setUint32(0,this.getUint32(t)),n._scratch.getFloat32(0)},n.prototype.getFloat64=function(t){return n._scratch.setUint32(0,this.getUint32(t)),n._scratch.setUint32(4,this.getUint32(t+32)),n._scratch.getFloat64(0)},n.prototype.setBoolean=function(t,e){this.setBits(t,e?1:0,1);},n.prototype.setInt8=n.prototype.setUint8=function(t,e){this.setBits(t,e,8);},n.prototype.setInt16=n.prototype.setUint16=function(t,e){this.setBits(t,e,16);},n.prototype.setInt32=n.prototype.setUint32=function(t,e){this.setBits(t,e,32);},n.prototype.setFloat32=function(t,e){n._scratch.setFloat32(0,e),this.setBits(t,n._scratch.getUint32(0),32);},n.prototype.setFloat64=function(t,e){n._scratch.setFloat64(0,e),this.setBits(t,n._scratch.getUint32(0),32),this.setBits(t+32,n._scratch.getUint32(4),32);},n.prototype.getArrayBuffer=function(t,e){for(var n=new Uint8Array(e),r=0;r<e;r++)n[r]=this.getUint8(t+8*r);return n};var r=function(t,e){return function(){if(this._index+e>this._length)throw new Error("Trying to read past the end of the stream");var n=this._view[t](this._index);return this._index+=e,n}},i=function(t,e){return function(n){this._view[t](this._index,n),this._index+=e;}};function o(t,e,n){if(0===e)return "";var r=0,i=[],o=true,s=!!e;for(e||(e=Math.floor((t._length-t._index)/8));r<e;){var a=t.readUint8();if(0===a&&(o=false,!s))break;o&&i.push(a),r++;}var c=String.fromCharCode.apply(null,i);if(!n)return c;try{return decodeURIComponent(escape(c))}catch(t){return c}}var s=function(t,e,r){var i=t instanceof ArrayBuffer||"undefined"!=typeof Buffer&&t instanceof Buffer;if(!(t instanceof n||i))throw new Error("Must specify a valid BitView, ArrayBuffer or Buffer");this._view=i?new n(t,e,r):t,this._index=0,this._startIndex=0,this._length=8*this._view.byteLength;};Object.defineProperty(s.prototype,"index",{get:function(){return this._index-this._startIndex},set:function(t){this._index=t+this._startIndex;},enumerable:true,configurable:true}),Object.defineProperty(s.prototype,"length",{get:function(){return this._length-this._startIndex},set:function(t){this._length=t+this._startIndex;},enumerable:true,configurable:true}),Object.defineProperty(s.prototype,"bitsLeft",{get:function(){return this._length-this._index},enumerable:true,configurable:true}),Object.defineProperty(s.prototype,"byteIndex",{get:function(){return Math.ceil(this._index/8)},set:function(t){this._index=8*t;},enumerable:true,configurable:true}),Object.defineProperty(s.prototype,"buffer",{get:function(){return this._view.buffer},enumerable:true,configurable:false}),Object.defineProperty(s.prototype,"view",{get:function(){return this._view},enumerable:true,configurable:false}),Object.defineProperty(s.prototype,"bigEndian",{get:function(){return this._view.bigEndian},set:function(t){this._view.bigEndian=t;},enumerable:true,configurable:false}),s.prototype.readBits=function(t,e){var n=this._view.getBits(this._index,t,e);return this._index+=t,n},s.prototype.writeBits=function(t,e){this._view.setBits(this._index,t,e),this._index+=e;},s.prototype.readBoolean=r("getBoolean",1),s.prototype.readInt8=r("getInt8",8),s.prototype.readUint8=r("getUint8",8),s.prototype.readInt16=r("getInt16",16),s.prototype.readUint16=r("getUint16",16),s.prototype.readInt32=r("getInt32",32),s.prototype.readUint32=r("getUint32",32),s.prototype.readFloat32=r("getFloat32",32),s.prototype.readFloat64=r("getFloat64",64),s.prototype.writeBoolean=i("setBoolean",1),s.prototype.writeInt8=i("setInt8",8),s.prototype.writeUint8=i("setUint8",8),s.prototype.writeInt16=i("setInt16",16),s.prototype.writeUint16=i("setUint16",16),s.prototype.writeInt32=i("setInt32",32),s.prototype.writeUint32=i("setUint32",32),s.prototype.writeFloat32=i("setFloat32",32),s.prototype.writeFloat64=i("setFloat64",64),s.prototype.readASCIIString=function(t){return function(t,e){return o(t,e,false)}(this,t)},s.prototype.readUTF8String=function(t){return function(t,e){return o(t,e,true)}(this,t)},s.prototype.writeASCIIString=function(t,e){!function(t,e,n){for(var r=n||e.length+1,i=0;i<r;i++)t.writeUint8(i<e.length?e.charCodeAt(i):0);}(this,t,e);},s.prototype.writeUTF8String=function(t,e){!function(t,e,n){for(var r=function(t){var e,n,r=[];for(e=0;e<t.length;e++)(n=t.charCodeAt(e))<=127?r.push(n):n<=2047?(r.push(n>>6|192),r.push(63&n|128)):n<=65535?(r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)):(r.push(n>>18|240),r.push(n>>12&63|128),r.push(n>>6&63|128),r.push(63&n|128));return r}(e),i=n||r.length+1,o=0;o<i;o++)t.writeUint8(o<r.length?r[o]:0);}(this,t,e);},s.prototype.readBitStream=function(t){var e=new s(this._view);return e._startIndex=this._index,e._index=this._index,e.length=t,this._index+=t,e},s.prototype.writeBitStream=function(t,e){var n;for(e||(e=t.bitsLeft);e>0;)n=Math.min(e,32),this.writeBits(t.readBits(n),n),e-=n;},s.prototype.readArrayBuffer=function(t){var e=this._view.getArrayBuffer(this._index,t);return this._index+=8*t,e},s.prototype.writeArrayBuffer=function(t,e){this.writeBitStream(new s(t),8*e);},t.exports&&(t.exports={BitView:n,BitStream:s});}();}));function tr(){return n(this,void 0,void 0,(function*(){const{hid:t}=window.navigator;if(!t)throw new be("WebHID not supported",Kt.INIT_ERROR);const e=yield t.requestDevice({filters:[{vendorId:Kn.VENDOR_ID}]});return new BroadcastChannel(Kn.PAIRING_CHANNEL).postMessage(null),e}))}!function(t){t[t.VENDOR_ID=2830]="VENDOR_ID",t.PAIRING_CHANNEL="jabra-webhid-pairing-channel";}(Kn||(Kn={})),function(t){t[t.HOOK_SWITCH=32]="HOOK_SWITCH",t[t.GN_PSEUDO_HOOK_SWITCH=65531]="GN_PSEUDO_HOOK_SWITCH",t[t.FLASH=33]="FLASH",t[t.ALT_HOLD=35]="ALT_HOLD",t[t.REDIAL=36]="REDIAL",t[t.ONLINE=42]="ONLINE",t[t.SPEAKER_PHONE=43]="SPEAKER_PHONE",t[t.PHONE_MUTE=47]="PHONE_MUTE",t[t.SEND=49]="SEND",t[t.SPEED_DIAL=80]="SPEED_DIAL",t[t.VOICE_MAIL=112]="VOICE_MAIL",t[t.ANSWER_ON_OFF=116]="ANSWER_ON_OFF",t[t.LINE_BUSY=151]="LINE_BUSY",t[t.RINGER=158]="RINGER",t[t.PHONE_KEY_0=176]="PHONE_KEY_0",t[t.PHONE_KEY_1=177]="PHONE_KEY_1",t[t.PHONE_KEY_2=178]="PHONE_KEY_2",t[t.PHONE_KEY_3=179]="PHONE_KEY_3",t[t.PHONE_KEY_4=180]="PHONE_KEY_4",t[t.PHONE_KEY_5=181]="PHONE_KEY_5",t[t.PHONE_KEY_6=182]="PHONE_KEY_6",t[t.PHONE_KEY_7=183]="PHONE_KEY_7",t[t.PHONE_KEY_8=184]="PHONE_KEY_8",t[t.PHONE_KEY_9=185]="PHONE_KEY_9",t[t.PHONE_KEY_STAR=186]="PHONE_KEY_STAR",t[t.PHONE_KEY_POUND=187]="PHONE_KEY_POUND",t[t.ALT_VOLUME_UP=233]="ALT_VOLUME_UP",t[t.ALT_VOLUME_DOWN=234]="ALT_VOLUME_DOWN",t[t.REJECT_CALL=65533]="REJECT_CALL";}(Yn||(Yn={}));class er{constructor(t,e,n){this.type=t,this.value=e,this.valueType=n;}toString(){return void 0===Yn[this.type]?`Unknown signal: type: ${this.type}, value: ${this.value}, valueType: ${this.valueType}`:`Signal: type: ${Yn[this.type]}, value: ${this.value}, valueType: ${this.valueType}`}}!function(t){t[t.BUTTON=9]="BUTTON",t[t.CONSUMER=12]="CONSUMER",t[t.LED=8]="LED",t[t.TELEPHONY=11]="TELEPHONY",t[t.GN_CONSUMER=65312]="GN_CONSUMER",t[t.GN_EXT_BUTTONS=65360]="GN_EXT_BUTTONS",t[t.GN_LED=65344]="GN_LED",t[t.GN_MISC=65376]="GN_MISC",t[t.GN_TELEPHONY=65328]="GN_TELEPHONY";}(Vn||(Vn={})),function(t){t[t.MUTE=9]="MUTE",t[t.OFF_HOOK=23]="OFF_HOOK",t[t.RING=24]="RING",t[t.MESSAGE_WAIT=25]="MESSAGE_WAIT",t[t.HOLD=32]="HOLD",t[t.MIC_MUTE=33]="MIC_MUTE",t[t.ONLINE=42]="ONLINE",t[t.HID_OFFLINE=43]="HID_OFFLINE";}(jn||(jn={})),function(t){t[t.HOOK_SWITCH=32]="HOOK_SWITCH",t[t.FLASH=33]="FLASH",t[t.HOLD=35]="HOLD",t[t.REDIAL=36]="REDIAL",t[t.ONLINE=42]="ONLINE",t[t.SPEAKER_PHONE=43]="SPEAKER_PHONE",t[t.MUTE=47]="MUTE",t[t.HID_SEND=49]="HID_SEND",t[t.SPEED_DIAL=80]="SPEED_DIAL",t[t.VOICE_MAIL=112]="VOICE_MAIL",t[t.ANSWER_ON_OFF=116]="ANSWER_ON_OFF",t[t.LINE_BUSY=151]="LINE_BUSY",t[t.RINGER=158]="RINGER",t[t.PHONE_KEY_0=176]="PHONE_KEY_0",t[t.PHONE_KEY_1=177]="PHONE_KEY_1",t[t.PHONE_KEY_2=178]="PHONE_KEY_2",t[t.PHONE_KEY_3=179]="PHONE_KEY_3",t[t.PHONE_KEY_4=180]="PHONE_KEY_4",t[t.PHONE_KEY_5=181]="PHONE_KEY_5",t[t.PHONE_KEY_6=182]="PHONE_KEY_6",t[t.PHONE_KEY_7=183]="PHONE_KEY_7",t[t.PHONE_KEY_8=184]="PHONE_KEY_8",t[t.PHONE_KEY_9=185]="PHONE_KEY_9",t[t.PHONE_KEY_STAR=186]="PHONE_KEY_STAR",t[t.PHONE_KEY_POUND=187]="PHONE_KEY_POUND",t[t.HID_ALT_VOLUME_UP=233]="HID_ALT_VOLUME_UP",t[t.HID_ALT_VOLUME_DOWN=234]="HID_ALT_VOLUME_DOWN",t[t.GN_PSEUDO_HOOK_SWITCH=65531]="GN_PSEUDO_HOOK_SWITCH",t[t.GN_OUT_OF_RANGE=65532]="GN_OUT_OF_RANGE",t[t.GN_REJECT_CALL=65533]="GN_REJECT_CALL",t[t.GN_TELEPHONY_CONT_SET=65535]="GN_TELEPHONY_CONT_SET";}(qn||(qn={}));class nr{constructor(t,e,n,r,i){this.hidChannel=t,this.onDisconnect=e,this.isSoftphoneInFocus=n,this.lockHeld=r,this.logger=i,this.cachedSignals=new Map;}setup(){const t=this.filter().pipe(de());return t.subscribe(),t}filter(){const t=this.hidChannel.input.pipe(Jt((t=>t.usagePage===Vn.GN_TELEPHONY&&!t.isArray())),Pt((t=>{const e=this.hidChannel.findDescriptor(t.usagePage,t.usage,Qe.INPUT);return (null==e?void 0:e.valueType)?Nt(Object.assign(Object.assign({},t),{valueType:e.valueType})):(In("",new be(`Unable to find value-type in descriptor for UsagePage: ${t.usagePage} and Usage: ${t.usage}`,Kt.FEATURE_NOT_SUPPORTED),this.logger),et)})),Jt((t=>{if(t.valueType===Je.RELATIVE)return Boolean(t.value);return this.cachedSignals.get(t.usage)!==t.value})),me((t=>{this.cachedSignals.set(t.usage,t.value);})),_e(this.onDisconnect),de()),e=[Yn.HOOK_SWITCH,Yn.REDIAL],n=t.pipe(on(this.isSoftphoneInFocus),Jt((t=>e.includes(t.usage)&&!this.lockHeld.getValue())));return Mt(t.pipe(Jt((t=>this.lockHeld.getValue()))),n).pipe(Lt((t=>new er(t.usage,0!==t.value,t.valueType))),ee((t=>(ye(t.message,this.logger),et))))}}class rr{constructor(t,e,n,r,i,o){this.device=t,this.onDisconnect=n,$n.set(this,void 0),zn.set(this,new j(false)),Qn.set(this,void 0),Jn.set(this,false),this.deviceSignals=new Y,h$1(this,$n,r),l$1(this,$n,"f").lockHeld.subscribe(l$1(this,zn,"f")),h$1(this,Qn,e),this.onDisconnect.pipe(ue(),Lt((()=>true))).subscribe((t=>{h$1(this,Jn,t);}));const s=new nr(l$1(this,Qn,"f"),this.onDisconnect,i,l$1(this,zn,"f"),o);this.deviceSignals=s.setup();}checkCallLockHeld(t){if(!l$1(this,zn,"f").getValue())throw new be(t,Kt.SDK_USAGE_ERROR)}checkCallLockNotHeld(t){if(l$1(this,zn,"f").getValue())throw new be(t,Kt.SDK_USAGE_ERROR)}checkHasDisconnected(){if(l$1(this,Jn,"f"))throw new be("CallControl cannot be performed as the connection has disconnected.",Kt.SDK_USAGE_ERROR)}takeCallLock(){return this.checkHasDisconnected(),this.checkCallLockNotHeld("Trying to take the call lock, but it is already held!"),St(l$1(this,$n,"f").tryTakeCallLock())}releaseCallLock(){this.checkHasDisconnected(),this.checkCallLockHeld("Trying to release the call lock, but it is not held!"),l$1(this,$n,"f").releaseCallLock();}offHook(t){this.checkHasDisconnected(),this.checkCallLockHeld("Calls can only be started and stopped when the call lock is held.");const e=l$1(this,Qn,"f").findDescriptor(Vn.GN_LED,jn.OFF_HOOK,Qe.OUTPUT);if(!e)throw new be(`Device ${this.device.name} does not support any offHook functionality.`,Kt.FEATURE_NOT_SUPPORTED);const n=t?1:0;l$1(this,Qn,"f").output(e.usagePage,e.usage,n);}ring(t){this.checkHasDisconnected(),this.checkCallLockHeld("The ringer state can only be modified when the call lock is held.");const e=l$1(this,Qn,"f").findDescriptor(Vn.GN_LED,jn.RING,Qe.OUTPUT),n=l$1(this,Qn,"f").findDescriptor(Vn.GN_TELEPHONY,qn.RINGER,Qe.OUTPUT);if(!e&&!n)throw new be(`Device ${this.device.name} does not support any ring functionality.`,Kt.FEATURE_NOT_SUPPORTED);if(n){const e=t?1:0;l$1(this,Qn,"f").output(n.usagePage,n.usage,e);}if(e){const n=t?1:0;l$1(this,Qn,"f").output(e.usagePage,e.usage,n);}}mute(t){this.checkHasDisconnected(),this.checkCallLockHeld("The mute state can only be modified when the call lock is held.");let e=l$1(this,Qn,"f").findDescriptor(Vn.GN_LED,jn.MIC_MUTE,Qe.OUTPUT);if(e||(e=l$1(this,Qn,"f").findDescriptor(Vn.GN_LED,jn.MUTE,Qe.OUTPUT)),!e)throw new be(`Device ${this.device.name} does not support any mute functionality.`,Kt.FEATURE_NOT_SUPPORTED);const n=t?1:0;l$1(this,Qn,"f").output(e.usagePage,e.usage,n);}hold(t){this.checkHasDisconnected(),this.checkCallLockHeld("The hold state can only be modified when the call lock is held.");const e=l$1(this,Qn,"f").findDescriptor(Vn.GN_LED,jn.HOLD,Qe.OUTPUT);if(!e)throw new be(`Device ${this.device.name} does not support hold functionality.`,Kt.FEATURE_NOT_SUPPORTED);const n=t?1:0;l$1(this,Qn,"f").output(e.usagePage,e.usage,n);}}$n=new WeakMap,zn=new WeakMap,Qn=new WeakMap,Jn=new WeakMap,function(t){t[t.STD_TELEPHONY=0]="STD_TELEPHONY",t[t.GN_TELEPHONY=1]="GN_TELEPHONY";}(Xn||(Xn={}));const ir={[De.SKYPE]:Xn.GN_TELEPHONY,[De.CISCO]:Xn.GN_TELEPHONY,[De.AVAYA]:Xn.GN_TELEPHONY,[De.SIEMENS]:Xn.GN_TELEPHONY,[De.IBM]:Xn.GN_TELEPHONY,[De.AASTRA]:Xn.GN_TELEPHONY,[De.JABRA]:Xn.GN_TELEPHONY,[De.NEC]:Xn.GN_TELEPHONY,[De.SHORETEL]:Xn.GN_TELEPHONY,[De.MS_OC]:Xn.STD_TELEPHONY,[De.ALCATEL]:Xn.STD_TELEPHONY,[De.OTHER]:Xn.STD_TELEPHONY,[De.NORTEL]:null,[De.GENERIC]:null};function or(t,e){const n=t.read(je).pipe(Lt((t=>ir[t]===e))),r=t.read(new Ke).pipe(Lt((t=>t.find((t=>ir[t]===e))))).pipe(Lt((e=>e?t.write(je,e):Nt(false))),ge());return n.pipe((i=Nt(true),o=r,t=>t.pipe(Lt((t=>t?i:o)),ge())));var i,o;}class sr{constructor(t,e,n){this.connectionCallLock=t,this.device=e,this.logger=n,this.lockHeld=new j(false),this.currentLocks=new j(new Set),this.lockReleaseEvent=new Y;}tryTakeCallLock(){const{currentConnections:t}=this.device,e=new Set,n=Gt((()=>wt(t).pipe(ne((t=>this.takeSingleCallLock(t).pipe(ee((t=>(In("DeviceCallLock:",t,this.logger),Nt(""))))))),me((t=>e.add(t)))))).pipe(function(t,e){var n=arguments.length>=2;return function(r){return r.pipe(k$1,le(1),n?re(e):ae((function(){return new Tt})))}}(),Lt((n=>(e.delete(""),this.currentLocks.next(e),e.size!==t.length?(this.releaseCallLock(),false):(this.lockHeld.next(true),true)))),fe());return n.subscribe((t=>{t&&(this.acquireLockOnNextConnectionEmit(),this.releaseLockOnRemovedConnectionEmit());})),n}acquireLockOnNextConnectionEmit(){this.device.connectionAdded.pipe(_e(this.lockReleaseEvent)).subscribe((t=>{this.takeSingleCallLock(t).pipe(_e(this.lockReleaseEvent),Lt((t=>(this.currentLocks.getValue().add(t),this.currentLocks.next(this.currentLocks.getValue()),w))),he(Nn())).subscribe({error:t=>{ye(`Failed to acquire the call lock on a new connection.\n Another softphone running an old SDK has most likely acquired this lock.\n Full error: ${t}`,this.logger,Bt.WARNING,Wt.JS_LIB);}});}));}releaseLockOnRemovedConnectionEmit(){this.device.connectionRemoved.pipe(_e(this.lockReleaseEvent)).subscribe((t=>this.releaseSingleCallLock(t.id.transportId)));}takeSingleCallLock(t){return Gt((()=>this.connectionCallLock.tryTakeCallLock(t.id.transportId))).pipe(Lt((e=>e.acquired?Nt(e.transportId):Ct((()=>new be(`Failed to acquire call lock on connection ${t.id.transportId}`,Kt.SDK_USAGE_ERROR))))),ge())}releaseCallLock(){this.lockReleaseEvent.next();[...this.currentLocks.getValue()].forEach((t=>{this.releaseSingleCallLock(t);})),this.currentLocks.getValue().clear(),this.currentLocks.next(this.currentLocks.getValue());}releaseSingleCallLock(t){this.connectionCallLock.releaseCallLock(t),this.currentLocks.getValue().delete(t),this.currentLocks.next(this.currentLocks.getValue()),0!==this.currentLocks.getValue().size&&0!==this.device.currentConnections.length||(this.lockReleaseEvent.next(),this.lockHeld.next(false));}}class ar{constructor(t){this.transport=t;}tryTakeCallLock(t){const e={action:"request-call-lock",id:t};return this.transport.writeAction(e),this.transport.consoleAppEvent.pipe(Jt((e=>"response-call-lock"===e.event&&e.id===t)),Lt((t=>({transportId:t.id,acquired:t.acquired}))),ue())}releaseCallLock(t){const e={action:"release-call-lock",id:t};this.transport.writeAction(e);}}const cr=[{usagePage:Vn.GN_LED,usage:jn.OFF_HOOK,reportType:Qe.OUTPUT},{usagePage:Vn.GN_LED,usage:jn.RING,reportType:Qe.OUTPUT},{usagePage:Vn.GN_TELEPHONY,usage:qn.RINGER,reportType:Qe.OUTPUT},{usagePage:Vn.GN_LED,usage:jn.MIC_MUTE,reportType:Qe.OUTPUT},{usagePage:Vn.GN_LED,usage:jn.MUTE,reportType:Qe.OUTPUT},{usagePage:Vn.GN_LED,usage:jn.HOLD,reportType:Qe.OUTPUT}],ur=[yn.USB,yn.INDIRECT,yn.BLUETOOTH];function lr(t,e){const{hidChannel:n}=t;return !!function(t){return cr.some((({usagePage:e,usage:n,reportType:r})=>t.findDescriptor(e,n,r)))}(n)&&(!pn.supportsGnpOverHid(n)||e!==On.DONGLE&&e!==On.OTHER)}function hr(t){const{currentConnections:e,type:n}=t;var r;return (r=e,[...r].sort(((t,e)=>ur.indexOf(t.type)-ur.indexOf(e.type)))).find((t=>lr(t,n)))}function dr(t,e,n,r,i){const o=hr(t),{hidChannel:s,onDisconnect:a}=o,c=new sr(new ar(r),t,i);if(e)return Nt(new rr(t,s,a,c,n.softphoneInFocus,i));if(r.context===Vt.WEB_HID)return Nt(new rr(t,s,a,c,n.softphoneInFocus,i));return function(t,e){return t.findDescriptor(Vn.GN_TELEPHONY,qn.GN_TELEPHONY_CONT_SET,Qe.FEATURE)?Gt((()=>(t.setFeatureReport(Vn.GN_TELEPHONY,qn.GN_TELEPHONY_CONT_SET,1),Nt(true)))):e?or(e,Xn.GN_TELEPHONY):Nt(false)}(s,o).pipe(Lt((e=>new rr(t,s,a,c,n.softphoneInFocus,i))))}class pr{constructor(t,e){this.devComm=t,this.softphoneInFocus=new G$1,this.softphoneInFocus=e.pipe(ue(),Pt((t=>this.devComm.consoleAppEvent.pipe(Jt((t=>"softphone-in-focus"===t.event)),Lt((t=>t.infocus)),function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=ot(t);return M$1((function(e,r){(n?xt(t,e,n):xt(t,e)).subscribe(r);}))}(!t),fe(1))))),this.softphoneInFocus.subscribe((()=>{}));}setSharedSoftphoneInfo(t){if(!(null==t?void 0:t.partnerKey)||!(null==t?void 0:t.appId))return void ye("Unable to register with Jabra Direct: partnerKey or appId missing in config",null==t?void 0:t.logger,Bt.WARNING);const e=t.partnerKey+t.appId,n=new Xe(5,"ns:OID",e);let{appName:r}=t;if((!t.appName||t.appName.length<3)&&(ye("App name missing in config. Fall back to use appId as app name.",null==t?void 0:t.logger,Bt.WARNING),r=t.appId),r.length>100)return void ye("Unable to register with Jabra Direct: appName must be below 100 characters.",null==t?void 0:t.logger,Bt.WARNING);const i={action:"set-softphone-info",name:r,id:n.toString()};this.devComm.writeAction(i);}}var fr,vr,Er,gr,_r,mr,br,yr;class Nr{constructor(t){var e;fr.set(this,void 0),vr.set(this,void 0),Er.set(this,void 0),gr.set(this,void 0),h$1(this,gr,t._readyEvents.pipe(ue((t=>"ready"===t.event)),Lt((t=>t.jabraDirectInstalled)))),h$1(this,vr,new pr(t._transport,l$1(this,gr,"f"))),l$1(this,vr,"f").setSharedSoftphoneInfo(t._config),h$1(this,fr,t._transport),h$1(this,Er,null===(e=t._config)||void 0===e?void 0:e.logger);}createCallControl(t){if(!this.supportsCallControl(t))return Promise.reject(new be(`Device ${t.name} does not support call control.`,Kt.FEATURE_NOT_SUPPORTED));return At(l$1(this,gr,"f").pipe(Pt((e=>dr(t,e,l$1(this,vr,"f"),l$1(this,fr,"f"),l$1(this,Er,"f"))))))}supportsCallControl(t){return void 0!==hr(t)}}fr=new WeakMap,vr=new WeakMap,Er=new WeakMap,gr=new WeakMap,function(t){t.HOLD_CURRENT="hold-current",t.END_CURRENT="end-current";}(_r||(_r={})),function(t){t.MUTED="muted",t.UNMUTED="unmuted",t.NO_ONGOING_CALLS="no-ongoing-calls";}(mr||(mr={})),function(t){t.ON_HOLD="on-hold",t.NOT_ON_HOLD="not-on-hold",t.NO_ONGOING_CALLS="no-ongoing-calls";}(br||(br={})),function(t){t.NO_INCOMING="no-incoming",t.AWAITING_RESPONSE="awaiting-response",t.RESOLVING_RESPONSE="resolving-response",t.ACCEPTED="accepted",t.REJECTED="rejected";}(yr||(yr={}));({muteState:mr.NO_ONGOING_CALLS,holdState:br.NO_ONGOING_CALLS,incomingCall:yr.NO_INCOMING});
|
|
68741
|
+
t.exports=function(){var t=function(t,e,n,r,i,o){for(var s=function(t,e){var n=t.toString(16);return n.length<2&&(n="0"+n),e&&(n=n.toUpperCase()),n},a=e;a<=n;a++)i[o++]=s(t[a],r);return i},e=function(t,e,n,r,i){for(var o=e;o<=n;o+=2)r[i++]=parseInt(t.substr(o,2),16);},n="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-:+=^!/*?&<>()[]{}@%$#".split(""),r=[0,68,0,84,83,82,72,0,75,76,70,65,0,63,62,69,0,1,2,3,4,5,6,7,8,9,64,0,73,66,74,71,81,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,77,0,78,67,0,0,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,79,0,80,0,0],i=function(t,e){for(var r="",i=0,o=0;i<e;)if(o=256*o+t[i++],i%4==0){for(var s=52200625;s>=1;){var a=Math.floor(o/s)%85;r+=n[a],s/=85;}o=0;}return r},o=function(t,e){var n=t.length;if(n%5!=0)throw new Error("z85_decode: invalid input length (multiple of 5 expected)");void 0===e&&(e=new Array(4*n/5));for(var i=0,o=0,s=0;i<n;){var a=t.charCodeAt(i++)-32;if(a<0||a>=r.length)break;if(s=85*s+r[a],i%5==0){for(var c=16777216;c>=1;)e[o++]=Math.trunc(s/c%256),c/=256;s=0;}}return e},s=function(t,e){var n={ibits:8,obits:8,obigendian:true};for(var r in e) void 0!==n[r]&&(n[r]=e[r]);for(var i,o,s,a=[],c=0,u=0,l=0,h=t.length;0===u&&(o=t.charCodeAt(c++)),i=o>>n.ibits-(u+8)&255,u=(u+8)%n.ibits,n.obigendian?0===l?s=i<<n.obits-8:s|=i<<n.obits-8-l:0===l?s=i:s|=i<<l,!(0==(l=(l+8)%n.obits)&&(a.push(s),c>=h)););return a},a=function(t,e){var n={ibits:32,ibigendian:true};for(var r in e) void 0!==n[r]&&(n[r]=e[r]);var i="",o=4294967295;n.ibits<32&&(o=(1<<n.ibits)-1);for(var s=t.length,a=0;a<s;a++)for(var c=t[a]&o,u=0;u<n.ibits;u+=8)n.ibigendian?i+=String.fromCharCode(c>>n.ibits-8-u&255):i+=String.fromCharCode(c>>u&255);return i},c=8,u=8,l=256,h=function(t,e,n,r,i,o,s,a){return [a,s,o,i,r,n,e,t]},d=function(){return h(0,0,0,0,0,0,0,0)},p=function(t){return t.slice(0)},f=function(t){for(var e=d(),n=0;n<c;n++)e[n]=Math.floor(t%l),t/=l;return e},v=function(t){for(var e=0,n=c-1;n>=0;n--)e*=l,e+=t[n];return Math.floor(e)},E=function(t,e){for(var n=0,r=0;r<c;r++)n+=t[r]+e[r],t[r]=Math.floor(n%l),n=Math.floor(n/l);return n},g=function(t,e){for(var n=0,r=0;r<c;r++)n+=t[r]*e,t[r]=Math.floor(n%l),n=Math.floor(n/l);return n},_=function(t,e){var n,r,i,o=new Array(c+c);for(n=0;n<c+c;n++)o[n]=0;for(n=0;n<c;n++){for(i=0,r=0;r<c;r++)i+=t[n]*e[r]+o[n+r],o[n+r]=i%l,i/=l;for(;r<c+c-n;r++)i+=o[n+r],o[n+r]=i%l,i/=l;}for(n=0;n<c;n++)t[n]=o[n];return o.slice(c,c)},m=function(t,e){for(var n=0;n<c;n++)t[n]&=e[n];return t},b=function(t,e){for(var n=0;n<c;n++)t[n]|=e[n];return t},y=function(t,e){var n=d();for(var r=Math.floor(e/u),i=0;i<r;i++){for(var o=c-1-1;o>=0;o--)n[o+1]=n[o];for(n[0]=t[0],o=0;o<c-1;o++)t[o]=t[o+1];t[o]=0;}return v(n)},O=function(t,e){if(e>c*u)throw new Error("ui64_ror: invalid number of bits to shift");var n,r=new Array(c+c);for(n=0;n<c;n++)r[n+c]=t[n],r[n]=0;var i=Math.floor(e/u),o=e%u;for(n=i;n<c+c-1;n++)r[n-i]=(r[n]>>>o|r[n+1]<<u-o)&(1<<u)-1;for(r[c+c-1-i]=r[c+c-1]>>>o&(1<<u)-1,n=c+c-1-i+1;n<c+c;n++)r[n]=0;for(n=0;n<c;n++)t[n]=r[n+c];return r.slice(0,c)},w=function(t,e){if(e>c*u)throw new Error("ui64_rol: invalid number of bits to shift");var n,r=new Array(c+c);for(n=0;n<c;n++)r[n+c]=0,r[n]=t[n];var i=Math.floor(e/u),o=e%u;for(n=c-1-i;n>0;n--)r[n+i]=(r[n]<<o|r[n-1]>>>u-o)&(1<<u)-1;for(r[0+i]=r[0]<<o&(1<<u)-1,n=0+i-1;n>=0;n--)r[n]=0;for(n=0;n<c;n++)t[n]=r[n];return r.slice(c,c)},N=function(t,e){for(var n=0;n<c;n++)t[n]^=e[n];},C=function(t,e){var n=(65535&t)+(65535&e);return (t>>16)+(e>>16)+(n>>16)<<16|65535&n},T=function(t,e){return t<<e&4294967295|t>>>32-e&4294967295},S=function(t,e){function n(t,e,n,r){return t<20?e&n|~e&r:t<40?e^n^r:t<60?e&n|e&r|n&r:e^n^r}function r(t){return t<20?1518500249:t<40?1859775393:t<60?-1894007588:-899497514}t[e>>5]|=128<<24-e%32,t[15+(e+64>>9<<4)]=e;for(var i=Array(80),o=1732584193,s=-271733879,a=-1732584194,c=271733878,u=-1009589776,l=0;l<t.length;l+=16){for(var h=o,d=s,p=a,f=c,v=u,E=0;E<80;E++){i[E]=E<16?t[l+E]:T(i[E-3]^i[E-8]^i[E-14]^i[E-16],1);var g=C(C(T(o,5),n(E,s,a,c)),C(C(u,i[E]),r(E)));u=c,c=a,a=T(s,30),s=o,o=g;}o=C(o,h),s=C(s,d),a=C(a,p),c=C(c,f),u=C(u,v);}return [o,s,a,c,u]},A=function(t){return a(S(s(t,{ibits:8,obits:32,obigendian:true}),8*t.length),{ibits:32,ibigendian:true})},I=function(t,e){function n(t,e,n,r,i,o){return C(T(C(C(e,t),C(r,o)),i),n)}function r(t,e,r,i,o,s,a){return n(e&r|~e&i,t,e,o,s,a)}function i(t,e,r,i,o,s,a){return n(e&i|r&~i,t,e,o,s,a)}function o(t,e,r,i,o,s,a){return n(e^r^i,t,e,o,s,a)}function s(t,e,r,i,o,s,a){return n(r^(e|~i),t,e,o,s,a)}t[e>>5]|=128<<e%32,t[14+(e+64>>>9<<4)]=e;for(var a=1732584193,c=-271733879,u=-1732584194,l=271733878,h=0;h<t.length;h+=16){var d=a,p=c,f=u,v=l;a=r(a,c,u,l,t[h+0],7,-680876936),l=r(l,a,c,u,t[h+1],12,-389564586),u=r(u,l,a,c,t[h+2],17,606105819),c=r(c,u,l,a,t[h+3],22,-1044525330),a=r(a,c,u,l,t[h+4],7,-176418897),l=r(l,a,c,u,t[h+5],12,1200080426),u=r(u,l,a,c,t[h+6],17,-1473231341),c=r(c,u,l,a,t[h+7],22,-45705983),a=r(a,c,u,l,t[h+8],7,1770035416),l=r(l,a,c,u,t[h+9],12,-1958414417),u=r(u,l,a,c,t[h+10],17,-42063),c=r(c,u,l,a,t[h+11],22,-1990404162),a=r(a,c,u,l,t[h+12],7,1804603682),l=r(l,a,c,u,t[h+13],12,-40341101),u=r(u,l,a,c,t[h+14],17,-1502002290),a=i(a,c=r(c,u,l,a,t[h+15],22,1236535329),u,l,t[h+1],5,-165796510),l=i(l,a,c,u,t[h+6],9,-1069501632),u=i(u,l,a,c,t[h+11],14,643717713),c=i(c,u,l,a,t[h+0],20,-373897302),a=i(a,c,u,l,t[h+5],5,-701558691),l=i(l,a,c,u,t[h+10],9,38016083),u=i(u,l,a,c,t[h+15],14,-660478335),c=i(c,u,l,a,t[h+4],20,-405537848),a=i(a,c,u,l,t[h+9],5,568446438),l=i(l,a,c,u,t[h+14],9,-1019803690),u=i(u,l,a,c,t[h+3],14,-187363961),c=i(c,u,l,a,t[h+8],20,1163531501),a=i(a,c,u,l,t[h+13],5,-1444681467),l=i(l,a,c,u,t[h+2],9,-51403784),u=i(u,l,a,c,t[h+7],14,1735328473),a=o(a,c=i(c,u,l,a,t[h+12],20,-1926607734),u,l,t[h+5],4,-378558),l=o(l,a,c,u,t[h+8],11,-2022574463),u=o(u,l,a,c,t[h+11],16,1839030562),c=o(c,u,l,a,t[h+14],23,-35309556),a=o(a,c,u,l,t[h+1],4,-1530992060),l=o(l,a,c,u,t[h+4],11,1272893353),u=o(u,l,a,c,t[h+7],16,-155497632),c=o(c,u,l,a,t[h+10],23,-1094730640),a=o(a,c,u,l,t[h+13],4,681279174),l=o(l,a,c,u,t[h+0],11,-358537222),u=o(u,l,a,c,t[h+3],16,-722521979),c=o(c,u,l,a,t[h+6],23,76029189),a=o(a,c,u,l,t[h+9],4,-640364487),l=o(l,a,c,u,t[h+12],11,-421815835),u=o(u,l,a,c,t[h+15],16,530742520),a=s(a,c=o(c,u,l,a,t[h+2],23,-995338651),u,l,t[h+0],6,-198630844),l=s(l,a,c,u,t[h+7],10,1126891415),u=s(u,l,a,c,t[h+14],15,-1416354905),c=s(c,u,l,a,t[h+5],21,-57434055),a=s(a,c,u,l,t[h+12],6,1700485571),l=s(l,a,c,u,t[h+3],10,-1894986606),u=s(u,l,a,c,t[h+10],15,-1051523),c=s(c,u,l,a,t[h+1],21,-2054922799),a=s(a,c,u,l,t[h+8],6,1873313359),l=s(l,a,c,u,t[h+15],10,-30611744),u=s(u,l,a,c,t[h+6],15,-1560198380),c=s(c,u,l,a,t[h+13],21,1309151649),a=s(a,c,u,l,t[h+4],6,-145523070),l=s(l,a,c,u,t[h+11],10,-1120210379),u=s(u,l,a,c,t[h+2],15,718787259),c=s(c,u,l,a,t[h+9],21,-343485551),a=C(a,d),c=C(c,p),u=C(u,f),l=C(l,v);}return [a,c,u,l]},R=function(t){return a(I(s(t,{ibits:8,obits:32,obigendian:false}),8*t.length),{ibits:32,ibigendian:false})},D=function(t){this.mul=h(88,81,244,45,76,149,127,45),this.inc=h(20,5,123,126,247,103,129,79),this.mask=h(0,0,0,0,255,255,255,255),this.state=p(this.inc),this.next(),m(this.state,this.mask),t=f(void 0!==t?t>>>0:4294967295*Math.random()>>>0),b(this.state,t),this.next();};D.prototype.next=function(){var t=p(this.state);_(this.state,this.mul),E(this.state,this.inc);var e=p(t);O(e,18),N(e,t),O(e,27);var n=p(t);O(n,59),m(e,this.mask);var r=v(n),i=p(e);return w(i,32-r),O(e,r),N(e,i),v(e)};var H=new D,L=function(t,e){for(var n=[],r=0;r<t;r++)n[r]=H.next()%e;return n},P=0,U=0,k=function(){if(1===arguments.length&&"string"==typeof arguments[0])this.parse.apply(this,arguments);else if(arguments.length>=1&&"number"==typeof arguments[0])this.make.apply(this,arguments);else {if(arguments.length>=1)throw new Error("UUID: constructor: invalid arguments");for(var t=0;t<16;t++)this[t]=0;}};return "undefined"!=typeof Uint8Array?k.prototype=new Uint8Array(16):Buffer$1?k.prototype=Buffer$1.alloc(16):k.prototype=new Array(16),k.prototype.constructor=k,k.prototype.make=function(t){var e,n=this;if(1===t){var r=(new Date).getTime();r!==P?U=0:U++,P=r;var i,o=f(r);g(o,1e4),E(o,h(1,178,29,210,19,129,64,0)),U>0&&E(o,f(U)),i=y(o,8),n[3]=255&i,i=y(o,8),n[2]=255&i,i=y(o,8),n[1]=255&i,i=y(o,8),n[0]=255&i,i=y(o,8),n[5]=255&i,i=y(o,8),n[4]=255&i,i=y(o,8),n[7]=255&i,i=y(o,8),n[6]=15&i;var s=L(2,255);n[8]=s[0],n[9]=s[1];var a=L(6,255);for(a[0]|=1,a[0]|=2,e=0;e<6;e++)n[10+e]=a[e];}else if(4===t){var c=L(16,255);for(e=0;e<16;e++)this[e]=c[e];}else {if(3!==t&&5!==t)throw new Error("UUID: make: invalid version");var u="",l="object"==typeof arguments[1]&&arguments[1]instanceof k?arguments[1]:(new k).parse(arguments[1]);for(e=0;e<16;e++)u+=String.fromCharCode(l[e]);u+=arguments[2];var d=3===t?R(u):A(u);for(e=0;e<16;e++)n[e]=d.charCodeAt(e);}return n[6]&=15,n[6]|=t<<4,n[8]&=63,n[8]|=128,n},k.prototype.format=function(e){var n,r;return "z85"===e?n=i(this,16):"b16"===e?(r=Array(32),t(this,0,15,true,r,0),n=r.join("")):void 0!==e&&"std"!==e||(r=new Array(36),t(this,0,3,false,r,0),r[8]="-",t(this,4,5,false,r,9),r[13]="-",t(this,6,7,false,r,14),r[18]="-",t(this,8,9,false,r,19),r[23]="-",t(this,10,15,false,r,24),n=r.join("")),n},k.prototype.toString=function(t){return this.format(t)},k.prototype.toJSON=function(){return this.format("std")},k.prototype.parse=function(t,n){if("string"!=typeof t)throw new Error("UUID: parse: invalid argument (type string expected)");if("z85"===n)o(t,this);else if("b16"===n)e(t,0,35,this,0);else if(void 0===n||"std"===n){var r={nil:"00000000-0000-0000-0000-000000000000","ns:DNS":"6ba7b810-9dad-11d1-80b4-00c04fd430c8","ns:URL":"6ba7b811-9dad-11d1-80b4-00c04fd430c8","ns:OID":"6ba7b812-9dad-11d1-80b4-00c04fd430c8","ns:X500":"6ba7b814-9dad-11d1-80b4-00c04fd430c8"};if(void 0!==r[t])t=r[t];else if(!t.match(/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/))throw new Error('UUID: parse: invalid string representation (expected "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")');e(t,0,7,this,0),e(t,9,12,this,4),e(t,14,17,this,6),e(t,19,22,this,8),e(t,24,35,this,10);}return this},k.prototype.export=function(){for(var t=Array(16),e=0;e<16;e++)t[e]=this[e];return t},k.prototype.import=function(t){if(!("object"==typeof t&&t instanceof Array))throw new Error("UUID: import: invalid argument (type Array expected)");if(16!==t.length)throw new Error("UUID: import: invalid argument (Array of length 16 expected)");for(var e=0;e<16;e++){if("number"!=typeof t[e])throw new Error("UUID: import: invalid array element #"+e+" (type Number expected)");if(!isFinite(t[e])||Math.floor(t[e])!==t[e])throw new Error("UUID: import: invalid array element #"+e+" (Number with integer value expected)");if(!(t[e]>=0&&t[e]<=255))throw new Error("UUID: import: invalid array element #"+e+" (Number with integer value in range 0...255 expected)");this[e]=t[e];}return this},k.prototype.compare=function(t){if("object"!=typeof t)throw new Error("UUID: compare: invalid argument (type UUID expected)");if(!(t instanceof k))throw new Error("UUID: compare: invalid argument (type UUID expected)");for(var e=0;e<16;e++){if(this[e]<t[e])return -1;if(this[e]>t[e])return 1}return 0},k.prototype.equal=function(t){return 0===this.compare(t)},k.prototype.fold=function(t){if(void 0===t)throw new Error("UUID: fold: invalid argument (number of fold operations expected)");if(t<1||t>4)throw new Error("UUID: fold: invalid argument (1-4 fold operations expected)");for(var e=16/Math.pow(2,t),n=new Array(e),r=0;r<e;r++){for(var i=0,o=0;r+o<16;o+=e)i^=this[r+o];n[r]=i;}return n},k.PCG=D,k}(),t.exports.default=t.exports;}));class Ze{constructor(t){this.transport=t,this.gnpLockAcquired=t.consoleAppEvent.pipe(Jt((t=>"response-gnp-lock"===t.event)),Lt((t=>t.token)),fe(1)),this.gnpLockAcquired.subscribe();}acquireGnpLock(t){const e=new Xe(4).toString(),n={action:"request-gnp-lock",id:t,token:e},r=this.gnpLockAcquired.pipe(ue((t=>t===e)));return this.transport.writeAction(n),r}releaseGnpLock(t,e){const n={action:"release-gnp-lock",id:t,token:e};this.transport.writeAction(n);}}!function(t){t[t.INPUT=0]="INPUT",t[t.OUTPUT=1]="OUTPUT",t[t.FEATURE=2]="FEATURE";}(Qe||(Qe={})),function(t){t.ABSOLUTE="absolute",t.RELATIVE="relative";}(Je||(Je={}));class tn{constructor(t){this.id=t;}equals(t){return this.id===t.id}startsWith(t){return this.id.startsWith(t.id)}toString(){return this.id}}function en(t,e,n){const r=t.toString(16).padStart(4,"0"),i=e.toString(16).padStart(4,"0");return new tn(`${r}:${i}:${n}`)}class nn{constructor(t,e,n,r){this.id=t,this.usagePage=e,this.usage=n,this.value=r;}isArray(){return Array.isArray(this.value)}static deserialize(t,e){return new nn(new tn(t),e.usagePage,e.usage,e.value)}}class rn{constructor(t,e,n){this.descriptor=e,this.transport=n,this.transportId=t.transportId,this.input=n.consoleAppEvent.pipe(Jt((t=>t.id===this.transportId)),rn.inputReportsFilter);}output(t,e,n){const r={action:"hid-output",id:this.transportId,usagePage:t,usage:e,value:n};this.transport.writeAction(r);}getFeatureReport(t,e){const n=new Xe(4).toString(),r={action:"request-hid-feature",id:this.transportId,token:n,usagePage:t,usage:e};return this.transport.writeAction(r),this.transport.consoleAppEvent.pipe(ue((t=>"response-hid-feature"===t.event&&t.token===n)),Lt((t=>t.value)))}setFeatureReport(t,e,n){const r={action:"set-hid-feature",id:this.transportId,usagePage:t,usage:e,value:n};this.transport.writeAction(r);}findDescriptor(t,e,n){return this.descriptor.find((r=>r.usagePage===t&&r.usage===e&&r.reportType===n))}}function on(t){return e=>e.pipe(function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=it(t);return M$1((function(e,r){for(var i=t.length,a=new Array(i),c=t.map((function(){return !1})),u=!1,l=function(e){Et(t[e]).subscribe(B$1(r,(function(t){a[e]=t,u||c[e]||(c[e]=!0,(u=c.every(k$1))&&(c=null));}),w));},h=0;h<i;h++)l(h);e.subscribe(B$1(r,(function(t){if(u){var e=s([t],o(a));r.next(n?n.apply(void 0,s([],o(e))):e);}})));}))}(t),Jt((([t,e])=>e)),Lt((([t,e])=>t)))}rn.inputReportsFilter=t=>t.pipe(Jt((t=>"hid-input"===t.event)),Lt((t=>nn.deserialize(t.id,t))));class sn{static typeFromAttr(t){return t>>6}static packetLengthFromAttr(t){return t&this.lengthMask}static deserialize(t){const e=t[0],n=t[1],r=t[2],i=this.typeFromAttr(t[3]),o=t[4],s=t[5],a=this.packetLengthFromAttr(t[3]),c=t.slice(6,a);return new Me(e,n,i,o,s,c,r)}}sn.lengthMask=63;class an{constructor(){this.data=[];}hasHeader(){return this.data.length>=an.gnpPacketHeaderLength}expectedPacketLength(){if(!this.hasHeader())throw new be("Unable to get expected packet length without a full header",Kt.UNEXPECTED_ERROR);return sn.packetLengthFromAttr(this.data[3])}appendData(t){this.hasHeader()&&this.expectedPacketLength()>an.gnpPacketMaxLength&&(this.data=[]),this.data=this.data.concat(t);}hasFullPacket(){if(!this.hasHeader())return false;const t=this.expectedPacketLength();return this.data.length>=t}getPacketAndReset(){if(!this.hasFullPacket())throw new be("Trying to get packet but buffer is not complete",Kt.UNEXPECTED_ERROR);const t=sn.deserialize(Uint8Array.from(this.data));return this.data=[],t}}an.gnpPacketHeaderLength=6,an.gnpPacketMaxLength=63;class cn{static attrFromTypeAndPayloadLength(t,e){return (t<<6)+(e+6)}static serialize(t){const e=new Uint8Array(6);e[0]=t.destination,e[1]=t.source,e[2]=t.sequenceNumber,e[3]=this.attrFromTypeAndPayloadLength(t.type,t.payload.length),e[4]=t.command,e[5]=t.subCommand;const n=new Uint8Array(e.length+t.payload.length);return n.set(e),n.set(t.payload,e.length),n}}const un=()=>{};function ln(t){return me((e=>t()),(e=>t()),(()=>un))}const hn=()=>{return t=t=>t.command===ke.NACK,e=t=>{const e=t.subCommand in Ge?Ge[t.subCommand]:t.subCommand;return new be(`Got NACK response. Reason: ${e}`,Kt.DEVICE_ERROR)},n=>n.pipe(Lt((n=>t(n)?Ct(e(n)):Nt(n))),ge());var t,e;},dn=t=>ue((e=>e.type===Ue.REPLY&&e.sequenceNumber===t.sequenceNumber&&e.destination===t.source&&e.source===t.destination));class pn{constructor(t,e,n,r,i=0){this.hidChannel=t,this.gnpLock=e,this.transportId=n,this.primaryAddress=r,this.lockQueue=[],this.packets=t.input.pipe(pn.inputFilter),this.events=this.packets.pipe(pn.eventsFilter),this.nextSequenceNumber=i;}static get inputFilter(){return t=>{const e=t.pipe(Jt((t=>t.usagePage===He.GN_PROTOCOL&&t.usage===Le.DATA&&t.isArray()))),n=new an;return e.pipe(Pt((t=>{const e=t.value;if(n.appendData(e),n.hasFullPacket()){return Nt(n.getPacketAndReset())}return qt})),de())}}static supportsGnpOverHid(t){return void 0!==t.findDescriptor(He.GN_PROTOCOL,Le.DATA,Qe.OUTPUT)}getNextSequenceNumber(){const t=this.nextSequenceNumber;return this.nextSequenceNumber=(this.nextSequenceNumber+1)%255,t}doWithGnpLockHeld(t){this.lockQueue.push(t),this.lockQueue.length>1||this.processLockQueue();}processLockQueue(){this.gnpLock.acquireGnpLock(this.transportId).subscribe((t=>{(0, this.lockQueue[0])((t=>{var e;const n=null===(e=this.hidChannel.findDescriptor(He.GN_PROTOCOL,Le.DATA,Qe.OUTPUT))||void 0===e?void 0:e.reportSize;if(!n)throw new be("Cannot send GNP packets to this device.",Kt.DEVICE_ERROR);const r=cn.serialize(t);let i=0;do{const t=Math.min(r.length-i,n),e=r.subarray(i,i+t);i+=e.length,this.hidChannel.output(He.GN_PROTOCOL,Le.DATA,Array.from(e));}while(i<r.length)}),this.packets,(()=>{this.gnpLock.releaseGnpLock(this.transportId,t),this.lockQueue.splice(0,1),this.lockQueue.length>0&&this.processLockQueue();}));}));}sendEvent(t,e,n=this.primaryAddress){const r=new Me(n,Pe.PC_ADDR,Ue.EVENT,t.command,t.subCommand,t.serialize(e),0);this.doWithGnpLockHeld(((t,e,n)=>{t(r),n();}));}read(t,e=this.primaryAddress,n=2500){const r=new Fe(t,(t=>new Uint8Array));return this.readWithParams(r,null,e,n)}readWithParams(t,e,n=this.primaryAddress,r=2500){const i=new Me(n,Pe.PC_ADDR,Ue.READ,t.command,t.subCommand,t.serialize(e),this.getNextSequenceNumber()),o=new Y;return this.doWithGnpLockHeld(((e,n,s)=>{n.pipe(dn(i),hn(),ue((t=>t.command===i.command&&t.subCommand===i.subCommand)),Dt(r),ln(s),Lt((e=>t.deserialize(e)))).subscribe(o),e(i);})),o}write(t,e,n=this.primaryAddress,r=2500){const i=new Me(n,Pe.PC_ADDR,Ue.WRITE,t.command,t.subCommand,t.serialize(e),this.getNextSequenceNumber()),o=new Y;return this.doWithGnpLockHeld(((t,e,n)=>{e.pipe(dn(i),hn(),ue((t=>t.command===ke.ACK)),Dt(r),ln(n),Lt((()=>true))).subscribe(o),t(i);})),o}}pn.eventsFilter=t=>t.pipe(Jt((t=>t.type===Ue.EVENT)));class fn{constructor(t,e){this.parentGnpChannel=t,this.primaryAddress=e,this.events=t.events.pipe(Jt((t=>t.source===this.primaryAddress)));}sendEvent(t,e,n){this.parentGnpChannel.sendEvent(t,e,this.primaryAddress);}read(t,e,n){return this.parentGnpChannel.read(t,this.primaryAddress,n)}readWithParams(t,e,n,r){return this.parentGnpChannel.readWithParams(t,e,this.primaryAddress,r)}write(t,e,n,r){return this.parentGnpChannel.write(t,e,this.primaryAddress,r)}}function vn(t,e,n,r){if(!pn.supportsGnpOverHid(t))return Ct((()=>new be("Device does not support GNP commands.",Kt.DEVICE_ERROR)));const i=Nt(Pe.HS_BT_USB_ADDR,Pe.BASE_ADDR,Pe.CRADLE_ADDR,Pe.HS1_ADDR,Pe.HS_CRADLE_ADDR).pipe(Lt(((r,i)=>Gt((()=>{const o=new pn(t,new Ze(e),n,r,i);return o.read(qe,r,500).pipe(Lt((t=>o)),ee((()=>et)))})))),kt(),ie(1),ae((()=>new be("GNP probe failed.",Kt.DEVICE_ERROR))));return Xt(r.pipe(Pt((t=>Ct((()=>new be("Device was suddenly disconnected.",Kt.DEVICE_ERROR)))))),i).pipe(de())}function En(t,e){return new fn(t,e)}class gn{constructor(){this.primaryAddress=Pe.BASE_ADDR,this.events=qt;}subscribeToEvent(t,e){return Ct((()=>new be("This device does not support GNP commands.",Kt.FEATURE_NOT_SUPPORTED)))}sendEvent(t,e,n){throw new be("This device does not support GNP commands.",Kt.FEATURE_NOT_SUPPORTED)}read(t,e,n){return Ct((()=>new be("This device does not support GNP commands.",Kt.FEATURE_NOT_SUPPORTED)))}readWithParams(t,e,n,r){return Ct((()=>new be("This device does not support GNP commands.",Kt.FEATURE_NOT_SUPPORTED)))}write(t,e,n,r){return Ct((()=>new be("This device does not support GNP commands.",Kt.FEATURE_NOT_SUPPORTED)))}}class _n{constructor(t){this.transportId=t,this.isChild=false;}equals(t){return this.isChild===t.isChild&&this.transportId===t.transportId}toString(){return this.transportId}}class mn{constructor(t,e){this.parentId=t,this.gnpAddress=e,this.isChild=true,this.transportId=t.transportId;}equals(t){if(this.isChild===t.isChild){const e=t;return this.parentId.equals(e.parentId)&&this.gnpAddress===e.gnpAddress}return false}toString(){return `0x${t=this.gnpAddress,t.toString(16).padStart(2,"0").toUpperCase()}@${this.transportId}`;var t;}}var bn,yn,On;!function(t){t.NO_TRACKING="no-tracking",t.TRACK_ERRORS="track-errors",t.TRACK_USAGE="track-usage",t.TRACK_ALL="track-all";}(bn||(bn={})),function(t){t[t.BLUETOOTH=0]="BLUETOOTH",t[t.INDIRECT=1]="INDIRECT",t[t.USB=2]="USB";}(yn||(yn={})),function(t){t[t.BASE=0]="BASE",t[t.HEADSET=1]="HEADSET",t[t.DESKSTAND=2]="DESKSTAND",t[t.OTHER=3]="OTHER",t[t.DONGLE=4]="DONGLE",t[t.PC=5]="PC",t[t.EHS=6]="EHS",t[t.USB=7]="USB",t[t.SPEAKER_PHONE=8]="SPEAKER_PHONE",t[t.INDICATOR=9]="INDICATOR",t[t.MOBILE=10]="MOBILE",t[t.NONE=11]="NONE",t[t.LOCAL=12]="LOCAL",t[t.DISPLAY=13]="DISPLAY",t[t.HS_CRADLE=14]="HS_CRADLE",t[t.HS_CRADLE2=15]="HS_CRADLE2",t[t.MOBILE_IAP=16]="MOBILE_IAP",t[t.CRADLE=17]="CRADLE",t[t.VIDEO=18]="VIDEO",t[t.NOT_GN=252]="NOT_GN",t[t.ANY_GN=253]="ANY_GN",t[t.NOT_INIT=254]="NOT_INIT",t[t.ANY=255]="ANY";}(On||(On={}));class wn{constructor(t,e,n,r,i,o,s,a,c,u,l){this.id=t,this.type=e,this.hidChannel=n,this.events=r,this.primaryAddress=i,this.sendEvent=o,this.read=s,this.readWithParams=a,this.write=c,this.onDisconnect=u,this.parentConnectionId=l,this.onDisconnect.subscribe({error:w});}static createConnection(t,e,n,r,i,o){const s=r.sendEvent.bind(r),a=r.read.bind(r),c=r.readWithParams.bind(r),u=r.write.bind(r);return new wn(t,e,n,r.events,r.primaryAddress,s,a,c,u,i,o)}}const Nn=(t=3,e=500)=>n=>n.pipe(Pt(((n,r)=>{const i=r+1;return i>t?Ct((()=>n)):Ft(i*i*e)})));function Cn(t,e,n,r=1e3,i=3,o=100){return Gt((()=>t.read(e,n,r))).pipe(he(Nn(i,o)))}function Tn(t,e,n){const{deviceType:r,address:i}=n;return {transportId:e.transportId,vid:e.vid,pid:Cn(t,Ve,i),name:Cn(t,Ye,i),serialNumber:Cn(t,$e,i),capabilities:e.capabilities,deviceType:r,connectionGnpAddress:i}}class Sn{constructor(t,e,n=Tn,r=wn.createConnection,i=En){this.parentConnection=e,this.connectionCreator=r,this.createChildGnpChannel=i;const o=e.events.pipe(Jt((t=>t.command===ke.DEVICE&&t.subCommand===xe.ATTACH_EVENT)),Lt((t=>({deviceType:t.payload[0],address:t.payload[1]})))).pipe(Lt(n.bind(null,e,t)));this.connectionEvents=o.pipe(Lt((t=>{const n=Xt(e.events.pipe(ue((e=>e.command===ke.DEVICE&&e.subCommand===xe.DETACH_EVENT&&e.payload[1]===t.connectionGnpAddress)),Lt(w)),e.onDisconnect);return {attach:t,detach:n}})),Pt((t=>te(Nt(t.attach),this.createConnection(t.attach,t.detach)))),Lt((([t,e])=>({event:t,connection:e}))),_e(e.onDisconnect)),e.sendEvent(Be,[]);}createConnection(t,e){const n=t.connectionGnpAddress,r=this.createChildGnpChannel(this.parentConnection,n),i=new mn(this.parentConnection.id,n);return Nt(this.connectionCreator(i,yn.INDIRECT,this.parentConnection.hidChannel,r,e,this.parentConnection.id))}}const An={command:ke.IDENT,subCommand:xe.TYPE,deserialize:t=>{const{payload:e}=t,n=e[0];if(n<1||n>=e.length)throw new be("Cannot get device type.",Kt.DEVICE_ERROR);return e[1]}};function In(t,e,n,r=Bt.ERROR,i=Wt.JS_LIB){const o=`${t} ${function(t){if(t instanceof be){const e=t;return `JabraError: ${e.message} (type: ${e.type})`}if(t instanceof Error){const e=t;return `Error: ${e.message} (name: ${e.name})`}return `Unknown error: ${t}`}(e)}`;ye(o,n,r,i);}function Rn(t){return new Sn(t.event,t.connection).connectionEvents}class Dn{constructor(t,e,n=((t,e,n)=>new rn(t,e,n)),r=vn,i=Rn,o=wn.createConnection){this.transport=t,this.logger=e,this.createHidChannel=n,this.createRootGnpChannel=r,this.connectionCreator=o;const s=this.transport.consoleAppEvent.pipe(Jt((t=>"attach"===t.event)),Lt(Dn.createAttachEvent),ee(((t,e)=>(In("",t,this.logger),e)))).pipe(Lt((t=>{const e=this.transport.consoleAppEvent.pipe(Jt((t=>"detach"===t.event)),ue((e=>Dn.getTransportId(e)===t.transportId)),Lt(w),fe());return e.subscribe(),{attach:t,detach:e}})),Pt((t=>this.createConnection(t.attach,t.detach))),de()),a=s.pipe(Jt((t=>t.event.deviceType===On.DONGLE)),Jt((t=>pn.supportsGnpOverHid(t.connection.hidChannel))),Pt((t=>i(t))));this.connectionEvents=Mt(s,a).pipe(de());}static convertToReportType(t){switch(t){case "input":return Qe.INPUT;case "output":return Qe.OUTPUT;case "feature":return Qe.FEATURE;default:throw new be(`${t} is not a valid ReportType`,Kt.UNEXPECTED_ERROR)}}static convertToValueType(t){switch(t){case "absolute":return Je.ABSOLUTE;case "relative":return Je.RELATIVE;default:throw new be(`${t} Not a valid ValueType`,Kt.UNEXPECTED_ERROR)}}static createDescriptor(t){return t.map((t=>({reportType:Dn.convertToReportType(t.reportType),usagePage:t.usagePage,usage:t.usage,valueType:Dn.convertToValueType(t.valueType),reportSize:t.reportSize})))}static getMandatoryField(t,e){const n=t[e];if(void 0===n)throw new be(`JSON event lacks required field "${e}: ${JSON.stringify(t)}`,Kt.UNEXPECTED_ERROR);return n}static getTransportId(t){return Dn.getMandatoryField(t,"id")}static createAttachEvent(t){return {transportId:Dn.getTransportId(t),vid:Dn.getMandatoryField(t,"vid"),pid:Nt(Dn.getMandatoryField(t,"pid")),name:Nt(Dn.getMandatoryField(t,"name")),serialNumber:Nt(Dn.getMandatoryField(t,"serialNumber")),capabilities:Dn.createDescriptor(Dn.getMandatoryField(t,"descriptor"))}}createConnection(t,e,n=3,r=100){const{capabilities:i,transportId:o}=t,s=new _n(o),a=this.createHidChannel(s,i,this.transport),c=this.createRootGnpChannel(a,this.transport,o,e).pipe(ee(((t,e)=>(t.type&&t.type===Kt.DEVICE_ERROR&&this.transport.context===Vt.WEB_HID&&ye("Child devices are not yet supported when using WebHID.",this.logger,Bt.WARNING,Wt.JS_LIB),Nt(new gn)))),de()),u=c.pipe(Pt((t=>t.read(An))),he(Nn(n,r)),ee((t=>Nt(On.ANY))));return te(c,u).pipe(_e(e),Lt((([n,r])=>({event:Object.assign(Object.assign({},t),{deviceType:r,connectionGnpAddress:n.primaryAddress}),connection:this.connectionCreator(s,yn.USB,a,n,e)}))))}}var Hn,Ln,Pn,Un,kn;class xn{constructor(t,e,n,r,i,o){this.vendorId=t,this.productId=e,this.serialNumber=n,this.name=r,this.type=i,Ln.set(this,void 0),h$1(this,Ln,new we(o,l$1(xn,Hn,"m",Un))),this.connectionAdded=l$1(this,Ln,"f").itemAdded,this.connectionRemoved=l$1(this,Ln,"f").itemRemoved,this.connectionList=l$1(this,Ln,"f").itemList,this.onDisconnect=l$1(this,Ln,"f").itemList.pipe(ve(1),ue((t=>0===t.length)),Lt(w),de());}get id(){return en(this.vendorId,this.productId,this.serialNumber)}get currentConnections(){return l$1(this,Ln,"f").getValue()}get browserLabel(){return `${this.vendorId.toString(16).padStart(4,"0")}:${this.productId.toString(16).padStart(4,"0")}`}}Hn=xn,Ln=new WeakMap,Un=function(t,e){return l$1(xn,Hn,"f",Pn).indexOf(t.type)-l$1(xn,Hn,"f",Pn).indexOf(e.type)},Pn={value:[yn.USB,yn.INDIRECT,yn.BLUETOOTH]};class Gn{constructor(t){this.deviceObservables=new we(t);}static exceptionToUndefined(t){try{return t()}catch(t){if(t instanceof be)return;throw t}}connectionExists(t){return void 0!==Gn.exceptionToUndefined((()=>this.findConnectionById(t)))}findConnectionById(t){for(const e of this.deviceObservables.getValue())for(const n of e.currentConnections)if(n.id.equals(t))return n;throw new be(`Could not find connection with id ${t.toString()}`,Kt.UNEXPECTED_ERROR)}findDeviceByDeviceId(t){return this.deviceObservables.getValue().find((e=>e.id.startsWith(t)||t.startsWith(e.id)))}}class Fn{constructor(t,e){this.logger=e;const[n,r]=(i=t.pipe(Jt((t=>!this.deviceCollection.connectionExists(t.connection.id))),ne((t=>this.force(t)))),[Jt(o=({event:t,pid:e,serialNumber:n})=>!this.deviceCollection.findDeviceByDeviceId(en(t.event.vid,e,n)),s)(Et(i)),Jt(Qt(o,s))(Et(i))]);var i,o,s;const a=n.pipe(Lt((t=>Fn.createDevice(t,r))));this.deviceCollection=new Gn(a),this.deviceObservables=this.deviceCollection.deviceObservables;}force(t){const{name:e,pid:n,serialNumber:r}=t.event,i=t.connection.onDisconnect.pipe((a=Ct((()=>new Error(`Connection with ID ${t.connection.id} disconnected`))),d$2(c)?ne((function(){return a}),c):ne((function(){return a}))));var a,c;return te(e,n,r).pipe(Lt((([e,n,r])=>({event:t,name:e,pid:n,serialNumber:r}))),function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.length?M$1((function(e,n){Zt(s([e],o(t)))(n);})):k$1}(i),ee((t=>(ye(`Failed to retrieve child connection information. Error: ${t}`,this.logger,Bt.WARNING,Wt.JS_LIB),et))))}static createDevice(t,e){const{event:n,pid:r,name:i,serialNumber:o}=t,{vid:s,deviceType:a}=n.event,c=e.pipe(Jt((e=>Fn.isSameDevice(t,e))),Lt((t=>t.event.connection))),u=xt(Nt(n.connection),c);return new xn(s,r,o,i,a,u)}static isSameDevice(t,e){const n=en(t.event.event.vid,t.pid,t.serialNumber),r=en(e.event.event.vid,e.pid,e.serialNumber);return n.startsWith(r)||r.startsWith(n)}static create(t,e){const n=new Dn(t,e);return new Fn(n.connectionEvents)}}function Mn(t){var e,r,i;return n(this,void 0,void 0,(function*(){const n=null==t?void 0:t.logger;ye("Jabra SDK JS starting up...",n,Bt.INFO);const o=new Re(t);o.validateOrganizationKey(),o.validateAppId(),o.validateAppName();const s=null!==(r=null===(e=null==t?void 0:t.internal)||void 0===e?void 0:e.testDeviceTransport)&&void 0!==r?r:yield Se(n,null==t?void 0:t.transport,null===(i=null==t?void 0:t.internal)||void 0===i?void 0:i.recorder);new Ae(s,n);const a=Fn.create(s,n),c=new Ce(a,s,t);return yield s.connect(),c}))}class Bn{constructor(t,e,n,r){this.deviceId=t,this.usagePage=e,this.usage=n,this.value=r;}}class Wn{constructor(t,e){this.token=t,this.value=e;}}!function(t){t.UsageReport=class{constructor(t,e){this.usage=t,this.value=e;}};}(kn||(kn={}));var Kn,Yn,Vn,jn,qn,$n,zn,Qn,Jn,Xn,Zn=ze((function(t){!function(e){var n=function(t,e,n){if(!(t instanceof ArrayBuffer||"undefined"!=typeof Buffer$1&&t instanceof Buffer$1))throw new Error("Must specify a valid ArrayBuffer or Buffer.");e=e||0,n=n||t.byteLength||t.length,this._view=new Uint8Array(t.buffer||t,e,n),this.bigEndian=false;};n._scratch=new DataView(new ArrayBuffer(8)),Object.defineProperty(n.prototype,"buffer",{get:function(){return "undefined"!=typeof Buffer$1?Buffer$1.from(this._view.buffer):this._view.buffer},enumerable:true,configurable:false}),Object.defineProperty(n.prototype,"byteLength",{get:function(){return this._view.length},enumerable:true,configurable:false}),n.prototype._setBit=function(t,e){e?this._view[t>>3]|=1<<(7&t):this._view[t>>3]&=~(1<<(7&t));},n.prototype.getBits=function(t,e,n){var r=8*this._view.length-t;if(e>r)throw new Error("Cannot get "+e+" bit(s) from offset "+t+", "+r+" available");for(var i=0,o=0;o<e;){var s=e-o,a=7&t,c=this._view[t>>3],u=Math.min(s,8-a);this.bigEndian?(i<<=u,i|=c>>8-u-a&~(255<<u)):i|=(c>>a&~(255<<u))<<o,t+=u,o+=u;}return n?(32!==e&&i&1<<e-1&&(i|=-1^(1<<e)-1),i):i>>>0},n.prototype.setBits=function(t,e,n){var r=8*this._view.length-t;if(n>r)throw new Error("Cannot set "+n+" bit(s) from offset "+t+", "+r+" available");for(var i=0;i<n;){var o,s,a,c=n-i,u=7&t,l=t>>3,h=Math.min(c,8-u);if(this.bigEndian){s=e>>n-i-h&(o=~(-1<<h));var d=8-u-h;a=~(o<<d),this._view[l]=this._view[l]&a|s<<d;}else s=e&(o=~(255<<h)),e>>=h,a=~(o<<u),this._view[l]=this._view[l]&a|s<<u;t+=h,i+=h;}},n.prototype.getBoolean=function(t){return 0!==this.getBits(t,1,false)},n.prototype.getInt8=function(t){return this.getBits(t,8,true)},n.prototype.getUint8=function(t){return this.getBits(t,8,false)},n.prototype.getInt16=function(t){return this.getBits(t,16,true)},n.prototype.getUint16=function(t){return this.getBits(t,16,false)},n.prototype.getInt32=function(t){return this.getBits(t,32,true)},n.prototype.getUint32=function(t){return this.getBits(t,32,false)},n.prototype.getFloat32=function(t){return n._scratch.setUint32(0,this.getUint32(t)),n._scratch.getFloat32(0)},n.prototype.getFloat64=function(t){return n._scratch.setUint32(0,this.getUint32(t)),n._scratch.setUint32(4,this.getUint32(t+32)),n._scratch.getFloat64(0)},n.prototype.setBoolean=function(t,e){this.setBits(t,e?1:0,1);},n.prototype.setInt8=n.prototype.setUint8=function(t,e){this.setBits(t,e,8);},n.prototype.setInt16=n.prototype.setUint16=function(t,e){this.setBits(t,e,16);},n.prototype.setInt32=n.prototype.setUint32=function(t,e){this.setBits(t,e,32);},n.prototype.setFloat32=function(t,e){n._scratch.setFloat32(0,e),this.setBits(t,n._scratch.getUint32(0),32);},n.prototype.setFloat64=function(t,e){n._scratch.setFloat64(0,e),this.setBits(t,n._scratch.getUint32(0),32),this.setBits(t+32,n._scratch.getUint32(4),32);},n.prototype.getArrayBuffer=function(t,e){for(var n=new Uint8Array(e),r=0;r<e;r++)n[r]=this.getUint8(t+8*r);return n};var r=function(t,e){return function(){if(this._index+e>this._length)throw new Error("Trying to read past the end of the stream");var n=this._view[t](this._index);return this._index+=e,n}},i=function(t,e){return function(n){this._view[t](this._index,n),this._index+=e;}};function o(t,e,n){if(0===e)return "";var r=0,i=[],o=true,s=!!e;for(e||(e=Math.floor((t._length-t._index)/8));r<e;){var a=t.readUint8();if(0===a&&(o=false,!s))break;o&&i.push(a),r++;}var c=String.fromCharCode.apply(null,i);if(!n)return c;try{return decodeURIComponent(escape(c))}catch(t){return c}}var s=function(t,e,r){var i=t instanceof ArrayBuffer||"undefined"!=typeof Buffer$1&&t instanceof Buffer$1;if(!(t instanceof n||i))throw new Error("Must specify a valid BitView, ArrayBuffer or Buffer");this._view=i?new n(t,e,r):t,this._index=0,this._startIndex=0,this._length=8*this._view.byteLength;};Object.defineProperty(s.prototype,"index",{get:function(){return this._index-this._startIndex},set:function(t){this._index=t+this._startIndex;},enumerable:true,configurable:true}),Object.defineProperty(s.prototype,"length",{get:function(){return this._length-this._startIndex},set:function(t){this._length=t+this._startIndex;},enumerable:true,configurable:true}),Object.defineProperty(s.prototype,"bitsLeft",{get:function(){return this._length-this._index},enumerable:true,configurable:true}),Object.defineProperty(s.prototype,"byteIndex",{get:function(){return Math.ceil(this._index/8)},set:function(t){this._index=8*t;},enumerable:true,configurable:true}),Object.defineProperty(s.prototype,"buffer",{get:function(){return this._view.buffer},enumerable:true,configurable:false}),Object.defineProperty(s.prototype,"view",{get:function(){return this._view},enumerable:true,configurable:false}),Object.defineProperty(s.prototype,"bigEndian",{get:function(){return this._view.bigEndian},set:function(t){this._view.bigEndian=t;},enumerable:true,configurable:false}),s.prototype.readBits=function(t,e){var n=this._view.getBits(this._index,t,e);return this._index+=t,n},s.prototype.writeBits=function(t,e){this._view.setBits(this._index,t,e),this._index+=e;},s.prototype.readBoolean=r("getBoolean",1),s.prototype.readInt8=r("getInt8",8),s.prototype.readUint8=r("getUint8",8),s.prototype.readInt16=r("getInt16",16),s.prototype.readUint16=r("getUint16",16),s.prototype.readInt32=r("getInt32",32),s.prototype.readUint32=r("getUint32",32),s.prototype.readFloat32=r("getFloat32",32),s.prototype.readFloat64=r("getFloat64",64),s.prototype.writeBoolean=i("setBoolean",1),s.prototype.writeInt8=i("setInt8",8),s.prototype.writeUint8=i("setUint8",8),s.prototype.writeInt16=i("setInt16",16),s.prototype.writeUint16=i("setUint16",16),s.prototype.writeInt32=i("setInt32",32),s.prototype.writeUint32=i("setUint32",32),s.prototype.writeFloat32=i("setFloat32",32),s.prototype.writeFloat64=i("setFloat64",64),s.prototype.readASCIIString=function(t){return function(t,e){return o(t,e,false)}(this,t)},s.prototype.readUTF8String=function(t){return function(t,e){return o(t,e,true)}(this,t)},s.prototype.writeASCIIString=function(t,e){!function(t,e,n){for(var r=n||e.length+1,i=0;i<r;i++)t.writeUint8(i<e.length?e.charCodeAt(i):0);}(this,t,e);},s.prototype.writeUTF8String=function(t,e){!function(t,e,n){for(var r=function(t){var e,n,r=[];for(e=0;e<t.length;e++)(n=t.charCodeAt(e))<=127?r.push(n):n<=2047?(r.push(n>>6|192),r.push(63&n|128)):n<=65535?(r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)):(r.push(n>>18|240),r.push(n>>12&63|128),r.push(n>>6&63|128),r.push(63&n|128));return r}(e),i=n||r.length+1,o=0;o<i;o++)t.writeUint8(o<r.length?r[o]:0);}(this,t,e);},s.prototype.readBitStream=function(t){var e=new s(this._view);return e._startIndex=this._index,e._index=this._index,e.length=t,this._index+=t,e},s.prototype.writeBitStream=function(t,e){var n;for(e||(e=t.bitsLeft);e>0;)n=Math.min(e,32),this.writeBits(t.readBits(n),n),e-=n;},s.prototype.readArrayBuffer=function(t){var e=this._view.getArrayBuffer(this._index,t);return this._index+=8*t,e},s.prototype.writeArrayBuffer=function(t,e){this.writeBitStream(new s(t),8*e);},t.exports&&(t.exports={BitView:n,BitStream:s});}();}));function tr(){return n(this,void 0,void 0,(function*(){const{hid:t}=window.navigator;if(!t)throw new be("WebHID not supported",Kt.INIT_ERROR);const e=yield t.requestDevice({filters:[{vendorId:Kn.VENDOR_ID}]});return new BroadcastChannel(Kn.PAIRING_CHANNEL).postMessage(null),e}))}!function(t){t[t.VENDOR_ID=2830]="VENDOR_ID",t.PAIRING_CHANNEL="jabra-webhid-pairing-channel";}(Kn||(Kn={})),function(t){t[t.HOOK_SWITCH=32]="HOOK_SWITCH",t[t.GN_PSEUDO_HOOK_SWITCH=65531]="GN_PSEUDO_HOOK_SWITCH",t[t.FLASH=33]="FLASH",t[t.ALT_HOLD=35]="ALT_HOLD",t[t.REDIAL=36]="REDIAL",t[t.ONLINE=42]="ONLINE",t[t.SPEAKER_PHONE=43]="SPEAKER_PHONE",t[t.PHONE_MUTE=47]="PHONE_MUTE",t[t.SEND=49]="SEND",t[t.SPEED_DIAL=80]="SPEED_DIAL",t[t.VOICE_MAIL=112]="VOICE_MAIL",t[t.ANSWER_ON_OFF=116]="ANSWER_ON_OFF",t[t.LINE_BUSY=151]="LINE_BUSY",t[t.RINGER=158]="RINGER",t[t.PHONE_KEY_0=176]="PHONE_KEY_0",t[t.PHONE_KEY_1=177]="PHONE_KEY_1",t[t.PHONE_KEY_2=178]="PHONE_KEY_2",t[t.PHONE_KEY_3=179]="PHONE_KEY_3",t[t.PHONE_KEY_4=180]="PHONE_KEY_4",t[t.PHONE_KEY_5=181]="PHONE_KEY_5",t[t.PHONE_KEY_6=182]="PHONE_KEY_6",t[t.PHONE_KEY_7=183]="PHONE_KEY_7",t[t.PHONE_KEY_8=184]="PHONE_KEY_8",t[t.PHONE_KEY_9=185]="PHONE_KEY_9",t[t.PHONE_KEY_STAR=186]="PHONE_KEY_STAR",t[t.PHONE_KEY_POUND=187]="PHONE_KEY_POUND",t[t.ALT_VOLUME_UP=233]="ALT_VOLUME_UP",t[t.ALT_VOLUME_DOWN=234]="ALT_VOLUME_DOWN",t[t.REJECT_CALL=65533]="REJECT_CALL";}(Yn||(Yn={}));class er{constructor(t,e,n){this.type=t,this.value=e,this.valueType=n;}toString(){return void 0===Yn[this.type]?`Unknown signal: type: ${this.type}, value: ${this.value}, valueType: ${this.valueType}`:`Signal: type: ${Yn[this.type]}, value: ${this.value}, valueType: ${this.valueType}`}}!function(t){t[t.BUTTON=9]="BUTTON",t[t.CONSUMER=12]="CONSUMER",t[t.LED=8]="LED",t[t.TELEPHONY=11]="TELEPHONY",t[t.GN_CONSUMER=65312]="GN_CONSUMER",t[t.GN_EXT_BUTTONS=65360]="GN_EXT_BUTTONS",t[t.GN_LED=65344]="GN_LED",t[t.GN_MISC=65376]="GN_MISC",t[t.GN_TELEPHONY=65328]="GN_TELEPHONY";}(Vn||(Vn={})),function(t){t[t.MUTE=9]="MUTE",t[t.OFF_HOOK=23]="OFF_HOOK",t[t.RING=24]="RING",t[t.MESSAGE_WAIT=25]="MESSAGE_WAIT",t[t.HOLD=32]="HOLD",t[t.MIC_MUTE=33]="MIC_MUTE",t[t.ONLINE=42]="ONLINE",t[t.HID_OFFLINE=43]="HID_OFFLINE";}(jn||(jn={})),function(t){t[t.HOOK_SWITCH=32]="HOOK_SWITCH",t[t.FLASH=33]="FLASH",t[t.HOLD=35]="HOLD",t[t.REDIAL=36]="REDIAL",t[t.ONLINE=42]="ONLINE",t[t.SPEAKER_PHONE=43]="SPEAKER_PHONE",t[t.MUTE=47]="MUTE",t[t.HID_SEND=49]="HID_SEND",t[t.SPEED_DIAL=80]="SPEED_DIAL",t[t.VOICE_MAIL=112]="VOICE_MAIL",t[t.ANSWER_ON_OFF=116]="ANSWER_ON_OFF",t[t.LINE_BUSY=151]="LINE_BUSY",t[t.RINGER=158]="RINGER",t[t.PHONE_KEY_0=176]="PHONE_KEY_0",t[t.PHONE_KEY_1=177]="PHONE_KEY_1",t[t.PHONE_KEY_2=178]="PHONE_KEY_2",t[t.PHONE_KEY_3=179]="PHONE_KEY_3",t[t.PHONE_KEY_4=180]="PHONE_KEY_4",t[t.PHONE_KEY_5=181]="PHONE_KEY_5",t[t.PHONE_KEY_6=182]="PHONE_KEY_6",t[t.PHONE_KEY_7=183]="PHONE_KEY_7",t[t.PHONE_KEY_8=184]="PHONE_KEY_8",t[t.PHONE_KEY_9=185]="PHONE_KEY_9",t[t.PHONE_KEY_STAR=186]="PHONE_KEY_STAR",t[t.PHONE_KEY_POUND=187]="PHONE_KEY_POUND",t[t.HID_ALT_VOLUME_UP=233]="HID_ALT_VOLUME_UP",t[t.HID_ALT_VOLUME_DOWN=234]="HID_ALT_VOLUME_DOWN",t[t.GN_PSEUDO_HOOK_SWITCH=65531]="GN_PSEUDO_HOOK_SWITCH",t[t.GN_OUT_OF_RANGE=65532]="GN_OUT_OF_RANGE",t[t.GN_REJECT_CALL=65533]="GN_REJECT_CALL",t[t.GN_TELEPHONY_CONT_SET=65535]="GN_TELEPHONY_CONT_SET";}(qn||(qn={}));class nr{constructor(t,e,n,r,i){this.hidChannel=t,this.onDisconnect=e,this.isSoftphoneInFocus=n,this.lockHeld=r,this.logger=i,this.cachedSignals=new Map;}setup(){const t=this.filter().pipe(de());return t.subscribe(),t}filter(){const t=this.hidChannel.input.pipe(Jt((t=>t.usagePage===Vn.GN_TELEPHONY&&!t.isArray())),Pt((t=>{const e=this.hidChannel.findDescriptor(t.usagePage,t.usage,Qe.INPUT);return (null==e?void 0:e.valueType)?Nt(Object.assign(Object.assign({},t),{valueType:e.valueType})):(In("",new be(`Unable to find value-type in descriptor for UsagePage: ${t.usagePage} and Usage: ${t.usage}`,Kt.FEATURE_NOT_SUPPORTED),this.logger),et)})),Jt((t=>{if(t.valueType===Je.RELATIVE)return Boolean(t.value);return this.cachedSignals.get(t.usage)!==t.value})),me((t=>{this.cachedSignals.set(t.usage,t.value);})),_e(this.onDisconnect),de()),e=[Yn.HOOK_SWITCH,Yn.REDIAL],n=t.pipe(on(this.isSoftphoneInFocus),Jt((t=>e.includes(t.usage)&&!this.lockHeld.getValue())));return Mt(t.pipe(Jt((t=>this.lockHeld.getValue()))),n).pipe(Lt((t=>new er(t.usage,0!==t.value,t.valueType))),ee((t=>(ye(t.message,this.logger),et))))}}class rr{constructor(t,e,n,r,i,o){this.device=t,this.onDisconnect=n,$n.set(this,void 0),zn.set(this,new j(false)),Qn.set(this,void 0),Jn.set(this,false),this.deviceSignals=new Y,h$1(this,$n,r),l$1(this,$n,"f").lockHeld.subscribe(l$1(this,zn,"f")),h$1(this,Qn,e),this.onDisconnect.pipe(ue(),Lt((()=>true))).subscribe((t=>{h$1(this,Jn,t);}));const s=new nr(l$1(this,Qn,"f"),this.onDisconnect,i,l$1(this,zn,"f"),o);this.deviceSignals=s.setup();}checkCallLockHeld(t){if(!l$1(this,zn,"f").getValue())throw new be(t,Kt.SDK_USAGE_ERROR)}checkCallLockNotHeld(t){if(l$1(this,zn,"f").getValue())throw new be(t,Kt.SDK_USAGE_ERROR)}checkHasDisconnected(){if(l$1(this,Jn,"f"))throw new be("CallControl cannot be performed as the connection has disconnected.",Kt.SDK_USAGE_ERROR)}takeCallLock(){return this.checkHasDisconnected(),this.checkCallLockNotHeld("Trying to take the call lock, but it is already held!"),St(l$1(this,$n,"f").tryTakeCallLock())}releaseCallLock(){this.checkHasDisconnected(),this.checkCallLockHeld("Trying to release the call lock, but it is not held!"),l$1(this,$n,"f").releaseCallLock();}offHook(t){this.checkHasDisconnected(),this.checkCallLockHeld("Calls can only be started and stopped when the call lock is held.");const e=l$1(this,Qn,"f").findDescriptor(Vn.GN_LED,jn.OFF_HOOK,Qe.OUTPUT);if(!e)throw new be(`Device ${this.device.name} does not support any offHook functionality.`,Kt.FEATURE_NOT_SUPPORTED);const n=t?1:0;l$1(this,Qn,"f").output(e.usagePage,e.usage,n);}ring(t){this.checkHasDisconnected(),this.checkCallLockHeld("The ringer state can only be modified when the call lock is held.");const e=l$1(this,Qn,"f").findDescriptor(Vn.GN_LED,jn.RING,Qe.OUTPUT),n=l$1(this,Qn,"f").findDescriptor(Vn.GN_TELEPHONY,qn.RINGER,Qe.OUTPUT);if(!e&&!n)throw new be(`Device ${this.device.name} does not support any ring functionality.`,Kt.FEATURE_NOT_SUPPORTED);if(n){const e=t?1:0;l$1(this,Qn,"f").output(n.usagePage,n.usage,e);}if(e){const n=t?1:0;l$1(this,Qn,"f").output(e.usagePage,e.usage,n);}}mute(t){this.checkHasDisconnected(),this.checkCallLockHeld("The mute state can only be modified when the call lock is held.");let e=l$1(this,Qn,"f").findDescriptor(Vn.GN_LED,jn.MIC_MUTE,Qe.OUTPUT);if(e||(e=l$1(this,Qn,"f").findDescriptor(Vn.GN_LED,jn.MUTE,Qe.OUTPUT)),!e)throw new be(`Device ${this.device.name} does not support any mute functionality.`,Kt.FEATURE_NOT_SUPPORTED);const n=t?1:0;l$1(this,Qn,"f").output(e.usagePage,e.usage,n);}hold(t){this.checkHasDisconnected(),this.checkCallLockHeld("The hold state can only be modified when the call lock is held.");const e=l$1(this,Qn,"f").findDescriptor(Vn.GN_LED,jn.HOLD,Qe.OUTPUT);if(!e)throw new be(`Device ${this.device.name} does not support hold functionality.`,Kt.FEATURE_NOT_SUPPORTED);const n=t?1:0;l$1(this,Qn,"f").output(e.usagePage,e.usage,n);}}$n=new WeakMap,zn=new WeakMap,Qn=new WeakMap,Jn=new WeakMap,function(t){t[t.STD_TELEPHONY=0]="STD_TELEPHONY",t[t.GN_TELEPHONY=1]="GN_TELEPHONY";}(Xn||(Xn={}));const ir={[De.SKYPE]:Xn.GN_TELEPHONY,[De.CISCO]:Xn.GN_TELEPHONY,[De.AVAYA]:Xn.GN_TELEPHONY,[De.SIEMENS]:Xn.GN_TELEPHONY,[De.IBM]:Xn.GN_TELEPHONY,[De.AASTRA]:Xn.GN_TELEPHONY,[De.JABRA]:Xn.GN_TELEPHONY,[De.NEC]:Xn.GN_TELEPHONY,[De.SHORETEL]:Xn.GN_TELEPHONY,[De.MS_OC]:Xn.STD_TELEPHONY,[De.ALCATEL]:Xn.STD_TELEPHONY,[De.OTHER]:Xn.STD_TELEPHONY,[De.NORTEL]:null,[De.GENERIC]:null};function or(t,e){const n=t.read(je).pipe(Lt((t=>ir[t]===e))),r=t.read(new Ke).pipe(Lt((t=>t.find((t=>ir[t]===e))))).pipe(Lt((e=>e?t.write(je,e):Nt(false))),ge());return n.pipe((i=Nt(true),o=r,t=>t.pipe(Lt((t=>t?i:o)),ge())));var i,o;}class sr{constructor(t,e,n){this.connectionCallLock=t,this.device=e,this.logger=n,this.lockHeld=new j(false),this.currentLocks=new j(new Set),this.lockReleaseEvent=new Y;}tryTakeCallLock(){const{currentConnections:t}=this.device,e=new Set,n=Gt((()=>wt(t).pipe(ne((t=>this.takeSingleCallLock(t).pipe(ee((t=>(In("DeviceCallLock:",t,this.logger),Nt(""))))))),me((t=>e.add(t)))))).pipe(function(t,e){var n=arguments.length>=2;return function(r){return r.pipe(k$1,le(1),n?re(e):ae((function(){return new Tt})))}}(),Lt((n=>(e.delete(""),this.currentLocks.next(e),e.size!==t.length?(this.releaseCallLock(),false):(this.lockHeld.next(true),true)))),fe());return n.subscribe((t=>{t&&(this.acquireLockOnNextConnectionEmit(),this.releaseLockOnRemovedConnectionEmit());})),n}acquireLockOnNextConnectionEmit(){this.device.connectionAdded.pipe(_e(this.lockReleaseEvent)).subscribe((t=>{this.takeSingleCallLock(t).pipe(_e(this.lockReleaseEvent),Lt((t=>(this.currentLocks.getValue().add(t),this.currentLocks.next(this.currentLocks.getValue()),w))),he(Nn())).subscribe({error:t=>{ye(`Failed to acquire the call lock on a new connection.\n Another softphone running an old SDK has most likely acquired this lock.\n Full error: ${t}`,this.logger,Bt.WARNING,Wt.JS_LIB);}});}));}releaseLockOnRemovedConnectionEmit(){this.device.connectionRemoved.pipe(_e(this.lockReleaseEvent)).subscribe((t=>this.releaseSingleCallLock(t.id.transportId)));}takeSingleCallLock(t){return Gt((()=>this.connectionCallLock.tryTakeCallLock(t.id.transportId))).pipe(Lt((e=>e.acquired?Nt(e.transportId):Ct((()=>new be(`Failed to acquire call lock on connection ${t.id.transportId}`,Kt.SDK_USAGE_ERROR))))),ge())}releaseCallLock(){this.lockReleaseEvent.next();[...this.currentLocks.getValue()].forEach((t=>{this.releaseSingleCallLock(t);})),this.currentLocks.getValue().clear(),this.currentLocks.next(this.currentLocks.getValue());}releaseSingleCallLock(t){this.connectionCallLock.releaseCallLock(t),this.currentLocks.getValue().delete(t),this.currentLocks.next(this.currentLocks.getValue()),0!==this.currentLocks.getValue().size&&0!==this.device.currentConnections.length||(this.lockReleaseEvent.next(),this.lockHeld.next(false));}}class ar{constructor(t){this.transport=t;}tryTakeCallLock(t){const e={action:"request-call-lock",id:t};return this.transport.writeAction(e),this.transport.consoleAppEvent.pipe(Jt((e=>"response-call-lock"===e.event&&e.id===t)),Lt((t=>({transportId:t.id,acquired:t.acquired}))),ue())}releaseCallLock(t){const e={action:"release-call-lock",id:t};this.transport.writeAction(e);}}const cr=[{usagePage:Vn.GN_LED,usage:jn.OFF_HOOK,reportType:Qe.OUTPUT},{usagePage:Vn.GN_LED,usage:jn.RING,reportType:Qe.OUTPUT},{usagePage:Vn.GN_TELEPHONY,usage:qn.RINGER,reportType:Qe.OUTPUT},{usagePage:Vn.GN_LED,usage:jn.MIC_MUTE,reportType:Qe.OUTPUT},{usagePage:Vn.GN_LED,usage:jn.MUTE,reportType:Qe.OUTPUT},{usagePage:Vn.GN_LED,usage:jn.HOLD,reportType:Qe.OUTPUT}],ur=[yn.USB,yn.INDIRECT,yn.BLUETOOTH];function lr(t,e){const{hidChannel:n}=t;return !!function(t){return cr.some((({usagePage:e,usage:n,reportType:r})=>t.findDescriptor(e,n,r)))}(n)&&(!pn.supportsGnpOverHid(n)||e!==On.DONGLE&&e!==On.OTHER)}function hr(t){const{currentConnections:e,type:n}=t;var r;return (r=e,[...r].sort(((t,e)=>ur.indexOf(t.type)-ur.indexOf(e.type)))).find((t=>lr(t,n)))}function dr(t,e,n,r,i){const o=hr(t),{hidChannel:s,onDisconnect:a}=o,c=new sr(new ar(r),t,i);if(e)return Nt(new rr(t,s,a,c,n.softphoneInFocus,i));if(r.context===Vt.WEB_HID)return Nt(new rr(t,s,a,c,n.softphoneInFocus,i));return function(t,e){return t.findDescriptor(Vn.GN_TELEPHONY,qn.GN_TELEPHONY_CONT_SET,Qe.FEATURE)?Gt((()=>(t.setFeatureReport(Vn.GN_TELEPHONY,qn.GN_TELEPHONY_CONT_SET,1),Nt(true)))):e?or(e,Xn.GN_TELEPHONY):Nt(false)}(s,o).pipe(Lt((e=>new rr(t,s,a,c,n.softphoneInFocus,i))))}class pr{constructor(t,e){this.devComm=t,this.softphoneInFocus=new G$1,this.softphoneInFocus=e.pipe(ue(),Pt((t=>this.devComm.consoleAppEvent.pipe(Jt((t=>"softphone-in-focus"===t.event)),Lt((t=>t.infocus)),function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=ot(t);return M$1((function(e,r){(n?xt(t,e,n):xt(t,e)).subscribe(r);}))}(!t),fe(1))))),this.softphoneInFocus.subscribe((()=>{}));}setSharedSoftphoneInfo(t){if(!(null==t?void 0:t.partnerKey)||!(null==t?void 0:t.appId))return void ye("Unable to register with Jabra Direct: partnerKey or appId missing in config",null==t?void 0:t.logger,Bt.WARNING);const e=t.partnerKey+t.appId,n=new Xe(5,"ns:OID",e);let{appName:r}=t;if((!t.appName||t.appName.length<3)&&(ye("App name missing in config. Fall back to use appId as app name.",null==t?void 0:t.logger,Bt.WARNING),r=t.appId),r.length>100)return void ye("Unable to register with Jabra Direct: appName must be below 100 characters.",null==t?void 0:t.logger,Bt.WARNING);const i={action:"set-softphone-info",name:r,id:n.toString()};this.devComm.writeAction(i);}}var fr,vr,Er,gr,_r,mr,br,yr;class Nr{constructor(t){var e;fr.set(this,void 0),vr.set(this,void 0),Er.set(this,void 0),gr.set(this,void 0),h$1(this,gr,t._readyEvents.pipe(ue((t=>"ready"===t.event)),Lt((t=>t.jabraDirectInstalled)))),h$1(this,vr,new pr(t._transport,l$1(this,gr,"f"))),l$1(this,vr,"f").setSharedSoftphoneInfo(t._config),h$1(this,fr,t._transport),h$1(this,Er,null===(e=t._config)||void 0===e?void 0:e.logger);}createCallControl(t){if(!this.supportsCallControl(t))return Promise.reject(new be(`Device ${t.name} does not support call control.`,Kt.FEATURE_NOT_SUPPORTED));return At(l$1(this,gr,"f").pipe(Pt((e=>dr(t,e,l$1(this,vr,"f"),l$1(this,fr,"f"),l$1(this,Er,"f"))))))}supportsCallControl(t){return void 0!==hr(t)}}fr=new WeakMap,vr=new WeakMap,Er=new WeakMap,gr=new WeakMap,function(t){t.HOLD_CURRENT="hold-current",t.END_CURRENT="end-current";}(_r||(_r={})),function(t){t.MUTED="muted",t.UNMUTED="unmuted",t.NO_ONGOING_CALLS="no-ongoing-calls";}(mr||(mr={})),function(t){t.ON_HOLD="on-hold",t.NOT_ON_HOLD="not-on-hold",t.NO_ONGOING_CALLS="no-ongoing-calls";}(br||(br={})),function(t){t.NO_INCOMING="no-incoming",t.AWAITING_RESPONSE="awaiting-response",t.RESOLVING_RESPONSE="resolving-response",t.ACCEPTED="accepted",t.REJECTED="rejected";}(yr||(yr={}));({muteState:mr.NO_ONGOING_CALLS,holdState:br.NO_ONGOING_CALLS,incomingCall:yr.NO_INCOMING});
|
|
68757
68742
|
|
|
68758
68743
|
var __awaiter$9 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
68759
68744
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
package/dist/manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "genesys-cloud-webrtc-sdk",
|
|
3
|
-
"version": "11.3.1-STREAM-913-snyk.
|
|
3
|
+
"version": "11.3.1-STREAM-913-snyk.5",
|
|
4
4
|
"description": "client for the interfacing with Genesys Cloud WebRTC",
|
|
5
5
|
"repository": "https://github.com/mypurecloud/genesys-cloud-webrtc-sdk",
|
|
6
6
|
"license": "MIT",
|