@hopeplayer/core 1.0.9 → 1.0.11

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.
@@ -183,7 +183,7 @@ class ve {
183
183
  (t = this.nativeHlsProbe) == null || t.call(this), (e = this.nativeAudioCleanup) == null || e.call(this), this.hls && (this.hls.destroy(), this.hls = null);
184
184
  }
185
185
  }
186
- function E(a) {
186
+ function x(a) {
187
187
  if (!Number.isFinite(a) || a < 0) return "0:00";
188
188
  const t = Math.floor(a), e = Math.floor(t / 3600), i = Math.floor(t % 3600 / 60), r = t % 60, o = e > 0 ? String(i).padStart(2, "0") : String(i), n = String(r).padStart(2, "0");
189
189
  return e > 0 ? `${e}:${o}:${n}` : `${o}:${n}`;
@@ -218,7 +218,7 @@ class ke {
218
218
  return;
219
219
  }
220
220
  const r = e.start + i * (e.end - e.start);
221
- this.hoverTimeEl.textContent = e.live ? `-${E(e.end - r)}` : E(r), this.hoverTimeEl.setAttribute("data-visible", "");
221
+ this.hoverTimeEl.textContent = e.live ? `-${x(e.end - r)}` : x(r), this.hoverTimeEl.setAttribute("data-visible", "");
222
222
  const o = this.el.getBoundingClientRect(), n = this.hoverTimeEl.offsetWidth, l = Math.min(Math.max(t.clientX - o.left - n / 2, 0), Math.max(o.width - n, 0));
223
223
  this.hoverTimeEl.style.transform = `translateX(${l}px)`;
224
224
  });
@@ -366,14 +366,14 @@ class ke {
366
366
  this.rafId !== null && cancelAnimationFrame(this.rafId), this.resizeObserver.disconnect(), this.el.removeEventListener("pointermove", this.onHoverMove), this.el.removeEventListener("pointerleave", this.onHoverLeave), this.video.removeEventListener("play", this.startLoop), this.video.removeEventListener("pause", this.stopLoop), this.video.removeEventListener("ended", this.stopLoop), this.video.removeEventListener("timeupdate", this.render), this.video.removeEventListener("progress", this.render), this.video.removeEventListener("loadedmetadata", this.render), this.clearMarkers(), (t = this.chaptersEl) == null || t.remove();
367
367
  }
368
368
  }
