@serifpersia/dango 3.9.0 → 3.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/README.md +1 -1
  2. package/client/dist/assets/{AnimeCard-NynqB4iz.js → AnimeCard-DV3CayVB.js} +1 -1
  3. package/client/dist/assets/{AnimeInfo-B_VL5_wz.js → AnimeInfo-C_yN40WV.js} +1 -1
  4. package/client/dist/assets/AnimeInfoPage-Dr9zOOq1.js +2 -0
  5. package/client/dist/assets/{Asmr-DMspoMra.js → Asmr-BzVhO0PK.js} +1 -1
  6. package/client/dist/assets/{AsmrPopup-BRzUy94h.js → AsmrPopup-CfCdTvhx.js} +1 -1
  7. package/client/dist/assets/{AsmrResetProgressModal-s1eRMiAW.js → AsmrResetProgressModal-CLjzhb4H.js} +1 -1
  8. package/client/dist/assets/{Home-ujV6ObHi.css → Home-D_Hd4SUo.css} +1 -1
  9. package/client/dist/assets/{Home-B2BED0gb.js → Home-wtyG5fKA.js} +1 -1
  10. package/client/dist/assets/{Insights-I1lFAHGg.js → Insights-DGTqzxXr.js} +1 -1
  11. package/client/dist/assets/{LibraryListPage-DVFA51uJ.js → LibraryListPage-DhsV2n64.js} +1 -1
  12. package/client/dist/assets/{ListeningList-C3_v1Hfq.js → ListeningList-BPD9igfn.js} +1 -1
  13. package/client/dist/assets/{Manga-Dwkuv9to.js → Manga-ClgoT4qk.js} +1 -1
  14. package/client/dist/assets/{MangaInfoPage-Dbe96uTp.js → MangaInfoPage-B8fttN1T.js} +1 -1
  15. package/client/dist/assets/{MangaReadPage-DMH36Bre.js → MangaReadPage-BTAVFeJH.js} +1 -1
  16. package/client/dist/assets/{MangaResetProgressModal-61xx7JY3.js → MangaResetProgressModal-CshoUUBm.js} +1 -1
  17. package/client/dist/assets/{Mature-BcCct3VM.js → Mature-DAgfZt9Q.js} +1 -1
  18. package/client/dist/assets/{MatureConsentModal-CkodsDv3.js → MatureConsentModal-BhpY2wdn.js} +1 -1
  19. package/client/dist/assets/{MediaCard-qj_IAltC.js → MediaCard-Czkyxqgb.js} +1 -1
  20. package/client/dist/assets/{OptionListMenu-BfK_U2JZ.js → OptionListMenu-HllK8Z_u.js} +1 -1
  21. package/client/dist/assets/Player-BVGxVSGv.js +56 -0
  22. package/client/dist/assets/{PlayerProvider-DMiS49-n.js → PlayerProvider-DGtOX3e2.js} +1 -1
  23. package/client/dist/assets/{PlayerSettings-DnDE4FjN.js → PlayerSettings-9iBVbWNR.js} +1 -1
  24. package/client/dist/assets/{QueueOptionsButton-ZPslb1vw.js → QueueOptionsButton-C3ptca9g.js} +1 -1
  25. package/client/dist/assets/{QueueRail-iewQtTf2.js → QueueRail-De3oifUM.js} +1 -1
  26. package/client/dist/assets/{ReadingList-DSn_7RPb.js → ReadingList-Bco6T_Jh.js} +1 -1
  27. package/client/dist/assets/{ResetProgressModal-DkUfWl68.js → ResetProgressModal-Cx1SaMad.js} +1 -1
  28. package/client/dist/assets/Search-B6dgK2Zu.js +1 -0
  29. package/client/dist/assets/Settings-DvOx960h.js +21 -0
  30. package/client/dist/assets/{SkeletonGrid-CDNxWb9m.js → SkeletonGrid-B2s8ytI8.js} +1 -1
  31. package/client/dist/assets/{Trackers-ChCE0FpJ.js → Trackers-Bp-U_jYN.js} +1 -1
  32. package/client/dist/assets/{Tv-DT3m2nZs.css → Tv-CDALArd3.css} +1 -1
  33. package/client/dist/assets/Tv-t2tt4jji.js +4 -0
  34. package/client/dist/assets/{TvInfo-CBDMmwKZ.js → TvInfo-BiUMbdN7.js} +1 -1
  35. package/client/dist/assets/{TvPopup-CbjydYVj.js → TvPopup-DnwmyRRE.js} +1 -1
  36. package/client/dist/assets/{TvSearch-B46QqKRF.js → TvSearch-C9VNflnp.js} +1 -1
  37. package/client/dist/assets/{TvWatchlist-CKClWqAa.js → TvWatchlist-Bt39ymiP.js} +1 -1
  38. package/client/dist/assets/{VirtualKeyboard-CO8IUNmo.js → VirtualKeyboard-BSILqgeU.js} +1 -1
  39. package/client/dist/assets/{WatchAlong-B3amSjXR.js → WatchAlong-GtXJ-2Qq.js} +1 -1
  40. package/client/dist/assets/{WatchAlongPanel-CNXfPJV8.js → WatchAlongPanel-CxkbtjKg.js} +1 -1
  41. package/client/dist/assets/{Watchlist-Dy02-vjm.js → Watchlist-CQ57yp82.js} +1 -1
  42. package/client/dist/assets/index-BYGDqzEf.js +178 -0
  43. package/client/dist/assets/index-TGvIXMUj.css +1 -0
  44. package/client/dist/assets/{libraryInvalidation-2b2_7vwd.js → libraryInvalidation-CHW51Kbi.js} +1 -1
  45. package/client/dist/assets/playbackCompletion-DrDOXJXe.js +1 -0
  46. package/client/dist/assets/{useAnimeInfoData-CdP9RtUB.js → useAnimeInfoData-CZY3Ui-u.js} +1 -1
  47. package/client/dist/assets/{useMangaLibrary-BANnF0ot.js → useMangaLibrary-x8zL6mOh.js} +1 -1
  48. package/client/dist/assets/{useMangaPopup-BdNC1rr_.js → useMangaPopup-DdrgbIw-.js} +1 -1
  49. package/client/dist/assets/{useProviders-B0XQ7aY4.js → useProviders-Dk2T31ho.js} +1 -1
  50. package/client/dist/assets/{useTv-DM0uMYJ8.js → useTv-CDh-n25T.js} +1 -1
  51. package/client/dist/assets/{useTvLibrary-aGEImTh1.js → useTvLibrary-Dec7yfKF.js} +1 -1
  52. package/client/dist/assets/useWatchAlongPlayer-D1o2zDEn.css +1 -0
  53. package/client/dist/assets/useWatchAlongPlayer-DpUPA4jD.js +10 -0
  54. package/client/dist/index.html +2 -2
  55. package/package.json +2 -2
  56. package/server/dist/server.js +136 -136
  57. package/server/package.json +1 -1
  58. package/client/dist/assets/AnimeInfoPage-DEHp6dbx.js +0 -2
  59. package/client/dist/assets/Player-CbaQmCP0.js +0 -56
  60. package/client/dist/assets/Search-DleGk52z.js +0 -1
  61. package/client/dist/assets/Settings-BL3wetIt.js +0 -21
  62. package/client/dist/assets/Tv-CnpSDbBA.js +0 -4
  63. package/client/dist/assets/index-D1FwY1a_.js +0 -178
  64. package/client/dist/assets/index-RwPVmyxh.css +0 -1
  65. package/client/dist/assets/playbackCompletion-OZmyMjQt.js +0 -1
  66. package/client/dist/assets/useWatchAlongPlayer-BkMVbNsw.js +0 -10
  67. package/client/dist/assets/useWatchAlongPlayer-CkSxIqXL.css +0 -1
