@byteplus/vepusher 2.0.1 → 2.0.2
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/index.es.js +1077 -1070
- package/dist/index.umd.js +8 -8
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var m = (r, e, t) =>
|
|
4
|
-
function
|
|
1
|
+
var Qs = Object.defineProperty;
|
|
2
|
+
var en = (r, e, t) => e in r ? Qs(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var m = (r, e, t) => en(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
function tn(r, e) {
|
|
5
5
|
for (var t = 0; t < e.length; t++) {
|
|
6
6
|
const i = e[t];
|
|
7
7
|
if (typeof i != "string" && !Array.isArray(i)) {
|
|
@@ -20,62 +20,62 @@ function en(r, e) {
|
|
|
20
20
|
function Ge(r) {
|
|
21
21
|
return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
|
|
22
22
|
}
|
|
23
|
-
var
|
|
24
|
-
function
|
|
23
|
+
var nt = { exports: {} }, br;
|
|
24
|
+
function rn() {
|
|
25
25
|
return br || (br = 1, function(r) {
|
|
26
26
|
var e = Object.prototype.hasOwnProperty, t = "~";
|
|
27
27
|
function i() {
|
|
28
28
|
}
|
|
29
29
|
Object.create && (i.prototype = /* @__PURE__ */ Object.create(null), new i().__proto__ || (t = !1));
|
|
30
|
-
function s(u,
|
|
31
|
-
this.fn = u, this.context =
|
|
30
|
+
function s(u, d, c) {
|
|
31
|
+
this.fn = u, this.context = d, this.once = c || !1;
|
|
32
32
|
}
|
|
33
|
-
function n(u,
|
|
34
|
-
if (typeof
|
|
33
|
+
function n(u, d, c, h, p) {
|
|
34
|
+
if (typeof c != "function")
|
|
35
35
|
throw new TypeError("The listener must be a function");
|
|
36
|
-
var l = new s(
|
|
36
|
+
var l = new s(c, h || u, p), f = t ? t + d : d;
|
|
37
37
|
return u._events[f] ? u._events[f].fn ? u._events[f] = [u._events[f], l] : u._events[f].push(l) : (u._events[f] = l, u._eventsCount++), u;
|
|
38
38
|
}
|
|
39
|
-
function a(u,
|
|
40
|
-
--u._eventsCount === 0 ? u._events = new i() : delete u._events[
|
|
39
|
+
function a(u, d) {
|
|
40
|
+
--u._eventsCount === 0 ? u._events = new i() : delete u._events[d];
|
|
41
41
|
}
|
|
42
42
|
function o() {
|
|
43
43
|
this._events = new i(), this._eventsCount = 0;
|
|
44
44
|
}
|
|
45
45
|
o.prototype.eventNames = function() {
|
|
46
|
-
var
|
|
47
|
-
if (this._eventsCount === 0) return
|
|
48
|
-
for (h in
|
|
49
|
-
e.call(
|
|
50
|
-
return Object.getOwnPropertySymbols ?
|
|
51
|
-
}, o.prototype.listeners = function(
|
|
52
|
-
var
|
|
46
|
+
var d = [], c, h;
|
|
47
|
+
if (this._eventsCount === 0) return d;
|
|
48
|
+
for (h in c = this._events)
|
|
49
|
+
e.call(c, h) && d.push(t ? h.slice(1) : h);
|
|
50
|
+
return Object.getOwnPropertySymbols ? d.concat(Object.getOwnPropertySymbols(c)) : d;
|
|
51
|
+
}, o.prototype.listeners = function(d) {
|
|
52
|
+
var c = t ? t + d : d, h = this._events[c];
|
|
53
53
|
if (!h) return [];
|
|
54
54
|
if (h.fn) return [h.fn];
|
|
55
55
|
for (var p = 0, l = h.length, f = new Array(l); p < l; p++)
|
|
56
56
|
f[p] = h[p].fn;
|
|
57
57
|
return f;
|
|
58
|
-
}, o.prototype.listenerCount = function(
|
|
59
|
-
var
|
|
58
|
+
}, o.prototype.listenerCount = function(d) {
|
|
59
|
+
var c = t ? t + d : d, h = this._events[c];
|
|
60
60
|
return h ? h.fn ? 1 : h.length : 0;
|
|
61
|
-
}, o.prototype.emit = function(
|
|
62
|
-
var g = t ? t +
|
|
61
|
+
}, o.prototype.emit = function(d, c, h, p, l, f) {
|
|
62
|
+
var g = t ? t + d : d;
|
|
63
63
|
if (!this._events[g]) return !1;
|
|
64
64
|
var _ = this._events[g], T = arguments.length, b, v;
|
|
65
65
|
if (_.fn) {
|
|
66
|
-
switch (_.once && this.removeListener(
|
|
66
|
+
switch (_.once && this.removeListener(d, _.fn, void 0, !0), T) {
|
|
67
67
|
case 1:
|
|
68
68
|
return _.fn.call(_.context), !0;
|
|
69
69
|
case 2:
|
|
70
|
-
return _.fn.call(_.context,
|
|
70
|
+
return _.fn.call(_.context, c), !0;
|
|
71
71
|
case 3:
|
|
72
|
-
return _.fn.call(_.context,
|
|
72
|
+
return _.fn.call(_.context, c, h), !0;
|
|
73
73
|
case 4:
|
|
74
|
-
return _.fn.call(_.context,
|
|
74
|
+
return _.fn.call(_.context, c, h, p), !0;
|
|
75
75
|
case 5:
|
|
76
|
-
return _.fn.call(_.context,
|
|
76
|
+
return _.fn.call(_.context, c, h, p, l), !0;
|
|
77
77
|
case 6:
|
|
78
|
-
return _.fn.call(_.context,
|
|
78
|
+
return _.fn.call(_.context, c, h, p, l, f), !0;
|
|
79
79
|
}
|
|
80
80
|
for (v = 1, b = new Array(T - 1); v < T; v++)
|
|
81
81
|
b[v - 1] = arguments[v];
|
|
@@ -83,18 +83,18 @@ function tn() {
|
|
|
83
83
|
} else {
|
|
84
84
|
var U = _.length, R;
|
|
85
85
|
for (v = 0; v < U; v++)
|
|
86
|
-
switch (_[v].once && this.removeListener(
|
|
86
|
+
switch (_[v].once && this.removeListener(d, _[v].fn, void 0, !0), T) {
|
|
87
87
|
case 1:
|
|
88
88
|
_[v].fn.call(_[v].context);
|
|
89
89
|
break;
|
|
90
90
|
case 2:
|
|
91
|
-
_[v].fn.call(_[v].context,
|
|
91
|
+
_[v].fn.call(_[v].context, c);
|
|
92
92
|
break;
|
|
93
93
|
case 3:
|
|
94
|
-
_[v].fn.call(_[v].context,
|
|
94
|
+
_[v].fn.call(_[v].context, c, h);
|
|
95
95
|
break;
|
|
96
96
|
case 4:
|
|
97
|
-
_[v].fn.call(_[v].context,
|
|
97
|
+
_[v].fn.call(_[v].context, c, h, p);
|
|
98
98
|
break;
|
|
99
99
|
default:
|
|
100
100
|
if (!b) for (R = 1, b = new Array(T - 1); R < T; R++)
|
|
@@ -103,61 +103,61 @@ function tn() {
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
return !0;
|
|
106
|
-
}, o.prototype.on = function(
|
|
107
|
-
return n(this,
|
|
108
|
-
}, o.prototype.once = function(
|
|
109
|
-
return n(this,
|
|
110
|
-
}, o.prototype.removeListener = function(
|
|
111
|
-
var l = t ? t +
|
|
106
|
+
}, o.prototype.on = function(d, c, h) {
|
|
107
|
+
return n(this, d, c, h, !1);
|
|
108
|
+
}, o.prototype.once = function(d, c, h) {
|
|
109
|
+
return n(this, d, c, h, !0);
|
|
110
|
+
}, o.prototype.removeListener = function(d, c, h, p) {
|
|
111
|
+
var l = t ? t + d : d;
|
|
112
112
|
if (!this._events[l]) return this;
|
|
113
|
-
if (!
|
|
113
|
+
if (!c)
|
|
114
114
|
return a(this, l), this;
|
|
115
115
|
var f = this._events[l];
|
|
116
116
|
if (f.fn)
|
|
117
|
-
f.fn ===
|
|
117
|
+
f.fn === c && (!p || f.once) && (!h || f.context === h) && a(this, l);
|
|
118
118
|
else {
|
|
119
119
|
for (var g = 0, _ = [], T = f.length; g < T; g++)
|
|
120
|
-
(f[g].fn !==
|
|
120
|
+
(f[g].fn !== c || p && !f[g].once || h && f[g].context !== h) && _.push(f[g]);
|
|
121
121
|
_.length ? this._events[l] = _.length === 1 ? _[0] : _ : a(this, l);
|
|
122
122
|
}
|
|
123
123
|
return this;
|
|
124
|
-
}, o.prototype.removeAllListeners = function(
|
|
125
|
-
var
|
|
126
|
-
return
|
|
124
|
+
}, o.prototype.removeAllListeners = function(d) {
|
|
125
|
+
var c;
|
|
126
|
+
return d ? (c = t ? t + d : d, this._events[c] && a(this, c)) : (this._events = new i(), this._eventsCount = 0), this;
|
|
127
127
|
}, o.prototype.off = o.prototype.removeListener, o.prototype.addListener = o.prototype.on, o.prefixed = t, o.EventEmitter = o, r.exports = o;
|
|
128
|
-
}(
|
|
128
|
+
}(nt)), nt.exports;
|
|
129
129
|
}
|
|
130
|
-
var
|
|
131
|
-
const te = /* @__PURE__ */ Ge(
|
|
132
|
-
var S = /* @__PURE__ */ ((r) => (r.Camera = "camera", r.Screen = "screen", r.VideoFile = "videoFile", r.Microphone = "microphone", r.AudioFile = "audioFile", r.Image = "image", r.MixAudio = "mixAudio", r.MixVideo = "mixVideo", r.CustomVideo = "customVideo", r.CustomAudio = "customAudio", r))(S || {}), j = /* @__PURE__ */ ((r) => (r.DeviceCaptured = "deviceCaptured", r.DeviceStopCapture = "deviceStopCapture", r.Error = "error", r.Interrupted = "interrupted", r))(j || {}), w = /* @__PURE__ */ ((r) => (r.PushStart = "pushStart", r.PushStop = "pushStop", r.PushError = "pushError", r.RTCConnectStateChanged = "rtcConnectStateChanged", r.CaptureFirstVideoFrame = "capturefirstvideoframe", r.CaptureFirstAudioFrame = "capturefirstaudioframe", r.NotAllowedAutoPlay = "notallowedautoplay", r))(w || {}), Ri = /* @__PURE__ */ ((r) => (r["120p"] = "160x120x15x200", r["180p"] = "320x180x15x350", r["240p"] = "320x240x15x400", r["360p"] = "640x360x15x800", r["480p"] = "640x480x15x900", r["720p-1"] = "1280x720x15x1500", r["720p-2"] = "1280x720x25x1500", r["720p-3"] = "1280x720x30x1500", r["1080p-1"] = "1920x1080x15x2080", r["1080p-2"] = "1920x1080x25x3000", r["1080p-3"] = "1920x1080x30x3150", r))(Ri || {}), Ai = /* @__PURE__ */ ((r) => (r["120p"] = "120x160x15x200", r["180p"] = "180x320x15x350", r["240p"] = "240x320x15x400", r["360p"] = "360x640x15x800", r["480p"] = "480x640x15x900", r["720p-1"] = "720x1280x15x1500", r["720p-2"] = "720x1280x25x1500", r["720p-3"] = "720x1280x30x1500", r["1080p-1"] = "1080x1920x15x2080", r["1080p-2"] = "1080x1920x25x3000", r["1080p-3"] = "1080x1920x30x3150", r))(Ai || {}), wi = /* @__PURE__ */ ((r) => (r.STANDARD = "48000x40", r.HIGH = "48000x128", r))(wi || {}), ie = /* @__PURE__ */ ((r) => (r.VideoStreamChange = "videoStreamChange", r.AudioStreamChange = "audioStreamChange", r))(ie || {}), Oi = /* @__PURE__ */ ((r) => (r[r.init = -1] = "init", r[r.new = 0] = "new", r[r.connecting = 1] = "connecting", r[r.connected = 2] = "connected", r[r.disconnected = 3] = "disconnected", r[r.failed = 4] = "failed", r[r.closed = 5] = "closed", r))(Oi || {}),
|
|
130
|
+
var sn = rn();
|
|
131
|
+
const te = /* @__PURE__ */ Ge(sn);
|
|
132
|
+
var S = /* @__PURE__ */ ((r) => (r.Camera = "camera", r.Screen = "screen", r.VideoFile = "videoFile", r.Microphone = "microphone", r.AudioFile = "audioFile", r.Image = "image", r.MixAudio = "mixAudio", r.MixVideo = "mixVideo", r.CustomVideo = "customVideo", r.CustomAudio = "customAudio", r))(S || {}), j = /* @__PURE__ */ ((r) => (r.DeviceCaptured = "deviceCaptured", r.DeviceStopCapture = "deviceStopCapture", r.Error = "error", r.Interrupted = "interrupted", r))(j || {}), w = /* @__PURE__ */ ((r) => (r.PushStart = "pushStart", r.PushStop = "pushStop", r.PushError = "pushError", r.RTCConnectStateChanged = "rtcConnectStateChanged", r.CaptureFirstVideoFrame = "capturefirstvideoframe", r.CaptureFirstAudioFrame = "capturefirstaudioframe", r.NotAllowedAutoPlay = "notallowedautoplay", r))(w || {}), Ri = /* @__PURE__ */ ((r) => (r["120p"] = "160x120x15x200", r["180p"] = "320x180x15x350", r["240p"] = "320x240x15x400", r["360p"] = "640x360x15x800", r["480p"] = "640x480x15x900", r["720p-1"] = "1280x720x15x1500", r["720p-2"] = "1280x720x25x1500", r["720p-3"] = "1280x720x30x1500", r["1080p-1"] = "1920x1080x15x2080", r["1080p-2"] = "1920x1080x25x3000", r["1080p-3"] = "1920x1080x30x3150", r))(Ri || {}), Ai = /* @__PURE__ */ ((r) => (r["120p"] = "120x160x15x200", r["180p"] = "180x320x15x350", r["240p"] = "240x320x15x400", r["360p"] = "360x640x15x800", r["480p"] = "480x640x15x900", r["720p-1"] = "720x1280x15x1500", r["720p-2"] = "720x1280x25x1500", r["720p-3"] = "720x1280x30x1500", r["1080p-1"] = "1080x1920x15x2080", r["1080p-2"] = "1080x1920x25x3000", r["1080p-3"] = "1080x1920x30x3150", r))(Ai || {}), wi = /* @__PURE__ */ ((r) => (r.STANDARD = "48000x40", r.HIGH = "48000x128", r))(wi || {}), ie = /* @__PURE__ */ ((r) => (r.VideoStreamChange = "videoStreamChange", r.AudioStreamChange = "audioStreamChange", r))(ie || {}), Oi = /* @__PURE__ */ ((r) => (r[r.init = -1] = "init", r[r.new = 0] = "new", r[r.connecting = 1] = "connecting", r[r.connected = 2] = "connected", r[r.disconnected = 3] = "disconnected", r[r.failed = 4] = "failed", r[r.closed = 5] = "closed", r))(Oi || {}), Nt = /* @__PURE__ */ ((r) => (r.SizeChange = "sizeChange", r))(Nt || {}), gt = /* @__PURE__ */ ((r) => (r.Portrait = "portrait", r.Landscape = "landscape", r))(gt || {});
|
|
133
133
|
const Ii = "720p-1", Mi = "STANDARD";
|
|
134
134
|
var y = /* @__PURE__ */ ((r) => (r.TRACK_NOT_AVAILABLE = "track-not-available", r.UNEXPECTED_TYPE = "unexpected-type", r.PLAY_FAILED = "play-failed", r.CAPTURE_FAILED = "capture-failed", r.NOT_SUPPORTED = "not-supported", r.UNEXPECTED_ERROR = "unexpected-error", r))(y || {}), E = /* @__PURE__ */ ((r) => (r.AUDIO = "audio", r.VIDEO = "video", r))(E || {}), I = /* @__PURE__ */ ((r) => (r.ENDED = "ended", r.MUTE = "mute", r.UNMUTE = "unmute", r.PLAY_FAILED = "play-failed", r.SIZE_CHANGE = "size-change", r))(I || {});
|
|
135
135
|
const O = [];
|
|
136
136
|
for (let r = 0; r < 256; ++r)
|
|
137
137
|
O.push((r + 256).toString(16).slice(1));
|
|
138
|
-
function
|
|
138
|
+
function nn(r, e = 0) {
|
|
139
139
|
return (O[r[e + 0]] + O[r[e + 1]] + O[r[e + 2]] + O[r[e + 3]] + "-" + O[r[e + 4]] + O[r[e + 5]] + "-" + O[r[e + 6]] + O[r[e + 7]] + "-" + O[r[e + 8]] + O[r[e + 9]] + "-" + O[r[e + 10]] + O[r[e + 11]] + O[r[e + 12]] + O[r[e + 13]] + O[r[e + 14]] + O[r[e + 15]]).toLowerCase();
|
|
140
140
|
}
|
|
141
|
-
let
|
|
142
|
-
const
|
|
143
|
-
function
|
|
144
|
-
if (!
|
|
141
|
+
let ot;
|
|
142
|
+
const on = new Uint8Array(16);
|
|
143
|
+
function an() {
|
|
144
|
+
if (!ot) {
|
|
145
145
|
if (typeof crypto > "u" || !crypto.getRandomValues)
|
|
146
146
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
147
|
-
|
|
147
|
+
ot = crypto.getRandomValues.bind(crypto);
|
|
148
148
|
}
|
|
149
|
-
return
|
|
149
|
+
return ot(on);
|
|
150
150
|
}
|
|
151
|
-
const
|
|
151
|
+
const cn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), kr = { randomUUID: cn };
|
|
152
152
|
function oe(r, e, t) {
|
|
153
153
|
var s;
|
|
154
154
|
if (kr.randomUUID && !r)
|
|
155
155
|
return kr.randomUUID();
|
|
156
156
|
r = r || {};
|
|
157
|
-
const i = r.random ?? ((s = r.rng) == null ? void 0 : s.call(r)) ??
|
|
157
|
+
const i = r.random ?? ((s = r.rng) == null ? void 0 : s.call(r)) ?? an();
|
|
158
158
|
if (i.length < 16)
|
|
159
159
|
throw new Error("Random bytes length must be >= 16");
|
|
160
|
-
return i[6] = i[6] & 15 | 64, i[8] = i[8] & 63 | 128,
|
|
160
|
+
return i[6] = i[6] & 15 | 64, i[8] = i[8] & 63 | 128, nn(i);
|
|
161
161
|
}
|
|
162
162
|
class Di {
|
|
163
163
|
constructor() {
|
|
@@ -207,7 +207,7 @@ class Pr extends Di {
|
|
|
207
207
|
this._g = t, this._node && (this._node.gain.value = t);
|
|
208
208
|
}
|
|
209
209
|
}
|
|
210
|
-
class
|
|
210
|
+
class dn extends Di {
|
|
211
211
|
constructor(t) {
|
|
212
212
|
super();
|
|
213
213
|
m(this, "previousNode", null);
|
|
@@ -221,7 +221,7 @@ class cn extends Di {
|
|
|
221
221
|
super.destroy();
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
|
-
class
|
|
224
|
+
class un extends dn {
|
|
225
225
|
constructor() {
|
|
226
226
|
super(...arguments);
|
|
227
227
|
m(this, "_node");
|
|
@@ -230,7 +230,7 @@ class dn extends cn {
|
|
|
230
230
|
if (this._node)
|
|
231
231
|
return this._node;
|
|
232
232
|
let i;
|
|
233
|
-
if (this.source instanceof
|
|
233
|
+
if (this.source instanceof Bi) {
|
|
234
234
|
const s = this.source.element();
|
|
235
235
|
i = new MediaElementAudioSourceNode(t, {
|
|
236
236
|
mediaElement: s
|
|
@@ -262,8 +262,8 @@ const xr = {
|
|
|
262
262
|
warn: { color: "rgba(255, 119, 0, 0.3)", text: "WARN" },
|
|
263
263
|
err: { color: "rgba(255, 0, 0, 0.3)", text: "ERR " },
|
|
264
264
|
succ: { color: "rgba(0, 119, 0, 0.3)", text: "SUCC" }
|
|
265
|
-
}, Rr = "__debug__",
|
|
266
|
-
function
|
|
265
|
+
}, Rr = "__debug__", hn = "[VE-CAPTURE]";
|
|
266
|
+
function pn() {
|
|
267
267
|
if (typeof location > "u" || typeof localStorage > "u")
|
|
268
268
|
return !1;
|
|
269
269
|
let r = !1;
|
|
@@ -275,9 +275,9 @@ let L = class {
|
|
|
275
275
|
this.moduleName = e;
|
|
276
276
|
}
|
|
277
277
|
print(e, t, ...i) {
|
|
278
|
-
const s =
|
|
279
|
-
|
|
280
|
-
`${s}-${
|
|
278
|
+
const s = ln();
|
|
279
|
+
pn() && console.log(
|
|
280
|
+
`${s}-${hn}%c[${xr[e].text}]%c[${this.moduleName}][${t}]`,
|
|
281
281
|
`background-color:${xr[e].color};`,
|
|
282
282
|
"background-color:rgba(0, 0, 0, 0)",
|
|
283
283
|
...i
|
|
@@ -310,11 +310,11 @@ let L = class {
|
|
|
310
310
|
};
|
|
311
311
|
}
|
|
312
312
|
};
|
|
313
|
-
function
|
|
313
|
+
function ln() {
|
|
314
314
|
const r = /* @__PURE__ */ new Date();
|
|
315
315
|
return `${r.toTimeString().split(" ")[0]}:${r.getMilliseconds().toString().padStart(3, "0")}`;
|
|
316
316
|
}
|
|
317
|
-
function
|
|
317
|
+
function vt(r, e) {
|
|
318
318
|
const t = document.createElement(r);
|
|
319
319
|
return e.id && (t.id = e.id), e.classList && e.classList.forEach((i) => {
|
|
320
320
|
t.classList.add(i);
|
|
@@ -331,7 +331,7 @@ function Li({ width: r, height: e }) {
|
|
|
331
331
|
);
|
|
332
332
|
return t.width = r, t.height = e, t.style.width = "100%", t.style.height = "100%", { context: i, canvas: t };
|
|
333
333
|
}
|
|
334
|
-
class
|
|
334
|
+
class Vt {
|
|
335
335
|
constructor(e) {
|
|
336
336
|
m(this, "target");
|
|
337
337
|
m(this, "_eventDict", /* @__PURE__ */ new Map());
|
|
@@ -366,12 +366,12 @@ const x = () => typeof window > "u";
|
|
|
366
366
|
function P() {
|
|
367
367
|
return navigator.userAgent.toLowerCase();
|
|
368
368
|
}
|
|
369
|
-
function
|
|
369
|
+
function Ut(r = P()) {
|
|
370
370
|
let e = "none";
|
|
371
371
|
return x() || (r.match("firefox") !== null ? e = "firefox" : r.match("Chrome") !== null ? (e = "chrome", r.match("Electron") !== null && (e = "electron")) : (r.match("Safari") !== null || r.match("AppleWebKit") !== null) && (e = "safari")), e;
|
|
372
372
|
}
|
|
373
|
-
const
|
|
374
|
-
|
|
373
|
+
const Fi = Ut() === "firefox", He = Ut() === "safari";
|
|
374
|
+
Ut();
|
|
375
375
|
!x() && /crios/i.test(P());
|
|
376
376
|
!x() && /edg\//i.test(P());
|
|
377
377
|
!x() && /edgA/i.test(P());
|
|
@@ -384,67 +384,67 @@ Vt();
|
|
|
384
384
|
!x() && /micromessenger/i.test(P());
|
|
385
385
|
!x() && P().includes("mobile");
|
|
386
386
|
!x() && /sm-\w+/i.test(P());
|
|
387
|
-
!x() &&
|
|
387
|
+
const mn = !x() && !!/(iphone|ipad|ipod)/i.exec(P());
|
|
388
388
|
!x() && /android/i.test(P());
|
|
389
389
|
!x() && /windows/i.test(P());
|
|
390
390
|
!x() && /openharmony/i.test(P());
|
|
391
|
-
let
|
|
391
|
+
let Ni = "0";
|
|
392
392
|
var Ti;
|
|
393
|
-
const
|
|
393
|
+
const fn = !x() && ((Ti = P().match(/version\/(\d+)/i)) == null ? void 0 : Ti[1]);
|
|
394
394
|
var Ei;
|
|
395
|
-
|
|
395
|
+
He && fn && (Ni = (Ei = navigator.userAgent.match(/version\/(\d+\.\d+)/i)) == null ? void 0 : Ei[1]);
|
|
396
396
|
var bi;
|
|
397
397
|
!x() && ((bi = P().match(/firefox\/(\d+)/i)) == null || bi[1]);
|
|
398
|
-
const
|
|
398
|
+
const Ct = Ni;
|
|
399
399
|
var ki, Pi;
|
|
400
400
|
!x() && ((Pi = (ki = P().match(/ ([\d_]+) like mac os x/i)) == null ? void 0 : ki[1]) == null || Pi.split("_").map((r) => parseInt(r)));
|
|
401
401
|
var xi;
|
|
402
402
|
!x() && ((xi = P().match(/chrome\/(\d+)/i)) == null || xi[1]);
|
|
403
|
-
function
|
|
403
|
+
function _n() {
|
|
404
404
|
var r;
|
|
405
405
|
return !!((r = navigator == null ? void 0 : navigator.permissions) != null && r.query);
|
|
406
406
|
}
|
|
407
407
|
function $t() {
|
|
408
408
|
return !!(navigator != null && navigator.mediaDevices);
|
|
409
409
|
}
|
|
410
|
-
function
|
|
410
|
+
function gn() {
|
|
411
411
|
var r;
|
|
412
412
|
return $t() && !!((r = navigator == null ? void 0 : navigator.mediaDevices) != null && r.getUserMedia);
|
|
413
413
|
}
|
|
414
|
-
function gn() {
|
|
415
|
-
return !!Promise.withResolvers;
|
|
416
|
-
}
|
|
417
414
|
function vn() {
|
|
418
|
-
return
|
|
415
|
+
return !!Promise.withResolvers;
|
|
419
416
|
}
|
|
420
417
|
function Cn() {
|
|
421
|
-
return !(
|
|
418
|
+
return !(He && Ct === "16.1");
|
|
422
419
|
}
|
|
423
420
|
function yn() {
|
|
424
|
-
return !
|
|
421
|
+
return !(He && Ct && ["16.1", "16.2", "16.3"].includes(Ct));
|
|
425
422
|
}
|
|
426
423
|
function Sn() {
|
|
424
|
+
return !Fi;
|
|
425
|
+
}
|
|
426
|
+
function Tn() {
|
|
427
427
|
return typeof CanvasCaptureMediaStreamTrack < "u";
|
|
428
428
|
}
|
|
429
|
-
function
|
|
429
|
+
function En(r) {
|
|
430
430
|
return typeof r.requestFrame == "function";
|
|
431
431
|
}
|
|
432
|
-
function
|
|
432
|
+
function bn() {
|
|
433
433
|
return !!$t() && typeof navigator.mediaDevices.ondevicechange < "u" && typeof navigator.mediaDevices.addEventListener == "function";
|
|
434
434
|
}
|
|
435
435
|
const G = {
|
|
436
|
-
permissionQuery:
|
|
436
|
+
permissionQuery: _n,
|
|
437
437
|
mediaDevices: $t,
|
|
438
|
-
settingResolutionInGetDisplayMedia:
|
|
439
|
-
promiseWithResolvers:
|
|
440
|
-
getUserMedia:
|
|
441
|
-
isolateEnumerateDevices:
|
|
442
|
-
supportIdealParamsInGetDisplayMedia:
|
|
443
|
-
canvasCaptureMediaStreamTrack:
|
|
444
|
-
requestFrameOnMediaStream:
|
|
445
|
-
ondevicechange:
|
|
438
|
+
settingResolutionInGetDisplayMedia: Cn,
|
|
439
|
+
promiseWithResolvers: vn,
|
|
440
|
+
getUserMedia: gn,
|
|
441
|
+
isolateEnumerateDevices: Sn,
|
|
442
|
+
supportIdealParamsInGetDisplayMedia: yn,
|
|
443
|
+
canvasCaptureMediaStreamTrack: Tn,
|
|
444
|
+
requestFrameOnMediaStream: En,
|
|
445
|
+
ondevicechange: bn
|
|
446
446
|
};
|
|
447
|
-
function
|
|
447
|
+
function kn() {
|
|
448
448
|
if (G.promiseWithResolvers())
|
|
449
449
|
return Promise.withResolvers();
|
|
450
450
|
let r, e;
|
|
@@ -455,12 +455,12 @@ function bn() {
|
|
|
455
455
|
throw Error("resolver and rejector working unexpected");
|
|
456
456
|
return { promise: t, resolve: r, reject: e };
|
|
457
457
|
}
|
|
458
|
-
function
|
|
458
|
+
function Vi(r = {}) {
|
|
459
459
|
const { timeout: e, message: t } = {
|
|
460
460
|
timeout: 0,
|
|
461
461
|
message: new C(y.UNEXPECTED_ERROR, "unexpected timeout"),
|
|
462
462
|
...r
|
|
463
|
-
}, { promise: i, resolve: s, reject: n } =
|
|
463
|
+
}, { promise: i, resolve: s, reject: n } = kn();
|
|
464
464
|
if (e <= 0)
|
|
465
465
|
return { promise: i, resolve: s, reject: n };
|
|
466
466
|
const a = setTimeout(() => {
|
|
@@ -474,7 +474,7 @@ function Ni(r = {}) {
|
|
|
474
474
|
reject: n
|
|
475
475
|
};
|
|
476
476
|
}
|
|
477
|
-
const
|
|
477
|
+
const Pn = {
|
|
478
478
|
playsinline: "",
|
|
479
479
|
"webkit-playsinline": "",
|
|
480
480
|
"x5-playsinline": "",
|
|
@@ -483,7 +483,7 @@ const kn = {
|
|
|
483
483
|
preload: "metadata",
|
|
484
484
|
muted: "",
|
|
485
485
|
crossOrigin: "anonymous"
|
|
486
|
-
},
|
|
486
|
+
}, xn = {
|
|
487
487
|
playsinline: "",
|
|
488
488
|
"webkit-playsinline": "",
|
|
489
489
|
preload: "metadata",
|
|
@@ -503,19 +503,19 @@ class be {
|
|
|
503
503
|
let i;
|
|
504
504
|
if (e instanceof MediaStreamTrack) {
|
|
505
505
|
const o = new MediaStream([e]);
|
|
506
|
-
i =
|
|
506
|
+
i = Rn(o), this._stream = o;
|
|
507
507
|
} else if (e.url)
|
|
508
|
-
i =
|
|
508
|
+
i = An(e);
|
|
509
509
|
else
|
|
510
510
|
throw new C(
|
|
511
511
|
y.UNEXPECTED_TYPE,
|
|
512
512
|
`got ${typeof e}, expected: MediaStreamTrack or constraints for creating element`
|
|
513
513
|
);
|
|
514
|
-
const { promise: s, resolve: n, reject: a } =
|
|
514
|
+
const { promise: s, resolve: n, reject: a } = Vi({
|
|
515
515
|
timeout: 2e3,
|
|
516
516
|
message: new C(y.PLAY_FAILED, "load media timeout")
|
|
517
517
|
});
|
|
518
|
-
this._readyLock = s, this._releaseReadyLock = n, this._throwReadyLock = a, this._element = new
|
|
518
|
+
this._readyLock = s, this._releaseReadyLock = n, this._throwReadyLock = a, this._element = new Vt(i), this._bindPlayerEvent(this._element), this._referenceTracks = [...t];
|
|
519
519
|
}
|
|
520
520
|
addReferenceTrack(e) {
|
|
521
521
|
this._referenceTracks.push(e);
|
|
@@ -609,33 +609,33 @@ class be {
|
|
|
609
609
|
});
|
|
610
610
|
}
|
|
611
611
|
}
|
|
612
|
-
function
|
|
612
|
+
function Rn(r) {
|
|
613
613
|
let e = "audio";
|
|
614
614
|
r.getVideoTracks().length > 0 && (e = "video");
|
|
615
|
-
const t =
|
|
615
|
+
const t = Ui(
|
|
616
616
|
e === "video" ? E.VIDEO : E.AUDIO
|
|
617
617
|
);
|
|
618
618
|
return t.srcObject = r, t;
|
|
619
619
|
}
|
|
620
|
-
function
|
|
621
|
-
const { url: e, kind: t, loop: i } = r, s =
|
|
620
|
+
function An(r) {
|
|
621
|
+
const { url: e, kind: t, loop: i } = r, s = Ui(t);
|
|
622
622
|
return s.src = e, s.loop = i, s;
|
|
623
623
|
}
|
|
624
|
-
function
|
|
624
|
+
function Ui(r) {
|
|
625
625
|
if (r === E.VIDEO)
|
|
626
|
-
return
|
|
626
|
+
return vt(E.VIDEO, {
|
|
627
627
|
style: {
|
|
628
628
|
width: "100%",
|
|
629
629
|
height: "100%"
|
|
630
630
|
},
|
|
631
|
-
attributes:
|
|
631
|
+
attributes: Pn
|
|
632
632
|
});
|
|
633
633
|
if (r === E.AUDIO)
|
|
634
|
-
return
|
|
634
|
+
return vt(E.AUDIO, {
|
|
635
635
|
style: {
|
|
636
636
|
display: "none"
|
|
637
637
|
},
|
|
638
|
-
attributes:
|
|
638
|
+
attributes: xn
|
|
639
639
|
});
|
|
640
640
|
throw new C(
|
|
641
641
|
y.UNEXPECTED_TYPE,
|
|
@@ -676,7 +676,7 @@ class Bt extends te {
|
|
|
676
676
|
return super.once(e, s, i);
|
|
677
677
|
}
|
|
678
678
|
}
|
|
679
|
-
function
|
|
679
|
+
function at(r) {
|
|
680
680
|
if (typeof r == "number")
|
|
681
681
|
return r;
|
|
682
682
|
if (typeof (r == null ? void 0 : r.exact) == "number")
|
|
@@ -689,8 +689,8 @@ function ot(r) {
|
|
|
689
689
|
return r.min;
|
|
690
690
|
throw new C(y.UNEXPECTED_TYPE, "unexpected constraints type");
|
|
691
691
|
}
|
|
692
|
-
const
|
|
693
|
-
class
|
|
692
|
+
const yt = 1e3;
|
|
693
|
+
class $i {
|
|
694
694
|
constructor(e) {
|
|
695
695
|
m(this, "id", oe());
|
|
696
696
|
m(this, "_context");
|
|
@@ -703,17 +703,17 @@ class Ui {
|
|
|
703
703
|
m(this, "_loopTimer");
|
|
704
704
|
m(this, "_referenceTracks", []);
|
|
705
705
|
m(this, "_stream");
|
|
706
|
-
const t =
|
|
706
|
+
const t = at(e.width), i = at(e.height), s = at(e.frameRate);
|
|
707
707
|
this._config = { width: t, height: i, frameRate: s };
|
|
708
708
|
const { context: n, canvas: a } = Li({ width: t, height: i });
|
|
709
709
|
this._context = n, this._canvas = a;
|
|
710
|
-
const o =
|
|
711
|
-
this._image = new
|
|
712
|
-
const { promise: u, resolve:
|
|
710
|
+
const o = wn({ url: e.url, width: t, height: i });
|
|
711
|
+
this._image = new Vt(o);
|
|
712
|
+
const { promise: u, resolve: d, reject: c } = Vi({
|
|
713
713
|
timeout: 2e3,
|
|
714
714
|
message: new C(y.PLAY_FAILED, "load image timeout")
|
|
715
715
|
});
|
|
716
|
-
this._readyLock = u, this._releaseReadyLock =
|
|
716
|
+
this._readyLock = u, this._releaseReadyLock = d, this._throwReadyLock = c, this._bindImageEvent(this._image);
|
|
717
717
|
}
|
|
718
718
|
track() {
|
|
719
719
|
this._paint();
|
|
@@ -750,7 +750,7 @@ class Ui {
|
|
|
750
750
|
const { width: e, height: t, frameRate: i } = this._config;
|
|
751
751
|
this._context.drawImage(this._image.target, 0, 0, e, t), this._loopTimer && clearTimeout(this._loopTimer), this._loopTimer = setTimeout(
|
|
752
752
|
this._paint.bind(this),
|
|
753
|
-
|
|
753
|
+
yt / i
|
|
754
754
|
);
|
|
755
755
|
}
|
|
756
756
|
addReferenceTrack(e) {
|
|
@@ -762,12 +762,12 @@ class Ui {
|
|
|
762
762
|
}
|
|
763
763
|
// destroy() {}
|
|
764
764
|
}
|
|
765
|
-
function
|
|
765
|
+
function wn({
|
|
766
766
|
url: r,
|
|
767
767
|
height: e,
|
|
768
768
|
width: t
|
|
769
769
|
}) {
|
|
770
|
-
const i =
|
|
770
|
+
const i = vt("img", {
|
|
771
771
|
style: {
|
|
772
772
|
width: `${t}px`,
|
|
773
773
|
height: `${e}px`
|
|
@@ -784,7 +784,7 @@ class jt extends Bt {
|
|
|
784
784
|
m(this, "id", oe());
|
|
785
785
|
m(this, "_track");
|
|
786
786
|
m(this, "_element");
|
|
787
|
-
t instanceof MediaStreamTrack ? (this._track = new
|
|
787
|
+
t instanceof MediaStreamTrack ? (this._track = new Vt(t), this._bindTrackEvent(this._track)) : t instanceof be ? (this._element = t, t.addReferenceTrack(this)) : t instanceof $i && (this._element = t);
|
|
788
788
|
}
|
|
789
789
|
_bindTrackEvent(t) {
|
|
790
790
|
t.on("ended", this._handleTrackEnded.bind(this)), t.on("mute", () => {
|
|
@@ -841,7 +841,7 @@ class jt extends Bt {
|
|
|
841
841
|
(t = this._track) == null || t.clearAll(), (i = this._track) == null || i.target.stop(), this._track && delete this._track, (s = this._element) == null || s.removeReference(this), delete this._element;
|
|
842
842
|
}
|
|
843
843
|
}
|
|
844
|
-
class
|
|
844
|
+
class qe extends jt {
|
|
845
845
|
constructor() {
|
|
846
846
|
super(...arguments);
|
|
847
847
|
m(this, "kind", E.AUDIO);
|
|
@@ -855,7 +855,7 @@ class He extends jt {
|
|
|
855
855
|
);
|
|
856
856
|
if (this._node)
|
|
857
857
|
return this._node;
|
|
858
|
-
const t = new
|
|
858
|
+
const t = new un(this);
|
|
859
859
|
return this._node = t, t;
|
|
860
860
|
}
|
|
861
861
|
/** overwrite in AudioTrack */
|
|
@@ -890,19 +890,19 @@ class He extends jt {
|
|
|
890
890
|
this.logger.warn("destroy", this.id), (t = this._node) == null || t.destroy(), super.destroy();
|
|
891
891
|
}
|
|
892
892
|
}
|
|
893
|
-
class
|
|
893
|
+
class On extends qe {
|
|
894
894
|
constructor() {
|
|
895
895
|
super(...arguments);
|
|
896
896
|
m(this, "logger", new L("MicrophoneAudioTrack"));
|
|
897
897
|
}
|
|
898
898
|
}
|
|
899
|
-
class
|
|
899
|
+
class In extends qe {
|
|
900
900
|
constructor() {
|
|
901
901
|
super(...arguments);
|
|
902
902
|
m(this, "logger", new L("ScreenAudioTrack"));
|
|
903
903
|
}
|
|
904
904
|
}
|
|
905
|
-
class
|
|
905
|
+
class Bi extends qe {
|
|
906
906
|
constructor() {
|
|
907
907
|
super(...arguments);
|
|
908
908
|
m(this, "logger", new L("MediaAudioTrack"));
|
|
@@ -921,35 +921,35 @@ class $i extends He {
|
|
|
921
921
|
}
|
|
922
922
|
}
|
|
923
923
|
}
|
|
924
|
-
class
|
|
924
|
+
class Mn extends qe {
|
|
925
925
|
constructor() {
|
|
926
926
|
super(...arguments);
|
|
927
927
|
m(this, "logger", new L("CustomAudioTrack"));
|
|
928
928
|
}
|
|
929
929
|
}
|
|
930
|
-
let
|
|
931
|
-
const
|
|
932
|
-
class
|
|
930
|
+
let Dn = 1;
|
|
931
|
+
const ct = new L("PromiseQueue");
|
|
932
|
+
class Ln {
|
|
933
933
|
constructor(e) {
|
|
934
934
|
m(this, "lockingPromise", Promise.resolve());
|
|
935
935
|
m(this, "locks", 0);
|
|
936
936
|
m(this, "name", "");
|
|
937
937
|
m(this, "lockId");
|
|
938
938
|
m(this, "closeReason");
|
|
939
|
-
this.lockId =
|
|
939
|
+
this.lockId = Dn++, e && (this.name = e), ct.info(`lock-${this.name}-${this.lockId}`, "is created.");
|
|
940
940
|
}
|
|
941
941
|
get isLocked() {
|
|
942
942
|
return this.locks > 0;
|
|
943
943
|
}
|
|
944
944
|
lock() {
|
|
945
|
-
this.locks += 1,
|
|
945
|
+
this.locks += 1, ct.info(
|
|
946
946
|
`lock-${this.name}-${this.lockId}`,
|
|
947
947
|
`locked, current queue ${this.locks}.`
|
|
948
948
|
);
|
|
949
949
|
let e;
|
|
950
950
|
const t = new Promise((s) => {
|
|
951
951
|
e = () => {
|
|
952
|
-
this.locks -= 1,
|
|
952
|
+
this.locks -= 1, ct.info(
|
|
953
953
|
`lock-${this.name}-${this.lockId}`,
|
|
954
954
|
`unlocked, current queue ${this.locks}.`
|
|
955
955
|
), s();
|
|
@@ -958,8 +958,8 @@ class Dn {
|
|
|
958
958
|
return this.lockingPromise = this.lockingPromise.then(() => t), i;
|
|
959
959
|
}
|
|
960
960
|
}
|
|
961
|
-
const
|
|
962
|
-
class
|
|
961
|
+
const Fn = 300, Nn = 3e3, B = new L("Devices");
|
|
962
|
+
class Vn extends Bt {
|
|
963
963
|
constructor() {
|
|
964
964
|
super();
|
|
965
965
|
/** 存储 SDK 已知的设备列表 */
|
|
@@ -973,7 +973,7 @@ class Nn extends Bt {
|
|
|
973
973
|
[E.AUDIO]: !1,
|
|
974
974
|
[E.VIDEO]: !1
|
|
975
975
|
});
|
|
976
|
-
m(this, "_changedQueue", new
|
|
976
|
+
m(this, "_changedQueue", new Ln("device changed queue"));
|
|
977
977
|
this._init();
|
|
978
978
|
}
|
|
979
979
|
async _init() {
|
|
@@ -988,13 +988,13 @@ class Nn extends Bt {
|
|
|
988
988
|
"no supported, use timer instead"
|
|
989
989
|
), setInterval(() => {
|
|
990
990
|
this._handleDeviceChanged();
|
|
991
|
-
},
|
|
991
|
+
}, Nn);
|
|
992
992
|
return;
|
|
993
993
|
}
|
|
994
994
|
G.ondevicechange() && navigator.mediaDevices.addEventListener("devicechange", () => {
|
|
995
995
|
B.info("devicechange"), setTimeout(() => {
|
|
996
996
|
this._handleDeviceChanged();
|
|
997
|
-
},
|
|
997
|
+
}, Fn);
|
|
998
998
|
});
|
|
999
999
|
}
|
|
1000
1000
|
async _initPermissionChanged() {
|
|
@@ -1176,23 +1176,23 @@ function Ir(r) {
|
|
|
1176
1176
|
const e = [];
|
|
1177
1177
|
return r.audio && e.push(E.AUDIO), r.video && e.push(E.VIDEO), e;
|
|
1178
1178
|
}
|
|
1179
|
-
const
|
|
1179
|
+
const St = new Vn();
|
|
1180
1180
|
class zt {
|
|
1181
1181
|
constructor() {
|
|
1182
1182
|
m(this, "id", oe());
|
|
1183
1183
|
}
|
|
1184
1184
|
position(e, t) {
|
|
1185
|
-
return new
|
|
1185
|
+
return new Un(this, { x: e, y: t });
|
|
1186
1186
|
}
|
|
1187
1187
|
scale(e) {
|
|
1188
|
-
return new
|
|
1188
|
+
return new $n(this, { s: e });
|
|
1189
1189
|
}
|
|
1190
1190
|
available() {
|
|
1191
1191
|
var e;
|
|
1192
1192
|
return ((e = this.previousNode) == null ? void 0 : e.available()) ?? !1;
|
|
1193
1193
|
}
|
|
1194
1194
|
}
|
|
1195
|
-
class
|
|
1195
|
+
class Un extends zt {
|
|
1196
1196
|
constructor(t, i) {
|
|
1197
1197
|
super();
|
|
1198
1198
|
m(this, "previousNode");
|
|
@@ -1204,7 +1204,7 @@ class Vn extends zt {
|
|
|
1204
1204
|
t.translate(this._x, this._y);
|
|
1205
1205
|
}
|
|
1206
1206
|
}
|
|
1207
|
-
class
|
|
1207
|
+
class $n extends zt {
|
|
1208
1208
|
constructor(t, i) {
|
|
1209
1209
|
super();
|
|
1210
1210
|
m(this, "previousNode");
|
|
@@ -1215,7 +1215,7 @@ class Un extends zt {
|
|
|
1215
1215
|
t.scale(this._s, this._s);
|
|
1216
1216
|
}
|
|
1217
1217
|
}
|
|
1218
|
-
class
|
|
1218
|
+
class Bn extends zt {
|
|
1219
1219
|
constructor(t) {
|
|
1220
1220
|
super();
|
|
1221
1221
|
m(this, "previousNode", null);
|
|
@@ -1226,7 +1226,7 @@ class $n extends zt {
|
|
|
1226
1226
|
return this._source.available();
|
|
1227
1227
|
}
|
|
1228
1228
|
}
|
|
1229
|
-
class
|
|
1229
|
+
class We extends Bn {
|
|
1230
1230
|
constructor(t, i) {
|
|
1231
1231
|
super(t);
|
|
1232
1232
|
m(this, "_targetWidth");
|
|
@@ -1235,7 +1235,7 @@ class qe extends $n {
|
|
|
1235
1235
|
this._targetWidth = s ?? this._source.width(), this._targetHeight = n ?? this._source.height();
|
|
1236
1236
|
}
|
|
1237
1237
|
size(t, i) {
|
|
1238
|
-
return new
|
|
1238
|
+
return new We(this._source, { width: t, height: i });
|
|
1239
1239
|
}
|
|
1240
1240
|
paint(t) {
|
|
1241
1241
|
const i = this._targetWidth, s = this._targetHeight;
|
|
@@ -1248,7 +1248,7 @@ class qe extends $n {
|
|
|
1248
1248
|
);
|
|
1249
1249
|
}
|
|
1250
1250
|
}
|
|
1251
|
-
class
|
|
1251
|
+
class jn extends jt {
|
|
1252
1252
|
constructor() {
|
|
1253
1253
|
super(...arguments);
|
|
1254
1254
|
m(this, "logger", new L("PictureTrack"));
|
|
@@ -1277,15 +1277,15 @@ class Bn extends jt {
|
|
|
1277
1277
|
y.TRACK_NOT_AVAILABLE,
|
|
1278
1278
|
"track is not avaiable when creating node"
|
|
1279
1279
|
);
|
|
1280
|
-
const t = new
|
|
1280
|
+
const t = new We(this);
|
|
1281
1281
|
return this.logger.info("node", t), t;
|
|
1282
1282
|
}
|
|
1283
1283
|
destroy() {
|
|
1284
1284
|
this.logger.warn("destroy"), super.destroy();
|
|
1285
1285
|
}
|
|
1286
1286
|
}
|
|
1287
|
-
const
|
|
1288
|
-
class
|
|
1287
|
+
const zn = 500;
|
|
1288
|
+
class Xe extends jt {
|
|
1289
1289
|
constructor() {
|
|
1290
1290
|
super(...arguments);
|
|
1291
1291
|
m(this, "kind", E.VIDEO);
|
|
@@ -1299,7 +1299,7 @@ class We extends jt {
|
|
|
1299
1299
|
width: s,
|
|
1300
1300
|
height: n
|
|
1301
1301
|
});
|
|
1302
|
-
},
|
|
1302
|
+
}, zn);
|
|
1303
1303
|
});
|
|
1304
1304
|
}
|
|
1305
1305
|
element() {
|
|
@@ -1317,13 +1317,13 @@ class We extends jt {
|
|
|
1317
1317
|
y.TRACK_NOT_AVAILABLE,
|
|
1318
1318
|
"track is not avaiable when creating node"
|
|
1319
1319
|
);
|
|
1320
|
-
return new
|
|
1320
|
+
return new We(this);
|
|
1321
1321
|
}
|
|
1322
1322
|
destroy() {
|
|
1323
1323
|
clearTimeout(this.sizeChangeTimer), super.destroy();
|
|
1324
1324
|
}
|
|
1325
1325
|
}
|
|
1326
|
-
class
|
|
1326
|
+
class Gn extends Xe {
|
|
1327
1327
|
constructor(t) {
|
|
1328
1328
|
super(t);
|
|
1329
1329
|
m(this, "logger", new L("CameraVideoTrack"));
|
|
@@ -1338,7 +1338,7 @@ class zn extends We {
|
|
|
1338
1338
|
return t ?? 0;
|
|
1339
1339
|
}
|
|
1340
1340
|
}
|
|
1341
|
-
class
|
|
1341
|
+
class Hn extends Xe {
|
|
1342
1342
|
constructor(t) {
|
|
1343
1343
|
super(t);
|
|
1344
1344
|
m(this, "logger", new L("ScreenVideoTrack"));
|
|
@@ -1353,7 +1353,7 @@ class Gn extends We {
|
|
|
1353
1353
|
return t ?? 0;
|
|
1354
1354
|
}
|
|
1355
1355
|
}
|
|
1356
|
-
class
|
|
1356
|
+
class qn extends Xe {
|
|
1357
1357
|
constructor() {
|
|
1358
1358
|
super(...arguments);
|
|
1359
1359
|
m(this, "logger", new L("MediaVideoTrack"));
|
|
@@ -1367,7 +1367,7 @@ class Hn extends We {
|
|
|
1367
1367
|
return t ?? 0;
|
|
1368
1368
|
}
|
|
1369
1369
|
}
|
|
1370
|
-
class
|
|
1370
|
+
class Wn extends Xe {
|
|
1371
1371
|
constructor() {
|
|
1372
1372
|
super(...arguments);
|
|
1373
1373
|
m(this, "logger", new L("CustomVideoTrack"));
|
|
@@ -1381,7 +1381,7 @@ class qn extends We {
|
|
|
1381
1381
|
return t ?? 0;
|
|
1382
1382
|
}
|
|
1383
1383
|
}
|
|
1384
|
-
function
|
|
1384
|
+
function ji(r, e) {
|
|
1385
1385
|
let t;
|
|
1386
1386
|
if (e != null && e.frameRate && typeof e.frameRate == "number" && (t = e.frameRate), t)
|
|
1387
1387
|
try {
|
|
@@ -1396,13 +1396,13 @@ function Bi(r, e) {
|
|
|
1396
1396
|
}
|
|
1397
1397
|
}
|
|
1398
1398
|
const q = new L("Capture");
|
|
1399
|
-
async function Wn(r) {
|
|
1400
|
-
return yt.enumerateDevices(r);
|
|
1401
|
-
}
|
|
1402
1399
|
async function Xn(r) {
|
|
1403
|
-
|
|
1400
|
+
return St.enumerateDevices(r);
|
|
1404
1401
|
}
|
|
1405
1402
|
async function Kn(r) {
|
|
1403
|
+
St.removeAllListeners("onDeviceStateChanged"), St.on("onDeviceStateChanged", r);
|
|
1404
|
+
}
|
|
1405
|
+
async function Jn(r) {
|
|
1406
1406
|
let e;
|
|
1407
1407
|
try {
|
|
1408
1408
|
const i = { video: r ?? !0 };
|
|
@@ -1415,11 +1415,11 @@ async function Kn(r) {
|
|
|
1415
1415
|
);
|
|
1416
1416
|
}
|
|
1417
1417
|
const t = e.getVideoTracks()[0];
|
|
1418
|
-
if (r != null && r.frameRate &&
|
|
1418
|
+
if (r != null && r.frameRate && ji(t, r), !t)
|
|
1419
1419
|
throw new C(y.UNEXPECTED_TYPE, "got falsy in track");
|
|
1420
|
-
return new
|
|
1420
|
+
return new Gn(t);
|
|
1421
1421
|
}
|
|
1422
|
-
async function
|
|
1422
|
+
async function Yn(r, e) {
|
|
1423
1423
|
const { video: t, audio: i } = r;
|
|
1424
1424
|
let s = t === !0 ? {} : t;
|
|
1425
1425
|
e != null && e.displaySurface && (s.displaySurface = e.displaySurface, delete e.displaySurface), G.settingResolutionInGetDisplayMedia() || (s = !0), !G.supportIdealParamsInGetDisplayMedia() && typeof s != "boolean" && (s.width && typeof s.width == "number" && (s.width = {
|
|
@@ -1434,33 +1434,33 @@ async function Jn(r, e) {
|
|
|
1434
1434
|
audio: i,
|
|
1435
1435
|
...e
|
|
1436
1436
|
});
|
|
1437
|
-
} catch (
|
|
1437
|
+
} catch (d) {
|
|
1438
1438
|
throw new C(
|
|
1439
1439
|
y.CAPTURE_FAILED,
|
|
1440
1440
|
"got error when capture screen",
|
|
1441
|
-
|
|
1441
|
+
d
|
|
1442
1442
|
);
|
|
1443
1443
|
}
|
|
1444
1444
|
const a = n.getVideoTracks()[0], o = n.getAudioTracks()[0];
|
|
1445
1445
|
if (!a)
|
|
1446
1446
|
throw new C(y.UNEXPECTED_TYPE, "got falsy in videoTrack");
|
|
1447
|
-
typeof s != "boolean" && typeof s.frameRate == "number" &&
|
|
1447
|
+
typeof s != "boolean" && typeof s.frameRate == "number" && ji(a, s);
|
|
1448
1448
|
const u = [];
|
|
1449
|
-
return u.push(new
|
|
1449
|
+
return u.push(new Hn(a)), o && u.push(new In(o)), u;
|
|
1450
1450
|
}
|
|
1451
|
-
async function
|
|
1451
|
+
async function Zn(r) {
|
|
1452
1452
|
const { url: e, audio: t, video: i, loop: s } = r, n = new be({
|
|
1453
1453
|
url: e,
|
|
1454
1454
|
kind: i ? E.VIDEO : E.AUDIO,
|
|
1455
1455
|
loop: s
|
|
1456
1456
|
}), a = [];
|
|
1457
|
-
return t && a.push(new
|
|
1458
|
-
}
|
|
1459
|
-
async function Zn(r) {
|
|
1460
|
-
const e = new Ui(r);
|
|
1461
|
-
return await e.isReady(), new Bn(e);
|
|
1457
|
+
return t && a.push(new Bi(n)), i && a.push(new qn(n)), await n.isReady(), a;
|
|
1462
1458
|
}
|
|
1463
1459
|
async function Qn(r) {
|
|
1460
|
+
const e = new $i(r);
|
|
1461
|
+
return await e.isReady(), new jn(e);
|
|
1462
|
+
}
|
|
1463
|
+
async function eo(r) {
|
|
1464
1464
|
let e;
|
|
1465
1465
|
try {
|
|
1466
1466
|
const i = { audio: r ?? !0 };
|
|
@@ -1475,31 +1475,31 @@ async function Qn(r) {
|
|
|
1475
1475
|
const t = e.getAudioTracks()[0];
|
|
1476
1476
|
if (!t)
|
|
1477
1477
|
throw new C(y.UNEXPECTED_TYPE, "got falsy in track");
|
|
1478
|
-
return new
|
|
1478
|
+
return new On(t);
|
|
1479
1479
|
}
|
|
1480
|
-
function
|
|
1480
|
+
function to(r) {
|
|
1481
1481
|
if (!r || r.kind !== "video")
|
|
1482
1482
|
throw new C(
|
|
1483
1483
|
y.UNEXPECTED_TYPE,
|
|
1484
1484
|
"error custom video track type"
|
|
1485
1485
|
);
|
|
1486
|
-
return new
|
|
1486
|
+
return new Wn(r);
|
|
1487
1487
|
}
|
|
1488
|
-
function
|
|
1488
|
+
function ro(r) {
|
|
1489
1489
|
if (!r || r.kind !== "audio")
|
|
1490
1490
|
throw new C(
|
|
1491
1491
|
y.UNEXPECTED_TYPE,
|
|
1492
1492
|
"error custom audio track type"
|
|
1493
1493
|
);
|
|
1494
|
-
return new
|
|
1494
|
+
return new Mn(r);
|
|
1495
1495
|
}
|
|
1496
|
-
const
|
|
1497
|
-
var
|
|
1498
|
-
const
|
|
1496
|
+
const io = q.invoke(Xn, "enumerateInputDevices"), so = q.invoke(Jn, "createCameraTrack"), no = q.invoke(Qn, "createPictureTrack"), Mr = q.invoke(Zn, "createMediaTracks"), oo = q.invoke(eo, "createMicrophoneTrack"), ao = q.invoke(Yn, "createScreenTracks"), co = q.invoke(Kn, "onDeviceChanged"), uo = q.invoke(to, "createCustomVideoTrack"), ho = q.invoke(ro, "createCustomAudioTrack");
|
|
1497
|
+
var Tt = /* @__PURE__ */ ((r) => (r.PAUSING = "pausing", r))(Tt || {});
|
|
1498
|
+
const po = {
|
|
1499
1499
|
sampleRate: 48e3,
|
|
1500
1500
|
keepAlive: !0
|
|
1501
1501
|
}, Dr = /* @__PURE__ */ new Map(), ye = new L("Mixer");
|
|
1502
|
-
class
|
|
1502
|
+
class lo extends Bt {
|
|
1503
1503
|
constructor(t) {
|
|
1504
1504
|
super();
|
|
1505
1505
|
m(this, "id", oe());
|
|
@@ -1510,12 +1510,12 @@ class po extends Bt {
|
|
|
1510
1510
|
m(this, "_bufferNode");
|
|
1511
1511
|
m(this, "_track");
|
|
1512
1512
|
ye.info("ctor", t), this._config = {
|
|
1513
|
-
...
|
|
1513
|
+
...po,
|
|
1514
1514
|
...t
|
|
1515
|
-
}, this._context =
|
|
1515
|
+
}, this._context = mo(this._config), this._bindContextEvent(this._context);
|
|
1516
1516
|
}
|
|
1517
1517
|
mix(t) {
|
|
1518
|
-
ye.info("mix", t),
|
|
1518
|
+
ye.info("mix", t), Et(this._context);
|
|
1519
1519
|
for (const i of this._nodeList)
|
|
1520
1520
|
t.includes(i) || i.destroy();
|
|
1521
1521
|
this._nodeList = t, this._connect(t, this._destNode), this._nodeList.length === 0 && this._appendSlience(this._context, this._destNode);
|
|
@@ -1544,10 +1544,10 @@ class po extends Bt {
|
|
|
1544
1544
|
}
|
|
1545
1545
|
_handleContextStateChange() {
|
|
1546
1546
|
const t = this._context;
|
|
1547
|
-
(t.state === "suspended" || t.state === "interrupted") && (ye.info("_emit_",
|
|
1547
|
+
(t.state === "suspended" || t.state === "interrupted") && (ye.info("_emit_", Tt.PAUSING), this.emit(Tt.PAUSING));
|
|
1548
1548
|
}
|
|
1549
1549
|
track() {
|
|
1550
|
-
if (ye.info("track"),
|
|
1550
|
+
if (ye.info("track"), Et(this._context), this._track)
|
|
1551
1551
|
return this._track;
|
|
1552
1552
|
let t = this._destNode;
|
|
1553
1553
|
t || (t = new MediaStreamAudioDestinationNode(this._context)), this._nodeList.length === 0 && this._appendSlience(this._context, t), this._connect(this._nodeList, t);
|
|
@@ -1555,23 +1555,23 @@ class po extends Bt {
|
|
|
1555
1555
|
return this._destNode = t, this._track = i, i;
|
|
1556
1556
|
}
|
|
1557
1557
|
}
|
|
1558
|
-
function
|
|
1558
|
+
function mo(r) {
|
|
1559
1559
|
const { sampleRate: e, keepAlive: t } = r;
|
|
1560
1560
|
let i = Dr.get(e);
|
|
1561
1561
|
return (!i || i.state === "closed") && (i = new AudioContext({ sampleRate: e }), Dr.set(e, i)), t && (i.onstatechange = () => {
|
|
1562
|
-
|
|
1562
|
+
Et(i);
|
|
1563
1563
|
}), i;
|
|
1564
1564
|
}
|
|
1565
|
-
function
|
|
1565
|
+
function Et(r) {
|
|
1566
1566
|
if (r.state === "suspended" || r.state === "interrupted")
|
|
1567
1567
|
return r.resume();
|
|
1568
1568
|
}
|
|
1569
|
-
const
|
|
1569
|
+
const fo = (r) => (e, t) => (r.set(e, t), t), Lr = Number.MAX_SAFE_INTEGER === void 0 ? 9007199254740991 : Number.MAX_SAFE_INTEGER, zi = 536870912, Fr = zi * 2, _o = (r, e) => (t) => {
|
|
1570
1570
|
const i = e.get(t);
|
|
1571
1571
|
let s = i === void 0 ? t.size : i < Fr ? i + 1 : 0;
|
|
1572
1572
|
if (!t.has(s))
|
|
1573
1573
|
return r(t, s);
|
|
1574
|
-
if (t.size <
|
|
1574
|
+
if (t.size < zi) {
|
|
1575
1575
|
for (; t.has(s); )
|
|
1576
1576
|
s = Math.floor(Math.random() * Fr);
|
|
1577
1577
|
return r(t, s);
|
|
@@ -1581,71 +1581,71 @@ const mo = (r) => (e, t) => (r.set(e, t), t), Lr = Number.MAX_SAFE_INTEGER === v
|
|
|
1581
1581
|
for (; t.has(s); )
|
|
1582
1582
|
s = Math.floor(Math.random() * Lr);
|
|
1583
1583
|
return r(t, s);
|
|
1584
|
-
},
|
|
1584
|
+
}, Gi = /* @__PURE__ */ new WeakMap(), go = fo(Gi), Y = _o(go, Gi), vo = (r) => r.method !== void 0 && r.method === "call", Co = (r) => typeof r.id == "number" && typeof r.result == "boolean", yo = (r) => {
|
|
1585
1585
|
const e = /* @__PURE__ */ new Map([[0, () => {
|
|
1586
1586
|
}]]), t = /* @__PURE__ */ new Map([[0, () => {
|
|
1587
1587
|
}]]), i = /* @__PURE__ */ new Map(), s = new Worker(r);
|
|
1588
|
-
return s.addEventListener("message", ({ data:
|
|
1589
|
-
if (
|
|
1590
|
-
const { params: { timerId:
|
|
1588
|
+
return s.addEventListener("message", ({ data: d }) => {
|
|
1589
|
+
if (vo(d)) {
|
|
1590
|
+
const { params: { timerId: c, timerType: h } } = d;
|
|
1591
1591
|
if (h === "interval") {
|
|
1592
|
-
const p = e.get(
|
|
1592
|
+
const p = e.get(c);
|
|
1593
1593
|
if (typeof p === void 0)
|
|
1594
1594
|
throw new Error("The timer is in an undefined state.");
|
|
1595
1595
|
if (typeof p == "number") {
|
|
1596
1596
|
const l = i.get(p);
|
|
1597
|
-
if (l === void 0 || l.timerId !==
|
|
1597
|
+
if (l === void 0 || l.timerId !== c || l.timerType !== h)
|
|
1598
1598
|
throw new Error("The timer is in an undefined state.");
|
|
1599
1599
|
} else typeof p == "function" && p();
|
|
1600
1600
|
} else if (h === "timeout") {
|
|
1601
|
-
const p = t.get(
|
|
1601
|
+
const p = t.get(c);
|
|
1602
1602
|
if (typeof p === void 0)
|
|
1603
1603
|
throw new Error("The timer is in an undefined state.");
|
|
1604
1604
|
if (typeof p == "number") {
|
|
1605
1605
|
const l = i.get(p);
|
|
1606
|
-
if (l === void 0 || l.timerId !==
|
|
1606
|
+
if (l === void 0 || l.timerId !== c || l.timerType !== h)
|
|
1607
1607
|
throw new Error("The timer is in an undefined state.");
|
|
1608
|
-
} else typeof p == "function" && (p(), t.delete(
|
|
1608
|
+
} else typeof p == "function" && (p(), t.delete(c));
|
|
1609
1609
|
}
|
|
1610
|
-
} else if (
|
|
1611
|
-
const { id:
|
|
1610
|
+
} else if (Co(d)) {
|
|
1611
|
+
const { id: c } = d, h = i.get(c);
|
|
1612
1612
|
if (h === void 0)
|
|
1613
1613
|
throw new Error("The timer is in an undefined state.");
|
|
1614
1614
|
const { timerId: p, timerType: l } = h;
|
|
1615
|
-
i.delete(
|
|
1615
|
+
i.delete(c), l === "interval" ? e.delete(p) : t.delete(p);
|
|
1616
1616
|
} else {
|
|
1617
|
-
const { error: { message:
|
|
1618
|
-
throw new Error(
|
|
1617
|
+
const { error: { message: c } } = d;
|
|
1618
|
+
throw new Error(c);
|
|
1619
1619
|
}
|
|
1620
1620
|
}), {
|
|
1621
|
-
clearInterval: (
|
|
1622
|
-
if (typeof e.get(
|
|
1623
|
-
const
|
|
1624
|
-
i.set(
|
|
1625
|
-
id:
|
|
1621
|
+
clearInterval: (d) => {
|
|
1622
|
+
if (typeof e.get(d) == "function") {
|
|
1623
|
+
const c = Y(i);
|
|
1624
|
+
i.set(c, { timerId: d, timerType: "interval" }), e.set(d, c), s.postMessage({
|
|
1625
|
+
id: c,
|
|
1626
1626
|
method: "clear",
|
|
1627
|
-
params: { timerId:
|
|
1627
|
+
params: { timerId: d, timerType: "interval" }
|
|
1628
1628
|
});
|
|
1629
1629
|
}
|
|
1630
1630
|
},
|
|
1631
|
-
clearTimeout: (
|
|
1632
|
-
if (typeof t.get(
|
|
1633
|
-
const
|
|
1634
|
-
i.set(
|
|
1635
|
-
id:
|
|
1631
|
+
clearTimeout: (d) => {
|
|
1632
|
+
if (typeof t.get(d) == "function") {
|
|
1633
|
+
const c = Y(i);
|
|
1634
|
+
i.set(c, { timerId: d, timerType: "timeout" }), t.set(d, c), s.postMessage({
|
|
1635
|
+
id: c,
|
|
1636
1636
|
method: "clear",
|
|
1637
|
-
params: { timerId:
|
|
1637
|
+
params: { timerId: d, timerType: "timeout" }
|
|
1638
1638
|
});
|
|
1639
1639
|
}
|
|
1640
1640
|
},
|
|
1641
|
-
setInterval: (
|
|
1641
|
+
setInterval: (d, c = 0, ...h) => {
|
|
1642
1642
|
const p = Y(e);
|
|
1643
1643
|
return e.set(p, () => {
|
|
1644
|
-
|
|
1644
|
+
d(...h), typeof e.get(p) == "function" && s.postMessage({
|
|
1645
1645
|
id: null,
|
|
1646
1646
|
method: "set",
|
|
1647
1647
|
params: {
|
|
1648
|
-
delay:
|
|
1648
|
+
delay: c,
|
|
1649
1649
|
now: performance.timeOrigin + performance.now(),
|
|
1650
1650
|
timerId: p,
|
|
1651
1651
|
timerType: "interval"
|
|
@@ -1655,20 +1655,20 @@ const mo = (r) => (e, t) => (r.set(e, t), t), Lr = Number.MAX_SAFE_INTEGER === v
|
|
|
1655
1655
|
id: null,
|
|
1656
1656
|
method: "set",
|
|
1657
1657
|
params: {
|
|
1658
|
-
delay:
|
|
1658
|
+
delay: c,
|
|
1659
1659
|
now: performance.timeOrigin + performance.now(),
|
|
1660
1660
|
timerId: p,
|
|
1661
1661
|
timerType: "interval"
|
|
1662
1662
|
}
|
|
1663
1663
|
}), p;
|
|
1664
1664
|
},
|
|
1665
|
-
setTimeout: (
|
|
1665
|
+
setTimeout: (d, c = 0, ...h) => {
|
|
1666
1666
|
const p = Y(t);
|
|
1667
|
-
return t.set(p, () =>
|
|
1667
|
+
return t.set(p, () => d(...h)), s.postMessage({
|
|
1668
1668
|
id: null,
|
|
1669
1669
|
method: "set",
|
|
1670
1670
|
params: {
|
|
1671
|
-
delay:
|
|
1671
|
+
delay: c,
|
|
1672
1672
|
now: performance.timeOrigin + performance.now(),
|
|
1673
1673
|
timerId: p,
|
|
1674
1674
|
timerType: "timeout"
|
|
@@ -1676,7 +1676,7 @@ const mo = (r) => (e, t) => (r.set(e, t), t), Lr = Number.MAX_SAFE_INTEGER === v
|
|
|
1676
1676
|
}), p;
|
|
1677
1677
|
}
|
|
1678
1678
|
};
|
|
1679
|
-
},
|
|
1679
|
+
}, So = (r, e) => {
|
|
1680
1680
|
let t = null;
|
|
1681
1681
|
return () => {
|
|
1682
1682
|
if (t !== null)
|
|
@@ -1684,7 +1684,7 @@ const mo = (r) => (e, t) => (r.set(e, t), t), Lr = Number.MAX_SAFE_INTEGER === v
|
|
|
1684
1684
|
const i = new Blob([e], { type: "application/javascript; charset=utf-8" }), s = URL.createObjectURL(i);
|
|
1685
1685
|
return t = r(s), setTimeout(() => URL.revokeObjectURL(s)), t;
|
|
1686
1686
|
};
|
|
1687
|
-
},
|
|
1687
|
+
}, To = `(()=>{"use strict";const e=new Map,t=new Map,r=t=>{const r=e.get(t);return void 0!==r&&(clearTimeout(r),e.delete(t),!0)},s=e=>{const r=t.get(e);return void 0!==r&&(clearTimeout(r),t.delete(e),!0)},o=(e,t)=>{const r=performance.now(),s=e+t-r-performance.timeOrigin;return{expected:r+s,remainingDelay:s}},i=(e,t,r,s)=>{const o=r-performance.now();o>0?e.set(t,setTimeout(i,o,e,t,r,s)):(e.delete(t),postMessage({id:null,method:"call",params:{timerId:t,timerType:s}}))};addEventListener("message",(({data:n})=>{try{if("clear"===n.method){const{id:e,params:{timerId:t,timerType:o}}=n;if("interval"===o)postMessage({id:e,result:r(t)});else{if("timeout"!==o)throw new Error('The given type "'.concat(o,'" is not supported'));postMessage({id:e,result:s(t)})}}else{if("set"!==n.method)throw new Error('The given method "'.concat(n.method,'" is not supported'));{const{params:{delay:r,now:s,timerId:a,timerType:m}}=n;if("interval"===m)((t,r,s)=>{const{expected:n,remainingDelay:a}=o(t,s);e.set(r,setTimeout(i,a,e,r,n,"interval"))})(r,a,s);else{if("timeout"!==m)throw new Error('The given type "'.concat(m,'" is not supported'));((e,r,s)=>{const{expected:n,remainingDelay:a}=o(e,s);t.set(r,setTimeout(i,a,t,r,n,"timeout"))})(r,a,s)}}}}catch(e){postMessage({error:{message:e.message},id:n.id,result:null})}}))})();`, Hi = So(yo, To), Eo = (r) => Hi().clearTimeout(r), bo = (...r) => Hi().setTimeout(...r), ko = (r) => r.method !== void 0 && r.method === "call", Po = (r) => typeof r.id == "number" && typeof r.result == "boolean", xo = (r) => {
|
|
1688
1688
|
const e = /* @__PURE__ */ new Map([
|
|
1689
1689
|
[0, () => {
|
|
1690
1690
|
}]
|
|
@@ -1694,71 +1694,71 @@ const mo = (r) => (e, t) => (r.set(e, t), t), Lr = Number.MAX_SAFE_INTEGER === v
|
|
|
1694
1694
|
]), i = /* @__PURE__ */ new Map(), s = new Worker(r, {
|
|
1695
1695
|
credentials: "omit"
|
|
1696
1696
|
});
|
|
1697
|
-
return s.addEventListener("message", ({ data:
|
|
1698
|
-
if (
|
|
1697
|
+
return s.addEventListener("message", ({ data: d }) => {
|
|
1698
|
+
if (ko(d)) {
|
|
1699
1699
|
const {
|
|
1700
|
-
params: { timerId:
|
|
1701
|
-
} =
|
|
1700
|
+
params: { timerId: c, timerType: h }
|
|
1701
|
+
} = d;
|
|
1702
1702
|
if (h === "interval") {
|
|
1703
|
-
const p = e.get(
|
|
1703
|
+
const p = e.get(c);
|
|
1704
1704
|
if (typeof p === void 0)
|
|
1705
1705
|
throw new Error("The timer is in an undefined state.");
|
|
1706
1706
|
if (typeof p == "number") {
|
|
1707
1707
|
const l = i.get(p);
|
|
1708
|
-
if (l === void 0 || l.timerId !==
|
|
1708
|
+
if (l === void 0 || l.timerId !== c || l.timerType !== h)
|
|
1709
1709
|
throw new Error("The timer is in an undefined state.");
|
|
1710
1710
|
} else typeof p == "function" && p();
|
|
1711
1711
|
} else if (h === "timeout") {
|
|
1712
|
-
const p = t.get(
|
|
1712
|
+
const p = t.get(c);
|
|
1713
1713
|
if (typeof p === void 0)
|
|
1714
1714
|
throw new Error("The timer is in an undefined state.");
|
|
1715
1715
|
if (typeof p == "number") {
|
|
1716
1716
|
const l = i.get(p);
|
|
1717
|
-
if (l === void 0 || l.timerId !==
|
|
1717
|
+
if (l === void 0 || l.timerId !== c || l.timerType !== h)
|
|
1718
1718
|
throw new Error("The timer is in an undefined state.");
|
|
1719
|
-
} else typeof p == "function" && (p(), t.delete(
|
|
1719
|
+
} else typeof p == "function" && (p(), t.delete(c));
|
|
1720
1720
|
}
|
|
1721
|
-
} else if (
|
|
1722
|
-
const { id:
|
|
1721
|
+
} else if (Po(d)) {
|
|
1722
|
+
const { id: c } = d, h = i.get(c);
|
|
1723
1723
|
if (h === void 0)
|
|
1724
1724
|
throw new Error("The timer is in an undefined state.");
|
|
1725
1725
|
const { timerId: p, timerType: l } = h;
|
|
1726
|
-
i.delete(
|
|
1726
|
+
i.delete(c), l === "interval" ? e.delete(p) : t.delete(p);
|
|
1727
1727
|
} else {
|
|
1728
1728
|
const {
|
|
1729
|
-
error: { message:
|
|
1730
|
-
} =
|
|
1731
|
-
throw new Error(
|
|
1729
|
+
error: { message: c }
|
|
1730
|
+
} = d;
|
|
1731
|
+
throw new Error(c);
|
|
1732
1732
|
}
|
|
1733
1733
|
}), {
|
|
1734
|
-
clearInterval: (
|
|
1735
|
-
if (typeof e.get(
|
|
1736
|
-
const
|
|
1737
|
-
i.set(
|
|
1738
|
-
id:
|
|
1734
|
+
clearInterval: (d) => {
|
|
1735
|
+
if (typeof e.get(d) == "function") {
|
|
1736
|
+
const c = Y(i);
|
|
1737
|
+
i.set(c, { timerId: d, timerType: "interval" }), e.set(d, c), s.postMessage({
|
|
1738
|
+
id: c,
|
|
1739
1739
|
method: "clear",
|
|
1740
|
-
params: { timerId:
|
|
1740
|
+
params: { timerId: d, timerType: "interval" }
|
|
1741
1741
|
});
|
|
1742
1742
|
}
|
|
1743
1743
|
},
|
|
1744
|
-
clearTimeout: (
|
|
1745
|
-
if (typeof t.get(
|
|
1746
|
-
const
|
|
1747
|
-
i.set(
|
|
1748
|
-
id:
|
|
1744
|
+
clearTimeout: (d) => {
|
|
1745
|
+
if (typeof t.get(d) == "function") {
|
|
1746
|
+
const c = Y(i);
|
|
1747
|
+
i.set(c, { timerId: d, timerType: "timeout" }), t.set(d, c), s.postMessage({
|
|
1748
|
+
id: c,
|
|
1749
1749
|
method: "clear",
|
|
1750
|
-
params: { timerId:
|
|
1750
|
+
params: { timerId: d, timerType: "timeout" }
|
|
1751
1751
|
});
|
|
1752
1752
|
}
|
|
1753
1753
|
},
|
|
1754
|
-
setInterval: (
|
|
1754
|
+
setInterval: (d, c = 0, ...h) => {
|
|
1755
1755
|
const p = Y(e);
|
|
1756
1756
|
return e.set(p, () => {
|
|
1757
|
-
|
|
1757
|
+
d(...h), typeof e.get(p) == "function" && s.postMessage({
|
|
1758
1758
|
id: null,
|
|
1759
1759
|
method: "set",
|
|
1760
1760
|
params: {
|
|
1761
|
-
delay:
|
|
1761
|
+
delay: c,
|
|
1762
1762
|
now: performance.timeOrigin + performance.now(),
|
|
1763
1763
|
timerId: p,
|
|
1764
1764
|
timerType: "interval"
|
|
@@ -1768,20 +1768,20 @@ const mo = (r) => (e, t) => (r.set(e, t), t), Lr = Number.MAX_SAFE_INTEGER === v
|
|
|
1768
1768
|
id: null,
|
|
1769
1769
|
method: "set",
|
|
1770
1770
|
params: {
|
|
1771
|
-
delay:
|
|
1771
|
+
delay: c,
|
|
1772
1772
|
now: performance.timeOrigin + performance.now(),
|
|
1773
1773
|
timerId: p,
|
|
1774
1774
|
timerType: "interval"
|
|
1775
1775
|
}
|
|
1776
1776
|
}), p;
|
|
1777
1777
|
},
|
|
1778
|
-
setTimeout: (
|
|
1778
|
+
setTimeout: (d, c = 0, ...h) => {
|
|
1779
1779
|
const p = Y(t);
|
|
1780
|
-
return t.set(p, () =>
|
|
1780
|
+
return t.set(p, () => d(...h)), s.postMessage({
|
|
1781
1781
|
id: null,
|
|
1782
1782
|
method: "set",
|
|
1783
1783
|
params: {
|
|
1784
|
-
delay:
|
|
1784
|
+
delay: c,
|
|
1785
1785
|
now: performance.timeOrigin + performance.now(),
|
|
1786
1786
|
timerId: p,
|
|
1787
1787
|
timerType: "timeout"
|
|
@@ -1789,13 +1789,13 @@ const mo = (r) => (e, t) => (r.set(e, t), t), Lr = Number.MAX_SAFE_INTEGER === v
|
|
|
1789
1789
|
}), p;
|
|
1790
1790
|
}
|
|
1791
1791
|
};
|
|
1792
|
-
},
|
|
1792
|
+
}, Ro = {
|
|
1793
1793
|
width: 640,
|
|
1794
1794
|
height: 480,
|
|
1795
1795
|
frameRate: 30,
|
|
1796
1796
|
backgroundColor: "#000000"
|
|
1797
1797
|
}, Ie = new L("View");
|
|
1798
|
-
class
|
|
1798
|
+
class Ao {
|
|
1799
1799
|
constructor(e) {
|
|
1800
1800
|
m(this, "id", oe());
|
|
1801
1801
|
m(this, "_context");
|
|
@@ -1819,18 +1819,18 @@ class Ro {
|
|
|
1819
1819
|
}
|
|
1820
1820
|
this._drawOnCanvas(), this._workerTimeoutId && this._customClearTimeout(this._workerTimeoutId), this._workerTimeoutId = this._customSetTimeout(() => {
|
|
1821
1821
|
this._paintLoop(), this._raqId && (cancelAnimationFrame(this._raqId), this._raqId = void 0);
|
|
1822
|
-
},
|
|
1822
|
+
}, yt / this._config.frameRate), this._raqId = requestAnimationFrame(this._paintLoop);
|
|
1823
1823
|
});
|
|
1824
1824
|
Ie.info("ctor", e), this._config = {
|
|
1825
|
-
...
|
|
1825
|
+
...Ro,
|
|
1826
1826
|
...e
|
|
1827
1827
|
};
|
|
1828
1828
|
const { context: t, canvas: i } = Li(this._config);
|
|
1829
|
-
this._context = t, this._canvas = i, this._customSetTimeout =
|
|
1829
|
+
this._context = t, this._canvas = i, this._customSetTimeout = bo, this._customClearTimeout = Eo;
|
|
1830
1830
|
}
|
|
1831
1831
|
setWorkerTimerScriptUrl(e) {
|
|
1832
1832
|
if (this._workerTimerScriptUrl = e, this._workerTimerScriptUrl) {
|
|
1833
|
-
const t =
|
|
1833
|
+
const t = xo(this._workerTimerScriptUrl);
|
|
1834
1834
|
this._customSetTimeout = (...i) => t.setTimeout(...i), this._customClearTimeout = (i) => t.clearTimeout(i);
|
|
1835
1835
|
}
|
|
1836
1836
|
}
|
|
@@ -1838,7 +1838,7 @@ class Ro {
|
|
|
1838
1838
|
if (e < this._nextTime)
|
|
1839
1839
|
return !1;
|
|
1840
1840
|
for (; e > this._nextTime; )
|
|
1841
|
-
this._nextTime +=
|
|
1841
|
+
this._nextTime += yt / this._config.frameRate;
|
|
1842
1842
|
return !0;
|
|
1843
1843
|
}
|
|
1844
1844
|
updateConfig(e) {
|
|
@@ -1888,10 +1888,10 @@ class Ro {
|
|
|
1888
1888
|
this._stopped = !0;
|
|
1889
1889
|
}
|
|
1890
1890
|
}
|
|
1891
|
-
function
|
|
1891
|
+
function wo() {
|
|
1892
1892
|
return Math.random().toString(36).slice(-8);
|
|
1893
1893
|
}
|
|
1894
|
-
const
|
|
1894
|
+
const Oo = `
|
|
1895
1895
|
const SMOOTHING_FACTOR = 0.8;
|
|
1896
1896
|
const MINIMUM_VALUE = 0.00001;
|
|
1897
1897
|
|
|
@@ -1946,10 +1946,10 @@ registerProcessor('vumeter', class extends AudioWorkletProcessor {
|
|
|
1946
1946
|
return true;
|
|
1947
1947
|
}
|
|
1948
1948
|
});
|
|
1949
|
-
`,
|
|
1950
|
-
new Blob([
|
|
1949
|
+
`, Io = URL.createObjectURL(
|
|
1950
|
+
new Blob([Oo], { type: "application/javascript" })
|
|
1951
1951
|
);
|
|
1952
|
-
class
|
|
1952
|
+
class Mo {
|
|
1953
1953
|
constructor() {
|
|
1954
1954
|
this._audioCtx = null, this._volume = 0;
|
|
1955
1955
|
}
|
|
@@ -1959,7 +1959,7 @@ class Io {
|
|
|
1959
1959
|
async start(e, t) {
|
|
1960
1960
|
if (this._audioCtx) return;
|
|
1961
1961
|
const i = new AudioContext();
|
|
1962
|
-
await i.audioWorklet.addModule(t ||
|
|
1962
|
+
await i.audioWorklet.addModule(t || Io);
|
|
1963
1963
|
const s = new MediaStream();
|
|
1964
1964
|
s.addTrack(e);
|
|
1965
1965
|
const n = i.createMediaStreamSource(s), a = new AudioWorkletNode(i, "vumeter");
|
|
@@ -1973,12 +1973,12 @@ class Io {
|
|
|
1973
1973
|
(e = this._audioCtx) == null || e.close(), this._audioCtx = null;
|
|
1974
1974
|
}
|
|
1975
1975
|
}
|
|
1976
|
-
class
|
|
1976
|
+
class Ke {
|
|
1977
1977
|
constructor() {
|
|
1978
1978
|
this._volumeDetectScriptUrl = void 0;
|
|
1979
1979
|
}
|
|
1980
1980
|
static get instance() {
|
|
1981
|
-
return this._instance || (this._instance = new
|
|
1981
|
+
return this._instance || (this._instance = new Ke()), this._instance;
|
|
1982
1982
|
}
|
|
1983
1983
|
get volumeDetectScriptUrl() {
|
|
1984
1984
|
return this._volumeDetectScriptUrl;
|
|
@@ -1987,9 +1987,9 @@ class Xe {
|
|
|
1987
1987
|
this._volumeDetectScriptUrl = e;
|
|
1988
1988
|
}
|
|
1989
1989
|
}
|
|
1990
|
-
class
|
|
1990
|
+
class qi extends te {
|
|
1991
1991
|
constructor(e) {
|
|
1992
|
-
super(), this._width = 0, this._height = 0, this._mediaStream = null, this._nextStream = null, this._trackMap = {}, this.type = e.type, this.id =
|
|
1992
|
+
super(), this._width = 0, this._height = 0, this._mediaStream = null, this._nextStream = null, this._trackMap = {}, this.type = e.type, this.id = wo(), this._source = e.stream;
|
|
1993
1993
|
}
|
|
1994
1994
|
get source() {
|
|
1995
1995
|
return this._source;
|
|
@@ -2020,9 +2020,9 @@ class Hi extends te {
|
|
|
2020
2020
|
return this._trackMap.audio && e.addTrack(this._trackMap.audio), this._trackMap.video && e.addTrack(this._trackMap.video), this._mediaStream = e, e;
|
|
2021
2021
|
}
|
|
2022
2022
|
async startVolumeDetect() {
|
|
2023
|
-
this.audioTrack && (this._volumeDetector || (this._volumeDetector = new
|
|
2023
|
+
this.audioTrack && (this._volumeDetector || (this._volumeDetector = new Mo()), await this._volumeDetector.start(
|
|
2024
2024
|
this.audioTrack,
|
|
2025
|
-
|
|
2025
|
+
Ke.instance.volumeDetectScriptUrl
|
|
2026
2026
|
));
|
|
2027
2027
|
}
|
|
2028
2028
|
stopVolumeDetect() {
|
|
@@ -2034,7 +2034,7 @@ class Hi extends te {
|
|
|
2034
2034
|
return ((e = this._volumeDetector) == null ? void 0 : e.volume) || 0;
|
|
2035
2035
|
}
|
|
2036
2036
|
}
|
|
2037
|
-
class _e extends
|
|
2037
|
+
class _e extends qi {
|
|
2038
2038
|
get isVideoStream() {
|
|
2039
2039
|
return !0;
|
|
2040
2040
|
}
|
|
@@ -2043,14 +2043,14 @@ class _e extends Hi {
|
|
|
2043
2043
|
}
|
|
2044
2044
|
bindTrackSizeChangeEvent(e) {
|
|
2045
2045
|
e.on(I.SIZE_CHANGE, ({ width: t, height: i }) => {
|
|
2046
|
-
this._width = t, this._height = i, this.emit(
|
|
2046
|
+
this._width = t, this._height = i, this.emit(Nt.SizeChange, {
|
|
2047
2047
|
width: t,
|
|
2048
2048
|
height: i
|
|
2049
2049
|
});
|
|
2050
2050
|
});
|
|
2051
2051
|
}
|
|
2052
2052
|
}
|
|
2053
|
-
class
|
|
2053
|
+
class Je extends qi {
|
|
2054
2054
|
get isVideoStream() {
|
|
2055
2055
|
return !1;
|
|
2056
2056
|
}
|
|
@@ -2058,7 +2058,7 @@ class Ke extends Hi {
|
|
|
2058
2058
|
return !0;
|
|
2059
2059
|
}
|
|
2060
2060
|
}
|
|
2061
|
-
class
|
|
2061
|
+
class Do extends _e {
|
|
2062
2062
|
constructor(e) {
|
|
2063
2063
|
super({
|
|
2064
2064
|
type: S.Camera,
|
|
@@ -2081,67 +2081,67 @@ class Mo extends _e {
|
|
|
2081
2081
|
this.source.destroy();
|
|
2082
2082
|
}
|
|
2083
2083
|
}
|
|
2084
|
-
var
|
|
2085
|
-
function
|
|
2086
|
-
var e =
|
|
2084
|
+
var Wi = typeof global == "object" && global && global.Object === Object && global, Lo = typeof self == "object" && self && self.Object === Object && self, W = Wi || Lo || Function("return this")(), Q = W.Symbol, Xi = Object.prototype, Fo = Xi.hasOwnProperty, No = Xi.toString, Se = Q ? Q.toStringTag : void 0;
|
|
2085
|
+
function Vo(r) {
|
|
2086
|
+
var e = Fo.call(r, Se), t = r[Se];
|
|
2087
2087
|
try {
|
|
2088
2088
|
r[Se] = void 0;
|
|
2089
2089
|
var i = !0;
|
|
2090
2090
|
} catch {
|
|
2091
2091
|
}
|
|
2092
|
-
var s =
|
|
2092
|
+
var s = No.call(r);
|
|
2093
2093
|
return i && (e ? r[Se] = t : delete r[Se]), s;
|
|
2094
2094
|
}
|
|
2095
|
-
var
|
|
2096
|
-
function
|
|
2097
|
-
return
|
|
2095
|
+
var Uo = Object.prototype, $o = Uo.toString;
|
|
2096
|
+
function Bo(r) {
|
|
2097
|
+
return $o.call(r);
|
|
2098
2098
|
}
|
|
2099
|
-
var
|
|
2099
|
+
var jo = "[object Null]", zo = "[object Undefined]", Nr = Q ? Q.toStringTag : void 0;
|
|
2100
2100
|
function ge(r) {
|
|
2101
|
-
return r == null ? r === void 0 ?
|
|
2101
|
+
return r == null ? r === void 0 ? zo : jo : Nr && Nr in Object(r) ? Vo(r) : Bo(r);
|
|
2102
2102
|
}
|
|
2103
2103
|
function me(r) {
|
|
2104
2104
|
return r != null && typeof r == "object";
|
|
2105
2105
|
}
|
|
2106
|
-
var
|
|
2107
|
-
function
|
|
2108
|
-
return typeof r == "symbol" || me(r) && ge(r) ==
|
|
2106
|
+
var Go = "[object Symbol]";
|
|
2107
|
+
function Ye(r) {
|
|
2108
|
+
return typeof r == "symbol" || me(r) && ge(r) == Go;
|
|
2109
2109
|
}
|
|
2110
|
-
function
|
|
2110
|
+
function Ki(r, e) {
|
|
2111
2111
|
for (var t = -1, i = r == null ? 0 : r.length, s = Array(i); ++t < i; )
|
|
2112
2112
|
s[t] = e(r[t], t, r);
|
|
2113
2113
|
return s;
|
|
2114
2114
|
}
|
|
2115
2115
|
var D = Array.isArray, Vr = Q ? Q.prototype : void 0, Ur = Vr ? Vr.toString : void 0;
|
|
2116
|
-
function
|
|
2116
|
+
function Ji(r) {
|
|
2117
2117
|
if (typeof r == "string")
|
|
2118
2118
|
return r;
|
|
2119
2119
|
if (D(r))
|
|
2120
|
-
return
|
|
2121
|
-
if (
|
|
2120
|
+
return Ki(r, Ji) + "";
|
|
2121
|
+
if (Ye(r))
|
|
2122
2122
|
return Ur ? Ur.call(r) : "";
|
|
2123
2123
|
var e = r + "";
|
|
2124
2124
|
return e == "0" && 1 / r == -1 / 0 ? "-0" : e;
|
|
2125
2125
|
}
|
|
2126
|
-
var
|
|
2127
|
-
function
|
|
2128
|
-
for (var e = r.length; e-- &&
|
|
2126
|
+
var Ho = /\s/;
|
|
2127
|
+
function qo(r) {
|
|
2128
|
+
for (var e = r.length; e-- && Ho.test(r.charAt(e)); )
|
|
2129
2129
|
;
|
|
2130
2130
|
return e;
|
|
2131
2131
|
}
|
|
2132
|
-
var
|
|
2133
|
-
function
|
|
2134
|
-
return r && r.slice(0,
|
|
2132
|
+
var Wo = /^\s+/;
|
|
2133
|
+
function Xo(r) {
|
|
2134
|
+
return r && r.slice(0, qo(r) + 1).replace(Wo, "");
|
|
2135
2135
|
}
|
|
2136
2136
|
function ke(r) {
|
|
2137
2137
|
var e = typeof r;
|
|
2138
2138
|
return r != null && (e == "object" || e == "function");
|
|
2139
2139
|
}
|
|
2140
|
-
var $r = NaN,
|
|
2141
|
-
function
|
|
2140
|
+
var $r = NaN, Ko = /^[-+]0x[0-9a-f]+$/i, Jo = /^0b[01]+$/i, Yo = /^0o[0-7]+$/i, Zo = parseInt;
|
|
2141
|
+
function Qo(r) {
|
|
2142
2142
|
if (typeof r == "number")
|
|
2143
2143
|
return r;
|
|
2144
|
-
if (
|
|
2144
|
+
if (Ye(r))
|
|
2145
2145
|
return $r;
|
|
2146
2146
|
if (ke(r)) {
|
|
2147
2147
|
var e = typeof r.valueOf == "function" ? r.valueOf() : r;
|
|
@@ -2149,46 +2149,46 @@ function Zo(r) {
|
|
|
2149
2149
|
}
|
|
2150
2150
|
if (typeof r != "string")
|
|
2151
2151
|
return r === 0 ? r : +r;
|
|
2152
|
-
r =
|
|
2153
|
-
var t =
|
|
2154
|
-
return t ||
|
|
2152
|
+
r = Xo(r);
|
|
2153
|
+
var t = Jo.test(r);
|
|
2154
|
+
return t || Yo.test(r) ? Zo(r.slice(2), t ? 2 : 8) : Ko.test(r) ? $r : +r;
|
|
2155
2155
|
}
|
|
2156
|
-
var
|
|
2157
|
-
function
|
|
2156
|
+
var ea = 1 / 0, ta = 17976931348623157e292;
|
|
2157
|
+
function ra(r) {
|
|
2158
2158
|
if (!r)
|
|
2159
2159
|
return r === 0 ? r : 0;
|
|
2160
|
-
if (r =
|
|
2160
|
+
if (r = Qo(r), r === ea || r === -1 / 0) {
|
|
2161
2161
|
var e = r < 0 ? -1 : 1;
|
|
2162
|
-
return e *
|
|
2162
|
+
return e * ta;
|
|
2163
2163
|
}
|
|
2164
2164
|
return r === r ? r : 0;
|
|
2165
2165
|
}
|
|
2166
|
-
function
|
|
2167
|
-
var e =
|
|
2166
|
+
function ia(r) {
|
|
2167
|
+
var e = ra(r), t = e % 1;
|
|
2168
2168
|
return e === e ? t ? e - t : e : 0;
|
|
2169
2169
|
}
|
|
2170
|
-
function
|
|
2170
|
+
function sa(r) {
|
|
2171
2171
|
return r;
|
|
2172
2172
|
}
|
|
2173
|
-
var
|
|
2174
|
-
function
|
|
2173
|
+
var na = "[object AsyncFunction]", oa = "[object Function]", aa = "[object GeneratorFunction]", ca = "[object Proxy]";
|
|
2174
|
+
function Yi(r) {
|
|
2175
2175
|
if (!ke(r))
|
|
2176
2176
|
return !1;
|
|
2177
2177
|
var e = ge(r);
|
|
2178
|
-
return e ==
|
|
2178
|
+
return e == oa || e == aa || e == na || e == ca;
|
|
2179
2179
|
}
|
|
2180
|
-
var
|
|
2181
|
-
var r = /[^.]+$/.exec(
|
|
2180
|
+
var dt = W["__core-js_shared__"], Br = function() {
|
|
2181
|
+
var r = /[^.]+$/.exec(dt && dt.keys && dt.keys.IE_PROTO || "");
|
|
2182
2182
|
return r ? "Symbol(src)_1." + r : "";
|
|
2183
2183
|
}();
|
|
2184
|
-
function
|
|
2184
|
+
function da(r) {
|
|
2185
2185
|
return !!Br && Br in r;
|
|
2186
2186
|
}
|
|
2187
|
-
var
|
|
2187
|
+
var ua = Function.prototype, ha = ua.toString;
|
|
2188
2188
|
function ae(r) {
|
|
2189
2189
|
if (r != null) {
|
|
2190
2190
|
try {
|
|
2191
|
-
return
|
|
2191
|
+
return ha.call(r);
|
|
2192
2192
|
} catch {
|
|
2193
2193
|
}
|
|
2194
2194
|
try {
|
|
@@ -2198,144 +2198,144 @@ function ae(r) {
|
|
|
2198
2198
|
}
|
|
2199
2199
|
return "";
|
|
2200
2200
|
}
|
|
2201
|
-
var
|
|
2202
|
-
"^" +
|
|
2201
|
+
var pa = /[\\^$.*+?()[\]{}|]/g, la = /^\[object .+?Constructor\]$/, ma = Function.prototype, fa = Object.prototype, _a = ma.toString, ga = fa.hasOwnProperty, va = RegExp(
|
|
2202
|
+
"^" + _a.call(ga).replace(pa, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
2203
2203
|
);
|
|
2204
|
-
function
|
|
2205
|
-
if (!ke(r) ||
|
|
2204
|
+
function Ca(r) {
|
|
2205
|
+
if (!ke(r) || da(r))
|
|
2206
2206
|
return !1;
|
|
2207
|
-
var e =
|
|
2207
|
+
var e = Yi(r) ? va : la;
|
|
2208
2208
|
return e.test(ae(r));
|
|
2209
2209
|
}
|
|
2210
|
-
function
|
|
2210
|
+
function ya(r, e) {
|
|
2211
2211
|
return r == null ? void 0 : r[e];
|
|
2212
2212
|
}
|
|
2213
2213
|
function ve(r, e) {
|
|
2214
|
-
var t =
|
|
2215
|
-
return
|
|
2214
|
+
var t = ya(r, e);
|
|
2215
|
+
return Ca(t) ? t : void 0;
|
|
2216
2216
|
}
|
|
2217
|
-
var
|
|
2218
|
-
function
|
|
2217
|
+
var bt = ve(W, "WeakMap");
|
|
2218
|
+
function Sa(r, e, t, i) {
|
|
2219
2219
|
for (var s = r.length, n = t + -1; ++n < s; )
|
|
2220
2220
|
if (e(r[n], n, r))
|
|
2221
2221
|
return n;
|
|
2222
2222
|
return -1;
|
|
2223
2223
|
}
|
|
2224
|
-
var
|
|
2225
|
-
function
|
|
2224
|
+
var Ta = 9007199254740991, Ea = /^(?:0|[1-9]\d*)$/;
|
|
2225
|
+
function Zi(r, e) {
|
|
2226
2226
|
var t = typeof r;
|
|
2227
|
-
return e = e ??
|
|
2227
|
+
return e = e ?? Ta, !!e && (t == "number" || t != "symbol" && Ea.test(r)) && r > -1 && r % 1 == 0 && r < e;
|
|
2228
2228
|
}
|
|
2229
|
-
function
|
|
2229
|
+
function Qi(r, e) {
|
|
2230
2230
|
return r === e || r !== r && e !== e;
|
|
2231
2231
|
}
|
|
2232
|
-
var
|
|
2232
|
+
var ba = 9007199254740991;
|
|
2233
2233
|
function Gt(r) {
|
|
2234
|
-
return typeof r == "number" && r > -1 && r % 1 == 0 && r <=
|
|
2234
|
+
return typeof r == "number" && r > -1 && r % 1 == 0 && r <= ba;
|
|
2235
2235
|
}
|
|
2236
2236
|
function Ht(r) {
|
|
2237
|
-
return r != null && Gt(r.length) && !
|
|
2237
|
+
return r != null && Gt(r.length) && !Yi(r);
|
|
2238
2238
|
}
|
|
2239
|
-
var
|
|
2240
|
-
function
|
|
2241
|
-
var e = r && r.constructor, t = typeof e == "function" && e.prototype ||
|
|
2239
|
+
var ka = Object.prototype;
|
|
2240
|
+
function Pa(r) {
|
|
2241
|
+
var e = r && r.constructor, t = typeof e == "function" && e.prototype || ka;
|
|
2242
2242
|
return r === t;
|
|
2243
2243
|
}
|
|
2244
|
-
function
|
|
2244
|
+
function xa(r, e) {
|
|
2245
2245
|
for (var t = -1, i = Array(r); ++t < r; )
|
|
2246
2246
|
i[t] = e(t);
|
|
2247
2247
|
return i;
|
|
2248
2248
|
}
|
|
2249
|
-
var
|
|
2249
|
+
var Ra = "[object Arguments]";
|
|
2250
2250
|
function jr(r) {
|
|
2251
|
-
return me(r) && ge(r) ==
|
|
2251
|
+
return me(r) && ge(r) == Ra;
|
|
2252
2252
|
}
|
|
2253
|
-
var
|
|
2253
|
+
var es = Object.prototype, Aa = es.hasOwnProperty, wa = es.propertyIsEnumerable, ts = jr(/* @__PURE__ */ function() {
|
|
2254
2254
|
return arguments;
|
|
2255
2255
|
}()) ? jr : function(r) {
|
|
2256
|
-
return me(r) &&
|
|
2256
|
+
return me(r) && Aa.call(r, "callee") && !wa.call(r, "callee");
|
|
2257
2257
|
};
|
|
2258
|
-
function
|
|
2258
|
+
function Oa() {
|
|
2259
2259
|
return !1;
|
|
2260
2260
|
}
|
|
2261
|
-
var
|
|
2262
|
-
k[
|
|
2263
|
-
k[
|
|
2264
|
-
function
|
|
2261
|
+
var rs = typeof exports == "object" && exports && !exports.nodeType && exports, zr = rs && typeof module == "object" && module && !module.nodeType && module, Ia = zr && zr.exports === rs, Gr = Ia ? W.Buffer : void 0, Ma = Gr ? Gr.isBuffer : void 0, kt = Ma || Oa, Da = "[object Arguments]", La = "[object Array]", Fa = "[object Boolean]", Na = "[object Date]", Va = "[object Error]", Ua = "[object Function]", $a = "[object Map]", Ba = "[object Number]", ja = "[object Object]", za = "[object RegExp]", Ga = "[object Set]", Ha = "[object String]", qa = "[object WeakMap]", Wa = "[object ArrayBuffer]", Xa = "[object DataView]", Ka = "[object Float32Array]", Ja = "[object Float64Array]", Ya = "[object Int8Array]", Za = "[object Int16Array]", Qa = "[object Int32Array]", ec = "[object Uint8Array]", tc = "[object Uint8ClampedArray]", rc = "[object Uint16Array]", ic = "[object Uint32Array]", k = {};
|
|
2262
|
+
k[Ka] = k[Ja] = k[Ya] = k[Za] = k[Qa] = k[ec] = k[tc] = k[rc] = k[ic] = !0;
|
|
2263
|
+
k[Da] = k[La] = k[Wa] = k[Fa] = k[Xa] = k[Na] = k[Va] = k[Ua] = k[$a] = k[Ba] = k[ja] = k[za] = k[Ga] = k[Ha] = k[qa] = !1;
|
|
2264
|
+
function sc(r) {
|
|
2265
2265
|
return me(r) && Gt(r.length) && !!k[ge(r)];
|
|
2266
2266
|
}
|
|
2267
|
-
function
|
|
2267
|
+
function nc(r) {
|
|
2268
2268
|
return function(e) {
|
|
2269
2269
|
return r(e);
|
|
2270
2270
|
};
|
|
2271
2271
|
}
|
|
2272
|
-
var
|
|
2272
|
+
var is = typeof exports == "object" && exports && !exports.nodeType && exports, Ee = is && typeof module == "object" && module && !module.nodeType && module, oc = Ee && Ee.exports === is, ut = oc && Wi.process, Hr = function() {
|
|
2273
2273
|
try {
|
|
2274
2274
|
var r = Ee && Ee.require && Ee.require("util").types;
|
|
2275
|
-
return r ||
|
|
2275
|
+
return r || ut && ut.binding && ut.binding("util");
|
|
2276
2276
|
} catch {
|
|
2277
2277
|
}
|
|
2278
|
-
}(), qr = Hr && Hr.isTypedArray,
|
|
2279
|
-
function
|
|
2280
|
-
var t = D(r), i = !t &&
|
|
2281
|
-
for (var
|
|
2282
|
-
|
|
2283
|
-
(
|
|
2284
|
-
s && (
|
|
2285
|
-
n && (
|
|
2286
|
-
|
|
2278
|
+
}(), qr = Hr && Hr.isTypedArray, ss = qr ? nc(qr) : sc, ac = Object.prototype, cc = ac.hasOwnProperty;
|
|
2279
|
+
function dc(r, e) {
|
|
2280
|
+
var t = D(r), i = !t && ts(r), s = !t && !i && kt(r), n = !t && !i && !s && ss(r), a = t || i || s || n, o = a ? xa(r.length, String) : [], u = o.length;
|
|
2281
|
+
for (var d in r)
|
|
2282
|
+
cc.call(r, d) && !(a && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
2283
|
+
(d == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
2284
|
+
s && (d == "offset" || d == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
2285
|
+
n && (d == "buffer" || d == "byteLength" || d == "byteOffset") || // Skip index properties.
|
|
2286
|
+
Zi(d, u))) && o.push(d);
|
|
2287
2287
|
return o;
|
|
2288
2288
|
}
|
|
2289
|
-
function
|
|
2289
|
+
function uc(r, e) {
|
|
2290
2290
|
return function(t) {
|
|
2291
2291
|
return r(e(t));
|
|
2292
2292
|
};
|
|
2293
2293
|
}
|
|
2294
|
-
var
|
|
2295
|
-
function
|
|
2296
|
-
if (!
|
|
2297
|
-
return
|
|
2294
|
+
var hc = uc(Object.keys, Object), pc = Object.prototype, lc = pc.hasOwnProperty;
|
|
2295
|
+
function mc(r) {
|
|
2296
|
+
if (!Pa(r))
|
|
2297
|
+
return hc(r);
|
|
2298
2298
|
var e = [];
|
|
2299
2299
|
for (var t in Object(r))
|
|
2300
|
-
|
|
2300
|
+
lc.call(r, t) && t != "constructor" && e.push(t);
|
|
2301
2301
|
return e;
|
|
2302
2302
|
}
|
|
2303
2303
|
function Ae(r) {
|
|
2304
|
-
return Ht(r) ?
|
|
2304
|
+
return Ht(r) ? dc(r) : mc(r);
|
|
2305
2305
|
}
|
|
2306
|
-
var
|
|
2306
|
+
var fc = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, _c = /^\w*$/;
|
|
2307
2307
|
function qt(r, e) {
|
|
2308
2308
|
if (D(r))
|
|
2309
2309
|
return !1;
|
|
2310
2310
|
var t = typeof r;
|
|
2311
|
-
return t == "number" || t == "symbol" || t == "boolean" || r == null ||
|
|
2311
|
+
return t == "number" || t == "symbol" || t == "boolean" || r == null || Ye(r) ? !0 : _c.test(r) || !fc.test(r) || e != null && r in Object(e);
|
|
2312
2312
|
}
|
|
2313
2313
|
var Pe = ve(Object, "create");
|
|
2314
|
-
function
|
|
2314
|
+
function gc() {
|
|
2315
2315
|
this.__data__ = Pe ? Pe(null) : {}, this.size = 0;
|
|
2316
2316
|
}
|
|
2317
|
-
function
|
|
2317
|
+
function vc(r) {
|
|
2318
2318
|
var e = this.has(r) && delete this.__data__[r];
|
|
2319
2319
|
return this.size -= e ? 1 : 0, e;
|
|
2320
2320
|
}
|
|
2321
|
-
var
|
|
2322
|
-
function
|
|
2321
|
+
var Cc = "__lodash_hash_undefined__", yc = Object.prototype, Sc = yc.hasOwnProperty;
|
|
2322
|
+
function Tc(r) {
|
|
2323
2323
|
var e = this.__data__;
|
|
2324
2324
|
if (Pe) {
|
|
2325
2325
|
var t = e[r];
|
|
2326
|
-
return t ===
|
|
2326
|
+
return t === Cc ? void 0 : t;
|
|
2327
2327
|
}
|
|
2328
|
-
return
|
|
2328
|
+
return Sc.call(e, r) ? e[r] : void 0;
|
|
2329
2329
|
}
|
|
2330
|
-
var
|
|
2331
|
-
function
|
|
2330
|
+
var Ec = Object.prototype, bc = Ec.hasOwnProperty;
|
|
2331
|
+
function kc(r) {
|
|
2332
2332
|
var e = this.__data__;
|
|
2333
|
-
return Pe ? e[r] !== void 0 :
|
|
2333
|
+
return Pe ? e[r] !== void 0 : bc.call(e, r);
|
|
2334
2334
|
}
|
|
2335
|
-
var
|
|
2336
|
-
function
|
|
2335
|
+
var Pc = "__lodash_hash_undefined__";
|
|
2336
|
+
function xc(r, e) {
|
|
2337
2337
|
var t = this.__data__;
|
|
2338
|
-
return this.size += this.has(r) ? 0 : 1, t[r] = Pe && e === void 0 ?
|
|
2338
|
+
return this.size += this.has(r) ? 0 : 1, t[r] = Pe && e === void 0 ? Pc : e, this;
|
|
2339
2339
|
}
|
|
2340
2340
|
function ne(r) {
|
|
2341
2341
|
var e = -1, t = r == null ? 0 : r.length;
|
|
@@ -2344,37 +2344,37 @@ function ne(r) {
|
|
|
2344
2344
|
this.set(i[0], i[1]);
|
|
2345
2345
|
}
|
|
2346
2346
|
}
|
|
2347
|
-
ne.prototype.clear =
|
|
2348
|
-
ne.prototype.delete =
|
|
2349
|
-
ne.prototype.get =
|
|
2350
|
-
ne.prototype.has =
|
|
2351
|
-
ne.prototype.set =
|
|
2352
|
-
function
|
|
2347
|
+
ne.prototype.clear = gc;
|
|
2348
|
+
ne.prototype.delete = vc;
|
|
2349
|
+
ne.prototype.get = Tc;
|
|
2350
|
+
ne.prototype.has = kc;
|
|
2351
|
+
ne.prototype.set = xc;
|
|
2352
|
+
function Rc() {
|
|
2353
2353
|
this.__data__ = [], this.size = 0;
|
|
2354
2354
|
}
|
|
2355
|
-
function
|
|
2355
|
+
function Ze(r, e) {
|
|
2356
2356
|
for (var t = r.length; t--; )
|
|
2357
|
-
if (
|
|
2357
|
+
if (Qi(r[t][0], e))
|
|
2358
2358
|
return t;
|
|
2359
2359
|
return -1;
|
|
2360
2360
|
}
|
|
2361
|
-
var
|
|
2362
|
-
function
|
|
2363
|
-
var e = this.__data__, t =
|
|
2361
|
+
var Ac = Array.prototype, wc = Ac.splice;
|
|
2362
|
+
function Oc(r) {
|
|
2363
|
+
var e = this.__data__, t = Ze(e, r);
|
|
2364
2364
|
if (t < 0)
|
|
2365
2365
|
return !1;
|
|
2366
2366
|
var i = e.length - 1;
|
|
2367
|
-
return t == i ? e.pop() :
|
|
2367
|
+
return t == i ? e.pop() : wc.call(e, t, 1), --this.size, !0;
|
|
2368
2368
|
}
|
|
2369
|
-
function
|
|
2370
|
-
var e = this.__data__, t =
|
|
2369
|
+
function Ic(r) {
|
|
2370
|
+
var e = this.__data__, t = Ze(e, r);
|
|
2371
2371
|
return t < 0 ? void 0 : e[t][1];
|
|
2372
2372
|
}
|
|
2373
|
-
function
|
|
2374
|
-
return
|
|
2373
|
+
function Mc(r) {
|
|
2374
|
+
return Ze(this.__data__, r) > -1;
|
|
2375
2375
|
}
|
|
2376
|
-
function
|
|
2377
|
-
var t = this.__data__, i =
|
|
2376
|
+
function Dc(r, e) {
|
|
2377
|
+
var t = this.__data__, i = Ze(t, r);
|
|
2378
2378
|
return i < 0 ? (++this.size, t.push([r, e])) : t[i][1] = e, this;
|
|
2379
2379
|
}
|
|
2380
2380
|
function X(r) {
|
|
@@ -2384,39 +2384,39 @@ function X(r) {
|
|
|
2384
2384
|
this.set(i[0], i[1]);
|
|
2385
2385
|
}
|
|
2386
2386
|
}
|
|
2387
|
-
X.prototype.clear =
|
|
2388
|
-
X.prototype.delete =
|
|
2389
|
-
X.prototype.get =
|
|
2390
|
-
X.prototype.has =
|
|
2391
|
-
X.prototype.set =
|
|
2387
|
+
X.prototype.clear = Rc;
|
|
2388
|
+
X.prototype.delete = Oc;
|
|
2389
|
+
X.prototype.get = Ic;
|
|
2390
|
+
X.prototype.has = Mc;
|
|
2391
|
+
X.prototype.set = Dc;
|
|
2392
2392
|
var xe = ve(W, "Map");
|
|
2393
|
-
function
|
|
2393
|
+
function Lc() {
|
|
2394
2394
|
this.size = 0, this.__data__ = {
|
|
2395
2395
|
hash: new ne(),
|
|
2396
2396
|
map: new (xe || X)(),
|
|
2397
2397
|
string: new ne()
|
|
2398
2398
|
};
|
|
2399
2399
|
}
|
|
2400
|
-
function
|
|
2400
|
+
function Fc(r) {
|
|
2401
2401
|
var e = typeof r;
|
|
2402
2402
|
return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? r !== "__proto__" : r === null;
|
|
2403
2403
|
}
|
|
2404
|
-
function
|
|
2404
|
+
function Qe(r, e) {
|
|
2405
2405
|
var t = r.__data__;
|
|
2406
|
-
return
|
|
2407
|
-
}
|
|
2408
|
-
function Fc(r) {
|
|
2409
|
-
var e = Ze(this, r).delete(r);
|
|
2410
|
-
return this.size -= e ? 1 : 0, e;
|
|
2406
|
+
return Fc(e) ? t[typeof e == "string" ? "string" : "hash"] : t.map;
|
|
2411
2407
|
}
|
|
2412
2408
|
function Nc(r) {
|
|
2413
|
-
|
|
2409
|
+
var e = Qe(this, r).delete(r);
|
|
2410
|
+
return this.size -= e ? 1 : 0, e;
|
|
2414
2411
|
}
|
|
2415
2412
|
function Vc(r) {
|
|
2416
|
-
return
|
|
2413
|
+
return Qe(this, r).get(r);
|
|
2417
2414
|
}
|
|
2418
|
-
function Uc(r
|
|
2419
|
-
|
|
2415
|
+
function Uc(r) {
|
|
2416
|
+
return Qe(this, r).has(r);
|
|
2417
|
+
}
|
|
2418
|
+
function $c(r, e) {
|
|
2419
|
+
var t = Qe(this, r), i = t.size;
|
|
2420
2420
|
return t.set(r, e), this.size += t.size == i ? 0 : 1, this;
|
|
2421
2421
|
}
|
|
2422
2422
|
function K(r) {
|
|
@@ -2426,15 +2426,15 @@ function K(r) {
|
|
|
2426
2426
|
this.set(i[0], i[1]);
|
|
2427
2427
|
}
|
|
2428
2428
|
}
|
|
2429
|
-
K.prototype.clear =
|
|
2430
|
-
K.prototype.delete =
|
|
2431
|
-
K.prototype.get =
|
|
2432
|
-
K.prototype.has =
|
|
2433
|
-
K.prototype.set =
|
|
2434
|
-
var
|
|
2429
|
+
K.prototype.clear = Lc;
|
|
2430
|
+
K.prototype.delete = Nc;
|
|
2431
|
+
K.prototype.get = Vc;
|
|
2432
|
+
K.prototype.has = Uc;
|
|
2433
|
+
K.prototype.set = $c;
|
|
2434
|
+
var Bc = "Expected a function";
|
|
2435
2435
|
function Wt(r, e) {
|
|
2436
2436
|
if (typeof r != "function" || e != null && typeof e != "function")
|
|
2437
|
-
throw new TypeError(
|
|
2437
|
+
throw new TypeError(Bc);
|
|
2438
2438
|
var t = function() {
|
|
2439
2439
|
var i = arguments, s = e ? e.apply(this, i) : i[0], n = t.cache;
|
|
2440
2440
|
if (n.has(s))
|
|
@@ -2445,65 +2445,65 @@ function Wt(r, e) {
|
|
|
2445
2445
|
return t.cache = new (Wt.Cache || K)(), t;
|
|
2446
2446
|
}
|
|
2447
2447
|
Wt.Cache = K;
|
|
2448
|
-
var
|
|
2449
|
-
function
|
|
2448
|
+
var jc = 500;
|
|
2449
|
+
function zc(r) {
|
|
2450
2450
|
var e = Wt(r, function(i) {
|
|
2451
|
-
return t.size ===
|
|
2451
|
+
return t.size === jc && t.clear(), i;
|
|
2452
2452
|
}), t = e.cache;
|
|
2453
2453
|
return e;
|
|
2454
2454
|
}
|
|
2455
|
-
var
|
|
2455
|
+
var Gc = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, Hc = /\\(\\)?/g, qc = zc(function(r) {
|
|
2456
2456
|
var e = [];
|
|
2457
|
-
return r.charCodeAt(0) === 46 && e.push(""), r.replace(
|
|
2458
|
-
e.push(s ? n.replace(
|
|
2457
|
+
return r.charCodeAt(0) === 46 && e.push(""), r.replace(Gc, function(t, i, s, n) {
|
|
2458
|
+
e.push(s ? n.replace(Hc, "$1") : i || t);
|
|
2459
2459
|
}), e;
|
|
2460
2460
|
});
|
|
2461
|
-
function
|
|
2462
|
-
return r == null ? "" :
|
|
2461
|
+
function Wc(r) {
|
|
2462
|
+
return r == null ? "" : Ji(r);
|
|
2463
2463
|
}
|
|
2464
|
-
function
|
|
2465
|
-
return D(r) ? r : qt(r, e) ? [r] :
|
|
2464
|
+
function ns(r, e) {
|
|
2465
|
+
return D(r) ? r : qt(r, e) ? [r] : qc(Wc(r));
|
|
2466
2466
|
}
|
|
2467
|
-
function
|
|
2468
|
-
if (typeof r == "string" ||
|
|
2467
|
+
function et(r) {
|
|
2468
|
+
if (typeof r == "string" || Ye(r))
|
|
2469
2469
|
return r;
|
|
2470
2470
|
var e = r + "";
|
|
2471
2471
|
return e == "0" && 1 / r == -1 / 0 ? "-0" : e;
|
|
2472
2472
|
}
|
|
2473
|
-
function
|
|
2474
|
-
e =
|
|
2473
|
+
function os(r, e) {
|
|
2474
|
+
e = ns(e, r);
|
|
2475
2475
|
for (var t = 0, i = e.length; r != null && t < i; )
|
|
2476
|
-
r = r[
|
|
2476
|
+
r = r[et(e[t++])];
|
|
2477
2477
|
return t && t == i ? r : void 0;
|
|
2478
2478
|
}
|
|
2479
|
-
function
|
|
2480
|
-
var i = r == null ? void 0 :
|
|
2479
|
+
function Xc(r, e, t) {
|
|
2480
|
+
var i = r == null ? void 0 : os(r, e);
|
|
2481
2481
|
return i === void 0 ? t : i;
|
|
2482
2482
|
}
|
|
2483
|
-
function
|
|
2483
|
+
function Kc(r, e) {
|
|
2484
2484
|
for (var t = -1, i = e.length, s = r.length; ++t < i; )
|
|
2485
2485
|
r[s + t] = e[t];
|
|
2486
2486
|
return r;
|
|
2487
2487
|
}
|
|
2488
|
-
function
|
|
2488
|
+
function Jc() {
|
|
2489
2489
|
this.__data__ = new X(), this.size = 0;
|
|
2490
2490
|
}
|
|
2491
|
-
function
|
|
2491
|
+
function Yc(r) {
|
|
2492
2492
|
var e = this.__data__, t = e.delete(r);
|
|
2493
2493
|
return this.size = e.size, t;
|
|
2494
2494
|
}
|
|
2495
|
-
function
|
|
2495
|
+
function Zc(r) {
|
|
2496
2496
|
return this.__data__.get(r);
|
|
2497
2497
|
}
|
|
2498
|
-
function
|
|
2498
|
+
function Qc(r) {
|
|
2499
2499
|
return this.__data__.has(r);
|
|
2500
2500
|
}
|
|
2501
|
-
var
|
|
2502
|
-
function
|
|
2501
|
+
var ed = 200;
|
|
2502
|
+
function td(r, e) {
|
|
2503
2503
|
var t = this.__data__;
|
|
2504
2504
|
if (t instanceof X) {
|
|
2505
2505
|
var i = t.__data__;
|
|
2506
|
-
if (!xe || i.length <
|
|
2506
|
+
if (!xe || i.length < ed - 1)
|
|
2507
2507
|
return i.push([r, e]), this.size = ++t.size, this;
|
|
2508
2508
|
t = this.__data__ = new K(i);
|
|
2509
2509
|
}
|
|
@@ -2513,56 +2513,56 @@ function H(r) {
|
|
|
2513
2513
|
var e = this.__data__ = new X(r);
|
|
2514
2514
|
this.size = e.size;
|
|
2515
2515
|
}
|
|
2516
|
-
H.prototype.clear =
|
|
2517
|
-
H.prototype.delete =
|
|
2518
|
-
H.prototype.get =
|
|
2519
|
-
H.prototype.has =
|
|
2520
|
-
H.prototype.set =
|
|
2521
|
-
function
|
|
2516
|
+
H.prototype.clear = Jc;
|
|
2517
|
+
H.prototype.delete = Yc;
|
|
2518
|
+
H.prototype.get = Zc;
|
|
2519
|
+
H.prototype.has = Qc;
|
|
2520
|
+
H.prototype.set = td;
|
|
2521
|
+
function as(r, e) {
|
|
2522
2522
|
for (var t = -1, i = r == null ? 0 : r.length, s = 0, n = []; ++t < i; ) {
|
|
2523
2523
|
var a = r[t];
|
|
2524
2524
|
e(a, t, r) && (n[s++] = a);
|
|
2525
2525
|
}
|
|
2526
2526
|
return n;
|
|
2527
2527
|
}
|
|
2528
|
-
function
|
|
2528
|
+
function rd() {
|
|
2529
2529
|
return [];
|
|
2530
2530
|
}
|
|
2531
|
-
var
|
|
2532
|
-
return r == null ? [] : (r = Object(r),
|
|
2533
|
-
return
|
|
2531
|
+
var id = Object.prototype, sd = id.propertyIsEnumerable, Wr = Object.getOwnPropertySymbols, nd = Wr ? function(r) {
|
|
2532
|
+
return r == null ? [] : (r = Object(r), as(Wr(r), function(e) {
|
|
2533
|
+
return sd.call(r, e);
|
|
2534
2534
|
}));
|
|
2535
|
-
} :
|
|
2536
|
-
function
|
|
2535
|
+
} : rd;
|
|
2536
|
+
function od(r, e, t) {
|
|
2537
2537
|
var i = e(r);
|
|
2538
|
-
return D(r) ? i :
|
|
2538
|
+
return D(r) ? i : Kc(i, t(r));
|
|
2539
2539
|
}
|
|
2540
2540
|
function Xr(r) {
|
|
2541
|
-
return
|
|
2541
|
+
return od(r, Ae, nd);
|
|
2542
2542
|
}
|
|
2543
|
-
var
|
|
2544
|
-
(
|
|
2545
|
-
var e = ge(r), t = e ==
|
|
2543
|
+
var Pt = ve(W, "DataView"), xt = ve(W, "Promise"), Rt = ve(W, "Set"), Kr = "[object Map]", ad = "[object Object]", Jr = "[object Promise]", Yr = "[object Set]", Zr = "[object WeakMap]", Qr = "[object DataView]", cd = ae(Pt), dd = ae(xe), ud = ae(xt), hd = ae(Rt), pd = ae(bt), J = ge;
|
|
2544
|
+
(Pt && J(new Pt(new ArrayBuffer(1))) != Qr || xe && J(new xe()) != Kr || xt && J(xt.resolve()) != Jr || Rt && J(new Rt()) != Yr || bt && J(new bt()) != Zr) && (J = function(r) {
|
|
2545
|
+
var e = ge(r), t = e == ad ? r.constructor : void 0, i = t ? ae(t) : "";
|
|
2546
2546
|
if (i)
|
|
2547
2547
|
switch (i) {
|
|
2548
|
-
case ad:
|
|
2549
|
-
return Qr;
|
|
2550
2548
|
case cd:
|
|
2551
|
-
return
|
|
2549
|
+
return Qr;
|
|
2552
2550
|
case dd:
|
|
2553
|
-
return
|
|
2551
|
+
return Kr;
|
|
2554
2552
|
case ud:
|
|
2555
|
-
return
|
|
2553
|
+
return Jr;
|
|
2556
2554
|
case hd:
|
|
2555
|
+
return Yr;
|
|
2556
|
+
case pd:
|
|
2557
2557
|
return Zr;
|
|
2558
2558
|
}
|
|
2559
2559
|
return e;
|
|
2560
2560
|
});
|
|
2561
|
-
var ei = W.Uint8Array,
|
|
2562
|
-
function ld(r) {
|
|
2563
|
-
return this.__data__.set(r, pd), this;
|
|
2564
|
-
}
|
|
2561
|
+
var ei = W.Uint8Array, ld = "__lodash_hash_undefined__";
|
|
2565
2562
|
function md(r) {
|
|
2563
|
+
return this.__data__.set(r, ld), this;
|
|
2564
|
+
}
|
|
2565
|
+
function fd(r) {
|
|
2566
2566
|
return this.__data__.has(r);
|
|
2567
2567
|
}
|
|
2568
2568
|
function je(r) {
|
|
@@ -2570,26 +2570,26 @@ function je(r) {
|
|
|
2570
2570
|
for (this.__data__ = new K(); ++e < t; )
|
|
2571
2571
|
this.add(r[e]);
|
|
2572
2572
|
}
|
|
2573
|
-
je.prototype.add = je.prototype.push =
|
|
2574
|
-
je.prototype.has =
|
|
2575
|
-
function
|
|
2573
|
+
je.prototype.add = je.prototype.push = md;
|
|
2574
|
+
je.prototype.has = fd;
|
|
2575
|
+
function _d(r, e) {
|
|
2576
2576
|
for (var t = -1, i = r == null ? 0 : r.length; ++t < i; )
|
|
2577
2577
|
if (e(r[t], t, r))
|
|
2578
2578
|
return !0;
|
|
2579
2579
|
return !1;
|
|
2580
2580
|
}
|
|
2581
|
-
function
|
|
2581
|
+
function gd(r, e) {
|
|
2582
2582
|
return r.has(e);
|
|
2583
2583
|
}
|
|
2584
|
-
var
|
|
2585
|
-
function
|
|
2586
|
-
var a = t &
|
|
2584
|
+
var vd = 1, Cd = 2;
|
|
2585
|
+
function cs(r, e, t, i, s, n) {
|
|
2586
|
+
var a = t & vd, o = r.length, u = e.length;
|
|
2587
2587
|
if (o != u && !(a && u > o))
|
|
2588
2588
|
return !1;
|
|
2589
|
-
var
|
|
2590
|
-
if (
|
|
2591
|
-
return
|
|
2592
|
-
var h = -1, p = !0, l = t &
|
|
2589
|
+
var d = n.get(r), c = n.get(e);
|
|
2590
|
+
if (d && c)
|
|
2591
|
+
return d == e && c == r;
|
|
2592
|
+
var h = -1, p = !0, l = t & Cd ? new je() : void 0;
|
|
2593
2593
|
for (n.set(r, e), n.set(e, r); ++h < o; ) {
|
|
2594
2594
|
var f = r[h], g = e[h];
|
|
2595
2595
|
if (i)
|
|
@@ -2601,8 +2601,8 @@ function as(r, e, t, i, s, n) {
|
|
|
2601
2601
|
break;
|
|
2602
2602
|
}
|
|
2603
2603
|
if (l) {
|
|
2604
|
-
if (!
|
|
2605
|
-
if (!
|
|
2604
|
+
if (!_d(e, function(T, b) {
|
|
2605
|
+
if (!gd(l, b) && (f === T || s(f, T, t, i, n)))
|
|
2606
2606
|
return l.push(b);
|
|
2607
2607
|
})) {
|
|
2608
2608
|
p = !1;
|
|
@@ -2615,62 +2615,62 @@ function as(r, e, t, i, s, n) {
|
|
|
2615
2615
|
}
|
|
2616
2616
|
return n.delete(r), n.delete(e), p;
|
|
2617
2617
|
}
|
|
2618
|
-
function
|
|
2618
|
+
function yd(r) {
|
|
2619
2619
|
var e = -1, t = Array(r.size);
|
|
2620
2620
|
return r.forEach(function(i, s) {
|
|
2621
2621
|
t[++e] = [s, i];
|
|
2622
2622
|
}), t;
|
|
2623
2623
|
}
|
|
2624
|
-
function
|
|
2624
|
+
function Sd(r) {
|
|
2625
2625
|
var e = -1, t = Array(r.size);
|
|
2626
2626
|
return r.forEach(function(i) {
|
|
2627
2627
|
t[++e] = i;
|
|
2628
2628
|
}), t;
|
|
2629
2629
|
}
|
|
2630
|
-
var
|
|
2631
|
-
function
|
|
2630
|
+
var Td = 1, Ed = 2, bd = "[object Boolean]", kd = "[object Date]", Pd = "[object Error]", xd = "[object Map]", Rd = "[object Number]", Ad = "[object RegExp]", wd = "[object Set]", Od = "[object String]", Id = "[object Symbol]", Md = "[object ArrayBuffer]", Dd = "[object DataView]", ti = Q ? Q.prototype : void 0, ht = ti ? ti.valueOf : void 0;
|
|
2631
|
+
function Ld(r, e, t, i, s, n, a) {
|
|
2632
2632
|
switch (t) {
|
|
2633
|
-
case
|
|
2633
|
+
case Dd:
|
|
2634
2634
|
if (r.byteLength != e.byteLength || r.byteOffset != e.byteOffset)
|
|
2635
2635
|
return !1;
|
|
2636
2636
|
r = r.buffer, e = e.buffer;
|
|
2637
|
-
case
|
|
2637
|
+
case Md:
|
|
2638
2638
|
return !(r.byteLength != e.byteLength || !n(new ei(r), new ei(e)));
|
|
2639
|
-
case Ed:
|
|
2640
2639
|
case bd:
|
|
2641
|
-
case xd:
|
|
2642
|
-
return Zi(+r, +e);
|
|
2643
2640
|
case kd:
|
|
2644
|
-
return r.name == e.name && r.message == e.message;
|
|
2645
2641
|
case Rd:
|
|
2646
|
-
|
|
2647
|
-
return r == e + "";
|
|
2642
|
+
return Qi(+r, +e);
|
|
2648
2643
|
case Pd:
|
|
2649
|
-
|
|
2644
|
+
return r.name == e.name && r.message == e.message;
|
|
2650
2645
|
case Ad:
|
|
2651
|
-
var u = i & Sd;
|
|
2652
|
-
if (o || (o = yd), r.size != e.size && !u)
|
|
2653
|
-
return !1;
|
|
2654
|
-
var c = a.get(r);
|
|
2655
|
-
if (c)
|
|
2656
|
-
return c == e;
|
|
2657
|
-
i |= Td, a.set(r, e);
|
|
2658
|
-
var d = as(o(r), o(e), i, s, n, a);
|
|
2659
|
-
return a.delete(r), d;
|
|
2660
2646
|
case Od:
|
|
2661
|
-
|
|
2662
|
-
|
|
2647
|
+
return r == e + "";
|
|
2648
|
+
case xd:
|
|
2649
|
+
var o = yd;
|
|
2650
|
+
case wd:
|
|
2651
|
+
var u = i & Td;
|
|
2652
|
+
if (o || (o = Sd), r.size != e.size && !u)
|
|
2653
|
+
return !1;
|
|
2654
|
+
var d = a.get(r);
|
|
2655
|
+
if (d)
|
|
2656
|
+
return d == e;
|
|
2657
|
+
i |= Ed, a.set(r, e);
|
|
2658
|
+
var c = cs(o(r), o(e), i, s, n, a);
|
|
2659
|
+
return a.delete(r), c;
|
|
2660
|
+
case Id:
|
|
2661
|
+
if (ht)
|
|
2662
|
+
return ht.call(r) == ht.call(e);
|
|
2663
2663
|
}
|
|
2664
2664
|
return !1;
|
|
2665
2665
|
}
|
|
2666
|
-
var
|
|
2667
|
-
function
|
|
2668
|
-
var a = t &
|
|
2669
|
-
if (u !=
|
|
2666
|
+
var Fd = 1, Nd = Object.prototype, Vd = Nd.hasOwnProperty;
|
|
2667
|
+
function Ud(r, e, t, i, s, n) {
|
|
2668
|
+
var a = t & Fd, o = Xr(r), u = o.length, d = Xr(e), c = d.length;
|
|
2669
|
+
if (u != c && !a)
|
|
2670
2670
|
return !1;
|
|
2671
2671
|
for (var h = u; h--; ) {
|
|
2672
2672
|
var p = o[h];
|
|
2673
|
-
if (!(a ? p in e :
|
|
2673
|
+
if (!(a ? p in e : Vd.call(e, p)))
|
|
2674
2674
|
return !1;
|
|
2675
2675
|
}
|
|
2676
2676
|
var l = n.get(r), f = n.get(e);
|
|
@@ -2695,32 +2695,32 @@ function Vd(r, e, t, i, s, n) {
|
|
|
2695
2695
|
}
|
|
2696
2696
|
return n.delete(r), n.delete(e), g;
|
|
2697
2697
|
}
|
|
2698
|
-
var
|
|
2699
|
-
function
|
|
2700
|
-
var a = D(r), o = D(e), u = a ? ii : J(r),
|
|
2701
|
-
u = u == ri ? Me : u,
|
|
2702
|
-
var
|
|
2703
|
-
if (p &&
|
|
2704
|
-
if (!
|
|
2698
|
+
var $d = 1, ri = "[object Arguments]", ii = "[object Array]", Me = "[object Object]", Bd = Object.prototype, si = Bd.hasOwnProperty;
|
|
2699
|
+
function jd(r, e, t, i, s, n) {
|
|
2700
|
+
var a = D(r), o = D(e), u = a ? ii : J(r), d = o ? ii : J(e);
|
|
2701
|
+
u = u == ri ? Me : u, d = d == ri ? Me : d;
|
|
2702
|
+
var c = u == Me, h = d == Me, p = u == d;
|
|
2703
|
+
if (p && kt(r)) {
|
|
2704
|
+
if (!kt(e))
|
|
2705
2705
|
return !1;
|
|
2706
|
-
a = !0,
|
|
2706
|
+
a = !0, c = !1;
|
|
2707
2707
|
}
|
|
2708
|
-
if (p && !
|
|
2709
|
-
return n || (n = new H()), a ||
|
|
2710
|
-
if (!(t &
|
|
2711
|
-
var l =
|
|
2708
|
+
if (p && !c)
|
|
2709
|
+
return n || (n = new H()), a || ss(r) ? cs(r, e, t, i, s, n) : Ld(r, e, u, t, i, s, n);
|
|
2710
|
+
if (!(t & $d)) {
|
|
2711
|
+
var l = c && si.call(r, "__wrapped__"), f = h && si.call(e, "__wrapped__");
|
|
2712
2712
|
if (l || f) {
|
|
2713
2713
|
var g = l ? r.value() : r, _ = f ? e.value() : e;
|
|
2714
2714
|
return n || (n = new H()), s(g, _, t, i, n);
|
|
2715
2715
|
}
|
|
2716
2716
|
}
|
|
2717
|
-
return p ? (n || (n = new H()),
|
|
2717
|
+
return p ? (n || (n = new H()), Ud(r, e, t, i, s, n)) : !1;
|
|
2718
2718
|
}
|
|
2719
2719
|
function Xt(r, e, t, i, s) {
|
|
2720
|
-
return r === e ? !0 : r == null || e == null || !me(r) && !me(e) ? r !== r && e !== e :
|
|
2720
|
+
return r === e ? !0 : r == null || e == null || !me(r) && !me(e) ? r !== r && e !== e : jd(r, e, t, i, Xt, s);
|
|
2721
2721
|
}
|
|
2722
|
-
var
|
|
2723
|
-
function
|
|
2722
|
+
var zd = 1, Gd = 2;
|
|
2723
|
+
function Hd(r, e, t, i) {
|
|
2724
2724
|
var s = t.length, n = s;
|
|
2725
2725
|
if (r == null)
|
|
2726
2726
|
return !n;
|
|
@@ -2731,79 +2731,79 @@ function Gd(r, e, t, i) {
|
|
|
2731
2731
|
}
|
|
2732
2732
|
for (; ++s < n; ) {
|
|
2733
2733
|
a = t[s];
|
|
2734
|
-
var o = a[0], u = r[o],
|
|
2734
|
+
var o = a[0], u = r[o], d = a[1];
|
|
2735
2735
|
if (a[2]) {
|
|
2736
2736
|
if (u === void 0 && !(o in r))
|
|
2737
2737
|
return !1;
|
|
2738
2738
|
} else {
|
|
2739
|
-
var
|
|
2740
|
-
if (!(h === void 0 ? Xt(
|
|
2739
|
+
var c = new H(), h;
|
|
2740
|
+
if (!(h === void 0 ? Xt(d, u, zd | Gd, i, c) : h))
|
|
2741
2741
|
return !1;
|
|
2742
2742
|
}
|
|
2743
2743
|
}
|
|
2744
2744
|
return !0;
|
|
2745
2745
|
}
|
|
2746
|
-
function
|
|
2746
|
+
function ds(r) {
|
|
2747
2747
|
return r === r && !ke(r);
|
|
2748
2748
|
}
|
|
2749
|
-
function
|
|
2749
|
+
function qd(r) {
|
|
2750
2750
|
for (var e = Ae(r), t = e.length; t--; ) {
|
|
2751
2751
|
var i = e[t], s = r[i];
|
|
2752
|
-
e[t] = [i, s,
|
|
2752
|
+
e[t] = [i, s, ds(s)];
|
|
2753
2753
|
}
|
|
2754
2754
|
return e;
|
|
2755
2755
|
}
|
|
2756
|
-
function
|
|
2756
|
+
function us(r, e) {
|
|
2757
2757
|
return function(t) {
|
|
2758
2758
|
return t == null ? !1 : t[r] === e && (e !== void 0 || r in Object(t));
|
|
2759
2759
|
};
|
|
2760
2760
|
}
|
|
2761
|
-
function
|
|
2762
|
-
var e =
|
|
2763
|
-
return e.length == 1 && e[0][2] ?
|
|
2764
|
-
return t === r ||
|
|
2761
|
+
function Wd(r) {
|
|
2762
|
+
var e = qd(r);
|
|
2763
|
+
return e.length == 1 && e[0][2] ? us(e[0][0], e[0][1]) : function(t) {
|
|
2764
|
+
return t === r || Hd(t, r, e);
|
|
2765
2765
|
};
|
|
2766
2766
|
}
|
|
2767
|
-
function
|
|
2767
|
+
function Xd(r, e) {
|
|
2768
2768
|
return r != null && e in Object(r);
|
|
2769
2769
|
}
|
|
2770
|
-
function
|
|
2771
|
-
e =
|
|
2770
|
+
function Kd(r, e, t) {
|
|
2771
|
+
e = ns(e, r);
|
|
2772
2772
|
for (var i = -1, s = e.length, n = !1; ++i < s; ) {
|
|
2773
|
-
var a =
|
|
2773
|
+
var a = et(e[i]);
|
|
2774
2774
|
if (!(n = r != null && t(r, a)))
|
|
2775
2775
|
break;
|
|
2776
2776
|
r = r[a];
|
|
2777
2777
|
}
|
|
2778
|
-
return n || ++i != s ? n : (s = r == null ? 0 : r.length, !!s && Gt(s) &&
|
|
2778
|
+
return n || ++i != s ? n : (s = r == null ? 0 : r.length, !!s && Gt(s) && Zi(a, s) && (D(r) || ts(r)));
|
|
2779
2779
|
}
|
|
2780
|
-
function
|
|
2781
|
-
return r != null &&
|
|
2780
|
+
function Jd(r, e) {
|
|
2781
|
+
return r != null && Kd(r, e, Xd);
|
|
2782
2782
|
}
|
|
2783
|
-
var
|
|
2784
|
-
function
|
|
2785
|
-
return qt(r) &&
|
|
2786
|
-
var i =
|
|
2787
|
-
return i === void 0 && i === e ?
|
|
2783
|
+
var Yd = 1, Zd = 2;
|
|
2784
|
+
function Qd(r, e) {
|
|
2785
|
+
return qt(r) && ds(e) ? us(et(r), e) : function(t) {
|
|
2786
|
+
var i = Xc(t, r);
|
|
2787
|
+
return i === void 0 && i === e ? Jd(t, r) : Xt(e, i, Yd | Zd);
|
|
2788
2788
|
};
|
|
2789
2789
|
}
|
|
2790
|
-
function
|
|
2790
|
+
function eu(r) {
|
|
2791
2791
|
return function(e) {
|
|
2792
2792
|
return e == null ? void 0 : e[r];
|
|
2793
2793
|
};
|
|
2794
2794
|
}
|
|
2795
|
-
function
|
|
2795
|
+
function tu(r) {
|
|
2796
2796
|
return function(e) {
|
|
2797
|
-
return
|
|
2797
|
+
return os(e, r);
|
|
2798
2798
|
};
|
|
2799
2799
|
}
|
|
2800
|
-
function
|
|
2801
|
-
return qt(r) ?
|
|
2800
|
+
function ru(r) {
|
|
2801
|
+
return qt(r) ? eu(et(r)) : tu(r);
|
|
2802
2802
|
}
|
|
2803
2803
|
function Kt(r) {
|
|
2804
|
-
return typeof r == "function" ? r : r == null ?
|
|
2804
|
+
return typeof r == "function" ? r : r == null ? sa : typeof r == "object" ? D(r) ? Qd(r[0], r[1]) : Wd(r) : ru(r);
|
|
2805
2805
|
}
|
|
2806
|
-
function
|
|
2806
|
+
function iu(r) {
|
|
2807
2807
|
return function(e, t, i) {
|
|
2808
2808
|
for (var s = -1, n = Object(e), a = i(e), o = a.length; o--; ) {
|
|
2809
2809
|
var u = a[++s];
|
|
@@ -2813,11 +2813,11 @@ function ru(r) {
|
|
|
2813
2813
|
return e;
|
|
2814
2814
|
};
|
|
2815
2815
|
}
|
|
2816
|
-
var
|
|
2817
|
-
function su(r, e) {
|
|
2818
|
-
return r && iu(r, e, Ae);
|
|
2819
|
-
}
|
|
2816
|
+
var su = iu();
|
|
2820
2817
|
function nu(r, e) {
|
|
2818
|
+
return r && su(r, e, Ae);
|
|
2819
|
+
}
|
|
2820
|
+
function ou(r, e) {
|
|
2821
2821
|
return function(t, i) {
|
|
2822
2822
|
if (t == null)
|
|
2823
2823
|
return t;
|
|
@@ -2828,18 +2828,18 @@ function nu(r, e) {
|
|
|
2828
2828
|
return t;
|
|
2829
2829
|
};
|
|
2830
2830
|
}
|
|
2831
|
-
var
|
|
2832
|
-
function
|
|
2831
|
+
var au = ou(nu);
|
|
2832
|
+
function cu(r, e) {
|
|
2833
2833
|
var t = [];
|
|
2834
|
-
return
|
|
2834
|
+
return au(r, function(i, s, n) {
|
|
2835
2835
|
e(i, s, n) && t.push(i);
|
|
2836
2836
|
}), t;
|
|
2837
2837
|
}
|
|
2838
|
-
function
|
|
2839
|
-
var t = D(r) ?
|
|
2838
|
+
function hs(r, e) {
|
|
2839
|
+
var t = D(r) ? as : cu;
|
|
2840
2840
|
return t(r, Kt(e));
|
|
2841
2841
|
}
|
|
2842
|
-
function
|
|
2842
|
+
function du(r) {
|
|
2843
2843
|
return function(e, t, i) {
|
|
2844
2844
|
var s = Object(e);
|
|
2845
2845
|
if (!Ht(e)) {
|
|
@@ -2852,27 +2852,27 @@ function cu(r) {
|
|
|
2852
2852
|
return a > -1 ? s[n ? e[a] : a] : void 0;
|
|
2853
2853
|
};
|
|
2854
2854
|
}
|
|
2855
|
-
var
|
|
2856
|
-
function
|
|
2855
|
+
var uu = Math.max;
|
|
2856
|
+
function hu(r, e, t) {
|
|
2857
2857
|
var i = r == null ? 0 : r.length;
|
|
2858
2858
|
if (!i)
|
|
2859
2859
|
return -1;
|
|
2860
|
-
var s = t == null ? 0 :
|
|
2861
|
-
return s < 0 && (s =
|
|
2860
|
+
var s = t == null ? 0 : ia(t);
|
|
2861
|
+
return s < 0 && (s = uu(i + s, 0)), Sa(r, Kt(e), s);
|
|
2862
2862
|
}
|
|
2863
|
-
var Re =
|
|
2864
|
-
function
|
|
2865
|
-
return
|
|
2863
|
+
var Re = du(hu);
|
|
2864
|
+
function pu(r, e) {
|
|
2865
|
+
return Ki(e, function(t) {
|
|
2866
2866
|
return r[t];
|
|
2867
2867
|
});
|
|
2868
2868
|
}
|
|
2869
2869
|
function ue(r) {
|
|
2870
|
-
return r == null ? [] :
|
|
2870
|
+
return r == null ? [] : pu(r, Ae(r));
|
|
2871
2871
|
}
|
|
2872
|
-
function
|
|
2872
|
+
function lu(r) {
|
|
2873
2873
|
return r == null;
|
|
2874
2874
|
}
|
|
2875
|
-
class
|
|
2875
|
+
class mu extends Je {
|
|
2876
2876
|
constructor(e) {
|
|
2877
2877
|
super({
|
|
2878
2878
|
type: S.Microphone,
|
|
@@ -2892,7 +2892,7 @@ class lu extends Ke {
|
|
|
2892
2892
|
this.source.destroy();
|
|
2893
2893
|
}
|
|
2894
2894
|
}
|
|
2895
|
-
class
|
|
2895
|
+
class fu extends _e {
|
|
2896
2896
|
constructor(e) {
|
|
2897
2897
|
super({
|
|
2898
2898
|
type: S.VideoFile,
|
|
@@ -2924,7 +2924,7 @@ class mu extends _e {
|
|
|
2924
2924
|
(e = this._videoStream) == null || e.destroy(), (t = this._audioStream) == null || t.destroy(), delete this._trackMap.video, delete this._trackMap.audio;
|
|
2925
2925
|
}
|
|
2926
2926
|
}
|
|
2927
|
-
class
|
|
2927
|
+
class _u extends _e {
|
|
2928
2928
|
constructor(e) {
|
|
2929
2929
|
super({
|
|
2930
2930
|
type: S.Screen,
|
|
@@ -2956,7 +2956,7 @@ class fu extends _e {
|
|
|
2956
2956
|
(e = this._videoStream) == null || e.destroy(), (t = this._audioStream) == null || t.destroy(), delete this._trackMap.video, delete this._trackMap.audio;
|
|
2957
2957
|
}
|
|
2958
2958
|
}
|
|
2959
|
-
class
|
|
2959
|
+
class gu extends Je {
|
|
2960
2960
|
constructor(e) {
|
|
2961
2961
|
super({
|
|
2962
2962
|
type: S.AudioFile,
|
|
@@ -2981,7 +2981,7 @@ class _u extends Ke {
|
|
|
2981
2981
|
(e = this._audioStream) == null || e.destroy();
|
|
2982
2982
|
}
|
|
2983
2983
|
}
|
|
2984
|
-
class
|
|
2984
|
+
class vu extends _e {
|
|
2985
2985
|
constructor(e) {
|
|
2986
2986
|
super({
|
|
2987
2987
|
type: S.Image,
|
|
@@ -3004,7 +3004,7 @@ class gu extends _e {
|
|
|
3004
3004
|
this.source.destroy();
|
|
3005
3005
|
}
|
|
3006
3006
|
}
|
|
3007
|
-
class
|
|
3007
|
+
class Cu extends _e {
|
|
3008
3008
|
constructor(e) {
|
|
3009
3009
|
super({
|
|
3010
3010
|
type: S.CustomVideo,
|
|
@@ -3027,7 +3027,7 @@ class vu extends _e {
|
|
|
3027
3027
|
this.source.destroy();
|
|
3028
3028
|
}
|
|
3029
3029
|
}
|
|
3030
|
-
class
|
|
3030
|
+
class yu extends Je {
|
|
3031
3031
|
constructor(e) {
|
|
3032
3032
|
super({
|
|
3033
3033
|
type: S.CustomAudio,
|
|
@@ -3050,7 +3050,7 @@ class Cu extends Ke {
|
|
|
3050
3050
|
(e = this._audioStream) == null || e.destroy();
|
|
3051
3051
|
}
|
|
3052
3052
|
}
|
|
3053
|
-
const
|
|
3053
|
+
const Su = ["user", "environment"];
|
|
3054
3054
|
var V = /* @__PURE__ */ ((r) => (r[r.OPEN_CAMERA_FAILED = 1001] = "OPEN_CAMERA_FAILED", r[r.OPEN_MICROPHONE_FAILED = 1002] = "OPEN_MICROPHONE_FAILED", r[r.OPEN_SCREEN_FAILED = 1003] = "OPEN_SCREEN_FAILED", r[r.VIDEO_FILE_CAPTURE_FAILED = 1004] = "VIDEO_FILE_CAPTURE_FAILED", r[r.AUDIO_FILE_CAPTURE_FAILED = 1005] = "AUDIO_FILE_CAPTURE_FAILED", r[r.IMAGE_FILE_CAPTURE_FAILED = 1006] = "IMAGE_FILE_CAPTURE_FAILED", r[r.VOLUME_DETECT_FAILED = 1008] = "VOLUME_DETECT_FAILED", r[r.PUBLISH_FAILED = 2001] = "PUBLISH_FAILED", r[r.UPDATE_PUBLISH_FAILED = 2002] = "UPDATE_PUBLISH_FAILED", r[r.PUSH_CONNECT_FAILED = 2003] = "PUSH_CONNECT_FAILED", r))(V || {});
|
|
3055
3055
|
class Te extends Error {
|
|
3056
3056
|
constructor(e, t, i) {
|
|
@@ -3058,12 +3058,12 @@ class Te extends Error {
|
|
|
3058
3058
|
}
|
|
3059
3059
|
}
|
|
3060
3060
|
function fe(r, e, t) {
|
|
3061
|
-
const i =
|
|
3061
|
+
const i = gt.Landscape;
|
|
3062
3062
|
if (e === "video") {
|
|
3063
|
-
const u = (i ===
|
|
3063
|
+
const u = (i === gt.Landscape ? Ri : Ai)[r], [d, c, h, p] = u.split("x").map((l) => Number(l));
|
|
3064
3064
|
return {
|
|
3065
|
-
width:
|
|
3066
|
-
height:
|
|
3065
|
+
width: d,
|
|
3066
|
+
height: c,
|
|
3067
3067
|
frameRate: h,
|
|
3068
3068
|
bitrate: p * 1e3
|
|
3069
3069
|
};
|
|
@@ -3074,7 +3074,7 @@ function fe(r, e, t) {
|
|
|
3074
3074
|
bitrate: a * 1e3
|
|
3075
3075
|
};
|
|
3076
3076
|
}
|
|
3077
|
-
class
|
|
3077
|
+
class Tu extends te {
|
|
3078
3078
|
constructor() {
|
|
3079
3079
|
super(), this._videoConstraints = {
|
|
3080
3080
|
width: 1080,
|
|
@@ -3133,7 +3133,7 @@ class Su extends te {
|
|
|
3133
3133
|
};
|
|
3134
3134
|
}
|
|
3135
3135
|
async getDevicesList(e) {
|
|
3136
|
-
return
|
|
3136
|
+
return io(
|
|
3137
3137
|
e ? [e] : ["audioinput", "videoinput"]
|
|
3138
3138
|
);
|
|
3139
3139
|
}
|
|
@@ -3185,16 +3185,16 @@ class Su extends te {
|
|
|
3185
3185
|
}
|
|
3186
3186
|
async startCameraCapture(e) {
|
|
3187
3187
|
let t = {};
|
|
3188
|
-
|
|
3188
|
+
Su.includes(e) ? t = {
|
|
3189
3189
|
facingMode: e
|
|
3190
3190
|
} : t = {
|
|
3191
3191
|
deviceId: e
|
|
3192
3192
|
};
|
|
3193
3193
|
try {
|
|
3194
|
-
const i = await
|
|
3194
|
+
const i = await so({
|
|
3195
3195
|
...t,
|
|
3196
3196
|
...this._videoConstraints
|
|
3197
|
-
}), s = new
|
|
3197
|
+
}), s = new Do(i);
|
|
3198
3198
|
return this._cameraStreams[s.id] = s, this._notifyCaptured(s), this._bindStreamEvent(s), s.id;
|
|
3199
3199
|
} catch (i) {
|
|
3200
3200
|
throw this._handleError(i, V.OPEN_CAMERA_FAILED), i;
|
|
@@ -3202,10 +3202,10 @@ class Su extends te {
|
|
|
3202
3202
|
}
|
|
3203
3203
|
async startMicrophoneCapture(e) {
|
|
3204
3204
|
try {
|
|
3205
|
-
const t = await
|
|
3205
|
+
const t = await oo({
|
|
3206
3206
|
...this._audioConstraints,
|
|
3207
3207
|
deviceId: e
|
|
3208
|
-
}), i = new
|
|
3208
|
+
}), i = new mu(t);
|
|
3209
3209
|
return this._microphoneStreams[i.id] = i, this._notifyCaptured(i), this._bindStreamEvent(i), i.id;
|
|
3210
3210
|
} catch (t) {
|
|
3211
3211
|
throw this._handleError(
|
|
@@ -3216,10 +3216,10 @@ class Su extends te {
|
|
|
3216
3216
|
}
|
|
3217
3217
|
async startScreenCapture(e) {
|
|
3218
3218
|
try {
|
|
3219
|
-
const t = await
|
|
3219
|
+
const t = await ao({
|
|
3220
3220
|
audio: e,
|
|
3221
3221
|
video: this._videoConstraints
|
|
3222
|
-
}), i = new
|
|
3222
|
+
}), i = new _u(t);
|
|
3223
3223
|
return this._screenStreams[i.id] = i, this._notifyCaptured(i), this._bindStreamEvent(i), i.id;
|
|
3224
3224
|
} catch (t) {
|
|
3225
3225
|
throw this._handleError(t, V.OPEN_SCREEN_FAILED), t;
|
|
@@ -3232,7 +3232,7 @@ class Su extends te {
|
|
|
3232
3232
|
video: !0,
|
|
3233
3233
|
audio: !0,
|
|
3234
3234
|
loop: !0
|
|
3235
|
-
}), i = new
|
|
3235
|
+
}), i = new fu(t);
|
|
3236
3236
|
return this._videoFileStreams[i.id] = i, this._notifyCaptured(i), this._bindStreamEvent(i), i.id;
|
|
3237
3237
|
} catch (t) {
|
|
3238
3238
|
throw this._handleError(
|
|
@@ -3248,7 +3248,7 @@ class Su extends te {
|
|
|
3248
3248
|
video: !1,
|
|
3249
3249
|
audio: !0,
|
|
3250
3250
|
loop: !0
|
|
3251
|
-
}), i = new
|
|
3251
|
+
}), i = new gu(t);
|
|
3252
3252
|
return this._audioFileStreams[i.id] = i, this._notifyCaptured(i), this._bindStreamEvent(i), i.id;
|
|
3253
3253
|
} catch (t) {
|
|
3254
3254
|
throw this._handleError(
|
|
@@ -3259,12 +3259,12 @@ class Su extends te {
|
|
|
3259
3259
|
}
|
|
3260
3260
|
async startImageCapture(e) {
|
|
3261
3261
|
try {
|
|
3262
|
-
const t = await
|
|
3262
|
+
const t = await no({
|
|
3263
3263
|
url: e,
|
|
3264
3264
|
width: 0,
|
|
3265
3265
|
height: 0,
|
|
3266
3266
|
frameRate: 30
|
|
3267
|
-
}), i = new
|
|
3267
|
+
}), i = new vu(t);
|
|
3268
3268
|
return this._imageStreams[i.id] = i, this._notifyCaptured(i), this._bindStreamEvent(i), i.id;
|
|
3269
3269
|
} catch (t) {
|
|
3270
3270
|
throw this._handleError(
|
|
@@ -3274,16 +3274,16 @@ class Su extends te {
|
|
|
3274
3274
|
}
|
|
3275
3275
|
}
|
|
3276
3276
|
startCustomVideoCapture(e) {
|
|
3277
|
-
const t =
|
|
3277
|
+
const t = uo(e);
|
|
3278
3278
|
if (t) {
|
|
3279
|
-
const i = new
|
|
3279
|
+
const i = new Cu(t);
|
|
3280
3280
|
return this._customVideoStreams[i.id] = i, this._notifyCaptured(i), this._bindStreamEvent(i), i.id;
|
|
3281
3281
|
}
|
|
3282
3282
|
}
|
|
3283
3283
|
startCustomAudioCapture(e) {
|
|
3284
|
-
const t =
|
|
3284
|
+
const t = ho(e);
|
|
3285
3285
|
if (t) {
|
|
3286
|
-
const i = new
|
|
3286
|
+
const i = new yu(t);
|
|
3287
3287
|
return this._customAudioStreams[i.id] = i, this._notifyCaptured(i), this._bindStreamEvent(i), i.id;
|
|
3288
3288
|
}
|
|
3289
3289
|
}
|
|
@@ -3385,7 +3385,7 @@ class Jt {
|
|
|
3385
3385
|
}
|
|
3386
3386
|
}
|
|
3387
3387
|
const ni = new ce("SingleComposer");
|
|
3388
|
-
class
|
|
3388
|
+
class Eu extends Jt {
|
|
3389
3389
|
onStreamCapture(e) {
|
|
3390
3390
|
e.isVideoStream ? this._handleVideoStreamCapture(e) : this._handleAudioStreamCapture(e);
|
|
3391
3391
|
}
|
|
@@ -3456,7 +3456,7 @@ class Tu extends Jt {
|
|
|
3456
3456
|
return this._composedStream;
|
|
3457
3457
|
}
|
|
3458
3458
|
}
|
|
3459
|
-
class
|
|
3459
|
+
class bu extends te {
|
|
3460
3460
|
constructor(e, {
|
|
3461
3461
|
width: t,
|
|
3462
3462
|
height: i,
|
|
@@ -3504,7 +3504,7 @@ class Eu extends te {
|
|
|
3504
3504
|
};
|
|
3505
3505
|
}
|
|
3506
3506
|
_bindVideoTrackSizeChange() {
|
|
3507
|
-
this._stream.on(
|
|
3507
|
+
this._stream.on(Nt.SizeChange, ({ width: e, height: t }) => {
|
|
3508
3508
|
this.setBaseProps("sourceWidth", e), this.setBaseProps("sourceHeight", t);
|
|
3509
3509
|
});
|
|
3510
3510
|
}
|
|
@@ -3625,16 +3625,16 @@ class oi extends _e {
|
|
|
3625
3625
|
this.source.stop(), delete this._trackMap.video;
|
|
3626
3626
|
}
|
|
3627
3627
|
}
|
|
3628
|
-
var
|
|
3629
|
-
for (var s =
|
|
3628
|
+
var ku = Object.defineProperty, Pu = Object.getOwnPropertyDescriptor, we = (r, e, t, i) => {
|
|
3629
|
+
for (var s = Pu(e, t), n = r.length - 1, a; n >= 0; n--)
|
|
3630
3630
|
(a = r[n]) && (s = a(e, t, s) || s);
|
|
3631
|
-
return s &&
|
|
3631
|
+
return s && ku(e, t, s), s;
|
|
3632
3632
|
};
|
|
3633
|
-
const
|
|
3633
|
+
const ps = new ce("composition-composer");
|
|
3634
3634
|
function Oe(r, e, t) {
|
|
3635
3635
|
const i = t.value;
|
|
3636
3636
|
return t.value = function(...s) {
|
|
3637
|
-
return this._active ||
|
|
3637
|
+
return this._active || ps.error("composer is not active"), i.apply(this, s);
|
|
3638
3638
|
}, t;
|
|
3639
3639
|
}
|
|
3640
3640
|
class Ce extends Jt {
|
|
@@ -3644,7 +3644,7 @@ class Ce extends Jt {
|
|
|
3644
3644
|
height: 720,
|
|
3645
3645
|
frameRate: 30,
|
|
3646
3646
|
backgroundColor: "#000000"
|
|
3647
|
-
}, this._sprites = [], this._videoMixer = new
|
|
3647
|
+
}, this._sprites = [], this._videoMixer = new Ao();
|
|
3648
3648
|
}
|
|
3649
3649
|
onStreamCapture(e) {
|
|
3650
3650
|
}
|
|
@@ -3660,7 +3660,7 @@ class Ce extends Jt {
|
|
|
3660
3660
|
super.disable(), this._videoMixer.stop();
|
|
3661
3661
|
}
|
|
3662
3662
|
_updateSpriteToMixer() {
|
|
3663
|
-
const e =
|
|
3663
|
+
const e = hs(
|
|
3664
3664
|
this._sprites.map((t) => t.isHidden ? null : t.getViewNode())
|
|
3665
3665
|
);
|
|
3666
3666
|
this._videoMixer.draw(e);
|
|
@@ -3670,7 +3670,7 @@ class Ce extends Jt {
|
|
|
3670
3670
|
}
|
|
3671
3671
|
_addSprite(e) {
|
|
3672
3672
|
this._sprites.push(e), this._sprites = this._sprites.sort((t, i) => t.zOrder - i.zOrder), e.on("propsChange", (t) => {
|
|
3673
|
-
|
|
3673
|
+
lu(t.zOrder) || (this._sprites = this._sprites.sort(
|
|
3674
3674
|
(i, s) => i.zOrder - s.zOrder
|
|
3675
3675
|
)), this._updateSpriteToMixer();
|
|
3676
3676
|
}), this._updateSpriteToMixer();
|
|
@@ -3687,14 +3687,14 @@ class Ce extends Jt {
|
|
|
3687
3687
|
}
|
|
3688
3688
|
addVideoStream(e, t) {
|
|
3689
3689
|
if (!e.viewNode) {
|
|
3690
|
-
|
|
3690
|
+
ps.error("have no viewNode for composition");
|
|
3691
3691
|
return;
|
|
3692
3692
|
}
|
|
3693
3693
|
e.audioTrack && this._streamComposeController.addAudioStream({
|
|
3694
3694
|
streamId: e.id,
|
|
3695
3695
|
volume: 100
|
|
3696
3696
|
});
|
|
3697
|
-
const i = new
|
|
3697
|
+
const i = new bu(e, t);
|
|
3698
3698
|
this._addSprite(i);
|
|
3699
3699
|
}
|
|
3700
3700
|
_updateSingleVideoStream(e) {
|
|
@@ -3754,7 +3754,7 @@ we([
|
|
|
3754
3754
|
we([
|
|
3755
3755
|
Oe
|
|
3756
3756
|
], Ce.prototype, "unmuteVideoStream");
|
|
3757
|
-
class
|
|
3757
|
+
class xu extends te {
|
|
3758
3758
|
constructor(e, { volume: t }) {
|
|
3759
3759
|
super(), this._volume = 100, this._isMute = !1, this._volume = t ?? 100, this._stream = e;
|
|
3760
3760
|
}
|
|
@@ -3782,7 +3782,7 @@ class Pu extends te {
|
|
|
3782
3782
|
return this._stream;
|
|
3783
3783
|
}
|
|
3784
3784
|
}
|
|
3785
|
-
class
|
|
3785
|
+
class Ru extends Je {
|
|
3786
3786
|
constructor(e) {
|
|
3787
3787
|
super({
|
|
3788
3788
|
type: S.MixAudio,
|
|
@@ -3806,9 +3806,9 @@ class xu extends Ke {
|
|
|
3806
3806
|
(e = this._trackMap.audio) == null || e.stop(), delete this._trackMap.audio;
|
|
3807
3807
|
}
|
|
3808
3808
|
}
|
|
3809
|
-
class
|
|
3809
|
+
class Au extends Jt {
|
|
3810
3810
|
constructor(e) {
|
|
3811
|
-
super(e), this._spriteList = [], this._audioMixer = new
|
|
3811
|
+
super(e), this._spriteList = [], this._audioMixer = new lo();
|
|
3812
3812
|
}
|
|
3813
3813
|
onStreamCapture(e) {
|
|
3814
3814
|
}
|
|
@@ -3816,7 +3816,7 @@ class Ru extends Jt {
|
|
|
3816
3816
|
e && this.removeAudioStream(e.id);
|
|
3817
3817
|
}
|
|
3818
3818
|
_updateSpriteToMixer() {
|
|
3819
|
-
const e =
|
|
3819
|
+
const e = hs(
|
|
3820
3820
|
this._spriteList.map((t) => t.isMute ? null : t.getMixerNode())
|
|
3821
3821
|
);
|
|
3822
3822
|
this._audioMixer.mix(e);
|
|
@@ -3827,11 +3827,11 @@ class Ru extends Jt {
|
|
|
3827
3827
|
}
|
|
3828
3828
|
enable() {
|
|
3829
3829
|
super.enable();
|
|
3830
|
-
const e = this._audioMixer.track(), t = new
|
|
3830
|
+
const e = this._audioMixer.track(), t = new Ru(e);
|
|
3831
3831
|
this._composedStream.setAudioStream(t), this._audioMixer.mix([]);
|
|
3832
3832
|
}
|
|
3833
3833
|
addAudioStream(e, t) {
|
|
3834
|
-
const i = new
|
|
3834
|
+
const i = new xu(e, t);
|
|
3835
3835
|
this._spriteList.push(i), this._updateSpriteToMixer();
|
|
3836
3836
|
}
|
|
3837
3837
|
removeAudioStream(e) {
|
|
@@ -3874,7 +3874,7 @@ class Ru extends Jt {
|
|
|
3874
3874
|
return this._spriteList.filter((t) => t.stream.type === e).map((t) => t.stream);
|
|
3875
3875
|
}
|
|
3876
3876
|
}
|
|
3877
|
-
class
|
|
3877
|
+
class wu extends te {
|
|
3878
3878
|
constructor({
|
|
3879
3879
|
videoStream: e,
|
|
3880
3880
|
audioStream: t
|
|
@@ -3904,10 +3904,10 @@ class Au extends te {
|
|
|
3904
3904
|
return (e = this._audioStream) == null ? void 0 : e.audioTrack;
|
|
3905
3905
|
}
|
|
3906
3906
|
}
|
|
3907
|
-
const
|
|
3908
|
-
class
|
|
3907
|
+
const Ou = new ce("streamComposeController");
|
|
3908
|
+
class Iu {
|
|
3909
3909
|
constructor(e) {
|
|
3910
|
-
this._streamManagerController = e, this._composedStream = new
|
|
3910
|
+
this._streamManagerController = e, this._composedStream = new wu(), this.singleComposer = new Eu({
|
|
3911
3911
|
streamManagerController: this._streamManagerController,
|
|
3912
3912
|
composedStream: this._composedStream,
|
|
3913
3913
|
streamComposeController: this
|
|
@@ -3915,7 +3915,7 @@ class Ou {
|
|
|
3915
3915
|
streamManagerController: this._streamManagerController,
|
|
3916
3916
|
composedStream: this._composedStream,
|
|
3917
3917
|
streamComposeController: this
|
|
3918
|
-
}), this.mixerComposer = new
|
|
3918
|
+
}), this.mixerComposer = new Au({
|
|
3919
3919
|
streamManagerController: this._streamManagerController,
|
|
3920
3920
|
composedStream: this._composedStream,
|
|
3921
3921
|
streamComposeController: this
|
|
@@ -3961,7 +3961,7 @@ class Ou {
|
|
|
3961
3961
|
e.streamId
|
|
3962
3962
|
);
|
|
3963
3963
|
if (!t) {
|
|
3964
|
-
|
|
3964
|
+
Ou.error("can not find video stream" + e.streamId);
|
|
3965
3965
|
return;
|
|
3966
3966
|
}
|
|
3967
3967
|
this.compositionComposer.addVideoStream(t, e);
|
|
@@ -4005,7 +4005,7 @@ class Ou {
|
|
|
4005
4005
|
this.compositionComposer.setMixerWorkerScript(e);
|
|
4006
4006
|
}
|
|
4007
4007
|
}
|
|
4008
|
-
class
|
|
4008
|
+
class ls {
|
|
4009
4009
|
constructor(e) {
|
|
4010
4010
|
this._hasBindComposedStreamEvent = !1, this._composedStream = e;
|
|
4011
4011
|
}
|
|
@@ -4029,7 +4029,7 @@ class ps {
|
|
|
4029
4029
|
}
|
|
4030
4030
|
}
|
|
4031
4031
|
const he = new ce("PreviewConsumer");
|
|
4032
|
-
class
|
|
4032
|
+
class Mu extends ls {
|
|
4033
4033
|
constructor(e, {
|
|
4034
4034
|
streamConsumeController: t
|
|
4035
4035
|
}) {
|
|
@@ -4121,11 +4121,11 @@ class Iu extends ps {
|
|
|
4121
4121
|
return this._isPreviewing;
|
|
4122
4122
|
}
|
|
4123
4123
|
}
|
|
4124
|
-
var $ = {},
|
|
4124
|
+
var $ = {}, pt = {}, lt = { exports: {} }, ai;
|
|
4125
4125
|
function Yt() {
|
|
4126
|
-
if (ai) return
|
|
4126
|
+
if (ai) return lt.exports;
|
|
4127
4127
|
ai = 1;
|
|
4128
|
-
var r =
|
|
4128
|
+
var r = lt.exports = {
|
|
4129
4129
|
v: [{
|
|
4130
4130
|
name: "version",
|
|
4131
4131
|
reg: /^(\d*)$/
|
|
@@ -4564,54 +4564,54 @@ function Yt() {
|
|
|
4564
4564
|
t.forEach(function(i) {
|
|
4565
4565
|
i.reg || (i.reg = /(.*)/), i.format || (i.format = "%s");
|
|
4566
4566
|
});
|
|
4567
|
-
}),
|
|
4567
|
+
}), lt.exports;
|
|
4568
4568
|
}
|
|
4569
4569
|
var ci;
|
|
4570
|
-
function
|
|
4570
|
+
function Du() {
|
|
4571
4571
|
return ci || (ci = 1, function(r) {
|
|
4572
4572
|
var e = function(o) {
|
|
4573
4573
|
return String(Number(o)) === o ? Number(o) : o;
|
|
4574
|
-
}, t = function(o, u,
|
|
4575
|
-
if (
|
|
4576
|
-
u[
|
|
4574
|
+
}, t = function(o, u, d, c) {
|
|
4575
|
+
if (c && !d)
|
|
4576
|
+
u[c] = e(o[1]);
|
|
4577
4577
|
else
|
|
4578
|
-
for (var h = 0; h <
|
|
4579
|
-
o[h + 1] != null && (u[
|
|
4580
|
-
}, i = function(o, u,
|
|
4581
|
-
var
|
|
4582
|
-
o.push && !u[o.push] ? u[o.push] = [] :
|
|
4578
|
+
for (var h = 0; h < d.length; h += 1)
|
|
4579
|
+
o[h + 1] != null && (u[d[h]] = e(o[h + 1]));
|
|
4580
|
+
}, i = function(o, u, d) {
|
|
4581
|
+
var c = o.name && o.names;
|
|
4582
|
+
o.push && !u[o.push] ? u[o.push] = [] : c && !u[o.name] && (u[o.name] = {});
|
|
4583
4583
|
var h = o.push ? {} : (
|
|
4584
4584
|
// blank object that will be pushed
|
|
4585
|
-
|
|
4585
|
+
c ? u[o.name] : u
|
|
4586
4586
|
);
|
|
4587
|
-
t(
|
|
4587
|
+
t(d.match(o.reg), h, o.names, o.name), o.push && u[o.push].push(h);
|
|
4588
4588
|
}, s = Yt(), n = RegExp.prototype.test.bind(/^([a-z])=(.*)/);
|
|
4589
4589
|
r.parse = function(o) {
|
|
4590
|
-
var u = {},
|
|
4590
|
+
var u = {}, d = [], c = u;
|
|
4591
4591
|
return o.split(/(\r\n|\r|\n)/).filter(n).forEach(function(h) {
|
|
4592
4592
|
var p = h[0], l = h.slice(2);
|
|
4593
|
-
p === "m" && (
|
|
4593
|
+
p === "m" && (d.push({ rtp: [], fmtp: [] }), c = d[d.length - 1]);
|
|
4594
4594
|
for (var f = 0; f < (s[p] || []).length; f += 1) {
|
|
4595
4595
|
var g = s[p][f];
|
|
4596
4596
|
if (g.reg.test(l))
|
|
4597
|
-
return i(g,
|
|
4597
|
+
return i(g, c, l);
|
|
4598
4598
|
}
|
|
4599
|
-
}), u.media =
|
|
4599
|
+
}), u.media = d, u;
|
|
4600
4600
|
};
|
|
4601
4601
|
var a = function(o, u) {
|
|
4602
|
-
var
|
|
4603
|
-
return
|
|
4602
|
+
var d = u.split(/=(.+)/, 2);
|
|
4603
|
+
return d.length === 2 ? o[d[0]] = e(d[1]) : d.length === 1 && u.length > 1 && (o[d[0]] = void 0), o;
|
|
4604
4604
|
};
|
|
4605
4605
|
r.parseParams = function(o) {
|
|
4606
4606
|
return o.split(/;\s?/).reduce(a, {});
|
|
4607
4607
|
}, r.parseFmtpConfig = r.parseParams, r.parsePayloads = function(o) {
|
|
4608
4608
|
return o.toString().split(" ").map(Number);
|
|
4609
4609
|
}, r.parseRemoteCandidates = function(o) {
|
|
4610
|
-
for (var u = [],
|
|
4610
|
+
for (var u = [], d = o.split(" ").map(e), c = 0; c < d.length; c += 3)
|
|
4611
4611
|
u.push({
|
|
4612
|
-
component: c
|
|
4613
|
-
ip: c
|
|
4614
|
-
port: c
|
|
4612
|
+
component: d[c],
|
|
4613
|
+
ip: d[c + 1],
|
|
4614
|
+
port: d[c + 2]
|
|
4615
4615
|
});
|
|
4616
4616
|
return u;
|
|
4617
4617
|
}, r.parseImageAttributes = function(o) {
|
|
@@ -4620,28 +4620,28 @@ function Mu() {
|
|
|
4620
4620
|
});
|
|
4621
4621
|
}, r.parseSimulcastStreamList = function(o) {
|
|
4622
4622
|
return o.split(";").map(function(u) {
|
|
4623
|
-
return u.split(",").map(function(
|
|
4624
|
-
var
|
|
4625
|
-
return
|
|
4626
|
-
scid:
|
|
4623
|
+
return u.split(",").map(function(d) {
|
|
4624
|
+
var c, h = !1;
|
|
4625
|
+
return d[0] !== "~" ? c = e(d) : (c = e(d.substring(1, d.length)), h = !0), {
|
|
4626
|
+
scid: c,
|
|
4627
4627
|
paused: h
|
|
4628
4628
|
};
|
|
4629
4629
|
});
|
|
4630
4630
|
});
|
|
4631
4631
|
};
|
|
4632
|
-
}(
|
|
4632
|
+
}(pt)), pt;
|
|
4633
4633
|
}
|
|
4634
|
-
var
|
|
4635
|
-
function
|
|
4636
|
-
if (di) return
|
|
4634
|
+
var mt, di;
|
|
4635
|
+
function Lu() {
|
|
4636
|
+
if (di) return mt;
|
|
4637
4637
|
di = 1;
|
|
4638
4638
|
var r = Yt(), e = /%[sdv%]/g, t = function(a) {
|
|
4639
|
-
var o = 1, u = arguments,
|
|
4640
|
-
return a.replace(e, function(
|
|
4641
|
-
if (o >=
|
|
4642
|
-
return
|
|
4639
|
+
var o = 1, u = arguments, d = u.length;
|
|
4640
|
+
return a.replace(e, function(c) {
|
|
4641
|
+
if (o >= d)
|
|
4642
|
+
return c;
|
|
4643
4643
|
var h = u[o];
|
|
4644
|
-
switch (o += 1,
|
|
4644
|
+
switch (o += 1, c) {
|
|
4645
4645
|
case "%%":
|
|
4646
4646
|
return "%";
|
|
4647
4647
|
case "%s":
|
|
@@ -4653,15 +4653,15 @@ function Du() {
|
|
|
4653
4653
|
}
|
|
4654
4654
|
});
|
|
4655
4655
|
}, i = function(a, o, u) {
|
|
4656
|
-
var
|
|
4656
|
+
var d = o.format instanceof Function ? o.format(o.push ? u : u[o.name]) : o.format, c = [a + "=" + d];
|
|
4657
4657
|
if (o.names)
|
|
4658
4658
|
for (var h = 0; h < o.names.length; h += 1) {
|
|
4659
4659
|
var p = o.names[h];
|
|
4660
|
-
o.name ?
|
|
4660
|
+
o.name ? c.push(u[o.name][p]) : c.push(u[o.names[h]]);
|
|
4661
4661
|
}
|
|
4662
4662
|
else
|
|
4663
|
-
|
|
4664
|
-
return t.apply(null,
|
|
4663
|
+
c.push(u[o.name]);
|
|
4664
|
+
return t.apply(null, c);
|
|
4665
4665
|
}, s = [
|
|
4666
4666
|
"v",
|
|
4667
4667
|
"o",
|
|
@@ -4677,45 +4677,45 @@ function Du() {
|
|
|
4677
4677
|
"z",
|
|
4678
4678
|
"a"
|
|
4679
4679
|
], n = ["i", "c", "b", "a"];
|
|
4680
|
-
return
|
|
4680
|
+
return mt = function(a, o) {
|
|
4681
4681
|
o = o || {}, a.version == null && (a.version = 0), a.name == null && (a.name = " "), a.media.forEach(function(h) {
|
|
4682
4682
|
h.payloads == null && (h.payloads = "");
|
|
4683
4683
|
});
|
|
4684
|
-
var u = o.outerOrder || s,
|
|
4684
|
+
var u = o.outerOrder || s, d = o.innerOrder || n, c = [];
|
|
4685
4685
|
return u.forEach(function(h) {
|
|
4686
4686
|
r[h].forEach(function(p) {
|
|
4687
|
-
p.name in a && a[p.name] != null ?
|
|
4688
|
-
|
|
4687
|
+
p.name in a && a[p.name] != null ? c.push(i(h, p, a)) : p.push in a && a[p.push] != null && a[p.push].forEach(function(l) {
|
|
4688
|
+
c.push(i(h, p, l));
|
|
4689
4689
|
});
|
|
4690
4690
|
});
|
|
4691
4691
|
}), a.media.forEach(function(h) {
|
|
4692
|
-
|
|
4692
|
+
c.push(i("m", r.m[0], h)), d.forEach(function(p) {
|
|
4693
4693
|
r[p].forEach(function(l) {
|
|
4694
|
-
l.name in h && h[l.name] != null ?
|
|
4695
|
-
|
|
4694
|
+
l.name in h && h[l.name] != null ? c.push(i(p, l, h)) : l.push in h && h[l.push] != null && h[l.push].forEach(function(f) {
|
|
4695
|
+
c.push(i(p, l, f));
|
|
4696
4696
|
});
|
|
4697
4697
|
});
|
|
4698
4698
|
});
|
|
4699
|
-
}),
|
|
4699
|
+
}), c.join(`\r
|
|
4700
4700
|
`) + `\r
|
|
4701
4701
|
`;
|
|
4702
|
-
},
|
|
4702
|
+
}, mt;
|
|
4703
4703
|
}
|
|
4704
4704
|
var ui;
|
|
4705
|
-
function
|
|
4705
|
+
function Fu() {
|
|
4706
4706
|
if (ui) return $;
|
|
4707
4707
|
ui = 1;
|
|
4708
|
-
var r =
|
|
4708
|
+
var r = Du(), e = Lu(), t = Yt();
|
|
4709
4709
|
return $.grammar = t, $.write = e, $.parse = r.parse, $.parseParams = r.parseParams, $.parseFmtpConfig = r.parseFmtpConfig, $.parsePayloads = r.parsePayloads, $.parseRemoteCandidates = r.parseRemoteCandidates, $.parseImageAttributes = r.parseImageAttributes, $.parseSimulcastStreamList = r.parseSimulcastStreamList, $;
|
|
4710
4710
|
}
|
|
4711
|
-
var
|
|
4712
|
-
const De = /* @__PURE__ */ Ge(
|
|
4713
|
-
function
|
|
4711
|
+
var Nu = Fu();
|
|
4712
|
+
const De = /* @__PURE__ */ Ge(Nu);
|
|
4713
|
+
function ms(r) {
|
|
4714
4714
|
return new Promise((e) => {
|
|
4715
4715
|
setTimeout(e, r);
|
|
4716
4716
|
});
|
|
4717
4717
|
}
|
|
4718
|
-
async function
|
|
4718
|
+
async function Vu(r, e = {}, t = 0) {
|
|
4719
4719
|
const i = new AbortController();
|
|
4720
4720
|
let s = !1;
|
|
4721
4721
|
e = Object.assign({}, e, { signal: i.signal });
|
|
@@ -4742,15 +4742,15 @@ async function Nu(r, e = {}, t = 0) {
|
|
|
4742
4742
|
throw s = !0, a;
|
|
4743
4743
|
}
|
|
4744
4744
|
}
|
|
4745
|
-
async function
|
|
4745
|
+
async function fs(r, e = {}, t = {}) {
|
|
4746
4746
|
const { timeout: i = 0, retryDelay: s = 0 } = t;
|
|
4747
4747
|
let { retryCount: n = 0 } = t;
|
|
4748
4748
|
try {
|
|
4749
|
-
return await
|
|
4749
|
+
return await Vu(r, e, i);
|
|
4750
4750
|
} catch (a) {
|
|
4751
4751
|
if (n--, t.retryCount = n, n < 0)
|
|
4752
4752
|
throw a;
|
|
4753
|
-
return await
|
|
4753
|
+
return await ms(s), await fs(r, e, t);
|
|
4754
4754
|
}
|
|
4755
4755
|
}
|
|
4756
4756
|
function A(r, e) {
|
|
@@ -4759,7 +4759,7 @@ function A(r, e) {
|
|
|
4759
4759
|
i.type === r && (t = i);
|
|
4760
4760
|
}), t;
|
|
4761
4761
|
}
|
|
4762
|
-
async function
|
|
4762
|
+
async function At(r, e) {
|
|
4763
4763
|
const t = {}, i = await (r == null ? void 0 : r.getStats()), s = await (e == null ? void 0 : e.getStats());
|
|
4764
4764
|
return i && (t.audio = {
|
|
4765
4765
|
mediaSource: A("media-source", i),
|
|
@@ -4783,29 +4783,29 @@ async function Rt(r, e) {
|
|
|
4783
4783
|
transport: A("transport", s)
|
|
4784
4784
|
}), t;
|
|
4785
4785
|
}
|
|
4786
|
-
async function
|
|
4787
|
-
var
|
|
4788
|
-
const i = await
|
|
4789
|
-
await
|
|
4790
|
-
const s = await
|
|
4786
|
+
async function Uu(r, e, t) {
|
|
4787
|
+
var c, h, p, l, f, g, _, T, b, v, U, R, Qt, er, tr, rr, ir, sr, nr, or, ar, cr, dr, ur, hr, pr, lr, mr, fr, _r, gr, vr, Cr, yr, Sr, Tr;
|
|
4788
|
+
const i = await At(e, t);
|
|
4789
|
+
await ms(r);
|
|
4790
|
+
const s = await At(e, t), { audio: n, video: a } = i, { audio: o, video: u } = s, d = {};
|
|
4791
4791
|
if (n != null && n.codec && (o != null && o.codec)) {
|
|
4792
|
-
const
|
|
4793
|
-
|
|
4792
|
+
const tt = ((c = o.outboundRtp) == null ? void 0 : c.timestamp) - ((h = n.outboundRtp) == null ? void 0 : h.timestamp), rt = ((p = o.outboundRtp) == null ? void 0 : p.bytesSent) - ((l = n.outboundRtp) == null ? void 0 : l.bytesSent), it = ((f = o.remoteInboundRtp) == null ? void 0 : f.packetsLost) - ((g = n.remoteInboundRtp) == null ? void 0 : g.packetsLost), st = ((_ = o.outboundRtp) == null ? void 0 : _.packetsSent) - ((T = n.outboundRtp) == null ? void 0 : T.packetsSent);
|
|
4793
|
+
d.audio = {
|
|
4794
4794
|
codec: o.codec.mimeType,
|
|
4795
4795
|
channels: o.codec.channels,
|
|
4796
|
-
sendBitrate:
|
|
4796
|
+
sendBitrate: rt / tt * 8e3,
|
|
4797
4797
|
// bps
|
|
4798
4798
|
packetsSent: (b = o.outboundRtp) == null ? void 0 : b.packetsSent,
|
|
4799
4799
|
nackCount: (v = o.outboundRtp) == null ? void 0 : v.nackCount,
|
|
4800
4800
|
packetsLost: (U = o.remoteInboundRtp) == null ? void 0 : U.packetsLost,
|
|
4801
|
-
packetsLostPercent:
|
|
4801
|
+
packetsLostPercent: it / st
|
|
4802
4802
|
};
|
|
4803
4803
|
}
|
|
4804
4804
|
if (a != null && a.codec && (u != null && u.codec)) {
|
|
4805
|
-
const
|
|
4806
|
-
|
|
4805
|
+
const tt = ((R = u.outboundRtp) == null ? void 0 : R.timestamp) - ((Qt = a.outboundRtp) == null ? void 0 : Qt.timestamp), rt = ((er = u.outboundRtp) == null ? void 0 : er.bytesSent) - ((tr = a.outboundRtp) == null ? void 0 : tr.bytesSent), it = ((rr = u.outboundRtp) == null ? void 0 : rr.framesEncoded) - ((ir = a.outboundRtp) == null ? void 0 : ir.framesEncoded), st = ((sr = u.outboundRtp) == null ? void 0 : sr.totalEncodeTime) - ((nr = a.outboundRtp) == null ? void 0 : nr.totalEncodeTime), Er = ((or = u.outboundRtp) == null ? void 0 : or.packetsSent) - ((ar = a.outboundRtp) == null ? void 0 : ar.packetsSent), Ys = ((cr = u.outboundRtp) == null ? void 0 : cr.totalPacketSendDelay) - ((dr = a.outboundRtp) == null ? void 0 : dr.totalPacketSendDelay), Zs = ((ur = u.remoteInboundRtp) == null ? void 0 : ur.packetsLost) - ((hr = a.remoteInboundRtp) == null ? void 0 : hr.packetsLost);
|
|
4806
|
+
d.video = {
|
|
4807
4807
|
codec: u.codec.mimeType,
|
|
4808
|
-
sendBitrate:
|
|
4808
|
+
sendBitrate: rt / tt * 8e3,
|
|
4809
4809
|
// bps
|
|
4810
4810
|
frameWidth: (pr = u.outboundRtp) == null ? void 0 : pr.frameWidth,
|
|
4811
4811
|
frameHeight: (lr = u.outboundRtp) == null ? void 0 : lr.frameHeight,
|
|
@@ -4813,22 +4813,36 @@ async function Vu(r, e, t) {
|
|
|
4813
4813
|
framesEncoded: (fr = u.outboundRtp) == null ? void 0 : fr.framesEncoded,
|
|
4814
4814
|
keyFramesEncoded: (_r = u.outboundRtp) == null ? void 0 : _r.keyFramesEncoded,
|
|
4815
4815
|
framesSent: (gr = u.outboundRtp) == null ? void 0 : gr.frameHeight,
|
|
4816
|
-
frameEncodeAvgTime:
|
|
4816
|
+
frameEncodeAvgTime: st * 1e3 / it,
|
|
4817
4817
|
// ms
|
|
4818
4818
|
packetsSent: (vr = u.outboundRtp) == null ? void 0 : vr.packetsSent,
|
|
4819
|
-
packetSendDelay:
|
|
4819
|
+
packetSendDelay: Ys * 1e3 / Er,
|
|
4820
4820
|
// ms
|
|
4821
4821
|
nackCount: (Cr = u.outboundRtp) == null ? void 0 : Cr.nackCount,
|
|
4822
4822
|
firCount: (yr = u.outboundRtp) == null ? void 0 : yr.firCount,
|
|
4823
4823
|
pliCount: (Sr = u.outboundRtp) == null ? void 0 : Sr.pliCount,
|
|
4824
4824
|
packetsLost: (Tr = u.remoteInboundRtp) == null ? void 0 : Tr.packetsLost,
|
|
4825
|
-
packetsLostPercent:
|
|
4825
|
+
packetsLostPercent: Zs / Er
|
|
4826
4826
|
};
|
|
4827
4827
|
}
|
|
4828
|
-
return
|
|
4828
|
+
return d;
|
|
4829
4829
|
}
|
|
4830
|
-
const
|
|
4831
|
-
|
|
4830
|
+
const $u = (r) => {
|
|
4831
|
+
var t;
|
|
4832
|
+
if (!Fi) return;
|
|
4833
|
+
const e = (t = r.rtp.filter((i) => i.codec === "opus")[0]) == null ? void 0 : t.payload;
|
|
4834
|
+
e && r.fmtp.forEach((i) => {
|
|
4835
|
+
i.payload === e && (i.config = "minptime=10;useinbandfec=1");
|
|
4836
|
+
});
|
|
4837
|
+
}, Bu = (r) => {
|
|
4838
|
+
r.ext && (mn || He) && (r.ext = r.ext.filter(
|
|
4839
|
+
(e) => {
|
|
4840
|
+
var t;
|
|
4841
|
+
return !((t = e.uri) != null && t.includes("video-orientation"));
|
|
4842
|
+
}
|
|
4843
|
+
));
|
|
4844
|
+
}, M = new ce("PCConnect");
|
|
4845
|
+
class ju {
|
|
4832
4846
|
constructor(e, t, i) {
|
|
4833
4847
|
this._pc = null, this._ms = new MediaStream(), this._signalUrl = "", this._videoTransceiver = null, this._audioTransceiver = null, this._opts = void 0, this._sessionId = Date.now(), this._signalUrl = e, this._opts = t, this._onConnectStateChange = i;
|
|
4834
4848
|
}
|
|
@@ -4843,32 +4857,25 @@ class Uu {
|
|
|
4843
4857
|
return this._sessionId;
|
|
4844
4858
|
}
|
|
4845
4859
|
async publish(e, t) {
|
|
4846
|
-
const i = new RTCPeerConnection()
|
|
4860
|
+
const i = new RTCPeerConnection();
|
|
4847
4861
|
this._pc = i, this._bindRTCEvent();
|
|
4848
|
-
const
|
|
4849
|
-
|
|
4862
|
+
const s = e.filter((c) => (c == null ? void 0 : c.kind) === "audio")[0], n = e.filter((c) => (c == null ? void 0 : c.kind) === "video")[0];
|
|
4863
|
+
s && this._ms.addTrack(s), n && this._ms.addTrack(n), this._audioTransceiver = i.addTransceiver(s || "audio", {
|
|
4850
4864
|
direction: "sendonly",
|
|
4851
4865
|
sendEncodings: [{ maxBitrate: t[0] }],
|
|
4852
4866
|
streams: [this._ms]
|
|
4853
|
-
}), M.log("add track to pc,",
|
|
4867
|
+
}), M.log("add track to pc,", s), this._videoTransceiver = i.addTransceiver(n || "video", {
|
|
4854
4868
|
direction: "sendonly",
|
|
4855
4869
|
sendEncodings: [{ maxBitrate: t[1] }],
|
|
4856
4870
|
streams: [this._ms]
|
|
4857
|
-
}), M.log("add track to pc,",
|
|
4858
|
-
const
|
|
4859
|
-
M.groupCollapsed("local offer"), M.log(
|
|
4860
|
-
const
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
(f) => f.codec === "opus"
|
|
4866
|
-
)[0]) == null ? void 0 : l.payload;
|
|
4867
|
-
p && h.fmtp.forEach((f) => {
|
|
4868
|
-
f.payload === p && (f.config = "minptime=10;useinbandfec=1");
|
|
4869
|
-
});
|
|
4870
|
-
}), o.sdp = De.write(u), M.log("local offer modified"), M.log(o.sdp), await i.setLocalDescription(o);
|
|
4871
|
-
const c = await ms(
|
|
4871
|
+
}), M.log("add track to pc,", n);
|
|
4872
|
+
const a = await i.createOffer();
|
|
4873
|
+
M.groupCollapsed("local offer"), M.log(a.sdp);
|
|
4874
|
+
const o = De.parse(a.sdp);
|
|
4875
|
+
o.media.forEach((c) => {
|
|
4876
|
+
c.type === "audio" ? $u(c) : c.type === "video" && Bu(c);
|
|
4877
|
+
}), a.sdp = De.write(o), M.log("local offer modified"), M.log(a.sdp), await i.setLocalDescription(a);
|
|
4878
|
+
const u = await fs(
|
|
4872
4879
|
this._signalUrl,
|
|
4873
4880
|
{
|
|
4874
4881
|
method: "POST",
|
|
@@ -4876,7 +4883,7 @@ class Uu {
|
|
|
4876
4883
|
body: JSON.stringify({
|
|
4877
4884
|
sessionId: "" + this._sessionId,
|
|
4878
4885
|
version: "1.0-html",
|
|
4879
|
-
localSdp:
|
|
4886
|
+
localSdp: a,
|
|
4880
4887
|
metadata: {
|
|
4881
4888
|
platform: "Web"
|
|
4882
4889
|
}
|
|
@@ -4884,17 +4891,17 @@ class Uu {
|
|
|
4884
4891
|
},
|
|
4885
4892
|
this._opts
|
|
4886
4893
|
);
|
|
4887
|
-
if ((
|
|
4894
|
+
if ((u == null ? void 0 : u.code) !== 200)
|
|
4888
4895
|
throw {
|
|
4889
|
-
code:
|
|
4890
|
-
message:
|
|
4896
|
+
code: u.code,
|
|
4897
|
+
message: u.message
|
|
4891
4898
|
};
|
|
4892
|
-
M.log("remote answer:"), M.log(
|
|
4893
|
-
const d = De.parse(
|
|
4894
|
-
d.media.forEach((
|
|
4895
|
-
var
|
|
4896
|
-
(
|
|
4897
|
-
}),
|
|
4899
|
+
M.log("remote answer:"), M.log(u.remoteSdp.sdp);
|
|
4900
|
+
const d = De.parse(u.remoteSdp.sdp);
|
|
4901
|
+
d.media.forEach((c) => {
|
|
4902
|
+
var h;
|
|
4903
|
+
(h = c.fingerprint) != null && h.hash && (c.fingerprint.hash = c.fingerprint.hash.toUpperCase());
|
|
4904
|
+
}), u.remoteSdp.sdp = De.write(d), M.log("remote answer modified"), M.log(u.remoteSdp.sdp), M.groupEnd(), await i.setRemoteDescription(u.remoteSdp);
|
|
4898
4905
|
}
|
|
4899
4906
|
async updatePublish(e, t) {
|
|
4900
4907
|
var n, a;
|
|
@@ -4921,14 +4928,14 @@ class Uu {
|
|
|
4921
4928
|
}
|
|
4922
4929
|
getStats() {
|
|
4923
4930
|
var e, t;
|
|
4924
|
-
return
|
|
4931
|
+
return At(
|
|
4925
4932
|
(e = this._audioTransceiver) == null ? void 0 : e.sender,
|
|
4926
4933
|
(t = this._videoTransceiver) == null ? void 0 : t.sender
|
|
4927
4934
|
);
|
|
4928
4935
|
}
|
|
4929
4936
|
getStatsSnapshoot(e) {
|
|
4930
4937
|
var t, i;
|
|
4931
|
-
return
|
|
4938
|
+
return Uu(
|
|
4932
4939
|
e || 100,
|
|
4933
4940
|
(t = this._audioTransceiver) == null ? void 0 : t.sender,
|
|
4934
4941
|
(i = this._videoTransceiver) == null ? void 0 : i.sender
|
|
@@ -4941,62 +4948,62 @@ class Uu {
|
|
|
4941
4948
|
});
|
|
4942
4949
|
}
|
|
4943
4950
|
}
|
|
4944
|
-
var se = /* @__PURE__ */ ((r) => (r.OnError = "onerror", r.OnConnectClosed = "onconnectclosed", r.OnFirstFramePushed = "onfirstframepushed", r))(se || {}), Z = /* @__PURE__ */ ((r) => (r.Video = "video", r.Audio = "audio", r))(Z || {}), N = /* @__PURE__ */ ((r) => (r.Init = "init", r.AvExist = "avexist", r.VideoFrame = "videoframe", r.MockVideoEncode = "mockvideoencode", r.AudioFrame = "audioframe", r.AdjustBitrate = "adjustbitrate", r.Publish = "publish", r.UnPublish = "unpublish", r.Download = "download", r.GetStats = "getstats", r.EncodeConfig = "encodeconfig", r))(N || {}), re = /* @__PURE__ */ ((r) => (r.Ready = "ready", r.Error = "error", r.FirstFramePushed = "firstframepushed", r.Flvfile = "flvfile", r.STATS = "stats", r.Close = "close", r))(re || {}),
|
|
4945
|
-
function
|
|
4951
|
+
var se = /* @__PURE__ */ ((r) => (r.OnError = "onerror", r.OnConnectClosed = "onconnectclosed", r.OnFirstFramePushed = "onfirstframepushed", r))(se || {}), Z = /* @__PURE__ */ ((r) => (r.Video = "video", r.Audio = "audio", r))(Z || {}), N = /* @__PURE__ */ ((r) => (r.Init = "init", r.AvExist = "avexist", r.VideoFrame = "videoframe", r.MockVideoEncode = "mockvideoencode", r.AudioFrame = "audioframe", r.AdjustBitrate = "adjustbitrate", r.Publish = "publish", r.UnPublish = "unpublish", r.Download = "download", r.GetStats = "getstats", r.EncodeConfig = "encodeconfig", r))(N || {}), re = /* @__PURE__ */ ((r) => (r.Ready = "ready", r.Error = "error", r.FirstFramePushed = "firstframepushed", r.Flvfile = "flvfile", r.STATS = "stats", r.Close = "close", r))(re || {}), ft = { exports: {} }, hi;
|
|
4952
|
+
function zu() {
|
|
4946
4953
|
return hi || (hi = 1, function(r) {
|
|
4947
4954
|
var e = Object.prototype.hasOwnProperty, t = "~";
|
|
4948
4955
|
function i() {
|
|
4949
4956
|
}
|
|
4950
4957
|
Object.create && (i.prototype = /* @__PURE__ */ Object.create(null), new i().__proto__ || (t = !1));
|
|
4951
|
-
function s(u,
|
|
4952
|
-
this.fn = u, this.context =
|
|
4958
|
+
function s(u, d, c) {
|
|
4959
|
+
this.fn = u, this.context = d, this.once = c || !1;
|
|
4953
4960
|
}
|
|
4954
|
-
function n(u,
|
|
4955
|
-
if (typeof
|
|
4961
|
+
function n(u, d, c, h, p) {
|
|
4962
|
+
if (typeof c != "function")
|
|
4956
4963
|
throw new TypeError("The listener must be a function");
|
|
4957
|
-
var l = new s(
|
|
4964
|
+
var l = new s(c, h || u, p), f = t ? t + d : d;
|
|
4958
4965
|
return u._events[f] ? u._events[f].fn ? u._events[f] = [u._events[f], l] : u._events[f].push(l) : (u._events[f] = l, u._eventsCount++), u;
|
|
4959
4966
|
}
|
|
4960
|
-
function a(u,
|
|
4961
|
-
--u._eventsCount === 0 ? u._events = new i() : delete u._events[
|
|
4967
|
+
function a(u, d) {
|
|
4968
|
+
--u._eventsCount === 0 ? u._events = new i() : delete u._events[d];
|
|
4962
4969
|
}
|
|
4963
4970
|
function o() {
|
|
4964
4971
|
this._events = new i(), this._eventsCount = 0;
|
|
4965
4972
|
}
|
|
4966
4973
|
o.prototype.eventNames = function() {
|
|
4967
|
-
var
|
|
4968
|
-
if (this._eventsCount === 0) return
|
|
4969
|
-
for (h in
|
|
4970
|
-
e.call(
|
|
4971
|
-
return Object.getOwnPropertySymbols ?
|
|
4972
|
-
}, o.prototype.listeners = function(
|
|
4973
|
-
var
|
|
4974
|
+
var d = [], c, h;
|
|
4975
|
+
if (this._eventsCount === 0) return d;
|
|
4976
|
+
for (h in c = this._events)
|
|
4977
|
+
e.call(c, h) && d.push(t ? h.slice(1) : h);
|
|
4978
|
+
return Object.getOwnPropertySymbols ? d.concat(Object.getOwnPropertySymbols(c)) : d;
|
|
4979
|
+
}, o.prototype.listeners = function(d) {
|
|
4980
|
+
var c = t ? t + d : d, h = this._events[c];
|
|
4974
4981
|
if (!h) return [];
|
|
4975
4982
|
if (h.fn) return [h.fn];
|
|
4976
4983
|
for (var p = 0, l = h.length, f = new Array(l); p < l; p++)
|
|
4977
4984
|
f[p] = h[p].fn;
|
|
4978
4985
|
return f;
|
|
4979
|
-
}, o.prototype.listenerCount = function(
|
|
4980
|
-
var
|
|
4986
|
+
}, o.prototype.listenerCount = function(d) {
|
|
4987
|
+
var c = t ? t + d : d, h = this._events[c];
|
|
4981
4988
|
return h ? h.fn ? 1 : h.length : 0;
|
|
4982
|
-
}, o.prototype.emit = function(
|
|
4983
|
-
var g = t ? t +
|
|
4989
|
+
}, o.prototype.emit = function(d, c, h, p, l, f) {
|
|
4990
|
+
var g = t ? t + d : d;
|
|
4984
4991
|
if (!this._events[g]) return !1;
|
|
4985
4992
|
var _ = this._events[g], T = arguments.length, b, v;
|
|
4986
4993
|
if (_.fn) {
|
|
4987
|
-
switch (_.once && this.removeListener(
|
|
4994
|
+
switch (_.once && this.removeListener(d, _.fn, void 0, !0), T) {
|
|
4988
4995
|
case 1:
|
|
4989
4996
|
return _.fn.call(_.context), !0;
|
|
4990
4997
|
case 2:
|
|
4991
|
-
return _.fn.call(_.context,
|
|
4998
|
+
return _.fn.call(_.context, c), !0;
|
|
4992
4999
|
case 3:
|
|
4993
|
-
return _.fn.call(_.context,
|
|
5000
|
+
return _.fn.call(_.context, c, h), !0;
|
|
4994
5001
|
case 4:
|
|
4995
|
-
return _.fn.call(_.context,
|
|
5002
|
+
return _.fn.call(_.context, c, h, p), !0;
|
|
4996
5003
|
case 5:
|
|
4997
|
-
return _.fn.call(_.context,
|
|
5004
|
+
return _.fn.call(_.context, c, h, p, l), !0;
|
|
4998
5005
|
case 6:
|
|
4999
|
-
return _.fn.call(_.context,
|
|
5006
|
+
return _.fn.call(_.context, c, h, p, l, f), !0;
|
|
5000
5007
|
}
|
|
5001
5008
|
for (v = 1, b = new Array(T - 1); v < T; v++)
|
|
5002
5009
|
b[v - 1] = arguments[v];
|
|
@@ -5004,18 +5011,18 @@ function $u() {
|
|
|
5004
5011
|
} else {
|
|
5005
5012
|
var U = _.length, R;
|
|
5006
5013
|
for (v = 0; v < U; v++)
|
|
5007
|
-
switch (_[v].once && this.removeListener(
|
|
5014
|
+
switch (_[v].once && this.removeListener(d, _[v].fn, void 0, !0), T) {
|
|
5008
5015
|
case 1:
|
|
5009
5016
|
_[v].fn.call(_[v].context);
|
|
5010
5017
|
break;
|
|
5011
5018
|
case 2:
|
|
5012
|
-
_[v].fn.call(_[v].context,
|
|
5019
|
+
_[v].fn.call(_[v].context, c);
|
|
5013
5020
|
break;
|
|
5014
5021
|
case 3:
|
|
5015
|
-
_[v].fn.call(_[v].context,
|
|
5022
|
+
_[v].fn.call(_[v].context, c, h);
|
|
5016
5023
|
break;
|
|
5017
5024
|
case 4:
|
|
5018
|
-
_[v].fn.call(_[v].context,
|
|
5025
|
+
_[v].fn.call(_[v].context, c, h, p);
|
|
5019
5026
|
break;
|
|
5020
5027
|
default:
|
|
5021
5028
|
if (!b) for (R = 1, b = new Array(T - 1); R < T; R++)
|
|
@@ -5024,34 +5031,34 @@ function $u() {
|
|
|
5024
5031
|
}
|
|
5025
5032
|
}
|
|
5026
5033
|
return !0;
|
|
5027
|
-
}, o.prototype.on = function(
|
|
5028
|
-
return n(this,
|
|
5029
|
-
}, o.prototype.once = function(
|
|
5030
|
-
return n(this,
|
|
5031
|
-
}, o.prototype.removeListener = function(
|
|
5032
|
-
var l = t ? t +
|
|
5034
|
+
}, o.prototype.on = function(d, c, h) {
|
|
5035
|
+
return n(this, d, c, h, !1);
|
|
5036
|
+
}, o.prototype.once = function(d, c, h) {
|
|
5037
|
+
return n(this, d, c, h, !0);
|
|
5038
|
+
}, o.prototype.removeListener = function(d, c, h, p) {
|
|
5039
|
+
var l = t ? t + d : d;
|
|
5033
5040
|
if (!this._events[l]) return this;
|
|
5034
|
-
if (!
|
|
5041
|
+
if (!c)
|
|
5035
5042
|
return a(this, l), this;
|
|
5036
5043
|
var f = this._events[l];
|
|
5037
5044
|
if (f.fn)
|
|
5038
|
-
f.fn ===
|
|
5045
|
+
f.fn === c && (!p || f.once) && (!h || f.context === h) && a(this, l);
|
|
5039
5046
|
else {
|
|
5040
5047
|
for (var g = 0, _ = [], T = f.length; g < T; g++)
|
|
5041
|
-
(f[g].fn !==
|
|
5048
|
+
(f[g].fn !== c || p && !f[g].once || h && f[g].context !== h) && _.push(f[g]);
|
|
5042
5049
|
_.length ? this._events[l] = _.length === 1 ? _[0] : _ : a(this, l);
|
|
5043
5050
|
}
|
|
5044
5051
|
return this;
|
|
5045
|
-
}, o.prototype.removeAllListeners = function(
|
|
5046
|
-
var
|
|
5047
|
-
return
|
|
5052
|
+
}, o.prototype.removeAllListeners = function(d) {
|
|
5053
|
+
var c;
|
|
5054
|
+
return d ? (c = t ? t + d : d, this._events[c] && a(this, c)) : (this._events = new i(), this._eventsCount = 0), this;
|
|
5048
5055
|
}, o.prototype.off = o.prototype.removeListener, o.prototype.addListener = o.prototype.on, o.prefixed = t, o.EventEmitter = o, r.exports = o;
|
|
5049
|
-
}(
|
|
5056
|
+
}(ft)), ft.exports;
|
|
5050
5057
|
}
|
|
5051
|
-
var
|
|
5052
|
-
const
|
|
5053
|
-
var
|
|
5054
|
-
class
|
|
5058
|
+
var Gu = zu();
|
|
5059
|
+
const Hu = /* @__PURE__ */ Ge(Gu);
|
|
5060
|
+
var wt = /* @__PURE__ */ ((r) => (r[r.RTMP_INIT_FAIL = 3e3] = "RTMP_INIT_FAIL", r[r.AUDIO_ENCODER_INIT_FAIL = 3001] = "AUDIO_ENCODER_INIT_FAIL", r[r.AUDIO_RRNOISE_INIT_FAIL = 3002] = "AUDIO_RRNOISE_INIT_FAIL", r[r.AUDIO_ENCODE_FAIL = 3003] = "AUDIO_ENCODE_FAIL", r[r.VIDEO_ENCODE_CONFIGURE_FAIL = 3004] = "VIDEO_ENCODE_CONFIGURE_FAIL", r[r.VIDEO_ENCODE_FAIL = 3005] = "VIDEO_ENCODE_FAIL", r[r.WTP_OPEN_FAIL = 3006] = "WTP_OPEN_FAIL", r[r.WTP_CONNECT_FAIL = 3007] = "WTP_CONNECT_FAIL", r[r.WORKER_ERROR = 3008] = "WORKER_ERROR", r))(wt || {});
|
|
5061
|
+
class qu extends Error {
|
|
5055
5062
|
constructor(e, t, i) {
|
|
5056
5063
|
super(), this.code = e, this.message = t, i && (this.ext = i), this.toJson = () => ({
|
|
5057
5064
|
code: this.code,
|
|
@@ -5061,7 +5068,7 @@ class zu extends Error {
|
|
|
5061
5068
|
}
|
|
5062
5069
|
}
|
|
5063
5070
|
function pi(r, e, t) {
|
|
5064
|
-
return new
|
|
5071
|
+
return new qu(r, e, t);
|
|
5065
5072
|
}
|
|
5066
5073
|
const pe = class pe {
|
|
5067
5074
|
constructor(e) {
|
|
@@ -5094,7 +5101,7 @@ const pe = class pe {
|
|
|
5094
5101
|
pe.enable = !1, pe.enableLong = !1;
|
|
5095
5102
|
let ee = pe;
|
|
5096
5103
|
const F = new ee("RTMP_Capture");
|
|
5097
|
-
class
|
|
5104
|
+
class Wu {
|
|
5098
5105
|
constructor(e) {
|
|
5099
5106
|
this._videoFirstframeCaptured = !1, this._audioFirstframeCaptured = !1, this._videoProcessorReader = null, this._audioProcessorReader = null, this._bridge = e;
|
|
5100
5107
|
}
|
|
@@ -5193,8 +5200,8 @@ class Gu {
|
|
|
5193
5200
|
});
|
|
5194
5201
|
}
|
|
5195
5202
|
}
|
|
5196
|
-
const fs = '(function(){"use strict";var l=(i=>(i.OnVideoCaptured="onvideocaptured",i.OnAudioCaptured="onaudiocaptured",i.OnVideoCaptureNoOutput="onvideocapturenooutput",i.OnVideoEncoded="onvideoencoded",i.OnAudioEncoded="onaudioencoded",i.OnEncodedFrame="onencodedframe",i.OnPacketed="onpacketed",i.OnUpstreamFeedback="onupstreamfeedback",i.OnBitrateChanged="onbitratechanged",i))(l||{}),O=(i=>(i.OnError="onerror",i.OnConnectClosed="onconnectclosed",i.OnFirstFramePushed="onfirstframepushed",i))(O||{}),S=(i=>(i.Video="video",i.Audio="audio",i))(S||{}),v=(i=>(i.Init="init",i.AvExist="avexist",i.VideoFrame="videoframe",i.MockVideoEncode="mockvideoencode",i.AudioFrame="audioframe",i.AdjustBitrate="adjustbitrate",i.Publish="publish",i.UnPublish="unpublish",i.Download="download",i.GetStats="getstats",i.EncodeConfig="encodeconfig",i))(v||{}),y=(i=>(i.Ready="ready",i.Error="error",i.FirstFramePushed="firstframepushed",i.Flvfile="flvfile",i.STATS="stats",i.Close="close",i))(y||{});function $(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var k={exports:{}},T;function q(){return T||(T=1,function(i){var t=Object.prototype.hasOwnProperty,e="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(e=!1));function n(u,a,r){this.fn=u,this.context=a,this.once=r||!1}function o(u,a,r,h,m){if(typeof r!="function")throw new TypeError("The listener must be a function");var g=new n(r,h||u,m),f=e?e+a:a;return u._events[f]?u._events[f].fn?u._events[f]=[u._events[f],g]:u._events[f].push(g):(u._events[f]=g,u._eventsCount++),u}function _(u,a){--u._eventsCount===0?u._events=new s:delete u._events[a]}function c(){this._events=new s,this._eventsCount=0}c.prototype.eventNames=function(){var a=[],r,h;if(this._eventsCount===0)return a;for(h in r=this._events)t.call(r,h)&&a.push(e?h.slice(1):h);return Object.getOwnPropertySymbols?a.concat(Object.getOwnPropertySymbols(r)):a},c.prototype.listeners=function(a){var r=e?e+a:a,h=this._events[r];if(!h)return[];if(h.fn)return[h.fn];for(var m=0,g=h.length,f=new Array(g);m<g;m++)f[m]=h[m].fn;return f},c.prototype.listenerCount=function(a){var r=e?e+a:a,h=this._events[r];return h?h.fn?1:h.length:0},c.prototype.emit=function(a,r,h,m,g,f){var w=e?e+a:a;if(!this._events[w])return!1;var d=this._events[w],F=arguments.length,V,p;if(d.fn){switch(d.once&&this.removeListener(a,d.fn,void 0,!0),F){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,r),!0;case 3:return d.fn.call(d.context,r,h),!0;case 4:return d.fn.call(d.context,r,h,m),!0;case 5:return d.fn.call(d.context,r,h,m,g),!0;case 6:return d.fn.call(d.context,r,h,m,g,f),!0}for(p=1,V=new Array(F-1);p<F;p++)V[p-1]=arguments[p];d.fn.apply(d.context,V)}else{var fe=d.length,R;for(p=0;p<fe;p++)switch(d[p].once&&this.removeListener(a,d[p].fn,void 0,!0),F){case 1:d[p].fn.call(d[p].context);break;case 2:d[p].fn.call(d[p].context,r);break;case 3:d[p].fn.call(d[p].context,r,h);break;case 4:d[p].fn.call(d[p].context,r,h,m);break;default:if(!V)for(R=1,V=new Array(F-1);R<F;R++)V[R-1]=arguments[R];d[p].fn.apply(d[p].context,V)}}return!0},c.prototype.on=function(a,r,h){return o(this,a,r,h,!1)},c.prototype.once=function(a,r,h){return o(this,a,r,h,!0)},c.prototype.removeListener=function(a,r,h,m){var g=e?e+a:a;if(!this._events[g])return this;if(!r)return _(this,g),this;var f=this._events[g];if(f.fn)f.fn===r&&(!m||f.once)&&(!h||f.context===h)&&_(this,g);else{for(var w=0,d=[],F=f.length;w<F;w++)(f[w].fn!==r||m&&!f[w].once||h&&f[w].context!==h)&&d.push(f[w]);d.length?this._events[g]=d.length===1?d[0]:d:_(this,g)}return this},c.prototype.removeAllListeners=function(a){var r;return a?(r=e?e+a:a,this._events[r]&&_(this,r)):(this._events=new s,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=e,c.EventEmitter=c,i.exports=c}(k)),k.exports}var z=q(),j=$(z);const N=class N{constructor(t){this.group=(...e)=>{this._enabled&&console.group(`[${this._prefix}]: `,...e)},this.groupCollapsed=(...e)=>{this._enabled&&console.groupCollapsed(`[${this._prefix}]: `,...e)},this.groupEnd=()=>{this._enabled&&console.groupEnd()},this.log=(...e)=>{this._enabled&&console.log(`[${this._prefix}]: `,...e)},this.warn=(...e)=>{this._enabled&&console.warn(`[${this._prefix}]: `,...e)},this.error=(...e)=>{this._enabled&&console.error(`[${this._prefix}]: `,...e)},this.table=(...e)=>{this._enabled&&console.table(...e)},this._prefix=t}get _enabled(){return N.enable}get _enableLong(){return N.enableLong}get long(){return this._enableLong}};N.enable=!1,N.enableLong=!1;let E=N;function D(i){i=i.filter(Boolean);const t=new Uint8Array(i.reduce((s,n)=>s+n.byteLength,0));let e=0;return i.forEach(s=>{t.set(s,e),e+=s.byteLength}),t}const A={codec:"avc1.4DE033",MaxCachedFrameSize:100,RealSpeedPercent:.8,UplinkBitrateCheckInterval:60*1e3,VideoBitrateDefault:1e6,AudioBitrateDefault:68e3,gopSize:90,sampleRate:48e3,channel:2,audioEncoderPath:"https://lf-unpkg.volccdn.com/obj/vcloudfe/sdk/Web_push/1.0.1/1735619140327/pcm2aac.js",audioEncoderWasmPath:"https://lf-unpkg.volccdn.com/obj/vcloudfe/sdk/Web_push/1.0.2/1735619208418/pcm2aac.wasm",rrnoiseAssetsPath:"https://sf1-cdn-tos.huoshanstatic.com/obj/media-fe/encoder/0.1.0",ignoreRelPublish:!1},U=new E("RTMP_AudioEncoder");class H{constructor(t){this._encodedFrameCount=0,this._ready=!1,this._lastFrame=null,this._aacOutput=(e,s)=>{const n=this._module.HEAPU8.subarray(e,e+s);if(!this._lastFrame)return;this._encodedFrameCount++;const{props:o}=this._lastFrame,_={buffer:new Uint8Array(n),props:{timestamp:parseInt(o.timestamp/1e3),originTs:parseInt(o.timestamp/1e3)}};this._core.emit(l.OnAudioEncoded,_)},this._core=t}async init(){const t=await fetch(A.audioEncoderPath).then(_=>_.text());new Function(`self.exports={};${t}`)();const e=self.exports.m;let s,n;const o=new Promise((_,c)=>{n=_,s=c});return e({instantiateWasm:function(_,c){fetch(A.audioEncoderWasmPath).then(u=>u.arrayBuffer()).then(u=>WebAssembly.instantiate(u,_)).then(function(u){return c(u.instance)}).then(()=>{n(),U.log("aac module inited")}).catch(u=>{s(u)})}}).then(_=>{const c=_.addFunction(this._aacOutput,"vii");_._init_callback(c),this._module=_}).catch(s),o}rnnoise(t){var s;const e=t.length;for(let n=0;n<e;n++)t[n]=t[n]*32768;(s=this._rnnoiseModule)==null||s.processFrame(t);for(let n=0;n<e;n++)t[n]=t[n]/32768}updateConfigure(){this._module._flush(),this._module._free_encoder(),this._ready=!1}encode(t){if(!this._ready){const o=this._start_encoder();if(o<0)throw new Error(`init aac encoder error, code:${o}`)}this._lastFrame=t;const e=t.buffer.buffer,s=this._module._malloc(e.byteLength);this._module.HEAPU8.subarray(s,s+e.byteLength).set(new Uint8Array(e));const n=this._module._encode_one_frame(s);if(n<0)throw new Error(`encode aac frame error, code:${n}`)}_start_encoder(){const t=this._core.getSetting(),e=this._module._init_encoder(t.sampleRate,t.channel,t.audioBitrate);if(e<0)return e;this._ready=!0,U.log(`init encoder: sampleRate=${t.sampleRate}, channel:${t.channel}, bitrate:${t.audioBitrate}`)}destroy(){var t;(t=this._module)==null||t._free_encoder()}}const P=1024;class M{constructor(){this._queue=[],this._sampleCount=0}compose(t){if(this._queue.push(t),this._sampleCount+=t.data.audioData.numberOfFrames,this._sampleCount>=P)return this._doCompose()}_doCompose(){const t=new Float32Array(P);let e=0,s=P;const n=this._queue[0];for(;;){const o=this._queue[0];if(!o)break;const _=Math.min(s,o.data.audioData.numberOfFrames-o.offset,480),c=o.data.buffer.slice(o.offset,o.offset+_);if(o.offset+=_,o.offset>=o.data.audioData.numberOfFrames&&this._queue.shift(),s-=_,this._sampleCount-=_,t.set(c,e),e+=_,s<=0)break}return{buffer:t,props:{timestamp:n.data.audioData.timestamp,sampleRate:n.data.audioData.sampleRate,numberOfChannels:n.data.audioData.numberOfChannels}}}}var C=(i=>(i[i.RTMP_INIT_FAIL=3e3]="RTMP_INIT_FAIL",i[i.AUDIO_ENCODER_INIT_FAIL=3001]="AUDIO_ENCODER_INIT_FAIL",i[i.AUDIO_RRNOISE_INIT_FAIL=3002]="AUDIO_RRNOISE_INIT_FAIL",i[i.AUDIO_ENCODE_FAIL=3003]="AUDIO_ENCODE_FAIL",i[i.VIDEO_ENCODE_CONFIGURE_FAIL=3004]="VIDEO_ENCODE_CONFIGURE_FAIL",i[i.VIDEO_ENCODE_FAIL=3005]="VIDEO_ENCODE_FAIL",i[i.WTP_OPEN_FAIL=3006]="WTP_OPEN_FAIL",i[i.WTP_CONNECT_FAIL=3007]="WTP_CONNECT_FAIL",i[i.WORKER_ERROR=3008]="WORKER_ERROR",i))(C||{});class W extends Error{constructor(t,e,s){super(),this.code=t,this.message=e,s&&(this.ext=s),this.toJson=()=>({code:this.code,message:this.message,ext:this.ext})}}function x(i,t,e){return new W(i,t,e)}class G{constructor(t){this._audioFrameQueue=new M,this.encode=e=>{const s=new Float32Array(e.numberOfFrames);e.copyTo(s,{planeIndex:0,frameOffset:0,frameCount:e.numberOfFrames});const n=this._audioFrameQueue.compose({offset:0,data:{audioData:e,buffer:s}});if(n)try{this._encoder.encode(n)}catch(o){this._core.emit(O.OnError,x(C.AUDIO_ENCODE_FAIL,o.message))}},this._core=t,this._encoder=new H(t)}async init(){try{await this._encoder.init()}catch(t){throw x(C.AUDIO_ENCODER_INIT_FAIL,t.message)}}setConfiguration(t){const e=Object.assign({},this._core.getSetting(),{audioBitrate:t});this._core.updateSetting(e),this._encoder.updateConfigure()}destroy(){this._encoder.destroy()}}const B=new E("RTMP_VEncoder");class J{constructor(t){this._encoder=null,this._queue=[],this._encodeTimer=0,this._loopEncodeTimer=0,this._frameIndex=0,this._gopSize=0,this._encodedFrameCount=0,this._lastFrame=null,this._startTimer=()=>{this._clearEncodeTimer(),this._encodeTimer=setInterval(()=>{const e=this._queue.shift();if(!(!e||!this._encoder||this._encoder.state==="closed"))try{this._encoder.encode(e,{keyFrame:this._frameIndex%this._gopSize===0}),this._frameIndex++,this._lastFrame&&this._lastFrame.close(),this._lastFrame=e}catch(s){B.log("encode frame error",s)}},5)},this._core=t}configurate(t){return this._gopSize=t.gopSize,this._encoder?this.flush().then(()=>this._configure(t)):this._configure(t)}_configure(t){return this._clearEncodeTimer(),B.log("start config encoder",t),VideoEncoder.isConfigSupported(t).then(e=>{if(!e.supported)throw new Error(`VideoEncoder not support config, ${JSON.stringify(t)}`);this._encoder=new VideoEncoder({output:(s,n)=>{const o=new Uint8Array(s.byteLength);s.copyTo(o),this._emitFrame(o,s,n)},error:s=>{this._clearEncodeTimer(),this._core.emit(O.OnError,x(C.VIDEO_ENCODE_FAIL,s.message))}}),this._encoder.configure(t),B.log("encoder configured")}).then(this._startTimer).catch(e=>{throw x(C.VIDEO_ENCODE_CONFIGURE_FAIL,e.message)})}_emitFrame(t,e,s){this._encodedFrameCount++,this._core.emit(l.OnVideoEncoded,{buffer:t,props:{byteLength:e.byteLength,duration:e.duration,timestamp:parseInt(e.timestamp/1e3),originTs:parseInt(e.timestamp/1e3),type:e.type},cfg:s.decoderConfig})}_clearEncodeTimer(){clearInterval(this._encodeTimer)}_clearLoopEncodeTimer(){this._loopEncodeTimer&&clearInterval(this._loopEncodeTimer)}flush(){return this._encoder?this._encoder.flush().then(()=>{var t;this._clearEncodeTimer(),(t=this._encoder)==null||t.close(),this._frameIndex=0,this._encoder=null,B.log("encoder flush & closed")}).catch(t=>{console.log("encoder flush & close error:",t)}):Promise.resolve()}encode(t){this._clearLoopEncodeTimer(),this._queue.push(t)}startLoop(t){if(!this._lastFrame)return;const e=Math.floor(1e3/t*1e3);B.log("start encode last frame looped, ",t,"increment:",e),this._loopEncodeTimer=setInterval(()=>{if(!this._lastFrame)return;const s=new VideoFrame(this._lastFrame,{duration:e,timestamp:(this._lastFrame.timestamp||0)+e});this._queue.push(s)},Math.floor(1e3/t))}destroy(){this._queue.forEach(t=>t.close()),this._lastFrame&&this._lastFrame.close(),this._clearEncodeTimer(),this._clearLoopEncodeTimer(),this.flush()}}const Q=new E("RTMP_VideoEncode");class K{constructor(t){this._core=t,this._encoder=new J(t)}async setConfiguration(t={}){const e=Object.assign({},this._core.getSetting(),t),s={width:e.width,height:e.height,displayWidth:e.width,displayHeight:e.height,bitrate:e.videoBitrate,framerate:Math.floor(e.frameRate),codec:e.codec,gopSize:e.gopSize,hardwareAcceleration:e.hardwareAcceleration};this._core.updateSetting(e),Q.log("set Configuration:",s,t);try{await this._encoder.configurate(s)}catch(n){this._core.emit(O.OnError,n)}}encode(t){this._encoder.encode(t)}startLoopEncodeLastFrame(){this._encoder.startLoop(this._core.getSetting().frameRate)}flushEncoder(){this._encoder.flush()}destroy(){this._encoder.destroy()}}const I=new E("RTMP_AVSync");class Z{constructor(t){this._videoFrameGot=!1,this._videoBaseDts=0,this._audioBaseDts=0,this._videoNextDts=0,this._videoLastDts=0,this._audioNextDts=0,this._lastVideoReceived=0,this._core=t}get avExist(){return this._core.getSetting().hasVideo&&this._core.getSetting().hasAudio}get videoRefDuration(){return parseInt(1e3/this._core.getSetting().frameRate)}get audioRefDuration(){return parseInt(1024/this._core.getSetting().sampleRate*1e3)}addVideoFrame(t){this._videoFrameGot||(this._videoFrameGot=!0);const e=t.props;if(Math.abs(this._videoNextDts-e.timestamp-this._videoBaseDts)>1e3){const n=Date.now()-this._lastVideoReceived;this._videoNextDts=this._videoNextDts===this._audioNextDts?this._videoNextDts+this.videoRefDuration:this._audioNextDts||this._videoNextDts+n,this._videoBaseDts=this._videoNextDts-e.timestamp,I.warn(`video stream timestamp breaked! dts:${this._videoNextDts} -> ${e.timestamp}, videoBaseDts=${this._videoBaseDts}, deltaToLastFrame=${n}`)}e.timestamp=e.timestamp+this._videoBaseDts;const s=e.timestamp-this._videoLastDts;return s>100&&I.warn("video frame large gap",s),this._videoLastDts=this._videoNextDts=e.timestamp,I.long&&I.log(`V frame, dts: ${e.timestamp}, originDts:${e.originTs}, videoBaseDts=${this._videoBaseDts}, type=${e.type}, duration=${s}`),this._lastVideoReceived=Date.now(),this._core.emit(l.OnEncodedFrame,S.Video,t),{size:t.buffer.length,duration:s,key:t.props.type==="key"}}addAudioFrame(t){if(this.avExist&&!this._videoFrameGot)return;const e=t.props;return this._audioBaseDts||(this._audioBaseDts=e.timestamp-this._videoNextDts),Math.abs(e.timestamp-this._audioBaseDts-this._audioNextDts)>1e3&&(this._audioBaseDts=this._audioNextDts+this.audioRefDuration-e.timestamp,I.warn(`audio stream timestamp breaked! dts:${this._audioNextDts} -> ${e.timestamp}, audioBaseDts=${this._audioBaseDts}`)),this._audioNextDts=e.timestamp=e.timestamp-this._audioBaseDts,I.long&&I.log(`A frame, dts: ${e.timestamp}, originDts:${e.originTs}`),this._core.emit(l.OnEncodedFrame,S.Audio,t),{size:t.buffer.length,duration:this.audioRefDuration}}}class X{constructor(){this._videoSize=0,this._videoDuration=0,this._videoBitrate=0,this._frameCount=0,this._fps=0,this._videoEncodedCount=0,this._keyCount=0,this._audioSize=0,this._audioDuration=0,this._audioBitrate=0,this._audioEncodedCount=0}get videoStats(){return{sendBitrate:this._videoBitrate,framesPerSecond:this._fps,framesEncoded:this._videoEncodedCount,keyFramesEncoded:this._keyCount}}get audioStats(){return{sendBitrate:this._audioBitrate,framesEncoded:this._audioEncodedCount}}addVideoSample({size:t,duration:e,key:s}){this._videoEncodedCount++,this._videoSize+=t,this._videoDuration+=e,this._frameCount++,s&&this._keyCount++,this._videoDuration>=1e3&&(this._videoBitrate=Math.floor(this._videoSize/this._videoDuration*8e3),this._fps=this._frameCount,this._frameCount=0,this._videoSize=0,this._videoDuration=0)}addAudioSample({size:t,duration:e}){this._audioEncodedCount++,this._audioSize+=t,this._audioDuration+=e,this._audioDuration>=1e3&&(this._audioBitrate=Math.floor(this._audioSize/this._audioDuration*1e3),this._audioSize=0,this._audioDuration=0)}}const Y=new E("RTMP_EncodeController");class ee{constructor(t){this._analyse=new X,this._gotFrame=!1,this._OnVideoCaptured=(e,s)=>{this._gotFrame=!0,this._videoSettingChanged(s)&&(Y.log("video track setting changed!",s),this._core.updateSetting({width:s.width,height:s.height,frameRate:s.frameRate,vDeviceId:s.deviceId}),this._videoEncode.setConfiguration()),this._videoEncode.encode(e)},this._OnVideoCaptureNoOutput=()=>{this._videoEncode.startLoopEncodeLastFrame()},this._OnAudioCaptured=e=>{this._gotFrame=!0,this._audioEncode.encode(e)},this._OnVideoEncoded=e=>{const s=this._avSync.addVideoFrame(e);this._analyse.addVideoSample(s)},this._OnAudioEncoded=e=>{if(!e.buffer.length)return;const s=this._avSync.addAudioFrame(e);s&&this._analyse.addAudioSample(s)},this._OnUpstreamFeedback=e=>{this._videoEncode.setConfiguration(e)},this._OnBitrateChanged=(e,s)=>{this._gotFrame&&(e===S.Video&&this._videoEncode.setConfiguration({videoBitrate:s}),e===S.Audio&&this._audioEncode.setConfiguration(s))},this._core=t,this._audioEncode=new G(t),this._videoEncode=new K(t),this._avSync=new Z(t),this._bindEvents()}getStats(){return{video:this._analyse.videoStats,audio:this._analyse.audioStats}}init(){return this._audioEncode.init()}_bindEvents(){this._core.on(l.OnVideoCaptured,this._OnVideoCaptured),this._core.on(l.OnAudioCaptured,this._OnAudioCaptured),this._core.on(l.OnVideoCaptureNoOutput,this._OnVideoCaptureNoOutput),this._core.on(l.OnVideoEncoded,this._OnVideoEncoded),this._core.on(l.OnAudioEncoded,this._OnAudioEncoded),this._core.on(l.OnUpstreamFeedback,this._OnUpstreamFeedback),this._core.on(l.OnBitrateChanged,this._OnBitrateChanged)}_videoSettingChanged(t){const e=this._core.getSetting();return t.width!==e.width||t.height!==e.height||Math.floor(t.frameRate)!==Math.floor(e.frameRate)||t.deviceId!==e.vDeviceId}destroy(){this._videoEncode.destroy(),this._audioEncode.destroy()}}var L=(i=>(i[i.AUDIO=8]="AUDIO",i[i.VIDEO=9]="VIDEO",i[i.SCRIPT_DATA=18]="SCRIPT_DATA",i))(L||{});const te=10,ie=1,se=7,oe={96e3:0,48e3:3,44100:4,22050:7,16e3:8,8e3:11};function ne(i){const t=(i[4]&3)+1;let e;const s=[],n=[];let o=6;const _=i[5]&31;let c;for(let r=0;r<_;r++){if(c=i[o]<<8|i[o+1],o+=2,!c)continue;const h=i.subarray(o,o+c);o+=c,s.push(h)}const u=i[o];o++;let a;for(let r=0;r<u;r++)a=i[o]<<8|i[o+1],o+=2,a&&(n.push(i.subarray(o,o+a)),o+=a);return{sps:e,spsArr:s,ppsArr:n,nalUnitSize:t}}class re{constructor(){this._cfg={hasVideo:!1,hasAudio:!1,sampleRate:48e3,channelCount:1},this._hasAudioSeqHeader=!1,this._hasVideoSeqHeader=!1}setConfig(t){this._cfg=Object.assign(this._cfg,t)}genHeader(){const t=[70,76,86,1,(this._cfg.hasAudio?1:0)<<2|(this._cfg.hasVideo?1:0),0,0,0,9,0,0,0,0];return new Uint8Array(t)}genSeqTag(t,e){let s;t===8?(s=this._genAudioTagPaylod(0,e),this._hasAudioSeqHeader=!0):(s=this._genVideoTagPayload(0,e),this._hasVideoSeqHeader=!0);const n=this._genTagHeader(t,s.length,e.props.timestamp),o=n.length+s.length;return D([n,s,new Uint8Array([o>>>24,o>>>16,o>>>8,o])])}genFrameTag(t,e){let s;t===8?s=this._genAudioTagPaylod(1,e):s=this._genVideoTagPayload(1,e);const n=this._genTagHeader(t,s.length,e.props.timestamp),o=n.length+s.length;return D([n,s,new Uint8Array([o>>>24,o>>>16,o>>>8,o])])}_genTagHeader(t,e,s){return new Uint8Array([t,e>>>16,e>>>8,e,s>>>16,s>>>8,s,s>>>24,0,0,0])}_genAudioTagPaylod(t,e){return D(t===0?[this._genAudioTagHeader(),this._genAudioSequenceHeader()]:[this._genAudioTagHeader(),this._genAudioData(e)])}_genAudioTagHeader(){return new Uint8Array([te<<4|12|ie<<1|this._cfg.channelCount-1])}_genAudioSequenceHeader(){const t=4096|oe[this._cfg.sampleRate]<<7|this._cfg.channelCount<<3;return new Uint8Array([0,t>>8,t])}_genAudioData(t){const e=new Uint8Array(1+t.buffer.length);return e.set([1],0),e.set(t.buffer,1),e}_genVideoTagPayload(t,e){return D(t===0?[this._genVideoTagHeader(e),this._genVideoSequenceHeader(e)]:[this._genVideoTagHeader(e),this._genVideoData(e)])}_genVideoTagHeader(t){return new Uint8Array([(t.props.type==="key"?1:2)<<4|se,this._hasVideoSeqHeader?1:0,0,0,0])}_genVideoSequenceHeader(t){return new Uint8Array(t.cfg.description)}_genVideoData(t){if(t.props.type==="delta")return t.buffer;const e=ne(new Uint8Array(t.cfg.description)),s=e.spsArr[0].length,n=e.ppsArr[0].length;return D([new Uint8Array([0,0,s>>8,s%256]),e.spsArr[0],new Uint8Array([0,0,n>>8,n%256]),e.ppsArr[0],t.buffer])}}const ae=new E("RTMP_Packet");class de{constructor(t){this._firstFrame=!0,this._flv=new re,this._OnEncodedFrame=(e,s)=>{if(this._firstFrame){const o=this._core.getSetting();this._flv.setConfig({hasVideo:o.hasVideo,hasAudio:o.hasAudio,sampleRate:o.sampleRate,channelCount:o.channel});const _=this._flv.genHeader();if(this._core.emit(l.OnPacketed,_),o.hasVideo){const c=this._flv.genSeqTag(L.VIDEO,s);this._core.emit(l.OnPacketed,c)}if(o.hasAudio){const c=this._flv.genSeqTag(L.AUDIO,s);this._core.emit(l.OnPacketed,c)}this._firstFrame=!1,ae.log("first frame encoded & packed")}const n=this._flv.genFrameTag(e==="video"?L.VIDEO:L.AUDIO,s);this._core.emit(l.OnPacketed,n,s.props.type==="key")},this._core=t,this._bindEvents()}_bindEvents(){this._core.on(l.OnEncodedFrame,this._OnEncodedFrame)}destroy(){}}class he{constructor(){this._lastDot=0,this._totalSize=0,this._speed=[]}addSample(t){this._lastDot||(this._lastDot=Date.now()),this._totalSize+=t;const e=Date.now()-this._lastDot;e>=500&&(this._addSpeedSample(this._totalSize/e*8e3),this._totalSize=0,this._lastDot=Date.now())}_addSpeedSample(t){this._speed.push(t),this._speed=this._speed.slice(-6)}reset(){this._speed=[]}getUpSpeed(){return this._speed.length?parseInt(this._speed.reduce((t,e)=>t+=e,0)/this._speed.length):0}}const b=new E("RTMP_Wtp");class ce{constructor(t){this._queue=[],this._url="",this._connectClosed=!1,this._upSpeed=new he,this._transport=null,this._writer=null,this._inWriting=!1,this._inAdjustEncode=!1,this._increaseTimer=0,this._firstFramePushed=!1,this._core=t,this._bindEvents()}get sendSpeed(){return this._upSpeed.getUpSpeed()}getStats(){var t;return(t=this._transport)==null?void 0:t.getStats()}_bindEvents(){this._core.on(l.OnPacketed,(t,e=!1)=>{this._checkDecreaseBitrate(),this._checkDeleteCache(e),this._queue.push(t),this._inWriting||this._write()})}_checkDecreaseBitrate(){if(this._inAdjustEncode)return;const t=this._upSpeed.getUpSpeed();if(!t||this._queue.length<A.MaxCachedFrameSize)return;b.log(`up speed: ${t} low, ajust encode setting`);const e=this._core.getSetting();this._core.emit(l.OnUpstreamFeedback,{videoBitrate:t*A.RealSpeedPercent,width:e.width,height:e.height,frameRate:e.frameRate}),this._inAdjustEncode=!0,this._checkIncreaseBitrate()}_checkIncreaseBitrate(){b.log("add timer to check uplink speed increased"),clearInterval(this._increaseTimer),this._increaseTimer=setTimeout(()=>{const t=this._core.getSetting();b.log(`set encode bitrate to specified ${t.videoBitrate}`),this._core.emit(l.OnUpstreamFeedback,{videoBitrate:t.videoBitrate,width:t.width,height:t.height,frameRate:t.frameRate}),this._inAdjustEncode=!0},A.UplinkBitrateCheckInterval)}_checkDeleteCache(t){this._inAdjustEncode&&t&&(b.log(`ajust encode setting finish, delete cached ${this._queue.length} frame`),this._queue=[],this._upSpeed.reset(),this._inAdjustEncode=!1)}async start(t){this._url=t;try{await this._connect()}catch(e){throw x(C.WTP_OPEN_FAIL,e.message)}}async _connect(){const t=new WebTransport(this._url);let e;t.closed.then(()=>{b.log("webtransport closed")}).catch(n=>{e=n.message,b.log("webtransport closed due to",n)}).finally(()=>{this._connectClosed=!0,this._core.emit(O.OnConnectClosed,e),this._core.emit(O.OnError,x(C.WTP_CONNECT_FAIL,e))}),await t.ready,this._transport=t;const s=await t.createBidirectionalStream();this._writer=s.writable.getWriter(),this._write(),b.log("transport opend")}async _write(){var e;if(!this._writer)return;this._inWriting=!0;const t=this._queue.shift();if(!t){this._inWriting=!1;return}await((e=this._writer)==null?void 0:e.write(t)),this._firstFramePushed||(this._firstFramePushed=!0,this._core.emit(O.OnFirstFramePushed),b.log("first frame pushed")),this._upSpeed.addSample(t.length);try{await this._write()}catch(s){b.log("writer error:",s)}}getFile(){return D(this._queue)}destroy(){var t,e;clearTimeout(this._increaseTimer),this._connectClosed||(t=this._writer)==null||t.close(),this._writer=null,(e=this._transport)==null||e.close(),this._transport=null}}const ue=new E("LiveRTMP");class _e extends j{constructor(){super(),this._ts=0,this._setting={codec:A.codec,hardwareAcceleration:"prefer-hardware",width:-1,height:-1,frameRate:-1,sampleRate:A.sampleRate,channel:A.channel,gopSize:A.gopSize,videoBitrate:A.VideoBitrateDefault,audioBitrate:A.AudioBitrateDefault,hasAudio:!1,hasVideo:!1,vDeviceId:"",aDeviceId:""},this._encode=new ee(this),this._packet=new de(this),this._transport=new ce(this)}ready(){return this._encode.init()}getSetting(){return this._setting}updateSetting(t){this._setting=Object.assign({},this._setting,t)}videoFrameCaptured(t,e){this.emit(l.OnVideoCaptured,t,e)}audioFrameCaptured(t,e){this.emit(l.OnAudioCaptured,t,e)}startMockVideoEncode(){this.emit(l.OnVideoCaptureNoOutput)}adjustBitrate(t,e){t===S.Video&&this.updateSetting({videoBitrate:e}),t===S.Audio&&this.updateSetting({audioBitrate:e}),this.emit(l.OnBitrateChanged,t,e)}avExist(t,e){this._setting.hasVideo=t,this._setting.hasAudio=e}publish(t){return this._transport.start(t)}setEncodeCapacity(t){this._setting=Object.assign({},this._setting,t)}getStats(){return{video:{...this._encode.getStats().video,sendSpeed:this._transport.sendSpeed,codec:this._setting.codec,frameWidth:this._setting.width,frameHeight:this._setting.height,gopSize:this._setting.gopSize},audio:{...this._encode.getStats().audio,codec:"aac",channels:this._setting.channel,sampleRate:this._setting.sampleRate}}}destroy(){ue.log("destroy"),this._encode.destroy(),this._packet.destroy(),this._transport.destroy()}down(){return this._transport.getFile()}}self.constructor.name!=="Window"&&le();function le(){let i={};self.addEventListener("message",async t=>{switch(t.data.type){case v.Init:{const{options:e}=t.data;e.logEnable&&(E.enable=!0),e.logEnableLong&&(E.enableLong=!0),i=new _e,i.on(O.OnError,s=>{self.postMessage({type:y.Error,data:s.toJson()})}),i.on(O.OnConnectClosed,()=>{self.postMessage({type:y.Close})}),i.on(O.OnFirstFramePushed,()=>{self.postMessage({type:y.FirstFramePushed})});try{await i.ready(),self.postMessage({type:y.Ready})}catch(s){self.postMessage({type:y.Error,data:s.toJson()})}}break;case v.AvExist:{const{hasAudio:e,hasVideo:s}=t.data;i.avExist(s,e)}break;case v.VideoFrame:{const{frame:e,setting:s}=t.data;i.videoFrameCaptured(e,s)}break;case v.MockVideoEncode:i.startMockVideoEncode();break;case v.AudioFrame:{const{frame:e,setting:s}=t.data;i.audioFrameCaptured(e,s)}break;case v.AdjustBitrate:{const{kind:e,bitrate:s}=t.data;i.adjustBitrate(e,s)}break;case v.Publish:{const{url:e}=t.data;try{await i.publish(e)}catch(s){self.postMessage({type:y.Error,data:s.toJson()})}}break;case v.GetStats:self.postMessage({type:y.STATS,data:i.getStats()});break;case v.EncodeConfig:{i.setEncodeCapacity(t.data.cfg);break}case v.Download:{const e=i.down();self.postMessage({type:y.Flvfile,buffer:e},[e.buffer])}break;case v.UnPublish:{i.destroy();break}}})}})();\n', li = typeof self < "u" && self.Blob && new Blob([fs], { type: "text/javascript;charset=utf-8" });
|
|
5197
|
-
function
|
|
5203
|
+
const _s = '(function(){"use strict";var l=(i=>(i.OnVideoCaptured="onvideocaptured",i.OnAudioCaptured="onaudiocaptured",i.OnVideoCaptureNoOutput="onvideocapturenooutput",i.OnVideoEncoded="onvideoencoded",i.OnAudioEncoded="onaudioencoded",i.OnEncodedFrame="onencodedframe",i.OnPacketed="onpacketed",i.OnUpstreamFeedback="onupstreamfeedback",i.OnBitrateChanged="onbitratechanged",i))(l||{}),O=(i=>(i.OnError="onerror",i.OnConnectClosed="onconnectclosed",i.OnFirstFramePushed="onfirstframepushed",i))(O||{}),S=(i=>(i.Video="video",i.Audio="audio",i))(S||{}),v=(i=>(i.Init="init",i.AvExist="avexist",i.VideoFrame="videoframe",i.MockVideoEncode="mockvideoencode",i.AudioFrame="audioframe",i.AdjustBitrate="adjustbitrate",i.Publish="publish",i.UnPublish="unpublish",i.Download="download",i.GetStats="getstats",i.EncodeConfig="encodeconfig",i))(v||{}),y=(i=>(i.Ready="ready",i.Error="error",i.FirstFramePushed="firstframepushed",i.Flvfile="flvfile",i.STATS="stats",i.Close="close",i))(y||{});function $(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var k={exports:{}},T;function q(){return T||(T=1,function(i){var t=Object.prototype.hasOwnProperty,e="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(e=!1));function n(u,a,r){this.fn=u,this.context=a,this.once=r||!1}function o(u,a,r,h,m){if(typeof r!="function")throw new TypeError("The listener must be a function");var g=new n(r,h||u,m),f=e?e+a:a;return u._events[f]?u._events[f].fn?u._events[f]=[u._events[f],g]:u._events[f].push(g):(u._events[f]=g,u._eventsCount++),u}function _(u,a){--u._eventsCount===0?u._events=new s:delete u._events[a]}function c(){this._events=new s,this._eventsCount=0}c.prototype.eventNames=function(){var a=[],r,h;if(this._eventsCount===0)return a;for(h in r=this._events)t.call(r,h)&&a.push(e?h.slice(1):h);return Object.getOwnPropertySymbols?a.concat(Object.getOwnPropertySymbols(r)):a},c.prototype.listeners=function(a){var r=e?e+a:a,h=this._events[r];if(!h)return[];if(h.fn)return[h.fn];for(var m=0,g=h.length,f=new Array(g);m<g;m++)f[m]=h[m].fn;return f},c.prototype.listenerCount=function(a){var r=e?e+a:a,h=this._events[r];return h?h.fn?1:h.length:0},c.prototype.emit=function(a,r,h,m,g,f){var w=e?e+a:a;if(!this._events[w])return!1;var d=this._events[w],F=arguments.length,V,p;if(d.fn){switch(d.once&&this.removeListener(a,d.fn,void 0,!0),F){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,r),!0;case 3:return d.fn.call(d.context,r,h),!0;case 4:return d.fn.call(d.context,r,h,m),!0;case 5:return d.fn.call(d.context,r,h,m,g),!0;case 6:return d.fn.call(d.context,r,h,m,g,f),!0}for(p=1,V=new Array(F-1);p<F;p++)V[p-1]=arguments[p];d.fn.apply(d.context,V)}else{var fe=d.length,R;for(p=0;p<fe;p++)switch(d[p].once&&this.removeListener(a,d[p].fn,void 0,!0),F){case 1:d[p].fn.call(d[p].context);break;case 2:d[p].fn.call(d[p].context,r);break;case 3:d[p].fn.call(d[p].context,r,h);break;case 4:d[p].fn.call(d[p].context,r,h,m);break;default:if(!V)for(R=1,V=new Array(F-1);R<F;R++)V[R-1]=arguments[R];d[p].fn.apply(d[p].context,V)}}return!0},c.prototype.on=function(a,r,h){return o(this,a,r,h,!1)},c.prototype.once=function(a,r,h){return o(this,a,r,h,!0)},c.prototype.removeListener=function(a,r,h,m){var g=e?e+a:a;if(!this._events[g])return this;if(!r)return _(this,g),this;var f=this._events[g];if(f.fn)f.fn===r&&(!m||f.once)&&(!h||f.context===h)&&_(this,g);else{for(var w=0,d=[],F=f.length;w<F;w++)(f[w].fn!==r||m&&!f[w].once||h&&f[w].context!==h)&&d.push(f[w]);d.length?this._events[g]=d.length===1?d[0]:d:_(this,g)}return this},c.prototype.removeAllListeners=function(a){var r;return a?(r=e?e+a:a,this._events[r]&&_(this,r)):(this._events=new s,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=e,c.EventEmitter=c,i.exports=c}(k)),k.exports}var z=q(),j=$(z);const N=class N{constructor(t){this.group=(...e)=>{this._enabled&&console.group(`[${this._prefix}]: `,...e)},this.groupCollapsed=(...e)=>{this._enabled&&console.groupCollapsed(`[${this._prefix}]: `,...e)},this.groupEnd=()=>{this._enabled&&console.groupEnd()},this.log=(...e)=>{this._enabled&&console.log(`[${this._prefix}]: `,...e)},this.warn=(...e)=>{this._enabled&&console.warn(`[${this._prefix}]: `,...e)},this.error=(...e)=>{this._enabled&&console.error(`[${this._prefix}]: `,...e)},this.table=(...e)=>{this._enabled&&console.table(...e)},this._prefix=t}get _enabled(){return N.enable}get _enableLong(){return N.enableLong}get long(){return this._enableLong}};N.enable=!1,N.enableLong=!1;let E=N;function D(i){i=i.filter(Boolean);const t=new Uint8Array(i.reduce((s,n)=>s+n.byteLength,0));let e=0;return i.forEach(s=>{t.set(s,e),e+=s.byteLength}),t}const A={codec:"avc1.4DE033",MaxCachedFrameSize:100,RealSpeedPercent:.8,UplinkBitrateCheckInterval:60*1e3,VideoBitrateDefault:1e6,AudioBitrateDefault:68e3,gopSize:90,sampleRate:48e3,channel:2,audioEncoderPath:"https://lf-unpkg.volccdn.com/obj/vcloudfe/sdk/Web_push/1.0.1/1735619140327/pcm2aac.js",audioEncoderWasmPath:"https://lf-unpkg.volccdn.com/obj/vcloudfe/sdk/Web_push/1.0.2/1735619208418/pcm2aac.wasm",rrnoiseAssetsPath:"https://sf1-cdn-tos.huoshanstatic.com/obj/media-fe/encoder/0.1.0",ignoreRelPublish:!1},U=new E("RTMP_AudioEncoder");class H{constructor(t){this._encodedFrameCount=0,this._ready=!1,this._lastFrame=null,this._aacOutput=(e,s)=>{const n=this._module.HEAPU8.subarray(e,e+s);if(!this._lastFrame)return;this._encodedFrameCount++;const{props:o}=this._lastFrame,_={buffer:new Uint8Array(n),props:{timestamp:parseInt(o.timestamp/1e3),originTs:parseInt(o.timestamp/1e3)}};this._core.emit(l.OnAudioEncoded,_)},this._core=t}async init(){const t=await fetch(A.audioEncoderPath).then(_=>_.text());new Function(`self.exports={};${t}`)();const e=self.exports.m;let s,n;const o=new Promise((_,c)=>{n=_,s=c});return e({instantiateWasm:function(_,c){fetch(A.audioEncoderWasmPath).then(u=>u.arrayBuffer()).then(u=>WebAssembly.instantiate(u,_)).then(function(u){return c(u.instance)}).then(()=>{n(),U.log("aac module inited")}).catch(u=>{s(u)})}}).then(_=>{const c=_.addFunction(this._aacOutput,"vii");_._init_callback(c),this._module=_}).catch(s),o}rnnoise(t){var s;const e=t.length;for(let n=0;n<e;n++)t[n]=t[n]*32768;(s=this._rnnoiseModule)==null||s.processFrame(t);for(let n=0;n<e;n++)t[n]=t[n]/32768}updateConfigure(){this._module._flush(),this._module._free_encoder(),this._ready=!1}encode(t){if(!this._ready){const o=this._start_encoder();if(o<0)throw new Error(`init aac encoder error, code:${o}`)}this._lastFrame=t;const e=t.buffer.buffer,s=this._module._malloc(e.byteLength);this._module.HEAPU8.subarray(s,s+e.byteLength).set(new Uint8Array(e));const n=this._module._encode_one_frame(s);if(n<0)throw new Error(`encode aac frame error, code:${n}`)}_start_encoder(){const t=this._core.getSetting(),e=this._module._init_encoder(t.sampleRate,t.channel,t.audioBitrate);if(e<0)return e;this._ready=!0,U.log(`init encoder: sampleRate=${t.sampleRate}, channel:${t.channel}, bitrate:${t.audioBitrate}`)}destroy(){var t;(t=this._module)==null||t._free_encoder()}}const P=1024;class M{constructor(){this._queue=[],this._sampleCount=0}compose(t){if(this._queue.push(t),this._sampleCount+=t.data.audioData.numberOfFrames,this._sampleCount>=P)return this._doCompose()}_doCompose(){const t=new Float32Array(P);let e=0,s=P;const n=this._queue[0];for(;;){const o=this._queue[0];if(!o)break;const _=Math.min(s,o.data.audioData.numberOfFrames-o.offset,480),c=o.data.buffer.slice(o.offset,o.offset+_);if(o.offset+=_,o.offset>=o.data.audioData.numberOfFrames&&this._queue.shift(),s-=_,this._sampleCount-=_,t.set(c,e),e+=_,s<=0)break}return{buffer:t,props:{timestamp:n.data.audioData.timestamp,sampleRate:n.data.audioData.sampleRate,numberOfChannels:n.data.audioData.numberOfChannels}}}}var C=(i=>(i[i.RTMP_INIT_FAIL=3e3]="RTMP_INIT_FAIL",i[i.AUDIO_ENCODER_INIT_FAIL=3001]="AUDIO_ENCODER_INIT_FAIL",i[i.AUDIO_RRNOISE_INIT_FAIL=3002]="AUDIO_RRNOISE_INIT_FAIL",i[i.AUDIO_ENCODE_FAIL=3003]="AUDIO_ENCODE_FAIL",i[i.VIDEO_ENCODE_CONFIGURE_FAIL=3004]="VIDEO_ENCODE_CONFIGURE_FAIL",i[i.VIDEO_ENCODE_FAIL=3005]="VIDEO_ENCODE_FAIL",i[i.WTP_OPEN_FAIL=3006]="WTP_OPEN_FAIL",i[i.WTP_CONNECT_FAIL=3007]="WTP_CONNECT_FAIL",i[i.WORKER_ERROR=3008]="WORKER_ERROR",i))(C||{});class W extends Error{constructor(t,e,s){super(),this.code=t,this.message=e,s&&(this.ext=s),this.toJson=()=>({code:this.code,message:this.message,ext:this.ext})}}function x(i,t,e){return new W(i,t,e)}class G{constructor(t){this._audioFrameQueue=new M,this.encode=e=>{const s=new Float32Array(e.numberOfFrames);e.copyTo(s,{planeIndex:0,frameOffset:0,frameCount:e.numberOfFrames});const n=this._audioFrameQueue.compose({offset:0,data:{audioData:e,buffer:s}});if(n)try{this._encoder.encode(n)}catch(o){this._core.emit(O.OnError,x(C.AUDIO_ENCODE_FAIL,o.message))}},this._core=t,this._encoder=new H(t)}async init(){try{await this._encoder.init()}catch(t){throw x(C.AUDIO_ENCODER_INIT_FAIL,t.message)}}setConfiguration(t){const e=Object.assign({},this._core.getSetting(),{audioBitrate:t});this._core.updateSetting(e),this._encoder.updateConfigure()}destroy(){this._encoder.destroy()}}const B=new E("RTMP_VEncoder");class J{constructor(t){this._encoder=null,this._queue=[],this._encodeTimer=0,this._loopEncodeTimer=0,this._frameIndex=0,this._gopSize=0,this._encodedFrameCount=0,this._lastFrame=null,this._startTimer=()=>{this._clearEncodeTimer(),this._encodeTimer=setInterval(()=>{const e=this._queue.shift();if(!(!e||!this._encoder||this._encoder.state==="closed"))try{this._encoder.encode(e,{keyFrame:this._frameIndex%this._gopSize===0}),this._frameIndex++,this._lastFrame&&this._lastFrame.close(),this._lastFrame=e}catch(s){B.log("encode frame error",s)}},5)},this._core=t}configurate(t){return this._gopSize=t.gopSize,this._encoder?this.flush().then(()=>this._configure(t)):this._configure(t)}_configure(t){return this._clearEncodeTimer(),B.log("start config encoder",t),VideoEncoder.isConfigSupported(t).then(e=>{if(!e.supported)throw new Error(`VideoEncoder not support config, ${JSON.stringify(t)}`);this._encoder=new VideoEncoder({output:(s,n)=>{const o=new Uint8Array(s.byteLength);s.copyTo(o),this._emitFrame(o,s,n)},error:s=>{this._clearEncodeTimer(),this._core.emit(O.OnError,x(C.VIDEO_ENCODE_FAIL,s.message))}}),this._encoder.configure(t),B.log("encoder configured")}).then(this._startTimer).catch(e=>{throw x(C.VIDEO_ENCODE_CONFIGURE_FAIL,e.message)})}_emitFrame(t,e,s){this._encodedFrameCount++,this._core.emit(l.OnVideoEncoded,{buffer:t,props:{byteLength:e.byteLength,duration:e.duration,timestamp:parseInt(e.timestamp/1e3),originTs:parseInt(e.timestamp/1e3),type:e.type},cfg:s.decoderConfig})}_clearEncodeTimer(){clearInterval(this._encodeTimer)}_clearLoopEncodeTimer(){this._loopEncodeTimer&&clearInterval(this._loopEncodeTimer)}flush(){return this._encoder?this._encoder.flush().then(()=>{var t;this._clearEncodeTimer(),(t=this._encoder)==null||t.close(),this._frameIndex=0,this._encoder=null,B.log("encoder flush & closed")}).catch(t=>{console.log("encoder flush & close error:",t)}):Promise.resolve()}encode(t){this._clearLoopEncodeTimer(),this._queue.push(t)}startLoop(t){if(!this._lastFrame)return;const e=Math.floor(1e3/t*1e3);B.log("start encode last frame looped, ",t,"increment:",e),this._loopEncodeTimer=setInterval(()=>{if(!this._lastFrame)return;const s=new VideoFrame(this._lastFrame,{duration:e,timestamp:(this._lastFrame.timestamp||0)+e});this._queue.push(s)},Math.floor(1e3/t))}destroy(){this._queue.forEach(t=>t.close()),this._lastFrame&&this._lastFrame.close(),this._clearEncodeTimer(),this._clearLoopEncodeTimer(),this.flush()}}const Q=new E("RTMP_VideoEncode");class K{constructor(t){this._core=t,this._encoder=new J(t)}async setConfiguration(t={}){const e=Object.assign({},this._core.getSetting(),t),s={width:e.width,height:e.height,displayWidth:e.width,displayHeight:e.height,bitrate:e.videoBitrate,framerate:Math.floor(e.frameRate),codec:e.codec,gopSize:e.gopSize,hardwareAcceleration:e.hardwareAcceleration};this._core.updateSetting(e),Q.log("set Configuration:",s,t);try{await this._encoder.configurate(s)}catch(n){this._core.emit(O.OnError,n)}}encode(t){this._encoder.encode(t)}startLoopEncodeLastFrame(){this._encoder.startLoop(this._core.getSetting().frameRate)}flushEncoder(){this._encoder.flush()}destroy(){this._encoder.destroy()}}const I=new E("RTMP_AVSync");class Z{constructor(t){this._videoFrameGot=!1,this._videoBaseDts=0,this._audioBaseDts=0,this._videoNextDts=0,this._videoLastDts=0,this._audioNextDts=0,this._lastVideoReceived=0,this._core=t}get avExist(){return this._core.getSetting().hasVideo&&this._core.getSetting().hasAudio}get videoRefDuration(){return parseInt(1e3/this._core.getSetting().frameRate)}get audioRefDuration(){return parseInt(1024/this._core.getSetting().sampleRate*1e3)}addVideoFrame(t){this._videoFrameGot||(this._videoFrameGot=!0);const e=t.props;if(Math.abs(this._videoNextDts-e.timestamp-this._videoBaseDts)>1e3){const n=Date.now()-this._lastVideoReceived;this._videoNextDts=this._videoNextDts===this._audioNextDts?this._videoNextDts+this.videoRefDuration:this._audioNextDts||this._videoNextDts+n,this._videoBaseDts=this._videoNextDts-e.timestamp,I.warn(`video stream timestamp breaked! dts:${this._videoNextDts} -> ${e.timestamp}, videoBaseDts=${this._videoBaseDts}, deltaToLastFrame=${n}`)}e.timestamp=e.timestamp+this._videoBaseDts;const s=e.timestamp-this._videoLastDts;return s>100&&I.warn("video frame large gap",s),this._videoLastDts=this._videoNextDts=e.timestamp,I.long&&I.log(`V frame, dts: ${e.timestamp}, originDts:${e.originTs}, videoBaseDts=${this._videoBaseDts}, type=${e.type}, duration=${s}`),this._lastVideoReceived=Date.now(),this._core.emit(l.OnEncodedFrame,S.Video,t),{size:t.buffer.length,duration:s,key:t.props.type==="key"}}addAudioFrame(t){if(this.avExist&&!this._videoFrameGot)return;const e=t.props;return this._audioBaseDts||(this._audioBaseDts=e.timestamp-this._videoNextDts),Math.abs(e.timestamp-this._audioBaseDts-this._audioNextDts)>1e3&&(this._audioBaseDts=this._audioNextDts+this.audioRefDuration-e.timestamp,I.warn(`audio stream timestamp breaked! dts:${this._audioNextDts} -> ${e.timestamp}, audioBaseDts=${this._audioBaseDts}`)),this._audioNextDts=e.timestamp=e.timestamp-this._audioBaseDts,I.long&&I.log(`A frame, dts: ${e.timestamp}, originDts:${e.originTs}`),this._core.emit(l.OnEncodedFrame,S.Audio,t),{size:t.buffer.length,duration:this.audioRefDuration}}}class X{constructor(){this._videoSize=0,this._videoDuration=0,this._videoBitrate=0,this._frameCount=0,this._fps=0,this._videoEncodedCount=0,this._keyCount=0,this._audioSize=0,this._audioDuration=0,this._audioBitrate=0,this._audioEncodedCount=0}get videoStats(){return{sendBitrate:this._videoBitrate,framesPerSecond:this._fps,framesEncoded:this._videoEncodedCount,keyFramesEncoded:this._keyCount}}get audioStats(){return{sendBitrate:this._audioBitrate,framesEncoded:this._audioEncodedCount}}addVideoSample({size:t,duration:e,key:s}){this._videoEncodedCount++,this._videoSize+=t,this._videoDuration+=e,this._frameCount++,s&&this._keyCount++,this._videoDuration>=1e3&&(this._videoBitrate=Math.floor(this._videoSize/this._videoDuration*8e3),this._fps=this._frameCount,this._frameCount=0,this._videoSize=0,this._videoDuration=0)}addAudioSample({size:t,duration:e}){this._audioEncodedCount++,this._audioSize+=t,this._audioDuration+=e,this._audioDuration>=1e3&&(this._audioBitrate=Math.floor(this._audioSize/this._audioDuration*1e3),this._audioSize=0,this._audioDuration=0)}}const Y=new E("RTMP_EncodeController");class ee{constructor(t){this._analyse=new X,this._gotFrame=!1,this._OnVideoCaptured=(e,s)=>{this._gotFrame=!0,this._videoSettingChanged(s)&&(Y.log("video track setting changed!",s),this._core.updateSetting({width:s.width,height:s.height,frameRate:s.frameRate,vDeviceId:s.deviceId}),this._videoEncode.setConfiguration()),this._videoEncode.encode(e)},this._OnVideoCaptureNoOutput=()=>{this._videoEncode.startLoopEncodeLastFrame()},this._OnAudioCaptured=e=>{this._gotFrame=!0,this._audioEncode.encode(e)},this._OnVideoEncoded=e=>{const s=this._avSync.addVideoFrame(e);this._analyse.addVideoSample(s)},this._OnAudioEncoded=e=>{if(!e.buffer.length)return;const s=this._avSync.addAudioFrame(e);s&&this._analyse.addAudioSample(s)},this._OnUpstreamFeedback=e=>{this._videoEncode.setConfiguration(e)},this._OnBitrateChanged=(e,s)=>{this._gotFrame&&(e===S.Video&&this._videoEncode.setConfiguration({videoBitrate:s}),e===S.Audio&&this._audioEncode.setConfiguration(s))},this._core=t,this._audioEncode=new G(t),this._videoEncode=new K(t),this._avSync=new Z(t),this._bindEvents()}getStats(){return{video:this._analyse.videoStats,audio:this._analyse.audioStats}}init(){return this._audioEncode.init()}_bindEvents(){this._core.on(l.OnVideoCaptured,this._OnVideoCaptured),this._core.on(l.OnAudioCaptured,this._OnAudioCaptured),this._core.on(l.OnVideoCaptureNoOutput,this._OnVideoCaptureNoOutput),this._core.on(l.OnVideoEncoded,this._OnVideoEncoded),this._core.on(l.OnAudioEncoded,this._OnAudioEncoded),this._core.on(l.OnUpstreamFeedback,this._OnUpstreamFeedback),this._core.on(l.OnBitrateChanged,this._OnBitrateChanged)}_videoSettingChanged(t){const e=this._core.getSetting();return t.width!==e.width||t.height!==e.height||Math.floor(t.frameRate)!==Math.floor(e.frameRate)||t.deviceId!==e.vDeviceId}destroy(){this._videoEncode.destroy(),this._audioEncode.destroy()}}var L=(i=>(i[i.AUDIO=8]="AUDIO",i[i.VIDEO=9]="VIDEO",i[i.SCRIPT_DATA=18]="SCRIPT_DATA",i))(L||{});const te=10,ie=1,se=7,oe={96e3:0,48e3:3,44100:4,22050:7,16e3:8,8e3:11};function ne(i){const t=(i[4]&3)+1;let e;const s=[],n=[];let o=6;const _=i[5]&31;let c;for(let r=0;r<_;r++){if(c=i[o]<<8|i[o+1],o+=2,!c)continue;const h=i.subarray(o,o+c);o+=c,s.push(h)}const u=i[o];o++;let a;for(let r=0;r<u;r++)a=i[o]<<8|i[o+1],o+=2,a&&(n.push(i.subarray(o,o+a)),o+=a);return{sps:e,spsArr:s,ppsArr:n,nalUnitSize:t}}class re{constructor(){this._cfg={hasVideo:!1,hasAudio:!1,sampleRate:48e3,channelCount:1},this._hasAudioSeqHeader=!1,this._hasVideoSeqHeader=!1}setConfig(t){this._cfg=Object.assign(this._cfg,t)}genHeader(){const t=[70,76,86,1,(this._cfg.hasAudio?1:0)<<2|(this._cfg.hasVideo?1:0),0,0,0,9,0,0,0,0];return new Uint8Array(t)}genSeqTag(t,e){let s;t===8?(s=this._genAudioTagPaylod(0,e),this._hasAudioSeqHeader=!0):(s=this._genVideoTagPayload(0,e),this._hasVideoSeqHeader=!0);const n=this._genTagHeader(t,s.length,e.props.timestamp),o=n.length+s.length;return D([n,s,new Uint8Array([o>>>24,o>>>16,o>>>8,o])])}genFrameTag(t,e){let s;t===8?s=this._genAudioTagPaylod(1,e):s=this._genVideoTagPayload(1,e);const n=this._genTagHeader(t,s.length,e.props.timestamp),o=n.length+s.length;return D([n,s,new Uint8Array([o>>>24,o>>>16,o>>>8,o])])}_genTagHeader(t,e,s){return new Uint8Array([t,e>>>16,e>>>8,e,s>>>16,s>>>8,s,s>>>24,0,0,0])}_genAudioTagPaylod(t,e){return D(t===0?[this._genAudioTagHeader(),this._genAudioSequenceHeader()]:[this._genAudioTagHeader(),this._genAudioData(e)])}_genAudioTagHeader(){return new Uint8Array([te<<4|12|ie<<1|this._cfg.channelCount-1])}_genAudioSequenceHeader(){const t=4096|oe[this._cfg.sampleRate]<<7|this._cfg.channelCount<<3;return new Uint8Array([0,t>>8,t])}_genAudioData(t){const e=new Uint8Array(1+t.buffer.length);return e.set([1],0),e.set(t.buffer,1),e}_genVideoTagPayload(t,e){return D(t===0?[this._genVideoTagHeader(e),this._genVideoSequenceHeader(e)]:[this._genVideoTagHeader(e),this._genVideoData(e)])}_genVideoTagHeader(t){return new Uint8Array([(t.props.type==="key"?1:2)<<4|se,this._hasVideoSeqHeader?1:0,0,0,0])}_genVideoSequenceHeader(t){return new Uint8Array(t.cfg.description)}_genVideoData(t){if(t.props.type==="delta")return t.buffer;const e=ne(new Uint8Array(t.cfg.description)),s=e.spsArr[0].length,n=e.ppsArr[0].length;return D([new Uint8Array([0,0,s>>8,s%256]),e.spsArr[0],new Uint8Array([0,0,n>>8,n%256]),e.ppsArr[0],t.buffer])}}const ae=new E("RTMP_Packet");class de{constructor(t){this._firstFrame=!0,this._flv=new re,this._OnEncodedFrame=(e,s)=>{if(this._firstFrame){const o=this._core.getSetting();this._flv.setConfig({hasVideo:o.hasVideo,hasAudio:o.hasAudio,sampleRate:o.sampleRate,channelCount:o.channel});const _=this._flv.genHeader();if(this._core.emit(l.OnPacketed,_),o.hasVideo){const c=this._flv.genSeqTag(L.VIDEO,s);this._core.emit(l.OnPacketed,c)}if(o.hasAudio){const c=this._flv.genSeqTag(L.AUDIO,s);this._core.emit(l.OnPacketed,c)}this._firstFrame=!1,ae.log("first frame encoded & packed")}const n=this._flv.genFrameTag(e==="video"?L.VIDEO:L.AUDIO,s);this._core.emit(l.OnPacketed,n,s.props.type==="key")},this._core=t,this._bindEvents()}_bindEvents(){this._core.on(l.OnEncodedFrame,this._OnEncodedFrame)}destroy(){}}class he{constructor(){this._lastDot=0,this._totalSize=0,this._speed=[]}addSample(t){this._lastDot||(this._lastDot=Date.now()),this._totalSize+=t;const e=Date.now()-this._lastDot;e>=500&&(this._addSpeedSample(this._totalSize/e*8e3),this._totalSize=0,this._lastDot=Date.now())}_addSpeedSample(t){this._speed.push(t),this._speed=this._speed.slice(-6)}reset(){this._speed=[]}getUpSpeed(){return this._speed.length?parseInt(this._speed.reduce((t,e)=>t+=e,0)/this._speed.length):0}}const b=new E("RTMP_Wtp");class ce{constructor(t){this._queue=[],this._url="",this._connectClosed=!1,this._upSpeed=new he,this._transport=null,this._writer=null,this._inWriting=!1,this._inAdjustEncode=!1,this._increaseTimer=0,this._firstFramePushed=!1,this._core=t,this._bindEvents()}get sendSpeed(){return this._upSpeed.getUpSpeed()}getStats(){var t;return(t=this._transport)==null?void 0:t.getStats()}_bindEvents(){this._core.on(l.OnPacketed,(t,e=!1)=>{this._checkDecreaseBitrate(),this._checkDeleteCache(e),this._queue.push(t),this._inWriting||this._write()})}_checkDecreaseBitrate(){if(this._inAdjustEncode)return;const t=this._upSpeed.getUpSpeed();if(!t||this._queue.length<A.MaxCachedFrameSize)return;b.log(`up speed: ${t} low, ajust encode setting`);const e=this._core.getSetting();this._core.emit(l.OnUpstreamFeedback,{videoBitrate:t*A.RealSpeedPercent,width:e.width,height:e.height,frameRate:e.frameRate}),this._inAdjustEncode=!0,this._checkIncreaseBitrate()}_checkIncreaseBitrate(){b.log("add timer to check uplink speed increased"),clearInterval(this._increaseTimer),this._increaseTimer=setTimeout(()=>{const t=this._core.getSetting();b.log(`set encode bitrate to specified ${t.videoBitrate}`),this._core.emit(l.OnUpstreamFeedback,{videoBitrate:t.videoBitrate,width:t.width,height:t.height,frameRate:t.frameRate}),this._inAdjustEncode=!0},A.UplinkBitrateCheckInterval)}_checkDeleteCache(t){this._inAdjustEncode&&t&&(b.log(`ajust encode setting finish, delete cached ${this._queue.length} frame`),this._queue=[],this._upSpeed.reset(),this._inAdjustEncode=!1)}async start(t){this._url=t;try{await this._connect()}catch(e){throw x(C.WTP_OPEN_FAIL,e.message)}}async _connect(){const t=new WebTransport(this._url);let e;t.closed.then(()=>{b.log("webtransport closed")}).catch(n=>{e=n.message,b.log("webtransport closed due to",n)}).finally(()=>{this._connectClosed=!0,this._core.emit(O.OnConnectClosed,e),this._core.emit(O.OnError,x(C.WTP_CONNECT_FAIL,e))}),await t.ready,this._transport=t;const s=await t.createBidirectionalStream();this._writer=s.writable.getWriter(),this._write(),b.log("transport opend")}async _write(){var e;if(!this._writer)return;this._inWriting=!0;const t=this._queue.shift();if(!t){this._inWriting=!1;return}await((e=this._writer)==null?void 0:e.write(t)),this._firstFramePushed||(this._firstFramePushed=!0,this._core.emit(O.OnFirstFramePushed),b.log("first frame pushed")),this._upSpeed.addSample(t.length);try{await this._write()}catch(s){b.log("writer error:",s)}}getFile(){return D(this._queue)}destroy(){var t,e;clearTimeout(this._increaseTimer),this._connectClosed||(t=this._writer)==null||t.close(),this._writer=null,(e=this._transport)==null||e.close(),this._transport=null}}const ue=new E("LiveRTMP");class _e extends j{constructor(){super(),this._ts=0,this._setting={codec:A.codec,hardwareAcceleration:"prefer-hardware",width:-1,height:-1,frameRate:-1,sampleRate:A.sampleRate,channel:A.channel,gopSize:A.gopSize,videoBitrate:A.VideoBitrateDefault,audioBitrate:A.AudioBitrateDefault,hasAudio:!1,hasVideo:!1,vDeviceId:"",aDeviceId:""},this._encode=new ee(this),this._packet=new de(this),this._transport=new ce(this)}ready(){return this._encode.init()}getSetting(){return this._setting}updateSetting(t){this._setting=Object.assign({},this._setting,t)}videoFrameCaptured(t,e){this.emit(l.OnVideoCaptured,t,e)}audioFrameCaptured(t,e){this.emit(l.OnAudioCaptured,t,e)}startMockVideoEncode(){this.emit(l.OnVideoCaptureNoOutput)}adjustBitrate(t,e){t===S.Video&&this.updateSetting({videoBitrate:e}),t===S.Audio&&this.updateSetting({audioBitrate:e}),this.emit(l.OnBitrateChanged,t,e)}avExist(t,e){this._setting.hasVideo=t,this._setting.hasAudio=e}publish(t){return this._transport.start(t)}setEncodeCapacity(t){this._setting=Object.assign({},this._setting,t)}getStats(){return{video:{...this._encode.getStats().video,sendSpeed:this._transport.sendSpeed,codec:this._setting.codec,frameWidth:this._setting.width,frameHeight:this._setting.height,gopSize:this._setting.gopSize},audio:{...this._encode.getStats().audio,codec:"aac",channels:this._setting.channel,sampleRate:this._setting.sampleRate}}}destroy(){ue.log("destroy"),this._encode.destroy(),this._packet.destroy(),this._transport.destroy()}down(){return this._transport.getFile()}}self.constructor.name!=="Window"&&le();function le(){let i={};self.addEventListener("message",async t=>{switch(t.data.type){case v.Init:{const{options:e}=t.data;e.logEnable&&(E.enable=!0),e.logEnableLong&&(E.enableLong=!0),i=new _e,i.on(O.OnError,s=>{self.postMessage({type:y.Error,data:s.toJson()})}),i.on(O.OnConnectClosed,()=>{self.postMessage({type:y.Close})}),i.on(O.OnFirstFramePushed,()=>{self.postMessage({type:y.FirstFramePushed})});try{await i.ready(),self.postMessage({type:y.Ready})}catch(s){self.postMessage({type:y.Error,data:s.toJson()})}}break;case v.AvExist:{const{hasAudio:e,hasVideo:s}=t.data;i.avExist(s,e)}break;case v.VideoFrame:{const{frame:e,setting:s}=t.data;i.videoFrameCaptured(e,s)}break;case v.MockVideoEncode:i.startMockVideoEncode();break;case v.AudioFrame:{const{frame:e,setting:s}=t.data;i.audioFrameCaptured(e,s)}break;case v.AdjustBitrate:{const{kind:e,bitrate:s}=t.data;i.adjustBitrate(e,s)}break;case v.Publish:{const{url:e}=t.data;try{await i.publish(e)}catch(s){self.postMessage({type:y.Error,data:s.toJson()})}}break;case v.GetStats:self.postMessage({type:y.STATS,data:i.getStats()});break;case v.EncodeConfig:{i.setEncodeCapacity(t.data.cfg);break}case v.Download:{const e=i.down();self.postMessage({type:y.Flvfile,buffer:e},[e.buffer])}break;case v.UnPublish:{i.destroy();break}}})}})();\n', li = typeof self < "u" && self.Blob && new Blob([_s], { type: "text/javascript;charset=utf-8" });
|
|
5204
|
+
function Xu(r) {
|
|
5198
5205
|
let e;
|
|
5199
5206
|
try {
|
|
5200
5207
|
if (e = li && (self.URL || self.webkitURL).createObjectURL(li), !e) throw "";
|
|
@@ -5206,7 +5213,7 @@ function Hu(r) {
|
|
|
5206
5213
|
}), t;
|
|
5207
5214
|
} catch {
|
|
5208
5215
|
return new Worker(
|
|
5209
|
-
"data:text/javascript;charset=utf-8," + encodeURIComponent(
|
|
5216
|
+
"data:text/javascript;charset=utf-8," + encodeURIComponent(_s),
|
|
5210
5217
|
{
|
|
5211
5218
|
name: r == null ? void 0 : r.name
|
|
5212
5219
|
}
|
|
@@ -5220,10 +5227,10 @@ try {
|
|
|
5220
5227
|
} catch {
|
|
5221
5228
|
}
|
|
5222
5229
|
const Le = new ee("Bridge");
|
|
5223
|
-
class
|
|
5230
|
+
class gs extends Hu {
|
|
5224
5231
|
// static version = __VERSION__
|
|
5225
5232
|
constructor() {
|
|
5226
|
-
super(), this._worker = null, this._audioMsTrack = null, this._videoMsTrack = null, this._capture = new
|
|
5233
|
+
super(), this._worker = null, this._audioMsTrack = null, this._videoMsTrack = null, this._capture = new Wu(this);
|
|
5227
5234
|
}
|
|
5228
5235
|
static isSupported() {
|
|
5229
5236
|
return typeof WebTransport < "u" && typeof MediaStreamTrackProcessor < "u" && typeof MediaStreamTrackGenerator < "u" && typeof VideoEncoder < "u";
|
|
@@ -5250,9 +5257,9 @@ class _s extends ju {
|
|
|
5250
5257
|
}
|
|
5251
5258
|
};
|
|
5252
5259
|
try {
|
|
5253
|
-
this._worker = new
|
|
5260
|
+
this._worker = new Xu();
|
|
5254
5261
|
} catch (o) {
|
|
5255
|
-
t(pi(
|
|
5262
|
+
t(pi(wt.RTMP_INIT_FAIL, o.message));
|
|
5256
5263
|
}
|
|
5257
5264
|
return (n = this._worker) == null || n.postMessage({
|
|
5258
5265
|
type: N.Init,
|
|
@@ -5275,7 +5282,7 @@ class _s extends ju {
|
|
|
5275
5282
|
Le.table(i.data.data), this.emit(se.OnError, i.data.data);
|
|
5276
5283
|
break;
|
|
5277
5284
|
case re.Flvfile:
|
|
5278
|
-
|
|
5285
|
+
Ku(i.data.buffer);
|
|
5279
5286
|
break;
|
|
5280
5287
|
case re.FirstFramePushed:
|
|
5281
5288
|
this.emit(se.OnFirstFramePushed);
|
|
@@ -5287,7 +5294,7 @@ class _s extends ju {
|
|
|
5287
5294
|
}), (t = this._worker) == null || t.addEventListener("error", (i) => {
|
|
5288
5295
|
this.emit(
|
|
5289
5296
|
se.OnError,
|
|
5290
|
-
pi(
|
|
5297
|
+
pi(wt.WORKER_ERROR, i.message)
|
|
5291
5298
|
);
|
|
5292
5299
|
});
|
|
5293
5300
|
}
|
|
@@ -5393,14 +5400,14 @@ class _s extends ju {
|
|
|
5393
5400
|
});
|
|
5394
5401
|
}
|
|
5395
5402
|
}
|
|
5396
|
-
function
|
|
5403
|
+
function Ku(r) {
|
|
5397
5404
|
const e = document.createElement("a");
|
|
5398
5405
|
e.href = URL.createObjectURL(new Blob([r])), e.download = Date.now() + ".flv", e.click();
|
|
5399
5406
|
}
|
|
5400
5407
|
const mi = new ce("RTMPConnect");
|
|
5401
|
-
class
|
|
5408
|
+
class Ju {
|
|
5402
5409
|
constructor(e, t, i, s) {
|
|
5403
|
-
this._opts = void 0, this._isPushing = !1, this._url = e, this._opts = t, this._onError = i, this._OnSuccess = s, this._rtmp = new
|
|
5410
|
+
this._opts = void 0, this._isPushing = !1, this._url = e, this._opts = t, this._onError = i, this._OnSuccess = s, this._rtmp = new gs(), this._bindEvents();
|
|
5404
5411
|
}
|
|
5405
5412
|
get isPushing() {
|
|
5406
5413
|
return this._isPushing;
|
|
@@ -5437,8 +5444,8 @@ class Wu {
|
|
|
5437
5444
|
mi.warn("unpublish"), this._rtmp.unpublish(), this._isPushing = !1;
|
|
5438
5445
|
}
|
|
5439
5446
|
}
|
|
5440
|
-
const
|
|
5441
|
-
class
|
|
5447
|
+
const Yu = new ce("PushController");
|
|
5448
|
+
class Zu extends ls {
|
|
5442
5449
|
constructor(e, {
|
|
5443
5450
|
config: t,
|
|
5444
5451
|
streamConsumeController: i
|
|
@@ -5522,7 +5529,7 @@ class Ku extends ps {
|
|
|
5522
5529
|
if (!i && !s)
|
|
5523
5530
|
return;
|
|
5524
5531
|
let n;
|
|
5525
|
-
this._pushMode === "rtm" ? n = new
|
|
5532
|
+
this._pushMode === "rtm" ? n = new ju(e, this._pushConfig, this._OnRtcStateChange) : n = new Ju(
|
|
5526
5533
|
e,
|
|
5527
5534
|
this._pushConfig,
|
|
5528
5535
|
this._OnRTMPError,
|
|
@@ -5535,7 +5542,7 @@ class Ku extends ps {
|
|
|
5535
5542
|
t
|
|
5536
5543
|
);
|
|
5537
5544
|
} catch (a) {
|
|
5538
|
-
|
|
5545
|
+
Yu.groupEnd(), n.unpublish();
|
|
5539
5546
|
const o = new Te(
|
|
5540
5547
|
V.PUBLISH_FAILED,
|
|
5541
5548
|
a.message,
|
|
@@ -5596,14 +5603,14 @@ class Ku extends ps {
|
|
|
5596
5603
|
return this._pushMode;
|
|
5597
5604
|
}
|
|
5598
5605
|
}
|
|
5599
|
-
class
|
|
5606
|
+
class Qu extends te {
|
|
5600
5607
|
constructor(e) {
|
|
5601
|
-
super(), this._previewConsumer = new
|
|
5608
|
+
super(), this._previewConsumer = new Mu(
|
|
5602
5609
|
e.getComposedStream(),
|
|
5603
5610
|
{
|
|
5604
5611
|
streamConsumeController: this
|
|
5605
5612
|
}
|
|
5606
|
-
), this._pushConsumer = new
|
|
5613
|
+
), this._pushConsumer = new Zu(
|
|
5607
5614
|
e.getComposedStream(),
|
|
5608
5615
|
{
|
|
5609
5616
|
streamConsumeController: this
|
|
@@ -5650,13 +5657,13 @@ class Ju extends te {
|
|
|
5650
5657
|
await this._pushConsumer.destroy(), this._previewConsumer.destroy();
|
|
5651
5658
|
}
|
|
5652
5659
|
}
|
|
5653
|
-
const
|
|
5660
|
+
const eh = () => typeof window > "u", z = {}, ze = async (r) => {
|
|
5654
5661
|
const e = new RTCPeerConnection({ sdpSemantics: "unified-plan" });
|
|
5655
5662
|
e.addTransceiver("video", { direction: r });
|
|
5656
5663
|
const t = await e.createOffer();
|
|
5657
5664
|
return e.close(), t.sdp.toLowerCase();
|
|
5658
5665
|
};
|
|
5659
|
-
function
|
|
5666
|
+
function vs(r) {
|
|
5660
5667
|
const e = r.split(`
|
|
5661
5668
|
`);
|
|
5662
5669
|
let t = !1;
|
|
@@ -5689,30 +5696,30 @@ function gs(r) {
|
|
|
5689
5696
|
}
|
|
5690
5697
|
return !1;
|
|
5691
5698
|
}
|
|
5692
|
-
const
|
|
5699
|
+
const th = async () => {
|
|
5693
5700
|
let r = await ze("sendonly");
|
|
5694
|
-
return navigator.userAgent.includes("VivoBrowser") && (r = await ze("sendonly")), z.h264encode =
|
|
5695
|
-
},
|
|
5701
|
+
return navigator.userAgent.includes("VivoBrowser") && (r = await ze("sendonly")), z.h264encode = vs(r), z.vp8encode = r.indexOf("vp8") > -1, z;
|
|
5702
|
+
}, rh = async () => {
|
|
5696
5703
|
let r = await ze("recvonly");
|
|
5697
|
-
return navigator.userAgent.includes("VivoBrowser") && (r = await ze("recvonly")), z.h264decode =
|
|
5698
|
-
},
|
|
5704
|
+
return navigator.userAgent.includes("VivoBrowser") && (r = await ze("recvonly")), z.h264decode = vs(r), z.vp8decode = r.indexOf("vp8") > -1, z;
|
|
5705
|
+
}, ih = async () => {
|
|
5699
5706
|
if (typeof z.h264encode > "u")
|
|
5700
5707
|
try {
|
|
5701
|
-
await
|
|
5708
|
+
await th();
|
|
5702
5709
|
} catch {
|
|
5703
5710
|
return !1;
|
|
5704
5711
|
}
|
|
5705
5712
|
return z.h264encode || !1;
|
|
5706
|
-
},
|
|
5713
|
+
}, sh = async () => {
|
|
5707
5714
|
if (typeof z.h264decode > "u")
|
|
5708
5715
|
try {
|
|
5709
|
-
await
|
|
5716
|
+
await rh();
|
|
5710
5717
|
} catch {
|
|
5711
5718
|
return !1;
|
|
5712
5719
|
}
|
|
5713
5720
|
return z.h264decode || !1;
|
|
5714
5721
|
};
|
|
5715
|
-
class
|
|
5722
|
+
class nh {
|
|
5716
5723
|
/** {zh}
|
|
5717
5724
|
* @brief 构造函数
|
|
5718
5725
|
* @hidden
|
|
@@ -5736,8 +5743,8 @@ class rh {
|
|
|
5736
5743
|
};
|
|
5737
5744
|
}
|
|
5738
5745
|
}
|
|
5739
|
-
const
|
|
5740
|
-
let
|
|
5746
|
+
const oh = new nh();
|
|
5747
|
+
let Cs = !0, ys = !0;
|
|
5741
5748
|
function Fe(r, e, t) {
|
|
5742
5749
|
const i = r.match(e);
|
|
5743
5750
|
return i && i.length >= t && parseInt(i[t], 10);
|
|
@@ -5749,9 +5756,9 @@ function de(r, e, t) {
|
|
|
5749
5756
|
i.addEventListener = function(a, o) {
|
|
5750
5757
|
if (a !== e)
|
|
5751
5758
|
return s.apply(this, arguments);
|
|
5752
|
-
const u = (
|
|
5753
|
-
const
|
|
5754
|
-
|
|
5759
|
+
const u = (d) => {
|
|
5760
|
+
const c = t(d);
|
|
5761
|
+
c && (o.handleEvent ? o.handleEvent(c) : o(c));
|
|
5755
5762
|
};
|
|
5756
5763
|
return this._eventMap = this._eventMap || {}, this._eventMap[e] || (this._eventMap[e] = /* @__PURE__ */ new Map()), this._eventMap[e].set(o, u), s.apply(this, [
|
|
5757
5764
|
a,
|
|
@@ -5786,23 +5793,23 @@ function de(r, e, t) {
|
|
|
5786
5793
|
configurable: !0
|
|
5787
5794
|
});
|
|
5788
5795
|
}
|
|
5789
|
-
function
|
|
5790
|
-
return typeof r != "boolean" ? new Error("Argument type: " + typeof r + ". Please use a boolean.") : (
|
|
5796
|
+
function ah(r) {
|
|
5797
|
+
return typeof r != "boolean" ? new Error("Argument type: " + typeof r + ". Please use a boolean.") : (Cs = r, r ? "adapter.js logging disabled" : "adapter.js logging enabled");
|
|
5791
5798
|
}
|
|
5792
|
-
function
|
|
5793
|
-
return typeof r != "boolean" ? new Error("Argument type: " + typeof r + ". Please use a boolean.") : (
|
|
5799
|
+
function ch(r) {
|
|
5800
|
+
return typeof r != "boolean" ? new Error("Argument type: " + typeof r + ". Please use a boolean.") : (ys = !r, "adapter.js deprecation warnings " + (r ? "disabled" : "enabled"));
|
|
5794
5801
|
}
|
|
5795
|
-
function
|
|
5802
|
+
function Ss() {
|
|
5796
5803
|
if (typeof window == "object") {
|
|
5797
|
-
if (
|
|
5804
|
+
if (Cs)
|
|
5798
5805
|
return;
|
|
5799
5806
|
typeof console < "u" && typeof console.log == "function" && console.log.apply(console, arguments);
|
|
5800
5807
|
}
|
|
5801
5808
|
}
|
|
5802
5809
|
function Zt(r, e) {
|
|
5803
|
-
|
|
5810
|
+
ys && console.warn(r + " is deprecated, please use " + e + " instead.");
|
|
5804
5811
|
}
|
|
5805
|
-
function
|
|
5812
|
+
function dh(r) {
|
|
5806
5813
|
const e = { browser: null, version: null };
|
|
5807
5814
|
if (typeof r > "u" || !r.navigator || !r.navigator.userAgent)
|
|
5808
5815
|
return e.browser = "Not a browser.", e;
|
|
@@ -5837,16 +5844,16 @@ function oh(r) {
|
|
|
5837
5844
|
function fi(r) {
|
|
5838
5845
|
return Object.prototype.toString.call(r) === "[object Object]";
|
|
5839
5846
|
}
|
|
5840
|
-
function
|
|
5847
|
+
function Ts(r) {
|
|
5841
5848
|
return fi(r) ? Object.keys(r).reduce(function(e, t) {
|
|
5842
|
-
const i = fi(r[t]), s = i ?
|
|
5849
|
+
const i = fi(r[t]), s = i ? Ts(r[t]) : r[t], n = i && !Object.keys(s).length;
|
|
5843
5850
|
return s === void 0 || n ? e : Object.assign(e, { [t]: s });
|
|
5844
5851
|
}, {}) : r;
|
|
5845
5852
|
}
|
|
5846
|
-
function
|
|
5853
|
+
function Ot(r, e, t) {
|
|
5847
5854
|
!e || t.has(e.id) || (t.set(e.id, e), Object.keys(e).forEach((i) => {
|
|
5848
|
-
i.endsWith("Id") ?
|
|
5849
|
-
|
|
5855
|
+
i.endsWith("Id") ? Ot(r, r.get(e[i]), t) : i.endsWith("Ids") && e[i].forEach((s) => {
|
|
5856
|
+
Ot(r, r.get(s), t);
|
|
5850
5857
|
});
|
|
5851
5858
|
}));
|
|
5852
5859
|
}
|
|
@@ -5859,12 +5866,12 @@ function _i(r, e, t) {
|
|
|
5859
5866
|
a.type === "track" && a.trackIdentifier === e.id && n.push(a);
|
|
5860
5867
|
}), n.forEach((a) => {
|
|
5861
5868
|
r.forEach((o) => {
|
|
5862
|
-
o.type === i && o.trackId === a.id &&
|
|
5869
|
+
o.type === i && o.trackId === a.id && Ot(r, o, s);
|
|
5863
5870
|
});
|
|
5864
5871
|
}), s;
|
|
5865
5872
|
}
|
|
5866
|
-
const gi =
|
|
5867
|
-
function
|
|
5873
|
+
const gi = Ss;
|
|
5874
|
+
function Es(r, e) {
|
|
5868
5875
|
const t = r && r.navigator;
|
|
5869
5876
|
if (!t.mediaDevices)
|
|
5870
5877
|
return;
|
|
@@ -5872,44 +5879,44 @@ function Ts(r, e) {
|
|
|
5872
5879
|
if (typeof o != "object" || o.mandatory || o.optional)
|
|
5873
5880
|
return o;
|
|
5874
5881
|
const u = {};
|
|
5875
|
-
return Object.keys(o).forEach((
|
|
5876
|
-
if (
|
|
5882
|
+
return Object.keys(o).forEach((d) => {
|
|
5883
|
+
if (d === "require" || d === "advanced" || d === "mediaSource")
|
|
5877
5884
|
return;
|
|
5878
|
-
const
|
|
5879
|
-
|
|
5885
|
+
const c = typeof o[d] == "object" ? o[d] : { ideal: o[d] };
|
|
5886
|
+
c.exact !== void 0 && typeof c.exact == "number" && (c.min = c.max = c.exact);
|
|
5880
5887
|
const h = function(p, l) {
|
|
5881
5888
|
return p ? p + l.charAt(0).toUpperCase() + l.slice(1) : l === "deviceId" ? "sourceId" : l;
|
|
5882
5889
|
};
|
|
5883
|
-
if (
|
|
5890
|
+
if (c.ideal !== void 0) {
|
|
5884
5891
|
u.optional = u.optional || [];
|
|
5885
5892
|
let p = {};
|
|
5886
|
-
typeof
|
|
5893
|
+
typeof c.ideal == "number" ? (p[h("min", d)] = c.ideal, u.optional.push(p), p = {}, p[h("max", d)] = c.ideal, u.optional.push(p)) : (p[h("", d)] = c.ideal, u.optional.push(p));
|
|
5887
5894
|
}
|
|
5888
|
-
|
|
5889
|
-
|
|
5895
|
+
c.exact !== void 0 && typeof c.exact != "number" ? (u.mandatory = u.mandatory || {}, u.mandatory[h("", d)] = c.exact) : ["min", "max"].forEach((p) => {
|
|
5896
|
+
c[p] !== void 0 && (u.mandatory = u.mandatory || {}, u.mandatory[h(p, d)] = c[p]);
|
|
5890
5897
|
});
|
|
5891
5898
|
}), o.advanced && (u.optional = (u.optional || []).concat(o.advanced)), u;
|
|
5892
5899
|
}, s = function(o, u) {
|
|
5893
5900
|
if (e.version >= 61)
|
|
5894
5901
|
return u(o);
|
|
5895
5902
|
if (o = JSON.parse(JSON.stringify(o)), o && typeof o.audio == "object") {
|
|
5896
|
-
const
|
|
5897
|
-
h in
|
|
5903
|
+
const d = function(c, h, p) {
|
|
5904
|
+
h in c && !(p in c) && (c[p] = c[h], delete c[h]);
|
|
5898
5905
|
};
|
|
5899
|
-
o = JSON.parse(JSON.stringify(o)),
|
|
5906
|
+
o = JSON.parse(JSON.stringify(o)), d(o.audio, "autoGainControl", "googAutoGainControl"), d(o.audio, "noiseSuppression", "googNoiseSuppression"), o.audio = i(o.audio);
|
|
5900
5907
|
}
|
|
5901
5908
|
if (o && typeof o.video == "object") {
|
|
5902
|
-
let
|
|
5903
|
-
|
|
5904
|
-
const
|
|
5905
|
-
if (
|
|
5909
|
+
let d = o.video.facingMode;
|
|
5910
|
+
d = d && (typeof d == "object" ? d : { ideal: d });
|
|
5911
|
+
const c = e.version < 66;
|
|
5912
|
+
if (d && (d.exact === "user" || d.exact === "environment" || d.ideal === "user" || d.ideal === "environment") && !(t.mediaDevices.getSupportedConstraints && t.mediaDevices.getSupportedConstraints().facingMode && !c)) {
|
|
5906
5913
|
delete o.video.facingMode;
|
|
5907
5914
|
let h;
|
|
5908
|
-
if (
|
|
5915
|
+
if (d.exact === "environment" || d.ideal === "environment" ? h = ["back", "rear"] : (d.exact === "user" || d.ideal === "user") && (h = ["front"]), h)
|
|
5909
5916
|
return t.mediaDevices.enumerateDevices().then((p) => {
|
|
5910
5917
|
p = p.filter((f) => f.kind === "videoinput");
|
|
5911
5918
|
let l = p.find((f) => h.some((g) => f.label.toLowerCase().includes(g)));
|
|
5912
|
-
return !l && p.length && h.includes("back") && (l = p[p.length - 1]), l && (o.video.deviceId =
|
|
5919
|
+
return !l && p.length && h.includes("back") && (l = p[p.length - 1]), l && (o.video.deviceId = d.exact ? { exact: l.deviceId } : { ideal: l.deviceId }), o.video = i(o.video), gi("chrome: " + JSON.stringify(o)), u(o);
|
|
5913
5920
|
});
|
|
5914
5921
|
}
|
|
5915
5922
|
o.video = i(o.video);
|
|
@@ -5936,30 +5943,30 @@ function Ts(r, e) {
|
|
|
5936
5943
|
return this.name + (this.message && ": ") + this.message;
|
|
5937
5944
|
}
|
|
5938
5945
|
};
|
|
5939
|
-
}, a = function(o, u,
|
|
5940
|
-
s(o, (
|
|
5941
|
-
t.webkitGetUserMedia(
|
|
5942
|
-
|
|
5946
|
+
}, a = function(o, u, d) {
|
|
5947
|
+
s(o, (c) => {
|
|
5948
|
+
t.webkitGetUserMedia(c, u, (h) => {
|
|
5949
|
+
d && d(n(h));
|
|
5943
5950
|
});
|
|
5944
5951
|
});
|
|
5945
5952
|
};
|
|
5946
5953
|
if (t.getUserMedia = a.bind(t), t.mediaDevices.getUserMedia) {
|
|
5947
5954
|
const o = t.mediaDevices.getUserMedia.bind(t.mediaDevices);
|
|
5948
5955
|
t.mediaDevices.getUserMedia = function(u) {
|
|
5949
|
-
return s(u, (
|
|
5950
|
-
if (
|
|
5951
|
-
throw
|
|
5956
|
+
return s(u, (d) => o(d).then((c) => {
|
|
5957
|
+
if (d.audio && !c.getAudioTracks().length || d.video && !c.getVideoTracks().length)
|
|
5958
|
+
throw c.getTracks().forEach((h) => {
|
|
5952
5959
|
h.stop();
|
|
5953
5960
|
}), new DOMException("", "NotFoundError");
|
|
5954
|
-
return
|
|
5955
|
-
}, (
|
|
5961
|
+
return c;
|
|
5962
|
+
}, (c) => Promise.reject(n(c))));
|
|
5956
5963
|
};
|
|
5957
5964
|
}
|
|
5958
5965
|
}
|
|
5959
|
-
function
|
|
5966
|
+
function bs(r) {
|
|
5960
5967
|
r.MediaStream = r.MediaStream || r.webkitMediaStream;
|
|
5961
5968
|
}
|
|
5962
|
-
function
|
|
5969
|
+
function ks(r) {
|
|
5963
5970
|
if (typeof r == "object" && r.RTCPeerConnection && !("ontrack" in r.RTCPeerConnection.prototype)) {
|
|
5964
5971
|
Object.defineProperty(r.RTCPeerConnection.prototype, "ontrack", {
|
|
5965
5972
|
get() {
|
|
@@ -5994,7 +6001,7 @@ function bs(r) {
|
|
|
5994
6001
|
{ value: { receiver: e.receiver } }
|
|
5995
6002
|
), e));
|
|
5996
6003
|
}
|
|
5997
|
-
function
|
|
6004
|
+
function Ps(r) {
|
|
5998
6005
|
if (typeof r == "object" && r.RTCPeerConnection && !("getSenders" in r.RTCPeerConnection.prototype) && "createDTMFSender" in r.RTCPeerConnection.prototype) {
|
|
5999
6006
|
const e = function(s, n) {
|
|
6000
6007
|
return {
|
|
@@ -6011,8 +6018,8 @@ function ks(r) {
|
|
|
6011
6018
|
};
|
|
6012
6019
|
const s = r.RTCPeerConnection.prototype.addTrack;
|
|
6013
6020
|
r.RTCPeerConnection.prototype.addTrack = function(o, u) {
|
|
6014
|
-
let
|
|
6015
|
-
return
|
|
6021
|
+
let d = s.apply(this, arguments);
|
|
6022
|
+
return d || (d = e(this, o), this._senders.push(d)), d;
|
|
6016
6023
|
};
|
|
6017
6024
|
const n = r.RTCPeerConnection.prototype.removeTrack;
|
|
6018
6025
|
r.RTCPeerConnection.prototype.removeTrack = function(o) {
|
|
@@ -6046,7 +6053,7 @@ function ks(r) {
|
|
|
6046
6053
|
});
|
|
6047
6054
|
}
|
|
6048
6055
|
}
|
|
6049
|
-
function
|
|
6056
|
+
function xs(r) {
|
|
6050
6057
|
if (!(typeof r == "object" && r.RTCPeerConnection && r.RTCRtpSender && r.RTCRtpReceiver))
|
|
6051
6058
|
return;
|
|
6052
6059
|
if (!("getStats" in r.RTCRtpSender.prototype)) {
|
|
@@ -6100,7 +6107,7 @@ function Ps(r) {
|
|
|
6100
6107
|
return e.apply(this, arguments);
|
|
6101
6108
|
};
|
|
6102
6109
|
}
|
|
6103
|
-
function
|
|
6110
|
+
function Rs(r) {
|
|
6104
6111
|
r.RTCPeerConnection.prototype.getLocalStreams = function() {
|
|
6105
6112
|
return this._shimmedLocalStreams = this._shimmedLocalStreams || {}, Object.keys(this._shimmedLocalStreams).map((a) => this._shimmedLocalStreams[a][0]);
|
|
6106
6113
|
};
|
|
@@ -6114,8 +6121,8 @@ function xs(r) {
|
|
|
6114
6121
|
};
|
|
6115
6122
|
const t = r.RTCPeerConnection.prototype.addStream;
|
|
6116
6123
|
r.RTCPeerConnection.prototype.addStream = function(a) {
|
|
6117
|
-
this._shimmedLocalStreams = this._shimmedLocalStreams || {}, a.getTracks().forEach((
|
|
6118
|
-
if (this.getSenders().find((h) => h.track ===
|
|
6124
|
+
this._shimmedLocalStreams = this._shimmedLocalStreams || {}, a.getTracks().forEach((d) => {
|
|
6125
|
+
if (this.getSenders().find((h) => h.track === d))
|
|
6119
6126
|
throw new DOMException(
|
|
6120
6127
|
"Track already exists.",
|
|
6121
6128
|
"InvalidAccessError"
|
|
@@ -6123,7 +6130,7 @@ function xs(r) {
|
|
|
6123
6130
|
});
|
|
6124
6131
|
const o = this.getSenders();
|
|
6125
6132
|
t.apply(this, arguments);
|
|
6126
|
-
const u = this.getSenders().filter((
|
|
6133
|
+
const u = this.getSenders().filter((d) => o.indexOf(d) === -1);
|
|
6127
6134
|
this._shimmedLocalStreams[a.id] = [a].concat(u);
|
|
6128
6135
|
};
|
|
6129
6136
|
const i = r.RTCPeerConnection.prototype.removeStream;
|
|
@@ -6138,46 +6145,46 @@ function xs(r) {
|
|
|
6138
6145
|
}), s.apply(this, arguments);
|
|
6139
6146
|
};
|
|
6140
6147
|
}
|
|
6141
|
-
function
|
|
6148
|
+
function As(r, e) {
|
|
6142
6149
|
if (!r.RTCPeerConnection)
|
|
6143
6150
|
return;
|
|
6144
6151
|
if (r.RTCPeerConnection.prototype.addTrack && e.version >= 65)
|
|
6145
|
-
return
|
|
6152
|
+
return Rs(r);
|
|
6146
6153
|
const t = r.RTCPeerConnection.prototype.getLocalStreams;
|
|
6147
6154
|
r.RTCPeerConnection.prototype.getLocalStreams = function() {
|
|
6148
|
-
const
|
|
6149
|
-
return this._reverseStreams = this._reverseStreams || {},
|
|
6155
|
+
const c = t.apply(this);
|
|
6156
|
+
return this._reverseStreams = this._reverseStreams || {}, c.map((h) => this._reverseStreams[h.id]);
|
|
6150
6157
|
};
|
|
6151
6158
|
const i = r.RTCPeerConnection.prototype.addStream;
|
|
6152
|
-
r.RTCPeerConnection.prototype.addStream = function(
|
|
6153
|
-
if (this._streams = this._streams || {}, this._reverseStreams = this._reverseStreams || {},
|
|
6159
|
+
r.RTCPeerConnection.prototype.addStream = function(c) {
|
|
6160
|
+
if (this._streams = this._streams || {}, this._reverseStreams = this._reverseStreams || {}, c.getTracks().forEach((h) => {
|
|
6154
6161
|
if (this.getSenders().find((l) => l.track === h))
|
|
6155
6162
|
throw new DOMException(
|
|
6156
6163
|
"Track already exists.",
|
|
6157
6164
|
"InvalidAccessError"
|
|
6158
6165
|
);
|
|
6159
|
-
}), !this._reverseStreams[
|
|
6160
|
-
const h = new r.MediaStream(
|
|
6161
|
-
this._streams[
|
|
6166
|
+
}), !this._reverseStreams[c.id]) {
|
|
6167
|
+
const h = new r.MediaStream(c.getTracks());
|
|
6168
|
+
this._streams[c.id] = h, this._reverseStreams[h.id] = c, c = h;
|
|
6162
6169
|
}
|
|
6163
|
-
i.apply(this, [
|
|
6170
|
+
i.apply(this, [c]);
|
|
6164
6171
|
};
|
|
6165
6172
|
const s = r.RTCPeerConnection.prototype.removeStream;
|
|
6166
|
-
r.RTCPeerConnection.prototype.removeStream = function(
|
|
6167
|
-
this._streams = this._streams || {}, this._reverseStreams = this._reverseStreams || {}, s.apply(this, [this._streams[
|
|
6168
|
-
}, r.RTCPeerConnection.prototype.addTrack = function(
|
|
6173
|
+
r.RTCPeerConnection.prototype.removeStream = function(c) {
|
|
6174
|
+
this._streams = this._streams || {}, this._reverseStreams = this._reverseStreams || {}, s.apply(this, [this._streams[c.id] || c]), delete this._reverseStreams[this._streams[c.id] ? this._streams[c.id].id : c.id], delete this._streams[c.id];
|
|
6175
|
+
}, r.RTCPeerConnection.prototype.addTrack = function(c, h) {
|
|
6169
6176
|
if (this.signalingState === "closed")
|
|
6170
6177
|
throw new DOMException(
|
|
6171
6178
|
"The RTCPeerConnection's signalingState is 'closed'.",
|
|
6172
6179
|
"InvalidStateError"
|
|
6173
6180
|
);
|
|
6174
6181
|
const p = [].slice.call(arguments, 1);
|
|
6175
|
-
if (p.length !== 1 || !p[0].getTracks().find((g) => g ===
|
|
6182
|
+
if (p.length !== 1 || !p[0].getTracks().find((g) => g === c))
|
|
6176
6183
|
throw new DOMException(
|
|
6177
6184
|
"The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.",
|
|
6178
6185
|
"NotSupportedError"
|
|
6179
6186
|
);
|
|
6180
|
-
if (this.getSenders().find((g) => g.track ===
|
|
6187
|
+
if (this.getSenders().find((g) => g.track === c))
|
|
6181
6188
|
throw new DOMException(
|
|
6182
6189
|
"Track already exists.",
|
|
6183
6190
|
"InvalidAccessError"
|
|
@@ -6185,45 +6192,45 @@ function Rs(r, e) {
|
|
|
6185
6192
|
this._streams = this._streams || {}, this._reverseStreams = this._reverseStreams || {};
|
|
6186
6193
|
const f = this._streams[h.id];
|
|
6187
6194
|
if (f)
|
|
6188
|
-
f.addTrack(
|
|
6195
|
+
f.addTrack(c), Promise.resolve().then(() => {
|
|
6189
6196
|
this.dispatchEvent(new Event("negotiationneeded"));
|
|
6190
6197
|
});
|
|
6191
6198
|
else {
|
|
6192
|
-
const g = new r.MediaStream([
|
|
6199
|
+
const g = new r.MediaStream([c]);
|
|
6193
6200
|
this._streams[h.id] = g, this._reverseStreams[g.id] = h, this.addStream(g);
|
|
6194
6201
|
}
|
|
6195
|
-
return this.getSenders().find((g) => g.track ===
|
|
6202
|
+
return this.getSenders().find((g) => g.track === c);
|
|
6196
6203
|
};
|
|
6197
|
-
function n(
|
|
6198
|
-
let h =
|
|
6199
|
-
return Object.keys(
|
|
6200
|
-
const l =
|
|
6204
|
+
function n(d, c) {
|
|
6205
|
+
let h = c.sdp;
|
|
6206
|
+
return Object.keys(d._reverseStreams || []).forEach((p) => {
|
|
6207
|
+
const l = d._reverseStreams[p], f = d._streams[l.id];
|
|
6201
6208
|
h = h.replace(
|
|
6202
6209
|
new RegExp(f.id, "g"),
|
|
6203
6210
|
l.id
|
|
6204
6211
|
);
|
|
6205
6212
|
}), new RTCSessionDescription({
|
|
6206
|
-
type:
|
|
6213
|
+
type: c.type,
|
|
6207
6214
|
sdp: h
|
|
6208
6215
|
});
|
|
6209
6216
|
}
|
|
6210
|
-
function a(
|
|
6211
|
-
let h =
|
|
6212
|
-
return Object.keys(
|
|
6213
|
-
const l =
|
|
6217
|
+
function a(d, c) {
|
|
6218
|
+
let h = c.sdp;
|
|
6219
|
+
return Object.keys(d._reverseStreams || []).forEach((p) => {
|
|
6220
|
+
const l = d._reverseStreams[p], f = d._streams[l.id];
|
|
6214
6221
|
h = h.replace(
|
|
6215
6222
|
new RegExp(l.id, "g"),
|
|
6216
6223
|
f.id
|
|
6217
6224
|
);
|
|
6218
6225
|
}), new RTCSessionDescription({
|
|
6219
|
-
type:
|
|
6226
|
+
type: c.type,
|
|
6220
6227
|
sdp: h
|
|
6221
6228
|
});
|
|
6222
6229
|
}
|
|
6223
|
-
["createOffer", "createAnswer"].forEach(function(
|
|
6224
|
-
const
|
|
6230
|
+
["createOffer", "createAnswer"].forEach(function(d) {
|
|
6231
|
+
const c = r.RTCPeerConnection.prototype[d], h = { [d]() {
|
|
6225
6232
|
const p = arguments;
|
|
6226
|
-
return arguments.length && typeof arguments[0] == "function" ?
|
|
6233
|
+
return arguments.length && typeof arguments[0] == "function" ? c.apply(this, [
|
|
6227
6234
|
(f) => {
|
|
6228
6235
|
const g = n(this, f);
|
|
6229
6236
|
p[0].apply(null, [g]);
|
|
@@ -6232,9 +6239,9 @@ function Rs(r, e) {
|
|
|
6232
6239
|
p[1] && p[1].apply(null, f);
|
|
6233
6240
|
},
|
|
6234
6241
|
arguments[2]
|
|
6235
|
-
]) :
|
|
6242
|
+
]) : c.apply(this, arguments).then((f) => n(this, f));
|
|
6236
6243
|
} };
|
|
6237
|
-
r.RTCPeerConnection.prototype[
|
|
6244
|
+
r.RTCPeerConnection.prototype[d] = h[d];
|
|
6238
6245
|
});
|
|
6239
6246
|
const o = r.RTCPeerConnection.prototype.setLocalDescription;
|
|
6240
6247
|
r.RTCPeerConnection.prototype.setLocalDescription = function() {
|
|
@@ -6249,19 +6256,19 @@ function Rs(r, e) {
|
|
|
6249
6256
|
"localDescription",
|
|
6250
6257
|
{
|
|
6251
6258
|
get() {
|
|
6252
|
-
const
|
|
6253
|
-
return
|
|
6259
|
+
const d = u.get.apply(this);
|
|
6260
|
+
return d.type === "" ? d : n(this, d);
|
|
6254
6261
|
}
|
|
6255
6262
|
}
|
|
6256
|
-
), r.RTCPeerConnection.prototype.removeTrack = function(
|
|
6263
|
+
), r.RTCPeerConnection.prototype.removeTrack = function(c) {
|
|
6257
6264
|
if (this.signalingState === "closed")
|
|
6258
6265
|
throw new DOMException(
|
|
6259
6266
|
"The RTCPeerConnection's signalingState is 'closed'.",
|
|
6260
6267
|
"InvalidStateError"
|
|
6261
6268
|
);
|
|
6262
|
-
if (!
|
|
6269
|
+
if (!c._pc)
|
|
6263
6270
|
throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.", "TypeError");
|
|
6264
|
-
if (!(
|
|
6271
|
+
if (!(c._pc === this))
|
|
6265
6272
|
throw new DOMException(
|
|
6266
6273
|
"Sender was not created by this connection.",
|
|
6267
6274
|
"InvalidAccessError"
|
|
@@ -6269,11 +6276,11 @@ function Rs(r, e) {
|
|
|
6269
6276
|
this._streams = this._streams || {};
|
|
6270
6277
|
let p;
|
|
6271
6278
|
Object.keys(this._streams).forEach((l) => {
|
|
6272
|
-
this._streams[l].getTracks().find((g) =>
|
|
6273
|
-
}), p && (p.getTracks().length === 1 ? this.removeStream(this._reverseStreams[p.id]) : p.removeTrack(
|
|
6279
|
+
this._streams[l].getTracks().find((g) => c.track === g) && (p = this._streams[l]);
|
|
6280
|
+
}), p && (p.getTracks().length === 1 ? this.removeStream(this._reverseStreams[p.id]) : p.removeTrack(c.track), this.dispatchEvent(new Event("negotiationneeded")));
|
|
6274
6281
|
};
|
|
6275
6282
|
}
|
|
6276
|
-
function
|
|
6283
|
+
function It(r, e) {
|
|
6277
6284
|
!r.RTCPeerConnection && r.webkitRTCPeerConnection && (r.RTCPeerConnection = r.webkitRTCPeerConnection), r.RTCPeerConnection && e.version < 53 && ["setLocalDescription", "setRemoteDescription", "addIceCandidate"].forEach(function(t) {
|
|
6278
6285
|
const i = r.RTCPeerConnection.prototype[t], s = { [t]() {
|
|
6279
6286
|
return arguments[0] = new (t === "addIceCandidate" ? r.RTCIceCandidate : r.RTCSessionDescription)(arguments[0]), i.apply(this, arguments);
|
|
@@ -6281,7 +6288,7 @@ function Ot(r, e) {
|
|
|
6281
6288
|
r.RTCPeerConnection.prototype[t] = s[t];
|
|
6282
6289
|
});
|
|
6283
6290
|
}
|
|
6284
|
-
function
|
|
6291
|
+
function ws(r, e) {
|
|
6285
6292
|
de(r, "negotiationneeded", (t) => {
|
|
6286
6293
|
const i = t.target;
|
|
6287
6294
|
if (!((e.version < 72 || i.getConfiguration && i.getConfiguration().sdpSemantics === "plan-b") && i.signalingState !== "stable"))
|
|
@@ -6290,17 +6297,17 @@ function As(r, e) {
|
|
|
6290
6297
|
}
|
|
6291
6298
|
const vi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
6292
6299
|
__proto__: null,
|
|
6293
|
-
fixNegotiationNeeded:
|
|
6294
|
-
shimAddTrackRemoveTrack:
|
|
6295
|
-
shimAddTrackRemoveTrackWithNative:
|
|
6296
|
-
shimGetSendersWithDtmf:
|
|
6297
|
-
shimGetUserMedia:
|
|
6298
|
-
shimMediaStream:
|
|
6299
|
-
shimOnTrack:
|
|
6300
|
-
shimPeerConnection:
|
|
6301
|
-
shimSenderReceiverGetStats:
|
|
6300
|
+
fixNegotiationNeeded: ws,
|
|
6301
|
+
shimAddTrackRemoveTrack: As,
|
|
6302
|
+
shimAddTrackRemoveTrackWithNative: Rs,
|
|
6303
|
+
shimGetSendersWithDtmf: Ps,
|
|
6304
|
+
shimGetUserMedia: Es,
|
|
6305
|
+
shimMediaStream: bs,
|
|
6306
|
+
shimOnTrack: ks,
|
|
6307
|
+
shimPeerConnection: It,
|
|
6308
|
+
shimSenderReceiverGetStats: xs
|
|
6302
6309
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
6303
|
-
function
|
|
6310
|
+
function Os(r, e) {
|
|
6304
6311
|
const t = r && r.navigator, i = r && r.MediaStreamTrack;
|
|
6305
6312
|
if (t.getUserMedia = function(s, n, a) {
|
|
6306
6313
|
Zt(
|
|
@@ -6328,7 +6335,7 @@ function ws(r, e) {
|
|
|
6328
6335
|
}
|
|
6329
6336
|
}
|
|
6330
6337
|
}
|
|
6331
|
-
function
|
|
6338
|
+
function uh(r, e) {
|
|
6332
6339
|
r.navigator.mediaDevices && "getDisplayMedia" in r.navigator.mediaDevices || r.navigator.mediaDevices && (r.navigator.mediaDevices.getDisplayMedia = function(i) {
|
|
6333
6340
|
if (!(i && i.video)) {
|
|
6334
6341
|
const s = new DOMException("getDisplayMedia without video constraints is undefined");
|
|
@@ -6337,14 +6344,14 @@ function ah(r, e) {
|
|
|
6337
6344
|
return i.video === !0 ? i.video = { mediaSource: e } : i.video.mediaSource = e, r.navigator.mediaDevices.getUserMedia(i);
|
|
6338
6345
|
});
|
|
6339
6346
|
}
|
|
6340
|
-
function
|
|
6347
|
+
function Is(r) {
|
|
6341
6348
|
typeof r == "object" && r.RTCTrackEvent && "receiver" in r.RTCTrackEvent.prototype && !("transceiver" in r.RTCTrackEvent.prototype) && Object.defineProperty(r.RTCTrackEvent.prototype, "transceiver", {
|
|
6342
6349
|
get() {
|
|
6343
6350
|
return { receiver: this.receiver };
|
|
6344
6351
|
}
|
|
6345
6352
|
});
|
|
6346
6353
|
}
|
|
6347
|
-
function
|
|
6354
|
+
function Mt(r, e) {
|
|
6348
6355
|
if (typeof r != "object" || !(r.RTCPeerConnection || r.mozRTCPeerConnection))
|
|
6349
6356
|
return;
|
|
6350
6357
|
!r.RTCPeerConnection && r.mozRTCPeerConnection && (r.RTCPeerConnection = r.mozRTCPeerConnection), e.version < 53 && ["setLocalDescription", "setRemoteDescription", "addIceCandidate"].forEach(function(s) {
|
|
@@ -6365,15 +6372,15 @@ function It(r, e) {
|
|
|
6365
6372
|
return i.apply(this, [n || null]).then((u) => {
|
|
6366
6373
|
if (e.version < 53 && !a)
|
|
6367
6374
|
try {
|
|
6368
|
-
u.forEach((
|
|
6369
|
-
|
|
6375
|
+
u.forEach((d) => {
|
|
6376
|
+
d.type = t[d.type] || d.type;
|
|
6370
6377
|
});
|
|
6371
|
-
} catch (
|
|
6372
|
-
if (
|
|
6373
|
-
throw
|
|
6374
|
-
u.forEach((
|
|
6375
|
-
u.set(h, Object.assign({},
|
|
6376
|
-
type: t[
|
|
6378
|
+
} catch (d) {
|
|
6379
|
+
if (d.name !== "TypeError")
|
|
6380
|
+
throw d;
|
|
6381
|
+
u.forEach((c, h) => {
|
|
6382
|
+
u.set(h, Object.assign({}, c, {
|
|
6383
|
+
type: t[c.type] || c.type
|
|
6377
6384
|
}));
|
|
6378
6385
|
});
|
|
6379
6386
|
}
|
|
@@ -6381,7 +6388,7 @@ function It(r, e) {
|
|
|
6381
6388
|
}).then(a, o);
|
|
6382
6389
|
};
|
|
6383
6390
|
}
|
|
6384
|
-
function
|
|
6391
|
+
function Ms(r) {
|
|
6385
6392
|
if (!(typeof r == "object" && r.RTCPeerConnection && r.RTCRtpSender) || r.RTCRtpSender && "getStats" in r.RTCRtpSender.prototype)
|
|
6386
6393
|
return;
|
|
6387
6394
|
const e = r.RTCPeerConnection.prototype.getSenders;
|
|
@@ -6397,7 +6404,7 @@ function Is(r) {
|
|
|
6397
6404
|
return this.track ? this._pc.getStats(this.track) : Promise.resolve(/* @__PURE__ */ new Map());
|
|
6398
6405
|
};
|
|
6399
6406
|
}
|
|
6400
|
-
function
|
|
6407
|
+
function Ds(r) {
|
|
6401
6408
|
if (!(typeof r == "object" && r.RTCPeerConnection && r.RTCRtpSender) || r.RTCRtpSender && "getStats" in r.RTCRtpReceiver.prototype)
|
|
6402
6409
|
return;
|
|
6403
6410
|
const e = r.RTCPeerConnection.prototype.getReceivers;
|
|
@@ -6408,17 +6415,17 @@ function Ms(r) {
|
|
|
6408
6415
|
return this._pc.getStats(this.track);
|
|
6409
6416
|
};
|
|
6410
6417
|
}
|
|
6411
|
-
function
|
|
6418
|
+
function Ls(r) {
|
|
6412
6419
|
!r.RTCPeerConnection || "removeStream" in r.RTCPeerConnection.prototype || (r.RTCPeerConnection.prototype.removeStream = function(t) {
|
|
6413
6420
|
Zt("removeStream", "removeTrack"), this.getSenders().forEach((i) => {
|
|
6414
6421
|
i.track && t.getTracks().includes(i.track) && this.removeTrack(i);
|
|
6415
6422
|
});
|
|
6416
6423
|
});
|
|
6417
6424
|
}
|
|
6418
|
-
function
|
|
6425
|
+
function Fs(r) {
|
|
6419
6426
|
r.DataChannel && !r.RTCDataChannel && (r.RTCDataChannel = r.DataChannel);
|
|
6420
6427
|
}
|
|
6421
|
-
function
|
|
6428
|
+
function Ns(r) {
|
|
6422
6429
|
if (!(typeof r == "object" && r.RTCPeerConnection))
|
|
6423
6430
|
return;
|
|
6424
6431
|
const e = r.RTCPeerConnection.prototype.addTransceiver;
|
|
@@ -6450,7 +6457,7 @@ function Fs(r) {
|
|
|
6450
6457
|
return n;
|
|
6451
6458
|
});
|
|
6452
6459
|
}
|
|
6453
|
-
function
|
|
6460
|
+
function Vs(r) {
|
|
6454
6461
|
if (!(typeof r == "object" && r.RTCRtpSender))
|
|
6455
6462
|
return;
|
|
6456
6463
|
const e = r.RTCRtpSender.prototype.getParameters;
|
|
@@ -6459,7 +6466,7 @@ function Ns(r) {
|
|
|
6459
6466
|
return "encodings" in i || (i.encodings = [].concat(this.sendEncodings || [{}])), i;
|
|
6460
6467
|
});
|
|
6461
6468
|
}
|
|
6462
|
-
function
|
|
6469
|
+
function Us(r) {
|
|
6463
6470
|
if (!(typeof r == "object" && r.RTCPeerConnection))
|
|
6464
6471
|
return;
|
|
6465
6472
|
const e = r.RTCPeerConnection.prototype.createOffer;
|
|
@@ -6469,7 +6476,7 @@ function Vs(r) {
|
|
|
6469
6476
|
}) : e.apply(this, arguments);
|
|
6470
6477
|
};
|
|
6471
6478
|
}
|
|
6472
|
-
function
|
|
6479
|
+
function $s(r) {
|
|
6473
6480
|
if (!(typeof r == "object" && r.RTCPeerConnection))
|
|
6474
6481
|
return;
|
|
6475
6482
|
const e = r.RTCPeerConnection.prototype.createAnswer;
|
|
@@ -6481,20 +6488,20 @@ function Us(r) {
|
|
|
6481
6488
|
}
|
|
6482
6489
|
const Ci = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
6483
6490
|
__proto__: null,
|
|
6484
|
-
shimAddTransceiver:
|
|
6485
|
-
shimCreateAnswer:
|
|
6486
|
-
shimCreateOffer:
|
|
6487
|
-
shimGetDisplayMedia:
|
|
6488
|
-
shimGetParameters:
|
|
6489
|
-
shimGetUserMedia:
|
|
6490
|
-
shimOnTrack:
|
|
6491
|
-
shimPeerConnection:
|
|
6492
|
-
shimRTCDataChannel:
|
|
6493
|
-
shimReceiverGetStats:
|
|
6494
|
-
shimRemoveStream:
|
|
6495
|
-
shimSenderGetStats:
|
|
6491
|
+
shimAddTransceiver: Ns,
|
|
6492
|
+
shimCreateAnswer: $s,
|
|
6493
|
+
shimCreateOffer: Us,
|
|
6494
|
+
shimGetDisplayMedia: uh,
|
|
6495
|
+
shimGetParameters: Vs,
|
|
6496
|
+
shimGetUserMedia: Os,
|
|
6497
|
+
shimOnTrack: Is,
|
|
6498
|
+
shimPeerConnection: Mt,
|
|
6499
|
+
shimRTCDataChannel: Fs,
|
|
6500
|
+
shimReceiverGetStats: Ds,
|
|
6501
|
+
shimRemoveStream: Ls,
|
|
6502
|
+
shimSenderGetStats: Ms
|
|
6496
6503
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
6497
|
-
function
|
|
6504
|
+
function Bs(r) {
|
|
6498
6505
|
if (!(typeof r != "object" || !r.RTCPeerConnection)) {
|
|
6499
6506
|
if ("getLocalStreams" in r.RTCPeerConnection.prototype || (r.RTCPeerConnection.prototype.getLocalStreams = function() {
|
|
6500
6507
|
return this._localStreams || (this._localStreams = []), this._localStreams;
|
|
@@ -6529,7 +6536,7 @@ function $s(r) {
|
|
|
6529
6536
|
});
|
|
6530
6537
|
}
|
|
6531
6538
|
}
|
|
6532
|
-
function
|
|
6539
|
+
function js(r) {
|
|
6533
6540
|
if (!(typeof r != "object" || !r.RTCPeerConnection) && ("getRemoteStreams" in r.RTCPeerConnection.prototype || (r.RTCPeerConnection.prototype.getRemoteStreams = function() {
|
|
6534
6541
|
return this._remoteStreams ? this._remoteStreams : [];
|
|
6535
6542
|
}), !("onaddstream" in r.RTCPeerConnection.prototype))) {
|
|
@@ -6564,47 +6571,47 @@ function Bs(r) {
|
|
|
6564
6571
|
};
|
|
6565
6572
|
}
|
|
6566
6573
|
}
|
|
6567
|
-
function
|
|
6574
|
+
function zs(r) {
|
|
6568
6575
|
if (typeof r != "object" || !r.RTCPeerConnection)
|
|
6569
6576
|
return;
|
|
6570
6577
|
const e = r.RTCPeerConnection.prototype, t = e.createOffer, i = e.createAnswer, s = e.setLocalDescription, n = e.setRemoteDescription, a = e.addIceCandidate;
|
|
6571
|
-
e.createOffer = function(
|
|
6578
|
+
e.createOffer = function(d, c) {
|
|
6572
6579
|
const h = arguments.length >= 2 ? arguments[2] : arguments[0], p = t.apply(this, [h]);
|
|
6573
|
-
return
|
|
6574
|
-
}, e.createAnswer = function(
|
|
6580
|
+
return c ? (p.then(d, c), Promise.resolve()) : p;
|
|
6581
|
+
}, e.createAnswer = function(d, c) {
|
|
6575
6582
|
const h = arguments.length >= 2 ? arguments[2] : arguments[0], p = i.apply(this, [h]);
|
|
6576
|
-
return
|
|
6583
|
+
return c ? (p.then(d, c), Promise.resolve()) : p;
|
|
6577
6584
|
};
|
|
6578
|
-
let o = function(u,
|
|
6585
|
+
let o = function(u, d, c) {
|
|
6579
6586
|
const h = s.apply(this, [u]);
|
|
6580
|
-
return
|
|
6587
|
+
return c ? (h.then(d, c), Promise.resolve()) : h;
|
|
6581
6588
|
};
|
|
6582
|
-
e.setLocalDescription = o, o = function(u,
|
|
6589
|
+
e.setLocalDescription = o, o = function(u, d, c) {
|
|
6583
6590
|
const h = n.apply(this, [u]);
|
|
6584
|
-
return
|
|
6585
|
-
}, e.setRemoteDescription = o, o = function(u,
|
|
6591
|
+
return c ? (h.then(d, c), Promise.resolve()) : h;
|
|
6592
|
+
}, e.setRemoteDescription = o, o = function(u, d, c) {
|
|
6586
6593
|
const h = a.apply(this, [u]);
|
|
6587
|
-
return
|
|
6594
|
+
return c ? (h.then(d, c), Promise.resolve()) : h;
|
|
6588
6595
|
}, e.addIceCandidate = o;
|
|
6589
6596
|
}
|
|
6590
|
-
function
|
|
6597
|
+
function Gs(r) {
|
|
6591
6598
|
const e = r && r.navigator;
|
|
6592
6599
|
if (e.mediaDevices && e.mediaDevices.getUserMedia) {
|
|
6593
6600
|
const t = e.mediaDevices, i = t.getUserMedia.bind(t);
|
|
6594
|
-
e.mediaDevices.getUserMedia = (s) => i(
|
|
6601
|
+
e.mediaDevices.getUserMedia = (s) => i(Hs(s));
|
|
6595
6602
|
}
|
|
6596
6603
|
!e.getUserMedia && e.mediaDevices && e.mediaDevices.getUserMedia && (e.getUserMedia = (function(i, s, n) {
|
|
6597
6604
|
e.mediaDevices.getUserMedia(i).then(s, n);
|
|
6598
6605
|
}).bind(e));
|
|
6599
6606
|
}
|
|
6600
|
-
function
|
|
6607
|
+
function Hs(r) {
|
|
6601
6608
|
return r && r.video !== void 0 ? Object.assign(
|
|
6602
6609
|
{},
|
|
6603
6610
|
r,
|
|
6604
|
-
{ video:
|
|
6611
|
+
{ video: Ts(r.video) }
|
|
6605
6612
|
) : r;
|
|
6606
6613
|
}
|
|
6607
|
-
function
|
|
6614
|
+
function qs(r) {
|
|
6608
6615
|
if (!r.RTCPeerConnection)
|
|
6609
6616
|
return;
|
|
6610
6617
|
const e = r.RTCPeerConnection;
|
|
@@ -6624,14 +6631,14 @@ function Hs(r) {
|
|
|
6624
6631
|
}
|
|
6625
6632
|
});
|
|
6626
6633
|
}
|
|
6627
|
-
function
|
|
6634
|
+
function Ws(r) {
|
|
6628
6635
|
typeof r == "object" && r.RTCTrackEvent && "receiver" in r.RTCTrackEvent.prototype && !("transceiver" in r.RTCTrackEvent.prototype) && Object.defineProperty(r.RTCTrackEvent.prototype, "transceiver", {
|
|
6629
6636
|
get() {
|
|
6630
6637
|
return { receiver: this.receiver };
|
|
6631
6638
|
}
|
|
6632
6639
|
});
|
|
6633
6640
|
}
|
|
6634
|
-
function
|
|
6641
|
+
function Xs(r) {
|
|
6635
6642
|
const e = r.RTCPeerConnection.prototype.createOffer;
|
|
6636
6643
|
r.RTCPeerConnection.prototype.createOffer = function(i) {
|
|
6637
6644
|
if (i) {
|
|
@@ -6644,23 +6651,23 @@ function Ws(r) {
|
|
|
6644
6651
|
return e.apply(this, arguments);
|
|
6645
6652
|
};
|
|
6646
6653
|
}
|
|
6647
|
-
function
|
|
6654
|
+
function Ks(r) {
|
|
6648
6655
|
typeof r != "object" || r.AudioContext || (r.AudioContext = r.webkitAudioContext);
|
|
6649
6656
|
}
|
|
6650
6657
|
const yi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
6651
6658
|
__proto__: null,
|
|
6652
|
-
shimAudioContext:
|
|
6653
|
-
shimCallbacksAPI:
|
|
6654
|
-
shimConstraints:
|
|
6655
|
-
shimCreateOfferLegacy:
|
|
6656
|
-
shimGetUserMedia:
|
|
6657
|
-
shimLocalStreamsAPI:
|
|
6658
|
-
shimRTCIceServerUrls:
|
|
6659
|
-
shimRemoteStreamsAPI:
|
|
6660
|
-
shimTrackEventTransceiver:
|
|
6659
|
+
shimAudioContext: Ks,
|
|
6660
|
+
shimCallbacksAPI: zs,
|
|
6661
|
+
shimConstraints: Hs,
|
|
6662
|
+
shimCreateOfferLegacy: Xs,
|
|
6663
|
+
shimGetUserMedia: Gs,
|
|
6664
|
+
shimLocalStreamsAPI: Bs,
|
|
6665
|
+
shimRTCIceServerUrls: qs,
|
|
6666
|
+
shimRemoteStreamsAPI: js,
|
|
6667
|
+
shimTrackEventTransceiver: Ws
|
|
6661
6668
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
6662
|
-
var
|
|
6663
|
-
function
|
|
6669
|
+
var _t = { exports: {} }, Si;
|
|
6670
|
+
function hh() {
|
|
6664
6671
|
return Si || (Si = 1, function(r) {
|
|
6665
6672
|
const e = {};
|
|
6666
6673
|
e.generateIdentifier = function() {
|
|
@@ -6870,22 +6877,22 @@ a=ice-pwd:` + t.password + `\r
|
|
|
6870
6877
|
}, n = e.splitLines(t)[0].split(" ");
|
|
6871
6878
|
i.profile = n[2];
|
|
6872
6879
|
for (let o = 3; o < n.length; o++) {
|
|
6873
|
-
const u = n[o],
|
|
6880
|
+
const u = n[o], d = e.matchPrefix(
|
|
6874
6881
|
t,
|
|
6875
6882
|
"a=rtpmap:" + u + " "
|
|
6876
6883
|
)[0];
|
|
6877
|
-
if (
|
|
6878
|
-
const
|
|
6884
|
+
if (d) {
|
|
6885
|
+
const c = e.parseRtpMap(d), h = e.matchPrefix(
|
|
6879
6886
|
t,
|
|
6880
6887
|
"a=fmtp:" + u + " "
|
|
6881
6888
|
);
|
|
6882
|
-
switch (
|
|
6889
|
+
switch (c.parameters = h.length ? e.parseFmtp(h[0]) : {}, c.rtcpFeedback = e.matchPrefix(
|
|
6883
6890
|
t,
|
|
6884
6891
|
"a=rtcp-fb:" + u + " "
|
|
6885
|
-
).map(e.parseRtcpFb), i.codecs.push(
|
|
6892
|
+
).map(e.parseRtcpFb), i.codecs.push(c), c.name.toUpperCase()) {
|
|
6886
6893
|
case "RED":
|
|
6887
6894
|
case "ULPFEC":
|
|
6888
|
-
i.fecMechanisms.push(
|
|
6895
|
+
i.fecMechanisms.push(c.name.toUpperCase());
|
|
6889
6896
|
break;
|
|
6890
6897
|
}
|
|
6891
6898
|
}
|
|
@@ -6896,7 +6903,7 @@ a=ice-pwd:` + t.password + `\r
|
|
|
6896
6903
|
const a = e.matchPrefix(t, "a=rtcp-fb:* ").map(e.parseRtcpFb);
|
|
6897
6904
|
return i.codecs.forEach((o) => {
|
|
6898
6905
|
a.forEach((u) => {
|
|
6899
|
-
o.rtcpFeedback.find((
|
|
6906
|
+
o.rtcpFeedback.find((c) => c.type === u.type && c.parameter === u.parameter) || o.rtcpFeedback.push(u);
|
|
6900
6907
|
});
|
|
6901
6908
|
}), i;
|
|
6902
6909
|
}, e.writeRtpDescription = function(t, i) {
|
|
@@ -6916,15 +6923,15 @@ a=ice-pwd:` + t.password + `\r
|
|
|
6916
6923
|
}), s;
|
|
6917
6924
|
}, e.parseRtpEncodingParameters = function(t) {
|
|
6918
6925
|
const i = [], s = e.parseRtpParameters(t), n = s.fecMechanisms.indexOf("RED") !== -1, a = s.fecMechanisms.indexOf("ULPFEC") !== -1, o = e.matchPrefix(t, "a=ssrc:").map((p) => e.parseSsrcMedia(p)).filter((p) => p.attribute === "cname"), u = o.length > 0 && o[0].ssrc;
|
|
6919
|
-
let
|
|
6920
|
-
const
|
|
6921
|
-
|
|
6926
|
+
let d;
|
|
6927
|
+
const c = e.matchPrefix(t, "a=ssrc-group:FID").map((p) => p.substring(17).split(" ").map((f) => parseInt(f, 10)));
|
|
6928
|
+
c.length > 0 && c[0].length > 1 && c[0][0] === u && (d = c[0][1]), s.codecs.forEach((p) => {
|
|
6922
6929
|
if (p.name.toUpperCase() === "RTX" && p.parameters.apt) {
|
|
6923
6930
|
let l = {
|
|
6924
6931
|
ssrc: u,
|
|
6925
6932
|
codecPayloadType: parseInt(p.parameters.apt, 10)
|
|
6926
6933
|
};
|
|
6927
|
-
u &&
|
|
6934
|
+
u && d && (l.rtx = { ssrc: d }), i.push(l), n && (l = JSON.parse(JSON.stringify(l)), l.fec = {
|
|
6928
6935
|
ssrc: u,
|
|
6929
6936
|
mechanism: a ? "red+ulpfec" : "red"
|
|
6930
6937
|
}, i.push(l));
|
|
@@ -7047,13 +7054,13 @@ t=0 0\r
|
|
|
7047
7054
|
return !1;
|
|
7048
7055
|
return !0;
|
|
7049
7056
|
}, r.exports = e;
|
|
7050
|
-
}(
|
|
7057
|
+
}(_t)), _t.exports;
|
|
7051
7058
|
}
|
|
7052
|
-
var
|
|
7053
|
-
const le = /* @__PURE__ */ Ge(
|
|
7059
|
+
var Js = hh();
|
|
7060
|
+
const le = /* @__PURE__ */ Ge(Js), ph = /* @__PURE__ */ tn({
|
|
7054
7061
|
__proto__: null,
|
|
7055
7062
|
default: le
|
|
7056
|
-
}, [
|
|
7063
|
+
}, [Js]);
|
|
7057
7064
|
function Ne(r) {
|
|
7058
7065
|
if (!r.RTCIceCandidate || r.RTCIceCandidate && "foundation" in r.RTCIceCandidate.prototype)
|
|
7059
7066
|
return;
|
|
@@ -7082,7 +7089,7 @@ function Ne(r) {
|
|
|
7082
7089
|
writable: "false"
|
|
7083
7090
|
}), t));
|
|
7084
7091
|
}
|
|
7085
|
-
function
|
|
7092
|
+
function Dt(r) {
|
|
7086
7093
|
!r.RTCIceCandidate || r.RTCIceCandidate && "relayProtocol" in r.RTCIceCandidate.prototype || de(r, "icecandidate", (e) => {
|
|
7087
7094
|
if (e.candidate) {
|
|
7088
7095
|
const t = le.parseCandidate(e.candidate.candidate);
|
|
@@ -7107,27 +7114,27 @@ function Ve(r, e) {
|
|
|
7107
7114
|
if (!o || !o.sdp)
|
|
7108
7115
|
return !1;
|
|
7109
7116
|
const u = le.splitSections(o.sdp);
|
|
7110
|
-
return u.shift(), u.some((
|
|
7111
|
-
const
|
|
7112
|
-
return
|
|
7117
|
+
return u.shift(), u.some((d) => {
|
|
7118
|
+
const c = le.parseMLine(d);
|
|
7119
|
+
return c && c.kind === "application" && c.protocol.indexOf("SCTP") !== -1;
|
|
7113
7120
|
});
|
|
7114
7121
|
}, i = function(o) {
|
|
7115
7122
|
const u = o.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);
|
|
7116
7123
|
if (u === null || u.length < 2)
|
|
7117
7124
|
return -1;
|
|
7118
|
-
const
|
|
7119
|
-
return
|
|
7125
|
+
const d = parseInt(u[1], 10);
|
|
7126
|
+
return d !== d ? -1 : d;
|
|
7120
7127
|
}, s = function(o) {
|
|
7121
7128
|
let u = 65536;
|
|
7122
7129
|
return e.browser === "firefox" && (e.version < 57 ? o === -1 ? u = 16384 : u = 2147483637 : e.version < 60 ? u = e.version === 57 ? 65535 : 65536 : u = 2147483637), u;
|
|
7123
7130
|
}, n = function(o, u) {
|
|
7124
|
-
let
|
|
7125
|
-
e.browser === "firefox" && e.version === 57 && (
|
|
7126
|
-
const
|
|
7131
|
+
let d = 65536;
|
|
7132
|
+
e.browser === "firefox" && e.version === 57 && (d = 65535);
|
|
7133
|
+
const c = le.matchPrefix(
|
|
7127
7134
|
o.sdp,
|
|
7128
7135
|
"a=max-message-size:"
|
|
7129
7136
|
);
|
|
7130
|
-
return
|
|
7137
|
+
return c.length > 0 ? d = parseInt(c[0].substring(19), 10) : e.browser === "firefox" && u !== -1 && (d = 2147483637), d;
|
|
7131
7138
|
}, a = r.RTCPeerConnection.prototype.setRemoteDescription;
|
|
7132
7139
|
r.RTCPeerConnection.prototype.setRemoteDescription = function() {
|
|
7133
7140
|
if (this._sctp = null, e.browser === "chrome" && e.version >= 76) {
|
|
@@ -7141,9 +7148,9 @@ function Ve(r, e) {
|
|
|
7141
7148
|
});
|
|
7142
7149
|
}
|
|
7143
7150
|
if (t(arguments[0])) {
|
|
7144
|
-
const u = i(arguments[0]),
|
|
7151
|
+
const u = i(arguments[0]), d = s(u), c = n(arguments[0], u);
|
|
7145
7152
|
let h;
|
|
7146
|
-
|
|
7153
|
+
d === 0 && c === 0 ? h = Number.POSITIVE_INFINITY : d === 0 || c === 0 ? h = Math.max(d, c) : h = Math.min(d, c);
|
|
7147
7154
|
const p = {};
|
|
7148
7155
|
Object.defineProperty(p, "maxMessageSize", {
|
|
7149
7156
|
get() {
|
|
@@ -7172,7 +7179,7 @@ function Ue(r) {
|
|
|
7172
7179
|
return e(s, this), s;
|
|
7173
7180
|
}, de(r, "datachannel", (i) => (e(i.channel, i.target), i));
|
|
7174
7181
|
}
|
|
7175
|
-
function
|
|
7182
|
+
function Lt(r) {
|
|
7176
7183
|
if (!r.RTCPeerConnection || "connectionState" in r.RTCPeerConnection.prototype)
|
|
7177
7184
|
return;
|
|
7178
7185
|
const e = r.RTCPeerConnection.prototype;
|
|
@@ -7218,7 +7225,7 @@ function Dt(r) {
|
|
|
7218
7225
|
};
|
|
7219
7226
|
});
|
|
7220
7227
|
}
|
|
7221
|
-
function
|
|
7228
|
+
function Ft(r, e) {
|
|
7222
7229
|
if (!r.RTCPeerConnection || e.browser === "chrome" && e.version >= 71 || e.browser === "safari" && e.version >= 605)
|
|
7223
7230
|
return;
|
|
7224
7231
|
const t = r.RTCPeerConnection.prototype.setRemoteDescription;
|
|
@@ -7266,48 +7273,48 @@ function Be(r, e) {
|
|
|
7266
7273
|
return s.sdp || s.type !== "offer" && s.type !== "answer" ? t.apply(this, [s]) : (s.type === "offer" ? this.createOffer : this.createAnswer).apply(this).then((a) => t.apply(this, [a]));
|
|
7267
7274
|
});
|
|
7268
7275
|
}
|
|
7269
|
-
const
|
|
7276
|
+
const lh = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
7270
7277
|
__proto__: null,
|
|
7271
|
-
removeExtmapAllowMixed:
|
|
7278
|
+
removeExtmapAllowMixed: Ft,
|
|
7272
7279
|
shimAddIceCandidateNullOrEmpty: $e,
|
|
7273
|
-
shimConnectionState:
|
|
7280
|
+
shimConnectionState: Lt,
|
|
7274
7281
|
shimMaxMessageSize: Ve,
|
|
7275
7282
|
shimParameterlessSetLocalDescription: Be,
|
|
7276
7283
|
shimRTCIceCandidate: Ne,
|
|
7277
|
-
shimRTCIceCandidateRelayProtocol:
|
|
7284
|
+
shimRTCIceCandidateRelayProtocol: Dt,
|
|
7278
7285
|
shimSendThrowTypeError: Ue
|
|
7279
7286
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
7280
|
-
function
|
|
7287
|
+
function mh({ window: r } = {}, e = {
|
|
7281
7288
|
shimChrome: !0,
|
|
7282
7289
|
shimFirefox: !0,
|
|
7283
7290
|
shimSafari: !0
|
|
7284
7291
|
}) {
|
|
7285
|
-
const t =
|
|
7292
|
+
const t = Ss, i = dh(r), s = {
|
|
7286
7293
|
browserDetails: i,
|
|
7287
|
-
commonShim:
|
|
7294
|
+
commonShim: lh,
|
|
7288
7295
|
extractVersion: Fe,
|
|
7289
|
-
disableLog:
|
|
7290
|
-
disableWarnings:
|
|
7296
|
+
disableLog: ah,
|
|
7297
|
+
disableWarnings: ch,
|
|
7291
7298
|
// Expose sdp as a convenience. For production apps include directly.
|
|
7292
|
-
sdp:
|
|
7299
|
+
sdp: ph
|
|
7293
7300
|
};
|
|
7294
7301
|
switch (i.browser) {
|
|
7295
7302
|
case "chrome":
|
|
7296
|
-
if (!vi || !
|
|
7303
|
+
if (!vi || !It || !e.shimChrome)
|
|
7297
7304
|
return t("Chrome shim is not included in this adapter release."), s;
|
|
7298
7305
|
if (i.version === null)
|
|
7299
7306
|
return t("Chrome shim can not determine version, not shimming."), s;
|
|
7300
|
-
t("adapter.js shimming chrome."), s.browserShim = vi, $e(r, i), Be(r),
|
|
7307
|
+
t("adapter.js shimming chrome."), s.browserShim = vi, $e(r, i), Be(r), Es(r, i), bs(r), It(r, i), ks(r), As(r, i), Ps(r), xs(r), ws(r, i), Ne(r), Dt(r), Lt(r), Ve(r, i), Ue(r), Ft(r, i);
|
|
7301
7308
|
break;
|
|
7302
7309
|
case "firefox":
|
|
7303
|
-
if (!Ci || !
|
|
7310
|
+
if (!Ci || !Mt || !e.shimFirefox)
|
|
7304
7311
|
return t("Firefox shim is not included in this adapter release."), s;
|
|
7305
|
-
t("adapter.js shimming firefox."), s.browserShim = Ci, $e(r, i), Be(r),
|
|
7312
|
+
t("adapter.js shimming firefox."), s.browserShim = Ci, $e(r, i), Be(r), Os(r, i), Mt(r, i), Is(r), Ls(r), Ms(r), Ds(r), Fs(r), Ns(r), Vs(r), Us(r), $s(r), Ne(r), Lt(r), Ve(r, i), Ue(r);
|
|
7306
7313
|
break;
|
|
7307
7314
|
case "safari":
|
|
7308
7315
|
if (!yi || !e.shimSafari)
|
|
7309
7316
|
return t("Safari shim is not included in this adapter release."), s;
|
|
7310
|
-
t("adapter.js shimming safari."), s.browserShim = yi, $e(r, i), Be(r),
|
|
7317
|
+
t("adapter.js shimming safari."), s.browserShim = yi, $e(r, i), Be(r), qs(r), Xs(r), zs(r), Bs(r), js(r), Ws(r), Gs(r), Ks(r), Ne(r), Dt(r), Ve(r, i), Ue(r), Ft(r, i);
|
|
7311
7318
|
break;
|
|
7312
7319
|
default:
|
|
7313
7320
|
t("Unsupported browser!");
|
|
@@ -7315,8 +7322,8 @@ function hh({ window: r } = {}, e = {
|
|
|
7315
7322
|
}
|
|
7316
7323
|
return s;
|
|
7317
7324
|
}
|
|
7318
|
-
|
|
7319
|
-
class
|
|
7325
|
+
mh({ window: typeof window > "u" ? void 0 : window });
|
|
7326
|
+
class vh extends te {
|
|
7320
7327
|
/** {zh}
|
|
7321
7328
|
* @brief 查询是否支持 RTM 或 WebTransport 推流。
|
|
7322
7329
|
* @param mode 推流模式。
|
|
@@ -7332,9 +7339,9 @@ class fh extends te {
|
|
|
7332
7339
|
*/
|
|
7333
7340
|
static async isSupported(e) {
|
|
7334
7341
|
if (e === "webTransport")
|
|
7335
|
-
return Promise.resolve(
|
|
7342
|
+
return Promise.resolve(gs.isSupported());
|
|
7336
7343
|
try {
|
|
7337
|
-
return
|
|
7344
|
+
return eh() || !window.RTCPeerConnection || !window.RTCPeerConnection.prototype.addTransceiver || !window.RTCPeerConnection.prototype.createDataChannel ? !1 : await sh() && await ih();
|
|
7338
7345
|
} catch {
|
|
7339
7346
|
return !1;
|
|
7340
7347
|
}
|
|
@@ -7350,11 +7357,11 @@ class fh extends te {
|
|
|
7350
7357
|
* @return LivePusher instance.
|
|
7351
7358
|
*/
|
|
7352
7359
|
constructor(e) {
|
|
7353
|
-
super(), this._streamManagerController = new
|
|
7360
|
+
super(), this._streamManagerController = new Tu(), this._streamComposeController = new Iu(
|
|
7354
7361
|
this._streamManagerController
|
|
7355
|
-
), this._streamConsumeController = new
|
|
7362
|
+
), this._streamConsumeController = new Qu(
|
|
7356
7363
|
this._streamComposeController
|
|
7357
|
-
), this._streamConsumeController.setPushConfig(e), this._observer =
|
|
7364
|
+
), this._streamConsumeController.setPushConfig(e), this._observer = oh, this._bindEvent();
|
|
7358
7365
|
}
|
|
7359
7366
|
/** {zh}
|
|
7360
7367
|
* @brief 获取设备列表,包括音频输入设备和视频输入设备。
|
|
@@ -8055,7 +8062,7 @@ class fh extends te {
|
|
|
8055
8062
|
);
|
|
8056
8063
|
break;
|
|
8057
8064
|
case "setVolumeDetectScriptUrl":
|
|
8058
|
-
|
|
8065
|
+
Ke.instance.volumeDetectScriptUrl = t;
|
|
8059
8066
|
break;
|
|
8060
8067
|
case "setMixerWorkerScriptUrl":
|
|
8061
8068
|
this._streamComposeController.setMixerWorkerScript(
|
|
@@ -8227,7 +8234,7 @@ class fh extends te {
|
|
|
8227
8234
|
() => {
|
|
8228
8235
|
this.observer.onCaptureFirstVideoFrame();
|
|
8229
8236
|
}
|
|
8230
|
-
),
|
|
8237
|
+
), co((e) => {
|
|
8231
8238
|
e.deviceInfo.kind === "videoinput" ? this.observer.onCameraChanged(e.deviceInfo) : e.deviceInfo.kind === "audioinput" && this.observer.onMicrophoneChanged(e.deviceInfo);
|
|
8232
8239
|
});
|
|
8233
8240
|
}
|
|
@@ -8297,5 +8304,5 @@ class fh extends te {
|
|
|
8297
8304
|
}
|
|
8298
8305
|
}
|
|
8299
8306
|
export {
|
|
8300
|
-
|
|
8307
|
+
vh as default
|
|
8301
8308
|
};
|