@serifpersia/dango 3.6.3 → 3.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/client/dist/assets/{AnimeCard-Cwc6Z9rO.js → AnimeCard-DVk4BNex.js} +1 -1
- package/client/dist/assets/{AnimeInfo-ad7aMRq5.js → AnimeInfo-DevqUuNX.js} +1 -1
- package/client/dist/assets/{AnimeInfoPage-B795AIlr.js → AnimeInfoPage-ZoJMem3T.js} +2 -2
- package/client/dist/assets/{Asmr-jqhD7q69.js → Asmr-B7Hc4hT4.js} +1 -1
- package/client/dist/assets/{AsmrResetProgressModal-Bey2zoeh.js → AsmrResetProgressModal-AdrZB33a.js} +1 -1
- package/client/dist/assets/{AvSyncCalibrator-B2fQmjbo.js → AvSyncCalibrator-IXHL6uH0.js} +1 -1
- package/client/dist/assets/{Home-rRTAnTfL.js → Home-Dy6jlbe-.js} +1 -1
- package/client/dist/assets/{Insights-CN2bm8wf.js → Insights-L72FYEhY.js} +1 -1
- package/client/dist/assets/{LibraryListPage-BlNQWLrf.js → LibraryListPage-CJiChvn7.js} +1 -1
- package/client/dist/assets/{ListeningList-Pi1Baxgd.js → ListeningList-C6DmhQYE.js} +1 -1
- package/client/dist/assets/{Manga-7Jt2tJyE.js → Manga-pBfz3N91.js} +1 -1
- package/client/dist/assets/{MangaInfoPage-45jPSjxB.js → MangaInfoPage-DanNLum0.js} +1 -1
- package/client/dist/assets/{MangaReadPage-BWgX9bSn.js → MangaReadPage-CmSrkaL3.js} +1 -1
- package/client/dist/assets/{MangaResetProgressModal-DLgJrIVT.js → MangaResetProgressModal-DYBD4XfF.js} +1 -1
- package/client/dist/assets/{Mature-2I4mvoWk.js → Mature-APIFXLUd.js} +1 -1
- package/client/dist/assets/{MediaCard-cSWL_NlR.js → MediaCard-lk6ZO2T2.js} +1 -1
- package/client/dist/assets/{Music-bUuge7On.js → Music-SWFqsret.js} +1 -1
- package/client/dist/assets/{OptionListMenu-D4ejupic.js → OptionListMenu-DCG-BF9D.js} +1 -1
- package/client/dist/assets/{Player-Fm7-Iaym.js → Player-Bww3XdSp.js} +6 -6
- package/client/dist/assets/{PlayerSettings-e_PohoiO.js → PlayerSettings-aHrCaLly.js} +1 -1
- package/client/dist/assets/{QueueOptionsButton-BMl804vN.js → QueueOptionsButton-9ptjLfgY.js} +1 -1
- package/client/dist/assets/{QueueRail-BfNg-4sG.js → QueueRail-DSA94IWc.js} +1 -1
- package/client/dist/assets/{Radio-BbkMYqMU.js → Radio-fo7eMtmX.js} +1 -1
- package/client/dist/assets/{ReadingList-BN03nBXY.js → ReadingList-DOZYEIaT.js} +1 -1
- package/client/dist/assets/{ResetProgressModal-CuoM4S_P.js → ResetProgressModal-PmJXKPXV.js} +1 -1
- package/client/dist/assets/{Search-DnBPEHjw.js → Search-q_45kuOY.js} +1 -1
- package/client/dist/assets/{Settings-CqiYnqx7.js → Settings-DCG_27q2.js} +1 -1
- package/client/dist/assets/{SkeletonGrid-CYZ3cstC.js → SkeletonGrid-D6e8JTc2.js} +1 -1
- package/client/dist/assets/{Trackers-DlkQl9Qs.js → Trackers-Br8u_-n7.js} +1 -1
- package/client/dist/assets/{Tv-Ac8wPuCw.js → Tv-9jGD-POg.js} +1 -1
- package/client/dist/assets/{TvInfo-Dhv0lmCc.js → TvInfo-DaoG5qd8.js} +1 -1
- package/client/dist/assets/{TvPopup-5lwvCCOQ.js → TvPopup-B11MGIN0.js} +1 -1
- package/client/dist/assets/{TvSearch-B3_Vf8Dk.js → TvSearch-BJ_lOIHZ.js} +1 -1
- package/client/dist/assets/{TvWatchlist-B_jtSOjL.js → TvWatchlist-DGvG3C9M.js} +1 -1
- package/client/dist/assets/{Watchlist-BtFidAWI.js → Watchlist-BHxo147b.js} +1 -1
- package/client/dist/assets/{hls-CEWF8efn.js → hls-CnVLfyq6.js} +1 -1
- package/client/dist/assets/{index-C93G341i.js → index-CQlPx8UA.js} +2 -2
- package/client/dist/assets/{useAnimeInfoData-gz0XXrYm.js → useAnimeInfoData-BRP9E_M5.js} +1 -1
- package/client/dist/assets/{useAsmr-BrRbA9AW.js → useAsmr-BnqAqfIG.js} +1 -1
- package/client/dist/assets/{useAsmrPopup-C4gKdZId.js → useAsmrPopup-BJ79NC61.js} +1 -1
- package/client/dist/assets/{useMangaLibrary-DkGSBFSX.js → useMangaLibrary-nC3VQT2C.js} +1 -1
- package/client/dist/assets/{useMangaPopup-DwKm2HYt.js → useMangaPopup-CTSFWlC4.js} +1 -1
- package/client/dist/assets/{useProviders-C3E0fPpP.js → useProviders-DQLAbAta.js} +1 -1
- package/client/dist/assets/{useTv-BQ3K3Xdh.js → useTv-BeQG1pC1.js} +1 -1
- package/client/dist/assets/{useTvLibrary-DizEfaXg.js → useTvLibrary-F0MkBioA.js} +1 -1
- package/client/dist/index.html +1 -1
- package/package.json +2 -2
- package/server/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Home-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Home-Dy6jlbe-.js","assets/vendor-core-DfaOB3Rn.js","assets/vendor-query-BBT5_sHx.js","assets/SkeletonGrid-D6e8JTc2.js","assets/vendor-icons-DrybRNxP.js","assets/SkeletonGrid-Bge3aRl2.css","assets/AnimeCard-DVk4BNex.js","assets/useAnimeInfoData-BRP9E_M5.js","assets/QueueOptionsButton-9ptjLfgY.js","assets/vendor-ui-3qrARCPr.js","assets/QueueOptionsButton-CM15uQn8.css","assets/MediaCard-lk6ZO2T2.js","assets/useIsMobile-Dvx1uJ82.js","assets/MediaCard-DB6Yjgky.css","assets/ErrorMessage-DAxegITP.js","assets/ErrorMessage-CXoRbrLN.css","assets/ResetProgressModal-PmJXKPXV.js","assets/QueueRail-DSA94IWc.js","assets/QueueRail-BUYEjdaq.css","assets/useMangaPopup-CTSFWlC4.js","assets/useMangaLibrary-nC3VQT2C.js","assets/usePopup-DS9jMzp6.js","assets/MangaResetProgressModal-DYBD4XfF.js","assets/useProviders-DQLAbAta.js","assets/useTv-BeQG1pC1.js","assets/TvPopup-B11MGIN0.js","assets/useTvLibrary-F0MkBioA.js","assets/AsmrResetProgressModal-AdrZB33a.js","assets/useAsmr-BnqAqfIG.js","assets/Home-DeY8zvfI.css","assets/Watchlist-BHxo147b.js","assets/Watchlist.module-XGtVQr1d.js","assets/Watchlist-BiDEU0iV.css","assets/Settings-DCG_27q2.js","assets/ToggleSwitch-CN_ppEc9.js","assets/ToggleSwitch-BPil0d_k.css","assets/Settings-CwIWLSfY.css","assets/Player-Bww3XdSp.js","assets/AvSyncCalibrator-IXHL6uH0.js","assets/AvSyncCalibrator-ZSpMgUid.css","assets/hls-CnVLfyq6.js","assets/AnimeMetaDetails-BogOi_bM.js","assets/AnimeMetaDetails-BwNQnRCd.css","assets/SynopsisText-B3Sa5pRv.js","assets/SynopsisText-CYv2W3yR.css","assets/Player-DCB994_8.css","assets/Search-q_45kuOY.js","assets/Search.module-CMEai-B-.js","assets/Search-Cs45oAwI.css","assets/Mature-APIFXLUd.js","assets/Mature-DJmUUtlF.css","assets/Asmr-B7Hc4hT4.js","assets/Asmr.module-CdWlioTY.js","assets/Asmr-D1KuQwQy.css","assets/useAsmrPopup-BJ79NC61.js","assets/page.module-C1MlZzf3.js","assets/page-DRvjODkg.css","assets/Manga-pBfz3N91.js","assets/Manga.module-depGEacJ.js","assets/Manga-CqAceKxR.css","assets/MangaInfoPage-DanNLum0.js","assets/MangaReadPage-CmSrkaL3.js","assets/ReadingList-DOZYEIaT.js","assets/LibraryListPage-CJiChvn7.js","assets/Radio-fo7eMtmX.js","assets/Radio.module-DGSZLpKM.js","assets/Radio-CCHNFN7R.css","assets/Music-SWFqsret.js","assets/Music-BGH_0voi.css","assets/TvSearch-BJ_lOIHZ.js","assets/TvInfo-DaoG5qd8.js","assets/TvInfo-Bu36xJyO.css","assets/Tv-9jGD-POg.js","assets/OptionListMenu-DCG-BF9D.js","assets/Tv-Bdruknna.css","assets/TvWatchlist-DGvG3C9M.js","assets/ListeningList-C6DmhQYE.js","assets/Trackers-Br8u_-n7.js","assets/Trackers-D5XBOCDp.css","assets/Insights-L72FYEhY.js","assets/Insights-Dc8xLmsr.css","assets/AnimeInfoPage-ZoJMem3T.js","assets/PlayerRedirect-fv2tzEUu.js","assets/VirtualKeyboard-BmqZPZXR.js","assets/VirtualKeyboard-KIPc5ZGH.css"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{N as Mn,k as W,A as B,q as Q,h as w,S as V,d as S,X as ce,x as le,T as Pe,g as ut,u as o,L as J,$ as Jt,a as Fn,c as dt,e as Bn,f as Wn,D as Qn,i as Kn,P as bt,j as Un,l as x,m as _t,z as q,n as Hn,B as Vn}from"./vendor-core-DfaOB3Rn.js";import{s as ge,i as zn,q as Gn,u as K,a as X,b as z,c as mt,Q as Yn,d as Jn}from"./vendor-query-BBT5_sHx.js";import{I as g}from"./vendor-icons-DrybRNxP.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();const Zn="modulepreload",Xn=function(e){return"/"+e},wt={},L=function(t,n,r){let i=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 a=document.querySelector("meta[property=csp-nonce]"),c=a?.nonce||a?.getAttribute("nonce");i=l(n.map(u=>{if(u=Xn(u),u in wt)return;wt[u]=!0;const d=u.endsWith(".css"),m=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${m}`))return;const h=document.createElement("link");if(h.rel=d?"stylesheet":Zn,d||(h.as="script"),h.crossOrigin="",h.href=u,c&&h.setAttribute("nonce",c),document.head.appendChild(h),d)return new Promise((p,f)=>{h.addEventListener("load",p),h.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${u}`)))})}))}function s(a){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=a,window.dispatchEvent(c),!c.defaultPrevented)throw a}return i.then(a=>{for(const c of a||[])c.status==="rejected"&&s(c.reason);return t().catch(s)})};let er={data:""},tr=e=>{if(typeof window=="object"){let t=(e?e.querySelector("#_goober"):window._goober)||Object.assign(document.createElement("style"),{innerHTML:" ",id:"_goober"});return t.nonce=window.__nonce__,t.parentNode||(e||document.head).appendChild(t),t.firstChild}return e||er},nr=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,rr=/\/\*[^]*?\*\/| +/g,Et=/\n+/g,he=(e,t)=>{let n="",r="",i="";for(let s in e){let a=e[s];s[0]=="@"?s[1]=="i"?n=s+" "+a+";":r+=s[1]=="f"?he(a,s):s+"{"+he(a,s[1]=="k"?"":t)+"}":typeof a=="object"?r+=he(a,t?t.replace(/([^,])+/g,c=>s.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,l=>/&/.test(l)?l.replace(/&/g,c):c?c+" "+l:l)):s):a!=null&&(s=s[1]=="-"?s:s.replace(/[A-Z]/g,"-$&").toLowerCase(),i+=he.p?he.p(s,a):s+":"+a+";")}return n+(t&&i?t+"{"+i+"}":i)+r},me={},Zt=e=>{if(typeof e=="object"){let t="";for(let n in e)t+=n+Zt(e[n]);return t}return e},or=(e,t,n,r,i)=>{let s=Zt(e),a=me[s]||(me[s]=(l=>{let u=0,d=11;for(;u<l.length;)d=101*d+l.charCodeAt(u++)>>>0;return"go"+d})(s));if(!me[a]){let l=s!==e?e:(u=>{let d,m,h=[{}];for(;d=nr.exec(u.replace(rr,""));)d[4]?h.shift():d[3]?(m=d[3].replace(Et," ").trim(),h.unshift(h[0][m]=h[0][m]||{})):h[0][d[1]]=d[2].replace(Et," ").trim();return h[0]})(e);me[a]=he(i?{["@keyframes "+a]:l}:l,n?"":"."+a)}let c=n&&me.g;return n&&(me.g=me[a]),((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)})(me[a],t,r,c),a},ir=(e,t,n)=>e.reduce((r,i,s)=>{let a=t[s];if(a&&a.call){let c=a(n),l=c&&c.props&&c.props.className||/^go/.test(c)&&c;a=l?"."+l:c&&typeof c=="object"?c.props?"":he(c,""):c===!1?"":c}return r+i+(a??"")},"");function Ke(e){let t=this||{},n=e.call?e(t.p):e;return or(n.unshift?n.raw?ir(n,[].slice.call(arguments,1),t.p):n.reduce((r,i)=>Object.assign(r,i&&i.call?i(t.p):i),{}):n,tr(t.target),t.g,t.o,t.k)}let Xt,tt,nt;Ke.bind({g:1});let ue=Ke.bind({k:1});function sr(e,t,n,r){he.p=t,Xt=e,tt=n,nt=r}function fe(e,t){let n=this||{};return function(){let r=arguments;function i(s,a){let c=Object.assign({},s),l=c.className||i.className;n.p=Object.assign({theme:tt&&tt()},c),n.o=/go\d/.test(l),c.className=Ke.apply(n,r)+(l?" "+l:"");let u=e;return e[0]&&(u=c.as||e,delete c.as),nt&&u[0]&&nt(c),Xt(u,c)}return i}}var ar=e=>typeof e=="function",We=(e,t)=>ar(e)?e(t):e,cr=(()=>{let e=0;return()=>(++e).toString()})(),en=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),lr=20,ht="default",tn=(e,t)=>{let{toastLimit:n}=e.settings;switch(t.type){case 0:return{...e,toasts:[t.toast,...e.toasts].slice(0,n)};case 1:return{...e,toasts:e.toasts.map(a=>a.id===t.toast.id?{...a,...t.toast}:a)};case 2:let{toast:r}=t;return tn(e,{type:e.toasts.find(a=>a.id===r.id)?1:0,toast:r});case 3:let{toastId:i}=t;return{...e,toasts:e.toasts.map(a=>a.id===i||i===void 0?{...a,dismissed:!0,visible:!1}:a)};case 4:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(a=>a.id!==t.toastId)};case 5:return{...e,pausedAt:t.time};case 6:let s=t.time-(e.pausedAt||0);return{...e,pausedAt:void 0,toasts:e.toasts.map(a=>({...a,pauseDuration:a.pauseDuration+s}))}}},Me=[],nn={toasts:[],pausedAt:void 0,settings:{toastLimit:lr}},re={},rn=(e,t=ht)=>{re[t]=tn(re[t]||nn,e),Me.forEach(([n,r])=>{n===t&&r(re[t])})},on=e=>Object.keys(re).forEach(t=>rn(e,t)),ur=e=>Object.keys(re).find(t=>re[t].toasts.some(n=>n.id===e)),Ue=(e=ht)=>t=>{rn(t,e)},dr={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},mr=(e={},t=ht)=>{let[n,r]=S(re[t]||nn),i=B(re[t]);w(()=>(i.current!==re[t]&&r(re[t]),Me.push([t,r]),()=>{let a=Me.findIndex(([c])=>c===t);a>-1&&Me.splice(a,1)}),[t]);let s=n.toasts.map(a=>{var c,l,u;return{...e,...e[a.type],...a,removeDelay:a.removeDelay||((c=e[a.type])==null?void 0:c.removeDelay)||e?.removeDelay,duration:a.duration||((l=e[a.type])==null?void 0:l.duration)||e?.duration||dr[a.type],style:{...e.style,...(u=e[a.type])==null?void 0:u.style,...a.style}}});return{...n,toasts:s}},hr=(e,t="blank",n)=>({createdAt:Date.now(),visible:!0,dismissed:!1,type:t,ariaProps:{role:"status","aria-live":"polite"},message:e,pauseDuration:0,...n,id:n?.id||cr()}),Ae=e=>(t,n)=>{let r=hr(t,e,n);return Ue(r.toasterId||ur(r.id))({type:2,toast:r}),r.id},M=(e,t)=>Ae("blank")(e,t);M.error=Ae("error");M.success=Ae("success");M.loading=Ae("loading");M.custom=Ae("custom");M.dismiss=(e,t)=>{let n={type:3,toastId:e};t?Ue(t)(n):on(n)};M.dismissAll=e=>M.dismiss(void 0,e);M.remove=(e,t)=>{let n={type:4,toastId:e};t?Ue(t)(n):on(n)};M.removeAll=e=>M.remove(void 0,e);M.promise=(e,t,n)=>{let r=M.loading(t.loading,{...n,...n?.loading});return typeof e=="function"&&(e=e()),e.then(i=>{let s=t.success?We(t.success,i):void 0;return s?M.success(s,{id:r,...n,...n?.success}):M.dismiss(r),i}).catch(i=>{let s=t.error?We(t.error,i):void 0;s?M.error(s,{id:r,...n,...n?.error}):M.dismiss(r)}),e};var pr=1e3,fr=(e,t="default")=>{let{toasts:n,pausedAt:r}=mr(e,t),i=B(new Map).current,s=Q((m,h=pr)=>{if(i.has(m))return;let p=setTimeout(()=>{i.delete(m),a({type:4,toastId:m})},h);i.set(m,p)},[]);w(()=>{if(r)return;let m=Date.now(),h=n.map(p=>{if(p.duration===1/0)return;let f=(p.duration||0)+p.pauseDuration-(m-p.createdAt);if(f<0){p.visible&&M.dismiss(p.id);return}return setTimeout(()=>M.dismiss(p.id,t),f)});return()=>{h.forEach(p=>p&&clearTimeout(p))}},[n,r,t]);let a=Q(Ue(t),[t]),c=Q(()=>{a({type:5,time:Date.now()})},[a]),l=Q((m,h)=>{a({type:1,toast:{id:m,height:h}})},[a]),u=Q(()=>{r&&a({type:6,time:Date.now()})},[r,a]),d=Q((m,h)=>{let{reverseOrder:p=!1,gutter:f=8,defaultPosition:I}=h||{},P=n.filter(E=>(E.position||I)===(m.position||I)&&E.height),R=P.findIndex(E=>E.id===m.id),O=P.filter((E,D)=>D<R&&E.visible).length;return P.filter(E=>E.visible).slice(...p?[O+1]:[0,O]).reduce((E,D)=>E+(D.height||0)+f,0)},[n]);return w(()=>{n.forEach(m=>{if(m.dismissed)s(m.id,m.removeDelay);else{let h=i.get(m.id);h&&(clearTimeout(h),i.delete(m.id))}})},[n,s]),{toasts:n,handlers:{updateHeight:l,startPause:c,endPause:u,calculateOffset:d}}},yr=ue`
|
|
3
3
|
from {
|
|
4
4
|
transform: scale(0) rotate(45deg);
|
|
@@ -175,4 +175,4 @@ to {
|
|
|
175
175
|
> * {
|
|
176
176
|
pointer-events: auto;
|
|
177
177
|
}
|
|
178
|
-
`,Re=16,Br=({reverseOrder:e,position:t="top-center",toastOptions:n,gutter:r,children:i,toasterId:s,containerStyle:a,containerClassName:c})=>{let{toasts:l,handlers:u}=fr(n,s);return W("div",{"data-rht-toaster":s||"",style:{position:"fixed",zIndex:9999,top:Re,left:Re,right:Re,bottom:Re,pointerEvents:"none",...a},className:c,onMouseEnter:u.startPause,onMouseLeave:u.endPause},l.map(d=>{let m=d.position||t,h=u.calculateOffset(d,{reverseOrder:e,gutter:r,defaultPosition:t}),p=Mr(m,h);return W(jr,{id:d.id,key:d.id,onHeightUpdate:u.updateHeight,className:d.visible?Fr:"",style:p},d.type==="custom"?We(d.message,d):i?i(d):W(Dr,{toast:d,position:m}))}))},b=M;function He(e){const t={subscribe(n){let r=null,i=!1,s=!1,a=!1;function c(){if(r===null){a=!0;return}s||(s=!0,typeof r=="function"?r():r&&r.unsubscribe())}return r=e({next(l){var u;i||(u=n.next)===null||u===void 0||u.call(n,l)},error(l){var u;i||(i=!0,(u=n.error)===null||u===void 0||u.call(n,l),c())},complete(){var l;i||(i=!0,(l=n.complete)===null||l===void 0||l.call(n),c())}}),a&&c(),{unsubscribe:c}},pipe(...n){return n.reduce(Wr,t)}};return t}function Wr(e,t){return t(e)}function Qr(e){const t=new AbortController;return new Promise((n,r)=>{let i=!1;function s(){i||(i=!0,a.unsubscribe())}t.signal.addEventListener("abort",()=>{r(t.signal.reason)});const a=e.subscribe({next(c){i=!0,n(c),s()},error(c){r(c)},complete(){t.abort(),s()}})})}function Kr(e){return t=>{let n=0,r=null;const i=[];function s(){r||(r=t.subscribe({next(c){for(const u of i){var l;(l=u.next)===null||l===void 0||l.call(u,c)}},error(c){for(const u of i){var l;(l=u.error)===null||l===void 0||l.call(u,c)}},complete(){for(const l of i){var c;(c=l.complete)===null||c===void 0||c.call(l)}}}))}function a(){if(n===0&&r){const c=r;r=null,c.unsubscribe()}}return He(c=>(n++,i.push(c),s(),{unsubscribe(){n--,a();const l=i.findIndex(u=>u===c);l>-1&&i.splice(l,1)}}))}}function Ur(e){let t=e;const n=[],r=a=>{t!==void 0&&a.next(t),n.push(a)},i=a=>{n.splice(n.indexOf(a),1)},s=He(a=>(r(a),()=>{i(a)}));return s.next=a=>{if(t!==a){t=a;for(const c of n)c.next(a)}},s.get=()=>t,s}function Hr(e){return He(t=>{function n(r=0,i=e.op){const s=e.links[r];if(!s)throw new Error("No more links to execute - did you forget to add an ending link?");return s({op:i,next(a){return n(r+1,a)}})}return n().subscribe(t)})}function Oe(e){"@babel/helpers - typeof";return Oe=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},Oe(e)}function Vr(e,t){if(Oe(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Oe(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function zr(e){var t=Vr(e,"string");return Oe(t)=="symbol"?t:t+""}function H(e,t,n){return(t=zr(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function kt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function F(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?kt(Object(n),!0).forEach(function(r){H(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kt(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 Gr(e){return typeof e=="function"}function Yr(){return Object.create(null)}const Jr=typeof Symbol=="function"&&!!Symbol.asyncIterator;function Zr(e){return Jr&&pe(e)&&Symbol.asyncIterator in e}const Xr=e=>e(),sn=()=>{},St=e=>{Object.freeze&&Object.freeze(e)};function an(e,t,n){var r;const i=t.join(".");return(r=n[i])!==null&&r!==void 0||(n[i]=new Proxy(sn,{get(s,a){if(!(typeof a!="string"||a==="then"))return an(e,[...t,a],n)},apply(s,a,c){const l=t[t.length-1];if(l==="valueOf"||l==="toString"||l==="toJSON")return`tRPC.proxy(${t.slice(0,-1).join(".")})`;let u={args:c,path:t};return l==="call"?u={args:c.length>=2?[c[1]]:[],path:t.slice(0,-1)}:l==="apply"&&(u={args:c.length>=2?c[1]:[],path:t.slice(0,-1)}),St(u.args),St(u.path),e(u)}})),n[i]}const cn=e=>an(e,[],Yr()),eo=e=>new Proxy(sn,{get(t,n){if(n!=="then")return e(n)}});function Ce(e){"@babel/helpers - typeof";return Ce=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},Ce(e)}function to(e,t){if(Ce(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Ce(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function no(e){var t=to(e,"string");return Ce(t)=="symbol"?t:t+""}function rt(e,t,n){return(t=no(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Pt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function $e(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Pt(Object(n),!0).forEach(function(r){rt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pt(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ro=class extends Error{constructor(e){super(oo(e)),Object.assign(this,e)}};function oo(e){if("message"in e)return String(e.message)}function io(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 ro(e)}}var xt=class extends Error{constructor(e){var t,n,r;const i=io(e.cause),s=(t=(n=e.message)!==null&&n!==void 0?n:i?.message)!==null&&t!==void 0?t:e.code;super(s,{cause:i}),rt(this,"cause",void 0),rt(this,"code",void 0),this.code=e.code,this.name="TRPCError",(r=this.cause)!==null&&r!==void 0||(this.cause=i)}};function so(e,t){if("error"in e){const n=t.deserialize(e.error);return{ok:!1,error:$e($e({},e),{},{error:n})}}return{ok:!0,result:$e($e({},e.result),(!e.result.type||e.result.type==="data")&&{type:"data",data:t.deserialize(e.result.data)})}}var Ge=class extends Error{constructor(){super("Unable to transform response from server")}};function ao(e,t){let n;try{n=so(e,t)}catch{throw new Ge}if(!n.ok&&(!pe(n.error.error)||typeof n.error.error.code!="number"))throw new Ge;if(n.ok&&!pe(n.result))throw new Ge;return n}function co(e){return typeof e=="function"}async function lo(e,t){const{_def:n}=e;let r=n.procedures[t];for(;!r;){const i=Object.keys(n.lazy).find(s=>t===s||t.startsWith(s+"."));if(!i)return null;await n.lazy[i].load(),r=n.procedures[t]}return r}async function uo(e){const{type:t,path:n}=e,r=await lo(e.router,n);if(!r||!co(r)||r._def.type!==t&&!e.allowMethodOverride)throw new xt({code:"NOT_FOUND",message:`No "${t}"-procedure on path "${n}"`});if(r._def.type!==t&&e.allowMethodOverride&&r._def.type==="subscription")throw new xt({code:"METHOD_NOT_SUPPORTED",message:"Method override is not supported for subscriptions"});return r(e)}function mo(e){return e instanceof Qe}function ho(e){return pe(e)&&pe(e.error)&&typeof e.error.code=="number"&&typeof e.error.message=="string"}function po(e,t){return typeof e=="string"?e:pe(e)&&typeof e.message=="string"?e.message:t}var Qe=class Fe extends Error{constructor(t,n){var r,i;const s=n?.cause;super(t,{cause:s}),H(this,"cause",void 0),H(this,"shape",void 0),H(this,"data",void 0),H(this,"meta",void 0),this.meta=n?.meta,this.cause=s,this.shape=n==null||(r=n.result)===null||r===void 0?void 0:r.error,this.data=n==null||(i=n.result)===null||i===void 0?void 0:i.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,Fe.prototype)}static from(t,n={}){const r=t;return mo(r)?(n.meta&&(r.meta=F(F({},r.meta),n.meta)),r):ho(r)?new Fe(r.error.message,F(F({},n),{},{result:r,cause:n.cause})):new Fe(po(r,"Unknown error"),F(F({},n),{},{cause:r}))}};function fo(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 Tt=e=>typeof e=="function";function yo(e){if(e)return e;if(typeof window<"u"&&Tt(window.fetch))return window.fetch.bind(window);if(typeof globalThis<"u"&&Tt(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}function vo(...e){const t=new AbortController,n=e.length;let r=0;const i=()=>{++r===n&&t.abort()};for(const s of e)s?.aborted?i():s?.addEventListener("abort",i,{once:!0});return t.signal}function go(...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 bo(e){return{url:e.url.toString(),fetch:e.fetch,transformer:fo(e.transformer),methodOverride:e.methodOverride}}function _o(e){const t={};for(let n=0;n<e.length;n++){const r=e[n];t[n]=r}return t}const wo={query:"GET",mutation:"POST",subscription:"PATCH"};function ln(e){return"input"in e?e.transformer.input.serialize(e.input):_o(e.inputs.map(t=>e.transformer.input.serialize(t)))}const un=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 i=ln(e);i!==void 0&&e.methodOverride!=="POST"&&r.push(`input=${encodeURIComponent(JSON.stringify(i))}`)}return r.length&&(n+="?"+r.join("&")),n},Eo=e=>{if(e.type==="query"&&e.methodOverride!=="POST")return;const t=ln(e);return t!==void 0?JSON.stringify(t):void 0},ko=e=>To(F(F({},e),{},{contentTypeHeader:"application/json",getUrl:un,getBody:Eo}));var So=class extends Error{constructor(){const e="AbortError";super(e),this.name=e,this.message=e}};const Po=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 So};async function xo(e){var t,n;Po(e.signal);const r=e.getUrl(e),i=e.getBody(e),s=(t=e.methodOverride)!==null&&t!==void 0?t:wo[e.type],a=await(async()=>{const l=await e.headers();return Symbol.iterator in l?Object.fromEntries(l):l})(),c=F(F(F({},e.contentTypeHeader&&s!=="GET"?{"content-type":e.contentTypeHeader}:{}),e.trpcAcceptHeader?{[(n=e.trpcAcceptHeaderKey)!==null&&n!==void 0?n:"trpc-accept"]:e.trpcAcceptHeader}:void 0),a);return yo(e.fetch)(r,{method:s,signal:e.signal,body:i,headers:c})}async function To(e){const t={},n=await xo(e);t.response=n;const r=await n.json();return t.responseJSON=r,{json:r,meta:t}}const It=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function Ot(e){let t=null,n=null;const r=()=>{clearTimeout(n),n=null,t=null};function i(c){const l=[[]];let u=0;for(;;){const h=c[u];if(!h)break;const p=l[l.length-1];if(h.aborted){var d;(d=h.reject)===null||d===void 0||d.call(h,new Error("Aborted")),u++;continue}if(e.validate(p.concat(h).map(f=>f.key))){p.push(h),u++;continue}if(p.length===0){var m;(m=h.reject)===null||m===void 0||m.call(h,new Error("Input is too big for a single dispatch")),u++;continue}l.push([])}return l}function s(){const c=i(t);r();for(const l of c){if(!l.length)continue;const u={items:l};for(const d of l)d.batch=u;e.fetch(u.items.map(d=>d.key)).then(async d=>{await Promise.all(d.map(async(h,p)=>{const f=u.items[p];try{var I;const R=await Promise.resolve(h);(I=f.resolve)===null||I===void 0||I.call(f,R)}catch(R){var P;(P=f.reject)===null||P===void 0||P.call(f,R)}f.batch=null,f.reject=null,f.resolve=null}));for(const h of u.items){var m;(m=h.reject)===null||m===void 0||m.call(h,new Error("Missing result")),h.batch=null}}).catch(d=>{for(const h of u.items){var m;(m=h.reject)===null||m===void 0||m.call(h,d),h.batch=null}})}}function a(c){var l;const u={aborted:!1,key:c,batch:null,resolve:It,reject:It},d=new Promise((m,h)=>{var p;u.reject=h,u.resolve=m,(p=t)!==null&&p!==void 0||(t=[]),t.push(u)});return(l=n)!==null&&l!==void 0||(n=setTimeout(s)),d}return{load:a}}function Io(e){var t,n;const r=bo(e),i=(t=e.maxURLLength)!==null&&t!==void 0?t:1/0,s=(n=e.maxItems)!==null&&n!==void 0?n:1/0;return()=>{const a=l=>({validate(u){if(i===1/0&&s===1/0)return!0;if(u.length>s)return!1;const d=u.map(h=>h.path).join(","),m=u.map(h=>h.input);return un(F(F({},r),{},{type:l,path:d,inputs:m,signal:null})).length<=i},async fetch(u){const d=u.map(f=>f.path).join(","),m=u.map(f=>f.input),h=vo(...u.map(f=>f.signal)),p=await ko(F(F({},r),{},{path:d,inputs:m,type:l,headers(){return e.headers?typeof e.headers=="function"?e.headers({opList:u}):e.headers:{}},signal:h}));return(Array.isArray(p.json)?p.json:u.map(()=>p.json)).map(f=>({meta:p.meta,json:f}))}}),c={query:Ot(a("query")),mutation:Ot(a("mutation"))};return({op:l})=>He(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(F(F({},l),{},{signal:go(l.signal,d.signal)}));let h=!1,p;return m.then(f=>{h=!0,p=f;const I=ao(f.json,r.transformer.output);if(!I.ok){u.error(Qe.from(I.error,{meta:f.meta}));return}u.next({context:f.meta,result:I.result}),u.complete()}).catch(f=>{h=!0,u.error(Qe.from(f,{meta:p?.meta}))}),()=>{h||d.abort()}})}}const dn=(e,...t)=>typeof e=="function"?e(...t):e;function Oo(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}async function Co(e){const t=await dn(e.url);return e.connectionParams?t+`${t.includes("?")?"&":"?"}connectionParams=1`:t}async function No(e,t){const n={method:"connectionParams",data:await dn(e)};return t.encode(n)}function Ao(e){const{promise:t,resolve:n,reject:r}=Oo();return e.addEventListener("open",()=>{e.removeEventListener("error",r),n()}),e.addEventListener("error",r),t}function qo(e,{intervalMs:t,pongTimeoutMs:n}){let r,i;function s(){r=setTimeout(()=>{e.send("PING"),i=setTimeout(()=>{e.close()},n)},t)}function a(){clearTimeout(r),s()}function c(){clearTimeout(i),a()}e.addEventListener("open",s),e.addEventListener("message",({data:l})=>{clearTimeout(r),s(),l==="PONG"&&c()}),e.addEventListener("close",()=>{clearTimeout(r),clearTimeout(i)})}var Lo=class ot{constructor(t){var n;if(H(this,"id",++ot.connectCount),H(this,"WebSocketPonyfill",void 0),H(this,"urlOptions",void 0),H(this,"keepAliveOpts",void 0),H(this,"encoder",void 0),H(this,"wsObservable",Ur(null)),H(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=++ot.connectCount;const t=Co(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&&qo(n,this.keepAliveOpts),n.addEventListener("close",()=>{this.ws===n&&(this.ws=null)}),await Ao(n),this.urlOptions.connectionParams&&n.send(await No(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()}}};H(Lo,"connectCount",0);var mn=class{constructor(e){H(this,"links",void 0),H(this,"runtime",void 0),H(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=e.links.map(t=>t(this.runtime))}$request(e){var t;return Hr({links:this.links,op:F(F({},e),{},{context:(t=e.context)!==null&&t!==void 0?t:{},id:++this.requestId})}).pipe(Kr())}async requestAsPromise(e){try{const t=this.$request(e);return(await Qr(t)).result.data}catch(t){throw Qe.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 i;(i=n.onConnectionStateChange)===null||i===void 0||i.call(n,r.result);break;case"started":var s;(s=n.onStarted)===null||s===void 0||s.call(n,{context:r.context});break;case"stopped":var a;(a=n.onStopped)===null||a===void 0||a.call(n);break;case"data":case void 0:var c;(c=n.onData)===null||c===void 0||c.call(n,r.result.data)}},error(r){var i;(i=n.onError)===null||i===void 0||i.call(n,r)},complete(){var r;(r=n.onComplete)===null||r===void 0||r.call(n)}})}};const hn=Symbol.for("trpc_untypedClient"),Ro={query:"query",mutate:"mutation",subscribe:"subscription"},$o=e=>Ro[e];function Do(e){const t=cn(({path:n,args:r})=>{const i=[...n],s=$o(i.pop()),a=i.join(".");return e[s](a,...r)});return eo(n=>n===hn?e:t[n])}function jo(e){return Do(new mn(e))}function Mo(e){return e[hn]}function Ne(e){"@babel/helpers - typeof";return Ne=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},Ne(e)}function Fo(e,t){if(Ne(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Ne(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Bo(e){var t=Fo(e,"string");return Ne(t)=="symbol"?t:t+""}function Wo(e,t,n){return(t=Bo(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ct(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function T(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ct(Object(n),!0).forEach(function(r){Wo(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ct(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Qo(e){var t,n,r,i=2;for(typeof Symbol<"u"&&(n=Symbol.asyncIterator,r=Symbol.iterator);i--;){if(n&&(t=e[n])!=null)return t.call(e);if(r&&(t=e[r])!=null)return new Be(t.call(e));n="@@asyncIterator",r="@@iterator"}throw new TypeError("Object is not async iterable")}function Be(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(i){return{value:i,done:r}})}return Be=function(r){this.s=r,this.n=r.next},Be.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(r){var i=this.s.return;return i===void 0?Promise.resolve({value:r,done:!0}):t(i.apply(this.s,arguments))},throw:function(r){var i=this.s.return;return i===void 0?Promise.reject(r):t(i.apply(this.s,arguments))}},new Be(e)}function Ko(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 Uo(e,t){if(e==null)return{};var n,r,i=Ko(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}const Ho=["cursor","direction"];function Ve(e){return{path:e.path.join(".")}}function Vo(e){return e.length>=3}function zo(e){return Vo(e)?{type:"prefixed",prefix:e[0],path:e[1],args:e[2]}:{type:"unprefixed",prefix:void 0,path:e[0],args:e[1]}}function pt(e,t,n){var r;const i=zo(e);let s=(r=i.args)===null||r===void 0?void 0:r.input;if(n){var a,c;s=T(T(T({},(a=(c=i.args)===null||c===void 0?void 0:c.input)!==null&&a!==void 0?a:{}),n.pageParam!==void 0?{cursor:n.pageParam}:{}),{},{direction:n.direction})}return[i.path.join("."),s,t?.trpc]}async function Go(e,t,n){const r=t.getQueryCache().build(t,{queryKey:n});r.setState({data:[],status:"success"});const i=[];var s=!1,a=!1,c;try{for(var l=Qo(e),u;s=!(u=await l.next()).done;s=!1){const d=u.value;i.push(d),r.setState({data:[...i]})}}catch(d){a=!0,c=d}finally{try{s&&l.return!=null&&await l.return()}finally{if(a)throw c}}return i}function se(e){const t=Xr(()=>{const{input:n,type:r}=e,i=e.path.flatMap(s=>s.split("."));if(!n&&r==="any")return i.length?[i]:[];if(r==="infinite"&&pe(n)&&("direction"in n||"cursor"in n)){const{cursor:s,direction:a}=n;return[i,{input:Uo(n,Ho),type:"infinite"}]}return[i,T(T({},typeof n<"u"&&n!==ge&&{input:n}),r&&r!=="any"&&{type:r})]});return e.prefix&&t.unshift([e.prefix]),t}function pn(e){const t=[e.path.flatMap(n=>n.split("."))];return e.prefix&&t.unshift([e.prefix]),t}function ft(e){return Gr(e)?e():e}function Yo(e){var t;const{input:n,query:r,path:i,queryKey:s,opts:a}=e,c=n===ge,l=async u=>{var d;const m=T(T({},a),{},{trpc:T(T({},a?.trpc),!(a==null||(d=a.trpc)===null||d===void 0)&&d.abortOnUnmount?{signal:u.signal}:{signal:null})});return await r(...pt(s,m,{direction:u.direction,pageParam:u.pageParam}))};return Object.assign(zn(T(T({},a??{}),{},{queryKey:s,queryFn:c?ge:l,initialPageParam:(t=a?.initialCursor)!==null&&t!==void 0?t:n?.cursor})),{trpc:Ve({path:i})})}function Jo(e){var t,n;const{mutate:r,path:i,prefix:s,opts:a,overrides:c}=e,l=ft(e.queryClient),u=pn({path:i,prefix:(t=a?.keyPrefix)!==null&&t!==void 0?t:s}),d=l.defaultMutationOptions(l.getMutationDefaults(u)),m=(n=c?.onSuccess)!==null&&n!==void 0?n:(p=>p.originalFn()),h=async p=>await r(...pt([...u,{input:p}],a));return T(T({},a),{},{mutationKey:u,mutationFn:h,onSuccess(...p){var f,I;return m({originalFn:()=>{var R,O,E;return(R=a==null||(O=a.onSuccess)===null||O===void 0?void 0:O.call(a,...p))!==null&&R!==void 0?R:d==null||(E=d.onSuccess)===null||E===void 0?void 0:E.call(d,...p)},queryClient:l,meta:(f=(I=a?.meta)!==null&&I!==void 0?I:d?.meta)!==null&&f!==void 0?f:{}})},trpc:Ve({path:i})})}function Zo(e){const{input:t,query:n,path:r,queryKey:i,opts:s}=e,a=ft(e.queryClient),c=t===ge,l=async u=>{var d;const m=T(T({},s),{},{trpc:T(T({},s?.trpc),!(s==null||(d=s.trpc)===null||d===void 0)&&d.abortOnUnmount?{signal:u.signal}:{signal:null})}),h=u.queryKey,p=await n(...pt(h,m));return Zr(p)?Go(p,a,h):p};return Object.assign(Gn(T(T({},s),{},{queryKey:i,queryFn:c?ge:l})),{trpc:Ve({path:r})})}const Xo=e=>{const{subscribe:t,path:n,queryKey:r,input:i,opts:s={}}=e,a="enabled"in s?!!s.enabled:i!==ge,c=l=>t(n.join("."),i===ge?void 0:i,l);return T(T({},s),{},{enabled:a,subscribe:c,queryKey:r,trpc:Ve({path:n})})};function ei(e){const t=e.keyPrefix,n=r=>(i,s,a)=>"router"in e?Promise.resolve(ft(e.ctx)).then(c=>uo({router:e.router,path:i,getRawInput:async()=>s,ctx:c,type:r,signal:void 0,batchIndex:0})):(e.client instanceof mn?e.client:Mo(e.client))[r](i,s,a);return cn(({args:r,path:i})=>{const s=[...i],a=s.pop(),[c,l]=r;return{"~types":void 0,pathKey:()=>se({path:s,type:"any",prefix:t}),pathFilter:()=>T(T({},c),{},{queryKey:se({path:s,type:"any",prefix:t})}),queryOptions:()=>Zo({input:c,opts:l,path:s,queryClient:e.queryClient,queryKey:se({path:s,input:c,type:"query",prefix:t}),query:n("query")}),queryKey:()=>se({path:s,input:c,type:"query",prefix:t}),queryFilter:()=>T(T({},l),{},{queryKey:se({path:s,input:c,type:"query",prefix:t})}),infiniteQueryOptions:()=>Yo({input:c,opts:l,path:s,queryKey:se({path:s,input:c,type:"infinite",prefix:t}),query:n("query")}),infiniteQueryKey:()=>se({path:s,input:c,type:"infinite",prefix:t}),infiniteQueryFilter:()=>T(T({},l),{},{queryKey:se({path:s,input:c,type:"infinite",prefix:t})}),mutationOptions:()=>{var u;return Jo({opts:c,path:s,prefix:t,queryClient:e.queryClient,mutate:n("mutation"),overrides:(u=e.overrides)===null||u===void 0?void 0:u.mutations})},mutationKey:()=>pn({path:s,prefix:t}),subscriptionOptions:()=>Xo({opts:l,path:s,input:c,queryKey:se({path:s,input:c,type:"any",prefix:t}),subscribe:n("subscription")})}[a]()})}function ti(){const e=ce(null),t=ce(null),n=s=>{const a=Pe(()=>ei({client:s.trpcClient,queryClient:s.queryClient,keyPrefix:s.keyPrefix}),[s.trpcClient,s.queryClient,s.keyPrefix]);return W(e.Provider,{value:s.trpcClient},W(t.Provider,{value:a},s.children))};n.displayName="TRPCProvider";function r(){const s=le(t);if(!s)throw new Error("useTRPC() can only be used inside of a <TRPCProvider>");return s}function i(){const s=le(e);if(!s)throw new Error("useTRPCClient() can only be used inside of a <TRPCProvider>");return s}return{TRPCProvider:n,useTRPC:r,useTRPCClient:i}}const it={lan:new Set,animepahe:new Set,jasmr:new Set};function Ee(e){for(const t of[...it[e]])try{t()}catch(n){console.error(`auth-bus listener failed (${e}):`,n)}}function fn(e,t){return it[e].add(t),()=>{it[e].delete(t)}}const ni=e=>new Promise(t=>setTimeout(t,e)),yn=async(e,t)=>{const n={"Content-Type":"application/json"},r=typeof e=="string"?e:e.toString();if(r.startsWith("/")||typeof window<"u"&&r.startsWith(window.location.origin)){const a=localStorage.getItem("animepahe_ua"),c=localStorage.getItem("animepahe_cookie"),l=localStorage.getItem("jasmr_ua"),u=localStorage.getItem("jasmr_cookie");a&&(n["x-animepahe-ua"]=a),c&&(n["x-animepahe-cookie"]=c),l&&(n["x-jasmr-ua"]=l),u&&(n["x-jasmr-cookie"]=u)}let s=await fetch(e,{...t,headers:{...n,...t?.headers}});for(let a=0;s.status===503&&a<8;a++)await ni(Math.min(500*2**a,4e3)),s=await fetch(e,{...t,headers:{...n,...t?.headers}});return s},zc=async(e,t)=>{const n=await yn(e,t);if(!n.ok){const r=await n.text().catch(()=>"");let i={};try{i=JSON.parse(r)}catch{}const s=typeof i.error=="string"?i.error:"";throw n.status===403&&s==="AUTH_REQUIRED"&&i.provider==="animepahe"&&Ee("animepahe"),n.status===403&&s==="AUTH_REQUIRED"&&i.provider==="jasmr"&&Ee("jasmr"),n.status===401&&s==="LAN_AUTH_REQUIRED"&&Ee("lan"),new Error(s||`Failed to fetch from ${e}`)}return n.json()};async function ri(e,t){const n=await yn(e,t);if(n.status===401)try{(await n.clone().json())?.error==="LAN_AUTH_REQUIRED"&&Ee("lan")}catch{}return await oi(n),n}async function oi(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 i=r?.error;if(!i||typeof i!="object")continue;const s=i.data?.cause;(i.message==="AUTH_REQUIRED"||s?.code==="AUTH_REQUIRED")&&(s?.provider==="animepahe"||s?.provider==="jasmr")&&Ee(s.provider),(i.message==="LAN_AUTH_REQUIRED"||s?.code==="LAN_AUTH_REQUIRED")&&Ee("lan")}}catch{}}const{TRPCProvider:ii,useTRPC:N}=ti(),Z=jo({links:[Io({url:"/api/trpc",fetch:ri})]}),Te=new Map,si=500,ai=(e,t,n)=>{if(!e||e.trim()==="")return"/placeholder.svg";if(e.includes("/api/image-proxy")){let a=e;if(t&&!a.includes("w=")){const c=a.includes("?")?"&":"?";a+=`${c}w=${t}`}if(n&&!a.includes("h=")){const c=a.includes("?")?"&":"?";a+=`${c}h=${n}`}return a}let r=e;r.includes("aln.youtube-anime.com")&&(r=r.replace(/https?:\/\/allanime\.day\/aln\.youtube-anime\.com/,"https://aln.youtube-anime.com"),r.includes("/images/mcovers")&&(r=r.replace("/images/mcovers","/mcovers")),r.includes("/images/images2")&&(r=r.replace("/images/images2","/images2"))),r.includes("allanime.day/s4.anilist.co")&&(r=r.replace(/https?:\/\/allanime\.day\/s4\.anilist\.co/,"https://s4.anilist.co")),r.includes("wp.youtube-anime.com/s4.anilist.co")&&(r=r.replace(/https?:\/\/wp\.youtube-anime\.com\/s4\.anilist\.co/,"https://s4.anilist.co"));const i=`${r}-${t}-${n}`;if(Te.has(i))return Te.get(i);let s;if(r.startsWith("https://s4.anilist.co"))s=r,t&&(s+=`${s.includes("?")?"&":"?"}w=${t}`),n&&(s+=`${s.includes("?")?"&":"?"}h=${n}`);else if(r.includes("animepahe")){s=`/api/image-proxy?url=${encodeURIComponent(r)}`;const a=localStorage.getItem("animepahe_cookie"),c=localStorage.getItem("animepahe_ua");a&&(s+=`&cookie=${encodeURIComponent(a)}`),c&&(s+=`&ua=${encodeURIComponent(c)}`)}else if(r.startsWith("http"))s=`/api/image-proxy?url=${encodeURIComponent(r)}`,t&&(s+=`&w=${t}`),n?s+=`&h=${n}`:t||(s+="&w=300");else{const c=`${r.startsWith("mcovers")||r.startsWith("images2")?"https://aln.youtube-anime.com":"https://aln.youtube-anime.com/images"}/${r}`;s=`/api/image-proxy?url=${encodeURIComponent(c)}`,t&&(s+=`&w=${t}`),n?s+=`&h=${n}`:t||(s+="&w=300")}return Te.size>si&&Te.clear(),Te.set(i,s),s},Gc=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 Yc(e){return e?e.replace(/<[^>]*>?/gm,"").replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").trim():""}function Jc(e){return e==null?e:e>10?Number((e/10).toFixed(1)):e}const ci=(...e)=>e.filter(Boolean).join(" "),vn=ce(void 0),li=()=>{const e=le(vn);if(e===void 0)throw new Error("useTitlePreference must be used within a TitlePreferenceProvider");return e},Zc=()=>{const e=N();return z({...e.data.spotlight.queryOptions(),staleTime:1e3*60*5,retry:1})},Xc=(e="TRENDING_DESC",t=10)=>mt({queryKey:["trendingList",e,t],queryFn:({pageParam:n=1})=>Z.data.popularList.query({sort:e,page:n,size:t}),initialPageParam:1,getNextPageParam:(n,r)=>n.length>=t?r.length+1:void 0}),el=(e="TV",t=12)=>mt({queryKey:["latestReleases",e,t],queryFn:({pageParam:n=1})=>Z.data.latestReleases.query({format:e,page:n,size:t}),initialPageParam:1,getNextPageParam:(n,r)=>n.length>=t?r.length+1:void 0}),tl=(e,t="TV",n=!0)=>{const r=N();return z({...r.data.seasonal.queryOptions({page:e,format:t}),enabled:n,staleTime:1e3*60*5})},ui=["query","sortBy","type","status","season","year","country","genres","excludeGenres","excludeTags","minScore","minEpisodes","adult"],nl=(e,t,n=14)=>{const r=N(),i=new URLSearchParams(e),s={page:t,limit:n};for(const a of ui){const c=i.get(a);c!==null&&(s[a]=c)}return z({...r.data.search.queryOptions(s),enabled:e!=null})},rl=()=>{const e=N();return z(e.queue.list.queryOptions())},di=()=>{const e=N(),t=K();return X(e.queue.add.mutationOptions({onSuccess:n=>{n.queued?b.success("Added to queue"):b.success("Removed from queue"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:["queue-remaining"]})},onError:n=>{b.error(`Failed to update queue: ${n.message}`)}}))},ol=()=>{const e=N(),t=K();return X(e.queue.remove.mutationOptions({onSuccess:()=>{b.success("Removed from queue"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:["queue-remaining"]}),t.invalidateQueries({queryKey:["allContinueWatching"]})},onError:n=>{b.error(`Failed to remove: ${n.message}`)}}))},il=(e,t=!0)=>z({queryKey:["queue-remaining",e],queryFn:()=>Z.watchlist.queueRemaining.query({showId:e}),enabled:!!e&&t,staleTime:1e3*60}),sl=()=>{const e=N(),t=K();return X(e.queue.addBatch.mutationOptions({onSuccess:(n,r)=>{const i=n.added??r.episodeNumbers.length;b.success(`${i} ${i===1?"episode":"episodes"} added to queue`),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:["queue-remaining"]})},onError:n=>{b.error(`Failed to update queue: ${n.message}`)}}))},al=()=>{const e=N(),t=K();return X(e.queue.removeMany.mutationOptions({onSuccess:()=>{b.success("Removed from queue"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:["queue-remaining"]}),t.invalidateQueries({queryKey:["allContinueWatching"]})},onError:n=>{b.error(`Failed to remove: ${n.message}`)}}))},cl=()=>{const e=N(),t=K();return X(e.queue.clear.mutationOptions({onSuccess:()=>{b.success("Queue cleared"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:["queue-remaining"]}),t.invalidateQueries({queryKey:["allContinueWatching"]})},onError:n=>{b.error(`Failed to clear queue: ${n.message}`)}}))},ll=()=>{const e=N(),t=K(),n=e.queue.list.queryOptions().queryKey;return X(e.queue.reorder.mutationOptions({onMutate:async r=>{await t.cancelQueries({queryKey:n});const i=t.getQueryData(n);return t.setQueryData(n,s=>{if(!s)return s;const a=new Map(s.map(c=>[c.id,c]));return r.map((c,l)=>{const u=a.get(c.id??-1);return u?{...u,queue_order:l}:void 0}).filter(c=>!!c)}),{previousQueue:i}},onError:(r,i,s)=>{s?.previousQueue&&t.setQueryData(n,s.previousQueue)},onSettled:()=>{t.invalidateQueries(e.queue.pathFilter())}}))},mi=["status","showMature","query","type","season","year","genres","excludeGenres","sortBy","titlePreference"];function yt(e,t,n){const r=new URLSearchParams(e),i={page:t,limit:n};for(const s of mi){const a=r.get(s);a!==null&&(i[s]=a)}return i}const ul=(e,t="",n,r=14)=>z({queryKey:["watchlist",e,t,n,r],queryFn:async()=>{const i=new URLSearchParams(t);return i.set("status",e),await Z.watchlist.list.query(yt(i.toString(),n,r))}}),dl=(e="")=>mt({queryKey:["allContinueWatching",e],queryFn:async({pageParam:t=1})=>await Z.watchlist.continueWatchingAll.query(yt(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)})}),ml=(e="",t,n=14)=>z({queryKey:["allContinueWatching",e,t,n],queryFn:async()=>await Z.watchlist.continueWatchingAll.query(yt(e,t,n))}),hl=()=>{const e=N(),t=K();return X(e.watchlist.remove.mutationOptions({onSuccess:()=>{b.success("Removed from watchlist"),t.invalidateQueries(e.watchlist.pathFilter()),t.invalidateQueries({queryKey:["watchlist"]})},onError:n=>{b.error(`Failed to remove: ${n.message}`)}}))},pl=()=>{const e=N(),t=K();return X(e.watchlist.batchStatus.mutationOptions({onSuccess:n=>{b.success(`Status updated for ${n.updated??0} items`),t.invalidateQueries(e.watchlist.pathFilter()),t.invalidateQueries({queryKey:["watchlist"]}),t.invalidateQueries({queryKey:["allContinueWatching"]})},onError:n=>{b.error(`Failed to update statuses: ${n.message}`)}}))},fl=()=>{const e=N(),t=K();return X(e.watchlist.removeMany.mutationOptions({onSuccess:n=>{const r=n.removed??0;b.success(`Removed ${r} ${r===1?"item":"items"} from watchlist`),t.invalidateQueries(e.watchlist.pathFilter()),t.invalidateQueries({queryKey:["watchlist"]}),t.invalidateQueries({queryKey:["allContinueWatching"]})},onError:n=>{b.error(`Failed to remove: ${n.message}`)}}))},yl=()=>{const e=N(),t=K();return X(e.continueWatching.removeMany.mutationOptions({onSuccess:n=>{const r=n.removed??0;b.success(`Removed ${r} ${r===1?"item":"items"} from continue watching`),t.invalidateQueries(e.continueWatching.pathFilter()),t.invalidateQueries({queryKey:["allContinueWatching"]})},onError:n=>{b.error(`Failed to remove: ${n.message}`)}}))},gn=(e=!0)=>{const t=N();return z({...t.notifications.list.queryOptions(),enabled:e,refetchInterval:3e4})},bn=(e=!0)=>{const t=N();return z({...t.data.systemNotifications.queryOptions(),enabled:e,refetchInterval:3e4})},_n=(e=!0)=>{const t=N();return z({...t.discovery.status.queryOptions(),enabled:e,refetchInterval:n=>n.state.data?.running?2e3:!1})},hi=()=>{const e=N(),t=K(),n=e.discovery.status.queryOptions().queryKey;return X(e.discovery.refresh.mutationOptions({onSuccess:r=>{t.setQueryData(n,{running:r.running,state:r.state,total:r.total,done:r.done,lastRunAt:r.lastRunAt}),t.invalidateQueries(e.notifications.pathFilter()),t.invalidateQueries({queryKey:["notifications"]})},onError:()=>{t.invalidateQueries({queryKey:n})}}))},pi=()=>{const e=N(),t=K();return X(e.notifications.dismiss.mutationOptions({onSuccess:()=>{t.invalidateQueries(e.notifications.pathFilter())}}))},fi=()=>{const e=N(),t=K();return X(e.notifications.clearAll.mutationOptions({onSuccess:()=>{t.invalidateQueries(e.notifications.pathFilter())}}))},vl=()=>{const e=N();return z({...e.continueWatching.thisWeek.queryOptions(),staleTime:1e3*60*5})},gl=()=>{const e=N();return z({...e.data.genresAndTags.queryOptions(),staleTime:1e3*60*60})},bl=()=>z({queryKey:["genreCards"],queryFn:()=>Z.insights.genreCards.query()}),yi="_container_1c94k_1",vi="_bellBtn_1c94k_7",gi="_badge_1c94k_56",bi="_dropdown_1c94k_96",_i="_dropdownHeader_1c94k_127",wi="_clearAllBtn_1c94k_141",Ei="_discoveryStatusRow_1c94k_159",ki="_statusDot_1c94k_170",Si="_statusDotRunning_1c94k_177",Pi="_statusDotOk_1c94k_182",xi="_statusDotInfo_1c94k_186",Ti="_statusDotError_1c94k_190",Ii="_statusDotIdle_1c94k_194",Oi="_list_1c94k_208",Ci="_item_1c94k_222",Ni="_thumbnail_1c94k_237",Ai="_itemInfo_1c94k_246",qi="_itemTitle_1c94k_251",Li="_itemMeta_1c94k_262",Ri="_systemItemMeta_1c94k_272",$i="_removeItem_1c94k_289",Di="_queueItem_1c94k_319",ji="_emptyState_1c94k_323",v={container:yi,bellBtn:vi,badge:gi,dropdown:bi,dropdownHeader:_i,clearAllBtn:wi,discoveryStatusRow:Ei,statusDot:ki,statusDotRunning:Si,statusDotOk:Pi,statusDotInfo:xi,statusDotError:Ti,statusDotIdle:Ii,list:Oi,item:Ci,thumbnail:Ni,itemInfo:Ai,itemTitle:qi,itemMeta:Li,systemItemMeta:Ri,removeItem:$i,queueItem:Di,emptyState:ji},Mi=({notification:e})=>{const t=pi(),n=di(),[r,i]=ut.useState(!1),s=d=>{d.preventDefault(),d.stopPropagation(),t.mutate({showId:e.showId,episodeNumber:e.episodeNumber})},a=()=>{t.mutate({showId:e.showId,episodeNumber:e.episodeNumber})},c=d=>{d.preventDefault(),d.stopPropagation(),i(!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(()=>i(!1),1e3)},{titlePreference:l}=li(),u=l==="nativeName"?e.nativeName||e.name:l==="englishName"&&e.englishName||e.name;return o(J,{to:`/watch/${e.showId}/${e.episodeNumber}`,className:v.item,onClick:a,children:[o("img",{src:ai(e.thumbnail,48,64),alt:e.name,className:v.thumbnail,loading:"lazy",decoding:"async"}),o("div",{className:v.itemInfo,children:[o("span",{className:v.itemTitle,children:u}),o("span",{className:v.itemMeta,children:["New Episode ",e.episodeNumber]})]}),o("button",{className:`${v.removeItem} ${v.queueItem}`,onClick:c,"aria-label":"Add notification to queue",children:r?o(g,{name:"check"}):o(g,{name:"plus"})}),o("button",{className:v.removeItem,onClick:s,"aria-label":"Remove notification",children:o(g,{name:"times"})})]})};function Ye({width:e="100%",height:t="1em",variant:n="rectangular",className:r="",style:i}){return o("div",{className:`skeleton skeleton-${n} ${r}`,style:{width:e,height:t,...i}})}const Fi=({count:e=3})=>o(V,{children:Array.from({length:e}).map((t,n)=>o("div",{className:v.item,style:{borderBottom:"1px solid var(--border-primary)",pointerEvents:"none"},children:[o("div",{className:v.thumbnail,style:{overflow:"hidden"},children:o(Ye,{width:"100%",height:"100%",variant:"rectangular"})}),o("div",{className:v.itemInfo,children:[o(Ye,{width:"80%",height:"1rem",variant:"text",style:{marginBottom:"4px"}}),o(Ye,{width:"40%",height:"0.7rem",variant:"rectangular",style:{borderRadius:"var(--radius-sm)"}})]})]},n))}),Bi=()=>{const{data:e=[],isLoading:t}=gn(),{data:n=[]}=bn(),{data:r}=_n(),i=fi(),s=K(),[a,c]=S(null);w(()=>{s.invalidateQueries({queryKey:["notifications"]})},[s]);const l=()=>{i.mutate(void 0)},u=n.find(d=>d.id===a)??null;return o("div",{className:v.dropdown,children:[o("div",{className:v.dropdownHeader,children:[o("h4",{children:"Notifications"}),e.length>0&&o("button",{className:v.clearAllBtn,onClick:l,children:"Clear All"})]}),o("div",{className:v.discoveryStatusRow,children:r?.running?o(V,{children:[o("span",{className:`${v.statusDot} ${v.statusDotRunning}`,"aria-hidden":"true"}),o("span",{children:r.total>0?`Checking ${Math.min(r.done,r.total)}/${r.total} shows...`:"Checking for new episodes..."})]}):r?.state==="complete"?o(V,{children:[o("span",{className:`${v.statusDot} ${v.statusDotOk}`,"aria-hidden":"true"}),o("span",{children:["Discovery complete — checked ",r.total," ",r.total===1?"show":"shows"]})]}):r?.state==="empty"?o(V,{children:[o("span",{className:`${v.statusDot} ${v.statusDotInfo}`,"aria-hidden":"true"}),o("span",{children:"No shows set to Watching — nothing to check"})]}):r?.state==="error"?o(V,{children:[o("span",{className:`${v.statusDot} ${v.statusDotError}`,"aria-hidden":"true"}),o("span",{children:"Last check failed — will retry automatically"})]}):o(V,{children:[o("span",{className:`${v.statusDot} ${v.statusDotIdle}`,"aria-hidden":"true"}),o("span",{children:r?.lastRunAt?`Last checked ${Math.max(1,Math.round((Date.now()-r.lastRunAt)/1e3))}s ago`:"Auto-checks every few minutes"})]})}),o("div",{className:v.list,children:t&&n.length===0?o(Fi,{count:4}):o(V,{children:[n.map(d=>o("div",{className:v.item,children:[o("div",{className:v.thumbnail,style:{background:"transparent",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:0,boxShadow:"none"},children:o(g,{name:"info-circle",size:32,color:"#6c9fff"})}),o("div",{className:v.itemInfo,children:[o("span",{className:v.itemTitle,children:d.title}),o("button",{type:"button",className:v.systemItemMeta,onClick:()=>c(d.id),title:"View full status",children:d.message.length>40?d.message.slice(0,40)+"…":d.message})]}),o("button",{className:v.removeItem,disabled:!0,style:{opacity:.3,cursor:"not-allowed"},"aria-hidden":"true",children:o(g,{name:"plus"})}),o("button",{className:v.removeItem,disabled:!0,style:{opacity:.3,cursor:"not-allowed"},"aria-hidden":"true",children:o(g,{name:"times"})})]},d.id)),n.length>0&&e.length>0&&o("div",{className:v.notificationDivider}),e.length>0?e.map(d=>o(Mi,{notification:d},d.id)):!t&&n.length===0&&o("div",{className:v.emptyState,children:"No new notifications"})]})}),u&&Jt(o("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0, 0, 0, 0.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:9999,padding:"1rem",backdropFilter:"blur(3px)"},onClick:()=>c(null),children:o("div",{style:{backgroundColor:"var(--bg-secondary)",padding:"1.5rem",borderRadius:"var(--radius-lg)",maxWidth:"420px",width:"100%",boxShadow:"var(--shadow-xl)",border:"1px solid var(--border-primary)"},onClick:d=>d.stopPropagation(),children:[o("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem",marginBottom:"1rem"},children:[o(g,{name:"info-circle",color:"#6c9fff"}),o("span",{style:{color:"#fff",fontWeight:600,fontSize:"1rem"},children:u.title})]}),o("p",{style:{color:"var(--text-secondary)",marginBottom:"1.5rem",lineHeight:1.5},children:u.message}),o("div",{style:{display:"flex",justifyContent:"flex-end"},children:o("button",{type:"button",onClick:()=>c(null),style:{background:"var(--accent)",color:"#fff",border:"none",padding:"0.5rem 1rem",borderRadius:"var(--radius-md)",cursor:"pointer",fontWeight:600},children:"OK"})})]})}),document.body)]})},Wi=()=>{const[e,t]=S(!1),n=B(null),r=K(),i=N(),s=hi(),{data:a=[]}=gn(),{data:c=[]}=bn(),{data:l}=_n(),u=a.length+c.length,d=u>5?"5+":u,m=B(!1);w(()=>{const p=f=>{n.current&&!n.current.contains(f.target)&&t(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[]),w(()=>{const p=!!l?.running;m.current&&!p&&(r.invalidateQueries(i.notifications.pathFilter()),r.invalidateQueries(i.discovery.pathFilter())),m.current=p},[l?.running,r,i]);const h=()=>{const p=!e;t(p),p&&s.mutate()};return o("div",{className:v.container,ref:n,children:[o("button",{className:v.bellBtn,onClick:h,"aria-label":"Notifications",children:[o(g,{name:"bell"}),u>0&&o("span",{className:v.badge,children:d})]}),e&&o(Bi,{})]})},ze=e=>{const t=N();return z({...t.settings.getByKey.queryOptions({key:e}),select:n=>n.value})},wn=()=>{const e=N(),t=K();return X(e.settings.set.mutationOptions({onSuccess:()=>{b.success("Setting updated!"),t.invalidateQueries(e.settings.pathFilter()),t.invalidateQueries({queryKey:["settings"]})},onError:n=>{b.error(`Failed to update setting: ${n.message}`)}}))},En=ce(void 0),Qi=()=>{const e=le(En);if(e===void 0)throw new Error("useLowEndMode must be used within a LowEndModeProvider");return e},oe={x:-2.8,y:-2,w:48.6,h:14},st=15,Se={w:13.6,h:10.2},ae=[{x:0,y:.5},{x:st,y:-.9},{x:st*2,y:.3}],Nt={x:Se.w/2,y:Se.h/2-.5},Je={y:Se.h/2,x1:-2,x2:st*2+Se.w+1.4},At=(e,t,n,r=0)=>{if(n.width<=0)return-1;const i=n.width/oe.w,s=(e-n.left)/i+oe.x,a=(t-n.top)/i+oe.y;for(let c=0;c<ae.length;c++){const l=s-ae[c].x,u=a-ae[c].y;if(l>=-r&&l<=Se.w+r&&u>=-r&&u<=Se.h+r)return c}return-1},qt=7.5,Lt=e=>Math.max(-1,Math.min(1,e)),Ki=(e,t,n,r)=>{const i=n.width/oe.w,s=(e-n.left)/i+oe.x-r.x-Nt.x,a=(t-n.top)/i+oe.y-r.y-Nt.y;return{x:Lt(s/qt),y:Lt(a/qt)}},Ui=["normal","squint"],Hi={normal:.72,squint:.28},Rt=(e=Math.random(),t)=>{let n=0;for(const r of Ui)if(n+=Hi[r],e<n)return r===t?r==="normal"?"squint":"normal":r;return"normal"},Vi="pet",zi="sleep",Gi=6e3,Yi=420,Ji=.5,$t=3e3,Zi=3e3,Xi=ae.map((e,t)=>t*260),Ze={from:ae.length-2,to:ae.length-1,after:400},Dt="data-dango-face",Xe="data-dango-hover",et="data-dango-cheer",jt="data-dango-nudge",es=()=>document.querySelectorAll("svg[data-dango-gaze-origin]"),De=()=>document.querySelectorAll("[data-dango-face-slot]"),ts=e=>e.querySelectorAll("[data-dango-eye]"),ns=()=>document.querySelectorAll("[data-dango-eye]"),kn=()=>{const{data:e}=ze("dangoGaze"),{lowEndMode:t}=Qi();return e!=="false"&&!t},rs=()=>{const e=kn();w(()=>{if(!e||window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;const t=ae.map(()=>"normal");let n=-1,r=-1,i=!1,s=-1,a=0,c=0,l=0,u=0,d=0;const m=[],h=(y,C)=>{const _=window.setTimeout(()=>{m.splice(m.indexOf(_),1),y()},C);m.push(_)},p=(y,C,_)=>{De().forEach($=>{Number($.getAttribute("data-dango-face-slot"))===y&&(_?$.setAttribute(C,""):$.removeAttribute(C))})},f=y=>De().forEach(C=>C.removeAttribute(y)),I=(y,C,_)=>{f(C),requestAnimationFrame(()=>{p(y,C,!0),h(()=>f(C),_)})},P=()=>{De().forEach(y=>{const C=Number(y.getAttribute("data-dango-face-slot"));y.setAttribute(Dt,r===C?Vi:t[C]),n===C?y.setAttribute(Xe,""):y.removeAttribute(Xe)})},R=y=>{y!==r&&(r>=0&&p(r,et,!1),r=y,y>=0&&p(y,et,!0))},O=()=>{window.clearTimeout(d),d=window.setTimeout(()=>{R(-1),P()},Yi)},E=()=>{window.clearTimeout(d),R(-1)},D=()=>{i=!1,Xi.forEach((y,C)=>{h(()=>{t[C]=Rt(),C===Ze.from&&h(()=>I(Ze.to,jt,520),Ze.after),P()},y)})},de=()=>{i=!0,t.fill(zi),E(),P()},G=()=>{window.clearTimeout(u),u=window.setTimeout(de,Gi)},be=()=>{i||(s=(s+1)%t.length,t[s]=Rt(Math.random(),t[s]),P()),h(be,$t+Math.random()*Zi)},ee=()=>{const y=Array.from(es(),Y=>[Y,Y.getBoundingClientRect()]);y.forEach(([Y,Le])=>{ts(Y).forEach(we=>{const{x:te,y:ve}=Ki(c,l,Le,ae[Number(we.getAttribute("data-dango-eye"))]);we.style.setProperty("--dango-gaze-x",te.toFixed(3)),we.style.setProperty("--dango-gaze-y",ve.toFixed(3))})});const C=y.find(([,Y])=>c>=Y.left&&c<=Y.right&&l>=Y.top&&l<=Y.bottom)?.[1]??null,_=n,$=r,ie=C?At(c,l,C):-1,xe=ie>=0?ie:C?At(c,l,C,Ji):-1;n=ie,xe>=0?(R(xe),O()):E(),(_!==n||$!==r)&&P(),i&&D(),G()},_e=y=>{c=y.clientX,l=y.clientY,!a&&(a=requestAnimationFrame(()=>{a=0,ee()}))},ye=y=>{y.relatedTarget||(n=-1,E(),P(),G())};return P(),G(),h(be,$t),window.addEventListener("pointermove",_e,{passive:!0}),window.addEventListener("pointerout",ye),()=>{cancelAnimationFrame(a),window.clearTimeout(u),window.clearTimeout(d),m.forEach(window.clearTimeout),window.removeEventListener("pointermove",_e),window.removeEventListener("pointerout",ye),ns().forEach(y=>{y.style.removeProperty("--dango-gaze-x"),y.style.removeProperty("--dango-gaze-y")}),De().forEach(y=>{y.setAttribute(Dt,"normal"),y.removeAttribute(Xe),y.removeAttribute(et),y.removeAttribute(jt)})}},[e])},Sn=ce(void 0),_l=()=>{const e=le(Sn);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e},wl=[{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"}],os={iris:{fill:"#897cff",stroke:"#5646db"},mochi:{fill:"#e3e1ee",stroke:"#b3b1c6"},sakura:{fill:"#e1afef",stroke:"#a978a9"}},is="_logo_t3il2_1",ss="_skewer_t3il2_8",as="_gaze_t3il2_15",cs="_face_t3il2_20",ls="_faceNormal_t3il2_25",us="_facePet_t3il2_26",ds="_faceSquint_t3il2_27",ms="_faceSleep_t3il2_28",hs="_line_t3il2_36",ps="_sway_t3il2_44",fs="_weight_t3il2_58",ys="_shift_t3il2_73",vs="_rock_t3il2_87",gs="_glance_t3il2_105",bs="_blinkDouble_t3il2_129 _blink_t3il2_124",_s="_blinkSlow_t3il2_153 _blink_t3il2_124",ws="_bump_t3il2_172",Es="_heart_t3il2_189",j={logo:is,skewer:ss,gaze:as,face:cs,faceNormal:ls,facePet:us,faceSquint:ds,faceSleep:ms,line:hs,sway:ps,weight:fs,shift:ys,rock:vs,glance:gs,blinkDouble:bs,blinkSlow:_s,bump:ws,heart:Es},Mt="#140f15",ks="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",Ss="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",Ps="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",xs={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"},Pn=[{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}],Ie=(e,t)=>e+Math.random()*(t-e),Ts=Pn.map(()=>({blinkDelay:-Ie(0,9),blinkDuration:Ie(3.4,8.6),motionDelay:-Ie(0,9),motionDuration:Ie(5.5,11),glanceDelay:-Ie(0,11)})),Is={double:j.blinkDouble,slow:j.blinkSlow},Os={weight:j.weight,shift:j.shift,rock:j.rock},Cs={normal:j.faceNormal,pet:j.facePet,squint:j.faceSquint,sleep:j.faceSleep},Ns=["normal","pet","squint","sleep"],As=[{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"}],vt=({className:e})=>{const t=kn();return o("svg",{viewBox:`${oe.x} ${oe.y} ${oe.w} ${oe.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 ${Je.x1},${Je.y} H ${Je.x2}`}),Pn.map((n,r)=>{const{x:i,y:s}=ae[r],a=Ts[r],{fill:c,stroke:l}=os[n.hue],u=o("g",{"data-dango-eye":r,className:j.gaze,style:{"--gaze-dur":`${(.12+n.lag*.18).toFixed(3)}s`},children:Ns.map(d=>o("g",{className:`${j.face} ${Cs[d]}`,children:o("g",{className:t&&d==="normal"?Is[n.blink]:void 0,style:t&&d==="normal"?{animationDelay:`${a.blinkDelay}s`,animationDuration:`${a.blinkDuration}s`}:void 0,children:d==="normal"?o(V,{children:[o("path",{fill:Mt,d:Ss}),o("path",{fill:Mt,d:Ps})]}):o("path",{className:j.line,d:xs[d]})})},d))});return o("g",{transform:`translate(${i} ${s})`,children:o("g",{"data-dango-face-slot":r,"data-dango-face":"normal",className:t?Os[n.motion]:void 0,style:t?{animationDelay:`${a.motionDelay}s`,animationDuration:`${a.motionDuration}s`}:void 0,children:[o("path",{fill:c,stroke:l,strokeWidth:"0.9",strokeLinejoin:"round",paintOrder:"stroke fill",d:ks}),o("g",{className:j.bump,children:[t&&n.glances?o("g",{className:j.glance,style:{animationDelay:`${a.glanceDelay}s`},children:u}):u,t&&o("g",{children:As.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)})]})})},xn=ce(void 0),gt=()=>{const e=le(xn);if(e===void 0)throw new Error("useSidebar must be used within a SidebarProvider");return e},Tn=ce(void 0),In=()=>{const e=le(Tn);if(e===void 0)throw new Error("useContentType must be used within a ContentTypeProvider");return e},at="virtual-keyboard:hide",Ft="virtual-keyboard:enabled-change",On="virtual_keyboard_enabled",qs=!1;function Bt(){const e=localStorage.getItem(On);return e===null?qs:e==="true"}const Wt=e=>e instanceof HTMLInputElement&&e.type==="text"&&!e.disabled&&!e.readOnly;function Ls(){window.dispatchEvent(new CustomEvent(at))}function Rs(){const[e,t]=S(!1),[n,r]=S(Bt),i=B(null);return w(()=>{const s=d=>{n&&Wt(d.target)&&(i.current=d.target,t(!0))},a=d=>{d.target===i.current&&window.setTimeout(()=>{if(Wt(document.activeElement)){i.current=document.activeElement,t(!0);return}i.current=null,t(!1)},0)},c=()=>{i.current=null,t(!1)},l=d=>{if(d.key!==On)return;const m=d.newValue==="true";r(m),m||c()},u=()=>{const d=Bt();r(d),d||c()};return document.addEventListener("focusin",s),document.addEventListener("focusout",a),window.addEventListener(at,c),window.addEventListener("storage",l),window.addEventListener(Ft,u),()=>{document.removeEventListener("focusin",s),document.removeEventListener("focusout",a),window.removeEventListener(at,c),window.removeEventListener("storage",l),window.removeEventListener(Ft,u)}},[n]),{activeInputRef:i,isVisible:n&&e,hide:()=>t(!1)}}const $s="_header_q6huj_1",Ds="_hidden_q6huj_21",js="_scrolled_q6huj_25",Ms="_logo_q6huj_31",Fs="_headerInner_q6huj_44",Bs="_leftSection_q6huj_54",Ws="_desktopNav_q6huj_60",Qs="_navLink_q6huj_67",Ks="_navLinkActive_q6huj_83",Us="_rightSection_q6huj_102",Hs="_searchWrapper_q6huj_108",Vs="_searchInput_q6huj_114",zs="_searchButton_q6huj_144",Gs="_searchIcon_q6huj_168",Ys="_profileBtn_q6huj_178",Js="_profileImg_q6huj_211",Zs="_hamburgerBtn_q6huj_217",Xs="_mobileSearchBar_q6huj_244",ea="_mobileSearchBarHidden_q6huj_271",ta="_mobileSearchInner_q6huj_288",na="_mobileSearchIcon_q6huj_304",ra="_mobileSearchInput_q6huj_311",k={header:$s,hidden:Ds,scrolled:js,logo:Ms,headerInner:Fs,leftSection:Bs,desktopNav:Ws,navLink:Qs,navLinkActive:Ks,rightSection:Us,searchWrapper:Hs,searchInput:Vs,searchButton:zs,searchIcon:Gs,profileBtn:Ys,profileImg:Js,hamburgerBtn:Zs,mobileSearchBar:Xs,mobileSearchBarHidden:ea,mobileSearchInner:ta,mobileSearchIcon:na,mobileSearchInput:ra},oa=async()=>{let e;try{e=await Z.auth.syncSettings.query()}catch{return null}const t=e.actualActiveProvider;if(t==="github")try{const n=await Z.auth.githubStatus.query();if(n.authenticated&&n.user)return{name:n.user.name||n.user.login,picture:n.user.avatarUrl,provider:"github"}}catch{}if(t==="google")try{const n=await Z.auth.user.query();if(n)return{name:n.name,picture:n.picture,email:n.email,provider:"google"}}catch{}return null},ia=()=>{const{toggleSidebar:e}=gt(),{contentType:t}=In(),[n,r]=S(""),[i,s]=S(!0),[a,c]=S(!1),[l,u]=S(!0),[d,m]=S(!1),h=Fn(),p=dt(),f=B(null),I=B(!1),P=B(null),R=B(null),O=B(null),E=B(null),D=B(!1),{data:de}=z({queryKey:["sync-profile"],queryFn:oa,staleTime:3e4});w(()=>{const _=window.visualViewport;if(!_)return;const $=()=>{E.current?.style.setProperty("--vv-top",`${_.offsetTop}px`)};return $(),_.addEventListener("scroll",$),_.addEventListener("resize",$),()=>{_.removeEventListener("scroll",$),_.removeEventListener("resize",$)}},[]),w(()=>{const _=()=>{f.current&&(window.clearTimeout(f.current),f.current=null)},$=()=>{_(),!(window.scrollY<=10)&&(f.current=window.setTimeout(()=>{D.current||s(!1)},2500))},ie=()=>{I.current||(I.current=!0,P.current=requestAnimationFrame(()=>{I.current=!1,P.current=null;const te=window.scrollY<=10;u(ve=>ve===te?ve:te),s(ve=>ve||!0),$()}))},xe=te=>{(te.metaKey||te.ctrlKey)&&te.key==="k"?(te.preventDefault(),G.current?.focus({preventScroll:!0})):te.key==="Escape"&&document.activeElement===G.current&&G.current?.blur()},Y=E.current,Le=()=>{D.current=!0},we=()=>{D.current=!1,$()};return window.addEventListener("scroll",ie,{passive:!0}),window.addEventListener("keydown",xe),Y?.addEventListener("pointerenter",Le),Y?.addEventListener("pointerleave",we),()=>{window.removeEventListener("scroll",ie),window.removeEventListener("keydown",xe),Y?.removeEventListener("pointerenter",Le),Y?.removeEventListener("pointerleave",we),_(),P.current!==null&&(cancelAnimationFrame(P.current),P.current=null),I.current=!1}},[a]);const G=ut.useRef(null),be=()=>window.innerWidth<=1024,ee=()=>{be()?(m(!0),setTimeout(()=>O.current?.focus({preventScroll:!0}),50)):document.activeElement===G.current&&n.trim()?C():G.current?.focus({preventScroll:!0})},_e=_=>{R.current?.contains(_.relatedTarget)||m(!1)},ye=p.pathname==="/music"?"Search music...":t==="manga"?"Search manga...":t==="tv"?"Search TV & movies...":t==="asmr"?"Search ASMR...":"Search anime...",y=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"},C=_=>{Ls();const $=n.trim();if($){if(p.pathname==="/music"){const ie=new URLSearchParams(p.search);ie.set("q",$),h(`/music?${ie.toString()}`);return}h(t==="manga"?`/manga?q=${encodeURIComponent($)}`:t==="tv"?`/tv-search?q=${encodeURIComponent($)}`:t==="asmr"?`/asmr?q=${encodeURIComponent($)}`:`/search?query=${encodeURIComponent($)}`)}};return o(V,{children:o("header",{ref:E,className:`${k.header} ${i?"":k.hidden} ${l?"":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(g,{name:"bars"})}),o(J,{to:"/",className:k.logo,"aria-label":"Ani-Web Home",children:o(vt,{})}),o("nav",{className:k.desktopNav,children:[o(J,{to:"/",className:`${k.navLink} ${p.pathname==="/"?k.navLinkActive:""}`,children:"Home"}),o(J,{to:y.to,className:`${k.navLink} ${p.pathname.startsWith(y.to)?k.navLinkActive:""}`,children:y.label}),t==="anime"&&o(J,{to:"/insights",className:`${k.navLink} ${p.pathname==="/insights"?k.navLinkActive:""}`,children:"Insights"}),o(J,{to:"/settings",className:`${k.navLink} ${p.pathname.startsWith("/settings")?k.navLinkActive:""}`,children:"Settings"})]})]}),o("div",{className:k.rightSection,children:[o("div",{className:k.searchWrapper,children:[o("input",{ref:G,type:"text","data-virtual-keyboard":"true",className:k.searchInput,placeholder:ye,value:n,onChange:_=>r(_.target.value),onFocus:()=>c(!0),onBlur:()=>c(!1),onKeyDown:_=>{_.key==="Enter"&&C()}}),o("button",{type:"button",className:k.searchButton,"aria-label":"Search",onMouseDown:_=>_.preventDefault(),onClick:ee,children:o(g,{name:"search",className:k.searchIcon})})]}),o(Wi,{}),o(J,{to:"/settings?tab=sync",className:k.profileBtn,"aria-label":"Sync settings",children:de?.picture?o("img",{src:de.picture,alt:de.name,className:k.profileImg,referrerPolicy:"no-referrer",decoding:"async"}):de?.provider==="github"?o(g,{name:"github"}):o(g,{name:"cloud"})})]})]}),d&&o("div",{className:`${k.mobileSearchBar} ${i?"":k.mobileSearchBarHidden}`,ref:R,onBlur:_e,children:o("div",{className:k.mobileSearchInner,children:[o(g,{name:"search",className:k.mobileSearchIcon}),o("input",{ref:O,type:"text","data-virtual-keyboard":"true",className:k.mobileSearchInput,placeholder:ye,value:n,onChange:_=>r(_.target.value),onKeyDown:_=>{_.key==="Enter"?(C(),m(!1)):_.key==="Escape"&&m(!1)}})]})})]})})},ct="agreedToViewMature";function Qt(){try{return localStorage.getItem(ct)==="true"}catch{return!1}}function sa(){const[e,t]=S(Qt);w(()=>{const i=()=>t(Qt());return window.addEventListener("storage",i),window.addEventListener("focus",i),()=>{window.removeEventListener("storage",i),window.removeEventListener("focus",i)}},[]);const n=Q(()=>{try{localStorage.setItem(ct,"true")}catch{}t(!0)},[]),r=Q(()=>{try{localStorage.removeItem(ct)}catch{}t(!1)},[]);return{hasConsent:e,grant:n,revoke:r}}const aa="_sidebar_153jc_1",ca="_open_153jc_20",la="_sidebarHeader_153jc_25",ua="_closeBtn_153jc_33",da="_logo_153jc_57",ma="_navSection_153jc_69",ha="_navLink_153jc_75",pa="_active_153jc_108",fa="_overlay_153jc_118",ya="_versionInfo_153jc_138",ne={sidebar:aa,open:ca,sidebarHeader:la,closeBtn:ua,logo:da,navSection:ma,navLink:ha,active:pa,overlay:fa,versionInfo:ya},va="3.6.3",Cn={version:va},ga=()=>{const{isOpen:e,setIsOpen:t}=gt(),{contentType:n}=In(),{hasConsent:r}=sa(),i=()=>{t(!1)},s=n==="manga",a=n==="tv",c=n==="asmr",l=[{to:"/",icon:o(g,{name:"home"}),label:"Home"},s?{to:"/manga",icon:o(g,{name:"book"}),label:"Manga"}:a?{to:"/tv-search",icon:o(g,{name:"tv"}),label:"TV and Movies"}:c?{to:"/asmr",icon:o(g,{name:"headphones"}),label:"ASMR"}:{to:"/search",icon:o(g,{name:"search"}),label:"Search"},s?{to:"/reading-list",icon:o(g,{name:"bookmark"}),label:"Reading List"}:a?{to:"/tv-watchlist",icon:o(g,{name:"clock"}),label:"TV Watchlist"}:c?{to:"/listening-list",icon:o(g,{name:"history"}),label:"Listening List"}:{to:"/watchlist",icon:o(g,{name:"clock"}),label:"Watchlist"},...n==="anime"?[{to:"/insights",icon:o(g,{name:"chart-pie"}),label:"Insights"}]:[],{to:"/trackers",icon:o(g,{name:"sync-alt"}),label:"Trackers"},{to:"/radio",icon:o(g,{name:"broadcast-tower"}),label:"Radio"},{to:"/music",icon:o(g,{name:"headphones"}),label:"Music"},...r?[{to:"/mature",icon:o(g,{name:"pepper-hot"}),label:"Mature"}]:[],{to:"/settings",icon:o(g,{name:"cog"}),label:"Settings"}];return o(V,{children:[o("aside",{className:`${ne.sidebar} ${e?ne.open:""} sidebar`,children:[o("div",{className:ne.sidebarHeader,children:[o("button",{className:ne.closeBtn,onClick:()=>t(!1),"aria-label":"Close menu",children:"×"}),o(J,{to:"/",className:ne.logo,onClick:i,children:o(vt,{})})]}),o("nav",{className:ne.navSection,children:l.map(u=>o(Bn,{to:u.to,className:({isActive:d})=>`${ne.navLink} ${d?ne.active:""}`,onClick:i,end:u.to==="/",children:[u.icon,o("span",{children:u.label})]},u.to))}),o("div",{className:ne.versionInfo,children:["v",Cn.version]})]}),e&&o("div",{className:ne.overlay,onClick:()=>t(!1),"aria-label":"Close sidebar"})]})},ba="_footer_1c905_1",_a="_footerInner_1c905_15",wa="_brandSection_1c905_27",Ea="_logoRow_1c905_39",ka="_logoText_1c905_45",Sa="_brandMeta_1c905_51",Pa="_brandTagline_1c905_60",xa="_statusPill_1c905_67",Ta="_statusDot_1c905_80",Ia="_linksGrid_1c905_88",Oa="_linkColumn_1c905_96",Ca="_columnTitle_1c905_102",Na="_bottomBar_1c905_126",Aa="_copyright_1c905_136",qa="_brand_1c905_27",La="_heartIcon_1c905_152",Ra="_backToTop_1c905_157",A={footer:ba,footerInner:_a,brandSection:wa,logoRow:Ea,logoText:ka,brandMeta:Sa,brandTagline:Pa,statusPill:xa,statusDot:Ta,linksGrid:Ia,linkColumn:Oa,columnTitle:Ca,bottomBar:Na,copyright:Aa,brand:qa,heartIcon:La,backToTop:Ra},$a=()=>{const e=new Date().getFullYear(),t=()=>{window.scrollTo({top:0,behavior:"smooth"})};return o("footer",{className:A.footer,children:[o("div",{className:A.footerInner,children:[o("div",{className:A.brandSection,children:[o("div",{className:A.logoRow,children:o(vt,{className:A.logoText})}),o("div",{className:A.brandMeta,children:[o("div",{className:A.statusPill,children:[o("span",{className:A.statusDot}),o("span",{children:["v",Cn.version]})]}),o("p",{className:A.brandTagline,children:"Fast, local anime streaming."})]})]}),o("div",{className:A.linksGrid,children:[o("div",{className:A.linkColumn,children:[o("h4",{className:A.columnTitle,children:"Navigation"}),o(J,{to:"/",children:"Home"}),o(J,{to:"/watchlist",children:"Watchlist"}),o(J,{to:"/settings",children:"Settings"})]}),o("div",{className:A.linkColumn,children:[o("h4",{className:A.columnTitle,children:"Features"}),o(J,{to:"/search",children:"Search Anime"}),o(J,{to:"/trackers",children:"Trackers"}),o(J,{to:"/insights",children:"Insights"})]}),o("div",{className:A.linkColumn,children:[o("h4",{className:A.columnTitle,children:"Community"}),o("a",{href:"https://discord.gg/6yT3VwTqz9",target:"_blank",rel:"noopener noreferrer",children:[o(g,{name:"discord",style:{marginRight:"6px"}})," Discord"]}),o("a",{href:"https://github.com/serifpersia/dango",target:"_blank",rel:"noopener noreferrer",children:[o(g,{name:"github",style:{marginRight:"6px"}})," GitHub"]})]}),o("div",{className:A.linkColumn,children:[o("h4",{className:A.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:A.bottomBar,children:[o("p",{className:A.copyright,children:["© ",e," ",o("span",{className:A.brand,children:"dango"})," • Crafted with"," ",o(g,{name:"heart",className:A.heartIcon})," by"," ",o("a",{href:"https://github.com/serifpersia",target:"_blank",rel:"noopener noreferrer",children:"serifpersia"})]}),o("button",{className:A.backToTop,onClick:t,"aria-label":"Back to top",children:[o(g,{name:"chevron-up",size:14}),o("span",{children:"Top"})]})]})]})};function Nn(e){return JSON.stringify({0:e??{}})}function An(e){return`/api/trpc/${e}?batch=1`}function lt(e,t){const n=Nn(t),r=An(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 El(e,t){await fetch(An(e),{method:"POST",headers:{"Content-Type":"application/json"},body:Nn(t),keepalive:!0})}function kl(e){e&&(lt("discord.clear",{sessionId:e}),lt("discord.heartbeat",{sessionId:e,bye:!0}))}function Da(){const e=dt(),{data:t}=ze("discordRPCEnabled"),n=B("");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,i=()=>Z.discord.heartbeat.mutate({sessionId:r}).catch(()=>{});i();const s=setInterval(i,15e3),a=()=>{lt("discord.heartbeat",{sessionId:r,bye:!0})};return window.addEventListener("pagehide",a),()=>{clearInterval(s),window.removeEventListener("pagehide",a)}},[t]),w(()=>{if(t===!1||t==="false")return;const r=e.pathname;if(r.startsWith("/watch/")||r.startsWith("/player/"))return;let i="home";r.startsWith("/search")||r.startsWith("/mature")?i="search":r.startsWith("/watchlist")?i="watchlist":r.startsWith("/anime/")?i="anime":r.startsWith("/insights")?i="insights":r.startsWith("/settings")?i="settings":r.startsWith("/trackers")?i="trackers":r.startsWith("/asmr")?i="asmr":r.startsWith("/manga")?i="manga":r.startsWith("/radio")?i="radio":r.startsWith("/music")?i="music":r.startsWith("/tv")&&(i="tv"),Z.discord.pageStatus.mutate({page:i}).catch(()=>{})},[e.pathname,t])}function qn(e,t){const[n,r]=S(()=>{try{const s=localStorage.getItem(e);if(s===null)return t;if(typeof t=="string")return s;try{return JSON.parse(s)}catch{return s}}catch{return t}});w(()=>{const s=a=>{if(a.key===e)try{if(a.newValue===null){r(t);return}if(typeof t=="string"){r(a.newValue);return}try{r(JSON.parse(a.newValue))}catch{r(a.newValue)}}catch{}};return window.addEventListener("storage",s),()=>window.removeEventListener("storage",s)},[e,t]);const i=Q(s=>{r(a=>{const c=typeof s=="function"?s(a):s;try{typeof c=="string"?localStorage.setItem(e,c):localStorage.setItem(e,JSON.stringify(c))}catch{}return c})},[e]);return[n,i]}const Ln=ce(void 0),ja=()=>{const e=le(Ln);if(!e)throw new Error("useAnimePaheCookie must be used within an AnimePaheCookieProvider");return e},Ma="_overlay_1juub_1",Fa="_fadeIn_1juub_1",Ba="_content_1juub_11",Wa="_modalIn_1juub_1",Qa="_sm_1juub_29",Ka="_md_1juub_33",Ua="_lg_1juub_37",Ha="_title_1juub_41",Va="_body_1juub_48",za="_footer_1juub_52",ke={overlay:Ma,fadeIn:Fa,content:Ba,modalIn:Wa,sm:Qa,md:Ka,lg:Ua,title:Ha,body:Va,footer:za};function Rn({children:e}){return o("h2",{className:ke.title,children:e})}function $n({children:e}){return o("div",{className:ke.body,children:e})}function Dn({children:e}){return o("div",{className:ke.footer,children:e})}function qe({isOpen:e,onClose:t,title:n,children:r,footer:i,width:s="md"}){const a=B(null);return w(()=>{if(!e)return;const c=u=>{u.key==="Escape"&&t?.()};document.addEventListener("keydown",c);const l=document.body.style.overflow;return document.body.style.overflow="hidden",a.current?.focus(),()=>{document.removeEventListener("keydown",c),document.body.style.overflow=l}},[e,t]),e?Jt(o("div",{role:"presentation",onMouseDown:c=>c.stopPropagation(),children:[o("div",{className:ke.overlay,onClick:()=>t?.(),"aria-hidden":"true"}),o("div",{ref:a,className:`${ke.content} ${ke[s]}`,role:"dialog","aria-modal":"true","aria-label":n,tabIndex:-1,children:[n&&o(Rn,{children:n}),o($n,{children:r}),i&&o(Dn,{children:i})]})]}),document.body):null}qe.Header=Rn;qe.Body=$n;qe.Actions=Dn;const Ga="_container_e96gf_1",Ya="_field_e96gf_9",Ja="_textarea_e96gf_20",Za="_input_e96gf_40",Xa="_button_e96gf_58",ec="_secondaryButton_e96gf_78",tc="_actions_e96gf_95",nc="_hint_e96gf_104",rc="_link_e96gf_117",U={container:Ga,field:Ya,textarea:Ja,input:Za,button:Xa,secondaryButton:ec,actions:tc,hint:nc,link:rc},oc="https://github.com/serifpersia/dango/releases/latest/download/dango-extension.zip",ic=e=>{try{return JSON.parse(e.detail)}catch{return null}},sc=({isOpen:e,onClose:t,onSuccess:n})=>{const[r,i]=S(1),[s,a]=S(navigator.userAgent),[c,l]=S(""),[u,d]=S(!1),m=B(null),h=navigator.userAgent,p=/android/i.test(h),f=/firefox|fxios/i.test(h)&&!p,I=!f&&!p&&/chrome|chromium|edg|brave/i.test(h),P=f||I;w(()=>{e&&(i(1),a(navigator.userAgent),l(""),d(!1))},[e]),w(()=>()=>{m.current&&(window.removeEventListener("dango:pahe-cookie",m.current),m.current=null)},[]);const R=()=>{localStorage.setItem("animepahe_ua",s),window.open("https://animepahe.pw","_blank","noopener,noreferrer"),i(2)},O=()=>{if(u)return;d(!0);const D=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,de=window.setTimeout(()=>{d(!1),m.current&&(window.removeEventListener("dango:pahe-cookie",m.current),m.current=null),b.error("Helper not detected — install it via about:debugging first.")},3e3),G=be=>{const ee=ic(be);if(!(!ee||ee.requestId!==D))if(window.clearTimeout(de),window.removeEventListener("dango:pahe-cookie",G),m.current=null,d(!1),ee?.ok&&ee.cookie)l(ee.cookie),b.success("Cookie extracted from helper!");else if(ee?.error==="NO_COOKIE"){const _e=ee.debug?.stores?.length??0,ye=ee.debug?.names??[];b.error(`Helper found no cf_clearance (checked ${_e} stores, saw: ${ye.join(", ")||"none"}) — solve the challenge on the AnimePahe tab first.`)}else b.error("Helper request failed — try again.")};m.current=G,window.addEventListener("dango:pahe-cookie",G),window.dispatchEvent(new CustomEvent("dango:get-pahe-cookie",{detail:{requestId:D}}))},E=()=>{const D=c.trim();if(!D){b.error("Please enter the cf_clearance cookie");return}try{localStorage.setItem("animepahe_cookie",D),b.success("Cookie updated successfully! Reloading…"),n?.(),t(),window.setTimeout(()=>window.location.reload(),1e3)}catch{b.error("Failed to save cookie")}};return o(qe,{isOpen:e,onClose:t,title:"AnimePahe Verification Required",children:o("div",{className:U.container,children:r===1?o(V,{children:[o("p",{children:"AnimePahe requires a manual verification to bypass Cloudflare/DDoS-Guard protection."}),o("div",{className:U.field,children:[o("label",{children:"Your User-Agent (will be used for requests):"}),o("textarea",{value:s,readOnly:!0,rows:3,className:U.textarea})]}),o("div",{className:U.actions,children:[o("button",{className:U.secondaryButton,onClick:t,children:"Cancel"}),o("button",{className:U.button,onClick:R,children:"Start Verification (Opens AnimePahe)"})]})]}):o(V,{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."]}),P&&o("div",{className:U.hint,children:[o("strong",{children:"Dango helper (one-time setup):"})," ",f?o(V,{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(V,{children:["type ",o("code",{children:"chrome://extensions"})," in the address bar → enable"," ",o("strong",{children:"Developer mode"})," → ",o("strong",{children:"Load unpacked"})," → open the ",o("code",{children:"dango-extension/chrome"})," folder. (Unpacked helpers show a developer-mode notice — expected.)"]})," ","Use this link to download the extension and extract it:"," ",o("a",{href:oc,target:"_blank",rel:"noreferrer",className:U.link,children:"dango-extension.zip"}),". Then click Extract below and the field fills itself.",o("div",{className:U.actions,children:o("button",{className:U.button,onClick:O,disabled:u,type:"button",children:u?"Extracting…":"Extract cookie from helper"})})]}),o("div",{className:U.field,children:[o("label",{children:"cf_clearance cookie value:"}),o("input",{type:"text",value:c,onChange:D=>l(D.target.value),placeholder:"e.g. xxxxxxxx.xxxxxxxx.xxxxxxx-xxxxxxx",className:U.input})]}),o("div",{className:U.actions,children:[o("button",{className:U.secondaryButton,onClick:t,children:"Cancel"}),o("button",{className:U.secondaryButton,onClick:()=>i(1),children:"Back"}),o("button",{className:U.button,onClick:E,children:"Submit"})]})]})})})};function ac(){const[e,t]=S(!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}class cc extends Wn{state={hasError:!1};static getDerivedStateFromError(t){return{hasError:!0}}componentDidCatch(t,n){console.error("Uncaught error:",t,n)}render(){return this.state.hasError?o("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100vh",width:"100%",backgroundColor:"#1a1b1c",color:"#fff",textAlign:"center",padding:"2rem"},children:[o(g,{name:"exclamation-triangle",style:{fontSize:"4rem",color:"#ff4d4d",marginBottom:"1rem"}}),o("h1",{style:{marginBottom:"1rem"},children:"Something went wrong"}),o("p",{style:{color:"#aaa",marginBottom:"2rem"},children:"The application encountered an unexpected error."}),o("button",{onClick:()=>{this.setState({hasError:!1}),window.location.href="/"},style:{padding:"0.8rem 1.5rem",backgroundColor:"var(--accent, #3d5afe)",color:"#fff",border:"none",borderRadius:"0.5rem",cursor:"pointer",display:"flex",alignItems:"center",gap:"0.5rem",fontSize:"1rem",transition:"background-color 0.2s"},onMouseOver:t=>t.currentTarget.style.backgroundColor="#536dfe",onMouseOut:t=>t.currentTarget.style.backgroundColor="var(--accent, #3d5afe)",children:[o(g,{name:"home"}),"Go back Home"]})]}):this.props.children}}const jn=ce(void 0),lc=({children:e})=>{const[t,n]=S(!1),r=Q(()=>n(!0),[]),i=Q(()=>n(!1),[]);return w(()=>fn("lan",r),[r]),o(jn.Provider,{value:{isOpen:t,openModal:r,closeModal:i},children:e})},uc=()=>{const e=le(jn);if(!e)throw new Error("useLanAuth must be used within a LanAuthProvider");return e},dc="_container_88bss_1",mc="_field_88bss_8",hc="_input_88bss_19",pc="_actions_88bss_37",je={container:dc,field:mc,input:hc,actions:pc},Kt=Qn(({variant:e="primary",size:t="md",loading:n,children:r,className:i="",disabled:s,...a},c)=>{const l=ci("btn",`btn-${e}`,t!=="md"&&`btn-${t}`,n&&"btn-loading",i);return o("button",{className:l,disabled:s||n,ref:c,...a,children:n?o("span",{className:"btn-spinner"}):r})}),fc=({isOpen:e,onClose:t,onSuccess:n})=>{const[r,i]=S(""),[s,a]=S(!1);ut.useEffect(()=>{e&&i("")},[e]);const c=async()=>{if(!r){b.error("Please enter your password");return}a(!0);try{const l=await fetch("/api/auth/app-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:r})}),u=await l.json().catch(()=>({}));if(!l.ok){b.error(u.error||"Login failed");return}b.success("Authenticated successfully"),n(),t(),window.location.reload()}catch{b.error("Network error")}finally{a(!1)}};return o(qe,{isOpen:e,onClose:t,title:"LAN Authentication Required",children:o("div",{className:je.container,children:[o("p",{children:"This instance is protected. Enter the password to access from this device."}),o("div",{className:je.field,children:[o("label",{htmlFor:"lan-password",children:"Password"}),o("input",{id:"lan-password",type:"password",value:r,onChange:l=>i(l.target.value),placeholder:"Enter password...",className:je.input,onKeyDown:l=>l.key==="Enter"&&c()})]}),o("div",{className:je.actions,children:[o(Kt,{variant:"secondary",onClick:t,disabled:s,children:"Cancel"}),o(Kt,{variant:"primary",onClick:c,loading:s,children:"Unlock"})]})]})})},yc=q(()=>L(()=>import("./Home-rRTAnTfL.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]))),vc=q(()=>L(()=>import("./Watchlist-BtFidAWI.js"),__vite__mapDeps([30,1,2,4,6,7,8,9,10,11,12,13,3,5,14,15,31,32]))),gc=q(()=>L(()=>import("./Settings-CqiYnqx7.js"),__vite__mapDeps([33,1,2,34,35,4,36]))),Ut=q(()=>L(()=>import("./Player-Fm7-Iaym.js"),__vite__mapDeps([37,1,2,38,4,39,40,12,17,18,8,9,10,23,41,42,43,44,45]))),bc=q(()=>L(()=>import("./Search-DnBPEHjw.js"),__vite__mapDeps([46,1,4,3,5,6,7,2,8,9,10,11,12,13,14,15,47,48]))),_c=q(()=>L(()=>import("./Mature-2I4mvoWk.js"),__vite__mapDeps([49,1,2,4,3,5,6,7,8,9,10,11,12,13,14,15,23,47,48,50]))),Ht=q(()=>L(()=>import("./Asmr-jqhD7q69.js"),__vite__mapDeps([51,1,4,2,34,35,11,9,12,13,28,52,53,54,21,40,55,56]))),wc=q(()=>L(()=>import("./Manga-7Jt2tJyE.js"),__vite__mapDeps([57,1,4,34,35,14,15,11,9,12,13,19,20,2,21,23,58,59,55,56]))),Ec=q(()=>L(()=>import("./MangaInfoPage-45jPSjxB.js"),__vite__mapDeps([60,1,4,14,15,20,2,58,59,55,56]))),kc=q(()=>L(()=>import("./MangaReadPage-BWgX9bSn.js"),__vite__mapDeps([61,1,14,4,15,2,20,58,59,55,56]))),Sc=q(()=>L(()=>import("./ReadingList-BN03nBXY.js"),__vite__mapDeps([62,1,11,9,12,4,13,63,3,5,14,15,31,32,19,20,2,21,22,16]))),Pc=q(()=>L(()=>import("./Radio-BbkMYqMU.js"),__vite__mapDeps([64,1,4,2,52,53,65,66,55,56]))),xc=q(()=>L(()=>import("./Music-bUuge7On.js"),__vite__mapDeps([67,1,4,65,66,52,53,2,55,56,68]))),Vt=q(()=>L(()=>import("./TvSearch-B3_Vf8Dk.js"),__vite__mapDeps([69,1,4,3,5,24,11,9,12,13,25,26,2,14,15,47,48]))),Tc=q(()=>L(()=>import("./TvInfo-Dhv0lmCc.js"),__vite__mapDeps([70,1,4,26,2,71]))),Ic=q(()=>L(()=>import("./Tv-Ac8wPuCw.js"),__vite__mapDeps([72,1,2,4,38,39,73,23,26,40,12,43,44,74]))),Oc=q(()=>L(()=>import("./TvWatchlist-B_jtSOjL.js"),__vite__mapDeps([75,1,11,9,12,4,13,63,3,5,14,15,31,32,16,25,26,2]))),Cc=q(()=>L(()=>import("./ListeningList-Pi1Baxgd.js"),__vite__mapDeps([76,1,11,9,12,4,13,63,3,5,14,15,31,32,54,28,2,52,53,21,27,16]))),Nc=q(()=>L(()=>import("./Trackers-DlkQl9Qs.js"),__vite__mapDeps([77,1,2,4,78]))),Ac=q(()=>L(()=>import("./Insights-CN2bm8wf.js"),__vite__mapDeps([79,1,2,4,80]))),qc=q(()=>L(()=>import("./AnimeInfoPage-B795AIlr.js"),__vite__mapDeps([81,1,2,4]))),Lc=q(()=>L(()=>import("./PlayerRedirect-fv2tzEUu.js"),__vite__mapDeps([82,1]))),Rc=q(()=>L(()=>import("./VirtualKeyboard-BmqZPZXR.js"),__vite__mapDeps([83,1,84])));function $c(){rs();const{isOpen:e,closeModal:t,onSuccess:n}=ja(),{isOpen:r,setIsOpen:i}=gt(),{isOpen:s,openModal:a,closeModal:c}=uc(),l=dt(),u=Kn(),d=B(new Map),m=B(l.pathname),h=Rs();Da();const[p,f]=S(!1);w(()=>{fetch("/api/auth/app-status").then(O=>O.json()).then(O=>{O.hasPassword&&!O.isAuthenticated&&(f(!0),a())}).catch(()=>{})},[a]);const[I,P]=qn("lan_auth_notice_shown","false"),R=B(!1);return w(()=>{if(I==="true"||R.current)return;R.current=!0,P("true");const O=setTimeout(()=>{b("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(O)},[I,P]),w(()=>{try{window.history.scrollRestoration="manual"}catch{}},[]),w(()=>{const O=l.key,E=d.current;if(u==="POP"){const D=E.get(O)??0;window.scrollTo({top:D,behavior:"instant"})}else l.pathname!==m.current&&window.scrollTo({top:0,behavior:"instant"});return m.current=l.pathname,()=>{E.set(O,window.scrollY)}},[l.key,l.pathname,u]),w(()=>{const O=E=>{r&&E.key==="Escape"&&i(!1)};return r?document.body.classList.add("sidebar-open"):document.body.classList.remove("sidebar-open"),window.addEventListener("keydown",O),()=>{window.removeEventListener("keydown",O),document.body.classList.remove("sidebar-open")}},[r,i]),o("div",{className:"app-container",children:[o(sc,{isOpen:e,onClose:t,onSuccess:n}),o(fc,{isOpen:s,onClose:p?()=>{}:c,onSuccess:()=>{f(!1),c()}}),o(Br,{position:"top-center",toastOptions:{style:{background:"var(--bg-elevated)",color:"var(--text-primary)",border:"1px solid var(--border-primary)"},success:{style:{background:"var(--accent)",color:"var(--accent-text)"},iconTheme:{primary:"var(--accent-text)",secondary:"var(--accent)"}},error:{style:{background:"rgba(153, 42, 42, 0.95)",color:"#fff"}}}}),o(ia,{}),o(ga,{}),o("main",{className:"main-content",children:o(cc,{children:o(bt,{fallback:o(ac,{}),children:o(Un,{children:[o(x,{path:"/",element:o(yc,{})}),o(x,{path:"/watchlist/:filter?",element:o(vc,{})}),o(x,{path:"/reading-list/:filter?",element:o(Sc,{})}),o(x,{path:"/search",element:o(bc,{})}),o(x,{path:"/mature",element:o(_c,{})}),o(x,{path:"/asmr",element:o(Ht,{})}),o(x,{path:"/asmr/:rj",element:o(Ht,{})}),o(x,{path:"/manga",element:o(wc,{})}),o(x,{path:"/manga/:provider/:id",element:o(Ec,{})}),o(x,{path:"/manga/:provider/:id/read",element:o(kc,{})}),o(x,{path:"/radio",element:o(Pc,{})}),o(x,{path:"/music",element:o(xc,{})}),o(x,{path:"/tv",element:o(Vt,{})}),o(x,{path:"/tv/:id",element:o(Tc,{})}),o(x,{path:"/tv/:id/watch",element:o(Ic,{})}),o(x,{path:"/tv-search",element:o(Vt,{})}),o(x,{path:"/tv-watchlist/:filter?",element:o(Oc,{})}),o(x,{path:"/listening-list/:filter?",element:o(Cc,{})}),o(x,{path:"/settings",element:o(gc,{})}),o(x,{path:"/trackers",element:o(Nc,{})}),o(x,{path:"/mal",element:o(_t,{to:"/trackers",replace:!0})}),o(x,{path:"/insights",element:o(Ac,{})}),o(x,{path:"/anime/:id",element:o(qc,{})}),o(x,{path:"/watch/:id",element:o(Ut,{})}),o(x,{path:"/watch/:id/:episodeNumber",element:o(Ut,{})}),o(x,{path:"/player/:id/:episodeNumber?",element:o(Lc,{})}),o(x,{path:"*",element:o(_t,{to:"/",replace:!0})})]})})})}),o($a,{}),h.isVisible&&o(bt,{fallback:null,children:o(Rc,{activeInputRef:h.activeInputRef,isVisible:h.isVisible,onClose:h.hide})})]})}function Dc(){return o(lc,{children:o($c,{})})}const jc=({children:e})=>{const[t,n]=S(!1),r=Q(()=>{n(s=>!s)},[]),i=Pe(()=>({isOpen:t,setIsOpen:n,toggleSidebar:r}),[t,r]);return o(xn.Provider,{value:i,children:e})},Mc=({children:e})=>{const[t,n]=qn("dango_content_type","anime"),r=Pe(()=>({contentType:t,setContentType:n}),[t,n]);return o(Tn.Provider,{value:r,children:e})},Fc=({children:e})=>{const[t,n]=S("englishName"),[r,i]=S(!0);w(()=>{(async()=>{try{const c=await Z.settings.getByKey.query({key:"titlePreference"});c.value&&n(c.value)}catch(c){console.error("Error fetching title preference in context:",c)}finally{i(!1)}})()},[]);const s=Pe(()=>({titlePreference:t,setTitlePreference:n,loading:r}),[t,r]);return o(vn.Provider,{value:s,children:e})},Bc=({children:e})=>{const{data:t,isLoading:n}=ze("lowEndMode"),r=wn(),i=K(),[s,a]=S(!1);w(()=>{const u=i.getDefaultOptions();i.setDefaultOptions({...u,queries:{...u.queries,gcTime:s?900*1e3:1800*1e3}})},[s,i]),w(()=>{t!==void 0&&a(t==="true"||t===!0)},[t]),w(()=>{s?document.body.classList.add("low-end"):document.body.classList.remove("low-end")},[s]);const c=Q(u=>{a(u),r.mutate({key:"lowEndMode",value:String(u)})},[r]),l=Pe(()=>({lowEndMode:s,setLowEndMode:c,loading:n}),[s,c,n]);return o(En.Provider,{value:l,children:e})},Wc=["iris","mochi","sakura"];function zt(e){e==="iris"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",e)}const Qc=({children:e})=>{const{data:t,isLoading:n}=ze("theme"),r=wn(),[i,s]=S("iris");w(()=>{typeof t=="string"&&Wc.includes(t)&&s(t)},[t]),w(()=>{zt(i)},[i]);const a=Q(l=>{l!==i&&(s(l),zt(l),r.mutate({key:"theme",value:l}))},[r,i]),c=Pe(()=>({theme:i,setTheme:a,loading:n}),[i,a,n]);return o(Sn.Provider,{value:c,children:e})},Kc=({children:e})=>{const[t,n]=S(!1),[r,i]=S(void 0),s=Q(c=>{i(()=>c),n(!0)},[]),a=Q(()=>{n(!1),i(void 0)},[]);return w(()=>fn("animepahe",()=>s()),[s]),o(Ln.Provider,{value:{isOpen:t,openModal:s,closeModal:a,onSuccess:r},children:e})};try{window.history.scrollRestoration="manual"}catch{}const Gt=new Yn({defaultOptions:{queries:{staleTime:1e3*60*5,gcTime:1800*1e3,refetchOnWindowFocus:!1,refetchIntervalInBackground:!1,retry:1}}}),Yt=document.getElementById("root");Yt&&Hn(o(Vn,{children:o(ii,{trpcClient:Z,queryClient:Gt,children:o(Jn,{client:Gt,children:o(Kc,{children:o(jc,{children:o(Mc,{children:o(Fc,{children:o(Bc,{children:o(Qc,{children:o(Dc,{})})})})})})})})})}),Yt);export{al as $,wn as A,Kt as B,fl as C,yl as D,pl as E,M as F,_l as G,Bt as H,Ft as I,Jc as J,U as K,sc as L,qe as M,nl as N,Ls as O,kl as P,fn as Q,El as R,Ye as S,wl as T,zc as U,On as V,gt as W,bl as X,ac as Y,sl as Z,L as _,qn as a,il as a0,Xc as b,el as c,li as d,sa as e,ai as f,Gc as g,N as h,tl as i,In as j,hl as k,rl as l,ol as m,cl as n,ll as o,vl as p,dl as q,Zc as r,Yc as s,Z as t,Qi as u,gl as v,ml as w,ul as x,ze as y,b as z};
|
|
178
|
+
`,Re=16,Br=({reverseOrder:e,position:t="top-center",toastOptions:n,gutter:r,children:i,toasterId:s,containerStyle:a,containerClassName:c})=>{let{toasts:l,handlers:u}=fr(n,s);return W("div",{"data-rht-toaster":s||"",style:{position:"fixed",zIndex:9999,top:Re,left:Re,right:Re,bottom:Re,pointerEvents:"none",...a},className:c,onMouseEnter:u.startPause,onMouseLeave:u.endPause},l.map(d=>{let m=d.position||t,h=u.calculateOffset(d,{reverseOrder:e,gutter:r,defaultPosition:t}),p=Mr(m,h);return W(jr,{id:d.id,key:d.id,onHeightUpdate:u.updateHeight,className:d.visible?Fr:"",style:p},d.type==="custom"?We(d.message,d):i?i(d):W(Dr,{toast:d,position:m}))}))},b=M;function He(e){const t={subscribe(n){let r=null,i=!1,s=!1,a=!1;function c(){if(r===null){a=!0;return}s||(s=!0,typeof r=="function"?r():r&&r.unsubscribe())}return r=e({next(l){var u;i||(u=n.next)===null||u===void 0||u.call(n,l)},error(l){var u;i||(i=!0,(u=n.error)===null||u===void 0||u.call(n,l),c())},complete(){var l;i||(i=!0,(l=n.complete)===null||l===void 0||l.call(n),c())}}),a&&c(),{unsubscribe:c}},pipe(...n){return n.reduce(Wr,t)}};return t}function Wr(e,t){return t(e)}function Qr(e){const t=new AbortController;return new Promise((n,r)=>{let i=!1;function s(){i||(i=!0,a.unsubscribe())}t.signal.addEventListener("abort",()=>{r(t.signal.reason)});const a=e.subscribe({next(c){i=!0,n(c),s()},error(c){r(c)},complete(){t.abort(),s()}})})}function Kr(e){return t=>{let n=0,r=null;const i=[];function s(){r||(r=t.subscribe({next(c){for(const u of i){var l;(l=u.next)===null||l===void 0||l.call(u,c)}},error(c){for(const u of i){var l;(l=u.error)===null||l===void 0||l.call(u,c)}},complete(){for(const l of i){var c;(c=l.complete)===null||c===void 0||c.call(l)}}}))}function a(){if(n===0&&r){const c=r;r=null,c.unsubscribe()}}return He(c=>(n++,i.push(c),s(),{unsubscribe(){n--,a();const l=i.findIndex(u=>u===c);l>-1&&i.splice(l,1)}}))}}function Ur(e){let t=e;const n=[],r=a=>{t!==void 0&&a.next(t),n.push(a)},i=a=>{n.splice(n.indexOf(a),1)},s=He(a=>(r(a),()=>{i(a)}));return s.next=a=>{if(t!==a){t=a;for(const c of n)c.next(a)}},s.get=()=>t,s}function Hr(e){return He(t=>{function n(r=0,i=e.op){const s=e.links[r];if(!s)throw new Error("No more links to execute - did you forget to add an ending link?");return s({op:i,next(a){return n(r+1,a)}})}return n().subscribe(t)})}function Oe(e){"@babel/helpers - typeof";return Oe=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},Oe(e)}function Vr(e,t){if(Oe(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Oe(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function zr(e){var t=Vr(e,"string");return Oe(t)=="symbol"?t:t+""}function H(e,t,n){return(t=zr(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function kt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function F(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?kt(Object(n),!0).forEach(function(r){H(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kt(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 Gr(e){return typeof e=="function"}function Yr(){return Object.create(null)}const Jr=typeof Symbol=="function"&&!!Symbol.asyncIterator;function Zr(e){return Jr&&pe(e)&&Symbol.asyncIterator in e}const Xr=e=>e(),sn=()=>{},St=e=>{Object.freeze&&Object.freeze(e)};function an(e,t,n){var r;const i=t.join(".");return(r=n[i])!==null&&r!==void 0||(n[i]=new Proxy(sn,{get(s,a){if(!(typeof a!="string"||a==="then"))return an(e,[...t,a],n)},apply(s,a,c){const l=t[t.length-1];if(l==="valueOf"||l==="toString"||l==="toJSON")return`tRPC.proxy(${t.slice(0,-1).join(".")})`;let u={args:c,path:t};return l==="call"?u={args:c.length>=2?[c[1]]:[],path:t.slice(0,-1)}:l==="apply"&&(u={args:c.length>=2?c[1]:[],path:t.slice(0,-1)}),St(u.args),St(u.path),e(u)}})),n[i]}const cn=e=>an(e,[],Yr()),eo=e=>new Proxy(sn,{get(t,n){if(n!=="then")return e(n)}});function Ce(e){"@babel/helpers - typeof";return Ce=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},Ce(e)}function to(e,t){if(Ce(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Ce(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function no(e){var t=to(e,"string");return Ce(t)=="symbol"?t:t+""}function rt(e,t,n){return(t=no(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Pt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function $e(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Pt(Object(n),!0).forEach(function(r){rt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pt(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var ro=class extends Error{constructor(e){super(oo(e)),Object.assign(this,e)}};function oo(e){if("message"in e)return String(e.message)}function io(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 ro(e)}}var xt=class extends Error{constructor(e){var t,n,r;const i=io(e.cause),s=(t=(n=e.message)!==null&&n!==void 0?n:i?.message)!==null&&t!==void 0?t:e.code;super(s,{cause:i}),rt(this,"cause",void 0),rt(this,"code",void 0),this.code=e.code,this.name="TRPCError",(r=this.cause)!==null&&r!==void 0||(this.cause=i)}};function so(e,t){if("error"in e){const n=t.deserialize(e.error);return{ok:!1,error:$e($e({},e),{},{error:n})}}return{ok:!0,result:$e($e({},e.result),(!e.result.type||e.result.type==="data")&&{type:"data",data:t.deserialize(e.result.data)})}}var Ge=class extends Error{constructor(){super("Unable to transform response from server")}};function ao(e,t){let n;try{n=so(e,t)}catch{throw new Ge}if(!n.ok&&(!pe(n.error.error)||typeof n.error.error.code!="number"))throw new Ge;if(n.ok&&!pe(n.result))throw new Ge;return n}function co(e){return typeof e=="function"}async function lo(e,t){const{_def:n}=e;let r=n.procedures[t];for(;!r;){const i=Object.keys(n.lazy).find(s=>t===s||t.startsWith(s+"."));if(!i)return null;await n.lazy[i].load(),r=n.procedures[t]}return r}async function uo(e){const{type:t,path:n}=e,r=await lo(e.router,n);if(!r||!co(r)||r._def.type!==t&&!e.allowMethodOverride)throw new xt({code:"NOT_FOUND",message:`No "${t}"-procedure on path "${n}"`});if(r._def.type!==t&&e.allowMethodOverride&&r._def.type==="subscription")throw new xt({code:"METHOD_NOT_SUPPORTED",message:"Method override is not supported for subscriptions"});return r(e)}function mo(e){return e instanceof Qe}function ho(e){return pe(e)&&pe(e.error)&&typeof e.error.code=="number"&&typeof e.error.message=="string"}function po(e,t){return typeof e=="string"?e:pe(e)&&typeof e.message=="string"?e.message:t}var Qe=class Fe extends Error{constructor(t,n){var r,i;const s=n?.cause;super(t,{cause:s}),H(this,"cause",void 0),H(this,"shape",void 0),H(this,"data",void 0),H(this,"meta",void 0),this.meta=n?.meta,this.cause=s,this.shape=n==null||(r=n.result)===null||r===void 0?void 0:r.error,this.data=n==null||(i=n.result)===null||i===void 0?void 0:i.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,Fe.prototype)}static from(t,n={}){const r=t;return mo(r)?(n.meta&&(r.meta=F(F({},r.meta),n.meta)),r):ho(r)?new Fe(r.error.message,F(F({},n),{},{result:r,cause:n.cause})):new Fe(po(r,"Unknown error"),F(F({},n),{},{cause:r}))}};function fo(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 Tt=e=>typeof e=="function";function yo(e){if(e)return e;if(typeof window<"u"&&Tt(window.fetch))return window.fetch.bind(window);if(typeof globalThis<"u"&&Tt(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}function vo(...e){const t=new AbortController,n=e.length;let r=0;const i=()=>{++r===n&&t.abort()};for(const s of e)s?.aborted?i():s?.addEventListener("abort",i,{once:!0});return t.signal}function go(...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 bo(e){return{url:e.url.toString(),fetch:e.fetch,transformer:fo(e.transformer),methodOverride:e.methodOverride}}function _o(e){const t={};for(let n=0;n<e.length;n++){const r=e[n];t[n]=r}return t}const wo={query:"GET",mutation:"POST",subscription:"PATCH"};function ln(e){return"input"in e?e.transformer.input.serialize(e.input):_o(e.inputs.map(t=>e.transformer.input.serialize(t)))}const un=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 i=ln(e);i!==void 0&&e.methodOverride!=="POST"&&r.push(`input=${encodeURIComponent(JSON.stringify(i))}`)}return r.length&&(n+="?"+r.join("&")),n},Eo=e=>{if(e.type==="query"&&e.methodOverride!=="POST")return;const t=ln(e);return t!==void 0?JSON.stringify(t):void 0},ko=e=>To(F(F({},e),{},{contentTypeHeader:"application/json",getUrl:un,getBody:Eo}));var So=class extends Error{constructor(){const e="AbortError";super(e),this.name=e,this.message=e}};const Po=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 So};async function xo(e){var t,n;Po(e.signal);const r=e.getUrl(e),i=e.getBody(e),s=(t=e.methodOverride)!==null&&t!==void 0?t:wo[e.type],a=await(async()=>{const l=await e.headers();return Symbol.iterator in l?Object.fromEntries(l):l})(),c=F(F(F({},e.contentTypeHeader&&s!=="GET"?{"content-type":e.contentTypeHeader}:{}),e.trpcAcceptHeader?{[(n=e.trpcAcceptHeaderKey)!==null&&n!==void 0?n:"trpc-accept"]:e.trpcAcceptHeader}:void 0),a);return yo(e.fetch)(r,{method:s,signal:e.signal,body:i,headers:c})}async function To(e){const t={},n=await xo(e);t.response=n;const r=await n.json();return t.responseJSON=r,{json:r,meta:t}}const It=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function Ot(e){let t=null,n=null;const r=()=>{clearTimeout(n),n=null,t=null};function i(c){const l=[[]];let u=0;for(;;){const h=c[u];if(!h)break;const p=l[l.length-1];if(h.aborted){var d;(d=h.reject)===null||d===void 0||d.call(h,new Error("Aborted")),u++;continue}if(e.validate(p.concat(h).map(f=>f.key))){p.push(h),u++;continue}if(p.length===0){var m;(m=h.reject)===null||m===void 0||m.call(h,new Error("Input is too big for a single dispatch")),u++;continue}l.push([])}return l}function s(){const c=i(t);r();for(const l of c){if(!l.length)continue;const u={items:l};for(const d of l)d.batch=u;e.fetch(u.items.map(d=>d.key)).then(async d=>{await Promise.all(d.map(async(h,p)=>{const f=u.items[p];try{var I;const R=await Promise.resolve(h);(I=f.resolve)===null||I===void 0||I.call(f,R)}catch(R){var P;(P=f.reject)===null||P===void 0||P.call(f,R)}f.batch=null,f.reject=null,f.resolve=null}));for(const h of u.items){var m;(m=h.reject)===null||m===void 0||m.call(h,new Error("Missing result")),h.batch=null}}).catch(d=>{for(const h of u.items){var m;(m=h.reject)===null||m===void 0||m.call(h,d),h.batch=null}})}}function a(c){var l;const u={aborted:!1,key:c,batch:null,resolve:It,reject:It},d=new Promise((m,h)=>{var p;u.reject=h,u.resolve=m,(p=t)!==null&&p!==void 0||(t=[]),t.push(u)});return(l=n)!==null&&l!==void 0||(n=setTimeout(s)),d}return{load:a}}function Io(e){var t,n;const r=bo(e),i=(t=e.maxURLLength)!==null&&t!==void 0?t:1/0,s=(n=e.maxItems)!==null&&n!==void 0?n:1/0;return()=>{const a=l=>({validate(u){if(i===1/0&&s===1/0)return!0;if(u.length>s)return!1;const d=u.map(h=>h.path).join(","),m=u.map(h=>h.input);return un(F(F({},r),{},{type:l,path:d,inputs:m,signal:null})).length<=i},async fetch(u){const d=u.map(f=>f.path).join(","),m=u.map(f=>f.input),h=vo(...u.map(f=>f.signal)),p=await ko(F(F({},r),{},{path:d,inputs:m,type:l,headers(){return e.headers?typeof e.headers=="function"?e.headers({opList:u}):e.headers:{}},signal:h}));return(Array.isArray(p.json)?p.json:u.map(()=>p.json)).map(f=>({meta:p.meta,json:f}))}}),c={query:Ot(a("query")),mutation:Ot(a("mutation"))};return({op:l})=>He(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(F(F({},l),{},{signal:go(l.signal,d.signal)}));let h=!1,p;return m.then(f=>{h=!0,p=f;const I=ao(f.json,r.transformer.output);if(!I.ok){u.error(Qe.from(I.error,{meta:f.meta}));return}u.next({context:f.meta,result:I.result}),u.complete()}).catch(f=>{h=!0,u.error(Qe.from(f,{meta:p?.meta}))}),()=>{h||d.abort()}})}}const dn=(e,...t)=>typeof e=="function"?e(...t):e;function Oo(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}async function Co(e){const t=await dn(e.url);return e.connectionParams?t+`${t.includes("?")?"&":"?"}connectionParams=1`:t}async function No(e,t){const n={method:"connectionParams",data:await dn(e)};return t.encode(n)}function Ao(e){const{promise:t,resolve:n,reject:r}=Oo();return e.addEventListener("open",()=>{e.removeEventListener("error",r),n()}),e.addEventListener("error",r),t}function qo(e,{intervalMs:t,pongTimeoutMs:n}){let r,i;function s(){r=setTimeout(()=>{e.send("PING"),i=setTimeout(()=>{e.close()},n)},t)}function a(){clearTimeout(r),s()}function c(){clearTimeout(i),a()}e.addEventListener("open",s),e.addEventListener("message",({data:l})=>{clearTimeout(r),s(),l==="PONG"&&c()}),e.addEventListener("close",()=>{clearTimeout(r),clearTimeout(i)})}var Lo=class ot{constructor(t){var n;if(H(this,"id",++ot.connectCount),H(this,"WebSocketPonyfill",void 0),H(this,"urlOptions",void 0),H(this,"keepAliveOpts",void 0),H(this,"encoder",void 0),H(this,"wsObservable",Ur(null)),H(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=++ot.connectCount;const t=Co(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&&qo(n,this.keepAliveOpts),n.addEventListener("close",()=>{this.ws===n&&(this.ws=null)}),await Ao(n),this.urlOptions.connectionParams&&n.send(await No(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()}}};H(Lo,"connectCount",0);var mn=class{constructor(e){H(this,"links",void 0),H(this,"runtime",void 0),H(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=e.links.map(t=>t(this.runtime))}$request(e){var t;return Hr({links:this.links,op:F(F({},e),{},{context:(t=e.context)!==null&&t!==void 0?t:{},id:++this.requestId})}).pipe(Kr())}async requestAsPromise(e){try{const t=this.$request(e);return(await Qr(t)).result.data}catch(t){throw Qe.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 i;(i=n.onConnectionStateChange)===null||i===void 0||i.call(n,r.result);break;case"started":var s;(s=n.onStarted)===null||s===void 0||s.call(n,{context:r.context});break;case"stopped":var a;(a=n.onStopped)===null||a===void 0||a.call(n);break;case"data":case void 0:var c;(c=n.onData)===null||c===void 0||c.call(n,r.result.data)}},error(r){var i;(i=n.onError)===null||i===void 0||i.call(n,r)},complete(){var r;(r=n.onComplete)===null||r===void 0||r.call(n)}})}};const hn=Symbol.for("trpc_untypedClient"),Ro={query:"query",mutate:"mutation",subscribe:"subscription"},$o=e=>Ro[e];function Do(e){const t=cn(({path:n,args:r})=>{const i=[...n],s=$o(i.pop()),a=i.join(".");return e[s](a,...r)});return eo(n=>n===hn?e:t[n])}function jo(e){return Do(new mn(e))}function Mo(e){return e[hn]}function Ne(e){"@babel/helpers - typeof";return Ne=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},Ne(e)}function Fo(e,t){if(Ne(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Ne(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Bo(e){var t=Fo(e,"string");return Ne(t)=="symbol"?t:t+""}function Wo(e,t,n){return(t=Bo(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ct(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function T(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ct(Object(n),!0).forEach(function(r){Wo(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ct(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Qo(e){var t,n,r,i=2;for(typeof Symbol<"u"&&(n=Symbol.asyncIterator,r=Symbol.iterator);i--;){if(n&&(t=e[n])!=null)return t.call(e);if(r&&(t=e[r])!=null)return new Be(t.call(e));n="@@asyncIterator",r="@@iterator"}throw new TypeError("Object is not async iterable")}function Be(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(i){return{value:i,done:r}})}return Be=function(r){this.s=r,this.n=r.next},Be.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(r){var i=this.s.return;return i===void 0?Promise.resolve({value:r,done:!0}):t(i.apply(this.s,arguments))},throw:function(r){var i=this.s.return;return i===void 0?Promise.reject(r):t(i.apply(this.s,arguments))}},new Be(e)}function Ko(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 Uo(e,t){if(e==null)return{};var n,r,i=Ko(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}const Ho=["cursor","direction"];function Ve(e){return{path:e.path.join(".")}}function Vo(e){return e.length>=3}function zo(e){return Vo(e)?{type:"prefixed",prefix:e[0],path:e[1],args:e[2]}:{type:"unprefixed",prefix:void 0,path:e[0],args:e[1]}}function pt(e,t,n){var r;const i=zo(e);let s=(r=i.args)===null||r===void 0?void 0:r.input;if(n){var a,c;s=T(T(T({},(a=(c=i.args)===null||c===void 0?void 0:c.input)!==null&&a!==void 0?a:{}),n.pageParam!==void 0?{cursor:n.pageParam}:{}),{},{direction:n.direction})}return[i.path.join("."),s,t?.trpc]}async function Go(e,t,n){const r=t.getQueryCache().build(t,{queryKey:n});r.setState({data:[],status:"success"});const i=[];var s=!1,a=!1,c;try{for(var l=Qo(e),u;s=!(u=await l.next()).done;s=!1){const d=u.value;i.push(d),r.setState({data:[...i]})}}catch(d){a=!0,c=d}finally{try{s&&l.return!=null&&await l.return()}finally{if(a)throw c}}return i}function se(e){const t=Xr(()=>{const{input:n,type:r}=e,i=e.path.flatMap(s=>s.split("."));if(!n&&r==="any")return i.length?[i]:[];if(r==="infinite"&&pe(n)&&("direction"in n||"cursor"in n)){const{cursor:s,direction:a}=n;return[i,{input:Uo(n,Ho),type:"infinite"}]}return[i,T(T({},typeof n<"u"&&n!==ge&&{input:n}),r&&r!=="any"&&{type:r})]});return e.prefix&&t.unshift([e.prefix]),t}function pn(e){const t=[e.path.flatMap(n=>n.split("."))];return e.prefix&&t.unshift([e.prefix]),t}function ft(e){return Gr(e)?e():e}function Yo(e){var t;const{input:n,query:r,path:i,queryKey:s,opts:a}=e,c=n===ge,l=async u=>{var d;const m=T(T({},a),{},{trpc:T(T({},a?.trpc),!(a==null||(d=a.trpc)===null||d===void 0)&&d.abortOnUnmount?{signal:u.signal}:{signal:null})});return await r(...pt(s,m,{direction:u.direction,pageParam:u.pageParam}))};return Object.assign(zn(T(T({},a??{}),{},{queryKey:s,queryFn:c?ge:l,initialPageParam:(t=a?.initialCursor)!==null&&t!==void 0?t:n?.cursor})),{trpc:Ve({path:i})})}function Jo(e){var t,n;const{mutate:r,path:i,prefix:s,opts:a,overrides:c}=e,l=ft(e.queryClient),u=pn({path:i,prefix:(t=a?.keyPrefix)!==null&&t!==void 0?t:s}),d=l.defaultMutationOptions(l.getMutationDefaults(u)),m=(n=c?.onSuccess)!==null&&n!==void 0?n:(p=>p.originalFn()),h=async p=>await r(...pt([...u,{input:p}],a));return T(T({},a),{},{mutationKey:u,mutationFn:h,onSuccess(...p){var f,I;return m({originalFn:()=>{var R,O,E;return(R=a==null||(O=a.onSuccess)===null||O===void 0?void 0:O.call(a,...p))!==null&&R!==void 0?R:d==null||(E=d.onSuccess)===null||E===void 0?void 0:E.call(d,...p)},queryClient:l,meta:(f=(I=a?.meta)!==null&&I!==void 0?I:d?.meta)!==null&&f!==void 0?f:{}})},trpc:Ve({path:i})})}function Zo(e){const{input:t,query:n,path:r,queryKey:i,opts:s}=e,a=ft(e.queryClient),c=t===ge,l=async u=>{var d;const m=T(T({},s),{},{trpc:T(T({},s?.trpc),!(s==null||(d=s.trpc)===null||d===void 0)&&d.abortOnUnmount?{signal:u.signal}:{signal:null})}),h=u.queryKey,p=await n(...pt(h,m));return Zr(p)?Go(p,a,h):p};return Object.assign(Gn(T(T({},s),{},{queryKey:i,queryFn:c?ge:l})),{trpc:Ve({path:r})})}const Xo=e=>{const{subscribe:t,path:n,queryKey:r,input:i,opts:s={}}=e,a="enabled"in s?!!s.enabled:i!==ge,c=l=>t(n.join("."),i===ge?void 0:i,l);return T(T({},s),{},{enabled:a,subscribe:c,queryKey:r,trpc:Ve({path:n})})};function ei(e){const t=e.keyPrefix,n=r=>(i,s,a)=>"router"in e?Promise.resolve(ft(e.ctx)).then(c=>uo({router:e.router,path:i,getRawInput:async()=>s,ctx:c,type:r,signal:void 0,batchIndex:0})):(e.client instanceof mn?e.client:Mo(e.client))[r](i,s,a);return cn(({args:r,path:i})=>{const s=[...i],a=s.pop(),[c,l]=r;return{"~types":void 0,pathKey:()=>se({path:s,type:"any",prefix:t}),pathFilter:()=>T(T({},c),{},{queryKey:se({path:s,type:"any",prefix:t})}),queryOptions:()=>Zo({input:c,opts:l,path:s,queryClient:e.queryClient,queryKey:se({path:s,input:c,type:"query",prefix:t}),query:n("query")}),queryKey:()=>se({path:s,input:c,type:"query",prefix:t}),queryFilter:()=>T(T({},l),{},{queryKey:se({path:s,input:c,type:"query",prefix:t})}),infiniteQueryOptions:()=>Yo({input:c,opts:l,path:s,queryKey:se({path:s,input:c,type:"infinite",prefix:t}),query:n("query")}),infiniteQueryKey:()=>se({path:s,input:c,type:"infinite",prefix:t}),infiniteQueryFilter:()=>T(T({},l),{},{queryKey:se({path:s,input:c,type:"infinite",prefix:t})}),mutationOptions:()=>{var u;return Jo({opts:c,path:s,prefix:t,queryClient:e.queryClient,mutate:n("mutation"),overrides:(u=e.overrides)===null||u===void 0?void 0:u.mutations})},mutationKey:()=>pn({path:s,prefix:t}),subscriptionOptions:()=>Xo({opts:l,path:s,input:c,queryKey:se({path:s,input:c,type:"any",prefix:t}),subscribe:n("subscription")})}[a]()})}function ti(){const e=ce(null),t=ce(null),n=s=>{const a=Pe(()=>ei({client:s.trpcClient,queryClient:s.queryClient,keyPrefix:s.keyPrefix}),[s.trpcClient,s.queryClient,s.keyPrefix]);return W(e.Provider,{value:s.trpcClient},W(t.Provider,{value:a},s.children))};n.displayName="TRPCProvider";function r(){const s=le(t);if(!s)throw new Error("useTRPC() can only be used inside of a <TRPCProvider>");return s}function i(){const s=le(e);if(!s)throw new Error("useTRPCClient() can only be used inside of a <TRPCProvider>");return s}return{TRPCProvider:n,useTRPC:r,useTRPCClient:i}}const it={lan:new Set,animepahe:new Set,jasmr:new Set};function Ee(e){for(const t of[...it[e]])try{t()}catch(n){console.error(`auth-bus listener failed (${e}):`,n)}}function fn(e,t){return it[e].add(t),()=>{it[e].delete(t)}}const ni=e=>new Promise(t=>setTimeout(t,e)),yn=async(e,t)=>{const n={"Content-Type":"application/json"},r=typeof e=="string"?e:e.toString();if(r.startsWith("/")||typeof window<"u"&&r.startsWith(window.location.origin)){const a=localStorage.getItem("animepahe_ua"),c=localStorage.getItem("animepahe_cookie"),l=localStorage.getItem("jasmr_ua"),u=localStorage.getItem("jasmr_cookie");a&&(n["x-animepahe-ua"]=a),c&&(n["x-animepahe-cookie"]=c),l&&(n["x-jasmr-ua"]=l),u&&(n["x-jasmr-cookie"]=u)}let s=await fetch(e,{...t,headers:{...n,...t?.headers}});for(let a=0;s.status===503&&a<8;a++)await ni(Math.min(500*2**a,4e3)),s=await fetch(e,{...t,headers:{...n,...t?.headers}});return s},zc=async(e,t)=>{const n=await yn(e,t);if(!n.ok){const r=await n.text().catch(()=>"");let i={};try{i=JSON.parse(r)}catch{}const s=typeof i.error=="string"?i.error:"";throw n.status===403&&s==="AUTH_REQUIRED"&&i.provider==="animepahe"&&Ee("animepahe"),n.status===403&&s==="AUTH_REQUIRED"&&i.provider==="jasmr"&&Ee("jasmr"),n.status===401&&s==="LAN_AUTH_REQUIRED"&&Ee("lan"),new Error(s||`Failed to fetch from ${e}`)}return n.json()};async function ri(e,t){const n=await yn(e,t);if(n.status===401)try{(await n.clone().json())?.error==="LAN_AUTH_REQUIRED"&&Ee("lan")}catch{}return await oi(n),n}async function oi(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 i=r?.error;if(!i||typeof i!="object")continue;const s=i.data?.cause;(i.message==="AUTH_REQUIRED"||s?.code==="AUTH_REQUIRED")&&(s?.provider==="animepahe"||s?.provider==="jasmr")&&Ee(s.provider),(i.message==="LAN_AUTH_REQUIRED"||s?.code==="LAN_AUTH_REQUIRED")&&Ee("lan")}}catch{}}const{TRPCProvider:ii,useTRPC:N}=ti(),Z=jo({links:[Io({url:"/api/trpc",fetch:ri})]}),Te=new Map,si=500,ai=(e,t,n)=>{if(!e||e.trim()==="")return"/placeholder.svg";if(e.includes("/api/image-proxy")){let a=e;if(t&&!a.includes("w=")){const c=a.includes("?")?"&":"?";a+=`${c}w=${t}`}if(n&&!a.includes("h=")){const c=a.includes("?")?"&":"?";a+=`${c}h=${n}`}return a}let r=e;r.includes("aln.youtube-anime.com")&&(r=r.replace(/https?:\/\/allanime\.day\/aln\.youtube-anime\.com/,"https://aln.youtube-anime.com"),r.includes("/images/mcovers")&&(r=r.replace("/images/mcovers","/mcovers")),r.includes("/images/images2")&&(r=r.replace("/images/images2","/images2"))),r.includes("allanime.day/s4.anilist.co")&&(r=r.replace(/https?:\/\/allanime\.day\/s4\.anilist\.co/,"https://s4.anilist.co")),r.includes("wp.youtube-anime.com/s4.anilist.co")&&(r=r.replace(/https?:\/\/wp\.youtube-anime\.com\/s4\.anilist\.co/,"https://s4.anilist.co"));const i=`${r}-${t}-${n}`;if(Te.has(i))return Te.get(i);let s;if(r.startsWith("https://s4.anilist.co"))s=r,t&&(s+=`${s.includes("?")?"&":"?"}w=${t}`),n&&(s+=`${s.includes("?")?"&":"?"}h=${n}`);else if(r.includes("animepahe")){s=`/api/image-proxy?url=${encodeURIComponent(r)}`;const a=localStorage.getItem("animepahe_cookie"),c=localStorage.getItem("animepahe_ua");a&&(s+=`&cookie=${encodeURIComponent(a)}`),c&&(s+=`&ua=${encodeURIComponent(c)}`)}else if(r.startsWith("http"))s=`/api/image-proxy?url=${encodeURIComponent(r)}`,t&&(s+=`&w=${t}`),n?s+=`&h=${n}`:t||(s+="&w=300");else{const c=`${r.startsWith("mcovers")||r.startsWith("images2")?"https://aln.youtube-anime.com":"https://aln.youtube-anime.com/images"}/${r}`;s=`/api/image-proxy?url=${encodeURIComponent(c)}`,t&&(s+=`&w=${t}`),n?s+=`&h=${n}`:t||(s+="&w=300")}return Te.size>si&&Te.clear(),Te.set(i,s),s},Gc=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 Yc(e){return e?e.replace(/<[^>]*>?/gm,"").replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").trim():""}function Jc(e){return e==null?e:e>10?Number((e/10).toFixed(1)):e}const ci=(...e)=>e.filter(Boolean).join(" "),vn=ce(void 0),li=()=>{const e=le(vn);if(e===void 0)throw new Error("useTitlePreference must be used within a TitlePreferenceProvider");return e},Zc=()=>{const e=N();return z({...e.data.spotlight.queryOptions(),staleTime:1e3*60*5,retry:1})},Xc=(e="TRENDING_DESC",t=10)=>mt({queryKey:["trendingList",e,t],queryFn:({pageParam:n=1})=>Z.data.popularList.query({sort:e,page:n,size:t}),initialPageParam:1,getNextPageParam:(n,r)=>n.length>=t?r.length+1:void 0}),el=(e="TV",t=12)=>mt({queryKey:["latestReleases",e,t],queryFn:({pageParam:n=1})=>Z.data.latestReleases.query({format:e,page:n,size:t}),initialPageParam:1,getNextPageParam:(n,r)=>n.length>=t?r.length+1:void 0}),tl=(e,t="TV",n=!0)=>{const r=N();return z({...r.data.seasonal.queryOptions({page:e,format:t}),enabled:n,staleTime:1e3*60*5})},ui=["query","sortBy","type","status","season","year","country","genres","excludeGenres","excludeTags","minScore","minEpisodes","adult"],nl=(e,t,n=14)=>{const r=N(),i=new URLSearchParams(e),s={page:t,limit:n};for(const a of ui){const c=i.get(a);c!==null&&(s[a]=c)}return z({...r.data.search.queryOptions(s),enabled:e!=null})},rl=()=>{const e=N();return z(e.queue.list.queryOptions())},di=()=>{const e=N(),t=K();return X(e.queue.add.mutationOptions({onSuccess:n=>{n.queued?b.success("Added to queue"):b.success("Removed from queue"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:["queue-remaining"]})},onError:n=>{b.error(`Failed to update queue: ${n.message}`)}}))},ol=()=>{const e=N(),t=K();return X(e.queue.remove.mutationOptions({onSuccess:()=>{b.success("Removed from queue"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:["queue-remaining"]}),t.invalidateQueries({queryKey:["allContinueWatching"]})},onError:n=>{b.error(`Failed to remove: ${n.message}`)}}))},il=(e,t=!0)=>z({queryKey:["queue-remaining",e],queryFn:()=>Z.watchlist.queueRemaining.query({showId:e}),enabled:!!e&&t,staleTime:1e3*60}),sl=()=>{const e=N(),t=K();return X(e.queue.addBatch.mutationOptions({onSuccess:(n,r)=>{const i=n.added??r.episodeNumbers.length;b.success(`${i} ${i===1?"episode":"episodes"} added to queue`),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:["queue-remaining"]})},onError:n=>{b.error(`Failed to update queue: ${n.message}`)}}))},al=()=>{const e=N(),t=K();return X(e.queue.removeMany.mutationOptions({onSuccess:()=>{b.success("Removed from queue"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:["queue-remaining"]}),t.invalidateQueries({queryKey:["allContinueWatching"]})},onError:n=>{b.error(`Failed to remove: ${n.message}`)}}))},cl=()=>{const e=N(),t=K();return X(e.queue.clear.mutationOptions({onSuccess:()=>{b.success("Queue cleared"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:["queue-remaining"]}),t.invalidateQueries({queryKey:["allContinueWatching"]})},onError:n=>{b.error(`Failed to clear queue: ${n.message}`)}}))},ll=()=>{const e=N(),t=K(),n=e.queue.list.queryOptions().queryKey;return X(e.queue.reorder.mutationOptions({onMutate:async r=>{await t.cancelQueries({queryKey:n});const i=t.getQueryData(n);return t.setQueryData(n,s=>{if(!s)return s;const a=new Map(s.map(c=>[c.id,c]));return r.map((c,l)=>{const u=a.get(c.id??-1);return u?{...u,queue_order:l}:void 0}).filter(c=>!!c)}),{previousQueue:i}},onError:(r,i,s)=>{s?.previousQueue&&t.setQueryData(n,s.previousQueue)},onSettled:()=>{t.invalidateQueries(e.queue.pathFilter())}}))},mi=["status","showMature","query","type","season","year","genres","excludeGenres","sortBy","titlePreference"];function yt(e,t,n){const r=new URLSearchParams(e),i={page:t,limit:n};for(const s of mi){const a=r.get(s);a!==null&&(i[s]=a)}return i}const ul=(e,t="",n,r=14)=>z({queryKey:["watchlist",e,t,n,r],queryFn:async()=>{const i=new URLSearchParams(t);return i.set("status",e),await Z.watchlist.list.query(yt(i.toString(),n,r))}}),dl=(e="")=>mt({queryKey:["allContinueWatching",e],queryFn:async({pageParam:t=1})=>await Z.watchlist.continueWatchingAll.query(yt(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)})}),ml=(e="",t,n=14)=>z({queryKey:["allContinueWatching",e,t,n],queryFn:async()=>await Z.watchlist.continueWatchingAll.query(yt(e,t,n))}),hl=()=>{const e=N(),t=K();return X(e.watchlist.remove.mutationOptions({onSuccess:()=>{b.success("Removed from watchlist"),t.invalidateQueries(e.watchlist.pathFilter()),t.invalidateQueries({queryKey:["watchlist"]})},onError:n=>{b.error(`Failed to remove: ${n.message}`)}}))},pl=()=>{const e=N(),t=K();return X(e.watchlist.batchStatus.mutationOptions({onSuccess:n=>{b.success(`Status updated for ${n.updated??0} items`),t.invalidateQueries(e.watchlist.pathFilter()),t.invalidateQueries({queryKey:["watchlist"]}),t.invalidateQueries({queryKey:["allContinueWatching"]})},onError:n=>{b.error(`Failed to update statuses: ${n.message}`)}}))},fl=()=>{const e=N(),t=K();return X(e.watchlist.removeMany.mutationOptions({onSuccess:n=>{const r=n.removed??0;b.success(`Removed ${r} ${r===1?"item":"items"} from watchlist`),t.invalidateQueries(e.watchlist.pathFilter()),t.invalidateQueries({queryKey:["watchlist"]}),t.invalidateQueries({queryKey:["allContinueWatching"]})},onError:n=>{b.error(`Failed to remove: ${n.message}`)}}))},yl=()=>{const e=N(),t=K();return X(e.continueWatching.removeMany.mutationOptions({onSuccess:n=>{const r=n.removed??0;b.success(`Removed ${r} ${r===1?"item":"items"} from continue watching`),t.invalidateQueries(e.continueWatching.pathFilter()),t.invalidateQueries({queryKey:["allContinueWatching"]})},onError:n=>{b.error(`Failed to remove: ${n.message}`)}}))},gn=(e=!0)=>{const t=N();return z({...t.notifications.list.queryOptions(),enabled:e,refetchInterval:3e4})},bn=(e=!0)=>{const t=N();return z({...t.data.systemNotifications.queryOptions(),enabled:e,refetchInterval:3e4})},_n=(e=!0)=>{const t=N();return z({...t.discovery.status.queryOptions(),enabled:e,refetchInterval:n=>n.state.data?.running?2e3:!1})},hi=()=>{const e=N(),t=K(),n=e.discovery.status.queryOptions().queryKey;return X(e.discovery.refresh.mutationOptions({onSuccess:r=>{t.setQueryData(n,{running:r.running,state:r.state,total:r.total,done:r.done,lastRunAt:r.lastRunAt}),t.invalidateQueries(e.notifications.pathFilter()),t.invalidateQueries({queryKey:["notifications"]})},onError:()=>{t.invalidateQueries({queryKey:n})}}))},pi=()=>{const e=N(),t=K();return X(e.notifications.dismiss.mutationOptions({onSuccess:()=>{t.invalidateQueries(e.notifications.pathFilter())}}))},fi=()=>{const e=N(),t=K();return X(e.notifications.clearAll.mutationOptions({onSuccess:()=>{t.invalidateQueries(e.notifications.pathFilter())}}))},vl=()=>{const e=N();return z({...e.continueWatching.thisWeek.queryOptions(),staleTime:1e3*60*5})},gl=()=>{const e=N();return z({...e.data.genresAndTags.queryOptions(),staleTime:1e3*60*60})},bl=()=>z({queryKey:["genreCards"],queryFn:()=>Z.insights.genreCards.query()}),yi="_container_1c94k_1",vi="_bellBtn_1c94k_7",gi="_badge_1c94k_56",bi="_dropdown_1c94k_96",_i="_dropdownHeader_1c94k_127",wi="_clearAllBtn_1c94k_141",Ei="_discoveryStatusRow_1c94k_159",ki="_statusDot_1c94k_170",Si="_statusDotRunning_1c94k_177",Pi="_statusDotOk_1c94k_182",xi="_statusDotInfo_1c94k_186",Ti="_statusDotError_1c94k_190",Ii="_statusDotIdle_1c94k_194",Oi="_list_1c94k_208",Ci="_item_1c94k_222",Ni="_thumbnail_1c94k_237",Ai="_itemInfo_1c94k_246",qi="_itemTitle_1c94k_251",Li="_itemMeta_1c94k_262",Ri="_systemItemMeta_1c94k_272",$i="_removeItem_1c94k_289",Di="_queueItem_1c94k_319",ji="_emptyState_1c94k_323",v={container:yi,bellBtn:vi,badge:gi,dropdown:bi,dropdownHeader:_i,clearAllBtn:wi,discoveryStatusRow:Ei,statusDot:ki,statusDotRunning:Si,statusDotOk:Pi,statusDotInfo:xi,statusDotError:Ti,statusDotIdle:Ii,list:Oi,item:Ci,thumbnail:Ni,itemInfo:Ai,itemTitle:qi,itemMeta:Li,systemItemMeta:Ri,removeItem:$i,queueItem:Di,emptyState:ji},Mi=({notification:e})=>{const t=pi(),n=di(),[r,i]=ut.useState(!1),s=d=>{d.preventDefault(),d.stopPropagation(),t.mutate({showId:e.showId,episodeNumber:e.episodeNumber})},a=()=>{t.mutate({showId:e.showId,episodeNumber:e.episodeNumber})},c=d=>{d.preventDefault(),d.stopPropagation(),i(!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(()=>i(!1),1e3)},{titlePreference:l}=li(),u=l==="nativeName"?e.nativeName||e.name:l==="englishName"&&e.englishName||e.name;return o(J,{to:`/watch/${e.showId}/${e.episodeNumber}`,className:v.item,onClick:a,children:[o("img",{src:ai(e.thumbnail,48,64),alt:e.name,className:v.thumbnail,loading:"lazy",decoding:"async"}),o("div",{className:v.itemInfo,children:[o("span",{className:v.itemTitle,children:u}),o("span",{className:v.itemMeta,children:["New Episode ",e.episodeNumber]})]}),o("button",{className:`${v.removeItem} ${v.queueItem}`,onClick:c,"aria-label":"Add notification to queue",children:r?o(g,{name:"check"}):o(g,{name:"plus"})}),o("button",{className:v.removeItem,onClick:s,"aria-label":"Remove notification",children:o(g,{name:"times"})})]})};function Ye({width:e="100%",height:t="1em",variant:n="rectangular",className:r="",style:i}){return o("div",{className:`skeleton skeleton-${n} ${r}`,style:{width:e,height:t,...i}})}const Fi=({count:e=3})=>o(V,{children:Array.from({length:e}).map((t,n)=>o("div",{className:v.item,style:{borderBottom:"1px solid var(--border-primary)",pointerEvents:"none"},children:[o("div",{className:v.thumbnail,style:{overflow:"hidden"},children:o(Ye,{width:"100%",height:"100%",variant:"rectangular"})}),o("div",{className:v.itemInfo,children:[o(Ye,{width:"80%",height:"1rem",variant:"text",style:{marginBottom:"4px"}}),o(Ye,{width:"40%",height:"0.7rem",variant:"rectangular",style:{borderRadius:"var(--radius-sm)"}})]})]},n))}),Bi=()=>{const{data:e=[],isLoading:t}=gn(),{data:n=[]}=bn(),{data:r}=_n(),i=fi(),s=K(),[a,c]=S(null);w(()=>{s.invalidateQueries({queryKey:["notifications"]})},[s]);const l=()=>{i.mutate(void 0)},u=n.find(d=>d.id===a)??null;return o("div",{className:v.dropdown,children:[o("div",{className:v.dropdownHeader,children:[o("h4",{children:"Notifications"}),e.length>0&&o("button",{className:v.clearAllBtn,onClick:l,children:"Clear All"})]}),o("div",{className:v.discoveryStatusRow,children:r?.running?o(V,{children:[o("span",{className:`${v.statusDot} ${v.statusDotRunning}`,"aria-hidden":"true"}),o("span",{children:r.total>0?`Checking ${Math.min(r.done,r.total)}/${r.total} shows...`:"Checking for new episodes..."})]}):r?.state==="complete"?o(V,{children:[o("span",{className:`${v.statusDot} ${v.statusDotOk}`,"aria-hidden":"true"}),o("span",{children:["Discovery complete — checked ",r.total," ",r.total===1?"show":"shows"]})]}):r?.state==="empty"?o(V,{children:[o("span",{className:`${v.statusDot} ${v.statusDotInfo}`,"aria-hidden":"true"}),o("span",{children:"No shows set to Watching — nothing to check"})]}):r?.state==="error"?o(V,{children:[o("span",{className:`${v.statusDot} ${v.statusDotError}`,"aria-hidden":"true"}),o("span",{children:"Last check failed — will retry automatically"})]}):o(V,{children:[o("span",{className:`${v.statusDot} ${v.statusDotIdle}`,"aria-hidden":"true"}),o("span",{children:r?.lastRunAt?`Last checked ${Math.max(1,Math.round((Date.now()-r.lastRunAt)/1e3))}s ago`:"Auto-checks every few minutes"})]})}),o("div",{className:v.list,children:t&&n.length===0?o(Fi,{count:4}):o(V,{children:[n.map(d=>o("div",{className:v.item,children:[o("div",{className:v.thumbnail,style:{background:"transparent",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:0,boxShadow:"none"},children:o(g,{name:"info-circle",size:32,color:"#6c9fff"})}),o("div",{className:v.itemInfo,children:[o("span",{className:v.itemTitle,children:d.title}),o("button",{type:"button",className:v.systemItemMeta,onClick:()=>c(d.id),title:"View full status",children:d.message.length>40?d.message.slice(0,40)+"…":d.message})]}),o("button",{className:v.removeItem,disabled:!0,style:{opacity:.3,cursor:"not-allowed"},"aria-hidden":"true",children:o(g,{name:"plus"})}),o("button",{className:v.removeItem,disabled:!0,style:{opacity:.3,cursor:"not-allowed"},"aria-hidden":"true",children:o(g,{name:"times"})})]},d.id)),n.length>0&&e.length>0&&o("div",{className:v.notificationDivider}),e.length>0?e.map(d=>o(Mi,{notification:d},d.id)):!t&&n.length===0&&o("div",{className:v.emptyState,children:"No new notifications"})]})}),u&&Jt(o("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0, 0, 0, 0.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:9999,padding:"1rem",backdropFilter:"blur(3px)"},onClick:()=>c(null),children:o("div",{style:{backgroundColor:"var(--bg-secondary)",padding:"1.5rem",borderRadius:"var(--radius-lg)",maxWidth:"420px",width:"100%",boxShadow:"var(--shadow-xl)",border:"1px solid var(--border-primary)"},onClick:d=>d.stopPropagation(),children:[o("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem",marginBottom:"1rem"},children:[o(g,{name:"info-circle",color:"#6c9fff"}),o("span",{style:{color:"#fff",fontWeight:600,fontSize:"1rem"},children:u.title})]}),o("p",{style:{color:"var(--text-secondary)",marginBottom:"1.5rem",lineHeight:1.5},children:u.message}),o("div",{style:{display:"flex",justifyContent:"flex-end"},children:o("button",{type:"button",onClick:()=>c(null),style:{background:"var(--accent)",color:"#fff",border:"none",padding:"0.5rem 1rem",borderRadius:"var(--radius-md)",cursor:"pointer",fontWeight:600},children:"OK"})})]})}),document.body)]})},Wi=()=>{const[e,t]=S(!1),n=B(null),r=K(),i=N(),s=hi(),{data:a=[]}=gn(),{data:c=[]}=bn(),{data:l}=_n(),u=a.length+c.length,d=u>5?"5+":u,m=B(!1);w(()=>{const p=f=>{n.current&&!n.current.contains(f.target)&&t(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[]),w(()=>{const p=!!l?.running;m.current&&!p&&(r.invalidateQueries(i.notifications.pathFilter()),r.invalidateQueries(i.discovery.pathFilter())),m.current=p},[l?.running,r,i]);const h=()=>{const p=!e;t(p),p&&s.mutate()};return o("div",{className:v.container,ref:n,children:[o("button",{className:v.bellBtn,onClick:h,"aria-label":"Notifications",children:[o(g,{name:"bell"}),u>0&&o("span",{className:v.badge,children:d})]}),e&&o(Bi,{})]})},ze=e=>{const t=N();return z({...t.settings.getByKey.queryOptions({key:e}),select:n=>n.value})},wn=()=>{const e=N(),t=K();return X(e.settings.set.mutationOptions({onSuccess:()=>{b.success("Setting updated!"),t.invalidateQueries(e.settings.pathFilter()),t.invalidateQueries({queryKey:["settings"]})},onError:n=>{b.error(`Failed to update setting: ${n.message}`)}}))},En=ce(void 0),Qi=()=>{const e=le(En);if(e===void 0)throw new Error("useLowEndMode must be used within a LowEndModeProvider");return e},oe={x:-2.8,y:-2,w:48.6,h:14},st=15,Se={w:13.6,h:10.2},ae=[{x:0,y:.5},{x:st,y:-.9},{x:st*2,y:.3}],Nt={x:Se.w/2,y:Se.h/2-.5},Je={y:Se.h/2,x1:-2,x2:st*2+Se.w+1.4},At=(e,t,n,r=0)=>{if(n.width<=0)return-1;const i=n.width/oe.w,s=(e-n.left)/i+oe.x,a=(t-n.top)/i+oe.y;for(let c=0;c<ae.length;c++){const l=s-ae[c].x,u=a-ae[c].y;if(l>=-r&&l<=Se.w+r&&u>=-r&&u<=Se.h+r)return c}return-1},qt=7.5,Lt=e=>Math.max(-1,Math.min(1,e)),Ki=(e,t,n,r)=>{const i=n.width/oe.w,s=(e-n.left)/i+oe.x-r.x-Nt.x,a=(t-n.top)/i+oe.y-r.y-Nt.y;return{x:Lt(s/qt),y:Lt(a/qt)}},Ui=["normal","squint"],Hi={normal:.72,squint:.28},Rt=(e=Math.random(),t)=>{let n=0;for(const r of Ui)if(n+=Hi[r],e<n)return r===t?r==="normal"?"squint":"normal":r;return"normal"},Vi="pet",zi="sleep",Gi=6e3,Yi=420,Ji=.5,$t=3e3,Zi=3e3,Xi=ae.map((e,t)=>t*260),Ze={from:ae.length-2,to:ae.length-1,after:400},Dt="data-dango-face",Xe="data-dango-hover",et="data-dango-cheer",jt="data-dango-nudge",es=()=>document.querySelectorAll("svg[data-dango-gaze-origin]"),De=()=>document.querySelectorAll("[data-dango-face-slot]"),ts=e=>e.querySelectorAll("[data-dango-eye]"),ns=()=>document.querySelectorAll("[data-dango-eye]"),kn=()=>{const{data:e}=ze("dangoGaze"),{lowEndMode:t}=Qi();return e!=="false"&&!t},rs=()=>{const e=kn();w(()=>{if(!e||window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;const t=ae.map(()=>"normal");let n=-1,r=-1,i=!1,s=-1,a=0,c=0,l=0,u=0,d=0;const m=[],h=(y,C)=>{const _=window.setTimeout(()=>{m.splice(m.indexOf(_),1),y()},C);m.push(_)},p=(y,C,_)=>{De().forEach($=>{Number($.getAttribute("data-dango-face-slot"))===y&&(_?$.setAttribute(C,""):$.removeAttribute(C))})},f=y=>De().forEach(C=>C.removeAttribute(y)),I=(y,C,_)=>{f(C),requestAnimationFrame(()=>{p(y,C,!0),h(()=>f(C),_)})},P=()=>{De().forEach(y=>{const C=Number(y.getAttribute("data-dango-face-slot"));y.setAttribute(Dt,r===C?Vi:t[C]),n===C?y.setAttribute(Xe,""):y.removeAttribute(Xe)})},R=y=>{y!==r&&(r>=0&&p(r,et,!1),r=y,y>=0&&p(y,et,!0))},O=()=>{window.clearTimeout(d),d=window.setTimeout(()=>{R(-1),P()},Yi)},E=()=>{window.clearTimeout(d),R(-1)},D=()=>{i=!1,Xi.forEach((y,C)=>{h(()=>{t[C]=Rt(),C===Ze.from&&h(()=>I(Ze.to,jt,520),Ze.after),P()},y)})},de=()=>{i=!0,t.fill(zi),E(),P()},G=()=>{window.clearTimeout(u),u=window.setTimeout(de,Gi)},be=()=>{i||(s=(s+1)%t.length,t[s]=Rt(Math.random(),t[s]),P()),h(be,$t+Math.random()*Zi)},ee=()=>{const y=Array.from(es(),Y=>[Y,Y.getBoundingClientRect()]);y.forEach(([Y,Le])=>{ts(Y).forEach(we=>{const{x:te,y:ve}=Ki(c,l,Le,ae[Number(we.getAttribute("data-dango-eye"))]);we.style.setProperty("--dango-gaze-x",te.toFixed(3)),we.style.setProperty("--dango-gaze-y",ve.toFixed(3))})});const C=y.find(([,Y])=>c>=Y.left&&c<=Y.right&&l>=Y.top&&l<=Y.bottom)?.[1]??null,_=n,$=r,ie=C?At(c,l,C):-1,xe=ie>=0?ie:C?At(c,l,C,Ji):-1;n=ie,xe>=0?(R(xe),O()):E(),(_!==n||$!==r)&&P(),i&&D(),G()},_e=y=>{c=y.clientX,l=y.clientY,!a&&(a=requestAnimationFrame(()=>{a=0,ee()}))},ye=y=>{y.relatedTarget||(n=-1,E(),P(),G())};return P(),G(),h(be,$t),window.addEventListener("pointermove",_e,{passive:!0}),window.addEventListener("pointerout",ye),()=>{cancelAnimationFrame(a),window.clearTimeout(u),window.clearTimeout(d),m.forEach(window.clearTimeout),window.removeEventListener("pointermove",_e),window.removeEventListener("pointerout",ye),ns().forEach(y=>{y.style.removeProperty("--dango-gaze-x"),y.style.removeProperty("--dango-gaze-y")}),De().forEach(y=>{y.setAttribute(Dt,"normal"),y.removeAttribute(Xe),y.removeAttribute(et),y.removeAttribute(jt)})}},[e])},Sn=ce(void 0),_l=()=>{const e=le(Sn);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e},wl=[{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"}],os={iris:{fill:"#897cff",stroke:"#5646db"},mochi:{fill:"#e3e1ee",stroke:"#b3b1c6"},sakura:{fill:"#e1afef",stroke:"#a978a9"}},is="_logo_t3il2_1",ss="_skewer_t3il2_8",as="_gaze_t3il2_15",cs="_face_t3il2_20",ls="_faceNormal_t3il2_25",us="_facePet_t3il2_26",ds="_faceSquint_t3il2_27",ms="_faceSleep_t3il2_28",hs="_line_t3il2_36",ps="_sway_t3il2_44",fs="_weight_t3il2_58",ys="_shift_t3il2_73",vs="_rock_t3il2_87",gs="_glance_t3il2_105",bs="_blinkDouble_t3il2_129 _blink_t3il2_124",_s="_blinkSlow_t3il2_153 _blink_t3il2_124",ws="_bump_t3il2_172",Es="_heart_t3il2_189",j={logo:is,skewer:ss,gaze:as,face:cs,faceNormal:ls,facePet:us,faceSquint:ds,faceSleep:ms,line:hs,sway:ps,weight:fs,shift:ys,rock:vs,glance:gs,blinkDouble:bs,blinkSlow:_s,bump:ws,heart:Es},Mt="#140f15",ks="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",Ss="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",Ps="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",xs={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"},Pn=[{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}],Ie=(e,t)=>e+Math.random()*(t-e),Ts=Pn.map(()=>({blinkDelay:-Ie(0,9),blinkDuration:Ie(3.4,8.6),motionDelay:-Ie(0,9),motionDuration:Ie(5.5,11),glanceDelay:-Ie(0,11)})),Is={double:j.blinkDouble,slow:j.blinkSlow},Os={weight:j.weight,shift:j.shift,rock:j.rock},Cs={normal:j.faceNormal,pet:j.facePet,squint:j.faceSquint,sleep:j.faceSleep},Ns=["normal","pet","squint","sleep"],As=[{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"}],vt=({className:e})=>{const t=kn();return o("svg",{viewBox:`${oe.x} ${oe.y} ${oe.w} ${oe.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 ${Je.x1},${Je.y} H ${Je.x2}`}),Pn.map((n,r)=>{const{x:i,y:s}=ae[r],a=Ts[r],{fill:c,stroke:l}=os[n.hue],u=o("g",{"data-dango-eye":r,className:j.gaze,style:{"--gaze-dur":`${(.12+n.lag*.18).toFixed(3)}s`},children:Ns.map(d=>o("g",{className:`${j.face} ${Cs[d]}`,children:o("g",{className:t&&d==="normal"?Is[n.blink]:void 0,style:t&&d==="normal"?{animationDelay:`${a.blinkDelay}s`,animationDuration:`${a.blinkDuration}s`}:void 0,children:d==="normal"?o(V,{children:[o("path",{fill:Mt,d:Ss}),o("path",{fill:Mt,d:Ps})]}):o("path",{className:j.line,d:xs[d]})})},d))});return o("g",{transform:`translate(${i} ${s})`,children:o("g",{"data-dango-face-slot":r,"data-dango-face":"normal",className:t?Os[n.motion]:void 0,style:t?{animationDelay:`${a.motionDelay}s`,animationDuration:`${a.motionDuration}s`}:void 0,children:[o("path",{fill:c,stroke:l,strokeWidth:"0.9",strokeLinejoin:"round",paintOrder:"stroke fill",d:ks}),o("g",{className:j.bump,children:[t&&n.glances?o("g",{className:j.glance,style:{animationDelay:`${a.glanceDelay}s`},children:u}):u,t&&o("g",{children:As.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)})]})})},xn=ce(void 0),gt=()=>{const e=le(xn);if(e===void 0)throw new Error("useSidebar must be used within a SidebarProvider");return e},Tn=ce(void 0),In=()=>{const e=le(Tn);if(e===void 0)throw new Error("useContentType must be used within a ContentTypeProvider");return e},at="virtual-keyboard:hide",Ft="virtual-keyboard:enabled-change",On="virtual_keyboard_enabled",qs=!1;function Bt(){const e=localStorage.getItem(On);return e===null?qs:e==="true"}const Wt=e=>e instanceof HTMLInputElement&&e.type==="text"&&!e.disabled&&!e.readOnly;function Ls(){window.dispatchEvent(new CustomEvent(at))}function Rs(){const[e,t]=S(!1),[n,r]=S(Bt),i=B(null);return w(()=>{const s=d=>{n&&Wt(d.target)&&(i.current=d.target,t(!0))},a=d=>{d.target===i.current&&window.setTimeout(()=>{if(Wt(document.activeElement)){i.current=document.activeElement,t(!0);return}i.current=null,t(!1)},0)},c=()=>{i.current=null,t(!1)},l=d=>{if(d.key!==On)return;const m=d.newValue==="true";r(m),m||c()},u=()=>{const d=Bt();r(d),d||c()};return document.addEventListener("focusin",s),document.addEventListener("focusout",a),window.addEventListener(at,c),window.addEventListener("storage",l),window.addEventListener(Ft,u),()=>{document.removeEventListener("focusin",s),document.removeEventListener("focusout",a),window.removeEventListener(at,c),window.removeEventListener("storage",l),window.removeEventListener(Ft,u)}},[n]),{activeInputRef:i,isVisible:n&&e,hide:()=>t(!1)}}const $s="_header_q6huj_1",Ds="_hidden_q6huj_21",js="_scrolled_q6huj_25",Ms="_logo_q6huj_31",Fs="_headerInner_q6huj_44",Bs="_leftSection_q6huj_54",Ws="_desktopNav_q6huj_60",Qs="_navLink_q6huj_67",Ks="_navLinkActive_q6huj_83",Us="_rightSection_q6huj_102",Hs="_searchWrapper_q6huj_108",Vs="_searchInput_q6huj_114",zs="_searchButton_q6huj_144",Gs="_searchIcon_q6huj_168",Ys="_profileBtn_q6huj_178",Js="_profileImg_q6huj_211",Zs="_hamburgerBtn_q6huj_217",Xs="_mobileSearchBar_q6huj_244",ea="_mobileSearchBarHidden_q6huj_271",ta="_mobileSearchInner_q6huj_288",na="_mobileSearchIcon_q6huj_304",ra="_mobileSearchInput_q6huj_311",k={header:$s,hidden:Ds,scrolled:js,logo:Ms,headerInner:Fs,leftSection:Bs,desktopNav:Ws,navLink:Qs,navLinkActive:Ks,rightSection:Us,searchWrapper:Hs,searchInput:Vs,searchButton:zs,searchIcon:Gs,profileBtn:Ys,profileImg:Js,hamburgerBtn:Zs,mobileSearchBar:Xs,mobileSearchBarHidden:ea,mobileSearchInner:ta,mobileSearchIcon:na,mobileSearchInput:ra},oa=async()=>{let e;try{e=await Z.auth.syncSettings.query()}catch{return null}const t=e.actualActiveProvider;if(t==="github")try{const n=await Z.auth.githubStatus.query();if(n.authenticated&&n.user)return{name:n.user.name||n.user.login,picture:n.user.avatarUrl,provider:"github"}}catch{}if(t==="google")try{const n=await Z.auth.user.query();if(n)return{name:n.name,picture:n.picture,email:n.email,provider:"google"}}catch{}return null},ia=()=>{const{toggleSidebar:e}=gt(),{contentType:t}=In(),[n,r]=S(""),[i,s]=S(!0),[a,c]=S(!1),[l,u]=S(!0),[d,m]=S(!1),h=Fn(),p=dt(),f=B(null),I=B(!1),P=B(null),R=B(null),O=B(null),E=B(null),D=B(!1),{data:de}=z({queryKey:["sync-profile"],queryFn:oa,staleTime:3e4});w(()=>{const _=window.visualViewport;if(!_)return;const $=()=>{E.current?.style.setProperty("--vv-top",`${_.offsetTop}px`)};return $(),_.addEventListener("scroll",$),_.addEventListener("resize",$),()=>{_.removeEventListener("scroll",$),_.removeEventListener("resize",$)}},[]),w(()=>{const _=()=>{f.current&&(window.clearTimeout(f.current),f.current=null)},$=()=>{_(),!(window.scrollY<=10)&&(f.current=window.setTimeout(()=>{D.current||s(!1)},2500))},ie=()=>{I.current||(I.current=!0,P.current=requestAnimationFrame(()=>{I.current=!1,P.current=null;const te=window.scrollY<=10;u(ve=>ve===te?ve:te),s(ve=>ve||!0),$()}))},xe=te=>{(te.metaKey||te.ctrlKey)&&te.key==="k"?(te.preventDefault(),G.current?.focus({preventScroll:!0})):te.key==="Escape"&&document.activeElement===G.current&&G.current?.blur()},Y=E.current,Le=()=>{D.current=!0},we=()=>{D.current=!1,$()};return window.addEventListener("scroll",ie,{passive:!0}),window.addEventListener("keydown",xe),Y?.addEventListener("pointerenter",Le),Y?.addEventListener("pointerleave",we),()=>{window.removeEventListener("scroll",ie),window.removeEventListener("keydown",xe),Y?.removeEventListener("pointerenter",Le),Y?.removeEventListener("pointerleave",we),_(),P.current!==null&&(cancelAnimationFrame(P.current),P.current=null),I.current=!1}},[a]);const G=ut.useRef(null),be=()=>window.innerWidth<=1024,ee=()=>{be()?(m(!0),setTimeout(()=>O.current?.focus({preventScroll:!0}),50)):document.activeElement===G.current&&n.trim()?C():G.current?.focus({preventScroll:!0})},_e=_=>{R.current?.contains(_.relatedTarget)||m(!1)},ye=p.pathname==="/music"?"Search music...":t==="manga"?"Search manga...":t==="tv"?"Search TV & movies...":t==="asmr"?"Search ASMR...":"Search anime...",y=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"},C=_=>{Ls();const $=n.trim();if($){if(p.pathname==="/music"){const ie=new URLSearchParams(p.search);ie.set("q",$),h(`/music?${ie.toString()}`);return}h(t==="manga"?`/manga?q=${encodeURIComponent($)}`:t==="tv"?`/tv-search?q=${encodeURIComponent($)}`:t==="asmr"?`/asmr?q=${encodeURIComponent($)}`:`/search?query=${encodeURIComponent($)}`)}};return o(V,{children:o("header",{ref:E,className:`${k.header} ${i?"":k.hidden} ${l?"":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(g,{name:"bars"})}),o(J,{to:"/",className:k.logo,"aria-label":"Ani-Web Home",children:o(vt,{})}),o("nav",{className:k.desktopNav,children:[o(J,{to:"/",className:`${k.navLink} ${p.pathname==="/"?k.navLinkActive:""}`,children:"Home"}),o(J,{to:y.to,className:`${k.navLink} ${p.pathname.startsWith(y.to)?k.navLinkActive:""}`,children:y.label}),t==="anime"&&o(J,{to:"/insights",className:`${k.navLink} ${p.pathname==="/insights"?k.navLinkActive:""}`,children:"Insights"}),o(J,{to:"/settings",className:`${k.navLink} ${p.pathname.startsWith("/settings")?k.navLinkActive:""}`,children:"Settings"})]})]}),o("div",{className:k.rightSection,children:[o("div",{className:k.searchWrapper,children:[o("input",{ref:G,type:"text","data-virtual-keyboard":"true",className:k.searchInput,placeholder:ye,value:n,onChange:_=>r(_.target.value),onFocus:()=>c(!0),onBlur:()=>c(!1),onKeyDown:_=>{_.key==="Enter"&&C()}}),o("button",{type:"button",className:k.searchButton,"aria-label":"Search",onMouseDown:_=>_.preventDefault(),onClick:ee,children:o(g,{name:"search",className:k.searchIcon})})]}),o(Wi,{}),o(J,{to:"/settings?tab=sync",className:k.profileBtn,"aria-label":"Sync settings",children:de?.picture?o("img",{src:de.picture,alt:de.name,className:k.profileImg,referrerPolicy:"no-referrer",decoding:"async"}):de?.provider==="github"?o(g,{name:"github"}):o(g,{name:"cloud"})})]})]}),d&&o("div",{className:`${k.mobileSearchBar} ${i?"":k.mobileSearchBarHidden}`,ref:R,onBlur:_e,children:o("div",{className:k.mobileSearchInner,children:[o(g,{name:"search",className:k.mobileSearchIcon}),o("input",{ref:O,type:"text","data-virtual-keyboard":"true",className:k.mobileSearchInput,placeholder:ye,value:n,onChange:_=>r(_.target.value),onKeyDown:_=>{_.key==="Enter"?(C(),m(!1)):_.key==="Escape"&&m(!1)}})]})})]})})},ct="agreedToViewMature";function Qt(){try{return localStorage.getItem(ct)==="true"}catch{return!1}}function sa(){const[e,t]=S(Qt);w(()=>{const i=()=>t(Qt());return window.addEventListener("storage",i),window.addEventListener("focus",i),()=>{window.removeEventListener("storage",i),window.removeEventListener("focus",i)}},[]);const n=Q(()=>{try{localStorage.setItem(ct,"true")}catch{}t(!0)},[]),r=Q(()=>{try{localStorage.removeItem(ct)}catch{}t(!1)},[]);return{hasConsent:e,grant:n,revoke:r}}const aa="_sidebar_153jc_1",ca="_open_153jc_20",la="_sidebarHeader_153jc_25",ua="_closeBtn_153jc_33",da="_logo_153jc_57",ma="_navSection_153jc_69",ha="_navLink_153jc_75",pa="_active_153jc_108",fa="_overlay_153jc_118",ya="_versionInfo_153jc_138",ne={sidebar:aa,open:ca,sidebarHeader:la,closeBtn:ua,logo:da,navSection:ma,navLink:ha,active:pa,overlay:fa,versionInfo:ya},va="3.6.4",Cn={version:va},ga=()=>{const{isOpen:e,setIsOpen:t}=gt(),{contentType:n}=In(),{hasConsent:r}=sa(),i=()=>{t(!1)},s=n==="manga",a=n==="tv",c=n==="asmr",l=[{to:"/",icon:o(g,{name:"home"}),label:"Home"},s?{to:"/manga",icon:o(g,{name:"book"}),label:"Manga"}:a?{to:"/tv-search",icon:o(g,{name:"tv"}),label:"TV and Movies"}:c?{to:"/asmr",icon:o(g,{name:"headphones"}),label:"ASMR"}:{to:"/search",icon:o(g,{name:"search"}),label:"Search"},s?{to:"/reading-list",icon:o(g,{name:"bookmark"}),label:"Reading List"}:a?{to:"/tv-watchlist",icon:o(g,{name:"clock"}),label:"TV Watchlist"}:c?{to:"/listening-list",icon:o(g,{name:"history"}),label:"Listening List"}:{to:"/watchlist",icon:o(g,{name:"clock"}),label:"Watchlist"},...n==="anime"?[{to:"/insights",icon:o(g,{name:"chart-pie"}),label:"Insights"}]:[],{to:"/trackers",icon:o(g,{name:"sync-alt"}),label:"Trackers"},{to:"/radio",icon:o(g,{name:"broadcast-tower"}),label:"Radio"},{to:"/music",icon:o(g,{name:"headphones"}),label:"Music"},...r?[{to:"/mature",icon:o(g,{name:"pepper-hot"}),label:"Mature"}]:[],{to:"/settings",icon:o(g,{name:"cog"}),label:"Settings"}];return o(V,{children:[o("aside",{className:`${ne.sidebar} ${e?ne.open:""} sidebar`,children:[o("div",{className:ne.sidebarHeader,children:[o("button",{className:ne.closeBtn,onClick:()=>t(!1),"aria-label":"Close menu",children:"×"}),o(J,{to:"/",className:ne.logo,onClick:i,children:o(vt,{})})]}),o("nav",{className:ne.navSection,children:l.map(u=>o(Bn,{to:u.to,className:({isActive:d})=>`${ne.navLink} ${d?ne.active:""}`,onClick:i,end:u.to==="/",children:[u.icon,o("span",{children:u.label})]},u.to))}),o("div",{className:ne.versionInfo,children:["v",Cn.version]})]}),e&&o("div",{className:ne.overlay,onClick:()=>t(!1),"aria-label":"Close sidebar"})]})},ba="_footer_1c905_1",_a="_footerInner_1c905_15",wa="_brandSection_1c905_27",Ea="_logoRow_1c905_39",ka="_logoText_1c905_45",Sa="_brandMeta_1c905_51",Pa="_brandTagline_1c905_60",xa="_statusPill_1c905_67",Ta="_statusDot_1c905_80",Ia="_linksGrid_1c905_88",Oa="_linkColumn_1c905_96",Ca="_columnTitle_1c905_102",Na="_bottomBar_1c905_126",Aa="_copyright_1c905_136",qa="_brand_1c905_27",La="_heartIcon_1c905_152",Ra="_backToTop_1c905_157",A={footer:ba,footerInner:_a,brandSection:wa,logoRow:Ea,logoText:ka,brandMeta:Sa,brandTagline:Pa,statusPill:xa,statusDot:Ta,linksGrid:Ia,linkColumn:Oa,columnTitle:Ca,bottomBar:Na,copyright:Aa,brand:qa,heartIcon:La,backToTop:Ra},$a=()=>{const e=new Date().getFullYear(),t=()=>{window.scrollTo({top:0,behavior:"smooth"})};return o("footer",{className:A.footer,children:[o("div",{className:A.footerInner,children:[o("div",{className:A.brandSection,children:[o("div",{className:A.logoRow,children:o(vt,{className:A.logoText})}),o("div",{className:A.brandMeta,children:[o("div",{className:A.statusPill,children:[o("span",{className:A.statusDot}),o("span",{children:["v",Cn.version]})]}),o("p",{className:A.brandTagline,children:"Fast, local anime streaming."})]})]}),o("div",{className:A.linksGrid,children:[o("div",{className:A.linkColumn,children:[o("h4",{className:A.columnTitle,children:"Navigation"}),o(J,{to:"/",children:"Home"}),o(J,{to:"/watchlist",children:"Watchlist"}),o(J,{to:"/settings",children:"Settings"})]}),o("div",{className:A.linkColumn,children:[o("h4",{className:A.columnTitle,children:"Features"}),o(J,{to:"/search",children:"Search Anime"}),o(J,{to:"/trackers",children:"Trackers"}),o(J,{to:"/insights",children:"Insights"})]}),o("div",{className:A.linkColumn,children:[o("h4",{className:A.columnTitle,children:"Community"}),o("a",{href:"https://discord.gg/6yT3VwTqz9",target:"_blank",rel:"noopener noreferrer",children:[o(g,{name:"discord",style:{marginRight:"6px"}})," Discord"]}),o("a",{href:"https://github.com/serifpersia/dango",target:"_blank",rel:"noopener noreferrer",children:[o(g,{name:"github",style:{marginRight:"6px"}})," GitHub"]})]}),o("div",{className:A.linkColumn,children:[o("h4",{className:A.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:A.bottomBar,children:[o("p",{className:A.copyright,children:["© ",e," ",o("span",{className:A.brand,children:"dango"})," • Crafted with"," ",o(g,{name:"heart",className:A.heartIcon})," by"," ",o("a",{href:"https://github.com/serifpersia",target:"_blank",rel:"noopener noreferrer",children:"serifpersia"})]}),o("button",{className:A.backToTop,onClick:t,"aria-label":"Back to top",children:[o(g,{name:"chevron-up",size:14}),o("span",{children:"Top"})]})]})]})};function Nn(e){return JSON.stringify({0:e??{}})}function An(e){return`/api/trpc/${e}?batch=1`}function lt(e,t){const n=Nn(t),r=An(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 El(e,t){await fetch(An(e),{method:"POST",headers:{"Content-Type":"application/json"},body:Nn(t),keepalive:!0})}function kl(e){e&&(lt("discord.clear",{sessionId:e}),lt("discord.heartbeat",{sessionId:e,bye:!0}))}function Da(){const e=dt(),{data:t}=ze("discordRPCEnabled"),n=B("");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,i=()=>Z.discord.heartbeat.mutate({sessionId:r}).catch(()=>{});i();const s=setInterval(i,15e3),a=()=>{lt("discord.heartbeat",{sessionId:r,bye:!0})};return window.addEventListener("pagehide",a),()=>{clearInterval(s),window.removeEventListener("pagehide",a)}},[t]),w(()=>{if(t===!1||t==="false")return;const r=e.pathname;if(r.startsWith("/watch/")||r.startsWith("/player/"))return;let i="home";r.startsWith("/search")||r.startsWith("/mature")?i="search":r.startsWith("/watchlist")?i="watchlist":r.startsWith("/anime/")?i="anime":r.startsWith("/insights")?i="insights":r.startsWith("/settings")?i="settings":r.startsWith("/trackers")?i="trackers":r.startsWith("/asmr")?i="asmr":r.startsWith("/manga")?i="manga":r.startsWith("/radio")?i="radio":r.startsWith("/music")?i="music":r.startsWith("/tv")&&(i="tv"),Z.discord.pageStatus.mutate({page:i}).catch(()=>{})},[e.pathname,t])}function qn(e,t){const[n,r]=S(()=>{try{const s=localStorage.getItem(e);if(s===null)return t;if(typeof t=="string")return s;try{return JSON.parse(s)}catch{return s}}catch{return t}});w(()=>{const s=a=>{if(a.key===e)try{if(a.newValue===null){r(t);return}if(typeof t=="string"){r(a.newValue);return}try{r(JSON.parse(a.newValue))}catch{r(a.newValue)}}catch{}};return window.addEventListener("storage",s),()=>window.removeEventListener("storage",s)},[e,t]);const i=Q(s=>{r(a=>{const c=typeof s=="function"?s(a):s;try{typeof c=="string"?localStorage.setItem(e,c):localStorage.setItem(e,JSON.stringify(c))}catch{}return c})},[e]);return[n,i]}const Ln=ce(void 0),ja=()=>{const e=le(Ln);if(!e)throw new Error("useAnimePaheCookie must be used within an AnimePaheCookieProvider");return e},Ma="_overlay_1juub_1",Fa="_fadeIn_1juub_1",Ba="_content_1juub_11",Wa="_modalIn_1juub_1",Qa="_sm_1juub_29",Ka="_md_1juub_33",Ua="_lg_1juub_37",Ha="_title_1juub_41",Va="_body_1juub_48",za="_footer_1juub_52",ke={overlay:Ma,fadeIn:Fa,content:Ba,modalIn:Wa,sm:Qa,md:Ka,lg:Ua,title:Ha,body:Va,footer:za};function Rn({children:e}){return o("h2",{className:ke.title,children:e})}function $n({children:e}){return o("div",{className:ke.body,children:e})}function Dn({children:e}){return o("div",{className:ke.footer,children:e})}function qe({isOpen:e,onClose:t,title:n,children:r,footer:i,width:s="md"}){const a=B(null);return w(()=>{if(!e)return;const c=u=>{u.key==="Escape"&&t?.()};document.addEventListener("keydown",c);const l=document.body.style.overflow;return document.body.style.overflow="hidden",a.current?.focus(),()=>{document.removeEventListener("keydown",c),document.body.style.overflow=l}},[e,t]),e?Jt(o("div",{role:"presentation",onMouseDown:c=>c.stopPropagation(),children:[o("div",{className:ke.overlay,onClick:()=>t?.(),"aria-hidden":"true"}),o("div",{ref:a,className:`${ke.content} ${ke[s]}`,role:"dialog","aria-modal":"true","aria-label":n,tabIndex:-1,children:[n&&o(Rn,{children:n}),o($n,{children:r}),i&&o(Dn,{children:i})]})]}),document.body):null}qe.Header=Rn;qe.Body=$n;qe.Actions=Dn;const Ga="_container_e96gf_1",Ya="_field_e96gf_9",Ja="_textarea_e96gf_20",Za="_input_e96gf_40",Xa="_button_e96gf_58",ec="_secondaryButton_e96gf_78",tc="_actions_e96gf_95",nc="_hint_e96gf_104",rc="_link_e96gf_117",U={container:Ga,field:Ya,textarea:Ja,input:Za,button:Xa,secondaryButton:ec,actions:tc,hint:nc,link:rc},oc="https://github.com/serifpersia/dango/releases/latest/download/dango-extension.zip",ic=e=>{try{return JSON.parse(e.detail)}catch{return null}},sc=({isOpen:e,onClose:t,onSuccess:n})=>{const[r,i]=S(1),[s,a]=S(navigator.userAgent),[c,l]=S(""),[u,d]=S(!1),m=B(null),h=navigator.userAgent,p=/android/i.test(h),f=/firefox|fxios/i.test(h)&&!p,I=!f&&!p&&/chrome|chromium|edg|brave/i.test(h),P=f||I;w(()=>{e&&(i(1),a(navigator.userAgent),l(""),d(!1))},[e]),w(()=>()=>{m.current&&(window.removeEventListener("dango:pahe-cookie",m.current),m.current=null)},[]);const R=()=>{localStorage.setItem("animepahe_ua",s),window.open("https://animepahe.pw","_blank","noopener,noreferrer"),i(2)},O=()=>{if(u)return;d(!0);const D=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,de=window.setTimeout(()=>{d(!1),m.current&&(window.removeEventListener("dango:pahe-cookie",m.current),m.current=null),b.error("Helper not detected — install it via about:debugging first.")},3e3),G=be=>{const ee=ic(be);if(!(!ee||ee.requestId!==D))if(window.clearTimeout(de),window.removeEventListener("dango:pahe-cookie",G),m.current=null,d(!1),ee?.ok&&ee.cookie)l(ee.cookie),b.success("Cookie extracted from helper!");else if(ee?.error==="NO_COOKIE"){const _e=ee.debug?.stores?.length??0,ye=ee.debug?.names??[];b.error(`Helper found no cf_clearance (checked ${_e} stores, saw: ${ye.join(", ")||"none"}) — solve the challenge on the AnimePahe tab first.`)}else b.error("Helper request failed — try again.")};m.current=G,window.addEventListener("dango:pahe-cookie",G),window.dispatchEvent(new CustomEvent("dango:get-pahe-cookie",{detail:{requestId:D}}))},E=()=>{const D=c.trim();if(!D){b.error("Please enter the cf_clearance cookie");return}try{localStorage.setItem("animepahe_cookie",D),b.success("Cookie updated successfully! Reloading…"),n?.(),t(),window.setTimeout(()=>window.location.reload(),1e3)}catch{b.error("Failed to save cookie")}};return o(qe,{isOpen:e,onClose:t,title:"AnimePahe Verification Required",children:o("div",{className:U.container,children:r===1?o(V,{children:[o("p",{children:"AnimePahe requires a manual verification to bypass Cloudflare/DDoS-Guard protection."}),o("div",{className:U.field,children:[o("label",{children:"Your User-Agent (will be used for requests):"}),o("textarea",{value:s,readOnly:!0,rows:3,className:U.textarea})]}),o("div",{className:U.actions,children:[o("button",{className:U.secondaryButton,onClick:t,children:"Cancel"}),o("button",{className:U.button,onClick:R,children:"Start Verification (Opens AnimePahe)"})]})]}):o(V,{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."]}),P&&o("div",{className:U.hint,children:[o("strong",{children:"Dango helper (one-time setup):"})," ",f?o(V,{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(V,{children:["type ",o("code",{children:"chrome://extensions"})," in the address bar → enable"," ",o("strong",{children:"Developer mode"})," → ",o("strong",{children:"Load unpacked"})," → open the ",o("code",{children:"dango-extension/chrome"})," folder. (Unpacked helpers show a developer-mode notice — expected.)"]})," ","Use this link to download the extension and extract it:"," ",o("a",{href:oc,target:"_blank",rel:"noreferrer",className:U.link,children:"dango-extension.zip"}),". Then click Extract below and the field fills itself.",o("div",{className:U.actions,children:o("button",{className:U.button,onClick:O,disabled:u,type:"button",children:u?"Extracting…":"Extract cookie from helper"})})]}),o("div",{className:U.field,children:[o("label",{children:"cf_clearance cookie value:"}),o("input",{type:"text",value:c,onChange:D=>l(D.target.value),placeholder:"e.g. xxxxxxxx.xxxxxxxx.xxxxxxx-xxxxxxx",className:U.input})]}),o("div",{className:U.actions,children:[o("button",{className:U.secondaryButton,onClick:t,children:"Cancel"}),o("button",{className:U.secondaryButton,onClick:()=>i(1),children:"Back"}),o("button",{className:U.button,onClick:E,children:"Submit"})]})]})})})};function ac(){const[e,t]=S(!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}class cc extends Wn{state={hasError:!1};static getDerivedStateFromError(t){return{hasError:!0}}componentDidCatch(t,n){console.error("Uncaught error:",t,n)}render(){return this.state.hasError?o("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100vh",width:"100%",backgroundColor:"#1a1b1c",color:"#fff",textAlign:"center",padding:"2rem"},children:[o(g,{name:"exclamation-triangle",style:{fontSize:"4rem",color:"#ff4d4d",marginBottom:"1rem"}}),o("h1",{style:{marginBottom:"1rem"},children:"Something went wrong"}),o("p",{style:{color:"#aaa",marginBottom:"2rem"},children:"The application encountered an unexpected error."}),o("button",{onClick:()=>{this.setState({hasError:!1}),window.location.href="/"},style:{padding:"0.8rem 1.5rem",backgroundColor:"var(--accent, #3d5afe)",color:"#fff",border:"none",borderRadius:"0.5rem",cursor:"pointer",display:"flex",alignItems:"center",gap:"0.5rem",fontSize:"1rem",transition:"background-color 0.2s"},onMouseOver:t=>t.currentTarget.style.backgroundColor="#536dfe",onMouseOut:t=>t.currentTarget.style.backgroundColor="var(--accent, #3d5afe)",children:[o(g,{name:"home"}),"Go back Home"]})]}):this.props.children}}const jn=ce(void 0),lc=({children:e})=>{const[t,n]=S(!1),r=Q(()=>n(!0),[]),i=Q(()=>n(!1),[]);return w(()=>fn("lan",r),[r]),o(jn.Provider,{value:{isOpen:t,openModal:r,closeModal:i},children:e})},uc=()=>{const e=le(jn);if(!e)throw new Error("useLanAuth must be used within a LanAuthProvider");return e},dc="_container_88bss_1",mc="_field_88bss_8",hc="_input_88bss_19",pc="_actions_88bss_37",je={container:dc,field:mc,input:hc,actions:pc},Kt=Qn(({variant:e="primary",size:t="md",loading:n,children:r,className:i="",disabled:s,...a},c)=>{const l=ci("btn",`btn-${e}`,t!=="md"&&`btn-${t}`,n&&"btn-loading",i);return o("button",{className:l,disabled:s||n,ref:c,...a,children:n?o("span",{className:"btn-spinner"}):r})}),fc=({isOpen:e,onClose:t,onSuccess:n})=>{const[r,i]=S(""),[s,a]=S(!1);ut.useEffect(()=>{e&&i("")},[e]);const c=async()=>{if(!r){b.error("Please enter your password");return}a(!0);try{const l=await fetch("/api/auth/app-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:r})}),u=await l.json().catch(()=>({}));if(!l.ok){b.error(u.error||"Login failed");return}b.success("Authenticated successfully"),n(),t(),window.location.reload()}catch{b.error("Network error")}finally{a(!1)}};return o(qe,{isOpen:e,onClose:t,title:"LAN Authentication Required",children:o("div",{className:je.container,children:[o("p",{children:"This instance is protected. Enter the password to access from this device."}),o("div",{className:je.field,children:[o("label",{htmlFor:"lan-password",children:"Password"}),o("input",{id:"lan-password",type:"password",value:r,onChange:l=>i(l.target.value),placeholder:"Enter password...",className:je.input,onKeyDown:l=>l.key==="Enter"&&c()})]}),o("div",{className:je.actions,children:[o(Kt,{variant:"secondary",onClick:t,disabled:s,children:"Cancel"}),o(Kt,{variant:"primary",onClick:c,loading:s,children:"Unlock"})]})]})})},yc=q(()=>L(()=>import("./Home-Dy6jlbe-.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]))),vc=q(()=>L(()=>import("./Watchlist-BHxo147b.js"),__vite__mapDeps([30,1,2,4,6,7,8,9,10,11,12,13,3,5,14,15,31,32]))),gc=q(()=>L(()=>import("./Settings-DCG_27q2.js"),__vite__mapDeps([33,1,2,34,35,4,36]))),Ut=q(()=>L(()=>import("./Player-Bww3XdSp.js"),__vite__mapDeps([37,1,2,38,4,39,40,12,17,18,8,9,10,23,41,42,43,44,45]))),bc=q(()=>L(()=>import("./Search-q_45kuOY.js"),__vite__mapDeps([46,1,4,3,5,6,7,2,8,9,10,11,12,13,14,15,47,48]))),_c=q(()=>L(()=>import("./Mature-APIFXLUd.js"),__vite__mapDeps([49,1,2,4,3,5,6,7,8,9,10,11,12,13,14,15,23,47,48,50]))),Ht=q(()=>L(()=>import("./Asmr-B7Hc4hT4.js"),__vite__mapDeps([51,1,4,2,34,35,11,9,12,13,28,52,53,54,21,40,55,56]))),wc=q(()=>L(()=>import("./Manga-pBfz3N91.js"),__vite__mapDeps([57,1,4,34,35,14,15,11,9,12,13,19,20,2,21,23,58,59,55,56]))),Ec=q(()=>L(()=>import("./MangaInfoPage-DanNLum0.js"),__vite__mapDeps([60,1,4,14,15,20,2,58,59,55,56]))),kc=q(()=>L(()=>import("./MangaReadPage-CmSrkaL3.js"),__vite__mapDeps([61,1,14,4,15,2,20,58,59,55,56]))),Sc=q(()=>L(()=>import("./ReadingList-DOZYEIaT.js"),__vite__mapDeps([62,1,11,9,12,4,13,63,3,5,14,15,31,32,19,20,2,21,22,16]))),Pc=q(()=>L(()=>import("./Radio-fo7eMtmX.js"),__vite__mapDeps([64,1,4,2,52,53,65,66,55,56]))),xc=q(()=>L(()=>import("./Music-SWFqsret.js"),__vite__mapDeps([67,1,4,65,66,52,53,2,55,56,68]))),Vt=q(()=>L(()=>import("./TvSearch-BJ_lOIHZ.js"),__vite__mapDeps([69,1,4,3,5,24,11,9,12,13,25,26,2,14,15,47,48]))),Tc=q(()=>L(()=>import("./TvInfo-DaoG5qd8.js"),__vite__mapDeps([70,1,4,26,2,71]))),Ic=q(()=>L(()=>import("./Tv-9jGD-POg.js"),__vite__mapDeps([72,1,2,4,38,39,73,23,26,40,12,43,44,74]))),Oc=q(()=>L(()=>import("./TvWatchlist-DGvG3C9M.js"),__vite__mapDeps([75,1,11,9,12,4,13,63,3,5,14,15,31,32,16,25,26,2]))),Cc=q(()=>L(()=>import("./ListeningList-C6DmhQYE.js"),__vite__mapDeps([76,1,11,9,12,4,13,63,3,5,14,15,31,32,54,28,2,52,53,21,27,16]))),Nc=q(()=>L(()=>import("./Trackers-Br8u_-n7.js"),__vite__mapDeps([77,1,2,4,78]))),Ac=q(()=>L(()=>import("./Insights-L72FYEhY.js"),__vite__mapDeps([79,1,2,4,80]))),qc=q(()=>L(()=>import("./AnimeInfoPage-ZoJMem3T.js"),__vite__mapDeps([81,1,2,4]))),Lc=q(()=>L(()=>import("./PlayerRedirect-fv2tzEUu.js"),__vite__mapDeps([82,1]))),Rc=q(()=>L(()=>import("./VirtualKeyboard-BmqZPZXR.js"),__vite__mapDeps([83,1,84])));function $c(){rs();const{isOpen:e,closeModal:t,onSuccess:n}=ja(),{isOpen:r,setIsOpen:i}=gt(),{isOpen:s,openModal:a,closeModal:c}=uc(),l=dt(),u=Kn(),d=B(new Map),m=B(l.pathname),h=Rs();Da();const[p,f]=S(!1);w(()=>{fetch("/api/auth/app-status").then(O=>O.json()).then(O=>{O.hasPassword&&!O.isAuthenticated&&(f(!0),a())}).catch(()=>{})},[a]);const[I,P]=qn("lan_auth_notice_shown","false"),R=B(!1);return w(()=>{if(I==="true"||R.current)return;R.current=!0,P("true");const O=setTimeout(()=>{b("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(O)},[I,P]),w(()=>{try{window.history.scrollRestoration="manual"}catch{}},[]),w(()=>{const O=l.key,E=d.current;if(u==="POP"){const D=E.get(O)??0;window.scrollTo({top:D,behavior:"instant"})}else l.pathname!==m.current&&window.scrollTo({top:0,behavior:"instant"});return m.current=l.pathname,()=>{E.set(O,window.scrollY)}},[l.key,l.pathname,u]),w(()=>{const O=E=>{r&&E.key==="Escape"&&i(!1)};return r?document.body.classList.add("sidebar-open"):document.body.classList.remove("sidebar-open"),window.addEventListener("keydown",O),()=>{window.removeEventListener("keydown",O),document.body.classList.remove("sidebar-open")}},[r,i]),o("div",{className:"app-container",children:[o(sc,{isOpen:e,onClose:t,onSuccess:n}),o(fc,{isOpen:s,onClose:p?()=>{}:c,onSuccess:()=>{f(!1),c()}}),o(Br,{position:"top-center",toastOptions:{style:{background:"var(--bg-elevated)",color:"var(--text-primary)",border:"1px solid var(--border-primary)"},success:{style:{background:"var(--accent)",color:"var(--accent-text)"},iconTheme:{primary:"var(--accent-text)",secondary:"var(--accent)"}},error:{style:{background:"rgba(153, 42, 42, 0.95)",color:"#fff"}}}}),o(ia,{}),o(ga,{}),o("main",{className:"main-content",children:o(cc,{children:o(bt,{fallback:o(ac,{}),children:o(Un,{children:[o(x,{path:"/",element:o(yc,{})}),o(x,{path:"/watchlist/:filter?",element:o(vc,{})}),o(x,{path:"/reading-list/:filter?",element:o(Sc,{})}),o(x,{path:"/search",element:o(bc,{})}),o(x,{path:"/mature",element:o(_c,{})}),o(x,{path:"/asmr",element:o(Ht,{})}),o(x,{path:"/asmr/:rj",element:o(Ht,{})}),o(x,{path:"/manga",element:o(wc,{})}),o(x,{path:"/manga/:provider/:id",element:o(Ec,{})}),o(x,{path:"/manga/:provider/:id/read",element:o(kc,{})}),o(x,{path:"/radio",element:o(Pc,{})}),o(x,{path:"/music",element:o(xc,{})}),o(x,{path:"/tv",element:o(Vt,{})}),o(x,{path:"/tv/:id",element:o(Tc,{})}),o(x,{path:"/tv/:id/watch",element:o(Ic,{})}),o(x,{path:"/tv-search",element:o(Vt,{})}),o(x,{path:"/tv-watchlist/:filter?",element:o(Oc,{})}),o(x,{path:"/listening-list/:filter?",element:o(Cc,{})}),o(x,{path:"/settings",element:o(gc,{})}),o(x,{path:"/trackers",element:o(Nc,{})}),o(x,{path:"/mal",element:o(_t,{to:"/trackers",replace:!0})}),o(x,{path:"/insights",element:o(Ac,{})}),o(x,{path:"/anime/:id",element:o(qc,{})}),o(x,{path:"/watch/:id",element:o(Ut,{})}),o(x,{path:"/watch/:id/:episodeNumber",element:o(Ut,{})}),o(x,{path:"/player/:id/:episodeNumber?",element:o(Lc,{})}),o(x,{path:"*",element:o(_t,{to:"/",replace:!0})})]})})})}),o($a,{}),h.isVisible&&o(bt,{fallback:null,children:o(Rc,{activeInputRef:h.activeInputRef,isVisible:h.isVisible,onClose:h.hide})})]})}function Dc(){return o(lc,{children:o($c,{})})}const jc=({children:e})=>{const[t,n]=S(!1),r=Q(()=>{n(s=>!s)},[]),i=Pe(()=>({isOpen:t,setIsOpen:n,toggleSidebar:r}),[t,r]);return o(xn.Provider,{value:i,children:e})},Mc=({children:e})=>{const[t,n]=qn("dango_content_type","anime"),r=Pe(()=>({contentType:t,setContentType:n}),[t,n]);return o(Tn.Provider,{value:r,children:e})},Fc=({children:e})=>{const[t,n]=S("englishName"),[r,i]=S(!0);w(()=>{(async()=>{try{const c=await Z.settings.getByKey.query({key:"titlePreference"});c.value&&n(c.value)}catch(c){console.error("Error fetching title preference in context:",c)}finally{i(!1)}})()},[]);const s=Pe(()=>({titlePreference:t,setTitlePreference:n,loading:r}),[t,r]);return o(vn.Provider,{value:s,children:e})},Bc=({children:e})=>{const{data:t,isLoading:n}=ze("lowEndMode"),r=wn(),i=K(),[s,a]=S(!1);w(()=>{const u=i.getDefaultOptions();i.setDefaultOptions({...u,queries:{...u.queries,gcTime:s?900*1e3:1800*1e3}})},[s,i]),w(()=>{t!==void 0&&a(t==="true"||t===!0)},[t]),w(()=>{s?document.body.classList.add("low-end"):document.body.classList.remove("low-end")},[s]);const c=Q(u=>{a(u),r.mutate({key:"lowEndMode",value:String(u)})},[r]),l=Pe(()=>({lowEndMode:s,setLowEndMode:c,loading:n}),[s,c,n]);return o(En.Provider,{value:l,children:e})},Wc=["iris","mochi","sakura"];function zt(e){e==="iris"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",e)}const Qc=({children:e})=>{const{data:t,isLoading:n}=ze("theme"),r=wn(),[i,s]=S("iris");w(()=>{typeof t=="string"&&Wc.includes(t)&&s(t)},[t]),w(()=>{zt(i)},[i]);const a=Q(l=>{l!==i&&(s(l),zt(l),r.mutate({key:"theme",value:l}))},[r,i]),c=Pe(()=>({theme:i,setTheme:a,loading:n}),[i,a,n]);return o(Sn.Provider,{value:c,children:e})},Kc=({children:e})=>{const[t,n]=S(!1),[r,i]=S(void 0),s=Q(c=>{i(()=>c),n(!0)},[]),a=Q(()=>{n(!1),i(void 0)},[]);return w(()=>fn("animepahe",()=>s()),[s]),o(Ln.Provider,{value:{isOpen:t,openModal:s,closeModal:a,onSuccess:r},children:e})};try{window.history.scrollRestoration="manual"}catch{}const Gt=new Yn({defaultOptions:{queries:{staleTime:1e3*60*5,gcTime:1800*1e3,refetchOnWindowFocus:!1,refetchIntervalInBackground:!1,retry:1}}}),Yt=document.getElementById("root");Yt&&Hn(o(Vn,{children:o(ii,{trpcClient:Z,queryClient:Gt,children:o(Jn,{client:Gt,children:o(Kc,{children:o(jc,{children:o(Mc,{children:o(Fc,{children:o(Bc,{children:o(Qc,{children:o(Dc,{})})})})})})})})})}),Yt);export{al as $,wn as A,Kt as B,fl as C,yl as D,pl as E,M as F,_l as G,Bt as H,Ft as I,Jc as J,U as K,sc as L,qe as M,nl as N,Ls as O,kl as P,fn as Q,El as R,Ye as S,wl as T,zc as U,On as V,gt as W,bl as X,ac as Y,sl as Z,L as _,qn as a,il as a0,Xc as b,el as c,li as d,sa as e,ai as f,Gc as g,N as h,tl as i,In as j,hl as k,rl as l,ol as m,cl as n,ll as o,vl as p,dl as q,Zc as r,Yc as s,Z as t,Qi as u,gl as v,ml as w,ul as x,ze as y,b as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{q as g}from"./vendor-core-DfaOB3Rn.js";import{u as p,b as q,a as M}from"./vendor-query-BBT5_sHx.js";import{h as v,z as h,t as y}from"./index-
|
|
1
|
+
import{q as g}from"./vendor-core-DfaOB3Rn.js";import{u as p,b as q,a as M}from"./vendor-query-BBT5_sHx.js";import{h as v,z as h,t as y}from"./index-CQlPx8UA.js";import{u as Q}from"./QueueOptionsButton-9ptjLfgY.js";function b(t){const s=p(),c=v(),{data:i,isLoading:w,error:u}=Q(t),n=c.watchlist.check.queryOptions({showId:t??""}).queryKey,{data:d}=q({...c.watchlist.check.queryOptions({showId:t??""}),enabled:!!t}),r=d?.inWatchlist??!1,{mutateAsync:l}=M({mutationFn:async({wasIn:e,meta:a})=>{if(!t)throw new Error("Missing showId");if(e)await y.watchlist.remove.mutate({id:t});else{const o=a?.names,m=a?.name||o?.romaji;if(!m)throw new Error("Missing show name");await y.watchlist.add.mutate({id:t,name:m,thumbnail:a?.thumbnail,nativeName:o?.native,englishName:o?.english,type:a?.type,isAdult:a?.isAdult})}return!e},onMutate:async({wasIn:e})=>{await s.cancelQueries({queryKey:n}),s.setQueryData(n,a=>({...a,inWatchlist:!e}))},onError:e=>{s.invalidateQueries({queryKey:n}),h.error(e instanceof Error?e.message:"Failed to update watchlist")},onSuccess:e=>{h.success(e?"Added to watchlist":"Removed from watchlist"),s.invalidateQueries({queryKey:["watchlist"]})}}),f=g(async()=>{!t||!i||await l({wasIn:r,meta:i})},[t,i,r,l]);return{showMeta:i,inWatchlist:r,loadingMeta:w,error:u?u.message:null,toggleWatchlist:f}}export{b as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{T as k}from"./vendor-core-DfaOB3Rn.js";import{b as y,u as l,a as d,e as F}from"./vendor-query-BBT5_sHx.js";import{h as n,z as a,t as v}from"./index-
|
|
1
|
+
import{T as k}from"./vendor-core-DfaOB3Rn.js";import{b as y,u as l,a as d,e as F}from"./vendor-query-BBT5_sHx.js";import{h as n,z as a,t as v}from"./index-CQlPx8UA.js";function P(e){return String(e||"").trim().toUpperCase()}function M(e){return P(e.id||e._id||"")}function N(e){return!!e.isAdult}const D=["Listening","Completed","On-Hold","Dropped","Planned"],E=e=>P(e),G=(e="All",s=1,r=24)=>{const t=n();return y(t.asmrLibrary.list.queryOptions({status:e,page:s,limit:r}))},O=()=>{const e=n();return y({...e.asmrLibrary.ids.queryOptions(),staleTime:1e3*60})},H=e=>{const s=n();return y({...s.asmrLibrary.check.queryOptions({id:e||""}),enabled:!!e,staleTime:1e3*60})},U=(e=24)=>{const s=n();return y(s.asmrProgress.continueListening.queryOptions({limit:e}))},W=e=>{const s=n();return y({...s.asmrProgress.getByWork.queryOptions({workId:e||""}),enabled:!!e})},T=()=>{const e=n(),s=l();return d({mutationFn:async r=>{const{silent:t,...m}=r;return v.asmrLibrary.add.mutate(m)},onSuccess:(r,t)=>{t.silent||a.success("Added to listening list"),s.invalidateQueries({queryKey:["asmr-library"]}),s.invalidateQueries(e.asmrLibrary.pathFilter())},onError:r=>{a.error(`Failed to add: ${r.message}`)}})},_=()=>{const e=n(),s=l();return d(e.asmrLibrary.remove.mutationOptions({onSuccess:()=>{a.success("Removed from listening list"),s.invalidateQueries({queryKey:["asmr-library"]}),s.invalidateQueries({queryKey:["asmr-continue-listening"]}),s.invalidateQueries(e.asmrLibrary.pathFilter()),s.invalidateQueries(e.asmrProgress.pathFilter())},onError:r=>{a.error(`Failed to remove: ${r.message}`)}}))},x=()=>{const e=n(),s=l();return d(e.asmrLibrary.setStatus.mutationOptions({onSuccess:()=>{a.success("Status updated"),s.invalidateQueries({queryKey:["asmr-library"]}),s.invalidateQueries({queryKey:["asmr-continue-listening"]}),s.invalidateQueries(e.asmrLibrary.pathFilter()),s.invalidateQueries(e.asmrProgress.pathFilter())},onError:r=>{a.error(`Failed to update status: ${r.message}`)}}))},z=()=>{const e=n(),s=l();return d(e.asmrProgress.save.mutationOptions({onSuccess:(r,t)=>{s.invalidateQueries({queryKey:["asmr-progress",t.workId]}),s.invalidateQueries({queryKey:["asmr-continue-listening"]}),s.invalidateQueries({queryKey:["asmr-library"]}),s.invalidateQueries(e.asmrLibrary.pathFilter()),s.invalidateQueries(e.asmrProgress.pathFilter())}}))},j=()=>{const e=n(),s=l();return d(e.asmrProgress.remove.mutationOptions({onSuccess:()=>{a.success("Progress reset"),s.invalidateQueries({queryKey:["asmr-progress"]}),s.invalidateQueries({queryKey:["asmr-continue-listening"]}),s.invalidateQueries({queryKey:["asmr-library"]}),s.invalidateQueries(e.asmrLibrary.pathFilter()),s.invalidateQueries(e.asmrProgress.pathFilter())},onError:r=>{a.error(`Failed to reset progress: ${r.message}`)}}))},Y=()=>{const e=n(),s=l();return d(e.asmrLibrary.batchStatus.mutationOptions({onSuccess:r=>{a.success(`Status updated for ${r.updated??0} items`),s.invalidateQueries({queryKey:["asmr-library"]}),s.invalidateQueries({queryKey:["asmr-continue-listening"]}),s.invalidateQueries(e.asmrLibrary.pathFilter()),s.invalidateQueries(e.asmrProgress.pathFilter())},onError:r=>{a.error(`Failed to update statuses: ${r.message}`)}}))},J=()=>{const e=n(),s=l();return d(e.asmrLibrary.removeMany.mutationOptions({onSuccess:r=>{const t=r.removed??0;a.success(`Removed ${t} ${t===1?"item":"items"} from listening list`),s.invalidateQueries({queryKey:["asmr-library"]}),s.invalidateQueries({queryKey:["asmr-continue-listening"]}),s.invalidateQueries(e.asmrLibrary.pathFilter()),s.invalidateQueries(e.asmrProgress.pathFilter())},onError:r=>{a.error(`Failed to remove: ${r.message}`)}}))},V=()=>{const e=n(),s=l();return d(e.asmrProgress.removeMany.mutationOptions({onSuccess:r=>{const t=r.removed??0;a.success(`Reset progress for ${t} ${t===1?"item":"items"}`),s.invalidateQueries({queryKey:["asmr-progress"]}),s.invalidateQueries({queryKey:["asmr-continue-listening"]}),s.invalidateQueries({queryKey:["asmr-library"]}),s.invalidateQueries(e.asmrLibrary.pathFilter()),s.invalidateQueries(e.asmrProgress.pathFilter())},onError:r=>{a.error(`Failed to reset progress: ${r.message}`)}}))},X=()=>{const e=T(),s=_(),{data:r}=O(),t=k(()=>new Set(r?.ids||[]),[r]);return{toggle:i=>{const o=E(i.rjCode);t.has(o)?s.mutate({id:o}):e.mutate({...i,thumbnail:i.thumbnail||""})},bookmarkedIds:t,pending:e.isPending||s.isPending}},h=300*1e3,A=15,Z=(e,s,r,t)=>{const m=s+1,i=F({queries:Array.from({length:m},(u,w)=>{const L=w+1;return{queryKey:["asmrBrowse",e,L,r,t],queryFn:()=>{const K=e.trim();return v.asmr.browse.query({q:K||void 0,page:L,sort:r&&r!=="latest"?r:void 0,rating:t||void 0})},staleTime:h}})}),o=i.flatMap(u=>u.data?.shows??[]),q=o.slice((s-1)*A,s*A),p=i[i.length-1]?.data,b=!!(p&&(p.hasNext||o.length>s*A)),f=i.some(u=>u.isLoading),c=i.some(u=>u.isFetching),Q=i.some(u=>u.isError);return{data:{shows:q,hasNext:b},isLoading:f,isError:Q,isFetching:c}},ee=e=>y({queryKey:["asmrWork",e],queryFn:()=>v.asmr.work.query({rj:e}),enabled:!!e,staleTime:h,refetchOnMount:"always"}),C=15,g=6;function B(e){if(e.isAdult||!e.thumbnail)return!1;const s=(e.rating||"").toLowerCase();return s===""||s==="sfw"}function S(e,s){const r=new Set,t=[];for(const m of e)for(const i of m){if(t.length>=s)return t;const o=i.id||i._id;!o||r.has(o)||(r.add(o),B(i)&&t.push(i))}return t}const se=(e=!0)=>{const s=F({queries:Array.from({length:C},(c,Q)=>{const u=Q+1;return{queryKey:["asmrBrowse","",u,"popular_month",""],queryFn:()=>v.asmr.browse.query({page:u,sort:"popular_month"}),staleTime:h,enabled:e,retry:1}})}),r=s.map(c=>c.data?.shows??[]),t=S(r,g),m=s.every(c=>c.isFetched),i=e&&m&&t.length<g,o=y({queryKey:["asmrBrowse","",1,"popular","sfw"],queryFn:()=>v.asmr.browse.query({page:1,sort:"popular",rating:"sfw"}),staleTime:h,enabled:i,retry:1}),q=o.data?.shows??[],p=t.length>=g?t.slice(0,g):S([t,q],g),b=e&&(s.some(c=>c.isLoading)||i&&o.isLoading),f=e&&m&&p.length===0&&s.some(c=>c.isError);return{data:p,isLoading:b,isError:f}};export{D as A,M as a,se as b,ee as c,H as d,X as e,W as f,P as g,z as h,T as i,Z as j,E as k,N as l,G as m,_ as n,x as o,Y as p,J as q,V as r,j as s,U as u};
|