@serifpersia/dango 3.3.4 → 3.3.5
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-CXx2EIN7.js +1 -0
- package/client/dist/assets/{AnimeInfo-0huPAq0O.js → AnimeInfo-C6ehrfYW.js} +1 -1
- package/client/dist/assets/{AnimeInfoPage-Dqr5QH6R.js → AnimeInfoPage-pgnMg0On.js} +2 -2
- package/client/dist/assets/{Asmr-B6ZiqkmU.js → Asmr-DfA8xB-U.js} +1 -1
- package/client/dist/assets/{AsmrResetProgressModal-Cqsoo3XC.js → AsmrResetProgressModal-QUNnEh9C.js} +1 -1
- package/client/dist/assets/AvSyncCalibrator-Bs4iejCG.js +10 -0
- package/client/dist/assets/Home-Csx6zT32.js +1 -0
- package/client/dist/assets/{Insights-ZlgPrzGD.js → Insights-MW8oRqeX.js} +1 -1
- package/client/dist/assets/{LibraryListPage-CCiee-Ot.js → LibraryListPage-VYaHXgXt.js} +1 -1
- package/client/dist/assets/{ListeningList-ctAz_6Zi.js → ListeningList-BzbQwmh0.js} +1 -1
- package/client/dist/assets/{Manga-BI9WMTx5.js → Manga-223panCD.js} +1 -1
- package/client/dist/assets/{MangaInfoPage-DcrEr7Sk.js → MangaInfoPage-DBqX-Ord.js} +1 -1
- package/client/dist/assets/{MangaReadPage-SYg63m48.js → MangaReadPage-DuXdVyTd.js} +1 -1
- package/client/dist/assets/{MangaResetProgressModal-DX-1PS4h.js → MangaResetProgressModal-6C3iaR6g.js} +1 -1
- package/client/dist/assets/{Mature-Dqh_9SA3.js → Mature-3VlywJMR.js} +1 -1
- package/client/dist/assets/{MediaCard-Be1ST9oj.js → MediaCard-xfJv6irD.js} +1 -1
- package/client/dist/assets/{Music-zsPwT8_5.js → Music-DkIeCRq1.js} +1 -1
- package/client/dist/assets/{OptionListMenu-Drc_vybW.js → OptionListMenu-JQ_--ggT.js} +1 -1
- package/client/dist/assets/Player-Czg_D7FN.js +56 -0
- package/client/dist/assets/{PlayerSettings-Cwoji-P7.js → PlayerSettings-KrFECely.js} +1 -1
- package/client/dist/assets/{QueueOptionsButton-B6BMq66e.js → QueueOptionsButton-BKNDfpCl.js} +1 -1
- package/client/dist/assets/{QueueRail-VxpUDBSm.js → QueueRail-Cgljhm64.js} +1 -1
- package/client/dist/assets/{Radio-B2Q_Egj7.js → Radio-wbxhaiqy.js} +1 -1
- package/client/dist/assets/{ReadingList-O0QPwXu7.js → ReadingList-DNJAx_LW.js} +1 -1
- package/client/dist/assets/{ResetProgressModal-CR_ovLAu.js → ResetProgressModal-By-iSYwL.js} +1 -1
- package/client/dist/assets/{Search-C8e2nlDD.js → Search-63TcSgOa.js} +1 -1
- package/client/dist/assets/{Settings-BgPWBl2V.js → Settings-BeS0llCE.js} +1 -1
- package/client/dist/assets/{SkeletonGrid-CtHKKMLj.js → SkeletonGrid-CnE_aoEU.js} +1 -1
- package/client/dist/assets/{Trackers-Bfoiyuzy.js → Trackers-ACFHfLXZ.js} +1 -1
- package/client/dist/assets/Tv-BCmNLUsp.js +4 -0
- package/client/dist/assets/{TvInfo-D_scgw_h.js → TvInfo-fFNHV1RJ.js} +1 -1
- package/client/dist/assets/{TvPopup-YTI7dEbJ.js → TvPopup-DYKTHRrD.js} +1 -1
- package/client/dist/assets/{TvSearch-CxU33UOf.js → TvSearch-CpenLEBz.js} +1 -1
- package/client/dist/assets/TvWatchlist-CTUZAvfa.js +1 -0
- package/client/dist/assets/{Watchlist-P6YMZUdF.js → Watchlist-B10pIG1F.js} +1 -1
- package/client/dist/assets/{hls-C4cG9wQw.js → hls-Cbou9Eb-.js} +1 -1
- package/client/dist/assets/index-CfvzoNYQ.js +178 -0
- package/client/dist/assets/{useAnimeInfoData-DeuwDSnI.js → useAnimeInfoData-D-vEehTG.js} +1 -1
- package/client/dist/assets/{useAsmr-CbMVRjmV.js → useAsmr-B-3EYd-B.js} +1 -1
- package/client/dist/assets/{useAsmrPopup-D91Q3CBg.js → useAsmrPopup-D9BxuTDg.js} +1 -1
- package/client/dist/assets/{useMangaLibrary-BPvFb1lU.js → useMangaLibrary-DtRKgk2x.js} +1 -1
- package/client/dist/assets/{useMangaPopup-BOL2mQJs.js → useMangaPopup-BNWJ5pR2.js} +1 -1
- package/client/dist/assets/{useProviders-BsRGONMA.js → useProviders-jxh6fvMH.js} +1 -1
- package/client/dist/assets/{useTv-D37MfTHA.js → useTv-CP4mofvR.js} +1 -1
- package/client/dist/assets/{useTvLibrary-Cwxgy_Bg.js → useTvLibrary-DeGkJuvp.js} +1 -1
- package/client/dist/index.html +1 -1
- package/package.json +2 -2
- package/server/dist/controllers/tv-library.controller.js +9 -5
- package/server/dist/repositories/tv.repository.js +10 -8
- package/server/dist/sync.js +19 -1
- package/server/package.json +1 -1
- package/client/dist/assets/AnimeCard-B5A20jAI.js +0 -1
- package/client/dist/assets/AvSyncCalibrator-C8ZoIwMY.js +0 -10
- package/client/dist/assets/Home-thJhPfs1.js +0 -1
- package/client/dist/assets/Player-BEtAYps2.js +0 -56
- package/client/dist/assets/Tv-Ca0fCdko.js +0 -3
- package/client/dist/assets/TvWatchlist-B4X1fWEH.js +0 -1
- package/client/dist/assets/index-IZgh1beL.js +0 -178
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as e,S as T,L as N,d as P,A as y,q as o}from"./vendor-core-8R2fFbyN.js";import{I as c}from"./vendor-icons-CDMuNDeL.js";import{g as I,r as A}from"./useMangaLibrary-
|
|
1
|
+
import{u as e,S as T,L as N,d as P,A as y,q as o}from"./vendor-core-8R2fFbyN.js";import{I as c}from"./vendor-icons-CDMuNDeL.js";import{g as I,r as A}from"./useMangaLibrary-DtRKgk2x.js";import{d as L}from"./index-CfvzoNYQ.js";import{p as s,a as M}from"./MediaCard-xfJv6irD.js";const S=({data:l,anchorRect:t,bookmarked:a,onToggleBookmark:i,onMouseEnter:d,onMouseLeave:m,onRequestClose:p})=>{const{data:n,isLoading:h}=I(l.provider,l.mangaId,l.rating||"safe",l.mature||!1),{titlePreference:f}=L(),u=n?.chapters.length??0,v=[n?.status,n?.type].filter(Boolean).join(" · "),g=A({title:l.title,altTitle:n?.altTitle??l.altTitle},f);return e(M,{anchorRect:t,onMouseEnter:d,onMouseLeave:m,onRequestClose:p,children:h?e("div",{className:s.loading,children:[e("div",{className:s.spinner}),e("span",{children:"Fetching details..."})]}):e(T,{children:[e("div",{className:s.header,children:[e("div",{className:s.title,children:g}),n?.altTitle&&n.altTitle!==g&&e("div",{className:s.synopsis,children:["Also known as: ",n.altTitle]})]}),e("div",{className:s.body,children:[e("div",{className:s.metaRow,children:[v&&e("div",{className:s.metaItem,children:[e(c,{name:"book",size:14}),e("span",{children:v})]}),u>0&&e("div",{className:s.metaItem,children:e("span",{children:[u," chapter",u===1?"":"s"]})}),l.progressLabel&&e("div",{className:s.metaItem,children:[e(c,{name:"bookmark",size:12}),e("span",{children:l.progressLabel})]})]}),e("div",{className:s.synopsis,children:n?.description?n.description:"No synopsis available."}),Array.isArray(n?.genres)&&(n?.genres?.length??0)>0&&e("div",{className:s.details,children:e("div",{className:s.genres,children:n.genres.filter(Boolean).slice(0,4).map(r=>e("span",{className:s.genre,children:r},r))})})]}),e("div",{className:s.footer,children:[e("div",{className:s.primaryAction,children:e(N,{to:l.readTarget,className:s.watchBtn,children:[e(c,{name:"book",size:14}),"Read now"]})}),e("div",{className:s.secondaryActions,children:[e("button",{className:`${s.watchlistBtn} ${a?s.active:""}`,onClick:r=>{r.preventDefault(),r.stopPropagation(),i()},children:[a?e(c,{name:"check",size:12}):e(c,{name:"plus",size:12}),e("span",{children:a?"Remove":"Bookmark"})]}),e(N,{to:`/manga/${l.provider}/${encodeURIComponent(l.mangaId)}`,className:s.detailsBtn,children:"Read more"})]})]})]})})},b=300;function $(){const[l,t]=P(null),a=y(null),i=o(()=>{a.current&&(clearTimeout(a.current),a.current=null)},[]),d=o((n,h)=>{i(),t({data:h,rect:n})},[i]),m=o(()=>{i(),a.current=setTimeout(()=>{a.current=null,t(null)},b)},[i]),p=o(()=>{i(),t(null)},[i]);return{popup:l,openPopup:d,scheduleClose:m,cancelClose:i,closePopup:p}}export{S as M,$ as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{T as o}from"./vendor-core-8R2fFbyN.js";import{b as a}from"./vendor-query-BXRECSI6.js";import{q as i}from"./index-
|
|
1
|
+
import{T as o}from"./vendor-core-8R2fFbyN.js";import{b as a}from"./vendor-query-BXRECSI6.js";import{q as i}from"./index-CfvzoNYQ.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 d,u as o,S as v}from"./vendor-core-8R2fFbyN.js";import{I as g}from"./vendor-icons-CDMuNDeL.js";import{M as f}from"./MediaCard-
|
|
1
|
+
import{N as d,u as o,S as v}from"./vendor-core-8R2fFbyN.js";import{I as g}from"./vendor-icons-CDMuNDeL.js";import{M as f}from"./MediaCard-xfJv6irD.js";import{T as m}from"./TvPopup-DYKTHRrD.js";import{c as T,i as h}from"./useTvLibrary-DeGkJuvp.js";import{b as u}from"./vendor-query-BXRECSI6.js";import{q as y}from"./index-CfvzoNYQ.js";const b=d(({item:e})=>{const r=e.type==="tv"||e.type==="tvSeries"||e.type==="tvMiniSeries",t=T(e.type,e.id);return o(f,{item:{id:String(e.id),title:e.title,thumbnail:e.image,typeBadge:r?"TV":"Movie",isAdult:h(e)},linkTo:t,hoverIcon:"info",showInfoButton:!0,metaRow:o(v,{children:[e.year&&o("span",{style:{opacity:.75},children:e.year}),e.vote_average!=null&&o("span",{style:{display:"inline-flex",alignItems:"center",gap:3},children:[o(g,{name:"star",size:10}),Number(e.vote_average).toFixed(1)]})]}),renderPopup:(n,a)=>o(m,{item:e,anchorRect:n,onMouseEnter:a.onMouseEnter,onMouseLeave:a.onMouseLeave,onRequestClose:a.close})})}),c=1e3*60*5,w=e=>{const{query:r,type:t,genre:n,year:a,sort_by:i,page:l}=e,s=new URLSearchParams;r?.trim()&&s.set("q",r.trim()),t&&t!=="multi"&&s.set("type",t),n&&s.set("genre",n),a&&a!=="ALL"&&s.set("year",a),i&&i!=="popularity.desc"&&s.set("sort_by",i),s.set("page",String(l||1));const p=s.toString();return u({queryKey:["tv-search-paginated",p],queryFn:()=>y(`/api/tv/search?${p}`),staleTime:c,retry:1})},A=(e="all",r="week",t=1,n=!0)=>u({queryKey:["tv-trending",e,r,t],queryFn:()=>y(`/api/tv/trending?media_type=${e}&time_window=${r}&page=${t}`),enabled:n,staleTime:c,retry:1});export{b as T,w as a,A as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{T as m}from"./vendor-core-8R2fFbyN.js";import{b as y,u as o,a as u}from"./vendor-query-BXRECSI6.js";import{q as i,z as a}from"./index-
|
|
1
|
+
import{T as m}from"./vendor-core-8R2fFbyN.js";import{b as y,u as o,a as u}from"./vendor-query-BXRECSI6.js";import{q as i,z as a}from"./index-CfvzoNYQ.js";const d=e=>String(e).toLowerCase()==="movie"?"movie":"tv",g=(e,t)=>`${d(e)}:${t}`,K=(e,t)=>{const r=d(e);return`/tv/${t}?type=${r}`},Q=(e,t,r,s)=>{const n=new URLSearchParams;return n.set("type",d(e)),r!==void 0&&n.set("s",String(r)),s!==void 0&&n.set("e",String(s)),`/tv/${t}/watch?${n.toString()}`},$=e=>e.adult===!0||e.adult===1,f=["Watching","Completed","On-Hold","Dropped","Planned"],l=(e,t)=>g(e,t),w=(e="All",t=1,r=24)=>y({queryKey:["tv-library",e,t,r],queryFn:()=>{const s=new URLSearchParams;return s.set("status",e),s.set("page",String(t)),s.set("limit",String(r)),i(`/api/tv/library?${s.toString()}`)}}),p=()=>y({queryKey:["tv-library-ids"],queryFn:()=>i("/api/tv/library/ids"),staleTime:1e3*60}),P=e=>y({queryKey:["tv-library-check",e],queryFn:()=>i(`/api/tv/library/check/${encodeURIComponent(e||"")}`),enabled:!!e,staleTime:1e3*60}),F=(e=24)=>y({queryKey:["tv-continue-watching",e],queryFn:()=>i(`/api/tv/continue-watching?limit=${e}`)}),O=e=>y({queryKey:["tv-progress",e],queryFn:()=>i(`/api/tv/progress/${encodeURIComponent(e||"")}`),enabled:!!e}),C=(e,t,r)=>y({queryKey:["tv-progress-latest",e,t,r],queryFn:()=>{const s=new URLSearchParams;t!==void 0&&s.set("season",String(t)),r!==void 0&&s.set("episode",String(r));const n=s.toString();return i(`/api/tv/progress/${encodeURIComponent(e||"")}/latest${n?`?${n}`:""}`)},enabled:!!e,staleTime:0}),q=()=>{const e=o();return u({mutationFn:async t=>{const{silent:r,...s}=t;return i("/api/tv/library/add",{method:"POST",body:JSON.stringify(s)})},onSuccess:(t,r)=>{r.silent||a.success("Added to TV watchlist"),e.invalidateQueries({queryKey:["tv-library"]}),e.invalidateQueries({queryKey:["tv-library-ids"]}),e.invalidateQueries({queryKey:["tv-library-check",l(r.mediaType,r.tmdbId)]})},onError:t=>{a.error(`Failed to add: ${t.message}`)}})},b=()=>{const e=o();return u({mutationFn:async t=>{await i("/api/tv/library/remove",{method:"POST",body:JSON.stringify({id:t})})},onSuccess:(t,r)=>{a.success("Removed from TV watchlist"),e.invalidateQueries({queryKey:["tv-library"]}),e.invalidateQueries({queryKey:["tv-library-ids"]}),e.invalidateQueries({queryKey:["tv-continue-watching"]}),e.invalidateQueries({queryKey:["tv-library-check",r]})},onError:t=>{a.error(`Failed to remove: ${t.message}`)}})},R=()=>{const e=o();return u({mutationFn:async({id:t,status:r})=>{await i("/api/tv/library/status",{method:"POST",body:JSON.stringify({id:t,status:r})})},onSuccess:()=>{a.success("Status updated"),e.invalidateQueries({queryKey:["tv-library"]}),e.invalidateQueries({queryKey:["tv-continue-watching"]})},onError:t=>{a.error(`Failed to update status: ${t.message}`)}})},k=()=>{const e=o();return u({mutationFn:async t=>{await i("/api/tv/progress",{method:"POST",body:JSON.stringify(t)})},onSuccess:(t,r)=>{e.invalidateQueries({queryKey:["tv-progress",r.mediaId]}),e.invalidateQueries({queryKey:["tv-progress-latest",r.mediaId]}),e.invalidateQueries({queryKey:["tv-continue-watching"]}),e.invalidateQueries({queryKey:["tv-library"]}),e.invalidateQueries({queryKey:["tv-library-ids"]})}})},L=()=>{const e=o();return u({mutationFn:async({mediaId:t,season:r,episode:s})=>{await i("/api/tv/progress/remove",{method:"POST",body:JSON.stringify({mediaId:t,season:r,episode:s})})},onSuccess:()=>{a.success("Progress reset"),e.invalidateQueries({queryKey:["tv-progress"]}),e.invalidateQueries({queryKey:["tv-continue-watching"]}),e.invalidateQueries({queryKey:["tv-library"]})},onError:t=>{a.error(`Failed to reset progress: ${t.message}`)}})},I=()=>{const e=o();return u({mutationFn:async({ids:t,status:r})=>i("/api/tv/library/batch-status",{method:"POST",body:JSON.stringify({ids:t,status:r})}),onSuccess:t=>{a.success(`Status updated for ${t.updated??0} items`),e.invalidateQueries({queryKey:["tv-library"]}),e.invalidateQueries({queryKey:["tv-continue-watching"]})},onError:t=>{a.error(`Failed to update statuses: ${t.message}`)}})},U=()=>{const e=o();return u({mutationFn:async t=>i("/api/tv/library/remove-many",{method:"POST",body:JSON.stringify({ids:t})}),onSuccess:t=>{const r=t.removed??0;a.success(`Removed ${r} ${r===1?"item":"items"} from TV watchlist`),e.invalidateQueries({queryKey:["tv-library"]}),e.invalidateQueries({queryKey:["tv-library-ids"]}),e.invalidateQueries({queryKey:["tv-continue-watching"]})},onError:t=>{a.error(`Failed to remove: ${t.message}`)}})},E=()=>{const e=o();return u({mutationFn:async t=>i("/api/tv/progress/remove-many",{method:"POST",body:JSON.stringify({ids:t})}),onSuccess:t=>{const r=t.removed??0;a.success(`Reset progress for ${r} ${r===1?"item":"items"}`),e.invalidateQueries({queryKey:["tv-progress"]}),e.invalidateQueries({queryKey:["tv-continue-watching"]}),e.invalidateQueries({queryKey:["tv-library"]})},onError:t=>{a.error(`Failed to reset progress: ${t.message}`)}})},J=()=>{const e=q(),t=b(),{data:r}=p(),s=m(()=>new Set(r?.ids||[]),[r]);return{toggle:c=>{const v=l(c.mediaType,c.tmdbId);s.has(v)?t.mutate(v):e.mutate({...c,poster:c.poster||""})},bookmarkedIds:s,pending:e.isPending||t.isPending}};export{f as T,b as a,L as b,K as c,g as d,P as e,J as f,k as g,R as h,$ as i,C as j,O as k,w as l,I as m,d as n,U as o,E as p,Q as t,F 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-CfvzoNYQ.js"></script>
|
|
37
37
|
<link rel="modulepreload" crossorigin href="/assets/vendor-core-8R2fFbyN.js">
|
|
38
38
|
<link rel="modulepreload" crossorigin href="/assets/vendor-query-BXRECSI6.js">
|
|
39
39
|
<link rel="modulepreload" crossorigin href="/assets/vendor-icons-CDMuNDeL.js">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serifpersia/dango",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.5",
|
|
4
4
|
"description": "A web application for watching anime.",
|
|
5
5
|
"main": "orchestrator.js",
|
|
6
6
|
"repository": {
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"allowScripts": {
|
|
82
82
|
"esbuild@0.28.2": true
|
|
83
83
|
},
|
|
84
|
-
"versionDate": "2026-09-
|
|
84
|
+
"versionDate": "2026-09-24T10:00:06.202Z"
|
|
85
85
|
}
|
|
@@ -127,18 +127,18 @@ export class TvLibraryController {
|
|
|
127
127
|
const episode = parseInt(req.query.episode, 10);
|
|
128
128
|
if (Number.isFinite(season) && Number.isFinite(episode)) {
|
|
129
129
|
const row = TvProgressRepository.getEpisode(db, mediaId, season, episode);
|
|
130
|
-
res.json(row || { currentTime: 0, duration: 0 });
|
|
130
|
+
res.json(row || { currentTime: 0, duration: 0, completed: 0 });
|
|
131
131
|
return;
|
|
132
132
|
}
|
|
133
133
|
const row = TvProgressRepository.getLatest(db, mediaId);
|
|
134
|
-
res.json(row || { currentTime: 0, duration: 0 });
|
|
134
|
+
res.json(row || { currentTime: 0, duration: 0, completed: 0 });
|
|
135
135
|
}
|
|
136
136
|
catch {
|
|
137
|
-
res.json({ currentTime: 0, duration: 0 });
|
|
137
|
+
res.json({ currentTime: 0, duration: 0, completed: 0 });
|
|
138
138
|
}
|
|
139
139
|
};
|
|
140
140
|
saveProgress = async (req, res) => {
|
|
141
|
-
const { mediaId: mediaIdRaw, season, episode, currentTime, duration, title, poster, backdrop, year, overview, tmdbId, mediaType, adult, } = req.body ?? {};
|
|
141
|
+
const { mediaId: mediaIdRaw, season, episode, currentTime, duration, completed, title, poster, backdrop, year, overview, tmdbId, mediaType, adult, } = req.body ?? {};
|
|
142
142
|
const mediaId = normalizeTvMediaId(mediaIdRaw);
|
|
143
143
|
if (!mediaId) {
|
|
144
144
|
return res.status(400).json({ error: 'mediaId is required' });
|
|
@@ -147,14 +147,18 @@ export class TvLibraryController {
|
|
|
147
147
|
const episodeNum = Math.max(Number(episode) || 1, 1);
|
|
148
148
|
const timeNum = Math.max(Number(currentTime) || 0, 0);
|
|
149
149
|
const durationNum = Math.max(Number(duration) || 0, 0);
|
|
150
|
+
const clampedTime = durationNum > 0 ? Math.min(timeNum, durationNum) : timeNum;
|
|
151
|
+
const storedTime = durationNum > 0 && clampedTime >= durationNum * 0.8 ? durationNum : clampedTime;
|
|
152
|
+
const completedNow = Number(completed) === 1 || (durationNum > 0 && storedTime >= durationNum * 0.8) ? 1 : 0;
|
|
150
153
|
try {
|
|
151
154
|
await performTvWriteTransaction(tvDb(req), (tx) => {
|
|
152
155
|
TvProgressRepository.upsert(tx, {
|
|
153
156
|
mediaId: String(mediaId),
|
|
154
157
|
season: Math.round(seasonNum),
|
|
155
158
|
episode: Math.round(episodeNum),
|
|
156
|
-
currentTime:
|
|
159
|
+
currentTime: storedTime,
|
|
157
160
|
duration: durationNum,
|
|
161
|
+
completed: completedNow,
|
|
158
162
|
title: title ?? null,
|
|
159
163
|
poster: poster ?? null,
|
|
160
164
|
backdrop: backdrop ?? null,
|
|
@@ -86,14 +86,15 @@ export const TvLibraryRepository = {
|
|
|
86
86
|
},
|
|
87
87
|
};
|
|
88
88
|
export const TvProgressRepository = {
|
|
89
|
-
getByMedia: (db, mediaId) => dbAll(db, 'SELECT mediaId, season, episode, currentTime, duration, updatedAt FROM tv_progress WHERE mediaId = ? ORDER BY updatedAt DESC', [mediaId]),
|
|
90
|
-
getEpisode: (db, mediaId, season, episode) => dbGet(db, 'SELECT mediaId, season, episode, currentTime, duration, updatedAt FROM tv_progress WHERE mediaId = ? AND season = ? AND episode = ?', [mediaId, season, episode]),
|
|
91
|
-
getLatest: (db, mediaId) => dbGet(db, 'SELECT mediaId, season, episode, currentTime, duration, updatedAt FROM tv_progress WHERE mediaId = ? ORDER BY updatedAt DESC LIMIT 1', [mediaId]),
|
|
92
|
-
upsert: (db, data) => dbRun(db, `INSERT INTO tv_progress (mediaId, season, episode, currentTime, duration, title, poster, backdrop, year, overview, tmdbId, mediaType, adult, updatedAt)
|
|
93
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, strftime('%s', 'now'))
|
|
89
|
+
getByMedia: (db, mediaId) => dbAll(db, 'SELECT mediaId, season, episode, currentTime, duration, completed, updatedAt FROM tv_progress WHERE mediaId = ? ORDER BY updatedAt DESC, rowid DESC', [mediaId]),
|
|
90
|
+
getEpisode: (db, mediaId, season, episode) => dbGet(db, 'SELECT mediaId, season, episode, currentTime, duration, completed, updatedAt FROM tv_progress WHERE mediaId = ? AND season = ? AND episode = ?', [mediaId, season, episode]),
|
|
91
|
+
getLatest: (db, mediaId) => dbGet(db, 'SELECT mediaId, season, episode, currentTime, duration, completed, updatedAt FROM tv_progress WHERE mediaId = ? ORDER BY updatedAt DESC, rowid DESC LIMIT 1', [mediaId]),
|
|
92
|
+
upsert: (db, data) => dbRun(db, `INSERT INTO tv_progress (mediaId, season, episode, currentTime, duration, completed, title, poster, backdrop, year, overview, tmdbId, mediaType, adult, updatedAt)
|
|
93
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, strftime('%s', 'now'))
|
|
94
94
|
ON CONFLICT(mediaId, season, episode) DO UPDATE SET
|
|
95
95
|
currentTime = EXCLUDED.currentTime,
|
|
96
96
|
duration = EXCLUDED.duration,
|
|
97
|
+
completed = CASE WHEN tv_progress.completed = 1 OR EXCLUDED.completed = 1 THEN 1 ELSE 0 END,
|
|
97
98
|
title = COALESCE(EXCLUDED.title, tv_progress.title),
|
|
98
99
|
poster = COALESCE(EXCLUDED.poster, tv_progress.poster),
|
|
99
100
|
backdrop = COALESCE(EXCLUDED.backdrop, tv_progress.backdrop),
|
|
@@ -108,6 +109,7 @@ export const TvProgressRepository = {
|
|
|
108
109
|
data.episode,
|
|
109
110
|
data.currentTime,
|
|
110
111
|
data.duration,
|
|
112
|
+
data.completed,
|
|
111
113
|
data.title ?? null,
|
|
112
114
|
data.poster ?? null,
|
|
113
115
|
data.backdrop ?? null,
|
|
@@ -137,15 +139,15 @@ export const TvProgressRepository = {
|
|
|
137
139
|
COALESCE(l.title, p.title) as title, COALESCE(l.poster, p.poster) as poster, COALESCE(l.backdrop, p.backdrop) as backdrop,
|
|
138
140
|
COALESCE(l.year, p.year) as year, COALESCE(l.overview, p.overview) as overview,
|
|
139
141
|
l.status as watchlistStatus, COALESCE(l.adult, p.adult) as adult,
|
|
140
|
-
p.season, p.episode, p.currentTime, p.duration, p.updatedAt as progressAt
|
|
142
|
+
p.season, p.episode, p.currentTime, p.duration, p.completed, p.updatedAt as progressAt
|
|
141
143
|
FROM (
|
|
142
|
-
SELECT *, ROW_NUMBER() OVER (PARTITION BY mediaId ORDER BY updatedAt DESC) as rn
|
|
144
|
+
SELECT *, rowid AS progressRowid, ROW_NUMBER() OVER (PARTITION BY mediaId ORDER BY updatedAt DESC, rowid DESC) as rn
|
|
143
145
|
FROM tv_progress
|
|
144
146
|
) p
|
|
145
147
|
LEFT JOIN tv_library l ON p.mediaId = l.id
|
|
146
148
|
WHERE p.rn = 1
|
|
147
149
|
AND (l.status IS NULL OR l.status = 'Watching')
|
|
148
|
-
ORDER BY p.updatedAt DESC
|
|
150
|
+
ORDER BY p.updatedAt DESC, p.progressRowid DESC
|
|
149
151
|
${limitClause}`);
|
|
150
152
|
},
|
|
151
153
|
};
|
package/server/dist/sync.js
CHANGED
|
@@ -974,7 +974,7 @@ export async function initializeTvDatabase(dbPath) {
|
|
|
974
974
|
db.run('PRAGMA mmap_size = 268435456;');
|
|
975
975
|
db.run('PRAGMA foreign_keys = ON;');
|
|
976
976
|
db.run(`CREATE TABLE IF NOT EXISTS tv_library (id TEXT PRIMARY KEY, tmdbId INTEGER NOT NULL, mediaType TEXT NOT NULL, title TEXT, poster TEXT, backdrop TEXT, year TEXT, overview TEXT, status TEXT DEFAULT 'Watching', adult INTEGER DEFAULT 0, lastSeason INTEGER, lastEpisode INTEGER, updatedAt INTEGER)`);
|
|
977
|
-
db.run(`CREATE TABLE IF NOT EXISTS tv_progress (mediaId TEXT NOT NULL, season INTEGER NOT NULL, episode INTEGER NOT NULL, currentTime REAL DEFAULT 0, duration REAL DEFAULT 0, updatedAt INTEGER, PRIMARY KEY (mediaId, season, episode))`);
|
|
977
|
+
db.run(`CREATE TABLE IF NOT EXISTS tv_progress (mediaId TEXT NOT NULL, season INTEGER NOT NULL, episode INTEGER NOT NULL, currentTime REAL DEFAULT 0, duration REAL DEFAULT 0, completed INTEGER NOT NULL DEFAULT 0, updatedAt INTEGER, PRIMARY KEY (mediaId, season, episode))`);
|
|
978
978
|
db.run(`CREATE TABLE IF NOT EXISTS sync_metadata (key TEXT PRIMARY KEY, value INTEGER)`);
|
|
979
979
|
db.run(`INSERT OR IGNORE INTO sync_metadata (key, value) VALUES ('db_version', 1)`);
|
|
980
980
|
db.run(`CREATE INDEX IF NOT EXISTS idx_tv_library_status ON tv_library(status)`);
|
|
@@ -1005,6 +1005,24 @@ export async function initializeTvDatabase(dbPath) {
|
|
|
1005
1005
|
if (!tvProgressColumns.some((c) => c.name === 'adult')) {
|
|
1006
1006
|
db.run(`ALTER TABLE tv_progress ADD COLUMN adult INTEGER`);
|
|
1007
1007
|
}
|
|
1008
|
+
if (!tvProgressColumns.some((c) => c.name === 'completed')) {
|
|
1009
|
+
db.run(`ALTER TABLE tv_progress ADD COLUMN completed INTEGER NOT NULL DEFAULT 0`);
|
|
1010
|
+
}
|
|
1011
|
+
db.run(`UPDATE tv_progress SET completed = 1 WHERE completed = 0 AND duration > 0 AND currentTime >= duration * 0.8`);
|
|
1012
|
+
db.run(`CREATE TRIGGER IF NOT EXISTS trg_tv_progress_completed_insert
|
|
1013
|
+
AFTER INSERT ON tv_progress
|
|
1014
|
+
WHEN NEW.duration > 0 AND NEW.currentTime >= NEW.duration * 0.8
|
|
1015
|
+
BEGIN
|
|
1016
|
+
UPDATE tv_progress SET completed = 1
|
|
1017
|
+
WHERE mediaId = NEW.mediaId AND season = NEW.season AND episode = NEW.episode;
|
|
1018
|
+
END`);
|
|
1019
|
+
db.run(`CREATE TRIGGER IF NOT EXISTS trg_tv_progress_completed_update
|
|
1020
|
+
AFTER UPDATE OF currentTime, duration ON tv_progress
|
|
1021
|
+
WHEN OLD.completed = 1 OR (NEW.duration > 0 AND NEW.currentTime >= NEW.duration * 0.8)
|
|
1022
|
+
BEGIN
|
|
1023
|
+
UPDATE tv_progress SET completed = 1
|
|
1024
|
+
WHERE mediaId = NEW.mediaId AND season = NEW.season AND episode = NEW.episode;
|
|
1025
|
+
END`);
|
|
1008
1026
|
db.run(`UPDATE OR IGNORE tv_progress SET mediaId = REPLACE(mediaId, '-', ':') WHERE mediaId LIKE 'tv-%' OR mediaId LIKE 'movie-%'`);
|
|
1009
1027
|
db.run(`DELETE FROM tv_progress WHERE mediaId LIKE 'tv-%' OR mediaId LIKE 'movie-%'`);
|
|
1010
1028
|
return db;
|
package/server/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{T as P,d as I,A as T,u as s,S as B,L as M,N as C}from"./vendor-core-8R2fFbyN.js";import{I as o}from"./vendor-icons-CDMuNDeL.js";import{u as D}from"./useAnimeInfoData-DeuwDSnI.js";import{d as z,s as R,e as A}from"./index-IZgh1beL.js";import{Q as x}from"./QueueOptionsButton-B6BMq66e.js";import{p as t,a as _,m as $,M as L}from"./MediaCard-Be1ST9oj.js";const k=({showId:e,anchorRect:l,onMouseEnter:m,onMouseLeave:h,onRequestClose:N})=>{const{showMeta:a,loadingMeta:r,inWatchlist:u,toggleWatchlist:f}=D(e),{titlePreference:n}=z(),d=P(()=>a?.name?n==="name"?a.name:n==="nativeName"?a.names?.native||a.name:n==="englishName"&&a.names?.english||a.name:"",[a,n]),[g,b]=I(!1),p=T(!1),y=()=>{p.current=!0,m()},w=()=>{p.current=!1,!g&&h()},c=i=>{b(i),!i&&!p.current&&h()};return s(_,{anchorRect:l,onMouseEnter:y,onMouseLeave:w,onRequestClose:N,children:r?s("div",{className:t.loading,children:[s("div",{className:t.spinner}),s("span",{children:"Fetching details..."})]}):a?s(B,{children:[s("div",{className:t.header,children:s("div",{className:t.title,children:d})}),s("div",{className:t.body,children:[s("div",{className:t.metaRow,children:[a.score&&s("div",{className:t.metaItem,children:[s(o,{name:"star",className:t.scoreIcon,size:14}),s("span",{children:a.score})]}),a.status&&s("div",{className:t.metaItem,children:[s(o,{name:"tv",size:14}),s("span",{children:a.status})]})]}),s("div",{className:t.synopsis,children:a.description?R(a.description):"No synopsis available."}),s("div",{className:t.details,children:[a.nextEpisodeAirDate&&s("div",{className:t.detailItem,children:[s("strong",{children:"Aired:"})," ",a.nextEpisodeAirDate]}),Array.isArray(a.genres)&&a.genres.length>0&&s("div",{className:t.genres,children:a.genres.filter(Boolean).slice(0,4).map(i=>{const E=typeof i=="string"?i:i?.name;return s("span",{className:t.genre,children:E},E)})})]})]}),s("div",{className:t.footer,children:[s("div",{className:t.primaryAction,children:s(M,{to:`/watch/${a?.id||e}`,className:t.watchBtn,children:[s(o,{name:"play",size:14}),"Watch now"]})}),s("div",{className:t.secondaryActions,children:[s("button",{className:`${t.watchlistBtn} ${u?t.active:""}`,onClick:i=>{i.preventDefault(),i.stopPropagation(),f()},children:[u?s(o,{name:"check",size:12}):s(o,{name:"plus",size:12}),s("span",{children:u?"Remove":"Watchlist"})]}),s(x,{showId:e,showName:a.name||a.names?.romaji,showThumbnail:a.thumbnail,nativeName:a.names?.native,englishName:a.names?.english,showType:a.type,className:t.watchlistBtn,activeClassName:t.active,align:"left",onMenuOpenChange:c}),s(M,{to:`/anime/${a?.id||e}`,className:t.detailsBtn,children:"Read more"})]})]})]}):s("div",{className:t.loading,children:"Failed to load info."})})},q=C(({anime:e,continueWatching:l=!1,onRemove:m,config:h,layout:N="vertical"})=>{const a=e.currentTime||0,r=e.duration||0,u=a>5&&r>5&&a<r*.95,f=a>0&&(r<=5||a>=r*.95),n=e.episodeNumber,d=l?{pathname:n?`/watch/${e._id}/${n}`:`/watch/${e._id}`,state:{name:e.name,thumbnail:e.thumbnail,nativeName:e.nativeName,englishName:e.englishName,type:e.type}}:n?`/watch/${e._id}/${n}`:`/anime/${e._id}`,g=(()=>{if(typeof d=="string")return d.startsWith("/watch/");const c=d.pathname;return typeof c=="string"&&c.startsWith("/watch/")})(),b=l&&n?`EP ${n}`:e.watchedCount!==void 0&&e.watchedCount>0?`EP ${e.watchedCount}`:null,p=[e.airTime,e.aired===!1&&e.nextEpisodeAirDate?`· ${e.nextEpisodeAirDate.split(",")[0]}`:""].filter(Boolean).join(" "),y=e.isAdult||e.rating==="R+"||e.rating==="Rx"||e.rating?.includes("17+"),w=s(B,{children:[(e.availableEpisodesDetail?.sub||e.availableEpisodes?.sub)&&s("div",{className:$.metaItem,children:[s(o,{name:"closed-captioning",size:10}),e.availableEpisodesDetail?.sub?.length??e.availableEpisodes?.sub]}),(e.availableEpisodesDetail?.dub||e.availableEpisodes?.dub)&&s("div",{className:$.metaItem,children:[s(o,{name:"microphone",size:10}),e.availableEpisodesDetail?.dub?.length??e.availableEpisodes?.dub]})]});return s(L,{item:{id:e.id||e.showId||e._id,title:e.name,nativeName:e.nativeName,englishName:e.englishName,thumbnail:e.thumbnail,typeBadge:e.type||"TV",chapterBadge:b,airMeta:p||void 0,isAdult:y,notAired:e.aired===!1},linkTo:d,hoverIcon:g?"play":"info",progress:u?{percent:a/r*100,label:`${A(a)} / ${A(r)}`}:f?{percent:100,label:"Watched"}:void 0,showProgress:l,metaRow:w,display:h,layout:N,onRemove:m,showRemoveButton:h?.elements?.poster?.removeButton??(l&&!!m),showInfoButton:!l,enrichedId:e._id,renderPopup:(c,v)=>s(k,{showId:e._id,anchorRect:c,onMouseEnter:v.onMouseEnter,onMouseLeave:v.onMouseLeave,onRequestClose:v.close})})});export{q as A};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import{u as t,A as g,d as w,h as I,q as N,T as re,$ as St}from"./vendor-core-8R2fFbyN.js";import{I as U}from"./vendor-icons-CDMuNDeL.js";import{S as fe,q as ve,e as kt,B as te}from"./index-IZgh1beL.js";import{u as Bt}from"./vendor-query-BXRECSI6.js";const xt="_controls_13898_1",Tt="_titleContainer_13898_9",Lt="_scheduleInfo_13898_15",Et="_status_13898_23",Nt="_nextEpisode_13898_35",It="_watchlistBtn_13898_45",Pt="_inList_13898_72",$t="_queueBtn_13898_83",Mt="_queueActive_13898_95",Ft="_modeToggleBtn_13898_101",At="_modeToggleActive_13898_108",Rt="_nativeToggleBtn_13898_119",Ot="_nativeToggleActive_13898_132",Dt="_markWatchedBtn_13898_153",qt="_markWatchedDone_13898_167",Ht="_completeSeriesBtn_13898_178",zt="_providerAndEpisodeRow_13898_192",Wt="_episodeActions_13898_199",Vt="_desktopEpisodeActions_13898_206",Ut="_mobileEpisodeActions_13898_213",Kt="_episodeNavBtn_13898_217",Gt="_primary_13898_247",Jt="_secondary_13898_257",Qt="_episodePickerBtn_13898_261",Xt="_queueCountdown_13898_265",jt="_speedBoostBadge_13898_280",Yt="_videoContainer_13898_311",Zt="_loadingOverlay_13898_324",en="_loadingDots_13898_338",tn="_dot_13898_343",nn="_bounce_13898_1",rn="_bufferingOverlay_13898_372",on="_bufferingSpinner_13898_381",sn="_spin_13898_920",cn="_videoIframe_13898_396",an="_videoElementHidden_13898_419",ln="_upscalerCanvas_13898_424",un="_upscalerActive_13898_437",dn="_upscalerStatusBadge_13898_441",pn="_subtitleOverlay_13898_456",fn="_controlsOverlay_13898_468",_n="_hidden_13898_498",mn="_centerPlayPause_13898_504",hn="_bottomControls_13898_536",gn="_progressBarContainer_13898_553",yn="_progressBar_13898_553",vn="_scrubbing_13898_576",bn="_watchedBar_13898_581",wn="_bufferedBar_13898_582",Cn="_thumb_13898_604",Sn="_timeBubble_13898_625",kn="_skipSegment_13898_647",Bn="_op_13898_661",xn="_ed_13898_665",Tn="_recap_13898_669",Ln="_bottomControlsRow_13898_673",En="_controlBtn_13898_681",Nn="_timeDisplay_13898_705",In="_leftControls_13898_714",Pn="_rightControls_13898_715",$n="_middleControls_13898_716",Mn="_skipControls_13898_722",Fn="_skipBtn_13898_728",An="_volumeContainer_13898_752",Rn="_volumeSlider_13898_759",On="_settingsMenu_13898_837",Dn="_slideUp_13898_1",qn="_qualityListInMenu_13898_876",Hn="_ccOptionsContainer_13898_877",zn="_qualityItemInMenu_13898_885",Wn="_ccItem_13898_886",Vn="_active_13898_907",Un="_sourceLoader_13898_914",Kn="_spinner_13898_920",Gn="_skipBubble_13898_971",Jn="_skipIcon_13898_975",Qn="_skipText_13898_978",Xn="_watchBtn_13898_990",jn="_errorOverlay_13898_1036",Yn="_retryButton_13898_1046",Zn="_skipIndicatorContainer_13898_1073",er="_leftSkip_13898_1073",tr="_rightSkip_13898_1076",nr="_sourceSelectionContainer_13898_1081",rr="_slideUpIn_13898_1",or="_providerSelectContainer_13898_1096",sr="_providerSelect_13898_1096",ir="_sourceSelect_13898_1081",cr="_sourceButtons_13898_1152",ar="_sourceButton_13898_1152",lr="_detailsBox_13898_1184",ur="_detailsToggleBtn_13898_1197",dr="_detailsGridContainer_13898_1221",pr="_fadeIn_13898_1",fr="_detailItem_13898_1233",_r="_animeStatus_13898_1253",mr="_genresList_13898_1266",hr="_genreTag_13898_1273",gr="_loadingDetails_13898_1291",yr="_descriptionSection_13898_1298",vr="_description_13898_1298",br="_epJumpControls_13898_1334",wr="_epRangeButtons_13898_1345",Cr="_metaTags_13898_1351",Sr="_epRangeBtn_13898_1358",kr="_epJumpInputGroup_13898_1373",Br="_fullscreenActive_13898_1405",xr="_skipRipple_13898_1",Tr="_errorSubtext_13898_1511",ss={controls:xt,titleContainer:Tt,scheduleInfo:Lt,status:Et,nextEpisode:Nt,watchlistBtn:It,inList:Pt,queueBtn:$t,queueActive:Mt,modeToggleBtn:Ft,modeToggleActive:At,nativeToggleBtn:Rt,nativeToggleActive:Ot,markWatchedBtn:Dt,markWatchedDone:qt,completeSeriesBtn:Ht,providerAndEpisodeRow:zt,episodeActions:Wt,desktopEpisodeActions:Vt,mobileEpisodeActions:Ut,episodeNavBtn:Kt,primary:Gt,secondary:Jt,episodePickerBtn:Qt,queueCountdown:Xt,speedBoostBadge:jt,videoContainer:Yt,loadingOverlay:Zt,loadingDots:en,dot:tn,bounce:nn,bufferingOverlay:rn,bufferingSpinner:on,spin:sn,videoIframe:cn,videoElementHidden:an,upscalerCanvas:ln,upscalerActive:un,upscalerStatusBadge:dn,subtitleOverlay:pn,controlsOverlay:fn,hidden:_n,centerPlayPause:mn,bottomControls:hn,progressBarContainer:gn,progressBar:yn,scrubbing:vn,watchedBar:bn,bufferedBar:wn,thumb:Cn,timeBubble:Sn,skipSegment:kn,op:Bn,ed:xn,recap:Tn,bottomControlsRow:Ln,controlBtn:En,timeDisplay:Nn,leftControls:In,rightControls:Pn,middleControls:$n,skipControls:Mn,skipBtn:Fn,volumeContainer:An,volumeSlider:Rn,settingsMenu:On,slideUp:Dn,qualityListInMenu:qn,ccOptionsContainer:Hn,qualityItemInMenu:zn,ccItem:Wn,active:Vn,sourceLoader:Un,spinner:Kn,skipBubble:Gn,skipIcon:Jn,skipText:Qn,watchBtn:Xn,errorOverlay:jn,retryButton:Yn,skipIndicatorContainer:Zn,leftSkip:er,rightSkip:tr,sourceSelectionContainer:nr,slideUpIn:rr,providerSelectContainer:or,providerSelect:sr,sourceSelect:ir,sourceButtons:cr,sourceButton:ar,detailsBox:lr,detailsToggleBtn:ur,detailsGridContainer:dr,fadeIn:pr,detailItem:fr,animeStatus:_r,genresList:mr,genreTag:hr,loadingDetails:gr,descriptionSection:yr,description:vr,epJumpControls:br,epRangeButtons:wr,metaTags:Cr,epRangeBtn:Sr,epJumpInputGroup:kr,fullscreenActive:Br,skipRipple:xr,errorSubtext:Tr},Lr="_playerPageLayout_xfhzl_1",Er="_episodeSidebar_xfhzl_15",Nr="_playerMain_xfhzl_28",Ir="_videoPlayerWrapper_xfhzl_36",Pr="_playerInfoHeader_xfhzl_52",$r="_playerAnimeCard_xfhzl_58",Mr="_playerInfoContainer_xfhzl_70",Fr="_videoTitleSection_xfhzl_94",Ar="_theaterMode_xfhzl_276",is={playerPageLayout:Lr,episodeSidebar:Er,playerMain:Nr,videoPlayerWrapper:Ir,playerInfoHeader:Pr,playerAnimeCard:$r,playerInfoContainer:Mr,videoTitleSection:Fr,theaterMode:Ar},Rr="_shell_41rxp_1",Or="_stage_41rxp_37",Dr="_shellFill_41rxp_85",qr="_shellFullscreen_41rxp_93",Hr="_uiLayer_41rxp_107",zr="_volumeWrap_41rxp_118",Wr="_volumeSlider_41rxp_124",j={shell:Rr,stage:Or,shellFill:Dr,shellFullscreen:qr,uiLayer:Hr,volumeWrap:zr,volumeSlider:Wr},Vr=e=>(e.language??e.lang??"").toLowerCase(),Ur=e=>(e.label??"").toLowerCase(),Kr=e=>`${e.language??e.lang??""}|||${e.label??""}`,Gr=e=>Vr(e).startsWith("en")||Ur(e).includes("english");function cs(e,r){if(e.length===0||r?.enabled===!1)return-1;const n=r?.lastKey??null;if(n){const o=e.findIndex(u=>Kr(u)===n);if(o>=0)return o}const s=e.findIndex(Gr);return s>=0?s:0}const K={fontSize:1.8,position:0,bgOpacity:.5,bgColor:"#000000",textColor:"#ffffff",edge:"shadow",bold:!1},Se=(e,r,n)=>Math.max(r,Math.min(n,e)),ke=e=>typeof e=="string"&&/^#[0-9a-fA-F]{6}$/.test(e),be=(e,r,n,s)=>{try{const o=localStorage.getItem(e);if(o===null)return r;const u=parseFloat(o);return Number.isFinite(u)?Se(u,n,s):r}catch{return r}};function Jr(){let e=K.edge,r=K.bgColor,n=K.textColor,s=K.bold;try{const o=localStorage.getItem("subtitleEdge");(o==="shadow"||o==="outline"||o==="none")&&(e=o);const u=localStorage.getItem("subtitleBgColor");ke(u)&&(r=u);const h=localStorage.getItem("subtitleTextColor");ke(h)&&(n=h);const i=localStorage.getItem("subtitleBold");i!==null&&(s=i==="true")}catch{}return{fontSize:be("subtitleFontSize",K.fontSize,.5,10),position:be("subtitlePosition",K.position,0,100),bgOpacity:be("subtitleBgOpacity",K.bgOpacity,0,1),bgColor:r,textColor:n,edge:e,bold:s}}function He(e,r){const n=`rgba(0, 0, 0, ${Se(r,0,1)})`;if(!ke(e))return n;const s=parseInt(e.slice(1,3),16),o=parseInt(e.slice(3,5),16),u=parseInt(e.slice(5,7),16);return`rgba(${s}, ${o}, ${u}, ${Se(r,0,1)})`}function ze(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 as(e){return`
|
|
2
|
-
video::cue {
|
|
3
|
-
font-size: ${e.fontSize}rem !important;
|
|
4
|
-
color: ${e.textColor} !important;
|
|
5
|
-
background-color: ${He(e.bgColor,e.bgOpacity)} !important;
|
|
6
|
-
font-weight: ${e.bold?"bold":"normal"} !important;
|
|
7
|
-
text-shadow: ${ze(e.edge,e.bgOpacity)} !important;
|
|
8
|
-
}
|
|
9
|
-
`}function ls(e){return[`font-size: ${e.fontSize}rem`,`color: ${e.textColor}`,`background-color: ${He(e.bgColor,e.bgOpacity)}`,`font-weight: ${e.bold?"700":"400"}`,`text-shadow: ${ze(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 Qr=new Set(["b","i","u","strong","em"]);function us(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/<(\/?)([a-zA-Z]+)>/g,(n,s,o)=>Qr.has(o.toLowerCase())?`<${s}${o.toLowerCase()}>`:n)}function ds(e){return e.replace(/<[^>]*>/g,"")}const ps=["#ffffff","#ffff00","#7CFC00","#00e5ff","#ff9ff3","#ffa502"],fs=["#000000","#1e272e","#2f3542","#3d0c02","#0c3d2e","#ffffff"];function _s(e,r){const n=Number.isFinite(e)?e*16:K.fontSize*16;return!Number.isFinite(r)||r<=0?n/16:Math.min(n,Math.max(13,r*.07))/16}function ms(e,r){const n=e.clientWidth||0,s=e.clientHeight||0,o=e.videoWidth>0&&e.videoHeight>0?e.videoWidth/e.videoHeight:0;let u=s;o>0&&n>0&&s>0&&(u=n/s>o?s:n/o);const h=Math.max(0,(s-u)/2),i=Math.max(0,Math.min(100,Number(r)||0))/100*u;return h+i}const Xr="_centerControls_61n7k_1",jr="_centerSkipBtn_61n7k_15",Yr="_centerPlayPause_61n7k_40",Zr="_playIconOffset_61n7k_71",ne={centerControls:Xr,centerSkipBtn:jr,centerPlayPause:Yr,playIconOffset:Zr},hs=({isPlaying:e,onTogglePlay:r,onSkipBack:n,onSkipForward:s,skipSeconds:o=10})=>t("div",{className:ne.centerControls,onClick:u=>u.stopPropagation(),children:[t("button",{className:ne.centerSkipBtn,onClick:n,title:`Skip back ${o}s`,"aria-label":`Skip back ${o} seconds`,children:t(U,{name:"replay-10"})}),t("button",{className:ne.centerPlayPause,"data-speed-boost-ignore":"true",onClick:r,"aria-label":e?"Pause":"Play",children:e?t(U,{name:"pause"}):t(U,{name:"play",className:ne.playIconOffset})}),t("button",{className:ne.centerSkipBtn,onClick:s,title:`Skip forward ${o}s`,"aria-label":`Skip forward ${o} seconds`,children:t(U,{name:"forward-10"})})]}),gs=({classes:e,videoRef:r,duration:n,formatTime:s,isScrubbing:o,buffered:u="auto",onSeek:h,onScrubStart:i,onScrubMove:S,onScrubEnd:b,timeLabelRef:a,children:E})=>{const _=g(null),T=g(null),f=g(null),p=g(null),[y,l]=w({time:0,position:null});I(()=>{const d=r.current;if(!d)return;const x=M=>{const m=M/n*100||0;T.current&&(T.current.style.width=`${m}%`),f.current&&(f.current.style.left=`${m}%`),a?.current&&(a.current.innerText=`${s(M)} / ${s(n)}`)},$=()=>{o||x(d.currentTime)},O=()=>{if(u==="auto"&&d.buffered.length>0){const m=d.buffered.end(d.buffered.length-1)/n*100||0;p.current&&(p.current.style.width=`${m}%`)}};return x(d.currentTime),O(),d.addEventListener("timeupdate",$),d.addEventListener("progress",O),()=>{d.removeEventListener("timeupdate",$),d.removeEventListener("progress",O)}},[r,n,o,u,s,a]),I(()=>{if(!o)return;const d=O=>{if(!_.current||!n)return;const M=_.current.getBoundingClientRect(),m=Math.min(1,Math.max(0,(O.clientX-M.left)/M.width));S(m),$(m)},x=()=>b();return document.addEventListener("mousemove",d),document.addEventListener("mouseup",x),()=>{document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",x)};function $(O){const M=O*n,m=M/n*100||0;T.current&&(T.current.style.width=`${m}%`),f.current&&(f.current.style.left=`${m}%`),a?.current&&(a.current.innerText=`${s(M)} / ${s(n)}`);const F=_.current?.getBoundingClientRect();l({time:M,position:F?O*F.width:null})}},[o,n,S,b,s,a]);const C=d=>{if(!_.current)return 0;const x=_.current.getBoundingClientRect();return Math.min(1,Math.max(0,(d-x.left)/x.width))};return t("div",{className:`${e.container} ${o&&e.scrubbing?e.scrubbing:""}`,ref:_,onClick:d=>{!r.current||isNaN(n)||n===0||h(C(d.clientX))},onMouseMove:d=>{if(!n)return;const x=C(d.clientX);l({time:x*n,position:d.clientX-(_.current?.getBoundingClientRect().left??0)})},onMouseLeave:()=>{o||l({time:0,position:null})},children:[y.position!==null&&t("div",{className:e.timeBubble,style:{left:y.position},children:s(y.time)}),t("div",{className:e.bar,children:[t("div",{className:e.buffered,ref:p,style:u==="full"?{width:"100%"}:void 0}),t("div",{className:e.watched,ref:T}),t("div",{className:e.thumb,ref:f,onMouseDown:d=>{d.preventDefault(),r.current&&i()}}),E]})]})};function we(){try{if(typeof window>"u")return!1;const e=window.matchMedia?.("(pointer: coarse)").matches??!1,n=(navigator.maxTouchPoints??0)>0||"ontouchstart"in window;return e||n}catch{return!1}}function We(){const[e,r]=w(we);return I(()=>{r(we());let n=null;const s=()=>r(we());try{n=window.matchMedia("(pointer: coarse)"),n.addEventListener?n.addEventListener("change",s):n.addListener(s)}catch{}return window.addEventListener("touchstart",s,{passive:!0,once:!0}),()=>{try{n&&(n.removeEventListener?n.removeEventListener("change",s):n.removeListener(s))}catch{}window.removeEventListener("touchstart",s)}},[]),e}const qe=280;function eo(e){return e?!!e.closest('button, input, select, textarea, a, [role="button"], [data-player-ui="true"]'):!1}const ys=({player:e,topBar:r,centerControls:n,bottomBar:s,settingsPanel:o,overlays:u,isInteracting:h=!1,className:i,chromeDisabled:S=!1,children:b})=>{const{state:a,refs:E,actions:_}=e,T=E.playerContainerRef,p=We()?5e3:3e3,y=g(0),l=g(null),C=g(h);C.current=h;const d=N(()=>{const m=_.inactivityTimer.current;m&&(window.clearTimeout(m),_.inactivityTimer.current=null)},[_]),x=N(()=>{d(),a.isPlaying&&(C.current||a.useNativeControls||(_.inactivityTimer.current=window.setTimeout(()=>{if(C.current)return;_.setShowControls(!1);const m=T.current;m&&a.isFullscreen&&(m.style.cursor="none")},p)))},[_,d,T,p,a.isFullscreen,a.isPlaying,a.useNativeControls]),$=N(()=>{const m=T.current;m&&(m.style.cursor="default"),!a.showControls&&!a.useNativeControls&&_.setShowControls(!0),x()},[_,T,x,a.showControls,a.useNativeControls]);I(()=>{if(a.showControls){if(!a.isPlaying){d();return}if(h||a.isScrubbing||a.showSettings||a.showVolumeSlider){_.setShowControls(!0),d();return}x()}},[_,d,h,x,a.isPlaying,a.isScrubbing,a.showControls,a.showSettings,a.showVolumeSlider]),I(()=>()=>d(),[d]);const O=N(m=>{const F=m.target;if(eo(F))return;const J=Date.now(),H=J-y.current<qe;if(y.current=J,H){l.current&&(window.clearTimeout(l.current),l.current=null),_.toggleFullscreen();return}l.current&&window.clearTimeout(l.current),l.current=window.setTimeout(()=>{l.current=null,_.setShowControls(!a.showControls),a.showControls?x():$()},qe)},[_,x,a.showControls,$]);I(()=>()=>{l.current&&window.clearTimeout(l.current)},[]);const M=a.showControls||a.isScrubbing||a.showSettings||a.showVolumeSlider;return t("div",{ref:T,className:`${j.shell} ${a.isFullscreen?j.shellFullscreen:""} ${i??""}`,onContextMenu:m=>m.preventDefault(),onPointerMove:m=>{m.pointerType==="mouse"&&$()},onMouseLeave:()=>{window.matchMedia?.("(hover: hover) and (pointer: fine)").matches&&a.isPlaying&&!C.current&&_.setShowControls(!1)},children:[t("div",{className:j.stage,onClick:O,onContextMenu:m=>m.preventDefault(),children:b}),u,!S&&!a.useNativeControls&&t("div",{className:j.uiLayer,onContextMenu:m=>m.preventDefault(),children:[t("div",{"data-player-ui":"true",children:r}),M&&n&&t("div",{"data-player-ui":"true",children:n}),t("div",{"data-player-ui":"true",children:s}),o&&t("div",{"data-player-ui":"true",children:o})]})]})},to=450,vs=({muted:e,volume:r,volumeIcon:n,buttonClassName:s,sliderClassName:o,onToggleMute:u,onVolumeChange:h,onExpandedChange:i})=>{const S=We(),[b,a]=w(!1),E=g(null),_=g(!1),T=g(null),f=N(d=>{a(d),i?.(d)},[i]);I(()=>()=>{E.current&&window.clearTimeout(E.current)},[]),I(()=>{if(!b)return;const d=x=>{T.current&&!T.current.contains(x.target)&&f(!1)};return document.addEventListener("pointerdown",d),()=>document.removeEventListener("pointerdown",d)},[b,f]);const p=e?0:r,y=()=>{_.current=!1,E.current&&window.clearTimeout(E.current),E.current=window.setTimeout(()=>{_.current=!0,f(!0)},to)},l=()=>{E.current&&(window.clearTimeout(E.current),E.current=null)},C=d=>{if(d.stopPropagation(),_.current){_.current=!1;return}if(S){b?u():f(!0);return}u()};return t("div",{ref:T,className:j.volumeWrap,"data-expanded":b?"true":"false",onContextMenu:d=>d.preventDefault(),children:[t("button",{type:"button",className:s,onClick:C,onPointerDown:y,onPointerUp:l,onPointerLeave:l,onContextMenu:d=>d.preventDefault(),"aria-label":e?"Unmute":"Mute","aria-expanded":b,children:n}),t("input",{type:"range",min:"0",max:"1",step:"0.05",value:p,onChange:d=>h(parseFloat(d.target.value)),onClick:d=>d.stopPropagation(),onPointerDown:d=>d.stopPropagation(),onContextMenu:d=>d.preventDefault(),className:`${j.volumeSlider} ${o??""}`,style:{"--volume-percent":`${p*100}%`},"aria-label":"Volume"})]})},no="_statusArea_1xccu_1",ro="_toggleBtn_1xccu_20",oo="_shortcuts_1xccu_46",so="_shortcutGroup_1xccu_56",io="_shortcut_1xccu_46",co="_key_1xccu_70",ao="_label_1xccu_91",B={statusArea:no,toggleBtn:ro,shortcuts:oo,shortcutGroup:so,shortcut:io,key:co,label:ao},bs=({showTheater:e=!0})=>{const[r,n]=w(!1);return t("div",{className:B.statusArea,children:[t("button",{type:"button",className:B.toggleBtn,onClick:()=>n(s=>!s),"aria-expanded":r,"aria-controls":"player-shortcuts",children:[t(U,{name:"keyboard",size:14}),t("span",{children:"Keyboard Shortcuts"}),r?t(U,{name:"chevron-up",size:12}):t(U,{name:"chevron-down",size:12})]}),r&&t("div",{id:"player-shortcuts",className:B.shortcuts,children:[t("div",{className:B.shortcutGroup,children:[t("div",{className:B.shortcut,children:[t("span",{className:B.key,children:"↑"}),t("span",{className:B.key,children:"↓"}),t("span",{className:B.label,children:"Volume"})]}),t("div",{className:B.shortcut,children:[t("span",{className:B.key,children:"←"}),t("span",{className:B.key,children:"→"}),t("span",{className:B.label,children:"Seek"})]})]}),t("div",{className:B.shortcutGroup,children:[t("div",{className:B.shortcut,children:[t("span",{className:B.key,children:"Space"}),t("span",{className:B.label,children:"Play/Pause"})]}),t("div",{className:B.shortcut,children:[t("span",{className:B.key,children:"F"}),t("span",{className:B.label,children:"Fullscreen"})]}),t("div",{className:B.shortcut,children:[t("span",{className:B.key,children:"M"}),t("span",{className:B.label,children:"Mute"})]}),e&&t("div",{className:B.shortcut,children:[t("span",{className:B.key,children:"T"}),t("span",{className:B.label,children:"Theater"})]}),t("div",{className:B.shortcut,children:[t("span",{className:B.key,children:"N"}),t("span",{className:B.label,children:"Next"})]})]})]})]})},lo="_episodeListContainer_9y3pr_1",uo="_drawerContainer_9y3pr_9",po="_episodeListHeader_9y3pr_14",fo="_drawerHeader_9y3pr_20",_o="_episodeListTitle_9y3pr_28",mo="_rangeSelector_9y3pr_40",ho="_rangeButton_9y3pr_46",go="_active_9y3pr_69",yo="_episodeList_9y3pr_1",vo="_drawerList_9y3pr_88",bo="_episodeItem_9y3pr_117",wo="_watched_9y3pr_144",Co="_episodeThumb_9y3pr_166",So="_episodeText_9y3pr_175",ko="_episodeLabel_9y3pr_183",Bo="_episodeSub_9y3pr_188",L={episodeListContainer:lo,drawerContainer:uo,episodeListHeader:po,drawerHeader:fo,episodeListTitle:_o,rangeSelector:mo,rangeButton:ho,active:go,episodeList:yo,drawerList:vo,episodeItem:bo,watched:wo,episodeThumb:Co,episodeText:So,episodeLabel:ko,episodeSub:Bo},xo=({episodes:e,currentEpisode:r,watchedEpisodes:n=[],onEpisodeClick:s,variant:o="sidebar",title:u="Episodes",header:h})=>{const[i,S]=w(0),b=g(null),a=re(()=>e.map(f=>typeof f=="string"?{id:f,label:`Episode ${f}`}:f),[e]),E=re(()=>new Set(n),[n]);I(()=>{const f=b.current;if(!f)return;let p=f.parentElement;for(;p;){const C=window.getComputedStyle(p);if((C.overflowY==="auto"||C.overflowY==="scroll")&&p.scrollHeight>p.clientHeight)break;p=p.parentElement}if(!p)return;const y=p.getBoundingClientRect(),l=f.getBoundingClientRect();p.scrollTop+=l.top+l.height/2-(y.top+p.clientHeight/2)},[r,i]);const _=re(()=>{if(a.length<=100)return[];const f=[];for(let p=0;p<a.length;p+=100){const y=p+1,l=Math.min(p+100,a.length);f.push(`${y}-${l}`)}return f},[a]),T=re(()=>{if(_.length===0)return a;const f=_[i];if(!f)return a;const[p,y]=f.split("-"),l=parseInt(p,10),C=parseInt(y,10);return a.slice(l-1,C)},[a,_,i]);return t("div",{className:`${L.episodeListContainer} ${o==="drawer"?L.drawerContainer:""}`,children:[t("div",{className:`${L.episodeListHeader} ${o==="drawer"?L.drawerHeader:""}`,children:[h,t("h3",{className:L.episodeListTitle,children:u}),_.length>0&&t("div",{className:L.rangeSelector,children:_.map((f,p)=>t("button",{className:`${L.rangeButton} ${i===p?L.active:""}`,onClick:()=>S(p),children:f},f))})]}),t("div",{className:`${L.episodeList} ${o==="drawer"?L.drawerList:""}`,children:T.map(f=>{const p=f.id===r,y=E.has(f.id)||f.watched===!0;return t("div",{ref:p?b:void 0,className:`${L.episodeItem} ${y?L.watched:""} ${p?L.active:""}`,onClick:()=>s(f.id),children:[f.thumbnail&&t("img",{src:f.thumbnail,alt:"",loading:"lazy",decoding:"async",className:L.episodeThumb}),t("span",{className:L.episodeText,children:[t("span",{className:L.episodeLabel,children:f.label??`Episode ${f.id}`}),f.sublabel&&t("span",{className:L.episodeSub,children:f.sublabel})]})]},f.id)})})]})},ws=({variant:e="sidebar",count:r=12})=>t("div",{className:`${L.episodeListContainer} ${e==="drawer"?L.drawerContainer:""}`,children:[t("div",{className:`${L.episodeListHeader} ${e==="drawer"?L.drawerHeader:""}`,children:[t("h3",{className:L.episodeListTitle,children:"Episodes"}),t("div",{className:L.rangeSelector,children:[t(fe,{width:"60px",height:"28px",variant:"rectangular"}),t(fe,{width:"60px",height:"28px",variant:"rectangular"}),t(fe,{width:"60px",height:"28px",variant:"rectangular"})]})]}),t("div",{className:`${L.episodeList} ${e==="drawer"?L.drawerList:""}`,children:Array.from({length:r}).map((n,s)=>t("div",{className:L.episodeItem,style:{border:"none",background:"transparent"},children:t(fe,{width:"120px",height:"1.2rem",variant:"text"})},s))})]}),To="_shell_cys6s_1",Lo="_overlay_cys6s_10",Eo="_drawer_cys6s_21",No="_handle_cys6s_56",Io="_header_cys6s_64",Po="_headerCopy_cys6s_73",$o="_kicker_cys6s_79",Mo="_title_cys6s_87",Fo="_closeBtn_cys6s_94",Ao="_body_cys6s_116",W={shell:To,overlay:Lo,drawer:Eo,handle:No,header:Io,headerCopy:Po,kicker:$o,title:Mo,closeBtn:Fo,body:Ao};function Cs({isOpen:e,onClose:r,episodes:n,currentEpisode:s,watchedEpisodes:o=[],onEpisodeClick:u,title:h,header:i}){return I(()=>{if(!e)return;const S=a=>{a.key==="Escape"&&r()},b=document.body.style.overflow;return document.body.style.overflow="hidden",document.addEventListener("keydown",S),()=>{document.body.style.overflow=b,document.removeEventListener("keydown",S)}},[e,r]),e?St(t("div",{className:W.shell,role:"dialog","aria-modal":"true","aria-label":"Episode picker",children:[t("button",{className:W.overlay,type:"button",onClick:r,"aria-label":"Close episodes"}),t("aside",{className:W.drawer,children:[t("div",{className:W.handle}),t("div",{className:W.header,children:[t("div",{className:W.headerCopy,children:[t("span",{className:W.kicker,children:"Episode picker"}),t("h3",{className:W.title,children:"Choose an episode"})]}),t("button",{className:W.closeBtn,type:"button",onClick:r,"aria-label":"Close",children:t(U,{name:"times"})})]}),t("div",{className:W.body,children:t(xo,{episodes:n,currentEpisode:s,watchedEpisodes:o,onEpisodeClick:u,variant:"drawer",title:h,header:i})})]})]}),document.body):null}function xe(){return document}function Ve(e){const r=xe();if(document.fullscreenElement)return document.fullscreenElement;if(r.webkitFullscreenElement)return r.webkitFullscreenElement;const n=e;return n?.webkitDisplayingFullscreen?n:null}function oe(e){return Ve(e)!==null}async function Ro(e,r){if(Ve(r))return;const n=e;try{if(typeof e.requestFullscreen=="function"){await e.requestFullscreen();return}if(typeof n.webkitRequestFullscreen=="function"){await n.webkitRequestFullscreen();return}if(typeof n.webkitRequestFullScreen=="function"){await n.webkitRequestFullScreen();return}}catch{}const s=r;if(s&&typeof s.webkitEnterFullscreen=="function"){if(s.webkitSupportsFullscreen===!1)return;try{await s.webkitEnterFullscreen()}catch{}}}async function Oo(e){const r=xe();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 n=e;if(n?.webkitDisplayingFullscreen&&typeof n.webkitExitFullscreen=="function"){try{n.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 Do(e,r){!e&&!r||(oe(r)?await Oo(r):e&&await Ro(e,r))}function qo(e,r){const n=()=>{try{r(oe(e()))}catch{}},s=xe(),o=n;s.addEventListener("fullscreenchange",n),s.addEventListener("webkitfullscreenchange",o),s.addEventListener("webkitbeginfullscreen",o,!0),s.addEventListener("webkitendfullscreen",o,!0);const u=e();return u?.addEventListener("webkitbeginfullscreen",o),u?.addEventListener("webkitendfullscreen",o),()=>{s.removeEventListener("fullscreenchange",n),s.removeEventListener("webkitfullscreenchange",o),s.removeEventListener("webkitbeginfullscreen",o,!0),s.removeEventListener("webkitendfullscreen",o,!0),u?.removeEventListener("webkitbeginfullscreen",o),u?.removeEventListener("webkitendfullscreen",o)}}const Ss=({skipIntervals:e,showId:r,episodeNumber:n,episodeCount:s,sourceType:o,showMeta:u})=>{const h=Bt(),i=g(null),S=g(null),b=g(null),a=g(null),E=g(!1),_=g(null),T=g(0),f=g(1),p=g({mouse:!1,keyboard:!1}),y=g(null),l=g(null),C=g(!1),d=g(Math.random().toString(36).substring(2)),[x,$]=w(!1),[O,M]=w(()=>{try{return localStorage.getItem("playerMuted")==="true"}catch{return!1}}),[m,F]=w(()=>{try{const c=parseFloat(localStorage.getItem("playerVolume")||"");return isNaN(c)?1:Math.max(0,Math.min(1,c))}catch{return 1}}),[J,H]=w(!1),[D,se]=w(0),[Ue,z]=w(!0),[ie,Te]=w(!1),[Ke,Le]=w({time:0,position:null}),[me,Ge]=w(localStorage.getItem("autoSkipEnabled")==="true"),[Je,he]=w(null),[Qe,Xe]=w(!1),[G]=w(Jr),[je,Ye]=w(G.fontSize),[Ze,et]=w(G.position),[tt,nt]=w(G.bgOpacity),[rt,ot]=w(G.bgColor),[st,it]=w(G.textColor),[ct,at]=w(G.edge),[lt,ut]=w(G.bold),[dt,pt]=w([]),[ft,_t]=w(null),[mt,ht]=w(!1),[gt,yt]=w(!1),[vt,ge]=w(!1),[bt,ce]=w(!1),[wt,Ee]=w(()=>{try{return localStorage.getItem("playerUseNativeControls")==="true"}catch{return!1}}),Y=g(!1),ye=g(-1),ae=N(()=>{const c=i.current;return!r||!n||!u?.name?null:{showId:r,episodeNumber:n,episodeCount:s,currentTime:c?c.currentTime:0,duration:c?c.duration:0,showName:u.name,showThumbnail:u.thumbnail,nativeName:u.names?.native,englishName:u.names?.english,genres:Array.isArray(u.genres)?u.genres.map(v=>typeof v=="string"?v:v?.name).filter(Boolean):void 0,popularityScore:u.score,type:u.type,isPlaying:c?!c.paused:!0,sessionId:d.current,isAdult:u.isAdult}},[r,n,s,u]),A=N((c=!1,v=!1)=>{if(Y.current)return!1;const k=ae();if(!k)return!1;const P=i.current;if(!P&&o!=="iframe")return!1;const R=P?P.currentTime>=P.duration*.8:!1;let V=P?P.currentTime:0;if(c&&R&&(V=P?P.duration:0),!v){if(V===0&&!R)return!1;const ee=P?Math.abs(V-ye.current):0;if(!c&&P&&V!==P.duration&&ee<5)return!1}return k.currentTime=V,ye.current=V,c?(async()=>{try{await ve("/api/update-progress",{method:"POST",body:JSON.stringify(k)}),h.invalidateQueries({queryKey:["video-sources",r,n]}),h.invalidateQueries({queryKey:["allContinueWatching"]}),h.invalidateQueries({queryKey:["thisWeekSchedule"]})}catch(ee){console.error("Failed to update progress:",ee)}})():ve("/api/update-progress",{method:"POST",body:JSON.stringify(k),keepalive:!0}).catch(ee=>console.error("Failed to update progress:",ee)),!0},[ae,o,h,r,n]);I(()=>{const c=i.current;c&&(c.volume=m,c.muted=O)},[i,m,O]),I(()=>{const c=()=>{Y.current||A(!0)};window.addEventListener("beforeunload",c);const v=_,k=a;return()=>{window.removeEventListener("beforeunload",c),Y.current||A(!0),v.current&&clearTimeout(v.current),k.current&&clearTimeout(k.current)}},[A]);const le=N(()=>{const c=S.current;c&&Do(c,i.current).catch(v=>{console.error(`Error attempting to toggle full-screen mode: ${v?.message} (${v?.name})`)})},[]),ue=N(()=>{i.current&&(i.current.paused?i.current.play().catch(()=>console.warn("Autoplay was prevented.")):(i.current.pause(),z(!0)))},[z]),Q=N(()=>{const c=i.current;if(!c)return;const v=p.current.mouse||p.current.keyboard;c.playbackRate=v?2:f.current},[]),de=N(c=>{p.current.mouse!==c&&(p.current.mouse=c,ce(c||p.current.keyboard),Q())},[Q]),X=N(c=>{p.current.keyboard!==c&&(p.current.keyboard=c,ce(p.current.mouse||c),Q())},[Q]),Z=N(c=>{i.current&&(i.current.currentTime+=c,_.current&&clearTimeout(_.current),_.current=setTimeout(()=>{A(!1,!0)},1500),z(!0))},[A,z]),pe=N(()=>{if(!i.current)return;const c=!i.current.muted;i.current.muted=c,M(c),localStorage.setItem("playerMuted",String(c)),!c&&i.current.volume===0&&(i.current.volume=.5,F(.5),localStorage.setItem("playerVolume",String(.5))),z(!0)},[z]);I(()=>{const c=()=>i.current,v=qo(c,k=>{H(k),k&&z(!0)});return H(oe(c())),v},[z]),I(()=>{const c=k=>{if(!k.target.closest('input, textarea, button, select, a, [role="button"], [contenteditable="true"]')){if(k.code==="Space"){if(k.preventDefault(),C.current)return;C.current=!0,l.current&&clearTimeout(l.current),l.current=window.setTimeout(()=>{l.current=null,C.current&&X(!0)},180);return}switch(k.key.toLowerCase()){case"f":le();break;case"m":pe();break;case"arrowright":Z(10);break;case"arrowleft":Z(-10);break;case"arrowup":if(k.preventDefault(),i.current){const R=Math.min(1,i.current.volume+.1);i.current.volume=R,F(R)}break;case"arrowdown":if(k.preventDefault(),i.current){const R=Math.max(0,i.current.volume-.1);i.current.volume=R,F(R)}break}}},v=k=>{if(k.code==="Space"){if(k.preventDefault(),C.current=!1,p.current.keyboard){X(!1);return}l.current&&(clearTimeout(l.current),l.current=null,ue())}};return document.addEventListener("keydown",c),document.addEventListener("keyup",v),()=>{document.removeEventListener("keydown",c),document.removeEventListener("keyup",v),l.current&&(clearTimeout(l.current),l.current=null),C.current=!1,X(!1),ce(!1)}},[X,ue,le,pe,Z]),I(()=>{const c=P=>{if(P.button!==0)return;const R=P.target;if(!R||R.closest('[data-speed-boost-ignore="true"]'))return;const V=S.current;!V||!V.contains(R)||(y.current&&clearTimeout(y.current),y.current=window.setTimeout(()=>{y.current=null,de(!0)},180))},v=()=>{y.current&&(clearTimeout(y.current),y.current=null),de(!1)},k=()=>{y.current&&(clearTimeout(y.current),y.current=null),C.current=!1,l.current&&(clearTimeout(l.current),l.current=null),X(!1),de(!1),ce(!1)};return document.addEventListener("mousedown",c),document.addEventListener("mouseup",v),window.addEventListener("blur",k),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("mouseup",v),window.removeEventListener("blur",k),y.current&&(clearTimeout(y.current),y.current=null)}},[X,de]);const Ne=N(()=>{$(!0),ge(!1),setTimeout(()=>A(!1,!0),50)},[A]),Ie=N(()=>{ge(!1)},[]),Pe=N(()=>{ge(!0)},[]),$e=N(()=>{$(!1),z(!0),setTimeout(()=>A(!1,!0),50)},[A]);I(()=>{Y.current=!1,ye.current=-1,T.current=0,d.current=Math.random().toString(36).substring(2)},[r,n]),I(()=>{const c=d.current;return()=>{const v=JSON.stringify({sessionId:c}),k=new Blob([v],{type:"application/json"});navigator.sendBeacon("/api/discord/clear",k)}},[r,n]),I(()=>{if(o!=="iframe")return;A(!1,!0);const c=setInterval(()=>{A(!1,!0)},6e4);return()=>clearInterval(c)},[o,A]);const Me=N(()=>{se(i.current?.duration||0),Q()},[Q]),Fe=N(()=>{if(i.current){const c=i.current.muted,v=i.current.volume;M(c),F(v),localStorage.setItem("playerMuted",String(c)),localStorage.setItem("playerVolume",String(v))}},[]),Ae=N(()=>{},[]),Re=N(()=>{const c=i.current;if(!c)return;const v=c.currentTime||0,k=Date.now();k-T.current>6e4&&A()&&(T.current=k);const P=e.find(R=>v>=R.start_time&&v<R.end_time)||null;he(R=>R?.skip_id!==P?.skip_id?P:R),me&&P&&!c.paused&&(c.currentTime=P.end_time,he(null))},[e,me,A]),Oe=N(()=>{const c=ae();c&&(c.currentTime=c.duration,ve("/api/update-progress",{method:"POST",body:JSON.stringify(c)}).then(()=>{h.invalidateQueries({queryKey:["video-sources",r,n]}),h.invalidateQueries({queryKey:["allContinueWatching"]})}).catch(v=>console.error("Failed to send final progress:",v)))},[ae,h,r,n]),De=N(()=>{Y.current=!0,Oe()},[Oe]);I(()=>{const c=()=>{ie&&(Te(!1),Le({time:0,position:null}),E.current&&i.current?.play(),A(!1,!0))};return ie&&document.addEventListener("mouseup",c),()=>{document.removeEventListener("mouseup",c)}},[ie,A]);const Ct=re(()=>({togglePlay:ue,seek:Z,toggleMute:pe,toggleFullscreen:le,onPlay:Ne,onPause:$e,onLoadedMetadata:Me,formatTime:kt,onVolumeChange:Fe,onProgress:Ae,onTimeUpdate:Re,onEnded:De,setShowControls:z,setIsScrubbing:Te,setHoverTime:Le,setIsAutoSkipEnabled:Ge,setCurrentSkipInterval:he,setShowCCMenu:Xe,setSubtitleFontSize:Ye,setSubtitlePosition:et,setSubtitleBgOpacity:nt,setSubtitleBgColor:ot,setSubtitleTextColor:it,setSubtitleEdge:at,setSubtitleBold:ut,setAvailableSubtitles:pt,setActiveSubtitleTrack:_t,setShowSettings:ht,setShowVolumeSlider:yt,wasPlayingBeforeScrub:E,inactivityTimer:a,setIsFullscreen:H,onWaiting:Pe,onPlaying:Ie,sendProgressUpdate:A,setUseNativeControls:Ee}),[ue,Z,pe,le,Ne,$e,Me,Fe,Ae,Re,De,H,Pe,Ie,A,Ee]);return{refs:{videoRef:i,playerContainerRef:S,progressBarRef:b},state:{isPlaying:x,isMuted:O,volume:m,isFullscreen:J,duration:D,showControls:Ue,isScrubbing:ie,hoverTime:Ke,isAutoSkipEnabled:me,currentSkipInterval:Je,showCCMenu:Qe,subtitleFontSize:je,subtitlePosition:Ze,subtitleBgOpacity:tt,subtitleBgColor:rt,subtitleTextColor:st,subtitleEdge:ct,subtitleBold:lt,availableSubtitles:dt,activeSubtitleTrack:ft,showSettings:mt,showVolumeSlider:gt,isBuffering:vt,isSpeedBoostActive:bt,useNativeControls:wt},actions:Ct}};function Ho(){try{return typeof navigator<"u"&&/android/i.test(navigator.userAgent)}catch{return!1}}function ks(e,r){const{state:n,refs:s,actions:o}=e,u=g(r);u.current=r;const h=g(!1);I(()=>{if(!Ho())return;let i=null;const S=()=>i?i.matches:window.innerWidth>window.innerHeight,b=()=>{const a=s.playerContainerRef.current;if(S()){if(!u.current||!a||oe(s.videoRef.current))return;h.current=!0,o.toggleFullscreen()}else h.current&&(h.current=!1,oe(s.videoRef.current)&&o.toggleFullscreen())};try{i=window.matchMedia("(orientation: landscape)"),i.addEventListener?i.addEventListener("change",b):i.addListener(b)}catch{}return b(),()=>{try{i&&(i.removeEventListener?i.removeEventListener("change",b):i.removeListener(b))}catch{}}},[o,s.playerContainerRef,s.videoRef,r]),I(()=>{n.isFullscreen||(h.current=!1)},[n.isFullscreen])}const zo=e=>Math.max(8,Math.min(40,Math.ceil(e/16.7)+4));function Bs({videoRef:e,canvasRef:r,delayMs:n,enabled:s}){const o=g(n);o.current=n;const u=g([]),h=g(-1),i=g(-1),S=g(!1),b=g(0),a=g(null);I(()=>{const E=l=>{if(l)try{l.close()}catch{}},_=()=>{for(const l of u.current)E(l.bitmap);u.current=[]};if(!s){_(),h.current=-1,i.current=-1,S.current=!1,b.current=0;return}let T=!1;const f=()=>{a.current!==null&&(cancelAnimationFrame(a.current),a.current=null)},p=()=>{T||(f(),a.current=requestAnimationFrame(()=>{y()}))};async function y(){if(T)return;const l=e.current,C=r.current;if(!l||!C||l.videoWidth===0){p();return}if(l.paused||l.ended||document.hidden||l.readyState<HTMLMediaElement.HAVE_CURRENT_DATA){p();return}const d=l.getVideoPlaybackQuality().totalVideoFrames;if(d===h.current){p();return}(l.seeking||i.current>=0&&Math.abs(l.currentTime-i.current)>.5)&&(_(),S.current=!1,b.current=0,h.current=-1),i.current=l.currentTime,(C.width!==l.videoWidth||C.height!==l.videoHeight)&&(C.width=l.videoWidth,C.height=l.videoHeight);const x=Math.max(0,o.current||0);x>b.current&&(S.current=!1);try{const $=await createImageBitmap(l);if(T){E($);return}h.current=d;const O=performance.now(),M=C.getContext("2d"),m=D=>{M&&M.drawImage(D,0,0,C.width,C.height)};if(x<=0){_(),S.current=!1,b.current=0,m($),E($),p();return}const F=u.current;F.push({bitmap:$,capture:O});const J=zo(x);for(;F.length>J;)E(F.shift()?.bitmap);let H=-1;for(let D=F.length-1;D>=0;D--)if(O-F[D].capture>=x){H=D;break}if(H!==-1){for(let se=0;se<H;se++)E(F.shift()?.bitmap);const D=F.shift();D?(m(D.bitmap),E(D.bitmap),S.current=!0,b.current=x):m($)}else if(!S.current)m($);else{const D=F.shift();D?(m(D.bitmap),E(D.bitmap)):m($)}}catch{}p()}return p(),()=>{T=!0,f();for(const l of u.current)try{l.bitmap.close()}catch{}u.current=[]}},[s,e,r])}const Wo="_row_1fq55_1",Vo="_rowHeader_1fq55_9",Uo="_rowLabel_1fq55_17",Ko="_rowValue_1fq55_28",Go="_slider_1fq55_36",Jo="_swatches_1fq55_99",Qo="_swatch_1fq55_99",Xo="_swatchPicked_1fq55_114",jo="_colorInput_1fq55_120",Yo="_segmented_1fq55_131",q={row:Wo,rowHeader:Vo,rowLabel:Uo,rowValue:Ko,slider:Go,swatches:Jo,swatch:Qo,swatchPicked:Xo,colorInput:jo,segmented:Yo},Zo=({label:e,display:r,min:n,max:s,step:o,value:u,percent:h,onChange:i,onCommit:S})=>t("div",{className:q.row,children:[t("div",{className:q.rowHeader,children:[t("span",{className:q.rowLabel,children:e}),t("span",{className:q.rowValue,children:r})]}),t("input",{type:"range",className:q.slider,min:n,max:s,step:o,value:u,"aria-label":e,onInput:b=>i(Number(b.target.value)),onPointerUp:S,onTouchEnd:S,onKeyUp:S,onBlur:S,style:{"--slider-percent":`${h}%`}})]}),xs=({label:e,colors:r,value:n,onChange:s})=>t("div",{className:q.row,children:[t("div",{className:q.rowHeader,children:t("span",{className:q.rowLabel,children:e})}),t("div",{className:q.swatches,children:[r.map(o=>t("button",{type:"button","aria-label":`${e} ${o}`,"aria-pressed":n.toLowerCase()===o.toLowerCase(),onClick:()=>s(o),className:`${q.swatch} ${n.toLowerCase()===o.toLowerCase()?q.swatchPicked:""}`,style:{backgroundColor:o}},o)),t("input",{type:"color","aria-label":`Custom ${e.toLowerCase()}`,className:q.colorInput,value:n,onInput:o=>s(o.target.value)})]})]});function Ts({label:e,options:r,value:n,onChange:s}){return t("div",{className:q.row,children:[t("div",{className:q.rowHeader,children:t("span",{className:q.rowLabel,children:e})}),t("div",{className:q.segmented,role:"group","aria-label":e,children:r.map(o=>t("button",{type:"button","aria-pressed":n===o,onClick:()=>s(o),children:[t("span",{children:o}),n===o&&t(U,{name:"check",size:10})]},o))})]})}const _e=10,Be=500,Ce=e=>Math.max(0,Math.min(Be,Math.round(e))),Ls=({isOpen:e,ms:r,onChange:n,onApply:s,onClose:o,testClipActive:u,onTestClip:h})=>e?t("div",{role:"dialog","aria-label":"Calibrate audio video sync","data-speed-boost-ignore":"true",onClick:i=>i.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:[t("div",{style:{fontSize:"0.8rem",fontWeight:800,color:"var(--text-primary)"},children:"A/V sync"}),t("div",{children:t(te,{size:"sm",variant:"secondary",onClick:h,children:u?"Back to video":"Preview test clip"})}),t("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6,flexWrap:"wrap"},children:[t(te,{size:"sm",onClick:()=>n(Ce(r-_e)),"aria-label":"Decrease delay by 10 milliseconds",children:["− ",_e,"ms"]}),t("div",{style:{fontSize:"1.1rem",fontWeight:800,minWidth:64,textAlign:"center"},children:[r,"ms"]}),t(te,{size:"sm",onClick:()=>n(Ce(r+_e)),"aria-label":"Increase delay by 10 milliseconds",children:["+ ",_e,"ms"]})]}),t(Zo,{label:"Video delay",display:`${r}ms`,min:0,max:Be,step:5,value:r,percent:r/Be*100,onChange:i=>n(Ce(i))}),t("div",{style:{display:"flex",gap:8,justifyContent:"center",flexWrap:"wrap"},children:[t(te,{size:"sm",variant:"secondary",onClick:o,children:"Cancel"}),t(te,{size:"sm",onClick:s,children:["Apply ",r,"ms"]})]})]}):null;export{Ls as A,fs as B,hs as C,K as D,ws as E,Zo as M,bs as P,gs as S,ps as T,vs as U,ys as a,Bs as b,ks as c,as as d,ls as e,_s as f,ms as g,ds as h,xo as i,ss as j,j as k,is as l,Cs as m,xs as n,Ts as o,cs as p,us as r,Kr as s,Ss as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as z,A as G,h as F,q as D,g as U,u as e,L as Me,T as X,S as oe,a as ee,_ as je}from"./vendor-core-8R2fFbyN.js";import{b as Ke,u as Ze,a as Je}from"./vendor-query-BXRECSI6.js";import{I as O}from"./vendor-icons-CDMuNDeL.js";import{A as ae}from"./AnimeCard-B5A20jAI.js";import{S as Be,A as Pe}from"./SkeletonGrid-CtHKKMLj.js";import{u as Ne,a as re,b as et,c as tt,d as Ee,s as at,f as be,B as De,e as ue,g as Ae,h as nt,i as rt,j as ot,k as st,l as lt,m as it,n as ct,o as dt,p as ut,q as ht}from"./index-IZgh1beL.js";import{u as mt}from"./vendor-ui-CUDCvRS_.js";import{E as Te}from"./ErrorMessage-z4f4WGgP.js";import{R as ze}from"./ResetProgressModal-CR_ovLAu.js";import{Q as pt}from"./QueueRail-VxpUDBSm.js";import{M as me}from"./MediaCard-Be1ST9oj.js";import{u as We,M as Oe}from"./useMangaPopup-BOL2mQJs.js";import{M as gt}from"./MangaResetProgressModal-DX-1PS4h.js";import{u as Fe,a as vt,m as ye,i as Ve,b as Ge,c as Ue,d as _t,e as ft}from"./useMangaLibrary-BPvFb1lU.js";import{u as bt}from"./useProviders-BsRGONMA.js";import{u as yt}from"./useMatureConsent-CT7-KfzG.js";import{u as Ye,a as Re,T as Nt}from"./useTv-D37MfTHA.js";import{T as Tt}from"./TvPopup-YTI7dEbJ.js";import{u as St,a as wt,b as kt,t as Ct,i as It,c as At}from"./useTvLibrary-Cwxgy_Bg.js";import{A as Rt}from"./AsmrResetProgressModal-Cqsoo3XC.js";import{u as Lt,a as $t,b as xt}from"./useAsmr-CbMVRjmV.js";import"./useAnimeInfoData-DeuwDSnI.js";import"./QueueOptionsButton-B6BMq66e.js";import"./useIsMobile-Dm_b6Ob3.js";const Mt="_sectionWrapper_2p2l1_9",Bt="_sectionTitleNoMargin_2p2l1_13",Pt="_carousel_2p2l1_178",E={"section-header":"_section-header_2p2l1_1",sectionWrapper:Mt,sectionTitleNoMargin:Bt,"title-wrapper":"_title-wrapper_2p2l1_17","header-controls":"_header-controls_2p2l1_24","header-select":"_header-select_2p2l1_30","collapse-button":"_collapse-button_2p2l1_79","title-link":"_title-link_2p2l1_98","continue-watching":"_continue-watching_2p2l1_117","nav-arrows":"_nav-arrows_2p2l1_139","nav-button":"_nav-button_2p2l1_148","carousel-container":"_carousel-container_2p2l1_178",carousel:Pt,"carousel-inner":"_carousel-inner_2p2l1_187","carousel-card":"_carousel-card_2p2l1_192"};function pe({align:a="start",containScroll:n="trimSnaps",scrollFraction:i=.8,threshold:t=.6,onReachThreshold:r}={}){const[c,s]=mt({align:a,containScroll:n,dragFree:!0}),[b,p]=z(!1),v=G({scrollFraction:i,threshold:t,onReachThreshold:r}),l=G(!1);F(()=>{v.current={scrollFraction:i,threshold:t,onReachThreshold:r}});const T=D(u=>{p(u.canScrollPrev()||u.canScrollNext())},[]);F(()=>{if(!s)return;const u=()=>{const d=s.scrollProgress();d>=v.current.threshold&&!l.current?(l.current=!0,v.current.onReachThreshold?.()):d<v.current.threshold&&(l.current=!1),T(s)};return s.on("init",u),s.on("reInit",u),s.on("scroll",u),s.on("resize",u),()=>{s.off("init",u),s.off("reInit",u),s.off("scroll",u),s.off("resize",u)}},[s,T]);const _=D(u=>{const d=u.containerNode().firstElementChild;if(!d)return 1;const h=u.rootNode().getBoundingClientRect().width,C=d.getBoundingClientRect().width;return C?Math.max(1,Math.round(h/C)):1},[]),o=D((u,d=!1)=>{if(!s)return;const h=Math.max(1,Math.round(_(s)*v.current.scrollFraction)),C=s.selectedScrollSnap()+(u==="left"?-h:h);s.scrollTo(C,d)},[s,_]),k=D((u=!1)=>{s?.scrollTo(0,u)},[s]);return{emblaRef:c,api:s,canScroll:b,stepBy:o,scrollToStart:k}}const J=({title:a,eyebrow:n,titleLink:i,loading:t,emptyState:r,carousel:c,layout:s,collapsible:b,defaultExpanded:p=!0,onReachThreshold:v,scrollThreshold:l,isFetchingNextPage:T,resetScrollOnShrink:_,itemCount:o=0,highlight:k,headerActions:u,loadingSkeleton:d,skeletonCount:h=7,children:C})=>{const{lowEndMode:L}=Ne(),{emblaRef:N,stepBy:$,scrollToStart:I}=pe({onReachThreshold:v,threshold:l}),[B,W]=U.useState(p);U.useEffect(()=>{W(p)},[p]);const P=U.useRef(0);return U.useEffect(()=>{_&&o>0&&B&&(o<=P.current||P.current===0)&&I(),o>0&&(P.current=o)},[o,_,B,I]),!t&&o===0&&!r&&!b?null:e("section",{className:`${E.sectionWrapper} ${k?E["continue-watching"]:""}`,children:[e("div",{className:E["section-header"],children:[e("div",{className:E["title-wrapper"],children:[e("div",{className:"title-stack",children:[n&&e("div",{className:"section-eyebrow",children:n}),i?e(Me,{to:i,className:E["title-link"],children:e("div",{className:`section-title ${E.sectionTitleNoMargin}`,children:a})}):e("div",{className:`section-title ${E.sectionTitleNoMargin}`,children:a})]}),c&&o>0&&B&&e("div",{className:E["nav-arrows"],children:[e("button",{className:E["nav-button"],type:"button","aria-label":"Scroll left",onClick:x=>{x.preventDefault(),$("left",L)},children:e(O,{name:"chevron-left"})}),e("button",{className:E["nav-button"],type:"button","aria-label":"Scroll right",onClick:x=>{x.preventDefault(),$("right",L)},children:e(O,{name:"chevron-right"})})]})]}),e("div",{className:E["header-controls"],children:[u,b&&e("button",{className:E["collapse-button"],type:"button",onClick:()=>W(x=>!x),"aria-expanded":B,"aria-label":B?`Collapse ${a}`:`Expand ${a}`,children:B?e(O,{name:"chevron-up"}):e(O,{name:"chevron-down"})})]})]}),B&&(c?!t&&o===0&&r?e("div",{children:r}):e("div",{className:E["carousel-container"],children:e("div",{className:E.carousel,ref:N,children:e("div",{className:E["carousel-inner"],children:[t&&o===0?Array.from({length:h}).map((x,A)=>e("div",{className:E["carousel-card"],children:d},A)):U.Children.map(C,(x,A)=>e("div",{className:E["carousel-card"],children:x},U.isValidElement(x)&&x.key!=null?x.key:`slide-${A}`)),T&&d&&e("div",{className:E["carousel-card"],children:d})]})})}):e("div",{className:"grid-container",children:t&&o===0?e(Be,{count:6,layout:s}):o>0?C:t?null:e("div",{style:{gridColumn:"1 / -1"},children:r})}))]})},Et=({title:a,eyebrow:n,animeList:i,continueWatching:t,titleLink:r,onRemove:c,loading:s,emptyState:b,carousel:p,cardConfig:v,layout:l,onReachThreshold:T,scrollThreshold:_,isFetchingNextPage:o,collapsible:k,defaultExpanded:u=!0})=>{const d=l||"vertical";return e(J,{title:a,eyebrow:n,titleLink:r,loading:s,emptyState:b,carousel:p,layout:d,collapsible:k,defaultExpanded:u,onReachThreshold:T,scrollThreshold:_,isFetchingNextPage:o,resetScrollOnShrink:t,highlight:t,itemCount:i.length,loadingSkeleton:e(Pe,{layout:d}),skeletonCount:7,children:p?i.map(h=>e(ae,{anime:h,continueWatching:t,onRemove:c,config:v,layout:d},h._id)):i.map(h=>e(ae,{anime:h,continueWatching:t,onRemove:c,config:v,layout:d},h._id))})},Le=U.memo(Et),Dt="_sectionWrapper_c8uv6_2",zt="_sectionTitleNoMargin_c8uv6_6",Wt="_timeSelect_c8uv6_80",Ot="_carouselContainer_c8uv6_111",Ft="_carousel_c8uv6_111",Vt="_carouselInner_c8uv6_122",Gt="_carouselItem_c8uv6_127",Ut="_rankCard_c8uv6_164",Yt="_rankPill_c8uv6_168",qt="_rankGold_c8uv6_179",Ht="_rankSilver_c8uv6_183",Qt="_rankBronze_c8uv6_187",Xt="_skeletonPoster_c8uv6_198",jt="_skeletonText_c8uv6_199",f={sectionWrapper:Dt,sectionTitleNoMargin:zt,"section-header":"_section-header_c8uv6_10","title-wrapper":"_title-wrapper_c8uv6_18","nav-arrows":"_nav-arrows_c8uv6_40","nav-button":"_nav-button_c8uv6_49",timeSelect:Wt,carouselContainer:Ot,carousel:Ft,carouselInner:Vt,carouselItem:Gt,rankCard:Ut,rankPill:Yt,rankGold:qt,rankSilver:Ht,rankBronze:Qt,skeletonPoster:Xt,skeletonText:jt},$e="TRENDING_DESC",Kt="POPULARITY_DESC",Zt=10;function Jt({title:a,eyebrow:n}){const{lowEndMode:i}=Ne(),[t,r]=re("trending_sort",$e),c=[{value:$e,label:"Trending"},{value:Kt,label:"All Time"}],{data:s,fetchNextPage:b,hasNextPage:p,isFetchingNextPage:v,isLoading:l,isError:T,error:_}=et(t,Zt),o=X(()=>s?.pages.flatMap(h=>h)||[],[s]),k=D(()=>{p&&!v&&!l&&b()},[p,v,l,b]),{emblaRef:u,stepBy:d}=pe({onReachThreshold:k});return e("section",{className:f.sectionWrapper,children:[e("div",{className:f["section-header"],children:[e("div",{className:f["title-wrapper"],children:[e("div",{className:"title-stack",children:[n&&e("div",{className:"section-eyebrow",children:n}),e("div",{className:`section-title ${f.sectionTitleNoMargin}`,children:a})]}),e("div",{className:f["nav-arrows"],children:[e("button",{className:f["nav-button"],type:"button",onClick:h=>{h.preventDefault(),d("left",i)},"aria-label":"Scroll left",children:e(O,{name:"chevron-left"})}),e("button",{className:f["nav-button"],type:"button",onClick:h=>{h.preventDefault(),d("right",i)},"aria-label":"Scroll right",children:e(O,{name:"chevron-right"})})]})]}),e("div",{className:f["header-actions"],children:e("select",{className:f.timeSelect,value:t,onChange:h=>r(h.currentTarget.value),children:c.map(h=>e("option",{value:h.value,children:h.label},h.value))})})]}),l?e("div",{className:f.carouselContainer,children:e("div",{className:f.carousel,children:e("div",{className:f.carouselInner,children:Array.from({length:7}).map((h,C)=>e("div",{className:f.carouselItem,children:[e("div",{className:f.skeletonPoster}),e("div",{className:f.skeletonText})]},C))})})}):T?e(Te,{message:_ instanceof Error?_.message:"An unknown error occurred"}):e("div",{className:f.carouselContainer,children:e("div",{className:f.carousel,ref:u,children:e("div",{className:f.carouselInner,children:[o.map((h,C)=>e("div",{className:f.carouselItem,children:[e("div",{className:f.rankCard,children:e(ae,{anime:h})}),e("div",{className:`${f.rankPill} ${C===0?f.rankGold:C===1?f.rankSilver:C===2?f.rankBronze:""}`,children:C+1})]},h._id)),v&&e("div",{className:f.carouselItem,style:{minWidth:"150px",display:"flex",alignItems:"center",justifyContent:"center"},children:e("div",{className:f.skeletonPoster})})]})})})]})}const ea=[{value:"TV",label:"TV"},{value:"ONA",label:"ONA"},{value:"OVA",label:"OVA"},{value:"MOVIE",label:"Movie"},{value:"ALL",label:"All"},{value:"ADULT",label:"Mature"}],ta=10;function aa({eyebrow:a}){const{lowEndMode:n}=Ne(),[i,t]=re("latest_releases_format","TV"),{data:r,fetchNextPage:c,hasNextPage:s,isFetchingNextPage:b,isLoading:p,isError:v,error:l}=tt(i,ta),T=X(()=>r?.pages.flatMap(u=>u)||[],[r]),_=D(()=>{s&&!b&&!p&&c()},[s,b,p,c]),{emblaRef:o,stepBy:k}=pe({onReachThreshold:_});return e("section",{className:f.sectionWrapper,children:[e("div",{className:f["section-header"],children:[e("div",{className:f["title-wrapper"],children:[e("div",{className:"title-stack",children:[a&&e("div",{className:"section-eyebrow",children:a}),e("div",{className:`section-title ${f.sectionTitleNoMargin}`,children:"Latest Releases"})]}),e("div",{className:f["nav-arrows"],children:[e("button",{className:f["nav-button"],type:"button",onClick:u=>{u.preventDefault(),k("left",n)},"aria-label":"Scroll left",children:e(O,{name:"chevron-left"})}),e("button",{className:f["nav-button"],type:"button",onClick:u=>{u.preventDefault(),k("right",n)},"aria-label":"Scroll right",children:e(O,{name:"chevron-right"})})]})]}),e("div",{className:f["header-actions"],children:e("select",{className:f.timeSelect,value:i,onChange:u=>t(u.currentTarget.value),children:ea.map(u=>e("option",{value:u.value,children:u.label},u.value))})})]}),p?e("div",{className:f.carouselContainer,children:e("div",{className:f.carousel,children:e("div",{className:f.carouselInner,children:Array.from({length:7}).map((u,d)=>e("div",{className:f.carouselItem,children:[e("div",{className:f.skeletonPoster}),e("div",{className:f.skeletonText})]},d))})})}):v?e(Te,{message:l instanceof Error?l.message:"An unknown error occurred"}):e("div",{className:f.carouselContainer,children:e("div",{className:f.carousel,ref:o,children:e("div",{className:f.carouselInner,children:[T.map(u=>e("div",{className:f.carouselItem,children:e(ae,{anime:u})},u._id)),b&&e("div",{className:f.carouselItem,style:{minWidth:"150px",display:"flex",alignItems:"center",justifyContent:"center"},children:e("div",{className:f.skeletonPoster})})]})})})]})}const na="_scheduleSection_10dfe_1",ra="_sectionTitleRow_10dfe_5",oa="_sectionTitleNoMargin_10dfe_11",sa="_sectionHeader_10dfe_15",la="_headerActions_10dfe_25",ia="_timeSelect_10dfe_31",ca="_daySelectorContainer_10dfe_62",da="_daySelector_10dfe_62",ua="_daySelectorInner_10dfe_79",ha="_dayBtn_10dfe_90",ma="_active_10dfe_113",pa="_dayMonth_10dfe_121",ga="_dayNum_10dfe_129",va="_dayName_10dfe_135",_a="_navArrows_10dfe_148",fa="_navButton_10dfe_157",ba="_carouselContainer_10dfe_181",ya="_carousel_10dfe_181",Na="_carouselInner_10dfe_193",Ta="_carouselCard_10dfe_198",M={scheduleSection:na,sectionTitleRow:ra,sectionTitleNoMargin:oa,sectionHeader:sa,headerActions:la,timeSelect:ia,daySelectorContainer:ca,daySelector:da,daySelectorInner:ua,dayBtn:ha,active:ma,dayMonth:pa,dayNum:ga,dayName:va,navArrows:_a,navButton:fa,carouselContainer:ba,carousel:ya,carouselInner:Na,carouselCard:Ta},se=a=>{const n=a.getFullYear(),i=String(a.getMonth()+1).padStart(2,"0"),t=String(a.getDate()).padStart(2,"0");return`${n}-${i}-${t}`},Sa=async(a,n)=>{const i=`/api/schedule/${a}?format=${n}`,t=await fetch(i);if(!t.ok)throw new Error("Failed to fetch episode schedule");return t.json()},wa=({eyebrow:a})=>{const[n,i]=z(()=>se(new Date)),[t,r]=re("schedule_format","TV"),{emblaRef:c,canScroll:s,stepBy:b,scrollToStart:p}=pe(),v=G(null),l=G(!0),{data:T=[],isLoading:_,error:o}=Ke({queryKey:["schedule",n,t],queryFn:()=>Sa(n,t),staleTime:1e3*60*5}),k=X(()=>{const d=[],h=new Date,C=se(h),L=new Date(h);L.setDate(h.getDate()-1);const N=se(L),$=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];for(let I=-6;I<=6;I++){const B=new Date;B.setDate(h.getDate()+I),d.push(B)}return d.map(I=>{const B=se(I),x=B===C?"Today":B===N?"Yest":$[I.getDay()],A=I.getDate(),j=new Intl.DateTimeFormat("en-US",{month:"short"}).format(I);return{dateString:B,dayLabel:x,dayNum:A,monthName:j}})},[]);F(()=>{if(l.current){l.current=!1;return}if(v.current){const d=v.current.querySelector(`[data-date="${n}"]`);d&&d.scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"})}},[n]),F(()=>{p(!0)},[n,p]);const u=[{value:"TV",label:"TV"},{value:"ONA",label:"ONA"},{value:"OVA",label:"OVA"},{value:"MOVIE",label:"Movie"},{value:"ALL",label:"All"},{value:"ADULT",label:"Mature"}];return e("div",{className:M.scheduleSection,children:[e("div",{className:M.sectionHeader,children:[e("div",{className:M.sectionTitleRow,children:[e("div",{className:"title-stack",children:[a&&e("div",{className:"section-eyebrow",children:a}),e("h2",{className:`section-title ${M.sectionTitleNoMargin}`,children:"Episode Schedule"})]}),T.length>0&&s&&e("div",{className:M.navArrows,children:[e("button",{className:M.navButton,onClick:()=>b("left"),"aria-label":"Scroll left",children:e(O,{name:"chevron-left"})}),e("button",{className:M.navButton,onClick:()=>b("right"),"aria-label":"Scroll right",children:e(O,{name:"chevron-right"})})]})]}),e("div",{className:M.headerActions,children:e("select",{className:M.timeSelect,value:t,onChange:d=>r(d.target.value),children:u.map(d=>e("option",{value:d.value,children:d.label},d.value))})})]}),e("div",{className:M.daySelectorContainer,children:e("div",{className:M.daySelector,ref:v,children:e("div",{className:M.daySelectorInner,children:k.map(d=>e("button",{type:"button","data-date":d.dateString,className:`${M.dayBtn} ${n===d.dateString?M.active:""}`,onClick:()=>i(d.dateString),children:[e("span",{className:M.dayMonth,children:d.monthName}),e("span",{className:M.dayNum,children:d.dayNum}),e("span",{className:M.dayName,children:d.dayLabel})]},d.dateString))})})}),e("div",{className:M.carouselContainer,children:e("div",{className:M.carousel,ref:c,children:e("div",{className:M.carouselInner,children:_?Array.from({length:7}).map((d,h)=>e("div",{className:M.carouselCard,children:e(Pe,{layout:"vertical"})},h)):o?e("div",{style:{width:"100%"},children:e(Te,{message:o instanceof Error?o.message:"An unknown error occurred"})}):T.length===0?e("p",{style:{textAlign:"center",marginTop:"1rem",width:"100%"},children:"No episodes scheduled for this day."}):T.map(d=>e("div",{className:M.carouselCard,children:e(ae,{anime:d,continueWatching:!1,layout:"vertical"},d._id)},d._id))})})})]})},ka="_bannerContainer_1r6xz_1",Ca="_hero_1r6xz_28",Ia="_ambient_1r6xz_37",Aa="_ambientShow_1r6xz_49",Ra="_scrim_1r6xz_53",La="_progressLine_1r6xz_69",$a="_paused_1r6xz_89",xa="_dots_1r6xz_103",Ma="_dot_1r6xz_103",Ba="_dotActive_1r6xz_132",Pa="_viewport_1r6xz_138",Ea="_track_1r6xz_145",Da="_slide_1r6xz_151",za="_slideInner_1r6xz_159",Wa="_poster_1r6xz_169",Oa="_info_1r6xz_179",Fa="_kicker_1r6xz_183",Va="_featureLabel_1r6xz_190",Ga="_scoreChip_1r6xz_202",Ua="_rise_1r6xz_220",Ya="_active_1r6xz_224",qa="_metaRow_1r6xz_280",Ha="_metaItem_1r6xz_291",Qa="_metaDivider_1r6xz_297",Xa="_title_1r6xz_304",ja="_genres_1r6xz_320",Ka="_genreTag_1r6xz_328",Za="_summary_1r6xz_339",Ja="_actions_1r6xz_351",en="_watchBtn_1r6xz_358",tn="_detailsBtn_1r6xz_380",an="_navArrow_1r6xz_401",nn="_prevArrow_1r6xz_434",rn="_nextArrow_1r6xz_438",y={bannerContainer:ka,hero:Ca,ambient:Ia,ambientShow:Aa,scrim:Ra,progressLine:La,paused:$a,dots:xa,dot:Ma,dotActive:Ba,viewport:Pa,track:Ea,slide:Da,slideInner:za,poster:Wa,info:Oa,kicker:Fa,featureLabel:Va,scoreChip:Ga,rise:Ua,active:Ya,metaRow:qa,metaItem:Ha,metaDivider:Qa,title:Xa,genres:ja,genreTag:Ka,summary:Za,actions:Ja,watchBtn:en,detailsBtn:tn,navArrow:an,prevArrow:nn,nextArrow:rn},on=8e3,le=()=>e("div",{className:"skeleton",style:{width:"100vw",maxWidth:"100vw",position:"relative",left:"50%",right:"50%",marginLeft:"-50vw",marginRight:"-50vw",height:"clamp(480px, 72vh, 660px)",marginTop:"calc(-1 * var(--header-height))",marginBottom:"2.5rem"}}),ge=({slides:a,posterClassName:n})=>{const[i,t]=z(0),[r,c]=z(0),[s,b]=z(!1),[p,v]=z(null),[l,T]=z(0),[_,o]=z({front:"",back:"",flip:!1}),k=G(0),u=G(0),d=G(new Set),h=G(null),C=G(0),L=D(m=>m.bannerSrc,[]),N=D(()=>{c(m=>m+1)},[]),$=D(m=>{h.current!==null&&(window.clearTimeout(h.current),h.current=null),v(null),N();const S=L(a[m]);o(w=>w.flip?{front:S,back:w.back,flip:!1}:{front:w.front,back:S,flip:!0}),t(m)},[N,a,L]),I=D(m=>{if(a.length===0)return;const S=(m%a.length+a.length)%a.length;d.current.has(L(a[S]))?$(S):v(S)},[a,L,$]);F(()=>{let m=!1;return a.forEach(S=>{const w=L(S);if(!w||d.current.has(w))return;const g=new Image;g.src=w;const Y=()=>{m||d.current.has(w)||(d.current.add(w),T(q=>q+1))};g.onload=Y,g.onerror=Y}),()=>{m=!0}},[a,L]),F(()=>{if(a.length!==0&&!_.front){const m=L(a[0]);o({front:m,back:"",flip:!1})}},[a,_.front,L]),F(()=>{if(p!==null){if(p<0||p>=a.length){v(null);return}d.current.has(L(a[p]))&&$(p)}},[p,l,a,L,$]),F(()=>{if(p===null)return;h.current!==null&&window.clearTimeout(h.current);const m=p;return h.current=window.setTimeout(()=>{h.current=null,$(m)},2500),()=>{h.current!==null&&(window.clearTimeout(h.current),h.current=null)}},[p,$]);const B=D(m=>{I(m)},[I]),W=D(()=>{I(C.current+1)},[I]),P=D(()=>{I(C.current-1)},[I]),x=G(null);if(F(()=>{const m=x.current;if(!m)return;const S=w=>{if(Math.abs(w.deltaY)>Math.abs(w.deltaX)&&Math.abs(w.deltaY)>5){w.preventDefault(),w.stopPropagation();const g=Date.now();if(g-k.current<300)return;k.current=g,N(),w.deltaY>0?W():P()}};return m.addEventListener("wheel",S,{passive:!1}),()=>m.removeEventListener("wheel",S)},[a.length,W,P,N]),F(()=>{if(a.length===0||s)return;const m=setTimeout(W,on);return()=>clearTimeout(m)},[i,W,a.length,r,s]),F(()=>{const m=S=>{const w=S.target;w&&(w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.tagName==="SELECT"||w.isContentEditable)||(S.key==="ArrowRight"?(S.preventDefault(),W()):S.key==="ArrowLeft"&&(S.preventDefault(),P()))};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[W,P]),F(()=>{i>=a.length&&t(0)},[a.length,i]),a.length===0)return null;const A=i>=a.length?0:i;C.current=A;const j=m=>{u.current=m.touches[0].clientX},H=m=>{const w=m.changedTouches[0].clientX-u.current;Math.abs(w)>50&&(N(),w>0?P():W())};return e("div",{className:y.bannerContainer,onMouseEnter:()=>b(!0),onMouseLeave:()=>b(!1),children:e("div",{className:`${y.hero} ${s?y.paused:""}`,onTouchStart:j,onTouchEnd:H,children:[_.front&&e("img",{src:_.front,alt:"","aria-hidden":"true",className:`${y.ambient} ${_.flip?"":y.ambientShow}`}),_.back&&e("img",{src:_.back,alt:"","aria-hidden":"true",className:`${y.ambient} ${_.flip?y.ambientShow:""}`}),e("div",{className:y.scrim,"aria-hidden":"true"}),a.length>1&&e("div",{className:y.progressLine,"aria-hidden":"true"},`progress-${r}-${A}`),a.length>1&&e("div",{className:y.dots,ref:x,role:"tablist","aria-label":"Spotlight slides",children:a.map((m,S)=>e("button",{role:"tab","aria-selected":S===A,"aria-label":`Go to slide ${S+1}: ${m.title}`,className:`${y.dot} ${S===A?y.dotActive:""}`,onClick:()=>B(S),tabIndex:S===A?0:-1},m.key))}),e("div",{className:y.viewport,children:e("div",{className:y.track,style:{transform:`translateX(-${A*100}%)`},children:a.map((m,S)=>e("div",{className:`${y.slide} ${S===A?y.active:""}`,"aria-hidden":S!==A,children:e("div",{className:y.slideInner,children:[e("img",{src:m.posterSrc,alt:m.posterAlt,className:n??y.poster,decoding:"async"}),e("div",{className:y.info,children:[e("div",{className:`${y.kicker} ${y.rise}`,children:[e("span",{className:y.featureLabel,children:"Spotlight"}),m.score!==void 0&&m.score!==null&&m.score!==""&&e("span",{className:y.scoreChip,children:[e(O,{name:"star",size:12}),e("span",{children:m.score})]})]}),e(Me,{to:m.detailTo,className:`${y.title} ${y.rise}`,"aria-label":`View details for ${m.title}`,tabIndex:S===A?0:-1,children:m.title}),m.metaItems.length>0&&e("div",{className:`${y.metaRow} ${y.rise}`,children:m.metaItems.map((w,g)=>e(U.Fragment,{children:[e("span",{className:y.metaItem,children:w}),g<m.metaItems.length-1&&e("div",{className:y.metaDivider})]},g))}),m.tags.length>0&&e("div",{className:`${y.genres} ${y.rise}`,children:m.tags.slice(0,3).map(w=>e("span",{className:y.genreTag,children:w},w))}),m.synopsis&&e("p",{className:`${y.summary} ${y.rise}`,children:m.synopsis}),e("div",{className:`${y.actions} ${y.rise}`,children:[e("button",{className:y.watchBtn,onClick:m.onPrimary,tabIndex:S===A?0:-1,children:[e(O,{name:m.primaryIcon,size:14}),e("span",{children:m.primaryLabel})]}),e("button",{className:y.detailsBtn,onClick:m.onDetails,tabIndex:S===A?0:-1,children:[e(O,{name:"info-circle",size:15}),e("span",{children:"Details"})]})]})]})]})},m.key))})}),a.length>1&&e(oe,{children:[e("button",{className:`${y.navArrow} ${y.prevArrow}`,onClick:()=>{N(),P()},"aria-label":"Previous slide",children:e(O,{name:"chevron-left",size:20})}),e("button",{className:`${y.navArrow} ${y.nextArrow}`,onClick:()=>{N(),W()},"aria-label":"Next slide",children:e(O,{name:"chevron-right",size:20})})]})]})})},sn=({animeList:a})=>{const{titlePreference:n}=Ee(),i=ee(),t=X(()=>a.slice(0,6).map(r=>{const c=n==="nativeName"?r.nativeName||r.name:n==="englishName"&&r.englishName||r.name;return{key:r._id,bannerSrc:r.bannerImage?be(r.bannerImage,1280,560):be(r.thumbnail,1280,450),posterSrc:be(r.thumbnail,460,650),posterAlt:c,title:c,detailTo:`/anime/${r._id}`,score:r.score,metaItems:[r.type||"Anime",r.status,r.episodeCount?`${r.episodeCount} Episodes`:void 0,r.rating].filter(s=>!!s),tags:(r.genres??[]).slice(0,3).map(s=>typeof s=="string"?s:s?.name).filter(s=>!!s),synopsis:at(r.description??""),primaryLabel:"Watch Now",primaryIcon:"play",onPrimary:()=>i(`/watch/${r._id}`),onDetails:()=>i(`/anime/${r._id}`)}}),[a,n,i]);return e(ge,{slides:t})},ln="_emptyState_19tmt_1",cn="_emptyStateIcon_19tmt_16",dn="_emptyStateTitle_19tmt_23",un="_emptyStateText_19tmt_30",ie={emptyState:ln,emptyStateIcon:cn,emptyStateTitle:dn,emptyStateText:un},ve=({icon:a,text:n,actionLabel:i,onAction:t,title:r="Nothing is here..."})=>e("div",{className:ie.emptyState,children:[e(O,{name:a,size:48,className:ie.emptyStateIcon}),e("div",{children:[e("h3",{className:ie.emptyStateTitle,children:r}),e("p",{className:ie.emptyStateText,children:n})]}),e(De,{variant:"primary",size:"sm",onClick:t,style:{marginTop:"1rem"},children:i})]}),hn="_select_1dw63_1",mn={select:hn},de=({value:a,options:n,onChange:i,ariaLabel:t,width:r})=>e("select",{className:mn.select,style:r!==void 0?{width:r}:void 0,value:a,"aria-label":t,onChange:c=>i(c.currentTarget.value),children:n.map(c=>e("option",{value:c.value,children:c.label},c.value))}),pn="_tabBar_irwbm_1",gn="_tabIndicator_irwbm_24",vn="_tabButton_irwbm_38",_n="_tabActive_irwbm_64",ce={tabBar:pn,tabIndicator:gn,tabButton:vn,tabActive:_n};function fn({options:a,value:n,onChange:i,ariaLabel:t},r){const c=G(null),s=G(new Map),[b,p]=z({left:0,width:0}),v=D(l=>{const T=s.current.get(l),_=c.current;if(T&&_){const o=_.getBoundingClientRect(),k=T.getBoundingClientRect();p({left:k.left-o.left+_.scrollLeft,width:k.width}),T.scrollIntoView({block:"nearest",inline:"nearest"})}},[]);return je(()=>{v(n)},[n,a.length,v]),F(()=>{if(v(n),typeof ResizeObserver>"u")return;let l=0;const T=c.current;if(!T)return;const _=new ResizeObserver(()=>{cancelAnimationFrame(l),l=requestAnimationFrame(()=>v(n))});_.observe(T);let o=!1;return document.fonts?.ready&&document.fonts.ready.then(()=>{o||v(n)}),()=>{o=!0,cancelAnimationFrame(l),_.disconnect()}},[n,a.length,v]),e("div",{className:ce.tabBar,ref:l=>{c.current=l,typeof r=="function"?r(l):r&&(r.current=l)},"aria-label":t,children:[e("div",{className:ce.tabIndicator,style:{left:b.left,width:b.width}}),a.map(l=>e(De,{ref:T=>{T&&s.current.set(l.value,T)},variant:"secondary",size:"sm",className:`${ce.tabButton} ${n===l.value?ce.tabActive:""}`,onClick:()=>i(l.value),children:l.label},l.value))]})}const he=U.forwardRef(fn),bn=[{value:"popular",label:"Popular"},{value:"followed",label:"Most Followed"},{value:"rating",label:"Top Rated"}];function yn(){const{options:a}=bt();return X(()=>a.filter(n=>n.kind==="manga").map(n=>n.value)[0]??"",[a])}const xe=({title:a,eyebrow:n,provider:i,sort:t,mature:r,headerActions:c})=>{const{toggle:s,bookmarkedIds:b}=Fe(),{popup:p,openPopup:v,scheduleClose:l,cancelClose:T,closePopup:_}=We(),{data:o,isLoading:k,fetchNextPage:u,hasNextPage:d,isFetchingNextPage:h}=vt({provider:i,query:"",sort:t,status:"",type:"",rating:r?"safe,suggestive,erotica,pornographic":"safe",mature:r}),C=X(()=>o?.pages.flatMap(N=>N.items)??[],[o]),L=D(()=>{d&&!h&&!k&&u()},[d,h,k,u]);return i?e(oe,{children:[e(J,{title:a,eyebrow:n,loading:k,carousel:!0,itemCount:C.length,headerActions:c,onReachThreshold:L,isFetchingNextPage:h,loadingSkeleton:e("div",{className:"skeleton",style:{aspectRatio:"3 / 4"}}),skeletonCount:7,children:C.map(N=>{const $=ye(N.provider,N.id);return e(me,{item:{id:$,title:N.title,...Ue(N),thumbnail:Ge(N.provider,N.cover),typeBadge:N.type||void 0,chapterBadge:N.latestChapter?`Ch. ${N.latestChapter}`:null,isAdult:Ve(N)},linkTo:`/manga/${N.provider}/${encodeURIComponent(N.id)}`,hoverIcon:"info",showInfoButton:!0,display:{elements:{poster:{typeBadge:!0,chapterBadge:!0,adultBadge:!0},info:{title:!0,mobileBadges:!0,progress:!1,meta:!1}}},onOpenDetails:I=>v(I,{provider:N.provider,mangaId:N.id,title:N.title,altTitle:N.altTitle,cover:N.cover,contentRating:N.contentRating,readTarget:`/manga/${N.provider}/${encodeURIComponent(N.id)}`,mature:r}),onPopupHoverIntent:I=>I?T():l(),rawThumbnail:!0},`${N.provider}-${N.id}`)})}),p&&e(Oe,{data:p.data,anchorRect:p.rect,bookmarked:b.has(ye(p.data.provider,p.data.mangaId)),onToggleBookmark:()=>s({id:p.data.mangaId,provider:p.data.provider,title:p.data.title,cover:p.data.cover,altTitle:p.data.altTitle??void 0,contentRating:p.data.contentRating}),onMouseEnter:T,onMouseLeave:l,onRequestClose:_})]}):null},Nn=()=>{const a=yn(),{hasConsent:n}=yt(),[i,t]=re("manga_discover_tab","latest"),[r,c]=re("manga_trending_sort","popular");return a?e(oe,{children:[e(he,{ariaLabel:"Discover manga",options:[{value:"latest",label:"Latest Releases"},{value:"trending",label:"Trending"}],value:i,onChange:t}),i==="latest"?e(xe,{title:"Latest Releases",eyebrow:"Fresh chapters",provider:a,sort:"latest",mature:n}):e(xe,{title:"Trending",eyebrow:"Discover",provider:a,sort:r,mature:n,headerActions:e("select",{className:E["header-select"],value:r,onChange:s=>c(s.currentTarget.value),"aria-label":"Trending sort",children:bn.map(s=>e("option",{value:s.value,children:s.label},s.value))})})]}):null},Tn=()=>{const a=ee(),{data:n,isLoading:i}=_t(24),[t,r]=z(null),{popup:c,openPopup:s,scheduleClose:b,cancelClose:p,closePopup:v}=We(),{toggle:l,bookmarkedIds:T}=Fe(),_=n?.data??[];return e("div",{style:{paddingBottom:"2rem"},children:[e(J,{title:"Continue Reading",eyebrow:"Pick up where you left off",titleLink:"/reading-list/Continue Reading",loading:i,carousel:!0,collapsible:!0,defaultExpanded:_.length>0,highlight:!0,itemCount:_.length,loadingSkeleton:e("div",{className:"skeleton",style:{aspectRatio:"3 / 4"}}),skeletonCount:7,emptyState:e(ve,{icon:"book",text:"You haven't read anything yet. Browse manga and open a chapter to start tracking.",actionLabel:"Browse Manga",onAction:()=>a("/manga")}),children:_.map(o=>{const k=o.page??0,u=o.pageCount??0,d=o.chapterId&&o.provider?`/manga/${o.provider}/${encodeURIComponent(o.mangaId)}/read?chapter=${encodeURIComponent(o.chapterId)}`:o.provider?`/manga/${o.provider}/${encodeURIComponent(o.mangaId)}`:"#";return e(me,{item:{id:o.id,title:o.title,...Ue({title:o.title,altTitle:o.altTitle}),thumbnail:o.provider?Ge(o.provider,o.cover||""):o.cover||"",chapterBadge:o.chapterNumber?`Ch. ${o.chapterNumber}`:null,isAdult:Ve(o)},linkTo:d,hoverIcon:"book",progress:u>0?{percent:k/u*100,label:`Ch. ${o.chapterNumber} · p. ${k}/${u}`}:void 0,showProgress:!0,display:{elements:{poster:{typeBadge:!1,chapterBadge:!0,adultBadge:!0,removeButton:!0},info:{title:!0,mobileBadges:!0,progress:!0,meta:!1}}},onRemove:()=>r({libId:o.id,title:o.title}),onOpenDetails:h=>s(h,{provider:o.provider||"",mangaId:o.mangaId||"",title:o.title||"",altTitle:o.altTitle,cover:o.cover||"",contentRating:o.contentRating||void 0,readTarget:d}),onPopupHoverIntent:h=>h?p():b(),rawThumbnail:!0},o.id)})}),e(gt,{mangaId:t?t.libId:null,title:t?.title,onClose:()=>r(null)}),c&&c.data.provider&&e(Oe,{data:c.data,anchorRect:c.rect,bookmarked:T.has(ye(c.data.provider,c.data.mangaId)),onToggleBookmark:()=>l({id:c.data.mangaId,provider:c.data.provider,title:c.data.title,cover:c.data.cover,altTitle:c.data.altTitle??void 0,contentRating:c.data.contentRating}),onMouseEnter:p,onMouseLeave:b,onRequestClose:v}),e(Nn,{})]})},Sn="_seasonGrid_bt5c7_76",wn="_emptyState_bt5c7_108",V={"section-header":"_section-header_bt5c7_1","title-wrapper":"_title-wrapper_bt5c7_8","pagination-controls":"_pagination-controls_bt5c7_14","nav-button":"_nav-button_bt5c7_24","page-info":"_page-info_bt5c7_55",seasonGrid:Sn,emptyState:wn},kn=[{value:"latest",label:"Latest Releases"},{value:"trending",label:"Trending"}],Cn=[{value:"trending_week",label:"Trending Now"},{value:"trending_day",label:"Trending Today"},{value:"popular",label:"Popular All Time"},{value:"top_rated",label:"Top Rated"}],In=()=>{const a=ee(),{data:n,isLoading:i}=St(24),t=wt(),r=kt(),[c,s]=z(null),[b,p]=z(!1),[v,l]=z(()=>localStorage.getItem("tv_home_activeTab")||"latest"),[T,_]=z("tv"),[o,k]=z("trending_week"),[u,d]=z("multi"),h=n?.data??[];U.useEffect(()=>{localStorage.setItem("tv_home_activeTab",v)},[v]);const C=o.startsWith("trending_"),L=o==="trending_day"?"day":"week",N={popular:"popularity.desc",top_rated:"vote_average.desc"},{data:$,isLoading:I}=Ye(u==="multi"?"all":u,L,1,C&&v==="trending"),{data:B,isLoading:W}=Re({type:u,sort_by:N[o]||"popularity.desc",page:1}),P=C?$?.results||[]:B?.results||[],x=C?I:W,{data:A,isLoading:j}=Re({type:T,sort_by:"primary_release_date.desc",page:1}),H=A?.results||[],m=()=>{c&&(r.mutate({mediaId:c.libId}),b&&t.mutate(c.libId),s(null),p(!1))},S=D(g=>e(Nt,{item:{id:g.id,title:g.title,year:g.year,type:g.type,image:g.image,vote_average:g.vote_average,adult:g.adult}},`${g.type}-${g.id}`),[]),w=()=>{switch(v){case"latest":return e("section",{children:[e("div",{className:V["section-header"],children:[e("div",{className:V["title-wrapper"],children:e("div",{className:"title-stack",children:[e("div",{className:"section-eyebrow",children:"Fresh picks"}),e("div",{className:"section-title",style:{marginBottom:0},children:"Latest Releases"})]})}),e("div",{style:{display:"flex",gap:"8px",alignItems:"center"},children:e(de,{ariaLabel:"Latest type",value:T,onChange:g=>_(g),options:[{value:"tv",label:"TV Shows"},{value:"movie",label:"Movies"}]})})]}),j?e("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(150px, 1fr))",gap:"var(--space-6)"},children:Array.from({length:7}).map((g,Y)=>e("div",{className:"skeleton",style:{aspectRatio:"3 / 4",borderRadius:"var(--radius-lg)"}},Y))}):H.length>0?e(J,{carousel:!0,itemCount:H.length,children:H.map(S)}):e("div",{className:V.emptyState,children:e("p",{children:"No latest releases available right now."})})]});case"trending":return e("section",{children:[e("div",{className:V["section-header"],children:[e("div",{className:V["title-wrapper"],children:e("div",{className:"title-stack",children:[e("div",{className:"section-eyebrow",children:"Discover"}),e("div",{className:"section-title",style:{marginBottom:0},children:"Trending"})]})}),e("div",{style:{display:"flex",gap:"8px",alignItems:"center"},children:[e(de,{ariaLabel:"Trending sort",value:o,onChange:k,options:Cn.map(g=>({value:g.value,label:g.label}))}),e(de,{ariaLabel:"Trending type",value:u,onChange:g=>d(g),options:[{value:"multi",label:"All"},{value:"tv",label:"TV Shows"},{value:"movie",label:"Movies"}]})]})]}),x?e("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(150px, 1fr))",gap:"var(--space-6)"},children:Array.from({length:7}).map((g,Y)=>e("div",{className:"skeleton",style:{aspectRatio:"3 / 4",borderRadius:"var(--radius-lg)"}},Y))}):P.length>0?e(J,{carousel:!0,itemCount:P.length,children:P.map(S)}):e("div",{className:V.emptyState,children:e("p",{children:"No trending content available right now."})})]})}};return e("div",{style:{paddingBottom:"2rem"},children:[e(J,{title:"Continue Watching",eyebrow:"Pick up where you left off",titleLink:"/tv-watchlist/Continue Watching",loading:i,carousel:!0,collapsible:!0,defaultExpanded:h.length>0,highlight:!0,itemCount:h.length,loadingSkeleton:e("div",{className:"skeleton",style:{aspectRatio:"3 / 4"}}),skeletonCount:7,emptyState:e(ve,{icon:"tv",text:"You haven't watched anything yet. Search TV & Movies and start watching to track progress.",actionLabel:"Browse TV & Movies",onAction:()=>a("/tv-search")}),children:h.map(g=>{const Y=g.currentTime??0,q=g.duration??0,te=g.season??g.lastSeason??1,Q=g.episode??g.lastEpisode??1,ne=q>0?`S${te} E${Q} · ${ue(Y)} / ${ue(q)}`:`S${te} E${Q}`;return e(me,{item:{id:g.id,title:g.title,thumbnail:g.poster||"",typeBadge:g.mediaType==="movie"?"Movie":"TV",chapterBadge:`S${te} E${Q}`,isAdult:It({adult:g.adult===1})},linkTo:Ct(g.mediaType,g.tmdbId,te,Q),hoverIcon:"play",progress:q>0?{percent:Y/q*100,label:ne}:void 0,showProgress:!0,metaRow:g.year?e("span",{style:{opacity:.75},children:g.year}):void 0,onRemove:()=>s({libId:g.id,title:g.title}),renderPopup:(_e,K)=>e(Tt,{item:{id:g.tmdbId??0,title:g.title||"",year:g.year||"",type:g.mediaType||"tv",image:g.poster||""},anchorRect:_e,onMouseEnter:K.onMouseEnter,onMouseLeave:K.onMouseLeave,onRequestClose:K.close})},g.id)})}),e(he,{ariaLabel:"Browse TV",options:kn,value:v,onChange:l}),e("div",{className:V.tabContent,children:w()}),e(ze,{isOpen:!!c,itemName:c?.title,progressKind:"watch",listLabel:"my TV watchlist",alsoRemove:b,onAlsoRemoveChange:p,onClose:()=>{s(null),p(!1)},onConfirm:m})]})};function An(a){const n=a.currentTime??0,i=a.duration??0,t=(a.trackIndex??0)+1;return i>0?`Track ${t} · ${ue(n)} / ${ue(i)}`:a.trackLabel?`Track ${t} · ${a.trackLabel}`:`Track ${t}`}const Rn=({title:a="Continue Listening",limit:n=24,titleLink:i,showEmptyState:t=!0})=>{const r=ee(),{data:c,isLoading:s}=Lt(n),[b,p]=z(null),v=c?.data??[];return e(oe,{children:[e(J,{title:a,eyebrow:"Pick up where you left off",titleLink:i??"/listening-list/Continue Listening",loading:s,carousel:!0,collapsible:!0,defaultExpanded:v.length>0,highlight:!0,itemCount:v.length,loadingSkeleton:e("div",{className:"skeleton",style:{aspectRatio:"16 / 9"}}),skeletonCount:7,emptyState:t?e(ve,{icon:"headphones",text:"You haven't listened to anything yet. Browse ASMR and play a track to start tracking.",actionLabel:"Browse ASMR",onAction:()=>r("/asmr")}):void 0,children:v.map(l=>{const T=l.currentTime??0,_=l.duration??0,o=l.rjCode||l.id;return e(me,{item:{id:l.id,title:l.title,thumbnail:l.thumbnail||"",chapterBadge:`Track ${(l.trackIndex??0)+1}`,isAdult:!!l.isAdult},linkTo:`/asmr/${encodeURIComponent(o)}`,hoverIcon:"play",layout:"horizontal",progress:_>0?{percent:Math.min(100,T/_*100),label:An(l)??""}:void 0,showProgress:!0,display:{elements:{poster:{typeBadge:!1,chapterBadge:!0,adultBadge:!0,removeButton:!0},info:{title:!0,mobileBadges:!0,progress:!0,meta:!1}}},onRemove:()=>p({workId:l.id,title:l.title}),rawThumbnail:!0},l.id)})}),e(Rt,{workId:b?b.workId:null,title:b?.title,onClose:()=>p(null)})]})},Ln=()=>e("div",{style:{paddingBottom:"2rem"},children:e(Rn,{})}),$n={10759:"Action & Adventure",16:"Animation",35:"Comedy",80:"Crime",18:"Drama",10765:"Sci-Fi & Fantasy",9648:"Mystery",28:"Action",12:"Adventure",14:"Fantasy",27:"Horror",878:"Sci-Fi",53:"Thriller",10749:"Romance"},xn=({items:a})=>{const n=ee(),i=X(()=>a.slice(0,6).map(t=>{const r=At(t.type,t.id);return{key:String(t.id),bannerSrc:t.backdrop?t.backdrop:t.image,posterSrc:t.image,posterAlt:t.title,title:t.title,detailTo:r,score:t.vote_average>0?Number(t.vote_average).toFixed(1):null,metaItems:[t.type==="tv"?"TV Show":"Movie",t.year].filter(Boolean),tags:t.genre_ids.slice(0,3).map(c=>$n[c]).filter(Boolean),synopsis:t.overview.length>200?t.overview.slice(0,200)+"...":t.overview,primaryLabel:"Watch Now",primaryIcon:"play",onPrimary:()=>n(r),onDetails:()=>n(r)}}),[a,n]);return e(ge,{slides:i})},Mn=({mangaList:a})=>{const n=ee(),i=X(()=>a.slice(0,6).map(t=>({key:t.id,bannerSrc:t.cover||"",posterSrc:t.cover,posterAlt:t.title,title:t.title,detailTo:`/manga/mangadex/${t.id}`,metaItems:[t.year?String(t.year):void 0,t.status??void 0].filter(r=>!!r),tags:t.tags.slice(0,3),synopsis:t.description?.slice(0,200)||"",primaryLabel:"Read Now",primaryIcon:"book",onPrimary:()=>n(`/manga/mangadex/${t.id}`),onDetails:()=>n(`/manga/mangadex/${t.id}`)})),[a,n]);return e(ge,{slides:i})},Bn="_posterLandscape_1smau_1",Pn={posterLandscape:Bn};function En(a){const n=a.availableEpisodes?.sub;if(typeof n=="number"&&n>0)return n;const i=a.availableEpisodesDetail?.sub,t=a.availableEpisodesDetail?.dub,r=(Array.isArray(i)?i.length:0)+(Array.isArray(t)?t.length:0);return r>0?r:null}const Dn=({works:a})=>{const n=ee(),i=X(()=>a.slice(0,6).map((t,r)=>{const c=$t(t),s=`/asmr/${encodeURIComponent(c)}`,b=En(t);return{key:c||t._id||String(r),bannerSrc:t.thumbnail||"",posterSrc:t.thumbnail,posterAlt:t.name,title:t.name,detailTo:s,metaItems:[t.rating?t.rating.toUpperCase():void 0,b?`${b} track${b===1?"":"s"}`:void 0].filter(p=>!!p),tags:[],synopsis:t.description?.slice(0,160)||"",primaryLabel:"Listen Now",primaryIcon:"play",onPrimary:()=>n(s),onDetails:()=>n(s)}}),[a,n]);return e(ge,{slides:i,posterClassName:Pn.posterLandscape})},zn=[{value:"anime",label:"Anime"},{value:"manga",label:"Manga"},{value:"tv",label:"TV & Movies"},{value:"asmr",label:"ASMR"}],cr=()=>{const a=Ze(),[n,i]=U.useState(1),[t,r]=z(()=>localStorage.getItem("home_activeTab")||"latest"),[c,s]=z(()=>localStorage.getItem("season_format")||"TV"),b=G(null),{data:p}=Ae(n+1,c,t==="season"),{titlePreference:v}=Ee(),{contentType:l,setContentType:T}=nt(),[_,o]=U.useState(null),[k,u]=U.useState(!1),d=rt(),{data:h=[]}=ot(),C=st(),L=lt(),N=it();F(()=>{document.title="Home - dango"},[]);const{data:$,isLoading:I}=ct();F(()=>{localStorage.setItem("home_activeTab",t)},[t]),F(()=>{localStorage.setItem("season_format",c),i(1)},[c]),F(()=>{$!==void 0&&$.length===0&&t==="week"&&r("latest")},[$,t]);const{data:B,isLoading:W,fetchNextPage:P,hasNextPage:x,isFetchingNextPage:A}=dt(),j=D(()=>{x&&!A&&!W&&P()},[x,A,W,P]),{data:H,isLoading:m}=ut(),{data:S,isLoading:w}=Ye("all","week",1,l==="tv"),{data:g,isLoading:Y}=xt(l==="asmr"),{data:q,isLoading:te}=ft(),Q=X(()=>B?.pages||[],[B]),{data:ne,isLoading:_e}=Ae(n,c,t==="season"),K=14,Se=ne&&ne.length>=K&&p&&p.length>0,we=Je({mutationFn:async R=>{await ht("/api/continue-watching/remove",{method:"POST",body:JSON.stringify({showId:R})})},onSuccess:async()=>{await a.invalidateQueries({queryKey:["allContinueWatching"]}),x&&Q.length-1<14&&P()}}),qe=D(R=>{const Z=Q?.find(fe=>String(fe.id)===String(R));if(Z){const fe=Z[v]||Z.name;o({id:R,name:fe})}},[Q,v]),He=D(()=>{_&&(we.mutate(_.id),k&&d.mutate(_.id),o(null),u(!1))},[_,we,d,k]),ke=[{key:"latest",label:"Latest Releases"},{key:"season",label:"Current Season"},{key:"popular",label:"Trending"}],Ce=$!==void 0&&$.length>0,Qe=Ce?[{key:"week",label:"This Week"},...ke]:ke,Ie=t==="week"&&!Ce?"latest":t,Xe=()=>{switch(Ie){case"latest":return e(aa,{eyebrow:"Fresh episodes"});case"season":return e("section",{style:{marginBottom:"2.5rem"},children:[e("div",{className:V["section-header"],ref:b,children:[e("div",{className:V["title-wrapper"],children:e("div",{className:"title-stack",children:[e("div",{className:"section-eyebrow",children:"This season"}),e("div",{className:"section-title",style:{marginBottom:0},children:"Current Season"})]})}),e("div",{style:{display:"flex",gap:"8px",alignItems:"center"},children:[e(de,{ariaLabel:"Season format",width:90,value:c,onChange:s,options:[{value:"TV",label:"TV"},{value:"ONA",label:"ONA"},{value:"OVA",label:"OVA"},{value:"MOVIE",label:"Movie"},{value:"ALL",label:"All"},{value:"ADULT",label:"Mature"}]}),e("div",{className:V["pagination-controls"],children:[e("button",{className:V["nav-button"],onClick:()=>{if(n>1&&(i(R=>R-1),b.current)){const R=b.current.getBoundingClientRect().top+window.scrollY-120;window.scrollTo({top:R,behavior:"smooth"})}},disabled:n===1,style:{opacity:n===1?.3:1},"aria-label":"Previous page",children:e(O,{name:"chevron-left",size:14})}),e("span",{className:V["page-info"],children:n}),e("button",{className:V["nav-button"],onClick:()=>{if(i(R=>R+1),b.current){const R=b.current.getBoundingClientRect().top+window.scrollY-120;window.scrollTo({top:R,behavior:"smooth"})}},disabled:!Se,style:{opacity:Se?1:.3},"aria-label":"Next page",children:e(O,{name:"chevron-right",size:14})})]})]})]}),e("div",{className:`grid-container ${V.seasonGrid}`,style:{minHeight:"300px",alignContent:"start"},children:_e?e(Be,{count:K}):ne?.slice(0,K).map(R=>e(ae,{anime:R},R._id))})]});case"popular":return e(Jt,{title:"Trending",eyebrow:"Discover"});case"week":return e(Le,{title:"This Week",eyebrow:"Aired this week",animeList:$||[],continueWatching:!1,carousel:!0,loading:I});default:return null}};return e("div",{style:{paddingBottom:"2rem"},children:[l==="anime"&&(m&&!H?.length?e(le,{}):H&&H.length>0&&e(sn,{animeList:H})),l==="tv"&&(w&&!S?.results?.length?e(le,{}):S?.results&&S.results.length>0&&e(xn,{items:S.results})),l==="manga"&&(te&&!q?.length?e(le,{}):q&&q.length>0&&e(Mn,{mangaList:q})),l==="asmr"&&(Y&&!g?.length?e(le,{}):g&&g.length>0&&e(Dn,{works:g})),e(he,{ariaLabel:"Content type",options:zn,value:l,onChange:T}),l==="manga"?e(Tn,{}):l==="tv"?e(In,{}):l==="asmr"?e(Ln,{}):e(oe,{children:[e(Le,{title:"Continue Watching",eyebrow:"Pick up where you left off",titleLink:"/watchlist/Continue Watching",animeList:Q,continueWatching:!0,carousel:!0,collapsible:!0,defaultExpanded:Q.length>0,onRemove:qe,loading:W,onReachThreshold:j,scrollThreshold:.7,isFetchingNextPage:A,emptyState:e(ve,{icon:"history",text:"You haven't watched anything yet. Start exploring and watch something first!",actionLabel:"Explore Trending",onAction:()=>r("popular")})}),e(pt,{title:"Queue",eyebrow:"Up next",items:h,onRemove:R=>C.mutate({showId:R.showId,episodeNumber:R.episodeNumber}),showClearAll:!0,onClear:()=>L.mutate(),onReorder:R=>N.mutate(R.map(Z=>({id:Z.id,showId:Z.showId,episodeNumber:Z.episodeNumber})))}),e(he,{ariaLabel:"Browse anime",options:Qe.map(R=>({value:R.key,label:R.label})),value:Ie,onChange:r}),e("div",{className:V.tabContent,children:Xe()}),e(wa,{eyebrow:"Never miss an episode"}),e(ze,{isOpen:!!_,itemName:_?.name,progressKind:"watch",listLabel:"my watchlist",alsoRemove:k,onAlsoRemoveChange:u,onClose:()=>{o(null),u(!1)},onConfirm:He})]})]})};export{cr as default};
|