@serifpersia/dango 3.7.5 → 3.7.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.
- package/README.md +1 -1
- package/client/dist/assets/{AnimeCard-BxhPLWBG.js → AnimeCard-aZA4-g8o.js} +1 -1
- package/client/dist/assets/{AnimeInfo-DcpKPBLS.js → AnimeInfo-CFGRb1OW.js} +1 -1
- package/client/dist/assets/{AnimeInfoPage-jKNSPHbX.js → AnimeInfoPage-CozJH4AM.js} +2 -2
- package/client/dist/assets/{AnimeMetaDetails-D8WIiO4b.js → AnimeMetaDetails-B3-A7O5H.js} +1 -1
- package/client/dist/assets/Asmr-AxjnBdsh.js +2 -0
- package/client/dist/assets/{AsmrResetProgressModal-DPHPLqPo.js → AsmrResetProgressModal-NKywttOY.js} +1 -1
- package/client/dist/assets/Home-CkdWZK2L.js +1 -0
- package/client/dist/assets/Home-DHAkZuDf.css +1 -0
- package/client/dist/assets/{Insights-C9HufjGJ.js → Insights-DgnlUFjW.js} +1 -1
- package/client/dist/assets/{LibraryListPage-BT_xDjEq.js → LibraryListPage-CJxNJYC3.js} +1 -1
- package/client/dist/assets/{ListeningList-DL1rdCRi.js → ListeningList-VZTVSt_i.js} +1 -1
- package/client/dist/assets/{Manga-BfFRq7eK.js → Manga-dDQAtejO.js} +1 -1
- package/client/dist/assets/{MangaInfoPage-wBJjn2FL.js → MangaInfoPage-DzaSKarW.js} +1 -1
- package/client/dist/assets/{MangaReadPage-BAgsRqxt.js → MangaReadPage-CT6THZho.js} +1 -1
- package/client/dist/assets/{MangaResetProgressModal-Br5zqZ-U.js → MangaResetProgressModal-DrqN7OF0.js} +1 -1
- package/client/dist/assets/{Mature-MO7ZwJVT.js → Mature-BGitA9fy.js} +1 -1
- package/client/dist/assets/{MatureConsentModal-Beq4JL0b.js → MatureConsentModal-DLVOORqW.js} +1 -1
- package/client/dist/assets/{MediaCard-lz7FdOe_.js → MediaCard-DJNRuWDJ.js} +1 -1
- package/client/dist/assets/{OptionListMenu-BSUcso28.js → OptionListMenu-CRaHF9k4.js} +1 -1
- package/client/dist/assets/Player-CdSjfMoO.js +56 -0
- package/client/dist/assets/PlayerProvider-D02-hqdz.js +1 -0
- package/client/dist/assets/PlayerProvider-N2pT5gty.css +1 -0
- package/client/dist/assets/PlayerSettings-CXmAyRJh.js +1 -0
- package/client/dist/assets/{QueueOptionsButton-B8xuoYlH.js → QueueOptionsButton-ByAwxtJ-.js} +1 -1
- package/client/dist/assets/{QueueRail-D1FmM-GR.js → QueueRail-BLf4fWOA.js} +1 -1
- package/client/dist/assets/{ReadingList-D8ZiOnWi.js → ReadingList-Cm5omw5j.js} +1 -1
- package/client/dist/assets/{ResetProgressModal-0PvvM2XJ.js → ResetProgressModal-Dq-B23o_.js} +1 -1
- package/client/dist/assets/{Search-D1T-PrGX.js → Search-C8rfGyYH.js} +1 -1
- package/client/dist/assets/{Settings-DALBQcFc.js → Settings-Do5F5e2c.js} +1 -1
- package/client/dist/assets/{SkeletonGrid-pA-dcLBM.js → SkeletonGrid-sA6_IQY1.js} +1 -1
- package/client/dist/assets/{Trackers-D68sJf1y.js → Trackers-DeJr1sbR.js} +1 -1
- package/client/dist/assets/Tv-BkApELpu.js +4 -0
- package/client/dist/assets/{TvInfo-CpPIymn8.js → TvInfo-C5cVdHka.js} +1 -1
- package/client/dist/assets/{TvPopup-BwGJ1Tjg.js → TvPopup-DyFUi32m.js} +1 -1
- package/client/dist/assets/{TvSearch-D9SrfJjK.js → TvSearch-BBYYrww5.js} +1 -1
- package/client/dist/assets/{TvWatchlist-25tpA8ln.js → TvWatchlist-SjHmyo2P.js} +1 -1
- package/client/dist/assets/{Watchlist-mlZQTcqR.js → Watchlist-BnmsAcx0.js} +1 -1
- package/client/dist/assets/{index-ZssheiHa.css → index-5x1mF1nD.css} +1 -1
- package/client/dist/assets/index-vb4WPdcb.js +178 -0
- package/client/dist/assets/{libraryInvalidation-DdnIPcOQ.js → libraryInvalidation-2sAPXNhJ.js} +1 -1
- package/client/dist/assets/{useAnimeInfoData-tcGkDs2b.js → useAnimeInfoData-Ai39I_f0.js} +1 -1
- package/client/dist/assets/{useAsmr-B-FYJW2L.js → useAsmr-XBCV7iDw.js} +1 -1
- package/client/dist/assets/{useAsmrPopup-Ct9jC6X6.js → useAsmrPopup-DViHcQnO.js} +1 -1
- package/client/dist/assets/useMangaLibrary-DrPp5K_1.js +1 -0
- package/client/dist/assets/{useMangaPopup-B_wRaMyP.js → useMangaPopup-VGTfdKEu.js} +1 -1
- package/client/dist/assets/usePlaybackEnd-BMf_H2dw.css +1 -0
- package/client/dist/assets/usePlaybackEnd-C5EyqR1L.js +10 -0
- package/client/dist/assets/{useProviders-D0XOHCsj.js → useProviders-Bt-p5Jxv.js} +1 -1
- package/client/dist/assets/{useTv-IidbSQU4.js → useTv-BpVapcT5.js} +1 -1
- package/client/dist/assets/{useTvLibrary-DiCSdUOj.js → useTvLibrary-BFRidauf.js} +1 -1
- package/client/dist/index.html +2 -2
- package/package.json +2 -2
- package/server/dist/server.js +1 -1
- package/server/package.json +1 -1
- package/client/dist/assets/Asmr-DlKBykO-.js +0 -2
- package/client/dist/assets/Home-C5eTe3jP.css +0 -1
- package/client/dist/assets/Home-D7-FNOmo.js +0 -1
- package/client/dist/assets/Player-CnLC-x2S.js +0 -56
- package/client/dist/assets/PlayerSettings-kqYmlLDl.js +0 -1
- package/client/dist/assets/Tv-DO-WeaMv.js +0 -4
- package/client/dist/assets/hls-qvAoYTJt.js +0 -1
- package/client/dist/assets/index-DlcgJVM6.js +0 -178
- package/client/dist/assets/useMangaLibrary-BacTdrw2.js +0 -1
- package/client/dist/assets/usePlaybackEnd-DLFOYx3Q.css +0 -1
- package/client/dist/assets/usePlaybackEnd-DuEfjKb8.js +0 -10
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import{u as n,A as S,d as L,h as $,q as T,T as pe,$ as Pt}from"./vendor-core-DfaOB3Rn.js";import{M as at,B as te,S as _e,i as At,Y as It,t as nt,q as de,W as Mt,g as $t}from"./index-DlcgJVM6.js";import{I as U}from"./vendor-icons-DrybRNxP.js";import{u as Ft}from"./vendor-query-BBT5_sHx.js";import{a as qt}from"./playbackCompletion-IPHm9fp5.js";const Dt="_controls_1ljql_1",Rt="_titleContainer_1ljql_9",jt="_scheduleInfo_1ljql_15",Ot="_status_1ljql_23",Ht="_nextEpisode_1ljql_35",Vt="_watchlistBtn_1ljql_45",Wt="_inList_1ljql_72",zt="_queueBtn_1ljql_83",Ut="_queueActive_1ljql_95",Kt="_modeToggleBtn_1ljql_101",Xt="_modeToggleActive_1ljql_108",Gt="_markWatchedBtn_1ljql_129",Qt="_markWatchedDone_1ljql_143",Yt="_streamPanel_1ljql_154",Jt="_desktopEpisodeActions_1ljql_168",Zt="_sourceLoader_1ljql_174",en="_episodeActions_1ljql_187",tn="_mobileEpisodeActions_1ljql_201",nn="_episodeNavBtn_1ljql_205",rn="_primary_1ljql_235",on="_secondary_1ljql_245",sn="_episodePickerBtn_1ljql_249",an="_queueCountdown_1ljql_253",cn="_speedBoostBadge_1ljql_268",ln="_videoContainer_1ljql_299",un="_loadingOverlay_1ljql_312",dn="_loadingDots_1ljql_326",fn="_dot_1ljql_331",pn="_bounce_1ljql_1",mn="_bufferingOverlay_1ljql_348",hn="_bufferingSpinner_1ljql_357",yn="_spin_1ljql_444",gn="_videoIframe_1ljql_366",vn="_videoElementHidden_1ljql_389",bn="_upscalerCanvas_1ljql_394",_n="_upscalerActive_1ljql_407",wn="_upscalerStatusBadge_1ljql_411",Sn="_subtitleOverlay_1ljql_426",Cn="_spinner_1ljql_444",kn="_errorOverlay_1ljql_505",En="_retryButton_1ljql_515",xn="_detailsToggleBtn_1ljql_528",Ln="_descriptionSection_1ljql_551",Tn="_synopsisFlat_1ljql_559",Nn="_fullscreenActive_1ljql_593",Bn="_errorSubtext_1ljql_637",So={controls:Dt,titleContainer:Rt,scheduleInfo:jt,status:Ot,nextEpisode:Ht,watchlistBtn:Vt,inList:Wt,queueBtn:zt,queueActive:Ut,modeToggleBtn:Kt,modeToggleActive:Xt,markWatchedBtn:Gt,markWatchedDone:Qt,streamPanel:Yt,desktopEpisodeActions:Jt,sourceLoader:Zt,episodeActions:en,mobileEpisodeActions:tn,episodeNavBtn:nn,primary:rn,secondary:on,episodePickerBtn:sn,queueCountdown:an,speedBoostBadge:cn,videoContainer:ln,loadingOverlay:un,loadingDots:dn,dot:fn,bounce:pn,bufferingOverlay:mn,bufferingSpinner:hn,spin:yn,videoIframe:gn,videoElementHidden:vn,upscalerCanvas:bn,upscalerActive:_n,upscalerStatusBadge:wn,subtitleOverlay:Sn,spinner:Cn,errorOverlay:kn,retryButton:En,detailsToggleBtn:xn,descriptionSection:Ln,synopsisFlat:Tn,fullscreenActive:Nn,errorSubtext:Bn},Pn="_playerPageLayout_13s1u_1",An="_noSidebar_13s1u_15",In="_episodeSidebar_13s1u_19",Mn="_playerMain_13s1u_32",$n="_videoPlayerWrapper_13s1u_40",Fn="_playerInfoHeader_13s1u_56",qn="_playerAnimeCard_13s1u_62",Dn="_playerInfoContainer_13s1u_74",Rn="_infoColumns_13s1u_86",jn="_videoTitleSection_13s1u_114",On="_theaterMode_13s1u_288",Co={playerPageLayout:Pn,noSidebar:An,episodeSidebar:In,playerMain:Mn,videoPlayerWrapper:$n,playerInfoHeader:Fn,playerAnimeCard:qn,playerInfoContainer:Dn,infoColumns:Rn,videoTitleSection:jn,theaterMode:On},Hn="_shell_41rxp_1",Vn="_stage_41rxp_37",Wn="_shellFill_41rxp_85",zn="_shellFullscreen_41rxp_93",Un="_uiLayer_41rxp_107",Kn="_volumeWrap_41rxp_118",Xn="_volumeSlider_41rxp_124",ae={shell:Hn,stage:Vn,shellFill:Wn,shellFullscreen:zn,uiLayer:Un,volumeWrap:Kn,volumeSlider:Xn},Gn={fontSize:"subtitleFontSize",position:"subtitlePosition",bgOpacity:"subtitleBgOpacity",bgColor:"subtitleBgColor",textColor:"subtitleTextColor",edge:"subtitleEdge",bold:"subtitleBold"},J={fontSize:1.8,position:0,bgOpacity:.5,bgColor:"#000000",textColor:"#ffffff",edge:"shadow",bold:!1},Ne=(e,r,t)=>Math.max(r,Math.min(t,e)),Be=e=>typeof e=="string"&&/^#[0-9a-fA-F]{6}$/.test(e),ke=(e,r,t,s)=>{try{const o=localStorage.getItem(e);if(o===null)return r;const i=parseFloat(o);return Number.isFinite(i)?Ne(i,t,s):r}catch{return r}};function Qn(){let e=J.edge,r=J.bgColor,t=J.textColor,s=J.bold;try{const o=localStorage.getItem("subtitleEdge");(o==="shadow"||o==="outline"||o==="none")&&(e=o);const i=localStorage.getItem("subtitleBgColor");Be(i)&&(r=i);const d=localStorage.getItem("subtitleTextColor");Be(d)&&(t=d);const g=localStorage.getItem("subtitleBold");g!==null&&(s=g==="true")}catch{}return{fontSize:ke("subtitleFontSize",J.fontSize,.5,10),position:ke("subtitlePosition",J.position,0,100),bgOpacity:ke("subtitleBgOpacity",J.bgOpacity,0,1),bgColor:r,textColor:t,edge:e,bold:s}}function ct(e,r){const t=`rgba(0, 0, 0, ${Ne(r,0,1)})`;if(!Be(e))return t;const s=parseInt(e.slice(1,3),16),o=parseInt(e.slice(3,5),16),i=parseInt(e.slice(5,7),16);return`rgba(${s}, ${o}, ${i}, ${Ne(r,0,1)})`}function it(e,r){return e==="none"?r<=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 ko(e){return`
|
|
2
|
-
video::cue {
|
|
3
|
-
font-size: ${e.fontSize}rem !important;
|
|
4
|
-
color: ${e.textColor} !important;
|
|
5
|
-
background-color: ${ct(e.bgColor,e.bgOpacity)} !important;
|
|
6
|
-
font-weight: ${e.bold?"bold":"normal"} !important;
|
|
7
|
-
text-shadow: ${it(e.edge,e.bgOpacity)} !important;
|
|
8
|
-
}
|
|
9
|
-
`}function Eo(e){return[`font-size: ${e.fontSize}rem`,`color: ${e.textColor}`,`background-color: ${ct(e.bgColor,e.bgOpacity)}`,`font-weight: ${e.bold?"700":"400"}`,`text-shadow: ${it(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 Yn=new Set(["b","i","u","strong","em"]);function xo(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/<(\/?)([a-zA-Z]+)>/g,(t,s,o)=>Yn.has(o.toLowerCase())?`<${s}${o.toLowerCase()}>`:t)}function Lo(e){return e.replace(/<[^>]*>/g,"")}const To=["#ffffff","#ffff00","#7CFC00","#00e5ff","#ff9ff3","#ffa502"],No=["#000000","#1e272e","#2f3542","#3d0c02","#0c3d2e","#ffffff"];function Bo(e,r){const t=Number.isFinite(e)?e*16:J.fontSize*16;return!Number.isFinite(r)||r<=0?t/16:Math.min(t,Math.max(13,r*.07))/16}function Po(e){const r=Math.abs(e/1e3).toFixed(1);return e>0?`+${r}s`:e<0?`-${r}s`:"0.0s"}function Ao(e,r){const t=e.clientWidth||0,s=e.clientHeight||0,o=e.videoWidth>0&&e.videoHeight>0?e.videoWidth/e.videoHeight:0;let i=s;o>0&&t>0&&s>0&&(i=t/s>o?s:t/o);const d=Math.max(0,(s-i)/2),g=Math.max(0,Math.min(100,Number(r)||0))/100*i;return d+g}const Io=({isOpen:e,onClose:r,title:t,heading:s,message:o,children:i})=>n(at,{isOpen:e,onClose:r,title:t,width:"sm",children:n("div",{style:{padding:"1rem",textAlign:"center"},children:[n(U,{name:"check-circle",size:48,style:{color:"var(--accent-lighter)",marginBottom:"0.5rem"}}),n("p",{style:{fontSize:"1.1rem",fontWeight:600},children:s}),n("p",{style:{color:"var(--text-secondary)"},children:o}),i&&n("div",{style:{marginTop:"1rem",display:"flex",gap:"10px",justifyContent:"center",flexWrap:"wrap"},children:i})]})}),Mo=({isOpen:e,onClose:r,title:t,message:s,resumeLabel:o="Resume",restartLabel:i="Start Over",onResume:d,onRestart:g})=>n(at,{isOpen:e,onClose:r,title:t,width:"sm",children:n("div",{style:{padding:"1rem",textAlign:"center"},children:[n("p",{children:s}),n("div",{style:{marginTop:"1rem",display:"flex",gap:"10px",justifyContent:"center"},children:[n(te,{variant:"secondary",onClick:g,children:i}),n(te,{onClick:d,children:o})]})]})}),Jn="_centerControls_bxt8c_1",Zn="_centerSkipBtn_bxt8c_15",er="_centerPlayPause_bxt8c_37",tr="_playIconOffset_bxt8c_65",fe={centerControls:Jn,centerSkipBtn:Zn,centerPlayPause:er,playIconOffset:tr},$o=({isPlaying:e,onTogglePlay:r,onSkipBack:t,onSkipForward:s,skipSeconds:o=10})=>n("div",{className:fe.centerControls,onClick:i=>i.stopPropagation(),children:[n("button",{className:fe.centerSkipBtn,onClick:t,title:`Skip back ${o}s`,"aria-label":`Skip back ${o} seconds`,children:n(U,{name:"replay-10"})}),n("button",{className:fe.centerPlayPause,"data-speed-boost-ignore":"true",onClick:r,"aria-label":e?"Pause":"Play",children:e?n(U,{name:"pause"}):n(U,{name:"play",className:fe.playIconOffset})}),n("button",{className:fe.centerSkipBtn,onClick:s,title:`Skip forward ${o}s`,"aria-label":`Skip forward ${o} seconds`,children:n(U,{name:"forward-10"})})]}),Fo=({visible:e,title:r,episode:t,onBack:s,classes:o})=>n("div",{className:`${o.overlay} ${e?"":o.hidden} `,"data-speed-boost-ignore":"true",style:{pointerEvents:"none",background:"none"},children:n("div",{className:o.top,onClick:i=>i.stopPropagation(),children:[n("button",{className:o.backBtn,onClick:i=>{i.stopPropagation(),s()},title:"Back","aria-label":"Back",children:n(U,{name:"chevron-left"})}),n("div",{className:o.titleInfo,children:[n("span",{className:o.title,children:r}),t&&n("span",{className:o.episode,children:t})]})]})}),qo=({classes:e,videoRef:r,duration:t,formatTime:s,isScrubbing:o,buffered:i="auto",onSeek:d,onScrubStart:g,onScrubMove:a,onScrubEnd:p,timeLabelRef:b,children:u})=>{const E=S(null),C=S(null),l=S(null),f=S(null),w=S(null),v=S(!1),k=S(o);k.current=o;const m=S({onScrubMove:a,onScrubEnd:p});m.current={onScrubMove:a,onScrubEnd:p};const[B,P]=L({time:0,position:null});$(()=>{const h=r.current;if(!h)return;const _=W=>{const X=W/t*100||0;C.current&&(C.current.style.width=`${X}%`),l.current&&(l.current.style.left=`${X}%`),b?.current&&(b.current.innerText=`${s(W)} / ${s(t)}`)},D=()=>{o||_(h.currentTime)},F=()=>{if(i==="auto"&&h.buffered.length>0){const X=h.buffered.end(h.buffered.length-1)/t*100||0;f.current&&(f.current.style.width=`${X}%`)}};return _(h.currentTime),F(),h.addEventListener("timeupdate",D),h.addEventListener("progress",F),()=>{h.removeEventListener("timeupdate",D),h.removeEventListener("progress",F)}},[r,t,o,i,s,b]);const O=h=>{if(!E.current)return 0;const _=E.current.getBoundingClientRect();return Math.min(1,Math.max(0,(h-_.left)/_.width))},K=h=>{const _=h*t,D=_/t*100||0;C.current&&(C.current.style.width=`${D}%`),l.current&&(l.current.style.left=`${D}%`),b?.current&&(b.current.innerText=`${s(_)} / ${s(t)}`);const F=E.current?.getBoundingClientRect();P({time:_,position:F?h*F.width:null})};$(()=>{if(!o){w.current=null;return}const h=D=>{if(w.current!==null&&D.pointerId!==w.current||!t)return;const F=O(D.clientX);m.current.onScrubMove(F);const W=F*t,X=W/t*100||0;C.current&&(C.current.style.width=`${X}%`),l.current&&(l.current.style.left=`${X}%`),b?.current&&(b.current.innerText=`${s(W)} / ${s(t)}`);const ne=E.current?.getBoundingClientRect();P({time:W,position:ne?F*ne.width:null})},_=D=>{w.current!==null&&D.pointerId!==w.current||(w.current=null,v.current=!0,D.pointerType!=="mouse"&&P({time:0,position:null}),m.current.onScrubEnd())};return document.addEventListener("pointermove",h),document.addEventListener("pointerup",_),document.addEventListener("pointercancel",_),()=>{document.removeEventListener("pointermove",h),document.removeEventListener("pointerup",_),document.removeEventListener("pointercancel",_)}},[o,t,s,b]);const H=h=>{if(h.pointerType==="mouse"&&h.button!==0||!r.current||!t)return;h.preventDefault(),w.current=h.pointerId;try{E.current?.setPointerCapture(h.pointerId)}catch{}k.current||g();const _=O(h.clientX);a(_),K(_)},N=h=>{if(!t||k.current||h.pointerType!=="mouse")return;const _=O(h.clientX);P({time:_*t,position:h.clientX-(E.current?.getBoundingClientRect().left??0)})},z=h=>{if(!(w.current!==null&&h.pointerId!==w.current)&&k.current){w.current=null,v.current=!0,h.pointerType!=="mouse"&&P({time:0,position:null});try{E.current?.hasPointerCapture(h.pointerId)&&E.current.releasePointerCapture(h.pointerId)}catch{}p()}};return n("div",{className:`${e.container} ${o&&e.scrubbing?e.scrubbing:""}`,ref:E,role:"slider","aria-label":"Seek","aria-valuemin":0,"aria-valuemax":Math.round(t||0),"aria-valuenow":Math.round((Number(C.current?.style.width?.replace("%",""))||0)*(t||0)/100),tabIndex:0,onClick:h=>{if(v.current){v.current=!1;return}!r.current||isNaN(t)||t===0||d(O(h.clientX))},onPointerDown:H,onPointerMove:N,onPointerUp:z,onPointerCancel:z,onMouseMove:h=>{if(o||!t)return;const _=O(h.clientX);P({time:_*t,position:h.clientX-(E.current?.getBoundingClientRect().left??0)})},onMouseLeave:()=>{o||P({time:0,position:null})},onKeyDown:h=>{if(!(!r.current||!t)&&(h.key==="ArrowRight"||h.key==="ArrowLeft")){h.preventDefault();const _=(h.key==="ArrowRight"?5:-5)/t,D=r.current.currentTime/t||0;d(Math.min(1,Math.max(0,D+_)))}},children:[B.position!==null&&n("div",{className:e.timeBubble,style:{left:B.position},children:s(B.time)}),n("div",{className:e.bar,children:[n("div",{className:e.buffered,ref:f,style:i==="full"?{width:"100%"}:void 0}),n("div",{className:e.watched,ref:C}),n("div",{className:e.thumb,ref:l,onMouseDown:h=>{h.preventDefault(),r.current&&(k.current||g())}}),u]})]})};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 lt(){const[e,r]=L(Ee);return $(()=>{r(Ee());let t=null;const s=()=>r(Ee());try{t=window.matchMedia("(pointer: coarse)"),t.addEventListener?t.addEventListener("change",s):t.addListener(s)}catch{}return window.addEventListener("touchstart",s,{passive:!0,once:!0}),()=>{try{t&&(t.removeEventListener?t.removeEventListener("change",s):t.removeListener(s))}catch{}window.removeEventListener("touchstart",s)}},[]),e}const nr=450,Do=({muted:e,volume:r,volumeIcon:t,buttonClassName:s,sliderClassName:o,onToggleMute:i,onVolumeChange:d,onExpandedChange:g})=>{const a=lt(),[p,b]=L(!1),u=S(null),E=S(!1),C=S(null),l=T(m=>{b(m),g?.(m)},[g]);$(()=>()=>{u.current&&window.clearTimeout(u.current)},[]),$(()=>{if(!p)return;const m=B=>{C.current&&!C.current.contains(B.target)&&l(!1)};return document.addEventListener("pointerdown",m),()=>document.removeEventListener("pointerdown",m)},[p,l]);const f=e?0:r,w=()=>{E.current=!1,u.current&&window.clearTimeout(u.current),u.current=window.setTimeout(()=>{E.current=!0,l(!0)},nr)},v=()=>{u.current&&(window.clearTimeout(u.current),u.current=null)},k=m=>{if(m.stopPropagation(),E.current){E.current=!1;return}if(a){p?i():l(!0);return}i()};return n("div",{ref:C,className:ae.volumeWrap,"data-expanded":p?"true":"false",onContextMenu:m=>m.preventDefault(),children:[n("button",{type:"button",className:s,onClick:k,onPointerDown:w,onPointerUp:v,onPointerLeave:v,onContextMenu:m=>m.preventDefault(),"aria-label":e?"Unmute":"Mute","aria-expanded":p,children:t}),n("input",{type:"range",min:"0",max:"1",step:"0.05",value:f,onChange:m=>d(parseFloat(m.currentTarget.value)),onClick:m=>m.stopPropagation(),onPointerDown:m=>m.stopPropagation(),onContextMenu:m=>m.preventDefault(),className:`${ae.volumeSlider} ${o??""}`,style:{"--volume-percent":`${f*100}%`},"aria-label":"Volume"})]})},rt=280;function rr(e){return e?!!e.closest('button, input, select, textarea, a, [role="button"], [data-player-ui="true"]'):!1}const Ro=({player:e,topBar:r,centerControls:t,bottomBar:s,settingsPanel:o,overlays:i,isInteracting:d=!1,className:g,chromeDisabled:a=!1,onStageClick:p,children:b})=>{const{state:u,refs:E,actions:C}=e,l=E.playerContainerRef,w=lt()?5e3:3e3,v=S(0),k=S(null),m=S(d);m.current=d;const B=T(()=>{const N=C.inactivityTimer.current;N&&(window.clearTimeout(N),C.inactivityTimer.current=null)},[C]),P=T(()=>{B(),u.isPlaying&&(m.current||u.useNativeControls||(C.inactivityTimer.current=window.setTimeout(()=>{if(m.current)return;C.setShowControls(!1);const N=l.current;N&&u.isFullscreen&&(N.style.cursor="none")},w)))},[C,B,l,w,u.isFullscreen,u.isPlaying,u.useNativeControls]),O=T(()=>{const N=l.current;N&&(N.style.cursor="default"),!u.showControls&&!u.useNativeControls&&C.setShowControls(!0),P()},[C,l,P,u.showControls,u.useNativeControls]);$(()=>{if(u.showControls){if(!u.isPlaying){B();return}if(d||u.isScrubbing||u.showSettings||u.showVolumeSlider){C.setShowControls(!0),B();return}P()}},[C,B,d,P,u.isPlaying,u.isScrubbing,u.showControls,u.showSettings,u.showVolumeSlider]),$(()=>()=>B(),[B]);const K=T(N=>{const z=N.target;if(rr(z))return;p?.();const h=Date.now(),_=h-v.current<rt;if(v.current=h,_){k.current&&(window.clearTimeout(k.current),k.current=null),C.toggleFullscreen();return}k.current&&window.clearTimeout(k.current),k.current=window.setTimeout(()=>{k.current=null,C.setShowControls(!u.showControls),u.showControls?P():O()},rt)},[C,p,P,u.showControls,O]);$(()=>()=>{k.current&&window.clearTimeout(k.current)},[]);const H=u.showControls||u.isScrubbing||u.showSettings||u.showVolumeSlider;return n("div",{ref:l,className:`${ae.shell} ${u.isFullscreen?ae.shellFullscreen:""} ${g??""}`,onContextMenu:N=>N.preventDefault(),onPointerMove:N=>{N.pointerType==="mouse"&&O()},onMouseLeave:()=>{window.matchMedia?.("(hover: hover) and (pointer: fine)").matches&&u.isPlaying&&!m.current&&C.setShowControls(!1)},children:[n("div",{className:ae.stage,onClick:K,onContextMenu:N=>N.preventDefault(),children:b}),i,!a&&!u.useNativeControls&&n("div",{className:ae.uiLayer,onContextMenu:N=>N.preventDefault(),children:[n("div",{"data-player-ui":"true",children:r}),H&&t&&n("div",{"data-player-ui":"true",children:t}),n("div",{"data-player-ui":"true",children:s}),o&&n("div",{"data-player-ui":"true",children:o})]})]})},or=e=>(e.language??e.lang??"").toLowerCase(),sr=e=>(e.label??"").toLowerCase(),ar=e=>`${e.language??e.lang??""}|||${e.label??""}`,cr=e=>or(e).startsWith("en")||sr(e).includes("english");function jo(e,r){if(e.length===0||r?.enabled===!1)return-1;const t=r?.lastKey??null;if(t){const o=e.findIndex(i=>ar(i)===t);if(o>=0)return o}const s=e.findIndex(cr);return s>=0?s:0}const ir="_statusArea_1xccu_1",lr="_toggleBtn_1xccu_20",ur="_shortcuts_1xccu_46",dr="_shortcutGroup_1xccu_56",fr="_shortcut_1xccu_46",pr="_key_1xccu_70",mr="_label_1xccu_91",I={statusArea:ir,toggleBtn:lr,shortcuts:ur,shortcutGroup:dr,shortcut:fr,key:pr,label:mr},Oo=({showTheater:e=!0})=>{const[r,t]=L(!1);return n("div",{className:I.statusArea,children:[n("button",{type:"button",className:I.toggleBtn,onClick:()=>t(s=>!s),"aria-expanded":r,"aria-controls":"player-shortcuts",children:[n(U,{name:"keyboard",size:14}),n("span",{children:"Keyboard Shortcuts"}),r?n(U,{name:"chevron-up",size:12}):n(U,{name:"chevron-down",size:12})]}),r&&n("div",{id:"player-shortcuts",className:I.shortcuts,children:[n("div",{className:I.shortcutGroup,children:[n("div",{className:I.shortcut,children:[n("span",{className:I.key,children:"↑"}),n("span",{className:I.key,children:"↓"}),n("span",{className:I.label,children:"Volume"})]}),n("div",{className:I.shortcut,children:[n("span",{className:I.key,children:"←"}),n("span",{className:I.key,children:"→"}),n("span",{className:I.label,children:"Seek"})]})]}),n("div",{className:I.shortcutGroup,children:[n("div",{className:I.shortcut,children:[n("span",{className:I.key,children:"Space"}),n("span",{className:I.label,children:"Play/Pause"})]}),n("div",{className:I.shortcut,children:[n("span",{className:I.key,children:"F"}),n("span",{className:I.label,children:"Fullscreen"})]}),n("div",{className:I.shortcut,children:[n("span",{className:I.key,children:"M"}),n("span",{className:I.label,children:"Mute"})]}),e&&n("div",{className:I.shortcut,children:[n("span",{className:I.key,children:"T"}),n("span",{className:I.label,children:"Theater"})]}),n("div",{className:I.shortcut,children:[n("span",{className:I.key,children:"N"}),n("span",{className:I.label,children:"Next"})]})]})]})]})},hr="_episodeListContainer_9tyin_1",yr="_drawerContainer_9tyin_9",gr="_episodeListHeader_9tyin_14",vr="_drawerHeader_9tyin_20",br="_episodeListTitle_9tyin_29",_r="_rangeSelector_9tyin_41",wr="_rangeButton_9tyin_47",Sr="_active_9tyin_70",Cr="_episodeList_9tyin_1",kr="_drawerList_9tyin_89",Er="_episodeItem_9tyin_118",xr="_watched_9tyin_145",Lr="_episodeThumb_9tyin_167",Tr="_episodeText_9tyin_176",Nr="_episodeLabel_9tyin_184",Br="_episodeSub_9tyin_189",M={episodeListContainer:hr,drawerContainer:yr,episodeListHeader:gr,drawerHeader:vr,episodeListTitle:br,rangeSelector:_r,rangeButton:wr,active:Sr,episodeList:Cr,drawerList:kr,episodeItem:Er,watched:xr,episodeThumb:Lr,episodeText:Tr,episodeLabel:Nr,episodeSub:Br},Pr=({episodes:e,currentEpisode:r,watchedEpisodes:t=[],onEpisodeClick:s,variant:o="sidebar",title:i="Episodes",header:d})=>{const[g,a]=L(0),p=S(null),b=pe(()=>e.map(l=>typeof l=="string"?{id:l,label:`Episode ${l}`}:l),[e]),u=pe(()=>new Set(t),[t]);$(()=>{const l=p.current;if(!l)return;let f=l.parentElement;for(;f;){const k=window.getComputedStyle(f);if((k.overflowY==="auto"||k.overflowY==="scroll")&&f.scrollHeight>f.clientHeight)break;f=f.parentElement}if(!f)return;const w=f.getBoundingClientRect(),v=l.getBoundingClientRect();f.scrollTop+=v.top+v.height/2-(w.top+f.clientHeight/2)},[r,g]);const E=pe(()=>{if(b.length<=100)return[];const l=[];for(let f=0;f<b.length;f+=100){const w=f+1,v=Math.min(f+100,b.length);l.push(`${w}-${v}`)}return l},[b]),C=pe(()=>{if(E.length===0)return b;const l=E[g];if(!l)return b;const[f,w]=l.split("-"),v=parseInt(f,10),k=parseInt(w,10);return b.slice(v-1,k)},[b,E,g]);return n("div",{className:`${M.episodeListContainer} ${o==="drawer"?M.drawerContainer:""}`,children:[n("div",{className:`${M.episodeListHeader} ${o==="drawer"?M.drawerHeader:""}`,children:[d,n("h3",{className:M.episodeListTitle,children:i}),E.length>0&&n("div",{className:M.rangeSelector,children:E.map((l,f)=>n("button",{className:`${M.rangeButton} ${g===f?M.active:""}`,onClick:()=>a(f),children:l},l))})]}),n("div",{className:`${M.episodeList} ${o==="drawer"?M.drawerList:""}`,children:C.map(l=>{const f=l.id===r,w=u.has(l.id)||l.watched===!0;return n("div",{ref:f?p:void 0,className:`${M.episodeItem} ${w?M.watched:""} ${f?M.active:""}`,onClick:()=>s(l.id),children:[l.thumbnail&&n("img",{src:l.thumbnail,alt:"",loading:"lazy",decoding:"async",className:M.episodeThumb}),n("span",{className:M.episodeText,children:[n("span",{className:M.episodeLabel,children:l.label??`Episode ${l.id}`}),l.sublabel&&n("span",{className:M.episodeSub,children:l.sublabel})]})]},l.id)})})]})},Ho=({variant:e="sidebar",count:r=12})=>n("div",{className:`${M.episodeListContainer} ${e==="drawer"?M.drawerContainer:""}`,children:[n("div",{className:`${M.episodeListHeader} ${e==="drawer"?M.drawerHeader:""}`,children:[n("h3",{className:M.episodeListTitle,children:"Episodes"}),n("div",{className:M.rangeSelector,children:[n(_e,{width:"60px",height:"28px",variant:"rectangular"}),n(_e,{width:"60px",height:"28px",variant:"rectangular"}),n(_e,{width:"60px",height:"28px",variant:"rectangular"})]})]}),n("div",{className:`${M.episodeList} ${e==="drawer"?M.drawerList:""}`,children:Array.from({length:r}).map((t,s)=>n("div",{className:M.episodeItem,style:{border:"none",background:"transparent"},children:n(_e,{width:"120px",height:"1.2rem",variant:"text"})},s))})]}),Ar="_shell_cys6s_1",Ir="_overlay_cys6s_10",Mr="_drawer_cys6s_21",$r="_handle_cys6s_56",Fr="_header_cys6s_64",qr="_headerCopy_cys6s_73",Dr="_kicker_cys6s_79",Rr="_title_cys6s_87",jr="_closeBtn_cys6s_94",Or="_body_cys6s_116",Y={shell:Ar,overlay:Ir,drawer:Mr,handle:$r,header:Fr,headerCopy:qr,kicker:Dr,title:Rr,closeBtn:jr,body:Or};function Vo({isOpen:e,onClose:r,episodes:t,currentEpisode:s,watchedEpisodes:o=[],onEpisodeClick:i,title:d,header:g}){return $(()=>{if(!e)return;const a=b=>{b.key==="Escape"&&r()},p=document.body.style.overflow;return document.body.style.overflow="hidden",document.addEventListener("keydown",a),()=>{document.body.style.overflow=p,document.removeEventListener("keydown",a)}},[e,r]),e?Pt(n("div",{className:Y.shell,role:"dialog","aria-modal":"true","aria-label":"Episode picker",children:[n("button",{className:Y.overlay,type:"button",onClick:r,"aria-label":"Close episodes"}),n("aside",{className:Y.drawer,children:[n("div",{className:Y.handle}),n("div",{className:Y.header,children:[n("div",{className:Y.headerCopy,children:[n("span",{className:Y.kicker,children:"Episode picker"}),n("h3",{className:Y.title,children:"Choose an episode"})]}),n("button",{className:Y.closeBtn,type:"button",onClick:r,"aria-label":"Close",children:n(U,{name:"times"})})]}),n("div",{className:Y.body,children:n(Pr,{episodes:t,currentEpisode:s,watchedEpisodes:o,onEpisodeClick:i,variant:"drawer",title:d,header:g})})]})]}),document.body):null}const Hr="_sourceSelectionContainer_1am19_1",Vr="_providerSelectContainer_1am19_14",Wr="_providerSelect_1am19_14",zr="_sourceSelect_1am19_1",Ur="_sourceButtons_1am19_70",Kr="_sourceButton_1am19_70",Xr="_active_1am19_95",Wo={sourceSelectionContainer:Hr,providerSelectContainer:Vr,providerSelect:Wr,sourceSelect:zr,sourceButtons:Ur,sourceButton:Kr,active:Xr};function Ae(){return document}function ut(e){const r=Ae();if(document.fullscreenElement)return document.fullscreenElement;if(r.webkitFullscreenElement)return r.webkitFullscreenElement;const t=e;return t?.webkitDisplayingFullscreen?t:null}function ce(e){return ut(e)!==null}async function Gr(e,r){if(ut(r))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 s=r;if(s&&typeof s.webkitEnterFullscreen=="function"){if(s.webkitSupportsFullscreen===!1)return;try{await s.webkitEnterFullscreen()}catch{}}}async function Qr(e){const r=Ae();try{if(document.fullscreenElement&&typeof document.exitFullscreen=="function"){await document.exitFullscreen();return}if(r.webkitFullscreenElement&&typeof r.webkitExitFullscreen=="function"){await r.webkitExitFullscreen();return}}catch{}const t=e;if(t?.webkitDisplayingFullscreen&&typeof t.webkitExitFullscreen=="function"){try{t.webkitExitFullscreen()}catch{}return}try{typeof r.webkitCancelFullScreen=="function"?r.webkitCancelFullScreen():!document.fullscreenElement&&typeof document.exitFullscreen=="function"&&(document.fullscreenElement??r.webkitFullscreenElement)&&await document.exitFullscreen()}catch{}}async function Yr(e,r){!e&&!r||(ce(r)?await Qr(r):e&&await Gr(e,r))}function Jr(e,r){const t=()=>{try{r(ce(e()))}catch{}},s=Ae(),o=t;s.addEventListener("fullscreenchange",t),s.addEventListener("webkitfullscreenchange",o),s.addEventListener("webkitbeginfullscreen",o,!0),s.addEventListener("webkitendfullscreen",o,!0);const i=e();return i?.addEventListener("webkitbeginfullscreen",o),i?.addEventListener("webkitendfullscreen",o),()=>{s.removeEventListener("fullscreenchange",t),s.removeEventListener("webkitfullscreenchange",o),s.removeEventListener("webkitbeginfullscreen",o,!0),s.removeEventListener("webkitendfullscreen",o,!0),i?.removeEventListener("webkitbeginfullscreen",o),i?.removeEventListener("webkitendfullscreen",o)}}const zo=({skipIntervals:e,showId:r,episodeNumber:t,episodeCount:s,sourceType:o,showMeta:i})=>{const d=Ft(),g=At(),a=S(null),p=S(null),b=S(null),u=S(!1),E=S(null),C=S(0),l=S({mouse:!1,keyboard:!1}),f=S(null),w=S(null),v=S(!1),k=S(Math.random().toString(36).substring(2)),[m,B]=L(!1),[P,O]=L(()=>{try{return localStorage.getItem("playerMuted")==="true"}catch{return!1}}),[K,H]=L(()=>{try{const c=parseFloat(localStorage.getItem("playerVolume")||"");return isNaN(c)?1:Math.max(0,Math.min(1,c))}catch{return 1}}),[N,z]=L(!1),[h,_]=L(0),[D,F]=L(!0),[W,X]=L(!1),[ne,dt]=L(localStorage.getItem("autoSkipEnabled")==="true"),[ft,Se]=L(null),[Z]=L(Qn),[pt,Ie]=L(Z.fontSize),[mt,Me]=L(Z.position),[ht,$e]=L(Z.bgOpacity),[yt,Fe]=L(Z.bgColor),[gt,qe]=L(Z.textColor),[vt,De]=L(Z.edge),[bt,Re]=L(Z.bold),je=T((c,x)=>{if({fontSize:y=>typeof y!="number"?!1:(Ie(y),!0),position:y=>typeof y!="number"?!1:(Me(y),!0),bgOpacity:y=>typeof y!="number"?!1:($e(y),!0),bgColor:y=>typeof y!="string"?!1:(Fe(y),!0),textColor:y=>typeof y!="string"?!1:(qe(y),!0),edge:y=>y!=="shadow"&&y!=="outline"&&y!=="none"?!1:(De(y),!0),bold:y=>typeof y!="boolean"?!1:(Re(y),!0)}[c](x))try{localStorage.setItem(Gn[c],String(x))}catch{}},[]),[_t,wt]=L([]),[St,Ct]=L(null),[kt,Et]=L(!1),[xt,Lt]=L(!1),[me,G]=L(!1),[Tt,he]=L(!1),[Nt,Oe]=L(()=>{try{return localStorage.getItem("playerUseNativeControls")==="true"}catch{return!1}}),re=S(!1),Ce=S(-1),ye=T(()=>{const c=a.current;return!r||!t||!i?.name?null:{showId:r,episodeNumber:t,episodeCount:s,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(x=>typeof x=="string"?x:x?.name).filter(Boolean):void 0,popularityScore:i.score,type:i.type,isPlaying:c?!c.paused:!0,sessionId:k.current,isAdult:i.isAdult}},[r,t,s,i]),R=T((c=!1,x=!1)=>{if(re.current)return!1;const A=ye();if(!A)return!1;const y=a.current;if(!y&&o!=="iframe")return!1;const q=y?y.currentTime:0;if(!x){if(q===0)return!1;const V=y?Math.abs(q-Ce.current):0;if(!c&&y&&q!==y.duration&&V<5)return!1}return A.currentTime=q,Ce.current=q,c?(async()=>{try{await nt.progress.updateProgress.mutate(A),d.invalidateQueries({queryKey:[de.videoSources,r,t]}),d.invalidateQueries({queryKey:[de.continueWatching]}),d.invalidateQueries({queryKey:[de.thisWeekSchedule]}),d.invalidateQueries(g.continueWatching.pathFilter())}catch(V){console.error("Failed to update progress:",V)}})():It("progress.updateProgress",A).catch(V=>console.error("Failed to update progress:",V)),!0},[ye,o,d,r,t,g.continueWatching]);$(()=>{const c=a.current;c&&(c.volume=K,c.muted=P)},[a,K,P]),$(()=>{const c=()=>{re.current||R(!0)};window.addEventListener("beforeunload",c);const x=E,A=b;return()=>{window.removeEventListener("beforeunload",c),re.current||R(!0),x.current&&clearTimeout(x.current),A.current&&clearTimeout(A.current)}},[R]);const He=T(()=>{F(!0),b.current&&clearTimeout(b.current),b.current=window.setTimeout(()=>{F(!1)},1e3)},[F]),ge=T(()=>{const c=p.current;c&&Yr(c,a.current).catch(x=>{console.error(`Error attempting to toggle full-screen mode: ${x?.message} (${x?.name})`)})},[]),ve=T(()=>{a.current&&(a.current.paused?a.current.play().catch(()=>console.warn("Autoplay was prevented.")):(a.current.pause(),F(!0)))},[F]),oe=T(()=>{const c=a.current;if(!c)return;const x=l.current.mouse||l.current.keyboard;c.playbackRate=x?2:1},[]),ie=T(c=>{l.current.mouse!==c&&(l.current.mouse=c,he(c||l.current.keyboard),oe())},[oe]),se=T(c=>{l.current.keyboard!==c&&(l.current.keyboard=c,he(l.current.mouse||c),oe())},[oe]),le=T(c=>{a.current&&(a.current.currentTime+=c,E.current&&clearTimeout(E.current),E.current=setTimeout(()=>{R(!1,!0)},1500),F(!0))},[R,F]),be=T(()=>{if(!a.current)return;const c=!a.current.muted;a.current.muted=c,O(c),localStorage.setItem("playerMuted",String(c)),!c&&a.current.volume===0&&(a.current.volume=.5,H(.5),localStorage.setItem("playerVolume",String(.5))),F(!0)},[F]);$(()=>{const c=()=>a.current,x=Jr(c,A=>{z(A),A&&F(!0)});return z(ce(c())),x},[F]),$(()=>{const c=A=>{if(!A.target.closest('input, textarea, button, select, a, [role="button"], [contenteditable="true"]')){if(A.code==="Space"){if(A.preventDefault(),v.current)return;v.current=!0,w.current&&clearTimeout(w.current),w.current=window.setTimeout(()=>{w.current=null,v.current&&se(!0)},180);return}switch(A.key.toLowerCase()){case"f":ge();break;case"m":be();break;case"arrowright":le(10);break;case"arrowleft":le(-10);break;case"arrowup":if(A.preventDefault(),a.current){const q=Math.min(1,a.current.volume+.1);a.current.volume=q,H(q)}break;case"arrowdown":if(A.preventDefault(),a.current){const q=Math.max(0,a.current.volume-.1);a.current.volume=q,H(q)}break}}},x=A=>{if(A.code==="Space"){if(A.preventDefault(),v.current=!1,l.current.keyboard){se(!1);return}w.current&&(clearTimeout(w.current),w.current=null,ve())}};return document.addEventListener("keydown",c),document.addEventListener("keyup",x),()=>{document.removeEventListener("keydown",c),document.removeEventListener("keyup",x),w.current&&(clearTimeout(w.current),w.current=null),v.current=!1,se(!1),he(!1)}},[se,ve,ge,be,le]),$(()=>{const c=Q=>Q?!!Q.closest('[data-speed-boost-ignore="true"], [data-player-ui="true"], button, input, select, textarea, a, [role="button"], [role="slider"], [contenteditable="true"]'):!0,x=Q=>{if(Q.button!==0)return;const V=Q.target;if(!V||c(V))return;const ue=p.current;!ue||!ue.contains(V)||(f.current&&clearTimeout(f.current),f.current=window.setTimeout(()=>{f.current=null,ie(!0)},180))},A=Q=>{const V=Q.target;if(!V||c(V))return;const ue=p.current;!ue||!ue.contains(V)||(f.current&&clearTimeout(f.current),f.current=window.setTimeout(()=>{f.current=null,ie(!0)},180))},y=()=>{f.current&&(clearTimeout(f.current),f.current=null),ie(!1)},q=()=>{f.current&&(clearTimeout(f.current),f.current=null),v.current=!1,w.current&&(clearTimeout(w.current),w.current=null),se(!1),ie(!1),he(!1)};return document.addEventListener("mousedown",x),document.addEventListener("mouseup",y),document.addEventListener("touchstart",A,{passive:!0}),document.addEventListener("touchend",y),document.addEventListener("touchcancel",y),document.addEventListener("pointerup",y),document.addEventListener("pointercancel",y),window.addEventListener("blur",q),()=>{document.removeEventListener("mousedown",x),document.removeEventListener("mouseup",y),document.removeEventListener("touchstart",A),document.removeEventListener("touchend",y),document.removeEventListener("touchcancel",y),document.removeEventListener("pointerup",y),document.removeEventListener("pointercancel",y),window.removeEventListener("blur",q),f.current&&(clearTimeout(f.current),f.current=null)}},[se,ie]);const Ve=T(()=>{re.current=!1,B(!0),G(!1),setTimeout(()=>R(!1,!0),50)},[R]),We=T(()=>{B(!0),G(!1)},[]),ze=T(()=>{const c=a.current;c&&!c.paused&&c.readyState>=3&&!c.seeking||G(!0)},[]),Ue=T(()=>{G(!1)},[]),Ke=T(()=>{B(!1),G(!1),F(!0),setTimeout(()=>R(!1,!0),50)},[R]),Xe=S(!1);Xe.current=me,$(()=>{if(!me)return;let c=a.current?.currentTime??0,x=0;const A=window.setInterval(()=>{const y=a.current;if(!y)return;x+=1;const q=y.currentTime,Q=q!==c;if(c=q,!(y.paused||y.seeking)){if(Q||y.readyState>=3){G(!1);return}x>=24&&y.readyState>=2&&!y.ended&&G(!1)}},500);return()=>window.clearInterval(A)},[me]),$(()=>{re.current=!1,Ce.current=-1,C.current=0,k.current=Math.random().toString(36).substring(2),_(0),G(!1)},[r,t]);const Ge=T(()=>{_(0),G(!1)},[]);$(()=>{const c=k.current;return()=>{Mt(c)}},[r,t]),$(()=>{if(o!=="iframe")return;R(!1,!0);const c=setInterval(()=>{R(!1,!0)},6e4);return()=>clearInterval(c)},[o,R]);const Qe=T(()=>{_(a.current?.duration||0),oe()},[oe]),Ye=T(()=>{const c=a.current?.duration;c&&Number.isFinite(c)&&_(c)},[]),Je=T(()=>{if(a.current){const c=a.current.muted,x=a.current.volume;O(c),H(x),localStorage.setItem("playerMuted",String(c)),localStorage.setItem("playerVolume",String(x))}},[]),Ze=T(()=>{const c=a.current;if(!c)return;Xe.current&&!c.paused&&!c.seeking&&G(!1);const x=c.currentTime||0,A=Date.now();A-C.current>6e4&&R()&&(C.current=A);const y=e.find(q=>x>=q.start_time&&x<q.end_time)||null;Se(q=>q?.skip_id!==y?.skip_id?y:q),ne&&y&&!c.paused&&(c.currentTime=y.end_time,Se(null))},[e,ne,R]),et=T(()=>{const c=ye();c&&(c.currentTime=c.duration,nt.progress.updateProgress.mutate(c).then(()=>{d.invalidateQueries({queryKey:[de.videoSources,r,t]}),d.invalidateQueries({queryKey:[de.continueWatching]})}).catch(x=>console.error("Failed to send final progress:",x)))},[ye,d,r,t]),tt=T(()=>{re.current=!0,et()},[et]);$(()=>{const c=()=>{W&&(X(!1),u.current&&a.current?.play(),R(!1,!0))};return W&&(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)}},[W,R]);const Bt=pe(()=>({togglePlay:ve,seek:le,toggleMute:be,toggleFullscreen:ge,onPlay:Ve,onPause:Ke,onLoadedMetadata:Qe,onDurationChange:Ye,formatTime:$t,onVolumeChange:Je,onTimeUpdate:Ze,onEnded:tt,setShowControls:F,setIsScrubbing:X,setIsAutoSkipEnabled:dt,setCurrentSkipInterval:Se,setSubtitleFontSize:Ie,setSubtitlePosition:Me,setSubtitleBgOpacity:$e,setSubtitleBgColor:Fe,setSubtitleTextColor:qe,setSubtitleEdge:De,setSubtitleBold:Re,setSubtitleStyle:je,setAvailableSubtitles:wt,setActiveSubtitleTrack:Ct,setShowSettings:Et,setShowVolumeSlider:Lt,wasPlayingBeforeScrub:u,inactivityTimer:b,flashControls:He,setIsFullscreen:z,onWaiting:ze,onPlaying:We,onCanPlay:Ue,sendProgressUpdate:R,setUseNativeControls:Oe,resetMediaState:Ge}),[ve,le,be,ge,Ve,Ke,Qe,Ye,Je,Ze,tt,z,ze,We,Ue,R,Oe,Ge,He,je]);return{refs:{videoRef:a,playerContainerRef:p},state:{isPlaying:m,isMuted:P,volume:K,isFullscreen:N,duration:h,showControls:D,isScrubbing:W,isAutoSkipEnabled:ne,currentSkipInterval:ft,subtitleFontSize:pt,subtitlePosition:mt,subtitleBgOpacity:ht,subtitleBgColor:yt,subtitleTextColor:gt,subtitleEdge:vt,subtitleBold:bt,availableSubtitles:_t,activeSubtitleTrack:St,showSettings:kt,showVolumeSlider:xt,isBuffering:me,isSpeedBoostActive:Tt,useNativeControls:Nt},actions:Bt}};function Zr(){try{return typeof navigator<"u"&&/android/i.test(navigator.userAgent)}catch{return!1}}function Uo(e,r){const{refs:t,actions:s}=e,o=S(r);o.current=r;const i=S(!1),d=S(!1),g=a=>{try{if(a)return a.matches}catch{}try{return window.innerWidth>window.innerHeight}catch{return!1}};$(()=>{if(!Zr())return;let a=null;const p=()=>{const b=t.playerContainerRef.current;if(g(a)){if(!o.current||!b||ce(t.videoRef.current)||d.current)return;i.current=!0,s.toggleFullscreen()}else d.current=!1,i.current&&(i.current=!1,ce(t.videoRef.current)&&s.toggleFullscreen())};try{a=window.matchMedia("(orientation: landscape)"),a.addEventListener?a.addEventListener("change",p):a.addListener(p)}catch{}return p(),()=>{try{a&&(a.removeEventListener?a.removeEventListener("change",p):a.removeListener(p))}catch{}}},[s,t.playerContainerRef,t.videoRef,r]),$(()=>{const a=()=>{if(!ce(t.videoRef.current)){i.current=!1;try{window.matchMedia("(orientation: landscape)").matches&&(d.current=!0)}catch{d.current=!0}}};return document.addEventListener("fullscreenchange",a),document.addEventListener("webkitfullscreenchange",a),()=>{document.removeEventListener("fullscreenchange",a),document.removeEventListener("webkitfullscreenchange",a)}},[t.videoRef])}const eo=e=>Math.max(8,Math.min(40,Math.ceil(e/16.7)+4));function Ko({videoRef:e,canvasRef:r,delayMs:t,enabled:s}){const o=S(t);o.current=t;const i=S([]),d=S(-1),g=S(-1),a=S(!1),p=S(0),b=S(null);$(()=>{const u=v=>{if(v)try{v.close()}catch{}},E=()=>{for(const v of i.current)u(v.bitmap);i.current=[]};if(!s){E(),d.current=-1,g.current=-1,a.current=!1,p.current=0;return}let C=!1;const l=()=>{b.current!==null&&(cancelAnimationFrame(b.current),b.current=null)},f=()=>{C||(l(),b.current=requestAnimationFrame(()=>{w()}))};async function w(){if(C)return;const v=e.current,k=r.current;if(!v||!k||v.videoWidth===0){f();return}if(v.paused||v.ended||document.hidden||v.readyState<HTMLMediaElement.HAVE_CURRENT_DATA){f();return}const m=v.getVideoPlaybackQuality().totalVideoFrames;if(m===d.current){f();return}(v.seeking||g.current>=0&&Math.abs(v.currentTime-g.current)>.5)&&(E(),a.current=!1,p.current=0,d.current=-1),g.current=v.currentTime,(k.width!==v.videoWidth||k.height!==v.videoHeight)&&(k.width=v.videoWidth,k.height=v.videoHeight);const B=Math.max(0,o.current||0);B>p.current&&(a.current=!1);try{const P=await createImageBitmap(v);if(C){u(P);return}d.current=m;const O=performance.now(),K=k.getContext("2d"),H=_=>{K&&K.drawImage(_,0,0,k.width,k.height)};if(B<=0){E(),a.current=!1,p.current=0,H(P),u(P),f();return}const N=i.current;N.push({bitmap:P,capture:O});const z=eo(B);for(;N.length>z;)u(N.shift()?.bitmap);let h=-1;for(let _=N.length-1;_>=0;_--)if(O-N[_].capture>=B){h=_;break}if(h!==-1){for(let D=0;D<h;D++)u(N.shift()?.bitmap);const _=N.shift();_?(H(_.bitmap),u(_.bitmap),a.current=!0,p.current=B):H(P)}else if(!a.current)H(P);else{const _=N.shift();_?(H(_.bitmap),u(_.bitmap)):H(P)}}catch{}f()}return f(),()=>{C=!0,l();for(const v of i.current)try{v.bitmap.close()}catch{}i.current=[]}},[s,e,r])}const ot=(e,r)=>{try{localStorage.setItem("playerVideoDelayMs",String(e)),localStorage.setItem("playerVideoDelayEnabled",String(r))}catch{}},st=e=>{try{localStorage.setItem("playerVideoDelayEnabled",String(e))}catch{}};function Xo(e,r){const[t,s]=L(()=>{try{const m=Number(localStorage.getItem("playerVideoDelayMs"));if(Number.isFinite(m)&&m>=0&&m<=500)return Math.round(m)}catch{}return 180}),[o,i]=L(()=>{try{return localStorage.getItem("playerVideoDelayEnabled")==="true"}catch{return!1}}),[d,g]=L(!1),[a,p]=L(!1),b=S(null),u=S(null),E=m=>{const B=Math.max(0,Math.min(500,Math.round(m)));s(B);try{localStorage.setItem("playerVideoDelayMs",String(B))}catch{}},C=m=>{i(m),st(m)},l=T(()=>{p(!1),g(!1)},[]);return{videoDelayMs:t,videoDelayEnabled:o,setDelayEnabled:C,handleVideoDelayChange:E,isCalibrating:d,testClipActive:a,stopCalibration:l,openAvSyncCalibrator:()=>{b.current={enabled:o,ms:t},i(!0),st(!0),r?.(),g(!0)},cancelAvSyncCalibrator:()=>{const m=b.current;b.current=null,m&&(s(m.ms),i(m.enabled),ot(m.ms,m.enabled)),p(!1),g(!1)},applyAvSyncCalibrator:()=>{b.current=null,i(!0),ot(t,!0),p(!1),g(!1)},toggleTestClip:()=>{if(a){p(!1);return}const m=e.current;m&&!isNaN(m.currentTime)&&(u.current=m.currentTime),p(!0)},calibReturnRef:u,effectiveVideoDelayMs:o?t:0}}function Go(){const[e,r]=L(()=>{try{return localStorage.getItem("playerTheaterMode")==="true"}catch{return!1}});$(()=>{try{e?document.body.classList.add("theater-mode"):document.body.classList.remove("theater-mode")}catch(o){console.error(o)}return()=>{try{document.body.classList.remove("theater-mode")}catch(o){console.error(o)}}},[e]);const t=T(()=>{r(o=>{const i=!o;try{localStorage.setItem("playerTheaterMode",i.toString())}catch{}return i})},[]),s=T(o=>{if(e&&o.target===o.currentTarget){r(!1);try{localStorage.setItem("playerTheaterMode","false")}catch{}}},[e]);return{isTheaterMode:e,toggleTheaterMode:t,handleLayoutClick:s}}const ee={enabled:!0,blur:60,saturation:150,brightness:70,opacity:60};function to(){try{const e=localStorage.getItem("playerAmbientLight");if(!e)return ee;const r=JSON.parse(e),t=(s,o,i,d)=>{const g=Number(s);return Number.isFinite(g)?Math.max(i,Math.min(d,g)):o};return{enabled:r.enabled??ee.enabled,blur:t(r.blur,ee.blur,0,120),saturation:t(r.saturation,ee.saturation,0,200),brightness:t(r.brightness,ee.brightness,20,120),opacity:t(r.opacity,ee.opacity,10,100)}}catch{return ee}}function Qo(){const[e,r]=L(to),t=T(s=>{r(o=>{const i={...o,...s};try{localStorage.setItem("playerAmbientLight",JSON.stringify(i))}catch{}return i})},[]);return{settings:e,update:t}}const no="_theaterAmbient_x9t0o_1",ro={theaterAmbient:no},xe=160,Le=90,oo=120,Yo=({videoRef:e,active:r,settings:t,className:s})=>{const o=S(null);return $(()=>{if(!r)return;const i=o.current,d=e.current;if(!i||!d)return;const g=i.getContext("2d",{alpha:!1});if(!g)return;let a=0,p=0,b=!1;const u=()=>{if(!(d.readyState<2||!d.videoWidth))try{const l=d.videoWidth,f=d.videoHeight,w=xe/Le,v=l/f;let k=l,m=f,B=0,P=0;v>w?(k=f*w,B=(l-k)/2):(m=l/w,P=(f-m)/2),g.drawImage(d,B,P,k,m,0,0,xe,Le)}catch{}},E=l=>{b||d.paused||(a=requestAnimationFrame(E),!(l-p<oo)&&(p=l,u()))},C=()=>{b||(cancelAnimationFrame(a),p=0,a=requestAnimationFrame(E))};return d.addEventListener("play",C),d.addEventListener("seeked",u),d.addEventListener("loadeddata",u),a=requestAnimationFrame(E),()=>{b=!0,cancelAnimationFrame(a),d.removeEventListener("play",C),d.removeEventListener("seeked",u),d.removeEventListener("loadeddata",u)}},[r,e]),r?n("canvas",{ref:o,width:xe,height:Le,"aria-hidden":"true",className:s??ro.theaterAmbient,style:{filter:`blur(${t.blur}px) saturate(${t.saturation}%) brightness(${t.brightness}%)`,opacity:t.opacity/100}}):null},so="_row_1fq55_1",ao="_rowHeader_1fq55_9",co="_rowLabel_1fq55_17",io="_rowValue_1fq55_28",lo="_slider_1fq55_36",uo="_swatches_1fq55_99",fo="_swatch_1fq55_99",po="_swatchPicked_1fq55_114",mo="_colorInput_1fq55_120",ho="_segmented_1fq55_131",j={row:so,rowHeader:ao,rowLabel:co,rowValue:io,slider:lo,swatches:uo,swatch:fo,swatchPicked:po,colorInput:mo,segmented:ho},yo=({label:e,display:r,min:t,max:s,step:o,value:i,percent:d,onChange:g,onCommit:a})=>n("div",{className:j.row,children:[n("div",{className:j.rowHeader,children:[n("span",{className:j.rowLabel,children:e}),n("span",{className:j.rowValue,children:r})]}),n("input",{type:"range",className:j.slider,min:t,max:s,step:o,value:i,"aria-label":e,"data-speed-boost-ignore":"true",onInput:p=>g(Number(p.target.value)),onMouseDown:p=>p.stopPropagation(),onPointerDown:p=>p.stopPropagation(),onTouchStart:p=>p.stopPropagation(),onPointerUp:a,onPointerCancel:a,onTouchEnd:a,onKeyUp:a,onBlur:a,style:{"--slider-percent":`${d}%`}})]}),Jo=({label:e,colors:r,value:t,onChange:s})=>n("div",{className:j.row,children:[n("div",{className:j.rowHeader,children:n("span",{className:j.rowLabel,children:e})}),n("div",{className:j.swatches,children:[r.map(o=>n("button",{type:"button","aria-label":`${e} ${o}`,"aria-pressed":t.toLowerCase()===o.toLowerCase(),onClick:()=>s(o),className:`${j.swatch} ${t.toLowerCase()===o.toLowerCase()?j.swatchPicked:""}`,style:{backgroundColor:o}},o)),n("input",{type:"color","aria-label":`Custom ${e.toLowerCase()}`,className:j.colorInput,value:t,"data-speed-boost-ignore":"true",onInput:o=>s(o.target.value),onMouseDown:o=>o.stopPropagation(),onPointerDown:o=>o.stopPropagation(),onTouchStart:o=>o.stopPropagation()})]})]});function Zo({label:e,options:r,value:t,onChange:s}){return n("div",{className:j.row,children:[n("div",{className:j.rowHeader,children:n("span",{className:j.rowLabel,children:e})}),n("div",{className:j.segmented,role:"group","aria-label":e,children:r.map(o=>n("button",{type:"button","aria-pressed":t===o,onClick:()=>s(o),children:[n("span",{children:o}),t===o&&n(U,{name:"check",size:10})]},o))})]})}const we=10,Pe=500,Te=e=>Math.max(0,Math.min(Pe,Math.round(e))),es=({isOpen:e,ms:r,onChange:t,onApply:s,onClose:o,testClipActive:i,onTestClip:d})=>e?n("div",{role:"dialog","aria-label":"Calibrate audio video sync","data-speed-boost-ignore":"true",onClick:g=>g.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:[n("div",{style:{fontSize:"0.8rem",fontWeight:800,color:"var(--text-primary)"},children:"A/V sync"}),n("div",{children:n(te,{size:"sm",variant:"secondary",onClick:d,children:i?"Back to video":"Preview test clip"})}),n("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6,flexWrap:"wrap"},children:[n(te,{size:"sm",onClick:()=>t(Te(r-we)),"aria-label":"Decrease delay by 10 milliseconds",children:["− ",we,"ms"]}),n("div",{style:{fontSize:"1.1rem",fontWeight:800,minWidth:64,textAlign:"center"},children:[r,"ms"]}),n(te,{size:"sm",onClick:()=>t(Te(r+we)),"aria-label":"Increase delay by 10 milliseconds",children:["+ ",we,"ms"]})]}),n(yo,{label:"Video delay",display:`${r}ms`,min:0,max:Pe,step:5,value:r,percent:r/Pe*100,onChange:g=>t(Te(g))}),n("div",{style:{display:"flex",gap:8,justifyContent:"center",flexWrap:"wrap"},children:[n(te,{size:"sm",variant:"secondary",onClick:o,children:"Cancel"}),n(te,{size:"sm",onClick:s,children:["Apply ",r,"ms"]})]})]}):null;function ts({videoRef:e,sourceType:r,resetKey:t,onEnd:s}){const o=S(!1),i=S(s);i.current=s,$(()=>{o.current=!1},[t]);const d=T(()=>{const a=e.current?.duration;!a||!Number.isFinite(a)||console.info(`[playback] duration ${a.toFixed(2)}s`)},[e]);return{checkEnd:T((a=!1)=>{const p=e.current;!p||r==="iframe"||o.current||!a&&!qt(p.currentTime,p.duration)||(o.current=!0,console.info(`[playback] end reached at ${p.currentTime.toFixed(2)}s / ${p.duration.toFixed(2)}s`),i.current())},[r,e]),logDuration:d}}export{Yo as A,Jo as B,$o as C,No as D,Ho as E,Zo as F,J as G,ee as H,yo as M,Oo as P,Mo as R,qo as S,To as T,Do as U,Ro as a,Fo as b,Wo as c,ko as d,Eo as e,Bo as f,Ao as g,Lo as h,Xo as i,Ko as j,Go as k,ts as l,Uo as m,Qo as n,Co as o,jo as p,Io as q,xo as r,ar as s,Pr as t,zo as u,So as v,ae as w,es as x,Vo as y,Po as z};
|