vidply 1.0.27 → 1.0.28

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.
Files changed (52) hide show
  1. package/dist/dev/vidply.TranscriptManager-QSF2PWUN.js +1744 -0
  2. package/dist/dev/vidply.TranscriptManager-QSF2PWUN.js.map +7 -0
  3. package/dist/dev/vidply.TranscriptManager-UTJBQC5B.js +1744 -0
  4. package/dist/dev/vidply.TranscriptManager-UTJBQC5B.js.map +7 -0
  5. package/dist/dev/vidply.chunk-5663PYKK.js +1631 -0
  6. package/dist/dev/vidply.chunk-5663PYKK.js.map +7 -0
  7. package/dist/dev/vidply.chunk-SRM7VNHG.js +1638 -0
  8. package/dist/dev/vidply.chunk-SRM7VNHG.js.map +7 -0
  9. package/dist/dev/vidply.de-RXAJM5QE.js +181 -0
  10. package/dist/dev/vidply.de-RXAJM5QE.js.map +7 -0
  11. package/dist/dev/vidply.de-SNL6AJ4D.js +188 -0
  12. package/dist/dev/vidply.de-SNL6AJ4D.js.map +7 -0
  13. package/dist/dev/vidply.es-2QCQKZ4U.js +188 -0
  14. package/dist/dev/vidply.es-2QCQKZ4U.js.map +7 -0
  15. package/dist/dev/vidply.es-SADVLJTQ.js +181 -0
  16. package/dist/dev/vidply.es-SADVLJTQ.js.map +7 -0
  17. package/dist/dev/vidply.esm.js +9 -9
  18. package/dist/dev/vidply.esm.js.map +2 -2
  19. package/dist/dev/vidply.fr-FJAZRL4L.js +188 -0
  20. package/dist/dev/vidply.fr-FJAZRL4L.js.map +7 -0
  21. package/dist/dev/vidply.fr-V3VAYBBT.js +181 -0
  22. package/dist/dev/vidply.fr-V3VAYBBT.js.map +7 -0
  23. package/dist/dev/vidply.ja-2XQOW53T.js +188 -0
  24. package/dist/dev/vidply.ja-2XQOW53T.js.map +7 -0
  25. package/dist/dev/vidply.ja-KL2TLZGJ.js +181 -0
  26. package/dist/dev/vidply.ja-KL2TLZGJ.js.map +7 -0
  27. package/dist/legacy/vidply.js +53 -13
  28. package/dist/legacy/vidply.js.map +2 -2
  29. package/dist/legacy/vidply.min.js +1 -1
  30. package/dist/legacy/vidply.min.meta.json +15 -15
  31. package/dist/prod/vidply.TranscriptManager-DZ2WZU3K.min.js +6 -0
  32. package/dist/prod/vidply.TranscriptManager-E5QHGFIR.min.js +6 -0
  33. package/dist/prod/vidply.chunk-5DWTMWEO.min.js +6 -0
  34. package/dist/prod/vidply.chunk-IBNYTGGM.min.js +6 -0
  35. package/dist/prod/vidply.de-FR3XX54P.min.js +6 -0
  36. package/dist/prod/vidply.de-HGJBCLLE.min.js +6 -0
  37. package/dist/prod/vidply.es-3IJCQLJ7.min.js +6 -0
  38. package/dist/prod/vidply.es-CZEBXCZN.min.js +6 -0
  39. package/dist/prod/vidply.esm.min.js +4 -4
  40. package/dist/prod/vidply.fr-HFOL7MWA.min.js +6 -0
  41. package/dist/prod/vidply.fr-NC4VEAPH.min.js +6 -0
  42. package/dist/prod/vidply.ja-4ZC6ZQLV.min.js +6 -0
  43. package/dist/prod/vidply.ja-QTVU5C25.min.js +6 -0
  44. package/dist/vidply.esm.min.meta.json +34 -34
  45. package/package.json +1 -1
  46. package/src/controls/TranscriptManager.js +1 -1
  47. package/src/features/PlaylistManager.js +12 -12
  48. package/src/i18n/languages/de.js +9 -1
  49. package/src/i18n/languages/en.js +9 -1
  50. package/src/i18n/languages/es.js +9 -1
  51. package/src/i18n/languages/fr.js +9 -1
  52. package/src/i18n/languages/ja.js +9 -1
@@ -11,27 +11,27 @@
11
11
  "format": "esm"
12
12
  },
13
13
  "src/i18n/languages/en.js": {
14
- "bytes": 6736,
14
+ "bytes": 7390,
15
15
  "imports": [],
16
16
  "format": "esm"
17
17
  },
18
18
  "src/i18n/languages/de.js": {
19
- "bytes": 8264,
19
+ "bytes": 9108,
20
20
  "imports": [],
21
21
  "format": "esm"
22
22
  },
23
23
  "src/i18n/languages/es.js": {
24
- "bytes": 7812,
24
+ "bytes": 8594,
25
25
  "imports": [],
26
26
  "format": "esm"
27
27
  },
28
28
  "src/i18n/languages/fr.js": {
29
- "bytes": 8025,
29
+ "bytes": 8836,
30
30
  "imports": [],
31
31
  "format": "esm"
32
32
  },
33
33
  "src/i18n/languages/ja.js": {
34
- "bytes": 8422,
34
+ "bytes": 9301,
35
35
  "imports": [],
36
36
  "format": "esm"
37
37
  },
@@ -229,7 +229,7 @@
229
229
  "format": "esm"
230
230
  },
