-
Notifications
You must be signed in to change notification settings - Fork 0
/
out.js
4394 lines (4392 loc) · 244 KB
/
out.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
(() => {
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
}) : x)(function(x) {
if (typeof require !== "undefined")
return require.apply(this, arguments);
throw new Error('Dynamic require of "' + x + '" is not supported');
});
var __commonJS = (cb, mod) => function __require2() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __reExport = (target, module, copyDefault, desc) => {
if (module && typeof module === "object" || typeof module === "function") {
for (let key of __getOwnPropNames(module))
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
__defProp(target, key, { get: () => module[key], enumerable: !(desc = __getOwnPropDesc(module, key)) || desc.enumerable });
}
return target;
};
var __toESM = (module, isNodeMode) => {
return __reExport(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, "default", !isNodeMode && module && module.__esModule ? { get: () => module.default, enumerable: true } : { value: module, enumerable: true })), module);
};
// node_modules/peerjs/dist/peerjs.min.js
var require_peerjs_min = __commonJS({
"node_modules/peerjs/dist/peerjs.min.js"(exports, module) {
parcelRequire = function(e, r, t, n) {
var i, o = typeof parcelRequire == "function" && parcelRequire, u = typeof __require == "function" && __require;
function f(t2, n2) {
if (!r[t2]) {
if (!e[t2]) {
var i2 = typeof parcelRequire == "function" && parcelRequire;
if (!n2 && i2)
return i2(t2, true);
if (o)
return o(t2, true);
if (u && typeof t2 == "string")
return u(t2);
var c2 = new Error("Cannot find module '" + t2 + "'");
throw c2.code = "MODULE_NOT_FOUND", c2;
}
p.resolve = function(r2) {
return e[t2][1][r2] || r2;
}, p.cache = {};
var l2 = r[t2] = new f.Module(t2);
e[t2][0].call(l2.exports, p, l2, l2.exports, this);
}
return r[t2].exports;
function p(e2) {
return f(p.resolve(e2));
}
}
f.isParcelRequire = true, f.Module = function(e2) {
this.id = e2, this.bundle = f, this.exports = {};
}, f.modules = e, f.cache = r, f.parent = o, f.register = function(r2, t2) {
e[r2] = [function(e2, r3) {
r3.exports = t2;
}, {}];
};
for (var c = 0; c < t.length; c++)
try {
f(t[c]);
} catch (e2) {
i || (i = e2);
}
if (t.length) {
var l = f(t[t.length - 1]);
typeof exports == "object" && typeof module != "undefined" ? module.exports = l : typeof define == "function" && define.amd ? define(function() {
return l;
}) : n && (this[n] = l);
}
if (parcelRequire = f, i)
throw i;
return f;
}({ "EgBh": [function(require2, module2, exports2) {
var e = {};
e.useBlobBuilder = function() {
try {
return new Blob([]), false;
} catch (e2) {
return true;
}
}(), e.useArrayBufferView = !e.useBlobBuilder && function() {
try {
return new Blob([new Uint8Array([])]).size === 0;
} catch (e2) {
return true;
}
}(), module2.exports.binaryFeatures = e;
var r = module2.exports.BlobBuilder;
function t() {
this._pieces = [], this._parts = [];
}
typeof window != "undefined" && (r = module2.exports.BlobBuilder = window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder || window.BlobBuilder), t.prototype.append = function(e2) {
typeof e2 == "number" ? this._pieces.push(e2) : (this.flush(), this._parts.push(e2));
}, t.prototype.flush = function() {
if (this._pieces.length > 0) {
var r2 = new Uint8Array(this._pieces);
e.useArrayBufferView || (r2 = r2.buffer), this._parts.push(r2), this._pieces = [];
}
}, t.prototype.getBuffer = function() {
if (this.flush(), e.useBlobBuilder) {
for (var t2 = new r(), i = 0, u = this._parts.length; i < u; i++)
t2.append(this._parts[i]);
return t2.getBlob();
}
return new Blob(this._parts);
}, module2.exports.BufferBuilder = t;
}, {}], "kdPp": [function(require2, module2, exports2) {
var t = require2("./bufferbuilder").BufferBuilder, e = require2("./bufferbuilder").binaryFeatures, i = { unpack: function(t2) {
return new r(t2).unpack();
}, pack: function(t2) {
var e2 = new n();
return e2.pack(t2), e2.getBuffer();
} };
function r(t2) {
this.index = 0, this.dataBuffer = t2, this.dataView = new Uint8Array(this.dataBuffer), this.length = this.dataBuffer.byteLength;
}
function n() {
this.bufferBuilder = new t();
}
function u(t2) {
var e2 = t2.charCodeAt(0);
return e2 <= 2047 ? "00" : e2 <= 65535 ? "000" : e2 <= 2097151 ? "0000" : e2 <= 67108863 ? "00000" : "000000";
}
function a(t2) {
return t2.length > 600 ? new Blob([t2]).size : t2.replace(/[^\u0000-\u007F]/g, u).length;
}
module2.exports = i, r.prototype.unpack = function() {
var t2, e2 = this.unpack_uint8();
if (e2 < 128)
return e2;
if ((224 ^ e2) < 32)
return (224 ^ e2) - 32;
if ((t2 = 160 ^ e2) <= 15)
return this.unpack_raw(t2);
if ((t2 = 176 ^ e2) <= 15)
return this.unpack_string(t2);
if ((t2 = 144 ^ e2) <= 15)
return this.unpack_array(t2);
if ((t2 = 128 ^ e2) <= 15)
return this.unpack_map(t2);
switch (e2) {
case 192:
return null;
case 193:
return;
case 194:
return false;
case 195:
return true;
case 202:
return this.unpack_float();
case 203:
return this.unpack_double();
case 204:
return this.unpack_uint8();
case 205:
return this.unpack_uint16();
case 206:
return this.unpack_uint32();
case 207:
return this.unpack_uint64();
case 208:
return this.unpack_int8();
case 209:
return this.unpack_int16();
case 210:
return this.unpack_int32();
case 211:
return this.unpack_int64();
case 212:
case 213:
case 214:
case 215:
return;
case 216:
return t2 = this.unpack_uint16(), this.unpack_string(t2);
case 217:
return t2 = this.unpack_uint32(), this.unpack_string(t2);
case 218:
return t2 = this.unpack_uint16(), this.unpack_raw(t2);
case 219:
return t2 = this.unpack_uint32(), this.unpack_raw(t2);
case 220:
return t2 = this.unpack_uint16(), this.unpack_array(t2);
case 221:
return t2 = this.unpack_uint32(), this.unpack_array(t2);
case 222:
return t2 = this.unpack_uint16(), this.unpack_map(t2);
case 223:
return t2 = this.unpack_uint32(), this.unpack_map(t2);
}
}, r.prototype.unpack_uint8 = function() {
var t2 = 255 & this.dataView[this.index];
return this.index++, t2;
}, r.prototype.unpack_uint16 = function() {
var t2 = this.read(2), e2 = 256 * (255 & t2[0]) + (255 & t2[1]);
return this.index += 2, e2;
}, r.prototype.unpack_uint32 = function() {
var t2 = this.read(4), e2 = 256 * (256 * (256 * t2[0] + t2[1]) + t2[2]) + t2[3];
return this.index += 4, e2;
}, r.prototype.unpack_uint64 = function() {
var t2 = this.read(8), e2 = 256 * (256 * (256 * (256 * (256 * (256 * (256 * t2[0] + t2[1]) + t2[2]) + t2[3]) + t2[4]) + t2[5]) + t2[6]) + t2[7];
return this.index += 8, e2;
}, r.prototype.unpack_int8 = function() {
var t2 = this.unpack_uint8();
return t2 < 128 ? t2 : t2 - 256;
}, r.prototype.unpack_int16 = function() {
var t2 = this.unpack_uint16();
return t2 < 32768 ? t2 : t2 - 65536;
}, r.prototype.unpack_int32 = function() {
var t2 = this.unpack_uint32();
return t2 < Math.pow(2, 31) ? t2 : t2 - Math.pow(2, 32);
}, r.prototype.unpack_int64 = function() {
var t2 = this.unpack_uint64();
return t2 < Math.pow(2, 63) ? t2 : t2 - Math.pow(2, 64);
}, r.prototype.unpack_raw = function(t2) {
if (this.length < this.index + t2)
throw new Error("BinaryPackFailure: index is out of range " + this.index + " " + t2 + " " + this.length);
var e2 = this.dataBuffer.slice(this.index, this.index + t2);
return this.index += t2, e2;
}, r.prototype.unpack_string = function(t2) {
for (var e2, i2, r2 = this.read(t2), n2 = 0, u2 = ""; n2 < t2; )
(e2 = r2[n2]) < 128 ? (u2 += String.fromCharCode(e2), n2++) : (192 ^ e2) < 32 ? (i2 = (192 ^ e2) << 6 | 63 & r2[n2 + 1], u2 += String.fromCharCode(i2), n2 += 2) : (i2 = (15 & e2) << 12 | (63 & r2[n2 + 1]) << 6 | 63 & r2[n2 + 2], u2 += String.fromCharCode(i2), n2 += 3);
return this.index += t2, u2;
}, r.prototype.unpack_array = function(t2) {
for (var e2 = new Array(t2), i2 = 0; i2 < t2; i2++)
e2[i2] = this.unpack();
return e2;
}, r.prototype.unpack_map = function(t2) {
for (var e2 = {}, i2 = 0; i2 < t2; i2++) {
var r2 = this.unpack(), n2 = this.unpack();
e2[r2] = n2;
}
return e2;
}, r.prototype.unpack_float = function() {
var t2 = this.unpack_uint32(), e2 = (t2 >> 23 & 255) - 127;
return (t2 >> 31 === 0 ? 1 : -1) * (8388607 & t2 | 8388608) * Math.pow(2, e2 - 23);
}, r.prototype.unpack_double = function() {
var t2 = this.unpack_uint32(), e2 = this.unpack_uint32(), i2 = (t2 >> 20 & 2047) - 1023;
return (t2 >> 31 === 0 ? 1 : -1) * ((1048575 & t2 | 1048576) * Math.pow(2, i2 - 20) + e2 * Math.pow(2, i2 - 52));
}, r.prototype.read = function(t2) {
var e2 = this.index;
if (e2 + t2 <= this.length)
return this.dataView.subarray(e2, e2 + t2);
throw new Error("BinaryPackFailure: read index out of range");
}, n.prototype.getBuffer = function() {
return this.bufferBuilder.getBuffer();
}, n.prototype.pack = function(t2) {
var i2 = typeof t2;
if (i2 === "string")
this.pack_string(t2);
else if (i2 === "number")
Math.floor(t2) === t2 ? this.pack_integer(t2) : this.pack_double(t2);
else if (i2 === "boolean")
t2 === true ? this.bufferBuilder.append(195) : t2 === false && this.bufferBuilder.append(194);
else if (i2 === "undefined")
this.bufferBuilder.append(192);
else {
if (i2 !== "object")
throw new Error('Type "' + i2 + '" not yet supported');
if (t2 === null)
this.bufferBuilder.append(192);
else {
var r2 = t2.constructor;
if (r2 == Array)
this.pack_array(t2);
else if (r2 == Blob || r2 == File || t2 instanceof Blob || t2 instanceof File)
this.pack_bin(t2);
else if (r2 == ArrayBuffer)
e.useArrayBufferView ? this.pack_bin(new Uint8Array(t2)) : this.pack_bin(t2);
else if ("BYTES_PER_ELEMENT" in t2)
e.useArrayBufferView ? this.pack_bin(new Uint8Array(t2.buffer)) : this.pack_bin(t2.buffer);
else if (r2 == Object || r2.toString().startsWith("class"))
this.pack_object(t2);
else if (r2 == Date)
this.pack_string(t2.toString());
else {
if (typeof t2.toBinaryPack != "function")
throw new Error('Type "' + r2.toString() + '" not yet supported');
this.bufferBuilder.append(t2.toBinaryPack());
}
}
}
this.bufferBuilder.flush();
}, n.prototype.pack_bin = function(t2) {
var e2 = t2.length || t2.byteLength || t2.size;
if (e2 <= 15)
this.pack_uint8(160 + e2);
else if (e2 <= 65535)
this.bufferBuilder.append(218), this.pack_uint16(e2);
else {
if (!(e2 <= 4294967295))
throw new Error("Invalid length");
this.bufferBuilder.append(219), this.pack_uint32(e2);
}
this.bufferBuilder.append(t2);
}, n.prototype.pack_string = function(t2) {
var e2 = a(t2);
if (e2 <= 15)
this.pack_uint8(176 + e2);
else if (e2 <= 65535)
this.bufferBuilder.append(216), this.pack_uint16(e2);
else {
if (!(e2 <= 4294967295))
throw new Error("Invalid length");
this.bufferBuilder.append(217), this.pack_uint32(e2);
}
this.bufferBuilder.append(t2);
}, n.prototype.pack_array = function(t2) {
var e2 = t2.length;
if (e2 <= 15)
this.pack_uint8(144 + e2);
else if (e2 <= 65535)
this.bufferBuilder.append(220), this.pack_uint16(e2);
else {
if (!(e2 <= 4294967295))
throw new Error("Invalid length");
this.bufferBuilder.append(221), this.pack_uint32(e2);
}
for (var i2 = 0; i2 < e2; i2++)
this.pack(t2[i2]);
}, n.prototype.pack_integer = function(t2) {
if (t2 >= -32 && t2 <= 127)
this.bufferBuilder.append(255 & t2);
else if (t2 >= 0 && t2 <= 255)
this.bufferBuilder.append(204), this.pack_uint8(t2);
else if (t2 >= -128 && t2 <= 127)
this.bufferBuilder.append(208), this.pack_int8(t2);
else if (t2 >= 0 && t2 <= 65535)
this.bufferBuilder.append(205), this.pack_uint16(t2);
else if (t2 >= -32768 && t2 <= 32767)
this.bufferBuilder.append(209), this.pack_int16(t2);
else if (t2 >= 0 && t2 <= 4294967295)
this.bufferBuilder.append(206), this.pack_uint32(t2);
else if (t2 >= -2147483648 && t2 <= 2147483647)
this.bufferBuilder.append(210), this.pack_int32(t2);
else if (t2 >= -9223372036854776e3 && t2 <= 9223372036854776e3)
this.bufferBuilder.append(211), this.pack_int64(t2);
else {
if (!(t2 >= 0 && t2 <= 18446744073709552e3))
throw new Error("Invalid integer");
this.bufferBuilder.append(207), this.pack_uint64(t2);
}
}, n.prototype.pack_double = function(t2) {
var e2 = 0;
t2 < 0 && (e2 = 1, t2 = -t2);
var i2 = Math.floor(Math.log(t2) / Math.LN2), r2 = t2 / Math.pow(2, i2) - 1, n2 = Math.floor(r2 * Math.pow(2, 52)), u2 = Math.pow(2, 32), a2 = e2 << 31 | i2 + 1023 << 20 | n2 / u2 & 1048575, p = n2 % u2;
this.bufferBuilder.append(203), this.pack_int32(a2), this.pack_int32(p);
}, n.prototype.pack_object = function(t2) {
var e2 = Object.keys(t2).length;
if (e2 <= 15)
this.pack_uint8(128 + e2);
else if (e2 <= 65535)
this.bufferBuilder.append(222), this.pack_uint16(e2);
else {
if (!(e2 <= 4294967295))
throw new Error("Invalid length");
this.bufferBuilder.append(223), this.pack_uint32(e2);
}
for (var i2 in t2)
t2.hasOwnProperty(i2) && (this.pack(i2), this.pack(t2[i2]));
}, n.prototype.pack_uint8 = function(t2) {
this.bufferBuilder.append(t2);
}, n.prototype.pack_uint16 = function(t2) {
this.bufferBuilder.append(t2 >> 8), this.bufferBuilder.append(255 & t2);
}, n.prototype.pack_uint32 = function(t2) {
var e2 = 4294967295 & t2;
this.bufferBuilder.append((4278190080 & e2) >>> 24), this.bufferBuilder.append((16711680 & e2) >>> 16), this.bufferBuilder.append((65280 & e2) >>> 8), this.bufferBuilder.append(255 & e2);
}, n.prototype.pack_uint64 = function(t2) {
var e2 = t2 / Math.pow(2, 32), i2 = t2 % Math.pow(2, 32);
this.bufferBuilder.append((4278190080 & e2) >>> 24), this.bufferBuilder.append((16711680 & e2) >>> 16), this.bufferBuilder.append((65280 & e2) >>> 8), this.bufferBuilder.append(255 & e2), this.bufferBuilder.append((4278190080 & i2) >>> 24), this.bufferBuilder.append((16711680 & i2) >>> 16), this.bufferBuilder.append((65280 & i2) >>> 8), this.bufferBuilder.append(255 & i2);
}, n.prototype.pack_int8 = function(t2) {
this.bufferBuilder.append(255 & t2);
}, n.prototype.pack_int16 = function(t2) {
this.bufferBuilder.append((65280 & t2) >> 8), this.bufferBuilder.append(255 & t2);
}, n.prototype.pack_int32 = function(t2) {
this.bufferBuilder.append(t2 >>> 24 & 255), this.bufferBuilder.append((16711680 & t2) >>> 16), this.bufferBuilder.append((65280 & t2) >>> 8), this.bufferBuilder.append(255 & t2);
}, n.prototype.pack_int64 = function(t2) {
var e2 = Math.floor(t2 / Math.pow(2, 32)), i2 = t2 % Math.pow(2, 32);
this.bufferBuilder.append((4278190080 & e2) >>> 24), this.bufferBuilder.append((16711680 & e2) >>> 16), this.bufferBuilder.append((65280 & e2) >>> 8), this.bufferBuilder.append(255 & e2), this.bufferBuilder.append((4278190080 & i2) >>> 24), this.bufferBuilder.append((16711680 & i2) >>> 16), this.bufferBuilder.append((65280 & i2) >>> 8), this.bufferBuilder.append(255 & i2);
};
}, { "./bufferbuilder": "EgBh" }], "iSxC": [function(require2, module2, exports2) {
"use strict";
function e(e2, t2, n2) {
return t2 in e2 ? Object.defineProperty(e2, t2, { value: n2, enumerable: true, configurable: true, writable: true }) : e2[t2] = n2, e2;
}
function t(e2) {
return (t = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e3) {
return typeof e3;
} : function(e3) {
return e3 && typeof Symbol == "function" && e3.constructor === Symbol && e3 !== Symbol.prototype ? "symbol" : typeof e3;
})(e2);
}
Object.defineProperty(exports2, "__esModule", { value: true }), exports2.extractVersion = o, exports2.wrapPeerConnectionEvent = i, exports2.disableLog = s, exports2.disableWarnings = a, exports2.log = p, exports2.deprecated = u, exports2.detectBrowser = c, exports2.compactObject = f, exports2.walkStats = l, exports2.filterStats = v;
var n = true, r = true;
function o(e2, t2, n2) {
var r2 = e2.match(t2);
return r2 && r2.length >= n2 && parseInt(r2[n2], 10);
}
function i(e2, t2, n2) {
if (e2.RTCPeerConnection) {
var r2 = e2.RTCPeerConnection.prototype, o2 = r2.addEventListener;
r2.addEventListener = function(e3, r3) {
if (e3 !== t2)
return o2.apply(this, arguments);
var i3 = function(e4) {
var t3 = n2(e4);
t3 && (r3.handleEvent ? r3.handleEvent(t3) : r3(t3));
};
return this._eventMap = this._eventMap || {}, this._eventMap[t2] || (this._eventMap[t2] = /* @__PURE__ */ new Map()), this._eventMap[t2].set(r3, i3), o2.apply(this, [e3, i3]);
};
var i2 = r2.removeEventListener;
r2.removeEventListener = function(e3, n3) {
if (e3 !== t2 || !this._eventMap || !this._eventMap[t2])
return i2.apply(this, arguments);
if (!this._eventMap[t2].has(n3))
return i2.apply(this, arguments);
var r3 = this._eventMap[t2].get(n3);
return this._eventMap[t2].delete(n3), this._eventMap[t2].size === 0 && delete this._eventMap[t2], Object.keys(this._eventMap).length === 0 && delete this._eventMap, i2.apply(this, [e3, r3]);
}, Object.defineProperty(r2, "on" + t2, { get: function() {
return this["_on" + t2];
}, set: function(e3) {
this["_on" + t2] && (this.removeEventListener(t2, this["_on" + t2]), delete this["_on" + t2]), e3 && this.addEventListener(t2, this["_on" + t2] = e3);
}, enumerable: true, configurable: true });
}
}
function s(e2) {
return typeof e2 != "boolean" ? new Error("Argument type: " + t(e2) + ". Please use a boolean.") : (n = e2, e2 ? "adapter.js logging disabled" : "adapter.js logging enabled");
}
function a(e2) {
return typeof e2 != "boolean" ? new Error("Argument type: " + t(e2) + ". Please use a boolean.") : (r = !e2, "adapter.js deprecation warnings " + (e2 ? "disabled" : "enabled"));
}
function p() {
if ((typeof window == "undefined" ? "undefined" : t(window)) === "object") {
if (n)
return;
typeof console != "undefined" && typeof console.log == "function" && console.log.apply(console, arguments);
}
}
function u(e2, t2) {
r && console.warn(e2 + " is deprecated, please use " + t2 + " instead.");
}
function c(e2) {
var t2 = { browser: null, version: null };
if (e2 === void 0 || !e2.navigator)
return t2.browser = "Not a browser.", t2;
var { navigator: n2 } = e2;
if (n2.mozGetUserMedia)
t2.browser = "firefox", t2.version = o(n2.userAgent, /Firefox\/(\d+)\./, 1);
else if (n2.webkitGetUserMedia || e2.isSecureContext === false && e2.webkitRTCPeerConnection && !e2.RTCIceGatherer)
t2.browser = "chrome", t2.version = o(n2.userAgent, /Chrom(e|ium)\/(\d+)\./, 2);
else if (n2.mediaDevices && n2.userAgent.match(/Edge\/(\d+).(\d+)$/))
t2.browser = "edge", t2.version = o(n2.userAgent, /Edge\/(\d+).(\d+)$/, 2);
else {
if (!e2.RTCPeerConnection || !n2.userAgent.match(/AppleWebKit\/(\d+)\./))
return t2.browser = "Not a supported browser.", t2;
t2.browser = "safari", t2.version = o(n2.userAgent, /AppleWebKit\/(\d+)\./, 1), t2.supportsUnifiedPlan = e2.RTCRtpTransceiver && "currentDirection" in e2.RTCRtpTransceiver.prototype;
}
return t2;
}
function d(e2) {
return Object.prototype.toString.call(e2) === "[object Object]";
}
function f(t2) {
return d(t2) ? Object.keys(t2).reduce(function(n2, r2) {
var o2 = d(t2[r2]), i2 = o2 ? f(t2[r2]) : t2[r2], s2 = o2 && !Object.keys(i2).length;
return i2 === void 0 || s2 ? n2 : Object.assign(n2, e({}, r2, i2));
}, {}) : t2;
}
function l(e2, t2, n2) {
t2 && !n2.has(t2.id) && (n2.set(t2.id, t2), Object.keys(t2).forEach(function(r2) {
r2.endsWith("Id") ? l(e2, e2.get(t2[r2]), n2) : r2.endsWith("Ids") && t2[r2].forEach(function(t3) {
l(e2, e2.get(t3), n2);
});
}));
}
function v(e2, t2, n2) {
var r2 = n2 ? "outbound-rtp" : "inbound-rtp", o2 = /* @__PURE__ */ new Map();
if (t2 === null)
return o2;
var i2 = [];
return e2.forEach(function(e3) {
e3.type === "track" && e3.trackIdentifier === t2.id && i2.push(e3);
}), i2.forEach(function(t3) {
e2.forEach(function(n3) {
n3.type === r2 && n3.trackId === t3.id && l(e2, n3, o2);
});
}), o2;
}
}, {}], "s6SN": [function(require2, module2, exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", { value: true }), exports2.shimGetUserMedia = i;
var e = t(require2("../utils.js"));
function r() {
if (typeof WeakMap != "function")
return null;
var e2 = /* @__PURE__ */ new WeakMap();
return r = function() {
return e2;
}, e2;
}
function t(e2) {
if (e2 && e2.__esModule)
return e2;
if (e2 === null || typeof e2 != "object" && typeof e2 != "function")
return { default: e2 };
var t2 = r();
if (t2 && t2.has(e2))
return t2.get(e2);
var o2 = {}, n2 = Object.defineProperty && Object.getOwnPropertyDescriptor;
for (var i2 in e2)
if (Object.prototype.hasOwnProperty.call(e2, i2)) {
var a = n2 ? Object.getOwnPropertyDescriptor(e2, i2) : null;
a && (a.get || a.set) ? Object.defineProperty(o2, i2, a) : o2[i2] = e2[i2];
}
return o2.default = e2, t2 && t2.set(e2, o2), o2;
}
function o(e2) {
return (o = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e3) {
return typeof e3;
} : function(e3) {
return e3 && typeof Symbol == "function" && e3.constructor === Symbol && e3 !== Symbol.prototype ? "symbol" : typeof e3;
})(e2);
}
var n = e.log;
function i(e2, r2) {
var t2 = e2 && e2.navigator;
if (t2.mediaDevices) {
var i2 = function(e3) {
if (o(e3) !== "object" || e3.mandatory || e3.optional)
return e3;
var r3 = {};
return Object.keys(e3).forEach(function(t3) {
if (t3 !== "require" && t3 !== "advanced" && t3 !== "mediaSource") {
var n2 = o(e3[t3]) === "object" ? e3[t3] : { ideal: e3[t3] };
n2.exact !== void 0 && typeof n2.exact == "number" && (n2.min = n2.max = n2.exact);
var i3 = function(e4, r4) {
return e4 ? e4 + r4.charAt(0).toUpperCase() + r4.slice(1) : r4 === "deviceId" ? "sourceId" : r4;
};
if (n2.ideal !== void 0) {
r3.optional = r3.optional || [];
var a2 = {};
typeof n2.ideal == "number" ? (a2[i3("min", t3)] = n2.ideal, r3.optional.push(a2), (a2 = {})[i3("max", t3)] = n2.ideal, r3.optional.push(a2)) : (a2[i3("", t3)] = n2.ideal, r3.optional.push(a2));
}
n2.exact !== void 0 && typeof n2.exact != "number" ? (r3.mandatory = r3.mandatory || {}, r3.mandatory[i3("", t3)] = n2.exact) : ["min", "max"].forEach(function(e4) {
n2[e4] !== void 0 && (r3.mandatory = r3.mandatory || {}, r3.mandatory[i3(e4, t3)] = n2[e4]);
});
}
}), e3.advanced && (r3.optional = (r3.optional || []).concat(e3.advanced)), r3;
}, a = function(e3, a2) {
if (r2.version >= 61)
return a2(e3);
if ((e3 = JSON.parse(JSON.stringify(e3))) && o(e3.audio) === "object") {
var c2 = function(e4, r3, t3) {
r3 in e4 && !(t3 in e4) && (e4[t3] = e4[r3], delete e4[r3]);
};
c2((e3 = JSON.parse(JSON.stringify(e3))).audio, "autoGainControl", "googAutoGainControl"), c2(e3.audio, "noiseSuppression", "googNoiseSuppression"), e3.audio = i2(e3.audio);
}
if (e3 && o(e3.video) === "object") {
var d2 = e3.video.facingMode;
d2 = d2 && (o(d2) === "object" ? d2 : { ideal: d2 });
var u, s = r2.version < 66;
if (d2 && (d2.exact === "user" || d2.exact === "environment" || d2.ideal === "user" || d2.ideal === "environment") && (!t2.mediaDevices.getSupportedConstraints || !t2.mediaDevices.getSupportedConstraints().facingMode || s)) {
if (delete e3.video.facingMode, d2.exact === "environment" || d2.ideal === "environment" ? u = ["back", "rear"] : d2.exact !== "user" && d2.ideal !== "user" || (u = ["front"]), u)
return t2.mediaDevices.enumerateDevices().then(function(r3) {
var t3 = (r3 = r3.filter(function(e4) {
return e4.kind === "videoinput";
})).find(function(e4) {
return u.some(function(r4) {
return e4.label.toLowerCase().includes(r4);
});
});
return !t3 && r3.length && u.includes("back") && (t3 = r3[r3.length - 1]), t3 && (e3.video.deviceId = d2.exact ? { exact: t3.deviceId } : { ideal: t3.deviceId }), e3.video = i2(e3.video), n("chrome: " + JSON.stringify(e3)), a2(e3);
});
}
e3.video = i2(e3.video);
}
return n("chrome: " + JSON.stringify(e3)), a2(e3);
}, c = function(e3) {
return r2.version >= 64 ? e3 : { name: { PermissionDeniedError: "NotAllowedError", PermissionDismissedError: "NotAllowedError", InvalidStateError: "NotAllowedError", DevicesNotFoundError: "NotFoundError", ConstraintNotSatisfiedError: "OverconstrainedError", TrackStartError: "NotReadableError", MediaDeviceFailedDueToShutdown: "NotAllowedError", MediaDeviceKillSwitchOn: "NotAllowedError", TabCaptureError: "AbortError", ScreenCaptureError: "AbortError", DeviceCaptureError: "AbortError" }[e3.name] || e3.name, message: e3.message, constraint: e3.constraint || e3.constraintName, toString: function() {
return this.name + (this.message && ": ") + this.message;
} };
};
if (t2.getUserMedia = function(e3, r3, o2) {
a(e3, function(e4) {
t2.webkitGetUserMedia(e4, r3, function(e5) {
o2 && o2(c(e5));
});
});
}.bind(t2), t2.mediaDevices.getUserMedia) {
var d = t2.mediaDevices.getUserMedia.bind(t2.mediaDevices);
t2.mediaDevices.getUserMedia = function(e3) {
return a(e3, function(e4) {
return d(e4).then(function(r3) {
if (e4.audio && !r3.getAudioTracks().length || e4.video && !r3.getVideoTracks().length)
throw r3.getTracks().forEach(function(e5) {
e5.stop();
}), new DOMException("", "NotFoundError");
return r3;
}, function(e5) {
return Promise.reject(c(e5));
});
});
};
}
}
}
}, { "../utils.js": "iSxC" }], "VHa8": [function(require2, module2, exports2) {
"use strict";
function e(e2, i) {
e2.navigator.mediaDevices && "getDisplayMedia" in e2.navigator.mediaDevices || e2.navigator.mediaDevices && (typeof i == "function" ? e2.navigator.mediaDevices.getDisplayMedia = function(a) {
return i(a).then(function(i2) {
var t = a.video && a.video.width, o = a.video && a.video.height, d = a.video && a.video.frameRate;
return a.video = { mandatory: { chromeMediaSource: "desktop", chromeMediaSourceId: i2, maxFrameRate: d || 3 } }, t && (a.video.mandatory.maxWidth = t), o && (a.video.mandatory.maxHeight = o), e2.navigator.mediaDevices.getUserMedia(a);
});
} : console.error("shimGetDisplayMedia: getSourceId argument is not a function"));
}
Object.defineProperty(exports2, "__esModule", { value: true }), exports2.shimGetDisplayMedia = e;
}, {}], "uI5X": [function(require2, module2, exports2) {
"use strict";
Object.defineProperty(exports2, "__esModule", { value: true }), exports2.shimMediaStream = a, exports2.shimOnTrack = c, exports2.shimGetSendersWithDtmf = p, exports2.shimGetStats = d, exports2.shimSenderReceiverGetStats = h, exports2.shimAddTrackRemoveTrackWithNative = f, exports2.shimAddTrackRemoveTrack = m, exports2.shimPeerConnection = u, exports2.fixNegotiationNeeded = l, Object.defineProperty(exports2, "shimGetUserMedia", { enumerable: true, get: function() {
return t.shimGetUserMedia;
} }), Object.defineProperty(exports2, "shimGetDisplayMedia", { enumerable: true, get: function() {
return r.shimGetDisplayMedia;
} });
var e = i(require2("../utils.js")), t = require2("./getusermedia"), r = require2("./getdisplaymedia");
function n() {
if (typeof WeakMap != "function")
return null;
var e2 = /* @__PURE__ */ new WeakMap();
return n = function() {
return e2;
}, e2;
}
function i(e2) {
if (e2 && e2.__esModule)
return e2;
if (e2 === null || typeof e2 != "object" && typeof e2 != "function")
return { default: e2 };
var t2 = n();
if (t2 && t2.has(e2))
return t2.get(e2);
var r2 = {}, i2 = Object.defineProperty && Object.getOwnPropertyDescriptor;
for (var o2 in e2)
if (Object.prototype.hasOwnProperty.call(e2, o2)) {
var s2 = i2 ? Object.getOwnPropertyDescriptor(e2, o2) : null;
s2 && (s2.get || s2.set) ? Object.defineProperty(r2, o2, s2) : r2[o2] = e2[o2];
}
return r2.default = e2, t2 && t2.set(e2, r2), r2;
}
function o(e2, t2, r2) {
return t2 in e2 ? Object.defineProperty(e2, t2, { value: r2, enumerable: true, configurable: true, writable: true }) : e2[t2] = r2, e2;
}
function s(e2) {
return (s = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e3) {
return typeof e3;
} : function(e3) {
return e3 && typeof Symbol == "function" && e3.constructor === Symbol && e3 !== Symbol.prototype ? "symbol" : typeof e3;
})(e2);
}
function a(e2) {
e2.MediaStream = e2.MediaStream || e2.webkitMediaStream;
}
function c(t2) {
if (s(t2) !== "object" || !t2.RTCPeerConnection || "ontrack" in t2.RTCPeerConnection.prototype)
e.wrapPeerConnectionEvent(t2, "track", function(e2) {
return e2.transceiver || Object.defineProperty(e2, "transceiver", { value: { receiver: e2.receiver } }), e2;
});
else {
Object.defineProperty(t2.RTCPeerConnection.prototype, "ontrack", { get: function() {
return this._ontrack;
}, set: function(e2) {
this._ontrack && this.removeEventListener("track", this._ontrack), this.addEventListener("track", this._ontrack = e2);
}, enumerable: true, configurable: true });
var r2 = t2.RTCPeerConnection.prototype.setRemoteDescription;
t2.RTCPeerConnection.prototype.setRemoteDescription = function() {
var e2 = this;
return this._ontrackpoly || (this._ontrackpoly = function(r3) {
r3.stream.addEventListener("addtrack", function(n2) {
var i2;
i2 = t2.RTCPeerConnection.prototype.getReceivers ? e2.getReceivers().find(function(e3) {
return e3.track && e3.track.id === n2.track.id;
}) : { track: n2.track };
var o2 = new Event("track");
o2.track = n2.track, o2.receiver = i2, o2.transceiver = { receiver: i2 }, o2.streams = [r3.stream], e2.dispatchEvent(o2);
}), r3.stream.getTracks().forEach(function(n2) {
var i2;
i2 = t2.RTCPeerConnection.prototype.getReceivers ? e2.getReceivers().find(function(e3) {
return e3.track && e3.track.id === n2.id;
}) : { track: n2 };
var o2 = new Event("track");
o2.track = n2, o2.receiver = i2, o2.transceiver = { receiver: i2 }, o2.streams = [r3.stream], e2.dispatchEvent(o2);
});
}, this.addEventListener("addstream", this._ontrackpoly)), r2.apply(this, arguments);
};
}
}
function p(e2) {
if (s(e2) === "object" && e2.RTCPeerConnection && !("getSenders" in e2.RTCPeerConnection.prototype) && "createDTMFSender" in e2.RTCPeerConnection.prototype) {
var t2 = function(e3, t3) {
return { track: t3, get dtmf() {
return this._dtmf === void 0 && (t3.kind === "audio" ? this._dtmf = e3.createDTMFSender(t3) : this._dtmf = null), this._dtmf;
}, _pc: e3 };
};
if (!e2.RTCPeerConnection.prototype.getSenders) {
e2.RTCPeerConnection.prototype.getSenders = function() {
return this._senders = this._senders || [], this._senders.slice();
};
var r2 = e2.RTCPeerConnection.prototype.addTrack;
e2.RTCPeerConnection.prototype.addTrack = function(e3, n3) {
var i3 = r2.apply(this, arguments);
return i3 || (i3 = t2(this, e3), this._senders.push(i3)), i3;
};
var n2 = e2.RTCPeerConnection.prototype.removeTrack;
e2.RTCPeerConnection.prototype.removeTrack = function(e3) {
n2.apply(this, arguments);
var t3 = this._senders.indexOf(e3);
t3 !== -1 && this._senders.splice(t3, 1);
};
}
var i2 = e2.RTCPeerConnection.prototype.addStream;
e2.RTCPeerConnection.prototype.addStream = function(e3) {
var r3 = this;
this._senders = this._senders || [], i2.apply(this, [e3]), e3.getTracks().forEach(function(e4) {
r3._senders.push(t2(r3, e4));
});
};
var o2 = e2.RTCPeerConnection.prototype.removeStream;
e2.RTCPeerConnection.prototype.removeStream = function(e3) {
var t3 = this;
this._senders = this._senders || [], o2.apply(this, [e3]), e3.getTracks().forEach(function(e4) {
var r3 = t3._senders.find(function(t4) {
return t4.track === e4;
});
r3 && t3._senders.splice(t3._senders.indexOf(r3), 1);
});
};
} else if (s(e2) === "object" && e2.RTCPeerConnection && "getSenders" in e2.RTCPeerConnection.prototype && "createDTMFSender" in e2.RTCPeerConnection.prototype && e2.RTCRtpSender && !("dtmf" in e2.RTCRtpSender.prototype)) {
var a2 = e2.RTCPeerConnection.prototype.getSenders;
e2.RTCPeerConnection.prototype.getSenders = function() {
var e3 = this, t3 = a2.apply(this, []);
return t3.forEach(function(t4) {
return t4._pc = e3;
}), t3;
}, Object.defineProperty(e2.RTCRtpSender.prototype, "dtmf", { get: function() {
return this._dtmf === void 0 && (this.track.kind === "audio" ? this._dtmf = this._pc.createDTMFSender(this.track) : this._dtmf = null), this._dtmf;
} });
}
}
function d(e2) {
if (e2.RTCPeerConnection) {
var t2 = e2.RTCPeerConnection.prototype.getStats;
e2.RTCPeerConnection.prototype.getStats = function() {
var e3 = this, [r2, n2, i2] = arguments;
if (arguments.length > 0 && typeof r2 == "function")
return t2.apply(this, arguments);
if (t2.length === 0 && (arguments.length === 0 || typeof r2 != "function"))
return t2.apply(this, []);
var o2 = function(e4) {
var t3 = {};
return e4.result().forEach(function(e5) {
var r3 = { id: e5.id, timestamp: e5.timestamp, type: { localcandidate: "local-candidate", remotecandidate: "remote-candidate" }[e5.type] || e5.type };
e5.names().forEach(function(t4) {
r3[t4] = e5.stat(t4);
}), t3[r3.id] = r3;
}), t3;
}, s2 = function(e4) {
return new Map(Object.keys(e4).map(function(t3) {
return [t3, e4[t3]];
}));
};
if (arguments.length >= 2) {
return t2.apply(this, [function(e4) {
n2(s2(o2(e4)));
}, r2]);
}
return new Promise(function(r3, n3) {
t2.apply(e3, [function(e4) {
r3(s2(o2(e4)));
}, n3]);
}).then(n2, i2);
};
}
}
function h(t2) {
if (s(t2) === "object" && t2.RTCPeerConnection && t2.RTCRtpSender && t2.RTCRtpReceiver) {
if (!("getStats" in t2.RTCRtpSender.prototype)) {
var r2 = t2.RTCPeerConnection.prototype.getSenders;
r2 && (t2.RTCPeerConnection.prototype.getSenders = function() {
var e2 = this, t3 = r2.apply(this, []);
return t3.forEach(function(t4) {
return t4._pc = e2;
}), t3;
});
var n2 = t2.RTCPeerConnection.prototype.addTrack;
n2 && (t2.RTCPeerConnection.prototype.addTrack = function() {
var e2 = n2.apply(this, arguments);
return e2._pc = this, e2;
}), t2.RTCRtpSender.prototype.getStats = function() {
var t3 = this;
return this._pc.getStats().then(function(r3) {
return e.filterStats(r3, t3.track, true);
});
};
}
if (!("getStats" in t2.RTCRtpReceiver.prototype)) {
var i2 = t2.RTCPeerConnection.prototype.getReceivers;
i2 && (t2.RTCPeerConnection.prototype.getReceivers = function() {
var e2 = this, t3 = i2.apply(this, []);
return t3.forEach(function(t4) {
return t4._pc = e2;
}), t3;
}), e.wrapPeerConnectionEvent(t2, "track", function(e2) {
return e2.receiver._pc = e2.srcElement, e2;
}), t2.RTCRtpReceiver.prototype.getStats = function() {
var t3 = this;
return this._pc.getStats().then(function(r3) {
return e.filterStats(r3, t3.track, false);
});
};
}
if ("getStats" in t2.RTCRtpSender.prototype && "getStats" in t2.RTCRtpReceiver.prototype) {
var o2 = t2.RTCPeerConnection.prototype.getStats;
t2.RTCPeerConnection.prototype.getStats = function() {
if (arguments.length > 0 && arguments[0] instanceof t2.MediaStreamTrack) {
var e2, r3, n3, i3 = arguments[0];
return this.getSenders().forEach(function(t3) {
t3.track === i3 && (e2 ? n3 = true : e2 = t3);
}), this.getReceivers().forEach(function(e3) {
return e3.track === i3 && (r3 ? n3 = true : r3 = e3), e3.track === i3;
}), n3 || e2 && r3 ? Promise.reject(new DOMException("There are more than one sender or receiver for the track.", "InvalidAccessError")) : e2 ? e2.getStats() : r3 ? r3.getStats() : Promise.reject(new DOMException("There is no sender or receiver for the track.", "InvalidAccessError"));
}
return o2.apply(this, arguments);
};
}
}
}
function f(e2) {
e2.RTCPeerConnection.prototype.getLocalStreams = function() {
var e3 = this;
return this._shimmedLocalStreams = this._shimmedLocalStreams || {}, Object.keys(this._shimmedLocalStreams).map(function(t3) {
return e3._shimmedLocalStreams[t3][0];
});
};
var t2 = e2.RTCPeerConnection.prototype.addTrack;
e2.RTCPeerConnection.prototype.addTrack = function(e3, r3) {
if (!r3)
return t2.apply(this, arguments);
this._shimmedLocalStreams = this._shimmedLocalStreams || {};
var n3 = t2.apply(this, arguments);
return this._shimmedLocalStreams[r3.id] ? this._shimmedLocalStreams[r3.id].indexOf(n3) === -1 && this._shimmedLocalStreams[r3.id].push(n3) : this._shimmedLocalStreams[r3.id] = [r3, n3], n3;
};
var r2 = e2.RTCPeerConnection.prototype.addStream;
e2.RTCPeerConnection.prototype.addStream = function(e3) {
var t3 = this;
this._shimmedLocalStreams = this._shimmedLocalStreams || {}, e3.getTracks().forEach(function(e4) {
if (t3.getSenders().find(function(t4) {
return t4.track === e4;
}))
throw new DOMException("Track already exists.", "InvalidAccessError");
});
var n3 = this.getSenders();
r2.apply(this, arguments);
var i3 = this.getSenders().filter(function(e4) {
return n3.indexOf(e4) === -1;
});
this._shimmedLocalStreams[e3.id] = [e3].concat(i3);
};
var n2 = e2.RTCPeerConnection.prototype.removeStream;
e2.RTCPeerConnection.prototype.removeStream = function(e3) {
return this._shimmedLocalStreams = this._shimmedLocalStreams || {}, delete this._shimmedLocalStreams[e3.id], n2.apply(this, arguments);
};
var i2 = e2.RTCPeerConnection.prototype.removeTrack;
e2.RTCPeerConnection.prototype.removeTrack = function(e3) {
var t3 = this;
return this._shimmedLocalStreams = this._shimmedLocalStreams || {}, e3 && Object.keys(this._shimmedLocalStreams).forEach(function(r3) {
var n3 = t3._shimmedLocalStreams[r3].indexOf(e3);
n3 !== -1 && t3._shimmedLocalStreams[r3].splice(n3, 1), t3._shimmedLocalStreams[r3].length === 1 && delete t3._shimmedLocalStreams[r3];
}), i2.apply(this, arguments);
};
}
function m(e2, t2) {
if (e2.RTCPeerConnection) {
if (e2.RTCPeerConnection.prototype.addTrack && t2.version >= 65)
return f(e2);
var r2 = e2.RTCPeerConnection.prototype.getLocalStreams;
e2.RTCPeerConnection.prototype.getLocalStreams = function() {
var e3 = this, t3 = r2.apply(this);
return this._reverseStreams = this._reverseStreams || {}, t3.map(function(t4) {
return e3._reverseStreams[t4.id];
});
};
var n2 = e2.RTCPeerConnection.prototype.addStream;
e2.RTCPeerConnection.prototype.addStream = function(t3) {
var r3 = this;
if (this._streams = this._streams || {}, this._reverseStreams = this._reverseStreams || {}, t3.getTracks().forEach(function(e3) {
if (r3.getSenders().find(function(t4) {
return t4.track === e3;
}))
throw new DOMException("Track already exists.", "InvalidAccessError");
}), !this._reverseStreams[t3.id]) {
var i3 = new e2.MediaStream(t3.getTracks());
this._streams[t3.id] = i3, this._reverseStreams[i3.id] = t3, t3 = i3;
}
n2.apply(this, [t3]);
};
var i2 = e2.RTCPeerConnection.prototype.removeStream;
e2.RTCPeerConnection.prototype.removeStream = function(e3) {
this._streams = this._streams || {}, this._reverseStreams = this._reverseStreams || {}, i2.apply(this, [this._streams[e3.id] || e3]), delete this._reverseStreams[this._streams[e3.id] ? this._streams[e3.id].id : e3.id], delete this._streams[e3.id];
}, e2.RTCPeerConnection.prototype.addTrack = function(t3, r3) {
var n3 = this;
if (this.signalingState === "closed")
throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.", "InvalidStateError");
var i3 = [].slice.call(arguments, 1);
if (i3.length !== 1 || !i3[0].getTracks().find(function(e3) {
return e3 === t3;
}))
throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.", "NotSupportedError");
if (this.getSenders().find(function(e3) {
return e3.track === t3;
}))
throw new DOMException("Track already exists.", "InvalidAccessError");
this._streams = this._streams || {}, this._reverseStreams = this._reverseStreams || {};
var o2 = this._streams[r3.id];
if (o2)
o2.addTrack(t3), Promise.resolve().then(function() {
n3.dispatchEvent(new Event("negotiationneeded"));
});
else {
var s3 = new e2.MediaStream([t3]);
this._streams[r3.id] = s3, this._reverseStreams[s3.id] = r3, this.addStream(s3);
}
return this.getSenders().find(function(e3) {
return e3.track === t3;
});
}, ["createOffer", "createAnswer"].forEach(function(t3) {
var r3 = e2.RTCPeerConnection.prototype[t3], n3 = o({}, t3, function() {
var e3 = this, t4 = arguments;
return arguments.length && typeof arguments[0] == "function" ? r3.apply(this, [function(r4) {
var n4 = c2(e3, r4);
t4[0].apply(null, [n4]);
}, function(e4) {
t4[1] && t4[1].apply(null, e4);
}, arguments[2]]) : r3.apply(this, arguments).then(function(t5) {
return c2(e3, t5);
});
});
e2.RTCPeerConnection.prototype[t3] = n3[t3];
});
var s2 = e2.RTCPeerConnection.prototype.setLocalDescription;
e2.RTCPeerConnection.prototype.setLocalDescription = function() {
return arguments.length && arguments[0].type ? (arguments[0] = (e3 = this, t3 = arguments[0], r3 = t3.sdp, Object.keys(e3._reverseStreams || []).forEach(function(t4) {
var n3 = e3._reverseStreams[t4], i3 = e3._streams[n3.id];
r3 = r3.replace(new RegExp(n3.id, "g"), i3.id);
}), new RTCSessionDescription({ type: t3.type, sdp: r3 })), s2.apply(this, arguments)) : s2.apply(this, arguments);
var e3, t3, r3;
};
var a2 = Object.getOwnPropertyDescriptor(e2.RTCPeerConnection.prototype, "localDescription");
Object.defineProperty(e2.RTCPeerConnection.prototype, "localDescription", { get: function() {
var e3 = a2.get.apply(this);
return e3.type === "" ? e3 : c2(this, e3);
} }), e2.RTCPeerConnection.prototype.removeTrack = function(e3) {
var t3, r3 = this;
if (this.signalingState === "closed")
throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.", "InvalidStateError");
if (!e3._pc)
throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.", "TypeError");
if (!(e3._pc === this))
throw new DOMException("Sender was not created by this connection.", "InvalidAccessError");
this._streams = this._streams || {}, Object.keys(this._streams).forEach(function(n3) {
r3._streams[n3].getTracks().find(function(t4) {
return e3.track === t4;
}) && (t3 = r3._streams[n3]);
}), t3 && (t3.getTracks().length === 1 ? this.removeStream(this._reverseStreams[t3.id]) : t3.removeTrack(e3.track), this.dispatchEvent(new Event("negotiationneeded")));
};
}
function c2(e3, t3) {
var r3 = t3.sdp;
return Object.keys(e3._reverseStreams || []).forEach(function(t4) {
var n3 = e3._reverseStreams[t4], i3 = e3._streams[n3.id];
r3 = r3.replace(new RegExp(i3.id, "g"), n3.id);
}), new RTCSessionDescription({ type: t3.type, sdp: r3 });
}
}
function u(e2, t2) {
!e2.RTCPeerConnection && e2.webkitRTCPeerConnection && (e2.RTCPeerConnection = e2.webkitRTCPeerConnection), e2.RTCPeerConnection && t2.version < 53 && ["setLocalDescription", "setRemoteDescription", "addIceCandidate"].forEach(function(t3) {
var r2 = e2.RTCPeerConnection.prototype[t3], n2 = o({}, t3, function() {
return arguments[0] = new (t3 === "addIceCandidate" ? e2.RTCIceCandidate : e2.RTCSessionDescription)(arguments[0]), r2.apply(this, arguments);
});
e2.RTCPeerConnection.prototype[t3] = n2[t3];
});