quickvo-player 0.3.8 → 0.3.9

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.js CHANGED
@@ -237,7 +237,7 @@ function de(e, t) {
237
237
  function h(e) {
238
238
  return typeof e == "object" && !!e && !Array.isArray(e);
239
239
  }
240
- function fe(e, t) {
240
+ function g(e, t) {
241
241
  if (h(e) && p in e && "add" in e && "field" in e && typeof e.field == "function") {
242
242
  if (t !== void 0) {
243
243
  let n = t, r = e.field();
@@ -247,7 +247,7 @@ function fe(e, t) {
247
247
  }
248
248
  return !1;
249
249
  }
250
- function pe(e, t) {
250
+ function fe(e, t) {
251
251
  if (h(e) && p in e && "has" in e && "field" in e && typeof e.field == "function") {
252
252
  if (t !== void 0) {
253
253
  let n = t, r = e.field();
@@ -257,19 +257,19 @@ function pe(e, t) {
257
257
  }
258
258
  return !1;
259
259
  }
260
- function me(e, t) {
260
+ function _(e, t) {
261
261
  return h(e) && p in e && "desc" in e && h(e.desc) && e.desc.kind === "message" && (t === void 0 || e.desc.typeName == t.typeName);
262
262
  }
263
263
  //#endregion
264
264
  //#region node_modules/@bufbuild/protobuf/dist/esm/wkt/wrappers.js
265
- function he(e) {
266
- return _e(e.$typeName);
265
+ function pe(e) {
266
+ return he(e.$typeName);
267
267
  }
268
- function ge(e) {
268
+ function me(e) {
269
269
  let t = e.fields[0];
270
- return _e(e.typeName) && t !== void 0 && t.fieldKind == "scalar" && t.name == "value" && t.number == 1;
270
+ return he(e.typeName) && t !== void 0 && t.fieldKind == "scalar" && t.name == "value" && t.number == 1;
271
271
  }
272
- function _e(e) {
272
+ function he(e) {
273
273
  return e.startsWith("google.protobuf.") && [
274
274
  "DoubleValue",
275
275
  "FloatValue",
@@ -284,13 +284,13 @@ function _e(e) {
284
284
  }
285
285
  //#endregion
286
286
  //#region node_modules/@bufbuild/protobuf/dist/esm/create.js
287
- var ve = 999, ye = 998, g = 2;
288
- function be(t, n) {
287
+ var ge = 999, _e = 998, v = 2;
288
+ function ve(t, n) {
289
289
  if (e(n, t)) return n;
290
- let r = Oe(t);
291
- return n !== void 0 && xe(t, r, n), r;
290
+ let r = Ee(t);
291
+ return n !== void 0 && ye(t, r, n), r;
292
292
  }
293
- function xe(e, t, n) {
293
+ function ye(e, t, n) {
294
294
  for (let r of e.members) {
295
295
  let e = n[r.localName];
296
296
  if (e == null) continue;
@@ -302,103 +302,103 @@ function xe(e, t, n) {
302
302
  } else i = r;
303
303
  switch (i.fieldKind) {
304
304
  case "message":
305
- e = _(i, e);
305
+ e = y(i, e);
306
306
  break;
307
307
  case "scalar":
308
- e = Se(i, e);
308
+ e = be(i, e);
309
309
  break;
310
310
  case "list":
311
- e = we(i, e);
311
+ e = Se(i, e);
312
312
  break;
313
313
  case "map":
314
- e = Ce(i, e);
314
+ e = xe(i, e);
315
315
  break;
316
316
  }
317
317
  ue(t, i, e);
318
318
  }
319
319
  return t;
320
320
  }
321
- function Se(e, n) {
322
- return e.scalar == t.BYTES ? v(n) : n;
321
+ function be(e, n) {
322
+ return e.scalar == t.BYTES ? b(n) : n;
323
323
  }
324
- function Ce(e, n) {
324
+ function xe(e, n) {
325
325
  if (h(n)) {
326
- if (e.scalar == t.BYTES) return Te(n, v);
327
- if (e.mapKind == "message") return Te(n, (t) => _(e, t));
326
+ if (e.scalar == t.BYTES) return Ce(n, b);
327
+ if (e.mapKind == "message") return Ce(n, (t) => y(e, t));
328
328
  }
329
329
  return n;
330
330
  }
331
- function we(e, n) {
331
+ function Se(e, n) {
332
332
  if (Array.isArray(n)) {
333
- if (e.scalar == t.BYTES) return n.map(v);
334
- if (e.listKind == "message") return n.map((t) => _(e, t));
333
+ if (e.scalar == t.BYTES) return n.map(b);
334
+ if (e.listKind == "message") return n.map((t) => y(e, t));
335
335
  }
336
336
  return n;
337
337
  }
338
- function _(t, n) {
339
- if (t.fieldKind == "message" && !t.oneof && ge(t.message)) return Se(t.message.fields[0], n);
338
+ function y(t, n) {
339
+ if (t.fieldKind == "message" && !t.oneof && me(t.message)) return be(t.message.fields[0], n);
340
340
  if (h(n)) {
341
341
  if (t.message.typeName == "google.protobuf.Struct" && t.parent.typeName !== "google.protobuf.Value") return n;
342
- if (!e(n, t.message)) return be(t.message, n);
342
+ if (!e(n, t.message)) return ve(t.message, n);
343
343
  }
344
344
  return n;
345
345
  }
346
- function v(e) {
346
+ function b(e) {
347
347
  return Array.isArray(e) ? new Uint8Array(e) : e;
348
348
  }
349
- function Te(e, t) {
349
+ function Ce(e, t) {
350
350
  let n = {};
351
351
  for (let r of Object.entries(e)) n[r[0]] = t(r[1]);
352
352
  return n;
353
353
  }
354
- var Ee = Symbol(), De = /* @__PURE__ */ new WeakMap();
355
- function Oe(e) {
354
+ var we = Symbol(), Te = /* @__PURE__ */ new WeakMap();
355
+ function Ee(e) {
356
356
  let t;
357
- if (ke(e)) {
358
- let n = De.get(e), r, i;
357
+ if (De(e)) {
358
+ let n = Te.get(e), r, i;
359
359
  if (n) ({prototype: r, members: i} = n);
360
360
  else {
361
361
  r = {}, i = /* @__PURE__ */ new Set();
362
- for (let t of e.members) t.kind != "oneof" && (t.fieldKind != "scalar" && t.fieldKind != "enum" || t.presence != g && (i.add(t), r[t.localName] = y(t)));
363
- De.set(e, {
362
+ for (let t of e.members) t.kind != "oneof" && (t.fieldKind != "scalar" && t.fieldKind != "enum" || t.presence != v && (i.add(t), r[t.localName] = x(t)));
363
+ Te.set(e, {
364
364
  prototype: r,
365
365
  members: i
366
366
  });
367
367
  }
368
368
  t = Object.create(r), t.$typeName = e.typeName;
369
- for (let n of e.members) i.has(n) || n.kind == "field" && (n.fieldKind == "message" || (n.fieldKind == "scalar" || n.fieldKind == "enum") && n.presence != g) || (t[n.localName] = y(n));
369
+ for (let n of e.members) i.has(n) || n.kind == "field" && (n.fieldKind == "message" || (n.fieldKind == "scalar" || n.fieldKind == "enum") && n.presence != v) || (t[n.localName] = x(n));
370
370
  } else {
371
371
  t = { $typeName: e.typeName };
372
- for (let n of e.members) (n.kind == "oneof" || n.presence == g) && (t[n.localName] = y(n));
372
+ for (let n of e.members) (n.kind == "oneof" || n.presence == v) && (t[n.localName] = x(n));
373
373
  }
374
374
  return t;
375
375
  }
376
- function ke(e) {
376
+ function De(e) {
377
377
  switch (e.file.edition) {
378
- case ve: return !1;
379
- case ye: return !0;
380
- default: return e.fields.some((e) => e.presence != g && e.fieldKind != "message" && !e.oneof);
378
+ case ge: return !1;
379
+ case _e: return !0;
380
+ default: return e.fields.some((e) => e.presence != v && e.fieldKind != "message" && !e.oneof);
381
381
  }
382
382
  }
383
- function y(e) {
383
+ function x(e) {
384
384
  if (e.kind == "oneof") return { case: void 0 };
385
385
  if (e.fieldKind == "list") return [];
386
386
  if (e.fieldKind == "map") return {};
387
- if (e.fieldKind == "message") return Ee;
387
+ if (e.fieldKind == "message") return we;
388
388
  let t = e.getDefaultValue();
389
389
  return t === void 0 ? e.fieldKind == "scalar" ? f(e.scalar, e.longAsString) : e.enum.values[0].number : e.fieldKind == "scalar" && e.longAsString ? t.toString() : t;
390
390
  }
391
391
  //#endregion
392
392
  //#region node_modules/@bufbuild/protobuf/dist/esm/reflect/error.js
393
- var b = class extends Error {
393
+ var S = class extends Error {
394
394
  constructor(e, t, n = "FieldValueInvalidError") {
395
395
  super(t), this.name = n, this.field = () => e;
396
396
  }
397
- }, x = Symbol.for("@bufbuild/protobuf/text-encoding");
398
- function Ae() {
399
- if (globalThis[x] == null) {
397
+ }, Oe = Symbol.for("@bufbuild/protobuf/text-encoding");
398
+ function ke() {
399
+ if (globalThis[Oe] == null) {
400
400
  let e = new globalThis.TextEncoder(), t = new globalThis.TextDecoder();
401
- globalThis[x] = {
401
+ globalThis[Oe] = {
402
402
  encodeUtf8(t) {
403
403
  return e.encode(t);
404
404
  },
@@ -414,16 +414,16 @@ function Ae() {
414
414
  }
415
415
  };
416
416
  }
417
- return globalThis[x];
417
+ return globalThis[Oe];
418
418
  }
419
419
  //#endregion
420
420
  //#region node_modules/@bufbuild/protobuf/dist/esm/wire/binary-encoding.js
421
- var S;
421
+ var C;
422
422
  (function(e) {
423
423
  e[e.Varint = 0] = "Varint", e[e.Bit64 = 1] = "Bit64", e[e.LengthDelimited = 2] = "LengthDelimited", e[e.StartGroup = 3] = "StartGroup", e[e.EndGroup = 4] = "EndGroup", e[e.Bit32 = 5] = "Bit32";
424
- })(S ||= {});
425
- var je = class {
426
- constructor(e, t = Ae().decodeUtf8) {
424
+ })(C ||= {});
425
+ var Ae = class {
426
+ constructor(e, t = ke().decodeUtf8) {
427
427
  this.decodeUtf8 = t, this.varint64 = n, this.uint32 = te, this.buf = e, this.len = e.length, this.pos = 0, this.view = new DataView(e.buffer, e.byteOffset, e.byteLength);
428
428
  }
429
429
  tag() {
@@ -434,21 +434,21 @@ var je = class {
434
434
  skip(e, t) {
435
435
  let n = this.pos;
436
436
  switch (e) {
437
- case S.Varint:
437
+ case C.Varint:
438
438
  for (; this.buf[this.pos++] & 128;);
439
439
  break;
440
- case S.Bit64: this.pos += 4;
441
- case S.Bit32:
440
+ case C.Bit64: this.pos += 4;
441
+ case C.Bit32:
442
442
  this.pos += 4;
443
443
  break;
444
- case S.LengthDelimited:
444
+ case C.LengthDelimited:
445
445
  let n = this.uint32();
446
446
  this.pos += n;
447
447
  break;
448
- case S.StartGroup:
448
+ case C.StartGroup:
449
449
  for (;;) {
450
450
  let [e, n] = this.tag();
451
- if (n === S.EndGroup) {
451
+ if (n === C.EndGroup) {
452
452
  if (t !== void 0 && e !== t) throw Error("invalid end group tag");
453
453
  break;
454
454
  }
@@ -511,8 +511,8 @@ var je = class {
511
511
  };
512
512
  //#endregion
513
513
  //#region node_modules/@bufbuild/protobuf/dist/esm/reflect/reflect-check.js
514
- function Me(e, t) {
515
- let n = e.fieldKind == "list" ? fe(t, e) : e.fieldKind == "map" ? pe(t, e) : C(e, t);
514
+ function je(e, t) {
515
+ let n = e.fieldKind == "list" ? g(t, e) : e.fieldKind == "map" ? fe(t, e) : Pe(e, t);
516
516
  if (n === !0) return;
517
517
  let r;
518
518
  switch (e.fieldKind) {
@@ -524,20 +524,20 @@ function Me(e, t) {
524
524
  break;
525
525
  default: r = w(e, t, n);
526
526
  }
527
- return new b(e, r);
527
+ return new S(e, r);
528
528
  }
529
- function Ne(e, t, n) {
530
- let r = C(e, n);
531
- if (r !== !0) return new b(e, `list item #${t + 1}: ${w(e, n, r)}`);
529
+ function Me(e, t, n) {
530
+ let r = Pe(e, n);
531
+ if (r !== !0) return new S(e, `list item #${t + 1}: ${w(e, n, r)}`);
532
532
  }
533
- function Pe(e, t, n) {
533
+ function Ne(e, t, n) {
534
534
  let r = Fe(t, e.mapKey);
535
- if (r !== !0) return new b(e, `invalid map key: ${w({ scalar: e.mapKey }, t, r)}`);
536
- let i = C(e, n);
537
- if (i !== !0) return new b(e, `map entry ${T(t)}: ${w(e, n, i)}`);
535
+ if (r !== !0) return new S(e, `invalid map key: ${w({ scalar: e.mapKey }, t, r)}`);
536
+ let i = Pe(e, n);
537
+ if (i !== !0) return new S(e, `map entry ${T(t)}: ${w(e, n, i)}`);
538
538
  }
539
- function C(e, t) {
540
- return e.scalar === void 0 ? e.enum === void 0 ? me(t, e.message) : e.enum.open ? Number.isInteger(t) : e.enum.values.some((e) => e.number === t) : Fe(t, e.scalar);
539
+ function Pe(e, t) {
540
+ return e.scalar === void 0 ? e.enum === void 0 ? _(t, e.message) : e.enum.open ? Number.isInteger(t) : e.enum.values.some((e) => e.number === t) : Fe(t, e.scalar);
541
541
  }
542
542
  function Fe(e, n) {
543
543
  switch (n) {
@@ -549,7 +549,7 @@ function Fe(e, n) {
549
549
  case t.FIXED32:
550
550
  case t.UINT32: return typeof e != "number" || !Number.isInteger(e) ? !1 : e > 4294967295 || e < 0 ? `${e.toFixed()} out of range` : !0;
551
551
  case t.BOOL: return typeof e == "boolean";
552
- case t.STRING: return typeof e == "string" ? Ae().checkUtf8(e) || "invalid UTF8" : !1;
552
+ case t.STRING: return typeof e == "string" ? ke().checkUtf8(e) || "invalid UTF8" : !1;
553
553
  case t.BYTES: return e instanceof Uint8Array;
554
554
  case t.INT64:
555
555
  case t.SFIXED64:
@@ -575,7 +575,7 @@ function w(e, t, n) {
575
575
  }
576
576
  function T(t) {
577
577
  switch (typeof t) {
578
- case "object": return t === null ? "null" : t instanceof Uint8Array ? `Uint8Array(${t.length})` : Array.isArray(t) ? `Array(${t.length})` : fe(t) ? Le(t.field()) : pe(t) ? Re(t.field()) : me(t) ? Ie(t.desc) : e(t) ? `message ${t.$typeName}` : "object";
578
+ case "object": return t === null ? "null" : t instanceof Uint8Array ? `Uint8Array(${t.length})` : Array.isArray(t) ? `Array(${t.length})` : g(t) ? Le(t.field()) : fe(t) ? Re(t.field()) : _(t) ? Ie(t.desc) : e(t) ? `message ${t.$typeName}` : "object";
579
579
  case "string": return t.length > 30 ? "string" : `"${t.split("\"").join("\\\"")}"`;
580
580
  case "boolean": return String(t);
581
581
  case "number": return String(t);
@@ -632,7 +632,7 @@ var Be = /* @__PURE__ */ new WeakMap(), Ve = class {
632
632
  return Be.set(this.desc, t), t;
633
633
  }
634
634
  constructor(e, t, n = !0) {
635
- this.lists = /* @__PURE__ */ new Map(), this.maps = /* @__PURE__ */ new Map(), this.check = n, this.desc = e, this.message = this[p] = t ?? be(e), this.fields = e.fields, this.oneofs = e.oneofs, this.members = e.members;
635
+ this.lists = /* @__PURE__ */ new Map(), this.maps = /* @__PURE__ */ new Map(), this.check = n, this.desc = e, this.message = this[p] = t ?? ve(e), this.fields = e.fields, this.oneofs = e.oneofs, this.members = e.members;
636
636
  }
637
637
  findNumber(e) {
638
638
  return this._fieldsByNumber ||= new Map(this.desc.fields.map((e) => [e.number, e])), this._fieldsByNumber.get(e);
@@ -663,11 +663,11 @@ var Be = /* @__PURE__ */ new WeakMap(), Ve = class {
663
663
  }
664
664
  set(e, t) {
665
665
  if (D(this.message, e), this.check) {
666
- let n = Me(e, t);
666
+ let n = je(e, t);
667
667
  if (n) throw n;
668
668
  }
669
669
  let n;
670
- n = e.fieldKind == "message" ? O(e, t) : pe(t) || fe(t) ? t[p] : P(e, t), ue(this.message, e, n);
670
+ n = e.fieldKind == "message" ? O(e, t) : fe(t) || g(t) ? t[p] : P(e, t), ue(this.message, e, n);
671
671
  }
672
672
  getUnknown() {
673
673
  return this.message.$unknown;
@@ -677,7 +677,7 @@ var Be = /* @__PURE__ */ new WeakMap(), Ve = class {
677
677
  }
678
678
  };
679
679
  function D(e, t) {
680
- if (t.parent.typeName !== e.$typeName) throw new b(t, `cannot use ${t.toString()} with message ${e.$typeName}`, "ForeignFieldError");
680
+ if (t.parent.typeName !== e.$typeName) throw new S(t, `cannot use ${t.toString()} with message ${e.$typeName}`, "ForeignFieldError");
681
681
  }
682
682
  var He = class {
683
683
  field() {
@@ -694,16 +694,16 @@ var He = class {
694
694
  return t === void 0 ? void 0 : A(this._field, t, this.check);
695
695
  }
696
696
  set(e, t) {
697
- if (e < 0 || e >= this._arr.length) throw new b(this._field, `list item #${e + 1}: out of range`);
697
+ if (e < 0 || e >= this._arr.length) throw new S(this._field, `list item #${e + 1}: out of range`);
698
698
  if (this.check) {
699
- let n = Ne(this._field, e, t);
699
+ let n = Me(this._field, e, t);
700
700
  if (n) throw n;
701
701
  }
702
702
  this._arr[e] = We(this._field, t);
703
703
  }
704
704
  add(e) {
705
705
  if (this.check) {
706
- let t = Ne(this._field, this._arr.length, e);
706
+ let t = Me(this._field, this._arr.length, e);
707
707
  if (t) throw t;
708
708
  }
709
709
  this._arr.push(We(this._field, e));
@@ -732,7 +732,7 @@ var He = class {
732
732
  }
733
733
  set(e, t) {
734
734
  if (this.check) {
735
- let n = Pe(this._field, e, t);
735
+ let n = Ne(this._field, e, t);
736
736
  if (n) throw n;
737
737
  }
738
738
  return this.obj[M(e)] = Ge(this._field, t), this;
@@ -771,10 +771,10 @@ var He = class {
771
771
  }
772
772
  };
773
773
  function O(e, t) {
774
- return me(t) ? he(t.message) && !e.oneof && e.fieldKind == "message" ? t.message.value : t.desc.typeName == "google.protobuf.Struct" && e.parent.typeName != "google.protobuf.Value" ? Je(t.message) : t.message : t;
774
+ return _(t) ? pe(t.message) && !e.oneof && e.fieldKind == "message" ? t.message.value : t.desc.typeName == "google.protobuf.Struct" && e.parent.typeName != "google.protobuf.Value" ? Je(t.message) : t.message : t;
775
775
  }
776
776
  function k(e, t, n) {
777
- return t !== void 0 && (ge(e.message) && !e.oneof && e.fieldKind == "message" ? t = {
777
+ return t !== void 0 && (me(e.message) && !e.oneof && e.fieldKind == "message" ? t = {
778
778
  $typeName: e.message.typeName,
779
779
  value: N(e.message.fields[0], t)
780
780
  } : e.message.typeName == "google.protobuf.Struct" && e.parent.typeName != "google.protobuf.Value" && h(t) && (t = qe(t))), new Ve(e.message, t, n);
@@ -3723,11 +3723,11 @@ function pn(e) {
3723
3723
  }
3724
3724
  function Q(e, t, n) {
3725
3725
  let r = E(e, void 0, !1);
3726
- return mn(r, new je(t), pn(n), !1, t.byteLength), r.message;
3726
+ return mn(r, new Ae(t), pn(n), !1, t.byteLength), r.message;
3727
3727
  }
3728
3728
  function mn(e, t, n, r, i) {
3729
3729
  let a = r ? t.len : t.pos + i, o, s, c = e.getUnknown() ?? [];
3730
- for (; t.pos < a && ([o, s] = t.tag(), !(r && s == S.EndGroup));) {
3730
+ for (; t.pos < a && ([o, s] = t.tag(), !(r && s == C.EndGroup));) {
3731
3731
  let r = e.findNumber(o);
3732
3732
  if (!r) {
3733
3733
  let e = t.skip(s, o);
@@ -3740,7 +3740,7 @@ function mn(e, t, n, r, i) {
3740
3740
  }
3741
3741
  hn(e, t, r, s, n);
3742
3742
  }
3743
- if (r && (s != S.EndGroup || o !== i)) throw Error("invalid end group tag");
3743
+ if (r && (s != C.EndGroup || o !== i)) throw Error("invalid end group tag");
3744
3744
  c.length > 0 && e.setUnknown(c);
3745
3745
  }
3746
3746
  function hn(e, n, r, i, a) {
@@ -3817,7 +3817,7 @@ function _n(e, n, r, i) {
3817
3817
  return;
3818
3818
  }
3819
3819
  let o = a.scalar ?? t.INT32;
3820
- if (!(n == S.LengthDelimited && o != t.STRING && o != t.BYTES)) {
3820
+ if (!(n == C.LengthDelimited && o != t.STRING && o != t.BYTES)) {
3821
3821
  r.add($(e, o));
3822
3822
  return;
3823
3823
  }
@@ -3855,7 +3855,7 @@ function yn(e, t) {
3855
3855
  }
3856
3856
  //#endregion
3857
3857
  //#region node_modules/pr-player/dist/index.js
3858
- var bn = "(function(){\"use strict\";class P{pendingPayloads=[];payload=new Uint8Array(0);chunks=[];push=t=>{this.pendingPayloads.push(t)};next=(t=0)=>{this.payload=this.payload.slice(t);const s=this.pendingPayloads.shift();if(!s)return!1;const e=new Uint8Array(this.payload.byteLength+s.byteLength);return e.set(this.payload,0),e.set(s,this.payload.byteLength),this.payload=e,new DataView(this.payload.buffer)};pushChunk=t=>{this.chunks.push(t),this.chunks.length>100&&this.chunks.shift()};destroy=()=>{this.pendingPayloads=[],this.payload=new Uint8Array(0),this.chunks=[]}}const I=(y,t)=>{const s=new Uint8Array(y),e=new Uint8Array(t),n=new Uint8Array(11+s.length+e.length);let a=0;return n[a++]=1,n[a++]=s[1],n[a++]=s[2],n[a++]=s[3],n[a++]=255,n[a++]=225,n[a++]=s.length>>8&255,n[a++]=s.length&255,n.set(s,a),a+=s.length,n[a++]=1,n[a++]=e.length>>8&255,n[a++]=e.length&255,n.set(e,a),n},T=y=>{let t=0;const s=new DataView(y.buffer),e=s.getUint8(t);if(t=t+1,e!==1)throw new Error(\"Invalid AVC version\");const n=s.getUint8(t)&255;t=t+1;const a=s.getUint8(t)&255;t=t+1;const o=s.getUint8(t)&255;t=t+1;const c=`avc1.${Array.from([n,a,o],U=>U.toString(16).padStart(2,\"0\")).join(\"\")}`,r=(s.getUint8(t)&3)-1;t=t+1;const g=s.getUint8(t)&31;t=t+1;const p=s.getUint16(t,!1);t=t+2;const h=new Uint8Array(s.buffer.slice(t,t+p));t=t+p;const d=s.getUint8(t)&31;t=t+1;const u=s.getUint16(t,!1);t=t+2;const f=new Uint8Array(s.buffer.slice(t,t+u));return t=t+u,{version:e,codec:c,profile:n,compatibility:a,level:o,lengthSizeMinusOne:r,numOfSequenceParameterSets:g,sequenceParameterSetLength:p,sps:h,numOfPictureParameterSets:d,pictureParameterSetLength:u,pps:f}},M=y=>{const t=new Uint8Array(4+y.length);return new DataView(t.buffer).setUint32(0,y.length,!1),t.set(y,4),t},C=y=>{let t=0;for(const n of y)t+=n.length;const s=new Uint8Array(t);let e=0;for(const n of y){const a=n;s.set(a,e),e+=a.length}return s},D=y=>{let t=\"unknown\";switch(y){case 1:case 2:case 27:case 36:t=\"video\";break;case 3:case 4:case 15:t=\"audio\";break;case 6:t=\"subtitle\";break;case 134:t=\"ad\";break}return t};class x{pat;pmt;audioConfig;videoConfig;payloadMap=new Map;on={};constructor(){}parse=async t=>{let s=0;for(;!(s+188>t.byteLength);){if(t.getInt8(s)!=71){s++;continue}await this.parsePacket(t,s),s+=188}return s};parsePacket=async(t,s)=>{if(s+188>t.byteLength)throw new Error(\"Invalid TS packet\");if(t.getUint8(s)!==71)throw new Error(\"Invalid TS packet\");let e=s;const n=this.parseHeader(t,e);e+=4;const{transport_error_indicator:a,pid:o,payload_unit_start_indicator:l,adaptation_field_control:i}=n;if(a===1||o===void 0)return;let c=184;if(i===2||i===3){const r=t.getUint8(e);e+=1,this.parseAdaptationField(t,e),e+=r,c-=r}if(i===3&&(c-=1),i===1||i===3){const r=new Uint8Array(t.buffer.slice(e,e+c));if(o===0)return this.parsePAT(t,e);{const{programs:h=[]}=this.pat||{};if(h.find(u=>u.pmt_pid===o))return this.parsePMT(t,e)}const{streams:g=[]}=this.pmt||{},p=g.find(h=>h.elementary_pid===o);if(p){if(l===1){const h=this.payloadMap.get(o);if(h){switch(p.kind){case\"audio\":{const d=await this.parseAudio(h);this.on.chunk&&this.on.chunk(d)}break;case\"video\":{const d=await this.parseVideo(h);this.on.chunk&&this.on.chunk(d),await new Promise(u=>setTimeout(()=>u(!0),0))}break}this.payloadMap.delete(o)}}{this.payloadMap.has(o)||this.payloadMap.set(o,new Uint8Array);const h=this.payloadMap.get(o),d=new Uint8Array(h.byteLength+r.byteLength);d.set(h,0),d.set(r,h.byteLength),this.payloadMap.set(o,d)}}}};parseHeader=(t,s)=>{let e=s;const n=t.getUint8(e),a=t.getUint8(e+1),o=t.getUint8(e+2),l=t.getUint8(e+3),i=(a&128)>>7;if(i===1)return{sync_byte:n,transport_error_indicator:i};const c=(a&64)>>6,r=(a&32)>>5,g=(a&31)<<8|o,p=(l&192)>>6,h=l>>4&3,d=l&15;return{sync_byte:n,transport_error_indicator:i,payload_unit_start_indicator:c,transport_priority:r,pid:g,transport_scrambling_control:p,adaptation_field_control:h,continuity_counter:d}};parsePAT=(t,s)=>{let e=s,n;{const l=t.getUint8(e);e+=1;const i=t.getUint8(e);if(e+=1,i!==0)throw new Error(\"Invalid PAT table_id\");const c=t.getUint16(e)&4095;e+=2;const r=t.getUint16(e);e+=2;const g=(t.getUint8(e)&62)>>1,p=t.getUint8(e)&1;e+=1;const h=t.getUint8(e);e+=1;const d=t.getUint8(e);e+=1,n={pointer_field:l,table_id:i,section_length:c,transport_stream_id:r,version_number:g,current_next_indicator:p,section_number:h,last_section_number:d}}const a=[];{const l=n.section_length-5-4,i=e+l;for(;e<i;){const c=t.getUint16(e),r=t.getUint16(e+2)&8191;e+=4,c!==0&&r>=32&&r<=8190&&a.push({program_number:c,pmt_pid:r})}}const o=t.getUint32(e);this.pat={header:n,programs:a,crc32:o},this.on.debug&&this.on.debug({pat:this.pat})};parsePMT=(t,s)=>{let e=s,n;{const l=t.getUint8(e);e+=1;const i=t.getUint8(e);if(e+=1,i!==2)throw new Error(\"Invalid PMT table_id\");const c=t.getUint16(e)&4095;e+=2;const r=t.getUint16(e);e+=2;const g=(t.getUint8(e)&62)>>1,p=t.getUint8(e)&1;e+=1;const h=t.getUint8(e);e+=1;const d=t.getUint8(e);e+=1;const u=t.getUint16(e)&8191;e+=2;const f=t.getUint16(e)&4095;e+=2,n={pointer_field:l,table_id:i,section_length:c,transport_stream_id:r,version_number:g,current_next_indicator:p,section_number:h,last_section_number:d,pcr_pid:u,program_info_length:f}}const a=[];{const l=n.section_length-9-4,i=e+l;for(;e<i;){const c=t.getUint8(e),r=D(c),g=t.getUint16(e+1)&8191,p=t.getUint16(e+3)&4095;if(e+=5,g<32||g>8190){console.warn(`Invalid elementary_pid: 0x${g.toString(16)}`);continue}a.push({kind:r,stream_type:c,elementary_pid:g,es_info_length:p})}}const o=t.getUint32(e);this.pmt={header:n,streams:a,crc32:o},this.on.debug&&this.on.debug({pmt:this.pmt})};parseAdaptationField=(t,s)=>{let e=s,n,a,o,l;const i=t.getUint8(e),c=!!(i&128),r=!!(i&64),g=!!(i&32),p=!!(i&16),h=!!(i&8),d=!!(i&4),u=!!(i&2),f=!!(i&1);e+=1;const U=(_,b)=>{let m=BigInt(0);m|=BigInt(_.getUint16(b))<<25n,m|=BigInt(_.getUint16(b+1))<<17n,m|=BigInt(_.getUint16(b+2))<<9n,m|=BigInt(_.getUint16(b+3))<<1n,m|=BigInt(_.getUint16(b+4)>>7);const S=(_.getUint16(b+4)&1)<<8|_.getUint16(b+5);return m=m*300n+BigInt(S),m};if(p&&(n=U(t,e),e+=6),h&&(a=U(t,e),e+=6),d&&(o=t.getInt8(e),e+=1),u){const _=t.getUint8(e);e+=1,l=new Uint8Array(t.buffer,e,_),e+=_}return{discontinuity_indicator:c,random_access_indicator:r,elementary_stream_priority_indicator:g,pcr_flag:p,opcr_flag:h,splicing_point_flag:d,transport_private_data_flag:u,adaptation_field_extension_flag:f,pcr:n,opcr:a,splice_countdown:o,transport_private_data:l}};parseAudio=async t=>{const s=new DataView(t.buffer);let e=0,n,a;{const o=s.getUint8(e)===0&&s.getUint8(e+1)===0&&s.getUint8(e+2)===1;if(e+=3,!o)throw new Error(\"invalid ts audio payload.\");const l=s.getUint8(e);e+=1;const i=s.getUint8(e)<<8|s.getUint8(e+1);e+=2;let c,r,g,p,h;{const f=s.getUint8(e);e+=1,c=f>>4&3,r=(f>>3&1)===1,g=(f>>2&1)===1,p=(f>>1&1)===1,h=(f&1)===1}let d,u;{const f=s.getUint8(e);e+=1;const U=f>>6,_=s.getUint8(e);e+=1,(U&2)===2&&(d=this.parsePtsDts(s,e)),(U&1)===1?u=this.parsePtsDts(s,e+5):u=d,e+=_}n={stream_id:l,pes_packet_length:i,scrambling_control:c,priority:r,data_alignment:g,copyright:p,original_copy:h,pts:d,dts:u}}a=t.slice(e);{if(!this.audioConfig&&s.getUint8(e)===255){const g=s.getUint8(e+2),p=s.getUint8(e+3);let h,d;d=g>>2&15,h=(g&1)<<2|p>>6;const u=`mp4a.40.${h}`,U=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350][d];this.audioConfig={kind:\"audio\",codec:u,sampleRate:U,numberOfChannels:h},this.on.config&&this.on.config(this.audioConfig)}const{dts:o=0,pts:l=0}=n,i=l-o,c=a.slice(7);return{kind:\"audio\",type:\"key\",dts:o,pts:l,cts:i,data:c}}};parseVideo=async t=>{const s=new DataView(t.buffer);let e=0,n,a;{const o=s.getUint8(e)===0&&s.getUint8(e+1)===0&&s.getUint8(e+2)===1;if(e+=3,!o)throw new Error(\"invalid ts video payload.\");const l=s.getUint8(e);e+=1;const i=s.getUint8(e)<<8|s.getUint8(e+1);e+=2;let c,r,g,p,h;{const f=s.getUint8(e);e+=1,c=f>>4&3,r=(f>>3&1)===1,g=(f>>2&1)===1,p=(f>>1&1)===1,h=(f&1)===1}let d,u;{const f=s.getUint8(e);e+=1;const U=f>>6,_=s.getUint8(e);e+=1,(U&2)===2&&(d=this.parsePtsDts(s,e)),(U&1)===1?u=this.parsePtsDts(s,e+5):u=d,e+=_}n={stream_id:l,pes_packet_length:i,scrambling_control:c,priority:r,data_alignment:g,copyright:p,original_copy:h,pts:d,dts:u}}a=t.slice(e);{const o=this.getNalus(a);if(!this.videoConfig){let h,d;if(h=o.find(f=>f.type===7)?.nalu.slice(4),d=o.find(f=>f.type===8)?.nalu.slice(4),h&&d){const u=I(h,d),{codec:f}=T(u);this.videoConfig={kind:\"video\",codec:f,description:u,sps:h,pps:d},this.on.config&&this.on.config(this.videoConfig)}}const l=[];let i=\"delta\";for(const h of o){const{type:d,nalu:u}=h;switch(d){case 6:case 9:l.push(u);break;case 1:i=\"delta\",l.push(u);break;case 5:i=\"key\",l.push(u);break}}const c=C(l),{dts:r=0,pts:g=0}=n,p=g-r;return{kind:\"video\",type:i,dts:r,pts:g,cts:p,data:c,nalus:l}}};parsePtsDts(t,s){const e=t.getUint8(s),n=t.getUint8(s+1),a=t.getUint8(s+2),o=t.getUint8(s+3),l=t.getUint8(s+4),i=(BigInt(e)&0b00001110n)<<29n|(BigInt(n)&0b11111111n)<<22n|(BigInt(a)&0b11111110n)<<14n|(BigInt(o)&0b11111111n)<<7n|(BigInt(l)&0b11111110n)>>1n;return Number(i)/90}getNalus=t=>{const s=[];let e=0;for(;!(e+4>t.byteLength);){if(t[e]!==0||t[e+1]!==0||t[e+2]!==1){e+=1;continue}e+=3;let n=e;const a=t[e]&31;for(e+=1;!(e+1>t.byteLength);){if(t[e]!==0||t[e+1]!==0||t[e+2]!==1){e+=1;continue}break}let o=e-n;if(t[e-1]===0&&(o-=1),o!==0){const l=t.slice(n,n+o),i=M(l);s.push({type:a,nalu:i})}}return s}}const k=(y,t)=>y.getUint8(t)<<16|y.getUint8(t+1)<<8|y.getUint8(t+2);class L{audioConfig;videoConfig;header;textDecoder=new TextDecoder(\"utf-8\");on={};constructor(){}parse=async t=>{let s=0;for(this.header||(this.parseHeader(t,s),s+=9);this.isSurplusTag(t,s)!==!1;){const n=this.parseTagHeader(t,s+4),{tagType:a,dataSize:o,timestamp:l}=n;if(a){const i=this.parseTagBody(a,t,s+4+11,o);switch(a){case\"script\":this.on.info&&this.on.info(i);break;case\"audio\":{const{accPacketType:c}=i;if(c===0){const{codec:r,sampleRate:g,channelConfiguration:p}=i;this.audioConfig={kind:\"audio\",codec:r,sampleRate:g,numberOfChannels:p},this.on.config&&this.on.config(this.audioConfig)}else{const{cts:r,data:g}=i,p=\"key\",h=r===void 0?void 0:r+l;this.on.chunk&&this.on.chunk({kind:\"audio\",type:p,dts:l,pts:h,cts:r,data:g})}}break;case\"video\":{const{avcPacketType:c}=i;if(c===0){const{codec:r,sps:g,pps:p,data:h}=i;this.videoConfig={kind:\"video\",codec:r,description:h,sps:g,pps:p},this.on.config&&this.on.config(this.videoConfig)}else{const{frameType:r,cts:g,data:p,nalus:h}=i,d=r===1?\"key\":\"delta\",u=g===void 0?void 0:g+l;this.on.chunk&&this.on.chunk({kind:\"video\",type:d,dts:l,pts:u,cts:g,data:p,nalus:h})}}break}s=s+4+11+o}await new Promise(i=>setTimeout(()=>i(!0),8))}return s};parseHeader=(t,s)=>{let e,n,a,o;e=t.getUint8(s)<<16|t.getUint8(s+1)<<8|t.getUint8(s+2),n=t.getUint8(3);{const i=t.getUint8(0).toString(2).padStart(5,\"0\").split(\"\"),[,,c,,r]=i;a={audio:r===\"1\",video:c===\"1\"}}o=t.getUint32(5),this.header={signature:e,version:n,flags:a,dataOffset:o}};isSurplusTag=(t,s)=>{let e=!0;const n=t.byteLength;if(s+4>n)e=!1;else if(s+4+11>n)e=!1;else{const a=k(t,s+4+1);s+4+11+a>n&&(e=!1)}return e};parseTagHeader=(t,s)=>{let e,n,a,o,l;{const i=t.getUint8(s);let c;switch(i){case 18:c=\"script\";break;case 8:c=\"audio\";break;case 9:c=\"video\";break}e=c}return n=k(t,s+1),a=k(t,s+4),o=t.getUint8(s+7),l=k(t,s+8),{tagType:e,dataSize:n,timestamp:a,timestampExtended:o,streamID:l}};parseTagBody=(t,s,e,n)=>{let a;switch(t){case\"script\":a=this.parseMetaData(s,e);break;case\"audio\":a=this.parseAudio(s,e,n);break;case\"video\":a=this.parseVideo(s,e,n);break}return a};parseMetaData=(t,s)=>{let e=s;{if(t.getUint8(e)!==2)throw new Error(\"Invalid AMF type for onMetaData (expected 0x02)\");e=e+1}const n=t.getUint16(e,!1);e=e+2;{const l=new Int8Array(t.buffer.slice(e,e+n));if((this.textDecoder?.decode(l)||\"\")!==\"onMetaData\")throw new Error(\"Expected 'onMetaData' string\");e=e+n}const a=this.getAmfType(t,e);return e=e+1,this.getAMFValue(t,e,a).value};parseAudio=(t,s,e)=>{let n=s;const a=t.getUint8(n),o=a>>4&15,l=a>>2&3,i=a>>1&1,c=a&1;n=n+1;const r=t.getUint8(n);n=n+1;const g=e,p=new Uint8Array(t.buffer.slice(n,n+g));if(o===10&&r===0){const h=t.getUint8(n),d=t.getUint8(n+1),u=h>>3&31,f=(h&7)<<1|d>>7,U=d>>3&15,_=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],b=`mp4a.40.${u}`,m=_[f];return{soundFormat:o,soundRate:l,soundSize:i,soundType:c,accPacketType:r,data:p,samplingFrequencyIndex:f,channelConfiguration:U,codec:b,sampleRate:m}}return{soundFormat:o,soundRate:l,soundSize:i,soundType:c,accPacketType:r,data:p}};parseVideo=(t,s,e)=>{let n=s;const a=t.getUint8(n),o=a>>4&15,l=a&15;n=n+1;const i=t.getUint8(n);n=n+1;const c=k(t,n);n=n+3;const r=e-5,g=new Uint8Array(t.buffer.slice(n,n+r));switch(l){case 7:if(i===0){const p=T(g);return{frameType:o,codecID:l,avcPacketType:i,cts:c,data:g,...p}}else if(i===1){const p=[],h=n+e-5;for(;!(n+4>h);){const d=t.getUint32(n,!1),u=new Uint8Array(t.buffer.slice(n,n+4+d));n+=4+d,p.push(u)}return{frameType:o,codecID:l,avcPacketType:i,cts:c,data:g,nalus:p}}break;default:throw new Error(\"Unsupported codecID\")}return{frameType:o,codecID:l,avcPacketType:i,cts:c,data:g}};getAmfType=(t,s)=>t.getUint8(s);getAMFName=(t,s,e)=>{const n=new Uint8Array(t.buffer.slice(s,s+e));return this.textDecoder?.decode(n)||\"\"};getAMFValue=(t,s,e)=>{let n=s,a,o=0;switch(e){case 0:a=t.getFloat64(n,!1),o=8;break;case 1:a=!!t.getUint8(n),o=1;break;case 2:{a=\"\";const i=t.getUint16(n,!1);n=n+2;const c=new Int8Array(t.buffer,n,i).filter(g=>g!==0);a=(this.textDecoder?.decode(c)||\"\").trim(),o=2+i}break;case 3:for(a={};n<t.byteLength;){const i=t.getUint16(n,!1);if(i===0)break;n=n+2;const c=this.getAMFName(t,n,i);n=n+i;const r=this.getAmfType(t,n);if(r===6)break;n=n+1;const g=this.getAMFValue(t,n,r);n=n+g.length,a[c]=g.value,o=2+i+1+g.length}break;case 8:{a={};const i=t.getUint32(n,!1);n=n+4;for(let c=0;c<i;c++){const r=t.getUint16(n,!1);n=n+2;const g=this.getAMFName(t,n,r);n=n+r;const p=this.getAmfType(t,n);n=n+1;const h=this.getAMFValue(t,n,p);n=n+h.length,a[g]=h.value,o=2+r+1+h.length}}break;case 10:{a=[];const i=t.getUint32(n,!1);n=n+4;for(let c=0;c<i;c++){const r=this.getAmfType(t,n);n=n+1;const g=this.getAMFValue(t,n,r);n=n+g.length,a.push(g.value),o=1+g.length}}break}return{amfType:e,length:o,value:a}}}class O{pattern;cacher=new P;isParseing=!1;offset=0;parser;on={};constructor(){}init=t=>{switch(this.destroy(),this.pattern=t,this.pattern){case\"flv\":this.parser=new L;break;case\"hls\":this.parser=new x;break;default:throw new Error(\"is error pattern.\")}this.parser.on.debug=s=>this.on.debug&&this.on.debug(s),this.parser.on.info=s=>this.on.info&&this.on.info(s),this.parser.on.config=s=>this.on.config&&this.on.config(s),this.parser.on.chunk=s=>{this.cacher.pushChunk(s),this.on.chunk&&this.on.chunk(s)}};push=t=>{this.cacher.push(t),this.isParseing===!1&&this.parse()};destroy=()=>{this.cacher.destroy(),this.isParseing=!1,this.offset=0};parse=async()=>{try{if(this.isParseing=!0,!this.pattern)throw new Error(\"You need to set the pattern.\");if(!this.parser)throw new Error(\"You need to init parser.\");for(;;){const t=this.cacher.next(this.offset);if(this.offset=0,!t)break;this.offset=await this.parser.parse(t)}this.isParseing=!1}catch{this.destroy()}}}const A=new O;A.on.info=y=>postMessage({action:\"on.info\",data:y}),A.on.config=y=>postMessage({action:\"on.config\",data:y}),A.on.chunk=y=>postMessage({action:\"on.chunk\",data:y}),A.on.debug=y=>postMessage({action:\"on.debug\",data:y}),onmessage=y=>{const{action:t,data:s}=y.data,e=A[t];e&&e(s)}})();\n", xn = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", bn], { type: "text/javascript;charset=utf-8" });
3858
+ var bn = "(function(){var e=class{pendingPayloads=[];payload=new Uint8Array;chunks=[];push=e=>{this.pendingPayloads.push(e)};next=(e=0)=>{this.payload=this.payload.slice(e);let t=this.pendingPayloads.shift();if(!t)return!1;let n=new Uint8Array(this.payload.byteLength+t.byteLength);return n.set(this.payload,0),n.set(t,this.payload.byteLength),this.payload=n,new DataView(this.payload.buffer)};pushChunk=e=>{this.chunks.push(e),this.chunks.length>100&&this.chunks.shift()};destroy=()=>{this.pendingPayloads=[],this.payload=new Uint8Array,this.chunks=[]}};let t=(e,t)=>{let n=new Uint8Array(e),r=new Uint8Array(t),i=new Uint8Array(11+n.length+r.length),a=0;return i[a++]=1,i[a++]=n[1],i[a++]=n[2],i[a++]=n[3],i[a++]=255,i[a++]=225,i[a++]=n.length>>8&255,i[a++]=n.length&255,i.set(n,a),a+=n.length,i[a++]=1,i[a++]=r.length>>8&255,i[a++]=r.length&255,i.set(r,a),i},n=e=>{let t=0,n=new DataView(e.buffer),r=n.getUint8(t);if(t+=1,r!==1)throw Error(`Invalid AVC version`);let i=n.getUint8(t)&255;t+=1;let a=n.getUint8(t)&255;t+=1;let o=n.getUint8(t)&255;t+=1;let s=`avc1.${Array.from([i,a,o],e=>e.toString(16).padStart(2,`0`)).join(``)}`,c=(n.getUint8(t)&3)-1;t+=1;let l=n.getUint8(t)&31;t+=1;let u=n.getUint16(t,!1);t+=2;let d=new Uint8Array(n.buffer.slice(t,t+u));t+=u;let f=n.getUint8(t)&31;t+=1;let p=n.getUint16(t,!1);t+=2;let m=new Uint8Array(n.buffer.slice(t,t+p));return t+=p,{version:r,codec:s,profile:i,compatibility:a,level:o,lengthSizeMinusOne:c,numOfSequenceParameterSets:l,sequenceParameterSetLength:u,sps:d,numOfPictureParameterSets:f,pictureParameterSetLength:p,pps:m}},r=e=>{let t=new Uint8Array(4+e.length);return new DataView(t.buffer).setUint32(0,e.length,!1),t.set(e,4),t},i=e=>{let t=0;for(let n of e)t+=n.length;let n=new Uint8Array(t),r=0;for(let t of e){let e=t;n.set(e,r),r+=e.length}return n},a=e=>{let t=`unknown`;switch(e){case 1:case 2:case 27:case 36:t=`video`;break;case 3:case 4:case 15:t=`audio`;break;case 6:t=`subtitle`;break;case 134:t=`ad`;break}return t};var o=class{pat;pmt;audioConfig;videoConfig;payloadMap=new Map;on={};constructor(){}parse=async e=>{let t=0;for(;!(t+188>e.byteLength);){if(e.getInt8(t)!=71){t++;continue}await this.parsePacket(e,t),t+=188}return t};parsePacket=async(e,t)=>{if(t+188>e.byteLength||e.getUint8(t)!==71)throw Error(`Invalid TS packet`);let n=t,r=this.parseHeader(e,n);n+=4;let{transport_error_indicator:i,pid:a,payload_unit_start_indicator:o,adaptation_field_control:s}=r;if(i===1||a===void 0)return;let c=184;if(s===2||s===3){let t=e.getUint8(n);n+=1,this.parseAdaptationField(e,n),n+=t,c-=t}if(s===3&&--c,s===1||s===3){let t=new Uint8Array(e.buffer.slice(n,n+c));if(a===0)return this.parsePAT(e,n);{let{programs:t=[]}=this.pat||{};if(t.find(e=>e.pmt_pid===a))return this.parsePMT(e,n)}let{streams:r=[]}=this.pmt||{},i=r.find(e=>e.elementary_pid===a);if(i){if(o===1){let e=this.payloadMap.get(a);if(e){switch(i.kind){case`audio`:{let t=await this.parseAudio(e);this.on.chunk&&this.on.chunk(t)}break;case`video`:{let t=await this.parseVideo(e);this.on.chunk&&this.on.chunk(t),await new Promise(e=>setTimeout(()=>e(!0),0))}break}this.payloadMap.delete(a)}}{this.payloadMap.has(a)||this.payloadMap.set(a,new Uint8Array);let e=this.payloadMap.get(a),n=new Uint8Array(e.byteLength+t.byteLength);n.set(e,0),n.set(t,e.byteLength),this.payloadMap.set(a,n)}}}};parseHeader=(e,t)=>{let n=t,r=e.getUint8(n),i=e.getUint8(n+1),a=e.getUint8(n+2),o=e.getUint8(n+3),s=(i&128)>>7;return s===1?{sync_byte:r,transport_error_indicator:s}:{sync_byte:r,transport_error_indicator:s,payload_unit_start_indicator:(i&64)>>6,transport_priority:(i&32)>>5,pid:(i&31)<<8|a,transport_scrambling_control:(o&192)>>6,adaptation_field_control:o>>4&3,continuity_counter:o&15}};parsePAT=(e,t)=>{let n=t,r;{let t=e.getUint8(n);n+=1;let i=e.getUint8(n);if(n+=1,i!==0)throw Error(`Invalid PAT table_id`);let a=e.getUint16(n)&4095;n+=2;let o=e.getUint16(n);n+=2;let s=(e.getUint8(n)&62)>>1,c=e.getUint8(n)&1;n+=1;let l=e.getUint8(n);n+=1;let u=e.getUint8(n);n+=1,r={pointer_field:t,table_id:i,section_length:a,transport_stream_id:o,version_number:s,current_next_indicator:c,section_number:l,last_section_number:u}}let i=[];{let t=r.section_length-5-4,a=n+t;for(;n<a;){let t=e.getUint16(n),r=e.getUint16(n+2)&8191;n+=4,t!==0&&r>=32&&r<=8190&&i.push({program_number:t,pmt_pid:r})}}let a=e.getUint32(n);this.pat={header:r,programs:i,crc32:a},this.on.debug&&this.on.debug({pat:this.pat})};parsePMT=(e,t)=>{let n=t,r;{let t=e.getUint8(n);n+=1;let i=e.getUint8(n);if(n+=1,i!==2)throw Error(`Invalid PMT table_id`);let a=e.getUint16(n)&4095;n+=2;let o=e.getUint16(n);n+=2;let s=(e.getUint8(n)&62)>>1,c=e.getUint8(n)&1;n+=1;let l=e.getUint8(n);n+=1;let u=e.getUint8(n);n+=1;let d=e.getUint16(n)&8191;n+=2;let f=e.getUint16(n)&4095;n+=2,r={pointer_field:t,table_id:i,section_length:a,transport_stream_id:o,version_number:s,current_next_indicator:c,section_number:l,last_section_number:u,pcr_pid:d,program_info_length:f}}let i=[];{let t=r.section_length-9-4,o=n+t;for(;n<o;){let t=e.getUint8(n),r=a(t),o=e.getUint16(n+1)&8191,s=e.getUint16(n+3)&4095;if(n+=5,o<32||o>8190){console.warn(`Invalid elementary_pid: 0x${o.toString(16)}`);continue}i.push({kind:r,stream_type:t,elementary_pid:o,es_info_length:s})}}let o=e.getUint32(n);this.pmt={header:r,streams:i,crc32:o},this.on.debug&&this.on.debug({pmt:this.pmt})};parseAdaptationField=(e,t)=>{let n=t,r,i,a,o,s=e.getUint8(n),c=!!(s&128),l=!!(s&64),u=!!(s&32),d=!!(s&16),f=!!(s&8),p=!!(s&4),m=!!(s&2),h=!!(s&1);n+=1;let g=(e,t)=>{let n=BigInt(0);n|=BigInt(e.getUint16(t))<<25n,n|=BigInt(e.getUint16(t+1))<<17n,n|=BigInt(e.getUint16(t+2))<<9n,n|=BigInt(e.getUint16(t+3))<<1n,n|=BigInt(e.getUint16(t+4)>>7);let r=(e.getUint16(t+4)&1)<<8|e.getUint16(t+5);return n=n*300n+BigInt(r),n};if(d&&(r=g(e,n),n+=6),f&&(i=g(e,n),n+=6),p&&(a=e.getInt8(n),n+=1),m){let t=e.getUint8(n);n+=1,o=new Uint8Array(e.buffer,n,t),n+=t}return{discontinuity_indicator:c,random_access_indicator:l,elementary_stream_priority_indicator:u,pcr_flag:d,opcr_flag:f,splicing_point_flag:p,transport_private_data_flag:m,adaptation_field_extension_flag:h,pcr:r,opcr:i,splice_countdown:a,transport_private_data:o}};parseAudio=async e=>{let t=new DataView(e.buffer),n=0,r,i;{let e=t.getUint8(n)===0&&t.getUint8(n+1)===0&&t.getUint8(n+2)===1;if(n+=3,!e)throw Error(`invalid ts audio payload.`);let i=t.getUint8(n);n+=1;let a=t.getUint8(n)<<8|t.getUint8(n+1);n+=2;let o,s,c,l,u;{let e=t.getUint8(n);n+=1,o=e>>4&3,s=(e>>3&1)==1,c=(e>>2&1)==1,l=(e>>1&1)==1,u=(e&1)==1}let d,f;{let e=t.getUint8(n);n+=1;let r=e>>6,i=t.getUint8(n);n+=1,(r&2)==2&&(d=this.parsePtsDts(t,n)),f=(r&1)==1?this.parsePtsDts(t,n+5):d,n+=i}r={stream_id:i,pes_packet_length:a,scrambling_control:o,priority:s,data_alignment:c,copyright:l,original_copy:u,pts:d,dts:f}}i=e.slice(n);{if(!this.audioConfig&&t.getUint8(n)===255){let e=t.getUint8(n+2),r=t.getUint8(n+3),i,a;a=e>>2&15,i=(e&1)<<2|r>>6,this.audioConfig={kind:`audio`,codec:`mp4a.40.${i}`,sampleRate:[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350][a],numberOfChannels:i},this.on.config&&this.on.config(this.audioConfig)}let{dts:e=0,pts:a=0}=r;return{kind:`audio`,type:`key`,dts:e,pts:a,cts:a-e,data:i.slice(7)}}};parseVideo=async e=>{let r=new DataView(e.buffer),a=0,o,s;{let e=r.getUint8(a)===0&&r.getUint8(a+1)===0&&r.getUint8(a+2)===1;if(a+=3,!e)throw Error(`invalid ts video payload.`);let t=r.getUint8(a);a+=1;let n=r.getUint8(a)<<8|r.getUint8(a+1);a+=2;let i,s,c,l,u;{let e=r.getUint8(a);a+=1,i=e>>4&3,s=(e>>3&1)==1,c=(e>>2&1)==1,l=(e>>1&1)==1,u=(e&1)==1}let d,f;{let e=r.getUint8(a);a+=1;let t=e>>6,n=r.getUint8(a);a+=1,(t&2)==2&&(d=this.parsePtsDts(r,a)),f=(t&1)==1?this.parsePtsDts(r,a+5):d,a+=n}o={stream_id:t,pes_packet_length:n,scrambling_control:i,priority:s,data_alignment:c,copyright:l,original_copy:u,pts:d,dts:f}}s=e.slice(a);{let e=this.getNalus(s);if(!this.videoConfig){let r,i;if(r=e.find(e=>e.type===7)?.nalu.slice(4),i=e.find(e=>e.type===8)?.nalu.slice(4),r&&i){let e=t(r,i),{codec:a}=n(e);this.videoConfig={kind:`video`,codec:a,description:e,sps:r,pps:i},this.on.config&&this.on.config(this.videoConfig)}}let r=[],a=`delta`;for(let t of e){let{type:e,nalu:n}=t;switch(e){case 6:case 9:r.push(n);break;case 1:a=`delta`,r.push(n);break;case 5:a=`key`,r.push(n);break}}let c=i(r),{dts:l=0,pts:u=0}=o,d=u-l;return{kind:`video`,type:a,dts:l,pts:u,cts:d,data:c,nalus:r}}};parsePtsDts(e,t){let n=e.getUint8(t),r=e.getUint8(t+1),i=e.getUint8(t+2),a=e.getUint8(t+3),o=e.getUint8(t+4),s=(BigInt(n)&14n)<<29n|(BigInt(r)&255n)<<22n|(BigInt(i)&254n)<<14n|(BigInt(a)&255n)<<7n|(BigInt(o)&254n)>>1n;return Number(s)/90}getNalus=e=>{let t=[],n=0;for(;!(n+4>e.byteLength);){if(e[n]!==0||e[n+1]!==0||e[n+2]!==1){n+=1;continue}n+=3;let i=n,a=e[n]&31;for(n+=1;!(n+1>e.byteLength);){if(e[n]!==0||e[n+1]!==0||e[n+2]!==1){n+=1;continue}break}let o=n-i;if(e[n-1]===0&&--o,o!==0){let n=r(e.slice(i,i+o));t.push({type:a,nalu:n})}}return t}};let s=(e,t)=>e.getUint8(t)<<16|e.getUint8(t+1)<<8|e.getUint8(t+2);var c=class{audioConfig;videoConfig;header;textDecoder=new TextDecoder(`utf-8`);on={};constructor(){}parse=async e=>{let t=0;for(this.header||(this.parseHeader(e,t),t+=9);this.isSurplusTag(e,t)!==!1;){let{tagType:n,dataSize:r,timestamp:i}=this.parseTagHeader(e,t+4);if(n){let a=this.parseTagBody(n,e,t+4+11,r);switch(n){case`script`:this.on.info&&this.on.info(a);break;case`audio`:{let{accPacketType:e}=a;if(e===0){let{codec:e,sampleRate:t,channelConfiguration:n}=a;this.audioConfig={kind:`audio`,codec:e,sampleRate:t,numberOfChannels:n},this.on.config&&this.on.config(this.audioConfig)}else{let{cts:e,data:t}=a,n=e===void 0?void 0:e+i;this.on.chunk&&this.on.chunk({kind:`audio`,type:`key`,dts:i,pts:n,cts:e,data:t})}}break;case`video`:{let{avcPacketType:e}=a;if(e===0){let{codec:e,sps:t,pps:n,data:r}=a;this.videoConfig={kind:`video`,codec:e,description:r,sps:t,pps:n},this.on.config&&this.on.config(this.videoConfig)}else{let{frameType:e,cts:t,data:n,nalus:r}=a,o=e===1?`key`:`delta`,s=t===void 0?void 0:t+i;this.on.chunk&&this.on.chunk({kind:`video`,type:o,dts:i,pts:s,cts:t,data:n,nalus:r})}}break}t=t+4+11+r}await new Promise(e=>setTimeout(()=>e(!0),8))}return t};parseHeader=(e,t)=>{let n,r,i,a;n=e.getUint8(t)<<16|e.getUint8(t+1)<<8|e.getUint8(t+2),r=e.getUint8(3);{let[,,t,,n]=e.getUint8(0).toString(2).padStart(5,`0`).split(``);i={audio:n===`1`,video:t===`1`}}a=e.getUint32(5),this.header={signature:n,version:r,flags:i,dataOffset:a}};isSurplusTag=(e,t)=>{let n=!0,r=e.byteLength;if(t+4>r)n=!1;else if(t+4+11>r)n=!1;else{let i=s(e,t+4+1);t+4+11+i>r&&(n=!1)}return n};parseTagHeader=(e,t)=>{let n,r,i,a,o;{let r=e.getUint8(t),i;switch(r){case 18:i=`script`;break;case 8:i=`audio`;break;case 9:i=`video`;break}n=i}return r=s(e,t+1),i=s(e,t+4),a=e.getUint8(t+7),o=s(e,t+8),{tagType:n,dataSize:r,timestamp:i,timestampExtended:a,streamID:o}};parseTagBody=(e,t,n,r)=>{let i;switch(e){case`script`:i=this.parseMetaData(t,n);break;case`audio`:i=this.parseAudio(t,n,r);break;case`video`:i=this.parseVideo(t,n,r);break}return i};parseMetaData=(e,t)=>{let n=t;if(e.getUint8(n)!==2)throw Error(`Invalid AMF type for onMetaData (expected 0x02)`);n+=1;let r=e.getUint16(n,!1);n+=2;{let t=new Int8Array(e.buffer.slice(n,n+r));if((this.textDecoder?.decode(t)||``)!==`onMetaData`)throw Error(`Expected 'onMetaData' string`);n+=r}let i=this.getAmfType(e,n);return n+=1,this.getAMFValue(e,n,i).value};parseAudio=(e,t,n)=>{let r=t,i=e.getUint8(r),a=i>>4&15,o=i>>2&3,s=i>>1&1,c=i&1;r+=1;let l=e.getUint8(r);r+=1;let u=n,d=new Uint8Array(e.buffer.slice(r,r+u));if(a===10&&l===0){let t=e.getUint8(r),n=e.getUint8(r+1),i=t>>3&31,u=(t&7)<<1|n>>7;return{soundFormat:a,soundRate:o,soundSize:s,soundType:c,accPacketType:l,data:d,samplingFrequencyIndex:u,channelConfiguration:n>>3&15,codec:`mp4a.40.${i}`,sampleRate:[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350][u]}}return{soundFormat:a,soundRate:o,soundSize:s,soundType:c,accPacketType:l,data:d}};parseVideo=(e,t,r)=>{let i=t,a=e.getUint8(i),o=a>>4&15,c=a&15;i+=1;let l=e.getUint8(i);i+=1;let u=s(e,i);i+=3;let d=r-5,f=new Uint8Array(e.buffer.slice(i,i+d));switch(c){case 7:if(l===0)return{frameType:o,codecID:c,avcPacketType:l,cts:u,data:f,...n(f)};if(l===1){let t=[],n=i+r-5;for(;!(i+4>n);){let n=e.getUint32(i,!1),r=new Uint8Array(e.buffer.slice(i,i+4+n));i+=4+n,t.push(r)}return{frameType:o,codecID:c,avcPacketType:l,cts:u,data:f,nalus:t}}break;default:throw Error(`Unsupported codecID`)}return{frameType:o,codecID:c,avcPacketType:l,cts:u,data:f}};getAmfType=(e,t)=>e.getUint8(t);getAMFName=(e,t,n)=>{let r=new Uint8Array(e.buffer.slice(t,t+n));return this.textDecoder?.decode(r)||``};getAMFValue=(e,t,n)=>{let r=t,i,a=0;switch(n){case 0:i=e.getFloat64(r,!1),a=8;break;case 1:i=!!e.getUint8(r),a=1;break;case 2:{i=``;let t=e.getUint16(r,!1);r+=2;let n=new Int8Array(e.buffer,r,t).filter(e=>e!==0);i=(this.textDecoder?.decode(n)||``).trim(),a=2+t}break;case 3:for(i={};r<e.byteLength;){let t=e.getUint16(r,!1);if(t===0)break;r+=2;let n=this.getAMFName(e,r,t);r+=t;let o=this.getAmfType(e,r);if(o===6)break;r+=1;let s=this.getAMFValue(e,r,o);r+=s.length,i[n]=s.value,a=2+t+1+s.length}break;case 8:{i={};let t=e.getUint32(r,!1);r+=4;for(let n=0;n<t;n++){let t=e.getUint16(r,!1);r+=2;let n=this.getAMFName(e,r,t);r+=t;let o=this.getAmfType(e,r);r+=1;let s=this.getAMFValue(e,r,o);r+=s.length,i[n]=s.value,a=2+t+1+s.length}}break;case 10:{i=[];let t=e.getUint32(r,!1);r+=4;for(let n=0;n<t;n++){let t=this.getAmfType(e,r);r+=1;let n=this.getAMFValue(e,r,t);r+=n.length,i.push(n.value),a=1+n.length}}break}return{amfType:n,length:a,value:i}}};let l=new class{pattern;cacher=new e;isParseing=!1;offset=0;parser;on={};constructor(){}init=e=>{switch(this.destroy(),this.pattern=e,this.pattern){case`flv`:this.parser=new c;break;case`hls`:this.parser=new o;break;default:throw Error(`is error pattern.`)}this.parser.on.debug=e=>this.on.debug&&this.on.debug(e),this.parser.on.info=e=>this.on.info&&this.on.info(e),this.parser.on.config=e=>this.on.config&&this.on.config(e),this.parser.on.chunk=e=>{this.cacher.pushChunk(e),this.on.chunk&&this.on.chunk(e)}};push=e=>{this.cacher.push(e),this.isParseing===!1&&this.parse()};destroy=()=>{this.cacher.destroy(),this.isParseing=!1,this.offset=0};parse=async()=>{try{if(this.isParseing=!0,!this.pattern)throw Error(`You need to set the pattern.`);if(!this.parser)throw Error(`You need to init parser.`);for(;;){let e=this.cacher.next(this.offset);if(this.offset=0,!e)break;this.offset=await this.parser.parse(e)}this.isParseing=!1}catch{this.destroy()}}};l.on.info=e=>postMessage({action:`on.info`,data:e}),l.on.config=e=>postMessage({action:`on.config`,data:e}),l.on.chunk=e=>postMessage({action:`on.chunk`,data:e}),l.on.debug=e=>postMessage({action:`on.debug`,data:e}),onmessage=e=>{let{action:t,data:n}=e.data,r=l[t];r&&r(n)}})();", xn = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", bn], { type: "text/javascript;charset=utf-8" });
3859
3859
  function Sn(e) {
3860
3860
  let t;
3861
3861
  try {
@@ -3868,8 +3868,8 @@ function Sn(e) {
3868
3868
  return new Worker("data:text/javascript;charset=utf-8," + encodeURIComponent(bn), { name: e?.name });
3869
3869
  }
3870
3870
  }
3871
- var Cn = class {
3872
- worker = new Sn();
3871
+ var Cn = "pr-player-demuxer", wn = class {
3872
+ worker = new Sn({ name: Cn });
3873
3873
  on = {};
3874
3874
  constructor() {
3875
3875
  this.worker.onmessage = (e) => {
@@ -3904,21 +3904,21 @@ var Cn = class {
3904
3904
  data: {}
3905
3905
  }), this.worker.terminate();
3906
3906
  };
3907
- }, wn = "(function(){\"use strict\";class a{pattern=\"flv\";audioDecoderConfig;audioDecoder;videoDecoderConfig;videoDecoder;hasKeyFrame=!1;baseTime=0;pendingChunks=[];currentChunk;isProcessing=!1;decodeTimer=0;frameTrack=!1;isFrameTrack=!1;fameTrackOption={flv:[30,50],hls:[200,300],dash:[50,100],rtmp:[50,100]};decodingSpeedRatio=1;maxDecodingSpeedRatio=2;decodingSpeed=16;fps=0;firstVideoChunkTimestamp;secondVideoChunkTimestamp;frameStartTime;lastRenderTime;nextRenderTime;on={audio:{},video:{}};constructor(){}init=e=>{this.destroy(),this.pattern=e,this.baseTime=new Date().getTime()-performance.now(),this.initDecodeInterval()};initAudio=e=>{this.audio.destroy(),this.audioDecoderConfig={...e},this.audioDecoder=new AudioDecoder({output:i=>{const o=this.decodingSpeedRatio;this.on.audio.decode&&this.on.audio.decode({audioData:i,playbackRate:o})},error:i=>{this.on.audio.error&&this.on.audio.error(i)}}),this.audioDecoder.configure(this.audioDecoderConfig)};initVideo=e=>{this.video.destroy(),this.videoDecoderConfig={...e},this.videoDecoder=new VideoDecoder({output:async i=>{this.frameStartTime||(this.frameStartTime=i.timestamp);try{const o=i.timestamp-this.frameStartTime+this.baseTime*1e3,s=await createImageBitmap(i);if(i.close(),!s.width||!s.height)return s.close();this.on.video.decode&&this.on.video.decode({timestamp:o,bitmap:s}),this.currentChunk&&this.currentChunk.kind===\"video\"&&this.currentChunk.nalus&&this.on.nalus&&this.on.nalus(this.currentChunk.nalus)}catch{i.close()}},error:i=>{this.on.video.error&&this.on.video.error(i)}}),this.videoDecoder.configure(this.videoDecoderConfig)};setFrameTrack=e=>{this.frameTrack=e,this.frameTrack===!1&&(this.decodingSpeedRatio=1)};push=e=>{this.pendingChunks.push(e)};destroy=()=>{this.audio.destroy(),this.video.destroy(),this.pendingChunks=[],this.firstVideoChunkTimestamp=void 0,this.secondVideoChunkTimestamp=void 0,this.frameStartTime=void 0,this.lastRenderTime=void 0,this.nextRenderTime=void 0,clearInterval(this.decodeTimer)};initDecodeInterval=()=>{let e=this.decodingSpeed/this.decodingSpeedRatio;const i=this.baseTime+performance.now();if(this.lastRenderTime||(this.lastRenderTime=i),this.fps=Math.round(1e3/(i-this.lastRenderTime)),this.lastRenderTime=i,this.nextRenderTime){const o=this.lastRenderTime-this.nextRenderTime;e-=o}this.nextRenderTime=this.lastRenderTime+e,this.decodeTimer=setTimeout(()=>{this.decode(),this.initDecodeInterval()},e)};decode=()=>{if(this.isProcessing!==!0){for(this.isProcessing=!0;this.currentChunk=this.pendingChunks.shift(),!!this.currentChunk;){const e=this.pendingChunks.length;if(this.frameTrack){const[s,n]=this.fameTrackOption[this.pattern];if(e<=s&&(this.isFrameTrack=!1),e>=n&&(this.isFrameTrack=!0),this.isFrameTrack){const r=Math.min(1+(e-s)/100,this.maxDecodingSpeedRatio);this.decodingSpeedRatio=Number(r.toFixed(1))}else this.decodingSpeedRatio=1}if(this.on.analysis){const{decodingSpeed:s,decodingSpeedRatio:n,fps:r}=this;this.on.analysis({decodingSpeed:s,decodingSpeedRatio:n,fps:r,cacheLength:e})}const{kind:i,init:o}=this.currentChunk;switch(i){case\"audio\":this.decodeAudio(o);break;case\"video\":this.decodeVideo(o);break}if(i===\"video\")break}this.isProcessing=!1}};decodeAudio=e=>{if(!this.audioDecoder)return;const i=new EncodedAudioChunk(e);this.audioDecoder.decode(i)};decodeVideo=e=>{if(this.videoDecoder&&(e.type===\"key\"&&(this.hasKeyFrame=!0),this.firstVideoChunkTimestamp?this.secondVideoChunkTimestamp||(this.secondVideoChunkTimestamp=e.timestamp,this.decodingSpeed=(this.secondVideoChunkTimestamp-this.firstVideoChunkTimestamp)/1e3):this.firstVideoChunkTimestamp=e.timestamp,this.hasKeyFrame)){const i=new EncodedVideoChunk(e);this.videoDecoder.decode(i)}};audio={flush:()=>{this.audioDecoder?.flush()},destroy:()=>{this.audioDecoderConfig=void 0,this.audioDecoder?.close(),this.audioDecoder=void 0}};video={flush:()=>{this.videoDecoder?.flush()},destroy:()=>{this.videoDecoderConfig=void 0,this.videoDecoder?.close(),this.videoDecoder=void 0,this.hasKeyFrame=!1}}}const d=new a;d.on.audio.decode=t=>postMessage({action:\"on.audio.decode\",data:t},[t.audioData]),d.on.audio.error=t=>postMessage({action:\"on.audio.error\",data:t}),d.on.video.decode=t=>postMessage({action:\"on.video.decode\",data:t},[t.bitmap]),d.on.video.error=t=>postMessage({action:\"on.video.error\",data:t}),d.on.nalus=t=>postMessage({action:\"on.nalus\",data:t}),d.on.analysis=t=>postMessage({action:\"on.analysis\",data:t}),onmessage=t=>{const{action:e,data:i}=t.data,o=d[e];o&&o(i)}})();\n", Tn = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", wn], { type: "text/javascript;charset=utf-8" });
3908
- function En(e) {
3907
+ }, Tn = "(function(){let e=new class{pattern=`flv`;audioDecoderConfig;audioDecoder;videoDecoderConfig;videoDecoder;hasKeyFrame=!1;baseTime=0;pendingChunks=[];currentChunk;isProcessing=!1;decodeTimer=0;frameTrack=!1;isFrameTrack=!1;fameTrackOption={flv:[30,50],hls:[200,300],dash:[50,100],rtmp:[50,100]};decodingSpeedRatio=1;maxDecodingSpeedRatio=2;decodingSpeed=16;fps=0;firstVideoChunkTimestamp;secondVideoChunkTimestamp;frameStartTime;lastRenderTime;nextRenderTime;on={audio:{},video:{}};constructor(){}init=e=>{this.destroy(),this.pattern=e,this.baseTime=new Date().getTime()-performance.now(),this.initDecodeInterval()};initAudio=e=>{this.audio.destroy(),this.audioDecoderConfig={...e},this.audioDecoder=new AudioDecoder({output:e=>{let t=this.decodingSpeedRatio;this.on.audio.decode&&this.on.audio.decode({audioData:e,playbackRate:t})},error:e=>{this.on.audio.error&&this.on.audio.error(e)}}),this.audioDecoder.configure(this.audioDecoderConfig)};initVideo=e=>{this.video.destroy(),this.videoDecoderConfig={...e},this.videoDecoder=new VideoDecoder({output:async e=>{this.frameStartTime||=e.timestamp;try{let t=e.timestamp-this.frameStartTime+this.baseTime*1e3,n=await createImageBitmap(e);if(e.close(),!n.width||!n.height)return n.close();this.on.video.decode&&this.on.video.decode({timestamp:t,bitmap:n}),this.currentChunk&&this.currentChunk.kind===`video`&&this.currentChunk.nalus&&this.on.nalus&&this.on.nalus(this.currentChunk.nalus)}catch{e.close()}},error:e=>{this.on.video.error&&this.on.video.error(e)}}),this.videoDecoder.configure(this.videoDecoderConfig)};setFrameTrack=e=>{this.frameTrack=e,this.frameTrack===!1&&(this.decodingSpeedRatio=1)};push=e=>{this.pendingChunks.push(e)};destroy=()=>{this.audio.destroy(),this.video.destroy(),this.pendingChunks=[],this.firstVideoChunkTimestamp=void 0,this.secondVideoChunkTimestamp=void 0,this.frameStartTime=void 0,this.lastRenderTime=void 0,this.nextRenderTime=void 0,clearInterval(this.decodeTimer)};initDecodeInterval=()=>{let e=this.decodingSpeed/this.decodingSpeedRatio,t=this.baseTime+performance.now();if(this.lastRenderTime||=t,this.fps=Math.round(1e3/(t-this.lastRenderTime)),this.lastRenderTime=t,this.nextRenderTime){let t=this.lastRenderTime-this.nextRenderTime;e-=t}this.nextRenderTime=this.lastRenderTime+e,this.decodeTimer=setTimeout(()=>{this.decode(),this.initDecodeInterval()},e)};decode=()=>{if(this.isProcessing!==!0){for(this.isProcessing=!0;this.currentChunk=this.pendingChunks.shift(),this.currentChunk;){let e=this.pendingChunks.length;if(this.frameTrack){let[t,n]=this.fameTrackOption[this.pattern];if(e<=t&&(this.isFrameTrack=!1),e>=n&&(this.isFrameTrack=!0),this.isFrameTrack){let n=Math.min(1+(e-t)/100,this.maxDecodingSpeedRatio);this.decodingSpeedRatio=Number(n.toFixed(1))}else this.decodingSpeedRatio=1}if(this.on.analysis){let{decodingSpeed:t,decodingSpeedRatio:n,fps:r}=this;this.on.analysis({decodingSpeed:t,decodingSpeedRatio:n,fps:r,cacheLength:e})}let{kind:t,init:n}=this.currentChunk;switch(t){case`audio`:this.decodeAudio(n);break;case`video`:this.decodeVideo(n);break}if(t===`video`)break}this.isProcessing=!1}};decodeAudio=e=>{if(!this.audioDecoder)return;let t=new EncodedAudioChunk(e);this.audioDecoder.decode(t)};decodeVideo=e=>{if(this.videoDecoder&&(e.type===`key`&&(this.hasKeyFrame=!0),this.firstVideoChunkTimestamp?this.secondVideoChunkTimestamp||(this.secondVideoChunkTimestamp=e.timestamp,this.decodingSpeed=(this.secondVideoChunkTimestamp-this.firstVideoChunkTimestamp)/1e3):this.firstVideoChunkTimestamp=e.timestamp,this.hasKeyFrame)){let t=new EncodedVideoChunk(e);this.videoDecoder.decode(t)}};audio={flush:()=>{this.audioDecoder?.flush()},destroy:()=>{this.audioDecoderConfig=void 0,this.audioDecoder?.close(),this.audioDecoder=void 0}};video={flush:()=>{this.videoDecoder?.flush()},destroy:()=>{this.videoDecoderConfig=void 0,this.videoDecoder?.close(),this.videoDecoder=void 0,this.hasKeyFrame=!1}}};e.on.audio.decode=e=>postMessage({action:`on.audio.decode`,data:e},[e.audioData]),e.on.audio.error=e=>postMessage({action:`on.audio.error`,data:e}),e.on.video.decode=e=>postMessage({action:`on.video.decode`,data:e},[e.bitmap]),e.on.video.error=e=>postMessage({action:`on.video.error`,data:e}),e.on.nalus=e=>postMessage({action:`on.nalus`,data:e}),e.on.analysis=e=>postMessage({action:`on.analysis`,data:e}),onmessage=t=>{let{action:n,data:r}=t.data,i=e[n];i&&i(r)}})();", En = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", Tn], { type: "text/javascript;charset=utf-8" });
3908
+ function Dn(e) {
3909
3909
  let t;
3910
3910
  try {
3911
- if (t = Tn && (self.URL || self.webkitURL).createObjectURL(Tn), !t) throw "";
3911
+ if (t = En && (self.URL || self.webkitURL).createObjectURL(En), !t) throw "";
3912
3912
  let n = new Worker(t, { name: e?.name });
3913
3913
  return n.addEventListener("error", () => {
3914
3914
  (self.URL || self.webkitURL).revokeObjectURL(t);
3915
3915
  }), n;
3916
3916
  } catch {
3917
- return new Worker("data:text/javascript;charset=utf-8," + encodeURIComponent(wn), { name: e?.name });
3917
+ return new Worker("data:text/javascript;charset=utf-8," + encodeURIComponent(Tn), { name: e?.name });
3918
3918
  }
3919
3919
  }
3920
- var Dn = class {
3921
- worker = new En();
3920
+ var On = "pr-player-decoder", kn = class {
3921
+ worker = new Dn({ name: On });
3922
3922
  on = {
3923
3923
  audio: {},
3924
3924
  video: {}
@@ -3971,21 +3971,21 @@ var Dn = class {
3971
3971
  destroy = () => {
3972
3972
  this.worker.postMessage({ action: "destroy" }), this.worker.terminate();
3973
3973
  };
3974
- }, On = "(function(){\"use strict\";class w{renderMap=new Map;constructor(){}push=async t=>{const{timestamp:s}=t,{bitmap:e}=t;try{const n=[...this.renderMap.keys()];for(const a of n){const i=this.renderMap.get(a);if(!i)continue;const{pause:y=!1,writer:u,offscreen:o,option:f}=i;if(y===!0)continue;const h=async r=>{if(u){const c=new VideoFrame(r,{timestamp:s});try{await u.write(c)}catch{}c.close()}else o&&(o.width=r.width,o.height=r.height,o?.getContext(\"2d\")?.drawImage(r,0,0))};if(a===\"default\")await h(e);else if(f){const{sx:r=0,sy:c=0,sw:p=e.width,sh:M=e.height}=f,g=await createImageBitmap(e,r,c,p,M);await h(g)}}}catch{}e.close()};addCut=t=>{const{key:s,writable:e,offscreen:n,option:a}={key:\"default\",...t};if(e){const i=e.getWriter();this.renderMap.set(s,{writer:i,option:a,pause:!1})}else this.renderMap.set(s,{offscreen:n,option:a,pause:!1})};delCut=t=>{this.renderMap.delete(t)};setCut=t=>{const{key:s,cutOption:e}={key:\"default\",...t},n=this.renderMap.get(s);n&&this.renderMap.set(s,{...n,option:e})};setPause=t=>{const{key:s,pause:e}={key:\"default\",...t},n=this.renderMap.get(s);n&&this.renderMap.set(s,{...n,pause:e})};destroy=()=>{this.renderMap=new Map}}const l=new w;onmessage=d=>{const{action:t,data:s}=d.data,e=l[t];e&&e(s)}})();\n", kn = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", On], { type: "text/javascript;charset=utf-8" });
3975
- function An(e) {
3974
+ }, An = "(function(){let e=new class{renderMap=new Map;constructor(){}push=async e=>{let{timestamp:t}=e,{bitmap:n}=e;try{let e=[...this.renderMap.keys()];for(let r of e){let e=this.renderMap.get(r);if(!e)continue;let{pause:i=!1,writer:a,offscreen:o,option:s}=e;if(i===!0)continue;let c=async e=>{if(a){let n=new VideoFrame(e,{timestamp:t});try{await a.write(n)}catch{}n.close()}else o&&(o.width=e.width,o.height=e.height,o?.getContext(`2d`)?.drawImage(e,0,0))};if(r===`default`)await c(n);else if(s){let{sx:e=0,sy:t=0,sw:r=n.width,sh:i=n.height}=s;await c(await createImageBitmap(n,e,t,r,i))}}}catch{}n.close()};addCut=e=>{let{key:t,writable:n,offscreen:r,option:i}={key:`default`,...e};if(n){let e=n.getWriter();this.renderMap.set(t,{writer:e,option:i,pause:!1})}else this.renderMap.set(t,{offscreen:r,option:i,pause:!1})};delCut=e=>{this.renderMap.delete(e)};setCut=e=>{let{key:t,cutOption:n}={key:`default`,...e},r=this.renderMap.get(t);r&&this.renderMap.set(t,{...r,option:n})};setPause=e=>{let{key:t,pause:n}={key:`default`,...e},r=this.renderMap.get(t);r&&this.renderMap.set(t,{...r,pause:n})};destroy=()=>{this.renderMap=new Map}};onmessage=t=>{let{action:n,data:r}=t.data,i=e[n];i&&i(r)}})();", jn = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", An], { type: "text/javascript;charset=utf-8" });
3975
+ function Mn(e) {
3976
3976
  let t;
3977
3977
  try {
3978
- if (t = kn && (self.URL || self.webkitURL).createObjectURL(kn), !t) throw "";
3978
+ if (t = jn && (self.URL || self.webkitURL).createObjectURL(jn), !t) throw "";
3979
3979
  let n = new Worker(t, { name: e?.name });
3980
3980
  return n.addEventListener("error", () => {
3981
3981
  (self.URL || self.webkitURL).revokeObjectURL(t);
3982
3982
  }), n;
3983
3983
  } catch {
3984
- return new Worker("data:text/javascript;charset=utf-8," + encodeURIComponent(On), { name: e?.name });
3984
+ return new Worker("data:text/javascript;charset=utf-8," + encodeURIComponent(An), { name: e?.name });
3985
3985
  }
3986
3986
  }
3987
- var jn = class {
3988
- worker = new An();
3987
+ var Nn = "pr-player-render", Pn = class {
3988
+ worker = new Mn({ name: Nn });
3989
3989
  constructor() {}
3990
3990
  push = (e) => this.worker.postMessage({
3991
3991
  action: "push",
@@ -4016,7 +4016,15 @@ var jn = class {
4016
4016
  data: {}
4017
4017
  }), this.worker.terminate();
4018
4018
  };
4019
- }, Mn = class {
4019
+ }, Fn = "data:text/javascript;base64,LyoqDQogKiDpnZnpn7Pml7bvvJrlnKjpopHln5/ku4Xkv53nlZkgYmluIDDvvZ4077yI6ZqP5py677yJ77yM5YW25L2Z5Li6IDDvvIzlho3lkIjmiJDml7bln5/lhpnlhaXovpPlh7og4oCUIOWNs+S/ruaUueecn+WuniBQQ03vvIznu48gQW5hbHlzZXIoZmZ0U2l6ZT01MTIpIOaXtuWJjSA1IOS4qiBiaW4g5pyJ6IO96YeP44CB5YW25L2Z5o6l6L+RIDDjgIINCiAqIFBFUklPRCDpobvkuI4gUHJBdWRpb1N0cmVhbSDkuK0gYW5hbHlzZXJOb2RlLmZmdFNpemUg5LiA6Ie044CCDQogKi8NCmNsYXNzIE5vdEVtcHR5Rm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0KICAgICAgICAgIGlmIChjaGFubmVsKSBjaGFubmVsW2ldID0gdg0KICAgICAgICB9DQogICAgICB9DQogICAgfQ0KICB9DQoNCiAgc3RhdGljIGNvcHlJbnB1dHNUb091dHB1dHMoaW5wdXRzLCBvdXRwdXRzKSB7DQogICAgZm9yIChsZXQgbm8gPSAwOyBubyA8IG91dHB1dHMubGVuZ3RoOyBubysrKSB7DQogICAgICBjb25zdCBvdXRQb3J0cyA9IG91dHB1dHNbbm9dDQogICAgICBjb25zdCBpblBvcnRzID0gaW5wdXRzW25vXQ0KICAgICAgaWYgKCFvdXRQb3J0cykgY29udGludWUNCiAgICAgIGZvciAobGV0IGNoID0gMDsgY2ggPCBvdXRQb3J0cy5sZW5ndGg7IGNoKyspIHsNCiAgICAgICAgY29uc3Qgb3V0Q2ggPSBvdXRQb3J0c1tjaF0NCiAgICAgICAgaWYgKCFvdXRDaCkgY29udGludWUNCiAgICAgICAgY29uc3QgaW5DaCA9IGluUG9ydHMgJiYgaW5Qb3J0c1tjaF0NCiAgICAgICAgaWYgKGluQ2ggJiYgaW5DaC5sZW5ndGggPT09IG91dENoLmxlbmd0aCkgew0KICAgICAgICAgIG91dENoLnNldChpbkNoKQ0KICAgICAgICB9IGVsc2UgaWYgKGluQ2gpIHsNCiAgICAgICAgICBjb25zdCBuID0gTWF0aC5taW4oaW5DaC5sZW5ndGgsIG91dENoLmxlbmd0aCkNCiAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IG47IGkrKykgb3V0Q2hbaV0gPSBpbkNoW2ldDQogICAgICAgICAgZm9yIChsZXQgaSA9IG47IGkgPCBvdXRDaC5sZW5ndGg7IGkrKykgb3V0Q2hbaV0gPSAwDQogICAgICAgIH0gZWxzZSB7DQogICAgICAgICAgb3V0Q2guZmlsbCgwKQ0KICAgICAgICB9DQogICAgICB9DQogICAgfQ0KICB9DQoNCiAgcHJvY2VzcyhpbnB1dHMsIG91dHB1dHMpIHsNCiAgICBpZiAodGhpcy5pc0Rlc3Ryb3kpIHJldHVybiBmYWxzZQ0KDQogICAgaWYgKHRoaXMuZGVidWcpIHsNCiAgICAgIGNvbnNvbGUubG9nKCdceDFiWzM4OzI7MDsxNTE7MjU1bSVjJXNceDFiWzBtJywgJ2NvbG9yOiMwMDk3ZmY7JywgJy0tLS0tLS0+QnJlYXRoZTogaW5wdXRzJywgaW5wdXRzKQ0KICAgIH0NCg0KICAgIGlmIChOb3RFbXB0eUZpbHRlcldvcmtsZXRQcm9jZXNzb3IuYWxsSW5wdXRzU2lsZW50KGlucHV0cykpIHsNCiAgICAgIHRoaXMuZmlsbE91dHB1dHNTcGFyc2VGaXZlQmlucyhvdXRwdXRzKQ0KICAgIH0gZWxzZSB7DQogICAgICB0aGlzLl9zaWxlbnRPZmYgPSBOb3RFbXB0eUZpbHRlcldvcmtsZXRQcm9jZXNzb3IuUEVSSU9EDQogICAgICBOb3RFbXB0eUZpbHRlcldvcmtsZXRQcm9jZXNzb3IuY29weUlucHV0c1RvT3V0cHV0cyhpbnB1dHMsIG91dHB1dHMpDQogICAgfQ0KDQogICAgcmV0dXJuIHRydWUNCiAgfQ0KDQogIGRlc3Ryb3koKSB7DQogICAgdGhpcy5pc0Rlc3Ryb3kgPSB0cnVlDQogIH0NCn0NCg0KcmVnaXN0ZXJQcm9jZXNzb3IoJ25vdC1lbXB0eS1maWx0ZXItcHJvY2Vzc29yJywgTm90RW1wdHlGaWx0ZXJXb3JrbGV0UHJvY2Vzc29yKQ0K", In = class {
4020
+ audioContext = new AudioContext();
4021
+ notEmptyFilterWorkletNode;
4022
+ constructor() {}
4023
+ createNotEmptyFilterWorkletNode = async (e) => (this.destroy(), this.audioContext = e, await this.audioContext.audioWorklet.addModule(Fn), this.notEmptyFilterWorkletNode = new AudioWorkletNode(this.audioContext, "not-empty-filter-processor"), this.notEmptyFilterWorkletNode);
4024
+ destroy = () => {
4025
+ this.notEmptyFilterWorkletNode?.disconnect(), this.notEmptyFilterWorkletNode?.port.postMessage({ type: "destroy" }), this.notEmptyFilterWorkletNode = void 0;
4026
+ };
4027
+ }, Ln = class {
4020
4028
  inputStream = new MediaStream();
4021
4029
  outputStream = new MediaStream();
4022
4030
  inputGain = 1;
@@ -4026,6 +4034,7 @@ var jn = class {
4026
4034
  outputGain = 1;
4027
4035
  mixAudioMap = /* @__PURE__ */ new Map();
4028
4036
  audioContext = new AudioContext();
4037
+ isExternalAudioContext = !1;
4029
4038
  sourceNode;
4030
4039
  inputGainNode;
4031
4040
  enhanceGainNode;
@@ -4038,11 +4047,14 @@ var jn = class {
4038
4047
  destinationNode;
4039
4048
  denoise = !1;
4040
4049
  mute = !0;
4050
+ notEmpty = !1;
4041
4051
  rnnoiseWorklet;
4042
4052
  rnnoiseWorkletNode;
4053
+ notEmptyFilterWorklet = new In();
4054
+ notEmptyFilterWorkletNode;
4043
4055
  filterStream = (e) => e;
4044
4056
  constructor(e, t) {
4045
- this.inputStream = e, t && (this.audioContext = t), this.sourceNode = this.audioContext.createMediaStreamSource(this.inputStream), this.inputGainNode = this.audioContext.createGain(), this.inputGainNode.gain.setValueAtTime(this.inputGain, this.audioContext.currentTime), this.enhanceGainNode = this.audioContext.createGain(), this.enhanceGainNode.gain.setValueAtTime(this.enhanceGain, this.audioContext.currentTime), this.bgsGainNode = this.audioContext.createGain(), this.bgsGainNode.gain.setValueAtTime(this.bgsGain, this.audioContext.currentTime), this.bgmGainNode = this.audioContext.createGain(), this.bgmGainNode.gain.setValueAtTime(this.bgmGain, this.audioContext.currentTime), this.analyserNode = this.audioContext.createAnalyser(), this.analyserNode.fftSize = 512, this.analyserArrayData = new Uint8Array(this.analyserNode.frequencyBinCount), this.outputGainNode = this.audioContext.createGain(), this.outputGainNode.gain.setValueAtTime(this.outputGain, this.audioContext.currentTime), this.destinationNode = this.audioContext.createMediaStreamDestination(), this.outputStream = this.destinationNode.stream;
4057
+ this.inputStream = e, t && (this.audioContext = t, this.isExternalAudioContext = !0), this.sourceNode = this.audioContext.createMediaStreamSource(this.inputStream), this.inputGainNode = this.audioContext.createGain(), this.inputGainNode.gain.setValueAtTime(this.inputGain, this.audioContext.currentTime), this.enhanceGainNode = this.audioContext.createGain(), this.enhanceGainNode.gain.setValueAtTime(this.enhanceGain, this.audioContext.currentTime), this.bgsGainNode = this.audioContext.createGain(), this.bgsGainNode.gain.setValueAtTime(this.bgsGain, this.audioContext.currentTime), this.bgmGainNode = this.audioContext.createGain(), this.bgmGainNode.gain.setValueAtTime(this.bgmGain, this.audioContext.currentTime), this.analyserNode = this.audioContext.createAnalyser(), this.analyserNode.fftSize = 512, this.analyserArrayData = new Uint8Array(this.analyserNode.frequencyBinCount), this.outputGainNode = this.audioContext.createGain(), this.outputGainNode.gain.setValueAtTime(this.outputGain, this.audioContext.currentTime), this.destinationNode = this.audioContext.createMediaStreamDestination(), this.outputStream = this.destinationNode.stream;
4046
4058
  {
4047
4059
  let { sourceNode: e, inputGainNode: t, enhanceGainNode: n, bgsGainNode: r, bgmGainNode: i, analyserNode: a, outputGainNode: o, destinationNode: s } = this;
4048
4060
  e.connect(t), t.connect(n), n.connect(a), r.connect(a), i.connect(a), n.connect(s), r.connect(s), i.connect(s), o.connect(this.audioContext.destination);
@@ -4075,7 +4087,10 @@ var jn = class {
4075
4087
  this.mute = e, this.analyserNode.disconnect(), e === !1 && this.analyserNode.connect(this.outputGainNode);
4076
4088
  };
4077
4089
  setDenoise = async (e = !0) => {
4078
- this.rnnoiseWorklet && (this.inputGainNode.disconnect(), this.rnnoiseWorklet.destroy(), e ? (this.rnnoiseWorkletNode = await this.rnnoiseWorklet.createRnnoiseWorkletNode(this.audioContext), this.inputGainNode.connect(this.rnnoiseWorkletNode), this.rnnoiseWorkletNode.connect(this.enhanceGainNode)) : this.inputGainNode.connect(this.enhanceGainNode), this.denoise = e);
4090
+ this.rnnoiseWorklet && (this.inputGainNode.disconnect(), e ? (this.rnnoiseWorkletNode = await this.rnnoiseWorklet.createRnnoiseWorkletNode(this.audioContext), this.inputGainNode.connect(this.rnnoiseWorkletNode), this.rnnoiseWorkletNode.connect(this.enhanceGainNode)) : (this.inputGainNode.connect(this.enhanceGainNode), this.rnnoiseWorklet.destroy()), this.denoise = e);
4091
+ };
4092
+ setNotEmpty = async (e = !0) => {
4093
+ this.notEmptyFilterWorklet && (e ? (this.notEmptyFilterWorkletNode = await this.notEmptyFilterWorklet.createNotEmptyFilterWorkletNode(this.audioContext), this.notEmptyFilterWorkletNode.connect(this.analyserNode), this.notEmptyFilterWorkletNode.connect(this.destinationNode)) : (this.notEmptyFilterWorkletNode?.disconnect(), this.notEmptyFilterWorklet.destroy()), this.notEmpty = e);
4079
4094
  };
4080
4095
  setInputGain = (e) => {
4081
4096
  this.inputGain = e, this.inputGainNode.gain.setValueAtTime(e, this.audioContext.currentTime);
@@ -4120,7 +4135,14 @@ var jn = class {
4120
4135
  let n = e === "bgs" ? this.bgsGainNode : this.bgmGainNode;
4121
4136
  t ? n.connect(this.destinationNode) : n.disconnect(this.destinationNode);
4122
4137
  };
4123
- }, Nn = async (e, t) => {
4138
+ destroy = async () => {
4139
+ for (let e of this.mixAudioMap.values()) e.stop(), e.disconnect();
4140
+ this.mixAudioMap.clear(), this.notEmptyFilterWorklet.destroy(), this.rnnoiseWorklet?.destroy(), this.notEmptyFilterWorkletNode = void 0, this.rnnoiseWorkletNode = void 0, this.sourceNode.disconnect(), this.inputGainNode.disconnect(), this.enhanceGainNode.disconnect(), this.bgsGainNode.disconnect(), this.bgmGainNode.disconnect(), this.analyserNode.disconnect(), this.outputGainNode.disconnect();
4141
+ for (let e of this.inputStream.getTracks()) e.stop(), this.inputStream.removeTrack(e);
4142
+ for (let e of this.outputStream.getTracks()) e.stop(), this.outputStream.removeTrack(e);
4143
+ this.notEmpty = !1, this.denoise = !1, this.mute = !0, !this.isExternalAudioContext && this.audioContext.state !== "closed" && await this.audioContext.close();
4144
+ };
4145
+ }, Rn = async (e, t) => {
4124
4146
  try {
4125
4147
  let { format: n, numberOfChannels: r, numberOfFrames: i, sampleRate: a } = t, o = e.createBuffer(r, i, a);
4126
4148
  for (let e = 0; e < r; e++) {
@@ -4151,7 +4173,7 @@ var jn = class {
4151
4173
  } catch (e) {
4152
4174
  throw console.error("Failed to convert AudioData to AudioBuffer:", e), e;
4153
4175
  }
4154
- }, Pn = class {
4176
+ }, zn = class {
4155
4177
  prAudioStream;
4156
4178
  audioContext;
4157
4179
  destination;
@@ -4160,12 +4182,12 @@ var jn = class {
4160
4182
  pendingSources = [];
4161
4183
  constructor() {}
4162
4184
  init = (e) => {
4163
- e ||= new (window.AudioContext || window.webkitAudioContext)(), this.audioContext = e, this.destination = this.audioContext.createMediaStreamDestination(), this.stream = new MediaStream(), this.stream.addTrack(this.destination.stream.getAudioTracks()[0]), this.prAudioStream = new Mn(this.stream, this.audioContext), this.nextStartTime = 0, this.pendingSources = [];
4185
+ e ||= new (window.AudioContext || window.webkitAudioContext)(), this.audioContext = e, this.destination = this.audioContext.createMediaStreamDestination(), this.stream = new MediaStream(), this.stream.addTrack(this.destination.stream.getAudioTracks()[0]), this.prAudioStream = new Ln(this.stream, this.audioContext), this.nextStartTime = 0, this.pendingSources = [];
4164
4186
  };
4165
4187
  async push(e) {
4166
4188
  let { audioData: t, playbackRate: n = 1 } = e;
4167
4189
  if (!this.audioContext || !this.destination) return;
4168
- let r = await Nn(this.audioContext, t);
4190
+ let r = await Rn(this.audioContext, t);
4169
4191
  if (t.close(), !r) return;
4170
4192
  let i = this.audioContext.createBufferSource();
4171
4193
  i.buffer = r, i.playbackRate.value = n;
@@ -4178,15 +4200,15 @@ var jn = class {
4178
4200
  }
4179
4201
  getStream = () => this.prAudioStream?.getStream();
4180
4202
  destroy() {
4181
- this.audioContext?.close(), this.audioContext = void 0, this.destination = void 0, this.nextStartTime = 0, this.prAudioStream?.stop(), this.pendingSources.forEach((e) => e.stop()), this.pendingSources = [];
4203
+ this.audioContext?.close(), this.audioContext = void 0, this.destination = void 0, this.nextStartTime = 0, this.prAudioStream?.stop(), this.prAudioStream?.destroy(), this.pendingSources.forEach((e) => e.stop()), this.pendingSources = [];
4182
4204
  }
4183
- }, Fn = (e) => {
4205
+ }, Bn = (e) => {
4184
4206
  let t = e.toLowerCase();
4185
4207
  return t.includes(".m3u8") || t.includes("hls") || t.includes("master.m3u8") || t.match(/index\d*\.m3u8/) ? "hls" : t.includes(".mpd") || t.includes("dash") ? "dash" : t.startsWith("rtmp://") || t.startsWith("rtmps://") ? "rtmp" : t.includes(".flv") || t.includes("flv") && !t.includes("flash") ? "flv" : "unknown";
4186
- }, In = (e) => {
4208
+ }, Vn = (e) => {
4187
4209
  let t = e?.getTracks() || [];
4188
4210
  for (let e of t) e.stop();
4189
- }, Ln = class {
4211
+ }, Hn = class {
4190
4212
  resolvesMap = /* @__PURE__ */ new Map();
4191
4213
  index = 0;
4192
4214
  constructor() {}
@@ -4218,7 +4240,7 @@ var jn = class {
4218
4240
  n && (clearTimeout(n.timer), n.resolve(), t.delete(e));
4219
4241
  }
4220
4242
  };
4221
- }, Rn = (e) => {
4243
+ }, Un = (e) => {
4222
4244
  let t = new DataView(e.buffer), n = 0, r, i, a;
4223
4245
  r = t.getUint32(n, !1), n += 4;
4224
4246
  {
@@ -4238,7 +4260,7 @@ var jn = class {
4238
4260
  header: i,
4239
4261
  data: a
4240
4262
  };
4241
- }, zn = class {
4263
+ }, Wn = class {
4242
4264
  #e = {
4243
4265
  timeout: 5 * 1e3,
4244
4266
  check: !1
@@ -4297,15 +4319,15 @@ var jn = class {
4297
4319
  e.name = "AbortError", this.#t.abort(e);
4298
4320
  }
4299
4321
  };
4300
- }, Bn = class {
4322
+ }, Gn = class {
4301
4323
  option = {
4302
4324
  debug: !1,
4303
4325
  frameTrack: !1
4304
4326
  };
4305
4327
  converter = "MediaStreamTrackGenerator" in window ? "generator" : "canvas";
4306
- prFetch = new zn();
4307
- getSegmentsFetch = new zn();
4308
- prResolves = new Ln();
4328
+ prFetch = new Wn();
4329
+ getSegmentsFetch = new Wn();
4330
+ prResolves = new Hn();
4309
4331
  url = "";
4310
4332
  start_resolve;
4311
4333
  demuxerWorker;
@@ -4325,7 +4347,7 @@ var jn = class {
4325
4347
  }
4326
4348
  start = async (e) => {
4327
4349
  await this.stop(), this.url = e;
4328
- let t = Fn(e);
4350
+ let t = Bn(e);
4329
4351
  if (t === "unknown") throw Error("This address cannot be parsed.");
4330
4352
  switch (this.init(t), t) {
4331
4353
  case "flv":
@@ -4338,7 +4360,7 @@ var jn = class {
4338
4360
  };
4339
4361
  stop = async () => {
4340
4362
  try {
4341
- this.url = "", clearInterval(this.hls.getSegmentsTimer), this.prFetch.stop(), this.getSegmentsFetch.stop(), this.demuxerWorker?.destroy(), this.decoderWorker?.destroy(), this.renderWorker?.destroy(), this.cutRenders = /* @__PURE__ */ new Map(), In(this.stream), this.audioPlayer?.destroy();
4363
+ this.url = "", clearInterval(this.hls.getSegmentsTimer), this.prFetch.stop(), this.getSegmentsFetch.stop(), this.demuxerWorker?.destroy(), this.decoderWorker?.destroy(), this.renderWorker?.destroy(), this.cutRenders = /* @__PURE__ */ new Map(), Vn(this.stream), this.audioPlayer?.destroy();
4342
4364
  } catch (e) {
4343
4365
  console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->pr-player: error", e);
4344
4366
  }
@@ -4390,10 +4412,10 @@ var jn = class {
4390
4412
  }
4391
4413
  };
4392
4414
  init = (e) => {
4393
- this.initRender(), this.initDecoder(e), this.initDemuxer(e), this.audioPlayer = new Pn(), this.audioPlayer.init();
4415
+ this.initRender(), this.initDecoder(e), this.initDemuxer(e), this.audioPlayer = new zn(), this.audioPlayer.init();
4394
4416
  };
4395
4417
  initDemuxer = (e) => {
4396
- this.demuxerWorker = new Cn(), this.demuxerWorker.init(e), this.demuxerWorker.on.debug = (e) => {
4418
+ this.demuxerWorker = new wn(), this.demuxerWorker.init(e), this.demuxerWorker.on.debug = (e) => {
4397
4419
  this.option.debug && this.on.debug && this.on.debug(e);
4398
4420
  }, this.demuxerWorker.on.info = (e) => {
4399
4421
  this.option.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->pr-player: info", e), this.on.demuxer.info && this.on.demuxer.info(e);
@@ -4456,7 +4478,7 @@ var jn = class {
4456
4478
  };
4457
4479
  };
4458
4480
  initDecoder = (e) => {
4459
- this.decoderWorker = new Dn(), this.decoderWorker.init(e);
4481
+ this.decoderWorker = new kn(), this.decoderWorker.init(e);
4460
4482
  let { frameTrack: t = !1 } = this.option;
4461
4483
  this.decoderWorker.setFrameTrack(t), this.decoderWorker.on.audio.decode = (e) => {
4462
4484
  this.audioPlayer?.push(e), this.on.decoder.audio && this.on.decoder.audio(e);
@@ -4469,7 +4491,7 @@ var jn = class {
4469
4491
  }, this.decoderWorker.on.nalus = async (e) => {
4470
4492
  for (let t of e) {
4471
4493
  if (t.byteLength <= 4) continue;
4472
- let { header: e, data: n } = Rn(t), { nal_unit_type: r } = e;
4494
+ let { header: e, data: n } = Un(t), { nal_unit_type: r } = e;
4473
4495
  r === 6 && this.on.decoder.sei && this.on.decoder.sei(n);
4474
4496
  }
4475
4497
  }, this.decoderWorker.on.analysis = (e) => {
@@ -4477,7 +4499,7 @@ var jn = class {
4477
4499
  };
4478
4500
  };
4479
4501
  initRender = () => {
4480
- if (this.renderWorker = new jn(), this.converter === "generator") {
4502
+ if (this.renderWorker = new Pn(), this.converter === "generator") {
4481
4503
  let e = new MediaStreamTrackGenerator({ kind: "video" }), t = new MediaStream([e]);
4482
4504
  this.renderWorker?.addCut({ writable: e.writable }), this.stream = t;
4483
4505
  } else {
@@ -4579,13 +4601,13 @@ var jn = class {
4579
4601
  }
4580
4602
  })
4581
4603
  };
4582
- }, Vn = /* @__PURE__ */ yn("Cg1DZG5EYXRhLnByb3RvEhVjb20ucXVpY2sudm9pY2UucHJvdG8iawoHU2VpRGF0YRIvCgVldmVudBgBIAEoDjIgLmNvbS5xdWljay52b2ljZS5wcm90by5FdmVudFR5cGUSDAoEZGF0YRgCIAEoDBIQCghjb21wcmVzcxgDIA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MjMuY29tLnF1aWNrLnZvaWNlLnByb3RvLkN1c3RvbUluZm8uQ3VzdG9tS2V5TWFwRW50cnkSFwoKdXBkYXRlVGltZRgDIAEoA0gAiAEBGjMKEUN1c3RvbUtleU1hcEVudHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1ZRgCIAEoCToCOAFCDQoLX3VwZGF0ZVRpbWUqIwoJRXZlbnRUeXBlEgoKBkxheW91dBAAEgoKBkN1c3RvbRABKj0KCkxheW91dFR5cGUSEQoNQXVkaW9BbmRWaWRlbxAAEg0KCU9ubHlBdWRpbxABEg0KCU9ubHlWaWRlbxACKiwKCUF1ZGlvVHlwZRIOCgpNaWNyb3Bob25lEAASDwoLU3lzdGVtVm9pY2UQASojCglWaWRlb1R5cGUSCgoGQ2FtZXJhEAASCgoGU2NyZWVuEAFCPwoWY29tLnF1aWNrLnBsYXllci5wcm90b0IHQ2RuRGF0YVoWY29tLnF1aWNrLnBsYXllci5wcm90b7oCA0NkbmIGcHJvdG8z"), qn = /* @__PURE__ */ Z(Kn, 0), Jn = /* @__PURE__ */ Z(Kn, 1), Yn = /* @__PURE__ */ Z(Kn, 5), Xn = () => ({
4583
4605
  remove: !1,
4584
4606
  isEnable: !1,
4585
4607
  updateTime: 0,
4586
4608
  isMute: !1,
4587
4609
  volume: 0
4588
- }), Kn = () => ({
4610
+ }), Zn = () => ({
4589
4611
  remove: !1,
4590
4612
  isEnable: !1,
4591
4613
  updateTime: 0,
@@ -4594,7 +4616,7 @@ var jn = class {
4594
4616
  sy: 0,
4595
4617
  sw: 0,
4596
4618
  sh: 0
4597
- }), qn = class {
4619
+ }), Qn = class {
4598
4620
  userId = "";
4599
4621
  mc_audio;
4600
4622
  mc_video;
@@ -4615,11 +4637,11 @@ var jn = class {
4615
4637
  let { type: t = 0, isEnable: n = !1, isMute: r = !1, updateTime: i, volume: a = 0 } = e;
4616
4638
  switch (t) {
4617
4639
  case 0:
4618
- if (this.mc_audio ||= Gn(), this.mc_audio.remove = !1, this.mc_audio.updateTime === Number(i)) break;
4640
+ if (this.mc_audio ||= Xn(), this.mc_audio.remove = !1, this.mc_audio.updateTime === Number(i)) break;
4619
4641
  this.mc_audio.isEnable = !!n, this.mc_audio.isMute = !!r, this.mc_audio.updateTime = Number(i), this.mc_audio.volume = Number(a);
4620
4642
  break;
4621
4643
  case 1:
4622
- if (this.ss_audio ||= Gn(), this.ss_audio.remove = !1, this.ss_audio.updateTime === Number(i)) break;
4644
+ if (this.ss_audio ||= Xn(), this.ss_audio.remove = !1, this.ss_audio.updateTime === Number(i)) break;
4623
4645
  this.ss_audio.isEnable = !!n, this.ss_audio.isMute = !!r, this.ss_audio.updateTime = Number(i), this.ss_audio.volume = Number(a);
4624
4646
  break;
4625
4647
  }
@@ -4628,11 +4650,11 @@ var jn = class {
4628
4650
  let { type: t = 0, isEnable: n, isMute: r, updateTime: i, width: a, height: o, x: s, y: c } = e;
4629
4651
  switch (t) {
4630
4652
  case 0:
4631
- if (this.mc_video ||= Kn(), this.mc_video.remove = !1, this.mc_video.updateTime === Number(i)) break;
4653
+ if (this.mc_video ||= Zn(), this.mc_video.remove = !1, this.mc_video.updateTime === Number(i)) break;
4632
4654
  this.mc_video.isEnable = !!n, this.mc_video.isMute = !!r, this.mc_video.updateTime = Number(i) || 0, this.mc_video.sx = s || 0, this.mc_video.sy = c || 0, this.mc_video.sw = a || 0, this.mc_video.sh = o || 0;
4633
4655
  break;
4634
4656
  case 1:
4635
- if (this.ss_video ||= Kn(), this.ss_video.remove = !1, this.ss_video.updateTime === Number(i)) break;
4657
+ if (this.ss_video ||= Zn(), this.ss_video.remove = !1, this.ss_video.updateTime === Number(i)) break;
4636
4658
  this.ss_video.isEnable = !!n, this.ss_video.isMute = !!r, this.ss_video.updateTime = Number(i) || 0, this.ss_video.sx = s || 0, this.ss_video.sy = c || 0, this.ss_video.sw = a || 0, this.ss_video.sh = o || 0;
4637
4659
  break;
4638
4660
  }
@@ -4642,7 +4664,7 @@ var jn = class {
4642
4664
  destroy = () => {
4643
4665
  this.mc_audio = void 0, this.mc_video = void 0, this.ss_audio = void 0, this.ss_video = void 0;
4644
4666
  };
4645
- }, Jn = (e) => {
4667
+ }, $n = (e) => {
4646
4668
  let t = 0, n = 0;
4647
4669
  for (;;) {
4648
4670
  let r = e[t];
@@ -4656,13 +4678,13 @@ var jn = class {
4656
4678
  if (n === 5) {
4657
4679
  let n = e.slice(t, t + 16), i = Array.from(n, (e) => e.toString(16).padStart(2, "0")).join("");
4658
4680
  t += 16;
4659
- let a = r - 16, o = Q(Hn, e.slice(t, t + a)), { event: s = 0 } = o, c = o.data, l;
4681
+ let a = r - 16, o = Q(qn, e.slice(t, t + a)), { event: s = 0 } = o, c = o.data, l;
4660
4682
  switch (s) {
4661
4683
  case 0:
4662
- l = Q(Un, o.data);
4684
+ l = Q(Jn, o.data);
4663
4685
  break;
4664
4686
  case 1:
4665
- l = Q(Wn, o.data);
4687
+ l = Q(Yn, o.data);
4666
4688
  break;
4667
4689
  }
4668
4690
  return {
@@ -4673,7 +4695,7 @@ var jn = class {
4673
4695
  data: l
4674
4696
  };
4675
4697
  }
4676
- }, Yn = class {
4698
+ }, er = class {
4677
4699
  option = {
4678
4700
  debug: !1,
4679
4701
  ws: "wss://livep2p.devplay.cc/websocket"
@@ -4694,7 +4716,7 @@ var jn = class {
4694
4716
  };
4695
4717
  constructor(e = {}) {
4696
4718
  let { debug: t = !1 } = e;
4697
- this.option.debug = t, this.prPlayer = new Bn({ debug: t }), this.prPlayer.on.demuxer.chunk = (e) => {}, this.prPlayer.on.decoder.sei = this.onSEI, this.prPlayer.on.decoder.analysis = this.onAnalysis;
4719
+ this.option.debug = t, this.prPlayer = new Gn({ debug: t }), this.prPlayer.on.demuxer.chunk = (e) => {}, this.prPlayer.on.decoder.sei = this.onSEI, this.prPlayer.on.decoder.analysis = this.onAnalysis;
4698
4720
  }
4699
4721
  start = async (e) => (this.stop(), this.prPlayer.start(e));
4700
4722
  stop = () => {
@@ -4712,7 +4734,7 @@ var jn = class {
4712
4734
  return Array.from(e, (e) => e.updateTime).join("_");
4713
4735
  };
4714
4736
  checkAndCreateUser = (e, t) => {
4715
- !this.usersMap.has(e) && this.usersMap.set(e, new qn());
4737
+ !this.usersMap.has(e) && this.usersMap.set(e, new Qn());
4716
4738
  let n = this.usersMap.get(e);
4717
4739
  if (n) {
4718
4740
  if (n.init(t), n.mc_video && n.mc_video.stream === void 0) {
@@ -4773,7 +4795,7 @@ var jn = class {
4773
4795
  };
4774
4796
  onSEI = (e) => {
4775
4797
  try {
4776
- let t = Jn(e);
4798
+ let t = $n(e);
4777
4799
  if (!t) return;
4778
4800
  let { event: n, data: r } = t;
4779
4801
  switch (n) {
@@ -4819,4 +4841,4 @@ var jn = class {
4819
4841
  };
4820
4842
  };
4821
4843
  //#endregion
4822
- export { Yn as QuickVoPlayer };
4844
+ export { er as QuickVoPlayer };