@serifpersia/dango 3.5.2 → 3.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/client/dist/assets/{AnimeCard-BVnAhrys.js → AnimeCard-Cw_PS4ev.js} +1 -1
- package/client/dist/assets/{AnimeInfo-DYBLIXmE.js → AnimeInfo-C_a0TTXe.js} +1 -1
- package/client/dist/assets/{AnimeInfoPage-DnXV4EMC.js → AnimeInfoPage-BB2RY_yn.js} +2 -2
- package/client/dist/assets/{Asmr-Dwlv-Af8.js → Asmr-oc1NaBzW.js} +1 -1
- package/client/dist/assets/{AsmrResetProgressModal-CnF9ZTJQ.js → AsmrResetProgressModal-cYbhZUTn.js} +1 -1
- package/client/dist/assets/AvSyncCalibrator-DyT8IH_y.js +10 -0
- package/client/dist/assets/{AvSyncCalibrator-gEONBv5a.css → AvSyncCalibrator-ieaRTs3u.css} +1 -1
- package/client/dist/assets/{Home-CUZPz_wy.js → Home-D3BVXJ5-.js} +1 -1
- package/client/dist/assets/{Insights-hvaO1jbY.js → Insights-BmBDfdDO.js} +1 -1
- package/client/dist/assets/{LibraryListPage-BeYz_I1y.js → LibraryListPage-C463kkiG.js} +1 -1
- package/client/dist/assets/{ListeningList-D-D-W7JK.js → ListeningList--EcSwlrV.js} +1 -1
- package/client/dist/assets/{Manga-DqIR2B6F.js → Manga-BhOs1yu_.js} +1 -1
- package/client/dist/assets/{MangaInfoPage-CWqxWbb3.js → MangaInfoPage-BP-kWQoG.js} +1 -1
- package/client/dist/assets/{MangaReadPage-BlyJ-OdY.js → MangaReadPage-CWCo81Qx.js} +1 -1
- package/client/dist/assets/{MangaResetProgressModal-gvz9_X7z.js → MangaResetProgressModal-DZGo5ZOV.js} +1 -1
- package/client/dist/assets/{Mature-B1Cuj67a.js → Mature-2wFvZ1Ix.js} +1 -1
- package/client/dist/assets/{MediaCard-GwFTnacn.js → MediaCard-BjnksiL1.js} +1 -1
- package/client/dist/assets/{Music-BEmRDuSo.js → Music-Bkz_ZyA4.js} +1 -1
- package/client/dist/assets/OptionListMenu-DIEBUA77.js +1 -0
- package/client/dist/assets/{Player-khTFa_o1.js → Player-BX_Skj8G.js} +6 -6
- package/client/dist/assets/{Player-B036Ic3m.css → Player-DBLl-bj_.css} +1 -1
- package/client/dist/assets/{PlayerSettings-B16FnAO_.js → PlayerSettings-B5ebT96a.js} +1 -1
- package/client/dist/assets/{QueueOptionsButton-DjBOibpt.js → QueueOptionsButton-iynUiGDS.js} +1 -1
- package/client/dist/assets/{QueueRail-DcLtEU46.js → QueueRail-D2RYa8Lf.js} +1 -1
- package/client/dist/assets/{Radio-rpaFuI72.js → Radio-DuFCL4ru.js} +1 -1
- package/client/dist/assets/{ReadingList-DTnI5411.js → ReadingList-CTOkZdFF.js} +1 -1
- package/client/dist/assets/{ResetProgressModal-Bcv92v7c.js → ResetProgressModal-Cjzd8-mT.js} +1 -1
- package/client/dist/assets/{Search-DNxPl_On.js → Search-CY6kxAYD.js} +1 -1
- package/client/dist/assets/{Settings-CQ-ykTG3.js → Settings-B2cCZBVq.js} +1 -1
- package/client/dist/assets/{SkeletonGrid-ZN-kS9re.js → SkeletonGrid-D98PFdEd.js} +1 -1
- package/client/dist/assets/{Trackers-EN1_ol5G.js → Trackers-CE2fejJC.js} +1 -1
- package/client/dist/assets/{Tv-Bx7tGS57.css → Tv-BlVIanQL.css} +1 -1
- package/client/dist/assets/Tv-BrwGG26Z.js +4 -0
- package/client/dist/assets/{TvInfo-Mpzun3PF.js → TvInfo-Dg_hN9lr.js} +1 -1
- package/client/dist/assets/{TvPopup-YYgg9-7r.js → TvPopup-CuR-CXOg.js} +1 -1
- package/client/dist/assets/{TvSearch-CdL9EA-S.js → TvSearch-DertJ9Je.js} +1 -1
- package/client/dist/assets/{TvWatchlist-DD6nRESU.js → TvWatchlist-DAp6XFbP.js} +1 -1
- package/client/dist/assets/{Watchlist-CD8UqukO.js → Watchlist-C5eiD8Nw.js} +1 -1
- package/client/dist/assets/{hls-E94cMCjR.js → hls-s6kEkfvo.js} +1 -1
- package/client/dist/assets/{index-CZW1But9.js → index-GAU-R8jU.js} +2 -2
- package/client/dist/assets/{useAnimeInfoData-C9tOyy6E.js → useAnimeInfoData-9eudX-hq.js} +1 -1
- package/client/dist/assets/{useAsmr-B4HAapZD.js → useAsmr-Dj8QioSc.js} +1 -1
- package/client/dist/assets/{useAsmrPopup-trIV7nUr.js → useAsmrPopup-QhQCU1HG.js} +1 -1
- package/client/dist/assets/{useMangaLibrary-CZ2Gke8p.js → useMangaLibrary-B6HQI4jU.js} +1 -1
- package/client/dist/assets/{useMangaPopup-80Daa4y-.js → useMangaPopup-BC8Mg08o.js} +1 -1
- package/client/dist/assets/{useProviders-CqMq_6ue.js → useProviders-DoJoJR_4.js} +1 -1
- package/client/dist/assets/{useTv-CHDhiKWu.js → useTv-C0AAHhYE.js} +1 -1
- package/client/dist/assets/{useTvLibrary-DWUGDtld.js → useTvLibrary-B1csgiZ_.js} +1 -1
- package/client/dist/index.html +1 -1
- package/package.json +2 -2
- package/server/dist/hono/tv.js +31 -14
- package/server/dist/lib/ytmusic.js +28 -2
- package/server/dist/trpc/routers/music.js +25 -3
- package/server/dist/trpc/routers/tv.js +1 -0
- package/server/package.json +1 -1
- package/client/dist/assets/AvSyncCalibrator-Cr9n1euF.js +0 -10
- package/client/dist/assets/OptionListMenu-Dlk9eHM7.js +0 -1
- package/client/dist/assets/Tv-C-4wd-BS.js +0 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as u,c as b,u as g,a as c}from"./vendor-query-BBT5_sHx.js";import{t as p,h as i,z as s}from"./index-
|
|
1
|
+
import{b as u,c as b,u as g,a as c}from"./vendor-query-BBT5_sHx.js";import{t as p,h as i,z as s}from"./index-GAU-R8jU.js";import{T as Q}from"./vendor-core-DfaOB3Rn.js";const v=300*1e3,M={mangadex:"https://mangadex.org/",mangapill:"https://www.mangapill.com/"},f=(e,a)=>`/api/proxy?url=${encodeURIComponent(a)}&referer=${encodeURIComponent(M[e])}`,T=(e,a)=>a&&(e==="mangapill"?f(e,a):a),k=(e,a=!0)=>{const{provider:r,query:n,page:o,sort:t,status:m,type:d,rating:y,mature:l}=e;return u({queryKey:["mangaBrowse",r,n,o,t,m,d,y,l],queryFn:()=>p.manga.search.query({provider:r,q:n.trim()||void 0,page:o,sort:t||void 0,status:m||void 0,type:d||void 0,rating:y||void 0,mature:l?"1":void 0}),staleTime:v,enabled:a&&!!r})},E=(e,a=14)=>{const{provider:r,query:n,sort:o,status:t,type:m,rating:d,mature:y}=e;return b({queryKey:["mangaBrowseInfinite",r,n,o,t,m,d,y,a],queryFn:({pageParam:l=1})=>p.manga.search.query({provider:r,q:n.trim()||void 0,page:l,limit:a,sort:o||void 0,status:t||void 0,type:m||void 0,rating:d||void 0,mature:y?"1":void 0}),initialPageParam:1,getNextPageParam:(l,q)=>l.hasNext?q.length+1:void 0,staleTime:v,enabled:!!r})},O=(e,a,r="safe",n=!1)=>u({queryKey:["mangaDetail",e,a,r,n],queryFn:()=>p.manga.info.query({provider:e||"",id:a||"",rating:r,mature:n?"1":void 0}),enabled:!!e&&!!a,staleTime:v}),$=(e,a,r)=>u({queryKey:["mangaPages",e,a],queryFn:()=>p.manga.pages.query({provider:e||"",id:a||""}),enabled:!!e&&!!a,staleTime:1800*1e3}),B=()=>{const e=i();return u({...e.manga.trending.queryOptions(),staleTime:600*1e3,retry:1})},I=e=>e.contentRating==="erotica"||e.contentRating==="pornographic"||e.type==="doujinshi";function N(e,a){const r=e.titles??{};return a==="englishName"?r.en||e.title:a==="nativeName"&&(r.native||r.romaji||e.altTitle)||e.title}function A(e){return{englishName:e.titles?.en??e.title,nativeName:e.titles?.native??e.titles?.romaji??e.altTitle??void 0}}const h=/^anilist:ch:(\d+)$/;function w(e){if(!e)return null;const a=h.exec(e.trim());if(!a)return null;const r=Number.parseInt(a[1],10);return Number.isFinite(r)?r:null}function x(e,a){const r=String(a),n=e.find(o=>(o.number??"").trim()===r);return n||(e.find(o=>{const t=Number.parseFloat((o.number??"").trim());return Number.isFinite(t)&&t===a})??null)}const _=["Reading","Completed","On-Hold","Dropped","Planned"],L=(e,a)=>`${e.toLowerCase()}:${a}`,D=(e="All",a=1,r=24)=>{const n=i();return u(n.mangaLibrary.list.queryOptions({status:e,page:a,limit:r}))},P=()=>{const e=i();return u({...e.mangaLibrary.ids.queryOptions(),staleTime:1e3*60})},U=e=>{const a=i();return u({...a.mangaLibrary.check.queryOptions({id:e??""}),enabled:!!e,staleTime:1e3*60})},j=e=>{const a=i();return u({...a.mangaLibrary.entry.queryOptions({id:e??""}),enabled:!!e,staleTime:1e3*60})},H=()=>{const e=i(),a=g();return c(e.mangaLibrary.link.mutationOptions({onSuccess:r=>{s.success(r?.progressMigrated?"Linked — chapter progress carried over":"Linked to AniList entry"),a.invalidateQueries(e.mangaLibrary.pathFilter()),a.invalidateQueries({queryKey:["manga-library"]}),a.invalidateQueries({queryKey:["manga-continue-reading"]})},onError:r=>{s.error(`Failed to link: ${r.message}`)}}))},z=(e=24)=>{const a=i();return u(a.mangaProgress.continueReading.queryOptions({limit:e}))},V=e=>{const a=i();return u({...a.mangaProgress.byManga.queryOptions({mangaId:e??""}),enabled:!!e})},S=()=>{const e=i(),a=g();return c(e.mangaLibrary.add.mutationOptions({onSuccess:(r,n)=>{n.silent||s.success("Bookmarked"),a.invalidateQueries(e.mangaLibrary.pathFilter()),a.invalidateQueries({queryKey:["manga-library"]})},onError:r=>{s.error(`Failed to bookmark: ${r.message}`)}}))},F=()=>{const e=i(),a=g();return c(e.mangaLibrary.remove.mutationOptions({onSuccess:()=>{s.success("Bookmark removed"),a.invalidateQueries(e.mangaLibrary.pathFilter()),a.invalidateQueries({queryKey:["manga-library"]}),a.invalidateQueries({queryKey:["manga-continue-reading"]})},onError:r=>{s.error(`Failed to remove: ${r.message}`)}}))},Y=()=>{const e=i(),a=g();return c(e.mangaLibrary.setStatus.mutationOptions({onSuccess:()=>{s.success("Status updated"),a.invalidateQueries(e.mangaLibrary.pathFilter()),a.invalidateQueries({queryKey:["manga-library"]}),a.invalidateQueries({queryKey:["manga-continue-reading"]})},onError:r=>{s.error(`Failed to update status: ${r.message}`)}}))},G=()=>{const e=i(),a=g();return c(e.mangaProgress.save.mutationOptions({onSuccess:(r,n)=>{a.invalidateQueries({queryKey:["manga-progress",n.mangaId]}),a.invalidateQueries({queryKey:["manga-continue-reading"]}),a.invalidateQueries({queryKey:["manga-library"]}),a.invalidateQueries(e.mangaProgress.pathFilter())}}))},J=()=>{const e=i(),a=g();return c(e.mangaProgress.remove.mutationOptions({onSuccess:()=>{s.success("Progress reset"),a.invalidateQueries({queryKey:["manga-progress"]}),a.invalidateQueries({queryKey:["manga-continue-reading"]}),a.invalidateQueries({queryKey:["manga-library"]}),a.invalidateQueries(e.mangaProgress.pathFilter())},onError:r=>{s.error(`Failed to reset progress: ${r.message}`)}}))},W=()=>{const e=i(),a=g();return c(e.mangaLibrary.batchStatus.mutationOptions({onSuccess:r=>{s.success(`Status updated for ${r.updated??0} items`),a.invalidateQueries(e.mangaLibrary.pathFilter()),a.invalidateQueries({queryKey:["manga-library"]}),a.invalidateQueries({queryKey:["manga-continue-reading"]})},onError:r=>{s.error(`Failed to update statuses: ${r.message}`)}}))},X=()=>{const e=i(),a=g();return c(e.mangaLibrary.removeMany.mutationOptions({onSuccess:r=>{const n=r.removed??0;s.success(`Removed ${n} ${n===1?"item":"items"} from reading list`),a.invalidateQueries(e.mangaLibrary.pathFilter()),a.invalidateQueries({queryKey:["manga-library"]}),a.invalidateQueries({queryKey:["manga-continue-reading"]})},onError:r=>{s.error(`Failed to remove: ${r.message}`)}}))},Z=()=>{const e=i(),a=g();return c(e.mangaProgress.removeMany.mutationOptions({onSuccess:r=>{const n=r.removed??0;s.success(`Reset progress for ${n} ${n===1?"item":"items"}`),a.invalidateQueries({queryKey:["manga-progress"]}),a.invalidateQueries({queryKey:["manga-continue-reading"]}),a.invalidateQueries({queryKey:["manga-library"]}),a.invalidateQueries(e.mangaProgress.pathFilter())},onError:r=>{s.error(`Failed to reset progress: ${r.message}`)}}))},ee=()=>{const e=S(),a=F(),{data:r}=P(),n=Q(()=>new Set(r?.ids||[]),[r]);return{toggle:t=>{const m=L(t.provider,t.id);n.has(m)?a.mutate(m):e.mutate({provider:t.provider,mangaId:t.id,title:t.title,cover:t.cover,altTitle:t.altTitle,contentRating:t.contentRating})},bookmarkedIds:n,pending:e.isPending||a.isPending}};export{Z as A,J as B,_ as M,E as a,T as b,A as c,z as d,B as e,k as f,j as g,S as h,I as i,H as j,O as k,U as l,L as m,V as n,F as o,Y as p,w as q,N as r,x as s,$ as t,ee as u,f as v,G as w,D as x,W as y,X as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as e,S as f,L as m}from"./vendor-core-DfaOB3Rn.js";import{I as l}from"./vendor-icons-DrybRNxP.js";import{k as y,r as T}from"./useMangaLibrary-
|
|
1
|
+
import{u as e,S as f,L as m}from"./vendor-core-DfaOB3Rn.js";import{I as l}from"./vendor-icons-DrybRNxP.js";import{k as y,r as T}from"./useMangaLibrary-B6HQI4jU.js";import{d as I}from"./index-GAU-R8jU.js";import{p as s,a as k}from"./MediaCard-BjnksiL1.js";import{u as P}from"./usePopup-DS9jMzp6.js";const R=({data:i,anchorRect:d,bookmarked:r,onToggleBookmark:p,onMouseEnter:h,onMouseLeave:v,onRequestClose:g})=>{const{data:a,isLoading:N}=y(i.provider,i.mangaId,i.rating||"safe",i.mature||!1),{titlePreference:u}=I(),t=a?.chapters.length??0,c=[a?.status,a?.type].filter(Boolean).join(" · "),o=T({title:i.title,altTitle:a?.altTitle??i.altTitle},u);return e(k,{anchorRect:d,onMouseEnter:h,onMouseLeave:v,onRequestClose:g,children:N?e("div",{className:s.loading,children:[e("div",{className:s.spinner}),e("span",{children:"Fetching details..."})]}):e(f,{children:[e("div",{className:s.header,children:[e("div",{className:s.title,children:o}),a?.altTitle&&a.altTitle!==o&&e("div",{className:s.synopsis,children:["Also known as: ",a.altTitle]})]}),e("div",{className:s.body,children:[e("div",{className:s.metaRow,children:[c&&e("div",{className:s.metaItem,children:[e(l,{name:"book",size:14}),e("span",{children:c})]}),t>0&&e("div",{className:s.metaItem,children:e("span",{children:[t," chapter",t===1?"":"s"]})}),i.progressLabel&&e("div",{className:s.metaItem,children:[e(l,{name:"bookmark",size:12}),e("span",{children:i.progressLabel})]})]}),e("div",{className:s.synopsis,children:a?.description?a.description:"No synopsis available."}),Array.isArray(a?.genres)&&(a?.genres?.length??0)>0&&e("div",{className:s.details,children:e("div",{className:s.genres,children:a.genres.filter(Boolean).slice(0,4).map(n=>e("span",{className:s.genre,children:n},n))})})]}),e("div",{className:s.footer,children:[e("div",{className:s.primaryAction,children:e(m,{to:i.readTarget,className:s.watchBtn,children:[e(l,{name:"book",size:14}),"Read now"]})}),e("div",{className:s.secondaryActions,children:[e("button",{className:`${s.watchlistBtn} ${r?s.active:""}`,onClick:n=>{n.preventDefault(),n.stopPropagation(),p()},children:[r?e(l,{name:"check",size:12}):e(l,{name:"plus",size:12}),e("span",{children:r?"Remove":"Bookmark"})]}),e(m,{to:`/manga/${i.provider}/${encodeURIComponent(i.mangaId)}`,className:s.detailsBtn,children:"Read more"})]})]})]})})},$=()=>P();export{R as M,$ as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{T as o}from"./vendor-core-DfaOB3Rn.js";import{b as a}from"./vendor-query-BBT5_sHx.js";import{U as i}from"./index-
|
|
1
|
+
import{T as o}from"./vendor-core-DfaOB3Rn.js";import{b as a}from"./vendor-query-BBT5_sHx.js";import{U as i}from"./index-GAU-R8jU.js";const n=300*1e3;function u(r){return{value:r.id,label:r.label,mature:r.mature,kind:r.kind,sub:r.sub,tier:r.tier,browse:r.browse,facets:r.facets,servers:r.servers}}const d=()=>{const r=a({queryKey:["providers"],queryFn:()=>i("/api/providers"),staleTime:n,retry:1}),e=Array.isArray(r.data)?r.data:null,t=o(()=>e&&e.length>0?e.filter(s=>s.loaded).map(u):[],[e]);return{...r,options:t,isFallback:!e||e.length===0}};export{d as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{N as c,u as r,S as d}from"./vendor-core-DfaOB3Rn.js";import{I as v}from"./vendor-icons-DrybRNxP.js";import{M as T}from"./MediaCard-
|
|
1
|
+
import{N as c,u as r,S as d}from"./vendor-core-DfaOB3Rn.js";import{I as v}from"./vendor-icons-DrybRNxP.js";import{M as T}from"./MediaCard-BjnksiL1.js";import{T as g}from"./TvPopup-CuR-CXOg.js";import{c as m,i as f}from"./useTvLibrary-B1csgiZ_.js";import{b as i}from"./vendor-query-BBT5_sHx.js";import{h as p}from"./index-GAU-R8jU.js";const _=c(({item:e})=>{const o=e.type==="tv"||e.type==="tvSeries"||e.type==="tvMiniSeries",s=m(e.type,e.id);return r(T,{item:{id:String(e.id),title:e.title,thumbnail:e.image,typeBadge:o?"TV":"Movie",isAdult:f(e)},linkTo:s,hoverIcon:"info",showInfoButton:!0,metaRow:r(d,{children:[e.year&&r("span",{style:{opacity:.75},children:e.year}),e.vote_average!=null&&r("span",{style:{display:"inline-flex",alignItems:"center",gap:3},children:[r(v,{name:"star",size:10}),Number(e.vote_average).toFixed(1)]})]}),renderPopup:(a,t)=>r(g,{item:e,anchorRect:a,onMouseEnter:t.onMouseEnter,onMouseLeave:t.onMouseLeave,onRequestClose:t.close})})}),u=1e3*60*5,b=e=>{const o=p(),{query:s,type:a,genre:t,year:n,sort_by:l,page:y}=e;return i({...o.tv.search.queryOptions({q:s?.trim()||"",type:a||"multi",genre:t||"",year:n&&n!=="ALL"?n:"",sortBy:l||"popularity.desc",page:y||1}),staleTime:u,retry:1})},A=(e="all",o="week",s=1,a=!0)=>{const t=p();return i({...t.tv.trending.queryOptions({mediaType:e,timeWindow:o,page:s}),enabled:a,staleTime:u,retry:1})};export{_ as T,b as a,A as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{T as y}from"./vendor-core-DfaOB3Rn.js";import{b as v,u as o,a as n}from"./vendor-query-BBT5_sHx.js";import{h as a,z as i,t as p}from"./index-
|
|
1
|
+
import{T as y}from"./vendor-core-DfaOB3Rn.js";import{b as v,u as o,a as n}from"./vendor-query-BBT5_sHx.js";import{h as a,z as i,t as p}from"./index-GAU-R8jU.js";const d=t=>String(t).toLowerCase()==="movie"?"movie":"tv",m=(t,e)=>`${d(t)}:${e}`,L=(t,e)=>{const r=d(t);return`/tv/${e}?type=${r}`},S=(t,e,r,s)=>{const u=new URLSearchParams;return u.set("type",d(t)),r!==void 0&&u.set("s",String(r)),s!==void 0&&u.set("e",String(s)),`/tv/${e}/watch?${u.toString()}`},F=t=>t.adult===!0||t.adult===1,K=["Watching","Completed","On-Hold","Dropped","Planned"],g=(t,e)=>m(t,e),$=(t="All",e=1,r=24)=>{const s=a();return v(s.tvLibrary.list.queryOptions({status:t,page:e,limit:r}))},h=()=>{const t=a();return v({...t.tvLibrary.ids.queryOptions(),staleTime:1e3*60})},C=t=>{const e=a();return v({...e.tvLibrary.check.queryOptions({id:t||""}),enabled:!!t,staleTime:1e3*60})},w=(t=24)=>{const e=a();return v(e.tvProgress.continueWatching.queryOptions({limit:t}))},O=t=>{const e=a();return v({...e.tvProgress.getByMedia.queryOptions({mediaId:t||""}),enabled:!!t})},f=(t,e,r)=>{const s=a();return v({...s.tvProgress.latest.queryOptions({mediaId:t||"",season:e,episode:r}),enabled:!!t,staleTime:0})},b=()=>{const t=a(),e=o();return n({mutationFn:async r=>{const{silent:s,...u}=r;return p.tvLibrary.add.mutate(u)},onSuccess:(r,s)=>{s.silent||i.success("Added to TV watchlist"),e.invalidateQueries({queryKey:["tv-library"]}),e.invalidateQueries(t.tvLibrary.pathFilter())},onError:r=>{i.error(`Failed to add: ${r.message}`)}})},Q=()=>{const t=a(),e=o();return n(t.tvLibrary.remove.mutationOptions({onSuccess:()=>{i.success("Removed from TV watchlist"),e.invalidateQueries({queryKey:["tv-library"]}),e.invalidateQueries({queryKey:["tv-continue-watching"]}),e.invalidateQueries(t.tvLibrary.pathFilter()),e.invalidateQueries(t.tvProgress.pathFilter())},onError:r=>{i.error(`Failed to remove: ${r.message}`)}}))},k=()=>{const t=a(),e=o();return n(t.tvLibrary.setStatus.mutationOptions({onSuccess:()=>{i.success("Status updated"),e.invalidateQueries({queryKey:["tv-library"]}),e.invalidateQueries({queryKey:["tv-continue-watching"]}),e.invalidateQueries(t.tvLibrary.pathFilter()),e.invalidateQueries(t.tvProgress.pathFilter())},onError:r=>{i.error(`Failed to update status: ${r.message}`)}}))},R=()=>{const t=a(),e=o();return n(t.tvProgress.save.mutationOptions({onSuccess:(r,s)=>{e.invalidateQueries({queryKey:["tv-progress",s.mediaId]}),e.invalidateQueries({queryKey:["tv-continue-watching"]}),e.invalidateQueries({queryKey:["tv-library"]}),e.invalidateQueries(t.tvLibrary.pathFilter()),e.invalidateQueries(t.tvProgress.pathFilter())}}))},B=()=>{const t=a(),e=o();return n(t.tvProgress.remove.mutationOptions({onSuccess:()=>{i.success("Progress reset"),e.invalidateQueries({queryKey:["tv-progress"]}),e.invalidateQueries({queryKey:["tv-continue-watching"]}),e.invalidateQueries({queryKey:["tv-library"]}),e.invalidateQueries(t.tvLibrary.pathFilter()),e.invalidateQueries(t.tvProgress.pathFilter())},onError:r=>{i.error(`Failed to reset progress: ${r.message}`)}}))},E=()=>{const t=a(),e=o();return n(t.tvLibrary.batchStatus.mutationOptions({onSuccess:r=>{i.success(`Status updated for ${r.updated??0} items`),e.invalidateQueries({queryKey:["tv-library"]}),e.invalidateQueries({queryKey:["tv-continue-watching"]}),e.invalidateQueries(t.tvLibrary.pathFilter()),e.invalidateQueries(t.tvProgress.pathFilter())},onError:r=>{i.error(`Failed to update statuses: ${r.message}`)}}))},I=()=>{const t=a(),e=o();return n(t.tvLibrary.removeMany.mutationOptions({onSuccess:r=>{const s=r.removed??0;i.success(`Removed ${s} ${s===1?"item":"items"} from TV watchlist`),e.invalidateQueries({queryKey:["tv-library"]}),e.invalidateQueries({queryKey:["tv-continue-watching"]}),e.invalidateQueries(t.tvLibrary.pathFilter()),e.invalidateQueries(t.tvProgress.pathFilter())},onError:r=>{i.error(`Failed to remove: ${r.message}`)}}))},A=()=>{const t=a(),e=o();return n(t.tvProgress.removeMany.mutationOptions({onSuccess:r=>{const s=r.removed??0;i.success(`Reset progress for ${s} ${s===1?"item":"items"}`),e.invalidateQueries({queryKey:["tv-progress"]}),e.invalidateQueries({queryKey:["tv-continue-watching"]}),e.invalidateQueries({queryKey:["tv-library"]}),e.invalidateQueries(t.tvLibrary.pathFilter()),e.invalidateQueries(t.tvProgress.pathFilter())},onError:r=>{i.error(`Failed to reset progress: ${r.message}`)}}))},M=()=>{const t=b(),e=Q(),{data:r}=h(),s=y(()=>new Set(r?.ids||[]),[r]);return{toggle:c=>{const l=g(c.mediaType,c.tmdbId);s.has(l)?e.mutate(l):t.mutate({...c,poster:c.poster||""})},bookmarkedIds:s,pending:t.isPending||e.isPending}};export{K as T,Q as a,B as b,L as c,m as d,C as e,M as f,R as g,k as h,F as i,f as j,O as k,$ as l,E as m,d as n,I as o,A as p,S as t,w as u};
|
package/client/dist/index.html
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
background-color: #0c0d12;
|
|
34
34
|
}
|
|
35
35
|
</style>
|
|
36
|
-
<script type="module" crossorigin src="/assets/index-
|
|
36
|
+
<script type="module" crossorigin src="/assets/index-GAU-R8jU.js"></script>
|
|
37
37
|
<link rel="modulepreload" crossorigin href="/assets/vendor-core-DfaOB3Rn.js">
|
|
38
38
|
<link rel="modulepreload" crossorigin href="/assets/vendor-query-BBT5_sHx.js">
|
|
39
39
|
<link rel="modulepreload" crossorigin href="/assets/vendor-icons-DrybRNxP.js">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serifpersia/dango",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.4",
|
|
4
4
|
"description": "A web application for watching anime.",
|
|
5
5
|
"main": "orchestrator.js",
|
|
6
6
|
"repository": {
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"allowScripts": {
|
|
84
84
|
"esbuild@0.28.2": true
|
|
85
85
|
},
|
|
86
|
-
"versionDate": "2026-10-
|
|
86
|
+
"versionDate": "2026-10-11T12:50:11.494Z"
|
|
87
87
|
}
|
package/server/dist/hono/tv.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import logger from '../logger.js';
|
|
2
|
-
import { linkAbort, setProxyHeaders } from '../utils/http.utils.js';
|
|
2
|
+
import { fetchWithRetry, linkAbort, setProxyHeaders } from '../utils/http.utils.js';
|
|
3
3
|
import { URL } from 'url';
|
|
4
4
|
import { isSafeExternalUrl } from '../utils/security.utils.js';
|
|
5
5
|
function proxiedMediaUrl(targetUrl, refererStr) {
|
|
@@ -83,11 +83,10 @@ export function registerTv(app, getTvProvider) {
|
|
|
83
83
|
};
|
|
84
84
|
if (refererStr)
|
|
85
85
|
headers['Referer'] = refererStr;
|
|
86
|
-
const fetchResp = await
|
|
86
|
+
const fetchResp = await fetchWithRetry(urlStr, {
|
|
87
87
|
headers,
|
|
88
|
-
signal: abort.signal,
|
|
89
88
|
redirect: 'follow',
|
|
90
|
-
});
|
|
89
|
+
}, { retries: 3, baseDelayMs: 750, signal: abort.signal });
|
|
91
90
|
const status = fetchResp.status;
|
|
92
91
|
if (status !== 200 && status !== 206) {
|
|
93
92
|
return c.text('Upstream error', (status || 502));
|
|
@@ -106,21 +105,23 @@ export function registerTv(app, getTvProvider) {
|
|
|
106
105
|
outHeaders.set('Content-Length', String(bodyBuffer.length));
|
|
107
106
|
return new Response(bodyBuffer, { status, headers: outHeaders });
|
|
108
107
|
}
|
|
109
|
-
const chunks = [];
|
|
110
108
|
const reader = fetchResp.body?.getReader();
|
|
111
109
|
if (!reader) {
|
|
112
110
|
logger.warn({ host: safeCheck.url?.hostname }, 'tv stream-proxy: upstream sent no body');
|
|
113
111
|
return c.text('Upstream sent no body', 502);
|
|
114
112
|
}
|
|
115
113
|
try {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
114
|
+
const first = await reader.read();
|
|
115
|
+
const head = first.done ? Buffer.alloc(0) : Buffer.from(first.value);
|
|
116
|
+
if (isPlaylistBody(head)) {
|
|
117
|
+
const chunks = [head];
|
|
118
|
+
while (true) {
|
|
119
|
+
const { done, value } = await reader.read();
|
|
120
|
+
if (done)
|
|
121
|
+
break;
|
|
122
|
+
chunks.push(Buffer.from(value));
|
|
123
|
+
}
|
|
124
|
+
const body = Buffer.concat(chunks);
|
|
124
125
|
const baseUrl = new URL(fetchResp.url || urlStr);
|
|
125
126
|
const rewritten = rewriteTvPlaylist(body.toString('utf8'), baseUrl, refererStr);
|
|
126
127
|
const bodyBuffer = Buffer.from(rewritten, 'utf8');
|
|
@@ -128,7 +129,23 @@ export function registerTv(app, getTvProvider) {
|
|
|
128
129
|
outHeaders.set('Content-Length', String(bodyBuffer.length));
|
|
129
130
|
return new Response(bodyBuffer, { status, headers: outHeaders });
|
|
130
131
|
}
|
|
131
|
-
|
|
132
|
+
const stream = new ReadableStream({
|
|
133
|
+
start(controller) {
|
|
134
|
+
if (head.length)
|
|
135
|
+
controller.enqueue(head);
|
|
136
|
+
},
|
|
137
|
+
async pull(controller) {
|
|
138
|
+
const { done, value } = await reader.read();
|
|
139
|
+
if (done)
|
|
140
|
+
controller.close();
|
|
141
|
+
else
|
|
142
|
+
controller.enqueue(value);
|
|
143
|
+
},
|
|
144
|
+
cancel(reason) {
|
|
145
|
+
return reader.cancel(reason);
|
|
146
|
+
},
|
|
147
|
+
});
|
|
148
|
+
return new Response(stream, { status, headers: outHeaders });
|
|
132
149
|
}
|
|
133
150
|
catch (err) {
|
|
134
151
|
logger.warn({ err, host: safeCheck.url?.hostname }, 'tv stream-proxy: upstream body stream failed');
|
|
@@ -96,8 +96,30 @@ export async function refreshAuthedInnertube() {
|
|
|
96
96
|
return null;
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
const AUTH_TTL_MS = 5 * 60 * 1000;
|
|
100
|
+
let authProbeAt = 0;
|
|
101
|
+
let authProbeOk = false;
|
|
102
|
+
export async function verifyMusicSession() {
|
|
103
|
+
if (!readCookie())
|
|
104
|
+
return false;
|
|
105
|
+
const now = Date.now();
|
|
106
|
+
if (now - authProbeAt < AUTH_TTL_MS)
|
|
107
|
+
return authProbeOk;
|
|
108
|
+
authProbeAt = now;
|
|
109
|
+
try {
|
|
110
|
+
const yt = await getAuthedInnertube();
|
|
111
|
+
if (!yt)
|
|
112
|
+
return false;
|
|
113
|
+
await yt.account.getInfo();
|
|
114
|
+
authProbeOk = true;
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
authProbeOk = false;
|
|
118
|
+
}
|
|
119
|
+
return authProbeOk;
|
|
120
|
+
}
|
|
121
|
+
export async function getMusicAuthStatus() {
|
|
122
|
+
return { authenticated: await verifyMusicSession() };
|
|
101
123
|
}
|
|
102
124
|
export async function saveMusicCookie(cookie) {
|
|
103
125
|
const clean = cookie.trim();
|
|
@@ -122,6 +144,8 @@ export async function saveMusicCookie(cookie) {
|
|
|
122
144
|
}
|
|
123
145
|
fs.writeFileSync(COOKIE_PATH, clean, 'utf-8');
|
|
124
146
|
authedTube = trial;
|
|
147
|
+
authProbeAt = Date.now();
|
|
148
|
+
authProbeOk = true;
|
|
125
149
|
logger.info('[ytmusic] cookie sign-in validated and saved');
|
|
126
150
|
}
|
|
127
151
|
export async function signOutMusic() {
|
|
@@ -133,4 +157,6 @@ export async function signOutMusic() {
|
|
|
133
157
|
// ignore
|
|
134
158
|
}
|
|
135
159
|
authedTube = null;
|
|
160
|
+
authProbeAt = 0;
|
|
161
|
+
authProbeOk = false;
|
|
136
162
|
}
|
|
@@ -2,7 +2,7 @@ import { TRPCError } from '@trpc/server';
|
|
|
2
2
|
import { protectedProcedure, router } from '../index.js';
|
|
3
3
|
import { badRequest, defineSchema, failed, optStr, reqObj } from '../validation.js';
|
|
4
4
|
import logger from '../../logger.js';
|
|
5
|
-
import { getInnertube, getAuthedInnertube, refreshAuthedInnertube, saveMusicCookie, getMusicAuthStatus, signOutMusic, isParserVariantError, } from '../../lib/ytmusic.js';
|
|
5
|
+
import { getInnertube, getAuthedInnertube, refreshAuthedInnertube, saveMusicCookie, getMusicAuthStatus, signOutMusic, isParserVariantError, verifyMusicSession, } from '../../lib/ytmusic.js';
|
|
6
6
|
const NAME_SUFFIXES = [
|
|
7
7
|
/\s*(- topic)$/i,
|
|
8
8
|
/\s*vevo$/i,
|
|
@@ -150,6 +150,9 @@ function upnextToTrack(node, trustLike = false) {
|
|
|
150
150
|
...(liked !== null ? { liked } : {}),
|
|
151
151
|
};
|
|
152
152
|
}
|
|
153
|
+
function isSignInPrompt(endpoint) {
|
|
154
|
+
return !!endpoint?.payload && 'signInEndpoint' in endpoint.payload;
|
|
155
|
+
}
|
|
153
156
|
function parseUpnext(panel, trustLike) {
|
|
154
157
|
const tracks = [];
|
|
155
158
|
const shaped = panel;
|
|
@@ -592,6 +595,9 @@ export const musicRouter = router({
|
|
|
592
595
|
if (!yt) {
|
|
593
596
|
throw unauthorized('MUSIC_AUTH_REQUIRED');
|
|
594
597
|
}
|
|
598
|
+
if (!(await verifyMusicSession())) {
|
|
599
|
+
throw unauthorized('MUSIC_AUTH_REQUIRED');
|
|
600
|
+
}
|
|
595
601
|
const attempt = async (session) => {
|
|
596
602
|
const shaped = session;
|
|
597
603
|
const actions = shaped.actions ?? shaped.session?.actions;
|
|
@@ -600,12 +606,21 @@ export const musicRouter = router({
|
|
|
600
606
|
const panel = await session.music.getUpNext(id);
|
|
601
607
|
const contents = panel.contents ?? [];
|
|
602
608
|
let endpoint = null;
|
|
609
|
+
let signedOut = false;
|
|
603
610
|
for (const item of contents) {
|
|
604
611
|
const toggle = findLikeToggle(item, id);
|
|
605
|
-
|
|
606
|
-
if (
|
|
612
|
+
const picked = like ? toggle.like : toggle.unlike;
|
|
613
|
+
if (isSignInPrompt(picked)) {
|
|
614
|
+
signedOut = true;
|
|
615
|
+
continue;
|
|
616
|
+
}
|
|
617
|
+
if (picked) {
|
|
618
|
+
endpoint = picked;
|
|
607
619
|
break;
|
|
620
|
+
}
|
|
608
621
|
}
|
|
622
|
+
if (signedOut && !endpoint)
|
|
623
|
+
throw new Error('MUSIC_SESSION_EXPIRED');
|
|
609
624
|
if (!endpoint)
|
|
610
625
|
throw new Error('Like toggle not found for track');
|
|
611
626
|
await endpoint.call(actions);
|
|
@@ -614,6 +629,10 @@ export const musicRouter = router({
|
|
|
614
629
|
await attempt(yt);
|
|
615
630
|
}
|
|
616
631
|
catch (err) {
|
|
632
|
+
if (err.message === 'MUSIC_SESSION_EXPIRED') {
|
|
633
|
+
logger.warn('[music] like rejected, session expired');
|
|
634
|
+
throw unauthorized('MUSIC_AUTH_REQUIRED');
|
|
635
|
+
}
|
|
617
636
|
logger.warn({ err }, '[music] rate failed, retrying with a fresh saved-cookie session');
|
|
618
637
|
const fresh = await refreshAuthedInnertube();
|
|
619
638
|
if (!fresh)
|
|
@@ -622,6 +641,9 @@ export const musicRouter = router({
|
|
|
622
641
|
await attempt(fresh);
|
|
623
642
|
}
|
|
624
643
|
catch (retryErr) {
|
|
644
|
+
if (retryErr.message === 'MUSIC_SESSION_EXPIRED') {
|
|
645
|
+
throw unauthorized('MUSIC_AUTH_REQUIRED');
|
|
646
|
+
}
|
|
625
647
|
logger.error({ err: retryErr }, '[music] rate retry failed');
|
|
626
648
|
throw failed('Like action failed');
|
|
627
649
|
}
|
package/server/package.json
CHANGED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import{u as r,A as b,d as C,h as A,q as B,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 Je,O as Dt,g as Ot}from"./index-CZW1But9.js";import{I as Q}from"./vendor-icons-DrybRNxP.js";import{u as qt}from"./vendor-query-BBT5_sHx.js";const Ht="_controls_ov6ol_1",Vt="_titleContainer_ov6ol_9",Wt="_scheduleInfo_ov6ol_15",Ut="_status_ov6ol_23",zt="_nextEpisode_ov6ol_35",Kt="_watchlistBtn_ov6ol_45",Gt="_inList_ov6ol_72",Xt="_queueBtn_ov6ol_83",Jt="_queueActive_ov6ol_95",Qt="_modeToggleBtn_ov6ol_101",jt="_modeToggleActive_ov6ol_108",Yt="_nativeToggleBtn_ov6ol_119",Zt="_nativeToggleActive_ov6ol_132",en="_markWatchedBtn_ov6ol_153",tn="_markWatchedDone_ov6ol_167",nn="_completeSeriesBtn_ov6ol_178",rn="_providerAndEpisodeRow_ov6ol_192",on="_episodeActions_ov6ol_199",sn="_desktopEpisodeActions_ov6ol_206",an="_mobileEpisodeActions_ov6ol_213",cn="_episodeNavBtn_ov6ol_217",ln="_primary_ov6ol_247",un="_secondary_ov6ol_257",dn="_episodePickerBtn_ov6ol_261",pn="_queueCountdown_ov6ol_265",fn="_speedBoostBadge_ov6ol_280",mn="_videoContainer_ov6ol_311",hn="_loadingOverlay_ov6ol_324",vn="_loadingDots_ov6ol_338",_n="_dot_ov6ol_343",gn="_bounce_ov6ol_1",yn="_bufferingOverlay_ov6ol_372",bn="_bufferingSpinner_ov6ol_381",wn="_spin_ov6ol_921",Sn="_videoIframe_ov6ol_396",Cn="_videoElementHidden_ov6ol_419",kn="_upscalerCanvas_ov6ol_424",En="_upscalerActive_ov6ol_437",Ln="_upscalerStatusBadge_ov6ol_441",Tn="_subtitleOverlay_ov6ol_456",xn="_controlsOverlay_ov6ol_468",Bn="_hidden_ov6ol_498",Nn="_centerPlayPause_ov6ol_504",In="_bottomControls_ov6ol_536",Pn="_progressBarContainer_ov6ol_553",Mn="_progressBar_ov6ol_553",An="_scrubbing_ov6ol_576",$n="_watchedBar_ov6ol_581",Fn="_bufferedBar_ov6ol_582",Rn="_thumb_ov6ol_604",Dn="_timeBubble_ov6ol_625",On="_skipSegment_ov6ol_648",qn="_op_ov6ol_662",Hn="_ed_ov6ol_666",Vn="_recap_ov6ol_670",Wn="_bottomControlsRow_ov6ol_674",Un="_controlBtn_ov6ol_682",zn="_timeDisplay_ov6ol_706",Kn="_leftControls_ov6ol_715",Gn="_rightControls_ov6ol_716",Xn="_middleControls_ov6ol_717",Jn="_skipControls_ov6ol_723",Qn="_skipBtn_ov6ol_729",jn="_volumeContainer_ov6ol_753",Yn="_volumeSlider_ov6ol_760",Zn="_settingsMenu_ov6ol_838",er="_slideUp_ov6ol_1",tr="_qualityListInMenu_ov6ol_877",nr="_ccOptionsContainer_ov6ol_878",rr="_qualityItemInMenu_ov6ol_886",or="_ccItem_ov6ol_887",sr="_active_ov6ol_908",ar="_sourceLoader_ov6ol_915",cr="_spinner_ov6ol_921",ir="_watchBtn_ov6ol_980",lr="_errorOverlay_ov6ol_1026",ur="_retryButton_ov6ol_1036",dr="_sourceSelectionContainer_ov6ol_1064",pr="_slideUpIn_ov6ol_1",fr="_providerSelectContainer_ov6ol_1079",mr="_providerSelect_ov6ol_1079",hr="_sourceSelect_ov6ol_1064",vr="_sourceButtons_ov6ol_1135",_r="_sourceButton_ov6ol_1135",gr="_detailsBox_ov6ol_1167",yr="_detailsToggleBtn_ov6ol_1180",br="_detailsGridContainer_ov6ol_1204",wr="_fadeIn_ov6ol_1",Sr="_detailItem_ov6ol_1216",Cr="_animeStatus_ov6ol_1236",kr="_genresList_ov6ol_1249",Er="_genreTag_ov6ol_1256",Lr="_loadingDetails_ov6ol_1274",Tr="_descriptionSection_ov6ol_1281",xr="_description_ov6ol_1281",Br="_epJumpControls_ov6ol_1317",Nr="_epRangeButtons_ov6ol_1328",Ir="_metaTags_ov6ol_1334",Pr="_epRangeBtn_ov6ol_1341",Mr="_epJumpInputGroup_ov6ol_1356",Ar="_fullscreenActive_ov6ol_1388",$r="_errorSubtext_ov6ol_1432",bs={controls:Ht,titleContainer:Vt,scheduleInfo:Wt,status:Ut,nextEpisode:zt,watchlistBtn:Kt,inList:Gt,queueBtn:Xt,queueActive:Jt,modeToggleBtn:Qt,modeToggleActive:jt,nativeToggleBtn:Yt,nativeToggleActive:Zt,markWatchedBtn:en,markWatchedDone:tn,completeSeriesBtn:nn,providerAndEpisodeRow:rn,episodeActions:on,desktopEpisodeActions:sn,mobileEpisodeActions:an,episodeNavBtn:cn,primary:ln,secondary:un,episodePickerBtn:dn,queueCountdown:pn,speedBoostBadge:fn,videoContainer:mn,loadingOverlay:hn,loadingDots:vn,dot:_n,bounce:gn,bufferingOverlay:yn,bufferingSpinner:bn,spin:wn,videoIframe:Sn,videoElementHidden:Cn,upscalerCanvas:kn,upscalerActive:En,upscalerStatusBadge:Ln,subtitleOverlay:Tn,controlsOverlay:xn,hidden:Bn,centerPlayPause:Nn,bottomControls:In,progressBarContainer:Pn,progressBar:Mn,scrubbing:An,watchedBar:$n,bufferedBar:Fn,thumb:Rn,timeBubble:Dn,skipSegment:On,op:qn,ed:Hn,recap:Vn,bottomControlsRow:Wn,controlBtn:Un,timeDisplay:zn,leftControls:Kn,rightControls:Gn,middleControls:Xn,skipControls:Jn,skipBtn:Qn,volumeContainer:jn,volumeSlider:Yn,settingsMenu:Zn,slideUp:er,qualityListInMenu:tr,ccOptionsContainer:nr,qualityItemInMenu:rr,ccItem:or,active:sr,sourceLoader:ar,spinner:cr,watchBtn:ir,errorOverlay:lr,retryButton:ur,sourceSelectionContainer:dr,slideUpIn:pr,providerSelectContainer:fr,providerSelect:mr,sourceSelect:hr,sourceButtons:vr,sourceButton:_r,detailsBox:gr,detailsToggleBtn:yr,detailsGridContainer:br,fadeIn:wr,detailItem:Sr,animeStatus:Cr,genresList:kr,genreTag:Er,loadingDetails:Lr,descriptionSection:Tr,description:xr,epJumpControls:Br,epRangeButtons:Nr,metaTags:Ir,epRangeBtn:Pr,epJumpInputGroup:Mr,fullscreenActive:Ar,errorSubtext:$r},Fr="_playerPageLayout_6lomc_1",Rr="_episodeSidebar_6lomc_15",Dr="_playerMain_6lomc_28",Or="_videoPlayerWrapper_6lomc_36",qr="_playerInfoHeader_6lomc_52",Hr="_playerAnimeCard_6lomc_58",Vr="_playerInfoContainer_6lomc_70",Wr="_videoTitleSection_6lomc_94",Ur="_theaterMode_6lomc_276",zr="_theaterAmbient_6lomc_310",Kr={playerPageLayout:Fr,episodeSidebar:Rr,playerMain:Dr,videoPlayerWrapper:Or,playerInfoHeader:qr,playerAnimeCard:Hr,playerInfoContainer:Vr,videoTitleSection:Wr,theaterMode:Ur,theaterAmbient:zr},Gr="_shell_41rxp_1",Xr="_stage_41rxp_37",Jr="_shellFill_41rxp_85",Qr="_shellFullscreen_41rxp_93",jr="_uiLayer_41rxp_107",Yr="_volumeWrap_41rxp_118",Zr="_volumeSlider_41rxp_124",ae={shell:Gr,stage:Xr,shellFill:Jr,shellFullscreen:Qr,uiLayer:jr,volumeWrap:Yr,volumeSlider:Zr},eo=.8,to=5,ws=2e3,Ze="autoplayEnabled",no=(e,n)=>n>0&&e>=n*eo,Ss=(e,n)=>e>to&&!no(e,n),Cs=()=>{try{return localStorage.getItem(Ze)==="true"}catch{return!1}},ks=e=>{try{localStorage.setItem(Ze,String(e))}catch{}},ro=["finished","completed","complete","ended"],Es=(e,n,t)=>e.length>0&&!!n&&e[e.length-1]===n&&ro.some(s=>String(t||"").trim().toLowerCase().includes(s)),Ls=e=>e.seekInduced?"none":e.autoplayEnabled&&e.hasNext?"advance":e.hasNext?"prompt-next":e.isFinal?"prompt-complete":"none",oo=e=>(e.language??e.lang??"").toLowerCase(),so=e=>(e.label??"").toLowerCase(),ao=e=>`${e.language??e.lang??""}|||${e.label??""}`,co=e=>oo(e).startsWith("en")||so(e).includes("english");function Ts(e,n){if(e.length===0||n?.enabled===!1)return-1;const t=n?.lastKey??null;if(t){const o=e.findIndex(i=>ao(i)===t);if(o>=0)return o}const s=e.findIndex(co);return s>=0?s:0}const Z={fontSize:1.8,position:0,bgOpacity:.5,bgColor:"#000000",textColor:"#ffffff",edge:"shadow",bold:!1},Be=(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,s)=>{try{const o=localStorage.getItem(e);if(o===null)return n;const i=parseFloat(o);return Number.isFinite(i)?Be(i,t,s):n}catch{return n}};function io(){let e=Z.edge,n=Z.bgColor,t=Z.textColor,s=Z.bold;try{const o=localStorage.getItem("subtitleEdge");(o==="shadow"||o==="outline"||o==="none")&&(e=o);const i=localStorage.getItem("subtitleBgColor");Ne(i)&&(n=i);const p=localStorage.getItem("subtitleTextColor");Ne(p)&&(t=p);const _=localStorage.getItem("subtitleBold");_!==null&&(s=_==="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:s}}function et(e,n){const t=`rgba(0, 0, 0, ${Be(n,0,1)})`;if(!Ne(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}, ${Be(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 xs(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 Bs(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 lo=new Set(["b","i","u","strong","em"]);function Ns(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/<(\/?)([a-zA-Z]+)>/g,(t,s,o)=>lo.has(o.toLowerCase())?`<${s}${o.toLowerCase()}>`:t)}function Is(e){return e.replace(/<[^>]*>/g,"")}const Ps=["#ffffff","#ffff00","#7CFC00","#00e5ff","#ff9ff3","#ffa502"],Ms=["#000000","#1e272e","#2f3542","#3d0c02","#0c3d2e","#ffffff"];function As(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 $s(e){const n=Math.abs(e/1e3).toFixed(1);return e>0?`+${n}s`:e<0?`-${n}s`:"0.0s"}function Fs(e,n){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 p=Math.max(0,(s-i)/2),_=Math.max(0,Math.min(100,Number(n)||0))/100*i;return p+_}const Rs=({isOpen:e,onClose:n,title:t,message:s,resumeLabel:o="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:s}),r("div",{style:{marginTop:"1rem",display:"flex",gap:"10px",justifyContent:"center"},children:[r(re,{variant:"secondary",onClick:_,children:i}),r(re,{onClick:p,children:o})]})]})}),uo="_centerControls_61n7k_1",po="_centerSkipBtn_61n7k_15",fo="_centerPlayPause_61n7k_40",mo="_playIconOffset_61n7k_71",de={centerControls:uo,centerSkipBtn:po,centerPlayPause:fo,playIconOffset:mo},Ds=({isPlaying:e,onTogglePlay:n,onSkipBack:t,onSkipForward:s,skipSeconds:o=10})=>r("div",{className:de.centerControls,onClick:i=>i.stopPropagation(),children:[r("button",{className:de.centerSkipBtn,onClick:t,title:`Skip back ${o}s`,"aria-label":`Skip back ${o} seconds`,children:r(Q,{name:"replay-10"})}),r("button",{className:de.centerPlayPause,"data-speed-boost-ignore":"true",onClick:n,"aria-label":e?"Pause":"Play",children:e?r(Q,{name:"pause"}):r(Q,{name:"play",className:de.playIconOffset})}),r("button",{className:de.centerSkipBtn,onClick:s,title:`Skip forward ${o}s`,"aria-label":`Skip forward ${o} seconds`,children:r(Q,{name:"forward-10"})})]}),Os=({visible:e,title:n,episode:t,onBack:s,classes:o})=>r("div",{className:`${o.overlay} ${e?"":o.hidden} `,"data-speed-boost-ignore":"true",style:{pointerEvents:"none",background:"none"},children:r("div",{className:o.top,onClick:i=>i.stopPropagation(),children:[r("button",{className:o.backBtn,onClick:i=>{i.stopPropagation(),s()},title:"Back","aria-label":"Back",children:r(Q,{name:"chevron-left"})}),r("div",{className:o.titleInfo,children:[r("span",{className:o.title,children:n}),t&&r("span",{className:o.episode,children:t})]})]})}),qs=({classes:e,videoRef:n,duration:t,formatTime:s,isScrubbing:o,buffered:i="auto",onSeek:p,onScrubStart:_,onScrubMove:c,onScrubEnd:h,timeLabelRef:l,children:E})=>{const v=b(null),L=b(null),f=b(null),g=b(null),S=b(null),u=b(!1),y=b(o);y.current=o;const d=b({onScrubMove:c,onScrubEnd:h});d.current={onScrubMove:c,onScrubEnd:h};const[N,$]=C({time:0,position:null});A(()=>{const m=n.current;if(!m)return;const w=j=>{const D=j/t*100||0;L.current&&(L.current.style.width=`${D}%`),f.current&&(f.current.style.left=`${D}%`),l?.current&&(l.current.innerText=`${s(j)} / ${s(t)}`)},R=()=>{o||w(m.currentTime)},U=()=>{if(i==="auto"&&m.buffered.length>0){const D=m.buffered.end(m.buffered.length-1)/t*100||0;g.current&&(g.current.style.width=`${D}%`)}};return w(m.currentTime),U(),m.addEventListener("timeupdate",R),m.addEventListener("progress",U),()=>{m.removeEventListener("timeupdate",R),m.removeEventListener("progress",U)}},[n,t,o,i,s,l]);const W=m=>{if(!v.current)return 0;const w=v.current.getBoundingClientRect();return Math.min(1,Math.max(0,(m-w.left)/w.width))},G=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=`${s(w)} / ${s(t)}`);const U=v.current?.getBoundingClientRect();$({time:w,position:U?m*U.width:null})};A(()=>{if(!o){S.current=null;return}const m=R=>{if(S.current!==null&&R.pointerId!==S.current||!t)return;const U=W(R.clientX);d.current.onScrubMove(U);const j=U*t,D=j/t*100||0;L.current&&(L.current.style.width=`${D}%`),f.current&&(f.current.style.left=`${D}%`),l?.current&&(l.current.innerText=`${s(j)} / ${s(t)}`);const ee=v.current?.getBoundingClientRect();$({time:j,position:ee?U*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)}},[o,t,s,l]);const x=m=>{if(m.pointerType==="mouse"&&m.button!==0||!n.current||!t)return;m.preventDefault(),S.current=m.pointerId;try{v.current?.setPointerCapture(m.pointerId)}catch{}y.current||_();const w=W(m.clientX);c(w),G(w)},q=m=>{if(!t||y.current||m.pointerType!=="mouse")return;const w=W(m.clientX);$({time:w*t,position:m.clientX-(v.current?.getBoundingClientRect().left??0)})},z=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{v.current?.hasPointerCapture(m.pointerId)&&v.current.releasePointerCapture(m.pointerId)}catch{}h()}};return r("div",{className:`${e.container} ${o&&e.scrubbing?e.scrubbing:""}`,ref:v,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(W(m.clientX))},onPointerDown:x,onPointerMove:q,onPointerUp:z,onPointerCancel:z,onMouseMove:m=>{if(o||!t)return;const w=W(m.clientX);$({time:w*t,position:m.clientX-(v.current?.getBoundingClientRect().left??0)})},onMouseLeave:()=>{o||$({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:s(N.time)}),r("div",{className:e.bar,children:[r("div",{className:e.buffered,ref:g,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 s=()=>n(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 ho=450,Hs=({muted:e,volume:n,volumeIcon:t,buttonClassName:s,sliderClassName:o,onToggleMute:i,onVolumeChange:p,onExpandedChange:_})=>{const c=nt(),[h,l]=C(!1),E=b(null),v=b(!1),L=b(null),f=B(d=>{l(d),_?.(d)},[_]);A(()=>()=>{E.current&&window.clearTimeout(E.current)},[]),A(()=>{if(!h)return;const d=N=>{L.current&&!L.current.contains(N.target)&&f(!1)};return document.addEventListener("pointerdown",d),()=>document.removeEventListener("pointerdown",d)},[h,f]);const g=e?0:n,S=()=>{v.current=!1,E.current&&window.clearTimeout(E.current),E.current=window.setTimeout(()=>{v.current=!0,f(!0)},ho)},u=()=>{E.current&&(window.clearTimeout(E.current),E.current=null)},y=d=>{if(d.stopPropagation(),v.current){v.current=!1;return}if(c){h?i():f(!0);return}i()};return r("div",{ref:L,className:ae.volumeWrap,"data-expanded":h?"true":"false",onContextMenu:d=>d.preventDefault(),children:[r("button",{type:"button",className:s,onClick:y,onPointerDown:S,onPointerUp:u,onPointerLeave:u,onContextMenu:d=>d.preventDefault(),"aria-label":e?"Unmute":"Mute","aria-expanded":h,children:t}),r("input",{type:"range",min:"0",max:"1",step:"0.05",value:g,onChange:d=>p(parseFloat(d.target.value)),onClick:d=>d.stopPropagation(),onPointerDown:d=>d.stopPropagation(),onContextMenu:d=>d.preventDefault(),className:`${ae.volumeSlider} ${o??""}`,style:{"--volume-percent":`${g*100}%`},"aria-label":"Volume"})]})},Qe=280;function vo(e){return e?!!e.closest('button, input, select, textarea, a, [role="button"], [data-player-ui="true"]'):!1}const Vs=({player:e,topBar:n,centerControls:t,bottomBar:s,settingsPanel:o,overlays:i,isInteracting:p=!1,className:_,chromeDisabled:c=!1,children:h})=>{const{state:l,refs:E,actions:v}=e,L=E.playerContainerRef,g=nt()?5e3:3e3,S=b(0),u=b(null),y=b(p);y.current=p;const d=B(()=>{const x=v.inactivityTimer.current;x&&(window.clearTimeout(x),v.inactivityTimer.current=null)},[v]),N=B(()=>{d(),l.isPlaying&&(y.current||l.useNativeControls||(v.inactivityTimer.current=window.setTimeout(()=>{if(y.current)return;v.setShowControls(!1);const x=L.current;x&&l.isFullscreen&&(x.style.cursor="none")},g)))},[v,d,L,g,l.isFullscreen,l.isPlaying,l.useNativeControls]),$=B(()=>{const x=L.current;x&&(x.style.cursor="default"),!l.showControls&&!l.useNativeControls&&v.setShowControls(!0),N()},[v,L,N,l.showControls,l.useNativeControls]);A(()=>{if(l.showControls){if(!l.isPlaying){d();return}if(p||l.isScrubbing||l.showSettings||l.showVolumeSlider){v.setShowControls(!0),d();return}N()}},[v,d,p,N,l.isPlaying,l.isScrubbing,l.showControls,l.showSettings,l.showVolumeSlider]),A(()=>()=>d(),[d]);const W=B(x=>{const q=x.target;if(vo(q))return;const z=Date.now(),m=z-S.current<Qe;if(S.current=z,m){u.current&&(window.clearTimeout(u.current),u.current=null),v.toggleFullscreen();return}u.current&&window.clearTimeout(u.current),u.current=window.setTimeout(()=>{u.current=null,v.setShowControls(!l.showControls),l.showControls?N():$()},Qe)},[v,N,l.showControls,$]);A(()=>()=>{u.current&&window.clearTimeout(u.current)},[]);const G=l.showControls||l.isScrubbing||l.showSettings||l.showVolumeSlider;return r("div",{ref:L,className:`${ae.shell} ${l.isFullscreen?ae.shellFullscreen:""} ${_??""}`,onContextMenu:x=>x.preventDefault(),onPointerMove:x=>{x.pointerType==="mouse"&&$()},onMouseLeave:()=>{window.matchMedia?.("(hover: hover) and (pointer: fine)").matches&&l.isPlaying&&!y.current&&v.setShowControls(!1)},children:[r("div",{className:ae.stage,onClick:W,onContextMenu:x=>x.preventDefault(),children:h}),i,!c&&!l.useNativeControls&&r("div",{className:ae.uiLayer,onContextMenu:x=>x.preventDefault(),children:[r("div",{"data-player-ui":"true",children:n}),G&&t&&r("div",{"data-player-ui":"true",children:t}),r("div",{"data-player-ui":"true",children:s}),o&&r("div",{"data-player-ui":"true",children:o})]})]})},_o="_statusArea_1xccu_1",go="_toggleBtn_1xccu_20",yo="_shortcuts_1xccu_46",bo="_shortcutGroup_1xccu_56",wo="_shortcut_1xccu_46",So="_key_1xccu_70",Co="_label_1xccu_91",P={statusArea:_o,toggleBtn:go,shortcuts:yo,shortcutGroup:bo,shortcut:wo,key:So,label:Co},Ws=({showTheater:e=!0})=>{const[n,t]=C(!1);return r("div",{className:P.statusArea,children:[r("button",{type:"button",className:P.toggleBtn,onClick:()=>t(s=>!s),"aria-expanded":n,"aria-controls":"player-shortcuts",children:[r(Q,{name:"keyboard",size:14}),r("span",{children:"Keyboard Shortcuts"}),n?r(Q,{name:"chevron-up",size:12}):r(Q,{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"})]})]})]})]})},ko="_episodeListContainer_9tyin_1",Eo="_drawerContainer_9tyin_9",Lo="_episodeListHeader_9tyin_14",To="_drawerHeader_9tyin_20",xo="_episodeListTitle_9tyin_29",Bo="_rangeSelector_9tyin_41",No="_rangeButton_9tyin_47",Io="_active_9tyin_70",Po="_episodeList_9tyin_1",Mo="_drawerList_9tyin_89",Ao="_episodeItem_9tyin_118",$o="_watched_9tyin_145",Fo="_episodeThumb_9tyin_167",Ro="_episodeText_9tyin_176",Do="_episodeLabel_9tyin_184",Oo="_episodeSub_9tyin_189",M={episodeListContainer:ko,drawerContainer:Eo,episodeListHeader:Lo,drawerHeader:To,episodeListTitle:xo,rangeSelector:Bo,rangeButton:No,active:Io,episodeList:Po,drawerList:Mo,episodeItem:Ao,watched:$o,episodeThumb:Fo,episodeText:Ro,episodeLabel:Do,episodeSub:Oo},qo=({episodes:e,currentEpisode:n,watchedEpisodes:t=[],onEpisodeClick:s,variant:o="sidebar",title:i="Episodes",header:p})=>{const[_,c]=C(0),h=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=h.current;if(!f)return;let g=f.parentElement;for(;g;){const y=window.getComputedStyle(g);if((y.overflowY==="auto"||y.overflowY==="scroll")&&g.scrollHeight>g.clientHeight)break;g=g.parentElement}if(!g)return;const S=g.getBoundingClientRect(),u=f.getBoundingClientRect();g.scrollTop+=u.top+u.height/2-(S.top+g.clientHeight/2)},[n,_]);const v=pe(()=>{if(l.length<=100)return[];const f=[];for(let g=0;g<l.length;g+=100){const S=g+1,u=Math.min(g+100,l.length);f.push(`${S}-${u}`)}return f},[l]),L=pe(()=>{if(v.length===0)return l;const f=v[_];if(!f)return l;const[g,S]=f.split("-"),u=parseInt(g,10),y=parseInt(S,10);return l.slice(u-1,y)},[l,v,_]);return r("div",{className:`${M.episodeListContainer} ${o==="drawer"?M.drawerContainer:""}`,children:[r("div",{className:`${M.episodeListHeader} ${o==="drawer"?M.drawerHeader:""}`,children:[p,r("h3",{className:M.episodeListTitle,children:i}),v.length>0&&r("div",{className:M.rangeSelector,children:v.map((f,g)=>r("button",{className:`${M.rangeButton} ${_===g?M.active:""}`,onClick:()=>c(g),children:f},f))})]}),r("div",{className:`${M.episodeList} ${o==="drawer"?M.drawerList:""}`,children:L.map(f=>{const g=f.id===n,S=E.has(f.id)||f.watched===!0;return r("div",{ref:g?h:void 0,className:`${M.episodeItem} ${S?M.watched:""} ${g?M.active:""}`,onClick:()=>s(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)})})]})},Us=({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,s)=>r("div",{className:M.episodeItem,style:{border:"none",background:"transparent"},children:r(ye,{width:"120px",height:"1.2rem",variant:"text"})},s))})]}),Ho="_shell_cys6s_1",Vo="_overlay_cys6s_10",Wo="_drawer_cys6s_21",Uo="_handle_cys6s_56",zo="_header_cys6s_64",Ko="_headerCopy_cys6s_73",Go="_kicker_cys6s_79",Xo="_title_cys6s_87",Jo="_closeBtn_cys6s_94",Qo="_body_cys6s_116",J={shell:Ho,overlay:Vo,drawer:Wo,handle:Uo,header:zo,headerCopy:Ko,kicker:Go,title:Xo,closeBtn:Jo,body:Qo};function zs({isOpen:e,onClose:n,episodes:t,currentEpisode:s,watchedEpisodes:o=[],onEpisodeClick:i,title:p,header:_}){return A(()=>{if(!e)return;const c=l=>{l.key==="Escape"&&n()},h=document.body.style.overflow;return document.body.style.overflow="hidden",document.addEventListener("keydown",c),()=>{document.body.style.overflow=h,document.removeEventListener("keydown",c)}},[e,n]),e?At(r("div",{className:J.shell,role:"dialog","aria-modal":"true","aria-label":"Episode picker",children:[r("button",{className:J.overlay,type:"button",onClick:n,"aria-label":"Close episodes"}),r("aside",{className:J.drawer,children:[r("div",{className:J.handle}),r("div",{className:J.header,children:[r("div",{className:J.headerCopy,children:[r("span",{className:J.kicker,children:"Episode picker"}),r("h3",{className:J.title,children:"Choose an episode"})]}),r("button",{className:J.closeBtn,type:"button",onClick:n,"aria-label":"Close",children:r(Q,{name:"times"})})]}),r("div",{className:J.body,children:r(qo,{episodes:t,currentEpisode:s,watchedEpisodes:o,onEpisodeClick:i,variant:"drawer",title:p,header:_})})]})]}),document.body):null}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 ce(e){return rt(e)!==null}async function jo(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 s=n;if(s&&typeof s.webkitEnterFullscreen=="function"){if(s.webkitSupportsFullscreen===!1)return;try{await s.webkitEnterFullscreen()}catch{}}}async function Yo(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 Zo(e,n){!e&&!n||(ce(n)?await Yo(n):e&&await jo(e,n))}function es(e,n){const t=()=>{try{n(ce(e()))}catch{}},s=Pe(),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 Ks=({skipIntervals:e,showId:n,episodeNumber:t,episodeCount:s,sourceType:o,showMeta:i})=>{const p=qt(),_=Ft(),c=b(null),h=b(null),l=b(null),E=b(null),v=b(!1),L=b(null),f=b(0),g=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)),[$,W]=C(!1),[G,x]=C(()=>{try{return localStorage.getItem("playerMuted")==="true"}catch{return!1}}),[q,z]=C(()=>{try{const a=parseFloat(localStorage.getItem("playerVolume")||"");return isNaN(a)?1:Math.max(0,Math.min(1,a))}catch{return 1}}),[m,w]=C(!1),[R,U]=C(0),[j,D]=C(!0),[ee,Me]=C(!1),[ot,Ae]=C({time:0,position:null}),[we,st]=C(localStorage.getItem("autoSkipEnabled")==="true"),[at,Se]=C(null),[ct,it]=C(!1),[te]=C(io),[lt,ut]=C(te.fontSize),[dt,pt]=C(te.position),[ft,mt]=C(te.bgOpacity),[ht,vt]=C(te.bgColor),[_t,gt]=C(te.textColor),[yt,bt]=C(te.edge),[wt,St]=C(te.bold),[Ct,kt]=C([]),[Et,Lt]=C(null),[Tt,xt]=C(!1),[Bt,Nt]=C(!1),[fe,X]=C(!1),[It,me]=C(!1),[Pt,$e]=C(()=>{try{return localStorage.getItem("playerUseNativeControls")==="true"}catch{return!1}}),ie=b(!1),Ce=b(-1),he=B(()=>{const a=c.current;return!n||!t||!i?.name?null:{showId:n,episodeNumber:t,episodeCount:s,currentTime:a?a.currentTime:0,duration:a?a.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:a?!a.paused:!0,sessionId:N.current,isAdult:i.isAdult}},[n,t,s,i]),O=B((a=!1,T=!1)=>{if(ie.current)return!1;const I=he();if(!I)return!1;const k=c.current;if(!k&&o!=="iframe")return!1;const F=k?k.currentTime>=k.duration*.8:!1;let H=k?k.currentTime:0;if(a&&F&&(H=k?k.duration:0),!T){if(H===0&&!F)return!1;const K=k?Math.abs(H-Ce.current):0;if(!a&&k&&H!==k.duration&&K<5)return!1}return I.currentTime=H,Ce.current=H,a?(async()=>{try{await Je.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},[he,o,p,n,t,_.continueWatching]);A(()=>{const a=c.current;a&&(a.volume=q,a.muted=G)},[c,q,G]),A(()=>{const a=()=>{ie.current||O(!0)};window.addEventListener("beforeunload",a);const T=L,I=E;return()=>{window.removeEventListener("beforeunload",a),ie.current||O(!0),T.current&&clearTimeout(T.current),I.current&&clearTimeout(I.current)}},[O]);const ve=B(()=>{const a=h.current;a&&Zo(a,c.current).catch(T=>{console.error(`Error attempting to toggle full-screen mode: ${T?.message} (${T?.name})`)})},[]),_e=B(()=>{c.current&&(c.current.paused?c.current.play().catch(()=>console.warn("Autoplay was prevented.")):(c.current.pause(),D(!0)))},[D]),oe=B(()=>{const a=c.current;if(!a)return;const T=S.current.mouse||S.current.keyboard;a.playbackRate=T?2:g.current},[]),le=B(a=>{S.current.mouse!==a&&(S.current.mouse=a,me(a||S.current.keyboard),oe())},[oe]),se=B(a=>{S.current.keyboard!==a&&(S.current.keyboard=a,me(S.current.mouse||a),oe())},[oe]),ue=B(a=>{c.current&&(c.current.currentTime+=a,L.current&&clearTimeout(L.current),L.current=setTimeout(()=>{O(!1,!0)},1500),D(!0))},[O,D]),ge=B(()=>{if(!c.current)return;const a=!c.current.muted;c.current.muted=a,x(a),localStorage.setItem("playerMuted",String(a)),!a&&c.current.volume===0&&(c.current.volume=.5,z(.5),localStorage.setItem("playerVolume",String(.5))),D(!0)},[D]);A(()=>{const a=()=>c.current,T=es(a,I=>{w(I),I&&D(!0)});return w(ce(a())),T},[D]),A(()=>{const a=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&&se(!0)},180);return}switch(I.key.toLowerCase()){case"f":ve();break;case"m":ge();break;case"arrowright":ue(10);break;case"arrowleft":ue(-10);break;case"arrowup":if(I.preventDefault(),c.current){const F=Math.min(1,c.current.volume+.1);c.current.volume=F,z(F)}break;case"arrowdown":if(I.preventDefault(),c.current){const F=Math.max(0,c.current.volume-.1);c.current.volume=F,z(F)}break}}},T=I=>{if(I.code==="Space"){if(I.preventDefault(),d.current=!1,S.current.keyboard){se(!1);return}y.current&&(clearTimeout(y.current),y.current=null,_e())}};return document.addEventListener("keydown",a),document.addEventListener("keyup",T),()=>{document.removeEventListener("keydown",a),document.removeEventListener("keyup",T),y.current&&(clearTimeout(y.current),y.current=null),d.current=!1,se(!1),me(!1)}},[se,_e,ve,ge,ue]),A(()=>{const a=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||a(Y))return;const K=h.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||a(Y))return;const K=h.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),se(!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)}},[se,le]);const Fe=B(()=>{W(!0),X(!1),setTimeout(()=>O(!1,!0),50)},[O]),Re=B(()=>{W(!0),X(!1)},[]),De=B(()=>{const a=c.current;a&&!a.paused&&a.readyState>=3&&!a.seeking||X(!0)},[]),Oe=B(()=>{X(!1)},[]),qe=B(()=>{W(!1),X(!1),D(!0),setTimeout(()=>O(!1,!0),50)},[O]),He=b(!1);He.current=fe,A(()=>{if(!fe)return;let a=c.current?.currentTime??0,T=0;const I=window.setInterval(()=>{const k=c.current;if(!k)return;T+=1;const F=k.currentTime,H=F!==a;if(a=F,!(k.paused||k.seeking)){if(H||k.readyState>=3){X(!1);return}T>=24&&k.readyState>=2&&!k.ended&&X(!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),U(0),X(!1)},[n,t]);const Ve=B(()=>{U(0),X(!1)},[]);A(()=>{const a=N.current;return()=>{Dt(a)}},[n,t]),A(()=>{if(o!=="iframe")return;O(!1,!0);const a=setInterval(()=>{O(!1,!0)},6e4);return()=>clearInterval(a)},[o,O]);const We=B(()=>{U(c.current?.duration||0),oe()},[oe]),Ue=B(()=>{if(c.current){const a=c.current.muted,T=c.current.volume;x(a),z(T),localStorage.setItem("playerMuted",String(a)),localStorage.setItem("playerVolume",String(T))}},[]),ze=B(()=>{},[]),Ke=B(()=>{const a=c.current;if(!a)return;He.current&&!a.paused&&!a.seeking&&X(!1);const T=a.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&&!a.paused&&(a.currentTime=k.end_time,Se(null))},[e,we,O]),Ge=B(()=>{const a=he();a&&(a.currentTime=a.duration,Je.progress.updateProgress.mutate(a).then(()=>{p.invalidateQueries({queryKey:["video-sources",n,t]}),p.invalidateQueries({queryKey:["allContinueWatching"]})}).catch(T=>console.error("Failed to send final progress:",T)))},[he,p,n,t]),Xe=B(()=>{ie.current=!0,Ge()},[Ge]);A(()=>{const a=()=>{ee&&(Me(!1),Ae({time:0,position:null}),v.current&&c.current?.play(),O(!1,!0))};return ee&&(document.addEventListener("mouseup",a),document.addEventListener("pointerup",a),document.addEventListener("touchend",a),document.addEventListener("pointercancel",a),document.addEventListener("touchcancel",a)),()=>{document.removeEventListener("mouseup",a),document.removeEventListener("pointerup",a),document.removeEventListener("touchend",a),document.removeEventListener("pointercancel",a),document.removeEventListener("touchcancel",a)}},[ee,O]);const Mt=pe(()=>({togglePlay:_e,seek:ue,toggleMute:ge,toggleFullscreen:ve,onPlay:Fe,onPause:qe,onLoadedMetadata:We,formatTime:Ot,onVolumeChange:Ue,onProgress:ze,onTimeUpdate:Ke,onEnded:Xe,setShowControls:D,setIsScrubbing:Me,setHoverTime:Ae,setIsAutoSkipEnabled:st,setCurrentSkipInterval:Se,setShowCCMenu:it,setSubtitleFontSize:ut,setSubtitlePosition:pt,setSubtitleBgOpacity:mt,setSubtitleBgColor:vt,setSubtitleTextColor:gt,setSubtitleEdge:bt,setSubtitleBold:St,setAvailableSubtitles:kt,setActiveSubtitleTrack:Lt,setShowSettings:xt,setShowVolumeSlider:Nt,wasPlayingBeforeScrub:v,inactivityTimer:E,setIsFullscreen:w,onWaiting:De,onPlaying:Re,onCanPlay:Oe,sendProgressUpdate:O,setUseNativeControls:$e,resetMediaState:Ve}),[_e,ue,ge,ve,Fe,qe,We,Ue,ze,Ke,Xe,w,De,Re,Oe,O,$e,Ve]);return{refs:{videoRef:c,playerContainerRef:h,progressBarRef:l},state:{isPlaying:$,isMuted:G,volume:q,isFullscreen:m,duration:R,showControls:j,isScrubbing:ee,hoverTime:ot,isAutoSkipEnabled:we,currentSkipInterval:at,showCCMenu:ct,subtitleFontSize:lt,subtitlePosition:dt,subtitleBgOpacity:ft,subtitleBgColor:ht,subtitleTextColor:_t,subtitleEdge:yt,subtitleBold:wt,availableSubtitles:Ct,activeSubtitleTrack:Et,showSettings:Tt,showVolumeSlider:Bt,isBuffering:fe,isSpeedBoostActive:It,useNativeControls:Pt},actions:Mt}};function ts(){try{return typeof navigator<"u"&&/android/i.test(navigator.userAgent)}catch{return!1}}function Gs(e,n){const{refs:t,actions:s}=e,o=b(n);o.current=n;const i=b(!1),p=b(!1),_=c=>{try{if(c)return c.matches}catch{}try{return window.innerWidth>window.innerHeight}catch{return!1}};A(()=>{if(!ts())return;let c=null;const h=()=>{const l=t.playerContainerRef.current;if(_(c)){if(!o.current||!l||ce(t.videoRef.current)||p.current)return;i.current=!0,s.toggleFullscreen()}else p.current=!1,i.current&&(i.current=!1,ce(t.videoRef.current)&&s.toggleFullscreen())};try{c=window.matchMedia("(orientation: landscape)"),c.addEventListener?c.addEventListener("change",h):c.addListener(h)}catch{}return h(),()=>{try{c&&(c.removeEventListener?c.removeEventListener("change",h):c.removeListener(h))}catch{}}},[s,t.playerContainerRef,t.videoRef,n]),A(()=>{const c=()=>{if(!ce(t.videoRef.current)){i.current=!1;try{window.matchMedia("(orientation: landscape)").matches&&(p.current=!0)}catch{p.current=!0}}};return document.addEventListener("fullscreenchange",c),document.addEventListener("webkitfullscreenchange",c),()=>{document.removeEventListener("fullscreenchange",c),document.removeEventListener("webkitfullscreenchange",c)}},[t.videoRef])}const ns=e=>Math.max(8,Math.min(40,Math.ceil(e/16.7)+4));function Xs({videoRef:e,canvasRef:n,delayMs:t,enabled:s}){const o=b(t);o.current=t;const i=b([]),p=b(-1),_=b(-1),c=b(!1),h=b(0),l=b(null);A(()=>{const E=u=>{if(u)try{u.close()}catch{}},v=()=>{for(const u of i.current)E(u.bitmap);i.current=[]};if(!s){v(),p.current=-1,_.current=-1,c.current=!1,h.current=0;return}let L=!1;const f=()=>{l.current!==null&&(cancelAnimationFrame(l.current),l.current=null)},g=()=>{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){g();return}if(u.paused||u.ended||document.hidden||u.readyState<HTMLMediaElement.HAVE_CURRENT_DATA){g();return}const d=u.getVideoPlaybackQuality().totalVideoFrames;if(d===p.current){g();return}(u.seeking||_.current>=0&&Math.abs(u.currentTime-_.current)>.5)&&(v(),c.current=!1,h.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,o.current||0);N>h.current&&(c.current=!1);try{const $=await createImageBitmap(u);if(L){E($);return}p.current=d;const W=performance.now(),G=y.getContext("2d"),x=w=>{G&&G.drawImage(w,0,0,y.width,y.height)};if(N<=0){v(),c.current=!1,h.current=0,x($),E($),g();return}const q=i.current;q.push({bitmap:$,capture:W});const z=ns(N);for(;q.length>z;)E(q.shift()?.bitmap);let m=-1;for(let w=q.length-1;w>=0;w--)if(W-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?(x(w.bitmap),E(w.bitmap),c.current=!0,h.current=N):x($)}else if(!c.current)x($);else{const w=q.shift();w?(x(w.bitmap),E(w.bitmap)):x($)}}catch{}g()}return g(),()=>{L=!0,f();for(const u of i.current)try{u.bitmap.close()}catch{}i.current=[]}},[s,e,n])}const je=(e,n)=>{try{localStorage.setItem("playerVideoDelayMs",String(e)),localStorage.setItem("playerVideoDelayEnabled",String(n))}catch{}},Ye=e=>{try{localStorage.setItem("playerVideoDelayEnabled",String(e))}catch{}};function Js(e,n){const[t,s]=C(()=>{try{const d=Number(localStorage.getItem("playerVideoDelayMs"));if(Number.isFinite(d)&&d>=0&&d<=500)return Math.round(d)}catch{}return 180}),[o,i]=C(()=>{try{return localStorage.getItem("playerVideoDelayEnabled")==="true"}catch{return!1}}),[p,_]=C(!1),[c,h]=C(!1),l=b(null),E=b(null),v=d=>{const N=Math.max(0,Math.min(500,Math.round(d)));s(N);try{localStorage.setItem("playerVideoDelayMs",String(N))}catch{}},L=d=>{i(d),Ye(d)},f=B(()=>{h(!1),_(!1)},[]);return{videoDelayMs:t,videoDelayEnabled:o,setDelayEnabled:L,handleVideoDelayChange:v,isCalibrating:p,testClipActive:c,stopCalibration:f,openAvSyncCalibrator:()=>{l.current={enabled:o,ms:t},i(!0),Ye(!0),n?.(),_(!0)},cancelAvSyncCalibrator:()=>{const d=l.current;l.current=null,d&&(s(d.ms),i(d.enabled),je(d.ms,d.enabled)),h(!1),_(!1)},applyAvSyncCalibrator:()=>{l.current=null,i(!0),je(t,!0),h(!1),_(!1)},toggleTestClip:()=>{if(c){h(!1);return}const d=e.current;d&&!isNaN(d.currentTime)&&(E.current=d.currentTime),h(!0)},calibReturnRef:E,effectiveVideoDelayMs:o?t:0}}function Qs(){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(o){console.error(o)}return()=>{try{document.body.classList.remove("theater-mode")}catch(o){console.error(o)}}},[e]);const t=B(()=>{n(o=>{const i=!o;try{localStorage.setItem("playerTheaterMode",i.toString())}catch{}return i})},[]),s=B(o=>{if(e&&o.target===o.currentTarget){n(!1);try{localStorage.setItem("playerTheaterMode","false")}catch{}}},[e]);return{isTheaterMode:e,toggleTheaterMode:t,handleLayoutClick:s}}const ne={enabled:!0,blur:60,saturation:150,brightness:70,opacity:60};function rs(){try{const e=localStorage.getItem("playerAmbientLight");if(!e)return ne;const n=JSON.parse(e),t=(s,o,i,p)=>{const _=Number(s);return Number.isFinite(_)?Math.max(i,Math.min(p,_)):o};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 js(){const[e,n]=C(rs),t=B(s=>{n(o=>{const i={...o,...s};try{localStorage.setItem("playerAmbientLight",JSON.stringify(i))}catch{}return i})},[]);return{settings:e,update:t}}const Le=160,Te=90,os=120,Ys=({videoRef:e,active:n,settings:t,className:s})=>{const o=b(null);return A(()=>{if(!n)return;const i=o.current,p=e.current;if(!i||!p)return;const _=i.getContext("2d",{alpha:!1});if(!_)return;let c=0,h=0,l=!1;const E=()=>{if(!(p.readyState<2||!p.videoWidth))try{const f=p.videoWidth,g=p.videoHeight,S=Le/Te,u=f/g;let y=f,d=g,N=0,$=0;u>S?(y=g*S,N=(f-y)/2):(d=f/S,$=(g-d)/2),_.drawImage(p,N,$,y,d,0,0,Le,Te)}catch{}},v=f=>{l||p.paused||(c=requestAnimationFrame(v),!(f-h<os)&&(h=f,E()))},L=()=>{l||(cancelAnimationFrame(c),h=0,c=requestAnimationFrame(v))};return p.addEventListener("play",L),p.addEventListener("seeked",E),p.addEventListener("loadeddata",E),c=requestAnimationFrame(v),()=>{l=!0,cancelAnimationFrame(c),p.removeEventListener("play",L),p.removeEventListener("seeked",E),p.removeEventListener("loadeddata",E)}},[n,e]),n?r("canvas",{ref:o,width:Le,height:Te,"aria-hidden":"true",className:s??Kr.theaterAmbient,style:{filter:`blur(${t.blur}px) saturate(${t.saturation}%) brightness(${t.brightness}%)`,opacity:t.opacity/100}}):null},ss="_row_1fq55_1",as="_rowHeader_1fq55_9",cs="_rowLabel_1fq55_17",is="_rowValue_1fq55_28",ls="_slider_1fq55_36",us="_swatches_1fq55_99",ds="_swatch_1fq55_99",ps="_swatchPicked_1fq55_114",fs="_colorInput_1fq55_120",ms="_segmented_1fq55_131",V={row:ss,rowHeader:as,rowLabel:cs,rowValue:is,slider:ls,swatches:us,swatch:ds,swatchPicked:ps,colorInput:fs,segmented:ms},hs=({label:e,display:n,min:t,max:s,step:o,value:i,percent:p,onChange:_,onCommit:c})=>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:s,step:o,value:i,"aria-label":e,"data-speed-boost-ignore":"true",onInput:h=>_(Number(h.target.value)),onMouseDown:h=>h.stopPropagation(),onPointerDown:h=>h.stopPropagation(),onTouchStart:h=>h.stopPropagation(),onPointerUp:c,onPointerCancel:c,onTouchEnd:c,onKeyUp:c,onBlur:c,style:{"--slider-percent":`${p}%`}})]}),Zs=({label:e,colors:n,value:t,onChange:s})=>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(o=>r("button",{type:"button","aria-label":`${e} ${o}`,"aria-pressed":t.toLowerCase()===o.toLowerCase(),onClick:()=>s(o),className:`${V.swatch} ${t.toLowerCase()===o.toLowerCase()?V.swatchPicked:""}`,style:{backgroundColor:o}},o)),r("input",{type:"color","aria-label":`Custom ${e.toLowerCase()}`,className:V.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 ea({label:e,options:n,value:t,onChange:s}){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(o=>r("button",{type:"button","aria-pressed":t===o,onClick:()=>s(o),children:[r("span",{children:o}),t===o&&r(Q,{name:"check",size:10})]},o))})]})}const be=10,Ie=500,xe=e=>Math.max(0,Math.min(Ie,Math.round(e))),ta=({isOpen:e,ms:n,onChange:t,onApply:s,onClose:o,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(xe(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(xe(n+be)),"aria-label":"Increase delay by 10 milliseconds",children:["+ ",be,"ms"]})]}),r(hs,{label:"Video delay",display:`${n}ms`,min:0,max:Ie,step:5,value:n,percent:n/Ie*100,onChange:_=>t(xe(_))}),r("div",{style:{display:"flex",gap:8,justifyContent:"center",flexWrap:"wrap"},children:[r(re,{size:"sm",variant:"secondary",onClick:o,children:"Cancel"}),r(re,{size:"sm",onClick:s,children:["Apply ",n,"ms"]})]})]}):null;export{Ys as A,$s as B,Ds as C,Ls as D,Us as E,ws as F,Ss as G,Zs as H,Ms as I,ea as J,Z as K,ne as L,hs as M,Ws as P,Rs as R,qs as S,Ps as T,Hs as U,Vs as a,Os as b,Js as c,Xs as d,Qs as e,Es as f,Gs as g,js as h,no as i,xs as j,As as k,Cs as l,Bs as m,Fs as n,Is as o,Ts as p,Kr as q,Ns as r,ao as s,qo as t,Ks as u,bs as v,ae as w,ta as x,zs as y,ks as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as e,S as s,d as y,h as g}from"./vendor-core-DfaOB3Rn.js";import{I as p}from"./vendor-icons-DrybRNxP.js";import{M as l,H as m,T as S,I as f,J as k,K as x,L as N}from"./AvSyncCalibrator-Cr9n1euF.js";const C=({classes:o,title:t,titleTag:i="span",showBack:a=!0,onBack:n,panelRef:b,onPanelClick:r,children:c})=>{const d=i;return e("div",{ref:b,className:o.panel,onClick:r,"data-speed-boost-ignore":"true",children:[e("div",{className:o.header,children:[a&&e("button",{className:o.backBtn,onClick:n,children:e(p,{name:"chevron-left"})}),e(d,{className:o.title||void 0,children:t})]}),e("div",{className:o.content,children:c})]})},$=({classes:o,values:t,onChange:i})=>{const a=()=>{const n=x;i("fontSize",n.fontSize),i("position",n.position),i("bgOpacity",n.bgOpacity),i("bgColor",n.bgColor),i("textColor",n.textColor),i("edge",n.edge),i("bold",n.bold)};return e(s,{children:[e(l,{label:"Font Size",display:t.fontSize.toFixed(1),min:.5,max:10,step:.5,value:t.fontSize,percent:(t.fontSize-.5)/9.5*100,onChange:n=>{Number.isFinite(n)&&i("fontSize",n)}}),e(l,{label:"Vertical Position",display:`${t.position}`,min:0,max:100,step:1,value:t.position,percent:t.position,onChange:n=>{Number.isFinite(n)&&i("position",Math.round(n))}}),e(l,{label:"Background Opacity",display:`${Math.round(t.bgOpacity*100)}%`,min:0,max:1,step:.05,value:t.bgOpacity,percent:t.bgOpacity*100,onChange:n=>{Number.isFinite(n)&&i("bgOpacity",n)}}),e(m,{label:"Text Color",colors:S,value:t.textColor,onChange:n=>i("textColor",n)}),e(m,{label:"Background Color",colors:f,value:t.bgColor,onChange:n=>i("bgColor",n)}),e(k,{label:"Text Edge",options:["shadow","outline","none"],value:t.edge,onChange:n=>i("edge",n)}),e("button",{type:"button",className:`${o.item} ${t.bold?o.active:""}`,onClick:()=>i("bold",!t.bold),children:[e("span",{children:"Bold Text"}),t.bold&&e(p,{name:"check",size:12})]}),e("button",{type:"button",className:o.item,onClick:a,children:e("span",{children:"Reset to Defaults"})})]})},z=({classes:o,enabled:t,delayMs:i,onToggle:a,onDelayChange:n,onCalibrate:b})=>{const[r,c]=y(null),d=r??i;g(()=>{c(null)},[i]);const h=()=>{r!==null&&(n(r),c(null))};return e(s,{children:[e("button",{type:"button",className:`${o.item} ${t?o.active:""}`,onClick:()=>a(!t),children:[e("span",{children:"Video delay"}),t&&e(p,{name:"check",size:12})]}),e(l,{label:"Video delay",display:`${d}ms`,min:0,max:500,step:5,value:d,percent:d/500*100,onChange:u=>c(Math.round(u)),onCommit:h}),e("div",{className:o.note,children:"For Bluetooth headsets where audio arrives late. Video is held back via canvas; audio plays untouched."}),b&&e("button",{type:"button",className:o.item,onClick:b,children:e("span",{children:"Calibrate…"})})]})},E=({classes:o,values:t,onChange:i})=>e(s,{children:[e("button",{type:"button",className:`${o.item} ${t.enabled?o.active:""}`,onClick:()=>i({enabled:!t.enabled}),"aria-pressed":t.enabled,children:[e("span",{children:"Ambient light"}),e("span",{style:{display:"flex",alignItems:"center",gap:6},children:[t.enabled?"On":"Off",t.enabled&&e(p,{name:"check",size:12})]})]}),e(l,{label:"Blur",display:`${t.blur}px`,min:0,max:120,step:2,value:t.blur,percent:t.blur/120*100,onChange:a=>i({blur:Math.round(a)})}),e(l,{label:"Saturation",display:`${t.saturation}%`,min:0,max:200,step:5,value:t.saturation,percent:t.saturation/200*100,onChange:a=>i({saturation:Math.round(a)})}),e(l,{label:"Brightness",display:`${t.brightness}%`,min:20,max:120,step:5,value:t.brightness,percent:(t.brightness-20)/100*100,onChange:a=>i({brightness:Math.round(a)})}),e(l,{label:"Opacity",display:`${t.opacity}%`,min:10,max:100,step:5,value:t.opacity,percent:(t.opacity-10)/90*100,onChange:a=>i({opacity:Math.round(a)})}),e("div",{className:o.note,children:"Mirrors the video onto the backdrop behind the player. Turn off for pure black."}),e("button",{type:"button",className:o.item,onClick:()=>i({...N}),children:e("span",{children:"Reset to defaults"})})]}),B=({classes:o,options:t,onSelect:i})=>e(s,{children:t.map(a=>e("button",{type:"button",className:`${o.item} ${a.selected?o.active:""}`,onClick:()=>i(a.key),children:[e("span",{children:a.label}),a.selected&&e(p,{name:"check",size:12})]},a.key))});export{z as A,B as O,C as S,$ as a,E as b};
|