@serifpersia/dango 3.5.6 → 3.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/client/dist/assets/{AnimeCard-B5chgVe0.js → AnimeCard-Bj5amdPt.js} +1 -1
- package/client/dist/assets/{AnimeInfo-CAIAwly1.js → AnimeInfo-B4b7iyCZ.js} +1 -1
- package/client/dist/assets/{AnimeInfoPage-QYTo62vI.js → AnimeInfoPage-_p_S9R09.js} +2 -2
- package/client/dist/assets/{Asmr-BCfPv0s2.js → Asmr-B4idhS3o.js} +1 -1
- package/client/dist/assets/{AsmrResetProgressModal-yqEA3jOA.js → AsmrResetProgressModal-BBrzzQFJ.js} +1 -1
- package/client/dist/assets/{AvSyncCalibrator-DQb5AJBT.js → AvSyncCalibrator-DipT4BfD.js} +1 -1
- package/client/dist/assets/{Home-CyAIcLBV.js → Home-B3U4UeUo.js} +1 -1
- package/client/dist/assets/{Insights-CXAxHzhr.js → Insights-CLwUQoct.js} +1 -1
- package/client/dist/assets/{LibraryListPage-oQc9xuRt.js → LibraryListPage-CcsUAzeL.js} +1 -1
- package/client/dist/assets/{ListeningList-By91F5vR.js → ListeningList-DZDivEEp.js} +1 -1
- package/client/dist/assets/{Manga-D7DgIXOq.js → Manga-DLLGgY3d.js} +1 -1
- package/client/dist/assets/{MangaInfoPage-Drk264JK.js → MangaInfoPage-CAoertK2.js} +1 -1
- package/client/dist/assets/{MangaReadPage-CnmtQB51.js → MangaReadPage-86iAGfPF.js} +1 -1
- package/client/dist/assets/{MangaResetProgressModal-irhuP8Mq.js → MangaResetProgressModal-BrgEfFCo.js} +1 -1
- package/client/dist/assets/{Mature-oAatUU-G.js → Mature-u1Zfj04I.js} +1 -1
- package/client/dist/assets/{MediaCard-DhBnuRF8.js → MediaCard-DlN3VNy8.js} +1 -1
- package/client/dist/assets/{Music-vX10ZW0N.js → Music-stf7yXDU.js} +1 -1
- package/client/dist/assets/{OptionListMenu-C9D50WHH.js → OptionListMenu-BFOitF3F.js} +1 -1
- package/client/dist/assets/{Player-C3glywqj.js → Player-DYz2t2Zv.js} +2 -2
- package/client/dist/assets/{PlayerSettings-DnHFn6_a.js → PlayerSettings-D2Gz6FgV.js} +1 -1
- package/client/dist/assets/{QueueOptionsButton-0GiAM-Bl.js → QueueOptionsButton-DFny02Po.js} +1 -1
- package/client/dist/assets/{QueueRail-CVLCaUMJ.js → QueueRail-C3FF1-f3.js} +1 -1
- package/client/dist/assets/{Radio-mP5TUQJn.js → Radio-BiRQreJI.js} +1 -1
- package/client/dist/assets/{ReadingList-BCAszsYl.js → ReadingList-kAreUiz-.js} +1 -1
- package/client/dist/assets/{ResetProgressModal-DLZmxatw.js → ResetProgressModal-DGE5sfz2.js} +1 -1
- package/client/dist/assets/{Search-DAMXgG2r.js → Search-Dvt7ZYbV.js} +1 -1
- package/client/dist/assets/{Settings-DHC_FqKK.js → Settings-D-BMTUko.js} +1 -1
- package/client/dist/assets/{SkeletonGrid-D-ed9Fo4.js → SkeletonGrid-CtRkgW2V.js} +1 -1
- package/client/dist/assets/{Trackers-DS90l3Q9.js → Trackers-DqaC4bYh.js} +1 -1
- package/client/dist/assets/Tv-Ug-q07EH.js +4 -0
- package/client/dist/assets/{TvInfo-BFVLnDNN.js → TvInfo-BfjnqnCn.js} +1 -1
- package/client/dist/assets/{TvPopup-CHFaDWpi.js → TvPopup-DgTptetJ.js} +1 -1
- package/client/dist/assets/{TvSearch-B9lZQqIk.js → TvSearch-D_VbFQF-.js} +1 -1
- package/client/dist/assets/{TvWatchlist-Do2SUmoL.js → TvWatchlist-DCx1lBta.js} +1 -1
- package/client/dist/assets/{Watchlist-C565Ujux.js → Watchlist-Cdi7veTd.js} +1 -1
- package/client/dist/assets/{hls-B2witrNg.js → hls-PlQLwAyI.js} +1 -1
- package/client/dist/assets/{index-CFHNQtWr.js → index-NKjVUCZV.js} +2 -2
- package/client/dist/assets/{useAnimeInfoData-CUTE8CPy.js → useAnimeInfoData-nFJhxeIK.js} +1 -1
- package/client/dist/assets/{useAsmr-DRjNfYvY.js → useAsmr-BFiC1M0v.js} +1 -1
- package/client/dist/assets/{useAsmrPopup-Df06MY8X.js → useAsmrPopup-BfVuxWTa.js} +1 -1
- package/client/dist/assets/{useMangaLibrary-JyVVwSCn.js → useMangaLibrary-DKLDWCwz.js} +1 -1
- package/client/dist/assets/{useMangaPopup-BB1TZKW4.js → useMangaPopup-C1z1dsYB.js} +1 -1
- package/client/dist/assets/{useProviders-Du7D_fOu.js → useProviders-aF3Qns7U.js} +1 -1
- package/client/dist/assets/{useTv-C2YgiBMr.js → useTv-DkUFW44b.js} +1 -1
- package/client/dist/assets/{useTvLibrary-DPO3DmuK.js → useTvLibrary-CrUDB1RB.js} +1 -1
- package/client/dist/index.html +1 -1
- package/package.json +2 -2
- package/server/package.json +1 -1
- package/client/dist/assets/Tv-C9pmI-95.js +0 -4
|
@@ -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-B3U4UeUo.js","assets/vendor-core-DfaOB3Rn.js","assets/vendor-query-BBT5_sHx.js","assets/SkeletonGrid-CtRkgW2V.js","assets/vendor-icons-DrybRNxP.js","assets/SkeletonGrid-Bge3aRl2.css","assets/AnimeCard-Bj5amdPt.js","assets/useAnimeInfoData-nFJhxeIK.js","assets/QueueOptionsButton-DFny02Po.js","assets/vendor-ui-3qrARCPr.js","assets/QueueOptionsButton-CM15uQn8.css","assets/MediaCard-DlN3VNy8.js","assets/useIsMobile-Dvx1uJ82.js","assets/MediaCard-DB6Yjgky.css","assets/ErrorMessage-DAxegITP.js","assets/ErrorMessage-CXoRbrLN.css","assets/ResetProgressModal-DGE5sfz2.js","assets/QueueRail-C3FF1-f3.js","assets/QueueRail-BUYEjdaq.css","assets/useMangaPopup-C1z1dsYB.js","assets/useMangaLibrary-DKLDWCwz.js","assets/usePopup-DS9jMzp6.js","assets/MangaResetProgressModal-BrgEfFCo.js","assets/useProviders-aF3Qns7U.js","assets/useTv-DkUFW44b.js","assets/TvPopup-DgTptetJ.js","assets/useTvLibrary-CrUDB1RB.js","assets/AsmrResetProgressModal-BBrzzQFJ.js","assets/useAsmr-BFiC1M0v.js","assets/Home-B_q2l74h.css","assets/Watchlist-Cdi7veTd.js","assets/Watchlist.module-XGtVQr1d.js","assets/Watchlist-BiDEU0iV.css","assets/Settings-D-BMTUko.js","assets/ToggleSwitch-CN_ppEc9.js","assets/ToggleSwitch-BPil0d_k.css","assets/Settings-CwIWLSfY.css","assets/Player-DYz2t2Zv.js","assets/AvSyncCalibrator-DipT4BfD.js","assets/AvSyncCalibrator-ieaRTs3u.css","assets/hls-PlQLwAyI.js","assets/AnimeMetaDetails-BogOi_bM.js","assets/AnimeMetaDetails-BwNQnRCd.css","assets/SynopsisText-B3Sa5pRv.js","assets/SynopsisText-CYv2W3yR.css","assets/Player-DBLl-bj_.css","assets/Search-Dvt7ZYbV.js","assets/Search.module-CMEai-B-.js","assets/Search-Cs45oAwI.css","assets/Mature-u1Zfj04I.js","assets/Mature-DJmUUtlF.css","assets/Asmr-B4idhS3o.js","assets/Asmr.module-CdWlioTY.js","assets/Asmr-D1KuQwQy.css","assets/useAsmrPopup-BfVuxWTa.js","assets/page.module-C1MlZzf3.js","assets/page-DRvjODkg.css","assets/Manga-DLLGgY3d.js","assets/Manga.module-depGEacJ.js","assets/Manga-CqAceKxR.css","assets/MangaInfoPage-CAoertK2.js","assets/MangaReadPage-86iAGfPF.js","assets/ReadingList-kAreUiz-.js","assets/LibraryListPage-CcsUAzeL.js","assets/Radio-BiRQreJI.js","assets/Radio.module-DGSZLpKM.js","assets/Radio-CCHNFN7R.css","assets/Music-stf7yXDU.js","assets/Music-BGH_0voi.css","assets/TvSearch-D_VbFQF-.js","assets/TvInfo-BfjnqnCn.js","assets/TvInfo-Bu36xJyO.css","assets/Tv-Ug-q07EH.js","assets/OptionListMenu-BFOitF3F.js","assets/Tv-BlVIanQL.css","assets/TvWatchlist-DCx1lBta.js","assets/ListeningList-DZDivEEp.js","assets/Trackers-DqaC4bYh.js","assets/Trackers-D5XBOCDp.css","assets/Insights-CLwUQoct.js","assets/Insights-Dc8xLmsr.css","assets/AnimeInfoPage-_p_S9R09.js","assets/PlayerRedirect-fv2tzEUu.js","assets/VirtualKeyboard-BmqZPZXR.js","assets/VirtualKeyboard-KIPc5ZGH.css"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{N as fn,k as $,A as D,q as M,h as b,S as K,d as w,X as ee,x as te,T as de,g as He,u as o,L as U,$ as xt,a as yn,c as Ve,e as vn,f as gn,D as bn,i as _n,P as nt,j as wn,l as S,m as rt,z as C,n as Sn,B as Pn}from"./vendor-core-DfaOB3Rn.js";import{s as ce,i as En,q as kn,u as F,a as V,b as Q,c as Ge,Q as Tn,d as xn}from"./vendor-query-BBT5_sHx.js";import{I as v}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 In="modulepreload",On=function(e){return"/"+e},ot={},N=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=On(u),u in ot)return;ot[u]=!0;const d=u.endsWith(".css"),m=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${m}`))return;const p=document.createElement("link");if(p.rel=d?"stylesheet":In,d||(p.as="script"),p.crossOrigin="",p.href=u,c&&p.setAttribute("nonce",c),document.head.appendChild(p),d)return new Promise((h,f)=>{p.addEventListener("load",h),p.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 Cn={data:""},Nn=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||Cn},An=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,Ln=/\/\*[^]*?\*\/| +/g,it=/\n+/g,ie=(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"?ie(a,s):s+"{"+ie(a,s[1]=="k"?"":t)+"}":typeof a=="object"?r+=ie(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+=ie.p?ie.p(s,a):s+":"+a+";")}return n+(t&&i?t+"{"+i+"}":i)+r},oe={},It=e=>{if(typeof e=="object"){let t="";for(let n in e)t+=n+It(e[n]);return t}return e},Rn=(e,t,n,r,i)=>{let s=It(e),a=oe[s]||(oe[s]=(l=>{let u=0,d=11;for(;u<l.length;)d=101*d+l.charCodeAt(u++)>>>0;return"go"+d})(s));if(!oe[a]){let l=s!==e?e:(u=>{let d,m,p=[{}];for(;d=An.exec(u.replace(Ln,""));)d[4]?p.shift():d[3]?(m=d[3].replace(it," ").trim(),p.unshift(p[0][m]=p[0][m]||{})):p[0][d[1]]=d[2].replace(it," ").trim();return p[0]})(e);oe[a]=ie(i?{["@keyframes "+a]:l}:l,n?"":"."+a)}let c=n&&oe.g;return n&&(oe.g=oe[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)})(oe[a],t,r,c),a},qn=(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?"":ie(c,""):c===!1?"":c}return r+i+(a??"")},"");function Ne(e){let t=this||{},n=e.call?e(t.p):e;return Rn(n.unshift?n.raw?qn(n,[].slice.call(arguments,1),t.p):n.reduce((r,i)=>Object.assign(r,i&&i.call?i(t.p):i),{}):n,Nn(t.target),t.g,t.o,t.k)}let Ot,Me,Fe;Ne.bind({g:1});let ne=Ne.bind({k:1});function jn(e,t,n,r){ie.p=t,Ot=e,Me=n,Fe=r}function ae(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:Me&&Me()},c),n.o=/go\d/.test(l),c.className=Ne.apply(n,r)+(l?" "+l:"");let u=e;return e[0]&&(u=c.as||e,delete c.as),Fe&&u[0]&&Fe(c),Ot(u,c)}return i}}var $n=e=>typeof e=="function",Oe=(e,t)=>$n(e)?e(t):e,Dn=(()=>{let e=0;return()=>(++e).toString()})(),Ct=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),Mn=20,Je="default",Nt=(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 Nt(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}))}}},Te=[],At={toasts:[],pausedAt:void 0,settings:{toastLimit:Mn}},Y={},Lt=(e,t=Je)=>{Y[t]=Nt(Y[t]||At,e),Te.forEach(([n,r])=>{n===t&&r(Y[t])})},Rt=e=>Object.keys(Y).forEach(t=>Lt(e,t)),Fn=e=>Object.keys(Y).find(t=>Y[t].toasts.some(n=>n.id===e)),Ae=(e=Je)=>t=>{Lt(t,e)},Bn={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},Wn=(e={},t=Je)=>{let[n,r]=w(Y[t]||At),i=D(Y[t]);b(()=>(i.current!==Y[t]&&r(Y[t]),Te.push([t,r]),()=>{let a=Te.findIndex(([c])=>c===t);a>-1&&Te.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||Bn[a.type],style:{...e.style,...(u=e[a.type])==null?void 0:u.style,...a.style}}});return{...n,toasts:s}},zn=(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||Dn()}),_e=e=>(t,n)=>{let r=zn(t,e,n);return Ae(r.toasterId||Fn(r.id))({type:2,toast:r}),r.id},L=(e,t)=>_e("blank")(e,t);L.error=_e("error");L.success=_e("success");L.loading=_e("loading");L.custom=_e("custom");L.dismiss=(e,t)=>{let n={type:3,toastId:e};t?Ae(t)(n):Rt(n)};L.dismissAll=e=>L.dismiss(void 0,e);L.remove=(e,t)=>{let n={type:4,toastId:e};t?Ae(t)(n):Rt(n)};L.removeAll=e=>L.remove(void 0,e);L.promise=(e,t,n)=>{let r=L.loading(t.loading,{...n,...n?.loading});return typeof e=="function"&&(e=e()),e.then(i=>{let s=t.success?Oe(t.success,i):void 0;return s?L.success(s,{id:r,...n,...n?.success}):L.dismiss(r),i}).catch(i=>{let s=t.error?Oe(t.error,i):void 0;s?L.error(s,{id:r,...n,...n?.error}):L.dismiss(r)}),e};var Qn=1e3,Kn=(e,t="default")=>{let{toasts:n,pausedAt:r}=Wn(e,t),i=D(new Map).current,s=M((m,p=Qn)=>{if(i.has(m))return;let h=setTimeout(()=>{i.delete(m),a({type:4,toastId:m})},p);i.set(m,h)},[]);b(()=>{if(r)return;let m=Date.now(),p=n.map(h=>{if(h.duration===1/0)return;let f=(h.duration||0)+h.pauseDuration-(m-h.createdAt);if(f<0){h.visible&&L.dismiss(h.id);return}return setTimeout(()=>L.dismiss(h.id,t),f)});return()=>{p.forEach(h=>h&&clearTimeout(h))}},[n,r,t]);let a=M(Ae(t),[t]),c=M(()=>{a({type:5,time:Date.now()})},[a]),l=M((m,p)=>{a({type:1,toast:{id:m,height:p}})},[a]),u=M(()=>{r&&a({type:6,time:Date.now()})},[r,a]),d=M((m,p)=>{let{reverseOrder:h=!1,gutter:f=8,defaultPosition:k}=p||{},A=n.filter(x=>(x.position||k)===(m.position||k)&&x.height),j=A.findIndex(x=>x.id===m.id),T=A.filter((x,q)=>q<j&&x.visible).length;return A.filter(x=>x.visible).slice(...h?[T+1]:[0,T]).reduce((x,q)=>x+(q.height||0)+f,0)},[n]);return b(()=>{n.forEach(m=>{if(m.dismissed)s(m.id,m.removeDelay);else{let p=i.get(m.id);p&&(clearTimeout(p),i.delete(m.id))}})},[n,s]),{toasts:n,handlers:{updateHeight:l,startPause:c,endPause:u,calculateOffset:d}}},Un=ne`
|
|
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
|
-
`,Pe=16,vr=({reverseOrder:e,position:t="top-center",toastOptions:n,gutter:r,children:i,toasterId:s,containerStyle:a,containerClassName:c})=>{let{toasts:l,handlers:u}=Kn(n,s);return $("div",{"data-rht-toaster":s||"",style:{position:"fixed",zIndex:9999,top:Pe,left:Pe,right:Pe,bottom:Pe,pointerEvents:"none",...a},className:c,onMouseEnter:u.startPause,onMouseLeave:u.endPause},l.map(d=>{let m=d.position||t,p=u.calculateOffset(d,{reverseOrder:e,gutter:r,defaultPosition:t}),h=fr(m,p);return $(hr,{id:d.id,key:d.id,onHeightUpdate:u.updateHeight,className:d.visible?yr:"",style:h},d.type==="custom"?Oe(d.message,d):i?i(d):$(pr,{toast:d,position:m}))}))},g=L;function Le(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(gr,t)}};return t}function gr(e,t){return t(e)}function br(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 _r(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 Le(c=>(n++,i.push(c),s(),{unsubscribe(){n--,a();const l=i.findIndex(u=>u===c);l>-1&&i.splice(l,1)}}))}}function wr(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=Le(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 Sr(e){return Le(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 ve(e){"@babel/helpers - typeof";return ve=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ve(e)}function Pr(e,t){if(ve(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ve(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Er(e){var t=Pr(e,"string");return ve(t)=="symbol"?t:t+""}function W(e,t,n){return(t=Er(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function st(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 R(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?st(Object(n),!0).forEach(function(r){W(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):st(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function se(e){return!!e&&!Array.isArray(e)&&typeof e=="object"}function kr(e){return typeof e=="function"}function Tr(){return Object.create(null)}const xr=typeof Symbol=="function"&&!!Symbol.asyncIterator;function Ir(e){return xr&&se(e)&&Symbol.asyncIterator in e}const Or=e=>e(),qt=()=>{},at=e=>{Object.freeze&&Object.freeze(e)};function jt(e,t,n){var r;const i=t.join(".");return(r=n[i])!==null&&r!==void 0||(n[i]=new Proxy(qt,{get(s,a){if(!(typeof a!="string"||a==="then"))return jt(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)}),at(u.args),at(u.path),e(u)}})),n[i]}const $t=e=>jt(e,[],Tr()),Cr=e=>new Proxy(qt,{get(t,n){if(n!=="then")return e(n)}});function ge(e){"@babel/helpers - typeof";return ge=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ge(e)}function Nr(e,t){if(ge(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ge(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ar(e){var t=Nr(e,"string");return ge(t)=="symbol"?t:t+""}function Be(e,t,n){return(t=Ar(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 Ee(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){Be(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}var Lr=class extends Error{constructor(e){super(Rr(e)),Object.assign(this,e)}};function Rr(e){if("message"in e)return String(e.message)}function qr(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(se(e))return new Lr(e)}}var lt=class extends Error{constructor(e){var t,n,r;const i=qr(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}),Be(this,"cause",void 0),Be(this,"code",void 0),this.code=e.code,this.name="TRPCError",(r=this.cause)!==null&&r!==void 0||(this.cause=i)}};function jr(e,t){if("error"in e){const n=t.deserialize(e.error);return{ok:!1,error:Ee(Ee({},e),{},{error:n})}}return{ok:!0,result:Ee(Ee({},e.result),(!e.result.type||e.result.type==="data")&&{type:"data",data:t.deserialize(e.result.data)})}}var $e=class extends Error{constructor(){super("Unable to transform response from server")}};function $r(e,t){let n;try{n=jr(e,t)}catch{throw new $e}if(!n.ok&&(!se(n.error.error)||typeof n.error.error.code!="number"))throw new $e;if(n.ok&&!se(n.result))throw new $e;return n}function Dr(e){return typeof e=="function"}async function Mr(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 Fr(e){const{type:t,path:n}=e,r=await Mr(e.router,n);if(!r||!Dr(r)||r._def.type!==t&&!e.allowMethodOverride)throw new lt({code:"NOT_FOUND",message:`No "${t}"-procedure on path "${n}"`});if(r._def.type!==t&&e.allowMethodOverride&&r._def.type==="subscription")throw new lt({code:"METHOD_NOT_SUPPORTED",message:"Method override is not supported for subscriptions"});return r(e)}function Br(e){return e instanceof Ce}function Wr(e){return se(e)&&se(e.error)&&typeof e.error.code=="number"&&typeof e.error.message=="string"}function zr(e,t){return typeof e=="string"?e:se(e)&&typeof e.message=="string"?e.message:t}var Ce=class xe extends Error{constructor(t,n){var r,i;const s=n?.cause;super(t,{cause:s}),W(this,"cause",void 0),W(this,"shape",void 0),W(this,"data",void 0),W(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,xe.prototype)}static from(t,n={}){const r=t;return Br(r)?(n.meta&&(r.meta=R(R({},r.meta),n.meta)),r):Wr(r)?new xe(r.error.message,R(R({},n),{},{result:r,cause:n.cause})):new xe(zr(r,"Unknown error"),R(R({},n),{},{cause:r}))}};function Qr(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 ut=e=>typeof e=="function";function Kr(e){if(e)return e;if(typeof window<"u"&&ut(window.fetch))return window.fetch.bind(window);if(typeof globalThis<"u"&&ut(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}function Ur(...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 Hr(...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 Vr(e){return{url:e.url.toString(),fetch:e.fetch,transformer:Qr(e.transformer),methodOverride:e.methodOverride}}function Gr(e){const t={};for(let n=0;n<e.length;n++){const r=e[n];t[n]=r}return t}const Jr={query:"GET",mutation:"POST",subscription:"PATCH"};function Dt(e){return"input"in e?e.transformer.input.serialize(e.input):Gr(e.inputs.map(t=>e.transformer.input.serialize(t)))}const Mt=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=Dt(e);i!==void 0&&e.methodOverride!=="POST"&&r.push(`input=${encodeURIComponent(JSON.stringify(i))}`)}return r.length&&(n+="?"+r.join("&")),n},Yr=e=>{if(e.type==="query"&&e.methodOverride!=="POST")return;const t=Dt(e);return t!==void 0?JSON.stringify(t):void 0},Xr=e=>no(R(R({},e),{},{contentTypeHeader:"application/json",getUrl:Mt,getBody:Yr}));var Zr=class extends Error{constructor(){const e="AbortError";super(e),this.name=e,this.message=e}};const eo=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 Zr};async function to(e){var t,n;eo(e.signal);const r=e.getUrl(e),i=e.getBody(e),s=(t=e.methodOverride)!==null&&t!==void 0?t:Jr[e.type],a=await(async()=>{const l=await e.headers();return Symbol.iterator in l?Object.fromEntries(l):l})(),c=R(R(R({},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 Kr(e.fetch)(r,{method:s,signal:e.signal,body:i,headers:c})}async function no(e){const t={},n=await to(e);t.response=n;const r=await n.json();return t.responseJSON=r,{json:r,meta:t}}const dt=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function mt(e){let t=null,n=null;const r=()=>{clearTimeout(n),n=null,t=null};function i(c){const l=[[]];let u=0;for(;;){const p=c[u];if(!p)break;const h=l[l.length-1];if(p.aborted){var d;(d=p.reject)===null||d===void 0||d.call(p,new Error("Aborted")),u++;continue}if(e.validate(h.concat(p).map(f=>f.key))){h.push(p),u++;continue}if(h.length===0){var m;(m=p.reject)===null||m===void 0||m.call(p,new Error("Input is too big for a single dispatch")),u++;continue}l.push([])}return l}function 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(p,h)=>{const f=u.items[h];try{var k;const j=await Promise.resolve(p);(k=f.resolve)===null||k===void 0||k.call(f,j)}catch(j){var A;(A=f.reject)===null||A===void 0||A.call(f,j)}f.batch=null,f.reject=null,f.resolve=null}));for(const p of u.items){var m;(m=p.reject)===null||m===void 0||m.call(p,new Error("Missing result")),p.batch=null}}).catch(d=>{for(const p of u.items){var m;(m=p.reject)===null||m===void 0||m.call(p,d),p.batch=null}})}}function a(c){var l;const u={aborted:!1,key:c,batch:null,resolve:dt,reject:dt},d=new Promise((m,p)=>{var h;u.reject=p,u.resolve=m,(h=t)!==null&&h!==void 0||(t=[]),t.push(u)});return(l=n)!==null&&l!==void 0||(n=setTimeout(s)),d}return{load:a}}function ro(e){var t,n;const r=Vr(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(p=>p.path).join(","),m=u.map(p=>p.input);return Mt(R(R({},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),p=Ur(...u.map(f=>f.signal)),h=await Xr(R(R({},r),{},{path:d,inputs:m,type:l,headers(){return e.headers?typeof e.headers=="function"?e.headers({opList:u}):e.headers:{}},signal:p}));return(Array.isArray(h.json)?h.json:u.map(()=>h.json)).map(f=>({meta:h.meta,json:f}))}}),c={query:mt(a("query")),mutation:mt(a("mutation"))};return({op:l})=>Le(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(R(R({},l),{},{signal:Hr(l.signal,d.signal)}));let p=!1,h;return m.then(f=>{p=!0,h=f;const k=$r(f.json,r.transformer.output);if(!k.ok){u.error(Ce.from(k.error,{meta:f.meta}));return}u.next({context:f.meta,result:k.result}),u.complete()}).catch(f=>{p=!0,u.error(Ce.from(f,{meta:h?.meta}))}),()=>{p||d.abort()}})}}const Ft=(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 io(e){const t=await Ft(e.url);return e.connectionParams?t+`${t.includes("?")?"&":"?"}connectionParams=1`:t}async function so(e,t){const n={method:"connectionParams",data:await Ft(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 co(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 We{constructor(t){var n;if(W(this,"id",++We.connectCount),W(this,"WebSocketPonyfill",void 0),W(this,"urlOptions",void 0),W(this,"keepAliveOpts",void 0),W(this,"encoder",void 0),W(this,"wsObservable",wr(null)),W(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=++We.connectCount;const t=io(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&&co(n,this.keepAliveOpts),n.addEventListener("close",()=>{this.ws===n&&(this.ws=null)}),await ao(n),this.urlOptions.connectionParams&&n.send(await so(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()}}};W(lo,"connectCount",0);var Bt=class{constructor(e){W(this,"links",void 0),W(this,"runtime",void 0),W(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=e.links.map(t=>t(this.runtime))}$request(e){var t;return Sr({links:this.links,op:R(R({},e),{},{context:(t=e.context)!==null&&t!==void 0?t:{},id:++this.requestId})}).pipe(_r())}async requestAsPromise(e){try{const t=this.$request(e);return(await br(t)).result.data}catch(t){throw Ce.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 Wt=Symbol.for("trpc_untypedClient"),uo={query:"query",mutate:"mutation",subscribe:"subscription"},mo=e=>uo[e];function po(e){const t=$t(({path:n,args:r})=>{const i=[...n],s=mo(i.pop()),a=i.join(".");return e[s](a,...r)});return Cr(n=>n===Wt?e:t[n])}function ho(e){return po(new Bt(e))}function fo(e){return e[Wt]}function be(e){"@babel/helpers - typeof";return be=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},be(e)}function yo(e,t){if(be(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(be(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function vo(e){var t=yo(e,"string");return be(t)=="symbol"?t:t+""}function go(e,t,n){return(t=vo(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 P(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){go(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}function bo(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 Ie(t.call(e));n="@@asyncIterator",r="@@iterator"}throw new TypeError("Object is not async iterable")}function Ie(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 Ie=function(r){this.s=r,this.n=r.next},Ie.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 Ie(e)}function _o(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 wo(e,t){if(e==null)return{};var n,r,i=_o(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 So=["cursor","direction"];function Re(e){return{path:e.path.join(".")}}function Po(e){return e.length>=3}function Eo(e){return Po(e)?{type:"prefixed",prefix:e[0],path:e[1],args:e[2]}:{type:"unprefixed",prefix:void 0,path:e[0],args:e[1]}}function Ye(e,t,n){var r;const i=Eo(e);let s=(r=i.args)===null||r===void 0?void 0:r.input;if(n){var a,c;s=P(P(P({},(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 ko(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=bo(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 Z(e){const t=Or(()=>{const{input:n,type:r}=e,i=e.path.flatMap(s=>s.split("."));if(!n&&r==="any")return i.length?[i]:[];if(r==="infinite"&&se(n)&&("direction"in n||"cursor"in n)){const{cursor:s,direction:a}=n;return[i,{input:wo(n,So),type:"infinite"}]}return[i,P(P({},typeof n<"u"&&n!==ce&&{input:n}),r&&r!=="any"&&{type:r})]});return e.prefix&&t.unshift([e.prefix]),t}function zt(e){const t=[e.path.flatMap(n=>n.split("."))];return e.prefix&&t.unshift([e.prefix]),t}function Xe(e){return kr(e)?e():e}function To(e){var t;const{input:n,query:r,path:i,queryKey:s,opts:a}=e,c=n===ce,l=async u=>{var d;const m=P(P({},a),{},{trpc:P(P({},a?.trpc),!(a==null||(d=a.trpc)===null||d===void 0)&&d.abortOnUnmount?{signal:u.signal}:{signal:null})});return await r(...Ye(s,m,{direction:u.direction,pageParam:u.pageParam}))};return Object.assign(En(P(P({},a??{}),{},{queryKey:s,queryFn:c?ce:l,initialPageParam:(t=a?.initialCursor)!==null&&t!==void 0?t:n?.cursor})),{trpc:Re({path:i})})}function xo(e){var t,n;const{mutate:r,path:i,prefix:s,opts:a,overrides:c}=e,l=Xe(e.queryClient),u=zt({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:(h=>h.originalFn()),p=async h=>await r(...Ye([...u,{input:h}],a));return P(P({},a),{},{mutationKey:u,mutationFn:p,onSuccess(...h){var f,k;return m({originalFn:()=>{var j,T,x;return(j=a==null||(T=a.onSuccess)===null||T===void 0?void 0:T.call(a,...h))!==null&&j!==void 0?j:d==null||(x=d.onSuccess)===null||x===void 0?void 0:x.call(d,...h)},queryClient:l,meta:(f=(k=a?.meta)!==null&&k!==void 0?k:d?.meta)!==null&&f!==void 0?f:{}})},trpc:Re({path:i})})}function Io(e){const{input:t,query:n,path:r,queryKey:i,opts:s}=e,a=Xe(e.queryClient),c=t===ce,l=async u=>{var d;const m=P(P({},s),{},{trpc:P(P({},s?.trpc),!(s==null||(d=s.trpc)===null||d===void 0)&&d.abortOnUnmount?{signal:u.signal}:{signal:null})}),p=u.queryKey,h=await n(...Ye(p,m));return Ir(h)?ko(h,a,p):h};return Object.assign(kn(P(P({},s),{},{queryKey:i,queryFn:c?ce:l})),{trpc:Re({path:r})})}const Oo=e=>{const{subscribe:t,path:n,queryKey:r,input:i,opts:s={}}=e,a="enabled"in s?!!s.enabled:i!==ce,c=l=>t(n.join("."),i===ce?void 0:i,l);return P(P({},s),{},{enabled:a,subscribe:c,queryKey:r,trpc:Re({path:n})})};function Co(e){const t=e.keyPrefix,n=r=>(i,s,a)=>"router"in e?Promise.resolve(Xe(e.ctx)).then(c=>Fr({router:e.router,path:i,getRawInput:async()=>s,ctx:c,type:r,signal:void 0,batchIndex:0})):(e.client instanceof Bt?e.client:fo(e.client))[r](i,s,a);return $t(({args:r,path:i})=>{const s=[...i],a=s.pop(),[c,l]=r;return{"~types":void 0,pathKey:()=>Z({path:s,type:"any",prefix:t}),pathFilter:()=>P(P({},c),{},{queryKey:Z({path:s,type:"any",prefix:t})}),queryOptions:()=>Io({input:c,opts:l,path:s,queryClient:e.queryClient,queryKey:Z({path:s,input:c,type:"query",prefix:t}),query:n("query")}),queryKey:()=>Z({path:s,input:c,type:"query",prefix:t}),queryFilter:()=>P(P({},l),{},{queryKey:Z({path:s,input:c,type:"query",prefix:t})}),infiniteQueryOptions:()=>To({input:c,opts:l,path:s,queryKey:Z({path:s,input:c,type:"infinite",prefix:t}),query:n("query")}),infiniteQueryKey:()=>Z({path:s,input:c,type:"infinite",prefix:t}),infiniteQueryFilter:()=>P(P({},l),{},{queryKey:Z({path:s,input:c,type:"infinite",prefix:t})}),mutationOptions:()=>{var u;return xo({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:()=>zt({path:s,prefix:t}),subscriptionOptions:()=>Oo({opts:l,path:s,input:c,queryKey:Z({path:s,input:c,type:"any",prefix:t}),subscribe:n("subscription")})}[a]()})}function No(){const e=ee(null),t=ee(null),n=s=>{const a=de(()=>Co({client:s.trpcClient,queryClient:s.queryClient,keyPrefix:s.keyPrefix}),[s.trpcClient,s.queryClient,s.keyPrefix]);return $(e.Provider,{value:s.trpcClient},$(t.Provider,{value:a},s.children))};n.displayName="TRPCProvider";function r(){const s=te(t);if(!s)throw new Error("useTRPC() can only be used inside of a <TRPCProvider>");return s}function i(){const s=te(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 ze={lan:new Set,animepahe:new Set,jasmr:new Set};function le(e){for(const t of[...ze[e]])try{t()}catch(n){console.error(`auth-bus listener failed (${e}):`,n)}}function Qt(e,t){return ze[e].add(t),()=>{ze[e].delete(t)}}const Ao=e=>new Promise(t=>setTimeout(t,e)),Kt=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 Ao(Math.min(500*2**a,4e3)),s=await fetch(e,{...t,headers:{...n,...t?.headers}});return s},Ra=async(e,t)=>{const n=await Kt(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"&&le("animepahe"),n.status===403&&s==="AUTH_REQUIRED"&&i.provider==="jasmr"&&le("jasmr"),n.status===401&&s==="LAN_AUTH_REQUIRED"&&le("lan"),new Error(s||`Failed to fetch from ${e}`)}return n.json()};async function Lo(e,t){const n=await Kt(e,t);if(n.status===401)try{(await n.clone().json())?.error==="LAN_AUTH_REQUIRED"&&le("lan")}catch{}return await Ro(n),n}async function Ro(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")&&le(s.provider),(i.message==="LAN_AUTH_REQUIRED"||s?.code==="LAN_AUTH_REQUIRED")&&le("lan")}}catch{}}const{TRPCProvider:qo,useTRPC:E}=No(),H=ho({links:[ro({url:"/api/trpc",fetch:Lo})]}),ye=new Map,jo=500,$o=(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(ye.has(i))return ye.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 ye.size>jo&&ye.clear(),ye.set(i,s),s},qa=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 ja(e){return e?e.replace(/<[^>]*>?/gm,"").replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").trim():""}function $a(e){return e==null?e:e>10?Number((e/10).toFixed(1)):e}const Do=(...e)=>e.filter(Boolean).join(" "),Ut=ee(void 0),Mo=()=>{const e=te(Ut);if(e===void 0)throw new Error("useTitlePreference must be used within a TitlePreferenceProvider");return e},Da=()=>{const e=E();return Q({...e.data.spotlight.queryOptions(),staleTime:1e3*60*5,retry:1})},Ma=(e="TRENDING_DESC",t=10)=>Ge({queryKey:["trendingList",e,t],queryFn:({pageParam:n=1})=>H.data.popularList.query({sort:e,page:n,size:t}),initialPageParam:1,getNextPageParam:(n,r)=>n.length>=t?r.length+1:void 0}),Fa=(e="TV",t=12)=>Ge({queryKey:["latestReleases",e,t],queryFn:({pageParam:n=1})=>H.data.latestReleases.query({format:e,page:n,size:t}),initialPageParam:1,getNextPageParam:(n,r)=>n.length>=t?r.length+1:void 0}),Ba=(e,t="TV",n=!0)=>{const r=E();return Q({...r.data.seasonal.queryOptions({page:e,format:t}),enabled:n,staleTime:1e3*60*5})},Fo=["query","sortBy","type","status","season","year","country","genres","excludeGenres","excludeTags","minScore","minEpisodes","adult"],Wa=(e,t,n=14)=>{const r=E(),i=new URLSearchParams(e),s={page:t,limit:n};for(const a of Fo){const c=i.get(a);c!==null&&(s[a]=c)}return Q({...r.data.search.queryOptions(s),enabled:e!=null})},za=()=>{const e=E();return Q(e.queue.list.queryOptions())},Bo=()=>{const e=E(),t=F();return V(e.queue.add.mutationOptions({onSuccess:n=>{n.queued?g.success("Added to queue"):g.success("Removed from queue"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:["queue-remaining"]})},onError:n=>{g.error(`Failed to update queue: ${n.message}`)}}))},Qa=()=>{const e=E(),t=F();return V(e.queue.remove.mutationOptions({onSuccess:()=>{g.success("Removed from queue"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:["queue-remaining"]}),t.invalidateQueries({queryKey:["allContinueWatching"]})},onError:n=>{g.error(`Failed to remove: ${n.message}`)}}))},Ka=(e,t=!0)=>Q({queryKey:["queue-remaining",e],queryFn:()=>H.watchlist.queueRemaining.query({showId:e}),enabled:!!e&&t,staleTime:1e3*60}),Ua=()=>{const e=E(),t=F();return V(e.queue.addBatch.mutationOptions({onSuccess:(n,r)=>{const i=n.added??r.episodeNumbers.length;g.success(`${i} ${i===1?"episode":"episodes"} added to queue`),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:["queue-remaining"]})},onError:n=>{g.error(`Failed to update queue: ${n.message}`)}}))},Ha=()=>{const e=E(),t=F();return V(e.queue.removeMany.mutationOptions({onSuccess:()=>{g.success("Removed from queue"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:["queue-remaining"]}),t.invalidateQueries({queryKey:["allContinueWatching"]})},onError:n=>{g.error(`Failed to remove: ${n.message}`)}}))},Va=()=>{const e=E(),t=F();return V(e.queue.clear.mutationOptions({onSuccess:()=>{g.success("Queue cleared"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:["queue-remaining"]}),t.invalidateQueries({queryKey:["allContinueWatching"]})},onError:n=>{g.error(`Failed to clear queue: ${n.message}`)}}))},Ga=()=>{const e=E(),t=F(),n=e.queue.list.queryOptions().queryKey;return V(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())}}))},Wo=["status","showMature","query","type","season","year","genres","excludeGenres","sortBy","titlePreference"];function Ze(e,t,n){const r=new URLSearchParams(e),i={page:t,limit:n};for(const s of Wo){const a=r.get(s);a!==null&&(i[s]=a)}return i}const Ja=(e,t="",n,r=14)=>Q({queryKey:["watchlist",e,t,n,r],queryFn:async()=>{const i=new URLSearchParams(t);return i.set("status",e),await H.watchlist.list.query(Ze(i.toString(),n,r))}}),Ya=(e="")=>Ge({queryKey:["allContinueWatching",e],queryFn:async({pageParam:t=1})=>await H.watchlist.continueWatchingAll.query(Ze(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)})}),Xa=(e="",t,n=14)=>Q({queryKey:["allContinueWatching",e,t,n],queryFn:async()=>await H.watchlist.continueWatchingAll.query(Ze(e,t,n))}),Za=()=>{const e=E(),t=F();return V(e.watchlist.remove.mutationOptions({onSuccess:()=>{g.success("Removed from watchlist"),t.invalidateQueries(e.watchlist.pathFilter()),t.invalidateQueries({queryKey:["watchlist"]})},onError:n=>{g.error(`Failed to remove: ${n.message}`)}}))},ec=()=>{const e=E(),t=F();return V(e.watchlist.batchStatus.mutationOptions({onSuccess:n=>{g.success(`Status updated for ${n.updated??0} items`),t.invalidateQueries(e.watchlist.pathFilter()),t.invalidateQueries({queryKey:["watchlist"]}),t.invalidateQueries({queryKey:["allContinueWatching"]})},onError:n=>{g.error(`Failed to update statuses: ${n.message}`)}}))},tc=()=>{const e=E(),t=F();return V(e.watchlist.removeMany.mutationOptions({onSuccess:n=>{const r=n.removed??0;g.success(`Removed ${r} ${r===1?"item":"items"} from watchlist`),t.invalidateQueries(e.watchlist.pathFilter()),t.invalidateQueries({queryKey:["watchlist"]}),t.invalidateQueries({queryKey:["allContinueWatching"]})},onError:n=>{g.error(`Failed to remove: ${n.message}`)}}))},nc=()=>{const e=E(),t=F();return V(e.continueWatching.removeMany.mutationOptions({onSuccess:n=>{const r=n.removed??0;g.success(`Removed ${r} ${r===1?"item":"items"} from continue watching`),t.invalidateQueries(e.continueWatching.pathFilter()),t.invalidateQueries({queryKey:["allContinueWatching"]})},onError:n=>{g.error(`Failed to remove: ${n.message}`)}}))},Ht=(e=!0)=>{const t=E();return Q({...t.notifications.list.queryOptions(),enabled:e,refetchInterval:3e4})},Vt=(e=!0)=>{const t=E();return Q({...t.data.systemNotifications.queryOptions(),enabled:e,refetchInterval:3e4})},Gt=(e=!0)=>{const t=E();return Q({...t.discovery.status.queryOptions(),enabled:e,refetchInterval:n=>n.state.data?.running?2e3:!1})},zo=()=>{const e=E(),t=F(),n=e.discovery.status.queryOptions().queryKey;return V(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})}}))},Qo=()=>{const e=E(),t=F();return V(e.notifications.dismiss.mutationOptions({onSuccess:()=>{t.invalidateQueries(e.notifications.pathFilter())}}))},Ko=()=>{const e=E(),t=F();return V(e.notifications.clearAll.mutationOptions({onSuccess:()=>{t.invalidateQueries(e.notifications.pathFilter())}}))},rc=()=>{const e=E();return Q({...e.continueWatching.thisWeek.queryOptions(),staleTime:1e3*60*5})},oc=()=>{const e=E();return Q({...e.data.genresAndTags.queryOptions(),staleTime:1e3*60*60})},ic=()=>Q({queryKey:["genreCards"],queryFn:()=>H.insights.genreCards.query()}),Uo="_container_z68uz_1",Ho="_bellBtn_z68uz_7",Vo="_badge_z68uz_56",Go="_dropdown_z68uz_96",Jo="_dropdownHeader_z68uz_127",Yo="_clearAllBtn_z68uz_141",Xo="_discoveryStatusRow_z68uz_156",Zo="_statusDot_z68uz_167",ei="_statusDotRunning_z68uz_174",ti="_statusDotOk_z68uz_179",ni="_statusDotInfo_z68uz_183",ri="_statusDotError_z68uz_187",oi="_statusDotIdle_z68uz_191",ii="_list_z68uz_205",si="_item_z68uz_219",ai="_thumbnail_z68uz_234",ci="_itemInfo_z68uz_243",li="_itemTitle_z68uz_248",ui="_itemMeta_z68uz_259",di="_systemItemMeta_z68uz_269",mi="_removeItem_z68uz_286",pi="_queueItem_z68uz_316",hi="_emptyState_z68uz_320",y={container:Uo,bellBtn:Ho,badge:Vo,dropdown:Go,dropdownHeader:Jo,clearAllBtn:Yo,discoveryStatusRow:Xo,statusDot:Zo,statusDotRunning:ei,statusDotOk:ti,statusDotInfo:ni,statusDotError:ri,statusDotIdle:oi,list:ii,item:si,thumbnail:ai,itemInfo:ci,itemTitle:li,itemMeta:ui,systemItemMeta:di,removeItem:mi,queueItem:pi,emptyState:hi},fi=({notification:e})=>{const t=Qo(),n=Bo(),[r,i]=He.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}=Mo(),u=l==="nativeName"?e.nativeName||e.name:l==="englishName"&&e.englishName||e.name;return o(U,{to:`/watch/${e.showId}/${e.episodeNumber}`,className:y.item,onClick:a,children:[o("img",{src:$o(e.thumbnail,48,64),alt:e.name,className:y.thumbnail,loading:"lazy",decoding:"async"}),o("div",{className:y.itemInfo,children:[o("span",{className:y.itemTitle,children:u}),o("span",{className:y.itemMeta,children:["New Episode ",e.episodeNumber]})]}),o("button",{className:`${y.removeItem} ${y.queueItem}`,onClick:c,"aria-label":"Add notification to queue",children:r?o(v,{name:"check"}):o(v,{name:"plus"})}),o("button",{className:y.removeItem,onClick:s,"aria-label":"Remove notification",children:o(v,{name:"times"})})]})};function De({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 yi=({count:e=3})=>o(K,{children:Array.from({length:e}).map((t,n)=>o("div",{className:y.item,style:{borderBottom:"1px solid var(--border-primary)",pointerEvents:"none"},children:[o("div",{className:y.thumbnail,style:{overflow:"hidden"},children:o(De,{width:"100%",height:"100%",variant:"rectangular"})}),o("div",{className:y.itemInfo,children:[o(De,{width:"80%",height:"1rem",variant:"text",style:{marginBottom:"4px"}}),o(De,{width:"40%",height:"0.7rem",variant:"rectangular",style:{borderRadius:"var(--radius-sm)"}})]})]},n))}),vi=()=>{const{data:e=[],isLoading:t}=Ht(),{data:n=[]}=Vt(),{data:r}=Gt(),i=Ko(),s=F(),[a,c]=w(null);b(()=>{s.invalidateQueries({queryKey:["notifications"]})},[s]);const l=()=>{i.mutate(void 0)},u=n.find(d=>d.id===a)??null;return o("div",{className:y.dropdown,children:[o("div",{className:y.dropdownHeader,children:[o("h4",{children:"Notifications"}),e.length>0&&o("button",{className:y.clearAllBtn,onClick:l,children:"Clear All"})]}),o("div",{className:y.discoveryStatusRow,children:r?.running?o(K,{children:[o("span",{className:`${y.statusDot} ${y.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(K,{children:[o("span",{className:`${y.statusDot} ${y.statusDotOk}`,"aria-hidden":"true"}),o("span",{children:["Discovery complete — checked ",r.total," ",r.total===1?"show":"shows"]})]}):r?.state==="empty"?o(K,{children:[o("span",{className:`${y.statusDot} ${y.statusDotInfo}`,"aria-hidden":"true"}),o("span",{children:"No shows set to Watching — nothing to check"})]}):r?.state==="error"?o(K,{children:[o("span",{className:`${y.statusDot} ${y.statusDotError}`,"aria-hidden":"true"}),o("span",{children:"Last check failed — will retry automatically"})]}):o(K,{children:[o("span",{className:`${y.statusDot} ${y.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:y.list,children:t&&n.length===0?o(yi,{count:4}):o(K,{children:[n.map(d=>o("div",{className:y.item,children:[o("div",{className:y.thumbnail,style:{background:"transparent",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:0,boxShadow:"none"},children:o(v,{name:"info-circle",size:32,color:"#6c9fff"})}),o("div",{className:y.itemInfo,children:[o("span",{className:y.itemTitle,children:d.title}),o("button",{type:"button",className:y.systemItemMeta,onClick:()=>c(d.id),title:"View full status",children:d.message.length>40?d.message.slice(0,40)+"…":d.message})]}),o("button",{className:y.removeItem,disabled:!0,style:{opacity:.3,cursor:"not-allowed"},"aria-hidden":"true",children:o(v,{name:"plus"})}),o("button",{className:y.removeItem,disabled:!0,style:{opacity:.3,cursor:"not-allowed"},"aria-hidden":"true",children:o(v,{name:"times"})})]},d.id)),n.length>0&&e.length>0&&o("div",{className:y.notificationDivider}),e.length>0?e.map(d=>o(fi,{notification:d},d.id)):!t&&n.length===0&&o("div",{className:y.emptyState,children:"No new notifications"})]})}),u&&xt(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(v,{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(--primary-color)",color:"#fff",border:"none",padding:"0.5rem 1rem",borderRadius:"var(--radius-md)",cursor:"pointer",fontWeight:600},children:"OK"})})]})}),document.body)]})},gi=()=>{const[e,t]=w(!1),n=D(null),r=F(),i=E(),s=zo(),{data:a=[]}=Ht(),{data:c=[]}=Vt(),{data:l}=Gt(),u=a.length+c.length,d=u>5?"5+":u,m=D(!1);b(()=>{const h=f=>{n.current&&!n.current.contains(f.target)&&t(!1)};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[]),b(()=>{const h=!!l?.running;m.current&&!h&&(r.invalidateQueries(i.notifications.pathFilter()),r.invalidateQueries(i.discovery.pathFilter())),m.current=h},[l?.running,r,i]);const p=()=>{const h=!e;t(h),h&&s.mutate()};return o("div",{className:y.container,ref:n,children:[o("button",{className:y.bellBtn,onClick:p,"aria-label":"Notifications",children:[o(v,{name:"bell"}),u>0&&o("span",{className:y.badge,children:d})]}),e&&o(vi,{})]})},Jt=ee(void 0),Yt=()=>{const e=te(Jt);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e},sc=[{id:"iris",label:"Taro (default)",blurb:"Deep purple",swatch:"#7d6df0"},{id:"mochi",label:"Mochi",blurb:"Monochrome pearl",swatch:"#f0f0f0"},{id:"sakura",label:"Sakura",blurb:"Soft pink",swatch:"#e0b0e0"}],ht={iris:"/logo.png",mochi:"/logo-mochi.png",sakura:"/logo-sakura.png"},Xt=({className:e})=>{const{theme:t}=Yt(),n=ht[t]||ht.iris;return o("img",{src:n,alt:"dango",className:e,decoding:"async",style:{height:"var(--logo-height, 75px)",width:"auto",display:"block",objectFit:"contain"}})},Zt=ee(void 0),et=()=>{const e=te(Zt);if(e===void 0)throw new Error("useSidebar must be used within a SidebarProvider");return e},en=ee(void 0),tn=()=>{const e=te(en);if(e===void 0)throw new Error("useContentType must be used within a ContentTypeProvider");return e},Qe="virtual-keyboard:hide",ft="virtual-keyboard:enabled-change",nn="virtual_keyboard_enabled",bi=!1;function yt(){const e=localStorage.getItem(nn);return e===null?bi:e==="true"}const vt=e=>e instanceof HTMLInputElement&&e.type==="text"&&!e.disabled&&!e.readOnly;function _i(){window.dispatchEvent(new CustomEvent(Qe))}function wi(){const[e,t]=w(!1),[n,r]=w(yt),i=D(null);return b(()=>{const s=d=>{n&&vt(d.target)&&(i.current=d.target,t(!0))},a=d=>{d.target===i.current&&window.setTimeout(()=>{if(vt(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!==nn)return;const m=d.newValue==="true";r(m),m||c()},u=()=>{const d=yt();r(d),d||c()};return document.addEventListener("focusin",s),document.addEventListener("focusout",a),window.addEventListener(Qe,c),window.addEventListener("storage",l),window.addEventListener(ft,u),()=>{document.removeEventListener("focusin",s),document.removeEventListener("focusout",a),window.removeEventListener(Qe,c),window.removeEventListener("storage",l),window.removeEventListener(ft,u)}},[n]),{activeInputRef:i,isVisible:n&&e,hide:()=>t(!1)}}const Si="_header_1elij_1",Pi="_hidden_1elij_21",Ei="_scrolled_1elij_25",ki="_logo_1elij_31",Ti="_headerInner_1elij_44",xi="_leftSection_1elij_54",Ii="_desktopNav_1elij_60",Oi="_navLink_1elij_67",Ci="_navLinkActive_1elij_83",Ni="_rightSection_1elij_102",Ai="_searchWrapper_1elij_108",Li="_searchInput_1elij_114",Ri="_searchButton_1elij_144",qi="_searchIcon_1elij_168",ji="_profileBtn_1elij_178",$i="_profileImg_1elij_211",Di="_hamburgerBtn_1elij_217",Mi="_mobileSearchBar_1elij_245",Fi="_mobileSearchBarHidden_1elij_272",Bi="_mobileSearchInner_1elij_289",Wi="_mobileSearchIcon_1elij_305",zi="_mobileSearchInput_1elij_312",_={header:Si,hidden:Pi,scrolled:Ei,logo:ki,headerInner:Ti,leftSection:xi,desktopNav:Ii,navLink:Oi,navLinkActive:Ci,rightSection:Ni,searchWrapper:Ai,searchInput:Li,searchButton:Ri,searchIcon:qi,profileBtn:ji,profileImg:$i,hamburgerBtn:Di,mobileSearchBar:Mi,mobileSearchBarHidden:Fi,mobileSearchInner:Bi,mobileSearchIcon:Wi,mobileSearchInput:zi},Qi=async()=>{let e;try{e=await H.auth.syncSettings.query()}catch{return null}const t=e.actualActiveProvider;if(t==="github")try{const n=await H.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 H.auth.user.query();if(n)return{name:n.name,picture:n.picture,email:n.email,provider:"google"}}catch{}return null},Ki=()=>{const{toggleSidebar:e}=et(),{contentType:t}=tn(),[n,r]=w(""),[i,s]=w(!0),[a,c]=w(!1),[l,u]=w(!0),[d,m]=w(!1),p=yn(),h=Ve(),f=D(null),k=D(!1),A=D(null),j=D(null),T=D(null),x=D(null),{data:q}=Q({queryKey:["sync-profile"],queryFn:Qi,staleTime:3e4});b(()=>{const I=window.visualViewport;if(!I)return;const z=()=>{x.current?.style.setProperty("--vv-top",`${I.offsetTop}px`)};return z(),I.addEventListener("scroll",z),I.addEventListener("resize",z),()=>{I.removeEventListener("scroll",z),I.removeEventListener("resize",z)}},[]),b(()=>{const I=()=>{f.current&&(window.clearTimeout(f.current),f.current=null)},z=()=>{k.current||(k.current=!0,A.current=requestAnimationFrame(()=>{k.current=!1,A.current=null;const X=window.scrollY<=10;u(fe=>fe===X?fe:X),s(fe=>fe||!0),I(),X||(f.current=window.setTimeout(()=>{s(!1)},2500))}))},he=X=>{(X.metaKey||X.ctrlKey)&&X.key==="k"?(X.preventDefault(),re.current?.focus({preventScroll:!0})):X.key==="Escape"&&document.activeElement===re.current&&re.current?.blur()};return window.addEventListener("scroll",z,{passive:!0}),window.addEventListener("keydown",he),()=>{window.removeEventListener("scroll",z),window.removeEventListener("keydown",he),I(),A.current!==null&&(cancelAnimationFrame(A.current),A.current=null),k.current=!1}},[a]);const re=He.useRef(null),me=()=>window.innerWidth<=1024,qe=()=>{me()?(m(!0),setTimeout(()=>T.current?.focus({preventScroll:!0}),50)):document.activeElement===re.current&&n.trim()?je():re.current?.focus({preventScroll:!0})},G=I=>{j.current?.contains(I.relatedTarget)||m(!1)},Se=h.pathname==="/music"?"Search music...":t==="manga"?"Search manga...":t==="tv"?"Search TV & movies...":t==="asmr"?"Search ASMR...":"Search anime...",pe=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"},je=I=>{_i();const z=n.trim();if(z){if(h.pathname==="/music"){const he=new URLSearchParams(h.search);he.set("q",z),p(`/music?${he.toString()}`);return}p(t==="manga"?`/manga?q=${encodeURIComponent(z)}`:t==="tv"?`/tv-search?q=${encodeURIComponent(z)}`:t==="asmr"?`/asmr?q=${encodeURIComponent(z)}`:`/search?query=${encodeURIComponent(z)}`)}};return o(K,{children:o("header",{ref:x,className:`${_.header} ${i?"":_.hidden} ${l?"":_.scrolled}`,children:[o("div",{className:_.headerInner,children:[o("div",{className:_.leftSection,children:[o("button",{className:_.hamburgerBtn,onClick:e,"aria-label":"Menu",children:o(v,{name:"bars"})}),o(U,{to:"/",className:_.logo,"aria-label":"Ani-Web Home",children:o(Xt,{})}),o("nav",{className:_.desktopNav,children:[o(U,{to:"/",className:`${_.navLink} ${h.pathname==="/"?_.navLinkActive:""}`,children:"Home"}),o(U,{to:pe.to,className:`${_.navLink} ${h.pathname.startsWith(pe.to)?_.navLinkActive:""}`,children:pe.label}),t==="anime"&&o(U,{to:"/insights",className:`${_.navLink} ${h.pathname==="/insights"?_.navLinkActive:""}`,children:"Insights"}),o(U,{to:"/settings",className:`${_.navLink} ${h.pathname.startsWith("/settings")?_.navLinkActive:""}`,children:"Settings"})]})]}),o("div",{className:_.rightSection,children:[o("div",{className:_.searchWrapper,children:[o("input",{ref:re,type:"text","data-virtual-keyboard":"true",className:_.searchInput,placeholder:Se,value:n,onChange:I=>r(I.target.value),onFocus:()=>c(!0),onBlur:()=>c(!1),onKeyDown:I=>{I.key==="Enter"&&je()}}),o("button",{type:"button",className:_.searchButton,"aria-label":"Search",onMouseDown:I=>I.preventDefault(),onClick:qe,children:o(v,{name:"search",className:_.searchIcon})})]}),o(gi,{}),o(U,{to:"/settings?tab=sync",className:_.profileBtn,"aria-label":"Sync settings",children:q?.picture?o("img",{src:q.picture,alt:q.name,className:_.profileImg,referrerPolicy:"no-referrer",decoding:"async"}):q?.provider==="github"?o(v,{name:"github"}):o(v,{name:"cloud"})})]})]}),d&&o("div",{className:`${_.mobileSearchBar} ${i?"":_.mobileSearchBarHidden}`,ref:j,onBlur:G,children:o("div",{className:_.mobileSearchInner,children:[o(v,{name:"search",className:_.mobileSearchIcon}),o("input",{ref:T,type:"text","data-virtual-keyboard":"true",className:_.mobileSearchInput,placeholder:Se,value:n,onChange:I=>r(I.target.value),onKeyDown:I=>{I.key==="Enter"?(je(),m(!1)):I.key==="Escape"&&m(!1)}})]})})]})})},Ke="agreedToViewMature";function gt(){try{return localStorage.getItem(Ke)==="true"}catch{return!1}}function Ui(){const[e,t]=w(gt);b(()=>{const i=()=>t(gt());return window.addEventListener("storage",i),window.addEventListener("focus",i),()=>{window.removeEventListener("storage",i),window.removeEventListener("focus",i)}},[]);const n=M(()=>{try{localStorage.setItem(Ke,"true")}catch{}t(!0)},[]),r=M(()=>{try{localStorage.removeItem(Ke)}catch{}t(!1)},[]);return{hasConsent:e,grant:n,revoke:r}}const Hi="_sidebar_153jc_1",Vi="_open_153jc_20",Gi="_sidebarHeader_153jc_25",Ji="_closeBtn_153jc_33",Yi="_logo_153jc_57",Xi="_navSection_153jc_69",Zi="_navLink_153jc_75",es="_active_153jc_108",ts="_overlay_153jc_118",ns="_versionInfo_153jc_138",J={sidebar:Hi,open:Vi,sidebarHeader:Gi,closeBtn:Ji,logo:Yi,navSection:Xi,navLink:Zi,active:es,overlay:ts,versionInfo:ns},rs="3.5.6",rn={version:rs},os=()=>{const{isOpen:e,setIsOpen:t}=et(),{contentType:n}=tn(),{hasConsent:r}=Ui(),i=()=>{t(!1)},s=n==="manga",a=n==="tv",c=n==="asmr",l=[{to:"/",icon:o(v,{name:"home"}),label:"Home"},s?{to:"/manga",icon:o(v,{name:"book"}),label:"Manga"}:a?{to:"/tv-search",icon:o(v,{name:"tv"}),label:"TV and Movies"}:c?{to:"/asmr",icon:o(v,{name:"headphones"}),label:"ASMR"}:{to:"/search",icon:o(v,{name:"search"}),label:"Search"},s?{to:"/reading-list",icon:o(v,{name:"bookmark"}),label:"Reading List"}:a?{to:"/tv-watchlist",icon:o(v,{name:"clock"}),label:"TV Watchlist"}:c?{to:"/listening-list",icon:o(v,{name:"history"}),label:"Listening List"}:{to:"/watchlist",icon:o(v,{name:"clock"}),label:"Watchlist"},...n==="anime"?[{to:"/insights",icon:o(v,{name:"chart-pie"}),label:"Insights"}]:[],{to:"/trackers",icon:o(v,{name:"sync-alt"}),label:"Trackers"},{to:"/radio",icon:o(v,{name:"broadcast-tower"}),label:"Radio"},{to:"/music",icon:o(v,{name:"headphones"}),label:"Music"},...r?[{to:"/mature",icon:o(v,{name:"pepper-hot"}),label:"Mature"}]:[],{to:"/settings",icon:o(v,{name:"cog"}),label:"Settings"}];return o(K,{children:[o("aside",{className:`${J.sidebar} ${e?J.open:""} sidebar`,children:[o("div",{className:J.sidebarHeader,children:[o("button",{className:J.closeBtn,onClick:()=>t(!1),"aria-label":"Close menu",children:"×"}),o(U,{to:"/",className:J.logo,onClick:i,children:o(Xt,{})})]}),o("nav",{className:J.navSection,children:l.map(u=>o(vn,{to:u.to,className:({isActive:d})=>`${J.navLink} ${d?J.active:""}`,onClick:i,end:u.to==="/",children:[u.icon,o("span",{children:u.label})]},u.to))}),o("div",{className:J.versionInfo,children:["v",rn.version]})]}),e&&o("div",{className:J.overlay,onClick:()=>t(!1),"aria-label":"Close sidebar"})]})},is="_footer_1p5nb_1",ss="_footerInner_1p5nb_15",as="_brandSection_1p5nb_27",cs="_logoRow_1p5nb_39",ls="_logoText_1p5nb_59",us="_brandMeta_1p5nb_65",ds="_brandTagline_1p5nb_74",ms="_statusPill_1p5nb_81",ps="_statusDot_1p5nb_94",hs="_linksGrid_1p5nb_102",fs="_linkColumn_1p5nb_110",ys="_columnTitle_1p5nb_116",vs="_bottomBar_1p5nb_140",gs="_copyright_1p5nb_150",bs="_brand_1p5nb_27",_s="_heartIcon_1p5nb_166",ws="_backToTop_1p5nb_171",O={footer:is,footerInner:ss,brandSection:as,logoRow:cs,logoText:ls,brandMeta:us,brandTagline:ds,statusPill:ms,statusDot:ps,linksGrid:hs,linkColumn:fs,columnTitle:ys,bottomBar:vs,copyright:gs,brand:bs,heartIcon:_s,backToTop:ws},bt={iris:"/logo.png",mochi:"/logo-mochi.png",sakura:"/logo-sakura.png"},Ss=()=>{const{theme:e}=Yt(),t=bt[e]||bt.iris,n=new Date().getFullYear(),r=()=>{window.scrollTo({top:0,behavior:"smooth"})};return o("footer",{className:O.footer,children:[o("div",{className:O.footerInner,children:[o("div",{className:O.brandSection,children:[o("div",{className:O.logoRow,children:o("img",{src:t,className:O.logoText,alt:"dango",loading:"lazy",decoding:"async"})}),o("div",{className:O.brandMeta,children:[o("div",{className:O.statusPill,children:[o("span",{className:O.statusDot}),o("span",{children:["v",rn.version]})]}),o("p",{className:O.brandTagline,children:"Fast, local anime streaming."})]})]}),o("div",{className:O.linksGrid,children:[o("div",{className:O.linkColumn,children:[o("h4",{className:O.columnTitle,children:"Navigation"}),o(U,{to:"/",children:"Home"}),o(U,{to:"/watchlist",children:"Watchlist"}),o(U,{to:"/settings",children:"Settings"})]}),o("div",{className:O.linkColumn,children:[o("h4",{className:O.columnTitle,children:"Features"}),o(U,{to:"/search",children:"Search Anime"}),o(U,{to:"/trackers",children:"Trackers"}),o(U,{to:"/insights",children:"Insights"})]}),o("div",{className:O.linkColumn,children:[o("h4",{className:O.columnTitle,children:"Community"}),o("a",{href:"https://discord.gg/2FTSPXCsvn",target:"_blank",rel:"noopener noreferrer",children:[o(v,{name:"discord",style:{marginRight:"6px"}})," Discord"]}),o("a",{href:"https://github.com/serifpersia/dango",target:"_blank",rel:"noopener noreferrer",children:[o(v,{name:"github",style:{marginRight:"6px"}})," GitHub"]})]}),o("div",{className:O.linkColumn,children:[o("h4",{className:O.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:O.bottomBar,children:[o("p",{className:O.copyright,children:["© ",n," ",o("span",{className:O.brand,children:"dango"})," • Crafted with"," ",o(v,{name:"heart",className:O.heartIcon})," by"," ",o("a",{href:"https://github.com/serifpersia",target:"_blank",rel:"noopener noreferrer",children:"serifpersia"})]}),o("button",{className:O.backToTop,onClick:r,"aria-label":"Back to top",children:[o(v,{name:"chevron-up",size:14}),o("span",{children:"Top"})]})]})]})},tt=e=>{const t=E();return Q({...t.settings.getByKey.queryOptions({key:e}),select:n=>n.value})},on=()=>{const e=E(),t=F();return V(e.settings.set.mutationOptions({onSuccess:()=>{g.success("Setting updated!"),t.invalidateQueries(e.settings.pathFilter()),t.invalidateQueries({queryKey:["settings"]})},onError:n=>{g.error(`Failed to update setting: ${n.message}`)}}))};function sn(e){return JSON.stringify({0:e??{}})}function an(e){return`/api/trpc/${e}?batch=1`}function Ue(e,t){const n=sn(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 ac(e,t){await fetch(an(e),{method:"POST",headers:{"Content-Type":"application/json"},body:sn(t),keepalive:!0})}function cc(e){e&&(Ue("discord.clear",{sessionId:e}),Ue("discord.heartbeat",{sessionId:e,bye:!0}))}function Ps(){const e=Ve(),{data:t}=tt("discordRPCEnabled"),n=D("");n.current||(n.current=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`tab-${Date.now()}-${Math.random().toString(36).slice(2)}`),b(()=>{if(t===!1||t==="false")return;const r=n.current,i=()=>H.discord.heartbeat.mutate({sessionId:r}).catch(()=>{});i();const s=setInterval(i,15e3),a=()=>{Ue("discord.heartbeat",{sessionId:r,bye:!0})};return window.addEventListener("pagehide",a),()=>{clearInterval(s),window.removeEventListener("pagehide",a)}},[t]),b(()=>{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"),H.discord.pageStatus.mutate({page:i}).catch(()=>{})},[e.pathname,t])}function cn(e,t){const[n,r]=w(()=>{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}});b(()=>{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=M(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=ee(void 0),Es=()=>{const e=te(ln);if(!e)throw new Error("useAnimePaheCookie must be used within an AnimePaheCookieProvider");return e},ks="_overlay_1juub_1",Ts="_fadeIn_1juub_1",xs="_content_1juub_11",Is="_modalIn_1juub_1",Os="_sm_1juub_29",Cs="_md_1juub_33",Ns="_lg_1juub_37",As="_title_1juub_41",Ls="_body_1juub_48",Rs="_footer_1juub_52",ue={overlay:ks,fadeIn:Ts,content:xs,modalIn:Is,sm:Os,md:Cs,lg:Ns,title:As,body:Ls,footer:Rs};function un({children:e}){return o("h2",{className:ue.title,children:e})}function dn({children:e}){return o("div",{className:ue.body,children:e})}function mn({children:e}){return o("div",{className:ue.footer,children:e})}function we({isOpen:e,onClose:t,title:n,children:r,footer:i,width:s="md"}){const a=D(null);return b(()=>{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?xt(o("div",{role:"presentation",onMouseDown:c=>c.stopPropagation(),children:[o("div",{className:ue.overlay,onClick:()=>t?.(),"aria-hidden":"true"}),o("div",{ref:a,className:`${ue.content} ${ue[s]}`,role:"dialog","aria-modal":"true","aria-label":n,tabIndex:-1,children:[n&&o(un,{children:n}),o(dn,{children:r}),i&&o(mn,{children:i})]})]}),document.body):null}we.Header=un;we.Body=dn;we.Actions=mn;const qs="_container_e96gf_1",js="_field_e96gf_9",$s="_textarea_e96gf_20",Ds="_input_e96gf_40",Ms="_button_e96gf_58",Fs="_secondaryButton_e96gf_78",Bs="_actions_e96gf_95",Ws="_hint_e96gf_104",zs="_link_e96gf_117",B={container:qs,field:js,textarea:$s,input:Ds,button:Ms,secondaryButton:Fs,actions:Bs,hint:Ws,link:zs},Qs="https://github.com/serifpersia/dango/releases/latest/download/dango-extension.zip",Ks=e=>{try{return JSON.parse(e.detail)}catch{return null}},Us=({isOpen:e,onClose:t,onSuccess:n})=>{const[r,i]=w(1),[s,a]=w(navigator.userAgent),[c,l]=w(""),[u,d]=w(!1),m=D(null),p=navigator.userAgent,h=/android/i.test(p),f=/firefox|fxios/i.test(p)&&!h,k=!f&&!h&&/chrome|chromium|edg|brave/i.test(p),A=f||k;b(()=>{e&&(i(1),a(navigator.userAgent),l(""),d(!1))},[e]),b(()=>()=>{m.current&&(window.removeEventListener("dango:pahe-cookie",m.current),m.current=null)},[]);const j=()=>{localStorage.setItem("animepahe_ua",s),window.open("https://animepahe.pw","_blank","noopener,noreferrer"),i(2)},T=()=>{if(u)return;d(!0);const q=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,re=window.setTimeout(()=>{d(!1),m.current&&(window.removeEventListener("dango:pahe-cookie",m.current),m.current=null),g.error("Helper not detected — install it via about:debugging first.")},3e3),me=qe=>{const G=Ks(qe);if(!(!G||G.requestId!==q))if(window.clearTimeout(re),window.removeEventListener("dango:pahe-cookie",me),m.current=null,d(!1),G?.ok&&G.cookie)l(G.cookie),g.success("Cookie extracted from helper!");else if(G?.error==="NO_COOKIE"){const Se=G.debug?.stores?.length??0,pe=G.debug?.names??[];g.error(`Helper found no cf_clearance (checked ${Se} stores, saw: ${pe.join(", ")||"none"}) — solve the challenge on the AnimePahe tab first.`)}else g.error("Helper request failed — try again.")};m.current=me,window.addEventListener("dango:pahe-cookie",me),window.dispatchEvent(new CustomEvent("dango:get-pahe-cookie",{detail:{requestId:q}}))},x=()=>{const q=c.trim();if(!q){g.error("Please enter the cf_clearance cookie");return}try{localStorage.setItem("animepahe_cookie",q),g.success("Cookie updated successfully! Reloading…"),n?.(),t(),window.setTimeout(()=>window.location.reload(),1e3)}catch{g.error("Failed to save cookie")}};return o(we,{isOpen:e,onClose:t,title:"AnimePahe Verification Required",children:o("div",{className:B.container,children:r===1?o(K,{children:[o("p",{children:"AnimePahe requires a manual verification to bypass Cloudflare/DDoS-Guard protection."}),o("div",{className:B.field,children:[o("label",{children:"Your User-Agent (will be used for requests):"}),o("textarea",{value:s,readOnly:!0,rows:3,className:B.textarea})]}),o("div",{className:B.actions,children:[o("button",{className:B.secondaryButton,onClick:t,children:"Cancel"}),o("button",{className:B.button,onClick:j,children:"Start Verification (Opens AnimePahe)"})]})]}):o(K,{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."]}),A&&o("div",{className:B.hint,children:[o("strong",{children:"Dango helper (one-time setup):"})," ",f?o(K,{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(K,{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:Qs,target:"_blank",rel:"noreferrer",className:B.link,children:"dango-extension.zip"}),". Then click Extract below and the field fills itself.",o("div",{className:B.actions,children:o("button",{className:B.button,onClick:T,disabled:u,type:"button",children:u?"Extracting…":"Extract cookie from helper"})})]}),o("div",{className:B.field,children:[o("label",{children:"cf_clearance cookie value:"}),o("input",{type:"text",value:c,onChange:q=>l(q.target.value),placeholder:"e.g. xxxxxxxx.xxxxxxxx.xxxxxxx-xxxxxxx",className:B.input})]}),o("div",{className:B.actions,children:[o("button",{className:B.secondaryButton,onClick:t,children:"Cancel"}),o("button",{className:B.secondaryButton,onClick:()=>i(1),children:"Back"}),o("button",{className:B.button,onClick:x,children:"Submit"})]})]})})})};function Hs(){const[e,t]=w(!1);return b(()=>{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 Vs extends gn{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(v,{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(v,{name:"home"}),"Go back Home"]})]}):this.props.children}}const pn=ee(void 0),Gs=({children:e})=>{const[t,n]=w(!1),r=M(()=>n(!0),[]),i=M(()=>n(!1),[]);return b(()=>Qt("lan",r),[r]),o(pn.Provider,{value:{isOpen:t,openModal:r,closeModal:i},children:e})},Js=()=>{const e=te(pn);if(!e)throw new Error("useLanAuth must be used within a LanAuthProvider");return e},Ys="_container_88bss_1",Xs="_field_88bss_8",Zs="_input_88bss_19",ea="_actions_88bss_37",ke={container:Ys,field:Xs,input:Zs,actions:ea},_t=bn(({variant:e="primary",size:t="md",loading:n,children:r,className:i="",disabled:s,...a},c)=>{const l=Do("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})}),ta=({isOpen:e,onClose:t,onSuccess:n})=>{const[r,i]=w(""),[s,a]=w(!1);He.useEffect(()=>{e&&i("")},[e]);const c=async()=>{if(!r){g.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){g.error(u.error||"Login failed");return}g.success("Authenticated successfully"),n(),t(),window.location.reload()}catch{g.error("Network error")}finally{a(!1)}};return o(we,{isOpen:e,onClose:t,title:"LAN Authentication Required",children:o("div",{className:ke.container,children:[o("p",{children:"This instance is protected. Enter the password to access from this device."}),o("div",{className:ke.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:ke.input,onKeyDown:l=>l.key==="Enter"&&c()})]}),o("div",{className:ke.actions,children:[o(_t,{variant:"secondary",onClick:t,disabled:s,children:"Cancel"}),o(_t,{variant:"primary",onClick:c,loading:s,children:"Unlock"})]})]})})},na=C(()=>N(()=>import("./Home-CyAIcLBV.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]))),ra=C(()=>N(()=>import("./Watchlist-C565Ujux.js"),__vite__mapDeps([30,1,2,4,6,7,8,9,10,11,12,13,3,5,14,15,31,32]))),oa=C(()=>N(()=>import("./Settings-DHC_FqKK.js"),__vite__mapDeps([33,1,2,34,35,4,36]))),wt=C(()=>N(()=>import("./Player-C3glywqj.js"),__vite__mapDeps([37,1,2,38,4,39,40,12,17,18,8,9,10,23,41,42,43,44,45]))),ia=C(()=>N(()=>import("./Search-DAMXgG2r.js"),__vite__mapDeps([46,1,4,3,5,6,7,2,8,9,10,11,12,13,14,15,47,48]))),sa=C(()=>N(()=>import("./Mature-oAatUU-G.js"),__vite__mapDeps([49,1,2,4,3,5,6,7,8,9,10,11,12,13,14,15,23,47,48,50]))),St=C(()=>N(()=>import("./Asmr-BCfPv0s2.js"),__vite__mapDeps([51,1,4,2,34,35,11,9,12,13,28,52,53,54,21,40,55,56]))),aa=C(()=>N(()=>import("./Manga-D7DgIXOq.js"),__vite__mapDeps([57,1,4,34,35,14,15,11,9,12,13,19,20,2,21,23,58,59,55,56]))),ca=C(()=>N(()=>import("./MangaInfoPage-Drk264JK.js"),__vite__mapDeps([60,1,4,14,15,20,2,58,59,55,56]))),la=C(()=>N(()=>import("./MangaReadPage-CnmtQB51.js"),__vite__mapDeps([61,1,14,4,15,2,20,58,59,55,56]))),ua=C(()=>N(()=>import("./ReadingList-BCAszsYl.js"),__vite__mapDeps([62,1,11,9,12,4,13,63,3,5,14,15,31,32,19,20,2,21,22,16]))),da=C(()=>N(()=>import("./Radio-mP5TUQJn.js"),__vite__mapDeps([64,1,4,2,52,53,65,66,55,56]))),ma=C(()=>N(()=>import("./Music-vX10ZW0N.js"),__vite__mapDeps([67,1,4,65,66,52,53,2,55,56,68]))),Pt=C(()=>N(()=>import("./TvSearch-B9lZQqIk.js"),__vite__mapDeps([69,1,4,3,5,24,11,9,12,13,25,26,2,14,15,47,48]))),pa=C(()=>N(()=>import("./TvInfo-BFVLnDNN.js"),__vite__mapDeps([70,1,4,26,2,71]))),ha=C(()=>N(()=>import("./Tv-C9pmI-95.js"),__vite__mapDeps([72,1,2,4,38,39,73,23,26,40,12,43,44,74]))),fa=C(()=>N(()=>import("./TvWatchlist-Do2SUmoL.js"),__vite__mapDeps([75,1,11,9,12,4,13,63,3,5,14,15,31,32,16,25,26,2]))),ya=C(()=>N(()=>import("./ListeningList-By91F5vR.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]))),va=C(()=>N(()=>import("./Trackers-DS90l3Q9.js"),__vite__mapDeps([77,1,2,4,78]))),ga=C(()=>N(()=>import("./Insights-CXAxHzhr.js"),__vite__mapDeps([79,1,2,4,80]))),ba=C(()=>N(()=>import("./AnimeInfoPage-QYTo62vI.js"),__vite__mapDeps([81,1,2,4]))),_a=C(()=>N(()=>import("./PlayerRedirect-fv2tzEUu.js"),__vite__mapDeps([82,1]))),wa=C(()=>N(()=>import("./VirtualKeyboard-BmqZPZXR.js"),__vite__mapDeps([83,1,84])));function Sa(){const{isOpen:e,closeModal:t,onSuccess:n}=Es(),{isOpen:r,setIsOpen:i}=et(),{isOpen:s,openModal:a,closeModal:c}=Js(),l=Ve(),u=_n(),d=D(new Map),m=D(l.pathname),p=wi();Ps();const[h,f]=w(!1);b(()=>{fetch("/api/auth/app-status").then(T=>T.json()).then(T=>{T.hasPassword&&!T.isAuthenticated&&(f(!0),a())}).catch(()=>{})},[a]);const[k,A]=cn("lan_auth_notice_shown","false"),j=D(!1);return b(()=>{if(k==="true"||j.current)return;j.current=!0,A("true");const T=setTimeout(()=>{g("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(T)},[k,A]),b(()=>{try{window.history.scrollRestoration="manual"}catch{}},[]),b(()=>{const T=l.key,x=d.current;if(u==="POP"){const q=x.get(T)??0;window.scrollTo({top:q,behavior:"instant"})}else l.pathname!==m.current&&window.scrollTo({top:0,behavior:"instant"});return m.current=l.pathname,()=>{x.set(T,window.scrollY)}},[l.key,l.pathname,u]),b(()=>{const T=x=>{r&&x.key==="Escape"&&i(!1)};return r?document.body.classList.add("sidebar-open"):document.body.classList.remove("sidebar-open"),window.addEventListener("keydown",T),()=>{window.removeEventListener("keydown",T),document.body.classList.remove("sidebar-open")}},[r,i]),o("div",{className:"app-container",children:[o(Us,{isOpen:e,onClose:t,onSuccess:n}),o(ta,{isOpen:s,onClose:h?()=>{}:c,onSuccess:()=>{f(!1),c()}}),o(vr,{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(Ki,{}),o(os,{}),o("main",{className:"main-content",children:o(Vs,{children:o(nt,{fallback:o(Hs,{}),children:o(wn,{children:[o(S,{path:"/",element:o(na,{})}),o(S,{path:"/watchlist/:filter?",element:o(ra,{})}),o(S,{path:"/reading-list/:filter?",element:o(ua,{})}),o(S,{path:"/search",element:o(ia,{})}),o(S,{path:"/mature",element:o(sa,{})}),o(S,{path:"/asmr",element:o(St,{})}),o(S,{path:"/asmr/:rj",element:o(St,{})}),o(S,{path:"/manga",element:o(aa,{})}),o(S,{path:"/manga/:provider/:id",element:o(ca,{})}),o(S,{path:"/manga/:provider/:id/read",element:o(la,{})}),o(S,{path:"/radio",element:o(da,{})}),o(S,{path:"/music",element:o(ma,{})}),o(S,{path:"/tv",element:o(Pt,{})}),o(S,{path:"/tv/:id",element:o(pa,{})}),o(S,{path:"/tv/:id/watch",element:o(ha,{})}),o(S,{path:"/tv-search",element:o(Pt,{})}),o(S,{path:"/tv-watchlist/:filter?",element:o(fa,{})}),o(S,{path:"/listening-list/:filter?",element:o(ya,{})}),o(S,{path:"/settings",element:o(oa,{})}),o(S,{path:"/trackers",element:o(va,{})}),o(S,{path:"/mal",element:o(rt,{to:"/trackers",replace:!0})}),o(S,{path:"/insights",element:o(ga,{})}),o(S,{path:"/anime/:id",element:o(ba,{})}),o(S,{path:"/watch/:id",element:o(wt,{})}),o(S,{path:"/watch/:id/:episodeNumber",element:o(wt,{})}),o(S,{path:"/player/:id/:episodeNumber?",element:o(_a,{})}),o(S,{path:"*",element:o(rt,{to:"/",replace:!0})})]})})})}),o(Ss,{}),p.isVisible&&o(nt,{fallback:null,children:o(wa,{activeInputRef:p.activeInputRef,isVisible:p.isVisible,onClose:p.hide})})]})}function Pa(){return o(Gs,{children:o(Sa,{})})}const Ea=({children:e})=>{const[t,n]=w(!1),r=M(()=>{n(s=>!s)},[]),i=de(()=>({isOpen:t,setIsOpen:n,toggleSidebar:r}),[t,r]);return o(Zt.Provider,{value:i,children:e})},ka=({children:e})=>{const[t,n]=cn("dango_content_type","anime"),r=de(()=>({contentType:t,setContentType:n}),[t,n]);return o(en.Provider,{value:r,children:e})},Ta=({children:e})=>{const[t,n]=w("englishName"),[r,i]=w(!0);b(()=>{(async()=>{try{const c=await H.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=de(()=>({titlePreference:t,setTitlePreference:n,loading:r}),[t,r]);return o(Ut.Provider,{value:s,children:e})},hn=ee(void 0),lc=()=>{const e=te(hn);if(e===void 0)throw new Error("useLowEndMode must be used within a LowEndModeProvider");return e},xa=({children:e})=>{const{data:t,isLoading:n}=tt("lowEndMode"),r=on(),i=F(),[s,a]=w(!1);b(()=>{const u=i.getDefaultOptions();i.setDefaultOptions({...u,queries:{...u.queries,gcTime:s?900*1e3:1800*1e3}})},[s,i]),b(()=>{t!==void 0&&a(t==="true"||t===!0)},[t]),b(()=>{s?document.body.classList.add("low-end"):document.body.classList.remove("low-end")},[s]);const c=M(u=>{a(u),r.mutate({key:"lowEndMode",value:String(u)})},[r]),l=de(()=>({lowEndMode:s,setLowEndMode:c,loading:n}),[s,c,n]);return o(hn.Provider,{value:l,children:e})},Ia=["iris","mochi","sakura"];function Et(e){e==="iris"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",e)}const Oa=({children:e})=>{const{data:t,isLoading:n}=tt("theme"),r=on(),[i,s]=w("iris");b(()=>{typeof t=="string"&&Ia.includes(t)&&s(t)},[t]),b(()=>{Et(i)},[i]);const a=M(l=>{l!==i&&(s(l),Et(l),r.mutate({key:"theme",value:l}))},[r,i]),c=de(()=>({theme:i,setTheme:a,loading:n}),[i,a,n]);return o(Jt.Provider,{value:c,children:e})},Ca=({children:e})=>{const[t,n]=w(!1),[r,i]=w(void 0),s=M(c=>{i(()=>c),n(!0)},[]),a=M(()=>{n(!1),i(void 0)},[]);return b(()=>Qt("animepahe",()=>s()),[s]),o(ln.Provider,{value:{isOpen:t,openModal:s,closeModal:a,onSuccess:r},children:e})};try{window.history.scrollRestoration="manual"}catch{}const kt=new Tn({defaultOptions:{queries:{staleTime:1e3*60*5,gcTime:1800*1e3,refetchOnWindowFocus:!1,refetchIntervalInBackground:!1,retry:1}}}),Tt=document.getElementById("root");Tt&&Sn(o(Pn,{children:o(qo,{trpcClient:H,queryClient:kt,children:o(xn,{client:kt,children:o(Ca,{children:o(Ea,{children:o(ka,{children:o(Ta,{children:o(xa,{children:o(Oa,{children:o(Pa,{})})})})})})})})})}),Tt);export{Ha as $,on as A,_t as B,tc as C,nc as D,ec as E,L as F,Yt as G,yt as H,ft as I,$a as J,Us as K,Wa as L,we as M,_i as N,cc as O,B as P,Qt as Q,ac as R,De as S,sc as T,Ra as U,nn as V,et as W,ic as X,Hs as Y,Ua as Z,N as _,cn as a,Ka as a0,Ma as b,Fa as c,Mo as d,Ui as e,$o as f,qa as g,E as h,Ba as i,tn as j,Za as k,za as l,Qa as m,Va as n,Ga as o,rc as p,Ya as q,Da as r,ja as s,H as t,lc as u,oc as v,Xa as w,Ja as x,tt as y,g as z};
|
|
178
|
+
`,Pe=16,vr=({reverseOrder:e,position:t="top-center",toastOptions:n,gutter:r,children:i,toasterId:s,containerStyle:a,containerClassName:c})=>{let{toasts:l,handlers:u}=Kn(n,s);return $("div",{"data-rht-toaster":s||"",style:{position:"fixed",zIndex:9999,top:Pe,left:Pe,right:Pe,bottom:Pe,pointerEvents:"none",...a},className:c,onMouseEnter:u.startPause,onMouseLeave:u.endPause},l.map(d=>{let m=d.position||t,p=u.calculateOffset(d,{reverseOrder:e,gutter:r,defaultPosition:t}),h=fr(m,p);return $(hr,{id:d.id,key:d.id,onHeightUpdate:u.updateHeight,className:d.visible?yr:"",style:h},d.type==="custom"?Oe(d.message,d):i?i(d):$(pr,{toast:d,position:m}))}))},g=L;function Le(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(gr,t)}};return t}function gr(e,t){return t(e)}function br(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 _r(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 Le(c=>(n++,i.push(c),s(),{unsubscribe(){n--,a();const l=i.findIndex(u=>u===c);l>-1&&i.splice(l,1)}}))}}function wr(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=Le(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 Sr(e){return Le(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 ve(e){"@babel/helpers - typeof";return ve=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ve(e)}function Pr(e,t){if(ve(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ve(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Er(e){var t=Pr(e,"string");return ve(t)=="symbol"?t:t+""}function W(e,t,n){return(t=Er(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function st(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 R(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?st(Object(n),!0).forEach(function(r){W(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):st(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function se(e){return!!e&&!Array.isArray(e)&&typeof e=="object"}function kr(e){return typeof e=="function"}function Tr(){return Object.create(null)}const xr=typeof Symbol=="function"&&!!Symbol.asyncIterator;function Ir(e){return xr&&se(e)&&Symbol.asyncIterator in e}const Or=e=>e(),qt=()=>{},at=e=>{Object.freeze&&Object.freeze(e)};function jt(e,t,n){var r;const i=t.join(".");return(r=n[i])!==null&&r!==void 0||(n[i]=new Proxy(qt,{get(s,a){if(!(typeof a!="string"||a==="then"))return jt(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)}),at(u.args),at(u.path),e(u)}})),n[i]}const $t=e=>jt(e,[],Tr()),Cr=e=>new Proxy(qt,{get(t,n){if(n!=="then")return e(n)}});function ge(e){"@babel/helpers - typeof";return ge=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ge(e)}function Nr(e,t){if(ge(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ge(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ar(e){var t=Nr(e,"string");return ge(t)=="symbol"?t:t+""}function Be(e,t,n){return(t=Ar(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 Ee(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){Be(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}var Lr=class extends Error{constructor(e){super(Rr(e)),Object.assign(this,e)}};function Rr(e){if("message"in e)return String(e.message)}function qr(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(se(e))return new Lr(e)}}var lt=class extends Error{constructor(e){var t,n,r;const i=qr(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}),Be(this,"cause",void 0),Be(this,"code",void 0),this.code=e.code,this.name="TRPCError",(r=this.cause)!==null&&r!==void 0||(this.cause=i)}};function jr(e,t){if("error"in e){const n=t.deserialize(e.error);return{ok:!1,error:Ee(Ee({},e),{},{error:n})}}return{ok:!0,result:Ee(Ee({},e.result),(!e.result.type||e.result.type==="data")&&{type:"data",data:t.deserialize(e.result.data)})}}var $e=class extends Error{constructor(){super("Unable to transform response from server")}};function $r(e,t){let n;try{n=jr(e,t)}catch{throw new $e}if(!n.ok&&(!se(n.error.error)||typeof n.error.error.code!="number"))throw new $e;if(n.ok&&!se(n.result))throw new $e;return n}function Dr(e){return typeof e=="function"}async function Mr(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 Fr(e){const{type:t,path:n}=e,r=await Mr(e.router,n);if(!r||!Dr(r)||r._def.type!==t&&!e.allowMethodOverride)throw new lt({code:"NOT_FOUND",message:`No "${t}"-procedure on path "${n}"`});if(r._def.type!==t&&e.allowMethodOverride&&r._def.type==="subscription")throw new lt({code:"METHOD_NOT_SUPPORTED",message:"Method override is not supported for subscriptions"});return r(e)}function Br(e){return e instanceof Ce}function Wr(e){return se(e)&&se(e.error)&&typeof e.error.code=="number"&&typeof e.error.message=="string"}function zr(e,t){return typeof e=="string"?e:se(e)&&typeof e.message=="string"?e.message:t}var Ce=class xe extends Error{constructor(t,n){var r,i;const s=n?.cause;super(t,{cause:s}),W(this,"cause",void 0),W(this,"shape",void 0),W(this,"data",void 0),W(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,xe.prototype)}static from(t,n={}){const r=t;return Br(r)?(n.meta&&(r.meta=R(R({},r.meta),n.meta)),r):Wr(r)?new xe(r.error.message,R(R({},n),{},{result:r,cause:n.cause})):new xe(zr(r,"Unknown error"),R(R({},n),{},{cause:r}))}};function Qr(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 ut=e=>typeof e=="function";function Kr(e){if(e)return e;if(typeof window<"u"&&ut(window.fetch))return window.fetch.bind(window);if(typeof globalThis<"u"&&ut(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}function Ur(...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 Hr(...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 Vr(e){return{url:e.url.toString(),fetch:e.fetch,transformer:Qr(e.transformer),methodOverride:e.methodOverride}}function Gr(e){const t={};for(let n=0;n<e.length;n++){const r=e[n];t[n]=r}return t}const Jr={query:"GET",mutation:"POST",subscription:"PATCH"};function Dt(e){return"input"in e?e.transformer.input.serialize(e.input):Gr(e.inputs.map(t=>e.transformer.input.serialize(t)))}const Mt=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=Dt(e);i!==void 0&&e.methodOverride!=="POST"&&r.push(`input=${encodeURIComponent(JSON.stringify(i))}`)}return r.length&&(n+="?"+r.join("&")),n},Yr=e=>{if(e.type==="query"&&e.methodOverride!=="POST")return;const t=Dt(e);return t!==void 0?JSON.stringify(t):void 0},Xr=e=>no(R(R({},e),{},{contentTypeHeader:"application/json",getUrl:Mt,getBody:Yr}));var Zr=class extends Error{constructor(){const e="AbortError";super(e),this.name=e,this.message=e}};const eo=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 Zr};async function to(e){var t,n;eo(e.signal);const r=e.getUrl(e),i=e.getBody(e),s=(t=e.methodOverride)!==null&&t!==void 0?t:Jr[e.type],a=await(async()=>{const l=await e.headers();return Symbol.iterator in l?Object.fromEntries(l):l})(),c=R(R(R({},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 Kr(e.fetch)(r,{method:s,signal:e.signal,body:i,headers:c})}async function no(e){const t={},n=await to(e);t.response=n;const r=await n.json();return t.responseJSON=r,{json:r,meta:t}}const dt=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function mt(e){let t=null,n=null;const r=()=>{clearTimeout(n),n=null,t=null};function i(c){const l=[[]];let u=0;for(;;){const p=c[u];if(!p)break;const h=l[l.length-1];if(p.aborted){var d;(d=p.reject)===null||d===void 0||d.call(p,new Error("Aborted")),u++;continue}if(e.validate(h.concat(p).map(f=>f.key))){h.push(p),u++;continue}if(h.length===0){var m;(m=p.reject)===null||m===void 0||m.call(p,new Error("Input is too big for a single dispatch")),u++;continue}l.push([])}return l}function 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(p,h)=>{const f=u.items[h];try{var k;const j=await Promise.resolve(p);(k=f.resolve)===null||k===void 0||k.call(f,j)}catch(j){var A;(A=f.reject)===null||A===void 0||A.call(f,j)}f.batch=null,f.reject=null,f.resolve=null}));for(const p of u.items){var m;(m=p.reject)===null||m===void 0||m.call(p,new Error("Missing result")),p.batch=null}}).catch(d=>{for(const p of u.items){var m;(m=p.reject)===null||m===void 0||m.call(p,d),p.batch=null}})}}function a(c){var l;const u={aborted:!1,key:c,batch:null,resolve:dt,reject:dt},d=new Promise((m,p)=>{var h;u.reject=p,u.resolve=m,(h=t)!==null&&h!==void 0||(t=[]),t.push(u)});return(l=n)!==null&&l!==void 0||(n=setTimeout(s)),d}return{load:a}}function ro(e){var t,n;const r=Vr(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(p=>p.path).join(","),m=u.map(p=>p.input);return Mt(R(R({},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),p=Ur(...u.map(f=>f.signal)),h=await Xr(R(R({},r),{},{path:d,inputs:m,type:l,headers(){return e.headers?typeof e.headers=="function"?e.headers({opList:u}):e.headers:{}},signal:p}));return(Array.isArray(h.json)?h.json:u.map(()=>h.json)).map(f=>({meta:h.meta,json:f}))}}),c={query:mt(a("query")),mutation:mt(a("mutation"))};return({op:l})=>Le(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(R(R({},l),{},{signal:Hr(l.signal,d.signal)}));let p=!1,h;return m.then(f=>{p=!0,h=f;const k=$r(f.json,r.transformer.output);if(!k.ok){u.error(Ce.from(k.error,{meta:f.meta}));return}u.next({context:f.meta,result:k.result}),u.complete()}).catch(f=>{p=!0,u.error(Ce.from(f,{meta:h?.meta}))}),()=>{p||d.abort()}})}}const Ft=(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 io(e){const t=await Ft(e.url);return e.connectionParams?t+`${t.includes("?")?"&":"?"}connectionParams=1`:t}async function so(e,t){const n={method:"connectionParams",data:await Ft(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 co(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 We{constructor(t){var n;if(W(this,"id",++We.connectCount),W(this,"WebSocketPonyfill",void 0),W(this,"urlOptions",void 0),W(this,"keepAliveOpts",void 0),W(this,"encoder",void 0),W(this,"wsObservable",wr(null)),W(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=++We.connectCount;const t=io(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&&co(n,this.keepAliveOpts),n.addEventListener("close",()=>{this.ws===n&&(this.ws=null)}),await ao(n),this.urlOptions.connectionParams&&n.send(await so(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()}}};W(lo,"connectCount",0);var Bt=class{constructor(e){W(this,"links",void 0),W(this,"runtime",void 0),W(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=e.links.map(t=>t(this.runtime))}$request(e){var t;return Sr({links:this.links,op:R(R({},e),{},{context:(t=e.context)!==null&&t!==void 0?t:{},id:++this.requestId})}).pipe(_r())}async requestAsPromise(e){try{const t=this.$request(e);return(await br(t)).result.data}catch(t){throw Ce.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 Wt=Symbol.for("trpc_untypedClient"),uo={query:"query",mutate:"mutation",subscribe:"subscription"},mo=e=>uo[e];function po(e){const t=$t(({path:n,args:r})=>{const i=[...n],s=mo(i.pop()),a=i.join(".");return e[s](a,...r)});return Cr(n=>n===Wt?e:t[n])}function ho(e){return po(new Bt(e))}function fo(e){return e[Wt]}function be(e){"@babel/helpers - typeof";return be=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},be(e)}function yo(e,t){if(be(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(be(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function vo(e){var t=yo(e,"string");return be(t)=="symbol"?t:t+""}function go(e,t,n){return(t=vo(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 P(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){go(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}function bo(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 Ie(t.call(e));n="@@asyncIterator",r="@@iterator"}throw new TypeError("Object is not async iterable")}function Ie(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 Ie=function(r){this.s=r,this.n=r.next},Ie.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 Ie(e)}function _o(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 wo(e,t){if(e==null)return{};var n,r,i=_o(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 So=["cursor","direction"];function Re(e){return{path:e.path.join(".")}}function Po(e){return e.length>=3}function Eo(e){return Po(e)?{type:"prefixed",prefix:e[0],path:e[1],args:e[2]}:{type:"unprefixed",prefix:void 0,path:e[0],args:e[1]}}function Ye(e,t,n){var r;const i=Eo(e);let s=(r=i.args)===null||r===void 0?void 0:r.input;if(n){var a,c;s=P(P(P({},(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 ko(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=bo(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 Z(e){const t=Or(()=>{const{input:n,type:r}=e,i=e.path.flatMap(s=>s.split("."));if(!n&&r==="any")return i.length?[i]:[];if(r==="infinite"&&se(n)&&("direction"in n||"cursor"in n)){const{cursor:s,direction:a}=n;return[i,{input:wo(n,So),type:"infinite"}]}return[i,P(P({},typeof n<"u"&&n!==ce&&{input:n}),r&&r!=="any"&&{type:r})]});return e.prefix&&t.unshift([e.prefix]),t}function zt(e){const t=[e.path.flatMap(n=>n.split("."))];return e.prefix&&t.unshift([e.prefix]),t}function Xe(e){return kr(e)?e():e}function To(e){var t;const{input:n,query:r,path:i,queryKey:s,opts:a}=e,c=n===ce,l=async u=>{var d;const m=P(P({},a),{},{trpc:P(P({},a?.trpc),!(a==null||(d=a.trpc)===null||d===void 0)&&d.abortOnUnmount?{signal:u.signal}:{signal:null})});return await r(...Ye(s,m,{direction:u.direction,pageParam:u.pageParam}))};return Object.assign(En(P(P({},a??{}),{},{queryKey:s,queryFn:c?ce:l,initialPageParam:(t=a?.initialCursor)!==null&&t!==void 0?t:n?.cursor})),{trpc:Re({path:i})})}function xo(e){var t,n;const{mutate:r,path:i,prefix:s,opts:a,overrides:c}=e,l=Xe(e.queryClient),u=zt({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:(h=>h.originalFn()),p=async h=>await r(...Ye([...u,{input:h}],a));return P(P({},a),{},{mutationKey:u,mutationFn:p,onSuccess(...h){var f,k;return m({originalFn:()=>{var j,T,x;return(j=a==null||(T=a.onSuccess)===null||T===void 0?void 0:T.call(a,...h))!==null&&j!==void 0?j:d==null||(x=d.onSuccess)===null||x===void 0?void 0:x.call(d,...h)},queryClient:l,meta:(f=(k=a?.meta)!==null&&k!==void 0?k:d?.meta)!==null&&f!==void 0?f:{}})},trpc:Re({path:i})})}function Io(e){const{input:t,query:n,path:r,queryKey:i,opts:s}=e,a=Xe(e.queryClient),c=t===ce,l=async u=>{var d;const m=P(P({},s),{},{trpc:P(P({},s?.trpc),!(s==null||(d=s.trpc)===null||d===void 0)&&d.abortOnUnmount?{signal:u.signal}:{signal:null})}),p=u.queryKey,h=await n(...Ye(p,m));return Ir(h)?ko(h,a,p):h};return Object.assign(kn(P(P({},s),{},{queryKey:i,queryFn:c?ce:l})),{trpc:Re({path:r})})}const Oo=e=>{const{subscribe:t,path:n,queryKey:r,input:i,opts:s={}}=e,a="enabled"in s?!!s.enabled:i!==ce,c=l=>t(n.join("."),i===ce?void 0:i,l);return P(P({},s),{},{enabled:a,subscribe:c,queryKey:r,trpc:Re({path:n})})};function Co(e){const t=e.keyPrefix,n=r=>(i,s,a)=>"router"in e?Promise.resolve(Xe(e.ctx)).then(c=>Fr({router:e.router,path:i,getRawInput:async()=>s,ctx:c,type:r,signal:void 0,batchIndex:0})):(e.client instanceof Bt?e.client:fo(e.client))[r](i,s,a);return $t(({args:r,path:i})=>{const s=[...i],a=s.pop(),[c,l]=r;return{"~types":void 0,pathKey:()=>Z({path:s,type:"any",prefix:t}),pathFilter:()=>P(P({},c),{},{queryKey:Z({path:s,type:"any",prefix:t})}),queryOptions:()=>Io({input:c,opts:l,path:s,queryClient:e.queryClient,queryKey:Z({path:s,input:c,type:"query",prefix:t}),query:n("query")}),queryKey:()=>Z({path:s,input:c,type:"query",prefix:t}),queryFilter:()=>P(P({},l),{},{queryKey:Z({path:s,input:c,type:"query",prefix:t})}),infiniteQueryOptions:()=>To({input:c,opts:l,path:s,queryKey:Z({path:s,input:c,type:"infinite",prefix:t}),query:n("query")}),infiniteQueryKey:()=>Z({path:s,input:c,type:"infinite",prefix:t}),infiniteQueryFilter:()=>P(P({},l),{},{queryKey:Z({path:s,input:c,type:"infinite",prefix:t})}),mutationOptions:()=>{var u;return xo({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:()=>zt({path:s,prefix:t}),subscriptionOptions:()=>Oo({opts:l,path:s,input:c,queryKey:Z({path:s,input:c,type:"any",prefix:t}),subscribe:n("subscription")})}[a]()})}function No(){const e=ee(null),t=ee(null),n=s=>{const a=de(()=>Co({client:s.trpcClient,queryClient:s.queryClient,keyPrefix:s.keyPrefix}),[s.trpcClient,s.queryClient,s.keyPrefix]);return $(e.Provider,{value:s.trpcClient},$(t.Provider,{value:a},s.children))};n.displayName="TRPCProvider";function r(){const s=te(t);if(!s)throw new Error("useTRPC() can only be used inside of a <TRPCProvider>");return s}function i(){const s=te(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 ze={lan:new Set,animepahe:new Set,jasmr:new Set};function le(e){for(const t of[...ze[e]])try{t()}catch(n){console.error(`auth-bus listener failed (${e}):`,n)}}function Qt(e,t){return ze[e].add(t),()=>{ze[e].delete(t)}}const Ao=e=>new Promise(t=>setTimeout(t,e)),Kt=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 Ao(Math.min(500*2**a,4e3)),s=await fetch(e,{...t,headers:{...n,...t?.headers}});return s},Ra=async(e,t)=>{const n=await Kt(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"&&le("animepahe"),n.status===403&&s==="AUTH_REQUIRED"&&i.provider==="jasmr"&&le("jasmr"),n.status===401&&s==="LAN_AUTH_REQUIRED"&&le("lan"),new Error(s||`Failed to fetch from ${e}`)}return n.json()};async function Lo(e,t){const n=await Kt(e,t);if(n.status===401)try{(await n.clone().json())?.error==="LAN_AUTH_REQUIRED"&&le("lan")}catch{}return await Ro(n),n}async function Ro(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")&&le(s.provider),(i.message==="LAN_AUTH_REQUIRED"||s?.code==="LAN_AUTH_REQUIRED")&&le("lan")}}catch{}}const{TRPCProvider:qo,useTRPC:E}=No(),H=ho({links:[ro({url:"/api/trpc",fetch:Lo})]}),ye=new Map,jo=500,$o=(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(ye.has(i))return ye.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 ye.size>jo&&ye.clear(),ye.set(i,s),s},qa=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 ja(e){return e?e.replace(/<[^>]*>?/gm,"").replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").trim():""}function $a(e){return e==null?e:e>10?Number((e/10).toFixed(1)):e}const Do=(...e)=>e.filter(Boolean).join(" "),Ut=ee(void 0),Mo=()=>{const e=te(Ut);if(e===void 0)throw new Error("useTitlePreference must be used within a TitlePreferenceProvider");return e},Da=()=>{const e=E();return Q({...e.data.spotlight.queryOptions(),staleTime:1e3*60*5,retry:1})},Ma=(e="TRENDING_DESC",t=10)=>Ge({queryKey:["trendingList",e,t],queryFn:({pageParam:n=1})=>H.data.popularList.query({sort:e,page:n,size:t}),initialPageParam:1,getNextPageParam:(n,r)=>n.length>=t?r.length+1:void 0}),Fa=(e="TV",t=12)=>Ge({queryKey:["latestReleases",e,t],queryFn:({pageParam:n=1})=>H.data.latestReleases.query({format:e,page:n,size:t}),initialPageParam:1,getNextPageParam:(n,r)=>n.length>=t?r.length+1:void 0}),Ba=(e,t="TV",n=!0)=>{const r=E();return Q({...r.data.seasonal.queryOptions({page:e,format:t}),enabled:n,staleTime:1e3*60*5})},Fo=["query","sortBy","type","status","season","year","country","genres","excludeGenres","excludeTags","minScore","minEpisodes","adult"],Wa=(e,t,n=14)=>{const r=E(),i=new URLSearchParams(e),s={page:t,limit:n};for(const a of Fo){const c=i.get(a);c!==null&&(s[a]=c)}return Q({...r.data.search.queryOptions(s),enabled:e!=null})},za=()=>{const e=E();return Q(e.queue.list.queryOptions())},Bo=()=>{const e=E(),t=F();return V(e.queue.add.mutationOptions({onSuccess:n=>{n.queued?g.success("Added to queue"):g.success("Removed from queue"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:["queue-remaining"]})},onError:n=>{g.error(`Failed to update queue: ${n.message}`)}}))},Qa=()=>{const e=E(),t=F();return V(e.queue.remove.mutationOptions({onSuccess:()=>{g.success("Removed from queue"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:["queue-remaining"]}),t.invalidateQueries({queryKey:["allContinueWatching"]})},onError:n=>{g.error(`Failed to remove: ${n.message}`)}}))},Ka=(e,t=!0)=>Q({queryKey:["queue-remaining",e],queryFn:()=>H.watchlist.queueRemaining.query({showId:e}),enabled:!!e&&t,staleTime:1e3*60}),Ua=()=>{const e=E(),t=F();return V(e.queue.addBatch.mutationOptions({onSuccess:(n,r)=>{const i=n.added??r.episodeNumbers.length;g.success(`${i} ${i===1?"episode":"episodes"} added to queue`),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:["queue-remaining"]})},onError:n=>{g.error(`Failed to update queue: ${n.message}`)}}))},Ha=()=>{const e=E(),t=F();return V(e.queue.removeMany.mutationOptions({onSuccess:()=>{g.success("Removed from queue"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:["queue-remaining"]}),t.invalidateQueries({queryKey:["allContinueWatching"]})},onError:n=>{g.error(`Failed to remove: ${n.message}`)}}))},Va=()=>{const e=E(),t=F();return V(e.queue.clear.mutationOptions({onSuccess:()=>{g.success("Queue cleared"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:["queue-remaining"]}),t.invalidateQueries({queryKey:["allContinueWatching"]})},onError:n=>{g.error(`Failed to clear queue: ${n.message}`)}}))},Ga=()=>{const e=E(),t=F(),n=e.queue.list.queryOptions().queryKey;return V(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())}}))},Wo=["status","showMature","query","type","season","year","genres","excludeGenres","sortBy","titlePreference"];function Ze(e,t,n){const r=new URLSearchParams(e),i={page:t,limit:n};for(const s of Wo){const a=r.get(s);a!==null&&(i[s]=a)}return i}const Ja=(e,t="",n,r=14)=>Q({queryKey:["watchlist",e,t,n,r],queryFn:async()=>{const i=new URLSearchParams(t);return i.set("status",e),await H.watchlist.list.query(Ze(i.toString(),n,r))}}),Ya=(e="")=>Ge({queryKey:["allContinueWatching",e],queryFn:async({pageParam:t=1})=>await H.watchlist.continueWatchingAll.query(Ze(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)})}),Xa=(e="",t,n=14)=>Q({queryKey:["allContinueWatching",e,t,n],queryFn:async()=>await H.watchlist.continueWatchingAll.query(Ze(e,t,n))}),Za=()=>{const e=E(),t=F();return V(e.watchlist.remove.mutationOptions({onSuccess:()=>{g.success("Removed from watchlist"),t.invalidateQueries(e.watchlist.pathFilter()),t.invalidateQueries({queryKey:["watchlist"]})},onError:n=>{g.error(`Failed to remove: ${n.message}`)}}))},ec=()=>{const e=E(),t=F();return V(e.watchlist.batchStatus.mutationOptions({onSuccess:n=>{g.success(`Status updated for ${n.updated??0} items`),t.invalidateQueries(e.watchlist.pathFilter()),t.invalidateQueries({queryKey:["watchlist"]}),t.invalidateQueries({queryKey:["allContinueWatching"]})},onError:n=>{g.error(`Failed to update statuses: ${n.message}`)}}))},tc=()=>{const e=E(),t=F();return V(e.watchlist.removeMany.mutationOptions({onSuccess:n=>{const r=n.removed??0;g.success(`Removed ${r} ${r===1?"item":"items"} from watchlist`),t.invalidateQueries(e.watchlist.pathFilter()),t.invalidateQueries({queryKey:["watchlist"]}),t.invalidateQueries({queryKey:["allContinueWatching"]})},onError:n=>{g.error(`Failed to remove: ${n.message}`)}}))},nc=()=>{const e=E(),t=F();return V(e.continueWatching.removeMany.mutationOptions({onSuccess:n=>{const r=n.removed??0;g.success(`Removed ${r} ${r===1?"item":"items"} from continue watching`),t.invalidateQueries(e.continueWatching.pathFilter()),t.invalidateQueries({queryKey:["allContinueWatching"]})},onError:n=>{g.error(`Failed to remove: ${n.message}`)}}))},Ht=(e=!0)=>{const t=E();return Q({...t.notifications.list.queryOptions(),enabled:e,refetchInterval:3e4})},Vt=(e=!0)=>{const t=E();return Q({...t.data.systemNotifications.queryOptions(),enabled:e,refetchInterval:3e4})},Gt=(e=!0)=>{const t=E();return Q({...t.discovery.status.queryOptions(),enabled:e,refetchInterval:n=>n.state.data?.running?2e3:!1})},zo=()=>{const e=E(),t=F(),n=e.discovery.status.queryOptions().queryKey;return V(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})}}))},Qo=()=>{const e=E(),t=F();return V(e.notifications.dismiss.mutationOptions({onSuccess:()=>{t.invalidateQueries(e.notifications.pathFilter())}}))},Ko=()=>{const e=E(),t=F();return V(e.notifications.clearAll.mutationOptions({onSuccess:()=>{t.invalidateQueries(e.notifications.pathFilter())}}))},rc=()=>{const e=E();return Q({...e.continueWatching.thisWeek.queryOptions(),staleTime:1e3*60*5})},oc=()=>{const e=E();return Q({...e.data.genresAndTags.queryOptions(),staleTime:1e3*60*60})},ic=()=>Q({queryKey:["genreCards"],queryFn:()=>H.insights.genreCards.query()}),Uo="_container_z68uz_1",Ho="_bellBtn_z68uz_7",Vo="_badge_z68uz_56",Go="_dropdown_z68uz_96",Jo="_dropdownHeader_z68uz_127",Yo="_clearAllBtn_z68uz_141",Xo="_discoveryStatusRow_z68uz_156",Zo="_statusDot_z68uz_167",ei="_statusDotRunning_z68uz_174",ti="_statusDotOk_z68uz_179",ni="_statusDotInfo_z68uz_183",ri="_statusDotError_z68uz_187",oi="_statusDotIdle_z68uz_191",ii="_list_z68uz_205",si="_item_z68uz_219",ai="_thumbnail_z68uz_234",ci="_itemInfo_z68uz_243",li="_itemTitle_z68uz_248",ui="_itemMeta_z68uz_259",di="_systemItemMeta_z68uz_269",mi="_removeItem_z68uz_286",pi="_queueItem_z68uz_316",hi="_emptyState_z68uz_320",y={container:Uo,bellBtn:Ho,badge:Vo,dropdown:Go,dropdownHeader:Jo,clearAllBtn:Yo,discoveryStatusRow:Xo,statusDot:Zo,statusDotRunning:ei,statusDotOk:ti,statusDotInfo:ni,statusDotError:ri,statusDotIdle:oi,list:ii,item:si,thumbnail:ai,itemInfo:ci,itemTitle:li,itemMeta:ui,systemItemMeta:di,removeItem:mi,queueItem:pi,emptyState:hi},fi=({notification:e})=>{const t=Qo(),n=Bo(),[r,i]=He.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}=Mo(),u=l==="nativeName"?e.nativeName||e.name:l==="englishName"&&e.englishName||e.name;return o(U,{to:`/watch/${e.showId}/${e.episodeNumber}`,className:y.item,onClick:a,children:[o("img",{src:$o(e.thumbnail,48,64),alt:e.name,className:y.thumbnail,loading:"lazy",decoding:"async"}),o("div",{className:y.itemInfo,children:[o("span",{className:y.itemTitle,children:u}),o("span",{className:y.itemMeta,children:["New Episode ",e.episodeNumber]})]}),o("button",{className:`${y.removeItem} ${y.queueItem}`,onClick:c,"aria-label":"Add notification to queue",children:r?o(v,{name:"check"}):o(v,{name:"plus"})}),o("button",{className:y.removeItem,onClick:s,"aria-label":"Remove notification",children:o(v,{name:"times"})})]})};function De({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 yi=({count:e=3})=>o(K,{children:Array.from({length:e}).map((t,n)=>o("div",{className:y.item,style:{borderBottom:"1px solid var(--border-primary)",pointerEvents:"none"},children:[o("div",{className:y.thumbnail,style:{overflow:"hidden"},children:o(De,{width:"100%",height:"100%",variant:"rectangular"})}),o("div",{className:y.itemInfo,children:[o(De,{width:"80%",height:"1rem",variant:"text",style:{marginBottom:"4px"}}),o(De,{width:"40%",height:"0.7rem",variant:"rectangular",style:{borderRadius:"var(--radius-sm)"}})]})]},n))}),vi=()=>{const{data:e=[],isLoading:t}=Ht(),{data:n=[]}=Vt(),{data:r}=Gt(),i=Ko(),s=F(),[a,c]=w(null);b(()=>{s.invalidateQueries({queryKey:["notifications"]})},[s]);const l=()=>{i.mutate(void 0)},u=n.find(d=>d.id===a)??null;return o("div",{className:y.dropdown,children:[o("div",{className:y.dropdownHeader,children:[o("h4",{children:"Notifications"}),e.length>0&&o("button",{className:y.clearAllBtn,onClick:l,children:"Clear All"})]}),o("div",{className:y.discoveryStatusRow,children:r?.running?o(K,{children:[o("span",{className:`${y.statusDot} ${y.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(K,{children:[o("span",{className:`${y.statusDot} ${y.statusDotOk}`,"aria-hidden":"true"}),o("span",{children:["Discovery complete — checked ",r.total," ",r.total===1?"show":"shows"]})]}):r?.state==="empty"?o(K,{children:[o("span",{className:`${y.statusDot} ${y.statusDotInfo}`,"aria-hidden":"true"}),o("span",{children:"No shows set to Watching — nothing to check"})]}):r?.state==="error"?o(K,{children:[o("span",{className:`${y.statusDot} ${y.statusDotError}`,"aria-hidden":"true"}),o("span",{children:"Last check failed — will retry automatically"})]}):o(K,{children:[o("span",{className:`${y.statusDot} ${y.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:y.list,children:t&&n.length===0?o(yi,{count:4}):o(K,{children:[n.map(d=>o("div",{className:y.item,children:[o("div",{className:y.thumbnail,style:{background:"transparent",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:0,boxShadow:"none"},children:o(v,{name:"info-circle",size:32,color:"#6c9fff"})}),o("div",{className:y.itemInfo,children:[o("span",{className:y.itemTitle,children:d.title}),o("button",{type:"button",className:y.systemItemMeta,onClick:()=>c(d.id),title:"View full status",children:d.message.length>40?d.message.slice(0,40)+"…":d.message})]}),o("button",{className:y.removeItem,disabled:!0,style:{opacity:.3,cursor:"not-allowed"},"aria-hidden":"true",children:o(v,{name:"plus"})}),o("button",{className:y.removeItem,disabled:!0,style:{opacity:.3,cursor:"not-allowed"},"aria-hidden":"true",children:o(v,{name:"times"})})]},d.id)),n.length>0&&e.length>0&&o("div",{className:y.notificationDivider}),e.length>0?e.map(d=>o(fi,{notification:d},d.id)):!t&&n.length===0&&o("div",{className:y.emptyState,children:"No new notifications"})]})}),u&&xt(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(v,{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(--primary-color)",color:"#fff",border:"none",padding:"0.5rem 1rem",borderRadius:"var(--radius-md)",cursor:"pointer",fontWeight:600},children:"OK"})})]})}),document.body)]})},gi=()=>{const[e,t]=w(!1),n=D(null),r=F(),i=E(),s=zo(),{data:a=[]}=Ht(),{data:c=[]}=Vt(),{data:l}=Gt(),u=a.length+c.length,d=u>5?"5+":u,m=D(!1);b(()=>{const h=f=>{n.current&&!n.current.contains(f.target)&&t(!1)};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[]),b(()=>{const h=!!l?.running;m.current&&!h&&(r.invalidateQueries(i.notifications.pathFilter()),r.invalidateQueries(i.discovery.pathFilter())),m.current=h},[l?.running,r,i]);const p=()=>{const h=!e;t(h),h&&s.mutate()};return o("div",{className:y.container,ref:n,children:[o("button",{className:y.bellBtn,onClick:p,"aria-label":"Notifications",children:[o(v,{name:"bell"}),u>0&&o("span",{className:y.badge,children:d})]}),e&&o(vi,{})]})},Jt=ee(void 0),Yt=()=>{const e=te(Jt);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e},sc=[{id:"iris",label:"Taro (default)",blurb:"Deep purple",swatch:"#7d6df0"},{id:"mochi",label:"Mochi",blurb:"Monochrome pearl",swatch:"#f0f0f0"},{id:"sakura",label:"Sakura",blurb:"Soft pink",swatch:"#e0b0e0"}],ht={iris:"/logo.png",mochi:"/logo-mochi.png",sakura:"/logo-sakura.png"},Xt=({className:e})=>{const{theme:t}=Yt(),n=ht[t]||ht.iris;return o("img",{src:n,alt:"dango",className:e,decoding:"async",style:{height:"var(--logo-height, 75px)",width:"auto",display:"block",objectFit:"contain"}})},Zt=ee(void 0),et=()=>{const e=te(Zt);if(e===void 0)throw new Error("useSidebar must be used within a SidebarProvider");return e},en=ee(void 0),tn=()=>{const e=te(en);if(e===void 0)throw new Error("useContentType must be used within a ContentTypeProvider");return e},Qe="virtual-keyboard:hide",ft="virtual-keyboard:enabled-change",nn="virtual_keyboard_enabled",bi=!1;function yt(){const e=localStorage.getItem(nn);return e===null?bi:e==="true"}const vt=e=>e instanceof HTMLInputElement&&e.type==="text"&&!e.disabled&&!e.readOnly;function _i(){window.dispatchEvent(new CustomEvent(Qe))}function wi(){const[e,t]=w(!1),[n,r]=w(yt),i=D(null);return b(()=>{const s=d=>{n&&vt(d.target)&&(i.current=d.target,t(!0))},a=d=>{d.target===i.current&&window.setTimeout(()=>{if(vt(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!==nn)return;const m=d.newValue==="true";r(m),m||c()},u=()=>{const d=yt();r(d),d||c()};return document.addEventListener("focusin",s),document.addEventListener("focusout",a),window.addEventListener(Qe,c),window.addEventListener("storage",l),window.addEventListener(ft,u),()=>{document.removeEventListener("focusin",s),document.removeEventListener("focusout",a),window.removeEventListener(Qe,c),window.removeEventListener("storage",l),window.removeEventListener(ft,u)}},[n]),{activeInputRef:i,isVisible:n&&e,hide:()=>t(!1)}}const Si="_header_1elij_1",Pi="_hidden_1elij_21",Ei="_scrolled_1elij_25",ki="_logo_1elij_31",Ti="_headerInner_1elij_44",xi="_leftSection_1elij_54",Ii="_desktopNav_1elij_60",Oi="_navLink_1elij_67",Ci="_navLinkActive_1elij_83",Ni="_rightSection_1elij_102",Ai="_searchWrapper_1elij_108",Li="_searchInput_1elij_114",Ri="_searchButton_1elij_144",qi="_searchIcon_1elij_168",ji="_profileBtn_1elij_178",$i="_profileImg_1elij_211",Di="_hamburgerBtn_1elij_217",Mi="_mobileSearchBar_1elij_245",Fi="_mobileSearchBarHidden_1elij_272",Bi="_mobileSearchInner_1elij_289",Wi="_mobileSearchIcon_1elij_305",zi="_mobileSearchInput_1elij_312",_={header:Si,hidden:Pi,scrolled:Ei,logo:ki,headerInner:Ti,leftSection:xi,desktopNav:Ii,navLink:Oi,navLinkActive:Ci,rightSection:Ni,searchWrapper:Ai,searchInput:Li,searchButton:Ri,searchIcon:qi,profileBtn:ji,profileImg:$i,hamburgerBtn:Di,mobileSearchBar:Mi,mobileSearchBarHidden:Fi,mobileSearchInner:Bi,mobileSearchIcon:Wi,mobileSearchInput:zi},Qi=async()=>{let e;try{e=await H.auth.syncSettings.query()}catch{return null}const t=e.actualActiveProvider;if(t==="github")try{const n=await H.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 H.auth.user.query();if(n)return{name:n.name,picture:n.picture,email:n.email,provider:"google"}}catch{}return null},Ki=()=>{const{toggleSidebar:e}=et(),{contentType:t}=tn(),[n,r]=w(""),[i,s]=w(!0),[a,c]=w(!1),[l,u]=w(!0),[d,m]=w(!1),p=yn(),h=Ve(),f=D(null),k=D(!1),A=D(null),j=D(null),T=D(null),x=D(null),{data:q}=Q({queryKey:["sync-profile"],queryFn:Qi,staleTime:3e4});b(()=>{const I=window.visualViewport;if(!I)return;const z=()=>{x.current?.style.setProperty("--vv-top",`${I.offsetTop}px`)};return z(),I.addEventListener("scroll",z),I.addEventListener("resize",z),()=>{I.removeEventListener("scroll",z),I.removeEventListener("resize",z)}},[]),b(()=>{const I=()=>{f.current&&(window.clearTimeout(f.current),f.current=null)},z=()=>{k.current||(k.current=!0,A.current=requestAnimationFrame(()=>{k.current=!1,A.current=null;const X=window.scrollY<=10;u(fe=>fe===X?fe:X),s(fe=>fe||!0),I(),X||(f.current=window.setTimeout(()=>{s(!1)},2500))}))},he=X=>{(X.metaKey||X.ctrlKey)&&X.key==="k"?(X.preventDefault(),re.current?.focus({preventScroll:!0})):X.key==="Escape"&&document.activeElement===re.current&&re.current?.blur()};return window.addEventListener("scroll",z,{passive:!0}),window.addEventListener("keydown",he),()=>{window.removeEventListener("scroll",z),window.removeEventListener("keydown",he),I(),A.current!==null&&(cancelAnimationFrame(A.current),A.current=null),k.current=!1}},[a]);const re=He.useRef(null),me=()=>window.innerWidth<=1024,qe=()=>{me()?(m(!0),setTimeout(()=>T.current?.focus({preventScroll:!0}),50)):document.activeElement===re.current&&n.trim()?je():re.current?.focus({preventScroll:!0})},G=I=>{j.current?.contains(I.relatedTarget)||m(!1)},Se=h.pathname==="/music"?"Search music...":t==="manga"?"Search manga...":t==="tv"?"Search TV & movies...":t==="asmr"?"Search ASMR...":"Search anime...",pe=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"},je=I=>{_i();const z=n.trim();if(z){if(h.pathname==="/music"){const he=new URLSearchParams(h.search);he.set("q",z),p(`/music?${he.toString()}`);return}p(t==="manga"?`/manga?q=${encodeURIComponent(z)}`:t==="tv"?`/tv-search?q=${encodeURIComponent(z)}`:t==="asmr"?`/asmr?q=${encodeURIComponent(z)}`:`/search?query=${encodeURIComponent(z)}`)}};return o(K,{children:o("header",{ref:x,className:`${_.header} ${i?"":_.hidden} ${l?"":_.scrolled}`,children:[o("div",{className:_.headerInner,children:[o("div",{className:_.leftSection,children:[o("button",{className:_.hamburgerBtn,onClick:e,"aria-label":"Menu",children:o(v,{name:"bars"})}),o(U,{to:"/",className:_.logo,"aria-label":"Ani-Web Home",children:o(Xt,{})}),o("nav",{className:_.desktopNav,children:[o(U,{to:"/",className:`${_.navLink} ${h.pathname==="/"?_.navLinkActive:""}`,children:"Home"}),o(U,{to:pe.to,className:`${_.navLink} ${h.pathname.startsWith(pe.to)?_.navLinkActive:""}`,children:pe.label}),t==="anime"&&o(U,{to:"/insights",className:`${_.navLink} ${h.pathname==="/insights"?_.navLinkActive:""}`,children:"Insights"}),o(U,{to:"/settings",className:`${_.navLink} ${h.pathname.startsWith("/settings")?_.navLinkActive:""}`,children:"Settings"})]})]}),o("div",{className:_.rightSection,children:[o("div",{className:_.searchWrapper,children:[o("input",{ref:re,type:"text","data-virtual-keyboard":"true",className:_.searchInput,placeholder:Se,value:n,onChange:I=>r(I.target.value),onFocus:()=>c(!0),onBlur:()=>c(!1),onKeyDown:I=>{I.key==="Enter"&&je()}}),o("button",{type:"button",className:_.searchButton,"aria-label":"Search",onMouseDown:I=>I.preventDefault(),onClick:qe,children:o(v,{name:"search",className:_.searchIcon})})]}),o(gi,{}),o(U,{to:"/settings?tab=sync",className:_.profileBtn,"aria-label":"Sync settings",children:q?.picture?o("img",{src:q.picture,alt:q.name,className:_.profileImg,referrerPolicy:"no-referrer",decoding:"async"}):q?.provider==="github"?o(v,{name:"github"}):o(v,{name:"cloud"})})]})]}),d&&o("div",{className:`${_.mobileSearchBar} ${i?"":_.mobileSearchBarHidden}`,ref:j,onBlur:G,children:o("div",{className:_.mobileSearchInner,children:[o(v,{name:"search",className:_.mobileSearchIcon}),o("input",{ref:T,type:"text","data-virtual-keyboard":"true",className:_.mobileSearchInput,placeholder:Se,value:n,onChange:I=>r(I.target.value),onKeyDown:I=>{I.key==="Enter"?(je(),m(!1)):I.key==="Escape"&&m(!1)}})]})})]})})},Ke="agreedToViewMature";function gt(){try{return localStorage.getItem(Ke)==="true"}catch{return!1}}function Ui(){const[e,t]=w(gt);b(()=>{const i=()=>t(gt());return window.addEventListener("storage",i),window.addEventListener("focus",i),()=>{window.removeEventListener("storage",i),window.removeEventListener("focus",i)}},[]);const n=M(()=>{try{localStorage.setItem(Ke,"true")}catch{}t(!0)},[]),r=M(()=>{try{localStorage.removeItem(Ke)}catch{}t(!1)},[]);return{hasConsent:e,grant:n,revoke:r}}const Hi="_sidebar_153jc_1",Vi="_open_153jc_20",Gi="_sidebarHeader_153jc_25",Ji="_closeBtn_153jc_33",Yi="_logo_153jc_57",Xi="_navSection_153jc_69",Zi="_navLink_153jc_75",es="_active_153jc_108",ts="_overlay_153jc_118",ns="_versionInfo_153jc_138",J={sidebar:Hi,open:Vi,sidebarHeader:Gi,closeBtn:Ji,logo:Yi,navSection:Xi,navLink:Zi,active:es,overlay:ts,versionInfo:ns},rs="3.5.7",rn={version:rs},os=()=>{const{isOpen:e,setIsOpen:t}=et(),{contentType:n}=tn(),{hasConsent:r}=Ui(),i=()=>{t(!1)},s=n==="manga",a=n==="tv",c=n==="asmr",l=[{to:"/",icon:o(v,{name:"home"}),label:"Home"},s?{to:"/manga",icon:o(v,{name:"book"}),label:"Manga"}:a?{to:"/tv-search",icon:o(v,{name:"tv"}),label:"TV and Movies"}:c?{to:"/asmr",icon:o(v,{name:"headphones"}),label:"ASMR"}:{to:"/search",icon:o(v,{name:"search"}),label:"Search"},s?{to:"/reading-list",icon:o(v,{name:"bookmark"}),label:"Reading List"}:a?{to:"/tv-watchlist",icon:o(v,{name:"clock"}),label:"TV Watchlist"}:c?{to:"/listening-list",icon:o(v,{name:"history"}),label:"Listening List"}:{to:"/watchlist",icon:o(v,{name:"clock"}),label:"Watchlist"},...n==="anime"?[{to:"/insights",icon:o(v,{name:"chart-pie"}),label:"Insights"}]:[],{to:"/trackers",icon:o(v,{name:"sync-alt"}),label:"Trackers"},{to:"/radio",icon:o(v,{name:"broadcast-tower"}),label:"Radio"},{to:"/music",icon:o(v,{name:"headphones"}),label:"Music"},...r?[{to:"/mature",icon:o(v,{name:"pepper-hot"}),label:"Mature"}]:[],{to:"/settings",icon:o(v,{name:"cog"}),label:"Settings"}];return o(K,{children:[o("aside",{className:`${J.sidebar} ${e?J.open:""} sidebar`,children:[o("div",{className:J.sidebarHeader,children:[o("button",{className:J.closeBtn,onClick:()=>t(!1),"aria-label":"Close menu",children:"×"}),o(U,{to:"/",className:J.logo,onClick:i,children:o(Xt,{})})]}),o("nav",{className:J.navSection,children:l.map(u=>o(vn,{to:u.to,className:({isActive:d})=>`${J.navLink} ${d?J.active:""}`,onClick:i,end:u.to==="/",children:[u.icon,o("span",{children:u.label})]},u.to))}),o("div",{className:J.versionInfo,children:["v",rn.version]})]}),e&&o("div",{className:J.overlay,onClick:()=>t(!1),"aria-label":"Close sidebar"})]})},is="_footer_1p5nb_1",ss="_footerInner_1p5nb_15",as="_brandSection_1p5nb_27",cs="_logoRow_1p5nb_39",ls="_logoText_1p5nb_59",us="_brandMeta_1p5nb_65",ds="_brandTagline_1p5nb_74",ms="_statusPill_1p5nb_81",ps="_statusDot_1p5nb_94",hs="_linksGrid_1p5nb_102",fs="_linkColumn_1p5nb_110",ys="_columnTitle_1p5nb_116",vs="_bottomBar_1p5nb_140",gs="_copyright_1p5nb_150",bs="_brand_1p5nb_27",_s="_heartIcon_1p5nb_166",ws="_backToTop_1p5nb_171",O={footer:is,footerInner:ss,brandSection:as,logoRow:cs,logoText:ls,brandMeta:us,brandTagline:ds,statusPill:ms,statusDot:ps,linksGrid:hs,linkColumn:fs,columnTitle:ys,bottomBar:vs,copyright:gs,brand:bs,heartIcon:_s,backToTop:ws},bt={iris:"/logo.png",mochi:"/logo-mochi.png",sakura:"/logo-sakura.png"},Ss=()=>{const{theme:e}=Yt(),t=bt[e]||bt.iris,n=new Date().getFullYear(),r=()=>{window.scrollTo({top:0,behavior:"smooth"})};return o("footer",{className:O.footer,children:[o("div",{className:O.footerInner,children:[o("div",{className:O.brandSection,children:[o("div",{className:O.logoRow,children:o("img",{src:t,className:O.logoText,alt:"dango",loading:"lazy",decoding:"async"})}),o("div",{className:O.brandMeta,children:[o("div",{className:O.statusPill,children:[o("span",{className:O.statusDot}),o("span",{children:["v",rn.version]})]}),o("p",{className:O.brandTagline,children:"Fast, local anime streaming."})]})]}),o("div",{className:O.linksGrid,children:[o("div",{className:O.linkColumn,children:[o("h4",{className:O.columnTitle,children:"Navigation"}),o(U,{to:"/",children:"Home"}),o(U,{to:"/watchlist",children:"Watchlist"}),o(U,{to:"/settings",children:"Settings"})]}),o("div",{className:O.linkColumn,children:[o("h4",{className:O.columnTitle,children:"Features"}),o(U,{to:"/search",children:"Search Anime"}),o(U,{to:"/trackers",children:"Trackers"}),o(U,{to:"/insights",children:"Insights"})]}),o("div",{className:O.linkColumn,children:[o("h4",{className:O.columnTitle,children:"Community"}),o("a",{href:"https://discord.gg/2FTSPXCsvn",target:"_blank",rel:"noopener noreferrer",children:[o(v,{name:"discord",style:{marginRight:"6px"}})," Discord"]}),o("a",{href:"https://github.com/serifpersia/dango",target:"_blank",rel:"noopener noreferrer",children:[o(v,{name:"github",style:{marginRight:"6px"}})," GitHub"]})]}),o("div",{className:O.linkColumn,children:[o("h4",{className:O.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:O.bottomBar,children:[o("p",{className:O.copyright,children:["© ",n," ",o("span",{className:O.brand,children:"dango"})," • Crafted with"," ",o(v,{name:"heart",className:O.heartIcon})," by"," ",o("a",{href:"https://github.com/serifpersia",target:"_blank",rel:"noopener noreferrer",children:"serifpersia"})]}),o("button",{className:O.backToTop,onClick:r,"aria-label":"Back to top",children:[o(v,{name:"chevron-up",size:14}),o("span",{children:"Top"})]})]})]})},tt=e=>{const t=E();return Q({...t.settings.getByKey.queryOptions({key:e}),select:n=>n.value})},on=()=>{const e=E(),t=F();return V(e.settings.set.mutationOptions({onSuccess:()=>{g.success("Setting updated!"),t.invalidateQueries(e.settings.pathFilter()),t.invalidateQueries({queryKey:["settings"]})},onError:n=>{g.error(`Failed to update setting: ${n.message}`)}}))};function sn(e){return JSON.stringify({0:e??{}})}function an(e){return`/api/trpc/${e}?batch=1`}function Ue(e,t){const n=sn(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 ac(e,t){await fetch(an(e),{method:"POST",headers:{"Content-Type":"application/json"},body:sn(t),keepalive:!0})}function cc(e){e&&(Ue("discord.clear",{sessionId:e}),Ue("discord.heartbeat",{sessionId:e,bye:!0}))}function Ps(){const e=Ve(),{data:t}=tt("discordRPCEnabled"),n=D("");n.current||(n.current=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`tab-${Date.now()}-${Math.random().toString(36).slice(2)}`),b(()=>{if(t===!1||t==="false")return;const r=n.current,i=()=>H.discord.heartbeat.mutate({sessionId:r}).catch(()=>{});i();const s=setInterval(i,15e3),a=()=>{Ue("discord.heartbeat",{sessionId:r,bye:!0})};return window.addEventListener("pagehide",a),()=>{clearInterval(s),window.removeEventListener("pagehide",a)}},[t]),b(()=>{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"),H.discord.pageStatus.mutate({page:i}).catch(()=>{})},[e.pathname,t])}function cn(e,t){const[n,r]=w(()=>{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}});b(()=>{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=M(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=ee(void 0),Es=()=>{const e=te(ln);if(!e)throw new Error("useAnimePaheCookie must be used within an AnimePaheCookieProvider");return e},ks="_overlay_1juub_1",Ts="_fadeIn_1juub_1",xs="_content_1juub_11",Is="_modalIn_1juub_1",Os="_sm_1juub_29",Cs="_md_1juub_33",Ns="_lg_1juub_37",As="_title_1juub_41",Ls="_body_1juub_48",Rs="_footer_1juub_52",ue={overlay:ks,fadeIn:Ts,content:xs,modalIn:Is,sm:Os,md:Cs,lg:Ns,title:As,body:Ls,footer:Rs};function un({children:e}){return o("h2",{className:ue.title,children:e})}function dn({children:e}){return o("div",{className:ue.body,children:e})}function mn({children:e}){return o("div",{className:ue.footer,children:e})}function we({isOpen:e,onClose:t,title:n,children:r,footer:i,width:s="md"}){const a=D(null);return b(()=>{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?xt(o("div",{role:"presentation",onMouseDown:c=>c.stopPropagation(),children:[o("div",{className:ue.overlay,onClick:()=>t?.(),"aria-hidden":"true"}),o("div",{ref:a,className:`${ue.content} ${ue[s]}`,role:"dialog","aria-modal":"true","aria-label":n,tabIndex:-1,children:[n&&o(un,{children:n}),o(dn,{children:r}),i&&o(mn,{children:i})]})]}),document.body):null}we.Header=un;we.Body=dn;we.Actions=mn;const qs="_container_e96gf_1",js="_field_e96gf_9",$s="_textarea_e96gf_20",Ds="_input_e96gf_40",Ms="_button_e96gf_58",Fs="_secondaryButton_e96gf_78",Bs="_actions_e96gf_95",Ws="_hint_e96gf_104",zs="_link_e96gf_117",B={container:qs,field:js,textarea:$s,input:Ds,button:Ms,secondaryButton:Fs,actions:Bs,hint:Ws,link:zs},Qs="https://github.com/serifpersia/dango/releases/latest/download/dango-extension.zip",Ks=e=>{try{return JSON.parse(e.detail)}catch{return null}},Us=({isOpen:e,onClose:t,onSuccess:n})=>{const[r,i]=w(1),[s,a]=w(navigator.userAgent),[c,l]=w(""),[u,d]=w(!1),m=D(null),p=navigator.userAgent,h=/android/i.test(p),f=/firefox|fxios/i.test(p)&&!h,k=!f&&!h&&/chrome|chromium|edg|brave/i.test(p),A=f||k;b(()=>{e&&(i(1),a(navigator.userAgent),l(""),d(!1))},[e]),b(()=>()=>{m.current&&(window.removeEventListener("dango:pahe-cookie",m.current),m.current=null)},[]);const j=()=>{localStorage.setItem("animepahe_ua",s),window.open("https://animepahe.pw","_blank","noopener,noreferrer"),i(2)},T=()=>{if(u)return;d(!0);const q=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,re=window.setTimeout(()=>{d(!1),m.current&&(window.removeEventListener("dango:pahe-cookie",m.current),m.current=null),g.error("Helper not detected — install it via about:debugging first.")},3e3),me=qe=>{const G=Ks(qe);if(!(!G||G.requestId!==q))if(window.clearTimeout(re),window.removeEventListener("dango:pahe-cookie",me),m.current=null,d(!1),G?.ok&&G.cookie)l(G.cookie),g.success("Cookie extracted from helper!");else if(G?.error==="NO_COOKIE"){const Se=G.debug?.stores?.length??0,pe=G.debug?.names??[];g.error(`Helper found no cf_clearance (checked ${Se} stores, saw: ${pe.join(", ")||"none"}) — solve the challenge on the AnimePahe tab first.`)}else g.error("Helper request failed — try again.")};m.current=me,window.addEventListener("dango:pahe-cookie",me),window.dispatchEvent(new CustomEvent("dango:get-pahe-cookie",{detail:{requestId:q}}))},x=()=>{const q=c.trim();if(!q){g.error("Please enter the cf_clearance cookie");return}try{localStorage.setItem("animepahe_cookie",q),g.success("Cookie updated successfully! Reloading…"),n?.(),t(),window.setTimeout(()=>window.location.reload(),1e3)}catch{g.error("Failed to save cookie")}};return o(we,{isOpen:e,onClose:t,title:"AnimePahe Verification Required",children:o("div",{className:B.container,children:r===1?o(K,{children:[o("p",{children:"AnimePahe requires a manual verification to bypass Cloudflare/DDoS-Guard protection."}),o("div",{className:B.field,children:[o("label",{children:"Your User-Agent (will be used for requests):"}),o("textarea",{value:s,readOnly:!0,rows:3,className:B.textarea})]}),o("div",{className:B.actions,children:[o("button",{className:B.secondaryButton,onClick:t,children:"Cancel"}),o("button",{className:B.button,onClick:j,children:"Start Verification (Opens AnimePahe)"})]})]}):o(K,{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."]}),A&&o("div",{className:B.hint,children:[o("strong",{children:"Dango helper (one-time setup):"})," ",f?o(K,{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(K,{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:Qs,target:"_blank",rel:"noreferrer",className:B.link,children:"dango-extension.zip"}),". Then click Extract below and the field fills itself.",o("div",{className:B.actions,children:o("button",{className:B.button,onClick:T,disabled:u,type:"button",children:u?"Extracting…":"Extract cookie from helper"})})]}),o("div",{className:B.field,children:[o("label",{children:"cf_clearance cookie value:"}),o("input",{type:"text",value:c,onChange:q=>l(q.target.value),placeholder:"e.g. xxxxxxxx.xxxxxxxx.xxxxxxx-xxxxxxx",className:B.input})]}),o("div",{className:B.actions,children:[o("button",{className:B.secondaryButton,onClick:t,children:"Cancel"}),o("button",{className:B.secondaryButton,onClick:()=>i(1),children:"Back"}),o("button",{className:B.button,onClick:x,children:"Submit"})]})]})})})};function Hs(){const[e,t]=w(!1);return b(()=>{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 Vs extends gn{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(v,{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(v,{name:"home"}),"Go back Home"]})]}):this.props.children}}const pn=ee(void 0),Gs=({children:e})=>{const[t,n]=w(!1),r=M(()=>n(!0),[]),i=M(()=>n(!1),[]);return b(()=>Qt("lan",r),[r]),o(pn.Provider,{value:{isOpen:t,openModal:r,closeModal:i},children:e})},Js=()=>{const e=te(pn);if(!e)throw new Error("useLanAuth must be used within a LanAuthProvider");return e},Ys="_container_88bss_1",Xs="_field_88bss_8",Zs="_input_88bss_19",ea="_actions_88bss_37",ke={container:Ys,field:Xs,input:Zs,actions:ea},_t=bn(({variant:e="primary",size:t="md",loading:n,children:r,className:i="",disabled:s,...a},c)=>{const l=Do("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})}),ta=({isOpen:e,onClose:t,onSuccess:n})=>{const[r,i]=w(""),[s,a]=w(!1);He.useEffect(()=>{e&&i("")},[e]);const c=async()=>{if(!r){g.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){g.error(u.error||"Login failed");return}g.success("Authenticated successfully"),n(),t(),window.location.reload()}catch{g.error("Network error")}finally{a(!1)}};return o(we,{isOpen:e,onClose:t,title:"LAN Authentication Required",children:o("div",{className:ke.container,children:[o("p",{children:"This instance is protected. Enter the password to access from this device."}),o("div",{className:ke.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:ke.input,onKeyDown:l=>l.key==="Enter"&&c()})]}),o("div",{className:ke.actions,children:[o(_t,{variant:"secondary",onClick:t,disabled:s,children:"Cancel"}),o(_t,{variant:"primary",onClick:c,loading:s,children:"Unlock"})]})]})})},na=C(()=>N(()=>import("./Home-B3U4UeUo.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]))),ra=C(()=>N(()=>import("./Watchlist-Cdi7veTd.js"),__vite__mapDeps([30,1,2,4,6,7,8,9,10,11,12,13,3,5,14,15,31,32]))),oa=C(()=>N(()=>import("./Settings-D-BMTUko.js"),__vite__mapDeps([33,1,2,34,35,4,36]))),wt=C(()=>N(()=>import("./Player-DYz2t2Zv.js"),__vite__mapDeps([37,1,2,38,4,39,40,12,17,18,8,9,10,23,41,42,43,44,45]))),ia=C(()=>N(()=>import("./Search-Dvt7ZYbV.js"),__vite__mapDeps([46,1,4,3,5,6,7,2,8,9,10,11,12,13,14,15,47,48]))),sa=C(()=>N(()=>import("./Mature-u1Zfj04I.js"),__vite__mapDeps([49,1,2,4,3,5,6,7,8,9,10,11,12,13,14,15,23,47,48,50]))),St=C(()=>N(()=>import("./Asmr-B4idhS3o.js"),__vite__mapDeps([51,1,4,2,34,35,11,9,12,13,28,52,53,54,21,40,55,56]))),aa=C(()=>N(()=>import("./Manga-DLLGgY3d.js"),__vite__mapDeps([57,1,4,34,35,14,15,11,9,12,13,19,20,2,21,23,58,59,55,56]))),ca=C(()=>N(()=>import("./MangaInfoPage-CAoertK2.js"),__vite__mapDeps([60,1,4,14,15,20,2,58,59,55,56]))),la=C(()=>N(()=>import("./MangaReadPage-86iAGfPF.js"),__vite__mapDeps([61,1,14,4,15,2,20,58,59,55,56]))),ua=C(()=>N(()=>import("./ReadingList-kAreUiz-.js"),__vite__mapDeps([62,1,11,9,12,4,13,63,3,5,14,15,31,32,19,20,2,21,22,16]))),da=C(()=>N(()=>import("./Radio-BiRQreJI.js"),__vite__mapDeps([64,1,4,2,52,53,65,66,55,56]))),ma=C(()=>N(()=>import("./Music-stf7yXDU.js"),__vite__mapDeps([67,1,4,65,66,52,53,2,55,56,68]))),Pt=C(()=>N(()=>import("./TvSearch-D_VbFQF-.js"),__vite__mapDeps([69,1,4,3,5,24,11,9,12,13,25,26,2,14,15,47,48]))),pa=C(()=>N(()=>import("./TvInfo-BfjnqnCn.js"),__vite__mapDeps([70,1,4,26,2,71]))),ha=C(()=>N(()=>import("./Tv-Ug-q07EH.js"),__vite__mapDeps([72,1,2,4,38,39,73,23,26,40,12,43,44,74]))),fa=C(()=>N(()=>import("./TvWatchlist-DCx1lBta.js"),__vite__mapDeps([75,1,11,9,12,4,13,63,3,5,14,15,31,32,16,25,26,2]))),ya=C(()=>N(()=>import("./ListeningList-DZDivEEp.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]))),va=C(()=>N(()=>import("./Trackers-DqaC4bYh.js"),__vite__mapDeps([77,1,2,4,78]))),ga=C(()=>N(()=>import("./Insights-CLwUQoct.js"),__vite__mapDeps([79,1,2,4,80]))),ba=C(()=>N(()=>import("./AnimeInfoPage-_p_S9R09.js"),__vite__mapDeps([81,1,2,4]))),_a=C(()=>N(()=>import("./PlayerRedirect-fv2tzEUu.js"),__vite__mapDeps([82,1]))),wa=C(()=>N(()=>import("./VirtualKeyboard-BmqZPZXR.js"),__vite__mapDeps([83,1,84])));function Sa(){const{isOpen:e,closeModal:t,onSuccess:n}=Es(),{isOpen:r,setIsOpen:i}=et(),{isOpen:s,openModal:a,closeModal:c}=Js(),l=Ve(),u=_n(),d=D(new Map),m=D(l.pathname),p=wi();Ps();const[h,f]=w(!1);b(()=>{fetch("/api/auth/app-status").then(T=>T.json()).then(T=>{T.hasPassword&&!T.isAuthenticated&&(f(!0),a())}).catch(()=>{})},[a]);const[k,A]=cn("lan_auth_notice_shown","false"),j=D(!1);return b(()=>{if(k==="true"||j.current)return;j.current=!0,A("true");const T=setTimeout(()=>{g("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(T)},[k,A]),b(()=>{try{window.history.scrollRestoration="manual"}catch{}},[]),b(()=>{const T=l.key,x=d.current;if(u==="POP"){const q=x.get(T)??0;window.scrollTo({top:q,behavior:"instant"})}else l.pathname!==m.current&&window.scrollTo({top:0,behavior:"instant"});return m.current=l.pathname,()=>{x.set(T,window.scrollY)}},[l.key,l.pathname,u]),b(()=>{const T=x=>{r&&x.key==="Escape"&&i(!1)};return r?document.body.classList.add("sidebar-open"):document.body.classList.remove("sidebar-open"),window.addEventListener("keydown",T),()=>{window.removeEventListener("keydown",T),document.body.classList.remove("sidebar-open")}},[r,i]),o("div",{className:"app-container",children:[o(Us,{isOpen:e,onClose:t,onSuccess:n}),o(ta,{isOpen:s,onClose:h?()=>{}:c,onSuccess:()=>{f(!1),c()}}),o(vr,{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(Ki,{}),o(os,{}),o("main",{className:"main-content",children:o(Vs,{children:o(nt,{fallback:o(Hs,{}),children:o(wn,{children:[o(S,{path:"/",element:o(na,{})}),o(S,{path:"/watchlist/:filter?",element:o(ra,{})}),o(S,{path:"/reading-list/:filter?",element:o(ua,{})}),o(S,{path:"/search",element:o(ia,{})}),o(S,{path:"/mature",element:o(sa,{})}),o(S,{path:"/asmr",element:o(St,{})}),o(S,{path:"/asmr/:rj",element:o(St,{})}),o(S,{path:"/manga",element:o(aa,{})}),o(S,{path:"/manga/:provider/:id",element:o(ca,{})}),o(S,{path:"/manga/:provider/:id/read",element:o(la,{})}),o(S,{path:"/radio",element:o(da,{})}),o(S,{path:"/music",element:o(ma,{})}),o(S,{path:"/tv",element:o(Pt,{})}),o(S,{path:"/tv/:id",element:o(pa,{})}),o(S,{path:"/tv/:id/watch",element:o(ha,{})}),o(S,{path:"/tv-search",element:o(Pt,{})}),o(S,{path:"/tv-watchlist/:filter?",element:o(fa,{})}),o(S,{path:"/listening-list/:filter?",element:o(ya,{})}),o(S,{path:"/settings",element:o(oa,{})}),o(S,{path:"/trackers",element:o(va,{})}),o(S,{path:"/mal",element:o(rt,{to:"/trackers",replace:!0})}),o(S,{path:"/insights",element:o(ga,{})}),o(S,{path:"/anime/:id",element:o(ba,{})}),o(S,{path:"/watch/:id",element:o(wt,{})}),o(S,{path:"/watch/:id/:episodeNumber",element:o(wt,{})}),o(S,{path:"/player/:id/:episodeNumber?",element:o(_a,{})}),o(S,{path:"*",element:o(rt,{to:"/",replace:!0})})]})})})}),o(Ss,{}),p.isVisible&&o(nt,{fallback:null,children:o(wa,{activeInputRef:p.activeInputRef,isVisible:p.isVisible,onClose:p.hide})})]})}function Pa(){return o(Gs,{children:o(Sa,{})})}const Ea=({children:e})=>{const[t,n]=w(!1),r=M(()=>{n(s=>!s)},[]),i=de(()=>({isOpen:t,setIsOpen:n,toggleSidebar:r}),[t,r]);return o(Zt.Provider,{value:i,children:e})},ka=({children:e})=>{const[t,n]=cn("dango_content_type","anime"),r=de(()=>({contentType:t,setContentType:n}),[t,n]);return o(en.Provider,{value:r,children:e})},Ta=({children:e})=>{const[t,n]=w("englishName"),[r,i]=w(!0);b(()=>{(async()=>{try{const c=await H.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=de(()=>({titlePreference:t,setTitlePreference:n,loading:r}),[t,r]);return o(Ut.Provider,{value:s,children:e})},hn=ee(void 0),lc=()=>{const e=te(hn);if(e===void 0)throw new Error("useLowEndMode must be used within a LowEndModeProvider");return e},xa=({children:e})=>{const{data:t,isLoading:n}=tt("lowEndMode"),r=on(),i=F(),[s,a]=w(!1);b(()=>{const u=i.getDefaultOptions();i.setDefaultOptions({...u,queries:{...u.queries,gcTime:s?900*1e3:1800*1e3}})},[s,i]),b(()=>{t!==void 0&&a(t==="true"||t===!0)},[t]),b(()=>{s?document.body.classList.add("low-end"):document.body.classList.remove("low-end")},[s]);const c=M(u=>{a(u),r.mutate({key:"lowEndMode",value:String(u)})},[r]),l=de(()=>({lowEndMode:s,setLowEndMode:c,loading:n}),[s,c,n]);return o(hn.Provider,{value:l,children:e})},Ia=["iris","mochi","sakura"];function Et(e){e==="iris"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",e)}const Oa=({children:e})=>{const{data:t,isLoading:n}=tt("theme"),r=on(),[i,s]=w("iris");b(()=>{typeof t=="string"&&Ia.includes(t)&&s(t)},[t]),b(()=>{Et(i)},[i]);const a=M(l=>{l!==i&&(s(l),Et(l),r.mutate({key:"theme",value:l}))},[r,i]),c=de(()=>({theme:i,setTheme:a,loading:n}),[i,a,n]);return o(Jt.Provider,{value:c,children:e})},Ca=({children:e})=>{const[t,n]=w(!1),[r,i]=w(void 0),s=M(c=>{i(()=>c),n(!0)},[]),a=M(()=>{n(!1),i(void 0)},[]);return b(()=>Qt("animepahe",()=>s()),[s]),o(ln.Provider,{value:{isOpen:t,openModal:s,closeModal:a,onSuccess:r},children:e})};try{window.history.scrollRestoration="manual"}catch{}const kt=new Tn({defaultOptions:{queries:{staleTime:1e3*60*5,gcTime:1800*1e3,refetchOnWindowFocus:!1,refetchIntervalInBackground:!1,retry:1}}}),Tt=document.getElementById("root");Tt&&Sn(o(Pn,{children:o(qo,{trpcClient:H,queryClient:kt,children:o(xn,{client:kt,children:o(Ca,{children:o(Ea,{children:o(ka,{children:o(Ta,{children:o(xa,{children:o(Oa,{children:o(Pa,{})})})})})})})})})}),Tt);export{Ha as $,on as A,_t as B,tc as C,nc as D,ec as E,L as F,Yt as G,yt as H,ft as I,$a as J,Us as K,Wa as L,we as M,_i as N,cc as O,B as P,Qt as Q,ac as R,De as S,sc as T,Ra as U,nn as V,et as W,ic as X,Hs as Y,Ua as Z,N as _,cn as a,Ka as a0,Ma as b,Fa as c,Mo as d,Ui as e,$o as f,qa as g,E as h,Ba as i,tn as j,Za as k,za as l,Qa as m,Va as n,Ga as o,rc as p,Ya as q,Da as r,ja as s,H as t,lc as u,oc as v,Xa as w,Ja as x,tt as y,g 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-NKjVUCZV.js";import{u as Q}from"./QueueOptionsButton-DFny02Po.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-NKjVUCZV.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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as e,S as g,L as m}from"./vendor-core-DfaOB3Rn.js";import{I as a}from"./vendor-icons-DrybRNxP.js";import{c as y}from"./useAsmr-
|
|
1
|
+
import{u as e,S as g,L as m}from"./vendor-core-DfaOB3Rn.js";import{I as a}from"./vendor-icons-DrybRNxP.js";import{c as y}from"./useAsmr-BFiC1M0v.js";import{p as s,a as k}from"./MediaCard-DlN3VNy8.js";import{a as L}from"./Asmr.module-CdWlioTY.js";import{u as f}from"./usePopup-DS9jMzp6.js";const P=({data:i,anchorRect:d,bookmarked:n,onToggleBookmark:p,onMouseEnter:h,onMouseLeave:u,onRequestClose:N})=>{const{data:c,isLoading:v}=y(i.rjCode||null),r=c?.tracks.length??0,l=r>0,t=!v;return e(k,{anchorRect:d,onMouseEnter:h,onMouseLeave:u,onRequestClose:N,children:[e("div",{className:s.header,children:[i.thumbnail&&e("img",{src:i.thumbnail,alt:i.title,loading:"lazy",decoding:"async",className:L.popupCover}),e("div",{className:s.title,children:i.title}),e("div",{className:s.synopsis,children:i.rjCode})]}),e("div",{className:s.body,children:[e("div",{className:s.metaRow,children:[e("div",{className:s.metaItem,children:[e(a,{name:"headphones",size:14}),e("span",{children:t?l?e(g,{children:[r," track",r===1?"":"s"]}):"No tracks":"Loading tracks…"})]}),i.rating&&e("div",{className:s.metaItem,children:e("span",{children:i.rating.toUpperCase()})}),i.isAdult&&e("div",{className:s.metaItem,children:e("span",{children:"18+"})}),i.progressLabel&&e("div",{className:s.metaItem,children:[e(a,{name:"bookmark",size:12}),e("span",{children:i.progressLabel})]})]}),e("div",{className:s.synopsis,children:!t&&!c?.description?"Loading description…":c?.description??"No description available."})]}),e("div",{className:s.footer,children:[e("div",{className:s.primaryAction,children:l?e(m,{to:i.listenTarget,className:s.watchBtn,children:[e(a,{name:"play",size:14}),"Listen now"]}):e("span",{className:s.watchBtn,"aria-disabled":"true",style:{opacity:.5,pointerEvents:"none"},children:[e(a,{name:"play",size:14}),t?"No tracks":"Loading…"]})}),e("div",{className:s.secondaryActions,children:[e("button",{className:`${s.watchlistBtn} ${n?s.active:""}`,onClick:o=>{o.preventDefault(),o.stopPropagation(),p()},children:[n?e(a,{name:"check",size:12}):e(a,{name:"plus",size:12}),e("span",{children:n?"Remove":"Bookmark"})]}),e(m,{to:i.listenTarget,className:s.detailsBtn,children:"Details"})]})]})]})},S=()=>f();export{P as A,S as u};
|