@serifpersia/dango 3.9.8 → 4.0.0

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 (62) hide show
  1. package/README.md +2 -2
  2. package/client/dist/assets/{AnimeCard-DewqpGzh.js → AnimeCard-SI0B6et0.js} +1 -1
  3. package/client/dist/assets/{AnimeInfo-D_Q7e5se.js → AnimeInfo-SoCwFMy3.js} +1 -1
  4. package/client/dist/assets/{AnimeInfoPage-CDzqc1kE.js → AnimeInfoPage-DLf7SyVa.js} +2 -2
  5. package/client/dist/assets/{Asmr-DdJXXv44.js → Asmr-Dsuu6xgC.js} +1 -1
  6. package/client/dist/assets/{AsmrPopup-Cty7WqGl.js → AsmrPopup-CQC440HI.js} +1 -1
  7. package/client/dist/assets/{AsmrResetProgressModal-CH8if1av.js → AsmrResetProgressModal-CEnhUV7K.js} +1 -1
  8. package/client/dist/assets/{Home-fOOTJ5Mv.js → Home-ioBgiYqI.js} +1 -1
  9. package/client/dist/assets/{Insights-BXIIjvKu.js → Insights-DZx-ZzP2.js} +1 -1
  10. package/client/dist/assets/{LibraryListPage-YiGRUJUu.js → LibraryListPage-DnwV1dP1.js} +1 -1
  11. package/client/dist/assets/{ListeningList-D-mxqb0Z.js → ListeningList-DR4z9phs.js} +1 -1
  12. package/client/dist/assets/{Manga-CHGPAvJO.js → Manga-Cd_q6M_o.js} +1 -1
  13. package/client/dist/assets/{MangaInfoPage-B2Gpavli.js → MangaInfoPage-DVGzzTOa.js} +1 -1
  14. package/client/dist/assets/{MangaReadPage-FFlXE7Ul.js → MangaReadPage-Dh4rEwtO.js} +1 -1
  15. package/client/dist/assets/{MangaResetProgressModal-COfIc2jG.js → MangaResetProgressModal-DVJbgVwK.js} +1 -1
  16. package/client/dist/assets/{Mature-D6KQl_hq.js → Mature-DCBXh2Dl.js} +1 -1
  17. package/client/dist/assets/{MatureConsentModal-DpjUSNog.js → MatureConsentModal-D34i8744.js} +1 -1
  18. package/client/dist/assets/{MediaCard-Btm1P5WW.js → MediaCard-JRLogrma.js} +1 -1
  19. package/client/dist/assets/{OptionListMenu-DonnPx8t.js → OptionListMenu-BjsiUrW1.js} +1 -1
  20. package/client/dist/assets/Player-Cy24aKqh.js +56 -0
  21. package/client/dist/assets/{PlayerProvider-BsAg1WEi.js → PlayerProvider-BbsS7ai1.js} +1 -1
  22. package/client/dist/assets/{PlayerSettings-Df7CLn-j.js → PlayerSettings-cJWnEwcK.js} +1 -1
  23. package/client/dist/assets/{QueueOptionsButton-Cj6B0P07.js → QueueOptionsButton-JAUAWTzf.js} +1 -1
  24. package/client/dist/assets/{QueueRail-uj185PNp.js → QueueRail-Ck96ehEp.js} +1 -1
  25. package/client/dist/assets/{ReadingList-DyLy-7tv.js → ReadingList-EboHnXxk.js} +1 -1
  26. package/client/dist/assets/{ResetProgressModal-DLr68mM9.js → ResetProgressModal-Daj-RqHv.js} +1 -1
  27. package/client/dist/assets/{Search-CbPH9KuK.js → Search-83zyS4iX.js} +1 -1
  28. package/client/dist/assets/{Settings-BcE3qLnj.js → Settings-Bv8Y_ao5.js} +1 -1
  29. package/client/dist/assets/{SkeletonGrid-m9giJrDw.js → SkeletonGrid-D2FNyELs.js} +1 -1
  30. package/client/dist/assets/{Trackers-CL19Dz3a.js → Trackers-Da4Q2-ta.js} +1 -1
  31. package/client/dist/assets/Tv-lRDoqQLs.js +4 -0
  32. package/client/dist/assets/TvInfo-9UDA16_u.js +1 -0
  33. package/client/dist/assets/{TvPopup-Fvqq_zfz.js → TvPopup-vBayJw7b.js} +1 -1
  34. package/client/dist/assets/{TvSearch-DBBMShrK.js → TvSearch-Vg-ncyei.js} +1 -1
  35. package/client/dist/assets/{TvWatchlist-DtRMYBcN.js → TvWatchlist-CEt3I21U.js} +1 -1
  36. package/client/dist/assets/{VirtualKeyboard-BAit8w5c.js → VirtualKeyboard-CADCu5f_.js} +1 -1
  37. package/client/dist/assets/{WatchAlong-x0fVpDw5.js → WatchAlong-Cc2HhkiG.js} +1 -1
  38. package/client/dist/assets/{WatchAlongPanel-BFgij___.js → WatchAlongPanel-D3FLPJz0.js} +1 -1
  39. package/client/dist/assets/{Watchlist-BQAmkXi4.js → Watchlist-CUFpDT9-.js} +1 -1
  40. package/client/dist/assets/index-B8IsmFl4.css +1 -0
  41. package/client/dist/assets/index-B9fL2VIP.js +178 -0
  42. package/client/dist/assets/{libraryInvalidation-D2FVJJH7.js → libraryInvalidation-Cnx2xRQb.js} +1 -1
  43. package/client/dist/assets/{playbackCompletion-D5cbxqOy.js → playbackCompletion-CKlwK8SG.js} +1 -1
  44. package/client/dist/assets/{useAnimeInfoData-Yk3cvLlr.js → useAnimeInfoData-hTms4q2e.js} +1 -1
  45. package/client/dist/assets/{useMangaLibrary-B_1FyESm.js → useMangaLibrary-CUNeIgcg.js} +1 -1
  46. package/client/dist/assets/{useMangaPopup-DO8o1xwG.js → useMangaPopup-s5QTNQMd.js} +1 -1
  47. package/client/dist/assets/{useProviders-BSr5s-nS.js → useProviders-twwSG5Ji.js} +1 -1
  48. package/client/dist/assets/{useTv-B3PUkZ51.js → useTv-CmriRQC3.js} +1 -1
  49. package/client/dist/assets/{useTvLibrary-DGLxk33P.js → useTvLibrary-abNJVIr4.js} +1 -1
  50. package/client/dist/assets/{useWatchAlongPlayer-Wd4W4HZk.js → useWatchAlongPlayer-CtnbRVOZ.js} +1 -1
  51. package/client/dist/index.html +2 -2
  52. package/client/dist/logo-mascot.png +0 -0
  53. package/client/dist/logo.png +0 -0
  54. package/package.json +2 -2
  55. package/server/dist/server.js +215 -215
  56. package/server/package.json +1 -1
  57. package/client/dist/assets/Player-CB8UTo30.js +0 -56
  58. package/client/dist/assets/Tv-Cvwf6kfG.js +0 -4
  59. package/client/dist/assets/TvInfo-CF-V57eQ.js +0 -1
  60. package/client/dist/assets/index-Arw9bJwh.js +0 -178
  61. package/client/dist/assets/index-DmkNa-gz.css +0 -1
  62. package/client/dist/logo.svg +0 -6
