@serifpersia/dango 3.7.7 → 3.7.8
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 +3 -1
- package/client/dist/assets/{AnimeCard-aZA4-g8o.js → AnimeCard-B_eNHj3Q.js} +1 -1
- package/client/dist/assets/{AnimeInfo-CFGRb1OW.js → AnimeInfo-B4DtKpJi.js} +1 -1
- package/client/dist/assets/{AnimeInfoPage-CozJH4AM.js → AnimeInfoPage-BTJBbJx7.js} +2 -2
- package/client/dist/assets/Asmr-DB4F0zQm.js +2 -0
- package/client/dist/assets/{AsmrResetProgressModal-NKywttOY.js → AsmrResetProgressModal-BkO6uAVo.js} +1 -1
- package/client/dist/assets/Home-BYtjQAAm.js +1 -0
- package/client/dist/assets/Insights-kd8R5HFL.js +1 -0
- package/client/dist/assets/{LibraryListPage-CJxNJYC3.js → LibraryListPage-BXCoAwO-.js} +1 -1
- package/client/dist/assets/{ListeningList-VZTVSt_i.js → ListeningList-B58inkaW.js} +1 -1
- package/client/dist/assets/Manga-B09DXrt3.js +1 -0
- package/client/dist/assets/{MangaInfoPage-DzaSKarW.js → MangaInfoPage-HniBD97j.js} +1 -1
- package/client/dist/assets/MangaReadPage-XTo4eB8e.js +1 -0
- package/client/dist/assets/{MangaResetProgressModal-DrqN7OF0.js → MangaResetProgressModal-DgD2JJiz.js} +1 -1
- package/client/dist/assets/Mature--NRjmFgA.js +1 -0
- package/client/dist/assets/{MatureConsentModal-DLVOORqW.js → MatureConsentModal-BxCEXBbj.js} +1 -1
- package/client/dist/assets/{MediaCard-DJNRuWDJ.js → MediaCard-BXWAjpwt.js} +1 -1
- package/client/dist/assets/OptionListMenu-DHzVKmrw.js +1 -0
- package/client/dist/assets/Player-BopSS6Gv.js +56 -0
- package/client/dist/assets/PlayerProvider-Cj4nkG1Z.js +1 -0
- package/client/dist/assets/PlayerSettings-BEorvGw8.js +1 -0
- package/client/dist/assets/{QueueOptionsButton-ByAwxtJ-.js → QueueOptionsButton-E2SuRJH_.js} +1 -1
- package/client/dist/assets/{QueueRail-BLf4fWOA.js → QueueRail-ZlyY6iwq.js} +1 -1
- package/client/dist/assets/{ReadingList-Cm5omw5j.js → ReadingList-DEOzfsq9.js} +1 -1
- package/client/dist/assets/{ResetProgressModal-Dq-B23o_.js → ResetProgressModal-B4qmiw-m.js} +1 -1
- package/client/dist/assets/Search-C2mxeTuG.js +1 -0
- package/client/dist/assets/Settings-BqOAQxhe.js +21 -0
- package/client/dist/assets/Settings-D37LNfis.css +1 -0
- package/client/dist/assets/{SkeletonGrid-sA6_IQY1.js → SkeletonGrid-Od92F7If.js} +1 -1
- package/client/dist/assets/Trackers-CyWVHtOz.js +2 -0
- package/client/dist/assets/Tv-B8tWYqQt.js +4 -0
- package/client/dist/assets/TvInfo-CYh7oICz.js +1 -0
- package/client/dist/assets/TvPopup-8uQGvzWG.js +1 -0
- package/client/dist/assets/TvSearch-DMc5DzU4.js +1 -0
- package/client/dist/assets/{TvWatchlist-SjHmyo2P.js → TvWatchlist-fPe4D63a.js} +1 -1
- package/client/dist/assets/VirtualKeyboard-CjOEv-Zs.js +1 -0
- package/client/dist/assets/WatchAlong-Cd_rNUGz.js +1 -0
- package/client/dist/assets/WatchAlongPanel-BKprdx-w.js +1 -0
- package/client/dist/assets/WatchAlongPanel-DbJuLqxU.css +1 -0
- package/client/dist/assets/{Watchlist-BnmsAcx0.js → Watchlist-DMj82PtZ.js} +1 -1
- package/client/dist/assets/index-B_2ppn5P.js +178 -0
- package/client/dist/assets/index-DP9TtvZX.css +1 -0
- package/client/dist/assets/{libraryInvalidation-2sAPXNhJ.js → libraryInvalidation-DeUzK6TJ.js} +1 -1
- package/client/dist/assets/playbackCompletion-_kwPgoZi.js +1 -0
- package/client/dist/assets/{useAnimeInfoData-Ai39I_f0.js → useAnimeInfoData-CH9hmj5A.js} +1 -1
- package/client/dist/assets/{useAsmr-XBCV7iDw.js → useAsmr-DQsv1SQT.js} +1 -1
- package/client/dist/assets/{useAsmrPopup-DViHcQnO.js → useAsmrPopup-6kWviNqn.js} +1 -1
- package/client/dist/assets/{useMangaLibrary-DrPp5K_1.js → useMangaLibrary-DlU4Z9JL.js} +1 -1
- package/client/dist/assets/{useMangaPopup-VGTfdKEu.js → useMangaPopup-3MuX6uO9.js} +1 -1
- package/client/dist/assets/{useProviders-Bt-p5Jxv.js → useProviders-Dx9rG8FY.js} +1 -1
- package/client/dist/assets/useTv-DZQzHJgO.js +1 -0
- package/client/dist/assets/useTvLibrary-DVpLBz5c.js +1 -0
- package/client/dist/assets/useWatchAlongPlayer-KZT7d2pQ.js +10 -0
- package/client/dist/index.html +2 -2
- package/package.json +2 -2
- package/server/dist/config.js +1 -1
- package/server/dist/profile-scope.js +1 -0
- package/server/dist/server.js +257 -249
- package/server/dist/shipped-defaults.js +1 -1
- package/server/package.json +2 -2
- package/client/dist/assets/Asmr-AxjnBdsh.js +0 -2
- package/client/dist/assets/Home-CkdWZK2L.js +0 -1
- package/client/dist/assets/Insights-DgnlUFjW.js +0 -1
- package/client/dist/assets/Manga-dDQAtejO.js +0 -1
- package/client/dist/assets/MangaReadPage-CT6THZho.js +0 -1
- package/client/dist/assets/Mature-BGitA9fy.js +0 -1
- package/client/dist/assets/OptionListMenu-CRaHF9k4.js +0 -1
- package/client/dist/assets/Player-CdSjfMoO.js +0 -56
- package/client/dist/assets/PlayerProvider-D02-hqdz.js +0 -1
- package/client/dist/assets/PlayerSettings-CXmAyRJh.js +0 -1
- package/client/dist/assets/Search-C8rfGyYH.js +0 -1
- package/client/dist/assets/Settings-DYjRBgpE.css +0 -1
- package/client/dist/assets/Settings-Do5F5e2c.js +0 -21
- package/client/dist/assets/Trackers-DeJr1sbR.js +0 -2
- package/client/dist/assets/Tv-BkApELpu.js +0 -4
- package/client/dist/assets/TvInfo-C5cVdHka.js +0 -1
- package/client/dist/assets/TvPopup-DyFUi32m.js +0 -1
- package/client/dist/assets/TvSearch-BBYYrww5.js +0 -1
- package/client/dist/assets/VirtualKeyboard-DeP7fb3P.js +0 -1
- package/client/dist/assets/index-5x1mF1nD.css +0 -1
- package/client/dist/assets/index-vb4WPdcb.js +0 -178
- package/client/dist/assets/playbackCompletion-IPHm9fp5.js +0 -1
- package/client/dist/assets/usePlaybackEnd-C5EyqR1L.js +0 -10
- package/client/dist/assets/useTv-BpVapcT5.js +0 -1
- package/client/dist/assets/useTvLibrary-BFRidauf.js +0 -1
- /package/client/dist/assets/{usePlaybackEnd-BMf_H2dw.css → useWatchAlongPlayer-BMf_H2dw.css} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as fe,o as He,a as Ze,p as Je,d as h,A as ye,T,u as t,S as Xe}from"./vendor-core-DfaOB3Rn.js";import{u as et,a as Se}from"./vendor-query-BBT5_sHx.js";import{i as tt,u as at,d as nt,x as st,y as _e,z as Ae,q as we,A as lt,t as rt,l as ct,C as it,D as ot,E as dt,F as ht,G as ut,B as W,M as se}from"./index-vb4WPdcb.js";import{I as g}from"./vendor-icons-DrybRNxP.js";import{A as mt}from"./AnimeCard-aZA4-g8o.js";import{S as pt}from"./SkeletonGrid-sA6_IQY1.js";import{E as gt}from"./ErrorMessage-DAxegITP.js";import{P as Le}from"./MediaCard-DJNRuWDJ.js";import{s as n}from"./LibraryListPage.module-r6k9nyT9.js";import{A as vt}from"./ActiveFilterChips-olGfwxle.js";import"./useAnimeInfoData-Ai39I_f0.js";import"./QueueOptionsButton-ByAwxtJ-.js";import"./vendor-ui-3qrARCPr.js";import"./playbackCompletion-IPHm9fp5.js";import"./useIsMobile-Dvx1uJ82.js";import"./MatureConsentModal-DLVOORqW.js";const ft=(d,v)=>{const l=new URLSearchParams(v);return l.delete("page"),l.sort(),`${d}|${l.toString()}`},yt=(d,v)=>{const l=new Set(d);return v.forEach(A=>l.add(A)),l},St=(d,v)=>{const l=new Set(d);return v.forEach(A=>l.delete(A)),l},_t="_sortSelect_cahhw_1",At="_filterContainer_cahhw_30",wt="_slideUpIn_cahhw_1",Lt="_searchBarWrapper_cahhw_44",Ct="_inputIconWrapper_cahhw_50",Nt="_searchIcon_cahhw_55",bt="_searchInput_cahhw_64",Bt="_searchActions_cahhw_84",kt="_searchBtn_cahhw_89",Rt="_filterToggleBtn_cahhw_94",Tt="_advancedFilters_cahhw_115",Wt="_show_cahhw_122",It="_filterDivider_cahhw_128",xt="_filterGrid_cahhw_134",$t="_filterItem_cahhw_141",Pt="_genreSection_cahhw_183",Ft="_genreLabel_cahhw_189",Gt="_genreContainer_cahhw_199",Mt="_genreButton_cahhw_205",Ot="_include_cahhw_222",Et="_exclude_cahhw_228",Dt="_filterActions_cahhw_235",zt="_applyBtn_cahhw_246",c={sortSelect:_t,filterContainer:At,slideUpIn:wt,searchBarWrapper:Lt,inputIconWrapper:Ct,searchIcon:Nt,searchInput:bt,searchActions:Bt,searchBtn:kt,filterToggleBtn:Rt,advancedFilters:Tt,show:Wt,filterDivider:It,filterGrid:xt,filterItem:$t,genreSection:Pt,genreLabel:Ft,genreContainer:Gt,genreButton:Mt,include:Ot,exclude:Et,filterActions:Dt,applyBtn:zt},Ne=["All","Continue Watching","Watching","Completed","On-Hold","Dropped","Planned"],Ce=Ne.slice(2),Ut=[{value:"ALL",label:"All Types"},{value:"TV",label:"TV Series"},{value:"Movie",label:"Movie"},{value:"OVA",label:"OVA"},{value:"ONA",label:"ONA"},{value:"TV_SHORT",label:"TV Short"},{value:"SPECIAL",label:"Special"},{value:"ADULT",label:"Adult (18+)"}],qt=[{value:"ALL",label:"All Seasons"},{value:"WINTER",label:"Winter"},{value:"SPRING",label:"Spring"},{value:"SUMMER",label:"Summer"},{value:"FALL",label:"Fall"}],ca=()=>{fe(()=>{document.title="Watchlist - dango"},[]);const{filter:d="All"}=He(),v=Ze(),[l,A]=Je(),Q=et(),le=tt(),[f,I]=h(parseInt(l.get("page")||"1")),[w,x]=h(l.get("query")||""),[L,V]=h(l.get("sortBy")||"last_added"),[C,$]=h(l.get("type")||"ALL"),[N,P]=h(l.get("season")||"ALL"),[b,F]=h(l.get("year")||"ALL"),[k,G]=h(()=>{const e={},a=l.get("genres")?.split(",").map(r=>r.trim()).filter(Boolean)||[],s=l.get("excludeGenres")?.split(",").map(r=>r.trim()).filter(Boolean)||[];return a.forEach(r=>r&&(e[r]="include")),s.forEach(r=>r&&(e[r]="exclude")),e}),[M,be]=h(()=>["type","season","year","genres","excludeGenres"].some(e=>l.has(e))),{lowEndMode:Be}=at(),{titlePreference:O}=nt(),{data:ke}=st(),re=ke?.genres||[],H=ye(null),[o,B]=h(null),[Z,E]=h(!1),[ce,D]=h(!1),[z,Re]=h(!1),[p,y]=h(new Set),J=ye(null),i=d==="Continue Watching",U=T(()=>{const e=new URLSearchParams(l);return e.delete("page"),e.set("titlePreference",O),e.toString()},[l,O]),{data:q,isLoading:Te,error:We}=_e(U,f,14),{data:Y,isLoading:Ie,error:xe}=Ae(d,U,f,14),{data:$e}=_e(U,f+1,14),{data:Pe}=Ae(d,U,f+1,14),X=T(()=>(i?q?.data:Y?.data)||[],[i,q,Y]),R=T(()=>(i?q?.total:Y?.total)||0,[i,q,Y]),j=i?Te:Ie,ie=i?We:xe,oe=i?$e:Pe;fe(()=>{x(l.get("query")||""),V(l.get("sortBy")||"last_added"),$(l.get("type")||"ALL"),P(l.get("season")||"ALL"),F(l.get("year")||"ALL");const e={},a=l.get("genres")?.split(",").map(u=>u.trim()).filter(Boolean)||[],s=l.get("excludeGenres")?.split(",").map(u=>u.trim()).filter(Boolean)||[];a.forEach(u=>u&&(e[u]="include")),s.forEach(u=>u&&(e[u]="exclude")),G(e),I(parseInt(l.get("page")||"1"));const r=ft(d,l);J.current!==null&&J.current!==r&&y(new Set),J.current=r},[l,d]);const Fe=Se({mutationFn:async({id:e,status:a})=>{await rt.watchlist.setStatus.mutate({id:e,status:a})},onSuccess:()=>{Q.invalidateQueries({queryKey:[we.watchlist]}),lt.success("Status updated")}}),Ge=Se(le.continueWatching.remove.mutationOptions({onSuccess:()=>{Q.invalidateQueries(le.continueWatching.pathFilter()),Q.invalidateQueries({queryKey:[we.continueWatching]})}})),ee=ct(),{data:de}=it("skipRemoveConfirmation"),Me=ot(),te=T(()=>{const e=a=>a[O]||a.name||"";return[...X].sort((a,s)=>L==="name_asc"?e(a).localeCompare(e(s)):L==="name_desc"?e(s).localeCompare(e(a)):0)},[X,L,O]),ae=new Date().getFullYear(),Oe=[{value:"ALL",label:"All Years"},...Array.from({length:ae-1980+1},(e,a)=>({value:String(ae-a),label:String(ae-a)}))],m=(e=L,a=1)=>{const s=new URLSearchParams;w.trim()&&s.set("query",w.trim()),e!=="last_added"&&s.set("sortBy",e),C!=="ALL"&&s.set("type",C),N!=="ALL"&&s.set("season",N),b!=="ALL"&&s.set("year",b);const r=Object.entries(k).filter(([,_])=>_==="include").map(([_])=>_),u=Object.entries(k).filter(([,_])=>_==="exclude").map(([_])=>_);r.length>0&&s.set("genres",r.join(",")),u.length>0&&s.set("excludeGenres",u.join(",")),a>1&&s.set("page",a.toString()),A(s),a!==f&&I(a)},he=e=>{if(m(L,e),H.current){const a=H.current.getBoundingClientRect().top+window.scrollY-100;window.scrollTo({top:a,behavior:"smooth"})}},Ee=()=>{x(""),V("last_added"),$("ALL"),P("ALL"),F("ALL"),G({}),A(new URLSearchParams),I(1)},De=e=>{G(a=>{const s=a[e],r={...a};return s==="include"?r[e]="exclude":s==="exclude"?delete r[e]:r[e]="include",r})},ue=(e,a)=>{if(i){B({id:e,name:a});return}String(de)==="true"||String(de)==="1"?ee.mutate({id:e}):B({id:e,name:a})},ze=()=>{if(o){if(o.ids){i?(Ue.mutate({ids:o.ids}),Z&&pe.mutate({ids:o.ids})):pe.mutate({ids:o.ids}),y(new Set),B(null),E(!1),D(!1);return}i?(Ge.mutate({showId:o.id}),Z&&ee.mutate({id:o.id})):ee.mutate({id:o.id}),ce&&Me.mutate({key:"skipRemoveConfirmation",value:!0}),B(null),E(!1),D(!1)}},me=()=>{B(null),E(!1),D(!1)},pe=dt(),Ue=ht(),qe=ut(),Ye=()=>{Re(e=>{const a=!e;return a||y(new Set),a})},je=e=>{y(a=>{const s=new Set(a);return s.has(e)?s.delete(e):s.add(e),s})},K=te.map(e=>e.id),ne=K.length>0&&K.every(e=>p.has(e)),Ke=()=>{y(ne?e=>St(e,K):e=>yt(e,K))},Qe=e=>{p.size!==0&&(qe.mutate({ids:[...p],status:e}),y(new Set))},Ve=()=>{p.size!==0&&B({ids:[...p]})},ge=X.length>=14&&oe&&oe.data.length>0,ve=T(()=>Math.max(1,Math.ceil(R/14)),[R]),S=[];w.trim()&&S.push({key:"query",label:`Search: ${w}`,onRemove:()=>{x(""),m()}}),C!=="ALL"&&S.push({key:"type",label:`Type: ${C}`,onRemove:()=>{$("ALL"),m()}}),N!=="ALL"&&S.push({key:"season",label:`Season: ${N}`,onRemove:()=>{P("ALL"),m()}}),b!=="ALL"&&S.push({key:"year",label:`Year: ${b}`,onRemove:()=>{F("ALL"),m()}});for(const[e,a]of Object.entries(k))S.push({key:e,label:a==="include"?`+ ${e}`:`-${e}`,tone:a==="include"?"primary":"danger",onRemove:()=>{G(s=>{const r={...s};return delete r[e],r}),m()}});return t("div",{className:"page-container",children:[t("header",{className:n.header,children:[t("h2",{className:n.title,children:"My Watchlist"}),t("p",{className:n.subtitle,children:"Track and manage your anime collection"})]}),t("div",{className:n.controls,children:[t("div",{className:n.filters,children:Ne.map(e=>t("button",{className:`${n.filterBtn} ${d===e?n.active:""}`,onClick:()=>{const a=new URLSearchParams(l);a.delete("page"),v({pathname:`/watchlist/${e}`,search:a.toString()}),I(1)},children:e},e))}),t("div",{children:t("select",{className:c.sortSelect,value:L,onChange:e=>{const a=e.currentTarget.value;V(a),m(a,f)},children:[t("option",{value:"last_added",children:"Recently Added"}),t("option",{value:"name_asc",children:"Name (A-Z)"}),t("option",{value:"name_desc",children:"Name (Z-A)"})]})})]}),t("div",{className:c.filterContainer,children:[t("div",{className:c.searchBarWrapper,children:[t("div",{className:c.inputIconWrapper,children:[t(g,{name:"search",className:c.searchIcon}),t("input",{className:c.searchInput,placeholder:"Search your watchlist by title...",value:w,onInput:e=>x(e.currentTarget.value),onKeyDown:e=>e.key==="Enter"&&m()})]}),t("div",{className:c.searchActions,children:[t(W,{onClick:()=>m(),className:c.searchBtn,children:"Search"}),t("button",{className:`${c.filterToggleBtn} ${M?n.active:""}`,onClick:()=>be(!M),children:[t(g,{name:"filter",size:14}),t("span",{children:"Filters"}),M?t(g,{name:"chevron-up",size:12}):t(g,{name:"chevron-down",size:12})]})]})]}),t("div",{className:`${c.advancedFilters} ${M?c.show:""}`,children:[t("div",{className:c.filterDivider}),t("div",{className:c.filterGrid,children:[t("div",{className:c.filterItem,children:[t("label",{children:"Type"}),t("select",{value:C,onChange:e=>$(e.currentTarget.value),children:Ut.map(e=>t("option",{value:e.value,children:e.label},e.value))})]}),t("div",{className:c.filterItem,children:[t("label",{children:"Season"}),t("select",{value:N,onChange:e=>P(e.currentTarget.value),children:qt.map(e=>t("option",{value:e.value,children:e.label},e.value))})]}),t("div",{className:c.filterItem,children:[t("label",{children:"Year"}),t("select",{value:b,onChange:e=>F(e.currentTarget.value),children:Oe.map(e=>t("option",{value:e.value,children:e.label},e.value))})]})]}),re.length>0&&t("div",{className:c.genreSection,children:[t("label",{className:c.genreLabel,children:"Genres"}),t("div",{className:c.genreContainer,children:re.map(e=>t("button",{className:`${c.genreButton} ${c[k[e]||""]}`,onClick:()=>De(e),children:e},e))})]}),t("div",{className:c.filterActions,children:[t(W,{variant:"secondary",onClick:Ee,children:"Reset All"}),t(W,{onClick:()=>m(),className:c.applyBtn,children:"Apply Filters"})]})]})]}),t("div",{className:n.resultsHeader,ref:H,children:[t("h3",{className:n.resultsTitle,children:[i?"Continue Watching":d,t("span",{className:n.itemCount,children:["(",R," items)"]})]}),t("div",{className:n.headerActions,children:[t("button",{className:`${n.manageBtn} ${z?n.active:""}`,onClick:Ye,children:[t(g,{name:"pencil-alt",size:13}),t("span",{children:"Bulk Manage"})]}),R>0&&t(Le,{page:f,totalPages:ve,canGoNext:ge,onChange:he,isLoading:j})]})]}),z&&t("div",{className:n.manageBar,children:[t("button",{className:n.selectAllBtn,onClick:Ke,children:[t("span",{className:`${n.selectAllBox} ${ne?n.selectAllBoxChecked:""}`,"aria-hidden":"true"}),t("span",{children:ne?"Clear Page":"Select All"})]}),t("span",{className:n.manageCount,children:[p.size," selected"]}),t("div",{className:n.manageSpacer}),!i&&t("select",{className:n.manageStatusSelect,value:"",onChange:e=>{e.currentTarget.value&&Qe(e.currentTarget.value)},disabled:p.size===0,title:"Set status for selected items",children:[t("option",{value:"",children:"Set status…"}),Ce.map(e=>t("option",{value:e,children:e},e))]}),t("button",{className:n.manageRemoveBtn,onClick:Ve,disabled:p.size===0,children:[t(g,{name:"trash",size:13}),t("span",{children:"Remove Selected"})]})]}),j?t(pt,{}):ie?t(gt,{message:ie.message}):t(Xe,{children:[S.length>0&&t(vt,{chips:S}),t("div",{className:`${n.grid} ${Be?n.lowEnd:""}`,children:te.map(e=>{const a=p.has(e.id);return t("div",{className:`${n.itemWrapper} ${a?n.selected:""}`,children:[z&&t("div",{className:n.selectOverlay,onClick:()=>je(e.id),title:a?"Deselect":"Select",children:t("span",{className:n.selectBadge,children:a?t(g,{name:"check",size:12}):null})}),t(mt,{anime:e,continueWatching:i,onRemove:()=>ue(e.id,e.name),layout:"vertical"}),!i&&!z&&t("div",{className:n.cardActions,children:[t("select",{className:n.statusSelect,value:e.status,onChange:s=>Fe.mutate({id:e.id,status:s.currentTarget.value}),children:Ce.map(s=>t("option",{value:s,children:s},s))}),t("button",{className:n.removeBtn,onClick:()=>ue(e.id,e.name),title:"Remove from Watchlist","aria-label":"Remove from Watchlist",children:t(g,{name:"trash",size:12})})]})]},e._id)})})]}),!j&&te.length===0&&t("div",{className:n.emptyState,children:[t("h3",{className:n.emptyTitle,children:"Your watchlist is looking a bit lonely"}),t("p",{className:n.emptyText,children:d!=="All"||w||C!=="ALL"||N!=="ALL"||b!=="ALL"||Object.keys(k).length>0?"No anime match these filters. Try adjusting them to see more titles.":"Let's find something to watch!"}),t("button",{className:n.emptyBtn,onClick:()=>v("/search"),children:[t(g,{name:"search",size:14}),t("span",{children:"Browse Anime"})]})]}),R>0&&t("div",{className:n.bottomPagination,children:t(Le,{page:f,totalPages:ve,canGoNext:ge,onChange:he,isLoading:j,variant:"labeled"})}),t(se,{isOpen:!!o,onClose:me,title:i?"Reset Progress":"Remove from Watchlist",children:[t(se.Body,{children:[t("p",{children:o?.ids&&o.ids.length>1?i?`Are you sure you want to remove watch progress for ${o.ids.length} items?`:`Are you sure you want to remove ${o.ids.length} items from your watchlist?`:i?`Are you sure you want to remove your watch progress for "${o?.name}"?`:`Are you sure you want to remove "${o?.name}" from your watchlist?`}),i&&t("label",{children:[t("input",{type:"checkbox",checked:Z,onChange:e=>E(e.currentTarget.checked)}),"Also remove from my watchlist"]}),!i&&!(o?.ids&&o.ids.length>1)&&t("label",{children:[t("input",{type:"checkbox",checked:ce,onChange:e=>D(e.currentTarget.checked)}),"Remember my choice"]})]}),t(se.Actions,{children:[t(W,{variant:"secondary",onClick:me,children:"No"}),t(W,{variant:"danger",onClick:ze,children:"Yes"})]})]})]})};export{ca as default};
|
|
1
|
+
import{h as fe,o as He,a as Ze,p as Je,d as h,A as ye,T,u as t,S as Xe}from"./vendor-core-DfaOB3Rn.js";import{u as et,a as Se}from"./vendor-query-BBT5_sHx.js";import{l as tt,u as at,d as nt,C as st,D as _e,E as we,q as Ae,F as lt,t as rt,o as ct,G as it,H as ot,I as dt,J as ht,K as ut,B as W,L as se}from"./index-B_2ppn5P.js";import{I as g}from"./vendor-icons-DrybRNxP.js";import{A as mt}from"./AnimeCard-B_eNHj3Q.js";import{S as pt}from"./SkeletonGrid-Od92F7If.js";import{E as gt}from"./ErrorMessage-DAxegITP.js";import{P as Le}from"./MediaCard-BXWAjpwt.js";import{s as n}from"./LibraryListPage.module-r6k9nyT9.js";import{A as vt}from"./ActiveFilterChips-olGfwxle.js";import"./useAnimeInfoData-CH9hmj5A.js";import"./QueueOptionsButton-E2SuRJH_.js";import"./vendor-ui-3qrARCPr.js";import"./playbackCompletion-_kwPgoZi.js";import"./useIsMobile-Dvx1uJ82.js";import"./MatureConsentModal-BxCEXBbj.js";const ft=(d,v)=>{const l=new URLSearchParams(v);return l.delete("page"),l.sort(),`${d}|${l.toString()}`},yt=(d,v)=>{const l=new Set(d);return v.forEach(w=>l.add(w)),l},St=(d,v)=>{const l=new Set(d);return v.forEach(w=>l.delete(w)),l},_t="_sortSelect_cahhw_1",wt="_filterContainer_cahhw_30",At="_slideUpIn_cahhw_1",Lt="_searchBarWrapper_cahhw_44",Ct="_inputIconWrapper_cahhw_50",Nt="_searchIcon_cahhw_55",bt="_searchInput_cahhw_64",Bt="_searchActions_cahhw_84",kt="_searchBtn_cahhw_89",Rt="_filterToggleBtn_cahhw_94",Tt="_advancedFilters_cahhw_115",Wt="_show_cahhw_122",It="_filterDivider_cahhw_128",xt="_filterGrid_cahhw_134",$t="_filterItem_cahhw_141",Pt="_genreSection_cahhw_183",Ft="_genreLabel_cahhw_189",Gt="_genreContainer_cahhw_199",Mt="_genreButton_cahhw_205",Ot="_include_cahhw_222",Et="_exclude_cahhw_228",Dt="_filterActions_cahhw_235",zt="_applyBtn_cahhw_246",c={sortSelect:_t,filterContainer:wt,slideUpIn:At,searchBarWrapper:Lt,inputIconWrapper:Ct,searchIcon:Nt,searchInput:bt,searchActions:Bt,searchBtn:kt,filterToggleBtn:Rt,advancedFilters:Tt,show:Wt,filterDivider:It,filterGrid:xt,filterItem:$t,genreSection:Pt,genreLabel:Ft,genreContainer:Gt,genreButton:Mt,include:Ot,exclude:Et,filterActions:Dt,applyBtn:zt},Ne=["All","Continue Watching","Watching","Completed","On-Hold","Dropped","Planned"],Ce=Ne.slice(2),Ut=[{value:"ALL",label:"All Types"},{value:"TV",label:"TV Series"},{value:"Movie",label:"Movie"},{value:"OVA",label:"OVA"},{value:"ONA",label:"ONA"},{value:"TV_SHORT",label:"TV Short"},{value:"SPECIAL",label:"Special"},{value:"ADULT",label:"Adult (18+)"}],qt=[{value:"ALL",label:"All Seasons"},{value:"WINTER",label:"Winter"},{value:"SPRING",label:"Spring"},{value:"SUMMER",label:"Summer"},{value:"FALL",label:"Fall"}],ca=()=>{fe(()=>{document.title="Watchlist - dango"},[]);const{filter:d="All"}=He(),v=Ze(),[l,w]=Je(),Q=et(),le=tt(),[f,I]=h(parseInt(l.get("page")||"1")),[A,x]=h(l.get("query")||""),[L,V]=h(l.get("sortBy")||"last_added"),[C,$]=h(l.get("type")||"ALL"),[N,P]=h(l.get("season")||"ALL"),[b,F]=h(l.get("year")||"ALL"),[k,G]=h(()=>{const e={},a=l.get("genres")?.split(",").map(r=>r.trim()).filter(Boolean)||[],s=l.get("excludeGenres")?.split(",").map(r=>r.trim()).filter(Boolean)||[];return a.forEach(r=>r&&(e[r]="include")),s.forEach(r=>r&&(e[r]="exclude")),e}),[M,be]=h(()=>["type","season","year","genres","excludeGenres"].some(e=>l.has(e))),{lowEndMode:Be}=at(),{titlePreference:O}=nt(),{data:ke}=st(),re=ke?.genres||[],H=ye(null),[o,B]=h(null),[Z,E]=h(!1),[ce,D]=h(!1),[z,Re]=h(!1),[p,y]=h(new Set),J=ye(null),i=d==="Continue Watching",U=T(()=>{const e=new URLSearchParams(l);return e.delete("page"),e.set("titlePreference",O),e.toString()},[l,O]),{data:q,isLoading:Te,error:We}=_e(U,f,14),{data:Y,isLoading:Ie,error:xe}=we(d,U,f,14),{data:$e}=_e(U,f+1,14),{data:Pe}=we(d,U,f+1,14),X=T(()=>(i?q?.data:Y?.data)||[],[i,q,Y]),R=T(()=>(i?q?.total:Y?.total)||0,[i,q,Y]),j=i?Te:Ie,ie=i?We:xe,oe=i?$e:Pe;fe(()=>{x(l.get("query")||""),V(l.get("sortBy")||"last_added"),$(l.get("type")||"ALL"),P(l.get("season")||"ALL"),F(l.get("year")||"ALL");const e={},a=l.get("genres")?.split(",").map(u=>u.trim()).filter(Boolean)||[],s=l.get("excludeGenres")?.split(",").map(u=>u.trim()).filter(Boolean)||[];a.forEach(u=>u&&(e[u]="include")),s.forEach(u=>u&&(e[u]="exclude")),G(e),I(parseInt(l.get("page")||"1"));const r=ft(d,l);J.current!==null&&J.current!==r&&y(new Set),J.current=r},[l,d]);const Fe=Se({mutationFn:async({id:e,status:a})=>{await rt.watchlist.setStatus.mutate({id:e,status:a})},onSuccess:()=>{Q.invalidateQueries({queryKey:[Ae.watchlist]}),lt.success("Status updated")}}),Ge=Se(le.continueWatching.remove.mutationOptions({onSuccess:()=>{Q.invalidateQueries(le.continueWatching.pathFilter()),Q.invalidateQueries({queryKey:[Ae.continueWatching]})}})),ee=ct(),{data:de}=it("skipRemoveConfirmation"),Me=ot(),te=T(()=>{const e=a=>a[O]||a.name||"";return[...X].sort((a,s)=>L==="name_asc"?e(a).localeCompare(e(s)):L==="name_desc"?e(s).localeCompare(e(a)):0)},[X,L,O]),ae=new Date().getFullYear(),Oe=[{value:"ALL",label:"All Years"},...Array.from({length:ae-1980+1},(e,a)=>({value:String(ae-a),label:String(ae-a)}))],m=(e=L,a=1)=>{const s=new URLSearchParams;A.trim()&&s.set("query",A.trim()),e!=="last_added"&&s.set("sortBy",e),C!=="ALL"&&s.set("type",C),N!=="ALL"&&s.set("season",N),b!=="ALL"&&s.set("year",b);const r=Object.entries(k).filter(([,_])=>_==="include").map(([_])=>_),u=Object.entries(k).filter(([,_])=>_==="exclude").map(([_])=>_);r.length>0&&s.set("genres",r.join(",")),u.length>0&&s.set("excludeGenres",u.join(",")),a>1&&s.set("page",a.toString()),w(s),a!==f&&I(a)},he=e=>{if(m(L,e),H.current){const a=H.current.getBoundingClientRect().top+window.scrollY-100;window.scrollTo({top:a,behavior:"smooth"})}},Ee=()=>{x(""),V("last_added"),$("ALL"),P("ALL"),F("ALL"),G({}),w(new URLSearchParams),I(1)},De=e=>{G(a=>{const s=a[e],r={...a};return s==="include"?r[e]="exclude":s==="exclude"?delete r[e]:r[e]="include",r})},ue=(e,a)=>{if(i){B({id:e,name:a});return}String(de)==="true"||String(de)==="1"?ee.mutate({id:e}):B({id:e,name:a})},ze=()=>{if(o){if(o.ids){i?(Ue.mutate({ids:o.ids}),Z&&pe.mutate({ids:o.ids})):pe.mutate({ids:o.ids}),y(new Set),B(null),E(!1),D(!1);return}i?(Ge.mutate({showId:o.id}),Z&&ee.mutate({id:o.id})):ee.mutate({id:o.id}),ce&&Me.mutate({key:"skipRemoveConfirmation",value:!0}),B(null),E(!1),D(!1)}},me=()=>{B(null),E(!1),D(!1)},pe=dt(),Ue=ht(),qe=ut(),Ye=()=>{Re(e=>{const a=!e;return a||y(new Set),a})},je=e=>{y(a=>{const s=new Set(a);return s.has(e)?s.delete(e):s.add(e),s})},K=te.map(e=>e.id),ne=K.length>0&&K.every(e=>p.has(e)),Ke=()=>{y(ne?e=>St(e,K):e=>yt(e,K))},Qe=e=>{p.size!==0&&(qe.mutate({ids:[...p],status:e}),y(new Set))},Ve=()=>{p.size!==0&&B({ids:[...p]})},ge=X.length>=14&&oe&&oe.data.length>0,ve=T(()=>Math.max(1,Math.ceil(R/14)),[R]),S=[];A.trim()&&S.push({key:"query",label:`Search: ${A}`,onRemove:()=>{x(""),m()}}),C!=="ALL"&&S.push({key:"type",label:`Type: ${C}`,onRemove:()=>{$("ALL"),m()}}),N!=="ALL"&&S.push({key:"season",label:`Season: ${N}`,onRemove:()=>{P("ALL"),m()}}),b!=="ALL"&&S.push({key:"year",label:`Year: ${b}`,onRemove:()=>{F("ALL"),m()}});for(const[e,a]of Object.entries(k))S.push({key:e,label:a==="include"?`+ ${e}`:`-${e}`,tone:a==="include"?"primary":"danger",onRemove:()=>{G(s=>{const r={...s};return delete r[e],r}),m()}});return t("div",{className:"page-container",children:[t("header",{className:n.header,children:[t("h2",{className:n.title,children:"My Watchlist"}),t("p",{className:n.subtitle,children:"Track and manage your anime collection"})]}),t("div",{className:n.controls,children:[t("div",{className:n.filters,children:Ne.map(e=>t("button",{className:`${n.filterBtn} ${d===e?n.active:""}`,onClick:()=>{const a=new URLSearchParams(l);a.delete("page"),v({pathname:`/watchlist/${e}`,search:a.toString()}),I(1)},children:e},e))}),t("div",{children:t("select",{className:c.sortSelect,value:L,onChange:e=>{const a=e.currentTarget.value;V(a),m(a,f)},children:[t("option",{value:"last_added",children:"Recently Added"}),t("option",{value:"name_asc",children:"Name (A-Z)"}),t("option",{value:"name_desc",children:"Name (Z-A)"})]})})]}),t("div",{className:c.filterContainer,children:[t("div",{className:c.searchBarWrapper,children:[t("div",{className:c.inputIconWrapper,children:[t(g,{name:"search",className:c.searchIcon}),t("input",{className:c.searchInput,placeholder:"Search your watchlist by title...",value:A,onInput:e=>x(e.currentTarget.value),onKeyDown:e=>e.key==="Enter"&&m()})]}),t("div",{className:c.searchActions,children:[t(W,{onClick:()=>m(),className:c.searchBtn,children:"Search"}),t("button",{className:`${c.filterToggleBtn} ${M?n.active:""}`,onClick:()=>be(!M),children:[t(g,{name:"filter",size:14}),t("span",{children:"Filters"}),M?t(g,{name:"chevron-up",size:12}):t(g,{name:"chevron-down",size:12})]})]})]}),t("div",{className:`${c.advancedFilters} ${M?c.show:""}`,children:[t("div",{className:c.filterDivider}),t("div",{className:c.filterGrid,children:[t("div",{className:c.filterItem,children:[t("label",{children:"Type"}),t("select",{value:C,onChange:e=>$(e.currentTarget.value),children:Ut.map(e=>t("option",{value:e.value,children:e.label},e.value))})]}),t("div",{className:c.filterItem,children:[t("label",{children:"Season"}),t("select",{value:N,onChange:e=>P(e.currentTarget.value),children:qt.map(e=>t("option",{value:e.value,children:e.label},e.value))})]}),t("div",{className:c.filterItem,children:[t("label",{children:"Year"}),t("select",{value:b,onChange:e=>F(e.currentTarget.value),children:Oe.map(e=>t("option",{value:e.value,children:e.label},e.value))})]})]}),re.length>0&&t("div",{className:c.genreSection,children:[t("label",{className:c.genreLabel,children:"Genres"}),t("div",{className:c.genreContainer,children:re.map(e=>t("button",{className:`${c.genreButton} ${c[k[e]||""]}`,onClick:()=>De(e),children:e},e))})]}),t("div",{className:c.filterActions,children:[t(W,{variant:"secondary",onClick:Ee,children:"Reset All"}),t(W,{onClick:()=>m(),className:c.applyBtn,children:"Apply Filters"})]})]})]}),t("div",{className:n.resultsHeader,ref:H,children:[t("h3",{className:n.resultsTitle,children:[i?"Continue Watching":d,t("span",{className:n.itemCount,children:["(",R," items)"]})]}),t("div",{className:n.headerActions,children:[t("button",{className:`${n.manageBtn} ${z?n.active:""}`,onClick:Ye,children:[t(g,{name:"pencil-alt",size:13}),t("span",{children:"Bulk Manage"})]}),R>0&&t(Le,{page:f,totalPages:ve,canGoNext:ge,onChange:he,isLoading:j})]})]}),z&&t("div",{className:n.manageBar,children:[t("button",{className:n.selectAllBtn,onClick:Ke,children:[t("span",{className:`${n.selectAllBox} ${ne?n.selectAllBoxChecked:""}`,"aria-hidden":"true"}),t("span",{children:ne?"Clear Page":"Select All"})]}),t("span",{className:n.manageCount,children:[p.size," selected"]}),t("div",{className:n.manageSpacer}),!i&&t("select",{className:n.manageStatusSelect,value:"",onChange:e=>{e.currentTarget.value&&Qe(e.currentTarget.value)},disabled:p.size===0,title:"Set status for selected items",children:[t("option",{value:"",children:"Set status…"}),Ce.map(e=>t("option",{value:e,children:e},e))]}),t("button",{className:n.manageRemoveBtn,onClick:Ve,disabled:p.size===0,children:[t(g,{name:"trash",size:13}),t("span",{children:"Remove Selected"})]})]}),j?t(pt,{}):ie?t(gt,{message:ie.message}):t(Xe,{children:[S.length>0&&t(vt,{chips:S}),t("div",{className:`${n.grid} ${Be?n.lowEnd:""}`,children:te.map(e=>{const a=p.has(e.id);return t("div",{className:`${n.itemWrapper} ${a?n.selected:""}`,children:[z&&t("div",{className:n.selectOverlay,onClick:()=>je(e.id),title:a?"Deselect":"Select",children:t("span",{className:n.selectBadge,children:a?t(g,{name:"check",size:12}):null})}),t(mt,{anime:e,continueWatching:i,onRemove:()=>ue(e.id,e.name),layout:"vertical"}),!i&&!z&&t("div",{className:n.cardActions,children:[t("select",{className:n.statusSelect,value:e.status,onChange:s=>Fe.mutate({id:e.id,status:s.currentTarget.value}),children:Ce.map(s=>t("option",{value:s,children:s},s))}),t("button",{className:n.removeBtn,onClick:()=>ue(e.id,e.name),title:"Remove from Watchlist","aria-label":"Remove from Watchlist",children:t(g,{name:"trash",size:12})})]})]},e._id)})})]}),!j&&te.length===0&&t("div",{className:n.emptyState,children:[t("h3",{className:n.emptyTitle,children:"Your watchlist is looking a bit lonely"}),t("p",{className:n.emptyText,children:d!=="All"||A||C!=="ALL"||N!=="ALL"||b!=="ALL"||Object.keys(k).length>0?"No anime match these filters. Try adjusting them to see more titles.":"Let's find something to watch!"}),t("button",{className:n.emptyBtn,onClick:()=>v("/search"),children:[t(g,{name:"search",size:14}),t("span",{children:"Browse Anime"})]})]}),R>0&&t("div",{className:n.bottomPagination,children:t(Le,{page:f,totalPages:ve,canGoNext:ge,onChange:he,isLoading:j,variant:"labeled"})}),t(se,{isOpen:!!o,onClose:me,title:i?"Reset Progress":"Remove from Watchlist",children:[t(se.Body,{children:[t("p",{children:o?.ids&&o.ids.length>1?i?`Are you sure you want to remove watch progress for ${o.ids.length} items?`:`Are you sure you want to remove ${o.ids.length} items from your watchlist?`:i?`Are you sure you want to remove your watch progress for "${o?.name}"?`:`Are you sure you want to remove "${o?.name}" from your watchlist?`}),i&&t("label",{children:[t("input",{type:"checkbox",checked:Z,onChange:e=>E(e.currentTarget.checked)}),"Also remove from my watchlist"]}),!i&&!(o?.ids&&o.ids.length>1)&&t("label",{children:[t("input",{type:"checkbox",checked:ce,onChange:e=>D(e.currentTarget.checked)}),"Remember my choice"]})]}),t(se.Actions,{children:[t(W,{variant:"secondary",onClick:me,children:"No"}),t(W,{variant:"danger",onClick:ze,children:"Yes"})]})]})]})};export{ca as default};
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Home-BYtjQAAm.js","assets/vendor-core-DfaOB3Rn.js","assets/vendor-query-BBT5_sHx.js","assets/MediaCard-BXWAjpwt.js","assets/vendor-icons-DrybRNxP.js","assets/vendor-ui-3qrARCPr.js","assets/useIsMobile-Dvx1uJ82.js","assets/MatureConsentModal-BxCEXBbj.js","assets/MatureConsentModal-CqewXc0q.css","assets/MediaCard-CoyScn-7.css","assets/AnimeCard-B_eNHj3Q.js","assets/useAnimeInfoData-CH9hmj5A.js","assets/QueueOptionsButton-E2SuRJH_.js","assets/QueueOptionsButton-CM15uQn8.css","assets/playbackCompletion-_kwPgoZi.js","assets/SkeletonGrid-Od92F7If.js","assets/SkeletonGrid-BisPI38I.css","assets/ErrorMessage-DAxegITP.js","assets/ErrorMessage-CXoRbrLN.css","assets/ResetProgressModal-B4qmiw-m.js","assets/QueueRail-ZlyY6iwq.js","assets/QueueRail-Bkh4VZls.css","assets/useMangaPopup-3MuX6uO9.js","assets/useMangaLibrary-DlU4Z9JL.js","assets/libraryInvalidation-DeUzK6TJ.js","assets/usePopup-DS9jMzp6.js","assets/MangaResetProgressModal-DgD2JJiz.js","assets/useProviders-Dx9rG8FY.js","assets/useTv-DZQzHJgO.js","assets/TvPopup-8uQGvzWG.js","assets/useTvLibrary-DVpLBz5c.js","assets/AsmrResetProgressModal-BkO6uAVo.js","assets/useAsmr-DQsv1SQT.js","assets/Home-DHAkZuDf.css","assets/Watchlist-DMj82PtZ.js","assets/LibraryListPage.module-r6k9nyT9.js","assets/LibraryListPage-DmdjNa2U.css","assets/ActiveFilterChips-olGfwxle.js","assets/ActiveFilterChips-QjkplDN2.css","assets/Watchlist-DW7kUORr.css","assets/Settings-BqOAQxhe.js","assets/ToggleSwitch-CN_ppEc9.js","assets/ToggleSwitch-BPil0d_k.css","assets/Settings-D37LNfis.css","assets/Player-BopSS6Gv.js","assets/PlayerProvider-Cj4nkG1Z.js","assets/PlayerProvider-N2pT5gty.css","assets/useWatchAlongPlayer-KZT7d2pQ.js","assets/useWatchAlongPlayer-BMf_H2dw.css","assets/AnimeMetaDetails-B3-A7O5H.js","assets/AnimeMetaDetails-BwNQnRCd.css","assets/SynopsisText-B3Sa5pRv.js","assets/SynopsisText-CYv2W3yR.css","assets/WatchAlongPanel-BKprdx-w.js","assets/WatchAlongPanel-DbJuLqxU.css","assets/Player-D-sQfjcx.css","assets/WatchAlong-Cd_rNUGz.js","assets/Search-C2mxeTuG.js","assets/Search.module-C_qwCdHS.js","assets/Search-DCKK3seW.css","assets/Mature--NRjmFgA.js","assets/Mature-DJmUUtlF.css","assets/Asmr-DB4F0zQm.js","assets/useAsmrPopup-6kWviNqn.js","assets/page.module-C1MlZzf3.js","assets/page-DRvjODkg.css","assets/Asmr-Do89pEHG.css","assets/Manga-B09DXrt3.js","assets/Manga.module-depGEacJ.js","assets/Manga-CqAceKxR.css","assets/MangaInfoPage-HniBD97j.js","assets/MangaReadPage-XTo4eB8e.js","assets/ReadingList-DEOzfsq9.js","assets/LibraryListPage-BXCoAwO-.js","assets/TvSearch-DMc5DzU4.js","assets/TvInfo-CYh7oICz.js","assets/TvInfo-Bu36xJyO.css","assets/Tv-B8tWYqQt.js","assets/OptionListMenu-DHzVKmrw.js","assets/Tv-D3vXCsSC.css","assets/TvWatchlist-fPe4D63a.js","assets/ListeningList-B58inkaW.js","assets/Trackers-CyWVHtOz.js","assets/Trackers-CvO6aWVx.css","assets/Insights-kd8R5HFL.js","assets/Insights-D0qrep0K.css","assets/AnimeInfoPage-BTJBbJx7.js","assets/PlayerRedirect-fv2tzEUu.js","assets/VirtualKeyboard-CjOEv-Zs.js","assets/VirtualKeyboard-BaUll8Yv.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{N as sr,k as Y,A as H,q as K,h as w,S as Z,d as g,X as fe,x as he,T as Ce,g as St,u as o,L as se,$ as Pt,a as hn,c as tt,e as ir,f as ar,D as cr,i as lr,P as qt,j as ur,l as R,m as Dt,z as M,n as dr,B as mr}from"./vendor-core-DfaOB3Rn.js";import{s as Pe,i as fr,q as hr,u as X,a as ie,b as re,c as Tt,Q as pr,d as vr}from"./vendor-query-BBT5_sHx.js";import{I as C}from"./vendor-icons-DrybRNxP.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();const yr="modulepreload",gr=function(e){return"/"+e},jt={},F=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){let l=function(u){return Promise.all(u.map(d=>Promise.resolve(d).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),c=a?.nonce||a?.getAttribute("nonce");s=l(n.map(u=>{if(u=gr(u),u in jt)return;jt[u]=!0;const d=u.endsWith(".css"),f=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${f}`))return;const m=document.createElement("link");if(m.rel=d?"stylesheet":yr,d||(m.as="script"),m.crossOrigin="",m.href=u,c&&m.setAttribute("nonce",c),document.head.appendChild(m),d)return new Promise((h,p)=>{m.addEventListener("load",h),m.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${u}`)))})}))}function i(a){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=a,window.dispatchEvent(c),!c.defaultPrevented)throw a}return s.then(a=>{for(const c of a||[])c.status==="rejected"&&i(c.reason);return t().catch(i)})};let br={data:""},wr=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||br},_r=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,Er=/\/\*[^]*?\*\/| +/g,Mt=/\n+/g,we=(e,t)=>{let n="",r="",s="";for(let i in e){let a=e[i];i[0]=="@"?i[1]=="i"?n=i+" "+a+";":r+=i[1]=="f"?we(a,i):i+"{"+we(a,i[1]=="k"?"":t)+"}":typeof a=="object"?r+=we(a,t?t.replace(/([^,])+/g,c=>i.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,l=>/&/.test(l)?l.replace(/&/g,c):c?c+" "+l:l)):i):a!=null&&(i=i[1]=="-"?i:i.replace(/[A-Z]/g,"-$&").toLowerCase(),s+=we.p?we.p(i,a):i+":"+a+";")}return n+(t&&s?t+"{"+s+"}":s)+r},be={},pn=e=>{if(typeof e=="object"){let t="";for(let n in e)t+=n+pn(e[n]);return t}return e},kr=(e,t,n,r,s)=>{let i=pn(e),a=be[i]||(be[i]=(l=>{let u=0,d=11;for(;u<l.length;)d=101*d+l.charCodeAt(u++)>>>0;return"go"+d})(i));if(!be[a]){let l=i!==e?e:(u=>{let d,f,m=[{}];for(;d=_r.exec(u.replace(Er,""));)d[4]?m.shift():d[3]?(f=d[3].replace(Mt," ").trim(),m.unshift(m[0][f]=m[0][f]||{})):m[0][d[1]]=d[2].replace(Mt," ").trim();return m[0]})(e);be[a]=we(s?{["@keyframes "+a]:l}:l,n?"":"."+a)}let c=n&&be.g;return n&&(be.g=be[a]),((l,u,d,f)=>{f?u.data=u.data.replace(f,l):u.data.indexOf(l)===-1&&(u.data=d?l+u.data:u.data+l)})(be[a],t,r,c),a},Sr=(e,t,n)=>e.reduce((r,s,i)=>{let a=t[i];if(a&&a.call){let c=a(n),l=c&&c.props&&c.props.className||/^go/.test(c)&&c;a=l?"."+l:c&&typeof c=="object"?c.props?"":we(c,""):c===!1?"":c}return r+s+(a??"")},"");function nt(e){let t=this||{},n=e.call?e(t.p):e;return kr(n.unshift?n.raw?Sr(n,[].slice.call(arguments,1),t.p):n.reduce((r,s)=>Object.assign(r,s&&s.call?s(t.p):s),{}):n,wr(t.target),t.g,t.o,t.k)}let vn,ht,pt;nt.bind({g:1});let ye=nt.bind({k:1});function Pr(e,t,n,r){we.p=t,vn=e,ht=n,pt=r}function Ee(e,t){let n=this||{};return function(){let r=arguments;function s(i,a){let c=Object.assign({},i),l=c.className||s.className;n.p=Object.assign({theme:ht&&ht()},c),n.o=/go\d/.test(l),c.className=nt.apply(n,r)+(l?" "+l:"");let u=e;return e[0]&&(u=c.as||e,delete c.as),pt&&u[0]&&pt(c),vn(u,c)}return s}}var Tr=e=>typeof e=="function",Ye=(e,t)=>Tr(e)?e(t):e,xr=(()=>{let e=0;return()=>(++e).toString()})(),yn=(()=>{let e;return()=>{if(e===void 0&&typeof window<"u"){let t=matchMedia("(prefers-reduced-motion: reduce)");e=!t||t.matches}return e}})(),Ir=20,xt="default",gn=(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 gn(e,{type:e.toasts.find(a=>a.id===r.id)?1:0,toast:r});case 3:let{toastId:s}=t;return{...e,toasts:e.toasts.map(a=>a.id===s||s===void 0?{...a,dismissed:!0,visible:!1}:a)};case 4:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(a=>a.id!==t.toastId)};case 5:return{...e,pausedAt:t.time};case 6:let i=t.time-(e.pausedAt||0);return{...e,pausedAt:void 0,toasts:e.toasts.map(a=>({...a,pauseDuration:a.pauseDuration+i}))}}},ze=[],bn={toasts:[],pausedAt:void 0,settings:{toastLimit:Ir}},de={},wn=(e,t=xt)=>{de[t]=gn(de[t]||bn,e),ze.forEach(([n,r])=>{n===t&&r(de[t])})},_n=e=>Object.keys(de).forEach(t=>wn(e,t)),Nr=e=>Object.keys(de).find(t=>de[t].toasts.some(n=>n.id===e)),rt=(e=xt)=>t=>{wn(t,e)},Cr={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},Or=(e={},t=xt)=>{let[n,r]=g(de[t]||bn),s=H(de[t]);w(()=>(s.current!==de[t]&&r(de[t]),ze.push([t,r]),()=>{let a=ze.findIndex(([c])=>c===t);a>-1&&ze.splice(a,1)}),[t]);let i=n.toasts.map(a=>{var c,l,u;return{...e,...e[a.type],...a,removeDelay:a.removeDelay||((c=e[a.type])==null?void 0:c.removeDelay)||e?.removeDelay,duration:a.duration||((l=e[a.type])==null?void 0:l.duration)||e?.duration||Cr[a.type],style:{...e.style,...(u=e[a.type])==null?void 0:u.style,...a.style}}});return{...n,toasts:i}},Ar=(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||xr()}),Fe=e=>(t,n)=>{let r=Ar(t,e,n);return rt(r.toasterId||Nr(r.id))({type:2,toast:r}),r.id},Q=(e,t)=>Fe("blank")(e,t);Q.error=Fe("error");Q.success=Fe("success");Q.loading=Fe("loading");Q.custom=Fe("custom");Q.dismiss=(e,t)=>{let n={type:3,toastId:e};t?rt(t)(n):_n(n)};Q.dismissAll=e=>Q.dismiss(void 0,e);Q.remove=(e,t)=>{let n={type:4,toastId:e};t?rt(t)(n):_n(n)};Q.removeAll=e=>Q.remove(void 0,e);Q.promise=(e,t,n)=>{let r=Q.loading(t.loading,{...n,...n?.loading});return typeof e=="function"&&(e=e()),e.then(s=>{let i=t.success?Ye(t.success,s):void 0;return i?Q.success(i,{id:r,...n,...n?.success}):Q.dismiss(r),s}).catch(s=>{let i=t.error?Ye(t.error,s):void 0;i?Q.error(i,{id:r,...n,...n?.error}):Q.dismiss(r)}),e};var Lr=1e3,Rr=(e,t="default")=>{let{toasts:n,pausedAt:r}=Or(e,t),s=H(new Map).current,i=K((f,m=Lr)=>{if(s.has(f))return;let h=setTimeout(()=>{s.delete(f),a({type:4,toastId:f})},m);s.set(f,h)},[]);w(()=>{if(r)return;let f=Date.now(),m=n.map(h=>{if(h.duration===1/0)return;let p=(h.duration||0)+h.pauseDuration-(f-h.createdAt);if(p<0){h.visible&&Q.dismiss(h.id);return}return setTimeout(()=>Q.dismiss(h.id,t),p)});return()=>{m.forEach(h=>h&&clearTimeout(h))}},[n,r,t]);let a=K(rt(t),[t]),c=K(()=>{a({type:5,time:Date.now()})},[a]),l=K((f,m)=>{a({type:1,toast:{id:f,height:m}})},[a]),u=K(()=>{r&&a({type:6,time:Date.now()})},[r,a]),d=K((f,m)=>{let{reverseOrder:h=!1,gutter:p=8,defaultPosition:_}=m||{},I=n.filter(y=>(y.position||_)===(f.position||_)&&y.height),S=I.findIndex(y=>y.id===f.id),v=I.filter((y,x)=>x<S&&y.visible).length;return I.filter(y=>y.visible).slice(...h?[v+1]:[0,v]).reduce((y,x)=>y+(x.height||0)+p,0)},[n]);return w(()=>{n.forEach(f=>{if(f.dismissed)i(f.id,f.removeDelay);else{let m=s.get(f.id);m&&(clearTimeout(m),s.delete(f.id))}})},[n,i]),{toasts:n,handlers:{updateHeight:l,startPause:c,endPause:u,calculateOffset:d}}},$r=ye`
|
|
3
|
+
from {
|
|
4
|
+
transform: scale(0) rotate(45deg);
|
|
5
|
+
opacity: 0;
|
|
6
|
+
}
|
|
7
|
+
to {
|
|
8
|
+
transform: scale(1) rotate(45deg);
|
|
9
|
+
opacity: 1;
|
|
10
|
+
}`,qr=ye`
|
|
11
|
+
from {
|
|
12
|
+
transform: scale(0);
|
|
13
|
+
opacity: 0;
|
|
14
|
+
}
|
|
15
|
+
to {
|
|
16
|
+
transform: scale(1);
|
|
17
|
+
opacity: 1;
|
|
18
|
+
}`,Dr=ye`
|
|
19
|
+
from {
|
|
20
|
+
transform: scale(0) rotate(90deg);
|
|
21
|
+
opacity: 0;
|
|
22
|
+
}
|
|
23
|
+
to {
|
|
24
|
+
transform: scale(1) rotate(90deg);
|
|
25
|
+
opacity: 1;
|
|
26
|
+
}`,jr=Ee("div")`
|
|
27
|
+
width: 20px;
|
|
28
|
+
opacity: 0;
|
|
29
|
+
height: 20px;
|
|
30
|
+
border-radius: 10px;
|
|
31
|
+
background: ${e=>e.primary||"#ff4b4b"};
|
|
32
|
+
position: relative;
|
|
33
|
+
transform: rotate(45deg);
|
|
34
|
+
|
|
35
|
+
animation: ${$r} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
|
|
36
|
+
forwards;
|
|
37
|
+
animation-delay: 100ms;
|
|
38
|
+
|
|
39
|
+
&:after,
|
|
40
|
+
&:before {
|
|
41
|
+
content: '';
|
|
42
|
+
animation: ${qr} 0.15s ease-out forwards;
|
|
43
|
+
animation-delay: 150ms;
|
|
44
|
+
position: absolute;
|
|
45
|
+
border-radius: 3px;
|
|
46
|
+
opacity: 0;
|
|
47
|
+
background: ${e=>e.secondary||"#fff"};
|
|
48
|
+
bottom: 9px;
|
|
49
|
+
left: 4px;
|
|
50
|
+
height: 2px;
|
|
51
|
+
width: 12px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&:before {
|
|
55
|
+
animation: ${Dr} 0.15s ease-out forwards;
|
|
56
|
+
animation-delay: 180ms;
|
|
57
|
+
transform: rotate(90deg);
|
|
58
|
+
}
|
|
59
|
+
`,Mr=ye`
|
|
60
|
+
from {
|
|
61
|
+
transform: rotate(0deg);
|
|
62
|
+
}
|
|
63
|
+
to {
|
|
64
|
+
transform: rotate(360deg);
|
|
65
|
+
}
|
|
66
|
+
`,Fr=Ee("div")`
|
|
67
|
+
width: 12px;
|
|
68
|
+
height: 12px;
|
|
69
|
+
box-sizing: border-box;
|
|
70
|
+
border: 2px solid;
|
|
71
|
+
border-radius: 100%;
|
|
72
|
+
border-color: ${e=>e.secondary||"#e0e0e0"};
|
|
73
|
+
border-right-color: ${e=>e.primary||"#616161"};
|
|
74
|
+
animation: ${Mr} 1s linear infinite;
|
|
75
|
+
`,Wr=ye`
|
|
76
|
+
from {
|
|
77
|
+
transform: scale(0) rotate(45deg);
|
|
78
|
+
opacity: 0;
|
|
79
|
+
}
|
|
80
|
+
to {
|
|
81
|
+
transform: scale(1) rotate(45deg);
|
|
82
|
+
opacity: 1;
|
|
83
|
+
}`,Br=ye`
|
|
84
|
+
0% {
|
|
85
|
+
height: 0;
|
|
86
|
+
width: 0;
|
|
87
|
+
opacity: 0;
|
|
88
|
+
}
|
|
89
|
+
40% {
|
|
90
|
+
height: 0;
|
|
91
|
+
width: 6px;
|
|
92
|
+
opacity: 1;
|
|
93
|
+
}
|
|
94
|
+
100% {
|
|
95
|
+
opacity: 1;
|
|
96
|
+
height: 10px;
|
|
97
|
+
}`,Ur=Ee("div")`
|
|
98
|
+
width: 20px;
|
|
99
|
+
opacity: 0;
|
|
100
|
+
height: 20px;
|
|
101
|
+
border-radius: 10px;
|
|
102
|
+
background: ${e=>e.primary||"#61d345"};
|
|
103
|
+
position: relative;
|
|
104
|
+
transform: rotate(45deg);
|
|
105
|
+
|
|
106
|
+
animation: ${Wr} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
|
|
107
|
+
forwards;
|
|
108
|
+
animation-delay: 100ms;
|
|
109
|
+
&:after {
|
|
110
|
+
content: '';
|
|
111
|
+
box-sizing: border-box;
|
|
112
|
+
animation: ${Br} 0.2s ease-out forwards;
|
|
113
|
+
opacity: 0;
|
|
114
|
+
animation-delay: 200ms;
|
|
115
|
+
position: absolute;
|
|
116
|
+
border-right: 2px solid;
|
|
117
|
+
border-bottom: 2px solid;
|
|
118
|
+
border-color: ${e=>e.secondary||"#fff"};
|
|
119
|
+
bottom: 6px;
|
|
120
|
+
left: 6px;
|
|
121
|
+
height: 10px;
|
|
122
|
+
width: 6px;
|
|
123
|
+
}
|
|
124
|
+
`,Hr=Ee("div")`
|
|
125
|
+
position: absolute;
|
|
126
|
+
`,Kr=Ee("div")`
|
|
127
|
+
position: relative;
|
|
128
|
+
display: flex;
|
|
129
|
+
justify-content: center;
|
|
130
|
+
align-items: center;
|
|
131
|
+
min-width: 20px;
|
|
132
|
+
min-height: 20px;
|
|
133
|
+
`,Qr=ye`
|
|
134
|
+
from {
|
|
135
|
+
transform: scale(0.6);
|
|
136
|
+
opacity: 0.4;
|
|
137
|
+
}
|
|
138
|
+
to {
|
|
139
|
+
transform: scale(1);
|
|
140
|
+
opacity: 1;
|
|
141
|
+
}`,Vr=Ee("div")`
|
|
142
|
+
position: relative;
|
|
143
|
+
transform: scale(0.6);
|
|
144
|
+
opacity: 0.4;
|
|
145
|
+
min-width: 20px;
|
|
146
|
+
animation: ${Qr} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275)
|
|
147
|
+
forwards;
|
|
148
|
+
`,zr=({toast:e})=>{let{icon:t,type:n,iconTheme:r}=e;return t!==void 0?typeof t=="string"?Y(Vr,null,t):t:n==="blank"?null:Y(Kr,null,Y(Fr,{...r}),n!=="loading"&&Y(Hr,null,n==="error"?Y(jr,{...r}):Y(Ur,{...r})))},Gr=e=>`
|
|
149
|
+
0% {transform: translate3d(0,${e*-200}%,0) scale(.6); opacity:.5;}
|
|
150
|
+
100% {transform: translate3d(0,0,0) scale(1); opacity:1;}
|
|
151
|
+
`,Jr=e=>`
|
|
152
|
+
0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;}
|
|
153
|
+
100% {transform: translate3d(0,${e*-150}%,-1px) scale(.6); opacity:0;}
|
|
154
|
+
`,Yr="0%{opacity:0;} 100%{opacity:1;}",Zr="0%{opacity:1;} 100%{opacity:0;}",Xr=Ee("div")`
|
|
155
|
+
display: flex;
|
|
156
|
+
align-items: center;
|
|
157
|
+
background: #fff;
|
|
158
|
+
color: #363636;
|
|
159
|
+
line-height: 1.3;
|
|
160
|
+
will-change: transform;
|
|
161
|
+
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1), 0 3px 3px rgba(0, 0, 0, 0.05);
|
|
162
|
+
max-width: 350px;
|
|
163
|
+
pointer-events: auto;
|
|
164
|
+
padding: 8px 10px;
|
|
165
|
+
border-radius: 8px;
|
|
166
|
+
`,eo=Ee("div")`
|
|
167
|
+
display: flex;
|
|
168
|
+
justify-content: center;
|
|
169
|
+
margin: 4px 10px;
|
|
170
|
+
color: inherit;
|
|
171
|
+
flex: 1 1 auto;
|
|
172
|
+
white-space: pre-line;
|
|
173
|
+
`,to=(e,t)=>{let n=e.includes("top")?1:-1,[r,s]=yn()?[Yr,Zr]:[Gr(n),Jr(n)];return{animation:t?`${ye(r)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${ye(s)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},no=sr(({toast:e,position:t,style:n,children:r})=>{let s=e.height?to(e.position||t||"top-center",e.visible):{opacity:0},i=Y(zr,{toast:e}),a=Y(eo,{...e.ariaProps},Ye(e.message,e));return Y(Xr,{className:e.className,style:{...s,...n,...e.style}},typeof r=="function"?r({icon:i,message:a}):Y(Z,null,i,a))});Pr(Y);var ro=({id:e,className:t,style:n,onHeightUpdate:r,children:s})=>{let i=K(a=>{if(a){let c=()=>{let l=a.getBoundingClientRect().height;r(e,l)};c(),new MutationObserver(c).observe(a,{subtree:!0,childList:!0,characterData:!0})}},[e,r]);return Y("div",{ref:i,className:t,style:n},s)},oo=(e,t)=>{let n=e.includes("top"),r=n?{top:0}:{bottom:0},s=e.includes("center")?{justifyContent:"center"}:e.includes("right")?{justifyContent:"flex-end"}:{};return{left:0,right:0,display:"flex",position:"absolute",transition:yn()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${t*(n?1:-1)}px)`,...r,...s}},so=nt`
|
|
174
|
+
z-index: 9999;
|
|
175
|
+
> * {
|
|
176
|
+
pointer-events: auto;
|
|
177
|
+
}
|
|
178
|
+
`,Be=16,En=({reverseOrder:e,position:t="top-center",toastOptions:n,gutter:r,children:s,toasterId:i,containerStyle:a,containerClassName:c})=>{let{toasts:l,handlers:u}=Rr(n,i);return Y("div",{"data-rht-toaster":i||"",style:{position:"fixed",zIndex:9999,top:Be,left:Be,right:Be,bottom:Be,pointerEvents:"none",...a},className:c,onMouseEnter:u.startPause,onMouseLeave:u.endPause},l.map(d=>{let f=d.position||t,m=u.calculateOffset(d,{reverseOrder:e,gutter:r,defaultPosition:t}),h=oo(f,m);return Y(ro,{id:d.id,key:d.id,onHeightUpdate:u.updateHeight,className:d.visible?so:"",style:h},d.type==="custom"?Ye(d.message,d):s?s(d):Y(no,{toast:d,position:f}))}))},T=Q;function ot(e){const t={subscribe(n){let r=null,s=!1,i=!1,a=!1;function c(){if(r===null){a=!0;return}i||(i=!0,typeof r=="function"?r():r&&r.unsubscribe())}return r=e({next(l){var u;s||(u=n.next)===null||u===void 0||u.call(n,l)},error(l){var u;s||(s=!0,(u=n.error)===null||u===void 0||u.call(n,l),c())},complete(){var l;s||(s=!0,(l=n.complete)===null||l===void 0||l.call(n),c())}}),a&&c(),{unsubscribe:c}},pipe(...n){return n.reduce(io,t)}};return t}function io(e,t){return t(e)}function ao(e){const t=new AbortController;return new Promise((n,r)=>{let s=!1;function i(){s||(s=!0,a.unsubscribe())}t.signal.addEventListener("abort",()=>{r(t.signal.reason)});const a=e.subscribe({next(c){s=!0,n(c),i()},error(c){r(c)},complete(){t.abort(),i()}})})}function co(e){return t=>{let n=0,r=null;const s=[];function i(){r||(r=t.subscribe({next(c){for(const u of s){var l;(l=u.next)===null||l===void 0||l.call(u,c)}},error(c){for(const u of s){var l;(l=u.error)===null||l===void 0||l.call(u,c)}},complete(){for(const l of s){var c;(c=l.complete)===null||c===void 0||c.call(l)}}}))}function a(){if(n===0&&r){const c=r;r=null,c.unsubscribe()}}return ot(c=>(n++,s.push(c),i(),{unsubscribe(){n--,a();const l=s.findIndex(u=>u===c);l>-1&&s.splice(l,1)}}))}}function lo(e){let t=e;const n=[],r=a=>{t!==void 0&&a.next(t),n.push(a)},s=a=>{n.splice(n.indexOf(a),1)},i=ot(a=>(r(a),()=>{s(a)}));return i.next=a=>{if(t!==a){t=a;for(const c of n)c.next(a)}},i.get=()=>t,i}function uo(e){return ot(t=>{function n(r=0,s=e.op){const i=e.links[r];if(!i)throw new Error("No more links to execute - did you forget to add an ending link?");return i({op:s,next(a){return n(r+1,a)}})}return n().subscribe(t)})}function De(e){"@babel/helpers - typeof";return De=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},De(e)}function mo(e,t){if(De(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(De(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function fo(e){var t=mo(e,"string");return De(t)=="symbol"?t:t+""}function ne(e,t,n){return(t=fo(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ft(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function V(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ft(Object(n),!0).forEach(function(r){ne(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ft(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function _e(e){return!!e&&!Array.isArray(e)&&typeof e=="object"}function ho(e){return typeof e=="function"}function po(){return Object.create(null)}const vo=typeof Symbol=="function"&&!!Symbol.asyncIterator;function yo(e){return vo&&_e(e)&&Symbol.asyncIterator in e}const go=e=>e(),kn=()=>{},Wt=e=>{Object.freeze&&Object.freeze(e)};function Sn(e,t,n){var r;const s=t.join(".");return(r=n[s])!==null&&r!==void 0||(n[s]=new Proxy(kn,{get(i,a){if(!(typeof a!="string"||a==="then"))return Sn(e,[...t,a],n)},apply(i,a,c){const l=t[t.length-1];if(l==="valueOf"||l==="toString"||l==="toJSON")return`tRPC.proxy(${t.slice(0,-1).join(".")})`;let u={args:c,path:t};return l==="call"?u={args:c.length>=2?[c[1]]:[],path:t.slice(0,-1)}:l==="apply"&&(u={args:c.length>=2?c[1]:[],path:t.slice(0,-1)}),Wt(u.args),Wt(u.path),e(u)}})),n[s]}const Pn=e=>Sn(e,[],po()),bo=e=>new Proxy(kn,{get(t,n){if(n!=="then")return e(n)}});function je(e){"@babel/helpers - typeof";return je=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},je(e)}function wo(e,t){if(je(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(je(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function _o(e){var t=wo(e,"string");return je(t)=="symbol"?t:t+""}function vt(e,t,n){return(t=_o(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Bt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Ue(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Bt(Object(n),!0).forEach(function(r){vt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bt(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Eo=class extends Error{constructor(e){super(ko(e)),Object.assign(this,e)}};function ko(e){if("message"in e)return String(e.message)}function So(e){if(e instanceof Error)return e;const t=typeof e;if(!(t==="undefined"||t==="function"||e===null)){if(t!=="object")return new Error(String(e));if(_e(e))return new Eo(e)}}var Ut=class extends Error{constructor(e){var t,n,r;const s=So(e.cause),i=(t=(n=e.message)!==null&&n!==void 0?n:s?.message)!==null&&t!==void 0?t:e.code;super(i,{cause:s}),vt(this,"cause",void 0),vt(this,"code",void 0),this.code=e.code,this.name="TRPCError",(r=this.cause)!==null&&r!==void 0||(this.cause=s)}};function Po(e,t){if("error"in e){const n=t.deserialize(e.error);return{ok:!1,error:Ue(Ue({},e),{},{error:n})}}return{ok:!0,result:Ue(Ue({},e.result),(!e.result.type||e.result.type==="data")&&{type:"data",data:t.deserialize(e.result.data)})}}var at=class extends Error{constructor(){super("Unable to transform response from server")}};function To(e,t){let n;try{n=Po(e,t)}catch{throw new at}if(!n.ok&&(!_e(n.error.error)||typeof n.error.error.code!="number"))throw new at;if(n.ok&&!_e(n.result))throw new at;return n}function xo(e){return typeof e=="function"}async function Io(e,t){const{_def:n}=e;let r=n.procedures[t];for(;!r;){const s=Object.keys(n.lazy).find(i=>t===i||t.startsWith(i+"."));if(!s)return null;await n.lazy[s].load(),r=n.procedures[t]}return r}async function No(e){const{type:t,path:n}=e,r=await Io(e.router,n);if(!r||!xo(r)||r._def.type!==t&&!e.allowMethodOverride)throw new Ut({code:"NOT_FOUND",message:`No "${t}"-procedure on path "${n}"`});if(r._def.type!==t&&e.allowMethodOverride&&r._def.type==="subscription")throw new Ut({code:"METHOD_NOT_SUPPORTED",message:"Method override is not supported for subscriptions"});return r(e)}function Co(e){return e instanceof Ze}function Oo(e){return _e(e)&&_e(e.error)&&typeof e.error.code=="number"&&typeof e.error.message=="string"}function Ao(e,t){return typeof e=="string"?e:_e(e)&&typeof e.message=="string"?e.message:t}var Ze=class Ge extends Error{constructor(t,n){var r,s;const i=n?.cause;super(t,{cause:i}),ne(this,"cause",void 0),ne(this,"shape",void 0),ne(this,"data",void 0),ne(this,"meta",void 0),this.meta=n?.meta,this.cause=i,this.shape=n==null||(r=n.result)===null||r===void 0?void 0:r.error,this.data=n==null||(s=n.result)===null||s===void 0?void 0:s.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,Ge.prototype)}static from(t,n={}){const r=t;return Co(r)?(n.meta&&(r.meta=V(V({},r.meta),n.meta)),r):Oo(r)?new Ge(r.error.message,V(V({},n),{},{result:r,cause:n.cause})):new Ge(Ao(r,"Unknown error"),V(V({},n),{},{cause:r}))}};function Lo(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 Ht=e=>typeof e=="function";function Ro(e){if(e)return e;if(typeof window<"u"&&Ht(window.fetch))return window.fetch.bind(window);if(typeof globalThis<"u"&&Ht(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}function $o(...e){const t=new AbortController,n=e.length;let r=0;const s=()=>{++r===n&&t.abort()};for(const i of e)i?.aborted?s():i?.addEventListener("abort",s,{once:!0});return t.signal}function qo(...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 Do(e){return{url:e.url.toString(),fetch:e.fetch,transformer:Lo(e.transformer),methodOverride:e.methodOverride}}function jo(e){const t={};for(let n=0;n<e.length;n++){const r=e[n];t[n]=r}return t}const Mo={query:"GET",mutation:"POST",subscription:"PATCH"};function Tn(e){return"input"in e?e.transformer.input.serialize(e.input):jo(e.inputs.map(t=>e.transformer.input.serialize(t)))}const xn=e=>{const t=e.url.split("?");let n=t[0].replace(/\/$/,"")+"/"+e.path;const r=[];if(t[1]&&r.push(t[1]),"inputs"in e&&r.push("batch=1"),e.type==="query"||e.type==="subscription"){const s=Tn(e);s!==void 0&&e.methodOverride!=="POST"&&r.push(`input=${encodeURIComponent(JSON.stringify(s))}`)}return r.length&&(n+="?"+r.join("&")),n},Fo=e=>{if(e.type==="query"&&e.methodOverride!=="POST")return;const t=Tn(e);return t!==void 0?JSON.stringify(t):void 0},Wo=e=>Ko(V(V({},e),{},{contentTypeHeader:"application/json",getUrl:xn,getBody:Fo}));var Bo=class extends Error{constructor(){const e="AbortError";super(e),this.name=e,this.message=e}};const Uo=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 Bo};async function Ho(e){var t,n;Uo(e.signal);const r=e.getUrl(e),s=e.getBody(e),i=(t=e.methodOverride)!==null&&t!==void 0?t:Mo[e.type],a=await(async()=>{const l=await e.headers();return Symbol.iterator in l?Object.fromEntries(l):l})(),c=V(V(V({},e.contentTypeHeader&&i!=="GET"?{"content-type":e.contentTypeHeader}:{}),e.trpcAcceptHeader?{[(n=e.trpcAcceptHeaderKey)!==null&&n!==void 0?n:"trpc-accept"]:e.trpcAcceptHeader}:void 0),a);return Ro(e.fetch)(r,{method:i,signal:e.signal,body:s,headers:c})}async function Ko(e){const t={},n=await Ho(e);t.response=n;const r=await n.json();return t.responseJSON=r,{json:r,meta:t}}const Kt=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function Qt(e){let t=null,n=null;const r=()=>{clearTimeout(n),n=null,t=null};function s(c){const l=[[]];let u=0;for(;;){const m=c[u];if(!m)break;const h=l[l.length-1];if(m.aborted){var d;(d=m.reject)===null||d===void 0||d.call(m,new Error("Aborted")),u++;continue}if(e.validate(h.concat(m).map(p=>p.key))){h.push(m),u++;continue}if(h.length===0){var f;(f=m.reject)===null||f===void 0||f.call(m,new Error("Input is too big for a single dispatch")),u++;continue}l.push([])}return l}function i(){const c=s(t);r();for(const l of c){if(!l.length)continue;const u={items:l};for(const d of l)d.batch=u;e.fetch(u.items.map(d=>d.key)).then(async d=>{await Promise.all(d.map(async(m,h)=>{const p=u.items[h];try{var _;const S=await Promise.resolve(m);(_=p.resolve)===null||_===void 0||_.call(p,S)}catch(S){var I;(I=p.reject)===null||I===void 0||I.call(p,S)}p.batch=null,p.reject=null,p.resolve=null}));for(const m of u.items){var f;(f=m.reject)===null||f===void 0||f.call(m,new Error("Missing result")),m.batch=null}}).catch(d=>{for(const m of u.items){var f;(f=m.reject)===null||f===void 0||f.call(m,d),m.batch=null}})}}function a(c){var l;const u={aborted:!1,key:c,batch:null,resolve:Kt,reject:Kt},d=new Promise((f,m)=>{var h;u.reject=m,u.resolve=f,(h=t)!==null&&h!==void 0||(t=[]),t.push(u)});return(l=n)!==null&&l!==void 0||(n=setTimeout(i)),d}return{load:a}}function Qo(e){var t,n;const r=Do(e),s=(t=e.maxURLLength)!==null&&t!==void 0?t:1/0,i=(n=e.maxItems)!==null&&n!==void 0?n:1/0;return()=>{const a=l=>({validate(u){if(s===1/0&&i===1/0)return!0;if(u.length>i)return!1;const d=u.map(m=>m.path).join(","),f=u.map(m=>m.input);return xn(V(V({},r),{},{type:l,path:d,inputs:f,signal:null})).length<=s},async fetch(u){const d=u.map(p=>p.path).join(","),f=u.map(p=>p.input),m=$o(...u.map(p=>p.signal)),h=await Wo(V(V({},r),{},{path:d,inputs:f,type:l,headers(){return e.headers?typeof e.headers=="function"?e.headers({opList:u}):e.headers:{}},signal:m}));return(Array.isArray(h.json)?h.json:u.map(()=>h.json)).map(p=>({meta:h.meta,json:p}))}}),c={query:Qt(a("query")),mutation:Qt(a("mutation"))};return({op:l})=>ot(u=>{if(l.type==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");const d=new AbortController,f=c[l.type].load(V(V({},l),{},{signal:qo(l.signal,d.signal)}));let m=!1,h;return f.then(p=>{m=!0,h=p;const _=To(p.json,r.transformer.output);if(!_.ok){u.error(Ze.from(_.error,{meta:p.meta}));return}u.next({context:p.meta,result:_.result}),u.complete()}).catch(p=>{m=!0,u.error(Ze.from(p,{meta:h?.meta}))}),()=>{m||d.abort()}})}}const In=(e,...t)=>typeof e=="function"?e(...t):e;function Vo(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}async function zo(e){const t=await In(e.url);return e.connectionParams?t+`${t.includes("?")?"&":"?"}connectionParams=1`:t}async function Go(e,t){const n={method:"connectionParams",data:await In(e)};return t.encode(n)}function Jo(e){const{promise:t,resolve:n,reject:r}=Vo();return e.addEventListener("open",()=>{e.removeEventListener("error",r),n()}),e.addEventListener("error",r),t}function Yo(e,{intervalMs:t,pongTimeoutMs:n}){let r,s;function i(){r=setTimeout(()=>{e.send("PING"),s=setTimeout(()=>{e.close()},n)},t)}function a(){clearTimeout(r),i()}function c(){clearTimeout(s),a()}e.addEventListener("open",i),e.addEventListener("message",({data:l})=>{clearTimeout(r),i(),l==="PONG"&&c()}),e.addEventListener("close",()=>{clearTimeout(r),clearTimeout(s)})}var Zo=class yt{constructor(t){var n;if(ne(this,"id",++yt.connectCount),ne(this,"WebSocketPonyfill",void 0),ne(this,"urlOptions",void 0),ne(this,"keepAliveOpts",void 0),ne(this,"encoder",void 0),ne(this,"wsObservable",lo(null)),ne(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=++yt.connectCount;const t=zo(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&&Yo(n,this.keepAliveOpts),n.addEventListener("close",()=>{this.ws===n&&(this.ws=null)}),await Jo(n),this.urlOptions.connectionParams&&n.send(await Go(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()}}};ne(Zo,"connectCount",0);var Nn=class{constructor(e){ne(this,"links",void 0),ne(this,"runtime",void 0),ne(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=e.links.map(t=>t(this.runtime))}$request(e){var t;return uo({links:this.links,op:V(V({},e),{},{context:(t=e.context)!==null&&t!==void 0?t:{},id:++this.requestId})}).pipe(co())}async requestAsPromise(e){try{const t=this.$request(e);return(await ao(t)).result.data}catch(t){throw Ze.from(t)}}query(e,t,n){return this.requestAsPromise({type:"query",path:e,input:t,context:n?.context,signal:n?.signal})}mutation(e,t,n){return this.requestAsPromise({type:"mutation",path:e,input:t,context:n?.context,signal:n?.signal})}subscription(e,t,n){return this.$request({type:"subscription",path:e,input:t,context:n.context,signal:n.signal}).subscribe({next(r){switch(r.result.type){case"state":var s;(s=n.onConnectionStateChange)===null||s===void 0||s.call(n,r.result);break;case"started":var i;(i=n.onStarted)===null||i===void 0||i.call(n,{context:r.context});break;case"stopped":var a;(a=n.onStopped)===null||a===void 0||a.call(n);break;case"data":case void 0:var c;(c=n.onData)===null||c===void 0||c.call(n,r.result.data)}},error(r){var s;(s=n.onError)===null||s===void 0||s.call(n,r)},complete(){var r;(r=n.onComplete)===null||r===void 0||r.call(n)}})}};const Cn=Symbol.for("trpc_untypedClient"),Xo={query:"query",mutate:"mutation",subscribe:"subscription"},es=e=>Xo[e];function ts(e){const t=Pn(({path:n,args:r})=>{const s=[...n],i=es(s.pop()),a=s.join(".");return e[i](a,...r)});return bo(n=>n===Cn?e:t[n])}function ns(e){return ts(new Nn(e))}function rs(e){return e[Cn]}function Me(e){"@babel/helpers - typeof";return Me=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Me(e)}function os(e,t){if(Me(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Me(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ss(e){var t=os(e,"string");return Me(t)=="symbol"?t:t+""}function is(e,t,n){return(t=ss(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Vt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function L(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Vt(Object(n),!0).forEach(function(r){is(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vt(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function as(e){var t,n,r,s=2;for(typeof Symbol<"u"&&(n=Symbol.asyncIterator,r=Symbol.iterator);s--;){if(n&&(t=e[n])!=null)return t.call(e);if(r&&(t=e[r])!=null)return new Je(t.call(e));n="@@asyncIterator",r="@@iterator"}throw new TypeError("Object is not async iterable")}function Je(e){function t(n){if(Object(n)!==n)return Promise.reject(new TypeError(n+" is not an object."));var r=n.done;return Promise.resolve(n.value).then(function(s){return{value:s,done:r}})}return Je=function(r){this.s=r,this.n=r.next},Je.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(r){var s=this.s.return;return s===void 0?Promise.resolve({value:r,done:!0}):t(s.apply(this.s,arguments))},throw:function(r){var s=this.s.return;return s===void 0?Promise.reject(r):t(s.apply(this.s,arguments))}},new Je(e)}function cs(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 ls(e,t){if(e==null)return{};var n,r,s=cs(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}const us=["cursor","direction"];function st(e){return{path:e.path.join(".")}}function ds(e){return e.length>=3}function ms(e){return ds(e)?{type:"prefixed",prefix:e[0],path:e[1],args:e[2]}:{type:"unprefixed",prefix:void 0,path:e[0],args:e[1]}}function It(e,t,n){var r;const s=ms(e);let i=(r=s.args)===null||r===void 0?void 0:r.input;if(n){var a,c;i=L(L(L({},(a=(c=s.args)===null||c===void 0?void 0:c.input)!==null&&a!==void 0?a:{}),n.pageParam!==void 0?{cursor:n.pageParam}:{}),{},{direction:n.direction})}return[s.path.join("."),i,t?.trpc]}async function fs(e,t,n){const r=t.getQueryCache().build(t,{queryKey:n});r.setState({data:[],status:"success"});const s=[];var i=!1,a=!1,c;try{for(var l=as(e),u;i=!(u=await l.next()).done;i=!1){const d=u.value;s.push(d),r.setState({data:[...s]})}}catch(d){a=!0,c=d}finally{try{i&&l.return!=null&&await l.return()}finally{if(a)throw c}}return s}function pe(e){const t=go(()=>{const{input:n,type:r}=e,s=e.path.flatMap(i=>i.split("."));if(!n&&r==="any")return s.length?[s]:[];if(r==="infinite"&&_e(n)&&("direction"in n||"cursor"in n)){const{cursor:i,direction:a}=n;return[s,{input:ls(n,us),type:"infinite"}]}return[s,L(L({},typeof n<"u"&&n!==Pe&&{input:n}),r&&r!=="any"&&{type:r})]});return e.prefix&&t.unshift([e.prefix]),t}function On(e){const t=[e.path.flatMap(n=>n.split("."))];return e.prefix&&t.unshift([e.prefix]),t}function Nt(e){return ho(e)?e():e}function hs(e){var t;const{input:n,query:r,path:s,queryKey:i,opts:a}=e,c=n===Pe,l=async u=>{var d;const f=L(L({},a),{},{trpc:L(L({},a?.trpc),!(a==null||(d=a.trpc)===null||d===void 0)&&d.abortOnUnmount?{signal:u.signal}:{signal:null})});return await r(...It(i,f,{direction:u.direction,pageParam:u.pageParam}))};return Object.assign(fr(L(L({},a??{}),{},{queryKey:i,queryFn:c?Pe:l,initialPageParam:(t=a?.initialCursor)!==null&&t!==void 0?t:n?.cursor})),{trpc:st({path:s})})}function ps(e){var t,n;const{mutate:r,path:s,prefix:i,opts:a,overrides:c}=e,l=Nt(e.queryClient),u=On({path:s,prefix:(t=a?.keyPrefix)!==null&&t!==void 0?t:i}),d=l.defaultMutationOptions(l.getMutationDefaults(u)),f=(n=c?.onSuccess)!==null&&n!==void 0?n:(h=>h.originalFn()),m=async h=>await r(...It([...u,{input:h}],a));return L(L({},a),{},{mutationKey:u,mutationFn:m,onSuccess(...h){var p,_;return f({originalFn:()=>{var S,v,y;return(S=a==null||(v=a.onSuccess)===null||v===void 0?void 0:v.call(a,...h))!==null&&S!==void 0?S:d==null||(y=d.onSuccess)===null||y===void 0?void 0:y.call(d,...h)},queryClient:l,meta:(p=(_=a?.meta)!==null&&_!==void 0?_:d?.meta)!==null&&p!==void 0?p:{}})},trpc:st({path:s})})}function vs(e){const{input:t,query:n,path:r,queryKey:s,opts:i}=e,a=Nt(e.queryClient),c=t===Pe,l=async u=>{var d;const f=L(L({},i),{},{trpc:L(L({},i?.trpc),!(i==null||(d=i.trpc)===null||d===void 0)&&d.abortOnUnmount?{signal:u.signal}:{signal:null})}),m=u.queryKey,h=await n(...It(m,f));return yo(h)?fs(h,a,m):h};return Object.assign(hr(L(L({},i),{},{queryKey:s,queryFn:c?Pe:l})),{trpc:st({path:r})})}const ys=e=>{const{subscribe:t,path:n,queryKey:r,input:s,opts:i={}}=e,a="enabled"in i?!!i.enabled:s!==Pe,c=l=>t(n.join("."),s===Pe?void 0:s,l);return L(L({},i),{},{enabled:a,subscribe:c,queryKey:r,trpc:st({path:n})})};function gs(e){const t=e.keyPrefix,n=r=>(s,i,a)=>"router"in e?Promise.resolve(Nt(e.ctx)).then(c=>No({router:e.router,path:s,getRawInput:async()=>i,ctx:c,type:r,signal:void 0,batchIndex:0})):(e.client instanceof Nn?e.client:rs(e.client))[r](s,i,a);return Pn(({args:r,path:s})=>{const i=[...s],a=i.pop(),[c,l]=r;return{"~types":void 0,pathKey:()=>pe({path:i,type:"any",prefix:t}),pathFilter:()=>L(L({},c),{},{queryKey:pe({path:i,type:"any",prefix:t})}),queryOptions:()=>vs({input:c,opts:l,path:i,queryClient:e.queryClient,queryKey:pe({path:i,input:c,type:"query",prefix:t}),query:n("query")}),queryKey:()=>pe({path:i,input:c,type:"query",prefix:t}),queryFilter:()=>L(L({},l),{},{queryKey:pe({path:i,input:c,type:"query",prefix:t})}),infiniteQueryOptions:()=>hs({input:c,opts:l,path:i,queryKey:pe({path:i,input:c,type:"infinite",prefix:t}),query:n("query")}),infiniteQueryKey:()=>pe({path:i,input:c,type:"infinite",prefix:t}),infiniteQueryFilter:()=>L(L({},l),{},{queryKey:pe({path:i,input:c,type:"infinite",prefix:t})}),mutationOptions:()=>{var u;return ps({opts:c,path:i,prefix:t,queryClient:e.queryClient,mutate:n("mutation"),overrides:(u=e.overrides)===null||u===void 0?void 0:u.mutations})},mutationKey:()=>On({path:i,prefix:t}),subscriptionOptions:()=>ys({opts:l,path:i,input:c,queryKey:pe({path:i,input:c,type:"any",prefix:t}),subscribe:n("subscription")})}[a]()})}function bs(){const e=fe(null),t=fe(null),n=i=>{const a=Ce(()=>gs({client:i.trpcClient,queryClient:i.queryClient,keyPrefix:i.keyPrefix}),[i.trpcClient,i.queryClient,i.keyPrefix]);return Y(e.Provider,{value:i.trpcClient},Y(t.Provider,{value:a},i.children))};n.displayName="TRPCProvider";function r(){const i=he(t);if(!i)throw new Error("useTRPC() can only be used inside of a <TRPCProvider>");return i}function s(){const i=he(e);if(!i)throw new Error("useTRPCClient() can only be used inside of a <TRPCProvider>");return i}return{TRPCProvider:n,useTRPC:r,useTRPCClient:s}}const gt={lan:new Set,animepahe:new Set,jasmr:new Set};function Se(e){for(const t of[...gt[e]])try{t()}catch(n){console.error(`auth-bus listener failed (${e}):`,n)}}function An(e,t){return gt[e].add(t),()=>{gt[e].delete(t)}}let Xe="default";function Ln(){return Xe}function ws(e){Xe=e}const _s=new Set(["playerVideoDelayMs","playerVideoDelayEnabled","anime4kEnabled"]);function He(e){return Xe==="default"||_s.has(e)?e:`dango:profile:${Xe}:${e}`}const z={keyFor:He,getItem:e=>localStorage.getItem(He(e)),setItem:(e,t)=>localStorage.setItem(He(e),t),removeItem:e=>localStorage.removeItem(He(e))};function Es(){localStorage.setItem("dango:profile-session-change",`${Date.now()}-${Math.random()}`),window.location.assign("/")}const ks=(e,t)=>new Promise((n,r)=>{t?.throwIfAborted();const s=()=>{clearTimeout(i),r(t?.reason)},i=setTimeout(()=>{t?.removeEventListener("abort",s),n()},e);t?.addEventListener("abort",s,{once:!0})}),Ct=async(e,t)=>{const n=e instanceof Request?e:void 0,r=new Headers(n?.headers);(!t?.body||!(t.body instanceof FormData))&&r.set("Content-Type","application/json");const s=n?.url??e.toString(),i=s.startsWith("/")&&!s.startsWith("//")||typeof window<"u"&&new URL(s,window.location.origin).origin===window.location.origin;if(i){!s.includes("/api/profiles/status")&&!s.includes("/api/profiles/login")&&!s.includes("/api/auth/app-")&&r.set("x-dango-profile-id",Ln());let f=z.getItem("animepahe_ua"),m=z.getItem("animepahe_cookie");m&&f&&f!==navigator.userAgent&&(z.removeItem("animepahe_cookie"),z.removeItem("animepahe_ua"),m=null,f=null,T.error("Your browser changed. Verify AnimePahe again to refresh its cookie."),Se("animepahe"));const h=z.getItem("jasmr_ua"),p=z.getItem("jasmr_cookie");f&&r.set("x-animepahe-ua",f),m&&r.set("x-animepahe-cookie",m),h&&r.set("x-jasmr-ua",h),p&&r.set("x-jasmr-cookie",p)}new Headers(t?.headers).forEach((f,m)=>r.set(m,f));const a={...t,headers:r},c=(t?.method??n?.method??"GET").toUpperCase(),l=t?.signal??n?.signal,u=i&&(c==="GET"||c==="HEAD");let d=await fetch(e,a);i&&d.status===409&&(await d.clone().json().catch(()=>null))?.error==="PROFILE_CHANGED"&&window.location.reload(),i&&d.status===401&&!s.includes("/api/profiles/")&&(await d.clone().json().catch(()=>null))?.error==="PROFILE_AUTH_REQUIRED"&&window.dispatchEvent(new Event("dango:profile-auth-required"));for(let f=0;u&&d.status===503&&d.headers.get("x-dango-not-ready")==="1"&&f<3;f++)await d.body?.cancel(),await ks(500*2**f,l),d=await fetch(e,a);return d},qe=async(e,t)=>{const n=await Ct(e,t);if(!n.ok){const r=await n.text().catch(()=>"");let s={};try{s=JSON.parse(r)}catch{}const i=typeof s.error=="string"?s.error:"";throw n.status===403&&i==="AUTH_REQUIRED"&&s.provider==="animepahe"&&Se("animepahe"),n.status===403&&i==="AUTH_REQUIRED"&&s.provider==="jasmr"&&Se("jasmr"),n.status===401&&i==="LAN_AUTH_REQUIRED"&&Se("lan"),new Error(i||`Failed to fetch from ${e}`)}return n.json()};async function Ss(e,t){const n=await Ct(e,t);if(n.status===401)try{(await n.clone().json())?.error==="LAN_AUTH_REQUIRED"&&Se("lan")}catch{}return await Ps(n),n}async function Ps(e){try{if(!e.headers.get("content-type")?.includes("json"))return;const t=await e.clone().json(),n=Array.isArray(t)?t:[t];for(const r of n){const s=r?.error;if(!s||typeof s!="object")continue;const i=s.data?.cause;(s.message==="AUTH_REQUIRED"||i?.code==="AUTH_REQUIRED")&&(i?.provider==="animepahe"||i?.provider==="jasmr")&&Se(i.provider),(s.message==="LAN_AUTH_REQUIRED"||i?.code==="LAN_AUTH_REQUIRED")&&Se("lan")}}catch{}}const{TRPCProvider:Ts,useTRPC:q}=bs(),ae=ns({links:[Qo({url:"/api/trpc",fetch:Ss})]}),Oe=new Map,xs=500,Is=(e,t,n)=>{if(!e||e.trim()==="")return"/placeholder.svg";if(e.includes("/api/image-proxy")){let a=e;if(t&&!a.includes("w=")){const c=a.includes("?")?"&":"?";a+=`${c}w=${t}`}if(n&&!a.includes("h=")){const c=a.includes("?")?"&":"?";a+=`${c}h=${n}`}return a}let r=e;r.includes("aln.youtube-anime.com")&&(r=r.replace(/https?:\/\/allanime\.day\/aln\.youtube-anime\.com/,"https://aln.youtube-anime.com"),r.includes("/images/mcovers")&&(r=r.replace("/images/mcovers","/mcovers")),r.includes("/images/images2")&&(r=r.replace("/images/images2","/images2"))),r.includes("allanime.day/s4.anilist.co")&&(r=r.replace(/https?:\/\/allanime\.day\/s4\.anilist\.co/,"https://s4.anilist.co")),r.includes("wp.youtube-anime.com/s4.anilist.co")&&(r=r.replace(/https?:\/\/wp\.youtube-anime\.com\/s4\.anilist\.co/,"https://s4.anilist.co"));const s=`${r}-${t}-${n}`;if(Oe.has(s))return Oe.get(s);let i;if(r.startsWith("https://s4.anilist.co"))i=r,t&&(i+=`${i.includes("?")?"&":"?"}w=${t}`),n&&(i+=`${i.includes("?")?"&":"?"}h=${n}`);else if(r.includes("animepahe")){i=`/api/image-proxy?url=${encodeURIComponent(r)}`;const a=z.getItem("animepahe_cookie"),c=z.getItem("animepahe_ua");a&&(i+=`&cookie=${encodeURIComponent(a)}`),c&&(i+=`&ua=${encodeURIComponent(c)}`)}else if(r.startsWith("http"))i=`/api/image-proxy?url=${encodeURIComponent(r)}`,t&&(i+=`&w=${t}`),n?i+=`&h=${n}`:t||(i+="&w=300");else{const c=`${r.startsWith("mcovers")||r.startsWith("images2")?"https://aln.youtube-anime.com":"https://aln.youtube-anime.com/images"}/${r}`;i=`/api/image-proxy?url=${encodeURIComponent(c)}`,t&&(i+=`&w=${t}`),n?i+=`&h=${n}`:t||(i+="&w=300")}return Oe.size>xs&&Oe.clear(),Oe.set(s,i),i},Bl=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 Ul(e){return e?e.replace(/<[^>]*>?/gm,"").replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").trim():""}function Hl(e){return e==null?e:e>10?Number((e/10).toFixed(1)):e}const Ns=(...e)=>e.filter(Boolean).join(" ");function Cs(e,t,n="..."){return e?e.length>t?e.slice(0,t)+n:e:""}const Rn=fe(void 0),Os=()=>{const e=he(Rn);if(e===void 0)throw new Error("useTitlePreference must be used within a TitlePreferenceProvider");return e},$={watchlist:"watchlist",continueWatching:"allContinueWatching",queueRemaining:"queue-remaining",suggestedEpisode:"suggestedEpisode",trendingList:"trendingList",latestReleases:"latestReleases",thisWeekSchedule:"thisWeekSchedule",schedule:"schedule",genreCards:"genreCards",queue:"queue",playerData:"player-data",showData:"show-data",showMeta:"show-meta",videoSources:"video-sources",tvSources:"tv-sources",tvLibrary:"tv-library",tvContinueWatching:"tv-continue-watching",tvProgress:"tv-progress",mangaLibrary:"manga-library",mangaContinueReading:"manga-continue-reading",mangaProgress:"manga-progress",mangaBrowse:"mangaBrowse",mangaBrowseInfinite:"mangaBrowseInfinite",mangaDetail:"mangaDetail",mangaPages:"mangaPages",asmrLibrary:"asmr-library",asmrContinueListening:"asmr-continue-listening",asmrProgress:"asmr-progress",asmrBrowse:"asmrBrowse",asmrWork:"asmrWork",trackerStatus:"trackerStatus",anilistClientId:"anilistClientId",malClientConfig:"malClientConfig",notifications:"notifications",settings:"settings",insights:"insights",insightsRecommendations:"insights-recommendations",providers:"providers",syncProfile:"sync-profile"},Kl=()=>{const e=q(),t=re({...e.data.spotlight.queryOptions(),staleTime:1e3*60*5,retry:1});return{...t,data:t.data}},Ql=(e="TRENDING_DESC",t=10)=>Tt({queryKey:[$.trendingList,e,t],queryFn:({pageParam:n=1})=>ae.data.popularList.query({sort:e,page:n,size:t}),initialPageParam:1,getNextPageParam:(n,r)=>n.length>=t?r.length+1:void 0}),Vl=(e="TV",t=12)=>Tt({queryKey:[$.latestReleases,e,t],queryFn:({pageParam:n=1})=>ae.data.latestReleases.query({format:e,page:n,size:t}),initialPageParam:1,getNextPageParam:(n,r)=>n.length>=t?r.length+1:void 0}),zl=(e,t="TV",n=!0)=>{const r=q();return re({...r.data.seasonal.queryOptions({page:e,format:t}),enabled:n,staleTime:1e3*60*5})},As=["query","sortBy","type","status","season","year","country","genres","excludeGenres","excludeTags","minScore","minEpisodes","adult"],Gl=(e,t,n=14)=>{const r=q(),s=new URLSearchParams(e),i={page:t,limit:n};for(const a of As){const c=s.get(a);c!==null&&(i[a]=c)}return re({...r.data.search.queryOptions(i),enabled:e!=null})},Jl=()=>{const e=q();return re(e.queue.list.queryOptions())},Ls=()=>{const e=q(),t=X();return ie(e.queue.add.mutationOptions({onSuccess:n=>{n.queued?T.success("Added to queue"):T.success("Removed from queue"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[$.queueRemaining]})},onError:n=>{T.error(`Failed to update queue: ${n.message}`)}}))},Yl=()=>{const e=q(),t=X();return ie(e.queue.remove.mutationOptions({onSuccess:()=>{T.success("Removed from queue"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[$.queueRemaining]}),t.invalidateQueries({queryKey:[$.continueWatching]})},onError:n=>{T.error(`Failed to remove: ${n.message}`)}}))},Zl=(e,t=!0)=>re({queryKey:[$.queueRemaining,e],queryFn:()=>ae.watchlist.queueRemaining.query({showId:e}),enabled:!!e&&t,staleTime:1e3*60}),Xl=()=>{const e=q(),t=X();return ie(e.queue.addBatch.mutationOptions({onSuccess:(n,r)=>{const s=n.added??r.episodeNumbers.length;T.success(`${s} ${s===1?"episode":"episodes"} added to queue`),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[$.queueRemaining]})},onError:n=>{T.error(`Failed to update queue: ${n.message}`)}}))},eu=()=>{const e=q(),t=X();return ie(e.queue.removeMany.mutationOptions({onSuccess:()=>{T.success("Removed from queue"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[$.queueRemaining]}),t.invalidateQueries({queryKey:[$.continueWatching]})},onError:n=>{T.error(`Failed to remove: ${n.message}`)}}))},tu=()=>{const e=q(),t=X();return ie(e.queue.clear.mutationOptions({onSuccess:()=>{T.success("Queue cleared"),t.invalidateQueries(e.queue.pathFilter()),t.invalidateQueries({queryKey:[$.queueRemaining]}),t.invalidateQueries({queryKey:[$.continueWatching]})},onError:n=>{T.error(`Failed to clear queue: ${n.message}`)}}))},nu=()=>{const e=q(),t=X(),n=e.queue.list.queryOptions().queryKey;return ie(e.queue.reorder.mutationOptions({onMutate:async r=>{await t.cancelQueries({queryKey:n});const s=t.getQueryData(n);return t.setQueryData(n,i=>{if(!i)return i;const a=new Map(i.map(c=>[c.id,c]));return r.map((c,l)=>{const u=a.get(c.id??-1);return u?{...u,queue_order:l}:void 0}).filter(c=>!!c)}),{previousQueue:s}},onError:(r,s,i)=>{i?.previousQueue&&t.setQueryData(n,i.previousQueue)},onSettled:()=>{t.invalidateQueries(e.queue.pathFilter())}}))},Rs=["status","showMature","query","type","season","year","genres","excludeGenres","sortBy","titlePreference"];function Ot(e,t,n){const r=new URLSearchParams(e),s={page:t,limit:n};for(const i of Rs){const a=r.get(i);a!==null&&(s[i]=a)}return s}const ru=(e,t="",n,r=14)=>re({queryKey:[$.watchlist,e,t,n,r],queryFn:async()=>{const s=new URLSearchParams(t);return s.set("status",e),await ae.watchlist.list.query(Ot(s.toString(),n,r))}}),ou=(e="")=>Tt({queryKey:[$.continueWatching,e],queryFn:async({pageParam:t=1})=>await ae.watchlist.continueWatchingAll.query(Ot(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)})}),su=(e="",t,n=14)=>re({queryKey:[$.continueWatching,e,t,n],queryFn:async()=>await ae.watchlist.continueWatchingAll.query(Ot(e,t,n))}),iu=()=>{const e=q(),t=X();return ie(e.watchlist.remove.mutationOptions({onSuccess:()=>{T.success("Removed from watchlist"),t.invalidateQueries(e.watchlist.pathFilter()),t.invalidateQueries({queryKey:[$.watchlist]})},onError:n=>{T.error(`Failed to remove: ${n.message}`)}}))},au=()=>{const e=q(),t=X();return ie(e.watchlist.batchStatus.mutationOptions({onSuccess:n=>{T.success(`Status updated for ${n.updated??0} items`),t.invalidateQueries(e.watchlist.pathFilter()),t.invalidateQueries({queryKey:[$.watchlist]}),t.invalidateQueries({queryKey:[$.continueWatching]})},onError:n=>{T.error(`Failed to update statuses: ${n.message}`)}}))},cu=()=>{const e=q(),t=X();return ie(e.watchlist.removeMany.mutationOptions({onSuccess:n=>{const r=n.removed??0;T.success(`Removed ${r} ${r===1?"item":"items"} from watchlist`),t.invalidateQueries(e.watchlist.pathFilter()),t.invalidateQueries({queryKey:[$.watchlist]}),t.invalidateQueries({queryKey:[$.continueWatching]})},onError:n=>{T.error(`Failed to remove: ${n.message}`)}}))},lu=()=>{const e=q(),t=X();return ie(e.continueWatching.removeMany.mutationOptions({onSuccess:n=>{const r=n.removed??0;T.success(`Removed ${r} ${r===1?"item":"items"} from continue watching`),t.invalidateQueries(e.continueWatching.pathFilter()),t.invalidateQueries({queryKey:[$.continueWatching]})},onError:n=>{T.error(`Failed to remove: ${n.message}`)}}))},$n=(e=!0)=>{const t=q();return re({...t.notifications.list.queryOptions(),enabled:e,refetchInterval:3e4})},qn=(e=!0)=>{const t=q();return re({...t.data.systemNotifications.queryOptions(),enabled:e,refetchInterval:3e4})},Dn=(e=!0)=>{const t=q();return re({...t.discovery.status.queryOptions(),enabled:e,refetchInterval:n=>n.state.data?.running?2e3:!1})},$s=()=>{const e=q(),t=X(),n=e.discovery.status.queryOptions().queryKey;return ie(e.discovery.refresh.mutationOptions({onSuccess:r=>{t.setQueryData(n,{running:r.running,state:r.state,total:r.total,done:r.done,lastRunAt:r.lastRunAt}),t.invalidateQueries(e.notifications.pathFilter()),t.invalidateQueries({queryKey:[$.notifications]})},onError:()=>{t.invalidateQueries({queryKey:n})}}))},qs=()=>{const e=q(),t=X();return ie(e.notifications.dismiss.mutationOptions({onSuccess:()=>{t.invalidateQueries(e.notifications.pathFilter())}}))},Ds=()=>{const e=q(),t=X();return ie(e.notifications.clearAll.mutationOptions({onSuccess:()=>{t.invalidateQueries(e.notifications.pathFilter())}}))},uu=()=>{const e=q();return re({...e.continueWatching.thisWeek.queryOptions(),staleTime:1e3*60*5})},du=()=>{const e=q();return re({...e.data.genresAndTags.queryOptions(),staleTime:1e3*60*60})},mu=()=>re({queryKey:[$.genreCards],queryFn:()=>ae.insights.genreCards.query()}),js="_container_vk8jv_1",Ms="_bellBtn_vk8jv_7",Fs="_badge_vk8jv_56",Ws="_dropdown_vk8jv_96",Bs="_dropdownHeader_vk8jv_127",Us="_clearAllBtn_vk8jv_141",Hs="_discoveryStatusRow_vk8jv_159",Ks="_statusDot_vk8jv_170",Qs="_statusDotRunning_vk8jv_177",Vs="_statusDotOk_vk8jv_182",zs="_statusDotInfo_vk8jv_186",Gs="_statusDotError_vk8jv_190",Js="_statusDotIdle_vk8jv_194",Ys="_list_vk8jv_208",Zs="_item_vk8jv_222",Xs="_thumbnail_vk8jv_237",ei="_itemInfo_vk8jv_246",ti="_itemTitle_vk8jv_251",ni="_itemMeta_vk8jv_262",ri="_systemItemMeta_vk8jv_272",oi="_removeItem_vk8jv_289",si="_queueItem_vk8jv_319",ii="_emptyState_vk8jv_323",ai="_notificationDivider_vk8jv_371",E={container:js,bellBtn:Ms,badge:Fs,dropdown:Ws,dropdownHeader:Bs,clearAllBtn:Us,discoveryStatusRow:Hs,statusDot:Ks,statusDotRunning:Qs,statusDotOk:Vs,statusDotInfo:zs,statusDotError:Gs,statusDotIdle:Js,list:Ys,item:Zs,thumbnail:Xs,itemInfo:ei,itemTitle:ti,itemMeta:ni,systemItemMeta:ri,removeItem:oi,queueItem:si,emptyState:ii,notificationDivider:ai},ci=({notification:e})=>{const t=qs(),n=Ls(),[r,s]=St.useState(!1),i=d=>{d.preventDefault(),d.stopPropagation(),t.mutate({showId:e.showId,episodeNumber:e.episodeNumber})},a=()=>{t.mutate({showId:e.showId,episodeNumber:e.episodeNumber})},c=d=>{d.preventDefault(),d.stopPropagation(),s(!0),n.mutate({showId:e.showId,episodeNumber:e.episodeNumber,showName:e.name,showThumbnail:e.thumbnail,nativeName:e.nativeName,englishName:e.englishName}),t.mutate({showId:e.showId,episodeNumber:e.episodeNumber}),window.setTimeout(()=>s(!1),1e3)},{titlePreference:l}=Os(),u=l==="nativeName"?e.nativeName||e.name:l==="englishName"&&e.englishName||e.name;return o(se,{to:`/watch/${e.showId}/${e.episodeNumber}`,className:E.item,onClick:a,children:[o("img",{src:Is(e.thumbnail,48,64),alt:e.name,className:E.thumbnail,loading:"lazy",decoding:"async"}),o("div",{className:E.itemInfo,children:[o("span",{className:E.itemTitle,children:u}),o("span",{className:E.itemMeta,children:["New Episode ",e.episodeNumber]})]}),o("button",{className:`${E.removeItem} ${E.queueItem}`,onClick:c,"aria-label":"Add notification to queue",children:r?o(C,{name:"check"}):o(C,{name:"plus"})}),o("button",{className:E.removeItem,onClick:i,"aria-label":"Remove notification",children:o(C,{name:"times"})})]})};function ct({width:e="100%",height:t="1em",variant:n="rectangular",className:r="",style:s}){return o("div",{className:`skeleton skeleton-${n} ${r}`,style:{width:e,height:t,...s}})}const li=({count:e=3})=>o(Z,{children:Array.from({length:e}).map((t,n)=>o("div",{className:E.item,style:{borderBottom:"1px solid var(--border-primary)",pointerEvents:"none"},children:[o("div",{className:E.thumbnail,style:{overflow:"hidden"},children:o(ct,{width:"100%",height:"100%",variant:"rectangular"})}),o("div",{className:E.itemInfo,children:[o(ct,{width:"80%",height:"1rem",variant:"text",style:{marginBottom:"4px"}}),o(ct,{width:"40%",height:"0.7rem",variant:"rectangular",style:{borderRadius:"var(--radius-sm)"}})]})]},n))}),ui=()=>{const{data:e=[],isLoading:t}=$n(),{data:n=[]}=qn(),{data:r}=Dn(),s=Ds(),i=X(),[a,c]=g(null);w(()=>{i.invalidateQueries({queryKey:[$.notifications]})},[i]);const l=()=>{s.mutate(void 0)},u=n.find(d=>d.id===a)??null;return o("div",{className:E.dropdown,children:[o("div",{className:E.dropdownHeader,children:[o("h4",{children:"Notifications"}),e.length>0&&o("button",{className:E.clearAllBtn,onClick:l,children:"Clear All"})]}),o("div",{className:E.discoveryStatusRow,children:r?.running?o(Z,{children:[o("span",{className:`${E.statusDot} ${E.statusDotRunning}`,"aria-hidden":"true"}),o("span",{children:r.total>0?`Checking ${Math.min(r.done,r.total)}/${r.total} shows...`:"Checking for new episodes..."})]}):r?.state==="complete"?o(Z,{children:[o("span",{className:`${E.statusDot} ${E.statusDotOk}`,"aria-hidden":"true"}),o("span",{children:["Discovery complete - checked ",r.total," ",r.total===1?"show":"shows"]})]}):r?.state==="empty"?o(Z,{children:[o("span",{className:`${E.statusDot} ${E.statusDotInfo}`,"aria-hidden":"true"}),o("span",{children:"No shows set to Watching - nothing to check"})]}):r?.state==="error"?o(Z,{children:[o("span",{className:`${E.statusDot} ${E.statusDotError}`,"aria-hidden":"true"}),o("span",{children:"Last check failed - will retry automatically"})]}):o(Z,{children:[o("span",{className:`${E.statusDot} ${E.statusDotIdle}`,"aria-hidden":"true"}),o("span",{children:r?.lastRunAt?`Last checked ${Math.max(1,Math.round((Date.now()-r.lastRunAt)/1e3))}s ago`:"Auto-checks every few minutes"})]})}),o("div",{className:E.list,children:t&&n.length===0?o(li,{count:4}):o(Z,{children:[n.map(d=>o("div",{className:E.item,children:[o("div",{className:E.thumbnail,style:{background:"transparent",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:0,boxShadow:"none"},children:o(C,{name:"info-circle",size:32,color:"#6c9fff"})}),o("div",{className:E.itemInfo,children:[o("span",{className:E.itemTitle,children:d.title}),o("button",{type:"button",className:E.systemItemMeta,onClick:()=>c(d.id),title:"View full status",children:Cs(d.message,40,"…")})]}),o("button",{className:E.removeItem,disabled:!0,style:{opacity:.3,cursor:"not-allowed"},"aria-hidden":"true",children:o(C,{name:"plus"})}),o("button",{className:E.removeItem,disabled:!0,style:{opacity:.3,cursor:"not-allowed"},"aria-hidden":"true",children:o(C,{name:"times"})})]},d.id)),n.length>0&&e.length>0&&o("div",{className:E.notificationDivider}),e.length>0?e.map(d=>o(ci,{notification:d},d.id)):!t&&n.length===0&&o("div",{className:E.emptyState,children:"No new notifications"})]})}),u&&Pt(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(C,{name:"info-circle",color:"#6c9fff"}),o("span",{style:{color:"#fff",fontWeight:600,fontSize:"1rem"},children:u.title})]}),o("p",{style:{color:"var(--text-secondary)",marginBottom:"1.5rem",lineHeight:1.5},children:u.message}),o("div",{style:{display:"flex",justifyContent:"flex-end"},children:o("button",{type:"button",onClick:()=>c(null),style:{background:"var(--accent)",color:"#fff",border:"none",padding:"0.5rem 1rem",borderRadius:"var(--radius-md)",cursor:"pointer",fontWeight:600},children:"OK"})})]})}),document.body)]})},di=()=>{const[e,t]=g(!1),n=H(null),r=X(),s=q(),i=$s(),{data:a=[]}=$n(),{data:c=[]}=qn(),{data:l}=Dn(),u=a.length+c.length,d=u>5?"5+":u,f=H(!1);w(()=>{const h=p=>{n.current&&!n.current.contains(p.target)&&t(!1)};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[]),w(()=>{const h=!!l?.running;f.current&&!h&&(r.invalidateQueries(s.notifications.pathFilter()),r.invalidateQueries(s.discovery.pathFilter())),f.current=h},[l?.running,r,s]);const m=()=>{const h=!e;t(h),h&&i.mutate()};return o("div",{className:E.container,ref:n,children:[o("button",{className:E.bellBtn,onClick:m,"aria-label":"Notifications",children:[o(C,{name:"bell"}),u>0&&o("span",{className:E.badge,children:d})]}),e&&o(ui,{})]})},it=e=>{const t=q();return re({...t.settings.getByKey.queryOptions({key:e}),select:n=>n.value})},jn=()=>{const e=q(),t=X();return ie(e.settings.set.mutationOptions({onSuccess:()=>{T.success("Setting updated!"),t.invalidateQueries(e.settings.pathFilter()),t.invalidateQueries({queryKey:[$.settings]})},onError:n=>{T.error(`Failed to update setting: ${n.message}`)}}))},Mn=fe(void 0),mi=()=>{const e=he(Mn);if(e===void 0)throw new Error("useLowEndMode must be used within a LowEndModeProvider");return e},me={x:-2.8,y:-2,w:48.6,h:14},bt=15,Ne={w:13.6,h:10.2},ve=[{x:0,y:.5},{x:bt,y:-.9},{x:bt*2,y:.3}],zt={x:Ne.w/2,y:Ne.h/2-.5},lt={y:Ne.h/2,x1:-2,x2:bt*2+Ne.w+1.4},Gt=(e,t,n,r=0)=>{if(n.width<=0)return-1;const s=n.width/me.w,i=(e-n.left)/s+me.x,a=(t-n.top)/s+me.y;for(let c=0;c<ve.length;c++){const l=i-ve[c].x,u=a-ve[c].y;if(l>=-r&&l<=Ne.w+r&&u>=-r&&u<=Ne.h+r)return c}return-1},Jt=7.5,Yt=e=>Math.max(-1,Math.min(1,e)),fi=(e,t,n,r)=>{const s=n.width/me.w,i=(e-n.left)/s+me.x-r.x-zt.x,a=(t-n.top)/s+me.y-r.y-zt.y;return{x:Yt(i/Jt),y:Yt(a/Jt)}},hi=["normal","squint"],pi={normal:.72,squint:.28},Zt=(e=Math.random(),t)=>{let n=0;for(const r of hi)if(n+=pi[r],e<n)return r===t?r==="normal"?"squint":"normal":r;return"normal"},vi="pet",yi="sleep",gi=6e3,bi=420,wi=.5,Xt=3e3,_i=3e3,Ei=ve.map((e,t)=>t*260),ut={from:ve.length-2,to:ve.length-1,after:400},en="data-dango-face",dt="data-dango-hover",mt="data-dango-cheer",tn="data-dango-nudge",ki=()=>document.querySelectorAll("svg[data-dango-gaze-origin]"),Ke=()=>document.querySelectorAll("[data-dango-face-slot]"),Si=e=>e.querySelectorAll("[data-dango-eye]"),Pi=()=>document.querySelectorAll("[data-dango-eye]"),Fn=()=>{const{data:e}=it("dangoGaze"),{lowEndMode:t}=mi();return e!=="false"&&!t},Ti=()=>{const e=Fn();w(()=>{if(!e||window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;const t=ve.map(()=>"normal");let n=-1,r=-1,s=!1,i=-1,a=0,c=0,l=0,u=0,d=0;const f=[],m=(b,N)=>{const P=window.setTimeout(()=>{f.splice(f.indexOf(P),1),b()},N);f.push(P)},h=(b,N,P)=>{Ke().forEach(D=>{Number(D.getAttribute("data-dango-face-slot"))===b&&(P?D.setAttribute(N,""):D.removeAttribute(N))})},p=b=>Ke().forEach(N=>N.removeAttribute(b)),_=(b,N,P)=>{p(N),requestAnimationFrame(()=>{h(b,N,!0),m(()=>p(N),P)})},I=()=>{Ke().forEach(b=>{const N=Number(b.getAttribute("data-dango-face-slot"));b.setAttribute(en,r===N?vi:t[N]),n===N?b.setAttribute(dt,""):b.removeAttribute(dt)})},S=b=>{b!==r&&(r>=0&&h(r,mt,!1),r=b,b>=0&&h(b,mt,!0))},v=()=>{window.clearTimeout(d),d=window.setTimeout(()=>{S(-1),I()},bi)},y=()=>{window.clearTimeout(d),S(-1)},x=()=>{s=!1,Ei.forEach((b,N)=>{m(()=>{t[N]=Zt(),N===ut.from&&m(()=>_(ut.to,tn,520),ut.after),I()},b)})},G=()=>{s=!0,t.fill(yi),y(),I()},ee=()=>{window.clearTimeout(u),u=window.setTimeout(G,gi)},ge=()=>{s||(i=(i+1)%t.length,t[i]=Zt(Math.random(),t[i]),I()),m(ge,Xt+Math.random()*_i)},k=()=>{const b=Array.from(ki(),O=>[O,O.getBoundingClientRect()]);b.forEach(([O,ce])=>{Si(O).forEach(Te=>{const{x:le,y:ke}=fi(c,l,ce,ve[Number(Te.getAttribute("data-dango-eye"))]);Te.style.setProperty("--dango-gaze-x",le.toFixed(3)),Te.style.setProperty("--dango-gaze-y",ke.toFixed(3))})});const N=b.find(([,O])=>c>=O.left&&c<=O.right&&l>=O.top&&l<=O.bottom)?.[1]??null,P=n,D=r,W=N?Gt(c,l,N):-1,oe=W>=0?W:N?Gt(c,l,N,wi):-1;n=W,oe>=0?(S(oe),v()):y(),(P!==n||D!==r)&&I(),s&&x(),ee()},J=b=>{c=b.clientX,l=b.clientY,!a&&(a=requestAnimationFrame(()=>{a=0,k()}))},B=b=>{b.relatedTarget||(n=-1,y(),I(),ee())};return I(),ee(),m(ge,Xt),window.addEventListener("pointermove",J,{passive:!0}),window.addEventListener("pointerout",B),()=>{cancelAnimationFrame(a),window.clearTimeout(u),window.clearTimeout(d),f.forEach(window.clearTimeout),window.removeEventListener("pointermove",J),window.removeEventListener("pointerout",B),Pi().forEach(b=>{b.style.removeProperty("--dango-gaze-x"),b.style.removeProperty("--dango-gaze-y")}),Ke().forEach(b=>{b.setAttribute(en,"normal"),b.removeAttribute(dt),b.removeAttribute(mt),b.removeAttribute(tn)})}},[e])},Wn=fe(void 0),fu=()=>{const e=he(Wn);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e},hu=[{id:"iris",label:"Taro (default)",blurb:"Deep purple",swatch:"#7d6df0"},{id:"sakura",label:"Sakura",blurb:"Soft pink",swatch:"#e0b0e0"},{id:"mochi",label:"Mochi",blurb:"Monochrome pearl",swatch:"#f0f0f0"}],xi={iris:{fill:"#897cff",stroke:"#5646db"},mochi:{fill:"#e3e1ee",stroke:"#b3b1c6"},sakura:{fill:"#e1afef",stroke:"#a978a9"}},Ii="_logo_t3il2_1",Ni="_skewer_t3il2_8",Ci="_gaze_t3il2_15",Oi="_face_t3il2_20",Ai="_faceNormal_t3il2_25",Li="_facePet_t3il2_26",Ri="_faceSquint_t3il2_27",$i="_faceSleep_t3il2_28",qi="_line_t3il2_36",Di="_sway_t3il2_44",ji="_weight_t3il2_58",Mi="_shift_t3il2_73",Fi="_rock_t3il2_87",Wi="_glance_t3il2_105",Bi="_blinkDouble_t3il2_129 _blink_t3il2_124",Ui="_blinkSlow_t3il2_153 _blink_t3il2_124",Hi="_bump_t3il2_172",Ki="_heart_t3il2_189",U={logo:Ii,skewer:Ni,gaze:Ci,face:Oi,faceNormal:Ai,facePet:Li,faceSquint:Ri,faceSleep:$i,line:qi,sway:Di,weight:ji,shift:Mi,rock:Fi,glance:Wi,blinkDouble:Bi,blinkSlow:Ui,bump:Hi,heart:Ki},nn="var(--logo-ink)",Qi="m 7,0 c -3.9372984,0 -7.10030437,2.4883888 -7,6 0.13572675,4.751733 5.0802847,4.156395 7,4.156395 1.2538994,0 6.530451,0.392468 6.584946,-4.168088 C 13.622023,2.8853946 10.937298,0 7,0 Z",Vi="m 4.9623825,3.416 c -0.5858889,0 -0.6520292,2.3368563 -0.024765,2.3368563 0.6604959,0 0.6704653,-2.3368563 0.024765,-2.3368563 z",zi="M 8.588001,3.416 C 8.0021121,3.416 7.9359718,5.7528563 8.563236,5.7528563 9.2237319,5.7528563 9.2337013,3.416 8.588001,3.416 Z",Gi={pet:"M 4.85,5.15 Q 5.285,4.0 5.72,5.15 M 8.25,5.15 Q 8.618,4.0 8.99,5.15",squint:"M 4.82,3.9 L 5.6,4.62 L 4.82,5.34 M 9.08,3.9 L 8.3,4.62 L 9.08,5.34",sleep:"M 4.9,4.72 Q 5.285,5.28 5.67,4.72 M 8.25,4.72 Q 8.618,5.28 9.0,4.72"},Bn=[{lag:.8,hue:"iris",blink:"double",motion:"weight",glances:!1},{lag:1.4,hue:"sakura",blink:"slow",motion:"shift",glances:!1},{lag:1,hue:"mochi",blink:"slow",motion:"rock",glances:!0}],Ae=(e,t)=>e+Math.random()*(t-e),Ji=Bn.map(()=>({blinkDelay:-Ae(0,9),blinkDuration:Ae(3.4,8.6),motionDelay:-Ae(0,9),motionDuration:Ae(5.5,11),glanceDelay:-Ae(0,11)})),Yi={double:U.blinkDouble,slow:U.blinkSlow},Zi={weight:U.weight,shift:U.shift,rock:U.rock},Xi={normal:U.faceNormal,pet:U.facePet,squint:U.faceSquint,sleep:U.faceSleep},ea=["normal","pet","squint","sleep"],ta=[{x:7,y:4.2,delay:0,drift:"0px"},{x:9.6,y:6.4,delay:-.3,drift:"-0.9px"},{x:4.6,y:6.1,delay:-.6,drift:"0.8px"},{x:8.2,y:3.4,delay:-.9,drift:"-0.4px"}],At=({className:e})=>{const t=Fn();return o("svg",{viewBox:`${me.x} ${me.y} ${me.w} ${me.h}`,className:e?`${U.logo} ${e}`:U.logo,role:"img","aria-label":"dango","data-dango-gaze-origin":"",children:o("g",{className:t?U.sway:void 0,children:[o("path",{className:U.skewer,d:`M ${lt.x1},${lt.y} H ${lt.x2}`}),Bn.map((n,r)=>{const{x:s,y:i}=ve[r],a=Ji[r],{fill:c,stroke:l}=xi[n.hue],u=o("g",{"data-dango-eye":r,className:U.gaze,style:{"--gaze-dur":`${(.12+n.lag*.18).toFixed(3)}s`},children:ea.map(d=>o("g",{className:`${U.face} ${Xi[d]}`,children:o("g",{className:t&&d==="normal"?Yi[n.blink]:void 0,style:t&&d==="normal"?{animationDelay:`${a.blinkDelay}s`,animationDuration:`${a.blinkDuration}s`}:void 0,children:d==="normal"?o(Z,{children:[o("path",{fill:nn,d:Vi}),o("path",{fill:nn,d:zi})]}):o("path",{className:U.line,d:Gi[d]})})},d))});return o("g",{transform:`translate(${s} ${i})`,children:o("g",{"data-dango-face-slot":r,"data-dango-face":"normal",className:t?Zi[n.motion]:void 0,style:t?{animationDelay:`${a.motionDelay}s`,animationDuration:`${a.motionDuration}s`}:void 0,children:[o("path",{fill:c,stroke:l,strokeWidth:"0.9",strokeLinejoin:"round",paintOrder:"stroke fill",d:Qi}),o("g",{className:U.bump,children:[t&&n.glances?o("g",{className:U.glance,style:{animationDelay:`${a.glanceDelay}s`},children:u}):u,t&&o("g",{children:ta.map(d=>o("text",{className:U.heart,x:d.x,y:d.y,fill:"var(--color-danger)",style:{"--drift":d.drift,animationDelay:`${d.delay}s`},children:"♥"},d.x))})]})]})},n.hue)})]})})},Un=fe(void 0),Lt=()=>{const e=he(Un);if(e===void 0)throw new Error("useSidebar must be used within a SidebarProvider");return e},Hn=fe(void 0),Kn=()=>{const e=he(Hn);if(e===void 0)throw new Error("useContentType must be used within a ContentTypeProvider");return e},wt="virtual-keyboard:hide",rn="virtual-keyboard:enabled-change",Qn="virtual_keyboard_enabled",na=!1;function on(){const e=z.getItem(Qn);return e===null?na:e==="true"}const sn=e=>e instanceof HTMLInputElement&&e.type==="text"&&!e.disabled&&!e.readOnly;function ra(){window.dispatchEvent(new CustomEvent(wt))}function oa(){const[e,t]=g(!1),[n,r]=g(on),s=H(null);return w(()=>{const i=d=>{n&&sn(d.target)&&(s.current=d.target,t(!0))},a=d=>{d.target===s.current&&window.setTimeout(()=>{if(sn(document.activeElement)){s.current=document.activeElement,t(!0);return}s.current=null,t(!1)},0)},c=()=>{s.current=null,t(!1)},l=d=>{if(d.key!==Qn)return;const f=d.newValue==="true";r(f),f||c()},u=()=>{const d=on();r(d),d||c()};return document.addEventListener("focusin",i),document.addEventListener("focusout",a),window.addEventListener(wt,c),window.addEventListener("storage",l),window.addEventListener(rn,u),()=>{document.removeEventListener("focusin",i),document.removeEventListener("focusout",a),window.removeEventListener(wt,c),window.removeEventListener("storage",l),window.removeEventListener(rn,u)}},[n]),{activeInputRef:s,isVisible:n&&e,hide:()=>t(!1)}}const sa={queryKey:[$.syncProfile],queryFn:()=>qe("/api/profiles/current"),staleTime:3e4};function Vn({image:e,name:t}){const[n,r]=g(!1);return w(()=>r(!1),[e]),e&&!n?o("img",{src:e,alt:t,referrerPolicy:"no-referrer",onError:()=>r(!0),style:{width:"100%",height:"100%",maxWidth:72,maxHeight:72,aspectRatio:"1",objectFit:"cover",borderRadius:"50%"}}):o("svg",{viewBox:"0 0 24 24",role:"img","aria-label":t,style:{width:"100%",height:"100%",maxWidth:72,maxHeight:72,aspectRatio:"1"},fill:"currentColor",children:[o("circle",{cx:"12",cy:"8",r:"4"}),o("path",{d:"M4 21v-2a8 8 0 0 1 16 0v2z"})]})}const ia="_header_1f1e7_1",aa="_hidden_1f1e7_21",ca="_scrolled_1f1e7_25",la="_logo_1f1e7_31",ua="_headerInner_1f1e7_44",da="_leftSection_1f1e7_54",ma="_desktopNav_1f1e7_60",fa="_navLink_1f1e7_67",ha="_navLinkActive_1f1e7_83",pa="_rightSection_1f1e7_102",va="_searchWrapper_1f1e7_108",ya="_searchInput_1f1e7_114",ga="_searchButton_1f1e7_144",ba="_searchIcon_1f1e7_168",wa="_profileBtn_1f1e7_178",_a="_profileAvatar_1f1e7_213",Ea="_profileName_1f1e7_220",ka="_hamburgerBtn_1f1e7_229",Sa="_mobileSearchBar_1f1e7_256",Pa="_mobileSearchBarHidden_1f1e7_283",Ta="_mobileSearchInner_1f1e7_300",xa="_mobileSearchIcon_1f1e7_316",Ia="_mobileSearchInput_1f1e7_323",A={header:ia,hidden:aa,scrolled:ca,logo:la,headerInner:ua,leftSection:da,desktopNav:ma,navLink:fa,navLinkActive:ha,rightSection:pa,searchWrapper:va,searchInput:ya,searchButton:ga,searchIcon:ba,profileBtn:wa,profileAvatar:_a,profileName:Ea,hamburgerBtn:ka,mobileSearchBar:Sa,mobileSearchBarHidden:Pa,mobileSearchInner:Ta,mobileSearchIcon:xa,mobileSearchInput:Ia},Na=()=>{const{toggleSidebar:e}=Lt(),{contentType:t}=Kn(),[n,r]=g(""),[s,i]=g(!0),[a,c]=g(!1),[l,u]=g(!0),[d,f]=g(!1),m=hn(),h=tt(),p=H(null),_=H(!1),I=H(null),S=H(null),v=H(null),y=H(null),x=H(!1),{data:G}=re(sa);w(()=>{const P=window.visualViewport;if(!P)return;const D=()=>{y.current?.style.setProperty("--vv-top",`${P.offsetTop}px`)};return D(),P.addEventListener("scroll",D),P.addEventListener("resize",D),()=>{P.removeEventListener("scroll",D),P.removeEventListener("resize",D)}},[]),w(()=>{const P=()=>{p.current&&(window.clearTimeout(p.current),p.current=null)},D=()=>{P(),!(window.scrollY<=10)&&(p.current=window.setTimeout(()=>{x.current||i(!1)},2500))},W=()=>{_.current||(_.current=!0,I.current=requestAnimationFrame(()=>{_.current=!1,I.current=null;const le=window.scrollY<=10;u(ke=>ke===le?ke:le),i(ke=>ke||!0),D()}))},oe=le=>{(le.metaKey||le.ctrlKey)&&le.key==="k"?(le.preventDefault(),ee.current?.focus({preventScroll:!0})):le.key==="Escape"&&document.activeElement===ee.current&&ee.current?.blur()},O=y.current,ce=()=>{x.current=!0},Te=()=>{x.current=!1,D()};return window.addEventListener("scroll",W,{passive:!0}),window.addEventListener("keydown",oe),O?.addEventListener("pointerenter",ce),O?.addEventListener("pointerleave",Te),()=>{window.removeEventListener("scroll",W),window.removeEventListener("keydown",oe),O?.removeEventListener("pointerenter",ce),O?.removeEventListener("pointerleave",Te),P(),I.current!==null&&(cancelAnimationFrame(I.current),I.current=null),_.current=!1}},[a]);const ee=St.useRef(null),ge=()=>window.innerWidth<=1024,k=()=>{ge()?(f(!0),setTimeout(()=>v.current?.focus({preventScroll:!0}),50)):document.activeElement===ee.current&&n.trim()?N():ee.current?.focus({preventScroll:!0})},J=P=>{S.current?.contains(P.relatedTarget)||f(!1)},B=t==="manga"?"Search manga...":t==="tv"?"Search TV & movies...":t==="asmr"?"Search ASMR...":"Search anime...",b=t==="manga"?{to:"/reading-list",label:"Reading List"}:t==="tv"?{to:"/tv-watchlist",label:"TV Watchlist"}:t==="asmr"?{to:"/listening-list",label:"Listening List"}:{to:"/watchlist",label:"Watchlist"},N=P=>{ra();const D=n.trim();D&&m(t==="manga"?`/manga?q=${encodeURIComponent(D)}`:t==="tv"?`/tv-search?q=${encodeURIComponent(D)}`:t==="asmr"?`/asmr?q=${encodeURIComponent(D)}`:`/search?query=${encodeURIComponent(D)}`)};return o(Z,{children:o("header",{ref:y,className:`${A.header} ${s?"":A.hidden} ${l?"":A.scrolled}`,children:[o("div",{className:A.headerInner,children:[o("div",{className:A.leftSection,children:[o("button",{className:A.hamburgerBtn,onClick:e,"aria-label":"Menu",children:o(C,{name:"bars"})}),o(se,{to:"/",className:A.logo,"aria-label":"Ani-Web Home",children:o(At,{})}),o("nav",{className:A.desktopNav,children:[o(se,{to:"/",className:`${A.navLink} ${h.pathname==="/"?A.navLinkActive:""}`,children:"Home"}),o(se,{to:b.to,className:`${A.navLink} ${h.pathname.startsWith(b.to)?A.navLinkActive:""}`,children:b.label}),t==="anime"&&o(se,{to:"/insights",className:`${A.navLink} ${h.pathname==="/insights"?A.navLinkActive:""}`,children:"Insights"}),o(se,{to:"/settings",className:`${A.navLink} ${h.pathname.startsWith("/settings")?A.navLinkActive:""}`,children:"Settings"})]})]}),o("div",{className:A.rightSection,children:[o("div",{className:A.searchWrapper,children:[o("input",{ref:ee,type:"text","data-virtual-keyboard":"true",className:A.searchInput,placeholder:B,value:n,onChange:P=>r(P.currentTarget.value),onFocus:()=>c(!0),onBlur:()=>c(!1),onKeyDown:P=>{P.key==="Enter"&&N()}}),o("button",{type:"button",className:A.searchButton,"aria-label":"Search",onMouseDown:P=>P.preventDefault(),onClick:k,children:o(C,{name:"search",className:A.searchIcon})})]}),o(di,{}),o(se,{to:"/settings",className:A.profileBtn,"aria-label":`${G?.name??"Profile"} — profile settings`,title:`${G?.name??"Profile"}${G?.owner?" (owner)":""} — profile settings`,children:[o("span",{className:A.profileAvatar,"aria-hidden":"true",children:o(Vn,{image:G?.image,name:G?.name??"Profile"})}),o("span",{className:A.profileName,children:G?.name??"Profile"})]})]})]}),d&&o("div",{className:`${A.mobileSearchBar} ${s?"":A.mobileSearchBarHidden}`,ref:S,onBlur:J,children:o("div",{className:A.mobileSearchInner,children:[o(C,{name:"search",className:A.mobileSearchIcon}),o("input",{ref:v,type:"text","data-virtual-keyboard":"true",className:A.mobileSearchInput,placeholder:B,value:n,onChange:P=>r(P.currentTarget.value),onKeyDown:P=>{P.key==="Enter"?(N(),f(!1)):P.key==="Escape"&&f(!1)}})]})})]})})},_t="agreedToViewMature";function Et(){try{return z.getItem(_t)==="true"}catch{return!1}}const $e=new Set;function zn(e){for(const t of $e)t(e)}function Qe(){zn(Et())}function an(e){try{e?z.setItem(_t,"true"):z.removeItem(_t)}catch{}zn(e)}function Ca(){const[e,t]=g(Et);w(()=>($e.add(t),$e.size===1&&(window.addEventListener("storage",Qe),window.addEventListener("focus",Qe)),t(Et()),()=>{$e.delete(t),$e.size===0&&(window.removeEventListener("storage",Qe),window.removeEventListener("focus",Qe))}),[]);const n=K(()=>an(!0),[]),r=K(()=>an(!1),[]);return{hasConsent:e,grant:n,revoke:r}}const Oa="_sidebar_153jc_1",Aa="_open_153jc_20",La="_sidebarHeader_153jc_25",Ra="_closeBtn_153jc_33",$a="_logo_153jc_57",qa="_navSection_153jc_69",Da="_navLink_153jc_75",ja="_active_153jc_108",Ma="_overlay_153jc_118",Fa="_versionInfo_153jc_138",ue={sidebar:Oa,open:Aa,sidebarHeader:La,closeBtn:Ra,logo:$a,navSection:qa,navLink:Da,active:ja,overlay:Ma,versionInfo:Fa},Wa="3.7.8",Gn={version:Wa},Ba=()=>{const{isOpen:e,setIsOpen:t}=Lt(),{contentType:n}=Kn(),{hasConsent:r}=Ca(),s=()=>{t(!1)},i=n==="manga",a=n==="tv",c=n==="asmr",l=[{to:"/",icon:o(C,{name:"home"}),label:"Home"},i?{to:"/manga",icon:o(C,{name:"book"}),label:"Manga"}:a?{to:"/tv-search",icon:o(C,{name:"tv"}),label:"TV and Movies"}:c?{to:"/asmr",icon:o(C,{name:"headphones"}),label:"ASMR"}:{to:"/search",icon:o(C,{name:"search"}),label:"Search"},i?{to:"/reading-list",icon:o(C,{name:"bookmark"}),label:"Reading List"}:a?{to:"/tv-watchlist",icon:o(C,{name:"clock"}),label:"TV Watchlist"}:c?{to:"/listening-list",icon:o(C,{name:"history"}),label:"Listening List"}:{to:"/watchlist",icon:o(C,{name:"clock"}),label:"Watchlist"},...n==="anime"?[{to:"/insights",icon:o(C,{name:"chart-pie"}),label:"Insights"}]:[],{to:"/trackers",icon:o(C,{name:"sync-alt"}),label:"Trackers"},{to:"/watch-along",icon:o(C,{name:"play"}),label:"Watch along"},...r?[{to:"/mature",icon:o(C,{name:"pepper-hot"}),label:"Mature"}]:[],{to:"/settings",icon:o(C,{name:"cog"}),label:"Settings"}];return o(Z,{children:[o("aside",{className:`${ue.sidebar} ${e?ue.open:""} sidebar`,children:[o("div",{className:ue.sidebarHeader,children:[o("button",{className:ue.closeBtn,onClick:()=>t(!1),"aria-label":"Close menu",children:"×"}),o(se,{to:"/",className:ue.logo,onClick:s,children:o(At,{})})]}),o("nav",{className:ue.navSection,children:l.map(u=>o(ir,{to:u.to,className:({isActive:d})=>`${ue.navLink} ${d?ue.active:""}`,onClick:s,end:u.to==="/",children:[u.icon,o("span",{children:u.label})]},u.to))}),o("div",{className:ue.versionInfo,children:["v",Gn.version]})]}),e&&o("div",{className:ue.overlay,onClick:()=>t(!1),"aria-label":"Close sidebar"})]})},Ua="_footer_1c905_1",Ha="_footerInner_1c905_15",Ka="_brandSection_1c905_27",Qa="_logoRow_1c905_39",Va="_logoText_1c905_45",za="_brandMeta_1c905_51",Ga="_brandTagline_1c905_60",Ja="_statusPill_1c905_67",Ya="_statusDot_1c905_80",Za="_linksGrid_1c905_88",Xa="_linkColumn_1c905_96",ec="_columnTitle_1c905_102",tc="_bottomBar_1c905_126",nc="_copyright_1c905_136",rc="_brand_1c905_27",oc="_heartIcon_1c905_152",sc="_backToTop_1c905_157",j={footer:Ua,footerInner:Ha,brandSection:Ka,logoRow:Qa,logoText:Va,brandMeta:za,brandTagline:Ga,statusPill:Ja,statusDot:Ya,linksGrid:Za,linkColumn:Xa,columnTitle:ec,bottomBar:tc,copyright:nc,brand:rc,heartIcon:oc,backToTop:sc},ic=()=>{const e=new Date().getFullYear(),t=()=>{window.scrollTo({top:0,behavior:"smooth"})};return o("footer",{className:j.footer,children:[o("div",{className:j.footerInner,children:[o("div",{className:j.brandSection,children:[o("div",{className:j.logoRow,children:o(At,{className:j.logoText})}),o("div",{className:j.brandMeta,children:[o("div",{className:j.statusPill,children:[o("span",{className:j.statusDot}),o("span",{children:["v",Gn.version]})]}),o("p",{className:j.brandTagline,children:"Fast, local anime streaming."})]})]}),o("div",{className:j.linksGrid,children:[o("div",{className:j.linkColumn,children:[o("h4",{className:j.columnTitle,children:"Navigation"}),o(se,{to:"/",children:"Home"}),o(se,{to:"/watchlist",children:"Watchlist"}),o(se,{to:"/settings",children:"Settings"})]}),o("div",{className:j.linkColumn,children:[o("h4",{className:j.columnTitle,children:"Features"}),o(se,{to:"/search",children:"Search Anime"}),o(se,{to:"/trackers",children:"Trackers"}),o(se,{to:"/insights",children:"Insights"})]}),o("div",{className:j.linkColumn,children:[o("h4",{className:j.columnTitle,children:"Community"}),o("a",{href:"https://discord.gg/6yT3VwTqz9",target:"_blank",rel:"noopener noreferrer",children:[o(C,{name:"discord",style:{marginRight:"6px"}})," Discord"]}),o("a",{href:"https://github.com/serifpersia/dango",target:"_blank",rel:"noopener noreferrer",children:[o(C,{name:"github",style:{marginRight:"6px"}})," GitHub"]})]}),o("div",{className:j.linkColumn,children:[o("h4",{className:j.columnTitle,children:"Project"}),o("a",{href:"https://github.com/serifpersia/dango/releases",target:"_blank",rel:"noopener noreferrer",children:"Releases"}),o("a",{href:"https://github.com/serifpersia/dango/issues",target:"_blank",rel:"noopener noreferrer",children:"Feedback"})]})]})]}),o("div",{className:j.bottomBar,children:[o("p",{className:j.copyright,children:["© ",e," ",o("span",{className:j.brand,children:"dango"})," • Crafted with"," ",o(C,{name:"heart",className:j.heartIcon})," by"," ",o("a",{href:"https://github.com/serifpersia",target:"_blank",rel:"noopener noreferrer",children:"serifpersia"})]}),o("button",{className:j.backToTop,onClick:t,"aria-label":"Back to top",children:[o(C,{name:"chevron-up",size:14}),o("span",{children:"Top"})]})]})]})};function Jn(e){return JSON.stringify({0:e??{}})}function Yn(e){return`/api/trpc/${e}?batch=1&_profile=${encodeURIComponent(Ln())}`}function kt(e,t){const n=Jn(t),r=Yn(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 pu(e,t){const n=await fetch(Yn(e),{method:"POST",headers:{"Content-Type":"application/json"},body:Jn(t),keepalive:!0});if(!n.ok)throw new Error(`tRPC request failed (HTTP ${n.status})`)}function vu(e){e&&(kt("discord.clear",{sessionId:e}),kt("discord.heartbeat",{sessionId:e,bye:!0}))}function ac(){const e=tt(),{data:t}=it("discordRPCEnabled"),n=H("");n.current||(n.current=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`tab-${Date.now()}-${Math.random().toString(36).slice(2)}`),w(()=>{if(t===!1||t==="false")return;const r=n.current,s=()=>ae.discord.heartbeat.mutate({sessionId:r}).catch(()=>{});s();const i=setInterval(s,15e3),a=()=>{kt("discord.heartbeat",{sessionId:r,bye:!0})};return window.addEventListener("pagehide",a),()=>{clearInterval(i),window.removeEventListener("pagehide",a)}},[t]),w(()=>{if(t===!1||t==="false")return;const r=e.pathname;if(r.startsWith("/watch/")||r.startsWith("/player/"))return;let s="home";r.startsWith("/search")||r.startsWith("/mature")?s="search":r.startsWith("/watchlist")?s="watchlist":r.startsWith("/anime/")?s="anime":r.startsWith("/insights")?s="insights":r.startsWith("/settings")?s="settings":r.startsWith("/trackers")?s="trackers":r.startsWith("/asmr")?s="asmr":r.startsWith("/manga")?s="manga":r.startsWith("/tv")&&(s="tv"),ae.discord.pageStatus.mutate({page:s}).catch(()=>{})},[e.pathname,t])}function Rt(e,t){const[n,r]=g(()=>{try{const i=z.getItem(e);if(i===null)return t;if(typeof t=="string")return i;try{return JSON.parse(i)}catch{return i}}catch{return t}});w(()=>{const i=a=>{if(a.key===z.keyFor(e))try{if(a.newValue===null){r(t);return}if(typeof t=="string"){r(a.newValue);return}try{r(JSON.parse(a.newValue))}catch{r(a.newValue)}}catch{}};return window.addEventListener("storage",i),()=>window.removeEventListener("storage",i)},[e,t]);const s=K(i=>{r(a=>{const c=typeof i=="function"?i(a):i;try{typeof c=="string"?z.setItem(e,c):z.setItem(e,JSON.stringify(c))}catch{}return c})},[e]);return[n,s]}const Zn=fe(void 0),cc=()=>{const e=he(Zn);if(!e)throw new Error("useAnimePaheCookie must be used within an AnimePaheCookieProvider");return e},lc="_overlay_1juub_1",uc="_fadeIn_1juub_1",dc="_content_1juub_11",mc="_modalIn_1juub_1",fc="_sm_1juub_29",hc="_md_1juub_33",pc="_lg_1juub_37",vc="_title_1juub_41",yc="_body_1juub_48",gc="_footer_1juub_52",Ie={overlay:lc,fadeIn:uc,content:dc,modalIn:mc,sm:fc,md:hc,lg:pc,title:vc,body:yc,footer:gc};function Xn({children:e}){return o("h2",{className:Ie.title,children:e})}function er({children:e}){return o("div",{className:Ie.body,children:e})}function tr({children:e}){return o("div",{className:Ie.footer,children:e})}function We({isOpen:e,onClose:t,title:n,children:r,footer:s,width:i="md"}){const a=H(null),[c,l]=g(document.body);return w(()=>{if(!e)return;const u=()=>l(document.fullscreenElement??document.body);return u(),document.addEventListener("fullscreenchange",u),()=>document.removeEventListener("fullscreenchange",u)},[e]),w(()=>{if(!e)return;const u=f=>{f.key==="Escape"&&t?.()};document.addEventListener("keydown",u);const d=document.body.style.overflow;return document.body.style.overflow="hidden",a.current?.focus(),()=>{document.removeEventListener("keydown",u),document.body.style.overflow=d}},[e,t]),e?Pt(o("div",{role:"presentation",onMouseDown:u=>u.stopPropagation(),children:[o("div",{className:Ie.overlay,onClick:()=>t?.(),"aria-hidden":"true"}),o("div",{ref:a,className:`${Ie.content} ${Ie[i]}`,role:"dialog","aria-modal":"true","aria-label":n,tabIndex:-1,children:[n&&o(Xn,{children:n}),o(er,{children:r}),s&&o(tr,{children:s})]})]}),c):null}We.Header=Xn;We.Body=er;We.Actions=tr;const bc="_container_e96gf_1",wc="_field_e96gf_9",_c="_textarea_e96gf_20",Ec="_input_e96gf_40",kc="_button_e96gf_58",Sc="_secondaryButton_e96gf_78",Pc="_actions_e96gf_95",Tc="_hint_e96gf_104",xc="_link_e96gf_117",te={container:bc,field:wc,textarea:_c,input:Ec,button:kc,secondaryButton:Sc,actions:Pc,hint:Tc,link:xc},Ic="https://github.com/serifpersia/dango/releases/latest/download/dango-extension.zip",Nc=e=>{try{return JSON.parse(e.detail)}catch{return null}},Cc=({isOpen:e,onClose:t,onSuccess:n})=>{const[r,s]=g(1),[i,a]=g(navigator.userAgent),[c,l]=g(""),[u,d]=g(!1),f=H(null),m=navigator.userAgent,h=/android/i.test(m),p=/firefox|fxios/i.test(m)&&!h,_=!p&&!h&&/chrome|chromium|edg|brave/i.test(m),I=p||_;w(()=>{e&&(s(1),a(navigator.userAgent),l(""),d(!1))},[e]),w(()=>()=>{f.current&&(window.removeEventListener("dango:pahe-cookie",f.current),f.current=null)},[]);const S=()=>{window.open("https://animepahe.pw","_blank","noopener,noreferrer"),s(2)},v=()=>{if(u)return;d(!0);const x=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,G=window.setTimeout(()=>{d(!1),f.current&&(window.removeEventListener("dango:pahe-cookie",f.current),f.current=null),T.error("Helper not detected - install it via about:debugging first.")},3e3),ee=ge=>{const k=Nc(ge);if(!(!k||k.requestId!==x))if(window.clearTimeout(G),window.removeEventListener("dango:pahe-cookie",ee),f.current=null,d(!1),k?.ok&&k.cookie)l(k.cookie),T.success("Cookie extracted from helper!");else if(k?.error==="NO_COOKIE"){const J=k.debug?.stores?.length??0,B=k.debug?.names??[];T.error(`Helper found no cf_clearance (checked ${J} stores, saw: ${B.join(", ")||"none"}) - solve the challenge on the AnimePahe tab first.`)}else T.error("Helper request failed - try again.")};f.current=ee,window.addEventListener("dango:pahe-cookie",ee),window.dispatchEvent(new CustomEvent("dango:get-pahe-cookie",{detail:{requestId:x}}))},y=()=>{const x=c.trim();if(!x){T.error("Please enter the cf_clearance cookie");return}try{z.setItem("animepahe_ua",i),z.setItem("animepahe_cookie",x),T.success("Cookie updated successfully! Reloading…"),n?.(),t(),window.setTimeout(()=>window.location.reload(),1e3)}catch{T.error("Failed to save cookie")}};return o(We,{isOpen:e,onClose:t,title:"AnimePahe Verification Required",children:o("div",{className:te.container,children:r===1?o(Z,{children:[o("p",{children:"AnimePahe requires a manual verification to bypass Cloudflare/DDoS-Guard protection."}),o("div",{className:te.field,children:[o("label",{children:"Your User-Agent (will be used for requests):"}),o("textarea",{value:i,readOnly:!0,rows:3,className:te.textarea})]}),o("div",{className:te.actions,children:[o("button",{className:te.secondaryButton,onClick:t,children:"Cancel"}),o("button",{className:te.button,onClick:S,children:"Start Verification (Opens AnimePahe)"})]})]}):o(Z,{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."]}),I&&o("div",{className:te.hint,children:[o("strong",{children:"Dango helper (one-time setup):"})," ",p?o(Z,{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(Z,{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:Ic,target:"_blank",rel:"noreferrer",className:te.link,children:"dango-extension.zip"}),". Then click Extract below and the field fills itself.",o("div",{className:te.actions,children:o("button",{className:te.button,onClick:v,disabled:u,type:"button",children:u?"Extracting…":"Extract cookie from helper"})})]}),o("div",{className:te.field,children:[o("label",{children:"cf_clearance cookie value:"}),o("input",{type:"text",value:c,onChange:x=>l(x.currentTarget.value),placeholder:"e.g. xxxxxxxx.xxxxxxxx.xxxxxxx-xxxxxxx",className:te.input})]}),o("div",{className:te.actions,children:[o("button",{className:te.secondaryButton,onClick:t,children:"Cancel"}),o("button",{className:te.secondaryButton,onClick:()=>s(1),children:"Back"}),o("button",{className:te.button,onClick:y,children:"Submit"})]})]})})})};function Oc(){const[e,t]=g(!1);return w(()=>{const n=window.setTimeout(()=>t(!0),120);return()=>window.clearTimeout(n)},[]),e?o("div",{className:"top-progress-bar",role:"progressbar","aria-label":"Loading"}):null}const Ac="_screen_1pca0_1",Lc="_icon_1pca0_14",Rc="_title_1pca0_20",$c="_text_1pca0_24",qc="_button_1pca0_29",Le={screen:Ac,icon:Lc,title:Rc,text:$c,button:qc};async function Dc(e,t){const n={message:e.message,stack:e.stack,componentStack:t.componentStack,url:typeof window<"u"?window.location.href:"",timestamp:new Date().toISOString()},r=JSON.stringify(n);try{if(navigator.sendBeacon){navigator.sendBeacon("/api/internal/client-error",new Blob([r],{type:"application/json"}));return}}catch{}fetch("/api/internal/client-error",{method:"POST",headers:{"Content-Type":"application/json"},body:r,keepalive:!0}).catch(()=>{})}class jc extends ar{state={hasError:!1};static getDerivedStateFromError(t){return{hasError:!0}}componentDidCatch(t,n){console.error("Uncaught error:",t,n),Dc(t,n)}render(){return this.state.hasError?o("div",{className:Le.screen,children:[o(C,{name:"exclamation-triangle",className:Le.icon}),o("h1",{className:Le.title,children:"Something went wrong"}),o("p",{className:Le.text,children:"The application encountered an unexpected error."}),o("button",{onClick:()=>{this.setState({hasError:!1}),window.location.href="/"},className:Le.button,children:[o(C,{name:"home"}),"Go back Home"]})]}):this.props.children}}const nr=fe(void 0),Mc=()=>{const e=he(nr);if(!e)throw new Error("useLanAuth must be used within a LanAuthProvider");return e},Fc=({children:e})=>{const[t,n]=g(!1),r=K(()=>n(!0),[]),s=K(()=>n(!1),[]);return w(()=>An("lan",r),[r]),o(nr.Provider,{value:{isOpen:t,openModal:r,closeModal:s},children:e})},Wc="_container_88bss_1",Bc="_field_88bss_8",Uc="_input_88bss_19",Hc="_actions_88bss_37",Ve={container:Wc,field:Bc,input:Uc,actions:Hc},et=cr(({variant:e="primary",size:t="md",loading:n,children:r,className:s="",disabled:i,...a},c)=>{const l=Ns("btn",`btn-${e}`,t!=="md"&&`btn-${t}`,n&&"btn-loading",s);return o("button",{className:l,disabled:i||n,ref:c,...a,children:n?o("span",{className:"btn-spinner"}):r})}),rr=({isOpen:e,onClose:t,onSuccess:n})=>{const[r,s]=g(""),[i,a]=g(!1);St.useEffect(()=>{e&&s("")},[e]);const c=async()=>{if(!r){T.error("Please enter your password");return}a(!0);try{const l=await Ct("/api/auth/app-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:r})}),u=await l.json().catch(()=>({}));if(!l.ok){T.error(u.error||"Login failed");return}T.success("Authenticated successfully"),n(),t(),window.location.reload()}catch{T.error("Network error")}finally{a(!1)}};return o(We,{isOpen:e,onClose:t,title:"LAN Authentication Required",children:o("div",{className:Ve.container,children:[o("p",{children:"This instance is protected. Enter the password to access from this device."}),o("div",{className:Ve.field,children:[o("label",{htmlFor:"lan-password",children:"Password"}),o("input",{id:"lan-password",type:"password",value:r,onChange:l=>s(l.currentTarget.value),placeholder:"Enter password...",className:Ve.input,onKeyDown:l=>l.key==="Enter"&&c()})]}),o("div",{className:Ve.actions,children:[o(et,{variant:"secondary",onClick:t,disabled:i,children:"Cancel"}),o(et,{variant:"primary",onClick:c,loading:i,children:"Unlock"})]})]})})},Kc="_notice_1d75r_1",Qc={notice:Kc},Vc=2600,zc=1e4,Gc={anilist:"Updating AniList…",mal:"Updating MyAnimeList…"};function Jc({enabled:e=!0}){const[t,n]=g(!1),[r,s]=g("mal"),[i,a]=g(document.fullscreenElement);return w(()=>{const c=()=>a(document.fullscreenElement);return document.addEventListener("fullscreenchange",c),()=>document.removeEventListener("fullscreenchange",c)},[]),w(()=>{if(!e||typeof EventSource>"u")return;const c=new EventSource("/api/tracker/activity"),l=new Map;let u;const d=new Set;let f=-1/0;const m=h=>{let p;try{p=JSON.parse(h.data)}catch{return}const _=p.provider;_!=="anilist"&&_!=="mal"||(p.updating===!0?(clearTimeout(l.get(_)),d.size===0&&Date.now()-f>=zc&&(f=Date.now(),s(_),n(!0),clearTimeout(u),u=setTimeout(()=>n(!1),Vc)),d.add(_)):p.updating===!1&&(clearTimeout(l.get(_)),l.set(_,setTimeout(()=>d.delete(_),1500))))};return c.addEventListener("tracker-activity",m),()=>{c.removeEventListener("tracker-activity",m),c.close(),clearTimeout(u);for(const h of l.values())clearTimeout(h);n(!1)}},[e]),!e||!t?null:Pt(o("div",{className:Qc.notice,role:"status","aria-live":"polite","aria-atomic":"true",children:[o(C,{name:r==="anilist"?"anilist":"myanimelist",size:15}),o("span",{children:Gc[r]})]}),i||document.body)}const Yc=M(()=>F(()=>import("./Home-BYtjQAAm.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33]))),Zc=M(()=>F(()=>import("./Watchlist-DMj82PtZ.js"),__vite__mapDeps([34,1,2,4,10,11,12,5,13,3,6,7,8,9,14,15,16,17,18,35,36,37,38,39]))),Xc=M(()=>F(()=>import("./Settings-BqOAQxhe.js"),__vite__mapDeps([40,1,2,41,42,4,43]))),cn=M(()=>F(()=>import("./Player-BopSS6Gv.js"),__vite__mapDeps([44,1,45,4,46,2,47,14,48,7,8,6,20,21,12,5,13,27,49,50,51,52,53,54,55]))),el=M(()=>F(()=>import("./WatchAlong-Cd_rNUGz.js"),__vite__mapDeps([56,1,53,54,2,4]))),tl=M(()=>F(()=>import("./Search-C2mxeTuG.js"),__vite__mapDeps([57,1,4,3,5,6,7,8,9,10,11,2,12,13,14,15,16,17,18,37,38,58,59]))),nl=M(()=>F(()=>import("./Mature--NRjmFgA.js"),__vite__mapDeps([60,1,2,4,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,27,58,59,61]))),ln=M(()=>F(()=>import("./Asmr-DB4F0zQm.js"),__vite__mapDeps([62,1,4,2,41,42,7,8,3,5,6,9,32,24,63,25,45,46,64,65,66]))),rl=M(()=>F(()=>import("./Manga-B09DXrt3.js"),__vite__mapDeps([67,1,4,41,42,7,8,17,18,3,5,6,9,22,23,2,24,25,27,68,69,64,65]))),ol=M(()=>F(()=>import("./MangaInfoPage-HniBD97j.js"),__vite__mapDeps([70,1,4,17,18,23,2,24,68,69,64,65]))),sl=M(()=>F(()=>import("./MangaReadPage-XTo4eB8e.js"),__vite__mapDeps([71,1,17,4,18,2,23,24,68,69,64,65]))),il=M(()=>F(()=>import("./ReadingList-DEOzfsq9.js"),__vite__mapDeps([72,1,3,4,5,6,7,8,9,73,15,16,17,18,35,36,22,23,2,24,25,26,19]))),un=M(()=>F(()=>import("./TvSearch-DMc5DzU4.js"),__vite__mapDeps([74,1,4,3,5,6,7,8,9,28,29,30,2,24,15,16,17,18,58,59]))),al=M(()=>F(()=>import("./TvInfo-CYh7oICz.js"),__vite__mapDeps([75,1,4,30,2,24,76]))),cl=M(()=>F(()=>import("./Tv-B8tWYqQt.js"),__vite__mapDeps([77,1,45,4,46,2,47,14,48,78,7,8,27,30,24,6,51,52,53,54,79]))),ll=M(()=>F(()=>import("./TvWatchlist-fPe4D63a.js"),__vite__mapDeps([80,1,3,4,5,6,7,8,9,73,15,16,17,18,35,36,19,29,30,2,24]))),ul=M(()=>F(()=>import("./ListeningList-B58inkaW.js"),__vite__mapDeps([81,1,3,4,5,6,7,8,9,73,15,16,17,18,35,36,63,32,2,24,25,31,19]))),dl=M(()=>F(()=>import("./Trackers-CyWVHtOz.js"),__vite__mapDeps([82,1,2,4,83]))),ml=M(()=>F(()=>import("./Insights-kd8R5HFL.js"),__vite__mapDeps([84,1,2,4,85]))),fl=M(()=>F(()=>import("./AnimeInfoPage-BTJBbJx7.js"),__vite__mapDeps([86,1,2,4]))),hl=M(()=>F(()=>import("./PlayerRedirect-fv2tzEUu.js"),__vite__mapDeps([87,1]))),pl=M(()=>F(()=>import("./VirtualKeyboard-CjOEv-Zs.js"),__vite__mapDeps([88,1,2,4,89])));function vl(){Ti();const{isOpen:e,closeModal:t,onSuccess:n}=cc(),{isOpen:r,setIsOpen:s}=Lt(),{isOpen:i,openModal:a,closeModal:c}=Mc(),l=tt(),u=lr(),d=H(new Map),f=H(l.pathname),m=oa();ac();const[h,p]=g(!1);w(()=>{const v=new AbortController;return qe("/api/auth/app-status",{signal:v.signal}).then(y=>{y.hasPassword&&!y.isAuthenticated&&(p(!0),a())}).catch(()=>{v.signal.aborted||T.error("Could not check server access. The server may still be starting; reload to retry.")}),()=>v.abort()},[a]);const[_,I]=Rt("lan_auth_notice_shown","false"),S=H(!1);return w(()=>{if(_==="true"||S.current)return;S.current=!0,I("true");const v=setTimeout(()=>{T("Optional LAN lock is available. Set a password in Settings to protect access from other devices on your network.",{duration:1e4,icon:"🔒"})},3e3);return()=>clearTimeout(v)},[_,I]),w(()=>{try{window.history.scrollRestoration="manual"}catch{}},[]),w(()=>{const v=l.key,y=d.current;if(u==="POP"){const x=y.get(v)??0;window.scrollTo({top:x,behavior:"instant"})}else l.pathname!==f.current&&window.scrollTo({top:0,behavior:"instant"});return f.current=l.pathname,()=>{y.set(v,window.scrollY)}},[l.key,l.pathname,u]),w(()=>{const v=y=>{r&&y.key==="Escape"&&s(!1)};return r?document.body.classList.add("sidebar-open"):document.body.classList.remove("sidebar-open"),window.addEventListener("keydown",v),()=>{window.removeEventListener("keydown",v),document.body.classList.remove("sidebar-open")}},[r,s]),o("div",{className:"app-container",children:[o(Cc,{isOpen:e,onClose:t,onSuccess:n}),o(rr,{isOpen:i,onClose:h?()=>{}:c,onSuccess:()=>{p(!1),c()}}),o(En,{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(Jc,{enabled:!h&&!i}),o(Na,{}),o(Ba,{}),o("main",{className:"main-content",children:o(jc,{children:o(qt,{fallback:o(Oc,{}),children:o(ur,{children:[o(R,{path:"/",element:o(Yc,{})}),o(R,{path:"/watchlist/:filter?",element:o(Zc,{})}),o(R,{path:"/reading-list/:filter?",element:o(il,{})}),o(R,{path:"/search",element:o(tl,{})}),o(R,{path:"/mature",element:o(nl,{})}),o(R,{path:"/asmr",element:o(ln,{})}),o(R,{path:"/asmr/:rj",element:o(ln,{})}),o(R,{path:"/manga",element:o(rl,{})}),o(R,{path:"/manga/:provider/:id",element:o(ol,{})}),o(R,{path:"/manga/:provider/:id/read",element:o(sl,{})}),o(R,{path:"/tv",element:o(un,{})}),o(R,{path:"/tv/:id",element:o(al,{})}),o(R,{path:"/tv/:id/watch",element:o(cl,{})}),o(R,{path:"/tv-search",element:o(un,{})}),o(R,{path:"/tv-watchlist/:filter?",element:o(ll,{})}),o(R,{path:"/listening-list/:filter?",element:o(ul,{})}),o(R,{path:"/settings",element:o(Xc,{})}),o(R,{path:"/trackers",element:o(dl,{})}),o(R,{path:"/mal",element:o(Dt,{to:"/trackers",replace:!0})}),o(R,{path:"/insights",element:o(ml,{})}),o(R,{path:"/anime/:id",element:o(fl,{})}),o(R,{path:"/watch/:id",element:o(cn,{})}),o(R,{path:"/watch-along",element:o(el,{})}),o(R,{path:"/watch/:id/:episodeNumber",element:o(cn,{})}),o(R,{path:"/player/:id/:episodeNumber?",element:o(hl,{})}),o(R,{path:"*",element:o(Dt,{to:"/",replace:!0})})]})})})}),o(ic,{}),m.isVisible&&o(qt,{fallback:null,children:o(pl,{activeInputRef:m.activeInputRef,isVisible:m.isVisible,onClose:m.hide})})]})}function yl(){return o(Fc,{children:o(vl,{})})}const gl=({children:e})=>{const[t,n]=g(!1),r=K(()=>{n(i=>!i)},[]),s=Ce(()=>({isOpen:t,setIsOpen:n,toggleSidebar:r}),[t,r]);return o(Un.Provider,{value:s,children:e})},bl=({children:e})=>{const[t,n]=Rt("dango_content_type","anime"),r=Ce(()=>({contentType:t,setContentType:n}),[t,n]);return o(Hn.Provider,{value:r,children:e})},wl=({children:e})=>{const[t,n]=g("englishName"),[r,s]=g(!0);w(()=>{(async()=>{try{const c=await ae.settings.getByKey.query({key:"titlePreference"});c.value&&n(c.value)}catch(c){console.error("Error fetching title preference in context:",c)}finally{s(!1)}})()},[]);const i=Ce(()=>({titlePreference:t,setTitlePreference:n,loading:r}),[t,r]);return o(Rn.Provider,{value:i,children:e})},_l=({children:e})=>{const{data:t,isLoading:n}=it("lowEndMode"),r=jn(),s=X(),[i,a]=g(!1);w(()=>{const u=s.getDefaultOptions();s.setDefaultOptions({...u,queries:{...u.queries,gcTime:i?900*1e3:1800*1e3}})},[i,s]),w(()=>{t!==void 0&&a(t==="true"||t===!0)},[t]),w(()=>{i?document.body.classList.add("low-end"):document.body.classList.remove("low-end")},[i]);const c=K(u=>{a(u),r.mutate({key:"lowEndMode",value:String(u)})},[r]),l=Ce(()=>({lowEndMode:i,setLowEndMode:c,loading:n}),[i,c,n]);return o(Mn.Provider,{value:l,children:e})},El=["iris","mochi","sakura"];function dn(e){e==="iris"?document.documentElement.removeAttribute("data-theme"):document.documentElement.setAttribute("data-theme",e)}const kl=({children:e})=>{const{data:t,isLoading:n}=it("theme"),r=jn(),[s,i]=g("iris");w(()=>{typeof t=="string"&&El.includes(t)&&i(t)},[t]),w(()=>{dn(s)},[s]);const a=K(l=>{l!==s&&(i(l),dn(l),r.mutate({key:"theme",value:l}))},[r,s]),c=Ce(()=>({theme:s,setTheme:a,loading:n}),[s,a,n]);return o(Wn.Provider,{value:c,children:e})},Sl=({children:e})=>{const[t,n]=g(!1),[r,s]=g(void 0),i=K(c=>{s(()=>c),n(!0)},[]),a=K(()=>{n(!1),s(void 0)},[]);return w(()=>An("animepahe",()=>i()),[i]),o(Zn.Provider,{value:{isOpen:t,openModal:i,closeModal:a,onSuccess:r},children:e})},Pl="_gate_r3yn2_1",Tl="_panel_r3yn2_10",xl="_form_r3yn2_18",Il="_field_r3yn2_31",Nl="_avatarRow_r3yn2_48",Cl="_profileList_r3yn2_60",Ol="_smallAvatar_r3yn2_73",Al="_profileName_r3yn2_78",xe={gate:Pl,panel:Tl,form:xl,field:Il,avatarRow:Nl,profileList:Cl,smallAvatar:Ol,profileName:Al};function Ll({children:e}){const[t,n]=g(!1),[r,s]=g(!1),[i,a]=g([]),[c,l]=g(""),[u,d]=g(""),[f,m]=g(""),[h,p]=g(!1),[_,I]=g(0);if(w(()=>{let v=!1;return m(""),(async()=>{const x=await qe("/api/auth/app-status");if(v)return;if(x.hasPassword&&!x.isAuthenticated){s(!0);return}const G=await qe("/api/profiles/status");v||(G.current?(ws(G.current.id),n(!0)):(a(G.profiles),l(G.profiles[0]?.id??"")))})().catch(x=>{v||m(x.message)}),()=>{v=!0}},[_]),w(()=>{const v=x=>{x.key==="dango:profile-session-change"&&window.location.reload()},y=()=>{n(!1),I(x=>x+1)};return window.addEventListener("storage",v),window.addEventListener("dango:profile-auth-required",y),()=>{window.removeEventListener("storage",v),window.removeEventListener("dango:profile-auth-required",y)}},[]),t)return e;const S=i.find(v=>v.id===c);return o("div",{className:xe.gate,children:[o(En,{}),o(rr,{isOpen:r,onClose:()=>{},onSuccess:()=>{s(!1),I(v=>v+1)}}),o("section",{className:xe.panel,children:[o("h1",{children:i.length?"Choose your profile":"Connecting to Dango…"}),S&&o(Z,{children:[o("div",{className:xe.avatarRow,children:o(Vn,{image:S.avatar??S.cloudAvatar,name:S.name})}),o("form",{className:xe.form,onSubmit:async v=>{v.preventDefault(),p(!0),m("");try{await qe("/api/profiles/login",{method:"POST",body:JSON.stringify({id:c,password:u})}),Es()}catch(y){m(y.message),p(!1)}},children:[o("label",{className:xe.field,children:["Profile",o("select",{value:c,onChange:v=>{l(v.currentTarget.value),d(""),m("")},children:i.map(v=>o("option",{value:v.id,children:[v.name,v.owner?" (owner)":""]},v.id))})]}),S.protected&&o("label",{className:xe.field,children:["Password",o("input",{type:"password",autoComplete:"current-password",required:!0,maxLength:256,value:u,onChange:v=>d(v.currentTarget.value)})]}),o(et,{type:"submit",loading:h,children:"Continue"})]})]}),f&&o(Z,{children:[o("p",{role:"alert",children:f}),o(et,{variant:"secondary",onClick:()=>I(v=>v+1),children:"Retry"})]})]})]})}const or=fe(null);function yu(){const e=he(or);if(!e)throw new Error("WatchAlongProvider is missing");return e}const Rl=/^[0-9a-f-]{36}$/,$l=/^[0-9a-f]{64}$/;function gu(e,t){return(e.kind??"anime")===(t.kind??"anime")&&e.season===t.season&&e.showId===t.showId&&e.episode===t.episode&&e.provider===t.provider&&e.mode===t.mode&&e.source===t.source}function bu(e,t){return e.position+(e.playing?Math.max(0,t-e.updatedAt)/1e3*e.rate:0)}const $t=e=>String(e).toLowerCase()==="movie"?"movie":"tv",wu=(e,t)=>`${$t(e)}:${t}`,_u=(e,t)=>{const n=$t(e);return`/tv/${t}?type=${n}`},ql=(e,t,n,r)=>{const s=new URLSearchParams;return s.set("type",$t(e)),n!==void 0&&s.set("s",String(n)),r!==void 0&&s.set("e",String(r)),`/tv/${t}/watch?${s.toString()}`},Eu=e=>e.adult===!0||e.adult===1,ku={10759:"Action & Adventure",16:"Animation",35:"Comedy",80:"Crime",99:"Documentary",18:"Drama",10751:"Family",10762:"Kids",9648:"Mystery",10765:"Sci-Fi & Fantasy",37:"Western"},Su={28:"Action",12:"Adventure",16:"Animation",35:"Comedy",80:"Crime",99:"Documentary",18:"Drama",10751:"Family",14:"Fantasy",36:"History",27:"Horror",9648:"Mystery",10749:"Romance",878:"Sci-Fi",53:"Thriller",10752:"War",37:"Western"};function Dl(e){return e.kind==="tv"||e.kind==="movie"?ql(e.kind,e.showId,e.kind==="tv"?e.season:void 0,e.kind==="tv"?Number(e.episode):void 0):`/watch/${encodeURIComponent(e.showId)}/${encodeURIComponent(e.episode)}`}function Re(e,t){let n=e.trim().replace(/^#/,"");if(n.includes("://")){const a=new URL(n);if(a.origin!==new URL(t).origin||!["/join","/watch-along"].includes(a.pathname))throw new Error("Use an invite from this dango watch-along service.");n=a.hash.slice(1)}const[r,s,i]=n.split(".");if(!Rl.test(r||"")||!$l.test(s||"")||i!==void 0)throw new Error("Paste a complete watch-along invite link or room code.");return{id:r,token:s,guestToken:s,host:!1}}const ft="dango-watch-along";function jl({children:e}){const t=hn(),n=tt(),[r,s]=Rt("watchAlongName",""),[i,a]=g(()=>{try{const k=JSON.parse(sessionStorage.getItem(ft)||"null");if(!k)return null;const J=Re(`${k.id}.${k.guestToken}`,""),B=Re(`${k.id}.${k.token}`,"");return{...J,token:B.token,host:k.host===!0}}catch{return null}}),[c,l]=g(null),[u,d]=g(!1),[f,m]=g(""),[h,p]=g(""),[_,I]=g({offset:0,latency:0}),S=H(null),{data:v}=re({queryKey:["watch-along-config"],queryFn:()=>ae.settings.watchAlong.query()}),y=v?.workerUrl.replace(/\/$/,"")||"";w(()=>{try{i?sessionStorage.setItem(ft,JSON.stringify(i)):sessionStorage.removeItem(ft)}catch{}},[i]);const x=K(k=>{S.current?.readyState===WebSocket.OPEN&&S.current.send(JSON.stringify(k))},[]);w(()=>{if(!u)return;const k=setTimeout(()=>x({type:"name",name:r}),250);return()=>clearTimeout(k)},[u,h,r,x]);const G=K(()=>{i?.host&&x({type:"end"}),S.current?.close(1e3,"Left room"),a(null),l(null),d(!1),m("")},[x,i]),ee=async k=>{if(!y)throw new Error("Watch along is unavailable. Check your server configuration.");const J=await fetch(`${y}/rooms`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(k),signal:AbortSignal.timeout(15e3)}),B=await J.json();if(!J.ok)throw new Error(B.error||"Could not create room");const b=Re(`${B.id}.${B.guestToken}`,y),N=Re(`${B.id}.${B.hostToken}`,y);m(""),l(null),a({...b,token:N.token,host:!0})},ge=k=>{if(!y)throw new Error("Watch along is unavailable. Check your server configuration.");const J=Re(k,y);m(""),l(null),a(J)};return w(()=>{if(!i||!y)return;let k=!1,J=0,B,b,N=Date.now();const P=async()=>{if(k)return;try{const oe=await fetch(`${y}/rooms/${i.id}`,{headers:{Authorization:`Bearer ${i.token}`},signal:AbortSignal.timeout(1e4)});if(k)return;if(!oe.ok){const O=await oe.json();if([403,404,409].includes(oe.status)){m(O.error||"Unable to join room"),a(null),l(null);return}throw new Error(O.error||"Room service unavailable")}}catch{if(k)return;m("Cannot reach the room service. Retrying…"),B=setTimeout(P,Math.min(15e3,1e3*2**Math.min(J++,4)));return}const D=new URL(`${y}/rooms/${i.id}/ws`);D.protocol=D.protocol==="https:"?"wss:":"ws:";const W=new WebSocket(D,["dango-watch-along",i.token]);S.current=W,W.onopen=()=>{N=Date.now()},W.onmessage=oe=>{if(!(k||S.current!==W)){N=Date.now();try{const O=JSON.parse(oe.data);if(O.type==="joined"){if(O.host!==i.host){W.close(4003,"Invalid role");return}J=0,d(!0),m(""),p(O.id),W.send(JSON.stringify({type:"ping",sentAt:Date.now()}))}else if(O.type==="state")l(ce=>ce&&ce.revision>O.state.revision?ce:O.state);else if(O.type==="pong"){const ce=Date.now()-O.sentAt;I({offset:O.serverTime-(O.sentAt+ce/2),latency:ce/2})}else O.type==="error"&&m(O.error)}catch{m("Invalid response from the room service.")}}},W.onclose=oe=>{if(!(k||S.current!==W)){if(clearInterval(b),d(!1),[4003,4004,4009].includes(oe.code)){m(oe.reason||"Room closed"),a(null),l(null);return}m("Connection lost. Reconnecting…"),B=setTimeout(P,Math.min(15e3,1e3*2**Math.min(J++,4)))}},W.onerror=()=>W.close(),b=setInterval(()=>{Date.now()-N>25e3?W.close():W.readyState===WebSocket.OPEN&&W.send(JSON.stringify({type:"ping",sentAt:Date.now()}))},1e4)};return P(),()=>{k=!0,clearTimeout(B),clearInterval(b),S.current?.close(1e3,"Leaving connection"),S.current=null,d(!1)}},[i,y]),w(()=>{if(!i||i.host||!c)return;const k=Dl(c.selection);`${n.pathname}${n.search}`!==k&&t(k,{replace:!0})},[i,c,n.pathname,n.search,t]),o(or.Provider,{value:{workerUrl:y,displayName:r,setDisplayName:s,session:i,room:c,connected:u,error:f,selfId:h,clock:_,create:ee,join:ge,leave:G,send:x},children:e})}try{window.history.scrollRestoration="manual"}catch{}const mn=new pr({defaultOptions:{queries:{staleTime:1e3*60*5,gcTime:1800*1e3,refetchOnWindowFocus:!1,refetchIntervalInBackground:!1,retry:1}}}),fn=document.getElementById("root");fn&&dr(o(Ll,{children:o(mr,{children:o(Ts,{trpcClient:ae,queryClient:mn,children:o(vr,{client:mn,children:o(Sl,{children:o(gl,{children:o(bl,{children:o(wl,{children:o(_l,{children:o(kl,{children:o(jl,{children:o(yl,{})})})})})})})})})})})}),fn);export{ct as $,Kl as A,et as B,du as C,su as D,ru as E,T as F,it as G,jn as H,cu as I,lu as J,au as K,We as L,Su as M,sa as N,qe as O,xe as P,Vn as Q,Es as R,Ct as S,ku as T,Q as U,fu as V,hu as W,on as X,Qn as Y,rn as Z,F as _,Rt as a,Hl as a0,te as a1,yu as a2,Cc as a3,Gl as a4,ra as a5,vu as a6,An as a7,$t as a8,wu as a9,pu as aa,gu as ab,bu as ac,Lt as ad,mu as ae,Oc as af,Xl as ag,eu as ah,Zl as ai,Ql as b,Vl as c,Os as d,Ca as e,Is as f,Bl as g,ql as h,Eu as i,_u as j,Cs as k,q as l,zl as m,Kn as n,iu as o,z as p,$ as q,Jl as r,Ul as s,ae as t,mi as u,Yl as v,tu as w,nu as x,uu as y,ou as z};
|