@obipascal/player 1.0.2 → 1.0.4

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,11 @@
1
- var at = Object.defineProperty;
2
- var lt = (c, t, e) => t in c ? at(c, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[t] = e;
3
- var o = (c, t, e) => lt(c, typeof t != "symbol" ? t + "" : t, e);
4
- import w from "hls.js";
5
- import Y, { useRef as U, useEffect as $, useState as V } from "react";
6
- class ct {
1
+ var V = Object.defineProperty;
2
+ var N = (l, t, e) => t in l ? V(l, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : l[t] = e;
3
+ var o = (l, t, e) => N(l, typeof t != "symbol" ? t + "" : t, e);
4
+ import p from "hls.js";
5
+ import { jsx as $ } from "react/jsx-runtime";
6
+ import * as F from "react";
7
+ import { useRef as w, useEffect as f, useState as b } from "react";
8
+ class j {
7
9
  constructor(t) {
8
10
  o(this, "config");
9
11
  o(this, "sessionId");
@@ -19,9 +21,9 @@ class ct {
19
21
  this.config = t, this.sessionId = (t == null ? void 0 : t.sessionId) || this.generateSessionId(), this.sessionStartTime = Date.now(), (e = this.config) != null && e.enabled && this.trackEvent("session_start", this.getSessionData());
20
22
  }
21
23
  trackEvent(t, e = {}) {
22
- var r;
23
- if (!((r = this.config) != null && r.enabled)) return;
24
- const s = {
24
+ var i;
25
+ if (!((i = this.config) != null && i.enabled)) return;
26
+ const n = {
25
27
  eventType: t,
26
28
  timestamp: Date.now(),
27
29
  sessionId: this.sessionId,
@@ -32,7 +34,7 @@ class ct {
32
34
  ...this.getQoEMetrics()
33
35
  }
34
36
  };
35
- this.events.push(s), this.updateMetrics(t, e), this.config.endpoint && this.sendEvent(s), process.env.NODE_ENV === "development" && console.log("[Analytics]", t, s.data);
37
+ this.events.push(n), this.updateMetrics(t, e), this.config.endpoint && this.sendEvent(n), process.env.NODE_ENV === "development" && console.log("[Analytics]", t, n.data);
36
38
  }
37
39
  updateMetrics(t, e) {
38
40
  switch (t) {
@@ -95,8 +97,8 @@ class ct {
95
97
  },
96
98
  body: JSON.stringify(t)
97
99
  });
98
- } catch (s) {
99
- console.error("Failed to send analytics event:", s);
100
+ } catch (n) {
101
+ console.error("Failed to send analytics event:", n);
100
102
  }
101
103
  }
102
104
  generateSessionId() {
@@ -117,7 +119,7 @@ class ct {
117
119
  (t = this.config) != null && t.enabled && this.trackEvent("session_end", this.getSessionData()), this.events = [];
118
120
  }
119
121
  }
120
- class ut {
122
+ class W {
121
123
  constructor(t, e) {
122
124
  o(this, "container");
123
125
  o(this, "player");
@@ -129,9 +131,6 @@ class ut {
129
131
  o(this, "skipForwardButton");
130
132
  o(this, "volumeButton");
131
133
  o(this, "fullscreenButton");
132
- o(this, "qualityButton");
133
- o(this, "subtitleButton");
134
- o(this, "speedButton");
135
134
  o(this, "settingsButton");
136
135
  // private timeDisplay: HTMLElement
137
136
  o(this, "volumeSlider");
@@ -139,24 +138,24 @@ class ut {
139
138
  // private controlsVisible = true
140
139
  o(this, "hideControlsTimeout", null);
141
140
  o(this, "stickyControls", !1);
142
- this.container = t, this.player = e, this.injectStyles(), this.createProgressBar(), this.controlsContainer = this.createControls(), this.container.appendChild(this.controlsContainer), this.playButton = this.controlsContainer.querySelector(".wontum-play-btn"), this.skipBackwardButton = this.controlsContainer.querySelector(".wontum-skip-backward-btn"), this.skipForwardButton = this.controlsContainer.querySelector(".wontum-skip-forward-btn"), this.volumeButton = this.controlsContainer.querySelector(".wontum-volume-btn"), this.fullscreenButton = this.controlsContainer.querySelector(".wontum-fullscreen-btn"), this.qualityButton = this.controlsContainer.querySelector(".wontum-quality-btn"), this.subtitleButton = this.controlsContainer.querySelector(".wontum-subtitle-btn"), this.speedButton = this.controlsContainer.querySelector(".wontum-speed-btn"), this.settingsButton = this.controlsContainer.querySelector(".wontum-settings-btn"), this.volumeSlider = this.controlsContainer.querySelector(".wontum-volume-slider"), this.progressInput = this.container.querySelector(".wontum-progress-input"), this.progressBar = this.container.querySelector(".wontum-progress-filled"), this.stickyControls = this.player.config.stickyControls || !1, this.stickyControls && this.controlsContainer.classList.add("sticky"), this.setupEventListeners(), this.setupPlayerEventListeners();
141
+ this.container = t, this.player = e, this.injectStyles(), this.createProgressBar(), this.controlsContainer = this.createControls(), this.container.appendChild(this.controlsContainer), this.playButton = this.controlsContainer.querySelector(".wontum-play-btn"), this.skipBackwardButton = this.controlsContainer.querySelector(".wontum-skip-backward-btn"), this.skipForwardButton = this.controlsContainer.querySelector(".wontum-skip-forward-btn"), this.volumeButton = this.controlsContainer.querySelector(".wontum-volume-btn"), this.fullscreenButton = this.controlsContainer.querySelector(".wontum-fullscreen-btn"), this.settingsButton = this.controlsContainer.querySelector(".wontum-settings-btn"), this.volumeSlider = this.controlsContainer.querySelector(".wontum-volume-slider"), this.progressInput = this.container.querySelector(".wontum-progress-input"), this.progressBar = this.container.querySelector(".wontum-progress-filled"), this.stickyControls = this.player.config.stickyControls || !1, this.stickyControls && this.controlsContainer.classList.add("sticky"), this.setupEventListeners(), this.setupPlayerEventListeners();
143
142
  }
144
143
  injectStyles() {
145
144
  const t = "wontum-player-styles";
146
145
  if (document.getElementById(t)) return;
147
- const e = this.player.config.theme || {}, s = e.primaryColor || "#3b82f6", r = e.accentColor || "#2563eb", i = e.fontFamily || "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif", l = e.controlsBackground || "linear-gradient(to top, rgba(0,0,0,0.8), transparent)", u = e.buttonHoverBg || "rgba(255, 255, 255, 0.1)", v = e.progressHeight || "6px", y = e.borderRadius || "4px", g = document.createElement("style");
148
- g.id = t, g.textContent = `
146
+ const e = this.player.config.theme || {}, n = e.primaryColor || "#3b82f6", i = e.accentColor || "#2563eb", s = e.fontFamily || "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif", r = e.controlsBackground || "linear-gradient(to top, rgba(0,0,0,0.8), transparent)", a = e.buttonHoverBg || "rgba(255, 255, 255, 0.1)", c = e.progressHeight || "6px", d = e.borderRadius || "4px", m = document.createElement("style");
147
+ m.id = t, m.textContent = `
149
148
  .wontum-player-container {
150
149
  position: relative;
151
150
  background: #000;
152
- font-family: ${i};
151
+ font-family: ${s};
153
152
  overflow: hidden;
154
- --primary-color: ${s};
155
- --accent-color: ${r};
156
- --controls-bg: ${l};
157
- --button-hover: ${u};
158
- --progress-height: ${v};
159
- --border-radius: ${y};
153
+ --primary-color: ${n};
154
+ --accent-color: ${i};
155
+ --controls-bg: ${r};
156
+ --button-hover: ${a};
157
+ --progress-height: ${c};
158
+ --border-radius: ${d};
160
159
  }
161
160
 
162
161
  .wontum-player-video {
@@ -425,21 +424,7 @@ class ut {
425
424
  }
426
425
 
427
426
  .wontum-quality-menu {
428
- position: absolute;
429
- bottom: 100%;
430
- right: 0;
431
- background: rgba(20, 20, 20, 0.95);
432
- backdrop-filter: blur(10px);
433
- border-radius: 6px;
434
427
  padding: 6px 0;
435
- margin-bottom: 8px;
436
- display: none;
437
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
438
- min-width: 120px;
439
- }
440
-
441
- .wontum-quality-menu.active {
442
- display: block;
443
428
  }
444
429
 
445
430
  .wontum-quality-option {
@@ -462,21 +447,7 @@ class ut {
462
447
  }
463
448
 
464
449
  .wontum-speed-menu {
465
- position: absolute;
466
- bottom: 100%;
467
- right: 0;
468
- background: rgba(20, 20, 20, 0.95);
469
- backdrop-filter: blur(10px);
470
- border-radius: 6px;
471
450
  padding: 6px 0;
472
- margin-bottom: 8px;
473
- display: none;
474
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
475
- min-width: 120px;
476
- }
477
-
478
- .wontum-speed-menu.active {
479
- display: block;
480
451
  }
481
452
 
482
453
  .wontum-speed-option {
@@ -498,24 +469,73 @@ class ut {
498
469
  background: rgba(255, 255, 255, 0.05);
499
470
  }
500
471
 
501
- .wontum-settings-menu {
472
+ .wontum-settings-panel {
502
473
  position: absolute;
503
474
  bottom: 100%;
504
475
  right: 0;
505
476
  background: rgba(20, 20, 20, 0.95);
506
477
  backdrop-filter: blur(10px);
507
- border-radius: 6px;
508
- padding: 6px 0;
478
+ border-radius: 8px;
509
479
  margin-bottom: 8px;
510
- min-width: 200px;
480
+ min-width: 320px;
511
481
  display: none;
512
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
482
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
483
+ overflow: hidden;
484
+ }
485
+
486
+ .wontum-settings-panel.active {
487
+ display: flex;
488
+ flex-direction: column;
489
+ }
490
+
491
+ .wontum-settings-tabs {
492
+ display: flex;
493
+ background: rgba(0, 0, 0, 0.3);
494
+ border-bottom: 1px solid rgba(255, 255, 255, 0.1);
495
+ }
496
+
497
+ .wontum-tab {
498
+ flex: 1;
499
+ padding: 10px 12px;
500
+ background: none;
501
+ border: none;
502
+ color: rgba(255, 255, 255, 0.7);
503
+ font-size: 12px;
504
+ cursor: pointer;
505
+ transition: all 0.2s ease;
506
+ border-bottom: 2px solid transparent;
507
+ font-family: inherit;
508
+ }
509
+
510
+ .wontum-tab:hover {
511
+ background: rgba(255, 255, 255, 0.05);
512
+ color: rgba(255, 255, 255, 0.9);
513
513
  }
514
514
 
515
- .wontum-settings-menu.active {
515
+ .wontum-tab.active {
516
+ color: var(--primary-color);
517
+ border-bottom-color: var(--primary-color);
518
+ background: rgba(59, 130, 246, 0.1);
519
+ }
520
+
521
+ .wontum-settings-content {
522
+ min-height: 120px;
523
+ max-height: 300px;
524
+ overflow-y: auto;
525
+ }
526
+
527
+ .wontum-tab-panel {
528
+ display: none;
529
+ }
530
+
531
+ .wontum-tab-panel.active {
516
532
  display: block;
517
533
  }
518
534
 
535
+ .wontum-settings-menu {
536
+ padding: 6px 0;
537
+ }
538
+
519
539
  .wontum-settings-option {
520
540
  padding: 12px 16px;
521
541
  cursor: pointer;
@@ -563,21 +583,7 @@ class ut {
563
583
  }
564
584
 
565
585
  .wontum-subtitle-menu {
566
- position: absolute;
567
- bottom: 100%;
568
- right: 0;
569
- background: rgba(20, 20, 20, 0.95);
570
- backdrop-filter: blur(10px);
571
- border-radius: 6px;
572
586
  padding: 6px 0;
573
- margin-bottom: 8px;
574
- display: none;
575
- min-width: 150px;
576
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
577
- }
578
-
579
- .wontum-subtitle-menu.active {
580
- display: block;
581
587
  }
582
588
 
583
589
  .wontum-subtitle-option {
@@ -610,7 +616,7 @@ class ut {
610
616
  transform: translateY(0) !important;
611
617
  pointer-events: all !important;
612
618
  }
613
- `, document.head.appendChild(g), this.container.classList.add("wontum-player-container");
619
+ `, document.head.appendChild(m), this.container.classList.add("wontum-player-container");
614
620
  }
615
621
  createProgressBar() {
616
622
  const t = document.createElement("div");
@@ -654,32 +660,32 @@ class ut {
654
660
 
655
661
  <div class="wontum-spacer"></div>
656
662
 
657
- <div class="wontum-subtitle-container" style="position: relative;">
658
- <button class="wontum-btn wontum-subtitle-btn" aria-label="Subtitles">
659
- ${this.getSubtitleIcon()}
660
- </button>
661
- <div class="wontum-subtitle-menu"></div>
662
- </div>
663
-
664
- <div class="wontum-speed-container" style="position: relative;">
665
- <button class="wontum-btn wontum-speed-btn" aria-label="Playback Speed">
666
- ${this.getSpeedIcon()}
667
- </button>
668
- <div class="wontum-speed-menu"></div>
669
- </div>
670
-
671
- <div class="wontum-quality-container" style="position: relative;">
672
- <button class="wontum-btn wontum-quality-btn" aria-label="Quality">
673
- ${this.getQualityIcon()}
674
- </button>
675
- <div class="wontum-quality-menu"></div>
676
- </div>
677
-
678
663
  <div class="wontum-settings-container" style="position: relative;">
679
664
  <button class="wontum-btn wontum-settings-btn" aria-label="Settings">
680
665
  ${this.getSettingsIcon()}
681
666
  </button>
682
- <div class="wontum-settings-menu"></div>
667
+ <div class="wontum-settings-panel">
668
+ <div class="wontum-settings-tabs">
669
+ <button class="wontum-tab active" data-tab="general">General</button>
670
+ <button class="wontum-tab" data-tab="quality">Quality</button>
671
+ <button class="wontum-tab" data-tab="speed">Speed</button>
672
+ <button class="wontum-tab" data-tab="subtitles">Subtitles</button>
673
+ </div>
674
+ <div class="wontum-settings-content">
675
+ <div class="wontum-tab-panel active" data-panel="general">
676
+ <div class="wontum-settings-menu"></div>
677
+ </div>
678
+ <div class="wontum-tab-panel" data-panel="quality">
679
+ <div class="wontum-quality-menu"></div>
680
+ </div>
681
+ <div class="wontum-tab-panel" data-panel="speed">
682
+ <div class="wontum-speed-menu"></div>
683
+ </div>
684
+ <div class="wontum-tab-panel" data-panel="subtitles">
685
+ <div class="wontum-subtitle-menu"></div>
686
+ </div>
687
+ </div>
688
+ </div>
683
689
  </div>
684
690
 
685
691
  <button class="wontum-btn wontum-fullscreen-btn" aria-label="Fullscreen">
@@ -699,28 +705,28 @@ class ut {
699
705
  this.player.skipBackward(10);
700
706
  }), this.skipForwardButton.addEventListener("click", () => {
701
707
  this.player.skipForward(10);
702
- }), this.progressInput.addEventListener("input", (e) => {
703
- const s = e.target, r = parseFloat(s.value), i = this.player.getState(), l = r / 100 * i.duration;
704
- this.player.seek(l);
705
- }), this.volumeSlider.addEventListener("input", (e) => {
706
- const s = e.target, r = parseFloat(s.value) / 100;
707
- this.player.setVolume(r);
708
+ }), this.progressInput.addEventListener("input", (n) => {
709
+ const i = n.target, s = parseFloat(i.value), r = this.player.getState(), a = s / 100 * r.duration;
710
+ this.player.seek(a);
711
+ }), this.volumeSlider.addEventListener("input", (n) => {
712
+ const i = n.target, s = parseFloat(i.value) / 100;
713
+ this.player.setVolume(s);
708
714
  }), this.volumeButton.addEventListener("click", () => {
709
715
  this.player.getState().muted ? this.player.unmute() : this.player.mute();
710
716
  }), this.fullscreenButton.addEventListener("click", () => {
711
717
  this.player.getState().fullscreen ? this.player.exitFullscreen() : this.player.enterFullscreen();
712
- }), this.qualityButton.addEventListener("click", () => {
713
- var s, r, i;
714
- this.controlsContainer.querySelector(".wontum-quality-menu").classList.toggle("active"), (s = this.controlsContainer.querySelector(".wontum-settings-menu")) == null || s.classList.remove("active"), (r = this.controlsContainer.querySelector(".wontum-subtitle-menu")) == null || r.classList.remove("active"), (i = this.controlsContainer.querySelector(".wontum-speed-menu")) == null || i.classList.remove("active");
715
- }), this.subtitleButton.addEventListener("click", () => {
716
- var s, r, i;
717
- this.controlsContainer.querySelector(".wontum-subtitle-menu").classList.toggle("active"), (s = this.controlsContainer.querySelector(".wontum-settings-menu")) == null || s.classList.remove("active"), (r = this.controlsContainer.querySelector(".wontum-quality-menu")) == null || r.classList.remove("active"), (i = this.controlsContainer.querySelector(".wontum-speed-menu")) == null || i.classList.remove("active"), this.updateSubtitleMenu();
718
- }), this.speedButton.addEventListener("click", () => {
719
- var s, r, i;
720
- this.controlsContainer.querySelector(".wontum-speed-menu").classList.toggle("active"), (s = this.controlsContainer.querySelector(".wontum-settings-menu")) == null || s.classList.remove("active"), (r = this.controlsContainer.querySelector(".wontum-quality-menu")) == null || r.classList.remove("active"), (i = this.controlsContainer.querySelector(".wontum-subtitle-menu")) == null || i.classList.remove("active"), this.updateSpeedMenu();
721
718
  }), this.settingsButton.addEventListener("click", () => {
722
- var s, r, i;
723
- this.controlsContainer.querySelector(".wontum-settings-menu").classList.toggle("active"), (s = this.controlsContainer.querySelector(".wontum-quality-menu")) == null || s.classList.remove("active"), (r = this.controlsContainer.querySelector(".wontum-subtitle-menu")) == null || r.classList.remove("active"), (i = this.controlsContainer.querySelector(".wontum-speed-menu")) == null || i.classList.remove("active"), this.updateSettingsMenu();
719
+ const n = this.controlsContainer.querySelector(".wontum-settings-panel");
720
+ n.classList.toggle("active"), n.classList.contains("active") && (this.updateSettingsMenu(), this.updateQualityMenu(), this.updateSpeedMenu(), this.updateSubtitleMenu());
721
+ });
722
+ const t = this.controlsContainer.querySelectorAll(".wontum-tab");
723
+ t.forEach((n) => {
724
+ n.addEventListener("click", (i) => {
725
+ const s = i.currentTarget, r = s.getAttribute("data-tab");
726
+ t.forEach((d) => d.classList.remove("active")), s.classList.add("active"), this.controlsContainer.querySelectorAll(".wontum-tab-panel").forEach((d) => d.classList.remove("active"));
727
+ const c = this.controlsContainer.querySelector(`[data-panel="${r}"]`);
728
+ c == null || c.classList.add("active");
729
+ });
724
730
  }), this.player.getVideoElement().addEventListener("click", () => {
725
731
  this.player.getState().playing ? this.player.pause() : this.player.play();
726
732
  }), this.container.addEventListener("mousemove", () => {
@@ -735,19 +741,19 @@ class ut {
735
741
  }), this.player.on("pause", () => {
736
742
  this.playButton.innerHTML = this.getPlayIcon();
737
743
  }), this.player.on("timeupdate", (t) => {
738
- const { currentTime: e } = t.data, s = this.player.getState();
739
- if (s.duration > 0) {
740
- const i = e / s.duration * 100;
741
- this.progressBar.style.width = `${i}%`, this.progressInput.value = i.toString();
744
+ const { currentTime: e } = t.data, n = this.player.getState();
745
+ if (n.duration > 0) {
746
+ const s = e / n.duration * 100;
747
+ this.progressBar.style.width = `${s}%`, this.progressInput.value = s.toString();
742
748
  }
743
- const r = this.controlsContainer.querySelector(".wontum-current-time");
744
- r.textContent = this.formatTime(e);
749
+ const i = this.controlsContainer.querySelector(".wontum-current-time");
750
+ i.textContent = this.formatTime(e);
745
751
  }), this.player.on("loadedmetadata", (t) => {
746
- const { duration: e } = t.data, s = this.controlsContainer.querySelector(".wontum-duration");
747
- s.textContent = this.formatTime(e), t.data.qualities && this.updateQualityMenu(t.data.qualities);
752
+ const { duration: e } = t.data, n = this.controlsContainer.querySelector(".wontum-duration");
753
+ n.textContent = this.formatTime(e), t.data.qualities && this.updateQualityMenu(t.data.qualities);
748
754
  }), this.player.on("volumechange", (t) => {
749
- const { volume: e, muted: s } = t.data;
750
- this.volumeSlider.value = (e * 100).toString(), this.volumeButton.innerHTML = s ? this.getMutedIcon() : this.getVolumeIcon();
755
+ const { volume: e, muted: n } = t.data;
756
+ this.volumeSlider.value = (e * 100).toString(), this.volumeButton.innerHTML = n ? this.getMutedIcon() : this.getVolumeIcon();
751
757
  }), this.player.on("waiting", () => {
752
758
  const t = this.controlsContainer.querySelector(".wontum-loading");
753
759
  t.style.display = "block";
@@ -762,35 +768,35 @@ class ut {
762
768
  t.innerHTML = '<div class="wontum-subtitle-option">No subtitles available</div>';
763
769
  return;
764
770
  }
765
- const s = e.findIndex((r) => r.mode === "showing");
771
+ const n = e.findIndex((i) => i.mode === "showing");
766
772
  t.innerHTML = `
767
- <div class="wontum-subtitle-option ${s === -1 ? "active" : ""}" data-track="-1">Off</div>
773
+ <div class="wontum-subtitle-option ${n === -1 ? "active" : ""}" data-track="-1">Off</div>
768
774
  ${e.map(
769
- (r, i) => `
770
- <div class="wontum-subtitle-option ${i === s ? "active" : ""}" data-track="${i}">
771
- ${r.label || r.language || `Track ${i + 1}`}
775
+ (i, s) => `
776
+ <div class="wontum-subtitle-option ${s === n ? "active" : ""}" data-track="${s}">
777
+ ${i.label || i.language || `Track ${s + 1}`}
772
778
  </div>
773
779
  `
774
780
  ).join("")}
775
- `, t.querySelectorAll(".wontum-subtitle-option").forEach((r) => {
776
- r.addEventListener("click", (i) => {
777
- const l = i.target, u = parseInt(l.dataset.track || "-1");
778
- u === -1 ? this.player.disableSubtitles() : this.player.enableSubtitles(u), t.querySelectorAll(".wontum-subtitle-option").forEach((v) => v.classList.remove("active")), l.classList.add("active"), t.classList.remove("active");
781
+ `, t.querySelectorAll(".wontum-subtitle-option").forEach((i) => {
782
+ i.addEventListener("click", (s) => {
783
+ const r = s.target, a = parseInt(r.dataset.track || "-1");
784
+ a === -1 ? this.player.disableSubtitles() : this.player.enableSubtitles(a), t.querySelectorAll(".wontum-subtitle-option").forEach((c) => c.classList.remove("active")), r.classList.add("active");
779
785
  });
780
786
  });
781
787
  }
782
788
  updateSpeedMenu() {
783
- const t = this.controlsContainer.querySelector(".wontum-speed-menu"), s = this.player.getState().playbackRate || 1, r = [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2];
784
- t.innerHTML = r.map(
785
- (i) => `
786
- <div class="wontum-speed-option ${s === i ? "active" : ""}" data-speed="${i}">
787
- ${i === 1 ? "Normal" : i + "x"}
789
+ const t = this.controlsContainer.querySelector(".wontum-speed-menu"), n = this.player.getState().playbackRate || 1, i = [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2];
790
+ t.innerHTML = i.map(
791
+ (s) => `
792
+ <div class="wontum-speed-option ${n === s ? "active" : ""}" data-speed="${s}">
793
+ ${s === 1 ? "Normal" : s + "x"}
788
794
  </div>
789
795
  `
790
- ).join(""), t.querySelectorAll(".wontum-speed-option").forEach((i) => {
791
- i.addEventListener("click", (l) => {
792
- const u = l.target, v = parseFloat(u.dataset.speed || "1");
793
- this.player.setPlaybackRate(v), t.querySelectorAll(".wontum-speed-option").forEach((y) => y.classList.remove("active")), u.classList.add("active"), t.classList.remove("active");
796
+ ).join(""), t.querySelectorAll(".wontum-speed-option").forEach((s) => {
797
+ s.addEventListener("click", (r) => {
798
+ const a = r.target, c = parseFloat(a.dataset.speed || "1");
799
+ this.player.setPlaybackRate(c), t.querySelectorAll(".wontum-speed-option").forEach((d) => d.classList.remove("active")), a.classList.add("active");
794
800
  });
795
801
  });
796
802
  }
@@ -808,18 +814,22 @@ class ut {
808
814
  });
809
815
  }
810
816
  updateQualityMenu(t) {
811
- const e = this.controlsContainer.querySelector(".wontum-quality-menu");
817
+ const e = this.controlsContainer.querySelector(".wontum-quality-menu"), n = t || this.player.getQualities();
818
+ if (!n || n.length === 0) {
819
+ e.innerHTML = '<div class="wontum-quality-option">No qualities available</div>';
820
+ return;
821
+ }
812
822
  e.innerHTML = `
813
823
  <div class="wontum-quality-option active" data-quality="-1">Auto</div>
814
- ${t.map(
815
- (s, r) => `
816
- <div class="wontum-quality-option" data-quality="${r}">${s.name}</div>
824
+ ${n.map(
825
+ (i, s) => `
826
+ <div class="wontum-quality-option" data-quality="${s}">${i.name}</div>
817
827
  `
818
828
  ).join("")}
819
- `, e.querySelectorAll(".wontum-quality-option").forEach((s) => {
820
- s.addEventListener("click", (r) => {
821
- const i = r.target, l = parseInt(i.dataset.quality || "-1");
822
- this.player.setQuality(l), e.querySelectorAll(".wontum-quality-option").forEach((u) => u.classList.remove("active")), i.classList.add("active"), e.classList.remove("active");
829
+ `, e.querySelectorAll(".wontum-quality-option").forEach((i) => {
830
+ i.addEventListener("click", (s) => {
831
+ const r = s.target, a = parseInt(r.dataset.quality || "-1");
832
+ this.player.setQuality(a), e.querySelectorAll(".wontum-quality-option").forEach((c) => c.classList.remove("active")), r.classList.add("active");
823
833
  });
824
834
  });
825
835
  }
@@ -837,8 +847,8 @@ class ut {
837
847
  }
838
848
  formatTime(t) {
839
849
  if (isNaN(t)) return "0:00";
840
- const e = Math.floor(t / 60), s = Math.floor(t % 60);
841
- return `${e}:${s.toString().padStart(2, "0")}`;
850
+ const e = Math.floor(t / 60), n = Math.floor(t % 60);
851
+ return `${e}:${n.toString().padStart(2, "0")}`;
842
852
  }
843
853
  // SVG Icons
844
854
  getPlayIcon() {
@@ -856,9 +866,6 @@ class ut {
856
866
  getFullscreenIcon() {
857
867
  return '<svg viewBox="0 0 24 24"><path d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/></svg>';
858
868
  }
859
- getQualityIcon() {
860
- return '<svg viewBox="0 0 24 24"><path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-8 12H9.5v-2h-2v2H6V9h1.5v2.5h2V9H11v6zm7-1c0 .55-.45 1-1 1h-.75v1.5h-1.5V15H14c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v4zm-3.5-.5h2v-3h-2v3z"/></svg>';
861
- }
862
869
  getSkipBackwardIcon() {
863
870
  return `<svg viewBox="0 0 60 60" fill="none" xmlns="http://www.w3.org/2000/svg">
864
871
  <circle cx="30" cy="30" r="28" stroke="white" stroke-width="2"/>
@@ -877,12 +884,6 @@ class ut {
877
884
  <text x="30" y="35" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="white" text-anchor="middle">10</text>
878
885
  </svg>`;
879
886
  }
880
- getSubtitleIcon() {
881
- return '<svg viewBox="0 0 24 24"><path d="M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zM4 12h4v2H4v-2zm10 6H4v-2h10v2zm6 0h-4v-2h4v2zm0-4H10v-2h10v2z"/></svg>';
882
- }
883
- getSpeedIcon() {
884
- return '<svg viewBox="0 0 24 24"><path d="M20.38 8.57l-1.23 1.85a8 8 0 0 1-.22 7.58H5.07A8 8 0 0 1 15.58 6.85l1.85-1.23A10 10 0 0 0 3.35 19a2 2 0 0 0 1.72 1h13.85a2 2 0 0 0 1.74-1 10 10 0 0 0-.27-10.44zm-9.79 6.84a2 2 0 0 0 2.83 0l5.66-8.49-8.49 5.66a2 2 0 0 0 0 2.83z"/></svg>';
885
- }
886
887
  getSettingsIcon() {
887
888
  return '<svg viewBox="0 0 24 24"><path d="M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z"/></svg>';
888
889
  }
@@ -890,7 +891,7 @@ class ut {
890
891
  this.hideControlsTimeout && clearTimeout(this.hideControlsTimeout), this.controlsContainer.remove();
891
892
  }
892
893
  }
893
- class dt {
894
+ class Q {
894
895
  constructor(t) {
895
896
  o(this, "config");
896
897
  o(this, "urlCache", /* @__PURE__ */ new Map());
@@ -911,8 +912,8 @@ class dt {
911
912
  if (!((e = this.config) != null && e.cloudFrontDomains) || this.config.cloudFrontDomains.length === 0)
912
913
  return !1;
913
914
  try {
914
- const s = new URL(t);
915
- return this.config.cloudFrontDomains.some((r) => s.hostname.includes(r));
915
+ const n = new URL(t);
916
+ return this.config.cloudFrontDomains.some((i) => n.hostname.includes(i));
916
917
  } catch {
917
918
  return !1;
918
919
  }
@@ -933,10 +934,10 @@ class dt {
933
934
  return t;
934
935
  if ((e = this.config) != null && e.signUrl)
935
936
  try {
936
- const s = await this.config.signUrl(t);
937
- return this.signedUrls.add(t), s;
938
- } catch (s) {
939
- throw console.error("Failed to sign CloudFront URL:", s), new Error("Failed to sign CloudFront URL");
937
+ const n = await this.config.signUrl(t);
938
+ return this.signedUrls.add(t), n;
939
+ } catch (n) {
940
+ throw console.error("Failed to sign CloudFront URL:", n), new Error("Failed to sign CloudFront URL");
940
941
  }
941
942
  return console.warn("No signUrl function provided. CloudFront cookies may not be set."), t;
942
943
  }
@@ -949,34 +950,34 @@ class dt {
949
950
  const e = t.match(/s3[.-]([^.]+)\.amazonaws\.com\/(.+)/);
950
951
  if (e)
951
952
  return e[2];
952
- const s = t.match(/([^.]+)\.s3\.amazonaws\.com\/(.+)/);
953
- return s ? s[2] : t;
953
+ const n = t.match(/([^.]+)\.s3\.amazonaws\.com\/(.+)/);
954
+ return n ? n[2] : t;
954
955
  }
955
956
  /**
956
957
  * Get presigned URL from cache or generate new one
957
958
  */
958
959
  async getPresignedUrl(t) {
959
- var r;
960
- const e = this.extractS3Key(t), s = this.urlCache.get(e);
961
- if (s && s.expiresAt > Date.now())
962
- return s.url;
963
- if ((r = this.config) != null && r.getPresignedUrl)
960
+ var i;
961
+ const e = this.extractS3Key(t), n = this.urlCache.get(e);
962
+ if (n && n.expiresAt > Date.now())
963
+ return n.url;
964
+ if ((i = this.config) != null && i.getPresignedUrl)
964
965
  try {
965
- const i = await this.config.getPresignedUrl(e);
966
+ const s = await this.config.getPresignedUrl(e);
966
967
  return this.urlCache.set(e, {
967
- url: i,
968
+ url: s,
968
969
  expiresAt: Date.now() + 50 * 60 * 1e3
969
- }), i;
970
- } catch (i) {
971
- throw console.error("Failed to generate presigned URL:", i), new Error("Failed to generate presigned URL for S3 object");
970
+ }), s;
971
+ } catch (s) {
972
+ throw console.error("Failed to generate presigned URL:", s), new Error("Failed to generate presigned URL for S3 object");
972
973
  }
973
974
  return console.warn("No getPresignedUrl function provided. Using direct S3 URL (requires public bucket)"), t;
974
975
  }
975
976
  /**
976
977
  * Helper to construct S3 URL from bucket and key
977
978
  */
978
- static constructS3Url(t, e, s = "us-east-1") {
979
- return `https://${t}.s3.${s}.amazonaws.com/${e}`;
979
+ static constructS3Url(t, e, n = "us-east-1") {
980
+ return `https://${t}.s3.${n}.amazonaws.com/${e}`;
980
981
  }
981
982
  /**
982
983
  * Helper to parse S3 URI (s3://bucket/key)
@@ -984,8 +985,8 @@ class dt {
984
985
  static parseS3Uri(t) {
985
986
  if (!t.startsWith("s3://"))
986
987
  return null;
987
- const e = t.replace("s3://", "").split("/"), s = e[0], r = e.slice(1).join("/");
988
- return { bucket: s, key: r };
988
+ const e = t.replace("s3://", "").split("/"), n = e[0], i = e.slice(1).join("/");
989
+ return { bucket: n, key: i };
989
990
  }
990
991
  /**
991
992
  * Clear URL cache and signed URLs
@@ -994,7 +995,7 @@ class dt {
994
995
  this.urlCache.clear(), this.signedUrls.clear();
995
996
  }
996
997
  }
997
- class nt {
998
+ class R {
998
999
  constructor(t) {
999
1000
  o(this, "container");
1000
1001
  o(this, "videoElement");
@@ -1004,6 +1005,7 @@ class nt {
1004
1005
  o(this, "analytics");
1005
1006
  o(this, "s3Handler");
1006
1007
  o(this, "uiController");
1008
+ o(this, "qualities", []);
1007
1009
  o(this, "state", {
1008
1010
  playing: !1,
1009
1011
  paused: !0,
@@ -1020,12 +1022,12 @@ class nt {
1020
1022
  });
1021
1023
  if (this.config = t, this.container = typeof t.container == "string" ? document.querySelector(t.container) : t.container, !this.container)
1022
1024
  throw new Error("Container element not found");
1023
- this.analytics = new ct(t.analytics), this.s3Handler = new dt(t.s3Config), this.videoElement = this.createVideoElement(), this.container.appendChild(this.videoElement), this.uiController = new ut(this.container, this), this.setupVideoListeners(), this.loadSource(t.src), t.autoplay && (this.videoElement.autoplay = !0), t.muted && this.mute(), t.poster && (this.videoElement.poster = t.poster), t.preload && (this.videoElement.preload = t.preload), t.subtitles && this.addSubtitleTracks(t.subtitles);
1025
+ this.analytics = new j(t.analytics), this.s3Handler = new Q(t.s3Config), this.videoElement = this.createVideoElement(), this.container.appendChild(this.videoElement), this.uiController = new W(this.container, this), this.setupVideoListeners(), this.loadSource(t.src), t.autoplay && (this.videoElement.autoplay = !0), t.muted && this.mute(), t.poster && (this.videoElement.poster = t.poster), t.preload && (this.videoElement.preload = t.preload), t.subtitles && this.addSubtitleTracks(t.subtitles);
1024
1026
  }
1025
1027
  addSubtitleTracks(t) {
1026
1028
  t.forEach((e) => {
1027
- const s = document.createElement("track");
1028
- s.kind = "subtitles", s.label = e.label, s.src = e.src, s.srclang = e.srclang, e.default && (s.default = !0), this.videoElement.appendChild(s);
1029
+ const n = document.createElement("track");
1030
+ n.kind = "subtitles", n.label = e.label, n.src = e.src, n.srclang = e.srclang, e.default && (n.default = !0), this.videoElement.appendChild(n);
1029
1031
  });
1030
1032
  }
1031
1033
  createVideoElement() {
@@ -1088,16 +1090,16 @@ class nt {
1088
1090
  async loadSource(t) {
1089
1091
  try {
1090
1092
  const e = await this.s3Handler.processUrl(t);
1091
- if (w.isSupported())
1092
- this.hls = new w(this.config.hlsConfig), this.hls.loadSource(e), this.hls.attachMedia(this.videoElement), this.hls.on(w.Events.MANIFEST_PARSED, (s, r) => {
1093
- const i = this.extractQualities(r.levels);
1094
- this.state.availableQualities = i.map((l) => l.name), this.emit("loadedmetadata", { qualities: i });
1095
- }), this.hls.on(w.Events.LEVEL_SWITCHED, (s, r) => {
1096
- var l;
1097
- const i = (l = this.hls) == null ? void 0 : l.levels[r.level];
1098
- i && (this.state.quality = `${i.height}p`, this.emit("qualitychange", { quality: this.state.quality }));
1099
- }), this.hls.on(w.Events.ERROR, (s, r) => {
1100
- r.fatal && this.handleHlsError(r);
1093
+ if (p.isSupported())
1094
+ this.hls = new p(this.config.hlsConfig), this.hls.loadSource(e), this.hls.attachMedia(this.videoElement), this.hls.on(p.Events.MANIFEST_PARSED, (n, i) => {
1095
+ const s = this.extractQualities(i.levels);
1096
+ this.qualities = s;
1097
+ }), this.hls.on(p.Events.LEVEL_SWITCHED, (n, i) => {
1098
+ var r;
1099
+ const s = (r = this.hls) == null ? void 0 : r.levels[i.level];
1100
+ s && (this.state.quality = `${s.height}p`, this.emit("qualitychange", { quality: this.state.quality }));
1101
+ }), this.hls.on(p.Events.ERROR, (n, i) => {
1102
+ i.fatal && this.handleHlsError(i);
1101
1103
  });
1102
1104
  else if (this.videoElement.canPlayType("application/vnd.apple.mpegurl"))
1103
1105
  this.videoElement.src = e;
@@ -1116,13 +1118,13 @@ class nt {
1116
1118
  }));
1117
1119
  }
1118
1120
  handleHlsError(t) {
1119
- var e, s;
1121
+ var e, n;
1120
1122
  switch (t.type) {
1121
- case w.ErrorTypes.NETWORK_ERROR:
1123
+ case p.ErrorTypes.NETWORK_ERROR:
1122
1124
  console.error("Network error occurred"), (e = this.hls) == null || e.startLoad();
1123
1125
  break;
1124
- case w.ErrorTypes.MEDIA_ERROR:
1125
- console.error("Media error occurred"), (s = this.hls) == null || s.recoverMediaError();
1126
+ case p.ErrorTypes.MEDIA_ERROR:
1127
+ console.error("Media error occurred"), (n = this.hls) == null || n.recoverMediaError();
1126
1128
  break;
1127
1129
  default:
1128
1130
  console.error("Fatal error occurred:", t), this.destroy();
@@ -1172,6 +1174,9 @@ class nt {
1172
1174
  setQuality(t) {
1173
1175
  this.hls && (this.hls.currentLevel = t);
1174
1176
  }
1177
+ getQualities() {
1178
+ return this.qualities;
1179
+ }
1175
1180
  enterFullscreen() {
1176
1181
  this.container.requestFullscreen && (this.container.requestFullscreen(), this.state.fullscreen = !0, this.emit("fullscreenchange", { fullscreen: !0 }));
1177
1182
  }
@@ -1189,8 +1194,8 @@ class nt {
1189
1194
  */
1190
1195
  enableSubtitles(t) {
1191
1196
  const e = this.videoElement.textTracks;
1192
- for (let s = 0; s < e.length; s++)
1193
- e[s].mode = s === t ? "showing" : "hidden";
1197
+ for (let n = 0; n < e.length; n++)
1198
+ e[n].mode = n === t ? "showing" : "hidden";
1194
1199
  }
1195
1200
  /**
1196
1201
  * Disable all subtitles
@@ -1205,7 +1210,7 @@ class nt {
1205
1210
  */
1206
1211
  toggleSubtitles() {
1207
1212
  const t = this.videoElement.textTracks;
1208
- return Array.from(t).some((s) => s.mode === "showing") ? (this.disableSubtitles(), !1) : t.length > 0 ? (this.enableSubtitles(0), !0) : !1;
1213
+ return Array.from(t).some((n) => n.mode === "showing") ? (this.disableSubtitles(), !1) : t.length > 0 ? (this.enableSubtitles(0), !0) : !1;
1209
1214
  }
1210
1215
  /**
1211
1216
  * Get available subtitle tracks
@@ -1224,403 +1229,132 @@ class nt {
1224
1229
  this.eventListeners.has(t) || this.eventListeners.set(t, /* @__PURE__ */ new Set()), this.eventListeners.get(t).add(e);
1225
1230
  }
1226
1231
  off(t, e) {
1227
- var s;
1228
- (s = this.eventListeners.get(t)) == null || s.delete(e);
1232
+ var n;
1233
+ (n = this.eventListeners.get(t)) == null || n.delete(e);
1229
1234
  }
1230
1235
  emit(t, e) {
1231
- var r;
1232
- const s = {
1236
+ var i;
1237
+ const n = {
1233
1238
  type: t,
1234
1239
  data: e,
1235
1240
  timestamp: Date.now()
1236
1241
  };
1237
- (r = this.eventListeners.get(t)) == null || r.forEach((i) => {
1238
- i(s);
1242
+ (i = this.eventListeners.get(t)) == null || i.forEach((s) => {
1243
+ s(n);
1239
1244
  });
1240
1245
  }
1241
1246
  destroy() {
1242
1247
  this.hls && (this.hls.destroy(), this.hls = null), this.uiController.destroy(), this.videoElement.remove(), this.eventListeners.clear(), this.analytics.destroy();
1243
1248
  }
1244
1249
  }
1245
- var W = { exports: {} }, q = {};
1246
- /**
1247
- * @license React
1248
- * react-jsx-runtime.production.js
1249
- *
1250
- * Copyright (c) Meta Platforms, Inc. and affiliates.
1251
- *
1252
- * This source code is licensed under the MIT license found in the
1253
- * LICENSE file in the root directory of this source tree.
1254
- */
1255
- var tt;
1256
- function ht() {
1257
- if (tt) return q;
1258
- tt = 1;
1259
- var c = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
1260
- function e(s, r, i) {
1261
- var l = null;
1262
- if (i !== void 0 && (l = "" + i), r.key !== void 0 && (l = "" + r.key), "key" in r) {
1263
- i = {};
1264
- for (var u in r)
1265
- u !== "key" && (i[u] = r[u]);
1266
- } else i = r;
1267
- return r = i.ref, {
1268
- $$typeof: c,
1269
- type: s,
1270
- key: l,
1271
- ref: r !== void 0 ? r : null,
1272
- props: i
1273
- };
1274
- }
1275
- return q.Fragment = t, q.jsx = e, q.jsxs = e, q;
1276
- }
1277
- var P = {};
1278
- /**
1279
- * @license React
1280
- * react-jsx-runtime.development.js
1281
- *
1282
- * Copyright (c) Meta Platforms, Inc. and affiliates.
1283
- *
1284
- * This source code is licensed under the MIT license found in the
1285
- * LICENSE file in the root directory of this source tree.
1286
- */
1287
- var et;
1288
- function mt() {
1289
- return et || (et = 1, process.env.NODE_ENV !== "production" && function() {
1290
- function c(n) {
1291
- if (n == null) return null;
1292
- if (typeof n == "function")
1293
- return n.$$typeof === I ? null : n.displayName || n.name || null;
1294
- if (typeof n == "string") return n;
1295
- switch (n) {
1296
- case k:
1297
- return "Fragment";
1298
- case F:
1299
- return "Profiler";
1300
- case M:
1301
- return "StrictMode";
1302
- case R:
1303
- return "Suspense";
1304
- case _:
1305
- return "SuspenseList";
1306
- case f:
1307
- return "Activity";
1308
- }
1309
- if (typeof n == "object")
1310
- switch (typeof n.tag == "number" && console.error(
1311
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
1312
- ), n.$$typeof) {
1313
- case A:
1314
- return "Portal";
1315
- case T:
1316
- return n.displayName || "Context";
1317
- case z:
1318
- return (n._context.displayName || "Context") + ".Consumer";
1319
- case L:
1320
- var a = n.render;
1321
- return n = n.displayName, n || (n = a.displayName || a.name || "", n = n !== "" ? "ForwardRef(" + n + ")" : "ForwardRef"), n;
1322
- case O:
1323
- return a = n.displayName || null, a !== null ? a : c(n.type) || "Memo";
1324
- case p:
1325
- a = n._payload, n = n._init;
1326
- try {
1327
- return c(n(a));
1328
- } catch {
1329
- }
1330
- }
1331
- return null;
1332
- }
1333
- function t(n) {
1334
- return "" + n;
1335
- }
1336
- function e(n) {
1337
- try {
1338
- t(n);
1339
- var a = !1;
1340
- } catch {
1341
- a = !0;
1342
- }
1343
- if (a) {
1344
- a = console;
1345
- var d = a.error, h = typeof Symbol == "function" && Symbol.toStringTag && n[Symbol.toStringTag] || n.constructor.name || "Object";
1346
- return d.call(
1347
- a,
1348
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
1349
- h
1350
- ), t(n);
1351
- }
1352
- }
1353
- function s(n) {
1354
- if (n === k) return "<>";
1355
- if (typeof n == "object" && n !== null && n.$$typeof === p)
1356
- return "<...>";
1357
- try {
1358
- var a = c(n);
1359
- return a ? "<" + a + ">" : "<...>";
1360
- } catch {
1361
- return "<...>";
1362
- }
1363
- }
1364
- function r() {
1365
- var n = j.A;
1366
- return n === null ? null : n.getOwner();
1367
- }
1368
- function i() {
1369
- return Error("react-stack-top-frame");
1370
- }
1371
- function l(n) {
1372
- if (Q.call(n, "key")) {
1373
- var a = Object.getOwnPropertyDescriptor(n, "key").get;
1374
- if (a && a.isReactWarning) return !1;
1375
- }
1376
- return n.key !== void 0;
1377
- }
1378
- function u(n, a) {
1379
- function d() {
1380
- J || (J = !0, console.error(
1381
- "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
1382
- a
1383
- ));
1384
- }
1385
- d.isReactWarning = !0, Object.defineProperty(n, "key", {
1386
- get: d,
1387
- configurable: !0
1388
- });
1389
- }
1390
- function v() {
1391
- var n = c(this.type);
1392
- return X[n] || (X[n] = !0, console.error(
1393
- "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
1394
- )), n = this.props.ref, n !== void 0 ? n : null;
1395
- }
1396
- function y(n, a, d, h, B, H) {
1397
- var m = d.ref;
1398
- return n = {
1399
- $$typeof: C,
1400
- type: n,
1401
- key: a,
1402
- props: d,
1403
- _owner: h
1404
- }, (m !== void 0 ? m : null) !== null ? Object.defineProperty(n, "ref", {
1405
- enumerable: !1,
1406
- get: v
1407
- }) : Object.defineProperty(n, "ref", { enumerable: !1, value: null }), n._store = {}, Object.defineProperty(n._store, "validated", {
1408
- configurable: !1,
1409
- enumerable: !1,
1410
- writable: !0,
1411
- value: 0
1412
- }), Object.defineProperty(n, "_debugInfo", {
1413
- configurable: !1,
1414
- enumerable: !1,
1415
- writable: !0,
1416
- value: null
1417
- }), Object.defineProperty(n, "_debugStack", {
1418
- configurable: !1,
1419
- enumerable: !1,
1420
- writable: !0,
1421
- value: B
1422
- }), Object.defineProperty(n, "_debugTask", {
1423
- configurable: !1,
1424
- enumerable: !1,
1425
- writable: !0,
1426
- value: H
1427
- }), Object.freeze && (Object.freeze(n.props), Object.freeze(n)), n;
1428
- }
1429
- function g(n, a, d, h, B, H) {
1430
- var m = a.children;
1431
- if (m !== void 0)
1432
- if (h)
1433
- if (it(m)) {
1434
- for (h = 0; h < m.length; h++)
1435
- x(m[h]);
1436
- Object.freeze && Object.freeze(m);
1437
- } else
1438
- console.error(
1439
- "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
1440
- );
1441
- else x(m);
1442
- if (Q.call(a, "key")) {
1443
- m = c(n);
1444
- var E = Object.keys(a).filter(function(ot) {
1445
- return ot !== "key";
1446
- });
1447
- h = 0 < E.length ? "{key: someKey, " + E.join(": ..., ") + ": ...}" : "{key: someKey}", K[m + h] || (E = 0 < E.length ? "{" + E.join(": ..., ") + ": ...}" : "{}", console.error(
1448
- `A props object containing a "key" prop is being spread into JSX:
1449
- let props = %s;
1450
- <%s {...props} />
1451
- React keys must be passed directly to JSX without using spread:
1452
- let props = %s;
1453
- <%s key={someKey} {...props} />`,
1454
- h,
1455
- m,
1456
- E,
1457
- m
1458
- ), K[m + h] = !0);
1459
- }
1460
- if (m = null, d !== void 0 && (e(d), m = "" + d), l(a) && (e(a.key), m = "" + a.key), "key" in a) {
1461
- d = {};
1462
- for (var N in a)
1463
- N !== "key" && (d[N] = a[N]);
1464
- } else d = a;
1465
- return m && u(
1466
- d,
1467
- typeof n == "function" ? n.displayName || n.name || "Unknown" : n
1468
- ), y(
1469
- n,
1470
- m,
1471
- d,
1472
- r(),
1473
- B,
1474
- H
1475
- );
1476
- }
1477
- function x(n) {
1478
- S(n) ? n._store && (n._store.validated = 1) : typeof n == "object" && n !== null && n.$$typeof === p && (n._payload.status === "fulfilled" ? S(n._payload.value) && n._payload.value._store && (n._payload.value._store.validated = 1) : n._store && (n._store.validated = 1));
1479
- }
1480
- function S(n) {
1481
- return typeof n == "object" && n !== null && n.$$typeof === C;
1482
- }
1483
- var b = Y, C = Symbol.for("react.transitional.element"), A = Symbol.for("react.portal"), k = Symbol.for("react.fragment"), M = Symbol.for("react.strict_mode"), F = Symbol.for("react.profiler"), z = Symbol.for("react.consumer"), T = Symbol.for("react.context"), L = Symbol.for("react.forward_ref"), R = Symbol.for("react.suspense"), _ = Symbol.for("react.suspense_list"), O = Symbol.for("react.memo"), p = Symbol.for("react.lazy"), f = Symbol.for("react.activity"), I = Symbol.for("react.client.reference"), j = b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Q = Object.prototype.hasOwnProperty, it = Array.isArray, D = console.createTask ? console.createTask : function() {
1484
- return null;
1485
- };
1486
- b = {
1487
- react_stack_bottom_frame: function(n) {
1488
- return n();
1489
- }
1490
- };
1491
- var J, X = {}, G = b.react_stack_bottom_frame.bind(
1492
- b,
1493
- i
1494
- )(), Z = D(s(i)), K = {};
1495
- P.Fragment = k, P.jsx = function(n, a, d) {
1496
- var h = 1e4 > j.recentlyCreatedOwnerStacks++;
1497
- return g(
1498
- n,
1499
- a,
1500
- d,
1501
- !1,
1502
- h ? Error("react-stack-top-frame") : G,
1503
- h ? D(s(n)) : Z
1504
- );
1505
- }, P.jsxs = function(n, a, d) {
1506
- var h = 1e4 > j.recentlyCreatedOwnerStacks++;
1507
- return g(
1508
- n,
1509
- a,
1510
- d,
1511
- !0,
1512
- h ? Error("react-stack-top-frame") : G,
1513
- h ? D(s(n)) : Z
1514
- );
1515
- };
1516
- }()), P;
1517
- }
1518
- process.env.NODE_ENV === "production" ? W.exports = ht() : W.exports = mt();
1519
- var st = W.exports;
1520
- const ft = (c) => {
1250
+ const X = (l) => {
1521
1251
  const {
1522
1252
  src: t,
1523
1253
  autoplay: e,
1524
- muted: s,
1525
- controls: r = !0,
1526
- poster: i,
1527
- preload: l,
1528
- theme: u,
1529
- s3Config: v,
1530
- analytics: y,
1531
- hlsConfig: g,
1532
- onReady: x,
1533
- onPlay: S,
1534
- onPause: b,
1535
- onEnded: C,
1536
- onTimeUpdate: A,
1537
- onVolumeChange: k,
1538
- onError: M,
1539
- style: F,
1540
- className: z,
1541
- width: T = "100%",
1542
- height: L = "500px"
1543
- } = c, R = U(null), _ = U(null);
1544
- return $(() => {
1545
- if (!R.current) return;
1546
- const O = {
1254
+ muted: n,
1255
+ controls: i = !0,
1256
+ poster: s,
1257
+ preload: r,
1258
+ theme: a,
1259
+ s3Config: c,
1260
+ analytics: d,
1261
+ hlsConfig: m,
1262
+ subtitles: z,
1263
+ stickyControls: A,
1264
+ onReady: k,
1265
+ onPlay: E,
1266
+ onPause: x,
1267
+ onEnded: S,
1268
+ onTimeUpdate: C,
1269
+ onVolumeChange: L,
1270
+ onError: T,
1271
+ onLoadedMetadata: q,
1272
+ onQualityChange: M,
1273
+ style: H,
1274
+ className: U,
1275
+ width: g = "100%",
1276
+ height: v = "500px"
1277
+ } = l, y = w(null), B = w(null);
1278
+ return f(() => {
1279
+ if (!y.current) return;
1280
+ const D = {
1547
1281
  src: t,
1548
- container: R.current,
1282
+ container: y.current,
1549
1283
  autoplay: e,
1550
- muted: s,
1551
- controls: r,
1552
- poster: i,
1553
- preload: l,
1554
- theme: u,
1555
- s3Config: v,
1556
- analytics: y,
1557
- hlsConfig: g
1558
- }, p = new nt(O);
1559
- return _.current = p, S && p.on("play", S), b && p.on("pause", b), C && p.on("ended", C), M && p.on("error", (f) => {
1284
+ muted: n,
1285
+ controls: i,
1286
+ poster: s,
1287
+ preload: r,
1288
+ theme: a,
1289
+ s3Config: c,
1290
+ analytics: d,
1291
+ hlsConfig: m,
1292
+ subtitles: z,
1293
+ stickyControls: A
1294
+ }, u = new R(D);
1295
+ return B.current = u, E && u.on("play", E), x && u.on("pause", x), S && u.on("ended", S), T && u.on("error", (h) => {
1560
1296
  var I;
1561
- return M((I = f.data) == null ? void 0 : I.error);
1562
- }), A && p.on("timeupdate", (f) => A(f.data.currentTime)), k && p.on("volumechange", (f) => k(f.data.volume, f.data.muted)), x && x(p), () => {
1563
- p.destroy(), _.current = null;
1297
+ return T((I = h.data) == null ? void 0 : I.error);
1298
+ }), q && u.on("loadedmetadata", q), M && u.on("qualitychange", (h) => M(h.data.level)), C && u.on("timeupdate", (h) => C(h.data.currentTime)), L && u.on("volumechange", (h) => L(h.data.volume, h.data.muted)), k && k(u), () => {
1299
+ u.destroy(), B.current = null;
1564
1300
  };
1565
- }, [t]), $(() => {
1566
- _.current;
1567
- }, [e, s, r]), /* @__PURE__ */ st.jsx(
1301
+ }, [t]), /* @__PURE__ */ $(
1568
1302
  "div",
1569
1303
  {
1570
- ref: R,
1571
- className: z,
1304
+ ref: y,
1305
+ className: U,
1572
1306
  style: {
1573
- width: typeof T == "number" ? `${T}px` : T,
1574
- height: typeof L == "number" ? `${L}px` : L,
1575
- ...F
1307
+ width: typeof g == "number" ? `${g}px` : g,
1308
+ height: typeof v == "number" ? `${v}px` : v,
1309
+ ...H
1576
1310
  }
1577
1311
  }
1578
1312
  );
1579
- }, yt = (c) => {
1580
- const [t, e] = V(null), [s, r] = V(null), i = U(null);
1581
- return $(() => {
1582
- if (!i.current) return;
1583
- const l = new nt({
1584
- ...c,
1585
- container: i.current
1313
+ }, G = (l) => {
1314
+ const [t, e] = b(null), [n, i] = b(null), s = w(null);
1315
+ return f(() => {
1316
+ if (!s.current) return;
1317
+ const r = new R({
1318
+ ...l,
1319
+ container: s.current
1586
1320
  });
1587
- e(l);
1588
- const u = () => {
1589
- r(l.getState());
1321
+ e(r);
1322
+ const a = () => {
1323
+ i(r.getState());
1590
1324
  };
1591
- return l.on("play", u), l.on("pause", u), l.on("timeupdate", u), l.on("volumechange", u), l.on("loadedmetadata", u), () => {
1592
- l.destroy();
1325
+ return r.on("play", a), r.on("pause", a), r.on("timeupdate", a), r.on("volumechange", a), r.on("loadedmetadata", a), () => {
1326
+ r.destroy();
1593
1327
  };
1594
- }, [c.src]), {
1595
- containerRef: i,
1328
+ }, [l.src]), {
1329
+ containerRef: s,
1596
1330
  player: t,
1597
- state: s
1331
+ state: n
1598
1332
  };
1599
- }, rt = Y.createContext({
1333
+ }, P = F.createContext({
1600
1334
  player: null,
1601
1335
  state: null
1602
- }), bt = (c) => {
1603
- const { player: t, children: e } = c, [s, r] = V(t.getState());
1604
- return $(() => {
1605
- const i = () => {
1606
- r(t.getState());
1336
+ }), J = (l) => {
1337
+ const { player: t, children: e } = l, [n, i] = b(t.getState());
1338
+ return f(() => {
1339
+ const s = () => {
1340
+ i(t.getState());
1607
1341
  };
1608
- return t.on("play", i), t.on("pause", i), t.on("timeupdate", i), t.on("volumechange", i), t.on("loadedmetadata", i), () => {
1342
+ return t.on("play", s), t.on("pause", s), t.on("timeupdate", s), t.on("volumechange", s), t.on("loadedmetadata", s), () => {
1609
1343
  };
1610
- }, [t]), /* @__PURE__ */ st.jsx(rt.Provider, { value: { player: t, state: s }, children: e });
1611
- }, wt = () => {
1612
- const c = Y.useContext(rt);
1613
- if (!c.player)
1344
+ }, [t]), /* @__PURE__ */ $(P.Provider, { value: { player: t, state: n }, children: e });
1345
+ }, Z = () => {
1346
+ const l = F.useContext(P);
1347
+ if (!l.player)
1614
1348
  throw new Error("useWontumPlayerContext must be used within WontumPlayerProvider");
1615
- return c;
1349
+ return l;
1616
1350
  };
1617
1351
  export {
1618
- ct as Analytics,
1619
- dt as S3Handler,
1620
- ut as UIController,
1621
- nt as WontumPlayer,
1622
- bt as WontumPlayerProvider,
1623
- ft as WontumPlayerReact,
1624
- yt as useWontumPlayer,
1625
- wt as useWontumPlayerContext
1352
+ j as Analytics,
1353
+ Q as S3Handler,
1354
+ W as UIController,
1355
+ R as WontumPlayer,
1356
+ J as WontumPlayerProvider,
1357
+ X as WontumPlayerReact,
1358
+ G as useWontumPlayer,
1359
+ Z as useWontumPlayerContext
1626
1360
  };