@@ -1,178 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Home-fOOTJ5Mv.js","assets/vendor-core-DfaOB3Rn.js","assets/vendor-query-BBT5_sHx.js","assets/MediaCard-Btm1P5WW.js","assets/vendor-icons-C1Pj_eSX.js","assets/vendor-ui-3qrARCPr.js","assets/useIsMobile-Dvx1uJ82.js","assets/MatureConsentModal-DpjUSNog.js","assets/MatureConsentModal-CqewXc0q.css","assets/MediaCard-CJ-18Ma8.css","assets/AnimeCard-DewqpGzh.js","assets/useAnimeInfoData-Yk3cvLlr.js","assets/QueueOptionsButton-Cj6B0P07.js","assets/QueueOptionsButton-CM15uQn8.css","assets/playbackCompletion-D5cbxqOy.js","assets/SkeletonGrid-m9giJrDw.js","assets/SkeletonGrid-BisPI38I.css","assets/ErrorMessage-hMt90aG4.js","assets/ErrorMessage-CXoRbrLN.css","assets/ResetProgressModal-DLr68mM9.js","assets/QueueRail-uj185PNp.js","assets/QueueRail-CcHdXRmS.css","assets/useMangaPopup-DO8o1xwG.js","assets/useMangaLibrary-B_1FyESm.js","assets/libraryInvalidation-D2FVJJH7.js","assets/usePopup-DS9jMzp6.js","assets/MangaResetProgressModal-COfIc2jG.js","assets/useProviders-BSr5s-nS.js","assets/useTv-B3PUkZ51.js","assets/TvPopup-Fvqq_zfz.js","assets/useTvLibrary-DGLxk33P.js","assets/AsmrResetProgressModal-CH8if1av.js","assets/AsmrPopup-Cty7WqGl.js","assets/Home-D_Hd4SUo.css","assets/Watchlist-BQAmkXi4.js","assets/LibraryListPage.module-r6k9nyT9.js","assets/LibraryListPage-DmdjNa2U.css","assets/ActiveFilterChips-olGfwxle.js","assets/ActiveFilterChips-QjkplDN2.css","assets/Watchlist-DW7kUORr.css","assets/Settings-BcE3qLnj.js","assets/ToggleSwitch-CN_ppEc9.js","assets/ToggleSwitch-BPil0d_k.css","assets/Settings-B57LhIVH.css","assets/Player-CB8UTo30.js","assets/PlayerProvider-BsAg1WEi.js","assets/PlayerProvider-ZeplRma-.css","assets/useWatchAlongPlayer-Wd4W4HZk.js","assets/useWatchAlongPlayer-Dk7zB7P4.css","assets/AnimeMetaDetails-B3-A7O5H.js","assets/AnimeMetaDetails-BwNQnRCd.css","assets/SynopsisText-B3Sa5pRv.js","assets/SynopsisText-CYv2W3yR.css","assets/WatchAlongPanel-BFgij___.js","assets/WatchAlongPanel-DWb8lSzW.css","assets/Player-1LfYnRyR.css","assets/WatchAlong-x0fVpDw5.js","assets/Search-CbPH9KuK.js","assets/Search.module-C_qwCdHS.js","assets/Search-DCKK3seW.css","assets/Mature-D6KQl_hq.js","assets/Mature-DJmUUtlF.css","assets/Asmr-DdJXXv44.js","assets/useAsmrPopup-BBmHrx9v.js","assets/page.module-C1MlZzf3.js","assets/page-DRvjODkg.css","assets/Asmr-Do89pEHG.css","assets/Manga-CHGPAvJO.js","assets/Manga.module-depGEacJ.js","assets/Manga-CqAceKxR.css","assets/MangaInfoPage-B2Gpavli.js","assets/MangaReadPage-FFlXE7Ul.js","assets/ReadingList-DyLy-7tv.js","assets/LibraryListPage-YiGRUJUu.js","assets/TvSearch-DBBMShrK.js","assets/TvInfo-CF-V57eQ.js","assets/TvInfo-Bu36xJyO.css","assets/Tv-Cvwf6kfG.js","assets/OptionListMenu-DonnPx8t.js","assets/Tv-C-bNPNTQ.css","assets/TvWatchlist-DtRMYBcN.js","assets/ListeningList-D-mxqb0Z.js","assets/Trackers-CL19Dz3a.js","assets/Trackers-BC636V59.css","assets/Insights-BXIIjvKu.js","assets/Insights-DEicrokg.css","assets/AnimeInfoPage-CDzqc1kE.js","assets/PlayerRedirect-fv2tzEUu.js","assets/VirtualKeyboard-BAit8w5c.js","assets/VirtualKeyboard-CejCi3pJ.css"])))=>i.map(i=>d[i]);
2
- import{N as yr,k as oe,A as q,q as V,h as w,S as ye,d as y,u as o,X as be,x as we,T as je,$ as Sn,g as Lt,L as me,a as Tn,c as Ye,e as vr,f as br,D as wr,i as _r,P as Gt,j as kr,l as R,m as Jt,z as K,n as Er,B as Sr}from"./vendor-core-DfaOB3Rn.js";import{s as Ae,i as Tr,q as Pr,u as ae,a as pe,b as j,c as ht,Q as Nr,d as Ir}from"./vendor-query-BBT5_sHx.js";import{I as P}from"./vendor-icons-C1Pj_eSX.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const s of a)if(s.type==="childList")for(const i of s.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(a){const s={};return a.integrity&&(s.integrity=a.integrity),a.referrerPolicy&&(s.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?s.credentials="include":a.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(a){if(a.ep)return;a.ep=!0;const s=n(a);fetch(a.href,s)}})();const Cr="modulepreload",xr=function(e){return"/"+e},Yt={},U=function(t,n,r){let a=Promise.resolve();if(n&&n.length>0){let l=function(u){return Promise.all(u.map(d=>Promise.resolve(d).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),c=i?.nonce||i?.getAttribute("nonce");a=l(n.map(u=>{if(u=xr(u),u in Yt)return;Yt[u]=!0;const d=u.endsWith(".css"),m=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${m}`))return;const h=document.createElement("link");if(h.rel=d?"stylesheet":Cr,d||(h.as="script"),h.crossOrigin="",h.href=u,c&&h.setAttribute("nonce",c),document.head.appendChild(h),d)return new Promise((p,g)=>{h.addEventListener("load",p),h.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${u}`)))})}))}function s(i){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=i,window.dispatchEvent(c),!c.defaultPrevented)throw i}return a.then(i=>{for(const c of i||[])c.status==="rejected"&&s(c.reason);return t().catch(s)})};let Or={data:""},Ar=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||Or},Lr=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,Rr=/\/\*[^]*?\*\/| +/g,Zt=/\n+/g,Te=(e,t)=>{let n="",r="",a="";for(let s in e){let i=e[s];s[0]=="@"?s[1]=="i"?n=s+" "+i+";":r+=s[1]=="f"?Te(i,s):s+"{"+Te(i,s[1]=="k"?"":t)+"}":typeof i=="object"?r+=Te(i,t?t.replace(/([^,])+/g,c=>s.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,l=>/&/.test(l)?l.replace(/&/g,c):c?c+" "+l:l)):s):i!=null&&(s=s[1]=="-"?s:s.replace(/[A-Z]/g,"-$&").toLowerCase(),a+=Te.p?Te.p(s,i):s+":"+i+";")}return n+(t&&a?t+"{"+a+"}":a)+r},Se={},Pn=e=>{if(typeof e=="object"){let t="";for(let n in e)t+=n+Pn(e[n]);return t}return e},qr=(e,t,n,r,a)=>{let s=Pn(e),i=Se[s]||(Se[s]=(l=>{let u=0,d=11;for(;u<l.length;)d=101*d+l.charCodeAt(u++)>>>0;return"go"+d})(s));if(!Se[i]){let l=s!==e?e:(u=>{let d,m,h=[{}];for(;d=Lr.exec(u.replace(Rr,""));)d[4]?h.shift():d[3]?(m=d[3].replace(Zt," ").trim(),h.unshift(h[0][m]=h[0][m]||{})):h[0][d[1]]=d[2].replace(Zt," ").trim();return h[0]})(e);Se[i]=Te(a?{["@keyframes "+i]:l}:l,n?"":"."+i)}let c=n&&Se.g;return n&&(Se.g=Se[i]),((l,u,d,m)=>{m?u.data=u.data.replace(m,l):u.data.indexOf(l)===-1&&(u.data=d?l+u.data:u.data+l)})(Se[i],t,r,c),i},Dr=(e,t,n)=>e.reduce((r,a,s)=>{let i=t[s];if(i&&i.call){let c=i(n),l=c&&c.props&&c.props.className||/^go/.test(c)&&c;i=l?"."+l:c&&typeof c=="object"?c.props?"":Te(c,""):c===!1?"":c}return r+a+(i??"")},"");function ft(e){let t=this||{},n=e.call?e(t.p):e;return qr(n.unshift?n.raw?Dr(n,[].slice.call(arguments,1),t.p):n.reduce((r,a)=>Object.assign(r,a&&a.call?a(t.p):a),{}):n,Ar(t.target),t.g,t.o,t.k)}let Nn,kt,Et;ft.bind({g:1});let ke=ft.bind({k:1});function $r(e,t,n,r){Te.p=t,Nn=e,kt=n,Et=r}function Ne(e,t){let n=this||{};return function(){let r=arguments;function a(s,i){let c=Object.assign({},s),l=c.className||a.className;n.p=Object.assign({theme:kt&&kt()},c),n.o=/go\d/.test(l),c.className=ft.apply(n,r)+(l?" "+l:"");let u=e;return e[0]&&(u=c.as||e,delete c.as),Et&&u[0]&&Et(c),Nn(u,c)}return a}}var jr=e=>typeof e=="function",ut=(e,t)=>jr(e)?e(t):e,Mr=(()=>{let e=0;return()=>(++e).toString()})(),In=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),Br=20,Rt="default",Cn=(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(i=>i.id===t.toast.id?{...i,...t.toast}:i)};case 2:let{toast:r}=t;return Cn(e,{type:e.toasts.find(i=>i.id===r.id)?1:0,toast:r});case 3:let{toastId:a}=t;return{...e,toasts:e.toasts.map(i=>i.id===a||a===void 0?{...i,dismissed:!0,visible:!1}:i)};case 4:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(i=>i.id!==t.toastId)};case 5:return{...e,pausedAt:t.time};case 6:let s=t.time-(e.pausedAt||0);return{...e,pausedAt:void 0,toasts:e.toasts.map(i=>({...i,pauseDuration:i.pauseDuration+s}))}}},it=[],xn={toasts:[],pausedAt:void 0,settings:{toastLimit:Br}},ve={},On=(e,t=Rt)=>{ve[t]=Cn(ve[t]||xn,e),it.forEach(([n,r])=>{n===t&&r(ve[t])})},An=e=>Object.keys(ve).forEach(t=>On(e,t)),Fr=e=>Object.keys(ve).find(t=>ve[t].toasts.some(n=>n.id===e)),gt=(e=Rt)=>t=>{On(t,e)},Wr={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},Kr=(e={},t=Rt)=>{let[n,r]=y(ve[t]||xn),a=q(ve[t]);w(()=>(a.current!==ve[t]&&r(ve[t]),it.push([t,r]),()=>{let i=it.findIndex(([c])=>c===t);i>-1&&it.splice(i,1)}),[t]);let s=n.toasts.map(i=>{var c,l,u;return{...e,...e[i.type],...i,removeDelay:i.removeDelay||((c=e[i.type])==null?void 0:c.removeDelay)||e?.removeDelay,duration:i.duration||((l=e[i.type])==null?void 0:l.duration)||e?.duration||Wr[i.type],style:{...e.style,...(u=e[i.type])==null?void 0:u.style,...i.style}}});return{...n,toasts:s}},Ur=(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||Mr()}),Ze=e=>(t,n)=>{let r=Ur(t,e,n);return gt(r.toasterId||Fr(r.id))({type:2,toast:r}),r.id},Y=(e,t)=>Ze("blank")(e,t);Y.error=Ze("error");Y.success=Ze("success");Y.loading=Ze("loading");Y.custom=Ze("custom");Y.dismiss=(e,t)=>{let n={type:3,toastId:e};t?gt(t)(n):An(n)};Y.dismissAll=e=>Y.dismiss(void 0,e);Y.remove=(e,t)=>{let n={type:4,toastId:e};t?gt(t)(n):An(n)};Y.removeAll=e=>Y.remove(void 0,e);Y.promise=(e,t,n)=>{let r=Y.loading(t.loading,{...n,...n?.loading});return typeof e=="function"&&(e=e()),e.then(a=>{let s=t.success?ut(t.success,a):void 0;return s?Y.success(s,{id:r,...n,...n?.success}):Y.dismiss(r),a}).catch(a=>{let s=t.error?ut(t.error,a):void 0;s?Y.error(s,{id:r,...n,...n?.error}):Y.dismiss(r)}),e};var Hr=1e3,Qr=(e,t="default")=>{let{toasts:n,pausedAt:r}=Kr(e,t),a=q(new Map).current,s=V((m,h=Hr)=>{if(a.has(m))return;let p=setTimeout(()=>{a.delete(m),i({type:4,toastId:m})},h);a.set(m,p)},[]);w(()=>{if(r)return;let m=Date.now(),h=n.map(p=>{if(p.duration===1/0)return;let g=(p.duration||0)+p.pauseDuration-(m-p.createdAt);if(g<0){p.visible&&Y.dismiss(p.id);return}return setTimeout(()=>Y.dismiss(p.id,t),g)});return()=>{h.forEach(p=>p&&clearTimeout(p))}},[n,r,t]);let i=V(gt(t),[t]),c=V(()=>{i({type:5,time:Date.now()})},[i]),l=V((m,h)=>{i({type:1,toast:{id:m,height:h}})},[i]),u=V(()=>{r&&i({type:6,time:Date.now()})},[r,i]),d=V((m,h)=>{let{reverseOrder:p=!1,gutter:g=8,defaultPosition:k}=h||{},M=n.filter(S=>(S.position||k)===(m.position||k)&&S.height),C=M.findIndex(S=>S.id===m.id),H=M.filter((S,x)=>x<C&&S.visible).length;return M.filter(S=>S.visible).slice(...p?[H+1]:[0,H]).reduce((S,x)=>S+(x.height||0)+g,0)},[n]);return w(()=>{n.forEach(m=>{if(m.dismissed)s(m.id,m.removeDelay);else{let h=a.get(m.id);h&&(clearTimeout(h),a.delete(m.id))}})},[n,s]),{toasts:n,handlers:{updateHeight:l,startPause:c,endPause:u,calculateOffset:d}}},zr=ke`
3
- from {
4
- transform: scale(0) rotate(45deg);
5
- opacity: 0;
6
- }
7
- to {
8
- transform: scale(1) rotate(45deg);
9
- opacity: 1;
10
- }`,Vr=ke`
11
- from {
12
- transform: scale(0);
13
- opacity: 0;
14
- }
15
- to {
16
- transform: scale(1);
17
- opacity: 1;
18
- }`,Gr=ke`
19
- from {
20
- transform: scale(0) rotate(90deg);
21
- opacity: 0;
22
- }
23
- to {
24
- transform: scale(1) rotate(90deg);
25
- opacity: 1;
26
- }`,Jr=Ne("div")`
27
- width: 20px;
28
- opacity: 0;
29
- height: 20px;
30
- border-radius: 10px;
31
- background: ${e=>e.primary||"#ff4b4b"};
32
- position: relative;
33
- transform: rotate(45deg);
34
-
35
- animation: ${zr} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
36
- forwards;
37
- animation-delay: 100ms;
38
-
39
- &:after,
40
- &:before {
41
- content: '';
42
- animation: ${Vr} 0.15s ease-out forwards;
43
- animation-delay: 150ms;
44
- position: absolute;
45
- border-radius: 3px;
46
- opacity: 0;
47
- background: ${e=>e.secondary||"#fff"};
48
- bottom: 9px;
49
- left: 4px;
50
- height: 2px;
51
- width: 12px;
52
- }
53
-
54
- &:before {
55
- animation: ${Gr} 0.15s ease-out forwards;
56
- animation-delay: 180ms;
57
- transform: rotate(90deg);
58
- }
59
- `,Yr=ke`
60
- from {
61
- transform: rotate(0deg);
62
- }
63
- to {
64
- transform: rotate(360deg);
65
- }
66
- `,Zr=Ne("div")`
67
- width: 12px;
68
- height: 12px;
69
- box-sizing: border-box;
70
- border: 2px solid;
71
- border-radius: 100%;
72
- border-color: ${e=>e.secondary||"#e0e0e0"};
73
- border-right-color: ${e=>e.primary||"#616161"};
74
- animation: ${Yr} 1s linear infinite;
75
- `,Xr=ke`
76
- from {
77
- transform: scale(0) rotate(45deg);
78
- opacity: 0;
79
- }
80
- to {
81
- transform: scale(1) rotate(45deg);
82
- opacity: 1;
83
- }`,eo=ke`
84
- 0% {
85
- height: 0;
86
- width: 0;
87
- opacity: 0;
88
- }
89
- 40% {
90
- height: 0;
91
- width: 6px;
92
- opacity: 1;
93
- }
94
- 100% {
95
- opacity: 1;
96
- height: 10px;
97
- }`,to=Ne("div")`
98
- width: 20px;
99
- opacity: 0;
100
- height: 20px;
101
- border-radius: 10px;
102
- background: ${e=>e.primary||"#61d345"};
103
- position: relative;
104
- transform: rotate(45deg);
105
-
106
- animation: ${Xr} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
107
- forwards;
108
- animation-delay: 100ms;
109
- &:after {
110
- content: '';
111
- box-sizing: border-box;
112
- animation: ${eo} 0.2s ease-out forwards;
113
- opacity: 0;
114
- animation-delay: 200ms;
115
- position: absolute;
116
- border-right: 2px solid;
117
- border-bottom: 2px solid;
118
- border-color: ${e=>e.secondary||"#fff"};
119
- bottom: 6px;
120
- left: 6px;
121
- height: 10px;
122
- width: 6px;
123
- }
124
- `,no=Ne("div")`
125
- position: absolute;
126
- `,ro=Ne("div")`
127
- position: relative;
128
- display: flex;
129
- justify-content: center;
130
- align-items: center;
131
- min-width: 20px;
132
- min-height: 20px;
133
- `,oo=ke`
134
- from {
135
- transform: scale(0.6);
136
- opacity: 0.4;
137
- }
138
- to {
139
- transform: scale(1);
140
- opacity: 1;
141
- }`,ao=Ne("div")`
142
- position: relative;
143
- transform: scale(0.6);
144
- opacity: 0.4;
145
- min-width: 20px;
146
- animation: ${oo} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275)
147
- forwards;
148
- `,so=({toast:e})=>{let{icon:t,type:n,iconTheme:r}=e;return t!==void 0?typeof t=="string"?oe(ao,null,t):t:n==="blank"?null:oe(ro,null,oe(Zr,{...r}),n!=="loading"&&oe(no,null,n==="error"?oe(Jr,{...r}):oe(to,{...r})))},io=e=>`
149
- 0% {transform: translate3d(0,${e*-200}%,0) scale(.6); opacity:.5;}
150
- 100% {transform: translate3d(0,0,0) scale(1); opacity:1;}
151
- `,co=e=>`
152
- 0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;}
153
- 100% {transform: translate3d(0,${e*-150}%,-1px) scale(.6); opacity:0;}
154
- `,lo="0%{opacity:0;} 100%{opacity:1;}",uo="0%{opacity:1;} 100%{opacity:0;}",mo=Ne("div")`
155
- display: flex;
156
- align-items: center;
157
- background: #fff;
158
- color: #363636;
159
- line-height: 1.3;
160
- will-change: transform;
161
- box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1), 0 3px 3px rgba(0, 0, 0, 0.05);
162
- max-width: 350px;
163
- pointer-events: auto;
164
- padding: 8px 10px;
165
- border-radius: 8px;
166
- `,po=Ne("div")`
167
- display: flex;
168
- justify-content: center;
169
- margin: 4px 10px;
170
- color: inherit;
171
- flex: 1 1 auto;
172
- white-space: pre-line;
173
- `,ho=(e,t)=>{let n=e.includes("top")?1:-1,[r,a]=In()?[lo,uo]:[io(n),co(n)];return{animation:t?`${ke(r)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${ke(a)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},fo=yr(({toast:e,position:t,style:n,children:r})=>{let a=e.height?ho(e.position||t||"top-center",e.visible):{opacity:0},s=oe(so,{toast:e}),i=oe(po,{...e.ariaProps},ut(e.message,e));return oe(mo,{className:e.className,style:{...a,...n,...e.style}},typeof r=="function"?r({icon:s,message:i}):oe(ye,null,s,i))});$r(oe);var go=({id:e,className:t,style:n,onHeightUpdate:r,children:a})=>{let s=V(i=>{if(i){let c=()=>{let l=i.getBoundingClientRect().height;r(e,l)};c(),new MutationObserver(c).observe(i,{subtree:!0,childList:!0,characterData:!0})}},[e,r]);return oe("div",{ref:s,className:t,style:n},a)},yo=(e,t)=>{let n=e.includes("top"),r=n?{top:0}:{bottom:0},a=e.includes("center")?{justifyContent:"center"}:e.includes("right")?{justifyContent:"flex-end"}:{};return{left:0,right:0,display:"flex",position:"absolute",transition:In()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${t*(n?1:-1)}px)`,...r,...a}},vo=ft`
174
- z-index: 9999;
175
- > * {
176
- pointer-events: auto;
177
- }
178
- `,tt=16,Ln=({reverseOrder:e,position:t="top-center",toastOptions:n,gutter:r,children:a,toasterId:s,containerStyle:i,containerClassName:c})=>{let{toasts:l,handlers:u}=Qr(n,s);return oe("div",{"data-rht-toaster":s||"",style:{position:"fixed",zIndex:9999,top:tt,left:tt,right:tt,bottom:tt,pointerEvents:"none",...i},className:c,onMouseEnter:u.startPause,onMouseLeave:u.endPause},l.map(d=>{let m=d.position||t,h=u.calculateOffset(d,{reverseOrder:e,gutter:r,defaultPosition:t}),p=yo(m,h);return oe(go,{id:d.id,key:d.id,onHeightUpdate:u.updateHeight,className:d.visible?vo:"",style:p},d.type==="custom"?ut(d.message,d):a?a(d):oe(fo,{toast:d,position:m}))}))},N=Y;const bo="_fadeImage_1bp3x_1",wo="_loaded_1bp3x_6",Xt={fadeImage:bo,loaded:wo},Rn=({className:e,onLoad:t,onError:n,...r})=>{const a=r.src,[s,i]=y(null),c=s!==null&&s===a;return o("img",{...r,className:`${e??""} ${Xt.fadeImage} ${c?Xt.loaded:""}`,onLoad:l=>{i(a),t?.(l)},onError:l=>{i(a),n?.(l)}})};function yt(e){const t={subscribe(n){let r=null,a=!1,s=!1,i=!1;function c(){if(r===null){i=!0;return}s||(s=!0,typeof r=="function"?r():r&&r.unsubscribe())}return r=e({next(l){var u;a||(u=n.next)===null||u===void 0||u.call(n,l)},error(l){var u;a||(a=!0,(u=n.error)===null||u===void 0||u.call(n,l),c())},complete(){var l;a||(a=!0,(l=n.complete)===null||l===void 0||l.call(n),c())}}),i&&c(),{unsubscribe:c}},pipe(...n){return n.reduce(_o,t)}};return t}function _o(e,t){return t(e)}function ko(e){const t=new AbortController;return new Promise((n,r)=>{let a=!1;function s(){a||(a=!0,i.unsubscribe())}t.signal.addEventListener("abort",()=>{r(t.signal.reason)});const i=e.subscribe({next(c){a=!0,n(c),s()},error(c){r(c)},complete(){t.abort(),s()}})})}function Eo(e){return t=>{let n=0,r=null;const a=[];function s(){r||(r=t.subscribe({next(c){for(const u of a){var l;(l=u.next)===null||l===void 0||l.call(u,c)}},error(c){for(const u of a){var l;(l=u.error)===null||l===void 0||l.call(u,c)}},complete(){for(const l of a){var c;(c=l.complete)===null||c===void 0||c.call(l)}}}))}function i(){if(n===0&&r){const c=r;r=null,c.unsubscribe()}}return yt(c=>(n++,a.push(c),s(),{unsubscribe(){n--,i();const l=a.findIndex(u=>u===c);l>-1&&a.splice(l,1)}}))}}function So(e){let t=e;const n=[],r=i=>{t!==void 0&&i.next(t),n.push(i)},a=i=>{n.splice(n.indexOf(i),1)},s=yt(i=>(r(i),()=>{a(i)}));return s.next=i=>{if(t!==i){t=i;for(const c of n)c.next(i)}},s.get=()=>t,s}function To(e){return yt(t=>{function n(r=0,a=e.op){const s=e.links[r];if(!s)throw new Error("No more links to execute - did you forget to add an ending link?");return s({op:a,next(i){return n(r+1,i)}})}return n().subscribe(t)})}function Ve(e){"@babel/helpers - typeof";return Ve=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},Ve(e)}function Po(e,t){if(Ve(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Ve(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function No(e){var t=Po(e,"string");return Ve(t)=="symbol"?t:t+""}function ce(e,t,n){return(t=No(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function en(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Z(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?en(Object(n),!0).forEach(function(r){ce(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):en(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Pe(e){return!!e&&!Array.isArray(e)&&typeof e=="object"}function Io(e){return typeof e=="function"}function Co(){return Object.create(null)}const xo=typeof Symbol=="function"&&!!Symbol.asyncIterator;function Oo(e){return xo&&Pe(e)&&Symbol.asyncIterator in e}const Ao=e=>e(),qn=()=>{},tn=e=>{Object.freeze&&Object.freeze(e)};function Dn(e,t,n){var r;const a=t.join(".");return(r=n[a])!==null&&r!==void 0||(n[a]=new Proxy(qn,{get(s,i){if(!(typeof i!="string"||i==="then"))return Dn(e,[...t,i],n)},apply(s,i,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)}),tn(u.args),tn(u.path),e(u)}})),n[a]}const $n=e=>Dn(e,[],Co()),Lo=e=>new Proxy(qn,{get(t,n){if(n!=="then")return e(n)}});function Ge(e){"@babel/helpers - typeof";return Ge=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},Ge(e)}function Ro(e,t){if(Ge(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Ge(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function qo(e){var t=Ro(e,"string");return Ge(t)=="symbol"?t:t+""}function St(e,t,n){return(t=qo(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function nt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?nn(Object(n),!0).forEach(function(r){St(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nn(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Do=class extends Error{constructor(e){super($o(e)),Object.assign(this,e)}};function $o(e){if("message"in e)return String(e.message)}function jo(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(Pe(e))return new Do(e)}}var rn=class extends Error{constructor(e){var t,n,r;const a=jo(e.cause),s=(t=(n=e.message)!==null&&n!==void 0?n:a?.message)!==null&&t!==void 0?t:e.code;super(s,{cause:a}),St(this,"cause",void 0),St(this,"code",void 0),this.code=e.code,this.name="TRPCError",(r=this.cause)!==null&&r!==void 0||(this.cause=a)}};function Mo(e,t){if("error"in e){const n=t.deserialize(e.error);return{ok:!1,error:nt(nt({},e),{},{error:n})}}return{ok:!0,result:nt(nt({},e.result),(!e.result.type||e.result.type==="data")&&{type:"data",data:t.deserialize(e.result.data)})}}var wt=class extends Error{constructor(){super("Unable to transform response from server")}};function Bo(e,t){let n;try{n=Mo(e,t)}catch{throw new wt}if(!n.ok&&(!Pe(n.error.error)||typeof n.error.error.code!="number"))throw new wt;if(n.ok&&!Pe(n.result))throw new wt;return n}function Fo(e){return typeof e=="function"}async function Wo(e,t){const{_def:n}=e;let r=n.procedures[t];for(;!r;){const a=Object.keys(n.lazy).find(s=>t===s||t.startsWith(s+"."));if(!a)return null;await n.lazy[a].load(),r=n.procedures[t]}return r}async function Ko(e){const{type:t,path:n}=e,r=await Wo(e.router,n);if(!r||!Fo(r)||r._def.type!==t&&!e.allowMethodOverride)throw new rn({code:"NOT_FOUND",message:`No "${t}"-procedure on path "${n}"`});if(r._def.type!==t&&e.allowMethodOverride&&r._def.type==="subscription")throw new rn({code:"METHOD_NOT_SUPPORTED",message:"Method override is not supported for subscriptions"});return r(e)}function Uo(e){return e instanceof dt}function Ho(e){return Pe(e)&&Pe(e.error)&&typeof e.error.code=="number"&&typeof e.error.message=="string"}function Qo(e,t){return typeof e=="string"?e:Pe(e)&&typeof e.message=="string"?e.message:t}var dt=class ct extends Error{constructor(t,n){var r,a;const s=n?.cause;super(t,{cause:s}),ce(this,"cause",void 0),ce(this,"shape",void 0),ce(this,"data",void 0),ce(this,"meta",void 0),this.meta=n?.meta,this.cause=s,this.shape=n==null||(r=n.result)===null||r===void 0?void 0:r.error,this.data=n==null||(a=n.result)===null||a===void 0?void 0:a.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,ct.prototype)}static from(t,n={}){const r=t;return Uo(r)?(n.meta&&(r.meta=Z(Z({},r.meta),n.meta)),r):Ho(r)?new ct(r.error.message,Z(Z({},n),{},{result:r,cause:n.cause})):new ct(Qo(r,"Unknown error"),Z(Z({},n),{},{cause:r}))}};function zo(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 on=e=>typeof e=="function";function Vo(e){if(e)return e;if(typeof window<"u"&&on(window.fetch))return window.fetch.bind(window);if(typeof globalThis<"u"&&on(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}function Go(...e){const t=new AbortController,n=e.length;let r=0;const a=()=>{++r===n&&t.abort()};for(const s of e)s?.aborted?a():s?.addEventListener("abort",a,{once:!0});return t.signal}function Jo(...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 Yo(e){return{url:e.url.toString(),fetch:e.fetch,transformer:zo(e.transformer),methodOverride:e.methodOverride}}function Zo(e){const t={};for(let n=0;n<e.length;n++){const r=e[n];t[n]=r}return t}const Xo={query:"GET",mutation:"POST",subscription:"PATCH"};function jn(e){return"input"in e?e.transformer.input.serialize(e.input):Zo(e.inputs.map(t=>e.transformer.input.serialize(t)))}const Mn=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 a=jn(e);a!==void 0&&e.methodOverride!=="POST"&&r.push(`input=${encodeURIComponent(JSON.stringify(a))}`)}return r.length&&(n+="?"+r.join("&")),n},ea=e=>{if(e.type==="query"&&e.methodOverride!=="POST")return;const t=jn(e);return t!==void 0?JSON.stringify(t):void 0},ta=e=>aa(Z(Z({},e),{},{contentTypeHeader:"application/json",getUrl:Mn,getBody:ea}));var na=class extends Error{constructor(){const e="AbortError";super(e),this.name=e,this.message=e}};const ra=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 na};async function oa(e){var t,n;ra(e.signal);const r=e.getUrl(e),a=e.getBody(e),s=(t=e.methodOverride)!==null&&t!==void 0?t:Xo[e.type],i=await(async()=>{const l=await e.headers();return Symbol.iterator in l?Object.fromEntries(l):l})(),c=Z(Z(Z({},e.contentTypeHeader&&s!=="GET"?{"content-type":e.contentTypeHeader}:{}),e.trpcAcceptHeader?{[(n=e.trpcAcceptHeaderKey)!==null&&n!==void 0?n:"trpc-accept"]:e.trpcAcceptHeader}:void 0),i);return Vo(e.fetch)(r,{method:s,signal:e.signal,body:a,headers:c})}async function aa(e){const t={},n=await oa(e);t.response=n;const r=await n.json();return t.responseJSON=r,{json:r,meta:t}}const an=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function sn(e){let t=null,n=null;const r=()=>{clearTimeout(n),n=null,t=null};function a(c){const l=[[]];let u=0;for(;;){const h=c[u];if(!h)break;const p=l[l.length-1];if(h.aborted){var d;(d=h.reject)===null||d===void 0||d.call(h,new Error("Aborted")),u++;continue}if(e.validate(p.concat(h).map(g=>g.key))){p.push(h),u++;continue}if(p.length===0){var m;(m=h.reject)===null||m===void 0||m.call(h,new Error("Input is too big for a single dispatch")),u++;continue}l.push([])}return l}function s(){const c=a(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(h,p)=>{const g=u.items[p];try{var k;const C=await Promise.resolve(h);(k=g.resolve)===null||k===void 0||k.call(g,C)}catch(C){var M;(M=g.reject)===null||M===void 0||M.call(g,C)}g.batch=null,g.reject=null,g.resolve=null}));for(const h of u.items){var m;(m=h.reject)===null||m===void 0||m.call(h,new Error("Missing result")),h.batch=null}}).catch(d=>{for(const h of u.items){var m;(m=h.reject)===null||m===void 0||m.call(h,d),h.batch=null}})}}function i(c){var l;const u={aborted:!1,key:c,batch:null,resolve:an,reject:an},d=new Promise((m,h)=>{var p;u.reject=h,u.resolve=m,(p=t)!==null&&p!==void 0||(t=[]),t.push(u)});return(l=n)!==null&&l!==void 0||(n=setTimeout(s)),d}return{load:i}}function sa(e){var t,n;const r=Yo(e),a=(t=e.maxURLLength)!==null&&t!==void 0?t:1/0,s=(n=e.maxItems)!==null&&n!==void 0?n:1/0;return()=>{const i=l=>({validate(u){if(a===1/0&&s===1/0)return!0;if(u.length>s)return!1;const d=u.map(h=>h.path).join(","),m=u.map(h=>h.input);return Mn(Z(Z({},r),{},{type:l,path:d,inputs:m,signal:null})).length<=a},async fetch(u){const d=u.map(g=>g.path).join(","),m=u.map(g=>g.input),h=Go(...u.map(g=>g.signal)),p=await ta(Z(Z({},r),{},{path:d,inputs:m,type:l,headers(){return e.headers?typeof e.headers=="function"?e.headers({opList:u}):e.headers:{}},signal:h}));return(Array.isArray(p.json)?p.json:u.map(()=>p.json)).map(g=>({meta:p.meta,json:g}))}}),c={query:sn(i("query")),mutation:sn(i("mutation"))};return({op:l})=>yt(u=>{if(l.type==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");const d=new AbortController,m=c[l.type].load(Z(Z({},l),{},{signal:Jo(l.signal,d.signal)}));let h=!1,p;return m.then(g=>{h=!0,p=g;const k=Bo(g.json,r.transformer.output);if(!k.ok){u.error(dt.from(k.error,{meta:g.meta}));return}u.next({context:g.meta,result:k.result}),u.complete()}).catch(g=>{h=!0,u.error(dt.from(g,{meta:p?.meta}))}),()=>{h||d.abort()}})}}const Bn=(e,...t)=>typeof e=="function"?e(...t):e;function ia(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}async function ca(e){const t=await Bn(e.url);return e.connectionParams?t+`${t.includes("?")?"&":"?"}connectionParams=1`:t}async function la(e,t){const n={method:"connectionParams",data:await Bn(e)};return t.encode(n)}function ua(e){const{promise:t,resolve:n,reject:r}=ia();return e.addEventListener("open",()=>{e.removeEventListener("error",r),n()}),e.addEventListener("error",r),t}function da(e,{intervalMs:t,pongTimeoutMs:n}){let r,a;function s(){r=setTimeout(()=>{e.send("PING"),a=setTimeout(()=>{e.close()},n)},t)}function i(){clearTimeout(r),s()}function c(){clearTimeout(a),i()}e.addEventListener("open",s),e.addEventListener("message",({data:l})=>{clearTimeout(r),s(),l==="PONG"&&c()}),e.addEventListener("close",()=>{clearTimeout(r),clearTimeout(a)})}var ma=class Tt{constructor(t){var n;if(ce(this,"id",++Tt.connectCount),ce(this,"WebSocketPonyfill",void 0),ce(this,"urlOptions",void 0),ce(this,"keepAliveOpts",void 0),ce(this,"encoder",void 0),ce(this,"wsObservable",So(null)),ce(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=++Tt.connectCount;const t=ca(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&&da(n,this.keepAliveOpts),n.addEventListener("close",()=>{this.ws===n&&(this.ws=null)}),await ua(n),this.urlOptions.connectionParams&&n.send(await la(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()}}};ce(ma,"connectCount",0);var Fn=class{constructor(e){ce(this,"links",void 0),ce(this,"runtime",void 0),ce(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=e.links.map(t=>t(this.runtime))}$request(e){var t;return To({links:this.links,op:Z(Z({},e),{},{context:(t=e.context)!==null&&t!==void 0?t:{},id:++this.requestId})}).pipe(Eo())}async requestAsPromise(e){try{const t=this.$request(e);return(await ko(t)).result.data}catch(t){throw dt.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 a;(a=n.onConnectionStateChange)===null||a===void 0||a.call(n,r.result);break;case"started":var s;(s=n.onStarted)===null||s===void 0||s.call(n,{context:r.context});break;case"stopped":var i;(i=n.onStopped)===null||i===void 0||i.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 a;(a=n.onError)===null||a===void 0||a.call(n,r)},complete(){var r;(r=n.onComplete)===null||r===void 0||r.call(n)}})}};const Wn=Symbol.for("trpc_untypedClient"),pa={query:"query",mutate:"mutation",subscribe:"subscription"},ha=e=>pa[e];function fa(e){const t=$n(({path:n,args:r})=>{const a=[...n],s=ha(a.pop()),i=a.join(".");return e[s](i,...r)});return Lo(n=>n===Wn?e:t[n])}function ga(e){return fa(new Fn(e))}function ya(e){return e[Wn]}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 va(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 ba(e){var t=va(e,"string");return Je(t)=="symbol"?t:t+""}function wa(e,t,n){return(t=ba(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function O(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?cn(Object(n),!0).forEach(function(r){wa(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cn(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function _a(e){var t,n,r,a=2;for(typeof Symbol<"u"&&(n=Symbol.asyncIterator,r=Symbol.iterator);a--;){if(n&&(t=e[n])!=null)return t.call(e);if(r&&(t=e[r])!=null)return new lt(t.call(e));n="@@asyncIterator",r="@@iterator"}throw new TypeError("Object is not async iterable")}function lt(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(a){return{value:a,done:r}})}return lt=function(r){this.s=r,this.n=r.next},lt.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(r){var a=this.s.return;return a===void 0?Promise.resolve({value:r,done:!0}):t(a.apply(this.s,arguments))},throw:function(r){var a=this.s.return;return a===void 0?Promise.reject(r):t(a.apply(this.s,arguments))}},new lt(e)}function ka(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 Ea(e,t){if(e==null)return{};var n,r,a=ka(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}const Sa=["cursor","direction"];function vt(e){return{path:e.path.join(".")}}function Ta(e){return e.length>=3}function Pa(e){return Ta(e)?{type:"prefixed",prefix:e[0],path:e[1],args:e[2]}:{type:"unprefixed",prefix:void 0,path:e[0],args:e[1]}}function qt(e,t,n){var r;const a=Pa(e);let s=(r=a.args)===null||r===void 0?void 0:r.input;if(n){var i,c;s=O(O(O({},(i=(c=a.args)===null||c===void 0?void 0:c.input)!==null&&i!==void 0?i:{}),n.pageParam!==void 0?{cursor:n.pageParam}:{}),{},{direction:n.direction})}return[a.path.join("."),s,t?.trpc]}async function Na(e,t,n){const r=t.getQueryCache().build(t,{queryKey:n});r.setState({data:[],status:"success"});const a=[];var s=!1,i=!1,c;try{for(var l=_a(e),u;s=!(u=await l.next()).done;s=!1){const d=u.value;a.push(d),r.setState({data:[...a]})}}catch(d){i=!0,c=d}finally{try{s&&l.return!=null&&await l.return()}finally{if(i)throw c}}return a}function _e(e){const t=Ao(()=>{const{input:n,type:r}=e,a=e.path.flatMap(s=>s.split("."));if(!n&&r==="any")return a.length?[a]:[];if(r==="infinite"&&Pe(n)&&("direction"in n||"cursor"in n)){const{cursor:s,direction:i}=n;return[a,{input:Ea(n,Sa),type:"infinite"}]}return[a,O(O({},typeof n<"u"&&n!==Ae&&{input:n}),r&&r!=="any"&&{type:r})]});return e.prefix&&t.unshift([e.prefix]),t}function Kn(e){const t=[e.path.flatMap(n=>n.split("."))];return e.prefix&&t.unshift([e.prefix]),t}function Dt(e){return Io(e)?e():e}function Ia(e){var t;const{input:n,query:r,path:a,queryKey:s,opts:i}=e,c=n===Ae,l=async u=>{var d;const m=O(O({},i),{},{trpc:O(O({},i?.trpc),!(i==null||(d=i.trpc)===null||d===void 0)&&d.abortOnUnmount?{signal:u.signal}:{signal:null})});return await r(...qt(s,m,{direction:u.direction,pageParam:u.pageParam}))};return Object.assign(Tr(O(O({},i??{}),{},{queryKey:s,queryFn:c?Ae:l,initialPageParam:(t=i?.initialCursor)!==null&&t!==void 0?t:n?.cursor})),{trpc:vt({path:a})})}function Ca(e){var t,n;const{mutate:r,path:a,prefix:s,opts:i,overrides:c}=e,l=Dt(e.queryClient),u=Kn({path:a,prefix:(t=i?.keyPrefix)!==null&&t!==void 0?t:s}),d=l.defaultMutationOptions(l.getMutationDefaults(u)),m=(n=c?.onSuccess)!==null&&n!==void 0?n:(p=>p.originalFn()),h=async p=>await r(...qt([...u,{input:p}],i));return O(O({},i),{},{mutationKey:u,mutationFn:h,onSuccess(...p){var g,k;return m({originalFn:()=>{var C,H,S;return(C=i==null||(H=i.onSuccess)===null||H===void 0?void 0:H.call(i,...p))!==null&&C!==void 0?C:d==null||(S=d.onSuccess)===null||S===void 0?void 0:S.call(d,...p)},queryClient:l,meta:(g=(k=i?.meta)!==null&&k!==void 0?k:d?.meta)!==null&&g!==void 0?g:{}})},trpc:vt({path:a})})}function xa(e){const{input:t,query:n,path:r,queryKey:a,opts:s}=e,i=Dt(e.queryClient),c=t===Ae,l=async u=>{var d;const m=O(O({},s),{},{trpc:O(O({},s?.trpc),!(s==null||(d=s.trpc)===null||d===void 0)&&d.abortOnUnmount?{signal:u.signal}:{signal:null})}),h=u.queryKey,p=await n(...qt(h,m));return Oo(p)?Na(p,i,h):p};return Object.assign(Pr(O(O({},s),{},{queryKey:a,queryFn:c?Ae:l})),{trpc:vt({path:r})})}const Oa=e=>{const{subscribe:t,path:n,queryKey:r,input:a,opts:s={}}=e,i="enabled"in s?!!s.enabled:a!==Ae,c=l=>t(n.join("."),a===Ae?void 0:a,l);return O(O({},s),{},{enabled:i,subscribe:c,queryKey:r,trpc:vt({path:n})})};function Aa(e){const t=e.keyPrefix,n=r=>(a,s,i)=>"router"in e?Promise.resolve(Dt(e.ctx)).then(c=>Ko({router:e.router,path:a,getRawInput:async()=>s,ctx:c,type:r,signal:void 0,batchIndex:0})):(e.client instanceof Fn?e.client:ya(e.client))[r](a,s,i);return $n(({args:r,path:a})=>{const s=[...a],i=s.pop(),[c,l]=r;return{"~types":void 0,pathKey:()=>_e({path:s,type:"any",prefix:t}),pathFilter:()=>O(O({},c),{},{queryKey:_e({path:s,type:"any",prefix:t})}),queryOptions:()=>xa({input:c,opts:l,path:s,queryClient:e.queryClient,queryKey:_e({path:s,input:c,type:"query",prefix:t}),query:n("query")}),queryKey:()=>_e({path:s,input:c,type:"query",prefix:t}),queryFilter:()=>O(O({},l),{},{queryKey:_e({path:s,input:c,type:"query",prefix:t})}),infiniteQueryOptions:()=>Ia({input:c,opts:l,path:s,queryKey:_e({path:s,input:c,type:"infinite",prefix:t}),query:n("query")}),infiniteQueryKey:()=>_e({path:s,input:c,type:"infinite",prefix:t}),infiniteQueryFilter:()=>O(O({},l),{},{queryKey:_e({path:s,input:c,type:"infinite",prefix:t})}),mutationOptions:()=>{var u;return Ca({opts:c,path:s,prefix:t,queryClient:e.queryClient,mutate:n("mutation"),overrides:(u=e.overrides)===null||u===void 0?void 0:u.mutations})},mutationKey:()=>Kn({path:s,prefix:t}),subscriptionOptions:()=>Oa({opts:l,path:s,input:c,queryKey:_e({path:s,input:c,type:"any",prefix:t}),subscribe:n("subscription")})}[i]()})}function La(){const e=be(null),t=be(null),n=s=>{const i=je(()=>Aa({client:s.trpcClient,queryClient:s.queryClient,keyPrefix:s.keyPrefix}),[s.trpcClient,s.queryClient,s.keyPrefix]);return oe(e.Provider,{value:s.trpcClient},oe(t.Provider,{value:i},s.children))};n.displayName="TRPCProvider";function r(){const s=we(t);if(!s)throw new Error("useTRPC() can only be used inside of a <TRPCProvider>");return s}function a(){const s=we(e);if(!s)throw new Error("useTRPCClient() can only be used inside of a <TRPCProvider>");return s}return{TRPCProvider:n,useTRPC:r,useTRPCClient:a}}const Pt={lan:new Set,animepahe:new Set,jasmr:new Set};function Oe(e){for(const t of[...Pt[e]])try{t()}catch(n){console.error(`auth-bus listener failed (${e}):`,n)}}function Un(e,t){return Pt[e].add(t),()=>{Pt[e].delete(t)}}let mt="default";function Hn(){return mt}function Ra(e){mt=e}const qa=new Set(["playerVideoDelayMs","playerVideoDelayEnabled","anime4kEnabled"]);function rt(e){return mt==="default"||qa.has(e)?e:`dango:profile:${mt}:${e}`}const ee={keyFor:rt,getItem:e=>localStorage.getItem(rt(e)),setItem:(e,t)=>localStorage.setItem(rt(e),t),removeItem:e=>localStorage.removeItem(rt(e))};function Da(){localStorage.setItem("dango:profile-session-change",`${Date.now()}-${Math.random()}`),window.location.assign("/")}const $a=(e,t)=>new Promise((n,r)=>{t?.throwIfAborted();const a=()=>{clearTimeout(s),r(t?.reason)},s=setTimeout(()=>{t?.removeEventListener("abort",a),n()},e);t?.addEventListener("abort",a,{once:!0})}),$t=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 a=n?.url??e.toString(),s=a.startsWith("/")&&!a.startsWith("//")||typeof window<"u"&&new URL(a,window.location.origin).origin===window.location.origin;if(s){!a.includes("/api/profiles/status")&&!a.includes("/api/profiles/login")&&!a.includes("/api/auth/app-")&&r.set("x-dango-profile-id",Hn());let m=ee.getItem("animepahe_ua"),h=ee.getItem("animepahe_cookie");h&&m&&m!==navigator.userAgent&&(ee.removeItem("animepahe_cookie"),ee.removeItem("animepahe_ua"),h=null,m=null,N.error("Your browser changed. Verify AnimePahe again to refresh its cookie."),Oe("animepahe"));const p=ee.getItem("jasmr_ua"),g=ee.getItem("jasmr_cookie");m&&r.set("x-animepahe-ua",m),h&&r.set("x-animepahe-cookie",h),p&&r.set("x-jasmr-ua",p),g&&r.set("x-jasmr-cookie",g)}new Headers(t?.headers).forEach((m,h)=>r.set(h,m));const i={...t,headers:r},c=(t?.method??n?.method??"GET").toUpperCase(),l=t?.signal??n?.signal,u=s&&(c==="GET"||c==="HEAD");let d=await fetch(e,i);s&&d.status===409&&(await d.clone().json().catch(()=>null))?.error==="PROFILE_CHANGED"&&window.location.reload(),s&&d.status===401&&!a.includes("/api/profiles/")&&(await d.clone().json().catch(()=>null))?.error==="PROFILE_AUTH_REQUIRED"&&window.dispatchEvent(new Event("dango:profile-auth-required"));for(let m=0;u&&d.status===503&&d.headers.get("x-dango-not-ready")==="1"&&m<3;m++)await d.body?.cancel(),await $a(500*2**m,l),d=await fetch(e,i);return d},De=async(e,t)=>{const n=await $t(e,t);if(!n.ok){const r=await n.text().catch(()=>"");let a={};try{a=JSON.parse(r)}catch{}const s=typeof a.error=="string"?a.error:"";throw n.status===403&&s==="AUTH_REQUIRED"&&a.provider==="animepahe"&&Oe("animepahe"),n.status===403&&s==="AUTH_REQUIRED"&&a.provider==="jasmr"&&Oe("jasmr"),n.status===401&&s==="LAN_AUTH_REQUIRED"&&Oe("lan"),new Error(s||`Failed to fetch from ${e}`)}return n.json()};async function ja(e,t){const n=await $t(e,t);if(n.status===401)try{(await n.clone().json())?.error==="LAN_AUTH_REQUIRED"&&Oe("lan")}catch{}return await Ma(n),n}async function Ma(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 a=r?.error;if(!a||typeof a!="object")continue;const s=a.data?.cause;(a.message==="AUTH_REQUIRED"||s?.code==="AUTH_REQUIRED")&&(s?.provider==="animepahe"||s?.provider==="jasmr")&&Oe(s.provider),(a.message==="LAN_AUTH_REQUIRED"||s?.code==="LAN_AUTH_REQUIRED")&&Oe("lan")}}catch{}}const{TRPCProvider:Ba,useTRPC:A}=La(),te=ga({links:[sa({url:"/api/trpc",fetch:ja})]}),Fa="_overlay_5hzq9_1",Wa="_fadeIn_5hzq9_1",Ka="_content_5hzq9_11",Ua="_modalIn_5hzq9_1",Ha="_sm_5hzq9_29",Qa="_md_5hzq9_33",za="_lg_5hzq9_37",Va="_title_5hzq9_41",Ga="_closeButton_5hzq9_48",Ja="_body_5hzq9_74",Ya="_footer_5hzq9_78",$e={overlay:Fa,fadeIn:Wa,content:Ka,modalIn:Ua,sm:Ha,md:Qa,lg:za,title:Va,closeButton:Ga,body:Ja,footer:Ya};function Qn({children:e}){return o("h2",{className:$e.title,children:e})}function zn({children:e}){return o("div",{className:$e.body,children:e})}function Vn({children:e}){return o("div",{className:$e.footer,children:e})}function Me({isOpen:e,onClose:t,title:n,children:r,footer:a,width:s="md"}){const i=q(null),[c,l]=y(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=m=>{m.key==="Escape"&&t?.()};document.addEventListener("keydown",u);const d=document.body.style.overflow;return document.body.style.overflow="hidden",i.current?.focus(),()=>{document.removeEventListener("keydown",u),document.body.style.overflow=d}},[e,t]),e?Sn(o("div",{role:"presentation",onMouseDown:u=>u.stopPropagation(),children:[o("div",{className:$e.overlay,onClick:()=>t?.(),"aria-hidden":"true"}),o("div",{ref:i,className:`${$e.content} ${$e[s]}`,role:"dialog","aria-modal":"true","aria-label":n,tabIndex:-1,children:[n&&o(Qn,{children:n}),o(zn,{children:r}),a&&o(Vn,{children:a})]})]}),c):null}Me.Header=Qn;Me.Body=zn;Me.Actions=Vn;const We=new Map,Za=500,Gn=(e,t,n)=>{if(!e||e.trim()==="")return"/placeholder.svg";if(e.includes("/api/image-proxy")){let i=e;if(t&&!i.includes("w=")){const c=i.includes("?")?"&":"?";i+=`${c}w=${t}`}if(n&&!i.includes("h=")){const c=i.includes("?")?"&":"?";i+=`${c}h=${n}`}return i}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 a=`${r}-${t}-${n}`;if(We.has(a))return We.get(a);let s;if(r.startsWith("https://s4.anilist.co"))s=r,t&&(s+=`${s.includes("?")?"&":"?"}w=${t}`),n&&(s+=`${s.includes("?")?"&":"?"}h=${n}`);else if(r.includes("animepahe")){s=`/api/image-proxy?url=${encodeURIComponent(r)}`;const i=ee.getItem("animepahe_cookie"),c=ee.getItem("animepahe_ua");i&&(s+=`&cookie=${encodeURIComponent(i)}`),c&&(s+=`&ua=${encodeURIComponent(c)}`)}else if(r.startsWith("http"))s=`/api/image-proxy?url=${encodeURIComponent(r)}`,t&&(s+=`&w=${t}`),n?s+=`&h=${n}`:t||(s+="&w=300");else{const c=`${r.startsWith("mcovers")||r.startsWith("images2")?"https://aln.youtube-anime.com":"https://aln.youtube-anime.com/images"}/${r}`;s=`/api/image-proxy?url=${encodeURIComponent(c)}`,t&&(s+=`&w=${t}`),n?s+=`&h=${n}`:t||(s+="&w=300")}return We.size>Za&&We.clear(),We.set(a,s),s},wu=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 _u(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 ku(e){return e==null?e:e>10?Number((e/10).toFixed(1)):e}const Xa=(...e)=>e.filter(Boolean).join(" ");function es(e,t,n="..."){return e?e.length>t?e.slice(0,t)+n:e:""}const Jn=be(void 0),Yn=()=>{const e=we(Jn);if(e===void 0)throw new Error("useTitlePreference must be used within a TitlePreferenceProvider");return e},I={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"},Eu=()=>{const e=A(),t=j({...e.data.spotlight.queryOptions(),staleTime:1e3*60*5,retry:1});return{...t,data:t.data}},Su=(e="TRENDING_DESC",t=10)=>ht({queryKey:[I.trendingList,e,t],queryFn:({pageParam:n=1})=>te.data.popularList.query({sort:e,page:n,size:t}),initialPageParam:1,getNextPageParam:(n,r)=>n.length>=t?r.length+1:void 0}),Tu=(e="TV",t=12)=>ht({queryKey:[I.latestReleases,e,t],queryFn:({pageParam:n=1})=>te.data.latestReleases.query({format:e,page:n,size:t}),initialPageParam:1,getNextPageParam:(n,r)=>n.length>=t?r.length+1:void 0}),Pu=(e,t="TV",n=!0)=>{const r=A();return j({...r.data.seasonal.queryOptions({page:e,format:t}),enabled:n,staleTime:1e3*60*5})},ts=["query","sortBy","type","status","season","year","country","genres","excludeGenres","excludeTags","minScore","minEpisodes","adult"],Nu=(e,t,n=14)=>{const r=A(),a=new URLSearchParams(e),s={page:t,limit:n};for(const i of ts){const c=a.get(i);c!==null&&(s[i]=c)}return j({...r.data.search.queryOptions(s),enabled:e!=null})},Iu=()=>{const e=A();return j(e.queue.list.queryOptions())},ns=()=>{const e=A(),t=ae();return pe(e.queue.add.mutationOptions({onSuccess:n=>{n.queued?N.success("Added to queue"):N.success("Removed from queue"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[I.queueRemaining]})},onError:n=>{N.error(`Failed to update queue: ${n.message}`)}}))},Cu=()=>{const e=A(),t=ae();return pe(e.queue.remove.mutationOptions({onSuccess:()=>{N.success("Removed from queue"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[I.queueRemaining]}),t.invalidateQueries({queryKey:[I.continueWatching]})},onError:n=>{N.error(`Failed to remove: ${n.message}`)}}))},xu=(e,t=!0)=>j({queryKey:[I.queueRemaining,e],queryFn:()=>te.watchlist.queueRemaining.query({showId:e}),enabled:!!e&&t,staleTime:1e3*60}),Ou=()=>{const e=A(),t=ae();return pe(e.queue.addBatch.mutationOptions({onSuccess:(n,r)=>{const a=n.added??r.episodeNumbers.length;N.success(`${a} ${a===1?"episode":"episodes"} added to queue`),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[I.queueRemaining]})},onError:n=>{N.error(`Failed to update queue: ${n.message}`)}}))},Au=()=>{const e=A(),t=ae();return pe(e.queue.removeMany.mutationOptions({onSuccess:()=>{N.success("Removed from queue"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[I.queueRemaining]}),t.invalidateQueries({queryKey:[I.continueWatching]})},onError:n=>{N.error(`Failed to remove: ${n.message}`)}}))},Lu=()=>{const e=A(),t=ae();return pe(e.queue.clear.mutationOptions({onSuccess:()=>{N.success("Queue cleared"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[I.queueRemaining]}),t.invalidateQueries({queryKey:[I.continueWatching]})},onError:n=>{N.error(`Failed to clear queue: ${n.message}`)}}))},Ru=()=>{const e=A(),t=ae(),n=e.queue.list.queryOptions().queryKey;return pe(e.queue.reorder.mutationOptions({onMutate:async r=>{await t.cancelQueries({queryKey:n});const a=t.getQueryData(n);return t.setQueryData(n,s=>{if(!s)return s;const i=new Map(s.map(c=>[c.id,c]));return r.map((c,l)=>{const u=i.get(c.id??-1);return u?{...u,queue_order:l}:void 0}).filter(c=>!!c)}),{previousQueue:a}},onError:(r,a,s)=>{s?.previousQueue&&t.setQueryData(n,s.previousQueue)},onSettled:()=>{t.invalidateQueries(e.queue.pathFilter())}}))},rs=["status","showMature","query","type","season","year","genres","excludeGenres","sortBy","titlePreference"];function jt(e,t,n){const r=new URLSearchParams(e),a={page:t,limit:n};for(const s of rs){const i=r.get(s);i!==null&&(a[s]=i)}return a}const qu=(e,t="",n,r=14)=>j({queryKey:[I.watchlist,e,t,n,r],queryFn:async()=>{const a=new URLSearchParams(t);return a.set("status",e),await te.watchlist.list.query(jt(a.toString(),n,r))}}),Du=(e="")=>ht({queryKey:[I.continueWatching,e],queryFn:async({pageParam:t=1})=>await te.watchlist.continueWatchingAll.query(jt(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)})}),$u=(e="",t,n=14)=>j({queryKey:[I.continueWatching,e,t,n],queryFn:async()=>await te.watchlist.continueWatchingAll.query(jt(e,t,n))}),ju=()=>{const e=A(),t=ae();return pe(e.watchlist.remove.mutationOptions({onSuccess:()=>{N.success("Removed from watchlist"),t.invalidateQueries(e.watchlist.pathFilter()),t.invalidateQueries({queryKey:[I.watchlist]})},onError:n=>{N.error(`Failed to remove: ${n.message}`)}}))},Mu=()=>{const e=A(),t=ae();return pe(e.watchlist.batchStatus.mutationOptions({onSuccess:n=>{N.success(`Status updated for ${n.updated??0} items`),t.invalidateQueries(e.watchlist.pathFilter()),t.invalidateQueries({queryKey:[I.watchlist]}),t.invalidateQueries({queryKey:[I.continueWatching]})},onError:n=>{N.error(`Failed to update statuses: ${n.message}`)}}))},Bu=()=>{const e=A(),t=ae();return pe(e.watchlist.removeMany.mutationOptions({onSuccess:n=>{const r=n.removed??0;N.success(`Removed ${r} ${r===1?"item":"items"} from watchlist`),t.invalidateQueries(e.watchlist.pathFilter()),t.invalidateQueries({queryKey:[I.watchlist]}),t.invalidateQueries({queryKey:[I.continueWatching]})},onError:n=>{N.error(`Failed to remove: ${n.message}`)}}))},Fu=()=>{const e=A(),t=ae();return pe(e.continueWatching.removeMany.mutationOptions({onSuccess:n=>{const r=n.removed??0;N.success(`Removed ${r} ${r===1?"item":"items"} from continue watching`),t.invalidateQueries(e.continueWatching.pathFilter()),t.invalidateQueries({queryKey:[I.continueWatching]})},onError:n=>{N.error(`Failed to remove: ${n.message}`)}}))},Zn=(e=!0)=>{const t=A();return j({...t.notifications.list.queryOptions(),enabled:e,refetchInterval:3e4})},Xn=(e=!0)=>{const t=A();return j({...t.data.systemNotifications.queryOptions(),enabled:e,refetchInterval:3e4})},er=(e=!0)=>{const t=A();return j({...t.discovery.status.queryOptions(),enabled:e,refetchInterval:n=>n.state.data?.running?2e3:!1})},os=()=>{const e=A(),t=ae(),n=e.discovery.status.queryOptions().queryKey;return pe(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:[I.notifications]})},onError:()=>{t.invalidateQueries({queryKey:n})}}))},as=()=>{const e=A(),t=ae();return pe(e.notifications.dismiss.mutationOptions({onSuccess:()=>{t.invalidateQueries(e.notifications.pathFilter())}}))},ss=()=>{const e=A(),t=ae();return pe(e.notifications.clearAll.mutationOptions({onSuccess:()=>{t.invalidateQueries(e.notifications.pathFilter())}}))},Wu=()=>{const e=A();return j({...e.continueWatching.thisWeek.queryOptions(),staleTime:1e3*60*5})},Ku=()=>{const e=A();return j({...e.data.genresAndTags.queryOptions(),staleTime:1e3*60*60})},Uu=()=>j({queryKey:[I.genreCards],queryFn:()=>te.insights.genreCards.query()}),is="_container_jzirm_1",cs="_bellBtn_jzirm_7",ls="_badge_jzirm_39",us="_dropdown_jzirm_67",ds="_dropdownHeader_jzirm_98",ms="_headerSubtitle_jzirm_106",ps="_headerActions_jzirm_113",hs="_closeBtn_jzirm_119",fs="_sectionHeading_jzirm_132",gs="_clearAllBtn_jzirm_148",ys="_discoveryStatusRow_jzirm_166",vs="_statusDot_jzirm_177",bs="_statusDotRunning_jzirm_184",ws="_statusDotOk_jzirm_189",_s="_statusDotError_jzirm_197",ks="_statusDotIdle_jzirm_201",Es="_list_jzirm_216",Ss="_item_jzirm_230",Ts="_itemTitleLink_jzirm_241",Ps="_systemItemMeta_jzirm_248",Ns="_removeItem_jzirm_249",Is="_modalButton_jzirm_251",Cs="_systemItem_jzirm_248",xs="_systemIcon_jzirm_264",Os="_thumbWrap_jzirm_275",As="_thumbnail_jzirm_284",Ls="_itemInfo_jzirm_293",Rs="_itemTitle_jzirm_241",qs="_itemMeta_jzirm_309",Ds="_queueItem_jzirm_374",$s="_fullMessage_jzirm_388",js="_emptyState_jzirm_394",Ms="_emptyIcon_jzirm_412",E={container:is,bellBtn:cs,badge:ls,dropdown:us,dropdownHeader:ds,headerSubtitle:ms,headerActions:ps,closeBtn:hs,sectionHeading:fs,clearAllBtn:gs,discoveryStatusRow:ys,statusDot:vs,statusDotRunning:bs,statusDotOk:ws,statusDotError:_s,statusDotIdle:ks,list:Es,item:Ss,itemTitleLink:Ts,systemItemMeta:Ps,removeItem:Ns,modalButton:Is,systemItem:Cs,systemIcon:xs,thumbWrap:Os,thumbnail:As,itemInfo:Ls,itemTitle:Rs,itemMeta:qs,queueItem:Ds,fullMessage:$s,emptyState:js,emptyIcon:Ms},Bs=({notification:e})=>{const t=as(),n=ns(),[r,a]=Lt.useState(!1),s=u=>{u.preventDefault(),u.stopPropagation(),t.mutate({showId:e.showId,episodeNumber:e.episodeNumber})},i=u=>{u.preventDefault(),u.stopPropagation(),a(!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(()=>a(!1),1e3)},{titlePreference:c}=Yn(),l=c==="nativeName"?e.nativeName||e.name:c==="englishName"&&e.englishName||e.name;return o("div",{className:E.item,children:[o("span",{className:E.thumbWrap,children:o(Rn,{src:Gn(e.thumbnail,48,64),alt:e.name,className:E.thumbnail,loading:"lazy",decoding:"async"})}),o("div",{className:E.itemInfo,children:[o(me,{to:`/watch/${e.showId}/${e.episodeNumber}`,className:E.itemTitleLink,onClick:()=>t.mutate({showId:e.showId,episodeNumber:e.episodeNumber}),children:o("span",{className:E.itemTitle,children:l})}),o("span",{className:E.itemMeta,children:["New Episode ",e.episodeNumber]})]}),o("button",{className:`${E.removeItem} ${E.queueItem}`,onClick:i,title:"Add to queue","aria-label":"Add notification to queue",children:r?o(P,{name:"check"}):o(P,{name:"plus"})}),o("button",{className:E.removeItem,onClick:s,title:"Dismiss","aria-label":"Remove notification",children:o(P,{name:"times"})})]})};function _t({width:e="100%",height:t="1em",variant:n="rectangular",className:r="",style:a}){return o("div",{className:`skeleton skeleton-${n} ${r}`,style:{width:e,height:t,...a}})}const Fs=({count:e=3})=>o(ye,{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(_t,{width:"100%",height:"100%",variant:"rectangular"})}),o("div",{className:E.itemInfo,children:[o(_t,{width:"80%",height:"1rem",variant:"text",style:{marginBottom:"4px"}}),o(_t,{width:"40%",height:"0.7rem",variant:"rectangular",style:{borderRadius:"var(--radius-sm)"}})]})]},n))}),Ws=({onClose:e})=>{const{data:t=[],isLoading:n}=Zn(),{data:r=[]}=Xn(),{data:a}=er(),s=ss(),i=ae(),[c,l]=y(null),u=q(null);w(()=>{u.current?.focus();const p=g=>{g.key==="Escape"&&e()};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[e]),w(()=>{i.invalidateQueries({queryKey:[I.notifications]})},[i]);const d=r.find(p=>p.id===c)??null,m=t.length+r.length,h=a?.running?a.total>0?`Checking ${Math.min(a.done,a.total)}/${a.total} shows...`:"Checking for new episodes...":a?.state==="complete"?`Discovery complete · checked ${a.total} ${a.total===1?"show":"shows"}`:a?.state==="empty"?"No shows set to Watching":a?.state==="error"?"Last check failed · will retry automatically":a?.lastRunAt?`Last checked ${Math.max(1,Math.round((Date.now()-a.lastRunAt)/1e3))}s ago`:"Auto-checks every few minutes";return o("div",{id:"notification-panel",ref:u,className:E.dropdown,role:"dialog","aria-label":"Notifications",tabIndex:-1,children:[o("div",{className:E.dropdownHeader,children:[o("div",{children:[o("h4",{children:"Notifications"}),o("span",{className:E.headerSubtitle,children:[m," updates"]})]}),o("div",{className:E.headerActions,children:[t.length>0&&o("button",{className:E.clearAllBtn,onClick:()=>s.mutate(void 0),children:"Clear all"}),o("button",{type:"button",className:E.closeBtn,onClick:e,title:"Close","aria-label":"Close notifications",children:o(P,{name:"times"})})]})]}),o("div",{className:E.discoveryStatusRow,children:[o("span",{className:`${E.statusDot} ${a?.running?E.statusDotRunning:a?.state==="complete"?E.statusDotOk:a?.state==="error"?E.statusDotError:E.statusDotIdle}`,"aria-hidden":"true"}),o("span",{children:h})]}),o("div",{className:E.list,children:n&&m===0?o(Fs,{count:4}):o(ye,{children:[r.length>0&&o("section",{"aria-labelledby":"system-notifications-heading",children:[o("h5",{id:"system-notifications-heading",className:E.sectionHeading,children:"App updates"}),r.map(p=>o("div",{className:`${E.item} ${E.systemItem}`,children:[o("div",{className:E.systemIcon,children:o(P,{name:"info-circle",size:20})}),o("div",{className:E.itemInfo,children:[o("span",{className:E.itemTitle,children:p.title}),o("button",{type:"button",className:E.systemItemMeta,onClick:()=>l(p.id),title:"View full message",children:[es(p.message,72,"…")," ",o("span",{children:"Read more"})]})]})]},p.id))]}),t.length>0&&o("section",{"aria-labelledby":"new-episodes-heading",children:[o("h5",{id:"new-episodes-heading",className:E.sectionHeading,children:"New episodes"}),t.map(p=>o(Bs,{notification:p},p.id))]}),!n&&m===0&&o("div",{className:E.emptyState,children:[o("span",{className:E.emptyIcon,children:o(P,{name:"bell",size:22})}),o("strong",{children:"You’re all caught up"}),o("span",{children:"New episode alerts and app updates will show up here."})]})]})}),o(Me,{isOpen:!!d,onClose:()=>l(null),title:d?.title,width:"sm",footer:o("button",{type:"button",className:E.modalButton,onClick:()=>l(null),children:"OK"}),children:d&&o("p",{className:E.fullMessage,children:d.message})})]})},Ks="notification-panel",Us=()=>{const[e,t]=y(!1),n=q(null),r=ae(),a=A(),s=os(),{data:i=[]}=Zn(),{data:c=[]}=Xn(),{data:l}=er(),u=i.length+c.length,d=u>9?"9+":u,m=q(!1);w(()=>{const p=g=>{n.current&&!n.current.contains(g.target)&&t(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[]),w(()=>{const p=!!l?.running;m.current&&!p&&(r.invalidateQueries(a.notifications.pathFilter()),r.invalidateQueries(a.discovery.pathFilter()),r.invalidateQueries({queryKey:[I.continueWatching]}),r.invalidateQueries({queryKey:[I.thisWeekSchedule]}),r.invalidateQueries(a.continueWatching.pathFilter()),r.invalidateQueries({queryKey:[I.notifications]})),m.current=p},[l?.running,r,a]);const h=()=>{const p=!e;t(p),p&&s.mutate()};return o("div",{className:E.container,ref:n,children:[o("button",{className:E.bellBtn,onClick:h,"aria-haspopup":"dialog","aria-expanded":e,"aria-controls":Ks,"aria-label":"Notifications",children:[o(P,{name:"bell"}),u>0&&o("span",{className:E.badge,"aria-hidden":"true",children:d})]}),e&&o(Ws,{onClose:()=>t(!1)})]})},Hs="_logo_177ls_1",Qs="_ball_177ls_8",zs="_eyes_177ls_15",Vs="_word_177ls_22",Ke={logo:Hs,ball:Qs,eyes:zs,word:Vs},pt=({className:e,collapsed:t})=>o("svg",{viewBox:t?"0 0 90 91":"0 0 271 91",className:e?`${Ke.logo} ${e}`:Ke.logo,role:"img","aria-label":"dango",children:[o("title",{children:"dango"}),o("circle",{className:Ke.ball,cx:"45",cy:"45.5",r:"39"}),o("path",{className:Ke.eyes,d:"M36 36.5v18M54 36.5v18"}),!t&&o("text",{className:Ke.word,x:"97",y:"67",children:"dango"})]}),tr=be(void 0),Mt=()=>{const e=we(tr);if(e===void 0)throw new Error("useSidebar must be used within a SidebarProvider");return e},nr=be(void 0),rr=()=>{const e=we(nr);if(e===void 0)throw new Error("useContentType must be used within a ContentTypeProvider");return e},Nt="virtual-keyboard:hide",ln="virtual-keyboard:enabled-change",or="virtual_keyboard_enabled",Gs=!1;function un(){const e=ee.getItem(or);return e===null?Gs:e==="true"}const dn=e=>e instanceof HTMLInputElement&&e.type==="text"&&!e.disabled&&!e.readOnly;function Js(){window.dispatchEvent(new CustomEvent(Nt))}function Ys(){const[e,t]=y(!1),[n,r]=y(un),a=q(null);return w(()=>{const s=d=>{n&&dn(d.target)&&(a.current=d.target,t(!0))},i=d=>{d.target===a.current&&window.setTimeout(()=>{if(dn(document.activeElement)){a.current=document.activeElement,t(!0);return}a.current=null,t(!1)},0)},c=()=>{a.current=null,t(!1)},l=d=>{if(d.key!==or)return;const m=d.newValue==="true";r(m),m||c()},u=()=>{const d=un();r(d),d||c()};return document.addEventListener("focusin",s),document.addEventListener("focusout",i),window.addEventListener(Nt,c),window.addEventListener("storage",l),window.addEventListener(ln,u),()=>{document.removeEventListener("focusin",s),document.removeEventListener("focusout",i),window.removeEventListener(Nt,c),window.removeEventListener("storage",l),window.removeEventListener(ln,u)}},[n]),{activeInputRef:a,isVisible:n&&e,hide:()=>t(!1)}}const Zs={queryKey:[I.syncProfile],queryFn:()=>De("/api/profiles/current"),staleTime:3e4};function It({image:e,name:t,size:n=72,radius:r="50%"}){const[a,s]=y(!1);w(()=>s(!1),[e]);const i={width:"100%",height:"100%",maxWidth:n,maxHeight:n,aspectRatio:"1",objectFit:"cover",borderRadius:r};return e&&!a?o("img",{src:e,alt:t,referrerPolicy:"no-referrer",onError:()=>s(!0),style:i}):o("svg",{viewBox:"0 0 24 24",role:"img","aria-label":t,style:i,fill:"currentColor",children:[o("circle",{cx:"12",cy:"8",r:"4"}),o("path",{d:"M4 21v-2a8 8 0 0 1 16 0v2z"})]})}const Bt=e=>String(e).toLowerCase()==="movie"?"movie":"tv",Hu=(e,t)=>`${Bt(e)}:${t}`,Xs=(e,t)=>{const n=Bt(e);return`/tv/${t}?type=${n}`},ei=(e,t,n,r)=>{const a=new URLSearchParams;return a.set("type",Bt(e)),n!==void 0&&a.set("s",String(n)),r!==void 0&&a.set("e",String(r)),`/tv/${t}/watch?${a.toString()}`},Qu=e=>e.adult===!0||e.adult===1,zu={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"},Vu={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"},Ft=300*1e3,ti={mangadex:"https://mangadex.org/",mangapill:"https://www.mangapill.com/"},ni="Dango/3.0 (+https://github.com/serifpersia/dango)",ri=(e,t)=>`/api/proxy?url=${encodeURIComponent(t)}&referer=${encodeURIComponent(ti[e])}`,oi=(e,t)=>t&&(e==="mangadex"?`/api/image-proxy?url=${encodeURIComponent(t)}&ua=${encodeURIComponent(ni)}`:e==="mangapill"?ri(e,t):t),Gu=(e,t=!0)=>{const{provider:n,query:r,page:a,sort:s,status:i,type:c,rating:l,mature:u}=e;return j({queryKey:[I.mangaBrowse,n,r,a,s,i,c,l,u],queryFn:()=>te.manga.search.query({provider:n,q:r.trim()||void 0,page:a,sort:s||void 0,status:i||void 0,type:c||void 0,rating:l||void 0,mature:u?"1":void 0}),staleTime:Ft,enabled:t})},Ju=(e,t=14)=>{const{provider:n,query:r,sort:a,status:s,type:i,rating:c,mature:l}=e;return ht({queryKey:[I.mangaBrowseInfinite,n,r,a,s,i,c,l,t],queryFn:({pageParam:u=1})=>te.manga.search.query({provider:n,q:r.trim()||void 0,page:u,limit:t,sort:a||void 0,status:s||void 0,type:i||void 0,rating:c||void 0,mature:l?"1":void 0}),initialPageParam:1,getNextPageParam:(u,d)=>u.hasNext?d.length+1:void 0,staleTime:Ft,enabled:!0})},Yu=(e,t,n="safe",r=!1)=>j({queryKey:[I.mangaDetail,e,t,n,r],queryFn:()=>te.manga.info.query({provider:e||"",id:t||"",rating:n,mature:r?"1":void 0}),enabled:!!e&&!!t,staleTime:Ft}),Zu=(e,t,n)=>j({queryKey:[I.mangaPages,e,t],queryFn:()=>te.manga.pages.query({provider:e||"",id:t||""}),enabled:!!e&&!!t,staleTime:1800*1e3}),Xu=()=>{const e=A(),t=j({...e.manga.trending.queryOptions(),staleTime:600*1e3,retry:1});return{...t,data:t.data}};function ai(e){return String(e||"").trim().toUpperCase()}function mn(e){return ai(e.id||e._id||"")}function ed(e){return!!e.isAdult}const si="_header_l1ojw_1",ii="_hidden_l1ojw_24",ci="_scrolled_l1ojw_28",li="_logo_l1ojw_37",ui="_logoCollapsed_l1ojw_53",di="_headerInner_l1ojw_57",mi="_leftSection_l1ojw_67",pi="_desktopNav_l1ojw_73",hi="_navLink_l1ojw_86",fi="_navLinkActive_l1ojw_105",gi="_navPill_l1ojw_111",yi="_rightSection_l1ojw_129",vi="_searchWrapper_l1ojw_135",bi="_searchIconButton_l1ojw_162",wi="_searchIcon_l1ojw_162",_i="_searchInput_l1ojw_189",ki="_searchKbd_l1ojw_222",Ei="_searchKbdHidden_l1ojw_240",Si="_searchButton_l1ojw_245",Ti="_profileBtn_l1ojw_255",Pi="_profileAvatar_l1ojw_290",Ni="_profileName_l1ojw_297",Ii="_hamburgerBtn_l1ojw_306",Ci="_searchDropdown_l1ojw_334",xi="_searchDropdownNoBar_l1ojw_366",Oi="_searchDropdownHeader_l1ojw_374",Ai="_searchDropdownQuery_l1ojw_382",Li="_searchDropdownSeeAll_l1ojw_388",Ri="_searchDropdownList_l1ojw_405",qi="_searchDropdownItem_l1ojw_419",Di="_searchDropdownThumb_l1ojw_437",$i="_searchDropdownItemInfo_l1ojw_446",ji="_searchDropdownItemTitle_l1ojw_453",Mi="_searchDropdownItemMeta_l1ojw_462",Bi="_mobileSearchBar_l1ojw_501",Fi="_searchIconMobile_l1ojw_572",Wi="_mobileSearchBarHidden_l1ojw_599",Ki="_mobileSearchInner_l1ojw_616",Ui="_mobileSearchIcon_l1ojw_632",Hi="_mobileSearchInput_l1ojw_639",Qi="_logoFull_l1ojw_700",b={header:si,hidden:ii,scrolled:ci,logo:li,logoCollapsed:ui,headerInner:di,leftSection:mi,desktopNav:pi,navLink:hi,navLinkActive:fi,navPill:gi,rightSection:yi,searchWrapper:vi,searchIconButton:bi,searchIcon:wi,searchInput:_i,searchKbd:ki,searchKbdHidden:Ei,searchButton:Si,profileBtn:Ti,profileAvatar:Pi,profileName:Ni,hamburgerBtn:Ii,searchDropdown:Ci,searchDropdownNoBar:xi,searchDropdownHeader:Oi,searchDropdownQuery:Ai,searchDropdownSeeAll:Li,searchDropdownList:Ri,searchDropdownItem:qi,searchDropdownThumb:Di,searchDropdownItemInfo:$i,searchDropdownItemTitle:ji,searchDropdownItemMeta:Mi,mobileSearchBar:Bi,searchIconMobile:Fi,mobileSearchBarHidden:Wi,mobileSearchInner:Ki,mobileSearchIcon:Ui,mobileSearchInput:Hi,logoFull:Qi},pn=300*1e3,zi=()=>{const{toggleSidebar:e}=Mt(),{contentType:t}=rr(),n=A(),{titlePreference:r}=Yn(),[a,s]=y(""),[i,c]=y(""),[l,u]=y(!0),[d,m]=y(!1),[h,p]=y(!0),[g,k]=y(!1),[M,C]=y({left:0,width:0,opacity:0}),[H,S]=y(!1),x=Tn(),W=Ye(),B=q(null),se=q(!1),v=q(null),L=q(null),D=q(null),Q=q(null),le=q(!1),ne=q(null),ue=q(null),G=q(null),{data:J}=j(Zs),$=i.length>=2,{data:fe}=j({...n.data.search.queryOptions({query:i,page:1,limit:6}),enabled:$&&t==="anime"}),{data:Xe}=j({...n.tv.search.queryOptions({q:i,page:1,type:"multi"}),enabled:$&&t==="tv"}),{data:Ie}=j({queryFn:()=>te.manga.search.query({q:i,page:1,limit:6,rating:"safe"}),queryKey:[I.mangaBrowse,"",i,1,"","","","safe",!1],staleTime:pn,enabled:$&&t==="manga"}),{data:_}=j({queryFn:()=>te.asmr.browse.query({q:i,page:1}),queryKey:[I.asmrBrowse,i,1,"",""],staleTime:pn,enabled:$&&t==="asmr"}),X=t==="anime"?(fe??[]).map(f=>({key:String(f.id),name:r==="nativeName"?f.nativeName||f.name:r==="englishName"&&f.englishName||f.name,meta:f.year,thumb:f.thumbnail?Gn(f.thumbnail,48,64):void 0,href:`/anime/${f.id}`})):t==="tv"?(Xe?.results??[]).map(f=>({key:`${f.type}-${f.id}`,name:f.title,meta:f.year,thumb:f.image||void 0,href:Xs(f.type,f.id)})):t==="manga"?(Ie?.items??[]).map(f=>({key:`${f.provider}-${f.id}`,name:f.title,meta:f.year,thumb:f.cover?oi(f.provider,f.cover):void 0,href:`/manga/${f.provider}/${encodeURIComponent(f.id)}`})):(_?.shows??[]).map(f=>({key:mn(f),name:f.name,thumb:f.thumbnail||void 0,href:`/asmr/${encodeURIComponent(mn(f))}`}));w(()=>{const f=window.visualViewport;if(!f)return;const re=()=>{Q.current?.style.setProperty("--vv-top",`${f.offsetTop}px`)};return re(),f.addEventListener("scroll",re),f.addEventListener("resize",re),()=>{f.removeEventListener("scroll",re),f.removeEventListener("resize",re)}},[]),w(()=>{const f=()=>{B.current&&(window.clearTimeout(B.current),B.current=null)},re=()=>{f(),!(window.scrollY<=10||d)&&(B.current=window.setTimeout(()=>{le.current||u(!1)},2500))},et=()=>{se.current||(se.current=!0,v.current=requestAnimationFrame(()=>{se.current=!1,v.current=null;const de=window.scrollY<=10;p(Ee=>Ee===de?Ee:de),u(Ee=>Ee||!0),re()}))},Fe=de=>{const Ee=de.target,gr=Ee instanceof HTMLElement&&!!Ee.closest('input, textarea, select, button, a, [role="button"], [contenteditable="true"]'),Vt=()=>{f(),u(!0),window.innerWidth<=1200?(k(!0),setTimeout(()=>D.current?.focus({preventScroll:!0}),50)):setTimeout(()=>z.current?.focus({preventScroll:!0}),10)};de.key.toLowerCase()==="s"&&!de.metaKey&&!de.ctrlKey&&!de.altKey&&!gr||(de.metaKey||de.ctrlKey)&&de.key==="k"?(de.preventDefault(),Vt()):de.key==="Escape"&&document.activeElement===z.current&&z.current?.blur()},qe=Q.current,Qt=()=>{le.current=!0},zt=()=>{le.current=!1,re()};return window.addEventListener("scroll",et,{passive:!0}),window.addEventListener("keydown",Fe),qe?.addEventListener("pointerenter",Qt),qe?.addEventListener("pointerleave",zt),()=>{window.removeEventListener("scroll",et),window.removeEventListener("keydown",Fe),qe?.removeEventListener("pointerenter",Qt),qe?.removeEventListener("pointerleave",zt),f(),v.current!==null&&(cancelAnimationFrame(v.current),v.current=null),se.current=!1}},[d]);const z=Lt.useRef(null);w(()=>{if(ne.current&&window.clearTimeout(ne.current),!a.trim()||a.trim().length<2){c(""),S(!1);return}return ne.current=window.setTimeout(()=>{c(a.trim()),d&&S(!0)},500),()=>{ne.current&&window.clearTimeout(ne.current)}},[a,d]);const he=V(()=>{S(!1)},[]);w(()=>{S(!1),k(!1)},[W.pathname,W.search]),w(()=>{const f=ue.current;if(!f)return;const re=f.querySelector(`.${b.navLinkActive}`);if(!re){C(qe=>({...qe,opacity:0}));return}const et=f.getBoundingClientRect(),Fe=re.getBoundingClientRect();C({left:Fe.left-et.left,width:Fe.width,opacity:1})},[W.pathname]);const Le=()=>window.innerWidth<=1200,Ht=()=>{u(!0),Le()?(k(!0),setTimeout(()=>D.current?.focus({preventScroll:!0}),50)):z.current?.focus({preventScroll:!0})},Re=f=>{L.current?.contains(f.relatedTarget)||(k(!1),he())},Ce=t==="manga"?"Search manga...":t==="tv"?"Search TV & movies...":t==="asmr"?"Search ASMR...":"Search anime...",Be=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"},xe=f=>{Js();const re=a.trim();re&&(he(),z.current?.blur(),m(!1),x(t==="manga"?`/manga?q=${encodeURIComponent(re)}`:t==="tv"?`/tv-search?q=${encodeURIComponent(re)}`:t==="asmr"?`/asmr?q=${encodeURIComponent(re)}`:`/search?query=${encodeURIComponent(re)}`))};return o(ye,{children:o("header",{ref:Q,className:`${b.header} ${l?"":b.hidden} ${h?"":b.scrolled}`,children:[o("div",{className:b.headerInner,children:[o("div",{className:b.leftSection,children:[o("button",{className:b.hamburgerBtn,onClick:e,"aria-label":"Menu",children:o(P,{name:"bars"})}),o(me,{to:"/",className:b.logo,"aria-label":"Ani-Web Home",children:[o(pt,{className:b.logoFull}),o(pt,{collapsed:!0,className:b.logoCollapsed})]}),o("nav",{className:b.desktopNav,ref:ue,children:[o("span",{className:b.navPill,style:M,"aria-hidden":"true"}),o(me,{to:"/",className:`${b.navLink} ${W.pathname==="/"?b.navLinkActive:""}`,children:"Home"}),o(me,{to:Be.to,className:`${b.navLink} ${W.pathname.startsWith(Be.to)?b.navLinkActive:""}`,children:Be.label}),t==="anime"&&o(me,{to:"/insights",className:`${b.navLink} ${W.pathname==="/insights"?b.navLinkActive:""}`,children:"Insights"})]})]}),o("div",{className:b.rightSection,children:[o("div",{className:b.searchWrapper,ref:G,onClick:()=>z.current?.focus(),children:[o("button",{type:"button",className:b.searchIconButton,"aria-label":"Search",onMouseDown:f=>f.preventDefault(),onClick:f=>{f.stopPropagation(),xe()},children:o(P,{name:"search",className:b.searchIcon})}),o("input",{ref:z,type:"text","data-virtual-keyboard":"true",className:b.searchInput,placeholder:Ce,value:a,onChange:f=>s(f.currentTarget.value),onFocus:()=>{m(!0),u(!0),i.length>=2&&S(!0)},onBlur:f=>{m(!1),G.current?.contains(f.relatedTarget)||he()},onKeyDown:f=>{f.key==="Enter"?xe():f.key==="Escape"&&(he(),z.current?.blur())}}),o("span",{className:`${b.searchKbd} ${a||d?b.searchKbdHidden:""}`,"aria-hidden":"true",children:"Ctrl K"}),o("button",{type:"button",className:b.searchButton,"aria-label":"Search",onMouseDown:f=>f.preventDefault(),onClick:f=>{f.stopPropagation(),Ht()},children:o(P,{name:"search",className:b.searchIconMobile})}),H&&X.length>0&&o("div",{className:`${b.searchDropdown} ${g?"":b.searchDropdownNoBar}`,onMouseDown:f=>f.preventDefault(),onClick:f=>f.stopPropagation(),children:[o("div",{className:b.searchDropdownHeader,children:[o("span",{className:b.searchDropdownQuery,children:["Results for “",i,"”"]}),o("button",{className:b.searchDropdownSeeAll,onClick:()=>{he(),k(!1),m(!1),xe()},children:"See all"})]}),o("div",{className:b.searchDropdownList,children:X.map(f=>o("button",{className:b.searchDropdownItem,onClick:()=>{he(),k(!1),m(!1),s(""),z.current?.blur(),x(f.href)},children:[f.thumb&&o(Rn,{src:f.thumb,alt:f.name,className:b.searchDropdownThumb,loading:"lazy",decoding:"async"}),o("div",{className:b.searchDropdownItemInfo,children:[o("span",{className:b.searchDropdownItemTitle,children:f.name}),f.meta&&o("span",{className:b.searchDropdownItemMeta,children:f.meta})]})]},f.key))})]})]}),o(Us,{}),o(me,{to:"/settings",className:b.profileBtn,"aria-label":`${J?.name??"Profile"} — profile settings`,title:`${J?.name??"Profile"}${J?.owner?" (owner)":""} — profile settings`,children:[o("span",{className:b.profileAvatar,"aria-hidden":"true",children:o(It,{image:J?.image,name:J?.name??"Profile"})}),o("span",{className:b.profileName,children:J?.name??"Profile"})]})]})]}),g&&o("div",{className:`${b.mobileSearchBar} ${l?"":b.mobileSearchBarHidden}`,ref:L,onBlur:Re,children:o("div",{className:b.mobileSearchInner,children:[o(P,{name:"search",className:b.mobileSearchIcon}),o("input",{ref:D,type:"text","data-virtual-keyboard":"true",className:b.mobileSearchInput,placeholder:Ce,value:a,onChange:f=>s(f.currentTarget.value),onFocus:()=>{m(!0),u(!0)},onBlur:()=>m(!1),onKeyDown:f=>{f.key==="Enter"?(xe(),k(!1),m(!1)):f.key==="Escape"&&(k(!1),m(!1),he())}})]})})]})})},Ct="agreedToViewMature";function xt(){try{return ee.getItem(Ct)==="true"}catch{return!1}}const He=new Set;function ar(e){for(const t of He)t(e)}function ot(){ar(xt())}function hn(e){try{e?ee.setItem(Ct,"true"):ee.removeItem(Ct)}catch{}ar(e)}function Vi(){const[e,t]=y(xt);w(()=>(He.add(t),He.size===1&&(window.addEventListener("storage",ot),window.addEventListener("focus",ot)),t(xt()),()=>{He.delete(t),He.size===0&&(window.removeEventListener("storage",ot),window.removeEventListener("focus",ot))}),[]);const n=V(()=>hn(!0),[]),r=V(()=>hn(!1),[]);return{hasConsent:e,grant:n,revoke:r}}const Gi="_sidebar_153jc_1",Ji="_open_153jc_20",Yi="_sidebarHeader_153jc_25",Zi="_closeBtn_153jc_33",Xi="_logo_153jc_57",ec="_navSection_153jc_69",tc="_navLink_153jc_75",nc="_active_153jc_108",rc="_overlay_153jc_118",oc="_versionInfo_153jc_138",ge={sidebar:Gi,open:Ji,sidebarHeader:Yi,closeBtn:Zi,logo:Xi,navSection:ec,navLink:tc,active:nc,overlay:rc,versionInfo:oc},ac="3.9.8",sr={version:ac},sc=()=>{const{isOpen:e,setIsOpen:t}=Mt(),{contentType:n}=rr(),{hasConsent:r}=Vi(),a=()=>{t(!1)},s=n==="manga",i=n==="tv",c=n==="asmr",l=[{to:"/",icon:o(P,{name:"home"}),label:"Home"},s?{to:"/manga",icon:o(P,{name:"book"}),label:"Manga"}:i?{to:"/tv-search",icon:o(P,{name:"tv"}),label:"TV and Movies"}:c?{to:"/asmr",icon:o(P,{name:"headphones"}),label:"ASMR"}:{to:"/search",icon:o(P,{name:"search"}),label:"Search"},s?{to:"/reading-list",icon:o(P,{name:"bookmark"}),label:"Reading List"}:i?{to:"/tv-watchlist",icon:o(P,{name:"clock"}),label:"TV Watchlist"}:c?{to:"/listening-list",icon:o(P,{name:"history"}),label:"Listening List"}:{to:"/watchlist",icon:o(P,{name:"clock"}),label:"Watchlist"},...n==="anime"?[{to:"/insights",icon:o(P,{name:"chart-pie"}),label:"Insights"}]:[],{to:"/trackers",icon:o(P,{name:"sync-alt"}),label:"Trackers"},...n==="anime"||i?[{to:"/watch-along",icon:o(P,{name:"play"}),label:"Watch along"}]:[],...r?[{to:"/mature",icon:o(P,{name:"pepper-hot"}),label:"Mature"}]:[],{to:"/settings",icon:o(P,{name:"cog"}),label:"Settings"}];return o(ye,{children:[o("aside",{className:`${ge.sidebar} ${e?ge.open:""} sidebar`,children:[o("div",{className:ge.sidebarHeader,children:[o("button",{className:ge.closeBtn,onClick:()=>t(!1),"aria-label":"Close menu",children:"×"}),o(me,{to:"/",className:ge.logo,onClick:a,children:o(pt,{})})]}),o("nav",{className:ge.navSection,children:l.map(u=>o(vr,{to:u.to,className:({isActive:d})=>`${ge.navLink} ${d?ge.active:""}`,onClick:a,end:u.to==="/",children:[u.icon,o("span",{children:u.label})]},u.to))}),o("div",{className:ge.versionInfo,children:["v",sr.version]})]}),e&&o("div",{className:ge.overlay,onClick:()=>t(!1),"aria-label":"Close sidebar"})]})},ic="_footer_1c905_1",cc="_footerInner_1c905_15",lc="_brandSection_1c905_27",uc="_logoRow_1c905_39",dc="_logoText_1c905_45",mc="_brandMeta_1c905_51",pc="_brandTagline_1c905_60",hc="_statusPill_1c905_67",fc="_statusDot_1c905_80",gc="_linksGrid_1c905_88",yc="_linkColumn_1c905_96",vc="_columnTitle_1c905_102",bc="_bottomBar_1c905_126",wc="_copyright_1c905_136",_c="_brand_1c905_27",kc="_heartIcon_1c905_152",Ec="_backToTop_1c905_157",F={footer:ic,footerInner:cc,brandSection:lc,logoRow:uc,logoText:dc,brandMeta:mc,brandTagline:pc,statusPill:hc,statusDot:fc,linksGrid:gc,linkColumn:yc,columnTitle:vc,bottomBar:bc,copyright:wc,brand:_c,heartIcon:kc,backToTop:Ec},Sc=()=>{const e=new Date().getFullYear(),t=Ye(),n=()=>{window.scrollTo({top:0,behavior:"smooth"})},r=a=>{t.pathname==="/"&&(a.preventDefault(),n())};return o("footer",{className:F.footer,children:[o("div",{className:F.footerInner,children:[o("div",{className:F.brandSection,children:[o("div",{className:F.logoRow,children:o(me,{to:"/",onClick:r,"aria-label":"Home",children:o(pt,{className:F.logoText})})}),o("div",{className:F.brandMeta,children:[o("div",{className:F.statusPill,children:[o("span",{className:F.statusDot}),o("span",{children:["v",sr.version]})]}),o("p",{className:F.brandTagline,children:"Fast, local anime streaming."})]})]}),o("div",{className:F.linksGrid,children:[o("div",{className:F.linkColumn,children:[o("h4",{className:F.columnTitle,children:"Navigation"}),o(me,{to:"/",children:"Home"}),o(me,{to:"/watchlist",children:"Watchlist"}),o(me,{to:"/settings",children:"Settings"})]}),o("div",{className:F.linkColumn,children:[o("h4",{className:F.columnTitle,children:"Features"}),o(me,{to:"/search",children:"Search Anime"}),o(me,{to:"/trackers",children:"Trackers"}),o(me,{to:"/insights",children:"Insights"})]}),o("div",{className:F.linkColumn,children:[o("h4",{className:F.columnTitle,children:"Community"}),o("a",{href:"https://discord.gg/6yT3VwTqz9",target:"_blank",rel:"noopener noreferrer",children:[o(P,{name:"discord",style:{marginRight:"6px"}})," Discord"]}),o("a",{href:"https://github.com/serifpersia/dango",target:"_blank",rel:"noopener noreferrer",children:[o(P,{name:"github",style:{marginRight:"6px"}})," GitHub"]})]}),o("div",{className:F.linkColumn,children:[o("h4",{className:F.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:F.bottomBar,children:[o("p",{className:F.copyright,children:["© ",e," ",o("span",{className:F.brand,children:"dango"})," • Crafted with"," ",o(P,{name:"heart",className:F.heartIcon})," by"," ",o("a",{href:"https://github.com/serifpersia",target:"_blank",rel:"noopener noreferrer",children:"serifpersia"})]}),o("button",{className:F.backToTop,onClick:n,"aria-label":"Back to top",children:[o(P,{name:"chevron-up",size:14}),o("span",{children:"Top"})]})]})]})},bt=e=>{const t=A();return j({...t.settings.getByKey.queryOptions({key:e}),select:n=>n.value})},ir=()=>{const e=A(),t=ae();return pe(e.settings.set.mutationOptions({onSuccess:()=>{N.success("Setting updated!"),t.invalidateQueries(e.settings.pathFilter()),t.invalidateQueries({queryKey:[I.settings]})},onError:n=>{N.error(`Failed to update setting: ${n.message}`)}}))};function cr(e){return JSON.stringify({0:e??{}})}function lr(e){return`/api/trpc/${e}?batch=1&_profile=${encodeURIComponent(Hn())}`}function Ot(e,t){const n=cr(t),r=lr(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 td(e,t){const n=await fetch(lr(e),{method:"POST",headers:{"Content-Type":"application/json"},body:cr(t),keepalive:!0});if(!n.ok)throw new Error(`tRPC request failed (HTTP ${n.status})`)}function nd(e){e&&(Ot("discord.clear",{sessionId:e}),Ot("discord.heartbeat",{sessionId:e,bye:!0}))}function Tc(){const e=Ye(),{data:t}=bt("discordRPCEnabled"),n=q("");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,a=()=>te.discord.heartbeat.mutate({sessionId:r}).catch(()=>{});a();const s=setInterval(a,15e3),i=()=>{Ot("discord.heartbeat",{sessionId:r,bye:!0})};return window.addEventListener("pagehide",i),()=>{clearInterval(s),window.removeEventListener("pagehide",i)}},[t]),w(()=>{if(t===!1||t==="false")return;const r=e.pathname;if(r.startsWith("/watch/")||r.startsWith("/player/"))return;let a="home";r.startsWith("/search")||r.startsWith("/mature")?a="search":r.startsWith("/watchlist")?a="watchlist":r.startsWith("/anime/")?a="anime":r.startsWith("/insights")?a="insights":r.startsWith("/settings")?a="settings":r.startsWith("/trackers")?a="trackers":r.startsWith("/asmr")?a="asmr":r.startsWith("/manga")?a="manga":r.startsWith("/tv")&&(a="tv"),te.discord.pageStatus.mutate({page:a}).catch(()=>{})},[e.pathname,t])}function Wt(e,t){const[n,r]=y(()=>{try{const s=ee.getItem(e);if(s===null)return t;if(typeof t=="string")return s;try{return JSON.parse(s)}catch{return s}}catch{return t}});w(()=>{const s=i=>{if(i.key===ee.keyFor(e))try{if(i.newValue===null){r(t);return}if(typeof t=="string"){r(i.newValue);return}try{r(JSON.parse(i.newValue))}catch{r(i.newValue)}}catch{}};return window.addEventListener("storage",s),()=>window.removeEventListener("storage",s)},[e,t]);const a=V(s=>{r(i=>{const c=typeof s=="function"?s(i):s;try{typeof c=="string"?ee.setItem(e,c):ee.setItem(e,JSON.stringify(c))}catch{}return c})},[e]);return[n,a]}const ur=be(void 0),Pc=()=>{const e=we(ur);if(!e)throw new Error("useAnimePaheCookie must be used within an AnimePaheCookieProvider");return e},Nc="_container_e96gf_1",Ic="_field_e96gf_9",Cc="_textarea_e96gf_20",xc="_input_e96gf_40",Oc="_button_e96gf_58",Ac="_secondaryButton_e96gf_78",Lc="_actions_e96gf_95",Rc="_hint_e96gf_104",qc="_link_e96gf_117",ie={container:Nc,field:Ic,textarea:Cc,input:xc,button:Oc,secondaryButton:Ac,actions:Lc,hint:Rc,link:qc},Dc="https://github.com/serifpersia/dango/releases/latest/download/dango-extension.zip",$c=e=>{try{return JSON.parse(e.detail)}catch{return null}},jc=({isOpen:e,onClose:t,onSuccess:n})=>{const[r,a]=y(1),[s,i]=y(navigator.userAgent),[c,l]=y(""),[u,d]=y(!1),m=q(null),h=navigator.userAgent,p=/android/i.test(h),g=/firefox|fxios/i.test(h)&&!p,k=!g&&!p&&/chrome|chromium|edg|brave/i.test(h),M=g||k;w(()=>{e&&(a(1),i(navigator.userAgent),l(""),d(!1))},[e]),w(()=>()=>{m.current&&(window.removeEventListener("dango:pahe-cookie",m.current),m.current=null)},[]);const C=()=>{window.open("https://animepahe.pw","_blank","noopener,noreferrer"),a(2)},H=()=>{if(u)return;d(!0);const x=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,W=window.setTimeout(()=>{d(!1),m.current&&(window.removeEventListener("dango:pahe-cookie",m.current),m.current=null),N.error("Helper not detected - install it via about:debugging first.")},3e3),B=se=>{const v=$c(se);if(!(!v||v.requestId!==x))if(window.clearTimeout(W),window.removeEventListener("dango:pahe-cookie",B),m.current=null,d(!1),v?.ok&&v.cookie)l(v.cookie),N.success("Cookie extracted from helper!");else if(v?.error==="NO_COOKIE"){const L=v.debug?.stores?.length??0,D=v.debug?.names??[];N.error(`Helper found no cf_clearance (checked ${L} stores, saw: ${D.join(", ")||"none"}) - solve the challenge on the AnimePahe tab first.`)}else N.error("Helper request failed - try again.")};m.current=B,window.addEventListener("dango:pahe-cookie",B),window.dispatchEvent(new CustomEvent("dango:get-pahe-cookie",{detail:{requestId:x}}))},S=()=>{const x=c.trim();if(!x){N.error("Please enter the cf_clearance cookie");return}try{ee.setItem("animepahe_ua",s),ee.setItem("animepahe_cookie",x),N.success("Cookie updated successfully! Reloading…"),n?.(),t(),window.setTimeout(()=>window.location.reload(),1e3)}catch{N.error("Failed to save cookie")}};return o(Me,{isOpen:e,onClose:t,title:"AnimePahe Verification Required",children:o("div",{className:ie.container,children:r===1?o(ye,{children:[o("p",{children:"AnimePahe requires a manual verification to bypass Cloudflare/DDoS-Guard protection."}),o("div",{className:ie.field,children:[o("label",{children:"Your User-Agent (will be used for requests):"}),o("textarea",{value:s,readOnly:!0,rows:3,className:ie.textarea})]}),o("div",{className:ie.actions,children:[o("button",{className:ie.secondaryButton,onClick:t,children:"Cancel"}),o("button",{className:ie.button,onClick:C,children:"Start Verification (Opens AnimePahe)"})]})]}):o(ye,{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."]}),M&&o("div",{className:ie.hint,children:[o("strong",{children:"Dango helper (one-time setup):"})," ",g?o(ye,{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(ye,{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:Dc,target:"_blank",rel:"noreferrer",className:ie.link,children:"dango-extension.zip"}),". Then click Extract below and the field fills itself.",o("div",{className:ie.actions,children:o("button",{className:ie.button,onClick:H,disabled:u,type:"button",children:u?"Extracting…":"Extract cookie from helper"})})]}),o("div",{className:ie.field,children:[o("label",{children:"cf_clearance cookie value:"}),o("input",{type:"text",value:c,onChange:x=>l(x.currentTarget.value),placeholder:"e.g. xxxxxxxx.xxxxxxxx.xxxxxxx-xxxxxxx",className:ie.input})]}),o("div",{className:ie.actions,children:[o("button",{className:ie.secondaryButton,onClick:t,children:"Cancel"}),o("button",{className:ie.secondaryButton,onClick:()=>a(1),children:"Back"}),o("button",{className:ie.button,onClick:S,children:"Submit"})]})]})})})};function fn(){const[e,t]=y(!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 Mc="_screen_1pca0_1",Bc="_icon_1pca0_14",Fc="_title_1pca0_20",Wc="_text_1pca0_24",Kc="_button_1pca0_29",Ue={screen:Mc,icon:Bc,title:Fc,text:Wc,button:Kc};async function Uc(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 Hc extends br{state={hasError:!1};static getDerivedStateFromError(t){return{hasError:!0}}componentDidCatch(t,n){console.error("Uncaught error:",t,n),Uc(t,n)}render(){return this.state.hasError?o("div",{className:Ue.screen,children:[o(P,{name:"exclamation-triangle",className:Ue.icon}),o("h1",{className:Ue.title,children:"Something went wrong"}),o("p",{className:Ue.text,children:"The application encountered an unexpected error."}),o("button",{onClick:()=>{this.setState({hasError:!1}),window.location.href="/"},className:Ue.button,children:[o(P,{name:"home"}),"Go back Home"]})]}):this.props.children}}const dr=be(void 0),Qc=()=>{const e=we(dr);if(!e)throw new Error("useLanAuth must be used within a LanAuthProvider");return e},zc=({children:e})=>{const[t,n]=y(!1),r=V(()=>n(!0),[]),a=V(()=>n(!1),[]);return w(()=>Un("lan",r),[r]),o(dr.Provider,{value:{isOpen:t,openModal:r,closeModal:a},children:e})},Vc="_container_88bss_1",Gc="_field_88bss_8",Jc="_input_88bss_19",Yc="_actions_88bss_37",at={container:Vc,field:Gc,input:Jc,actions:Yc},Qe=wr(({variant:e="primary",size:t="md",loading:n,children:r,className:a="",disabled:s,...i},c)=>{const l=Xa("btn",`btn-${e}`,t!=="md"&&`btn-${t}`,n&&"btn-loading",a);return o("button",{className:l,disabled:s||n,ref:c,...i,children:n?o("span",{className:"btn-spinner"}):r})}),mr=({isOpen:e,onClose:t,onSuccess:n})=>{const[r,a]=y(""),[s,i]=y(!1);Lt.useEffect(()=>{e&&a("")},[e]);const c=async()=>{if(!r){N.error("Please enter your password");return}i(!0);try{const l=await $t("/api/auth/app-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:r})}),u=await l.json().catch(()=>({}));if(!l.ok){N.error(u.error||"Login failed");return}N.success("Authenticated successfully"),n(),t(),window.location.reload()}catch{N.error("Network error")}finally{i(!1)}};return o(Me,{isOpen:e,onClose:t,title:"LAN Authentication Required",children:o("div",{className:at.container,children:[o("p",{children:"This instance is protected. Enter the password to access from this device."}),o("div",{className:at.field,children:[o("label",{htmlFor:"lan-password",children:"Password"}),o("input",{id:"lan-password",type:"password",value:r,onChange:l=>a(l.currentTarget.value),placeholder:"Enter password...",className:at.input,onKeyDown:l=>l.key==="Enter"&&c()})]}),o("div",{className:at.actions,children:[o(Qe,{variant:"secondary",onClick:t,disabled:s,children:"Cancel"}),o(Qe,{variant:"primary",onClick:c,loading:s,children:"Unlock"})]})]})})},Zc="_notice_1d75r_1",Xc={notice:Zc},el=2600,tl=1e4,nl={anilist:"Updating AniList…",mal:"Updating MyAnimeList…"};function rl({enabled:e=!0}){const[t,n]=y(!1),[r,a]=y("mal"),[s,i]=y(document.fullscreenElement);return w(()=>{const c=()=>i(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 m=-1/0;const h=p=>{let g;try{g=JSON.parse(p.data)}catch{return}const k=g.provider;k!=="anilist"&&k!=="mal"||(g.updating===!0?(clearTimeout(l.get(k)),d.size===0&&Date.now()-m>=tl&&(m=Date.now(),a(k),n(!0),clearTimeout(u),u=setTimeout(()=>n(!1),el)),d.add(k)):g.updating===!1&&(clearTimeout(l.get(k)),l.set(k,setTimeout(()=>d.delete(k),1500))))};return c.addEventListener("tracker-activity",h),()=>{c.removeEventListener("tracker-activity",h),c.close(),clearTimeout(u);for(const p of l.values())clearTimeout(p);n(!1)}},[e]),!e||!t?null:Sn(o("div",{className:Xc.notice,role:"status","aria-live":"polite","aria-atomic":"true",children:[o(P,{name:r==="anilist"?"anilist":"myanimelist",size:15}),o("span",{children:nl[r]})]}),s||document.body)}const ol=K(()=>U(()=>import("./Home-fOOTJ5Mv.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]))),al=K(()=>U(()=>import("./Watchlist-BQAmkXi4.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]))),sl=K(()=>U(()=>import("./Settings-BcE3qLnj.js"),__vite__mapDeps([40,1,2,4,41,42,14,7,8,43]))),gn=K(()=>U(()=>import("./Player-CB8UTo30.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]))),il=K(()=>U(()=>import("./WatchAlong-x0fVpDw5.js"),__vite__mapDeps([56,1,53,54,2,4]))),cl=K(()=>U(()=>import("./Search-CbPH9KuK.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]))),ll=K(()=>U(()=>import("./Mature-D6KQl_hq.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]))),yn=K(()=>U(()=>import("./Asmr-DdJXXv44.js"),__vite__mapDeps([62,1,4,2,41,42,7,8,3,5,6,9,32,24,63,25,45,46,64,65,66]))),ul=K(()=>U(()=>import("./Manga-CHGPAvJO.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]))),dl=K(()=>U(()=>import("./MangaInfoPage-B2Gpavli.js"),__vite__mapDeps([70,1,4,17,18,68,69,23,2,24,64,65]))),ml=K(()=>U(()=>import("./MangaReadPage-FFlXE7Ul.js"),__vite__mapDeps([71,1,17,4,18,2,68,69,23,24,64,65]))),pl=K(()=>U(()=>import("./ReadingList-DyLy-7tv.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]))),vn=K(()=>U(()=>import("./TvSearch-DBBMShrK.js"),__vite__mapDeps([74,1,4,3,5,6,7,8,9,28,29,30,2,24,15,16,17,18,58,59]))),hl=K(()=>U(()=>import("./TvInfo-CF-V57eQ.js"),__vite__mapDeps([75,1,4,30,2,24,76]))),fl=K(()=>U(()=>import("./Tv-Cvwf6kfG.js"),__vite__mapDeps([77,1,45,4,46,2,47,14,48,78,7,8,27,30,24,6,51,52,53,54,79]))),gl=K(()=>U(()=>import("./TvWatchlist-DtRMYBcN.js"),__vite__mapDeps([80,1,3,4,5,6,7,8,9,73,15,16,17,18,35,36,19,29,30,2,24]))),yl=K(()=>U(()=>import("./ListeningList-D-mxqb0Z.js"),__vite__mapDeps([81,1,3,4,5,6,7,8,9,73,15,16,17,18,35,36,32,2,24,63,25,31,19]))),vl=K(()=>U(()=>import("./Trackers-CL19Dz3a.js"),__vite__mapDeps([82,1,2,4,83]))),bl=K(()=>U(()=>import("./Insights-BXIIjvKu.js"),__vite__mapDeps([84,1,2,4,85]))),wl=K(()=>U(()=>import("./AnimeInfoPage-CDzqc1kE.js"),__vite__mapDeps([86,1,2,4]))),_l=K(()=>U(()=>import("./PlayerRedirect-fv2tzEUu.js"),__vite__mapDeps([87,1]))),kl=K(()=>U(()=>import("./VirtualKeyboard-BAit8w5c.js"),__vite__mapDeps([88,1,2,4,89])));function El(){const{isOpen:e,closeModal:t,onSuccess:n}=Pc(),{isOpen:r,setIsOpen:a}=Mt(),{isOpen:s,openModal:i,closeModal:c}=Qc(),l=Ye(),u=_r(),d=q(new Map),m=q(l.pathname),h=q(l.key),p=q(null),[g,k]=y(!1),M=Ys();Tc();const{data:C}=bt("frozenMode"),H=C==="true"||C===!0,[S,x]=y(!1);w(()=>{const v=new AbortController;return De("/api/auth/app-status",{signal:v.signal}).then(L=>{L.hasPassword&&!L.isAuthenticated&&(x(!0),i())}).catch(()=>{v.signal.aborted||N.error("Could not check server access. The server may still be starting; reload to retry.")}),()=>v.abort()},[i]);const[W,B]=Wt("lan_auth_notice_shown","false"),se=q(!1);return w(()=>{if(W==="true"||se.current)return;se.current=!0,B("true");const v=setTimeout(()=>{N("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(v)},[W,B]),w(()=>{try{window.history.scrollRestoration="manual"}catch{}},[]),w(()=>{const v=l.key,L=d.current;if(u==="POP"){const D=L.get(v)??0;window.scrollTo({top:D,behavior:"instant"})}else l.pathname!==m.current&&window.scrollTo({top:0,behavior:"instant"});return m.current=l.pathname,()=>{L.set(v,window.scrollY)}},[l.key,l.pathname,u]),w(()=>{const v=()=>{k(!0),p.current!==null&&window.clearTimeout(p.current),p.current=window.setTimeout(()=>{k(!1),p.current=null},1e4)},L=Q=>{if(Q.defaultPrevented||Q.button!==0||Q.metaKey||Q.ctrlKey||Q.shiftKey||Q.altKey)return;const le=Q.target;if(!(le instanceof Element))return;const ne=le.closest("a[href]");if(!ne||ne.hasAttribute("download")||ne.getAttribute("target")==="_blank")return;const ue=new URL(ne.href,window.location.href);ue.origin===window.location.origin&&`${ue.pathname}${ue.search}${ue.hash}`!=`${window.location.pathname}${window.location.search}${window.location.hash}`&&v()},D=()=>v();return document.addEventListener("click",L,!0),window.addEventListener("popstate",D),()=>{document.removeEventListener("click",L,!0),window.removeEventListener("popstate",D),p.current!==null&&(window.clearTimeout(p.current),p.current=null)}},[]),w(()=>{h.current!==l.key&&(h.current=l.key,g&&(p.current!==null&&window.clearTimeout(p.current),p.current=window.setTimeout(()=>{k(!1),p.current=null},500)))},[l.key,g]),w(()=>{const v=L=>{r&&L.key==="Escape"&&a(!1)};return r?document.body.classList.add("sidebar-open"):document.body.classList.remove("sidebar-open"),window.addEventListener("keydown",v),()=>{window.removeEventListener("keydown",v),document.body.classList.remove("sidebar-open")}},[r,a]),o("div",{className:"app-container",children:[o(jc,{isOpen:e,onClose:t,onSuccess:n}),o(mr,{isOpen:s,onClose:S?()=>{}:c,onSuccess:()=>{x(!1),c()}}),o(Ln,{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"}}}}),g&&o(fn,{}),H&&o("div",{style:{padding:"0.5rem 1rem",background:"var(--bg-tertiary)",borderBottom:"1px solid var(--border-color)",fontSize:"0.85rem",textAlign:"center"},children:[o("strong",{children:"Frozen Mode:"})," nothing is being saved or synced."]}),o(rl,{enabled:!S&&!s}),o(zi,{}),o(sc,{}),o("main",{className:"main-content",children:o(Hc,{children:o(Gt,{fallback:o(fn,{}),children:o(kr,{children:[o(R,{path:"/",element:o(ol,{})}),o(R,{path:"/watchlist/:filter?",element:o(al,{})}),o(R,{path:"/reading-list/:filter?",element:o(pl,{})}),o(R,{path:"/search",element:o(cl,{})}),o(R,{path:"/mature",element:o(ll,{})}),o(R,{path:"/asmr",element:o(yn,{})}),o(R,{path:"/asmr/:rj",element:o(yn,{})}),o(R,{path:"/manga",element:o(ul,{})}),o(R,{path:"/manga/:provider/:id",element:o(dl,{})}),o(R,{path:"/manga/:provider/:id/read",element:o(ml,{})}),o(R,{path:"/tv",element:o(vn,{})}),o(R,{path:"/tv/:id",element:o(hl,{})}),o(R,{path:"/tv/:id/watch",element:o(fl,{})}),o(R,{path:"/tv-search",element:o(vn,{})}),o(R,{path:"/tv-watchlist/:filter?",element:o(gl,{})}),o(R,{path:"/listening-list/:filter?",element:o(yl,{})}),o(R,{path:"/settings",element:o(sl,{})}),o(R,{path:"/trackers",element:o(vl,{})}),o(R,{path:"/mal",element:o(Jt,{to:"/trackers",replace:!0})}),o(R,{path:"/insights",element:o(bl,{})}),o(R,{path:"/anime/:id",element:o(wl,{})}),o(R,{path:"/watch/:id",element:o(gn,{})}),o(R,{path:"/watch-along",element:o(il,{})}),o(R,{path:"/watch/:id/:episodeNumber",element:o(gn,{})}),o(R,{path:"/player/:id/:episodeNumber?",element:o(_l,{})}),o(R,{path:"*",element:o(Jt,{to:"/",replace:!0})})]})})})}),o(Sc,{}),M.isVisible&&o(Gt,{fallback:null,children:o(kl,{activeInputRef:M.activeInputRef,isVisible:M.isVisible,onClose:M.hide})})]})}function Sl(){return o(zc,{children:o(El,{})})}const Tl=({children:e})=>{const[t,n]=y(!1),r=V(()=>{n(s=>!s)},[]),a=je(()=>({isOpen:t,setIsOpen:n,toggleSidebar:r}),[t,r]);return o(tr.Provider,{value:a,children:e})},Pl=({children:e})=>{const[t,n]=Wt("dango_content_type","anime"),r=je(()=>({contentType:t,setContentType:n}),[t,n]);return o(nr.Provider,{value:r,children:e})},Nl=({children:e})=>{const[t,n]=y("englishName"),[r,a]=y(!0);w(()=>{(async()=>{try{const c=await te.settings.getByKey.query({key:"titlePreference"});c.value&&n(c.value)}catch(c){console.error("Error fetching title preference in context:",c)}finally{a(!1)}})()},[]);const s=je(()=>({titlePreference:t,setTitlePreference:n,loading:r}),[t,r]);return o(Jn.Provider,{value:s,children:e})},pr=be(void 0),rd=()=>{const e=we(pr);if(e===void 0)throw new Error("useLowEndMode must be used within a LowEndModeProvider");return e},Il=({children:e})=>{const{data:t,isLoading:n}=bt("lowEndMode"),r=ir(),a=ae(),[s,i]=y(!1);w(()=>{const u=a.getDefaultOptions();a.setDefaultOptions({...u,queries:{...u.queries,gcTime:s?900*1e3:1800*1e3}})},[s,a]),w(()=>{t!==void 0&&i(t==="true"||t===!0)},[t]),w(()=>{s?document.body.classList.add("low-end"):document.body.classList.remove("low-end")},[s]);const c=V(u=>{i(u),r.mutate({key:"lowEndMode",value:String(u)})},[r]),l=je(()=>({lowEndMode:s,setLowEndMode:c,loading:n}),[s,c,n]);return o(pr.Provider,{value:l,children:e})},hr=be(void 0),od=()=>{const e=we(hr);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e},ad=[{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"}],Cl=["iris","mochi","sakura"];function bn(e){e==="iris"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",e)}const xl=({children:e})=>{const{data:t,isLoading:n}=bt("theme"),r=ir(),[a,s]=y("iris");w(()=>{typeof t=="string"&&Cl.includes(t)&&s(t)},[t]),w(()=>{bn(a)},[a]);const i=V(l=>{l!==a&&(s(l),bn(l),r.mutate({key:"theme",value:l}))},[r,a]),c=je(()=>({theme:a,setTheme:i,loading:n}),[a,i,n]);return o(hr.Provider,{value:c,children:e})},Ol=({children:e})=>{const[t,n]=y(!1),[r,a]=y(void 0),s=V(c=>{a(()=>c),n(!0)},[]),i=V(()=>{n(!1),a(void 0)},[]);return w(()=>Un("animepahe",()=>s()),[s]),o(ur.Provider,{value:{isOpen:t,openModal:s,closeModal:i,onSuccess:r},children:e})},Al="_gate_1ex8w_1",Ll="_gateExiting_1ex8w_21",Rl="_appEntering_1ex8w_27",ql="_gateInner_1ex8w_100",Dl="_connecting_1ex8w_110",$l="_connectingLogo_1ex8w_118",jl="_connectingDots_1ex8w_128",Ml="_gateTitle_1ex8w_149",Bl="_profileGrid_1ex8w_157",Fl="_profileCard_1ex8w_165",Wl="_profileCardAvatar_1ex8w_216",Kl="_addAvatar_1ex8w_245",Ul="_profileCardName_1ex8w_255",Hl="_ownerTag_1ex8w_265",Ql="_lockBadge_1ex8w_273",zl="_gatePanel_1ex8w_288",Vl="_panelAvatar_1ex8w_302",Gl="_panelTitle_1ex8w_308",Jl="_gateForm_1ex8w_314",Yl="_gateField_1ex8w_320",Zl="_gateHint_1ex8w_346",Xl="_gateError_1ex8w_353",eu="_backButton_1ex8w_359",tu="_form_1ex8w_444",nu="_field_1ex8w_457",ru="_avatarRow_1ex8w_474",ou="_uploadButton_1ex8w_486",au="_fileInput_1ex8w_515",su="_profileList_1ex8w_528",iu="_smallAvatar_1ex8w_541",cu="_profileName_1ex8w_546",T={gate:Al,gateExiting:Ll,appEntering:Rl,gateInner:ql,connecting:Dl,connectingLogo:$l,connectingDots:jl,gateTitle:Ml,profileGrid:Bl,profileCard:Fl,profileCardAvatar:Wl,addAvatar:Kl,profileCardName:Ul,ownerTag:Hl,lockBadge:Ql,gatePanel:zl,panelAvatar:Vl,panelTitle:Gl,gateForm:Jl,gateField:Yl,gateHint:Zl,gateError:Xl,backButton:eu,form:tu,field:nu,avatarRow:ru,uploadButton:ou,fileInput:au,profileList:su,smallAvatar:iu,profileName:cu},Kt="dango:entering-profile";function lu(){try{return!!sessionStorage.getItem(Kt)}catch{return!1}}function wn(){try{sessionStorage.setItem(Kt,String(Date.now()))}catch{}}function uu({children:e}){const[t,n]=y(!1),[r,a]=y(!1),[s,i]=y(()=>lu()),[c,l]=y(!0),[u,d]=y(!1),[m,h]=y(!1),[p,g]=y([]),[k,M]=y(""),[C,H]=y("pick"),[S,x]=y(""),[W,B]=y(""),[se,v]=y(!1),[L,D]=y(0),[Q,le]=y(""),[ne,ue]=y(""),[G,J]=y("");w(()=>{let _=!1,X;B(""),l(!0),d(!1);let z=!1;const he=setTimeout(()=>{_||(z=!0,d(!0))},500),Le=()=>{he&&clearTimeout(he),d(!1)};return(async()=>{const Re=await De("/api/auth/app-status");if(_)return;if(Re.hasPassword&&!Re.isAuthenticated){h(!0),Le(),l(!1);return}const Ce=await De("/api/profiles/status");if(!_)if(Ce.current){Ra(Ce.current.id);const Be=window.matchMedia("(prefers-reduced-motion: reduce)").matches,xe=z&&!Be;xe&&a(!0),X=setTimeout(()=>{if(!_){Le(),n(!0),a(!1),l(!1);try{sessionStorage.removeItem(Kt)}catch{}}},xe?280:0)}else Le(),g(Ce.profiles),M(Ce.profiles[0]?.id??""),l(!1)})().catch(Re=>{_||(Le(),B(Re.message),l(!1))}),()=>{_=!0,X&&clearTimeout(X),he&&clearTimeout(he)}},[L]),w(()=>{const _=z=>{z.key==="dango:profile-session-change"&&(wn(),window.location.reload())},X=()=>{n(!1),a(!1),i(!1),D(z=>z+1)};return window.addEventListener("storage",_),window.addEventListener("dango:profile-auth-required",X),()=>{window.removeEventListener("storage",_),window.removeEventListener("dango:profile-auth-required",X)}},[]);const $=async(_,X)=>{v(!0),B("");try{await De("/api/profiles/login",{method:"POST",body:JSON.stringify({id:_,password:X})}),wn(),Da()}catch(z){B(z.message),v(!1)}},fe=_=>{B(""),x(""),M(_.id),_.protected?H("password"):$(_.id,"")},Xe=()=>{H("pick"),x(""),B("")};if(t)return s?o("div",{className:T.appEntering,children:e}):e;const Ie=p.find(_=>_.id===k);return c&&!u&&!W&&!m?o("div",{className:T.gate,"aria-hidden":"true"}):o("div",{className:`${T.gate}${r?` ${T.gateExiting}`:""}`,children:[o(Ln,{}),o(mr,{isOpen:m,onClose:()=>{},onSuccess:()=>{h(!1),D(_=>_+1)}}),C==="pick"&&c&&u&&!p.length&&!W&&!m&&o("section",{className:T.gateInner,"aria-busy":"true","aria-label":"Connecting to Dango",children:o("div",{className:T.connecting,children:[o("span",{className:T.connectingLogo,"aria-hidden":"true"}),o("h1",{className:T.gateTitle,children:"Connecting to Dango"}),o("span",{className:T.connectingDots,"aria-hidden":"true",children:[o("span",{}),o("span",{}),o("span",{})]})]})}),C==="pick"&&!c&&o("section",{className:T.gateInner,children:[o("h1",{className:T.gateTitle,children:p.length?"Who's watching?":"Dango"}),p.length>0&&o("div",{className:T.profileGrid,children:[p.map(_=>o("button",{type:"button",className:T.profileCard,disabled:se,onClick:()=>fe(_),children:[o("span",{className:T.profileCardAvatar,children:[o(It,{image:_.avatar??_.cloudAvatar,name:_.name,size:"100%",radius:"var(--radius-sm)"}),_.protected&&o("span",{className:T.lockBadge,"aria-hidden":"true",children:o(P,{name:"lock",size:"0.85rem"})})]}),o("span",{className:T.profileCardName,children:[_.name,_.owner&&o("span",{className:T.ownerTag,children:"Owner"})]})]},_.id)),o("button",{type:"button",className:T.profileCard,disabled:se,onClick:()=>{B(""),H("create")},children:[o("span",{className:`${T.profileCardAvatar} ${T.addAvatar}`,children:o(P,{name:"plus",size:40})}),o("span",{className:T.profileCardName,children:"Add profile"})]})]}),W&&o(ye,{children:[o("p",{role:"alert",className:T.gateError,children:W}),!p.length&&o(Qe,{variant:"secondary",onClick:()=>D(_=>_+1),children:"Retry"})]})]}),C==="password"&&Ie&&o("section",{className:T.gatePanel,children:[o("button",{type:"button",className:T.backButton,onClick:Xe,children:[o(P,{name:"chevron-left"}),"Back"]}),o("div",{className:T.panelAvatar,children:o(It,{image:Ie.avatar??Ie.cloudAvatar,name:Ie.name,size:"100%",radius:"18%"})}),o("h2",{className:T.panelTitle,children:Ie.name}),o("form",{className:T.gateForm,onSubmit:_=>{_.preventDefault(),$(k,S)},children:[o("label",{className:T.gateField,children:["Password",o("input",{type:"password",autoComplete:"current-password",required:!0,maxLength:256,value:S,onChange:_=>x(_.currentTarget.value)})]}),o(Qe,{type:"submit",className:"btn-block",loading:se,children:"Continue"})]}),W&&o("p",{role:"alert",className:T.gateError,children:W})]},"password"),C==="create"&&o("section",{className:T.gatePanel,children:[o("button",{type:"button",className:T.backButton,onClick:Xe,children:[o(P,{name:"chevron-left"}),"Back"]}),o("h2",{className:T.panelTitle,children:"Add a profile"}),o("p",{className:T.gateHint,children:"Enter the owner password to create a new profile."}),o("form",{className:T.gateForm,onSubmit:async _=>{_.preventDefault(),v(!0),B("");try{const X=await De("/api/profiles/create",{method:"POST",body:JSON.stringify({name:ne,password:G,ownerPassword:Q})});g(z=>[...z,X]),le(""),ue(""),J(""),H("pick"),M(X.id),X.protected?H("password"):await $(X.id,"")}catch(X){B(X.message)}finally{v(!1)}},children:[o("label",{className:T.gateField,children:["Owner password",o("input",{type:"password",autoComplete:"current-password",required:!0,maxLength:256,value:Q,onChange:_=>le(_.currentTarget.value)})]}),o("label",{className:T.gateField,children:["Profile name",o("input",{required:!0,maxLength:60,value:ne,onChange:_=>ue(_.currentTarget.value)})]}),o("label",{className:T.gateField,children:["Profile password (optional)",o("input",{type:"password",autoComplete:"new-password",minLength:8,maxLength:256,value:G,onChange:_=>J(_.currentTarget.value)})]}),o(Qe,{type:"submit",className:"btn-block",loading:se,children:"Create profile"})]}),W&&o("p",{role:"alert",className:T.gateError,children:W})]},"create")]})}const fr=be(null);function sd(){const e=we(fr);if(!e)throw new Error("WatchAlongProvider is missing");return e}const du=/^[0-9a-f-]{36}$/,mu=/^[0-9a-f]{64}$/;function id(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 cd(e,t){return e.position+(e.playing?Math.max(0,t-e.updatedAt)/1e3*e.rate:0)}const At="dango-watch-along",Ut="dango-watch-along-host";function _n(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=ze(`${t.id}.${t.guestToken}`,""),r=ze(`${t.id}.${t.token}`,"");return{...n,token:r.token,host:t.host===!0}}function pu(){try{return _n(JSON.parse(sessionStorage.getItem(At)||"null"))??_n(JSON.parse(localStorage.getItem(Ut)||"null"))}catch{return null}}function hu(e){try{e?sessionStorage.setItem(At,JSON.stringify(e)):sessionStorage.removeItem(At),e?.host&&localStorage.setItem(Ut,JSON.stringify(e))}catch{}}function st(){try{localStorage.removeItem(Ut)}catch{}}function fu(e){return e.kind==="tv"||e.kind==="movie"?ei(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 ze(e,t){let n=e.trim().replace(/^#/,"");if(n.includes("://")){const i=new URL(n);if(i.origin!==new URL(t).origin||!["/join","/watch-along"].includes(i.pathname))throw new Error("Use an invite from this dango watch-along service.");n=i.hash.slice(1)}const[r,a,s]=n.split(".");if(!du.test(r||"")||!mu.test(a||"")||s!==void 0)throw new Error("Paste a complete watch-along invite link or room code.");return{id:r,token:a,guestToken:a,host:!1}}function gu({children:e}){const t=Tn(),n=Ye(),[r,a]=Wt("watchAlongName",""),[s,i]=y(pu),[c,l]=y(null),[u,d]=y(!1),[m,h]=y(""),[p,g]=y(""),[k,M]=y({offset:0,latency:0}),C=q(null),{data:H}=j({queryKey:["watch-along-config"],queryFn:()=>te.settings.watchAlong.query()}),S=H?.workerUrl.replace(/\/$/,"")||"";w(()=>{hu(s)},[s]);const x=V(v=>{C.current?.readyState===WebSocket.OPEN&&C.current.send(JSON.stringify(v))},[]);w(()=>{if(!u)return;const v=setTimeout(()=>x({type:"name",name:r}),250);return()=>clearTimeout(v)},[u,p,r,x]);const W=V(()=>{s?.host&&x({type:"end"}),C.current?.close(1e3,"Left room"),st(),i(null),l(null),d(!1),h("")},[x,s]),B=async v=>{if(!S)throw new Error("Watch along is unavailable. Check your server configuration.");const L=await fetch(`${S}/rooms`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(v),signal:AbortSignal.timeout(15e3)}),D=await L.json();if(!L.ok)throw new Error(D.error||"Could not create room");const Q=ze(`${D.id}.${D.guestToken}`,S),le=ze(`${D.id}.${D.hostToken}`,S);h(""),l(null),i({...Q,token:le.token,host:!0})},se=v=>{if(!S)throw new Error("Watch along is unavailable. Check your server configuration.");const L=ze(v,S);st(),h(""),l(null),i(L)};return w(()=>{if(!s||!S)return;let v=!1,L=0,D,Q,le=Date.now();const ne=async()=>{if(v)return;try{const J=await fetch(`${S}/rooms/${s.id}`,{headers:{Authorization:`Bearer ${s.token}`},signal:AbortSignal.timeout(1e4)});if(v)return;if(!J.ok){const $=await J.json();if([403,404,409].includes(J.status)){h($.error||"Unable to join room"),st(),i(null),l(null);return}throw new Error($.error||"Room service unavailable")}}catch{if(v)return;h("Cannot reach the room service. Retrying…"),D=setTimeout(ne,Math.min(15e3,1e3*2**Math.min(L++,4)));return}const ue=new URL(`${S}/rooms/${s.id}/ws`);ue.protocol=ue.protocol==="https:"?"wss:":"ws:";const G=new WebSocket(ue,["dango-watch-along",s.token]);C.current=G,G.onopen=()=>{le=Date.now()},G.onmessage=J=>{if(!(v||C.current!==G)){le=Date.now();try{const $=JSON.parse(J.data);if($.type==="joined"){if($.host!==s.host){G.close(4003,"Invalid role");return}L=0,d(!0),h(""),g($.id),G.send(JSON.stringify({type:"ping",sentAt:Date.now()}))}else if($.type==="state")l(fe=>fe&&fe.revision>$.state.revision?fe:$.state);else if($.type==="pong"){const fe=Date.now()-$.sentAt;M({offset:$.serverTime-($.sentAt+fe/2),latency:fe/2})}else $.type==="error"&&h($.error)}catch{h("Invalid response from the room service.")}}},G.onclose=J=>{if(!(v||C.current!==G)){if(clearInterval(Q),d(!1),[4003,4004,4009].includes(J.code)){h(J.reason||"Room closed"),J.code!==4009&&st(),i(null),l(null);return}h("Connection lost. Reconnecting…"),D=setTimeout(ne,Math.min(15e3,1e3*2**Math.min(L++,4)))}},G.onerror=()=>G.close(),Q=setInterval(()=>{Date.now()-le>25e3?G.close():G.readyState===WebSocket.OPEN&&G.send(JSON.stringify({type:"ping",sentAt:Date.now()}))},1e4)};return ne(),()=>{v=!0,clearTimeout(D),clearInterval(Q),C.current?.close(1e3,"Leaving connection"),C.current=null,d(!1)}},[s,S]),w(()=>{if(!s||s.host||!c)return;const v=fu(c.selection);`${n.pathname}${n.search}`!==v&&t(v,{replace:!0})},[s,c,n.pathname,n.search,t]),o(fr.Provider,{value:{workerUrl:S,displayName:r,setDisplayName:a,session:s,room:c,connected:u,error:m,selfId:p,clock:k,create:B,join:se,leave:W,send:x},children:e})}try{window.history.scrollRestoration="manual"}catch{}const kn=new Nr({defaultOptions:{queries:{staleTime:1e3*60*5,gcTime:1800*1e3,refetchOnWindowFocus:!1,refetchIntervalInBackground:!1,retry:1}}}),En=document.getElementById("root");En&&Er(o(uu,{children:o(Sr,{children:o(Ba,{trpcClient:te,queryClient:kn,children:o(Ir,{client:kn,children:o(Ol,{children:o(Tl,{children:o(Pl,{children:o(Nl,{children:o(Il,{children:o(xl,{children:o(gu,{children:o(Sl,{})})})})})})})})})})})}),En);export{un as $,Ru as A,Qe as B,Wu as C,Du as D,Eu as E,Xu as F,Ku as G,$u as H,qu as I,N as J,bt as K,ir as L,Vu as M,Bu as N,Fu as O,Mu as P,Me as Q,Zs as R,De as S,zu as T,T as U,It as V,Da as W,$t as X,Y,od as Z,ad as _,Wt as a,or as a0,ln as a1,U as a2,_t as a3,ku as a4,ie as a5,sd as a6,jc as a7,Rn as a8,Nu as a9,Js as aa,ai as ab,nd as ac,Un as ad,ed as ae,Gu as af,Yu as ag,Zu as ah,ri as ai,Bt as aj,Hu as ak,$e as al,td as am,id as an,cd as ao,Mt as ap,Uu as aq,fn as ar,Ou as as,Au as at,xu as au,Su as b,Tu as c,Yn as d,Vi as e,Gn as f,Ju as g,wu as h,ei as i,Qu as j,Xs as k,es as l,oi as m,mn as n,A as o,ee as p,I as q,Pu as r,_u as s,te as t,rd as u,rr as v,ju as w,Iu as x,Cu as y,Lu as z};