369
- function w(a, t = "") {
369
+ function k(a, t = "") {
370
370
  const e = document.createElement("i");
371
371
  return e.className = `hp-icon hp-icon-${a}${t ? ` ${t}` : ""}`, e.setAttribute("aria-hidden", "true"), e;
372
372
  }
373
- function A(a, t) {
373
+ function C(a, t) {
374
374
  a.className = a.className.replace(/hp-icon-[\w-]+/, `hp-icon-${t}`);
375
375
  }
376
- const L = 0.05, we = 150;
376
+ const A = 0.05, we = 150;
377
377
  class xe {
378
378
  constructor(t, e, i) {
379
379
  s(this, "el");
@@ -400,10 +400,10 @@ class xe {
400
400
  s(this, "onWheel", (t) => {
401
401
  if (t.preventDefault(), this.adHooks.isAdActive()) {
402
402
  const r = this.adHooks.getVolume();
403
- this.adHooks.setVolume(Math.min(1, Math.max(0, r + (t.deltaY < 0 ? L : -L)))), this.render();
403
+ this.adHooks.setVolume(Math.min(1, Math.max(0, r + (t.deltaY < 0 ? A : -A)))), this.render();
404
404
  return;
405
405
  }
406
- const e = this.video.muted ? 0 : this.video.volume, i = Math.min(1, Math.max(0, e + (t.deltaY < 0 ? L : -L)));
406
+ const e = this.video.muted ? 0 : this.video.volume, i = Math.min(1, Math.max(0, e + (t.deltaY < 0 ? A : -A)));
407
407
  this.video.volume = i, this.video.muted = i === 0;
408
408
  });
409
409
  s(this, "onToggleMute", () => {
@@ -441,11 +441,11 @@ class xe {
441
441
  const e = t === 0 ? this.labels.unmute : this.labels.mute;
442
442
  this.button.setAttribute("aria-label", e);
443
443
  const i = this.adHooks.isAdActive() || !this.video.paused;
444
- this.unmuteBadge.toggleAttribute("data-visible", t === 0 && i), this.unmuteText.textContent = this.labels.unmute, t === 0 ? A(this.iconEl, "volume-muted") : t < 0.5 ? A(this.iconEl, "volume-low") : A(this.iconEl, "volume-high");
444
+ this.unmuteBadge.toggleAttribute("data-visible", t === 0 && i), this.unmuteText.textContent = this.labels.unmute, t === 0 ? C(this.iconEl, "volume-muted") : t < 0.5 ? C(this.iconEl, "volume-low") : C(this.iconEl, "volume-high");
445
445
  });
446
- this.video = t, this.labels = e, this.adHooks = i, this.el = document.createElement("div"), this.el.className = "hp-volume hp:relative hp:flex hp:items-center", this.unmuteBadge = document.createElement("button"), this.unmuteBadge.type = "button", this.unmuteBadge.className = "hp-unmute-badge", this.unmuteBadge.setAttribute("part", "unmute-badge"), this.unmuteBadge.appendChild(w("volume-muted", "hp:text-base")), this.unmuteText = document.createElement("span"), this.unmuteText.textContent = e.unmute, this.unmuteBadge.appendChild(this.unmuteText), this.unmuteBadge.addEventListener("pointerdown", (o) => o.stopPropagation()), this.unmuteBadge.addEventListener("click", (o) => {
446
+ this.video = t, this.labels = e, this.adHooks = i, this.el = document.createElement("div"), this.el.className = "hp-volume hp:relative hp:flex hp:items-center", this.unmuteBadge = document.createElement("button"), this.unmuteBadge.type = "button", this.unmuteBadge.className = "hp-unmute-badge", this.unmuteBadge.setAttribute("part", "unmute-badge"), this.unmuteBadge.appendChild(k("volume-muted", "hp:text-base")), this.unmuteText = document.createElement("span"), this.unmuteText.textContent = e.unmute, this.unmuteBadge.appendChild(this.unmuteText), this.unmuteBadge.addEventListener("pointerdown", (o) => o.stopPropagation()), this.unmuteBadge.addEventListener("click", (o) => {
447
447
  o.stopPropagation(), this.unmute();
448
- }), this.button = document.createElement("button"), this.button.type = "button", this.button.setAttribute("part", "volume-button"), this.button.className = "hp-chip hp:flex hp:items-center hp:justify-center hp:w-[var(--hp-ctrl-btn-size)] hp:h-[var(--hp-ctrl-btn-size)] hp:cursor-pointer", this.button.setAttribute("aria-label", e.mute), this.button.dataset.shortcut = "M", this.iconEl = w("volume-high", "hp:text-[length:var(--hp-ctrl-icon-size)]"), this.button.appendChild(this.iconEl), this.el.appendChild(this.button), this.slider = document.createElement("div"), this.slider.setAttribute("part", "volume-slider"), this.slider.className = "hp-chip hp:absolute hp:bottom-full hp:left-1/2 hp-center-x hp:mb-2 hp:w-7 hp:h-20 hp:rounded-full hp:cursor-pointer hp:flex hp:items-end hp:justify-center hp:p-1.5 hp:pointer-events-none hp:transition-opacity hp:duration-150 hp:will-change-[opacity]", this.slider.style.opacity = "0", this.slider.style.borderRadius = "9999px", this.slider.setAttribute("role", "slider"), this.slider.setAttribute("tabindex", "0"), this.slider.setAttribute("aria-label", e.volume), this.slider.setAttribute("aria-orientation", "vertical"), this.slider.setAttribute("aria-valuemin", "0"), this.slider.setAttribute("aria-valuemax", "100");
448
+ }), this.button = document.createElement("button"), this.button.type = "button", this.button.setAttribute("part", "volume-button"), this.button.className = "hp-chip hp:flex hp:items-center hp:justify-center hp:w-[var(--hp-ctrl-btn-size)] hp:h-[var(--hp-ctrl-btn-size)] hp:cursor-pointer", this.button.setAttribute("aria-label", e.mute), this.button.dataset.shortcut = "M", this.iconEl = k("volume-high", "hp:text-[length:var(--hp-ctrl-icon-size)]"), this.button.appendChild(this.iconEl), this.el.appendChild(this.button), this.slider = document.createElement("div"), this.slider.setAttribute("part", "volume-slider"), this.slider.className = "hp-chip hp:absolute hp:bottom-full hp:left-1/2 hp-center-x hp:mb-2 hp:w-7 hp:h-20 hp:rounded-full hp:cursor-pointer hp:flex hp:items-end hp:justify-center hp:p-1.5 hp:pointer-events-none hp:transition-opacity hp:duration-150 hp:will-change-[opacity]", this.slider.style.opacity = "0", this.slider.style.borderRadius = "9999px", this.slider.setAttribute("role", "slider"), this.slider.setAttribute("tabindex", "0"), this.slider.setAttribute("aria-label", e.volume), this.slider.setAttribute("aria-orientation", "vertical"), this.slider.setAttribute("aria-valuemin", "0"), this.slider.setAttribute("aria-valuemax", "100");
449
449
  const r = document.createElement("div");
450
450
  r.className = "hp:relative hp:w-1.5 hp:h-full hp:rounded-full hp:bg-on-surface/25 hp:overflow-hidden", this.slider.appendChild(r), this.sliderFill = document.createElement("div"), this.sliderFill.className = "hp:absolute hp:inset-x-0 hp:bottom-0 hp:bg-accent", r.appendChild(this.sliderFill), this.el.appendChild(this.slider), this.button.addEventListener("click", this.onToggleMute), this.slider.addEventListener("pointerdown", this.onSliderPointerDown), this.slider.addEventListener("keydown", this.onSliderKeyDown), this.el.addEventListener("mouseenter", this.openNow), this.el.addEventListener("mouseleave", this.scheduleHide), this.el.addEventListener("focusin", this.openNow), this.el.addEventListener("focusout", this.scheduleHide), this.el.addEventListener("wheel", this.onWheel, { passive: !1 }), t.addEventListener("volumechange", this.render), t.addEventListener("play", this.render), t.addEventListener("pause", this.render), this.render();
451
451
  }
@@ -483,7 +483,7 @@ class xe {
483
483
  this.hideTimer && clearTimeout(this.hideTimer), this.el.removeEventListener("mouseenter", this.openNow), this.el.removeEventListener("mouseleave", this.scheduleHide), this.el.removeEventListener("focusin", this.openNow), this.el.removeEventListener("focusout", this.scheduleHide), this.el.removeEventListener("wheel", this.onWheel), this.video.removeEventListener("volumechange", this.render), this.video.removeEventListener("play", this.render), this.video.removeEventListener("pause", this.render), this.unmuteBadge.remove();
484
484
  }
485
485
  }
486
- const Ee = 8, P = 8, Ce = 100, V = 256;
486
+ const Ee = 8, S = 8, Ce = 100, V = 256;
487
487
  class Te {
488
488
  constructor(t, e, i) {
489
489
  s(this, "el");
@@ -514,17 +514,17 @@ class Te {
514
514
  if (!t) return;
515
515
  const e = t.getBoundingClientRect(), i = this.button.getBoundingClientRect(), r = this.el.getBoundingClientRect(), o = !!this.el.closest(".hp-top-bar");
516
516
  this.panel.toggleAttribute("data-drop", o), Object.assign(this.panel.style, { top: "", bottom: "", marginTop: "", marginBottom: "" });
517
- const n = this.panel.scrollHeight, l = (o ? e.bottom - i.bottom : i.top - e.top) - Ee - P;
517
+ const n = this.panel.scrollHeight, l = (o ? e.bottom - i.bottom : i.top - e.top) - Ee - S;
518
518
  if (n <= l || l >= Ce) {
519
519
  this.panel.style.maxHeight = `${Math.min(V, l)}px`;
520
520
  return;
521
521
  }
522
- this.panel.style.maxHeight = `${Math.min(V, e.height - 2 * P)}px`, o ? Object.assign(this.panel.style, { top: `${e.top + P - r.top}px`, marginTop: "0" }) : Object.assign(this.panel.style, { bottom: `${r.bottom - (e.bottom - P)}px`, marginBottom: "0" });
522
+ this.panel.style.maxHeight = `${Math.min(V, e.height - 2 * S)}px`, o ? Object.assign(this.panel.style, { top: `${e.top + S - r.top}px`, marginTop: "0" }) : Object.assign(this.panel.style, { bottom: `${r.bottom - (e.bottom - S)}px`, marginBottom: "0" });
523
523
  });
524
524
  s(this, "onDocumentClick", (t) => {
525
525
  this.open && !t.composedPath().includes(this.el) && this.close();
526
526
  });
527
- this.video = t, this.playbackRates = e, this.labels = i, this.activeQualityLabel = i.autoQuality, this.activeCaptionLabel = i.captionsOff, this.el = document.createElement("div"), this.el.className = "hp:relative", this.button = document.createElement("button"), this.button.type = "button", this.button.setAttribute("aria-label", i.settings), this.button.className = "hp-chip hp:flex hp:items-center hp:justify-center hp:w-[var(--hp-ctrl-btn-size)] hp:h-[var(--hp-ctrl-btn-size)] hp:cursor-pointer", this.button.appendChild(w("settings", "hp:text-[length:var(--hp-ctrl-icon-size)]")), this.panel = document.createElement("div"), this.panel.className = "hp-chip hp-chip-panel hp:hidden hp:absolute hp:bottom-full hp:right-0 hp:mb-2 hp:w-48 hp:max-h-64 hp:overflow-y-auto hp:text-sm hp:py-1", this.panelObserver = new MutationObserver(this.fitToPlayer), this.panelObserver.observe(this.panel, { childList: !0 }), this.el.appendChild(this.button), this.el.appendChild(this.panel), this.button.addEventListener("click", (r) => {
527
+ this.video = t, this.playbackRates = e, this.labels = i, this.activeQualityLabel = i.autoQuality, this.activeCaptionLabel = i.captionsOff, this.el = document.createElement("div"), this.el.className = "hp:relative", this.button = document.createElement("button"), this.button.type = "button", this.button.setAttribute("aria-label", i.settings), this.button.className = "hp-chip hp:flex hp:items-center hp:justify-center hp:w-[var(--hp-ctrl-btn-size)] hp:h-[var(--hp-ctrl-btn-size)] hp:cursor-pointer", this.button.appendChild(k("settings", "hp:text-[length:var(--hp-ctrl-icon-size)]")), this.panel = document.createElement("div"), this.panel.className = "hp-chip hp-chip-panel hp:hidden hp:absolute hp:bottom-full hp:right-0 hp:mb-2 hp:w-48 hp:max-h-64 hp:overflow-y-auto hp:text-sm hp:py-1", this.panelObserver = new MutationObserver(this.fitToPlayer), this.panelObserver.observe(this.panel, { childList: !0 }), this.el.appendChild(this.button), this.el.appendChild(this.panel), this.button.addEventListener("click", (r) => {
528
528
  r.stopPropagation(), this.toggle();
529
529
  }), document.addEventListener("click", this.onDocumentClick, !0), this.renderMain();
530
530
  }
@@ -581,7 +581,7 @@ class Te {
581
581
  }
582
582
  backRow(t, e) {
583
583
  const i = document.createElement("button");
584
- i.type = "button", i.className = "hp:flex hp:items-center hp:gap-2 hp:w-full hp:px-3 hp:py-2 hp:text-left hp:bg-transparent hp:border-0 hp:cursor-pointer hp:text-on-surface hp:font-medium hp:hover:bg-on-surface/10", i.appendChild(w("chevron-left", "hp:text-sm"));
584
+ i.type = "button", i.className = "hp:flex hp:items-center hp:gap-2 hp:w-full hp:px-3 hp:py-2 hp:text-left hp:bg-transparent hp:border-0 hp:cursor-pointer hp:text-on-surface hp:font-medium hp:hover:bg-on-surface/10", i.appendChild(k("chevron-left", "hp:text-sm"));
585
585
  const r = document.createElement("span");
586
586
  return r.textContent = t, i.appendChild(r), i.addEventListener("click", e), i;
587
587
  }
@@ -728,18 +728,18 @@ function se(a, t) {
728
728
  }
729
729
  const Ae = 15, Se = 480, Le = 150, _ = ["waiting", "seeking"], G = ["playing", "canplay", "canplaythrough", "seeked", "pause", "error", "emptied"];
730
730
  function q(a, t) {
731
- const { btn: e } = T("", `skip-${a}`);
731
+ const { btn: e } = E("", `skip-${a}`);
732
732
  e.classList.add("hp-skip-btn"), e.setAttribute("part", t);
733
733
  const i = document.createElement("span");
734
734
  return i.className = "hp-skip-num", i.setAttribute("aria-hidden", "true"), e.appendChild(i), e.style.display = "none", { btn: e, num: i };
735
735
  }
736
- function x(a, t) {
736
+ function w(a, t) {
737
737
  a.setAttribute("aria-label", t);
738
738
  }
739
- function T(a, t, e) {
739
+ function E(a, t, e) {
740
740
  const i = document.createElement("button");
741
- i.type = "button", x(i, a), e && (i.dataset.shortcut = e), i.className = "hp-chip hp:flex hp:items-center hp:justify-center hp:w-[var(--hp-ctrl-btn-size)] hp:h-[var(--hp-ctrl-btn-size)] hp:cursor-pointer hp:shrink-0";
742
- const r = w(t, "hp:text-[length:var(--hp-ctrl-icon-size)]");
741
+ i.type = "button", w(i, a), e && (i.dataset.shortcut = e), i.className = "hp-chip hp:flex hp:items-center hp:justify-center hp:w-[var(--hp-ctrl-btn-size)] hp:h-[var(--hp-ctrl-btn-size)] hp:cursor-pointer hp:shrink-0";
742
+ const r = k(t, "hp:text-[length:var(--hp-ctrl-icon-size)]");
743
743
  return i.appendChild(r), { btn: i, icon: r };
744
744
  }
745
745
  class Pe {
@@ -785,7 +785,7 @@ class Pe {
785
785
  });
786
786
  s(this, "renderPlayState", () => {
787
787
  const t = this.callbacks.isAdActive() ? this.callbacks.adIsPaused() : this.video.paused;
788
- A(this.playIcon, t ? "play" : "pause"), x(this.playButton, t ? this.labels.play : this.labels.pause);
788
+ C(this.playIcon, t ? "play" : "pause"), w(this.playButton, t ? this.labels.play : this.labels.pause);
789
789
  });
790
790
  s(this, "renderTime", () => {
791
791
  var r, o;
@@ -794,9 +794,9 @@ class Pe {
794
794
  const n = this.video.duration, l = this.video.currentTime;
795
795
  if (this.showRemaining) {
796
796
  const d = Number.isFinite(n) ? Math.floor(n) : 0, m = Math.max(0, d - Math.floor(l));
797
- this.timeLabel.textContent = `-${E(m)} / ${E(n)}`;
797
+ this.timeLabel.textContent = `-${x(m)} / ${x(n)}`;
798
798
  } else
799
- this.timeLabel.textContent = `${E(l)} / ${E(n)}`;
799
+ this.timeLabel.textContent = `${x(l)} / ${x(n)}`;
800
800
  return;
801
801
  }
802
802
  const e = ((o = (r = this.callbacks).liveSyncPosition) == null ? void 0 : o.call(r)) ?? this.liveEdge(), i = e !== null && e - this.video.currentTime > Ae;
@@ -826,7 +826,7 @@ class Pe {
826
826
  l.className = "hp-loading-ring", l.setAttribute("aria-hidden", "true");
827
827
  const d = document.createElement("span");
828
828
  d.className = "hp-loading-ring-mask", d.appendChild(document.createElement("span")), l.appendChild(d), n.appendChild(l);
829
- const m = T(r.play, "play", "K");
829
+ const m = E(r.play, "play", "K");
830
830
  this.playButton = m.btn, this.playIcon = m.icon, this.playButton.setAttribute("part", "play-pause-button"), this.playButton.addEventListener("click", () => this.togglePlay()), n.appendChild(this.playButton), this.skipBack = q("back", "skip-back-button"), this.skipBack.btn.addEventListener("click", () => this.skip(-(this.skipSeconds.back ?? 0))), this.skipForward = q("forward", "skip-forward-button"), this.skipForward.btn.addEventListener("click", () => this.skip(this.skipSeconds.forward ?? 0)), n.append(this.skipBack.btn, this.skipForward.btn), this.volumePanel = new xe(t, r, i.adVolume), n.appendChild(this.volumePanel.el), this.timeLabel = document.createElement("button"), this.timeLabel.type = "button", this.timeLabel.setAttribute("part", "time-display"), this.timeLabel.className = "hp:text-xs hp:text-on-surface hp:tabular-nums hp:whitespace-nowrap hp:px-1 hp:bg-transparent hp:border-0 hp:cursor-pointer hp:select-none hp:p-0 hp:hover:opacity-80 hp:transition-opacity hp:focus-visible:outline-none hp:focus-visible:ring-1 hp:focus-visible:ring-accent hp:rounded", this.timeLabel.textContent = "0:00 / 0:00", this.timeLabel.addEventListener("click", this.onTimeClick), n.appendChild(this.timeLabel), this.liveBadge = document.createElement("button"), this.liveBadge.type = "button", this.liveBadge.className = "hp-live-badge", this.liveBadge.setAttribute("part", "live-badge"), this.liveBadge.setAttribute("aria-label", r.goToLive);
831
831
  const c = document.createElement("span");
832
832
  c.className = "hp-live-dot", this.liveText = document.createElement("span"), this.liveText.textContent = r.live, this.liveBadge.append(c, this.liveText), this.liveBadge.style.display = "none", this.liveBadge.addEventListener("click", this.goToLive), n.appendChild(this.liveBadge);
@@ -834,9 +834,9 @@ class Pe {
834
834
  h.className = "hp:flex-1", o.appendChild(h);
835
835
  const p = document.createElement("div");
836
836
  p.className = "hp-group hp:flex hp:items-center hp:gap-1 hp:px-1.5 hp:py-1 hp:shrink-0 hp:pointer-events-auto", o.appendChild(p), this.rightGroup = p, this.settingsMenu = new Te(t, e, r), p.appendChild(this.settingsMenu.el), this.extraButtonAnchor = this.settingsMenu.el, this.row = p;
837
- const u = T(r.pip, "pip");
837
+ const u = E(r.pip, "pip");
838
838
  this.pipButton = u.btn, this.pipButton.addEventListener("click", () => this.togglePip()), document.pictureInPictureEnabled || (this.pipButton.style.display = "none"), p.appendChild(this.pipButton);
839
- const b = T(r.fullscreenEnter, "fullscreen-enter", "F");
839
+ const b = E(r.fullscreenEnter, "fullscreen-enter", "F");
840
840
  this.fullscreenButton = b.btn, this.fullscreenIcon = b.icon, this.fullscreenButton.addEventListener("click", () => this.toggleFullscreen()), p.appendChild(this.fullscreenButton), this.topEl = document.createElement("div"), this.topEl.className = "hp-top-bar", this.topEl.setAttribute("part", "top-bar"), this.fullscreenSlot = document.createElement("div"), this.fullscreenSlot.className = "hp-group hp:items-center hp:px-1.5 hp:py-1 hp:shrink-0 hp:pointer-events-auto", this.fullscreenSlot.style.display = "none", o.appendChild(this.fullscreenSlot), this.resizeObserver = new ResizeObserver(() => this.updateLayout()), this.resizeObserver.observe(this.el), t.addEventListener("play", this.renderPlayState), t.addEventListener("pause", this.renderPlayState), t.addEventListener("timeupdate", this.renderTime), t.addEventListener("loadedmetadata", this.renderTime), t.addEventListener("durationchange", this.renderTime), t.addEventListener("progress", this.renderTime), t.addEventListener("emptied", this.renderTime);
841
841
  for (const g of _) t.addEventListener(g, this.onLoadingStart);
842
842
  for (const g of G) t.addEventListener(g, this.onLoadingEnd);
@@ -851,7 +851,7 @@ class Pe {
851
851
  e !== this.compact && (this.compact = e, this.settingsMenu.closeMenu(), this.el.toggleAttribute("data-compact", e), (i = this.el.closest(".video-area")) == null || i.toggleAttribute("data-compact", e), e ? (this.fullscreenSlot.appendChild(this.fullscreenButton), this.fullscreenSlot.style.display = this.adMode ? "none" : "flex", this.topEl.appendChild(this.rightGroup)) : (this.rightGroup.appendChild(this.fullscreenButton), this.bottomRow.insertBefore(this.rightGroup, this.fullscreenSlot), this.fullscreenSlot.style.display = "none"));
852
852
  }
853
853
  setFullscreenState(t) {
854
- A(this.fullscreenIcon, t ? "fullscreen-exit" : "fullscreen-enter"), x(this.fullscreenButton, t ? this.labels.fullscreenExit : this.labels.fullscreenEnter);
854
+ C(this.fullscreenIcon, t ? "fullscreen-exit" : "fullscreen-enter"), w(this.fullscreenButton, t ? this.labels.fullscreenExit : this.labels.fullscreenEnter);
855
855
  }
856
856
  /** Dil sonradan değişince (`options.locale`/`labels`) statik (reaktif olarak yeniden render edilmeyen) etiketleri tazeler. */
857
857
  /** Geri/ileri sarma butonları — `null` süre o butonu gizler. */
@@ -864,7 +864,7 @@ class Pe {
864
864
  }
865
865
  renderSkipButtons() {
866
866
  const t = (e, i, r) => {
867
- e.btn.style.display = i === null || this.adMode ? "none" : "", i !== null && (e.num.textContent = String(i), e.num.toggleAttribute("data-long", String(i).length > 2), x(e.btn, r(i)));
867
+ e.btn.style.display = i === null || this.adMode ? "none" : "", i !== null && (e.num.textContent = String(i), e.num.toggleAttribute("data-long", String(i).length > 2), w(e.btn, r(i)));
868
868
  };
869
869
  t(this.skipBack, this.skipSeconds.back, this.labels.skipBack), t(this.skipForward, this.skipSeconds.forward, this.labels.skipForward);
870
870
  }
@@ -873,7 +873,7 @@ class Pe {
873
873
  !t || !this.seekingEnabled || (se(this.video, t), (e = this.onSkip) == null || e.call(this, t));
874
874
  }
875
875
  refreshLabels() {
876
- this.renderPlayState(), this.renderSkipButtons(), x(this.pipButton, this.labels.pip), x(this.liveBadge, this.labels.goToLive), this.liveText.textContent = this.labels.live, this.setFullscreenState(this.callbacks.isFullscreen()), this.seekBar.refreshLabels(), this.volumePanel.refreshLabels(), this.settingsMenu.refreshLabels();
876
+ this.renderPlayState(), this.renderSkipButtons(), w(this.pipButton, this.labels.pip), w(this.liveBadge, this.labels.goToLive), this.liveText.textContent = this.labels.live, this.setFullscreenState(this.callbacks.isFullscreen()), this.seekBar.refreshLabels(), this.volumePanel.refreshLabels(), this.settingsMenu.refreshLabels();
877
877
  }
878
878
  /** Reklam modu: seek bar, süre ve sağ grup gizlenir; oynat/duraklat + ses kalır. */
879
879
  setAdMode(t) {
@@ -894,7 +894,7 @@ class Pe {
894
894
  }
895
895
  /** Plugin'lerin (loop-section vb.) kontrol çubuğuna kendi butonlarını eklemesi için — ayarlar menüsünden önce yerleştirilir. */
896
896
  addButton(t, e, i) {
897
- const { btn: r, icon: o } = T(t, e);
897
+ const { btn: r, icon: o } = E(t, e);
898
898
  return r.addEventListener("click", i), this.row.insertBefore(r, this.extraButtonAnchor), { btn: r, icon: o };
899
899
  }
900
900
  toggleTimeMode() {
@@ -938,7 +938,7 @@ class Pe {
938
938
  this.loadingTimer && clearTimeout(this.loadingTimer), this.resizeObserver.disconnect(), this.topEl.remove(), this.seekBar.destroy(), this.settingsMenu.destroy();
939
939
  }
940
940
  }
941
- const Me = 450, Be = 60, X = 8, R = 6, Re = /* @__PURE__ */ new Set(["seek-bar", "time-display"]);
941
+ const Me = 450, Be = 60, X = 8, M = 6, Re = /* @__PURE__ */ new Set(["seek-bar", "time-display"]);
942
942
  function ze() {
943
943
  return typeof window.matchMedia != "function" || window.matchMedia("(hover: hover)").matches;
944
944
  }
@@ -1020,13 +1020,13 @@ class Ne {
1020
1020
  position(t) {
1021
1021
  const e = this.mountEl.getBoundingClientRect(), i = t.getBoundingClientRect(), r = this.el.getBoundingClientRect();
1022
1022
  let o = i.top - e.top - r.height - X;
1023
- o < R && (o = i.bottom - e.top + X);
1023
+ o < M && (o = i.bottom - e.top + X);
1024
1024
  let n = i.left - e.left + i.width / 2 - r.width / 2;
1025
- const l = e.width - r.width - R;
1026
- n = Math.max(R, Math.min(n, l)), this.el.style.top = `${o}px`, this.el.style.left = `${n}px`;
1025
+ const l = e.width - r.width - M;
1026
+ n = Math.max(M, Math.min(n, l)), this.el.style.top = `${o}px`, this.el.style.left = `${n}px`;
1027
1027
  }
1028
1028
  }
1029
- class Fe {
1029
+ class Oe {
1030
1030
  constructor(t, e, i) {
1031
1031
  s(this, "host");
1032
1032
  s(this, "video");
@@ -1074,7 +1074,7 @@ class Fe {
1074
1074
  this.host.removeEventListener("keydown", this.onKeyDown);
1075
1075
  }
1076
1076
  }
1077
- class Oe {
1077
+ class Fe {
1078
1078
  constructor(t) {
1079
1079
  s(this, "el");
1080
1080
  s(this, "video");
@@ -1107,7 +1107,7 @@ class De {
1107
1107
  const i = document.createElement("div");
1108
1108
  i.className = "hp-error-card";
1109
1109
  const r = document.createElement("div");
1110
- r.className = "hp-error-icon", r.appendChild(w("warning")), i.appendChild(r), this.messageEl = document.createElement("p"), this.messageEl.className = "hp-error-message", i.appendChild(this.messageEl), this.codeEl = document.createElement("p"), this.codeEl.className = "hp-error-code", i.appendChild(this.codeEl), this.retryBtn = document.createElement("button"), this.retryBtn.type = "button", this.retryBtn.className = "hp-error-retry", this.retryBtn.innerHTML = Ie, this.retryText = document.createElement("span"), this.retryText.textContent = e.retry, this.retryBtn.appendChild(this.retryText), this.retryBtn.addEventListener("click", () => {
1110
+ r.className = "hp-error-icon", r.appendChild(k("warning")), i.appendChild(r), this.messageEl = document.createElement("p"), this.messageEl.className = "hp-error-message", i.appendChild(this.messageEl), this.codeEl = document.createElement("p"), this.codeEl.className = "hp-error-code", i.appendChild(this.codeEl), this.retryBtn = document.createElement("button"), this.retryBtn.type = "button", this.retryBtn.className = "hp-error-retry", this.retryBtn.innerHTML = Ie, this.retryText = document.createElement("span"), this.retryText.textContent = e.retry, this.retryBtn.appendChild(this.retryText), this.retryBtn.addEventListener("click", () => {
1111
1111
  var o;
1112
1112
  this.dismiss(), (o = this.onRetry) == null || o.call(this);
1113
1113
  }), i.appendChild(this.retryBtn), this.el.appendChild(i), t.addEventListener("error", this.show);
@@ -1153,19 +1153,19 @@ class De {
1153
1153
  this.video.removeEventListener("error", this.show);
1154
1154
  }
1155
1155
  }
1156
- const N = /* @__PURE__ */ new WeakMap(), re = /* @__PURE__ */ new WeakSet(), B = /* @__PURE__ */ new WeakMap();
1156
+ const R = /* @__PURE__ */ new WeakMap(), re = /* @__PURE__ */ new WeakSet(), P = /* @__PURE__ */ new WeakMap();
1157
1157
  function He(a) {
1158
1158
  return re.has(a);
1159
1159
  }
1160
1160
  function oe(a, t, e, i, r) {
1161
- let o = N.get(a);
1162
- o || N.set(a, o = /* @__PURE__ */ new Map());
1161
+ let o = R.get(a);
1162
+ o || R.set(a, o = /* @__PURE__ */ new Map());
1163
1163
  const n = `${t}\0${e}\0${i}\0${r}`;
1164
1164
  let l = o.get(n);
1165
1165
  return l || (l = a.addTextTrack(e, i, r), re.add(l), o.set(n, l)), l;
1166
1166
  }
1167
1167
  function ne(a, t) {
1168
- for (const [e, i] of N.get(a) ?? [])
1168
+ for (const [e, i] of R.get(a) ?? [])
1169
1169
  if (e.startsWith(`${t}\0`)) {
1170
1170
  i.mode = "hidden";
1171
1171
  for (const r of Array.from(i.cues ?? [])) i.removeCue(r);
@@ -1174,7 +1174,7 @@ function ne(a, t) {
1174
1174
  }
1175
1175
  function Ve(a, t) {
1176
1176
  ae(a);
1177
- const e = B.get(a), i = [];
1177
+ const e = P.get(a), i = [];
1178
1178
  for (const r of t) {
1179
1179
  const o = oe(a, "options", "subtitles", r.label, r.srclang);
1180
1180
  o.mode = r.default ? "hidden" : "disabled", i.push({ label: r.label, track: o }), Ge(a, o, r.src, e);
@@ -1182,7 +1182,7 @@ function Ve(a, t) {
1182
1182
  return i;
1183
1183
  }
1184
1184
  function ae(a) {
1185
- B.set(a, (B.get(a) ?? 0) + 1), ne(a, "options");
1185
+ P.set(a, (P.get(a) ?? 0) + 1), ne(a, "options");
1186
1186
  }
1187
1187
  function _e(a, t) {
1188
1188
  let e = null;
@@ -1202,7 +1202,7 @@ async function Ge(a, t, e, i) {
1202
1202
  console.warn("[HopePlayer] altyazı yüklenemedi:", e, o);
1203
1203
  return;
1204
1204
  }
1205
- if (!(B.get(a) !== i || typeof VTTCue != "function"))
1205
+ if (!(P.get(a) !== i || typeof VTTCue != "function"))
1206
1206
  for (const o of Xe(r)) {
1207
1207
  const n = new VTTCue(o.start, o.end, o.text);
1208
1208
  Ue(n, o.settings), t.addCue(n);
@@ -1238,7 +1238,7 @@ function Ue(a, t) {
1238
1238
  }
1239
1239
  }
1240
1240
  }
1241
- const M = 6, Qe = 20, Ke = 14, We = 6, je = 10, Ye = 3, le = "hope-caption-row", he = "hope-caption-font-size", K = "hope-caption-bg-color", W = "hope-caption-text-color", $e = {
1241
+ const L = 6, Qe = 20, Ke = 14, We = 6, je = 10, Ye = 3, le = "hope-caption-row", he = "hope-caption-font-size", K = "hope-caption-bg-color", W = "hope-caption-text-color", $e = {
1242
1242
  small: 0.78,
1243
1243
  normal: 1,
1244
1244
  large: 1.35
@@ -1253,7 +1253,7 @@ const M = 6, Qe = 20, Ke = 14, We = 6, je = 10, Ye = 3, le = "hope-caption-row",
1253
1253
  function Ze() {
1254
1254
  try {
1255
1255
  const a = window.localStorage.getItem(le), t = a === null ? 0 : Number(a);
1256
- return Number.isFinite(t) && t >= 0 && t < M ? t : 0;
1256
+ return Number.isFinite(t) && t >= 0 && t < L ? t : 0;
1257
1257
  } catch {
1258
1258
  return 0;
1259
1259
  }
@@ -1275,7 +1275,7 @@ function $(a, t) {
1275
1275
  return e;
1276
1276
  }
1277
1277
  }
1278
- class S {
1278
+ class T {
1279
1279
  constructor(t, e, i, r) {
1280
1280
  s(this, "layerEl");
1281
1281
  s(this, "bubbleEl");
@@ -1324,7 +1324,7 @@ class S {
1324
1324
  });
1325
1325
  s(this, "onPointerUp", (t) => {
1326
1326
  if (!this.dragging || (this.dragging = !1, this.bubbleEl.releasePointerCapture(t.pointerId), this.bubbleEl.removeEventListener("pointermove", this.onPointerMove), this.bubbleEl.removeEventListener("pointerup", this.onPointerUp), this.bubbleEl.removeEventListener("pointercancel", this.onPointerUp), this.rafId !== null && (cancelAnimationFrame(this.rafId), this.rafId = null), this.bubbleEl.classList.remove("hp-caption-dragging"), !this.dragMoved)) return;
1327
- const { min: e, max: i } = this.bounds(), r = Math.min(i, Math.max(e, this.dragStartBottomPx - this.pendingDeltaPx)), o = i > e ? (r - e) / (i - e) : 0, n = Math.round(o * (M - 1));
1327
+ const { min: e, max: i } = this.bounds(), r = Math.min(i, Math.max(e, this.dragStartBottomPx - this.pendingDeltaPx)), o = i > e ? (r - e) / (i - e) : 0, n = Math.round(o * (L - 1));
1328
1328
  this.setRowIndex(n, !0, r);
1329
1329
  });
1330
1330
  this.videoArea = e, this.seekBarEl = i, this.labels = r, this.layerEl = document.createElement("div"), this.layerEl.className = "hp-caption-layer", this.layerEl.setAttribute("part", "caption-layer"), this.bubbleEl = document.createElement("div"), this.bubbleEl.className = "hp-caption-bubble", this.bubbleEl.setAttribute("part", "caption-bubble"), this.bubbleEl.setAttribute("role", "note"), this.bubbleEl.setAttribute("aria-label", r.captionDragHandle), this.bubbleEl.tabIndex = -1, this.applyFontSizeVar(), this.bubbleEl.style.setProperty("--hp-caption-bg", this.bgColor), this.bubbleEl.style.setProperty("--hp-caption-text", this.textColor), this.layerEl.appendChild(this.bubbleEl), this.bubbleEl.addEventListener("pointerdown", this.onPointerDown), this.resizeObserver = new ResizeObserver(() => this.recomputePosition()), this.resizeObserver.observe(this.videoArea), this.recomputePosition();
@@ -1379,12 +1379,12 @@ class S {
1379
1379
  return { min: n, max: l };
1380
1380
  }
1381
1381
  pxForRow(t) {
1382
- const { min: e, max: i } = this.bounds(), r = t / (M - 1);
1382
+ const { min: e, max: i } = this.bounds(), r = t / (L - 1);
1383
1383
  return Math.round(e + r * (i - e));
1384
1384
  }
1385
1385
  /** FLIP: bottom anında yazılır, yalnızca transform animasyonlanır — bottom'u animasyonlamak bırakınca zıplatıyordu. */
1386
1386
  setRowIndex(t, e, i) {
1387
- this.rowIndex = Math.min(M - 1, Math.max(0, t));
1387
+ this.rowIndex = Math.min(L - 1, Math.max(0, t));
1388
1388
  const r = this.pxForRow(this.rowIndex), o = i ?? parseFloat(this.bubbleEl.style.bottom || `${r}`);
1389
1389
  e && o !== r ? (this.bubbleEl.classList.add("hp-caption-no-transition"), this.bubbleEl.style.bottom = `${r}px`, this.bubbleEl.style.transform = `translateX(-50%) translateY(${r - o}px)`, this.bubbleEl.offsetHeight, this.bubbleEl.classList.remove("hp-caption-no-transition"), this.bubbleEl.style.transform = "translateX(-50%)") : (this.bubbleEl.style.transform = "translateX(-50%)", this.bubbleEl.style.bottom = `${r}px`);
1390
1390
  try {
@@ -1404,7 +1404,7 @@ class S {
1404
1404
  this.activeTrack && this.activeTrack.removeEventListener("cuechange", this.onCueChange), this.resizeObserver.disconnect(), this.rafId !== null && cancelAnimationFrame(this.rafId), this.bubbleEl.removeEventListener("pointerdown", this.onPointerDown);
1405
1405
  }
1406
1406
  }
1407
- s(S, "BG_COLOR_PRESETS", j), s(S, "TEXT_COLOR_PRESETS", Y);
1407
+ s(T, "BG_COLOR_PRESETS", j), s(T, "TEXT_COLOR_PRESETS", Y);
1408
1408
  class et {
1409
1409
  constructor(t) {
1410
1410
  s(this, "el");
@@ -1689,7 +1689,7 @@ function ce(a, t) {
1689
1689
  function pt(a, t, e) {
1690
1690
  Object.assign(a, ce(t, e));
1691
1691
  }
1692
- const ct = [0.5, 0.75, 1, 1.25, 1.5, 2], J = 1200, dt = 3e3, ee = 5e3, ut = 10, te = 10, mt = 5, ie = "stream-audio", z = "1.0.9", bt = (
1692
+ const ct = [0.5, 0.75, 1, 1.25, 1.5, 2], J = 1200, dt = 3e3, ee = 5e3, ut = 10, te = 10, mt = 5, ie = "stream-audio", B = "1.0.11", bt = (
1693
1693
  /* html */
1694
1694
  `
1695
1695
  <div class="video-area">
@@ -1780,6 +1780,18 @@ class de extends HTMLElement {
1780
1780
  */
1781
1781
  s(this, "bootResolved", !1);
1782
1782
  s(this, "bootGraceTimer", null);
1783
+ /**
1784
+ * Son uygulanan `.options` nesnesi + attribute'lar. `.options` element sayfaya eklenmeden önce verilince
1785
+ * connectedCallback AYNI seçenekleri yeniden uyguluyordu; değişen bir şey yoksa bu ikinci geçiş atlanır.
1786
+ */
1787
+ s(this, "lastSynced", null);
1788
+ /**
1789
+ * applyOptions'ın asenkron kısmı (plugin kurulumu + kaynak yükleme) aynı anda tek kez çalışır. İki geçiş
1790
+ * üst üste binince `!this.adsController` gibi kontroller ikisinde de geçiyor, plugin (ör. IMA) iki kez kuruluyordu.
1791
+ * Çalışırken gelen seçenekler bekletilir; bitince yalnızca en sonuncusu uygulanır.
1792
+ */
1793
+ s(this, "pluginApplyRun", null);
1794
+ s(this, "pendingPluginOptions", null);
1783
1795
  s(this, "_options", {});
1784
1796
  s(this, "hideTimer", null);
1785
1797
  s(this, "cursorTimer", null);
@@ -1806,7 +1818,7 @@ class de extends HTMLElement {
1806
1818
  s(this, "onContextMenu", (e) => {
1807
1819
  const i = this.contextMenuConfig;
1808
1820
  !i || this.lastPointerType !== "mouse" || (e.preventDefault(), this.contextMenu.show(e.clientX, e.clientY, [
1809
- { label: "HopeCorePlayer", meta: `v${z}` },
1821
+ { label: "HopeCorePlayer", meta: `v${B}` },
1810
1822
  ...i.stats ? [{ label: this.i18n.statsTitle, onSelect: () => void this.toggleStats(!0) }] : []
1811
1823
  ]));
1812
1824
  });
@@ -1945,9 +1957,9 @@ class de extends HTMLElement {
1945
1957
  const e = document.createElement("style");
1946
1958
  e.textContent = be, this.root.appendChild(e);
1947
1959
  const i = document.createElement("div");
1948
- i.className = "hp-root", i.innerHTML = bt, this.root.appendChild(i), this.videoArea = this.root.querySelector(".video-area"), this.videoEl = this.root.querySelector("video"), this.adLayerEl = this.root.querySelector('[part="ad-layer"]'), this.instanceKey = `hp-${Math.random().toString(36).slice(2, 10)}`, this.loadingSpinner = new Oe(this.videoEl), this.root.querySelector(".media-layer").appendChild(this.loadingSpinner.el), this.errorScreen = new De(this.videoEl, this.i18n), this.errorScreen.setOnRetry(() => void this.sourceManager.reload()), this.videoArea.appendChild(this.errorScreen.el), this.centerPlayButton = document.createElement("button"), this.centerPlayButton.type = "button", this.centerPlayButton.setAttribute("part", "center-play-button"), this.centerPlayButton.setAttribute("aria-label", this.i18n.play), this.centerPlayButton.className = "hp-center-play hp:absolute hp:inset-0 hp:flex hp:items-center hp:justify-center hp:bg-transparent hp:border-0 hp:cursor-pointer hp:text-on-surface hp:transition-opacity";
1960
+ i.className = "hp-root", i.innerHTML = bt, this.root.appendChild(i), this.videoArea = this.root.querySelector(".video-area"), this.videoEl = this.root.querySelector("video"), this.adLayerEl = this.root.querySelector('[part="ad-layer"]'), this.instanceKey = `hp-${Math.random().toString(36).slice(2, 10)}`, this.loadingSpinner = new Fe(this.videoEl), this.root.querySelector(".media-layer").appendChild(this.loadingSpinner.el), this.errorScreen = new De(this.videoEl, this.i18n), this.errorScreen.setOnRetry(() => void this.sourceManager.reload()), this.videoArea.appendChild(this.errorScreen.el), this.centerPlayButton = document.createElement("button"), this.centerPlayButton.type = "button", this.centerPlayButton.setAttribute("part", "center-play-button"), this.centerPlayButton.setAttribute("aria-label", this.i18n.play), this.centerPlayButton.className = "hp-center-play hp:absolute hp:inset-0 hp:flex hp:items-center hp:justify-center hp:bg-transparent hp:border-0 hp:cursor-pointer hp:text-on-surface hp:transition-opacity";
1949
1961
  const r = document.createElement("span");
1950
- r.className = "hp-chip hp:flex hp:items-center hp:justify-center hp:w-16 hp:h-16", r.style.borderRadius = "9999px", r.appendChild(w("play", "hp:text-2xl")), this.centerPlayButton.appendChild(r), this.centerPlayButton.addEventListener("click", (o) => {
1962
+ r.className = "hp-chip hp:flex hp:items-center hp:justify-center hp:w-16 hp:h-16", r.style.borderRadius = "9999px", r.appendChild(k("play", "hp:text-2xl")), this.centerPlayButton.appendChild(r), this.centerPlayButton.addEventListener("click", (o) => {
1951
1963
  var c;
1952
1964
  const n = () => {
1953
1965
  this.videoEl.paused && this.videoEl.play();
@@ -1997,7 +2009,7 @@ class de extends HTMLElement {
1997
2009
  }
1998
2010
  },
1999
2011
  this.i18n
2000
- ), this.chromeEl.appendChild(this.controlBar.el), this.chromeEl.appendChild(this.controlBar.topEl), this.videoArea.appendChild(this.controlBar.volumePanel.unmuteBadge), this.captionRenderer = new S(this.videoEl, this.videoArea, this.controlBar.seekBar.el, this.i18n), this.videoArea.appendChild(this.captionRenderer.layerEl), this.keyboard = new Fe(
2012
+ ), this.chromeEl.appendChild(this.controlBar.el), this.chromeEl.appendChild(this.controlBar.topEl), this.videoArea.appendChild(this.controlBar.volumePanel.unmuteBadge), this.captionRenderer = new T(this.videoEl, this.videoArea, this.controlBar.seekBar.el, this.i18n), this.videoArea.appendChild(this.captionRenderer.layerEl), this.keyboard = new Oe(
2001
2013
  this,
2002
2014
  this.videoEl,
2003
2015
  () => this.isFullscreenActive() ? this.exitFullscreenCompat() : this.requestFullscreenCompat()
@@ -2017,8 +2029,8 @@ class de extends HTMLElement {
2017
2029
  }), this.videoEl.addEventListener("mousedown", this.onVideoPressStart), this.videoEl.addEventListener("mouseup", this.onVideoPressEnd), this.videoEl.addEventListener("mouseleave", this.onVideoPressCancel), this.videoEl.addEventListener("touchstart", this.onVideoPressStart, { passive: !0 }), this.videoEl.addEventListener("touchend", this.onVideoPressEnd), this.videoEl.addEventListener("touchcancel", this.onVideoPressCancel), this.dispatchEvent(new CustomEvent("hp:ready"));
2018
2030
  }
2019
2031
  disconnectedCallback() {
2020
- var e, i, r, o, n, l, d, m, c, h, p, u, b, g, y, k, v, C, f, F, O, I;
2021
- (e = this.centerPlayObserver) == null || e.disconnect(), this.showCursor(), (i = this.miniProgress) == null || i.destroy(), this.miniProgress = null, this.videoEl.removeEventListener("play", this.onPlay), this.videoEl.removeEventListener("pause", this.onPause), this.removeEventListener("pointermove", this.onPointerMove), this.removeEventListener("pointerleave", this.onPointerLeave), this.removeEventListener("pointerdown", this.onPointerDownFocus), this.controlBar.settingsMenu.onOpenChange = null, document.removeEventListener("fullscreenchange", this.onFullscreenChange), document.removeEventListener("webkitfullscreenchange", this.onFullscreenChange), this.videoEl.removeEventListener("webkitbeginfullscreen", this.onFullscreenChange), this.videoEl.removeEventListener("webkitendfullscreen", this.onFullscreenChange), this.removeEventListener("contextmenu", this.onContextMenu), this.removeEventListener("pointerdown", this.onPointerTypeTrack, !0), this.videoEl.textTracks.removeEventListener("addtrack", this.onNativeTextTracksChanged), this.videoEl.textTracks.removeEventListener("removetrack", this.onNativeTextTracksChanged), this.videoEl.removeEventListener("mousedown", this.onVideoPressStart), this.videoEl.removeEventListener("mouseup", this.onVideoPressEnd), this.videoEl.removeEventListener("mouseleave", this.onVideoPressCancel), this.videoEl.removeEventListener("touchstart", this.onVideoPressStart), this.videoEl.removeEventListener("touchend", this.onVideoPressEnd), this.videoEl.removeEventListener("touchcancel", this.onVideoPressCancel), this.controlBar.destroy(), this.captionRenderer.destroy(), this.keyboard.destroy(), this.tooltip.destroy(), this.loadingSpinner.destroy(), this.errorScreen.destroy(), this.seekFeedback.destroy(), this.contextMenu.destroy(), (r = this.statsPanel) == null || r.destroy(), (o = this.tapGestures) == null || o.destroy(), this.sourceManager.destroy(), (n = this.adsController) == null || n.destroy(), (l = this.gestureControls) == null || l.destroy(), (d = this.loopSection) == null || d.destroy(), (m = this.inViewAutoplay) == null || m.destroy(), (c = this.unregisterSticky) == null || c.call(this), (h = this.playlistRunner) == null || h.destroy(), (p = this.hopeStory) == null || p.destroy(), (u = this.markProgress) == null || u.destroy(), (b = this.segments) == null || b.destroy(), (g = this.spriteThumbnails) == null || g.destroy(), (y = this.countdownScreen) == null || y.destroy(), (k = this.geoChecker) == null || k.destroy(), (v = this.redirectScreen) == null || v.destroy(), (C = this.qrResume) == null || C.destroy(), (f = this.pauseAd) == null || f.destroy(), this.pauseAd = null, (F = this.dubbing) == null || F.destroy(), (O = this.liveWallClock) == null || O.destroy(), (I = this.daiController) == null || I.destroy(), this.hideTimer && clearTimeout(this.hideTimer), this.bootGraceTimer && clearTimeout(this.bootGraceTimer);
2032
+ var e, i, r, o, n, l, d, m, c, h, p, u, b, g, f, v, y, z, N, O, F, I;
2033
+ (e = this.centerPlayObserver) == null || e.disconnect(), this.showCursor(), (i = this.miniProgress) == null || i.destroy(), this.miniProgress = null, this.videoEl.removeEventListener("play", this.onPlay), this.videoEl.removeEventListener("pause", this.onPause), this.removeEventListener("pointermove", this.onPointerMove), this.removeEventListener("pointerleave", this.onPointerLeave), this.removeEventListener("pointerdown", this.onPointerDownFocus), this.controlBar.settingsMenu.onOpenChange = null, document.removeEventListener("fullscreenchange", this.onFullscreenChange), document.removeEventListener("webkitfullscreenchange", this.onFullscreenChange), this.videoEl.removeEventListener("webkitbeginfullscreen", this.onFullscreenChange), this.videoEl.removeEventListener("webkitendfullscreen", this.onFullscreenChange), this.removeEventListener("contextmenu", this.onContextMenu), this.removeEventListener("pointerdown", this.onPointerTypeTrack, !0), this.videoEl.textTracks.removeEventListener("addtrack", this.onNativeTextTracksChanged), this.videoEl.textTracks.removeEventListener("removetrack", this.onNativeTextTracksChanged), this.videoEl.removeEventListener("mousedown", this.onVideoPressStart), this.videoEl.removeEventListener("mouseup", this.onVideoPressEnd), this.videoEl.removeEventListener("mouseleave", this.onVideoPressCancel), this.videoEl.removeEventListener("touchstart", this.onVideoPressStart), this.videoEl.removeEventListener("touchend", this.onVideoPressEnd), this.videoEl.removeEventListener("touchcancel", this.onVideoPressCancel), this.controlBar.destroy(), this.captionRenderer.destroy(), this.keyboard.destroy(), this.tooltip.destroy(), this.loadingSpinner.destroy(), this.errorScreen.destroy(), this.seekFeedback.destroy(), this.contextMenu.destroy(), (r = this.statsPanel) == null || r.destroy(), (o = this.tapGestures) == null || o.destroy(), this.sourceManager.destroy(), (n = this.adsController) == null || n.destroy(), (l = this.gestureControls) == null || l.destroy(), (d = this.loopSection) == null || d.destroy(), (m = this.inViewAutoplay) == null || m.destroy(), (c = this.unregisterSticky) == null || c.call(this), (h = this.playlistRunner) == null || h.destroy(), (p = this.hopeStory) == null || p.destroy(), (u = this.markProgress) == null || u.destroy(), (b = this.segments) == null || b.destroy(), (g = this.spriteThumbnails) == null || g.destroy(), (f = this.countdownScreen) == null || f.destroy(), (v = this.geoChecker) == null || v.destroy(), (y = this.redirectScreen) == null || y.destroy(), (z = this.qrResume) == null || z.destroy(), (N = this.pauseAd) == null || N.destroy(), this.pauseAd = null, (O = this.dubbing) == null || O.destroy(), (F = this.liveWallClock) == null || F.destroy(), (I = this.daiController) == null || I.destroy(), this.hideTimer && clearTimeout(this.hideTimer), this.bootGraceTimer && clearTimeout(this.bootGraceTimer), this.lastSynced = null;
2022
2034
  }
2023
2035
  /** Reklam/consent-farkında plugin'lerin (gesture/sticky/in-view-autoplay) ortak sorgusu. */
2024
2036
  isAdPlaying() {
@@ -2031,7 +2043,7 @@ class de extends HTMLElement {
2031
2043
  return this._options;
2032
2044
  }
2033
2045
  set options(e) {
2034
- this._options = e ?? {}, this.bootGraceTimer && (clearTimeout(this.bootGraceTimer), this.bootGraceTimer = null), this.bootResolved = !0, this.syncFromAttributes();
2046
+ this._options = e ?? {}, this.bootGraceTimer && (clearTimeout(this.bootGraceTimer), this.bootGraceTimer = null), this.bootResolved = !0, this.lastSynced = null, this.syncFromAttributes();
2035
2047
  }
2036
2048
  play() {
2037
2049
  return this.videoEl.play();
@@ -2052,7 +2064,7 @@ class de extends HTMLElement {
2052
2064
  videoEl: this.videoEl,
2053
2065
  containerEl: this.videoArea,
2054
2066
  i18n: this.i18n,
2055
- version: z,
2067
+ version: B,
2056
2068
  getEngine: () => this.sourceManager.engine,
2057
2069
  getHls: () => this.sourceManager.hlsInstance
2058
2070
  }));
@@ -2078,6 +2090,7 @@ class de extends HTMLElement {
2078
2090
  this.controlBar.toggleTimeMode();
2079
2091
  }
2080
2092
  syncFromAttributes() {
2093
+ var r;
2081
2094
  const e = {
2082
2095
  src: this.getAttribute("src") ?? void 0,
2083
2096
  poster: this.getAttribute("poster") ?? void 0,
@@ -2086,21 +2099,42 @@ class de extends HTMLElement {
2086
2099
  loop: this.hasAttribute("loop"),
2087
2100
  theme: this.getAttribute("theme") ?? void 0,
2088
2101
  locale: this.getAttribute("locale") ?? void 0
2089
- };
2102
+ }, i = JSON.stringify(e);
2103
+ if (this.bootResolved) {
2104
+ if (((r = this.lastSynced) == null ? void 0 : r.options) === this._options && this.lastSynced.attrs === i) return;
2105
+ this.lastSynced = { options: this._options, attrs: i };
2106
+ }
2090
2107
  this.applyOptions({ ...e, ...this._options });
2091
2108
  }
2109
+ queuePluginApply(e) {
2110
+ return this.pendingPluginOptions = e, this.pluginApplyRun || (this.pluginApplyRun = (async () => {
2111
+ for (; this.pendingPluginOptions; ) {
2112
+ const i = this.pendingPluginOptions;
2113
+ this.pendingPluginOptions = null;
2114
+ try {
2115
+ await this.applyPluginsAndPlayback(i);
2116
+ } catch (r) {
2117
+ console.error("[hope-player] options could not be applied:", r);
2118
+ }
2119
+ }
2120
+ })().finally(() => {
2121
+ this.pluginApplyRun = null;
2122
+ })), this.pluginApplyRun;
2123
+ }
2092
2124
  async applyOptions(e) {
2093
- var n, l, d, m, c, h, p, u, b, g, y, k, v, C;
2125
+ var o, n, l, d, m, c, h, p, u, b, g, f, v, y;
2094
2126
  e.poster && (this.videoEl.poster = e.poster), this.videoEl.autoplay = !!e.autoplay, this.videoEl.muted = !!e.muted, this.videoEl.loop = !!e.loop, this.videoEl.preload = e.preload ?? "metadata", this.videoEl.playsInline = !0, this.videoEl.setAttribute("webkit-playsinline", ""), this.autoHideDelayMs = e.autoHideDelayMs ?? J, this.tapToPlay = e.tapToPlay ?? "auto", this.cursorHideDelayMs = e.cursorHideDelayMs === !1 ? null : e.cursorHideDelayMs ?? ee, this.cursorHideDelayMs === null && this.showCursor(), e.miniProgress && !this.miniProgress ? (this.miniProgress = new et(this.videoEl), this.videoArea.appendChild(this.miniProgress.el), this.updateMiniProgress()) : !e.miniProgress && this.miniProgress && (this.miniProgress.destroy(), this.miniProgress = null), this.contextMenuConfig = e.contextMenu === !1 ? null : { stats: typeof e.contextMenu == "object" && e.contextMenu.stats === !0 }, this.contextMenuConfig || this.contextMenu.close();
2095
2127
  const i = e.keyboardSeekStep && e.keyboardSeekStep > 0 ? e.keyboardSeekStep : mt;
2096
2128
  this.keyboard.seekStep = i, this.controlBar.seekBar.keyboardStep = i;
2097
2129
  const r = e.skipButtons === !0 ? {} : e.skipButtons || null;
2098
- if (this.controlBar.setSkipButtons(
2130
+ this.controlBar.setSkipButtons(
2099
2131
  r && r.back !== !1 ? r.back ?? te : null,
2100
2132
  r && r.forward !== !1 ? r.forward ?? te : null
2101
- ), e.showRemainingTime !== void 0 && e.showRemainingTime !== this.appliedShowRemaining && (this.appliedShowRemaining = e.showRemainingTime, this.controlBar.setShowRemaining(e.showRemainingTime)), e.theme ? this.setAttribute("data-theme", e.theme) : this.removeAttribute("data-theme"), this.localeCode = e.locale ?? "tr", pt(this.i18n, e.locale, e.labels), this.centerPlayButton.setAttribute("aria-label", this.i18n.play), this.controlBar.refreshLabels(), this.captionRenderer.refreshLabels(this.i18n), this.captionTrackActive && this.controlBar.settingsMenu.setCaptionAppearance(this.buildCaptionAppearance()), this.errorScreen.refreshLabels(), (n = this.playlistRunner) == null || n.refreshLabels(), (l = this.hopeStory) == null || l.refreshLabels(), (d = this.countdownScreen) == null || d.refreshLabels(), (m = this.geoChecker) == null || m.refreshLabels(), (c = this.redirectScreen) == null || c.refreshLabels(), (h = this.qrResume) == null || h.refreshLabels(), (p = this.pauseAd) == null || p.refreshLabels(), (u = this.dubbing) == null || u.refreshLabels(), this.onStreamAudioTracks(this.streamAudio.tracks, this.streamAudio.active), (b = this.statsPanel) == null || b.refreshLabels(), (g = this.liveWallClock) == null || g.refreshLabels(), (y = this.loopSection) == null || y.refreshLabels(), (k = this.markProgress) == null || k.refreshLabels(), (C = (v = this.unregisterSticky) == null ? void 0 : v.refreshLabels) == null || C.call(v), !this.bootResolved)
2102
- return;
2103
- const o = () => ({
2133
+ ), e.showRemainingTime !== void 0 && e.showRemainingTime !== this.appliedShowRemaining && (this.appliedShowRemaining = e.showRemainingTime, this.controlBar.setShowRemaining(e.showRemainingTime)), e.theme ? this.setAttribute("data-theme", e.theme) : this.removeAttribute("data-theme"), this.localeCode = e.locale ?? "tr", pt(this.i18n, e.locale, e.labels), this.centerPlayButton.setAttribute("aria-label", this.i18n.play), this.controlBar.refreshLabels(), this.captionRenderer.refreshLabels(this.i18n), this.captionTrackActive && this.controlBar.settingsMenu.setCaptionAppearance(this.buildCaptionAppearance()), this.errorScreen.refreshLabels(), (o = this.playlistRunner) == null || o.refreshLabels(), (n = this.hopeStory) == null || n.refreshLabels(), (l = this.countdownScreen) == null || l.refreshLabels(), (d = this.geoChecker) == null || d.refreshLabels(), (m = this.redirectScreen) == null || m.refreshLabels(), (c = this.qrResume) == null || c.refreshLabels(), (h = this.pauseAd) == null || h.refreshLabels(), (p = this.dubbing) == null || p.refreshLabels(), this.onStreamAudioTracks(this.streamAudio.tracks, this.streamAudio.active), (u = this.statsPanel) == null || u.refreshLabels(), (b = this.liveWallClock) == null || b.refreshLabels(), (g = this.loopSection) == null || g.refreshLabels(), (f = this.markProgress) == null || f.refreshLabels(), (y = (v = this.unregisterSticky) == null ? void 0 : v.refreshLabels) == null || y.call(v), this.bootResolved && await this.queuePluginApply(e);
2134
+ }
2135
+ /** applyOptions'ın asenkron kısmı — yalnızca queuePluginApply üzerinden, sırayla çalışır. */
2136
+ async applyPluginsAndPlayback(e) {
2137
+ const i = () => ({
2104
2138
  videoEl: this.videoEl,
2105
2139
  overlayContainerEl: this.videoArea,
2106
2140
  blockChrome: () => this.blockChrome("countdown-geo"),
@@ -2108,16 +2142,16 @@ class de extends HTMLElement {
2108
2142
  i18n: this.i18n
2109
2143
  });
2110
2144
  if (e.countdownScreen && !this.countdownScreen) {
2111
- const { installCountdownScreen: f } = await import("./index-rENB3n9O.js");
2112
- this.countdownScreen = f(o(), e.countdownScreen);
2145
+ const { installCountdownScreen: r } = await import("./index-rENB3n9O.js");
2146
+ this.countdownScreen = r(i(), e.countdownScreen);
2113
2147
  }
2114
2148
  if (e.geoChecker && !this.geoChecker) {
2115
- const { installGeoChecker: f } = await import("./index-BBmuCtKu.js");
2116
- this.geoChecker = f(o(), e.geoChecker);
2149
+ const { installGeoChecker: r } = await import("./index-BBmuCtKu.js");
2150
+ this.geoChecker = r(i(), e.geoChecker);
2117
2151
  }
2118
2152
  this.unblockChrome("boot"), this.countdownScreen && !this.countdownScreen.isComplete() ? (this.pendingPlaybackOptions = e, this.playbackInitRegistered || (this.playbackInitRegistered = !0, this.countdownScreen.onComplete(() => {
2119
- const f = this.pendingPlaybackOptions;
2120
- this.pendingPlaybackOptions = null, f && this.initPlayback(f);
2153
+ const r = this.pendingPlaybackOptions;
2154
+ this.pendingPlaybackOptions = null, r && this.initPlayback(r);
2121
2155
  }))) : await this.initPlayback(e);
2122
2156
  }
2123
2157
  async initPlayback(e) {
@@ -2196,7 +2230,7 @@ class de extends HTMLElement {
2196
2230
  );
2197
2231
  }
2198
2232
  if (e.playlist && !this.playlistRunner) {
2199
- const { installPlaylist: h } = await import("./index-BvIdZX8n.js");
2233
+ const { installPlaylist: h } = await import("./index-lwFM1iPV.js");
2200
2234
  this.playlistRunner = h(
2201
2235
  {
2202
2236
  videoEl: this.videoEl,
@@ -2216,7 +2250,7 @@ class de extends HTMLElement {
2216
2250
  );
2217
2251
  }
2218
2252
  if (e.story && !this.hopeStory) {
2219
- const { installStory: h } = await import("./index-DTYAPn_5.js");
2253
+ const { installStory: h } = await import("./index-d_U9dcN6.js");
2220
2254
  this.hopeStory = h(
2221
2255
  {
2222
2256
  videoEl: this.videoEl,
@@ -2237,7 +2271,7 @@ class de extends HTMLElement {
2237
2271
  );
2238
2272
  }
2239
2273
  if (e.markers && !this.markProgress) {
2240
- const { installMarkers: h } = await import("./index-D0EWYTFL.js");
2274
+ const { installMarkers: h } = await import("./index-BeBmx35F.js");
2241
2275
  this.markProgress = h(
2242
2276
  {
2243
2277
  videoEl: this.videoEl,
@@ -2249,11 +2283,11 @@ class de extends HTMLElement {
2249
2283
  );
2250
2284
  }
2251
2285
  if ((n = e.segments) != null && n.length && !this.segments) {
2252
- const { installSegments: h } = await import("./index-DX9Cypeq.js");
2286
+ const { installSegments: h } = await import("./index-C6ONQXlF.js");
2253
2287
  this.segments = h({ videoEl: this.videoEl, seekBar: this.controlBar.seekBar }, e.segments);
2254
2288
  }
2255
2289
  if (e.spriteThumbnails && !this.spriteThumbnails) {
2256
- const { installSpriteThumbnails: h } = await import("./index-DMmNJUbP.js");
2290
+ const { installSpriteThumbnails: h } = await import("./index-DGSYKljQ.js");
2257
2291
  this.spriteThumbnails = h(
2258
2292
  {
2259
2293
  videoEl: this.videoEl,
@@ -2333,10 +2367,10 @@ class de extends HTMLElement {
2333
2367
  addControlElement: (u) => this.controlBar.addElement(u),
2334
2368
  i18n: this.i18n,
2335
2369
  getPlayingDate: () => {
2336
- var y, k, v;
2337
- const u = (y = this.sourceManager.hlsInstance) == null ? void 0 : y.playingDate;
2370
+ var f, v, y;
2371
+ const u = (f = this.sourceManager.hlsInstance) == null ? void 0 : f.playingDate;
2338
2372
  if (u) return u;
2339
- const b = (v = (k = this.videoEl).getStartDate) == null ? void 0 : v.call(k), g = (b == null ? void 0 : b.getTime()) ?? NaN;
2373
+ const b = (y = (v = this.videoEl).getStartDate) == null ? void 0 : y.call(v), g = (b == null ? void 0 : b.getTime()) ?? NaN;
2340
2374
  return Number.isFinite(g) && g > 0 ? new Date(g + this.videoEl.currentTime * 1e3) : null;
2341
2375
  }
2342
2376
  },
@@ -2415,14 +2449,14 @@ class de extends HTMLElement {
2415
2449
  })),
2416
2450
  bgColorLabel: this.i18n.captionBgColor,
2417
2451
  getBgColorOptions: () => i(
2418
- S.BG_COLOR_PRESETS,
2452
+ T.BG_COLOR_PRESETS,
2419
2453
  () => this.captionRenderer.getBgColor(),
2420
2454
  (r) => this.captionRenderer.setBgColor(r),
2421
2455
  this.i18n.captionBgColor
2422
2456
  ),
2423
2457
  textColorLabel: this.i18n.captionTextColor,
2424
2458
  getTextColorOptions: () => i(
2425
- S.TEXT_COLOR_PRESETS,
2459
+ T.TEXT_COLOR_PRESETS,
2426
2460
  () => this.captionRenderer.getTextColor(),
2427
2461
  (r) => this.captionRenderer.setTextColor(r),
2428
2462
  this.i18n.captionTextColor
@@ -2566,12 +2600,12 @@ class de extends HTMLElement {
2566
2600
  }
2567
2601
  }
2568
2602
  /** Paket sürümü (ör. "1.0.4"). */
2569
- s(de, "version", z);
2603
+ s(de, "version", B);
2570
2604
  typeof window < "u" && !customElements.get("hope-player") && customElements.define("hope-player", de);
2571
2605
  export {
2572
- z as H,
2606
+ B as H,
2573
2607
  de as a,
2574
- w as c,
2575
- E as f
2608
+ k as c,
2609
+ x as f
2576
2610
  };
2577
- //# sourceMappingURL=index-C_shwb86.js.map
2611
+ //# sourceMappingURL=index-BHO8Gbrj.js.map