@vindral/web-sdk 4.6.0 → 4.7.0-1-gb0d0369b

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.
@@ -1,9 +1,9 @@
1
1
  import { n as e, t } from "./BsfwXDui.js";
2
- import { F as n, x as r } from "./BBVSf5AB.js";
3
- import { t as i } from "./DrWNJwZx.js";
4
- import { t as a } from "./BKeRxR4O.js";
2
+ import { t as n } from "./CuYn2z5X.js";
3
+ import { t as r } from "./DrWNJwZx.js";
4
+ import { t as i } from "./D1kpe8tT.js";
5
5
  //#region ../../libs/wasm-decoders/src/opus/wasm/opus.js
6
- var o = (function() {
6
+ var a = (function() {
7
7
  var e = typeof document < "u" && document.currentScript ? document.currentScript.src : void 0;
8
8
  return (function(t) {
9
9
  t = t || {};
@@ -203,9 +203,9 @@ var o = (function() {
203
203
  if (n.run = F, n.preInit) for (typeof n.preInit == "function" && (n.preInit = [n.preInit]); 0 < n.preInit.length;) n.preInit.pop()();
204
204
  return F(), t.ready;
205
205
  });
206
- })(), s, c = /* @__PURE__ */ function(e) {
206
+ })(), o, s = /* @__PURE__ */ function(e) {
207
207
  return e[e.OK = 0] = "OK", e[e["Bad argument"] = -1] = "Bad argument", e[e["Buffer too small"] = -2] = "Buffer too small", e[e["Internal error"] = -3] = "Internal error", e[e["Invalid packet"] = -4] = "Invalid packet", e[e.Unimplemented = -5] = "Unimplemented", e[e["Invalid state"] = -6] = "Invalid state", e[e["Memory allocation fail"] = -7] = "Memory allocation fail", e;
208
- }(c || {}), l = class t {
208
+ }(s || {}), c = class t {
209
209
  constructor(n, r, i) {
210
210
  e(this, "opusModule", void 0), e(this, "decoderInstance", void 0), e(this, "opusBufferPointer", void 0), e(this, "pcmBufferPointer", void 0), e(this, "channels", void 0), e(this, "pcmBufferByteSize", () => t.MAX_SAMPLES * this.channels * Float32Array.BYTES_PER_ELEMENT), e(this, "unload", () => {
211
211
  this.opusModule._free(this.opusBufferPointer), this.opusModule._free(this.pcmBufferPointer), this.opusModule._opus_decoder_destroy(this.decoderInstance);
@@ -213,15 +213,15 @@ var o = (function() {
213
213
  if (e.byteLength > t.MAX_OPUS_BUFFER) throw Error(`Opus packet too large (${e.byteLength} bytes), max ${t.MAX_OPUS_BUFFER} bytes`);
214
214
  this.opusModule.HEAPU8.set(e, this.opusBufferPointer);
215
215
  let n = this.opusModule._opus_decode_float(this.decoderInstance, this.opusBufferPointer, e.byteLength, this.pcmBufferPointer, t.MAX_SAMPLES, 0);
216
- if (n < 0) throw Error(`${c[n]} (${n})`);
216
+ if (n < 0) throw Error(`${s[n]} (${n})`);
217
217
  let r = this.pcmBufferPointer / Float32Array.BYTES_PER_ELEMENT;
218
218
  return this.opusModule.HEAPF32.subarray(r, r + n * this.channels);
219
219
  }), this.opusModule = n, this.channels = i, this.decoderInstance = this.opusModule._opus_decoder_create(r, i, 0), this.opusBufferPointer = this.opusModule._malloc(t.MAX_OPUS_BUFFER), this.pcmBufferPointer = this.opusModule._malloc(this.pcmBufferByteSize());
220
220
  }
221
221
  };
222
- s = l, e(l, "MAX_OPUS_BUFFER", 16384), e(l, "MAX_SAMPLES", 6 * 960), e(l, "create", function() {
222
+ o = c, e(c, "MAX_OPUS_BUFFER", 16384), e(c, "MAX_SAMPLES", 6 * 960), e(c, "create", function() {
223
223
  var e = t(function* (e, t) {
224
- return new s(yield o(), e, t);
224
+ return new o(yield a(), e, t);
225
225
  });
226
226
  return function(t, n) {
227
227
  return e.apply(this, arguments);
@@ -229,14 +229,14 @@ s = l, e(l, "MAX_OPUS_BUFFER", 16384), e(l, "MAX_SAMPLES", 6 * 960), e(l, "creat
229
229
  }());
230
230
  //#endregion
231
231
  //#region ../../libs/web-sdk/src/decoders/OpusDecoderContext.ts
232
- var u, d = class {
232
+ var l, u = class {
233
233
  constructor(t) {
234
- e(this, "decodedSamples", []), e(this, "decoder", void 0), e(this, "errors", new i(10)), e(this, "unload", () => {
234
+ e(this, "decodedSamples", []), e(this, "decoder", void 0), e(this, "errors", new r(10)), e(this, "unload", () => {
235
235
  this.decoder.unload();
236
236
  }), e(this, "enqueue", (e) => {
237
237
  try {
238
238
  let t = performance.now(), n = this.decoder.decode(new Uint8Array(e.data));
239
- this.decodedSamples.push(a(a({}, e), {}, {
239
+ this.decodedSamples.push(i(i({}, e), {}, {
240
240
  type: "audio",
241
241
  format: "f32",
242
242
  data: n,
@@ -248,7 +248,7 @@ var u, d = class {
248
248
  }
249
249
  }));
250
250
  } catch (e) {
251
- e instanceof Error && this.errors.push(r(!1, e));
251
+ e instanceof Error && this.errors.push(e);
252
252
  }
253
253
  }), e(this, "initSegment", n), e(this, "take", () => this.decodedSamples.shift()), this.decoder = t;
254
254
  }
@@ -256,13 +256,13 @@ var u, d = class {
256
256
  return this.errors.pop();
257
257
  }
258
258
  };
259
- u = d, e(d, "create", function() {
259
+ l = u, e(u, "create", function() {
260
260
  var e = t(function* (e, t) {
261
- return new u(yield l.create(e, t));
261
+ return new l(yield c.create(e, t));
262
262
  });
263
263
  return function(t, n) {
264
264
  return e.apply(this, arguments);
265
265
  };
266
266
  }());
267
267
  //#endregion
268
- export { d as OpusDecoderContext };
268
+ export { u as OpusDecoderContext };
package/BK-84KPi.js ADDED
@@ -0,0 +1,375 @@
1
+ import { n as e } from "./BsfwXDui.js";
2
+ import { i as t, n, r, t as i } from "./DSw1XhvD.js";
3
+ import { t as a } from "./Tj9xPXja.js";
4
+ //#region ../../libs/utils/src/formatting.ts
5
+ var o = 1e3, s = o * 1e3, c = s * 1e3, l = (e, t, n) => e % t === 0 ? e / t : (e / t).toFixed(n), u = (e, t = 1) => e >= c ? `${l(e, c, t)} Gbit/s` : e >= s ? `${l(e, s, t)} Mbit/s` : e >= o ? `${l(e, o, t)} Kbit/s` : `${e} bit/s`, d = ({ width: e, height: t }) => `${e}x${t}`, f = {
6
+ PAUSED: "paused",
7
+ MUTED: "muted",
8
+ USER_INTERACTING: "user-interacting",
9
+ IS_CASTING: "is-casting",
10
+ CAST_AVAILABLE: "cast-available",
11
+ CAST_RECEIVER_NAME: "cast-receiver-name",
12
+ BUFFERING: "buffering",
13
+ UI_LOCKED: "ui-locked",
14
+ HIDE_UI_ON_PAUSE: "hide-ui-on-pause",
15
+ FULLSCREEN: "is-fullscreen",
16
+ FULLSCREEN_FALLBACK: "is-fullscreen-fallback",
17
+ RENDITION_LEVELS: "rendition-levels",
18
+ RENDITION_LEVEL: "rendition-level",
19
+ MAX_VIDEO_BITRATE: "max-video-bit-rate",
20
+ MAX_INITIAL_BITRATE: "max-initial-bit-rate",
21
+ ABR_ENABLED: "abr-enabled",
22
+ SIZE_BASED_RESOLUTION_CAP_ENABLED: "size-based-resolution-cap-enabled",
23
+ CHANNELS: "channels",
24
+ CHANNEL_ID: "channel-id",
25
+ CHANNEL_GROUP_ID: "channel-group-id",
26
+ PIP_AVAILABLE: "pip-available",
27
+ IS_PIP: "is-pip",
28
+ AIRPLAY_AVAILABLE: "airplay-available",
29
+ IS_AIRPLAYING: "is-airplaying",
30
+ MEDIA: "media",
31
+ LANGUAGES: "languages",
32
+ LANGUAGE: "language",
33
+ TEXT_TRACKS: "text-tracks",
34
+ TEXT_TRACK: "text-track",
35
+ NEEDS_USER_INPUT_VIDEO: "needs-user-input-video",
36
+ NEEDS_USER_INPUT_AUDIO: "needs-user-input-audio",
37
+ AUTHENTICATION_TOKEN: "authentication-token",
38
+ VOLUME: "volume",
39
+ VOLUME_LEVEL: "volume-level",
40
+ CAST_ENABLED: "cast",
41
+ AIRPLAY_ENABLED: "airplay",
42
+ PIP_ENABLED: "pip",
43
+ FULLSCREEN_ENABLED: "fullscreen",
44
+ DOUBLE_CLICK_FULLSCREEN_ENABLED: "double-click-fullscreen",
45
+ VU_METER_ENABLED: "vu-meter",
46
+ TIMESHIFT_ENABLED: "timeshift",
47
+ TIMESHIFT_POSITION: "timeshift-position",
48
+ TIMELINE_MARKERS: "timeline-markers",
49
+ POSTER_SRC: "poster-src",
50
+ DURATION: "duration",
51
+ DEBUG_PANEL_OPEN: "debug-panel-open",
52
+ TARGET_BUFFER_TIME: "target-buffer-time",
53
+ DRIFT: "drift",
54
+ PLAYBACK_LATENCY: "playback-latency",
55
+ CONNECTION_STATE: "connection-state"
56
+ }, p = Object.values(f), m = {
57
+ PLAY: "play",
58
+ PAUSE: "pause",
59
+ MUTE: "mute",
60
+ UNMUTE: "unmute",
61
+ LOCK_UI: "lock-ui",
62
+ UNLOCK_UI: "unlock-ui",
63
+ ENTER_FULLSCREEN: "enter-fullscreen",
64
+ EXIT_FULLSCREEN: "exit-fullscreen",
65
+ SET_RENDITION: "set-rendition",
66
+ SET_ABR_MODE: "set-abr-mode",
67
+ SET_SIZE_BASED_RESOLUTION_CAP_MODE: "set-size-based-resolution-cap-mode",
68
+ CHANNEL_GRID_OPENED: "channel-grid-opened",
69
+ CHANNEL_GRID_CLOSED: "channel-grid-closed",
70
+ ENTER_PIP: "enter-pip",
71
+ EXIT_PIP: "exit-pip",
72
+ REQUEST_AIRPLAY: "request-airplay",
73
+ SET_LANGUAGE: "set-language",
74
+ SET_TEXT_TRACK: "set-text-track",
75
+ REQUEST_USER_INPUT: "request-user-input",
76
+ SET_VOLUME: "set-volume",
77
+ SEEK: "seek",
78
+ GO_LIVE: "go-live",
79
+ TOGGLE_DEBUG_PANEL: "toggle-debug-panel",
80
+ SET_TARGET_BUFFER_TIME: "set-target-buffer-time"
81
+ };
82
+ //#endregion
83
+ //#region ../../libs/player-next/src/utils/vindralAttributesUtils.ts
84
+ function h(e) {
85
+ return e === "audio" || e === "video" || e === "audio+video" ? e : "audio+video";
86
+ }
87
+ function g(e) {
88
+ return e === "trace" || e === "debug" || e === "info" || e === "warn" || e === "error" || e === "off" ? e : "off";
89
+ }
90
+ function _(e) {
91
+ if (e === null) return;
92
+ let t = e.split(",").map((e) => e.trim()).filter((e) => e === "h264" || e === "h265" || e === "av1");
93
+ if (t.length !== 0) return t;
94
+ }
95
+ function v(e) {
96
+ if (e !== null) try {
97
+ let t = JSON.parse(e);
98
+ if (typeof t == "object" && t) {
99
+ let e = t;
100
+ if (typeof e.width == "number" && typeof e.height == "number") return e;
101
+ }
102
+ } catch (e) {
103
+ return;
104
+ }
105
+ }
106
+ function y(e) {
107
+ if (e !== null) try {
108
+ let t = JSON.parse(e);
109
+ if (typeof t == "object" && t) return t;
110
+ } catch (e) {
111
+ return;
112
+ }
113
+ }
114
+ function b(e) {
115
+ if (e === null) return;
116
+ let t = parseFloat(e);
117
+ return Number.isNaN(t) ? void 0 : t;
118
+ }
119
+ function x(e) {
120
+ return typeof e == "string";
121
+ }
122
+ function S(e, t) {
123
+ if (e === null) return t == null ? void 0 : t;
124
+ let n = e.toLowerCase();
125
+ return n === "false" ? !1 : n === "true" || n === "" || t == null ? !0 : t;
126
+ }
127
+ function C(e, t) {
128
+ return e === null ? t == null ? void 0 : t : e === "" || e.toLowerCase() === "true" ? !0 : e.toLowerCase() === "false" ? !1 : e;
129
+ }
130
+ function w(e) {
131
+ if (e === null) return;
132
+ let t = {}, n = e.split(",");
133
+ for (let e of n) {
134
+ let [n, r] = e.split(":");
135
+ n && r && (t[n.trim()] = r.trim());
136
+ }
137
+ return Object.keys(t).length > 0 ? t : void 0;
138
+ }
139
+ function T(e) {
140
+ if (e === null) return;
141
+ let t = e.split(",").map((e) => e.trim()).filter((e) => e.length > 0);
142
+ return t.length > 0 ? t : void 0;
143
+ }
144
+ //#endregion
145
+ //#region ../../libs/player-next/src/components/tooltip.ts
146
+ var E = "\n background: var(--bg-subtle, rgba(0, 0, 0, 0.8));\n color: var(--fg-strong, #fff);\n font-family: var(--ui-font, inherit);\n font-size: 12px;\n font-weight: normal;\n line-height: 1.2;\n padding: 4px 8px;\n border-radius: 4px;\n white-space: nowrap;\n", D = `
147
+ .tooltip {
148
+ ${E}
149
+ --_tooltip-gap: 4px;
150
+ /* Hit-testable only while the controls are, so the pointer can move onto it (WCAG 1.4.13, hoverable). */
151
+ pointer-events: inherit;
152
+ display: var(--tooltip-display, block);
153
+ position: absolute;
154
+ left: 50%;
155
+ bottom: calc(100% + var(--_tooltip-gap));
156
+ transform: translateX(calc(-50% + var(--tooltip-shift, 0px)));
157
+ z-index: 1;
158
+ opacity: 0;
159
+ visibility: hidden;
160
+ transition: opacity 0.15s, visibility 0s 0.15s;
161
+ }
162
+
163
+ /* Bridges the gap so moving from the control onto the tooltip keeps it open. */
164
+ .tooltip::after {
165
+ content: "";
166
+ position: absolute;
167
+ left: 0;
168
+ right: 0;
169
+ top: 100%;
170
+ height: var(--_tooltip-gap);
171
+ }
172
+
173
+ .tooltip[hidden],
174
+ :host([tooltip-dismissed]) .tooltip {
175
+ display: none;
176
+ }
177
+
178
+ @media (hover: hover) and (pointer: fine) {
179
+ :host(:hover:not([disabled])) .tooltip {
180
+ opacity: 1;
181
+ visibility: visible;
182
+ transition: opacity 0.15s 0.3s, visibility 0s 0.3s;
183
+ }
184
+ }
185
+ `;
186
+ function O(e, t) {
187
+ let n = !1, r = !1, i = () => {
188
+ !n && !r && e.removeAttribute("tooltip-dismissed");
189
+ }, a = () => {
190
+ let e = getComputedStyle(t);
191
+ return e.display !== "none" && e.visibility === "visible";
192
+ }, o = (t) => {
193
+ t.key === "Escape" && (n || r) && a() && e.setAttribute("tooltip-dismissed", "");
194
+ }, s = () => {
195
+ n = !0;
196
+ }, c = () => {
197
+ n = !1, i();
198
+ }, l = () => {
199
+ r = !0;
200
+ }, u = (t) => {
201
+ e.contains(t.relatedTarget) || (r = !1, i());
202
+ };
203
+ return document.addEventListener("keydown", o), e.addEventListener("mouseenter", s), e.addEventListener("mouseleave", c), e.addEventListener("focusin", l), e.addEventListener("focusout", u), () => {
204
+ document.removeEventListener("keydown", o), e.removeEventListener("mouseenter", s), e.removeEventListener("mouseleave", c), e.removeEventListener("focusin", l), e.removeEventListener("focusout", u);
205
+ };
206
+ }
207
+ //#endregion
208
+ //#region ../../libs/player-next/src/components/VindralButton.ts
209
+ var k = document.createElement("template");
210
+ k.innerHTML = `
211
+ <style>
212
+ :host {
213
+ cursor: pointer;
214
+ color: var(--fg-strong);
215
+ padding: var(--button-padding) !important;
216
+ background: transparent;
217
+ transition: background 0.2s linear;
218
+ -webkit-tap-highlight-color: transparent;
219
+ position: relative;
220
+ }
221
+
222
+ :host(:focus-visible) {
223
+ box-shadow: inset 0 0 0 2px var(--fg-strong);
224
+ outline: 0;
225
+ }
226
+
227
+ :host(:where(:focus)) {
228
+ box-shadow: none;
229
+ outline: 0;
230
+ }
231
+
232
+ @media (hover: hover) and (pointer: fine) {
233
+ :host(:hover) {
234
+ background: rgba(255, 255, 255, 0.15);
235
+ }
236
+ }
237
+
238
+ :host(:active) {
239
+ background: rgba(255, 255, 255, 0.25);
240
+ }
241
+
242
+ :host(:active) svg {
243
+ scale: 0.9;
244
+ }
245
+
246
+ :host([disabled]) {
247
+ opacity: 0.5;
248
+ background: transparent;
249
+ }
250
+
251
+ slot > svg {
252
+ display: block;
253
+ width: var(--button-icon-size);
254
+ height: var(--button-icon-size);
255
+ }
256
+
257
+ ${D}
258
+
259
+ :host([aria-expanded="true"]) .tooltip {
260
+ display: none;
261
+ }
262
+
263
+ .tooltip[below] {
264
+ bottom: auto;
265
+ top: calc(100% + var(--_tooltip-gap));
266
+ }
267
+
268
+ .tooltip[below]::after {
269
+ top: auto;
270
+ bottom: 100%;
271
+ }
272
+
273
+ :host(:focus-visible:not([disabled])) .tooltip {
274
+ opacity: 1;
275
+ visibility: visible;
276
+ transition-delay: 0s;
277
+ }
278
+ </style>
279
+ <span class="tooltip" aria-hidden="true" hidden></span>
280
+ `;
281
+ var A = /* @__PURE__ */ new WeakMap(), j = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap(), N = /* @__PURE__ */ new WeakSet(), P = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), R = class extends HTMLElement {
282
+ constructor() {
283
+ super(), a(this, N), t(this, A, null), t(this, j, void 0), t(this, M, void 0), t(this, P, () => {
284
+ if (i(j, this).style.setProperty("--tooltip-shift", "0px"), i(j, this).removeAttribute("below"), !i(A, this)) return;
285
+ let e = i(A, this).getBoundingClientRect(), t = i(j, this).getBoundingClientRect();
286
+ if (t.width === 0) return;
287
+ t.top < e.top && i(j, this).setAttribute("below", "");
288
+ let n = e.left - t.left, r = t.right - e.right, a = 0;
289
+ n > 0 ? a = n : r > 0 && (a = -r), i(j, this).style.setProperty("--tooltip-shift", `${a}px`);
290
+ }), t(this, F, (e) => {
291
+ e.composedPath().includes(i(j, this)) || this.handleClick(e);
292
+ }), t(this, I, (e) => {
293
+ let { key: t } = e;
294
+ if (!this.keysUsed.includes(t)) {
295
+ this.removeEventListener("keyup", i(I, this));
296
+ return;
297
+ }
298
+ this.handleClick(e);
299
+ }), t(this, L, (e) => {
300
+ let { metaKey: t, altKey: n, key: r } = e;
301
+ if (t || n || !this.keysUsed.includes(r)) {
302
+ this.removeEventListener("keyup", i(I, this));
303
+ return;
304
+ }
305
+ this.addEventListener("keyup", i(I, this), { once: !0 });
306
+ });
307
+ let e = this.attachShadow({ mode: "open" });
308
+ e.appendChild(k.content.cloneNode(!0)), n(j, this, e.querySelector(".tooltip")), this.addEventListener("mouseenter", i(P, this)), this.addEventListener("focus", i(P, this));
309
+ }
310
+ get keysUsed() {
311
+ return ["Enter", " "];
312
+ }
313
+ connectedCallback() {
314
+ var e;
315
+ n(A, this, this.closest("vindral-controller")), (e = i(A, this)) == null || e.connectListener(this), n(M, this, O(this, i(j, this))), this.hasAttribute("disabled") || this.enable(), this.setAttribute("role", "button");
316
+ }
317
+ enable() {
318
+ this.addEventListener("click", i(F, this)), this.addEventListener("keydown", i(L, this)), this.tabIndex = 0;
319
+ }
320
+ disable() {
321
+ this.removeEventListener("click", i(F, this)), this.removeEventListener("keydown", i(L, this)), this.removeEventListener("keyup", i(I, this)), this.tabIndex = -1;
322
+ }
323
+ disconnectedCallback() {
324
+ var e, t;
325
+ (e = i(A, this)) == null || e.disconnectListener(this), (t = i(M, this)) == null || t.call(this);
326
+ }
327
+ attributeChangedCallback(e, t, n) {
328
+ e === "disabled" && (x(n) ? this.disable() : this.enable()), e === "aria-label" && (i(j, this).textContent = n == null ? "" : n, i(j, this).hidden = !n, r(N, this, z).call(this)), e === "aria-expanded" && n !== "true" && r(N, this, z).call(this);
329
+ }
330
+ };
331
+ function z() {
332
+ this.matches(":hover, :focus") && i(P, this).call(this);
333
+ }
334
+ e(R, "observedAttributes", [
335
+ "disabled",
336
+ "aria-label",
337
+ "aria-expanded"
338
+ ]);
339
+ //#endregion
340
+ //#region \0@oxc-project+runtime@0.115.0/helpers/getPrototypeOf.js
341
+ function B(e) {
342
+ return B = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) {
343
+ return e.__proto__ || Object.getPrototypeOf(e);
344
+ }, B(e);
345
+ }
346
+ //#endregion
347
+ //#region \0@oxc-project+runtime@0.115.0/helpers/superPropBase.js
348
+ function V(e, t) {
349
+ for (; !{}.hasOwnProperty.call(e, t) && (e = B(e)) !== null;);
350
+ return e;
351
+ }
352
+ //#endregion
353
+ //#region \0@oxc-project+runtime@0.115.0/helpers/get.js
354
+ function H() {
355
+ return H = typeof Reflect < "u" && Reflect.get ? Reflect.get.bind() : function(e, t, n) {
356
+ var r = V(e, t);
357
+ if (r) {
358
+ var i = Object.getOwnPropertyDescriptor(r, t);
359
+ return i.get ? i.get.call(arguments.length < 3 ? e : n) : i.value;
360
+ }
361
+ }, H.apply(null, arguments);
362
+ }
363
+ //#endregion
364
+ //#region \0@oxc-project+runtime@0.115.0/helpers/superPropGet.js
365
+ function U(e, t, n, r) {
366
+ var i = H(B(1 & r ? e.prototype : e), t, n);
367
+ return 2 & r && typeof i == "function" ? function(e) {
368
+ return i.apply(n, e);
369
+ } : i;
370
+ }
371
+ //#endregion
372
+ //#region ../../libs/player-next/src/constants.ts
373
+ var W = 5e3, G = "https://lb.cdn.vindral.com";
374
+ //#endregion
375
+ export { d as C, u as S, T as _, E as a, f as b, x as c, C as d, g as f, b as g, h, R as i, y as l, v as m, G as n, D as o, w as p, U as r, O as s, W as t, S as u, _ as v, p as x, m as y };
package/BdMchGeH.js ADDED
@@ -0,0 +1,169 @@
1
+ import { n as e } from "./BsfwXDui.js";
2
+ import { i as t, n, t as r } from "./DSw1XhvD.js";
3
+ //#region ../../libs/utils/src/BitReader.ts
4
+ var i = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new WeakMap(), o = /* @__PURE__ */ new WeakMap(), s = class {
5
+ constructor(s, c = 0) {
6
+ t(this, i, void 0), t(this, a, void 0), t(this, o, void 0), e(this, "position", () => r(o, this)), e(this, "peekBit", () => this.getBit(r(a, this), r(o, this))), e(this, "readBit", () => {
7
+ var e;
8
+ let t = this.peekBit();
9
+ return n(o, this, (e = r(o, this), e++, e)), t;
10
+ }), e(this, "readBits", (e) => {
11
+ let t = 0;
12
+ for (let c = 0; c < e; c++) {
13
+ var i, s;
14
+ t = t << 1 | (this.getBit(r(a, this), (n(o, this, (i = r(o, this), s = i++, i)), s)) ? 1 : 0);
15
+ }
16
+ return t;
17
+ }), e(this, "remainingBits", () => r(a, this).byteLength * 8 - r(o, this)), e(this, "readSignedExpGolomb", () => {
18
+ let e = this.readUnsignedExpGolomb();
19
+ return e & 1 ? (e + 1) / 2 : -(e / 2);
20
+ }), e(this, "readUnsignedExpGolomb", () => {
21
+ var e, t;
22
+ let i = 0;
23
+ for (; this.getBit(r(a, this), (n(o, this, (e = r(o, this), t = e++, e)), t)) === 0;) i++;
24
+ let s = 1 << i;
25
+ for (let e = i - 1; e >= 0; e--) {
26
+ var c, l;
27
+ s |= this.getBit(r(a, this), (n(o, this, (c = r(o, this), l = c++, c)), l)) << e;
28
+ }
29
+ return s - 1;
30
+ }), e(this, "getBit", (e, t) => {
31
+ if (e.byteLength * 8 <= t) throw Error("BitReader: Out of bounds");
32
+ return e[t >> 3] >> 7 - (t & 7) & 1;
33
+ }), n(i, this, s), n(a, this, new Uint8Array(r(i, this))), n(o, this, c);
34
+ }
35
+ bytes() {
36
+ return r(a, this);
37
+ }
38
+ }, c = [
39
+ 96e3,
40
+ 88200,
41
+ 64e3,
42
+ 48e3,
43
+ 44100,
44
+ 32e3,
45
+ 24e3,
46
+ 22050,
47
+ 16e3,
48
+ 12e3,
49
+ 11025,
50
+ 8e3,
51
+ 7350
52
+ ], l = (e, t) => {
53
+ let n = c.indexOf(t);
54
+ if (n === -1 || e < 1 || e > 8 || e === 7) return;
55
+ let r = /* @__PURE__ */ new ArrayBuffer(2), i = new Uint8Array(r), a = e === 8 ? 7 : e;
56
+ return i[0] = 16 | n >> 1, i[1] = (n & 1) << 7 | a << 3, r;
57
+ }, u = [
58
+ void 0,
59
+ 1,
60
+ 2,
61
+ 3,
62
+ 4,
63
+ 5,
64
+ 6,
65
+ 8,
66
+ void 0,
67
+ void 0,
68
+ void 0,
69
+ 7,
70
+ 8,
71
+ 24,
72
+ 8
73
+ ], d = 5, f = 29, p = new Set([
74
+ 1,
75
+ 2,
76
+ 3,
77
+ 4
78
+ ]), m = 695, h = 1352, g = (e) => {
79
+ let t = new s(e.slice().buffer), n = (e) => t.remainingBits() >= e, r = () => {
80
+ if (!n(5)) return;
81
+ let e = t.readBits(5);
82
+ return e === 31 ? n(6) ? 32 + t.readBits(6) : void 0 : e;
83
+ }, i = () => {
84
+ if (!n(4)) return;
85
+ let e = t.readBits(4);
86
+ return e === 15 ? n(24) ? t.readBits(24) : void 0 : c[e];
87
+ }, a = r(), o = i();
88
+ if (!a || !o || !n(4)) return;
89
+ let l = t.readBits(4), g = u[l];
90
+ if (a !== d && a !== f) {
91
+ if (!p.has(a) || l === 0 || !n(2)) return {
92
+ sampleRate: o,
93
+ channelCount: g
94
+ };
95
+ if (t.readBits(1), t.readBits(1) === 1) {
96
+ if (!n(14)) return {
97
+ sampleRate: o,
98
+ channelCount: g
99
+ };
100
+ t.readBits(14);
101
+ }
102
+ if (!n(1)) return {
103
+ sampleRate: o,
104
+ channelCount: g
105
+ };
106
+ if (t.readBits(1) === 1) {
107
+ if (!n(1)) return {
108
+ sampleRate: o,
109
+ channelCount: g
110
+ };
111
+ t.readBits(1);
112
+ }
113
+ if (!n(16) || t.readBits(11) !== m || r() !== d || !n(1) || t.readBits(1) === 0) return {
114
+ sampleRate: o,
115
+ channelCount: g
116
+ };
117
+ let e = i();
118
+ return e ? {
119
+ sampleRate: e,
120
+ channelCount: n(12) && t.readBits(11) === h && t.readBits(1) === 1 && g === 1 ? 2 : g
121
+ } : {
122
+ sampleRate: o,
123
+ channelCount: g
124
+ };
125
+ }
126
+ let _ = i();
127
+ if (!(!_ || r() === void 0)) return a === f && g === 1 && (g = 2), {
128
+ sampleRate: _,
129
+ channelCount: g
130
+ };
131
+ }, _ = (e) => {
132
+ if (!e) return;
133
+ let t = e.channelMappingTable, n = new Uint8Array(19 + t.byteLength), r = new DataView(n.buffer, n.byteOffset, n.byteLength);
134
+ return n.set([
135
+ 79,
136
+ 112,
137
+ 117,
138
+ 115,
139
+ 72,
140
+ 101,
141
+ 97,
142
+ 100
143
+ ], 0), r.setUint8(8, 1), r.setUint8(9, e.channelCount), r.setUint16(10, e.preSkip, !0), r.setUint32(12, e.inputSampleRate, !0), r.setInt16(16, e.outputGain, !0), r.setUint8(18, e.channelMappingFamily), t.byteLength > 0 && n.set(t, 19), n;
144
+ }, v = (e, t) => {
145
+ if (e < 1 || e > 2) return;
146
+ let n = new Uint8Array(19), r = new DataView(n.buffer, n.byteOffset, n.byteLength);
147
+ return n.set([
148
+ 79,
149
+ 112,
150
+ 117,
151
+ 115,
152
+ 72,
153
+ 101,
154
+ 97,
155
+ 100
156
+ ]), r.setUint8(8, 1), r.setUint8(9, e), r.setUint16(10, 3840, !0), r.setUint32(12, t, !0), r.setInt16(16, 0, !0), r.setUint8(18, 0), n;
157
+ }, y = (e) => {
158
+ switch (e) {
159
+ case "opus": return "opus";
160
+ case "aac": return "mp4a.40.2";
161
+ case "mp3": return "mp3";
162
+ default: {
163
+ let t = e;
164
+ throw Error(`Unsupported audio codec: ${t}`);
165
+ }
166
+ }
167
+ };
168
+ //#endregion
169
+ export { g as a, l as i, v as n, s as o, _ as r, y as t };