@@ -0,0 +1,178 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Home-wtyG5fKA.js","assets/vendor-core-DfaOB3Rn.js","assets/vendor-query-BBT5_sHx.js","assets/MediaCard-Czkyxqgb.js","assets/vendor-icons-DrybRNxP.js","assets/vendor-ui-3qrARCPr.js","assets/useIsMobile-Dvx1uJ82.js","assets/MatureConsentModal-BhpY2wdn.js","assets/MatureConsentModal-CqewXc0q.css","assets/MediaCard-CJ-18Ma8.css","assets/AnimeCard-DV3CayVB.js","assets/useAnimeInfoData-CZY3Ui-u.js","assets/QueueOptionsButton-C3ptca9g.js","assets/QueueOptionsButton-CM15uQn8.css","assets/playbackCompletion-DrDOXJXe.js","assets/SkeletonGrid-B2s8ytI8.js","assets/SkeletonGrid-BisPI38I.css","assets/ErrorMessage-DAxegITP.js","assets/ErrorMessage-CXoRbrLN.css","assets/ResetProgressModal-Cx1SaMad.js","assets/QueueRail-De3oifUM.js","assets/QueueRail-CcHdXRmS.css","assets/useMangaPopup-DdrgbIw-.js","assets/useMangaLibrary-x8zL6mOh.js","assets/libraryInvalidation-CHW51Kbi.js","assets/usePopup-DS9jMzp6.js","assets/MangaResetProgressModal-CshoUUBm.js","assets/useProviders-Dk2T31ho.js","assets/useTv-CDh-n25T.js","assets/TvPopup-DnwmyRRE.js","assets/useTvLibrary-Dec7yfKF.js","assets/AsmrResetProgressModal-CLjzhb4H.js","assets/AsmrPopup-CfCdTvhx.js","assets/Home-D_Hd4SUo.css","assets/Watchlist-CQ57yp82.js","assets/LibraryListPage.module-r6k9nyT9.js","assets/LibraryListPage-DmdjNa2U.css","assets/ActiveFilterChips-olGfwxle.js","assets/ActiveFilterChips-QjkplDN2.css","assets/Watchlist-DW7kUORr.css","assets/Settings-DvOx960h.js","assets/ToggleSwitch-CN_ppEc9.js","assets/ToggleSwitch-BPil0d_k.css","assets/Settings-B57LhIVH.css","assets/Player-BVGxVSGv.js","assets/PlayerProvider-DGtOX3e2.js","assets/PlayerProvider-ZeplRma-.css","assets/useWatchAlongPlayer-DpUPA4jD.js","assets/useWatchAlongPlayer-D1o2zDEn.css","assets/AnimeMetaDetails-B3-A7O5H.js","assets/AnimeMetaDetails-BwNQnRCd.css","assets/SynopsisText-B3Sa5pRv.js","assets/SynopsisText-CYv2W3yR.css","assets/WatchAlongPanel-CxkbtjKg.js","assets/WatchAlongPanel-DWb8lSzW.css","assets/Player-1LfYnRyR.css","assets/WatchAlong-GtXJ-2Qq.js","assets/Search-B6dgK2Zu.js","assets/Search.module-C_qwCdHS.js","assets/Search-DCKK3seW.css","assets/Mature-DAgfZt9Q.js","assets/Mature-DJmUUtlF.css","assets/Asmr-BzVhO0PK.js","assets/useAsmrPopup-BBmHrx9v.js","assets/page.module-C1MlZzf3.js","assets/page-DRvjODkg.css","assets/Asmr-Do89pEHG.css","assets/Manga-ClgoT4qk.js","assets/Manga.module-depGEacJ.js","assets/Manga-CqAceKxR.css","assets/MangaInfoPage-B8fttN1T.js","assets/MangaReadPage-BTAVFeJH.js","assets/ReadingList-Bco6T_Jh.js","assets/LibraryListPage-DhsV2n64.js","assets/TvSearch-C9VNflnp.js","assets/TvInfo-BiUMbdN7.js","assets/TvInfo-Bu36xJyO.css","assets/Tv-t2tt4jji.js","assets/OptionListMenu-HllK8Z_u.js","assets/Tv-CDALArd3.css","assets/TvWatchlist-Bt39ymiP.js","assets/ListeningList-BPD9igfn.js","assets/Trackers-Bp-U_jYN.js","assets/Trackers-BC636V59.css","assets/Insights-DGTqzxXr.js","assets/Insights-DEicrokg.css","assets/AnimeInfoPage-Dr9zOOq1.js","assets/PlayerRedirect-fv2tzEUu.js","assets/VirtualKeyboard-BSILqgeU.js","assets/VirtualKeyboard-CejCi3pJ.css"])))=>i.map(i=>d[i]);
2
+ import{N as Rr,k as re,A as M,q as V,h as w,S as de,d as g,u as o,X as ye,x as ge,T as Le,$ as $n,g as $t,L as le,a as Mn,c as ut,e as Dr,f as $r,D as Mr,i as jr,P as en,j as Br,l as $,m as tn,z as K,n as Fr,B as Wr}from"./vendor-core-DfaOB3Rn.js";import{s as Ne,i as Kr,q as Ur,u as oe,a as ce,b as B,c as dt,Q as Hr,d as Qr}from"./vendor-query-BBT5_sHx.js";import{I as A}from"./vendor-icons-DrybRNxP.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const a of s)if(a.type==="childList")for(const i of a.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(s){const a={};return s.integrity&&(a.integrity=s.integrity),s.referrerPolicy&&(a.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?a.credentials="include":s.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(s){if(s.ep)return;s.ep=!0;const a=n(s);fetch(s.href,a)}})();const zr="modulepreload",Vr=function(e){return"/"+e},nn={},U=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){let l=function(u){return Promise.all(u.map(d=>Promise.resolve(d).then(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");s=l(n.map(u=>{if(u=Vr(u),u in nn)return;nn[u]=!0;const d=u.endsWith(".css"),m=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${m}`))return;const p=document.createElement("link");if(p.rel=d?"stylesheet":zr,d||(p.as="script"),p.crossOrigin="",p.href=u,c&&p.setAttribute("nonce",c),document.head.appendChild(p),d)return new Promise((h,y)=>{p.addEventListener("load",h),p.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${u}`)))})}))}function a(i){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=i,window.dispatchEvent(c),!c.defaultPrevented)throw i}return s.then(i=>{for(const c of i||[])c.status==="rejected"&&a(c.reason);return t().catch(a)})};let Gr={data:""},Jr=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||Gr},Yr=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,Zr=/\/\*[^]*?\*\/| +/g,rn=/\n+/g,Se=(e,t)=>{let n="",r="",s="";for(let a in e){let i=e[a];a[0]=="@"?a[1]=="i"?n=a+" "+i+";":r+=a[1]=="f"?Se(i,a):a+"{"+Se(i,a[1]=="k"?"":t)+"}":typeof i=="object"?r+=Se(i,t?t.replace(/([^,])+/g,c=>a.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,l=>/&/.test(l)?l.replace(/&/g,c):c?c+" "+l:l)):a):i!=null&&(a=a[1]=="-"?a:a.replace(/[A-Z]/g,"-$&").toLowerCase(),s+=Se.p?Se.p(a,i):a+":"+i+";")}return n+(t&&s?t+"{"+s+"}":s)+r},Ee={},jn=e=>{if(typeof e=="object"){let t="";for(let n in e)t+=n+jn(e[n]);return t}return e},Xr=(e,t,n,r,s)=>{let a=jn(e),i=Ee[a]||(Ee[a]=(l=>{let u=0,d=11;for(;u<l.length;)d=101*d+l.charCodeAt(u++)>>>0;return"go"+d})(a));if(!Ee[i]){let l=a!==e?e:(u=>{let d,m,p=[{}];for(;d=Yr.exec(u.replace(Zr,""));)d[4]?p.shift():d[3]?(m=d[3].replace(rn," ").trim(),p.unshift(p[0][m]=p[0][m]||{})):p[0][d[1]]=d[2].replace(rn," ").trim();return p[0]})(e);Ee[i]=Se(s?{["@keyframes "+i]:l}:l,n?"":"."+i)}let c=n&&Ee.g;return n&&(Ee.g=Ee[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)})(Ee[i],t,r,c),i},eo=(e,t,n)=>e.reduce((r,s,a)=>{let i=t[a];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?"":Se(c,""):c===!1?"":c}return r+s+(i??"")},"");function mt(e){let t=this||{},n=e.call?e(t.p):e;return Xr(n.unshift?n.raw?eo(n,[].slice.call(arguments,1),t.p):n.reduce((r,s)=>Object.assign(r,s&&s.call?s(t.p):s),{}):n,Jr(t.target),t.g,t.o,t.k)}let Bn,Tt,It;mt.bind({g:1});let _e=mt.bind({k:1});function to(e,t,n,r){Se.p=t,Bn=e,Tt=n,It=r}function Te(e,t){let n=this||{};return function(){let r=arguments;function s(a,i){let c=Object.assign({},a),l=c.className||s.className;n.p=Object.assign({theme:Tt&&Tt()},c),n.o=/go\d/.test(l),c.className=mt.apply(n,r)+(l?" "+l:"");let u=e;return e[0]&&(u=c.as||e,delete c.as),It&&u[0]&&It(c),Bn(u,c)}return s}}var no=e=>typeof e=="function",at=(e,t)=>no(e)?e(t):e,ro=(()=>{let e=0;return()=>(++e).toString()})(),Fn=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),oo=20,Mt="default",Wn=(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 Wn(e,{type:e.toasts.find(i=>i.id===r.id)?1:0,toast:r});case 3:let{toastId:s}=t;return{...e,toasts:e.toasts.map(i=>i.id===s||s===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 a=t.time-(e.pausedAt||0);return{...e,pausedAt:void 0,toasts:e.toasts.map(i=>({...i,pauseDuration:i.pauseDuration+a}))}}},rt=[],Kn={toasts:[],pausedAt:void 0,settings:{toastLimit:oo}},he={},Un=(e,t=Mt)=>{he[t]=Wn(he[t]||Kn,e),rt.forEach(([n,r])=>{n===t&&r(he[t])})},Hn=e=>Object.keys(he).forEach(t=>Un(e,t)),so=e=>Object.keys(he).find(t=>he[t].toasts.some(n=>n.id===e)),pt=(e=Mt)=>t=>{Un(t,e)},ao={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},io=(e={},t=Mt)=>{let[n,r]=g(he[t]||Kn),s=M(he[t]);w(()=>(s.current!==he[t]&&r(he[t]),rt.push([t,r]),()=>{let i=rt.findIndex(([c])=>c===t);i>-1&&rt.splice(i,1)}),[t]);let a=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||ao[i.type],style:{...e.style,...(u=e[i.type])==null?void 0:u.style,...i.style}}});return{...n,toasts:a}},co=(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||ro()}),ze=e=>(t,n)=>{let r=co(t,e,n);return pt(r.toasterId||so(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?pt(t)(n):Hn(n)};Y.dismissAll=e=>Y.dismiss(void 0,e);Y.remove=(e,t)=>{let n={type:4,toastId:e};t?pt(t)(n):Hn(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(s=>{let a=t.success?at(t.success,s):void 0;return a?Y.success(a,{id:r,...n,...n?.success}):Y.dismiss(r),s}).catch(s=>{let a=t.error?at(t.error,s):void 0;a?Y.error(a,{id:r,...n,...n?.error}):Y.dismiss(r)}),e};var lo=1e3,uo=(e,t="default")=>{let{toasts:n,pausedAt:r}=io(e,t),s=M(new Map).current,a=V((m,p=lo)=>{if(s.has(m))return;let h=setTimeout(()=>{s.delete(m),i({type:4,toastId:m})},p);s.set(m,h)},[]);w(()=>{if(r)return;let m=Date.now(),p=n.map(h=>{if(h.duration===1/0)return;let y=(h.duration||0)+h.pauseDuration-(m-h.createdAt);if(y<0){h.visible&&Y.dismiss(h.id);return}return setTimeout(()=>Y.dismiss(h.id,t),y)});return()=>{p.forEach(h=>h&&clearTimeout(h))}},[n,r,t]);let i=V(pt(t),[t]),c=V(()=>{i({type:5,time:Date.now()})},[i]),l=V((m,p)=>{i({type:1,toast:{id:m,height:p}})},[i]),u=V(()=>{r&&i({type:6,time:Date.now()})},[r,i]),d=V((m,p)=>{let{reverseOrder:h=!1,gutter:y=8,defaultPosition:_}=p||{},O=n.filter(b=>(b.position||_)===(m.position||_)&&b.height),x=O.findIndex(b=>b.id===m.id),E=O.filter((b,T)=>T<x&&b.visible).length;return O.filter(b=>b.visible).slice(...h?[E+1]:[0,E]).reduce((b,T)=>b+(T.height||0)+y,0)},[n]);return w(()=>{n.forEach(m=>{if(m.dismissed)a(m.id,m.removeDelay);else{let p=s.get(m.id);p&&(clearTimeout(p),s.delete(m.id))}})},[n,a]),{toasts:n,handlers:{updateHeight:l,startPause:c,endPause:u,calculateOffset:d}}},mo=_e`
3
+ from {
4
+ transform: scale(0) rotate(45deg);
5
+ opacity: 0;
6
+ }
7
+ to {
8
+ transform: scale(1) rotate(45deg);
9
+ opacity: 1;
10
+ }`,po=_e`
11
+ from {
12
+ transform: scale(0);
13
+ opacity: 0;
14
+ }
15
+ to {
16
+ transform: scale(1);
17
+ opacity: 1;
18
+ }`,ho=_e`
19
+ from {
20
+ transform: scale(0) rotate(90deg);
21
+ opacity: 0;
22
+ }
23
+ to {
24
+ transform: scale(1) rotate(90deg);
25
+ opacity: 1;
26
+ }`,fo=Te("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: ${mo} 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: ${po} 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: ${ho} 0.15s ease-out forwards;
56
+ animation-delay: 180ms;
57
+ transform: rotate(90deg);
58
+ }
59
+ `,yo=_e`
60
+ from {
61
+ transform: rotate(0deg);
62
+ }
63
+ to {
64
+ transform: rotate(360deg);
65
+ }
66
+ `,go=Te("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: ${yo} 1s linear infinite;
75
+ `,vo=_e`
76
+ from {
77
+ transform: scale(0) rotate(45deg);
78
+ opacity: 0;
79
+ }
80
+ to {
81
+ transform: scale(1) rotate(45deg);
82
+ opacity: 1;
83
+ }`,bo=_e`
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
+ }`,wo=Te("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: ${vo} 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: ${bo} 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
+ `,_o=Te("div")`
125
+ position: absolute;
126
+ `,ko=Te("div")`
127
+ position: relative;
128
+ display: flex;
129
+ justify-content: center;
130
+ align-items: center;
131
+ min-width: 20px;
132
+ min-height: 20px;
133
+ `,Eo=_e`
134
+ from {
135
+ transform: scale(0.6);
136
+ opacity: 0.4;
137
+ }
138
+ to {
139
+ transform: scale(1);
140
+ opacity: 1;
141
+ }`,So=Te("div")`
142
+ position: relative;
143
+ transform: scale(0.6);
144
+ opacity: 0.4;
145
+ min-width: 20px;
146
+ animation: ${Eo} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275)
147
+ forwards;
148
+ `,Po=({toast:e})=>{let{icon:t,type:n,iconTheme:r}=e;return t!==void 0?typeof t=="string"?re(So,null,t):t:n==="blank"?null:re(ko,null,re(go,{...r}),n!=="loading"&&re(_o,null,n==="error"?re(fo,{...r}):re(wo,{...r})))},To=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
+ `,Io=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
+ `,xo="0%{opacity:0;} 100%{opacity:1;}",No="0%{opacity:1;} 100%{opacity:0;}",Co=Te("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
+ `,Ao=Te("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
+ `,Oo=(e,t)=>{let n=e.includes("top")?1:-1,[r,s]=Fn()?[xo,No]:[To(n),Io(n)];return{animation:t?`${_e(r)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${_e(s)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},qo=Rr(({toast:e,position:t,style:n,children:r})=>{let s=e.height?Oo(e.position||t||"top-center",e.visible):{opacity:0},a=re(Po,{toast:e}),i=re(Ao,{...e.ariaProps},at(e.message,e));return re(Co,{className:e.className,style:{...s,...n,...e.style}},typeof r=="function"?r({icon:a,message:i}):re(de,null,a,i))});to(re);var Lo=({id:e,className:t,style:n,onHeightUpdate:r,children:s})=>{let a=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 re("div",{ref:a,className:t,style:n},s)},Ro=(e,t)=>{let n=e.includes("top"),r=n?{top:0}:{bottom:0},s=e.includes("center")?{justifyContent:"center"}:e.includes("right")?{justifyContent:"flex-end"}:{};return{left:0,right:0,display:"flex",position:"absolute",transition:Fn()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${t*(n?1:-1)}px)`,...r,...s}},Do=mt`
174
+ z-index: 9999;
175
+ > * {
176
+ pointer-events: auto;
177
+ }
178
+ `,Je=16,Qn=({reverseOrder:e,position:t="top-center",toastOptions:n,gutter:r,children:s,toasterId:a,containerStyle:i,containerClassName:c})=>{let{toasts:l,handlers:u}=uo(n,a);return re("div",{"data-rht-toaster":a||"",style:{position:"fixed",zIndex:9999,top:Je,left:Je,right:Je,bottom:Je,pointerEvents:"none",...i},className:c,onMouseEnter:u.startPause,onMouseLeave:u.endPause},l.map(d=>{let m=d.position||t,p=u.calculateOffset(d,{reverseOrder:e,gutter:r,defaultPosition:t}),h=Ro(m,p);return re(Lo,{id:d.id,key:d.id,onHeightUpdate:u.updateHeight,className:d.visible?Do:"",style:h},d.type==="custom"?at(d.message,d):s?s(d):re(qo,{toast:d,position:m}))}))},N=Y;const $o="_fadeImage_1bp3x_1",Mo="_loaded_1bp3x_6",on={fadeImage:$o,loaded:Mo},jo=({className:e,onLoad:t,onError:n,...r})=>{const s=r.src,[a,i]=g(null),c=a!==null&&a===s;return o("img",{...r,className:`${e??""} ${on.fadeImage} ${c?on.loaded:""}`,onLoad:l=>{i(s),t?.(l)},onError:l=>{i(s),n?.(l)}})};function ht(e){const t={subscribe(n){let r=null,s=!1,a=!1,i=!1;function c(){if(r===null){i=!0;return}a||(a=!0,typeof r=="function"?r():r&&r.unsubscribe())}return r=e({next(l){var u;s||(u=n.next)===null||u===void 0||u.call(n,l)},error(l){var u;s||(s=!0,(u=n.error)===null||u===void 0||u.call(n,l),c())},complete(){var l;s||(s=!0,(l=n.complete)===null||l===void 0||l.call(n),c())}}),i&&c(),{unsubscribe:c}},pipe(...n){return n.reduce(Bo,t)}};return t}function Bo(e,t){return t(e)}function Fo(e){const t=new AbortController;return new Promise((n,r)=>{let s=!1;function a(){s||(s=!0,i.unsubscribe())}t.signal.addEventListener("abort",()=>{r(t.signal.reason)});const i=e.subscribe({next(c){s=!0,n(c),a()},error(c){r(c)},complete(){t.abort(),a()}})})}function Wo(e){return t=>{let n=0,r=null;const s=[];function a(){r||(r=t.subscribe({next(c){for(const u of s){var l;(l=u.next)===null||l===void 0||l.call(u,c)}},error(c){for(const u of s){var l;(l=u.error)===null||l===void 0||l.call(u,c)}},complete(){for(const l of s){var c;(c=l.complete)===null||c===void 0||c.call(l)}}}))}function i(){if(n===0&&r){const c=r;r=null,c.unsubscribe()}}return ht(c=>(n++,s.push(c),a(),{unsubscribe(){n--,i();const l=s.findIndex(u=>u===c);l>-1&&s.splice(l,1)}}))}}function Ko(e){let t=e;const n=[],r=i=>{t!==void 0&&i.next(t),n.push(i)},s=i=>{n.splice(n.indexOf(i),1)},a=ht(i=>(r(i),()=>{s(i)}));return a.next=i=>{if(t!==i){t=i;for(const c of n)c.next(i)}},a.get=()=>t,a}function Uo(e){return ht(t=>{function n(r=0,s=e.op){const a=e.links[r];if(!a)throw new Error("No more links to execute - did you forget to add an ending link?");return a({op:s,next(i){return n(r+1,i)}})}return n().subscribe(t)})}function Ue(e){"@babel/helpers - typeof";return Ue=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},Ue(e)}function Ho(e,t){if(Ue(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Ue(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Qo(e){var t=Ho(e,"string");return Ue(t)=="symbol"?t:t+""}function ae(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 sn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Z(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?sn(Object(n),!0).forEach(function(r){ae(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sn(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 zo(e){return typeof e=="function"}function Vo(){return Object.create(null)}const Go=typeof Symbol=="function"&&!!Symbol.asyncIterator;function Jo(e){return Go&&Pe(e)&&Symbol.asyncIterator in e}const Yo=e=>e(),zn=()=>{},an=e=>{Object.freeze&&Object.freeze(e)};function Vn(e,t,n){var r;const s=t.join(".");return(r=n[s])!==null&&r!==void 0||(n[s]=new Proxy(zn,{get(a,i){if(!(typeof i!="string"||i==="then"))return Vn(e,[...t,i],n)},apply(a,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)}),an(u.args),an(u.path),e(u)}})),n[s]}const Gn=e=>Vn(e,[],Vo()),Zo=e=>new Proxy(zn,{get(t,n){if(n!=="then")return e(n)}});function He(e){"@babel/helpers - typeof";return He=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},He(e)}function Xo(e,t){if(He(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(He(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function es(e){var t=Xo(e,"string");return He(t)=="symbol"?t:t+""}function xt(e,t,n){return(t=es(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(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Ye(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){xt(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}var ts=class extends Error{constructor(e){super(ns(e)),Object.assign(this,e)}};function ns(e){if("message"in e)return String(e.message)}function rs(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 ts(e)}}var ln=class extends Error{constructor(e){var t,n,r;const s=rs(e.cause),a=(t=(n=e.message)!==null&&n!==void 0?n:s?.message)!==null&&t!==void 0?t:e.code;super(a,{cause:s}),xt(this,"cause",void 0),xt(this,"code",void 0),this.code=e.code,this.name="TRPCError",(r=this.cause)!==null&&r!==void 0||(this.cause=s)}};function os(e,t){if("error"in e){const n=t.deserialize(e.error);return{ok:!1,error:Ye(Ye({},e),{},{error:n})}}return{ok:!0,result:Ye(Ye({},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 ss(e,t){let n;try{n=os(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 as(e){return typeof e=="function"}async function is(e,t){const{_def:n}=e;let r=n.procedures[t];for(;!r;){const s=Object.keys(n.lazy).find(a=>t===a||t.startsWith(a+"."));if(!s)return null;await n.lazy[s].load(),r=n.procedures[t]}return r}async function cs(e){const{type:t,path:n}=e,r=await is(e.router,n);if(!r||!as(r)||r._def.type!==t&&!e.allowMethodOverride)throw new ln({code:"NOT_FOUND",message:`No "${t}"-procedure on path "${n}"`});if(r._def.type!==t&&e.allowMethodOverride&&r._def.type==="subscription")throw new ln({code:"METHOD_NOT_SUPPORTED",message:"Method override is not supported for subscriptions"});return r(e)}function ls(e){return e instanceof it}function us(e){return Pe(e)&&Pe(e.error)&&typeof e.error.code=="number"&&typeof e.error.message=="string"}function ds(e,t){return typeof e=="string"?e:Pe(e)&&typeof e.message=="string"?e.message:t}var it=class ot extends Error{constructor(t,n){var r,s;const a=n?.cause;super(t,{cause:a}),ae(this,"cause",void 0),ae(this,"shape",void 0),ae(this,"data",void 0),ae(this,"meta",void 0),this.meta=n?.meta,this.cause=a,this.shape=n==null||(r=n.result)===null||r===void 0?void 0:r.error,this.data=n==null||(s=n.result)===null||s===void 0?void 0:s.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,ot.prototype)}static from(t,n={}){const r=t;return ls(r)?(n.meta&&(r.meta=Z(Z({},r.meta),n.meta)),r):us(r)?new ot(r.error.message,Z(Z({},n),{},{result:r,cause:n.cause})):new ot(ds(r,"Unknown error"),Z(Z({},n),{},{cause:r}))}};function ms(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 un=e=>typeof e=="function";function ps(e){if(e)return e;if(typeof window<"u"&&un(window.fetch))return window.fetch.bind(window);if(typeof globalThis<"u"&&un(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}function hs(...e){const t=new AbortController,n=e.length;let r=0;const s=()=>{++r===n&&t.abort()};for(const a of e)a?.aborted?s():a?.addEventListener("abort",s,{once:!0});return t.signal}function fs(...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 ys(e){return{url:e.url.toString(),fetch:e.fetch,transformer:ms(e.transformer),methodOverride:e.methodOverride}}function gs(e){const t={};for(let n=0;n<e.length;n++){const r=e[n];t[n]=r}return t}const vs={query:"GET",mutation:"POST",subscription:"PATCH"};function Jn(e){return"input"in e?e.transformer.input.serialize(e.input):gs(e.inputs.map(t=>e.transformer.input.serialize(t)))}const Yn=e=>{const t=e.url.split("?");let n=t[0].replace(/\/$/,"")+"/"+e.path;const r=[];if(t[1]&&r.push(t[1]),"inputs"in e&&r.push("batch=1"),e.type==="query"||e.type==="subscription"){const s=Jn(e);s!==void 0&&e.methodOverride!=="POST"&&r.push(`input=${encodeURIComponent(JSON.stringify(s))}`)}return r.length&&(n+="?"+r.join("&")),n},bs=e=>{if(e.type==="query"&&e.methodOverride!=="POST")return;const t=Jn(e);return t!==void 0?JSON.stringify(t):void 0},ws=e=>Ss(Z(Z({},e),{},{contentTypeHeader:"application/json",getUrl:Yn,getBody:bs}));var _s=class extends Error{constructor(){const e="AbortError";super(e),this.name=e,this.message=e}};const ks=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 _s};async function Es(e){var t,n;ks(e.signal);const r=e.getUrl(e),s=e.getBody(e),a=(t=e.methodOverride)!==null&&t!==void 0?t:vs[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&&a!=="GET"?{"content-type":e.contentTypeHeader}:{}),e.trpcAcceptHeader?{[(n=e.trpcAcceptHeaderKey)!==null&&n!==void 0?n:"trpc-accept"]:e.trpcAcceptHeader}:void 0),i);return ps(e.fetch)(r,{method:a,signal:e.signal,body:s,headers:c})}async function Ss(e){const t={},n=await Es(e);t.response=n;const r=await n.json();return t.responseJSON=r,{json:r,meta:t}}const dn=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function mn(e){let t=null,n=null;const r=()=>{clearTimeout(n),n=null,t=null};function s(c){const l=[[]];let u=0;for(;;){const p=c[u];if(!p)break;const h=l[l.length-1];if(p.aborted){var d;(d=p.reject)===null||d===void 0||d.call(p,new Error("Aborted")),u++;continue}if(e.validate(h.concat(p).map(y=>y.key))){h.push(p),u++;continue}if(h.length===0){var m;(m=p.reject)===null||m===void 0||m.call(p,new Error("Input is too big for a single dispatch")),u++;continue}l.push([])}return l}function a(){const c=s(t);r();for(const l of c){if(!l.length)continue;const u={items:l};for(const d of l)d.batch=u;e.fetch(u.items.map(d=>d.key)).then(async d=>{await Promise.all(d.map(async(p,h)=>{const y=u.items[h];try{var _;const x=await Promise.resolve(p);(_=y.resolve)===null||_===void 0||_.call(y,x)}catch(x){var O;(O=y.reject)===null||O===void 0||O.call(y,x)}y.batch=null,y.reject=null,y.resolve=null}));for(const p of u.items){var m;(m=p.reject)===null||m===void 0||m.call(p,new Error("Missing result")),p.batch=null}}).catch(d=>{for(const p of u.items){var m;(m=p.reject)===null||m===void 0||m.call(p,d),p.batch=null}})}}function i(c){var l;const u={aborted:!1,key:c,batch:null,resolve:dn,reject:dn},d=new Promise((m,p)=>{var h;u.reject=p,u.resolve=m,(h=t)!==null&&h!==void 0||(t=[]),t.push(u)});return(l=n)!==null&&l!==void 0||(n=setTimeout(a)),d}return{load:i}}function Ps(e){var t,n;const r=ys(e),s=(t=e.maxURLLength)!==null&&t!==void 0?t:1/0,a=(n=e.maxItems)!==null&&n!==void 0?n:1/0;return()=>{const i=l=>({validate(u){if(s===1/0&&a===1/0)return!0;if(u.length>a)return!1;const d=u.map(p=>p.path).join(","),m=u.map(p=>p.input);return Yn(Z(Z({},r),{},{type:l,path:d,inputs:m,signal:null})).length<=s},async fetch(u){const d=u.map(y=>y.path).join(","),m=u.map(y=>y.input),p=hs(...u.map(y=>y.signal)),h=await ws(Z(Z({},r),{},{path:d,inputs:m,type:l,headers(){return e.headers?typeof e.headers=="function"?e.headers({opList:u}):e.headers:{}},signal:p}));return(Array.isArray(h.json)?h.json:u.map(()=>h.json)).map(y=>({meta:h.meta,json:y}))}}),c={query:mn(i("query")),mutation:mn(i("mutation"))};return({op:l})=>ht(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:fs(l.signal,d.signal)}));let p=!1,h;return m.then(y=>{p=!0,h=y;const _=ss(y.json,r.transformer.output);if(!_.ok){u.error(it.from(_.error,{meta:y.meta}));return}u.next({context:y.meta,result:_.result}),u.complete()}).catch(y=>{p=!0,u.error(it.from(y,{meta:h?.meta}))}),()=>{p||d.abort()}})}}const Zn=(e,...t)=>typeof e=="function"?e(...t):e;function Ts(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}async function Is(e){const t=await Zn(e.url);return e.connectionParams?t+`${t.includes("?")?"&":"?"}connectionParams=1`:t}async function xs(e,t){const n={method:"connectionParams",data:await Zn(e)};return t.encode(n)}function Ns(e){const{promise:t,resolve:n,reject:r}=Ts();return e.addEventListener("open",()=>{e.removeEventListener("error",r),n()}),e.addEventListener("error",r),t}function Cs(e,{intervalMs:t,pongTimeoutMs:n}){let r,s;function a(){r=setTimeout(()=>{e.send("PING"),s=setTimeout(()=>{e.close()},n)},t)}function i(){clearTimeout(r),a()}function c(){clearTimeout(s),i()}e.addEventListener("open",a),e.addEventListener("message",({data:l})=>{clearTimeout(r),a(),l==="PONG"&&c()}),e.addEventListener("close",()=>{clearTimeout(r),clearTimeout(s)})}var As=class Nt{constructor(t){var n;if(ae(this,"id",++Nt.connectCount),ae(this,"WebSocketPonyfill",void 0),ae(this,"urlOptions",void 0),ae(this,"keepAliveOpts",void 0),ae(this,"encoder",void 0),ae(this,"wsObservable",Ko(null)),ae(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=++Nt.connectCount;const t=Is(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&&Cs(n,this.keepAliveOpts),n.addEventListener("close",()=>{this.ws===n&&(this.ws=null)}),await Ns(n),this.urlOptions.connectionParams&&n.send(await xs(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()}}};ae(As,"connectCount",0);var Xn=class{constructor(e){ae(this,"links",void 0),ae(this,"runtime",void 0),ae(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=e.links.map(t=>t(this.runtime))}$request(e){var t;return Uo({links:this.links,op:Z(Z({},e),{},{context:(t=e.context)!==null&&t!==void 0?t:{},id:++this.requestId})}).pipe(Wo())}async requestAsPromise(e){try{const t=this.$request(e);return(await Fo(t)).result.data}catch(t){throw it.from(t)}}query(e,t,n){return this.requestAsPromise({type:"query",path:e,input:t,context:n?.context,signal:n?.signal})}mutation(e,t,n){return this.requestAsPromise({type:"mutation",path:e,input:t,context:n?.context,signal:n?.signal})}subscription(e,t,n){return this.$request({type:"subscription",path:e,input:t,context:n.context,signal:n.signal}).subscribe({next(r){switch(r.result.type){case"state":var s;(s=n.onConnectionStateChange)===null||s===void 0||s.call(n,r.result);break;case"started":var a;(a=n.onStarted)===null||a===void 0||a.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 s;(s=n.onError)===null||s===void 0||s.call(n,r)},complete(){var r;(r=n.onComplete)===null||r===void 0||r.call(n)}})}};const er=Symbol.for("trpc_untypedClient"),Os={query:"query",mutate:"mutation",subscribe:"subscription"},qs=e=>Os[e];function Ls(e){const t=Gn(({path:n,args:r})=>{const s=[...n],a=qs(s.pop()),i=s.join(".");return e[a](i,...r)});return Zo(n=>n===er?e:t[n])}function Rs(e){return Ls(new Xn(e))}function Ds(e){return e[er]}function Qe(e){"@babel/helpers - typeof";return Qe=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},Qe(e)}function $s(e,t){if(Qe(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Qe(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ms(e){var t=$s(e,"string");return Qe(t)=="symbol"?t:t+""}function js(e,t,n){return(t=Ms(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function R(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?pn(Object(n),!0).forEach(function(r){js(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pn(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Bs(e){var t,n,r,s=2;for(typeof Symbol<"u"&&(n=Symbol.asyncIterator,r=Symbol.iterator);s--;){if(n&&(t=e[n])!=null)return t.call(e);if(r&&(t=e[r])!=null)return new st(t.call(e));n="@@asyncIterator",r="@@iterator"}throw new TypeError("Object is not async iterable")}function st(e){function t(n){if(Object(n)!==n)return Promise.reject(new TypeError(n+" is not an object."));var r=n.done;return Promise.resolve(n.value).then(function(s){return{value:s,done:r}})}return st=function(r){this.s=r,this.n=r.next},st.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(r){var s=this.s.return;return s===void 0?Promise.resolve({value:r,done:!0}):t(s.apply(this.s,arguments))},throw:function(r){var s=this.s.return;return s===void 0?Promise.reject(r):t(s.apply(this.s,arguments))}},new st(e)}function Fs(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 Ws(e,t){if(e==null)return{};var n,r,s=Fs(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}const Ks=["cursor","direction"];function ft(e){return{path:e.path.join(".")}}function Us(e){return e.length>=3}function Hs(e){return Us(e)?{type:"prefixed",prefix:e[0],path:e[1],args:e[2]}:{type:"unprefixed",prefix:void 0,path:e[0],args:e[1]}}function jt(e,t,n){var r;const s=Hs(e);let a=(r=s.args)===null||r===void 0?void 0:r.input;if(n){var i,c;a=R(R(R({},(i=(c=s.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[s.path.join("."),a,t?.trpc]}async function Qs(e,t,n){const r=t.getQueryCache().build(t,{queryKey:n});r.setState({data:[],status:"success"});const s=[];var a=!1,i=!1,c;try{for(var l=Bs(e),u;a=!(u=await l.next()).done;a=!1){const d=u.value;s.push(d),r.setState({data:[...s]})}}catch(d){i=!0,c=d}finally{try{a&&l.return!=null&&await l.return()}finally{if(i)throw c}}return s}function be(e){const t=Yo(()=>{const{input:n,type:r}=e,s=e.path.flatMap(a=>a.split("."));if(!n&&r==="any")return s.length?[s]:[];if(r==="infinite"&&Pe(n)&&("direction"in n||"cursor"in n)){const{cursor:a,direction:i}=n;return[s,{input:Ws(n,Ks),type:"infinite"}]}return[s,R(R({},typeof n<"u"&&n!==Ne&&{input:n}),r&&r!=="any"&&{type:r})]});return e.prefix&&t.unshift([e.prefix]),t}function tr(e){const t=[e.path.flatMap(n=>n.split("."))];return e.prefix&&t.unshift([e.prefix]),t}function Bt(e){return zo(e)?e():e}function zs(e){var t;const{input:n,query:r,path:s,queryKey:a,opts:i}=e,c=n===Ne,l=async u=>{var d;const m=R(R({},i),{},{trpc:R(R({},i?.trpc),!(i==null||(d=i.trpc)===null||d===void 0)&&d.abortOnUnmount?{signal:u.signal}:{signal:null})});return await r(...jt(a,m,{direction:u.direction,pageParam:u.pageParam}))};return Object.assign(Kr(R(R({},i??{}),{},{queryKey:a,queryFn:c?Ne:l,initialPageParam:(t=i?.initialCursor)!==null&&t!==void 0?t:n?.cursor})),{trpc:ft({path:s})})}function Vs(e){var t,n;const{mutate:r,path:s,prefix:a,opts:i,overrides:c}=e,l=Bt(e.queryClient),u=tr({path:s,prefix:(t=i?.keyPrefix)!==null&&t!==void 0?t:a}),d=l.defaultMutationOptions(l.getMutationDefaults(u)),m=(n=c?.onSuccess)!==null&&n!==void 0?n:(h=>h.originalFn()),p=async h=>await r(...jt([...u,{input:h}],i));return R(R({},i),{},{mutationKey:u,mutationFn:p,onSuccess(...h){var y,_;return m({originalFn:()=>{var x,E,b;return(x=i==null||(E=i.onSuccess)===null||E===void 0?void 0:E.call(i,...h))!==null&&x!==void 0?x:d==null||(b=d.onSuccess)===null||b===void 0?void 0:b.call(d,...h)},queryClient:l,meta:(y=(_=i?.meta)!==null&&_!==void 0?_:d?.meta)!==null&&y!==void 0?y:{}})},trpc:ft({path:s})})}function Gs(e){const{input:t,query:n,path:r,queryKey:s,opts:a}=e,i=Bt(e.queryClient),c=t===Ne,l=async u=>{var d;const m=R(R({},a),{},{trpc:R(R({},a?.trpc),!(a==null||(d=a.trpc)===null||d===void 0)&&d.abortOnUnmount?{signal:u.signal}:{signal:null})}),p=u.queryKey,h=await n(...jt(p,m));return Jo(h)?Qs(h,i,p):h};return Object.assign(Ur(R(R({},a),{},{queryKey:s,queryFn:c?Ne:l})),{trpc:ft({path:r})})}const Js=e=>{const{subscribe:t,path:n,queryKey:r,input:s,opts:a={}}=e,i="enabled"in a?!!a.enabled:s!==Ne,c=l=>t(n.join("."),s===Ne?void 0:s,l);return R(R({},a),{},{enabled:i,subscribe:c,queryKey:r,trpc:ft({path:n})})};function Ys(e){const t=e.keyPrefix,n=r=>(s,a,i)=>"router"in e?Promise.resolve(Bt(e.ctx)).then(c=>cs({router:e.router,path:s,getRawInput:async()=>a,ctx:c,type:r,signal:void 0,batchIndex:0})):(e.client instanceof Xn?e.client:Ds(e.client))[r](s,a,i);return Gn(({args:r,path:s})=>{const a=[...s],i=a.pop(),[c,l]=r;return{"~types":void 0,pathKey:()=>be({path:a,type:"any",prefix:t}),pathFilter:()=>R(R({},c),{},{queryKey:be({path:a,type:"any",prefix:t})}),queryOptions:()=>Gs({input:c,opts:l,path:a,queryClient:e.queryClient,queryKey:be({path:a,input:c,type:"query",prefix:t}),query:n("query")}),queryKey:()=>be({path:a,input:c,type:"query",prefix:t}),queryFilter:()=>R(R({},l),{},{queryKey:be({path:a,input:c,type:"query",prefix:t})}),infiniteQueryOptions:()=>zs({input:c,opts:l,path:a,queryKey:be({path:a,input:c,type:"infinite",prefix:t}),query:n("query")}),infiniteQueryKey:()=>be({path:a,input:c,type:"infinite",prefix:t}),infiniteQueryFilter:()=>R(R({},l),{},{queryKey:be({path:a,input:c,type:"infinite",prefix:t})}),mutationOptions:()=>{var u;return Vs({opts:c,path:a,prefix:t,queryClient:e.queryClient,mutate:n("mutation"),overrides:(u=e.overrides)===null||u===void 0?void 0:u.mutations})},mutationKey:()=>tr({path:a,prefix:t}),subscriptionOptions:()=>Js({opts:l,path:a,input:c,queryKey:be({path:a,input:c,type:"any",prefix:t}),subscribe:n("subscription")})}[i]()})}function Zs(){const e=ye(null),t=ye(null),n=a=>{const i=Le(()=>Ys({client:a.trpcClient,queryClient:a.queryClient,keyPrefix:a.keyPrefix}),[a.trpcClient,a.queryClient,a.keyPrefix]);return re(e.Provider,{value:a.trpcClient},re(t.Provider,{value:i},a.children))};n.displayName="TRPCProvider";function r(){const a=ge(t);if(!a)throw new Error("useTRPC() can only be used inside of a <TRPCProvider>");return a}function s(){const a=ge(e);if(!a)throw new Error("useTRPCClient() can only be used inside of a <TRPCProvider>");return a}return{TRPCProvider:n,useTRPC:r,useTRPCClient:s}}const Ct={lan:new Set,animepahe:new Set,jasmr:new Set};function xe(e){for(const t of[...Ct[e]])try{t()}catch(n){console.error(`auth-bus listener failed (${e}):`,n)}}function nr(e,t){return Ct[e].add(t),()=>{Ct[e].delete(t)}}let ct="default";function rr(){return ct}function Xs(e){ct=e}const ea=new Set(["playerVideoDelayMs","playerVideoDelayEnabled","anime4kEnabled"]);function Ze(e){return ct==="default"||ea.has(e)?e:`dango:profile:${ct}:${e}`}const ee={keyFor:Ze,getItem:e=>localStorage.getItem(Ze(e)),setItem:(e,t)=>localStorage.setItem(Ze(e),t),removeItem:e=>localStorage.removeItem(Ze(e))};function ta(){localStorage.setItem("dango:profile-session-change",`${Date.now()}-${Math.random()}`),window.location.assign("/")}const na=(e,t)=>new Promise((n,r)=>{t?.throwIfAborted();const s=()=>{clearTimeout(a),r(t?.reason)},a=setTimeout(()=>{t?.removeEventListener("abort",s),n()},e);t?.addEventListener("abort",s,{once:!0})}),Ft=async(e,t)=>{const n=e instanceof Request?e:void 0,r=new Headers(n?.headers);(!t?.body||!(t.body instanceof FormData))&&r.set("Content-Type","application/json");const s=n?.url??e.toString(),a=s.startsWith("/")&&!s.startsWith("//")||typeof window<"u"&&new URL(s,window.location.origin).origin===window.location.origin;if(a){!s.includes("/api/profiles/status")&&!s.includes("/api/profiles/login")&&!s.includes("/api/auth/app-")&&r.set("x-dango-profile-id",rr());let m=ee.getItem("animepahe_ua"),p=ee.getItem("animepahe_cookie");p&&m&&m!==navigator.userAgent&&(ee.removeItem("animepahe_cookie"),ee.removeItem("animepahe_ua"),p=null,m=null,N.error("Your browser changed. Verify AnimePahe again to refresh its cookie."),xe("animepahe"));const h=ee.getItem("jasmr_ua"),y=ee.getItem("jasmr_cookie");m&&r.set("x-animepahe-ua",m),p&&r.set("x-animepahe-cookie",p),h&&r.set("x-jasmr-ua",h),y&&r.set("x-jasmr-cookie",y)}new Headers(t?.headers).forEach((m,p)=>r.set(p,m));const i={...t,headers:r},c=(t?.method??n?.method??"GET").toUpperCase(),l=t?.signal??n?.signal,u=a&&(c==="GET"||c==="HEAD");let d=await fetch(e,i);a&&d.status===409&&(await d.clone().json().catch(()=>null))?.error==="PROFILE_CHANGED"&&window.location.reload(),a&&d.status===401&&!s.includes("/api/profiles/")&&(await d.clone().json().catch(()=>null))?.error==="PROFILE_AUTH_REQUIRED"&&window.dispatchEvent(new Event("dango:profile-auth-required"));for(let m=0;u&&d.status===503&&d.headers.get("x-dango-not-ready")==="1"&&m<3;m++)await d.body?.cancel(),await na(500*2**m,l),d=await fetch(e,i);return d},We=async(e,t)=>{const n=await Ft(e,t);if(!n.ok){const r=await n.text().catch(()=>"");let s={};try{s=JSON.parse(r)}catch{}const a=typeof s.error=="string"?s.error:"";throw n.status===403&&a==="AUTH_REQUIRED"&&s.provider==="animepahe"&&xe("animepahe"),n.status===403&&a==="AUTH_REQUIRED"&&s.provider==="jasmr"&&xe("jasmr"),n.status===401&&a==="LAN_AUTH_REQUIRED"&&xe("lan"),new Error(a||`Failed to fetch from ${e}`)}return n.json()};async function ra(e,t){const n=await Ft(e,t);if(n.status===401)try{(await n.clone().json())?.error==="LAN_AUTH_REQUIRED"&&xe("lan")}catch{}return await oa(n),n}async function oa(e){try{if(!e.headers.get("content-type")?.includes("json"))return;const t=await e.clone().json(),n=Array.isArray(t)?t:[t];for(const r of n){const s=r?.error;if(!s||typeof s!="object")continue;const a=s.data?.cause;(s.message==="AUTH_REQUIRED"||a?.code==="AUTH_REQUIRED")&&(a?.provider==="animepahe"||a?.provider==="jasmr")&&xe(a.provider),(s.message==="LAN_AUTH_REQUIRED"||a?.code==="LAN_AUTH_REQUIRED")&&xe("lan")}}catch{}}const{TRPCProvider:sa,useTRPC:D}=Zs(),te=Rs({links:[Ps({url:"/api/trpc",fetch:ra})]}),aa="_overlay_5hzq9_1",ia="_fadeIn_5hzq9_1",ca="_content_5hzq9_11",la="_modalIn_5hzq9_1",ua="_sm_5hzq9_29",da="_md_5hzq9_33",ma="_lg_5hzq9_37",pa="_title_5hzq9_41",ha="_closeButton_5hzq9_48",fa="_body_5hzq9_74",ya="_footer_5hzq9_78",Oe={overlay:aa,fadeIn:ia,content:ca,modalIn:la,sm:ua,md:da,lg:ma,title:pa,closeButton:ha,body:fa,footer:ya};function or({children:e}){return o("h2",{className:Oe.title,children:e})}function sr({children:e}){return o("div",{className:Oe.body,children:e})}function ar({children:e}){return o("div",{className:Oe.footer,children:e})}function Re({isOpen:e,onClose:t,title:n,children:r,footer:s,width:a="md"}){const i=M(null),[c,l]=g(document.body);return w(()=>{if(!e)return;const u=()=>l(document.fullscreenElement??document.body);return u(),document.addEventListener("fullscreenchange",u),()=>document.removeEventListener("fullscreenchange",u)},[e]),w(()=>{if(!e)return;const u=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?$n(o("div",{role:"presentation",onMouseDown:u=>u.stopPropagation(),children:[o("div",{className:Oe.overlay,onClick:()=>t?.(),"aria-hidden":"true"}),o("div",{ref:i,className:`${Oe.content} ${Oe[a]}`,role:"dialog","aria-modal":"true","aria-label":n,tabIndex:-1,children:[n&&o(or,{children:n}),o(sr,{children:r}),s&&o(ar,{children:s})]})]}),c):null}Re.Header=or;Re.Body=sr;Re.Actions=ar;const Me=new Map,ga=500,ir=(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 s=`${r}-${t}-${n}`;if(Me.has(s))return Me.get(s);let a;if(r.startsWith("https://s4.anilist.co"))a=r,t&&(a+=`${a.includes("?")?"&":"?"}w=${t}`),n&&(a+=`${a.includes("?")?"&":"?"}h=${n}`);else if(r.includes("animepahe")){a=`/api/image-proxy?url=${encodeURIComponent(r)}`;const i=ee.getItem("animepahe_cookie"),c=ee.getItem("animepahe_ua");i&&(a+=`&cookie=${encodeURIComponent(i)}`),c&&(a+=`&ua=${encodeURIComponent(c)}`)}else if(r.startsWith("http"))a=`/api/image-proxy?url=${encodeURIComponent(r)}`,t&&(a+=`&w=${t}`),n?a+=`&h=${n}`:t||(a+="&w=300");else{const c=`${r.startsWith("mcovers")||r.startsWith("images2")?"https://aln.youtube-anime.com":"https://aln.youtube-anime.com/images"}/${r}`;a=`/api/image-proxy?url=${encodeURIComponent(c)}`,t&&(a+=`&w=${t}`),n?a+=`&h=${n}`:t||(a+="&w=300")}return Me.size>ga&&Me.clear(),Me.set(s,a),a},ed=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 td(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 nd(e){return e==null?e:e>10?Number((e/10).toFixed(1)):e}const va=(...e)=>e.filter(Boolean).join(" ");function ba(e,t,n="..."){return e?e.length>t?e.slice(0,t)+n:e:""}const cr=ye(void 0),lr=()=>{const e=ge(cr);if(e===void 0)throw new Error("useTitlePreference must be used within a TitlePreferenceProvider");return e},C={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"},rd=()=>{const e=D(),t=B({...e.data.spotlight.queryOptions(),staleTime:1e3*60*5,retry:1});return{...t,data:t.data}},od=(e="TRENDING_DESC",t=10)=>dt({queryKey:[C.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}),sd=(e="TV",t=12)=>dt({queryKey:[C.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}),ad=(e,t="TV",n=!0)=>{const r=D();return B({...r.data.seasonal.queryOptions({page:e,format:t}),enabled:n,staleTime:1e3*60*5})},wa=["query","sortBy","type","status","season","year","country","genres","excludeGenres","excludeTags","minScore","minEpisodes","adult"],id=(e,t,n=14)=>{const r=D(),s=new URLSearchParams(e),a={page:t,limit:n};for(const i of wa){const c=s.get(i);c!==null&&(a[i]=c)}return B({...r.data.search.queryOptions(a),enabled:e!=null})},cd=()=>{const e=D();return B(e.queue.list.queryOptions())},_a=()=>{const e=D(),t=oe();return ce(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:[C.queueRemaining]})},onError:n=>{N.error(`Failed to update queue: ${n.message}`)}}))},ld=()=>{const e=D(),t=oe();return ce(e.queue.remove.mutationOptions({onSuccess:()=>{N.success("Removed from queue"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[C.queueRemaining]}),t.invalidateQueries({queryKey:[C.continueWatching]})},onError:n=>{N.error(`Failed to remove: ${n.message}`)}}))},ud=(e,t=!0)=>B({queryKey:[C.queueRemaining,e],queryFn:()=>te.watchlist.queueRemaining.query({showId:e}),enabled:!!e&&t,staleTime:1e3*60}),dd=()=>{const e=D(),t=oe();return ce(e.queue.addBatch.mutationOptions({onSuccess:(n,r)=>{const s=n.added??r.episodeNumbers.length;N.success(`${s} ${s===1?"episode":"episodes"} added to queue`),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[C.queueRemaining]})},onError:n=>{N.error(`Failed to update queue: ${n.message}`)}}))},md=()=>{const e=D(),t=oe();return ce(e.queue.removeMany.mutationOptions({onSuccess:()=>{N.success("Removed from queue"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[C.queueRemaining]}),t.invalidateQueries({queryKey:[C.continueWatching]})},onError:n=>{N.error(`Failed to remove: ${n.message}`)}}))},pd=()=>{const e=D(),t=oe();return ce(e.queue.clear.mutationOptions({onSuccess:()=>{N.success("Queue cleared"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[C.queueRemaining]}),t.invalidateQueries({queryKey:[C.continueWatching]})},onError:n=>{N.error(`Failed to clear queue: ${n.message}`)}}))},hd=()=>{const e=D(),t=oe(),n=e.queue.list.queryOptions().queryKey;return ce(e.queue.reorder.mutationOptions({onMutate:async r=>{await t.cancelQueries({queryKey:n});const s=t.getQueryData(n);return t.setQueryData(n,a=>{if(!a)return a;const i=new Map(a.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:s}},onError:(r,s,a)=>{a?.previousQueue&&t.setQueryData(n,a.previousQueue)},onSettled:()=>{t.invalidateQueries(e.queue.pathFilter())}}))},ka=["status","showMature","query","type","season","year","genres","excludeGenres","sortBy","titlePreference"];function Wt(e,t,n){const r=new URLSearchParams(e),s={page:t,limit:n};for(const a of ka){const i=r.get(a);i!==null&&(s[a]=i)}return s}const fd=(e,t="",n,r=14)=>B({queryKey:[C.watchlist,e,t,n,r],queryFn:async()=>{const s=new URLSearchParams(t);return s.set("status",e),await te.watchlist.list.query(Wt(s.toString(),n,r))}}),yd=(e="")=>dt({queryKey:[C.continueWatching,e],queryFn:async({pageParam:t=1})=>await te.watchlist.continueWatchingAll.query(Wt(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)})}),gd=(e="",t,n=14)=>B({queryKey:[C.continueWatching,e,t,n],queryFn:async()=>await te.watchlist.continueWatchingAll.query(Wt(e,t,n))}),vd=()=>{const e=D(),t=oe();return ce(e.watchlist.remove.mutationOptions({onSuccess:()=>{N.success("Removed from watchlist"),t.invalidateQueries(e.watchlist.pathFilter()),t.invalidateQueries({queryKey:[C.watchlist]})},onError:n=>{N.error(`Failed to remove: ${n.message}`)}}))},bd=()=>{const e=D(),t=oe();return ce(e.watchlist.batchStatus.mutationOptions({onSuccess:n=>{N.success(`Status updated for ${n.updated??0} items`),t.invalidateQueries(e.watchlist.pathFilter()),t.invalidateQueries({queryKey:[C.watchlist]}),t.invalidateQueries({queryKey:[C.continueWatching]})},onError:n=>{N.error(`Failed to update statuses: ${n.message}`)}}))},wd=()=>{const e=D(),t=oe();return ce(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:[C.watchlist]}),t.invalidateQueries({queryKey:[C.continueWatching]})},onError:n=>{N.error(`Failed to remove: ${n.message}`)}}))},_d=()=>{const e=D(),t=oe();return ce(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:[C.continueWatching]})},onError:n=>{N.error(`Failed to remove: ${n.message}`)}}))},ur=(e=!0)=>{const t=D();return B({...t.notifications.list.queryOptions(),enabled:e,refetchInterval:3e4})},dr=(e=!0)=>{const t=D();return B({...t.data.systemNotifications.queryOptions(),enabled:e,refetchInterval:3e4})},mr=(e=!0)=>{const t=D();return B({...t.discovery.status.queryOptions(),enabled:e,refetchInterval:n=>n.state.data?.running?2e3:!1})},Ea=()=>{const e=D(),t=oe(),n=e.discovery.status.queryOptions().queryKey;return ce(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:[C.notifications]})},onError:()=>{t.invalidateQueries({queryKey:n})}}))},Sa=()=>{const e=D(),t=oe();return ce(e.notifications.dismiss.mutationOptions({onSuccess:()=>{t.invalidateQueries(e.notifications.pathFilter())}}))},Pa=()=>{const e=D(),t=oe();return ce(e.notifications.clearAll.mutationOptions({onSuccess:()=>{t.invalidateQueries(e.notifications.pathFilter())}}))},kd=()=>{const e=D();return B({...e.continueWatching.thisWeek.queryOptions(),staleTime:1e3*60*5})},Ed=()=>{const e=D();return B({...e.data.genresAndTags.queryOptions(),staleTime:1e3*60*60})},Sd=()=>B({queryKey:[C.genreCards],queryFn:()=>te.insights.genreCards.query()}),Ta="_container_1x6po_1",Ia="_bellBtn_1x6po_7",xa="_badge_1x6po_39",Na="_dropdown_1x6po_67",Ca="_dropdownHeader_1x6po_98",Aa="_headerSubtitle_1x6po_106",Oa="_headerActions_1x6po_113",qa="_closeBtn_1x6po_119",La="_sectionHeading_1x6po_132",Ra="_clearAllBtn_1x6po_148",Da="_discoveryStatusRow_1x6po_166",$a="_statusDot_1x6po_177",Ma="_statusDotRunning_1x6po_184",ja="_statusDotOk_1x6po_189",Ba="_statusDotError_1x6po_197",Fa="_statusDotIdle_1x6po_201",Wa="_list_1x6po_216",Ka="_item_1x6po_230",Ua="_itemTitleLink_1x6po_241",Ha="_systemItemMeta_1x6po_248",Qa="_removeItem_1x6po_249",za="_modalButton_1x6po_251",Va="_systemItem_1x6po_248",Ga="_systemIcon_1x6po_264",Ja="_thumbnail_1x6po_275",Ya="_itemInfo_1x6po_284",Za="_itemTitle_1x6po_241",Xa="_itemMeta_1x6po_300",ei="_queueItem_1x6po_365",ti="_fullMessage_1x6po_379",ni="_emptyState_1x6po_385",ri="_emptyIcon_1x6po_403",S={container:Ta,bellBtn:Ia,badge:xa,dropdown:Na,dropdownHeader:Ca,headerSubtitle:Aa,headerActions:Oa,closeBtn:qa,sectionHeading:La,clearAllBtn:Ra,discoveryStatusRow:Da,statusDot:$a,statusDotRunning:Ma,statusDotOk:ja,statusDotError:Ba,statusDotIdle:Fa,list:Wa,item:Ka,itemTitleLink:Ua,systemItemMeta:Ha,removeItem:Qa,modalButton:za,systemItem:Va,systemIcon:Ga,thumbnail:Ja,itemInfo:Ya,itemTitle:Za,itemMeta:Xa,queueItem:ei,fullMessage:ti,emptyState:ni,emptyIcon:ri},oi=({notification:e})=>{const t=Sa(),n=_a(),[r,s]=$t.useState(!1),a=u=>{u.preventDefault(),u.stopPropagation(),t.mutate({showId:e.showId,episodeNumber:e.episodeNumber})},i=u=>{u.preventDefault(),u.stopPropagation(),s(!0),n.mutate({showId:e.showId,episodeNumber:e.episodeNumber,showName:e.name,showThumbnail:e.thumbnail,nativeName:e.nativeName,englishName:e.englishName}),t.mutate({showId:e.showId,episodeNumber:e.episodeNumber}),window.setTimeout(()=>s(!1),1e3)},{titlePreference:c}=lr(),l=c==="nativeName"?e.nativeName||e.name:c==="englishName"&&e.englishName||e.name;return o("div",{className:S.item,children:[o("img",{src:ir(e.thumbnail,48,64),alt:e.name,className:S.thumbnail,loading:"lazy",decoding:"async"}),o("div",{className:S.itemInfo,children:[o(le,{to:`/watch/${e.showId}/${e.episodeNumber}`,className:S.itemTitleLink,onClick:()=>t.mutate({showId:e.showId,episodeNumber:e.episodeNumber}),children:o("span",{className:S.itemTitle,children:l})}),o("span",{className:S.itemMeta,children:["New Episode ",e.episodeNumber]})]}),o("button",{className:`${S.removeItem} ${S.queueItem}`,onClick:i,title:"Add to queue","aria-label":"Add notification to queue",children:r?o(A,{name:"check"}):o(A,{name:"plus"})}),o("button",{className:S.removeItem,onClick:a,title:"Dismiss","aria-label":"Remove notification",children:o(A,{name:"times"})})]})};function _t({width:e="100%",height:t="1em",variant:n="rectangular",className:r="",style:s}){return o("div",{className:`skeleton skeleton-${n} ${r}`,style:{width:e,height:t,...s}})}const si=({count:e=3})=>o(de,{children:Array.from({length:e}).map((t,n)=>o("div",{className:S.item,style:{borderBottom:"1px solid var(--border-primary)",pointerEvents:"none"},children:[o("div",{className:S.thumbnail,style:{overflow:"hidden"},children:o(_t,{width:"100%",height:"100%",variant:"rectangular"})}),o("div",{className:S.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))}),ai=({onClose:e})=>{const{data:t=[],isLoading:n}=ur(),{data:r=[]}=dr(),{data:s}=mr(),a=Pa(),i=oe(),[c,l]=g(null),u=M(null);w(()=>{u.current?.focus();const h=y=>{y.key==="Escape"&&e()};return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e]),w(()=>{i.invalidateQueries({queryKey:[C.notifications]})},[i]);const d=r.find(h=>h.id===c)??null,m=t.length+r.length,p=s?.running?s.total>0?`Checking ${Math.min(s.done,s.total)}/${s.total} shows...`:"Checking for new episodes...":s?.state==="complete"?`Discovery complete · checked ${s.total} ${s.total===1?"show":"shows"}`:s?.state==="empty"?"No shows set to Watching":s?.state==="error"?"Last check failed · will retry automatically":s?.lastRunAt?`Last checked ${Math.max(1,Math.round((Date.now()-s.lastRunAt)/1e3))}s ago`:"Auto-checks every few minutes";return o("div",{id:"notification-panel",ref:u,className:S.dropdown,role:"dialog","aria-label":"Notifications",tabIndex:-1,children:[o("div",{className:S.dropdownHeader,children:[o("div",{children:[o("h4",{children:"Notifications"}),o("span",{className:S.headerSubtitle,children:[m," updates"]})]}),o("div",{className:S.headerActions,children:[t.length>0&&o("button",{className:S.clearAllBtn,onClick:()=>a.mutate(void 0),children:"Clear all"}),o("button",{type:"button",className:S.closeBtn,onClick:e,title:"Close","aria-label":"Close notifications",children:o(A,{name:"times"})})]})]}),o("div",{className:S.discoveryStatusRow,children:[o("span",{className:`${S.statusDot} ${s?.running?S.statusDotRunning:s?.state==="complete"?S.statusDotOk:s?.state==="error"?S.statusDotError:S.statusDotIdle}`,"aria-hidden":"true"}),o("span",{children:p})]}),o("div",{className:S.list,children:n&&m===0?o(si,{count:4}):o(de,{children:[r.length>0&&o("section",{"aria-labelledby":"system-notifications-heading",children:[o("h5",{id:"system-notifications-heading",className:S.sectionHeading,children:"App updates"}),r.map(h=>o("div",{className:`${S.item} ${S.systemItem}`,children:[o("div",{className:S.systemIcon,children:o(A,{name:"info-circle",size:20})}),o("div",{className:S.itemInfo,children:[o("span",{className:S.itemTitle,children:h.title}),o("button",{type:"button",className:S.systemItemMeta,onClick:()=>l(h.id),title:"View full message",children:[ba(h.message,72,"…")," ",o("span",{children:"Read more"})]})]})]},h.id))]}),t.length>0&&o("section",{"aria-labelledby":"new-episodes-heading",children:[o("h5",{id:"new-episodes-heading",className:S.sectionHeading,children:"New episodes"}),t.map(h=>o(oi,{notification:h},h.id))]}),!n&&m===0&&o("div",{className:S.emptyState,children:[o("span",{className:S.emptyIcon,children:o(A,{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(Re,{isOpen:!!d,onClose:()=>l(null),title:d?.title,width:"sm",footer:o("button",{type:"button",className:S.modalButton,onClick:()=>l(null),children:"OK"}),children:d&&o("p",{className:S.fullMessage,children:d.message})})]})},ii="notification-panel",ci=()=>{const[e,t]=g(!1),n=M(null),r=oe(),s=D(),a=Ea(),{data:i=[]}=ur(),{data:c=[]}=dr(),{data:l}=mr(),u=i.length+c.length,d=u>9?"9+":u,m=M(!1);w(()=>{const h=y=>{n.current&&!n.current.contains(y.target)&&t(!1)};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[]),w(()=>{const h=!!l?.running;m.current&&!h&&(r.invalidateQueries(s.notifications.pathFilter()),r.invalidateQueries(s.discovery.pathFilter()),r.invalidateQueries({queryKey:[C.continueWatching]}),r.invalidateQueries({queryKey:[C.thisWeekSchedule]}),r.invalidateQueries(s.continueWatching.pathFilter()),r.invalidateQueries({queryKey:[C.notifications]})),m.current=h},[l?.running,r,s]);const p=()=>{const h=!e;t(h),h&&a.mutate()};return o("div",{className:S.container,ref:n,children:[o("button",{className:S.bellBtn,onClick:p,"aria-haspopup":"dialog","aria-expanded":e,"aria-controls":ii,"aria-label":"Notifications",children:[o(A,{name:"bell"}),u>0&&o("span",{className:S.badge,"aria-hidden":"true",children:d})]}),e&&o(ai,{onClose:()=>t(!1)})]})},yt=e=>{const t=D();return B({...t.settings.getByKey.queryOptions({key:e}),select:n=>n.value})},pr=()=>{const e=D(),t=oe();return ce(e.settings.set.mutationOptions({onSuccess:()=>{N.success("Setting updated!"),t.invalidateQueries(e.settings.pathFilter()),t.invalidateQueries({queryKey:[C.settings]})},onError:n=>{N.error(`Failed to update setting: ${n.message}`)}}))},hr=ye(void 0),li=()=>{const e=ge(hr);if(e===void 0)throw new Error("useLowEndMode must be used within a LowEndModeProvider");return e},fe={x:-2.8,y:-2,w:48.6,h:14},At=15,qe={w:13.6,h:10.2},we=[{x:0,y:.5},{x:At,y:-.9},{x:At*2,y:.3}],hn={x:qe.w/2,y:qe.h/2-.5},kt={y:qe.h/2,x1:-2,x2:At*2+qe.w+1.4},fn=(e,t,n,r=0)=>{if(n.width<=0)return-1;const s=n.width/fe.w,a=(e-n.left)/s+fe.x,i=(t-n.top)/s+fe.y;for(let c=0;c<we.length;c++){const l=a-we[c].x,u=i-we[c].y;if(l>=-r&&l<=qe.w+r&&u>=-r&&u<=qe.h+r)return c}return-1},yn=7.5,gn=e=>Math.max(-1,Math.min(1,e)),ui=(e,t,n,r)=>{const s=n.width/fe.w,a=(e-n.left)/s+fe.x-r.x-hn.x,i=(t-n.top)/s+fe.y-r.y-hn.y;return{x:gn(a/yn),y:gn(i/yn)}},di=["normal","squint"],mi={normal:.72,squint:.28},vn=(e=Math.random(),t)=>{let n=0;for(const r of di)if(n+=mi[r],e<n)return r===t?r==="normal"?"squint":"normal":r;return"normal"},pi="pet",hi="sleep",fi=6e3,yi=420,gi=.5,bn=3e3,vi=3e3,bi=we.map((e,t)=>t*260),Et={from:we.length-2,to:we.length-1,after:400},wn="data-dango-face",St="data-dango-hover",Pt="data-dango-cheer",_n="data-dango-nudge",wi=()=>document.querySelectorAll("svg[data-dango-gaze-origin]"),Xe=()=>document.querySelectorAll("[data-dango-face-slot]"),_i=e=>e.querySelectorAll("[data-dango-eye]"),ki=()=>document.querySelectorAll("[data-dango-eye]"),fr=()=>{const{data:e}=yt("dangoGaze"),{lowEndMode:t}=li();return e!=="false"&&!t},Ei=()=>{const e=fr();w(()=>{if(!e||window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;const t=we.map(()=>"normal");let n=-1,r=-1,s=!1,a=-1,i=0,c=0,l=0,u=0,d=0;const m=[],p=(v,I)=>{const X=window.setTimeout(()=>{m.splice(m.indexOf(X),1),v()},I);m.push(X)},h=(v,I,X)=>{Xe().forEach(ue=>{Number(ue.getAttribute("data-dango-face-slot"))===v&&(X?ue.setAttribute(I,""):ue.removeAttribute(I))})},y=v=>Xe().forEach(I=>I.removeAttribute(v)),_=(v,I,X)=>{y(I),requestAnimationFrame(()=>{h(v,I,!0),p(()=>y(I),X)})},O=()=>{Xe().forEach(v=>{const I=Number(v.getAttribute("data-dango-face-slot"));v.setAttribute(wn,r===I?pi:t[I]),n===I?v.setAttribute(St,""):v.removeAttribute(St)})},x=v=>{v!==r&&(r>=0&&h(r,Pt,!1),r=v,v>=0&&h(v,Pt,!0))},E=()=>{window.clearTimeout(d),d=window.setTimeout(()=>{x(-1),O()},yi)},b=()=>{window.clearTimeout(d),x(-1)},T=()=>{s=!1,bi.forEach((v,I)=>{p(()=>{t[I]=vn(),I===Et.from&&p(()=>_(Et.to,_n,520),Et.after),O()},v)})},Q=()=>{s=!0,t.fill(hi),b(),O()},L=()=>{window.clearTimeout(u),u=window.setTimeout(Q,fi)},W=()=>{s||(a=(a+1)%t.length,t[a]=vn(Math.random(),t[a]),O()),p(W,bn+Math.random()*vi)},P=()=>{const v=Array.from(wi(),q=>[q,q.getBoundingClientRect()]);v.forEach(([q,me])=>{_i(q).forEach(De=>{const{x:gt,y:vt}=ui(c,l,me,we[Number(De.getAttribute("data-dango-eye"))]);De.style.setProperty("--dango-gaze-x",gt.toFixed(3)),De.style.setProperty("--dango-gaze-y",vt.toFixed(3))})});const I=v.find(([,q])=>c>=q.left&&c<=q.right&&l>=q.top&&l<=q.bottom)?.[1]??null,X=n,ue=r,z=I?fn(c,l,I):-1,G=z>=0?z:I?fn(c,l,I,gi):-1;n=z,G>=0?(x(G),E()):b(),(X!==n||ue!==r)&&O(),s&&T(),L()},j=v=>{c=v.clientX,l=v.clientY,!i&&(i=requestAnimationFrame(()=>{i=0,P()}))},H=v=>{v.relatedTarget||(n=-1,b(),O(),L())};return O(),L(),p(W,bn),window.addEventListener("pointermove",j,{passive:!0}),window.addEventListener("pointerout",H),()=>{cancelAnimationFrame(i),window.clearTimeout(u),window.clearTimeout(d),m.forEach(window.clearTimeout),window.removeEventListener("pointermove",j),window.removeEventListener("pointerout",H),ki().forEach(v=>{v.style.removeProperty("--dango-gaze-x"),v.style.removeProperty("--dango-gaze-y")}),Xe().forEach(v=>{v.setAttribute(wn,"normal"),v.removeAttribute(St),v.removeAttribute(Pt),v.removeAttribute(_n)})}},[e])},yr=ye(void 0),Pd=()=>{const e=ge(yr);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e},Td=[{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"}],Si={iris:{fill:"#897cff",stroke:"#5646db"},mochi:{fill:"#e3e1ee",stroke:"#b3b1c6"},sakura:{fill:"#e1afef",stroke:"#a978a9"}},Pi="_logo_t3il2_1",Ti="_skewer_t3il2_8",Ii="_gaze_t3il2_15",xi="_face_t3il2_20",Ni="_faceNormal_t3il2_25",Ci="_facePet_t3il2_26",Ai="_faceSquint_t3il2_27",Oi="_faceSleep_t3il2_28",qi="_line_t3il2_36",Li="_sway_t3il2_44",Ri="_weight_t3il2_58",Di="_shift_t3il2_73",$i="_rock_t3il2_87",Mi="_glance_t3il2_105",ji="_blinkDouble_t3il2_129 _blink_t3il2_124",Bi="_blinkSlow_t3il2_153 _blink_t3il2_124",Fi="_bump_t3il2_172",Wi="_heart_t3il2_189",J={logo:Pi,skewer:Ti,gaze:Ii,face:xi,faceNormal:Ni,facePet:Ci,faceSquint:Ai,faceSleep:Oi,line:qi,sway:Li,weight:Ri,shift:Di,rock:$i,glance:Mi,blinkDouble:ji,blinkSlow:Bi,bump:Fi,heart:Wi},kn="var(--logo-ink)",Ki="m 7,0 c -3.9372984,0 -7.10030437,2.4883888 -7,6 0.13572675,4.751733 5.0802847,4.156395 7,4.156395 1.2538994,0 6.530451,0.392468 6.584946,-4.168088 C 13.622023,2.8853946 10.937298,0 7,0 Z",Ui="m 4.9623825,3.416 c -0.5858889,0 -0.6520292,2.3368563 -0.024765,2.3368563 0.6604959,0 0.6704653,-2.3368563 0.024765,-2.3368563 z",Hi="M 8.588001,3.416 C 8.0021121,3.416 7.9359718,5.7528563 8.563236,5.7528563 9.2237319,5.7528563 9.2337013,3.416 8.588001,3.416 Z",Qi={pet:"M 4.85,5.15 Q 5.285,4.0 5.72,5.15 M 8.25,5.15 Q 8.618,4.0 8.99,5.15",squint:"M 4.82,3.9 L 5.6,4.62 L 4.82,5.34 M 9.08,3.9 L 8.3,4.62 L 9.08,5.34",sleep:"M 4.9,4.72 Q 5.285,5.28 5.67,4.72 M 8.25,4.72 Q 8.618,5.28 9.0,4.72"},gr=[{lag:.8,hue:"iris",blink:"double",motion:"weight",glances:!1},{lag:1.4,hue:"sakura",blink:"slow",motion:"shift",glances:!1},{lag:1,hue:"mochi",blink:"slow",motion:"rock",glances:!0}],je=(e,t)=>e+Math.random()*(t-e),zi=gr.map(()=>({blinkDelay:-je(0,9),blinkDuration:je(3.4,8.6),motionDelay:-je(0,9),motionDuration:je(5.5,11),glanceDelay:-je(0,11)})),Vi={double:J.blinkDouble,slow:J.blinkSlow},Gi={weight:J.weight,shift:J.shift,rock:J.rock},Ji={normal:J.faceNormal,pet:J.facePet,squint:J.faceSquint,sleep:J.faceSleep},Yi=["normal","pet","squint","sleep"],Zi=[{x:7,y:4.2,delay:0,drift:"0px"},{x:9.6,y:6.4,delay:-.3,drift:"-0.9px"},{x:4.6,y:6.1,delay:-.6,drift:"0.8px"},{x:8.2,y:3.4,delay:-.9,drift:"-0.4px"}],Kt=({className:e})=>{const t=fr();return o("svg",{viewBox:`${fe.x} ${fe.y} ${fe.w} ${fe.h}`,className:e?`${J.logo} ${e}`:J.logo,role:"img","aria-label":"dango","data-dango-gaze-origin":"",children:o("g",{className:t?J.sway:void 0,children:[o("path",{className:J.skewer,d:`M ${kt.x1},${kt.y} H ${kt.x2}`}),gr.map((n,r)=>{const{x:s,y:a}=we[r],i=zi[r],{fill:c,stroke:l}=Si[n.hue],u=o("g",{"data-dango-eye":r,className:J.gaze,style:{"--gaze-dur":`${(.12+n.lag*.18).toFixed(3)}s`},children:Yi.map(d=>o("g",{className:`${J.face} ${Ji[d]}`,children:o("g",{className:t&&d==="normal"?Vi[n.blink]:void 0,style:t&&d==="normal"?{animationDelay:`${i.blinkDelay}s`,animationDuration:`${i.blinkDuration}s`}:void 0,children:d==="normal"?o(de,{children:[o("path",{fill:kn,d:Ui}),o("path",{fill:kn,d:Hi})]}):o("path",{className:J.line,d:Qi[d]})})},d))});return o("g",{transform:`translate(${s} ${a})`,children:o("g",{"data-dango-face-slot":r,"data-dango-face":"normal",className:t?Gi[n.motion]:void 0,style:t?{animationDelay:`${i.motionDelay}s`,animationDuration:`${i.motionDuration}s`}:void 0,children:[o("path",{fill:c,stroke:l,strokeWidth:"0.9",strokeLinejoin:"round",paintOrder:"stroke fill",d:Ki}),o("g",{className:J.bump,children:[t&&n.glances?o("g",{className:J.glance,style:{animationDelay:`${i.glanceDelay}s`},children:u}):u,t&&o("g",{children:Zi.map(d=>o("text",{className:J.heart,x:d.x,y:d.y,fill:"var(--color-danger)",style:{"--drift":d.drift,animationDelay:`${d.delay}s`},children:"♥"},d.x))})]})]})},n.hue)})]})})},vr=ye(void 0),Ut=()=>{const e=ge(vr);if(e===void 0)throw new Error("useSidebar must be used within a SidebarProvider");return e},br=ye(void 0),wr=()=>{const e=ge(br);if(e===void 0)throw new Error("useContentType must be used within a ContentTypeProvider");return e},Ot="virtual-keyboard:hide",En="virtual-keyboard:enabled-change",_r="virtual_keyboard_enabled",Xi=!1;function Sn(){const e=ee.getItem(_r);return e===null?Xi:e==="true"}const Pn=e=>e instanceof HTMLInputElement&&e.type==="text"&&!e.disabled&&!e.readOnly;function ec(){window.dispatchEvent(new CustomEvent(Ot))}function tc(){const[e,t]=g(!1),[n,r]=g(Sn),s=M(null);return w(()=>{const a=d=>{n&&Pn(d.target)&&(s.current=d.target,t(!0))},i=d=>{d.target===s.current&&window.setTimeout(()=>{if(Pn(document.activeElement)){s.current=document.activeElement,t(!0);return}s.current=null,t(!1)},0)},c=()=>{s.current=null,t(!1)},l=d=>{if(d.key!==_r)return;const m=d.newValue==="true";r(m),m||c()},u=()=>{const d=Sn();r(d),d||c()};return document.addEventListener("focusin",a),document.addEventListener("focusout",i),window.addEventListener(Ot,c),window.addEventListener("storage",l),window.addEventListener(En,u),()=>{document.removeEventListener("focusin",a),document.removeEventListener("focusout",i),window.removeEventListener(Ot,c),window.removeEventListener("storage",l),window.removeEventListener(En,u)}},[n]),{activeInputRef:s,isVisible:n&&e,hide:()=>t(!1)}}const nc={queryKey:[C.syncProfile],queryFn:()=>We("/api/profiles/current"),staleTime:3e4};function kr({image:e,name:t}){const[n,r]=g(!1);return w(()=>r(!1),[e]),e&&!n?o("img",{src:e,alt:t,referrerPolicy:"no-referrer",onError:()=>r(!0),style:{width:"100%",height:"100%",maxWidth:72,maxHeight:72,aspectRatio:"1",objectFit:"cover",borderRadius:"50%"}}):o("svg",{viewBox:"0 0 24 24",role:"img","aria-label":t,style:{width:"100%",height:"100%",maxWidth:72,maxHeight:72,aspectRatio:"1"},fill:"currentColor",children:[o("circle",{cx:"12",cy:"8",r:"4"}),o("path",{d:"M4 21v-2a8 8 0 0 1 16 0v2z"})]})}const Ht=e=>String(e).toLowerCase()==="movie"?"movie":"tv",Id=(e,t)=>`${Ht(e)}:${t}`,rc=(e,t)=>{const n=Ht(e);return`/tv/${t}?type=${n}`},oc=(e,t,n,r)=>{const s=new URLSearchParams;return s.set("type",Ht(e)),n!==void 0&&s.set("s",String(n)),r!==void 0&&s.set("e",String(r)),`/tv/${t}/watch?${s.toString()}`},xd=e=>e.adult===!0||e.adult===1,Nd={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"},Cd={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"},Qt=300*1e3,sc={mangadex:"https://mangadex.org/",mangapill:"https://www.mangapill.com/"},ac="Dango/3.0 (+https://github.com/serifpersia/dango)",ic=(e,t)=>`/api/proxy?url=${encodeURIComponent(t)}&referer=${encodeURIComponent(sc[e])}`,cc=(e,t)=>t&&(e==="mangadex"?`/api/image-proxy?url=${encodeURIComponent(t)}&ua=${encodeURIComponent(ac)}`:e==="mangapill"?ic(e,t):t),Ad=(e,t=!0)=>{const{provider:n,query:r,page:s,sort:a,status:i,type:c,rating:l,mature:u}=e;return B({queryKey:[C.mangaBrowse,n,r,s,a,i,c,l,u],queryFn:()=>te.manga.search.query({provider:n,q:r.trim()||void 0,page:s,sort:a||void 0,status:i||void 0,type:c||void 0,rating:l||void 0,mature:u?"1":void 0}),staleTime:Qt,enabled:t})},Od=(e,t=14)=>{const{provider:n,query:r,sort:s,status:a,type:i,rating:c,mature:l}=e;return dt({queryKey:[C.mangaBrowseInfinite,n,r,s,a,i,c,l,t],queryFn:({pageParam:u=1})=>te.manga.search.query({provider:n,q:r.trim()||void 0,page:u,limit:t,sort:s||void 0,status:a||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:Qt,enabled:!0})},qd=(e,t,n="safe",r=!1)=>B({queryKey:[C.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:Qt}),Ld=(e,t,n)=>B({queryKey:[C.mangaPages,e,t],queryFn:()=>te.manga.pages.query({provider:e||"",id:t||""}),enabled:!!e&&!!t,staleTime:1800*1e3}),Rd=()=>{const e=D(),t=B({...e.manga.trending.queryOptions(),staleTime:600*1e3,retry:1});return{...t,data:t.data}};function lc(e){return String(e||"").trim().toUpperCase()}function Tn(e){return lc(e.id||e._id||"")}function Dd(e){return!!e.isAdult}const uc="_header_3lgqk_1",dc="_hidden_3lgqk_24",mc="_scrolled_3lgqk_28",pc="_logo_3lgqk_37",hc="_headerInner_3lgqk_53",fc="_leftSection_3lgqk_63",yc="_desktopNav_3lgqk_69",gc="_navLink_3lgqk_82",vc="_navLinkActive_3lgqk_101",bc="_navPill_3lgqk_107",wc="_rightSection_3lgqk_125",_c="_searchWrapper_3lgqk_131",kc="_searchIconButton_3lgqk_158",Ec="_searchIcon_3lgqk_158",Sc="_searchInput_3lgqk_185",Pc="_searchKbd_3lgqk_218",Tc="_searchKbdHidden_3lgqk_236",Ic="_searchButton_3lgqk_241",xc="_profileBtn_3lgqk_251",Nc="_profileAvatar_3lgqk_286",Cc="_profileName_3lgqk_293",Ac="_hamburgerBtn_3lgqk_302",Oc="_searchDropdown_3lgqk_330",qc="_searchDropdownNoBar_3lgqk_362",Lc="_searchDropdownHeader_3lgqk_370",Rc="_searchDropdownQuery_3lgqk_378",Dc="_searchDropdownSeeAll_3lgqk_384",$c="_searchDropdownList_3lgqk_401",Mc="_searchDropdownItem_3lgqk_415",jc="_searchDropdownThumb_3lgqk_433",Bc="_searchDropdownItemInfo_3lgqk_442",Fc="_searchDropdownItemTitle_3lgqk_449",Wc="_searchDropdownItemMeta_3lgqk_458",Kc="_mobileSearchBar_3lgqk_497",Uc="_searchIconMobile_3lgqk_568",Hc="_mobileSearchBarHidden_3lgqk_595",Qc="_mobileSearchInner_3lgqk_612",zc="_mobileSearchIcon_3lgqk_628",Vc="_mobileSearchInput_3lgqk_635",k={header:uc,hidden:dc,scrolled:mc,logo:pc,headerInner:hc,leftSection:fc,desktopNav:yc,navLink:gc,navLinkActive:vc,navPill:bc,rightSection:wc,searchWrapper:_c,searchIconButton:kc,searchIcon:Ec,searchInput:Sc,searchKbd:Pc,searchKbdHidden:Tc,searchButton:Ic,profileBtn:xc,profileAvatar:Nc,profileName:Cc,hamburgerBtn:Ac,searchDropdown:Oc,searchDropdownNoBar:qc,searchDropdownHeader:Lc,searchDropdownQuery:Rc,searchDropdownSeeAll:Dc,searchDropdownList:$c,searchDropdownItem:Mc,searchDropdownThumb:jc,searchDropdownItemInfo:Bc,searchDropdownItemTitle:Fc,searchDropdownItemMeta:Wc,mobileSearchBar:Kc,searchIconMobile:Uc,mobileSearchBarHidden:Hc,mobileSearchInner:Qc,mobileSearchIcon:zc,mobileSearchInput:Vc},In=300*1e3,Gc=()=>{const{toggleSidebar:e}=Ut(),{contentType:t}=wr(),n=D(),{titlePreference:r}=lr(),[s,a]=g(""),[i,c]=g(""),[l,u]=g(!0),[d,m]=g(!1),[p,h]=g(!0),[y,_]=g(!1),[O,x]=g({left:0,width:0,opacity:0}),[E,b]=g(!1),T=Mn(),Q=ut(),L=M(null),W=M(!1),P=M(null),j=M(null),H=M(null),v=M(null),I=M(!1),X=M(null),ue=M(null),z=M(null),{data:G}=B(nc),q=i.length>=2,{data:me}=B({...n.data.search.queryOptions({query:i,page:1,limit:6}),enabled:q&&t==="anime"}),{data:De}=B({...n.tv.search.queryOptions({q:i,page:1,type:"multi"}),enabled:q&&t==="tv"}),{data:gt}=B({queryFn:()=>te.manga.search.query({q:i,page:1,limit:6,rating:"safe"}),queryKey:[C.mangaBrowse,"",i,1,"","","","safe",!1],staleTime:In,enabled:q&&t==="manga"}),{data:vt}=B({queryFn:()=>te.asmr.browse.query({q:i,page:1}),queryKey:[C.asmrBrowse,i,1,"",""],staleTime:In,enabled:q&&t==="asmr"}),Gt=t==="anime"?(me??[]).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?ir(f.thumbnail,48,64):void 0,href:`/anime/${f.id}`})):t==="tv"?(De?.results??[]).map(f=>({key:`${f.type}-${f.id}`,name:f.title,meta:f.year,thumb:f.image||void 0,href:rc(f.type,f.id)})):t==="manga"?(gt?.items??[]).map(f=>({key:`${f.provider}-${f.id}`,name:f.title,meta:f.year,thumb:f.cover?cc(f.provider,f.cover):void 0,href:`/manga/${f.provider}/${encodeURIComponent(f.id)}`})):(vt?.shows??[]).map(f=>({key:Tn(f),name:f.name,thumb:f.thumbnail||void 0,href:`/asmr/${encodeURIComponent(Tn(f))}`}));w(()=>{const f=window.visualViewport;if(!f)return;const ne=()=>{v.current?.style.setProperty("--vv-top",`${f.offsetTop}px`)};return ne(),f.addEventListener("scroll",ne),f.addEventListener("resize",ne),()=>{f.removeEventListener("scroll",ne),f.removeEventListener("resize",ne)}},[]),w(()=>{const f=()=>{L.current&&(window.clearTimeout(L.current),L.current=null)},ne=()=>{f(),!(window.scrollY<=10||d)&&(L.current=window.setTimeout(()=>{I.current||u(!1)},2500))},Ge=()=>{W.current||(W.current=!0,P.current=requestAnimationFrame(()=>{W.current=!1,P.current=null;const ie=window.scrollY<=10;h(ke=>ke===ie?ke:ie),u(ke=>ke||!0),ne()}))},$e=ie=>{const ke=ie.target,Lr=ke instanceof HTMLElement&&!!ke.closest('input, textarea, select, button, a, [role="button"], [contenteditable="true"]'),Xt=()=>{f(),u(!0),window.innerWidth<=1200?(_(!0),setTimeout(()=>H.current?.focus({preventScroll:!0}),50)):setTimeout(()=>ve.current?.focus({preventScroll:!0}),10)};ie.key.toLowerCase()==="s"&&!ie.metaKey&&!ie.ctrlKey&&!ie.altKey&&!Lr||(ie.metaKey||ie.ctrlKey)&&ie.key==="k"?(ie.preventDefault(),Xt()):ie.key==="Escape"&&document.activeElement===ve.current&&ve.current?.blur()},Ce=v.current,Yt=()=>{I.current=!0},Zt=()=>{I.current=!1,ne()};return window.addEventListener("scroll",Ge,{passive:!0}),window.addEventListener("keydown",$e),Ce?.addEventListener("pointerenter",Yt),Ce?.addEventListener("pointerleave",Zt),()=>{window.removeEventListener("scroll",Ge),window.removeEventListener("keydown",$e),Ce?.removeEventListener("pointerenter",Yt),Ce?.removeEventListener("pointerleave",Zt),f(),P.current!==null&&(cancelAnimationFrame(P.current),P.current=null),W.current=!1}},[d]);const ve=$t.useRef(null);w(()=>{if(X.current&&window.clearTimeout(X.current),!s.trim()||s.trim().length<2){c(""),b(!1);return}return X.current=window.setTimeout(()=>{c(s.trim()),d&&b(!0)},500),()=>{X.current&&window.clearTimeout(X.current)}},[s,d]);const Ie=V(()=>{b(!1)},[]);w(()=>{b(!1),_(!1)},[Q.pathname,Q.search]),w(()=>{const f=ue.current;if(!f)return;const ne=f.querySelector(`.${k.navLinkActive}`);if(!ne){x(Ce=>({...Ce,opacity:0}));return}const Ge=f.getBoundingClientRect(),$e=ne.getBoundingClientRect();x({left:$e.left-Ge.left,width:$e.width,opacity:1})},[Q.pathname]);const Ar=()=>window.innerWidth<=1200,Or=()=>{u(!0),Ar()?(_(!0),setTimeout(()=>H.current?.focus({preventScroll:!0}),50)):ve.current?.focus({preventScroll:!0})},qr=f=>{j.current?.contains(f.relatedTarget)||(_(!1),Ie())},Jt=t==="manga"?"Search manga...":t==="tv"?"Search TV & movies...":t==="asmr"?"Search ASMR...":"Search anime...",bt=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"},Ve=f=>{ec();const ne=s.trim();ne&&(Ie(),ve.current?.blur(),m(!1),T(t==="manga"?`/manga?q=${encodeURIComponent(ne)}`:t==="tv"?`/tv-search?q=${encodeURIComponent(ne)}`:t==="asmr"?`/asmr?q=${encodeURIComponent(ne)}`:`/search?query=${encodeURIComponent(ne)}`))};return o(de,{children:o("header",{ref:v,className:`${k.header} ${l?"":k.hidden} ${p?"":k.scrolled}`,children:[o("div",{className:k.headerInner,children:[o("div",{className:k.leftSection,children:[o("button",{className:k.hamburgerBtn,onClick:e,"aria-label":"Menu",children:o(A,{name:"bars"})}),o(le,{to:"/",className:k.logo,"aria-label":"Ani-Web Home",children:o(Kt,{})}),o("nav",{className:k.desktopNav,ref:ue,children:[o("span",{className:k.navPill,style:O,"aria-hidden":"true"}),o(le,{to:"/",className:`${k.navLink} ${Q.pathname==="/"?k.navLinkActive:""}`,children:"Home"}),o(le,{to:bt.to,className:`${k.navLink} ${Q.pathname.startsWith(bt.to)?k.navLinkActive:""}`,children:bt.label}),t==="anime"&&o(le,{to:"/insights",className:`${k.navLink} ${Q.pathname==="/insights"?k.navLinkActive:""}`,children:"Insights"})]})]}),o("div",{className:k.rightSection,children:[o("div",{className:k.searchWrapper,ref:z,onClick:()=>ve.current?.focus(),children:[o("button",{type:"button",className:k.searchIconButton,"aria-label":"Search",onMouseDown:f=>f.preventDefault(),onClick:f=>{f.stopPropagation(),Ve()},children:o(A,{name:"search",className:k.searchIcon})}),o("input",{ref:ve,type:"text","data-virtual-keyboard":"true",className:k.searchInput,placeholder:Jt,value:s,onChange:f=>a(f.currentTarget.value),onFocus:()=>{m(!0),u(!0),i.length>=2&&b(!0)},onBlur:f=>{m(!1),z.current?.contains(f.relatedTarget)||Ie()},onKeyDown:f=>{f.key==="Enter"?Ve():f.key==="Escape"&&(Ie(),ve.current?.blur())}}),o("span",{className:`${k.searchKbd} ${s||d?k.searchKbdHidden:""}`,"aria-hidden":"true",children:"Ctrl K"}),o("button",{type:"button",className:k.searchButton,"aria-label":"Search",onMouseDown:f=>f.preventDefault(),onClick:f=>{f.stopPropagation(),Or()},children:o(A,{name:"search",className:k.searchIconMobile})}),E&&Gt.length>0&&o("div",{className:`${k.searchDropdown} ${y?"":k.searchDropdownNoBar}`,onMouseDown:f=>f.preventDefault(),onClick:f=>f.stopPropagation(),children:[o("div",{className:k.searchDropdownHeader,children:[o("span",{className:k.searchDropdownQuery,children:["Results for “",i,"”"]}),o("button",{className:k.searchDropdownSeeAll,onClick:()=>{Ie(),_(!1),m(!1),Ve()},children:"See all"})]}),o("div",{className:k.searchDropdownList,children:Gt.map(f=>o("button",{className:k.searchDropdownItem,onClick:()=>{Ie(),_(!1),m(!1),a(""),ve.current?.blur(),T(f.href)},children:[f.thumb&&o(jo,{src:f.thumb,alt:f.name,className:k.searchDropdownThumb,loading:"lazy",decoding:"async"}),o("div",{className:k.searchDropdownItemInfo,children:[o("span",{className:k.searchDropdownItemTitle,children:f.name}),f.meta&&o("span",{className:k.searchDropdownItemMeta,children:f.meta})]})]},f.key))})]})]}),o(ci,{}),o(le,{to:"/settings",className:k.profileBtn,"aria-label":`${G?.name??"Profile"} — profile settings`,title:`${G?.name??"Profile"}${G?.owner?" (owner)":""} — profile settings`,children:[o("span",{className:k.profileAvatar,"aria-hidden":"true",children:o(kr,{image:G?.image,name:G?.name??"Profile"})}),o("span",{className:k.profileName,children:G?.name??"Profile"})]})]})]}),y&&o("div",{className:`${k.mobileSearchBar} ${l?"":k.mobileSearchBarHidden}`,ref:j,onBlur:qr,children:o("div",{className:k.mobileSearchInner,children:[o(A,{name:"search",className:k.mobileSearchIcon}),o("input",{ref:H,type:"text","data-virtual-keyboard":"true",className:k.mobileSearchInput,placeholder:Jt,value:s,onChange:f=>a(f.currentTarget.value),onFocus:()=>{m(!0),u(!0)},onBlur:()=>m(!1),onKeyDown:f=>{f.key==="Enter"?(Ve(),_(!1),m(!1)):f.key==="Escape"&&(_(!1),m(!1),Ie())}})]})})]})})},qt="agreedToViewMature";function Lt(){try{return ee.getItem(qt)==="true"}catch{return!1}}const Fe=new Set;function Er(e){for(const t of Fe)t(e)}function et(){Er(Lt())}function xn(e){try{e?ee.setItem(qt,"true"):ee.removeItem(qt)}catch{}Er(e)}function Jc(){const[e,t]=g(Lt);w(()=>(Fe.add(t),Fe.size===1&&(window.addEventListener("storage",et),window.addEventListener("focus",et)),t(Lt()),()=>{Fe.delete(t),Fe.size===0&&(window.removeEventListener("storage",et),window.removeEventListener("focus",et))}),[]);const n=V(()=>xn(!0),[]),r=V(()=>xn(!1),[]);return{hasConsent:e,grant:n,revoke:r}}const Yc="_sidebar_153jc_1",Zc="_open_153jc_20",Xc="_sidebarHeader_153jc_25",el="_closeBtn_153jc_33",tl="_logo_153jc_57",nl="_navSection_153jc_69",rl="_navLink_153jc_75",ol="_active_153jc_108",sl="_overlay_153jc_118",al="_versionInfo_153jc_138",pe={sidebar:Yc,open:Zc,sidebarHeader:Xc,closeBtn:el,logo:tl,navSection:nl,navLink:rl,active:ol,overlay:sl,versionInfo:al},il="3.9.2",Sr={version:il},cl=()=>{const{isOpen:e,setIsOpen:t}=Ut(),{contentType:n}=wr(),{hasConsent:r}=Jc(),s=()=>{t(!1)},a=n==="manga",i=n==="tv",c=n==="asmr",l=[{to:"/",icon:o(A,{name:"home"}),label:"Home"},a?{to:"/manga",icon:o(A,{name:"book"}),label:"Manga"}:i?{to:"/tv-search",icon:o(A,{name:"tv"}),label:"TV and Movies"}:c?{to:"/asmr",icon:o(A,{name:"headphones"}),label:"ASMR"}:{to:"/search",icon:o(A,{name:"search"}),label:"Search"},a?{to:"/reading-list",icon:o(A,{name:"bookmark"}),label:"Reading List"}:i?{to:"/tv-watchlist",icon:o(A,{name:"clock"}),label:"TV Watchlist"}:c?{to:"/listening-list",icon:o(A,{name:"history"}),label:"Listening List"}:{to:"/watchlist",icon:o(A,{name:"clock"}),label:"Watchlist"},...n==="anime"?[{to:"/insights",icon:o(A,{name:"chart-pie"}),label:"Insights"}]:[],{to:"/trackers",icon:o(A,{name:"sync-alt"}),label:"Trackers"},...n==="anime"||i?[{to:"/watch-along",icon:o(A,{name:"play"}),label:"Watch along"}]:[],...r?[{to:"/mature",icon:o(A,{name:"pepper-hot"}),label:"Mature"}]:[],{to:"/settings",icon:o(A,{name:"cog"}),label:"Settings"}];return o(de,{children:[o("aside",{className:`${pe.sidebar} ${e?pe.open:""} sidebar`,children:[o("div",{className:pe.sidebarHeader,children:[o("button",{className:pe.closeBtn,onClick:()=>t(!1),"aria-label":"Close menu",children:"×"}),o(le,{to:"/",className:pe.logo,onClick:s,children:o(Kt,{})})]}),o("nav",{className:pe.navSection,children:l.map(u=>o(Dr,{to:u.to,className:({isActive:d})=>`${pe.navLink} ${d?pe.active:""}`,onClick:s,end:u.to==="/",children:[u.icon,o("span",{children:u.label})]},u.to))}),o("div",{className:pe.versionInfo,children:["v",Sr.version]})]}),e&&o("div",{className:pe.overlay,onClick:()=>t(!1),"aria-label":"Close sidebar"})]})},ll="_footer_1c905_1",ul="_footerInner_1c905_15",dl="_brandSection_1c905_27",ml="_logoRow_1c905_39",pl="_logoText_1c905_45",hl="_brandMeta_1c905_51",fl="_brandTagline_1c905_60",yl="_statusPill_1c905_67",gl="_statusDot_1c905_80",vl="_linksGrid_1c905_88",bl="_linkColumn_1c905_96",wl="_columnTitle_1c905_102",_l="_bottomBar_1c905_126",kl="_copyright_1c905_136",El="_brand_1c905_27",Sl="_heartIcon_1c905_152",Pl="_backToTop_1c905_157",F={footer:ll,footerInner:ul,brandSection:dl,logoRow:ml,logoText:pl,brandMeta:hl,brandTagline:fl,statusPill:yl,statusDot:gl,linksGrid:vl,linkColumn:bl,columnTitle:wl,bottomBar:_l,copyright:kl,brand:El,heartIcon:Sl,backToTop:Pl},Tl=()=>{const e=new Date().getFullYear(),t=()=>{window.scrollTo({top:0,behavior:"smooth"})};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(Kt,{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(le,{to:"/",children:"Home"}),o(le,{to:"/watchlist",children:"Watchlist"}),o(le,{to:"/settings",children:"Settings"})]}),o("div",{className:F.linkColumn,children:[o("h4",{className:F.columnTitle,children:"Features"}),o(le,{to:"/search",children:"Search Anime"}),o(le,{to:"/trackers",children:"Trackers"}),o(le,{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(A,{name:"discord",style:{marginRight:"6px"}})," Discord"]}),o("a",{href:"https://github.com/serifpersia/dango",target:"_blank",rel:"noopener noreferrer",children:[o(A,{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(A,{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:t,"aria-label":"Back to top",children:[o(A,{name:"chevron-up",size:14}),o("span",{children:"Top"})]})]})]})};function Pr(e){return JSON.stringify({0:e??{}})}function Tr(e){return`/api/trpc/${e}?batch=1&_profile=${encodeURIComponent(rr())}`}function Rt(e,t){const n=Pr(t),r=Tr(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 $d(e,t){const n=await fetch(Tr(e),{method:"POST",headers:{"Content-Type":"application/json"},body:Pr(t),keepalive:!0});if(!n.ok)throw new Error(`tRPC request failed (HTTP ${n.status})`)}function Md(e){e&&(Rt("discord.clear",{sessionId:e}),Rt("discord.heartbeat",{sessionId:e,bye:!0}))}function Il(){const e=ut(),{data:t}=yt("discordRPCEnabled"),n=M("");n.current||(n.current=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`tab-${Date.now()}-${Math.random().toString(36).slice(2)}`),w(()=>{if(t===!1||t==="false")return;const r=n.current,s=()=>te.discord.heartbeat.mutate({sessionId:r}).catch(()=>{});s();const a=setInterval(s,15e3),i=()=>{Rt("discord.heartbeat",{sessionId:r,bye:!0})};return window.addEventListener("pagehide",i),()=>{clearInterval(a),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 s="home";r.startsWith("/search")||r.startsWith("/mature")?s="search":r.startsWith("/watchlist")?s="watchlist":r.startsWith("/anime/")?s="anime":r.startsWith("/insights")?s="insights":r.startsWith("/settings")?s="settings":r.startsWith("/trackers")?s="trackers":r.startsWith("/asmr")?s="asmr":r.startsWith("/manga")?s="manga":r.startsWith("/tv")&&(s="tv"),te.discord.pageStatus.mutate({page:s}).catch(()=>{})},[e.pathname,t])}function zt(e,t){const[n,r]=g(()=>{try{const a=ee.getItem(e);if(a===null)return t;if(typeof t=="string")return a;try{return JSON.parse(a)}catch{return a}}catch{return t}});w(()=>{const a=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",a),()=>window.removeEventListener("storage",a)},[e,t]);const s=V(a=>{r(i=>{const c=typeof a=="function"?a(i):a;try{typeof c=="string"?ee.setItem(e,c):ee.setItem(e,JSON.stringify(c))}catch{}return c})},[e]);return[n,s]}const Ir=ye(void 0),xl=()=>{const e=ge(Ir);if(!e)throw new Error("useAnimePaheCookie must be used within an AnimePaheCookieProvider");return e},Nl="_container_e96gf_1",Cl="_field_e96gf_9",Al="_textarea_e96gf_20",Ol="_input_e96gf_40",ql="_button_e96gf_58",Ll="_secondaryButton_e96gf_78",Rl="_actions_e96gf_95",Dl="_hint_e96gf_104",$l="_link_e96gf_117",se={container:Nl,field:Cl,textarea:Al,input:Ol,button:ql,secondaryButton:Ll,actions:Rl,hint:Dl,link:$l},Ml="https://github.com/serifpersia/dango/releases/latest/download/dango-extension.zip",jl=e=>{try{return JSON.parse(e.detail)}catch{return null}},Bl=({isOpen:e,onClose:t,onSuccess:n})=>{const[r,s]=g(1),[a,i]=g(navigator.userAgent),[c,l]=g(""),[u,d]=g(!1),m=M(null),p=navigator.userAgent,h=/android/i.test(p),y=/firefox|fxios/i.test(p)&&!h,_=!y&&!h&&/chrome|chromium|edg|brave/i.test(p),O=y||_;w(()=>{e&&(s(1),i(navigator.userAgent),l(""),d(!1))},[e]),w(()=>()=>{m.current&&(window.removeEventListener("dango:pahe-cookie",m.current),m.current=null)},[]);const x=()=>{window.open("https://animepahe.pw","_blank","noopener,noreferrer"),s(2)},E=()=>{if(u)return;d(!0);const T=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,Q=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),L=W=>{const P=jl(W);if(!(!P||P.requestId!==T))if(window.clearTimeout(Q),window.removeEventListener("dango:pahe-cookie",L),m.current=null,d(!1),P?.ok&&P.cookie)l(P.cookie),N.success("Cookie extracted from helper!");else if(P?.error==="NO_COOKIE"){const j=P.debug?.stores?.length??0,H=P.debug?.names??[];N.error(`Helper found no cf_clearance (checked ${j} stores, saw: ${H.join(", ")||"none"}) - solve the challenge on the AnimePahe tab first.`)}else N.error("Helper request failed - try again.")};m.current=L,window.addEventListener("dango:pahe-cookie",L),window.dispatchEvent(new CustomEvent("dango:get-pahe-cookie",{detail:{requestId:T}}))},b=()=>{const T=c.trim();if(!T){N.error("Please enter the cf_clearance cookie");return}try{ee.setItem("animepahe_ua",a),ee.setItem("animepahe_cookie",T),N.success("Cookie updated successfully! Reloading…"),n?.(),t(),window.setTimeout(()=>window.location.reload(),1e3)}catch{N.error("Failed to save cookie")}};return o(Re,{isOpen:e,onClose:t,title:"AnimePahe Verification Required",children:o("div",{className:se.container,children:r===1?o(de,{children:[o("p",{children:"AnimePahe requires a manual verification to bypass Cloudflare/DDoS-Guard protection."}),o("div",{className:se.field,children:[o("label",{children:"Your User-Agent (will be used for requests):"}),o("textarea",{value:a,readOnly:!0,rows:3,className:se.textarea})]}),o("div",{className:se.actions,children:[o("button",{className:se.secondaryButton,onClick:t,children:"Cancel"}),o("button",{className:se.button,onClick:x,children:"Start Verification (Opens AnimePahe)"})]})]}):o(de,{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."]}),O&&o("div",{className:se.hint,children:[o("strong",{children:"Dango helper (one-time setup):"})," ",y?o(de,{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(de,{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:Ml,target:"_blank",rel:"noreferrer",className:se.link,children:"dango-extension.zip"}),". Then click Extract below and the field fills itself.",o("div",{className:se.actions,children:o("button",{className:se.button,onClick:E,disabled:u,type:"button",children:u?"Extracting…":"Extract cookie from helper"})})]}),o("div",{className:se.field,children:[o("label",{children:"cf_clearance cookie value:"}),o("input",{type:"text",value:c,onChange:T=>l(T.currentTarget.value),placeholder:"e.g. xxxxxxxx.xxxxxxxx.xxxxxxx-xxxxxxx",className:se.input})]}),o("div",{className:se.actions,children:[o("button",{className:se.secondaryButton,onClick:t,children:"Cancel"}),o("button",{className:se.secondaryButton,onClick:()=>s(1),children:"Back"}),o("button",{className:se.button,onClick:b,children:"Submit"})]})]})})})};function Nn(){const[e,t]=g(!1);return w(()=>{const n=window.setTimeout(()=>t(!0),120);return()=>window.clearTimeout(n)},[]),e?o("div",{className:"top-progress-bar",role:"progressbar","aria-label":"Loading"}):null}const Fl="_screen_1pca0_1",Wl="_icon_1pca0_14",Kl="_title_1pca0_20",Ul="_text_1pca0_24",Hl="_button_1pca0_29",Be={screen:Fl,icon:Wl,title:Kl,text:Ul,button:Hl};async function Ql(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 zl extends $r{state={hasError:!1};static getDerivedStateFromError(t){return{hasError:!0}}componentDidCatch(t,n){console.error("Uncaught error:",t,n),Ql(t,n)}render(){return this.state.hasError?o("div",{className:Be.screen,children:[o(A,{name:"exclamation-triangle",className:Be.icon}),o("h1",{className:Be.title,children:"Something went wrong"}),o("p",{className:Be.text,children:"The application encountered an unexpected error."}),o("button",{onClick:()=>{this.setState({hasError:!1}),window.location.href="/"},className:Be.button,children:[o(A,{name:"home"}),"Go back Home"]})]}):this.props.children}}const xr=ye(void 0),Vl=()=>{const e=ge(xr);if(!e)throw new Error("useLanAuth must be used within a LanAuthProvider");return e},Gl=({children:e})=>{const[t,n]=g(!1),r=V(()=>n(!0),[]),s=V(()=>n(!1),[]);return w(()=>nr("lan",r),[r]),o(xr.Provider,{value:{isOpen:t,openModal:r,closeModal:s},children:e})},Jl="_container_88bss_1",Yl="_field_88bss_8",Zl="_input_88bss_19",Xl="_actions_88bss_37",tt={container:Jl,field:Yl,input:Zl,actions:Xl},lt=Mr(({variant:e="primary",size:t="md",loading:n,children:r,className:s="",disabled:a,...i},c)=>{const l=va("btn",`btn-${e}`,t!=="md"&&`btn-${t}`,n&&"btn-loading",s);return o("button",{className:l,disabled:a||n,ref:c,...i,children:n?o("span",{className:"btn-spinner"}):r})}),Nr=({isOpen:e,onClose:t,onSuccess:n})=>{const[r,s]=g(""),[a,i]=g(!1);$t.useEffect(()=>{e&&s("")},[e]);const c=async()=>{if(!r){N.error("Please enter your password");return}i(!0);try{const l=await Ft("/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(Re,{isOpen:e,onClose:t,title:"LAN Authentication Required",children:o("div",{className:tt.container,children:[o("p",{children:"This instance is protected. Enter the password to access from this device."}),o("div",{className:tt.field,children:[o("label",{htmlFor:"lan-password",children:"Password"}),o("input",{id:"lan-password",type:"password",value:r,onChange:l=>s(l.currentTarget.value),placeholder:"Enter password...",className:tt.input,onKeyDown:l=>l.key==="Enter"&&c()})]}),o("div",{className:tt.actions,children:[o(lt,{variant:"secondary",onClick:t,disabled:a,children:"Cancel"}),o(lt,{variant:"primary",onClick:c,loading:a,children:"Unlock"})]})]})})},eu="_notice_1d75r_1",tu={notice:eu},nu=2600,ru=1e4,ou={anilist:"Updating AniList…",mal:"Updating MyAnimeList…"};function su({enabled:e=!0}){const[t,n]=g(!1),[r,s]=g("mal"),[a,i]=g(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 p=h=>{let y;try{y=JSON.parse(h.data)}catch{return}const _=y.provider;_!=="anilist"&&_!=="mal"||(y.updating===!0?(clearTimeout(l.get(_)),d.size===0&&Date.now()-m>=ru&&(m=Date.now(),s(_),n(!0),clearTimeout(u),u=setTimeout(()=>n(!1),nu)),d.add(_)):y.updating===!1&&(clearTimeout(l.get(_)),l.set(_,setTimeout(()=>d.delete(_),1500))))};return c.addEventListener("tracker-activity",p),()=>{c.removeEventListener("tracker-activity",p),c.close(),clearTimeout(u);for(const h of l.values())clearTimeout(h);n(!1)}},[e]),!e||!t?null:$n(o("div",{className:tu.notice,role:"status","aria-live":"polite","aria-atomic":"true",children:[o(A,{name:r==="anilist"?"anilist":"myanimelist",size:15}),o("span",{children:ou[r]})]}),a||document.body)}const au=K(()=>U(()=>import("./Home-wtyG5fKA.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]))),iu=K(()=>U(()=>import("./Watchlist-CQ57yp82.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]))),cu=K(()=>U(()=>import("./Settings-DvOx960h.js"),__vite__mapDeps([40,1,2,4,41,42,14,7,8,43]))),Cn=K(()=>U(()=>import("./Player-BVGxVSGv.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]))),lu=K(()=>U(()=>import("./WatchAlong-GtXJ-2Qq.js"),__vite__mapDeps([56,1,53,54,2,4]))),uu=K(()=>U(()=>import("./Search-B6dgK2Zu.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]))),du=K(()=>U(()=>import("./Mature-DAgfZt9Q.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]))),An=K(()=>U(()=>import("./Asmr-BzVhO0PK.js"),__vite__mapDeps([62,1,4,2,41,42,7,8,3,5,6,9,32,24,63,25,45,46,64,65,66]))),mu=K(()=>U(()=>import("./Manga-ClgoT4qk.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]))),pu=K(()=>U(()=>import("./MangaInfoPage-B8fttN1T.js"),__vite__mapDeps([70,1,4,17,18,68,69,23,2,24,64,65]))),hu=K(()=>U(()=>import("./MangaReadPage-BTAVFeJH.js"),__vite__mapDeps([71,1,17,4,18,2,68,69,23,24,64,65]))),fu=K(()=>U(()=>import("./ReadingList-Bco6T_Jh.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]))),On=K(()=>U(()=>import("./TvSearch-C9VNflnp.js"),__vite__mapDeps([74,1,4,3,5,6,7,8,9,28,29,30,2,24,15,16,17,18,58,59]))),yu=K(()=>U(()=>import("./TvInfo-BiUMbdN7.js"),__vite__mapDeps([75,1,4,30,2,24,76]))),gu=K(()=>U(()=>import("./Tv-t2tt4jji.js"),__vite__mapDeps([77,1,45,4,46,2,47,14,48,78,7,8,27,30,24,6,51,52,53,54,79]))),vu=K(()=>U(()=>import("./TvWatchlist-Bt39ymiP.js"),__vite__mapDeps([80,1,3,4,5,6,7,8,9,73,15,16,17,18,35,36,19,29,30,2,24]))),bu=K(()=>U(()=>import("./ListeningList-BPD9igfn.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]))),wu=K(()=>U(()=>import("./Trackers-Bp-U_jYN.js"),__vite__mapDeps([82,1,2,4,83]))),_u=K(()=>U(()=>import("./Insights-DGTqzxXr.js"),__vite__mapDeps([84,1,2,4,85]))),ku=K(()=>U(()=>import("./AnimeInfoPage-Dr9zOOq1.js"),__vite__mapDeps([86,1,2,4]))),Eu=K(()=>U(()=>import("./PlayerRedirect-fv2tzEUu.js"),__vite__mapDeps([87,1]))),Su=K(()=>U(()=>import("./VirtualKeyboard-BSILqgeU.js"),__vite__mapDeps([88,1,2,4,89])));function Pu(){Ei();const{isOpen:e,closeModal:t,onSuccess:n}=xl(),{isOpen:r,setIsOpen:s}=Ut(),{isOpen:a,openModal:i,closeModal:c}=Vl(),l=ut(),u=jr(),d=M(new Map),m=M(l.pathname),p=M(l.key),h=M(null),[y,_]=g(!1),O=tc();Il();const[x,E]=g(!1);w(()=>{const L=new AbortController;return We("/api/auth/app-status",{signal:L.signal}).then(W=>{W.hasPassword&&!W.isAuthenticated&&(E(!0),i())}).catch(()=>{L.signal.aborted||N.error("Could not check server access. The server may still be starting; reload to retry.")}),()=>L.abort()},[i]);const[b,T]=zt("lan_auth_notice_shown","false"),Q=M(!1);return w(()=>{if(b==="true"||Q.current)return;Q.current=!0,T("true");const L=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(L)},[b,T]),w(()=>{try{window.history.scrollRestoration="manual"}catch{}},[]),w(()=>{const L=l.key,W=d.current;if(u==="POP"){const P=W.get(L)??0;window.scrollTo({top:P,behavior:"instant"})}else l.pathname!==m.current&&window.scrollTo({top:0,behavior:"instant"});return m.current=l.pathname,()=>{W.set(L,window.scrollY)}},[l.key,l.pathname,u]),w(()=>{const L=()=>{_(!0),h.current!==null&&window.clearTimeout(h.current),h.current=window.setTimeout(()=>{_(!1),h.current=null},1e4)},W=j=>{if(j.defaultPrevented||j.button!==0||j.metaKey||j.ctrlKey||j.shiftKey||j.altKey)return;const H=j.target;if(!(H instanceof Element))return;const v=H.closest("a[href]");if(!v||v.hasAttribute("download")||v.getAttribute("target")==="_blank")return;const I=new URL(v.href,window.location.href);I.origin===window.location.origin&&`${I.pathname}${I.search}${I.hash}`!=`${window.location.pathname}${window.location.search}${window.location.hash}`&&L()},P=()=>L();return document.addEventListener("click",W,!0),window.addEventListener("popstate",P),()=>{document.removeEventListener("click",W,!0),window.removeEventListener("popstate",P),h.current!==null&&(window.clearTimeout(h.current),h.current=null)}},[]),w(()=>{p.current!==l.key&&(p.current=l.key,y&&(h.current!==null&&window.clearTimeout(h.current),h.current=window.setTimeout(()=>{_(!1),h.current=null},500)))},[l.key,y]),w(()=>{const L=W=>{r&&W.key==="Escape"&&s(!1)};return r?document.body.classList.add("sidebar-open"):document.body.classList.remove("sidebar-open"),window.addEventListener("keydown",L),()=>{window.removeEventListener("keydown",L),document.body.classList.remove("sidebar-open")}},[r,s]),o("div",{className:"app-container",children:[o(Bl,{isOpen:e,onClose:t,onSuccess:n}),o(Nr,{isOpen:a,onClose:x?()=>{}:c,onSuccess:()=>{E(!1),c()}}),o(Qn,{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"}}}}),y&&o(Nn,{}),o(su,{enabled:!x&&!a}),o(Gc,{}),o(cl,{}),o("main",{className:"main-content",children:o(zl,{children:o(en,{fallback:o(Nn,{}),children:o(Br,{children:[o($,{path:"/",element:o(au,{})}),o($,{path:"/watchlist/:filter?",element:o(iu,{})}),o($,{path:"/reading-list/:filter?",element:o(fu,{})}),o($,{path:"/search",element:o(uu,{})}),o($,{path:"/mature",element:o(du,{})}),o($,{path:"/asmr",element:o(An,{})}),o($,{path:"/asmr/:rj",element:o(An,{})}),o($,{path:"/manga",element:o(mu,{})}),o($,{path:"/manga/:provider/:id",element:o(pu,{})}),o($,{path:"/manga/:provider/:id/read",element:o(hu,{})}),o($,{path:"/tv",element:o(On,{})}),o($,{path:"/tv/:id",element:o(yu,{})}),o($,{path:"/tv/:id/watch",element:o(gu,{})}),o($,{path:"/tv-search",element:o(On,{})}),o($,{path:"/tv-watchlist/:filter?",element:o(vu,{})}),o($,{path:"/listening-list/:filter?",element:o(bu,{})}),o($,{path:"/settings",element:o(cu,{})}),o($,{path:"/trackers",element:o(wu,{})}),o($,{path:"/mal",element:o(tn,{to:"/trackers",replace:!0})}),o($,{path:"/insights",element:o(_u,{})}),o($,{path:"/anime/:id",element:o(ku,{})}),o($,{path:"/watch/:id",element:o(Cn,{})}),o($,{path:"/watch-along",element:o(lu,{})}),o($,{path:"/watch/:id/:episodeNumber",element:o(Cn,{})}),o($,{path:"/player/:id/:episodeNumber?",element:o(Eu,{})}),o($,{path:"*",element:o(tn,{to:"/",replace:!0})})]})})})}),o(Tl,{}),O.isVisible&&o(en,{fallback:null,children:o(Su,{activeInputRef:O.activeInputRef,isVisible:O.isVisible,onClose:O.hide})})]})}function Tu(){return o(Gl,{children:o(Pu,{})})}const Iu=({children:e})=>{const[t,n]=g(!1),r=V(()=>{n(a=>!a)},[]),s=Le(()=>({isOpen:t,setIsOpen:n,toggleSidebar:r}),[t,r]);return o(vr.Provider,{value:s,children:e})},xu=({children:e})=>{const[t,n]=zt("dango_content_type","anime"),r=Le(()=>({contentType:t,setContentType:n}),[t,n]);return o(br.Provider,{value:r,children:e})},Nu=({children:e})=>{const[t,n]=g("englishName"),[r,s]=g(!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{s(!1)}})()},[]);const a=Le(()=>({titlePreference:t,setTitlePreference:n,loading:r}),[t,r]);return o(cr.Provider,{value:a,children:e})},Cu=({children:e})=>{const{data:t,isLoading:n}=yt("lowEndMode"),r=pr(),s=oe(),[a,i]=g(!1);w(()=>{const u=s.getDefaultOptions();s.setDefaultOptions({...u,queries:{...u.queries,gcTime:a?900*1e3:1800*1e3}})},[a,s]),w(()=>{t!==void 0&&i(t==="true"||t===!0)},[t]),w(()=>{a?document.body.classList.add("low-end"):document.body.classList.remove("low-end")},[a]);const c=V(u=>{i(u),r.mutate({key:"lowEndMode",value:String(u)})},[r]),l=Le(()=>({lowEndMode:a,setLowEndMode:c,loading:n}),[a,c,n]);return o(hr.Provider,{value:l,children:e})},Au=["iris","mochi","sakura"];function qn(e){e==="iris"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",e)}const Ou=({children:e})=>{const{data:t,isLoading:n}=yt("theme"),r=pr(),[s,a]=g("iris");w(()=>{typeof t=="string"&&Au.includes(t)&&a(t)},[t]),w(()=>{qn(s)},[s]);const i=V(l=>{l!==s&&(a(l),qn(l),r.mutate({key:"theme",value:l}))},[r,s]),c=Le(()=>({theme:s,setTheme:i,loading:n}),[s,i,n]);return o(yr.Provider,{value:c,children:e})},qu=({children:e})=>{const[t,n]=g(!1),[r,s]=g(void 0),a=V(c=>{s(()=>c),n(!0)},[]),i=V(()=>{n(!1),s(void 0)},[]);return w(()=>nr("animepahe",()=>a()),[a]),o(Ir.Provider,{value:{isOpen:t,openModal:a,closeModal:i,onSuccess:r},children:e})},Lu="_gate_rmllo_1",Ru="_panel_rmllo_10",Du="_form_rmllo_18",$u="_field_rmllo_31",Mu="_avatarRow_rmllo_48",ju="_uploadButton_rmllo_60",Bu="_fileInput_rmllo_89",Fu="_profileList_rmllo_102",Wu="_smallAvatar_rmllo_115",Ku="_profileName_rmllo_120",Ae={gate:Lu,panel:Ru,form:Du,field:$u,avatarRow:Mu,uploadButton:ju,fileInput:Bu,profileList:Fu,smallAvatar:Wu,profileName:Ku};function Uu({children:e}){const[t,n]=g(!1),[r,s]=g(!1),[a,i]=g([]),[c,l]=g(""),[u,d]=g(""),[m,p]=g(""),[h,y]=g(!1),[_,O]=g(0);if(w(()=>{let E=!1;return p(""),(async()=>{const T=await We("/api/auth/app-status");if(E)return;if(T.hasPassword&&!T.isAuthenticated){s(!0);return}const Q=await We("/api/profiles/status");E||(Q.current?(Xs(Q.current.id),n(!0)):(i(Q.profiles),l(Q.profiles[0]?.id??"")))})().catch(T=>{E||p(T.message)}),()=>{E=!0}},[_]),w(()=>{const E=T=>{T.key==="dango:profile-session-change"&&window.location.reload()},b=()=>{n(!1),O(T=>T+1)};return window.addEventListener("storage",E),window.addEventListener("dango:profile-auth-required",b),()=>{window.removeEventListener("storage",E),window.removeEventListener("dango:profile-auth-required",b)}},[]),t)return e;const x=a.find(E=>E.id===c);return o("div",{className:Ae.gate,children:[o(Qn,{}),o(Nr,{isOpen:r,onClose:()=>{},onSuccess:()=>{s(!1),O(E=>E+1)}}),o("section",{className:Ae.panel,children:[o("h1",{children:a.length?"Choose your profile":"Connecting to Dango…"}),x&&o(de,{children:[o("div",{className:Ae.avatarRow,children:o(kr,{image:x.avatar??x.cloudAvatar,name:x.name})}),o("form",{className:Ae.form,onSubmit:async E=>{E.preventDefault(),y(!0),p("");try{await We("/api/profiles/login",{method:"POST",body:JSON.stringify({id:c,password:u})}),ta()}catch(b){p(b.message),y(!1)}},children:[o("label",{className:Ae.field,children:["Profile",o("select",{value:c,onChange:E=>{l(E.currentTarget.value),d(""),p("")},children:a.map(E=>o("option",{value:E.id,children:[E.name,E.owner?" (owner)":""]},E.id))})]}),x.protected&&o("label",{className:Ae.field,children:["Password",o("input",{type:"password",autoComplete:"current-password",required:!0,maxLength:256,value:u,onChange:E=>d(E.currentTarget.value)})]}),o(lt,{type:"submit",loading:h,children:"Continue"})]})]}),m&&o(de,{children:[o("p",{role:"alert",children:m}),o(lt,{variant:"secondary",onClick:()=>O(E=>E+1),children:"Retry"})]})]})]})}const Cr=ye(null);function jd(){const e=ge(Cr);if(!e)throw new Error("WatchAlongProvider is missing");return e}const Hu=/^[0-9a-f-]{36}$/,Qu=/^[0-9a-f]{64}$/;function Bd(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 Fd(e,t){return e.position+(e.playing?Math.max(0,t-e.updatedAt)/1e3*e.rate:0)}const Dt="dango-watch-along",Vt="dango-watch-along-host";function Ln(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=Ke(`${t.id}.${t.guestToken}`,""),r=Ke(`${t.id}.${t.token}`,"");return{...n,token:r.token,host:t.host===!0}}function zu(){try{return Ln(JSON.parse(sessionStorage.getItem(Dt)||"null"))??Ln(JSON.parse(localStorage.getItem(Vt)||"null"))}catch{return null}}function Vu(e){try{e?sessionStorage.setItem(Dt,JSON.stringify(e)):sessionStorage.removeItem(Dt),e?.host&&localStorage.setItem(Vt,JSON.stringify(e))}catch{}}function nt(){try{localStorage.removeItem(Vt)}catch{}}function Gu(e){return e.kind==="tv"||e.kind==="movie"?oc(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 Ke(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,s,a]=n.split(".");if(!Hu.test(r||"")||!Qu.test(s||"")||a!==void 0)throw new Error("Paste a complete watch-along invite link or room code.");return{id:r,token:s,guestToken:s,host:!1}}function Ju({children:e}){const t=Mn(),n=ut(),[r,s]=zt("watchAlongName",""),[a,i]=g(zu),[c,l]=g(null),[u,d]=g(!1),[m,p]=g(""),[h,y]=g(""),[_,O]=g({offset:0,latency:0}),x=M(null),{data:E}=B({queryKey:["watch-along-config"],queryFn:()=>te.settings.watchAlong.query()}),b=E?.workerUrl.replace(/\/$/,"")||"";w(()=>{Vu(a)},[a]);const T=V(P=>{x.current?.readyState===WebSocket.OPEN&&x.current.send(JSON.stringify(P))},[]);w(()=>{if(!u)return;const P=setTimeout(()=>T({type:"name",name:r}),250);return()=>clearTimeout(P)},[u,h,r,T]);const Q=V(()=>{a?.host&&T({type:"end"}),x.current?.close(1e3,"Left room"),nt(),i(null),l(null),d(!1),p("")},[T,a]),L=async P=>{if(!b)throw new Error("Watch along is unavailable. Check your server configuration.");const j=await fetch(`${b}/rooms`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(P),signal:AbortSignal.timeout(15e3)}),H=await j.json();if(!j.ok)throw new Error(H.error||"Could not create room");const v=Ke(`${H.id}.${H.guestToken}`,b),I=Ke(`${H.id}.${H.hostToken}`,b);p(""),l(null),i({...v,token:I.token,host:!0})},W=P=>{if(!b)throw new Error("Watch along is unavailable. Check your server configuration.");const j=Ke(P,b);nt(),p(""),l(null),i(j)};return w(()=>{if(!a||!b)return;let P=!1,j=0,H,v,I=Date.now();const X=async()=>{if(P)return;try{const G=await fetch(`${b}/rooms/${a.id}`,{headers:{Authorization:`Bearer ${a.token}`},signal:AbortSignal.timeout(1e4)});if(P)return;if(!G.ok){const q=await G.json();if([403,404,409].includes(G.status)){p(q.error||"Unable to join room"),nt(),i(null),l(null);return}throw new Error(q.error||"Room service unavailable")}}catch{if(P)return;p("Cannot reach the room service. Retrying…"),H=setTimeout(X,Math.min(15e3,1e3*2**Math.min(j++,4)));return}const ue=new URL(`${b}/rooms/${a.id}/ws`);ue.protocol=ue.protocol==="https:"?"wss:":"ws:";const z=new WebSocket(ue,["dango-watch-along",a.token]);x.current=z,z.onopen=()=>{I=Date.now()},z.onmessage=G=>{if(!(P||x.current!==z)){I=Date.now();try{const q=JSON.parse(G.data);if(q.type==="joined"){if(q.host!==a.host){z.close(4003,"Invalid role");return}j=0,d(!0),p(""),y(q.id),z.send(JSON.stringify({type:"ping",sentAt:Date.now()}))}else if(q.type==="state")l(me=>me&&me.revision>q.state.revision?me:q.state);else if(q.type==="pong"){const me=Date.now()-q.sentAt;O({offset:q.serverTime-(q.sentAt+me/2),latency:me/2})}else q.type==="error"&&p(q.error)}catch{p("Invalid response from the room service.")}}},z.onclose=G=>{if(!(P||x.current!==z)){if(clearInterval(v),d(!1),[4003,4004,4009].includes(G.code)){p(G.reason||"Room closed"),G.code!==4009&&nt(),i(null),l(null);return}p("Connection lost. Reconnecting…"),H=setTimeout(X,Math.min(15e3,1e3*2**Math.min(j++,4)))}},z.onerror=()=>z.close(),v=setInterval(()=>{Date.now()-I>25e3?z.close():z.readyState===WebSocket.OPEN&&z.send(JSON.stringify({type:"ping",sentAt:Date.now()}))},1e4)};return X(),()=>{P=!0,clearTimeout(H),clearInterval(v),x.current?.close(1e3,"Leaving connection"),x.current=null,d(!1)}},[a,b]),w(()=>{if(!a||a.host||!c)return;const P=Gu(c.selection);`${n.pathname}${n.search}`!==P&&t(P,{replace:!0})},[a,c,n.pathname,n.search,t]),o(Cr.Provider,{value:{workerUrl:b,displayName:r,setDisplayName:s,session:a,room:c,connected:u,error:m,selfId:h,clock:_,create:L,join:W,leave:Q,send:T},children:e})}try{window.history.scrollRestoration="manual"}catch{}const Rn=new Hr({defaultOptions:{queries:{staleTime:1e3*60*5,gcTime:1800*1e3,refetchOnWindowFocus:!1,refetchIntervalInBackground:!1,retry:1}}}),Dn=document.getElementById("root");Dn&&Fr(o(Uu,{children:o(Wr,{children:o(sa,{trpcClient:te,queryClient:Rn,children:o(Qr,{client:Rn,children:o(qu,{children:o(Iu,{children:o(xu,{children:o(Nu,{children:o(Cu,{children:o(Ou,{children:o(Ju,{children:o(Tu,{})})})})})})})})})})})}),Dn);export{Sn as $,hd as A,lt as B,kd as C,yd as D,rd as E,Rd as F,Ed as G,gd as H,fd as I,N as J,yt as K,pr as L,Cd as M,wd as N,_d as O,bd as P,Re as Q,nc as R,We as S,Nd as T,Ae as U,kr as V,ta as W,Ft as X,Y,Pd as Z,Td as _,zt as a,_r as a0,En as a1,U as a2,_t as a3,nd as a4,se as a5,jd as a6,Bl as a7,jo as a8,id as a9,ec as aa,lc as ab,Md as ac,nr as ad,Dd as ae,Ad as af,qd as ag,Ld as ah,ic as ai,Ht as aj,Id as ak,Oe as al,$d as am,Bd as an,Fd as ao,Ut as ap,Sd as aq,Nn as ar,dd as as,md as at,ud as au,od as b,sd as c,lr as d,Jc as e,ir as f,Od as g,ed as h,oc as i,xd as j,rc as k,ba as l,cc as m,Tn as n,D as o,ee as p,C as q,ad as r,td as s,te as t,li as u,wr as v,vd as w,cd as x,ld as y,pd as z};