@geekapps/silo-elements-nextjs 0.3.2 → 0.3.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.
package/dist/index.js CHANGED
@@ -396,7 +396,7 @@ function ImageUploader({
396
396
  ] })
397
397
  ] });
398
398
  }
399
- var CODECS = [
399
+ var VIDEO_CODECS = [
400
400
  {
401
401
  value: "h264",
402
402
  label: "H.264",
@@ -405,15 +405,46 @@ var CODECS = [
405
405
  {
406
406
  value: "h265",
407
407
  label: "H.265",
408
- description: "50% menor que H.264 com a mesma qualidade. Requer player moderno (Chrome, Safari, Firefox)."
408
+ description: "50% menor que H.264 com a mesma qualidade. Requer player moderno."
409
409
  },
410
410
  {
411
411
  value: "av1",
412
412
  label: "AV1",
413
- description: "M\xE1xima efici\xEAncia \u2014 at\xE9 50% menor que H.265. Suportado no Chrome, Firefox e Safari 17+.",
414
- warning: "AV1 n\xE3o \xE9 suportado em iPhones mais antigos (iOS < 16) e Smart TVs antigas."
413
+ description: "M\xE1xima efici\xEAncia \u2014 at\xE9 50% menor que H.265. Chrome 70+, Firefox 67+, Safari 17+.",
414
+ warning: "N\xE3o suportado em iPhones antigos (iOS < 16) e Smart TVs antigas."
415
415
  }
416
416
  ];
417
+ var AUDIO_SIMPLE = [
418
+ {
419
+ value: "passthrough",
420
+ label: "Preservar original",
421
+ badge: "Recomendado",
422
+ description: "Copia o \xE1udio sem reencodar quando compat\xEDvel com HLS (AAC, AC3, E-AC3). Converte para AAC est\xE9reo como fallback."
423
+ },
424
+ {
425
+ value: "aac",
426
+ label: "AAC",
427
+ description: "Compatibilidade m\xE1xima. Funciona em todos os players e dispositivos."
428
+ },
429
+ {
430
+ value: "opus",
431
+ label: "Opus",
432
+ description: "Melhor efici\xEAncia que AAC. Suportado em Chrome, Firefox e Android. N\xE3o suportado em Safari/iOS."
433
+ }
434
+ ];
435
+ var AUDIO_ADVANCED_CODEC = [
436
+ { value: "passthrough", label: "Original", description: "Passthrough quando HLS-compat\xEDvel, AAC como fallback." },
437
+ { value: "aac", label: "AAC", description: "Compatibilidade m\xE1xima." },
438
+ { value: "opus", label: "Opus", description: "Melhor efici\xEAncia que AAC. Chrome/Firefox/Android." },
439
+ { value: "ac3", label: "AC3", description: "Dolby Digital. Compat\xEDvel com HLS e home theaters." },
440
+ { value: "eac3", label: "E-AC3", description: "Dolby Digital Plus. Suporta Atmos. Netflix, Disney+, Apple TV+." }
441
+ ];
442
+ var AUDIO_CHANNELS = [
443
+ { value: "original", label: "Original", description: "Mant\xE9m os canais do arquivo fonte." },
444
+ { value: "stereo", label: "Est\xE9reo", description: "2.0 \u2014 compat\xEDvel com todos os dispositivos." },
445
+ { value: "5.1", label: "5.1", description: "Surround 5.1." },
446
+ { value: "7.1", label: "7.1", description: "Surround 7.1." }
447
+ ];
417
448
  var RESOLUTIONS = ["144", "240", "360", "480", "720", "1080", "1440", "2160"];
418
449
  var RESOLUTION_LABELS = {
419
450
  "144": "144p",
@@ -426,20 +457,40 @@ var RESOLUTION_LABELS = {
426
457
  "2160": "4K"
427
458
  };
428
459
  function optBtnStyle(active) {
429
- return active ? { border: "1px solid #6366f1", background: "#6366f1", color: "#fff", padding: "4px 10px", borderRadius: 6, fontSize: 12, fontWeight: 600, cursor: "pointer", minWidth: 36 } : { border: "1px solid rgba(255,255,255,0.2)", background: "rgba(255,255,255,0.06)", color: "rgba(255,255,255,0.8)", padding: "4px 10px", borderRadius: 6, fontSize: 12, fontWeight: 600, cursor: "pointer", minWidth: 36 };
460
+ return active ? { border: "1px solid #6366f1", background: "#6366f1", color: "#fff", padding: "4px 10px", borderRadius: 6, fontSize: 12, fontWeight: 600, cursor: "pointer" } : { border: "1px solid rgba(255,255,255,0.2)", background: "rgba(255,255,255,0.06)", color: "rgba(255,255,255,0.8)", padding: "4px 10px", borderRadius: 6, fontSize: 12, fontWeight: 600, cursor: "pointer" };
461
+ }
462
+ function SectionLabel({ children }) {
463
+ return /* @__PURE__ */ jsx("div", { style: { fontSize: 11, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.05em", marginBottom: 6, color: "rgba(255,255,255,0.35)" }, children });
464
+ }
465
+ function Hint({ children }) {
466
+ return /* @__PURE__ */ jsx("p", { style: { marginTop: 5, fontSize: 11, color: "rgba(255,255,255,0.4)", lineHeight: 1.5 }, children });
430
467
  }
431
- function Toggle({ checked, onToggle, label }) {
432
- return /* @__PURE__ */ jsxs("div", { style: { display: "inline-flex", alignItems: "center", gap: 8, cursor: "pointer", userSelect: "none" }, onClick: onToggle, children: [
433
- /* @__PURE__ */ jsx("span", { style: { position: "relative", display: "inline-block", width: 32, height: 18, borderRadius: 9, flexShrink: 0, cursor: "pointer", background: checked ? "#6366f1" : "rgba(255,255,255,0.15)", transition: "background 150ms" }, children: /* @__PURE__ */ jsx("span", { style: { position: "absolute", top: 2, left: checked ? 16 : 2, width: 14, height: 14, borderRadius: "50%", background: "#fff", boxShadow: "0 1px 3px rgba(0,0,0,.3)", transition: "left 150ms" } }) }),
434
- /* @__PURE__ */ jsx("span", { style: { fontSize: 12, fontWeight: 500, color: "rgba(255,255,255,0.85)" }, children: label })
468
+ function Warning({ children }) {
469
+ return /* @__PURE__ */ jsx("div", { style: { marginTop: 5, display: "flex", gap: 5, background: "rgba(251,191,36,0.08)", border: "1px solid rgba(251,191,36,0.2)", borderRadius: 6, padding: "5px 8px" }, children: /* @__PURE__ */ jsxs("span", { style: { fontSize: 11, color: "#fbbf24", lineHeight: 1.5 }, children: [
470
+ "\u26A0 ",
471
+ children
472
+ ] }) });
473
+ }
474
+ function Toggle({ checked, onToggle, label, hint }) {
475
+ return /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "flex-start", gap: 8, cursor: "pointer", userSelect: "none" }, onClick: onToggle, children: [
476
+ /* @__PURE__ */ jsx("span", { style: { position: "relative", display: "inline-block", width: 32, height: 18, borderRadius: 9, flexShrink: 0, marginTop: 1, background: checked ? "#6366f1" : "rgba(255,255,255,0.15)", transition: "background 150ms" }, children: /* @__PURE__ */ jsx("span", { style: { position: "absolute", top: 2, left: checked ? 16 : 2, width: 14, height: 14, borderRadius: "50%", background: "#fff", boxShadow: "0 1px 3px rgba(0,0,0,.3)", transition: "left 150ms" } }) }),
477
+ /* @__PURE__ */ jsxs("div", { children: [
478
+ /* @__PURE__ */ jsx("span", { style: { fontSize: 12, fontWeight: 500, color: "rgba(255,255,255,0.85)" }, children: label }),
479
+ hint && /* @__PURE__ */ jsx("p", { style: { fontSize: 11, color: "rgba(255,255,255,0.4)", marginTop: 1, lineHeight: 1.4 }, children: hint })
480
+ ] })
435
481
  ] });
436
482
  }
437
483
  function VideoOptions({ value, onChange, style }) {
484
+ const [advanced, setAdvanced] = useState(false);
438
485
  const codec = value.codec ?? "h264";
439
486
  const transcoding = value.transcoding ?? "auto";
440
487
  const isAuto = transcoding === "auto";
441
488
  const selectedRes = isAuto ? [] : transcoding;
442
- const selectedCodec = CODECS.find((c) => c.value === codec) ?? CODECS[0];
489
+ const audioCodec = value.audioCodec ?? "passthrough";
490
+ const audioChannels = value.audioChannels ?? "original";
491
+ const preserveAtmos = value.preserveAtmos ?? true;
492
+ const hdrMode = value.hdr ?? "preserve";
493
+ const selectedVideoCodec = VIDEO_CODECS.find((c) => c.value === codec);
443
494
  function toggleRes(r) {
444
495
  if (isAuto) {
445
496
  onChange({ ...value, transcoding: [r] });
@@ -448,13 +499,12 @@ function VideoOptions({ value, onChange, style }) {
448
499
  const next = selectedRes.includes(r) ? selectedRes.filter((x) => x !== r) : [...selectedRes, r];
449
500
  onChange({ ...value, transcoding: next.length === 0 ? "auto" : next });
450
501
  }
451
- function toggleFeature(key) {
452
- onChange({ ...value, [key]: !value[key] });
453
- }
454
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", style, children: [
502
+ const showAtmosOption = audioCodec === "eac3" || audioCodec === "passthrough";
503
+ const showAtmosWarning = audioCodec === "aac" || audioCodec === "opus" || audioCodec === "ac3";
504
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", style, children: [
455
505
  /* @__PURE__ */ jsxs("div", { children: [
456
- /* @__PURE__ */ jsx("div", { style: { fontSize: 11, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.05em", marginBottom: 6, color: "rgba(255,255,255,0.4)" }, children: "Codec de v\xEDdeo" }),
457
- /* @__PURE__ */ jsx("div", { className: "flex gap-1.5 flex-wrap", children: CODECS.map((c) => /* @__PURE__ */ jsx(
506
+ /* @__PURE__ */ jsx(SectionLabel, { children: "Codec de v\xEDdeo" }),
507
+ /* @__PURE__ */ jsx("div", { className: "flex gap-1.5 flex-wrap", children: VIDEO_CODECS.map((c) => /* @__PURE__ */ jsx(
458
508
  "button",
459
509
  {
460
510
  type: "button",
@@ -464,38 +514,117 @@ function VideoOptions({ value, onChange, style }) {
464
514
  },
465
515
  c.value
466
516
  )) }),
467
- /* @__PURE__ */ jsx("div", { style: { marginTop: 6, fontSize: 11, color: "rgba(255,255,255,0.45)", lineHeight: 1.5 }, children: selectedCodec.description }),
468
- selectedCodec.warning && /* @__PURE__ */ jsx("div", { style: { marginTop: 5, display: "flex", alignItems: "flex-start", gap: 5, background: "rgba(251,191,36,0.08)", border: "1px solid rgba(251,191,36,0.2)", borderRadius: 6, padding: "5px 8px" }, children: /* @__PURE__ */ jsxs("span", { style: { fontSize: 11, color: "#fbbf24", lineHeight: 1.5 }, children: [
469
- "\u26A0 ",
470
- selectedCodec.warning
471
- ] }) })
517
+ selectedVideoCodec && /* @__PURE__ */ jsx(Hint, { children: selectedVideoCodec.description }),
518
+ selectedVideoCodec?.warning && /* @__PURE__ */ jsx(Warning, { children: selectedVideoCodec.warning })
472
519
  ] }),
473
520
  /* @__PURE__ */ jsxs("div", { children: [
474
- /* @__PURE__ */ jsx("div", { style: { fontSize: 11, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.05em", marginBottom: 6, color: "rgba(255,255,255,0.4)" }, children: "Resolu\xE7\xF5es" }),
521
+ /* @__PURE__ */ jsx(SectionLabel, { children: "Resolu\xE7\xF5es" }),
475
522
  /* @__PURE__ */ jsxs("div", { className: "flex gap-1.5 flex-wrap", children: [
476
523
  /* @__PURE__ */ jsx("button", { type: "button", onClick: () => onChange({ ...value, transcoding: "auto" }), style: optBtnStyle(isAuto), children: "Auto" }),
477
- RESOLUTIONS.map((r) => /* @__PURE__ */ jsx(
524
+ RESOLUTIONS.map((r) => /* @__PURE__ */ jsx("button", { type: "button", onClick: () => toggleRes(r), style: optBtnStyle(!isAuto && selectedRes.includes(r)), children: RESOLUTION_LABELS[r] }, r))
525
+ ] }),
526
+ isAuto && /* @__PURE__ */ jsx(Hint, { children: "Gera todas as resolu\xE7\xF5es at\xE9 a resolu\xE7\xE3o original do v\xEDdeo." })
527
+ ] }),
528
+ !advanced && /* @__PURE__ */ jsxs(Fragment, { children: [
529
+ /* @__PURE__ */ jsxs("div", { children: [
530
+ /* @__PURE__ */ jsx(SectionLabel, { children: "\xC1udio" }),
531
+ /* @__PURE__ */ jsx("div", { className: "flex gap-1.5 flex-wrap", children: AUDIO_SIMPLE.map((a) => /* @__PURE__ */ jsxs(
532
+ "button",
533
+ {
534
+ type: "button",
535
+ onClick: () => onChange({ ...value, audioCodec: a.value }),
536
+ style: optBtnStyle(audioCodec === a.value),
537
+ children: [
538
+ a.label,
539
+ "badge" in a && a.badge ? /* @__PURE__ */ jsx("span", { style: { marginLeft: 5, fontSize: 9, fontWeight: 700, background: "rgba(255,255,255,0.15)", borderRadius: 4, padding: "1px 4px", verticalAlign: "middle" }, children: a.badge }) : null
540
+ ]
541
+ },
542
+ a.value
543
+ )) }),
544
+ /* @__PURE__ */ jsx(Hint, { children: AUDIO_SIMPLE.find((a) => a.value === audioCodec)?.description })
545
+ ] }),
546
+ /* @__PURE__ */ jsxs("div", { children: [
547
+ /* @__PURE__ */ jsx(SectionLabel, { children: "HDR" }),
548
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ jsx(
549
+ Toggle,
550
+ {
551
+ checked: hdrMode === "preserve",
552
+ onToggle: () => onChange({ ...value, hdr: hdrMode === "preserve" ? "sdr" : "preserve" }),
553
+ label: "Preservar HDR",
554
+ hint: "Mant\xE9m HDR10, HDR10+, HLG e Dolby Vision quando o codec de sa\xEDda suporta (H.265 e AV1). Ignorado para H.264."
555
+ }
556
+ ) })
557
+ ] })
558
+ ] }),
559
+ advanced && /* @__PURE__ */ jsxs(Fragment, { children: [
560
+ /* @__PURE__ */ jsxs("div", { children: [
561
+ /* @__PURE__ */ jsx(SectionLabel, { children: "Codec de \xE1udio" }),
562
+ /* @__PURE__ */ jsx("div", { className: "flex gap-1.5 flex-wrap", children: AUDIO_ADVANCED_CODEC.map((a) => /* @__PURE__ */ jsx(
563
+ "button",
564
+ {
565
+ type: "button",
566
+ onClick: () => onChange({ ...value, audioCodec: a.value }),
567
+ style: optBtnStyle(audioCodec === a.value),
568
+ children: a.label
569
+ },
570
+ a.value
571
+ )) }),
572
+ /* @__PURE__ */ jsx(Hint, { children: AUDIO_ADVANCED_CODEC.find((a) => a.value === audioCodec)?.description }),
573
+ showAtmosWarning && /* @__PURE__ */ jsx(Warning, { children: "Este codec n\xE3o preserva Dolby Atmos. Use E-AC3 ou Original para manter Atmos." })
574
+ ] }),
575
+ /* @__PURE__ */ jsxs("div", { children: [
576
+ /* @__PURE__ */ jsx(SectionLabel, { children: "Canais" }),
577
+ /* @__PURE__ */ jsx("div", { className: "flex gap-1.5 flex-wrap", children: AUDIO_CHANNELS.map((c) => /* @__PURE__ */ jsx(
478
578
  "button",
479
579
  {
480
580
  type: "button",
481
- onClick: () => toggleRes(r),
482
- style: optBtnStyle(!isAuto && selectedRes.includes(r)),
483
- children: RESOLUTION_LABELS[r]
581
+ onClick: () => onChange({ ...value, audioChannels: c.value }),
582
+ style: optBtnStyle(audioChannels === c.value),
583
+ children: c.label
484
584
  },
485
- r
486
- ))
585
+ c.value
586
+ )) }),
587
+ /* @__PURE__ */ jsx(Hint, { children: AUDIO_CHANNELS.find((c) => c.value === audioChannels)?.description })
487
588
  ] }),
488
- isAuto && /* @__PURE__ */ jsx("div", { style: { marginTop: 6, fontSize: 11, color: "rgba(255,255,255,0.35)", lineHeight: 1.5 }, children: "Modo autom\xE1tico: gera todas as resolu\xE7\xF5es at\xE9 a resolu\xE7\xE3o original do v\xEDdeo." })
589
+ showAtmosOption && /* @__PURE__ */ jsxs("div", { children: [
590
+ /* @__PURE__ */ jsx(SectionLabel, { children: "Atmos" }),
591
+ /* @__PURE__ */ jsx(
592
+ Toggle,
593
+ {
594
+ checked: preserveAtmos,
595
+ onToggle: () => onChange({ ...value, preserveAtmos: !preserveAtmos }),
596
+ label: "Preservar Dolby Atmos quando dispon\xEDvel",
597
+ hint: "Mant\xE9m os metadados Atmos no E-AC3 de sa\xEDda. Efetivo somente com codec E-AC3 ou Original."
598
+ }
599
+ )
600
+ ] }),
601
+ /* @__PURE__ */ jsxs("div", { children: [
602
+ /* @__PURE__ */ jsx(SectionLabel, { children: "HDR" }),
603
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-1.5 flex-wrap", children: [
604
+ /* @__PURE__ */ jsx("button", { type: "button", onClick: () => onChange({ ...value, hdr: "preserve" }), style: optBtnStyle(hdrMode === "preserve"), children: "Preservar HDR" }),
605
+ /* @__PURE__ */ jsx("button", { type: "button", onClick: () => onChange({ ...value, hdr: "sdr" }), style: optBtnStyle(hdrMode === "sdr"), children: "Converter para SDR" })
606
+ ] }),
607
+ /* @__PURE__ */ jsx(Hint, { children: hdrMode === "preserve" ? "HDR10, HDR10+, HLG e Dolby Vision s\xE3o preservados com H.265 e AV1. H.264 ignora HDR." : "Tonemapping para SDR \u2014 compat\xEDvel com todos os displays." })
608
+ ] })
489
609
  ] }),
490
610
  /* @__PURE__ */ jsxs("div", { children: [
491
- /* @__PURE__ */ jsx("div", { style: { fontSize: 11, fontWeight: 700, textTransform: "uppercase", letterSpacing: "0.05em", marginBottom: 8, color: "var(--silo-text-muted)" }, children: "Recursos" }),
492
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
493
- /* @__PURE__ */ jsx(Toggle, { checked: value.thumbnails ?? true, onToggle: () => toggleFeature("thumbnails"), label: "Gerar thumbnails" }),
494
- /* @__PURE__ */ jsx(Toggle, { checked: value.storyboard ?? false, onToggle: () => toggleFeature("storyboard"), label: "Gerar storyboard" }),
495
- /* @__PURE__ */ jsx(Toggle, { checked: value.autoCaptions ?? false, onToggle: () => toggleFeature("autoCaptions"), label: "Legendas autom\xE1ticas (IA)" }),
496
- /* @__PURE__ */ jsx(Toggle, { checked: value.separateAudio ?? false, onToggle: () => toggleFeature("separateAudio"), label: "Separar faixa de \xE1udio" })
611
+ /* @__PURE__ */ jsx(SectionLabel, { children: "Recursos" }),
612
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2.5", children: [
613
+ /* @__PURE__ */ jsx(Toggle, { checked: value.thumbnails ?? true, onToggle: () => onChange({ ...value, thumbnails: !(value.thumbnails ?? true) }), label: "Gerar thumbnails" }),
614
+ /* @__PURE__ */ jsx(Toggle, { checked: value.storyboard ?? false, onToggle: () => onChange({ ...value, storyboard: !value.storyboard }), label: "Gerar storyboard" }),
615
+ /* @__PURE__ */ jsx(Toggle, { checked: value.autoCaptions ?? false, onToggle: () => onChange({ ...value, autoCaptions: !value.autoCaptions }), label: "Legendas autom\xE1ticas (IA)" }),
616
+ /* @__PURE__ */ jsx(Toggle, { checked: value.separateAudio ?? false, onToggle: () => onChange({ ...value, separateAudio: !value.separateAudio }), label: "Separar faixa de \xE1udio" })
497
617
  ] })
498
- ] })
618
+ ] }),
619
+ /* @__PURE__ */ jsx(
620
+ "button",
621
+ {
622
+ type: "button",
623
+ onClick: () => setAdvanced((v) => !v),
624
+ style: { alignSelf: "flex-start", fontSize: 11, color: "rgba(255,255,255,0.35)", background: "none", border: "none", cursor: "pointer", padding: 0, textDecoration: "underline", textUnderlineOffset: 3 },
625
+ children: advanced ? "\u2190 Modo simples" : "Op\xE7\xF5es avan\xE7adas \u2192"
626
+ }
627
+ )
499
628
  ] });
500
629
  }
501
630
  var DEFAULT_VIDEO_OPTS = {
@@ -1330,6 +1459,9 @@ function Video({
1330
1459
  const ageRatingWrapRef = useRef(null);
1331
1460
  const ageRatingIconRef = useRef(null);
1332
1461
  const ageRatingTextRef = useRef(null);
1462
+ const ageRatingShownRef = useRef(false);
1463
+ const ageRatingQueuedRef = useRef(false);
1464
+ const ageRatingPendingRef = useRef(false);
1333
1465
  const [clickIcon, setClickIcon] = useState(null);
1334
1466
  const clickIconTimerRef = useRef(null);
1335
1467
  const clickIconRef = useRef(null);
@@ -1404,9 +1536,6 @@ function Video({
1404
1536
  setControlsVisible(false);
1405
1537
  }, 2400);
1406
1538
  }
1407
- if (video?.paused) {
1408
- showAgeRatingRef.current?.();
1409
- }
1410
1539
  }, [autoHideControls]);
1411
1540
  useEffect(() => {
1412
1541
  if (!containerRef.current) return;
@@ -1482,7 +1611,13 @@ function Video({
1482
1611
  gsap.to(el, {
1483
1612
  opacity: controlsVisible ? 1 : 0,
1484
1613
  duration: 0.2,
1485
- ease: "power1.inOut"
1614
+ ease: "power1.inOut",
1615
+ onComplete: () => {
1616
+ if (!controlsVisible && ageRatingPendingRef.current) {
1617
+ ageRatingPendingRef.current = false;
1618
+ showAgeRatingRef.current?.();
1619
+ }
1620
+ }
1486
1621
  });
1487
1622
  el.style.pointerEvents = controlsVisible ? "" : "none";
1488
1623
  if (player) {
@@ -1558,7 +1693,7 @@ function Video({
1558
1693
  if (!wrap) return;
1559
1694
  if (ageRatingTlRef.current) ageRatingTlRef.current.kill();
1560
1695
  const HOLD = 12;
1561
- const tl = gsap.timeline({ delay: 0.6 });
1696
+ const tl = gsap.timeline({ delay: 0.3 });
1562
1697
  tl.fromTo(wrap, { opacity: 0 }, { opacity: 1, duration: 0.5, ease: "power2.out" });
1563
1698
  if (icon) {
1564
1699
  tl.fromTo(
@@ -1577,7 +1712,9 @@ function Video({
1577
1712
  );
1578
1713
  }
1579
1714
  tl.to({}, { duration: HOLD });
1580
- tl.to(wrap, { opacity: 0, duration: 0.7, ease: "power2.inOut" });
1715
+ tl.to(wrap, { opacity: 0, duration: 0.7, ease: "power2.inOut", onComplete: () => {
1716
+ ageRatingShownRef.current = true;
1717
+ } });
1581
1718
  ageRatingTlRef.current = tl;
1582
1719
  };
1583
1720
  showAgeRatingRef.current = showAgeRating;
@@ -1587,10 +1724,10 @@ function Video({
1587
1724
  window.clearTimeout(ageRatingPauseTimerRef.current);
1588
1725
  ageRatingPauseTimerRef.current = null;
1589
1726
  }
1590
- setHasPlayed((prev) => {
1591
- if (!prev) showAgeRating();
1592
- return true;
1593
- });
1727
+ const shouldShow = !ageRatingShownRef.current || ageRatingQueuedRef.current;
1728
+ ageRatingQueuedRef.current = false;
1729
+ if (shouldShow) ageRatingPendingRef.current = true;
1730
+ setHasPlayed(true);
1594
1731
  showControlsTemporarily();
1595
1732
  };
1596
1733
  const onPause = () => {
@@ -1600,7 +1737,7 @@ function Video({
1600
1737
  if (parsed.ageRating?.data) {
1601
1738
  if (ageRatingPauseTimerRef.current) window.clearTimeout(ageRatingPauseTimerRef.current);
1602
1739
  ageRatingPauseTimerRef.current = window.setTimeout(() => {
1603
- showAgeRating();
1740
+ ageRatingQueuedRef.current = true;
1604
1741
  ageRatingPauseTimerRef.current = null;
1605
1742
  }, 60 * 1e3);
1606
1743
  }
@@ -3188,7 +3325,20 @@ function Video({
3188
3325
  activeCue && /* @__PURE__ */ jsx(
3189
3326
  "div",
3190
3327
  {
3191
- className: `pointer-events-none absolute inset-x-0 z-40 flex justify-center px-4 transition-all duration-200${controlsVisible ? "bottom-20 @sm:bottom-24 @lg:bottom-28" : "bottom-4 @sm:bottom-6"}`,
3328
+ className: "pointer-events-none absolute inset-x-0 z-40 flex justify-center px-4",
3329
+ style: {
3330
+ bottom: (() => {
3331
+ if (preview) {
3332
+ const frameW = preview.cue.w ?? 160;
3333
+ const frameH = preview.cue.h ?? 90;
3334
+ const thumbH = Math.round(200 * (frameH / frameW));
3335
+ return `${80 + thumbH + 32 + 10}px`;
3336
+ }
3337
+ if (controlsVisible) return "5rem";
3338
+ return "1rem";
3339
+ })(),
3340
+ transition: "bottom 0.2s ease"
3341
+ },
3192
3342
  children: /* @__PURE__ */ jsx(
3193
3343
  "div",
3194
3344
  {