@byteplus/vepusher 2.0.4-rc.10 → 2.0.4-rc.12
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.d.ts +2 -2
- package/dist/index.es.js +421 -413
- package/dist/index.umd.js +8 -8
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -81,8 +81,8 @@ function Td() {
|
|
|
81
81
|
T[E - 1] = arguments[E];
|
|
82
82
|
w.fn.apply(w.context, T);
|
|
83
83
|
} else {
|
|
84
|
-
var
|
|
85
|
-
for (E = 0; E <
|
|
84
|
+
var M = w.length, G;
|
|
85
|
+
for (E = 0; E < M; E++)
|
|
86
86
|
switch (w[E].once && this.removeListener(c, w[E].fn, void 0, !0), b) {
|
|
87
87
|
case 1:
|
|
88
88
|
w[E].fn.call(w[E].context);
|
|
@@ -225,7 +225,7 @@ class xd extends mc {
|
|
|
225
225
|
super.destroy();
|
|
226
226
|
}
|
|
227
227
|
}
|
|
228
|
-
class
|
|
228
|
+
class Od extends xd {
|
|
229
229
|
constructor() {
|
|
230
230
|
super(...arguments);
|
|
231
231
|
V(this, "_node");
|
|
@@ -266,7 +266,7 @@ const hs = {
|
|
|
266
266
|
warn: { color: "rgba(255, 119, 0, 0.3)", text: "WARN" },
|
|
267
267
|
err: { color: "rgba(255, 0, 0, 0.3)", text: "ERR " },
|
|
268
268
|
succ: { color: "rgba(0, 119, 0, 0.3)", text: "SUCC" }
|
|
269
|
-
}, fs = "__debug__",
|
|
269
|
+
}, fs = "__debug__", Md = "[VE-CAPTURE]";
|
|
270
270
|
function Pd() {
|
|
271
271
|
if (typeof location > "u" || typeof localStorage > "u")
|
|
272
272
|
return !1;
|
|
@@ -281,7 +281,7 @@ let je = class {
|
|
|
281
281
|
print(e, t, ...n) {
|
|
282
282
|
const i = Ld();
|
|
283
283
|
Pd() && console.log(
|
|
284
|
-
`${i}-${
|
|
284
|
+
`${i}-${Md}%c[${hs[e].text}]%c[${this.moduleName}][${t}]`,
|
|
285
285
|
`background-color:${hs[e].color};`,
|
|
286
286
|
"background-color:rgba(0, 0, 0, 0)",
|
|
287
287
|
...n
|
|
@@ -646,7 +646,7 @@ function Sc(r) {
|
|
|
646
646
|
`got ${r}, expected: audio, video`
|
|
647
647
|
);
|
|
648
648
|
}
|
|
649
|
-
class
|
|
649
|
+
class Oo extends Bt {
|
|
650
650
|
emit(e, ...t) {
|
|
651
651
|
const n = this.listenerCount(e);
|
|
652
652
|
return Promise.resolve().then(() => {
|
|
@@ -782,7 +782,7 @@ function Qd({
|
|
|
782
782
|
});
|
|
783
783
|
return n.src = r, n;
|
|
784
784
|
}
|
|
785
|
-
class
|
|
785
|
+
class Mo extends Oo {
|
|
786
786
|
constructor(t) {
|
|
787
787
|
super();
|
|
788
788
|
V(this, "id", tr());
|
|
@@ -845,7 +845,7 @@ class Oo extends Mo {
|
|
|
845
845
|
(t = this._track) == null || t.clearAll(), (n = this._track) == null || n.target.stop(), this._track && delete this._track, (i = this._element) == null || i.removeReference(this), delete this._element;
|
|
846
846
|
}
|
|
847
847
|
}
|
|
848
|
-
class Kn extends
|
|
848
|
+
class Kn extends Mo {
|
|
849
849
|
constructor() {
|
|
850
850
|
super(...arguments);
|
|
851
851
|
V(this, "kind", he.AUDIO);
|
|
@@ -859,7 +859,7 @@ class Kn extends Oo {
|
|
|
859
859
|
);
|
|
860
860
|
if (this._node)
|
|
861
861
|
return this._node;
|
|
862
|
-
const t = new
|
|
862
|
+
const t = new Od(this);
|
|
863
863
|
return this._node = t, t;
|
|
864
864
|
}
|
|
865
865
|
/** overwrite in AudioTrack */
|
|
@@ -963,7 +963,7 @@ class il {
|
|
|
963
963
|
}
|
|
964
964
|
}
|
|
965
965
|
const ol = 300, sl = 3e3, ct = new je("Devices");
|
|
966
|
-
class al extends
|
|
966
|
+
class al extends Oo {
|
|
967
967
|
constructor() {
|
|
968
968
|
super();
|
|
969
969
|
/** 存储 SDK 已知的设备列表 */
|
|
@@ -1274,7 +1274,7 @@ class Wn extends ul {
|
|
|
1274
1274
|
);
|
|
1275
1275
|
}
|
|
1276
1276
|
}
|
|
1277
|
-
class dl extends
|
|
1277
|
+
class dl extends Mo {
|
|
1278
1278
|
constructor() {
|
|
1279
1279
|
super(...arguments);
|
|
1280
1280
|
V(this, "logger", new je("PictureTrack"));
|
|
@@ -1311,7 +1311,7 @@ class dl extends Oo {
|
|
|
1311
1311
|
}
|
|
1312
1312
|
}
|
|
1313
1313
|
const ll = 500;
|
|
1314
|
-
class Jn extends
|
|
1314
|
+
class Jn extends Mo {
|
|
1315
1315
|
constructor() {
|
|
1316
1316
|
super(...arguments);
|
|
1317
1317
|
V(this, "kind", he.VIDEO);
|
|
@@ -1522,11 +1522,11 @@ function Cl(r) {
|
|
|
1522
1522
|
}
|
|
1523
1523
|
const kl = kt.invoke(gl, "enumerateInputDevices"), Tl = kt.invoke(vl, "createCameraTrack"), zl = kt.invoke(bl, "createPictureTrack"), ys = kt.invoke(Sl, "createMediaTracks"), Rl = kt.invoke(El, "createMicrophoneTrack"), Dl = kt.invoke(yl, "createScreenTracks"), Al = kt.invoke(_l, "onDeviceChanged"), Il = kt.invoke(wl, "createCustomVideoTrack"), xl = kt.invoke(Cl, "createCustomAudioTrack");
|
|
1524
1524
|
var Zi = /* @__PURE__ */ ((r) => (r.PAUSING = "pausing", r))(Zi || {});
|
|
1525
|
-
const
|
|
1525
|
+
const Ol = {
|
|
1526
1526
|
sampleRate: 48e3,
|
|
1527
1527
|
keepAlive: !0
|
|
1528
1528
|
}, Ss = /* @__PURE__ */ new Map(), kr = new je("Mixer");
|
|
1529
|
-
class
|
|
1529
|
+
class Ml extends Oo {
|
|
1530
1530
|
constructor(t) {
|
|
1531
1531
|
super();
|
|
1532
1532
|
V(this, "id", tr());
|
|
@@ -1544,25 +1544,25 @@ class Ol extends Mo {
|
|
|
1544
1544
|
t.removeEventListener(a, o);
|
|
1545
1545
|
});
|
|
1546
1546
|
}, o = () => {
|
|
1547
|
-
|
|
1547
|
+
Or(this._context).then(i);
|
|
1548
1548
|
};
|
|
1549
1549
|
n.forEach((a) => {
|
|
1550
1550
|
t.addEventListener(a, o, !1);
|
|
1551
1551
|
});
|
|
1552
1552
|
});
|
|
1553
1553
|
kr.info("ctor", t), this._config = {
|
|
1554
|
-
...
|
|
1554
|
+
...Ol,
|
|
1555
1555
|
...t
|
|
1556
1556
|
}, this._context = Pl(this._config), this._bindContextEvent(this._context);
|
|
1557
1557
|
}
|
|
1558
1558
|
mix(t) {
|
|
1559
|
-
kr.info("mix", t),
|
|
1559
|
+
kr.info("mix", t), Or(this._context);
|
|
1560
1560
|
for (const n of this._nodeList)
|
|
1561
1561
|
t.includes(n) || n.destroy();
|
|
1562
1562
|
this._nodeList = t, this._connect(t, this._destNode), this._nodeList.length === 0 && this._appendSlience(this._context, this._destNode);
|
|
1563
1563
|
}
|
|
1564
1564
|
resume() {
|
|
1565
|
-
return kr.info("resume"),
|
|
1565
|
+
return kr.info("resume"), Or(this._context);
|
|
1566
1566
|
}
|
|
1567
1567
|
_connect(t, n) {
|
|
1568
1568
|
for (const i of t)
|
|
@@ -1588,7 +1588,7 @@ class Ol extends Mo {
|
|
|
1588
1588
|
(t.state === "suspended" || t.state === "interrupted") && (kr.info("_emit_", Zi.PAUSING), this.emit(Zi.PAUSING));
|
|
1589
1589
|
}
|
|
1590
1590
|
track() {
|
|
1591
|
-
if (kr.info("track"),
|
|
1591
|
+
if (kr.info("track"), Or(this._context), this.unlockAudioContext(), this._track)
|
|
1592
1592
|
return this._track;
|
|
1593
1593
|
let t = this._destNode;
|
|
1594
1594
|
t || (t = new MediaStreamAudioDestinationNode(this._context)), this._nodeList.length === 0 && this._appendSlience(this._context, t), this._connect(this._nodeList, t);
|
|
@@ -1600,10 +1600,10 @@ function Pl(r) {
|
|
|
1600
1600
|
const { sampleRate: e, keepAlive: t } = r;
|
|
1601
1601
|
let n = Ss.get(e);
|
|
1602
1602
|
return (!n || n.state === "closed") && (n = new AudioContext({ sampleRate: e }), Ss.set(e, n)), t && (n.onstatechange = () => {
|
|
1603
|
-
|
|
1603
|
+
Or(n);
|
|
1604
1604
|
}), n;
|
|
1605
1605
|
}
|
|
1606
|
-
function
|
|
1606
|
+
function Or(r) {
|
|
1607
1607
|
return r.state === "suspended" || r.state === "interrupted" ? r.resume() : Promise.resolve();
|
|
1608
1608
|
}
|
|
1609
1609
|
const Ll = (r) => (e, t) => (r.set(e, t), t), bs = Number.MAX_SAFE_INTEGER === void 0 ? 9007199254740991 : Number.MAX_SAFE_INTEGER, Cc = 536870912, Es = Cc * 2, Ul = (r, e) => (t) => {
|
|
@@ -2268,13 +2268,13 @@ function rr(r) {
|
|
|
2268
2268
|
}
|
|
2269
2269
|
return "";
|
|
2270
2270
|
}
|
|
2271
|
-
var
|
|
2272
|
-
"^" + Uh.call(Gh).replace(
|
|
2271
|
+
var Oh = /[\\^$.*+?()[\]{}|]/g, Mh = /^\[object .+?Constructor\]$/, Ph = Function.prototype, Lh = Object.prototype, Uh = Ph.toString, Gh = Lh.hasOwnProperty, Nh = RegExp(
|
|
2272
|
+
"^" + Uh.call(Gh).replace(Oh, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
2273
2273
|
);
|
|
2274
2274
|
function Bh(r) {
|
|
2275
2275
|
if (!Yr(r) || Ah(r))
|
|
2276
2276
|
return !1;
|
|
2277
|
-
var e = xc(r) ? Nh :
|
|
2277
|
+
var e = xc(r) ? Nh : Mh;
|
|
2278
2278
|
return e.test(rr(r));
|
|
2279
2279
|
}
|
|
2280
2280
|
function Fh(r, e) {
|
|
@@ -2292,11 +2292,11 @@ function Vh(r, e, t, n) {
|
|
|
2292
2292
|
return -1;
|
|
2293
2293
|
}
|
|
2294
2294
|
var jh = 9007199254740991, Hh = /^(?:0|[1-9]\d*)$/;
|
|
2295
|
-
function
|
|
2295
|
+
function Oc(r, e) {
|
|
2296
2296
|
var t = typeof r;
|
|
2297
2297
|
return e = e ?? jh, !!e && (t == "number" || t != "symbol" && Hh.test(r)) && r > -1 && r % 1 == 0 && r < e;
|
|
2298
2298
|
}
|
|
2299
|
-
function
|
|
2299
|
+
function Mc(r, e) {
|
|
2300
2300
|
return r === e || r !== r && e !== e;
|
|
2301
2301
|
}
|
|
2302
2302
|
var $h = 9007199254740991;
|
|
@@ -2328,7 +2328,7 @@ var Lc = Object.prototype, Jh = Lc.hasOwnProperty, Xh = Lc.propertyIsEnumerable,
|
|
|
2328
2328
|
function Zh() {
|
|
2329
2329
|
return !1;
|
|
2330
2330
|
}
|
|
2331
|
-
var Uc = typeof exports == "object" && exports && !exports.nodeType && exports, Ds = Uc && typeof module == "object" && module && !module.nodeType && module, Yh = Ds && Ds.exports === Uc, As = Yh ? Tt.Buffer : void 0, Qh = As ? As.isBuffer : void 0,
|
|
2331
|
+
var Uc = typeof exports == "object" && exports && !exports.nodeType && exports, Ds = Uc && typeof module == "object" && module && !module.nodeType && module, Yh = Ds && Ds.exports === Uc, As = Yh ? Tt.Buffer : void 0, Qh = As ? As.isBuffer : void 0, Mn = Qh || Zh, ef = "[object Arguments]", tf = "[object Array]", rf = "[object Boolean]", nf = "[object Date]", of = "[object Error]", sf = "[object Function]", af = "[object Map]", cf = "[object Number]", uf = "[object Object]", df = "[object RegExp]", lf = "[object Set]", hf = "[object String]", ff = "[object WeakMap]", pf = "[object ArrayBuffer]", mf = "[object DataView]", gf = "[object Float32Array]", _f = "[object Float64Array]", vf = "[object Int8Array]", yf = "[object Int16Array]", Sf = "[object Int32Array]", bf = "[object Uint8Array]", Ef = "[object Uint8ClampedArray]", wf = "[object Uint16Array]", Cf = "[object Uint32Array]", ge = {};
|
|
2332
2332
|
ge[gf] = ge[_f] = ge[vf] = ge[yf] = ge[Sf] = ge[bf] = ge[Ef] = ge[wf] = ge[Cf] = !0;
|
|
2333
2333
|
ge[ef] = ge[tf] = ge[pf] = ge[rf] = ge[mf] = ge[nf] = ge[of] = ge[sf] = ge[af] = ge[cf] = ge[uf] = ge[df] = ge[lf] = ge[hf] = ge[ff] = !1;
|
|
2334
2334
|
function kf(r) {
|
|
@@ -2347,13 +2347,13 @@ var Gc = typeof exports == "object" && exports && !exports.nodeType && exports,
|
|
|
2347
2347
|
}
|
|
2348
2348
|
}(), xs = Is && Is.isTypedArray, Go = xs ? Tf(xs) : kf, Rf = Object.prototype, Df = Rf.hasOwnProperty;
|
|
2349
2349
|
function Af(r, e) {
|
|
2350
|
-
var t = ze(r), n = !t && Uo(r), i = !t && !n &&
|
|
2350
|
+
var t = ze(r), n = !t && Uo(r), i = !t && !n && Mn(r), o = !t && !n && !i && Go(r), a = t || n || i || o, s = a ? Kh(r.length, String) : [], d = s.length;
|
|
2351
2351
|
for (var c in r)
|
|
2352
2352
|
Df.call(r, c) && !(a && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
2353
2353
|
(c == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
2354
2354
|
i && (c == "offset" || c == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
2355
2355
|
o && (c == "buffer" || c == "byteLength" || c == "byteOffset") || // Skip index properties.
|
|
2356
|
-
|
|
2356
|
+
Oc(c, d))) && s.push(c);
|
|
2357
2357
|
return s;
|
|
2358
2358
|
}
|
|
2359
2359
|
function If(r, e) {
|
|
@@ -2361,13 +2361,13 @@ function If(r, e) {
|
|
|
2361
2361
|
return r(e(t));
|
|
2362
2362
|
};
|
|
2363
2363
|
}
|
|
2364
|
-
var xf = If(Object.keys, Object),
|
|
2364
|
+
var xf = If(Object.keys, Object), Of = Object.prototype, Mf = Of.hasOwnProperty;
|
|
2365
2365
|
function Nc(r) {
|
|
2366
2366
|
if (!Pc(r))
|
|
2367
2367
|
return xf(r);
|
|
2368
2368
|
var e = [];
|
|
2369
2369
|
for (var t in Object(r))
|
|
2370
|
-
|
|
2370
|
+
Mf.call(r, t) && t != "constructor" && e.push(t);
|
|
2371
2371
|
return e;
|
|
2372
2372
|
}
|
|
2373
2373
|
function hn(r) {
|
|
@@ -2424,7 +2424,7 @@ function Wf() {
|
|
|
2424
2424
|
}
|
|
2425
2425
|
function Qn(r, e) {
|
|
2426
2426
|
for (var t = r.length; t--; )
|
|
2427
|
-
if (
|
|
2427
|
+
if (Mc(r[t][0], e))
|
|
2428
2428
|
return t;
|
|
2429
2429
|
return -1;
|
|
2430
2430
|
}
|
|
@@ -2598,8 +2598,8 @@ function Vc(r, e) {
|
|
|
2598
2598
|
function Ep() {
|
|
2599
2599
|
return [];
|
|
2600
2600
|
}
|
|
2601
|
-
var wp = Object.prototype, Cp = wp.propertyIsEnumerable,
|
|
2602
|
-
return r == null ? [] : (r = Object(r), Vc(
|
|
2601
|
+
var wp = Object.prototype, Cp = wp.propertyIsEnumerable, Os = Object.getOwnPropertySymbols, kp = Os ? function(r) {
|
|
2602
|
+
return r == null ? [] : (r = Object(r), Vc(Os(r), function(e) {
|
|
2603
2603
|
return Cp.call(r, e);
|
|
2604
2604
|
}));
|
|
2605
2605
|
} : Ep;
|
|
@@ -2607,7 +2607,7 @@ function Tp(r, e, t) {
|
|
|
2607
2607
|
var n = e(r);
|
|
2608
2608
|
return ze(r) ? n : mp(n, t(r));
|
|
2609
2609
|
}
|
|
2610
|
-
function
|
|
2610
|
+
function Ms(r) {
|
|
2611
2611
|
return Tp(r, hn, kp);
|
|
2612
2612
|
}
|
|
2613
2613
|
var Qi = Er(Tt, "DataView"), eo = Er(Tt, "Promise"), to = Er(Tt, "Set"), Ps = "[object Map]", zp = "[object Object]", Ls = "[object Promise]", Us = "[object Set]", Gs = "[object WeakMap]", Ns = "[object DataView]", Rp = rr(Qi), Dp = rr(en), Ap = rr(eo), Ip = rr(to), xp = rr(Yi), bt = br;
|
|
@@ -2628,9 +2628,9 @@ var Qi = Er(Tt, "DataView"), eo = Er(Tt, "Promise"), to = Er(Tt, "Set"), Ps = "[
|
|
|
2628
2628
|
}
|
|
2629
2629
|
return e;
|
|
2630
2630
|
});
|
|
2631
|
-
var Bs = Tt.Uint8Array,
|
|
2632
|
-
function
|
|
2633
|
-
return this.__data__.set(r,
|
|
2631
|
+
var Bs = Tt.Uint8Array, Op = "__lodash_hash_undefined__";
|
|
2632
|
+
function Mp(r) {
|
|
2633
|
+
return this.__data__.set(r, Op), this;
|
|
2634
2634
|
}
|
|
2635
2635
|
function Pp(r) {
|
|
2636
2636
|
return this.__data__.has(r);
|
|
@@ -2640,7 +2640,7 @@ function Pn(r) {
|
|
|
2640
2640
|
for (this.__data__ = new Rt(); ++e < t; )
|
|
2641
2641
|
this.add(r[e]);
|
|
2642
2642
|
}
|
|
2643
|
-
Pn.prototype.add = Pn.prototype.push =
|
|
2643
|
+
Pn.prototype.add = Pn.prototype.push = Mp;
|
|
2644
2644
|
Pn.prototype.has = Pp;
|
|
2645
2645
|
function Lp(r, e) {
|
|
2646
2646
|
for (var t = -1, n = r == null ? 0 : r.length; ++t < n; )
|
|
@@ -2709,7 +2709,7 @@ function tm(r, e, t, n, i, o, a) {
|
|
|
2709
2709
|
case Hp:
|
|
2710
2710
|
case $p:
|
|
2711
2711
|
case Wp:
|
|
2712
|
-
return
|
|
2712
|
+
return Mc(+r, +e);
|
|
2713
2713
|
case qp:
|
|
2714
2714
|
return r.name == e.name && r.message == e.message;
|
|
2715
2715
|
case Jp:
|
|
@@ -2735,7 +2735,7 @@ function tm(r, e, t, n, i, o, a) {
|
|
|
2735
2735
|
}
|
|
2736
2736
|
var rm = 1, nm = Object.prototype, im = nm.hasOwnProperty;
|
|
2737
2737
|
function om(r, e, t, n, i, o) {
|
|
2738
|
-
var a = t & rm, s =
|
|
2738
|
+
var a = t & rm, s = Ms(r), d = s.length, c = Ms(e), u = c.length;
|
|
2739
2739
|
if (d != u && !a)
|
|
2740
2740
|
return !1;
|
|
2741
2741
|
for (var f = d; f--; ) {
|
|
@@ -2760,8 +2760,8 @@ function om(r, e, t, n, i, o) {
|
|
|
2760
2760
|
w || (w = h == "constructor");
|
|
2761
2761
|
}
|
|
2762
2762
|
if (z && !w) {
|
|
2763
|
-
var
|
|
2764
|
-
|
|
2763
|
+
var M = r.constructor, G = e.constructor;
|
|
2764
|
+
M != G && "constructor" in r && "constructor" in e && !(typeof M == "function" && M instanceof M && typeof G == "function" && G instanceof G) && (z = !1);
|
|
2765
2765
|
}
|
|
2766
2766
|
return o.delete(r), o.delete(e), z;
|
|
2767
2767
|
}
|
|
@@ -2770,8 +2770,8 @@ function cm(r, e, t, n, i, o) {
|
|
|
2770
2770
|
var a = ze(r), s = ze(e), d = a ? js : bt(r), c = s ? js : bt(e);
|
|
2771
2771
|
d = d == Vs ? yn : d, c = c == Vs ? yn : c;
|
|
2772
2772
|
var u = d == yn, f = c == yn, h = d == c;
|
|
2773
|
-
if (h &&
|
|
2774
|
-
if (!
|
|
2773
|
+
if (h && Mn(r)) {
|
|
2774
|
+
if (!Mn(e))
|
|
2775
2775
|
return !1;
|
|
2776
2776
|
a = !0, u = !1;
|
|
2777
2777
|
}
|
|
@@ -2845,7 +2845,7 @@ function mm(r, e, t) {
|
|
|
2845
2845
|
break;
|
|
2846
2846
|
r = r[a];
|
|
2847
2847
|
}
|
|
2848
|
-
return o || ++n != i ? o : (i = r == null ? 0 : r.length, !!i && Lo(i) &&
|
|
2848
|
+
return o || ++n != i ? o : (i = r == null ? 0 : r.length, !!i && Lo(i) && Oc(a, i) && (ze(r) || Uo(r)));
|
|
2849
2849
|
}
|
|
2850
2850
|
function gm(r, e) {
|
|
2851
2851
|
return r != null && mm(r, e, pm);
|
|
@@ -2939,14 +2939,14 @@ function xm(r, e) {
|
|
|
2939
2939
|
function _t(r) {
|
|
2940
2940
|
return r == null ? [] : xm(r, hn(r));
|
|
2941
2941
|
}
|
|
2942
|
-
var
|
|
2942
|
+
var Om = "[object Map]", Mm = "[object Set]", Pm = Object.prototype, Lm = Pm.hasOwnProperty;
|
|
2943
2943
|
function Um(r) {
|
|
2944
2944
|
if (r == null)
|
|
2945
2945
|
return !0;
|
|
2946
|
-
if (Yn(r) && (ze(r) || typeof r == "string" || typeof r.splice == "function" ||
|
|
2946
|
+
if (Yn(r) && (ze(r) || typeof r == "string" || typeof r.splice == "function" || Mn(r) || Go(r) || Uo(r)))
|
|
2947
2947
|
return !r.length;
|
|
2948
2948
|
var e = bt(r);
|
|
2949
|
-
if (e ==
|
|
2949
|
+
if (e == Om || e == Mm)
|
|
2950
2950
|
return !r.size;
|
|
2951
2951
|
if (Pc(r))
|
|
2952
2952
|
return !Nc(r).length;
|
|
@@ -3486,13 +3486,13 @@ var Br = Xc(function(r, e) {
|
|
|
3486
3486
|
}
|
|
3487
3487
|
function g(b, T, E) {
|
|
3488
3488
|
o(function() {
|
|
3489
|
-
var
|
|
3489
|
+
var M;
|
|
3490
3490
|
try {
|
|
3491
|
-
|
|
3491
|
+
M = T(E);
|
|
3492
3492
|
} catch (G) {
|
|
3493
3493
|
return s.reject(b, G);
|
|
3494
3494
|
}
|
|
3495
|
-
|
|
3495
|
+
M === b ? s.reject(b, new TypeError("Cannot resolve promise with itself")) : s.resolve(b, M);
|
|
3496
3496
|
});
|
|
3497
3497
|
}
|
|
3498
3498
|
function k(b) {
|
|
@@ -3503,23 +3503,23 @@ var Br = Xc(function(r, e) {
|
|
|
3503
3503
|
}
|
|
3504
3504
|
function z(b, T) {
|
|
3505
3505
|
var E = !1;
|
|
3506
|
-
function
|
|
3506
|
+
function M(U) {
|
|
3507
3507
|
E || (E = !0, s.reject(b, U));
|
|
3508
3508
|
}
|
|
3509
3509
|
function G(U) {
|
|
3510
3510
|
E || (E = !0, s.resolve(b, U));
|
|
3511
3511
|
}
|
|
3512
3512
|
var I = w(function() {
|
|
3513
|
-
T(G,
|
|
3513
|
+
T(G, M);
|
|
3514
3514
|
});
|
|
3515
|
-
I.status === "error" &&
|
|
3515
|
+
I.status === "error" && M(I.value);
|
|
3516
3516
|
}
|
|
3517
3517
|
function w(b, T) {
|
|
3518
3518
|
var E = {};
|
|
3519
3519
|
try {
|
|
3520
3520
|
E.value = b(T), E.status = "success";
|
|
3521
|
-
} catch (
|
|
3522
|
-
E.status = "error", E.value =
|
|
3521
|
+
} catch (M) {
|
|
3522
|
+
E.status = "error", E.value = M;
|
|
3523
3523
|
}
|
|
3524
3524
|
return E;
|
|
3525
3525
|
}
|
|
@@ -3540,8 +3540,8 @@ var Br = Xc(function(r, e) {
|
|
|
3540
3540
|
}, s.resolve = function(b, T) {
|
|
3541
3541
|
var E = w(k, T);
|
|
3542
3542
|
if (E.status === "error") return s.reject(b, E.value);
|
|
3543
|
-
var
|
|
3544
|
-
if (
|
|
3543
|
+
var M = E.value;
|
|
3544
|
+
if (M) z(b, M);
|
|
3545
3545
|
else {
|
|
3546
3546
|
b.state = c, b.outcome = T;
|
|
3547
3547
|
for (var G = -1, I = b.queue.length; ++G < I; ) b.queue[G].callFulfilled(T);
|
|
@@ -3549,7 +3549,7 @@ var Br = Xc(function(r, e) {
|
|
|
3549
3549
|
return b;
|
|
3550
3550
|
}, s.reject = function(b, T) {
|
|
3551
3551
|
b.state = d, b.outcome = T;
|
|
3552
|
-
for (var E = -1,
|
|
3552
|
+
for (var E = -1, M = b.queue.length; ++E < M; ) b.queue[E].callRejected(T);
|
|
3553
3553
|
return b;
|
|
3554
3554
|
}, f.resolve = function(b) {
|
|
3555
3555
|
return b instanceof this ? b : s.resolve(new this(a), b);
|
|
@@ -3559,26 +3559,26 @@ var Br = Xc(function(r, e) {
|
|
|
3559
3559
|
}, f.all = function(b) {
|
|
3560
3560
|
var T = this;
|
|
3561
3561
|
if (Object.prototype.toString.call(b) !== "[object Array]") return this.reject(new TypeError("must be an array"));
|
|
3562
|
-
var E = b.length,
|
|
3562
|
+
var E = b.length, M = !1;
|
|
3563
3563
|
if (!E) return this.resolve([]);
|
|
3564
3564
|
for (var G = new Array(E), I = 0, U = -1, L = new this(a); ++U < E; ) j(b[U], U);
|
|
3565
3565
|
return L;
|
|
3566
3566
|
function j($, K) {
|
|
3567
|
-
T.resolve($).then(function(
|
|
3568
|
-
G[K] =
|
|
3569
|
-
}, function(
|
|
3570
|
-
|
|
3567
|
+
T.resolve($).then(function(Z) {
|
|
3568
|
+
G[K] = Z, ++I !== E || M || (M = !0, s.resolve(L, G));
|
|
3569
|
+
}, function(Z) {
|
|
3570
|
+
M || (M = !0, s.reject(L, Z));
|
|
3571
3571
|
});
|
|
3572
3572
|
}
|
|
3573
3573
|
}, f.race = function(b) {
|
|
3574
3574
|
var T = this;
|
|
3575
3575
|
if (Object.prototype.toString.call(b) !== "[object Array]") return this.reject(new TypeError("must be an array"));
|
|
3576
|
-
var E = b.length,
|
|
3576
|
+
var E = b.length, M = !1;
|
|
3577
3577
|
if (!E) return this.resolve([]);
|
|
3578
3578
|
for (var G, I = -1, U = new this(a); ++I < E; ) G = b[I], T.resolve(G).then(function(L) {
|
|
3579
|
-
|
|
3579
|
+
M || (M = !0, s.resolve(U, L));
|
|
3580
3580
|
}, function(L) {
|
|
3581
|
-
|
|
3581
|
+
M || (M = !0, s.reject(U, L));
|
|
3582
3582
|
});
|
|
3583
3583
|
return U;
|
|
3584
3584
|
};
|
|
@@ -3664,7 +3664,7 @@ var Br = Xc(function(r, e) {
|
|
|
3664
3664
|
var p = k[y.name].deferredOperations.pop();
|
|
3665
3665
|
if (p) return p.reject(l), p.promise;
|
|
3666
3666
|
}
|
|
3667
|
-
function
|
|
3667
|
+
function M(y, l) {
|
|
3668
3668
|
return new d(function(p, m) {
|
|
3669
3669
|
if (k[y.name] = k[y.name] || { forages: [], db: null, dbReady: null, deferredOperations: [] }, y.db) {
|
|
3670
3670
|
if (!l) return p(y.db);
|
|
@@ -3692,10 +3692,10 @@ var Br = Xc(function(r, e) {
|
|
|
3692
3692
|
});
|
|
3693
3693
|
}
|
|
3694
3694
|
function G(y) {
|
|
3695
|
-
return
|
|
3695
|
+
return M(y, !1);
|
|
3696
3696
|
}
|
|
3697
3697
|
function I(y) {
|
|
3698
|
-
return
|
|
3698
|
+
return M(y, !0);
|
|
3699
3699
|
}
|
|
3700
3700
|
function U(y, l) {
|
|
3701
3701
|
if (!y.db) return !0;
|
|
@@ -3740,13 +3740,13 @@ var Br = Xc(function(r, e) {
|
|
|
3740
3740
|
var A = R[D];
|
|
3741
3741
|
A._dbInfo.db && (A._dbInfo.db.close(), A._dbInfo.db = null);
|
|
3742
3742
|
}
|
|
3743
|
-
return S.db = null, G(S).then(function(
|
|
3744
|
-
return S.db =
|
|
3745
|
-
}).then(function(
|
|
3746
|
-
S.db = C.db =
|
|
3747
|
-
for (var N = 0; N < R.length; N++) R[N]._dbInfo.db =
|
|
3748
|
-
}).catch(function(
|
|
3749
|
-
throw E(S,
|
|
3743
|
+
return S.db = null, G(S).then(function(O) {
|
|
3744
|
+
return S.db = O, U(S) ? I(S) : O;
|
|
3745
|
+
}).then(function(O) {
|
|
3746
|
+
S.db = C.db = O;
|
|
3747
|
+
for (var N = 0; N < R.length; N++) R[N]._dbInfo.db = O;
|
|
3748
|
+
}).catch(function(O) {
|
|
3749
|
+
throw E(S, O), O;
|
|
3750
3750
|
});
|
|
3751
3751
|
}(y).then(function() {
|
|
3752
3752
|
K(y, l, p, m - 1);
|
|
@@ -3755,7 +3755,7 @@ var Br = Xc(function(r, e) {
|
|
|
3755
3755
|
p(_);
|
|
3756
3756
|
}
|
|
3757
3757
|
}
|
|
3758
|
-
var
|
|
3758
|
+
var Z = { _driver: "asyncStorage", _initStorage: function(y) {
|
|
3759
3759
|
var l = this, p = { db: null };
|
|
3760
3760
|
if (y) for (var m in y) p[m] = y[m];
|
|
3761
3761
|
var v = k[p.name];
|
|
@@ -3775,8 +3775,8 @@ var Br = Xc(function(r, e) {
|
|
|
3775
3775
|
return p.db = A, U(p, l._defaultConfig.version) ? I(p) : A;
|
|
3776
3776
|
}).then(function(A) {
|
|
3777
3777
|
p.db = v.db = A, l._dbInfo = p;
|
|
3778
|
-
for (var
|
|
3779
|
-
var N = D[
|
|
3778
|
+
for (var O = 0; O < D.length; O++) {
|
|
3779
|
+
var N = D[O];
|
|
3780
3780
|
N !== l && (N._dbInfo.db = p.db, N._dbInfo.version = p.version);
|
|
3781
3781
|
}
|
|
3782
3782
|
});
|
|
@@ -3798,9 +3798,9 @@ var Br = Xc(function(r, e) {
|
|
|
3798
3798
|
R.onsuccess = function() {
|
|
3799
3799
|
var A = R.result;
|
|
3800
3800
|
if (A) {
|
|
3801
|
-
var
|
|
3802
|
-
j(
|
|
3803
|
-
var N = y(
|
|
3801
|
+
var O = A.value;
|
|
3802
|
+
j(O) && (O = L(O));
|
|
3803
|
+
var N = y(O, A.key, D++);
|
|
3804
3804
|
N !== void 0 ? v(N) : A.continue();
|
|
3805
3805
|
} else v();
|
|
3806
3806
|
}, R.onerror = function() {
|
|
@@ -3842,9 +3842,9 @@ var Br = Xc(function(r, e) {
|
|
|
3842
3842
|
var C;
|
|
3843
3843
|
m.ready().then(function() {
|
|
3844
3844
|
return C = m._dbInfo, z.call(l) === "[object Blob]" ? w(C.db).then(function(R) {
|
|
3845
|
-
return R ? l : (D = l, new d(function(A,
|
|
3845
|
+
return R ? l : (D = l, new d(function(A, O) {
|
|
3846
3846
|
var N = new FileReader();
|
|
3847
|
-
N.onerror =
|
|
3847
|
+
N.onerror = O, N.onloadend = function(H) {
|
|
3848
3848
|
var q = btoa(H.target.result || "");
|
|
3849
3849
|
A({ __local_forage_encoded_blob: !0, data: q, type: D.type });
|
|
3850
3850
|
}, N.readAsBinaryString(D);
|
|
@@ -3855,9 +3855,9 @@ var Br = Xc(function(r, e) {
|
|
|
3855
3855
|
K(m._dbInfo, "readwrite", function(D, A) {
|
|
3856
3856
|
if (D) return S(D);
|
|
3857
3857
|
try {
|
|
3858
|
-
var
|
|
3858
|
+
var O = A.objectStore(m._dbInfo.storeName);
|
|
3859
3859
|
R === null && (R = void 0);
|
|
3860
|
-
var N =
|
|
3860
|
+
var N = O.put(R, y);
|
|
3861
3861
|
A.oncomplete = function() {
|
|
3862
3862
|
R === void 0 && (R = null), _(R);
|
|
3863
3863
|
}, A.onabort = A.onerror = function() {
|
|
@@ -3954,13 +3954,13 @@ var Br = Xc(function(r, e) {
|
|
|
3954
3954
|
try {
|
|
3955
3955
|
var R = C.objectStore(p._dbInfo.storeName), D = !1, A = (R.openKeyCursor || R.openCursor).call(R);
|
|
3956
3956
|
A.onsuccess = function() {
|
|
3957
|
-
var
|
|
3958
|
-
|
|
3957
|
+
var O = A.result;
|
|
3958
|
+
O ? y === 0 || D ? v(O.key) : (D = !0, O.advance(y)) : v(null);
|
|
3959
3959
|
}, A.onerror = function() {
|
|
3960
3960
|
_(A.error);
|
|
3961
3961
|
};
|
|
3962
|
-
} catch (
|
|
3963
|
-
_(
|
|
3962
|
+
} catch (O) {
|
|
3963
|
+
_(O);
|
|
3964
3964
|
}
|
|
3965
3965
|
});
|
|
3966
3966
|
}).catch(_);
|
|
@@ -4004,8 +4004,8 @@ var Br = Xc(function(r, e) {
|
|
|
4004
4004
|
b(y);
|
|
4005
4005
|
var D = k[y.name], A = D.forages;
|
|
4006
4006
|
C.close();
|
|
4007
|
-
for (var
|
|
4008
|
-
var N = A[
|
|
4007
|
+
for (var O = 0; O < A.length; O++) {
|
|
4008
|
+
var N = A[O];
|
|
4009
4009
|
N._dbInfo.db = null, N._dbInfo.version = R;
|
|
4010
4010
|
}
|
|
4011
4011
|
return new d(function(H, q) {
|
|
@@ -4034,7 +4034,7 @@ var Br = Xc(function(r, e) {
|
|
|
4034
4034
|
var R = k[y.name], D = R.forages;
|
|
4035
4035
|
C.close();
|
|
4036
4036
|
for (var A = 0; A < D.length; A++) D[A]._dbInfo.db = null;
|
|
4037
|
-
return new d(function(
|
|
4037
|
+
return new d(function(O, N) {
|
|
4038
4038
|
var H = a.deleteDatabase(y.name);
|
|
4039
4039
|
H.onerror = function() {
|
|
4040
4040
|
var q = H.result;
|
|
@@ -4043,14 +4043,14 @@ var Br = Xc(function(r, e) {
|
|
|
4043
4043
|
console.warn('dropInstance blocked for database "' + y.name + '" until all open connections are closed');
|
|
4044
4044
|
}, H.onsuccess = function() {
|
|
4045
4045
|
var q = H.result;
|
|
4046
|
-
q && q.close(),
|
|
4046
|
+
q && q.close(), O(q);
|
|
4047
4047
|
};
|
|
4048
|
-
}).then(function(
|
|
4049
|
-
R.db =
|
|
4048
|
+
}).then(function(O) {
|
|
4049
|
+
R.db = O;
|
|
4050
4050
|
for (var N = 0; N < D.length; N++) T(D[N]._dbInfo);
|
|
4051
|
-
}).catch(function(
|
|
4052
|
-
throw (E(y,
|
|
4053
|
-
}),
|
|
4051
|
+
}).catch(function(O) {
|
|
4052
|
+
throw (E(y, O) || d.resolve()).catch(function() {
|
|
4053
|
+
}), O;
|
|
4054
4054
|
});
|
|
4055
4055
|
});
|
|
4056
4056
|
} else m = d.reject("Invalid arguments");
|
|
@@ -4138,8 +4138,8 @@ var Br = Xc(function(r, e) {
|
|
|
4138
4138
|
v.ready().then(function() {
|
|
4139
4139
|
l === void 0 && (l = null);
|
|
4140
4140
|
var R = l, D = v._dbInfo;
|
|
4141
|
-
D.serializer.serialize(l, function(A,
|
|
4142
|
-
|
|
4141
|
+
D.serializer.serialize(l, function(A, O) {
|
|
4142
|
+
O ? C(O) : D.db.transaction(function(N) {
|
|
4143
4143
|
re(N, D, "INSERT OR REPLACE INTO " + D.storeName + " (key, value) VALUES (?, ?)", [y, A], function() {
|
|
4144
4144
|
S(R);
|
|
4145
4145
|
}, function(H, q) {
|
|
@@ -4194,7 +4194,7 @@ var Br = Xc(function(r, e) {
|
|
|
4194
4194
|
var S = p._dbInfo;
|
|
4195
4195
|
S.db.transaction(function(C) {
|
|
4196
4196
|
re(C, S, "SELECT * FROM " + S.storeName, [], function(R, D) {
|
|
4197
|
-
for (var A = D.rows,
|
|
4197
|
+
for (var A = D.rows, O = A.length, N = 0; N < O; N++) {
|
|
4198
4198
|
var H = A.item(N), q = H.value;
|
|
4199
4199
|
if (q && (q = S.serializer.deserialize(q)), (q = y(q, H.key, N + 1)) !== void 0) return void v(q);
|
|
4200
4200
|
}
|
|
@@ -4320,7 +4320,7 @@ var Br = Xc(function(r, e) {
|
|
|
4320
4320
|
});
|
|
4321
4321
|
});
|
|
4322
4322
|
}
|
|
4323
|
-
for (var A = [],
|
|
4323
|
+
for (var A = [], O = 0, N = _.storeNames.length; O < N; O++) A.push(D(_.storeNames[O]));
|
|
4324
4324
|
d.all(A).then(function() {
|
|
4325
4325
|
S();
|
|
4326
4326
|
}).catch(function(H) {
|
|
@@ -4360,8 +4360,8 @@ var Br = Xc(function(r, e) {
|
|
|
4360
4360
|
for (var v = p._dbInfo, _ = v.keyPrefix, S = _.length, C = localStorage.length, R = 1, D = 0; D < C; D++) {
|
|
4361
4361
|
var A = localStorage.key(D);
|
|
4362
4362
|
if (A.indexOf(_) === 0) {
|
|
4363
|
-
var
|
|
4364
|
-
if (
|
|
4363
|
+
var O = localStorage.getItem(A);
|
|
4364
|
+
if (O && (O = v.serializer.deserialize(O)), (O = y(O, A.substring(S), R++)) !== void 0) return O;
|
|
4365
4365
|
}
|
|
4366
4366
|
}
|
|
4367
4367
|
});
|
|
@@ -4386,8 +4386,8 @@ var Br = Xc(function(r, e) {
|
|
|
4386
4386
|
if (A) C(A);
|
|
4387
4387
|
else try {
|
|
4388
4388
|
localStorage.setItem(R.keyPrefix + y, D), S(_);
|
|
4389
|
-
} catch (
|
|
4390
|
-
|
|
4389
|
+
} catch (O) {
|
|
4390
|
+
O.name !== "QuotaExceededError" && O.name !== "NS_ERROR_DOM_QUOTA_REACHED" || C(O), C(O);
|
|
4391
4391
|
}
|
|
4392
4392
|
});
|
|
4393
4393
|
});
|
|
@@ -4456,7 +4456,7 @@ var Br = Xc(function(r, e) {
|
|
|
4456
4456
|
return !1;
|
|
4457
4457
|
}, mt = Array.isArray || function(y) {
|
|
4458
4458
|
return Object.prototype.toString.call(y) === "[object Array]";
|
|
4459
|
-
}, He = {}, Te = {}, De = { INDEXEDDB:
|
|
4459
|
+
}, He = {}, Te = {}, De = { INDEXEDDB: Z, WEBSQL: pe, LOCALSTORAGE: Le }, Ue = [De.INDEXEDDB._driver, De.WEBSQL._driver, De.LOCALSTORAGE._driver], Ge = ["dropInstance"], Ne = ["clear", "getItem", "iterate", "key", "keys", "length", "removeItem", "setItem"].concat(Ge), Ze = { description: "", driver: Ue.slice(), name: "localforage", size: 4980736, storeName: "keyvaluepairs", version: 1 };
|
|
4460
4460
|
function gt(y, l) {
|
|
4461
4461
|
y[l] = function() {
|
|
4462
4462
|
var p = arguments;
|
|
@@ -4498,7 +4498,7 @@ var Br = Xc(function(r, e) {
|
|
|
4498
4498
|
try {
|
|
4499
4499
|
var C = l._driver, R = new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");
|
|
4500
4500
|
if (!l._driver) return void S(R);
|
|
4501
|
-
for (var D = Ne.concat("_initStorage"), A = 0,
|
|
4501
|
+
for (var D = Ne.concat("_initStorage"), A = 0, O = D.length; A < O; A++) {
|
|
4502
4502
|
var N = D[A];
|
|
4503
4503
|
if ((!At(Ge, N) || l[N]) && typeof l[N] != "function") return void S(R);
|
|
4504
4504
|
}
|
|
@@ -4551,12 +4551,12 @@ var Br = Xc(function(r, e) {
|
|
|
4551
4551
|
return this._driverSet = R.then(function() {
|
|
4552
4552
|
var D = _[0];
|
|
4553
4553
|
return v._dbInfo = null, v._ready = null, v.getDriver(D).then(function(A) {
|
|
4554
|
-
v._driver = A._driver, S(), v._wrapLibraryMethodsWithReady(), v._initDriver = /* @__PURE__ */ function(
|
|
4554
|
+
v._driver = A._driver, S(), v._wrapLibraryMethodsWithReady(), v._initDriver = /* @__PURE__ */ function(O) {
|
|
4555
4555
|
return function() {
|
|
4556
4556
|
var N = 0;
|
|
4557
4557
|
return function H() {
|
|
4558
|
-
for (; N <
|
|
4559
|
-
var q =
|
|
4558
|
+
for (; N < O.length; ) {
|
|
4559
|
+
var q = O[N];
|
|
4560
4560
|
return N++, v._dbInfo = null, v._ready = null, v.getDriver(q).then(C).catch(H);
|
|
4561
4561
|
}
|
|
4562
4562
|
S();
|
|
@@ -4752,10 +4752,10 @@ var Br = Xc(function(r, e) {
|
|
|
4752
4752
|
return r.prototype.init = function() {
|
|
4753
4753
|
var e, t = window.navigator.userAgent, n = window.navigator.language, i = document.referrer, o = i ? Ho(i).hostname : "", a = Ln(window.location.href), s = /Mobile|htc|mini|Android|iP(ad|od|hone)/.test(this.appVersion) ? "wap" : "web", d = ((e = window.navigator.connection) === null || e === void 0 ? void 0 : e.effectiveType) || "";
|
|
4754
4754
|
this.utm = function(f, h, g, k) {
|
|
4755
|
-
var z = new ng(), w = f ? "_tea_utm_cache_" + f : "_tea_utm_cache", b = f ? "_$utm_from_url_" + f : "_$utm_from_url", T = {}, E = ["tr_shareuser", "tr_admaster", "tr_param1", "tr_param2", "tr_param3", "tr_param4", "$utm_from_url"],
|
|
4755
|
+
var z = new ng(), w = f ? "_tea_utm_cache_" + f : "_tea_utm_cache", b = f ? "_$utm_from_url_" + f : "_$utm_from_url", T = {}, E = ["tr_shareuser", "tr_admaster", "tr_param1", "tr_param2", "tr_param3", "tr_param4", "$utm_from_url"], M = { ad_id: Number(h.ad_id) || void 0, campaign_id: Number(h.campaign_id) || void 0, creative_id: Number(h.creative_id) || void 0, utm_source: h.utm_source, utm_medium: h.utm_medium, utm_campaign: h.utm_campaign, utm_term: h.utm_term, utm_content: h.utm_content, tr_shareuser: h.tr_shareuser, tr_admaster: h.tr_admaster, tr_param1: h.tr_param1, tr_param2: h.tr_param2, tr_param3: h.tr_param3, tr_param4: h.tr_param4 };
|
|
4756
4756
|
try {
|
|
4757
4757
|
var G = !1;
|
|
4758
|
-
for (var I in
|
|
4758
|
+
for (var I in M) M[I] && (E.indexOf(I) !== -1 ? (T.hasOwnProperty("tracer_data") || (T.tracer_data = {}), T.tracer_data[I] = M[I]) : T[I] = M[I], G = !0);
|
|
4759
4759
|
if (G) z.setSessionItem(b, "1"), z.setCookie(w, JSON.stringify(T), k, g);
|
|
4760
4760
|
else {
|
|
4761
4761
|
var U = z.getCookie(w, g);
|
|
@@ -4763,7 +4763,7 @@ var Br = Xc(function(r, e) {
|
|
|
4763
4763
|
}
|
|
4764
4764
|
z.getSessionItem(b) == 1 && (T.hasOwnProperty("tracer_data") || (T.tracer_data = {}), T.tracer_data.$utm_from_url = 1);
|
|
4765
4765
|
} catch {
|
|
4766
|
-
return
|
|
4766
|
+
return M;
|
|
4767
4767
|
}
|
|
4768
4768
|
return T;
|
|
4769
4769
|
}(this.appid, a, this.domain, this.cookie_expire);
|
|
@@ -5571,7 +5571,7 @@ var F = io, ie = void 0, Yc = (/* @__PURE__ */ new Date()).getTimezoneOffset(),
|
|
|
5571
5571
|
} else t("");
|
|
5572
5572
|
});
|
|
5573
5573
|
}, r;
|
|
5574
|
-
}(),
|
|
5574
|
+
}(), Mr = function() {
|
|
5575
5575
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(r) {
|
|
5576
5576
|
var e = 16 * Math.random() | 0;
|
|
5577
5577
|
return (r === "x" ? e : 3 & e | 8).toString(16);
|
|
@@ -5590,11 +5590,11 @@ var F = io, ie = void 0, Yc = (/* @__PURE__ */ new Date()).getTimezoneOffset(),
|
|
|
5590
5590
|
var e = this.storage.getItem(this.sessionKey);
|
|
5591
5591
|
if (e && e.sessionId) {
|
|
5592
5592
|
var t = e.timestamp;
|
|
5593
|
-
Date.now() - t > this.expireTime ? e = { sessionId:
|
|
5593
|
+
Date.now() - t > this.expireTime ? e = { sessionId: Mr(), timestamp: Date.now() } : e.timestamp = Date.now(), this.storage.setItem(this.sessionKey, e), this.resetExpTime();
|
|
5594
5594
|
}
|
|
5595
5595
|
}, r.prototype.setSessionId = function() {
|
|
5596
5596
|
var e = this, t = this.storage.getItem(this.sessionKey);
|
|
5597
|
-
t && t.sessionId ? t.timestamp = Date.now() : t = { sessionId:
|
|
5597
|
+
t && t.sessionId ? t.timestamp = Date.now() : t = { sessionId: Mr(), timestamp: Date.now() }, this.storage.setItem(this.sessionKey, t), this.disableSessionTimeCheck || (this.sessionExp = setInterval(function() {
|
|
5598
5598
|
e.checkEXp();
|
|
5599
5599
|
}, this.expireTime));
|
|
5600
5600
|
}, r.prototype.getSessionId = function() {
|
|
@@ -5606,11 +5606,11 @@ var F = io, ie = void 0, Yc = (/* @__PURE__ */ new Date()).getTimezoneOffset(),
|
|
|
5606
5606
|
e.checkEXp();
|
|
5607
5607
|
}, this.expireTime));
|
|
5608
5608
|
}, r.prototype.resetSessionId = function(e) {
|
|
5609
|
-
var t = { sessionId: e ||
|
|
5609
|
+
var t = { sessionId: e || Mr(), timestamp: Date.now() };
|
|
5610
5610
|
this.storage.setItem(this.sessionKey, t);
|
|
5611
5611
|
}, r.prototype.checkEXp = function() {
|
|
5612
5612
|
var e = this.storage.getItem(this.sessionKey);
|
|
5613
|
-
e && e.sessionId && Date.now() - e.timestamp + 30 >= this.expireTime && (e = { sessionId:
|
|
5613
|
+
e && e.sessionId && Date.now() - e.timestamp + 30 >= this.expireTime && (e = { sessionId: Mr(), timestamp: Date.now() }, this.storage.setItem(this.sessionKey, e));
|
|
5614
5614
|
}, r;
|
|
5615
5615
|
}();
|
|
5616
5616
|
function wr(r) {
|
|
@@ -5690,15 +5690,15 @@ const Qc = (r) => r < 256 ? an[r] : an[256 + (r >>> 7)], cn = (r, e) => {
|
|
|
5690
5690
|
while (r.heap_len >= 2);
|
|
5691
5691
|
r.heap[--r.heap_max] = r.heap[1], ((u, f) => {
|
|
5692
5692
|
const h = f.dyn_tree, g = f.max_code, k = f.stat_desc.static_tree, z = f.stat_desc.has_stree, w = f.stat_desc.extra_bits, b = f.stat_desc.extra_base, T = f.stat_desc.max_length;
|
|
5693
|
-
let E,
|
|
5693
|
+
let E, M, G, I, U, L, j = 0;
|
|
5694
5694
|
for (I = 0; I <= 15; I++) u.bl_count[I] = 0;
|
|
5695
|
-
for (h[2 * u.heap[u.heap_max] + 1] = 0, E = u.heap_max + 1; E < 573; E++)
|
|
5695
|
+
for (h[2 * u.heap[u.heap_max] + 1] = 0, E = u.heap_max + 1; E < 573; E++) M = u.heap[E], I = h[2 * h[2 * M + 1] + 1] + 1, I > T && (I = T, j++), h[2 * M + 1] = I, M > g || (u.bl_count[I]++, U = 0, M >= b && (U = w[M - b]), L = h[2 * M], u.opt_len += L * (I + U), z && (u.static_len += L * (k[2 * M + 1] + U)));
|
|
5696
5696
|
if (j !== 0) {
|
|
5697
5697
|
do {
|
|
5698
5698
|
for (I = T - 1; u.bl_count[I] === 0; ) I--;
|
|
5699
5699
|
u.bl_count[I]--, u.bl_count[I + 1] += 2, u.bl_count[T]--, j -= 2;
|
|
5700
5700
|
} while (j > 0);
|
|
5701
|
-
for (I = T; I !== 0; I--) for (
|
|
5701
|
+
for (I = T; I !== 0; I--) for (M = u.bl_count[I]; M !== 0; ) G = u.heap[--E], G > g || (h[2 * G + 1] !== I && (u.opt_len += (I - h[2 * G + 1]) * h[2 * G], h[2 * G + 1] = I), M--);
|
|
5702
5702
|
}
|
|
5703
5703
|
})(r, e), tu(t, c, r.bl_count);
|
|
5704
5704
|
}, ta = (r, e, t) => {
|
|
@@ -5780,7 +5780,7 @@ var Ie = (r, e, t, n) => {
|
|
|
5780
5780
|
for (let a = n; a < o; a++) r = r >>> 8 ^ i[255 & (r ^ e[a])];
|
|
5781
5781
|
return -1 ^ r;
|
|
5782
5782
|
}, er = { 2: "need dictionary", 1: "stream end", 0: "", "-1": "file error", "-2": "stream error", "-3": "data error", "-4": "insufficient memory", "-5": "buffer error", "-6": "incompatible version" }, nr = { Z_NO_FLUSH: 0, Z_PARTIAL_FLUSH: 1, Z_SYNC_FLUSH: 2, Z_FULL_FLUSH: 3, Z_FINISH: 4, Z_BLOCK: 5, Z_TREES: 6, Z_OK: 0, Z_STREAM_END: 1, Z_NEED_DICT: 2, Z_ERRNO: -1, Z_STREAM_ERROR: -2, Z_DATA_ERROR: -3, Z_MEM_ERROR: -4, Z_BUF_ERROR: -5, Z_NO_COMPRESSION: 0, Z_BEST_SPEED: 1, Z_BEST_COMPRESSION: 9, Z_DEFAULT_COMPRESSION: -1, Z_FILTERED: 1, Z_HUFFMAN_ONLY: 2, Z_RLE: 3, Z_FIXED: 4, Z_DEFAULT_STRATEGY: 0, Z_BINARY: 0, Z_TEXT: 1, Z_UNKNOWN: 2, Z_DEFLATED: 8 };
|
|
5783
|
-
const { _tr_init: wg, _tr_stored_block: ao, _tr_flush_block: Cg, _tr_tally: Pt, _tr_align: kg } = bg, { Z_NO_FLUSH: Lt, Z_PARTIAL_FLUSH: Tg, Z_FULL_FLUSH: zg, Z_FINISH: rt, Z_BLOCK: oa, Z_OK:
|
|
5783
|
+
const { _tr_init: wg, _tr_stored_block: ao, _tr_flush_block: Cg, _tr_tally: Pt, _tr_align: kg } = bg, { Z_NO_FLUSH: Lt, Z_PARTIAL_FLUSH: Tg, Z_FULL_FLUSH: zg, Z_FINISH: rt, Z_BLOCK: oa, Z_OK: Oe, Z_STREAM_END: sa, Z_STREAM_ERROR: lt, Z_DATA_ERROR: Rg, Z_BUF_ERROR: yi, Z_DEFAULT_COMPRESSION: Dg, Z_FILTERED: Ag, Z_HUFFMAN_ONLY: bn, Z_RLE: Ig, Z_FIXED: xg, Z_DEFAULT_STRATEGY: Og, Z_UNKNOWN: Mg, Z_DEFLATED: Gn } = nr, $t = (r, e) => (r.msg = er[e], e), aa = (r) => 2 * r - (r > 4 ? 9 : 0), It = (r) => {
|
|
5784
5784
|
let e = r.length;
|
|
5785
5785
|
for (; --e >= 0; ) r[e] = 0;
|
|
5786
5786
|
}, Pg = (r) => {
|
|
@@ -5890,13 +5890,13 @@ const Ur = (r) => {
|
|
|
5890
5890
|
return !e || e.strm !== r || e.status !== 42 && e.status !== 57 && e.status !== 69 && e.status !== 73 && e.status !== 91 && e.status !== 103 && e.status !== 113 && e.status !== 666 ? 1 : 0;
|
|
5891
5891
|
}, ou = (r) => {
|
|
5892
5892
|
if (Ur(r)) return $t(r, lt);
|
|
5893
|
-
r.total_in = r.total_out = 0, r.data_type =
|
|
5893
|
+
r.total_in = r.total_out = 0, r.data_type = Mg;
|
|
5894
5894
|
const e = r.state;
|
|
5895
|
-
return e.pending = 0, e.pending_out = 0, e.wrap < 0 && (e.wrap = -e.wrap), e.status = e.wrap === 2 ? 57 : e.wrap ? 42 : 113, r.adler = e.wrap === 2 ? 0 : 1, e.last_flush = -2, wg(e),
|
|
5895
|
+
return e.pending = 0, e.pending_out = 0, e.wrap < 0 && (e.wrap = -e.wrap), e.status = e.wrap === 2 ? 57 : e.wrap ? 42 : 113, r.adler = e.wrap === 2 ? 0 : 1, e.last_flush = -2, wg(e), Oe;
|
|
5896
5896
|
}, su = (r) => {
|
|
5897
5897
|
const e = ou(r);
|
|
5898
5898
|
var t;
|
|
5899
|
-
return e ===
|
|
5899
|
+
return e === Oe && ((t = r.state).window_size = 2 * t.w_size, It(t.head), t.max_lazy_match = Lr[t.level].max_lazy, t.good_match = Lr[t.level].good_length, t.nice_match = Lr[t.level].nice_length, t.max_chain_length = Lr[t.level].max_chain, t.strstart = 0, t.block_start = 0, t.lookahead = 0, t.insert = 0, t.match_length = t.prev_length = 2, t.match_available = 0, t.ins_h = 0), e;
|
|
5900
5900
|
}, ca = (r, e, t, n, i, o) => {
|
|
5901
5901
|
if (!r) return lt;
|
|
5902
5902
|
let a = 1;
|
|
@@ -5905,29 +5905,29 @@ const Ur = (r) => {
|
|
|
5905
5905
|
const s = new Lg();
|
|
5906
5906
|
return r.state = s, s.strm = r, s.status = 42, s.wrap = a, s.gzhead = null, s.w_bits = n, s.w_size = 1 << s.w_bits, s.w_mask = s.w_size - 1, s.hash_bits = i + 7, s.hash_size = 1 << s.hash_bits, s.hash_mask = s.hash_size - 1, s.hash_shift = ~~((s.hash_bits + 3 - 1) / 3), s.window = new Uint8Array(2 * s.w_size), s.head = new Uint16Array(s.hash_size), s.prev = new Uint16Array(s.w_size), s.lit_bufsize = 1 << i + 6, s.pending_buf_size = 4 * s.lit_bufsize, s.pending_buf = new Uint8Array(s.pending_buf_size), s.sym_buf = s.lit_bufsize, s.sym_end = 3 * (s.lit_bufsize - 1), s.level = e, s.strategy = o, s.method = t, su(r);
|
|
5907
5907
|
};
|
|
5908
|
-
var jr = { deflateInit: (r, e) => ca(r, e, Gn, 15, 8,
|
|
5908
|
+
var jr = { deflateInit: (r, e) => ca(r, e, Gn, 15, 8, Og), deflateInit2: ca, deflateReset: su, deflateResetKeep: ou, deflateSetHeader: (r, e) => Ur(r) || r.state.wrap !== 2 ? lt : (r.state.gzhead = e, Oe), deflate: (r, e) => {
|
|
5909
5909
|
if (Ur(r) || e > oa || e < 0) return r ? $t(r, lt) : lt;
|
|
5910
5910
|
const t = r.state;
|
|
5911
5911
|
if (!r.output || r.avail_in !== 0 && !r.input || t.status === 666 && e !== rt) return $t(r, r.avail_out === 0 ? yi : lt);
|
|
5912
5912
|
const n = t.last_flush;
|
|
5913
5913
|
if (t.last_flush = e, t.pending !== 0) {
|
|
5914
|
-
if (Ke(r), r.avail_out === 0) return t.last_flush = -1,
|
|
5914
|
+
if (Ke(r), r.avail_out === 0) return t.last_flush = -1, Oe;
|
|
5915
5915
|
} else if (r.avail_in === 0 && aa(e) <= aa(n) && e !== rt) return $t(r, yi);
|
|
5916
5916
|
if (t.status === 666 && r.avail_in !== 0) return $t(r, yi);
|
|
5917
5917
|
if (t.status === 42 && t.wrap === 0 && (t.status = 113), t.status === 42) {
|
|
5918
5918
|
let i = Gn + (t.w_bits - 8 << 4) << 8, o = -1;
|
|
5919
|
-
if (o = t.strategy >= bn || t.level < 2 ? 0 : t.level < 6 ? 1 : t.level === 6 ? 2 : 3, i |= o << 6, t.strstart !== 0 && (i |= 32), i += 31 - i % 31, zr(t, i), t.strstart !== 0 && (zr(t, r.adler >>> 16), zr(t, 65535 & r.adler)), r.adler = 1, t.status = 113, Ke(r), t.pending !== 0) return t.last_flush = -1,
|
|
5919
|
+
if (o = t.strategy >= bn || t.level < 2 ? 0 : t.level < 6 ? 1 : t.level === 6 ? 2 : 3, i |= o << 6, t.strstart !== 0 && (i |= 32), i += 31 - i % 31, zr(t, i), t.strstart !== 0 && (zr(t, r.adler >>> 16), zr(t, 65535 & r.adler)), r.adler = 1, t.status = 113, Ke(r), t.pending !== 0) return t.last_flush = -1, Oe;
|
|
5920
5920
|
}
|
|
5921
5921
|
if (t.status === 57) {
|
|
5922
5922
|
if (r.adler = 0, ae(t, 31), ae(t, 139), ae(t, 8), t.gzhead) ae(t, (t.gzhead.text ? 1 : 0) + (t.gzhead.hcrc ? 2 : 0) + (t.gzhead.extra ? 4 : 0) + (t.gzhead.name ? 8 : 0) + (t.gzhead.comment ? 16 : 0)), ae(t, 255 & t.gzhead.time), ae(t, t.gzhead.time >> 8 & 255), ae(t, t.gzhead.time >> 16 & 255), ae(t, t.gzhead.time >> 24 & 255), ae(t, t.level === 9 ? 2 : t.strategy >= bn || t.level < 2 ? 4 : 0), ae(t, 255 & t.gzhead.os), t.gzhead.extra && t.gzhead.extra.length && (ae(t, 255 & t.gzhead.extra.length), ae(t, t.gzhead.extra.length >> 8 & 255)), t.gzhead.hcrc && (r.adler = Ie(r.adler, t.pending_buf, t.pending, 0)), t.gzindex = 0, t.status = 69;
|
|
5923
|
-
else if (ae(t, 0), ae(t, 0), ae(t, 0), ae(t, 0), ae(t, 0), ae(t, t.level === 9 ? 2 : t.strategy >= bn || t.level < 2 ? 4 : 0), ae(t, 3), t.status = 113, Ke(r), t.pending !== 0) return t.last_flush = -1,
|
|
5923
|
+
else if (ae(t, 0), ae(t, 0), ae(t, 0), ae(t, 0), ae(t, 0), ae(t, t.level === 9 ? 2 : t.strategy >= bn || t.level < 2 ? 4 : 0), ae(t, 3), t.status = 113, Ke(r), t.pending !== 0) return t.last_flush = -1, Oe;
|
|
5924
5924
|
}
|
|
5925
5925
|
if (t.status === 69) {
|
|
5926
5926
|
if (t.gzhead.extra) {
|
|
5927
5927
|
let i = t.pending, o = (65535 & t.gzhead.extra.length) - t.gzindex;
|
|
5928
5928
|
for (; t.pending + o > t.pending_buf_size; ) {
|
|
5929
5929
|
let s = t.pending_buf_size - t.pending;
|
|
5930
|
-
if (t.pending_buf.set(t.gzhead.extra.subarray(t.gzindex, t.gzindex + s), t.pending), t.pending = t.pending_buf_size, t.gzhead.hcrc && t.pending > i && (r.adler = Ie(r.adler, t.pending_buf, t.pending - i, i)), t.gzindex += s, Ke(r), t.pending !== 0) return t.last_flush = -1,
|
|
5930
|
+
if (t.pending_buf.set(t.gzhead.extra.subarray(t.gzindex, t.gzindex + s), t.pending), t.pending = t.pending_buf_size, t.gzhead.hcrc && t.pending > i && (r.adler = Ie(r.adler, t.pending_buf, t.pending - i, i)), t.gzindex += s, Ke(r), t.pending !== 0) return t.last_flush = -1, Oe;
|
|
5931
5931
|
i = 0, o -= s;
|
|
5932
5932
|
}
|
|
5933
5933
|
let a = new Uint8Array(t.gzhead.extra);
|
|
@@ -5940,7 +5940,7 @@ var jr = { deflateInit: (r, e) => ca(r, e, Gn, 15, 8, Mg), deflateInit2: ca, def
|
|
|
5940
5940
|
let i, o = t.pending;
|
|
5941
5941
|
do {
|
|
5942
5942
|
if (t.pending === t.pending_buf_size) {
|
|
5943
|
-
if (t.gzhead.hcrc && t.pending > o && (r.adler = Ie(r.adler, t.pending_buf, t.pending - o, o)), Ke(r), t.pending !== 0) return t.last_flush = -1,
|
|
5943
|
+
if (t.gzhead.hcrc && t.pending > o && (r.adler = Ie(r.adler, t.pending_buf, t.pending - o, o)), Ke(r), t.pending !== 0) return t.last_flush = -1, Oe;
|
|
5944
5944
|
o = 0;
|
|
5945
5945
|
}
|
|
5946
5946
|
i = t.gzindex < t.gzhead.name.length ? 255 & t.gzhead.name.charCodeAt(t.gzindex++) : 0, ae(t, i);
|
|
@@ -5954,7 +5954,7 @@ var jr = { deflateInit: (r, e) => ca(r, e, Gn, 15, 8, Mg), deflateInit2: ca, def
|
|
|
5954
5954
|
let i, o = t.pending;
|
|
5955
5955
|
do {
|
|
5956
5956
|
if (t.pending === t.pending_buf_size) {
|
|
5957
|
-
if (t.gzhead.hcrc && t.pending > o && (r.adler = Ie(r.adler, t.pending_buf, t.pending - o, o)), Ke(r), t.pending !== 0) return t.last_flush = -1,
|
|
5957
|
+
if (t.gzhead.hcrc && t.pending > o && (r.adler = Ie(r.adler, t.pending_buf, t.pending - o, o)), Ke(r), t.pending !== 0) return t.last_flush = -1, Oe;
|
|
5958
5958
|
o = 0;
|
|
5959
5959
|
}
|
|
5960
5960
|
i = t.gzindex < t.gzhead.comment.length ? 255 & t.gzhead.comment.charCodeAt(t.gzindex++) : 0, ae(t, i);
|
|
@@ -5965,10 +5965,10 @@ var jr = { deflateInit: (r, e) => ca(r, e, Gn, 15, 8, Mg), deflateInit2: ca, def
|
|
|
5965
5965
|
}
|
|
5966
5966
|
if (t.status === 103) {
|
|
5967
5967
|
if (t.gzhead.hcrc) {
|
|
5968
|
-
if (t.pending + 2 > t.pending_buf_size && (Ke(r), t.pending !== 0)) return t.last_flush = -1,
|
|
5968
|
+
if (t.pending + 2 > t.pending_buf_size && (Ke(r), t.pending !== 0)) return t.last_flush = -1, Oe;
|
|
5969
5969
|
ae(t, 255 & r.adler), ae(t, r.adler >> 8 & 255), r.adler = 0;
|
|
5970
5970
|
}
|
|
5971
|
-
if (t.status = 113, Ke(r), t.pending !== 0) return t.last_flush = -1,
|
|
5971
|
+
if (t.status = 113, Ke(r), t.pending !== 0) return t.last_flush = -1, Oe;
|
|
5972
5972
|
}
|
|
5973
5973
|
if (r.avail_in !== 0 || t.lookahead !== 0 || e !== Lt && t.status !== 666) {
|
|
5974
5974
|
let i = t.level === 0 ? iu(t, e) : t.strategy === bn ? ((o, a) => {
|
|
@@ -6000,14 +6000,14 @@ var jr = { deflateInit: (r, e) => ca(r, e, Gn, 15, 8, Mg), deflateInit2: ca, def
|
|
|
6000
6000
|
}
|
|
6001
6001
|
return o.insert = 0, a === rt ? (Je(o, !0), o.strm.avail_out === 0 ? 3 : 4) : o.sym_next && (Je(o, !1), o.strm.avail_out === 0) ? 1 : 2;
|
|
6002
6002
|
})(t, e) : Lr[t.level].func(t, e);
|
|
6003
|
-
if (i !== 3 && i !== 4 || (t.status = 666), i === 1 || i === 3) return r.avail_out === 0 && (t.last_flush = -1),
|
|
6004
|
-
if (i === 2 && (e === Tg ? kg(t) : e !== oa && (ao(t, 0, 0, !1), e === zg && (It(t.head), t.lookahead === 0 && (t.strstart = 0, t.block_start = 0, t.insert = 0))), Ke(r), r.avail_out === 0)) return t.last_flush = -1,
|
|
6003
|
+
if (i !== 3 && i !== 4 || (t.status = 666), i === 1 || i === 3) return r.avail_out === 0 && (t.last_flush = -1), Oe;
|
|
6004
|
+
if (i === 2 && (e === Tg ? kg(t) : e !== oa && (ao(t, 0, 0, !1), e === zg && (It(t.head), t.lookahead === 0 && (t.strstart = 0, t.block_start = 0, t.insert = 0))), Ke(r), r.avail_out === 0)) return t.last_flush = -1, Oe;
|
|
6005
6005
|
}
|
|
6006
|
-
return e !== rt ?
|
|
6006
|
+
return e !== rt ? Oe : t.wrap <= 0 ? sa : (t.wrap === 2 ? (ae(t, 255 & r.adler), ae(t, r.adler >> 8 & 255), ae(t, r.adler >> 16 & 255), ae(t, r.adler >> 24 & 255), ae(t, 255 & r.total_in), ae(t, r.total_in >> 8 & 255), ae(t, r.total_in >> 16 & 255), ae(t, r.total_in >> 24 & 255)) : (zr(t, r.adler >>> 16), zr(t, 65535 & r.adler)), Ke(r), t.wrap > 0 && (t.wrap = -t.wrap), t.pending !== 0 ? Oe : sa);
|
|
6007
6007
|
}, deflateEnd: (r) => {
|
|
6008
6008
|
if (Ur(r)) return lt;
|
|
6009
6009
|
const e = r.state.status;
|
|
6010
|
-
return r.state = null, e === 113 ? $t(r, Rg) :
|
|
6010
|
+
return r.state = null, e === 113 ? $t(r, Rg) : Oe;
|
|
6011
6011
|
}, deflateSetDictionary: (r, e) => {
|
|
6012
6012
|
let t = e.length;
|
|
6013
6013
|
if (Ur(r)) return lt;
|
|
@@ -6026,7 +6026,7 @@ var jr = { deflateInit: (r, e) => ca(r, e, Gn, 15, 8, Mg), deflateInit2: ca, def
|
|
|
6026
6026
|
while (--c);
|
|
6027
6027
|
n.strstart = d, n.lookahead = 2, hr(n);
|
|
6028
6028
|
}
|
|
6029
|
-
return n.strstart += n.lookahead, n.block_start = n.strstart, n.insert = n.lookahead, n.lookahead = 0, n.match_length = n.prev_length = 2, n.match_available = 0, r.next_in = a, r.input = s, r.avail_in = o, n.wrap = i,
|
|
6029
|
+
return n.strstart += n.lookahead, n.block_start = n.strstart, n.insert = n.lookahead, n.lookahead = 0, n.match_length = n.prev_length = 2, n.match_available = 0, r.next_in = a, r.input = s, r.avail_in = o, n.wrap = i, Oe;
|
|
6030
6030
|
}, deflateInfo: "pako deflate (from Nodeca project)" };
|
|
6031
6031
|
const Ug = (r, e) => Object.prototype.hasOwnProperty.call(r, e);
|
|
6032
6032
|
var au = function(r) {
|
|
@@ -6137,7 +6137,7 @@ var Wg = { Deflate: Hr, deflate: bi, deflateRaw: function(r, e) {
|
|
|
6137
6137
|
}, gzip: function(r, e) {
|
|
6138
6138
|
return (e = e || {}).gzip = !0, bi(r, e);
|
|
6139
6139
|
}, constants: nr }, Jg = function(r, e) {
|
|
6140
|
-
let t, n, i, o, a, s, d, c, u, f, h, g, k, z, w, b, T, E,
|
|
6140
|
+
let t, n, i, o, a, s, d, c, u, f, h, g, k, z, w, b, T, E, M, G, I, U, L, j;
|
|
6141
6141
|
const $ = r.state;
|
|
6142
6142
|
t = r.next_in, L = r.input, n = t + (r.avail_in - 5), i = r.next_out, j = r.output, o = i - (e - r.avail_out), a = i + (r.avail_out - 257), s = $.dmax, d = $.wsize, c = $.whave, u = $.wnext, f = $.window, h = $.hold, g = $.bits, k = $.lencode, z = $.distcode, w = (1 << $.lenbits) - 1, b = (1 << $.distbits) - 1;
|
|
6143
6143
|
e: do {
|
|
@@ -6157,7 +6157,7 @@ var Wg = { Deflate: Hr, deflate: bi, deflateRaw: function(r, e) {
|
|
|
6157
6157
|
r.msg = "invalid literal/length code", $.mode = 16209;
|
|
6158
6158
|
break e;
|
|
6159
6159
|
}
|
|
6160
|
-
|
|
6160
|
+
M = 65535 & T, E &= 15, E && (g < E && (h += L[t++] << g, g += 8), M += h & (1 << E) - 1, h >>>= E, g -= E), g < 15 && (h += L[t++] << g, g += 8, h += L[t++] << g, g += 8), T = z[h & b];
|
|
6161
6161
|
r: for (; ; ) {
|
|
6162
6162
|
if (E = T >>> 24, h >>>= E, g -= E, E = T >>> 16 & 255, !(16 & E)) {
|
|
6163
6163
|
if (!(64 & E)) {
|
|
@@ -6177,42 +6177,42 @@ var Wg = { Deflate: Hr, deflate: bi, deflateRaw: function(r, e) {
|
|
|
6177
6177
|
break e;
|
|
6178
6178
|
}
|
|
6179
6179
|
if (I = 0, U = f, u === 0) {
|
|
6180
|
-
if (I += d - E, E <
|
|
6181
|
-
|
|
6180
|
+
if (I += d - E, E < M) {
|
|
6181
|
+
M -= E;
|
|
6182
6182
|
do
|
|
6183
6183
|
j[i++] = f[I++];
|
|
6184
6184
|
while (--E);
|
|
6185
6185
|
I = i - G, U = j;
|
|
6186
6186
|
}
|
|
6187
6187
|
} else if (u < E) {
|
|
6188
|
-
if (I += d + u - E, E -= u, E <
|
|
6189
|
-
|
|
6188
|
+
if (I += d + u - E, E -= u, E < M) {
|
|
6189
|
+
M -= E;
|
|
6190
6190
|
do
|
|
6191
6191
|
j[i++] = f[I++];
|
|
6192
6192
|
while (--E);
|
|
6193
|
-
if (I = 0, u <
|
|
6194
|
-
E = u,
|
|
6193
|
+
if (I = 0, u < M) {
|
|
6194
|
+
E = u, M -= E;
|
|
6195
6195
|
do
|
|
6196
6196
|
j[i++] = f[I++];
|
|
6197
6197
|
while (--E);
|
|
6198
6198
|
I = i - G, U = j;
|
|
6199
6199
|
}
|
|
6200
6200
|
}
|
|
6201
|
-
} else if (I += u - E, E <
|
|
6202
|
-
|
|
6201
|
+
} else if (I += u - E, E < M) {
|
|
6202
|
+
M -= E;
|
|
6203
6203
|
do
|
|
6204
6204
|
j[i++] = f[I++];
|
|
6205
6205
|
while (--E);
|
|
6206
6206
|
I = i - G, U = j;
|
|
6207
6207
|
}
|
|
6208
|
-
for (;
|
|
6209
|
-
|
|
6208
|
+
for (; M > 2; ) j[i++] = U[I++], j[i++] = U[I++], j[i++] = U[I++], M -= 3;
|
|
6209
|
+
M && (j[i++] = U[I++], M > 1 && (j[i++] = U[I++]));
|
|
6210
6210
|
} else {
|
|
6211
6211
|
I = i - G;
|
|
6212
6212
|
do
|
|
6213
|
-
j[i++] = j[I++], j[i++] = j[I++], j[i++] = j[I++],
|
|
6214
|
-
while (
|
|
6215
|
-
|
|
6213
|
+
j[i++] = j[I++], j[i++] = j[I++], j[i++] = j[I++], M -= 3;
|
|
6214
|
+
while (M > 2);
|
|
6215
|
+
M && (j[i++] = j[I++], M > 1 && (j[i++] = j[I++]));
|
|
6216
6216
|
}
|
|
6217
6217
|
break;
|
|
6218
6218
|
}
|
|
@@ -6220,14 +6220,14 @@ var Wg = { Deflate: Hr, deflate: bi, deflateRaw: function(r, e) {
|
|
|
6220
6220
|
break;
|
|
6221
6221
|
}
|
|
6222
6222
|
} while (t < n && i < a);
|
|
6223
|
-
|
|
6223
|
+
M = g >> 3, t -= M, g -= M << 3, h &= (1 << g) - 1, r.next_in = t, r.next_out = i, r.avail_in = t < n ? n - t + 5 : 5 - (t - n), r.avail_out = i < a ? a - i + 257 : 257 - (i - a), $.hold = h, $.bits = g;
|
|
6224
6224
|
};
|
|
6225
6225
|
const Xg = new Uint16Array([3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0]), Zg = new Uint8Array([16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78]), Yg = new Uint16Array([1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0]), Qg = new Uint8Array([16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 64, 64]);
|
|
6226
6226
|
var $r = (r, e, t, n, i, o, a, s) => {
|
|
6227
6227
|
const d = s.bits;
|
|
6228
|
-
let c, u, f, h, g, k, z = 0, w = 0, b = 0, T = 0, E = 0,
|
|
6228
|
+
let c, u, f, h, g, k, z = 0, w = 0, b = 0, T = 0, E = 0, M = 0, G = 0, I = 0, U = 0, L = 0, j = null;
|
|
6229
6229
|
const $ = new Uint16Array(16), K = new Uint16Array(16);
|
|
6230
|
-
let
|
|
6230
|
+
let Z, W, se, ne = null;
|
|
6231
6231
|
for (z = 0; z <= 15; z++) $[z] = 0;
|
|
6232
6232
|
for (w = 0; w < n; w++) $[e[t + w]]++;
|
|
6233
6233
|
for (E = d, T = 15; T >= 1 && $[T] === 0; T--) ;
|
|
@@ -6237,11 +6237,11 @@ var $r = (r, e, t, n, i, o, a, s) => {
|
|
|
6237
6237
|
if (I > 0 && (r === 0 || T !== 1)) return -1;
|
|
6238
6238
|
for (K[1] = 0, z = 1; z < 15; z++) K[z + 1] = K[z] + $[z];
|
|
6239
6239
|
for (w = 0; w < n; w++) e[t + w] !== 0 && (a[K[e[t + w]]++] = w);
|
|
6240
|
-
if (r === 0 ? (j = ne = a, k = 20) : r === 1 ? (j = Xg, ne = Zg, k = 257) : (j = Yg, ne = Qg, k = 0), L = 0, w = 0, z = b, g = o,
|
|
6240
|
+
if (r === 0 ? (j = ne = a, k = 20) : r === 1 ? (j = Xg, ne = Zg, k = 257) : (j = Yg, ne = Qg, k = 0), L = 0, w = 0, z = b, g = o, M = E, G = 0, f = -1, U = 1 << E, h = U - 1, r === 1 && U > 852 || r === 2 && U > 592) return 1;
|
|
6241
6241
|
for (; ; ) {
|
|
6242
|
-
|
|
6242
|
+
Z = z - G, a[w] + 1 < k ? (W = 0, se = a[w]) : a[w] >= k ? (W = ne[a[w] - k], se = j[a[w] - k]) : (W = 96, se = 0), c = 1 << z - G, u = 1 << M, b = u;
|
|
6243
6243
|
do
|
|
6244
|
-
u -= c, i[g + (L >> G) + u] =
|
|
6244
|
+
u -= c, i[g + (L >> G) + u] = Z << 24 | W << 16 | se | 0;
|
|
6245
6245
|
while (u !== 0);
|
|
6246
6246
|
for (c = 1 << z - 1; L & c; ) c >>= 1;
|
|
6247
6247
|
if (c !== 0 ? (L &= c - 1, L += c) : L = 0, w++, --$[z] == 0) {
|
|
@@ -6249,9 +6249,9 @@ var $r = (r, e, t, n, i, o, a, s) => {
|
|
|
6249
6249
|
z = e[t + a[w]];
|
|
6250
6250
|
}
|
|
6251
6251
|
if (z > E && (L & h) !== f) {
|
|
6252
|
-
for (G === 0 && (G = E), g += b,
|
|
6253
|
-
if (U += 1 <<
|
|
6254
|
-
f = L & h, i[f] = E << 24 |
|
|
6252
|
+
for (G === 0 && (G = E), g += b, M = z - G, I = 1 << M; M + G < T && (I -= $[M + G], !(I <= 0)); ) M++, I <<= 1;
|
|
6253
|
+
if (U += 1 << M, r === 1 && U > 852 || r === 2 && U > 592) return 1;
|
|
6254
|
+
f = L & h, i[f] = E << 24 | M << 16 | g - o | 0;
|
|
6255
6255
|
}
|
|
6256
6256
|
}
|
|
6257
6257
|
return L !== 0 && (i[g + L] = z - G << 24 | 64 << 16 | 0), s.bits = E, 0;
|
|
@@ -6303,10 +6303,10 @@ const o_ = (r) => {
|
|
|
6303
6303
|
return o.window === null && (o.wsize = 1 << o.wbits, o.wnext = 0, o.whave = 0, o.window = new Uint8Array(o.wsize)), n >= o.wsize ? (o.window.set(e.subarray(t - o.wsize, t), 0), o.wnext = 0, o.whave = o.wsize) : (i = o.wsize - o.wnext, i > n && (i = n), o.window.set(e.subarray(t - n, t - n + i), o.wnext), (n -= i) ? (o.window.set(e.subarray(t - n, t), 0), o.wnext = n, o.whave = o.wsize) : (o.wnext += i, o.wnext === o.wsize && (o.wnext = 0), o.whave < o.wsize && (o.whave += i))), 0;
|
|
6304
6304
|
};
|
|
6305
6305
|
var Et = { inflateReset: fu, inflateReset2: pu, inflateResetKeep: hu, inflateInit: (r) => pa(r, 15), inflateInit2: pa, inflate: (r, e) => {
|
|
6306
|
-
let t, n, i, o, a, s, d, c, u, f, h, g, k, z, w, b, T, E,
|
|
6306
|
+
let t, n, i, o, a, s, d, c, u, f, h, g, k, z, w, b, T, E, M, G, I, U, L = 0;
|
|
6307
6307
|
const j = new Uint8Array(4);
|
|
6308
6308
|
let $, K;
|
|
6309
|
-
const
|
|
6309
|
+
const Z = new Uint8Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
|
|
6310
6310
|
if (Jt(r) || !r.output || !r.input && r.avail_in !== 0) return tt;
|
|
6311
6311
|
t = r.state, t.mode === 16191 && (t.mode = 16192), a = r.next_out, i = r.output, d = r.avail_out, o = r.next_in, n = r.input, s = r.avail_in, c = t.hold, u = t.bits, f = s, h = d, U = qt;
|
|
6312
6312
|
e: for (; ; ) switch (t.mode) {
|
|
@@ -6483,9 +6483,9 @@ var Et = { inflateReset: fu, inflateReset2: pu, inflateResetKeep: hu, inflateIni
|
|
|
6483
6483
|
if (s === 0) break e;
|
|
6484
6484
|
s--, c += n[o++] << u, u += 8;
|
|
6485
6485
|
}
|
|
6486
|
-
t.lens[
|
|
6486
|
+
t.lens[Z[t.have++]] = 7 & c, c >>>= 3, u -= 3;
|
|
6487
6487
|
}
|
|
6488
|
-
for (; t.have < 19; ) t.lens[
|
|
6488
|
+
for (; t.have < 19; ) t.lens[Z[t.have++]] = 0;
|
|
6489
6489
|
if (t.lencode = t.lendyn, t.lenbits = 7, $ = { bits: t.lenbits }, U = $r(0, t.lens, 0, 19, t.lencode, 0, t.work, $), t.lenbits = $.bits, U) {
|
|
6490
6490
|
r.msg = "invalid code lengths set", t.mode = 16209;
|
|
6491
6491
|
break;
|
|
@@ -6555,7 +6555,7 @@ var Et = { inflateReset: fu, inflateReset2: pu, inflateResetKeep: hu, inflateIni
|
|
|
6555
6555
|
s--, c += n[o++] << u, u += 8;
|
|
6556
6556
|
}
|
|
6557
6557
|
if (b && !(240 & b)) {
|
|
6558
|
-
for (E = w,
|
|
6558
|
+
for (E = w, M = b, G = T; L = t.lencode[G + ((c & (1 << E + M) - 1) >> E)], w = L >>> 24, b = L >>> 16 & 255, T = 65535 & L, !(E + w <= u); ) {
|
|
6559
6559
|
if (s === 0) break e;
|
|
6560
6560
|
s--, c += n[o++] << u, u += 8;
|
|
6561
6561
|
}
|
|
@@ -6589,7 +6589,7 @@ var Et = { inflateReset: fu, inflateReset2: pu, inflateResetKeep: hu, inflateIni
|
|
|
6589
6589
|
s--, c += n[o++] << u, u += 8;
|
|
6590
6590
|
}
|
|
6591
6591
|
if (!(240 & b)) {
|
|
6592
|
-
for (E = w,
|
|
6592
|
+
for (E = w, M = b, G = T; L = t.distcode[G + ((c & (1 << E + M) - 1) >> E)], w = L >>> 24, b = L >>> 16 & 255, T = 65535 & L, !(E + w <= u); ) {
|
|
6593
6593
|
if (s === 0) break e;
|
|
6594
6594
|
s--, c += n[o++] << u, u += 8;
|
|
6595
6595
|
}
|
|
@@ -7113,7 +7113,7 @@ var S_ = { Deflate: h_, deflate: f_, deflateRaw: p_, gzip: m_, Inflate: g_, infl
|
|
|
7113
7113
|
}, r.prototype.setNativeAppId = function(e) {
|
|
7114
7114
|
this.bridgeReport && this.appBridge.setNativeAppId(e);
|
|
7115
7115
|
}, r.prototype.getSessionId = function() {
|
|
7116
|
-
return
|
|
7116
|
+
return Mr();
|
|
7117
7117
|
}, r.prototype.setSessionId = function(e) {
|
|
7118
7118
|
this.emit(F.SessionReset, e);
|
|
7119
7119
|
}, r.prototype.resetStayDuration = function(e, t, n) {
|
|
@@ -7761,7 +7761,7 @@ var Bn = function(r, e) {
|
|
|
7761
7761
|
}
|
|
7762
7762
|
return t;
|
|
7763
7763
|
}
|
|
7764
|
-
},
|
|
7764
|
+
}, O_ = function() {
|
|
7765
7765
|
function r(e, t, n) {
|
|
7766
7766
|
var i = this;
|
|
7767
7767
|
this.statistics = !1, this.pageView = !1, this.clickEvent = function(o) {
|
|
@@ -7851,7 +7851,7 @@ var Bn = function(r, e) {
|
|
|
7851
7851
|
}, r.prototype.getDefaultConfig = function() {
|
|
7852
7852
|
return { is_html: 1, url: location.href, referrer: document.referrer, page_key: location.href, refer_page_key: document.referrer, page_title: document.title || location.pathname, page_manual_key: "", refer_page_manual_key: "", refer_page_title: "", page_path: location.pathname, page_host: location.host };
|
|
7853
7853
|
}, r;
|
|
7854
|
-
}(),
|
|
7854
|
+
}(), M_ = { eventConfig: { mode: "proxy-capturing", submit: !1, click: !0, change: !1, pv: !0, beat: !0, hashTag: !1, impr: !1 }, scoutConfig: { mode: "xpath" } }, P_ = function() {
|
|
7855
7855
|
function r(e, t) {
|
|
7856
7856
|
this.config = e, this.config.eventConfig = Object.assign(this.config.eventConfig, t);
|
|
7857
7857
|
}
|
|
@@ -7882,13 +7882,13 @@ function U_(r, e, t, n) {
|
|
|
7882
7882
|
}
|
|
7883
7883
|
}(e), a = function(I, U) {
|
|
7884
7884
|
I === void 0 && (I = {}), U === void 0 && (U = {});
|
|
7885
|
-
var L = I.clientX, j = I.clientY, $ = U.left, K = U.top,
|
|
7886
|
-
return { touch_x: Math.floor(
|
|
7885
|
+
var L = I.clientX, j = I.clientY, $ = U.left, K = U.top, Z = L - $ >= 0 ? L - $ : 0, W = j - K >= 0 ? j - K : 0;
|
|
7886
|
+
return { touch_x: Math.floor(Z), touch_y: Math.floor(W) };
|
|
7887
7887
|
}(r, o), s = o.element_width, d = o.element_height, c = a.touch_x, u = a.touch_y, f = L_(e), h = f.element_path, g = f.positions, k = function(I) {
|
|
7888
7888
|
var U = Di(I), L = [];
|
|
7889
7889
|
return function j($) {
|
|
7890
7890
|
var K = ya($);
|
|
7891
|
-
if (K && L.indexOf(K) === -1 && L.push(K), $.childNodes.length > 0) for (var
|
|
7891
|
+
if (K && L.indexOf(K) === -1 && L.push(K), $.childNodes.length > 0) for (var Z = $.childNodes, W = 0; W < Z.length; W++) Z[W].nodeType !== 8 && j(Z[W]);
|
|
7892
7892
|
}(U), L;
|
|
7893
7893
|
}(e), z = window.performance.timing.navigationStart, w = Date.now() - z, b = g.map(function(I) {
|
|
7894
7894
|
return "" + I;
|
|
@@ -7897,7 +7897,7 @@ function U_(r, e, t, n) {
|
|
|
7897
7897
|
var U = Di(I), L = "";
|
|
7898
7898
|
return function j($) {
|
|
7899
7899
|
var K = ya($);
|
|
7900
|
-
if (K && (L += K), $.childNodes.length > 0) for (var
|
|
7900
|
+
if (K && (L += K), $.childNodes.length > 0) for (var Z = $.childNodes, W = 0; W < Z.length; W++) Z[W].nodeType === 3 && j(Z[W]);
|
|
7901
7901
|
}(U), L;
|
|
7902
7902
|
}(e)), i.element_id = e.getAttribute("id") || "", i.element_class_name = e.getAttribute("class") || "", i.element_type = e.nodeType, i.element_width = Math.floor(s), i.element_height = Math.floor(d), i.touch_x = c, i.touch_y = u, i.page_manual_key = "", i.elememt_manual_key = "", i.since_page_start_ms = w, i.page_start_ms = z, i.page_path = location.pathname, i.page_host = location.host, t.track_attr && function(I, U) {
|
|
7903
7903
|
return !!x_(I, U);
|
|
@@ -7909,7 +7909,7 @@ function U_(r, e, t, n) {
|
|
|
7909
7909
|
Bn(I, U[j]) && (L[U[j]] = I.getAttribute(U[j]));
|
|
7910
7910
|
return L;
|
|
7911
7911
|
}(e, t.track_attr);
|
|
7912
|
-
for (var
|
|
7912
|
+
for (var M in E) i[M] = E[M];
|
|
7913
7913
|
}
|
|
7914
7914
|
var G = Di(e);
|
|
7915
7915
|
return G.tagName === "A" && (i.href = G.getAttribute("href")), e.tagName === "IMG" && (i.src = e.getAttribute("src")), i;
|
|
@@ -8279,7 +8279,7 @@ var ba, $_ = function() {
|
|
|
8279
8279
|
}, r.prototype.ready = function(e) {
|
|
8280
8280
|
this.collect.set(e);
|
|
8281
8281
|
var t = this.config.autotrack;
|
|
8282
|
-
t = typeof t == "object" ? t : {}, t = Object.assign(q_, t), this.destroyed = !1, this.options = t, this.Config = new P_(
|
|
8282
|
+
t = typeof t == "object" ? t : {}, t = Object.assign(q_, t), this.destroyed = !1, this.options = t, this.Config = new P_(M_, this.options), this.Exposure = new H_(this.collect, this.config, this.handle.bind(this)), this.Scroll = new $_(this.config, this.handle.bind(this)), this.Listener = new O_(t, this.collect, this.Config), this.EventHandle = new G_(this.config, t), this.Request = new N_(this.collect), this.autoTrackStart = !0, this.init(), F_(this, this.config);
|
|
8283
8283
|
}, r.prototype.init = function() {
|
|
8284
8284
|
this.Listener.init(this.handle.bind(this)), this.collect.loadType === "base" && (window.opener || window.parent).postMessage("[tea-sdk]ready", "*");
|
|
8285
8285
|
}, r.prototype.handle = function(e, t) {
|
|
@@ -8653,7 +8653,7 @@ var Ea = { pv: ["predefine_pageview"], sdk: ["_be_active", "predefine_page_alive
|
|
|
8653
8653
|
}();
|
|
8654
8654
|
Qe.usePlugin(X_, "extend"), Qe.usePlugin(T_, "et"), Qe.usePlugin(J_, "retry"), Qe.usePlugin(k_, "ab"), Qe.usePlugin(D_, "stay"), Qe.usePlugin(K_, "autotrack"), Qe.usePlugin(Y_, "trackeventduration"), Qe.usePlugin(A_, "heartbeat"), Qe.usePlugin(I_, "monitor"), Qe.usePlugin(Z_, "route"), Qe.usePlugin(W_, "tracer");
|
|
8655
8655
|
var Dr = new Qe("default");
|
|
8656
|
-
const xi = "VEPUSHER_DEVICE_ID",
|
|
8656
|
+
const xi = "VEPUSHER_DEVICE_ID", Oi = "VEPUSHER_USER_ID", _u = (r) => Math.floor(
|
|
8657
8657
|
(Math.random() * 9 + 1) * Math.pow(10, r - 1)
|
|
8658
8658
|
).toString();
|
|
8659
8659
|
function Q_(r) {
|
|
@@ -8673,12 +8673,12 @@ function Q_(r) {
|
|
|
8673
8673
|
}
|
|
8674
8674
|
function ev(r) {
|
|
8675
8675
|
if (r)
|
|
8676
|
-
return localStorage.setItem(
|
|
8677
|
-
const e = localStorage.getItem(
|
|
8676
|
+
return localStorage.setItem(Oi, r), r;
|
|
8677
|
+
const e = localStorage.getItem(Oi);
|
|
8678
8678
|
if (e)
|
|
8679
8679
|
return e;
|
|
8680
8680
|
const t = _u(12);
|
|
8681
|
-
return localStorage.setItem(
|
|
8681
|
+
return localStorage.setItem(Oi, t), r;
|
|
8682
8682
|
}
|
|
8683
8683
|
function tv(r) {
|
|
8684
8684
|
if (r)
|
|
@@ -8831,6 +8831,8 @@ const rv = {
|
|
|
8831
8831
|
* enable_reconnect: 是否开启自动重连
|
|
8832
8832
|
*/
|
|
8833
8833
|
STOP_PUSH_STREAM: "stop_push_stream",
|
|
8834
|
+
/** 停止直播sdk方法调用 */
|
|
8835
|
+
STOP_PUSH_STREAM_API_CALL: "stop_push_stream_api_call",
|
|
8834
8836
|
/**
|
|
8835
8837
|
* 开始推流状态
|
|
8836
8838
|
* is_success: 是否成功
|
|
@@ -8865,7 +8867,7 @@ const rv = {
|
|
|
8865
8867
|
* RTM推流sdp协商信息
|
|
8866
8868
|
*/
|
|
8867
8869
|
PUSH_SDP_INFO: "push_sdp_info"
|
|
8868
|
-
},
|
|
8870
|
+
}, J = {
|
|
8869
8871
|
/**
|
|
8870
8872
|
* 推流SDK初始化事件
|
|
8871
8873
|
* options: 初始化配置参数
|
|
@@ -8887,6 +8889,8 @@ const rv = {
|
|
|
8887
8889
|
SET_AUDIO_QUALITY: "set_audio_quality",
|
|
8888
8890
|
/** 页面可见性变化 */
|
|
8889
8891
|
PAGE_VISIBLE_CHANGE: "page_visible_change",
|
|
8892
|
+
/** 推流SDK销毁事件 */
|
|
8893
|
+
PUSHER_DESTROY: "pusher_destroy",
|
|
8890
8894
|
...rv,
|
|
8891
8895
|
...nv,
|
|
8892
8896
|
...iv
|
|
@@ -8903,7 +8907,7 @@ class ov {
|
|
|
8903
8907
|
page_path_fe: window.location.pathname || "unknown",
|
|
8904
8908
|
page_host_fe: window.location.hostname || "unknown",
|
|
8905
8909
|
sdk_version: "2.0.3",
|
|
8906
|
-
build_version: "1.0.0.
|
|
8910
|
+
build_version: "1.0.0.125",
|
|
8907
8911
|
...n
|
|
8908
8912
|
}
|
|
8909
8913
|
};
|
|
@@ -8943,14 +8947,14 @@ let dn;
|
|
|
8943
8947
|
function sv({ showLogInConsole: r }) {
|
|
8944
8948
|
dn = new ov({ showLogInConsole: r });
|
|
8945
8949
|
}
|
|
8946
|
-
function
|
|
8950
|
+
function X(r, e, t = !1) {
|
|
8947
8951
|
dn && dn.sendTeaEvent(r, e, t);
|
|
8948
8952
|
}
|
|
8949
8953
|
function av(r, e) {
|
|
8950
8954
|
dn && dn.configTea(r, e);
|
|
8951
8955
|
}
|
|
8952
8956
|
const vu = () => {
|
|
8953
|
-
|
|
8957
|
+
X(J.PAGE_VISIBLE_CHANGE, {
|
|
8954
8958
|
page_visible: !document.hidden
|
|
8955
8959
|
});
|
|
8956
8960
|
}, cv = () => {
|
|
@@ -9030,13 +9034,13 @@ class dv extends Bt {
|
|
|
9030
9034
|
const t = await kl(
|
|
9031
9035
|
e ? [e] : ["audioinput", "videoinput"]
|
|
9032
9036
|
);
|
|
9033
|
-
return
|
|
9037
|
+
return X(J.GET_DEVICES_RESULT, {
|
|
9034
9038
|
type: e,
|
|
9035
9039
|
is_success: !0,
|
|
9036
9040
|
devices: t
|
|
9037
9041
|
}), t;
|
|
9038
9042
|
} catch (t) {
|
|
9039
|
-
return
|
|
9043
|
+
return X(J.GET_DEVICES_RESULT, {
|
|
9040
9044
|
type: e,
|
|
9041
9045
|
is_success: !1,
|
|
9042
9046
|
error: t,
|
|
@@ -9087,7 +9091,7 @@ class dv extends Bt {
|
|
|
9087
9091
|
i.push(o);
|
|
9088
9092
|
} else
|
|
9089
9093
|
i = _t(this[n]);
|
|
9090
|
-
|
|
9094
|
+
X(J.STOP_CAPTURE, {
|
|
9091
9095
|
stream_id: e,
|
|
9092
9096
|
type: t,
|
|
9093
9097
|
number: i.length
|
|
@@ -9116,14 +9120,14 @@ class dv extends Bt {
|
|
|
9116
9120
|
), o = new th(i, {
|
|
9117
9121
|
frameRate: this._videoConstraints.frameRate
|
|
9118
9122
|
});
|
|
9119
|
-
return this._cameraStreams[o.id] = o, this._notifyCaptured(o), this._bindStreamEvent(o),
|
|
9123
|
+
return this._cameraStreams[o.id] = o, this._notifyCaptured(o), this._bindStreamEvent(o), X(J.CAMERA_CAPTURE_RESULT, {
|
|
9120
9124
|
is_success: !0,
|
|
9121
9125
|
stream_id: o.id,
|
|
9122
9126
|
device_id: e,
|
|
9123
9127
|
capture_params: n
|
|
9124
9128
|
}), o.id;
|
|
9125
9129
|
} catch (i) {
|
|
9126
|
-
throw
|
|
9130
|
+
throw X(J.CAMERA_CAPTURE_RESULT, {
|
|
9127
9131
|
is_success: !1,
|
|
9128
9132
|
device_id: e,
|
|
9129
9133
|
capture_params: n,
|
|
@@ -9144,14 +9148,14 @@ class dv extends Bt {
|
|
|
9144
9148
|
};
|
|
9145
9149
|
try {
|
|
9146
9150
|
const i = await Rl(n), o = new Nm(i);
|
|
9147
|
-
return this._microphoneStreams[o.id] = o, this._notifyCaptured(o), this._bindStreamEvent(o),
|
|
9151
|
+
return this._microphoneStreams[o.id] = o, this._notifyCaptured(o), this._bindStreamEvent(o), X(J.MICROPHONE_CAPTURE_RESULT, {
|
|
9148
9152
|
is_success: !0,
|
|
9149
9153
|
stream_id: o.id,
|
|
9150
9154
|
device_id: e,
|
|
9151
9155
|
capture_params: n
|
|
9152
9156
|
}), o.id;
|
|
9153
9157
|
} catch (i) {
|
|
9154
|
-
throw
|
|
9158
|
+
throw X(J.MICROPHONE_CAPTURE_RESULT, {
|
|
9155
9159
|
is_success: !1,
|
|
9156
9160
|
device_id: e,
|
|
9157
9161
|
capture_params: n,
|
|
@@ -9175,13 +9179,13 @@ class dv extends Bt {
|
|
|
9175
9179
|
), i = new Fm(n, {
|
|
9176
9180
|
frameRate: this._videoConstraints.frameRate
|
|
9177
9181
|
});
|
|
9178
|
-
return this._screenStreams[i.id] = i, this._notifyCaptured(i), this._bindStreamEvent(i),
|
|
9182
|
+
return this._screenStreams[i.id] = i, this._notifyCaptured(i), this._bindStreamEvent(i), X(J.SCREEN_CAPTURE_RESULT, {
|
|
9179
9183
|
is_success: !0,
|
|
9180
9184
|
stream_id: i.id,
|
|
9181
9185
|
capture_params: t
|
|
9182
9186
|
}), i.id;
|
|
9183
9187
|
} catch (n) {
|
|
9184
|
-
throw
|
|
9188
|
+
throw X(J.SCREEN_CAPTURE_RESULT, {
|
|
9185
9189
|
is_success: !1,
|
|
9186
9190
|
capture_params: t,
|
|
9187
9191
|
...sr(n)
|
|
@@ -9196,7 +9200,7 @@ class dv extends Bt {
|
|
|
9196
9200
|
audio: !0,
|
|
9197
9201
|
loop: !0
|
|
9198
9202
|
}), n = new Bm(t);
|
|
9199
|
-
return this._videoFileStreams[n.id] = n, this._notifyCaptured(n), this._bindStreamEvent(n),
|
|
9203
|
+
return this._videoFileStreams[n.id] = n, this._notifyCaptured(n), this._bindStreamEvent(n), X(J.VIDEO_FILE_CAPTURE_RESULT, {
|
|
9200
9204
|
is_success: !0,
|
|
9201
9205
|
stream_id: n.id,
|
|
9202
9206
|
file_url: e
|
|
@@ -9205,7 +9209,7 @@ class dv extends Bt {
|
|
|
9205
9209
|
throw this._handleError(
|
|
9206
9210
|
t,
|
|
9207
9211
|
We.VIDEO_FILE_CAPTURE_FAILED
|
|
9208
|
-
),
|
|
9212
|
+
), X(J.VIDEO_FILE_CAPTURE_RESULT, {
|
|
9209
9213
|
is_success: !1,
|
|
9210
9214
|
file_url: e,
|
|
9211
9215
|
...sr(t)
|
|
@@ -9220,13 +9224,13 @@ class dv extends Bt {
|
|
|
9220
9224
|
audio: !0,
|
|
9221
9225
|
loop: !0
|
|
9222
9226
|
}), n = new Vm(t);
|
|
9223
|
-
return this._audioFileStreams[n.id] = n, this._notifyCaptured(n), this._bindStreamEvent(n),
|
|
9227
|
+
return this._audioFileStreams[n.id] = n, this._notifyCaptured(n), this._bindStreamEvent(n), X(J.AUDIO_FILE_CAPTURE_RESULT, {
|
|
9224
9228
|
is_success: !0,
|
|
9225
9229
|
stream_id: n.id,
|
|
9226
9230
|
file_url: e
|
|
9227
9231
|
}), n.id;
|
|
9228
9232
|
} catch (t) {
|
|
9229
|
-
throw
|
|
9233
|
+
throw X(J.AUDIO_FILE_CAPTURE_RESULT, {
|
|
9230
9234
|
is_success: !1,
|
|
9231
9235
|
file_url: e,
|
|
9232
9236
|
...sr(t)
|
|
@@ -9244,13 +9248,13 @@ class dv extends Bt {
|
|
|
9244
9248
|
height: 0,
|
|
9245
9249
|
frameRate: 30
|
|
9246
9250
|
}), n = new jm(t);
|
|
9247
|
-
return this._imageStreams[n.id] = n, this._notifyCaptured(n), this._bindStreamEvent(n),
|
|
9251
|
+
return this._imageStreams[n.id] = n, this._notifyCaptured(n), this._bindStreamEvent(n), X(J.IMAGE_FILE_CAPTURE_RESULT, {
|
|
9248
9252
|
is_success: !0,
|
|
9249
9253
|
stream_id: n.id,
|
|
9250
9254
|
file_url: e
|
|
9251
9255
|
}), n.id;
|
|
9252
9256
|
} catch (t) {
|
|
9253
|
-
throw
|
|
9257
|
+
throw X(J.IMAGE_FILE_CAPTURE_RESULT, {
|
|
9254
9258
|
is_success: !1,
|
|
9255
9259
|
file_url: e,
|
|
9256
9260
|
...sr(t)
|
|
@@ -9278,12 +9282,12 @@ class dv extends Bt {
|
|
|
9278
9282
|
const t = this.getStreamById(e);
|
|
9279
9283
|
if (t)
|
|
9280
9284
|
try {
|
|
9281
|
-
await t.startVolumeDetect(),
|
|
9285
|
+
await t.startVolumeDetect(), X(J.VOLUME_DETECTOR_START_RESULT, {
|
|
9282
9286
|
is_success: !0,
|
|
9283
9287
|
stream_id: t.id
|
|
9284
9288
|
});
|
|
9285
9289
|
} catch (n) {
|
|
9286
|
-
|
|
9290
|
+
X(J.VOLUME_DETECTOR_START_RESULT, {
|
|
9287
9291
|
is_success: !1,
|
|
9288
9292
|
stream_id: t.id,
|
|
9289
9293
|
error_message: n.message
|
|
@@ -9849,7 +9853,7 @@ class gv extends Xn {
|
|
|
9849
9853
|
}
|
|
9850
9854
|
class _v extends Zo {
|
|
9851
9855
|
constructor(e) {
|
|
9852
|
-
super(e), this._spriteList = [], this._audioMixer = new
|
|
9856
|
+
super(e), this._spriteList = [], this._audioMixer = new Ml({
|
|
9853
9857
|
keepAlive: !0
|
|
9854
9858
|
});
|
|
9855
9859
|
}
|
|
@@ -10183,7 +10187,7 @@ class bv extends Su {
|
|
|
10183
10187
|
return this._isPreviewing;
|
|
10184
10188
|
}
|
|
10185
10189
|
}
|
|
10186
|
-
var ot = {},
|
|
10190
|
+
var ot = {}, Mi = {}, Pi = { exports: {} }, ka;
|
|
10187
10191
|
function Yo() {
|
|
10188
10192
|
if (ka) return Pi.exports;
|
|
10189
10193
|
ka = 1;
|
|
@@ -10691,7 +10695,7 @@ function Ev() {
|
|
|
10691
10695
|
});
|
|
10692
10696
|
});
|
|
10693
10697
|
};
|
|
10694
|
-
}(
|
|
10698
|
+
}(Mi)), Mi;
|
|
10695
10699
|
}
|
|
10696
10700
|
var Li, za;
|
|
10697
10701
|
function wv() {
|
|
@@ -10847,7 +10851,7 @@ async function lo(r, e) {
|
|
|
10847
10851
|
}), t;
|
|
10848
10852
|
}
|
|
10849
10853
|
async function zv(r, e, t) {
|
|
10850
|
-
var u, f, h, g, k, z, w, b, T, E,
|
|
10854
|
+
var u, f, h, g, k, z, w, b, T, E, M, G, I, U, L, j, $, K, Z, W, se, ne, Y, le, fe, ue, Se, ye, re, Ee, de, pe, Re, Dt, Le, At, mt, He, Te;
|
|
10851
10855
|
const n = await lo(e, t);
|
|
10852
10856
|
await gn(r);
|
|
10853
10857
|
const i = await lo(e, t), { audio: o, video: a } = n, { audio: s, video: d } = i, c = {};
|
|
@@ -10858,7 +10862,7 @@ async function zv(r, e, t) {
|
|
|
10858
10862
|
channels: s.codec.channels,
|
|
10859
10863
|
sendBitrate: Ue / De * 8e3,
|
|
10860
10864
|
// bps
|
|
10861
|
-
packetsSent: (
|
|
10865
|
+
packetsSent: (M = s.outboundRtp) == null ? void 0 : M.packetsSent,
|
|
10862
10866
|
nackCount: (G = s.outboundRtp) == null ? void 0 : G.nackCount,
|
|
10863
10867
|
packetsLost: (I = s.remoteInboundRtp) == null ? void 0 : I.packetsLost,
|
|
10864
10868
|
packetsLostPercent: Ge / Ne,
|
|
@@ -10866,7 +10870,7 @@ async function zv(r, e, t) {
|
|
|
10866
10870
|
};
|
|
10867
10871
|
}
|
|
10868
10872
|
if (a != null && a.codec && (d != null && d.codec)) {
|
|
10869
|
-
const De = ((U = d.outboundRtp) == null ? void 0 : U.timestamp) - ((L = a.outboundRtp) == null ? void 0 : L.timestamp), Ue = ((j = d.outboundRtp) == null ? void 0 : j.bytesSent) - (($ = a.outboundRtp) == null ? void 0 : $.bytesSent), Ge = ((K = d.outboundRtp) == null ? void 0 : K.framesEncoded) - ((
|
|
10873
|
+
const De = ((U = d.outboundRtp) == null ? void 0 : U.timestamp) - ((L = a.outboundRtp) == null ? void 0 : L.timestamp), Ue = ((j = d.outboundRtp) == null ? void 0 : j.bytesSent) - (($ = a.outboundRtp) == null ? void 0 : $.bytesSent), Ge = ((K = d.outboundRtp) == null ? void 0 : K.framesEncoded) - ((Z = a.outboundRtp) == null ? void 0 : Z.framesEncoded), Ne = ((W = d.outboundRtp) == null ? void 0 : W.totalEncodeTime) - ((se = a.outboundRtp) == null ? void 0 : se.totalEncodeTime), Ze = ((ne = d.outboundRtp) == null ? void 0 : ne.framesSent) - ((Y = a.outboundRtp) == null ? void 0 : Y.framesSent), gt = ((le = d.outboundRtp) == null ? void 0 : le.packetsSent) - ((fe = a.outboundRtp) == null ? void 0 : fe.packetsSent), nt = ((ue = d.outboundRtp) == null ? void 0 : ue.totalPacketSendDelay) - ((Se = a.outboundRtp) == null ? void 0 : Se.totalPacketSendDelay), it = ((ye = d.remoteInboundRtp) == null ? void 0 : ye.packetsLost) - ((re = a.remoteInboundRtp) == null ? void 0 : re.packetsLost);
|
|
10870
10874
|
c.video = {
|
|
10871
10875
|
codec: d.codec.mimeType,
|
|
10872
10876
|
sendBitrate: Ue / De * 8e3,
|
|
@@ -10906,7 +10910,7 @@ function we(r, e = uo) {
|
|
|
10906
10910
|
return r ?? e;
|
|
10907
10911
|
}
|
|
10908
10912
|
function Rv(r) {
|
|
10909
|
-
var e, t, n, i, o, a, s, d, c, u, f, h, g, k, z, w, b, T, E,
|
|
10913
|
+
var e, t, n, i, o, a, s, d, c, u, f, h, g, k, z, w, b, T, E, M, G, I, U, L, j, $, K, Z, W, se, ne, Y, le, fe, ue, Se, ye, re, Ee, de, pe;
|
|
10910
10914
|
return {
|
|
10911
10915
|
// outbound-rtp info
|
|
10912
10916
|
audio_bytes: (e = r.outboundRtp) == null ? void 0 : e.bytesSent,
|
|
@@ -10929,7 +10933,7 @@ function Rv(r) {
|
|
|
10929
10933
|
// candidatePair info
|
|
10930
10934
|
audio_ice_available_outgoing_bitrate: (T = r.candidatePair) == null ? void 0 : T.availableOutgoingBitrate,
|
|
10931
10935
|
audio_ice_bytes_received: (E = r.candidatePair) == null ? void 0 : E.bytesReceived,
|
|
10932
|
-
audio_ice_bytes_sent: (
|
|
10936
|
+
audio_ice_bytes_sent: (M = r.candidatePair) == null ? void 0 : M.bytesSent,
|
|
10933
10937
|
audio_ice_nominated: (G = r.candidatePair) == null ? void 0 : G.nominated,
|
|
10934
10938
|
audio_ice_pair_id: (I = r.candidatePair) == null ? void 0 : I.id,
|
|
10935
10939
|
audio_ice_pair_rtt: (U = r.candidatePair) == null ? void 0 : U.currentRoundTripTime,
|
|
@@ -10937,7 +10941,7 @@ function Rv(r) {
|
|
|
10937
10941
|
audio_ice_pair_writable: (j = r.candidatePair) == null ? void 0 : j.writable,
|
|
10938
10942
|
audio_recv_ping_requests: ($ = r.candidatePair) == null ? void 0 : $.requestsReceived,
|
|
10939
10943
|
audio_recv_ping_responses: (K = r.candidatePair) == null ? void 0 : K.responsesReceived,
|
|
10940
|
-
audio_sent_ping_requests_before_first_response: (
|
|
10944
|
+
audio_sent_ping_requests_before_first_response: (Z = r.candidatePair) == null ? void 0 : Z.requestsSent,
|
|
10941
10945
|
audio_sent_ping_requests_total: (((W = r.candidatePair) == null ? void 0 : W.requestsSent) ?? 0) + (((se = r.candidatePair) == null ? void 0 : se.consentRequestsSent) ?? 0),
|
|
10942
10946
|
audio_sent_ping_responses: (ne = r.candidatePair) == null ? void 0 : ne.responsesSent,
|
|
10943
10947
|
// localCandidate info
|
|
@@ -10953,7 +10957,7 @@ function Rv(r) {
|
|
|
10953
10957
|
};
|
|
10954
10958
|
}
|
|
10955
10959
|
function Dv(r) {
|
|
10956
|
-
var e, t, n, i, o, a, s, d, c, u, f, h, g, k, z, w, b, T, E,
|
|
10960
|
+
var e, t, n, i, o, a, s, d, c, u, f, h, g, k, z, w, b, T, E, M, G, I, U, L, j, $, K, Z, W, se, ne, Y, le, fe, ue, Se, ye;
|
|
10957
10961
|
return {
|
|
10958
10962
|
// outbound-rtp info
|
|
10959
10963
|
video_qp_sum: (e = r.outboundRtp) == null ? void 0 : e.qpSum,
|
|
@@ -10977,14 +10981,14 @@ function Dv(r) {
|
|
|
10977
10981
|
video_ice_pair_state: (b = r.candidatePair) == null ? void 0 : b.state,
|
|
10978
10982
|
video_ice_pair_writable: (T = r.candidatePair) == null ? void 0 : T.writable,
|
|
10979
10983
|
video_recv_ping_requests: (E = r.candidatePair) == null ? void 0 : E.requestsReceived,
|
|
10980
|
-
video_recv_ping_responses: (
|
|
10984
|
+
video_recv_ping_responses: (M = r.candidatePair) == null ? void 0 : M.responsesReceived,
|
|
10981
10985
|
video_sent_ping_requests_before_first_response: (G = r.candidatePair) == null ? void 0 : G.requestsSent,
|
|
10982
10986
|
video_sent_ping_requests_total: (((I = r.candidatePair) == null ? void 0 : I.requestsSent) ?? 0) + (((U = r.candidatePair) == null ? void 0 : U.consentRequestsSent) ?? 0),
|
|
10983
10987
|
video_sent_ping_responses: (L = r.candidatePair) == null ? void 0 : L.responsesSent,
|
|
10984
10988
|
// localCandidate info
|
|
10985
10989
|
video_local_candidate_type: (j = r.localCandidate) == null ? void 0 : j.candidateType,
|
|
10986
10990
|
video_local_ip: (($ = r.localCandidate) == null ? void 0 : $.ip) || ((K = r.localCandidate) == null ? void 0 : K.address),
|
|
10987
|
-
video_local_network_type: (
|
|
10991
|
+
video_local_network_type: (Z = r.localCandidate) == null ? void 0 : Z.networkType,
|
|
10988
10992
|
video_local_port: (W = r.localCandidate) == null ? void 0 : W.port,
|
|
10989
10993
|
video_local_protocol: (se = r.localCandidate) == null ? void 0 : se.protocol,
|
|
10990
10994
|
// remoteCandidate info
|
|
@@ -10998,7 +11002,7 @@ function Dv(r) {
|
|
|
10998
11002
|
};
|
|
10999
11003
|
}
|
|
11000
11004
|
function Av(r, e, t) {
|
|
11001
|
-
var c, u, f, h, g, k, z, w, b, T, E,
|
|
11005
|
+
var c, u, f, h, g, k, z, w, b, T, E, M, G, I, U, L, j, $, K, Z, W, se, ne, Y, le, fe, ue;
|
|
11002
11006
|
const n = Dv(e.video ?? {}), { video_input_frame_width: i, video_input_frame_height: o } = n, a = we((c = r.video) == null ? void 0 : c.frameWidth), s = we(
|
|
11003
11007
|
(u = r.video) == null ? void 0 : u.frameHeight
|
|
11004
11008
|
), d = a < Number(i) || s < Number(o);
|
|
@@ -11025,7 +11029,7 @@ function Av(r, e, t) {
|
|
|
11025
11029
|
),
|
|
11026
11030
|
video_delta_time: we((T = r.video) == null ? void 0 : T.deltaTime, 2e3),
|
|
11027
11031
|
video_packets_sent: we((E = r.video) == null ? void 0 : E.packetsSent),
|
|
11028
|
-
video_nack_count: we((
|
|
11032
|
+
video_nack_count: we((M = r.video) == null ? void 0 : M.nackCount),
|
|
11029
11033
|
video_fir_count: we((G = r.video) == null ? void 0 : G.firCount),
|
|
11030
11034
|
video_pli_count: we((I = r.video) == null ? void 0 : I.pliCount),
|
|
11031
11035
|
video_packets_lost: we((U = r.video) == null ? void 0 : U.packetsLost),
|
|
@@ -11038,7 +11042,7 @@ function Av(r, e, t) {
|
|
|
11038
11042
|
1
|
|
11039
11043
|
) * 100 : uo,
|
|
11040
11044
|
video_bitrate_compliance: t != null && t.idealBitrate ? Math.min(
|
|
11041
|
-
we((
|
|
11045
|
+
we((Z = r.video) == null ? void 0 : Z.sendBitrate) / t.idealBitrate,
|
|
11042
11046
|
1
|
|
11043
11047
|
) * 100 : uo,
|
|
11044
11048
|
video_resolution_downgrade: d,
|
|
@@ -11069,7 +11073,7 @@ function Iv(r) {
|
|
|
11069
11073
|
audio_send_sample_rate: r.audio.sampleRate
|
|
11070
11074
|
};
|
|
11071
11075
|
}
|
|
11072
|
-
const xv = "42001f",
|
|
11076
|
+
const xv = "42001f", Ov = "42e01f", Mv = (r) => {
|
|
11073
11077
|
var t;
|
|
11074
11078
|
if (!_c)
|
|
11075
11079
|
return;
|
|
@@ -11107,7 +11111,7 @@ function Da(r, e) {
|
|
|
11107
11111
|
const t = r.fmtp.find(
|
|
11108
11112
|
(a) => a.config && a.config.includes(xv)
|
|
11109
11113
|
), n = r.fmtp.find(
|
|
11110
|
-
(a) => a.config && a.config.includes(
|
|
11114
|
+
(a) => a.config && a.config.includes(Ov)
|
|
11111
11115
|
);
|
|
11112
11116
|
if (!t || !n)
|
|
11113
11117
|
return;
|
|
@@ -11190,7 +11194,7 @@ const Gv = async () => {
|
|
|
11190
11194
|
return !1;
|
|
11191
11195
|
}
|
|
11192
11196
|
return pt.h264decode || !1;
|
|
11193
|
-
},
|
|
11197
|
+
}, Me = new Ft("PCConnect"), as = class as {
|
|
11194
11198
|
constructor(e, t, n) {
|
|
11195
11199
|
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 = n;
|
|
11196
11200
|
}
|
|
@@ -11220,17 +11224,17 @@ const Gv = async () => {
|
|
|
11220
11224
|
direction: "sendonly",
|
|
11221
11225
|
sendEncodings: [{ maxBitrate: t[0] }],
|
|
11222
11226
|
streams: [this._ms]
|
|
11223
|
-
}),
|
|
11227
|
+
}), Me.log("add track to pc,", o), this._videoTransceiver = i.addTransceiver(a || "video", {
|
|
11224
11228
|
direction: "sendonly",
|
|
11225
11229
|
sendEncodings: [{ maxBitrate: t[1] }],
|
|
11226
11230
|
streams: [this._ms]
|
|
11227
|
-
}),
|
|
11231
|
+
}), Me.log("add track to pc,", a);
|
|
11228
11232
|
const s = await i.createOffer();
|
|
11229
|
-
|
|
11233
|
+
Me.groupCollapsed("local offer"), Me.log(s.sdp);
|
|
11230
11234
|
const d = cr.parse(s.sdp);
|
|
11231
11235
|
d.media.forEach((h) => {
|
|
11232
|
-
h.type === "audio" ?
|
|
11233
|
-
}), s.sdp = cr.write(d),
|
|
11236
|
+
h.type === "audio" ? Mv(h) : h.type === "video" && (Pv(h), Da(h, "software"), Lv(h, t[1]));
|
|
11237
|
+
}), s.sdp = cr.write(d), Me.log("local offer modified"), Me.log(s.sdp), await i.setLocalDescription(s);
|
|
11234
11238
|
const c = await bu(
|
|
11235
11239
|
this._signalUrl,
|
|
11236
11240
|
{
|
|
@@ -11255,18 +11259,18 @@ const Gv = async () => {
|
|
|
11255
11259
|
code: c.code,
|
|
11256
11260
|
message: c.message
|
|
11257
11261
|
};
|
|
11258
|
-
|
|
11262
|
+
Me.log("remote answer:"), Me.log(c.remoteSdp.sdp);
|
|
11259
11263
|
const u = cr.parse(c.remoteSdp.sdp);
|
|
11260
11264
|
if (u.media.forEach((h) => {
|
|
11261
11265
|
var g;
|
|
11262
11266
|
(g = h.fingerprint) != null && g.hash && (h.fingerprint.hash = h.fingerprint.hash.toUpperCase());
|
|
11263
|
-
}), c.remoteSdp.sdp = cr.write(u),
|
|
11264
|
-
|
|
11267
|
+
}), c.remoteSdp.sdp = cr.write(u), Me.log("remote answer modified"), Me.log(c.remoteSdp.sdp), Me.groupEnd(), i.connectionState === "closed") {
|
|
11268
|
+
Me.log(
|
|
11265
11269
|
"PeerConnection is closed, skipping setRemoteDescription"
|
|
11266
11270
|
);
|
|
11267
11271
|
return;
|
|
11268
11272
|
}
|
|
11269
|
-
|
|
11273
|
+
X(J.PUSH_SDP_INFO, {
|
|
11270
11274
|
offer_sdp: s.sdp,
|
|
11271
11275
|
answer_sdp: c.remoteSdp.sdp
|
|
11272
11276
|
}), await i.setRemoteDescription(c.remoteSdp);
|
|
@@ -11289,7 +11293,7 @@ const Gv = async () => {
|
|
|
11289
11293
|
let n;
|
|
11290
11294
|
t === "video" ? n = this._videoTransceiver : n = this._audioTransceiver;
|
|
11291
11295
|
const i = (o = n == null ? void 0 : n.sender) == null ? void 0 : o.track;
|
|
11292
|
-
(i == null ? void 0 : i.id) !== (e == null ? void 0 : e.id) && (await ((a = n == null ? void 0 : n.sender) == null ? void 0 : a.replaceTrack(e)),
|
|
11296
|
+
(i == null ? void 0 : i.id) !== (e == null ? void 0 : e.id) && (await ((a = n == null ? void 0 : n.sender) == null ? void 0 : a.replaceTrack(e)), Me.log(
|
|
11293
11297
|
`replace ${t} track done! ${i == null ? void 0 : i.label} -> ${e == null ? void 0 : e.label}`
|
|
11294
11298
|
));
|
|
11295
11299
|
}
|
|
@@ -11298,14 +11302,14 @@ const Gv = async () => {
|
|
|
11298
11302
|
const i = t === "video" ? (a = this._videoTransceiver) == null ? void 0 : a.sender : (s = this._audioTransceiver) == null ? void 0 : s.sender;
|
|
11299
11303
|
if (!i) return;
|
|
11300
11304
|
const o = i.getParameters();
|
|
11301
|
-
o.encodings = (d = o.encodings) != null && d.length ? o.encodings : [{}], n ? o.encodings[0].minBitrate = e : o.encodings[0].maxBitrate = e, i.setParameters(o),
|
|
11305
|
+
o.encodings = (d = o.encodings) != null && d.length ? o.encodings : [{}], n ? o.encodings[0].minBitrate = e : o.encodings[0].maxBitrate = e, i.setParameters(o), Me.log(`set bitrate for ${t}, ${e} bps, min:${n}`);
|
|
11302
11306
|
}
|
|
11303
11307
|
unpublish() {
|
|
11304
11308
|
var e, t;
|
|
11305
11309
|
(e = this._pc) == null || e.getSenders().forEach((n) => {
|
|
11306
11310
|
var i;
|
|
11307
11311
|
(i = this._pc) == null || i.removeTrack(n);
|
|
11308
|
-
}), (t = this._pc) == null || t.close(), this._audioTransceiver = null, this._videoTransceiver = null, this._pc = null,
|
|
11312
|
+
}), (t = this._pc) == null || t.close(), this._audioTransceiver = null, this._videoTransceiver = null, this._pc = null, Me.log("close pc!");
|
|
11309
11313
|
}
|
|
11310
11314
|
getStats() {
|
|
11311
11315
|
var e, t;
|
|
@@ -11325,7 +11329,7 @@ const Gv = async () => {
|
|
|
11325
11329
|
_bindRTCEvent() {
|
|
11326
11330
|
const e = this._pc;
|
|
11327
11331
|
e == null || e.addEventListener("connectionstatechange", () => {
|
|
11328
|
-
|
|
11332
|
+
Me.log("onconnectionstatechange:", e.connectionState), this._onConnectStateChange(e.connectionState);
|
|
11329
11333
|
});
|
|
11330
11334
|
}
|
|
11331
11335
|
};
|
|
@@ -11337,7 +11341,7 @@ as.isSupported = async () => {
|
|
|
11337
11341
|
}
|
|
11338
11342
|
};
|
|
11339
11343
|
let Vn = as;
|
|
11340
|
-
var
|
|
11344
|
+
var Ot = /* @__PURE__ */ ((r) => (r.OnError = "onerror", r.OnConnectClosed = "onconnectclosed", r.OnFirstFramePushed = "onfirstframepushed", r))(Ot || {}), Mt = /* @__PURE__ */ ((r) => (r.Video = "video", r.Audio = "audio", r))(Mt || {}), et = /* @__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))(et || {}), Ht = /* @__PURE__ */ ((r) => (r.Ready = "ready", r.Error = "error", r.FirstFramePushed = "firstframepushed", r.Flvfile = "flvfile", r.STATS = "stats", r.Close = "close", r))(Ht || {}), Ui = { exports: {} }, Aa;
|
|
11341
11345
|
function Vv() {
|
|
11342
11346
|
return Aa || (Aa = 1, function(r) {
|
|
11343
11347
|
var e = Object.prototype.hasOwnProperty, t = "~";
|
|
@@ -11398,8 +11402,8 @@ function Vv() {
|
|
|
11398
11402
|
T[E - 1] = arguments[E];
|
|
11399
11403
|
w.fn.apply(w.context, T);
|
|
11400
11404
|
} else {
|
|
11401
|
-
var
|
|
11402
|
-
for (E = 0; E <
|
|
11405
|
+
var M = w.length, G;
|
|
11406
|
+
for (E = 0; E < M; E++)
|
|
11403
11407
|
switch (w[E].once && this.removeListener(c, w[E].fn, void 0, !0), b) {
|
|
11404
11408
|
case 1:
|
|
11405
11409
|
w[E].fn.call(w[E].context);
|
|
@@ -11509,7 +11513,7 @@ class $v {
|
|
|
11509
11513
|
* @param mst
|
|
11510
11514
|
*/
|
|
11511
11515
|
restartCapture(e) {
|
|
11512
|
-
if (Ye.log(`replace ${e} track`), e ===
|
|
11516
|
+
if (Ye.log(`replace ${e} track`), e === Mt.Video) {
|
|
11513
11517
|
if (this._videoProcessorReader) {
|
|
11514
11518
|
this._videoProcessorReader.cancel().finally(() => {
|
|
11515
11519
|
this._startVideoCapture();
|
|
@@ -11667,30 +11671,30 @@ class ku extends Hv {
|
|
|
11667
11671
|
(e = this._worker) == null || e.addEventListener("message", (n) => {
|
|
11668
11672
|
switch (n.data.type) {
|
|
11669
11673
|
case Ht.Error:
|
|
11670
|
-
wn.table(n.data.data), this.emit(
|
|
11674
|
+
wn.table(n.data.data), this.emit(Ot.OnError, n.data.data);
|
|
11671
11675
|
break;
|
|
11672
11676
|
case Ht.Flvfile:
|
|
11673
11677
|
Kv(n.data.buffer);
|
|
11674
11678
|
break;
|
|
11675
11679
|
case Ht.FirstFramePushed:
|
|
11676
|
-
this.emit(
|
|
11680
|
+
this.emit(Ot.OnFirstFramePushed);
|
|
11677
11681
|
break;
|
|
11678
11682
|
case Ht.Close:
|
|
11679
|
-
this.emit(
|
|
11683
|
+
this.emit(Ot.OnConnectClosed), this.destroy();
|
|
11680
11684
|
break;
|
|
11681
11685
|
}
|
|
11682
11686
|
}), (t = this._worker) == null || t.addEventListener("error", (n) => {
|
|
11683
11687
|
this.emit(
|
|
11684
|
-
|
|
11688
|
+
Ot.OnError,
|
|
11685
11689
|
Ia(jn.WORKER_ERROR, n.message)
|
|
11686
11690
|
);
|
|
11687
11691
|
});
|
|
11688
11692
|
}
|
|
11689
11693
|
addTrack(e) {
|
|
11690
|
-
e.kind ===
|
|
11694
|
+
e.kind === Mt.Video && (this._videoMsTrack = e), e.kind === Mt.Audio && (this._audioMsTrack = e), this._setAVExist(!!this._videoMsTrack, !!this._audioMsTrack);
|
|
11691
11695
|
}
|
|
11692
11696
|
replaceTrack(e, t) {
|
|
11693
|
-
e ===
|
|
11697
|
+
e === Mt.Video && (this._videoMsTrack = t), e === Mt.Audio && (this._audioMsTrack = t), this._setAVExist(!!this._videoMsTrack, !!this._audioMsTrack), this._capture.restartCapture(e);
|
|
11694
11698
|
}
|
|
11695
11699
|
async getStats() {
|
|
11696
11700
|
var o, a;
|
|
@@ -11792,7 +11796,7 @@ function Kv(r) {
|
|
|
11792
11796
|
const e = document.createElement("a");
|
|
11793
11797
|
e.href = URL.createObjectURL(new Blob([r])), e.download = Date.now() + ".flv", e.click();
|
|
11794
11798
|
}
|
|
11795
|
-
const
|
|
11799
|
+
const Oa = new Ft("RTMPConnect");
|
|
11796
11800
|
class Wv {
|
|
11797
11801
|
constructor(e, t, n, i) {
|
|
11798
11802
|
this._opts = void 0, this._isPushing = !1, this._url = e, this._opts = t, this._onError = n, this._OnSuccess = i, this._rtmp = new ku(), this._bindEvents();
|
|
@@ -11807,21 +11811,21 @@ class Wv {
|
|
|
11807
11811
|
return 0;
|
|
11808
11812
|
}
|
|
11809
11813
|
_bindEvents() {
|
|
11810
|
-
this._rtmp.on(
|
|
11814
|
+
this._rtmp.on(Ot.OnError, (e) => {
|
|
11811
11815
|
this._isPushing = !1, this._onError(e);
|
|
11812
|
-
}), this._rtmp.on(
|
|
11816
|
+
}), this._rtmp.on(Ot.OnConnectClosed, () => {
|
|
11813
11817
|
this._isPushing = !1, this._onError(
|
|
11814
11818
|
new wu(jn.WTP_CONNECT_FAIL, "connect lost")
|
|
11815
11819
|
);
|
|
11816
|
-
}), this._rtmp.on(
|
|
11820
|
+
}), this._rtmp.on(Ot.OnFirstFramePushed, () => {
|
|
11817
11821
|
this._isPushing = !0, this._OnSuccess();
|
|
11818
11822
|
});
|
|
11819
11823
|
}
|
|
11820
11824
|
async publish(e, t, n) {
|
|
11821
|
-
await this._rtmp.ready(), n != null && n.cfg && this._rtmp.setEncodeCapacity(n.cfg), e.filter(Boolean).forEach((i) => this._rtmp.addTrack(i)), t[0] && this._rtmp.adjustBitrate(
|
|
11825
|
+
await this._rtmp.ready(), n != null && n.cfg && this._rtmp.setEncodeCapacity(n.cfg), e.filter(Boolean).forEach((i) => this._rtmp.addTrack(i)), t[0] && this._rtmp.adjustBitrate(Mt.Audio, t[0]), t[1] && this._rtmp.adjustBitrate(Mt.Video, t[1]), this._rtmp.publish(this._url);
|
|
11822
11826
|
}
|
|
11823
11827
|
updatePublish(e, t) {
|
|
11824
|
-
|
|
11828
|
+
Oa.log(`replace track to ${e == null ? void 0 : e.label}`), this._rtmp.replaceTrack(t, e);
|
|
11825
11829
|
}
|
|
11826
11830
|
applyBitrate(e, t) {
|
|
11827
11831
|
this._rtmp.adjustBitrate(t, e);
|
|
@@ -11836,7 +11840,7 @@ class Wv {
|
|
|
11836
11840
|
};
|
|
11837
11841
|
}
|
|
11838
11842
|
unpublish() {
|
|
11839
|
-
|
|
11843
|
+
Oa.warn("unpublish"), this._rtmp.unpublish(), this._isPushing = !1;
|
|
11840
11844
|
}
|
|
11841
11845
|
}
|
|
11842
11846
|
var st = /* @__PURE__ */ ((r) => (r[r.Start = 0] = "Start", r[r.Stop = 1] = "Stop", r[r.GameControl = 2] = "GameControl", r[r.InitPushReader = 3] = "InitPushReader", r[r.Online = 4] = "Online", r[r.Reconnect = 5] = "Reconnect", r[r.UpdateTrack = 6] = "UpdateTrack", r[r.SetBitrate = 7] = "SetBitrate", r[r.PassEngineEvent = 8] = "PassEngineEvent", r[r.StopSuccess = 9] = "StopSuccess", r[r.VideoLog = 10] = "VideoLog", r[r.SetJitterBuffer = 11] = "SetJitterBuffer", r[r.ResetEngine = 12] = "ResetEngine", r[r.GetStats = 13] = "GetStats", r[r.Test = 14] = "Test", r[r.Plugin = 15] = "Plugin", r[r.EnableLogger = 16] = "EnableLogger", r[r.SendLogToMain = 17] = "SendLogToMain", r))(st || {});
|
|
@@ -11991,11 +11995,11 @@ class Qv extends Yv {
|
|
|
11991
11995
|
this.messenger.sendTransportable(e, t);
|
|
11992
11996
|
}
|
|
11993
11997
|
}
|
|
11994
|
-
const zu = '(function(){"use strict";var g=(s=>(s[s.Start=0]="Start",s[s.Stop=1]="Stop",s[s.GameControl=2]="GameControl",s[s.InitPushReader=3]="InitPushReader",s[s.Online=4]="Online",s[s.Reconnect=5]="Reconnect",s[s.UpdateTrack=6]="UpdateTrack",s[s.SetBitrate=7]="SetBitrate",s[s.PassEngineEvent=8]="PassEngineEvent",s[s.StopSuccess=9]="StopSuccess",s[s.VideoLog=10]="VideoLog",s[s.SetJitterBuffer=11]="SetJitterBuffer",s[s.ResetEngine=12]="ResetEngine",s[s.GetStats=13]="GetStats",s[s.Test=14]="Test",s[s.Plugin=15]="Plugin",s[s.EnableLogger=16]="EnableLogger",s[s.SendLogToMain=17]="SendLogToMain",s))(g||{});const j=1e3;function $(){return!1}class G{constructor(){this.maxSize=j,this.supported=$(),this.supported&&(this.buffer=new SharedArrayBuffer(this.maxSize),this.arr=new Uint8Array(this.buffer))}share(e){return this.supported?(this.arr.set(e),this.buffer):e.buffer}}class q{constructor(e){this.encoder=new TextEncoder,this.decoder=new TextDecoder,this.buffer=new G,this.client=e}send(e){this.client.postMessage(e)}sendTransportable(e,t){Object.assign(e,t);const i=Object.values(t);this.client.postMessage(e,i)}onMessage(e){this.client.addEventListener("message",t=>{e(t.data)})}destroy(){var e,t;(t=(e=this.client).terminate)==null||t.call(e)}}class p{constructor(){this.usePrevEmit=!0,this._map={},this._prevData={}}hasEvent(e){return!!this._map[e]}on(e,t){if(typeof e=="object"){const i=[];for(const n in e)i.push(this.on(n,e[n]));return()=>{i.forEach(n=>n())}}else{if(!t)throw new Error("fn is required");const i=this._formatTarget(t);return this._checkPrev(e,i)&&i.once?()=>{}:(this._getList(e).push(i),()=>{this.off(e,i)})}}_formatTarget(e,t){return typeof e=="function"?{listener:e,once:t??!1,prev:this.usePrevEmit}:(typeof t=="boolean"&&(e.once=t),e)}emit(e,...t){this._prevData[e]=t;const i=this._map[e];if(!i)return!1;for(let n=0;n<i.length;n++){const r=i[n];r.listener(...t),r.once&&(i.splice(n,1),n--)}return!0}off(e,t){const i=this._map[e];if(!i)return!1;const n=i.findIndex(r=>r===t||r.listener===t);return n===-1?!1:(i.splice(n,1),!0)}clear(e){return this._map[e]?(delete this._map[e],delete this._prevData[e],!0):!1}async onWait(e,t){return new Promise(i=>{var a;let n=(...o)=>i(o);t&&(n={listener:n,...t});const r=this.once(e,n);(a=t==null?void 0:t.onclear)==null||a.call(t,r)})}destroy(){this._map={},this._prevData={}}_checkPrev(e,t){if(!t.prev)return!1;const i=this._prevData[e];return typeof i<"u"?(t.listener(...i),!0):!1}once(e,t){return this.on(e,this._formatTarget(t,!0))}head(e,t){const i=this._formatTarget(t);return this._checkPrev(e,i)&&i.once?()=>{}:(this._getList(e).unshift(t),()=>{this.off(e,t)})}headOnce(e,t){return this.head(e,this._formatTarget(t,!0))}_getList(e){let t=this._map[e];return t||(this._map[e]=t=[]),t}passEvents(e,t){t.forEach(i=>{e.on(i,n=>{this.emit(i,n)})})}}class M extends p{constructor(){super(),this.messenger=new q(globalThis),this.messenger.onMessage(this.receiveMainMessage.bind(this))}onMessage(e){this.messenger.onMessage(e)}send(e,t){this.messenger.send({type:e,data:t})}}var l=(s=>(s[s.Connecting=0]="Connecting",s[s.Open=1]="Open",s[s.Closing=2]="Closing",s[s.Closed=3]="Closed",s))(l||{}),S=(s=>(s.Init="init",s.Online="online",s.Error="error",s.ApiCall="api_call",s))(S||{});function E(){let s,e;return{ready:new Promise((i,n)=>{s=i,e=n}),resolve:s,reject:e}}function J(s=500,e){const{ready:t,resolve:i}=E(),n=setTimeout(i,s);return e==null||e(n),t}function V(s){let e=!0,t="";for(const i of s)if(!(i in window)){e=!1,t=`${i} not Supported`;break}return{supported:e,info:t}}function x({task:s,timeout:e,time:t=200}){const{ready:i,resolve:n}=E(),r=setTimeout(async()=>{let a;typeof e<"u"&&(typeof e=="function"?(a=e(),a instanceof Promise&&(a=await a)):a=e),n(a)},t);return s().then(a=>{clearTimeout(r),n(a)}),i}const K=24*60*60*1e3;function F(s,e="1d"){const t=`_me_expire_${s}`;let i=0;if(typeof e=="string"){if(!/^[0-9]+d$/.test(e))throw new Error("expire format error");i=K*parseInt(e)}else i=e;return{get(){const n=localStorage.getItem(t);if(!n)return null;let r=null;try{r=JSON.parse(n)}catch{return null}const{value:a,expire:o}=r;return o<Date.now()?(localStorage.removeItem(t),null):a},set(n){localStorage.setItem(t,JSON.stringify({value:n,expire:Date.now()+i}))},remove(){localStorage.removeItem(t)}}}function C(s){let e=s.length,t=0;for(let r=e-1;r>=0;r--)s[r]?t+=s[r].byteLength:(e--,s.splice(r,1));const i=new Uint8Array(t);let n=0;for(let r=0;r<e;r++)i.set(s[r],n),n+=s[r].byteLength;return i}function _(s){for(const e in s)typeof s[e]>"u"&&delete s[e];return s}function X(s,e){let t=Number.MAX_SAFE_INTEGER,i=0;for(const n of e){const r=Math.abs(s-n);if(r===0)return n;r<t&&(t=r,i=n)}return i}var f=(s=>(s[s.AAC=0]="AAC",s[s.OPUS=1]="OPUS",s[s.H264=2]="H264",s[s.H265=3]="H265",s[s.AV1=4]="AV1",s))(f||{});f.AAC+"",f.OPUS+"",f.H264+"",f.H265+"",f.AV1+"";const U={[f.AAC]:"mp4a.40.2",[f.OPUS]:"opus",[f.H264]:"avc1.4DE033",[f.H265]:"hev1.1.6.L93.B0"};function O({readable:s,onFrame:e,onFinish:t,onError:i}){if(!s)return()=>{};const n=s.getReader();console.log("getReader");let r=!0;return Z({reader:n,flag:()=>r,onFrame:e,onFinish:t,onError:i}),()=>{r=!1}}async function Z({reader:s,flag:e,onFrame:t,onFinish:i,onError:n}){for(;e();)try{const{done:r,value:a}=await s.read();if(r){console.warn("Stream complete"),i==null||i();return}t(a),a.close()}catch(r){console.error("read error,",r),n==null||n(r)}}function W(s){const{video:e,audio:t}=Y(s);return{video:e?R(e):void 0,audio:t?R(t):void 0}}function R(s){const e=new MediaStreamTrackProcessor(s),{readable:t}=e,i=s.getSettings();return{readable:t,settings:i}}function Y(s){return{video:s.getVideoTracks()[0],audio:s.getAudioTracks()[0]}}function ee(s){const e=new Uint8Array(s.byteLength);return s.copyTo(e),e}const u={log(){},send(){},$custom:{},$enableLog(s=!0){u.log=s?(...e)=>{console.log(L(),...e),u.enableLogSend&&z(e)}:()=>{}},$enableSend(){u.send=(...s)=>{z(s)}}};function te(){var n;typeof window=="object"&&!window.__me_debug_helper&&(window.__me_debug_helper=u);let s=location.search.substring(1);const e="_medh_",t=((n=u.$isInnerEnv)==null?void 0:n.call(u))||!0;if(!s){const{hash:r}=location,a=r.indexOf("?");if(!r||a===-1||(s=r.substring(a+1),!s))return}const i=s.split("&");for(const r of i){const[a,o]=r.split("=");if(a.startsWith(e)){let c=a.replace(e,"");if(c.startsWith("inner_")){if(!t)continue;c=c.replace("inner_","")}c==="log"?u.$enableLog():c==="send"?u.$enableSend():u[c]=o||!0}}location.hostname==="localhost"&&u.$enableLog()}function z(s){if(u.$logger)try{u.$logger(s)}catch(e){console.error(L(),"debug send fail:",e)}}function L(){const s=new Date;return`[${s.toLocaleTimeString()} ${s.getMilliseconds().toString().padStart(3,"0")} media-engine]`}te();let ie=class{constructor(){this._lastDot=0,this._totalSize=0,this._speed=[]}addSample(e){this._lastDot||(this._lastDot=Date.now()),this._totalSize+=e;const t=Date.now()-this._lastDot;t>=500&&(this._addSpeedSample(this._totalSize/t*8e3),this._totalSize=0,this._lastDot=Date.now())}_addSpeedSample(e){this._speed.push(e),this._speed=this._speed.slice(-6)}reset(){this._speed=[]}getUpSpeed(){return this._speed.length?parseInt(this._speed.reduce((e,t)=>e+=t,0)/this._speed.length):0}};class se{constructor(){this._bandwidth=0,this._dbrDataSize=0,this.MAX_ESTIMATE_DURATION_MS=2e3,this.MIN_ESTIMATE_DURATION_MS=1e3,this.packets=[]}addDbrPacket(e){this.packets.push(e),this._dbrDataSize+=e.size;const t=this.packets[0],i=e.sendEndTime-t.sendBeginTime;for(;this.packets.length>0;){const n=this.packets[0];if(e.sendEndTime-n.sendBeginTime>this.MAX_ESTIMATE_DURATION_MS)this._dbrDataSize-=n.size,this.packets.shift();else break}this._bandwidth=i>=this.MIN_ESTIMATE_DURATION_MS?this._dbrDataSize*1e3/i*8:0}getEstimateBandwidth(){return this._bandwidth}reset(){this._bandwidth=0,this._dbrDataSize=0,this.packets=[]}}class ne extends p{constructor(e,t,i){super(),this.streamWriter=null,this.datagramWriter=null,this.failQueue=[],this.bandwidth=0,this.smoothTime=0,this.failCount=0,this.timeoutCount=0,this.streamWriter=e.writable.getWriter(),this.datagramWriter=t.writable.getWriter(),this.upspeed=new ie,this.bandwidthEstimate=new se,i&&(this.strategy=i,i.upstream=this)}async resetStream(e){var t;(t=this.streamWriter)==null||t.releaseLock(),this.streamWriter=e.writable.getWriter(),this.failQueue.forEach(({data:i,config:n})=>{this.sendStream(i,n)}),this.failQueue=[]}async sendStream(e,{extra:t,force:i}={extra:{},force:!1}){var d;if(!i&&((d=this.strategy)==null?void 0:d.onSendStream(e,t))===!1)return;const n={sendBeginTime:performance.now(),size:e.byteLength,sendEndTime:0};this.upspeed.addSample(e.byteLength);const r=performance.now(),a=await this._writeData(e);if(a){(a==="error"||a==="timeout")&&(this.failQueue.push({data:e,config:{extra:t,force:i}}),this.emit("write-error",a));return}n.sendEndTime=performance.now(),this.bandwidthEstimate.addDbrPacket(n);const o=performance.now()-r||.001;this.smoothTime=this.smoothTime===0?o:this.smoothTime*.7+o*.3;const h=e.byteLength/1024*8/(this.smoothTime/1e3);this.bandwidth=Math.min(this.bandwidth===0?h:this.bandwidth*.7+h*.3,1e4)}async _writeData(e){return await x({task:()=>{if(!this.streamWriter)return Promise.resolve("no_stream");const{ready:i,resolve:n}=E();return this.streamWriter.write(e).then(()=>{n("")}).catch(()=>{this.failCount++,n("error")}),i},timeout:()=>(this.timeoutCount++,"timeout"),time:1e3})}async sendDgm(e,{extra:t,force:i}={extra:{},force:!0}){var n,r;!i&&((n=this.strategy)==null?void 0:n.onSendDgm(e,t))===!1||(this.upspeed.addSample(e.byteLength),await((r=this.datagramWriter)==null?void 0:r.write(e).catch(a=>{console.log("send dgm fail",a)})))}async destroy(){var e,t,i;try{await((e=this.streamWriter)==null?void 0:e.close()),await((t=this.datagramWriter)==null?void 0:t.close())}catch(n){console.warn("upstream destroy:",n)}this.upspeed.reset(),(i=this.strategy)==null||i.destroy()}getSpeed(){return this.upspeed.getUpSpeed()}getBandwidth(){return this.bandwidth}getEstimateBandwidth(){return this.bandwidthEstimate.getEstimateBandwidth()}clearEstimateBandwidth(){this.bandwidthEstimate.reset()}}class re extends p{constructor(e,t){super(),this.destroyed=!1,this.read(e.readable,i=>{this.emit("stream",i)},!0),this.read(t.readable,i=>{this.emit("datagram",i)})}async read(e,t=()=>{},i=!1){const n=e.getReader();for(i&&(this.streamReader=n);!this.destroyed;){const{value:r,done:a}=await n.read().catch(()=>({done:!0,value:null}));if(a)break;t(r)}}resetStream(e){this.streamReader.releaseLock(),this.read(e.readable,t=>{this.emit("stream",t)})}destroy(){this.destroyed=!0,super.destroy()}}const P={clearConnection:()=>Promise.resolve(),sendStream:async()=>{},sendDgm:async()=>{},getUpSpeed:()=>0,getUpBandwidth:()=>0,getId:()=>0};class ae extends p{constructor(e){super(),this.destroyed=!1,this._resetLock=!1,this.options=e,this.ready=this.connect(),this.ready.then(t=>{var i;t&&(this.initStream(),(i=this.transport)==null||i.closed.then(n=>{this.emit("closed",n)}).catch(n=>{this.emit("closed",{closeCode:-1,reason:`catch ${n.toString()}`})}))})}get id(){return this.options.id}async destroy(){var e,t,i,n;if(super.destroy(),!this.destroyed){this.destroyed=!0,await((e=this.upstream)==null?void 0:e.destroy()),(t=this.downstream)==null||t.destroy();try{(i=this.transport)==null||i.close(),await((n=this.transport)==null?void 0:n.closed)}catch(r){console.warn("close fail",r)}this.transport=null,u.log("close transport"),this.emit("destroyed")}}async connect(){try{const e=new WebTransport(this.options.url);if(!e)this.onFail("Init error");else{this.transport=e;const t=await x({task:async()=>{var i;try{return await((i=this.transport)==null?void 0:i.ready),u.log("transport ready"),""}catch(n){return`Ready Catch: ${(n==null?void 0:n.toString())||"Fail"}`}},timeout:"Init timeout",time:2e3});if(t)this.onFail(t);else return this.emit("success"),!0}}catch(e){this.onFail(`Init Catch: ${(e==null?void 0:e.toString())||"Fail"}`)}return!1}onFail(e){this.emit("fail",e),this.transport=null,this.destroy()}async initStream(){const{transport:e}=this;if(!e)return;const t=await this.createBidStream();if(!t)return;this._prevStream=t;const i=e.datagrams;this.upstream=new ne(t,i,this.options.strategy),this.downstream=new re(t,i),this.downstream.on({stream:n=>this.emit("stream",n),datagram:n=>{this.emit("datagram",n)}}),this.upstream.on("write-error",()=>{this.resetStream()}),this.emit("upstream-ready")}async resetStream(){var t,i,n,r;if(this._resetLock)return;this._resetLock=!0;const e=await this.createBidStream();if(!e){this._resetLock=!1;return}(t=this.upstream)==null||t.resetStream(e),(i=this._prevStream)==null||i.writable.close(),(n=this.downstream)==null||n.resetStream(e),(r=this._prevStream)==null||r.readable.cancel(),this._prevStream=e,this._resetLock=!1}async createBidStream(){var e;return(e=this.transport)==null?void 0:e.createBidirectionalStream()}}class oe{constructor(e){this.index=0,this.gaps=[5,5,5,5,10,10,10,20,20,30,30,40,50,70,100],this.count=0,this.n=this.gaps.length,this.max=this.gaps[this.n-1]*100,this.maxCount=e}reset(){this.index=0,this.count=0}get gap(){return typeof this.maxCount=="number"&&this.count>=this.maxCount?0:(this.count++,this.index>=this.n-1?this.max:this.gaps[this.index++]*100)}}class ce extends p{constructor(){super(...arguments),this.readyState=l.Connecting,this.connectId=0,this.connectionUtil=P,this.destroyed=!1}setState(e){this.readyState=e}get isConnecting(){return this.readyState===l.Connecting}async init(e){this.options=Object.assign({autoReconnect:!0,useDownstream:!0},e),this.reconnectGap=new oe(e.maxCount),await this.connect({connectReason:S.Init})}async connect({first:e=!0,connectReason:t,url:i}){if(this.destroyed)return this.setState(l.Closed),Promise.resolve("Reconnector destroyed");const n=t===S.Init;e&&(this.reconnectGap.reset(),n||this.emit("reconnecting",t)),this.setState(l.Connecting);const{success:r,reason:a}=await this.singleConnect(i);if(this.destroyed)return this.setState(l.Closed),Promise.resolve("Reconnector destroyed stage2");if(!r){const{gap:o}=this.reconnectGap,c=e&&n?"connect-fail":"reconnect-fail";return this.emit(c,a),o===0||!this.options.autoReconnect?(this.emit("end"),this.setState(l.Closed),a):(await J(o,h=>this.delayTimer=h),this.connect({first:!1,url:i,connectReason:S.Error}))}return this.setState(l.Open),this.emit("connect-open",n),this.onConnected(),n||this.onMonitorConnectionNormal(),""}async onConnected(){var t;(t=this.clearWaitClosed)==null||t.call(this);const[e]=await this.onWait("connection-closed",{onclear:i=>this.clearWaitClosed=i});if(e.closeCode!==-1){if(console.log("reason",e.reason),this.emit("connect-close",e.reason||""),this.isConnecting){console.warn("isConnecting",e.reason);return}console.log("close: webts closed gracefully.",e.reason),e.closeCode===0&&(this.emit("end"),this.setState(l.Closed))}else{const i=e.reason;console.error("close: webts closed due to ",e),this.emit("connect-close",i),this.emit("disconnected",i),this.options.autoReconnect?this.connect({connectReason:S.Error}):(this.emit("connect-fail",i),this.emit("end"))}}onMonitorConnectionNormal(){this.options.useDownstream&&(this.waitTimer=setTimeout(()=>{this.emit("reconnect-fail","no packet"),this.emit("connect-close","no packet received"),this.emit("end"),this.setState(l.Closed)},3e3))}onReceivePacket(e){this.waitTimer!==null&&(e<10||(clearTimeout(this.waitTimer),this.waitTimer=null,console.warn("DEBUG 重连恢复收包"),this.emit("reconnected")))}async singleConnect(e){const{resolve:t,ready:i}=E();await this.clearReconnect();const n=new ae({id:this.connectId++,url:e||this.options.url,strategy:this.options.strategy});n.on({success:()=>{t({success:!0,reason:""})},fail:a=>{t({success:!1,reason:a})},destroyed:()=>{t({success:!1,reason:"Connection destroyed"})},datagram:a=>{this.onReceivePacket(a.byteLength),this.emit("datagram",a)},closed:a=>{this.emit("connection-closed",a)}}),this.passEvents(n,["upstream-ready","stream"]);const r=n.onWait("upstream-ready");return this.connectionUtil={clearConnection:()=>n.destroy(),sendStream:async(a,o)=>{var c;if(!n.destroyed)return await r,(c=n.upstream)==null?void 0:c.sendStream(a,o)},sendDgm:async(a,o)=>{var c;if(!n.destroyed)return await r,(c=n.upstream)==null?void 0:c.sendDgm(a,o)},getUpSpeed:()=>{var a;return((a=n.upstream)==null?void 0:a.getSpeed())||0},getUpBandwidth:()=>{var a;return((a=n.upstream)==null?void 0:a.getBandwidth())||0},getId:()=>n.id},i}async destroy(){this.destroyed||(this.destroyed=!0,await this.clearReconnect(),this.emit("connect-close","api call"),this.emit("disconnected","api call"),super.destroy())}async clearReconnect(){var e;await((e=this.connectionUtil)==null?void 0:e.clearConnection()),clearTimeout(this.delayTimer),clearTimeout(this.waitTimer),this.waitTimer=this.delayTimer=null}onlineReconnect(){this.options.autoReconnect&&(this.clearReconnect(),this.connect({first:!0,connectReason:S.Online}))}}class he extends p{get readyState(){var e;return((e=this.reconnector)==null?void 0:e.readyState)||l.Closed}get closed(){return this.readyState===l.Closed}get connection(){var e;return((e=this.reconnector)==null?void 0:e.connectionUtil)||P}async init(e){this.reconnector=new ce,this.initEvents(),this.ready=this.reconnector.init({...Object.assign({useDownstream:!0},e)}),await this.ready}async close(){await this.reconnector.destroy()}online(){this.reconnector.onlineReconnect()}reconnect(e){this.reconnector.connect({connectReason:S.ApiCall,url:e})}async sendStream(e,t){var i;return await this.ready,(i=this.connection)==null?void 0:i.sendStream(e,t)}async sendDgm(e,t){var i;return await this.ready,(i=this.connection)==null?void 0:i.sendDgm(e,t)}initEvents(){this.passEvents(this.reconnector,["reconnected","reconnect-fail","connect-close","disconnected","reconnecting","connect-fail","connect-open","upstream-ready","stream","datagram"])}getUpSpeed(){return this.connection.getUpSpeed()}getUpBandwidth(){return this.connection.getUpBandwidth()}async destroy(){await this.close(),super.destroy()}}class de extends p{sendStream(e,t){return this.upstream.sendStream(e,{force:!0,extra:t})}sendDgm(e,t){return this.upstream.sendDgm(e,{force:!0,extra:t})}}class ue{constructor(){this.totalFrames=0,this.periodFrames=0,this.periodSize=0,this.periodDuration=0,this.keyFrames=0,this.bitrate=0,this.framerate=0,this.lastTs=0}addFrame(e){const t=e.byteLength;let i=0;const n=Math.round(e.timestamp/1e3);this.lastTs!==0&&(i=n-this.lastTs),this.lastTs=n,this.totalFrames++,this.periodFrames++,this.periodSize+=t,this.periodDuration+=i,e.type==="key"&&this.keyFrames++,this.periodDuration>=1e3&&(this.bitrate=Math.floor(this.periodSize/this.periodDuration*8e3),this.framerate=this.periodFrames,this.periodFrames=0,this.periodDuration=0,this.periodSize=0)}getStats(){return{bitrate:this.bitrate,framerate:this.framerate,encodedFrames:this.totalFrames,encodedKeyFrames:this.keyFrames,codec:""}}reset(){this.totalFrames=0,this.periodFrames=0,this.periodSize=0,this.periodDuration=0,this.keyFrames=0,this.bitrate=0,this.framerate=0,this.lastTs=0}}class H extends p{constructor(){super(...arguments),this.configInitialized=!1,this.firstFrame=!1,this.stats=new ue,this._config={},this._finalConfig={},this._decoderConfig={},this._destroyed=!1}extraEncodeConfig(){return{}}getStats(){return this.stats.getStats()}get mediaType(){return this._config.mediaType}async updateConfig(e){if(e=_(e),Object.keys(e).length===0)return;Object.assign(this._config,e),this.encoder&&(await this.encoder.flush(),this.encoder.close(),this.init());const t=await this.checkConfigSupported(this.formatConfig());this._config={...this._config,...t},this._finalConfig=this.formatConfig(),this.configInitialized=!1}getConfig(){return this._config}getDecoderConfig(){return this._decoderConfig}init(e){e&&this.updateConfig(e),u.log("init encoder"),this.encoder=new this.Encoder({output:(t,i)=>{t.syncTimestamp=t.timestamp,this.stats.addFrame(t);const n=i==null?void 0:i.decoderConfig;let r;n&&(r=n,Object.assign(this._decoderConfig,n),this.emit("decoder-config-change",this._decoderConfig)),this.emit("frame-encoded",t,r),this.firstFrame||(this.emit("first-frame-encoded",t,r),this.firstFrame=!0)},error:t=>{this.emit("encode-error",t)}})}encode(e){var t;if(!this._destroyed){if(!this.configInitialized){const i=this._finalConfig;(t=this.encoder)==null||t.configure(i),this.configInitialized=!0,console.warn("configure final done",i)}this.encoder.encode(e,this.extraEncodeConfig())}}async destroy(){var e,t;this.stats.reset(),this._destroyed=!0;try{await((e=this.encoder)==null?void 0:e.flush()),(t=this.encoder)==null||t.close()}catch{}super.destroy()}async checkConfigSupported(e,t=!1){if(this.Encoder.isConfigSupported)try{const{config:i,supported:n}=await this.Encoder.isConfigSupported(e);if(n)return e;if(!t&&this.retryConfig)return this.checkConfigSupported(this.retryConfig(e),!0);this.emit("config-error",{message:"config not supported",config:i})}catch(i){if(!t&&this.retryConfig)return this.checkConfigSupported(this.retryConfig(e));this.emit("config-error",{message:"config uncaught error",err:i,config:e})}}}F("audio_encoder_support","3d");function le(){return V(["EncodedAudioChunk","AudioEncoder","AudioData"])}const m={mediaType:f.H264,format:"annexb",bitrate:2e5,framerate:15,bitrateMode:"variable",keyInterval:3e3,keyGopSize:90,hardwareAcceleration:"prefer-hardware",latencyMode:"quality"},w={mediaType:f.AAC,bitrate:96e3,sampleRate:48e3,numberOfChannels:2,bitrateMode:"constant"},T=class T extends H{constructor(){super(...arguments),this.Encoder=AudioEncoder,this.isAudio=!0}updateConfig(e){if(typeof e.bitrate=="number"){const t=[96e3,128e3,16e4,192e3],i=X(e.bitrate,t);i!==e.bitrate&&(console.warn(`audio bitrate ${e.bitrate} not supported, use ${i} instead`),e.bitrate=i)}return super.updateConfig(e)}getStats(){const{codec:e="",numberOfChannels:t=0,sampleRate:i=0}=this._finalConfig;return{...super.getStats(),codec:e,numberOfChannels:t,sampleRate:i}}formatConfig(e){const{bitrate:t=w.bitrate,bitrateMode:i=w.bitrateMode,codec:n=w.codec||U[this._config.mediaType??w.mediaType],numberOfChannels:r=w.numberOfChannels,format:a=w.format||(e==null?void 0:e.format),sampleRate:o=w.sampleRate}=this._config,c=_({codec:n,sampleRate:o,numberOfChannels:r,bitrate:t,bitrateMode:i,format:a});return this.emit("config-change",c),c}};T.isSupported=le;let v=T;F("video_encoder_support","3d");function fe(){return V(["EncodedVideoChunk","VideoEncoder","VideoFrame"])}function me(s=m.keyInterval){let e=!0,t;return{is(){return e?(e=!1,t=setTimeout(()=>{e=!0},s),!0):!1},reset(){e=!0,clearTimeout(t)}}}function pe(s=m.keyGopSize){let e=s;return{is(){return e++,e>=s?(e=0,!0):!1},reset(){e=s}}}const B=class B extends H{constructor(){super(...arguments),this.Encoder=VideoEncoder,this.isAudio=!1,this.retryConfig=e=>(e.hardwareAcceleration==="prefer-hardware"&&(e.hardwareAcceleration="prefer-software",this._config.hardwareAcceleration="prefer-software",console.warn("retry config with software hardwareAcceleration")),e)}getStats(){const e=super.getStats();let{keyGopSize:t}=this._finalConfig;const{keyInterval:i=m.keyInterval}=this._config,{width:n=0,height:r=0,codec:a="",framerate:o=0}=this._finalConfig;return typeof t>"u"&&(t=Math.round(i/1e3*o)),{...e,width:n,height:r,codec:a,keyGopSize:t}}formatConfig(e){const{codec:t=m.codec||U[this._config.mediaType??m.mediaType],bitrate:i=m.bitrate,framerate:n=m.framerate,keyInterval:r=m.keyInterval,hardwareAcceleration:a=m.hardwareAcceleration,latencyMode:o=m.latencyMode,keyGopSize:c,width:h=m.width||(e==null?void 0:e.codedWidth),height:d=m.height||(e==null?void 0:e.codedHeight)}=this._config;this.keyframe=c?pe(c):me(r);const b=_({latencyMode:o,codec:t,hardwareAcceleration:a,bitrate:i,width:h,height:d,framerate:n});return console.log("config video",JSON.stringify(b,null,2)),this.emit("config-change",b),b}extraEncodeConfig(){return{keyFrame:this.keyframe.is()}}resetKeyFrame(){var e;(e=this.keyframe)==null||e.reset()}async destroy(){try{this.resetKeyFrame()}catch{}await super.destroy()}};B.isSupported=fe;let k=B;const N=16;function Q(){let s=-1,e=-1,t=-1;return{getLatest(){return s},setBase(i){t===-1&&(t=i)},check(i){return s===-1?s=t:s+=i-e,e=i,s},reset(){s=e=t=-1}}}class ge extends p{constructor(){super(...arguments),this.video=Q(),this.audio=Q(),this.base=N,this._sendQueue=[],this._processedVideo=!1,this._processedAudio=!1,this._maximumVideoSyncTimestamp=0,this._maximumAudioSyncTimestamp=0,this.cacheAudioChunk=[],this.cacheVideoChunk=[],this.hasGetFirstVideoFrame=!1,this.SYNC_THRESHOLD=40}insertPacket(e,t,i){let n=0;for(;n<this._sendQueue.length&&!(this._sendQueue[n].frame.syncTimestamp===e.syncTimestamp&&t==="video"||this._sendQueue[n].frame.syncTimestamp>e.syncTimestamp);n++);this._sendQueue.splice(n,0,{frame:e,type:t,cfg:i})}processPacket(e,t,i){switch(this._processedAudio&&this._processedVideo||(t==="video"?this._processedVideo=!0:this._processedAudio=!0),this.insertPacket(e,t,i),t){case"video":this._maximumVideoSyncTimestamp<e.syncTimestamp&&(this._maximumVideoSyncTimestamp=e.syncTimestamp);break;case"audio":this._maximumAudioSyncTimestamp<e.syncTimestamp&&(this._maximumAudioSyncTimestamp=e.syncTimestamp);break}if(this._processedAudio&&this._processedVideo)for(;this._sendQueue.length>0;){const r=this._sendQueue[0];if(!this.checkOpposingTimestamp(r.frame,r.type))return!1;this.emit("processed-frame",r.frame,r.type,r.cfg),this._sendQueue.shift()}}checkOpposingTimestamp(e,t){switch(t){case"audio":return this._maximumVideoSyncTimestamp>e.syncTimestamp;case"video":return this._maximumAudioSyncTimestamp>e.syncTimestamp;default:return!1}}formatFrame(e,t,i,n){this[t].setBase(this.base);const a=Math.round(e.timestamp/1e3),o=this[t].check(a);return e.syncTimestamp=o,this.processPacket(e,t,n),[e]}syncAVFrame(e,t){if(t==="audio")this.cacheAudioChunk.push(e),this.cacheAudioChunk.sort((i,n)=>i.syncTimestamp-n.syncTimestamp);else if(this.cacheVideoChunk.push(e),this.cacheVideoChunk.sort((i,n)=>i.syncTimestamp-n.syncTimestamp),!this.hasGetFirstVideoFrame)return this.hasGetFirstVideoFrame=!0,null;return this.flushSynchronizedFrames()}flushSynchronizedFrames(){const e=[];for(;this.canSendFrame();){const t=this.getNextFrameToSend();if(t)e.push(t);else break}return e}canSendFrame(){if(this.cacheAudioChunk.length===0&&this.cacheVideoChunk.length===0)return!1;if(this.cacheAudioChunk.length===0)return this.cacheVideoChunk.length>0;if(this.cacheVideoChunk.length===0)return!1;const e=this.cacheAudioChunk[0],t=this.cacheVideoChunk[0];return Math.abs(e.syncTimestamp-t.syncTimestamp)<=this.SYNC_THRESHOLD}getNextFrameToSend(){if(this.cacheAudioChunk.length===0&&this.cacheVideoChunk.length>0)return this.cacheVideoChunk.shift()||null;if(this.cacheVideoChunk.length===0&&this.cacheAudioChunk.length>0||this.cacheAudioChunk.length===0&&this.cacheVideoChunk.length===0)return null;const e=this.cacheAudioChunk[0],t=this.cacheVideoChunk[0];return e.syncTimestamp<=t.syncTimestamp?this.cacheAudioChunk.shift()||null:this.cacheVideoChunk.shift()||null}reset(){this.audio.reset(),this.video.reset(),this.base=N,this._processedAudio=!1,this._processedVideo=!1,this._maximumAudioSyncTimestamp=0,this._maximumVideoSyncTimestamp=0,this.cacheAudioChunk=[],this.cacheVideoChunk=[],this.hasGetFirstVideoFrame=!1}}var y=(s=>(s[s.AUDIO=8]="AUDIO",s[s.VIDEO=9]="VIDEO",s[s.SCRIPT_DATA=18]="SCRIPT_DATA",s))(y||{}),A=(s=>(s[s.SEQUENCE_HEADER=0]="SEQUENCE_HEADER",s[s.AAC=1]="AAC",s))(A||{}),D=(s=>(s[s.SEQUENCE_HEADER=0]="SEQUENCE_HEADER",s[s.NALU=1]="NALU",s))(D||{}),I=(s=>(s[s.KEY=1]="KEY",s[s.INNER=2]="INNER",s))(I||{});const _e=10,ye=1,Se=7,we={96e3:0,48e3:3,44100:4,22050:7,16e3:8,8e3:11};function be(s){const e=(s[4]&3)+1;let t;const i=[],n=[];let r=6;const a=s[5]&31;let o;for(let d=0;d<a;d++){if(o=s[r]<<8|s[r+1],r+=2,!o)continue;const b=s.subarray(r,r+o);r+=o,i.push(b)}const c=s[r];r++;let h;for(let d=0;d<c;d++)h=s[r]<<8|s[r+1],r+=2,h&&(n.push(s.subarray(r,r+h)),r+=h);return{sps:t,spsArr:i,ppsArr:n,nalUnitSize:e}}class Ce{constructor(){this._cfg={hasVideo:!1,hasAudio:!1,sampleRate:48e3,numberOfChannels:1},this._hasVideoSeqHeader=!1}get hasVideo(){return!!this._cfg.hasVideo}get hasAudio(){return!!this._cfg.hasAudio}setConfig(e){this._cfg=Object.assign(this._cfg,e),console.log("---flv setConfig",this._cfg)}genHeader(){const e=[70,76,86,1,(this.hasAudio?1:0)<<2|(this.hasVideo?1:0),0,0,0,9,0,0,0,0];return new Uint8Array(e)}geneSEQ(e,t){let i;return e===y.AUDIO?i=this._genAudioSEQPayload():(i=this._genVideoSEQPayload(t.frame.type,t.description),this._hasVideoSeqHeader=!0),this._concatPayload(e,t.frame.syncTimestamp,i)}genPayload(e){const t=e.type===y.AUDIO,i=ee(e.frame),n=C([t?this._genAudioTagHeader():this._genVideoTagHeader(e.frame.type),t?this._genAudioData(i):this._genVideoData(e,i)]);return this._concatPayload(e.type,e.frame.syncTimestamp,n)}_concatPayload(e,t,i){const n=this._genTagHeader(e,i.length,t),r=n.length+i.length;return C([n,i,new Uint8Array([r>>>24,r>>>16,r>>>8,r])])}_genTagHeader(e,t,i){return new Uint8Array([e,t>>>16,t>>>8,t,i>>>16,i>>>8,i,i>>>24,0,0,0])}_genAudioSEQPayload(){return C([this._genAudioTagHeader(),this._genAudioSequenceHeader()])}_genVideoSEQPayload(e,t){return C([this._genVideoTagHeader(e),this._genVideoSequenceHeader(t)])}_genAudioTagHeader(){return new Uint8Array([_e<<4|12|ye<<1|this._cfg.numberOfChannels-1])}_genVideoTagHeader(e){return new Uint8Array([(e==="key"?I.KEY:I.INNER)<<4|Se,this._hasVideoSeqHeader?D.NALU:D.SEQUENCE_HEADER,0,0,0])}_genAudioSequenceHeader(){const e=4096|we[this._cfg.sampleRate]<<7|this._cfg.numberOfChannels<<3;return new Uint8Array([A.SEQUENCE_HEADER,e>>8,e])}_genAudioData(e){const t=new Uint8Array(1+e.length);return t.set([A.AAC],0),t.set(e,1),t}_genVideoSequenceHeader(e){return new Uint8Array(e||[])}_genVideoData(e,t){if(e.frame.type==="delta")return t;const i=be(new Uint8Array(e.description)),n=i.spsArr[0].length,r=i.ppsArr[0].length;return C([new Uint8Array([0,0,n>>8,n%256]),i.spsArr[0],new Uint8Array([0,0,r>>8,r%256]),i.ppsArr[0],t])}reset(){this._hasVideoSeqHeader=!1}}class Ee{constructor(){this._firstFrame=!0,this._flv=new Ce}updateConfig(e){e&&this._flv.setConfig(e)}receiveMediaFrame(e,t){const i=e.type===y.AUDIO;this._firstFrame&&i||(this._firstFrame&&(t({buffer:this._flv.genHeader(),type:"header"}),this._flv.hasAudio&&t({buffer:this._flv.geneSEQ(y.AUDIO,e),type:"seq"}),this._flv.hasVideo&&t({buffer:this._flv.geneSEQ(y.VIDEO,e),type:"seq"}),this._firstFrame=!1),t({buffer:this._flv.genPayload(e),type:"payload"}))}reset(){this._firstFrame=!0,this._flv.reset()}destroy(){this.reset()}}class ve{constructor(e=1e3){this._packets=[],this._latestDts=0,this._videoDuration=0,this._batchSize=e}addPacket(e,t){this._packets.push({data:e,isSeparator:!1,...t}),t.mediaType==="video"&&(this._latestDts=t.dts||0)}getVideoDuration(){const e=this._packets.find(t=>t.mediaType==="video");return!e||!e.dts?0:this._latestDts-e.dts}shift(){if(this._packets.length===0)return;let e=0;for(const r of this._packets)e+=r.data.byteLength;if(e<this._batchSize)return;const t=new Uint8Array(this._batchSize);let i=0,n=this._batchSize;for(;n>0&&this._packets.length>0;){const r=this._packets[0],a=r.data.byteLength;if(a<=n)t.set(r.data,i),i+=a,n-=a,this._packets.shift();else{const o=r.data.slice(0,n);t.set(o,i),this._packets[0]={...r,data:r.data.slice(n),isSeparator:!0},n=0}}return t}shiftSinglePacket(){if(this._packets.length===0)return;const e=this._packets.shift();return e==null?void 0:e.data}forceShift(){if(this._packets.length===0)return;let e=0;for(const a of this._packets)e+=a.data.byteLength;const t=Math.min(e,this._batchSize),i=new Uint8Array(t);let n=0,r=t;for(;r>0&&this._packets.length>0;){const a=this._packets[0],o=a.data.byteLength;if(o<=r)i.set(a.data,n),n+=o,r-=o,this._packets.shift();else{const c=a.data.slice(0,r);i.set(c,n),this._packets[0]={...a,data:a.data.slice(r),isSeparator:!0},r=0}}return i}dropPackets(e){const t=Math.min(e,this._packets.length);this._packets.splice(0,t)}dropVideoPackets(){this._packets=this._packets.filter(e=>e.mediaType!=="video")}get size(){return this._packets.length}get totalBytes(){return this._packets.reduce((e,t)=>e+t.data.byteLength,0)}get hasEnoughData(){return this.totalBytes>=this._batchSize}reset(){this._packets=[]}setBatchSize(e){this._batchSize=e}}class ke{constructor(){this._lastDot=0,this._totalSize=0,this._speed=[]}addSample(e){this._lastDot||(this._lastDot=Date.now()),this._totalSize+=e;const t=Date.now()-this._lastDot;t>=500&&(this._addSpeedSample(this._totalSize/t*8e3),this._totalSize=0,this._lastDot=Date.now())}_addSpeedSample(e){this._speed.push(e),this._speed=this._speed.slice(-6)}reset(){this._speed=[]}getUpSpeed(){return this._speed.length?parseInt(this._speed.reduce((e,t)=>e+=t,0)/this._speed.length):0}}class Ae extends de{constructor(e,t){super(),this.context=e,this.upSpeed=new ke,this.streamBuffer=new ve,this._inAdjustEncode=!1,this._dbrIncTimeout=0,this._dbrPrevBitrate=0,this._increaseTimer=0,this.isSending=!1,this.config={maxCacheSize:50,realSpeedPercent:.8,setting:{},uplinkBitrateCheckInterval:4*1e3,dbrIncreaseStep:.1},this.getCurrentBitrate=()=>this.context.videoEncoderConfig.bitrate??0,t&&this.updateConfig(t)}reset(){this.upSpeed.reset(),this.streamBuffer.reset(),this.isSending=!1,clearInterval(this._increaseTimer),this._increaseTimer=0,this._inAdjustEncode=!1}updateConfig(e){Object.assign(this.config,e)}_isHavingCongestion(){return this.streamBuffer.size>this.config.maxCacheSize}_setEncoderBitrate(e){const{width:t,height:i,framerate:n}=this.context.videoEncoderConfig;console.log(`set encode bitrate to specified ${e}`),this.context.emit("video-encoder-config",{bitrate:e,width:t,height:i,framerate:n}),this._inAdjustEncode=!0}_increaseBitrate(){this._dbrIncTimeout=0,this._dbrPrevBitrate=this.getCurrentBitrate();const e=this.context.videoEncoderConfig.originBitrate;if(!e)return;let t=this.getCurrentBitrate()+e*this.config.dbrIncreaseStep;t>=e?t=e:this._dbrIncTimeout=Date.now()+this.config.uplinkBitrateCheckInterval,this._setEncoderBitrate(t)}_decreaseBitrate(){const e=this._dbrPrevBitrate;let t=0,i;if(this.upstream.getEstimateBandwidth()&&this.upstream.getEstimateBandwidth()<this.getCurrentBitrate()&&(t=Math.floor(this.upstream.getEstimateBandwidth()*90/100/1e5)*1e5,t<50*1e3&&(t=50*1e3),this.upstream.clearEstimateBandwidth()),t)i=t;else if(e)console.log("use prev bitrate",e),i=e;else return;this._dbrPrevBitrate=0,this._dbrIncTimeout=Date.now()+this.config.uplinkBitrateCheckInterval,this._setEncoderBitrate(i)}_checkBitrate(){this._dbrIncTimeout&&Date.now()>=this._dbrIncTimeout&&(this._isHavingCongestion()?this._dbrIncTimeout=Date.now()+this.config.uplinkBitrateCheckInterval:this._increaseBitrate()),this._isHavingCongestion()&&this.streamBuffer.getVideoDuration()>500&&this._decreaseBitrate()}onSendStream(e,t){return this._checkBitrate(),this.streamBuffer.addPacket(e,t),this.upSpeed.addSample(e.byteLength),this._sendBuffer(),!1}async _sendBuffer(){if(!this.isSending){for(this.isSending=!0;;){const e=this.streamBuffer.shiftSinglePacket();if(!e)break;await this.sendStream(e)}this.isSending=!1}}onSendDgm(){return!0}_checkDeleteCache(e=!1){this._inAdjustEncode&&e&&(console.log(`ajust encode setting finish, delete cached ${this.streamBuffer.size} frame`),this.streamBuffer.reset(),this.upSpeed.reset(),this._inAdjustEncode=!1)}}class De extends p{constructor(e){super(),this.entry=e,this.on({"video-encoder-config":t=>{this.entry.videoEncoder.updateConfig(t)},"audio-encoder-config":t=>{this.entry.audioEncoder.updateConfig(t)}})}get videoEncoderConfig(){return this.entry.videoEncoder.getConfig()}get audioEncoderConfig(){return this.entry.audioEncoder.getConfig()}}class Ie extends p{constructor({videoEncoder:e,audioEncoder:t,transport:i,flv:n,strategy:r,formatAV:a=!0}={}){super(),this.hasVideo=!0,this.stopVideoInput=()=>{},this.stopAudioInput=()=>{},this._isVideoEncoded=!1,this._destroy=!1,this.reconnecting=!1,this.context=new De(this),this.videoEncoder=e||new k,this.audioEncoder=t||new v,this.transport=i||new he,this.flv=n||new Ee,a&&(this.avFormat=new ge,this.initAvFormatEventListener()),this.strategy=r||new Ae(this.context);const{sampleRate:o,numberOfChannels:c}=this.audioEncoder.getConfig();this.flv.updateConfig(_({sampleRate:o,numberOfChannels:c}))}initAvFormatEventListener(){this.avFormat.on("processed-frame",(e,t,i)=>{const n=e;if(n instanceof EncodedAudioChunk&&this.flv.receiveMediaFrame({type:y.AUDIO,frame:n},({buffer:r,type:a})=>{this.transport.sendStream(r,{extra:{isAudio:!0,type:a,key:!0,mediaType:"audio",dts:n.syncTimestamp}})}),n instanceof EncodedVideoChunk){const r=n.type==="key";this.flv.receiveMediaFrame({type:y.VIDEO,frame:n,description:i==null?void 0:i.description},({buffer:a,type:o})=>{this.transport.sendStream(a,{extra:{isAudio:!1,type:o,key:r,mediaType:"video",dts:n.syncTimestamp}})})}})}start(e){const t=e.data,i={},n={};if(e.video){const{width:r,height:a,frameRate:o}=t.setting.video||{};Object.assign(i,_({width:r,height:a,framerate:o}))}if(e.audio){const{sampleRate:r,channelCount:a}=t.setting.audio||{};Object.assign(n,_({sampleRate:r,numberOfChannels:a}))}if(t.cfg){const{channel:r,gopSize:a,sampleRate:o}=t.cfg;e.video&&Object.assign(i,_({keyGopSize:a,bitrate:t.bitrate.video,originBitrate:t.bitrate.video})),e.audio&&Object.assign(n,_({numberOfChannels:r,sampleRate:o,bitrate:t.bitrate.audio}))}this.videoEncoder.updateConfig(i),this.audioEncoder.updateConfig(n),this.init({transport:{url:t.url,maxReconnectCount:t.maxReconnectCount,autoReconnect:t.autoReconnect},input:{audio:e.audio,video:e.video}}),console.log("On worker start",t)}async init(e){this.initPassEvents();const{url:t,maxReconnectCount:i,autoReconnect:n}=e.transport;this.options=e,await this.transport.init({url:t,maxReconnectCount:i,autoReconnect:n,strategy:this.strategy,useDownstream:!1}),this.initSyncStuff(e),this.emit("engine-ready")}initPassEvents(){this.passEvents(this.transport,["connect-open","connect-close","disconnected","reconnecting","reconnected","reconnect-fail","connect-fail"])}initWriter(e){e&&(e.stream?this.initInputWithStream(e.stream):(e.audio||e.video)&&this.initInput({video:e.video,audio:e.audio}))}initSyncStuff({encoder:e,input:t,flv:i}){this.videoEncoder.init(e==null?void 0:e.video),this.audioEncoder.init(e==null?void 0:e.audio),this.initWriter(t),this.flv.updateConfig(i),this.initEngineEvents()}async initInput({audio:e,video:t}){this.hasVideo=!!t,this.flv.updateConfig({hasAudio:!!e,hasVideo:!!t}),await this.transport.onWait("upstream-ready");const i=(r=!1)=>()=>{console.log("encode finish: ",r)},n=(r=!1)=>a=>{console.warn("encode error: ",r,a)};e&&(this.stopAudioInput=O({readable:e,onFrame:r=>{this._destroy||this.reconnecting||this.audioEncoder.encode(r)},onFinish:i(!0),onError:n(!0)})),t&&(this.stopVideoInput=O({readable:t,onFrame:r=>{this._destroy||this.reconnecting||this.videoEncoder.encode(r)},onFinish:i(),onError:n()}))}initInputWithStream(e){const{video:t,audio:i}=W(e);this.hasVideo=!!t,t&&this.videoEncoder.updateConfig(t.settings),i&&this.audioEncoder.updateConfig(i.settings),this.initInput({video:t==null?void 0:t.readable,audio:i==null?void 0:i.readable})}muxAndSend(e,t,i){this.avFormat.formatFrame(e,t,this.hasVideo,i)}initEngineEvents(){this._isVideoEncoded=!this.hasVideo,this.audioEncoder.on({"first-frame-encoded":()=>{this.emit("first-audio-frame-encoded")},"frame-encoded":e=>{this.reconnecting||this.muxAndSend(e,"audio")},"encode-error":e=>{this.triggerError("audio encode error",e)},"config-error":e=>{this.triggerError("audio config error",e)},"config-change":e=>{console.log("Encoder config audio",e)},"decoder-config-change":e=>{this.flv.updateConfig(e)}}),this.videoEncoder.on({"first-frame-encoded":()=>{this.emit("first-video-frame-encoded")},"frame-encoded":(e,t)=>{this.reconnecting||(this._isVideoEncoded||(this._isVideoEncoded=!0),this.muxAndSend(e,"video",t))},"encode-error":e=>{this.triggerError("video encode error",e)},"config-error":e=>{this.triggerError("video config error",e)},"config-change":e=>{console.log("Encoder config video",e)}})}triggerError(e,t){this.emit("error",{info:e,err:t})}async destroy(){this.stopVideoInput(),this.stopAudioInput(),console.log("transport close 1"),await this.transport.destroy(),await this.videoEncoder.destroy(),await this.audioEncoder.destroy(),this.flv.destroy(),super.destroy()}online(){this.transport.online()}setBitrate(e,t){(t==="audio"?this.audioEncoder:this.videoEncoder).updateConfig({bitrate:e,originBitrate:e})}getStats(){return{video:this.videoEncoder.getStats(),audio:this.audioEncoder.getStats(),upspeed:this.transport.getUpSpeed(),upBandwidth:this.transport.getUpBandwidth()}}async reconnect(e){this.reconnecting=!0,this.strategy.reset(),this.avFormat.reset(),this.flv.reset(),this._isVideoEncoded=!this.hasVideo,this.videoEncoder.resetKeyFrame(),this.transport.reconnect(e),await this.transport.onWait("upstream-ready",{prev:!1}),this.reconnecting=!1}}class Te extends M{receiveMainMessage(e){var t,i,n,r,a,o,c;switch(e.type){case g.Start:{this.startMsg=e,this.engine=new Ie,this.initPassEvents(),this.engine.start(e);break}case g.Stop:(t=this.engine)==null||t.destroy();break;case g.UpdateTrack:{const{engine:h}=this;if(!h)return;const d=e.data;d.isAudio?h.stopAudioInput():h.stopVideoInput(),h.initInput({[d.isAudio?"audio":"video"]:d.stream}),(i=h.avFormat)==null||i.reset(),d.setting&&(d.isAudio?h.audioEncoder:h.videoEncoder).updateConfig(d.setting)}break;case g.SetBitrate:(n=this.engine)==null||n.setBitrate(e.data.bitrate,e.data.type);break;case g.Online:(r=this.engine)==null||r.online();break;case g.Reconnect:(o=this.engine)==null||o.reconnect((a=e.data)==null?void 0:a.url);break;case g.GetStats:this.send(g.GetStats,((c=this.engine)==null?void 0:c.getStats())||{});break}}initPassEvents(){["engine-ready","first-audio-frame-encoded","first-video-frame-encoded","error","connect-fail","connect-open","disconnected","reconnected","reconnecting","reconnect-fail","connect-close"].forEach(e=>{this.engine.on(e,t=>{this.send(g.PassEngineEvent,{event:e,data:t})})})}}new Te})();\n', Oa = typeof self < "u" && self.Blob && new Blob([zu], { type: "text/javascript;charset=utf-8" });
|
|
11998
|
+
const zu = '(function(){"use strict";var g=(s=>(s[s.Start=0]="Start",s[s.Stop=1]="Stop",s[s.GameControl=2]="GameControl",s[s.InitPushReader=3]="InitPushReader",s[s.Online=4]="Online",s[s.Reconnect=5]="Reconnect",s[s.UpdateTrack=6]="UpdateTrack",s[s.SetBitrate=7]="SetBitrate",s[s.PassEngineEvent=8]="PassEngineEvent",s[s.StopSuccess=9]="StopSuccess",s[s.VideoLog=10]="VideoLog",s[s.SetJitterBuffer=11]="SetJitterBuffer",s[s.ResetEngine=12]="ResetEngine",s[s.GetStats=13]="GetStats",s[s.Test=14]="Test",s[s.Plugin=15]="Plugin",s[s.EnableLogger=16]="EnableLogger",s[s.SendLogToMain=17]="SendLogToMain",s))(g||{});const j=1e3;function $(){return!1}class G{constructor(){this.maxSize=j,this.supported=$(),this.supported&&(this.buffer=new SharedArrayBuffer(this.maxSize),this.arr=new Uint8Array(this.buffer))}share(e){return this.supported?(this.arr.set(e),this.buffer):e.buffer}}class q{constructor(e){this.encoder=new TextEncoder,this.decoder=new TextDecoder,this.buffer=new G,this.client=e}send(e){this.client.postMessage(e)}sendTransportable(e,t){Object.assign(e,t);const i=Object.values(t);this.client.postMessage(e,i)}onMessage(e){this.client.addEventListener("message",t=>{e(t.data)})}destroy(){var e,t;(t=(e=this.client).terminate)==null||t.call(e)}}class p{constructor(){this.usePrevEmit=!0,this._map={},this._prevData={}}hasEvent(e){return!!this._map[e]}on(e,t){if(typeof e=="object"){const i=[];for(const n in e)i.push(this.on(n,e[n]));return()=>{i.forEach(n=>n())}}else{if(!t)throw new Error("fn is required");const i=this._formatTarget(t);return this._checkPrev(e,i)&&i.once?()=>{}:(this._getList(e).push(i),()=>{this.off(e,i)})}}_formatTarget(e,t){return typeof e=="function"?{listener:e,once:t??!1,prev:this.usePrevEmit}:(typeof t=="boolean"&&(e.once=t),e)}emit(e,...t){this._prevData[e]=t;const i=this._map[e];if(!i)return!1;for(let n=0;n<i.length;n++){const r=i[n];r.listener(...t),r.once&&(i.splice(n,1),n--)}return!0}off(e,t){const i=this._map[e];if(!i)return!1;const n=i.findIndex(r=>r===t||r.listener===t);return n===-1?!1:(i.splice(n,1),!0)}clear(e){return this._map[e]?(delete this._map[e],delete this._prevData[e],!0):!1}async onWait(e,t){return new Promise(i=>{var a;let n=(...o)=>i(o);t&&(n={listener:n,...t});const r=this.once(e,n);(a=t==null?void 0:t.onclear)==null||a.call(t,r)})}destroy(){this._map={},this._prevData={}}_checkPrev(e,t){if(!t.prev)return!1;const i=this._prevData[e];return typeof i<"u"?(t.listener(...i),!0):!1}once(e,t){return this.on(e,this._formatTarget(t,!0))}head(e,t){const i=this._formatTarget(t);return this._checkPrev(e,i)&&i.once?()=>{}:(this._getList(e).unshift(t),()=>{this.off(e,t)})}headOnce(e,t){return this.head(e,this._formatTarget(t,!0))}_getList(e){let t=this._map[e];return t||(this._map[e]=t=[]),t}passEvents(e,t){t.forEach(i=>{e.on(i,n=>{this.emit(i,n)})})}}class M extends p{constructor(){super(),this.messenger=new q(globalThis),this.messenger.onMessage(this.receiveMainMessage.bind(this))}onMessage(e){this.messenger.onMessage(e)}send(e,t){this.messenger.send({type:e,data:t})}}var l=(s=>(s[s.Connecting=0]="Connecting",s[s.Open=1]="Open",s[s.Closing=2]="Closing",s[s.Closed=3]="Closed",s))(l||{}),S=(s=>(s.Init="init",s.Online="online",s.Error="error",s.ApiCall="api_call",s))(S||{});function E(){let s,e;return{ready:new Promise((i,n)=>{s=i,e=n}),resolve:s,reject:e}}function J(s=500,e){const{ready:t,resolve:i}=E(),n=setTimeout(i,s);return e==null||e(n),t}function V(s){let e=!0,t="";for(const i of s)if(!(i in window)){e=!1,t=`${i} not Supported`;break}return{supported:e,info:t}}function x({task:s,timeout:e,time:t=200}){const{ready:i,resolve:n}=E(),r=setTimeout(async()=>{let a;typeof e<"u"&&(typeof e=="function"?(a=e(),a instanceof Promise&&(a=await a)):a=e),n(a)},t);return s().then(a=>{clearTimeout(r),n(a)}),i}const K=24*60*60*1e3;function F(s,e="1d"){const t=`_me_expire_${s}`;let i=0;if(typeof e=="string"){if(!/^[0-9]+d$/.test(e))throw new Error("expire format error");i=K*parseInt(e)}else i=e;return{get(){const n=localStorage.getItem(t);if(!n)return null;let r=null;try{r=JSON.parse(n)}catch{return null}const{value:a,expire:o}=r;return o<Date.now()?(localStorage.removeItem(t),null):a},set(n){localStorage.setItem(t,JSON.stringify({value:n,expire:Date.now()+i}))},remove(){localStorage.removeItem(t)}}}function C(s){let e=s.length,t=0;for(let r=e-1;r>=0;r--)s[r]?t+=s[r].byteLength:(e--,s.splice(r,1));const i=new Uint8Array(t);let n=0;for(let r=0;r<e;r++)i.set(s[r],n),n+=s[r].byteLength;return i}function _(s){for(const e in s)typeof s[e]>"u"&&delete s[e];return s}function X(s,e){let t=Number.MAX_SAFE_INTEGER,i=0;for(const n of e){const r=Math.abs(s-n);if(r===0)return n;r<t&&(t=r,i=n)}return i}var f=(s=>(s[s.AAC=0]="AAC",s[s.OPUS=1]="OPUS",s[s.H264=2]="H264",s[s.H265=3]="H265",s[s.AV1=4]="AV1",s))(f||{});f.AAC+"",f.OPUS+"",f.H264+"",f.H265+"",f.AV1+"";const U={[f.AAC]:"mp4a.40.2",[f.OPUS]:"opus",[f.H264]:"avc1.4DE033",[f.H265]:"hev1.1.6.L93.B0"};function O({readable:s,onFrame:e,onFinish:t,onError:i}){if(!s)return()=>{};const n=s.getReader();console.log("getReader");let r=!0;return Z({reader:n,flag:()=>r,onFrame:e,onFinish:t,onError:i}),()=>{r=!1}}async function Z({reader:s,flag:e,onFrame:t,onFinish:i,onError:n}){for(;e();)try{const{done:r,value:a}=await s.read();if(r){console.warn("Stream complete"),i==null||i();return}t(a),a.close()}catch(r){console.error("read error,",r),n==null||n(r)}}function W(s){const{video:e,audio:t}=Y(s);return{video:e?R(e):void 0,audio:t?R(t):void 0}}function R(s){const e=new MediaStreamTrackProcessor(s),{readable:t}=e,i=s.getSettings();return{readable:t,settings:i}}function Y(s){return{video:s.getVideoTracks()[0],audio:s.getAudioTracks()[0]}}function ee(s){const e=new Uint8Array(s.byteLength);return s.copyTo(e),e}const u={log(){},send(){},$custom:{},$enableLog(s=!0){u.log=s?(...e)=>{console.log(L(),...e),u.enableLogSend&&z(e)}:()=>{}},$enableSend(){u.send=(...s)=>{z(s)}}};function te(){var n;typeof window=="object"&&!window.__me_debug_helper&&(window.__me_debug_helper=u);let s=location.search.substring(1);const e="_medh_",t=((n=u.$isInnerEnv)==null?void 0:n.call(u))||!0;if(!s){const{hash:r}=location,a=r.indexOf("?");if(!r||a===-1||(s=r.substring(a+1),!s))return}const i=s.split("&");for(const r of i){const[a,o]=r.split("=");if(a.startsWith(e)){let c=a.replace(e,"");if(c.startsWith("inner_")){if(!t)continue;c=c.replace("inner_","")}c==="log"?u.$enableLog():c==="send"?u.$enableSend():u[c]=o||!0}}location.hostname==="localhost"&&u.$enableLog()}function z(s){if(u.$logger)try{u.$logger(s)}catch(e){console.error(L(),"debug send fail:",e)}}function L(){const s=new Date;return`[${s.toLocaleTimeString()} ${s.getMilliseconds().toString().padStart(3,"0")} media-engine]`}te();let ie=class{constructor(){this._lastDot=0,this._totalSize=0,this._speed=[]}addSample(e){this._lastDot||(this._lastDot=Date.now()),this._totalSize+=e;const t=Date.now()-this._lastDot;t>=500&&(this._addSpeedSample(this._totalSize/t*8e3),this._totalSize=0,this._lastDot=Date.now())}_addSpeedSample(e){this._speed.push(e),this._speed=this._speed.slice(-6)}reset(){this._speed=[]}getUpSpeed(){return this._speed.length?parseInt(this._speed.reduce((e,t)=>e+=t,0)/this._speed.length):0}};class se{constructor(){this._bandwidth=0,this._dbrDataSize=0,this.MAX_ESTIMATE_DURATION_MS=2e3,this.MIN_ESTIMATE_DURATION_MS=1e3,this.packets=[]}addDbrPacket(e){this.packets.push(e),this._dbrDataSize+=e.size;const t=this.packets[0],i=e.sendEndTime-t.sendBeginTime;for(;this.packets.length>0;){const n=this.packets[0];if(e.sendEndTime-n.sendBeginTime>this.MAX_ESTIMATE_DURATION_MS)this._dbrDataSize-=n.size,this.packets.shift();else break}this._bandwidth=i>=this.MIN_ESTIMATE_DURATION_MS?this._dbrDataSize*1e3/i*8:0}getEstimateBandwidth(){return this._bandwidth}reset(){this._bandwidth=0,this._dbrDataSize=0,this.packets=[]}}class ne extends p{constructor(e,t,i){super(),this.streamWriter=null,this.datagramWriter=null,this.failQueue=[],this.bandwidth=0,this.smoothTime=0,this.failCount=0,this.timeoutCount=0,this.streamWriter=e.writable.getWriter(),this.datagramWriter=t.writable.getWriter(),this.upspeed=new ie,this.bandwidthEstimate=new se,i&&(this.strategy=i,i.upstream=this)}async resetStream(e){var t;(t=this.streamWriter)==null||t.releaseLock(),this.streamWriter=e.writable.getWriter(),this.failQueue.forEach(({data:i,config:n})=>{this.sendStream(i,n)}),this.failQueue=[]}async sendStream(e,{extra:t,force:i}={extra:{},force:!1}){var d;if(!i&&((d=this.strategy)==null?void 0:d.onSendStream(e,t))===!1)return;const n={sendBeginTime:performance.now(),size:e.byteLength,sendEndTime:0};this.upspeed.addSample(e.byteLength);const r=performance.now(),a=await this._writeData(e);if(a){(a==="error"||a==="timeout")&&(this.failQueue.push({data:e,config:{extra:t,force:i}}),this.emit("write-error",a));return}n.sendEndTime=performance.now(),this.bandwidthEstimate.addDbrPacket(n);const o=performance.now()-r||.001;this.smoothTime=this.smoothTime===0?o:this.smoothTime*.7+o*.3;const h=e.byteLength/1024*8/(this.smoothTime/1e3);this.bandwidth=Math.min(this.bandwidth===0?h:this.bandwidth*.7+h*.3,1e4)}async _writeData(e){return await x({task:()=>{if(!this.streamWriter)return Promise.resolve("no_stream");const{ready:i,resolve:n}=E();return this.streamWriter.write(e).then(()=>{n("")}).catch(()=>{this.failCount++,n("error")}),i},timeout:()=>(this.timeoutCount++,"timeout"),time:1e3})}async sendDgm(e,{extra:t,force:i}={extra:{},force:!0}){var n,r;!i&&((n=this.strategy)==null?void 0:n.onSendDgm(e,t))===!1||(this.upspeed.addSample(e.byteLength),await((r=this.datagramWriter)==null?void 0:r.write(e).catch(a=>{console.log("send dgm fail",a)})))}async destroy(){var e,t,i;try{await((e=this.streamWriter)==null?void 0:e.close()),await((t=this.datagramWriter)==null?void 0:t.close())}catch(n){console.warn("upstream destroy:",n)}this.upspeed.reset(),(i=this.strategy)==null||i.destroy()}getSpeed(){return this.upspeed.getUpSpeed()}getBandwidth(){return this.bandwidth}getEstimateBandwidth(){return this.bandwidthEstimate.getEstimateBandwidth()}clearEstimateBandwidth(){this.bandwidthEstimate.reset()}}class re extends p{constructor(e,t){super(),this.destroyed=!1,this.read(e.readable,i=>{this.emit("stream",i)},!0),this.read(t.readable,i=>{this.emit("datagram",i)})}async read(e,t=()=>{},i=!1){const n=e.getReader();for(i&&(this.streamReader=n);!this.destroyed;){const{value:r,done:a}=await n.read().catch(()=>({done:!0,value:null}));if(a)break;t(r)}}resetStream(e){this.streamReader.releaseLock(),this.read(e.readable,t=>{this.emit("stream",t)})}destroy(){this.destroyed=!0,super.destroy()}}const P={clearConnection:()=>Promise.resolve(),sendStream:async()=>{},sendDgm:async()=>{},getUpSpeed:()=>0,getUpBandwidth:()=>0,getId:()=>0};class ae extends p{constructor(e){super(),this.destroyed=!1,this._resetLock=!1,this.options=e,this.ready=this.connect(),this.ready.then(t=>{var i;t&&(this.initStream(),(i=this.transport)==null||i.closed.then(n=>{this.emit("closed",n)}).catch(n=>{this.emit("closed",{closeCode:-1,reason:`catch ${n.toString()}`})}))})}get id(){return this.options.id}async destroy(){var e,t,i,n;if(super.destroy(),!this.destroyed){this.destroyed=!0,await((e=this.upstream)==null?void 0:e.destroy()),(t=this.downstream)==null||t.destroy();try{(i=this.transport)==null||i.close(),await((n=this.transport)==null?void 0:n.closed)}catch(r){console.warn("close fail",r)}this.transport=null,u.log("close transport"),this.emit("destroyed")}}async connect(){try{const e=new WebTransport(this.options.url);if(!e)this.onFail("Init error");else{this.transport=e;const t=await x({task:async()=>{var i;try{return await((i=this.transport)==null?void 0:i.ready),u.log("transport ready"),""}catch(n){return`Ready Catch: ${(n==null?void 0:n.toString())||"Fail"}`}},timeout:"Init timeout",time:2e3});if(t)this.onFail(t);else return this.emit("success"),!0}}catch(e){this.onFail(`Init Catch: ${(e==null?void 0:e.toString())||"Fail"}`)}return!1}onFail(e){this.emit("fail",e),this.transport=null,this.destroy()}async initStream(){const{transport:e}=this;if(!e)return;const t=await this.createBidStream();if(!t)return;this._prevStream=t;const i=e.datagrams;this.upstream=new ne(t,i,this.options.strategy),this.downstream=new re(t,i),this.downstream.on({stream:n=>this.emit("stream",n),datagram:n=>{this.emit("datagram",n)}}),this.upstream.on("write-error",()=>{this.resetStream()}),this.emit("upstream-ready")}async resetStream(){var t,i,n,r;if(this._resetLock)return;this._resetLock=!0;const e=await this.createBidStream();if(!e){this._resetLock=!1;return}(t=this.upstream)==null||t.resetStream(e),(i=this._prevStream)==null||i.writable.close(),(n=this.downstream)==null||n.resetStream(e),(r=this._prevStream)==null||r.readable.cancel(),this._prevStream=e,this._resetLock=!1}async createBidStream(){var e;return(e=this.transport)==null?void 0:e.createBidirectionalStream()}}class oe{constructor(e){this.index=0,this.gaps=[5,5,5,5,10,10,10,20,20,30,30,40,50,70,100],this.count=0,this.n=this.gaps.length,this.max=this.gaps[this.n-1]*100,this.maxCount=e}reset(){this.index=0,this.count=0}get gap(){return typeof this.maxCount=="number"&&this.count>=this.maxCount?0:(this.count++,this.index>=this.n-1?this.max:this.gaps[this.index++]*100)}}class ce extends p{constructor(){super(...arguments),this.readyState=l.Connecting,this.connectId=0,this.connectionUtil=P,this.destroyed=!1}setState(e){this.readyState=e}get isConnecting(){return this.readyState===l.Connecting}async init(e){this.options=Object.assign({autoReconnect:!0,useDownstream:!0},e),this.reconnectGap=new oe(e.maxCount),await this.connect({connectReason:S.Init})}async connect({first:e=!0,connectReason:t,url:i}){if(this.destroyed)return this.setState(l.Closed),Promise.resolve("Reconnector destroyed");const n=t===S.Init;e&&(this.reconnectGap.reset(),n||this.emit("reconnecting",t)),this.setState(l.Connecting);const{success:r,reason:a}=await this.singleConnect(i);if(this.destroyed)return this.setState(l.Closed),Promise.resolve("Reconnector destroyed stage2");if(!r){const{gap:o}=this.reconnectGap,c=e&&n?"connect-fail":"reconnect-fail";return this.emit(c,a),o===0||!this.options.autoReconnect?(this.emit("end"),this.setState(l.Closed),a):(await J(o,h=>this.delayTimer=h),this.connect({first:!1,url:i,connectReason:S.Error}))}return this.setState(l.Open),this.emit("connect-open",n),this.onConnected(),n||this.onMonitorConnectionNormal(),""}async onConnected(){var t;(t=this.clearWaitClosed)==null||t.call(this);const[e]=await this.onWait("connection-closed",{onclear:i=>this.clearWaitClosed=i});if(e.closeCode!==-1){if(console.log("reason",e.reason),this.emit("connect-close",e.reason||""),this.isConnecting){console.warn("isConnecting",e.reason);return}console.log("close: webts closed gracefully.",e.reason),e.closeCode===0&&(this.emit("end"),this.setState(l.Closed))}else{const i=e.reason;console.error("close: webts closed due to ",e),this.emit("connect-close",i),this.emit("disconnected",i),this.options.autoReconnect?this.connect({connectReason:S.Error}):(this.emit("connect-fail",i),this.emit("end"))}}onMonitorConnectionNormal(){this.options.useDownstream&&(this.waitTimer=setTimeout(()=>{this.emit("reconnect-fail","no packet"),this.emit("connect-close","no packet received"),this.emit("end"),this.setState(l.Closed)},3e3))}onReceivePacket(e){this.waitTimer!==null&&(e<10||(clearTimeout(this.waitTimer),this.waitTimer=null,console.warn("DEBUG 重连恢复收包"),this.emit("reconnected")))}async singleConnect(e){const{resolve:t,ready:i}=E();await this.clearReconnect();const n=new ae({id:this.connectId++,url:e||this.options.url,strategy:this.options.strategy});n.on({success:()=>{t({success:!0,reason:""})},fail:a=>{t({success:!1,reason:a})},destroyed:()=>{t({success:!1,reason:"Connection destroyed"})},datagram:a=>{this.onReceivePacket(a.byteLength),this.emit("datagram",a)},closed:a=>{this.emit("connection-closed",a)}}),this.passEvents(n,["upstream-ready","stream"]);const r=n.onWait("upstream-ready");return this.connectionUtil={clearConnection:()=>n.destroy(),sendStream:async(a,o)=>{var c;if(!n.destroyed)return await r,(c=n.upstream)==null?void 0:c.sendStream(a,o)},sendDgm:async(a,o)=>{var c;if(!n.destroyed)return await r,(c=n.upstream)==null?void 0:c.sendDgm(a,o)},getUpSpeed:()=>{var a;return((a=n.upstream)==null?void 0:a.getSpeed())||0},getUpBandwidth:()=>{var a;return((a=n.upstream)==null?void 0:a.getBandwidth())||0},getId:()=>n.id},i}async destroy(){this.destroyed||(this.destroyed=!0,await this.clearReconnect(),this.emit("connect-close","api call"),this.emit("disconnected","api call"),super.destroy())}async clearReconnect(){var e;await((e=this.connectionUtil)==null?void 0:e.clearConnection()),clearTimeout(this.delayTimer),clearTimeout(this.waitTimer),this.waitTimer=this.delayTimer=null}onlineReconnect(){this.options.autoReconnect&&(this.clearReconnect(),this.connect({first:!0,connectReason:S.Online}))}}class he extends p{get readyState(){var e;return((e=this.reconnector)==null?void 0:e.readyState)||l.Closed}get closed(){return this.readyState===l.Closed}get connection(){var e;return((e=this.reconnector)==null?void 0:e.connectionUtil)||P}async init(e){this.reconnector=new ce,this.initEvents(),this.ready=this.reconnector.init({...Object.assign({useDownstream:!0},e)}),await this.ready}async close(){await this.reconnector.destroy()}online(){this.reconnector.onlineReconnect()}reconnect(e){this.reconnector.connect({connectReason:S.ApiCall,url:e})}async sendStream(e,t){var i;return await this.ready,(i=this.connection)==null?void 0:i.sendStream(e,t)}async sendDgm(e,t){var i;return await this.ready,(i=this.connection)==null?void 0:i.sendDgm(e,t)}initEvents(){this.passEvents(this.reconnector,["reconnected","reconnect-fail","connect-close","disconnected","reconnecting","connect-fail","connect-open","upstream-ready","stream","datagram"])}getUpSpeed(){return this.connection.getUpSpeed()}getUpBandwidth(){return this.connection.getUpBandwidth()}async destroy(){await this.close(),super.destroy()}}class de extends p{sendStream(e,t){return this.upstream.sendStream(e,{force:!0,extra:t})}sendDgm(e,t){return this.upstream.sendDgm(e,{force:!0,extra:t})}}class ue{constructor(){this.totalFrames=0,this.periodFrames=0,this.periodSize=0,this.periodDuration=0,this.keyFrames=0,this.bitrate=0,this.framerate=0,this.lastTs=0}addFrame(e){const t=e.byteLength;let i=0;const n=Math.round(e.timestamp/1e3);this.lastTs!==0&&(i=n-this.lastTs),this.lastTs=n,this.totalFrames++,this.periodFrames++,this.periodSize+=t,this.periodDuration+=i,e.type==="key"&&this.keyFrames++,this.periodDuration>=1e3&&(this.bitrate=Math.floor(this.periodSize/this.periodDuration*8e3),this.framerate=this.periodFrames,this.periodFrames=0,this.periodDuration=0,this.periodSize=0)}getStats(){return{bitrate:this.bitrate,framerate:this.framerate,encodedFrames:this.totalFrames,encodedKeyFrames:this.keyFrames,codec:""}}reset(){this.totalFrames=0,this.periodFrames=0,this.periodSize=0,this.periodDuration=0,this.keyFrames=0,this.bitrate=0,this.framerate=0,this.lastTs=0}}class H extends p{constructor(){super(...arguments),this.configInitialized=!1,this.firstFrame=!1,this.stats=new ue,this._config={},this._finalConfig={},this._decoderConfig={},this._destroyed=!1}extraEncodeConfig(){return{}}getStats(){return this.stats.getStats()}get mediaType(){return this._config.mediaType}async updateConfig(e){if(e=_(e),Object.keys(e).length===0)return;Object.assign(this._config,e),this.encoder&&(await this.encoder.flush(),this.encoder.close(),this.init());const t=await this.checkConfigSupported(this.formatConfig());this._config={...this._config,...t},this._finalConfig=this.formatConfig(),this.configInitialized=!1}getConfig(){return this._config}getDecoderConfig(){return this._decoderConfig}init(e){e&&this.updateConfig(e),u.log("init encoder"),this.encoder=new this.Encoder({output:(t,i)=>{t.syncTimestamp=t.timestamp,this.stats.addFrame(t);const n=i==null?void 0:i.decoderConfig;let r;n&&(r=n,Object.assign(this._decoderConfig,n),this.emit("decoder-config-change",this._decoderConfig)),this.emit("frame-encoded",t,r),this.firstFrame||(this.emit("first-frame-encoded",t,r),this.firstFrame=!0)},error:t=>{this.emit("encode-error",t)}})}encode(e){var t;if(!this._destroyed){if(!this.configInitialized){const i=this._finalConfig;(t=this.encoder)==null||t.configure(i),this.configInitialized=!0,console.warn("configure final done",i)}this.encoder.encode(e,this.extraEncodeConfig())}}async destroy(){var e,t;this.stats.reset(),this._destroyed=!0;try{await((e=this.encoder)==null?void 0:e.flush()),(t=this.encoder)==null||t.close()}catch{}super.destroy()}async checkConfigSupported(e,t=!1){if(this.Encoder.isConfigSupported)try{const{config:i,supported:n}=await this.Encoder.isConfigSupported(e);if(n)return e;if(!t&&this.retryConfig)return this.checkConfigSupported(this.retryConfig(e),!0);this.emit("config-error",{message:"config not supported",config:i})}catch(i){if(!t&&this.retryConfig)return this.checkConfigSupported(this.retryConfig(e));this.emit("config-error",{message:"config uncaught error",err:i,config:e})}}}F("audio_encoder_support","3d");function le(){return V(["EncodedAudioChunk","AudioEncoder","AudioData"])}const m={mediaType:f.H264,format:"annexb",bitrate:2e5,framerate:15,bitrateMode:"variable",keyInterval:3e3,keyGopSize:90,hardwareAcceleration:"prefer-hardware",latencyMode:"quality"},w={mediaType:f.AAC,bitrate:96e3,sampleRate:48e3,numberOfChannels:2,bitrateMode:"constant"},T=class T extends H{constructor(){super(...arguments),this.Encoder=AudioEncoder,this.isAudio=!0}updateConfig(e){if(typeof e.bitrate=="number"){const t=[96e3,128e3,16e4,192e3],i=X(e.bitrate,t);i!==e.bitrate&&(console.warn(`audio bitrate ${e.bitrate} not supported, use ${i} instead`),e.bitrate=i)}return super.updateConfig(e)}getStats(){const{codec:e="",numberOfChannels:t=0,sampleRate:i=0}=this._finalConfig;return{...super.getStats(),codec:e,numberOfChannels:t,sampleRate:i}}formatConfig(e){const{bitrate:t=w.bitrate,bitrateMode:i=w.bitrateMode,codec:n=w.codec||U[this._config.mediaType??w.mediaType],numberOfChannels:r=w.numberOfChannels,format:a=w.format||(e==null?void 0:e.format),sampleRate:o=w.sampleRate}=this._config,c=_({codec:n,sampleRate:o,numberOfChannels:r,bitrate:t,bitrateMode:i,format:a});return this.emit("config-change",c),c}};T.isSupported=le;let v=T;F("video_encoder_support","3d");function fe(){return V(["EncodedVideoChunk","VideoEncoder","VideoFrame"])}function me(s=m.keyInterval){let e=!0,t;return{is(){return e?(e=!1,t=setTimeout(()=>{e=!0},s),!0):!1},reset(){e=!0,clearTimeout(t)}}}function pe(s=m.keyGopSize){let e=s;return{is(){return e++,e>=s?(e=0,!0):!1},reset(){e=s}}}const B=class B extends H{constructor(){super(...arguments),this.Encoder=VideoEncoder,this.isAudio=!1,this.retryConfig=e=>(e.hardwareAcceleration==="prefer-hardware"&&(e.hardwareAcceleration="prefer-software",this._config.hardwareAcceleration="prefer-software",console.warn("retry config with software hardwareAcceleration")),e)}getStats(){const e=super.getStats();let{keyGopSize:t}=this._finalConfig;const{keyInterval:i=m.keyInterval}=this._config,{width:n=0,height:r=0,codec:a="",framerate:o=0}=this._finalConfig;return typeof t>"u"&&(t=Math.round(i/1e3*o)),{...e,width:n,height:r,codec:a,keyGopSize:t}}formatConfig(e){const{codec:t=m.codec||U[this._config.mediaType??m.mediaType],bitrate:i=m.bitrate,framerate:n=m.framerate,keyInterval:r=m.keyInterval,hardwareAcceleration:a=m.hardwareAcceleration,latencyMode:o=m.latencyMode,keyGopSize:c,width:h=m.width||(e==null?void 0:e.codedWidth),height:d=m.height||(e==null?void 0:e.codedHeight)}=this._config;this.keyframe=c?pe(c):me(r);const b=_({latencyMode:o,codec:t,hardwareAcceleration:a,bitrate:i,width:h,height:d,framerate:n});return console.log("config video",JSON.stringify(b,null,2)),this.emit("config-change",b),b}extraEncodeConfig(){return{keyFrame:this.keyframe.is()}}resetKeyFrame(){var e;(e=this.keyframe)==null||e.reset()}async destroy(){try{this.resetKeyFrame()}catch{}await super.destroy()}};B.isSupported=fe;let k=B;const N=16;function Q(){let s=-1,e=-1,t=-1;return{getLatest(){return s},setBase(i){t===-1&&(t=i)},check(i){return s===-1?s=t:s+=i-e,e=i,s},reset(){s=e=t=-1}}}class ge extends p{constructor(){super(...arguments),this.video=Q(),this.audio=Q(),this.base=N,this._sendQueue=[],this._processedVideo=!1,this._processedAudio=!1,this._maximumVideoSyncTimestamp=0,this._maximumAudioSyncTimestamp=0,this.cacheAudioChunk=[],this.cacheVideoChunk=[],this.hasGetFirstVideoFrame=!1,this.SYNC_THRESHOLD=40}insertPacket(e,t,i){let n=0;for(;n<this._sendQueue.length&&!(this._sendQueue[n].frame.syncTimestamp===e.syncTimestamp&&t==="video"||this._sendQueue[n].frame.syncTimestamp>e.syncTimestamp);n++);this._sendQueue.splice(n,0,{frame:e,type:t,cfg:i})}processPacket(e,t,i){switch(this._processedAudio&&this._processedVideo||(t==="video"?this._processedVideo=!0:this._processedAudio=!0),this.insertPacket(e,t,i),t){case"video":this._maximumVideoSyncTimestamp<e.syncTimestamp&&(this._maximumVideoSyncTimestamp=e.syncTimestamp);break;case"audio":this._maximumAudioSyncTimestamp<e.syncTimestamp&&(this._maximumAudioSyncTimestamp=e.syncTimestamp);break}if(this._processedAudio&&this._processedVideo)for(;this._sendQueue.length>0;){const r=this._sendQueue[0];if(!this.checkOpposingTimestamp(r.frame,r.type))return!1;this.emit("processed-frame",r.frame,r.type,r.cfg),this._sendQueue.shift()}}checkOpposingTimestamp(e,t){switch(t){case"audio":return this._maximumVideoSyncTimestamp>e.syncTimestamp;case"video":return this._maximumAudioSyncTimestamp>e.syncTimestamp;default:return!1}}formatFrame(e,t,i,n){this[t].setBase(this.base);const a=Math.round(e.timestamp/1e3),o=this[t].check(a);return e.syncTimestamp=o,this.processPacket(e,t,n),[e]}syncAVFrame(e,t){if(t==="audio")this.cacheAudioChunk.push(e),this.cacheAudioChunk.sort((i,n)=>i.syncTimestamp-n.syncTimestamp);else if(this.cacheVideoChunk.push(e),this.cacheVideoChunk.sort((i,n)=>i.syncTimestamp-n.syncTimestamp),!this.hasGetFirstVideoFrame)return this.hasGetFirstVideoFrame=!0,null;return this.flushSynchronizedFrames()}flushSynchronizedFrames(){const e=[];for(;this.canSendFrame();){const t=this.getNextFrameToSend();if(t)e.push(t);else break}return e}canSendFrame(){if(this.cacheAudioChunk.length===0&&this.cacheVideoChunk.length===0)return!1;if(this.cacheAudioChunk.length===0)return this.cacheVideoChunk.length>0;if(this.cacheVideoChunk.length===0)return!1;const e=this.cacheAudioChunk[0],t=this.cacheVideoChunk[0];return Math.abs(e.syncTimestamp-t.syncTimestamp)<=this.SYNC_THRESHOLD}getNextFrameToSend(){if(this.cacheAudioChunk.length===0&&this.cacheVideoChunk.length>0)return this.cacheVideoChunk.shift()||null;if(this.cacheVideoChunk.length===0&&this.cacheAudioChunk.length>0||this.cacheAudioChunk.length===0&&this.cacheVideoChunk.length===0)return null;const e=this.cacheAudioChunk[0],t=this.cacheVideoChunk[0];return e.syncTimestamp<=t.syncTimestamp?this.cacheAudioChunk.shift()||null:this.cacheVideoChunk.shift()||null}reset(){this.audio.reset(),this.video.reset(),this.base=N,this._processedAudio=!1,this._processedVideo=!1,this._maximumAudioSyncTimestamp=0,this._maximumVideoSyncTimestamp=0,this.cacheAudioChunk=[],this.cacheVideoChunk=[],this.hasGetFirstVideoFrame=!1}}var y=(s=>(s[s.AUDIO=8]="AUDIO",s[s.VIDEO=9]="VIDEO",s[s.SCRIPT_DATA=18]="SCRIPT_DATA",s))(y||{}),A=(s=>(s[s.SEQUENCE_HEADER=0]="SEQUENCE_HEADER",s[s.AAC=1]="AAC",s))(A||{}),D=(s=>(s[s.SEQUENCE_HEADER=0]="SEQUENCE_HEADER",s[s.NALU=1]="NALU",s))(D||{}),I=(s=>(s[s.KEY=1]="KEY",s[s.INNER=2]="INNER",s))(I||{});const _e=10,ye=1,Se=7,we={96e3:0,48e3:3,44100:4,22050:7,16e3:8,8e3:11};function be(s){const e=(s[4]&3)+1;let t;const i=[],n=[];let r=6;const a=s[5]&31;let o;for(let d=0;d<a;d++){if(o=s[r]<<8|s[r+1],r+=2,!o)continue;const b=s.subarray(r,r+o);r+=o,i.push(b)}const c=s[r];r++;let h;for(let d=0;d<c;d++)h=s[r]<<8|s[r+1],r+=2,h&&(n.push(s.subarray(r,r+h)),r+=h);return{sps:t,spsArr:i,ppsArr:n,nalUnitSize:e}}class Ce{constructor(){this._cfg={hasVideo:!1,hasAudio:!1,sampleRate:48e3,numberOfChannels:1},this._hasVideoSeqHeader=!1}get hasVideo(){return!!this._cfg.hasVideo}get hasAudio(){return!!this._cfg.hasAudio}setConfig(e){this._cfg=Object.assign(this._cfg,e),console.log("---flv setConfig",this._cfg)}genHeader(){const e=[70,76,86,1,(this.hasAudio?1:0)<<2|(this.hasVideo?1:0),0,0,0,9,0,0,0,0];return new Uint8Array(e)}geneSEQ(e,t){let i;return e===y.AUDIO?i=this._genAudioSEQPayload():(i=this._genVideoSEQPayload(t.frame.type,t.description),this._hasVideoSeqHeader=!0),this._concatPayload(e,t.frame.syncTimestamp,i)}genPayload(e){const t=e.type===y.AUDIO,i=ee(e.frame),n=C([t?this._genAudioTagHeader():this._genVideoTagHeader(e.frame.type),t?this._genAudioData(i):this._genVideoData(e,i)]);return this._concatPayload(e.type,e.frame.syncTimestamp,n)}_concatPayload(e,t,i){const n=this._genTagHeader(e,i.length,t),r=n.length+i.length;return C([n,i,new Uint8Array([r>>>24,r>>>16,r>>>8,r])])}_genTagHeader(e,t,i){return new Uint8Array([e,t>>>16,t>>>8,t,i>>>16,i>>>8,i,i>>>24,0,0,0])}_genAudioSEQPayload(){return C([this._genAudioTagHeader(),this._genAudioSequenceHeader()])}_genVideoSEQPayload(e,t){return C([this._genVideoTagHeader(e),this._genVideoSequenceHeader(t)])}_genAudioTagHeader(){return new Uint8Array([_e<<4|12|ye<<1|this._cfg.numberOfChannels-1])}_genVideoTagHeader(e){return new Uint8Array([(e==="key"?I.KEY:I.INNER)<<4|Se,this._hasVideoSeqHeader?D.NALU:D.SEQUENCE_HEADER,0,0,0])}_genAudioSequenceHeader(){const e=4096|we[this._cfg.sampleRate]<<7|this._cfg.numberOfChannels<<3;return new Uint8Array([A.SEQUENCE_HEADER,e>>8,e])}_genAudioData(e){const t=new Uint8Array(1+e.length);return t.set([A.AAC],0),t.set(e,1),t}_genVideoSequenceHeader(e){return new Uint8Array(e||[])}_genVideoData(e,t){if(e.frame.type==="delta")return t;const i=be(new Uint8Array(e.description)),n=i.spsArr[0].length,r=i.ppsArr[0].length;return C([new Uint8Array([0,0,n>>8,n%256]),i.spsArr[0],new Uint8Array([0,0,r>>8,r%256]),i.ppsArr[0],t])}reset(){this._hasVideoSeqHeader=!1}}class Ee{constructor(){this._firstFrame=!0,this._flv=new Ce}updateConfig(e){e&&this._flv.setConfig(e)}receiveMediaFrame(e,t){const i=e.type===y.AUDIO;this._firstFrame&&i||(this._firstFrame&&(t({buffer:this._flv.genHeader(),type:"header"}),this._flv.hasAudio&&t({buffer:this._flv.geneSEQ(y.AUDIO,e),type:"seq"}),this._flv.hasVideo&&t({buffer:this._flv.geneSEQ(y.VIDEO,e),type:"seq"}),this._firstFrame=!1),t({buffer:this._flv.genPayload(e),type:"payload"}))}reset(){this._firstFrame=!0,this._flv.reset()}destroy(){this.reset()}}class ve{constructor(e=1e3){this._packets=[],this._latestDts=0,this._videoDuration=0,this._batchSize=e}addPacket(e,t){this._packets.push({data:e,isSeparator:!1,...t}),t.mediaType==="video"&&(this._latestDts=t.dts||0)}getVideoDuration(){const e=this._packets.find(t=>t.mediaType==="video");return!e||!e.dts?0:this._latestDts-e.dts}shift(){if(this._packets.length===0)return;let e=0;for(const r of this._packets)e+=r.data.byteLength;if(e<this._batchSize)return;const t=new Uint8Array(this._batchSize);let i=0,n=this._batchSize;for(;n>0&&this._packets.length>0;){const r=this._packets[0],a=r.data.byteLength;if(a<=n)t.set(r.data,i),i+=a,n-=a,this._packets.shift();else{const o=r.data.slice(0,n);t.set(o,i),this._packets[0]={...r,data:r.data.slice(n),isSeparator:!0},n=0}}return t}shiftSinglePacket(){if(this._packets.length===0)return;const e=this._packets.shift();return e==null?void 0:e.data}forceShift(){if(this._packets.length===0)return;let e=0;for(const a of this._packets)e+=a.data.byteLength;const t=Math.min(e,this._batchSize),i=new Uint8Array(t);let n=0,r=t;for(;r>0&&this._packets.length>0;){const a=this._packets[0],o=a.data.byteLength;if(o<=r)i.set(a.data,n),n+=o,r-=o,this._packets.shift();else{const c=a.data.slice(0,r);i.set(c,n),this._packets[0]={...a,data:a.data.slice(r),isSeparator:!0},r=0}}return i}dropPackets(e){const t=Math.min(e,this._packets.length);this._packets.splice(0,t)}dropVideoPackets(){this._packets=this._packets.filter(e=>e.mediaType!=="video")}get size(){return this._packets.length}get totalBytes(){return this._packets.reduce((e,t)=>e+t.data.byteLength,0)}get hasEnoughData(){return this.totalBytes>=this._batchSize}reset(){this._packets=[]}setBatchSize(e){this._batchSize=e}}class ke{constructor(){this._lastDot=0,this._totalSize=0,this._speed=[]}addSample(e){this._lastDot||(this._lastDot=Date.now()),this._totalSize+=e;const t=Date.now()-this._lastDot;t>=500&&(this._addSpeedSample(this._totalSize/t*8e3),this._totalSize=0,this._lastDot=Date.now())}_addSpeedSample(e){this._speed.push(e),this._speed=this._speed.slice(-6)}reset(){this._speed=[]}getUpSpeed(){return this._speed.length?parseInt(this._speed.reduce((e,t)=>e+=t,0)/this._speed.length):0}}class Ae extends de{constructor(e,t){super(),this.context=e,this.upSpeed=new ke,this.streamBuffer=new ve,this._inAdjustEncode=!1,this._dbrIncTimeout=0,this._dbrPrevBitrate=0,this._increaseTimer=0,this.isSending=!1,this.config={maxCacheSize:50,realSpeedPercent:.8,setting:{},uplinkBitrateCheckInterval:4*1e3,dbrIncreaseStep:.1},this.getCurrentBitrate=()=>this.context.videoEncoderConfig.bitrate??0,t&&this.updateConfig(t)}reset(){this.upSpeed.reset(),this.streamBuffer.reset(),this.isSending=!1,clearInterval(this._increaseTimer),this._increaseTimer=0,this._inAdjustEncode=!1}updateConfig(e){Object.assign(this.config,e)}_isHavingCongestion(){return this.streamBuffer.size>this.config.maxCacheSize}_setEncoderBitrate(e){const{width:t,height:i,framerate:n}=this.context.videoEncoderConfig;console.log(`set encode bitrate to specified ${e}`),this.context.emit("video-encoder-config",{bitrate:e,width:t,height:i,framerate:n}),this._inAdjustEncode=!0}_increaseBitrate(){this._dbrIncTimeout=0,this._dbrPrevBitrate=this.getCurrentBitrate();const e=this.context.videoEncoderConfig.originBitrate;if(!e)return;let t=this.getCurrentBitrate()+e*this.config.dbrIncreaseStep;t>=e?t=e:this._dbrIncTimeout=Date.now()+this.config.uplinkBitrateCheckInterval,this._setEncoderBitrate(t)}_decreaseBitrate(){const e=this._dbrPrevBitrate;let t=0,i;if(this.upstream.getEstimateBandwidth()&&this.upstream.getEstimateBandwidth()<this.getCurrentBitrate()&&(t=Math.floor(this.upstream.getEstimateBandwidth()*90/100/1e5)*1e5,t<50*1e3&&(t=50*1e3),this.upstream.clearEstimateBandwidth()),t)i=t;else if(e)console.log("use prev bitrate",e),i=e;else return;this._dbrPrevBitrate=0,this._dbrIncTimeout=Date.now()+this.config.uplinkBitrateCheckInterval,this._setEncoderBitrate(i)}_checkBitrate(){this._dbrIncTimeout&&Date.now()>=this._dbrIncTimeout&&(this._isHavingCongestion()?this._dbrIncTimeout=Date.now()+this.config.uplinkBitrateCheckInterval:this._increaseBitrate()),this._isHavingCongestion()&&this.streamBuffer.getVideoDuration()>500&&this._decreaseBitrate()}onSendStream(e,t){return this._checkBitrate(),this.streamBuffer.addPacket(e,t),this.upSpeed.addSample(e.byteLength),this._sendBuffer(),!1}async _sendBuffer(){if(!this.isSending){for(this.isSending=!0;;){const e=this.streamBuffer.shiftSinglePacket();if(!e)break;await this.sendStream(e)}this.isSending=!1}}onSendDgm(){return!0}_checkDeleteCache(e=!1){this._inAdjustEncode&&e&&(console.log(`ajust encode setting finish, delete cached ${this.streamBuffer.size} frame`),this.streamBuffer.reset(),this.upSpeed.reset(),this._inAdjustEncode=!1)}}class De extends p{constructor(e){super(),this.entry=e,this.on({"video-encoder-config":t=>{this.entry.videoEncoder.updateConfig(t)},"audio-encoder-config":t=>{this.entry.audioEncoder.updateConfig(t)}})}get videoEncoderConfig(){return this.entry.videoEncoder.getConfig()}get audioEncoderConfig(){return this.entry.audioEncoder.getConfig()}}class Ie extends p{constructor({videoEncoder:e,audioEncoder:t,transport:i,flv:n,strategy:r,formatAV:a=!0}={}){super(),this.hasVideo=!0,this.stopVideoInput=()=>{},this.stopAudioInput=()=>{},this._isVideoEncoded=!1,this._destroy=!1,this.reconnecting=!1,this.context=new De(this),this.videoEncoder=e||new k,this.audioEncoder=t||new v,this.transport=i||new he,this.flv=n||new Ee,a&&(this.avFormat=new ge,this.initAvFormatEventListener()),this.strategy=r||new Ae(this.context);const{sampleRate:o,numberOfChannels:c}=this.audioEncoder.getConfig();this.flv.updateConfig(_({sampleRate:o,numberOfChannels:c}))}initAvFormatEventListener(){this.avFormat.on("processed-frame",(e,t,i)=>{const n=e;if(n instanceof EncodedAudioChunk&&this.flv.receiveMediaFrame({type:y.AUDIO,frame:n},({buffer:r,type:a})=>{this.transport.sendStream(r,{extra:{isAudio:!0,type:a,key:!0,mediaType:"audio",dts:n.syncTimestamp}})}),n instanceof EncodedVideoChunk){const r=n.type==="key";this.flv.receiveMediaFrame({type:y.VIDEO,frame:n,description:i==null?void 0:i.description},({buffer:a,type:o})=>{this.transport.sendStream(a,{extra:{isAudio:!1,type:o,key:r,mediaType:"video",dts:n.syncTimestamp}})})}})}start(e){const t=e.data,i={},n={};if(e.video){const{width:r,height:a,frameRate:o}=t.setting.video||{};Object.assign(i,_({width:r,height:a,framerate:o}))}if(e.audio){const{sampleRate:r,channelCount:a}=t.setting.audio||{};Object.assign(n,_({sampleRate:r,numberOfChannels:a}))}if(t.cfg){const{channel:r,gopSize:a,sampleRate:o}=t.cfg;e.video&&Object.assign(i,_({keyGopSize:a,bitrate:t.bitrate.video,originBitrate:t.bitrate.video})),e.audio&&Object.assign(n,_({numberOfChannels:r,sampleRate:o,bitrate:t.bitrate.audio}))}this.videoEncoder.updateConfig(i),this.audioEncoder.updateConfig(n),this.init({transport:{url:t.url,maxReconnectCount:t.maxReconnectCount,autoReconnect:t.autoReconnect},input:{audio:e.audio,video:e.video}}),console.log("On worker start",t)}async init(e){this.initPassEvents();const{url:t,maxReconnectCount:i,autoReconnect:n}=e.transport;this.options=e,await this.transport.init({url:t,maxReconnectCount:i,autoReconnect:n,strategy:this.strategy,useDownstream:!1}),this.initSyncStuff(e),this.emit("engine-ready")}initPassEvents(){this.passEvents(this.transport,["connect-open","connect-close","disconnected","reconnecting","reconnected","reconnect-fail","connect-fail"])}initWriter(e){e&&(e.stream?this.initInputWithStream(e.stream):(e.audio||e.video)&&this.initInput({video:e.video,audio:e.audio}))}initSyncStuff({encoder:e,input:t,flv:i}){this.videoEncoder.init(e==null?void 0:e.video),this.audioEncoder.init(e==null?void 0:e.audio),this.initWriter(t),this.flv.updateConfig(i),this.initEngineEvents()}async initInput({audio:e,video:t}){this.hasVideo=!!t,this.flv.updateConfig({hasAudio:!!e,hasVideo:!!t}),await this.transport.onWait("upstream-ready");const i=(r=!1)=>()=>{console.log("encode finish: ",r)},n=(r=!1)=>a=>{console.warn("encode error: ",r,a)};e&&(this.stopAudioInput=O({readable:e,onFrame:r=>{this._destroy||this.reconnecting||this.audioEncoder.encode(r)},onFinish:i(!0),onError:n(!0)})),t&&(this.stopVideoInput=O({readable:t,onFrame:r=>{this._destroy||this.reconnecting||this.videoEncoder.encode(r)},onFinish:i(),onError:n()}))}initInputWithStream(e){const{video:t,audio:i}=W(e);this.hasVideo=!!t,t&&this.videoEncoder.updateConfig(t.settings),i&&this.audioEncoder.updateConfig(i.settings),this.initInput({video:t==null?void 0:t.readable,audio:i==null?void 0:i.readable})}muxAndSend(e,t,i){this.avFormat.formatFrame(e,t,this.hasVideo,i)}initEngineEvents(){this._isVideoEncoded=!this.hasVideo,this.audioEncoder.on({"first-frame-encoded":()=>{this.emit("first-audio-frame-encoded")},"frame-encoded":e=>{this.reconnecting||this.muxAndSend(e,"audio")},"encode-error":e=>{this.triggerError("audio encode error",e)},"config-error":e=>{this.triggerError("audio config error",e)},"config-change":e=>{console.log("Encoder config audio",e)},"decoder-config-change":e=>{this.flv.updateConfig(e)}}),this.videoEncoder.on({"first-frame-encoded":()=>{this.emit("first-video-frame-encoded")},"frame-encoded":(e,t)=>{this.reconnecting||(this._isVideoEncoded||(this._isVideoEncoded=!0),this.muxAndSend(e,"video",t))},"encode-error":e=>{this.triggerError("video encode error",e)},"config-error":e=>{this.triggerError("video config error",e)},"config-change":e=>{console.log("Encoder config video",e)}})}triggerError(e,t){this.emit("error",{info:e,err:t})}async destroy(){this.stopVideoInput(),this.stopAudioInput(),console.log("transport close 1"),await this.transport.destroy(),await this.videoEncoder.destroy(),await this.audioEncoder.destroy(),this.flv.destroy(),super.destroy()}online(){this.transport.online()}setBitrate(e,t){(t==="audio"?this.audioEncoder:this.videoEncoder).updateConfig({bitrate:e,originBitrate:e})}getStats(){return{video:this.videoEncoder.getStats(),audio:this.audioEncoder.getStats(),upspeed:this.transport.getUpSpeed(),upBandwidth:this.transport.getUpBandwidth()}}async reconnect(e){this.reconnecting=!0,this.strategy.reset(),this.avFormat.reset(),this.flv.reset(),this._isVideoEncoded=!this.hasVideo,this.videoEncoder.resetKeyFrame(),this.transport.reconnect(e),await this.transport.onWait("upstream-ready",{prev:!1}),this.reconnecting=!1}}class Te extends M{receiveMainMessage(e){var t,i,n,r,a,o,c;switch(e.type){case g.Start:{this.startMsg=e,this.engine=new Ie,this.initPassEvents(),this.engine.start(e);break}case g.Stop:(t=this.engine)==null||t.destroy();break;case g.UpdateTrack:{const{engine:h}=this;if(!h)return;const d=e.data;d.isAudio?h.stopAudioInput():h.stopVideoInput(),h.initInput({[d.isAudio?"audio":"video"]:d.stream}),(i=h.avFormat)==null||i.reset(),d.setting&&(d.isAudio?h.audioEncoder:h.videoEncoder).updateConfig(d.setting)}break;case g.SetBitrate:(n=this.engine)==null||n.setBitrate(e.data.bitrate,e.data.type);break;case g.Online:(r=this.engine)==null||r.online();break;case g.Reconnect:(o=this.engine)==null||o.reconnect((a=e.data)==null?void 0:a.url);break;case g.GetStats:this.send(g.GetStats,((c=this.engine)==null?void 0:c.getStats())||{});break}}initPassEvents(){["engine-ready","first-audio-frame-encoded","first-video-frame-encoded","error","connect-fail","connect-open","disconnected","reconnected","reconnecting","reconnect-fail","connect-close"].forEach(e=>{this.engine.on(e,t=>{this.send(g.PassEngineEvent,{event:e,data:t})})})}}new Te})();\n', Ma = typeof self < "u" && self.Blob && new Blob([zu], { type: "text/javascript;charset=utf-8" });
|
|
11995
11999
|
function ey(r) {
|
|
11996
12000
|
let e;
|
|
11997
12001
|
try {
|
|
11998
|
-
if (e =
|
|
12002
|
+
if (e = Ma && (self.URL || self.webkitURL).createObjectURL(Ma), !e) throw "";
|
|
11999
12003
|
const t = new Worker(e, {
|
|
12000
12004
|
name: r == null ? void 0 : r.name
|
|
12001
12005
|
});
|
|
@@ -12330,13 +12334,13 @@ var Xr = Du(function(r, e) {
|
|
|
12330
12334
|
}
|
|
12331
12335
|
function g(b, T, E) {
|
|
12332
12336
|
o(function() {
|
|
12333
|
-
var
|
|
12337
|
+
var M;
|
|
12334
12338
|
try {
|
|
12335
|
-
|
|
12339
|
+
M = T(E);
|
|
12336
12340
|
} catch (G) {
|
|
12337
12341
|
return s.reject(b, G);
|
|
12338
12342
|
}
|
|
12339
|
-
|
|
12343
|
+
M === b ? s.reject(b, new TypeError("Cannot resolve promise with itself")) : s.resolve(b, M);
|
|
12340
12344
|
});
|
|
12341
12345
|
}
|
|
12342
12346
|
function k(b) {
|
|
@@ -12347,23 +12351,23 @@ var Xr = Du(function(r, e) {
|
|
|
12347
12351
|
}
|
|
12348
12352
|
function z(b, T) {
|
|
12349
12353
|
var E = !1;
|
|
12350
|
-
function
|
|
12354
|
+
function M(U) {
|
|
12351
12355
|
E || (E = !0, s.reject(b, U));
|
|
12352
12356
|
}
|
|
12353
12357
|
function G(U) {
|
|
12354
12358
|
E || (E = !0, s.resolve(b, U));
|
|
12355
12359
|
}
|
|
12356
12360
|
var I = w(function() {
|
|
12357
|
-
T(G,
|
|
12361
|
+
T(G, M);
|
|
12358
12362
|
});
|
|
12359
|
-
I.status === "error" &&
|
|
12363
|
+
I.status === "error" && M(I.value);
|
|
12360
12364
|
}
|
|
12361
12365
|
function w(b, T) {
|
|
12362
12366
|
var E = {};
|
|
12363
12367
|
try {
|
|
12364
12368
|
E.value = b(T), E.status = "success";
|
|
12365
|
-
} catch (
|
|
12366
|
-
E.status = "error", E.value =
|
|
12369
|
+
} catch (M) {
|
|
12370
|
+
E.status = "error", E.value = M;
|
|
12367
12371
|
}
|
|
12368
12372
|
return E;
|
|
12369
12373
|
}
|
|
@@ -12384,8 +12388,8 @@ var Xr = Du(function(r, e) {
|
|
|
12384
12388
|
}, s.resolve = function(b, T) {
|
|
12385
12389
|
var E = w(k, T);
|
|
12386
12390
|
if (E.status === "error") return s.reject(b, E.value);
|
|
12387
|
-
var
|
|
12388
|
-
if (
|
|
12391
|
+
var M = E.value;
|
|
12392
|
+
if (M) z(b, M);
|
|
12389
12393
|
else {
|
|
12390
12394
|
b.state = c, b.outcome = T;
|
|
12391
12395
|
for (var G = -1, I = b.queue.length; ++G < I; ) b.queue[G].callFulfilled(T);
|
|
@@ -12393,7 +12397,7 @@ var Xr = Du(function(r, e) {
|
|
|
12393
12397
|
return b;
|
|
12394
12398
|
}, s.reject = function(b, T) {
|
|
12395
12399
|
b.state = d, b.outcome = T;
|
|
12396
|
-
for (var E = -1,
|
|
12400
|
+
for (var E = -1, M = b.queue.length; ++E < M; ) b.queue[E].callRejected(T);
|
|
12397
12401
|
return b;
|
|
12398
12402
|
}, f.resolve = function(b) {
|
|
12399
12403
|
return b instanceof this ? b : s.resolve(new this(a), b);
|
|
@@ -12403,26 +12407,26 @@ var Xr = Du(function(r, e) {
|
|
|
12403
12407
|
}, f.all = function(b) {
|
|
12404
12408
|
var T = this;
|
|
12405
12409
|
if (Object.prototype.toString.call(b) !== "[object Array]") return this.reject(new TypeError("must be an array"));
|
|
12406
|
-
var E = b.length,
|
|
12410
|
+
var E = b.length, M = !1;
|
|
12407
12411
|
if (!E) return this.resolve([]);
|
|
12408
12412
|
for (var G = new Array(E), I = 0, U = -1, L = new this(a); ++U < E; ) j(b[U], U);
|
|
12409
12413
|
return L;
|
|
12410
12414
|
function j($, K) {
|
|
12411
|
-
T.resolve($).then(function(
|
|
12412
|
-
G[K] =
|
|
12413
|
-
}, function(
|
|
12414
|
-
|
|
12415
|
+
T.resolve($).then(function(Z) {
|
|
12416
|
+
G[K] = Z, ++I !== E || M || (M = !0, s.resolve(L, G));
|
|
12417
|
+
}, function(Z) {
|
|
12418
|
+
M || (M = !0, s.reject(L, Z));
|
|
12415
12419
|
});
|
|
12416
12420
|
}
|
|
12417
12421
|
}, f.race = function(b) {
|
|
12418
12422
|
var T = this;
|
|
12419
12423
|
if (Object.prototype.toString.call(b) !== "[object Array]") return this.reject(new TypeError("must be an array"));
|
|
12420
|
-
var E = b.length,
|
|
12424
|
+
var E = b.length, M = !1;
|
|
12421
12425
|
if (!E) return this.resolve([]);
|
|
12422
12426
|
for (var G, I = -1, U = new this(a); ++I < E; ) G = b[I], T.resolve(G).then(function(L) {
|
|
12423
|
-
|
|
12427
|
+
M || (M = !0, s.resolve(U, L));
|
|
12424
12428
|
}, function(L) {
|
|
12425
|
-
|
|
12429
|
+
M || (M = !0, s.reject(U, L));
|
|
12426
12430
|
});
|
|
12427
12431
|
return U;
|
|
12428
12432
|
};
|
|
@@ -12508,7 +12512,7 @@ var Xr = Du(function(r, e) {
|
|
|
12508
12512
|
var m = k[l.name].deferredOperations.pop();
|
|
12509
12513
|
if (m) return m.reject(p), m.promise;
|
|
12510
12514
|
}
|
|
12511
|
-
function
|
|
12515
|
+
function M(l, p) {
|
|
12512
12516
|
return new d(function(m, v) {
|
|
12513
12517
|
if (k[l.name] = k[l.name] || { forages: [], db: null, dbReady: null, deferredOperations: [] }, l.db) {
|
|
12514
12518
|
if (!p) return m(l.db);
|
|
@@ -12536,10 +12540,10 @@ var Xr = Du(function(r, e) {
|
|
|
12536
12540
|
});
|
|
12537
12541
|
}
|
|
12538
12542
|
function G(l) {
|
|
12539
|
-
return
|
|
12543
|
+
return M(l, !1);
|
|
12540
12544
|
}
|
|
12541
12545
|
function I(l) {
|
|
12542
|
-
return
|
|
12546
|
+
return M(l, !0);
|
|
12543
12547
|
}
|
|
12544
12548
|
function U(l, p) {
|
|
12545
12549
|
if (!l.db) return !0;
|
|
@@ -12581,8 +12585,8 @@ var Xr = Du(function(r, e) {
|
|
|
12581
12585
|
return function(C) {
|
|
12582
12586
|
b(C);
|
|
12583
12587
|
for (var R = k[C.name], D = R.forages, A = 0; A < D.length; A++) {
|
|
12584
|
-
var
|
|
12585
|
-
|
|
12588
|
+
var O = D[A];
|
|
12589
|
+
O._dbInfo.db && (O._dbInfo.db.close(), O._dbInfo.db = null);
|
|
12586
12590
|
}
|
|
12587
12591
|
return C.db = null, G(C).then(function(N) {
|
|
12588
12592
|
return C.db = N, U(C) ? I(C) : N;
|
|
@@ -12599,7 +12603,7 @@ var Xr = Du(function(r, e) {
|
|
|
12599
12603
|
m(S);
|
|
12600
12604
|
}
|
|
12601
12605
|
}
|
|
12602
|
-
var
|
|
12606
|
+
var Z = { _driver: "asyncStorage", _initStorage: function(l) {
|
|
12603
12607
|
var p = this, m = { db: null };
|
|
12604
12608
|
if (l) for (var v in l) m[v] = l[v];
|
|
12605
12609
|
var _ = k[m.name];
|
|
@@ -12615,10 +12619,10 @@ var Xr = Du(function(r, e) {
|
|
|
12615
12619
|
var A = _.forages.slice(0);
|
|
12616
12620
|
return d.all(S).then(function() {
|
|
12617
12621
|
return m.db = _.db, G(m);
|
|
12618
|
-
}).then(function(
|
|
12619
|
-
return m.db =
|
|
12620
|
-
}).then(function(
|
|
12621
|
-
m.db = _.db =
|
|
12622
|
+
}).then(function(O) {
|
|
12623
|
+
return m.db = O, U(m, p._defaultConfig.version) ? I(m) : O;
|
|
12624
|
+
}).then(function(O) {
|
|
12625
|
+
m.db = _.db = O, p._dbInfo = m;
|
|
12622
12626
|
for (var N = 0; N < A.length; N++) {
|
|
12623
12627
|
var H = A[N];
|
|
12624
12628
|
H !== p && (H._dbInfo.db = m.db, H._dbInfo.version = m.version);
|
|
@@ -12640,18 +12644,18 @@ var Xr = Du(function(r, e) {
|
|
|
12640
12644
|
try {
|
|
12641
12645
|
var D = R.objectStore(m._dbInfo.storeName).openCursor(), A = 1;
|
|
12642
12646
|
D.onsuccess = function() {
|
|
12643
|
-
var
|
|
12644
|
-
if (
|
|
12645
|
-
var N =
|
|
12647
|
+
var O = D.result;
|
|
12648
|
+
if (O) {
|
|
12649
|
+
var N = O.value;
|
|
12646
12650
|
j(N) && (N = L(N));
|
|
12647
|
-
var H = l(N,
|
|
12648
|
-
H !== void 0 ? _(H) :
|
|
12651
|
+
var H = l(N, O.key, A++);
|
|
12652
|
+
H !== void 0 ? _(H) : O.continue();
|
|
12649
12653
|
} else _();
|
|
12650
12654
|
}, D.onerror = function() {
|
|
12651
12655
|
S(D.error);
|
|
12652
12656
|
};
|
|
12653
|
-
} catch (
|
|
12654
|
-
S(
|
|
12657
|
+
} catch (O) {
|
|
12658
|
+
S(O);
|
|
12655
12659
|
}
|
|
12656
12660
|
});
|
|
12657
12661
|
}).catch(S);
|
|
@@ -12686,25 +12690,25 @@ var Xr = Du(function(r, e) {
|
|
|
12686
12690
|
var R;
|
|
12687
12691
|
v.ready().then(function() {
|
|
12688
12692
|
return R = v._dbInfo, z.call(p) === "[object Blob]" ? w(R.db).then(function(D) {
|
|
12689
|
-
return D ? p : (A = p, new d(function(
|
|
12693
|
+
return D ? p : (A = p, new d(function(O, N) {
|
|
12690
12694
|
var H = new FileReader();
|
|
12691
12695
|
H.onerror = N, H.onloadend = function(q) {
|
|
12692
12696
|
var Q = btoa(q.target.result || "");
|
|
12693
|
-
|
|
12697
|
+
O({ __local_forage_encoded_blob: !0, data: Q, type: A.type });
|
|
12694
12698
|
}, H.readAsBinaryString(A);
|
|
12695
12699
|
}));
|
|
12696
12700
|
var A;
|
|
12697
12701
|
}) : p;
|
|
12698
12702
|
}).then(function(D) {
|
|
12699
|
-
K(v._dbInfo, "readwrite", function(A,
|
|
12703
|
+
K(v._dbInfo, "readwrite", function(A, O) {
|
|
12700
12704
|
if (A) return C(A);
|
|
12701
12705
|
try {
|
|
12702
|
-
var N =
|
|
12706
|
+
var N = O.objectStore(v._dbInfo.storeName);
|
|
12703
12707
|
D === null && (D = void 0);
|
|
12704
12708
|
var H = N.put(D, l);
|
|
12705
|
-
|
|
12709
|
+
O.oncomplete = function() {
|
|
12706
12710
|
D === void 0 && (D = null), S(D);
|
|
12707
|
-
},
|
|
12711
|
+
}, O.onabort = O.onerror = function() {
|
|
12708
12712
|
try {
|
|
12709
12713
|
var q = H.error ? H.error : H.transaction.error;
|
|
12710
12714
|
C(q);
|
|
@@ -12736,8 +12740,8 @@ var Xr = Du(function(r, e) {
|
|
|
12736
12740
|
try {
|
|
12737
12741
|
var A = D.error ? D.error : D.transaction.error;
|
|
12738
12742
|
S(A);
|
|
12739
|
-
} catch (
|
|
12740
|
-
S(
|
|
12743
|
+
} catch (O) {
|
|
12744
|
+
S(O);
|
|
12741
12745
|
}
|
|
12742
12746
|
};
|
|
12743
12747
|
} catch (A) {
|
|
@@ -12796,12 +12800,12 @@ var Xr = Du(function(r, e) {
|
|
|
12796
12800
|
K(m._dbInfo, "readonly", function(C, R) {
|
|
12797
12801
|
if (C) return S(C);
|
|
12798
12802
|
try {
|
|
12799
|
-
var D = R.objectStore(m._dbInfo.storeName), A = !1,
|
|
12800
|
-
|
|
12801
|
-
var N =
|
|
12803
|
+
var D = R.objectStore(m._dbInfo.storeName), A = !1, O = (D.openKeyCursor || D.openCursor).call(D);
|
|
12804
|
+
O.onsuccess = function() {
|
|
12805
|
+
var N = O.result;
|
|
12802
12806
|
N ? l === 0 || A ? _(N.key) : (A = !0, N.advance(l)) : _(null);
|
|
12803
|
-
},
|
|
12804
|
-
S(
|
|
12807
|
+
}, O.onerror = function() {
|
|
12808
|
+
S(O.error);
|
|
12805
12809
|
};
|
|
12806
12810
|
} catch (N) {
|
|
12807
12811
|
S(N);
|
|
@@ -12818,13 +12822,13 @@ var Xr = Du(function(r, e) {
|
|
|
12818
12822
|
try {
|
|
12819
12823
|
var R = C.objectStore(p._dbInfo.storeName), D = (R.openKeyCursor || R.openCursor).call(R), A = [];
|
|
12820
12824
|
D.onsuccess = function() {
|
|
12821
|
-
var
|
|
12822
|
-
|
|
12825
|
+
var O = D.result;
|
|
12826
|
+
O ? (A.push(O.key), O.continue()) : v(A);
|
|
12823
12827
|
}, D.onerror = function() {
|
|
12824
12828
|
_(D.error);
|
|
12825
12829
|
};
|
|
12826
|
-
} catch (
|
|
12827
|
-
_(
|
|
12830
|
+
} catch (O) {
|
|
12831
|
+
_(O);
|
|
12828
12832
|
}
|
|
12829
12833
|
});
|
|
12830
12834
|
}).catch(_);
|
|
@@ -12839,17 +12843,17 @@ var Xr = Du(function(r, e) {
|
|
|
12839
12843
|
var S = l.name === m.name && _._dbInfo.db, C = S ? d.resolve(_._dbInfo.db) : G(l).then(function(R) {
|
|
12840
12844
|
var D = k[l.name], A = D.forages;
|
|
12841
12845
|
D.db = R;
|
|
12842
|
-
for (var
|
|
12846
|
+
for (var O = 0; O < A.length; O++) A[O]._dbInfo.db = R;
|
|
12843
12847
|
return R;
|
|
12844
12848
|
});
|
|
12845
12849
|
v = l.storeName ? C.then(function(R) {
|
|
12846
12850
|
if (R.objectStoreNames.contains(l.storeName)) {
|
|
12847
12851
|
var D = R.version + 1;
|
|
12848
12852
|
b(l);
|
|
12849
|
-
var A = k[l.name],
|
|
12853
|
+
var A = k[l.name], O = A.forages;
|
|
12850
12854
|
R.close();
|
|
12851
|
-
for (var N = 0; N <
|
|
12852
|
-
var H =
|
|
12855
|
+
for (var N = 0; N < O.length; N++) {
|
|
12856
|
+
var H = O[N];
|
|
12853
12857
|
H._dbInfo.db = null, H._dbInfo.version = D;
|
|
12854
12858
|
}
|
|
12855
12859
|
return new d(function(q, Q) {
|
|
@@ -12864,8 +12868,8 @@ var Xr = Du(function(r, e) {
|
|
|
12864
12868
|
};
|
|
12865
12869
|
}).then(function(q) {
|
|
12866
12870
|
A.db = q;
|
|
12867
|
-
for (var Q = 0; Q <
|
|
12868
|
-
var me =
|
|
12871
|
+
for (var Q = 0; Q < O.length; Q++) {
|
|
12872
|
+
var me = O[Q];
|
|
12869
12873
|
me._dbInfo.db = q, T(me._dbInfo);
|
|
12870
12874
|
}
|
|
12871
12875
|
}).catch(function(q) {
|
|
@@ -12877,7 +12881,7 @@ var Xr = Du(function(r, e) {
|
|
|
12877
12881
|
b(l);
|
|
12878
12882
|
var D = k[l.name], A = D.forages;
|
|
12879
12883
|
R.close();
|
|
12880
|
-
for (var
|
|
12884
|
+
for (var O = 0; O < A.length; O++) A[O]._dbInfo.db = null;
|
|
12881
12885
|
return new d(function(N, H) {
|
|
12882
12886
|
var q = a.deleteDatabase(l.name);
|
|
12883
12887
|
q.onerror = function() {
|
|
@@ -12903,8 +12907,8 @@ var Xr = Du(function(r, e) {
|
|
|
12903
12907
|
function fe(l) {
|
|
12904
12908
|
var p, m, v, _, S, C = 0.75 * l.length, R = l.length, D = 0;
|
|
12905
12909
|
l[l.length - 1] === "=" && (C--, l[l.length - 2] === "=" && C--);
|
|
12906
|
-
var A = new ArrayBuffer(C),
|
|
12907
|
-
for (p = 0; p < R; p += 4) m = W.indexOf(l[p]), v = W.indexOf(l[p + 1]), _ = W.indexOf(l[p + 2]), S = W.indexOf(l[p + 3]),
|
|
12910
|
+
var A = new ArrayBuffer(C), O = new Uint8Array(A);
|
|
12911
|
+
for (p = 0; p < R; p += 4) m = W.indexOf(l[p]), v = W.indexOf(l[p + 1]), _ = W.indexOf(l[p + 2]), S = W.indexOf(l[p + 3]), O[D++] = m << 2 | v >> 4, O[D++] = (15 & v) << 4 | _ >> 2, O[D++] = (3 & _) << 6 | 63 & S;
|
|
12908
12912
|
return A;
|
|
12909
12913
|
}
|
|
12910
12914
|
function ue(l) {
|
|
@@ -12982,9 +12986,9 @@ var Xr = Du(function(r, e) {
|
|
|
12982
12986
|
_.ready().then(function() {
|
|
12983
12987
|
p === void 0 && (p = null);
|
|
12984
12988
|
var D = p, A = _._dbInfo;
|
|
12985
|
-
A.serializer.serialize(p, function(
|
|
12989
|
+
A.serializer.serialize(p, function(O, N) {
|
|
12986
12990
|
N ? R(N) : A.db.transaction(function(H) {
|
|
12987
|
-
re(H, A, "INSERT OR REPLACE INTO " + A.storeName + " (key, value) VALUES (?, ?)", [l,
|
|
12991
|
+
re(H, A, "INSERT OR REPLACE INTO " + A.storeName + " (key, value) VALUES (?, ?)", [l, O], function() {
|
|
12988
12992
|
C(D);
|
|
12989
12993
|
}, function(q, Q) {
|
|
12990
12994
|
R(Q);
|
|
@@ -13038,8 +13042,8 @@ var Xr = Du(function(r, e) {
|
|
|
13038
13042
|
var C = m._dbInfo;
|
|
13039
13043
|
C.db.transaction(function(R) {
|
|
13040
13044
|
re(R, C, "SELECT * FROM " + C.storeName, [], function(D, A) {
|
|
13041
|
-
for (var
|
|
13042
|
-
var q =
|
|
13045
|
+
for (var O = A.rows, N = O.length, H = 0; H < N; H++) {
|
|
13046
|
+
var q = O.item(H), Q = q.value;
|
|
13043
13047
|
if (Q && (Q = C.serializer.deserialize(Q)), (Q = l(Q, q.key, H + 1)) !== void 0) return void _(Q);
|
|
13044
13048
|
}
|
|
13045
13049
|
_();
|
|
@@ -13058,8 +13062,8 @@ var Xr = Du(function(r, e) {
|
|
|
13058
13062
|
var C = m._dbInfo;
|
|
13059
13063
|
C.db.transaction(function(R) {
|
|
13060
13064
|
re(R, C, "SELECT * FROM " + C.storeName + " WHERE key = ? LIMIT 1", [l], function(D, A) {
|
|
13061
|
-
var
|
|
13062
|
-
|
|
13065
|
+
var O = A.rows.length ? A.rows.item(0).value : null;
|
|
13066
|
+
O && (O = C.serializer.deserialize(O)), _(O);
|
|
13063
13067
|
}, function(D, A) {
|
|
13064
13068
|
S(A);
|
|
13065
13069
|
});
|
|
@@ -13120,8 +13124,8 @@ var Xr = Du(function(r, e) {
|
|
|
13120
13124
|
var C = m._dbInfo;
|
|
13121
13125
|
C.db.transaction(function(R) {
|
|
13122
13126
|
re(R, C, "SELECT key FROM " + C.storeName + " WHERE id = ? LIMIT 1", [l + 1], function(D, A) {
|
|
13123
|
-
var
|
|
13124
|
-
_(
|
|
13127
|
+
var O = A.rows.length ? A.rows.item(0).key : null;
|
|
13128
|
+
_(O);
|
|
13125
13129
|
}, function(D, A) {
|
|
13126
13130
|
S(A);
|
|
13127
13131
|
});
|
|
@@ -13135,7 +13139,7 @@ var Xr = Du(function(r, e) {
|
|
|
13135
13139
|
var S = p._dbInfo;
|
|
13136
13140
|
S.db.transaction(function(C) {
|
|
13137
13141
|
re(C, S, "SELECT key FROM " + S.storeName, [], function(R, D) {
|
|
13138
|
-
for (var A = [],
|
|
13142
|
+
for (var A = [], O = 0; O < D.rows.length; O++) A.push(D.rows.item(O).key);
|
|
13139
13143
|
v(A);
|
|
13140
13144
|
}, function(R, D) {
|
|
13141
13145
|
_(D);
|
|
@@ -13164,8 +13168,8 @@ var Xr = Du(function(r, e) {
|
|
|
13164
13168
|
});
|
|
13165
13169
|
});
|
|
13166
13170
|
}
|
|
13167
|
-
for (var
|
|
13168
|
-
d.all(
|
|
13171
|
+
for (var O = [], N = 0, H = S.storeNames.length; N < H; N++) O.push(A(S.storeNames[N]));
|
|
13172
|
+
d.all(O).then(function() {
|
|
13169
13173
|
C();
|
|
13170
13174
|
}).catch(function(q) {
|
|
13171
13175
|
R(q);
|
|
@@ -13202,10 +13206,10 @@ var Xr = Du(function(r, e) {
|
|
|
13202
13206
|
}(), iterate: function(l, p) {
|
|
13203
13207
|
var m = this, v = m.ready().then(function() {
|
|
13204
13208
|
for (var _ = m._dbInfo, S = _.keyPrefix, C = S.length, R = localStorage.length, D = 1, A = 0; A < R; A++) {
|
|
13205
|
-
var
|
|
13206
|
-
if (
|
|
13207
|
-
var N = localStorage.getItem(
|
|
13208
|
-
if (N && (N = _.serializer.deserialize(N)), (N = l(N,
|
|
13209
|
+
var O = localStorage.key(A);
|
|
13210
|
+
if (O.indexOf(S) === 0) {
|
|
13211
|
+
var N = localStorage.getItem(O);
|
|
13212
|
+
if (N && (N = _.serializer.deserialize(N)), (N = l(N, O.substring(C), D++)) !== void 0) return N;
|
|
13209
13213
|
}
|
|
13210
13214
|
}
|
|
13211
13215
|
});
|
|
@@ -13226,8 +13230,8 @@ var Xr = Du(function(r, e) {
|
|
|
13226
13230
|
var S = p;
|
|
13227
13231
|
return new d(function(C, R) {
|
|
13228
13232
|
var D = v._dbInfo;
|
|
13229
|
-
D.serializer.serialize(p, function(A,
|
|
13230
|
-
if (
|
|
13233
|
+
D.serializer.serialize(p, function(A, O) {
|
|
13234
|
+
if (O) R(O);
|
|
13231
13235
|
else try {
|
|
13232
13236
|
localStorage.setItem(D.keyPrefix + l, A), C(S);
|
|
13233
13237
|
} catch (N) {
|
|
@@ -13302,7 +13306,7 @@ var Xr = Du(function(r, e) {
|
|
|
13302
13306
|
return !1;
|
|
13303
13307
|
}, He = Array.isArray || function(l) {
|
|
13304
13308
|
return Object.prototype.toString.call(l) === "[object Array]";
|
|
13305
|
-
}, Te = {}, De = {}, Ue = { INDEXEDDB:
|
|
13309
|
+
}, Te = {}, De = {}, Ue = { INDEXEDDB: Z, WEBSQL: pe, LOCALSTORAGE: Le }, Ge = [Ue.INDEXEDDB._driver, Ue.WEBSQL._driver, Ue.LOCALSTORAGE._driver], Ne = ["dropInstance"], Ze = ["clear", "getItem", "iterate", "key", "keys", "length", "removeItem", "setItem"].concat(Ne), gt = { description: "", driver: Ge.slice(), name: "localforage", size: 4980736, storeName: "keyvaluepairs", version: 1 };
|
|
13306
13310
|
function nt(l, p) {
|
|
13307
13311
|
l[p] = function() {
|
|
13308
13312
|
var m = arguments;
|
|
@@ -13344,8 +13348,8 @@ var Xr = Du(function(r, e) {
|
|
|
13344
13348
|
try {
|
|
13345
13349
|
var R = p._driver, D = new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");
|
|
13346
13350
|
if (!p._driver) return void C(D);
|
|
13347
|
-
for (var A = Ze.concat("_initStorage"),
|
|
13348
|
-
var H = A[
|
|
13351
|
+
for (var A = Ze.concat("_initStorage"), O = 0, N = A.length; O < N; O++) {
|
|
13352
|
+
var H = A[O];
|
|
13349
13353
|
if ((!mt(Ne, H) || p[H]) && typeof p[H] != "function") return void C(D);
|
|
13350
13354
|
}
|
|
13351
13355
|
(function() {
|
|
@@ -13396,8 +13400,8 @@ var Xr = Du(function(r, e) {
|
|
|
13396
13400
|
}) : d.resolve();
|
|
13397
13401
|
return this._driverSet = D.then(function() {
|
|
13398
13402
|
var A = S[0];
|
|
13399
|
-
return _._dbInfo = null, _._ready = null, _.getDriver(A).then(function(
|
|
13400
|
-
_._driver =
|
|
13403
|
+
return _._dbInfo = null, _._ready = null, _.getDriver(A).then(function(O) {
|
|
13404
|
+
_._driver = O._driver, C(), _._wrapLibraryMethodsWithReady(), _._initDriver = /* @__PURE__ */ function(N) {
|
|
13401
13405
|
return function() {
|
|
13402
13406
|
var H = 0;
|
|
13403
13407
|
return function q() {
|
|
@@ -13598,10 +13602,10 @@ var Xr = Du(function(r, e) {
|
|
|
13598
13602
|
return r.prototype.init = function() {
|
|
13599
13603
|
var e, t = window.navigator.userAgent, n = window.navigator.language, i = document.referrer, o = i ? Ru(i).hostname : "", a = mo(window.location.href), s = /Mobile|htc|mini|Android|iP(ad|od|hone)/.test(this.appVersion) ? "wap" : "web", d = ((e = window.navigator.connection) === null || e === void 0 ? void 0 : e.effectiveType) || "";
|
|
13600
13604
|
this.utm = function(f, h, g, k) {
|
|
13601
|
-
var z = new Au(), w = f ? "_tea_utm_cache_" + f : "_tea_utm_cache", b = f ? "_$utm_from_url_" + f : "_$utm_from_url", T = {}, E = ["tr_shareuser", "tr_admaster", "tr_param1", "tr_param2", "tr_param3", "tr_param4", "$utm_from_url"],
|
|
13605
|
+
var z = new Au(), w = f ? "_tea_utm_cache_" + f : "_tea_utm_cache", b = f ? "_$utm_from_url_" + f : "_$utm_from_url", T = {}, E = ["tr_shareuser", "tr_admaster", "tr_param1", "tr_param2", "tr_param3", "tr_param4", "$utm_from_url"], M = { ad_id: Number(h.ad_id) || void 0, campaign_id: Number(h.campaign_id) || void 0, creative_id: Number(h.creative_id) || void 0, utm_source: h.utm_source, utm_medium: h.utm_medium, utm_campaign: h.utm_campaign, utm_term: h.utm_term, utm_content: h.utm_content, tr_shareuser: h.tr_shareuser, tr_admaster: h.tr_admaster, tr_param1: h.tr_param1, tr_param2: h.tr_param2, tr_param3: h.tr_param3, tr_param4: h.tr_param4 };
|
|
13602
13606
|
try {
|
|
13603
13607
|
var G = !1;
|
|
13604
|
-
for (var I in
|
|
13608
|
+
for (var I in M) M[I] && (E.indexOf(I) !== -1 ? (T.hasOwnProperty("tracer_data") || (T.tracer_data = {}), T.tracer_data[I] = M[I]) : T[I] = M[I], G = !0);
|
|
13605
13609
|
if (G) z.setSessionItem(b, "1"), z.setCookie(w, JSON.stringify(T), k, g);
|
|
13606
13610
|
else {
|
|
13607
13611
|
var U = z.getCookie(w, g);
|
|
@@ -13609,7 +13613,7 @@ var Xr = Du(function(r, e) {
|
|
|
13609
13613
|
}
|
|
13610
13614
|
z.getSessionItem(b) == 1 && (T.hasOwnProperty("tracer_data") || (T.tracer_data = {}), T.tracer_data.$utm_from_url = 1);
|
|
13611
13615
|
} catch {
|
|
13612
|
-
return
|
|
13616
|
+
return M;
|
|
13613
13617
|
}
|
|
13614
13618
|
return T;
|
|
13615
13619
|
}(this.appid, a, this.domain, this.cookie_expire);
|
|
@@ -14466,14 +14470,14 @@ var B = go, oe = void 0, xu = (/* @__PURE__ */ new Date()).getTimezoneOffset(),
|
|
|
14466
14470
|
var e = this.storage.getSessionItem(this.sessionKey);
|
|
14467
14471
|
e && e.sessionId && Date.now() - e.timestamp + 30 >= this.expireTime && (e = { sessionId: Gr(), timestamp: Date.now() }, this.storage.setSessionItem(this.sessionKey, e));
|
|
14468
14472
|
}, r;
|
|
14469
|
-
}(), at = Uint8Array, Xe = Uint16Array, rs = Int32Array, ns = new at([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 0, 0, 0]), is = new at([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 0, 0]), Ba = new at([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]),
|
|
14473
|
+
}(), at = Uint8Array, Xe = Uint16Array, rs = Int32Array, ns = new at([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 0, 0, 0]), is = new at([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 0, 0]), Ba = new at([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), Ou = function(r, e) {
|
|
14470
14474
|
for (var t = new Xe(31), n = 0; n < 31; ++n) t[n] = e += 1 << r[n - 1];
|
|
14471
14475
|
var i = new rs(t[30]);
|
|
14472
14476
|
for (n = 1; n < 30; ++n) for (var o = t[n]; o < t[n + 1]; ++o) i[o] = o - t[n] << 5 | n;
|
|
14473
14477
|
return { b: t, r: i };
|
|
14474
|
-
},
|
|
14478
|
+
}, Mu = Ou(ns, 2), Cy = Mu.b, _o = Mu.r;
|
|
14475
14479
|
Cy[28] = 258, _o[258] = 28;
|
|
14476
|
-
for (var Fa =
|
|
14480
|
+
for (var Fa = Ou(is, 0), TS = Fa.b, Va = Fa.r, vo = new Xe(32768), _e = 0; _e < 32768; ++_e) {
|
|
14477
14481
|
var jt = (43690 & _e) >> 1 | (21845 & _e) << 1;
|
|
14478
14482
|
jt = (61680 & (jt = (52428 & jt) >> 2 | (13107 & jt) << 2)) >> 4 | (3855 & jt) << 4, vo[_e] = ((65280 & jt) >> 8 | (255 & jt) << 8) >> 1;
|
|
14479
14483
|
}
|
|
@@ -14541,8 +14545,8 @@ var Pu = function(r) {
|
|
|
14541
14545
|
g[E] < e ? z -= 1 << e - g[E]++ - 1 : ++n;
|
|
14542
14546
|
}
|
|
14543
14547
|
for (; n >= 0 && z; --n) {
|
|
14544
|
-
var
|
|
14545
|
-
g[
|
|
14548
|
+
var M = o[n].s;
|
|
14549
|
+
g[M] == e && (--g[M], ++z);
|
|
14546
14550
|
}
|
|
14547
14551
|
k = e;
|
|
14548
14552
|
}
|
|
@@ -14576,16 +14580,16 @@ var Pu = function(r) {
|
|
|
14576
14580
|
return 8 * (i + 4 + n);
|
|
14577
14581
|
}, Ha = function(r, e, t, n, i, o, a, s, d, c, u) {
|
|
14578
14582
|
vt(e, u++, t), ++i[256];
|
|
14579
|
-
for (var f = Vi(i, 15), h = f.t, g = f.l, k = Vi(o, 15), z = k.t, w = k.l, b = ja(h), T = b.c, E = b.n,
|
|
14583
|
+
for (var f = Vi(i, 15), h = f.t, g = f.l, k = Vi(o, 15), z = k.t, w = k.l, b = ja(h), T = b.c, E = b.n, M = ja(z), G = M.c, I = M.n, U = new Xe(19), L = 0; L < T.length; ++L) ++U[31 & T[L]];
|
|
14580
14584
|
for (L = 0; L < G.length; ++L) ++U[31 & G[L]];
|
|
14581
|
-
for (var j = Vi(U, 7), $ = j.t, K = j.l,
|
|
14582
|
-
var W, se, ne, Y, le = c + 5 << 3, fe = Ir(i, Nt) + Ir(o, ln) + a, ue = Ir(i, h) + Ir(o, z) + a + 14 + 3 *
|
|
14585
|
+
for (var j = Vi(U, 7), $ = j.t, K = j.l, Z = 19; Z > 4 && !$[Ba[Z - 1]]; --Z) ;
|
|
14586
|
+
var W, se, ne, Y, le = c + 5 << 3, fe = Ir(i, Nt) + Ir(o, ln) + a, ue = Ir(i, h) + Ir(o, z) + a + 14 + 3 * Z + Ir(U, $) + 2 * U[16] + 3 * U[17] + 7 * U[18];
|
|
14583
14587
|
if (d >= 0 && le <= fe && le <= ue) return Lu(e, u, r.subarray(d, d + c));
|
|
14584
14588
|
if (vt(e, u, 1 + (ue < fe)), u += 2, ue < fe) {
|
|
14585
14589
|
W = Zt(h, g, 0), se = h, ne = Zt(z, w, 0), Y = z;
|
|
14586
14590
|
var Se = Zt($, K, 0);
|
|
14587
|
-
for (vt(e, u, E - 257), vt(e, u + 5, I - 1), vt(e, u + 10,
|
|
14588
|
-
u += 3 *
|
|
14591
|
+
for (vt(e, u, E - 257), vt(e, u + 5, I - 1), vt(e, u + 10, Z - 4), u += 14, L = 0; L < Z; ++L) vt(e, u + 3 * L, $[Ba[L]]);
|
|
14592
|
+
u += 3 * Z;
|
|
14589
14593
|
for (var ye = [T, G], re = 0; re < 2; ++re) {
|
|
14590
14594
|
var Ee = ye[re];
|
|
14591
14595
|
for (L = 0; L < Ee.length; ++L) {
|
|
@@ -14626,18 +14630,18 @@ var Pu = function(r) {
|
|
|
14626
14630
|
var g = h.z || s.length, k = new at(u + g + 5 * (1 + Math.ceil(g / 7e3)) + f), z = k.subarray(u, k.length - f), w = h.l, b = 7 & (h.r || 0);
|
|
14627
14631
|
if (d) {
|
|
14628
14632
|
b && (z[0] = h.r >> 3);
|
|
14629
|
-
for (var T = Ry[d - 1], E = T >> 13,
|
|
14633
|
+
for (var T = Ry[d - 1], E = T >> 13, M = 8191 & T, G = (1 << c) - 1, I = h.p || new Xe(32768), U = h.h || new Xe(G + 1), L = Math.ceil(c / 3), j = 2 * L, $ = function(it) {
|
|
14630
14634
|
return (s[it] ^ s[it + 1] << L ^ s[it + 2] << j) & G;
|
|
14631
|
-
}, K = new rs(25e3),
|
|
14635
|
+
}, K = new rs(25e3), Z = new Xe(288), W = new Xe(32), se = 0, ne = 0, Y = h.i || 0, le = 0, fe = h.w || 0, ue = 0; Y + 2 < g; ++Y) {
|
|
14632
14636
|
var Se = $(Y), ye = 32767 & Y, re = U[Se];
|
|
14633
14637
|
if (I[ye] = re, U[Se] = ye, fe <= Y) {
|
|
14634
14638
|
var Ee = g - Y;
|
|
14635
14639
|
if ((se > 7e3 || le > 24576) && (Ee > 423 || !w)) {
|
|
14636
|
-
b = Ha(s, z, 0, K,
|
|
14637
|
-
for (var de = 0; de < 286; ++de)
|
|
14640
|
+
b = Ha(s, z, 0, K, Z, W, ne, le, ue, Y - ue, b), le = se = ne = 0, ue = Y;
|
|
14641
|
+
for (var de = 0; de < 286; ++de) Z[de] = 0;
|
|
14638
14642
|
for (de = 0; de < 30; ++de) W[de] = 0;
|
|
14639
14643
|
}
|
|
14640
|
-
var pe = 2, Re = 0, Dt =
|
|
14644
|
+
var pe = 2, Re = 0, Dt = M, Le = ye - re & 32767;
|
|
14641
14645
|
if (Ee > 2 && Se == $(Y - Le)) for (var At = Math.min(E, Ee) - 1, mt = Math.min(32767, Y), He = Math.min(258, Ee); Le <= mt && --Dt && ye != re; ) {
|
|
14642
14646
|
if (s[Y + pe] == s[Y + pe - Le]) {
|
|
14643
14647
|
for (var Te = 0; Te < He && s[Y + Te] == s[Y + Te - Le]; ++Te) ;
|
|
@@ -14655,12 +14659,12 @@ var Pu = function(r) {
|
|
|
14655
14659
|
if (Re) {
|
|
14656
14660
|
K[le++] = 268435456 | _o[pe] << 18 | Va[Re];
|
|
14657
14661
|
var Ze = 31 & _o[pe], gt = 31 & Va[Re];
|
|
14658
|
-
ne += ns[Ze] + is[gt], ++
|
|
14659
|
-
} else K[le++] = s[Y], ++
|
|
14662
|
+
ne += ns[Ze] + is[gt], ++Z[257 + Ze], ++W[gt], fe = Y + pe, ++se;
|
|
14663
|
+
} else K[le++] = s[Y], ++Z[s[Y]];
|
|
14660
14664
|
}
|
|
14661
14665
|
}
|
|
14662
|
-
for (Y = Math.max(Y, fe); Y < g; ++Y) K[le++] = s[Y], ++
|
|
14663
|
-
b = Ha(s, z, w, K,
|
|
14666
|
+
for (Y = Math.max(Y, fe); Y < g; ++Y) K[le++] = s[Y], ++Z[s[Y]];
|
|
14667
|
+
b = Ha(s, z, w, K, Z, W, ne, le, ue, Y - ue, b), w || (h.r = 7 & b | z[b / 8 | 0] << 3, b -= 7, h.h = U, h.p = I, h.i = Y, h.w = fe);
|
|
14664
14668
|
} else {
|
|
14665
14669
|
for (Y = h.w || 0; Y < g + w; Y += 65535) {
|
|
14666
14670
|
var nt = Y + 65535;
|
|
@@ -14678,19 +14682,19 @@ var Pu = function(r) {
|
|
|
14678
14682
|
r[3] = 8;
|
|
14679
14683
|
for (var n = 0; n <= t.length; ++n) r[n + 10] = t.charCodeAt(n);
|
|
14680
14684
|
}
|
|
14681
|
-
},
|
|
14685
|
+
}, Oy = function(r) {
|
|
14682
14686
|
return 10 + (r.filename ? r.filename.length + 1 : 0);
|
|
14683
14687
|
};
|
|
14684
14688
|
function $a(r, e) {
|
|
14685
14689
|
e || (e = {});
|
|
14686
14690
|
var t = Ay(), n = r.length;
|
|
14687
14691
|
t.p(r);
|
|
14688
|
-
var i = Iy(r, e,
|
|
14692
|
+
var i = Iy(r, e, Oy(e), 8), o = i.length;
|
|
14689
14693
|
return xy(i, e), So(i, o - 8, t.d()), So(i, o - 4, n), i;
|
|
14690
14694
|
}
|
|
14691
|
-
var
|
|
14695
|
+
var My = (typeof TextEncoder < "u" && new TextEncoder(), typeof TextDecoder < "u" && new TextDecoder());
|
|
14692
14696
|
try {
|
|
14693
|
-
|
|
14697
|
+
My.decode(Uu, { stream: !0 });
|
|
14694
14698
|
} catch {
|
|
14695
14699
|
}
|
|
14696
14700
|
var Py = function() {
|
|
@@ -15889,7 +15893,7 @@ class uS {
|
|
|
15889
15893
|
this.execute(!0);
|
|
15890
15894
|
}, this.execute = (n = !1) => {
|
|
15891
15895
|
var i;
|
|
15892
|
-
this._logger.log("start reconnect strategy"), this.state === "idle" && (this._reconnectStartTime = Date.now(), this._totalReconnectInfo.totalReconnectCount += 1,
|
|
15896
|
+
this._logger.log("start reconnect strategy"), this.state === "idle" && (this._reconnectStartTime = Date.now(), this._totalReconnectInfo.totalReconnectCount += 1, X(J.PUSH_RECONNECT_START, {
|
|
15893
15897
|
start_time: this._reconnectStartTime,
|
|
15894
15898
|
session_id: this._pushConsumer.pushSessionId,
|
|
15895
15899
|
max_timeout: this._maxTimeout
|
|
@@ -16072,7 +16076,7 @@ class dS extends Su {
|
|
|
16072
16076
|
retryDelay: 1e3
|
|
16073
16077
|
}, this._audioBitrate = _r(pc, "audio").bitrate, this._videoBitrate = _r(fc, "video").bitrate, this.handleReconnectError = (s, d) => {
|
|
16074
16078
|
var c, u;
|
|
16075
|
-
|
|
16079
|
+
X(J.STOP_PUSH_STREAM, {
|
|
16076
16080
|
reason: xr.ReconnectFailed,
|
|
16077
16081
|
error_message: s,
|
|
16078
16082
|
session_id: this._pushSessionId,
|
|
@@ -16101,14 +16105,14 @@ class dS extends Su {
|
|
|
16101
16105
|
this.pushDuration < Jm || !this._reconnectStrategy || this.pushMode === "webTransport" ? (this._streamConsumeController.emit(
|
|
16102
16106
|
Ce.PushError,
|
|
16103
16107
|
d
|
|
16104
|
-
),
|
|
16108
|
+
), X(J.STOP_PUSH_STREAM, {
|
|
16105
16109
|
reason: xr.PushError,
|
|
16106
16110
|
duration: this.pushDuration,
|
|
16107
16111
|
session_id: this._pushSessionId,
|
|
16108
16112
|
push_mode: this._pushMode,
|
|
16109
16113
|
error_msg: s.message,
|
|
16110
16114
|
error_code: s.code
|
|
16111
|
-
}),
|
|
16115
|
+
}), X(J.START_PUSH_STATUS, {
|
|
16112
16116
|
is_success: !1,
|
|
16113
16117
|
reason: ur.PushError,
|
|
16114
16118
|
error_message: s.message,
|
|
@@ -16121,7 +16125,7 @@ class dS extends Su {
|
|
|
16121
16125
|
(s = this._reconnectStrategy) == null || s.execute(), this.setConnectState(qe.RECONNECTING), this.unpublish({ isReconnecting: !0 });
|
|
16122
16126
|
}, this._OnRtcStateChange = (s) => {
|
|
16123
16127
|
var d;
|
|
16124
|
-
switch (
|
|
16128
|
+
switch (X(J.PUSH_RTC_STATE_CHANGE, {
|
|
16125
16129
|
state: s,
|
|
16126
16130
|
push_url: this._pushUrl,
|
|
16127
16131
|
session_id: this._pushSessionId,
|
|
@@ -16138,13 +16142,13 @@ class dS extends Su {
|
|
|
16138
16142
|
this._reconnectStrategy && this._executeReconnect();
|
|
16139
16143
|
break;
|
|
16140
16144
|
case "failed":
|
|
16141
|
-
(d = this._reconnectStrategy) != null && d.isActive() ? this._executeReconnect() : (this.connectionState === qe.CONNECTED ?
|
|
16145
|
+
(d = this._reconnectStrategy) != null && d.isActive() ? this._executeReconnect() : (this.connectionState === qe.CONNECTED ? X(J.STOP_PUSH_STREAM, {
|
|
16142
16146
|
reason: xr.PushError,
|
|
16143
16147
|
error_message: "peerconnection failed",
|
|
16144
16148
|
duration: this.pushDuration,
|
|
16145
16149
|
session_id: this._pushSessionId,
|
|
16146
16150
|
push_mode: this._pushMode
|
|
16147
|
-
}) :
|
|
16151
|
+
}) : X(J.START_PUSH_STATUS, {
|
|
16148
16152
|
is_success: !1,
|
|
16149
16153
|
reason: ur.PushError,
|
|
16150
16154
|
error_message: "peerconnection failed",
|
|
@@ -16200,7 +16204,7 @@ class dS extends Su {
|
|
|
16200
16204
|
case qe.CONNECTED:
|
|
16201
16205
|
(t = this._reconnectStrategy) != null && t.isActive() ? this._reconnectStrategy.stop({ isSuccess: !0 }) : (this._streamConsumeController.emit(
|
|
16202
16206
|
Ce.PushStart
|
|
16203
|
-
), this.setPushStatsInterval(),
|
|
16207
|
+
), this.setPushStatsInterval(), X(J.START_PUSH_STATUS, {
|
|
16204
16208
|
is_success: !0,
|
|
16205
16209
|
push_url: this._pushUrl,
|
|
16206
16210
|
session_id: this._pushSessionId,
|
|
@@ -16214,11 +16218,11 @@ class dS extends Su {
|
|
|
16214
16218
|
}
|
|
16215
16219
|
async startPush(e, t = {}) {
|
|
16216
16220
|
var a, s, d;
|
|
16217
|
-
if (t.isReconnect || (this._pushSessionId = Date.now(),
|
|
16221
|
+
if (t.isReconnect || (this._pushSessionId = Date.now(), X(J.START_PUSH, {
|
|
16218
16222
|
push_url: e,
|
|
16219
16223
|
session_id: this._pushSessionId
|
|
16220
16224
|
})), !e)
|
|
16221
|
-
throw
|
|
16225
|
+
throw X(J.START_PUSH_STATUS, {
|
|
16222
16226
|
is_success: !1,
|
|
16223
16227
|
session_id: this._pushSessionId,
|
|
16224
16228
|
reason: ur.PushCheck,
|
|
@@ -16228,7 +16232,7 @@ class dS extends Su {
|
|
|
16228
16232
|
this.start(), this._pushUrl = Hu({ pushUrl: e, disableTCC: !0 }), this._pushEncodeConfig = t.cfg;
|
|
16229
16233
|
const n = this._composedStream.videoTrack, i = this._composedStream.audioTrack;
|
|
16230
16234
|
if (this._needCheckAudioTrack && (!n || !i)) {
|
|
16231
|
-
|
|
16235
|
+
X(J.START_PUSH_STATUS, {
|
|
16232
16236
|
is_success: !1,
|
|
16233
16237
|
reason: ur.PushCheck,
|
|
16234
16238
|
push_url: this._pushUrl,
|
|
@@ -16242,7 +16246,7 @@ class dS extends Su {
|
|
|
16242
16246
|
});
|
|
16243
16247
|
return;
|
|
16244
16248
|
} else if (!n && !i) {
|
|
16245
|
-
|
|
16249
|
+
X(J.START_PUSH_STATUS, {
|
|
16246
16250
|
is_success: !1,
|
|
16247
16251
|
reason: ur.PushCheck,
|
|
16248
16252
|
push_url: this._pushUrl,
|
|
@@ -16290,14 +16294,14 @@ class dS extends Su {
|
|
|
16290
16294
|
this._streamConsumeController.emit(
|
|
16291
16295
|
Ce.PushError,
|
|
16292
16296
|
u
|
|
16293
|
-
),
|
|
16297
|
+
), X(J.STOP_PUSH_STREAM, {
|
|
16294
16298
|
reason: xr.PushError,
|
|
16295
16299
|
error_message: u.message,
|
|
16296
16300
|
enable_reconnect: !1,
|
|
16297
16301
|
push_mode: this._pushMode,
|
|
16298
16302
|
session_id: this._pushSessionId,
|
|
16299
16303
|
duration: this.pushDuration
|
|
16300
|
-
}),
|
|
16304
|
+
}), X(J.START_PUSH_STATUS, {
|
|
16301
16305
|
is_success: !1,
|
|
16302
16306
|
push_url: this._pushUrl,
|
|
16303
16307
|
reason: ur.PushError,
|
|
@@ -16324,8 +16328,8 @@ class dS extends Su {
|
|
|
16324
16328
|
idealBitrate: this._videoBitrate
|
|
16325
16329
|
}
|
|
16326
16330
|
) : Iv(d), g = this.pushMode === "rtm" ? (o = this._connect) == null ? void 0 : o.videoSenderTrackStats : {};
|
|
16327
|
-
|
|
16328
|
-
|
|
16331
|
+
X(
|
|
16332
|
+
J.PUSH_STATS,
|
|
16329
16333
|
{
|
|
16330
16334
|
...h,
|
|
16331
16335
|
...g,
|
|
@@ -16341,8 +16345,8 @@ class dS extends Su {
|
|
|
16341
16345
|
!0
|
|
16342
16346
|
);
|
|
16343
16347
|
} else
|
|
16344
|
-
await gn(2e3),
|
|
16345
|
-
|
|
16348
|
+
await gn(2e3), X(
|
|
16349
|
+
J.PUSH_STATS,
|
|
16346
16350
|
{
|
|
16347
16351
|
push_url: this._pushUrl,
|
|
16348
16352
|
push_mode: this._pushMode,
|
|
@@ -16397,7 +16401,7 @@ class dS extends Su {
|
|
|
16397
16401
|
isManual: !1
|
|
16398
16402
|
}) {
|
|
16399
16403
|
var t, n, i, o, a;
|
|
16400
|
-
e.isReconnecting && this.pushMode === "mediaEngine" || ((t = this._connect) == null || t.unpublish(), this._connect = null), this._prevStats = void 0, e.isManual && (
|
|
16404
|
+
e.isReconnecting && this.pushMode === "mediaEngine" || ((t = this._connect) == null || t.unpublish(), this._connect = null), this._prevStats = void 0, e.isManual && (X(J.STOP_PUSH_STREAM, {
|
|
16401
16405
|
reason: xr.ManualStop,
|
|
16402
16406
|
duration: this.pushDuration,
|
|
16403
16407
|
session_id: this._streamConsumeController.pushSessionId,
|
|
@@ -16444,7 +16448,7 @@ class dS extends Su {
|
|
|
16444
16448
|
params: t,
|
|
16445
16449
|
teaParams: n
|
|
16446
16450
|
}) {
|
|
16447
|
-
|
|
16451
|
+
X(J.PUSH_RECONNECT_STATUS, {
|
|
16448
16452
|
status: e,
|
|
16449
16453
|
...t,
|
|
16450
16454
|
...n
|
|
@@ -18060,7 +18064,7 @@ function xn(r, e) {
|
|
|
18060
18064
|
return arguments[0] ? (e.browser === "chrome" && e.version < 78 || e.browser === "firefox" && e.version < 68 || e.browser === "safari") && arguments[0] && arguments[0].candidate === "" ? Promise.resolve() : t.apply(this, arguments) : (arguments[1] && arguments[1].apply(null), Promise.resolve());
|
|
18061
18065
|
});
|
|
18062
18066
|
}
|
|
18063
|
-
function
|
|
18067
|
+
function On(r, e) {
|
|
18064
18068
|
if (!(r.RTCPeerConnection && r.RTCPeerConnection.prototype))
|
|
18065
18069
|
return;
|
|
18066
18070
|
const t = r.RTCPeerConnection.prototype.setLocalDescription;
|
|
@@ -18088,7 +18092,7 @@ const SS = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
18088
18092
|
shimAddIceCandidateNullOrEmpty: xn,
|
|
18089
18093
|
shimConnectionState: Ro,
|
|
18090
18094
|
shimMaxMessageSize: An,
|
|
18091
|
-
shimParameterlessSetLocalDescription:
|
|
18095
|
+
shimParameterlessSetLocalDescription: On,
|
|
18092
18096
|
shimRTCIceCandidate: Dn,
|
|
18093
18097
|
shimRTCIceCandidateRelayProtocol: zo,
|
|
18094
18098
|
shimSendThrowTypeError: In
|
|
@@ -18113,17 +18117,17 @@ function bS({ window: r } = {}, e = {
|
|
|
18113
18117
|
return t("Chrome shim is not included in this adapter release."), i;
|
|
18114
18118
|
if (n.version === null)
|
|
18115
18119
|
return t("Chrome shim can not determine version, not shimming."), i;
|
|
18116
|
-
t("adapter.js shimming chrome."), i.browserShim = Za, xn(r, n),
|
|
18120
|
+
t("adapter.js shimming chrome."), i.browserShim = Za, xn(r, n), On(r), Ju(r, n), Xu(r), ko(r, n), Zu(r), td(r, n), Yu(r), Qu(r), rd(r, n), Dn(r), zo(r), Ro(r), An(r, n), In(r), Do(r, n);
|
|
18117
18121
|
break;
|
|
18118
18122
|
case "firefox":
|
|
18119
18123
|
if (!Ya || !To || !e.shimFirefox)
|
|
18120
18124
|
return t("Firefox shim is not included in this adapter release."), i;
|
|
18121
|
-
t("adapter.js shimming firefox."), i.browserShim = Ya, xn(r, n),
|
|
18125
|
+
t("adapter.js shimming firefox."), i.browserShim = Ya, xn(r, n), On(r), nd(r, n), To(r, n), id(r), ad(r), od(r), sd(r), cd(r), ud(r), dd(r), ld(r), hd(r), Dn(r), Ro(r), An(r, n), In(r);
|
|
18122
18126
|
break;
|
|
18123
18127
|
case "safari":
|
|
18124
18128
|
if (!Qa || !e.shimSafari)
|
|
18125
18129
|
return t("Safari shim is not included in this adapter release."), i;
|
|
18126
|
-
t("adapter.js shimming safari."), i.browserShim = Qa, xn(r, n),
|
|
18130
|
+
t("adapter.js shimming safari."), i.browserShim = Qa, xn(r, n), On(r), vd(r), Sd(r), md(r), fd(r), pd(r), yd(r), gd(r), bd(r), Dn(r), zo(r), An(r, n), In(r), Do(r, n);
|
|
18127
18131
|
break;
|
|
18128
18132
|
default:
|
|
18129
18133
|
t("Unsupported browser!");
|
|
@@ -18213,7 +18217,7 @@ class zS extends Bt {
|
|
|
18213
18217
|
customer_app_name: ((u = e == null ? void 0 : e.loggerConfig) == null ? void 0 : u.appName) ?? "unknown",
|
|
18214
18218
|
customer_app_id: ((f = e == null ? void 0 : e.loggerConfig) == null ? void 0 : f.appId) ?? 0
|
|
18215
18219
|
}
|
|
18216
|
-
),
|
|
18220
|
+
), X(J.PUSHER_INIT, {
|
|
18217
18221
|
options: e,
|
|
18218
18222
|
...ES()
|
|
18219
18223
|
}), cv();
|
|
@@ -18664,7 +18668,7 @@ class zS extends Bt {
|
|
|
18664
18668
|
* - You can call [`setMixingConfig()`](#livepusher-setmixingconfig) both before and after enabling local mixing to configure canvas parameters (e.g., width, height, frame rate), ensuring the merged output meets your requirements.
|
|
18665
18669
|
*/
|
|
18666
18670
|
enableMixing(e) {
|
|
18667
|
-
if (
|
|
18671
|
+
if (X(J.SWITCH_ENABLE_MIXING, {
|
|
18668
18672
|
enable: e,
|
|
18669
18673
|
is_pushing: this.isPushing()
|
|
18670
18674
|
}), this.isPushing())
|
|
@@ -18680,7 +18684,7 @@ class zS extends Bt {
|
|
|
18680
18684
|
* @param config Attributes of the mixing canvas, such as width, height, frame rate, etc.
|
|
18681
18685
|
*/
|
|
18682
18686
|
setMixingConfig(e) {
|
|
18683
|
-
|
|
18687
|
+
X(J.SET_MIXING_CONFIG, e), this._streamComposeController.setMixingConfig(e);
|
|
18684
18688
|
}
|
|
18685
18689
|
/** {zh}
|
|
18686
18690
|
* @brief 获取配置的合流参数,包括合流画布的宽度、高度、帧率等。
|
|
@@ -18746,7 +18750,7 @@ class zS extends Bt {
|
|
|
18746
18750
|
try {
|
|
18747
18751
|
await this._streamComposeController.resumeMixer();
|
|
18748
18752
|
} catch (t) {
|
|
18749
|
-
if (
|
|
18753
|
+
if (X(J.PUSH_AUDIO_CONTEXT_START_FAILED, {
|
|
18750
18754
|
error: t
|
|
18751
18755
|
}), this._options.checkAudio)
|
|
18752
18756
|
throw new lr(
|
|
@@ -18769,7 +18773,7 @@ class zS extends Bt {
|
|
|
18769
18773
|
* @param config The video stream layout parameters can be a single object or an array of multiple objects.
|
|
18770
18774
|
*/
|
|
18771
18775
|
addVideoStream(e) {
|
|
18772
|
-
|
|
18776
|
+
X(J.ADD_VIDEO_STREAM, {
|
|
18773
18777
|
number: ze(e) ? e.length : 1,
|
|
18774
18778
|
// 视频流数量
|
|
18775
18779
|
config: e
|
|
@@ -18787,7 +18791,7 @@ class zS extends Bt {
|
|
|
18787
18791
|
* @param streamId The video stream ID to be removed
|
|
18788
18792
|
*/
|
|
18789
18793
|
removeVideoStream(e) {
|
|
18790
|
-
|
|
18794
|
+
X(J.DELETE_VIDEO_STREAM, { stream_id: e }), this._streamComposeController.removeVideoStream(e);
|
|
18791
18795
|
}
|
|
18792
18796
|
/** {zh}
|
|
18793
18797
|
* @brief 更新已添加的视频流的布局参数,例如位置、大小等,适用于动态布局调整等场景。
|
|
@@ -18799,7 +18803,7 @@ class zS extends Bt {
|
|
|
18799
18803
|
* @param config Update the video stream parameters. When an array is passed, multiple video streams are updated.
|
|
18800
18804
|
*/
|
|
18801
18805
|
updateVideoStream(e) {
|
|
18802
|
-
|
|
18806
|
+
X(J.UPDATE_VIDEO_STREAM, {
|
|
18803
18807
|
number: ze(e) ? e.length : 1,
|
|
18804
18808
|
// 视频流数量
|
|
18805
18809
|
config: e
|
|
@@ -18815,7 +18819,7 @@ class zS extends Bt {
|
|
|
18815
18819
|
* @param streamId The ID of the video stream to hide. If omitted, all video streams will be hidden.
|
|
18816
18820
|
*/
|
|
18817
18821
|
muteVideoStream(e) {
|
|
18818
|
-
|
|
18822
|
+
X(J.CHANGE_VIDEO_STREAM_MUTE, {
|
|
18819
18823
|
stream_id: e,
|
|
18820
18824
|
mute: !1
|
|
18821
18825
|
}), this._streamComposeController.muteVideoStream(e);
|
|
@@ -18830,7 +18834,7 @@ class zS extends Bt {
|
|
|
18830
18834
|
* @param streamId To unhide video stream id; if not provided, unhide all video streams.
|
|
18831
18835
|
*/
|
|
18832
18836
|
unmuteVideoStream(e) {
|
|
18833
|
-
|
|
18837
|
+
X(J.CHANGE_VIDEO_STREAM_MUTE, {
|
|
18834
18838
|
stream_id: e,
|
|
18835
18839
|
mute: !0
|
|
18836
18840
|
}), this._streamComposeController.unmuteVideoStream(e);
|
|
@@ -18847,7 +18851,7 @@ class zS extends Bt {
|
|
|
18847
18851
|
* @param config Audio stream parameters can be a single object or an array of multiple objects.
|
|
18848
18852
|
*/
|
|
18849
18853
|
addAudioStream(e) {
|
|
18850
|
-
|
|
18854
|
+
X(J.ADD_AUDIO_STREAM, {
|
|
18851
18855
|
number: ze(e) ? e.length : 1,
|
|
18852
18856
|
// 音频流数量
|
|
18853
18857
|
config: e
|
|
@@ -18865,7 +18869,7 @@ class zS extends Bt {
|
|
|
18865
18869
|
* @param streamId The stream ID to be removed. If omitted, all audio streams will be removed.
|
|
18866
18870
|
*/
|
|
18867
18871
|
removeAudioStream(e) {
|
|
18868
|
-
|
|
18872
|
+
X(J.DELETE_AUDIO_STREAM, { stream_id: e }), this._streamComposeController.removeAudioStream(e);
|
|
18869
18873
|
}
|
|
18870
18874
|
/** {zh}
|
|
18871
18875
|
* @brief 更新音频流的音量大小。在混音场景中调整某个或多个音频流的音量,例如,主播语音、背景音乐和视频音频的平衡调整。
|
|
@@ -18885,7 +18889,7 @@ class zS extends Bt {
|
|
|
18885
18889
|
* - Call `updateAudioStream()` to update the parameters of the audio stream.
|
|
18886
18890
|
*/
|
|
18887
18891
|
updateAudioStream(e) {
|
|
18888
|
-
|
|
18892
|
+
X(J.UPDATE_AUDIO_STREAM, {
|
|
18889
18893
|
number: ze(e) ? e.length : 1,
|
|
18890
18894
|
// 音频流数量
|
|
18891
18895
|
config: e
|
|
@@ -18903,7 +18907,7 @@ class zS extends Bt {
|
|
|
18903
18907
|
* @notes Mute the specified audio stream. If the target is an individual audio stream, mute it directly. If the target is a video stream containing an audio track, it will only affect the audio part of the video stream without impacting the video footage.
|
|
18904
18908
|
*/
|
|
18905
18909
|
muteAudioStream(e) {
|
|
18906
|
-
|
|
18910
|
+
X(J.CHANGE_AUDIO_STREAM_MUTE, {
|
|
18907
18911
|
stream_id: e,
|
|
18908
18912
|
mute: !0
|
|
18909
18913
|
}), this._streamComposeController.muteAudioStream(e);
|
|
@@ -18918,7 +18922,7 @@ class zS extends Bt {
|
|
|
18918
18922
|
* @param streamId The stream ID to unmute. If omitted, all streams will be unmuted.
|
|
18919
18923
|
*/
|
|
18920
18924
|
unmuteAudioStream(e) {
|
|
18921
|
-
|
|
18925
|
+
X(J.CHANGE_AUDIO_STREAM_MUTE, {
|
|
18922
18926
|
stream_id: e,
|
|
18923
18927
|
mute: !1
|
|
18924
18928
|
}), this._streamComposeController.unmuteAudioStream(e);
|
|
@@ -18938,7 +18942,7 @@ class zS extends Bt {
|
|
|
18938
18942
|
* @param value Fill in the value of the corresponding attribute according to the type of `key`.
|
|
18939
18943
|
*/
|
|
18940
18944
|
setProperty(e, t) {
|
|
18941
|
-
switch (
|
|
18945
|
+
switch (X(J.SET_PROPERTY_CALL, {
|
|
18942
18946
|
key: e,
|
|
18943
18947
|
value: t
|
|
18944
18948
|
}), e) {
|
|
@@ -19011,7 +19015,7 @@ class zS extends Bt {
|
|
|
19011
19015
|
* @param quality Video Quality, see [VIDEO_DEFAULT_QUALITY](docs-configuration#video_default_quality)
|
|
19012
19016
|
*/
|
|
19013
19017
|
setVideoQuality(e) {
|
|
19014
|
-
if (
|
|
19018
|
+
if (X(J.SET_VIDEO_QUALITY, {
|
|
19015
19019
|
quality: e
|
|
19016
19020
|
}), this._streamConsumeController.pushMode === "webTransport" && ["120p", "180p", "240p"].indexOf(e) !== -1)
|
|
19017
19021
|
throw new Error("quality not allowed lower than 360p on rtmp mode");
|
|
@@ -19046,7 +19050,7 @@ class zS extends Bt {
|
|
|
19046
19050
|
* - `HIGH`: High audio quality (high bitrate), suitable for music streaming and high-quality scenarios.
|
|
19047
19051
|
*/
|
|
19048
19052
|
setAudioQuality(e) {
|
|
19049
|
-
|
|
19053
|
+
X(J.SET_AUDIO_QUALITY, {
|
|
19050
19054
|
quality: e
|
|
19051
19055
|
});
|
|
19052
19056
|
const { sampleRate: t, bitrate: n } = _r(e, "audio");
|
|
@@ -19090,8 +19094,10 @@ class zS extends Bt {
|
|
|
19090
19094
|
* - ** Success**: No return value.
|
|
19091
19095
|
* - ** Failure**: Returns an error message.
|
|
19092
19096
|
*/
|
|
19093
|
-
stopPush() {
|
|
19094
|
-
return
|
|
19097
|
+
stopPush(e) {
|
|
19098
|
+
return X(J.STOP_PUSH_STREAM_API_CALL, {
|
|
19099
|
+
reason: e
|
|
19100
|
+
}), this._streamConsumeController.stopPush();
|
|
19095
19101
|
}
|
|
19096
19102
|
/** {zh}
|
|
19097
19103
|
* @brief 判断当前是否正在推流。
|
|
@@ -19213,8 +19219,10 @@ class zS extends Bt {
|
|
|
19213
19219
|
* - ** Success**: no return value.
|
|
19214
19220
|
* - ** Failure**: returns an error message.
|
|
19215
19221
|
*/
|
|
19216
|
-
async destroy() {
|
|
19217
|
-
|
|
19222
|
+
async destroy(e) {
|
|
19223
|
+
X(J.PUSHER_DESTROY, {
|
|
19224
|
+
reason: e
|
|
19225
|
+
}), await this._streamConsumeController.destroy(), this._streamManagerController.destroy(), uv();
|
|
19218
19226
|
}
|
|
19219
19227
|
/** {zh}
|
|
19220
19228
|
* @default ???
|