@serifpersia/dango 3.8.0 → 3.8.2

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 (69) hide show
  1. package/README.md +4 -2
  2. package/client/dist/assets/{AnimeCard-BURLDiUV.js → AnimeCard-Dl21Mnwa.js} +1 -1
  3. package/client/dist/assets/{AnimeInfo-D2coN_ZJ.js → AnimeInfo-BZnCkkHq.js} +1 -1
  4. package/client/dist/assets/{AnimeInfoPage-BfPP9trp.js → AnimeInfoPage-CPFvFKt0.js} +2 -2
  5. package/client/dist/assets/{Asmr-CiuBtMGl.js → Asmr--BgcQsb9.js} +1 -1
  6. package/client/dist/assets/{AsmrResetProgressModal-BDFeO6fQ.js → AsmrResetProgressModal-VXhNSZib.js} +1 -1
  7. package/client/dist/assets/Home-CXsFL5QN.js +1 -0
  8. package/client/dist/assets/Home-DINyLUCh.css +1 -0
  9. package/client/dist/assets/{Insights-CKk02Whw.js → Insights-4HjAFOov.js} +1 -1
  10. package/client/dist/assets/{LibraryListPage-AGyVc7pR.js → LibraryListPage-BnJw-xnm.js} +1 -1
  11. package/client/dist/assets/{ListeningList-DeAdvRjS.js → ListeningList-DSc_Aqz9.js} +1 -1
  12. package/client/dist/assets/{Manga-CiPWc8Ly.js → Manga-mB3KYDUt.js} +1 -1
  13. package/client/dist/assets/{MangaInfoPage-3jObt7zd.js → MangaInfoPage-C2sxlrwM.js} +1 -1
  14. package/client/dist/assets/{MangaReadPage-V5M2BLWG.js → MangaReadPage-pDNIP1mf.js} +1 -1
  15. package/client/dist/assets/{MangaResetProgressModal-CXRvdwD9.js → MangaResetProgressModal-C_QbfWkA.js} +1 -1
  16. package/client/dist/assets/{Mature-B9IEX0IP.js → Mature-CWEA-qdC.js} +1 -1
  17. package/client/dist/assets/{MatureConsentModal-LTZSG_Kx.js → MatureConsentModal-Ixo33c5M.js} +1 -1
  18. package/client/dist/assets/{MediaCard-l2gAJctz.js → MediaCard-BhYZUPLl.js} +1 -1
  19. package/client/dist/assets/{OptionListMenu-CHJb3qot.js → OptionListMenu-D-g4a-VC.js} +1 -1
  20. package/client/dist/assets/Player-B2CmI6hn.js +56 -0
  21. package/client/dist/assets/PlayerProvider-Q25sRaQm.js +1 -0
  22. package/client/dist/assets/PlayerProvider-ZeplRma-.css +1 -0
  23. package/client/dist/assets/{PlayerSettings-B-_QOjfP.js → PlayerSettings-puzcbL0V.js} +1 -1
  24. package/client/dist/assets/{QueueOptionsButton-BCxERY1G.js → QueueOptionsButton-C0U85ua3.js} +1 -1
  25. package/client/dist/assets/{QueueRail-BX4CwNHY.js → QueueRail-D2SeBzV5.js} +1 -1
  26. package/client/dist/assets/{ReadingList-BLUM-leI.js → ReadingList-Bp_5vTLj.js} +1 -1
  27. package/client/dist/assets/{ResetProgressModal-DLs9yqI-.js → ResetProgressModal-By_82RcA.js} +1 -1
  28. package/client/dist/assets/{Search-tnIvsV_a.js → Search-BpG4bAm2.js} +1 -1
  29. package/client/dist/assets/{Settings-CibKc1Rt.js → Settings-C72mbc_2.js} +1 -1
  30. package/client/dist/assets/{SkeletonGrid-nW7P1jQU.js → SkeletonGrid-CPc8hqla.js} +1 -1
  31. package/client/dist/assets/{Trackers-Cynvnhc3.js → Trackers-CYbGDEf-.js} +1 -1
  32. package/client/dist/assets/Tv-FXbgyY_h.js +4 -0
  33. package/client/dist/assets/{TvInfo-DGIpvh-v.js → TvInfo-Cu6BPMzl.js} +1 -1
  34. package/client/dist/assets/{TvPopup-BS4iiQMd.js → TvPopup-BnPKXA6c.js} +1 -1
  35. package/client/dist/assets/{TvSearch-p0kCDTee.js → TvSearch-BQNApkYS.js} +1 -1
  36. package/client/dist/assets/{TvWatchlist-CmXQkDQp.js → TvWatchlist-DKbRFInR.js} +1 -1
  37. package/client/dist/assets/{VirtualKeyboard-CroH8QGP.js → VirtualKeyboard-B0KbwdUi.js} +1 -1
  38. package/client/dist/assets/{WatchAlong-iCJlxiZA.js → WatchAlong-CoZ0_fXQ.js} +1 -1
  39. package/client/dist/assets/WatchAlongPanel-CerutuF6.js +1 -0
  40. package/client/dist/assets/WatchAlongPanel-DWb8lSzW.css +1 -0
  41. package/client/dist/assets/{Watchlist-D2sHodVo.js → Watchlist-5UqdPHPq.js} +1 -1
  42. package/client/dist/assets/index-CoCvEAx6.css +1 -0
  43. package/client/dist/assets/{index-DYanm9eZ.js → index-hnIW0p5l.js} +18 -18
  44. package/client/dist/assets/{libraryInvalidation-DlwONLN-.js → libraryInvalidation-DGzo-Q94.js} +1 -1
  45. package/client/dist/assets/{playbackCompletion-CxGa4g7a.js → playbackCompletion-DCNDnWtX.js} +1 -1
  46. package/client/dist/assets/{useAnimeInfoData-DMeGA3wY.js → useAnimeInfoData-C-n9ZzJX.js} +1 -1
  47. package/client/dist/assets/{useAsmr-B88X71vs.js → useAsmr-QthQGpYA.js} +1 -1
  48. package/client/dist/assets/{useAsmrPopup-DEhKwHLC.js → useAsmrPopup-BGI3k7sr.js} +1 -1
  49. package/client/dist/assets/{useMangaLibrary-CX_0zLJK.js → useMangaLibrary-uCL2et8O.js} +1 -1
  50. package/client/dist/assets/{useMangaPopup-Dkq2Yw-e.js → useMangaPopup-DV8-cCbz.js} +1 -1
  51. package/client/dist/assets/{useProviders-D9QoFCnY.js → useProviders-Bzr6U-8b.js} +1 -1
  52. package/client/dist/assets/{useTv-BGXZmuV8.js → useTv-D2BZQllK.js} +1 -1
  53. package/client/dist/assets/{useTvLibrary-TnVQ2e21.js → useTvLibrary-BIs22-2H.js} +1 -1
  54. package/client/dist/assets/{useWatchAlongPlayer-BMf_H2dw.css → useWatchAlongPlayer-1fbftVwT.css} +1 -1
  55. package/client/dist/assets/useWatchAlongPlayer-B79YboC3.js +10 -0
  56. package/client/dist/index.html +2 -2
  57. package/package.json +2 -2
  58. package/server/dist/server.js +170 -170
  59. package/server/package.json +1 -1
  60. package/client/dist/assets/Home-DHAkZuDf.css +0 -1
  61. package/client/dist/assets/Home-GShTLEbZ.js +0 -1
  62. package/client/dist/assets/Player-BTimy0Mp.js +0 -56
  63. package/client/dist/assets/PlayerProvider-BXBzQc8G.js +0 -1
  64. package/client/dist/assets/PlayerProvider-N2pT5gty.css +0 -1
  65. package/client/dist/assets/Tv-BePMuQoo.js +0 -4
  66. package/client/dist/assets/WatchAlongPanel-DbJuLqxU.css +0 -1
  67. package/client/dist/assets/WatchAlongPanel-R7Nd5MXr.js +0 -1
  68. package/client/dist/assets/index-DP9TtvZX.css +0 -1
  69. package/client/dist/assets/useWatchAlongPlayer-3HXJvQR2.js +0 -10
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Home-GShTLEbZ.js","assets/vendor-core-DfaOB3Rn.js","assets/vendor-query-BBT5_sHx.js","assets/MediaCard-l2gAJctz.js","assets/vendor-icons-DrybRNxP.js","assets/vendor-ui-3qrARCPr.js","assets/useIsMobile-Dvx1uJ82.js","assets/MatureConsentModal-LTZSG_Kx.js","assets/MatureConsentModal-CqewXc0q.css","assets/MediaCard-CoyScn-7.css","assets/AnimeCard-BURLDiUV.js","assets/useAnimeInfoData-DMeGA3wY.js","assets/QueueOptionsButton-BCxERY1G.js","assets/QueueOptionsButton-CM15uQn8.css","assets/playbackCompletion-CxGa4g7a.js","assets/SkeletonGrid-nW7P1jQU.js","assets/SkeletonGrid-BisPI38I.css","assets/ErrorMessage-DAxegITP.js","assets/ErrorMessage-CXoRbrLN.css","assets/ResetProgressModal-DLs9yqI-.js","assets/QueueRail-BX4CwNHY.js","assets/QueueRail-Bkh4VZls.css","assets/useMangaPopup-Dkq2Yw-e.js","assets/useMangaLibrary-CX_0zLJK.js","assets/libraryInvalidation-DlwONLN-.js","assets/usePopup-DS9jMzp6.js","assets/MangaResetProgressModal-CXRvdwD9.js","assets/useProviders-D9QoFCnY.js","assets/useTv-BGXZmuV8.js","assets/TvPopup-BS4iiQMd.js","assets/useTvLibrary-TnVQ2e21.js","assets/AsmrResetProgressModal-BDFeO6fQ.js","assets/useAsmr-B88X71vs.js","assets/Home-DHAkZuDf.css","assets/Watchlist-D2sHodVo.js","assets/LibraryListPage.module-r6k9nyT9.js","assets/LibraryListPage-DmdjNa2U.css","assets/ActiveFilterChips-olGfwxle.js","assets/ActiveFilterChips-QjkplDN2.css","assets/Watchlist-DW7kUORr.css","assets/Settings-CibKc1Rt.js","assets/ToggleSwitch-CN_ppEc9.js","assets/ToggleSwitch-BPil0d_k.css","assets/Settings-D37LNfis.css","assets/Player-BTimy0Mp.js","assets/PlayerProvider-BXBzQc8G.js","assets/PlayerProvider-N2pT5gty.css","assets/useWatchAlongPlayer-3HXJvQR2.js","assets/useWatchAlongPlayer-BMf_H2dw.css","assets/AnimeMetaDetails-B3-A7O5H.js","assets/AnimeMetaDetails-BwNQnRCd.css","assets/SynopsisText-B3Sa5pRv.js","assets/SynopsisText-CYv2W3yR.css","assets/WatchAlongPanel-R7Nd5MXr.js","assets/WatchAlongPanel-DbJuLqxU.css","assets/Player-D-sQfjcx.css","assets/WatchAlong-iCJlxiZA.js","assets/Search-tnIvsV_a.js","assets/Search.module-C_qwCdHS.js","assets/Search-DCKK3seW.css","assets/Mature-B9IEX0IP.js","assets/Mature-DJmUUtlF.css","assets/Asmr-CiuBtMGl.js","assets/useAsmrPopup-DEhKwHLC.js","assets/page.module-C1MlZzf3.js","assets/page-DRvjODkg.css","assets/Asmr-Do89pEHG.css","assets/Manga-CiPWc8Ly.js","assets/Manga.module-depGEacJ.js","assets/Manga-CqAceKxR.css","assets/MangaInfoPage-3jObt7zd.js","assets/MangaReadPage-V5M2BLWG.js","assets/ReadingList-BLUM-leI.js","assets/LibraryListPage-AGyVc7pR.js","assets/TvSearch-p0kCDTee.js","assets/TvInfo-DGIpvh-v.js","assets/TvInfo-Bu36xJyO.css","assets/Tv-BePMuQoo.js","assets/OptionListMenu-CHJb3qot.js","assets/Tv-D3vXCsSC.css","assets/TvWatchlist-CmXQkDQp.js","assets/ListeningList-DeAdvRjS.js","assets/Trackers-Cynvnhc3.js","assets/Trackers-CvO6aWVx.css","assets/Insights-CKk02Whw.js","assets/Insights-D0qrep0K.css","assets/AnimeInfoPage-BfPP9trp.js","assets/PlayerRedirect-fv2tzEUu.js","assets/VirtualKeyboard-CroH8QGP.js","assets/VirtualKeyboard-BaUll8Yv.css"])))=>i.map(i=>d[i]);
2
- import{N as cr,k as J,A as U,q as H,h as w,S as Y,d as g,X as fe,x as he,T as Ce,g as Pt,u as o,L as se,$ as Tt,a as vn,c as nt,e as lr,f as ur,D as dr,i as mr,P as jt,j as fr,l as R,m as Mt,z as M,n as hr,B as pr}from"./vendor-core-DfaOB3Rn.js";import{s as Pe,i as yr,q as vr,u as Z,a as ie,b as ne,c as xt,Q as gr,d as br}from"./vendor-query-BBT5_sHx.js";import{I as N}from"./vendor-icons-DrybRNxP.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();const wr="modulepreload",_r=function(e){return"/"+e},Ft={},F=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){let l=function(u){return Promise.all(u.map(d=>Promise.resolve(d).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),c=a?.nonce||a?.getAttribute("nonce");s=l(n.map(u=>{if(u=_r(u),u in Ft)return;Ft[u]=!0;const d=u.endsWith(".css"),f=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${f}`))return;const m=document.createElement("link");if(m.rel=d?"stylesheet":wr,d||(m.as="script"),m.crossOrigin="",m.href=u,c&&m.setAttribute("nonce",c),document.head.appendChild(m),d)return new Promise((h,p)=>{m.addEventListener("load",h),m.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${u}`)))})}))}function i(a){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=a,window.dispatchEvent(c),!c.defaultPrevented)throw a}return s.then(a=>{for(const c of a||[])c.status==="rejected"&&i(c.reason);return t().catch(i)})};let kr={data:""},Er=e=>{if(typeof window=="object"){let t=(e?e.querySelector("#_goober"):window._goober)||Object.assign(document.createElement("style"),{innerHTML:" ",id:"_goober"});return t.nonce=window.__nonce__,t.parentNode||(e||document.head).appendChild(t),t.firstChild}return e||kr},Sr=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,Pr=/\/\*[^]*?\*\/| +/g,Wt=/\n+/g,we=(e,t)=>{let n="",r="",s="";for(let i in e){let a=e[i];i[0]=="@"?i[1]=="i"?n=i+" "+a+";":r+=i[1]=="f"?we(a,i):i+"{"+we(a,i[1]=="k"?"":t)+"}":typeof a=="object"?r+=we(a,t?t.replace(/([^,])+/g,c=>i.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,l=>/&/.test(l)?l.replace(/&/g,c):c?c+" "+l:l)):i):a!=null&&(i=i[1]=="-"?i:i.replace(/[A-Z]/g,"-$&").toLowerCase(),s+=we.p?we.p(i,a):i+":"+a+";")}return n+(t&&s?t+"{"+s+"}":s)+r},be={},gn=e=>{if(typeof e=="object"){let t="";for(let n in e)t+=n+gn(e[n]);return t}return e},Tr=(e,t,n,r,s)=>{let i=gn(e),a=be[i]||(be[i]=(l=>{let u=0,d=11;for(;u<l.length;)d=101*d+l.charCodeAt(u++)>>>0;return"go"+d})(i));if(!be[a]){let l=i!==e?e:(u=>{let d,f,m=[{}];for(;d=Sr.exec(u.replace(Pr,""));)d[4]?m.shift():d[3]?(f=d[3].replace(Wt," ").trim(),m.unshift(m[0][f]=m[0][f]||{})):m[0][d[1]]=d[2].replace(Wt," ").trim();return m[0]})(e);be[a]=we(s?{["@keyframes "+a]:l}:l,n?"":"."+a)}let c=n&&be.g;return n&&(be.g=be[a]),((l,u,d,f)=>{f?u.data=u.data.replace(f,l):u.data.indexOf(l)===-1&&(u.data=d?l+u.data:u.data+l)})(be[a],t,r,c),a},xr=(e,t,n)=>e.reduce((r,s,i)=>{let a=t[i];if(a&&a.call){let c=a(n),l=c&&c.props&&c.props.className||/^go/.test(c)&&c;a=l?"."+l:c&&typeof c=="object"?c.props?"":we(c,""):c===!1?"":c}return r+s+(a??"")},"");function rt(e){let t=this||{},n=e.call?e(t.p):e;return Tr(n.unshift?n.raw?xr(n,[].slice.call(arguments,1),t.p):n.reduce((r,s)=>Object.assign(r,s&&s.call?s(t.p):s),{}):n,Er(t.target),t.g,t.o,t.k)}let bn,ht,pt;rt.bind({g:1});let ve=rt.bind({k:1});function Ir(e,t,n,r){we.p=t,bn=e,ht=n,pt=r}function ke(e,t){let n=this||{};return function(){let r=arguments;function s(i,a){let c=Object.assign({},i),l=c.className||s.className;n.p=Object.assign({theme:ht&&ht()},c),n.o=/go\d/.test(l),c.className=rt.apply(n,r)+(l?" "+l:"");let u=e;return e[0]&&(u=c.as||e,delete c.as),pt&&u[0]&&pt(c),bn(u,c)}return s}}var Nr=e=>typeof e=="function",Ze=(e,t)=>Nr(e)?e(t):e,Cr=(()=>{let e=0;return()=>(++e).toString()})(),wn=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),Or=20,It="default",_n=(e,t)=>{let{toastLimit:n}=e.settings;switch(t.type){case 0:return{...e,toasts:[t.toast,...e.toasts].slice(0,n)};case 1:return{...e,toasts:e.toasts.map(a=>a.id===t.toast.id?{...a,...t.toast}:a)};case 2:let{toast:r}=t;return _n(e,{type:e.toasts.find(a=>a.id===r.id)?1:0,toast:r});case 3:let{toastId:s}=t;return{...e,toasts:e.toasts.map(a=>a.id===s||s===void 0?{...a,dismissed:!0,visible:!1}:a)};case 4:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(a=>a.id!==t.toastId)};case 5:return{...e,pausedAt:t.time};case 6:let i=t.time-(e.pausedAt||0);return{...e,pausedAt:void 0,toasts:e.toasts.map(a=>({...a,pauseDuration:a.pauseDuration+i}))}}},Ge=[],kn={toasts:[],pausedAt:void 0,settings:{toastLimit:Or}},de={},En=(e,t=It)=>{de[t]=_n(de[t]||kn,e),Ge.forEach(([n,r])=>{n===t&&r(de[t])})},Sn=e=>Object.keys(de).forEach(t=>En(e,t)),Ar=e=>Object.keys(de).find(t=>de[t].toasts.some(n=>n.id===e)),ot=(e=It)=>t=>{En(t,e)},Lr={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},Rr=(e={},t=It)=>{let[n,r]=g(de[t]||kn),s=U(de[t]);w(()=>(s.current!==de[t]&&r(de[t]),Ge.push([t,r]),()=>{let a=Ge.findIndex(([c])=>c===t);a>-1&&Ge.splice(a,1)}),[t]);let i=n.toasts.map(a=>{var c,l,u;return{...e,...e[a.type],...a,removeDelay:a.removeDelay||((c=e[a.type])==null?void 0:c.removeDelay)||e?.removeDelay,duration:a.duration||((l=e[a.type])==null?void 0:l.duration)||e?.duration||Lr[a.type],style:{...e.style,...(u=e[a.type])==null?void 0:u.style,...a.style}}});return{...n,toasts:i}},$r=(e,t="blank",n)=>({createdAt:Date.now(),visible:!0,dismissed:!1,type:t,ariaProps:{role:"status","aria-live":"polite"},message:e,pauseDuration:0,...n,id:n?.id||Cr()}),Fe=e=>(t,n)=>{let r=$r(t,e,n);return ot(r.toasterId||Ar(r.id))({type:2,toast:r}),r.id},K=(e,t)=>Fe("blank")(e,t);K.error=Fe("error");K.success=Fe("success");K.loading=Fe("loading");K.custom=Fe("custom");K.dismiss=(e,t)=>{let n={type:3,toastId:e};t?ot(t)(n):Sn(n)};K.dismissAll=e=>K.dismiss(void 0,e);K.remove=(e,t)=>{let n={type:4,toastId:e};t?ot(t)(n):Sn(n)};K.removeAll=e=>K.remove(void 0,e);K.promise=(e,t,n)=>{let r=K.loading(t.loading,{...n,...n?.loading});return typeof e=="function"&&(e=e()),e.then(s=>{let i=t.success?Ze(t.success,s):void 0;return i?K.success(i,{id:r,...n,...n?.success}):K.dismiss(r),s}).catch(s=>{let i=t.error?Ze(t.error,s):void 0;i?K.error(i,{id:r,...n,...n?.error}):K.dismiss(r)}),e};var qr=1e3,Dr=(e,t="default")=>{let{toasts:n,pausedAt:r}=Rr(e,t),s=U(new Map).current,i=H((f,m=qr)=>{if(s.has(f))return;let h=setTimeout(()=>{s.delete(f),a({type:4,toastId:f})},m);s.set(f,h)},[]);w(()=>{if(r)return;let f=Date.now(),m=n.map(h=>{if(h.duration===1/0)return;let p=(h.duration||0)+h.pauseDuration-(f-h.createdAt);if(p<0){h.visible&&K.dismiss(h.id);return}return setTimeout(()=>K.dismiss(h.id,t),p)});return()=>{m.forEach(h=>h&&clearTimeout(h))}},[n,r,t]);let a=H(ot(t),[t]),c=H(()=>{a({type:5,time:Date.now()})},[a]),l=H((f,m)=>{a({type:1,toast:{id:f,height:m}})},[a]),u=H(()=>{r&&a({type:6,time:Date.now()})},[r,a]),d=H((f,m)=>{let{reverseOrder:h=!1,gutter:p=8,defaultPosition:_}=m||{},x=n.filter(v=>(v.position||_)===(f.position||_)&&v.height),E=x.findIndex(v=>v.id===f.id),y=x.filter((v,T)=>T<E&&v.visible).length;return x.filter(v=>v.visible).slice(...h?[y+1]:[0,y]).reduce((v,T)=>v+(T.height||0)+p,0)},[n]);return w(()=>{n.forEach(f=>{if(f.dismissed)i(f.id,f.removeDelay);else{let m=s.get(f.id);m&&(clearTimeout(m),s.delete(f.id))}})},[n,i]),{toasts:n,handlers:{updateHeight:l,startPause:c,endPause:u,calculateOffset:d}}},jr=ve`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Home-CXsFL5QN.js","assets/vendor-core-DfaOB3Rn.js","assets/vendor-query-BBT5_sHx.js","assets/MediaCard-BhYZUPLl.js","assets/vendor-icons-DrybRNxP.js","assets/vendor-ui-3qrARCPr.js","assets/useIsMobile-Dvx1uJ82.js","assets/MatureConsentModal-Ixo33c5M.js","assets/MatureConsentModal-CqewXc0q.css","assets/MediaCard-CoyScn-7.css","assets/AnimeCard-Dl21Mnwa.js","assets/useAnimeInfoData-C-n9ZzJX.js","assets/QueueOptionsButton-C0U85ua3.js","assets/QueueOptionsButton-CM15uQn8.css","assets/playbackCompletion-DCNDnWtX.js","assets/SkeletonGrid-CPc8hqla.js","assets/SkeletonGrid-BisPI38I.css","assets/ErrorMessage-DAxegITP.js","assets/ErrorMessage-CXoRbrLN.css","assets/ResetProgressModal-By_82RcA.js","assets/QueueRail-D2SeBzV5.js","assets/QueueRail-Bkh4VZls.css","assets/useMangaPopup-DV8-cCbz.js","assets/useMangaLibrary-uCL2et8O.js","assets/libraryInvalidation-DGzo-Q94.js","assets/usePopup-DS9jMzp6.js","assets/MangaResetProgressModal-C_QbfWkA.js","assets/useProviders-Bzr6U-8b.js","assets/useTv-D2BZQllK.js","assets/TvPopup-BnPKXA6c.js","assets/useTvLibrary-BIs22-2H.js","assets/AsmrResetProgressModal-VXhNSZib.js","assets/useAsmr-QthQGpYA.js","assets/Home-DINyLUCh.css","assets/Watchlist-5UqdPHPq.js","assets/LibraryListPage.module-r6k9nyT9.js","assets/LibraryListPage-DmdjNa2U.css","assets/ActiveFilterChips-olGfwxle.js","assets/ActiveFilterChips-QjkplDN2.css","assets/Watchlist-DW7kUORr.css","assets/Settings-C72mbc_2.js","assets/ToggleSwitch-CN_ppEc9.js","assets/ToggleSwitch-BPil0d_k.css","assets/Settings-D37LNfis.css","assets/Player-B2CmI6hn.js","assets/PlayerProvider-Q25sRaQm.js","assets/PlayerProvider-ZeplRma-.css","assets/useWatchAlongPlayer-B79YboC3.js","assets/useWatchAlongPlayer-1fbftVwT.css","assets/AnimeMetaDetails-B3-A7O5H.js","assets/AnimeMetaDetails-BwNQnRCd.css","assets/SynopsisText-B3Sa5pRv.js","assets/SynopsisText-CYv2W3yR.css","assets/WatchAlongPanel-CerutuF6.js","assets/WatchAlongPanel-DWb8lSzW.css","assets/Player-D-sQfjcx.css","assets/WatchAlong-CoZ0_fXQ.js","assets/Search-BpG4bAm2.js","assets/Search.module-C_qwCdHS.js","assets/Search-DCKK3seW.css","assets/Mature-CWEA-qdC.js","assets/Mature-DJmUUtlF.css","assets/Asmr--BgcQsb9.js","assets/useAsmrPopup-BGI3k7sr.js","assets/page.module-C1MlZzf3.js","assets/page-DRvjODkg.css","assets/Asmr-Do89pEHG.css","assets/Manga-mB3KYDUt.js","assets/Manga.module-depGEacJ.js","assets/Manga-CqAceKxR.css","assets/MangaInfoPage-C2sxlrwM.js","assets/MangaReadPage-pDNIP1mf.js","assets/ReadingList-Bp_5vTLj.js","assets/LibraryListPage-BnJw-xnm.js","assets/TvSearch-BQNApkYS.js","assets/TvInfo-Cu6BPMzl.js","assets/TvInfo-Bu36xJyO.css","assets/Tv-FXbgyY_h.js","assets/OptionListMenu-D-g4a-VC.js","assets/Tv-D3vXCsSC.css","assets/TvWatchlist-DKbRFInR.js","assets/ListeningList-DSc_Aqz9.js","assets/Trackers-CYbGDEf-.js","assets/Trackers-CvO6aWVx.css","assets/Insights-4HjAFOov.js","assets/Insights-D0qrep0K.css","assets/AnimeInfoPage-CPFvFKt0.js","assets/PlayerRedirect-fv2tzEUu.js","assets/VirtualKeyboard-B0KbwdUi.js","assets/VirtualKeyboard-BaUll8Yv.css"])))=>i.map(i=>d[i]);
2
+ import{N as cr,k as J,A as U,q as H,h as w,S as Y,d as v,X as he,x as fe,T as Ce,g as Pt,u as o,L as se,$ as Tt,a as gn,c as nt,e as lr,f as ur,D as dr,i as mr,P as jt,j as hr,l as R,m as Mt,z as M,n as fr,B as pr}from"./vendor-core-DfaOB3Rn.js";import{s as Pe,i as yr,q as gr,u as Z,a as ie,b as ne,c as xt,Q as vr,d as br}from"./vendor-query-BBT5_sHx.js";import{I as N}from"./vendor-icons-DrybRNxP.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();const wr="modulepreload",_r=function(e){return"/"+e},Ft={},F=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){let l=function(u){return Promise.all(u.map(d=>Promise.resolve(d).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),c=a?.nonce||a?.getAttribute("nonce");s=l(n.map(u=>{if(u=_r(u),u in Ft)return;Ft[u]=!0;const d=u.endsWith(".css"),h=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${h}`))return;const m=document.createElement("link");if(m.rel=d?"stylesheet":wr,d||(m.as="script"),m.crossOrigin="",m.href=u,c&&m.setAttribute("nonce",c),document.head.appendChild(m),d)return new Promise((f,p)=>{m.addEventListener("load",f),m.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${u}`)))})}))}function i(a){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=a,window.dispatchEvent(c),!c.defaultPrevented)throw a}return s.then(a=>{for(const c of a||[])c.status==="rejected"&&i(c.reason);return t().catch(i)})};let Er={data:""},Sr=e=>{if(typeof window=="object"){let t=(e?e.querySelector("#_goober"):window._goober)||Object.assign(document.createElement("style"),{innerHTML:" ",id:"_goober"});return t.nonce=window.__nonce__,t.parentNode||(e||document.head).appendChild(t),t.firstChild}return e||Er},kr=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,Pr=/\/\*[^]*?\*\/| +/g,Wt=/\n+/g,we=(e,t)=>{let n="",r="",s="";for(let i in e){let a=e[i];i[0]=="@"?i[1]=="i"?n=i+" "+a+";":r+=i[1]=="f"?we(a,i):i+"{"+we(a,i[1]=="k"?"":t)+"}":typeof a=="object"?r+=we(a,t?t.replace(/([^,])+/g,c=>i.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,l=>/&/.test(l)?l.replace(/&/g,c):c?c+" "+l:l)):i):a!=null&&(i=i[1]=="-"?i:i.replace(/[A-Z]/g,"-$&").toLowerCase(),s+=we.p?we.p(i,a):i+":"+a+";")}return n+(t&&s?t+"{"+s+"}":s)+r},be={},vn=e=>{if(typeof e=="object"){let t="";for(let n in e)t+=n+vn(e[n]);return t}return e},Tr=(e,t,n,r,s)=>{let i=vn(e),a=be[i]||(be[i]=(l=>{let u=0,d=11;for(;u<l.length;)d=101*d+l.charCodeAt(u++)>>>0;return"go"+d})(i));if(!be[a]){let l=i!==e?e:(u=>{let d,h,m=[{}];for(;d=kr.exec(u.replace(Pr,""));)d[4]?m.shift():d[3]?(h=d[3].replace(Wt," ").trim(),m.unshift(m[0][h]=m[0][h]||{})):m[0][d[1]]=d[2].replace(Wt," ").trim();return m[0]})(e);be[a]=we(s?{["@keyframes "+a]:l}:l,n?"":"."+a)}let c=n&&be.g;return n&&(be.g=be[a]),((l,u,d,h)=>{h?u.data=u.data.replace(h,l):u.data.indexOf(l)===-1&&(u.data=d?l+u.data:u.data+l)})(be[a],t,r,c),a},xr=(e,t,n)=>e.reduce((r,s,i)=>{let a=t[i];if(a&&a.call){let c=a(n),l=c&&c.props&&c.props.className||/^go/.test(c)&&c;a=l?"."+l:c&&typeof c=="object"?c.props?"":we(c,""):c===!1?"":c}return r+s+(a??"")},"");function rt(e){let t=this||{},n=e.call?e(t.p):e;return Tr(n.unshift?n.raw?xr(n,[].slice.call(arguments,1),t.p):n.reduce((r,s)=>Object.assign(r,s&&s.call?s(t.p):s),{}):n,Sr(t.target),t.g,t.o,t.k)}let bn,ft,pt;rt.bind({g:1});let ge=rt.bind({k:1});function Ir(e,t,n,r){we.p=t,bn=e,ft=n,pt=r}function Ee(e,t){let n=this||{};return function(){let r=arguments;function s(i,a){let c=Object.assign({},i),l=c.className||s.className;n.p=Object.assign({theme:ft&&ft()},c),n.o=/go\d/.test(l),c.className=rt.apply(n,r)+(l?" "+l:"");let u=e;return e[0]&&(u=c.as||e,delete c.as),pt&&u[0]&&pt(c),bn(u,c)}return s}}var Nr=e=>typeof e=="function",Ze=(e,t)=>Nr(e)?e(t):e,Cr=(()=>{let e=0;return()=>(++e).toString()})(),wn=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),Or=20,It="default",_n=(e,t)=>{let{toastLimit:n}=e.settings;switch(t.type){case 0:return{...e,toasts:[t.toast,...e.toasts].slice(0,n)};case 1:return{...e,toasts:e.toasts.map(a=>a.id===t.toast.id?{...a,...t.toast}:a)};case 2:let{toast:r}=t;return _n(e,{type:e.toasts.find(a=>a.id===r.id)?1:0,toast:r});case 3:let{toastId:s}=t;return{...e,toasts:e.toasts.map(a=>a.id===s||s===void 0?{...a,dismissed:!0,visible:!1}:a)};case 4:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(a=>a.id!==t.toastId)};case 5:return{...e,pausedAt:t.time};case 6:let i=t.time-(e.pausedAt||0);return{...e,pausedAt:void 0,toasts:e.toasts.map(a=>({...a,pauseDuration:a.pauseDuration+i}))}}},Ge=[],En={toasts:[],pausedAt:void 0,settings:{toastLimit:Or}},de={},Sn=(e,t=It)=>{de[t]=_n(de[t]||En,e),Ge.forEach(([n,r])=>{n===t&&r(de[t])})},kn=e=>Object.keys(de).forEach(t=>Sn(e,t)),Ar=e=>Object.keys(de).find(t=>de[t].toasts.some(n=>n.id===e)),ot=(e=It)=>t=>{Sn(t,e)},Lr={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},Rr=(e={},t=It)=>{let[n,r]=v(de[t]||En),s=U(de[t]);w(()=>(s.current!==de[t]&&r(de[t]),Ge.push([t,r]),()=>{let a=Ge.findIndex(([c])=>c===t);a>-1&&Ge.splice(a,1)}),[t]);let i=n.toasts.map(a=>{var c,l,u;return{...e,...e[a.type],...a,removeDelay:a.removeDelay||((c=e[a.type])==null?void 0:c.removeDelay)||e?.removeDelay,duration:a.duration||((l=e[a.type])==null?void 0:l.duration)||e?.duration||Lr[a.type],style:{...e.style,...(u=e[a.type])==null?void 0:u.style,...a.style}}});return{...n,toasts:i}},$r=(e,t="blank",n)=>({createdAt:Date.now(),visible:!0,dismissed:!1,type:t,ariaProps:{role:"status","aria-live":"polite"},message:e,pauseDuration:0,...n,id:n?.id||Cr()}),Fe=e=>(t,n)=>{let r=$r(t,e,n);return ot(r.toasterId||Ar(r.id))({type:2,toast:r}),r.id},K=(e,t)=>Fe("blank")(e,t);K.error=Fe("error");K.success=Fe("success");K.loading=Fe("loading");K.custom=Fe("custom");K.dismiss=(e,t)=>{let n={type:3,toastId:e};t?ot(t)(n):kn(n)};K.dismissAll=e=>K.dismiss(void 0,e);K.remove=(e,t)=>{let n={type:4,toastId:e};t?ot(t)(n):kn(n)};K.removeAll=e=>K.remove(void 0,e);K.promise=(e,t,n)=>{let r=K.loading(t.loading,{...n,...n?.loading});return typeof e=="function"&&(e=e()),e.then(s=>{let i=t.success?Ze(t.success,s):void 0;return i?K.success(i,{id:r,...n,...n?.success}):K.dismiss(r),s}).catch(s=>{let i=t.error?Ze(t.error,s):void 0;i?K.error(i,{id:r,...n,...n?.error}):K.dismiss(r)}),e};var qr=1e3,Dr=(e,t="default")=>{let{toasts:n,pausedAt:r}=Rr(e,t),s=U(new Map).current,i=H((h,m=qr)=>{if(s.has(h))return;let f=setTimeout(()=>{s.delete(h),a({type:4,toastId:h})},m);s.set(h,f)},[]);w(()=>{if(r)return;let h=Date.now(),m=n.map(f=>{if(f.duration===1/0)return;let p=(f.duration||0)+f.pauseDuration-(h-f.createdAt);if(p<0){f.visible&&K.dismiss(f.id);return}return setTimeout(()=>K.dismiss(f.id,t),p)});return()=>{m.forEach(f=>f&&clearTimeout(f))}},[n,r,t]);let a=H(ot(t),[t]),c=H(()=>{a({type:5,time:Date.now()})},[a]),l=H((h,m)=>{a({type:1,toast:{id:h,height:m}})},[a]),u=H(()=>{r&&a({type:6,time:Date.now()})},[r,a]),d=H((h,m)=>{let{reverseOrder:f=!1,gutter:p=8,defaultPosition:_}=m||{},x=n.filter(g=>(g.position||_)===(h.position||_)&&g.height),S=x.findIndex(g=>g.id===h.id),y=x.filter((g,T)=>T<S&&g.visible).length;return x.filter(g=>g.visible).slice(...f?[y+1]:[0,y]).reduce((g,T)=>g+(T.height||0)+p,0)},[n]);return w(()=>{n.forEach(h=>{if(h.dismissed)i(h.id,h.removeDelay);else{let m=s.get(h.id);m&&(clearTimeout(m),s.delete(h.id))}})},[n,i]),{toasts:n,handlers:{updateHeight:l,startPause:c,endPause:u,calculateOffset:d}}},jr=ge`
3
3
  from {
4
4
  transform: scale(0) rotate(45deg);
5
5
  opacity: 0;
@@ -7,7 +7,7 @@ from {
7
7
  to {
8
8
  transform: scale(1) rotate(45deg);
9
9
  opacity: 1;
10
- }`,Mr=ve`
10
+ }`,Mr=ge`
11
11
  from {
12
12
  transform: scale(0);
13
13
  opacity: 0;
@@ -15,7 +15,7 @@ from {
15
15
  to {
16
16
  transform: scale(1);
17
17
  opacity: 1;
18
- }`,Fr=ve`
18
+ }`,Fr=ge`
19
19
  from {
20
20
  transform: scale(0) rotate(90deg);
21
21
  opacity: 0;
@@ -23,7 +23,7 @@ from {
23
23
  to {
24
24
  transform: scale(1) rotate(90deg);
25
25
  opacity: 1;
26
- }`,Wr=ke("div")`
26
+ }`,Wr=Ee("div")`
27
27
  width: 20px;
28
28
  opacity: 0;
29
29
  height: 20px;
@@ -56,14 +56,14 @@ to {
56
56
  animation-delay: 180ms;
57
57
  transform: rotate(90deg);
58
58
  }
59
- `,Br=ve`
59
+ `,Br=ge`
60
60
  from {
61
61
  transform: rotate(0deg);
62
62
  }
63
63
  to {
64
64
  transform: rotate(360deg);
65
65
  }
66
- `,Ur=ke("div")`
66
+ `,Ur=Ee("div")`
67
67
  width: 12px;
68
68
  height: 12px;
69
69
  box-sizing: border-box;
@@ -72,7 +72,7 @@ to {
72
72
  border-color: ${e=>e.secondary||"#e0e0e0"};
73
73
  border-right-color: ${e=>e.primary||"#616161"};
74
74
  animation: ${Br} 1s linear infinite;
75
- `,Hr=ve`
75
+ `,Hr=ge`
76
76
  from {
77
77
  transform: scale(0) rotate(45deg);
78
78
  opacity: 0;
@@ -80,7 +80,7 @@ from {
80
80
  to {
81
81
  transform: scale(1) rotate(45deg);
82
82
  opacity: 1;
83
- }`,Kr=ve`
83
+ }`,Kr=ge`
84
84
  0% {
85
85
  height: 0;
86
86
  width: 0;
@@ -94,7 +94,7 @@ to {
94
94
  100% {
95
95
  opacity: 1;
96
96
  height: 10px;
97
- }`,Qr=ke("div")`
97
+ }`,Qr=Ee("div")`
98
98
  width: 20px;
99
99
  opacity: 0;
100
100
  height: 20px;
@@ -121,16 +121,16 @@ to {
121
121
  height: 10px;
122
122
  width: 6px;
123
123
  }
124
- `,Vr=ke("div")`
124
+ `,Vr=Ee("div")`
125
125
  position: absolute;
126
- `,zr=ke("div")`
126
+ `,zr=Ee("div")`
127
127
  position: relative;
128
128
  display: flex;
129
129
  justify-content: center;
130
130
  align-items: center;
131
131
  min-width: 20px;
132
132
  min-height: 20px;
133
- `,Gr=ve`
133
+ `,Gr=ge`
134
134
  from {
135
135
  transform: scale(0.6);
136
136
  opacity: 0.4;
@@ -138,7 +138,7 @@ from {
138
138
  to {
139
139
  transform: scale(1);
140
140
  opacity: 1;
141
- }`,Jr=ke("div")`
141
+ }`,Jr=Ee("div")`
142
142
  position: relative;
143
143
  transform: scale(0.6);
144
144
  opacity: 0.4;
@@ -151,7 +151,7 @@ to {
151
151
  `,Xr=e=>`
152
152
  0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;}
153
153
  100% {transform: translate3d(0,${e*-150}%,-1px) scale(.6); opacity:0;}
154
- `,eo="0%{opacity:0;} 100%{opacity:1;}",to="0%{opacity:1;} 100%{opacity:0;}",no=ke("div")`
154
+ `,eo="0%{opacity:0;} 100%{opacity:1;}",to="0%{opacity:1;} 100%{opacity:0;}",no=Ee("div")`
155
155
  display: flex;
156
156
  align-items: center;
157
157
  background: #fff;
@@ -163,16 +163,16 @@ to {
163
163
  pointer-events: auto;
164
164
  padding: 8px 10px;
165
165
  border-radius: 8px;
166
- `,ro=ke("div")`
166
+ `,ro=Ee("div")`
167
167
  display: flex;
168
168
  justify-content: center;
169
169
  margin: 4px 10px;
170
170
  color: inherit;
171
171
  flex: 1 1 auto;
172
172
  white-space: pre-line;
173
- `,oo=(e,t)=>{let n=e.includes("top")?1:-1,[r,s]=wn()?[eo,to]:[Zr(n),Xr(n)];return{animation:t?`${ve(r)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${ve(s)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},so=cr(({toast:e,position:t,style:n,children:r})=>{let s=e.height?oo(e.position||t||"top-center",e.visible):{opacity:0},i=J(Yr,{toast:e}),a=J(ro,{...e.ariaProps},Ze(e.message,e));return J(no,{className:e.className,style:{...s,...n,...e.style}},typeof r=="function"?r({icon:i,message:a}):J(Y,null,i,a))});Ir(J);var io=({id:e,className:t,style:n,onHeightUpdate:r,children:s})=>{let i=H(a=>{if(a){let c=()=>{let l=a.getBoundingClientRect().height;r(e,l)};c(),new MutationObserver(c).observe(a,{subtree:!0,childList:!0,characterData:!0})}},[e,r]);return J("div",{ref:i,className:t,style:n},s)},ao=(e,t)=>{let n=e.includes("top"),r=n?{top:0}:{bottom:0},s=e.includes("center")?{justifyContent:"center"}:e.includes("right")?{justifyContent:"flex-end"}:{};return{left:0,right:0,display:"flex",position:"absolute",transition:wn()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${t*(n?1:-1)}px)`,...r,...s}},co=rt`
173
+ `,oo=(e,t)=>{let n=e.includes("top")?1:-1,[r,s]=wn()?[eo,to]:[Zr(n),Xr(n)];return{animation:t?`${ge(r)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${ge(s)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},so=cr(({toast:e,position:t,style:n,children:r})=>{let s=e.height?oo(e.position||t||"top-center",e.visible):{opacity:0},i=J(Yr,{toast:e}),a=J(ro,{...e.ariaProps},Ze(e.message,e));return J(no,{className:e.className,style:{...s,...n,...e.style}},typeof r=="function"?r({icon:i,message:a}):J(Y,null,i,a))});Ir(J);var io=({id:e,className:t,style:n,onHeightUpdate:r,children:s})=>{let i=H(a=>{if(a){let c=()=>{let l=a.getBoundingClientRect().height;r(e,l)};c(),new MutationObserver(c).observe(a,{subtree:!0,childList:!0,characterData:!0})}},[e,r]);return J("div",{ref:i,className:t,style:n},s)},ao=(e,t)=>{let n=e.includes("top"),r=n?{top:0}:{bottom:0},s=e.includes("center")?{justifyContent:"center"}:e.includes("right")?{justifyContent:"flex-end"}:{};return{left:0,right:0,display:"flex",position:"absolute",transition:wn()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${t*(n?1:-1)}px)`,...r,...s}},co=rt`
174
174
  z-index: 9999;
175
175
  > * {
176
176
  pointer-events: auto;
177
177
  }
178
- `,Be=16,Pn=({reverseOrder:e,position:t="top-center",toastOptions:n,gutter:r,children:s,toasterId:i,containerStyle:a,containerClassName:c})=>{let{toasts:l,handlers:u}=Dr(n,i);return J("div",{"data-rht-toaster":i||"",style:{position:"fixed",zIndex:9999,top:Be,left:Be,right:Be,bottom:Be,pointerEvents:"none",...a},className:c,onMouseEnter:u.startPause,onMouseLeave:u.endPause},l.map(d=>{let f=d.position||t,m=u.calculateOffset(d,{reverseOrder:e,gutter:r,defaultPosition:t}),h=ao(f,m);return J(io,{id:d.id,key:d.id,onHeightUpdate:u.updateHeight,className:d.visible?co:"",style:h},d.type==="custom"?Ze(d.message,d):s?s(d):J(so,{toast:d,position:f}))}))},P=K;function st(e){const t={subscribe(n){let r=null,s=!1,i=!1,a=!1;function c(){if(r===null){a=!0;return}i||(i=!0,typeof r=="function"?r():r&&r.unsubscribe())}return r=e({next(l){var u;s||(u=n.next)===null||u===void 0||u.call(n,l)},error(l){var u;s||(s=!0,(u=n.error)===null||u===void 0||u.call(n,l),c())},complete(){var l;s||(s=!0,(l=n.complete)===null||l===void 0||l.call(n),c())}}),a&&c(),{unsubscribe:c}},pipe(...n){return n.reduce(lo,t)}};return t}function lo(e,t){return t(e)}function uo(e){const t=new AbortController;return new Promise((n,r)=>{let s=!1;function i(){s||(s=!0,a.unsubscribe())}t.signal.addEventListener("abort",()=>{r(t.signal.reason)});const a=e.subscribe({next(c){s=!0,n(c),i()},error(c){r(c)},complete(){t.abort(),i()}})})}function mo(e){return t=>{let n=0,r=null;const s=[];function i(){r||(r=t.subscribe({next(c){for(const u of s){var l;(l=u.next)===null||l===void 0||l.call(u,c)}},error(c){for(const u of s){var l;(l=u.error)===null||l===void 0||l.call(u,c)}},complete(){for(const l of s){var c;(c=l.complete)===null||c===void 0||c.call(l)}}}))}function a(){if(n===0&&r){const c=r;r=null,c.unsubscribe()}}return st(c=>(n++,s.push(c),i(),{unsubscribe(){n--,a();const l=s.findIndex(u=>u===c);l>-1&&s.splice(l,1)}}))}}function fo(e){let t=e;const n=[],r=a=>{t!==void 0&&a.next(t),n.push(a)},s=a=>{n.splice(n.indexOf(a),1)},i=st(a=>(r(a),()=>{s(a)}));return i.next=a=>{if(t!==a){t=a;for(const c of n)c.next(a)}},i.get=()=>t,i}function ho(e){return st(t=>{function n(r=0,s=e.op){const i=e.links[r];if(!i)throw new Error("No more links to execute - did you forget to add an ending link?");return i({op:s,next(a){return n(r+1,a)}})}return n().subscribe(t)})}function De(e){"@babel/helpers - typeof";return De=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},De(e)}function po(e,t){if(De(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(De(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function yo(e){var t=po(e,"string");return De(t)=="symbol"?t:t+""}function te(e,t,n){return(t=yo(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Bt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Q(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Bt(Object(n),!0).forEach(function(r){te(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bt(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function _e(e){return!!e&&!Array.isArray(e)&&typeof e=="object"}function vo(e){return typeof e=="function"}function go(){return Object.create(null)}const bo=typeof Symbol=="function"&&!!Symbol.asyncIterator;function wo(e){return bo&&_e(e)&&Symbol.asyncIterator in e}const _o=e=>e(),Tn=()=>{},Ut=e=>{Object.freeze&&Object.freeze(e)};function xn(e,t,n){var r;const s=t.join(".");return(r=n[s])!==null&&r!==void 0||(n[s]=new Proxy(Tn,{get(i,a){if(!(typeof a!="string"||a==="then"))return xn(e,[...t,a],n)},apply(i,a,c){const l=t[t.length-1];if(l==="valueOf"||l==="toString"||l==="toJSON")return`tRPC.proxy(${t.slice(0,-1).join(".")})`;let u={args:c,path:t};return l==="call"?u={args:c.length>=2?[c[1]]:[],path:t.slice(0,-1)}:l==="apply"&&(u={args:c.length>=2?c[1]:[],path:t.slice(0,-1)}),Ut(u.args),Ut(u.path),e(u)}})),n[s]}const In=e=>xn(e,[],go()),ko=e=>new Proxy(Tn,{get(t,n){if(n!=="then")return e(n)}});function je(e){"@babel/helpers - typeof";return je=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},je(e)}function Eo(e,t){if(je(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(je(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function So(e){var t=Eo(e,"string");return je(t)=="symbol"?t:t+""}function yt(e,t,n){return(t=So(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ht(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Ue(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ht(Object(n),!0).forEach(function(r){yt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ht(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Po=class extends Error{constructor(e){super(To(e)),Object.assign(this,e)}};function To(e){if("message"in e)return String(e.message)}function xo(e){if(e instanceof Error)return e;const t=typeof e;if(!(t==="undefined"||t==="function"||e===null)){if(t!=="object")return new Error(String(e));if(_e(e))return new Po(e)}}var Kt=class extends Error{constructor(e){var t,n,r;const s=xo(e.cause),i=(t=(n=e.message)!==null&&n!==void 0?n:s?.message)!==null&&t!==void 0?t:e.code;super(i,{cause:s}),yt(this,"cause",void 0),yt(this,"code",void 0),this.code=e.code,this.name="TRPCError",(r=this.cause)!==null&&r!==void 0||(this.cause=s)}};function Io(e,t){if("error"in e){const n=t.deserialize(e.error);return{ok:!1,error:Ue(Ue({},e),{},{error:n})}}return{ok:!0,result:Ue(Ue({},e.result),(!e.result.type||e.result.type==="data")&&{type:"data",data:t.deserialize(e.result.data)})}}var ct=class extends Error{constructor(){super("Unable to transform response from server")}};function No(e,t){let n;try{n=Io(e,t)}catch{throw new ct}if(!n.ok&&(!_e(n.error.error)||typeof n.error.error.code!="number"))throw new ct;if(n.ok&&!_e(n.result))throw new ct;return n}function Co(e){return typeof e=="function"}async function Oo(e,t){const{_def:n}=e;let r=n.procedures[t];for(;!r;){const s=Object.keys(n.lazy).find(i=>t===i||t.startsWith(i+"."));if(!s)return null;await n.lazy[s].load(),r=n.procedures[t]}return r}async function Ao(e){const{type:t,path:n}=e,r=await Oo(e.router,n);if(!r||!Co(r)||r._def.type!==t&&!e.allowMethodOverride)throw new Kt({code:"NOT_FOUND",message:`No "${t}"-procedure on path "${n}"`});if(r._def.type!==t&&e.allowMethodOverride&&r._def.type==="subscription")throw new Kt({code:"METHOD_NOT_SUPPORTED",message:"Method override is not supported for subscriptions"});return r(e)}function Lo(e){return e instanceof Xe}function Ro(e){return _e(e)&&_e(e.error)&&typeof e.error.code=="number"&&typeof e.error.message=="string"}function $o(e,t){return typeof e=="string"?e:_e(e)&&typeof e.message=="string"?e.message:t}var Xe=class Je extends Error{constructor(t,n){var r,s;const i=n?.cause;super(t,{cause:i}),te(this,"cause",void 0),te(this,"shape",void 0),te(this,"data",void 0),te(this,"meta",void 0),this.meta=n?.meta,this.cause=i,this.shape=n==null||(r=n.result)===null||r===void 0?void 0:r.error,this.data=n==null||(s=n.result)===null||s===void 0?void 0:s.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,Je.prototype)}static from(t,n={}){const r=t;return Lo(r)?(n.meta&&(r.meta=Q(Q({},r.meta),n.meta)),r):Ro(r)?new Je(r.error.message,Q(Q({},n),{},{result:r,cause:n.cause})):new Je($o(r,"Unknown error"),Q(Q({},n),{},{cause:r}))}};function qo(e){const t=e;return t?"input"in t?t:{input:t,output:t}:{input:{serialize:n=>n,deserialize:n=>n},output:{serialize:n=>n,deserialize:n=>n}}}const Qt=e=>typeof e=="function";function Do(e){if(e)return e;if(typeof window<"u"&&Qt(window.fetch))return window.fetch.bind(window);if(typeof globalThis<"u"&&Qt(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}function jo(...e){const t=new AbortController,n=e.length;let r=0;const s=()=>{++r===n&&t.abort()};for(const i of e)i?.aborted?s():i?.addEventListener("abort",s,{once:!0});return t.signal}function Mo(...e){const t=new AbortController;for(const n of e)n?.aborted?t.abort():n?.addEventListener("abort",()=>t.abort(),{once:!0});return t.signal}function Fo(e){return{url:e.url.toString(),fetch:e.fetch,transformer:qo(e.transformer),methodOverride:e.methodOverride}}function Wo(e){const t={};for(let n=0;n<e.length;n++){const r=e[n];t[n]=r}return t}const Bo={query:"GET",mutation:"POST",subscription:"PATCH"};function Nn(e){return"input"in e?e.transformer.input.serialize(e.input):Wo(e.inputs.map(t=>e.transformer.input.serialize(t)))}const Cn=e=>{const t=e.url.split("?");let n=t[0].replace(/\/$/,"")+"/"+e.path;const r=[];if(t[1]&&r.push(t[1]),"inputs"in e&&r.push("batch=1"),e.type==="query"||e.type==="subscription"){const s=Nn(e);s!==void 0&&e.methodOverride!=="POST"&&r.push(`input=${encodeURIComponent(JSON.stringify(s))}`)}return r.length&&(n+="?"+r.join("&")),n},Uo=e=>{if(e.type==="query"&&e.methodOverride!=="POST")return;const t=Nn(e);return t!==void 0?JSON.stringify(t):void 0},Ho=e=>zo(Q(Q({},e),{},{contentTypeHeader:"application/json",getUrl:Cn,getBody:Uo}));var Ko=class extends Error{constructor(){const e="AbortError";super(e),this.name=e,this.message=e}};const Qo=e=>{var t;if(e?.aborted)throw(t=e.throwIfAborted)===null||t===void 0||t.call(e),typeof DOMException<"u"?new DOMException("AbortError","AbortError"):new Ko};async function Vo(e){var t,n;Qo(e.signal);const r=e.getUrl(e),s=e.getBody(e),i=(t=e.methodOverride)!==null&&t!==void 0?t:Bo[e.type],a=await(async()=>{const l=await e.headers();return Symbol.iterator in l?Object.fromEntries(l):l})(),c=Q(Q(Q({},e.contentTypeHeader&&i!=="GET"?{"content-type":e.contentTypeHeader}:{}),e.trpcAcceptHeader?{[(n=e.trpcAcceptHeaderKey)!==null&&n!==void 0?n:"trpc-accept"]:e.trpcAcceptHeader}:void 0),a);return Do(e.fetch)(r,{method:i,signal:e.signal,body:s,headers:c})}async function zo(e){const t={},n=await Vo(e);t.response=n;const r=await n.json();return t.responseJSON=r,{json:r,meta:t}}const Vt=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function zt(e){let t=null,n=null;const r=()=>{clearTimeout(n),n=null,t=null};function s(c){const l=[[]];let u=0;for(;;){const m=c[u];if(!m)break;const h=l[l.length-1];if(m.aborted){var d;(d=m.reject)===null||d===void 0||d.call(m,new Error("Aborted")),u++;continue}if(e.validate(h.concat(m).map(p=>p.key))){h.push(m),u++;continue}if(h.length===0){var f;(f=m.reject)===null||f===void 0||f.call(m,new Error("Input is too big for a single dispatch")),u++;continue}l.push([])}return l}function i(){const c=s(t);r();for(const l of c){if(!l.length)continue;const u={items:l};for(const d of l)d.batch=u;e.fetch(u.items.map(d=>d.key)).then(async d=>{await Promise.all(d.map(async(m,h)=>{const p=u.items[h];try{var _;const E=await Promise.resolve(m);(_=p.resolve)===null||_===void 0||_.call(p,E)}catch(E){var x;(x=p.reject)===null||x===void 0||x.call(p,E)}p.batch=null,p.reject=null,p.resolve=null}));for(const m of u.items){var f;(f=m.reject)===null||f===void 0||f.call(m,new Error("Missing result")),m.batch=null}}).catch(d=>{for(const m of u.items){var f;(f=m.reject)===null||f===void 0||f.call(m,d),m.batch=null}})}}function a(c){var l;const u={aborted:!1,key:c,batch:null,resolve:Vt,reject:Vt},d=new Promise((f,m)=>{var h;u.reject=m,u.resolve=f,(h=t)!==null&&h!==void 0||(t=[]),t.push(u)});return(l=n)!==null&&l!==void 0||(n=setTimeout(i)),d}return{load:a}}function Go(e){var t,n;const r=Fo(e),s=(t=e.maxURLLength)!==null&&t!==void 0?t:1/0,i=(n=e.maxItems)!==null&&n!==void 0?n:1/0;return()=>{const a=l=>({validate(u){if(s===1/0&&i===1/0)return!0;if(u.length>i)return!1;const d=u.map(m=>m.path).join(","),f=u.map(m=>m.input);return Cn(Q(Q({},r),{},{type:l,path:d,inputs:f,signal:null})).length<=s},async fetch(u){const d=u.map(p=>p.path).join(","),f=u.map(p=>p.input),m=jo(...u.map(p=>p.signal)),h=await Ho(Q(Q({},r),{},{path:d,inputs:f,type:l,headers(){return e.headers?typeof e.headers=="function"?e.headers({opList:u}):e.headers:{}},signal:m}));return(Array.isArray(h.json)?h.json:u.map(()=>h.json)).map(p=>({meta:h.meta,json:p}))}}),c={query:zt(a("query")),mutation:zt(a("mutation"))};return({op:l})=>st(u=>{if(l.type==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");const d=new AbortController,f=c[l.type].load(Q(Q({},l),{},{signal:Mo(l.signal,d.signal)}));let m=!1,h;return f.then(p=>{m=!0,h=p;const _=No(p.json,r.transformer.output);if(!_.ok){u.error(Xe.from(_.error,{meta:p.meta}));return}u.next({context:p.meta,result:_.result}),u.complete()}).catch(p=>{m=!0,u.error(Xe.from(p,{meta:h?.meta}))}),()=>{m||d.abort()}})}}const On=(e,...t)=>typeof e=="function"?e(...t):e;function Jo(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}async function Yo(e){const t=await On(e.url);return e.connectionParams?t+`${t.includes("?")?"&":"?"}connectionParams=1`:t}async function Zo(e,t){const n={method:"connectionParams",data:await On(e)};return t.encode(n)}function Xo(e){const{promise:t,resolve:n,reject:r}=Jo();return e.addEventListener("open",()=>{e.removeEventListener("error",r),n()}),e.addEventListener("error",r),t}function es(e,{intervalMs:t,pongTimeoutMs:n}){let r,s;function i(){r=setTimeout(()=>{e.send("PING"),s=setTimeout(()=>{e.close()},n)},t)}function a(){clearTimeout(r),i()}function c(){clearTimeout(s),a()}e.addEventListener("open",i),e.addEventListener("message",({data:l})=>{clearTimeout(r),i(),l==="PONG"&&c()}),e.addEventListener("close",()=>{clearTimeout(r),clearTimeout(s)})}var ts=class vt{constructor(t){var n;if(te(this,"id",++vt.connectCount),te(this,"WebSocketPonyfill",void 0),te(this,"urlOptions",void 0),te(this,"keepAliveOpts",void 0),te(this,"encoder",void 0),te(this,"wsObservable",fo(null)),te(this,"openPromise",null),this.WebSocketPonyfill=(n=t.WebSocketPonyfill)!==null&&n!==void 0?n:WebSocket,!this.WebSocketPonyfill)throw new Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");this.urlOptions=t.urlOptions,this.keepAliveOpts=t.keepAlive,this.encoder=t.encoder}get ws(){return this.wsObservable.get()}set ws(t){this.wsObservable.next(t)}isOpen(){return!!this.ws&&this.ws.readyState===this.WebSocketPonyfill.OPEN&&!this.openPromise}isClosed(){return!!this.ws&&(this.ws.readyState===this.WebSocketPonyfill.CLOSING||this.ws.readyState===this.WebSocketPonyfill.CLOSED)}async open(){if(this.openPromise)return this.openPromise;this.id=++vt.connectCount;const t=Yo(this.urlOptions).then(n=>new this.WebSocketPonyfill(n));this.openPromise=t.then(async n=>{this.ws=n,n.binaryType="arraybuffer",n.addEventListener("message",function({data:r}){r==="PING"&&this.send("PONG")}),this.keepAliveOpts.enabled&&es(n,this.keepAliveOpts),n.addEventListener("close",()=>{this.ws===n&&(this.ws=null)}),await Xo(n),this.urlOptions.connectionParams&&n.send(await Zo(this.urlOptions.connectionParams,this.encoder))});try{await this.openPromise}finally{this.openPromise=null}}async close(){try{await this.openPromise}finally{var t;(t=this.ws)===null||t===void 0||t.close()}}};te(ts,"connectCount",0);var An=class{constructor(e){te(this,"links",void 0),te(this,"runtime",void 0),te(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=e.links.map(t=>t(this.runtime))}$request(e){var t;return ho({links:this.links,op:Q(Q({},e),{},{context:(t=e.context)!==null&&t!==void 0?t:{},id:++this.requestId})}).pipe(mo())}async requestAsPromise(e){try{const t=this.$request(e);return(await uo(t)).result.data}catch(t){throw Xe.from(t)}}query(e,t,n){return this.requestAsPromise({type:"query",path:e,input:t,context:n?.context,signal:n?.signal})}mutation(e,t,n){return this.requestAsPromise({type:"mutation",path:e,input:t,context:n?.context,signal:n?.signal})}subscription(e,t,n){return this.$request({type:"subscription",path:e,input:t,context:n.context,signal:n.signal}).subscribe({next(r){switch(r.result.type){case"state":var s;(s=n.onConnectionStateChange)===null||s===void 0||s.call(n,r.result);break;case"started":var i;(i=n.onStarted)===null||i===void 0||i.call(n,{context:r.context});break;case"stopped":var a;(a=n.onStopped)===null||a===void 0||a.call(n);break;case"data":case void 0:var c;(c=n.onData)===null||c===void 0||c.call(n,r.result.data)}},error(r){var s;(s=n.onError)===null||s===void 0||s.call(n,r)},complete(){var r;(r=n.onComplete)===null||r===void 0||r.call(n)}})}};const Ln=Symbol.for("trpc_untypedClient"),ns={query:"query",mutate:"mutation",subscribe:"subscription"},rs=e=>ns[e];function os(e){const t=In(({path:n,args:r})=>{const s=[...n],i=rs(s.pop()),a=s.join(".");return e[i](a,...r)});return ko(n=>n===Ln?e:t[n])}function ss(e){return os(new An(e))}function is(e){return e[Ln]}function Me(e){"@babel/helpers - typeof";return Me=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Me(e)}function as(e,t){if(Me(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Me(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function cs(e){var t=as(e,"string");return Me(t)=="symbol"?t:t+""}function ls(e,t,n){return(t=cs(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Gt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function L(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Gt(Object(n),!0).forEach(function(r){ls(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gt(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function us(e){var t,n,r,s=2;for(typeof Symbol<"u"&&(n=Symbol.asyncIterator,r=Symbol.iterator);s--;){if(n&&(t=e[n])!=null)return t.call(e);if(r&&(t=e[r])!=null)return new Ye(t.call(e));n="@@asyncIterator",r="@@iterator"}throw new TypeError("Object is not async iterable")}function Ye(e){function t(n){if(Object(n)!==n)return Promise.reject(new TypeError(n+" is not an object."));var r=n.done;return Promise.resolve(n.value).then(function(s){return{value:s,done:r}})}return Ye=function(r){this.s=r,this.n=r.next},Ye.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(r){var s=this.s.return;return s===void 0?Promise.resolve({value:r,done:!0}):t(s.apply(this.s,arguments))},throw:function(r){var s=this.s.return;return s===void 0?Promise.reject(r):t(s.apply(this.s,arguments))}},new Ye(e)}function ds(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function ms(e,t){if(e==null)return{};var n,r,s=ds(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}const fs=["cursor","direction"];function it(e){return{path:e.path.join(".")}}function hs(e){return e.length>=3}function ps(e){return hs(e)?{type:"prefixed",prefix:e[0],path:e[1],args:e[2]}:{type:"unprefixed",prefix:void 0,path:e[0],args:e[1]}}function Nt(e,t,n){var r;const s=ps(e);let i=(r=s.args)===null||r===void 0?void 0:r.input;if(n){var a,c;i=L(L(L({},(a=(c=s.args)===null||c===void 0?void 0:c.input)!==null&&a!==void 0?a:{}),n.pageParam!==void 0?{cursor:n.pageParam}:{}),{},{direction:n.direction})}return[s.path.join("."),i,t?.trpc]}async function ys(e,t,n){const r=t.getQueryCache().build(t,{queryKey:n});r.setState({data:[],status:"success"});const s=[];var i=!1,a=!1,c;try{for(var l=us(e),u;i=!(u=await l.next()).done;i=!1){const d=u.value;s.push(d),r.setState({data:[...s]})}}catch(d){a=!0,c=d}finally{try{i&&l.return!=null&&await l.return()}finally{if(a)throw c}}return s}function pe(e){const t=_o(()=>{const{input:n,type:r}=e,s=e.path.flatMap(i=>i.split("."));if(!n&&r==="any")return s.length?[s]:[];if(r==="infinite"&&_e(n)&&("direction"in n||"cursor"in n)){const{cursor:i,direction:a}=n;return[s,{input:ms(n,fs),type:"infinite"}]}return[s,L(L({},typeof n<"u"&&n!==Pe&&{input:n}),r&&r!=="any"&&{type:r})]});return e.prefix&&t.unshift([e.prefix]),t}function Rn(e){const t=[e.path.flatMap(n=>n.split("."))];return e.prefix&&t.unshift([e.prefix]),t}function Ct(e){return vo(e)?e():e}function vs(e){var t;const{input:n,query:r,path:s,queryKey:i,opts:a}=e,c=n===Pe,l=async u=>{var d;const f=L(L({},a),{},{trpc:L(L({},a?.trpc),!(a==null||(d=a.trpc)===null||d===void 0)&&d.abortOnUnmount?{signal:u.signal}:{signal:null})});return await r(...Nt(i,f,{direction:u.direction,pageParam:u.pageParam}))};return Object.assign(yr(L(L({},a??{}),{},{queryKey:i,queryFn:c?Pe:l,initialPageParam:(t=a?.initialCursor)!==null&&t!==void 0?t:n?.cursor})),{trpc:it({path:s})})}function gs(e){var t,n;const{mutate:r,path:s,prefix:i,opts:a,overrides:c}=e,l=Ct(e.queryClient),u=Rn({path:s,prefix:(t=a?.keyPrefix)!==null&&t!==void 0?t:i}),d=l.defaultMutationOptions(l.getMutationDefaults(u)),f=(n=c?.onSuccess)!==null&&n!==void 0?n:(h=>h.originalFn()),m=async h=>await r(...Nt([...u,{input:h}],a));return L(L({},a),{},{mutationKey:u,mutationFn:m,onSuccess(...h){var p,_;return f({originalFn:()=>{var E,y,v;return(E=a==null||(y=a.onSuccess)===null||y===void 0?void 0:y.call(a,...h))!==null&&E!==void 0?E:d==null||(v=d.onSuccess)===null||v===void 0?void 0:v.call(d,...h)},queryClient:l,meta:(p=(_=a?.meta)!==null&&_!==void 0?_:d?.meta)!==null&&p!==void 0?p:{}})},trpc:it({path:s})})}function bs(e){const{input:t,query:n,path:r,queryKey:s,opts:i}=e,a=Ct(e.queryClient),c=t===Pe,l=async u=>{var d;const f=L(L({},i),{},{trpc:L(L({},i?.trpc),!(i==null||(d=i.trpc)===null||d===void 0)&&d.abortOnUnmount?{signal:u.signal}:{signal:null})}),m=u.queryKey,h=await n(...Nt(m,f));return wo(h)?ys(h,a,m):h};return Object.assign(vr(L(L({},i),{},{queryKey:s,queryFn:c?Pe:l})),{trpc:it({path:r})})}const ws=e=>{const{subscribe:t,path:n,queryKey:r,input:s,opts:i={}}=e,a="enabled"in i?!!i.enabled:s!==Pe,c=l=>t(n.join("."),s===Pe?void 0:s,l);return L(L({},i),{},{enabled:a,subscribe:c,queryKey:r,trpc:it({path:n})})};function _s(e){const t=e.keyPrefix,n=r=>(s,i,a)=>"router"in e?Promise.resolve(Ct(e.ctx)).then(c=>Ao({router:e.router,path:s,getRawInput:async()=>i,ctx:c,type:r,signal:void 0,batchIndex:0})):(e.client instanceof An?e.client:is(e.client))[r](s,i,a);return In(({args:r,path:s})=>{const i=[...s],a=i.pop(),[c,l]=r;return{"~types":void 0,pathKey:()=>pe({path:i,type:"any",prefix:t}),pathFilter:()=>L(L({},c),{},{queryKey:pe({path:i,type:"any",prefix:t})}),queryOptions:()=>bs({input:c,opts:l,path:i,queryClient:e.queryClient,queryKey:pe({path:i,input:c,type:"query",prefix:t}),query:n("query")}),queryKey:()=>pe({path:i,input:c,type:"query",prefix:t}),queryFilter:()=>L(L({},l),{},{queryKey:pe({path:i,input:c,type:"query",prefix:t})}),infiniteQueryOptions:()=>vs({input:c,opts:l,path:i,queryKey:pe({path:i,input:c,type:"infinite",prefix:t}),query:n("query")}),infiniteQueryKey:()=>pe({path:i,input:c,type:"infinite",prefix:t}),infiniteQueryFilter:()=>L(L({},l),{},{queryKey:pe({path:i,input:c,type:"infinite",prefix:t})}),mutationOptions:()=>{var u;return gs({opts:c,path:i,prefix:t,queryClient:e.queryClient,mutate:n("mutation"),overrides:(u=e.overrides)===null||u===void 0?void 0:u.mutations})},mutationKey:()=>Rn({path:i,prefix:t}),subscriptionOptions:()=>ws({opts:l,path:i,input:c,queryKey:pe({path:i,input:c,type:"any",prefix:t}),subscribe:n("subscription")})}[a]()})}function ks(){const e=fe(null),t=fe(null),n=i=>{const a=Ce(()=>_s({client:i.trpcClient,queryClient:i.queryClient,keyPrefix:i.keyPrefix}),[i.trpcClient,i.queryClient,i.keyPrefix]);return J(e.Provider,{value:i.trpcClient},J(t.Provider,{value:a},i.children))};n.displayName="TRPCProvider";function r(){const i=he(t);if(!i)throw new Error("useTRPC() can only be used inside of a <TRPCProvider>");return i}function s(){const i=he(e);if(!i)throw new Error("useTRPCClient() can only be used inside of a <TRPCProvider>");return i}return{TRPCProvider:n,useTRPC:r,useTRPCClient:s}}const gt={lan:new Set,animepahe:new Set,jasmr:new Set};function Se(e){for(const t of[...gt[e]])try{t()}catch(n){console.error(`auth-bus listener failed (${e}):`,n)}}function $n(e,t){return gt[e].add(t),()=>{gt[e].delete(t)}}let et="default";function qn(){return et}function Es(e){et=e}const Ss=new Set(["playerVideoDelayMs","playerVideoDelayEnabled","anime4kEnabled"]);function He(e){return et==="default"||Ss.has(e)?e:`dango:profile:${et}:${e}`}const V={keyFor:He,getItem:e=>localStorage.getItem(He(e)),setItem:(e,t)=>localStorage.setItem(He(e),t),removeItem:e=>localStorage.removeItem(He(e))};function Ps(){localStorage.setItem("dango:profile-session-change",`${Date.now()}-${Math.random()}`),window.location.assign("/")}const Ts=(e,t)=>new Promise((n,r)=>{t?.throwIfAborted();const s=()=>{clearTimeout(i),r(t?.reason)},i=setTimeout(()=>{t?.removeEventListener("abort",s),n()},e);t?.addEventListener("abort",s,{once:!0})}),Ot=async(e,t)=>{const n=e instanceof Request?e:void 0,r=new Headers(n?.headers);(!t?.body||!(t.body instanceof FormData))&&r.set("Content-Type","application/json");const s=n?.url??e.toString(),i=s.startsWith("/")&&!s.startsWith("//")||typeof window<"u"&&new URL(s,window.location.origin).origin===window.location.origin;if(i){!s.includes("/api/profiles/status")&&!s.includes("/api/profiles/login")&&!s.includes("/api/auth/app-")&&r.set("x-dango-profile-id",qn());let f=V.getItem("animepahe_ua"),m=V.getItem("animepahe_cookie");m&&f&&f!==navigator.userAgent&&(V.removeItem("animepahe_cookie"),V.removeItem("animepahe_ua"),m=null,f=null,P.error("Your browser changed. Verify AnimePahe again to refresh its cookie."),Se("animepahe"));const h=V.getItem("jasmr_ua"),p=V.getItem("jasmr_cookie");f&&r.set("x-animepahe-ua",f),m&&r.set("x-animepahe-cookie",m),h&&r.set("x-jasmr-ua",h),p&&r.set("x-jasmr-cookie",p)}new Headers(t?.headers).forEach((f,m)=>r.set(m,f));const a={...t,headers:r},c=(t?.method??n?.method??"GET").toUpperCase(),l=t?.signal??n?.signal,u=i&&(c==="GET"||c==="HEAD");let d=await fetch(e,a);i&&d.status===409&&(await d.clone().json().catch(()=>null))?.error==="PROFILE_CHANGED"&&window.location.reload(),i&&d.status===401&&!s.includes("/api/profiles/")&&(await d.clone().json().catch(()=>null))?.error==="PROFILE_AUTH_REQUIRED"&&window.dispatchEvent(new Event("dango:profile-auth-required"));for(let f=0;u&&d.status===503&&d.headers.get("x-dango-not-ready")==="1"&&f<3;f++)await d.body?.cancel(),await Ts(500*2**f,l),d=await fetch(e,a);return d},$e=async(e,t)=>{const n=await Ot(e,t);if(!n.ok){const r=await n.text().catch(()=>"");let s={};try{s=JSON.parse(r)}catch{}const i=typeof s.error=="string"?s.error:"";throw n.status===403&&i==="AUTH_REQUIRED"&&s.provider==="animepahe"&&Se("animepahe"),n.status===403&&i==="AUTH_REQUIRED"&&s.provider==="jasmr"&&Se("jasmr"),n.status===401&&i==="LAN_AUTH_REQUIRED"&&Se("lan"),new Error(i||`Failed to fetch from ${e}`)}return n.json()};async function xs(e,t){const n=await Ot(e,t);if(n.status===401)try{(await n.clone().json())?.error==="LAN_AUTH_REQUIRED"&&Se("lan")}catch{}return await Is(n),n}async function Is(e){try{if(!e.headers.get("content-type")?.includes("json"))return;const t=await e.clone().json(),n=Array.isArray(t)?t:[t];for(const r of n){const s=r?.error;if(!s||typeof s!="object")continue;const i=s.data?.cause;(s.message==="AUTH_REQUIRED"||i?.code==="AUTH_REQUIRED")&&(i?.provider==="animepahe"||i?.provider==="jasmr")&&Se(i.provider),(s.message==="LAN_AUTH_REQUIRED"||i?.code==="LAN_AUTH_REQUIRED")&&Se("lan")}}catch{}}const{TRPCProvider:Ns,useTRPC:q}=ks(),ae=ss({links:[Go({url:"/api/trpc",fetch:xs})]}),Oe=new Map,Cs=500,Os=(e,t,n)=>{if(!e||e.trim()==="")return"/placeholder.svg";if(e.includes("/api/image-proxy")){let a=e;if(t&&!a.includes("w=")){const c=a.includes("?")?"&":"?";a+=`${c}w=${t}`}if(n&&!a.includes("h=")){const c=a.includes("?")?"&":"?";a+=`${c}h=${n}`}return a}let r=e;r.includes("aln.youtube-anime.com")&&(r=r.replace(/https?:\/\/allanime\.day\/aln\.youtube-anime\.com/,"https://aln.youtube-anime.com"),r.includes("/images/mcovers")&&(r=r.replace("/images/mcovers","/mcovers")),r.includes("/images/images2")&&(r=r.replace("/images/images2","/images2"))),r.includes("allanime.day/s4.anilist.co")&&(r=r.replace(/https?:\/\/allanime\.day\/s4\.anilist\.co/,"https://s4.anilist.co")),r.includes("wp.youtube-anime.com/s4.anilist.co")&&(r=r.replace(/https?:\/\/wp\.youtube-anime\.com\/s4\.anilist\.co/,"https://s4.anilist.co"));const s=`${r}-${t}-${n}`;if(Oe.has(s))return Oe.get(s);let i;if(r.startsWith("https://s4.anilist.co"))i=r,t&&(i+=`${i.includes("?")?"&":"?"}w=${t}`),n&&(i+=`${i.includes("?")?"&":"?"}h=${n}`);else if(r.includes("animepahe")){i=`/api/image-proxy?url=${encodeURIComponent(r)}`;const a=V.getItem("animepahe_cookie"),c=V.getItem("animepahe_ua");a&&(i+=`&cookie=${encodeURIComponent(a)}`),c&&(i+=`&ua=${encodeURIComponent(c)}`)}else if(r.startsWith("http"))i=`/api/image-proxy?url=${encodeURIComponent(r)}`,t&&(i+=`&w=${t}`),n?i+=`&h=${n}`:t||(i+="&w=300");else{const c=`${r.startsWith("mcovers")||r.startsWith("images2")?"https://aln.youtube-anime.com":"https://aln.youtube-anime.com/images"}/${r}`;i=`/api/image-proxy?url=${encodeURIComponent(c)}`,t&&(i+=`&w=${t}`),n?i+=`&h=${n}`:t||(i+="&w=300")}return Oe.size>Cs&&Oe.clear(),Oe.set(s,i),i},Vl=e=>{if(isNaN(e)||e<=0)return"00:00";const t=new Date(e*1e3).toISOString().slice(11,19);return parseInt(t.slice(0,2),10)>0?t:t.slice(3)};function zl(e){return e?e.replace(/<[^>]*>?/gm,"").replace(/&nbsp;/g," ").replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").trim():""}function Gl(e){return e==null?e:e>10?Number((e/10).toFixed(1)):e}const As=(...e)=>e.filter(Boolean).join(" ");function Ls(e,t,n="..."){return e?e.length>t?e.slice(0,t)+n:e:""}const Dn=fe(void 0),Rs=()=>{const e=he(Dn);if(e===void 0)throw new Error("useTitlePreference must be used within a TitlePreferenceProvider");return e},$={watchlist:"watchlist",continueWatching:"allContinueWatching",queueRemaining:"queue-remaining",suggestedEpisode:"suggestedEpisode",trendingList:"trendingList",latestReleases:"latestReleases",thisWeekSchedule:"thisWeekSchedule",schedule:"schedule",genreCards:"genreCards",queue:"queue",playerData:"player-data",showData:"show-data",showMeta:"show-meta",videoSources:"video-sources",tvSources:"tv-sources",tvLibrary:"tv-library",tvContinueWatching:"tv-continue-watching",tvProgress:"tv-progress",mangaLibrary:"manga-library",mangaContinueReading:"manga-continue-reading",mangaProgress:"manga-progress",mangaBrowse:"mangaBrowse",mangaBrowseInfinite:"mangaBrowseInfinite",mangaDetail:"mangaDetail",mangaPages:"mangaPages",asmrLibrary:"asmr-library",asmrContinueListening:"asmr-continue-listening",asmrProgress:"asmr-progress",asmrBrowse:"asmrBrowse",asmrWork:"asmrWork",trackerStatus:"trackerStatus",anilistClientId:"anilistClientId",malClientConfig:"malClientConfig",notifications:"notifications",settings:"settings",insights:"insights",insightsRecommendations:"insights-recommendations",providers:"providers",syncProfile:"sync-profile"},Jl=()=>{const e=q(),t=ne({...e.data.spotlight.queryOptions(),staleTime:1e3*60*5,retry:1});return{...t,data:t.data}},Yl=(e="TRENDING_DESC",t=10)=>xt({queryKey:[$.trendingList,e,t],queryFn:({pageParam:n=1})=>ae.data.popularList.query({sort:e,page:n,size:t}),initialPageParam:1,getNextPageParam:(n,r)=>n.length>=t?r.length+1:void 0}),Zl=(e="TV",t=12)=>xt({queryKey:[$.latestReleases,e,t],queryFn:({pageParam:n=1})=>ae.data.latestReleases.query({format:e,page:n,size:t}),initialPageParam:1,getNextPageParam:(n,r)=>n.length>=t?r.length+1:void 0}),Xl=(e,t="TV",n=!0)=>{const r=q();return ne({...r.data.seasonal.queryOptions({page:e,format:t}),enabled:n,staleTime:1e3*60*5})},$s=["query","sortBy","type","status","season","year","country","genres","excludeGenres","excludeTags","minScore","minEpisodes","adult"],eu=(e,t,n=14)=>{const r=q(),s=new URLSearchParams(e),i={page:t,limit:n};for(const a of $s){const c=s.get(a);c!==null&&(i[a]=c)}return ne({...r.data.search.queryOptions(i),enabled:e!=null})},tu=()=>{const e=q();return ne(e.queue.list.queryOptions())},qs=()=>{const e=q(),t=Z();return ie(e.queue.add.mutationOptions({onSuccess:n=>{n.queued?P.success("Added to queue"):P.success("Removed from queue"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[$.queueRemaining]})},onError:n=>{P.error(`Failed to update queue: ${n.message}`)}}))},nu=()=>{const e=q(),t=Z();return ie(e.queue.remove.mutationOptions({onSuccess:()=>{P.success("Removed from queue"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[$.queueRemaining]}),t.invalidateQueries({queryKey:[$.continueWatching]})},onError:n=>{P.error(`Failed to remove: ${n.message}`)}}))},ru=(e,t=!0)=>ne({queryKey:[$.queueRemaining,e],queryFn:()=>ae.watchlist.queueRemaining.query({showId:e}),enabled:!!e&&t,staleTime:1e3*60}),ou=()=>{const e=q(),t=Z();return ie(e.queue.addBatch.mutationOptions({onSuccess:(n,r)=>{const s=n.added??r.episodeNumbers.length;P.success(`${s} ${s===1?"episode":"episodes"} added to queue`),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[$.queueRemaining]})},onError:n=>{P.error(`Failed to update queue: ${n.message}`)}}))},su=()=>{const e=q(),t=Z();return ie(e.queue.removeMany.mutationOptions({onSuccess:()=>{P.success("Removed from queue"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[$.queueRemaining]}),t.invalidateQueries({queryKey:[$.continueWatching]})},onError:n=>{P.error(`Failed to remove: ${n.message}`)}}))},iu=()=>{const e=q(),t=Z();return ie(e.queue.clear.mutationOptions({onSuccess:()=>{P.success("Queue cleared"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[$.queueRemaining]}),t.invalidateQueries({queryKey:[$.continueWatching]})},onError:n=>{P.error(`Failed to clear queue: ${n.message}`)}}))},au=()=>{const e=q(),t=Z(),n=e.queue.list.queryOptions().queryKey;return ie(e.queue.reorder.mutationOptions({onMutate:async r=>{await t.cancelQueries({queryKey:n});const s=t.getQueryData(n);return t.setQueryData(n,i=>{if(!i)return i;const a=new Map(i.map(c=>[c.id,c]));return r.map((c,l)=>{const u=a.get(c.id??-1);return u?{...u,queue_order:l}:void 0}).filter(c=>!!c)}),{previousQueue:s}},onError:(r,s,i)=>{i?.previousQueue&&t.setQueryData(n,i.previousQueue)},onSettled:()=>{t.invalidateQueries(e.queue.pathFilter())}}))},Ds=["status","showMature","query","type","season","year","genres","excludeGenres","sortBy","titlePreference"];function At(e,t,n){const r=new URLSearchParams(e),s={page:t,limit:n};for(const i of Ds){const a=r.get(i);a!==null&&(s[i]=a)}return s}const cu=(e,t="",n,r=14)=>ne({queryKey:[$.watchlist,e,t,n,r],queryFn:async()=>{const s=new URLSearchParams(t);return s.set("status",e),await ae.watchlist.list.query(At(s.toString(),n,r))}}),lu=(e="")=>xt({queryKey:[$.continueWatching,e],queryFn:async({pageParam:t=1})=>await ae.watchlist.continueWatchingAll.query(At(e,t,14)),initialPageParam:1,getNextPageParam:t=>{if(!(t.data.length===0||t.page*t.limit>=t.total))return t.page+1},select:t=>({...t,pages:t.pages.flatMap(n=>n.data)})}),uu=(e="",t,n=14)=>ne({queryKey:[$.continueWatching,e,t,n],queryFn:async()=>await ae.watchlist.continueWatchingAll.query(At(e,t,n))}),du=()=>{const e=q(),t=Z();return ie(e.watchlist.remove.mutationOptions({onSuccess:()=>{P.success("Removed from watchlist"),t.invalidateQueries(e.watchlist.pathFilter()),t.invalidateQueries({queryKey:[$.watchlist]})},onError:n=>{P.error(`Failed to remove: ${n.message}`)}}))},mu=()=>{const e=q(),t=Z();return ie(e.watchlist.batchStatus.mutationOptions({onSuccess:n=>{P.success(`Status updated for ${n.updated??0} items`),t.invalidateQueries(e.watchlist.pathFilter()),t.invalidateQueries({queryKey:[$.watchlist]}),t.invalidateQueries({queryKey:[$.continueWatching]})},onError:n=>{P.error(`Failed to update statuses: ${n.message}`)}}))},fu=()=>{const e=q(),t=Z();return ie(e.watchlist.removeMany.mutationOptions({onSuccess:n=>{const r=n.removed??0;P.success(`Removed ${r} ${r===1?"item":"items"} from watchlist`),t.invalidateQueries(e.watchlist.pathFilter()),t.invalidateQueries({queryKey:[$.watchlist]}),t.invalidateQueries({queryKey:[$.continueWatching]})},onError:n=>{P.error(`Failed to remove: ${n.message}`)}}))},hu=()=>{const e=q(),t=Z();return ie(e.continueWatching.removeMany.mutationOptions({onSuccess:n=>{const r=n.removed??0;P.success(`Removed ${r} ${r===1?"item":"items"} from continue watching`),t.invalidateQueries(e.continueWatching.pathFilter()),t.invalidateQueries({queryKey:[$.continueWatching]})},onError:n=>{P.error(`Failed to remove: ${n.message}`)}}))},jn=(e=!0)=>{const t=q();return ne({...t.notifications.list.queryOptions(),enabled:e,refetchInterval:3e4})},Mn=(e=!0)=>{const t=q();return ne({...t.data.systemNotifications.queryOptions(),enabled:e,refetchInterval:3e4})},Fn=(e=!0)=>{const t=q();return ne({...t.discovery.status.queryOptions(),enabled:e,refetchInterval:n=>n.state.data?.running?2e3:!1})},js=()=>{const e=q(),t=Z(),n=e.discovery.status.queryOptions().queryKey;return ie(e.discovery.refresh.mutationOptions({onSuccess:r=>{t.setQueryData(n,{running:r.running,state:r.state,total:r.total,done:r.done,lastRunAt:r.lastRunAt}),t.invalidateQueries(e.notifications.pathFilter()),t.invalidateQueries({queryKey:[$.notifications]})},onError:()=>{t.invalidateQueries({queryKey:n})}}))},Ms=()=>{const e=q(),t=Z();return ie(e.notifications.dismiss.mutationOptions({onSuccess:()=>{t.invalidateQueries(e.notifications.pathFilter())}}))},Fs=()=>{const e=q(),t=Z();return ie(e.notifications.clearAll.mutationOptions({onSuccess:()=>{t.invalidateQueries(e.notifications.pathFilter())}}))},pu=()=>{const e=q();return ne({...e.continueWatching.thisWeek.queryOptions(),staleTime:1e3*60*5})},yu=()=>{const e=q();return ne({...e.data.genresAndTags.queryOptions(),staleTime:1e3*60*60})},vu=()=>ne({queryKey:[$.genreCards],queryFn:()=>ae.insights.genreCards.query()}),Ws="_container_vk8jv_1",Bs="_bellBtn_vk8jv_7",Us="_badge_vk8jv_56",Hs="_dropdown_vk8jv_96",Ks="_dropdownHeader_vk8jv_127",Qs="_clearAllBtn_vk8jv_141",Vs="_discoveryStatusRow_vk8jv_159",zs="_statusDot_vk8jv_170",Gs="_statusDotRunning_vk8jv_177",Js="_statusDotOk_vk8jv_182",Ys="_statusDotInfo_vk8jv_186",Zs="_statusDotError_vk8jv_190",Xs="_statusDotIdle_vk8jv_194",ei="_list_vk8jv_208",ti="_item_vk8jv_222",ni="_thumbnail_vk8jv_237",ri="_itemInfo_vk8jv_246",oi="_itemTitle_vk8jv_251",si="_itemMeta_vk8jv_262",ii="_systemItemMeta_vk8jv_272",ai="_removeItem_vk8jv_289",ci="_queueItem_vk8jv_319",li="_emptyState_vk8jv_323",ui="_notificationDivider_vk8jv_371",k={container:Ws,bellBtn:Bs,badge:Us,dropdown:Hs,dropdownHeader:Ks,clearAllBtn:Qs,discoveryStatusRow:Vs,statusDot:zs,statusDotRunning:Gs,statusDotOk:Js,statusDotInfo:Ys,statusDotError:Zs,statusDotIdle:Xs,list:ei,item:ti,thumbnail:ni,itemInfo:ri,itemTitle:oi,itemMeta:si,systemItemMeta:ii,removeItem:ai,queueItem:ci,emptyState:li,notificationDivider:ui},di=({notification:e})=>{const t=Ms(),n=qs(),[r,s]=Pt.useState(!1),i=d=>{d.preventDefault(),d.stopPropagation(),t.mutate({showId:e.showId,episodeNumber:e.episodeNumber})},a=()=>{t.mutate({showId:e.showId,episodeNumber:e.episodeNumber})},c=d=>{d.preventDefault(),d.stopPropagation(),s(!0),n.mutate({showId:e.showId,episodeNumber:e.episodeNumber,showName:e.name,showThumbnail:e.thumbnail,nativeName:e.nativeName,englishName:e.englishName}),t.mutate({showId:e.showId,episodeNumber:e.episodeNumber}),window.setTimeout(()=>s(!1),1e3)},{titlePreference:l}=Rs(),u=l==="nativeName"?e.nativeName||e.name:l==="englishName"&&e.englishName||e.name;return o(se,{to:`/watch/${e.showId}/${e.episodeNumber}`,className:k.item,onClick:a,children:[o("img",{src:Os(e.thumbnail,48,64),alt:e.name,className:k.thumbnail,loading:"lazy",decoding:"async"}),o("div",{className:k.itemInfo,children:[o("span",{className:k.itemTitle,children:u}),o("span",{className:k.itemMeta,children:["New Episode ",e.episodeNumber]})]}),o("button",{className:`${k.removeItem} ${k.queueItem}`,onClick:c,"aria-label":"Add notification to queue",children:r?o(N,{name:"check"}):o(N,{name:"plus"})}),o("button",{className:k.removeItem,onClick:i,"aria-label":"Remove notification",children:o(N,{name:"times"})})]})};function lt({width:e="100%",height:t="1em",variant:n="rectangular",className:r="",style:s}){return o("div",{className:`skeleton skeleton-${n} ${r}`,style:{width:e,height:t,...s}})}const mi=({count:e=3})=>o(Y,{children:Array.from({length:e}).map((t,n)=>o("div",{className:k.item,style:{borderBottom:"1px solid var(--border-primary)",pointerEvents:"none"},children:[o("div",{className:k.thumbnail,style:{overflow:"hidden"},children:o(lt,{width:"100%",height:"100%",variant:"rectangular"})}),o("div",{className:k.itemInfo,children:[o(lt,{width:"80%",height:"1rem",variant:"text",style:{marginBottom:"4px"}}),o(lt,{width:"40%",height:"0.7rem",variant:"rectangular",style:{borderRadius:"var(--radius-sm)"}})]})]},n))}),fi=()=>{const{data:e=[],isLoading:t}=jn(),{data:n=[]}=Mn(),{data:r}=Fn(),s=Fs(),i=Z(),[a,c]=g(null);w(()=>{i.invalidateQueries({queryKey:[$.notifications]})},[i]);const l=()=>{s.mutate(void 0)},u=n.find(d=>d.id===a)??null;return o("div",{className:k.dropdown,children:[o("div",{className:k.dropdownHeader,children:[o("h4",{children:"Notifications"}),e.length>0&&o("button",{className:k.clearAllBtn,onClick:l,children:"Clear All"})]}),o("div",{className:k.discoveryStatusRow,children:r?.running?o(Y,{children:[o("span",{className:`${k.statusDot} ${k.statusDotRunning}`,"aria-hidden":"true"}),o("span",{children:r.total>0?`Checking ${Math.min(r.done,r.total)}/${r.total} shows...`:"Checking for new episodes..."})]}):r?.state==="complete"?o(Y,{children:[o("span",{className:`${k.statusDot} ${k.statusDotOk}`,"aria-hidden":"true"}),o("span",{children:["Discovery complete - checked ",r.total," ",r.total===1?"show":"shows"]})]}):r?.state==="empty"?o(Y,{children:[o("span",{className:`${k.statusDot} ${k.statusDotInfo}`,"aria-hidden":"true"}),o("span",{children:"No shows set to Watching - nothing to check"})]}):r?.state==="error"?o(Y,{children:[o("span",{className:`${k.statusDot} ${k.statusDotError}`,"aria-hidden":"true"}),o("span",{children:"Last check failed - will retry automatically"})]}):o(Y,{children:[o("span",{className:`${k.statusDot} ${k.statusDotIdle}`,"aria-hidden":"true"}),o("span",{children:r?.lastRunAt?`Last checked ${Math.max(1,Math.round((Date.now()-r.lastRunAt)/1e3))}s ago`:"Auto-checks every few minutes"})]})}),o("div",{className:k.list,children:t&&n.length===0?o(mi,{count:4}):o(Y,{children:[n.map(d=>o("div",{className:k.item,children:[o("div",{className:k.thumbnail,style:{background:"transparent",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:0,boxShadow:"none"},children:o(N,{name:"info-circle",size:32,color:"#6c9fff"})}),o("div",{className:k.itemInfo,children:[o("span",{className:k.itemTitle,children:d.title}),o("button",{type:"button",className:k.systemItemMeta,onClick:()=>c(d.id),title:"View full status",children:Ls(d.message,40,"…")})]}),o("button",{className:k.removeItem,disabled:!0,style:{opacity:.3,cursor:"not-allowed"},"aria-hidden":"true",children:o(N,{name:"plus"})}),o("button",{className:k.removeItem,disabled:!0,style:{opacity:.3,cursor:"not-allowed"},"aria-hidden":"true",children:o(N,{name:"times"})})]},d.id)),n.length>0&&e.length>0&&o("div",{className:k.notificationDivider}),e.length>0?e.map(d=>o(di,{notification:d},d.id)):!t&&n.length===0&&o("div",{className:k.emptyState,children:"No new notifications"})]})}),u&&Tt(o("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0, 0, 0, 0.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:9999,padding:"1rem",backdropFilter:"blur(3px)"},onClick:()=>c(null),children:o("div",{style:{backgroundColor:"var(--bg-secondary)",padding:"1.5rem",borderRadius:"var(--radius-lg)",maxWidth:"420px",width:"100%",boxShadow:"var(--shadow-xl)",border:"1px solid var(--border-primary)"},onClick:d=>d.stopPropagation(),children:[o("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem",marginBottom:"1rem"},children:[o(N,{name:"info-circle",color:"#6c9fff"}),o("span",{style:{color:"#fff",fontWeight:600,fontSize:"1rem"},children:u.title})]}),o("p",{style:{color:"var(--text-secondary)",marginBottom:"1.5rem",lineHeight:1.5},children:u.message}),o("div",{style:{display:"flex",justifyContent:"flex-end"},children:o("button",{type:"button",onClick:()=>c(null),style:{background:"var(--accent)",color:"#fff",border:"none",padding:"0.5rem 1rem",borderRadius:"var(--radius-md)",cursor:"pointer",fontWeight:600},children:"OK"})})]})}),document.body)]})},hi=()=>{const[e,t]=g(!1),n=U(null),r=Z(),s=q(),i=js(),{data:a=[]}=jn(),{data:c=[]}=Mn(),{data:l}=Fn(),u=a.length+c.length,d=u>5?"5+":u,f=U(!1);w(()=>{const h=p=>{n.current&&!n.current.contains(p.target)&&t(!1)};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[]),w(()=>{const h=!!l?.running;f.current&&!h&&(r.invalidateQueries(s.notifications.pathFilter()),r.invalidateQueries(s.discovery.pathFilter())),f.current=h},[l?.running,r,s]);const m=()=>{const h=!e;t(h),h&&i.mutate()};return o("div",{className:k.container,ref:n,children:[o("button",{className:k.bellBtn,onClick:m,"aria-label":"Notifications",children:[o(N,{name:"bell"}),u>0&&o("span",{className:k.badge,children:d})]}),e&&o(fi,{})]})},at=e=>{const t=q();return ne({...t.settings.getByKey.queryOptions({key:e}),select:n=>n.value})},Wn=()=>{const e=q(),t=Z();return ie(e.settings.set.mutationOptions({onSuccess:()=>{P.success("Setting updated!"),t.invalidateQueries(e.settings.pathFilter()),t.invalidateQueries({queryKey:[$.settings]})},onError:n=>{P.error(`Failed to update setting: ${n.message}`)}}))},Bn=fe(void 0),pi=()=>{const e=he(Bn);if(e===void 0)throw new Error("useLowEndMode must be used within a LowEndModeProvider");return e},me={x:-2.8,y:-2,w:48.6,h:14},bt=15,Ne={w:13.6,h:10.2},ye=[{x:0,y:.5},{x:bt,y:-.9},{x:bt*2,y:.3}],Jt={x:Ne.w/2,y:Ne.h/2-.5},ut={y:Ne.h/2,x1:-2,x2:bt*2+Ne.w+1.4},Yt=(e,t,n,r=0)=>{if(n.width<=0)return-1;const s=n.width/me.w,i=(e-n.left)/s+me.x,a=(t-n.top)/s+me.y;for(let c=0;c<ye.length;c++){const l=i-ye[c].x,u=a-ye[c].y;if(l>=-r&&l<=Ne.w+r&&u>=-r&&u<=Ne.h+r)return c}return-1},Zt=7.5,Xt=e=>Math.max(-1,Math.min(1,e)),yi=(e,t,n,r)=>{const s=n.width/me.w,i=(e-n.left)/s+me.x-r.x-Jt.x,a=(t-n.top)/s+me.y-r.y-Jt.y;return{x:Xt(i/Zt),y:Xt(a/Zt)}},vi=["normal","squint"],gi={normal:.72,squint:.28},en=(e=Math.random(),t)=>{let n=0;for(const r of vi)if(n+=gi[r],e<n)return r===t?r==="normal"?"squint":"normal":r;return"normal"},bi="pet",wi="sleep",_i=6e3,ki=420,Ei=.5,tn=3e3,Si=3e3,Pi=ye.map((e,t)=>t*260),dt={from:ye.length-2,to:ye.length-1,after:400},nn="data-dango-face",mt="data-dango-hover",ft="data-dango-cheer",rn="data-dango-nudge",Ti=()=>document.querySelectorAll("svg[data-dango-gaze-origin]"),Ke=()=>document.querySelectorAll("[data-dango-face-slot]"),xi=e=>e.querySelectorAll("[data-dango-eye]"),Ii=()=>document.querySelectorAll("[data-dango-eye]"),Un=()=>{const{data:e}=at("dangoGaze"),{lowEndMode:t}=pi();return e!=="false"&&!t},Ni=()=>{const e=Un();w(()=>{if(!e||window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;const t=ye.map(()=>"normal");let n=-1,r=-1,s=!1,i=-1,a=0,c=0,l=0,u=0,d=0;const f=[],m=(b,I)=>{const S=window.setTimeout(()=>{f.splice(f.indexOf(S),1),b()},I);f.push(S)},h=(b,I,S)=>{Ke().forEach(D=>{Number(D.getAttribute("data-dango-face-slot"))===b&&(S?D.setAttribute(I,""):D.removeAttribute(I))})},p=b=>Ke().forEach(I=>I.removeAttribute(b)),_=(b,I,S)=>{p(I),requestAnimationFrame(()=>{h(b,I,!0),m(()=>p(I),S)})},x=()=>{Ke().forEach(b=>{const I=Number(b.getAttribute("data-dango-face-slot"));b.setAttribute(nn,r===I?bi:t[I]),n===I?b.setAttribute(mt,""):b.removeAttribute(mt)})},E=b=>{b!==r&&(r>=0&&h(r,ft,!1),r=b,b>=0&&h(b,ft,!0))},y=()=>{window.clearTimeout(d),d=window.setTimeout(()=>{E(-1),x()},ki)},v=()=>{window.clearTimeout(d),E(-1)},T=()=>{s=!1,Pi.forEach((b,I)=>{m(()=>{t[I]=en(),I===dt.from&&m(()=>_(dt.to,rn,520),dt.after),x()},b)})},z=()=>{s=!0,t.fill(wi),v(),x()},X=()=>{window.clearTimeout(u),u=window.setTimeout(z,_i)},ge=()=>{s||(i=(i+1)%t.length,t[i]=en(Math.random(),t[i]),x()),m(ge,tn+Math.random()*Si)},C=()=>{const b=Array.from(Ti(),O=>[O,O.getBoundingClientRect()]);b.forEach(([O,ce])=>{xi(O).forEach(Te=>{const{x:le,y:Ee}=yi(c,l,ce,ye[Number(Te.getAttribute("data-dango-eye"))]);Te.style.setProperty("--dango-gaze-x",le.toFixed(3)),Te.style.setProperty("--dango-gaze-y",Ee.toFixed(3))})});const I=b.find(([,O])=>c>=O.left&&c<=O.right&&l>=O.top&&l<=O.bottom)?.[1]??null,S=n,D=r,W=I?Yt(c,l,I):-1,oe=W>=0?W:I?Yt(c,l,I,Ei):-1;n=W,oe>=0?(E(oe),y()):v(),(S!==n||D!==r)&&x(),s&&T(),X()},re=b=>{c=b.clientX,l=b.clientY,!a&&(a=requestAnimationFrame(()=>{a=0,C()}))},G=b=>{b.relatedTarget||(n=-1,v(),x(),X())};return x(),X(),m(ge,tn),window.addEventListener("pointermove",re,{passive:!0}),window.addEventListener("pointerout",G),()=>{cancelAnimationFrame(a),window.clearTimeout(u),window.clearTimeout(d),f.forEach(window.clearTimeout),window.removeEventListener("pointermove",re),window.removeEventListener("pointerout",G),Ii().forEach(b=>{b.style.removeProperty("--dango-gaze-x"),b.style.removeProperty("--dango-gaze-y")}),Ke().forEach(b=>{b.setAttribute(nn,"normal"),b.removeAttribute(mt),b.removeAttribute(ft),b.removeAttribute(rn)})}},[e])},Hn=fe(void 0),gu=()=>{const e=he(Hn);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e},bu=[{id:"iris",label:"Taro (default)",blurb:"Deep purple",swatch:"#7d6df0"},{id:"sakura",label:"Sakura",blurb:"Soft pink",swatch:"#e0b0e0"},{id:"mochi",label:"Mochi",blurb:"Monochrome pearl",swatch:"#f0f0f0"}],Ci={iris:{fill:"#897cff",stroke:"#5646db"},mochi:{fill:"#e3e1ee",stroke:"#b3b1c6"},sakura:{fill:"#e1afef",stroke:"#a978a9"}},Oi="_logo_t3il2_1",Ai="_skewer_t3il2_8",Li="_gaze_t3il2_15",Ri="_face_t3il2_20",$i="_faceNormal_t3il2_25",qi="_facePet_t3il2_26",Di="_faceSquint_t3il2_27",ji="_faceSleep_t3il2_28",Mi="_line_t3il2_36",Fi="_sway_t3il2_44",Wi="_weight_t3il2_58",Bi="_shift_t3il2_73",Ui="_rock_t3il2_87",Hi="_glance_t3il2_105",Ki="_blinkDouble_t3il2_129 _blink_t3il2_124",Qi="_blinkSlow_t3il2_153 _blink_t3il2_124",Vi="_bump_t3il2_172",zi="_heart_t3il2_189",B={logo:Oi,skewer:Ai,gaze:Li,face:Ri,faceNormal:$i,facePet:qi,faceSquint:Di,faceSleep:ji,line:Mi,sway:Fi,weight:Wi,shift:Bi,rock:Ui,glance:Hi,blinkDouble:Ki,blinkSlow:Qi,bump:Vi,heart:zi},on="var(--logo-ink)",Gi="m 7,0 c -3.9372984,0 -7.10030437,2.4883888 -7,6 0.13572675,4.751733 5.0802847,4.156395 7,4.156395 1.2538994,0 6.530451,0.392468 6.584946,-4.168088 C 13.622023,2.8853946 10.937298,0 7,0 Z",Ji="m 4.9623825,3.416 c -0.5858889,0 -0.6520292,2.3368563 -0.024765,2.3368563 0.6604959,0 0.6704653,-2.3368563 0.024765,-2.3368563 z",Yi="M 8.588001,3.416 C 8.0021121,3.416 7.9359718,5.7528563 8.563236,5.7528563 9.2237319,5.7528563 9.2337013,3.416 8.588001,3.416 Z",Zi={pet:"M 4.85,5.15 Q 5.285,4.0 5.72,5.15 M 8.25,5.15 Q 8.618,4.0 8.99,5.15",squint:"M 4.82,3.9 L 5.6,4.62 L 4.82,5.34 M 9.08,3.9 L 8.3,4.62 L 9.08,5.34",sleep:"M 4.9,4.72 Q 5.285,5.28 5.67,4.72 M 8.25,4.72 Q 8.618,5.28 9.0,4.72"},Kn=[{lag:.8,hue:"iris",blink:"double",motion:"weight",glances:!1},{lag:1.4,hue:"sakura",blink:"slow",motion:"shift",glances:!1},{lag:1,hue:"mochi",blink:"slow",motion:"rock",glances:!0}],Ae=(e,t)=>e+Math.random()*(t-e),Xi=Kn.map(()=>({blinkDelay:-Ae(0,9),blinkDuration:Ae(3.4,8.6),motionDelay:-Ae(0,9),motionDuration:Ae(5.5,11),glanceDelay:-Ae(0,11)})),ea={double:B.blinkDouble,slow:B.blinkSlow},ta={weight:B.weight,shift:B.shift,rock:B.rock},na={normal:B.faceNormal,pet:B.facePet,squint:B.faceSquint,sleep:B.faceSleep},ra=["normal","pet","squint","sleep"],oa=[{x:7,y:4.2,delay:0,drift:"0px"},{x:9.6,y:6.4,delay:-.3,drift:"-0.9px"},{x:4.6,y:6.1,delay:-.6,drift:"0.8px"},{x:8.2,y:3.4,delay:-.9,drift:"-0.4px"}],Lt=({className:e})=>{const t=Un();return o("svg",{viewBox:`${me.x} ${me.y} ${me.w} ${me.h}`,className:e?`${B.logo} ${e}`:B.logo,role:"img","aria-label":"dango","data-dango-gaze-origin":"",children:o("g",{className:t?B.sway:void 0,children:[o("path",{className:B.skewer,d:`M ${ut.x1},${ut.y} H ${ut.x2}`}),Kn.map((n,r)=>{const{x:s,y:i}=ye[r],a=Xi[r],{fill:c,stroke:l}=Ci[n.hue],u=o("g",{"data-dango-eye":r,className:B.gaze,style:{"--gaze-dur":`${(.12+n.lag*.18).toFixed(3)}s`},children:ra.map(d=>o("g",{className:`${B.face} ${na[d]}`,children:o("g",{className:t&&d==="normal"?ea[n.blink]:void 0,style:t&&d==="normal"?{animationDelay:`${a.blinkDelay}s`,animationDuration:`${a.blinkDuration}s`}:void 0,children:d==="normal"?o(Y,{children:[o("path",{fill:on,d:Ji}),o("path",{fill:on,d:Yi})]}):o("path",{className:B.line,d:Zi[d]})})},d))});return o("g",{transform:`translate(${s} ${i})`,children:o("g",{"data-dango-face-slot":r,"data-dango-face":"normal",className:t?ta[n.motion]:void 0,style:t?{animationDelay:`${a.motionDelay}s`,animationDuration:`${a.motionDuration}s`}:void 0,children:[o("path",{fill:c,stroke:l,strokeWidth:"0.9",strokeLinejoin:"round",paintOrder:"stroke fill",d:Gi}),o("g",{className:B.bump,children:[t&&n.glances?o("g",{className:B.glance,style:{animationDelay:`${a.glanceDelay}s`},children:u}):u,t&&o("g",{children:oa.map(d=>o("text",{className:B.heart,x:d.x,y:d.y,fill:"var(--color-danger)",style:{"--drift":d.drift,animationDelay:`${d.delay}s`},children:"♥"},d.x))})]})]})},n.hue)})]})})},Qn=fe(void 0),Rt=()=>{const e=he(Qn);if(e===void 0)throw new Error("useSidebar must be used within a SidebarProvider");return e},Vn=fe(void 0),zn=()=>{const e=he(Vn);if(e===void 0)throw new Error("useContentType must be used within a ContentTypeProvider");return e},wt="virtual-keyboard:hide",sn="virtual-keyboard:enabled-change",Gn="virtual_keyboard_enabled",sa=!1;function an(){const e=V.getItem(Gn);return e===null?sa:e==="true"}const cn=e=>e instanceof HTMLInputElement&&e.type==="text"&&!e.disabled&&!e.readOnly;function ia(){window.dispatchEvent(new CustomEvent(wt))}function aa(){const[e,t]=g(!1),[n,r]=g(an),s=U(null);return w(()=>{const i=d=>{n&&cn(d.target)&&(s.current=d.target,t(!0))},a=d=>{d.target===s.current&&window.setTimeout(()=>{if(cn(document.activeElement)){s.current=document.activeElement,t(!0);return}s.current=null,t(!1)},0)},c=()=>{s.current=null,t(!1)},l=d=>{if(d.key!==Gn)return;const f=d.newValue==="true";r(f),f||c()},u=()=>{const d=an();r(d),d||c()};return document.addEventListener("focusin",i),document.addEventListener("focusout",a),window.addEventListener(wt,c),window.addEventListener("storage",l),window.addEventListener(sn,u),()=>{document.removeEventListener("focusin",i),document.removeEventListener("focusout",a),window.removeEventListener(wt,c),window.removeEventListener("storage",l),window.removeEventListener(sn,u)}},[n]),{activeInputRef:s,isVisible:n&&e,hide:()=>t(!1)}}const ca={queryKey:[$.syncProfile],queryFn:()=>$e("/api/profiles/current"),staleTime:3e4};function Jn({image:e,name:t}){const[n,r]=g(!1);return w(()=>r(!1),[e]),e&&!n?o("img",{src:e,alt:t,referrerPolicy:"no-referrer",onError:()=>r(!0),style:{width:"100%",height:"100%",maxWidth:72,maxHeight:72,aspectRatio:"1",objectFit:"cover",borderRadius:"50%"}}):o("svg",{viewBox:"0 0 24 24",role:"img","aria-label":t,style:{width:"100%",height:"100%",maxWidth:72,maxHeight:72,aspectRatio:"1"},fill:"currentColor",children:[o("circle",{cx:"12",cy:"8",r:"4"}),o("path",{d:"M4 21v-2a8 8 0 0 1 16 0v2z"})]})}const la="_header_1f1e7_1",ua="_hidden_1f1e7_21",da="_scrolled_1f1e7_25",ma="_logo_1f1e7_31",fa="_headerInner_1f1e7_44",ha="_leftSection_1f1e7_54",pa="_desktopNav_1f1e7_60",ya="_navLink_1f1e7_67",va="_navLinkActive_1f1e7_83",ga="_rightSection_1f1e7_102",ba="_searchWrapper_1f1e7_108",wa="_searchInput_1f1e7_114",_a="_searchButton_1f1e7_144",ka="_searchIcon_1f1e7_168",Ea="_profileBtn_1f1e7_178",Sa="_profileAvatar_1f1e7_213",Pa="_profileName_1f1e7_220",Ta="_hamburgerBtn_1f1e7_229",xa="_mobileSearchBar_1f1e7_256",Ia="_mobileSearchBarHidden_1f1e7_283",Na="_mobileSearchInner_1f1e7_300",Ca="_mobileSearchIcon_1f1e7_316",Oa="_mobileSearchInput_1f1e7_323",A={header:la,hidden:ua,scrolled:da,logo:ma,headerInner:fa,leftSection:ha,desktopNav:pa,navLink:ya,navLinkActive:va,rightSection:ga,searchWrapper:ba,searchInput:wa,searchButton:_a,searchIcon:ka,profileBtn:Ea,profileAvatar:Sa,profileName:Pa,hamburgerBtn:Ta,mobileSearchBar:xa,mobileSearchBarHidden:Ia,mobileSearchInner:Na,mobileSearchIcon:Ca,mobileSearchInput:Oa},Aa=()=>{const{toggleSidebar:e}=Rt(),{contentType:t}=zn(),[n,r]=g(""),[s,i]=g(!0),[a,c]=g(!1),[l,u]=g(!0),[d,f]=g(!1),m=vn(),h=nt(),p=U(null),_=U(!1),x=U(null),E=U(null),y=U(null),v=U(null),T=U(!1),{data:z}=ne(ca);w(()=>{const S=window.visualViewport;if(!S)return;const D=()=>{v.current?.style.setProperty("--vv-top",`${S.offsetTop}px`)};return D(),S.addEventListener("scroll",D),S.addEventListener("resize",D),()=>{S.removeEventListener("scroll",D),S.removeEventListener("resize",D)}},[]),w(()=>{const S=()=>{p.current&&(window.clearTimeout(p.current),p.current=null)},D=()=>{S(),!(window.scrollY<=10)&&(p.current=window.setTimeout(()=>{T.current||i(!1)},2500))},W=()=>{_.current||(_.current=!0,x.current=requestAnimationFrame(()=>{_.current=!1,x.current=null;const le=window.scrollY<=10;u(Ee=>Ee===le?Ee:le),i(Ee=>Ee||!0),D()}))},oe=le=>{(le.metaKey||le.ctrlKey)&&le.key==="k"?(le.preventDefault(),X.current?.focus({preventScroll:!0})):le.key==="Escape"&&document.activeElement===X.current&&X.current?.blur()},O=v.current,ce=()=>{T.current=!0},Te=()=>{T.current=!1,D()};return window.addEventListener("scroll",W,{passive:!0}),window.addEventListener("keydown",oe),O?.addEventListener("pointerenter",ce),O?.addEventListener("pointerleave",Te),()=>{window.removeEventListener("scroll",W),window.removeEventListener("keydown",oe),O?.removeEventListener("pointerenter",ce),O?.removeEventListener("pointerleave",Te),S(),x.current!==null&&(cancelAnimationFrame(x.current),x.current=null),_.current=!1}},[a]);const X=Pt.useRef(null),ge=()=>window.innerWidth<=1024,C=()=>{ge()?(f(!0),setTimeout(()=>y.current?.focus({preventScroll:!0}),50)):document.activeElement===X.current&&n.trim()?I():X.current?.focus({preventScroll:!0})},re=S=>{E.current?.contains(S.relatedTarget)||f(!1)},G=t==="manga"?"Search manga...":t==="tv"?"Search TV & movies...":t==="asmr"?"Search ASMR...":"Search anime...",b=t==="manga"?{to:"/reading-list",label:"Reading List"}:t==="tv"?{to:"/tv-watchlist",label:"TV Watchlist"}:t==="asmr"?{to:"/listening-list",label:"Listening List"}:{to:"/watchlist",label:"Watchlist"},I=S=>{ia();const D=n.trim();D&&m(t==="manga"?`/manga?q=${encodeURIComponent(D)}`:t==="tv"?`/tv-search?q=${encodeURIComponent(D)}`:t==="asmr"?`/asmr?q=${encodeURIComponent(D)}`:`/search?query=${encodeURIComponent(D)}`)};return o(Y,{children:o("header",{ref:v,className:`${A.header} ${s?"":A.hidden} ${l?"":A.scrolled}`,children:[o("div",{className:A.headerInner,children:[o("div",{className:A.leftSection,children:[o("button",{className:A.hamburgerBtn,onClick:e,"aria-label":"Menu",children:o(N,{name:"bars"})}),o(se,{to:"/",className:A.logo,"aria-label":"Ani-Web Home",children:o(Lt,{})}),o("nav",{className:A.desktopNav,children:[o(se,{to:"/",className:`${A.navLink} ${h.pathname==="/"?A.navLinkActive:""}`,children:"Home"}),o(se,{to:b.to,className:`${A.navLink} ${h.pathname.startsWith(b.to)?A.navLinkActive:""}`,children:b.label}),t==="anime"&&o(se,{to:"/insights",className:`${A.navLink} ${h.pathname==="/insights"?A.navLinkActive:""}`,children:"Insights"}),o(se,{to:"/settings",className:`${A.navLink} ${h.pathname.startsWith("/settings")?A.navLinkActive:""}`,children:"Settings"})]})]}),o("div",{className:A.rightSection,children:[o("div",{className:A.searchWrapper,children:[o("input",{ref:X,type:"text","data-virtual-keyboard":"true",className:A.searchInput,placeholder:G,value:n,onChange:S=>r(S.currentTarget.value),onFocus:()=>c(!0),onBlur:()=>c(!1),onKeyDown:S=>{S.key==="Enter"&&I()}}),o("button",{type:"button",className:A.searchButton,"aria-label":"Search",onMouseDown:S=>S.preventDefault(),onClick:C,children:o(N,{name:"search",className:A.searchIcon})})]}),o(hi,{}),o(se,{to:"/settings",className:A.profileBtn,"aria-label":`${z?.name??"Profile"} — profile settings`,title:`${z?.name??"Profile"}${z?.owner?" (owner)":""} — profile settings`,children:[o("span",{className:A.profileAvatar,"aria-hidden":"true",children:o(Jn,{image:z?.image,name:z?.name??"Profile"})}),o("span",{className:A.profileName,children:z?.name??"Profile"})]})]})]}),d&&o("div",{className:`${A.mobileSearchBar} ${s?"":A.mobileSearchBarHidden}`,ref:E,onBlur:re,children:o("div",{className:A.mobileSearchInner,children:[o(N,{name:"search",className:A.mobileSearchIcon}),o("input",{ref:y,type:"text","data-virtual-keyboard":"true",className:A.mobileSearchInput,placeholder:G,value:n,onChange:S=>r(S.currentTarget.value),onKeyDown:S=>{S.key==="Enter"?(I(),f(!1)):S.key==="Escape"&&f(!1)}})]})})]})})},_t="agreedToViewMature";function kt(){try{return V.getItem(_t)==="true"}catch{return!1}}const Re=new Set;function Yn(e){for(const t of Re)t(e)}function Qe(){Yn(kt())}function ln(e){try{e?V.setItem(_t,"true"):V.removeItem(_t)}catch{}Yn(e)}function La(){const[e,t]=g(kt);w(()=>(Re.add(t),Re.size===1&&(window.addEventListener("storage",Qe),window.addEventListener("focus",Qe)),t(kt()),()=>{Re.delete(t),Re.size===0&&(window.removeEventListener("storage",Qe),window.removeEventListener("focus",Qe))}),[]);const n=H(()=>ln(!0),[]),r=H(()=>ln(!1),[]);return{hasConsent:e,grant:n,revoke:r}}const Ra="_sidebar_153jc_1",$a="_open_153jc_20",qa="_sidebarHeader_153jc_25",Da="_closeBtn_153jc_33",ja="_logo_153jc_57",Ma="_navSection_153jc_69",Fa="_navLink_153jc_75",Wa="_active_153jc_108",Ba="_overlay_153jc_118",Ua="_versionInfo_153jc_138",ue={sidebar:Ra,open:$a,sidebarHeader:qa,closeBtn:Da,logo:ja,navSection:Ma,navLink:Fa,active:Wa,overlay:Ba,versionInfo:Ua},Ha="3.8.0",Zn={version:Ha},Ka=()=>{const{isOpen:e,setIsOpen:t}=Rt(),{contentType:n}=zn(),{hasConsent:r}=La(),s=()=>{t(!1)},i=n==="manga",a=n==="tv",c=n==="asmr",l=[{to:"/",icon:o(N,{name:"home"}),label:"Home"},i?{to:"/manga",icon:o(N,{name:"book"}),label:"Manga"}:a?{to:"/tv-search",icon:o(N,{name:"tv"}),label:"TV and Movies"}:c?{to:"/asmr",icon:o(N,{name:"headphones"}),label:"ASMR"}:{to:"/search",icon:o(N,{name:"search"}),label:"Search"},i?{to:"/reading-list",icon:o(N,{name:"bookmark"}),label:"Reading List"}:a?{to:"/tv-watchlist",icon:o(N,{name:"clock"}),label:"TV Watchlist"}:c?{to:"/listening-list",icon:o(N,{name:"history"}),label:"Listening List"}:{to:"/watchlist",icon:o(N,{name:"clock"}),label:"Watchlist"},...n==="anime"?[{to:"/insights",icon:o(N,{name:"chart-pie"}),label:"Insights"}]:[],{to:"/trackers",icon:o(N,{name:"sync-alt"}),label:"Trackers"},{to:"/watch-along",icon:o(N,{name:"play"}),label:"Watch along"},...r?[{to:"/mature",icon:o(N,{name:"pepper-hot"}),label:"Mature"}]:[],{to:"/settings",icon:o(N,{name:"cog"}),label:"Settings"}];return o(Y,{children:[o("aside",{className:`${ue.sidebar} ${e?ue.open:""} sidebar`,children:[o("div",{className:ue.sidebarHeader,children:[o("button",{className:ue.closeBtn,onClick:()=>t(!1),"aria-label":"Close menu",children:"×"}),o(se,{to:"/",className:ue.logo,onClick:s,children:o(Lt,{})})]}),o("nav",{className:ue.navSection,children:l.map(u=>o(lr,{to:u.to,className:({isActive:d})=>`${ue.navLink} ${d?ue.active:""}`,onClick:s,end:u.to==="/",children:[u.icon,o("span",{children:u.label})]},u.to))}),o("div",{className:ue.versionInfo,children:["v",Zn.version]})]}),e&&o("div",{className:ue.overlay,onClick:()=>t(!1),"aria-label":"Close sidebar"})]})},Qa="_footer_1c905_1",Va="_footerInner_1c905_15",za="_brandSection_1c905_27",Ga="_logoRow_1c905_39",Ja="_logoText_1c905_45",Ya="_brandMeta_1c905_51",Za="_brandTagline_1c905_60",Xa="_statusPill_1c905_67",ec="_statusDot_1c905_80",tc="_linksGrid_1c905_88",nc="_linkColumn_1c905_96",rc="_columnTitle_1c905_102",oc="_bottomBar_1c905_126",sc="_copyright_1c905_136",ic="_brand_1c905_27",ac="_heartIcon_1c905_152",cc="_backToTop_1c905_157",j={footer:Qa,footerInner:Va,brandSection:za,logoRow:Ga,logoText:Ja,brandMeta:Ya,brandTagline:Za,statusPill:Xa,statusDot:ec,linksGrid:tc,linkColumn:nc,columnTitle:rc,bottomBar:oc,copyright:sc,brand:ic,heartIcon:ac,backToTop:cc},lc=()=>{const e=new Date().getFullYear(),t=()=>{window.scrollTo({top:0,behavior:"smooth"})};return o("footer",{className:j.footer,children:[o("div",{className:j.footerInner,children:[o("div",{className:j.brandSection,children:[o("div",{className:j.logoRow,children:o(Lt,{className:j.logoText})}),o("div",{className:j.brandMeta,children:[o("div",{className:j.statusPill,children:[o("span",{className:j.statusDot}),o("span",{children:["v",Zn.version]})]}),o("p",{className:j.brandTagline,children:"Fast, local anime streaming."})]})]}),o("div",{className:j.linksGrid,children:[o("div",{className:j.linkColumn,children:[o("h4",{className:j.columnTitle,children:"Navigation"}),o(se,{to:"/",children:"Home"}),o(se,{to:"/watchlist",children:"Watchlist"}),o(se,{to:"/settings",children:"Settings"})]}),o("div",{className:j.linkColumn,children:[o("h4",{className:j.columnTitle,children:"Features"}),o(se,{to:"/search",children:"Search Anime"}),o(se,{to:"/trackers",children:"Trackers"}),o(se,{to:"/insights",children:"Insights"})]}),o("div",{className:j.linkColumn,children:[o("h4",{className:j.columnTitle,children:"Community"}),o("a",{href:"https://discord.gg/6yT3VwTqz9",target:"_blank",rel:"noopener noreferrer",children:[o(N,{name:"discord",style:{marginRight:"6px"}})," Discord"]}),o("a",{href:"https://github.com/serifpersia/dango",target:"_blank",rel:"noopener noreferrer",children:[o(N,{name:"github",style:{marginRight:"6px"}})," GitHub"]})]}),o("div",{className:j.linkColumn,children:[o("h4",{className:j.columnTitle,children:"Project"}),o("a",{href:"https://github.com/serifpersia/dango/releases",target:"_blank",rel:"noopener noreferrer",children:"Releases"}),o("a",{href:"https://github.com/serifpersia/dango/issues",target:"_blank",rel:"noopener noreferrer",children:"Feedback"})]})]})]}),o("div",{className:j.bottomBar,children:[o("p",{className:j.copyright,children:["© ",e," ",o("span",{className:j.brand,children:"dango"})," • Crafted with"," ",o(N,{name:"heart",className:j.heartIcon})," by"," ",o("a",{href:"https://github.com/serifpersia",target:"_blank",rel:"noopener noreferrer",children:"serifpersia"})]}),o("button",{className:j.backToTop,onClick:t,"aria-label":"Back to top",children:[o(N,{name:"chevron-up",size:14}),o("span",{children:"Top"})]})]})]})};function Xn(e){return JSON.stringify({0:e??{}})}function er(e){return`/api/trpc/${e}?batch=1&_profile=${encodeURIComponent(qn())}`}function Et(e,t){const n=Xn(t),r=er(e);try{if(navigator.sendBeacon){navigator.sendBeacon(r,new Blob([n],{type:"application/json"}));return}}catch{}fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:n,keepalive:!0}).catch(()=>{})}async function wu(e,t){const n=await fetch(er(e),{method:"POST",headers:{"Content-Type":"application/json"},body:Xn(t),keepalive:!0});if(!n.ok)throw new Error(`tRPC request failed (HTTP ${n.status})`)}function _u(e){e&&(Et("discord.clear",{sessionId:e}),Et("discord.heartbeat",{sessionId:e,bye:!0}))}function uc(){const e=nt(),{data:t}=at("discordRPCEnabled"),n=U("");n.current||(n.current=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`tab-${Date.now()}-${Math.random().toString(36).slice(2)}`),w(()=>{if(t===!1||t==="false")return;const r=n.current,s=()=>ae.discord.heartbeat.mutate({sessionId:r}).catch(()=>{});s();const i=setInterval(s,15e3),a=()=>{Et("discord.heartbeat",{sessionId:r,bye:!0})};return window.addEventListener("pagehide",a),()=>{clearInterval(i),window.removeEventListener("pagehide",a)}},[t]),w(()=>{if(t===!1||t==="false")return;const r=e.pathname;if(r.startsWith("/watch/")||r.startsWith("/player/"))return;let s="home";r.startsWith("/search")||r.startsWith("/mature")?s="search":r.startsWith("/watchlist")?s="watchlist":r.startsWith("/anime/")?s="anime":r.startsWith("/insights")?s="insights":r.startsWith("/settings")?s="settings":r.startsWith("/trackers")?s="trackers":r.startsWith("/asmr")?s="asmr":r.startsWith("/manga")?s="manga":r.startsWith("/tv")&&(s="tv"),ae.discord.pageStatus.mutate({page:s}).catch(()=>{})},[e.pathname,t])}function $t(e,t){const[n,r]=g(()=>{try{const i=V.getItem(e);if(i===null)return t;if(typeof t=="string")return i;try{return JSON.parse(i)}catch{return i}}catch{return t}});w(()=>{const i=a=>{if(a.key===V.keyFor(e))try{if(a.newValue===null){r(t);return}if(typeof t=="string"){r(a.newValue);return}try{r(JSON.parse(a.newValue))}catch{r(a.newValue)}}catch{}};return window.addEventListener("storage",i),()=>window.removeEventListener("storage",i)},[e,t]);const s=H(i=>{r(a=>{const c=typeof i=="function"?i(a):i;try{typeof c=="string"?V.setItem(e,c):V.setItem(e,JSON.stringify(c))}catch{}return c})},[e]);return[n,s]}const tr=fe(void 0),dc=()=>{const e=he(tr);if(!e)throw new Error("useAnimePaheCookie must be used within an AnimePaheCookieProvider");return e},mc="_overlay_1juub_1",fc="_fadeIn_1juub_1",hc="_content_1juub_11",pc="_modalIn_1juub_1",yc="_sm_1juub_29",vc="_md_1juub_33",gc="_lg_1juub_37",bc="_title_1juub_41",wc="_body_1juub_48",_c="_footer_1juub_52",Ie={overlay:mc,fadeIn:fc,content:hc,modalIn:pc,sm:yc,md:vc,lg:gc,title:bc,body:wc,footer:_c};function nr({children:e}){return o("h2",{className:Ie.title,children:e})}function rr({children:e}){return o("div",{className:Ie.body,children:e})}function or({children:e}){return o("div",{className:Ie.footer,children:e})}function We({isOpen:e,onClose:t,title:n,children:r,footer:s,width:i="md"}){const a=U(null),[c,l]=g(document.body);return w(()=>{if(!e)return;const u=()=>l(document.fullscreenElement??document.body);return u(),document.addEventListener("fullscreenchange",u),()=>document.removeEventListener("fullscreenchange",u)},[e]),w(()=>{if(!e)return;const u=f=>{f.key==="Escape"&&t?.()};document.addEventListener("keydown",u);const d=document.body.style.overflow;return document.body.style.overflow="hidden",a.current?.focus(),()=>{document.removeEventListener("keydown",u),document.body.style.overflow=d}},[e,t]),e?Tt(o("div",{role:"presentation",onMouseDown:u=>u.stopPropagation(),children:[o("div",{className:Ie.overlay,onClick:()=>t?.(),"aria-hidden":"true"}),o("div",{ref:a,className:`${Ie.content} ${Ie[i]}`,role:"dialog","aria-modal":"true","aria-label":n,tabIndex:-1,children:[n&&o(nr,{children:n}),o(rr,{children:r}),s&&o(or,{children:s})]})]}),c):null}We.Header=nr;We.Body=rr;We.Actions=or;const kc="_container_e96gf_1",Ec="_field_e96gf_9",Sc="_textarea_e96gf_20",Pc="_input_e96gf_40",Tc="_button_e96gf_58",xc="_secondaryButton_e96gf_78",Ic="_actions_e96gf_95",Nc="_hint_e96gf_104",Cc="_link_e96gf_117",ee={container:kc,field:Ec,textarea:Sc,input:Pc,button:Tc,secondaryButton:xc,actions:Ic,hint:Nc,link:Cc},Oc="https://github.com/serifpersia/dango/releases/latest/download/dango-extension.zip",Ac=e=>{try{return JSON.parse(e.detail)}catch{return null}},Lc=({isOpen:e,onClose:t,onSuccess:n})=>{const[r,s]=g(1),[i,a]=g(navigator.userAgent),[c,l]=g(""),[u,d]=g(!1),f=U(null),m=navigator.userAgent,h=/android/i.test(m),p=/firefox|fxios/i.test(m)&&!h,_=!p&&!h&&/chrome|chromium|edg|brave/i.test(m),x=p||_;w(()=>{e&&(s(1),a(navigator.userAgent),l(""),d(!1))},[e]),w(()=>()=>{f.current&&(window.removeEventListener("dango:pahe-cookie",f.current),f.current=null)},[]);const E=()=>{window.open("https://animepahe.pw","_blank","noopener,noreferrer"),s(2)},y=()=>{if(u)return;d(!0);const T=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,z=window.setTimeout(()=>{d(!1),f.current&&(window.removeEventListener("dango:pahe-cookie",f.current),f.current=null),P.error("Helper not detected - install it via about:debugging first.")},3e3),X=ge=>{const C=Ac(ge);if(!(!C||C.requestId!==T))if(window.clearTimeout(z),window.removeEventListener("dango:pahe-cookie",X),f.current=null,d(!1),C?.ok&&C.cookie)l(C.cookie),P.success("Cookie extracted from helper!");else if(C?.error==="NO_COOKIE"){const re=C.debug?.stores?.length??0,G=C.debug?.names??[];P.error(`Helper found no cf_clearance (checked ${re} stores, saw: ${G.join(", ")||"none"}) - solve the challenge on the AnimePahe tab first.`)}else P.error("Helper request failed - try again.")};f.current=X,window.addEventListener("dango:pahe-cookie",X),window.dispatchEvent(new CustomEvent("dango:get-pahe-cookie",{detail:{requestId:T}}))},v=()=>{const T=c.trim();if(!T){P.error("Please enter the cf_clearance cookie");return}try{V.setItem("animepahe_ua",i),V.setItem("animepahe_cookie",T),P.success("Cookie updated successfully! Reloading…"),n?.(),t(),window.setTimeout(()=>window.location.reload(),1e3)}catch{P.error("Failed to save cookie")}};return o(We,{isOpen:e,onClose:t,title:"AnimePahe Verification Required",children:o("div",{className:ee.container,children:r===1?o(Y,{children:[o("p",{children:"AnimePahe requires a manual verification to bypass Cloudflare/DDoS-Guard protection."}),o("div",{className:ee.field,children:[o("label",{children:"Your User-Agent (will be used for requests):"}),o("textarea",{value:i,readOnly:!0,rows:3,className:ee.textarea})]}),o("div",{className:ee.actions,children:[o("button",{className:ee.secondaryButton,onClick:t,children:"Cancel"}),o("button",{className:ee.button,onClick:E,children:"Start Verification (Opens AnimePahe)"})]})]}):o(Y,{children:[o("p",{children:["1. Solve the challenge on the ",o("strong",{children:"AnimePahe tab"})," (keep that tab open).",o("br",{}),"2. Copy the ",o("strong",{children:"cf_clearance"})," cookie value using one of these:",o("br",{}),o("br",{}),o("strong",{children:"Chrome / Edge — DevTools:"})," press ",o("code",{children:"F12"})," →"," ",o("strong",{children:"Application"})," → ",o("strong",{children:"Cookies"})," →"," ",o("code",{children:"https://animepahe.pw"}),". Find ",o("strong",{children:"cf_clearance"}),", double-click its ",o("strong",{children:"Value"})," to select it, then copy.",o("br",{}),o("br",{}),o("strong",{children:"Firefox — Storage Inspector:"})," press ",o("code",{children:"F12"})," →"," ",o("strong",{children:"Storage"})," → ",o("strong",{children:"Cookies"})," →"," ",o("code",{children:"https://animepahe.pw"}),". Find ",o("strong",{children:"cf_clearance"}),", right-click the value → ",o("strong",{children:"Copy Value"}),".",o("br",{}),o("br",{}),o("strong",{children:"Either browser — extension:"})," open"," ",o("strong",{children:"Cookie Manager"})," while on the AnimePahe tab, find"," ",o("strong",{children:"cf_clearance"}),", and copy its value (or use the extension's export).",o("br",{}),o("br",{}),"3. Paste it below. Copy ",o("strong",{children:"only the value"})," — remove any"," ",o("code",{children:"cf_clearance="})," prefix or quotes if they were included."]}),x&&o("div",{className:ee.hint,children:[o("strong",{children:"Dango helper (one-time setup):"})," ",p?o(Y,{children:["type ",o("code",{children:"about:debugging"})," in the address bar →"," ",o("strong",{children:"This Firefox"})," → ",o("strong",{children:"Load Temporary Add-on"})," ","→ open the ",o("code",{children:"dango-extension/firefox"})," folder and pick"," ",o("code",{children:"manifest.json"}),". (Temporary helpers unload when Firefox closes - repeat after a restart.)"]}):o(Y,{children:["type ",o("code",{children:"chrome://extensions"})," in the address bar → enable"," ",o("strong",{children:"Developer mode"})," → ",o("strong",{children:"Load unpacked"})," → open the ",o("code",{children:"dango-extension/chrome"})," folder. (Unpacked helpers show a developer-mode notice - expected.)"]})," ","Use this link to download the extension and extract it:"," ",o("a",{href:Oc,target:"_blank",rel:"noreferrer",className:ee.link,children:"dango-extension.zip"}),". Then click Extract below and the field fills itself.",o("div",{className:ee.actions,children:o("button",{className:ee.button,onClick:y,disabled:u,type:"button",children:u?"Extracting…":"Extract cookie from helper"})})]}),o("div",{className:ee.field,children:[o("label",{children:"cf_clearance cookie value:"}),o("input",{type:"text",value:c,onChange:T=>l(T.currentTarget.value),placeholder:"e.g. xxxxxxxx.xxxxxxxx.xxxxxxx-xxxxxxx",className:ee.input})]}),o("div",{className:ee.actions,children:[o("button",{className:ee.secondaryButton,onClick:t,children:"Cancel"}),o("button",{className:ee.secondaryButton,onClick:()=>s(1),children:"Back"}),o("button",{className:ee.button,onClick:v,children:"Submit"})]})]})})})};function Rc(){const[e,t]=g(!1);return w(()=>{const n=window.setTimeout(()=>t(!0),120);return()=>window.clearTimeout(n)},[]),e?o("div",{className:"top-progress-bar",role:"progressbar","aria-label":"Loading"}):null}const $c="_screen_1pca0_1",qc="_icon_1pca0_14",Dc="_title_1pca0_20",jc="_text_1pca0_24",Mc="_button_1pca0_29",Le={screen:$c,icon:qc,title:Dc,text:jc,button:Mc};async function Fc(e,t){const n={message:e.message,stack:e.stack,componentStack:t.componentStack,url:typeof window<"u"?window.location.href:"",timestamp:new Date().toISOString()},r=JSON.stringify(n);try{if(navigator.sendBeacon){navigator.sendBeacon("/api/internal/client-error",new Blob([r],{type:"application/json"}));return}}catch{}fetch("/api/internal/client-error",{method:"POST",headers:{"Content-Type":"application/json"},body:r,keepalive:!0}).catch(()=>{})}class Wc extends ur{state={hasError:!1};static getDerivedStateFromError(t){return{hasError:!0}}componentDidCatch(t,n){console.error("Uncaught error:",t,n),Fc(t,n)}render(){return this.state.hasError?o("div",{className:Le.screen,children:[o(N,{name:"exclamation-triangle",className:Le.icon}),o("h1",{className:Le.title,children:"Something went wrong"}),o("p",{className:Le.text,children:"The application encountered an unexpected error."}),o("button",{onClick:()=>{this.setState({hasError:!1}),window.location.href="/"},className:Le.button,children:[o(N,{name:"home"}),"Go back Home"]})]}):this.props.children}}const sr=fe(void 0),Bc=()=>{const e=he(sr);if(!e)throw new Error("useLanAuth must be used within a LanAuthProvider");return e},Uc=({children:e})=>{const[t,n]=g(!1),r=H(()=>n(!0),[]),s=H(()=>n(!1),[]);return w(()=>$n("lan",r),[r]),o(sr.Provider,{value:{isOpen:t,openModal:r,closeModal:s},children:e})},Hc="_container_88bss_1",Kc="_field_88bss_8",Qc="_input_88bss_19",Vc="_actions_88bss_37",Ve={container:Hc,field:Kc,input:Qc,actions:Vc},tt=dr(({variant:e="primary",size:t="md",loading:n,children:r,className:s="",disabled:i,...a},c)=>{const l=As("btn",`btn-${e}`,t!=="md"&&`btn-${t}`,n&&"btn-loading",s);return o("button",{className:l,disabled:i||n,ref:c,...a,children:n?o("span",{className:"btn-spinner"}):r})}),ir=({isOpen:e,onClose:t,onSuccess:n})=>{const[r,s]=g(""),[i,a]=g(!1);Pt.useEffect(()=>{e&&s("")},[e]);const c=async()=>{if(!r){P.error("Please enter your password");return}a(!0);try{const l=await Ot("/api/auth/app-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:r})}),u=await l.json().catch(()=>({}));if(!l.ok){P.error(u.error||"Login failed");return}P.success("Authenticated successfully"),n(),t(),window.location.reload()}catch{P.error("Network error")}finally{a(!1)}};return o(We,{isOpen:e,onClose:t,title:"LAN Authentication Required",children:o("div",{className:Ve.container,children:[o("p",{children:"This instance is protected. Enter the password to access from this device."}),o("div",{className:Ve.field,children:[o("label",{htmlFor:"lan-password",children:"Password"}),o("input",{id:"lan-password",type:"password",value:r,onChange:l=>s(l.currentTarget.value),placeholder:"Enter password...",className:Ve.input,onKeyDown:l=>l.key==="Enter"&&c()})]}),o("div",{className:Ve.actions,children:[o(tt,{variant:"secondary",onClick:t,disabled:i,children:"Cancel"}),o(tt,{variant:"primary",onClick:c,loading:i,children:"Unlock"})]})]})})},zc="_notice_1d75r_1",Gc={notice:zc},Jc=2600,Yc=1e4,Zc={anilist:"Updating AniList…",mal:"Updating MyAnimeList…"};function Xc({enabled:e=!0}){const[t,n]=g(!1),[r,s]=g("mal"),[i,a]=g(document.fullscreenElement);return w(()=>{const c=()=>a(document.fullscreenElement);return document.addEventListener("fullscreenchange",c),()=>document.removeEventListener("fullscreenchange",c)},[]),w(()=>{if(!e||typeof EventSource>"u")return;const c=new EventSource("/api/tracker/activity"),l=new Map;let u;const d=new Set;let f=-1/0;const m=h=>{let p;try{p=JSON.parse(h.data)}catch{return}const _=p.provider;_!=="anilist"&&_!=="mal"||(p.updating===!0?(clearTimeout(l.get(_)),d.size===0&&Date.now()-f>=Yc&&(f=Date.now(),s(_),n(!0),clearTimeout(u),u=setTimeout(()=>n(!1),Jc)),d.add(_)):p.updating===!1&&(clearTimeout(l.get(_)),l.set(_,setTimeout(()=>d.delete(_),1500))))};return c.addEventListener("tracker-activity",m),()=>{c.removeEventListener("tracker-activity",m),c.close(),clearTimeout(u);for(const h of l.values())clearTimeout(h);n(!1)}},[e]),!e||!t?null:Tt(o("div",{className:Gc.notice,role:"status","aria-live":"polite","aria-atomic":"true",children:[o(N,{name:r==="anilist"?"anilist":"myanimelist",size:15}),o("span",{children:Zc[r]})]}),i||document.body)}const el=M(()=>F(()=>import("./Home-GShTLEbZ.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33]))),tl=M(()=>F(()=>import("./Watchlist-D2sHodVo.js"),__vite__mapDeps([34,1,2,4,10,11,12,5,13,3,6,7,8,9,14,15,16,17,18,35,36,37,38,39]))),nl=M(()=>F(()=>import("./Settings-CibKc1Rt.js"),__vite__mapDeps([40,1,2,41,42,4,43]))),un=M(()=>F(()=>import("./Player-BTimy0Mp.js"),__vite__mapDeps([44,1,45,4,46,2,47,14,48,7,8,6,20,21,12,5,13,27,49,50,51,52,53,54,55]))),rl=M(()=>F(()=>import("./WatchAlong-iCJlxiZA.js"),__vite__mapDeps([56,1,53,54,2,4]))),ol=M(()=>F(()=>import("./Search-tnIvsV_a.js"),__vite__mapDeps([57,1,4,3,5,6,7,8,9,10,11,2,12,13,14,15,16,17,18,37,38,58,59]))),sl=M(()=>F(()=>import("./Mature-B9IEX0IP.js"),__vite__mapDeps([60,1,2,4,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,27,58,59,61]))),dn=M(()=>F(()=>import("./Asmr-CiuBtMGl.js"),__vite__mapDeps([62,1,4,2,41,42,7,8,3,5,6,9,32,24,63,25,45,46,64,65,66]))),il=M(()=>F(()=>import("./Manga-CiPWc8Ly.js"),__vite__mapDeps([67,1,4,41,42,7,8,17,18,3,5,6,9,22,23,2,24,25,27,68,69,64,65]))),al=M(()=>F(()=>import("./MangaInfoPage-3jObt7zd.js"),__vite__mapDeps([70,1,4,17,18,23,2,24,68,69,64,65]))),cl=M(()=>F(()=>import("./MangaReadPage-V5M2BLWG.js"),__vite__mapDeps([71,1,17,4,18,2,23,24,68,69,64,65]))),ll=M(()=>F(()=>import("./ReadingList-BLUM-leI.js"),__vite__mapDeps([72,1,3,4,5,6,7,8,9,73,15,16,17,18,35,36,22,23,2,24,25,26,19]))),mn=M(()=>F(()=>import("./TvSearch-p0kCDTee.js"),__vite__mapDeps([74,1,4,3,5,6,7,8,9,28,29,30,2,24,15,16,17,18,58,59]))),ul=M(()=>F(()=>import("./TvInfo-DGIpvh-v.js"),__vite__mapDeps([75,1,4,30,2,24,76]))),dl=M(()=>F(()=>import("./Tv-BePMuQoo.js"),__vite__mapDeps([77,1,45,4,46,2,47,14,48,78,7,8,27,30,24,6,51,52,53,54,79]))),ml=M(()=>F(()=>import("./TvWatchlist-CmXQkDQp.js"),__vite__mapDeps([80,1,3,4,5,6,7,8,9,73,15,16,17,18,35,36,19,29,30,2,24]))),fl=M(()=>F(()=>import("./ListeningList-DeAdvRjS.js"),__vite__mapDeps([81,1,3,4,5,6,7,8,9,73,15,16,17,18,35,36,63,32,2,24,25,31,19]))),hl=M(()=>F(()=>import("./Trackers-Cynvnhc3.js"),__vite__mapDeps([82,1,2,4,83]))),pl=M(()=>F(()=>import("./Insights-CKk02Whw.js"),__vite__mapDeps([84,1,2,4,85]))),yl=M(()=>F(()=>import("./AnimeInfoPage-BfPP9trp.js"),__vite__mapDeps([86,1,2,4]))),vl=M(()=>F(()=>import("./PlayerRedirect-fv2tzEUu.js"),__vite__mapDeps([87,1]))),gl=M(()=>F(()=>import("./VirtualKeyboard-CroH8QGP.js"),__vite__mapDeps([88,1,2,4,89])));function bl(){Ni();const{isOpen:e,closeModal:t,onSuccess:n}=dc(),{isOpen:r,setIsOpen:s}=Rt(),{isOpen:i,openModal:a,closeModal:c}=Bc(),l=nt(),u=mr(),d=U(new Map),f=U(l.pathname),m=aa();uc();const[h,p]=g(!1);w(()=>{const y=new AbortController;return $e("/api/auth/app-status",{signal:y.signal}).then(v=>{v.hasPassword&&!v.isAuthenticated&&(p(!0),a())}).catch(()=>{y.signal.aborted||P.error("Could not check server access. The server may still be starting; reload to retry.")}),()=>y.abort()},[a]);const[_,x]=$t("lan_auth_notice_shown","false"),E=U(!1);return w(()=>{if(_==="true"||E.current)return;E.current=!0,x("true");const y=setTimeout(()=>{P("Optional LAN lock is available. Set a password in Settings to protect access from other devices on your network.",{duration:1e4,icon:"🔒"})},3e3);return()=>clearTimeout(y)},[_,x]),w(()=>{try{window.history.scrollRestoration="manual"}catch{}},[]),w(()=>{const y=l.key,v=d.current;if(u==="POP"){const T=v.get(y)??0;window.scrollTo({top:T,behavior:"instant"})}else l.pathname!==f.current&&window.scrollTo({top:0,behavior:"instant"});return f.current=l.pathname,()=>{v.set(y,window.scrollY)}},[l.key,l.pathname,u]),w(()=>{const y=v=>{r&&v.key==="Escape"&&s(!1)};return r?document.body.classList.add("sidebar-open"):document.body.classList.remove("sidebar-open"),window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y),document.body.classList.remove("sidebar-open")}},[r,s]),o("div",{className:"app-container",children:[o(Lc,{isOpen:e,onClose:t,onSuccess:n}),o(ir,{isOpen:i,onClose:h?()=>{}:c,onSuccess:()=>{p(!1),c()}}),o(Pn,{position:"top-center",toastOptions:{style:{background:"var(--bg-elevated)",color:"var(--text-primary)",border:"1px solid var(--border-primary)"},success:{style:{background:"var(--accent)",color:"var(--accent-text)"},iconTheme:{primary:"var(--accent-text)",secondary:"var(--accent)"}},error:{style:{background:"rgba(153, 42, 42, 0.95)",color:"#fff"}}}}),o(Xc,{enabled:!h&&!i}),o(Aa,{}),o(Ka,{}),o("main",{className:"main-content",children:o(Wc,{children:o(jt,{fallback:o(Rc,{}),children:o(fr,{children:[o(R,{path:"/",element:o(el,{})}),o(R,{path:"/watchlist/:filter?",element:o(tl,{})}),o(R,{path:"/reading-list/:filter?",element:o(ll,{})}),o(R,{path:"/search",element:o(ol,{})}),o(R,{path:"/mature",element:o(sl,{})}),o(R,{path:"/asmr",element:o(dn,{})}),o(R,{path:"/asmr/:rj",element:o(dn,{})}),o(R,{path:"/manga",element:o(il,{})}),o(R,{path:"/manga/:provider/:id",element:o(al,{})}),o(R,{path:"/manga/:provider/:id/read",element:o(cl,{})}),o(R,{path:"/tv",element:o(mn,{})}),o(R,{path:"/tv/:id",element:o(ul,{})}),o(R,{path:"/tv/:id/watch",element:o(dl,{})}),o(R,{path:"/tv-search",element:o(mn,{})}),o(R,{path:"/tv-watchlist/:filter?",element:o(ml,{})}),o(R,{path:"/listening-list/:filter?",element:o(fl,{})}),o(R,{path:"/settings",element:o(nl,{})}),o(R,{path:"/trackers",element:o(hl,{})}),o(R,{path:"/mal",element:o(Mt,{to:"/trackers",replace:!0})}),o(R,{path:"/insights",element:o(pl,{})}),o(R,{path:"/anime/:id",element:o(yl,{})}),o(R,{path:"/watch/:id",element:o(un,{})}),o(R,{path:"/watch-along",element:o(rl,{})}),o(R,{path:"/watch/:id/:episodeNumber",element:o(un,{})}),o(R,{path:"/player/:id/:episodeNumber?",element:o(vl,{})}),o(R,{path:"*",element:o(Mt,{to:"/",replace:!0})})]})})})}),o(lc,{}),m.isVisible&&o(jt,{fallback:null,children:o(gl,{activeInputRef:m.activeInputRef,isVisible:m.isVisible,onClose:m.hide})})]})}function wl(){return o(Uc,{children:o(bl,{})})}const _l=({children:e})=>{const[t,n]=g(!1),r=H(()=>{n(i=>!i)},[]),s=Ce(()=>({isOpen:t,setIsOpen:n,toggleSidebar:r}),[t,r]);return o(Qn.Provider,{value:s,children:e})},kl=({children:e})=>{const[t,n]=$t("dango_content_type","anime"),r=Ce(()=>({contentType:t,setContentType:n}),[t,n]);return o(Vn.Provider,{value:r,children:e})},El=({children:e})=>{const[t,n]=g("englishName"),[r,s]=g(!0);w(()=>{(async()=>{try{const c=await ae.settings.getByKey.query({key:"titlePreference"});c.value&&n(c.value)}catch(c){console.error("Error fetching title preference in context:",c)}finally{s(!1)}})()},[]);const i=Ce(()=>({titlePreference:t,setTitlePreference:n,loading:r}),[t,r]);return o(Dn.Provider,{value:i,children:e})},Sl=({children:e})=>{const{data:t,isLoading:n}=at("lowEndMode"),r=Wn(),s=Z(),[i,a]=g(!1);w(()=>{const u=s.getDefaultOptions();s.setDefaultOptions({...u,queries:{...u.queries,gcTime:i?900*1e3:1800*1e3}})},[i,s]),w(()=>{t!==void 0&&a(t==="true"||t===!0)},[t]),w(()=>{i?document.body.classList.add("low-end"):document.body.classList.remove("low-end")},[i]);const c=H(u=>{a(u),r.mutate({key:"lowEndMode",value:String(u)})},[r]),l=Ce(()=>({lowEndMode:i,setLowEndMode:c,loading:n}),[i,c,n]);return o(Bn.Provider,{value:l,children:e})},Pl=["iris","mochi","sakura"];function fn(e){e==="iris"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",e)}const Tl=({children:e})=>{const{data:t,isLoading:n}=at("theme"),r=Wn(),[s,i]=g("iris");w(()=>{typeof t=="string"&&Pl.includes(t)&&i(t)},[t]),w(()=>{fn(s)},[s]);const a=H(l=>{l!==s&&(i(l),fn(l),r.mutate({key:"theme",value:l}))},[r,s]),c=Ce(()=>({theme:s,setTheme:a,loading:n}),[s,a,n]);return o(Hn.Provider,{value:c,children:e})},xl=({children:e})=>{const[t,n]=g(!1),[r,s]=g(void 0),i=H(c=>{s(()=>c),n(!0)},[]),a=H(()=>{n(!1),s(void 0)},[]);return w(()=>$n("animepahe",()=>i()),[i]),o(tr.Provider,{value:{isOpen:t,openModal:i,closeModal:a,onSuccess:r},children:e})},Il="_gate_r3yn2_1",Nl="_panel_r3yn2_10",Cl="_form_r3yn2_18",Ol="_field_r3yn2_31",Al="_avatarRow_r3yn2_48",Ll="_profileList_r3yn2_60",Rl="_smallAvatar_r3yn2_73",$l="_profileName_r3yn2_78",xe={gate:Il,panel:Nl,form:Cl,field:Ol,avatarRow:Al,profileList:Ll,smallAvatar:Rl,profileName:$l};function ql({children:e}){const[t,n]=g(!1),[r,s]=g(!1),[i,a]=g([]),[c,l]=g(""),[u,d]=g(""),[f,m]=g(""),[h,p]=g(!1),[_,x]=g(0);if(w(()=>{let y=!1;return m(""),(async()=>{const T=await $e("/api/auth/app-status");if(y)return;if(T.hasPassword&&!T.isAuthenticated){s(!0);return}const z=await $e("/api/profiles/status");y||(z.current?(Es(z.current.id),n(!0)):(a(z.profiles),l(z.profiles[0]?.id??"")))})().catch(T=>{y||m(T.message)}),()=>{y=!0}},[_]),w(()=>{const y=T=>{T.key==="dango:profile-session-change"&&window.location.reload()},v=()=>{n(!1),x(T=>T+1)};return window.addEventListener("storage",y),window.addEventListener("dango:profile-auth-required",v),()=>{window.removeEventListener("storage",y),window.removeEventListener("dango:profile-auth-required",v)}},[]),t)return e;const E=i.find(y=>y.id===c);return o("div",{className:xe.gate,children:[o(Pn,{}),o(ir,{isOpen:r,onClose:()=>{},onSuccess:()=>{s(!1),x(y=>y+1)}}),o("section",{className:xe.panel,children:[o("h1",{children:i.length?"Choose your profile":"Connecting to Dango…"}),E&&o(Y,{children:[o("div",{className:xe.avatarRow,children:o(Jn,{image:E.avatar??E.cloudAvatar,name:E.name})}),o("form",{className:xe.form,onSubmit:async y=>{y.preventDefault(),p(!0),m("");try{await $e("/api/profiles/login",{method:"POST",body:JSON.stringify({id:c,password:u})}),Ps()}catch(v){m(v.message),p(!1)}},children:[o("label",{className:xe.field,children:["Profile",o("select",{value:c,onChange:y=>{l(y.currentTarget.value),d(""),m("")},children:i.map(y=>o("option",{value:y.id,children:[y.name,y.owner?" (owner)":""]},y.id))})]}),E.protected&&o("label",{className:xe.field,children:["Password",o("input",{type:"password",autoComplete:"current-password",required:!0,maxLength:256,value:u,onChange:y=>d(y.currentTarget.value)})]}),o(tt,{type:"submit",loading:h,children:"Continue"})]})]}),f&&o(Y,{children:[o("p",{role:"alert",children:f}),o(tt,{variant:"secondary",onClick:()=>x(y=>y+1),children:"Retry"})]})]})]})}const ar=fe(null);function ku(){const e=he(ar);if(!e)throw new Error("WatchAlongProvider is missing");return e}const Dl=/^[0-9a-f-]{36}$/,jl=/^[0-9a-f]{64}$/;function Eu(e,t){return(e.kind??"anime")===(t.kind??"anime")&&e.season===t.season&&e.showId===t.showId&&e.episode===t.episode&&e.provider===t.provider&&e.mode===t.mode&&e.source===t.source}function Su(e,t){return e.position+(e.playing?Math.max(0,t-e.updatedAt)/1e3*e.rate:0)}const qt=e=>String(e).toLowerCase()==="movie"?"movie":"tv",Pu=(e,t)=>`${qt(e)}:${t}`,Tu=(e,t)=>{const n=qt(e);return`/tv/${t}?type=${n}`},Ml=(e,t,n,r)=>{const s=new URLSearchParams;return s.set("type",qt(e)),n!==void 0&&s.set("s",String(n)),r!==void 0&&s.set("e",String(r)),`/tv/${t}/watch?${s.toString()}`},xu=e=>e.adult===!0||e.adult===1,Iu={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"},Nu={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"},St="dango-watch-along",Dt="dango-watch-along-host";function hn(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.id!="string"||typeof t.token!="string"||typeof t.guestToken!="string")return null;const n=qe(`${t.id}.${t.guestToken}`,""),r=qe(`${t.id}.${t.token}`,"");return{...n,token:r.token,host:t.host===!0}}function Fl(){try{return hn(JSON.parse(sessionStorage.getItem(St)||"null"))??hn(JSON.parse(localStorage.getItem(Dt)||"null"))}catch{return null}}function Wl(e){try{e?sessionStorage.setItem(St,JSON.stringify(e)):sessionStorage.removeItem(St),e?.host&&localStorage.setItem(Dt,JSON.stringify(e))}catch{}}function ze(){try{localStorage.removeItem(Dt)}catch{}}function Bl(e){return e.kind==="tv"||e.kind==="movie"?Ml(e.kind,e.showId,e.kind==="tv"?e.season:void 0,e.kind==="tv"?Number(e.episode):void 0):`/watch/${encodeURIComponent(e.showId)}/${encodeURIComponent(e.episode)}`}function qe(e,t){let n=e.trim().replace(/^#/,"");if(n.includes("://")){const a=new URL(n);if(a.origin!==new URL(t).origin||!["/join","/watch-along"].includes(a.pathname))throw new Error("Use an invite from this dango watch-along service.");n=a.hash.slice(1)}const[r,s,i]=n.split(".");if(!Dl.test(r||"")||!jl.test(s||"")||i!==void 0)throw new Error("Paste a complete watch-along invite link or room code.");return{id:r,token:s,guestToken:s,host:!1}}function Ul({children:e}){const t=vn(),n=nt(),[r,s]=$t("watchAlongName",""),[i,a]=g(Fl),[c,l]=g(null),[u,d]=g(!1),[f,m]=g(""),[h,p]=g(""),[_,x]=g({offset:0,latency:0}),E=U(null),{data:y}=ne({queryKey:["watch-along-config"],queryFn:()=>ae.settings.watchAlong.query()}),v=y?.workerUrl.replace(/\/$/,"")||"";w(()=>{Wl(i)},[i]);const T=H(C=>{E.current?.readyState===WebSocket.OPEN&&E.current.send(JSON.stringify(C))},[]);w(()=>{if(!u)return;const C=setTimeout(()=>T({type:"name",name:r}),250);return()=>clearTimeout(C)},[u,h,r,T]);const z=H(()=>{i?.host&&T({type:"end"}),E.current?.close(1e3,"Left room"),ze(),a(null),l(null),d(!1),m("")},[T,i]),X=async C=>{if(!v)throw new Error("Watch along is unavailable. Check your server configuration.");const re=await fetch(`${v}/rooms`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(C),signal:AbortSignal.timeout(15e3)}),G=await re.json();if(!re.ok)throw new Error(G.error||"Could not create room");const b=qe(`${G.id}.${G.guestToken}`,v),I=qe(`${G.id}.${G.hostToken}`,v);m(""),l(null),a({...b,token:I.token,host:!0})},ge=C=>{if(!v)throw new Error("Watch along is unavailable. Check your server configuration.");const re=qe(C,v);ze(),m(""),l(null),a(re)};return w(()=>{if(!i||!v)return;let C=!1,re=0,G,b,I=Date.now();const S=async()=>{if(C)return;try{const oe=await fetch(`${v}/rooms/${i.id}`,{headers:{Authorization:`Bearer ${i.token}`},signal:AbortSignal.timeout(1e4)});if(C)return;if(!oe.ok){const O=await oe.json();if([403,404,409].includes(oe.status)){m(O.error||"Unable to join room"),ze(),a(null),l(null);return}throw new Error(O.error||"Room service unavailable")}}catch{if(C)return;m("Cannot reach the room service. Retrying…"),G=setTimeout(S,Math.min(15e3,1e3*2**Math.min(re++,4)));return}const D=new URL(`${v}/rooms/${i.id}/ws`);D.protocol=D.protocol==="https:"?"wss:":"ws:";const W=new WebSocket(D,["dango-watch-along",i.token]);E.current=W,W.onopen=()=>{I=Date.now()},W.onmessage=oe=>{if(!(C||E.current!==W)){I=Date.now();try{const O=JSON.parse(oe.data);if(O.type==="joined"){if(O.host!==i.host){W.close(4003,"Invalid role");return}re=0,d(!0),m(""),p(O.id),W.send(JSON.stringify({type:"ping",sentAt:Date.now()}))}else if(O.type==="state")l(ce=>ce&&ce.revision>O.state.revision?ce:O.state);else if(O.type==="pong"){const ce=Date.now()-O.sentAt;x({offset:O.serverTime-(O.sentAt+ce/2),latency:ce/2})}else O.type==="error"&&m(O.error)}catch{m("Invalid response from the room service.")}}},W.onclose=oe=>{if(!(C||E.current!==W)){if(clearInterval(b),d(!1),[4003,4004,4009].includes(oe.code)){m(oe.reason||"Room closed"),oe.code!==4009&&ze(),a(null),l(null);return}m("Connection lost. Reconnecting…"),G=setTimeout(S,Math.min(15e3,1e3*2**Math.min(re++,4)))}},W.onerror=()=>W.close(),b=setInterval(()=>{Date.now()-I>25e3?W.close():W.readyState===WebSocket.OPEN&&W.send(JSON.stringify({type:"ping",sentAt:Date.now()}))},1e4)};return S(),()=>{C=!0,clearTimeout(G),clearInterval(b),E.current?.close(1e3,"Leaving connection"),E.current=null,d(!1)}},[i,v]),w(()=>{if(!i||i.host||!c)return;const C=Bl(c.selection);`${n.pathname}${n.search}`!==C&&t(C,{replace:!0})},[i,c,n.pathname,n.search,t]),o(ar.Provider,{value:{workerUrl:v,displayName:r,setDisplayName:s,session:i,room:c,connected:u,error:f,selfId:h,clock:_,create:X,join:ge,leave:z,send:T},children:e})}try{window.history.scrollRestoration="manual"}catch{}const pn=new gr({defaultOptions:{queries:{staleTime:1e3*60*5,gcTime:1800*1e3,refetchOnWindowFocus:!1,refetchIntervalInBackground:!1,retry:1}}}),yn=document.getElementById("root");yn&&hr(o(ql,{children:o(pr,{children:o(Ns,{trpcClient:ae,queryClient:pn,children:o(br,{client:pn,children:o(xl,{children:o(_l,{children:o(kl,{children:o(El,{children:o(Sl,{children:o(Tl,{children:o(Ul,{children:o(wl,{})})})})})})})})})})})}),yn);export{lt as $,Jl as A,tt as B,yu as C,uu as D,cu as E,P as F,at as G,Wn as H,fu as I,hu as J,mu as K,We as L,Nu as M,ca as N,$e as O,xe as P,Jn as Q,Ps as R,Ot as S,Iu as T,K as U,gu as V,bu as W,an as X,Gn as Y,sn as Z,F as _,$t as a,Gl as a0,ee as a1,ku as a2,Lc as a3,eu as a4,ia as a5,_u as a6,$n as a7,qt as a8,Pu as a9,wu as aa,Eu as ab,Su as ac,Rt as ad,vu as ae,Rc as af,ou as ag,su as ah,ru as ai,Yl as b,Zl as c,Rs as d,La as e,Os as f,Vl as g,Ml as h,xu as i,Tu as j,Ls as k,q as l,Xl as m,zn as n,du as o,V as p,$ as q,tu as r,zl as s,ae as t,pi as u,nu as v,iu as w,au as x,pu as y,lu as z};
178
+ `,Be=16,Pn=({reverseOrder:e,position:t="top-center",toastOptions:n,gutter:r,children:s,toasterId:i,containerStyle:a,containerClassName:c})=>{let{toasts:l,handlers:u}=Dr(n,i);return J("div",{"data-rht-toaster":i||"",style:{position:"fixed",zIndex:9999,top:Be,left:Be,right:Be,bottom:Be,pointerEvents:"none",...a},className:c,onMouseEnter:u.startPause,onMouseLeave:u.endPause},l.map(d=>{let h=d.position||t,m=u.calculateOffset(d,{reverseOrder:e,gutter:r,defaultPosition:t}),f=ao(h,m);return J(io,{id:d.id,key:d.id,onHeightUpdate:u.updateHeight,className:d.visible?co:"",style:f},d.type==="custom"?Ze(d.message,d):s?s(d):J(so,{toast:d,position:h}))}))},P=K;function st(e){const t={subscribe(n){let r=null,s=!1,i=!1,a=!1;function c(){if(r===null){a=!0;return}i||(i=!0,typeof r=="function"?r():r&&r.unsubscribe())}return r=e({next(l){var u;s||(u=n.next)===null||u===void 0||u.call(n,l)},error(l){var u;s||(s=!0,(u=n.error)===null||u===void 0||u.call(n,l),c())},complete(){var l;s||(s=!0,(l=n.complete)===null||l===void 0||l.call(n),c())}}),a&&c(),{unsubscribe:c}},pipe(...n){return n.reduce(lo,t)}};return t}function lo(e,t){return t(e)}function uo(e){const t=new AbortController;return new Promise((n,r)=>{let s=!1;function i(){s||(s=!0,a.unsubscribe())}t.signal.addEventListener("abort",()=>{r(t.signal.reason)});const a=e.subscribe({next(c){s=!0,n(c),i()},error(c){r(c)},complete(){t.abort(),i()}})})}function mo(e){return t=>{let n=0,r=null;const s=[];function i(){r||(r=t.subscribe({next(c){for(const u of s){var l;(l=u.next)===null||l===void 0||l.call(u,c)}},error(c){for(const u of s){var l;(l=u.error)===null||l===void 0||l.call(u,c)}},complete(){for(const l of s){var c;(c=l.complete)===null||c===void 0||c.call(l)}}}))}function a(){if(n===0&&r){const c=r;r=null,c.unsubscribe()}}return st(c=>(n++,s.push(c),i(),{unsubscribe(){n--,a();const l=s.findIndex(u=>u===c);l>-1&&s.splice(l,1)}}))}}function ho(e){let t=e;const n=[],r=a=>{t!==void 0&&a.next(t),n.push(a)},s=a=>{n.splice(n.indexOf(a),1)},i=st(a=>(r(a),()=>{s(a)}));return i.next=a=>{if(t!==a){t=a;for(const c of n)c.next(a)}},i.get=()=>t,i}function fo(e){return st(t=>{function n(r=0,s=e.op){const i=e.links[r];if(!i)throw new Error("No more links to execute - did you forget to add an ending link?");return i({op:s,next(a){return n(r+1,a)}})}return n().subscribe(t)})}function De(e){"@babel/helpers - typeof";return De=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},De(e)}function po(e,t){if(De(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(De(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function yo(e){var t=po(e,"string");return De(t)=="symbol"?t:t+""}function te(e,t,n){return(t=yo(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Bt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Q(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Bt(Object(n),!0).forEach(function(r){te(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bt(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function _e(e){return!!e&&!Array.isArray(e)&&typeof e=="object"}function go(e){return typeof e=="function"}function vo(){return Object.create(null)}const bo=typeof Symbol=="function"&&!!Symbol.asyncIterator;function wo(e){return bo&&_e(e)&&Symbol.asyncIterator in e}const _o=e=>e(),Tn=()=>{},Ut=e=>{Object.freeze&&Object.freeze(e)};function xn(e,t,n){var r;const s=t.join(".");return(r=n[s])!==null&&r!==void 0||(n[s]=new Proxy(Tn,{get(i,a){if(!(typeof a!="string"||a==="then"))return xn(e,[...t,a],n)},apply(i,a,c){const l=t[t.length-1];if(l==="valueOf"||l==="toString"||l==="toJSON")return`tRPC.proxy(${t.slice(0,-1).join(".")})`;let u={args:c,path:t};return l==="call"?u={args:c.length>=2?[c[1]]:[],path:t.slice(0,-1)}:l==="apply"&&(u={args:c.length>=2?c[1]:[],path:t.slice(0,-1)}),Ut(u.args),Ut(u.path),e(u)}})),n[s]}const In=e=>xn(e,[],vo()),Eo=e=>new Proxy(Tn,{get(t,n){if(n!=="then")return e(n)}});function je(e){"@babel/helpers - typeof";return je=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},je(e)}function So(e,t){if(je(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(je(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ko(e){var t=So(e,"string");return je(t)=="symbol"?t:t+""}function yt(e,t,n){return(t=ko(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ht(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Ue(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ht(Object(n),!0).forEach(function(r){yt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ht(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Po=class extends Error{constructor(e){super(To(e)),Object.assign(this,e)}};function To(e){if("message"in e)return String(e.message)}function xo(e){if(e instanceof Error)return e;const t=typeof e;if(!(t==="undefined"||t==="function"||e===null)){if(t!=="object")return new Error(String(e));if(_e(e))return new Po(e)}}var Kt=class extends Error{constructor(e){var t,n,r;const s=xo(e.cause),i=(t=(n=e.message)!==null&&n!==void 0?n:s?.message)!==null&&t!==void 0?t:e.code;super(i,{cause:s}),yt(this,"cause",void 0),yt(this,"code",void 0),this.code=e.code,this.name="TRPCError",(r=this.cause)!==null&&r!==void 0||(this.cause=s)}};function Io(e,t){if("error"in e){const n=t.deserialize(e.error);return{ok:!1,error:Ue(Ue({},e),{},{error:n})}}return{ok:!0,result:Ue(Ue({},e.result),(!e.result.type||e.result.type==="data")&&{type:"data",data:t.deserialize(e.result.data)})}}var ct=class extends Error{constructor(){super("Unable to transform response from server")}};function No(e,t){let n;try{n=Io(e,t)}catch{throw new ct}if(!n.ok&&(!_e(n.error.error)||typeof n.error.error.code!="number"))throw new ct;if(n.ok&&!_e(n.result))throw new ct;return n}function Co(e){return typeof e=="function"}async function Oo(e,t){const{_def:n}=e;let r=n.procedures[t];for(;!r;){const s=Object.keys(n.lazy).find(i=>t===i||t.startsWith(i+"."));if(!s)return null;await n.lazy[s].load(),r=n.procedures[t]}return r}async function Ao(e){const{type:t,path:n}=e,r=await Oo(e.router,n);if(!r||!Co(r)||r._def.type!==t&&!e.allowMethodOverride)throw new Kt({code:"NOT_FOUND",message:`No "${t}"-procedure on path "${n}"`});if(r._def.type!==t&&e.allowMethodOverride&&r._def.type==="subscription")throw new Kt({code:"METHOD_NOT_SUPPORTED",message:"Method override is not supported for subscriptions"});return r(e)}function Lo(e){return e instanceof Xe}function Ro(e){return _e(e)&&_e(e.error)&&typeof e.error.code=="number"&&typeof e.error.message=="string"}function $o(e,t){return typeof e=="string"?e:_e(e)&&typeof e.message=="string"?e.message:t}var Xe=class Je extends Error{constructor(t,n){var r,s;const i=n?.cause;super(t,{cause:i}),te(this,"cause",void 0),te(this,"shape",void 0),te(this,"data",void 0),te(this,"meta",void 0),this.meta=n?.meta,this.cause=i,this.shape=n==null||(r=n.result)===null||r===void 0?void 0:r.error,this.data=n==null||(s=n.result)===null||s===void 0?void 0:s.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,Je.prototype)}static from(t,n={}){const r=t;return Lo(r)?(n.meta&&(r.meta=Q(Q({},r.meta),n.meta)),r):Ro(r)?new Je(r.error.message,Q(Q({},n),{},{result:r,cause:n.cause})):new Je($o(r,"Unknown error"),Q(Q({},n),{},{cause:r}))}};function qo(e){const t=e;return t?"input"in t?t:{input:t,output:t}:{input:{serialize:n=>n,deserialize:n=>n},output:{serialize:n=>n,deserialize:n=>n}}}const Qt=e=>typeof e=="function";function Do(e){if(e)return e;if(typeof window<"u"&&Qt(window.fetch))return window.fetch.bind(window);if(typeof globalThis<"u"&&Qt(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}function jo(...e){const t=new AbortController,n=e.length;let r=0;const s=()=>{++r===n&&t.abort()};for(const i of e)i?.aborted?s():i?.addEventListener("abort",s,{once:!0});return t.signal}function Mo(...e){const t=new AbortController;for(const n of e)n?.aborted?t.abort():n?.addEventListener("abort",()=>t.abort(),{once:!0});return t.signal}function Fo(e){return{url:e.url.toString(),fetch:e.fetch,transformer:qo(e.transformer),methodOverride:e.methodOverride}}function Wo(e){const t={};for(let n=0;n<e.length;n++){const r=e[n];t[n]=r}return t}const Bo={query:"GET",mutation:"POST",subscription:"PATCH"};function Nn(e){return"input"in e?e.transformer.input.serialize(e.input):Wo(e.inputs.map(t=>e.transformer.input.serialize(t)))}const Cn=e=>{const t=e.url.split("?");let n=t[0].replace(/\/$/,"")+"/"+e.path;const r=[];if(t[1]&&r.push(t[1]),"inputs"in e&&r.push("batch=1"),e.type==="query"||e.type==="subscription"){const s=Nn(e);s!==void 0&&e.methodOverride!=="POST"&&r.push(`input=${encodeURIComponent(JSON.stringify(s))}`)}return r.length&&(n+="?"+r.join("&")),n},Uo=e=>{if(e.type==="query"&&e.methodOverride!=="POST")return;const t=Nn(e);return t!==void 0?JSON.stringify(t):void 0},Ho=e=>zo(Q(Q({},e),{},{contentTypeHeader:"application/json",getUrl:Cn,getBody:Uo}));var Ko=class extends Error{constructor(){const e="AbortError";super(e),this.name=e,this.message=e}};const Qo=e=>{var t;if(e?.aborted)throw(t=e.throwIfAborted)===null||t===void 0||t.call(e),typeof DOMException<"u"?new DOMException("AbortError","AbortError"):new Ko};async function Vo(e){var t,n;Qo(e.signal);const r=e.getUrl(e),s=e.getBody(e),i=(t=e.methodOverride)!==null&&t!==void 0?t:Bo[e.type],a=await(async()=>{const l=await e.headers();return Symbol.iterator in l?Object.fromEntries(l):l})(),c=Q(Q(Q({},e.contentTypeHeader&&i!=="GET"?{"content-type":e.contentTypeHeader}:{}),e.trpcAcceptHeader?{[(n=e.trpcAcceptHeaderKey)!==null&&n!==void 0?n:"trpc-accept"]:e.trpcAcceptHeader}:void 0),a);return Do(e.fetch)(r,{method:i,signal:e.signal,body:s,headers:c})}async function zo(e){const t={},n=await Vo(e);t.response=n;const r=await n.json();return t.responseJSON=r,{json:r,meta:t}}const Vt=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function zt(e){let t=null,n=null;const r=()=>{clearTimeout(n),n=null,t=null};function s(c){const l=[[]];let u=0;for(;;){const m=c[u];if(!m)break;const f=l[l.length-1];if(m.aborted){var d;(d=m.reject)===null||d===void 0||d.call(m,new Error("Aborted")),u++;continue}if(e.validate(f.concat(m).map(p=>p.key))){f.push(m),u++;continue}if(f.length===0){var h;(h=m.reject)===null||h===void 0||h.call(m,new Error("Input is too big for a single dispatch")),u++;continue}l.push([])}return l}function i(){const c=s(t);r();for(const l of c){if(!l.length)continue;const u={items:l};for(const d of l)d.batch=u;e.fetch(u.items.map(d=>d.key)).then(async d=>{await Promise.all(d.map(async(m,f)=>{const p=u.items[f];try{var _;const S=await Promise.resolve(m);(_=p.resolve)===null||_===void 0||_.call(p,S)}catch(S){var x;(x=p.reject)===null||x===void 0||x.call(p,S)}p.batch=null,p.reject=null,p.resolve=null}));for(const m of u.items){var h;(h=m.reject)===null||h===void 0||h.call(m,new Error("Missing result")),m.batch=null}}).catch(d=>{for(const m of u.items){var h;(h=m.reject)===null||h===void 0||h.call(m,d),m.batch=null}})}}function a(c){var l;const u={aborted:!1,key:c,batch:null,resolve:Vt,reject:Vt},d=new Promise((h,m)=>{var f;u.reject=m,u.resolve=h,(f=t)!==null&&f!==void 0||(t=[]),t.push(u)});return(l=n)!==null&&l!==void 0||(n=setTimeout(i)),d}return{load:a}}function Go(e){var t,n;const r=Fo(e),s=(t=e.maxURLLength)!==null&&t!==void 0?t:1/0,i=(n=e.maxItems)!==null&&n!==void 0?n:1/0;return()=>{const a=l=>({validate(u){if(s===1/0&&i===1/0)return!0;if(u.length>i)return!1;const d=u.map(m=>m.path).join(","),h=u.map(m=>m.input);return Cn(Q(Q({},r),{},{type:l,path:d,inputs:h,signal:null})).length<=s},async fetch(u){const d=u.map(p=>p.path).join(","),h=u.map(p=>p.input),m=jo(...u.map(p=>p.signal)),f=await Ho(Q(Q({},r),{},{path:d,inputs:h,type:l,headers(){return e.headers?typeof e.headers=="function"?e.headers({opList:u}):e.headers:{}},signal:m}));return(Array.isArray(f.json)?f.json:u.map(()=>f.json)).map(p=>({meta:f.meta,json:p}))}}),c={query:zt(a("query")),mutation:zt(a("mutation"))};return({op:l})=>st(u=>{if(l.type==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");const d=new AbortController,h=c[l.type].load(Q(Q({},l),{},{signal:Mo(l.signal,d.signal)}));let m=!1,f;return h.then(p=>{m=!0,f=p;const _=No(p.json,r.transformer.output);if(!_.ok){u.error(Xe.from(_.error,{meta:p.meta}));return}u.next({context:p.meta,result:_.result}),u.complete()}).catch(p=>{m=!0,u.error(Xe.from(p,{meta:f?.meta}))}),()=>{m||d.abort()}})}}const On=(e,...t)=>typeof e=="function"?e(...t):e;function Jo(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}async function Yo(e){const t=await On(e.url);return e.connectionParams?t+`${t.includes("?")?"&":"?"}connectionParams=1`:t}async function Zo(e,t){const n={method:"connectionParams",data:await On(e)};return t.encode(n)}function Xo(e){const{promise:t,resolve:n,reject:r}=Jo();return e.addEventListener("open",()=>{e.removeEventListener("error",r),n()}),e.addEventListener("error",r),t}function es(e,{intervalMs:t,pongTimeoutMs:n}){let r,s;function i(){r=setTimeout(()=>{e.send("PING"),s=setTimeout(()=>{e.close()},n)},t)}function a(){clearTimeout(r),i()}function c(){clearTimeout(s),a()}e.addEventListener("open",i),e.addEventListener("message",({data:l})=>{clearTimeout(r),i(),l==="PONG"&&c()}),e.addEventListener("close",()=>{clearTimeout(r),clearTimeout(s)})}var ts=class gt{constructor(t){var n;if(te(this,"id",++gt.connectCount),te(this,"WebSocketPonyfill",void 0),te(this,"urlOptions",void 0),te(this,"keepAliveOpts",void 0),te(this,"encoder",void 0),te(this,"wsObservable",ho(null)),te(this,"openPromise",null),this.WebSocketPonyfill=(n=t.WebSocketPonyfill)!==null&&n!==void 0?n:WebSocket,!this.WebSocketPonyfill)throw new Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");this.urlOptions=t.urlOptions,this.keepAliveOpts=t.keepAlive,this.encoder=t.encoder}get ws(){return this.wsObservable.get()}set ws(t){this.wsObservable.next(t)}isOpen(){return!!this.ws&&this.ws.readyState===this.WebSocketPonyfill.OPEN&&!this.openPromise}isClosed(){return!!this.ws&&(this.ws.readyState===this.WebSocketPonyfill.CLOSING||this.ws.readyState===this.WebSocketPonyfill.CLOSED)}async open(){if(this.openPromise)return this.openPromise;this.id=++gt.connectCount;const t=Yo(this.urlOptions).then(n=>new this.WebSocketPonyfill(n));this.openPromise=t.then(async n=>{this.ws=n,n.binaryType="arraybuffer",n.addEventListener("message",function({data:r}){r==="PING"&&this.send("PONG")}),this.keepAliveOpts.enabled&&es(n,this.keepAliveOpts),n.addEventListener("close",()=>{this.ws===n&&(this.ws=null)}),await Xo(n),this.urlOptions.connectionParams&&n.send(await Zo(this.urlOptions.connectionParams,this.encoder))});try{await this.openPromise}finally{this.openPromise=null}}async close(){try{await this.openPromise}finally{var t;(t=this.ws)===null||t===void 0||t.close()}}};te(ts,"connectCount",0);var An=class{constructor(e){te(this,"links",void 0),te(this,"runtime",void 0),te(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=e.links.map(t=>t(this.runtime))}$request(e){var t;return fo({links:this.links,op:Q(Q({},e),{},{context:(t=e.context)!==null&&t!==void 0?t:{},id:++this.requestId})}).pipe(mo())}async requestAsPromise(e){try{const t=this.$request(e);return(await uo(t)).result.data}catch(t){throw Xe.from(t)}}query(e,t,n){return this.requestAsPromise({type:"query",path:e,input:t,context:n?.context,signal:n?.signal})}mutation(e,t,n){return this.requestAsPromise({type:"mutation",path:e,input:t,context:n?.context,signal:n?.signal})}subscription(e,t,n){return this.$request({type:"subscription",path:e,input:t,context:n.context,signal:n.signal}).subscribe({next(r){switch(r.result.type){case"state":var s;(s=n.onConnectionStateChange)===null||s===void 0||s.call(n,r.result);break;case"started":var i;(i=n.onStarted)===null||i===void 0||i.call(n,{context:r.context});break;case"stopped":var a;(a=n.onStopped)===null||a===void 0||a.call(n);break;case"data":case void 0:var c;(c=n.onData)===null||c===void 0||c.call(n,r.result.data)}},error(r){var s;(s=n.onError)===null||s===void 0||s.call(n,r)},complete(){var r;(r=n.onComplete)===null||r===void 0||r.call(n)}})}};const Ln=Symbol.for("trpc_untypedClient"),ns={query:"query",mutate:"mutation",subscribe:"subscription"},rs=e=>ns[e];function os(e){const t=In(({path:n,args:r})=>{const s=[...n],i=rs(s.pop()),a=s.join(".");return e[i](a,...r)});return Eo(n=>n===Ln?e:t[n])}function ss(e){return os(new An(e))}function is(e){return e[Ln]}function Me(e){"@babel/helpers - typeof";return Me=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Me(e)}function as(e,t){if(Me(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Me(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function cs(e){var t=as(e,"string");return Me(t)=="symbol"?t:t+""}function ls(e,t,n){return(t=cs(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Gt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function L(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Gt(Object(n),!0).forEach(function(r){ls(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gt(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function us(e){var t,n,r,s=2;for(typeof Symbol<"u"&&(n=Symbol.asyncIterator,r=Symbol.iterator);s--;){if(n&&(t=e[n])!=null)return t.call(e);if(r&&(t=e[r])!=null)return new Ye(t.call(e));n="@@asyncIterator",r="@@iterator"}throw new TypeError("Object is not async iterable")}function Ye(e){function t(n){if(Object(n)!==n)return Promise.reject(new TypeError(n+" is not an object."));var r=n.done;return Promise.resolve(n.value).then(function(s){return{value:s,done:r}})}return Ye=function(r){this.s=r,this.n=r.next},Ye.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(r){var s=this.s.return;return s===void 0?Promise.resolve({value:r,done:!0}):t(s.apply(this.s,arguments))},throw:function(r){var s=this.s.return;return s===void 0?Promise.reject(r):t(s.apply(this.s,arguments))}},new Ye(e)}function ds(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function ms(e,t){if(e==null)return{};var n,r,s=ds(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}const hs=["cursor","direction"];function it(e){return{path:e.path.join(".")}}function fs(e){return e.length>=3}function ps(e){return fs(e)?{type:"prefixed",prefix:e[0],path:e[1],args:e[2]}:{type:"unprefixed",prefix:void 0,path:e[0],args:e[1]}}function Nt(e,t,n){var r;const s=ps(e);let i=(r=s.args)===null||r===void 0?void 0:r.input;if(n){var a,c;i=L(L(L({},(a=(c=s.args)===null||c===void 0?void 0:c.input)!==null&&a!==void 0?a:{}),n.pageParam!==void 0?{cursor:n.pageParam}:{}),{},{direction:n.direction})}return[s.path.join("."),i,t?.trpc]}async function ys(e,t,n){const r=t.getQueryCache().build(t,{queryKey:n});r.setState({data:[],status:"success"});const s=[];var i=!1,a=!1,c;try{for(var l=us(e),u;i=!(u=await l.next()).done;i=!1){const d=u.value;s.push(d),r.setState({data:[...s]})}}catch(d){a=!0,c=d}finally{try{i&&l.return!=null&&await l.return()}finally{if(a)throw c}}return s}function pe(e){const t=_o(()=>{const{input:n,type:r}=e,s=e.path.flatMap(i=>i.split("."));if(!n&&r==="any")return s.length?[s]:[];if(r==="infinite"&&_e(n)&&("direction"in n||"cursor"in n)){const{cursor:i,direction:a}=n;return[s,{input:ms(n,hs),type:"infinite"}]}return[s,L(L({},typeof n<"u"&&n!==Pe&&{input:n}),r&&r!=="any"&&{type:r})]});return e.prefix&&t.unshift([e.prefix]),t}function Rn(e){const t=[e.path.flatMap(n=>n.split("."))];return e.prefix&&t.unshift([e.prefix]),t}function Ct(e){return go(e)?e():e}function gs(e){var t;const{input:n,query:r,path:s,queryKey:i,opts:a}=e,c=n===Pe,l=async u=>{var d;const h=L(L({},a),{},{trpc:L(L({},a?.trpc),!(a==null||(d=a.trpc)===null||d===void 0)&&d.abortOnUnmount?{signal:u.signal}:{signal:null})});return await r(...Nt(i,h,{direction:u.direction,pageParam:u.pageParam}))};return Object.assign(yr(L(L({},a??{}),{},{queryKey:i,queryFn:c?Pe:l,initialPageParam:(t=a?.initialCursor)!==null&&t!==void 0?t:n?.cursor})),{trpc:it({path:s})})}function vs(e){var t,n;const{mutate:r,path:s,prefix:i,opts:a,overrides:c}=e,l=Ct(e.queryClient),u=Rn({path:s,prefix:(t=a?.keyPrefix)!==null&&t!==void 0?t:i}),d=l.defaultMutationOptions(l.getMutationDefaults(u)),h=(n=c?.onSuccess)!==null&&n!==void 0?n:(f=>f.originalFn()),m=async f=>await r(...Nt([...u,{input:f}],a));return L(L({},a),{},{mutationKey:u,mutationFn:m,onSuccess(...f){var p,_;return h({originalFn:()=>{var S,y,g;return(S=a==null||(y=a.onSuccess)===null||y===void 0?void 0:y.call(a,...f))!==null&&S!==void 0?S:d==null||(g=d.onSuccess)===null||g===void 0?void 0:g.call(d,...f)},queryClient:l,meta:(p=(_=a?.meta)!==null&&_!==void 0?_:d?.meta)!==null&&p!==void 0?p:{}})},trpc:it({path:s})})}function bs(e){const{input:t,query:n,path:r,queryKey:s,opts:i}=e,a=Ct(e.queryClient),c=t===Pe,l=async u=>{var d;const h=L(L({},i),{},{trpc:L(L({},i?.trpc),!(i==null||(d=i.trpc)===null||d===void 0)&&d.abortOnUnmount?{signal:u.signal}:{signal:null})}),m=u.queryKey,f=await n(...Nt(m,h));return wo(f)?ys(f,a,m):f};return Object.assign(gr(L(L({},i),{},{queryKey:s,queryFn:c?Pe:l})),{trpc:it({path:r})})}const ws=e=>{const{subscribe:t,path:n,queryKey:r,input:s,opts:i={}}=e,a="enabled"in i?!!i.enabled:s!==Pe,c=l=>t(n.join("."),s===Pe?void 0:s,l);return L(L({},i),{},{enabled:a,subscribe:c,queryKey:r,trpc:it({path:n})})};function _s(e){const t=e.keyPrefix,n=r=>(s,i,a)=>"router"in e?Promise.resolve(Ct(e.ctx)).then(c=>Ao({router:e.router,path:s,getRawInput:async()=>i,ctx:c,type:r,signal:void 0,batchIndex:0})):(e.client instanceof An?e.client:is(e.client))[r](s,i,a);return In(({args:r,path:s})=>{const i=[...s],a=i.pop(),[c,l]=r;return{"~types":void 0,pathKey:()=>pe({path:i,type:"any",prefix:t}),pathFilter:()=>L(L({},c),{},{queryKey:pe({path:i,type:"any",prefix:t})}),queryOptions:()=>bs({input:c,opts:l,path:i,queryClient:e.queryClient,queryKey:pe({path:i,input:c,type:"query",prefix:t}),query:n("query")}),queryKey:()=>pe({path:i,input:c,type:"query",prefix:t}),queryFilter:()=>L(L({},l),{},{queryKey:pe({path:i,input:c,type:"query",prefix:t})}),infiniteQueryOptions:()=>gs({input:c,opts:l,path:i,queryKey:pe({path:i,input:c,type:"infinite",prefix:t}),query:n("query")}),infiniteQueryKey:()=>pe({path:i,input:c,type:"infinite",prefix:t}),infiniteQueryFilter:()=>L(L({},l),{},{queryKey:pe({path:i,input:c,type:"infinite",prefix:t})}),mutationOptions:()=>{var u;return vs({opts:c,path:i,prefix:t,queryClient:e.queryClient,mutate:n("mutation"),overrides:(u=e.overrides)===null||u===void 0?void 0:u.mutations})},mutationKey:()=>Rn({path:i,prefix:t}),subscriptionOptions:()=>ws({opts:l,path:i,input:c,queryKey:pe({path:i,input:c,type:"any",prefix:t}),subscribe:n("subscription")})}[a]()})}function Es(){const e=he(null),t=he(null),n=i=>{const a=Ce(()=>_s({client:i.trpcClient,queryClient:i.queryClient,keyPrefix:i.keyPrefix}),[i.trpcClient,i.queryClient,i.keyPrefix]);return J(e.Provider,{value:i.trpcClient},J(t.Provider,{value:a},i.children))};n.displayName="TRPCProvider";function r(){const i=fe(t);if(!i)throw new Error("useTRPC() can only be used inside of a <TRPCProvider>");return i}function s(){const i=fe(e);if(!i)throw new Error("useTRPCClient() can only be used inside of a <TRPCProvider>");return i}return{TRPCProvider:n,useTRPC:r,useTRPCClient:s}}const vt={lan:new Set,animepahe:new Set,jasmr:new Set};function ke(e){for(const t of[...vt[e]])try{t()}catch(n){console.error(`auth-bus listener failed (${e}):`,n)}}function $n(e,t){return vt[e].add(t),()=>{vt[e].delete(t)}}let et="default";function qn(){return et}function Ss(e){et=e}const ks=new Set(["playerVideoDelayMs","playerVideoDelayEnabled","anime4kEnabled"]);function He(e){return et==="default"||ks.has(e)?e:`dango:profile:${et}:${e}`}const V={keyFor:He,getItem:e=>localStorage.getItem(He(e)),setItem:(e,t)=>localStorage.setItem(He(e),t),removeItem:e=>localStorage.removeItem(He(e))};function Ps(){localStorage.setItem("dango:profile-session-change",`${Date.now()}-${Math.random()}`),window.location.assign("/")}const Ts=(e,t)=>new Promise((n,r)=>{t?.throwIfAborted();const s=()=>{clearTimeout(i),r(t?.reason)},i=setTimeout(()=>{t?.removeEventListener("abort",s),n()},e);t?.addEventListener("abort",s,{once:!0})}),Ot=async(e,t)=>{const n=e instanceof Request?e:void 0,r=new Headers(n?.headers);(!t?.body||!(t.body instanceof FormData))&&r.set("Content-Type","application/json");const s=n?.url??e.toString(),i=s.startsWith("/")&&!s.startsWith("//")||typeof window<"u"&&new URL(s,window.location.origin).origin===window.location.origin;if(i){!s.includes("/api/profiles/status")&&!s.includes("/api/profiles/login")&&!s.includes("/api/auth/app-")&&r.set("x-dango-profile-id",qn());let h=V.getItem("animepahe_ua"),m=V.getItem("animepahe_cookie");m&&h&&h!==navigator.userAgent&&(V.removeItem("animepahe_cookie"),V.removeItem("animepahe_ua"),m=null,h=null,P.error("Your browser changed. Verify AnimePahe again to refresh its cookie."),ke("animepahe"));const f=V.getItem("jasmr_ua"),p=V.getItem("jasmr_cookie");h&&r.set("x-animepahe-ua",h),m&&r.set("x-animepahe-cookie",m),f&&r.set("x-jasmr-ua",f),p&&r.set("x-jasmr-cookie",p)}new Headers(t?.headers).forEach((h,m)=>r.set(m,h));const a={...t,headers:r},c=(t?.method??n?.method??"GET").toUpperCase(),l=t?.signal??n?.signal,u=i&&(c==="GET"||c==="HEAD");let d=await fetch(e,a);i&&d.status===409&&(await d.clone().json().catch(()=>null))?.error==="PROFILE_CHANGED"&&window.location.reload(),i&&d.status===401&&!s.includes("/api/profiles/")&&(await d.clone().json().catch(()=>null))?.error==="PROFILE_AUTH_REQUIRED"&&window.dispatchEvent(new Event("dango:profile-auth-required"));for(let h=0;u&&d.status===503&&d.headers.get("x-dango-not-ready")==="1"&&h<3;h++)await d.body?.cancel(),await Ts(500*2**h,l),d=await fetch(e,a);return d},$e=async(e,t)=>{const n=await Ot(e,t);if(!n.ok){const r=await n.text().catch(()=>"");let s={};try{s=JSON.parse(r)}catch{}const i=typeof s.error=="string"?s.error:"";throw n.status===403&&i==="AUTH_REQUIRED"&&s.provider==="animepahe"&&ke("animepahe"),n.status===403&&i==="AUTH_REQUIRED"&&s.provider==="jasmr"&&ke("jasmr"),n.status===401&&i==="LAN_AUTH_REQUIRED"&&ke("lan"),new Error(i||`Failed to fetch from ${e}`)}return n.json()};async function xs(e,t){const n=await Ot(e,t);if(n.status===401)try{(await n.clone().json())?.error==="LAN_AUTH_REQUIRED"&&ke("lan")}catch{}return await Is(n),n}async function Is(e){try{if(!e.headers.get("content-type")?.includes("json"))return;const t=await e.clone().json(),n=Array.isArray(t)?t:[t];for(const r of n){const s=r?.error;if(!s||typeof s!="object")continue;const i=s.data?.cause;(s.message==="AUTH_REQUIRED"||i?.code==="AUTH_REQUIRED")&&(i?.provider==="animepahe"||i?.provider==="jasmr")&&ke(i.provider),(s.message==="LAN_AUTH_REQUIRED"||i?.code==="LAN_AUTH_REQUIRED")&&ke("lan")}}catch{}}const{TRPCProvider:Ns,useTRPC:q}=Es(),ae=ss({links:[Go({url:"/api/trpc",fetch:xs})]}),Oe=new Map,Cs=500,Os=(e,t,n)=>{if(!e||e.trim()==="")return"/placeholder.svg";if(e.includes("/api/image-proxy")){let a=e;if(t&&!a.includes("w=")){const c=a.includes("?")?"&":"?";a+=`${c}w=${t}`}if(n&&!a.includes("h=")){const c=a.includes("?")?"&":"?";a+=`${c}h=${n}`}return a}let r=e;r.includes("aln.youtube-anime.com")&&(r=r.replace(/https?:\/\/allanime\.day\/aln\.youtube-anime\.com/,"https://aln.youtube-anime.com"),r.includes("/images/mcovers")&&(r=r.replace("/images/mcovers","/mcovers")),r.includes("/images/images2")&&(r=r.replace("/images/images2","/images2"))),r.includes("allanime.day/s4.anilist.co")&&(r=r.replace(/https?:\/\/allanime\.day\/s4\.anilist\.co/,"https://s4.anilist.co")),r.includes("wp.youtube-anime.com/s4.anilist.co")&&(r=r.replace(/https?:\/\/wp\.youtube-anime\.com\/s4\.anilist\.co/,"https://s4.anilist.co"));const s=`${r}-${t}-${n}`;if(Oe.has(s))return Oe.get(s);let i;if(r.startsWith("https://s4.anilist.co"))i=r,t&&(i+=`${i.includes("?")?"&":"?"}w=${t}`),n&&(i+=`${i.includes("?")?"&":"?"}h=${n}`);else if(r.includes("animepahe")){i=`/api/image-proxy?url=${encodeURIComponent(r)}`;const a=V.getItem("animepahe_cookie"),c=V.getItem("animepahe_ua");a&&(i+=`&cookie=${encodeURIComponent(a)}`),c&&(i+=`&ua=${encodeURIComponent(c)}`)}else if(r.startsWith("http"))i=`/api/image-proxy?url=${encodeURIComponent(r)}`,t&&(i+=`&w=${t}`),n?i+=`&h=${n}`:t||(i+="&w=300");else{const c=`${r.startsWith("mcovers")||r.startsWith("images2")?"https://aln.youtube-anime.com":"https://aln.youtube-anime.com/images"}/${r}`;i=`/api/image-proxy?url=${encodeURIComponent(c)}`,t&&(i+=`&w=${t}`),n?i+=`&h=${n}`:t||(i+="&w=300")}return Oe.size>Cs&&Oe.clear(),Oe.set(s,i),i},Vl=e=>{if(isNaN(e)||e<=0)return"00:00";const t=new Date(e*1e3).toISOString().slice(11,19);return parseInt(t.slice(0,2),10)>0?t:t.slice(3)};function zl(e){return e?e.replace(/<[^>]*>?/gm,"").replace(/&nbsp;/g," ").replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").trim():""}function Gl(e){return e==null?e:e>10?Number((e/10).toFixed(1)):e}const As=(...e)=>e.filter(Boolean).join(" ");function Ls(e,t,n="..."){return e?e.length>t?e.slice(0,t)+n:e:""}const Dn=he(void 0),Rs=()=>{const e=fe(Dn);if(e===void 0)throw new Error("useTitlePreference must be used within a TitlePreferenceProvider");return e},$={watchlist:"watchlist",continueWatching:"allContinueWatching",queueRemaining:"queue-remaining",suggestedEpisode:"suggestedEpisode",trendingList:"trendingList",latestReleases:"latestReleases",thisWeekSchedule:"thisWeekSchedule",schedule:"schedule",genreCards:"genreCards",queue:"queue",playerData:"player-data",showData:"show-data",showMeta:"show-meta",videoSources:"video-sources",tvSources:"tv-sources",tvLibrary:"tv-library",tvContinueWatching:"tv-continue-watching",tvProgress:"tv-progress",mangaLibrary:"manga-library",mangaContinueReading:"manga-continue-reading",mangaProgress:"manga-progress",mangaBrowse:"mangaBrowse",mangaBrowseInfinite:"mangaBrowseInfinite",mangaDetail:"mangaDetail",mangaPages:"mangaPages",asmrLibrary:"asmr-library",asmrContinueListening:"asmr-continue-listening",asmrProgress:"asmr-progress",asmrBrowse:"asmrBrowse",asmrWork:"asmrWork",trackerStatus:"trackerStatus",anilistClientId:"anilistClientId",malClientConfig:"malClientConfig",notifications:"notifications",settings:"settings",insights:"insights",insightsRecommendations:"insights-recommendations",providers:"providers",syncProfile:"sync-profile"},Jl=()=>{const e=q(),t=ne({...e.data.spotlight.queryOptions(),staleTime:1e3*60*5,retry:1});return{...t,data:t.data}},Yl=(e="TRENDING_DESC",t=10)=>xt({queryKey:[$.trendingList,e,t],queryFn:({pageParam:n=1})=>ae.data.popularList.query({sort:e,page:n,size:t}),initialPageParam:1,getNextPageParam:(n,r)=>n.length>=t?r.length+1:void 0}),Zl=(e="TV",t=12)=>xt({queryKey:[$.latestReleases,e,t],queryFn:({pageParam:n=1})=>ae.data.latestReleases.query({format:e,page:n,size:t}),initialPageParam:1,getNextPageParam:(n,r)=>n.length>=t?r.length+1:void 0}),Xl=(e,t="TV",n=!0)=>{const r=q();return ne({...r.data.seasonal.queryOptions({page:e,format:t}),enabled:n,staleTime:1e3*60*5})},$s=["query","sortBy","type","status","season","year","country","genres","excludeGenres","excludeTags","minScore","minEpisodes","adult"],eu=(e,t,n=14)=>{const r=q(),s=new URLSearchParams(e),i={page:t,limit:n};for(const a of $s){const c=s.get(a);c!==null&&(i[a]=c)}return ne({...r.data.search.queryOptions(i),enabled:e!=null})},tu=()=>{const e=q();return ne(e.queue.list.queryOptions())},qs=()=>{const e=q(),t=Z();return ie(e.queue.add.mutationOptions({onSuccess:n=>{n.queued?P.success("Added to queue"):P.success("Removed from queue"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[$.queueRemaining]})},onError:n=>{P.error(`Failed to update queue: ${n.message}`)}}))},nu=()=>{const e=q(),t=Z();return ie(e.queue.remove.mutationOptions({onSuccess:()=>{P.success("Removed from queue"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[$.queueRemaining]}),t.invalidateQueries({queryKey:[$.continueWatching]})},onError:n=>{P.error(`Failed to remove: ${n.message}`)}}))},ru=(e,t=!0)=>ne({queryKey:[$.queueRemaining,e],queryFn:()=>ae.watchlist.queueRemaining.query({showId:e}),enabled:!!e&&t,staleTime:1e3*60}),ou=()=>{const e=q(),t=Z();return ie(e.queue.addBatch.mutationOptions({onSuccess:(n,r)=>{const s=n.added??r.episodeNumbers.length;P.success(`${s} ${s===1?"episode":"episodes"} added to queue`),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[$.queueRemaining]})},onError:n=>{P.error(`Failed to update queue: ${n.message}`)}}))},su=()=>{const e=q(),t=Z();return ie(e.queue.removeMany.mutationOptions({onSuccess:()=>{P.success("Removed from queue"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[$.queueRemaining]}),t.invalidateQueries({queryKey:[$.continueWatching]})},onError:n=>{P.error(`Failed to remove: ${n.message}`)}}))},iu=()=>{const e=q(),t=Z();return ie(e.queue.clear.mutationOptions({onSuccess:()=>{P.success("Queue cleared"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[$.queueRemaining]}),t.invalidateQueries({queryKey:[$.continueWatching]})},onError:n=>{P.error(`Failed to clear queue: ${n.message}`)}}))},au=()=>{const e=q(),t=Z(),n=e.queue.list.queryOptions().queryKey;return ie(e.queue.reorder.mutationOptions({onMutate:async r=>{await t.cancelQueries({queryKey:n});const s=t.getQueryData(n);return t.setQueryData(n,i=>{if(!i)return i;const a=new Map(i.map(c=>[c.id,c]));return r.map((c,l)=>{const u=a.get(c.id??-1);return u?{...u,queue_order:l}:void 0}).filter(c=>!!c)}),{previousQueue:s}},onError:(r,s,i)=>{i?.previousQueue&&t.setQueryData(n,i.previousQueue)},onSettled:()=>{t.invalidateQueries(e.queue.pathFilter())}}))},Ds=["status","showMature","query","type","season","year","genres","excludeGenres","sortBy","titlePreference"];function At(e,t,n){const r=new URLSearchParams(e),s={page:t,limit:n};for(const i of Ds){const a=r.get(i);a!==null&&(s[i]=a)}return s}const cu=(e,t="",n,r=14)=>ne({queryKey:[$.watchlist,e,t,n,r],queryFn:async()=>{const s=new URLSearchParams(t);return s.set("status",e),await ae.watchlist.list.query(At(s.toString(),n,r))}}),lu=(e="")=>xt({queryKey:[$.continueWatching,e],queryFn:async({pageParam:t=1})=>await ae.watchlist.continueWatchingAll.query(At(e,t,14)),initialPageParam:1,getNextPageParam:t=>{if(!(t.data.length===0||t.page*t.limit>=t.total))return t.page+1},select:t=>({...t,pages:t.pages.flatMap(n=>n.data)})}),uu=(e="",t,n=14)=>ne({queryKey:[$.continueWatching,e,t,n],queryFn:async()=>await ae.watchlist.continueWatchingAll.query(At(e,t,n))}),du=()=>{const e=q(),t=Z();return ie(e.watchlist.remove.mutationOptions({onSuccess:()=>{P.success("Removed from watchlist"),t.invalidateQueries(e.watchlist.pathFilter()),t.invalidateQueries({queryKey:[$.watchlist]})},onError:n=>{P.error(`Failed to remove: ${n.message}`)}}))},mu=()=>{const e=q(),t=Z();return ie(e.watchlist.batchStatus.mutationOptions({onSuccess:n=>{P.success(`Status updated for ${n.updated??0} items`),t.invalidateQueries(e.watchlist.pathFilter()),t.invalidateQueries({queryKey:[$.watchlist]}),t.invalidateQueries({queryKey:[$.continueWatching]})},onError:n=>{P.error(`Failed to update statuses: ${n.message}`)}}))},hu=()=>{const e=q(),t=Z();return ie(e.watchlist.removeMany.mutationOptions({onSuccess:n=>{const r=n.removed??0;P.success(`Removed ${r} ${r===1?"item":"items"} from watchlist`),t.invalidateQueries(e.watchlist.pathFilter()),t.invalidateQueries({queryKey:[$.watchlist]}),t.invalidateQueries({queryKey:[$.continueWatching]})},onError:n=>{P.error(`Failed to remove: ${n.message}`)}}))},fu=()=>{const e=q(),t=Z();return ie(e.continueWatching.removeMany.mutationOptions({onSuccess:n=>{const r=n.removed??0;P.success(`Removed ${r} ${r===1?"item":"items"} from continue watching`),t.invalidateQueries(e.continueWatching.pathFilter()),t.invalidateQueries({queryKey:[$.continueWatching]})},onError:n=>{P.error(`Failed to remove: ${n.message}`)}}))},jn=(e=!0)=>{const t=q();return ne({...t.notifications.list.queryOptions(),enabled:e,refetchInterval:3e4})},Mn=(e=!0)=>{const t=q();return ne({...t.data.systemNotifications.queryOptions(),enabled:e,refetchInterval:3e4})},Fn=(e=!0)=>{const t=q();return ne({...t.discovery.status.queryOptions(),enabled:e,refetchInterval:n=>n.state.data?.running?2e3:!1})},js=()=>{const e=q(),t=Z(),n=e.discovery.status.queryOptions().queryKey;return ie(e.discovery.refresh.mutationOptions({onSuccess:r=>{t.setQueryData(n,{running:r.running,state:r.state,total:r.total,done:r.done,lastRunAt:r.lastRunAt}),t.invalidateQueries(e.notifications.pathFilter()),t.invalidateQueries({queryKey:[$.notifications]})},onError:()=>{t.invalidateQueries({queryKey:n})}}))},Ms=()=>{const e=q(),t=Z();return ie(e.notifications.dismiss.mutationOptions({onSuccess:()=>{t.invalidateQueries(e.notifications.pathFilter())}}))},Fs=()=>{const e=q(),t=Z();return ie(e.notifications.clearAll.mutationOptions({onSuccess:()=>{t.invalidateQueries(e.notifications.pathFilter())}}))},pu=()=>{const e=q();return ne({...e.continueWatching.thisWeek.queryOptions(),staleTime:1e3*60*5})},yu=()=>{const e=q();return ne({...e.data.genresAndTags.queryOptions(),staleTime:1e3*60*60})},gu=()=>ne({queryKey:[$.genreCards],queryFn:()=>ae.insights.genreCards.query()}),Ws="_container_s4ah4_1",Bs="_bellBtn_s4ah4_7",Us="_badge_s4ah4_56",Hs="_dropdown_s4ah4_96",Ks="_dropdownHeader_s4ah4_127",Qs="_clearAllBtn_s4ah4_141",Vs="_discoveryStatusRow_s4ah4_159",zs="_statusDot_s4ah4_170",Gs="_statusDotRunning_s4ah4_177",Js="_statusDotOk_s4ah4_182",Ys="_statusDotInfo_s4ah4_186",Zs="_statusDotError_s4ah4_190",Xs="_statusDotIdle_s4ah4_194",ei="_list_s4ah4_208",ti="_item_s4ah4_222",ni="_thumbnail_s4ah4_237",ri="_itemInfo_s4ah4_246",oi="_itemTitle_s4ah4_251",si="_itemMeta_s4ah4_262",ii="_systemItemMeta_s4ah4_272",ai="_removeItem_s4ah4_289",ci="_queueItem_s4ah4_319",li="_emptyState_s4ah4_323",ui="_notificationDivider_s4ah4_371",E={container:Ws,bellBtn:Bs,badge:Us,dropdown:Hs,dropdownHeader:Ks,clearAllBtn:Qs,discoveryStatusRow:Vs,statusDot:zs,statusDotRunning:Gs,statusDotOk:Js,statusDotInfo:Ys,statusDotError:Zs,statusDotIdle:Xs,list:ei,item:ti,thumbnail:ni,itemInfo:ri,itemTitle:oi,itemMeta:si,systemItemMeta:ii,removeItem:ai,queueItem:ci,emptyState:li,notificationDivider:ui},di=({notification:e})=>{const t=Ms(),n=qs(),[r,s]=Pt.useState(!1),i=d=>{d.preventDefault(),d.stopPropagation(),t.mutate({showId:e.showId,episodeNumber:e.episodeNumber})},a=()=>{t.mutate({showId:e.showId,episodeNumber:e.episodeNumber})},c=d=>{d.preventDefault(),d.stopPropagation(),s(!0),n.mutate({showId:e.showId,episodeNumber:e.episodeNumber,showName:e.name,showThumbnail:e.thumbnail,nativeName:e.nativeName,englishName:e.englishName}),t.mutate({showId:e.showId,episodeNumber:e.episodeNumber}),window.setTimeout(()=>s(!1),1e3)},{titlePreference:l}=Rs(),u=l==="nativeName"?e.nativeName||e.name:l==="englishName"&&e.englishName||e.name;return o(se,{to:`/watch/${e.showId}/${e.episodeNumber}`,className:E.item,onClick:a,children:[o("img",{src:Os(e.thumbnail,48,64),alt:e.name,className:E.thumbnail,loading:"lazy",decoding:"async"}),o("div",{className:E.itemInfo,children:[o("span",{className:E.itemTitle,children:u}),o("span",{className:E.itemMeta,children:["New Episode ",e.episodeNumber]})]}),o("button",{className:`${E.removeItem} ${E.queueItem}`,onClick:c,"aria-label":"Add notification to queue",children:r?o(N,{name:"check"}):o(N,{name:"plus"})}),o("button",{className:E.removeItem,onClick:i,"aria-label":"Remove notification",children:o(N,{name:"times"})})]})};function lt({width:e="100%",height:t="1em",variant:n="rectangular",className:r="",style:s}){return o("div",{className:`skeleton skeleton-${n} ${r}`,style:{width:e,height:t,...s}})}const mi=({count:e=3})=>o(Y,{children:Array.from({length:e}).map((t,n)=>o("div",{className:E.item,style:{borderBottom:"1px solid var(--border-primary)",pointerEvents:"none"},children:[o("div",{className:E.thumbnail,style:{overflow:"hidden"},children:o(lt,{width:"100%",height:"100%",variant:"rectangular"})}),o("div",{className:E.itemInfo,children:[o(lt,{width:"80%",height:"1rem",variant:"text",style:{marginBottom:"4px"}}),o(lt,{width:"40%",height:"0.7rem",variant:"rectangular",style:{borderRadius:"var(--radius-sm)"}})]})]},n))}),hi=()=>{const{data:e=[],isLoading:t}=jn(),{data:n=[]}=Mn(),{data:r}=Fn(),s=Fs(),i=Z(),[a,c]=v(null);w(()=>{i.invalidateQueries({queryKey:[$.notifications]})},[i]);const l=()=>{s.mutate(void 0)},u=n.find(d=>d.id===a)??null;return o("div",{className:E.dropdown,children:[o("div",{className:E.dropdownHeader,children:[o("h4",{children:"Notifications"}),e.length>0&&o("button",{className:E.clearAllBtn,onClick:l,children:"Clear All"})]}),o("div",{className:E.discoveryStatusRow,children:r?.running?o(Y,{children:[o("span",{className:`${E.statusDot} ${E.statusDotRunning}`,"aria-hidden":"true"}),o("span",{children:r.total>0?`Checking ${Math.min(r.done,r.total)}/${r.total} shows...`:"Checking for new episodes..."})]}):r?.state==="complete"?o(Y,{children:[o("span",{className:`${E.statusDot} ${E.statusDotOk}`,"aria-hidden":"true"}),o("span",{children:["Discovery complete - checked ",r.total," ",r.total===1?"show":"shows"]})]}):r?.state==="empty"?o(Y,{children:[o("span",{className:`${E.statusDot} ${E.statusDotInfo}`,"aria-hidden":"true"}),o("span",{children:"No shows set to Watching - nothing to check"})]}):r?.state==="error"?o(Y,{children:[o("span",{className:`${E.statusDot} ${E.statusDotError}`,"aria-hidden":"true"}),o("span",{children:"Last check failed - will retry automatically"})]}):o(Y,{children:[o("span",{className:`${E.statusDot} ${E.statusDotIdle}`,"aria-hidden":"true"}),o("span",{children:r?.lastRunAt?`Last checked ${Math.max(1,Math.round((Date.now()-r.lastRunAt)/1e3))}s ago`:"Auto-checks every few minutes"})]})}),o("div",{className:E.list,children:t&&n.length===0?o(mi,{count:4}):o(Y,{children:[n.map(d=>o("div",{className:E.item,children:[o("div",{className:E.thumbnail,style:{background:"transparent",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:0,boxShadow:"none"},children:o(N,{name:"info-circle",size:32,color:"#6c9fff"})}),o("div",{className:E.itemInfo,children:[o("span",{className:E.itemTitle,children:d.title}),o("button",{type:"button",className:E.systemItemMeta,onClick:()=>c(d.id),title:"View full status",children:Ls(d.message,40,"…")})]}),o("button",{className:E.removeItem,disabled:!0,style:{opacity:.3,cursor:"not-allowed"},"aria-hidden":"true",children:o(N,{name:"plus"})}),o("button",{className:E.removeItem,disabled:!0,style:{opacity:.3,cursor:"not-allowed"},"aria-hidden":"true",children:o(N,{name:"times"})})]},d.id)),n.length>0&&e.length>0&&o("div",{className:E.notificationDivider}),e.length>0?e.map(d=>o(di,{notification:d},d.id)):!t&&n.length===0&&o("div",{className:E.emptyState,children:"No new notifications"})]})}),u&&Tt(o("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0, 0, 0, 0.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:9999,padding:"1rem",backdropFilter:"blur(3px)"},onClick:()=>c(null),children:o("div",{style:{backgroundColor:"var(--bg-secondary)",padding:"1.5rem",borderRadius:"var(--radius-lg)",maxWidth:"420px",width:"100%",boxShadow:"var(--shadow-xl)",border:"1px solid var(--border-primary)"},onClick:d=>d.stopPropagation(),children:[o("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem",marginBottom:"1rem"},children:[o(N,{name:"info-circle",color:"#6c9fff"}),o("span",{style:{color:"#fff",fontWeight:600,fontSize:"1rem"},children:u.title})]}),o("p",{style:{color:"var(--text-secondary)",marginBottom:"1.5rem",lineHeight:1.5},children:u.message}),o("div",{style:{display:"flex",justifyContent:"flex-end"},children:o("button",{type:"button",onClick:()=>c(null),style:{background:"var(--accent)",color:"#fff",border:"none",padding:"0.5rem 1rem",borderRadius:"var(--radius-md)",cursor:"pointer",fontWeight:600},children:"OK"})})]})}),document.body)]})},fi=()=>{const[e,t]=v(!1),n=U(null),r=Z(),s=q(),i=js(),{data:a=[]}=jn(),{data:c=[]}=Mn(),{data:l}=Fn(),u=a.length+c.length,d=u>5?"5+":u,h=U(!1);w(()=>{const f=p=>{n.current&&!n.current.contains(p.target)&&t(!1)};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[]),w(()=>{const f=!!l?.running;h.current&&!f&&(r.invalidateQueries(s.notifications.pathFilter()),r.invalidateQueries(s.discovery.pathFilter())),h.current=f},[l?.running,r,s]);const m=()=>{const f=!e;t(f),f&&i.mutate()};return o("div",{className:E.container,ref:n,children:[o("button",{className:E.bellBtn,onClick:m,"aria-label":"Notifications",children:[o(N,{name:"bell"}),u>0&&o("span",{className:E.badge,children:d})]}),e&&o(hi,{})]})},at=e=>{const t=q();return ne({...t.settings.getByKey.queryOptions({key:e}),select:n=>n.value})},Wn=()=>{const e=q(),t=Z();return ie(e.settings.set.mutationOptions({onSuccess:()=>{P.success("Setting updated!"),t.invalidateQueries(e.settings.pathFilter()),t.invalidateQueries({queryKey:[$.settings]})},onError:n=>{P.error(`Failed to update setting: ${n.message}`)}}))},Bn=he(void 0),pi=()=>{const e=fe(Bn);if(e===void 0)throw new Error("useLowEndMode must be used within a LowEndModeProvider");return e},me={x:-2.8,y:-2,w:48.6,h:14},bt=15,Ne={w:13.6,h:10.2},ye=[{x:0,y:.5},{x:bt,y:-.9},{x:bt*2,y:.3}],Jt={x:Ne.w/2,y:Ne.h/2-.5},ut={y:Ne.h/2,x1:-2,x2:bt*2+Ne.w+1.4},Yt=(e,t,n,r=0)=>{if(n.width<=0)return-1;const s=n.width/me.w,i=(e-n.left)/s+me.x,a=(t-n.top)/s+me.y;for(let c=0;c<ye.length;c++){const l=i-ye[c].x,u=a-ye[c].y;if(l>=-r&&l<=Ne.w+r&&u>=-r&&u<=Ne.h+r)return c}return-1},Zt=7.5,Xt=e=>Math.max(-1,Math.min(1,e)),yi=(e,t,n,r)=>{const s=n.width/me.w,i=(e-n.left)/s+me.x-r.x-Jt.x,a=(t-n.top)/s+me.y-r.y-Jt.y;return{x:Xt(i/Zt),y:Xt(a/Zt)}},gi=["normal","squint"],vi={normal:.72,squint:.28},en=(e=Math.random(),t)=>{let n=0;for(const r of gi)if(n+=vi[r],e<n)return r===t?r==="normal"?"squint":"normal":r;return"normal"},bi="pet",wi="sleep",_i=6e3,Ei=420,Si=.5,tn=3e3,ki=3e3,Pi=ye.map((e,t)=>t*260),dt={from:ye.length-2,to:ye.length-1,after:400},nn="data-dango-face",mt="data-dango-hover",ht="data-dango-cheer",rn="data-dango-nudge",Ti=()=>document.querySelectorAll("svg[data-dango-gaze-origin]"),Ke=()=>document.querySelectorAll("[data-dango-face-slot]"),xi=e=>e.querySelectorAll("[data-dango-eye]"),Ii=()=>document.querySelectorAll("[data-dango-eye]"),Un=()=>{const{data:e}=at("dangoGaze"),{lowEndMode:t}=pi();return e!=="false"&&!t},Ni=()=>{const e=Un();w(()=>{if(!e||window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;const t=ye.map(()=>"normal");let n=-1,r=-1,s=!1,i=-1,a=0,c=0,l=0,u=0,d=0;const h=[],m=(b,I)=>{const k=window.setTimeout(()=>{h.splice(h.indexOf(k),1),b()},I);h.push(k)},f=(b,I,k)=>{Ke().forEach(D=>{Number(D.getAttribute("data-dango-face-slot"))===b&&(k?D.setAttribute(I,""):D.removeAttribute(I))})},p=b=>Ke().forEach(I=>I.removeAttribute(b)),_=(b,I,k)=>{p(I),requestAnimationFrame(()=>{f(b,I,!0),m(()=>p(I),k)})},x=()=>{Ke().forEach(b=>{const I=Number(b.getAttribute("data-dango-face-slot"));b.setAttribute(nn,r===I?bi:t[I]),n===I?b.setAttribute(mt,""):b.removeAttribute(mt)})},S=b=>{b!==r&&(r>=0&&f(r,ht,!1),r=b,b>=0&&f(b,ht,!0))},y=()=>{window.clearTimeout(d),d=window.setTimeout(()=>{S(-1),x()},Ei)},g=()=>{window.clearTimeout(d),S(-1)},T=()=>{s=!1,Pi.forEach((b,I)=>{m(()=>{t[I]=en(),I===dt.from&&m(()=>_(dt.to,rn,520),dt.after),x()},b)})},z=()=>{s=!0,t.fill(wi),g(),x()},X=()=>{window.clearTimeout(u),u=window.setTimeout(z,_i)},ve=()=>{s||(i=(i+1)%t.length,t[i]=en(Math.random(),t[i]),x()),m(ve,tn+Math.random()*ki)},C=()=>{const b=Array.from(Ti(),O=>[O,O.getBoundingClientRect()]);b.forEach(([O,ce])=>{xi(O).forEach(Te=>{const{x:le,y:Se}=yi(c,l,ce,ye[Number(Te.getAttribute("data-dango-eye"))]);Te.style.setProperty("--dango-gaze-x",le.toFixed(3)),Te.style.setProperty("--dango-gaze-y",Se.toFixed(3))})});const I=b.find(([,O])=>c>=O.left&&c<=O.right&&l>=O.top&&l<=O.bottom)?.[1]??null,k=n,D=r,W=I?Yt(c,l,I):-1,oe=W>=0?W:I?Yt(c,l,I,Si):-1;n=W,oe>=0?(S(oe),y()):g(),(k!==n||D!==r)&&x(),s&&T(),X()},re=b=>{c=b.clientX,l=b.clientY,!a&&(a=requestAnimationFrame(()=>{a=0,C()}))},G=b=>{b.relatedTarget||(n=-1,g(),x(),X())};return x(),X(),m(ve,tn),window.addEventListener("pointermove",re,{passive:!0}),window.addEventListener("pointerout",G),()=>{cancelAnimationFrame(a),window.clearTimeout(u),window.clearTimeout(d),h.forEach(window.clearTimeout),window.removeEventListener("pointermove",re),window.removeEventListener("pointerout",G),Ii().forEach(b=>{b.style.removeProperty("--dango-gaze-x"),b.style.removeProperty("--dango-gaze-y")}),Ke().forEach(b=>{b.setAttribute(nn,"normal"),b.removeAttribute(mt),b.removeAttribute(ht),b.removeAttribute(rn)})}},[e])},Hn=he(void 0),vu=()=>{const e=fe(Hn);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e},bu=[{id:"iris",label:"Taro (default)",blurb:"Deep purple",swatch:"#7d6df0"},{id:"sakura",label:"Sakura",blurb:"Soft pink",swatch:"#e0b0e0"},{id:"mochi",label:"Mochi",blurb:"Monochrome pearl",swatch:"#f0f0f0"}],Ci={iris:{fill:"#897cff",stroke:"#5646db"},mochi:{fill:"#e3e1ee",stroke:"#b3b1c6"},sakura:{fill:"#e1afef",stroke:"#a978a9"}},Oi="_logo_t3il2_1",Ai="_skewer_t3il2_8",Li="_gaze_t3il2_15",Ri="_face_t3il2_20",$i="_faceNormal_t3il2_25",qi="_facePet_t3il2_26",Di="_faceSquint_t3il2_27",ji="_faceSleep_t3il2_28",Mi="_line_t3il2_36",Fi="_sway_t3il2_44",Wi="_weight_t3il2_58",Bi="_shift_t3il2_73",Ui="_rock_t3il2_87",Hi="_glance_t3il2_105",Ki="_blinkDouble_t3il2_129 _blink_t3il2_124",Qi="_blinkSlow_t3il2_153 _blink_t3il2_124",Vi="_bump_t3il2_172",zi="_heart_t3il2_189",B={logo:Oi,skewer:Ai,gaze:Li,face:Ri,faceNormal:$i,facePet:qi,faceSquint:Di,faceSleep:ji,line:Mi,sway:Fi,weight:Wi,shift:Bi,rock:Ui,glance:Hi,blinkDouble:Ki,blinkSlow:Qi,bump:Vi,heart:zi},on="var(--logo-ink)",Gi="m 7,0 c -3.9372984,0 -7.10030437,2.4883888 -7,6 0.13572675,4.751733 5.0802847,4.156395 7,4.156395 1.2538994,0 6.530451,0.392468 6.584946,-4.168088 C 13.622023,2.8853946 10.937298,0 7,0 Z",Ji="m 4.9623825,3.416 c -0.5858889,0 -0.6520292,2.3368563 -0.024765,2.3368563 0.6604959,0 0.6704653,-2.3368563 0.024765,-2.3368563 z",Yi="M 8.588001,3.416 C 8.0021121,3.416 7.9359718,5.7528563 8.563236,5.7528563 9.2237319,5.7528563 9.2337013,3.416 8.588001,3.416 Z",Zi={pet:"M 4.85,5.15 Q 5.285,4.0 5.72,5.15 M 8.25,5.15 Q 8.618,4.0 8.99,5.15",squint:"M 4.82,3.9 L 5.6,4.62 L 4.82,5.34 M 9.08,3.9 L 8.3,4.62 L 9.08,5.34",sleep:"M 4.9,4.72 Q 5.285,5.28 5.67,4.72 M 8.25,4.72 Q 8.618,5.28 9.0,4.72"},Kn=[{lag:.8,hue:"iris",blink:"double",motion:"weight",glances:!1},{lag:1.4,hue:"sakura",blink:"slow",motion:"shift",glances:!1},{lag:1,hue:"mochi",blink:"slow",motion:"rock",glances:!0}],Ae=(e,t)=>e+Math.random()*(t-e),Xi=Kn.map(()=>({blinkDelay:-Ae(0,9),blinkDuration:Ae(3.4,8.6),motionDelay:-Ae(0,9),motionDuration:Ae(5.5,11),glanceDelay:-Ae(0,11)})),ea={double:B.blinkDouble,slow:B.blinkSlow},ta={weight:B.weight,shift:B.shift,rock:B.rock},na={normal:B.faceNormal,pet:B.facePet,squint:B.faceSquint,sleep:B.faceSleep},ra=["normal","pet","squint","sleep"],oa=[{x:7,y:4.2,delay:0,drift:"0px"},{x:9.6,y:6.4,delay:-.3,drift:"-0.9px"},{x:4.6,y:6.1,delay:-.6,drift:"0.8px"},{x:8.2,y:3.4,delay:-.9,drift:"-0.4px"}],Lt=({className:e})=>{const t=Un();return o("svg",{viewBox:`${me.x} ${me.y} ${me.w} ${me.h}`,className:e?`${B.logo} ${e}`:B.logo,role:"img","aria-label":"dango","data-dango-gaze-origin":"",children:o("g",{className:t?B.sway:void 0,children:[o("path",{className:B.skewer,d:`M ${ut.x1},${ut.y} H ${ut.x2}`}),Kn.map((n,r)=>{const{x:s,y:i}=ye[r],a=Xi[r],{fill:c,stroke:l}=Ci[n.hue],u=o("g",{"data-dango-eye":r,className:B.gaze,style:{"--gaze-dur":`${(.12+n.lag*.18).toFixed(3)}s`},children:ra.map(d=>o("g",{className:`${B.face} ${na[d]}`,children:o("g",{className:t&&d==="normal"?ea[n.blink]:void 0,style:t&&d==="normal"?{animationDelay:`${a.blinkDelay}s`,animationDuration:`${a.blinkDuration}s`}:void 0,children:d==="normal"?o(Y,{children:[o("path",{fill:on,d:Ji}),o("path",{fill:on,d:Yi})]}):o("path",{className:B.line,d:Zi[d]})})},d))});return o("g",{transform:`translate(${s} ${i})`,children:o("g",{"data-dango-face-slot":r,"data-dango-face":"normal",className:t?ta[n.motion]:void 0,style:t?{animationDelay:`${a.motionDelay}s`,animationDuration:`${a.motionDuration}s`}:void 0,children:[o("path",{fill:c,stroke:l,strokeWidth:"0.9",strokeLinejoin:"round",paintOrder:"stroke fill",d:Gi}),o("g",{className:B.bump,children:[t&&n.glances?o("g",{className:B.glance,style:{animationDelay:`${a.glanceDelay}s`},children:u}):u,t&&o("g",{children:oa.map(d=>o("text",{className:B.heart,x:d.x,y:d.y,fill:"var(--color-danger)",style:{"--drift":d.drift,animationDelay:`${d.delay}s`},children:"♥"},d.x))})]})]})},n.hue)})]})})},Qn=he(void 0),Rt=()=>{const e=fe(Qn);if(e===void 0)throw new Error("useSidebar must be used within a SidebarProvider");return e},Vn=he(void 0),zn=()=>{const e=fe(Vn);if(e===void 0)throw new Error("useContentType must be used within a ContentTypeProvider");return e},wt="virtual-keyboard:hide",sn="virtual-keyboard:enabled-change",Gn="virtual_keyboard_enabled",sa=!1;function an(){const e=V.getItem(Gn);return e===null?sa:e==="true"}const cn=e=>e instanceof HTMLInputElement&&e.type==="text"&&!e.disabled&&!e.readOnly;function ia(){window.dispatchEvent(new CustomEvent(wt))}function aa(){const[e,t]=v(!1),[n,r]=v(an),s=U(null);return w(()=>{const i=d=>{n&&cn(d.target)&&(s.current=d.target,t(!0))},a=d=>{d.target===s.current&&window.setTimeout(()=>{if(cn(document.activeElement)){s.current=document.activeElement,t(!0);return}s.current=null,t(!1)},0)},c=()=>{s.current=null,t(!1)},l=d=>{if(d.key!==Gn)return;const h=d.newValue==="true";r(h),h||c()},u=()=>{const d=an();r(d),d||c()};return document.addEventListener("focusin",i),document.addEventListener("focusout",a),window.addEventListener(wt,c),window.addEventListener("storage",l),window.addEventListener(sn,u),()=>{document.removeEventListener("focusin",i),document.removeEventListener("focusout",a),window.removeEventListener(wt,c),window.removeEventListener("storage",l),window.removeEventListener(sn,u)}},[n]),{activeInputRef:s,isVisible:n&&e,hide:()=>t(!1)}}const ca={queryKey:[$.syncProfile],queryFn:()=>$e("/api/profiles/current"),staleTime:3e4};function Jn({image:e,name:t}){const[n,r]=v(!1);return w(()=>r(!1),[e]),e&&!n?o("img",{src:e,alt:t,referrerPolicy:"no-referrer",onError:()=>r(!0),style:{width:"100%",height:"100%",maxWidth:72,maxHeight:72,aspectRatio:"1",objectFit:"cover",borderRadius:"50%"}}):o("svg",{viewBox:"0 0 24 24",role:"img","aria-label":t,style:{width:"100%",height:"100%",maxWidth:72,maxHeight:72,aspectRatio:"1"},fill:"currentColor",children:[o("circle",{cx:"12",cy:"8",r:"4"}),o("path",{d:"M4 21v-2a8 8 0 0 1 16 0v2z"})]})}const la="_header_ax9ih_1",ua="_hidden_ax9ih_21",da="_scrolled_ax9ih_25",ma="_logo_ax9ih_33",ha="_headerInner_ax9ih_46",fa="_leftSection_ax9ih_56",pa="_desktopNav_ax9ih_62",ya="_navLink_ax9ih_69",ga="_navLinkActive_ax9ih_85",va="_rightSection_ax9ih_104",ba="_searchWrapper_ax9ih_110",wa="_searchInput_ax9ih_116",_a="_searchButton_ax9ih_146",Ea="_searchIcon_ax9ih_170",Sa="_profileBtn_ax9ih_180",ka="_profileAvatar_ax9ih_215",Pa="_profileName_ax9ih_222",Ta="_hamburgerBtn_ax9ih_231",xa="_mobileSearchBar_ax9ih_258",Ia="_mobileSearchBarHidden_ax9ih_285",Na="_mobileSearchInner_ax9ih_302",Ca="_mobileSearchIcon_ax9ih_318",Oa="_mobileSearchInput_ax9ih_325",A={header:la,hidden:ua,scrolled:da,logo:ma,headerInner:ha,leftSection:fa,desktopNav:pa,navLink:ya,navLinkActive:ga,rightSection:va,searchWrapper:ba,searchInput:wa,searchButton:_a,searchIcon:Ea,profileBtn:Sa,profileAvatar:ka,profileName:Pa,hamburgerBtn:Ta,mobileSearchBar:xa,mobileSearchBarHidden:Ia,mobileSearchInner:Na,mobileSearchIcon:Ca,mobileSearchInput:Oa},Aa=()=>{const{toggleSidebar:e}=Rt(),{contentType:t}=zn(),[n,r]=v(""),[s,i]=v(!0),[a,c]=v(!1),[l,u]=v(!0),[d,h]=v(!1),m=gn(),f=nt(),p=U(null),_=U(!1),x=U(null),S=U(null),y=U(null),g=U(null),T=U(!1),{data:z}=ne(ca);w(()=>{const k=window.visualViewport;if(!k)return;const D=()=>{g.current?.style.setProperty("--vv-top",`${k.offsetTop}px`)};return D(),k.addEventListener("scroll",D),k.addEventListener("resize",D),()=>{k.removeEventListener("scroll",D),k.removeEventListener("resize",D)}},[]),w(()=>{const k=()=>{p.current&&(window.clearTimeout(p.current),p.current=null)},D=()=>{k(),!(window.scrollY<=10)&&(p.current=window.setTimeout(()=>{T.current||i(!1)},2500))},W=()=>{_.current||(_.current=!0,x.current=requestAnimationFrame(()=>{_.current=!1,x.current=null;const le=window.scrollY<=10;u(Se=>Se===le?Se:le),i(Se=>Se||!0),D()}))},oe=le=>{(le.metaKey||le.ctrlKey)&&le.key==="k"?(le.preventDefault(),X.current?.focus({preventScroll:!0})):le.key==="Escape"&&document.activeElement===X.current&&X.current?.blur()},O=g.current,ce=()=>{T.current=!0},Te=()=>{T.current=!1,D()};return window.addEventListener("scroll",W,{passive:!0}),window.addEventListener("keydown",oe),O?.addEventListener("pointerenter",ce),O?.addEventListener("pointerleave",Te),()=>{window.removeEventListener("scroll",W),window.removeEventListener("keydown",oe),O?.removeEventListener("pointerenter",ce),O?.removeEventListener("pointerleave",Te),k(),x.current!==null&&(cancelAnimationFrame(x.current),x.current=null),_.current=!1}},[a]);const X=Pt.useRef(null),ve=()=>window.innerWidth<=1024,C=()=>{ve()?(h(!0),setTimeout(()=>y.current?.focus({preventScroll:!0}),50)):document.activeElement===X.current&&n.trim()?I():X.current?.focus({preventScroll:!0})},re=k=>{S.current?.contains(k.relatedTarget)||h(!1)},G=t==="manga"?"Search manga...":t==="tv"?"Search TV & movies...":t==="asmr"?"Search ASMR...":"Search anime...",b=t==="manga"?{to:"/reading-list",label:"Reading List"}:t==="tv"?{to:"/tv-watchlist",label:"TV Watchlist"}:t==="asmr"?{to:"/listening-list",label:"Listening List"}:{to:"/watchlist",label:"Watchlist"},I=k=>{ia();const D=n.trim();D&&m(t==="manga"?`/manga?q=${encodeURIComponent(D)}`:t==="tv"?`/tv-search?q=${encodeURIComponent(D)}`:t==="asmr"?`/asmr?q=${encodeURIComponent(D)}`:`/search?query=${encodeURIComponent(D)}`)};return o(Y,{children:o("header",{ref:g,className:`${A.header} ${s?"":A.hidden} ${l?"":A.scrolled}`,children:[o("div",{className:A.headerInner,children:[o("div",{className:A.leftSection,children:[o("button",{className:A.hamburgerBtn,onClick:e,"aria-label":"Menu",children:o(N,{name:"bars"})}),o(se,{to:"/",className:A.logo,"aria-label":"Ani-Web Home",children:o(Lt,{})}),o("nav",{className:A.desktopNav,children:[o(se,{to:"/",className:`${A.navLink} ${f.pathname==="/"?A.navLinkActive:""}`,children:"Home"}),o(se,{to:b.to,className:`${A.navLink} ${f.pathname.startsWith(b.to)?A.navLinkActive:""}`,children:b.label}),t==="anime"&&o(se,{to:"/insights",className:`${A.navLink} ${f.pathname==="/insights"?A.navLinkActive:""}`,children:"Insights"}),o(se,{to:"/settings",className:`${A.navLink} ${f.pathname.startsWith("/settings")?A.navLinkActive:""}`,children:"Settings"})]})]}),o("div",{className:A.rightSection,children:[o("div",{className:A.searchWrapper,children:[o("input",{ref:X,type:"text","data-virtual-keyboard":"true",className:A.searchInput,placeholder:G,value:n,onChange:k=>r(k.currentTarget.value),onFocus:()=>c(!0),onBlur:()=>c(!1),onKeyDown:k=>{k.key==="Enter"&&I()}}),o("button",{type:"button",className:A.searchButton,"aria-label":"Search",onMouseDown:k=>k.preventDefault(),onClick:C,children:o(N,{name:"search",className:A.searchIcon})})]}),o(fi,{}),o(se,{to:"/settings",className:A.profileBtn,"aria-label":`${z?.name??"Profile"} — profile settings`,title:`${z?.name??"Profile"}${z?.owner?" (owner)":""} — profile settings`,children:[o("span",{className:A.profileAvatar,"aria-hidden":"true",children:o(Jn,{image:z?.image,name:z?.name??"Profile"})}),o("span",{className:A.profileName,children:z?.name??"Profile"})]})]})]}),d&&o("div",{className:`${A.mobileSearchBar} ${s?"":A.mobileSearchBarHidden}`,ref:S,onBlur:re,children:o("div",{className:A.mobileSearchInner,children:[o(N,{name:"search",className:A.mobileSearchIcon}),o("input",{ref:y,type:"text","data-virtual-keyboard":"true",className:A.mobileSearchInput,placeholder:G,value:n,onChange:k=>r(k.currentTarget.value),onKeyDown:k=>{k.key==="Enter"?(I(),h(!1)):k.key==="Escape"&&h(!1)}})]})})]})})},_t="agreedToViewMature";function Et(){try{return V.getItem(_t)==="true"}catch{return!1}}const Re=new Set;function Yn(e){for(const t of Re)t(e)}function Qe(){Yn(Et())}function ln(e){try{e?V.setItem(_t,"true"):V.removeItem(_t)}catch{}Yn(e)}function La(){const[e,t]=v(Et);w(()=>(Re.add(t),Re.size===1&&(window.addEventListener("storage",Qe),window.addEventListener("focus",Qe)),t(Et()),()=>{Re.delete(t),Re.size===0&&(window.removeEventListener("storage",Qe),window.removeEventListener("focus",Qe))}),[]);const n=H(()=>ln(!0),[]),r=H(()=>ln(!1),[]);return{hasConsent:e,grant:n,revoke:r}}const Ra="_sidebar_153jc_1",$a="_open_153jc_20",qa="_sidebarHeader_153jc_25",Da="_closeBtn_153jc_33",ja="_logo_153jc_57",Ma="_navSection_153jc_69",Fa="_navLink_153jc_75",Wa="_active_153jc_108",Ba="_overlay_153jc_118",Ua="_versionInfo_153jc_138",ue={sidebar:Ra,open:$a,sidebarHeader:qa,closeBtn:Da,logo:ja,navSection:Ma,navLink:Fa,active:Wa,overlay:Ba,versionInfo:Ua},Ha="3.8.2",Zn={version:Ha},Ka=()=>{const{isOpen:e,setIsOpen:t}=Rt(),{contentType:n}=zn(),{hasConsent:r}=La(),s=()=>{t(!1)},i=n==="manga",a=n==="tv",c=n==="asmr",l=[{to:"/",icon:o(N,{name:"home"}),label:"Home"},i?{to:"/manga",icon:o(N,{name:"book"}),label:"Manga"}:a?{to:"/tv-search",icon:o(N,{name:"tv"}),label:"TV and Movies"}:c?{to:"/asmr",icon:o(N,{name:"headphones"}),label:"ASMR"}:{to:"/search",icon:o(N,{name:"search"}),label:"Search"},i?{to:"/reading-list",icon:o(N,{name:"bookmark"}),label:"Reading List"}:a?{to:"/tv-watchlist",icon:o(N,{name:"clock"}),label:"TV Watchlist"}:c?{to:"/listening-list",icon:o(N,{name:"history"}),label:"Listening List"}:{to:"/watchlist",icon:o(N,{name:"clock"}),label:"Watchlist"},...n==="anime"?[{to:"/insights",icon:o(N,{name:"chart-pie"}),label:"Insights"}]:[],{to:"/trackers",icon:o(N,{name:"sync-alt"}),label:"Trackers"},...n==="anime"||a?[{to:"/watch-along",icon:o(N,{name:"play"}),label:"Watch along"}]:[],...r?[{to:"/mature",icon:o(N,{name:"pepper-hot"}),label:"Mature"}]:[],{to:"/settings",icon:o(N,{name:"cog"}),label:"Settings"}];return o(Y,{children:[o("aside",{className:`${ue.sidebar} ${e?ue.open:""} sidebar`,children:[o("div",{className:ue.sidebarHeader,children:[o("button",{className:ue.closeBtn,onClick:()=>t(!1),"aria-label":"Close menu",children:"×"}),o(se,{to:"/",className:ue.logo,onClick:s,children:o(Lt,{})})]}),o("nav",{className:ue.navSection,children:l.map(u=>o(lr,{to:u.to,className:({isActive:d})=>`${ue.navLink} ${d?ue.active:""}`,onClick:s,end:u.to==="/",children:[u.icon,o("span",{children:u.label})]},u.to))}),o("div",{className:ue.versionInfo,children:["v",Zn.version]})]}),e&&o("div",{className:ue.overlay,onClick:()=>t(!1),"aria-label":"Close sidebar"})]})},Qa="_footer_1c905_1",Va="_footerInner_1c905_15",za="_brandSection_1c905_27",Ga="_logoRow_1c905_39",Ja="_logoText_1c905_45",Ya="_brandMeta_1c905_51",Za="_brandTagline_1c905_60",Xa="_statusPill_1c905_67",ec="_statusDot_1c905_80",tc="_linksGrid_1c905_88",nc="_linkColumn_1c905_96",rc="_columnTitle_1c905_102",oc="_bottomBar_1c905_126",sc="_copyright_1c905_136",ic="_brand_1c905_27",ac="_heartIcon_1c905_152",cc="_backToTop_1c905_157",j={footer:Qa,footerInner:Va,brandSection:za,logoRow:Ga,logoText:Ja,brandMeta:Ya,brandTagline:Za,statusPill:Xa,statusDot:ec,linksGrid:tc,linkColumn:nc,columnTitle:rc,bottomBar:oc,copyright:sc,brand:ic,heartIcon:ac,backToTop:cc},lc=()=>{const e=new Date().getFullYear(),t=()=>{window.scrollTo({top:0,behavior:"smooth"})};return o("footer",{className:j.footer,children:[o("div",{className:j.footerInner,children:[o("div",{className:j.brandSection,children:[o("div",{className:j.logoRow,children:o(Lt,{className:j.logoText})}),o("div",{className:j.brandMeta,children:[o("div",{className:j.statusPill,children:[o("span",{className:j.statusDot}),o("span",{children:["v",Zn.version]})]}),o("p",{className:j.brandTagline,children:"Fast, local anime streaming."})]})]}),o("div",{className:j.linksGrid,children:[o("div",{className:j.linkColumn,children:[o("h4",{className:j.columnTitle,children:"Navigation"}),o(se,{to:"/",children:"Home"}),o(se,{to:"/watchlist",children:"Watchlist"}),o(se,{to:"/settings",children:"Settings"})]}),o("div",{className:j.linkColumn,children:[o("h4",{className:j.columnTitle,children:"Features"}),o(se,{to:"/search",children:"Search Anime"}),o(se,{to:"/trackers",children:"Trackers"}),o(se,{to:"/insights",children:"Insights"})]}),o("div",{className:j.linkColumn,children:[o("h4",{className:j.columnTitle,children:"Community"}),o("a",{href:"https://discord.gg/6yT3VwTqz9",target:"_blank",rel:"noopener noreferrer",children:[o(N,{name:"discord",style:{marginRight:"6px"}})," Discord"]}),o("a",{href:"https://github.com/serifpersia/dango",target:"_blank",rel:"noopener noreferrer",children:[o(N,{name:"github",style:{marginRight:"6px"}})," GitHub"]})]}),o("div",{className:j.linkColumn,children:[o("h4",{className:j.columnTitle,children:"Project"}),o("a",{href:"https://github.com/serifpersia/dango/releases",target:"_blank",rel:"noopener noreferrer",children:"Releases"}),o("a",{href:"https://github.com/serifpersia/dango/issues",target:"_blank",rel:"noopener noreferrer",children:"Feedback"})]})]})]}),o("div",{className:j.bottomBar,children:[o("p",{className:j.copyright,children:["© ",e," ",o("span",{className:j.brand,children:"dango"})," • Crafted with"," ",o(N,{name:"heart",className:j.heartIcon})," by"," ",o("a",{href:"https://github.com/serifpersia",target:"_blank",rel:"noopener noreferrer",children:"serifpersia"})]}),o("button",{className:j.backToTop,onClick:t,"aria-label":"Back to top",children:[o(N,{name:"chevron-up",size:14}),o("span",{children:"Top"})]})]})]})};function Xn(e){return JSON.stringify({0:e??{}})}function er(e){return`/api/trpc/${e}?batch=1&_profile=${encodeURIComponent(qn())}`}function St(e,t){const n=Xn(t),r=er(e);try{if(navigator.sendBeacon){navigator.sendBeacon(r,new Blob([n],{type:"application/json"}));return}}catch{}fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:n,keepalive:!0}).catch(()=>{})}async function wu(e,t){const n=await fetch(er(e),{method:"POST",headers:{"Content-Type":"application/json"},body:Xn(t),keepalive:!0});if(!n.ok)throw new Error(`tRPC request failed (HTTP ${n.status})`)}function _u(e){e&&(St("discord.clear",{sessionId:e}),St("discord.heartbeat",{sessionId:e,bye:!0}))}function uc(){const e=nt(),{data:t}=at("discordRPCEnabled"),n=U("");n.current||(n.current=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`tab-${Date.now()}-${Math.random().toString(36).slice(2)}`),w(()=>{if(t===!1||t==="false")return;const r=n.current,s=()=>ae.discord.heartbeat.mutate({sessionId:r}).catch(()=>{});s();const i=setInterval(s,15e3),a=()=>{St("discord.heartbeat",{sessionId:r,bye:!0})};return window.addEventListener("pagehide",a),()=>{clearInterval(i),window.removeEventListener("pagehide",a)}},[t]),w(()=>{if(t===!1||t==="false")return;const r=e.pathname;if(r.startsWith("/watch/")||r.startsWith("/player/"))return;let s="home";r.startsWith("/search")||r.startsWith("/mature")?s="search":r.startsWith("/watchlist")?s="watchlist":r.startsWith("/anime/")?s="anime":r.startsWith("/insights")?s="insights":r.startsWith("/settings")?s="settings":r.startsWith("/trackers")?s="trackers":r.startsWith("/asmr")?s="asmr":r.startsWith("/manga")?s="manga":r.startsWith("/tv")&&(s="tv"),ae.discord.pageStatus.mutate({page:s}).catch(()=>{})},[e.pathname,t])}function $t(e,t){const[n,r]=v(()=>{try{const i=V.getItem(e);if(i===null)return t;if(typeof t=="string")return i;try{return JSON.parse(i)}catch{return i}}catch{return t}});w(()=>{const i=a=>{if(a.key===V.keyFor(e))try{if(a.newValue===null){r(t);return}if(typeof t=="string"){r(a.newValue);return}try{r(JSON.parse(a.newValue))}catch{r(a.newValue)}}catch{}};return window.addEventListener("storage",i),()=>window.removeEventListener("storage",i)},[e,t]);const s=H(i=>{r(a=>{const c=typeof i=="function"?i(a):i;try{typeof c=="string"?V.setItem(e,c):V.setItem(e,JSON.stringify(c))}catch{}return c})},[e]);return[n,s]}const tr=he(void 0),dc=()=>{const e=fe(tr);if(!e)throw new Error("useAnimePaheCookie must be used within an AnimePaheCookieProvider");return e},mc="_overlay_1juub_1",hc="_fadeIn_1juub_1",fc="_content_1juub_11",pc="_modalIn_1juub_1",yc="_sm_1juub_29",gc="_md_1juub_33",vc="_lg_1juub_37",bc="_title_1juub_41",wc="_body_1juub_48",_c="_footer_1juub_52",Ie={overlay:mc,fadeIn:hc,content:fc,modalIn:pc,sm:yc,md:gc,lg:vc,title:bc,body:wc,footer:_c};function nr({children:e}){return o("h2",{className:Ie.title,children:e})}function rr({children:e}){return o("div",{className:Ie.body,children:e})}function or({children:e}){return o("div",{className:Ie.footer,children:e})}function We({isOpen:e,onClose:t,title:n,children:r,footer:s,width:i="md"}){const a=U(null),[c,l]=v(document.body);return w(()=>{if(!e)return;const u=()=>l(document.fullscreenElement??document.body);return u(),document.addEventListener("fullscreenchange",u),()=>document.removeEventListener("fullscreenchange",u)},[e]),w(()=>{if(!e)return;const u=h=>{h.key==="Escape"&&t?.()};document.addEventListener("keydown",u);const d=document.body.style.overflow;return document.body.style.overflow="hidden",a.current?.focus(),()=>{document.removeEventListener("keydown",u),document.body.style.overflow=d}},[e,t]),e?Tt(o("div",{role:"presentation",onMouseDown:u=>u.stopPropagation(),children:[o("div",{className:Ie.overlay,onClick:()=>t?.(),"aria-hidden":"true"}),o("div",{ref:a,className:`${Ie.content} ${Ie[i]}`,role:"dialog","aria-modal":"true","aria-label":n,tabIndex:-1,children:[n&&o(nr,{children:n}),o(rr,{children:r}),s&&o(or,{children:s})]})]}),c):null}We.Header=nr;We.Body=rr;We.Actions=or;const Ec="_container_e96gf_1",Sc="_field_e96gf_9",kc="_textarea_e96gf_20",Pc="_input_e96gf_40",Tc="_button_e96gf_58",xc="_secondaryButton_e96gf_78",Ic="_actions_e96gf_95",Nc="_hint_e96gf_104",Cc="_link_e96gf_117",ee={container:Ec,field:Sc,textarea:kc,input:Pc,button:Tc,secondaryButton:xc,actions:Ic,hint:Nc,link:Cc},Oc="https://github.com/serifpersia/dango/releases/latest/download/dango-extension.zip",Ac=e=>{try{return JSON.parse(e.detail)}catch{return null}},Lc=({isOpen:e,onClose:t,onSuccess:n})=>{const[r,s]=v(1),[i,a]=v(navigator.userAgent),[c,l]=v(""),[u,d]=v(!1),h=U(null),m=navigator.userAgent,f=/android/i.test(m),p=/firefox|fxios/i.test(m)&&!f,_=!p&&!f&&/chrome|chromium|edg|brave/i.test(m),x=p||_;w(()=>{e&&(s(1),a(navigator.userAgent),l(""),d(!1))},[e]),w(()=>()=>{h.current&&(window.removeEventListener("dango:pahe-cookie",h.current),h.current=null)},[]);const S=()=>{window.open("https://animepahe.pw","_blank","noopener,noreferrer"),s(2)},y=()=>{if(u)return;d(!0);const T=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,z=window.setTimeout(()=>{d(!1),h.current&&(window.removeEventListener("dango:pahe-cookie",h.current),h.current=null),P.error("Helper not detected - install it via about:debugging first.")},3e3),X=ve=>{const C=Ac(ve);if(!(!C||C.requestId!==T))if(window.clearTimeout(z),window.removeEventListener("dango:pahe-cookie",X),h.current=null,d(!1),C?.ok&&C.cookie)l(C.cookie),P.success("Cookie extracted from helper!");else if(C?.error==="NO_COOKIE"){const re=C.debug?.stores?.length??0,G=C.debug?.names??[];P.error(`Helper found no cf_clearance (checked ${re} stores, saw: ${G.join(", ")||"none"}) - solve the challenge on the AnimePahe tab first.`)}else P.error("Helper request failed - try again.")};h.current=X,window.addEventListener("dango:pahe-cookie",X),window.dispatchEvent(new CustomEvent("dango:get-pahe-cookie",{detail:{requestId:T}}))},g=()=>{const T=c.trim();if(!T){P.error("Please enter the cf_clearance cookie");return}try{V.setItem("animepahe_ua",i),V.setItem("animepahe_cookie",T),P.success("Cookie updated successfully! Reloading…"),n?.(),t(),window.setTimeout(()=>window.location.reload(),1e3)}catch{P.error("Failed to save cookie")}};return o(We,{isOpen:e,onClose:t,title:"AnimePahe Verification Required",children:o("div",{className:ee.container,children:r===1?o(Y,{children:[o("p",{children:"AnimePahe requires a manual verification to bypass Cloudflare/DDoS-Guard protection."}),o("div",{className:ee.field,children:[o("label",{children:"Your User-Agent (will be used for requests):"}),o("textarea",{value:i,readOnly:!0,rows:3,className:ee.textarea})]}),o("div",{className:ee.actions,children:[o("button",{className:ee.secondaryButton,onClick:t,children:"Cancel"}),o("button",{className:ee.button,onClick:S,children:"Start Verification (Opens AnimePahe)"})]})]}):o(Y,{children:[o("p",{children:["1. Solve the challenge on the ",o("strong",{children:"AnimePahe tab"})," (keep that tab open).",o("br",{}),"2. Copy the ",o("strong",{children:"cf_clearance"})," cookie value using one of these:",o("br",{}),o("br",{}),o("strong",{children:"Chrome / Edge — DevTools:"})," press ",o("code",{children:"F12"})," →"," ",o("strong",{children:"Application"})," → ",o("strong",{children:"Cookies"})," →"," ",o("code",{children:"https://animepahe.pw"}),". Find ",o("strong",{children:"cf_clearance"}),", double-click its ",o("strong",{children:"Value"})," to select it, then copy.",o("br",{}),o("br",{}),o("strong",{children:"Firefox — Storage Inspector:"})," press ",o("code",{children:"F12"})," →"," ",o("strong",{children:"Storage"})," → ",o("strong",{children:"Cookies"})," →"," ",o("code",{children:"https://animepahe.pw"}),". Find ",o("strong",{children:"cf_clearance"}),", right-click the value → ",o("strong",{children:"Copy Value"}),".",o("br",{}),o("br",{}),o("strong",{children:"Either browser — extension:"})," open"," ",o("strong",{children:"Cookie Manager"})," while on the AnimePahe tab, find"," ",o("strong",{children:"cf_clearance"}),", and copy its value (or use the extension's export).",o("br",{}),o("br",{}),"3. Paste it below. Copy ",o("strong",{children:"only the value"})," — remove any"," ",o("code",{children:"cf_clearance="})," prefix or quotes if they were included."]}),x&&o("div",{className:ee.hint,children:[o("strong",{children:"Dango helper (one-time setup):"})," ",p?o(Y,{children:["type ",o("code",{children:"about:debugging"})," in the address bar →"," ",o("strong",{children:"This Firefox"})," → ",o("strong",{children:"Load Temporary Add-on"})," ","→ open the ",o("code",{children:"dango-extension/firefox"})," folder and pick"," ",o("code",{children:"manifest.json"}),". (Temporary helpers unload when Firefox closes - repeat after a restart.)"]}):o(Y,{children:["type ",o("code",{children:"chrome://extensions"})," in the address bar → enable"," ",o("strong",{children:"Developer mode"})," → ",o("strong",{children:"Load unpacked"})," → open the ",o("code",{children:"dango-extension/chrome"})," folder. (Unpacked helpers show a developer-mode notice - expected.)"]})," ","Use this link to download the extension and extract it:"," ",o("a",{href:Oc,target:"_blank",rel:"noreferrer",className:ee.link,children:"dango-extension.zip"}),". Then click Extract below and the field fills itself.",o("div",{className:ee.actions,children:o("button",{className:ee.button,onClick:y,disabled:u,type:"button",children:u?"Extracting…":"Extract cookie from helper"})})]}),o("div",{className:ee.field,children:[o("label",{children:"cf_clearance cookie value:"}),o("input",{type:"text",value:c,onChange:T=>l(T.currentTarget.value),placeholder:"e.g. xxxxxxxx.xxxxxxxx.xxxxxxx-xxxxxxx",className:ee.input})]}),o("div",{className:ee.actions,children:[o("button",{className:ee.secondaryButton,onClick:t,children:"Cancel"}),o("button",{className:ee.secondaryButton,onClick:()=>s(1),children:"Back"}),o("button",{className:ee.button,onClick:g,children:"Submit"})]})]})})})};function Rc(){const[e,t]=v(!1);return w(()=>{const n=window.setTimeout(()=>t(!0),120);return()=>window.clearTimeout(n)},[]),e?o("div",{className:"top-progress-bar",role:"progressbar","aria-label":"Loading"}):null}const $c="_screen_1pca0_1",qc="_icon_1pca0_14",Dc="_title_1pca0_20",jc="_text_1pca0_24",Mc="_button_1pca0_29",Le={screen:$c,icon:qc,title:Dc,text:jc,button:Mc};async function Fc(e,t){const n={message:e.message,stack:e.stack,componentStack:t.componentStack,url:typeof window<"u"?window.location.href:"",timestamp:new Date().toISOString()},r=JSON.stringify(n);try{if(navigator.sendBeacon){navigator.sendBeacon("/api/internal/client-error",new Blob([r],{type:"application/json"}));return}}catch{}fetch("/api/internal/client-error",{method:"POST",headers:{"Content-Type":"application/json"},body:r,keepalive:!0}).catch(()=>{})}class Wc extends ur{state={hasError:!1};static getDerivedStateFromError(t){return{hasError:!0}}componentDidCatch(t,n){console.error("Uncaught error:",t,n),Fc(t,n)}render(){return this.state.hasError?o("div",{className:Le.screen,children:[o(N,{name:"exclamation-triangle",className:Le.icon}),o("h1",{className:Le.title,children:"Something went wrong"}),o("p",{className:Le.text,children:"The application encountered an unexpected error."}),o("button",{onClick:()=>{this.setState({hasError:!1}),window.location.href="/"},className:Le.button,children:[o(N,{name:"home"}),"Go back Home"]})]}):this.props.children}}const sr=he(void 0),Bc=()=>{const e=fe(sr);if(!e)throw new Error("useLanAuth must be used within a LanAuthProvider");return e},Uc=({children:e})=>{const[t,n]=v(!1),r=H(()=>n(!0),[]),s=H(()=>n(!1),[]);return w(()=>$n("lan",r),[r]),o(sr.Provider,{value:{isOpen:t,openModal:r,closeModal:s},children:e})},Hc="_container_88bss_1",Kc="_field_88bss_8",Qc="_input_88bss_19",Vc="_actions_88bss_37",Ve={container:Hc,field:Kc,input:Qc,actions:Vc},tt=dr(({variant:e="primary",size:t="md",loading:n,children:r,className:s="",disabled:i,...a},c)=>{const l=As("btn",`btn-${e}`,t!=="md"&&`btn-${t}`,n&&"btn-loading",s);return o("button",{className:l,disabled:i||n,ref:c,...a,children:n?o("span",{className:"btn-spinner"}):r})}),ir=({isOpen:e,onClose:t,onSuccess:n})=>{const[r,s]=v(""),[i,a]=v(!1);Pt.useEffect(()=>{e&&s("")},[e]);const c=async()=>{if(!r){P.error("Please enter your password");return}a(!0);try{const l=await Ot("/api/auth/app-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:r})}),u=await l.json().catch(()=>({}));if(!l.ok){P.error(u.error||"Login failed");return}P.success("Authenticated successfully"),n(),t(),window.location.reload()}catch{P.error("Network error")}finally{a(!1)}};return o(We,{isOpen:e,onClose:t,title:"LAN Authentication Required",children:o("div",{className:Ve.container,children:[o("p",{children:"This instance is protected. Enter the password to access from this device."}),o("div",{className:Ve.field,children:[o("label",{htmlFor:"lan-password",children:"Password"}),o("input",{id:"lan-password",type:"password",value:r,onChange:l=>s(l.currentTarget.value),placeholder:"Enter password...",className:Ve.input,onKeyDown:l=>l.key==="Enter"&&c()})]}),o("div",{className:Ve.actions,children:[o(tt,{variant:"secondary",onClick:t,disabled:i,children:"Cancel"}),o(tt,{variant:"primary",onClick:c,loading:i,children:"Unlock"})]})]})})},zc="_notice_1d75r_1",Gc={notice:zc},Jc=2600,Yc=1e4,Zc={anilist:"Updating AniList…",mal:"Updating MyAnimeList…"};function Xc({enabled:e=!0}){const[t,n]=v(!1),[r,s]=v("mal"),[i,a]=v(document.fullscreenElement);return w(()=>{const c=()=>a(document.fullscreenElement);return document.addEventListener("fullscreenchange",c),()=>document.removeEventListener("fullscreenchange",c)},[]),w(()=>{if(!e||typeof EventSource>"u")return;const c=new EventSource("/api/tracker/activity"),l=new Map;let u;const d=new Set;let h=-1/0;const m=f=>{let p;try{p=JSON.parse(f.data)}catch{return}const _=p.provider;_!=="anilist"&&_!=="mal"||(p.updating===!0?(clearTimeout(l.get(_)),d.size===0&&Date.now()-h>=Yc&&(h=Date.now(),s(_),n(!0),clearTimeout(u),u=setTimeout(()=>n(!1),Jc)),d.add(_)):p.updating===!1&&(clearTimeout(l.get(_)),l.set(_,setTimeout(()=>d.delete(_),1500))))};return c.addEventListener("tracker-activity",m),()=>{c.removeEventListener("tracker-activity",m),c.close(),clearTimeout(u);for(const f of l.values())clearTimeout(f);n(!1)}},[e]),!e||!t?null:Tt(o("div",{className:Gc.notice,role:"status","aria-live":"polite","aria-atomic":"true",children:[o(N,{name:r==="anilist"?"anilist":"myanimelist",size:15}),o("span",{children:Zc[r]})]}),i||document.body)}const el=M(()=>F(()=>import("./Home-CXsFL5QN.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33]))),tl=M(()=>F(()=>import("./Watchlist-5UqdPHPq.js"),__vite__mapDeps([34,1,2,4,10,11,12,5,13,3,6,7,8,9,14,15,16,17,18,35,36,37,38,39]))),nl=M(()=>F(()=>import("./Settings-C72mbc_2.js"),__vite__mapDeps([40,1,2,41,42,4,43]))),un=M(()=>F(()=>import("./Player-B2CmI6hn.js"),__vite__mapDeps([44,1,45,4,46,2,47,14,48,7,8,6,20,21,12,5,13,27,49,50,51,52,53,54,55]))),rl=M(()=>F(()=>import("./WatchAlong-CoZ0_fXQ.js"),__vite__mapDeps([56,1,53,54,2,4]))),ol=M(()=>F(()=>import("./Search-BpG4bAm2.js"),__vite__mapDeps([57,1,4,3,5,6,7,8,9,10,11,2,12,13,14,15,16,17,18,37,38,58,59]))),sl=M(()=>F(()=>import("./Mature-CWEA-qdC.js"),__vite__mapDeps([60,1,2,4,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,27,58,59,61]))),dn=M(()=>F(()=>import("./Asmr--BgcQsb9.js"),__vite__mapDeps([62,1,4,2,41,42,7,8,3,5,6,9,32,24,63,25,45,46,64,65,66]))),il=M(()=>F(()=>import("./Manga-mB3KYDUt.js"),__vite__mapDeps([67,1,4,41,42,7,8,17,18,3,5,6,9,22,23,2,24,25,27,68,69,64,65]))),al=M(()=>F(()=>import("./MangaInfoPage-C2sxlrwM.js"),__vite__mapDeps([70,1,4,17,18,23,2,24,68,69,64,65]))),cl=M(()=>F(()=>import("./MangaReadPage-pDNIP1mf.js"),__vite__mapDeps([71,1,17,4,18,2,23,24,68,69,64,65]))),ll=M(()=>F(()=>import("./ReadingList-Bp_5vTLj.js"),__vite__mapDeps([72,1,3,4,5,6,7,8,9,73,15,16,17,18,35,36,22,23,2,24,25,26,19]))),mn=M(()=>F(()=>import("./TvSearch-BQNApkYS.js"),__vite__mapDeps([74,1,4,3,5,6,7,8,9,28,29,30,2,24,15,16,17,18,58,59]))),ul=M(()=>F(()=>import("./TvInfo-Cu6BPMzl.js"),__vite__mapDeps([75,1,4,30,2,24,76]))),dl=M(()=>F(()=>import("./Tv-FXbgyY_h.js"),__vite__mapDeps([77,1,45,4,46,2,47,14,48,78,7,8,27,30,24,6,51,52,53,54,79]))),ml=M(()=>F(()=>import("./TvWatchlist-DKbRFInR.js"),__vite__mapDeps([80,1,3,4,5,6,7,8,9,73,15,16,17,18,35,36,19,29,30,2,24]))),hl=M(()=>F(()=>import("./ListeningList-DSc_Aqz9.js"),__vite__mapDeps([81,1,3,4,5,6,7,8,9,73,15,16,17,18,35,36,63,32,2,24,25,31,19]))),fl=M(()=>F(()=>import("./Trackers-CYbGDEf-.js"),__vite__mapDeps([82,1,2,4,83]))),pl=M(()=>F(()=>import("./Insights-4HjAFOov.js"),__vite__mapDeps([84,1,2,4,85]))),yl=M(()=>F(()=>import("./AnimeInfoPage-CPFvFKt0.js"),__vite__mapDeps([86,1,2,4]))),gl=M(()=>F(()=>import("./PlayerRedirect-fv2tzEUu.js"),__vite__mapDeps([87,1]))),vl=M(()=>F(()=>import("./VirtualKeyboard-B0KbwdUi.js"),__vite__mapDeps([88,1,2,4,89])));function bl(){Ni();const{isOpen:e,closeModal:t,onSuccess:n}=dc(),{isOpen:r,setIsOpen:s}=Rt(),{isOpen:i,openModal:a,closeModal:c}=Bc(),l=nt(),u=mr(),d=U(new Map),h=U(l.pathname),m=aa();uc();const[f,p]=v(!1);w(()=>{const y=new AbortController;return $e("/api/auth/app-status",{signal:y.signal}).then(g=>{g.hasPassword&&!g.isAuthenticated&&(p(!0),a())}).catch(()=>{y.signal.aborted||P.error("Could not check server access. The server may still be starting; reload to retry.")}),()=>y.abort()},[a]);const[_,x]=$t("lan_auth_notice_shown","false"),S=U(!1);return w(()=>{if(_==="true"||S.current)return;S.current=!0,x("true");const y=setTimeout(()=>{P("Optional LAN lock is available. Set a password in Settings to protect access from other devices on your network.",{duration:1e4,icon:"🔒"})},3e3);return()=>clearTimeout(y)},[_,x]),w(()=>{try{window.history.scrollRestoration="manual"}catch{}},[]),w(()=>{const y=l.key,g=d.current;if(u==="POP"){const T=g.get(y)??0;window.scrollTo({top:T,behavior:"instant"})}else l.pathname!==h.current&&window.scrollTo({top:0,behavior:"instant"});return h.current=l.pathname,()=>{g.set(y,window.scrollY)}},[l.key,l.pathname,u]),w(()=>{const y=g=>{r&&g.key==="Escape"&&s(!1)};return r?document.body.classList.add("sidebar-open"):document.body.classList.remove("sidebar-open"),window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y),document.body.classList.remove("sidebar-open")}},[r,s]),o("div",{className:"app-container",children:[o(Lc,{isOpen:e,onClose:t,onSuccess:n}),o(ir,{isOpen:i,onClose:f?()=>{}:c,onSuccess:()=>{p(!1),c()}}),o(Pn,{position:"top-center",toastOptions:{style:{background:"var(--bg-elevated)",color:"var(--text-primary)",border:"1px solid var(--border-primary)"},success:{style:{background:"var(--accent)",color:"var(--accent-text)"},iconTheme:{primary:"var(--accent-text)",secondary:"var(--accent)"}},error:{style:{background:"rgba(153, 42, 42, 0.95)",color:"#fff"}}}}),o(Xc,{enabled:!f&&!i}),o(Aa,{}),o(Ka,{}),o("main",{className:"main-content",children:o(Wc,{children:o(jt,{fallback:o(Rc,{}),children:o(hr,{children:[o(R,{path:"/",element:o(el,{})}),o(R,{path:"/watchlist/:filter?",element:o(tl,{})}),o(R,{path:"/reading-list/:filter?",element:o(ll,{})}),o(R,{path:"/search",element:o(ol,{})}),o(R,{path:"/mature",element:o(sl,{})}),o(R,{path:"/asmr",element:o(dn,{})}),o(R,{path:"/asmr/:rj",element:o(dn,{})}),o(R,{path:"/manga",element:o(il,{})}),o(R,{path:"/manga/:provider/:id",element:o(al,{})}),o(R,{path:"/manga/:provider/:id/read",element:o(cl,{})}),o(R,{path:"/tv",element:o(mn,{})}),o(R,{path:"/tv/:id",element:o(ul,{})}),o(R,{path:"/tv/:id/watch",element:o(dl,{})}),o(R,{path:"/tv-search",element:o(mn,{})}),o(R,{path:"/tv-watchlist/:filter?",element:o(ml,{})}),o(R,{path:"/listening-list/:filter?",element:o(hl,{})}),o(R,{path:"/settings",element:o(nl,{})}),o(R,{path:"/trackers",element:o(fl,{})}),o(R,{path:"/mal",element:o(Mt,{to:"/trackers",replace:!0})}),o(R,{path:"/insights",element:o(pl,{})}),o(R,{path:"/anime/:id",element:o(yl,{})}),o(R,{path:"/watch/:id",element:o(un,{})}),o(R,{path:"/watch-along",element:o(rl,{})}),o(R,{path:"/watch/:id/:episodeNumber",element:o(un,{})}),o(R,{path:"/player/:id/:episodeNumber?",element:o(gl,{})}),o(R,{path:"*",element:o(Mt,{to:"/",replace:!0})})]})})})}),o(lc,{}),m.isVisible&&o(jt,{fallback:null,children:o(vl,{activeInputRef:m.activeInputRef,isVisible:m.isVisible,onClose:m.hide})})]})}function wl(){return o(Uc,{children:o(bl,{})})}const _l=({children:e})=>{const[t,n]=v(!1),r=H(()=>{n(i=>!i)},[]),s=Ce(()=>({isOpen:t,setIsOpen:n,toggleSidebar:r}),[t,r]);return o(Qn.Provider,{value:s,children:e})},El=({children:e})=>{const[t,n]=$t("dango_content_type","anime"),r=Ce(()=>({contentType:t,setContentType:n}),[t,n]);return o(Vn.Provider,{value:r,children:e})},Sl=({children:e})=>{const[t,n]=v("englishName"),[r,s]=v(!0);w(()=>{(async()=>{try{const c=await ae.settings.getByKey.query({key:"titlePreference"});c.value&&n(c.value)}catch(c){console.error("Error fetching title preference in context:",c)}finally{s(!1)}})()},[]);const i=Ce(()=>({titlePreference:t,setTitlePreference:n,loading:r}),[t,r]);return o(Dn.Provider,{value:i,children:e})},kl=({children:e})=>{const{data:t,isLoading:n}=at("lowEndMode"),r=Wn(),s=Z(),[i,a]=v(!1);w(()=>{const u=s.getDefaultOptions();s.setDefaultOptions({...u,queries:{...u.queries,gcTime:i?900*1e3:1800*1e3}})},[i,s]),w(()=>{t!==void 0&&a(t==="true"||t===!0)},[t]),w(()=>{i?document.body.classList.add("low-end"):document.body.classList.remove("low-end")},[i]);const c=H(u=>{a(u),r.mutate({key:"lowEndMode",value:String(u)})},[r]),l=Ce(()=>({lowEndMode:i,setLowEndMode:c,loading:n}),[i,c,n]);return o(Bn.Provider,{value:l,children:e})},Pl=["iris","mochi","sakura"];function hn(e){e==="iris"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",e)}const Tl=({children:e})=>{const{data:t,isLoading:n}=at("theme"),r=Wn(),[s,i]=v("iris");w(()=>{typeof t=="string"&&Pl.includes(t)&&i(t)},[t]),w(()=>{hn(s)},[s]);const a=H(l=>{l!==s&&(i(l),hn(l),r.mutate({key:"theme",value:l}))},[r,s]),c=Ce(()=>({theme:s,setTheme:a,loading:n}),[s,a,n]);return o(Hn.Provider,{value:c,children:e})},xl=({children:e})=>{const[t,n]=v(!1),[r,s]=v(void 0),i=H(c=>{s(()=>c),n(!0)},[]),a=H(()=>{n(!1),s(void 0)},[]);return w(()=>$n("animepahe",()=>i()),[i]),o(tr.Provider,{value:{isOpen:t,openModal:i,closeModal:a,onSuccess:r},children:e})},Il="_gate_r3yn2_1",Nl="_panel_r3yn2_10",Cl="_form_r3yn2_18",Ol="_field_r3yn2_31",Al="_avatarRow_r3yn2_48",Ll="_profileList_r3yn2_60",Rl="_smallAvatar_r3yn2_73",$l="_profileName_r3yn2_78",xe={gate:Il,panel:Nl,form:Cl,field:Ol,avatarRow:Al,profileList:Ll,smallAvatar:Rl,profileName:$l};function ql({children:e}){const[t,n]=v(!1),[r,s]=v(!1),[i,a]=v([]),[c,l]=v(""),[u,d]=v(""),[h,m]=v(""),[f,p]=v(!1),[_,x]=v(0);if(w(()=>{let y=!1;return m(""),(async()=>{const T=await $e("/api/auth/app-status");if(y)return;if(T.hasPassword&&!T.isAuthenticated){s(!0);return}const z=await $e("/api/profiles/status");y||(z.current?(Ss(z.current.id),n(!0)):(a(z.profiles),l(z.profiles[0]?.id??"")))})().catch(T=>{y||m(T.message)}),()=>{y=!0}},[_]),w(()=>{const y=T=>{T.key==="dango:profile-session-change"&&window.location.reload()},g=()=>{n(!1),x(T=>T+1)};return window.addEventListener("storage",y),window.addEventListener("dango:profile-auth-required",g),()=>{window.removeEventListener("storage",y),window.removeEventListener("dango:profile-auth-required",g)}},[]),t)return e;const S=i.find(y=>y.id===c);return o("div",{className:xe.gate,children:[o(Pn,{}),o(ir,{isOpen:r,onClose:()=>{},onSuccess:()=>{s(!1),x(y=>y+1)}}),o("section",{className:xe.panel,children:[o("h1",{children:i.length?"Choose your profile":"Connecting to Dango…"}),S&&o(Y,{children:[o("div",{className:xe.avatarRow,children:o(Jn,{image:S.avatar??S.cloudAvatar,name:S.name})}),o("form",{className:xe.form,onSubmit:async y=>{y.preventDefault(),p(!0),m("");try{await $e("/api/profiles/login",{method:"POST",body:JSON.stringify({id:c,password:u})}),Ps()}catch(g){m(g.message),p(!1)}},children:[o("label",{className:xe.field,children:["Profile",o("select",{value:c,onChange:y=>{l(y.currentTarget.value),d(""),m("")},children:i.map(y=>o("option",{value:y.id,children:[y.name,y.owner?" (owner)":""]},y.id))})]}),S.protected&&o("label",{className:xe.field,children:["Password",o("input",{type:"password",autoComplete:"current-password",required:!0,maxLength:256,value:u,onChange:y=>d(y.currentTarget.value)})]}),o(tt,{type:"submit",loading:f,children:"Continue"})]})]}),h&&o(Y,{children:[o("p",{role:"alert",children:h}),o(tt,{variant:"secondary",onClick:()=>x(y=>y+1),children:"Retry"})]})]})]})}const ar=he(null);function Eu(){const e=fe(ar);if(!e)throw new Error("WatchAlongProvider is missing");return e}const Dl=/^[0-9a-f-]{36}$/,jl=/^[0-9a-f]{64}$/;function Su(e,t){return(e.kind??"anime")===(t.kind??"anime")&&e.season===t.season&&e.showId===t.showId&&e.episode===t.episode&&e.provider===t.provider&&e.mode===t.mode&&e.source===t.source}function ku(e,t){return e.position+(e.playing?Math.max(0,t-e.updatedAt)/1e3*e.rate:0)}const qt=e=>String(e).toLowerCase()==="movie"?"movie":"tv",Pu=(e,t)=>`${qt(e)}:${t}`,Tu=(e,t)=>{const n=qt(e);return`/tv/${t}?type=${n}`},Ml=(e,t,n,r)=>{const s=new URLSearchParams;return s.set("type",qt(e)),n!==void 0&&s.set("s",String(n)),r!==void 0&&s.set("e",String(r)),`/tv/${t}/watch?${s.toString()}`},xu=e=>e.adult===!0||e.adult===1,Iu={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"},Nu={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"},kt="dango-watch-along",Dt="dango-watch-along-host";function fn(e){if(!e||typeof e!="object")return null;const t=e;if(typeof t.id!="string"||typeof t.token!="string"||typeof t.guestToken!="string")return null;const n=qe(`${t.id}.${t.guestToken}`,""),r=qe(`${t.id}.${t.token}`,"");return{...n,token:r.token,host:t.host===!0}}function Fl(){try{return fn(JSON.parse(sessionStorage.getItem(kt)||"null"))??fn(JSON.parse(localStorage.getItem(Dt)||"null"))}catch{return null}}function Wl(e){try{e?sessionStorage.setItem(kt,JSON.stringify(e)):sessionStorage.removeItem(kt),e?.host&&localStorage.setItem(Dt,JSON.stringify(e))}catch{}}function ze(){try{localStorage.removeItem(Dt)}catch{}}function Bl(e){return e.kind==="tv"||e.kind==="movie"?Ml(e.kind,e.showId,e.kind==="tv"?e.season:void 0,e.kind==="tv"?Number(e.episode):void 0):`/watch/${encodeURIComponent(e.showId)}/${encodeURIComponent(e.episode)}`}function qe(e,t){let n=e.trim().replace(/^#/,"");if(n.includes("://")){const a=new URL(n);if(a.origin!==new URL(t).origin||!["/join","/watch-along"].includes(a.pathname))throw new Error("Use an invite from this dango watch-along service.");n=a.hash.slice(1)}const[r,s,i]=n.split(".");if(!Dl.test(r||"")||!jl.test(s||"")||i!==void 0)throw new Error("Paste a complete watch-along invite link or room code.");return{id:r,token:s,guestToken:s,host:!1}}function Ul({children:e}){const t=gn(),n=nt(),[r,s]=$t("watchAlongName",""),[i,a]=v(Fl),[c,l]=v(null),[u,d]=v(!1),[h,m]=v(""),[f,p]=v(""),[_,x]=v({offset:0,latency:0}),S=U(null),{data:y}=ne({queryKey:["watch-along-config"],queryFn:()=>ae.settings.watchAlong.query()}),g=y?.workerUrl.replace(/\/$/,"")||"";w(()=>{Wl(i)},[i]);const T=H(C=>{S.current?.readyState===WebSocket.OPEN&&S.current.send(JSON.stringify(C))},[]);w(()=>{if(!u)return;const C=setTimeout(()=>T({type:"name",name:r}),250);return()=>clearTimeout(C)},[u,f,r,T]);const z=H(()=>{i?.host&&T({type:"end"}),S.current?.close(1e3,"Left room"),ze(),a(null),l(null),d(!1),m("")},[T,i]),X=async C=>{if(!g)throw new Error("Watch along is unavailable. Check your server configuration.");const re=await fetch(`${g}/rooms`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(C),signal:AbortSignal.timeout(15e3)}),G=await re.json();if(!re.ok)throw new Error(G.error||"Could not create room");const b=qe(`${G.id}.${G.guestToken}`,g),I=qe(`${G.id}.${G.hostToken}`,g);m(""),l(null),a({...b,token:I.token,host:!0})},ve=C=>{if(!g)throw new Error("Watch along is unavailable. Check your server configuration.");const re=qe(C,g);ze(),m(""),l(null),a(re)};return w(()=>{if(!i||!g)return;let C=!1,re=0,G,b,I=Date.now();const k=async()=>{if(C)return;try{const oe=await fetch(`${g}/rooms/${i.id}`,{headers:{Authorization:`Bearer ${i.token}`},signal:AbortSignal.timeout(1e4)});if(C)return;if(!oe.ok){const O=await oe.json();if([403,404,409].includes(oe.status)){m(O.error||"Unable to join room"),ze(),a(null),l(null);return}throw new Error(O.error||"Room service unavailable")}}catch{if(C)return;m("Cannot reach the room service. Retrying…"),G=setTimeout(k,Math.min(15e3,1e3*2**Math.min(re++,4)));return}const D=new URL(`${g}/rooms/${i.id}/ws`);D.protocol=D.protocol==="https:"?"wss:":"ws:";const W=new WebSocket(D,["dango-watch-along",i.token]);S.current=W,W.onopen=()=>{I=Date.now()},W.onmessage=oe=>{if(!(C||S.current!==W)){I=Date.now();try{const O=JSON.parse(oe.data);if(O.type==="joined"){if(O.host!==i.host){W.close(4003,"Invalid role");return}re=0,d(!0),m(""),p(O.id),W.send(JSON.stringify({type:"ping",sentAt:Date.now()}))}else if(O.type==="state")l(ce=>ce&&ce.revision>O.state.revision?ce:O.state);else if(O.type==="pong"){const ce=Date.now()-O.sentAt;x({offset:O.serverTime-(O.sentAt+ce/2),latency:ce/2})}else O.type==="error"&&m(O.error)}catch{m("Invalid response from the room service.")}}},W.onclose=oe=>{if(!(C||S.current!==W)){if(clearInterval(b),d(!1),[4003,4004,4009].includes(oe.code)){m(oe.reason||"Room closed"),oe.code!==4009&&ze(),a(null),l(null);return}m("Connection lost. Reconnecting…"),G=setTimeout(k,Math.min(15e3,1e3*2**Math.min(re++,4)))}},W.onerror=()=>W.close(),b=setInterval(()=>{Date.now()-I>25e3?W.close():W.readyState===WebSocket.OPEN&&W.send(JSON.stringify({type:"ping",sentAt:Date.now()}))},1e4)};return k(),()=>{C=!0,clearTimeout(G),clearInterval(b),S.current?.close(1e3,"Leaving connection"),S.current=null,d(!1)}},[i,g]),w(()=>{if(!i||i.host||!c)return;const C=Bl(c.selection);`${n.pathname}${n.search}`!==C&&t(C,{replace:!0})},[i,c,n.pathname,n.search,t]),o(ar.Provider,{value:{workerUrl:g,displayName:r,setDisplayName:s,session:i,room:c,connected:u,error:h,selfId:f,clock:_,create:X,join:ve,leave:z,send:T},children:e})}try{window.history.scrollRestoration="manual"}catch{}const pn=new vr({defaultOptions:{queries:{staleTime:1e3*60*5,gcTime:1800*1e3,refetchOnWindowFocus:!1,refetchIntervalInBackground:!1,retry:1}}}),yn=document.getElementById("root");yn&&fr(o(ql,{children:o(pr,{children:o(Ns,{trpcClient:ae,queryClient:pn,children:o(br,{client:pn,children:o(xl,{children:o(_l,{children:o(El,{children:o(Sl,{children:o(kl,{children:o(Tl,{children:o(Ul,{children:o(wl,{})})})})})})})})})})})}),yn);export{lt as $,Jl as A,tt as B,yu as C,uu as D,cu as E,P as F,at as G,Wn as H,hu as I,fu as J,mu as K,We as L,Nu as M,ca as N,$e as O,xe as P,Jn as Q,Ps as R,Ot as S,Iu as T,K as U,vu as V,bu as W,an as X,Gn as Y,sn as Z,F as _,$t as a,Gl as a0,ee as a1,Eu as a2,Lc as a3,eu as a4,ia as a5,_u as a6,$n as a7,qt as a8,Pu as a9,wu as aa,Su as ab,ku as ac,Rt as ad,gu as ae,Rc as af,ou as ag,su as ah,ru as ai,Yl as b,Zl as c,Rs as d,La as e,Os as f,Vl as g,Ml as h,xu as i,Tu as j,Ls as k,q as l,Xl as m,zn as n,du as o,V as p,$ as q,tu as r,zl as s,ae as t,pi as u,nu as v,iu as w,au as x,pu as y,lu as z};