@serifpersia/dango 3.3.6 → 3.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/README.md +1 -1
  2. package/client/dist/assets/{AnimeCard-OKU7LaSN.js → AnimeCard-WlhU88fn.js} +1 -1
  3. package/client/dist/assets/{AnimeInfo-BCyLw0yz.js → AnimeInfo-BCLagpbu.js} +1 -1
  4. package/client/dist/assets/{AnimeInfoPage-BZWl-TJY.js → AnimeInfoPage-o0U_OXKP.js} +2 -2
  5. package/client/dist/assets/{Asmr-4S6uoevp.js → Asmr-ieGJ_BcQ.js} +1 -1
  6. package/client/dist/assets/{AsmrResetProgressModal-C8i6weqW.js → AsmrResetProgressModal-BwaoVski.js} +1 -1
  7. package/client/dist/assets/{AvSyncCalibrator-oK6LlG61.js → AvSyncCalibrator-CXvBuY4l.js} +1 -1
  8. package/client/dist/assets/Home-DjLpvsp8.js +1 -0
  9. package/client/dist/assets/Insights-Dc8xLmsr.css +1 -0
  10. package/client/dist/assets/Insights-lQcQoeES.js +1 -0
  11. package/client/dist/assets/LibraryListPage-B2nhFFrc.js +1 -0
  12. package/client/dist/assets/{ListeningList-Dxkhy6E2.js → ListeningList-okIpsKCr.js} +1 -1
  13. package/client/dist/assets/{Manga-pJEpcUpo.js → Manga-3u9nVNZC.js} +1 -1
  14. package/client/dist/assets/{MangaInfoPage-BEQsjTHH.js → MangaInfoPage-Cat-B487.js} +1 -1
  15. package/client/dist/assets/{MangaReadPage-C0WAtK-1.js → MangaReadPage-CyLRxzvl.js} +1 -1
  16. package/client/dist/assets/{MangaResetProgressModal-WjKH_G_f.js → MangaResetProgressModal-Ch8RjwbO.js} +1 -1
  17. package/client/dist/assets/Mature-pINwl5wj.js +1 -0
  18. package/client/dist/assets/{MediaCard-DszKDA4s.js → MediaCard-DDiYEAm8.js} +1 -1
  19. package/client/dist/assets/{Music-CU6TBHF5.js → Music-B1swlVLI.js} +1 -1
  20. package/client/dist/assets/{OptionListMenu-CkK2BvEz.js → OptionListMenu-CzH2VSPh.js} +1 -1
  21. package/client/dist/assets/Player-SKPWb-o8.js +56 -0
  22. package/client/dist/assets/PlayerSettings-jrmY95-i.js +1 -0
  23. package/client/dist/assets/{QueueOptionsButton-DKWi-9kd.js → QueueOptionsButton-CcVP7Vi6.js} +1 -1
  24. package/client/dist/assets/{QueueRail-DAcIex5B.js → QueueRail-Cj-PU9EV.js} +1 -1
  25. package/client/dist/assets/{Radio-BhTsgGGd.js → Radio-CRlbaxQt.js} +1 -1
  26. package/client/dist/assets/{ReadingList-BLnkwB--.js → ReadingList-wRtHGNo8.js} +1 -1
  27. package/client/dist/assets/{ResetProgressModal-8mcLXaAb.js → ResetProgressModal-BokfoYFB.js} +1 -1
  28. package/client/dist/assets/Search-BOOBeTVA.js +1 -0
  29. package/client/dist/assets/{Settings-bSA7BG7h.js → Settings-BgrcswJD.js} +1 -1
  30. package/client/dist/assets/SkeletonGrid-Bge3aRl2.css +1 -0
  31. package/client/dist/assets/SkeletonGrid-C6S7OYHn.js +1 -0
  32. package/client/dist/assets/{Trackers-BXSONaRD.js → Trackers-DLcTEJJW.js} +1 -1
  33. package/client/dist/assets/{Tv-DJTbg4VW.js → Tv-ByVckozq.js} +1 -1
  34. package/client/dist/assets/{TvInfo-Z0c1Wh3i.js → TvInfo-fJ9SFMK8.js} +1 -1
  35. package/client/dist/assets/{TvPopup-CP41CncZ.js → TvPopup-yfH7p0y0.js} +1 -1
  36. package/client/dist/assets/TvSearch-CBNWDByW.js +1 -0
  37. package/client/dist/assets/{TvWatchlist-COCWPkgh.js → TvWatchlist-BqjZ2-4A.js} +1 -1
  38. package/client/dist/assets/Watchlist-B_Q2hEiJ.js +1 -0
  39. package/client/dist/assets/{hls-B_yo8-yR.js → hls-kIF7bMpF.js} +1 -1
  40. package/client/dist/assets/{index-lo-bz7f2.js → index-C65i4HWv.js} +2 -2
  41. package/client/dist/assets/{useAnimeInfoData-CbNnHRj8.js → useAnimeInfoData-BKSrS8eN.js} +1 -1
  42. package/client/dist/assets/{useAsmr-BEcgHwxg.js → useAsmr-Byj8Qiwp.js} +1 -1
  43. package/client/dist/assets/{useAsmrPopup-BXD3y2m1.js → useAsmrPopup-CLcWCCXf.js} +1 -1
  44. package/client/dist/assets/{useMangaLibrary-BXhgN-dl.js → useMangaLibrary-U7tUo8nx.js} +1 -1
  45. package/client/dist/assets/{useMangaPopup-BvgtZ53s.js → useMangaPopup-ZonOP5_c.js} +1 -1
  46. package/client/dist/assets/{useProviders-xlftutIo.js → useProviders-CymA42ZB.js} +1 -1
  47. package/client/dist/assets/{useTv-DTqrJEWp.js → useTv-CPj6Cf42.js} +1 -1
  48. package/client/dist/assets/{useTvLibrary-BHeWSd1F.js → useTvLibrary-COsyN8yu.js} +1 -1
  49. package/client/dist/index.html +1 -1
  50. package/package.json +2 -2
  51. package/server/dist/controllers/insights.controller.js +5 -1
  52. package/server/dist/controllers/proxy.controller.js +94 -23
  53. package/server/dist/controllers/watchlist.controller.js +42 -0
  54. package/server/dist/lib/discord-roles-sync.service.js +237 -2
  55. package/server/dist/repositories/insights.repository.js +10 -0
  56. package/server/dist/repositories/shows-meta.repository.js +4 -1
  57. package/server/dist/repositories/watchlist.repository.js +1 -0
  58. package/server/dist/routes/insights.routes.js +1 -0
  59. package/server/package.json +1 -1
  60. package/client/dist/assets/Home-CQ4Ikeja.js +0 -1
  61. package/client/dist/assets/Insights-DKtoVe6L.css +0 -1
  62. package/client/dist/assets/Insights-DiAo0UAc.js +0 -1
  63. package/client/dist/assets/LibraryListPage-B0MDTnEc.js +0 -1
  64. package/client/dist/assets/Mature-Ckx99wFj.js +0 -1
  65. package/client/dist/assets/Player-C3yWQkXb.js +0 -56
  66. package/client/dist/assets/PlayerSettings-CBdTzo0E.js +0 -1
  67. package/client/dist/assets/Search-DxX021dj.js +0 -1
  68. package/client/dist/assets/SkeletonGrid-DhPYefXr.css +0 -1
  69. package/client/dist/assets/SkeletonGrid-Du10CNfq.js +0 -1
  70. package/client/dist/assets/TvSearch-BlqTQYJa.js +0 -1
  71. package/client/dist/assets/Watchlist-BHLshSPX.js +0 -1
