@serifpersia/dango 3.3.6 → 3.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/README.md +1 -1
  2. package/client/dist/assets/{AnimeCard-OKU7LaSN.js → AnimeCard-WlhU88fn.js} +1 -1
  3. package/client/dist/assets/{AnimeInfo-BCyLw0yz.js → AnimeInfo-BCLagpbu.js} +1 -1
  4. package/client/dist/assets/{AnimeInfoPage-BZWl-TJY.js → AnimeInfoPage-o0U_OXKP.js} +2 -2
  5. package/client/dist/assets/{Asmr-4S6uoevp.js → Asmr-ieGJ_BcQ.js} +1 -1
  6. package/client/dist/assets/{AsmrResetProgressModal-C8i6weqW.js → AsmrResetProgressModal-BwaoVski.js} +1 -1
  7. package/client/dist/assets/{AvSyncCalibrator-oK6LlG61.js → AvSyncCalibrator-CXvBuY4l.js} +1 -1
  8. package/client/dist/assets/Home-DjLpvsp8.js +1 -0
  9. package/client/dist/assets/Insights-Dc8xLmsr.css +1 -0
  10. package/client/dist/assets/Insights-lQcQoeES.js +1 -0
  11. package/client/dist/assets/LibraryListPage-B2nhFFrc.js +1 -0
  12. package/client/dist/assets/{ListeningList-Dxkhy6E2.js → ListeningList-okIpsKCr.js} +1 -1
  13. package/client/dist/assets/{Manga-pJEpcUpo.js → Manga-3u9nVNZC.js} +1 -1
  14. package/client/dist/assets/{MangaInfoPage-BEQsjTHH.js → MangaInfoPage-Cat-B487.js} +1 -1
  15. package/client/dist/assets/{MangaReadPage-C0WAtK-1.js → MangaReadPage-CyLRxzvl.js} +1 -1
  16. package/client/dist/assets/{MangaResetProgressModal-WjKH_G_f.js → MangaResetProgressModal-Ch8RjwbO.js} +1 -1
  17. package/client/dist/assets/Mature-pINwl5wj.js +1 -0
  18. package/client/dist/assets/{MediaCard-DszKDA4s.js → MediaCard-DDiYEAm8.js} +1 -1
  19. package/client/dist/assets/{Music-CU6TBHF5.js → Music-B1swlVLI.js} +1 -1
  20. package/client/dist/assets/{OptionListMenu-CkK2BvEz.js → OptionListMenu-CzH2VSPh.js} +1 -1
  21. package/client/dist/assets/Player-SKPWb-o8.js +56 -0
  22. package/client/dist/assets/PlayerSettings-jrmY95-i.js +1 -0
  23. package/client/dist/assets/{QueueOptionsButton-DKWi-9kd.js → QueueOptionsButton-CcVP7Vi6.js} +1 -1
  24. package/client/dist/assets/{QueueRail-DAcIex5B.js → QueueRail-Cj-PU9EV.js} +1 -1
  25. package/client/dist/assets/{Radio-BhTsgGGd.js → Radio-CRlbaxQt.js} +1 -1
  26. package/client/dist/assets/{ReadingList-BLnkwB--.js → ReadingList-wRtHGNo8.js} +1 -1
  27. package/client/dist/assets/{ResetProgressModal-8mcLXaAb.js → ResetProgressModal-BokfoYFB.js} +1 -1
  28. package/client/dist/assets/Search-BOOBeTVA.js +1 -0
  29. package/client/dist/assets/{Settings-bSA7BG7h.js → Settings-BgrcswJD.js} +1 -1
  30. package/client/dist/assets/SkeletonGrid-Bge3aRl2.css +1 -0
  31. package/client/dist/assets/SkeletonGrid-C6S7OYHn.js +1 -0
  32. package/client/dist/assets/{Trackers-BXSONaRD.js → Trackers-DLcTEJJW.js} +1 -1
  33. package/client/dist/assets/{Tv-DJTbg4VW.js → Tv-ByVckozq.js} +1 -1
  34. package/client/dist/assets/{TvInfo-Z0c1Wh3i.js → TvInfo-fJ9SFMK8.js} +1 -1
  35. package/client/dist/assets/{TvPopup-CP41CncZ.js → TvPopup-yfH7p0y0.js} +1 -1
  36. package/client/dist/assets/TvSearch-CBNWDByW.js +1 -0
  37. package/client/dist/assets/{TvWatchlist-COCWPkgh.js → TvWatchlist-BqjZ2-4A.js} +1 -1
  38. package/client/dist/assets/Watchlist-B_Q2hEiJ.js +1 -0
  39. package/client/dist/assets/{hls-B_yo8-yR.js → hls-kIF7bMpF.js} +1 -1
  40. package/client/dist/assets/{index-lo-bz7f2.js → index-C65i4HWv.js} +2 -2
  41. package/client/dist/assets/{useAnimeInfoData-CbNnHRj8.js → useAnimeInfoData-BKSrS8eN.js} +1 -1
  42. package/client/dist/assets/{useAsmr-BEcgHwxg.js → useAsmr-Byj8Qiwp.js} +1 -1
  43. package/client/dist/assets/{useAsmrPopup-BXD3y2m1.js → useAsmrPopup-CLcWCCXf.js} +1 -1
  44. package/client/dist/assets/{useMangaLibrary-BXhgN-dl.js → useMangaLibrary-U7tUo8nx.js} +1 -1
  45. package/client/dist/assets/{useMangaPopup-BvgtZ53s.js → useMangaPopup-ZonOP5_c.js} +1 -1
  46. package/client/dist/assets/{useProviders-xlftutIo.js → useProviders-CymA42ZB.js} +1 -1
  47. package/client/dist/assets/{useTv-DTqrJEWp.js → useTv-CPj6Cf42.js} +1 -1
  48. package/client/dist/assets/{useTvLibrary-BHeWSd1F.js → useTvLibrary-COsyN8yu.js} +1 -1
  49. package/client/dist/index.html +1 -1
  50. package/package.json +2 -2
  51. package/server/dist/controllers/insights.controller.js +5 -1
  52. package/server/dist/controllers/proxy.controller.js +94 -23
  53. package/server/dist/controllers/watchlist.controller.js +42 -0
  54. package/server/dist/lib/discord-roles-sync.service.js +237 -2
  55. package/server/dist/repositories/insights.repository.js +10 -0
  56. package/server/dist/repositories/shows-meta.repository.js +4 -1
  57. package/server/dist/repositories/watchlist.repository.js +1 -0
  58. package/server/dist/routes/insights.routes.js +1 -0
  59. package/server/package.json +1 -1
  60. package/client/dist/assets/Home-CQ4Ikeja.js +0 -1
  61. package/client/dist/assets/Insights-DKtoVe6L.css +0 -1
  62. package/client/dist/assets/Insights-DiAo0UAc.js +0 -1
  63. package/client/dist/assets/LibraryListPage-B0MDTnEc.js +0 -1
  64. package/client/dist/assets/Mature-Ckx99wFj.js +0 -1
  65. package/client/dist/assets/Player-C3yWQkXb.js +0 -56
  66. package/client/dist/assets/PlayerSettings-CBdTzo0E.js +0 -1
  67. package/client/dist/assets/Search-DxX021dj.js +0 -1
  68. package/client/dist/assets/SkeletonGrid-DhPYefXr.css +0 -1
  69. package/client/dist/assets/SkeletonGrid-Du10CNfq.js +0 -1
  70. package/client/dist/assets/TvSearch-BlqTQYJa.js +0 -1
  71. package/client/dist/assets/Watchlist-BHLshSPX.js +0 -1
