@serifpersia/dango 3.6.5 → 3.6.7

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 (57) hide show
  1. package/README.md +1 -1
  2. package/client/dist/assets/{AnimeCard-JkXG40Es.js → AnimeCard-C3P9zWi9.js} +1 -1
  3. package/client/dist/assets/{AnimeInfo-2L0UJkbB.js → AnimeInfo-Et6687Tl.js} +1 -1
  4. package/client/dist/assets/{AnimeInfoPage-BDs03vKk.js → AnimeInfoPage-DX4eNnlH.js} +2 -2
  5. package/client/dist/assets/{Asmr-D2mVKEl9.js → Asmr-CCdEWrFi.js} +1 -1
  6. package/client/dist/assets/{AsmrResetProgressModal-MQA_bNQM.js → AsmrResetProgressModal-DgEWBJOw.js} +1 -1
  7. package/client/dist/assets/AvSyncCalibrator-CQ2fjf2E.js +10 -0
  8. package/client/dist/assets/{Home-DxMBHFmc.js → Home-DUkUTTTy.js} +1 -1
  9. package/client/dist/assets/{Insights-hmLWsSXY.js → Insights-QCh4xW12.js} +1 -1
  10. package/client/dist/assets/{LibraryListPage-CWI7hgUh.js → LibraryListPage-BoTxRqHz.js} +1 -1
  11. package/client/dist/assets/{ListeningList-NOc28KAV.js → ListeningList-DguKjI_t.js} +1 -1
  12. package/client/dist/assets/{Manga-B5qNhI7v.js → Manga-HydR-L7o.js} +1 -1
  13. package/client/dist/assets/{MangaInfoPage-D4wIyb-V.js → MangaInfoPage-CBakEI9a.js} +1 -1
  14. package/client/dist/assets/{MangaReadPage-Ce1VX7-0.js → MangaReadPage-DwAR3iPy.js} +1 -1
  15. package/client/dist/assets/{MangaResetProgressModal-P3oY4_14.js → MangaResetProgressModal-DGzl8vsO.js} +1 -1
  16. package/client/dist/assets/{Mature-D8EwGYQq.js → Mature-Pi0TxKuF.js} +1 -1
  17. package/client/dist/assets/{MediaCard-Dp8DjyXB.js → MediaCard--cuFxOCS.js} +1 -1
  18. package/client/dist/assets/{Music-DULtVsAM.js → Music-CQpyXTLH.js} +1 -1
  19. package/client/dist/assets/{OptionListMenu-fIHdE-nq.js → OptionListMenu-B3D39dGS.js} +1 -1
  20. package/client/dist/assets/{Player-B8XeOmso.js → Player-CsH4x_I_.js} +6 -6
  21. package/client/dist/assets/{PlayerSettings-BycNCiCs.js → PlayerSettings-DGxBsi3F.js} +1 -1
  22. package/client/dist/assets/{QueueOptionsButton-T1J37IZT.js → QueueOptionsButton-Djq4Cpex.js} +1 -1
  23. package/client/dist/assets/{QueueRail-BAwI-apz.js → QueueRail-DOrYgNVX.js} +1 -1
  24. package/client/dist/assets/{Radio-Bv9DyKtZ.js → Radio-DF6g6odd.js} +1 -1
  25. package/client/dist/assets/{ReadingList-Cl0CcVp3.js → ReadingList-DwYoBrNk.js} +1 -1
  26. package/client/dist/assets/{ResetProgressModal--N60WWCB.js → ResetProgressModal-CMF86mX6.js} +1 -1
  27. package/client/dist/assets/{Search-DvgVDlUR.js → Search-DFkhuk-x.js} +1 -1
  28. package/client/dist/assets/{Settings-dCz_-bJn.js → Settings-DBB2r0VQ.js} +1 -1
  29. package/client/dist/assets/{SkeletonGrid-BZHKk1I6.js → SkeletonGrid-DJelJgAv.js} +1 -1
  30. package/client/dist/assets/{Trackers-C1T5VcPu.js → Trackers-DGYXFhYZ.js} +1 -1
  31. package/client/dist/assets/{Tv-Dhv_cg4y.js → Tv-C5MDGD2Z.js} +4 -4
  32. package/client/dist/assets/{TvInfo-DgaLK2H6.js → TvInfo-DrKuK13u.js} +1 -1
  33. package/client/dist/assets/{TvPopup-DyX7f8kC.js → TvPopup-DtHilRDT.js} +1 -1
  34. package/client/dist/assets/{TvSearch-Bp0H6kue.js → TvSearch-CzNxdu_w.js} +1 -1
  35. package/client/dist/assets/{TvWatchlist-ohMtMeKa.js → TvWatchlist-D7p4br6S.js} +1 -1
  36. package/client/dist/assets/{Watchlist-BbQtzsER.js → Watchlist-DrOzswl2.js} +1 -1
  37. package/client/dist/assets/{hls-Bi1cjpLZ.js → hls-BGCX7mJy.js} +1 -1
  38. package/client/dist/assets/{index-BTnhzofk.js → index-CnfZwsds.js} +2 -2
  39. package/client/dist/assets/{useAnimeInfoData-Cvmso3IK.js → useAnimeInfoData-DYXWBPF-.js} +1 -1
  40. package/client/dist/assets/{useAsmr-CbzGCzmv.js → useAsmr-BbhQ59bk.js} +1 -1
  41. package/client/dist/assets/{useAsmrPopup-DaREZ9Ie.js → useAsmrPopup-SymV1J-b.js} +1 -1
  42. package/client/dist/assets/{useMangaLibrary-BVQRhsFh.js → useMangaLibrary-DuesWQaE.js} +1 -1
  43. package/client/dist/assets/{useMangaPopup-CzsCbndG.js → useMangaPopup-D57OVGUr.js} +1 -1
  44. package/client/dist/assets/{useProviders-UuUPzft-.js → useProviders-mpQb_dix.js} +1 -1
  45. package/client/dist/assets/{useTv-CSsbWKH9.js → useTv-DGflCsSI.js} +1 -1
  46. package/client/dist/assets/{useTvLibrary-a_Y0c2FS.js → useTvLibrary-BqeSmyc4.js} +1 -1
  47. package/client/dist/index.html +1 -1
  48. package/package.json +2 -2
  49. package/server/dist/app-hono.js +1 -1
  50. package/server/dist/hono/proxy.js +105 -227
  51. package/server/dist/hono/tv.js +33 -2
  52. package/server/dist/providers/remote-loader.js +12 -3
  53. package/server/dist/providers/remote-types.js +35 -0
  54. package/server/dist/server.js +3 -0
  55. package/server/package.json +1 -1
  56. package/client/dist/assets/AvSyncCalibrator-DmoH5eRA.js +0 -10
  57. package/server/dist/utils/megaplay.utils.js +0 -40