231
231
  "src/controls/TranscriptManager.js": {
232
- "bytes": 80185,
232
+ "bytes": 80197,
233
233
  "imports": [
234
234
  {
235
235
  "path": "src/utils/DOMUtils.js",
@@ -407,7 +407,7 @@
407
407
  "format": "esm"
408
408
  },
409
409
  "src/features/PlaylistManager.js": {
410
- "bytes": 48513,
410
+ "bytes": 48411,
411
411
  "imports": [
412
412
  {
413
413
  "path": "src/utils/DOMUtils.js",
@@ -469,19 +469,19 @@
469
469
  "bytesInOutput": 2302
470
470
  },
471
471
  "src/i18n/languages/en.js": {
472
- "bytesInOutput": 5577
472
+ "bytesInOutput": 6175
473
473
  },
474
474
  "src/i18n/languages/de.js": {
475
- "bytesInOutput": 6514
475
+ "bytesInOutput": 7270
476
476
  },
477
477
  "src/i18n/languages/es.js": {
478
- "bytesInOutput": 6681
478
+ "bytesInOutput": 7407
479
479
  },
480
480
  "src/i18n/languages/fr.js": {
481
- "bytesInOutput": 6891
481
+ "bytesInOutput": 7646
482
482
  },
483
483
  "src/i18n/languages/ja.js": {
484
- "bytesInOutput": 7290
484
+ "bytesInOutput": 8113
485
485
  },
486
486
  "src/i18n/translations.js": {
487
487
  "bytesInOutput": 368
@@ -514,7 +514,7 @@
514
514
  "bytesInOutput": 800
515
515
  },
516
516
  "src/controls/TranscriptManager.js": {
517
- "bytesInOutput": 43951
517
+ "bytesInOutput": 43960
518
518
  },
519
519
  "src/renderers/YouTubeRenderer.js": {
520
520
  "bytesInOutput": 4430
@@ -547,13 +547,13 @@
547
547
  "bytesInOutput": 4025
548
548
  },
549
549
  "src/features/PlaylistManager.js": {
550
- "bytesInOutput": 21797
550
+ "bytesInOutput": 21616
551
551
  },
552
552
  "src/index.js": {
553
553
  "bytesInOutput": 1877
554
554
  }
555
555
  },
556
- "bytes": 311196
556
+ "bytes": 314682
557
557
  }
558
558
  }
559
559
  }
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * Universal, Accessible Video Player
3
+ * (c) 2025 Matthias Peltzer
4
+ * Released under GPL-2.0-or-later License
5
+ */
6
+ import{a as l,b as r,c as M,d as b,f as v,h as C,i as P,j as f,k as w,m as S,n as z}from"./vidply.chunk-5DWTMWEO.min.js";var W=class{constructor(t){this.player=t,this.transcriptWindow=null,this.transcriptEntries=[],this.metadataCues=[],this.currentActiveEntry=null,this.isVisible=!1,this.storage=new C("vidply"),this.draggableResizable=null,this.settingsMenuVisible=!1,this.settingsMenu=null,this.settingsButton=null,this.settingsMenuJustOpened=!1,this.resizeOptionButton=null,this.resizeOptionText=null,this.dragOptionButton=null,this.dragOptionText=null,this.resizeModeIndicator=null,this.resizeModeIndicatorTimeout=null,this.transcriptResizeHandles=[],this.liveRegion=null,this.styleDialog=null,this.styleDialogVisible=!1,this.styleDialogJustOpened=!1,this.languageSelector=null,this.languageLabel=null,this.currentTranscriptLanguage=null,this.availableTranscriptLanguages=[],this.languageSelectorHandler=null;let i=this.storage.getTranscriptPreferences();this.autoscrollEnabled=i?.autoscroll!==void 0?i.autoscroll:!0,this.showTimestamps=i?.showTimestamps!==void 0?i.showTimestamps:!1,this.transcriptStyle={fontSize:i?.fontSize||this.player.options.transcriptFontSize||"100%",fontFamily:i?.fontFamily||this.player.options.transcriptFontFamily||"sans-serif",color:i?.color||this.player.options.transcriptColor||"#ffffff",backgroundColor:i?.backgroundColor||this.player.options.transcriptBackgroundColor||"#1e1e1e",opacity:i?.opacity??this.player.options.transcriptOpacity??.98},this.handlers={timeupdate:()=>this.updateActiveEntry(),audiodescriptionenabled:()=>{this.isVisible&&this.loadTranscriptData()},audiodescriptiondisabled:()=>{this.isVisible&&this.loadTranscriptData()},resize:null,settingsClick:null,settingsKeydown:null,documentClick:null,styleDialogKeydown:null},this.timeouts=new Set,this.init()}init(){this.setupMetadataHandlingOnLoad(),this.player.on("timeupdate",this.handlers.timeupdate),this.player.on("audiodescriptionenabled",this.handlers.audiodescriptionenabled),this.player.on("audiodescriptiondisabled",this.handlers.audiodescriptiondisabled),this.player.on("fullscreenchange",()=>{this.isVisible&&(window.innerWidth<768&&this.setupDragAndDrop(),(!this.draggableResizable||!this.draggableResizable.manuallyPositioned)&&this.setManagedTimeout(()=>this.positionTranscript(),100))})}toggleTranscript(){this.isVisible?this.hideTranscript():this.showTranscript()}showTranscript(){if(this.transcriptWindow){this.transcriptWindow.style.display="flex",this.isVisible=!0,this.player.controlBar&&typeof this.player.controlBar.updateTranscriptButton=="function"&&this.player.controlBar.updateTranscriptButton(),v(this.settingsButton,{delay:150});return}this.createTranscriptWindow(),this.loadTranscriptData(),this.transcriptWindow&&(this.transcriptWindow.style.display="flex",(!this.draggableResizable||!this.draggableResizable.manuallyPositioned)&&this.setManagedTimeout(()=>this.positionTranscript(),0),v(this.settingsButton,{delay:150})),this.isVisible=!0}hideTranscript({focusButton:t=!1}={}){if(this.transcriptWindow&&(this.transcriptWindow.style.display="none",this.isVisible=!1),this.draggableResizable&&this.draggableResizable.pointerResizeMode&&(this.draggableResizable.disablePointerResizeMode(),this.updateResizeOptionState()),this.hideResizeModeIndicator(),this.announceLive(""),this.player.controlBar&&typeof this.player.controlBar.updateTranscriptButton=="function"&&this.player.controlBar.updateTranscriptButton(),t){let i=this.player.controlBar?.controls?.transcript;i&&typeof i.focus=="function"&&i.focus({preventScroll:!0})}}createTranscriptWindow(){this.transcriptWindow=l.createElement("div",{className:`${this.player.options.classPrefix}-transcript-window`,attributes:{role:"dialog","aria-label":r.t("transcript.ariaLabel"),tabindex:"-1"}}),this.transcriptHeader=l.createElement("div",{className:`${this.player.options.classPrefix}-transcript-header`,attributes:{tabindex:"0"}}),this.headerLeft=l.createElement("div",{className:`${this.player.options.classPrefix}-transcript-header-left`});let t=r.t("transcript.settingsMenu");this.settingsButton=l.createElement("button",{className:`${this.player.options.classPrefix}-transcript-settings`,attributes:{type:"button","aria-label":t,"aria-expanded":"false"}}),this.settingsButton.appendChild(b("settings")),l.attachTooltip(this.settingsButton,t,this.player.options.classPrefix),this.handlers.settingsClick=d=>{d.preventDefault(),d.stopPropagation(),this.settingsMenuVisible?this.hideSettingsMenu():this.showSettingsMenu()},this.settingsButton.addEventListener("click",this.handlers.settingsClick),this.handlers.settingsKeydown=d=>{d.key==="d"||d.key==="D"?(d.preventDefault(),d.stopPropagation(),this.toggleKeyboardDragMode()):d.key==="r"||d.key==="R"?(d.preventDefault(),d.stopPropagation(),this.toggleResizeMode()):d.key==="Escape"&&this.settingsMenuVisible&&(d.preventDefault(),d.stopPropagation(),this.hideSettingsMenu())},this.settingsButton.addEventListener("keydown",this.handlers.settingsKeydown);let i=l.createElement("h3",{textContent:`${r.t("transcript.title")}. ${r.t("transcript.dragResizePrompt")}`}),e=`${this.player.options.classPrefix}-transcript-autoscroll-${Date.now()}`,a=l.createElement("label",{className:`${this.player.options.classPrefix}-transcript-autoscroll-label`,attributes:{for:e}});this.autoscrollCheckbox=l.createElement("input",{attributes:{id:e,type:"checkbox"}}),this.autoscrollEnabled&&(this.autoscrollCheckbox.checked=!0);let n=l.createElement("span",{textContent:r.t("transcript.autoscroll"),className:`${this.player.options.classPrefix}-transcript-autoscroll-text`});a.appendChild(this.autoscrollCheckbox),a.appendChild(n),this.autoscrollCheckbox.addEventListener("change",d=>{this.autoscrollEnabled=d.target.checked,this.saveAutoscrollPreference()}),this.transcriptHeader.appendChild(i),this.headerLeft.appendChild(this.settingsButton),this.headerLeft.appendChild(a);let c=`${this.player.options.classPrefix}-transcript-language-select-${Date.now()}`,{label:p,select:o}=S({classPrefix:this.player.options.classPrefix,labelClass:`${this.player.options.classPrefix}-transcript-language-label`,selectClass:`${this.player.options.classPrefix}-transcript-language-select`,labelText:"settings.language",selectId:c,hidden:!1});this.languageLabel=p,this.languageSelector=o;let s=l.createElement("div",{className:`${this.player.options.classPrefix}-transcript-language-wrapper`,attributes:{style:"display: none;"}});s.appendChild(this.languageLabel),s.appendChild(this.languageSelector),this.languageSelectorWrapper=s,z(s),this.headerLeft.appendChild(s);let h=r.t("transcript.close"),u=l.createElement("button",{className:`${this.player.options.classPrefix}-transcript-close`,attributes:{type:"button","aria-label":h}});u.appendChild(b("close")),l.attachTooltip(u,h,this.player.options.classPrefix),u.addEventListener("click",()=>this.hideTranscript({focusButton:!0})),this.transcriptHeader.appendChild(this.headerLeft),this.transcriptHeader.appendChild(u),this.transcriptContent=l.createElement("div",{className:`${this.player.options.classPrefix}-transcript-content`}),this.transcriptWindow.appendChild(this.transcriptHeader),this.transcriptWindow.appendChild(this.transcriptContent),this.createResizeHandles(),this.liveRegion=l.createElement("div",{className:"vidply-sr-only",attributes:{"aria-live":"polite","aria-atomic":"true"}}),this.transcriptWindow.appendChild(this.liveRegion),this.player.container.appendChild(this.transcriptWindow),this.setupDragAndDrop(),(!this.draggableResizable||!this.draggableResizable.manuallyPositioned)&&this.positionTranscript(),this.handlers.documentClick=d=>{this.settingsMenuJustOpened||this.styleDialogJustOpened||this.settingsButton&&this.settingsButton.contains(d.target)||this.settingsMenu&&this.settingsMenu.contains(d.target)||(this.settingsMenuVisible&&this.hideSettingsMenu(),this.styleDialogVisible&&this.styleDialog&&!this.styleDialog.contains(d.target)&&this.hideStyleDialog())},this.documentClickHandlerAdded=!1;let y;this.handlers.resize=()=>{y&&this.clearManagedTimeout(y),y=this.setManagedTimeout(()=>{(!this.draggableResizable||!this.draggableResizable.manuallyPositioned)&&this.positionTranscript()},100)},window.addEventListener("resize",this.handlers.resize)}createResizeHandles(){if(!this.transcriptWindow)return;let t=["n","s","e","w","ne","nw","se","sw"];this.transcriptResizeHandles=t.map(i=>{let e=l.createElement("div",{className:`${this.player.options.classPrefix}-transcript-resize-handle ${this.player.options.classPrefix}-transcript-resize-${i}`,attributes:{"data-direction":i,"data-vidply-managed-resize":"true","aria-hidden":"true"}});return e.style.display="none",this.transcriptWindow.appendChild(e),e})}positionTranscript(){if(!this.transcriptWindow||!this.player.videoWrapper||!this.isVisible||this.draggableResizable&&this.draggableResizable.manuallyPositioned)return;let t=window.innerWidth<768,i=this.player.videoWrapper.getBoundingClientRect(),e=this.player.state.fullscreen;if(t&&!e)this.transcriptWindow.style.position="relative",this.transcriptWindow.style.left="0",this.transcriptWindow.style.right="0",this.transcriptWindow.style.bottom="auto",this.transcriptWindow.style.top="auto",this.transcriptWindow.style.width="100%",this.transcriptWindow.style.maxWidth="100%",this.transcriptWindow.style.maxHeight="400px",this.transcriptWindow.style.height="auto",this.transcriptWindow.style.borderRadius="0",this.transcriptWindow.style.transform="none",this.transcriptWindow.style.border="none",this.transcriptWindow.style.borderTop="1px solid var(--vidply-border-light)",this.transcriptWindow.style.removeProperty("border-right"),this.transcriptWindow.style.removeProperty("border-bottom"),this.transcriptWindow.style.removeProperty("border-left"),this.transcriptWindow.style.removeProperty("border-image"),this.transcriptWindow.style.removeProperty("border-image-source"),this.transcriptWindow.style.removeProperty("border-image-slice"),this.transcriptWindow.style.removeProperty("border-image-width"),this.transcriptWindow.style.removeProperty("border-image-outset"),this.transcriptWindow.style.removeProperty("border-image-repeat"),this.transcriptWindow.style.boxShadow="none",this.transcriptHeader&&(this.transcriptHeader.style.cursor="default"),this.transcriptWindow.parentNode!==this.player.container&&this.player.container.appendChild(this.transcriptWindow);else if(e){this.transcriptWindow.style.position="fixed",this.transcriptWindow.style.left="auto",this.transcriptWindow.style.right="20px",this.transcriptWindow.style.bottom="80px",this.transcriptWindow.style.top="auto",this.transcriptWindow.style.maxHeight="calc(100vh - 180px)",this.transcriptWindow.style.height="auto";let a=260,n=Math.max(a,window.innerWidth-40),c=parseFloat(this.transcriptWindow.style.width)||400,p=Math.max(a,Math.min(c,n));this.transcriptWindow.style.width=`${p}px`,this.transcriptWindow.style.maxWidth="none",this.transcriptWindow.style.borderRadius="8px",this.transcriptWindow.style.border="1px solid var(--vidply-border)",this.transcriptWindow.style.removeProperty("border-top"),this.transcriptWindow.style.removeProperty("border-right"),this.transcriptWindow.style.removeProperty("border-bottom"),this.transcriptWindow.style.removeProperty("border-left"),this.transcriptWindow.style.removeProperty("border-image"),this.transcriptWindow.style.removeProperty("border-image-source"),this.transcriptWindow.style.removeProperty("border-image-slice"),this.transcriptWindow.style.removeProperty("border-image-width"),this.transcriptWindow.style.removeProperty("border-image-outset"),this.transcriptWindow.style.removeProperty("border-image-repeat"),this.transcriptHeader&&(this.transcriptHeader.style.cursor="move"),this.transcriptWindow.parentNode!==this.player.container&&this.player.container.appendChild(this.transcriptWindow)}else{let a=parseFloat(this.transcriptWindow.style.width)||400,n=20,c=260,p=this.player.container.getBoundingClientRect();window.getComputedStyle(this.player.container).position==="static"&&(this.player.container.style.position="relative");let s=i.right-p.left+n,h=window.innerWidth-i.right-n,u=Math.max(c,Math.min(a,h)),y=i.height;this.transcriptWindow.style.position="absolute",this.transcriptWindow.style.left=`${s}px`,this.transcriptWindow.style.right="auto",this.transcriptWindow.style.bottom="auto",this.transcriptWindow.style.top="0",this.transcriptWindow.style.height=`${y}px`,this.transcriptWindow.style.maxHeight="none",this.transcriptWindow.style.width=`${u}px`,this.transcriptWindow.style.maxWidth="none",this.transcriptWindow.style.borderRadius="8px",this.transcriptWindow.style.border="1px solid var(--vidply-border)",this.transcriptWindow.style.removeProperty("border-top"),this.transcriptWindow.style.removeProperty("border-right"),this.transcriptWindow.style.removeProperty("border-bottom"),this.transcriptWindow.style.removeProperty("border-left"),this.transcriptWindow.style.removeProperty("border-image"),this.transcriptWindow.style.removeProperty("border-image-source"),this.transcriptWindow.style.removeProperty("border-image-slice"),this.transcriptWindow.style.removeProperty("border-image-width"),this.transcriptWindow.style.removeProperty("border-image-outset"),this.transcriptWindow.style.removeProperty("border-image-repeat"),this.transcriptHeader&&(this.transcriptHeader.style.cursor="move"),this.transcriptWindow.parentNode!==this.player.container&&this.player.container.appendChild(this.transcriptWindow)}}getAvailableTranscriptLanguages(){let t=this.player.textTracks,i=new Map;return t.forEach(e=>{(e.kind==="captions"||e.kind==="subtitles")&&e.language&&(i.has(e.language)||i.set(e.language,{language:e.language,label:e.label||e.language,track:e}))}),Array.from(i.values())}updateLanguageSelector(){if(this.languageSelector){if(this.availableTranscriptLanguages=this.getAvailableTranscriptLanguages(),this.languageSelector.innerHTML="",this.availableTranscriptLanguages.length<2){this.languageSelectorWrapper&&(this.languageSelectorWrapper.style.display="none");return}if(this.languageSelectorWrapper&&(this.languageSelectorWrapper.style.display="flex"),this.availableTranscriptLanguages.forEach((t,i)=>{let e=l.createElement("option",{textContent:t.label,attributes:{value:t.language,lang:t.language}});this.languageSelector.appendChild(e)}),this.currentTranscriptLanguage)this.languageSelector.value=this.currentTranscriptLanguage;else if(this.availableTranscriptLanguages.length>0){let t=this.player.textTracks.find(i=>(i.kind==="captions"||i.kind==="subtitles")&&i.mode==="showing");this.currentTranscriptLanguage=t?t.language:this.availableTranscriptLanguages[0].language,this.languageSelector.value=this.currentTranscriptLanguage}this.languageSelectorHandler&&this.languageSelector.removeEventListener("change",this.languageSelectorHandler),this.languageSelectorHandler=t=>{this.currentTranscriptLanguage=t.target.value,this.loadTranscriptData(),this.transcriptContent&&this.currentTranscriptLanguage&&this.transcriptContent.setAttribute("lang",this.currentTranscriptLanguage)},this.languageSelector.addEventListener("change",this.languageSelectorHandler)}}loadTranscriptData(){this.transcriptEntries=[],this.transcriptContent.innerHTML="";let t=this.player.textTracks,i=null;this.currentTranscriptLanguage&&(i=t.find(s=>(s.kind==="captions"||s.kind==="subtitles")&&s.language===this.currentTranscriptLanguage)),i||(i=t.find(s=>s.kind==="captions"||s.kind==="subtitles"),i&&(this.currentTranscriptLanguage=i.language));let e=null;this.currentTranscriptLanguage&&(e=t.find(s=>s.kind==="descriptions"&&s.language===this.currentTranscriptLanguage)),e||(e=t.find(s=>s.kind==="descriptions"));let a=t.find(s=>s.kind==="metadata"),n=e&&this.player.state.audioDescriptionEnabled;if(!i&&!n&&!a){this.showNoTranscriptMessage();return}let c=[i,e,a].filter(Boolean);if(c.forEach(s=>{s.mode==="disabled"&&(s.mode="hidden")}),c.some(s=>!s.cues||s.cues.length===0)){let s=l.createElement("div",{className:`${this.player.options.classPrefix}-transcript-loading`,textContent:r.t("transcript.loading")});this.transcriptContent.appendChild(s);let h=0,u=()=>{h++,h>=c.length&&this.loadTranscriptData()};c.forEach(y=>{y.addEventListener("load",u,{once:!0})}),this.setManagedTimeout(()=>{this.loadTranscriptData()},500);return}let o=[];i&&i.cues&&Array.from(i.cues).forEach(s=>{o.push({cue:s,type:"caption"})}),e&&e.cues&&this.player.state.audioDescriptionEnabled&&Array.from(e.cues).forEach(s=>{o.push({cue:s,type:"description"})}),a&&a.cues&&(this.metadataCues=Array.from(a.cues),this.setupMetadataHandling()),o.sort((s,h)=>s.cue.startTime-h.cue.startTime),o.forEach((s,h)=>{let u=this.createTranscriptEntry(s.cue,h,s.type);this.transcriptEntries.push({element:u,cue:s.cue,type:s.type,startTime:s.cue.startTime,endTime:s.cue.endTime}),this.transcriptContent.appendChild(u)}),this.applyTranscriptStyles(),this.updateTimestampVisibility(),this.transcriptContent&&this.currentTranscriptLanguage&&this.transcriptContent.setAttribute("lang",this.currentTranscriptLanguage),this.updateLanguageSelector()}setupMetadataHandlingOnLoad(){let t=()=>{let e=this.player.textTracks.find(a=>a.kind==="metadata");if(e){if(e.mode==="disabled"&&(e.mode="hidden"),this.metadataCueChangeHandler&&e.removeEventListener("cuechange",this.metadataCueChangeHandler),this.metadataCueChangeHandler=()=>{let a=Array.from(e.activeCues||[]);a.length>0&&this.player.options.debug&&console.log("[VidPly Metadata] Active cues:",a.map(n=>({start:n.startTime,end:n.endTime,text:n.text}))),a.forEach(n=>{this.handleMetadataCue(n)})},e.addEventListener("cuechange",this.metadataCueChangeHandler),this.player.options.debug){let a=e.cues?e.cues.length:0;console.log("[VidPly Metadata] Track enabled,",a,"cues available")}}else this.player.options.debug&&console.warn("[VidPly Metadata] No metadata track found")};t(),this.player.on("loadedmetadata",t)}setupMetadataHandling(){!this.metadataCues||this.metadataCues.length===0||this.player.options.debug&&console.log("[VidPly Metadata]",this.metadataCues.length,"cues stored from transcript load")}handleMetadataCue(t){let i=t.text.trim();this.player.options.debug&&console.log("[VidPly Metadata] Processing cue:",{time:t.startTime,text:i}),this.player.emit("metadata",{time:t.startTime,endTime:t.endTime,text:i,cue:t}),i.includes("PAUSE")&&(this.player.state.paused||(this.player.options.debug&&console.log("[VidPly Metadata] Pausing video at",t.startTime),this.player.pause()),this.player.emit("metadata:pause",{time:t.startTime,text:i}));let e=i.match(/FOCUS:([\w#-]+)/);if(e){let n=e[1],c=document.querySelector(n);c?(this.player.options.debug&&console.log("[VidPly Metadata] Focusing element:",n),this.setManagedTimeout(()=>{c.focus({preventScroll:!0})},10)):this.player.options.debug&&console.warn("[VidPly Metadata] Element not found:",n),this.player.emit("metadata:focus",{time:t.startTime,target:n,element:c,text:i})}let a=i.match(/#[\w-]+/g);a&&(this.player.options.debug&&console.log("[VidPly Metadata] Hashtags found:",a),this.player.emit("metadata:hashtags",{time:t.startTime,hashtags:a,text:i}))}createTranscriptEntry(t,i,e="caption"){let a=this.stripVTTFormatting(t.text),n=l.createElement("div",{className:`${this.player.options.classPrefix}-transcript-entry ${this.player.options.classPrefix}-transcript-${e}`,attributes:{tabindex:"0","data-start":String(t.startTime),"data-end":String(t.endTime),"data-type":e}}),c=l.createElement("span",{className:`${this.player.options.classPrefix}-transcript-time`,textContent:M.formatTime(t.startTime),attributes:{"aria-hidden":"true"}}),p=l.createElement("span",{className:`${this.player.options.classPrefix}-transcript-text`,textContent:a});n.appendChild(c),n.appendChild(p);let o=()=>{this.player.seek(t.startTime),this.player.state.paused&&this.player.play()};return n.addEventListener("click",o),n.addEventListener("keydown",s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),o())}),n}stripVTTFormatting(t){return t.replace(/<[^>]+>/g,"").replace(/\n/g," ").trim()}showNoTranscriptMessage(){let t=l.createElement("div",{className:`${this.player.options.classPrefix}-transcript-empty`,textContent:r.t("transcript.noTranscript")});this.transcriptContent.appendChild(t)}updateActiveEntry(){if(!this.isVisible||this.transcriptEntries.length===0)return;let t=this.player.state.currentTime,i=this.transcriptEntries.find(e=>t>=e.startTime&&t<e.endTime);i&&i!==this.currentActiveEntry?(this.currentActiveEntry&&this.currentActiveEntry.element.classList.remove(`${this.player.options.classPrefix}-transcript-entry-active`),i.element.classList.add(`${this.player.options.classPrefix}-transcript-entry-active`),this.scrollToEntry(i.element),this.currentActiveEntry=i):!i&&this.currentActiveEntry&&(this.currentActiveEntry.element.classList.remove(`${this.player.options.classPrefix}-transcript-entry-active`),this.currentActiveEntry=null)}scrollToEntry(t){if(!this.transcriptContent||!this.autoscrollEnabled)return;let i=this.transcriptContent.getBoundingClientRect(),e=t.getBoundingClientRect();if(e.top<i.top||e.bottom>i.bottom){let a=t.offsetTop-this.transcriptContent.clientHeight/2+t.clientHeight/2;this.transcriptContent.scrollTo({top:a,behavior:"smooth"})}}saveAutoscrollPreference(){let t=this.storage.getTranscriptPreferences()||{};t.autoscroll=this.autoscrollEnabled,this.storage.saveTranscriptPreferences(t)}setupDragAndDrop(){if(!this.transcriptHeader||!this.transcriptWindow)return;let t=window.innerWidth<768,i=this.player.state.fullscreen;if(t&&!i){this.draggableResizable&&(this.draggableResizable.destroy(),this.draggableResizable=null);return}this.draggableResizable||(this.draggableResizable=new P(this.transcriptWindow,{dragHandle:this.transcriptHeader,resizeHandles:this.transcriptResizeHandles,constrainToViewport:!0,classPrefix:`${this.player.options.classPrefix}-transcript`,keyboardDragKey:"d",keyboardResizeKey:"r",keyboardStep:10,keyboardStepLarge:50,minWidth:300,minHeight:200,maxWidth:()=>Math.max(320,window.innerWidth-40),maxHeight:()=>Math.max(200,window.innerHeight-120),pointerResizeIndicatorText:r.t("transcript.resizeModeHint"),onPointerResizeToggle:e=>{this.transcriptResizeHandles.forEach(a=>{a.style.display=e?"block":"none"}),this.onPointerResizeModeChange(e)},onDragStart:e=>{let a=[`.${this.player.options.classPrefix}-transcript-close`,`.${this.player.options.classPrefix}-transcript-settings`,`.${this.player.options.classPrefix}-transcript-language-select`,`.${this.player.options.classPrefix}-transcript-language-label`,`.${this.player.options.classPrefix}-transcript-settings-menu`,`.${this.player.options.classPrefix}-transcript-style-dialog`];for(let n of a)if(e.target.closest(n))return!1;return!0}}),this.customKeyHandler=e=>{let a=e.key.toLowerCase(),n=e.defaultPrevented;if(!(this.settingsMenuVisible||this.styleDialogVisible)){if(a==="home"){e.preventDefault(),e.stopPropagation(),this.draggableResizable&&(this.draggableResizable.pointerResizeMode&&this.draggableResizable.disablePointerResizeMode(),this.draggableResizable.manuallyPositioned=!1,this.positionTranscript(),this.updateResizeOptionState(),this.announceLive(r.t("transcript.positionReset")));return}if(a==="r"){if(n)return;e.preventDefault(),e.stopPropagation(),this.toggleResizeMode()&&this.transcriptWindow.focus({preventScroll:!0});return}if(a==="escape"){if(this.draggableResizable&&this.draggableResizable.pointerResizeMode){e.preventDefault(),e.stopPropagation(),this.draggableResizable.disablePointerResizeMode();return}if(this.draggableResizable&&this.draggableResizable.keyboardDragMode){e.preventDefault(),e.stopPropagation(),this.draggableResizable.disableKeyboardDragMode(),this.announceLive(r.t("transcript.dragModeDisabled"));return}e.preventDefault(),e.stopPropagation(),this.hideTranscript({focusButton:!0});return}}},this.transcriptWindow.addEventListener("keydown",this.customKeyHandler))}toggleKeyboardDragMode(){if(this.draggableResizable){let t=this.draggableResizable.keyboardDragMode;this.draggableResizable.toggleKeyboardDragMode();let i=this.draggableResizable.keyboardDragMode;!t&&i&&this.enableMoveMode(),this.updateDragOptionState(),this.settingsMenuVisible&&this.hideSettingsMenu(),this.transcriptWindow.focus({preventScroll:!0})}}toggleSettingsMenu(){this.settingsMenuVisible?this.hideSettingsMenu():this.showSettingsMenu()}showSettingsMenu(){if(this.settingsMenuJustOpened=!0,setTimeout(()=>{this.settingsMenuJustOpened=!1},350),this.documentClickHandlerAdded||setTimeout(()=>{document.addEventListener("click",this.handlers.documentClick),this.documentClickHandlerAdded=!0},300),this.settingsMenu){this.settingsMenu.style.display="block",this.settingsMenuVisible=!0,this.settingsButton&&this.settingsButton.setAttribute("aria-expanded","true"),this.attachSettingsMenuKeyboardNavigation(),this.positionSettingsMenuImmediate(),this.updateResizeOptionState(),setTimeout(()=>{let g=this.settingsMenu.querySelectorAll(`.${this.player.options.classPrefix}-transcript-settings-item`);if(g.length>0){g[0].setAttribute("tabindex","0");for(let m=1;m<g.length;m++)g[m].setAttribute("tabindex","-1");g[0].focus({preventScroll:!0})}},50);return}this.settingsMenu=l.createElement("div",{className:`${this.player.options.classPrefix}-transcript-settings-menu`,attributes:{role:"menu"}});let t=f({classPrefix:this.player.options.classPrefix,itemClass:`${this.player.options.classPrefix}-transcript-settings-item`,icon:"move",label:"transcript.enableDragMode",hasTextClass:!0,onClick:()=>{this.toggleKeyboardDragMode(),this.hideSettingsMenu()}});t.setAttribute("role","switch"),t.setAttribute("aria-checked","false");let i=t.querySelector(`.${this.player.options.classPrefix}-tooltip`);i&&i.remove();let e=t.querySelector(`.${this.player.options.classPrefix}-button-text`);e&&e.remove(),this.dragOptionButton=t,this.dragOptionText=t.querySelector(`.${this.player.options.classPrefix}-settings-text`),this.updateDragOptionState();let a=f({classPrefix:this.player.options.classPrefix,itemClass:`${this.player.options.classPrefix}-transcript-settings-item`,icon:"settings",label:"transcript.styleTranscript",onClick:g=>{g.preventDefault(),g.stopPropagation(),this.hideSettingsMenu(),setTimeout(()=>{this.showStyleDialog()},50)}}),n=a.querySelector(`.${this.player.options.classPrefix}-tooltip`);n&&n.remove();let c=a.querySelector(`.${this.player.options.classPrefix}-button-text`);c&&c.remove();let p=f({classPrefix:this.player.options.classPrefix,itemClass:`${this.player.options.classPrefix}-transcript-settings-item`,icon:"resize",label:"transcript.enableResizeMode",hasTextClass:!0,onClick:g=>{g.preventDefault(),g.stopPropagation(),this.toggleResizeMode({focus:!1})?(this.hideSettingsMenu({focusButton:!1}),setTimeout(()=>{this.transcriptWindow&&this.transcriptWindow.focus({preventScroll:!0})},20)):this.hideSettingsMenu({focusButton:!0})}});p.setAttribute("role","switch"),p.setAttribute("aria-checked","false");let o=p.querySelector(`.${this.player.options.classPrefix}-tooltip`);o&&o.remove();let s=p.querySelector(`.${this.player.options.classPrefix}-button-text`);s&&s.remove(),this.resizeOptionButton=p,this.resizeOptionText=p.querySelector(`.${this.player.options.classPrefix}-settings-text`),this.updateResizeOptionState();let h=f({classPrefix:this.player.options.classPrefix,itemClass:`${this.player.options.classPrefix}-transcript-settings-item`,icon:"clock",label:"transcript.showTimestamps",hasTextClass:!0,onClick:()=>{this.toggleShowTimestamps()}});h.setAttribute("role","switch"),h.setAttribute("aria-checked",this.showTimestamps?"true":"false");let u=h.querySelector(`.${this.player.options.classPrefix}-tooltip`);u&&u.remove();let y=h.querySelector(`.${this.player.options.classPrefix}-button-text`);y&&y.remove(),this.showTimestampsButton=h,this.showTimestampsText=h.querySelector(`.${this.player.options.classPrefix}-settings-text`),this.updateShowTimestampsState();let d=f({classPrefix:this.player.options.classPrefix,itemClass:`${this.player.options.classPrefix}-transcript-settings-item`,icon:"close",label:"transcript.closeMenu",onClick:()=>{this.hideSettingsMenu()}}),x=d.querySelector(`.${this.player.options.classPrefix}-tooltip`);x&&x.remove();let T=d.querySelector(`.${this.player.options.classPrefix}-button-text`);T&&T.remove(),this.settingsMenu.appendChild(t),this.settingsMenu.appendChild(p),this.settingsMenu.appendChild(a),this.settingsMenu.appendChild(h),this.settingsMenu.appendChild(d),this.settingsMenu.style.visibility="hidden",this.settingsMenu.style.display="block",this.settingsButton&&this.settingsButton.parentNode?this.settingsButton.insertAdjacentElement("afterend",this.settingsMenu):this.headerLeft?this.headerLeft.appendChild(this.settingsMenu):this.transcriptHeader?this.transcriptHeader.appendChild(this.settingsMenu):this.transcriptWindow.appendChild(this.settingsMenu),this.positionSettingsMenuImmediate(),requestAnimationFrame(()=>{this.settingsMenu&&(this.settingsMenu.style.visibility="visible")}),this.settingsMenuKeyHandler=w(this.settingsMenu,this.settingsButton,`.${this.player.options.classPrefix}-transcript-settings-item`,()=>this.hideSettingsMenu({focusButton:!0})),this.settingsMenuVisible=!0,this.settingsMenu.style.display="block",this.settingsButton&&this.settingsButton.setAttribute("aria-expanded","true"),this.updateResizeOptionState(),setTimeout(()=>{let g=this.settingsMenu.querySelectorAll(`.${this.player.options.classPrefix}-transcript-settings-item`);if(g.length>0){g[0].setAttribute("tabindex","0");for(let m=1;m<g.length;m++)g[m].setAttribute("tabindex","-1");g[0].focus({preventScroll:!0})}},50)}positionSettingsMenuImmediate(){if(!this.settingsMenu||!this.settingsButton)return;let t=this.settingsButton.parentElement;if(!t)return;let i=this.settingsButton.getBoundingClientRect(),e=t.getBoundingClientRect(),a=this.settingsMenu.getBoundingClientRect(),n=window.innerHeight,c=i.left-e.left,p=i.bottom-e.top,o=i.top-e.top,s=n-i.bottom,h=i.top,u=p+4;s<a.height+20&&h>s?(u=o-a.height-4,this.settingsMenu.classList.add("vidply-menu-above")):this.settingsMenu.classList.remove("vidply-menu-above"),this.settingsMenu.style.top=`${u}px`,this.settingsMenu.style.left=`${c}px`,this.settingsMenu.style.right="auto",this.settingsMenu.style.bottom="auto"}positionSettingsMenu(){!this.settingsMenu||!this.settingsButton||requestAnimationFrame(()=>{setTimeout(()=>{this.positionSettingsMenuImmediate()},10)})}attachSettingsMenuKeyboardNavigation(){if(!this.settingsMenu)return;this.settingsMenuKeyHandler&&this.settingsMenu.removeEventListener("keydown",this.settingsMenuKeyHandler,!0);let t=w(this.settingsMenu,this.settingsButton,`.${this.player.options.classPrefix}-transcript-settings-item`,()=>this.hideSettingsMenu({focusButton:!0}));this.settingsMenuKeyHandler=t}hideSettingsMenu({focusButton:t=!0}={}){this.settingsMenu&&(this.settingsMenu.style.display="none",this.settingsMenuVisible=!1,this.settingsMenuJustOpened=!1,this.settingsMenuKeyHandler&&(this.settingsMenu.removeEventListener("keydown",this.settingsMenuKeyHandler,!0),this.settingsMenuKeyHandler=null),this.settingsButton&&(this.settingsButton.setAttribute("aria-expanded","false"),t&&this.settingsButton.focus({preventScroll:!0})))}enableMoveMode(){this.hideResizeModeIndicator(),this.transcriptWindow.classList.add(`${this.player.options.classPrefix}-transcript-move-mode`);let t=l.createElement("div",{className:`${this.player.options.classPrefix}-transcript-move-tooltip`,textContent:"Drag with mouse or press D for keyboard drag mode"});this.transcriptHeader.appendChild(t),setTimeout(()=>{this.transcriptWindow.classList.remove(`${this.player.options.classPrefix}-transcript-move-mode`),t.parentNode&&t.remove()},2e3)}toggleResizeMode({focus:t=!0}={}){return this.draggableResizable?this.draggableResizable.pointerResizeMode?(this.draggableResizable.disablePointerResizeMode({focus:t}),!1):(this.draggableResizable.enablePointerResizeMode({focus:t}),!0):!1}updateDragOptionState(){if(!this.dragOptionButton)return;let t=!!(this.draggableResizable&&this.draggableResizable.keyboardDragMode),i=t?r.t("transcript.disableDragMode"):r.t("transcript.enableDragMode"),e=t?r.t("transcript.disableDragModeAria"):r.t("transcript.enableDragModeAria");this.dragOptionButton.setAttribute("aria-checked",t?"true":"false"),this.dragOptionButton.setAttribute("aria-label",e),this.dragOptionText&&(this.dragOptionText.textContent=i)}updateResizeOptionState(){if(!this.resizeOptionButton)return;let t=!!(this.draggableResizable&&this.draggableResizable.pointerResizeMode),i=t?r.t("transcript.disableResizeMode"):r.t("transcript.enableResizeMode"),e=t?r.t("transcript.disableResizeModeAria"):r.t("transcript.enableResizeModeAria");this.resizeOptionButton.setAttribute("aria-checked",t?"true":"false"),this.resizeOptionButton.setAttribute("aria-label",e),this.resizeOptionText&&(this.resizeOptionText.textContent=i)}toggleShowTimestamps(){this.showTimestamps=!this.showTimestamps,this.updateShowTimestampsState(),this.updateTimestampVisibility(),this.saveTimestampsPreference()}updateShowTimestampsState(){if(!this.showTimestampsButton)return;let t=this.showTimestamps?r.t("transcript.hideTimestamps"):r.t("transcript.showTimestamps"),i=this.showTimestamps?r.t("transcript.hideTimestampsAria"):r.t("transcript.showTimestampsAria");this.showTimestampsButton.setAttribute("aria-checked",this.showTimestamps?"true":"false"),this.showTimestampsButton.setAttribute("aria-label",i),this.showTimestampsText&&(this.showTimestampsText.textContent=t)}updateTimestampVisibility(){if(!this.transcriptContent)return;this.transcriptContent.querySelectorAll(`.${this.player.options.classPrefix}-transcript-time`).forEach(i=>{i.style.display=this.showTimestamps?"":"none"})}saveTimestampsPreference(){let t=this.storage.getTranscriptPreferences()||{};t.showTimestamps=this.showTimestamps,this.storage.saveTranscriptPreferences(t)}showResizeModeIndicator(){if(!this.transcriptHeader)return;this.hideResizeModeIndicator();let t=l.createElement("div",{className:`${this.player.options.classPrefix}-transcript-resize-tooltip`,textContent:r.t("transcript.resizeModeHint")||"Resize handles enabled. Drag edges or corners to adjust. Press Esc or R to exit."});this.transcriptHeader.appendChild(t),this.resizeModeIndicator=t,this.resizeModeIndicatorTimeout=this.setManagedTimeout(()=>{this.hideResizeModeIndicator()},3e3)}hideResizeModeIndicator(){this.resizeModeIndicatorTimeout&&(this.clearManagedTimeout(this.resizeModeIndicatorTimeout),this.resizeModeIndicatorTimeout=null),this.resizeModeIndicator&&this.resizeModeIndicator.parentNode&&this.resizeModeIndicator.remove(),this.resizeModeIndicator=null}onPointerResizeModeChange(t){this.updateResizeOptionState(),t?(this.showResizeModeIndicator(),this.announceLive(r.t("transcript.resizeModeEnabled"))):(this.hideResizeModeIndicator(),this.announceLive(r.t("transcript.resizeModeDisabled")))}showStyleDialog(){if(this.styleDialog){this.styleDialog.style.display="block",this.styleDialogVisible=!0,this.handlers.styleDialogKeydown&&document.addEventListener("keydown",this.handlers.styleDialogKeydown),this.styleDialogJustOpened=!0,setTimeout(()=>{this.styleDialogJustOpened=!1},350),setTimeout(()=>{let o=this.styleDialog.querySelector("select, input");o&&o.focus({preventScroll:!0})},0);return}this.styleDialog=l.createElement("div",{className:`${this.player.options.classPrefix}-transcript-style-dialog`});let t=l.createElement("h4",{textContent:r.t("transcript.styleTitle"),className:`${this.player.options.classPrefix}-transcript-style-title`});this.styleDialog.appendChild(t);let i=this.createStyleSelectControl(r.t("captions.fontSize"),"fontSize",[{label:r.t("fontSizes.small"),value:"90%"},{label:r.t("fontSizes.normal"),value:"100%"},{label:r.t("fontSizes.large"),value:"110%"},{label:r.t("fontSizes.xlarge"),value:"120%"}]);this.styleDialog.appendChild(i);let e=this.createStyleSelectControl(r.t("captions.fontFamily"),"fontFamily",[{label:r.t("fontFamilies.sansSerif"),value:"sans-serif"},{label:r.t("fontFamilies.serif"),value:"serif"},{label:r.t("fontFamilies.monospace"),value:"monospace"}]);this.styleDialog.appendChild(e);let a=this.createStyleColorControl(r.t("captions.color"),"color");this.styleDialog.appendChild(a);let n=this.createStyleColorControl(r.t("captions.backgroundColor"),"backgroundColor");this.styleDialog.appendChild(n);let c=this.createStyleOpacityControl(r.t("captions.opacity"),"opacity");this.styleDialog.appendChild(c);let p=l.createElement("button",{className:`${this.player.options.classPrefix}-transcript-style-close`,textContent:r.t("settings.close"),attributes:{type:"button"}});p.addEventListener("click",()=>this.hideStyleDialog()),this.styleDialog.appendChild(p),this.handlers.styleDialogKeydown=o=>{if(this.styleDialogVisible){if(o.key==="Escape"){o.preventDefault(),o.stopPropagation(),this.hideStyleDialog();return}if(o.key==="Tab"){let s=this.styleDialog.querySelectorAll("select, input, button"),h=s[0],u=s[s.length-1];o.shiftKey&&document.activeElement===h?(o.preventDefault(),u.focus({preventScroll:!0})):!o.shiftKey&&document.activeElement===u&&(o.preventDefault(),h.focus({preventScroll:!0}))}}},document.addEventListener("keydown",this.handlers.styleDialogKeydown),this.headerLeft?this.headerLeft.appendChild(this.styleDialog):this.transcriptHeader.appendChild(this.styleDialog),this.applyTranscriptStyles(),this.styleDialogVisible=!0,this.styleDialog.style.display="block",this.styleDialogJustOpened=!0,setTimeout(()=>{this.styleDialogJustOpened=!1},350),setTimeout(()=>{let o=this.styleDialog.querySelector("select, input");o&&o.focus({preventScroll:!0})},0)}hideStyleDialog(){this.styleDialog&&(this.styleDialog.style.display="none",this.styleDialogVisible=!1,this.handlers.styleDialogKeydown&&document.removeEventListener("keydown",this.handlers.styleDialogKeydown),this.settingsButton&&this.settingsButton.focus({preventScroll:!0}))}createStyleSelectControl(t,i,e){let a=l.createElement("div",{className:`${this.player.options.classPrefix}-transcript-style-group`}),n=`${this.player.options.classPrefix}-transcript-${i}-${Date.now()}`,c=l.createElement("label",{textContent:t,attributes:{for:n}});a.appendChild(c);let p=l.createElement("select",{className:`${this.player.options.classPrefix}-transcript-style-select`,attributes:{id:n}});return e.forEach(o=>{let s=l.createElement("option",{textContent:o.label,attributes:{value:o.value}});this.transcriptStyle[i]===o.value&&(s.selected=!0),p.appendChild(s)}),p.addEventListener("change",o=>{this.transcriptStyle[i]=o.target.value,this.applyTranscriptStyles(),this.savePreferences()}),a.appendChild(p),a}createStyleColorControl(t,i){let e=l.createElement("div",{className:`${this.player.options.classPrefix}-transcript-style-group`}),a=`${this.player.options.classPrefix}-transcript-${i}-${Date.now()}`,n=l.createElement("label",{textContent:t,attributes:{for:a}});e.appendChild(n);let c=l.createElement("input",{attributes:{id:a,type:"color",value:this.transcriptStyle[i]},className:`${this.player.options.classPrefix}-transcript-style-color`});return c.addEventListener("input",p=>{this.transcriptStyle[i]=p.target.value,this.applyTranscriptStyles(),this.savePreferences()}),e.appendChild(c),e}createStyleOpacityControl(t,i){let e=l.createElement("div",{className:`${this.player.options.classPrefix}-transcript-style-group`}),a=`${this.player.options.classPrefix}-transcript-${i}-${Date.now()}`,n=l.createElement("label",{textContent:t,attributes:{for:a}});e.appendChild(n);let c=l.createElement("span",{textContent:Math.round(this.transcriptStyle[i]*100)+"%",className:`${this.player.options.classPrefix}-transcript-style-value`}),p=l.createElement("input",{attributes:{id:a,type:"range",min:"0",max:"1",step:"0.1",value:String(this.transcriptStyle[i])},className:`${this.player.options.classPrefix}-transcript-style-range`});p.addEventListener("input",s=>{let h=parseFloat(s.target.value);this.transcriptStyle[i]=h,c.textContent=Math.round(h*100)+"%",this.applyTranscriptStyles(),this.savePreferences()});let o=l.createElement("div",{className:`${this.player.options.classPrefix}-transcript-style-range-container`});return o.appendChild(p),o.appendChild(c),e.appendChild(n),e.appendChild(o),e}savePreferences(){this.storage.saveTranscriptPreferences(this.transcriptStyle)}applyTranscriptStyles(){if(!this.transcriptWindow)return;this.transcriptWindow.style.backgroundColor=this.transcriptStyle.backgroundColor,this.transcriptWindow.style.opacity=String(this.transcriptStyle.opacity),this.transcriptContent&&(this.transcriptContent.style.fontSize=this.transcriptStyle.fontSize,this.transcriptContent.style.fontFamily=this.transcriptStyle.fontFamily,this.transcriptContent.style.color=this.transcriptStyle.color),this.transcriptWindow.querySelectorAll(`.${this.player.options.classPrefix}-transcript-text`).forEach(e=>{e.style.fontSize=this.transcriptStyle.fontSize,e.style.fontFamily=this.transcriptStyle.fontFamily,e.style.color=this.transcriptStyle.color}),this.transcriptWindow.querySelectorAll(`.${this.player.options.classPrefix}-transcript-time`).forEach(e=>{e.style.fontFamily=this.transcriptStyle.fontFamily})}setManagedTimeout(t,i){let e=setTimeout(()=>{this.timeouts.delete(e),t()},i);return this.timeouts.add(e),e}clearManagedTimeout(t){t&&(clearTimeout(t),this.timeouts.delete(t))}destroy(){this.hideResizeModeIndicator(),this.draggableResizable&&(this.draggableResizable.pointerResizeMode&&(this.draggableResizable.disablePointerResizeMode(),this.updateResizeOptionState()),this.draggableResizable.destroy(),this.draggableResizable=null),this.transcriptWindow&&this.customKeyHandler&&(this.transcriptWindow.removeEventListener("keydown",this.customKeyHandler),this.customKeyHandler=null),this.handlers.timeupdate&&this.player.off("timeupdate",this.handlers.timeupdate),this.handlers.audiodescriptionenabled&&this.player.off("audiodescriptionenabled",this.handlers.audiodescriptionenabled),this.handlers.audiodescriptiondisabled&&this.player.off("audiodescriptiondisabled",this.handlers.audiodescriptiondisabled),this.settingsButton&&(this.handlers.settingsClick&&this.settingsButton.removeEventListener("click",this.handlers.settingsClick),this.handlers.settingsKeydown&&this.settingsButton.removeEventListener("keydown",this.handlers.settingsKeydown)),this.handlers.styleDialogKeydown&&document.removeEventListener("keydown",this.handlers.styleDialogKeydown),this.handlers.documentClick&&document.removeEventListener("click",this.handlers.documentClick),this.handlers.resize&&window.removeEventListener("resize",this.handlers.resize),this.timeouts.forEach(t=>clearTimeout(t)),this.timeouts.clear(),this.handlers=null,this.transcriptWindow&&this.transcriptWindow.parentNode&&this.transcriptWindow.parentNode.removeChild(this.transcriptWindow),this.transcriptWindow=null,this.transcriptHeader=null,this.transcriptContent=null,this.transcriptEntries=[],this.settingsMenu=null,this.styleDialog=null,this.transcriptResizeHandles=[],this.resizeOptionButton=null,this.resizeOptionText=null,this.liveRegion=null}announceLive(t){this.liveRegion&&(this.liveRegion.textContent=t||"")}};export{W as TranscriptManager};
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * Universal, Accessible Video Player
3
+ * (c) 2025 Matthias Peltzer
4
+ * Released under GPL-2.0-or-later License
5
+ */
6
+ import{a as o,b as l,c as M,d as b,f as v,h as C,i as P,j as f,k as w,m as S,n as z}from"./vidply.chunk-IBNYTGGM.min.js";var W=class{constructor(t){this.player=t,this.transcriptWindow=null,this.transcriptEntries=[],this.metadataCues=[],this.currentActiveEntry=null,this.isVisible=!1,this.storage=new C("vidply"),this.draggableResizable=null,this.settingsMenuVisible=!1,this.settingsMenu=null,this.settingsButton=null,this.settingsMenuJustOpened=!1,this.resizeOptionButton=null,this.resizeOptionText=null,this.dragOptionButton=null,this.dragOptionText=null,this.resizeModeIndicator=null,this.resizeModeIndicatorTimeout=null,this.transcriptResizeHandles=[],this.liveRegion=null,this.styleDialog=null,this.styleDialogVisible=!1,this.styleDialogJustOpened=!1,this.languageSelector=null,this.languageLabel=null,this.currentTranscriptLanguage=null,this.availableTranscriptLanguages=[],this.languageSelectorHandler=null;let i=this.storage.getTranscriptPreferences();this.autoscrollEnabled=i?.autoscroll!==void 0?i.autoscroll:!0,this.showTimestamps=i?.showTimestamps!==void 0?i.showTimestamps:!1,this.transcriptStyle={fontSize:i?.fontSize||this.player.options.transcriptFontSize||"100%",fontFamily:i?.fontFamily||this.player.options.transcriptFontFamily||"sans-serif",color:i?.color||this.player.options.transcriptColor||"#ffffff",backgroundColor:i?.backgroundColor||this.player.options.transcriptBackgroundColor||"#1e1e1e",opacity:i?.opacity??this.player.options.transcriptOpacity??.98},this.handlers={timeupdate:()=>this.updateActiveEntry(),audiodescriptionenabled:()=>{this.isVisible&&this.loadTranscriptData()},audiodescriptiondisabled:()=>{this.isVisible&&this.loadTranscriptData()},resize:null,settingsClick:null,settingsKeydown:null,documentClick:null,styleDialogKeydown:null},this.timeouts=new Set,this.init()}init(){this.setupMetadataHandlingOnLoad(),this.player.on("timeupdate",this.handlers.timeupdate),this.player.on("audiodescriptionenabled",this.handlers.audiodescriptionenabled),this.player.on("audiodescriptiondisabled",this.handlers.audiodescriptiondisabled),this.player.on("fullscreenchange",()=>{this.isVisible&&(window.innerWidth<768&&this.setupDragAndDrop(),(!this.draggableResizable||!this.draggableResizable.manuallyPositioned)&&this.setManagedTimeout(()=>this.positionTranscript(),100))})}toggleTranscript(){this.isVisible?this.hideTranscript():this.showTranscript()}showTranscript(){if(this.transcriptWindow){this.transcriptWindow.style.display="flex",this.isVisible=!0,this.player.controlBar&&typeof this.player.controlBar.updateTranscriptButton=="function"&&this.player.controlBar.updateTranscriptButton(),v(this.settingsButton,{delay:150});return}this.createTranscriptWindow(),this.loadTranscriptData(),this.transcriptWindow&&(this.transcriptWindow.style.display="flex",(!this.draggableResizable||!this.draggableResizable.manuallyPositioned)&&this.setManagedTimeout(()=>this.positionTranscript(),0),v(this.settingsButton,{delay:150})),this.isVisible=!0}hideTranscript({focusButton:t=!1}={}){if(this.transcriptWindow&&(this.transcriptWindow.style.display="none",this.isVisible=!1),this.draggableResizable&&this.draggableResizable.pointerResizeMode&&(this.draggableResizable.disablePointerResizeMode(),this.updateResizeOptionState()),this.hideResizeModeIndicator(),this.announceLive(""),this.player.controlBar&&typeof this.player.controlBar.updateTranscriptButton=="function"&&this.player.controlBar.updateTranscriptButton(),t){let i=this.player.controlBar?.controls?.transcript;i&&typeof i.focus=="function"&&i.focus({preventScroll:!0})}}createTranscriptWindow(){this.transcriptWindow=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-window`,attributes:{role:"dialog","aria-label":"Video Transcript",tabindex:"-1"}}),this.transcriptHeader=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-header`,attributes:{tabindex:"0"}}),this.headerLeft=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-header-left`});let t=l.t("transcript.settingsMenu");this.settingsButton=o.createElement("button",{className:`${this.player.options.classPrefix}-transcript-settings`,attributes:{type:"button","aria-label":t,"aria-expanded":"false"}}),this.settingsButton.appendChild(b("settings")),o.attachTooltip(this.settingsButton,t,this.player.options.classPrefix),this.handlers.settingsClick=d=>{d.preventDefault(),d.stopPropagation(),this.settingsMenuVisible?this.hideSettingsMenu():this.showSettingsMenu()},this.settingsButton.addEventListener("click",this.handlers.settingsClick),this.handlers.settingsKeydown=d=>{d.key==="d"||d.key==="D"?(d.preventDefault(),d.stopPropagation(),this.toggleKeyboardDragMode()):d.key==="r"||d.key==="R"?(d.preventDefault(),d.stopPropagation(),this.toggleResizeMode()):d.key==="Escape"&&this.settingsMenuVisible&&(d.preventDefault(),d.stopPropagation(),this.hideSettingsMenu())},this.settingsButton.addEventListener("keydown",this.handlers.settingsKeydown);let i=o.createElement("h3",{textContent:`${l.t("transcript.title")}. ${l.t("transcript.dragResizePrompt")}`}),e=`${this.player.options.classPrefix}-transcript-autoscroll-${Date.now()}`,a=o.createElement("label",{className:`${this.player.options.classPrefix}-transcript-autoscroll-label`,attributes:{for:e}});this.autoscrollCheckbox=o.createElement("input",{attributes:{id:e,type:"checkbox"}}),this.autoscrollEnabled&&(this.autoscrollCheckbox.checked=!0);let n=o.createElement("span",{textContent:l.t("transcript.autoscroll"),className:`${this.player.options.classPrefix}-transcript-autoscroll-text`});a.appendChild(this.autoscrollCheckbox),a.appendChild(n),this.autoscrollCheckbox.addEventListener("change",d=>{this.autoscrollEnabled=d.target.checked,this.saveAutoscrollPreference()}),this.transcriptHeader.appendChild(i),this.headerLeft.appendChild(this.settingsButton),this.headerLeft.appendChild(a);let c=`${this.player.options.classPrefix}-transcript-language-select-${Date.now()}`,{label:p,select:r}=S({classPrefix:this.player.options.classPrefix,labelClass:`${this.player.options.classPrefix}-transcript-language-label`,selectClass:`${this.player.options.classPrefix}-transcript-language-select`,labelText:"settings.language",selectId:c,hidden:!1});this.languageLabel=p,this.languageSelector=r;let s=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-language-wrapper`,attributes:{style:"display: none;"}});s.appendChild(this.languageLabel),s.appendChild(this.languageSelector),this.languageSelectorWrapper=s,z(s),this.headerLeft.appendChild(s);let h=l.t("transcript.close"),u=o.createElement("button",{className:`${this.player.options.classPrefix}-transcript-close`,attributes:{type:"button","aria-label":h}});u.appendChild(b("close")),o.attachTooltip(u,h,this.player.options.classPrefix),u.addEventListener("click",()=>this.hideTranscript({focusButton:!0})),this.transcriptHeader.appendChild(this.headerLeft),this.transcriptHeader.appendChild(u),this.transcriptContent=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-content`}),this.transcriptWindow.appendChild(this.transcriptHeader),this.transcriptWindow.appendChild(this.transcriptContent),this.createResizeHandles(),this.liveRegion=o.createElement("div",{className:"vidply-sr-only",attributes:{"aria-live":"polite","aria-atomic":"true"}}),this.transcriptWindow.appendChild(this.liveRegion),this.player.container.appendChild(this.transcriptWindow),this.setupDragAndDrop(),(!this.draggableResizable||!this.draggableResizable.manuallyPositioned)&&this.positionTranscript(),this.handlers.documentClick=d=>{this.settingsMenuJustOpened||this.styleDialogJustOpened||this.settingsButton&&this.settingsButton.contains(d.target)||this.settingsMenu&&this.settingsMenu.contains(d.target)||(this.settingsMenuVisible&&this.hideSettingsMenu(),this.styleDialogVisible&&this.styleDialog&&!this.styleDialog.contains(d.target)&&this.hideStyleDialog())},this.documentClickHandlerAdded=!1;let y;this.handlers.resize=()=>{y&&this.clearManagedTimeout(y),y=this.setManagedTimeout(()=>{(!this.draggableResizable||!this.draggableResizable.manuallyPositioned)&&this.positionTranscript()},100)},window.addEventListener("resize",this.handlers.resize)}createResizeHandles(){if(!this.transcriptWindow)return;let t=["n","s","e","w","ne","nw","se","sw"];this.transcriptResizeHandles=t.map(i=>{let e=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-resize-handle ${this.player.options.classPrefix}-transcript-resize-${i}`,attributes:{"data-direction":i,"data-vidply-managed-resize":"true","aria-hidden":"true"}});return e.style.display="none",this.transcriptWindow.appendChild(e),e})}positionTranscript(){if(!this.transcriptWindow||!this.player.videoWrapper||!this.isVisible||this.draggableResizable&&this.draggableResizable.manuallyPositioned)return;let t=window.innerWidth<768,i=this.player.videoWrapper.getBoundingClientRect(),e=this.player.state.fullscreen;if(t&&!e)this.transcriptWindow.style.position="relative",this.transcriptWindow.style.left="0",this.transcriptWindow.style.right="0",this.transcriptWindow.style.bottom="auto",this.transcriptWindow.style.top="auto",this.transcriptWindow.style.width="100%",this.transcriptWindow.style.maxWidth="100%",this.transcriptWindow.style.maxHeight="400px",this.transcriptWindow.style.height="auto",this.transcriptWindow.style.borderRadius="0",this.transcriptWindow.style.transform="none",this.transcriptWindow.style.border="none",this.transcriptWindow.style.borderTop="1px solid var(--vidply-border-light)",this.transcriptWindow.style.removeProperty("border-right"),this.transcriptWindow.style.removeProperty("border-bottom"),this.transcriptWindow.style.removeProperty("border-left"),this.transcriptWindow.style.removeProperty("border-image"),this.transcriptWindow.style.removeProperty("border-image-source"),this.transcriptWindow.style.removeProperty("border-image-slice"),this.transcriptWindow.style.removeProperty("border-image-width"),this.transcriptWindow.style.removeProperty("border-image-outset"),this.transcriptWindow.style.removeProperty("border-image-repeat"),this.transcriptWindow.style.boxShadow="none",this.transcriptHeader&&(this.transcriptHeader.style.cursor="default"),this.transcriptWindow.parentNode!==this.player.container&&this.player.container.appendChild(this.transcriptWindow);else if(e){this.transcriptWindow.style.position="fixed",this.transcriptWindow.style.left="auto",this.transcriptWindow.style.right="20px",this.transcriptWindow.style.bottom="80px",this.transcriptWindow.style.top="auto",this.transcriptWindow.style.maxHeight="calc(100vh - 180px)",this.transcriptWindow.style.height="auto";let a=260,n=Math.max(a,window.innerWidth-40),c=parseFloat(this.transcriptWindow.style.width)||400,p=Math.max(a,Math.min(c,n));this.transcriptWindow.style.width=`${p}px`,this.transcriptWindow.style.maxWidth="none",this.transcriptWindow.style.borderRadius="8px",this.transcriptWindow.style.border="1px solid var(--vidply-border)",this.transcriptWindow.style.removeProperty("border-top"),this.transcriptWindow.style.removeProperty("border-right"),this.transcriptWindow.style.removeProperty("border-bottom"),this.transcriptWindow.style.removeProperty("border-left"),this.transcriptWindow.style.removeProperty("border-image"),this.transcriptWindow.style.removeProperty("border-image-source"),this.transcriptWindow.style.removeProperty("border-image-slice"),this.transcriptWindow.style.removeProperty("border-image-width"),this.transcriptWindow.style.removeProperty("border-image-outset"),this.transcriptWindow.style.removeProperty("border-image-repeat"),this.transcriptHeader&&(this.transcriptHeader.style.cursor="move"),this.transcriptWindow.parentNode!==this.player.container&&this.player.container.appendChild(this.transcriptWindow)}else{let a=parseFloat(this.transcriptWindow.style.width)||400,n=20,c=260,p=this.player.container.getBoundingClientRect();window.getComputedStyle(this.player.container).position==="static"&&(this.player.container.style.position="relative");let s=i.right-p.left+n,h=window.innerWidth-i.right-n,u=Math.max(c,Math.min(a,h)),y=i.height;this.transcriptWindow.style.position="absolute",this.transcriptWindow.style.left=`${s}px`,this.transcriptWindow.style.right="auto",this.transcriptWindow.style.bottom="auto",this.transcriptWindow.style.top="0",this.transcriptWindow.style.height=`${y}px`,this.transcriptWindow.style.maxHeight="none",this.transcriptWindow.style.width=`${u}px`,this.transcriptWindow.style.maxWidth="none",this.transcriptWindow.style.borderRadius="8px",this.transcriptWindow.style.border="1px solid var(--vidply-border)",this.transcriptWindow.style.removeProperty("border-top"),this.transcriptWindow.style.removeProperty("border-right"),this.transcriptWindow.style.removeProperty("border-bottom"),this.transcriptWindow.style.removeProperty("border-left"),this.transcriptWindow.style.removeProperty("border-image"),this.transcriptWindow.style.removeProperty("border-image-source"),this.transcriptWindow.style.removeProperty("border-image-slice"),this.transcriptWindow.style.removeProperty("border-image-width"),this.transcriptWindow.style.removeProperty("border-image-outset"),this.transcriptWindow.style.removeProperty("border-image-repeat"),this.transcriptHeader&&(this.transcriptHeader.style.cursor="move"),this.transcriptWindow.parentNode!==this.player.container&&this.player.container.appendChild(this.transcriptWindow)}}getAvailableTranscriptLanguages(){let t=this.player.textTracks,i=new Map;return t.forEach(e=>{(e.kind==="captions"||e.kind==="subtitles")&&e.language&&(i.has(e.language)||i.set(e.language,{language:e.language,label:e.label||e.language,track:e}))}),Array.from(i.values())}updateLanguageSelector(){if(this.languageSelector){if(this.availableTranscriptLanguages=this.getAvailableTranscriptLanguages(),this.languageSelector.innerHTML="",this.availableTranscriptLanguages.length<2){this.languageSelectorWrapper&&(this.languageSelectorWrapper.style.display="none");return}if(this.languageSelectorWrapper&&(this.languageSelectorWrapper.style.display="flex"),this.availableTranscriptLanguages.forEach((t,i)=>{let e=o.createElement("option",{textContent:t.label,attributes:{value:t.language,lang:t.language}});this.languageSelector.appendChild(e)}),this.currentTranscriptLanguage)this.languageSelector.value=this.currentTranscriptLanguage;else if(this.availableTranscriptLanguages.length>0){let t=this.player.textTracks.find(i=>(i.kind==="captions"||i.kind==="subtitles")&&i.mode==="showing");this.currentTranscriptLanguage=t?t.language:this.availableTranscriptLanguages[0].language,this.languageSelector.value=this.currentTranscriptLanguage}this.languageSelectorHandler&&this.languageSelector.removeEventListener("change",this.languageSelectorHandler),this.languageSelectorHandler=t=>{this.currentTranscriptLanguage=t.target.value,this.loadTranscriptData(),this.transcriptContent&&this.currentTranscriptLanguage&&this.transcriptContent.setAttribute("lang",this.currentTranscriptLanguage)},this.languageSelector.addEventListener("change",this.languageSelectorHandler)}}loadTranscriptData(){this.transcriptEntries=[],this.transcriptContent.innerHTML="";let t=this.player.textTracks,i=null;this.currentTranscriptLanguage&&(i=t.find(s=>(s.kind==="captions"||s.kind==="subtitles")&&s.language===this.currentTranscriptLanguage)),i||(i=t.find(s=>s.kind==="captions"||s.kind==="subtitles"),i&&(this.currentTranscriptLanguage=i.language));let e=null;this.currentTranscriptLanguage&&(e=t.find(s=>s.kind==="descriptions"&&s.language===this.currentTranscriptLanguage)),e||(e=t.find(s=>s.kind==="descriptions"));let a=t.find(s=>s.kind==="metadata"),n=e&&this.player.state.audioDescriptionEnabled;if(!i&&!n&&!a){this.showNoTranscriptMessage();return}let c=[i,e,a].filter(Boolean);if(c.forEach(s=>{s.mode==="disabled"&&(s.mode="hidden")}),c.some(s=>!s.cues||s.cues.length===0)){let s=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-loading`,textContent:l.t("transcript.loading")});this.transcriptContent.appendChild(s);let h=0,u=()=>{h++,h>=c.length&&this.loadTranscriptData()};c.forEach(y=>{y.addEventListener("load",u,{once:!0})}),this.setManagedTimeout(()=>{this.loadTranscriptData()},500);return}let r=[];i&&i.cues&&Array.from(i.cues).forEach(s=>{r.push({cue:s,type:"caption"})}),e&&e.cues&&this.player.state.audioDescriptionEnabled&&Array.from(e.cues).forEach(s=>{r.push({cue:s,type:"description"})}),a&&a.cues&&(this.metadataCues=Array.from(a.cues),this.setupMetadataHandling()),r.sort((s,h)=>s.cue.startTime-h.cue.startTime),r.forEach((s,h)=>{let u=this.createTranscriptEntry(s.cue,h,s.type);this.transcriptEntries.push({element:u,cue:s.cue,type:s.type,startTime:s.cue.startTime,endTime:s.cue.endTime}),this.transcriptContent.appendChild(u)}),this.applyTranscriptStyles(),this.updateTimestampVisibility(),this.transcriptContent&&this.currentTranscriptLanguage&&this.transcriptContent.setAttribute("lang",this.currentTranscriptLanguage),this.updateLanguageSelector()}setupMetadataHandlingOnLoad(){let t=()=>{let e=this.player.textTracks.find(a=>a.kind==="metadata");if(e){if(e.mode==="disabled"&&(e.mode="hidden"),this.metadataCueChangeHandler&&e.removeEventListener("cuechange",this.metadataCueChangeHandler),this.metadataCueChangeHandler=()=>{let a=Array.from(e.activeCues||[]);a.length>0&&this.player.options.debug&&console.log("[VidPly Metadata] Active cues:",a.map(n=>({start:n.startTime,end:n.endTime,text:n.text}))),a.forEach(n=>{this.handleMetadataCue(n)})},e.addEventListener("cuechange",this.metadataCueChangeHandler),this.player.options.debug){let a=e.cues?e.cues.length:0;console.log("[VidPly Metadata] Track enabled,",a,"cues available")}}else this.player.options.debug&&console.warn("[VidPly Metadata] No metadata track found")};t(),this.player.on("loadedmetadata",t)}setupMetadataHandling(){!this.metadataCues||this.metadataCues.length===0||this.player.options.debug&&console.log("[VidPly Metadata]",this.metadataCues.length,"cues stored from transcript load")}handleMetadataCue(t){let i=t.text.trim();this.player.options.debug&&console.log("[VidPly Metadata] Processing cue:",{time:t.startTime,text:i}),this.player.emit("metadata",{time:t.startTime,endTime:t.endTime,text:i,cue:t}),i.includes("PAUSE")&&(this.player.state.paused||(this.player.options.debug&&console.log("[VidPly Metadata] Pausing video at",t.startTime),this.player.pause()),this.player.emit("metadata:pause",{time:t.startTime,text:i}));let e=i.match(/FOCUS:([\w#-]+)/);if(e){let n=e[1],c=document.querySelector(n);c?(this.player.options.debug&&console.log("[VidPly Metadata] Focusing element:",n),this.setManagedTimeout(()=>{c.focus({preventScroll:!0})},10)):this.player.options.debug&&console.warn("[VidPly Metadata] Element not found:",n),this.player.emit("metadata:focus",{time:t.startTime,target:n,element:c,text:i})}let a=i.match(/#[\w-]+/g);a&&(this.player.options.debug&&console.log("[VidPly Metadata] Hashtags found:",a),this.player.emit("metadata:hashtags",{time:t.startTime,hashtags:a,text:i}))}createTranscriptEntry(t,i,e="caption"){let a=this.stripVTTFormatting(t.text),n=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-entry ${this.player.options.classPrefix}-transcript-${e}`,attributes:{tabindex:"0","data-start":String(t.startTime),"data-end":String(t.endTime),"data-type":e}}),c=o.createElement("span",{className:`${this.player.options.classPrefix}-transcript-time`,textContent:M.formatTime(t.startTime),attributes:{"aria-hidden":"true"}}),p=o.createElement("span",{className:`${this.player.options.classPrefix}-transcript-text`,textContent:a});n.appendChild(c),n.appendChild(p);let r=()=>{this.player.seek(t.startTime),this.player.state.paused&&this.player.play()};return n.addEventListener("click",r),n.addEventListener("keydown",s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),r())}),n}stripVTTFormatting(t){return t.replace(/<[^>]+>/g,"").replace(/\n/g," ").trim()}showNoTranscriptMessage(){let t=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-empty`,textContent:l.t("transcript.noTranscript")});this.transcriptContent.appendChild(t)}updateActiveEntry(){if(!this.isVisible||this.transcriptEntries.length===0)return;let t=this.player.state.currentTime,i=this.transcriptEntries.find(e=>t>=e.startTime&&t<e.endTime);i&&i!==this.currentActiveEntry?(this.currentActiveEntry&&this.currentActiveEntry.element.classList.remove(`${this.player.options.classPrefix}-transcript-entry-active`),i.element.classList.add(`${this.player.options.classPrefix}-transcript-entry-active`),this.scrollToEntry(i.element),this.currentActiveEntry=i):!i&&this.currentActiveEntry&&(this.currentActiveEntry.element.classList.remove(`${this.player.options.classPrefix}-transcript-entry-active`),this.currentActiveEntry=null)}scrollToEntry(t){if(!this.transcriptContent||!this.autoscrollEnabled)return;let i=this.transcriptContent.getBoundingClientRect(),e=t.getBoundingClientRect();if(e.top<i.top||e.bottom>i.bottom){let a=t.offsetTop-this.transcriptContent.clientHeight/2+t.clientHeight/2;this.transcriptContent.scrollTo({top:a,behavior:"smooth"})}}saveAutoscrollPreference(){let t=this.storage.getTranscriptPreferences()||{};t.autoscroll=this.autoscrollEnabled,this.storage.saveTranscriptPreferences(t)}setupDragAndDrop(){if(!this.transcriptHeader||!this.transcriptWindow)return;let t=window.innerWidth<768,i=this.player.state.fullscreen;if(t&&!i){this.draggableResizable&&(this.draggableResizable.destroy(),this.draggableResizable=null);return}this.draggableResizable||(this.draggableResizable=new P(this.transcriptWindow,{dragHandle:this.transcriptHeader,resizeHandles:this.transcriptResizeHandles,constrainToViewport:!0,classPrefix:`${this.player.options.classPrefix}-transcript`,keyboardDragKey:"d",keyboardResizeKey:"r",keyboardStep:10,keyboardStepLarge:50,minWidth:300,minHeight:200,maxWidth:()=>Math.max(320,window.innerWidth-40),maxHeight:()=>Math.max(200,window.innerHeight-120),pointerResizeIndicatorText:l.t("transcript.resizeModeHint"),onPointerResizeToggle:e=>{this.transcriptResizeHandles.forEach(a=>{a.style.display=e?"block":"none"}),this.onPointerResizeModeChange(e)},onDragStart:e=>{let a=[`.${this.player.options.classPrefix}-transcript-close`,`.${this.player.options.classPrefix}-transcript-settings`,`.${this.player.options.classPrefix}-transcript-language-select`,`.${this.player.options.classPrefix}-transcript-language-label`,`.${this.player.options.classPrefix}-transcript-settings-menu`,`.${this.player.options.classPrefix}-transcript-style-dialog`];for(let n of a)if(e.target.closest(n))return!1;return!0}}),this.customKeyHandler=e=>{let a=e.key.toLowerCase(),n=e.defaultPrevented;if(!(this.settingsMenuVisible||this.styleDialogVisible)){if(a==="home"){e.preventDefault(),e.stopPropagation(),this.draggableResizable&&(this.draggableResizable.pointerResizeMode&&this.draggableResizable.disablePointerResizeMode(),this.draggableResizable.manuallyPositioned=!1,this.positionTranscript(),this.updateResizeOptionState(),this.announceLive(l.t("transcript.positionReset")));return}if(a==="r"){if(n)return;e.preventDefault(),e.stopPropagation(),this.toggleResizeMode()&&this.transcriptWindow.focus({preventScroll:!0});return}if(a==="escape"){if(this.draggableResizable&&this.draggableResizable.pointerResizeMode){e.preventDefault(),e.stopPropagation(),this.draggableResizable.disablePointerResizeMode();return}if(this.draggableResizable&&this.draggableResizable.keyboardDragMode){e.preventDefault(),e.stopPropagation(),this.draggableResizable.disableKeyboardDragMode(),this.announceLive(l.t("transcript.dragModeDisabled"));return}e.preventDefault(),e.stopPropagation(),this.hideTranscript({focusButton:!0});return}}},this.transcriptWindow.addEventListener("keydown",this.customKeyHandler))}toggleKeyboardDragMode(){if(this.draggableResizable){let t=this.draggableResizable.keyboardDragMode;this.draggableResizable.toggleKeyboardDragMode();let i=this.draggableResizable.keyboardDragMode;!t&&i&&this.enableMoveMode(),this.updateDragOptionState(),this.settingsMenuVisible&&this.hideSettingsMenu(),this.transcriptWindow.focus({preventScroll:!0})}}toggleSettingsMenu(){this.settingsMenuVisible?this.hideSettingsMenu():this.showSettingsMenu()}showSettingsMenu(){if(this.settingsMenuJustOpened=!0,setTimeout(()=>{this.settingsMenuJustOpened=!1},350),this.documentClickHandlerAdded||setTimeout(()=>{document.addEventListener("click",this.handlers.documentClick),this.documentClickHandlerAdded=!0},300),this.settingsMenu){this.settingsMenu.style.display="block",this.settingsMenuVisible=!0,this.settingsButton&&this.settingsButton.setAttribute("aria-expanded","true"),this.attachSettingsMenuKeyboardNavigation(),this.positionSettingsMenuImmediate(),this.updateResizeOptionState(),setTimeout(()=>{let g=this.settingsMenu.querySelectorAll(`.${this.player.options.classPrefix}-transcript-settings-item`);if(g.length>0){g[0].setAttribute("tabindex","0");for(let m=1;m<g.length;m++)g[m].setAttribute("tabindex","-1");g[0].focus({preventScroll:!0})}},50);return}this.settingsMenu=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-settings-menu`,attributes:{role:"menu"}});let t=f({classPrefix:this.player.options.classPrefix,itemClass:`${this.player.options.classPrefix}-transcript-settings-item`,icon:"move",label:"transcript.enableDragMode",hasTextClass:!0,onClick:()=>{this.toggleKeyboardDragMode(),this.hideSettingsMenu()}});t.setAttribute("role","switch"),t.setAttribute("aria-checked","false");let i=t.querySelector(`.${this.player.options.classPrefix}-tooltip`);i&&i.remove();let e=t.querySelector(`.${this.player.options.classPrefix}-button-text`);e&&e.remove(),this.dragOptionButton=t,this.dragOptionText=t.querySelector(`.${this.player.options.classPrefix}-settings-text`),this.updateDragOptionState();let a=f({classPrefix:this.player.options.classPrefix,itemClass:`${this.player.options.classPrefix}-transcript-settings-item`,icon:"settings",label:"transcript.styleTranscript",onClick:g=>{g.preventDefault(),g.stopPropagation(),this.hideSettingsMenu(),setTimeout(()=>{this.showStyleDialog()},50)}}),n=a.querySelector(`.${this.player.options.classPrefix}-tooltip`);n&&n.remove();let c=a.querySelector(`.${this.player.options.classPrefix}-button-text`);c&&c.remove();let p=f({classPrefix:this.player.options.classPrefix,itemClass:`${this.player.options.classPrefix}-transcript-settings-item`,icon:"resize",label:"transcript.enableResizeMode",hasTextClass:!0,onClick:g=>{g.preventDefault(),g.stopPropagation(),this.toggleResizeMode({focus:!1})?(this.hideSettingsMenu({focusButton:!1}),setTimeout(()=>{this.transcriptWindow&&this.transcriptWindow.focus({preventScroll:!0})},20)):this.hideSettingsMenu({focusButton:!0})}});p.setAttribute("role","switch"),p.setAttribute("aria-checked","false");let r=p.querySelector(`.${this.player.options.classPrefix}-tooltip`);r&&r.remove();let s=p.querySelector(`.${this.player.options.classPrefix}-button-text`);s&&s.remove(),this.resizeOptionButton=p,this.resizeOptionText=p.querySelector(`.${this.player.options.classPrefix}-settings-text`),this.updateResizeOptionState();let h=f({classPrefix:this.player.options.classPrefix,itemClass:`${this.player.options.classPrefix}-transcript-settings-item`,icon:"clock",label:"transcript.showTimestamps",hasTextClass:!0,onClick:()=>{this.toggleShowTimestamps()}});h.setAttribute("role","switch"),h.setAttribute("aria-checked",this.showTimestamps?"true":"false");let u=h.querySelector(`.${this.player.options.classPrefix}-tooltip`);u&&u.remove();let y=h.querySelector(`.${this.player.options.classPrefix}-button-text`);y&&y.remove(),this.showTimestampsButton=h,this.showTimestampsText=h.querySelector(`.${this.player.options.classPrefix}-settings-text`),this.updateShowTimestampsState();let d=f({classPrefix:this.player.options.classPrefix,itemClass:`${this.player.options.classPrefix}-transcript-settings-item`,icon:"close",label:"transcript.closeMenu",onClick:()=>{this.hideSettingsMenu()}}),T=d.querySelector(`.${this.player.options.classPrefix}-tooltip`);T&&T.remove();let x=d.querySelector(`.${this.player.options.classPrefix}-button-text`);x&&x.remove(),this.settingsMenu.appendChild(t),this.settingsMenu.appendChild(p),this.settingsMenu.appendChild(a),this.settingsMenu.appendChild(h),this.settingsMenu.appendChild(d),this.settingsMenu.style.visibility="hidden",this.settingsMenu.style.display="block",this.settingsButton&&this.settingsButton.parentNode?this.settingsButton.insertAdjacentElement("afterend",this.settingsMenu):this.headerLeft?this.headerLeft.appendChild(this.settingsMenu):this.transcriptHeader?this.transcriptHeader.appendChild(this.settingsMenu):this.transcriptWindow.appendChild(this.settingsMenu),this.positionSettingsMenuImmediate(),requestAnimationFrame(()=>{this.settingsMenu&&(this.settingsMenu.style.visibility="visible")}),this.settingsMenuKeyHandler=w(this.settingsMenu,this.settingsButton,`.${this.player.options.classPrefix}-transcript-settings-item`,()=>this.hideSettingsMenu({focusButton:!0})),this.settingsMenuVisible=!0,this.settingsMenu.style.display="block",this.settingsButton&&this.settingsButton.setAttribute("aria-expanded","true"),this.updateResizeOptionState(),setTimeout(()=>{let g=this.settingsMenu.querySelectorAll(`.${this.player.options.classPrefix}-transcript-settings-item`);if(g.length>0){g[0].setAttribute("tabindex","0");for(let m=1;m<g.length;m++)g[m].setAttribute("tabindex","-1");g[0].focus({preventScroll:!0})}},50)}positionSettingsMenuImmediate(){if(!this.settingsMenu||!this.settingsButton)return;let t=this.settingsButton.parentElement;if(!t)return;let i=this.settingsButton.getBoundingClientRect(),e=t.getBoundingClientRect(),a=this.settingsMenu.getBoundingClientRect(),n=window.innerHeight,c=i.left-e.left,p=i.bottom-e.top,r=i.top-e.top,s=n-i.bottom,h=i.top,u=p+4;s<a.height+20&&h>s?(u=r-a.height-4,this.settingsMenu.classList.add("vidply-menu-above")):this.settingsMenu.classList.remove("vidply-menu-above"),this.settingsMenu.style.top=`${u}px`,this.settingsMenu.style.left=`${c}px`,this.settingsMenu.style.right="auto",this.settingsMenu.style.bottom="auto"}positionSettingsMenu(){!this.settingsMenu||!this.settingsButton||requestAnimationFrame(()=>{setTimeout(()=>{this.positionSettingsMenuImmediate()},10)})}attachSettingsMenuKeyboardNavigation(){if(!this.settingsMenu)return;this.settingsMenuKeyHandler&&this.settingsMenu.removeEventListener("keydown",this.settingsMenuKeyHandler,!0);let t=w(this.settingsMenu,this.settingsButton,`.${this.player.options.classPrefix}-transcript-settings-item`,()=>this.hideSettingsMenu({focusButton:!0}));this.settingsMenuKeyHandler=t}hideSettingsMenu({focusButton:t=!0}={}){this.settingsMenu&&(this.settingsMenu.style.display="none",this.settingsMenuVisible=!1,this.settingsMenuJustOpened=!1,this.settingsMenuKeyHandler&&(this.settingsMenu.removeEventListener("keydown",this.settingsMenuKeyHandler,!0),this.settingsMenuKeyHandler=null),this.settingsButton&&(this.settingsButton.setAttribute("aria-expanded","false"),t&&this.settingsButton.focus({preventScroll:!0})))}enableMoveMode(){this.hideResizeModeIndicator(),this.transcriptWindow.classList.add(`${this.player.options.classPrefix}-transcript-move-mode`);let t=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-move-tooltip`,textContent:"Drag with mouse or press D for keyboard drag mode"});this.transcriptHeader.appendChild(t),setTimeout(()=>{this.transcriptWindow.classList.remove(`${this.player.options.classPrefix}-transcript-move-mode`),t.parentNode&&t.remove()},2e3)}toggleResizeMode({focus:t=!0}={}){return this.draggableResizable?this.draggableResizable.pointerResizeMode?(this.draggableResizable.disablePointerResizeMode({focus:t}),!1):(this.draggableResizable.enablePointerResizeMode({focus:t}),!0):!1}updateDragOptionState(){if(!this.dragOptionButton)return;let t=!!(this.draggableResizable&&this.draggableResizable.keyboardDragMode),i=t?l.t("transcript.disableDragMode"):l.t("transcript.enableDragMode"),e=t?l.t("transcript.disableDragModeAria"):l.t("transcript.enableDragModeAria");this.dragOptionButton.setAttribute("aria-checked",t?"true":"false"),this.dragOptionButton.setAttribute("aria-label",e),this.dragOptionText&&(this.dragOptionText.textContent=i)}updateResizeOptionState(){if(!this.resizeOptionButton)return;let t=!!(this.draggableResizable&&this.draggableResizable.pointerResizeMode),i=t?l.t("transcript.disableResizeMode"):l.t("transcript.enableResizeMode"),e=t?l.t("transcript.disableResizeModeAria"):l.t("transcript.enableResizeModeAria");this.resizeOptionButton.setAttribute("aria-checked",t?"true":"false"),this.resizeOptionButton.setAttribute("aria-label",e),this.resizeOptionText&&(this.resizeOptionText.textContent=i)}toggleShowTimestamps(){this.showTimestamps=!this.showTimestamps,this.updateShowTimestampsState(),this.updateTimestampVisibility(),this.saveTimestampsPreference()}updateShowTimestampsState(){if(!this.showTimestampsButton)return;let t=this.showTimestamps?l.t("transcript.hideTimestamps"):l.t("transcript.showTimestamps"),i=this.showTimestamps?l.t("transcript.hideTimestampsAria"):l.t("transcript.showTimestampsAria");this.showTimestampsButton.setAttribute("aria-checked",this.showTimestamps?"true":"false"),this.showTimestampsButton.setAttribute("aria-label",i),this.showTimestampsText&&(this.showTimestampsText.textContent=t)}updateTimestampVisibility(){if(!this.transcriptContent)return;this.transcriptContent.querySelectorAll(`.${this.player.options.classPrefix}-transcript-time`).forEach(i=>{i.style.display=this.showTimestamps?"":"none"})}saveTimestampsPreference(){let t=this.storage.getTranscriptPreferences()||{};t.showTimestamps=this.showTimestamps,this.storage.saveTranscriptPreferences(t)}showResizeModeIndicator(){if(!this.transcriptHeader)return;this.hideResizeModeIndicator();let t=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-resize-tooltip`,textContent:l.t("transcript.resizeModeHint")||"Resize handles enabled. Drag edges or corners to adjust. Press Esc or R to exit."});this.transcriptHeader.appendChild(t),this.resizeModeIndicator=t,this.resizeModeIndicatorTimeout=this.setManagedTimeout(()=>{this.hideResizeModeIndicator()},3e3)}hideResizeModeIndicator(){this.resizeModeIndicatorTimeout&&(this.clearManagedTimeout(this.resizeModeIndicatorTimeout),this.resizeModeIndicatorTimeout=null),this.resizeModeIndicator&&this.resizeModeIndicator.parentNode&&this.resizeModeIndicator.remove(),this.resizeModeIndicator=null}onPointerResizeModeChange(t){this.updateResizeOptionState(),t?(this.showResizeModeIndicator(),this.announceLive(l.t("transcript.resizeModeEnabled"))):(this.hideResizeModeIndicator(),this.announceLive(l.t("transcript.resizeModeDisabled")))}showStyleDialog(){if(this.styleDialog){this.styleDialog.style.display="block",this.styleDialogVisible=!0,this.handlers.styleDialogKeydown&&document.addEventListener("keydown",this.handlers.styleDialogKeydown),this.styleDialogJustOpened=!0,setTimeout(()=>{this.styleDialogJustOpened=!1},350),setTimeout(()=>{let r=this.styleDialog.querySelector("select, input");r&&r.focus({preventScroll:!0})},0);return}this.styleDialog=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-style-dialog`});let t=o.createElement("h4",{textContent:l.t("transcript.styleTitle"),className:`${this.player.options.classPrefix}-transcript-style-title`});this.styleDialog.appendChild(t);let i=this.createStyleSelectControl(l.t("captions.fontSize"),"fontSize",[{label:l.t("fontSizes.small"),value:"90%"},{label:l.t("fontSizes.normal"),value:"100%"},{label:l.t("fontSizes.large"),value:"110%"},{label:l.t("fontSizes.xlarge"),value:"120%"}]);this.styleDialog.appendChild(i);let e=this.createStyleSelectControl(l.t("captions.fontFamily"),"fontFamily",[{label:l.t("fontFamilies.sansSerif"),value:"sans-serif"},{label:l.t("fontFamilies.serif"),value:"serif"},{label:l.t("fontFamilies.monospace"),value:"monospace"}]);this.styleDialog.appendChild(e);let a=this.createStyleColorControl(l.t("captions.color"),"color");this.styleDialog.appendChild(a);let n=this.createStyleColorControl(l.t("captions.backgroundColor"),"backgroundColor");this.styleDialog.appendChild(n);let c=this.createStyleOpacityControl(l.t("captions.opacity"),"opacity");this.styleDialog.appendChild(c);let p=o.createElement("button",{className:`${this.player.options.classPrefix}-transcript-style-close`,textContent:l.t("settings.close"),attributes:{type:"button"}});p.addEventListener("click",()=>this.hideStyleDialog()),this.styleDialog.appendChild(p),this.handlers.styleDialogKeydown=r=>{if(this.styleDialogVisible){if(r.key==="Escape"){r.preventDefault(),r.stopPropagation(),this.hideStyleDialog();return}if(r.key==="Tab"){let s=this.styleDialog.querySelectorAll("select, input, button"),h=s[0],u=s[s.length-1];r.shiftKey&&document.activeElement===h?(r.preventDefault(),u.focus({preventScroll:!0})):!r.shiftKey&&document.activeElement===u&&(r.preventDefault(),h.focus({preventScroll:!0}))}}},document.addEventListener("keydown",this.handlers.styleDialogKeydown),this.headerLeft?this.headerLeft.appendChild(this.styleDialog):this.transcriptHeader.appendChild(this.styleDialog),this.applyTranscriptStyles(),this.styleDialogVisible=!0,this.styleDialog.style.display="block",this.styleDialogJustOpened=!0,setTimeout(()=>{this.styleDialogJustOpened=!1},350),setTimeout(()=>{let r=this.styleDialog.querySelector("select, input");r&&r.focus({preventScroll:!0})},0)}hideStyleDialog(){this.styleDialog&&(this.styleDialog.style.display="none",this.styleDialogVisible=!1,this.handlers.styleDialogKeydown&&document.removeEventListener("keydown",this.handlers.styleDialogKeydown),this.settingsButton&&this.settingsButton.focus({preventScroll:!0}))}createStyleSelectControl(t,i,e){let a=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-style-group`}),n=`${this.player.options.classPrefix}-transcript-${i}-${Date.now()}`,c=o.createElement("label",{textContent:t,attributes:{for:n}});a.appendChild(c);let p=o.createElement("select",{className:`${this.player.options.classPrefix}-transcript-style-select`,attributes:{id:n}});return e.forEach(r=>{let s=o.createElement("option",{textContent:r.label,attributes:{value:r.value}});this.transcriptStyle[i]===r.value&&(s.selected=!0),p.appendChild(s)}),p.addEventListener("change",r=>{this.transcriptStyle[i]=r.target.value,this.applyTranscriptStyles(),this.savePreferences()}),a.appendChild(p),a}createStyleColorControl(t,i){let e=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-style-group`}),a=`${this.player.options.classPrefix}-transcript-${i}-${Date.now()}`,n=o.createElement("label",{textContent:t,attributes:{for:a}});e.appendChild(n);let c=o.createElement("input",{attributes:{id:a,type:"color",value:this.transcriptStyle[i]},className:`${this.player.options.classPrefix}-transcript-style-color`});return c.addEventListener("input",p=>{this.transcriptStyle[i]=p.target.value,this.applyTranscriptStyles(),this.savePreferences()}),e.appendChild(c),e}createStyleOpacityControl(t,i){let e=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-style-group`}),a=`${this.player.options.classPrefix}-transcript-${i}-${Date.now()}`,n=o.createElement("label",{textContent:t,attributes:{for:a}});e.appendChild(n);let c=o.createElement("span",{textContent:Math.round(this.transcriptStyle[i]*100)+"%",className:`${this.player.options.classPrefix}-transcript-style-value`}),p=o.createElement("input",{attributes:{id:a,type:"range",min:"0",max:"1",step:"0.1",value:String(this.transcriptStyle[i])},className:`${this.player.options.classPrefix}-transcript-style-range`});p.addEventListener("input",s=>{let h=parseFloat(s.target.value);this.transcriptStyle[i]=h,c.textContent=Math.round(h*100)+"%",this.applyTranscriptStyles(),this.savePreferences()});let r=o.createElement("div",{className:`${this.player.options.classPrefix}-transcript-style-range-container`});return r.appendChild(p),r.appendChild(c),e.appendChild(n),e.appendChild(r),e}savePreferences(){this.storage.saveTranscriptPreferences(this.transcriptStyle)}applyTranscriptStyles(){if(!this.transcriptWindow)return;this.transcriptWindow.style.backgroundColor=this.transcriptStyle.backgroundColor,this.transcriptWindow.style.opacity=String(this.transcriptStyle.opacity),this.transcriptContent&&(this.transcriptContent.style.fontSize=this.transcriptStyle.fontSize,this.transcriptContent.style.fontFamily=this.transcriptStyle.fontFamily,this.transcriptContent.style.color=this.transcriptStyle.color),this.transcriptWindow.querySelectorAll(`.${this.player.options.classPrefix}-transcript-text`).forEach(e=>{e.style.fontSize=this.transcriptStyle.fontSize,e.style.fontFamily=this.transcriptStyle.fontFamily,e.style.color=this.transcriptStyle.color}),this.transcriptWindow.querySelectorAll(`.${this.player.options.classPrefix}-transcript-time`).forEach(e=>{e.style.fontFamily=this.transcriptStyle.fontFamily})}setManagedTimeout(t,i){let e=setTimeout(()=>{this.timeouts.delete(e),t()},i);return this.timeouts.add(e),e}clearManagedTimeout(t){t&&(clearTimeout(t),this.timeouts.delete(t))}destroy(){this.hideResizeModeIndicator(),this.draggableResizable&&(this.draggableResizable.pointerResizeMode&&(this.draggableResizable.disablePointerResizeMode(),this.updateResizeOptionState()),this.draggableResizable.destroy(),this.draggableResizable=null),this.transcriptWindow&&this.customKeyHandler&&(this.transcriptWindow.removeEventListener("keydown",this.customKeyHandler),this.customKeyHandler=null),this.handlers.timeupdate&&this.player.off("timeupdate",this.handlers.timeupdate),this.handlers.audiodescriptionenabled&&this.player.off("audiodescriptionenabled",this.handlers.audiodescriptionenabled),this.handlers.audiodescriptiondisabled&&this.player.off("audiodescriptiondisabled",this.handlers.audiodescriptiondisabled),this.settingsButton&&(this.handlers.settingsClick&&this.settingsButton.removeEventListener("click",this.handlers.settingsClick),this.handlers.settingsKeydown&&this.settingsButton.removeEventListener("keydown",this.handlers.settingsKeydown)),this.handlers.styleDialogKeydown&&document.removeEventListener("keydown",this.handlers.styleDialogKeydown),this.handlers.documentClick&&document.removeEventListener("click",this.handlers.documentClick),this.handlers.resize&&window.removeEventListener("resize",this.handlers.resize),this.timeouts.forEach(t=>clearTimeout(t)),this.timeouts.clear(),this.handlers=null,this.transcriptWindow&&this.transcriptWindow.parentNode&&this.transcriptWindow.parentNode.removeChild(this.transcriptWindow),this.transcriptWindow=null,this.transcriptHeader=null,this.transcriptContent=null,this.transcriptEntries=[],this.settingsMenu=null,this.styleDialog=null,this.transcriptResizeHandles=[],this.resizeOptionButton=null,this.resizeOptionText=null,this.liveRegion=null}announceLive(t){this.liveRegion&&(this.liveRegion.textContent=t||"")}};export{W as TranscriptManager};
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * Universal, Accessible Video Player
3
+ * (c) 2025 Matthias Peltzer
4
+ * Released under GPL-2.0-or-later License
5
+ */
6
+ var m={createElement(i,e={}){let t=document.createElement(i);return e.className&&(t.className=e.className),e.attributes&&Object.entries(e.attributes).forEach(([s,o])=>{t.setAttribute(s,o)}),e.innerHTML&&(t.innerHTML=e.innerHTML),e.textContent&&(t.textContent=e.textContent),e.style&&Object.assign(t.style,e.style),e.children&&e.children.forEach(s=>{s&&t.appendChild(s)}),t},addClass(i,e){i&&e&&i.classList.add(e)},removeClass(i,e){i&&e&&i.classList.remove(e)},toggleClass(i,e){i&&e&&i.classList.toggle(e)},hasClass(i,e){return i&&i.classList.contains(e)},show(i){i&&(i.style.display="")},hide(i){i&&(i.style.display="none")},fadeIn(i,e=300){if(!i)return;i.style.opacity="0",i.style.display="";let t=null,s=o=>{t||(t=o);let n=o-t,r=Math.min(n/e,1);i.style.opacity=r,n<e&&requestAnimationFrame(s)};requestAnimationFrame(s)},fadeOut(i,e=300){if(!i)return;let t=parseFloat(getComputedStyle(i).opacity)||1,s=null,o=n=>{s||(s=n);let r=n-s,c=Math.max(t-r/e,0);i.style.opacity=c,r<e?requestAnimationFrame(o):i.style.display="none"};requestAnimationFrame(o)},offset(i){if(!i)return{top:0,left:0};let e=i.getBoundingClientRect();return{top:e.top+window.pageYOffset,left:e.left+window.pageXOffset,width:e.width,height:e.height}},escapeHTML(i){let e=document.createElement("div");return e.textContent=i,e.innerHTML},sanitizeHTML(i){let e=document.createElement("div"),t=i.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"").replace(/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi,"").replace(/on\w+\s*=/gi,"").replace(/javascript:/gi,"");return e.innerHTML=t,e.innerHTML},createTooltip(i,e="vidply"){return this.createElement("span",{className:`${e}-tooltip`,textContent:i,attributes:{"aria-hidden":"true"}})},attachTooltip(i,e,t="vidply"){if(!i||!e)return;let s=i.querySelector(`.${t}-tooltip`);s&&s.remove();let o=this.createTooltip(e,t);i.appendChild(o);let n=()=>{o.classList.add(`${t}-tooltip-visible`)},r=()=>{o.classList.remove(`${t}-tooltip-visible`)};i.addEventListener("mouseenter",n),i.addEventListener("mouseleave",r),i.addEventListener("focus",n),i.addEventListener("blur",r)},createButtonText(i,e="vidply"){return this.createElement("span",{className:`${e}-button-text`,textContent:i,attributes:{"aria-hidden":"true"}})}};var w={player:{label:"Video Player",play:"Play",pause:"Pause",stop:"Stop",restart:"Restart from beginning",rewind:"Rewind",forward:"Forward",rewindSeconds:"Rewind {seconds} seconds",forwardSeconds:"Forward {seconds} seconds",previous:"Previous track",next:"Next track",playlist:"Toggle playlist",volume:"Volume",mute:"Mute",unmute:"Unmute",fullscreen:"Fullscreen",exitFullscreen:"Exit Fullscreen",captions:"Captions",chapters:"Chapters",quality:"Quality",captionStyling:"Caption styling",transcript:"Toggle transcript",audioDescription:"Audio description",signLanguage:"Sign language video",settings:"Settings",speed:"Playback Speed",pip:"Picture in Picture",currentTime:"Current time",duration:"Duration",progress:"Progress",seekForward:"Seek forward {seconds} seconds",seekBackward:"Seek backward {seconds} seconds",volumeUp:"Volume up",volumeDown:"Volume down",loading:"Loading...",loadingChapters:"Loading chapters...",error:"Error loading media",buffering:"Buffering...",signLanguageVideo:"Sign Language Video",closeSignLanguage:"Close sign language video",signLanguageSettings:"Sign language settings",noChapters:"No chapters available",noCaptions:"No captions available",auto:"Auto",autoQuality:"Auto (no quality selection available)",noQuality:"Quality selection not available",signLanguageDragResize:"Sign Language Video - Press D to drag with keyboard, R to resize",signLanguageDragActive:"Sign Language Video - Drag mode active. Use arrow keys to move, Escape to exit.",signLanguageResizeActive:"Sign Language Video - Resize mode active. Use left/right arrow keys to resize, Escape to exit.",enableSignDragMode:"Enable drag mode. Shortcut: D key",disableSignDragMode:"Disable drag mode. Shortcut: D key",enableSignDragModeAria:"Enable toggle keyboard drag mode with arrow keys. Shortcut: D key",disableSignDragModeAria:"Disable toggle keyboard drag mode with arrow keys. Shortcut: D key",enableSignResizeMode:"Enable resize mode. Shortcut: R key",disableSignResizeMode:"Disable resize mode. Shortcut: R key",enableSignResizeModeAria:"Enable keyboard resize mode with arrow keys. Shortcut: R key",disableSignResizeModeAria:"Disable keyboard resize mode with arrow keys. Shortcut: R key",resizeHandle:"Resize {direction} corner",moreOptions:"More options",noMoreOptions:"No additional options available"},captions:{off:"Off",select:"Select captions",fontSize:"Font Size",fontFamily:"Font Family",color:"Text Color",backgroundColor:"Background Color",opacity:"Opacity"},fontSizes:{small:"Small",normal:"Normal",large:"Large",xlarge:"X-Large"},fontFamilies:{sansSerif:"Sans-serif",serif:"Serif",monospace:"Monospace"},styleLabels:{textColor:"Text Color",background:"Background",font:"Font",fontSize:"Font Size",opacity:"Opacity"},audioDescription:{enable:"Enable audio description",disable:"Disable audio description"},signLanguage:{show:"Show sign language video",hide:"Hide sign language video"},transcript:{title:"Transcript",ariaLabel:"Video Transcript",close:"Close transcript",loading:"Loading transcript...",noTranscript:"No transcript available for this video.",settings:"Transcript settings. Press Enter to open menu, or D to enable drag mode",keyboardDragMode:"Toggle keyboard drag mode with arrow keys. Shortcut: D key",keyboardDragActive:"⌨️ Keyboard Drag Mode Active (Arrow keys to move, Shift+Arrows for large steps, D or ESC to exit)",dragResizePrompt:"Press D to drag or R to resize. Use Home to reset position, Esc to close.",dragModeEnabled:"Keyboard drag mode enabled. Use arrow keys to move, Shift+Arrow for larger steps. Press D or Esc to exit.",dragModeDisabled:"Keyboard drag mode disabled.",enableDragMode:"Enable drag mode. Shortcut: D key",disableDragMode:"Disable drag mode. Shortcut: D key",enableDragModeAria:"Enable toggle keyboard drag mode with arrow keys. Shortcut: D key",disableDragModeAria:"Disable toggle keyboard drag mode with arrow keys. Shortcut: D key",resizeWindow:"Resize Window",disableResizeWindow:"Disable Resize Mode",enableResizeMode:"Enable resize mode. Shortcut: R key",disableResizeMode:"Disable resize mode. Shortcut: R key",enableResizeModeAria:"Enable keyboard resize mode with arrow keys. Shortcut: R key",disableResizeModeAria:"Disable keyboard resize mode with arrow keys. Shortcut: R key",resizeModeHint:"Resize handles enabled. Drag edges or corners to adjust. Press Esc or R to exit.",resizeModeEnabled:"Resize mode enabled. Drag edges or corners to adjust. Press Esc or R to exit.",resizeModeDisabled:"Resize mode disabled.",positionReset:"Transcript position reset.",styleTranscript:"Open transcript style settings",closeMenu:"Close Menu",styleTitle:"Transcript Style",autoscroll:"Autoscroll",settingsMenu:"Transcript dialog settings",showTimestamps:"Show timestamps",hideTimestamps:"Hide timestamps",showTimestampsAria:"Show timestamps in transcript",hideTimestampsAria:"Hide timestamps in transcript"},settings:{title:"Settings",quality:"Quality",speed:"Speed",captions:"Captions",language:"Language",reset:"Reset to defaults",close:"Close"},speeds:{normal:"Normal"},time:{display:"Time display",durationPrefix:"Duration: ",of:"of",hour:"{count} hour",hours:"{count} hours",minute:"{count} minute",minutes:"{count} minutes",second:"{count} second",seconds:"{count} seconds"},playlist:{title:"Playlist",trackOf:"Track {current} of {total}",nowPlaying:"Now playing: Track {current} of {total}. {title}{artist}",by:" by ",untitled:"Untitled",trackUntitled:"Track {number}",currentlyPlaying:"Currently playing",notPlaying:"Not playing",pressEnterPlay:"Press Enter to play",pressEnterRestart:"Press Enter to restart",keyboardInstructions:"Playlist navigation: Use Up and Down arrow keys to move between tracks. Press Page Up or Page Down to skip 5 tracks. Press Home to go to first track, End to go to last track. Press Enter or Space to play the selected track.",endOfPlaylist:"End of playlist. {current} of {total}.",beginningOfPlaylist:"Beginning of playlist. 1 of {total}.",jumpedToLastTrack:"Jumped to last track. {current} of {total}.",jumpedToFirstTrack:"Jumped to first track. 1 of {total}.",firstTrack:"First track. 1 of {total}.",lastTrack:"Last track. {current} of {total}."}};var M={de:()=>import("./vidply.de-FR3XX54P.min.js"),es:()=>import("./vidply.es-3IJCQLJ7.min.js"),fr:()=>import("./vidply.fr-NC4VEAPH.min.js"),ja:()=>import("./vidply.ja-4ZC6ZQLV.min.js")};function y(){return{en:w}}function k(){return M}async function S(i){let e=M[i];if(!e)return null;let t=await e();return t[i]||t.default||null}var V=y();var v=class{constructor(){this.currentLanguage="en",this.translations=y(),this.loadingPromises=new Map,this.builtInLanguageLoaders=k()}setLanguage(e){this.translations[e]?this.currentLanguage=e:(console.warn(`Language "${e}" not found, falling back to English`),this.currentLanguage="en")}getLanguage(){return this.currentLanguage}async ensureLanguage(e){let t=(e||"").toLowerCase();if(!t)return this.currentLanguage;if(this.translations[t])return t;if(this.loadingPromises.has(t))return await this.loadingPromises.get(t),this.translations[t]?t:null;if(!this.builtInLanguageLoaders[t])return null;let s=(async()=>{try{let o=await S(t);o&&(this.translations[t]=o)}catch(o){console.warn(`Language "${t}" failed to load:`,o)}finally{this.loadingPromises.delete(t)}})();return this.loadingPromises.set(t,s),await s,this.translations[t]?t:null}t(e,t={}){let s=e.split("."),o=this.translations[this.currentLanguage];for(let n of s)if(o&&typeof o=="object"&&n in o)o=o[n];else{o=this.translations.en;for(let r of s)if(o&&typeof o=="object"&&r in o)o=o[r];else return e;break}return typeof o=="string"&&Object.entries(t).forEach(([n,r])=>{o=o.replace(new RegExp(`{${n}}`,"g"),r)}),o}addTranslation(e,t){this.translations[e]||(this.translations[e]={}),Object.assign(this.translations[e],t)}async loadLanguageFromUrl(e,t){if(this.loadingPromises.has(t))return this.loadingPromises.get(t);let s=(async()=>{try{let o=await fetch(t);if(!o.ok)throw new Error(`Failed to load language file: ${o.statusText}`);let n=o.headers.get("content-type")||"",r,c=await o.arrayBuffer(),a=new TextDecoder("utf-8").decode(c);if(n.includes("application/json")||t.endsWith(".json"))r=JSON.parse(a);else if(n.includes("text/yaml")||n.includes("application/x-yaml")||t.endsWith(".yaml")||t.endsWith(".yml"))try{r=JSON.parse(a)}catch{if(typeof window<"u"&&window.jsyaml)r=window.jsyaml.load(a);else throw console.warn("YAML parsing requires js-yaml library. Please include it or use JSON format."),new Error("YAML parsing not available. Please use JSON format or include js-yaml library.")}else r=JSON.parse(a);return this.addTranslation(e,r),r}catch(o){throw console.error(`Error loading language file from ${t}:`,o),o}finally{this.loadingPromises.delete(t)}})();return this.loadingPromises.set(t,s),s}async loadLanguagesFromUrls(e){let t=Object.entries(e).map(([s,o])=>this.loadLanguageFromUrl(s,o));await Promise.all(t)}},p=new v;var K={formatTime(i,e=!1){if(!isFinite(i)||i<0)return e?"00:00:00":"00:00";let t=Math.floor(i/3600),s=Math.floor(i%3600/60),o=Math.floor(i%60),n=r=>String(r).padStart(2,"0");return t>0||e?`${n(t)}:${n(s)}:${n(o)}`:`${n(s)}:${n(o)}`},parseTime(i){let e=i.split(":").map(t=>parseInt(t,10));return e.length===3?e[0]*3600+e[1]*60+e[2]:e.length===2?e[0]*60+e[1]:e.length===1?e[0]:0},formatDuration(i){if(!isFinite(i)||i<0)return p.t("time.seconds",{count:0});let e=Math.floor(i/3600),t=Math.floor(i%3600/60),s=Math.floor(i%60),o=[];if(e>0){let n=e===1?"time.hour":"time.hours";o.push(p.t(n,{count:e}))}if(t>0){let n=t===1?"time.minute":"time.minutes";o.push(p.t(n,{count:t}))}if(s>0||o.length===0){let n=s===1?"time.second":"time.seconds";o.push(p.t(n,{count:s}))}return o.join(", ")},formatPercentage(i,e){return e===0?0:Math.round(i/e*100)}};var H={play:'<path d="M8 5v14l11-7z"/>',pause:'<path d="M6 4h4v16H6V4zm8 0h4v16h-4V4z"/>',stop:'<rect x="6" y="6" width="12" height="12"/>',rewind:'<path d="M11 18V6l-8.5 6 8.5 6zm.5-6l8.5 6V6l-8.5 6z"/>',forward:'<path d="M4 18l8.5-6L4 6v12zm9-12v12l8.5-6L13 6z"/>',skipPrevious:'<path d="M6 6h2v12H6V6zm3 6l8.5 6V6L9 12z"/>',skipNext:'<path d="M16 6h2v12h-2V6zM6 6l8.5 6L6 18V6z"/>',restart:'<path d="M12 5V1L7 6l5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6H4c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8z"/>',volumeHigh:'<path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"/>',volumeMedium:'<path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02z"/>',volumeLow:'<path d="M7 9v6h4l5 5V4l-5 5H7z"/>',volumeMuted:'<path d="M16.5 12c0-1.77-1.02-3.29-2.5-4.03v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51C20.63 14.91 21 13.5 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3L3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06c1.38-.31 2.63-.95 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4L9.91 6.09 12 8.18V4z"/>',fullscreen:'<path d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/>',fullscreenExit:'<path d="M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"/>',settings:'<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-.94L14.4 2.81c-.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"/>',captions:'<path d="M19 4H5c-1.11 0-2 .9-2 2v12c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-8 7H9.5v-.5h-2v3h2V13H11v1c0 .55-.45 1-1 1H7c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v1zm7 0h-1.5v-.5h-2v3h2V13H18v1c0 .55-.45 1-1 1h-3c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v1z"/>',captionsOff:'<path d="M19 4H5c-1.11 0-2 .9-2 2v12c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-8 7H9.5v-.5h-2v3h2V13H11v1c0 .55-.45 1-1 1H7c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v1zm7 0h-1.5v-.5h-2v3h2V13H18v1c0 .55-.45 1-1 1h-3c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v1z"/><path d="M0 0h24v24H0z" fill="none"/>',pip:'<path d="M19 7h-8v6h8V7zm2-4H3c-1.1 0-2 .9-2 2v14c0 1.1.9 1.98 2 1.98h18c1.1 0 2-.88 2-1.98V5c0-1.1-.9-2-2-2zm0 16.01H3V4.98h18v14.03z"/>',speed:'<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.44z"/><path d="M10.59 15.41a2 2 0 0 0 2.83 0l5.66-8.49-8.49 5.66a2 2 0 0 0 0 2.83z"/>',close:'<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>',check:'<path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/>',loading:'<path d="M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3z"/>',error:'<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"/>',playlist:'<path d="M15 6H3v2h12V6zm0 4H3v2h12v-2zM3 16h8v-2H3v2zM17 6v8.18c-.31-.11-.65-.18-1-.18-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3V8h3V6h-5z"/>',hd:'<path d="M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-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"/>',transcript:'<path d="M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 16H8v-2h8v2zm0-4H8v-2h8v2zm-3-5V3.5L18.5 9H13z"/>',chapters:'<path d="M3 5h2v2H3V5zm0 4h2v2H3V9zm0 4h2v2H3v-2zm0 4h2v2H3v-2zM7 5h14v2H7V5zm0 4h14v2H7V9zm0 4h14v2H7v-2zm0 4h14v2H7v-2z"/>',audioDescription:'<rect x="2" y="5" width="20" height="14" rx="2" fill="#ffffff" stroke="#ffffff" stroke-width="2"/><text x="12" y="16" font-family="Arial, sans-serif" font-size="10" font-weight="bold" text-anchor="middle" fill="#1a1a1a">AD</text>',audioDescriptionOn:'<rect x="2" y="5" width="20" height="14" rx="2" fill="none" stroke="currentColor" stroke-width="2"/><text x="12" y="16" font-family="Arial, sans-serif" font-size="10" font-weight="bold" text-anchor="middle" fill="currentColor">AD</text>',signLanguage:'<g transform="scale(1.5)"><path d="M16 11.3c-.1-.9-4.8 1.3-5.4 1.1-2.6-1 5.8-1.3 5.1-2.9s-5.1 1.5-6 1.4C6.5 9.4 16.5 9.1 13.5 8c-1.9-.6-8.8 2.9-6.8.4.7-.6.7-1.9-.7-1.7-9.7 7.2-.7 12.2 8.8 7 0-1.3-3.5.4-4.1.4-2.6 0 5.6-2 5.4-3ZM3.9 7.8c3.2-4.2 3.7 1.2 6 .1s.2-.2.2-.3c.7-2.7 2.5-7.5-1.5-1.3-1.6 0 1.1-4 1-4.6C8.9-1 7.3 4.4 7.2 4.9c-1.6.7-.9-1.4-.7-1.5 3-6-.6-3.1-.9.4-2.5 1.8 0-2.8 0-3.5C2.8-.9 4 9.4 1.1 4.9S.1 4.6 0 5c-.4 2.7 2.6 7.2 3.9 2.8Z"/></g>',signLanguageOn:'<g transform="scale(1.5)"><path d="M16 11.3c-.1-.9-4.8 1.3-5.4 1.1-2.6-1 5.8-1.3 5.1-2.9s-5.1 1.5-6 1.4C6.5 9.4 16.5 9.1 13.5 8c-1.9-.6-8.8 2.9-6.8.4.7-.6.7-1.9-.7-1.7-9.7 7.2-.7 12.2 8.8 7 0-1.3-3.5.4-4.1.4-2.6 0 5.6-2 5.4-3ZM3.9 7.8c3.2-4.2 3.7 1.2 6 .1s.2-.2.2-.3c.7-2.7 2.5-7.5-1.5-1.3-1.6 0 1.1-4 1-4.6C8.9-1 7.3 4.4 7.2 4.9c-1.6.7-.9-1.4-.7-1.5 3-6-.6-3.1-.9.4-2.5 1.8 0-2.8 0-3.5C2.8-.9 4 9.4 1.1 4.9S.1 4.6 0 5c-.4 2.7 2.6 7.2 3.9 2.8Z"/></g>',music:'<path d="M12 3v9.28c-.47-.17-.97-.28-1.5-.28C8.01 12 6 14.01 6 16.5S8.01 21 10.5 21c2.31 0 4.2-1.75 4.45-4H15V6h4V3h-7zm-1.5 16c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"/>',moreVertical:'<path d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/>',move:'<path d="M10 9h4V6h3l-5-5-5 5h3v3zm-1 1H6V7l-5 5 5 5v-3h3v-4zm14 2l-5-5v3h-3v4h3v3l5-5zm-9 3h-4v3H7l5 5 5-5h-3v-3z"/>',resize:'<path d="M21.71 11.29l-9-9c-.39-.39-1.02-.39-1.41 0l-9 9c-.39.39-.39 1.02 0 1.41l9 9c.39.39 1.02.39 1.41 0l9-9c.39-.38.39-1.01 0-1.41zM14 14.5V12h-4v2.5L7 11l3-3.5V10h4V7.5l3 3.5-3 3.5z"/>',clock:'<path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"/><path d="M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"/>'},E=i=>`<svg viewBox="0 0 24 24" fill="currentColor">${i}</svg>`,D=Object.fromEntries(Object.entries(H).map(([i,e])=>[i,E(e)]));function P(i){return D[i]||D.play}function L(i,e=""){let t=document.createElement("span");return t.className=`vidply-icon ${e}`.trim(),t.innerHTML=P(i),t.setAttribute("aria-hidden","true"),t}function W(){let i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("class","vidply-play-overlay"),i.setAttribute("viewBox","0 0 80 80"),i.setAttribute("width","80"),i.setAttribute("height","80"),i.setAttribute("aria-hidden","true"),i.setAttribute("role","presentation"),i.style.cursor="pointer";let e=document.createElementNS("http://www.w3.org/2000/svg","defs"),t=`vidply-play-shadow-${Math.random().toString(36).substr(2,9)}`,s=document.createElementNS("http://www.w3.org/2000/svg","filter");s.setAttribute("id",t),s.setAttribute("x","-50%"),s.setAttribute("y","-50%"),s.setAttribute("width","200%"),s.setAttribute("height","200%");let o=document.createElementNS("http://www.w3.org/2000/svg","feGaussianBlur");o.setAttribute("in","SourceAlpha"),o.setAttribute("stdDeviation","3");let n=document.createElementNS("http://www.w3.org/2000/svg","feOffset");n.setAttribute("dx","0"),n.setAttribute("dy","2"),n.setAttribute("result","offsetblur");let r=document.createElementNS("http://www.w3.org/2000/svg","feComponentTransfer"),c=document.createElementNS("http://www.w3.org/2000/svg","feFuncA");c.setAttribute("type","linear"),c.setAttribute("slope","0.3"),r.appendChild(c);let a=document.createElementNS("http://www.w3.org/2000/svg","feMerge"),u=document.createElementNS("http://www.w3.org/2000/svg","feMergeNode"),h=document.createElementNS("http://www.w3.org/2000/svg","feMergeNode");h.setAttribute("in","SourceGraphic"),a.appendChild(u),a.appendChild(h),s.appendChild(o),s.appendChild(n),s.appendChild(r),s.appendChild(a),e.appendChild(s),i.appendChild(e);let l=document.createElementNS("http://www.w3.org/2000/svg","circle");l.setAttribute("cx","40"),l.setAttribute("cy","40"),l.setAttribute("r","40"),l.setAttribute("fill","rgba(255, 255, 255, 0.95)"),l.setAttribute("filter",`url(#${t})`),l.setAttribute("class","vidply-play-overlay-bg"),i.appendChild(l);let d=document.createElementNS("http://www.w3.org/2000/svg","polygon");return d.setAttribute("points","32,28 32,52 54,40"),d.setAttribute("fill","#0a406e"),d.setAttribute("class","vidply-play-overlay-icon"),i.appendChild(d),i}function b(i,{delay:e=0,preventScroll:t=!0}={}){i&&requestAnimationFrame(()=>{setTimeout(()=>{i&&document.contains(i)&&i.focus({preventScroll:t})},e)})}function X(i,e,t={}){if(!i)return;let s=i.querySelector(e);s&&b(s,t)}var x=class{constructor(e="vidply"){this.namespace=e,this.storage=this.isStorageAvailable()?localStorage:null}isStorageAvailable(){try{let e="__storage_test__";return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch{return!1}}getKey(e){return`${this.namespace}_${e}`}set(e,t){if(!this.storage)return!1;try{let s=this.getKey(e);return this.storage.setItem(s,JSON.stringify(t)),!0}catch(s){return console.warn("Failed to save to localStorage:",s),!1}}get(e,t=null){if(!this.storage)return t;try{let s=this.getKey(e),o=this.storage.getItem(s);return o?JSON.parse(o):t}catch(s){return console.warn("Failed to read from localStorage:",s),t}}remove(e){if(!this.storage)return!1;try{let t=this.getKey(e);return this.storage.removeItem(t),!0}catch(t){return console.warn("Failed to remove from localStorage:",t),!1}}clear(){if(!this.storage)return!1;try{return Object.keys(this.storage).forEach(t=>{t.startsWith(this.namespace)&&this.storage.removeItem(t)}),!0}catch(e){return console.warn("Failed to clear localStorage:",e),!1}}saveTranscriptPreferences(e){return this.set("transcript_preferences",e)}getTranscriptPreferences(){return this.get("transcript_preferences",null)}saveCaptionPreferences(e){return this.set("caption_preferences",e)}getCaptionPreferences(){return this.get("caption_preferences",null)}savePlayerPreferences(e){return this.set("player_preferences",e)}getPlayerPreferences(){return this.get("player_preferences",null)}saveSignLanguagePreferences(e){return this.set("sign_language_preferences",e)}getSignLanguagePreferences(){return this.get("sign_language_preferences",null)}};var R=class{constructor(e,t={}){this.element=e,this.options={dragHandle:null,resizeHandles:[],onDragStart:null,onDrag:null,onDragEnd:null,onResizeStart:null,onResize:null,onResizeEnd:null,constrainToViewport:!0,minWidth:150,minHeight:100,maintainAspectRatio:!1,keyboardDragKey:"d",keyboardResizeKey:"r",keyboardStep:5,keyboardStepLarge:10,maxWidth:null,maxHeight:null,pointerResizeIndicatorText:null,onPointerResizeToggle:null,classPrefix:"draggable",storage:null,storageKey:null,...t},this.isDragging=!1,this.isResizing=!1,this.resizeDirection=null,this.dragOffsetX=0,this.dragOffsetY=0,this.positionOffsetX=0,this.positionOffsetY=0,this.initialMouseX=0,this.initialMouseY=0,this.needsPositionConversion=!1,this.resizeStartX=0,this.resizeStartY=0,this.resizeStartWidth=0,this.resizeStartHeight=0,this.resizeStartLeft=0,this.resizeStartTop=0,this.keyboardDragMode=!1,this.keyboardResizeMode=!1,this.pointerResizeMode=!1,this.manuallyPositioned=!1,this.resizeHandlesManaged=new Map,this.resizeIndicatorElement=null,this.handlers={mousedown:this.onMouseDown.bind(this),mousemove:this.onMouseMove.bind(this),mouseup:this.onMouseUp.bind(this),touchstart:this.onTouchStart.bind(this),touchmove:this.onTouchMove.bind(this),touchend:this.onTouchEnd.bind(this),keydown:this.onKeyDown.bind(this),resizeHandleMousedown:this.onResizeHandleMouseDown.bind(this)},this.init()}hasManagedResizeHandles(){return Array.from(this.resizeHandlesManaged.values()).some(Boolean)}storeOriginalHandleDisplay(e){e.dataset.originalDisplay||(e.dataset.originalDisplay=e.style.display||"")}hideResizeHandle(e){e.style.display="none",e.setAttribute("aria-hidden","true")}showResizeHandle(e){let t=e.dataset.originalDisplay!==void 0?e.dataset.originalDisplay:"";e.style.display=t,e.removeAttribute("aria-hidden")}setManagedHandlesVisible(e){!this.options.resizeHandles||this.options.resizeHandles.length===0||this.options.resizeHandles.forEach(t=>{this.resizeHandlesManaged.get(t)&&(e?this.showResizeHandle(t):this.hideResizeHandle(t))})}init(){let e=this.options.dragHandle||this.element;e.addEventListener("mousedown",this.handlers.mousedown),e.addEventListener("touchstart",this.handlers.touchstart),document.addEventListener("mousemove",this.handlers.mousemove),document.addEventListener("mouseup",this.handlers.mouseup),document.addEventListener("touchmove",this.handlers.touchmove,{passive:!1}),document.addEventListener("touchend",this.handlers.touchend),this.element.addEventListener("keydown",this.handlers.keydown),this.options.resizeHandles&&this.options.resizeHandles.length>0&&this.options.resizeHandles.forEach(t=>{t.addEventListener("mousedown",this.handlers.resizeHandleMousedown),t.addEventListener("touchstart",this.handlers.resizeHandleMousedown);let s=t.dataset.vidplyManagedResize==="true";this.resizeHandlesManaged.set(t,s),s&&(this.storeOriginalHandleDisplay(t),this.hideResizeHandle(t))})}onMouseDown(e){e.target.classList.contains(`${this.options.classPrefix}-resize-handle`)||this.options.onDragStart&&!this.options.onDragStart(e)||(this.startDragging(e.clientX,e.clientY),e.preventDefault())}onTouchStart(e){if(e.target.classList.contains(`${this.options.classPrefix}-resize-handle`)||this.options.onDragStart&&!this.options.onDragStart(e))return;let t=e.touches[0];this.startDragging(t.clientX,t.clientY)}onResizeHandleMouseDown(e){e.preventDefault(),e.stopPropagation();let t=e.target;this.resizeDirection=t.getAttribute("data-direction");let s=e.clientX||e.touches?.[0]?.clientX,o=e.clientY||e.touches?.[0]?.clientY;this.startResizing(s,o)}onMouseMove(e){this.isDragging?(this.drag(e.clientX,e.clientY),e.preventDefault()):this.isResizing&&(this.resize(e.clientX,e.clientY),e.preventDefault())}onTouchMove(e){if(this.isDragging||this.isResizing){let t=e.touches[0];this.isDragging?this.drag(t.clientX,t.clientY):this.resize(t.clientX,t.clientY),e.preventDefault()}}onMouseUp(){this.isDragging?this.stopDragging():this.isResizing&&this.stopResizing()}onTouchEnd(){this.isDragging?this.stopDragging():this.isResizing&&this.stopResizing()}onKeyDown(e){if(e.key.toLowerCase()===this.options.keyboardDragKey.toLowerCase()){e.preventDefault(),this.toggleKeyboardDragMode();return}if(e.key.toLowerCase()===this.options.keyboardResizeKey.toLowerCase()){e.preventDefault(),this.hasManagedResizeHandles()?this.togglePointerResizeMode():this.toggleKeyboardResizeMode();return}if(e.key==="Escape"){if(this.pointerResizeMode){e.preventDefault(),this.disablePointerResizeMode();return}if(this.keyboardDragMode||this.keyboardResizeMode){e.preventDefault(),this.disableKeyboardDragMode(),this.disableKeyboardResizeMode();return}}["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(e.key)&&(this.keyboardDragMode?(e.preventDefault(),e.stopPropagation(),this.keyboardDrag(e.key,e.shiftKey)):this.keyboardResizeMode&&(e.preventDefault(),e.stopPropagation(),this.keyboardResize(e.key,e.shiftKey))),e.key==="Home"&&(this.keyboardDragMode||this.keyboardResizeMode)&&(e.preventDefault(),this.resetPosition())}startDragging(e,t){let s=this.element.getBoundingClientRect(),o=window.getComputedStyle(this.element),n=o.right!=="auto"||o.bottom!=="auto"||o.transform!=="none";if(this.positionOffsetX=0,this.positionOffsetY=0,n){let c,a;if(o.position==="absolute"){let d=(this.element.offsetParent||document.body).getBoundingClientRect();c=s.left-d.left,a=s.top-d.top,this.positionOffsetX=d.left,this.positionOffsetY=d.top}else if(o.position==="fixed"){let l=parseFloat(o.left),d=parseFloat(o.top),f=Number.isFinite(l),g=Number.isFinite(d);c=f?l:s.left,a=g?d:s.top,this.positionOffsetX=s.left-c,this.positionOffsetY=s.top-a}else c=s.left,a=s.top,this.positionOffsetX=s.left-c,this.positionOffsetY=s.top-a;let h=this.element.style.cssText.split(";").filter(l=>{let d=l.trim();if(!d)return!1;let f=d.indexOf(":");if(f===-1)return!1;let g=d.substring(0,f).trim(),z=d.substring(f+1).trim();return!(!z||z===""||g==="right"||g==="bottom"||g==="transform"||g==="left"||g==="top"||g==="inset"||g.startsWith("border-image"))}).join("; ");h&&(h+="; "),h+=`left: ${c}px; top: ${a}px; right: auto; bottom: auto; transform: none`,this.element.style.cssText=h}let r=this.element.getBoundingClientRect();this.dragOffsetX=e-r.left,this.dragOffsetY=t-r.top,this.isDragging=!0,this.element.classList.add(`${this.options.classPrefix}-dragging`),document.body.style.cursor="grabbing",document.body.style.userSelect="none"}drag(e,t){if(!this.isDragging)return;let s=e-this.dragOffsetX-this.positionOffsetX,o=t-this.dragOffsetY-this.positionOffsetY;if(this.options.constrainToViewport){let n=this.element.getBoundingClientRect(),r=document.documentElement.clientWidth,c=document.documentElement.clientHeight,a=100,u=-(n.width-a),h=-(n.height-a),l=r-a,d=c-a;s=Math.max(u,Math.min(s,l)),o=Math.max(h,Math.min(o,d))}this.element.style.left=`${s}px`,this.element.style.top=`${o}px`,this.options.onDrag&&this.options.onDrag({x:s,y:o})}stopDragging(){this.isDragging=!1,this.element.classList.remove(`${this.options.classPrefix}-dragging`),document.body.style.cursor="",document.body.style.userSelect="",this.manuallyPositioned=!0,this.options.onDragEnd&&this.options.onDragEnd()}startResizing(e,t){this.isResizing=!0,this.resizeStartX=e,this.resizeStartY=t;let s=this.element.getBoundingClientRect();this.resizeStartWidth=s.width,this.resizeStartHeight=s.height,this.resizeStartLeft=s.left,this.resizeStartTop=s.top,this.element.classList.add(`${this.options.classPrefix}-resizing`),document.body.style.userSelect="none",this.options.onResizeStart&&this.options.onResizeStart()}resize(e,t){if(!this.isResizing)return;let s=e-this.resizeStartX,o=t-this.resizeStartY,n=this.resizeStartWidth,r=this.resizeStartHeight,c=this.resizeStartLeft,a=this.resizeStartTop;if(this.resizeDirection.includes("e")&&(n=Math.max(this.options.minWidth,this.resizeStartWidth+s)),this.resizeDirection.includes("w")){let h=Math.max(this.options.minWidth,this.resizeStartWidth-s);c=this.resizeStartLeft+(this.resizeStartWidth-h),n=h}let u=typeof this.options.maxWidth=="function"?this.options.maxWidth():this.options.maxWidth;if(Number.isFinite(u)){let h=Math.min(n,u);h!==n&&this.resizeDirection.includes("w")&&(c+=n-h),n=h}if(!this.options.maintainAspectRatio){if(this.resizeDirection.includes("s")&&(r=Math.max(this.options.minHeight,this.resizeStartHeight+o)),this.resizeDirection.includes("n")){let l=Math.max(this.options.minHeight,this.resizeStartHeight-o);a=this.resizeStartTop+(this.resizeStartHeight-l),r=l}let h=typeof this.options.maxHeight=="function"?this.options.maxHeight():this.options.maxHeight;if(Number.isFinite(h)){let l=Math.min(r,h);l!==r&&this.resizeDirection.includes("n")&&(a+=r-l),r=l}}this.element.style.width=`${n}px`,this.options.maintainAspectRatio?this.element.style.height="auto":this.element.style.height=`${r}px`,this.resizeDirection.includes("w")&&(this.element.style.left=`${c}px`),this.resizeDirection.includes("n")&&!this.options.maintainAspectRatio&&(this.element.style.top=`${a}px`),this.options.onResize&&this.options.onResize({width:n,height:r,left:c,top:a})}stopResizing(){this.isResizing=!1,this.resizeDirection=null,this.element.classList.remove(`${this.options.classPrefix}-resizing`),document.body.style.userSelect="",this.manuallyPositioned=!0,this.options.onResizeEnd&&this.options.onResizeEnd()}toggleKeyboardDragMode(){this.keyboardDragMode?this.disableKeyboardDragMode():this.enableKeyboardDragMode()}enableKeyboardDragMode(){this.keyboardDragMode=!0,this.keyboardResizeMode=!1,this.element.classList.add(`${this.options.classPrefix}-keyboard-drag`),this.element.classList.remove(`${this.options.classPrefix}-keyboard-resize`),this.focusElement()}disableKeyboardDragMode(){this.keyboardDragMode=!1,this.element.classList.remove(`${this.options.classPrefix}-keyboard-drag`)}toggleKeyboardResizeMode(){this.keyboardResizeMode?this.disableKeyboardResizeMode():this.enableKeyboardResizeMode()}enableKeyboardResizeMode(){this.keyboardResizeMode=!0,this.keyboardDragMode=!1,this.element.classList.add(`${this.options.classPrefix}-keyboard-resize`),this.element.classList.remove(`${this.options.classPrefix}-keyboard-drag`),this.focusElement()}disableKeyboardResizeMode(){this.keyboardResizeMode=!1,this.element.classList.remove(`${this.options.classPrefix}-keyboard-resize`)}enablePointerResizeMode({focus:e=!0}={}){if(!this.hasManagedResizeHandles()){this.enableKeyboardResizeMode();return}this.pointerResizeMode||(this.pointerResizeMode=!0,this.setManagedHandlesVisible(!0),this.element.classList.add(`${this.options.classPrefix}-resizable`),this.enableKeyboardResizeMode(),e&&this.focusElement(),typeof this.options.onPointerResizeToggle=="function"&&this.options.onPointerResizeToggle(!0))}disablePointerResizeMode({focus:e=!1}={}){this.pointerResizeMode&&(this.pointerResizeMode=!1,this.setManagedHandlesVisible(!1),this.element.classList.remove(`${this.options.classPrefix}-resizable`),this.disableKeyboardResizeMode(),e&&this.focusElement(),typeof this.options.onPointerResizeToggle=="function"&&this.options.onPointerResizeToggle(!1))}togglePointerResizeMode(){return this.pointerResizeMode?this.disablePointerResizeMode():this.enablePointerResizeMode(),this.pointerResizeMode}focusElement(){if(typeof this.element.focus=="function")try{this.element.focus({preventScroll:!0})}catch{this.element.focus()}}keyboardDrag(e,t){let s=t?this.options.keyboardStepLarge:this.options.keyboardStep,o=parseFloat(this.element.style.left)||0,n=parseFloat(this.element.style.top)||0;if(window.getComputedStyle(this.element).transform!=="none"){let u=this.element.getBoundingClientRect();o=u.left,n=u.top,this.element.style.transform="none",this.element.style.left=`${o}px`,this.element.style.top=`${n}px`}let c=o,a=n;switch(e){case"ArrowLeft":c-=s;break;case"ArrowRight":c+=s;break;case"ArrowUp":a-=s;break;case"ArrowDown":a+=s;break}this.element.style.left=`${c}px`,this.element.style.top=`${a}px`,this.options.onDrag&&this.options.onDrag({x:c,y:a})}keyboardResize(e,t){let s=t?this.options.keyboardStepLarge:this.options.keyboardStep,o=this.element.getBoundingClientRect(),n=o.width,r=o.height;switch(e){case"ArrowLeft":n-=s;break;case"ArrowRight":n+=s;break;case"ArrowUp":this.options.maintainAspectRatio?n+=s:r-=s;break;case"ArrowDown":this.options.maintainAspectRatio?n-=s:r+=s;break}n=Math.max(this.options.minWidth,n),r=Math.max(this.options.minHeight,r),this.element.style.width=`${n}px`,this.options.maintainAspectRatio?this.element.style.height="auto":this.element.style.height=`${r}px`,this.options.onResize&&this.options.onResize({width:n,height:r})}resetPosition(){this.element.style.left="50%",this.element.style.top="50%",this.element.style.transform="translate(-50%, -50%)",this.element.style.right="",this.element.style.bottom="",this.manuallyPositioned=!1,this.options.onDrag&&this.options.onDrag({centered:!0})}destroy(){let e=this.options.dragHandle||this.element;this.disablePointerResizeMode(),e.removeEventListener("mousedown",this.handlers.mousedown),e.removeEventListener("touchstart",this.handlers.touchstart),document.removeEventListener("mousemove",this.handlers.mousemove),document.removeEventListener("mouseup",this.handlers.mouseup),document.removeEventListener("touchmove",this.handlers.touchmove),document.removeEventListener("touchend",this.handlers.touchend),this.element.removeEventListener("keydown",this.handlers.keydown),this.options.resizeHandles&&this.options.resizeHandles.length>0&&this.options.resizeHandles.forEach(t=>{t.removeEventListener("mousedown",this.handlers.resizeHandleMousedown),t.removeEventListener("touchstart",this.handlers.resizeHandleMousedown)}),this.element.classList.remove(`${this.options.classPrefix}-dragging`,`${this.options.classPrefix}-resizing`,`${this.options.classPrefix}-keyboard-drag`,`${this.options.classPrefix}-keyboard-resize`)}};function Z({classPrefix:i,itemClass:e,icon:t,label:s,ariaLabel:o,onClick:n,hasTextClass:r=!1}){let c=typeof s=="string"&&(s.startsWith("transcript.")||s.startsWith("player.")||s.startsWith("settings.")),a=o||c&&p.t(s)||s,u=m.createElement("button",{className:e,attributes:{type:"button","aria-label":a,tabindex:"-1"}});t&&u.appendChild(L(t));let l=typeof s=="string"&&(s.startsWith("transcript.")||s.startsWith("player.")||s.startsWith("settings."))&&p.t(s)||s,d=m.createElement("span",{textContent:l,className:r?`${i}-settings-text`:void 0,attributes:{"aria-hidden":"true"}});return u.appendChild(d),n&&u.addEventListener("click",n),u}function G(i,e,t,s){if(!i)return;let o=Array.from(i.querySelectorAll(t));if(o.length===0)return;let n=r=>{let c=o.indexOf(document.activeElement);switch(r.key){case"ArrowDown":r.preventDefault(),r.stopPropagation();let a=(c+1)%o.length;o.forEach((l,d)=>{l.setAttribute("tabindex",d===a?"0":"-1")}),o[a].focus({preventScroll:!1}),o[a].scrollIntoView({behavior:"smooth",block:"nearest"});break;case"ArrowUp":r.preventDefault(),r.stopPropagation();let u=(c-1+o.length)%o.length;o.forEach((l,d)=>{l.setAttribute("tabindex",d===u?"0":"-1")}),o[u].focus({preventScroll:!1}),o[u].scrollIntoView({behavior:"smooth",block:"nearest"});break;case"Home":r.preventDefault(),r.stopPropagation(),o.forEach((l,d)=>{l.setAttribute("tabindex",d===0?"0":"-1")}),o[0].focus({preventScroll:!1}),o[0].scrollIntoView({behavior:"smooth",block:"nearest"});break;case"End":r.preventDefault(),r.stopPropagation();let h=o.length-1;o.forEach((l,d)=>{l.setAttribute("tabindex",d===h?"0":"-1")}),o[h].focus({preventScroll:!1}),o[h].scrollIntoView({behavior:"smooth",block:"nearest"});break;case"Enter":case" ":r.preventDefault(),r.stopPropagation(),document.activeElement&&o.includes(document.activeElement)&&(document.activeElement.click(),s&&setTimeout(()=>{e&&document.contains(e)&&e.focus()},0));break;case"Escape":r.preventDefault(),r.stopPropagation(),s&&s();break}};return i.addEventListener("keydown",n,!0),n}function ee(i,e,t=0){i&&setTimeout(()=>{let s=Array.from(i.querySelectorAll(e));s.length>0&&(s.forEach((o,n)=>{o.setAttribute("tabindex",n===0?"0":"-1")}),b(s[0],{delay:0}),s[0].scrollIntoView({behavior:"smooth",block:"nearest"}))},t)}function oe({classPrefix:i,labelClass:e,selectClass:t,labelText:s,selectId:o,hidden:n=!1,onChange:r=null,options:c=[]}){let u=typeof s=="string"&&(s.startsWith("transcript.")||s.startsWith("player.")||s.startsWith("settings.")||s.startsWith("captions."))&&p.t(s)||s,h=m.createElement("label",{className:e,textContent:u,attributes:{for:o,style:n?"display: none;":void 0}}),l=m.createElement("select",{className:t,attributes:{id:o,style:n?"display: none;":void 0}});return c.forEach(d=>{let f=m.createElement("option",{textContent:d.text,attributes:{value:d.value,selected:d.selected?"selected":void 0}});l.appendChild(f)}),r&&l.addEventListener("change",r),{label:h,select:l}}function ne(i){i&&["mousedown","click"].forEach(e=>{i.addEventListener(e,t=>{t.stopPropagation()})})}export{m as a,p as b,K as c,L as d,W as e,b as f,X as g,x as h,R as i,Z as j,G as k,ee as l,oe as m,ne as n};
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * Universal, Accessible Video Player
3
+ * (c) 2025 Matthias Peltzer
4
+ * Released under GPL-2.0-or-later License
5
+ */
6
+ var m={createElement(i,e={}){let t=document.createElement(i);return e.className&&(t.className=e.className),e.attributes&&Object.entries(e.attributes).forEach(([s,o])=>{t.setAttribute(s,o)}),e.innerHTML&&(t.innerHTML=e.innerHTML),e.textContent&&(t.textContent=e.textContent),e.style&&Object.assign(t.style,e.style),e.children&&e.children.forEach(s=>{s&&t.appendChild(s)}),t},addClass(i,e){i&&e&&i.classList.add(e)},removeClass(i,e){i&&e&&i.classList.remove(e)},toggleClass(i,e){i&&e&&i.classList.toggle(e)},hasClass(i,e){return i&&i.classList.contains(e)},show(i){i&&(i.style.display="")},hide(i){i&&(i.style.display="none")},fadeIn(i,e=300){if(!i)return;i.style.opacity="0",i.style.display="";let t=null,s=o=>{t||(t=o);let n=o-t,r=Math.min(n/e,1);i.style.opacity=r,n<e&&requestAnimationFrame(s)};requestAnimationFrame(s)},fadeOut(i,e=300){if(!i)return;let t=parseFloat(getComputedStyle(i).opacity)||1,s=null,o=n=>{s||(s=n);let r=n-s,c=Math.max(t-r/e,0);i.style.opacity=c,r<e?requestAnimationFrame(o):i.style.display="none"};requestAnimationFrame(o)},offset(i){if(!i)return{top:0,left:0};let e=i.getBoundingClientRect();return{top:e.top+window.pageYOffset,left:e.left+window.pageXOffset,width:e.width,height:e.height}},escapeHTML(i){let e=document.createElement("div");return e.textContent=i,e.innerHTML},sanitizeHTML(i){let e=document.createElement("div"),t=i.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"").replace(/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi,"").replace(/on\w+\s*=/gi,"").replace(/javascript:/gi,"");return e.innerHTML=t,e.innerHTML},createTooltip(i,e="vidply"){return this.createElement("span",{className:`${e}-tooltip`,textContent:i,attributes:{"aria-hidden":"true"}})},attachTooltip(i,e,t="vidply"){if(!i||!e)return;let s=i.querySelector(`.${t}-tooltip`);s&&s.remove();let o=this.createTooltip(e,t);i.appendChild(o);let n=()=>{o.classList.add(`${t}-tooltip-visible`)},r=()=>{o.classList.remove(`${t}-tooltip-visible`)};i.addEventListener("mouseenter",n),i.addEventListener("mouseleave",r),i.addEventListener("focus",n),i.addEventListener("blur",r)},createButtonText(i,e="vidply"){return this.createElement("span",{className:`${e}-button-text`,textContent:i,attributes:{"aria-hidden":"true"}})}};var w={player:{label:"Video Player",play:"Play",pause:"Pause",stop:"Stop",restart:"Restart from beginning",rewind:"Rewind",forward:"Forward",rewindSeconds:"Rewind {seconds} seconds",forwardSeconds:"Forward {seconds} seconds",previous:"Previous track",next:"Next track",playlist:"Toggle playlist",volume:"Volume",mute:"Mute",unmute:"Unmute",fullscreen:"Fullscreen",exitFullscreen:"Exit Fullscreen",captions:"Captions",chapters:"Chapters",quality:"Quality",captionStyling:"Caption styling",transcript:"Toggle transcript",audioDescription:"Audio description",signLanguage:"Sign language video",settings:"Settings",speed:"Playback Speed",pip:"Picture in Picture",currentTime:"Current time",duration:"Duration",progress:"Progress",seekForward:"Seek forward {seconds} seconds",seekBackward:"Seek backward {seconds} seconds",volumeUp:"Volume up",volumeDown:"Volume down",loading:"Loading...",loadingChapters:"Loading chapters...",error:"Error loading media",buffering:"Buffering...",signLanguageVideo:"Sign Language Video",closeSignLanguage:"Close sign language video",signLanguageSettings:"Sign language settings",noChapters:"No chapters available",noCaptions:"No captions available",auto:"Auto",autoQuality:"Auto (no quality selection available)",noQuality:"Quality selection not available",signLanguageDragResize:"Sign Language Video - Press D to drag with keyboard, R to resize",signLanguageDragActive:"Sign Language Video - Drag mode active. Use arrow keys to move, Escape to exit.",signLanguageResizeActive:"Sign Language Video - Resize mode active. Use left/right arrow keys to resize, Escape to exit.",enableSignDragMode:"Enable drag mode. Shortcut: D key",disableSignDragMode:"Disable drag mode. Shortcut: D key",enableSignDragModeAria:"Enable toggle keyboard drag mode with arrow keys. Shortcut: D key",disableSignDragModeAria:"Disable toggle keyboard drag mode with arrow keys. Shortcut: D key",enableSignResizeMode:"Enable resize mode. Shortcut: R key",disableSignResizeMode:"Disable resize mode. Shortcut: R key",enableSignResizeModeAria:"Enable keyboard resize mode with arrow keys. Shortcut: R key",disableSignResizeModeAria:"Disable keyboard resize mode with arrow keys. Shortcut: R key",resizeHandle:"Resize {direction} corner",moreOptions:"More options",noMoreOptions:"No additional options available"},captions:{off:"Off",select:"Select captions",fontSize:"Font Size",fontFamily:"Font Family",color:"Text Color",backgroundColor:"Background Color",opacity:"Opacity"},fontSizes:{small:"Small",normal:"Normal",large:"Large",xlarge:"X-Large"},fontFamilies:{sansSerif:"Sans-serif",serif:"Serif",monospace:"Monospace"},styleLabels:{textColor:"Text Color",background:"Background",font:"Font",fontSize:"Font Size",opacity:"Opacity"},audioDescription:{enable:"Enable audio description",disable:"Disable audio description"},signLanguage:{show:"Show sign language video",hide:"Hide sign language video"},transcript:{title:"Transcript",close:"Close transcript",loading:"Loading transcript...",noTranscript:"No transcript available for this video.",settings:"Transcript settings. Press Enter to open menu, or D to enable drag mode",keyboardDragMode:"Toggle keyboard drag mode with arrow keys. Shortcut: D key",keyboardDragActive:"⌨️ Keyboard Drag Mode Active (Arrow keys to move, Shift+Arrows for large steps, D or ESC to exit)",dragResizePrompt:"Press D to drag or R to resize. Use Home to reset position, Esc to close.",dragModeEnabled:"Keyboard drag mode enabled. Use arrow keys to move, Shift+Arrow for larger steps. Press D or Esc to exit.",dragModeDisabled:"Keyboard drag mode disabled.",enableDragMode:"Enable drag mode. Shortcut: D key",disableDragMode:"Disable drag mode. Shortcut: D key",enableDragModeAria:"Enable toggle keyboard drag mode with arrow keys. Shortcut: D key",disableDragModeAria:"Disable toggle keyboard drag mode with arrow keys. Shortcut: D key",resizeWindow:"Resize Window",disableResizeWindow:"Disable Resize Mode",enableResizeMode:"Enable resize mode. Shortcut: R key",disableResizeMode:"Disable resize mode. Shortcut: R key",enableResizeModeAria:"Enable keyboard resize mode with arrow keys. Shortcut: R key",disableResizeModeAria:"Disable keyboard resize mode with arrow keys. Shortcut: R key",resizeModeHint:"Resize handles enabled. Drag edges or corners to adjust. Press Esc or R to exit.",resizeModeEnabled:"Resize mode enabled. Drag edges or corners to adjust. Press Esc or R to exit.",resizeModeDisabled:"Resize mode disabled.",positionReset:"Transcript position reset.",styleTranscript:"Open transcript style settings",closeMenu:"Close Menu",styleTitle:"Transcript Style",autoscroll:"Autoscroll",settingsMenu:"Transcript dialog settings",showTimestamps:"Show timestamps",hideTimestamps:"Hide timestamps",showTimestampsAria:"Show timestamps in transcript",hideTimestampsAria:"Hide timestamps in transcript"},settings:{title:"Settings",quality:"Quality",speed:"Speed",captions:"Captions",language:"Language",reset:"Reset to defaults",close:"Close"},speeds:{normal:"Normal"},time:{display:"Time display",durationPrefix:"Duration: ",of:"of",hour:"{count} hour",hours:"{count} hours",minute:"{count} minute",minutes:"{count} minutes",second:"{count} second",seconds:"{count} seconds"},playlist:{title:"Playlist",trackOf:"Track {current} of {total}",nowPlaying:"Now playing: Track {current} of {total}. {title}{artist}",by:" by ",untitled:"Untitled",trackUntitled:"Track {number}",currentlyPlaying:"Currently playing",notPlaying:"Not playing",pressEnterPlay:"Press Enter to play",pressEnterRestart:"Press Enter to restart",keyboardInstructions:"Playlist navigation: Use Up and Down arrow keys to move between tracks. Press Page Up or Page Down to skip 5 tracks. Press Home to go to first track, End to go to last track. Press Enter or Space to play the selected track."}};var M={de:()=>import("./vidply.de-HGJBCLLE.min.js"),es:()=>import("./vidply.es-CZEBXCZN.min.js"),fr:()=>import("./vidply.fr-HFOL7MWA.min.js"),ja:()=>import("./vidply.ja-QTVU5C25.min.js")};function y(){return{en:w}}function S(){return M}async function k(i){let e=M[i];if(!e)return null;let t=await e();return t[i]||t.default||null}var V=y();var v=class{constructor(){this.currentLanguage="en",this.translations=y(),this.loadingPromises=new Map,this.builtInLanguageLoaders=S()}setLanguage(e){this.translations[e]?this.currentLanguage=e:(console.warn(`Language "${e}" not found, falling back to English`),this.currentLanguage="en")}getLanguage(){return this.currentLanguage}async ensureLanguage(e){let t=(e||"").toLowerCase();if(!t)return this.currentLanguage;if(this.translations[t])return t;if(this.loadingPromises.has(t))return await this.loadingPromises.get(t),this.translations[t]?t:null;if(!this.builtInLanguageLoaders[t])return null;let s=(async()=>{try{let o=await k(t);o&&(this.translations[t]=o)}catch(o){console.warn(`Language "${t}" failed to load:`,o)}finally{this.loadingPromises.delete(t)}})();return this.loadingPromises.set(t,s),await s,this.translations[t]?t:null}t(e,t={}){let s=e.split("."),o=this.translations[this.currentLanguage];for(let n of s)if(o&&typeof o=="object"&&n in o)o=o[n];else{o=this.translations.en;for(let r of s)if(o&&typeof o=="object"&&r in o)o=o[r];else return e;break}return typeof o=="string"&&Object.entries(t).forEach(([n,r])=>{o=o.replace(new RegExp(`{${n}}`,"g"),r)}),o}addTranslation(e,t){this.translations[e]||(this.translations[e]={}),Object.assign(this.translations[e],t)}async loadLanguageFromUrl(e,t){if(this.loadingPromises.has(t))return this.loadingPromises.get(t);let s=(async()=>{try{let o=await fetch(t);if(!o.ok)throw new Error(`Failed to load language file: ${o.statusText}`);let n=o.headers.get("content-type")||"",r,c=await o.arrayBuffer(),a=new TextDecoder("utf-8").decode(c);if(n.includes("application/json")||t.endsWith(".json"))r=JSON.parse(a);else if(n.includes("text/yaml")||n.includes("application/x-yaml")||t.endsWith(".yaml")||t.endsWith(".yml"))try{r=JSON.parse(a)}catch{if(typeof window<"u"&&window.jsyaml)r=window.jsyaml.load(a);else throw console.warn("YAML parsing requires js-yaml library. Please include it or use JSON format."),new Error("YAML parsing not available. Please use JSON format or include js-yaml library.")}else r=JSON.parse(a);return this.addTranslation(e,r),r}catch(o){throw console.error(`Error loading language file from ${t}:`,o),o}finally{this.loadingPromises.delete(t)}})();return this.loadingPromises.set(t,s),s}async loadLanguagesFromUrls(e){let t=Object.entries(e).map(([s,o])=>this.loadLanguageFromUrl(s,o));await Promise.all(t)}},p=new v;var F={formatTime(i,e=!1){if(!isFinite(i)||i<0)return e?"00:00:00":"00:00";let t=Math.floor(i/3600),s=Math.floor(i%3600/60),o=Math.floor(i%60),n=r=>String(r).padStart(2,"0");return t>0||e?`${n(t)}:${n(s)}:${n(o)}`:`${n(s)}:${n(o)}`},parseTime(i){let e=i.split(":").map(t=>parseInt(t,10));return e.length===3?e[0]*3600+e[1]*60+e[2]:e.length===2?e[0]*60+e[1]:e.length===1?e[0]:0},formatDuration(i){if(!isFinite(i)||i<0)return p.t("time.seconds",{count:0});let e=Math.floor(i/3600),t=Math.floor(i%3600/60),s=Math.floor(i%60),o=[];if(e>0){let n=e===1?"time.hour":"time.hours";o.push(p.t(n,{count:e}))}if(t>0){let n=t===1?"time.minute":"time.minutes";o.push(p.t(n,{count:t}))}if(s>0||o.length===0){let n=s===1?"time.second":"time.seconds";o.push(p.t(n,{count:s}))}return o.join(", ")},formatPercentage(i,e){return e===0?0:Math.round(i/e*100)}};var H={play:'<path d="M8 5v14l11-7z"/>',pause:'<path d="M6 4h4v16H6V4zm8 0h4v16h-4V4z"/>',stop:'<rect x="6" y="6" width="12" height="12"/>',rewind:'<path d="M11 18V6l-8.5 6 8.5 6zm.5-6l8.5 6V6l-8.5 6z"/>',forward:'<path d="M4 18l8.5-6L4 6v12zm9-12v12l8.5-6L13 6z"/>',skipPrevious:'<path d="M6 6h2v12H6V6zm3 6l8.5 6V6L9 12z"/>',skipNext:'<path d="M16 6h2v12h-2V6zM6 6l8.5 6L6 18V6z"/>',restart:'<path d="M12 5V1L7 6l5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6H4c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8z"/>',volumeHigh:'<path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"/>',volumeMedium:'<path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02z"/>',volumeLow:'<path d="M7 9v6h4l5 5V4l-5 5H7z"/>',volumeMuted:'<path d="M16.5 12c0-1.77-1.02-3.29-2.5-4.03v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51C20.63 14.91 21 13.5 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3L3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06c1.38-.31 2.63-.95 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4L9.91 6.09 12 8.18V4z"/>',fullscreen:'<path d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/>',fullscreenExit:'<path d="M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"/>',settings:'<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-.94L14.4 2.81c-.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"/>',captions:'<path d="M19 4H5c-1.11 0-2 .9-2 2v12c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-8 7H9.5v-.5h-2v3h2V13H11v1c0 .55-.45 1-1 1H7c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v1zm7 0h-1.5v-.5h-2v3h2V13H18v1c0 .55-.45 1-1 1h-3c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v1z"/>',captionsOff:'<path d="M19 4H5c-1.11 0-2 .9-2 2v12c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-8 7H9.5v-.5h-2v3h2V13H11v1c0 .55-.45 1-1 1H7c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v1zm7 0h-1.5v-.5h-2v3h2V13H18v1c0 .55-.45 1-1 1h-3c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1h3c.55 0 1 .45 1 1v1z"/><path d="M0 0h24v24H0z" fill="none"/>',pip:'<path d="M19 7h-8v6h8V7zm2-4H3c-1.1 0-2 .9-2 2v14c0 1.1.9 1.98 2 1.98h18c1.1 0 2-.88 2-1.98V5c0-1.1-.9-2-2-2zm0 16.01H3V4.98h18v14.03z"/>',speed:'<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.44z"/><path d="M10.59 15.41a2 2 0 0 0 2.83 0l5.66-8.49-8.49 5.66a2 2 0 0 0 0 2.83z"/>',close:'<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>',check:'<path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/>',loading:'<path d="M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3z"/>',error:'<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"/>',playlist:'<path d="M15 6H3v2h12V6zm0 4H3v2h12v-2zM3 16h8v-2H3v2zM17 6v8.18c-.31-.11-.65-.18-1-.18-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3V8h3V6h-5z"/>',hd:'<path d="M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-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"/>',transcript:'<path d="M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 16H8v-2h8v2zm0-4H8v-2h8v2zm-3-5V3.5L18.5 9H13z"/>',chapters:'<path d="M3 5h2v2H3V5zm0 4h2v2H3V9zm0 4h2v2H3v-2zm0 4h2v2H3v-2zM7 5h14v2H7V5zm0 4h14v2H7V9zm0 4h14v2H7v-2zm0 4h14v2H7v-2z"/>',audioDescription:'<rect x="2" y="5" width="20" height="14" rx="2" fill="#ffffff" stroke="#ffffff" stroke-width="2"/><text x="12" y="16" font-family="Arial, sans-serif" font-size="10" font-weight="bold" text-anchor="middle" fill="#1a1a1a">AD</text>',audioDescriptionOn:'<rect x="2" y="5" width="20" height="14" rx="2" fill="none" stroke="currentColor" stroke-width="2"/><text x="12" y="16" font-family="Arial, sans-serif" font-size="10" font-weight="bold" text-anchor="middle" fill="currentColor">AD</text>',signLanguage:'<g transform="scale(1.5)"><path d="M16 11.3c-.1-.9-4.8 1.3-5.4 1.1-2.6-1 5.8-1.3 5.1-2.9s-5.1 1.5-6 1.4C6.5 9.4 16.5 9.1 13.5 8c-1.9-.6-8.8 2.9-6.8.4.7-.6.7-1.9-.7-1.7-9.7 7.2-.7 12.2 8.8 7 0-1.3-3.5.4-4.1.4-2.6 0 5.6-2 5.4-3ZM3.9 7.8c3.2-4.2 3.7 1.2 6 .1s.2-.2.2-.3c.7-2.7 2.5-7.5-1.5-1.3-1.6 0 1.1-4 1-4.6C8.9-1 7.3 4.4 7.2 4.9c-1.6.7-.9-1.4-.7-1.5 3-6-.6-3.1-.9.4-2.5 1.8 0-2.8 0-3.5C2.8-.9 4 9.4 1.1 4.9S.1 4.6 0 5c-.4 2.7 2.6 7.2 3.9 2.8Z"/></g>',signLanguageOn:'<g transform="scale(1.5)"><path d="M16 11.3c-.1-.9-4.8 1.3-5.4 1.1-2.6-1 5.8-1.3 5.1-2.9s-5.1 1.5-6 1.4C6.5 9.4 16.5 9.1 13.5 8c-1.9-.6-8.8 2.9-6.8.4.7-.6.7-1.9-.7-1.7-9.7 7.2-.7 12.2 8.8 7 0-1.3-3.5.4-4.1.4-2.6 0 5.6-2 5.4-3ZM3.9 7.8c3.2-4.2 3.7 1.2 6 .1s.2-.2.2-.3c.7-2.7 2.5-7.5-1.5-1.3-1.6 0 1.1-4 1-4.6C8.9-1 7.3 4.4 7.2 4.9c-1.6.7-.9-1.4-.7-1.5 3-6-.6-3.1-.9.4-2.5 1.8 0-2.8 0-3.5C2.8-.9 4 9.4 1.1 4.9S.1 4.6 0 5c-.4 2.7 2.6 7.2 3.9 2.8Z"/></g>',music:'<path d="M12 3v9.28c-.47-.17-.97-.28-1.5-.28C8.01 12 6 14.01 6 16.5S8.01 21 10.5 21c2.31 0 4.2-1.75 4.45-4H15V6h4V3h-7zm-1.5 16c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"/>',moreVertical:'<path d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/>',move:'<path d="M10 9h4V6h3l-5-5-5 5h3v3zm-1 1H6V7l-5 5 5 5v-3h3v-4zm14 2l-5-5v3h-3v4h3v3l5-5zm-9 3h-4v3H7l5 5 5-5h-3v-3z"/>',resize:'<path d="M21.71 11.29l-9-9c-.39-.39-1.02-.39-1.41 0l-9 9c-.39.39-.39 1.02 0 1.41l9 9c.39.39 1.02.39 1.41 0l9-9c.39-.38.39-1.01 0-1.41zM14 14.5V12h-4v2.5L7 11l3-3.5V10h4V7.5l3 3.5-3 3.5z"/>',clock:'<path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"/><path d="M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"/>'},E=i=>`<svg viewBox="0 0 24 24" fill="currentColor">${i}</svg>`,D=Object.fromEntries(Object.entries(H).map(([i,e])=>[i,E(e)]));function P(i){return D[i]||D.play}function L(i,e=""){let t=document.createElement("span");return t.className=`vidply-icon ${e}`.trim(),t.innerHTML=P(i),t.setAttribute("aria-hidden","true"),t}function W(){let i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.setAttribute("class","vidply-play-overlay"),i.setAttribute("viewBox","0 0 80 80"),i.setAttribute("width","80"),i.setAttribute("height","80"),i.setAttribute("aria-hidden","true"),i.setAttribute("role","presentation"),i.style.cursor="pointer";let e=document.createElementNS("http://www.w3.org/2000/svg","defs"),t=`vidply-play-shadow-${Math.random().toString(36).substr(2,9)}`,s=document.createElementNS("http://www.w3.org/2000/svg","filter");s.setAttribute("id",t),s.setAttribute("x","-50%"),s.setAttribute("y","-50%"),s.setAttribute("width","200%"),s.setAttribute("height","200%");let o=document.createElementNS("http://www.w3.org/2000/svg","feGaussianBlur");o.setAttribute("in","SourceAlpha"),o.setAttribute("stdDeviation","3");let n=document.createElementNS("http://www.w3.org/2000/svg","feOffset");n.setAttribute("dx","0"),n.setAttribute("dy","2"),n.setAttribute("result","offsetblur");let r=document.createElementNS("http://www.w3.org/2000/svg","feComponentTransfer"),c=document.createElementNS("http://www.w3.org/2000/svg","feFuncA");c.setAttribute("type","linear"),c.setAttribute("slope","0.3"),r.appendChild(c);let a=document.createElementNS("http://www.w3.org/2000/svg","feMerge"),u=document.createElementNS("http://www.w3.org/2000/svg","feMergeNode"),d=document.createElementNS("http://www.w3.org/2000/svg","feMergeNode");d.setAttribute("in","SourceGraphic"),a.appendChild(u),a.appendChild(d),s.appendChild(o),s.appendChild(n),s.appendChild(r),s.appendChild(a),e.appendChild(s),i.appendChild(e);let l=document.createElementNS("http://www.w3.org/2000/svg","circle");l.setAttribute("cx","40"),l.setAttribute("cy","40"),l.setAttribute("r","40"),l.setAttribute("fill","rgba(255, 255, 255, 0.95)"),l.setAttribute("filter",`url(#${t})`),l.setAttribute("class","vidply-play-overlay-bg"),i.appendChild(l);let h=document.createElementNS("http://www.w3.org/2000/svg","polygon");return h.setAttribute("points","32,28 32,52 54,40"),h.setAttribute("fill","#0a406e"),h.setAttribute("class","vidply-play-overlay-icon"),i.appendChild(h),i}function b(i,{delay:e=0,preventScroll:t=!0}={}){i&&requestAnimationFrame(()=>{setTimeout(()=>{i&&document.contains(i)&&i.focus({preventScroll:t})},e)})}function X(i,e,t={}){if(!i)return;let s=i.querySelector(e);s&&b(s,t)}var x=class{constructor(e="vidply"){this.namespace=e,this.storage=this.isStorageAvailable()?localStorage:null}isStorageAvailable(){try{let e="__storage_test__";return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch{return!1}}getKey(e){return`${this.namespace}_${e}`}set(e,t){if(!this.storage)return!1;try{let s=this.getKey(e);return this.storage.setItem(s,JSON.stringify(t)),!0}catch(s){return console.warn("Failed to save to localStorage:",s),!1}}get(e,t=null){if(!this.storage)return t;try{let s=this.getKey(e),o=this.storage.getItem(s);return o?JSON.parse(o):t}catch(s){return console.warn("Failed to read from localStorage:",s),t}}remove(e){if(!this.storage)return!1;try{let t=this.getKey(e);return this.storage.removeItem(t),!0}catch(t){return console.warn("Failed to remove from localStorage:",t),!1}}clear(){if(!this.storage)return!1;try{return Object.keys(this.storage).forEach(t=>{t.startsWith(this.namespace)&&this.storage.removeItem(t)}),!0}catch(e){return console.warn("Failed to clear localStorage:",e),!1}}saveTranscriptPreferences(e){return this.set("transcript_preferences",e)}getTranscriptPreferences(){return this.get("transcript_preferences",null)}saveCaptionPreferences(e){return this.set("caption_preferences",e)}getCaptionPreferences(){return this.get("caption_preferences",null)}savePlayerPreferences(e){return this.set("player_preferences",e)}getPlayerPreferences(){return this.get("player_preferences",null)}saveSignLanguagePreferences(e){return this.set("sign_language_preferences",e)}getSignLanguagePreferences(){return this.get("sign_language_preferences",null)}};var R=class{constructor(e,t={}){this.element=e,this.options={dragHandle:null,resizeHandles:[],onDragStart:null,onDrag:null,onDragEnd:null,onResizeStart:null,onResize:null,onResizeEnd:null,constrainToViewport:!0,minWidth:150,minHeight:100,maintainAspectRatio:!1,keyboardDragKey:"d",keyboardResizeKey:"r",keyboardStep:5,keyboardStepLarge:10,maxWidth:null,maxHeight:null,pointerResizeIndicatorText:null,onPointerResizeToggle:null,classPrefix:"draggable",storage:null,storageKey:null,...t},this.isDragging=!1,this.isResizing=!1,this.resizeDirection=null,this.dragOffsetX=0,this.dragOffsetY=0,this.positionOffsetX=0,this.positionOffsetY=0,this.initialMouseX=0,this.initialMouseY=0,this.needsPositionConversion=!1,this.resizeStartX=0,this.resizeStartY=0,this.resizeStartWidth=0,this.resizeStartHeight=0,this.resizeStartLeft=0,this.resizeStartTop=0,this.keyboardDragMode=!1,this.keyboardResizeMode=!1,this.pointerResizeMode=!1,this.manuallyPositioned=!1,this.resizeHandlesManaged=new Map,this.resizeIndicatorElement=null,this.handlers={mousedown:this.onMouseDown.bind(this),mousemove:this.onMouseMove.bind(this),mouseup:this.onMouseUp.bind(this),touchstart:this.onTouchStart.bind(this),touchmove:this.onTouchMove.bind(this),touchend:this.onTouchEnd.bind(this),keydown:this.onKeyDown.bind(this),resizeHandleMousedown:this.onResizeHandleMouseDown.bind(this)},this.init()}hasManagedResizeHandles(){return Array.from(this.resizeHandlesManaged.values()).some(Boolean)}storeOriginalHandleDisplay(e){e.dataset.originalDisplay||(e.dataset.originalDisplay=e.style.display||"")}hideResizeHandle(e){e.style.display="none",e.setAttribute("aria-hidden","true")}showResizeHandle(e){let t=e.dataset.originalDisplay!==void 0?e.dataset.originalDisplay:"";e.style.display=t,e.removeAttribute("aria-hidden")}setManagedHandlesVisible(e){!this.options.resizeHandles||this.options.resizeHandles.length===0||this.options.resizeHandles.forEach(t=>{this.resizeHandlesManaged.get(t)&&(e?this.showResizeHandle(t):this.hideResizeHandle(t))})}init(){let e=this.options.dragHandle||this.element;e.addEventListener("mousedown",this.handlers.mousedown),e.addEventListener("touchstart",this.handlers.touchstart),document.addEventListener("mousemove",this.handlers.mousemove),document.addEventListener("mouseup",this.handlers.mouseup),document.addEventListener("touchmove",this.handlers.touchmove,{passive:!1}),document.addEventListener("touchend",this.handlers.touchend),this.element.addEventListener("keydown",this.handlers.keydown),this.options.resizeHandles&&this.options.resizeHandles.length>0&&this.options.resizeHandles.forEach(t=>{t.addEventListener("mousedown",this.handlers.resizeHandleMousedown),t.addEventListener("touchstart",this.handlers.resizeHandleMousedown);let s=t.dataset.vidplyManagedResize==="true";this.resizeHandlesManaged.set(t,s),s&&(this.storeOriginalHandleDisplay(t),this.hideResizeHandle(t))})}onMouseDown(e){e.target.classList.contains(`${this.options.classPrefix}-resize-handle`)||this.options.onDragStart&&!this.options.onDragStart(e)||(this.startDragging(e.clientX,e.clientY),e.preventDefault())}onTouchStart(e){if(e.target.classList.contains(`${this.options.classPrefix}-resize-handle`)||this.options.onDragStart&&!this.options.onDragStart(e))return;let t=e.touches[0];this.startDragging(t.clientX,t.clientY)}onResizeHandleMouseDown(e){e.preventDefault(),e.stopPropagation();let t=e.target;this.resizeDirection=t.getAttribute("data-direction");let s=e.clientX||e.touches?.[0]?.clientX,o=e.clientY||e.touches?.[0]?.clientY;this.startResizing(s,o)}onMouseMove(e){this.isDragging?(this.drag(e.clientX,e.clientY),e.preventDefault()):this.isResizing&&(this.resize(e.clientX,e.clientY),e.preventDefault())}onTouchMove(e){if(this.isDragging||this.isResizing){let t=e.touches[0];this.isDragging?this.drag(t.clientX,t.clientY):this.resize(t.clientX,t.clientY),e.preventDefault()}}onMouseUp(){this.isDragging?this.stopDragging():this.isResizing&&this.stopResizing()}onTouchEnd(){this.isDragging?this.stopDragging():this.isResizing&&this.stopResizing()}onKeyDown(e){if(e.key.toLowerCase()===this.options.keyboardDragKey.toLowerCase()){e.preventDefault(),this.toggleKeyboardDragMode();return}if(e.key.toLowerCase()===this.options.keyboardResizeKey.toLowerCase()){e.preventDefault(),this.hasManagedResizeHandles()?this.togglePointerResizeMode():this.toggleKeyboardResizeMode();return}if(e.key==="Escape"){if(this.pointerResizeMode){e.preventDefault(),this.disablePointerResizeMode();return}if(this.keyboardDragMode||this.keyboardResizeMode){e.preventDefault(),this.disableKeyboardDragMode(),this.disableKeyboardResizeMode();return}}["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(e.key)&&(this.keyboardDragMode?(e.preventDefault(),e.stopPropagation(),this.keyboardDrag(e.key,e.shiftKey)):this.keyboardResizeMode&&(e.preventDefault(),e.stopPropagation(),this.keyboardResize(e.key,e.shiftKey))),e.key==="Home"&&(this.keyboardDragMode||this.keyboardResizeMode)&&(e.preventDefault(),this.resetPosition())}startDragging(e,t){let s=this.element.getBoundingClientRect(),o=window.getComputedStyle(this.element),n=o.right!=="auto"||o.bottom!=="auto"||o.transform!=="none";if(this.positionOffsetX=0,this.positionOffsetY=0,n){let c,a;if(o.position==="absolute"){let h=(this.element.offsetParent||document.body).getBoundingClientRect();c=s.left-h.left,a=s.top-h.top,this.positionOffsetX=h.left,this.positionOffsetY=h.top}else if(o.position==="fixed"){let l=parseFloat(o.left),h=parseFloat(o.top),f=Number.isFinite(l),g=Number.isFinite(h);c=f?l:s.left,a=g?h:s.top,this.positionOffsetX=s.left-c,this.positionOffsetY=s.top-a}else c=s.left,a=s.top,this.positionOffsetX=s.left-c,this.positionOffsetY=s.top-a;let d=this.element.style.cssText.split(";").filter(l=>{let h=l.trim();if(!h)return!1;let f=h.indexOf(":");if(f===-1)return!1;let g=h.substring(0,f).trim(),z=h.substring(f+1).trim();return!(!z||z===""||g==="right"||g==="bottom"||g==="transform"||g==="left"||g==="top"||g==="inset"||g.startsWith("border-image"))}).join("; ");d&&(d+="; "),d+=`left: ${c}px; top: ${a}px; right: auto; bottom: auto; transform: none`,this.element.style.cssText=d}let r=this.element.getBoundingClientRect();this.dragOffsetX=e-r.left,this.dragOffsetY=t-r.top,this.isDragging=!0,this.element.classList.add(`${this.options.classPrefix}-dragging`),document.body.style.cursor="grabbing",document.body.style.userSelect="none"}drag(e,t){if(!this.isDragging)return;let s=e-this.dragOffsetX-this.positionOffsetX,o=t-this.dragOffsetY-this.positionOffsetY;if(this.options.constrainToViewport){let n=this.element.getBoundingClientRect(),r=document.documentElement.clientWidth,c=document.documentElement.clientHeight,a=100,u=-(n.width-a),d=-(n.height-a),l=r-a,h=c-a;s=Math.max(u,Math.min(s,l)),o=Math.max(d,Math.min(o,h))}this.element.style.left=`${s}px`,this.element.style.top=`${o}px`,this.options.onDrag&&this.options.onDrag({x:s,y:o})}stopDragging(){this.isDragging=!1,this.element.classList.remove(`${this.options.classPrefix}-dragging`),document.body.style.cursor="",document.body.style.userSelect="",this.manuallyPositioned=!0,this.options.onDragEnd&&this.options.onDragEnd()}startResizing(e,t){this.isResizing=!0,this.resizeStartX=e,this.resizeStartY=t;let s=this.element.getBoundingClientRect();this.resizeStartWidth=s.width,this.resizeStartHeight=s.height,this.resizeStartLeft=s.left,this.resizeStartTop=s.top,this.element.classList.add(`${this.options.classPrefix}-resizing`),document.body.style.userSelect="none",this.options.onResizeStart&&this.options.onResizeStart()}resize(e,t){if(!this.isResizing)return;let s=e-this.resizeStartX,o=t-this.resizeStartY,n=this.resizeStartWidth,r=this.resizeStartHeight,c=this.resizeStartLeft,a=this.resizeStartTop;if(this.resizeDirection.includes("e")&&(n=Math.max(this.options.minWidth,this.resizeStartWidth+s)),this.resizeDirection.includes("w")){let d=Math.max(this.options.minWidth,this.resizeStartWidth-s);c=this.resizeStartLeft+(this.resizeStartWidth-d),n=d}let u=typeof this.options.maxWidth=="function"?this.options.maxWidth():this.options.maxWidth;if(Number.isFinite(u)){let d=Math.min(n,u);d!==n&&this.resizeDirection.includes("w")&&(c+=n-d),n=d}if(!this.options.maintainAspectRatio){if(this.resizeDirection.includes("s")&&(r=Math.max(this.options.minHeight,this.resizeStartHeight+o)),this.resizeDirection.includes("n")){let l=Math.max(this.options.minHeight,this.resizeStartHeight-o);a=this.resizeStartTop+(this.resizeStartHeight-l),r=l}let d=typeof this.options.maxHeight=="function"?this.options.maxHeight():this.options.maxHeight;if(Number.isFinite(d)){let l=Math.min(r,d);l!==r&&this.resizeDirection.includes("n")&&(a+=r-l),r=l}}this.element.style.width=`${n}px`,this.options.maintainAspectRatio?this.element.style.height="auto":this.element.style.height=`${r}px`,this.resizeDirection.includes("w")&&(this.element.style.left=`${c}px`),this.resizeDirection.includes("n")&&!this.options.maintainAspectRatio&&(this.element.style.top=`${a}px`),this.options.onResize&&this.options.onResize({width:n,height:r,left:c,top:a})}stopResizing(){this.isResizing=!1,this.resizeDirection=null,this.element.classList.remove(`${this.options.classPrefix}-resizing`),document.body.style.userSelect="",this.manuallyPositioned=!0,this.options.onResizeEnd&&this.options.onResizeEnd()}toggleKeyboardDragMode(){this.keyboardDragMode?this.disableKeyboardDragMode():this.enableKeyboardDragMode()}enableKeyboardDragMode(){this.keyboardDragMode=!0,this.keyboardResizeMode=!1,this.element.classList.add(`${this.options.classPrefix}-keyboard-drag`),this.element.classList.remove(`${this.options.classPrefix}-keyboard-resize`),this.focusElement()}disableKeyboardDragMode(){this.keyboardDragMode=!1,this.element.classList.remove(`${this.options.classPrefix}-keyboard-drag`)}toggleKeyboardResizeMode(){this.keyboardResizeMode?this.disableKeyboardResizeMode():this.enableKeyboardResizeMode()}enableKeyboardResizeMode(){this.keyboardResizeMode=!0,this.keyboardDragMode=!1,this.element.classList.add(`${this.options.classPrefix}-keyboard-resize`),this.element.classList.remove(`${this.options.classPrefix}-keyboard-drag`),this.focusElement()}disableKeyboardResizeMode(){this.keyboardResizeMode=!1,this.element.classList.remove(`${this.options.classPrefix}-keyboard-resize`)}enablePointerResizeMode({focus:e=!0}={}){if(!this.hasManagedResizeHandles()){this.enableKeyboardResizeMode();return}this.pointerResizeMode||(this.pointerResizeMode=!0,this.setManagedHandlesVisible(!0),this.element.classList.add(`${this.options.classPrefix}-resizable`),this.enableKeyboardResizeMode(),e&&this.focusElement(),typeof this.options.onPointerResizeToggle=="function"&&this.options.onPointerResizeToggle(!0))}disablePointerResizeMode({focus:e=!1}={}){this.pointerResizeMode&&(this.pointerResizeMode=!1,this.setManagedHandlesVisible(!1),this.element.classList.remove(`${this.options.classPrefix}-resizable`),this.disableKeyboardResizeMode(),e&&this.focusElement(),typeof this.options.onPointerResizeToggle=="function"&&this.options.onPointerResizeToggle(!1))}togglePointerResizeMode(){return this.pointerResizeMode?this.disablePointerResizeMode():this.enablePointerResizeMode(),this.pointerResizeMode}focusElement(){if(typeof this.element.focus=="function")try{this.element.focus({preventScroll:!0})}catch{this.element.focus()}}keyboardDrag(e,t){let s=t?this.options.keyboardStepLarge:this.options.keyboardStep,o=parseFloat(this.element.style.left)||0,n=parseFloat(this.element.style.top)||0;if(window.getComputedStyle(this.element).transform!=="none"){let u=this.element.getBoundingClientRect();o=u.left,n=u.top,this.element.style.transform="none",this.element.style.left=`${o}px`,this.element.style.top=`${n}px`}let c=o,a=n;switch(e){case"ArrowLeft":c-=s;break;case"ArrowRight":c+=s;break;case"ArrowUp":a-=s;break;case"ArrowDown":a+=s;break}this.element.style.left=`${c}px`,this.element.style.top=`${a}px`,this.options.onDrag&&this.options.onDrag({x:c,y:a})}keyboardResize(e,t){let s=t?this.options.keyboardStepLarge:this.options.keyboardStep,o=this.element.getBoundingClientRect(),n=o.width,r=o.height;switch(e){case"ArrowLeft":n-=s;break;case"ArrowRight":n+=s;break;case"ArrowUp":this.options.maintainAspectRatio?n+=s:r-=s;break;case"ArrowDown":this.options.maintainAspectRatio?n-=s:r+=s;break}n=Math.max(this.options.minWidth,n),r=Math.max(this.options.minHeight,r),this.element.style.width=`${n}px`,this.options.maintainAspectRatio?this.element.style.height="auto":this.element.style.height=`${r}px`,this.options.onResize&&this.options.onResize({width:n,height:r})}resetPosition(){this.element.style.left="50%",this.element.style.top="50%",this.element.style.transform="translate(-50%, -50%)",this.element.style.right="",this.element.style.bottom="",this.manuallyPositioned=!1,this.options.onDrag&&this.options.onDrag({centered:!0})}destroy(){let e=this.options.dragHandle||this.element;this.disablePointerResizeMode(),e.removeEventListener("mousedown",this.handlers.mousedown),e.removeEventListener("touchstart",this.handlers.touchstart),document.removeEventListener("mousemove",this.handlers.mousemove),document.removeEventListener("mouseup",this.handlers.mouseup),document.removeEventListener("touchmove",this.handlers.touchmove),document.removeEventListener("touchend",this.handlers.touchend),this.element.removeEventListener("keydown",this.handlers.keydown),this.options.resizeHandles&&this.options.resizeHandles.length>0&&this.options.resizeHandles.forEach(t=>{t.removeEventListener("mousedown",this.handlers.resizeHandleMousedown),t.removeEventListener("touchstart",this.handlers.resizeHandleMousedown)}),this.element.classList.remove(`${this.options.classPrefix}-dragging`,`${this.options.classPrefix}-resizing`,`${this.options.classPrefix}-keyboard-drag`,`${this.options.classPrefix}-keyboard-resize`)}};function Z({classPrefix:i,itemClass:e,icon:t,label:s,ariaLabel:o,onClick:n,hasTextClass:r=!1}){let c=typeof s=="string"&&(s.startsWith("transcript.")||s.startsWith("player.")||s.startsWith("settings.")),a=o||c&&p.t(s)||s,u=m.createElement("button",{className:e,attributes:{type:"button","aria-label":a,tabindex:"-1"}});t&&u.appendChild(L(t));let l=typeof s=="string"&&(s.startsWith("transcript.")||s.startsWith("player.")||s.startsWith("settings."))&&p.t(s)||s,h=m.createElement("span",{textContent:l,className:r?`${i}-settings-text`:void 0,attributes:{"aria-hidden":"true"}});return u.appendChild(h),n&&u.addEventListener("click",n),u}function G(i,e,t,s){if(!i)return;let o=Array.from(i.querySelectorAll(t));if(o.length===0)return;let n=r=>{let c=o.indexOf(document.activeElement);switch(r.key){case"ArrowDown":r.preventDefault(),r.stopPropagation();let a=(c+1)%o.length;o.forEach((l,h)=>{l.setAttribute("tabindex",h===a?"0":"-1")}),o[a].focus({preventScroll:!1}),o[a].scrollIntoView({behavior:"smooth",block:"nearest"});break;case"ArrowUp":r.preventDefault(),r.stopPropagation();let u=(c-1+o.length)%o.length;o.forEach((l,h)=>{l.setAttribute("tabindex",h===u?"0":"-1")}),o[u].focus({preventScroll:!1}),o[u].scrollIntoView({behavior:"smooth",block:"nearest"});break;case"Home":r.preventDefault(),r.stopPropagation(),o.forEach((l,h)=>{l.setAttribute("tabindex",h===0?"0":"-1")}),o[0].focus({preventScroll:!1}),o[0].scrollIntoView({behavior:"smooth",block:"nearest"});break;case"End":r.preventDefault(),r.stopPropagation();let d=o.length-1;o.forEach((l,h)=>{l.setAttribute("tabindex",h===d?"0":"-1")}),o[d].focus({preventScroll:!1}),o[d].scrollIntoView({behavior:"smooth",block:"nearest"});break;case"Enter":case" ":r.preventDefault(),r.stopPropagation(),document.activeElement&&o.includes(document.activeElement)&&(document.activeElement.click(),s&&setTimeout(()=>{e&&document.contains(e)&&e.focus()},0));break;case"Escape":r.preventDefault(),r.stopPropagation(),s&&s();break}};return i.addEventListener("keydown",n,!0),n}function ee(i,e,t=0){i&&setTimeout(()=>{let s=Array.from(i.querySelectorAll(e));s.length>0&&(s.forEach((o,n)=>{o.setAttribute("tabindex",n===0?"0":"-1")}),b(s[0],{delay:0}),s[0].scrollIntoView({behavior:"smooth",block:"nearest"}))},t)}function oe({classPrefix:i,labelClass:e,selectClass:t,labelText:s,selectId:o,hidden:n=!1,onChange:r=null,options:c=[]}){let u=typeof s=="string"&&(s.startsWith("transcript.")||s.startsWith("player.")||s.startsWith("settings.")||s.startsWith("captions."))&&p.t(s)||s,d=m.createElement("label",{className:e,textContent:u,attributes:{for:o,style:n?"display: none;":void 0}}),l=m.createElement("select",{className:t,attributes:{id:o,style:n?"display: none;":void 0}});return c.forEach(h=>{let f=m.createElement("option",{textContent:h.text,attributes:{value:h.value,selected:h.selected?"selected":void 0}});l.appendChild(f)}),r&&l.addEventListener("change",r),{label:d,select:l}}function ne(i){i&&["mousedown","click"].forEach(e=>{i.addEventListener(e,t=>{t.stopPropagation()})})}export{m as a,p as b,F as c,L as d,W as e,b as f,X as g,x as h,R as i,Z as j,G as k,ee as l,oe as m,ne as n};
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * Universal, Accessible Video Player
3
+ * (c) 2025 Matthias Peltzer
4
+ * Released under GPL-2.0-or-later License
5
+ */
6
+ var e={player:{label:"Videoplayer",play:"Abspielen",pause:"Pause",stop:"Stopp",restart:"Von vorne beginnen",rewind:"Zurückspulen",forward:"Vorspulen",rewindSeconds:"{seconds} Sekunden zurückspulen",forwardSeconds:"{seconds} Sekunden vorspulen",previous:"Vorheriger Titel",next:"Nächster Titel",playlist:"Wiedergabeliste umschalten",volume:"Lautstärke",mute:"Stumm",unmute:"Ton ein",fullscreen:"Vollbild",exitFullscreen:"Vollbild beenden",captions:"Untertitel",chapters:"Kapitel",quality:"Qualität",captionStyling:"Untertitel-Stil",transcript:"Transkript umschalten",audioDescription:"Audiodeskription",signLanguage:"Gebärdensprache-Video",settings:"Einstellungen",speed:"Wiedergabegeschwindigkeit",pip:"Bild-in-Bild",currentTime:"Aktuelle Zeit",duration:"Dauer",progress:"Fortschritt",seekForward:"{seconds} Sekunden vorspulen",seekBackward:"{seconds} Sekunden zurückspulen",volumeUp:"Lauter",volumeDown:"Leiser",loading:"Lädt...",loadingChapters:"Kapitel werden geladen...",error:"Fehler beim Laden",buffering:"Puffern...",signLanguageVideo:"Gebärdensprache-Video",closeSignLanguage:"Gebärdensprache-Video schließen",signLanguageSettings:"Gebärdensprache-Einstellungen",noChapters:"Keine Kapitel verfügbar",noCaptions:"Keine Untertitel verfügbar",auto:"Automatisch",autoQuality:"Automatisch (keine Qualitätsauswahl verfügbar)",noQuality:"Qualitätsauswahl nicht verfügbar",signLanguageDragResize:"Gebärdensprache-Video - Drücken Sie D zum Verschieben per Tastatur, R zum Ändern der Größe",signLanguageDragActive:"Gebärdensprache-Video - Verschiebemodus aktiv. Pfeiltasten zum Bewegen, Escape zum Beenden.",signLanguageResizeActive:"Gebärdensprache-Video - Größenänderungsmodus aktiv. Links-/Rechts-Pfeiltasten zum Ändern der Größe, Escape zum Beenden.",enableSignDragMode:"Verschiebemodus aktivieren. Tastenkombination: D-Taste",disableSignDragMode:"Verschiebemodus deaktivieren. Tastenkombination: D-Taste",enableSignDragModeAria:"Tastatur-Verschiebemodus mit Pfeiltasten aktivieren. Tastenkombination: D-Taste",disableSignDragModeAria:"Tastatur-Verschiebemodus mit Pfeiltasten deaktivieren. Tastenkombination: D-Taste",enableSignResizeMode:"Größenänderungsmodus aktivieren. Tastenkombination: R-Taste",disableSignResizeMode:"Größenänderungsmodus deaktivieren. Tastenkombination: R-Taste",enableSignResizeModeAria:"Tastatur-Größenänderungsmodus mit Pfeiltasten aktivieren. Tastenkombination: R-Taste",disableSignResizeModeAria:"Tastatur-Größenänderungsmodus mit Pfeiltasten deaktivieren. Tastenkombination: R-Taste",resizeHandle:"Größenänderung {direction}-Ecke",moreOptions:"Weitere Optionen",noMoreOptions:"Keine weiteren Optionen verfügbar"},captions:{off:"Aus",select:"Untertitel auswählen",fontSize:"Schriftgröße",fontFamily:"Schriftart",color:"Textfarbe",backgroundColor:"Hintergrundfarbe",opacity:"Deckkraft"},fontSizes:{small:"Klein",normal:"Normal",large:"Groß",xlarge:"Sehr groß"},fontFamilies:{sansSerif:"Sans-serif",serif:"Serif",monospace:"Monospace"},styleLabels:{textColor:"Textfarbe",background:"Hintergrund",font:"Schrift",fontSize:"Schriftgröße",opacity:"Deckkraft"},audioDescription:{enable:"Audiodeskription aktivieren",disable:"Audiodeskription deaktivieren"},signLanguage:{show:"Gebärdensprache-Video anzeigen",hide:"Gebärdensprache-Video ausblenden"},transcript:{title:"Transkript",ariaLabel:"Video-Transkript",close:"Transkript schließen",loading:"Transkript wird geladen...",noTranscript:"Kein Transkript für dieses Video verfügbar.",settings:"Transkript-Einstellungen. Eingabetaste zum Öffnen des Menüs drücken oder D zum Aktivieren des Verschiebemodus",keyboardDragMode:"Tastatur-Verschiebemodus mit Pfeiltasten umschalten. Tastenkombination: D-Taste",keyboardDragActive:"⌨️ Tastatur-Verschiebemodus aktiv (Pfeiltasten zum Bewegen, Umschalt+Pfeiltasten für große Schritte, D oder ESC zum Beenden)",dragResizePrompt:"Drücken Sie D zum Verschieben oder R zur Größenänderung. Home setzt die Position zurück, Esc schließt.",dragModeEnabled:"Tastatur-Verschiebemodus aktiviert. Pfeiltasten zum Bewegen, Umschalt+Pfeiltasten für größere Schritte. D oder Esc zum Beenden.",dragModeDisabled:"Tastatur-Verschiebemodus deaktiviert.",enableDragMode:"Verschiebemodus aktivieren. Tastenkombination: D-Taste",disableDragMode:"Verschiebemodus deaktivieren. Tastenkombination: D-Taste",enableDragModeAria:"Tastatur-Verschiebemodus mit Pfeiltasten aktivieren. Tastenkombination: D-Taste",disableDragModeAria:"Tastatur-Verschiebemodus mit Pfeiltasten deaktivieren. Tastenkombination: D-Taste",resizeWindow:"Fenster vergrößern/verkleinern",disableResizeWindow:"Resize-Modus deaktivieren",enableResizeMode:"Größenänderungsmodus aktivieren. Tastenkombination: R-Taste",disableResizeMode:"Größenänderungsmodus deaktivieren. Tastenkombination: R-Taste",enableResizeModeAria:"Tastatur-Größenänderungsmodus mit Pfeiltasten aktivieren. Tastenkombination: R-Taste",disableResizeModeAria:"Tastatur-Größenänderungsmodus mit Pfeiltasten deaktivieren. Tastenkombination: R-Taste",resizeModeHint:"Griffe aktiviert. Ziehen Sie Kanten oder Ecken zum Anpassen. Esc oder R zum Beenden.",resizeModeEnabled:"Resize-Modus aktiviert. Kanten oder Ecken ziehen; Esc oder R beendet.",resizeModeDisabled:"Resize-Modus deaktiviert.",positionReset:"Transkriptposition zurückgesetzt.",styleTranscript:"Transkript-Stileinstellungen öffnen",closeMenu:"Menü schließen",styleTitle:"Transkript-Stil",autoscroll:"Auto-Scroll",settingsMenu:"Transkript-Dialog-Einstellungen",showTimestamps:"Zeitstempel anzeigen",hideTimestamps:"Zeitstempel ausblenden",showTimestampsAria:"Zeitstempel im Transkript anzeigen",hideTimestampsAria:"Zeitstempel im Transkript ausblenden"},settings:{title:"Einstellungen",quality:"Qualität",speed:"Geschwindigkeit",captions:"Untertitel",language:"Sprache",reset:"Zurücksetzen",close:"Schließen"},speeds:{normal:"Normal"},time:{display:"Zeitanzeige",durationPrefix:"Dauer: ",of:"von",hour:"{count} Stunde",hours:"{count} Stunden",minute:"{count} Minute",minutes:"{count} Minuten",second:"{count} Sekunde",seconds:"{count} Sekunden"},playlist:{title:"Wiedergabeliste",trackOf:"Titel {current} von {total}",nowPlaying:"Läuft gerade: Titel {current} von {total}. {title}{artist}",by:" von ",untitled:"Ohne Titel",trackUntitled:"Titel {number}",currentlyPlaying:"Wird gerade abgespielt",notPlaying:"Nicht aktiv",pressEnterPlay:"Eingabetaste zum Abspielen",pressEnterRestart:"Eingabetaste zum Neustart",keyboardInstructions:"Wiedergabelisten-Navigation: Verwenden Sie die Pfeiltasten nach oben und unten, um zwischen Titeln zu wechseln. Drücken Sie Bild auf oder Bild ab, um 5 Titel zu überspringen. Drücken Sie Pos1, um zum ersten Titel zu springen, Ende für den letzten Titel. Drücken Sie die Eingabetaste oder Leertaste, um den ausgewählten Titel abzuspielen.",endOfPlaylist:"Ende der Wiedergabeliste. {current} von {total}.",beginningOfPlaylist:"Anfang der Wiedergabeliste. 1 von {total}.",jumpedToLastTrack:"Zum letzten Titel gesprungen. {current} von {total}.",jumpedToFirstTrack:"Zum ersten Titel gesprungen. 1 von {total}.",firstTrack:"Erster Titel. 1 von {total}.",lastTrack:"Letzter Titel. {current} von {total}."}};export{e as de};