@@ -1 +1 @@
1
- import{b as A}from"./vendor-query-BXRECSI6.js";import{q as V,j as Z,Z as H,$ as J,a0 as W}from"./index-lo-bz7f2.js";import{d as X,T as R,q as r,u as t,$ as Y,S as w}from"./vendor-core-8R2fFbyN.js";import{a as ee,c as te,d as ne,b as se,o as oe,f as ae,s as ie}from"./vendor-ui-CUDCvRS_.js";import{I as u}from"./vendor-icons-CDMuNDeL.js";function Pe(n){return A({queryKey:["show-meta",n],queryFn:async()=>n?V(`/api/show-meta/${n}`):{},enabled:!!n,staleTime:3e4})}async function re(n){const d=await fetch(`/api/queue/suggested/${n}`);if(!d.ok)throw new Error("Failed to resolve suggested episode");return d.json()}const ue="_trigger_1vova_6",me="_triggerBtn_1vova_11",le="_chevron_1vova_25",ce="_menu_1vova_34",pe="_menuTitle_1vova_51",de="_menuItem_1vova_60",ge="_removeItem_1vova_91",fe="_menuEmpty_1vova_99",a={trigger:ue,triggerBtn:me,chevron:le,menu:ce,menuTitle:pe,menuItem:de,removeItem:ge,menuEmpty:fe},ve=8,$e=({showId:n,showName:d,showThumbnail:h,nativeName:y,englishName:_,showType:b,className:F="",activeClassName:T="",align:z="right",onMenuOpenChange:g})=>{const{data:E=[]}=Z(),P=H(),$=J(),[m,v]=X(!1),{refs:q,floatingStyles:D,context:x}=ee({open:m,onOpenChange:e=>{e||(v(!1),g?.(!1))},placement:z==="left"?"bottom-start":"bottom-end",middleware:[oe(ve),ae({padding:8}),ie({padding:8})],whileElementsMounted:se}),I=te(x,{outsidePress:!0,escapeKey:!0,referencePress:!1}),{getReferenceProps:M,getFloatingProps:S}=ne([I]),l=R(()=>E.filter(e=>e.showId===n),[E,n]),{data:C}=A({queryKey:["suggestedEpisode",n],queryFn:()=>re(n),enabled:!!n}),{data:Q,isFetching:N}=W(n,m),s=R(()=>Q?.episodes||[],[Q]),k=r(()=>{v(!0),g?.(!0)},[g]),c=r(()=>{v(!1),g?.(!1)},[g]),p=l.length>0,o=s.length>0,f=C?.episodeNumber,i=r(e=>{!n||e.length===0||(P.mutate({showId:n,episodeNumbers:e,showName:d,showThumbnail:h,nativeName:y,englishName:_,type:b}),c())},[n,d,h,y,_,b,P,c]),K=r(()=>{!n||l.length===0||($.mutate({showId:n,episodeNumbers:l.map(e=>e.episodeNumber)}),c())},[n,l,$,c]),j=r(()=>{o?i([s[0]]):f&&i([String(f)])},[o,s,f,i]),L=r(()=>{o&&i(s.slice(0,3))},[o,s,i]),O=r(()=>{o&&i([...s])},[o,s,i]),B=s[0],U=s[Math.min(2,s.length-1)],G=t("div",{className:a.trigger,ref:q.setReference,children:t("span",{className:`${a.triggerBtn} ${F} ${p?T:""}`,role:"button",tabIndex:0,"aria-haspopup":"menu","aria-expanded":m,"aria-label":p?"Queued":"Queue",...M(),onClick:e=>{e.preventDefault(),e.stopPropagation(),m?c():k()},onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),e.stopPropagation(),m?c():k())},children:[p?t(u,{name:"check",size:14}):t(u,{name:"plus",size:14}),p?"Queued":"Queue",t(u,{name:"chevron-down",size:10,className:a.chevron})]})});return t(w,{children:[G,m&&Y(t("div",{ref:q.setFloating,className:a.menu,style:D,role:"menu",...S(),onMouseDown:e=>e.stopPropagation(),onClick:e=>{e.preventDefault(),e.stopPropagation()},children:[t("div",{className:a.menuTitle,children:"Queue episodes"}),t("button",{className:a.menuItem,role:"menuitem",type:"button",disabled:!o&&!f,onClick:e=>{e.stopPropagation(),j()},children:[t(u,{name:"plus",size:11}),t("span",{children:o?`+1 — EP ${B}`:`+1 — EP ${f||"?"}`})]}),t("button",{className:a.menuItem,role:"menuitem",type:"button",disabled:!o,onClick:e=>{e.stopPropagation(),L()},children:[t(u,{name:"plus",size:11}),t("span",{children:o?`+3 — EP ${B}${s.length>1?`-${U}`:""}`:"+3"})]}),t("button",{className:a.menuItem,role:"menuitem",type:"button",disabled:!o,onClick:e=>{e.stopPropagation(),O()},children:[t(u,{name:"plus",size:11}),t("span",{children:["All Remaining",N?"":` (${Math.max(s.length,0)})`]})]}),!N&&s.length===0&&t("div",{className:a.menuEmpty,children:p?"All episodes are already queued":"No remaining unwatched episodes"}),p&&t("button",{className:`${a.menuItem} ${a.removeItem}`,role:"menuitem",type:"button",onClick:e=>{e.stopPropagation(),K()},children:[t(u,{name:"times",size:11}),t("span",{children:["Remove from Queue",l.length>0?` (${l.length})`:""]})]})]}),document.body)]})};export{$e as Q,Pe as u};
1
+ import{b as A}from"./vendor-query-BXRECSI6.js";import{q as V,j as Z,Z as H,$ as J,a0 as W}from"./index-C65i4HWv.js";import{d as X,T as R,q as r,u as t,$ as Y,S as w}from"./vendor-core-8R2fFbyN.js";import{a as ee,c as te,d as ne,b as se,o as oe,f as ae,s as ie}from"./vendor-ui-CUDCvRS_.js";import{I as u}from"./vendor-icons-CDMuNDeL.js";function Pe(n){return A({queryKey:["show-meta",n],queryFn:async()=>n?V(`/api/show-meta/${n}`):{},enabled:!!n,staleTime:3e4})}async function re(n){const d=await fetch(`/api/queue/suggested/${n}`);if(!d.ok)throw new Error("Failed to resolve suggested episode");return d.json()}const ue="_trigger_1vova_6",me="_triggerBtn_1vova_11",le="_chevron_1vova_25",ce="_menu_1vova_34",pe="_menuTitle_1vova_51",de="_menuItem_1vova_60",ge="_removeItem_1vova_91",fe="_menuEmpty_1vova_99",a={trigger:ue,triggerBtn:me,chevron:le,menu:ce,menuTitle:pe,menuItem:de,removeItem:ge,menuEmpty:fe},ve=8,$e=({showId:n,showName:d,showThumbnail:h,nativeName:y,englishName:_,showType:b,className:F="",activeClassName:T="",align:z="right",onMenuOpenChange:g})=>{const{data:E=[]}=Z(),P=H(),$=J(),[m,v]=X(!1),{refs:q,floatingStyles:D,context:x}=ee({open:m,onOpenChange:e=>{e||(v(!1),g?.(!1))},placement:z==="left"?"bottom-start":"bottom-end",middleware:[oe(ve),ae({padding:8}),ie({padding:8})],whileElementsMounted:se}),I=te(x,{outsidePress:!0,escapeKey:!0,referencePress:!1}),{getReferenceProps:M,getFloatingProps:S}=ne([I]),l=R(()=>E.filter(e=>e.showId===n),[E,n]),{data:C}=A({queryKey:["suggestedEpisode",n],queryFn:()=>re(n),enabled:!!n}),{data:Q,isFetching:N}=W(n,m),s=R(()=>Q?.episodes||[],[Q]),k=r(()=>{v(!0),g?.(!0)},[g]),c=r(()=>{v(!1),g?.(!1)},[g]),p=l.length>0,o=s.length>0,f=C?.episodeNumber,i=r(e=>{!n||e.length===0||(P.mutate({showId:n,episodeNumbers:e,showName:d,showThumbnail:h,nativeName:y,englishName:_,type:b}),c())},[n,d,h,y,_,b,P,c]),K=r(()=>{!n||l.length===0||($.mutate({showId:n,episodeNumbers:l.map(e=>e.episodeNumber)}),c())},[n,l,$,c]),j=r(()=>{o?i([s[0]]):f&&i([String(f)])},[o,s,f,i]),L=r(()=>{o&&i(s.slice(0,3))},[o,s,i]),O=r(()=>{o&&i([...s])},[o,s,i]),B=s[0],U=s[Math.min(2,s.length-1)],G=t("div",{className:a.trigger,ref:q.setReference,children:t("span",{className:`${a.triggerBtn} ${F} ${p?T:""}`,role:"button",tabIndex:0,"aria-haspopup":"menu","aria-expanded":m,"aria-label":p?"Queued":"Queue",...M(),onClick:e=>{e.preventDefault(),e.stopPropagation(),m?c():k()},onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),e.stopPropagation(),m?c():k())},children:[p?t(u,{name:"check",size:14}):t(u,{name:"plus",size:14}),p?"Queued":"Queue",t(u,{name:"chevron-down",size:10,className:a.chevron})]})});return t(w,{children:[G,m&&Y(t("div",{ref:q.setFloating,className:a.menu,style:D,role:"menu",...S(),onMouseDown:e=>e.stopPropagation(),onClick:e=>{e.preventDefault(),e.stopPropagation()},children:[t("div",{className:a.menuTitle,children:"Queue episodes"}),t("button",{className:a.menuItem,role:"menuitem",type:"button",disabled:!o&&!f,onClick:e=>{e.stopPropagation(),j()},children:[t(u,{name:"plus",size:11}),t("span",{children:o?`+1 — EP ${B}`:`+1 — EP ${f||"?"}`})]}),t("button",{className:a.menuItem,role:"menuitem",type:"button",disabled:!o,onClick:e=>{e.stopPropagation(),L()},children:[t(u,{name:"plus",size:11}),t("span",{children:o?`+3 — EP ${B}${s.length>1?`-${U}`:""}`:"+3"})]}),t("button",{className:a.menuItem,role:"menuitem",type:"button",disabled:!o,onClick:e=>{e.stopPropagation(),O()},children:[t(u,{name:"plus",size:11}),t("span",{children:["All Remaining",N?"":` (${Math.max(s.length,0)})`]})]}),!N&&s.length===0&&t("div",{className:a.menuEmpty,children:p?"All episodes are already queued":"No remaining unwatched episodes"}),p&&t("button",{className:`${a.menuItem} ${a.removeItem}`,role:"menuitem",type:"button",onClick:e=>{e.stopPropagation(),K()},children:[t(u,{name:"times",size:11}),t("span",{children:["Remove from Queue",l.length>0?` (${l.length})`:""]})]})]}),document.body)]})};export{$e as Q,Pe as u};
@@ -1 +1 @@
1
- import{g as s,u as n,a as Y}from"./vendor-core-8R2fFbyN.js";import{I as P}from"./vendor-icons-CDMuNDeL.js";import{d as L,f as z}from"./index-lo-bz7f2.js";const F="_section_1pwqc_1",O="_header_1pwqc_10",j="_headerToggle_1pwqc_20",G="_headerActions_1pwqc_34",J="_title_1pwqc_40",K="_badge_1pwqc_50",V="_clearBtn_1pwqc_65",W="_nextBtn_1pwqc_83",Z="_list_1pwqc_101",ee="_item_1pwqc_114",ne="_active_1pwqc_134",te="_dragging_1pwqc_142",re="_dragHandle_1pwqc_149",ce="_thumbnail_1pwqc_167",ae="_meta_1pwqc_175",oe="_name_1pwqc_182",se="_episode_1pwqc_204",ie="_iconBtn_1pwqc_210",r={section:F,header:O,headerToggle:j,headerActions:G,title:J,badge:K,clearBtn:V,nextBtn:W,list:Z,item:ee,active:ne,dragging:te,dragHandle:re,thumbnail:ce,meta:ae,name:oe,episode:se,iconBtn:ie},le=({item:c,isActive:T,index:m,onRemove:D,onTouchPointerDown:v,onTouchPointerMove:x,onTouchPointerUp:q,onTouchPointerCancel:I,shouldIgnoreClick:_,onDragStart:B,onDragEnter:f,onDragEnd:o,isDragging:w})=>{const a=Y(),{titlePreference:i}=L(),l=c[i]||c.name||"Unknown show";return n("div",{"data-queue-index":m,className:`${r.item} ${T?r.active:""} ${w?r.dragging:""}`,draggable:!0,onDragStart:B,onDragEnter:f,onDragOver:u=>u.preventDefault(),onDragEnd:o,onPointerDown:u=>v(m,u),onPointerMove:x,onPointerUp:q,onPointerCancel:I,children:[n("button",{className:r.dragHandle,type:"button","aria-label":"Drag queue item",children:n(P,{name:"bars"})}),n("img",{className:r.thumbnail,src:z(c.thumbnail||"",72,96),alt:l,loading:"lazy",decoding:"async",onError:u=>{u.currentTarget.src="/placeholder.svg"}}),n("div",{className:r.meta,children:[n("button",{className:r.name,type:"button",onClick:()=>{_()||a(`/watch/${c.showId}/${c.episodeNumber}`)},children:l}),n("div",{className:r.episode,children:["Episode ",c.episodeNumber]})]}),n("button",{className:r.iconBtn,type:"button",onClick:()=>{_()||D(c)},"aria-label":`Remove ${l} episode ${c.episodeNumber} from queue`,children:n(P,{name:"times"})})]})},he=({title:c="Queue",eyebrow:T,items:m,currentShowId:D,currentEpisode:v,onRemove:x,onReorder:q,onNextQueue:I,onClear:_,showClearAll:B=!1,defaultExpanded:f=!0})=>{const[o,w]=s.useState([]),[a,i]=s.useState(null),[l,u]=s.useState(f),b=s.useRef(null),N=s.useRef(null),d=s.useRef(null),p=s.useRef(!1),R=s.useRef(!1);s.useEffect(()=>{w(m)},[m]),s.useEffect(()=>{u(f)},[f]);const E=e=>{i(e)},$=e=>{if(a===null||a===e)return;const t=[...o],h=t[a];t.splice(a,1),t.splice(e,0,h),i(e),w(t)},k=()=>{a!==null&&q(o.map(e=>({id:e.id,showId:e.showId,episodeNumber:e.episodeNumber}))),i(null)},C=(e=!1)=>{d.current!==null&&(window.clearTimeout(d.current),d.current=null),e&&p.current&&(q(o.map(t=>({id:t.id,showId:t.showId,episodeNumber:t.episodeNumber}))),R.current=!0,window.setTimeout(()=>{R.current=!1},0)),b.current=null,N.current=null,p.current=!1,i(null)},A=(e,t)=>{if(t.pointerType==="mouse")return;const h=t.currentTarget,g=t.pointerId;b.current=t.pointerId,N.current={x:t.clientX,y:t.clientY},d.current!==null&&window.clearTimeout(d.current),d.current=window.setTimeout(()=>{p.current=!0,i(e);try{h.setPointerCapture(g)}catch{}},220)},Q=e=>{if(e.pointerType==="mouse"||b.current!==e.pointerId)return;if(!p.current&&N.current){const H=Math.abs(e.clientX-N.current.x),X=Math.abs(e.clientY-N.current.y);(H>8||X>8)&&C(!1);return}if(!p.current)return;e.preventDefault();const h=document.elementFromPoint(e.clientX,e.clientY)?.closest?.("[data-queue-index]"),g=h?Number(h.dataset.queueIndex):NaN;if(Number.isNaN(g)||a===null||g===a)return;const y=[...o],U=y[a];y.splice(a,1),y.splice(g,0,U),i(g),w(y)},S=e=>{e.pointerType!=="mouse"&&b.current===e.pointerId&&C(p.current)},M=e=>{e.pointerType!=="mouse"&&b.current===e.pointerId&&C(!1)};return o.length===0?null:n("section",{className:r.section,children:[n("div",{className:r.header,children:[n("button",{className:r.headerToggle,type:"button",onClick:()=>u(e=>!e),"aria-expanded":l,"aria-label":l?`Collapse ${c}`:`Expand ${c}`,children:[n("span",{className:r.title,children:[n("span",{className:"title-stack",children:[T&&n("div",{className:"section-eyebrow",children:T}),n("span",{children:c})]}),n("span",{className:r.badge,children:o.length})]}),l?n(P,{name:"chevron-up"}):n(P,{name:"chevron-down"})]}),B&&_&&n("div",{className:r.headerActions,children:[I&&o.length>1&&n("button",{className:r.nextBtn,type:"button",onClick:I,children:"Next"}),n("button",{className:r.clearBtn,type:"button",onClick:_,children:"Clear All"})]})]}),l&&n("div",{className:r.list,children:o.map((e,t)=>n(le,{item:e,isActive:e.showId===D&&e.episodeNumber===v,index:t,onRemove:x,onTouchPointerDown:A,onTouchPointerMove:Q,onTouchPointerUp:S,onTouchPointerCancel:M,shouldIgnoreClick:()=>R.current,onDragStart:()=>E(t),onDragEnter:()=>$(t),onDragEnd:k,isDragging:a===t},e.id))})]})};export{he as Q,r as s};
1
+ import{g as s,u as n,a as Y}from"./vendor-core-8R2fFbyN.js";import{I as P}from"./vendor-icons-CDMuNDeL.js";import{d as L,f as z}from"./index-C65i4HWv.js";const F="_section_1pwqc_1",O="_header_1pwqc_10",j="_headerToggle_1pwqc_20",G="_headerActions_1pwqc_34",J="_title_1pwqc_40",K="_badge_1pwqc_50",V="_clearBtn_1pwqc_65",W="_nextBtn_1pwqc_83",Z="_list_1pwqc_101",ee="_item_1pwqc_114",ne="_active_1pwqc_134",te="_dragging_1pwqc_142",re="_dragHandle_1pwqc_149",ce="_thumbnail_1pwqc_167",ae="_meta_1pwqc_175",oe="_name_1pwqc_182",se="_episode_1pwqc_204",ie="_iconBtn_1pwqc_210",r={section:F,header:O,headerToggle:j,headerActions:G,title:J,badge:K,clearBtn:V,nextBtn:W,list:Z,item:ee,active:ne,dragging:te,dragHandle:re,thumbnail:ce,meta:ae,name:oe,episode:se,iconBtn:ie},le=({item:c,isActive:T,index:m,onRemove:D,onTouchPointerDown:v,onTouchPointerMove:x,onTouchPointerUp:q,onTouchPointerCancel:I,shouldIgnoreClick:_,onDragStart:B,onDragEnter:f,onDragEnd:o,isDragging:w})=>{const a=Y(),{titlePreference:i}=L(),l=c[i]||c.name||"Unknown show";return n("div",{"data-queue-index":m,className:`${r.item} ${T?r.active:""} ${w?r.dragging:""}`,draggable:!0,onDragStart:B,onDragEnter:f,onDragOver:u=>u.preventDefault(),onDragEnd:o,onPointerDown:u=>v(m,u),onPointerMove:x,onPointerUp:q,onPointerCancel:I,children:[n("button",{className:r.dragHandle,type:"button","aria-label":"Drag queue item",children:n(P,{name:"bars"})}),n("img",{className:r.thumbnail,src:z(c.thumbnail||"",72,96),alt:l,loading:"lazy",decoding:"async",onError:u=>{u.currentTarget.src="/placeholder.svg"}}),n("div",{className:r.meta,children:[n("button",{className:r.name,type:"button",onClick:()=>{_()||a(`/watch/${c.showId}/${c.episodeNumber}`)},children:l}),n("div",{className:r.episode,children:["Episode ",c.episodeNumber]})]}),n("button",{className:r.iconBtn,type:"button",onClick:()=>{_()||D(c)},"aria-label":`Remove ${l} episode ${c.episodeNumber} from queue`,children:n(P,{name:"times"})})]})},he=({title:c="Queue",eyebrow:T,items:m,currentShowId:D,currentEpisode:v,onRemove:x,onReorder:q,onNextQueue:I,onClear:_,showClearAll:B=!1,defaultExpanded:f=!0})=>{const[o,w]=s.useState([]),[a,i]=s.useState(null),[l,u]=s.useState(f),b=s.useRef(null),N=s.useRef(null),d=s.useRef(null),p=s.useRef(!1),R=s.useRef(!1);s.useEffect(()=>{w(m)},[m]),s.useEffect(()=>{u(f)},[f]);const E=e=>{i(e)},$=e=>{if(a===null||a===e)return;const t=[...o],h=t[a];t.splice(a,1),t.splice(e,0,h),i(e),w(t)},k=()=>{a!==null&&q(o.map(e=>({id:e.id,showId:e.showId,episodeNumber:e.episodeNumber}))),i(null)},C=(e=!1)=>{d.current!==null&&(window.clearTimeout(d.current),d.current=null),e&&p.current&&(q(o.map(t=>({id:t.id,showId:t.showId,episodeNumber:t.episodeNumber}))),R.current=!0,window.setTimeout(()=>{R.current=!1},0)),b.current=null,N.current=null,p.current=!1,i(null)},A=(e,t)=>{if(t.pointerType==="mouse")return;const h=t.currentTarget,g=t.pointerId;b.current=t.pointerId,N.current={x:t.clientX,y:t.clientY},d.current!==null&&window.clearTimeout(d.current),d.current=window.setTimeout(()=>{p.current=!0,i(e);try{h.setPointerCapture(g)}catch{}},220)},Q=e=>{if(e.pointerType==="mouse"||b.current!==e.pointerId)return;if(!p.current&&N.current){const H=Math.abs(e.clientX-N.current.x),X=Math.abs(e.clientY-N.current.y);(H>8||X>8)&&C(!1);return}if(!p.current)return;e.preventDefault();const h=document.elementFromPoint(e.clientX,e.clientY)?.closest?.("[data-queue-index]"),g=h?Number(h.dataset.queueIndex):NaN;if(Number.isNaN(g)||a===null||g===a)return;const y=[...o],U=y[a];y.splice(a,1),y.splice(g,0,U),i(g),w(y)},S=e=>{e.pointerType!=="mouse"&&b.current===e.pointerId&&C(p.current)},M=e=>{e.pointerType!=="mouse"&&b.current===e.pointerId&&C(!1)};return o.length===0?null:n("section",{className:r.section,children:[n("div",{className:r.header,children:[n("button",{className:r.headerToggle,type:"button",onClick:()=>u(e=>!e),"aria-expanded":l,"aria-label":l?`Collapse ${c}`:`Expand ${c}`,children:[n("span",{className:r.title,children:[n("span",{className:"title-stack",children:[T&&n("div",{className:"section-eyebrow",children:T}),n("span",{children:c})]}),n("span",{className:r.badge,children:o.length})]}),l?n(P,{name:"chevron-up"}):n(P,{name:"chevron-down"})]}),B&&_&&n("div",{className:r.headerActions,children:[I&&o.length>1&&n("button",{className:r.nextBtn,type:"button",onClick:I,children:"Next"}),n("button",{className:r.clearBtn,type:"button",onClick:_,children:"Clear All"})]})]}),l&&n("div",{className:r.list,children:o.map((e,t)=>n(le,{item:e,isActive:e.showId===D&&e.episodeNumber===v,index:t,onRemove:x,onTouchPointerDown:A,onTouchPointerMove:Q,onTouchPointerUp:S,onTouchPointerCancel:M,shouldIgnoreClick:()=>R.current,onDragStart:()=>E(t),onDragEnter:()=>$(t),onDragEnd:k,isDragging:a===t},e.id))})]})};export{he as Q,r as s};
@@ -1 +1 @@
1
- import{d as h,A as j,h as y,g as ne,u as e,S as C,$ as Q,T as _}from"./vendor-core-8R2fFbyN.js";import{I as o}from"./vendor-icons-CDMuNDeL.js";import{b as Y}from"./vendor-query-BXRECSI6.js";import{q as Z}from"./index-lo-bz7f2.js";import{a as t}from"./Asmr.module-ChUXDZKx.js";import{r as i}from"./Radio.module-DGSZLpKM.js";const x=300*1e3,se="https://cdn.listen.moe/covers/";function q(n){return n?n.startsWith("http")?n:`${se}${n}`:null}function re(n){return n?q(n.albums[0]?.image)||q(n.artists[0]?.image)||q(n.sources[0]?.image):null}function F(n){return n?n.artists.map(r=>r.nameRomaji||r.name).join(", "):""}const le=()=>Y({queryKey:["radioStations"],queryFn:()=>Z("/api/radio/stations"),staleTime:x}),oe=n=>Y({queryKey:["radioSearch",n],queryFn:()=>Z(`/api/radio/search?q=${encodeURIComponent(n)}`),enabled:n.trim().length>0,staleTime:x}),G={song:null,lastPlayed:[],listeners:0,startTime:null},ie=n=>{const[r,p]=h(G),[l,c]=h(!1),d=j(null);return y(()=>{if(p(G),c(!1),!n)return;let m=null,f=!1;try{m=new WebSocket(n)}catch{return}return m.onopen=()=>{f||c(!0)},m.onmessage=v=>{try{const u=JSON.parse(v.data);if(u.op===0){const b=u.d?.heartbeat||35e3;d.current&&window.clearInterval(d.current),d.current=window.setInterval(()=>{m&&m.readyState===WebSocket.OPEN&&m.send(JSON.stringify({op:9}))},b)}else u.op===1&&p({song:u.d?.song||null,lastPlayed:u.d?.lastPlayed||[],listeners:u.d?.listeners||0,startTime:u.d?.startTime||null})}catch{}},m.onclose=()=>{f||c(!1)},()=>{f=!0,d.current&&window.clearInterval(d.current),d.current=null,m&&m.close()}},[n]),{nowPlaying:r,connected:l}};function X(n){if(!n)return"";const r=Math.max(0,Math.floor((Date.now()-new Date(n).getTime())/1e3)),p=Math.floor(r/60),l=r%60;return`${p}:${String(l).padStart(2,"0")}`}const ce=({station:n,nowPlaying:r,connected:p,expanded:l,onStationStep:c,onExpandedChange:d,onClose:m})=>{const f=j(null),[v,u]=h(!1),[b,H]=h(!0),[S,I]=h(!1),[L,T]=h(!0),[O,P]=h(""),[N,A]=h(()=>{const a=parseFloat(localStorage.getItem("radioVolume")||"");return Number.isFinite(a)?a:1}),s=j(""),g=j(N);g.current=N,s.current||(s.current=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`radio-${Date.now()}-${Math.random().toString(36).slice(2)}`);const w=r.song,k=re(w)||n.favicon||null,[R,J]=h(!1);y(()=>{J(!1)},[k]);const E=R?null:k,U=!!E,B=w?`${F(w)} — ${w.title}`:n.name;y(()=>{const a=f.current;if(a)return u(!1),a.src=n.streamUrl,a.load(),a.volume=g.current,a.play().catch(()=>u(!1)),()=>{a.removeAttribute("src")}},[n.id,n.streamUrl]),y(()=>{const a=f.current;a&&(a.volume=N)},[N]),y(()=>{if(l)return document.body.classList.add("asmr-player-open"),()=>document.body.classList.remove("asmr-player-open")},[l]),y(()=>{l&&T(!0)},[l]);const ee=a=>a?Math.max(0,Math.floor((Date.now()-new Date(a).getTime())/1e3)):0,M=ne.useCallback(a=>{n&&(fetch("/api/discord/radio",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:B,stationLabel:n.name,isPlaying:a,thumbnail:E||"",currentTime:ee(r.startTime),sessionId:s.current})}).catch(()=>{}),fetch("/api/discord/heartbeat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:s.current})}).catch(()=>{}))},[n,B,E,r.startTime]);y(()=>{M(v)},[M,v,n.id,B,l]),y(()=>{if(!v)return;const a=window.setInterval(()=>M(!0),15e3);return()=>window.clearInterval(a)},[v,M]),y(()=>{const a=s.current,$=()=>{if(!a)return;const K=JSON.stringify({sessionId:a});navigator.sendBeacon?(navigator.sendBeacon("/api/discord/clear",new Blob([K],{type:"application/json"})),navigator.sendBeacon("/api/discord/heartbeat",new Blob([JSON.stringify({sessionId:a,bye:!0})],{type:"application/json"}))):(fetch("/api/discord/clear",{method:"POST",headers:{"Content-Type":"application/json"},body:K,keepalive:!0}).catch(()=>{}),fetch("/api/discord/heartbeat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:a,bye:!0}),keepalive:!0}).catch(()=>{}))},D=()=>$(),W=()=>{document.visibilityState==="hidden"&&$()};return window.addEventListener("pagehide",D),window.addEventListener("beforeunload",D),document.addEventListener("visibilitychange",W),()=>{window.removeEventListener("pagehide",D),window.removeEventListener("beforeunload",D),document.removeEventListener("visibilitychange",W),$()}},[]),y(()=>{if(!r.startTime){P("");return}P(X(r.startTime));const a=window.setInterval(()=>P(X(r.startTime)),1e3);return()=>window.clearInterval(a)},[r.startTime,r.song?.id]),y(()=>{if(!l)return;const a=$=>{$.key==="Escape"&&(S?I(!1):d(!1))};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[l,S,d]);const ae=()=>{const a=f.current;a&&(a.paused?(a.load(),a.play().catch(()=>{})):a.pause())},te=e(C,{children:[e("div",{className:t.playerButtons,children:[e("button",{className:t.playerBtn,onClick:()=>c(-1),"aria-label":"Previous station",children:e(o,{name:"step-backward"})}),e("button",{className:`${t.playerBtn} ${t.playBtn}`,onClick:ae,"aria-label":v?"Pause":"Play",children:v?e(o,{name:"pause"}):e(o,{name:"play"})}),e("button",{className:t.playerBtn,onClick:()=>c(1),"aria-label":"Next station",children:e(o,{name:"step-forward"})})]}),e("div",{className:t.seekRow,children:[e("span",{className:i.liveBadge,children:[e(o,{name:"broadcast-tower",size:10})," LIVE"]}),O&&e("span",{className:t.timeLabel,children:O}),p&&r.listeners>0&&e("span",{className:t.timeLabel,children:[r.listeners," listening"]}),!p&&n.source==="listen.moe"&&e("span",{className:t.timeLabel,children:"connecting…"})]})]}),V=e(C,{children:[e("button",{className:`${t.playerBtn} ${t.playerToggle}`,onClick:()=>d(!l),"aria-label":l?"Minimize player":"Expand player",title:l?"Minimize to browse":"Expand",children:l?e(o,{name:"chevron-down"}):e(o,{name:"chevron-up"})}),e("div",{className:t.playerInfo,children:[e("p",{className:t.playerTitle,title:B,children:B}),e("p",{className:t.playerTrack,children:n.name})]}),e("div",{className:t.playerControls,children:te}),e("div",{className:t.playerRight,children:[N===0?e(o,{name:"volume-mute",className:t.volumeIcon}):N<.5?e(o,{name:"volume-down",className:t.volumeIcon}):e(o,{name:"volume-up",className:t.volumeIcon}),e("input",{className:t.volumeBar,type:"range",min:0,max:1,step:.01,value:N,onChange:a=>{const $=parseFloat(a.target.value);A($),localStorage.setItem("radioVolume",String($))},style:{"--volume-percent":`${N*100}%`},"aria-label":"Volume"})]}),e("div",{className:t.playerActions,children:[l&&U&&e("button",{className:t.playerBtn,onClick:()=>H(a=>!a),"aria-label":b?"Hide art":"Show art",title:b?"Hide art":"Show art",children:b?e(o,{name:"eye-slash"}):e(o,{name:"image"})}),l&&r.lastPlayed.length>0&&e("button",{className:`${t.playerBtn} ${S?t.playerBtnActive:""}`,onClick:()=>I(a=>!a),"aria-label":S?"Hide history":"Show history",title:"Recently played",children:e(o,{name:"list-ol"})}),e("button",{className:t.playerBtn,onClick:m,"aria-label":"Close player",children:e(o,{name:"times"})})]})]}),z=e("audio",{ref:f,preload:"none",onPlay:()=>u(!0),onPause:()=>u(!1)});return l?Q(e(C,{children:[z,e("div",{className:`${t.npOverlay} ${L?"":t.npOverlayControlsHidden}`,children:[e("div",{className:`${t.npStage} ${!b||!U?t.npStageBlank:""}`,onClick:()=>T(a=>!a),children:b&&U&&E&&e("div",{className:i.coverWrap,children:e("img",{src:E,alt:B,loading:"lazy",decoding:"async",draggable:!1,className:i.cover,onError:()=>J(!0)})})}),e("div",{className:`${t.playerBar} ${t.playerBarDocked} ${L?"":t.playerBarDockedHidden}`,onClick:a=>a.stopPropagation(),children:[V,S&&e(C,{children:[e("div",{className:t.npBackdrop,onClick:()=>I(!1)}),e("div",{className:t.chapterPanel,children:r.lastPlayed.map(a=>e("div",{className:t.chapterRow,children:e("span",{className:t.chapterRowLabel,title:`${F(a)} — ${a.title}`,children:[F(a)," — ",a.title]})},a.id))})]})]})]})]}),document.body):Q(e(C,{children:[z,e("div",{className:t.playerBar,children:V})]}),document.body)},fe=()=>{y(()=>{document.title="Radio - dango"},[]);const[n,r]=h(""),[p,l]=h(""),[c,d]=h(null),[m,f]=h(!0),{data:v,isLoading:u}=le(),{data:b,isLoading:H}=oe(p),S=_(()=>v?.stations||[],[v]),I=_(()=>b?.stations||[],[b]),L=p?I:S,{nowPlaying:T,connected:O}=ie(c?.gateway),P=s=>{d(s),f(!0)},N=s=>{const g=L.length>0?L:S;if(g.length===0||!c)return;const w=g.findIndex(R=>R.id===c.id),k=g[(w<0?0:w+s+g.length)%g.length];d(k)},A=s=>{const g=c?.id===s.id,w=g&&T.song?`${F(T.song)} — ${T.song.title}`:null,k=[s.codec,s.bitrate?`${s.bitrate}k`:"",s.tags].filter(Boolean).join(" · ");return e("button",{className:`${i.stationRow} ${g?i.stationRowActive:""}`,onClick:()=>P(s),children:[s.favicon?e("img",{src:s.favicon,alt:"",className:i.stationThumb,loading:"lazy",decoding:"async",onError:R=>{R.target.style.display="none"}}):e("span",{className:i.stationThumbPlaceholder,children:e(o,{name:"broadcast-tower"})}),e("span",{className:i.stationMeta,children:[e("span",{className:i.stationName,children:s.name}),k&&e("span",{className:i.stationSub,children:k})]}),w&&e("span",{className:i.stationNowPlaying,children:w})]},s.id)};return e("div",{className:`${t.page} ${c?t.pageWithPlayer:""}`,children:[e("div",{className:t.header,children:[e("h1",{className:t.pageTitle,children:[e(o,{name:"broadcast-tower"})," Radio"]}),e("form",{className:t.searchForm,onSubmit:s=>{s.preventDefault(),l(n)},children:[e("input",{className:t.searchInput,value:n,onChange:s=>r(s.target.value),placeholder:"Search stations (anime, j-pop, k-pop…)","aria-label":"Search radio stations"}),e("button",{className:t.searchBtn,type:"submit","aria-label":"Search",children:e(o,{name:"search"})})]})]}),p?e(C,{children:[e("h2",{className:i.sectionTitle,children:["Results for “",p,"”"]}),H?e("p",{className:t.statusMsg,children:"Searching…"}):I.length===0?e("p",{className:t.statusMsg,children:"No stations found."}):e("div",{className:i.stationList,children:I.map(A)})]}):e(C,{children:[e("h2",{className:i.sectionTitle,children:"Featured"}),u?e("p",{className:t.statusMsg,children:"Loading…"}):e("div",{className:i.stationList,children:S.map(A)})]}),c&&e(ce,{station:c,nowPlaying:T,connected:O,expanded:m,onStationStep:N,onExpandedChange:f,onClose:()=>d(null)})]})};export{fe as default};
1
+ import{d as h,A as j,h as y,g as ne,u as e,S as C,$ as Q,T as _}from"./vendor-core-8R2fFbyN.js";import{I as o}from"./vendor-icons-CDMuNDeL.js";import{b as Y}from"./vendor-query-BXRECSI6.js";import{q as Z}from"./index-C65i4HWv.js";import{a as t}from"./Asmr.module-ChUXDZKx.js";import{r as i}from"./Radio.module-DGSZLpKM.js";const x=300*1e3,se="https://cdn.listen.moe/covers/";function q(n){return n?n.startsWith("http")?n:`${se}${n}`:null}function re(n){return n?q(n.albums[0]?.image)||q(n.artists[0]?.image)||q(n.sources[0]?.image):null}function F(n){return n?n.artists.map(r=>r.nameRomaji||r.name).join(", "):""}const le=()=>Y({queryKey:["radioStations"],queryFn:()=>Z("/api/radio/stations"),staleTime:x}),oe=n=>Y({queryKey:["radioSearch",n],queryFn:()=>Z(`/api/radio/search?q=${encodeURIComponent(n)}`),enabled:n.trim().length>0,staleTime:x}),G={song:null,lastPlayed:[],listeners:0,startTime:null},ie=n=>{const[r,p]=h(G),[l,c]=h(!1),d=j(null);return y(()=>{if(p(G),c(!1),!n)return;let m=null,f=!1;try{m=new WebSocket(n)}catch{return}return m.onopen=()=>{f||c(!0)},m.onmessage=v=>{try{const u=JSON.parse(v.data);if(u.op===0){const b=u.d?.heartbeat||35e3;d.current&&window.clearInterval(d.current),d.current=window.setInterval(()=>{m&&m.readyState===WebSocket.OPEN&&m.send(JSON.stringify({op:9}))},b)}else u.op===1&&p({song:u.d?.song||null,lastPlayed:u.d?.lastPlayed||[],listeners:u.d?.listeners||0,startTime:u.d?.startTime||null})}catch{}},m.onclose=()=>{f||c(!1)},()=>{f=!0,d.current&&window.clearInterval(d.current),d.current=null,m&&m.close()}},[n]),{nowPlaying:r,connected:l}};function X(n){if(!n)return"";const r=Math.max(0,Math.floor((Date.now()-new Date(n).getTime())/1e3)),p=Math.floor(r/60),l=r%60;return`${p}:${String(l).padStart(2,"0")}`}const ce=({station:n,nowPlaying:r,connected:p,expanded:l,onStationStep:c,onExpandedChange:d,onClose:m})=>{const f=j(null),[v,u]=h(!1),[b,H]=h(!0),[S,I]=h(!1),[L,T]=h(!0),[O,P]=h(""),[N,A]=h(()=>{const a=parseFloat(localStorage.getItem("radioVolume")||"");return Number.isFinite(a)?a:1}),s=j(""),g=j(N);g.current=N,s.current||(s.current=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`radio-${Date.now()}-${Math.random().toString(36).slice(2)}`);const w=r.song,k=re(w)||n.favicon||null,[R,J]=h(!1);y(()=>{J(!1)},[k]);const E=R?null:k,U=!!E,B=w?`${F(w)} — ${w.title}`:n.name;y(()=>{const a=f.current;if(a)return u(!1),a.src=n.streamUrl,a.load(),a.volume=g.current,a.play().catch(()=>u(!1)),()=>{a.removeAttribute("src")}},[n.id,n.streamUrl]),y(()=>{const a=f.current;a&&(a.volume=N)},[N]),y(()=>{if(l)return document.body.classList.add("asmr-player-open"),()=>document.body.classList.remove("asmr-player-open")},[l]),y(()=>{l&&T(!0)},[l]);const ee=a=>a?Math.max(0,Math.floor((Date.now()-new Date(a).getTime())/1e3)):0,M=ne.useCallback(a=>{n&&(fetch("/api/discord/radio",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:B,stationLabel:n.name,isPlaying:a,thumbnail:E||"",currentTime:ee(r.startTime),sessionId:s.current})}).catch(()=>{}),fetch("/api/discord/heartbeat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:s.current})}).catch(()=>{}))},[n,B,E,r.startTime]);y(()=>{M(v)},[M,v,n.id,B,l]),y(()=>{if(!v)return;const a=window.setInterval(()=>M(!0),15e3);return()=>window.clearInterval(a)},[v,M]),y(()=>{const a=s.current,$=()=>{if(!a)return;const K=JSON.stringify({sessionId:a});navigator.sendBeacon?(navigator.sendBeacon("/api/discord/clear",new Blob([K],{type:"application/json"})),navigator.sendBeacon("/api/discord/heartbeat",new Blob([JSON.stringify({sessionId:a,bye:!0})],{type:"application/json"}))):(fetch("/api/discord/clear",{method:"POST",headers:{"Content-Type":"application/json"},body:K,keepalive:!0}).catch(()=>{}),fetch("/api/discord/heartbeat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:a,bye:!0}),keepalive:!0}).catch(()=>{}))},D=()=>$(),W=()=>{document.visibilityState==="hidden"&&$()};return window.addEventListener("pagehide",D),window.addEventListener("beforeunload",D),document.addEventListener("visibilitychange",W),()=>{window.removeEventListener("pagehide",D),window.removeEventListener("beforeunload",D),document.removeEventListener("visibilitychange",W),$()}},[]),y(()=>{if(!r.startTime){P("");return}P(X(r.startTime));const a=window.setInterval(()=>P(X(r.startTime)),1e3);return()=>window.clearInterval(a)},[r.startTime,r.song?.id]),y(()=>{if(!l)return;const a=$=>{$.key==="Escape"&&(S?I(!1):d(!1))};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[l,S,d]);const ae=()=>{const a=f.current;a&&(a.paused?(a.load(),a.play().catch(()=>{})):a.pause())},te=e(C,{children:[e("div",{className:t.playerButtons,children:[e("button",{className:t.playerBtn,onClick:()=>c(-1),"aria-label":"Previous station",children:e(o,{name:"step-backward"})}),e("button",{className:`${t.playerBtn} ${t.playBtn}`,onClick:ae,"aria-label":v?"Pause":"Play",children:v?e(o,{name:"pause"}):e(o,{name:"play"})}),e("button",{className:t.playerBtn,onClick:()=>c(1),"aria-label":"Next station",children:e(o,{name:"step-forward"})})]}),e("div",{className:t.seekRow,children:[e("span",{className:i.liveBadge,children:[e(o,{name:"broadcast-tower",size:10})," LIVE"]}),O&&e("span",{className:t.timeLabel,children:O}),p&&r.listeners>0&&e("span",{className:t.timeLabel,children:[r.listeners," listening"]}),!p&&n.source==="listen.moe"&&e("span",{className:t.timeLabel,children:"connecting…"})]})]}),V=e(C,{children:[e("button",{className:`${t.playerBtn} ${t.playerToggle}`,onClick:()=>d(!l),"aria-label":l?"Minimize player":"Expand player",title:l?"Minimize to browse":"Expand",children:l?e(o,{name:"chevron-down"}):e(o,{name:"chevron-up"})}),e("div",{className:t.playerInfo,children:[e("p",{className:t.playerTitle,title:B,children:B}),e("p",{className:t.playerTrack,children:n.name})]}),e("div",{className:t.playerControls,children:te}),e("div",{className:t.playerRight,children:[N===0?e(o,{name:"volume-mute",className:t.volumeIcon}):N<.5?e(o,{name:"volume-down",className:t.volumeIcon}):e(o,{name:"volume-up",className:t.volumeIcon}),e("input",{className:t.volumeBar,type:"range",min:0,max:1,step:.01,value:N,onChange:a=>{const $=parseFloat(a.target.value);A($),localStorage.setItem("radioVolume",String($))},style:{"--volume-percent":`${N*100}%`},"aria-label":"Volume"})]}),e("div",{className:t.playerActions,children:[l&&U&&e("button",{className:t.playerBtn,onClick:()=>H(a=>!a),"aria-label":b?"Hide art":"Show art",title:b?"Hide art":"Show art",children:b?e(o,{name:"eye-slash"}):e(o,{name:"image"})}),l&&r.lastPlayed.length>0&&e("button",{className:`${t.playerBtn} ${S?t.playerBtnActive:""}`,onClick:()=>I(a=>!a),"aria-label":S?"Hide history":"Show history",title:"Recently played",children:e(o,{name:"list-ol"})}),e("button",{className:t.playerBtn,onClick:m,"aria-label":"Close player",children:e(o,{name:"times"})})]})]}),z=e("audio",{ref:f,preload:"none",onPlay:()=>u(!0),onPause:()=>u(!1)});return l?Q(e(C,{children:[z,e("div",{className:`${t.npOverlay} ${L?"":t.npOverlayControlsHidden}`,children:[e("div",{className:`${t.npStage} ${!b||!U?t.npStageBlank:""}`,onClick:()=>T(a=>!a),children:b&&U&&E&&e("div",{className:i.coverWrap,children:e("img",{src:E,alt:B,loading:"lazy",decoding:"async",draggable:!1,className:i.cover,onError:()=>J(!0)})})}),e("div",{className:`${t.playerBar} ${t.playerBarDocked} ${L?"":t.playerBarDockedHidden}`,onClick:a=>a.stopPropagation(),children:[V,S&&e(C,{children:[e("div",{className:t.npBackdrop,onClick:()=>I(!1)}),e("div",{className:t.chapterPanel,children:r.lastPlayed.map(a=>e("div",{className:t.chapterRow,children:e("span",{className:t.chapterRowLabel,title:`${F(a)} — ${a.title}`,children:[F(a)," — ",a.title]})},a.id))})]})]})]})]}),document.body):Q(e(C,{children:[z,e("div",{className:t.playerBar,children:V})]}),document.body)},fe=()=>{y(()=>{document.title="Radio - dango"},[]);const[n,r]=h(""),[p,l]=h(""),[c,d]=h(null),[m,f]=h(!0),{data:v,isLoading:u}=le(),{data:b,isLoading:H}=oe(p),S=_(()=>v?.stations||[],[v]),I=_(()=>b?.stations||[],[b]),L=p?I:S,{nowPlaying:T,connected:O}=ie(c?.gateway),P=s=>{d(s),f(!0)},N=s=>{const g=L.length>0?L:S;if(g.length===0||!c)return;const w=g.findIndex(R=>R.id===c.id),k=g[(w<0?0:w+s+g.length)%g.length];d(k)},A=s=>{const g=c?.id===s.id,w=g&&T.song?`${F(T.song)} — ${T.song.title}`:null,k=[s.codec,s.bitrate?`${s.bitrate}k`:"",s.tags].filter(Boolean).join(" · ");return e("button",{className:`${i.stationRow} ${g?i.stationRowActive:""}`,onClick:()=>P(s),children:[s.favicon?e("img",{src:s.favicon,alt:"",className:i.stationThumb,loading:"lazy",decoding:"async",onError:R=>{R.target.style.display="none"}}):e("span",{className:i.stationThumbPlaceholder,children:e(o,{name:"broadcast-tower"})}),e("span",{className:i.stationMeta,children:[e("span",{className:i.stationName,children:s.name}),k&&e("span",{className:i.stationSub,children:k})]}),w&&e("span",{className:i.stationNowPlaying,children:w})]},s.id)};return e("div",{className:`${t.page} ${c?t.pageWithPlayer:""}`,children:[e("div",{className:t.header,children:[e("h1",{className:t.pageTitle,children:[e(o,{name:"broadcast-tower"})," Radio"]}),e("form",{className:t.searchForm,onSubmit:s=>{s.preventDefault(),l(n)},children:[e("input",{className:t.searchInput,value:n,onChange:s=>r(s.target.value),placeholder:"Search stations (anime, j-pop, k-pop…)","aria-label":"Search radio stations"}),e("button",{className:t.searchBtn,type:"submit","aria-label":"Search",children:e(o,{name:"search"})})]})]}),p?e(C,{children:[e("h2",{className:i.sectionTitle,children:["Results for “",p,"”"]}),H?e("p",{className:t.statusMsg,children:"Searching…"}):I.length===0?e("p",{className:t.statusMsg,children:"No stations found."}):e("div",{className:i.stationList,children:I.map(A)})]}):e(C,{children:[e("h2",{className:i.sectionTitle,children:"Featured"}),u?e("p",{className:t.statusMsg,children:"Loading…"}):e("div",{className:i.stationList,children:S.map(A)})]}),c&&e(ce,{station:c,nowPlaying:T,connected:O,expanded:m,onStationStep:N,onExpandedChange:f,onClose:()=>d(null)})]})};export{fe as default};
@@ -1 +1 @@
1
- import{n as U,d as v,h as b,T as w,u as i,S as E}from"./vendor-core-8R2fFbyN.js";import{M as x}from"./MediaCard-DszKDA4s.js";import{L as F}from"./LibraryListPage-B0MDTnEc.js";import{u as _,M as D}from"./useMangaPopup-BvgtZ53s.js";import{M as G}from"./MangaResetProgressModal-WjKH_G_f.js";import{s as O,d as Q,l as Y,n as q,u as z,t as H,v as K,w as V,M as h,m as Z,i as j,b as J,c as W}from"./useMangaLibrary-BXhgN-dl.js";import"./vendor-ui-CUDCvRS_.js";import"./vendor-icons-CDMuNDeL.js";import"./index-lo-bz7f2.js";import"./vendor-query-BXRECSI6.js";import"./useIsMobile-Dm_b6Ob3.js";import"./SkeletonGrid-Du10CNfq.js";import"./ErrorMessage-z4f4WGgP.js";import"./Watchlist.module-XGtVQr1d.js";import"./ResetProgressModal-8mcLXaAb.js";const X=["All","Continue Reading",...h],R=24,y=e=>({provider:e.provider,mangaId:e.mangaId,title:e.title,altTitle:e.altTitle,cover:e.cover,contentRating:e.contentRating,readTarget:e.detailTarget,progressLabel:e.progressLabel});function va(){const{filter:e="All"}=U(),[g,p]=v(1),[d,u]=v(null);b(()=>{document.title="Reading List - dango"},[]),b(()=>{p(1)},[e]);const r=e==="Continue Reading",n=O(r?"All":e,g,R),s=Q(100),I=Y(),T=q(),{toggle:L,bookmarkedIds:C}=z(),{popup:t,openPopup:k,scheduleClose:c,cancelClose:m,closePopup:M}=_(),f=H(),P=K(),B=V(),S=w(()=>r?(s.data?.data??[]).map(a=>{const o=a.page??0,l=a.pageCount??0;return{key:a.id,libId:a.id,provider:a.provider,mangaId:a.mangaId,title:a.title,altTitle:a.altTitle,cover:a.cover||"",status:a.status,contentRating:a.contentRating||void 0,chapterLabel:a.chapterNumber?`Ch. ${a.chapterNumber}`:void 0,progressPercent:l>0?o/l*100:0,progressLabel:a.chapterNumber&&l>0?`Ch. ${a.chapterNumber} · p. ${o}/${l}`:void 0,detailTarget:a.chapterId&&a.provider&&a.mangaId?`/manga/${a.provider}/${encodeURIComponent(a.mangaId)}/read?chapter=${encodeURIComponent(a.chapterId)}`:`/manga/${a.provider}/${encodeURIComponent(a.mangaId)}`}}):(n.data?.data??[]).map(a=>({key:a.id,libId:a.id,provider:a.provider,mangaId:a.mangaId,title:a.title,altTitle:a.altTitle,cover:a.cover||"",status:a.status,contentRating:a.contentRating||void 0,chapterLabel:a.lastChapterNumber?`Ch. ${a.lastChapterNumber}`:void 0,progressPercent:void 0,progressLabel:void 0,detailTarget:`/manga/${a.provider}/${encodeURIComponent(a.mangaId)}`})),[r,s.data,n.data]),$=r?s.data?.total??0:n.data?.total??0,A=r?s.isLoading:n.isLoading,N=r?s.error:n.error;return i(F,{headerTitle:"My Reading List",headerSubtitle:"Track and manage your manga collection",filters:X,filterBy:e,filterBasePath:"/reading-list",continueFilter:"Continue Reading",statusOptions:[...h],entries:S,total:$,isLoading:A,error:N,page:g,pageSize:R,onPageChange:p,emptyTitle:"Your reading list is looking a bit lonely",emptyFilteredText:"No titles match this filter.",emptyAllText:"Let's find something to read!",browseLabel:"Browse Manga",browseTarget:"/manga",removeListLabel:"Remove from Reading List",listNoun:"reading list",skipConfirmKey:"mangaSkipRemoveConfirmation",onBulkStatus:(a,o)=>f.mutate({ids:a,status:o}),onBulkRemove:a=>{r?B.mutate(a):P.mutate(a)},onStatusChange:(a,o)=>T.mutate({id:a,status:o}),onRemoveItem:a=>I.mutate(a),renderCard:a=>i(x,{item:{id:a.libId,title:a.title,...W({title:a.title,altTitle:a.altTitle}),thumbnail:J(a.provider,a.cover),chapterBadge:a.chapterLabel??null,isAdult:j(a)},linkTo:a.detailTarget,hoverIcon:"book",progress:a.progressPercent!==void 0&&a.progressLabel?{percent:a.progressPercent,label:a.progressLabel}:void 0,showProgress:r,display:{elements:{poster:{typeBadge:!1,chapterBadge:!0,adultBadge:!0},info:{title:!0,mobileBadges:!0,progress:!0,meta:!1}}},onRemove:r?()=>u(a):void 0,onOpenDetails:o=>k(o,y(a)),onPopupHoverIntent:o=>o?m():c(),rawThumbnail:!0}),modals:i(E,{children:[t&&t.data.provider&&i(D,{data:t.data,anchorRect:t.rect,bookmarked:C.has(Z(t.data.provider,t.data.mangaId)),onToggleBookmark:()=>L({id:t.data.mangaId,provider:t.data.provider,title:t.data.title,cover:t.data.cover,altTitle:t.data.altTitle??void 0,contentRating:t.data.contentRating}),onMouseEnter:m,onMouseLeave:c,onRequestClose:M}),i(G,{mangaId:d?d.libId:null,title:d?.title,onClose:()=>u(null)})]})})}export{va as default};
1
+ import{n as U,d as v,h as b,T as w,u as i,S as E}from"./vendor-core-8R2fFbyN.js";import{M as x}from"./MediaCard-DDiYEAm8.js";import{L as F}from"./LibraryListPage-B2nhFFrc.js";import{u as _,M as D}from"./useMangaPopup-ZonOP5_c.js";import{M as G}from"./MangaResetProgressModal-Ch8RjwbO.js";import{s as O,d as Q,l as Y,n as q,u as z,t as H,v as K,w as V,M as h,m as Z,i as j,b as J,c as W}from"./useMangaLibrary-U7tUo8nx.js";import"./vendor-ui-CUDCvRS_.js";import"./vendor-icons-CDMuNDeL.js";import"./index-C65i4HWv.js";import"./vendor-query-BXRECSI6.js";import"./useIsMobile-Dm_b6Ob3.js";import"./SkeletonGrid-C6S7OYHn.js";import"./ErrorMessage-z4f4WGgP.js";import"./Watchlist.module-XGtVQr1d.js";import"./ResetProgressModal-BokfoYFB.js";const X=["All","Continue Reading",...h],R=24,y=e=>({provider:e.provider,mangaId:e.mangaId,title:e.title,altTitle:e.altTitle,cover:e.cover,contentRating:e.contentRating,readTarget:e.detailTarget,progressLabel:e.progressLabel});function va(){const{filter:e="All"}=U(),[g,p]=v(1),[d,u]=v(null);b(()=>{document.title="Reading List - dango"},[]),b(()=>{p(1)},[e]);const r=e==="Continue Reading",n=O(r?"All":e,g,R),s=Q(100),I=Y(),T=q(),{toggle:L,bookmarkedIds:C}=z(),{popup:t,openPopup:k,scheduleClose:c,cancelClose:m,closePopup:M}=_(),f=H(),P=K(),B=V(),S=w(()=>r?(s.data?.data??[]).map(a=>{const o=a.page??0,l=a.pageCount??0;return{key:a.id,libId:a.id,provider:a.provider,mangaId:a.mangaId,title:a.title,altTitle:a.altTitle,cover:a.cover||"",status:a.status,contentRating:a.contentRating||void 0,chapterLabel:a.chapterNumber?`Ch. ${a.chapterNumber}`:void 0,progressPercent:l>0?o/l*100:0,progressLabel:a.chapterNumber&&l>0?`Ch. ${a.chapterNumber} · p. ${o}/${l}`:void 0,detailTarget:a.chapterId&&a.provider&&a.mangaId?`/manga/${a.provider}/${encodeURIComponent(a.mangaId)}/read?chapter=${encodeURIComponent(a.chapterId)}`:`/manga/${a.provider}/${encodeURIComponent(a.mangaId)}`}}):(n.data?.data??[]).map(a=>({key:a.id,libId:a.id,provider:a.provider,mangaId:a.mangaId,title:a.title,altTitle:a.altTitle,cover:a.cover||"",status:a.status,contentRating:a.contentRating||void 0,chapterLabel:a.lastChapterNumber?`Ch. ${a.lastChapterNumber}`:void 0,progressPercent:void 0,progressLabel:void 0,detailTarget:`/manga/${a.provider}/${encodeURIComponent(a.mangaId)}`})),[r,s.data,n.data]),$=r?s.data?.total??0:n.data?.total??0,A=r?s.isLoading:n.isLoading,N=r?s.error:n.error;return i(F,{headerTitle:"My Reading List",headerSubtitle:"Track and manage your manga collection",filters:X,filterBy:e,filterBasePath:"/reading-list",continueFilter:"Continue Reading",statusOptions:[...h],entries:S,total:$,isLoading:A,error:N,page:g,pageSize:R,onPageChange:p,emptyTitle:"Your reading list is looking a bit lonely",emptyFilteredText:"No titles match this filter.",emptyAllText:"Let's find something to read!",browseLabel:"Browse Manga",browseTarget:"/manga",removeListLabel:"Remove from Reading List",listNoun:"reading list",skipConfirmKey:"mangaSkipRemoveConfirmation",onBulkStatus:(a,o)=>f.mutate({ids:a,status:o}),onBulkRemove:a=>{r?B.mutate(a):P.mutate(a)},onStatusChange:(a,o)=>T.mutate({id:a,status:o}),onRemoveItem:a=>I.mutate(a),renderCard:a=>i(x,{item:{id:a.libId,title:a.title,...W({title:a.title,altTitle:a.altTitle}),thumbnail:J(a.provider,a.cover),chapterBadge:a.chapterLabel??null,isAdult:j(a)},linkTo:a.detailTarget,hoverIcon:"book",progress:a.progressPercent!==void 0&&a.progressLabel?{percent:a.progressPercent,label:a.progressLabel}:void 0,showProgress:r,display:{elements:{poster:{typeBadge:!1,chapterBadge:!0,adultBadge:!0},info:{title:!0,mobileBadges:!0,progress:!0,meta:!1}}},onRemove:r?()=>u(a):void 0,onOpenDetails:o=>k(o,y(a)),onPopupHoverIntent:o=>o?m():c(),rawThumbnail:!0}),modals:i(E,{children:[t&&t.data.provider&&i(D,{data:t.data,anchorRect:t.rect,bookmarked:C.has(Z(t.data.provider,t.data.mangaId)),onToggleBookmark:()=>L({id:t.data.mangaId,provider:t.data.provider,title:t.data.title,cover:t.data.cover,altTitle:t.data.altTitle??void 0,contentRating:t.data.contentRating}),onMouseEnter:m,onMouseLeave:c,onRequestClose:M}),i(G,{mangaId:d?d.libId:null,title:d?.title,onClose:()=>u(null)})]})})}export{va as default};
@@ -1 +1 @@
1
- import{u as e}from"./vendor-core-8R2fFbyN.js";import{M as r,B as n}from"./index-lo-bz7f2.js";const p=({isOpen:t,itemName:c,progressKind:i,listLabel:s,alsoRemove:a,onAlsoRemoveChange:d,onClose:o,onConfirm:l})=>e(r,{isOpen:t,onClose:o,title:"Reset Progress",children:[e(r.Body,{children:[e("p",{children:["Are you sure you want to remove your ",i,' progress for "',c,'"?']}),e("label",{children:[e("input",{type:"checkbox",checked:a,onChange:h=>d(h.target.checked)}),"Also remove from ",s]})]}),e(r.Actions,{children:[e(n,{variant:"secondary",onClick:o,children:"No"}),e(n,{variant:"danger",onClick:l,children:"Yes"})]})]});export{p as R};
1
+ import{u as e}from"./vendor-core-8R2fFbyN.js";import{M as r,B as n}from"./index-C65i4HWv.js";const p=({isOpen:t,itemName:c,progressKind:i,listLabel:s,alsoRemove:a,onAlsoRemoveChange:d,onClose:o,onConfirm:l})=>e(r,{isOpen:t,onClose:o,title:"Reset Progress",children:[e(r.Body,{children:[e("p",{children:["Are you sure you want to remove your ",i,' progress for "',c,'"?']}),e("label",{children:[e("input",{type:"checkbox",checked:a,onChange:h=>d(h.target.checked)}),"Also remove from ",s]})]}),e(r.Actions,{children:[e(n,{variant:"secondary",onClick:o,children:"No"}),e(n,{variant:"danger",onClick:l,children:"Yes"})]})]});export{p as R};
@@ -0,0 +1 @@
1
+ import{h as R,o as me,a as ge,d as o,A as ve,g as fe,u as a}from"./vendor-core-8R2fFbyN.js";import{I as L}from"./vendor-icons-CDMuNDeL.js";import{P as ee,S as Le}from"./SkeletonGrid-C6S7OYHn.js";import{A as Ae}from"./AnimeCard-WlhU88fn.js";import{u as be,r as ye,P as ae,B as w,Q as Se}from"./index-C65i4HWv.js";import{E as Ne}from"./ErrorMessage-z4f4WGgP.js";import{s as t}from"./Search.module-CMEai-B-.js";import"./useAnimeInfoData-BKSrS8eN.js";import"./vendor-query-BXRECSI6.js";import"./QueueOptionsButton-CcVP7Vi6.js";import"./vendor-ui-CUDCvRS_.js";import"./MediaCard-DDiYEAm8.js";import"./useIsMobile-Dm_b6Ob3.js";const Ce=[{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:"Mature"}],Te=[{value:"ALL",label:"All Seasons"},{value:"Winter",label:"Winter"},{value:"Spring",label:"Spring"},{value:"Summer",label:"Summer"},{value:"Fall",label:"Fall"}],Ee=[{value:"ALL",label:"All Countries"},{value:"JP",label:"Japan"},{value:"CN",label:"China"}],Ie=[{value:"POPULARITY_DESC",label:"Popularity"},{value:"TRENDING_DESC",label:"Trending"},{value:"SCORE_DESC",label:"Score"},{value:"START_DATE_DESC",label:"Newest"},{value:"START_DATE_ASC",label:"Oldest"},{value:"EPISODES_DESC",label:"Most Episodes"},{value:"FAVOURITES_DESC",label:"Favourites"}],De=[{value:"RELEASING",label:"Currently Airing"},{value:"FINISHED",label:"Finished"},{value:"NOT_YET_RELEASED",label:"Not Yet Released"},{value:"CANCELLED",label:"Cancelled"},{value:"HIATUS",label:"Hiatus"}];function $e(){R(()=>{document.title="Search - dango"},[]);const[r,te]=me(),le=ge(),[h,k]=o(r.get("query")||""),[p,_]=o(parseInt(r.get("page")||"1")),[u,A]=o(r.get("type")||"ALL"),[m,b]=o(r.get("season")||"ALL"),[g,y]=o(r.get("year")||"ALL"),[B,E]=o(r.get("country")||"ALL"),[G,ne]=o(r.get("provider")||"anilist"),[Y,I]=o(r.get("sortBy")||"POPULARITY_DESC"),[U,D]=o(r.get("status")||""),[S,re]=o(!1),[se,F]=o(null);R(()=>{let e=!1;return fetch("/api/anilist-status").then(n=>n.json()).then(n=>{e||F(n.available)}).catch(()=>{e||F(!0)}),()=>{e=!0}},[]);const{lowEndMode:ie}=be(),P=ve(null),{data:oe}=ye(),M=oe?.genres||[],[v,N]=o(()=>{const e={},n=r.get("genres")?.split(",").map(l=>l.trim()).filter(Boolean)||[],s=r.get("excludeGenres")?.split(",").map(l=>l.trim()).filter(Boolean)||[];return n.forEach(l=>l&&(e[l]="include")),s.forEach(l=>l&&(e[l]="exclude")),e}),$=new URLSearchParams(r);$.delete("page");const j=$.toString(),{data:f=[],isLoading:C,isError:ce,error:ue}=ae(j,p,14),{data:V}=ae(j,p+1,14),[x,de]=o(!1),T=fe.useMemo(()=>G==="anilist"&&u==="ADULT"||x?f:f.filter(e=>!(e.isAdult||e.rating==="R+"||e.rating==="Rx"||e.rating?.includes("17+"))),[f,x,G,u]);R(()=>{k(r.get("query")||""),A(r.get("type")||"ALL"),b(r.get("season")||"ALL"),y(r.get("year")||"ALL"),E(r.get("country")||"ALL"),ne(r.get("provider")||"anilist"),I(r.get("sortBy")||"POPULARITY_DESC"),D(r.get("status")||""),_(parseInt(r.get("page")||"1"));const e={},n=r.get("genres")?.split(",").map(l=>l.trim()).filter(Boolean)||[],s=r.get("excludeGenres")?.split(",").map(l=>l.trim()).filter(Boolean)||[];n.forEach(l=>l&&(e[l]="include")),s.forEach(l=>l&&(e[l]="exclude")),N(e)},[r]);const c=(e=1,n={})=>{Se();const s=n.type??u,l=n.status??U,H=n.season??m,q=n.year??g,J=n.country??B,K=n.sort??Y,Q=n.genreState??v,pe=n.showMature??x,i=new URLSearchParams;h.trim()&&i.set("query",h.trim()),s!=="ALL"&&i.set("type",s),l&&i.set("status",l),H!=="ALL"&&i.set("season",H),q!=="ALL"&&i.set("year",q),J!=="ALL"&&i.set("country",J),K!=="POPULARITY_DESC"&&i.set("sortBy",K);const X=Object.entries(Q).filter(([,d])=>d==="include").map(([d])=>d),Z=Object.entries(Q).filter(([,d])=>d==="exclude").map(([d])=>d);X.length>0&&i.set("genres",X.join(",")),Z.length>0&&i.set("excludeGenres",Z.join(",")),s!=="ADULT"&&!pe&&i.set("adult","false"),i.set("provider","anilist"),e>1&&i.set("page",e.toString()),te(i),e!==p&&_(e)},W=e=>{if(c(e),P.current){const n=P.current.getBoundingClientRect().top+window.scrollY-100;window.scrollTo({top:n,behavior:"smooth"})}},O=new Date().getFullYear(),he=[{value:"ALL",label:"All Years"},...Array.from({length:O-1980+1},(e,n)=>({value:String(O-n),label:String(O-n)}))],z=f.length>=14&&V&&V.length>0;return a("div",{className:"page-container",children:[a("div",{className:t.header,children:[a("h1",{className:t.pageTitle,children:"Search Anime"}),a("p",{className:t.pageSubtitle,children:"Search through thousands of titles and discover your next favorite"})]}),a("div",{className:t.filterContainer,children:[a("div",{className:t.searchBarWrapper,children:[a("div",{className:t.inputIconWrapper,children:[a(L,{name:"search",className:t.searchIcon}),a("input",{type:"text","data-virtual-keyboard":"true",className:t.searchInput,placeholder:"Search by title, character, or studio...",value:h,onInput:e=>k(e.currentTarget.value),onKeyDown:e=>e.key==="Enter"&&c()})]}),a("div",{className:t.searchActions,children:[a(w,{onClick:()=>c(),className:t.searchBtn,children:"Search"}),a("button",{className:`${t.filterToggleBtn} ${S?t.active:""}`,onClick:()=>re(!S),children:[a(L,{name:"filter",size:14}),a("span",{children:"Filters"}),S?a(L,{name:"chevron-up",size:12}):a(L,{name:"chevron-down",size:12})]})]})]}),a("div",{className:`${t.advancedFilters} ${S?t.show:""}`,children:[a("div",{className:t.filterDivider}),a("div",{className:t.filterGrid,children:[a("div",{className:t.filterItem,children:[a("label",{children:"Type"}),a("select",{value:u,onChange:e=>{if(e.currentTarget.value==="ADULT"){le("/mature?provider=mal");return}A(e.currentTarget.value)},children:Ce.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Status"}),a("select",{value:U,onChange:e=>D(e.currentTarget.value),children:[a("option",{value:"",children:"All Status"}),De.map(e=>a("option",{value:e.value,children:e.label},e.value))]})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Season"}),a("select",{value:m,onChange:e=>b(e.currentTarget.value),children:Te.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Year"}),a("select",{value:g,onChange:e=>y(e.currentTarget.value),children:he.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:["Country",se===!1&&a("span",{style:{display:"block",fontSize:"0.75rem",color:"var(--text-muted)",fontWeight:400},children:"AniList only — ignored by fallback providers"})]}),a("select",{value:B,onChange:e=>E(e.currentTarget.value),children:Ee.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Sort By"}),a("select",{value:Y,onChange:e=>I(e.currentTarget.value),children:Ie.map(e=>a("option",{value:e.value,children:e.label},e.value))})]})]}),M.length>0&&a("div",{className:t.genreSection,children:[a("label",{className:t.genreLabel,children:"Genres"}),a("div",{className:t.genreContainer,children:M.map(e=>a("button",{className:`${t.genreButton} ${t[v[e]||""]}`,onClick:()=>{N(n=>{const s=n[e],l={...n};return s==="include"?l[e]="exclude":s==="exclude"?delete l[e]:l[e]="include",l})},children:e},e))})]}),a("div",{className:t.filterActions,children:[a(w,{variant:"secondary",onClick:()=>{N({}),A("ALL"),b("ALL"),y("ALL"),E("ALL"),I("POPULARITY_DESC"),D(""),de(!1),c(1,{type:"ALL",status:"",season:"ALL",year:"ALL",country:"ALL",sort:"POPULARITY_DESC",genreState:{},showMature:!1})},children:"Reset All"}),a(w,{onClick:()=>c(),className:t.applyBtn,children:"Apply Filters"})]})]})]}),ce&&a(Ne,{message:ue?.message||"Error"}),(u!=="ALL"||m!=="ALL"||g!=="ALL"||Object.keys(v).length>0)&&a("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center",marginBottom:"1.5rem"},children:[a("span",{style:{fontSize:"0.8rem",color:"var(--text-muted)",fontWeight:600},children:"Active Filters:"}),u!=="ALL"&&a("span",{className:"badge badge-secondary",style:{display:"inline-flex",alignItems:"center",gap:"6px"},children:["Type: ",u,a("button",{onClick:e=>{e.stopPropagation(),e.preventDefault(),A("ALL"),c(1,{type:"ALL"})},style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"✕"})]}),m!=="ALL"&&a("span",{className:"badge badge-secondary",style:{display:"inline-flex",alignItems:"center",gap:"6px"},children:["Season: ",m,a("button",{onClick:e=>{e.stopPropagation(),e.preventDefault(),b("ALL"),c(1,{season:"ALL"})},style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"✕"})]}),g!=="ALL"&&a("span",{className:"badge badge-secondary",style:{display:"inline-flex",alignItems:"center",gap:"6px"},children:["Year: ",g,a("button",{onClick:e=>{e.stopPropagation(),e.preventDefault(),y("ALL"),c(1,{year:"ALL"})},style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"✕"})]}),Object.entries(v).map(([e,n])=>a("span",{className:`badge ${n==="include"?"badge-primary":"badge-danger"}`,style:{display:"inline-flex",alignItems:"center",gap:"6px"},children:[n==="include"?`+ ${e}`:`- ${e}`,a("button",{onClick:s=>{s.stopPropagation(),s.preventDefault();const l={...v};delete l[e],N(l),c(1,{genreState:l})},style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"✕"})]},e))]}),a("div",{className:t.resultsHeader,ref:P,children:[a("h2",{className:t.resultsTitle,children:h?`Search Results for "${h}"`:"Discover Anime"}),T.length>0&&a(ee,{page:p,canGoNext:z,onChange:W,isLoading:C})]}),a("div",{className:`${t.resultsGrid} ${ie?t.lowEnd:""}`,children:C?a(Le,{}):T.map(e=>a(Ae,{anime:e},e._id))}),!C&&T.length===0&&a("div",{className:t.noResults,children:[a(L,{name:"search",size:48,className:t.noResultsIcon}),a("h3",{children:"No results found"}),a("p",{children:"Try adjusting your search or filters to find what you're looking for."})]}),T.length>0&&a("div",{className:t.bottomPagination,children:a(ee,{page:p,canGoNext:z,onChange:W,isLoading:C,variant:"labeled"})})]})}export{$e as default};
@@ -1,4 +1,4 @@
1
- import{d as r,A as V,h as U,u as e,q as te,S as ee,T as Te,o as Re,a as De,g as ge,_ as Ie}from"./vendor-core-8R2fFbyN.js";import{d as Pe,B as D,M as G,h as xe,T as F,z as me,D as ie,E as Le,F as Oe,q as de,u as Ae,G as Ue,w as pe,x as Me,H as Ee,I as $e,V as je,J as Ge,K as Ke,L as He}from"./index-lo-bz7f2.js";import{u as ue}from"./vendor-query-BXRECSI6.js";import{I as q}from"./vendor-icons-CDMuNDeL.js";const oe={"title-preference-container":"_title-preference-container_sdqgs_1","toggle-button":"_toggle-button_sdqgs_21","toggle-label":"_toggle-label_sdqgs_51"},ce=["name","nativeName","englishName"],le={name:"Default (Romaji)",nativeName:"Native",englishName:"English"},Fe=()=>{const{titlePreference:t,setTitlePreference:n,loading:o}=Pe(),[i,l]=r(le[t]),[w,b]=r(!1),d=V(null);U(()=>{o||l(le[t])},[t,o]);const s=async()=>{if(w)return;b(!0);const g=(ce.indexOf(t)+1)%ce.length,p=ce[g],h=le[p];d.current&&(d.current.style.transform="translateX(-100%)",d.current.style.opacity="0"),setTimeout(async()=>{l(h),n(p),d.current&&(d.current.style.transition="none",d.current.style.transform="translateX(100%)",d.current.style.opacity="0",d.current.offsetWidth,d.current.style.transition="transform 0.3s ease-out, opacity 0.3s ease-out",d.current.style.transform="translateX(0)",d.current.style.opacity="1");try{await fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:"titlePreference",value:p})})}catch(C){console.error("Error saving title preference:",C)}finally{b(!1)}},300)};return o?e("p",{children:"Loading title preference..."}):e("div",{className:oe["title-preference-container"],children:[e("h4",{children:"Anime Title Display Preference"}),e("button",{onClick:s,className:oe["toggle-button"],disabled:w,children:e("span",{ref:d,className:oe["toggle-label"],children:i})})]})},ze="_settingsHeader_14a5d_1",Be="_pageTitle_14a5d_6",We="_pageSubtitle_14a5d_14",qe="_settingsLayout_14a5d_20",Ve="_sidebar_14a5d_27",Je="_sidebarIndicator_14a5d_35",Ye="_sidebarItem_14a5d_50",Qe="_active_14a5d_72",Xe="_mainContent_14a5d_80",Ze="_tabContent_14a5d_85",et="_sectionCard_14a5d_103",tt="_settingItem_14a5d_127",at="_settingRow_14a5d_132",nt="_controls_14a5d_145",st="_status_14a5d_151",m={settingsHeader:ze,pageTitle:Be,pageSubtitle:We,settingsLayout:qe,sidebar:Ve,sidebarIndicator:Je,sidebarItem:Ye,active:Qe,mainContent:Xe,tabContent:Ze,sectionCard:et,settingItem:tt,settingRow:at,controls:nt,status:st},rt="_sectionCard_wt900_12",it="_title_wt900_22",ot="_signIn_wt900_29",ct="_userInfo_wt900_36",lt="_warning_wt900_58",dt="_formGroup_wt900_65",ut="_label_wt900_69",ht="_inputWrapper_wt900_79",gt="_input_wt900_79",mt="_select_wt900_103",pt="_actions_wt900_140",yt="_hr_wt900_148",y={sectionCard:rt,title:it,signIn:ot,userInfo:ct,warning:lt,formGroup:dt,label:ut,inputWrapper:ht,input:gt,select:mt,actions:pt,hr:yt},ft=()=>{const[t,n]=r(!0),[o,i]=r(!1),[l,w]=r(!1),[b,d]=r(null),[s,u]=r({status:"idle"}),[g,p]=r(!1),[h,C]=r(""),[k,f]=r(!1),I=V(null),[T,P]=r({show:!1,message:"",type:"info"}),N=()=>{I.current&&(window.clearInterval(I.current),I.current=null)},L=te(S=>{w(S.authenticated),d(S.user||S.device.user||null),u(S.device),p(!!S.hasCustomClientId)},[]),O=te(async()=>{const M=await(await fetch("/api/auth/github/status")).json();L(M)},[L]),E=async()=>{try{const M=await(await fetch("/api/auth/github/poll")).json();u(M),M.status==="success"?(N(),await O(),P({show:!0,message:"GitHub authentication complete. Sync has been initialized.",type:"success"})):M.status==="error"&&(N(),P({show:!0,message:M.error||"GitHub authentication failed.",type:"error"}))}catch{N(),P({show:!0,message:"Failed to poll GitHub authentication status.",type:"error"})}},_=(S=5)=>{N(),I.current=window.setInterval(E,Math.max(S,5)*1e3)};U(()=>(O().catch(()=>{P({show:!0,message:"Failed to load GitHub sync status.",type:"error"})}).finally(()=>n(!1)),N),[O]);const v=async()=>{i(!0);try{const S=await fetch("/api/auth/github/start",{method:"POST"}),M=await S.json();if(!S.ok)throw new Error("Failed to start GitHub authentication.");u(M),_(M.verification?.interval)}catch(S){P({show:!0,message:S instanceof Error?S.message:"Failed to start GitHub authentication.",type:"error"})}finally{i(!1)}},R=async()=>{try{await fetch("/api/auth/github/logout",{method:"POST"}),w(!1),d(null),u({status:"idle"}),P({show:!0,message:"Signed out of GitHub sync.",type:"success"})}catch{P({show:!0,message:"Failed to sign out of GitHub.",type:"error"})}},$=async()=>{f(!0);try{if(!(await fetch("/api/auth/github/auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:h})})).ok)throw new Error("save failed");C(""),await O(),P({show:!0,message:"Custom GitHub auth saved.",type:"success"})}catch{P({show:!0,message:"Failed to save override.",type:"error"})}finally{f(!1)}},K=async()=>{f(!0);try{await fetch("/api/auth/github/auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:""})}),C(""),await O(),P({show:!0,message:"Custom auth cleared. Using dango defaults.",type:"success"})}catch{P({show:!0,message:"Failed to clear override.",type:"error"})}finally{f(!1)}};return t?e("div",{style:{color:"var(--text-secondary)",padding:"1.5rem"},children:"Loading..."}):e("div",{className:y.sectionCard,children:[e("h3",{className:y.title,children:"GitHub Cloud Sync"}),e("p",{className:y.signIn,children:"Sync local data through a private GitHub repository named dango-sync-data."}),l&&b?e("div",{className:y.userInfo,children:[e("p",{children:["Signed in as: ",e("strong",{children:b.name||b.login})]}),e(D,{variant:"danger",onClick:R,children:"Sign Out"})]}):e("div",{className:y.signIn,children:e(D,{onClick:v,disabled:o||s.status==="pending",children:o||s.status==="pending"?"Waiting for GitHub...":"Sign in with GitHub"})}),s.status==="pending"&&s.verification&&e(ee,{children:[e("hr",{className:y.hr}),e("div",{className:y.formGroup,children:[e("label",{className:y.label,children:"Verification URL"}),e("div",{className:y.inputWrapper,children:[e("input",{className:y.input,value:s.verification.verification_uri,readOnly:!0}),e(D,{onClick:()=>{const S=s.verification?.verification_uri;S&&/^https?:\/\//i.test(S)&&window.open(S,"_blank","noopener,noreferrer")},children:"Open"})]})]}),e("div",{className:y.formGroup,children:[e("label",{className:y.label,children:"Device Code"}),e("input",{className:y.input,value:s.verification.user_code,readOnly:!0})]})]}),s.status==="error"&&e("p",{className:y.warning,children:s.error}),e("details",{style:{marginTop:"1rem",fontSize:"var(--font-size-sm)"},children:[e("summary",{style:{cursor:"pointer",color:"var(--text-secondary)"},children:["Advanced: use your own auth ",g?"(override active)":""]}),e("div",{className:y.formGroup,style:{marginTop:"0.75rem"},children:[e("label",{className:y.label,children:"Client ID (optional)"}),e("input",{className:y.input,value:h,onChange:S=>C(S.currentTarget.value),placeholder:"Your GitHub OAuth app ID"})]}),e("div",{className:y.actions,children:[e(D,{onClick:$,disabled:k,children:"Save override"}),e(D,{variant:"secondary",onClick:K,disabled:k,children:"Use dango defaults"})]})]}),e(G,{isOpen:T.show,onClose:()=>P(S=>({...S,show:!1})),width:"sm",children:[e(G.Body,{children:e("p",{children:T.message})}),e(G.Actions,{children:e(D,{onClick:()=>P(S=>({...S,show:!1})),children:"OK"})})]})]})},wt=()=>{const[t,n]=r(!0),[o,i]=r(null),[l,w]=r(!1),[b,d]=r(!1),[s,u]=r(""),[g,p]=r(""),[h,C]=r(""),[k,f]=r(!1),[I,T]=r({show:!1,message:"",type:"info"}),P=async()=>{try{const R=await(await fetch("/api/auth/user")).json();i(R?.email?R:null)}catch{i(null)}},N=async()=>{try{const[v,R]=await Promise.all([fetch("/api/auth/config-status"),fetch("/api/auth/google-auth")]),$=await v.json(),K=await R.json();w(!!$.hasConfig),d(!!(K.hasCustomWorkerUrl||K.hasCustomClientId||K.hasClientSecret))}catch(v){console.error("Failed to fetch config status",v)}};U(()=>{(async()=>{n(!0),await Promise.all([P(),N()]);try{new URLSearchParams(window.location.search).get("google_auth")==="success"&&(await P(),window.history.replaceState(null,"",window.location.pathname))}catch{}n(!1)})();const R=$=>{$.origin===window.location.origin&&typeof $.data=="object"&&$.data!==null&&$.data.type==="GOOGLE_AUTH_SUCCESS"&&(i($.data.user),window.location.reload())};return window.addEventListener("message",R),()=>window.removeEventListener("message",R)},[]);const L=async()=>{try{const R=await(await fetch("/api/auth/google/login",{method:"POST"})).json();if(R.authenticated){window.location.reload();return}if(R.url){if(typeof window.DangoBridge<"u"){window.location.href=R.url;return}const K=600,S=700,M=window.innerWidth/2-K/2,ae=window.innerHeight/2-S/2;window.open(R.url,"GoogleAuth",`width=${K},height=${S},top=${ae},left=${M}`)}else throw new Error("Auth URL not available")}catch{T({show:!0,message:"Authentication failed. Ensure server is configured correctly.",type:"error"})}},O=async()=>{try{await fetch("/api/auth/logout",{method:"POST"}),i(null),T({show:!0,message:"Successfully signed out.",type:"success"}),window.location.reload()}catch(v){console.error("Sign out failed",v),T({show:!0,message:"Failed to sign out.",type:"error"})}},E=async()=>{f(!0);try{if(!(await fetch("/api/auth/google-auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workerUrl:s,clientId:g,clientSecret:h})})).ok)throw new Error("save failed");u(""),p(""),C(""),await N(),T({show:!0,message:"Custom auth saved. Restart may be required.",type:"success"})}catch{T({show:!0,message:"Failed to save override.",type:"error"})}finally{f(!1)}},_=async()=>{f(!0);try{await fetch("/api/auth/google-auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workerUrl:"",clientId:"",clientSecret:""})}),u(""),p(""),C(""),await N(),T({show:!0,message:"Custom auth cleared. Using dango defaults.",type:"success"})}catch{T({show:!0,message:"Failed to clear override.",type:"error"})}finally{f(!1)}};return t?e("div",{style:{color:"var(--text-secondary)",padding:"1.5rem"},children:"Loading..."}):e("div",{className:y.sectionCard,children:[e("h3",{className:y.title,children:"Google Drive Sync"}),o?e("div",{className:y.userInfo,children:[e("p",{children:["Signed in as: ",e("strong",{children:o.name})," (",o.email,")"]}),e(D,{variant:"danger",onClick:O,children:"Sign Out"})]}):e("div",{className:y.signIn,children:[e("p",{children:"Sign in with your Google account to enable synchronization features."}),e(D,{onClick:L,disabled:!l,children:"Sign in with Google"}),!l&&e("p",{className:y.warning,children:"Google sync is not configured on the server."})]}),e("details",{style:{marginTop:"1rem",fontSize:"var(--font-size-sm)"},children:[e("summary",{style:{cursor:"pointer",color:"var(--text-secondary)"},children:["Advanced: use your own auth ",b?"(override active)":""]}),e("div",{className:y.formGroup,style:{marginTop:"0.75rem"},children:[e("label",{className:y.label,children:"Worker URL (optional)"}),e("input",{className:y.input,value:s,onChange:v=>u(v.currentTarget.value),placeholder:"https://your-worker.workers.dev"})]}),e("div",{className:y.formGroup,children:[e("label",{className:y.label,children:"Client ID (optional)"}),e("input",{className:y.input,value:g,onChange:v=>p(v.currentTarget.value),placeholder:"Your Google OAuth client ID"})]}),e("div",{className:y.formGroup,children:[e("label",{className:y.label,children:"Client Secret (optional)"}),e("input",{type:"password",className:y.input,value:h,onChange:v=>C(v.currentTarget.value),placeholder:"Your Google OAuth secret"})]}),e("div",{className:y.actions,children:[e(D,{onClick:E,disabled:k,children:"Save override"}),e(D,{variant:"secondary",onClick:_,disabled:k,children:"Use dango defaults"})]})]}),e(G,{isOpen:I.show,onClose:()=>T(v=>({...v,show:!1})),width:"sm",children:[e(G.Body,{children:e("p",{children:I.message})}),e(G.Actions,{children:e(D,{onClick:()=>T(v=>({...v,show:!1})),children:"OK"})})]})]})},vt="_sectionCard_1pqo4_1",bt="_settingItem_1pqo4_26",_t="_settingRow_1pqo4_31",kt="_modalOverlay_1pqo4_38",St="_modal_1pqo4_38",Ct="_modalActions_1pqo4_73",Nt="_modalSecondary_1pqo4_79",Tt="_modalPrimary_1pqo4_89",j={sectionCard:vt,settingItem:bt,settingRow:_t,modalOverlay:kt,modal:St,modalActions:Ct,modalSecondary:Nt,modalPrimary:Tt},Rt={anime:{heading:"Watchlist Preferences",blurb:"Customize your experience when managing your watchlist and series entries.",skipKey:"skipRemoveConfirmation",ignoreKey:"ignoreAdultContent",listOnlyKey:"cwWatchlistOnly",skipLabel:"Skip confirmation when removing from watchlist",ignoreLabel:"Hide adult content from continue watching",listOnlyLabel:"Only show continue watching for shows in watchlist",listNoun:"watchlist",continueNoun:"continue watching",adultCountUrl:"/api/continue-watching/adult-count",purgeUrl:"/api/continue-watching/purge-adult",purgeDoneText:t=>`Removed ${t??0} entries from continue watching`,invalidateKeys:[["allContinueWatching"]]},manga:{heading:"Reading List Preferences",blurb:"Customize your experience when managing your reading list and manga entries.",skipKey:"mangaSkipRemoveConfirmation",ignoreKey:"mangaIgnoreAdultContent",listOnlyKey:"mangaCwWatchlistOnly",skipLabel:"Skip confirmation when removing from reading list",ignoreLabel:"Hide adult content from continue reading",listOnlyLabel:"Only show continue reading for manga in reading list",listNoun:"reading list",continueNoun:"continue reading",adultCountUrl:"/api/manga/continue-reading/adult-count",purgeUrl:"/api/manga/continue-reading/purge-adult",purgeDoneText:t=>`Removed ${t??0} entries from continue reading`,invalidateKeys:[["manga-continue-reading"]]},tv:{heading:"TV Watchlist Preferences",blurb:"Customize your experience when managing your TV watchlist and series entries.",skipKey:"tvSkipRemoveConfirmation",ignoreKey:"tvIgnoreAdultContent",listOnlyKey:"tvCwWatchlistOnly",skipLabel:"Skip confirmation when removing from TV watchlist",ignoreLabel:"Hide adult content from continue watching",listOnlyLabel:"Only show continue watching for shows in TV watchlist",listNoun:"TV watchlist",continueNoun:"continue watching",adultCountUrl:"/api/tv/continue-watching/adult-count",purgeUrl:"/api/tv/continue-watching/purge-adult",purgeDoneText:t=>`Removed ${t??0} entries from continue watching`,invalidateKeys:[["tv-continue-watching"]]},asmr:{heading:"Listening List Preferences",blurb:"Customize your experience when managing your listening list and work entries.",skipKey:"asmrSkipRemoveConfirmation",ignoreKey:"asmrIgnoreAdultContent",listOnlyKey:"asmrCwWatchlistOnly",skipLabel:"Skip confirmation when removing from listening list",ignoreLabel:"Hide adult content from continue listening",listOnlyLabel:"Only show continue listening for works in listening list",listNoun:"listening list",continueNoun:"continue listening",adultCountUrl:"/api/asmr/continue-listening/adult-count",purgeUrl:"/api/asmr/continue-listening/purge-adult",purgeDoneText:t=>`Removed ${t??0} entries from continue listening`,invalidateKeys:[["asmr-continue-listening"]]}},Dt=(t,n)=>{if(t==null)return n;const o=String(t);return o==="true"||o==="1"?!0:o==="false"||o==="0"?!1:n},ye=(t,n,o)=>{const[i,l]=r(n),[w,b]=r(!1),d=ue();return U(()=>{(async()=>{try{const p=await(await fetch(`/api/settings?key=${t}`)).json();l(Dt(p.value,n))}catch(g){console.error("Failed to fetch setting",g)}})()},[t,n]),{value:i,setValue:l,isUpdating:w,toggle:async()=>{if(w)return;b(!0);const u=!i;l(u);try{await fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:t,value:u})});for(const g of o)d.invalidateQueries({queryKey:g})}catch(g){console.error("Error saving setting:",g),l(!u)}finally{b(!1)}}}},It=()=>{const{contentType:t}=xe(),n=Rt[t],[o,i]=r(!1),[l,w]=r(!0),[b,d]=r(!1),s=ye(n.ignoreKey,!0,n.invalidateKeys),u=ye(n.listOnlyKey,!1,n.invalidateKeys),[g,p]=r(null),[h,C]=r(!1),k=ue();U(()=>{w(!0),(async()=>{try{const O=await(await fetch(`/api/settings?key=${n.skipKey}`)).json();String(O.value)==="true"||String(O.value)==="1"?i(!0):i(!1)}catch(L){console.error("Failed to fetch setting",L)}finally{w(!1)}})()},[n.skipKey]);const f=async()=>{if(b)return;d(!0);const N=!o;i(N);try{await fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:n.skipKey,value:N})})}catch(L){console.error("Error saving setting:",L),i(!N)}finally{d(!1)}},I=async()=>{if(!s.isUpdating){if(s.value)try{const L=await(await fetch(n.adultCountUrl)).json();if(typeof L.count=="number"&&L.count>0){p(L.count);return}}catch(N){console.error("Failed to fetch adult count",N)}s.toggle()}},T=()=>{p(null),s.toggle()},P=async()=>{if(!h){C(!0);try{const L=await(await fetch(n.purgeUrl,{method:"POST"})).json();me.success(n.purgeDoneText(L.removed));for(const O of n.invalidateKeys)k.invalidateQueries({queryKey:O})}catch(N){console.error("Failed to purge adult entries",N),me.error("Failed to remove adult entries")}finally{C(!1),p(null)}s.toggle()}};return l?e("div",{children:"Loading settings..."}):e("div",{className:j.sectionCard,children:[e("h3",{children:n.heading}),e("p",{children:n.blurb}),e("div",{className:j.settingItem,children:e("div",{className:j.settingRow,children:[e("label",{htmlFor:"skip-confirmation-toggle",children:n.skipLabel}),e(F,{isChecked:o,onChange:f,id:"skip-confirmation-toggle",disabled:b})]})}),e("div",{className:j.settingItem,children:e("div",{className:j.settingRow,children:[e("label",{htmlFor:"ignore-adult-toggle",children:n.ignoreLabel}),e(F,{isChecked:s.value,onChange:I,id:"ignore-adult-toggle",disabled:s.isUpdating})]})}),e("div",{className:j.settingItem,children:e("div",{className:j.settingRow,children:[e("label",{htmlFor:"cw-watchlist-only-toggle",children:n.listOnlyLabel}),e(F,{isChecked:u.value,onChange:u.toggle,id:"cw-watchlist-only-toggle",disabled:u.isUpdating})]})}),g!==null&&e("div",{className:j.modalOverlay,onClick:()=>p(null),children:e("div",{className:j.modal,onClick:N=>N.stopPropagation(),children:[e("h4",{children:"Show adult entries?"}),e("p",{children:[g," adult ",g===1?"entry":"entries"," not in your"," ",n.listNoun," ",g===1?"is":"are"," currently hidden from"," ",n.continueNoun,". You can purge ",g===1?"it":"them"," from the database instead of showing ",g===1?"it":"them","."]}),e("div",{className:j.modalActions,children:[e("button",{type:"button",className:j.modalSecondary,onClick:T,disabled:h,children:"Show them"}),e("button",{type:"button",className:j.modalPrimary,onClick:P,disabled:h,children:h?"Purging...":`Purge ${g}`})]})]})})]})},Pt="_sectionCard_jkggs_1",xt="_statsGrid_jkggs_26",Lt="_statCard_jkggs_33",Ot="_statLabel_jkggs_43",At="_statValue_jkggs_51",Ut="_statMeta_jkggs_57",Mt="_statusBanner_jkggs_63",Et="_statusSuccess_jkggs_74",$t="_statusUpdating_jkggs_80",jt="_statusError_jkggs_86",Gt="_sha_jkggs_92",Kt="_settingItem_jkggs_99",Ht="_settingRow_jkggs_104",Ft="_settingTitle_jkggs_111",zt="_settingSubtitle_jkggs_117",Bt="_actionsRow_jkggs_124",x={sectionCard:Pt,statsGrid:xt,statCard:Lt,statLabel:Ot,statValue:At,statMeta:Ut,statusBanner:Mt,statusSuccess:Et,statusUpdating:$t,statusError:jt,sha:Gt,settingItem:Kt,settingRow:Ht,settingTitle:Ft,settingSubtitle:zt,actionsRow:Bt},Wt=()=>{const[t,n]=r(null),[o,i]=r(!0),[l,w]=r(!1),[b,d]=r(!1),s=V(null),u=async()=>{try{const k=await fetch("/api/settings/offline-db");if(k.ok){const f=await k.json();return n(f),f}}catch(k){console.error("Failed to fetch offline DB info:",k)}finally{i(!1)}return null};U(()=>(u(),()=>{s.current&&window.clearInterval(s.current)}),[]),U(()=>{t?.isRefreshing?s.current||(s.current=window.setInterval(async()=>{const k=await u();k&&!k.isRefreshing&&s.current&&(window.clearInterval(s.current),s.current=null)},2e3)):s.current&&(window.clearInterval(s.current),s.current=null)},[t?.isRefreshing]);const g=async()=>{if(!t||l)return;const k=!t.autoUpdateEnabled;w(!0),n({...t,autoUpdateEnabled:k});try{(await fetch("/api/settings/offline-db/auto-update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:k})})).ok||n({...t,autoUpdateEnabled:!k})}catch(f){console.error("Failed to update auto update setting:",f),n({...t,autoUpdateEnabled:!k})}finally{w(!1)}},p=async()=>{if(!(t?.isRefreshing||b)){d(!0);try{(await fetch("/api/settings/offline-db/update",{method:"POST"})).ok&&n(f=>f?{...f,isRefreshing:!0,lastStatus:"updating",lastMessage:"Downloading database..."}:null)}catch(k){console.error("Failed to trigger offline DB update:",k)}finally{d(!1)}}},h=k=>{if(!k)return"Never";try{return new Date(k).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}catch{return k}},C=t?.isRefreshing||b;return e("div",{className:x.sectionCard,children:[e("h3",{children:"Offline Metadata Database"}),e("p",{children:"Local MAL to AniList ID map used for instant imports and metadata enrichment without hitting rate-limited APIs. Updates automatically every Saturday in the background."}),e("div",{className:x.statsGrid,children:[e("div",{className:x.statCard,children:[e("span",{className:x.statLabel,children:"MAL Mapped"}),e("span",{className:x.statValue,children:o?"—":(t?.totalMalMapped??0).toLocaleString()})]}),e("div",{className:x.statCard,children:[e("span",{className:x.statLabel,children:"Release"}),e("span",{className:x.statMeta,children:o?"—":t?.releaseTag??"Never"})]}),e("div",{className:x.statCard,children:[e("span",{className:x.statLabel,children:"Last Checked"}),e("span",{className:x.statMeta,children:o?"—":h(t?.lastCheckedAt??null)})]}),e("div",{className:x.statCard,children:[e("span",{className:x.statLabel,children:"Last Updated"}),e("span",{className:x.statMeta,children:o?"—":h(t?.lastUpdatedAt??null)})]})]}),t?.lastMessage&&e("div",{className:`${x.statusBanner} ${t.lastStatus==="failed"?x.statusError:t.lastStatus==="updating"?x.statusUpdating:x.statusSuccess}`,children:[e("span",{children:t.lastMessage}),t.contentSha256&&e("span",{className:x.sha,children:["sha:",t.contentSha256.slice(0,12)]})]}),e("div",{className:x.settingItem,children:e("div",{className:x.settingRow,children:[e("div",{children:[e("span",{className:x.settingTitle,children:"Weekly Automatic Updates (Saturdays)"}),e("div",{className:x.settingSubtitle,children:"Download and index new database releases in the background. Catches up on startup if the server was offline."})]}),e(F,{id:"offline-db-auto-update-toggle",isChecked:t?t.autoUpdateEnabled:!0,onChange:g,disabled:o||l})]})}),e("div",{className:x.actionsRow,children:e(D,{onClick:p,disabled:o||C,children:C?"Updating Database...":"Update Offline Database Now"})})]})},qt="_sectionCard_1g4qx_1",Vt="_dangerCard_1g4qx_26",Jt="_status_1g4qx_34",Yt="_warningText_1g4qx_40",Qt="_ackLabel_1g4qx_44",Z={sectionCard:qt,dangerCard:Vt,status:Jt,warningText:Yt,ackLabel:Qt},Xt=()=>{const t=ue(),[n,o]=r(!1),[i,l]=r(!1),[w,b]=r(!1),[d,s]=r(""),u=()=>{l(!1),s(""),o(!0)},g=()=>{w||(o(!1),l(!1))},p=async()=>{if(!(!i||w)){b(!0),s("");try{const h=await fetch("/api/database/clear",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({confirm:!0})}),C=await h.json();if(!h.ok)throw new Error(C.error||"Failed to clear database");const k=C.deleted,f=C.deletedManga,I=C.deletedTv,T=C.deletedAsmr,P=Object.values(k).reduce((E,_)=>E+(_||0),0)+Object.values(f??{}).reduce((E,_)=>E+(_||0),0)+Object.values(I??{}).reduce((E,_)=>E+(_||0),0)+Object.values(T??{}).reduce((E,_)=>E+(_||0),0),N=(f?.manga_library??0)+(f?.manga_progress??0),L=(I?.tv_library??0)+(I?.tv_progress??0),O=(T?.asmr_library??0)+(T?.asmr_progress??0);s(`Library cleared — ${k.watchlist??0} watchlist entries, ${N} manga rows, ${L} TV rows, ${O} ASMR rows and ${P} total rows removed.`),t.invalidateQueries({queryKey:["watchlist"]}),t.invalidateQueries({queryKey:["allContinueWatching"]}),t.invalidateQueries({queryKey:["manga-library"]}),t.invalidateQueries({queryKey:["manga-library-ids"]}),t.invalidateQueries({queryKey:["manga-continue-reading"]}),t.invalidateQueries({queryKey:["tv-library"]}),t.invalidateQueries({queryKey:["tv-library-ids"]}),t.invalidateQueries({queryKey:["tv-continue-watching"]}),t.invalidateQueries({queryKey:["asmr-library"]}),t.invalidateQueries({queryKey:["asmr-library-ids"]}),t.invalidateQueries({queryKey:["asmr-continue-listening"]}),o(!1)}catch(h){s(h.message)}finally{b(!1),l(!1)}}};return e("div",{className:`${Z.sectionCard} ${Z.dangerCard}`,children:[e("h3",{children:"Danger Zone"}),e("p",{children:"Permanently delete your library (watchlist, watched episodes, queue, cached show metadata, manga reading list and reading progress, TV watchlist and watch progress, ASMR listening list and listening progress) to start fresh. Your settings, sync state and the offline metadata cache are preserved."}),e(D,{variant:"danger",onClick:u,children:"Clear Library Data"}),d&&e("p",{className:Z.status,children:d}),e(G,{isOpen:n,onClose:g,title:"Clear library data?",width:"sm",children:[e(G.Body,{children:[e("p",{className:Z.warningText,children:"This permanently deletes everything in your library. It acts on the active database (dev or prod, per server config) and cannot be undone. Settings, sync state and the offline metadata cache are kept."}),e("label",{className:Z.ackLabel,children:[e("input",{type:"checkbox",checked:i,onChange:h=>l(h.target.checked),disabled:w}),e("span",{children:"I understand this permanently deletes my library"})]})]}),e(G.Actions,{children:[e(D,{variant:"secondary",onClick:g,disabled:w,children:"Cancel"}),e(D,{variant:"danger",onClick:p,disabled:!i||w,children:w?"Clearing...":"Yes, delete everything"})]})]})]})},Zt=()=>{const[t,n]=r(""),[o,i]=r([]),[l,w]=r(null),[b,d]=r(!0),[s,u]=r({show:!1,message:"",type:"info"}),g=async()=>{try{d(!0);const C=await(await fetch("/api/auth/settings/rclone")).json();n(C.remote||""),i(C.availableRemotes||[]),w(C.activeRemote||null)}catch(h){console.error("Failed to fetch Rclone settings",h)}finally{d(!1)}};U(()=>{g()},[]);const p=async()=>{try{if((await fetch("/api/auth/settings/rclone",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({remote:t})})).ok)u({show:!0,message:"Rclone configuration saved successfully. You must restart the server for these changes to take effect.",type:"success"}),g();else throw new Error("Failed to save")}catch{u({show:!0,message:"Failed to save Rclone configuration.",type:"error"})}};return b?e("div",{style:{color:"var(--text-secondary)",padding:"1.5rem"},children:"Loading..."}):e("div",{className:y.sectionCard,children:[e("h3",{className:y.title,children:"Rclone Cloud Sync"}),e("p",{className:y.signIn,children:"Configure which Rclone remote to use for database synchronization."}),l?e("div",{className:y.userInfo,children:e("p",{children:["Current Active Remote: ",e("strong",{children:l})]})}):e("p",{className:y.warning,style:{marginBottom:"1.5rem"},children:"Rclone sync is not currently active. Ensure rclone is installed and a remote is configured."}),e("div",{className:y.formGroup,children:[e("label",{className:y.label,children:"Remote Name"}),e("div",{className:y.inputWrapper,children:e("select",{className:y.select,value:t,onChange:h=>n(h.target.value),children:[e("option",{value:"",children:"(Disabled / None)"}),o.map(h=>e("option",{value:h,children:h},h)),t&&!o.includes(t)&&e("option",{value:t,children:[t," (Manual)"]})]})}),e("p",{className:y.warning,style:{marginTop:"12px"},children:[e("strong",{children:"Note:"})," You can choose which provider is active using the selector at the top of the page."]})]}),e("div",{className:y.actions,children:e(D,{onClick:p,children:"Save Rclone Settings"})}),e(G,{isOpen:s.show,onClose:()=>u(h=>({...h,show:!1})),width:"sm",children:[e(G.Body,{children:e("p",{children:s.message})}),e(G.Actions,{children:e(D,{onClick:()=>u(h=>({...h,show:!1})),children:"OK"})})]})]})},ea=()=>{const[t,n]=r(null),[o,i]=r(!0),l=async()=>{try{const u=await(await fetch("/api/auth/settings/sync")).json();n(u)}catch(s){console.error("Failed to fetch sync settings",s)}finally{i(!1)}};U(()=>{l()},[]);const w=async s=>{const u=s.target.value;try{const g=await fetch("/api/auth/settings/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:u})});if(g.ok){const p=await g.json();n(h=>h?{...h,activeProvider:p.activeProvider}:null),await l(),ie.success(`Sync provider updated to ${u==="default"?"Default Order":u}`)}else ie.error("Failed to update sync provider")}catch{ie.error("Error updating sync provider")}};if(o||!t)return null;const b=[{value:"default",label:"Default (Priority Based)"}];t.authenticatedProviders.github&&b.push({value:"github",label:"GitHub"}),t.authenticatedProviders.google&&b.push({value:"google",label:"Google Drive"}),t.authenticatedProviders.rclone&&b.push({value:"rclone",label:"Rclone"}),b.push({value:"none",label:"None (Local Only)"});const d=s=>s==="none"?"Local Only (No Sync)":s==="google"?"Google Drive":s==="github"?"GitHub":s==="rclone"?"Rclone":s;return e("div",{className:m.sectionCard,children:[e("h3",{children:"Active Sync Provider"}),e("p",{children:'Choose which provider to use for synchronization. "Default" uses the first available provider you are logged into.'}),e("div",{style:{marginBottom:"1.5rem",padding:"0.75rem",background:"rgba(255, 255, 255, 0.03)",borderRadius:"var(--radius-md)",borderLeft:"4px solid var(--accent)",fontSize:"var(--font-size-sm)"},children:["Current Status:"," ",e("strong",{style:{color:"var(--accent-light)",textTransform:"capitalize"},children:d(t.actualActiveProvider)})]}),e("div",{className:m.settingRow,children:[e("label",{htmlFor:"sync-provider-select",children:"Selected Preference"}),e("select",{id:"sync-provider-select",value:t.activeProvider,onChange:w,style:{padding:"0.5rem",borderRadius:"var(--radius-md)",background:"rgba(255, 255, 255, 0.05)",color:"var(--text-primary)",border:"1px solid var(--glass-border)",fontSize:"var(--font-size-sm)",minWidth:"220px",outline:"none",cursor:"pointer"},children:b.map(s=>e("option",{value:s.value,children:s.label},s.value))})]})]})};function ta(){return"javascript:"+encodeURIComponent(`(function(){
1
+ import{d as r,A as V,h as U,u as e,q as te,S as ee,T as Te,o as Re,a as De,g as ge,_ as Ie}from"./vendor-core-8R2fFbyN.js";import{d as Pe,B as D,M as G,h as xe,T as F,z as me,D as ie,E as Le,F as Oe,q as de,u as Ae,G as Ue,w as pe,x as Me,H as Ee,I as $e,V as je,J as Ge,K as Ke,L as He}from"./index-C65i4HWv.js";import{u as ue}from"./vendor-query-BXRECSI6.js";import{I as q}from"./vendor-icons-CDMuNDeL.js";const oe={"title-preference-container":"_title-preference-container_sdqgs_1","toggle-button":"_toggle-button_sdqgs_21","toggle-label":"_toggle-label_sdqgs_51"},ce=["name","nativeName","englishName"],le={name:"Default (Romaji)",nativeName:"Native",englishName:"English"},Fe=()=>{const{titlePreference:t,setTitlePreference:n,loading:o}=Pe(),[i,l]=r(le[t]),[w,b]=r(!1),d=V(null);U(()=>{o||l(le[t])},[t,o]);const s=async()=>{if(w)return;b(!0);const g=(ce.indexOf(t)+1)%ce.length,p=ce[g],h=le[p];d.current&&(d.current.style.transform="translateX(-100%)",d.current.style.opacity="0"),setTimeout(async()=>{l(h),n(p),d.current&&(d.current.style.transition="none",d.current.style.transform="translateX(100%)",d.current.style.opacity="0",d.current.offsetWidth,d.current.style.transition="transform 0.3s ease-out, opacity 0.3s ease-out",d.current.style.transform="translateX(0)",d.current.style.opacity="1");try{await fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:"titlePreference",value:p})})}catch(C){console.error("Error saving title preference:",C)}finally{b(!1)}},300)};return o?e("p",{children:"Loading title preference..."}):e("div",{className:oe["title-preference-container"],children:[e("h4",{children:"Anime Title Display Preference"}),e("button",{onClick:s,className:oe["toggle-button"],disabled:w,children:e("span",{ref:d,className:oe["toggle-label"],children:i})})]})},ze="_settingsHeader_14a5d_1",Be="_pageTitle_14a5d_6",We="_pageSubtitle_14a5d_14",qe="_settingsLayout_14a5d_20",Ve="_sidebar_14a5d_27",Je="_sidebarIndicator_14a5d_35",Ye="_sidebarItem_14a5d_50",Qe="_active_14a5d_72",Xe="_mainContent_14a5d_80",Ze="_tabContent_14a5d_85",et="_sectionCard_14a5d_103",tt="_settingItem_14a5d_127",at="_settingRow_14a5d_132",nt="_controls_14a5d_145",st="_status_14a5d_151",m={settingsHeader:ze,pageTitle:Be,pageSubtitle:We,settingsLayout:qe,sidebar:Ve,sidebarIndicator:Je,sidebarItem:Ye,active:Qe,mainContent:Xe,tabContent:Ze,sectionCard:et,settingItem:tt,settingRow:at,controls:nt,status:st},rt="_sectionCard_wt900_12",it="_title_wt900_22",ot="_signIn_wt900_29",ct="_userInfo_wt900_36",lt="_warning_wt900_58",dt="_formGroup_wt900_65",ut="_label_wt900_69",ht="_inputWrapper_wt900_79",gt="_input_wt900_79",mt="_select_wt900_103",pt="_actions_wt900_140",yt="_hr_wt900_148",y={sectionCard:rt,title:it,signIn:ot,userInfo:ct,warning:lt,formGroup:dt,label:ut,inputWrapper:ht,input:gt,select:mt,actions:pt,hr:yt},ft=()=>{const[t,n]=r(!0),[o,i]=r(!1),[l,w]=r(!1),[b,d]=r(null),[s,u]=r({status:"idle"}),[g,p]=r(!1),[h,C]=r(""),[k,f]=r(!1),I=V(null),[T,P]=r({show:!1,message:"",type:"info"}),N=()=>{I.current&&(window.clearInterval(I.current),I.current=null)},L=te(S=>{w(S.authenticated),d(S.user||S.device.user||null),u(S.device),p(!!S.hasCustomClientId)},[]),O=te(async()=>{const M=await(await fetch("/api/auth/github/status")).json();L(M)},[L]),E=async()=>{try{const M=await(await fetch("/api/auth/github/poll")).json();u(M),M.status==="success"?(N(),await O(),P({show:!0,message:"GitHub authentication complete. Sync has been initialized.",type:"success"})):M.status==="error"&&(N(),P({show:!0,message:M.error||"GitHub authentication failed.",type:"error"}))}catch{N(),P({show:!0,message:"Failed to poll GitHub authentication status.",type:"error"})}},_=(S=5)=>{N(),I.current=window.setInterval(E,Math.max(S,5)*1e3)};U(()=>(O().catch(()=>{P({show:!0,message:"Failed to load GitHub sync status.",type:"error"})}).finally(()=>n(!1)),N),[O]);const v=async()=>{i(!0);try{const S=await fetch("/api/auth/github/start",{method:"POST"}),M=await S.json();if(!S.ok)throw new Error("Failed to start GitHub authentication.");u(M),_(M.verification?.interval)}catch(S){P({show:!0,message:S instanceof Error?S.message:"Failed to start GitHub authentication.",type:"error"})}finally{i(!1)}},R=async()=>{try{await fetch("/api/auth/github/logout",{method:"POST"}),w(!1),d(null),u({status:"idle"}),P({show:!0,message:"Signed out of GitHub sync.",type:"success"})}catch{P({show:!0,message:"Failed to sign out of GitHub.",type:"error"})}},$=async()=>{f(!0);try{if(!(await fetch("/api/auth/github/auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:h})})).ok)throw new Error("save failed");C(""),await O(),P({show:!0,message:"Custom GitHub auth saved.",type:"success"})}catch{P({show:!0,message:"Failed to save override.",type:"error"})}finally{f(!1)}},K=async()=>{f(!0);try{await fetch("/api/auth/github/auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:""})}),C(""),await O(),P({show:!0,message:"Custom auth cleared. Using dango defaults.",type:"success"})}catch{P({show:!0,message:"Failed to clear override.",type:"error"})}finally{f(!1)}};return t?e("div",{style:{color:"var(--text-secondary)",padding:"1.5rem"},children:"Loading..."}):e("div",{className:y.sectionCard,children:[e("h3",{className:y.title,children:"GitHub Cloud Sync"}),e("p",{className:y.signIn,children:"Sync local data through a private GitHub repository named dango-sync-data."}),l&&b?e("div",{className:y.userInfo,children:[e("p",{children:["Signed in as: ",e("strong",{children:b.name||b.login})]}),e(D,{variant:"danger",onClick:R,children:"Sign Out"})]}):e("div",{className:y.signIn,children:e(D,{onClick:v,disabled:o||s.status==="pending",children:o||s.status==="pending"?"Waiting for GitHub...":"Sign in with GitHub"})}),s.status==="pending"&&s.verification&&e(ee,{children:[e("hr",{className:y.hr}),e("div",{className:y.formGroup,children:[e("label",{className:y.label,children:"Verification URL"}),e("div",{className:y.inputWrapper,children:[e("input",{className:y.input,value:s.verification.verification_uri,readOnly:!0}),e(D,{onClick:()=>{const S=s.verification?.verification_uri;S&&/^https?:\/\//i.test(S)&&window.open(S,"_blank","noopener,noreferrer")},children:"Open"})]})]}),e("div",{className:y.formGroup,children:[e("label",{className:y.label,children:"Device Code"}),e("input",{className:y.input,value:s.verification.user_code,readOnly:!0})]})]}),s.status==="error"&&e("p",{className:y.warning,children:s.error}),e("details",{style:{marginTop:"1rem",fontSize:"var(--font-size-sm)"},children:[e("summary",{style:{cursor:"pointer",color:"var(--text-secondary)"},children:["Advanced: use your own auth ",g?"(override active)":""]}),e("div",{className:y.formGroup,style:{marginTop:"0.75rem"},children:[e("label",{className:y.label,children:"Client ID (optional)"}),e("input",{className:y.input,value:h,onChange:S=>C(S.currentTarget.value),placeholder:"Your GitHub OAuth app ID"})]}),e("div",{className:y.actions,children:[e(D,{onClick:$,disabled:k,children:"Save override"}),e(D,{variant:"secondary",onClick:K,disabled:k,children:"Use dango defaults"})]})]}),e(G,{isOpen:T.show,onClose:()=>P(S=>({...S,show:!1})),width:"sm",children:[e(G.Body,{children:e("p",{children:T.message})}),e(G.Actions,{children:e(D,{onClick:()=>P(S=>({...S,show:!1})),children:"OK"})})]})]})},wt=()=>{const[t,n]=r(!0),[o,i]=r(null),[l,w]=r(!1),[b,d]=r(!1),[s,u]=r(""),[g,p]=r(""),[h,C]=r(""),[k,f]=r(!1),[I,T]=r({show:!1,message:"",type:"info"}),P=async()=>{try{const R=await(await fetch("/api/auth/user")).json();i(R?.email?R:null)}catch{i(null)}},N=async()=>{try{const[v,R]=await Promise.all([fetch("/api/auth/config-status"),fetch("/api/auth/google-auth")]),$=await v.json(),K=await R.json();w(!!$.hasConfig),d(!!(K.hasCustomWorkerUrl||K.hasCustomClientId||K.hasClientSecret))}catch(v){console.error("Failed to fetch config status",v)}};U(()=>{(async()=>{n(!0),await Promise.all([P(),N()]);try{new URLSearchParams(window.location.search).get("google_auth")==="success"&&(await P(),window.history.replaceState(null,"",window.location.pathname))}catch{}n(!1)})();const R=$=>{$.origin===window.location.origin&&typeof $.data=="object"&&$.data!==null&&$.data.type==="GOOGLE_AUTH_SUCCESS"&&(i($.data.user),window.location.reload())};return window.addEventListener("message",R),()=>window.removeEventListener("message",R)},[]);const L=async()=>{try{const R=await(await fetch("/api/auth/google/login",{method:"POST"})).json();if(R.authenticated){window.location.reload();return}if(R.url){if(typeof window.DangoBridge<"u"){window.location.href=R.url;return}const K=600,S=700,M=window.innerWidth/2-K/2,ae=window.innerHeight/2-S/2;window.open(R.url,"GoogleAuth",`width=${K},height=${S},top=${ae},left=${M}`)}else throw new Error("Auth URL not available")}catch{T({show:!0,message:"Authentication failed. Ensure server is configured correctly.",type:"error"})}},O=async()=>{try{await fetch("/api/auth/logout",{method:"POST"}),i(null),T({show:!0,message:"Successfully signed out.",type:"success"}),window.location.reload()}catch(v){console.error("Sign out failed",v),T({show:!0,message:"Failed to sign out.",type:"error"})}},E=async()=>{f(!0);try{if(!(await fetch("/api/auth/google-auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workerUrl:s,clientId:g,clientSecret:h})})).ok)throw new Error("save failed");u(""),p(""),C(""),await N(),T({show:!0,message:"Custom auth saved. Restart may be required.",type:"success"})}catch{T({show:!0,message:"Failed to save override.",type:"error"})}finally{f(!1)}},_=async()=>{f(!0);try{await fetch("/api/auth/google-auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workerUrl:"",clientId:"",clientSecret:""})}),u(""),p(""),C(""),await N(),T({show:!0,message:"Custom auth cleared. Using dango defaults.",type:"success"})}catch{T({show:!0,message:"Failed to clear override.",type:"error"})}finally{f(!1)}};return t?e("div",{style:{color:"var(--text-secondary)",padding:"1.5rem"},children:"Loading..."}):e("div",{className:y.sectionCard,children:[e("h3",{className:y.title,children:"Google Drive Sync"}),o?e("div",{className:y.userInfo,children:[e("p",{children:["Signed in as: ",e("strong",{children:o.name})," (",o.email,")"]}),e(D,{variant:"danger",onClick:O,children:"Sign Out"})]}):e("div",{className:y.signIn,children:[e("p",{children:"Sign in with your Google account to enable synchronization features."}),e(D,{onClick:L,disabled:!l,children:"Sign in with Google"}),!l&&e("p",{className:y.warning,children:"Google sync is not configured on the server."})]}),e("details",{style:{marginTop:"1rem",fontSize:"var(--font-size-sm)"},children:[e("summary",{style:{cursor:"pointer",color:"var(--text-secondary)"},children:["Advanced: use your own auth ",b?"(override active)":""]}),e("div",{className:y.formGroup,style:{marginTop:"0.75rem"},children:[e("label",{className:y.label,children:"Worker URL (optional)"}),e("input",{className:y.input,value:s,onChange:v=>u(v.currentTarget.value),placeholder:"https://your-worker.workers.dev"})]}),e("div",{className:y.formGroup,children:[e("label",{className:y.label,children:"Client ID (optional)"}),e("input",{className:y.input,value:g,onChange:v=>p(v.currentTarget.value),placeholder:"Your Google OAuth client ID"})]}),e("div",{className:y.formGroup,children:[e("label",{className:y.label,children:"Client Secret (optional)"}),e("input",{type:"password",className:y.input,value:h,onChange:v=>C(v.currentTarget.value),placeholder:"Your Google OAuth secret"})]}),e("div",{className:y.actions,children:[e(D,{onClick:E,disabled:k,children:"Save override"}),e(D,{variant:"secondary",onClick:_,disabled:k,children:"Use dango defaults"})]})]}),e(G,{isOpen:I.show,onClose:()=>T(v=>({...v,show:!1})),width:"sm",children:[e(G.Body,{children:e("p",{children:I.message})}),e(G.Actions,{children:e(D,{onClick:()=>T(v=>({...v,show:!1})),children:"OK"})})]})]})},vt="_sectionCard_1pqo4_1",bt="_settingItem_1pqo4_26",_t="_settingRow_1pqo4_31",kt="_modalOverlay_1pqo4_38",St="_modal_1pqo4_38",Ct="_modalActions_1pqo4_73",Nt="_modalSecondary_1pqo4_79",Tt="_modalPrimary_1pqo4_89",j={sectionCard:vt,settingItem:bt,settingRow:_t,modalOverlay:kt,modal:St,modalActions:Ct,modalSecondary:Nt,modalPrimary:Tt},Rt={anime:{heading:"Watchlist Preferences",blurb:"Customize your experience when managing your watchlist and series entries.",skipKey:"skipRemoveConfirmation",ignoreKey:"ignoreAdultContent",listOnlyKey:"cwWatchlistOnly",skipLabel:"Skip confirmation when removing from watchlist",ignoreLabel:"Hide adult content from continue watching",listOnlyLabel:"Only show continue watching for shows in watchlist",listNoun:"watchlist",continueNoun:"continue watching",adultCountUrl:"/api/continue-watching/adult-count",purgeUrl:"/api/continue-watching/purge-adult",purgeDoneText:t=>`Removed ${t??0} entries from continue watching`,invalidateKeys:[["allContinueWatching"]]},manga:{heading:"Reading List Preferences",blurb:"Customize your experience when managing your reading list and manga entries.",skipKey:"mangaSkipRemoveConfirmation",ignoreKey:"mangaIgnoreAdultContent",listOnlyKey:"mangaCwWatchlistOnly",skipLabel:"Skip confirmation when removing from reading list",ignoreLabel:"Hide adult content from continue reading",listOnlyLabel:"Only show continue reading for manga in reading list",listNoun:"reading list",continueNoun:"continue reading",adultCountUrl:"/api/manga/continue-reading/adult-count",purgeUrl:"/api/manga/continue-reading/purge-adult",purgeDoneText:t=>`Removed ${t??0} entries from continue reading`,invalidateKeys:[["manga-continue-reading"]]},tv:{heading:"TV Watchlist Preferences",blurb:"Customize your experience when managing your TV watchlist and series entries.",skipKey:"tvSkipRemoveConfirmation",ignoreKey:"tvIgnoreAdultContent",listOnlyKey:"tvCwWatchlistOnly",skipLabel:"Skip confirmation when removing from TV watchlist",ignoreLabel:"Hide adult content from continue watching",listOnlyLabel:"Only show continue watching for shows in TV watchlist",listNoun:"TV watchlist",continueNoun:"continue watching",adultCountUrl:"/api/tv/continue-watching/adult-count",purgeUrl:"/api/tv/continue-watching/purge-adult",purgeDoneText:t=>`Removed ${t??0} entries from continue watching`,invalidateKeys:[["tv-continue-watching"]]},asmr:{heading:"Listening List Preferences",blurb:"Customize your experience when managing your listening list and work entries.",skipKey:"asmrSkipRemoveConfirmation",ignoreKey:"asmrIgnoreAdultContent",listOnlyKey:"asmrCwWatchlistOnly",skipLabel:"Skip confirmation when removing from listening list",ignoreLabel:"Hide adult content from continue listening",listOnlyLabel:"Only show continue listening for works in listening list",listNoun:"listening list",continueNoun:"continue listening",adultCountUrl:"/api/asmr/continue-listening/adult-count",purgeUrl:"/api/asmr/continue-listening/purge-adult",purgeDoneText:t=>`Removed ${t??0} entries from continue listening`,invalidateKeys:[["asmr-continue-listening"]]}},Dt=(t,n)=>{if(t==null)return n;const o=String(t);return o==="true"||o==="1"?!0:o==="false"||o==="0"?!1:n},ye=(t,n,o)=>{const[i,l]=r(n),[w,b]=r(!1),d=ue();return U(()=>{(async()=>{try{const p=await(await fetch(`/api/settings?key=${t}`)).json();l(Dt(p.value,n))}catch(g){console.error("Failed to fetch setting",g)}})()},[t,n]),{value:i,setValue:l,isUpdating:w,toggle:async()=>{if(w)return;b(!0);const u=!i;l(u);try{await fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:t,value:u})});for(const g of o)d.invalidateQueries({queryKey:g})}catch(g){console.error("Error saving setting:",g),l(!u)}finally{b(!1)}}}},It=()=>{const{contentType:t}=xe(),n=Rt[t],[o,i]=r(!1),[l,w]=r(!0),[b,d]=r(!1),s=ye(n.ignoreKey,!0,n.invalidateKeys),u=ye(n.listOnlyKey,!1,n.invalidateKeys),[g,p]=r(null),[h,C]=r(!1),k=ue();U(()=>{w(!0),(async()=>{try{const O=await(await fetch(`/api/settings?key=${n.skipKey}`)).json();String(O.value)==="true"||String(O.value)==="1"?i(!0):i(!1)}catch(L){console.error("Failed to fetch setting",L)}finally{w(!1)}})()},[n.skipKey]);const f=async()=>{if(b)return;d(!0);const N=!o;i(N);try{await fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:n.skipKey,value:N})})}catch(L){console.error("Error saving setting:",L),i(!N)}finally{d(!1)}},I=async()=>{if(!s.isUpdating){if(s.value)try{const L=await(await fetch(n.adultCountUrl)).json();if(typeof L.count=="number"&&L.count>0){p(L.count);return}}catch(N){console.error("Failed to fetch adult count",N)}s.toggle()}},T=()=>{p(null),s.toggle()},P=async()=>{if(!h){C(!0);try{const L=await(await fetch(n.purgeUrl,{method:"POST"})).json();me.success(n.purgeDoneText(L.removed));for(const O of n.invalidateKeys)k.invalidateQueries({queryKey:O})}catch(N){console.error("Failed to purge adult entries",N),me.error("Failed to remove adult entries")}finally{C(!1),p(null)}s.toggle()}};return l?e("div",{children:"Loading settings..."}):e("div",{className:j.sectionCard,children:[e("h3",{children:n.heading}),e("p",{children:n.blurb}),e("div",{className:j.settingItem,children:e("div",{className:j.settingRow,children:[e("label",{htmlFor:"skip-confirmation-toggle",children:n.skipLabel}),e(F,{isChecked:o,onChange:f,id:"skip-confirmation-toggle",disabled:b})]})}),e("div",{className:j.settingItem,children:e("div",{className:j.settingRow,children:[e("label",{htmlFor:"ignore-adult-toggle",children:n.ignoreLabel}),e(F,{isChecked:s.value,onChange:I,id:"ignore-adult-toggle",disabled:s.isUpdating})]})}),e("div",{className:j.settingItem,children:e("div",{className:j.settingRow,children:[e("label",{htmlFor:"cw-watchlist-only-toggle",children:n.listOnlyLabel}),e(F,{isChecked:u.value,onChange:u.toggle,id:"cw-watchlist-only-toggle",disabled:u.isUpdating})]})}),g!==null&&e("div",{className:j.modalOverlay,onClick:()=>p(null),children:e("div",{className:j.modal,onClick:N=>N.stopPropagation(),children:[e("h4",{children:"Show adult entries?"}),e("p",{children:[g," adult ",g===1?"entry":"entries"," not in your"," ",n.listNoun," ",g===1?"is":"are"," currently hidden from"," ",n.continueNoun,". You can purge ",g===1?"it":"them"," from the database instead of showing ",g===1?"it":"them","."]}),e("div",{className:j.modalActions,children:[e("button",{type:"button",className:j.modalSecondary,onClick:T,disabled:h,children:"Show them"}),e("button",{type:"button",className:j.modalPrimary,onClick:P,disabled:h,children:h?"Purging...":`Purge ${g}`})]})]})})]})},Pt="_sectionCard_jkggs_1",xt="_statsGrid_jkggs_26",Lt="_statCard_jkggs_33",Ot="_statLabel_jkggs_43",At="_statValue_jkggs_51",Ut="_statMeta_jkggs_57",Mt="_statusBanner_jkggs_63",Et="_statusSuccess_jkggs_74",$t="_statusUpdating_jkggs_80",jt="_statusError_jkggs_86",Gt="_sha_jkggs_92",Kt="_settingItem_jkggs_99",Ht="_settingRow_jkggs_104",Ft="_settingTitle_jkggs_111",zt="_settingSubtitle_jkggs_117",Bt="_actionsRow_jkggs_124",x={sectionCard:Pt,statsGrid:xt,statCard:Lt,statLabel:Ot,statValue:At,statMeta:Ut,statusBanner:Mt,statusSuccess:Et,statusUpdating:$t,statusError:jt,sha:Gt,settingItem:Kt,settingRow:Ht,settingTitle:Ft,settingSubtitle:zt,actionsRow:Bt},Wt=()=>{const[t,n]=r(null),[o,i]=r(!0),[l,w]=r(!1),[b,d]=r(!1),s=V(null),u=async()=>{try{const k=await fetch("/api/settings/offline-db");if(k.ok){const f=await k.json();return n(f),f}}catch(k){console.error("Failed to fetch offline DB info:",k)}finally{i(!1)}return null};U(()=>(u(),()=>{s.current&&window.clearInterval(s.current)}),[]),U(()=>{t?.isRefreshing?s.current||(s.current=window.setInterval(async()=>{const k=await u();k&&!k.isRefreshing&&s.current&&(window.clearInterval(s.current),s.current=null)},2e3)):s.current&&(window.clearInterval(s.current),s.current=null)},[t?.isRefreshing]);const g=async()=>{if(!t||l)return;const k=!t.autoUpdateEnabled;w(!0),n({...t,autoUpdateEnabled:k});try{(await fetch("/api/settings/offline-db/auto-update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:k})})).ok||n({...t,autoUpdateEnabled:!k})}catch(f){console.error("Failed to update auto update setting:",f),n({...t,autoUpdateEnabled:!k})}finally{w(!1)}},p=async()=>{if(!(t?.isRefreshing||b)){d(!0);try{(await fetch("/api/settings/offline-db/update",{method:"POST"})).ok&&n(f=>f?{...f,isRefreshing:!0,lastStatus:"updating",lastMessage:"Downloading database..."}:null)}catch(k){console.error("Failed to trigger offline DB update:",k)}finally{d(!1)}}},h=k=>{if(!k)return"Never";try{return new Date(k).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}catch{return k}},C=t?.isRefreshing||b;return e("div",{className:x.sectionCard,children:[e("h3",{children:"Offline Metadata Database"}),e("p",{children:"Local MAL to AniList ID map used for instant imports and metadata enrichment without hitting rate-limited APIs. Updates automatically every Saturday in the background."}),e("div",{className:x.statsGrid,children:[e("div",{className:x.statCard,children:[e("span",{className:x.statLabel,children:"MAL Mapped"}),e("span",{className:x.statValue,children:o?"—":(t?.totalMalMapped??0).toLocaleString()})]}),e("div",{className:x.statCard,children:[e("span",{className:x.statLabel,children:"Release"}),e("span",{className:x.statMeta,children:o?"—":t?.releaseTag??"Never"})]}),e("div",{className:x.statCard,children:[e("span",{className:x.statLabel,children:"Last Checked"}),e("span",{className:x.statMeta,children:o?"—":h(t?.lastCheckedAt??null)})]}),e("div",{className:x.statCard,children:[e("span",{className:x.statLabel,children:"Last Updated"}),e("span",{className:x.statMeta,children:o?"—":h(t?.lastUpdatedAt??null)})]})]}),t?.lastMessage&&e("div",{className:`${x.statusBanner} ${t.lastStatus==="failed"?x.statusError:t.lastStatus==="updating"?x.statusUpdating:x.statusSuccess}`,children:[e("span",{children:t.lastMessage}),t.contentSha256&&e("span",{className:x.sha,children:["sha:",t.contentSha256.slice(0,12)]})]}),e("div",{className:x.settingItem,children:e("div",{className:x.settingRow,children:[e("div",{children:[e("span",{className:x.settingTitle,children:"Weekly Automatic Updates (Saturdays)"}),e("div",{className:x.settingSubtitle,children:"Download and index new database releases in the background. Catches up on startup if the server was offline."})]}),e(F,{id:"offline-db-auto-update-toggle",isChecked:t?t.autoUpdateEnabled:!0,onChange:g,disabled:o||l})]})}),e("div",{className:x.actionsRow,children:e(D,{onClick:p,disabled:o||C,children:C?"Updating Database...":"Update Offline Database Now"})})]})},qt="_sectionCard_1g4qx_1",Vt="_dangerCard_1g4qx_26",Jt="_status_1g4qx_34",Yt="_warningText_1g4qx_40",Qt="_ackLabel_1g4qx_44",Z={sectionCard:qt,dangerCard:Vt,status:Jt,warningText:Yt,ackLabel:Qt},Xt=()=>{const t=ue(),[n,o]=r(!1),[i,l]=r(!1),[w,b]=r(!1),[d,s]=r(""),u=()=>{l(!1),s(""),o(!0)},g=()=>{w||(o(!1),l(!1))},p=async()=>{if(!(!i||w)){b(!0),s("");try{const h=await fetch("/api/database/clear",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({confirm:!0})}),C=await h.json();if(!h.ok)throw new Error(C.error||"Failed to clear database");const k=C.deleted,f=C.deletedManga,I=C.deletedTv,T=C.deletedAsmr,P=Object.values(k).reduce((E,_)=>E+(_||0),0)+Object.values(f??{}).reduce((E,_)=>E+(_||0),0)+Object.values(I??{}).reduce((E,_)=>E+(_||0),0)+Object.values(T??{}).reduce((E,_)=>E+(_||0),0),N=(f?.manga_library??0)+(f?.manga_progress??0),L=(I?.tv_library??0)+(I?.tv_progress??0),O=(T?.asmr_library??0)+(T?.asmr_progress??0);s(`Library cleared — ${k.watchlist??0} watchlist entries, ${N} manga rows, ${L} TV rows, ${O} ASMR rows and ${P} total rows removed.`),t.invalidateQueries({queryKey:["watchlist"]}),t.invalidateQueries({queryKey:["allContinueWatching"]}),t.invalidateQueries({queryKey:["manga-library"]}),t.invalidateQueries({queryKey:["manga-library-ids"]}),t.invalidateQueries({queryKey:["manga-continue-reading"]}),t.invalidateQueries({queryKey:["tv-library"]}),t.invalidateQueries({queryKey:["tv-library-ids"]}),t.invalidateQueries({queryKey:["tv-continue-watching"]}),t.invalidateQueries({queryKey:["asmr-library"]}),t.invalidateQueries({queryKey:["asmr-library-ids"]}),t.invalidateQueries({queryKey:["asmr-continue-listening"]}),o(!1)}catch(h){s(h.message)}finally{b(!1),l(!1)}}};return e("div",{className:`${Z.sectionCard} ${Z.dangerCard}`,children:[e("h3",{children:"Danger Zone"}),e("p",{children:"Permanently delete your library (watchlist, watched episodes, queue, cached show metadata, manga reading list and reading progress, TV watchlist and watch progress, ASMR listening list and listening progress) to start fresh. Your settings, sync state and the offline metadata cache are preserved."}),e(D,{variant:"danger",onClick:u,children:"Clear Library Data"}),d&&e("p",{className:Z.status,children:d}),e(G,{isOpen:n,onClose:g,title:"Clear library data?",width:"sm",children:[e(G.Body,{children:[e("p",{className:Z.warningText,children:"This permanently deletes everything in your library. It acts on the active database (dev or prod, per server config) and cannot be undone. Settings, sync state and the offline metadata cache are kept."}),e("label",{className:Z.ackLabel,children:[e("input",{type:"checkbox",checked:i,onChange:h=>l(h.target.checked),disabled:w}),e("span",{children:"I understand this permanently deletes my library"})]})]}),e(G.Actions,{children:[e(D,{variant:"secondary",onClick:g,disabled:w,children:"Cancel"}),e(D,{variant:"danger",onClick:p,disabled:!i||w,children:w?"Clearing...":"Yes, delete everything"})]})]})]})},Zt=()=>{const[t,n]=r(""),[o,i]=r([]),[l,w]=r(null),[b,d]=r(!0),[s,u]=r({show:!1,message:"",type:"info"}),g=async()=>{try{d(!0);const C=await(await fetch("/api/auth/settings/rclone")).json();n(C.remote||""),i(C.availableRemotes||[]),w(C.activeRemote||null)}catch(h){console.error("Failed to fetch Rclone settings",h)}finally{d(!1)}};U(()=>{g()},[]);const p=async()=>{try{if((await fetch("/api/auth/settings/rclone",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({remote:t})})).ok)u({show:!0,message:"Rclone configuration saved successfully. You must restart the server for these changes to take effect.",type:"success"}),g();else throw new Error("Failed to save")}catch{u({show:!0,message:"Failed to save Rclone configuration.",type:"error"})}};return b?e("div",{style:{color:"var(--text-secondary)",padding:"1.5rem"},children:"Loading..."}):e("div",{className:y.sectionCard,children:[e("h3",{className:y.title,children:"Rclone Cloud Sync"}),e("p",{className:y.signIn,children:"Configure which Rclone remote to use for database synchronization."}),l?e("div",{className:y.userInfo,children:e("p",{children:["Current Active Remote: ",e("strong",{children:l})]})}):e("p",{className:y.warning,style:{marginBottom:"1.5rem"},children:"Rclone sync is not currently active. Ensure rclone is installed and a remote is configured."}),e("div",{className:y.formGroup,children:[e("label",{className:y.label,children:"Remote Name"}),e("div",{className:y.inputWrapper,children:e("select",{className:y.select,value:t,onChange:h=>n(h.target.value),children:[e("option",{value:"",children:"(Disabled / None)"}),o.map(h=>e("option",{value:h,children:h},h)),t&&!o.includes(t)&&e("option",{value:t,children:[t," (Manual)"]})]})}),e("p",{className:y.warning,style:{marginTop:"12px"},children:[e("strong",{children:"Note:"})," You can choose which provider is active using the selector at the top of the page."]})]}),e("div",{className:y.actions,children:e(D,{onClick:p,children:"Save Rclone Settings"})}),e(G,{isOpen:s.show,onClose:()=>u(h=>({...h,show:!1})),width:"sm",children:[e(G.Body,{children:e("p",{children:s.message})}),e(G.Actions,{children:e(D,{onClick:()=>u(h=>({...h,show:!1})),children:"OK"})})]})]})},ea=()=>{const[t,n]=r(null),[o,i]=r(!0),l=async()=>{try{const u=await(await fetch("/api/auth/settings/sync")).json();n(u)}catch(s){console.error("Failed to fetch sync settings",s)}finally{i(!1)}};U(()=>{l()},[]);const w=async s=>{const u=s.target.value;try{const g=await fetch("/api/auth/settings/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:u})});if(g.ok){const p=await g.json();n(h=>h?{...h,activeProvider:p.activeProvider}:null),await l(),ie.success(`Sync provider updated to ${u==="default"?"Default Order":u}`)}else ie.error("Failed to update sync provider")}catch{ie.error("Error updating sync provider")}};if(o||!t)return null;const b=[{value:"default",label:"Default (Priority Based)"}];t.authenticatedProviders.github&&b.push({value:"github",label:"GitHub"}),t.authenticatedProviders.google&&b.push({value:"google",label:"Google Drive"}),t.authenticatedProviders.rclone&&b.push({value:"rclone",label:"Rclone"}),b.push({value:"none",label:"None (Local Only)"});const d=s=>s==="none"?"Local Only (No Sync)":s==="google"?"Google Drive":s==="github"?"GitHub":s==="rclone"?"Rclone":s;return e("div",{className:m.sectionCard,children:[e("h3",{children:"Active Sync Provider"}),e("p",{children:'Choose which provider to use for synchronization. "Default" uses the first available provider you are logged into.'}),e("div",{style:{marginBottom:"1.5rem",padding:"0.75rem",background:"rgba(255, 255, 255, 0.03)",borderRadius:"var(--radius-md)",borderLeft:"4px solid var(--accent)",fontSize:"var(--font-size-sm)"},children:["Current Status:"," ",e("strong",{style:{color:"var(--accent-light)",textTransform:"capitalize"},children:d(t.actualActiveProvider)})]}),e("div",{className:m.settingRow,children:[e("label",{htmlFor:"sync-provider-select",children:"Selected Preference"}),e("select",{id:"sync-provider-select",value:t.activeProvider,onChange:w,style:{padding:"0.5rem",borderRadius:"var(--radius-md)",background:"rgba(255, 255, 255, 0.05)",color:"var(--text-primary)",border:"1px solid var(--glass-border)",fontSize:"var(--font-size-sm)",minWidth:"220px",outline:"none",cursor:"pointer"},children:b.map(s=>e("option",{value:s.value,children:s.label},s.value))})]})]})};function ta(){return"javascript:"+encodeURIComponent(`(function(){
2
2
  if(!/(^|\\.)discord\\.com$/.test(location.hostname)){alert('Dango: use this bookmarklet while on discord.com');return}
3
3
  var t=null;
4
4
  try{
@@ -0,0 +1 @@
1
+ ._pagination_zelsc_1{display:flex;align-items:center;gap:var(--space-2)}._pageBtn_zelsc_7{background:none;border:none;color:var(--text-primary);cursor:pointer;display:flex;align-items:center;justify-content:center;padding:6px;min-width:28px;border-radius:var(--radius-full);transition:all var(--transition-fast);gap:var(--space-2);font-size:var(--font-size-sm)}._pageBtn_zelsc_7:hover:not(:disabled){background:var(--bg-tertiary);color:var(--accent)}._pageBtn_zelsc_7:disabled{opacity:.3;cursor:not-allowed}._pageBtn_zelsc_7 span{font-size:var(--font-size-xs);font-weight:600}._pageInfo_zelsc_38{font-size:var(--font-size-sm);color:var(--text-secondary);white-space:nowrap}._pageInfo_zelsc_38 strong{color:var(--text-primary)}._pagePicker_zelsc_48{position:relative}._dropdown_zelsc_52{position:absolute;bottom:calc(100% + 8px);left:50%;transform:translate(-50%);z-index:50;background:var(--bg-secondary);border:1px solid var(--border-secondary);border-radius:var(--radius-lg);padding:10px;width:210px;max-width:calc(100vw - 32px);box-shadow:0 12px 32px #00000059;touch-action:manipulation}._dropdown_zelsc_52._flipDown_zelsc_68{bottom:auto;top:calc(100% + 8px)}._jumpRow_zelsc_73{display:flex;gap:8px;margin-bottom:8px}._jumpInput_zelsc_79{flex:1;min-width:0;background:var(--bg-tertiary);border:1px solid var(--border-primary);color:var(--text-primary);border-radius:8px;padding:6px 10px;font-size:.85rem}._jumpGo_zelsc_90{background:var(--bg-tertiary);border:1px solid var(--border-primary);color:var(--text-primary);border-radius:8px;padding:6px 12px;font-size:.8rem;font-weight:700;cursor:pointer}._jumpGo_zelsc_90:hover{border-color:var(--accent)}._optionList_zelsc_105{display:grid;grid-template-columns:repeat(5,1fr);gap:4px;max-height:180px;overflow-y:auto}._optionBtn_zelsc_113{background:none;border:none;color:var(--text-primary);border-radius:6px;padding:6px 0;font-size:.8rem;cursor:pointer}._optionBtn_zelsc_113:hover:not(:disabled){background:var(--bg-tertiary);color:var(--accent)}._optionBtn_zelsc_113:disabled{cursor:default}._optionBtn_zelsc_113._current_zelsc_132{font-weight:800;background:var(--bg-tertiary)}@media(pointer:coarse){._dropdown_zelsc_52{width:240px;padding:12px}._jumpInput_zelsc_79{min-height:44px;font-size:1rem}._jumpGo_zelsc_90{min-height:44px;padding:6px 16px}._optionList_zelsc_105{grid-template-columns:repeat(4,1fr);gap:6px;max-height:220px}._optionBtn_zelsc_113{min-height:44px;font-size:.9rem}._pageBtn_zelsc_7{min-width:36px;min-height:36px}}._skeletonCard_1b0hr_1{display:flex;flex-direction:column;background-color:var(--bg-secondary);border-radius:var(--radius-md);overflow:hidden;height:100%;border:1px solid var(--border-secondary)}._poster_1b0hr_11{width:100%;aspect-ratio:3 / 4;background-color:var(--bg-tertiary);position:relative;overflow:hidden}._poster_1b0hr_11:after,._line_1b0hr_20:after{content:"";position:absolute;inset:0;transform:translate(-100%);background-image:linear-gradient(90deg,#fff0 0,#ffffff0d 20%,#ffffff1f 60%,#fff0);animation:_skeleton-wave_1b0hr_1 1.8s infinite ease-in-out}._info_1b0hr_38{padding:var(--space-3);display:flex;flex-direction:column;gap:var(--space-2);flex-grow:1}._line_1b0hr_20{position:relative;overflow:hidden;height:18px;border-radius:var(--radius-sm);background-color:var(--bg-tertiary)}._line_1b0hr_20._short_1b0hr_54{width:60%;height:14px}@media(max-width:768px){._skeletonCard_1b0hr_1._horizontal_1b0hr_60{flex-direction:row;height:auto;min-height:100px}._skeletonCard_1b0hr_1._horizontal_1b0hr_60 ._poster_1b0hr_11{width:85px;height:100%;aspect-ratio:auto;flex-shrink:0}._skeletonCard_1b0hr_1._horizontal_1b0hr_60 ._info_1b0hr_38{padding:var(--space-2) var(--space-3);justify-content:center}._skeletonCard_1b0hr_1._vertical_1b0hr_78 ._poster_1b0hr_11{width:100%;aspect-ratio:3 / 4}._skeletonCard_1b0hr_1._vertical_1b0hr_78 ._info_1b0hr_38{padding:var(--space-2);align-items:center}._line_1b0hr_20{height:16px}._line_1b0hr_20._short_1b0hr_54{height:12px}}._skeletonCard_1b0hr_1._lowEnd_1b0hr_97{min-height:0}._skeletonCard_1b0hr_1._lowEnd_1b0hr_97 ._poster_1b0hr_11:after,._skeletonCard_1b0hr_1._lowEnd_1b0hr_97 ._line_1b0hr_20:after{animation:none}._skeletonCard_1b0hr_1._lowEnd_1b0hr_97 ._line_1b0hr_20{opacity:.6}._skeletonCard_1b0hr_1._lowEnd_1b0hr_97 ._info_1b0hr_38{padding:var(--space-3)}
@@ -0,0 +1 @@
1
+ import{d as _,A as v,h as E,T as R,u as e,g as A}from"./vendor-core-8R2fFbyN.js";import{I as P}from"./vendor-icons-CDMuNDeL.js";import{u as L}from"./index-C65i4HWv.js";const x="_pagination_zelsc_1",M="_pageBtn_zelsc_7",S="_pageInfo_zelsc_38",G="_pagePicker_zelsc_48",F="_dropdown_zelsc_52",K="_flipDown_zelsc_68",T="_jumpRow_zelsc_73",W="_jumpInput_zelsc_79",q="_jumpGo_zelsc_90",J="_optionList_zelsc_105",O="_optionBtn_zelsc_113",H="_current_zelsc_132",s={pagination:x,pageBtn:M,pageInfo:S,pagePicker:G,dropdown:F,flipDown:K,jumpRow:T,jumpInput:W,jumpGo:q,optionList:J,optionBtn:O,current:H},cn=({page:t,totalPages:d,canGoNext:m,onChange:p,isLoading:f=!1,variant:g="compact"})=>{const[l,u]=_(!1),[b,h]=_(""),[k,N]=_(0),[$,z]=_(!1),w=v(null),y=v(null),j=v(null);E(()=>{if(!l)return;const n=o=>{w.current&&!w.current.contains(o.target)&&u(!1)},r=o=>{o.key==="Escape"&&u(!1)};return document.addEventListener("pointerdown",n),document.addEventListener("keydown",r),()=>{document.removeEventListener("pointerdown",n),document.removeEventListener("keydown",r)}},[l]),E(()=>{if(!l)return;N(0),z(!1);const n=requestAnimationFrame(()=>{const r=j.current?.getBoundingClientRect(),o=y.current?.getBoundingClientRect();if(!r)return;let c=0;r.right>window.innerWidth-8?c=window.innerWidth-8-r.right:r.left<8&&(c=8-r.left),N(Math.round(c)),o&&o.top<r.height+24&&z(!0)});return()=>cancelAnimationFrame(n)},[l]);const i=d,C=R(()=>{if(i!==void 0){if(i<=100)return Array.from({length:i},(o,c)=>c+1);const r=new Set([1,i]);for(let o=t-10;o<=t+10;o++)o>=1&&o<=i&&r.add(o);return[...r].sort((o,c)=>o-c)}const n=m?t+1:t;return Array.from({length:n},(r,o)=>o+1)},[i,t,m]),B=n=>{const r=i!==void 0?Math.min(Math.max(1,n),i):Math.max(1,n);u(!1),h(""),r!==t&&p(r)},D=()=>{const n=parseInt(b,10);Number.isNaN(n)||B(n)},I=f||(i!==void 0?t>=i:!m);return e("div",{className:s.pagination,ref:w,children:[e("button",{className:s.pageBtn,onClick:()=>p(t-1),disabled:t<=1||f,"aria-label":"Previous page",children:[e(P,{name:"chevron-left",size:14}),g==="labeled"&&e("span",{children:"Previous"})]}),e("div",{className:s.pagePicker,ref:y,children:[e("button",{className:s.pageBtn,onClick:()=>{h(""),u(n=>!n)},disabled:f,"aria-label":"Jump to page","aria-expanded":l,children:e("span",{className:s.pageInfo,children:["Page ",e("strong",{children:t}),i!==void 0&&` of ${i}`]})}),l&&e("div",{ref:j,className:`${s.dropdown} ${$?s.flipDown:""}`,style:k!==0?{marginLeft:k}:void 0,children:[e("div",{className:s.jumpRow,children:[e("input",{className:s.jumpInput,type:"number",inputMode:"numeric",min:1,max:i,value:b,placeholder:"Page #",onChange:n=>h(n.currentTarget.value),onKeyDown:n=>{n.key==="Enter"&&D()}}),e("button",{className:s.jumpGo,onClick:D,children:"Go"})]}),e("div",{className:s.optionList,children:C.map(n=>e("button",{className:`${s.optionBtn} ${n===t?s.current:""}`,onClick:()=>B(n),disabled:n===t,children:n},n))})]})]}),e("button",{className:s.pageBtn,onClick:()=>p(t+1),disabled:I,"aria-label":"Next page",children:[g==="labeled"&&e("span",{children:"Next"}),e(P,{name:"chevron-right",size:14})]})]})},Q="_skeletonCard_1b0hr_1",U="_poster_1b0hr_11",V="_line_1b0hr_20",X="_info_1b0hr_38",Y="_short_1b0hr_54",Z="_horizontal_1b0hr_60",nn="_vertical_1b0hr_78",en="_lowEnd_1b0hr_97",a={skeletonCard:Q,poster:U,line:V,"skeleton-wave":"_skeleton-wave_1b0hr_1",info:X,short:Y,horizontal:Z,vertical:nn,lowEnd:en},tn=({layout:t="vertical"})=>{const{lowEndMode:d}=L();return e("div",{className:`${a.skeletonCard} ${a[t]} ${d?a.lowEnd:""}`,children:[e("div",{className:a.poster}),e("div",{className:a.info,children:[e("div",{className:a.line}),e("div",{className:`${a.line} ${a.short}`})]})]})},on=({count:t=14,layout:d="vertical"})=>e("div",{className:"grid-container",children:Array.from({length:t}).map((m,p)=>e(tn,{layout:d},p))}),ln=A.memo(on);export{tn as A,cn as P,ln as S};
@@ -1,2 +1,2 @@
1
- import{d as a,h as me,g as ce,A as le,q as je,u as e,S as I}from"./vendor-core-8R2fFbyN.js";import{u as ue,b as de,a as R}from"./vendor-query-BXRECSI6.js";import{z as s,W as Se,B as pe}from"./index-lo-bz7f2.js";import{I as h}from"./vendor-icons-CDMuNDeL.js";function Ce(){const B=ue(),[r,m]=a(!1);return me(()=>{const g=new URLSearchParams(window.location.search),u=g.get("anilist");if(u){const i=g.get("user"),b=g.get("reason");window.history.replaceState(null,"",window.location.pathname),u==="success"?(s.success(i?`Connected to AniList as ${decodeURIComponent(i)}`:"Connected to AniList"),B.invalidateQueries({queryKey:["trackerStatus"]})):s.error(b?decodeURIComponent(b):"AniList authentication failed");return}const w=new URLSearchParams(window.location.hash.substring(1)),c=w.get("access_token"),D=g.get("code");if(!c&&!D){const i=w.get("error");i&&(s.error(`AniList error: ${i}`),window.history.replaceState(null,"",window.location.pathname));return}const j=window.location.origin+window.location.pathname;window.history.replaceState(null,"",window.location.pathname),m(!0),s("Connecting to AniList..."),fetch("/api/tracker/anilist/auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c?{token:c}:{code:D,redirectUri:j})}).then(async i=>{const b=await i.json().catch(()=>({}));if(!i.ok)throw new Error(b.error||"Authentication failed");s.success(`Connected to AniList as ${b.user?.name??"AniList user"}`),B.invalidateQueries({queryKey:["trackerStatus"]})}).catch(i=>{s.error(i instanceof Error?i.message:"Failed to authenticate with AniList")}).finally(()=>{m(!1)})},[B]),r}const Te="_header_j1lbh_1",xe="_fadeIn_j1lbh_1",Le="_pageTitle_j1lbh_6",Ae="_pageSubtitle_j1lbh_14",Pe="_importCard_j1lbh_20",Ee="_slideUpIn_j1lbh_1",Be="_cardHeader_j1lbh_37",De="_uploadArea_j1lbh_55",Me="_fileInputWrapper_j1lbh_59",Oe="_fileInput_j1lbh_59",Fe="_fileDisplay_j1lbh_87",$e="_fileIcon_j1lbh_95",Ue="_fileName_j1lbh_100",Re="_browseButton_j1lbh_109",qe="_optionsArea_j1lbh_120",Ke="_checkboxLabel_j1lbh_128",He="_checkbox_j1lbh_128",Qe="_checkboxCustom_j1lbh_141",Ge="_optionText_j1lbh_169",We="_optionTitle_j1lbh_175",ze="_optionDesc_j1lbh_181",Je="_actions_j1lbh_187",Xe="_importBtn_j1lbh_195",Ve="_cancelBtn_j1lbh_201",Ye="_statusMessage_j1lbh_215",Ze="_success_j1lbh_225",en="_error_j1lbh_231",nn="_progressSection_j1lbh_237",tn="_progressBar_j1lbh_242",sn="_progressFill_j1lbh_250",an="_progressInfo_j1lbh_257",on="_progressCount_j1lbh_264",rn="_progressTitle_j1lbh_271",cn="_sourceBadge_j1lbh_289",ln="_anilist_j1lbh_301",dn="_kitsu_j1lbh_307",pn="_offline_j1lbh_313",hn="_skipped_j1lbh_319",mn="_cardTitleRow_j1lbh_324",un="_anilistIcon_j1lbh_334",_n="_malIcon_j1lbh_340",gn="_badgeOnline_j1lbh_346",bn="_badgeOffline_j1lbh_358",fn="_connectedProfile_j1lbh_370",yn="_avatar_j1lbh_379",wn="_connectedInfo_j1lbh_386",Nn="_connectedName_j1lbh_394",kn="_connectedHint_j1lbh_400",vn="_loginPrompt_j1lbh_405",In="_loginSection_j1lbh_413",jn="_fieldLabel_j1lbh_419",Sn="_helpText_j1lbh_438",Cn="_loginText_j1lbh_455",Tn="_primaryBtn_j1lbh_464",xn="_secondaryBtn_j1lbh_465",Ln="_syncBtn_j1lbh_466",An="_divider_j1lbh_518",Pn="_actionSection_j1lbh_524",En="_inputGroup_j1lbh_538",Bn="_input_j1lbh_538",Dn="_syncSummary_j1lbh_559",Mn="_syncErrors_j1lbh_565",On="_spin_j1lbh_569",Fn="_radioGroup_j1lbh_598",$n="_radioLabel_j1lbh_604",Un="_syncHint_j1lbh_642",Rn="_importLoading_j1lbh_649",n={header:Te,fadeIn:xe,pageTitle:Le,pageSubtitle:Ae,importCard:Pe,slideUpIn:Ee,cardHeader:Be,uploadArea:De,fileInputWrapper:Me,fileInput:Oe,fileDisplay:Fe,fileIcon:$e,fileName:Ue,browseButton:Re,optionsArea:qe,checkboxLabel:Ke,checkbox:He,checkboxCustom:Qe,optionText:Ge,optionTitle:We,optionDesc:ze,actions:Je,importBtn:Xe,cancelBtn:Ve,statusMessage:Ye,success:Ze,error:en,progressSection:nn,progressBar:tn,progressFill:sn,progressInfo:an,progressCount:on,progressTitle:rn,sourceBadge:cn,anilist:ln,kitsu:dn,offline:pn,skipped:hn,cardTitleRow:mn,anilistIcon:un,malIcon:_n,badgeOnline:gn,badgeOffline:bn,connectedProfile:fn,avatar:yn,connectedInfo:wn,connectedName:Nn,connectedHint:kn,loginPrompt:vn,loginSection:In,fieldLabel:jn,helpText:Sn,loginText:Cn,primaryBtn:Tn,secondaryBtn:xn,syncBtn:Ln,divider:An,actionSection:Pn,inputGroup:En,input:Bn,syncSummary:Dn,syncErrors:Mn,spin:On,radioGroup:Fn,radioLabel:$n,syncHint:Un,importLoading:Rn},W="tracker_anilist_client_id",he="49887".trim(),Gn=()=>{const{setIsOpen:B}=Se(),r=ue();ce.useEffect(()=>{document.title="Trackers - dango"},[]);const[m,g]=a(""),[u,w]=a("username"),[c,D]=a(null),[j,i]=a(""),b=Ce(),{data:z,isLoading:_e}=de({queryKey:["trackerStatus"],queryFn:async()=>{const t=await fetch("/api/tracker/status");if(!t.ok)throw new Error("Failed to load tracker status");return t.json()}}),{data:N}=de({queryKey:["anilistClientId"],queryFn:async()=>(await(await fetch(`/api/settings?key=${W}`)).json()).value||""}),J=le(!1);ce.useEffect(()=>{J.current||N!==void 0&&(N&&i(N),J.current=!0)},[N]);const S=z?.anilist?.connected??!1;me(()=>{S&&w("sync")},[S]);const M=z?.anilist?.user??null,q=!!he,ge=(N||"").trim(),be=async()=>{const t=j.trim(),o=t||he;if(!o){s.error("Enter your AniList client ID first");return}const _=async(y,Q)=>{if(!(await fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:y,value:Q})})).ok)throw new Error(`Failed to save ${y}`)};try{t?t!==N&&await _(W,t):q&&ge&&await _(W,""),r.invalidateQueries({queryKey:["anilistClientId"]})}catch(y){s.error(y.message);return}const p=window.location.origin+window.location.pathname,A=encodeURIComponent(p);window.location.href=`https://anilist.co/api/v2/oauth/authorize?client_id=${encodeURIComponent(o)}&response_type=token&state=${A}`},X=R({mutationFn:async()=>{const t=await fetch("/api/tracker/anilist/disconnect",{method:"POST"});if(!t.ok)throw new Error("Failed to disconnect");return t.json()},onSuccess:()=>{r.invalidateQueries({queryKey:["trackerStatus"]}),s.success("Disconnected from AniList")},onError:t=>s.error(t.message)}),O=R({mutationFn:async()=>{const t=await fetch("/api/tracker/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:"anilist"})}),o=await t.json();if(!t.ok)throw new Error(o.error||"Sync failed");return o.summary},onSuccess:t=>{r.invalidateQueries({queryKey:["watchlist"]}),r.invalidateQueries({queryKey:["allContinueWatching"]}),D(t),s.success(`Sync complete — pushed ${t.pushed}, pulled ${t.pulled}, merged ${t.merged}, unchanged ${t.unchanged}`,{duration:6e3})},onError:t=>s.error(t.message)}),k=R({mutationFn:async()=>{if(!m.trim())throw new Error("Please enter a username");const t=await fetch("/api/tracker/anilist/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:m.trim(),erase:f})}),o=await t.json();if(!t.ok)throw new Error(o.error||"Import failed");return o.count},onSuccess:t=>{r.invalidateQueries({queryKey:["watchlist"]}),r.invalidateQueries({queryKey:["allContinueWatching"]}),s.success(`Imported ${t} anime entries from AniList`),g("")},onError:t=>s.error(t.message)}),[C,V]=a(""),d=R({mutationFn:async t=>{if(!C.trim())throw new Error("Please enter a MAL username");const o=await fetch("/api/tracker/mal/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:C.trim(),erase:t.erase,useOfflineDb:t.useOfflineDb,skipFallback:t.skipFallback})}),_=await o.json();if(!o.ok)throw new Error(_.error||"Import failed");return _.count},onSuccess:t=>{r.invalidateQueries({queryKey:["watchlist"]}),r.invalidateQueries({queryKey:["allContinueWatching"]}),s.success(`Imported ${t} anime entries from MAL`),V("")},onError:t=>s.error(t.message)}),[f,Y]=a(!1),[T,fe]=a(!0),[x,ye]=a(!1),[Z,ee]=a(""),[v,ne]=a(!1),[l,te]=a(null),[K,se]=a(null),[ae,F]=a(""),H=le(null),we=t=>{t.target.files&&t.target.files.length>0?ee(t.target.files[0].name):ee("")},Ne=je(async()=>{const t=document.getElementById("malFile");if(!t.files||t.files.length===0){F("Please select a file first.");return}const o=t.files[0];ne(!0),te(null),se(null),F("");const _=new AbortController;H.current=_;try{const p=new FormData;p.append("xmlfile",o),p.append("erase",String(f)),p.append("useOfflineDb",String(T)),p.append("skipFallback",String(x));const A=await fetch("/api/import/mal-xml",{method:"POST",body:p,signal:_.signal});if(!A.ok){const G=await A.text();let P="Failed to import";try{P=JSON.parse(G).error||P}catch{}throw new Error(P)}const y=A.body?.getReader();if(!y)throw new Error("No response stream");const Q=new TextDecoder;let $="",U="";for(;;){const{done:G,value:P}=await y.read();if(G)break;$+=Q.decode(P,{stream:!0});const oe=$.split(`
1
+ import{d as a,h as me,g as ce,A as le,q as je,u as e,S as I}from"./vendor-core-8R2fFbyN.js";import{u as ue,b as de,a as R}from"./vendor-query-BXRECSI6.js";import{z as s,W as Se,B as pe}from"./index-C65i4HWv.js";import{I as h}from"./vendor-icons-CDMuNDeL.js";function Ce(){const B=ue(),[r,m]=a(!1);return me(()=>{const g=new URLSearchParams(window.location.search),u=g.get("anilist");if(u){const i=g.get("user"),b=g.get("reason");window.history.replaceState(null,"",window.location.pathname),u==="success"?(s.success(i?`Connected to AniList as ${decodeURIComponent(i)}`:"Connected to AniList"),B.invalidateQueries({queryKey:["trackerStatus"]})):s.error(b?decodeURIComponent(b):"AniList authentication failed");return}const w=new URLSearchParams(window.location.hash.substring(1)),c=w.get("access_token"),D=g.get("code");if(!c&&!D){const i=w.get("error");i&&(s.error(`AniList error: ${i}`),window.history.replaceState(null,"",window.location.pathname));return}const j=window.location.origin+window.location.pathname;window.history.replaceState(null,"",window.location.pathname),m(!0),s("Connecting to AniList..."),fetch("/api/tracker/anilist/auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c?{token:c}:{code:D,redirectUri:j})}).then(async i=>{const b=await i.json().catch(()=>({}));if(!i.ok)throw new Error(b.error||"Authentication failed");s.success(`Connected to AniList as ${b.user?.name??"AniList user"}`),B.invalidateQueries({queryKey:["trackerStatus"]})}).catch(i=>{s.error(i instanceof Error?i.message:"Failed to authenticate with AniList")}).finally(()=>{m(!1)})},[B]),r}const Te="_header_j1lbh_1",xe="_fadeIn_j1lbh_1",Le="_pageTitle_j1lbh_6",Ae="_pageSubtitle_j1lbh_14",Pe="_importCard_j1lbh_20",Ee="_slideUpIn_j1lbh_1",Be="_cardHeader_j1lbh_37",De="_uploadArea_j1lbh_55",Me="_fileInputWrapper_j1lbh_59",Oe="_fileInput_j1lbh_59",Fe="_fileDisplay_j1lbh_87",$e="_fileIcon_j1lbh_95",Ue="_fileName_j1lbh_100",Re="_browseButton_j1lbh_109",qe="_optionsArea_j1lbh_120",Ke="_checkboxLabel_j1lbh_128",He="_checkbox_j1lbh_128",Qe="_checkboxCustom_j1lbh_141",Ge="_optionText_j1lbh_169",We="_optionTitle_j1lbh_175",ze="_optionDesc_j1lbh_181",Je="_actions_j1lbh_187",Xe="_importBtn_j1lbh_195",Ve="_cancelBtn_j1lbh_201",Ye="_statusMessage_j1lbh_215",Ze="_success_j1lbh_225",en="_error_j1lbh_231",nn="_progressSection_j1lbh_237",tn="_progressBar_j1lbh_242",sn="_progressFill_j1lbh_250",an="_progressInfo_j1lbh_257",on="_progressCount_j1lbh_264",rn="_progressTitle_j1lbh_271",cn="_sourceBadge_j1lbh_289",ln="_anilist_j1lbh_301",dn="_kitsu_j1lbh_307",pn="_offline_j1lbh_313",hn="_skipped_j1lbh_319",mn="_cardTitleRow_j1lbh_324",un="_anilistIcon_j1lbh_334",_n="_malIcon_j1lbh_340",gn="_badgeOnline_j1lbh_346",bn="_badgeOffline_j1lbh_358",fn="_connectedProfile_j1lbh_370",yn="_avatar_j1lbh_379",wn="_connectedInfo_j1lbh_386",Nn="_connectedName_j1lbh_394",kn="_connectedHint_j1lbh_400",vn="_loginPrompt_j1lbh_405",In="_loginSection_j1lbh_413",jn="_fieldLabel_j1lbh_419",Sn="_helpText_j1lbh_438",Cn="_loginText_j1lbh_455",Tn="_primaryBtn_j1lbh_464",xn="_secondaryBtn_j1lbh_465",Ln="_syncBtn_j1lbh_466",An="_divider_j1lbh_518",Pn="_actionSection_j1lbh_524",En="_inputGroup_j1lbh_538",Bn="_input_j1lbh_538",Dn="_syncSummary_j1lbh_559",Mn="_syncErrors_j1lbh_565",On="_spin_j1lbh_569",Fn="_radioGroup_j1lbh_598",$n="_radioLabel_j1lbh_604",Un="_syncHint_j1lbh_642",Rn="_importLoading_j1lbh_649",n={header:Te,fadeIn:xe,pageTitle:Le,pageSubtitle:Ae,importCard:Pe,slideUpIn:Ee,cardHeader:Be,uploadArea:De,fileInputWrapper:Me,fileInput:Oe,fileDisplay:Fe,fileIcon:$e,fileName:Ue,browseButton:Re,optionsArea:qe,checkboxLabel:Ke,checkbox:He,checkboxCustom:Qe,optionText:Ge,optionTitle:We,optionDesc:ze,actions:Je,importBtn:Xe,cancelBtn:Ve,statusMessage:Ye,success:Ze,error:en,progressSection:nn,progressBar:tn,progressFill:sn,progressInfo:an,progressCount:on,progressTitle:rn,sourceBadge:cn,anilist:ln,kitsu:dn,offline:pn,skipped:hn,cardTitleRow:mn,anilistIcon:un,malIcon:_n,badgeOnline:gn,badgeOffline:bn,connectedProfile:fn,avatar:yn,connectedInfo:wn,connectedName:Nn,connectedHint:kn,loginPrompt:vn,loginSection:In,fieldLabel:jn,helpText:Sn,loginText:Cn,primaryBtn:Tn,secondaryBtn:xn,syncBtn:Ln,divider:An,actionSection:Pn,inputGroup:En,input:Bn,syncSummary:Dn,syncErrors:Mn,spin:On,radioGroup:Fn,radioLabel:$n,syncHint:Un,importLoading:Rn},W="tracker_anilist_client_id",he="49887".trim(),Gn=()=>{const{setIsOpen:B}=Se(),r=ue();ce.useEffect(()=>{document.title="Trackers - dango"},[]);const[m,g]=a(""),[u,w]=a("username"),[c,D]=a(null),[j,i]=a(""),b=Ce(),{data:z,isLoading:_e}=de({queryKey:["trackerStatus"],queryFn:async()=>{const t=await fetch("/api/tracker/status");if(!t.ok)throw new Error("Failed to load tracker status");return t.json()}}),{data:N}=de({queryKey:["anilistClientId"],queryFn:async()=>(await(await fetch(`/api/settings?key=${W}`)).json()).value||""}),J=le(!1);ce.useEffect(()=>{J.current||N!==void 0&&(N&&i(N),J.current=!0)},[N]);const S=z?.anilist?.connected??!1;me(()=>{S&&w("sync")},[S]);const M=z?.anilist?.user??null,q=!!he,ge=(N||"").trim(),be=async()=>{const t=j.trim(),o=t||he;if(!o){s.error("Enter your AniList client ID first");return}const _=async(y,Q)=>{if(!(await fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:y,value:Q})})).ok)throw new Error(`Failed to save ${y}`)};try{t?t!==N&&await _(W,t):q&&ge&&await _(W,""),r.invalidateQueries({queryKey:["anilistClientId"]})}catch(y){s.error(y.message);return}const p=window.location.origin+window.location.pathname,A=encodeURIComponent(p);window.location.href=`https://anilist.co/api/v2/oauth/authorize?client_id=${encodeURIComponent(o)}&response_type=token&state=${A}`},X=R({mutationFn:async()=>{const t=await fetch("/api/tracker/anilist/disconnect",{method:"POST"});if(!t.ok)throw new Error("Failed to disconnect");return t.json()},onSuccess:()=>{r.invalidateQueries({queryKey:["trackerStatus"]}),s.success("Disconnected from AniList")},onError:t=>s.error(t.message)}),O=R({mutationFn:async()=>{const t=await fetch("/api/tracker/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:"anilist"})}),o=await t.json();if(!t.ok)throw new Error(o.error||"Sync failed");return o.summary},onSuccess:t=>{r.invalidateQueries({queryKey:["watchlist"]}),r.invalidateQueries({queryKey:["allContinueWatching"]}),D(t),s.success(`Sync complete — pushed ${t.pushed}, pulled ${t.pulled}, merged ${t.merged}, unchanged ${t.unchanged}`,{duration:6e3})},onError:t=>s.error(t.message)}),k=R({mutationFn:async()=>{if(!m.trim())throw new Error("Please enter a username");const t=await fetch("/api/tracker/anilist/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:m.trim(),erase:f})}),o=await t.json();if(!t.ok)throw new Error(o.error||"Import failed");return o.count},onSuccess:t=>{r.invalidateQueries({queryKey:["watchlist"]}),r.invalidateQueries({queryKey:["allContinueWatching"]}),s.success(`Imported ${t} anime entries from AniList`),g("")},onError:t=>s.error(t.message)}),[C,V]=a(""),d=R({mutationFn:async t=>{if(!C.trim())throw new Error("Please enter a MAL username");const o=await fetch("/api/tracker/mal/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:C.trim(),erase:t.erase,useOfflineDb:t.useOfflineDb,skipFallback:t.skipFallback})}),_=await o.json();if(!o.ok)throw new Error(_.error||"Import failed");return _.count},onSuccess:t=>{r.invalidateQueries({queryKey:["watchlist"]}),r.invalidateQueries({queryKey:["allContinueWatching"]}),s.success(`Imported ${t} anime entries from MAL`),V("")},onError:t=>s.error(t.message)}),[f,Y]=a(!1),[T,fe]=a(!0),[x,ye]=a(!1),[Z,ee]=a(""),[v,ne]=a(!1),[l,te]=a(null),[K,se]=a(null),[ae,F]=a(""),H=le(null),we=t=>{t.target.files&&t.target.files.length>0?ee(t.target.files[0].name):ee("")},Ne=je(async()=>{const t=document.getElementById("malFile");if(!t.files||t.files.length===0){F("Please select a file first.");return}const o=t.files[0];ne(!0),te(null),se(null),F("");const _=new AbortController;H.current=_;try{const p=new FormData;p.append("xmlfile",o),p.append("erase",String(f)),p.append("useOfflineDb",String(T)),p.append("skipFallback",String(x));const A=await fetch("/api/import/mal-xml",{method:"POST",body:p,signal:_.signal});if(!A.ok){const G=await A.text();let P="Failed to import";try{P=JSON.parse(G).error||P}catch{}throw new Error(P)}const y=A.body?.getReader();if(!y)throw new Error("No response stream");const Q=new TextDecoder;let $="",U="";for(;;){const{done:G,value:P}=await y.read();if(G)break;$+=Q.decode(P,{stream:!0});const oe=$.split(`
2
2
  `);$=oe.pop()||"";for(const E of oe)if(E.startsWith("event: "))U=E.slice(7).trim();else if(E.startsWith("data: ")){const Ie=E.slice(6);try{const re=JSON.parse(Ie);U==="progress"?te(re):U==="complete"&&se(re)}catch{}}else E===""&&(U="")}r.invalidateQueries({queryKey:["watchlist"]})}catch(p){p instanceof DOMException&&p.name==="AbortError"?F("Import cancelled."):F(p.message)}finally{ne(!1),H.current=null}},[f,T,x,r]),ke=()=>{H.current?.abort(),fetch("/api/import/mal-xml/cancel",{method:"POST"}).catch(()=>{})},ve=l?Math.round(l.current/l.total*100):0,[L,ie]=a("username");return e("div",{className:"page-container",children:[e("div",{className:n.header,children:[e("h1",{className:n.pageTitle,children:"Trackers"}),e("p",{className:n.pageSubtitle,children:"Import & sync your anime watchlists with tracking services"})]}),e("div",{className:n.importCard,children:[e("div",{className:n.cardHeader,children:e("div",{className:n.cardTitleRow,children:[e(h,{name:"anilist",className:n.anilistIcon}),e("h3",{children:"AniList"}),_e?null:S?e("span",{className:n.badgeOnline,children:"Connected"}):e("span",{className:n.badgeOffline,children:"Not connected"})]})}),S&&M?e("div",{className:n.connectedProfile,children:[M.avatar&&e("img",{src:M.avatar,alt:"Avatar",className:n.avatar,loading:"lazy",decoding:"async"}),e("div",{className:n.connectedInfo,children:[e("span",{className:n.connectedName,children:M.name}),e("span",{className:n.connectedHint,children:"2-way sync is ready"})]}),e("button",{className:n.secondaryBtn,onClick:()=>X.mutate(),disabled:X.isPending,children:[e(h,{name:"sign-out-alt"})," Disconnect"]})]}):e("div",{className:n.loginSection,children:[e("p",{className:n.loginText,children:["Log in with AniList to enable bidirectional progress & status synchronization.",b&&e("span",{style:{marginLeft:8,color:"var(--accent)"},children:"Finishing login…"})]}),e("div",{className:n.fieldLabel,children:["AniList client ID — defaults to Dango's app"," ",e("a",{href:"https://anilist.co/settings/developer",target:"_blank",rel:"noopener noreferrer",children:["create your own app ",e(h,{name:"external-link-alt",size:9})]})]}),e("div",{className:n.inputGroup,children:[e("input",{type:"text",placeholder:"Client ID",value:j,onChange:t=>i(t.target.value),className:n.input}),e("button",{className:n.primaryBtn,onClick:be,disabled:!(j.trim()||q),children:[e(h,{name:"external-link-alt"})," Connect"]})]}),e("p",{className:n.helpText,children:q?e(I,{children:["By default uses Dango's client. To use your own AniList app: create it at"," ",e("a",{href:"https://anilist.co/settings/developer",target:"_blank",rel:"noopener noreferrer",children:"anilist.co/settings/developer"}),", set its ",e("strong",{children:"Redirect URL"})," to"," ",e("code",{children:window.location.port==="5173"?`${window.location.protocol}//${window.location.hostname}:3000/api/tracker/anilist/callback`:`${window.location.origin}/api/tracker/anilist/callback`}),", then paste only the ",e("strong",{children:"Client ID"})," above (leave empty to use Dango's)."]}):e(I,{children:["No shipped client in this build — create your own app at"," ",e("a",{href:"https://anilist.co/settings/developer",target:"_blank",rel:"noopener noreferrer",children:"anilist.co/settings/developer"}),", set ",e("strong",{children:"Redirect URL"})," to"," ",e("code",{children:window.location.port==="5173"?`${window.location.protocol}//${window.location.hostname}:3000/api/tracker/anilist/callback`:`${window.location.origin}/api/tracker/anilist/callback`}),", then paste the ",e("strong",{children:"Client ID"})," above."]})})]}),S&&e(I,{children:[e("hr",{className:n.divider}),e("div",{className:n.radioGroup,children:[e("label",{className:n.radioLabel,children:[e("input",{type:"radio",name:"anilistMode",value:"username",checked:u==="username",onChange:()=>w("username")}),e("span",{children:"Quick Import"})]}),e("label",{className:n.radioLabel,children:[e("input",{type:"radio",name:"anilistMode",value:"sync",checked:u==="sync",onChange:()=>w("sync")}),e("span",{children:"Two-way Sync"})]})]}),u==="username"?e("div",{className:n.inputGroup,children:e("input",{type:"text",placeholder:"Enter AniList username",value:m,onChange:t=>g(t.target.value),className:n.input,disabled:k.isPending,onKeyDown:t=>{t.key==="Enter"&&m.trim()&&k.mutate()}})}):e("p",{className:n.syncHint,children:"Merges progress non-destructively: pushes shows and episodes you watched on dango to AniList, and pulls anything you updated on AniList into dango."}),u==="username"&&e("div",{className:n.optionsArea,children:e("label",{className:n.checkboxLabel,children:[e("input",{type:"checkbox",checked:f,onChange:t=>Y(t.target.checked),className:n.checkbox,disabled:k.isPending}),e("span",{className:n.checkboxCustom}),e("div",{className:n.optionText,children:[e("span",{className:n.optionTitle,children:"Erase current watchlist"}),e("span",{className:n.optionDesc,children:"Delete existing watchlist before importing."})]})]})}),u==="username"?e("button",{className:n.syncBtn,onClick:()=>k.mutate(),disabled:!m.trim()||k.isPending,children:[e(h,{name:"download"}),k.isPending?"Importing...":"Start Import"]}):e(I,{children:[e("button",{className:n.syncBtn,onClick:()=>O.mutate(),disabled:O.isPending,children:[e(h,{name:"sync-alt",className:O.isPending?n.spin:""}),O.isPending?"Syncing...":"Start Sync"]}),c&&e("div",{className:n.syncSummary,children:["Pushed: ",c.pushed," · Pulled: ",c.pulled," · Merged:"," ",c.merged," · Unchanged: ",c.unchanged,c.errors.length>0&&e("span",{className:n.syncErrors,children:[" ","· ",c.errors.length," error",c.errors.length>1?"s":""]})]})]}),e("p",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)",marginTop:"8px"},children:["AniList ",e("code",{children:"Rewatching (REPEATING)"})," is not tracked — entries with this status are ignored."]})]})]}),e("div",{className:n.importCard,children:[e("div",{className:n.cardHeader,children:e("div",{className:n.cardTitleRow,children:[e(h,{name:"myanimelist",className:n.malIcon}),e("h3",{children:"MyAnimeList"})]})}),e("div",{className:n.radioGroup,children:[e("label",{className:n.radioLabel,children:[e("input",{type:"radio",name:"malMode",value:"username",checked:L==="username",onChange:()=>ie("username")}),e("span",{children:"Username"})]}),e("label",{className:n.radioLabel,children:[e("input",{type:"radio",name:"malMode",value:"xml",checked:L==="xml",onChange:()=>ie("xml")}),e("span",{children:"XML File"})]})]}),L==="username"?e(I,{children:[e("div",{className:n.inputGroup,children:e("input",{type:"text",placeholder:"Enter MAL username",value:C,onChange:t=>V(t.target.value),className:n.input,disabled:d.isPending,onKeyDown:t=>{t.key==="Enter"&&C.trim()&&d.mutate({erase:f,useOfflineDb:T,skipFallback:x})}})}),d.isPending&&e("div",{className:n.importLoading,children:[e(h,{name:"sync-alt",className:n.spin}),e("span",{children:"Importing from MAL..."})]})]}):e("div",{className:n.uploadArea,children:e("div",{className:n.fileInputWrapper,children:[e("input",{type:"file",id:"malFile",accept:".xml,application/xml",className:n.fileInput,onChange:we,disabled:v}),e("div",{className:n.fileDisplay,children:[e(h,{name:"file-alt",className:n.fileIcon}),e("span",{className:n.fileName,children:Z||"Choose XML file..."})]}),e("label",{htmlFor:"malFile",className:n.browseButton,children:"Browse"})]})}),e("div",{className:n.optionsArea,children:[e("label",{className:n.checkboxLabel,children:[e("input",{type:"checkbox",checked:f,onChange:t=>Y(t.target.checked),className:n.checkbox,disabled:v||d.isPending}),e("span",{className:n.checkboxCustom}),e("div",{className:n.optionText,children:[e("span",{className:n.optionTitle,children:"Erase current watchlist"}),e("span",{className:n.optionDesc,children:"Delete existing watchlist before importing."})]})]}),e("label",{className:n.checkboxLabel,children:[e("input",{type:"checkbox",checked:T,onChange:t=>fe(t.target.checked),className:n.checkbox,disabled:v||d.isPending}),e("span",{className:n.checkboxCustom}),e("div",{className:n.optionText,children:[e("span",{className:n.optionTitle,children:"Use offline database (fast)"}),e("span",{className:n.optionDesc,children:"Match by MAL ID locally first — instant and avoids AniList rate limits."})]})]}),e("label",{className:n.checkboxLabel,children:[e("input",{type:"checkbox",checked:x,onChange:t=>ye(t.target.checked),className:n.checkbox,disabled:v||d.isPending}),e("span",{className:n.checkboxCustom}),e("div",{className:n.optionText,children:[e("span",{className:n.optionTitle,children:"Skip online fallback"}),e("span",{className:n.optionDesc,children:"Only import offline matches. Unmatched titles are skipped without API calls."})]})]})]}),L==="username"?e("button",{className:n.syncBtn,onClick:()=>d.mutate({erase:f,useOfflineDb:T,skipFallback:x}),disabled:!C.trim()||d.isPending,children:[e(h,{name:"download"}),d.isPending?"Importing...":"Start Import"]}):e("div",{className:n.actions,children:v?e(pe,{onClick:ke,className:n.cancelBtn,children:"Cancel Import"}):e(pe,{onClick:Ne,className:n.importBtn,disabled:!Z,children:[e(h,{name:"upload"})," Start Import"]})}),L==="username"&&d.isError&&e("div",{className:`${n.statusMessage} ${n.error}`,children:d.error.message}),v&&l&&e("div",{className:n.progressSection,children:[e("div",{className:n.progressBar,children:e("div",{className:n.progressFill,style:{width:`${ve}%`}})}),e("div",{className:n.progressInfo,children:[e("span",{className:n.progressCount,children:[l.current," / ",l.total]}),e("span",{className:n.progressTitle,children:l.found?e(I,{children:[l.matchedTitle,e("span",{className:`${n.sourceBadge} ${n[l.source||"anilist"]}`,children:l.source==="kitsu"?"Kitsu":l.source==="offline"?"Offline DB":"AniList"})]}):e("span",{className:n.skipped,children:["Skipped: ",l.title]})})]})]}),K&&e("div",{className:`${n.statusMessage} ${n.success}`,children:["Import complete! Imported: ",K.imported,", Skipped: ",K.skipped,"."]}),ae&&e("div",{className:`${n.statusMessage} ${n.error}`,children:ae})]})]})};export{Gn as default};