@@ -1 +0,0 @@
1
- import{d as z,A as Y,h as F,q as D,g as q,u as e,L as Pe,T as Q,S as ie,a as te,_ 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 ne}from"./AnimeCard-OKU7LaSN.js";import{S as Ee,A as De}from"./SkeletonGrid-Du10CNfq.js";import{u as ke,a as le,b as et,c as tt,d as ze,s as at,f as Se,B as We,e as ae,g as Le,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-lo-bz7f2.js";import{u as mt}from"./vendor-ui-CUDCvRS_.js";import{E as Ce}from"./ErrorMessage-z4f4WGgP.js";import{R as Oe}from"./ResetProgressModal-8mcLXaAb.js";import{Q as pt}from"./QueueRail-DAcIex5B.js";import{M as _e}from"./MediaCard-DszKDA4s.js";import{u as Fe,M as Ve}from"./useMangaPopup-BvgtZ53s.js";import{M as gt}from"./MangaResetProgressModal-WjKH_G_f.js";import{u as Ge,a as vt,m as we,i as Ue,b as Ye,c as qe,d as _t,e as ft}from"./useMangaLibrary-BXhgN-dl.js";import{u as bt}from"./useProviders-xlftutIo.js";import{u as yt}from"./useMatureConsent-CT7-KfzG.js";import{u as He,a as $e,T as Nt}from"./useTv-DTqrJEWp.js";import{T as Tt}from"./TvPopup-CP41CncZ.js";import{u as St,a as wt,b as kt,t as Ct,i as It,c as At}from"./useTvLibrary-BHeWSd1F.js";import{A as Rt}from"./AsmrResetProgressModal-C8i6weqW.js";import{u as Lt,a as $t,b as xt}from"./useAsmr-BEcgHwxg.js";import"./useAnimeInfoData-CbNnHRj8.js";import"./QueueOptionsButton-DKWi-9kd.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 fe({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,g]=z(!1),v=Y({scrollFraction:i,threshold:t,onReachThreshold:r}),l=Y(!1);F(()=>{v.current={scrollFraction:i,threshold:t,onReachThreshold:r}});const T=D(u=>{g(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 ee=({title:a,eyebrow:n,titleLink:i,loading:t,emptyState:r,carousel:c,layout:s,collapsible:b,defaultExpanded:g=!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}=ke(),{emblaRef:N,stepBy:$,scrollToStart:I}=fe({onReachThreshold:v,threshold:l}),[B,W]=q.useState(g);q.useEffect(()=>{W(g)},[g]);const P=q.useRef(0);return q.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(Pe,{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)):q.Children.map(C,(x,A)=>e("div",{className:E["carousel-card"],children:x},q.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(Ee,{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:g,cardConfig:v,layout:l,onReachThreshold:T,scrollThreshold:_,isFetchingNextPage:o,collapsible:k,defaultExpanded:u=!0})=>{const d=l||"vertical";return e(ee,{title:a,eyebrow:n,titleLink:r,loading:s,emptyState:b,carousel:g,layout:d,collapsible:k,defaultExpanded:u,onReachThreshold:T,scrollThreshold:_,isFetchingNextPage:o,resetScrollOnShrink:t,highlight:t,itemCount:i.length,loadingSkeleton:e(De,{layout:d}),skeletonCount:7,children:g?i.map(h=>e(ne,{anime:h,continueWatching:t,onRemove:c,config:v,layout:d},h._id)):i.map(h=>e(ne,{anime:h,continueWatching:t,onRemove:c,config:v,layout:d},h._id))})},xe=q.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},Me="TRENDING_DESC",Kt="POPULARITY_DESC",Zt=10;function Jt({title:a,eyebrow:n}){const{lowEndMode:i}=ke(),[t,r]=le("trending_sort",Me),c=[{value:Me,label:"Trending"},{value:Kt,label:"All Time"}],{data:s,fetchNextPage:b,hasNextPage:g,isFetchingNextPage:v,isLoading:l,isError:T,error:_}=et(t,Zt),o=Q(()=>s?.pages.flatMap(h=>h)||[],[s]),k=D(()=>{g&&!v&&!l&&b()},[g,v,l,b]),{emblaRef:u,stepBy:d}=fe({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(Ce,{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(ne,{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}=ke(),[i,t]=le("latest_releases_format","TV"),{data:r,fetchNextPage:c,hasNextPage:s,isFetchingNextPage:b,isLoading:g,isError:v,error:l}=tt(i,ta),T=Q(()=>r?.pages.flatMap(u=>u)||[],[r]),_=D(()=>{s&&!b&&!g&&c()},[s,b,g,c]),{emblaRef:o,stepBy:k}=fe({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))})})]}),g?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(Ce,{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(ne,{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},ue=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(()=>ue(new Date)),[t,r]=le("schedule_format","TV"),{emblaRef:c,canScroll:s,stepBy:b,scrollToStart:g}=fe(),v=Y(null),l=Y(!0),{data:T=[],isLoading:_,error:o}=Ke({queryKey:["schedule",n,t],queryFn:()=>Sa(n,t),staleTime:1e3*60*5}),k=Q(()=>{const d=[],h=new Date,C=ue(h),L=new Date(h);L.setDate(h.getDate()-1);const N=ue(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=ue(I),x=B===C?"Today":B===N?"Yest":$[I.getDay()],A=I.getDate(),K=new Intl.DateTimeFormat("en-US",{month:"short"}).format(I);return{dateString:B,dayLabel:x,dayNum:A,monthName:K}})},[]);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(()=>{g(!0)},[n,g]);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(De,{layout:"vertical"})},h)):o?e("div",{style:{width:"100%"},children:e(Ce,{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(ne,{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,he=()=>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"}}),be=({slides:a,posterClassName:n})=>{const[i,t]=z(0),[r,c]=z(0),[s,b]=z(!1),[g,v]=z(null),[l,T]=z(0),[_,o]=z({front:"",back:"",flip:!1}),k=Y(0),u=Y(0),d=Y(new Set),h=Y(null),C=Y(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 p=new Image;p.src=w;const U=()=>{m||d.current.has(w)||(d.current.add(w),T(V=>V+1))};p.onload=U,p.onerror=U}),()=>{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(g!==null){if(g<0||g>=a.length){v(null);return}d.current.has(L(a[g]))&&$(g)}},[g,l,a,L,$]),F(()=>{if(g===null)return;h.current!==null&&window.clearTimeout(h.current);const m=g;return h.current=window.setTimeout(()=>{h.current=null,$(m)},2500),()=>{h.current!==null&&(window.clearTimeout(h.current),h.current=null)}},[g,$]);const B=D(m=>{I(m)},[I]),W=D(()=>{I(C.current+1)},[I]),P=D(()=>{I(C.current-1)},[I]),x=Y(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 p=Date.now();if(p-k.current<300)return;k.current=p,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 K=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:K,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(Pe,{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,p)=>e(q.Fragment,{children:[e("span",{className:y.metaItem,children:w}),p<m.metaItems.length-1&&e("div",{className:y.metaDivider})]},p))}),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(ie,{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}=ze(),i=te(),t=Q(()=>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?Se(r.bannerImage,1280,560):Se(r.thumbnail,1280,450),posterSrc:Se(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(be,{slides:t})},ln="_emptyState_19tmt_1",cn="_emptyStateIcon_19tmt_16",dn="_emptyStateTitle_19tmt_23",un="_emptyStateText_19tmt_30",me={emptyState:ln,emptyStateIcon:cn,emptyStateTitle:dn,emptyStateText:un},ye=({icon:a,text:n,actionLabel:i,onAction:t,title:r="Nothing is here..."})=>e("div",{className:me.emptyState,children:[e(O,{name:a,size:48,className:me.emptyStateIcon}),e("div",{children:[e("h3",{className:me.emptyStateTitle,children:r}),e("p",{className:me.emptyStateText,children:n})]}),e(We,{variant:"primary",size:"sm",onClick:t,style:{marginTop:"1rem"},children:i})]}),hn="_select_1dw63_1",mn={select:hn},ge=({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",pe={tabBar:pn,tabIndicator:gn,tabButton:vn,tabActive:_n};function fn({options:a,value:n,onChange:i,ariaLabel:t},r){const c=Y(null),s=Y(new Map),[b,g]=z({left:0,width:0}),v=D(l=>{const T=s.current.get(l),_=c.current;if(T&&_){const o=_.getBoundingClientRect(),k=T.getBoundingClientRect();g({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:pe.tabBar,ref:l=>{c.current=l,typeof r=="function"?r(l):r&&(r.current=l)},"aria-label":t,children:[e("div",{className:pe.tabIndicator,style:{left:b.left,width:b.width}}),a.map(l=>e(We,{ref:T=>{T&&s.current.set(l.value,T)},variant:"secondary",size:"sm",className:`${pe.tabButton} ${n===l.value?pe.tabActive:""}`,onClick:()=>i(l.value),children:l.label},l.value))]})}const ve=q.forwardRef(fn),bn=[{value:"popular",label:"Popular"},{value:"followed",label:"Most Followed"},{value:"rating",label:"Top Rated"}];function yn(){const{options:a}=bt();return Q(()=>a.filter(n=>n.kind==="manga").map(n=>n.value)[0]??"",[a])}const Be=({title:a,eyebrow:n,provider:i,sort:t,mature:r,headerActions:c})=>{const{toggle:s,bookmarkedIds:b}=Ge(),{popup:g,openPopup:v,scheduleClose:l,cancelClose:T,closePopup:_}=Fe(),{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=Q(()=>o?.pages.flatMap(N=>N.items)??[],[o]),L=D(()=>{d&&!h&&!k&&u()},[d,h,k,u]);return i?e(ie,{children:[e(ee,{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 $=we(N.provider,N.id);return e(_e,{item:{id:$,title:N.title,...qe(N),thumbnail:Ye(N.provider,N.cover),typeBadge:N.type||void 0,chapterBadge:N.latestChapter?`Ch. ${N.latestChapter}`:null,isAdult:Ue(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}`)})}),g&&e(Ve,{data:g.data,anchorRect:g.rect,bookmarked:b.has(we(g.data.provider,g.data.mangaId)),onToggleBookmark:()=>s({id:g.data.mangaId,provider:g.data.provider,title:g.data.title,cover:g.data.cover,altTitle:g.data.altTitle??void 0,contentRating:g.data.contentRating}),onMouseEnter:T,onMouseLeave:l,onRequestClose:_})]}):null},Nn=()=>{const a=yn(),{hasConsent:n}=yt(),[i,t]=le("manga_discover_tab","latest"),[r,c]=le("manga_trending_sort","popular");return a?e(ie,{children:[e(ve,{ariaLabel:"Discover manga",options:[{value:"latest",label:"Latest Releases"},{value:"trending",label:"Trending"}],value:i,onChange:t}),i==="latest"?e(Be,{title:"Latest Releases",eyebrow:"Fresh chapters",provider:a,sort:"latest",mature:n}):e(Be,{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=te(),{data:n,isLoading:i}=_t(24),[t,r]=z(null),{popup:c,openPopup:s,scheduleClose:b,cancelClose:g,closePopup:v}=Fe(),{toggle:l,bookmarkedIds:T}=Ge(),_=n?.data??[];return e("div",{style:{paddingBottom:"2rem"},children:[e(ee,{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(ye,{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(_e,{item:{id:o.id,title:o.title,...qe({title:o.title,altTitle:o.altTitle}),thumbnail:o.provider?Ye(o.provider,o.cover||""):o.cover||"",chapterBadge:o.chapterNumber?`Ch. ${o.chapterNumber}`:null,isAdult:Ue(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?g():b(),rawThumbnail:!0},o.id)})}),e(gt,{mangaId:t?t.libId:null,title:t?.title,onClose:()=>r(null)}),c&&c.data.provider&&e(Ve,{data:c.data,anchorRect:c.rect,bookmarked:T.has(we(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:g,onMouseLeave:b,onRequestClose:v}),e(Nn,{})]})},Sn="_seasonGrid_bt5c7_76",wn="_emptyState_bt5c7_108",G={"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=te(),{data:n,isLoading:i}=St(24),t=wt(),r=kt(),[c,s]=z(null),[b,g]=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??[];q.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}=He(u==="multi"?"all":u,L,1,C&&v==="trending"),{data:B,isLoading:W}=$e({type:u,sort_by:N[o]||"popularity.desc",page:1}),P=C?$?.results||[]:B?.results||[],x=C?I:W,{data:A,isLoading:K}=$e({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),g(!1))},S=D(p=>e(Nt,{item:{id:p.id,title:p.title,year:p.year,type:p.type,image:p.image,vote_average:p.vote_average,adult:p.adult}},`${p.type}-${p.id}`),[]),w=()=>{switch(v){case"latest":return e("section",{children:[e("div",{className:G["section-header"],children:[e("div",{className:G["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(ge,{ariaLabel:"Latest type",value:T,onChange:p=>_(p),options:[{value:"tv",label:"TV Shows"},{value:"movie",label:"Movies"}]})})]}),K?e("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(150px, 1fr))",gap:"var(--space-6)"},children:Array.from({length:7}).map((p,U)=>e("div",{className:"skeleton",style:{aspectRatio:"3 / 4",borderRadius:"var(--radius-lg)"}},U))}):H.length>0?e(ee,{carousel:!0,itemCount:H.length,children:H.map(S)}):e("div",{className:G.emptyState,children:e("p",{children:"No latest releases available right now."})})]});case"trending":return e("section",{children:[e("div",{className:G["section-header"],children:[e("div",{className:G["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(ge,{ariaLabel:"Trending sort",value:o,onChange:k,options:Cn.map(p=>({value:p.value,label:p.label}))}),e(ge,{ariaLabel:"Trending type",value:u,onChange:p=>d(p),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((p,U)=>e("div",{className:"skeleton",style:{aspectRatio:"3 / 4",borderRadius:"var(--radius-lg)"}},U))}):P.length>0?e(ee,{carousel:!0,itemCount:P.length,children:P.map(S)}):e("div",{className:G.emptyState,children:e("p",{children:"No trending content available right now."})})]})}};return e("div",{style:{paddingBottom:"2rem"},children:[e(ee,{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(ye,{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(p=>{const U=p.currentTime??0,V=p.duration??0,ce=p.season??p.lastSeason??1,j=p.episode??p.lastEpisode??1,X=p.mediaType==="movie",re=X?"Movie":`S${ce} E${j}`,Z=p.completed===!0||p.completed===1||V>0&&U>=V*.8,oe=Z?100:V>0&&U>0?U/V*100:0,de=Z?"Watched":V>0?X?`${ae(U)} / ${ae(V)}`:`${re} · ${ae(U)} / ${ae(V)}`:re;return e(_e,{item:{id:p.id,title:p.title,thumbnail:p.poster||"",typeBadge:X?"Movie":"TV",chapterBadge:re,isAdult:It({adult:p.adult===1})},linkTo:Ct(p.mediaType,p.tmdbId,X?void 0:ce,X?void 0:j),hoverIcon:"play",progress:(V>0||Z)&&oe>0?{percent:oe,label:de}:void 0,showProgress:!0,metaRow:p.year?e("span",{style:{opacity:.75},children:p.year}):void 0,onRemove:()=>s({libId:p.id,title:p.title}),renderPopup:(Ne,se)=>e(Tt,{item:{id:p.tmdbId??0,title:p.title||"",year:p.year||"",type:p.mediaType||"tv",image:p.poster||""},anchorRect:Ne,onMouseEnter:se.onMouseEnter,onMouseLeave:se.onMouseLeave,onRequestClose:se.close})},p.id)})}),e(ve,{ariaLabel:"Browse TV",options:kn,value:v,onChange:l}),e("div",{className:G.tabContent,children:w()}),e(Oe,{isOpen:!!c,itemName:c?.title,progressKind:"watch",listLabel:"my TV watchlist",alsoRemove:b,onAlsoRemoveChange:g,onClose:()=>{s(null),g(!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} · ${ae(n)} / ${ae(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=te(),{data:c,isLoading:s}=Lt(n),[b,g]=z(null),v=c?.data??[];return e(ie,{children:[e(ee,{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(ye,{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(_e,{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:()=>g({workId:l.id,title:l.title}),rawThumbnail:!0},l.id)})}),e(Rt,{workId:b?b.workId:null,title:b?.title,onClose:()=>g(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=te(),i=Q(()=>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(be,{slides:i})},Mn=({mangaList:a})=>{const n=te(),i=Q(()=>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(be,{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=te(),i=Q(()=>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(g=>!!g),tags:[],synopsis:t.description?.slice(0,160)||"",primaryLabel:"Listen Now",primaryIcon:"play",onPrimary:()=>n(s),onDetails:()=>n(s)}}),[a,n]);return e(be,{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]=q.useState(1),[t,r]=z(()=>localStorage.getItem("home_activeTab")||"latest"),[c,s]=z(()=>localStorage.getItem("season_format")||"TV"),b=Y(null),{data:g}=Le(n+1,c,t==="season"),{titlePreference:v}=ze(),{contentType:l,setContentType:T}=nt(),[_,o]=q.useState(null),[k,u]=q.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(),K=D(()=>{x&&!A&&!W&&P()},[x,A,W,P]),{data:H,isLoading:m}=ut(),{data:S,isLoading:w}=He("all","week",1,l==="tv"),{data:p,isLoading:U}=xt(l==="asmr"),{data:V,isLoading:ce}=ft(),j=Q(()=>B?.pages||[],[B]),{data:X,isLoading:re}=Le(n,c,t==="season"),Z=14,oe=X&&X.length>=Z&&g&&g.length>0,de=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&&j.length-1<14&&P()}}),Ne=D(R=>{const J=j?.find(Te=>String(Te.id)===String(R));if(J){const Te=J[v]||J.name;o({id:R,name:Te})}},[j,v]),se=D(()=>{_&&(de.mutate(_.id),k&&d.mutate(_.id),o(null),u(!1))},[_,de,d,k]),Ie=[{key:"latest",label:"Latest Releases"},{key:"season",label:"Current Season"},{key:"popular",label:"Trending"}],Ae=$!==void 0&&$.length>0,Qe=Ae?[{key:"week",label:"This Week"},...Ie]:Ie,Re=t==="week"&&!Ae?"latest":t,Xe=()=>{switch(Re){case"latest":return e(aa,{eyebrow:"Fresh episodes"});case"season":return e("section",{style:{marginBottom:"2.5rem"},children:[e("div",{className:G["section-header"],ref:b,children:[e("div",{className:G["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(ge,{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:G["pagination-controls"],children:[e("button",{className:G["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:G["page-info"],children:n}),e("button",{className:G["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:!oe,style:{opacity:oe?1:.3},"aria-label":"Next page",children:e(O,{name:"chevron-right",size:14})})]})]})]}),e("div",{className:`grid-container ${G.seasonGrid}`,style:{minHeight:"300px",alignContent:"start"},children:re?e(Ee,{count:Z}):X?.slice(0,Z).map(R=>e(ne,{anime:R},R._id))})]});case"popular":return e(Jt,{title:"Trending",eyebrow:"Discover"});case"week":return e(xe,{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(he,{}):H&&H.length>0&&e(sn,{animeList:H})),l==="tv"&&(w&&!S?.results?.length?e(he,{}):S?.results&&S.results.length>0&&e(xn,{items:S.results})),l==="manga"&&(ce&&!V?.length?e(he,{}):V&&V.length>0&&e(Mn,{mangaList:V})),l==="asmr"&&(U&&!p?.length?e(he,{}):p&&p.length>0&&e(Dn,{works:p})),e(ve,{ariaLabel:"Content type",options:zn,value:l,onChange:T}),l==="manga"?e(Tn,{}):l==="tv"?e(In,{}):l==="asmr"?e(Ln,{}):e(ie,{children:[e(xe,{title:"Continue Watching",eyebrow:"Pick up where you left off",titleLink:"/watchlist/Continue Watching",animeList:j,continueWatching:!0,carousel:!0,collapsible:!0,defaultExpanded:j.length>0,onRemove:Ne,loading:W,onReachThreshold:K,scrollThreshold:.7,isFetchingNextPage:A,emptyState:e(ye,{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(J=>({id:J.id,showId:J.showId,episodeNumber:J.episodeNumber})))}),e(ve,{ariaLabel:"Browse anime",options:Qe.map(R=>({value:R.key,label:R.label})),value:Re,onChange:r}),e("div",{className:G.tabContent,children:Xe()}),e(wa,{eyebrow:"Never miss an episode"}),e(Oe,{isOpen:!!_,itemName:_?.name,progressKind:"watch",listLabel:"my watchlist",alsoRemove:k,onAlsoRemoveChange:u,onClose:()=>{o(null),u(!1)},onConfirm:se})]})]})};export{cr as default};
@@ -1 +0,0 @@
1
- ._header_1d4ig_1{display:flex;justify-content:space-between;align-items:center;margin-bottom:var(--space-8);animation:_fadeIn_1d4ig_1 .8s var(--ease-smooth)}._personaBadge_1d4ig_9{display:flex;align-items:center;gap:var(--space-4);background:var(--glass-bg);backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px);color:var(--accent-light);padding:var(--space-3) var(--space-6);border-radius:var(--radius-lg);font-weight:700;border:1px solid var(--border-accent);box-shadow:var(--glass-shadow);cursor:default;transition:all var(--transition-base)}._personaBadge_1d4ig_9:hover{transform:translateY(-2px);border-color:var(--accent);box-shadow:0 0 20px var(--accent-glow)}._personaBadge_1d4ig_9 svg{font-size:1.5rem;color:var(--accent)}._personaInfo_1d4ig_37{display:flex;flex-direction:column}._personaLabel_1d4ig_42{font-size:.72rem;text-transform:uppercase;letter-spacing:1.5px;color:var(--text-tertiary);margin-bottom:2px;font-weight:800}._personaValue_1d4ig_51{font-size:1.1rem;color:var(--text-primary);letter-spacing:-.01em}._statsGrid_1d4ig_57{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:var(--space-6);margin-bottom:var(--space-10);animation:_slideUpIn_1d4ig_1 .8s var(--ease-smooth)}._statCard_1d4ig_65{background:var(--glass-bg);border:1px solid var(--border-primary);border-radius:var(--radius-xl);padding:var(--space-6);display:flex;align-items:center;gap:var(--space-5);transition:all var(--transition-base)}._statCard_1d4ig_65:hover{transform:translateY(-5px);border-color:var(--border-accent);background:var(--bg-tertiary)}._statIcon_1d4ig_82{width:54px;height:54px;border-radius:var(--radius-lg);display:flex;align-items:center;justify-content:center;font-size:1.5rem;flex-shrink:0;transition:transform var(--transition-base)}._statCard_1d4ig_65:hover ._statIcon_1d4ig_82{transform:scale(1.1) rotate(-5deg)}._statInfo_1d4ig_98{display:flex;flex-direction:column}._statValue_1d4ig_103{font-size:1.75rem;font-weight:800;color:var(--text-primary);line-height:1;margin-bottom:4px;letter-spacing:-.02em}._statLabel_1d4ig_112{color:var(--text-tertiary);font-size:.75rem;font-weight:700;text-transform:uppercase;letter-spacing:1px}._wideSection_1d4ig_120{background:var(--glass-bg);backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px);border:1px solid var(--glass-border);border-radius:var(--radius-xl);padding:var(--space-8);margin-bottom:var(--space-10);box-shadow:var(--glass-shadow);animation:_slideUpIn_1d4ig_1 .8s var(--ease-smooth) .1s both}._sectionHeader_1d4ig_132{display:flex;justify-content:space-between;align-items:center;margin-bottom:var(--space-8);gap:var(--space-4)}._sectionHeader_1d4ig_132 h3{font-size:1.5rem;font-weight:800;color:var(--text-primary);letter-spacing:-.02em}._yearSelect_1d4ig_147{width:130px;height:44px;padding:0 var(--space-4);background:var(--bg-tertiary);color:var(--text-primary);border:1px solid var(--border-primary);border-radius:var(--radius-lg);font-size:var(--font-size-sm);font-weight:600;cursor:pointer;appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%2371717a' stroke-width='2' viewBox='0 0 12 12'%3E%3Cpolyline points='3 5 6 8 9 5'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 1rem center;transition:all var(--transition-fast)}._yearSelect_1d4ig_147:hover{border-color:var(--border-secondary);background-color:var(--bg-elevated)}._yearSelect_1d4ig_147:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-glow)}._heatmapLayout_1d4ig_176{display:flex;gap:var(--space-8);align-items:flex-start;justify-content:center}._dayLabels_1d4ig_183{display:grid;grid-template-rows:repeat(7,14px);gap:4px;font-size:.75rem;color:var(--text-tertiary);align-items:center;padding-right:6px;margin-top:24px;font-weight:700}._heatmapWrapper_1d4ig_195{overflow-x:auto;padding:var(--space-2) var(--space-3);max-width:100%}._heatmapMonthLabels_1d4ig_201{display:grid;grid-auto-flow:column;grid-auto-columns:18px;margin-bottom:8px;font-size:.7rem;color:var(--text-tertiary);font-weight:700;text-transform:uppercase}._heatmapGrid_1d4ig_212{display:grid;grid-auto-flow:column;grid-template-rows:repeat(7,14px);gap:4px;width:fit-content}._heatBox_1d4ig_220{width:14px;height:14px;border-radius:3px;background:var(--bg-tertiary);border:1px solid var(--border-primary);transition:all .15s ease}._heatBox_1d4ig_220._hiddenBox_1d4ig_229{opacity:0;pointer-events:none}._heatBox_1d4ig_220:hover{transform:scale(1.6);z-index:10;border-color:var(--accent)}._level0_1d4ig_240{background:var(--bg-tertiary)}._level1_1d4ig_243{background:color-mix(in srgb,var(--accent) 25%,transparent);border-color:color-mix(in srgb,var(--accent) 30%,transparent)}._level2_1d4ig_247{background:color-mix(in srgb,var(--accent) 50%,transparent);border-color:color-mix(in srgb,var(--accent) 55%,transparent)}._level3_1d4ig_251{background:color-mix(in srgb,var(--accent) 75%,transparent);border-color:color-mix(in srgb,var(--accent) 80%,transparent)}._level4_1d4ig_255{background:var(--accent);border-color:var(--accent-light)}._heatmapFooter_1d4ig_260{display:flex;justify-content:flex-end;margin-top:var(--space-6);padding-right:var(--space-2)}._heatLegend_1d4ig_267{display:flex;align-items:center;gap:6px;font-size:.7rem;color:var(--text-tertiary);font-weight:700;text-transform:uppercase}._chartsContainer_1d4ig_277{display:grid;grid-template-columns:repeat(auto-fit,minmax(400px,1fr));gap:var(--space-8);margin-bottom:var(--space-10);animation:_slideUpIn_1d4ig_1 .8s var(--ease-smooth) .2s both}._chartWrapper_1d4ig_285{background:var(--glass-bg);backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px);border:1px solid var(--glass-border);border-radius:var(--radius-xl);padding:var(--space-8);display:flex;flex-direction:column;box-shadow:var(--glass-shadow);transition:transform var(--transition-base)}._chartWrapper_1d4ig_285:hover{transform:translateY(-4px)}._chartWrapper_1d4ig_285 h3{margin-bottom:var(--space-8);font-size:1.25rem;font-weight:800;color:var(--text-primary);border-left:4px solid var(--accent);padding-left:var(--space-4);letter-spacing:-.01em}._hourlyChart_1d4ig_312{display:flex;align-items:flex-end;height:160px;gap:2px;padding-top:var(--space-4)}._hourlyBarContainer_1d4ig_320{flex:1;display:flex;flex-direction:column;align-items:center;height:100%;min-width:0}._hourlyBar_1d4ig_320{width:100%;max-width:12px;background:linear-gradient(to top,var(--accent),var(--accent-light));border-radius:4px 4px 2px 2px;opacity:.7;transition:all var(--transition-fast);min-height:4px}._hourlyBar_1d4ig_320:hover{opacity:1;transform:scaleY(1.05);filter:brightness(1.2);box-shadow:0 0 10px var(--accent-glow)}._hourlyLabel_1d4ig_346{font-size:.75rem;color:var(--text-tertiary);margin-top:8px;font-weight:700}._chartSubtext_1d4ig_353{margin-top:var(--space-8);padding:var(--space-4);background:var(--accent-subtle);border:1px solid var(--border-accent);border-radius:var(--radius-lg);font-size:.9rem;color:var(--accent-light);font-weight:600;text-align:center}._popScale_1d4ig_365{padding:var(--space-8) 0}._popTrack_1d4ig_369{height:14px;background:linear-gradient(to right,var(--accent-dark),var(--accent),var(--accent-light));border-radius:var(--radius-full);position:relative;margin-bottom:var(--space-6)}._popThumb_1d4ig_377{width:26px;height:26px;background:#fff;border:4px solid var(--bg-secondary);border-radius:50%;position:absolute;top:50%;transform:translate(-50%,-50%);transition:left 1s var(--ease-spring)}._popLabels_1d4ig_389{display:flex;justify-content:space-between;font-size:.78rem;font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:var(--text-secondary)}._popDescription_1d4ig_399{font-size:.95rem;color:var(--text-secondary);line-height:1.6;background:var(--bg-secondary);padding:var(--space-5);border-radius:var(--radius-lg);border:1px solid var(--border-primary)}._popDescription_1d4ig_399 strong{color:var(--text-primary);font-weight:800}._seasonalChart_1d4ig_414{display:flex;align-items:flex-end;height:160px;gap:8px;padding-top:var(--space-4)}._seasonalBarContainer_1d4ig_422{flex:1;display:flex;flex-direction:column;align-items:center;height:100%;min-width:0}._seasonalBar_1d4ig_422{width:100%;background:var(--accent);border-radius:6px 6px 2px 2px;opacity:.8;transition:all var(--transition-fast)}._seasonalBar_1d4ig_422:hover{opacity:1;transform:scaleY(1.03)}._seasonalLabel_1d4ig_444{font-size:.75rem;color:var(--text-tertiary);margin-top:10px;font-weight:700;text-transform:uppercase}._genreList_1d4ig_452{display:flex;flex-direction:column;gap:var(--space-6);padding-top:var(--space-2)}._genreRow_1d4ig_459{display:flex;flex-direction:column;gap:var(--space-2)}._genreInfo_1d4ig_465{display:flex;justify-content:space-between;align-items:center;margin-bottom:2px}._genreName_1d4ig_472{font-weight:800;font-size:1rem;color:var(--text-primary);letter-spacing:-.01em}._genreCount_1d4ig_479{font-size:.8rem;color:var(--text-tertiary);font-weight:700;text-transform:uppercase}._genreBarBg_1d4ig_486{height:12px;background:var(--bg-tertiary);border-radius:var(--radius-full);overflow:hidden}._genreBar_1d4ig_486{height:100%;border-radius:var(--radius-full);transition:width 1.5s var(--ease-smooth)}._warningSection_1d4ig_499{background:color-mix(in srgb,var(--color-danger) 3%,transparent);backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px);border:1px solid color-mix(in srgb,var(--color-danger) 20%,transparent);border-radius:var(--radius-xl);padding:var(--space-10);box-shadow:0 20px 50px -20px color-mix(in srgb,var(--color-danger) 15%,transparent);animation:_slideUpIn_1d4ig_1 .8s var(--ease-smooth) .3s both}._warningHeader_1d4ig_510{display:flex;align-items:center;gap:var(--space-4);margin-bottom:var(--space-8);color:var(--color-danger)}._warningHeader_1d4ig_510 h3{font-size:1.5rem;font-weight:800;margin:0;letter-spacing:-.03em;text-transform:uppercase}._droppedGrid_1d4ig_526{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:var(--space-5)}._droppedCard_1d4ig_532{background:var(--bg-secondary);border:1px solid var(--border-primary);padding:var(--space-6);border-radius:var(--radius-lg);display:flex;flex-direction:column;gap:8px;transition:all var(--transition-base)}._droppedCard_1d4ig_532:hover{transform:translateY(-4px) scale(1.02);background:var(--bg-tertiary);border-color:var(--border-secondary)}._droppedName_1d4ig_549{font-weight:800;color:var(--text-primary);font-size:1.1rem;letter-spacing:-.01em}._droppedDate_1d4ig_556{font-size:.85rem;color:var(--text-tertiary);font-weight:600}@keyframes _fadeIn_1d4ig_1{0%{opacity:0}to{opacity:1}}@keyframes _slideUpIn_1d4ig_1{0%{opacity:0;transform:translateY(30px)}to{opacity:1;transform:translateY(0)}}@media(max-width:768px){._header_1d4ig_1{flex-direction:column;align-items:flex-start;gap:var(--space-6)}._statsGrid_1d4ig_57,._chartsContainer_1d4ig_277{grid-template-columns:1fr}._heatmapLayout_1d4ig_176{flex-direction:column-reverse}._genreGrid_1d4ig_597{grid-template-columns:1fr}}._genreGrid_1d4ig_597{display:grid;grid-template-columns:repeat(auto-fill,minmax(360px,1fr));gap:1.5rem;margin-bottom:var(--space-10)}._genreCard_1d4ig_609{background:var(--glass-bg);border:1px solid var(--glass-border);border-radius:var(--radius-xl);padding:1.5rem;position:relative;box-shadow:var(--glass-shadow)}._rankBadge_1d4ig_618{position:absolute;top:1rem;right:1rem;width:32px;height:32px;border-radius:50%;background:var(--accent);display:flex;align-items:center;justify-content:center}._rankNumber_1d4ig_631{color:var(--accent-text);font-weight:700;font-size:1.1rem}._genreTitle_1d4ig_637{font-size:1.25rem;font-weight:800;color:var(--text-primary);margin-bottom:.75rem;letter-spacing:-.01em}._genreStats_1d4ig_645{display:flex;gap:1rem;margin-bottom:1rem;font-size:.85rem;color:var(--text-secondary)}._posterRow_1d4ig_653{display:grid;grid-template-columns:repeat(4,1fr);gap:.5rem;margin-top:.5rem}._miniPoster_1d4ig_660{aspect-ratio:2/3;width:100%;border-radius:var(--radius-sm);object-fit:cover;border:1px solid var(--border-primary);transition:transform var(--transition-fast)}._miniPoster_1d4ig_660:hover{transform:scale(1.05);border-color:var(--accent)}._genreCardSkeleton_1d4ig_674{background:var(--glass-bg);border:1px solid var(--glass-border);border-radius:var(--radius-xl);padding:1.5rem;animation:_pulse_1d4ig_1 1.5s ease-in-out infinite}._skeletonRank_1d4ig_682{width:32px;height:32px;background:linear-gradient(90deg,#ffffff1a 25%,#fff3,#ffffff1a 75%);border-radius:50%;margin-bottom:.5rem}._skeletonTitle_1d4ig_696{height:1.25rem;width:60%;background:linear-gradient(90deg,#ffffff1a 25%,#fff3,#ffffff1a 75%);border-radius:4px;margin-bottom:.75rem}._skeletonStats_1d4ig_709{height:1rem;background:linear-gradient(90deg,#ffffff1a 25%,#fff3,#ffffff1a 75%);border-radius:4px;margin-bottom:1rem}._skeletonPosters_1d4ig_721{display:grid;grid-template-columns:repeat(4,1fr);gap:.5rem}._skeletonPosters_1d4ig_721:before{content:"";display:block;height:100%;background:linear-gradient(90deg,#ffffff1a 25%,#fff3,#ffffff1a 75%);border-radius:4px}@keyframes _pulse_1d4ig_1{0%{opacity:.6}50%{opacity:1}to{opacity:.6}}
@@ -1 +0,0 @@
1
- import{h as I,d as D,T as p,u as e}from"./vendor-core-8R2fFbyN.js";import{b as x}from"./vendor-query-BXRECSI6.js";import{I as l}from"./vendor-icons-CDMuNDeL.js";import{X as $,d as R,f as T}from"./index-lo-bz7f2.js";const G="_header_1d4ig_1",M="_fadeIn_1d4ig_1",W="_personaBadge_1d4ig_9",O="_personaInfo_1d4ig_37",V="_personaLabel_1d4ig_42",F="_personaValue_1d4ig_51",Y="_statsGrid_1d4ig_57",P="_slideUpIn_1d4ig_1",A="_statCard_1d4ig_65",H="_statIcon_1d4ig_82",E="_statInfo_1d4ig_98",U="_statValue_1d4ig_103",q="_statLabel_1d4ig_112",z="_wideSection_1d4ig_120",j="_sectionHeader_1d4ig_132",K="_yearSelect_1d4ig_147",Q="_heatmapLayout_1d4ig_176",X="_dayLabels_1d4ig_183",J="_heatmapWrapper_1d4ig_195",Z="_heatmapMonthLabels_1d4ig_201",ee="_heatmapGrid_1d4ig_212",ae="_heatBox_1d4ig_220",te="_hiddenBox_1d4ig_229",se="_level0_1d4ig_240",ne="_level1_1d4ig_243",re="_level2_1d4ig_247",ie="_level3_1d4ig_251",le="_level4_1d4ig_255",oe="_heatmapFooter_1d4ig_260",ce="_heatLegend_1d4ig_267",de="_chartsContainer_1d4ig_277",he="_chartWrapper_1d4ig_285",pe="_hourlyChart_1d4ig_312",ge="_hourlyBarContainer_1d4ig_320",me="_hourlyBar_1d4ig_320",_e="_hourlyLabel_1d4ig_346",ue="_chartSubtext_1d4ig_353",ve="_popScale_1d4ig_365",Ne="_popTrack_1d4ig_369",ye="_popThumb_1d4ig_377",be="_popLabels_1d4ig_389",fe="_popDescription_1d4ig_399",Se="_seasonalChart_1d4ig_414",Ce="_seasonalBarContainer_1d4ig_422",ke="_seasonalBar_1d4ig_422",Le="_seasonalLabel_1d4ig_444",Be="_genreList_1d4ig_452",we="_genreRow_1d4ig_459",Ie="_genreInfo_1d4ig_465",De="_genreName_1d4ig_472",xe="_genreCount_1d4ig_479",$e="_genreBarBg_1d4ig_486",Re="_genreBar_1d4ig_486",Te="_warningSection_1d4ig_499",Ge="_warningHeader_1d4ig_510",Me="_droppedGrid_1d4ig_526",We="_droppedCard_1d4ig_532",Oe="_droppedName_1d4ig_549",Ve="_droppedDate_1d4ig_556",Fe="_genreGrid_1d4ig_597",Ye="_genreCard_1d4ig_609",Pe="_rankBadge_1d4ig_618",Ae="_rankNumber_1d4ig_631",He="_genreTitle_1d4ig_637",Ee="_genreStats_1d4ig_645",Ue="_posterRow_1d4ig_653",qe="_miniPoster_1d4ig_660",ze="_genreCardSkeleton_1d4ig_674",je="_pulse_1d4ig_1",Ke="_skeletonRank_1d4ig_682",Qe="_skeletonTitle_1d4ig_696",Xe="_skeletonStats_1d4ig_709",Je="_skeletonPosters_1d4ig_721",a={header:G,fadeIn:M,personaBadge:W,personaInfo:O,personaLabel:V,personaValue:F,statsGrid:Y,slideUpIn:P,statCard:A,statIcon:H,statInfo:E,statValue:U,statLabel:q,wideSection:z,sectionHeader:j,yearSelect:K,heatmapLayout:Q,dayLabels:X,heatmapWrapper:J,heatmapMonthLabels:Z,heatmapGrid:ee,heatBox:ae,hiddenBox:te,level0:se,level1:ne,level2:re,level3:ie,level4:le,heatmapFooter:oe,heatLegend:ce,chartsContainer:de,chartWrapper:he,hourlyChart:pe,hourlyBarContainer:ge,hourlyBar:me,hourlyLabel:_e,chartSubtext:ue,popScale:ve,popTrack:Ne,popThumb:ye,popLabels:be,popDescription:fe,seasonalChart:Se,seasonalBarContainer:Ce,seasonalBar:ke,seasonalLabel:Le,genreList:Be,genreRow:we,genreInfo:Ie,genreName:De,genreCount:xe,genreBarBg:$e,genreBar:Re,warningSection:Te,warningHeader:Ge,droppedGrid:Me,droppedCard:We,droppedName:Oe,droppedDate:Ve,genreGrid:Fe,genreCard:Ye,rankBadge:Pe,rankNumber:Ae,genreTitle:He,genreStats:Ee,posterRow:Ue,miniPoster:qe,genreCardSkeleton:ze,pulse:je,skeletonRank:Ke,skeletonTitle:Qe,skeletonStats:Xe,skeletonPosters:Je},sa=()=>{I(()=>{document.title="Insights - dango"},[]);const{data:s,isLoading:N,isError:y}=x({queryKey:["insights"],queryFn:async()=>{const t=await fetch("/api/insights");if(!t.ok)throw new Error("Failed to fetch insights");return t.json()}}),{data:b,isLoading:g}=$(),{titlePreference:f}=R(),m=t=>{switch(f){case"nativeName":return t.nativeName||t.name;case"englishName":return t.englishName||t.name;default:return t.name}},[c,S]=D(new Date().getFullYear()),C=p(()=>{if(!s?.activityGrid)return[new Date().getFullYear()];const t=new Set(s.activityGrid.map(n=>parseInt(n.day.split("-")[0])));return t.add(new Date().getFullYear()),Array.from(t).sort((n,r)=>r-n)},[s]),_=p(()=>{if(!s?.activityGrid)return[];const t=new Map(s.activityGrid.map(h=>[h.day,h.count])),n=[],r=new Date(c,0,1),o=new Date(c,11,31),d=r.getDay(),i=new Date(r);for(i.setDate(i.getDate()-d);(i<=o||i.getDay()!==0)&&!(i>o&&i.getDay()===0);){const h=i.getFullYear(),B=String(i.getMonth()+1).padStart(2,"0"),w=String(i.getDate()).padStart(2,"0"),u=`${h}-${B}-${w}`,v=i<r||i>o;n.push({date:u,count:v?0:t.get(u)||0,month:i.getMonth(),isOutOfRange:v}),i.setDate(i.getDate()+1)}return n},[s,c]),k=p(()=>s?.seasonality?.length?Math.max(...s.seasonality.map(t=>t.seconds),1):0,[s]),L=p(()=>s?.hourlyDist?.length?Math.max(...s.hourlyDist.map(t=>t.count),1):0,[s]);return N||g?e("div",{className:a.loading,children:"Analyzing your anime lifestyle..."}):y?e("div",{className:a.error,children:"Could not load insights. Data might be syncing."}):s?e("div",{className:"page-container",children:[e("div",{className:a.header,children:[e("h2",{className:"section-title",children:"Watch Insights"}),e("div",{className:a.personaBadge,children:[e(l,{name:"user-astronaut"}),e("div",{className:a.personaInfo,children:[e("span",{className:a.personaLabel,children:"Your Persona"}),e("span",{className:a.personaValue,children:s.persona})]})]})]}),e("div",{className:a.statsGrid,children:[e("div",{className:a.statCard,children:[e("div",{className:a.statIcon,style:{background:"rgba(138, 79, 255, 0.2)",color:"var(--accent)"},children:e(l,{name:"clock"})}),e("div",{className:a.statInfo,children:[e("span",{className:a.statValue,children:[s.totalHours,"h"]}),e("span",{className:a.statLabel,children:"Watch Time"})]})]}),e("div",{className:a.statCard,children:[e("div",{className:a.statIcon,style:{background:"rgba(167, 139, 250, 0.2)",color:"#a78bfa"},children:e(l,{name:"bookmark"})}),e("div",{className:a.statInfo,children:[e("span",{className:a.statValue,children:s.totalAnime}),e("span",{className:a.statLabel,children:"Total Anime"})]})]}),e("div",{className:a.statCard,children:[e("div",{className:a.statIcon,style:{background:"rgba(34, 197, 94, 0.2)",color:"#22c55e"},children:e(l,{name:"check-circle"})}),e("div",{className:a.statInfo,children:[e("span",{className:a.statValue,children:s.totalEpisodes}),e("span",{className:a.statLabel,children:"Episodes Watched"})]})]}),e("div",{className:a.statCard,children:[e("div",{className:a.statIcon,style:{background:"rgba(34, 197, 94, 0.2)",color:"#22c55e"},children:e(l,{name:"check-circle"})}),e("div",{className:a.statInfo,children:[e("span",{className:a.statValue,children:[s.completionRate,"%"]}),e("span",{className:a.statLabel,children:"Completion Rate"})]})]}),e("div",{className:a.statCard,children:[e("div",{className:a.statIcon,style:{background:"rgba(45, 212, 191, 0.2)",color:"#2dd4bf"},children:e(l,{name:"tv"})}),e("div",{className:a.statInfo,children:[e("span",{className:a.statValue,children:s.completedAnime}),e("span",{className:a.statLabel,children:"Completed Shows"})]})]}),e("div",{className:a.statCard,children:[e("div",{className:a.statIcon,style:{background:"rgba(239, 68, 68, 0.2)",color:"#ef4444"},children:e(l,{name:"fire"})}),e("div",{className:a.statInfo,children:[e("span",{className:a.statValue,children:s.bingeFactor}),e("span",{className:a.statLabel,children:"Max Daily Binge"})]})]}),e("div",{className:a.statCard,children:[e("div",{className:a.statIcon,style:{background:"rgba(59, 130, 246, 0.2)",color:"#3b82f6"},children:e(l,{name:"history"})}),e("div",{className:a.statInfo,children:[e("span",{className:a.statValue,children:[s.avgSessionMinutes,"m"]}),e("span",{className:a.statLabel,children:"Avg. Session"})]})]}),e("div",{className:a.statCard,children:[e("div",{className:a.statIcon,style:{background:"rgba(251, 191, 36, 0.2)",color:"#fbbf24"},children:e(l,{name:"layer-group"})}),e("div",{className:a.statInfo,children:[e("span",{className:a.statValue,children:[s.avgCompletionDays,"d"]}),e("span",{className:a.statLabel,children:"Avg. Speed"})]})]})]}),e("div",{className:a.wideSection,children:[e("div",{className:a.sectionHeader,children:[e("h3",{children:"Activity"}),e("select",{className:a.yearSelect,value:c,onChange:t=>S(Number(t.currentTarget.value)),children:C.map(t=>e("option",{value:t,children:t},t))})]}),e("div",{className:a.heatmapLayout,children:[e("div",{className:a.dayLabels,children:[e("span",{style:{gridRow:2},children:"Mon"}),e("span",{style:{gridRow:4},children:"Wed"}),e("span",{style:{gridRow:6},children:"Fri"})]}),e("div",{className:a.heatmapWrapper,children:[e("div",{className:a.heatmapMonthLabels,children:(()=>{const t=[];let n=-1;return _.forEach((r,o)=>{if(r.month!==n&&!r.isOutOfRange){const d=Math.floor(o/7)+1;d>(t.length>0?t[t.length-1].props.style.gridColumn+2:-1)&&(t.push(e("span",{style:{gridColumn:d,whiteSpace:"nowrap"},children:new Date(0,r.month).toLocaleString("default",{month:"short"})},o)),n=r.month)}}),t})()}),e("div",{className:a.heatmapGrid,children:_.map((t,n)=>{let r=0;return t.count>0&&!t.isOutOfRange&&(r=1),t.count>2&&!t.isOutOfRange&&(r=2),t.count>5&&!t.isOutOfRange&&(r=3),t.count>10&&!t.isOutOfRange&&(r=4),e("div",{className:`${a.heatBox} ${a[`level${r}`]} ${t.isOutOfRange?a.hiddenBox:""}`,title:t.isOutOfRange?"":`${t.count} episodes on ${t.date}`},n)})}),e("div",{className:a.heatmapFooter,children:e("div",{className:a.heatLegend,children:[e("span",{children:"Less"}),e("div",{className:`${a.heatBox} ${a.level0}`}),e("div",{className:`${a.heatBox} ${a.level1}`}),e("div",{className:`${a.heatBox} ${a.level2}`}),e("div",{className:`${a.heatBox} ${a.level3}`}),e("div",{className:`${a.heatBox} ${a.level4}`}),e("span",{children:"More"})]})})]})]})]}),e("div",{className:a.chartsContainer,children:[e("div",{className:a.chartWrapper,children:[e("h3",{children:"Time Distribution (24h)"}),e("div",{className:a.hourlyChart,children:s.hourlyDist?.map((t,n)=>e("div",{className:a.hourlyBarContainer,children:[e("div",{className:a.hourlyBar,style:{height:`${t.count/L*100||2}%`,width:"100%",maxWidth:"12px"},title:`${t.count} watches at ${t.hour}:00`}),e("span",{className:a.hourlyLabel,style:{visibility:n%4===0?"visible":"hidden"},children:t.hour})]},n))}),e("div",{className:a.chartSubtext,children:(()=>{if(!s.hourlyDist?.length)return"Watch more to see your peak hours!";const t=parseInt([...s.hourlyDist].sort((n,r)=>r.count-n.count)[0].hour);return t>=6&&t<19?"You prefer daytime watching ☀️":"You're a confirmed Night Owl 🦉"})()})]}),e("div",{className:a.chartWrapper,children:[e("h3",{children:"Popularity Bias"}),e("div",{className:a.popScale,children:[e("div",{className:a.popTrack,children:e("div",{className:a.popThumb,style:{left:`${Math.max(0,Math.min(100,100-s.popularityScore*10))}%`}})}),e("div",{className:a.popLabels,children:[e("span",{children:"Mainstream"}),e("span",{children:"Underground"})]})]}),e("p",{className:a.popDescription,children:["Your taste score is ",e("strong",{children:[s.popularityScore,"/10"]}),".",s.popularityScore>=5?" You follow the big hits!":" You're a connoisseur of the obscure!"]})]}),e("div",{className:a.chartWrapper,children:[e("h3",{children:"Monthly Activity"}),e("div",{className:a.seasonalChart,children:s.seasonality?.map((t,n)=>e("div",{className:a.seasonalBarContainer,children:[e("div",{className:a.seasonalBar,style:{height:`${t.seconds/k*100||5}%`,width:"100%",maxWidth:"24px"},title:`${Math.round(t.seconds/3600)}h in ${new Date(0,n).toLocaleString("default",{month:"long"})}`}),e("span",{className:a.seasonalLabel,children:new Date(0,n).toLocaleString("default",{month:"short"})})]},n))})]})]}),e("div",{className:a.genreGrid,children:g?Array.from({length:4}).map((t,n)=>e("div",{className:a.genreCardSkeleton,children:[e("div",{className:a.skeletonRank}),e("div",{className:a.skeletonTitle}),e("div",{className:a.skeletonStats}),e("div",{className:a.skeletonPosters})]},n)):b?.map(t=>e("div",{className:a.genreCard,children:[e("div",{className:a.rankBadge,children:e("span",{className:a.rankNumber,children:t.rank})}),e("h3",{className:a.genreTitle,children:t.name}),e("div",{className:a.genreStats,children:[e("span",{children:[t.count," episodes"]}),e("span",{children:[t.meanScore.toFixed(1)," avg score"]}),e("span",{children:t.timeWatched})]}),e("div",{className:a.posterRow,children:t.topShows.map(n=>e("img",{src:T(n.thumbnail),alt:m(n),className:a.miniPoster,title:m(n),loading:"lazy",decoding:"async"},n.id))})]},t.name))}),s.droppedShows?.length>0&&e("div",{className:a.warningSection,children:[e("div",{className:a.warningHeader,children:[e(l,{name:"exclamation-triangle"}),e("h3",{children:"Dusty Watchlist (Inactive 90+ days)"})]}),e("div",{className:a.droppedGrid,children:s.droppedShows.map(t=>e("div",{className:a.droppedCard,children:[e("span",{className:a.droppedName,children:t.name}),e("span",{className:a.droppedDate,children:["Last watched: ",new Date(t.lastActivity).toLocaleDateString()]})]},t.id))})]})]}):null};export{sa as default};
@@ -1 +0,0 @@
1
- import{a as ie,d as f,h as ce,u as e}from"./vendor-core-8R2fFbyN.js";import{I as i}from"./vendor-icons-CDMuNDeL.js";import{S as re}from"./SkeletonGrid-Du10CNfq.js";import{E as de}from"./ErrorMessage-z4f4WGgP.js";import{w as oe,x as me,M as B,B as q}from"./index-lo-bz7f2.js";import{s as l}from"./Watchlist.module-XGtVQr1d.js";function fe({headerTitle:G,headerSubtitle:H,filters:O,filterBy:o,filterBasePath:U,continueFilter:V,statusOptions:$,entries:m,total:b,isLoading:h,error:I,page:c,pageSize:z,onPageChange:p,emptyTitle:W,emptyFilteredText:Y,emptyAllText:j,browseLabel:F,browseTarget:J,removeListLabel:A,listNoun:S,skipConfirmKey:w,onBulkStatus:Q,onBulkRemove:x,onStatusChange:X,onRemoveItem:M,renderCard:Z,modals:_}){const R=ie(),[g,T]=f(!1),[s,d]=f(new Set),[t,v]=f(null),[y,k]=f(!1),{data:P}=oe(w),K=me();ce(()=>{d(new Set),T(!1)},[o]);const u=o===V,D=String(P)==="true"||String(P)==="1",L=()=>{T(a=>(a&&d(new Set),!a))},ee=a=>{d(n=>{const r=new Set(n);return r.has(a)?r.delete(a):r.add(a),r})},N=m.map(a=>a.libId),C=N.length>0&&N.every(a=>s.has(a)),ae=()=>{d(a=>{const n=new Set(a);if(C)for(const r of N)n.delete(r);else for(const r of N)n.add(r);return n})},le=a=>{s.size!==0&&(Q([...s],a),d(new Set))},se=()=>{s.size!==0&&(u||D?(x([...s]),d(new Set)):v({ids:[...s]}))},ne=a=>{u||D?M(a.libId):v({ids:[a.libId],title:a.title})},te=()=>{t&&(y&&K.mutate({key:w,value:!0}),t.ids.length===1?M(t.ids[0]):x(t.ids),d(new Set),v(null),k(!1))},E=()=>{v(null),k(!1)};return e("div",{className:"page-container",children:[e("header",{className:l.header,children:[e("h2",{className:l.title,children:G}),e("p",{className:l.subtitle,children:H})]}),e("div",{className:l.controls,children:e("div",{className:l.filters,children:O.map(a=>e("button",{className:`${l.filterBtn} ${o===a?l.active:""}`,onClick:()=>R(`${U}/${a==="All"?"":a}`),children:a},a))})}),e("div",{className:l.resultsHeader,children:[e("h3",{className:l.resultsTitle,children:[o,e("span",{className:l.itemCount,children:["(",b," items)"]})]}),e("div",{className:l.headerActions,children:[e("button",{className:`${l.manageBtn} ${g?l.active:""}`,onClick:L,children:[e(i,{name:"pencil-alt",size:13}),e("span",{children:"Bulk Manage"})]}),b>0&&e("div",{className:l.pagination,children:[e("button",{className:l.pageBtn,onClick:()=>p(Math.max(1,c-1)),disabled:c===1||h,"aria-label":"Previous page",children:e(i,{name:"chevron-left",size:14})}),e("span",{className:l.pageInfo,children:["Page ",e("strong",{children:c})]}),e("button",{className:l.pageBtn,onClick:()=>p(c+1),disabled:m.length<z||h,"aria-label":"Next page",children:e(i,{name:"chevron-right",size:14})})]})]})]}),g&&e("div",{className:l.manageBar,children:[e("button",{className:l.selectAllBtn,onClick:ae,children:[e("span",{className:`${l.selectAllBox} ${C?l.selectAllBoxChecked:""}`,"aria-hidden":"true"}),e("span",{children:C?"Clear Page":"Select All"})]}),e("span",{className:l.manageCount,children:[s.size," selected"]}),e("div",{className:l.manageSpacer}),!u&&e("select",{className:l.manageStatusSelect,value:"",onChange:a=>{a.currentTarget.value&&le(a.currentTarget.value)},disabled:s.size===0,title:"Set status for selected items",children:[e("option",{value:"",children:"Set status…"}),$.map(a=>e("option",{value:a,children:a},a))]}),e("button",{className:l.manageRemoveBtn,onClick:se,disabled:s.size===0,children:[e(i,{name:"trash",size:13}),e("span",{children:u?"Reset Selected":"Remove Selected"})]})]}),h?e(re,{}):I?e(de,{message:I.message}):m.length===0?e("div",{className:l.emptyState,children:[e("h3",{className:l.emptyTitle,children:W}),e("p",{className:l.emptyText,children:o!=="All"?Y:j}),e("button",{className:l.emptyBtn,onClick:()=>R(J),children:[e(i,{name:"search",size:14}),e("span",{children:F})]})]}):e("div",{className:l.grid,children:m.map(a=>e("div",{className:`${l.itemWrapper} ${s.has(a.libId)?l.selected:""}`,children:[g&&e("div",{className:l.selectOverlay,onClick:()=>ee(a.libId),title:s.has(a.libId)?"Deselect":"Select",children:e("span",{className:l.selectBadge,children:s.has(a.libId)?e(i,{name:"check",size:12}):null})}),Z(a),!u&&!g&&e("div",{className:l.cardActions,children:[e("select",{className:l.statusSelect,value:a.status,onChange:n=>X(a.libId,n.currentTarget.value),children:$.map(n=>e("option",{value:n,children:n},n))}),e("button",{className:l.removeBtn,onClick:()=>ne(a),title:A,"aria-label":A,children:e(i,{name:"trash",size:12})})]})]},a.key))}),b>0&&e("div",{className:l.bottomPagination,children:e("div",{className:l.pagination,children:[e("button",{className:l.pageBtn,onClick:()=>p(Math.max(1,c-1)),disabled:c===1||h,children:[e(i,{name:"chevron-left",size:14}),e("span",{children:"Previous"})]}),e("span",{className:l.pageInfo,children:["Page ",e("strong",{children:c})]}),e("button",{className:l.pageBtn,onClick:()=>p(c+1),disabled:m.length<z||h,children:[e("span",{children:"Next"}),e(i,{name:"chevron-right",size:14})]})]})}),_,e(B,{isOpen:!!t,onClose:E,title:`Remove from ${S}`,children:[e(B.Body,{children:[e("p",{children:t&&t.ids.length===1?`Are you sure you want to remove "${t.title}" from your ${S}?`:`Are you sure you want to remove ${t?.ids.length??0} selected items from your ${S}?`}),e("label",{children:[e("input",{type:"checkbox",checked:y,onChange:a=>k(a.target.checked)}),"Don't ask again"]})]}),e(B.Actions,{children:[e(q,{variant:"secondary",onClick:E,children:"No"}),e(q,{variant:"danger",onClick:te,children:"Yes"})]})]})]})}export{fe as L};
@@ -1 +0,0 @@
1
- import{u as t,a as $e,o as Ge,h as me,d as l,T as he,S as ge}from"./vendor-core-8R2fFbyN.js";import{b as pe}from"./vendor-query-BXRECSI6.js";import{B as L,M as we,q as O,Q as Fe,z as Me}from"./index-lo-bz7f2.js";import{I as A}from"./vendor-icons-CDMuNDeL.js";import{A as qe}from"./AnimeCard-OKU7LaSN.js";import{S as xe}from"./SkeletonGrid-Du10CNfq.js";import{E as Ue}from"./ErrorMessage-z4f4WGgP.js";import{u as Ye}from"./useMatureConsent-CT7-KfzG.js";import{u as je}from"./useProviders-xlftutIo.js";import{s as a}from"./Search.module-CMEai-B-.js";import"./useAnimeInfoData-CbNnHRj8.js";import"./QueueOptionsButton-DKWi-9kd.js";import"./vendor-ui-CUDCvRS_.js";import"./MediaCard-DszKDA4s.js";import"./useIsMobile-Dm_b6Ob3.js";const Ke=({isOpen:m,onClose:n,onGrant:q})=>t(we,{isOpen:m,title:"Content Warning",onClose:n,children:t("div",{style:{padding:"1rem",textAlign:"center"},children:[t("p",{children:"This title contains mature content intended for adult audiences."}),t("p",{children:["By proceeding, you confirm that you are ",t("strong",{children:"18 years of age or older"})," (or the age of majority in your jurisdiction) and wish to view this content."]}),t("div",{style:{marginTop:"1rem",display:"flex",gap:"10px",justifyContent:"center"},children:[t(L,{variant:"secondary",onClick:n,children:"Go Back"}),t(L,{onClick:q,children:"I'm 18+, Continue"})]})]})}),Qe="_shrinkSelect_130sm_1",Ve="_tightGrid_130sm_7",z={shrinkSelect:Qe,tightGrid:Ve},We=[{value:"anilist",label:"AniList"},{value:"mal",label:"MAL"}],ze=[{value:"POPULARITY_DESC",label:"Popularity"},{value:"TRENDING_DESC",label:"Trending"},{value:"SCORE_DESC",label:"Score"},{value:"START_DATE_DESC",label:"Newest"},{value:"FAVOURITES_DESC",label:"Favourites"}],He=[{value:"",label:"All Status"},{value:"RELEASING",label:"Currently Airing"},{value:"FINISHED",label:"Finished"},{value:"NOT_YET_RELEASED",label:"Not Yet Released"}],Je=[{value:"",label:"Relevance"},{value:"visits:desc",label:"Most Visited"},{value:"title:asc",label:"Title A-Z"}],Ze={recent:"Latest",popular:"Popular",views:"Most Viewed",rating:"Top Rated",random:"Random"},Xe=[{value:"ALL",label:"All Seasons"},{value:"Winter",label:"Winter"},{value:"Spring",label:"Spring"},{value:"Summer",label:"Summer"},{value:"Fall",label:"Fall"}],ve=m=>m.split("-").map(n=>n&&n[0].toUpperCase()+n.slice(1)).join(" ");function vt(){const m=$e(),[n,q]=Ge(),{hasConsent:x,grant:fe}=Ye();me(()=>{document.title="Mature - dango"},[]);const[i,Se]=l(n.get("provider")||"anilist"),[S,H]=l(n.get("query")||""),[T,U]=l(n.get("query")||""),[d,h]=l(parseInt(n.get("page")||"1",10)||1),[R,Y]=l(()=>{const e=n.get("sortBy");return e||(i==="mal"?"SCORE_DESC":"POPULARITY_DESC")}),[_,J]=l(n.get("sortBy")||""),[b,be]=l(n.get("status")||""),[B,ye]=l(n.get("season")||"ALL"),[k,Ne]=l(n.get("year")||"ALL"),[g,D]=l(n.get("genre")||n.get("genres")||""),[j,Ce]=l(n.get("order")||"recent"),[K,Ae]=l(n.get("studio")||""),[$,Ie]=l(n.get("studio")||""),[Z,X]=l([]),[Q,Pe]=l(!1),[Ee,ee]=l(null),{options:te}=je(),ae=he(()=>te.filter(e=>e.mature&&(e.kind??"anime")==="anime"),[te]),re=he(()=>[...We,...ae.map(e=>({value:e.value,label:e.label}))],[ae]),{data:G}=pe({queryKey:["mature-filters"],queryFn:()=>O("/api/mature/filters"),enabled:x,staleTime:1/0}),c=i==="anilist"||i==="mal",V=c?void 0:G?.providers?.[i],I=V?.browse,P=V?.genres??[],y=V?.orders??[],ne=y.length>0&&!y.includes(j)?y[0]:j,w=!c&&(I?.genre===!0||P.length>0||Z.length>0),p=!c&&(I?.order===!0||y.length>0),N=!c&&I?.studio===!0,ie=!c&&I?.sort===!0,le=c?14:I?.pageSize??14,v=e=>{const r=new URLSearchParams;if(e.provider!=="anilist"&&r.set("provider",e.provider),e.query.trim()&&r.set("query",e.query.trim()),e.page>1&&r.set("page",String(e.page)),e.provider==="anilist")e.sort!=="POPULARITY_DESC"&&r.set("sortBy",e.sort),e.status&&r.set("status",e.status),e.season!=="ALL"&&r.set("season",e.season),e.year!=="ALL"&&r.set("year",e.year);else if(e.provider==="mal")e.sort!=="SCORE_DESC"&&r.set("sortBy",e.sort),e.status&&r.set("status",e.status);else{const s=G?.providers?.[e.provider]?.browse,u=G?.providers?.[e.provider]?.orders??[],o=u.length>0&&!u.includes(e.remoteOrder)?u[0]:e.remoteOrder;(!s||s.sort)&&e.remoteSort&&r.set("sortBy",e.remoteSort),(!s||s.genre)&&e.genre&&r.set("genre",e.genre),(!s||s.order)&&o!==(u[0]??"recent")&&r.set("order",o),(!s||s.studio)&&e.studio.trim()&&r.set("studio",e.studio.trim())}q(r,{replace:!0})},f=(e={})=>({provider:i,query:T,page:d,sort:R,remoteSort:_,status:b,season:B,year:k,genre:g,remoteOrder:j,studio:$,...e}),se=(()=>{const e=new URLSearchParams;return e.set("provider",i),T.trim()&&e.set("query",T.trim()),e.set("page",String(d)),e.set("limit",String(le)),i==="anilist"&&(e.set("sortBy",R),b&&e.set("status",b),B!=="ALL"&&e.set("season",B),k!=="ALL"&&e.set("year",k)),i==="mal"?(e.set("sortBy",R),b&&e.set("status",b)):c||(w&&g&&e.set("genre",g),p&&e.set("order",ne),ie&&_&&e.set("sortBy",_),N&&$.trim()&&e.set("studio",$.trim())),e.toString()})(),{data:C,isLoading:Oe,isError:Le,error:Te}=pe({queryKey:["mature-search",se],queryFn:()=>O(`/api/mature/search?${se}`),enabled:x});me(()=>{const e=C?.genres;!c&&P.length===0&&e&&e.length>0&&X(r=>{const s=new Set(r.map(o=>o.slug)),u=[...r];for(const o of e)o.slug&&!s.has(o.slug)&&(s.add(o.slug),u.push(o));return u.length===r.length?r:u})},[C,i,c,P.length]);const F=(C?.data||[]).map(e=>({...e,isAdult:!0})),oe=C?.hasMore??!1,E=()=>{Fe(),h(1);let e=g;!c&&!p&&S.trim()&&(e=""),D(e),N&&Ie(K),U(S),v(f({query:S,page:1,genre:e,studio:N?K:$}))},Re=e=>{Se(e),h(1),J(""),D(""),X([]),e==="mal"?Y("SCORE_DESC"):e==="anilist"&&Y("POPULARITY_DESC"),U(S),v(f({provider:e,page:1,remoteSort:"",genre:"",query:S}))},_e=e=>{D(e),h(1),e&&(H(""),U("")),v(f({genre:e,page:1,query:e?"":T}))},M=e=>{h(e),v(f({page:e})),window.scrollTo({top:0,behavior:"smooth"})},Be=async(e,r)=>{const s=r.id||r._id;if(i!=="mal"&&!/^\d+$/.test(s)&&(e.preventDefault(),e.stopPropagation(),!Ee)){ee(s);try{if(i!=="anilist"){let o=!1;try{o=(await O("/api/anilist-status"))?.available===!0}catch{o=!1}if(o){const ue=await O(`/api/mature/resolve?title=${encodeURIComponent(r.name)}`);m(`/anime/${ue.id}`);return}const ce=await fetch("/api/mature/allocate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:i,nativeId:s,title:r.name,thumbnail:r.thumbnail})}),de=await ce.json().catch(()=>null);if(!ce.ok||!de?.id)throw new Error("Allocate failed");m(`/anime/${de.id}`);return}const u=await O(`/api/mature/resolve?title=${encodeURIComponent(r.name)}`);m(`/anime/${u.id}`)}catch{Me.error("Could not match this title on AniList")}finally{ee(null)}}},W=new Date().getFullYear(),ke=[{value:"ALL",label:"All Years"},...Array.from({length:W-1980+1},(e,r)=>({value:String(W-r),label:String(W-r)}))],De=P.length>0?P.map(e=>({value:e,label:ve(e)})):Z.map(e=>({value:e.slug,label:e.name}));return x?t("div",{className:"page-container",children:[t("div",{className:a.header,children:[t("h1",{className:a.pageTitle,children:"Mature"}),t("p",{className:a.pageSubtitle,children:"Browse 18+ titles across AniList and streaming providers"})]}),t("div",{className:a.filterContainer,children:[t("div",{className:a.searchBarWrapper,children:[t("div",{className:a.inputIconWrapper,children:[t(A,{name:"search",className:a.searchIcon}),t("input",{type:"text",placeholder:`Search ${re.find(e=>e.value===i)?.label}...`,value:S,onChange:e=>H(e.target.value),onKeyDown:e=>{e.key==="Enter"&&E()},className:a.searchInput})]}),t("div",{className:a.searchActions,children:[t("select",{value:i,onChange:e=>Re(e.target.value),className:a.providerSelect,"aria-label":"Provider",children:re.map(e=>t("option",{value:e.value,children:e.label},e.value))}),t(L,{onClick:E,className:a.searchBtn,children:"Search"}),c&&t("button",{onClick:()=>Pe(!Q),className:`${a.filterToggleBtn} ${Q?a.active:""}`,children:[t(A,{name:"filter"})," Filters"]}),ie&&t("select",{value:_,onChange:e=>{J(e.target.value),h(1),v(f({remoteSort:e.target.value,page:1}))},className:a.providerSelect,"aria-label":"Sort",children:Je.map(e=>t("option",{value:e.value,children:e.label},e.value))})]})]}),(i==="anilist"||i==="mal")&&t("div",{className:`${a.advancedFilters} ${Q?a.show:""}`,children:[t("div",{className:a.filterDivider}),t("div",{className:a.filterGrid,children:[t("div",{className:a.filterItem,children:[t("label",{children:"Sort By"}),t("select",{value:R,onChange:e=>Y(e.currentTarget.value),children:ze.map(e=>t("option",{value:e.value,children:e.label},e.value))})]}),t("div",{className:a.filterItem,children:[t("label",{children:"Status"}),t("select",{value:b,onChange:e=>be(e.currentTarget.value),children:He.map(e=>t("option",{value:e.value,children:e.label},e.value))})]}),i==="anilist"&&t(ge,{children:[t("div",{className:a.filterItem,children:[t("label",{children:"Season"}),t("select",{value:B,onChange:e=>ye(e.currentTarget.value),children:Xe.map(e=>t("option",{value:e.value,children:e.label},e.value))})]}),t("div",{className:a.filterItem,children:[t("label",{children:"Year"}),t("select",{value:k,onChange:e=>Ne(e.currentTarget.value),children:ke.map(e=>t("option",{value:e.value,children:e.label},e.value))})]})]})]}),t("div",{className:a.filterActions,children:t(L,{onClick:E,className:a.searchBtn,children:"Apply Filters"})})]}),!c&&!!G&&(w||p||N)&&t("div",{className:`${a.advancedFilters} ${a.show}`,children:[t("div",{className:a.filterDivider}),t("div",{className:`${a.filterGrid} ${z.tightGrid}`,children:[p&&t("div",{className:`${a.filterItem} ${z.shrinkSelect}`,children:[t("label",{children:"Order"}),t("select",{value:ne,onChange:e=>{Ce(e.target.value),h(1),v(f({remoteOrder:e.target.value,page:1}))},children:(y.length>0?y:["recent"]).map(e=>t("option",{value:e,children:Ze[e]||e},e))})]}),w&&t("div",{className:`${a.filterItem} ${z.shrinkSelect}`,children:[t("label",{children:"Genre"}),t("select",{value:g,onChange:e=>{p?(D(e.target.value),h(1),v(f({genre:e.target.value,page:1}))):_e(e.target.value)},children:[t("option",{value:"",children:"All Genres"}),De.map(e=>t("option",{value:e.value,children:e.label},e.value))]})]}),N&&t("div",{className:a.filterItem,children:[t("label",{children:"Studio"}),t("input",{type:"text",placeholder:"Studio name...",value:K,onChange:e=>Ae(e.target.value),onKeyDown:e=>{e.key==="Enter"&&E()},className:a.searchInput})]})]}),g&&w&&!p&&t("p",{className:a.pageSubtitle,children:["Browsing the ",ve(g)," genre — search text is ignored while a genre is selected."]}),(p||N)&&t("div",{className:a.filterActions,children:t(L,{onClick:E,className:a.searchBtn,children:"Apply Filters"})})]})]}),Le&&t(Ue,{message:Te?.message||"Search failed"}),Oe?t(xe,{count:le}):F.length===0?t("div",{className:a.noResults,children:[t("h3",{children:"No results found"}),t("p",{children:"Try a different query, genre or provider"})]}):t(ge,{children:[t("div",{className:a.resultsHeader,children:[t("h2",{className:a.resultsTitle,children:[C?.total??F.length," result",(C?.total??F.length)===1?"":"s"]}),t("div",{className:a.pagination,children:[t("button",{className:a.pageBtn,disabled:d<=1,onClick:()=>M(d-1),children:[t(A,{name:"chevron-left"})," ",t("span",{children:"Prev"})]}),t("span",{className:a.pageInfo,children:["Page ",t("strong",{children:d})]}),t("button",{className:a.pageBtn,disabled:!oe,onClick:()=>M(d+1),children:[t("span",{children:"Next"})," ",t(A,{name:"chevron-right"})]})]})]}),t("div",{className:a.resultsGrid,children:F.map(e=>t("div",{onClickCapture:r=>Be(r,e),children:t(qe,{anime:e})},`${i}-${e._id}`))}),t("div",{className:a.bottomPagination,children:t("div",{className:a.pagination,children:[t("button",{className:a.pageBtn,disabled:d<=1,onClick:()=>M(d-1),children:[t(A,{name:"chevron-left"})," ",t("span",{children:"Prev"})]}),t("span",{className:a.pageInfo,children:["Page ",t("strong",{children:d})]}),t("button",{className:a.pageBtn,disabled:!oe,onClick:()=>M(d+1),children:[t("span",{children:"Next"})," ",t(A,{name:"chevron-right"})]})]})})]})]}):t(Ke,{isOpen:!0,onClose:()=>m("/"),onGrant:fe})}export{vt as default};
@@ -1,56 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PlayerSettings-CBdTzo0E.js","assets/vendor-core-8R2fFbyN.js","assets/vendor-icons-CDMuNDeL.js","assets/OptionListMenu-CkK2BvEz.js","assets/AvSyncCalibrator-oK6LlG61.js","assets/index-lo-bz7f2.js","assets/vendor-query-BXRECSI6.js","assets/index-CUm1meqr.css","assets/AvSyncCalibrator-BPa6KaGC.css","assets/PlayerSettings-Bj6SsmQ2.css"])))=>i.map(i=>d[i]);
2
- import{g as Dt,h as x,u as r,P as Br,z as Ir,d as q,A as f,q as O,y as Lr,T as ct,n as $r,a as Dr,c as Fr,_ as Or,S as Et}from"./vendor-core-8R2fFbyN.js";import{_ as ur,S as Nt,q as $e,z as Qe,N as Wr,j as Vr,k as Ur,l as Qr,m as qr,d as zr,M as Ae,B as Ze,O as Gr,f as Hr}from"./index-lo-bz7f2.js";import{u as dr,b as ar,a as Gt}from"./vendor-query-BXRECSI6.js";import{C as Kr,S as jr,U as Yr,a as Jr,p as Ht,s as Xr,l as Zr,u as en,b as tn,i as rn,c as nn,d as ir,f as lr,e as sn,g as on,h as an,r as ln,j as Ue,E as cn,k as un,m as u,n as dn,A as pn,P as mn,o as hn,q as fn}from"./AvSyncCalibrator-oK6LlG61.js";import{I as W}from"./vendor-icons-CDMuNDeL.js";import{l as vn}from"./hls-B_yo8-yR.js";import{u as gn}from"./useMatureConsent-CT7-KfzG.js";import{u as bn}from"./useIsMobile-Dm_b6Ob3.js";import{s as et,Q as yn}from"./QueueRail-DAcIex5B.js";import{u as Sn,Q as En}from"./QueueOptionsButton-DKWi-9kd.js";import{u as pr}from"./useProviders-xlftutIo.js";import{A as wn}from"./AnimeMetaDetails-BPvv5xIl.js";import{S as kn}from"./SynopsisText-BcpwT5iw.js";import"./vendor-ui-CUDCvRS_.js";const Tn={soft:"Softsub",hard:"Hardsub",mixed:"Mixed"},Cn={direct:"Direct",embed:"Embed",cookie:"Needs cookie"},Mn=["direct","cookie","embed"],Rn="_controlsOverlay_1b7ea_1",_n="_hidden_1b7ea_21",Nn="_topControls_1b7ea_27",xn="_backBtn_1b7ea_47",Pn="_videoTitleInfo_1b7ea_67",An="_animeTitle_1b7ea_73",Bn="_episodeNumber_1b7ea_81",In="_bottomControls_1b7ea_89",Ln="_progressBarContainer_1b7ea_108",$n="_progressBar_1b7ea_108",Dn="_thumb_1b7ea_127",Fn="_scrubbing_1b7ea_142",On="_watchedBar_1b7ea_146",Wn="_bufferedBar_1b7ea_147",Vn="_timeBubble_1b7ea_185",Un="_skipSegment_1b7ea_219",Qn="_op_1b7ea_229",qn="_ed_1b7ea_232",zn="_recap_1b7ea_235",Gn="_bottomControlsRow_1b7ea_239",Hn="_leftControls_1b7ea_247",Kn="_rightControls_1b7ea_248",jn="_controlBtn_1b7ea_255",Yn="_theaterBtn_1b7ea_296",Jn="_nextEpisodeBtn_1b7ea_300",Xn="_active_1b7ea_317",Zn="_timeDisplay_1b7ea_321",es="_skipControls_1b7ea_329",ts="_skipBtn_1b7ea_335",rs="_volumeContainer_1b7ea_376",ns="_volumeSlider_1b7ea_382",ss="_playerPageLayout_1b7ea_440",os="_videoPlayerWrapper_1b7ea_444",as="_playerInfoContainer_1b7ea_449",is="_visible_1b7ea_566",ls="_shortcuts_1b7ea_584",E={controlsOverlay:Rn,hidden:_n,topControls:Nn,backBtn:xn,videoTitleInfo:Pn,animeTitle:An,episodeNumber:Bn,bottomControls:In,progressBarContainer:Ln,progressBar:$n,thumb:Dn,scrubbing:Fn,watchedBar:On,bufferedBar:Wn,timeBubble:Vn,skipSegment:Un,op:Qn,ed:qn,recap:zn,bottomControlsRow:Gn,leftControls:Hn,rightControls:Kn,controlBtn:jn,theaterBtn:Yn,nextEpisodeBtn:Jn,active:Xn,timeDisplay:Zn,skipControls:es,skipBtn:ts,volumeContainer:rs,volumeSlider:ns,playerPageLayout:ss,videoPlayerWrapper:os,playerInfoContainer:as,visible:is,shortcuts:ls},cs=Ir(()=>ur(()=>import("./PlayerSettings-CBdTzo0E.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),us=({player:n,isAutoplayEnabled:v,onAutoplayChange:w,showNextEpisodeButton:K,onNextEpisode:b,videoSources:C,selectedSource:S,selectedLink:P,onSourceChange:R,skipIntervals:ie,animeTitle:ye,episodeNumber:e,isTheaterMode:g,onTheaterModeToggle:V,anime4kEnabled:U,onAnime4kToggle:le,anime4kSupported:z,anime4kProfile:ve,onAnime4kProfileChange:A,anime4kInitializing:$,anime4kError:De,videoDelayEnabled:qe,onVideoDelayToggle:a,videoDelayMs:m,onVideoDelayChange:k,onCalibrateAvSync:Se,fallbackChoice:Fe,onFallbackChoiceChange:Be,children:Ie,overlays:ze,isInteractingExtra:ee=!1,className:Re,hideChrome:l=!1})=>{const{state:o,refs:d,actions:p}=n,{showSettings:B}=o,{setShowSettings:Q,setShowVolumeSlider:j}=p,te=Dt.useRef(null),Ee=Dt.useRef(null);x(()=>{const h=_=>{te.current&&!te.current.contains(_.target)&&Ee.current&&!Ee.current.contains(_.target)&&B&&Q(!1)};return B&&document.addEventListener("mousedown",h),()=>{document.removeEventListener("mousedown",h)}},[B,Q]);const we=Dt.useRef(null),Ge=h=>{d.videoRef.current&&(d.videoRef.current.volume=h,d.videoRef.current.muted=h===0,localStorage.setItem("playerVolume",h.toString()))},He=h=>{!d.videoRef.current||isNaN(o.duration)||o.duration===0||(d.videoRef.current.currentTime=h*o.duration,p.sendProgressUpdate(!1,!0))},tt=()=>{d.videoRef.current&&(p.setIsScrubbing(!0),p.wasPlayingBeforeScrub.current=!d.videoRef.current.paused,d.videoRef.current.pause())},G=h=>{!d.videoRef.current||!o.duration||(d.videoRef.current.currentTime=h*o.duration)},Ke=()=>{p.setIsScrubbing(!1),p.wasPlayingBeforeScrub.current&&d.videoRef.current?.play()},ut=h=>{if(!d.videoRef.current)return;p.setActiveSubtitleTrack(h);try{if(h===null||h==="off")localStorage.setItem("playerSubtitlesEnabled","false");else{localStorage.setItem("playerSubtitlesEnabled","true");const I=o.availableSubtitles.find(Y=>Y.label===h||Y.lang===h);I?localStorage.setItem("playerLastSubtitle",Xr(I)):localStorage.setItem("playerLastSubtitle",h)}}catch{}let _=!1;Array.from(d.videoRef.current.textTracks).forEach(I=>{const nt=h!==null&&h!=="off"&&(I.language===h||I.label===h)&&!_;I.mode=nt?"showing":"hidden",nt&&(_=!0)})},re=o.activeSubtitleTrack!==null&&o.activeSubtitleTrack!=="off",pe=()=>{if(!d.videoRef.current)return;if(re){ut("off");return}if(o.availableSubtitles.length===0)return;let h=null;try{h=localStorage.getItem("playerLastSubtitle")}catch{}const _=Ht(o.availableSubtitles,{lastKey:h,enabled:!0});if(_<0)return;const I=o.availableSubtitles[_];ut(I.label||I.lang)},je=()=>o.isMuted||o.volume===0?r(W,{name:"volume-mute"}):o.volume<.5?r(W,{name:"volume-down"}):r(W,{name:"volume-up"}),rt=r("div",{className:`${E.controlsOverlay} ${!o.showControls&&!B&&!o.isScrubbing?E.hidden:""} `,"data-speed-boost-ignore":"true",style:{pointerEvents:"none",background:"none"},children:r("div",{className:E.topControls,onClick:h=>h.stopPropagation(),children:[r("button",{className:E.backBtn,onClick:h=>{h.stopPropagation(),window.history.back()},title:"Back","aria-label":"Back",children:r(W,{name:"chevron-left"})}),r("div",{className:E.videoTitleInfo,children:[r("span",{className:E.animeTitle,children:ye}),e&&r("span",{className:E.episodeNumber,children:["Episode ",e]})]})]})}),ft=r(Kr,{isPlaying:o.isPlaying,onTogglePlay:p.togglePlay,onSkipBack:()=>p.seek(-10),onSkipForward:()=>p.seek(10)}),ne=r("div",{className:`${E.controlsOverlay} ${!o.showControls&&!B&&!o.isScrubbing?E.hidden:""} `,"data-speed-boost-ignore":"true",style:{pointerEvents:"none",background:"none",justifyContent:"flex-end"},children:r("div",{className:E.bottomControls,"data-speed-boost-ignore":"true",onClick:h=>h.stopPropagation(),children:[r(jr,{classes:{container:E.progressBarContainer,scrubbing:E.scrubbing,timeBubble:E.timeBubble,bar:E.progressBar,buffered:E.bufferedBar,watched:E.watchedBar,thumb:E.thumb},videoRef:d.videoRef,duration:o.duration,formatTime:p.formatTime,isScrubbing:o.isScrubbing,onSeek:He,onScrubStart:tt,onScrubMove:G,onScrubEnd:Ke,timeLabelRef:we,children:[o.duration>0&&n.state.currentSkipInterval&&r("div",{className:`${E.skipSegment} ${E[n.state.currentSkipInterval.skip_type]} `,style:{left:`${n.state.currentSkipInterval.start_time/o.duration*100}% `,width:`${(n.state.currentSkipInterval.end_time-n.state.currentSkipInterval.start_time)/o.duration*100}% `}}),ie.map(h=>{const _=h.start_time/o.duration*100,I=(h.end_time-h.start_time)/o.duration*100;return r("div",{className:`${E.skipSegment} ${E[h.skip_type]} `,style:{left:`${_}% `,width:`${I}% `},title:h.skip_type.toUpperCase()},h.skip_id)})]}),r("div",{className:E.bottomControlsRow,children:[r("div",{className:E.leftControls,children:[r("button",{className:E.controlBtn,onClick:p.togglePlay,"aria-label":o.isPlaying?"Pause":"Play",children:o.isPlaying?r(W,{name:"pause"}):r(W,{name:"play"})}),r(Yr,{muted:o.isMuted,volume:o.volume,volumeIcon:je(),buttonClassName:E.controlBtn,onToggleMute:p.toggleMute,onVolumeChange:Ge,onExpandedChange:h=>j(h)}),r("span",{className:E.timeDisplay,ref:we,children:[p.formatTime(0)," / ",p.formatTime(o.duration)]}),o.currentSkipInterval&&!o.isAutoSkipEnabled&&r("button",{className:E.controlBtn,onClick:()=>{d.videoRef.current&&o.currentSkipInterval&&(d.videoRef.current.currentTime=o.currentSkipInterval.end_time,p.setCurrentSkipInterval(null))},children:["Skip ",o.currentSkipInterval.skip_type==="op"?"Opening":"Ending"]})]}),r("div",{className:E.rightControls,children:[r("div",{className:E.skipControls,children:K&&r("button",{className:E.nextEpisodeBtn,onClick:b,title:"Play next episode",children:"Next EP"})}),r("button",{className:`${E.controlBtn} ${re?E.active:""}`,onClick:pe,title:re?"Disable Subtitles":"Enable Subtitles","aria-label":"Toggle Subtitles",children:r(W,{name:"closed-captioning",size:22})}),r("button",{ref:Ee,className:`${E.controlBtn} ${B?E.active:""} `,onClick:()=>Q(!B),"aria-label":"Settings",children:r(W,{name:"cog"})}),r("button",{className:`${E.controlBtn} ${E.theaterBtn} ${g?E.active:""} `,onClick:h=>{h.stopPropagation(),V()},title:g?"Exit Theater Mode":"Theater Mode","aria-label":g?"Exit Theater Mode":"Theater Mode",children:r(W,{name:"tv"})}),r("button",{className:E.controlBtn,onClick:p.toggleFullscreen,"aria-label":o.isFullscreen?"Exit Fullscreen":"Fullscreen",children:o.isFullscreen?r(W,{name:"compress"}):r(W,{name:"expand"})})]})]})]})}),Ye=r(Br,{fallback:null,children:r(cs,{ref:te,isOpen:B,onClose:()=>Q(!1),videoSources:C,currentSource:S,currentLink:P,onSourceChange:R,subtitles:o.availableSubtitles,activeSubtitleTrack:o.activeSubtitleTrack,onSubtitleChange:ut,subtitleSettings:{fontSize:o.subtitleFontSize,position:o.subtitlePosition,bgOpacity:o.subtitleBgOpacity,bgColor:o.subtitleBgColor,textColor:o.subtitleTextColor,edge:o.subtitleEdge,bold:o.subtitleBold},onSubtitleSettingsChange:(h,_)=>{const I=(Y,nt)=>{try{localStorage.setItem(Y,String(nt))}catch{}};switch(h){case"fontSize":p.setSubtitleFontSize(_),I("subtitleFontSize",_);break;case"position":p.setSubtitlePosition(_),I("subtitlePosition",_);break;case"bgOpacity":p.setSubtitleBgOpacity(_),I("subtitleBgOpacity",_);break;case"bgColor":p.setSubtitleBgColor(_),I("subtitleBgColor",_);break;case"textColor":p.setSubtitleTextColor(_),I("subtitleTextColor",_);break;case"edge":p.setSubtitleEdge(_),I("subtitleEdge",_);break;case"bold":p.setSubtitleBold(_),I("subtitleBold",_);break}},useNativeControls:o.useNativeControls,onNativeControlsToggle:p.setUseNativeControls,anime4kEnabled:U,onAnime4kToggle:le,anime4kSupported:z,anime4kProfile:ve,onAnime4kProfileChange:A,anime4kInitializing:$,anime4kError:De,videoDelayEnabled:qe,onVideoDelayToggle:a,videoDelayMs:m,onVideoDelayChange:k,onCalibrateAvSync:Se,isAutoSkipEnabled:o.isAutoSkipEnabled,onAutoSkipChange:h=>{p.setIsAutoSkipEnabled(h);try{localStorage.setItem("autoSkipEnabled",h.toString())}catch{}},isAutoplayEnabled:v,onAutoplayChange:w,fallbackChoice:Fe,onFallbackChoiceChange:Be})});return r(Jr,{player:n,topBar:rt,centerControls:ft,bottomBar:ne,settingsPanel:Ye,overlays:ze,isInteracting:ee,className:Re,chromeDisabled:l,children:Ie})},ds=({count:n=3})=>r("section",{className:et.section,children:[r("div",{className:et.header,children:r("button",{className:et.headerToggle,disabled:!0,children:[r("span",{className:et.title,children:r(Nt,{width:"60px",height:"1.2rem",variant:"text"})}),r(W,{name:"chevron-down",style:{opacity:.3}})]})}),r("div",{className:et.list,children:Array.from({length:n}).map((v,w)=>r("div",{className:et.item,style:{pointerEvents:"none"},children:[r("div",{className:et.dragHandle,style:{opacity:.2},children:r(Nt,{width:"16px",height:"16px",variant:"rectangular"})}),r("div",{className:et.thumbnail,style:{overflow:"hidden",background:"transparent"},children:r(Nt,{width:"100%",height:"100%",variant:"rectangular"})}),r("div",{className:et.meta,children:[r(Nt,{width:"80%",height:"1.2rem",variant:"text",className:"mb-2"}),r(Nt,{width:"40%",height:"0.8rem",variant:"rectangular",style:{borderRadius:"var(--radius-sm)"}})]})]},w))})]}),ps="_sourceSelectionContainer_c5tub_76",ms="_providerSelectContainer_c5tub_89",hs="_providerSelect_c5tub_89",fs="_sourceSelect_c5tub_76",vs="_sourceButtons_c5tub_145",gs="_sourceButton_c5tub_145",bs="_active_c5tub_170",ht={sourceSelectionContainer:ps,providerSelectContainer:ms,providerSelect:hs,sourceSelect:fs,sourceButtons:vs,sourceButton:gs,active:bs},ys=({selectedProvider:n,onProviderChange:v,isAdult:w,options:K})=>{const b=K&&K.length>0?K:[],C=w===void 0?b:b.filter(S=>S.mature===w);return r("div",{className:ht.providerSelectContainer,children:[r("h4",{children:"Provider"}),r("select",{className:ht.providerSelect,value:n,onChange:S=>v(S.target.value),children:Mn.map(S=>{const P=C.filter(R=>(R.tier??"direct")===S);return P.length===0?null:r("optgroup",{label:Cn[S],children:P.map(R=>r("option",{value:R.value,children:R.sub?`${R.label} (${Tn[R.sub]})`:R.label},R.value))},S)})})]})},Ss=({videoSources:n,selectedSource:v,selectedLink:w,onSourceChange:K,onLinkChange:b})=>{const C=Array.isArray(n)?n:[];if(C.length===0)return null;const S=v?.type==="iframe"&&(v.links?.length??0)>1;return r("div",{className:ht.sourceSelectionContainer,children:[r("h4",{children:"Source"}),r("div",{className:ht.sourceButtons,children:C.map((P,R)=>r("button",{className:`${ht.sourceButton} ${v?.sourceName===P.sourceName?ht.active:""} `,onClick:()=>K(P),children:P.sourceName},`${P.sourceName}-${R}`))}),S&&r("select",{className:ht.sourceSelect,"aria-label":"Fallback embed quality",value:w?.link??v.links[0]?.link??"",onChange:P=>{const R=v.links.find(ie=>ie.link===P.target.value);R&&b(R)},children:v.links.map(P=>r("option",{value:P.link,children:P.resolutionStr},P.link))})]})},Es=Dt.memo(Ss,(n,v)=>n.selectedSource?.sourceName===v.selectedSource?.sourceName&&n.selectedLink?.link===v.selectedLink?.link&&n.videoSources===v.videoSources),ws={low:{sd:1.5,hd:1.3,fhd:1.25},balanced:{sd:2,hd:1.5,fhd:1.25},high:{sd:2.5,hd:2,fhd:1.5},denoise:{sd:1.5,hd:1.5,fhd:1.5}},ks={low:"ModeB",balanced:"ModeA",high:"ModeAA",denoise:"ModeC"},Ts=5,Cs=15e3,Ms=`
3
- @group(0) @binding(0) var extTex: texture_external;
4
- @group(0) @binding(1) var extSamp: sampler;
5
- struct VSOut {
6
- @builtin(position) pos: vec4f,
7
- @location(0) uv: vec2f,
8
- };
9
- @vertex
10
- fn vs(@builtin(vertex_index) idx: u32) -> VSOut {
11
- var positions = array<vec2f, 6>(
12
- vec2f(-1.0, -1.0), vec2f(1.0, -1.0), vec2f(-1.0, 1.0),
13
- vec2f(-1.0, 1.0), vec2f(1.0, -1.0), vec2f(1.0, 1.0)
14
- );
15
- var uvs = array<vec2f, 6>(
16
- vec2f(0.0, 1.0), vec2f(1.0, 1.0), vec2f(0.0, 0.0),
17
- vec2f(0.0, 0.0), vec2f(1.0, 1.0), vec2f(1.0, 0.0)
18
- );
19
- var out: VSOut;
20
- out.pos = vec4f(positions[idx], 0.0, 1.0);
21
- out.uv = uvs[idx];
22
- return out;
23
- }
24
- @fragment
25
- fn fs(@location(0) uv: vec2f) -> @location(0) vec4f {
26
- return textureSampleBaseClampToEdge(extTex, extSamp, uv);
27
- }
28
- `;function Rs({videoRef:n,canvasRef:v,profile:w="balanced",delayMs:K=0}){const[b,C]=q(!1),[S,P]=q(!1),[R,ie]=q(!1),[ye,e]=q(null),[g,V]=q(0),U=f(0),le=f(null),z=f(null),ve=f(null),A=f(null),$=f(null),De=f(null),qe=f(null),a=f(null),m=f(null),k=f(!1),Se=f(-1),Fe=f(0),Be=f(K);Be.current=K;const Ie=f([]),ze=f(!1),ee=f(!1),Re=f(!1),l=f(null),o=f(-1),d=f(-1),p=f(!1),B=f(0);x(()=>{async function j(){if(typeof navigator>"u"||!navigator.gpu){C(!1);return}try{const te=await navigator.gpu.requestAdapter();C(!!te)}catch{C(!1)}}j()},[]),x(()=>{if(!S||!b)return;let j=!1;const te=++U.current,Ee=G=>{if(G)try{G.close()}catch{}},we=()=>{for(const G of Ie.current)Ee(G.bitmap);Ie.current=[]},Ge=G=>Math.max(8,Math.min(40,Math.ceil(G/16.7)+4));function He(){m.current!==null&&(cancelAnimationFrame(m.current),m.current=null)}async function tt(){let G=n.current;const Ke=v.current;if(!G||!Ke||U.current!==te)return;const ut=performance.now()+Cs;for(;(!G||G.videoWidth===0)&&performance.now()<ut;){if(await new Promise(Y=>requestAnimationFrame(Y)),j||U.current!==te)return;G=n.current}if(!G||G.videoWidth===0){!j&&U.current===te&&(e("Timed out waiting for video metadata"),ie(!1),P(!1));return}const re=G.videoWidth,pe=G.videoHeight,je=Math.max(re,pe),rt=window.innerWidth,ft=window.innerHeight,ne=Math.max(rt,ft),Ye=je<ne?ne/je:1,h=ws[w],_=je<=480?h.sd:je<=720?h.hd:je<=1080?h.fhd:1,I=Math.min(_,Ye);Ke.width=Math.round(re*I),Ke.height=Math.round(pe*I),ie(!0),e(null),Fe.current=0,Se.current=-1,k.current=!1;try{let Y=function(){j||U.current!==te||(He(),m.current=requestAnimationFrame(()=>{dt()}))};const{ModeA:nt,ModeB:wt,ModeC:st,ModeAA:ot}=await ur(async()=>{const{ModeA:L,ModeB:ce,ModeC:Ne,ModeAA:D}=await import("./index-BOKlZEHq.js").then(ue=>ue.i);return{ModeA:L,ModeB:ce,ModeC:Ne,ModeAA:D}},[]);if(!navigator.gpu)throw new Error("WebGPU not available");const kt=await navigator.gpu.requestAdapter();if(!kt)throw new Error("No GPU adapter found");const M=await kt.requestDevice();if(!M)throw new Error("Failed to get GPU device");const Oe=Ke.getContext("webgpu");if(!Oe)throw new Error("Failed to get WebGPU context");const at=navigator.gpu.getPreferredCanvasFormat();Oe.configure({device:M,format:at,alphaMode:"premultiplied"});const me=M.createTexture({size:[re,pe],format:"rgba16float",usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT}),Je=ks[w],ke=Math.round(re*I),Le=Math.round(pe*I),vt=(()=>{switch(Je){case"ModeB":return new wt({device:M,inputTexture:me,nativeDimensions:{width:re,height:pe},targetDimensions:{width:ke,height:Le}});case"ModeC":return new st({device:M,inputTexture:me,nativeDimensions:{width:re,height:pe},targetDimensions:{width:ke,height:Le}});case"ModeAA":return new ot({device:M,inputTexture:me,nativeDimensions:{width:re,height:pe},targetDimensions:{width:ke,height:Le}});default:return new nt({device:M,inputTexture:me,nativeDimensions:{width:re,height:pe},targetDimensions:{width:ke,height:Le}})}})(),_e=vt.getOutputTexture(),gt=M.createSampler({magFilter:"linear",minFilter:"linear"}),bt=M.createShaderModule({code:`
29
- @group(0) @binding(0) var tex: texture_2d<f32>;
30
- @group(0) @binding(1) var samp: sampler;
31
- struct VertexOutput {
32
- @builtin(position) pos: vec4f,
33
- @location(0) uv: vec2f,
34
- }
35
- @vertex
36
- fn vs(@builtin(vertex_index) idx: u32) -> VertexOutput {
37
- var positions = array<vec2f, 6>(
38
- vec2f(-1.0, -1.0), vec2f(1.0, -1.0), vec2f(-1.0, 1.0),
39
- vec2f(-1.0, 1.0), vec2f(1.0, -1.0), vec2f(1.0, 1.0)
40
- );
41
- var uvs = array<vec2f, 6>(
42
- vec2f(0.0, 1.0), vec2f(1.0, 1.0), vec2f(0.0, 0.0),
43
- vec2f(0.0, 0.0), vec2f(1.0, 1.0), vec2f(1.0, 0.0)
44
- );
45
- var out: VertexOutput;
46
- out.pos = vec4f(positions[idx], 0.0, 1.0);
47
- out.uv = uvs[idx];
48
- return out;
49
- }
50
- @fragment
51
- fn fs(@location(0) uv: vec2f) -> @location(0) vec4f {
52
- return textureSample(tex, samp, uv);
53
- }
54
- `}),Xe=M.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float"}},{binding:1,visibility:GPUShaderStage.FRAGMENT,sampler:{type:"filtering"}}]}),Tt=M.createRenderPipeline({layout:M.createPipelineLayout({bindGroupLayouts:[Xe]}),vertex:{module:bt,entryPoint:"vs"},fragment:{module:bt,entryPoint:"fs",targets:[{format:at}]},primitive:{topology:"triangle-list"}}),Ct=M.createBindGroup({layout:Xe,entries:[{binding:0,resource:_e.createView()},{binding:1,resource:gt}]});try{const L=M.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,externalTexture:{}},{binding:1,visibility:GPUShaderStage.FRAGMENT,sampler:{type:"filtering"}}]}),ce=M.createShaderModule({code:Ms}),Ne=M.createRenderPipeline({layout:M.createPipelineLayout({bindGroupLayouts:[L]}),vertex:{module:ce,entryPoint:"vs"},fragment:{module:ce,entryPoint:"fs",targets:[{format:"rgba16float"}]},primitive:{topology:"triangle-list"}});l.current={pipeline:Ne,layout:L,inputView:me.createView()}}catch{l.current=null}if(U.current!==te){me.destroy(),M.destroy();return}le.current=M,z.current=Oe,ve.current=vt,A.current=me,$.current=_e,De.current=Tt,qe.current=gt,a.current=Xe,ee.current=!1,Re.current=!1;async function Ft(){const L=l.current;if(!L||ee.current)return!1;const ce=n.current;if(!ce)return!1;const Ne=!Re.current;Ne&&M.pushErrorScope("validation");try{const D=M.importExternalTexture({source:ce}),ue=M.createBindGroup({layout:L.layout,entries:[{binding:0,resource:D},{binding:1,resource:gt}]}),Te=M.createCommandEncoder(),T=Te.beginRenderPass({colorAttachments:[{view:L.inputView,loadOp:"load",storeOp:"store"}]});T.setPipeline(L.pipeline),T.setBindGroup(0,ue),T.draw(6),T.end(),M.queue.submit([Te.finish()])}catch{return ee.current=!0,l.current=null,!1}if(Ne){const D=await M.popErrorScope().catch(()=>null);if(D)return console.warn("[anime4k] blit probe failed:",D.message),ee.current=!0,l.current=null,!1;Re.current=!0}return!0}ie(!1);async function dt(){if(j||U.current!==te)return;const L=n.current;if(!L||L.videoWidth===0){Y();return}if(L!==G||L.videoWidth!==re||L.videoHeight!==pe){V(ue=>ue+1);return}if(L.paused||L.ended||document.hidden||L.readyState<HTMLMediaElement.HAVE_CURRENT_DATA){Y();return}const ce=L.getVideoPlaybackQuality().totalVideoFrames;if(ce===d.current){Y();return}if(k.current){Y();return}const Ne=L.currentTime;(L.seeking||o.current>=0&&Math.abs(Ne-o.current)>.5)&&(we(),p.current=!1,B.current=0,d.current=-1),o.current=Ne;const D=Math.max(0,Be.current||0);D>B.current&&(p.current=!1),k.current=!0;try{const ue=performance.now();let Te=null,T=!1;if(D<=0){Ie.current.length>0&&we(),p.current=!1,B.current=0;let Ce=!1;if(!ze.current)try{M.queue.copyExternalImageToTexture({source:L},{texture:me},[re,pe]),d.current=ce,Ce=!0}catch(he){if(he instanceof TypeError)ze.current=!0;else throw he}if(!Ce&&!ee.current&&l.current&&await Ft()&&(d.current=ce,Ce=!0),!Ce){const he=await createImageBitmap(L);d.current=ce,M.queue.copyExternalImageToTexture({source:he},{texture:me},[re,pe]),Ee(he)}}else{const Ce=await createImageBitmap(L);d.current=ce;const he=Ie.current;he.push({bitmap:Ce,capture:ue});const Ot=Ge(D);for(;he.length>Ot;)Ee(he.shift()?.bitmap);let se=-1;for(let ge=he.length-1;ge>=0;ge--)if(ue-he[ge].capture>=D){se=ge;break}if(se!==-1){for(let Ve=0;Ve<se;Ve++)Ee(he.shift()?.bitmap);const ge=he.shift();ge?(Te=ge.bitmap,p.current=!0,B.current=D):(Te=Ce,T=!0)}else if(!p.current)Te=Ce,T=!0;else{const ge=he.shift();Te=ge?ge.bitmap:Ce,ge||(T=!0)}if(!Te){k.current=!1,Y();return}M.queue.copyExternalImageToTexture({source:Te},{texture:me},[re,pe]),T||Ee(Te)}const Mt=M.createCommandEncoder();await vt.pass(Mt);const We=Mt.beginRenderPass({colorAttachments:[{view:Oe.getCurrentTexture().createView(),clearValue:{r:0,g:0,b:0,a:1},loadOp:"clear",storeOp:"store"}]});We.setPipeline(Tt),We.setBindGroup(0,Ct),We.draw(6),We.end(),M.queue.submit([Mt.finish()]),Se.current=ce,Fe.current=0,M.queue.onSubmittedWorkDone().then(()=>{U.current===te&&(k.current=!1)})}catch(ue){if(k.current=!1,Fe.current+=1,Fe.current>=Ts&&!j&&U.current===te){console.error(ue),e(ue instanceof Error?ue.message:"Render error"),P(!1);return}}Y()}Y()}catch(Y){!j&&U.current===te&&(e(Y instanceof Error?Y.message:"Failed to initialize upscaler"),ie(!1),P(!1))}}return tt(),()=>{j=!0,U.current+=1,He(),we(),A.current&&(A.current.destroy(),A.current=null),$.current&&($.current.destroy(),$.current=null),le.current&&(le.current.destroy(),le.current=null),ve.current=null,De.current=null,qe.current=null,a.current=null,l.current=null,z.current=null,k.current=!1}},[S,b,n,v,w,g]);const Q=O(()=>{P(j=>!j)},[]);return{isWebGPUSupported:b,isEnabled:S,isInitializing:R,error:ye,toggle:Q}}const _s=()=>localStorage.getItem("preferredMode")==="dub"?"dub":"sub",Ns=()=>{const n=localStorage.getItem("preferredProvider");return n&&/^[a-z0-9-]+$/i.test(n)?n:"megaplay"},mr=()=>({showMeta:{},episodes:[],watchedEpisodes:[],watchlistStatus:null,showCombinedDetails:!1,currentMode:_s(),inWatchlist:!1,videoSources:[],selectedSource:null,selectedLink:null,forceNativePlayer:localStorage.getItem("forceNativePlayer")==="true",isAutoplayEnabled:Zr(),showResumeModal:!0,resumeTime:0,resumeDuration:0,skipIntervals:[],selectedProvider:Ns(),loadingShowData:!0,loadingVideo:!1,loadingDetails:!1,error:null,detailsError:null,showCookieModal:!1,cookieProvider:null});mr();function xs(n,v){switch(v.type){case"SET_STATE":return{...n,...v.payload};case"SET_MODE":return{...n,currentMode:v.payload,videoSources:[],selectedSource:null,selectedLink:null};case"SET_PROVIDER":return{...n,selectedProvider:v.payload};case"SET_OVERRIDE_SOURCE":return{...n,selectedSource:v.payload?.source??null,selectedLink:v.payload?.link??null};default:return n}}async function cr(n,v,w,K,b=!1){if(!n||!v)throw new Error("Missing params");try{const[C,S,P,R]=await Promise.all([$e(`/api/video?showId=${n}&episodeNumber=${v}&mode=${w.currentMode}&provider=${w.selectedProvider}`).catch(()=>null),$e(`/api/episode-progress/${n}/${v}`).catch(()=>null),$e("/api/settings?key=preferredSource").catch(()=>null),$e(`/api/skip-times/${n}/${v}`).catch(()=>[])]),ie=P?.value,ye=C?.filter(A=>{const $=A.sourceName.toLowerCase();return w.currentMode==="dub"?$.includes("eng")||$.includes("dub"):$.includes("jpn")||$.includes("sub")||!$.includes("eng")&&!$.includes("dub")})??[],e=ye.length>0?ye:C??[];let g=e.length>0?e[0]:null;if(ie){const A=e.find($=>$.sourceName===ie);A&&(g=A)}const V=g&&g.links.length>0?g.links.sort((A,$)=>(parseInt($.resolutionStr)||0)-(parseInt(A.resolutionStr)||0))[0]:null,U=S?.currentTime||0,le=S?.duration||0,ve=(Array.isArray(R)?R:R?.results||[]).map(A=>({skip_id:A.skip_id||"",skip_type:A.skip_type||"",start_time:A.interval?.start_time??A.start_time??0,end_time:A.interval?.end_time??A.end_time??0})).filter(A=>A.end_time>0);return(!C||C.length===0)&&(b||Qe.error(`No video sources found for ${w.selectedProvider}`)),{videoSources:C,selectedSource:g,selectedLink:V,resumeTime:U,resumeDuration:le,showResumeModal:U>5&&g?.type!=="iframe",skipIntervals:ve,fetchedEpisodeNumber:v}}catch(C){const S=C;if(S.message==="AUTH_REQUIRED")return K({type:"SET_STATE",payload:{showCookieModal:!0,cookieProvider:S.provider}}),{videoSources:[],selectedSource:null,selectedLink:null,resumeTime:0,resumeDuration:0,showResumeModal:!1,skipIntervals:[],fetchedEpisodeNumber:v};throw C}}const Ps=(n,v,w,K)=>{const[b,C]=Lr(xs,w,l=>({...mr(),showMeta:l?.name?{name:l.name,thumbnail:l.thumbnail,nativeName:l.nativeName,englishName:l.englishName,names:{romaji:l.name||l.englishName,english:l.englishName||l.name,native:l.nativeName}}:{}})),S=dr(),P=f(null),R=f(null),{options:ie}=pr(),ye=ct(()=>ie.filter(l=>(l.kind??"anime")==="anime"),[ie]),e=v||b.initialEpisode,g=f(e);x(()=>{g.current!==e&&(g.current=e,C({type:"SET_STATE",payload:{selectedSource:null,selectedLink:null}}))},[e,C]),x(()=>{n&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(n)&&b.selectedProvider!=="animepahe"&&P.current!==n&&(P.current=n,C({type:"SET_PROVIDER",payload:"animepahe"}))},[n,b.selectedProvider]);const{data:V,isLoading:U,error:le}=Sn(n),{data:z}=ar({queryKey:["player-data",n,b.currentMode,b.selectedProvider],queryFn:async()=>{if(!n)throw new Error("No showId");const l=async()=>{try{const Q=await $e(`/api/episodes?showId=${n}&mode=${b.currentMode}&provider=${b.selectedProvider}`);if(Q?.episodes?.length)return Q}catch{}return null},[o,d,p]=await Promise.all([l(),$e(`/api/watchlist/check/${n}`).catch(()=>({inWatchlist:!1})),$e(`/api/watched-episodes/${n}`).catch(()=>[])]),B=o?.episodes?o.episodes.sort((Q,j)=>parseFloat(Q)-parseFloat(j)):[];return{description:o?.description||"",episodes:B,inWatchlist:d.inWatchlist,watchlistStatus:d.status??null,watchedEpisodes:p}},enabled:!!n});x(()=>{!v&&z?.episodes&&z.episodes.length>0&&!v&&C({type:"SET_STATE",payload:{initialEpisode:z.episodes[0]}})},[z,v]),x(()=>{if(V?.isAdult===void 0)return;const o=new Set(ye.filter(d=>d.mature).map(d=>d.value)).has(b.selectedProvider);if(R.current!==n){if(V.isAdult&&!o){R.current=n;const d=ye.find(p=>p.mature);if(!d)return;C({type:"SET_PROVIDER",payload:d.value}),localStorage.setItem("preferredProvider",d.value)}if(!V.isAdult&&o){R.current=n;const d=ye.find(p=>!p.mature);if(!d)return;C({type:"SET_PROVIDER",payload:d.value}),localStorage.setItem("preferredProvider",d.value)}}},[V?.isAdult,b.selectedProvider,n,ye]),x(()=>{if(!n||!/^dango-mt-\d+$/.test(n)||R.current===`temp:${n}`)return;const l=V?.provider;l&&(R.current=`temp:${n}`,l!==b.selectedProvider&&C({type:"SET_PROVIDER",payload:l}))},[n,V,b.selectedProvider]);const{data:ve,isLoading:A,error:$}=ar({queryKey:["video-sources",n,e,b.selectedProvider,b.currentMode],queryFn:()=>cr(n,e,b,C),enabled:!!n&&!!e&&!(b.showMeta?.isAdult===!0&&!K?.hasMatureConsent)}),De=!1,{mutateAsync:qe}=Gt({mutationFn:async({wasIn:l,showMeta:o})=>{const d=l?"/api/watchlist/remove":"/api/watchlist/add",p={id:n,name:o.name||o.names?.romaji,thumbnail:o.thumbnail,nativeName:o.names?.native,englishName:o.names?.english,type:o.type,isAdult:o.isAdult},B=await fetch(d,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(p)});if(!B.ok){const Q=await B.json().catch(()=>null);throw new Error(Q?.error||"Failed to update watchlist")}return!l},onSuccess:l=>{Qe.success(l?"Added to watchlist":"Removed from watchlist"),S.invalidateQueries({queryKey:["player-data",n]}),S.invalidateQueries({queryKey:["show-data",n]}),S.invalidateQueries({queryKey:["watchlist"]})},onError:l=>Qe.error(l instanceof Error?l.message:"Failed to update watchlist")}),a=O(async()=>{!n||!V||await qe({wasIn:!!z?.inWatchlist,showMeta:V})},[n,V,z?.inWatchlist,qe]),m=O(async l=>{try{await $e("/api/settings",{method:"POST",body:JSON.stringify({key:"preferredSource",value:l})})}catch(o){console.error(o)}},[]),{mutateAsync:k,isPending:Se}=Gt({mutationFn:async({status:l})=>{if(!n)throw new Error("Missing showId");return await $e("/api/watchlist/status",{method:"POST",body:JSON.stringify({id:n,status:l})}),l},onSuccess:l=>{C({type:"SET_STATE",payload:{inWatchlist:!0,watchlistStatus:l}}),Qe.success(`Moved to ${l}`),S.invalidateQueries({queryKey:["show-data",n]}),S.invalidateQueries({queryKey:["watchlist"]}),S.invalidateQueries({queryKey:["allContinueWatching"]})},onError:()=>Qe.error("Failed to update watchlist status")}),Fe=O(async()=>{await k({status:"Completed"})},[k]),{mutateAsync:Be}=Gt({mutationFn:async({episodeNumber:l,duration:o,showMeta:d,episodes:p})=>{await $e("/api/update-progress",{method:"POST",body:JSON.stringify({showId:n,episodeNumber:l,currentTime:o,duration:o,showName:d.name,showThumbnail:d.thumbnail,nativeName:d.names?.native,englishName:d.names?.english,genres:d.genres?.map(B=>B.name),popularityScore:Wr(d.score??d.stats?.averageScore),type:d.type,status:d.status,episodeCount:p.length,isAdult:d.isAdult}),keepalive:!0})},onSuccess:(l,o)=>{Qe.success(`Episode ${o.episodeNumber} marked as watched`),S.invalidateQueries({queryKey:["player-data",n]}),S.invalidateQueries({queryKey:["show-meta",n]}),S.invalidateQueries({queryKey:["video-sources",n,o.episodeNumber]}),S.invalidateQueries({queryKey:["allContinueWatching"]}),S.invalidateQueries({queryKey:["thisWeekSchedule"]})},onError:()=>Qe.error("Failed to mark episode as watched")}),Ie=O(async(l,o)=>{!n||!V||await Be({episodeNumber:l,duration:o,showMeta:V,episodes:z?.episodes||[]})},[n,V,z?.episodes,Be]),ze=O(async()=>{C({type:"SET_STATE",payload:{showCombinedDetails:!b.showCombinedDetails}})},[b.showCombinedDetails]),ee=ct(()=>{const l=le||$,o=l?l.message:null,d=o==="AUTH_REQUIRED"?null:o,p=ve&&ve.fetchedEpisodeNumber===e?ve:null,B=!!ve&&!p;return{...b,currentEpisode:e,showMeta:{...b.showMeta||{},...V||{}},episodes:z?.episodes||[],watchedEpisodes:z?.watchedEpisodes||[],inWatchlist:!!z?.inWatchlist,watchlistStatus:z?.watchlistStatus??b.watchlistStatus??null,videoSources:p?.videoSources||[],selectedSource:b.selectedSource||p?.selectedSource||null,selectedLink:b.selectedLink||p?.selectedLink||null,resumeTime:p?.resumeTime||0,resumeDuration:p?.resumeDuration||0,showResumeModal:b.showResumeModal&&(p?.showResumeModal??!1),skipIntervals:p?.skipIntervals||[],loadingShowData:U,loadingVideo:A||B,loadingDetails:De,error:d,fetchedEpisodeNumber:p?.fetchedEpisodeNumber}},[b,V,z,ve,U,A,De,le,$,e]),Re=O((l,o)=>{const d=o||n;if(!d||!l||d===n&&l===e)return;const B=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(d)&&b.selectedProvider!=="animepahe"?"animepahe":b.selectedProvider,Q=["video-sources",d,l,B,b.currentMode];S.getQueryState(Q)?.status!=="success"&&S.prefetchQuery({queryKey:Q,queryFn:()=>cr(d,l,{selectedProvider:B,currentMode:b.currentMode},C,!0),staleTime:300*1e3,gcTime:1800*1e3})},[n,e,S,b,C]);return{state:ee,dispatch:C,toggleWatchlist:a,moveToCompleted:Fe,setPreferredSource:m,handleToggleDetails:ze,markEpisodeWatched:Ie,prefetchEpisodeSources:Re,isMarkingWatched:Be.isPending,isUpdatingWatchlistStatus:Se}},Kt="fallbackChoice";function As(){try{const n=localStorage.getItem(Kt);return n==="iframe"||n==="retry"?n:null}catch{return null}}function Bs(n){try{n===null?localStorage.removeItem(Kt):localStorage.setItem(Kt,n)}catch{}}const Xs=()=>{const{id:n,episodeNumber:v}=$r(),w=Dr(),K=dr(),b=Fr(),{hasConsent:C,grant:S}=gn(),{options:P}=pr(),R=ct(()=>P.filter(t=>(t.kind??"anime")==="anime"),[P]),ie=ct(()=>R.map(t=>t.value),[R]),ye=ct(()=>new Set(R.filter(t=>t.mature).map(t=>t.value)),[R]),{state:e,dispatch:g,toggleWatchlist:V,moveToCompleted:U,setPreferredSource:le,handleToggleDetails:z,markEpisodeWatched:ve,prefetchEpisodeSources:A,isMarkingWatched:$,isUpdatingWatchlistStatus:De}=Ps(n,v,b.state||null,{hasMatureConsent:C});x(()=>{if(n&&e.showMeta?.id&&e.showMeta.id!==n){const t=v?`/watch/${e.showMeta.id}/${v}${window.location.search}`:`/watch/${e.showMeta.id}${window.location.search}`;w(t,{replace:!0})}},[n,e.showMeta?.id,v,w]);const qe=ct(()=>{if(e.showMeta.name)return{name:e.showMeta.name,thumbnail:e.showMeta.thumbnail,names:e.showMeta.names,genres:e.showMeta.genres,score:e.showMeta.score,isAdult:e.showMeta.isAdult}},[e.showMeta.name,e.showMeta.thumbnail,e.showMeta.names,e.showMeta.genres,e.showMeta.score,e.showMeta.isAdult]),a=en({skipIntervals:e.skipIntervals,showId:n,episodeNumber:e.currentEpisode?.toString(),episodeCount:e.episodes.length||void 0,sourceType:e.selectedSource?.type,showMeta:qe}),{refs:m,actions:k}=a,Se=f(null),Fe=bn(),Be=f(null),Ie=f(null),ze=f(null),ee=f(0),Re=f(e.resumeTime),l=f(e.showResumeModal),[o,d]=q(()=>{try{const t=localStorage.getItem("anime4kProfile");return["low","balanced","high","denoise"].includes(t)?t:"balanced"}catch{return"balanced"}}),[p,B]=q(()=>{try{const t=Number(localStorage.getItem("playerVideoDelayMs"));if(Number.isFinite(t)&&t>=0&&t<=500)return Math.round(t)}catch{}return 180}),[Q,j]=q(()=>{try{return localStorage.getItem("playerVideoDelayEnabled")==="true"}catch{return!1}}),[te,Ee]=q(!1),[we,Ge]=q(!1),He=f(null),tt=f(null),G=(t,s)=>{try{localStorage.setItem("playerVideoDelayMs",String(t)),localStorage.setItem("playerVideoDelayEnabled",String(s))}catch{}},Ke=t=>{const s=Math.max(0,Math.min(500,Math.round(t)));B(s);try{localStorage.setItem("playerVideoDelayMs",String(s))}catch{}},ut=()=>{He.current={enabled:Q,ms:p},j(!0);try{localStorage.setItem("playerVideoDelayEnabled","true")}catch{}k.setShowSettings(!1),Ee(!0)},re=()=>{const t=He.current;He.current=null,t&&(B(t.ms),j(t.enabled),G(t.ms,t.enabled)),Ge(!1),Ee(!1)},pe=()=>{He.current=null,j(!0),G(p,!0),Ge(!1),Ee(!1)},je=()=>{if(we){Ge(!1);return}const t=m.videoRef.current;t&&!isNaN(t.currentTime)&&(tt.current=t.currentTime),Ge(!0)},rt=Q?p:0,ft=f(null),ne=Rs({videoRef:m.videoRef,canvasRef:Ie,profile:o,delayMs:rt}),Ye=ne.isEnabled&&ne.isWebGPUSupported;tn({videoRef:m.videoRef,canvasRef:ft,delayMs:rt,enabled:Q&&!Ye});const h=Q&&!Ye,_=Ye||h;x(()=>{Re.current=e.resumeTime,l.current=e.showResumeModal},[e.resumeTime,e.showResumeModal]);const[I,Y]=q(null),[nt,wt]=q(!1),[st,ot]=q(!1),[kt,M]=q(!1),Oe=f(!1),[at,me]=q(null),Je=f(!1),ke=f([]),Le=f(!1),[vt,_e]=q(null),[gt,bt]=q(!1),[Xe,Tt]=q(!1),[Ct,Ft]=q(()=>As()??"ask"),dt=O(t=>{Ft(t),Bs(t==="ask"?null:t)},[]),L=f(Ct);L.current=Ct;const ce=f(e.videoSources);ce.current=e.videoSources;const Ne=f(()=>{}),[D,ue]=q(null),Te=f(v);x(()=>{Te.current!==v&&(Te.current=v,ue(null),me(null),Oe.current=!1,Ge(!1),Ee(!1))},[v]),x(()=>{Je.current=!1,ke.current=[],Le.current=!1,_e(null),bt(!1)},[n,e.currentEpisode]),x(()=>{st||(Oe.current=!1)},[st]);const{data:T=[],isLoading:Mt}=Vr(),We=Ur(),Ce=f(We);Ce.current=We;const he=Qr(),Ot=qr(),[se,ge]=q(()=>{try{return localStorage.getItem("playerTheaterMode")==="true"}catch{return!1}});x(()=>{try{se?document.body.classList.add("theater-mode"):document.body.classList.remove("theater-mode")}catch(t){console.error(t)}return()=>{try{document.body.classList.remove("theater-mode")}catch(t){console.error(t)}}},[se]),Or(()=>{if(a.state.isFullscreen||se)return;const t=m.playerContainerRef.current,s=Be.current;if(!t||!s)return;const i=()=>{const N=t.getBoundingClientRect().height;s.style.height=`${N}px`};i();const c=new ResizeObserver(i);return c.observe(t),()=>c.disconnect()},[a.state.isFullscreen,se,m.playerContainerRef]);const Ve=ct(()=>e.episodes.findIndex(t=>t===e.currentEpisode),[e.episodes,e.currentEpisode]),Wt=Ve>0?e.episodes[Ve-1]:null,xe=Ve>=0&&Ve<e.episodes.length-1?e.episodes[Ve+1]:null,Vt=Ve>-1&&Ve<e.episodes.length-1,hr=e.episodes.length>0&&!!e.currentEpisode&&e.episodes[e.episodes.length-1]===e.currentEpisode,fr=String(e.showMeta.status||"").trim().toLowerCase(),vr=["finished","completed","complete","ended"].some(t=>fr.includes(t)),Ut=rn(e.resumeTime,e.resumeDuration)||st,it=hr&&vr&&Ut,jt=e.showResumeModal&&(it||!Ut),xt=Ut&&!it&&T.length===0&&!D&&(e.showResumeModal||st),pt=jt||xt;nn(a,!!e.selectedLink&&!se&&!pt),x(()=>{const t=m.videoRef.current;if(!t)return;let s=!1;for(Se.current&&(Se.current.destroy(),Se.current=null),(e.loadingVideo||e.selectedSource)&&(t.pause(),t.removeAttribute("src"),t.load());t.firstChild;)t.removeChild(t.firstChild);if(we)return t.src="/av-sync-test.mp4",t.play().catch(()=>{k.setShowControls(!0)}),()=>{s=!0};if(!e.selectedSource||!e.selectedLink)return;if(e.selectedSource.type==="iframe"){ee.current=0;return}tt.current!=null?(ee.current=tt.current,tt.current=null):Re.current>5&&!l.current?ee.current=Re.current:l.current&&(ee.current=0);let i=e.selectedLink.link;if(i.startsWith("/api/proxy")||(i=`/api/proxy?url=${encodeURIComponent(i)}`,e.selectedLink.headers?.Referer&&(i+=`&referer=${encodeURIComponent(e.selectedLink.headers.Referer)}`)),e.selectedSource.subtitles){const fe=localStorage.getItem("playerSubtitlesEnabled")!=="false";let Me=null;try{Me=localStorage.getItem("playerLastSubtitle")}catch{}const J=Ht(e.selectedSource.subtitles,{lastKey:Me,enabled:fe}),Pe=J>=0?e.selectedSource.subtitles[J]:null;e.selectedSource.subtitles.forEach(be=>{const X=document.createElement("track");X.kind="subtitles",X.label=be.label,X.srclang=be.lang;const y=be.src??be.url;if(y){let Z=`/api/subtitle-proxy?url=${encodeURIComponent(y)}`;const ae=e.selectedLink?.headers?.Referer,yt=y.includes("anilight.live")?"https://anilight.live/":"",$t=ae||yt;$t&&(Z+=`&referer=${encodeURIComponent($t)}`),X.src=Z}Pe&&be.label===Pe.label&&be.lang===Pe.lang&&(X.default=!0),t.appendChild(X)}),fe||k.setActiveSubtitleTrack("off"),k.setAvailableSubtitles(e.selectedSource.subtitles)}const c=ee.current;ee.current=0;const N=()=>{c>0&&(t.currentTime=c)};t.addEventListener("loadedmetadata",N,{once:!0});const de=!(l.current&&Re.current>5),H=()=>{de&&t.play().catch(()=>{k.setShowControls(!0)})};e.selectedLink.hls?(async()=>{const fe=await vn();if(s)return;if(!fe||!fe.isSupported()){t.src=i,H();return}const Me=document.body.classList.contains("low-end"),J=new fe({maxBufferLength:Me?15:30,maxMaxBufferLength:Me?30:60,maxBufferSize:Me?25*1e3*1e3:60*1e3*1e3,startLevel:-1,enableWorker:!0});Se.current=J,J.on(fe.Events.ERROR,(X,y)=>{y.fatal&&!Je.current&&Ne.current()});const Pe=(e.selectedSource?.subtitles?.length??0)>0,be=()=>{try{Pe&&typeof J.subtitleTrack=="number"&&J.subtitleTrack!==-1&&(J.subtitleTrack=-1)}catch{}};J.on(fe.Events.SUBTITLE_TRACK_SWITCH,(X,y)=>{y?.id!==-1&&be()}),be(),J.loadSource(i),J.attachMedia(t),J.once(fe.Events.MANIFEST_PARSED,()=>{s||H()})})():(t.src=i,H());const F=localStorage.getItem("playerVolume"),oe=localStorage.getItem("playerMuted");return F!==null&&(t.volume=parseFloat(F)),oe!==null&&(t.muted=oe==="true"),()=>{s=!0,t.removeEventListener("loadedmetadata",N),Se.current&&(Se.current.destroy(),Se.current=null)}},[e.selectedSource,e.selectedLink,m.videoRef,k,e.loadingVideo,we]);const Pt=O(t=>{if(Je.current)return;Je.current=!0;const s=t.links[0];le(t.sourceName),g({type:"SET_STATE",payload:{selectedSource:t,selectedLink:s}}),_e(null)},[g,le]),At=O(()=>{const s=ce.current.find(i=>i.type==="iframe");return s?.links?.length?s:null},[]),Bt=O(async()=>{const t=e.showMeta?.isAdult,s=ie.filter(i=>{if(ke.current.includes(i))return!1;const c=ye.has(i);return t===void 0?!0:c===t});bt(!0);try{for(const i of s){ke.current.push(i);let c=null;try{c=await $e(`/api/video?showId=${n}&episodeNumber=${e.currentEpisode}&mode=${e.currentMode}&provider=${i}`)}catch{continue}const N=(c??[]).filter(F=>{const oe=F.sourceName.toLowerCase();return e.currentMode==="dub"?oe.includes("eng")||oe.includes("dub"):oe.includes("jpn")||oe.includes("sub")||!oe.includes("eng")&&!oe.includes("dub")});if((N.length>0?N:c??[]).find(F=>F.type!=="iframe"&&F.links?.length)){ke.current=[e.selectedProvider],Le.current=!1,g({type:"SET_STATE",payload:{selectedProvider:i,videoSources:[],selectedSource:null,selectedLink:null,loadingVideo:!0}}),localStorage.setItem("preferredProvider",i),_e(null),Qe.success(`Switched to ${i} (direct stream)`);return}}_e({retryFailed:!0}),Qe.error("No working direct stream found on other providers")}finally{bt(!1)}},[n,e.currentEpisode,e.currentMode,e.showMeta?.isAdult,e.selectedProvider,g,ie,ye]),Yt=O(()=>{if(Je.current||Le.current||e.selectedSource?.type!=="player")return;const t=At();if(!t)return;ke.current.includes(e.selectedProvider)||ke.current.push(e.selectedProvider);const s=L.current;if(s==="iframe"){Pt(t);return}if(s==="retry"){Bt();return}k.setShowControls(!0),_e({retryFailed:!1})},[e.selectedSource,e.selectedProvider,At,Pt,Bt,k]);Ne.current=Yt;const gr=O(()=>{Le.current=!0,_e(null),Tt(!1)},[]),br=O(()=>{Xe&&dt("iframe");const t=At();t?Pt(t):_e(null)},[Xe,dt,At,Pt]),yr=O(()=>{Xe&&dt("retry"),Bt()},[Xe,dt,Bt]),Rt=(t,s,i)=>t.showId===s||!!i&&t.showId===i,It=O(()=>{k.onEnded();const t=T.find(i=>Rt(i,n,e.showMeta?.id)&&i.episodeNumber===e.currentEpisode);if(T.length>0){const i=T.findIndex(N=>Rt(N,n,e.showMeta?.id)&&N.episodeNumber===e.currentEpisode),c=i>=0?T[i+1]||null:T[0];ue({nextItem:c,playedItem:t||null}),me(2)}else t&&Ce.current.mutate({showId:t.showId,episodeNumber:t.episodeNumber});let s=!1;if(e.isAutoplayEnabled&&T.length===0){const i=e.episodes.findIndex(c=>c===e.currentEpisode);if(i>-1&&i<e.episodes.length-1){const c=e.episodes[i+1];K.invalidateQueries({queryKey:["allContinueWatching"]}),w(`/watch/${n}/${c}`),s=!0}}if(!s&&T.length===0&&!D&&!Oe.current){const i=e.episodes.length>0&&!!e.currentEpisode&&e.episodes[e.episodes.length-1]===e.currentEpisode,c=String(e.showMeta.status||"").trim().toLowerCase(),N=["finished","completed","complete","ended"].some(de=>c.includes(de));i&&N&&g({type:"SET_STATE",payload:{showResumeModal:!0}})}},[k,w,T,n,e.showMeta?.id,e.showMeta?.status,e.currentEpisode,e.episodes,e.isAutoplayEnabled,D,g,K]),Qt=O(()=>{if(T.length===0)return;k.onEnded();const t=T.find(c=>Rt(c,n,e.showMeta?.id)&&c.episodeNumber===e.currentEpisode),s=T.findIndex(c=>Rt(c,n,e.showMeta?.id)&&c.episodeNumber===e.currentEpisode),i=s>=0?T[s+1]||null:T[0];t&&We.mutate({showId:t.showId,episodeNumber:t.episodeNumber}),i?w(`/watch/${i.showId}/${i.episodeNumber}`):t&&g({type:"SET_STATE",payload:{showResumeModal:!0}})},[k,w,T,We,n,e.showMeta?.id,e.currentEpisode,g]),_t=O(()=>{xe&&(K.invalidateQueries({queryKey:["allContinueWatching"]}),ot(!1),w(`/watch/${n}/${xe}`)),g({type:"SET_STATE",payload:{showResumeModal:!1}})},[xe,w,n,g,K]),Jt=O(()=>{T.length>0?Qt():xe?_t():Qe.error("No next episode available")},[T.length,Qt,_t,xe]),Sr=()=>{Wt&&w(`/watch/${n}/${Wt}`)};x(()=>{const t=m.videoRef.current;if(!t)return;const s=()=>{we||It()};return t.addEventListener("ended",s),()=>{t&&t.removeEventListener("ended",s)}},[It,m.videoRef,we]),x(()=>{const t=s=>{s.origin===window.location.origin&&e.selectedSource?.type==="iframe"&&s.data?.type==="ANI_WEB_MEDIA_ENDED"&&It()};return window.addEventListener("message",t),()=>window.removeEventListener("message",t)},[It,e.selectedSource?.type]),x(()=>{if(!D||at===null)return;if(at<=0){const{nextItem:s,playedItem:i}=D;ue(null),me(null),i&&Ce.current.mutate({showId:i.showId,episodeNumber:i.episodeNumber}),s?w(`/watch/${s.showId}/${s.episodeNumber}`):i&&g({type:"SET_STATE",payload:{showResumeModal:!0}});return}const t=window.setTimeout(()=>{me(s=>s===null?null:s-1)},1e3);return()=>window.clearTimeout(t)},[D,at,w,g]),x(()=>{pt&&a.state.isFullscreen&&a.actions.toggleFullscreen()},[pt,a.state.isFullscreen,a.actions]),x(()=>{pt&&m.videoRef.current&&m.videoRef.current.pause()},[pt,m.videoRef]);const{titlePreference:Lt}=zr(),mt=ct(()=>{if(!e.showMeta||e.loadingShowData)return"Loading...";const{name:t,names:s}=e.showMeta;return Lt==="name"?t||"Loading...":Lt==="nativeName"?s?.native||t||"Loading...":Lt==="englishName"?s?.english||t||"Loading...":t||"Loading..."},[e.showMeta,Lt,e.loadingShowData]);x(()=>{mt&&mt!=="Loading..."&&e.currentEpisode&&(document.title=`► ${mt} Episode ${e.currentEpisode} - dango`)},[mt,e.currentEpisode]),x(()=>{const t=s=>{if(!s.target.closest('input, textarea, button, select, a, [role="button"], [contenteditable="true"]')&&(["arrowup","arrowdown","arrowleft","arrowright"].includes(s.key.toLowerCase())&&(k.setShowControls(!0),a.actions.inactivityTimer.current&&clearTimeout(a.actions.inactivityTimer.current),a.actions.inactivityTimer.current=window.setTimeout(()=>{k.setShowControls(!1)},1e3)),s.key.toLowerCase()==="n"&&Jt(),s.key.toLowerCase()==="t")){const c=!se;ge(c),localStorage.setItem("playerTheaterMode",c.toString())}};return document.addEventListener("keydown",t),()=>{document.removeEventListener("keydown",t)}},[k,a.actions.inactivityTimer,Jt,se]);const{setAvailableSubtitles:Xt,setActiveSubtitleTrack:qt}=k;x(()=>{const t=m.videoRef.current;if(!t)return;const s=()=>{const i=Array.from(t.textTracks).map(c=>({label:c.label,lang:c.language,src:void 0,mode:c.mode}));Xt(i)};return t.textTracks.addEventListener("addtrack",s),t.textTracks.addEventListener("removetrack",s),s(),()=>{t&&(t.textTracks.removeEventListener("addtrack",s),t.textTracks.removeEventListener("removetrack",s))}},[m.videoRef,Xt]),x(()=>{if(a.state.activeSubtitleTrack===null&&a.state.availableSubtitles.length>0&&localStorage.getItem("playerSubtitlesEnabled")!=="false"){let t=null;try{t=localStorage.getItem("playerLastSubtitle")}catch{}const s=Ht(a.state.availableSubtitles,{lastKey:t,enabled:!0});if(s<0){qt("off");return}const i=a.state.availableSubtitles[s];qt(i.lang||i.label)}},[a.state.activeSubtitleTrack,a.state.availableSubtitles,qt]),x(()=>{const t=m.videoRef.current;if(!t||a.state.availableSubtitles.length===0)return;const s=a.state.activeSubtitleTrack;if(!(localStorage.getItem("playerSubtitlesEnabled")!=="false")||s==="off"||s===null){Array.from(t.textTracks).forEach(N=>{N.mode="hidden"});return}let c=!1;if(Array.from(t.textTracks).forEach(N=>{const H=(N.language===s||N.label===s)&&!c;N.mode=H?"showing":"hidden",H&&(c=!0)}),!c&&t.textTracks.length>0){const N=Array.from(t.textTracks).find(de=>de.language==="en"||de.label==="English")||t.textTracks[0];N&&(N.mode="showing")}},[a.state.activeSubtitleTrack,a.state.availableSubtitles,m.videoRef]);const[Zt,Er]=q(0);x(()=>{const t=m.videoRef.current;if(!t)return;const s=()=>Er(t.clientHeight||0);s();const i=new ResizeObserver(s);return i.observe(t),()=>i.disconnect()},[m.videoRef,e.selectedSource,e.selectedLink]),x(()=>{const t="dynamic-subtitle-styles";let s=document.getElementById(t);s||(s=document.createElement("style"),s.id=t,document.head.appendChild(s));const i={fontSize:a.state.subtitleFontSize,position:a.state.subtitlePosition,bgOpacity:a.state.subtitleBgOpacity,bgColor:a.state.subtitleBgColor,textColor:a.state.subtitleTextColor,edge:a.state.subtitleEdge,bold:a.state.subtitleBold};s.textContent=ir(i);const c=m.videoRef.current;if(!c)return;const N=lr(a.state.subtitleFontSize,Zt||c.clientHeight||720);s.textContent=ir({...i,fontSize:N});const de=()=>{const y=Number(a.state.subtitlePosition),Z=isNaN(y)?0:Math.max(0,Math.min(100,y));return Math.max(0,Math.min(100,100-Z))},H=(y,Z)=>{try{const ae=y;ae.snapToLines=!1,ae.line=Z}catch{}},F=()=>{const y=N*16,Z=c.videoHeight||c.clientHeight||720,ae=c.videoWidth||c.clientWidth||1280;return{step:y*1.3/Z*100,chars:Math.max(20,Math.floor(ae/(y*.55)))}},oe=y=>{const Z=de(),ae=Array.from(y.activeCues??[]);if(ae.length<=1){ae.forEach(St=>H(St,Z));return}const{step:yt,chars:$t}=F();let sr=Z;for(let St=ae.length-1;St>=0;St--){const xr=String(ae[St].text??"").replace(/<[^>]*>/g,"").split(`
55
- `).reduce((Pr,Ar)=>Pr+Math.max(1,Math.ceil(Ar.length/$t)),0),or=sr-xr*yt;H(ae[St],Math.max(0,or)),sr=or-yt*.4}},fe=y=>{if(!y.cues)return;const Z=de();Array.from(y.cues).forEach(ae=>H(ae,Z)),y.mode==="showing"&&oe(y)},Me=()=>{Array.from(c.textTracks).forEach(fe)};Me();const J=y=>{const Z=y.target;Z.mode==="showing"&&oe(Z)};Array.from(c.textTracks).forEach(y=>{y.addEventListener("cuechange",J)});const Pe=()=>{Array.from(c.textTracks).forEach(y=>{y.removeEventListener("cuechange",J),y.addEventListener("cuechange",J)}),Me()};c.textTracks.addEventListener("addtrack",Pe),c.textTracks.addEventListener("removetrack",Pe);const be=Array.from(c.querySelectorAll("track")),X=()=>{Me()};return be.forEach(y=>{y.addEventListener("load",X)}),()=>{Array.from(c.textTracks).forEach(y=>{y.removeEventListener("cuechange",J)}),c.textTracks.removeEventListener("addtrack",Pe),c.textTracks.removeEventListener("removetrack",Pe),be.forEach(y=>{y.removeEventListener("load",X)})}},[a.state.subtitleFontSize,a.state.subtitlePosition,a.state.subtitleBgOpacity,a.state.subtitleBgColor,a.state.subtitleTextColor,a.state.subtitleEdge,a.state.subtitleBold,a.state.activeSubtitleTrack,a.state.availableSubtitles,e.selectedSource,e.selectedLink,m.videoRef,Zt]),x(()=>{if(!_)return;const t=m.videoRef.current,s=ze.current;if(!t||!s)return;const i=localStorage.getItem("playerSubtitlesEnabled")!=="false",c=a.state.activeSubtitleTrack;function N(){if(s.innerHTML="",!i||c==="off"||c===null)return;const F=Array.from(t.textTracks).find(X=>X.language===c||X.label===c);if(!F||F.mode!=="showing")return;const oe=rt/1e3;let fe;if(oe>0&&F.cues){const X=t.currentTime-oe;fe=Array.from(F.cues).filter(y=>y.startTime<=X&&X<=y.endTime)}else fe=Array.from(F.activeCues??[]);if(fe.length===0)return;const Me={fontSize:lr(a.state.subtitleFontSize,t.clientHeight||0),position:a.state.subtitlePosition,bgOpacity:a.state.subtitleBgOpacity,bgColor:a.state.subtitleBgColor,textColor:a.state.subtitleTextColor,edge:a.state.subtitleEdge,bold:a.state.subtitleBold},J=sn(Me),Pe=on(t,Me.position),be=Array.from(fe);be.forEach((X,y)=>{const Z=String(X.text??"");if(!an(Z).trim())return;const ae=document.createElement("div"),yt=(be.length-1-y)*1.7;ae.style.cssText=`${J}
56
- bottom: calc(${Pe}px + ${yt}em);`,ae.innerHTML=ln(Z),s.appendChild(ae)})}const de=()=>N(),H=()=>N();return Array.from(t.textTracks).forEach(F=>{F.addEventListener("cuechange",de)}),t.addEventListener("timeupdate",H),N(),()=>{Array.from(t.textTracks).forEach(F=>{F.removeEventListener("cuechange",de)}),t.removeEventListener("timeupdate",H),s.innerHTML=""}},[ne.isEnabled,ne.isWebGPUSupported,a.state.subtitleFontSize,a.state.subtitlePosition,a.state.subtitleBgOpacity,a.state.subtitleBgColor,a.state.subtitleTextColor,a.state.subtitleEdge,a.state.subtitleBold,a.state.activeSubtitleTrack,m.videoRef,_,rt]),x(()=>{try{localStorage.setItem("anime4kProfile",o)}catch{}},[o]);const wr=()=>{m.videoRef.current&&(m.videoRef.current.currentTime=e.resumeTime,m.videoRef.current.play()),g({type:"SET_STATE",payload:{showResumeModal:!1}})},kr=()=>{m.videoRef.current&&(m.videoRef.current.currentTime=0,m.videoRef.current.play()),g({type:"SET_STATE",payload:{showResumeModal:!1}})},er=O(()=>{it&&(Oe.current=!0),xt&&ot(!1),g({type:"SET_STATE",payload:{showResumeModal:!1}})},[g,it,xt]),Tr=O(()=>{if(ot(!1),m.videoRef.current)try{m.videoRef.current.currentTime=0,m.videoRef.current.play().catch(()=>{})}catch{}g({type:"SET_STATE",payload:{showResumeModal:!1}})},[g,m]),Cr=O(async()=>{try{await U(),g({type:"SET_STATE",payload:{showResumeModal:!1}}),w("/")}catch{}},[U,g,w]),tr=(t,s)=>r("div",{className:t,children:[r("button",{className:`${u.episodeNavBtn} ${u.secondary}`,onClick:Sr,disabled:!Wt,type:"button",children:[r(W,{name:"chevron-left",size:12}),"Prev EP"]}),r("button",{className:`${u.episodeNavBtn} ${u.primary}`,onClick:_t,disabled:!xe,type:"button",children:["Next EP",r(W,{name:"chevron-right",size:12})]}),s==="mobile"&&Fe&&r("button",{className:`${u.episodeNavBtn} ${u.episodePickerBtn}`,onClick:()=>M(!0),type:"button",children:[r(W,{name:"list-ul",size:12}),"Episodes"]})]});x(()=>{st&&(e.showResumeModal||T.length>0||D||Oe.current||it&&g({type:"SET_STATE",payload:{showResumeModal:!0}}))},[st,it,e.showResumeModal,T.length,D,g]);const Mr=t=>{g({type:"SET_STATE",payload:{isAutoplayEnabled:t}}),fn(t)},rr=!!(e.currentEpisode&&e.watchedEpisodes.includes(e.currentEpisode)),Rr=e.selectedProvider!=="megaplay"||e.selectedSource?.type==="iframe",zt=f(A);zt.current=A;const nr=f("");x(()=>{const t=m.videoRef.current;if(wt(!1),ot(!1),!t||e.selectedSource?.type==="iframe")return;const s=()=>{const i=t.duration,c=t.currentTime;if(!i||Number.isNaN(i)){wt(!1),ot(!1);return}const N=c/i;if(i-c<=60){const de=T.findIndex(oe=>Rt(oe,n,e.showMeta?.id)&&oe.episodeNumber===e.currentEpisode),H=T.length>0?de>=0?T[de+1]||null:T[0]:null,F=H?`${H.showId}:${H.episodeNumber}`:Vt?`${n}:${xe}`:"";F&&nr.current!==F&&(nr.current=F,H?zt.current(H.episodeNumber,H.showId):zt.current(xe))}wt(Vt&&N>=.8),ot(c>=Math.max(i*.98,i-10))};return s(),t.addEventListener("timeupdate",s),t.addEventListener("loadedmetadata",s),()=>{t.removeEventListener("timeupdate",s),t.removeEventListener("loadedmetadata",s)}},[m.videoRef,Vt,e.currentEpisode,e.selectedSource,xe,n,T,e.showMeta?.id]);const _r=O(async()=>{if(!n||!e.currentEpisode||!e.showMeta.name||$)return;const t=m.videoRef.current?.duration,s=Math.max(t||0,e.resumeDuration||0,(e.showMeta.lengthMin||0)*60,1);await ve(e.currentEpisode,s)},[n,e.currentEpisode,e.showMeta,e.resumeDuration,ve,$,m.videoRef]);if(e.error&&!e.showMeta.name&&e.videoSources.length===0&&e.episodes.length===0)return r("p",{className:"error-message",children:["Error: ",e.error]});const lt=e.loadingShowData||e.loadingVideo,Nr=t=>{se&&t.target===t.currentTarget&&(ge(!1),localStorage.setItem("playerTheaterMode","false"))};return e.showMeta?.isAdult===!0&&!C?r("div",{className:Ue.playerPageLayout,children:r(Ae,{isOpen:!0,title:"Content Warning",onClose:()=>w("/home"),children:r("div",{style:{padding:"1rem",textAlign:"center"},children:[r("p",{children:"This title contains mature content intended for adult audiences."}),r("p",{children:["By proceeding, you confirm that you are ",r("strong",{children:"18 years of age or older"})," (or the age of majority in your jurisdiction) and wish to view this content."]}),r("div",{style:{marginTop:"1rem",display:"flex",gap:"10px",justifyContent:"center"},children:[r(Ze,{variant:"secondary",onClick:()=>w("/home"),children:"Go Back"}),r(Ze,{onClick:S,children:"I'm 18+, Continue"})]})]})})}):r("div",{className:`${Ue.playerPageLayout} ${se?Ue.theaterMode:""}`,onClick:Nr,children:[r(Ae,{isOpen:jt,onClose:er,title:it?"Show Completed!":"Resume Playback?",width:"sm",children:it?r(Et,{children:[r(Ae.Body,{children:r("p",{children:"Congratulations! You've finished the final episode of this series."})}),r(Ae.Actions,{children:r(Ze,{onClick:Cr,disabled:De,children:De?"Saving...":"Move to Completed"})})]}):r(Et,{children:[r(Ae.Body,{children:r("p",{children:["You were watching at ",r("strong",{children:a.actions.formatTime(e.resumeTime)}),". Would you like to continue?"]})}),r(Ae.Actions,{children:[r(Ze,{variant:"secondary",onClick:kr,children:"Start Over"}),r(Ze,{onClick:wr,children:"Resume"})]})]})}),r(Ae,{isOpen:xt,onClose:er,title:"Episode Completed",width:"sm",children:[r(Ae.Body,{children:r("p",{children:["You've already watched Episode ",r("strong",{children:e.currentEpisode}),".",xe?" Would you like to watch the next episode?":""]})}),r(Ae.Actions,{children:[r(Ze,{variant:"secondary",onClick:Tr,children:"Replay"}),xe&&r(Ze,{onClick:_t,children:`Watch EP ${xe}`})]})]}),r(Ae,{isOpen:!!vt,onClose:gr,title:"Direct stream failed",width:"sm",children:[r(Ae.Body,{children:[r("p",{children:[r("strong",{children:e.selectedProvider}),"'s direct stream failed for this episode."]}),vt?.retryFailed&&r("p",{children:"No working direct stream was found on the other providers either."}),r("p",{children:["You can continue with the embedded (iframe) player, but embedded players may show"," ",r("strong",{children:"ads and pop-ups"}),"."]}),r("label",{style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"0.75rem",cursor:"pointer"},children:[r("input",{type:"checkbox",checked:Xe,onChange:t=>Tt(t.target.checked)}),"Remember my choice"]})]}),r(Ae.Actions,{children:[r(Ze,{variant:"secondary",onClick:br,children:"Continue with iframe"}),r(Ze,{onClick:yr,disabled:gt,children:gt?"Searching…":"Try another provider"})]})]}),r(Gr,{isOpen:!!e.showCookieModal,onClose:()=>g({type:"SET_STATE",payload:{showCookieModal:!1}}),onSuccess:()=>{K.invalidateQueries({queryKey:["video-sources",n,e.currentEpisode,e.selectedProvider,e.currentMode]})}}),!se&&r("aside",{ref:Be,className:Ue.episodeSidebar,children:e.loadingShowData?r(cn,{variant:"sidebar"}):r(un,{episodes:e.episodes,currentEpisode:e.currentEpisode,watchedEpisodes:e.watchedEpisodes,onEpisodeClick:t=>w(`/watch/${n}/${t}`)})}),r("div",{className:Ue.playerMain,children:[r("div",{className:`${u.videoContainer} ${a.state.isFullscreen?"":Ue.videoPlayerWrapper} ${a.state.isFullscreen?u.fullscreenActive:""}`,style:{...pt?{visibility:"hidden"}:{}},onContextMenu:t=>t.preventDefault(),children:r(us,{player:a,isAutoplayEnabled:e.isAutoplayEnabled,onAutoplayChange:Mr,fallbackChoice:Ct,onFallbackChoiceChange:dt,showNextEpisodeButton:!pt&&nt&&T.length===0,onNextEpisode:_t,videoSources:e.videoSources,selectedSource:e.selectedSource,selectedLink:e.selectedLink,onSourceChange:(t,s)=>{m.videoRef.current&&!isNaN(m.videoRef.current.currentTime)&&(ee.current=m.videoRef.current.currentTime),le(t.sourceName),g({type:"SET_STATE",payload:{selectedSource:t,selectedLink:s,showResumeModal:e.showResumeModal&&t.type!=="iframe"}})},loadingVideo:e.loadingVideo,skipIntervals:e.skipIntervals,animeTitle:mt,episodeNumber:e.currentEpisode,isTheaterMode:se,onTheaterModeToggle:()=>{const t=!se;ge(t),localStorage.setItem("playerTheaterMode",t.toString())},anime4kEnabled:ne.isEnabled,onAnime4kToggle:ne.toggle,anime4kSupported:ne.isWebGPUSupported,anime4kProfile:o,onAnime4kProfileChange:d,anime4kInitializing:ne.isInitializing,anime4kError:ne.error,videoDelayEnabled:Q,onVideoDelayToggle:t=>{j(t);try{localStorage.setItem("playerVideoDelayEnabled",String(t))}catch{}},videoDelayMs:p,onVideoDelayChange:Ke,onCalibrateAvSync:ut,isInteractingExtra:kt||te,className:dn.shellFill,hideChrome:e.selectedSource?.type==="iframe",overlays:r(Et,{children:[a.state.isSpeedBoostActive&&r("div",{className:u.speedBoostBadge,"aria-hidden":"true",children:[r("span",{children:"2x"}),r(W,{name:"forward",size:12})]}),at!==null&&D?.nextItem&&r("div",{className:u.queueCountdown,children:["Queue next in ",at,"s"]})]}),children:[I&&r("div",{className:`${u.skipIndicatorContainer} ${I.side==="left"?u.leftSkip:u.rightSkip} `,children:r("div",{className:u.skipBubble,children:[r("div",{className:u.skipIcon,children:I.side==="left"?r(W,{name:"backward"}):r(W,{name:"forward"})}),r("div",{className:u.skipText,children:"15s"})]})}),lt&&r("div",{className:u.loadingOverlay,children:r("div",{className:u.loadingDots,children:[r("div",{className:u.dot}),r("div",{className:u.dot}),r("div",{className:u.dot})]})}),a.state.isBuffering&&!lt&&e.selectedSource?.type!=="iframe"&&r("div",{className:u.bufferingOverlay,children:r("div",{className:u.bufferingSpinner})}),e.selectedSource?.type==="iframe"?!lt&&r("iframe",{src:e.selectedLink?.link,className:u.videoIframe,allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0,sandbox:e.selectedSource.sandbox?`${e.selectedSource.sandbox} allow-fullscreen allow-popups allow-popups-to-escape-sandbox`:void 0}):r(Et,{children:[!lt&&e.videoSources.length===0&&r("div",{className:u.errorOverlay,children:[r("p",{children:["No sources found for this episode with ",e.selectedProvider,"."]}),r("p",{className:u.errorSubtext,children:"Please try selecting a different provider below."}),r("button",{className:u.retryButton,onClick:()=>window.location.reload(),"data-speed-boost-ignore":"true",style:{marginTop:8},children:"Retry"})]}),!lt&&e.videoSources.length>0&&r("video",{ref:m.videoRef,controls:a.state.useNativeControls,playsInline:!0,"webkit-playsinline":"true",disablePictureInPicture:!0,disableRemotePlayback:!0,onPlay:k.onPlay,onPause:k.onPause,onLoadedMetadata:k.onLoadedMetadata,onTimeUpdate:()=>{we||(k.onTimeUpdate(),D&&m.videoRef.current&&m.videoRef.current.currentTime<m.videoRef.current.duration-1&&(ue(null),me(null)))},onProgress:k.onProgress,onVolumeChange:k.onVolumeChange,onWaiting:k.onWaiting,onPlaying:k.onPlaying,onError:Yt,onContextMenu:t=>t.preventDefault(),className:_?u.videoElementHidden:""}),ne.isWebGPUSupported&&!lt&&e.videoSources.length>0&&r("canvas",{ref:Ie,className:`${u.upscalerCanvas} ${Ye?u.upscalerActive:""}`}),!Ye&&!lt&&e.videoSources.length>0&&r("canvas",{ref:ft,className:`${u.upscalerCanvas} ${h?u.upscalerActive:""}`}),ne.isEnabled&&ne.isWebGPUSupported&&ne.isInitializing&&r("div",{className:u.upscalerStatusBadge,children:"Preparing upscaler…"}),_&&r("div",{ref:ze,className:u.subtitleOverlay}),r(pn,{isOpen:te,ms:p,onChange:Ke,onApply:pe,onClose:re,testClipActive:we,onTestClip:je})]})]})}),!se&&r(mn,{}),!se&&r(Et,{children:[Mt&&T.length===0?r(ds,{count:3}):r(yn,{title:"Queue",items:T,currentShowId:n,currentEpisode:e.currentEpisode,onNextQueue:Qt,onRemove:t=>We.mutate({showId:t.showId,episodeNumber:t.episodeNumber}),onClear:()=>he.mutate(),showClearAll:!0,onReorder:t=>Ot.mutate(t.map(s=>({id:s.id,showId:s.showId,episodeNumber:s.episodeNumber})))}),r("div",{className:u.providerAndEpisodeRow,children:[r(ys,{selectedProvider:e.selectedProvider,isAdult:e.showMeta?.isAdult,options:R,onProviderChange:t=>{Je.current=!1,ke.current=[],Le.current=!1,_e(null),g({type:"SET_STATE",payload:{selectedProvider:t,videoSources:[],selectedSource:null,selectedLink:null,loadingVideo:!0}}),localStorage.setItem("preferredProvider",t)}}),tr(`${u.episodeActions} ${u.desktopEpisodeActions}`,"desktop")]}),lt?r("div",{className:u.sourceLoader,children:r("div",{className:u.spinner})}):r(Et,{children:r(Es,{videoSources:e.videoSources,selectedSource:e.selectedSource,selectedLink:e.selectedLink,onSourceChange:t=>{m.videoRef.current&&!isNaN(m.videoRef.current.currentTime)&&(ee.current=m.videoRef.current.currentTime);const i=(t.links||[]).sort((c,N)=>(parseInt(N.resolutionStr)||0)-(parseInt(c.resolutionStr)||0))[0]||null;le(t.sourceName),g({type:"SET_STATE",payload:{selectedSource:t,selectedLink:i,showResumeModal:e.showResumeModal&&t.type!=="iframe"}})},onLinkChange:t=>{e.selectedSource&&(le(e.selectedSource.sourceName),g({type:"SET_STATE",payload:{selectedLink:t}}))}})}),r("div",{className:Ue.playerInfoContainer,children:[r("div",{className:Ue.playerInfoHeader,children:[r("div",{className:Ue.playerAnimeCard,children:r("img",{src:Hr(e.showMeta.thumbnail||""),alt:mt,loading:"lazy",decoding:"async",onError:t=>{t.target.src="/placeholder.svg"}})}),r("div",{className:Ue.videoTitleSection,children:[r("div",{className:u.titleContainer,children:[r("h1",{children:mt}),r("div",{className:u.scheduleInfo,children:[e.showMeta.status&&r("span",{className:u.status,children:e.showMeta.status}),e.showMeta.nextEpisodeAirDate&&r("span",{className:u.nextEpisode,children:["Next episode: ",e.showMeta.nextEpisodeAirDate]})]})]}),r("div",{className:u.controls,children:[r("button",{className:`${u.watchlistBtn} ${e.inWatchlist?u.inList:""}`,onClick:V,children:[e.inWatchlist?r(W,{name:"check",size:14}):r(W,{name:"plus",size:14}),e.inWatchlist?"In Watchlist":"Add to Watchlist"]}),r(En,{showId:n,showName:e.showMeta.name||e.showMeta.names?.romaji,showThumbnail:e.showMeta.thumbnail,nativeName:e.showMeta.names?.native,englishName:e.showMeta.names?.english,showType:e.showMeta.type,className:`${u.watchlistBtn} ${u.queueBtn}`,activeClassName:u.queueActive}),Rr&&r("button",{className:`${u.watchlistBtn} ${u.markWatchedBtn} ${rr?u.markWatchedDone:""}`,onClick:_r,disabled:$||!e.currentEpisode,children:[r(W,{name:"check",size:14}),$?"Saving...":rr?"Watched":"Mark Watched"]}),r("button",{className:`${u.watchlistBtn} ${u.modeToggleBtn} ${e.currentMode==="dub"?u.modeToggleActive:""}`,onClick:()=>{const t=e.currentMode==="dub"?"sub":"dub";Je.current=!1,ke.current=[],Le.current=!1,_e(null),g({type:"SET_MODE",payload:t}),localStorage.setItem("preferredMode",t)},type:"button","aria-pressed":e.currentMode==="dub",children:e.currentMode==="dub"?"DUB":"SUB"}),r("button",{className:`${u.watchlistBtn} ${u.modeToggleBtn} ${a.state.useNativeControls?u.modeToggleActive:""}`,onClick:()=>{const t=!a.state.useNativeControls;a.actions.setUseNativeControls(t),localStorage.setItem("playerUseNativeControls",t.toString())},type:"button",children:a.state.useNativeControls?"NATIVE: ON":"NATIVE: OFF"})]})]})]}),tr(`${u.episodeActions} ${u.mobileEpisodeActions}`,"mobile"),r("div",{className:u.descriptionSection,children:[r("h3",{children:"Synopsis"}),r(kn,{text:e.showMeta.description?e.showMeta.description.replace(/<[^>]*>?/gm,""):"",emptyText:"No description available."})]}),r("button",{className:u.detailsToggleBtn,onClick:z,children:[e.showCombinedDetails?r(W,{name:"chevron-up"}):r(W,{name:"chevron-down"}),e.showCombinedDetails?"Hide Details":"Show Details"]}),e.showCombinedDetails&&r(wn,{showMeta:e.showMeta,styles:u})]})]})]}),r(hn,{isOpen:kt,onClose:()=>M(!1),episodes:e.episodes,currentEpisode:e.currentEpisode,watchedEpisodes:e.watchedEpisodes,onEpisodeClick:t=>{M(!1),w(`/watch/${n}/${t}`)}})]})};export{Xs as default};
@@ -1 +0,0 @@
1
- import{g as I,d as J,T as X,u as e}from"./vendor-core-8R2fFbyN.js";import{I as o}from"./vendor-icons-CDMuNDeL.js";import{S as Y,O as _,a as Z,A as ee}from"./OptionListMenu-CkK2BvEz.js";import"./AvSyncCalibrator-oK6LlG61.js";import"./index-lo-bz7f2.js";import"./vendor-query-BXRECSI6.js";const ne="_settingsPanel_y6z3b_1",te="_header_y6z3b_33",ae="_backBtn_y6z3b_56",se="_contentWrapper_y6z3b_76",le="_menuContent_y6z3b_82",ie="_menuItem_y6z3b_89",re="_selected_y6z3b_114",ce="_currentValue_y6z3b_134",oe="_menuNote_y6z3b_141",de="_menuError_y6z3b_150",n={settingsPanel:ne,header:te,backBtn:ae,contentWrapper:se,menuContent:le,menuItem:ie,selected:re,currentValue:ce,menuNote:oe,menuError:de},me=(A,z)=>{const{isOpen:b,onClose:ue,videoSources:he,currentSource:v,currentLink:k,onSourceChange:w,subtitles:$,activeSubtitleTrack:y,onSubtitleChange:P,subtitleSettings:V,onSubtitleSettingsChange:O,useNativeControls:g,onNativeControlsToggle:U,anime4kEnabled:u,onAnime4kToggle:B,anime4kSupported:C,anime4kProfile:i,onAnime4kProfileChange:h,anime4kInitializing:E,anime4kError:f,videoDelayEnabled:N,onVideoDelayToggle:T,videoDelayMs:S,onVideoDelayChange:D,onCalibrateAvSync:x,isAutoSkipEnabled:d,onAutoSkipChange:L,isAutoplayEnabled:m,onAutoplayChange:M,fallbackChoice:p,onFallbackChoiceChange:W}=A,[a,r]=J("main");I.useEffect(()=>{if(!b){const t=setTimeout(()=>r("main"),300);return()=>clearTimeout(t)}},[b]);const G=()=>e("div",{className:n.menuContent,children:[e("button",{className:n.menuItem,onClick:()=>r("quality"),children:[e("span",{children:"Quality"}),e("span",{className:n.currentValue,children:k?.resolutionStr||"Auto"})]}),e("button",{className:n.menuItem,onClick:()=>r("subtitles"),children:[e("span",{children:"Subtitles"}),e("span",{className:n.currentValue,children:y||"Off"})]}),e("button",{className:n.menuItem,onClick:()=>r("subtitle-style"),children:e("span",{children:"Subtitle Style"})}),e("button",{className:`${n.menuItem} ${g?n.selected:""}`,onClick:()=>{const t=!g;U(t),localStorage.setItem("playerUseNativeControls",t.toString())},children:[e("span",{children:"Native Controls"}),g&&e(o,{name:"check",size:12})]}),C&&e("button",{className:`${n.menuItem} ${u?n.selected:""}`,onClick:()=>{B(!u)},children:[e("span",{children:"Anime4K Upscaler"}),u&&e(o,{name:"check",size:12})]}),C&&u&&e("button",{className:n.menuItem,onClick:()=>r("upscaler"),children:e("span",{children:"Upscaler Settings"})}),e("button",{className:n.menuItem,onClick:()=>r("av-sync"),children:[e("span",{children:"A/V Sync"}),e("span",{className:n.currentValue,children:N?`${S}ms`:"Off"})]}),e("button",{className:n.menuItem,onClick:()=>r("playback"),children:[e("span",{children:"Playback"}),e("span",{className:n.currentValue,children:[d?"Auto-skip On":null,m?"Autoplay On":null].filter(Boolean).join(" • ")||"Off"})]})]}),j=()=>{const t=v?.links.sort((s,c)=>(parseInt(c.resolutionStr)||0)-(parseInt(s.resolutionStr)||0))||[];return e("div",{className:n.menuContent,children:e(_,{classes:{item:n.menuItem,active:n.selected},options:t.map(s=>({key:s.resolutionStr,label:s.resolutionStr,selected:k?.resolutionStr===s.resolutionStr})),onSelect:s=>{const c=t.find(l=>l.resolutionStr===s);c&&w(v,c)}})})},q=()=>e("div",{className:n.menuContent,children:e(_,{classes:{item:n.menuItem,active:n.selected},options:[{key:"off",label:"Off",selected:y==="off"},...$.map(t=>({key:t.label||t.lang,label:t.label,selected:y===(t.label||t.lang)}))],onSelect:t=>P(t)})}),F=()=>e("div",{className:n.menuContent,children:e(Z,{classes:{item:n.menuItem,active:n.selected},values:V,onChange:O})}),Q=X(()=>{try{const s=navigator.userAgentData?.brands?.map(l=>l.brand.toLowerCase())??[];if(s.length>0)return s.some(l=>l.includes("chromium")||l.includes("chrome")||l.includes("edge")||l.includes("opera")||l.includes("brave")||l.includes("vivaldi"));const c=navigator.userAgent.toLowerCase();return c.includes("chrome")||c.includes("chromium")||c.includes("edg")}catch{return!0}},[]),R=()=>e("div",{className:n.menuContent,children:[E&&e("div",{className:n.menuNote,role:"status",children:"Preparing GPU, this can take a few seconds…"}),f&&e("div",{className:n.menuError,role:"alert",children:["Upscaler failed: ",f]}),!Q&&e("div",{className:n.menuNote,children:"Upscaling performs best in Chrome-based browsers."}),e("button",{className:`${n.menuItem} ${i==="low"?n.selected:""}`,onClick:()=>h("low"),children:[e("div",{children:[e("div",{children:"Low"}),e("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"Lightest, best for weaker GPUs"})]}),i==="low"&&e(o,{name:"check",size:12})]}),e("button",{className:`${n.menuItem} ${i==="balanced"?n.selected:""}`,onClick:()=>h("balanced"),children:[e("div",{children:[e("div",{children:"Balanced"}),e("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"Source + display aware"})]}),i==="balanced"&&e(o,{name:"check",size:12})]}),e("button",{className:`${n.menuItem} ${i==="high"?n.selected:""}`,onClick:()=>h("high"),children:[e("div",{children:[e("div",{children:"High"}),e("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"Aggressive, needs strong GPU"})]}),i==="high"&&e(o,{name:"check",size:12})]}),e("button",{className:`${n.menuItem} ${i==="denoise"?n.selected:""}`,onClick:()=>h("denoise"),children:[e("div",{children:[e("div",{children:"Denoise"}),e("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"Denoise + upscale noisy, compressed sources"})]}),i==="denoise"&&e(o,{name:"check",size:12})]})]}),H=()=>e("div",{className:n.menuContent,children:[e("button",{type:"button",className:`${n.menuItem} ${d?n.selected:""}`,onClick:()=>L(!d),"aria-pressed":d,children:[e("span",{children:"Auto-skip openings and endings"}),e("span",{className:n.currentValue,children:d?"On":"Off"})]}),e("div",{className:n.menuNote,children:"Automatically jump past opening, ending and recap segments when detected."}),e("button",{type:"button",className:`${n.menuItem} ${m?n.selected:""}`,onClick:()=>M(!m),"aria-pressed":m,children:[e("span",{children:"Autoplay next episode"}),e("span",{className:n.currentValue,children:m?"On":"Off"})]}),e("div",{className:n.menuNote,children:"Automatically start the next episode when this one ends."}),e("button",{type:"button",className:n.menuItem,onClick:()=>W(p==="ask"?"iframe":p==="iframe"?"retry":"ask"),children:[e("span",{children:"Failed direct stream"}),e("span",{className:n.currentValue,children:p==="iframe"?"Use iframe":p==="retry"?"Try provider":"Ask me"})]}),e("div",{className:n.menuNote,children:"When a direct stream fails: ask each time, go straight to the embedded player (may show ads), or automatically try another provider."})]}),K=()=>e("div",{className:n.menuContent,children:e(ee,{classes:{item:n.menuItem,active:n.selected,note:n.menuNote},enabled:N,delayMs:S,onToggle:T,onDelayChange:D,onCalibrate:x})});return b?e(Y,{classes:{panel:n.settingsPanel,header:n.header,backBtn:n.backBtn,title:"",content:n.contentWrapper},title:a==="main"?"Settings":a.charAt(0).toUpperCase()+a.slice(1).replace("-"," "),titleTag:"h3",showBack:a!=="main",onBack:()=>r("main"),panelRef:z,onPanelClick:t=>t.stopPropagation(),children:[a==="main"&&G(),a==="quality"&&j(),a==="subtitles"&&q(),a==="subtitle-style"&&F(),a==="upscaler"&&R(),a==="av-sync"&&K(),a==="playback"&&H()]}):null},Ce=I.forwardRef(me);export{Ce as default};
@@ -1 +0,0 @@
1
- import{h as k,o as pe,a as ge,d as o,A as me,g as ve,u as a}from"./vendor-core-8R2fFbyN.js";import{I as d}from"./vendor-icons-CDMuNDeL.js";import{A as fe}from"./AnimeCard-OKU7LaSN.js";import{S as be}from"./SkeletonGrid-Du10CNfq.js";import{u as Le,r as Ae,P as ee,B as w,Q as ye}from"./index-lo-bz7f2.js";import{E as Se}from"./ErrorMessage-z4f4WGgP.js";import{s as t}from"./Search.module-CMEai-B-.js";import"./useAnimeInfoData-CbNnHRj8.js";import"./vendor-query-BXRECSI6.js";import"./QueueOptionsButton-DKWi-9kd.js";import"./vendor-ui-CUDCvRS_.js";import"./MediaCard-DszKDA4s.js";import"./useIsMobile-Dm_b6Ob3.js";const Ne=[{value:"ALL",label:"All Types"},{value:"TV",label:"TV Series"},{value:"Movie",label:"Movie"},{value:"OVA",label:"OVA"},{value:"ONA",label:"ONA"},{value:"TV_SHORT",label:"TV Short"},{value:"SPECIAL",label:"Special"},{value:"ADULT",label:"Mature"}],Ce=[{value:"ALL",label:"All Seasons"},{value:"Winter",label:"Winter"},{value:"Spring",label:"Spring"},{value:"Summer",label:"Summer"},{value:"Fall",label:"Fall"}],Te=[{value:"ALL",label:"All Countries"},{value:"JP",label:"Japan"},{value:"CN",label:"China"}],Ee=[{value:"POPULARITY_DESC",label:"Popularity"},{value:"TRENDING_DESC",label:"Trending"},{value:"SCORE_DESC",label:"Score"},{value:"START_DATE_DESC",label:"Newest"},{value:"START_DATE_ASC",label:"Oldest"},{value:"EPISODES_DESC",label:"Most Episodes"},{value:"FAVOURITES_DESC",label:"Favourites"}],Ie=[{value:"RELEASING",label:"Currently Airing"},{value:"FINISHED",label:"Finished"},{value:"NOT_YET_RELEASED",label:"Not Yet Released"},{value:"CANCELLED",label:"Cancelled"},{value:"HIATUS",label:"Hiatus"}];function Me(){k(()=>{document.title="Search - dango"},[]);const[r,ae]=pe(),te=ge(),[m,B]=o(r.get("query")||""),[c,_]=o(parseInt(r.get("page")||"1")),[h,A]=o(r.get("type")||"ALL"),[v,y]=o(r.get("season")||"ALL"),[f,S]=o(r.get("year")||"ALL"),[G,I]=o(r.get("country")||"ALL"),[Y,le]=o(r.get("provider")||"anilist"),[U,P]=o(r.get("sortBy")||"POPULARITY_DESC"),[F,x]=o(r.get("status")||""),[N,ne]=o(!1),[re,M]=o(null);k(()=>{let e=!1;return fetch("/api/anilist-status").then(n=>n.json()).then(n=>{e||M(n.available)}).catch(()=>{e||M(!0)}),()=>{e=!0}},[]);const{lowEndMode:se}=Le(),D=me(null),{data:ie}=Ae(),$=ie?.genres||[],[b,C]=o(()=>{const e={},n=r.get("genres")?.split(",").map(l=>l.trim()).filter(Boolean)||[],s=r.get("excludeGenres")?.split(",").map(l=>l.trim()).filter(Boolean)||[];return n.forEach(l=>l&&(e[l]="include")),s.forEach(l=>l&&(e[l]="exclude")),e}),z=new URLSearchParams(r);z.delete("page");const j=z.toString(),{data:L=[],isLoading:g,isError:oe,error:ce}=ee(j,c,14),{data:V}=ee(j,c+1,14),[O,ue]=o(!1),T=ve.useMemo(()=>Y==="anilist"&&h==="ADULT"||O?L:L.filter(e=>!(e.isAdult||e.rating==="R+"||e.rating==="Rx"||e.rating?.includes("17+"))),[L,O,Y,h]);k(()=>{B(r.get("query")||""),A(r.get("type")||"ALL"),y(r.get("season")||"ALL"),S(r.get("year")||"ALL"),I(r.get("country")||"ALL"),le(r.get("provider")||"anilist"),P(r.get("sortBy")||"POPULARITY_DESC"),x(r.get("status")||""),_(parseInt(r.get("page")||"1"));const e={},n=r.get("genres")?.split(",").map(l=>l.trim()).filter(Boolean)||[],s=r.get("excludeGenres")?.split(",").map(l=>l.trim()).filter(Boolean)||[];n.forEach(l=>l&&(e[l]="include")),s.forEach(l=>l&&(e[l]="exclude")),C(e)},[r]);const u=(e=1,n={})=>{ye();const s=n.type??h,l=n.status??F,H=n.season??v,q=n.year??f,J=n.country??G,K=n.sort??U,Q=n.genreState??b,he=n.showMature??O,i=new URLSearchParams;m.trim()&&i.set("query",m.trim()),s!=="ALL"&&i.set("type",s),l&&i.set("status",l),H!=="ALL"&&i.set("season",H),q!=="ALL"&&i.set("year",q),J!=="ALL"&&i.set("country",J),K!=="POPULARITY_DESC"&&i.set("sortBy",K);const X=Object.entries(Q).filter(([,p])=>p==="include").map(([p])=>p),Z=Object.entries(Q).filter(([,p])=>p==="exclude").map(([p])=>p);X.length>0&&i.set("genres",X.join(",")),Z.length>0&&i.set("excludeGenres",Z.join(",")),s!=="ADULT"&&!he&&i.set("adult","false"),i.set("provider","anilist"),e>1&&i.set("page",e.toString()),ae(i),e!==c&&_(e)},E=e=>{if(u(e),D.current){const n=D.current.getBoundingClientRect().top+window.scrollY-100;window.scrollTo({top:n,behavior:"smooth"})}},R=new Date().getFullYear(),de=[{value:"ALL",label:"All Years"},...Array.from({length:R-1980+1},(e,n)=>({value:String(R-n),label:String(R-n)}))],W=L.length>=14&&V&&V.length>0;return a("div",{className:"page-container",children:[a("div",{className:t.header,children:[a("h1",{className:t.pageTitle,children:"Search Anime"}),a("p",{className:t.pageSubtitle,children:"Search through thousands of titles and discover your next favorite"})]}),a("div",{className:t.filterContainer,children:[a("div",{className:t.searchBarWrapper,children:[a("div",{className:t.inputIconWrapper,children:[a(d,{name:"search",className:t.searchIcon}),a("input",{type:"text","data-virtual-keyboard":"true",className:t.searchInput,placeholder:"Search by title, character, or studio...",value:m,onInput:e=>B(e.currentTarget.value),onKeyDown:e=>e.key==="Enter"&&u()})]}),a("div",{className:t.searchActions,children:[a(w,{onClick:()=>u(),className:t.searchBtn,children:"Search"}),a("button",{className:`${t.filterToggleBtn} ${N?t.active:""}`,onClick:()=>ne(!N),children:[a(d,{name:"filter",size:14}),a("span",{children:"Filters"}),N?a(d,{name:"chevron-up",size:12}):a(d,{name:"chevron-down",size:12})]})]})]}),a("div",{className:`${t.advancedFilters} ${N?t.show:""}`,children:[a("div",{className:t.filterDivider}),a("div",{className:t.filterGrid,children:[a("div",{className:t.filterItem,children:[a("label",{children:"Type"}),a("select",{value:h,onChange:e=>{if(e.currentTarget.value==="ADULT"){te("/mature?provider=mal");return}A(e.currentTarget.value)},children:Ne.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Status"}),a("select",{value:F,onChange:e=>x(e.currentTarget.value),children:[a("option",{value:"",children:"All Status"}),Ie.map(e=>a("option",{value:e.value,children:e.label},e.value))]})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Season"}),a("select",{value:v,onChange:e=>y(e.currentTarget.value),children:Ce.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Year"}),a("select",{value:f,onChange:e=>S(e.currentTarget.value),children:de.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:["Country",re===!1&&a("span",{style:{display:"block",fontSize:"0.75rem",color:"var(--text-muted)",fontWeight:400},children:"AniList only — ignored by fallback providers"})]}),a("select",{value:G,onChange:e=>I(e.currentTarget.value),children:Te.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Sort By"}),a("select",{value:U,onChange:e=>P(e.currentTarget.value),children:Ee.map(e=>a("option",{value:e.value,children:e.label},e.value))})]})]}),$.length>0&&a("div",{className:t.genreSection,children:[a("label",{className:t.genreLabel,children:"Genres"}),a("div",{className:t.genreContainer,children:$.map(e=>a("button",{className:`${t.genreButton} ${t[b[e]||""]}`,onClick:()=>{C(n=>{const s=n[e],l={...n};return s==="include"?l[e]="exclude":s==="exclude"?delete l[e]:l[e]="include",l})},children:e},e))})]}),a("div",{className:t.filterActions,children:[a(w,{variant:"secondary",onClick:()=>{C({}),A("ALL"),y("ALL"),S("ALL"),I("ALL"),P("POPULARITY_DESC"),x(""),ue(!1),u(1,{type:"ALL",status:"",season:"ALL",year:"ALL",country:"ALL",sort:"POPULARITY_DESC",genreState:{},showMature:!1})},children:"Reset All"}),a(w,{onClick:()=>u(),className:t.applyBtn,children:"Apply Filters"})]})]})]}),oe&&a(Se,{message:ce?.message||"Error"}),(h!=="ALL"||v!=="ALL"||f!=="ALL"||Object.keys(b).length>0)&&a("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center",marginBottom:"1.5rem"},children:[a("span",{style:{fontSize:"0.8rem",color:"var(--text-muted)",fontWeight:600},children:"Active Filters:"}),h!=="ALL"&&a("span",{className:"badge badge-secondary",style:{display:"inline-flex",alignItems:"center",gap:"6px"},children:["Type: ",h,a("button",{onClick:e=>{e.stopPropagation(),e.preventDefault(),A("ALL"),u(1,{type:"ALL"})},style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"✕"})]}),v!=="ALL"&&a("span",{className:"badge badge-secondary",style:{display:"inline-flex",alignItems:"center",gap:"6px"},children:["Season: ",v,a("button",{onClick:e=>{e.stopPropagation(),e.preventDefault(),y("ALL"),u(1,{season:"ALL"})},style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"✕"})]}),f!=="ALL"&&a("span",{className:"badge badge-secondary",style:{display:"inline-flex",alignItems:"center",gap:"6px"},children:["Year: ",f,a("button",{onClick:e=>{e.stopPropagation(),e.preventDefault(),S("ALL"),u(1,{year:"ALL"})},style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"✕"})]}),Object.entries(b).map(([e,n])=>a("span",{className:`badge ${n==="include"?"badge-primary":"badge-danger"}`,style:{display:"inline-flex",alignItems:"center",gap:"6px"},children:[n==="include"?`+ ${e}`:`- ${e}`,a("button",{onClick:s=>{s.stopPropagation(),s.preventDefault();const l={...b};delete l[e],C(l),u(1,{genreState:l})},style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"✕"})]},e))]}),a("div",{className:t.resultsHeader,ref:D,children:[a("h2",{className:t.resultsTitle,children:m?`Search Results for "${m}"`:"Discover Anime"}),T.length>0&&a("div",{className:t.pagination,children:[a("button",{className:t.pageBtn,onClick:()=>E(c-1),disabled:c===1||g,"aria-label":"Previous page",children:a(d,{name:"chevron-left",size:14})}),a("span",{className:t.pageInfo,children:["Page ",a("strong",{children:c})]}),a("button",{className:t.pageBtn,onClick:()=>E(c+1),disabled:!W||g,"aria-label":"Next page",children:a(d,{name:"chevron-right",size:14})})]})]}),a("div",{className:`${t.resultsGrid} ${se?t.lowEnd:""}`,children:g?a(be,{}):T.map(e=>a(fe,{anime:e},e._id))}),!g&&T.length===0&&a("div",{className:t.noResults,children:[a(d,{name:"search",size:48,className:t.noResultsIcon}),a("h3",{children:"No results found"}),a("p",{children:"Try adjusting your search or filters to find what you're looking for."})]}),T.length>0&&a("div",{className:t.bottomPagination,children:a("div",{className:t.pagination,children:[a("button",{className:t.pageBtn,onClick:()=>E(c-1),disabled:c===1||g,children:[a(d,{name:"chevron-left",size:14}),a("span",{children:"Previous"})]}),a("span",{className:t.pageInfo,children:["Page ",a("strong",{children:c})]}),a("button",{className:t.pageBtn,onClick:()=>E(c+1),disabled:!W||g,children:[a("span",{children:"Next"}),a(d,{name:"chevron-right",size:14})]})]})})]})}export{Me as default};
@@ -1 +0,0 @@
1
- ._skeletonCard_1b0hr_1{display:flex;flex-direction:column;background-color:var(--bg-secondary);border-radius:var(--radius-md);overflow:hidden;height:100%;border:1px solid var(--border-secondary)}._poster_1b0hr_11{width:100%;aspect-ratio:3 / 4;background-color:var(--bg-tertiary);position:relative;overflow:hidden}._poster_1b0hr_11:after,._line_1b0hr_20:after{content:"";position:absolute;inset:0;transform:translate(-100%);background-image:linear-gradient(90deg,#fff0 0,#ffffff0d 20%,#ffffff1f 60%,#fff0);animation:_skeleton-wave_1b0hr_1 1.8s infinite ease-in-out}._info_1b0hr_38{padding:var(--space-3);display:flex;flex-direction:column;gap:var(--space-2);flex-grow:1}._line_1b0hr_20{position:relative;overflow:hidden;height:18px;border-radius:var(--radius-sm);background-color:var(--bg-tertiary)}._line_1b0hr_20._short_1b0hr_54{width:60%;height:14px}@media(max-width:768px){._skeletonCard_1b0hr_1._horizontal_1b0hr_60{flex-direction:row;height:auto;min-height:100px}._skeletonCard_1b0hr_1._horizontal_1b0hr_60 ._poster_1b0hr_11{width:85px;height:100%;aspect-ratio:auto;flex-shrink:0}._skeletonCard_1b0hr_1._horizontal_1b0hr_60 ._info_1b0hr_38{padding:var(--space-2) var(--space-3);justify-content:center}._skeletonCard_1b0hr_1._vertical_1b0hr_78 ._poster_1b0hr_11{width:100%;aspect-ratio:3 / 4}._skeletonCard_1b0hr_1._vertical_1b0hr_78 ._info_1b0hr_38{padding:var(--space-2);align-items:center}._line_1b0hr_20{height:16px}._line_1b0hr_20._short_1b0hr_54{height:12px}}._skeletonCard_1b0hr_1._lowEnd_1b0hr_97{min-height:0}._skeletonCard_1b0hr_1._lowEnd_1b0hr_97 ._poster_1b0hr_11:after,._skeletonCard_1b0hr_1._lowEnd_1b0hr_97 ._line_1b0hr_20:after{animation:none}._skeletonCard_1b0hr_1._lowEnd_1b0hr_97 ._line_1b0hr_20{opacity:.6}._skeletonCard_1b0hr_1._lowEnd_1b0hr_97 ._info_1b0hr_38{padding:var(--space-3)}
@@ -1 +0,0 @@
1
- import{u as e,g as t}from"./vendor-core-8R2fFbyN.js";import{u as l}from"./index-lo-bz7f2.js";const a="_skeletonCard_1b0hr_1",i="_poster_1b0hr_11",c="_line_1b0hr_20",_="_info_1b0hr_38",d="_short_1b0hr_54",h="_horizontal_1b0hr_60",m="_vertical_1b0hr_78",v="_lowEnd_1b0hr_97",o={skeletonCard:a,poster:i,line:c,"skeleton-wave":"_skeleton-wave_1b0hr_1",info:_,short:d,horizontal:h,vertical:m,lowEnd:v},b=({layout:n="vertical"})=>{const{lowEndMode:r}=l();return e("div",{className:`${o.skeletonCard} ${o[n]} ${r?o.lowEnd:""}`,children:[e("div",{className:o.poster}),e("div",{className:o.info,children:[e("div",{className:o.line}),e("div",{className:`${o.line} ${o.short}`})]})]})},k=({count:n=14,layout:r="vertical"})=>e("div",{className:"grid-container",children:Array.from({length:n}).map((p,s)=>e(b,{layout:r},s))}),E=t.memo(k);export{b as A,E as S};
@@ -1 +0,0 @@
1
- import{h as D,o as ae,A as te,d as c,T as I,q as A,u as a}from"./vendor-core-8R2fFbyN.js";import{I as d}from"./vendor-icons-CDMuNDeL.js";import{a as ne,T as re}from"./useTv-DTqrJEWp.js";import{S as se}from"./SkeletonGrid-Du10CNfq.js";import{u as le,Q as ie,B as _}from"./index-lo-bz7f2.js";import{E as oe}from"./ErrorMessage-z4f4WGgP.js";import{s as t}from"./Search.module-CMEai-B-.js";import"./MediaCard-DszKDA4s.js";import"./vendor-ui-CUDCvRS_.js";import"./useIsMobile-Dm_b6Ob3.js";import"./TvPopup-CP41CncZ.js";import"./useTvLibrary-BHeWSd1F.js";import"./vendor-query-BXRECSI6.js";const ce=[{value:"multi",label:"All"},{value:"tv",label:"TV Shows"},{value:"movie",label:"Movies"}],de=[{value:"popularity.desc",label:"Popularity"},{value:"vote_average.desc",label:"Top Rated"},{value:"primary_release_date.desc",label:"Newest"},{value:"primary_release_date.asc",label:"Oldest"},{value:"vote_count.desc",label:"Most Voted"}],V={10759:"Action & Adventure",16:"Animation",35:"Comedy",80:"Crime",99:"Documentary",18:"Drama",10751:"Family",10762:"Kids",9648:"Mystery",10765:"Sci-Fi & Fantasy",37:"Western"},W={28:"Action",12:"Adventure",16:"Animation",35:"Comedy",80:"Crime",99:"Documentary",18:"Drama",10751:"Family",14:"Fantasy",36:"History",27:"Horror",9648:"Mystery",10749:"Romance",878:"Sci-Fi",53:"Thriller",10752:"War",37:"Western"},M=new Date().getFullYear(),me=[{value:"ALL",label:"All Years"},...Array.from({length:M-1980+1},(i,h)=>({value:String(M-h),label:String(M-h)}))];function Ae(){D(()=>{document.title="Search TV & Movies - dango"},[]);const[i,h]=ae(),{lowEndMode:Y}=le(),k=te(null),[v,Q]=c(i.get("q")||""),[g,H]=c(i.get("q")||""),[s,y]=c(parseInt(i.get("page")||"1",10)||1),[o,K]=c(i.get("type")||"multi"),[x,O]=c(i.get("genre")||""),[f,$]=c(i.get("year")||"ALL"),[b,F]=c(i.get("sort_by")||"popularity.desc"),[N,U]=c(!1),[m,S]=c(()=>{const e={},n=i.get("genre")||"";return n&&(e[n]="include"),e}),P=I(()=>{if(o==="tv")return Object.entries(V).map(([n,r])=>({id:n,name:r}));if(o==="movie")return Object.entries(W).map(([n,r])=>({id:n,name:r}));const e=new Map;for(const[n,r]of Object.entries(V))e.set(n,r);for(const[n,r]of Object.entries(W))e.set(n,r);return Array.from(e.entries()).map(([n,r])=>({id:n,name:r}))},[o]),w=I(()=>Object.entries(m).filter(([,n])=>n==="include").map(([n])=>n).join(","),[m]),{data:B,isLoading:p,isError:J,error:X}=ne({query:g,type:o,genre:w,year:f,sort_by:b,page:s}),T=B?.results||[],Z=B?.total_pages||0,E=B?.total_results||0,R=s<Math.min(Z,500),u=A((e={})=>{const n=new URLSearchParams,r=e.q!==void 0?e.q:g,l=e.type!==void 0?e.type:o,j=e.year!==void 0?e.year:f,q=e.sort!==void 0?e.sort:b,z=e.page!==void 0?e.page:String(s),G=e.genre!==void 0?e.genre:w;r.trim()&&n.set("q",r.trim()),l!=="multi"&&n.set("type",l),G&&n.set("genre",G),j!=="ALL"&&n.set("year",j),q!=="popularity.desc"&&n.set("sort_by",q),z!=="1"&&n.set("page",z),h(n,{replace:!0})},[g,o,f,b,s,w,h]),L=A(()=>{ie(),y(1),H(v),u({q:v,page:"1"}),window.scrollTo({top:0,behavior:"smooth"})},[v,u]),C=A(e=>{if(y(e),u({page:String(e)}),k.current){const n=k.current.getBoundingClientRect().top+window.scrollY-100;window.scrollTo({top:n,behavior:"smooth"})}},[u]),ee=A(e=>{S(n=>{const r=n[e],l={...n};return r==="include"?l[e]="exclude":r==="exclude"?delete l[e]:l[e]="include",l}),y(1)},[]);return D(()=>{const n=Object.entries(m).filter(([,r])=>r==="include").map(([r])=>r).join(",");n!==x&&(O(n),u({genre:n,page:"1"}))},[m,x,O,u]),a("div",{className:"page-container",children:[a("div",{className:t.header,children:[a("h1",{className:t.pageTitle,children:"Search TV & Movies"}),a("p",{className:t.pageSubtitle,children:"Discover trending shows, movies, and more powered by TMDB"})]}),a("div",{className:t.filterContainer,children:[a("div",{className:t.searchBarWrapper,children:[a("div",{className:t.inputIconWrapper,children:[a(d,{name:"search",className:t.searchIcon}),a("input",{type:"text","data-virtual-keyboard":"true",className:t.searchInput,placeholder:"Search titles...",value:v,onInput:e=>Q(e.currentTarget.value),onKeyDown:e=>e.key==="Enter"&&L()})]}),a("div",{className:t.searchActions,children:[a("select",{value:o,onChange:e=>{K(e.target.value),S({})},className:t.providerSelect,"aria-label":"Media type",children:ce.map(e=>a("option",{value:e.value,children:e.label},e.value))}),a(_,{onClick:L,className:t.searchBtn,children:"Search"}),a("button",{className:`${t.filterToggleBtn} ${N?t.active:""}`,onClick:()=>U(!N),children:[a(d,{name:"filter",size:14}),a("span",{children:"Filters"}),N?a(d,{name:"chevron-up",size:12}):a(d,{name:"chevron-down",size:12})]})]})]}),a("div",{className:`${t.advancedFilters} ${N?t.show:""}`,children:[a("div",{className:t.filterDivider}),a("div",{className:t.filterGrid,children:[a("div",{className:t.filterItem,children:[a("label",{children:"Sort By"}),a("select",{value:b,onChange:e=>F(e.currentTarget.value),children:de.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Year"}),a("select",{value:f,onChange:e=>$(e.currentTarget.value),children:me.map(e=>a("option",{value:e.value,children:e.label},e.value))})]})]}),P.length>0&&a("div",{className:t.genreSection,children:[a("label",{className:t.genreLabel,children:"Genres"}),a("div",{className:t.genreContainer,children:P.map(e=>a("button",{className:`${t.genreButton} ${t[m[e.id]||""]}`,onClick:()=>ee(e.id),children:e.name},e.id))})]}),a("div",{className:t.filterActions,children:[a(_,{variant:"secondary",onClick:()=>{S({}),$("ALL"),F("popularity.desc"),y(1),u({genre:"",year:"ALL",sort:"popularity.desc",page:"1"})},children:"Reset All"}),a(_,{onClick:L,className:t.searchBtn,children:"Apply Filters"})]})]})]}),J&&a(oe,{message:X?.message||"Search failed"}),Object.keys(m).length>0&&a("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px",marginBottom:"1.5rem"},children:[a("span",{style:{fontSize:"0.8rem",color:"var(--text-muted)",fontWeight:600},children:"Active Filters:"}),Object.entries(m).map(([e,n])=>{const r=P.find(l=>l.id===e)?.name||e;return a("span",{className:`badge ${n==="include"?"badge-primary":"badge-danger"}`,style:{display:"inline-flex",alignItems:"center",gap:"6px"},children:[n==="include"?`+ ${r}`:`- ${r}`,a("button",{onClick:()=>{const l={...m};delete l[e],S(l)},style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"✕"})]},e)})]}),a("div",{className:t.resultsHeader,ref:k,children:[a("h2",{className:t.resultsTitle,children:[g?`Results for "${g}"`:w?"Browsing genres":o==="tv"?"Popular TV Shows":o==="movie"?"Popular Movies":"Trending",E>0&&a("span",{style:{fontWeight:400,color:"var(--text-tertiary)",fontSize:"0.85em",marginLeft:"0.5em"},children:["(",E.toLocaleString(),")"]})]}),T.length>0&&a("div",{className:t.pagination,children:[a("button",{className:t.pageBtn,onClick:()=>C(s-1),disabled:s===1||p,"aria-label":"Previous page",children:a(d,{name:"chevron-left",size:14})}),a("span",{className:t.pageInfo,children:["Page ",a("strong",{children:s})]}),a("button",{className:t.pageBtn,onClick:()=>C(s+1),disabled:!R||p,"aria-label":"Next page",children:a(d,{name:"chevron-right",size:14})})]})]}),a("div",{className:`${t.resultsGrid} ${Y?t.lowEnd:""}`,children:p?a(se,{}):T.map(e=>a(re,{item:{id:e.id,title:e.title,year:e.year,type:e.type,image:e.image,vote_average:e.vote_average,adult:e.adult}},`${e.type}-${e.id}`))}),!p&&T.length===0&&a("div",{className:t.noResults,children:[a(d,{name:"search",size:48,className:t.noResultsIcon}),a("h3",{children:"No results found"}),a("p",{children:"Try adjusting your search or filters to find what you're looking for."})]}),T.length>0&&a("div",{className:t.bottomPagination,children:a("div",{className:t.pagination,children:[a("button",{className:t.pageBtn,onClick:()=>C(s-1),disabled:s===1||p,children:[a(d,{name:"chevron-left",size:14}),a("span",{children:"Previous"})]}),a("span",{className:t.pageInfo,children:["Page ",a("strong",{children:s})]}),a("button",{className:t.pageBtn,onClick:()=>C(s+1),disabled:!R||p,children:[a("span",{children:"Next"}),a(d,{name:"chevron-right",size:14})]})]})})]})}export{Ae as default};