@@ -38,6 +38,7 @@ const app = createHonoApp(() => ({ shuttingDown: isShuttingDown, dbReady: !!db }
38
38
  getProviders: () => providers,
39
39
  getMangaProvider: (name) => mangaProviders[name],
40
40
  getTvProvider: (name) => tvProviders[name],
41
+ getProxyRules: () => proxyRules,
41
42
  getJasmr: () => {
42
43
  const mod = providers['jasmr'];
43
44
  return isJasmrApi(mod) ? mod : undefined;
@@ -47,6 +48,7 @@ const apiCache = new AppCache({ ttlSeconds: 3600, maxKeys: 5000 });
47
48
  const providers = {};
48
49
  const mangaProviders = {};
49
50
  const tvProviders = {};
51
+ let proxyRules = [];
50
52
  let remoteCatalog = [];
51
53
  function parseEnabledProviders() {
52
54
  return CONFIG.PROVIDER_ENABLED.split(',')
@@ -85,6 +87,7 @@ async function refreshRemoteProviders() {
85
87
  delete tvProviders[key];
86
88
  }
87
89
  Object.assign(tvProviders, result.tvProviders);
90
+ proxyRules = result.proxyRules;
88
91
  remoteCatalog = result.catalog;
89
92
  logger.info({
90
93
  count: Object.keys(result.providers).length,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dango-server",
3
3
  "private": true,
4
- "version": "3.6.5",
4
+ "version": "3.6.7",
5
5
  "type": "module",
6
6
  "engines": {
7
7
  "node": ">=22.12.0"
@@ -1,10 +0,0 @@
1
- import{u as r,A as b,d as C,h as A,q as x,T as pe,$ as At}from"./vendor-core-DfaOB3Rn.js";import{B as re,M as $t,S as ye,h as Ft,R as Rt,t as Xe,P as Dt,g as Ot}from"./index-BTnhzofk.js";import{I as J}from"./vendor-icons-DrybRNxP.js";import{u as qt}from"./vendor-query-BBT5_sHx.js";const Ht="_controls_p5g5s_1",Vt="_titleContainer_p5g5s_9",zt="_scheduleInfo_p5g5s_15",Wt="_status_p5g5s_23",Ut="_nextEpisode_p5g5s_35",Kt="_watchlistBtn_p5g5s_45",jt="_inList_p5g5s_72",Gt="_queueBtn_p5g5s_83",Xt="_queueActive_p5g5s_95",Jt="_modeToggleBtn_p5g5s_101",Qt="_modeToggleActive_p5g5s_108",Yt="_nativeToggleBtn_p5g5s_119",Zt="_nativeToggleActive_p5g5s_132",en="_markWatchedBtn_p5g5s_153",tn="_markWatchedDone_p5g5s_167",nn="_completeSeriesBtn_p5g5s_178",rn="_streamPanel_p5g5s_192",sn="_desktopEpisodeActions_p5g5s_206",on="_sourceSelectionContainer_p5g5s_212",cn="_sourceLoader_p5g5s_213",an="_episodeActions_p5g5s_226",ln="_mobileEpisodeActions_p5g5s_240",un="_episodeNavBtn_p5g5s_244",dn="_primary_p5g5s_274",pn="_secondary_p5g5s_284",fn="_episodePickerBtn_p5g5s_288",mn="_queueCountdown_p5g5s_292",gn="_speedBoostBadge_p5g5s_307",hn="_videoContainer_p5g5s_338",_n="_loadingOverlay_p5g5s_351",vn="_loadingDots_p5g5s_365",yn="_dot_p5g5s_370",bn="_bounce_p5g5s_1",wn="_bufferingOverlay_p5g5s_399",Sn="_bufferingSpinner_p5g5s_408",Cn="_spin_p5g5s_948",kn="_videoIframe_p5g5s_423",En="_videoElementHidden_p5g5s_446",Ln="_upscalerCanvas_p5g5s_451",Tn="_upscalerActive_p5g5s_464",Bn="_upscalerStatusBadge_p5g5s_468",xn="_subtitleOverlay_p5g5s_483",Nn="_controlsOverlay_p5g5s_495",In="_hidden_p5g5s_525",Pn="_centerPlayPause_p5g5s_531",Mn="_bottomControls_p5g5s_563",An="_progressBarContainer_p5g5s_580",$n="_progressBar_p5g5s_580",Fn="_scrubbing_p5g5s_603",Rn="_watchedBar_p5g5s_608",Dn="_bufferedBar_p5g5s_609",On="_thumb_p5g5s_631",qn="_timeBubble_p5g5s_652",Hn="_skipSegment_p5g5s_675",Vn="_op_p5g5s_689",zn="_ed_p5g5s_693",Wn="_recap_p5g5s_697",Un="_bottomControlsRow_p5g5s_701",Kn="_controlBtn_p5g5s_709",jn="_timeDisplay_p5g5s_733",Gn="_leftControls_p5g5s_742",Xn="_rightControls_p5g5s_743",Jn="_middleControls_p5g5s_744",Qn="_skipControls_p5g5s_750",Yn="_skipBtn_p5g5s_756",Zn="_volumeContainer_p5g5s_780",er="_volumeSlider_p5g5s_787",tr="_settingsMenu_p5g5s_865",nr="_slideUp_p5g5s_1",rr="_qualityListInMenu_p5g5s_904",sr="_ccOptionsContainer_p5g5s_905",or="_qualityItemInMenu_p5g5s_913",cr="_ccItem_p5g5s_914",ar="_active_p5g5s_935",ir="_spinner_p5g5s_948",lr="_watchBtn_p5g5s_1007",ur="_errorOverlay_p5g5s_1053",dr="_retryButton_p5g5s_1063",pr="_providerSelectContainer_p5g5s_1098",fr="_providerSelect_p5g5s_1098",mr="_sourceSelect_p5g5s_212",gr="_sourceButtons_p5g5s_1154",hr="_sourceButton_p5g5s_1154",_r="_detailsBox_p5g5s_1186",vr="_detailsToggleBtn_p5g5s_1199",yr="_detailsGridContainer_p5g5s_1222",br="_fadeIn_p5g5s_1",wr="_detailItem_p5g5s_1231",Sr="_animeStatus_p5g5s_1251",Cr="_genresList_p5g5s_1264",kr="_genreTag_p5g5s_1271",Er="_loadingDetails_p5g5s_1289",Lr="_descriptionSection_p5g5s_1296",Tr="_synopsisFlat_p5g5s_1304",Br="_description_p5g5s_1296",xr="_epJumpControls_p5g5s_1345",Nr="_epRangeButtons_p5g5s_1356",Ir="_metaTags_p5g5s_1362",Pr="_epRangeBtn_p5g5s_1369",Mr="_epJumpInputGroup_p5g5s_1384",Ar="_fullscreenActive_p5g5s_1416",$r="_errorSubtext_p5g5s_1460",xo={controls:Ht,titleContainer:Vt,scheduleInfo:zt,status:Wt,nextEpisode:Ut,watchlistBtn:Kt,inList:jt,queueBtn:Gt,queueActive:Xt,modeToggleBtn:Jt,modeToggleActive:Qt,nativeToggleBtn:Yt,nativeToggleActive:Zt,markWatchedBtn:en,markWatchedDone:tn,completeSeriesBtn:nn,streamPanel:rn,desktopEpisodeActions:sn,sourceSelectionContainer:on,sourceLoader:cn,episodeActions:an,mobileEpisodeActions:ln,episodeNavBtn:un,primary:dn,secondary:pn,episodePickerBtn:fn,queueCountdown:mn,speedBoostBadge:gn,videoContainer:hn,loadingOverlay:_n,loadingDots:vn,dot:yn,bounce:bn,bufferingOverlay:wn,bufferingSpinner:Sn,spin:Cn,videoIframe:kn,videoElementHidden:En,upscalerCanvas:Ln,upscalerActive:Tn,upscalerStatusBadge:Bn,subtitleOverlay:xn,controlsOverlay:Nn,hidden:In,centerPlayPause:Pn,bottomControls:Mn,progressBarContainer:An,progressBar:$n,scrubbing:Fn,watchedBar:Rn,bufferedBar:Dn,thumb:On,timeBubble:qn,skipSegment:Hn,op:Vn,ed:zn,recap:Wn,bottomControlsRow:Un,controlBtn:Kn,timeDisplay:jn,leftControls:Gn,rightControls:Xn,middleControls:Jn,skipControls:Qn,skipBtn:Yn,volumeContainer:Zn,volumeSlider:er,settingsMenu:tr,slideUp:nr,qualityListInMenu:rr,ccOptionsContainer:sr,qualityItemInMenu:or,ccItem:cr,active:ar,spinner:ir,watchBtn:lr,errorOverlay:ur,retryButton:dr,providerSelectContainer:pr,providerSelect:fr,sourceSelect:mr,sourceButtons:gr,sourceButton:hr,detailsBox:_r,detailsToggleBtn:vr,detailsGridContainer:yr,fadeIn:br,detailItem:wr,animeStatus:Sr,genresList:Cr,genreTag:kr,loadingDetails:Er,descriptionSection:Lr,synopsisFlat:Tr,description:Br,epJumpControls:xr,epRangeButtons:Nr,metaTags:Ir,epRangeBtn:Pr,epJumpInputGroup:Mr,fullscreenActive:Ar,errorSubtext:$r},Fr="_playerPageLayout_hzfjd_1",Rr="_noSidebar_hzfjd_15",Dr="_episodeSidebar_hzfjd_19",Or="_playerMain_hzfjd_32",qr="_videoPlayerWrapper_hzfjd_40",Hr="_playerInfoHeader_hzfjd_56",Vr="_playerAnimeCard_hzfjd_62",zr="_playerInfoContainer_hzfjd_74",Wr="_infoColumns_hzfjd_86",Ur="_videoTitleSection_hzfjd_114",Kr="_theaterMode_hzfjd_296",jr="_theaterAmbient_hzfjd_330",Gr={playerPageLayout:Fr,noSidebar:Rr,episodeSidebar:Dr,playerMain:Or,videoPlayerWrapper:qr,playerInfoHeader:Hr,playerAnimeCard:Vr,playerInfoContainer:zr,infoColumns:Wr,videoTitleSection:Ur,theaterMode:Kr,theaterAmbient:jr},Xr="_shell_41rxp_1",Jr="_stage_41rxp_37",Qr="_shellFill_41rxp_85",Yr="_shellFullscreen_41rxp_93",Zr="_uiLayer_41rxp_107",es="_volumeWrap_41rxp_118",ts="_volumeSlider_41rxp_124",ce={shell:Xr,stage:Jr,shellFill:Qr,shellFullscreen:Yr,uiLayer:Zr,volumeWrap:es,volumeSlider:ts},ns=.8,rs=5,No=2e3,Ze="autoplayEnabled",ss=(e,n)=>n>0&&e>=n*ns,Io=(e,n)=>e>rs&&!ss(e,n),Po=()=>{try{return localStorage.getItem(Ze)==="true"}catch{return!1}},Mo=e=>{try{localStorage.setItem(Ze,String(e))}catch{}},os=["finished","completed","complete","ended"],Ao=(e,n,t)=>e.length>0&&!!n&&e[e.length-1]===n&&os.some(o=>String(t||"").trim().toLowerCase().includes(o)),$o=e=>e.seekInduced?"none":e.autoplayEnabled&&e.hasNext?"advance":e.hasNext?"prompt-next":e.isFinal?"prompt-complete":"none",cs=e=>(e.language??e.lang??"").toLowerCase(),as=e=>(e.label??"").toLowerCase(),is=e=>`${e.language??e.lang??""}|||${e.label??""}`,ls=e=>cs(e).startsWith("en")||as(e).includes("english");function Fo(e,n){if(e.length===0||n?.enabled===!1)return-1;const t=n?.lastKey??null;if(t){const s=e.findIndex(i=>is(i)===t);if(s>=0)return s}const o=e.findIndex(ls);return o>=0?o:0}const Z={fontSize:1.8,position:0,bgOpacity:.5,bgColor:"#000000",textColor:"#ffffff",edge:"shadow",bold:!1},xe=(e,n,t)=>Math.max(n,Math.min(t,e)),Ne=e=>typeof e=="string"&&/^#[0-9a-fA-F]{6}$/.test(e),ke=(e,n,t,o)=>{try{const s=localStorage.getItem(e);if(s===null)return n;const i=parseFloat(s);return Number.isFinite(i)?xe(i,t,o):n}catch{return n}};function us(){let e=Z.edge,n=Z.bgColor,t=Z.textColor,o=Z.bold;try{const s=localStorage.getItem("subtitleEdge");(s==="shadow"||s==="outline"||s==="none")&&(e=s);const i=localStorage.getItem("subtitleBgColor");Ne(i)&&(n=i);const p=localStorage.getItem("subtitleTextColor");Ne(p)&&(t=p);const _=localStorage.getItem("subtitleBold");_!==null&&(o=_==="true")}catch{}return{fontSize:ke("subtitleFontSize",Z.fontSize,.5,10),position:ke("subtitlePosition",Z.position,0,100),bgOpacity:ke("subtitleBgOpacity",Z.bgOpacity,0,1),bgColor:n,textColor:t,edge:e,bold:o}}function et(e,n){const t=`rgba(0, 0, 0, ${xe(n,0,1)})`;if(!Ne(e))return t;const o=parseInt(e.slice(1,3),16),s=parseInt(e.slice(3,5),16),i=parseInt(e.slice(5,7),16);return`rgba(${o}, ${s}, ${i}, ${xe(n,0,1)})`}function tt(e,n){return e==="none"?n<=0?"0 1px 3px rgba(0, 0, 0, 0.9)":"none":e==="outline"?["-1px 0 0 black","1px 0 0 black","0 -1px 0 black","0 1px 0 black","-1px -1px 0 black","1px -1px 0 black","-1px 1px 0 black","1px 1px 0 black","0 0 6px rgba(0, 0, 0, 0.9)"].join(", "):"0 0 4px black, 0 1px 2px rgba(0, 0, 0, 0.8)"}function Ro(e){return`
2
- video::cue {
3
- font-size: ${e.fontSize}rem !important;
4
- color: ${e.textColor} !important;
5
- background-color: ${et(e.bgColor,e.bgOpacity)} !important;
6
- font-weight: ${e.bold?"bold":"normal"} !important;
7
- text-shadow: ${tt(e.edge,e.bgOpacity)} !important;
8
- }
9
- `}function Do(e){return[`font-size: ${e.fontSize}rem`,`color: ${e.textColor}`,`background-color: ${et(e.bgColor,e.bgOpacity)}`,`font-weight: ${e.bold?"700":"400"}`,`text-shadow: ${tt(e.edge,e.bgOpacity)}`,"padding: 0.2em 0.5em","border-radius: 0.25em","text-align: center","position: absolute","left: 50%","transform: translateX(-50%)","max-width: 92%","white-space: pre-wrap","overflow-wrap: break-word","line-height: 1.4"].join(`;
10
- `)+";"}const ds=new Set(["b","i","u","strong","em"]);function Oo(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/&lt;(\/?)([a-zA-Z]+)&gt;/g,(t,o,s)=>ds.has(s.toLowerCase())?`<${o}${s.toLowerCase()}>`:t)}function qo(e){return e.replace(/<[^>]*>/g,"")}const Ho=["#ffffff","#ffff00","#7CFC00","#00e5ff","#ff9ff3","#ffa502"],Vo=["#000000","#1e272e","#2f3542","#3d0c02","#0c3d2e","#ffffff"];function zo(e,n){const t=Number.isFinite(e)?e*16:Z.fontSize*16;return!Number.isFinite(n)||n<=0?t/16:Math.min(t,Math.max(13,n*.07))/16}function Wo(e){const n=Math.abs(e/1e3).toFixed(1);return e>0?`+${n}s`:e<0?`-${n}s`:"0.0s"}function Uo(e,n){const t=e.clientWidth||0,o=e.clientHeight||0,s=e.videoWidth>0&&e.videoHeight>0?e.videoWidth/e.videoHeight:0;let i=o;s>0&&t>0&&o>0&&(i=t/o>s?o:t/s);const p=Math.max(0,(o-i)/2),_=Math.max(0,Math.min(100,Number(n)||0))/100*i;return p+_}const Ko=({isOpen:e,onClose:n,title:t,message:o,resumeLabel:s="Resume",restartLabel:i="Start Over",onResume:p,onRestart:_})=>r($t,{isOpen:e,onClose:n,title:t,width:"sm",children:r("div",{style:{padding:"1rem",textAlign:"center"},children:[r("p",{children:o}),r("div",{style:{marginTop:"1rem",display:"flex",gap:"10px",justifyContent:"center"},children:[r(re,{variant:"secondary",onClick:_,children:i}),r(re,{onClick:p,children:s})]})]})}),ps="_centerControls_61n7k_1",fs="_centerSkipBtn_61n7k_15",ms="_centerPlayPause_61n7k_40",gs="_playIconOffset_61n7k_71",de={centerControls:ps,centerSkipBtn:fs,centerPlayPause:ms,playIconOffset:gs},jo=({isPlaying:e,onTogglePlay:n,onSkipBack:t,onSkipForward:o,skipSeconds:s=10})=>r("div",{className:de.centerControls,onClick:i=>i.stopPropagation(),children:[r("button",{className:de.centerSkipBtn,onClick:t,title:`Skip back ${s}s`,"aria-label":`Skip back ${s} seconds`,children:r(J,{name:"replay-10"})}),r("button",{className:de.centerPlayPause,"data-speed-boost-ignore":"true",onClick:n,"aria-label":e?"Pause":"Play",children:e?r(J,{name:"pause"}):r(J,{name:"play",className:de.playIconOffset})}),r("button",{className:de.centerSkipBtn,onClick:o,title:`Skip forward ${s}s`,"aria-label":`Skip forward ${s} seconds`,children:r(J,{name:"forward-10"})})]}),Go=({visible:e,title:n,episode:t,onBack:o,classes:s})=>r("div",{className:`${s.overlay} ${e?"":s.hidden} `,"data-speed-boost-ignore":"true",style:{pointerEvents:"none",background:"none"},children:r("div",{className:s.top,onClick:i=>i.stopPropagation(),children:[r("button",{className:s.backBtn,onClick:i=>{i.stopPropagation(),o()},title:"Back","aria-label":"Back",children:r(J,{name:"chevron-left"})}),r("div",{className:s.titleInfo,children:[r("span",{className:s.title,children:n}),t&&r("span",{className:s.episode,children:t})]})]})}),Xo=({classes:e,videoRef:n,duration:t,formatTime:o,isScrubbing:s,buffered:i="auto",onSeek:p,onScrubStart:_,onScrubMove:a,onScrubEnd:g,timeLabelRef:l,children:E})=>{const h=b(null),L=b(null),f=b(null),v=b(null),S=b(null),u=b(!1),y=b(s);y.current=s;const d=b({onScrubMove:a,onScrubEnd:g});d.current={onScrubMove:a,onScrubEnd:g};const[N,$]=C({time:0,position:null});A(()=>{const m=n.current;if(!m)return;const w=Q=>{const D=Q/t*100||0;L.current&&(L.current.style.width=`${D}%`),f.current&&(f.current.style.left=`${D}%`),l?.current&&(l.current.innerText=`${o(Q)} / ${o(t)}`)},R=()=>{s||w(m.currentTime)},W=()=>{if(i==="auto"&&m.buffered.length>0){const D=m.buffered.end(m.buffered.length-1)/t*100||0;v.current&&(v.current.style.width=`${D}%`)}};return w(m.currentTime),W(),m.addEventListener("timeupdate",R),m.addEventListener("progress",W),()=>{m.removeEventListener("timeupdate",R),m.removeEventListener("progress",W)}},[n,t,s,i,o,l]);const z=m=>{if(!h.current)return 0;const w=h.current.getBoundingClientRect();return Math.min(1,Math.max(0,(m-w.left)/w.width))},j=m=>{const w=m*t,R=w/t*100||0;L.current&&(L.current.style.width=`${R}%`),f.current&&(f.current.style.left=`${R}%`),l?.current&&(l.current.innerText=`${o(w)} / ${o(t)}`);const W=h.current?.getBoundingClientRect();$({time:w,position:W?m*W.width:null})};A(()=>{if(!s){S.current=null;return}const m=R=>{if(S.current!==null&&R.pointerId!==S.current||!t)return;const W=z(R.clientX);d.current.onScrubMove(W);const Q=W*t,D=Q/t*100||0;L.current&&(L.current.style.width=`${D}%`),f.current&&(f.current.style.left=`${D}%`),l?.current&&(l.current.innerText=`${o(Q)} / ${o(t)}`);const ee=h.current?.getBoundingClientRect();$({time:Q,position:ee?W*ee.width:null})},w=R=>{S.current!==null&&R.pointerId!==S.current||(S.current=null,u.current=!0,R.pointerType!=="mouse"&&$({time:0,position:null}),d.current.onScrubEnd())};return document.addEventListener("pointermove",m),document.addEventListener("pointerup",w),document.addEventListener("pointercancel",w),()=>{document.removeEventListener("pointermove",m),document.removeEventListener("pointerup",w),document.removeEventListener("pointercancel",w)}},[s,t,o,l]);const B=m=>{if(m.pointerType==="mouse"&&m.button!==0||!n.current||!t)return;m.preventDefault(),S.current=m.pointerId;try{h.current?.setPointerCapture(m.pointerId)}catch{}y.current||_();const w=z(m.clientX);a(w),j(w)},q=m=>{if(!t||y.current||m.pointerType!=="mouse")return;const w=z(m.clientX);$({time:w*t,position:m.clientX-(h.current?.getBoundingClientRect().left??0)})},U=m=>{if(!(S.current!==null&&m.pointerId!==S.current)&&y.current){S.current=null,u.current=!0,m.pointerType!=="mouse"&&$({time:0,position:null});try{h.current?.hasPointerCapture(m.pointerId)&&h.current.releasePointerCapture(m.pointerId)}catch{}g()}};return r("div",{className:`${e.container} ${s&&e.scrubbing?e.scrubbing:""}`,ref:h,role:"slider","aria-label":"Seek","aria-valuemin":0,"aria-valuemax":Math.round(t||0),"aria-valuenow":Math.round((Number(L.current?.style.width?.replace("%",""))||0)*(t||0)/100),tabIndex:0,onClick:m=>{if(u.current){u.current=!1;return}!n.current||isNaN(t)||t===0||p(z(m.clientX))},onPointerDown:B,onPointerMove:q,onPointerUp:U,onPointerCancel:U,onMouseMove:m=>{if(s||!t)return;const w=z(m.clientX);$({time:w*t,position:m.clientX-(h.current?.getBoundingClientRect().left??0)})},onMouseLeave:()=>{s||$({time:0,position:null})},onKeyDown:m=>{if(!(!n.current||!t)&&(m.key==="ArrowRight"||m.key==="ArrowLeft")){m.preventDefault();const w=(m.key==="ArrowRight"?5:-5)/t,R=n.current.currentTime/t||0;p(Math.min(1,Math.max(0,R+w)))}},children:[N.position!==null&&r("div",{className:e.timeBubble,style:{left:N.position},children:o(N.time)}),r("div",{className:e.bar,children:[r("div",{className:e.buffered,ref:v,style:i==="full"?{width:"100%"}:void 0}),r("div",{className:e.watched,ref:L}),r("div",{className:e.thumb,ref:f,onMouseDown:m=>{m.preventDefault(),n.current&&(y.current||_())}}),E]})]})};function Ee(){try{if(typeof window>"u")return!1;const e=window.matchMedia?.("(pointer: coarse)").matches??!1,t=(navigator.maxTouchPoints??0)>0||"ontouchstart"in window;return e||t}catch{return!1}}function nt(){const[e,n]=C(Ee);return A(()=>{n(Ee());let t=null;const o=()=>n(Ee());try{t=window.matchMedia("(pointer: coarse)"),t.addEventListener?t.addEventListener("change",o):t.addListener(o)}catch{}return window.addEventListener("touchstart",o,{passive:!0,once:!0}),()=>{try{t&&(t.removeEventListener?t.removeEventListener("change",o):t.removeListener(o))}catch{}window.removeEventListener("touchstart",o)}},[]),e}const hs=450,Jo=({muted:e,volume:n,volumeIcon:t,buttonClassName:o,sliderClassName:s,onToggleMute:i,onVolumeChange:p,onExpandedChange:_})=>{const a=nt(),[g,l]=C(!1),E=b(null),h=b(!1),L=b(null),f=x(d=>{l(d),_?.(d)},[_]);A(()=>()=>{E.current&&window.clearTimeout(E.current)},[]),A(()=>{if(!g)return;const d=N=>{L.current&&!L.current.contains(N.target)&&f(!1)};return document.addEventListener("pointerdown",d),()=>document.removeEventListener("pointerdown",d)},[g,f]);const v=e?0:n,S=()=>{h.current=!1,E.current&&window.clearTimeout(E.current),E.current=window.setTimeout(()=>{h.current=!0,f(!0)},hs)},u=()=>{E.current&&(window.clearTimeout(E.current),E.current=null)},y=d=>{if(d.stopPropagation(),h.current){h.current=!1;return}if(a){g?i():f(!0);return}i()};return r("div",{ref:L,className:ce.volumeWrap,"data-expanded":g?"true":"false",onContextMenu:d=>d.preventDefault(),children:[r("button",{type:"button",className:o,onClick:y,onPointerDown:S,onPointerUp:u,onPointerLeave:u,onContextMenu:d=>d.preventDefault(),"aria-label":e?"Unmute":"Mute","aria-expanded":g,children:t}),r("input",{type:"range",min:"0",max:"1",step:"0.05",value:v,onChange:d=>p(parseFloat(d.target.value)),onClick:d=>d.stopPropagation(),onPointerDown:d=>d.stopPropagation(),onContextMenu:d=>d.preventDefault(),className:`${ce.volumeSlider} ${s??""}`,style:{"--volume-percent":`${v*100}%`},"aria-label":"Volume"})]})},Je=280;function _s(e){return e?!!e.closest('button, input, select, textarea, a, [role="button"], [data-player-ui="true"]'):!1}const Qo=({player:e,topBar:n,centerControls:t,bottomBar:o,settingsPanel:s,overlays:i,isInteracting:p=!1,className:_,chromeDisabled:a=!1,children:g})=>{const{state:l,refs:E,actions:h}=e,L=E.playerContainerRef,v=nt()?5e3:3e3,S=b(0),u=b(null),y=b(p);y.current=p;const d=x(()=>{const B=h.inactivityTimer.current;B&&(window.clearTimeout(B),h.inactivityTimer.current=null)},[h]),N=x(()=>{d(),l.isPlaying&&(y.current||l.useNativeControls||(h.inactivityTimer.current=window.setTimeout(()=>{if(y.current)return;h.setShowControls(!1);const B=L.current;B&&l.isFullscreen&&(B.style.cursor="none")},v)))},[h,d,L,v,l.isFullscreen,l.isPlaying,l.useNativeControls]),$=x(()=>{const B=L.current;B&&(B.style.cursor="default"),!l.showControls&&!l.useNativeControls&&h.setShowControls(!0),N()},[h,L,N,l.showControls,l.useNativeControls]);A(()=>{if(l.showControls){if(!l.isPlaying){d();return}if(p||l.isScrubbing||l.showSettings||l.showVolumeSlider){h.setShowControls(!0),d();return}N()}},[h,d,p,N,l.isPlaying,l.isScrubbing,l.showControls,l.showSettings,l.showVolumeSlider]),A(()=>()=>d(),[d]);const z=x(B=>{const q=B.target;if(_s(q))return;const U=Date.now(),m=U-S.current<Je;if(S.current=U,m){u.current&&(window.clearTimeout(u.current),u.current=null),h.toggleFullscreen();return}u.current&&window.clearTimeout(u.current),u.current=window.setTimeout(()=>{u.current=null,h.setShowControls(!l.showControls),l.showControls?N():$()},Je)},[h,N,l.showControls,$]);A(()=>()=>{u.current&&window.clearTimeout(u.current)},[]);const j=l.showControls||l.isScrubbing||l.showSettings||l.showVolumeSlider;return r("div",{ref:L,className:`${ce.shell} ${l.isFullscreen?ce.shellFullscreen:""} ${_??""}`,onContextMenu:B=>B.preventDefault(),onPointerMove:B=>{B.pointerType==="mouse"&&$()},onMouseLeave:()=>{window.matchMedia?.("(hover: hover) and (pointer: fine)").matches&&l.isPlaying&&!y.current&&h.setShowControls(!1)},children:[r("div",{className:ce.stage,onClick:z,onContextMenu:B=>B.preventDefault(),children:g}),i,!a&&!l.useNativeControls&&r("div",{className:ce.uiLayer,onContextMenu:B=>B.preventDefault(),children:[r("div",{"data-player-ui":"true",children:n}),j&&t&&r("div",{"data-player-ui":"true",children:t}),r("div",{"data-player-ui":"true",children:o}),s&&r("div",{"data-player-ui":"true",children:s})]})]})},vs="_statusArea_1xccu_1",ys="_toggleBtn_1xccu_20",bs="_shortcuts_1xccu_46",ws="_shortcutGroup_1xccu_56",Ss="_shortcut_1xccu_46",Cs="_key_1xccu_70",ks="_label_1xccu_91",P={statusArea:vs,toggleBtn:ys,shortcuts:bs,shortcutGroup:ws,shortcut:Ss,key:Cs,label:ks},Yo=({showTheater:e=!0})=>{const[n,t]=C(!1);return r("div",{className:P.statusArea,children:[r("button",{type:"button",className:P.toggleBtn,onClick:()=>t(o=>!o),"aria-expanded":n,"aria-controls":"player-shortcuts",children:[r(J,{name:"keyboard",size:14}),r("span",{children:"Keyboard Shortcuts"}),n?r(J,{name:"chevron-up",size:12}):r(J,{name:"chevron-down",size:12})]}),n&&r("div",{id:"player-shortcuts",className:P.shortcuts,children:[r("div",{className:P.shortcutGroup,children:[r("div",{className:P.shortcut,children:[r("span",{className:P.key,children:"↑"}),r("span",{className:P.key,children:"↓"}),r("span",{className:P.label,children:"Volume"})]}),r("div",{className:P.shortcut,children:[r("span",{className:P.key,children:"←"}),r("span",{className:P.key,children:"→"}),r("span",{className:P.label,children:"Seek"})]})]}),r("div",{className:P.shortcutGroup,children:[r("div",{className:P.shortcut,children:[r("span",{className:P.key,children:"Space"}),r("span",{className:P.label,children:"Play/Pause"})]}),r("div",{className:P.shortcut,children:[r("span",{className:P.key,children:"F"}),r("span",{className:P.label,children:"Fullscreen"})]}),r("div",{className:P.shortcut,children:[r("span",{className:P.key,children:"M"}),r("span",{className:P.label,children:"Mute"})]}),e&&r("div",{className:P.shortcut,children:[r("span",{className:P.key,children:"T"}),r("span",{className:P.label,children:"Theater"})]}),r("div",{className:P.shortcut,children:[r("span",{className:P.key,children:"N"}),r("span",{className:P.label,children:"Next"})]})]})]})]})},Es="_episodeListContainer_9tyin_1",Ls="_drawerContainer_9tyin_9",Ts="_episodeListHeader_9tyin_14",Bs="_drawerHeader_9tyin_20",xs="_episodeListTitle_9tyin_29",Ns="_rangeSelector_9tyin_41",Is="_rangeButton_9tyin_47",Ps="_active_9tyin_70",Ms="_episodeList_9tyin_1",As="_drawerList_9tyin_89",$s="_episodeItem_9tyin_118",Fs="_watched_9tyin_145",Rs="_episodeThumb_9tyin_167",Ds="_episodeText_9tyin_176",Os="_episodeLabel_9tyin_184",qs="_episodeSub_9tyin_189",M={episodeListContainer:Es,drawerContainer:Ls,episodeListHeader:Ts,drawerHeader:Bs,episodeListTitle:xs,rangeSelector:Ns,rangeButton:Is,active:Ps,episodeList:Ms,drawerList:As,episodeItem:$s,watched:Fs,episodeThumb:Rs,episodeText:Ds,episodeLabel:Os,episodeSub:qs},Hs=({episodes:e,currentEpisode:n,watchedEpisodes:t=[],onEpisodeClick:o,variant:s="sidebar",title:i="Episodes",header:p})=>{const[_,a]=C(0),g=b(null),l=pe(()=>e.map(f=>typeof f=="string"?{id:f,label:`Episode ${f}`}:f),[e]),E=pe(()=>new Set(t),[t]);A(()=>{const f=g.current;if(!f)return;let v=f.parentElement;for(;v;){const y=window.getComputedStyle(v);if((y.overflowY==="auto"||y.overflowY==="scroll")&&v.scrollHeight>v.clientHeight)break;v=v.parentElement}if(!v)return;const S=v.getBoundingClientRect(),u=f.getBoundingClientRect();v.scrollTop+=u.top+u.height/2-(S.top+v.clientHeight/2)},[n,_]);const h=pe(()=>{if(l.length<=100)return[];const f=[];for(let v=0;v<l.length;v+=100){const S=v+1,u=Math.min(v+100,l.length);f.push(`${S}-${u}`)}return f},[l]),L=pe(()=>{if(h.length===0)return l;const f=h[_];if(!f)return l;const[v,S]=f.split("-"),u=parseInt(v,10),y=parseInt(S,10);return l.slice(u-1,y)},[l,h,_]);return r("div",{className:`${M.episodeListContainer} ${s==="drawer"?M.drawerContainer:""}`,children:[r("div",{className:`${M.episodeListHeader} ${s==="drawer"?M.drawerHeader:""}`,children:[p,r("h3",{className:M.episodeListTitle,children:i}),h.length>0&&r("div",{className:M.rangeSelector,children:h.map((f,v)=>r("button",{className:`${M.rangeButton} ${_===v?M.active:""}`,onClick:()=>a(v),children:f},f))})]}),r("div",{className:`${M.episodeList} ${s==="drawer"?M.drawerList:""}`,children:L.map(f=>{const v=f.id===n,S=E.has(f.id)||f.watched===!0;return r("div",{ref:v?g:void 0,className:`${M.episodeItem} ${S?M.watched:""} ${v?M.active:""}`,onClick:()=>o(f.id),children:[f.thumbnail&&r("img",{src:f.thumbnail,alt:"",loading:"lazy",decoding:"async",className:M.episodeThumb}),r("span",{className:M.episodeText,children:[r("span",{className:M.episodeLabel,children:f.label??`Episode ${f.id}`}),f.sublabel&&r("span",{className:M.episodeSub,children:f.sublabel})]})]},f.id)})})]})},Zo=({variant:e="sidebar",count:n=12})=>r("div",{className:`${M.episodeListContainer} ${e==="drawer"?M.drawerContainer:""}`,children:[r("div",{className:`${M.episodeListHeader} ${e==="drawer"?M.drawerHeader:""}`,children:[r("h3",{className:M.episodeListTitle,children:"Episodes"}),r("div",{className:M.rangeSelector,children:[r(ye,{width:"60px",height:"28px",variant:"rectangular"}),r(ye,{width:"60px",height:"28px",variant:"rectangular"}),r(ye,{width:"60px",height:"28px",variant:"rectangular"})]})]}),r("div",{className:`${M.episodeList} ${e==="drawer"?M.drawerList:""}`,children:Array.from({length:n}).map((t,o)=>r("div",{className:M.episodeItem,style:{border:"none",background:"transparent"},children:r(ye,{width:"120px",height:"1.2rem",variant:"text"})},o))})]}),Vs="_shell_cys6s_1",zs="_overlay_cys6s_10",Ws="_drawer_cys6s_21",Us="_handle_cys6s_56",Ks="_header_cys6s_64",js="_headerCopy_cys6s_73",Gs="_kicker_cys6s_79",Xs="_title_cys6s_87",Js="_closeBtn_cys6s_94",Qs="_body_cys6s_116",X={shell:Vs,overlay:zs,drawer:Ws,handle:Us,header:Ks,headerCopy:js,kicker:Gs,title:Xs,closeBtn:Js,body:Qs};function ec({isOpen:e,onClose:n,episodes:t,currentEpisode:o,watchedEpisodes:s=[],onEpisodeClick:i,title:p,header:_}){return A(()=>{if(!e)return;const a=l=>{l.key==="Escape"&&n()},g=document.body.style.overflow;return document.body.style.overflow="hidden",document.addEventListener("keydown",a),()=>{document.body.style.overflow=g,document.removeEventListener("keydown",a)}},[e,n]),e?At(r("div",{className:X.shell,role:"dialog","aria-modal":"true","aria-label":"Episode picker",children:[r("button",{className:X.overlay,type:"button",onClick:n,"aria-label":"Close episodes"}),r("aside",{className:X.drawer,children:[r("div",{className:X.handle}),r("div",{className:X.header,children:[r("div",{className:X.headerCopy,children:[r("span",{className:X.kicker,children:"Episode picker"}),r("h3",{className:X.title,children:"Choose an episode"})]}),r("button",{className:X.closeBtn,type:"button",onClick:n,"aria-label":"Close",children:r(J,{name:"times"})})]}),r("div",{className:X.body,children:r(Hs,{episodes:t,currentEpisode:o,watchedEpisodes:s,onEpisodeClick:i,variant:"drawer",title:p,header:_})})]})]}),document.body):null}const Ys="_sourceSelectionContainer_c5tub_76",Zs="_providerSelectContainer_c5tub_89",eo="_providerSelect_c5tub_89",to="_sourceSelect_c5tub_76",no="_sourceButtons_c5tub_145",ro="_sourceButton_c5tub_145",so="_active_c5tub_170",tc={sourceSelectionContainer:Ys,providerSelectContainer:Zs,providerSelect:eo,sourceSelect:to,sourceButtons:no,sourceButton:ro,active:so};function Pe(){return document}function rt(e){const n=Pe();if(document.fullscreenElement)return document.fullscreenElement;if(n.webkitFullscreenElement)return n.webkitFullscreenElement;const t=e;return t?.webkitDisplayingFullscreen?t:null}function ae(e){return rt(e)!==null}async function oo(e,n){if(rt(n))return;const t=e;try{if(typeof e.requestFullscreen=="function"){await e.requestFullscreen();return}if(typeof t.webkitRequestFullscreen=="function"){await t.webkitRequestFullscreen();return}if(typeof t.webkitRequestFullScreen=="function"){await t.webkitRequestFullScreen();return}}catch{}const o=n;if(o&&typeof o.webkitEnterFullscreen=="function"){if(o.webkitSupportsFullscreen===!1)return;try{await o.webkitEnterFullscreen()}catch{}}}async function co(e){const n=Pe();try{if(document.fullscreenElement&&typeof document.exitFullscreen=="function"){await document.exitFullscreen();return}if(n.webkitFullscreenElement&&typeof n.webkitExitFullscreen=="function"){await n.webkitExitFullscreen();return}}catch{}const t=e;if(t?.webkitDisplayingFullscreen&&typeof t.webkitExitFullscreen=="function"){try{t.webkitExitFullscreen()}catch{}return}try{typeof n.webkitCancelFullScreen=="function"?n.webkitCancelFullScreen():!document.fullscreenElement&&typeof document.exitFullscreen=="function"&&(document.fullscreenElement??n.webkitFullscreenElement)&&await document.exitFullscreen()}catch{}}async function ao(e,n){!e&&!n||(ae(n)?await co(n):e&&await oo(e,n))}function io(e,n){const t=()=>{try{n(ae(e()))}catch{}},o=Pe(),s=t;o.addEventListener("fullscreenchange",t),o.addEventListener("webkitfullscreenchange",s),o.addEventListener("webkitbeginfullscreen",s,!0),o.addEventListener("webkitendfullscreen",s,!0);const i=e();return i?.addEventListener("webkitbeginfullscreen",s),i?.addEventListener("webkitendfullscreen",s),()=>{o.removeEventListener("fullscreenchange",t),o.removeEventListener("webkitfullscreenchange",s),o.removeEventListener("webkitbeginfullscreen",s,!0),o.removeEventListener("webkitendfullscreen",s,!0),i?.removeEventListener("webkitbeginfullscreen",s),i?.removeEventListener("webkitendfullscreen",s)}}const nc=({skipIntervals:e,showId:n,episodeNumber:t,episodeCount:o,sourceType:s,showMeta:i})=>{const p=qt(),_=Ft(),a=b(null),g=b(null),l=b(null),E=b(null),h=b(!1),L=b(null),f=b(0),v=b(1),S=b({mouse:!1,keyboard:!1}),u=b(null),y=b(null),d=b(!1),N=b(Math.random().toString(36).substring(2)),[$,z]=C(!1),[j,B]=C(()=>{try{return localStorage.getItem("playerMuted")==="true"}catch{return!1}}),[q,U]=C(()=>{try{const c=parseFloat(localStorage.getItem("playerVolume")||"");return isNaN(c)?1:Math.max(0,Math.min(1,c))}catch{return 1}}),[m,w]=C(!1),[R,W]=C(0),[Q,D]=C(!0),[ee,Me]=C(!1),[st,Ae]=C({time:0,position:null}),[we,ot]=C(localStorage.getItem("autoSkipEnabled")==="true"),[ct,Se]=C(null),[at,it]=C(!1),[te]=C(us),[lt,ut]=C(te.fontSize),[dt,pt]=C(te.position),[ft,mt]=C(te.bgOpacity),[gt,ht]=C(te.bgColor),[_t,vt]=C(te.textColor),[yt,bt]=C(te.edge),[wt,St]=C(te.bold),[Ct,kt]=C([]),[Et,Lt]=C(null),[Tt,Bt]=C(!1),[xt,Nt]=C(!1),[fe,G]=C(!1),[It,me]=C(!1),[Pt,$e]=C(()=>{try{return localStorage.getItem("playerUseNativeControls")==="true"}catch{return!1}}),ie=b(!1),Ce=b(-1),ge=x(()=>{const c=a.current;return!n||!t||!i?.name?null:{showId:n,episodeNumber:t,episodeCount:o,currentTime:c?c.currentTime:0,duration:c?c.duration:0,showName:i.name,showThumbnail:i.thumbnail,nativeName:i.names?.native,englishName:i.names?.english,genres:Array.isArray(i.genres)?i.genres.map(T=>typeof T=="string"?T:T?.name).filter(Boolean):void 0,popularityScore:i.score,type:i.type,isPlaying:c?!c.paused:!0,sessionId:N.current,isAdult:i.isAdult}},[n,t,o,i]),O=x((c=!1,T=!1)=>{if(ie.current)return!1;const I=ge();if(!I)return!1;const k=a.current;if(!k&&s!=="iframe")return!1;const F=k?k.currentTime>=k.duration*.8:!1;let H=k?k.currentTime:0;if(c&&F&&(H=k?k.duration:0),!T){if(H===0&&!F)return!1;const K=k?Math.abs(H-Ce.current):0;if(!c&&k&&H!==k.duration&&K<5)return!1}return I.currentTime=H,Ce.current=H,c?(async()=>{try{await Xe.progress.updateProgress.mutate(I),p.invalidateQueries({queryKey:["video-sources",n,t]}),p.invalidateQueries({queryKey:["allContinueWatching"]}),p.invalidateQueries({queryKey:["thisWeekSchedule"]}),p.invalidateQueries(_.continueWatching.pathFilter())}catch(K){console.error("Failed to update progress:",K)}})():Rt("progress.updateProgress",I).catch(K=>console.error("Failed to update progress:",K)),!0},[ge,s,p,n,t,_.continueWatching]);A(()=>{const c=a.current;c&&(c.volume=q,c.muted=j)},[a,q,j]),A(()=>{const c=()=>{ie.current||O(!0)};window.addEventListener("beforeunload",c);const T=L,I=E;return()=>{window.removeEventListener("beforeunload",c),ie.current||O(!0),T.current&&clearTimeout(T.current),I.current&&clearTimeout(I.current)}},[O]);const he=x(()=>{const c=g.current;c&&ao(c,a.current).catch(T=>{console.error(`Error attempting to toggle full-screen mode: ${T?.message} (${T?.name})`)})},[]),_e=x(()=>{a.current&&(a.current.paused?a.current.play().catch(()=>console.warn("Autoplay was prevented.")):(a.current.pause(),D(!0)))},[D]),se=x(()=>{const c=a.current;if(!c)return;const T=S.current.mouse||S.current.keyboard;c.playbackRate=T?2:v.current},[]),le=x(c=>{S.current.mouse!==c&&(S.current.mouse=c,me(c||S.current.keyboard),se())},[se]),oe=x(c=>{S.current.keyboard!==c&&(S.current.keyboard=c,me(S.current.mouse||c),se())},[se]),ue=x(c=>{a.current&&(a.current.currentTime+=c,L.current&&clearTimeout(L.current),L.current=setTimeout(()=>{O(!1,!0)},1500),D(!0))},[O,D]),ve=x(()=>{if(!a.current)return;const c=!a.current.muted;a.current.muted=c,B(c),localStorage.setItem("playerMuted",String(c)),!c&&a.current.volume===0&&(a.current.volume=.5,U(.5),localStorage.setItem("playerVolume",String(.5))),D(!0)},[D]);A(()=>{const c=()=>a.current,T=io(c,I=>{w(I),I&&D(!0)});return w(ae(c())),T},[D]),A(()=>{const c=I=>{if(!I.target.closest('input, textarea, button, select, a, [role="button"], [contenteditable="true"]')){if(I.code==="Space"){if(I.preventDefault(),d.current)return;d.current=!0,y.current&&clearTimeout(y.current),y.current=window.setTimeout(()=>{y.current=null,d.current&&oe(!0)},180);return}switch(I.key.toLowerCase()){case"f":he();break;case"m":ve();break;case"arrowright":ue(10);break;case"arrowleft":ue(-10);break;case"arrowup":if(I.preventDefault(),a.current){const F=Math.min(1,a.current.volume+.1);a.current.volume=F,U(F)}break;case"arrowdown":if(I.preventDefault(),a.current){const F=Math.max(0,a.current.volume-.1);a.current.volume=F,U(F)}break}}},T=I=>{if(I.code==="Space"){if(I.preventDefault(),d.current=!1,S.current.keyboard){oe(!1);return}y.current&&(clearTimeout(y.current),y.current=null,_e())}};return document.addEventListener("keydown",c),document.addEventListener("keyup",T),()=>{document.removeEventListener("keydown",c),document.removeEventListener("keyup",T),y.current&&(clearTimeout(y.current),y.current=null),d.current=!1,oe(!1),me(!1)}},[oe,_e,he,ve,ue]),A(()=>{const c=H=>H?!!H.closest('[data-speed-boost-ignore="true"], [data-player-ui="true"], button, input, select, textarea, a, [role="button"], [role="slider"], [contenteditable="true"]'):!0,T=H=>{if(H.button!==0)return;const Y=H.target;if(!Y||c(Y))return;const K=g.current;!K||!K.contains(Y)||(u.current&&clearTimeout(u.current),u.current=window.setTimeout(()=>{u.current=null,le(!0)},180))},I=H=>{const Y=H.target;if(!Y||c(Y))return;const K=g.current;!K||!K.contains(Y)||(u.current&&clearTimeout(u.current),u.current=window.setTimeout(()=>{u.current=null,le(!0)},180))},k=()=>{u.current&&(clearTimeout(u.current),u.current=null),le(!1)},F=()=>{u.current&&(clearTimeout(u.current),u.current=null),d.current=!1,y.current&&(clearTimeout(y.current),y.current=null),oe(!1),le(!1),me(!1)};return document.addEventListener("mousedown",T),document.addEventListener("mouseup",k),document.addEventListener("touchstart",I,{passive:!0}),document.addEventListener("touchend",k),document.addEventListener("touchcancel",k),document.addEventListener("pointerup",k),document.addEventListener("pointercancel",k),window.addEventListener("blur",F),()=>{document.removeEventListener("mousedown",T),document.removeEventListener("mouseup",k),document.removeEventListener("touchstart",I),document.removeEventListener("touchend",k),document.removeEventListener("touchcancel",k),document.removeEventListener("pointerup",k),document.removeEventListener("pointercancel",k),window.removeEventListener("blur",F),u.current&&(clearTimeout(u.current),u.current=null)}},[oe,le]);const Fe=x(()=>{z(!0),G(!1),setTimeout(()=>O(!1,!0),50)},[O]),Re=x(()=>{z(!0),G(!1)},[]),De=x(()=>{const c=a.current;c&&!c.paused&&c.readyState>=3&&!c.seeking||G(!0)},[]),Oe=x(()=>{G(!1)},[]),qe=x(()=>{z(!1),G(!1),D(!0),setTimeout(()=>O(!1,!0),50)},[O]),He=b(!1);He.current=fe,A(()=>{if(!fe)return;let c=a.current?.currentTime??0,T=0;const I=window.setInterval(()=>{const k=a.current;if(!k)return;T+=1;const F=k.currentTime,H=F!==c;if(c=F,!(k.paused||k.seeking)){if(H||k.readyState>=3){G(!1);return}T>=24&&k.readyState>=2&&!k.ended&&G(!1)}},500);return()=>window.clearInterval(I)},[fe]),A(()=>{ie.current=!1,Ce.current=-1,f.current=0,N.current=Math.random().toString(36).substring(2),W(0),G(!1)},[n,t]);const Ve=x(()=>{W(0),G(!1)},[]);A(()=>{const c=N.current;return()=>{Dt(c)}},[n,t]),A(()=>{if(s!=="iframe")return;O(!1,!0);const c=setInterval(()=>{O(!1,!0)},6e4);return()=>clearInterval(c)},[s,O]);const ze=x(()=>{W(a.current?.duration||0),se()},[se]),We=x(()=>{if(a.current){const c=a.current.muted,T=a.current.volume;B(c),U(T),localStorage.setItem("playerMuted",String(c)),localStorage.setItem("playerVolume",String(T))}},[]),Ue=x(()=>{},[]),Ke=x(()=>{const c=a.current;if(!c)return;He.current&&!c.paused&&!c.seeking&&G(!1);const T=c.currentTime||0,I=Date.now();I-f.current>6e4&&O()&&(f.current=I);const k=e.find(F=>T>=F.start_time&&T<F.end_time)||null;Se(F=>F?.skip_id!==k?.skip_id?k:F),we&&k&&!c.paused&&(c.currentTime=k.end_time,Se(null))},[e,we,O]),je=x(()=>{const c=ge();c&&(c.currentTime=c.duration,Xe.progress.updateProgress.mutate(c).then(()=>{p.invalidateQueries({queryKey:["video-sources",n,t]}),p.invalidateQueries({queryKey:["allContinueWatching"]})}).catch(T=>console.error("Failed to send final progress:",T)))},[ge,p,n,t]),Ge=x(()=>{ie.current=!0,je()},[je]);A(()=>{const c=()=>{ee&&(Me(!1),Ae({time:0,position:null}),h.current&&a.current?.play(),O(!1,!0))};return ee&&(document.addEventListener("mouseup",c),document.addEventListener("pointerup",c),document.addEventListener("touchend",c),document.addEventListener("pointercancel",c),document.addEventListener("touchcancel",c)),()=>{document.removeEventListener("mouseup",c),document.removeEventListener("pointerup",c),document.removeEventListener("touchend",c),document.removeEventListener("pointercancel",c),document.removeEventListener("touchcancel",c)}},[ee,O]);const Mt=pe(()=>({togglePlay:_e,seek:ue,toggleMute:ve,toggleFullscreen:he,onPlay:Fe,onPause:qe,onLoadedMetadata:ze,formatTime:Ot,onVolumeChange:We,onProgress:Ue,onTimeUpdate:Ke,onEnded:Ge,setShowControls:D,setIsScrubbing:Me,setHoverTime:Ae,setIsAutoSkipEnabled:ot,setCurrentSkipInterval:Se,setShowCCMenu:it,setSubtitleFontSize:ut,setSubtitlePosition:pt,setSubtitleBgOpacity:mt,setSubtitleBgColor:ht,setSubtitleTextColor:vt,setSubtitleEdge:bt,setSubtitleBold:St,setAvailableSubtitles:kt,setActiveSubtitleTrack:Lt,setShowSettings:Bt,setShowVolumeSlider:Nt,wasPlayingBeforeScrub:h,inactivityTimer:E,setIsFullscreen:w,onWaiting:De,onPlaying:Re,onCanPlay:Oe,sendProgressUpdate:O,setUseNativeControls:$e,resetMediaState:Ve}),[_e,ue,ve,he,Fe,qe,ze,We,Ue,Ke,Ge,w,De,Re,Oe,O,$e,Ve]);return{refs:{videoRef:a,playerContainerRef:g,progressBarRef:l},state:{isPlaying:$,isMuted:j,volume:q,isFullscreen:m,duration:R,showControls:Q,isScrubbing:ee,hoverTime:st,isAutoSkipEnabled:we,currentSkipInterval:ct,showCCMenu:at,subtitleFontSize:lt,subtitlePosition:dt,subtitleBgOpacity:ft,subtitleBgColor:gt,subtitleTextColor:_t,subtitleEdge:yt,subtitleBold:wt,availableSubtitles:Ct,activeSubtitleTrack:Et,showSettings:Tt,showVolumeSlider:xt,isBuffering:fe,isSpeedBoostActive:It,useNativeControls:Pt},actions:Mt}};function lo(){try{return typeof navigator<"u"&&/android/i.test(navigator.userAgent)}catch{return!1}}function rc(e,n){const{refs:t,actions:o}=e,s=b(n);s.current=n;const i=b(!1),p=b(!1),_=a=>{try{if(a)return a.matches}catch{}try{return window.innerWidth>window.innerHeight}catch{return!1}};A(()=>{if(!lo())return;let a=null;const g=()=>{const l=t.playerContainerRef.current;if(_(a)){if(!s.current||!l||ae(t.videoRef.current)||p.current)return;i.current=!0,o.toggleFullscreen()}else p.current=!1,i.current&&(i.current=!1,ae(t.videoRef.current)&&o.toggleFullscreen())};try{a=window.matchMedia("(orientation: landscape)"),a.addEventListener?a.addEventListener("change",g):a.addListener(g)}catch{}return g(),()=>{try{a&&(a.removeEventListener?a.removeEventListener("change",g):a.removeListener(g))}catch{}}},[o,t.playerContainerRef,t.videoRef,n]),A(()=>{const a=()=>{if(!ae(t.videoRef.current)){i.current=!1;try{window.matchMedia("(orientation: landscape)").matches&&(p.current=!0)}catch{p.current=!0}}};return document.addEventListener("fullscreenchange",a),document.addEventListener("webkitfullscreenchange",a),()=>{document.removeEventListener("fullscreenchange",a),document.removeEventListener("webkitfullscreenchange",a)}},[t.videoRef])}const uo=e=>Math.max(8,Math.min(40,Math.ceil(e/16.7)+4));function sc({videoRef:e,canvasRef:n,delayMs:t,enabled:o}){const s=b(t);s.current=t;const i=b([]),p=b(-1),_=b(-1),a=b(!1),g=b(0),l=b(null);A(()=>{const E=u=>{if(u)try{u.close()}catch{}},h=()=>{for(const u of i.current)E(u.bitmap);i.current=[]};if(!o){h(),p.current=-1,_.current=-1,a.current=!1,g.current=0;return}let L=!1;const f=()=>{l.current!==null&&(cancelAnimationFrame(l.current),l.current=null)},v=()=>{L||(f(),l.current=requestAnimationFrame(()=>{S()}))};async function S(){if(L)return;const u=e.current,y=n.current;if(!u||!y||u.videoWidth===0){v();return}if(u.paused||u.ended||document.hidden||u.readyState<HTMLMediaElement.HAVE_CURRENT_DATA){v();return}const d=u.getVideoPlaybackQuality().totalVideoFrames;if(d===p.current){v();return}(u.seeking||_.current>=0&&Math.abs(u.currentTime-_.current)>.5)&&(h(),a.current=!1,g.current=0,p.current=-1),_.current=u.currentTime,(y.width!==u.videoWidth||y.height!==u.videoHeight)&&(y.width=u.videoWidth,y.height=u.videoHeight);const N=Math.max(0,s.current||0);N>g.current&&(a.current=!1);try{const $=await createImageBitmap(u);if(L){E($);return}p.current=d;const z=performance.now(),j=y.getContext("2d"),B=w=>{j&&j.drawImage(w,0,0,y.width,y.height)};if(N<=0){h(),a.current=!1,g.current=0,B($),E($),v();return}const q=i.current;q.push({bitmap:$,capture:z});const U=uo(N);for(;q.length>U;)E(q.shift()?.bitmap);let m=-1;for(let w=q.length-1;w>=0;w--)if(z-q[w].capture>=N){m=w;break}if(m!==-1){for(let R=0;R<m;R++)E(q.shift()?.bitmap);const w=q.shift();w?(B(w.bitmap),E(w.bitmap),a.current=!0,g.current=N):B($)}else if(!a.current)B($);else{const w=q.shift();w?(B(w.bitmap),E(w.bitmap)):B($)}}catch{}v()}return v(),()=>{L=!0,f();for(const u of i.current)try{u.bitmap.close()}catch{}i.current=[]}},[o,e,n])}const Qe=(e,n)=>{try{localStorage.setItem("playerVideoDelayMs",String(e)),localStorage.setItem("playerVideoDelayEnabled",String(n))}catch{}},Ye=e=>{try{localStorage.setItem("playerVideoDelayEnabled",String(e))}catch{}};function oc(e,n){const[t,o]=C(()=>{try{const d=Number(localStorage.getItem("playerVideoDelayMs"));if(Number.isFinite(d)&&d>=0&&d<=500)return Math.round(d)}catch{}return 180}),[s,i]=C(()=>{try{return localStorage.getItem("playerVideoDelayEnabled")==="true"}catch{return!1}}),[p,_]=C(!1),[a,g]=C(!1),l=b(null),E=b(null),h=d=>{const N=Math.max(0,Math.min(500,Math.round(d)));o(N);try{localStorage.setItem("playerVideoDelayMs",String(N))}catch{}},L=d=>{i(d),Ye(d)},f=x(()=>{g(!1),_(!1)},[]);return{videoDelayMs:t,videoDelayEnabled:s,setDelayEnabled:L,handleVideoDelayChange:h,isCalibrating:p,testClipActive:a,stopCalibration:f,openAvSyncCalibrator:()=>{l.current={enabled:s,ms:t},i(!0),Ye(!0),n?.(),_(!0)},cancelAvSyncCalibrator:()=>{const d=l.current;l.current=null,d&&(o(d.ms),i(d.enabled),Qe(d.ms,d.enabled)),g(!1),_(!1)},applyAvSyncCalibrator:()=>{l.current=null,i(!0),Qe(t,!0),g(!1),_(!1)},toggleTestClip:()=>{if(a){g(!1);return}const d=e.current;d&&!isNaN(d.currentTime)&&(E.current=d.currentTime),g(!0)},calibReturnRef:E,effectiveVideoDelayMs:s?t:0}}function cc(){const[e,n]=C(()=>{try{return localStorage.getItem("playerTheaterMode")==="true"}catch{return!1}});A(()=>{try{e?document.body.classList.add("theater-mode"):document.body.classList.remove("theater-mode")}catch(s){console.error(s)}return()=>{try{document.body.classList.remove("theater-mode")}catch(s){console.error(s)}}},[e]);const t=x(()=>{n(s=>{const i=!s;try{localStorage.setItem("playerTheaterMode",i.toString())}catch{}return i})},[]),o=x(s=>{if(e&&s.target===s.currentTarget){n(!1);try{localStorage.setItem("playerTheaterMode","false")}catch{}}},[e]);return{isTheaterMode:e,toggleTheaterMode:t,handleLayoutClick:o}}const ne={enabled:!0,blur:60,saturation:150,brightness:70,opacity:60};function po(){try{const e=localStorage.getItem("playerAmbientLight");if(!e)return ne;const n=JSON.parse(e),t=(o,s,i,p)=>{const _=Number(o);return Number.isFinite(_)?Math.max(i,Math.min(p,_)):s};return{enabled:n.enabled??ne.enabled,blur:t(n.blur,ne.blur,0,120),saturation:t(n.saturation,ne.saturation,0,200),brightness:t(n.brightness,ne.brightness,20,120),opacity:t(n.opacity,ne.opacity,10,100)}}catch{return ne}}function ac(){const[e,n]=C(po),t=x(o=>{n(s=>{const i={...s,...o};try{localStorage.setItem("playerAmbientLight",JSON.stringify(i))}catch{}return i})},[]);return{settings:e,update:t}}const Le=160,Te=90,fo=120,ic=({videoRef:e,active:n,settings:t,className:o})=>{const s=b(null);return A(()=>{if(!n)return;const i=s.current,p=e.current;if(!i||!p)return;const _=i.getContext("2d",{alpha:!1});if(!_)return;let a=0,g=0,l=!1;const E=()=>{if(!(p.readyState<2||!p.videoWidth))try{const f=p.videoWidth,v=p.videoHeight,S=Le/Te,u=f/v;let y=f,d=v,N=0,$=0;u>S?(y=v*S,N=(f-y)/2):(d=f/S,$=(v-d)/2),_.drawImage(p,N,$,y,d,0,0,Le,Te)}catch{}},h=f=>{l||p.paused||(a=requestAnimationFrame(h),!(f-g<fo)&&(g=f,E()))},L=()=>{l||(cancelAnimationFrame(a),g=0,a=requestAnimationFrame(h))};return p.addEventListener("play",L),p.addEventListener("seeked",E),p.addEventListener("loadeddata",E),a=requestAnimationFrame(h),()=>{l=!0,cancelAnimationFrame(a),p.removeEventListener("play",L),p.removeEventListener("seeked",E),p.removeEventListener("loadeddata",E)}},[n,e]),n?r("canvas",{ref:s,width:Le,height:Te,"aria-hidden":"true",className:o??Gr.theaterAmbient,style:{filter:`blur(${t.blur}px) saturate(${t.saturation}%) brightness(${t.brightness}%)`,opacity:t.opacity/100}}):null},mo="_row_1fq55_1",go="_rowHeader_1fq55_9",ho="_rowLabel_1fq55_17",_o="_rowValue_1fq55_28",vo="_slider_1fq55_36",yo="_swatches_1fq55_99",bo="_swatch_1fq55_99",wo="_swatchPicked_1fq55_114",So="_colorInput_1fq55_120",Co="_segmented_1fq55_131",V={row:mo,rowHeader:go,rowLabel:ho,rowValue:_o,slider:vo,swatches:yo,swatch:bo,swatchPicked:wo,colorInput:So,segmented:Co},ko=({label:e,display:n,min:t,max:o,step:s,value:i,percent:p,onChange:_,onCommit:a})=>r("div",{className:V.row,children:[r("div",{className:V.rowHeader,children:[r("span",{className:V.rowLabel,children:e}),r("span",{className:V.rowValue,children:n})]}),r("input",{type:"range",className:V.slider,min:t,max:o,step:s,value:i,"aria-label":e,"data-speed-boost-ignore":"true",onInput:g=>_(Number(g.target.value)),onMouseDown:g=>g.stopPropagation(),onPointerDown:g=>g.stopPropagation(),onTouchStart:g=>g.stopPropagation(),onPointerUp:a,onPointerCancel:a,onTouchEnd:a,onKeyUp:a,onBlur:a,style:{"--slider-percent":`${p}%`}})]}),lc=({label:e,colors:n,value:t,onChange:o})=>r("div",{className:V.row,children:[r("div",{className:V.rowHeader,children:r("span",{className:V.rowLabel,children:e})}),r("div",{className:V.swatches,children:[n.map(s=>r("button",{type:"button","aria-label":`${e} ${s}`,"aria-pressed":t.toLowerCase()===s.toLowerCase(),onClick:()=>o(s),className:`${V.swatch} ${t.toLowerCase()===s.toLowerCase()?V.swatchPicked:""}`,style:{backgroundColor:s}},s)),r("input",{type:"color","aria-label":`Custom ${e.toLowerCase()}`,className:V.colorInput,value:t,"data-speed-boost-ignore":"true",onInput:s=>o(s.target.value),onMouseDown:s=>s.stopPropagation(),onPointerDown:s=>s.stopPropagation(),onTouchStart:s=>s.stopPropagation()})]})]});function uc({label:e,options:n,value:t,onChange:o}){return r("div",{className:V.row,children:[r("div",{className:V.rowHeader,children:r("span",{className:V.rowLabel,children:e})}),r("div",{className:V.segmented,role:"group","aria-label":e,children:n.map(s=>r("button",{type:"button","aria-pressed":t===s,onClick:()=>o(s),children:[r("span",{children:s}),t===s&&r(J,{name:"check",size:10})]},s))})]})}const be=10,Ie=500,Be=e=>Math.max(0,Math.min(Ie,Math.round(e))),dc=({isOpen:e,ms:n,onChange:t,onApply:o,onClose:s,testClipActive:i,onTestClip:p})=>e?r("div",{role:"dialog","aria-label":"Calibrate audio video sync","data-speed-boost-ignore":"true",onClick:_=>_.stopPropagation(),style:{position:"absolute",right:8,bottom:112,width:"min(260px, calc(100% - 16px))",maxHeight:"calc(100% - 124px)",overflowY:"auto",overflowX:"hidden",zIndex:60,display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:12,borderRadius:"var(--radius-lg)",border:"1px solid var(--glass-border)",background:"rgba(18, 18, 22, 0.95)",boxShadow:"var(--glass-shadow)",backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)",boxSizing:"border-box"},children:[r("div",{style:{fontSize:"0.8rem",fontWeight:800,color:"var(--text-primary)"},children:"A/V sync"}),r("div",{children:r(re,{size:"sm",variant:"secondary",onClick:p,children:i?"Back to video":"Preview test clip"})}),r("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6,flexWrap:"wrap"},children:[r(re,{size:"sm",onClick:()=>t(Be(n-be)),"aria-label":"Decrease delay by 10 milliseconds",children:["− ",be,"ms"]}),r("div",{style:{fontSize:"1.1rem",fontWeight:800,minWidth:64,textAlign:"center"},children:[n,"ms"]}),r(re,{size:"sm",onClick:()=>t(Be(n+be)),"aria-label":"Increase delay by 10 milliseconds",children:["+ ",be,"ms"]})]}),r(ko,{label:"Video delay",display:`${n}ms`,min:0,max:Ie,step:5,value:n,percent:n/Ie*100,onChange:_=>t(Be(_))}),r("div",{style:{display:"flex",gap:8,justifyContent:"center",flexWrap:"wrap"},children:[r(re,{size:"sm",variant:"secondary",onClick:s,children:"Cancel"}),r(re,{size:"sm",onClick:o,children:["Apply ",n,"ms"]})]})]}):null;export{ic as A,Mo as B,jo as C,Wo as D,Zo as E,$o as F,No as G,Io as H,lc as I,Vo as J,uc as K,Z as L,ko as M,ne as N,Yo as P,Ko as R,Xo as S,Ho as T,Jo as U,Qo as a,Go as b,tc as c,oc as d,sc as e,cc as f,Ao as g,rc as h,ss as i,ac as j,Ro as k,Po as l,zo as m,Do as n,Uo as o,Fo as p,qo as q,Oo as r,is as s,Gr as t,nc as u,Hs as v,xo as w,ce as x,dc as y,ec as z};
@@ -1,40 +0,0 @@
1
- import { createHmac } from 'node:crypto';
2
- const MEGAPLAY_CDN_TOKEN_KEY = 'MpCdnT0k3n!9f2K#xQ7vL5mR8wN1pY4s';
3
- export const MEGAPLAY_CDN_TOKEN_TTL_SECONDS = 120;
4
- export const MEGAPLAY_ORIGIN = 'https://megaplay.buzz';
5
- export function base64UrlEncode(input) {
6
- return Buffer.from(input)
7
- .toString('base64')
8
- .replace(/\+/g, '-')
9
- .replace(/\//g, '_')
10
- .replace(/=+$/, '');
11
- }
12
- export function isNexabloomMasterUrl(url) {
13
- try {
14
- const parsed = new URL(url);
15
- return (parsed.hostname.toLowerCase().endsWith('nexabloom.top') &&
16
- parsed.pathname.includes('master.m3u8'));
17
- }
18
- catch {
19
- return false;
20
- }
21
- }
22
- export function signNexabloomMasterUrl(masterUrl, ttlSeconds = MEGAPLAY_CDN_TOKEN_TTL_SECONDS) {
23
- const match = masterUrl.match(/\/([a-f0-9]{32})\/([a-f0-9]{32})\//i);
24
- if (!match)
25
- return masterUrl;
26
- const path = `${match[1].toLowerCase()}/${match[2].toLowerCase()}`;
27
- const expires = Math.floor(Date.now() / 1000) + ttlSeconds;
28
- const message = `${expires}|${path}`;
29
- const signature = base64UrlEncode(createHmac('sha256', MEGAPLAY_CDN_TOKEN_KEY).update(message).digest());
30
- const token = `${base64UrlEncode(message)}.${signature}`;
31
- try {
32
- const parsed = new URL(masterUrl);
33
- parsed.searchParams.set('token', token);
34
- return parsed.href;
35
- }
36
- catch {
37
- const separator = masterUrl.includes('?') ? '&' : '?';
38
- return `${masterUrl}${separator}token=${encodeURIComponent(token)}`;
39
- }
40
- }