@vindral/web-sdk 4.8.2 → 4.8.3

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.8.2",
2
+ "version": "4.8.3",
3
3
  "name": "@vindral/web-sdk",
4
4
  "main": "./legacy.umd.js",
5
5
  "module": "./legacy.es.js",
package/player.d.ts CHANGED
@@ -388,7 +388,14 @@ interface Options {
388
388
  * false to stop reconnecting. It can also return a promise with true or false if it needs
389
389
  * to make any async calls before determining wether to reconnect.
390
390
  *
391
- * The default reconnect handler allows 30 reconnects before stopping.
391
+ * The default reconnect handler allows 30 reconnects before stopping. If a custom handler throws or its promise
392
+ * rejects, for example when a fetch fails during the outage, the default rule decides that attempt instead, counting
393
+ * only the failed reconnects since the handler last answered. The first such failure of a player instance is
394
+ * reported as an uncaught error, with the original as its `cause`.
395
+ *
396
+ * Set your own limit in the handler, for example `({ reconnectRetries }) => reconnectRetries < 100`. The fallback for
397
+ * a failing handler is fixed; to keep your limit when, say, a fetch inside the handler fails, catch that failure and
398
+ * return your own answer.
392
399
  *
393
400
  * Note: the ReconnectState gets reset every time the client instance makes a successful connection.
394
401
  * This means the default reconnect handler will only stop reconnecting after 30 _consecutive_ failed connections.
@@ -1143,6 +1150,8 @@ declare class Vindral extends Emitter<PublicVindralEvents> {
1143
1150
  private offscreenCanvasElement?;
1144
1151
  private webCodecsRenditionSupport;
1145
1152
  private hasCalledConnect;
1153
+ /** The next join is a rejoin after congestion or fatal QoS, which asks for a short burst. */
1154
+ private shortBurstRejoin;
1146
1155
  /** The last upgrade check held, so the hold is logged once. */
1147
1156
  private upgradeHeld;
1148
1157
  private hasRequestedAudioSession;
@@ -1464,6 +1473,12 @@ declare class Vindral extends Emitter<PublicVindralEvents> {
1464
1473
  * since another backlog or stall costs more than a few seconds at low quality.
1465
1474
  */
1466
1475
  private lowerTargetForRejoin;
1476
+ /**
1477
+ * The join burst: the buffer target, or 0 when bursts are off. A link too thin for the target's burst, or a rejoin
1478
+ * after congestion or fatal QoS, gets a short burst instead, so it starts in the edge's live group without
1479
+ * resending history into a link that can't take it.
1480
+ */
1481
+ private joinBurstMs;
1467
1482
  private onPingTimeout;
1468
1483
  private emitLanguagesIfChanged;
1469
1484
  private updateTextTracks;
package/player.js CHANGED
@@ -1,4 +1,3 @@
1
- import { t as e } from "./DyoeX7Rz.js";
2
- import "./DTFc40PP.js";
3
- import { t } from "./BmhvfDax.js";
4
- export { t as registerComponents, e as registerDebugComponents };
1
+ import { t as e } from "./CmTzPIcG.js";
2
+ import { t } from "./CukMAxok.js";
3
+ export { e as registerComponents, t as registerDebugComponents };
package/react.d.ts CHANGED
@@ -390,7 +390,14 @@ interface Options {
390
390
  * false to stop reconnecting. It can also return a promise with true or false if it needs
391
391
  * to make any async calls before determining wether to reconnect.
392
392
  *
393
- * The default reconnect handler allows 30 reconnects before stopping.
393
+ * The default reconnect handler allows 30 reconnects before stopping. If a custom handler throws or its promise
394
+ * rejects, for example when a fetch fails during the outage, the default rule decides that attempt instead, counting
395
+ * only the failed reconnects since the handler last answered. The first such failure of a player instance is
396
+ * reported as an uncaught error, with the original as its `cause`.
397
+ *
398
+ * Set your own limit in the handler, for example `({ reconnectRetries }) => reconnectRetries < 100`. The fallback for
399
+ * a failing handler is fixed; to keep your limit when, say, a fetch inside the handler fails, catch that failure and
400
+ * return your own answer.
394
401
  *
395
402
  * Note: the ReconnectState gets reset every time the client instance makes a successful connection.
396
403
  * This means the default reconnect handler will only stop reconnecting after 30 _consecutive_ failed connections.
@@ -1145,6 +1152,8 @@ declare class Vindral extends Emitter<PublicVindralEvents> {
1145
1152
  private offscreenCanvasElement?;
1146
1153
  private webCodecsRenditionSupport;
1147
1154
  private hasCalledConnect;
1155
+ /** The next join is a rejoin after congestion or fatal QoS, which asks for a short burst. */
1156
+ private shortBurstRejoin;
1148
1157
  /** The last upgrade check held, so the hold is logged once. */
1149
1158
  private upgradeHeld;
1150
1159
  private hasRequestedAudioSession;
@@ -1466,6 +1475,12 @@ declare class Vindral extends Emitter<PublicVindralEvents> {
1466
1475
  * since another backlog or stall costs more than a few seconds at low quality.
1467
1476
  */
1468
1477
  private lowerTargetForRejoin;
1478
+ /**
1479
+ * The join burst: the buffer target, or 0 when bursts are off. A link too thin for the target's burst, or a rejoin
1480
+ * after congestion or fatal QoS, gets a short burst instead, so it starts in the edge's live group without
1481
+ * resending history into a link that can't take it.
1482
+ */
1483
+ private joinBurstMs;
1469
1484
  private onPingTimeout;
1470
1485
  private emitLanguagesIfChanged;
1471
1486
  private updateTextTracks;
package/style.css ADDED
@@ -0,0 +1,2 @@
1
+ ._buffering_1ccif_1{opacity:1;pointer-events:none;background-color:rgba(0,0,0,.3);border-radius:100%;justify-content:center;align-items:center;transition:opacity .25s 1s;display:flex;position:absolute;top:16px;left:16px}._buffering-fullscreen_1ccif_16{border-radius:0;width:100%;height:100%;transition-delay:0s;top:0;left:0}._hidden_1ccif_25{pointer-events:none;opacity:0;transition-delay:0s}._buffering-indicator_1ccif_31{background-color:#fff;border-radius:40px;width:40px;height:40px;animation:1s ease-in-out infinite _scaleout_1ccif_1}@-webkit-keyframes _scaleout_1ccif_1{0%{-webkit-transform:scale(0)}to{opacity:0;-webkit-transform:scale(1)}}@keyframes _scaleout_1ccif_1{0%{transform:scale(0)}to{opacity:0;transform:scale(1)}}._bar_qm7bl_1{z-index:11;background-color:rgba(0,0,0,.6);border-radius:10px;max-width:900px;height:40px;margin:0 auto;padding:0 10px;transition:all .25s;display:flex;position:absolute;bottom:2em;left:2em;right:2em;transform:translate(0,0);box-shadow:inset 0 1px rgba(255,255,255,.2),0 13px 27px -5px rgba(50,50,93,.25),0 8px 16px -8px rgba(0,0,0,.3)}@media only screen and (max-width:576px){._bar_qm7bl_1{border-radius:0;padding:0;bottom:0;left:0;right:0}}@media only screen and (max-width:360px){._bar_qm7bl_1,._bar_qm7bl_1 svg{height:30px}}@media only screen and (max-width:200px){._bar_qm7bl_1{zoom:.7}}._hidden_qm7bl_47{opacity:0;transform:translate3d(0,40px,400px)}._bar_qm7bl_1 google-cast-launcher{color:#fff;cursor:pointer;--disconnected-color:white;padding:7px}._channel-selection-item_suenn_1{cursor:pointer;border:2px solid transparent;border-radius:.5em;padding:8px}._channel-selection-item-selected_suenn_8{background-color:rgba(0,128,255,.2);border-color:#fff}._channel-selection-item-image_suenn_13{position:absolute;top:0;left:0}._withThumbnails_suenn_19{text-align:center;background-size:cover;margin:.5em;font-weight:700}@media only screen and (max-width:260px){._hide-on-small_suenn_27{display:none}}._icon-button_5fg7v_1{transition:transform .25s}._icon-button_5fg7v_1:hover{transform:scale(.9)}._icon-button_5fg7v_1:active{transform:scale(.8)}._list_1vkum_1{background-color:rgba(0,0,0,.6);border-radius:10px;transition:all .25s;overflow:hidden;box-shadow:inset 0 1px rgba(255,255,255,.2),0 13px 27px -5px rgba(50,50,93,.25),0 8px 16px -8px rgba(0,0,0,.3)}._list-item_1vkum_12{color:#fff}._list-item-disabled_1vkum_16{opacity:.5}._hidden_1vkum_20{display:none}._container_13xnz_1{cursor:pointer;position:relative}._hidden_13xnz_6{display:none}._list_13xnz_10{width:150px;position:absolute;bottom:44px;left:22px;overflow-y:auto;transform:translate(-50%)}._language-button-item_1dov5_1{cursor:pointer;padding:8px}._language-button-item-selected_1dov5_6{background-color:rgba(0,128,255,.2)}._item_5vhyo_1{cursor:pointer;padding:8px}._item-selected_5vhyo_6{background-color:rgba(0,128,255,.2)}._title_5vhyo_10{display:block}._sub-title_5vhyo_14{opacity:.9;font-size:12px;display:block}@media only screen and (max-width:260px){._hide-on-small_5vhyo_21{display:none}}._text-track-button-item_1ry10_1{cursor:pointer;padding:8px}._text-track-button-item-selected_1ry10_6{background-color:rgba(0,128,255,.2)}._castoverlay_1n91l_1{text-align:center;pointer-events:none;background:rgba(0,0,0,.5);width:100%;padding:5% 0;font-size:20px;position:absolute;top:0;left:0;box-shadow:0 0 20px #000}@media only screen and (max-width:600px){._castoverlay_1n91l_1{font-size:14px}}._hidden_1n91l_20{display:none}@keyframes _show-and-scaleup_4ybkq_1{0%{opacity:0;transform:scale(0)}20%{opacity:0}70%{opacity:1}to{opacity:1;transform:scale(1)}}._button_4ybkq_21{opacity:0;color:#fff;text-align:center;cursor:pointer;background:#222;border:2px solid transparent;border-radius:.5em;justify-content:flex-start;align-items:flex-end;width:14em;max-width:20vw;height:7em;margin-bottom:.5em;padding:.5em .75em;font-size:1em;font-weight:700;animation-name:_show-and-scaleup_4ybkq_1;animation-duration:.5s;animation-delay:0s;animation-fill-mode:forwards;display:flex;position:relative;overflow:hidden;box-shadow:inset 0 1px rgba(255,255,255,.2),0 13px 27px -5px rgba(50,50,93,.25),0 8px 16px -8px rgba(0,0,0,.3)}._button_4ybkq_21 span{z-index:99;pointer-events:none;width:100%}@media only screen and (max-width:400px){._button_4ybkq_21 span{display:none}}@media only screen and (max-width:576px){._button_4ybkq_21{width:7em;height:3.5em;margin-bottom:.3em;padding:.3em .5em}._button_4ybkq_21 span{font-size:.5em}}@media only screen and (max-width:768px){._button_4ybkq_21 span{font-size:.7em}}@media only screen and (max-width:768px) and (min-width:576px){._button_4ybkq_21{width:10em;height:5em;margin-bottom:.4em;padding:.4em .6em}}._image_4ybkq_98{opacity:1;background-size:cover;background-clip:padding-box;transition:opacity 3s;position:absolute;top:0;bottom:0;left:0;right:0}._overlay_4ybkq_118{opacity:0;background:rgba(0,0,0,.4) 50%/2em no-repeat;position:absolute;top:0;bottom:0;left:0;right:0}._overlay_4ybkq_118:hover{opacity:1;background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTc5MiIgaGVpZ2h0PSIxNzkyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgoKIDxnPgogIDx0aXRsZT5iYWNrZ3JvdW5kPC90aXRsZT4KICA8cmVjdCBmaWxsPSJub25lIiBpZD0iY2FudmFzX2JhY2tncm91bmQiIGhlaWdodD0iNDAyIiB3aWR0aD0iNTgyIiB5PSItMSIgeD0iLTEiLz4KIDwvZz4KIDxnPgogIDx0aXRsZT5MYXllciAxPC90aXRsZT4KICA8cGF0aCBmaWxsPSIjZmZmZmZmIiBpZD0ic3ZnXzEiIGQ9Im0xNTc2LDkyN2wtMTMyOCw3MzhxLTIzLDEzIC0zOS41LDN0LTE2LjUsLTM2bDAsLTE0NzJxMCwtMjYgMTYuNSwtMzZ0MzkuNSwzbDEzMjgsNzM4cTIzLDEzIDIzLDMxdC0yMywzMXoiLz4KIDwvZz4KPC9zdmc+)}._selected_4ybkq_136{pointer-events:none;border-color:#fff}._hidden_4ybkq_141{display:none}._disabled_4ybkq_145{background-color:rgba(24,18,18,.6)}._channel-selection-overlay_btpgd_1{background-color:rgba(255,77,145,.3);justify-content:center;align-items:center;width:100%;height:100%;display:flex;position:absolute;top:0;left:0}._container_btpgd_13{z-index:10;flex-direction:column;max-height:calc(100% - 60px);padding:1em;display:flex;position:absolute;top:0;right:0;overflow-y:auto}@media only screen and (max-width:576px){._container_btpgd_13{padding:.3em}}@media only screen and (max-width:768px) and (min-width:576px){._container_btpgd_13{padding:.6em}}._hidden_btpgd_37{display:none}._disabled_btpgd_41{background-color:rgba(24,18,18,.6)}._fullscreen_1v9d8_1{object-fit:contain;background:#000;top:0;bottom:0;left:0;right:0;box-sizing:border-box!important;z-index:1000!important;width:100%!important;min-width:0!important;max-width:none!important;height:100%!important;min-height:0!important;max-height:none!important;margin:0!important;position:fixed!important;top:0!important;bottom:0!important;left:0!important;right:0!important;transform:none!important}._player_1vdos_1{background-color:#141414;justify-content:center;width:100%;display:flex;position:relative;overflow:hidden}._player_1vdos_1>video,._player_1vdos_1>canvas{object-fit:contain}._player_1vdos_1:focus-visible{outline:none}._one-to-one_1vdos_19>video,._one-to-one_1vdos_19>canvas{object-fit:contain;height:auto!important;max-height:auto!important;width:auto!important;max-width:auto!important}._audio-only_1vdos_28{min-height:100px;overflow:visible}._player_1vdos_1 video::-webkit-media-text-track-display{font-size:28px;transform:translateY(calc(var(--vindral-control-bar-offset,0px) - .5em))!important}._player_1vdos_1 video::cue{white-space:pre-wrap;background-color:rgba(0,0,0,.6);font-size:28px}._player_1vdos_1 video::-webkit-media-text-track-display-backdrop{background-color:transparent}._playoverlay_1niji_1{cursor:pointer;opacity:1;background-color:rgba(0,0,0,.3);justify-content:center;align-items:center;width:100%;height:100%;transition:opacity .25s .5s;display:flex;position:absolute;top:0;left:0}._hidden_1niji_17{pointer-events:none;opacity:0;transition-delay:0s}._playoverlay-indicator_1niji_23{border-top:40px solid transparent;border-bottom:40px solid transparent;border-left:60px solid rgba(255,255,255,.8);width:0;height:0}@media only screen and (max-width:400px){._playoverlay-indicator_1niji_23{border-top:20px solid transparent;border-bottom:20px solid transparent;border-left:30px solid rgba(255,255,255,.8)}}
2
+ /*$vite$:1*/
@@ -1,5 +1,3 @@
1
- import "./DTFc40PP.js";
2
- import { t as e } from "./BmhvfDax.js";
3
- //#region src/vindral-player-component.ts
1
+ import { t as e } from "./CmTzPIcG.js";
2
+ // src/vindral-player-component.ts
4
3
  e();
5
- //#endregion
package/BdMchGeH.js DELETED
@@ -1,169 +0,0 @@
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 };
package/Bg5VLlmK.js DELETED
@@ -1,110 +0,0 @@
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/Emitter.ts
4
- var i = class {
5
- constructor() {
6
- e(this, "listeners", {});
7
- }
8
- handleListenerError(e, t) {
9
- throw e;
10
- }
11
- emit(e, t) {
12
- let n = this.listeners[e];
13
- if (n) {
14
- let r = !1;
15
- for (let e = 0; e < n.length; e++) if (n[e].once) {
16
- r = !0;
17
- break;
18
- }
19
- r && (this.listeners[e] = n.filter((e) => !e.once));
20
- let i, a = n.length;
21
- for (let r = 0; r < a; r++) try {
22
- let e = n[r].fn(t);
23
- typeof e == "function" && (i || (i = []), i.push(e));
24
- } catch (t) {
25
- this.handleListenerError(t, e);
26
- }
27
- if (i) for (let t = 0; t < i.length; t++) try {
28
- i[t]();
29
- } catch (t) {
30
- this.handleListenerError(t, e);
31
- }
32
- }
33
- }
34
- off(e, t) {
35
- let n = this.listeners[e];
36
- n && (this.listeners[e] = n.filter((e) => e.fn !== t));
37
- }
38
- on(e, t) {
39
- this.add(e, t, !1);
40
- }
41
- once(e, t) {
42
- this.add(e, t, !0);
43
- }
44
- hasListeners(e) {
45
- let t = this.listeners[e];
46
- return t !== void 0 && t.length > 0;
47
- }
48
- reset() {
49
- this.listeners = {};
50
- }
51
- add(e, t, n) {
52
- let r = this.listeners[e], i = {
53
- fn: t,
54
- once: n
55
- };
56
- r ? r.push(i) : this.listeners[e] = [i];
57
- }
58
- }, a = [
59
- "off",
60
- "error",
61
- "warn",
62
- "info",
63
- "debug",
64
- "trace"
65
- ], o = {
66
- ERROR: "error",
67
- WARN: "warn",
68
- INFO: "info",
69
- DEBUG: "debug",
70
- TRACE: "trace",
71
- OFF: "off"
72
- }, s = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap(), l = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new WeakMap(), d = class i {
73
- constructor({ context: i, logLevel: a, debug: o }) {
74
- t(this, s, /* @__PURE__ */ new Map()), t(this, c, ""), t(this, l, !1), t(this, u, "off"), e(this, "trace", (...e) => {}), e(this, "debug", (...e) => {}), e(this, "info", (...e) => {}), e(this, "warn", (...e) => {}), e(this, "error", (...e) => {}), e(this, "table", (...e) => {}), e(this, "count", (...e) => {}), n(c, this, i), n(u, this, a), n(l, this, o || !1), this.setLevel(a), this.setDebug(r(l, this));
75
- }
76
- setDebug(e) {
77
- n(l, this, e);
78
- for (let [t, n] of r(s, this)) n.setDebug(e);
79
- e ? (this.table = console.table.bind(console), this.count = console.count.bind(console)) : (this.table = () => {}, this.count = () => {});
80
- }
81
- getLevel() {
82
- return r(u, this);
83
- }
84
- setLevel(e) {
85
- n(u, this, e);
86
- for (let [t, n] of r(s, this)) n.setLevel(e);
87
- let t = a.indexOf(e);
88
- for (let [e, n] of a.entries()) n !== "off" && (e <= t ? this[n] = console[n].bind(console, "%c%s %c%s", "font-weight:bold;", n.toUpperCase(), "font-weight:normal;", r(c, this)) : this[n] = () => {});
89
- }
90
- createContext(e) {
91
- let t = r(s, this).get(e);
92
- if (!t) {
93
- let t = new i({
94
- context: `${e}`,
95
- logLevel: r(u, this),
96
- debug: r(l, this)
97
- });
98
- return r(s, this).set(e, t), t;
99
- }
100
- return t;
101
- }
102
- static get() {
103
- return f._ || (f._ = new i({
104
- context: "Vindral",
105
- logLevel: "off"
106
- })), f._;
107
- }
108
- }, f = { _: void 0 };
109
- //#endregion
110
- export { d as n, i as r, o as t };