@serifpersia/dango 3.8.5 → 3.8.6

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 (75) hide show
  1. package/README.md +1 -1
  2. package/client/dist/assets/{AnimeCard-CkomfiIw.js → AnimeCard-DWKuN1cB.js} +1 -1
  3. package/client/dist/assets/AnimeInfo-BvNA7-QZ.js +1 -0
  4. package/client/dist/assets/AnimeInfoPage-BGg76ExO.js +2 -0
  5. package/client/dist/assets/Asmr-C8pvBHUO.js +2 -0
  6. package/client/dist/assets/AsmrPopup-BV5rbWXg.js +1 -0
  7. package/client/dist/assets/{AsmrResetProgressModal-CBz6OxDc.js → AsmrResetProgressModal-Cs5wzgRU.js} +1 -1
  8. package/client/dist/assets/{Home-BQK51s69.js → Home-C3k84yqn.js} +1 -1
  9. package/client/dist/assets/{Insights-2Ei1ZfVV.js → Insights-RSd-4osN.js} +1 -1
  10. package/client/dist/assets/{LibraryListPage-BJ7o8MNw.js → LibraryListPage-CHHjw4Jz.js} +1 -1
  11. package/client/dist/assets/ListeningList-DkgZaFkg.js +1 -0
  12. package/client/dist/assets/Manga-BAI78oiq.js +1 -0
  13. package/client/dist/assets/MangaInfoPage-CPYfuLAg.js +1 -0
  14. package/client/dist/assets/MangaReadPage-DvznQu_2.js +1 -0
  15. package/client/dist/assets/MangaResetProgressModal-BPci6zSM.js +1 -0
  16. package/client/dist/assets/{Mature-eyCcjCLK.js → Mature-Cob1Zmtu.js} +1 -1
  17. package/client/dist/assets/{MatureConsentModal-J7mF0tSH.js → MatureConsentModal-BrKd4CBZ.js} +1 -1
  18. package/client/dist/assets/MediaCard-CXZJ8wr7.js +1 -0
  19. package/client/dist/assets/{OptionListMenu-oRSmXUYN.js → OptionListMenu-ClUReC8J.js} +1 -1
  20. package/client/dist/assets/{Player-D3cSsrYy.js → Player-7iroOb7T.js} +6 -6
  21. package/client/dist/assets/PlayerProvider-DzaMVhFX.js +1 -0
  22. package/client/dist/assets/{PlayerSettings-CfTMIrw1.js → PlayerSettings-DnFjoot8.js} +1 -1
  23. package/client/dist/assets/{QueueOptionsButton-BeAS9Ufo.js → QueueOptionsButton-BdAz_Gn-.js} +1 -1
  24. package/client/dist/assets/{QueueRail-BrVL0OWm.js → QueueRail-BMLyoeAe.js} +1 -1
  25. package/client/dist/assets/{ReadingList-BWT_0y7B.js → ReadingList-B62vvh4_.js} +1 -1
  26. package/client/dist/assets/{ResetProgressModal-D9Hi4yvU.js → ResetProgressModal-CXDZfCap.js} +1 -1
  27. package/client/dist/assets/{Search-Ma_U--_p.js → Search-CfNUqNi0.js} +1 -1
  28. package/client/dist/assets/Settings-CxC4k-nB.js +21 -0
  29. package/client/dist/assets/{SkeletonGrid-Bi4N7XcX.js → SkeletonGrid-CmHR4_Fc.js} +1 -1
  30. package/client/dist/assets/{Trackers-CyZCgKDv.js → Trackers-BnvqfI9T.js} +2 -2
  31. package/client/dist/assets/Tv-Dht8h84V.js +4 -0
  32. package/client/dist/assets/TvInfo-6fZeQsh1.js +1 -0
  33. package/client/dist/assets/{TvPopup-CSFfDhV6.js → TvPopup-CIMgMYf0.js} +1 -1
  34. package/client/dist/assets/{TvSearch-BlrNDENc.js → TvSearch-DGG4xRiv.js} +1 -1
  35. package/client/dist/assets/TvWatchlist-B6DLkxqi.js +1 -0
  36. package/client/dist/assets/{VirtualKeyboard-CG5L_RyF.js → VirtualKeyboard-D8TvygKk.js} +1 -1
  37. package/client/dist/assets/{WatchAlong-KYPcweoT.js → WatchAlong-ivfsMGhR.js} +1 -1
  38. package/client/dist/assets/{WatchAlongPanel-CdJRfBiU.js → WatchAlongPanel-CvUFCFll.js} +1 -1
  39. package/client/dist/assets/{Watchlist-Bwh35S5A.js → Watchlist-dsmIAzsH.js} +1 -1
  40. package/client/dist/assets/index-Ej7BS74s.css +1 -0
  41. package/client/dist/assets/index-npJ4Ahxa.js +178 -0
  42. package/client/dist/assets/{libraryInvalidation-C4kz8swK.js → libraryInvalidation-CHlEJU7b.js} +1 -1
  43. package/client/dist/assets/{playbackCompletion-Dfy-xXLg.js → playbackCompletion-DB_c1lex.js} +1 -1
  44. package/client/dist/assets/{useAnimeInfoData-D7YFegdk.js → useAnimeInfoData-DrWgr6PK.js} +1 -1
  45. package/client/dist/assets/useMangaLibrary-sGh96sdT.js +1 -0
  46. package/client/dist/assets/useMangaPopup-CWDMFbSD.js +1 -0
  47. package/client/dist/assets/{useProviders-SXQCnsGW.js → useProviders-DphwZjpZ.js} +1 -1
  48. package/client/dist/assets/{useTv-EwO7nOqH.js → useTv-DatZ0tof.js} +1 -1
  49. package/client/dist/assets/{useTvLibrary-D6KqZu5s.js → useTvLibrary-efdd6TIy.js} +1 -1
  50. package/client/dist/assets/{useWatchAlongPlayer-DC-nsje5.js → useWatchAlongPlayer-CRf0zHFj.js} +4 -4
  51. package/client/dist/assets/useWatchAlongPlayer-CzQyysyL.css +1 -0
  52. package/client/dist/index.html +2 -2
  53. package/package.json +2 -2
  54. package/server/dist/server.js +154 -154
  55. package/server/package.json +1 -1
  56. package/client/dist/assets/AnimeInfo-CtBg9n1W.js +0 -1
  57. package/client/dist/assets/AnimeInfoPage-DYic1q9k.js +0 -2
  58. package/client/dist/assets/Asmr-VRahW3BN.js +0 -2
  59. package/client/dist/assets/AsmrPopup-Du6eR09X.js +0 -1
  60. package/client/dist/assets/ListeningList-C_hDyuFM.js +0 -1
  61. package/client/dist/assets/Manga-4XqXRRq7.js +0 -1
  62. package/client/dist/assets/MangaInfoPage-BSj5R5c3.js +0 -1
  63. package/client/dist/assets/MangaReadPage-BpJNfRcn.js +0 -1
  64. package/client/dist/assets/MangaResetProgressModal-B1DyEkSk.js +0 -1
  65. package/client/dist/assets/MediaCard-Wp1bAPsS.js +0 -1
  66. package/client/dist/assets/PlayerProvider-WO2tWEb1.js +0 -1
  67. package/client/dist/assets/Settings-BWXmAzt8.js +0 -21
  68. package/client/dist/assets/Tv-3U6AQcKB.js +0 -4
  69. package/client/dist/assets/TvInfo-C6k13aZL.js +0 -1
  70. package/client/dist/assets/TvWatchlist-l6N6tOjK.js +0 -1
  71. package/client/dist/assets/index-BKQMKYFa.css +0 -1
  72. package/client/dist/assets/index-fS4AGBy2.js +0 -178
  73. package/client/dist/assets/useMangaLibrary-4UsX_okY.js +0 -1
  74. package/client/dist/assets/useMangaPopup-DrrvSchc.js +0 -1
  75. package/client/dist/assets/useWatchAlongPlayer-CJebxcje.css +0 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dango-server",
3
3
  "private": true,
4
- "version": "3.8.5",
4
+ "version": "3.8.6",
5
5
  "type": "module",
6
6
  "engines": {
7
7
  "node": ">=22.12.0"
@@ -1 +0,0 @@
1
- import{o as y,a as I,d as T,h as b,T as S,u as e}from"./vendor-core-DfaOB3Rn.js";import{I as o}from"./vendor-icons-DrybRNxP.js";import{u as B}from"./useAnimeInfoData-D7YFegdk.js";import{d as w,e as M,f as m,s as x,L as A,B as p}from"./index-fS4AGBy2.js";import{A as D}from"./AnimeMetaDetails-B3-A7O5H.js";import{S as G}from"./SynopsisText-B3Sa5pRv.js";import{Q as P}from"./QueueOptionsButton-BeAS9Ufo.js";import"./vendor-query-BBT5_sHx.js";import"./useIsMobile-Dvx1uJ82.js";import"./vendor-ui-3qrARCPr.js";const W="_container_1obln_1",O="_heroSection_1obln_11",$="_bannerContainer_1obln_17",U="_banner_1obln_17",j="_bannerOverlay_1obln_37",q="_heroContent_1obln_49",z="_posterContainer_1obln_62",V="_floatIn_1obln_1",Q="_poster_1obln_62",E="_infoGlass_1obln_86",H="_slideUpIn_1obln_1",L="_title_1obln_100",F="_quickMeta_1obln_109",J="_metaItem_1obln_117",K="_iconStar_1obln_126",R="_iconTv_1obln_129",X="_iconType_1obln_132",Y="_iconClock_1obln_135",Z="_genres_1obln_139",ee="_genre_1obln_139",ne="_infoColumns_1obln_165",te="_synopsisSection_1obln_180",oe="_sectionTitleSmall_1obln_188",se="_actions_1obln_210",ae="_watchBtn_1obln_216",ie="_watchlistBtn_1obln_238",le="_active_1obln_258",ce="_detailsToggleBtn_1obln_265",re="_expandedContent_1obln_288",me="_fadeIn_1obln_1",_e="_detailsGridContainer_1obln_293",de="_detailItem_1obln_301",he="_airingValue_1obln_320",be="_loadingDetails_1obln_325",pe="_spinner_1obln_334",ue="_spin_1obln_334",ve="_heroSkeleton_1obln_349",ge="_skeletonBanner_1obln_353",ke="_skeletonPoster_1obln_354",fe="_skeletonTitle_1obln_355",Ne="_skeletonMeta_1obln_356",Ce="_skeletonDesc_1obln_357",ye="_skeletonActions_1obln_358",Ie="_skeletonContent_1obln_391",Te="_skeletonInfo_1obln_405",t={container:W,heroSection:O,bannerContainer:$,banner:U,bannerOverlay:j,heroContent:q,posterContainer:z,floatIn:V,poster:Q,infoGlass:E,slideUpIn:H,title:L,quickMeta:F,metaItem:J,iconStar:K,iconTv:R,iconType:X,iconClock:Y,genres:Z,genre:ee,infoColumns:ne,synopsisSection:te,sectionTitleSmall:oe,actions:se,watchBtn:ae,watchlistBtn:ie,active:le,detailsToggleBtn:ce,expandedContent:re,fadeIn:me,detailsGridContainer:_e,detailItem:de,airingValue:he,loadingDetails:be,spinner:pe,spin:ue,heroSkeleton:ve,skeletonBanner:ge,skeletonPoster:ke,skeletonTitle:fe,skeletonMeta:Ne,skeletonDesc:Ce,skeletonActions:ye,"skeleton-wave":"_skeleton-wave_1obln_1",skeletonContent:Ie,skeletonInfo:Te};function Oe(){const{id:s}=y(),a=I(),{titlePreference:l}=w(),[i,u]=T(!1),{showMeta:n,loadingMeta:v,toggleWatchlist:g,inWatchlist:c}=B(s),{hasConsent:k,grant:f}=M();b(()=>{s&&n?.id&&n.id!==s&&a(`/anime/${n.id}`,{replace:!0})},[s,n,a]),b(()=>{document.title=n?.name?`${n.name} - dango`:"Anime - dango"},[n?.name]);const N=()=>n?.name?l==="name"?n.name:l==="nativeName"?n.names?.native||n.name:l==="englishName"&&n.names?.english||n.name:"",C=()=>{s&&a(`/watch/${s}`)},_=S(()=>n?.bannerImage?m(n.bannerImage):n?.thumbnail?m(n.thumbnail,1200,450):"",[n?.bannerImage,n?.thumbnail]);if(v||!n?.name)return e("div",{className:t.container,children:e("div",{className:t.heroSkeleton,children:[e("div",{className:t.skeletonBanner}),e("div",{className:t.skeletonContent,children:[e("div",{className:t.skeletonPoster}),e("div",{className:t.skeletonInfo,children:[e("div",{className:t.skeletonTitle}),e("div",{className:t.skeletonMeta}),e("div",{className:t.skeletonDesc}),e("div",{className:t.skeletonActions})]})]})]})});const d=n.isAdult===!0&&!k;return e("div",{className:t.container,style:d?{filter:"blur(14px)",pointerEvents:"none",userSelect:"none"}:void 0,children:[e("div",{className:t.heroSection,children:[e("div",{className:t.bannerContainer,children:[e("div",{className:t.banner,style:_?{backgroundImage:`url(${_})`}:void 0}),e("div",{className:t.bannerOverlay})]}),e("div",{className:t.heroContent,children:[e("div",{className:t.posterContainer,children:e("img",{src:m(n.thumbnail||"",320,480),alt:n.name,className:t.poster,decoding:"async"})}),e("div",{className:t.infoGlass,children:[e("div",{children:[e("h1",{className:t.title,children:N()}),e("div",{className:t.quickMeta,children:[n.score&&e("div",{className:t.metaItem,children:[e(o,{name:"star",className:t.iconStar}),e("span",{children:n.score})]}),n.status&&e("div",{className:t.metaItem,children:[e(o,{name:"tv",className:t.iconTv}),e("span",{children:n.status})]}),n.type&&e("div",{className:t.metaItem,children:[e(o,{name:"layer-group",className:t.iconType}),e("span",{children:n.type})]})]}),Array.isArray(n.genres)&&n.genres.length>0&&e("div",{className:t.genres,children:n.genres.filter(Boolean).slice(0,5).map(r=>{const h=typeof r=="string"?r:r?.name;return e("span",{className:t.genre,children:h},h)})})]}),e("div",{className:t.infoColumns,children:[e("div",{className:t.synopsisSection,children:[e("h2",{className:t.sectionTitleSmall,children:"Synopsis"}),e(G,{text:x(n.description),emptyText:"No description available."}),e("button",{className:t.detailsToggleBtn,onClick:()=>{u(!i)},children:[i?e(o,{name:"chevron-up"}):e(o,{name:"chevron-down"}),i?"Hide Details":"Show Details"]})]}),i&&e("div",{className:t.expandedContent,children:e(D,{showMeta:n,styles:t})})]}),e("div",{className:t.actions,children:[e("button",{className:t.watchBtn,onClick:C,children:[e(o,{name:"play",size:14}),"Start Watching"]}),e("button",{className:`${t.watchlistBtn} ${c?t.active:""}`,onClick:g,children:[c?e(o,{name:"check",size:14}):e(o,{name:"plus",size:14}),c?"In Watchlist":"Add to Watchlist"]}),e(P,{showId:s,showName:n.name||n.names?.romaji,showThumbnail:n.thumbnail,nativeName:n.names?.native,englishName:n.names?.english,showType:n.type,className:t.watchlistBtn,activeClassName:t.active})]})]})]})]}),d&&e(A,{isOpen:!0,title:"Content Warning",onClose:()=>a("/"),children:e("div",{style:{padding:"1rem",textAlign:"center"},children:[e("p",{children:"This title contains mature content intended for adult audiences."}),e("p",{children:["By proceeding, you confirm that you are ",e("strong",{children:"18 years of age or older"})," (or the age of majority in your jurisdiction) and wish to view this content."]}),e("div",{style:{marginTop:"1rem",display:"flex",gap:"10px",justifyContent:"center"},children:[e(p,{variant:"secondary",onClick:()=>a("/"),children:"Go Back"}),e(p,{onClick:f,children:"I'm 18+, Continue"})]})]})})]})}export{Oe as default};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AnimeInfo-CtBg9n1W.js","assets/vendor-core-DfaOB3Rn.js","assets/vendor-icons-DrybRNxP.js","assets/useAnimeInfoData-D7YFegdk.js","assets/vendor-query-BBT5_sHx.js","assets/index-fS4AGBy2.js","assets/index-BKQMKYFa.css","assets/QueueOptionsButton-BeAS9Ufo.js","assets/vendor-ui-3qrARCPr.js","assets/QueueOptionsButton-CM15uQn8.css","assets/AnimeMetaDetails-B3-A7O5H.js","assets/AnimeMetaDetails-BwNQnRCd.css","assets/SynopsisText-B3Sa5pRv.js","assets/useIsMobile-Dvx1uJ82.js","assets/SynopsisText-CYv2W3yR.css","assets/AnimeInfo-BivVqWcB.css"])))=>i.map(i=>d[i]);
2
- import{af as r,_ as t}from"./index-fS4AGBy2.js";import{u as o,P as e,z as i}from"./vendor-core-DfaOB3Rn.js";import"./vendor-query-BBT5_sHx.js";import"./vendor-icons-DrybRNxP.js";const a=i(()=>t(()=>import("./AnimeInfo-CtBg9n1W.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15])));function p(){return o(e,{fallback:o(r,{}),children:o(a,{})})}export{p as default};
@@ -1,2 +0,0 @@
1
- import{T as Ee,u as e,d as b,A as H,a as Ve,g as Re,q as Y,h as T,S as E,$ as je,o as rt,p as st}from"./vendor-core-DfaOB3Rn.js";import{g as Le,t as Me,a6 as ot,B as Oe,L as Je,a1 as M,p as ue,F as ae,e as lt,a7 as it,q as He}from"./index-fS4AGBy2.js";import{I as w}from"./vendor-icons-DrybRNxP.js";import{u as ct}from"./vendor-query-BBT5_sHx.js";import{T as De}from"./ToggleSwitch-CN_ppEc9.js";import{M as dt}from"./MatureConsentModal-J7mF0tSH.js";import{M as ut,P as mt}from"./MediaCard-Wp1bAPsS.js";import{e as Ke,c as ze,f as ht,a as Ge,g as Ye,h as pt,i as gt,j as ft,k as yt,b as Fe,l as Be,A as _t}from"./AsmrPopup-Du6eR09X.js";import{u as bt}from"./useAsmrPopup-BBmHrx9v.js";import{u as kt,d as vt,e as wt,f as Ct,g as Nt,h as Tt,S as We,a as St,i as qe,j as At,k as Bt,V as Rt,l as Lt}from"./PlayerProvider-WO2tWEb1.js";import{p as ne}from"./page.module-C1MlZzf3.js";import"./vendor-ui-3qrARCPr.js";import"./useIsMobile-Dvx1uJ82.js";import"./libraryInvalidation-C4kz8swK.js";import"./usePopup-DS9jMzp6.js";const Mt="_sortSelect_1f2gy_1",Pt="_grid_1f2gy_11",It="_fetching_1f2gy_25",xt="_thumbPlaceholder_1f2gy_64",$t="_asmrCardWrap_1f2gy_100",Et="_bookmarkBtn_1f2gy_105",jt="_bookmarked_1f2gy_129",Ot="_statusMsg_1f2gy_152",Ht="_skeletonCard_1f2gy_160",Dt="_skeletonThumb_1f2gy_165",Ft="_skeletonLine_1f2gy_171",Wt="_shimmer_1f2gy_178",qt="_matureToggleWrap_1f2gy_219",Ut="_matureLabel_1f2gy_226",Vt="_translateToggleWrap_1f2gy_232",Jt="_filterTogglesGroup_1f2gy_239",Kt="_filterBar_1f2gy_251",zt="_filterLabel_1f2gy_258",Gt="_detailOverlay_1f2gy_263",Yt="_detailModal_1f2gy_275",Qt="_detailClose_1f2gy_287",Zt="_detailHeader_1f2gy_303",Xt="_detailCover_1f2gy_309",ea="_detailInfo_1f2gy_318",ta="_detailTitle_1f2gy_322",aa="_detailRj_1f2gy_329",na="_metaRow_1f2gy_335",ra="_metaLabel_1f2gy_341",sa="_tagChips_1f2gy_347",oa="_tagChip_1f2gy_347",la="_npOverlay_1f2gy_363",ia="_playerBarDocked_1f2gy_378",ca="_playerBarDockedHidden_1f2gy_392",da="_npOverlayControlsHidden_1f2gy_403",ua="_npArrow_1f2gy_403",ma="_npImageCount_1f2gy_404",ha="_npStage_1f2gy_413",pa="_sliderViewport_1f2gy_429",ga="_slide_1f2gy_429",fa="_slideImg_1f2gy_431",ya="_npStageBlank_1f2gy_450",_a="_sliderTrack_1f2gy_469",ba="_slideImgLoaded_1f2gy_502",ka="_slideSpinner_1f2gy_507",va="_npArrowLeft_1f2gy_557",wa="_npArrowRight_1f2gy_561",Ca="_chapterPanel_1f2gy_578",Na="_chapterRow_1f2gy_593",Ta="_chapterRowActive_1f2gy_612",Sa="_chapterRowTime_1f2gy_616",Aa="_chapterRowLabel_1f2gy_627",Ba="_npBackdrop_1f2gy_633",Ra="_playerBtn_1f2gy_639",La="_playerBtnActive_1f2gy_639",Ma="_tracksSection_1f2gy_645",Pa="_tracksHeading_1f2gy_649",Ia="_trackList_1f2gy_655",xa="_trackRow_1f2gy_664",$a="_trackIcon_1f2gy_682",Ea="_trackLabel_1f2gy_687",ja="_trackType_1f2gy_692",Oa="_noTracks_1f2gy_697",Ha="_playAllBtn_1f2gy_702",Da="_detailActions_1f2gy_715",Fa="_playerBar_1f2gy_378",Wa="_playerActions_1f2gy_738",qa="_playerInfo_1f2gy_744",Ua="_playerTitle_1f2gy_749",Va="_playerTrack_1f2gy_758",Ja="_playerControls_1f2gy_764",Ka="_seekRow_1f2gy_771",za="_playerButtons_1f2gy_779",Ga="_seekBtn_1f2gy_814",Ya="_playBtn_1f2gy_824",Qa="_seekBar_1f2gy_871",Za="_volumeBar_1f2gy_872",Xa="_timeLabel_1f2gy_964",en="_playerRight_1f2gy_970",tn="_volumeIcon_1f2gy_976",an="_playerToggle_1f2gy_1020",t={sortSelect:Mt,grid:Pt,fetching:It,thumbPlaceholder:xt,asmrCardWrap:$t,bookmarkBtn:Et,bookmarked:jt,statusMsg:Ot,skeletonCard:Ht,skeletonThumb:Dt,skeletonLine:Ft,shimmer:Wt,matureToggleWrap:qt,matureLabel:Ut,translateToggleWrap:Vt,filterTogglesGroup:Jt,filterBar:Kt,filterLabel:zt,detailOverlay:Gt,detailModal:Yt,detailClose:Qt,detailHeader:Zt,detailCover:Xt,detailInfo:ea,detailTitle:ta,detailRj:aa,metaRow:na,metaLabel:ra,tagChips:sa,tagChip:oa,npOverlay:la,playerBarDocked:ia,playerBarDockedHidden:ca,npOverlayControlsHidden:da,npArrow:ua,npImageCount:ma,npStage:ha,sliderViewport:pa,slide:ga,slideImg:fa,npStageBlank:ya,sliderTrack:_a,slideImgLoaded:ba,slideSpinner:ka,npArrowLeft:va,npArrowRight:wa,chapterPanel:Ca,chapterRow:Na,chapterRowActive:Ta,chapterRowTime:Sa,chapterRowLabel:Aa,npBackdrop:Ba,playerBtn:Ra,playerBtnActive:La,tracksSection:Ma,tracksHeading:Pa,trackList:Ia,trackRow:xa,trackIcon:$a,trackLabel:Ea,trackType:ja,noTracks:Oa,playAllBtn:Ha,detailActions:Da,playerBar:Fa,playerActions:Wa,playerInfo:qa,playerTitle:Ua,playerTrack:Va,playerControls:Ja,seekRow:Ka,playerButtons:za,seekBtn:Ga,playBtn:Ya,seekBar:Qa,volumeBar:Za,timeLabel:Xa,playerRight:en,volumeIcon:tn,playerToggle:an},nn=({work:r,onClose:o,onPlay:k,t:g})=>{const{data:i,isLoading:u}=Ke(r.id||null),y=ze(r),{data:S}=ht(y||void 0),{toggle:_,bookmarkedIds:C}=Ge(),{data:P}=Ye(y||void 0),R=y?C.has(y):!!S?.inLibrary,f=Ee(()=>(i?.description||r.description||"").split(`
2
- `).map(c=>{const l=c.indexOf(":");return l===-1?null:{label:c.slice(0,l),value:c.slice(l+1).trim()}}).filter(c=>!!c&&!!c.value),[i?.description,r.description]),m=i?.tracks||[],L=r.thumbnail||i?.images?.[0],A=Ee(()=>{const c=P?.progress??[];return c.length>0?c.reduce((l,B)=>l.updatedAt>=B.updatedAt?l:B):null},[P]),h=A&&A.trackIndex<m.length?A.trackIndex:null;return e("div",{className:t.detailOverlay,onClick:o,children:e("div",{className:t.detailModal,onClick:c=>c.stopPropagation(),children:[e("button",{className:t.detailClose,onClick:o,"aria-label":"Close",children:e(w,{name:"times"})}),e("div",{className:t.detailHeader,children:[L?e("img",{className:t.detailCover,src:L,alt:r.name,decoding:"async"}):e("div",{className:`${t.detailCover} ${t.thumbPlaceholder}`}),e("div",{className:t.detailInfo,children:[e("h2",{className:t.detailTitle,children:g?g(r.name):r.name}),e("p",{className:t.detailRj,children:r.id}),f.map(c=>c.label==="Tags"?e("p",{className:t.metaRow,children:[e("span",{className:t.metaLabel,children:"Tags"}),e("span",{className:t.tagChips,children:c.value.split(", ").map(l=>e("span",{className:t.tagChip,children:l},l))})]},c.label):e("p",{className:t.metaRow,children:[e("span",{className:t.metaLabel,children:c.label}),c.value]},c.label))]})]}),e("div",{className:t.tracksSection,children:[e("h3",{className:t.tracksHeading,children:u?"Loading tracks…":`Tracks (${m.length})`}),!u&&(m.length>0?e("ul",{className:t.trackList,children:m.map((c,l)=>e("li",{children:e("button",{className:t.trackRow,onClick:()=>k(r,m,l),children:[e(w,{name:"play",className:t.trackIcon}),e("span",{className:t.trackLabel,children:c.resolutionStr}),e("span",{className:t.trackType,children:c.hls?"HLS":"MP3"})]})},c.link))}):e("p",{className:t.noTracks,children:"No audio streams available for this work."}))]}),e("div",{className:t.detailActions,children:[!u&&m.length>0&&e("button",{className:t.playAllBtn,onClick:()=>k(r,m,0),children:[e(w,{name:"play"})," Play from start"]}),!u&&h!==null&&A&&e("button",{className:t.playAllBtn,onClick:()=>k(r,m,h),children:[e(w,{name:"history"})," Resume track ",h+1," ·"," ",Le(A.currentTime),A.duration>0?` / ${Le(A.duration)}`:""]}),y&&e("button",{className:t.playAllBtn,onClick:()=>_({rjCode:y,title:r.name,thumbnail:r.thumbnail||"",isAdult:!!r.isAdult}),"aria-pressed":R,children:[e(w,{name:R?"check":"plus"})," ",R?"In listening list":"Add to listening list"]})]})]})})},rn=r=>{const{engine:o}=kt({volumeKey:"asmrVolume",mutedKey:"asmrMuted"});return e(vt,{engine:o,children:e(sn,{...r})})},sn=({title:r,images:o,chapters:k,tracks:g,trackIndex:i,expanded:u,isAdult:y,rjCode:S,t:_,onTrackChange:C,onExpandedChange:P,onClose:R})=>{const f=wt(),m=f.mediaRef,{duration:L,volume:A,isPlaying:h}=Ct(f),{currentTime:c}=Nt(f),[l,B]=b(!0),[p,x]=b(0),[j,Q]=b(new Set),[N,K]=b(!1),[$,D]=b(!0),U=H("");U.current||(U.current=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`asmr-${Date.now()}-${Math.random().toString(36).slice(2)}`);const me=Ve(),F=Re.useMemo(()=>S?pt(S):"",[S]),W=gt(),be=ft(),{data:Z}=Ye(F||void 0),[ke,re]=b(!1),he=H(""),q=H(null),pe=H(0),V=H(0),se=H(0),oe=g[i],ge=oe?.link,J=oe?.hls,fe=oe?.resolutionStr||"",le=o.length>0,X=`${F}:${i}`,ie=Re.useMemo(()=>(Z?.progress??[]).find(s=>s.trackIndex===i)??null,[Z,i]),ve=H({workId:"",trackIndex:0,trackLabel:""}),z=H(Z);z.current=Z,ve.current={workId:F,trackIndex:i,trackLabel:fe};const ce=Y((a,s,v,O=!1)=>{!a.workId||!v||v<10||!O&&Math.abs(s-pe.current)<5||(pe.current=s,W.mutate({workId:a.workId,trackIndex:a.trackIndex,trackLabel:a.trackLabel,currentTime:Math.floor(s),duration:Math.floor(v),title:r,thumbnail:o[0]||"",rjCode:a.workId,isAdult:y?1:0}))},[W,r,o,y]),ye=Y((a=!1)=>{q.current&&(clearTimeout(q.current),q.current=null),ce(ve.current,V.current,se.current,a)},[ce]),ee=H(ye);ee.current=ye;const we=H(ce);we.current=ce,T(()=>{if(!m.current||!ge)return;const s={workId:F,trackIndex:i,trackLabel:fe},v=()=>{q.current&&(clearTimeout(q.current),q.current=null),we.current(s,f.getTimeline().currentTime,f.getState().duration||se.current,!0)};V.current=0,se.current=0,pe.current=0;const O=z.current?.progress?.find(nt=>nt.trackIndex===i),Te=O?.currentTime||0,Se=O?.duration||0,Ae=Te>=10&&Se-Te>=15,at=f.loadSource({url:ge,hls:J},{autoPlay:!Ae});return()=>{v(),at()}},[f,ge,J,F,i,fe,m]),T(()=>{const a=()=>{document.visibilityState==="hidden"&&ee.current()},s=()=>ee.current();return document.addEventListener("visibilitychange",a),window.addEventListener("pagehide",s),()=>{document.removeEventListener("visibilitychange",a),window.removeEventListener("pagehide",s)}},[]),T(()=>{if(!ie||he.current===X||!(L>0))return;const a=ie.currentTime||0,s=ie.duration||L;he.current=X,!(!(a>=10&&s-a>=15&&V.current<a)||!m.current)&&(f.seek(a),V.current=a,f.play())},[f,m,ie,L,X]),T(()=>{if(u)return document.body.classList.add("asmr-player-open"),()=>document.body.classList.remove("asmr-player-open")},[u]),T(()=>{x(0)},[o]),T(()=>{u&&D(!0)},[u]),T(()=>{N&&D(!0)},[N]);const de=Y(a=>{if(!r||g.length===0)return;const s=g[i],v=s?`${s.resolutionStr} (${i+1}/${g.length})`:"",O=m.current,Te=O?O.currentTime:0,Se=O&&O.duration||0,Ae=o[0]||"";Me.discord.asmrPresence.mutate({title:r,trackLabel:v,isPlaying:a,thumbnail:Ae,thumbnails:o,currentTime:Te,duration:Se,isAdult:!!y,rjCode:S||"",sessionId:U.current}).catch(()=>{}),Me.discord.heartbeat.mutate({sessionId:U.current}).catch(()=>{})},[m,r,g,i,o,y,S]);T(()=>{de(h)},[de,h,i,r,u]),T(()=>{if(!h)return;const a=window.setInterval(()=>de(!0),15e3);return()=>window.clearInterval(a)},[h,de]),T(()=>{const a=U.current,s=()=>ot(a),v=()=>s(),O=()=>{document.visibilityState==="hidden"&&s()};return window.addEventListener("pagehide",v),window.addEventListener("beforeunload",v),document.addEventListener("visibilitychange",O),()=>{window.removeEventListener("pagehide",v),window.removeEventListener("beforeunload",v),document.removeEventListener("visibilitychange",O),s()}},[]);const n=Y(a=>{Q(s=>{if(s.has(a))return s;const v=new Set(s);return v.add(a),v})},[]),d=Y((a,s)=>{a&&a.complete&&a.naturalWidth>0&&n(s)},[n]);T(()=>{if(!u)return;const a=s=>{if(!(s.defaultPrevented||s.ctrlKey||s.metaKey||s.altKey||s.target instanceof Element&&s.target.closest('input, textarea, select, button, [role="slider"], [contenteditable="true"]'))){if(s.key==="Escape"){N?K(!1):P(!1);return}!l||o.length<2||(s.key==="ArrowLeft"&&x(v=>Math.max(0,v-1)),s.key==="ArrowRight"&&x(v=>Math.min(o.length-1,v+1)))}};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[u,l,o.length,N,P]);const I=()=>{ye(!0),i<g.length-1?C(i+1):re(!0)},Ce=a=>{const s=a.currentTarget.currentTime;V.current=s,q.current&&clearTimeout(q.current),q.current=setTimeout(()=>ee.current(),5e3)},te=()=>{ee.current()},Ne=a=>{const s=a.currentTarget.duration;se.current=Number.isFinite(s)?s:0},G=Y(()=>{F&&be.mutate({rjCode:F,title:r,thumbnail:o[0]||"",status:"Completed",isAdult:!!y,silent:!0}),re(!1),R(),me("/")},[F,be,r,o,y,R,me]),Ze=k.reduce((a,s,v)=>c>=s.time?v:a,-1),Xe=a=>f.seek(a);Tt(f,()=>D(!0),!u||!l&&!N);const et=e(E,{children:[e("div",{className:t.playerButtons,children:[e("button",{className:t.playerBtn,onClick:()=>C(Math.max(0,i-1)),disabled:i===0,"aria-label":"Previous track",children:e(w,{name:"step-backward"})}),e(We,{seconds:-10,className:`${t.playerBtn} ${t.seekBtn}`}),e(St,{className:`${t.playerBtn} ${t.playBtn}`}),e(We,{seconds:10,className:`${t.playerBtn} ${t.seekBtn}`}),e("button",{className:t.playerBtn,onClick:()=>C(Math.min(g.length-1,i+1)),disabled:i>=g.length-1,"aria-label":"Next track",children:e(w,{name:"step-forward"})})]}),e("div",{className:t.seekRow,children:[e(qe,{className:t.timeLabel}),e(At,{className:t.seekBar}),e(qe,{className:t.timeLabel,durationOnly:!0})]})]}),Pe=e(E,{children:[e("button",{className:`${t.playerBtn} ${t.playerToggle}`,onClick:()=>P(!u),"aria-label":u?"Minimize player":"Expand player",title:u?"Minimize to browse":"Expand",children:u?e(w,{name:"chevron-down"}):e(w,{name:"chevron-up"})}),e("div",{className:t.playerInfo,children:[e(Bt,{}),e("p",{className:t.playerTitle,title:r,children:_?_(r):r}),e("p",{className:t.playerTrack,children:[oe?.resolutionStr||"",g.length>1?` (${i+1}/${g.length})`:""]})]}),e("div",{className:t.playerControls,children:et}),e("div",{className:t.playerRight,children:[A===0?e(w,{name:"volume-mute",className:t.volumeIcon}):A<.5?e(w,{name:"volume-down",className:t.volumeIcon}):e(w,{name:"volume-up",className:t.volumeIcon}),e(Rt,{className:t.volumeBar})]}),e("div",{className:t.playerActions,children:[u&&le&&e("button",{className:t.playerBtn,onClick:()=>B(a=>!a),"aria-label":l?"Hide images":"Show images",title:l?"Hide images":"Show images",children:l?e(w,{name:"eye-slash"}):e(w,{name:"image"})}),u&&k.length>0&&e("button",{className:`${t.playerBtn} ${N?t.playerBtnActive:""}`,onClick:()=>K(a=>!a),"aria-label":N?"Hide bookmarks":"Show bookmarks",title:"Timestamps",children:e(w,{name:"list-ol"})}),e("button",{className:t.playerBtn,onClick:R,"aria-label":"Close player",children:e(w,{name:"times"})})]})]}),Ie=e(Lt,{preload:"metadata",onPause:te,onTimeUpdate:Ce,onLoadedMetadata:Ne,onEnded:I}),xe=e(Je,{isOpen:ke,onClose:()=>re(!1),title:"Finished!",children:e("div",{style:{padding:"1rem",textAlign:"center"},children:[e(w,{name:"check-circle",size:48,style:{color:"var(--accent-lighter)",marginBottom:"0.5rem"}}),e("p",{style:{fontSize:"1.1rem",fontWeight:600},children:_?_(r):r}),e("p",{style:{color:"var(--text-secondary)"},children:"You finished this work!"}),e("div",{style:{marginTop:"1rem",display:"flex",gap:"10px",justifyContent:"center"},children:[e(Oe,{variant:"secondary",onClick:()=>re(!1),children:"Close"}),e(Oe,{onClick:G,children:"Mark Completed & Back to Home"})]})]})});if(!u)return je(e(E,{children:[Ie,e("div",{ref:f.containerRef,"data-player-root":"true",className:t.playerBar,children:Pe}),xe]}),document.body);const _e=Math.min(p,Math.max(0,o.length-1)),$e=o[_e],tt=l&&le&&!!$e&&!j.has($e);return je(e(E,{children:[Ie,xe,e("div",{ref:f.containerRef,"data-player-root":"true",className:`${t.npOverlay} ${$?"":t.npOverlayControlsHidden}`,children:[e("div",{className:`${t.npStage} ${!l||!le?t.npStageBlank:""}`,onClick:()=>D(a=>!a),children:l&&le&&e(E,{children:[e("div",{className:t.sliderViewport,children:[e("div",{className:t.sliderTrack,style:{transform:`translateX(-${_e*100}%)`},children:o.map(a=>e("div",{className:t.slide,children:e("img",{ref:s=>d(s,a),src:a,alt:`${_?_(r):r} - work image`,loading:"lazy",decoding:"async",draggable:!1,onLoad:()=>n(a),onError:()=>n(a),className:`${t.slideImg} ${j.has(a)?t.slideImgLoaded:""}`})},a))}),tt&&e("span",{className:t.slideSpinner,"aria-label":"Loading image"})]}),o.length>1&&e(E,{children:[e("button",{className:`${t.npArrow} ${t.npArrowLeft}`,onClick:a=>{a.stopPropagation(),x(s=>Math.max(0,s-1)),D(!0)},disabled:_e===0,"aria-label":"Previous image",children:e(w,{name:"chevron-left"})}),e("button",{className:`${t.npArrow} ${t.npArrowRight}`,onClick:a=>{a.stopPropagation(),x(s=>Math.min(o.length-1,s+1)),D(!0)},disabled:_e===o.length-1,"aria-label":"Next image",children:e(w,{name:"chevron-right"})}),e("span",{className:t.npImageCount,onClick:a=>a.stopPropagation(),children:[_e+1," / ",o.length]})]})]})}),e("div",{className:`${t.playerBar} ${t.playerBarDocked} ${$?"":t.playerBarDockedHidden}`,onClick:a=>a.stopPropagation(),children:[Pe,N&&e(E,{children:[e("div",{className:t.npBackdrop,onClick:()=>K(!1)}),e("div",{className:t.chapterPanel,children:k.map((a,s)=>e("button",{className:`${t.chapterRow} ${s===Ze?t.chapterRowActive:""}`,title:_?_(a.label):a.label,onClick:()=>{Xe(a.time),K(!1)},children:[e("span",{className:t.chapterRowTime,children:Le(a.time)}),e("span",{className:t.chapterRowLabel,title:_?_(a.label):a.label,children:_?_(a.label):a.label})]},`${a.time}-${s}`))})]})]})]})]}),document.body)},on="https://github.com/serifpersia/dango/releases/latest/download/dango-extension.zip",ln=r=>{try{return JSON.parse(r.detail)}catch{return null}},cn=({isOpen:r,onClose:o,onSuccess:k})=>{const[g,i]=b(1),[u,y]=b(typeof navigator<"u"?navigator.userAgent:""),[S,_]=b(""),[C,P]=b(!1),[R,f]=b(!1),m=H(null),L=typeof navigator<"u"?navigator.userAgent:"",A=/android/i.test(L),h=/firefox|fxios/i.test(L)&&!A,c=!h&&!A&&/chrome|chromium|edg|brave/i.test(L),l=h||c;T(()=>{r&&(i(1),y(typeof navigator<"u"?navigator.userAgent:""),_(""),P(!1),f(!1))},[r]),T(()=>()=>{m.current&&(window.removeEventListener("dango:jasmr-cookie",m.current),m.current=null)},[]);const B=async()=>{ue.setItem("jasmr_ua",u),window.open("https://japaneseasmr.com","_blank","noopener,noreferrer"),i(2)},p=()=>{if(R)return;f(!0);const j=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,Q=window.setTimeout(()=>{f(!1),m.current&&(window.removeEventListener("dango:jasmr-cookie",m.current),m.current=null),ae.error("Helper not detected - install it via about:debugging first.")},3e3),N=K=>{const $=ln(K);if(!(!$||$.requestId!==j))if(window.clearTimeout(Q),window.removeEventListener("dango:jasmr-cookie",N),m.current=null,f(!1),$?.ok&&$.cookie)_($.cookie),ae.success("Cookie extracted from helper!");else if($?.error==="NO_COOKIE"){const D=$.debug?.stores?.length??0,U=$.debug?.names??[];ae.error(`Helper found no cf_clearance (checked ${D} stores, saw: ${U.join(", ")||"none"}) - solve the challenge on the JapaneseASMR tab first.`)}else ae.error("Helper request failed - try again.")};m.current=N,window.addEventListener("dango:jasmr-cookie",N),window.dispatchEvent(new CustomEvent("dango:get-jasmr-cookie",{detail:{requestId:j}}))},x=async()=>{if(!S.trim()){ae.error("Please enter the cf_clearance cookie");return}P(!0);try{ue.setItem("jasmr_cookie",S.trim()),ae.success("Cookie updated successfully!"),k?.(),o()}catch{ae.error("Failed to save cookie")}finally{P(!1)}};return e(Je,{isOpen:r,onClose:o,title:"JapaneseASMR Verification Required",children:e("div",{className:M.container,children:g===1?e(E,{children:[e("p",{children:["JapaneseASMR is protected by a Cloudflare challenge. Solve it once in your browser and paste the ",e("strong",{children:"cf_clearance"})," cookie so the app can load the site for you."]}),e("div",{className:M.field,children:[e("label",{children:"Your User-Agent (must match the browser you solve the challenge with):"}),e("textarea",{value:u,onChange:j=>y(j.currentTarget.value),rows:3,className:M.textarea})]}),e("div",{className:M.actions,children:[e("button",{className:M.secondaryButton,onClick:o,children:"Cancel"}),e("button",{className:M.button,onClick:B,children:"Start Verification (Opens JapaneseASMR)"})]})]}):e(E,{children:[e("p",{children:["1. Solve the challenge on the ",e("strong",{children:"JapaneseASMR tab"})," (keep that tab open).",e("br",{}),"2. Copy the ",e("strong",{children:"cf_clearance"})," cookie value using one of these:",e("br",{}),e("br",{}),e("strong",{children:"Chrome / Edge — DevTools:"})," press ",e("code",{children:"F12"})," →"," ",e("strong",{children:"Application"})," → ",e("strong",{children:"Cookies"})," →"," ",e("code",{children:"https://japaneseasmr.com"}),". Find ",e("strong",{children:"cf_clearance"}),", double-click its ",e("strong",{children:"Value"})," to select it, then copy.",e("br",{}),e("br",{}),e("strong",{children:"Firefox — Storage Inspector:"})," press ",e("code",{children:"F12"})," →"," ",e("strong",{children:"Storage"})," → ",e("strong",{children:"Cookies"})," →"," ",e("code",{children:"https://japaneseasmr.com"}),". Find ",e("strong",{children:"cf_clearance"}),", right-click the value → ",e("strong",{children:"Copy Value"}),".",e("br",{}),e("br",{}),e("strong",{children:"Either browser — extension:"})," open"," ",e("strong",{children:"Cookie Manager"})," while on the JapaneseASMR tab, find"," ",e("strong",{children:"cf_clearance"}),", and copy its value (or use the extension's export).",e("br",{}),e("br",{}),"3. Paste it below. Copy ",e("strong",{children:"only the value"})," — remove any"," ",e("code",{children:"cf_clearance="})," prefix or quotes if they were included."]}),l&&e("div",{className:M.hint,children:[e("strong",{children:"Dango helper (one-time setup):"})," ",h?e(E,{children:["type ",e("code",{children:"about:debugging"})," in the address bar →"," ",e("strong",{children:"This Firefox"})," → ",e("strong",{children:"Load Temporary Add-on"})," ","→ open the ",e("code",{children:"dango-extension/firefox"})," folder and pick"," ",e("code",{children:"manifest.json"}),". (Temporary helpers unload when Firefox closes - repeat after a restart.)"]}):e(E,{children:["type ",e("code",{children:"chrome://extensions"})," in the address bar → enable"," ",e("strong",{children:"Developer mode"})," → ",e("strong",{children:"Load unpacked"})," → open the ",e("code",{children:"dango-extension/chrome"})," folder. (Unpacked helpers show a developer-mode notice - expected.)"]})," ","Use this link to download the extension and extract it:"," ",e("a",{href:on,target:"_blank",rel:"noreferrer",className:M.link,children:"dango-extension.zip"}),". Then click Extract below and the field fills itself.",e("div",{className:M.actions,children:e("button",{className:M.button,onClick:p,disabled:R,type:"button",children:R?"Extracting…":"Extract cookie from helper"})})]}),e("div",{className:M.field,children:[e("label",{children:"cf_clearance cookie value:"}),e("input",{type:"text",value:S,onChange:j=>_(j.currentTarget.value),placeholder:"e.g. xxxxxxxx.xxxxxxxx.xxxxxxx-xxxxxxx",className:M.input})]}),e("div",{className:M.actions,children:[e("button",{className:M.secondaryButton,onClick:o,children:"Cancel"}),e("button",{className:M.secondaryButton,onClick:()=>i(1),children:"Back"}),e("button",{className:M.button,onClick:x,disabled:C,children:C?"Saving...":"Submit"})]})]})})})},Qe="asmrTranslateCache",dn=10080*60*1e3;function un(){try{const r=ue.getItem(Qe);if(!r)return new Map;const o=JSON.parse(r);return new Map(Object.entries(o))}catch{return new Map}}function mn(r){try{const o={};for(const[k,g]of r)o[k]=g;ue.setItem(Qe,JSON.stringify(o))}catch{}}function Ue(r){return/[\u3040-\u309F\u30A0-\u30FF\u4E00-\u9FAF]/.test(r)}async function hn(r){const o=r.map(i=>i.trim()).filter(Boolean);if(o.length===0)return new Map;const k=await Me.settings.translate.mutate({texts:o,source:"ja",target:"en"}),g=new Map;for(const[i,u]of Object.entries(k.translations||{}))g.set(i,u);for(const i of o)g.has(i)||g.set(i,i);return g}function pn(r,o){const[k,g]=b(new Map),[i,u]=b(!1),y=H(null),S=r.join("");return T(()=>{const C=S?S.split(""):[];if(!o||C.length===0){g(new Map),u(!1);return}const P=Array.from(new Set(C.map(h=>h.trim()).filter(Boolean).filter(Ue)));if(P.length===0){g(new Map);return}y.current||(y.current=un());const R=Date.now(),f=new Map,m=[];for(const h of P){const c=y.current.get(h);c&&R-c.ts<dn?f.set(h,c.t):m.push(h)}if(m.length===0){g(f);return}let L=!1;u(!0);const A=[];for(let h=0;h<m.length;h+=15)A.push(m.slice(h,h+15));return(async()=>{const h=new Map;for(const l of A){try{const B=await hn(l);for(const[p,x]of B)h.set(p,x)}catch{}await new Promise(B=>setTimeout(B,120))}if(L)return;if(y.current){for(const[l,B]of h)y.current.set(l,{t:B,ts:Date.now()});mn(y.current)}const c=new Map([...f,...h]);g(c),u(!1)})(),()=>{L=!0}},[o,S]),{t:C=>!o||!C||!Ue(C)?C:k.get(C.trim())||C,map:k,isTranslating:i}}const gn=[{label:"Date",options:[{value:"latest",label:"Latest"},{value:"oldest",label:"Oldest"}]},{label:"Title",options:[{value:"title_asc",label:"A → Z"},{value:"title_desc",label:"Z → A"}]},{label:"Popular (Views)",options:[{value:"popular_recent",label:"Recent"},{value:"popular_week",label:"Week"},{value:"popular_month",label:"Month"},{value:"popular_6_months",label:"6 Months"},{value:"popular_year",label:"Year"},{value:"popular",label:"All Time"}]},{label:"Most Commented",options:[{value:"comments_week",label:"Week"},{value:"comments_month",label:"Month"},{value:"comments_year",label:"Year"},{value:"comments",label:"All Time"}]},{label:"Other",options:[{value:"random",label:"Random"}]}],fn=[{value:"",label:"All"},{value:"sfw",label:"SFW / 全年齢"},{value:"r-15",label:"R-15"},{value:"r-18",label:"NSFW / R18"},{value:"yuri",label:"Yuri / Girls love / 百合"},{value:"otokonoko",label:"Otoko no ko / 男の娘"},{value:"futanari",label:"Futanari / フタナリ"},{value:"r-18g",label:"R-18G / グロ"}],yn=[{value:"sfw",label:"SFW / 全年齢"}],In=()=>{const{rj:r}=rt(),o=Ve(),[k,g]=st(),{hasConsent:i,grant:u}=lt(),[y,S]=b(!1),[_,C]=b(()=>k.get("q")||""),[P,R]=b(()=>k.get("q")||""),[f,m]=b("latest"),[L,A]=b("sfw"),[h,c]=b(1),[l,B]=b(null),[p,x]=b(null),[j,Q]=b(!0),[N,K]=b(()=>ue.getItem("asmrTranslateEN")==="true"),[$,D]=b(!1),U=ct(),{toggle:me,bookmarkedIds:F}=Ge(),{popup:W,openPopup:be,scheduleClose:Z,cancelClose:ke,closePopup:re}=bt();T(()=>it("jasmr",()=>D(!0)),[]),T(()=>{ue.setItem("asmrTranslateEN",String(N))},[N]);const he=i,q=he?L:"sfw",pe=he?fn:yn,{data:V,isLoading:se,isError:oe,isFetching:ge}=yt(P,h,f,q),J=Re.useMemo(()=>V?.shows??[],[V?.shows]),fe=V?.hasNext??!1;T(()=>{if(!r){l&&!p&&B(null);return}const n=r.toUpperCase();if(p&&(p.work.id?.toUpperCase()===n||p.work._id?.toUpperCase()===n)){l&&B(null);return}const d=J.find(I=>(I.id||I._id)?.toUpperCase()===n);d?(!l||(l.id||l._id)!==(d.id||d._id))&&B(d):(!l||(l.id||l._id)?.toUpperCase()!==n)&&B({_id:n,id:n,name:n})},[r,J,p,l]);const le=Y(()=>{o("/asmr")},[o]);T(()=>{!r&&p&&x(null)},[r,p]);const{data:X}=Ke(p&&p.work.id||null),ie=p?[p.work.thumbnail,...X?.images||[]].filter(Boolean):[],ve=[...J.map(n=>n.name),l?.name||"",p?.work.name||"",...X?.chapters?.map(n=>n.label)||[]].filter(Boolean),{t:z}=pn(ve,N);T(()=>{const n=p?p.work.name:l?l.name:r?r.toUpperCase():"",d=n?N?z(n):n:"",I=d?`${d} - dango`:"dango";document.title=I;try{window.history.replaceState(window.history.state,I,window.location.href)}catch{}},[l,p,r,N,z]);const ce=n=>{n.preventDefault(),R(_),c(1);const d=new URLSearchParams(k);_.trim()?d.set("q",_.trim()):d.delete("q"),d.delete("page"),g(d,{replace:!0})};T(()=>{const n=k.get("q")||"";C(d=>d===n?d:n),R(d=>d===n?d:n),c(1)},[k]);const ye=n=>{n.currentTarget.checked&&!i&&S(!0)},ee=()=>{u(),S(!1),c(1)},we=()=>{S(!1)},de=Y((n,d,I)=>{B(null),Q(!0),x({work:n,tracks:d,index:I})},[]);return e("div",{className:`${ne.page} ${p?ne.pageWithPlayer:""}`,children:[!(p&&j)&&e(E,{children:[e("header",{className:ne.header,children:[e("h1",{className:ne.pageTitle,children:[e(w,{name:"headphones"})," ASMR"]}),e("form",{className:ne.searchForm,onSubmit:ce,children:[e("input",{className:ne.searchInput,type:"text",value:_,onChange:n=>C(n.currentTarget.value),placeholder:"Search works, circles, CV… (-word excludes)","aria-label":"Search ASMR works"}),e("button",{className:ne.searchBtn,type:"submit","aria-label":"Search",children:e(w,{name:"search"})})]})]}),e("div",{className:t.filterBar,children:[e("label",{className:t.filterLabel,htmlFor:"asmr-sort",children:"Sort"}),e("select",{id:"asmr-sort",className:t.sortSelect,value:f,onChange:n=>{m(n.currentTarget.value),c(1)},children:gn.map(n=>e("optgroup",{label:n.label,children:n.options.map(d=>e("option",{value:d.value,children:d.label},d.value))},n.label))}),e("label",{className:t.filterLabel,htmlFor:"asmr-rating",children:"Type"}),e("select",{id:"asmr-rating",className:t.sortSelect,value:L,onChange:n=>{A(n.currentTarget.value),c(1)},children:pe.map(n=>e("option",{value:n.value,children:n.label},n.value))}),e("div",{className:t.filterTogglesGroup,children:[e("div",{className:t.translateToggleWrap,children:[e("span",{className:t.filterLabel,children:"JP"}),e(De,{id:"asmr-translate-toggle",isChecked:N,onChange:n=>K(n.currentTarget.checked)}),e("span",{className:t.filterLabel,children:"EN"})]}),!i&&e("div",{className:t.matureToggleWrap,children:[e("label",{className:t.matureLabel,htmlFor:"asmr-mature-toggle",children:"Mature"}),e(De,{id:"asmr-mature-toggle",isChecked:!1,onChange:ye})]})]})]}),oe?e("p",{className:t.statusMsg,children:"Failed to load works. Please try again."}):se&&J.length===0?e("div",{className:t.grid,"aria-hidden":!0,children:Array.from({length:12}).map((n,d)=>e("div",{className:t.skeletonCard,children:[e("div",{className:`${t.skeletonThumb} ${t.shimmer}`}),e("div",{className:`${t.skeletonLine} ${t.shimmer}`,style:{width:"88%"}}),e("div",{className:`${t.skeletonLine} ${t.shimmer}`,style:{width:"55%"}})]},d))}):J.length===0?e("p",{className:t.statusMsg,children:"No works found."}):e(E,{children:[e("div",{className:`${t.grid} ${ge?t.fetching:""}`,children:J.map(n=>{const d=N?{...n,name:z(n.name)}:n,I=ze(n),Ce=Fe(I),te=F.has(Ce),Ne=`/asmr/${encodeURIComponent(I)}`;return e("div",{className:t.asmrCardWrap,children:[e(ut,{item:{id:Ce,title:d.name,thumbnail:n.thumbnail||"",typeBadge:I||void 0,isAdult:Be(n)},linkTo:Ne,hoverIcon:"info",layout:"horizontal",showInfoButton:!0,display:{elements:{poster:{typeBadge:!0,chapterBadge:!1,adultBadge:!0},info:{title:!0,mobileBadges:!0,progress:!1,meta:!1}}},onOpenDetails:G=>be(G,{rjCode:I,title:d.name,thumbnail:n.thumbnail||"",isAdult:Be(n),rating:n.rating,listenTarget:Ne}),onPopupHoverIntent:G=>G?ke():Z(),rawThumbnail:!0}),e("button",{className:`${t.bookmarkBtn} ${te?t.bookmarked:""}`,onClick:G=>{G.preventDefault(),G.stopPropagation(),me({rjCode:I,title:n.name,thumbnail:n.thumbnail||"",isAdult:Be(n)})},title:te?"Remove from listening list":"Add to listening list","aria-label":te?"Remove from listening list":"Add to listening list","aria-pressed":te,children:e(w,{name:te?"check":"plus",size:12})})]},n._id||n.id)})}),e(mt,{page:h,canGoNext:fe,onChange:n=>c(n),variant:"labeled"})]})]}),l&&e(nn,{work:l,onClose:le,onPlay:de,t:z}),W&&e(_t,{data:W.data,anchorRect:W.rect,bookmarked:F.has(Fe(W.data.rjCode)),onToggleBookmark:()=>me({rjCode:W.data.rjCode,title:W.data.title,thumbnail:W.data.thumbnail||"",isAdult:W.data.isAdult}),onMouseEnter:ke,onMouseLeave:Z,onRequestClose:re}),$&&e(cn,{isOpen:$,onClose:()=>D(!1),onSuccess:()=>{U.invalidateQueries({queryKey:[He.asmrBrowse]}),U.invalidateQueries({queryKey:[He.asmrWork]})}}),y&&e(dt,{isOpen:!0,scope:"section",showResetHint:!0,onClose:we,onGrant:ee}),p&&e(rn,{title:p.work.name,images:ie,chapters:X?.chapters||[],tracks:p.tracks,trackIndex:p.index,expanded:j,isAdult:!!p.work.isAdult,rjCode:p.work.id||p.work._id,t:z,onTrackChange:n=>x(d=>d&&{...d,index:n}),onExpandedChange:Q,onClose:()=>{x(null),Q(!0),r&&o("/asmr")}})]})};export{In as default};
@@ -1 +0,0 @@
1
- import{T as E,u as O}from"./vendor-core-DfaOB3Rn.js";import{b,u as d,a as p,e as w}from"./vendor-query-BBT5_sHx.js";import{l as c,F as i,q as A,t as S}from"./index-fS4AGBy2.js";import{i as L}from"./libraryInvalidation-C4kz8swK.js";import{a as _}from"./MediaCard-Wp1bAPsS.js";function C(s){return String(s||"").trim().toUpperCase()}function x(s){return C(s.id||s._id||"")}function W(s){return!!s.isAdult}const z=["Listening","Completed","On-Hold","Dropped","Planned"],B=s=>C(s),Y=(s="All",r=1,e=24)=>{const t=c();return b(t.asmrLibrary.list.queryOptions({status:s,page:r,limit:e}))},$=()=>{const s=c();return b({...s.asmrLibrary.ids.queryOptions(),staleTime:1e3*60})},J=s=>{const r=c();return b({...r.asmrLibrary.check.queryOptions({id:s||""}),enabled:!!s,staleTime:1e3*60})},V=(s=24)=>{const r=c();return b(r.asmrProgress.continueListening.queryOptions({limit:s}))},X=s=>{const r=c();return b({...r.asmrProgress.getByWork.queryOptions({workId:s||""}),enabled:!!s})},R=()=>{const s=c(),r=d();return p({mutationFn:async e=>{const{silent:t,...u}=e;return S.asmrLibrary.add.mutate(u)},onSuccess:(e,t)=>{t.silent||i.success("Added to listening list"),r.invalidateQueries({queryKey:[A.asmrLibrary]}),r.invalidateQueries(s.asmrLibrary.pathFilter())},onError:e=>{i.error(`Failed to add: ${e.message}`)}})},I=()=>{const s=c(),r=d();return p(s.asmrLibrary.remove.mutationOptions({onSuccess:()=>{i.success("Removed from listening list"),L(r,"asmr"),r.invalidateQueries(s.asmrLibrary.pathFilter()),r.invalidateQueries(s.asmrProgress.pathFilter())},onError:e=>{i.error(`Failed to remove: ${e.message}`)}}))},Z=()=>{const s=c(),r=d();return p(s.asmrLibrary.setStatus.mutationOptions({onSuccess:()=>{i.success("Status updated"),L(r,"asmr"),r.invalidateQueries(s.asmrLibrary.pathFilter()),r.invalidateQueries(s.asmrProgress.pathFilter())},onError:e=>{i.error(`Failed to update status: ${e.message}`)}}))},ss=()=>{const s=c(),r=d();return p(s.asmrProgress.save.mutationOptions({onSuccess:()=>{L(r,"asmr",!0),r.invalidateQueries(s.asmrLibrary.pathFilter()),r.invalidateQueries(s.asmrProgress.pathFilter())}}))},rs=()=>{const s=c(),r=d();return p(s.asmrProgress.remove.mutationOptions({onSuccess:()=>{i.success("Progress reset"),L(r,"asmr",!0),r.invalidateQueries(s.asmrLibrary.pathFilter()),r.invalidateQueries(s.asmrProgress.pathFilter())},onError:e=>{i.error(`Failed to reset progress: ${e.message}`)}}))},es=()=>{const s=c(),r=d();return p(s.asmrLibrary.batchStatus.mutationOptions({onSuccess:e=>{i.success(`Status updated for ${e.updated??0} items`),L(r,"asmr"),r.invalidateQueries(s.asmrLibrary.pathFilter()),r.invalidateQueries(s.asmrProgress.pathFilter())},onError:e=>{i.error(`Failed to update statuses: ${e.message}`)}}))},ts=()=>{const s=c(),r=d();return p(s.asmrLibrary.removeMany.mutationOptions({onSuccess:e=>{const t=e.removed??0;i.success(`Removed ${t} ${t===1?"item":"items"} from listening list`),L(r,"asmr"),r.invalidateQueries(s.asmrLibrary.pathFilter()),r.invalidateQueries(s.asmrProgress.pathFilter())},onError:e=>{i.error(`Failed to remove: ${e.message}`)}}))},os=()=>{const s=c(),r=d();return p(s.asmrProgress.removeMany.mutationOptions({onSuccess:e=>{const t=e.removed??0;i.success(`Reset progress for ${t} ${t===1?"item":"items"}`),L(r,"asmr",!0),r.invalidateQueries(s.asmrLibrary.pathFilter()),r.invalidateQueries(s.asmrProgress.pathFilter())},onError:e=>{i.error(`Failed to reset progress: ${e.message}`)}}))},as=()=>{const s=R(),r=I(),{data:e}=$(),t=E(()=>new Set(e?.ids||[]),[e]);return{toggle:o=>{const a=B(o.rjCode);t.has(a)?r.mutate({id:a}):s.mutate({...o,thumbnail:o.thumbnail||""})},bookmarkedIds:t,pending:s.isPending||r.isPending}},k=300*1e3,q=15,ns=(s,r,e,t)=>{const u=r+1,o=w({queries:Array.from({length:u},(m,T)=>{const F=T+1;return{queryKey:[A.asmrBrowse,s,F,e,t],queryFn:()=>{const Q=s.trim();return S.asmr.browse.query({q:Q||void 0,page:F,sort:e&&e!=="latest"?e:void 0,rating:t||void 0})},staleTime:k}})}),a=o.flatMap(m=>m.data?.shows??[]),g=a.slice((r-1)*q,r*q),y=o[o.length-1]?.data,h=!!(y&&(y.hasNext||a.length>r*q)),v=o.some(m=>m.isLoading),n=o.some(m=>m.isFetching),l=o.some(m=>m.isError);return{data:{shows:g,hasNext:h},isLoading:v,isError:l,isFetching:n}},M=s=>{const r=c(),e=b({...r.asmr.work.queryOptions({rj:s}),enabled:!!s,staleTime:k,refetchOnMount:"always"});return{...e,data:e.data}},N=15,f=6;function D(s){if(s.isAdult||!s.thumbnail)return!1;const r=(s.rating||"").toLowerCase();return r===""||r==="sfw"}function P(s,r){const e=new Set,t=[];for(const u of s)for(const o of u){if(t.length>=r)return t;const a=o.id||o._id;!a||e.has(a)||(e.add(a),D(o)&&t.push(o))}return t}const is=(s=!0)=>{const r=w({queries:Array.from({length:N},(n,l)=>{const m=l+1;return{queryKey:[A.asmrBrowse,"",m,"popular_month",""],queryFn:()=>S.asmr.browse.query({page:m,sort:"popular_month"}),staleTime:k,enabled:s,retry:1}})}),e=r.map(n=>n.data?.shows??[]),t=P(e,f),u=r.every(n=>n.isFetched),o=s&&u&&t.length<f,a=b({queryKey:[A.asmrBrowse,"",1,"popular","sfw"],queryFn:()=>S.asmr.browse.query({page:1,sort:"popular",rating:"sfw"}),staleTime:k,enabled:o,retry:1}),g=a.data?.shows??[],y=t.length>=f?t.slice(0,f):P([t,g],f),h=s&&(r.some(n=>n.isLoading)||o&&a.isLoading),v=s&&u&&y.length===0&&r.some(n=>n.isError);return{data:y,isLoading:h,isError:v}},cs=({data:s,anchorRect:r,bookmarked:e,onToggleBookmark:t,onMouseEnter:u,onMouseLeave:o,onRequestClose:a})=>{const{data:g,isLoading:y}=M(s.rjCode||null),h=g?.tracks.length??0,v=h>0,n=!y,l=[{icon:"headphones",label:n?v?`${h} track${h===1?"":"s"}`:"No tracks":"Loading tracks…"}];return s.rating&&l.push({label:s.rating.toUpperCase()}),s.isAdult&&l.push({label:"18+"}),s.progressLabel&&l.push({icon:"bookmark",label:s.progressLabel}),O(_,{anchorRect:r,title:s.title,subtitle:s.rjCode,cover:s.thumbnail,meta:l,synopsis:!n&&!g?.description?"Loading description…":g?.description??"No description available.",primaryAction:{to:s.listenTarget,label:v?"Listen now":n?"No tracks":"Loading…",icon:"play",disabled:!v},secondaryAction:{to:s.listenTarget,label:"Details"},bookmarked:e,bookmarkLabel:"Bookmark",onToggleBookmark:t,onMouseEnter:u,onMouseLeave:o,onRequestClose:a})};export{cs as A,as as a,B as b,x as c,is as d,M as e,J as f,X as g,C as h,ss as i,R as j,ns as k,W as l,Y as m,I as n,Z as o,es as p,ts as q,os as r,z as s,rs as t,V as u};
@@ -1 +0,0 @@
1
- import{o as U,d as k,h as L,T as E,u,S as y}from"./vendor-core-DfaOB3Rn.js";import{M as F}from"./MediaCard-Wp1bAPsS.js";import{L as N}from"./LibraryListPage-BJ7o8MNw.js";import{m as _,u as q,n as z,o as O,a as Q,p as Y,q as D,r as G,s as T,A as H,b as K}from"./AsmrPopup-Du6eR09X.js";import{u as Z}from"./useAsmrPopup-BBmHrx9v.js";import{A as J}from"./AsmrResetProgressModal-CBz6OxDc.js";import{g as h}from"./index-fS4AGBy2.js";import"./vendor-icons-DrybRNxP.js";import"./vendor-ui-3qrARCPr.js";import"./useIsMobile-Dvx1uJ82.js";import"./MatureConsentModal-J7mF0tSH.js";import"./SkeletonGrid-Bi4N7XcX.js";import"./ErrorMessage-DAxegITP.js";import"./LibraryListPage.module-r6k9nyT9.js";import"./vendor-query-BBT5_sHx.js";import"./libraryInvalidation-C4kz8swK.js";import"./usePopup-DS9jMzp6.js";import"./ResetProgressModal-D9Hi4yvU.js";const V=["All","Continue Listening",...T],A=24;function W(a){const d=a.currentTime??0,i=a.duration??0,r=(a.trackIndex??0)+1;return i>0?`Track ${r} · ${h(d)} / ${h(i)}`:`Track ${r}`}function Lt(){const{filter:a="All"}=U(),[d,i]=k(1),[r,m]=k(null);L(()=>{document.title="Listening List - dango"},[]),L(()=>{i(1)},[a]);const o=a==="Continue Listening",n=_(o?"All":a,d,A),l=q(100),f=z(),C=O(),{toggle:v,bookmarkedIds:R}=Q(),{popup:s,openPopup:I,scheduleClose:c,cancelClose:p,closePopup:B}=Z(),P=Y(),S=D(),j=G(),M=E(()=>o?(l.data?.data??[]).map(t=>{const e=t.currentTime??0,g=t.duration??0,b=t.rjCode||t.id;return{key:t.id,libId:t.id,rjCode:b,title:t.title||"",thumbnail:t.thumbnail||"",status:t.watchlistStatus??"",isAdult:!!t.isAdult,trackLabel:`Track ${(t.trackIndex??0)+1}`,progressPercent:g>0?Math.min(100,e/g*100):0,progressLabel:W(t),detailTarget:`/asmr/${encodeURIComponent(b)}`}}):(n.data?.data??[]).map(t=>{const e=t.rjCode||t.id;return{key:t.id,libId:t.id,rjCode:e,title:t.title,thumbnail:t.thumbnail||"",status:t.status,isAdult:!!t.isAdult,trackLabel:t.lastTrackIndex!==null&&t.lastTrackIndex!==void 0?`Track ${t.lastTrackIndex+1}`:void 0,progressPercent:void 0,progressLabel:void 0,detailTarget:`/asmr/${encodeURIComponent(e)}`}}),[o,l.data,n.data]),w=o?l.data?.total??0:n.data?.total??0,x=o?l.isLoading:n.isLoading,$=o?l.error:n.error;return u(N,{headerTitle:"My Listening List",headerSubtitle:"Track and manage your ASMR collection",filters:V,filterBy:a,filterBasePath:"/listening-list",continueFilter:"Continue Listening",statusOptions:[...T],entries:M,total:w,isLoading:x,error:$,page:d,pageSize:A,onPageChange:i,emptyTitle:"Your listening list is looking a bit lonely",emptyFilteredText:"No works match this filter.",emptyAllText:"Let's find something to listen to!",browseLabel:"Browse ASMR",browseTarget:"/asmr",removeListLabel:"Remove from Listening List",listNoun:"listening list",skipConfirmKey:"asmrSkipRemoveConfirmation",onBulkStatus:(t,e)=>P.mutate({ids:t,status:e}),onBulkRemove:t=>{o?j.mutate({ids:t}):S.mutate({ids:t})},onStatusChange:(t,e)=>C.mutate({id:t,status:e}),onRemoveItem:t=>f.mutate({id:t}),renderCard:t=>u(F,{item:{id:t.libId,title:t.title,thumbnail:t.thumbnail,typeBadge:t.rjCode||void 0,chapterBadge:t.trackLabel??null,isAdult:t.isAdult},linkTo:t.detailTarget,hoverIcon:"info",layout:"horizontal",showInfoButton:!o,progress:t.progressPercent!==void 0&&t.progressLabel?{percent:t.progressPercent,label:t.progressLabel}:void 0,showProgress:o,display:{elements:{poster:{typeBadge:!0,chapterBadge:!0,adultBadge:!0},info:{title:!0,mobileBadges:!0,progress:!0,meta:!1}}},onRemove:o?()=>m(t):void 0,onOpenDetails:o?void 0:e=>I(e,{rjCode:t.rjCode,title:t.title,thumbnail:t.thumbnail,isAdult:t.isAdult,listenTarget:t.detailTarget,progressLabel:t.progressLabel}),onPopupHoverIntent:e=>e?p():c(),rawThumbnail:!0}),modals:u(y,{children:[u(J,{workId:r?r.libId:null,title:r?.title,onClose:()=>m(null)}),s&&u(H,{data:s.data,anchorRect:s.rect,bookmarked:R.has(K(s.data.rjCode)),onToggleBookmark:()=>v({rjCode:s.data.rjCode,title:s.data.title,thumbnail:s.data.thumbnail||"",isAdult:s.data.isAdult}),onMouseEnter:p,onMouseLeave:c,onRequestClose:B})]})})}export{Lt as default};
@@ -1 +0,0 @@
1
- import{p as le,d as O,T as re,h as U,u as a,m as ne,S as q}from"./vendor-core-DfaOB3Rn.js";import{I as M}from"./vendor-icons-DrybRNxP.js";import{T as se}from"./ToggleSwitch-CN_ppEc9.js";import{M as oe}from"./MatureConsentModal-J7mF0tSH.js";import{E as ie}from"./ErrorMessage-DAxegITP.js";import{M as ce,P as de}from"./MediaCard-Wp1bAPsS.js";import{u as ue,M as ge}from"./useMangaPopup-DrrvSchc.js";import{e as pe,a5 as he}from"./index-fS4AGBy2.js";import{f as me,u as ve,m as D,i as be,b as fe,c as Se}from"./useMangaLibrary-4UsX_okY.js";import{u as Te}from"./useProviders-SXQCnsGW.js";import{s as l}from"./Manga.module-depGEacJ.js";import{p as c}from"./page.module-C1MlZzf3.js";import"./vendor-ui-3qrARCPr.js";import"./useIsMobile-Dvx1uJ82.js";import"./usePopup-DS9jMzp6.js";import"./vendor-query-BBT5_sHx.js";import"./libraryInvalidation-C4kz8swK.js";const ye=[{value:"popular",label:"Popular"},{value:"latest",label:"Latest"},{value:"rating",label:"Top Rated"},{value:"followed",label:"Most Followed"}],Me=[{value:"",label:"Any Status"},{value:"ongoing",label:"Ongoing"},{value:"completed",label:"Completed"},{value:"hiatus",label:"Hiatus"},{value:"cancelled",label:"Cancelled"}],Ne=[{value:"",label:"Any Status"},{value:"publishing",label:"Publishing"},{value:"finished",label:"Finished"},{value:"on hiatus",label:"On Hiatus"},{value:"discontinued",label:"Discontinued"}],Ce=[{value:"",label:"All Types"},{value:"manga",label:"Manga"},{value:"novel",label:"Novel"},{value:"one-shot",label:"One-Shot"},{value:"doujinshi",label:"Doujinshi"}],Pe=[{value:"safe",label:"Safe"}],Ie=[{value:"safe",label:"Safe"},{value:"suggestive",label:"Suggestive"},{value:"erotica",label:"Erotica"},{value:"pornographic",label:"Pornographic"}];function He(){const[n,N]=le(),{hasConsent:v,grant:_}=pe(),[j,b]=O(!1),[C,P]=O(n.get("q")||""),{options:I,isLoading:R,refetch:G}=Te(),d=re(()=>I.filter(e=>e.kind==="manga").map(e=>({value:e.id,label:e.label})),[I]),f=n.get("provider")||"",S=f&&d.some(e=>e.value===f)?f:"",T=n.get("q")||"",L=parseInt(n.get("page")||"1"),$=n.get("sort")||"popular",k=n.get("status")||"",w=n.get("type")||"",u=n.get("rating")||"safe",A=n.get("id")||"";U(()=>{document.title="Manga - dango"},[]);const o=v,y=o?u:"safe",H=o?Ie:Pe,i=(e,t=!1)=>{const r=new URLSearchParams(n);for(const[m,E]of Object.entries(e))E?r.set(m,E):r.delete(m);t&&r.delete("page"),N(r)},g=me({provider:S,query:T,page:L,sort:$,status:k,type:w,rating:y,mature:o}),h=g.data?.items??[],z=g.data?.hasNext??!1,p=S||h[0]?.provider||"",{toggle:V,bookmarkedIds:X}=ve(),{popup:s,openPopup:K,scheduleClose:x,cancelClose:B,closePopup:Q}=ue();if(U(()=>{P(T)},[T]),A){const e=new URLSearchParams;o&&u!=="safe"&&e.set("rating",u);const t=n.get("chapter")||"";t&&e.set("chapter",t);const r=e.toString()?`?${e.toString()}`:"",m=`/manga/${p||"mangadex"}/${encodeURIComponent(A)}${t?`/read${r}`:r}`;return a(ne,{to:m,replace:!0})}const W=e=>{e.preventDefault(),he(),i({q:C},!0)},Y=e=>{e.currentTarget.checked&&!v&&b(!0)},J=()=>{_(),b(!1),i({},!0)},Z=()=>{b(!1)},F=e=>{const t=new URLSearchParams;o&&u!=="safe"&&t.set("rating",u);const r=t.toString()?`?${t.toString()}`:"";return`/manga/${e.provider}/${encodeURIComponent(e.id)}${r}`},ee=p==="mangapill"?Ne:Me,ae=p==="mangapill",te=p==="mangadex";return a("div",{className:c.page,children:[a("div",{className:c.header,children:[a("h1",{className:c.pageTitle,children:[a(M,{name:"book"})," Manga"]}),a("form",{className:c.searchForm,onSubmit:W,children:[a("input",{className:c.searchInput,value:C,onChange:e=>P(e.currentTarget.value),placeholder:"Search manga titles...","aria-label":"Search manga"}),a("button",{className:c.searchBtn,type:"submit","aria-label":"Search",children:a(M,{name:"search",size:14})})]}),a("select",{className:l.select,value:S,disabled:d.length===0,onChange:e=>{const t=new URLSearchParams(n);t.set("provider",e.currentTarget.value),t.delete("page"),t.delete("id"),t.delete("chapter"),t.delete("status"),t.delete("type"),N(t)},"aria-label":"Manga provider",children:d.length===0?a("option",{value:"",children:R?"Loading providers…":"No providers available"}):a(q,{children:[a("option",{value:"",children:"Auto"}),d.map(e=>a("option",{value:e.value,children:e.label},e.value))]})}),d.length===0&&!R&&a("button",{className:c.searchBtn,type:"button",onClick:()=>G(),"aria-label":"Retry loading providers",children:a(M,{name:"redo",size:14})})]}),a("div",{className:l.filterRow,children:[p==="mangadex"&&a("select",{className:l.select,value:$,onChange:e=>i({sort:e.currentTarget.value},!0),"aria-label":"Sort manga",children:ye.map(e=>a("option",{value:e.value,children:e.label},e.value))}),a("select",{className:l.select,value:k,onChange:e=>i({status:e.currentTarget.value},!0),"aria-label":"Filter by status",children:ee.map(e=>a("option",{value:e.value,children:e.label},e.label))}),ae&&a("select",{className:l.select,value:w,onChange:e=>i({type:e.currentTarget.value},!0),"aria-label":"Filter by type",children:Ce.filter(e=>e.value!=="doujinshi"||o).map(e=>a("option",{value:e.value,children:e.label},e.value))}),te&&a("select",{className:l.select,value:y,onChange:e=>i({rating:e.currentTarget.value},!0),"aria-label":"Content rating",children:H.map(e=>a("option",{value:e.value,children:e.label},e.value))}),!v&&a("div",{className:l.matureToggleWrap,children:[a("label",{className:l.matureLabel,htmlFor:"manga-mature-toggle",children:"Mature"}),a(se,{id:"manga-mature-toggle",isChecked:!1,onChange:Y})]})]}),g.isError?a(ie,{message:"Failed to load manga. Please try again."}):g.isLoading&&h.length===0?a("div",{className:l.grid,"aria-hidden":!0,children:Array.from({length:12}).map((e,t)=>a("div",{className:l.skeletonCard,children:[a("div",{className:`${l.skeletonThumb} ${l.shimmer}`}),a("div",{className:`${l.skeletonLine} ${l.shimmer}`,style:{width:"88%"}}),a("div",{className:`${l.skeletonLine} ${l.shimmer}`,style:{width:"55%"}})]},t))}):h.length===0?a("p",{className:l.statusMsg,children:"No titles found. Try another search or provider."}):a(q,{children:[a("div",{className:`${l.grid} ${g.isFetching?l.fetching:""}`,children:h.map(e=>{const t=D(e.provider,e.id);return a(ce,{item:{id:t,title:e.title,...Se(e),thumbnail:fe(e.provider,e.cover),typeBadge:e.type||void 0,chapterBadge:e.latestChapter?`Ch. ${e.latestChapter}`:null,isAdult:be(e)},linkTo:F(e),hoverIcon:"info",display:{elements:{poster:{typeBadge:!0,chapterBadge:!0,adultBadge:!0},info:{title:!0,mobileBadges:!0,progress:!1,meta:!1}}},onOpenDetails:r=>K(r,{provider:e.provider,mangaId:e.id,title:e.title,altTitle:e.altTitle,cover:e.cover,contentRating:e.contentRating,readTarget:F(e),rating:y,mature:o}),onPopupHoverIntent:r=>r?B():x(),rawThumbnail:!0},`${e.provider}-${e.id}`)})}),a(de,{page:L,canGoNext:z,onChange:e=>i({page:String(e)}),variant:"labeled"})]}),s&&a(ge,{data:s.data,anchorRect:s.rect,bookmarked:X.has(D(s.data.provider,s.data.mangaId)),onToggleBookmark:()=>V({id:s.data.mangaId,provider:s.data.provider,title:s.data.title,cover:s.data.cover,altTitle:s.data.altTitle??void 0,contentRating:s.data.contentRating}),onMouseEnter:B,onMouseLeave:x,onRequestClose:Q}),j&&a(oe,{isOpen:!0,scope:"section",showResetHint:!0,onClose:Z,onGrant:J})]})}export{He as default};
@@ -1 +0,0 @@
1
- import{u as e,a as Q,d as z,S as E,o as O,p as G,T as $,h as Y}from"./vendor-core-DfaOB3Rn.js";import{I as x}from"./vendor-icons-DrybRNxP.js";import{B as M,e as H,d as J}from"./index-fS4AGBy2.js";import{E as K}from"./ErrorMessage-DAxegITP.js";import{b as D,g as V,f as U,h as j,j as X,m as A,k as Z,l as ee,n as te,r as ae,o as re,p as ne,q as se,s as ie,M as oe}from"./useMangaLibrary-4UsX_okY.js";import{s as r}from"./Manga.module-depGEacJ.js";import{p as le}from"./page.module-C1MlZzf3.js";import"./vendor-query-BBT5_sHx.js";import"./libraryInvalidation-C4kz8swK.js";const ce=({detail:a,altTitle:c,onBack:b,onOpenChapter:v,bookmarkButton:n,statusSelect:g,primaryAction:k,progressByChapter:d})=>{const h=[a.type,a.status,a.year?String(a.year):"",a.author?`by ${a.author}`:""].filter(Boolean);return e("div",{children:[e("button",{className:r.backBtn,onClick:b,children:[e(x,{name:"chevron-left",size:12})," Back to browse"]}),e("div",{className:r.detail,children:[a.cover&&e("img",{className:r.detailCover,src:D(a.provider,a.cover),alt:a.title,decoding:"async",draggable:!1}),e("div",{className:r.detailInfo,children:[e("h2",{className:r.detailTitle,children:a.title}),c&&e("p",{className:r.detailAltTitle,children:["Also known as: ",c]}),h.length>0&&e("div",{className:r.detailMeta,children:h.map(t=>e("span",{className:r.badge,children:t},t))}),a.genres&&a.genres.length>0&&e("div",{className:r.detailMeta,children:a.genres.map(t=>e("span",{className:r.badge,children:t},t))}),a.description&&e("p",{className:r.detailDesc,children:a.description}),(n||g||k)&&e("div",{className:r.detailActions,children:[k,n,g]})]})]}),e("h3",{className:r.detailTitle,style:{fontSize:"1rem"},children:["Chapters (",a.chapters.length,")"]}),a.chapters.length===0?e("p",{className:r.statusMsg,children:"No chapters found for this title on this provider."}):e("div",{className:r.chapterList,children:a.chapters.map(t=>{const o=d?.get(t.id),p=!!o&&o.pageCount>0&&o.page>=o.pageCount;return e("button",{className:`${r.chapterRow} ${p?r.chapterDone:""}`,onClick:()=>v(t),title:t.externalUrl?"External only - opens on source site":void 0,children:[e("span",{children:["Ch. ",t.number,t.title?` - ${t.title}`:""]}),e("span",{className:r.chapterMeta,children:[o&&o.pageCount>0?p?"read":`p. ${o.page}/${o.pageCount}`:"",t.group,t.externalUrl?"external":""].filter(Boolean).join(" · ")})]},t.id)})})]})},de=({libId:a,anilistId:c})=>{const b=Q(),v=V(a),n=v.data?.item,[g,k]=z(null),[d,h]=z(null),t=g??n?.title??"",o=U({provider:"mangadex",query:t,page:1,sort:"",status:"",type:"",rating:"safe",mature:!1},!!t),p=U({provider:"mangapill",query:t,page:1,sort:"",status:"",type:"",rating:"safe",mature:!1},!!t),S=j(),y=X(),T=async s=>{const u=A(s.provider,s.id);h(u);try{await S.mutateAsync({provider:s.provider,mangaId:s.id,title:s.title,cover:s.cover,altTitle:s.altTitle,contentRating:s.contentRating,silent:!0}),await y.mutateAsync({id:u,anilistId:c}),b(`/manga/${s.provider}/${encodeURIComponent(s.id)}`)}catch{return}finally{h(null)}},C=(s,u,B)=>e("div",{style:{marginTop:"12px"},children:[e("div",{style:{fontWeight:600,textTransform:"capitalize",marginBottom:"6px"},children:s}),B?e("div",{style:{color:"var(--text-tertiary)",fontSize:"0.85rem"},children:"Searching…"}):!u||u.length===0?e("div",{style:{color:"var(--text-tertiary)",fontSize:"0.85rem"},children:"No matches."}):u.slice(0,6).map(l=>{const I=A(l.provider,l.id),N=d===I;return e("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"6px 0",borderTop:"1px solid var(--border, #223)"},children:[l.cover&&e("img",{src:D(l.provider,l.cover),alt:"",loading:"lazy",style:{width:"34px",height:"48px",objectFit:"cover",borderRadius:"4px"}}),e("div",{style:{flex:1,minWidth:0},children:[e("div",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l.title}),l.latestChapter&&e("div",{style:{color:"var(--text-tertiary)",fontSize:"0.75rem"},children:l.latestChapter})]}),e(M,{onClick:()=>T(l),disabled:N,children:[e(x,{name:"external-link-alt",size:12})," ",N?"Linking…":"Link"]})]},I)})]});return e("div",{children:[e("button",{onClick:()=>b("/manga"),style:{background:"none",border:"none",color:"var(--accent)",cursor:"pointer",marginBottom:"12px"},children:[e(x,{name:"chevron-left",size:12})," Back to browse"]}),v.isLoading?e("div",{style:{color:"var(--text-tertiary)"},children:"Loading library entry…"}):n?e(E,{children:[e("div",{style:{display:"flex",gap:"12px",alignItems:"center"},children:[n.cover&&e("img",{src:n.cover,alt:"",style:{width:"64px",height:"90px",objectFit:"cover",borderRadius:"6px"}}),e("div",{children:[e("h2",{style:{margin:"0 0 4px"},children:n.title}),e("div",{style:{color:"var(--text-tertiary)",fontSize:"0.85rem"},children:["Tracked on AniList",n.lastChapterNumber?` · Ch. ${n.lastChapterNumber}`:"",n.status?` · ${n.status}`:""]})]})]}),e("p",{style:{color:"var(--text-tertiary)",fontSize:"0.85rem",marginTop:"12px"},children:"AniList doesn't host chapters. Search your providers below and link the matching manga - your AniList status and chapter progress will sync to it from now on."}),e("div",{style:{display:"flex",gap:"8px",marginTop:"8px"},children:e("input",{type:"text",value:g??n.title,onChange:s=>k(s.currentTarget.value),placeholder:"Search providers…",style:{flex:1,padding:"8px 10px",borderRadius:"6px",border:"1px solid var(--border, #223)",background:"var(--bg-secondary, transparent)",color:"inherit"}})}),C("mangadex",o.data?.items,o.isLoading),C("mangapill",p.data?.items,p.isLoading)]}):e("div",{style:{color:"var(--text-tertiary)"},children:"This AniList entry is no longer in your library."})]})};function ke(){const{provider:a="",id:c=""}=O(),[b]=G(),v=Q(),{hasConsent:n}=H(),g=b.get("rating")||"safe",k=n?g:"safe",d=a&&c?A(a,c):void 0,h=Z(a||null,c||null,k,n),t=h.data,o=ee(d),p=te(d),{titlePreference:S}=J(),y=$(()=>t&&{...t,title:ae(t,S)},[t,S]),T=j(),C=re(),s=ne();Y(()=>{y&&(document.title=`${y.title} - dango`)},[y]);const u=$(()=>{const i=new Map;for(const m of p.data?.progress??[])i.set(m.chapterId,m);return i},[p.data]),B=a.toLowerCase()==="anilist"&&/^\d+$/.test(c)?parseInt(c,10):null,l=o.data?.inLibrary??!1,I=o.data?.status??"Reading",N=$(()=>(t?.chapters??[]).filter(i=>!i.externalUrl),[t]),f=$(()=>{if(!t)return null;const i=[...p.data?.progress??[]].sort((m,L)=>L.updatedAt-m.updatedAt);for(const m of i){const L=t.chapters.find(w=>w.id===m.chapterId);if(L&&!L.externalUrl)return L;const P=se(m.chapterId);if(P!=null){const w=ie(t.chapters,P);if(w&&!w.externalUrl)return w}}return N[0]??null},[t,p.data,N]),q=f?u.get(f.id):void 0,F=(p.data?.progress?.length??0)>0,W=f&&(q||F)?`Continue Ch. ${f?.number}`:"Start Reading",R=i=>{if(i.externalUrl){window.open(i.externalUrl,"_blank","noopener,noreferrer");return}const m=new URLSearchParams;m.set("chapter",i.id),n&&g!=="safe"&&m.set("rating",g),v(`/manga/${a}/${encodeURIComponent(c)}/read?${m.toString()}`)},_=()=>{!t||!d||(l?C.mutate(d):T.mutate({provider:a,mangaId:c,title:t.title,cover:t.cover,author:t.author,altTitle:t.altTitle,contentRating:t.contentRating}))};return e("div",{className:le.page,children:h.isLoading?e("div",{"aria-hidden":!0,children:[e("div",{className:`${r.skeletonThumb} ${r.shimmer}`,style:{maxWidth:"12rem"}}),e("div",{className:`${r.skeletonLine} ${r.shimmer}`,style:{width:"40%"}}),e("div",{className:`${r.skeletonLine} ${r.shimmer}`,style:{width:"70%"}})]}):h.isError||!t||!y?B!=null&&d?e(de,{libId:d,anilistId:B}):e(E,{children:[e("button",{className:r.backBtn,onClick:()=>v("/manga"),children:[e(x,{name:"chevron-left",size:12})," Back to browse"]}),e(K,{message:"Failed to load this title. Please try again."})]}):e(ce,{detail:y,altTitle:t.altTitle!==y.title?t.altTitle:void 0,onBack:()=>v("/manga"),onOpenChapter:R,progressByChapter:u,primaryAction:f?e(M,{onClick:()=>f&&R(f),children:[e(x,{name:"book",size:13})," ",W]}):void 0,bookmarkButton:e(M,{variant:l?"secondary":"primary",onClick:_,disabled:T.isPending||C.isPending,children:[e(x,{name:"bookmark",size:13})," ",l?"Bookmarked":"Bookmark"]}),statusSelect:l?e("select",{className:r.detailSelect,value:I,onChange:i=>d&&s.mutate({id:d,status:i.currentTarget.value}),"aria-label":"Reading status",children:oe.map(i=>e("option",{value:i,children:i},i))}):void 0})})}export{ke as default};
@@ -1 +0,0 @@
1
- import{d as D,A as w,q as Z,h as g,u as e,S as le,o as be,p as we,a as Ne,T as ye}from"./vendor-core-DfaOB3Rn.js";import{E as Ce}from"./ErrorMessage-DAxegITP.js";import{p as X,q as ke,e as Ie,d as $e,t as ce}from"./index-fS4AGBy2.js";import{I as S}from"./vendor-icons-DrybRNxP.js";import{u as Se}from"./vendor-query-BBT5_sHx.js";import{t as Pe,v as Re,m as Me,k as xe,r as Ee,n as Te,w as Le,q as Be,s as ze}from"./useMangaLibrary-4UsX_okY.js";import{s as t}from"./Manga.module-depGEacJ.js";import{p as Ae}from"./page.module-C1MlZzf3.js";import"./libraryInvalidation-C4kz8swK.js";const de="mangaReadMode",ue="mangaFitMode";function Fe(){try{return X.getItem(de)==="page"?"page":"strip"}catch{return"strip"}}function Ue(){try{return X.getItem(ue)==="height"?"height":"width"}catch{return"width"}}const De=({provider:h,mangaTitle:p,chapter:f,chapters:y,onBack:C,onOpenChapter:v,initialPage:u=0,onProgress:V})=>{const[c,P]=D(Fe),[B,i]=D(Ue),[d,z]=D(0),[A,M]=D(new Set),[b,k]=D(0),N=w(null),x=w([]),Y=Se(),{data:_,isLoading:j,isError:R}=Pe(h,f.id),s=_?.pages??[],m=s.map(n=>Re(h,n)),$=w(0),F=w(0),E=w(!1);F.current=s.length;const T=y.findIndex(n=>n.id===f.id),r=T>0?[...y.slice(0,T)].reverse().find(n=>!n.externalUrl)??null:null,o=T>=0?y.slice(T+1).find(n=>!n.externalUrl)??null:null,I=Z(n=>{E.current=!0,z(a=>{const l=a+n;return l<0?(r&&v(r),0):l>=s.length?(o&&v(o),a):l})},[s.length,r,o,v]);g(()=>{E.current=!1,$.current=Math.max(0,u),z(Math.max(0,u)),M(new Set),x.current=[],u<=0&&window.scrollTo(0,0)},[f.id,u]);const J=w(V);J.current=V;const ee=w(""),O=w(null),te=w(null),[W,ge]=D(0),L=Z(()=>{const n=c==="strip"?x.current[$.current]:te.current,a=n?.querySelector("img");if(!n||!a)return;const l=Math.max(0,(n.clientWidth-a.clientWidth)/2)+8;ge(H=>Math.abs(H-l)<1?H:l)},[c]);g(()=>{$.current=d,s.length!==0&&J.current?.(Math.min(d+1,s.length),s.length)},[d,s.length]),g(()=>{u<=0||E.current||$.current===0&&(E.current=!1,$.current=u,z(u))},[u]),g(()=>{if(c!=="strip"||s.length===0||u<=0)return;const n=`${f.id}:${u}`;if(ee.current===n)return;ee.current=n;const a=window.setTimeout(()=>{x.current[Math.min(u,s.length-1)]?.scrollIntoView({block:"start"})},150);return()=>window.clearTimeout(a)},[c,s.length,u,f.id]),g(()=>{document.title=`${p} Ch. ${f.number} - dango`},[p,f.number]),g(()=>{try{X.setItem(de,c)}catch{}},[c]),g(()=>{try{X.setItem(ue,B)}catch{}},[B]),g(()=>{c==="page"&&window.scrollTo(0,0)},[c]),g(()=>{if(c!=="page"||s.length===0)return;const n=a=>{a.key==="ArrowRight"||a.key===" "?(a.preventDefault(),I(1)):a.key==="ArrowLeft"&&(a.preventDefault(),I(-1))};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[c,s.length,I]),g(()=>{if(c!=="strip"||s.length===0)return;let n=0;const a=()=>{n=0;const H=window.innerHeight*.3,G=x.current;let q=-1,se=0;for(let Q=0;Q<G.length;Q++){const ie=G[Q];if(!ie)continue;const oe=ie.getBoundingClientRect();if(oe.height>4&&se++,oe.top<=H)q=Q;else break}q<0||se<Math.min(3,G.length)||(q!==$.current&&(E.current=!0,$.current=q,z(q)),L())},l=()=>{n||(n=requestAnimationFrame(a))};return O.current=l,l(),window.addEventListener("scroll",l,{passive:!0}),window.addEventListener("resize",l),()=>{window.removeEventListener("scroll",l),window.removeEventListener("resize",l),n&&cancelAnimationFrame(n),O.current=null}},[c,s.length,_,L]),g(()=>{if(!(c!=="page"||s.length===0))return L(),window.addEventListener("resize",L),()=>window.removeEventListener("resize",L)},[c,d,s.length,L]);const he=n=>{N.current=n.touches[0].clientX},me=n=>{if(N.current===null)return;const a=n.changedTouches[0].clientX-N.current;N.current=null,!(Math.abs(a)<50)&&I(a<0?1:-1)},K=n=>{n&&v(n)},ne=n=>M(a=>{if(a.has(n))return a;const l=new Set(a);return l.add(n),l}),pe=n=>{M(a=>{const l=new Set(a);return l.delete(n),l}),k(a=>a+1)},fe=()=>{M(new Set),k(n=>n+1),Y.invalidateQueries({queryKey:[ke.mangaPages,h,f.id]})},ve=s.length>0&&A.size>=s.length,re=n=>b>0?`${n}&n=${b}`:n,ae=n=>e("div",{className:t.deadPage,role:"alert",children:[e("span",{children:["Page ",n+1," failed to load"]}),e("button",{className:t.pageBtn,onClick:()=>pe(n),children:[e(S,{name:"sync-alt",size:12})," Retry"]})]}),U=B==="height";return e("div",{className:t.readerShell,children:[e("div",{className:t.readerBar,children:[e("button",{className:t.readerIconBtn,onClick:C,"aria-label":"Back to chapters",children:e(S,{name:"chevron-left",size:14})}),e("span",{className:t.readerTitle,children:[p," - Ch. ",f.number,f.title?` ${f.title}`:""]}),s.length>0&&e("span",{className:t.readerCounter,children:[Math.min(d+1,s.length)," / ",s.length]}),e("div",{className:t.readerSegment,role:"group","aria-label":"Reading mode",children:[e("button",{type:"button","aria-pressed":c==="strip",className:c==="strip"?t.readerSegmentActive:"",onClick:()=>P("strip"),children:"Strip"}),e("button",{type:"button","aria-pressed":c==="page",className:c==="page"?t.readerSegmentActive:"",onClick:()=>P("page"),children:"Page"})]}),e("div",{className:t.readerSegment,role:"group","aria-label":"Fit mode",children:[e("button",{type:"button","aria-pressed":!U,className:U?"":t.readerSegmentActive,onClick:()=>i("width"),title:"Fit width - best for portrait / phones",children:"Wide"}),e("button",{type:"button","aria-pressed":U,className:U?t.readerSegmentActive:"",onClick:()=>i("height"),title:"Fit height - best for landscape / desktop",children:"Tall"})]}),e("button",{className:t.readerIconBtn,disabled:!r,onClick:()=>K(r),"aria-label":"Previous chapter",children:e(S,{name:"chevron-left",size:14})}),e("button",{className:t.readerIconBtn,disabled:!o,onClick:()=>K(o),"aria-label":"Next chapter",children:e(S,{name:"chevron-right",size:14})})]}),R?e("p",{className:t.statusMsg,children:"Failed to load pages. Please try again."}):j?e("div",{className:t.readerPages,"aria-hidden":!0,children:Array.from({length:3}).map((n,a)=>e("div",{className:`${t.skeletonThumb} ${t.shimmer}`,style:{width:"100%",maxWidth:"56rem",aspectRatio:"3 / 4"}},a))}):s.length===0?e("p",{className:t.statusMsg,children:"No pages found for this chapter."}):ve?e("div",{className:t.failedBox,children:[e("p",{className:t.statusMsg,children:"Page images failed to load (expired or blocked links)."}),e("button",{className:t.pageBtn,onClick:fe,children:[e(S,{name:"sync-alt",size:12})," Reload pages"]})]}):c==="strip"?e("div",{className:`${t.readerPages} ${U?t.readerPagesTall:""}`,children:m.map((n,a)=>e("div",{ref:l=>{x.current[a]=l},className:t.readerPageWrap,children:[a===d&&e("div",{className:t.ribbon,style:W>0?{right:W}:void 0,"aria-hidden":"true",children:e(S,{name:"bookmark",size:12})},d),A.has(a)?ae(a):e("img",{className:t.readerPage,src:re(n),alt:`Page ${a+1}`,loading:a<3?"eager":"lazy",decoding:"async",draggable:!1,onLoad:()=>O.current?.(),onError:()=>ne(a)})]},`${a}-${s[a].slice(-32)}`))}):e(le,{children:[e("div",{ref:te,className:`${t.pageView} ${U?t.pageViewTall:""}`,onTouchStart:he,onTouchEnd:me,children:[e("div",{className:t.ribbon,style:W>0?{right:W}:void 0,"aria-hidden":"true",children:e(S,{name:"bookmark",size:12})},d),e("button",{className:`${t.tapZone} ${t.tapZoneLeft}`,onClick:()=>I(-1),"aria-label":"Previous page",children:e("span",{className:t.tapChevron,children:e(S,{name:"chevron-left",size:16})})}),A.has(d)?ae(d):e("img",{className:t.pageImage,src:re(m[d]),alt:`Page ${d+1} of ${s.length}`,decoding:"async",draggable:!1,onLoad:()=>L(),onError:()=>ne(d)},`${d}-${s[d].slice(-32)}`),e("button",{className:`${t.tapZone} ${t.tapZoneRight}`,onClick:()=>I(1),"aria-label":"Next page",children:e("span",{className:t.tapChevron,children:e(S,{name:"chevron-right",size:16})})})]}),e("nav",{className:t.pagination,"aria-label":"Page navigation",children:[e("button",{className:t.pageBtn,disabled:d<=0,onClick:()=>I(-1),children:"Previous page"}),e("span",{className:t.pageIndicator,children:[d+1," / ",s.length]}),e("button",{className:t.pageBtn,disabled:d>=s.length-1,onClick:()=>I(1),children:"Next page"})]})]}),(r||o)&&e("nav",{className:t.pagination,children:[e("button",{className:t.pageBtn,disabled:!r,onClick:()=>K(r),children:"Previous chapter"}),e("button",{className:t.pageBtn,disabled:!o,onClick:()=>K(o),children:"Next chapter"})]})]})},_e=800,qe=5e3;function Oe(){const{provider:h="",id:p=""}=be(),[f]=we(),y=Ne(),C=f.get("chapter")||"",v=f.get("rating")||"safe",{hasConsent:u}=Ie(),V=u?v:"safe",c=h&&p?Me(h,p):"",P=h.toLowerCase()==="anilist";g(()=>{P&&p&&y(`/manga/anilist/${encodeURIComponent(p)}`,{replace:!0})},[P,p,y]);const B=xe(!P&&h?h:null,!P&&p?p:null,V,u),i=B.data,{titlePreference:d}=$e(),z=i?Ee(i,d):"Manga",A=Te(c||void 0),M=Le(),b=i&&C?i.chapters.find(r=>r.id===C)??null:null,k=Be(C),N=k!=null&&i?ze(i.chapters,k):null;g(()=>{if(k!=null&&N&&N.id!==C){const r=new URLSearchParams;r.set("chapter",N.id),u&&v!=="safe"&&r.set("rating",v),y(`/manga/${h}/${encodeURIComponent(p)}/read?${r.toString()}`,{replace:!0})}},[k,N,C,u,v,h,p,y]);const x=k!=null&&!!i&&!!N,Y=k!=null&&!!i&&!N,_=ye(()=>{const r=(A.data?.progress??[]).find(o=>o.chapterId===C);return r&&r.page>0?r.page:0},[A.data,C]),j=_>1?_-1:0,R=w(null),s=w(null),m=Z(()=>{R.current&&(clearTimeout(R.current),R.current=null);const r=s.current;s.current=null,r&&c&&M.mutate({mangaId:c,chapterId:r.chapterId,chapterNumber:r.chapterNumber,page:r.page,pageCount:r.pageCount,title:i?.title??null,cover:i?.cover??null,provider:h||null,altTitle:i?.altTitle??null,contentRating:i?.contentRating??null})},[c,M,i?.title,i?.cover,i?.altTitle,i?.contentRating,h]),$=Z((r,o)=>{b&&(s.current={chapterId:b.id,chapterNumber:b.number,page:r,pageCount:o},R.current&&clearTimeout(R.current),R.current=setTimeout(m,_e))},[b,m]);g(()=>{m()},[C,m]),g(()=>()=>m(),[m]),g(()=>{const r=window.setInterval(()=>{s.current&&m()},qe);return()=>window.clearInterval(r)},[m]),g(()=>{const r=()=>{document.visibilityState==="hidden"&&m()},o=()=>m();return document.addEventListener("visibilitychange",r),window.addEventListener("pagehide",o),()=>{document.removeEventListener("visibilitychange",r),window.removeEventListener("pagehide",o)}},[m]);const F=w("");F.current||(F.current=`manga-${Date.now()}-${Math.random().toString(36).slice(2)}`),g(()=>{if(!i||!b)return;const r=i.contentRating==="erotica"||i.contentRating==="pornographic"||i.type==="doujinshi",o=()=>{ce.discord.mangaPresence.mutate({title:i.title,chapterLabel:`Chapter ${b.number}`,isPlaying:!0,thumbnail:i.cover||"",thumbnails:[i.cover].filter(Boolean),isAdult:r,sessionId:F.current}).catch(()=>{}),ce.discord.heartbeat.mutate({sessionId:F.current}).catch(()=>{})};o();const I=window.setInterval(o,6e4);return()=>window.clearInterval(I)},[i,b]);const E=r=>{if(m(),r.externalUrl){window.open(r.externalUrl,"_blank","noopener,noreferrer");return}const o=new URLSearchParams;o.set("chapter",r.id),u&&v!=="safe"&&o.set("rating",v),y(`/manga/${h}/${encodeURIComponent(p)}/read?${o.toString()}`)},T=()=>{m();const r=new URLSearchParams;u&&v!=="safe"&&r.set("rating",v);const o=r.toString()?`?${r.toString()}`:"";y(`/manga/${h}/${encodeURIComponent(p)}${o}`)};return P?null:e("div",{className:Ae.page,children:B.isLoading||x?e("div",{className:t.readerPages,"aria-hidden":!0,children:Array.from({length:3}).map((r,o)=>e("div",{className:`${t.skeletonThumb} ${t.shimmer}`,style:{width:"100%",maxWidth:"56rem",aspectRatio:"3 / 4"}},o))}):!i||!b?e(le,{children:[e("button",{className:t.backBtn,onClick:T,children:"Back to title"}),e(Ce,{message:Y?`Chapter ${k} isn't available from ${h} for this title.`:"Failed to load this chapter. Please try again."})]}):e(De,{provider:h,mangaTitle:z,chapter:b,chapters:i.chapters,onBack:T,onOpenChapter:E,initialPage:j,onProgress:$},b.id)})}export{Oe as default};
@@ -1 +0,0 @@
1
- import{u as a}from"./vendor-core-DfaOB3Rn.js";import{R as i}from"./ResetProgressModal-D9Hi4yvU.js";import{B as n,o as g}from"./useMangaLibrary-4UsX_okY.js";const M=({mangaId:e,title:o,onClose:r})=>{const s=n(),t=g();return a(i,{isOpen:!!e,itemName:o,progressKind:"reading",listLabel:"my reading list",onClose:r,onConfirm:m=>{e&&(s.mutate({mangaId:e}),m&&t.mutate(e))}})};export{M};
@@ -1 +0,0 @@
1
- import{d as $,A as z,h as F,T as Ee,u as e,g as x,S as H,$ as Re,L as Y,q as C,N as Ie,a as ze}from"./vendor-core-DfaOB3Rn.js";import{I as k}from"./vendor-icons-DrybRNxP.js";import{a as $e,b as Se,f as Le,s as De}from"./vendor-ui-3qrARCPr.js";import{u as re}from"./useIsMobile-Dvx1uJ82.js";import{M as xe}from"./MatureConsentModal-J7mF0tSH.js";import{t as Oe,d as Ae,u as je,e as Fe,f as Ue}from"./index-fS4AGBy2.js";const We="_pagination_zelsc_1",Ve="_pageBtn_zelsc_7",Ge="_pageInfo_zelsc_38",Xe="_pagePicker_zelsc_48",Ye="_dropdown_zelsc_52",He="_flipDown_zelsc_68",Ke="_jumpRow_zelsc_73",qe="_jumpInput_zelsc_79",Je="_jumpGo_zelsc_90",Qe="_optionList_zelsc_105",Ze="_optionBtn_zelsc_113",et="_current_zelsc_132",w={pagination:We,pageBtn:Ve,pageInfo:Ge,pagePicker:Xe,dropdown:Ye,flipDown:He,jumpRow:Ke,jumpInput:qe,jumpGo:Je,optionList:Qe,optionBtn:Ze,current:et},yn=({page:t,totalPages:p,canGoNext:l,onChange:i,isLoading:h=!1,variant:f="compact"})=>{const[s,b]=$(!1),[B,_]=$(""),[y,v]=$(0),[N,E]=$(!1),M=z(null),d=z(null),g=z(null);F(()=>{if(!s)return;const r=m=>{M.current&&!M.current.contains(m.target)&&b(!1)},n=m=>{m.key==="Escape"&&b(!1)};return document.addEventListener("pointerdown",r),document.addEventListener("keydown",n),()=>{document.removeEventListener("pointerdown",r),document.removeEventListener("keydown",n)}},[s]),F(()=>{if(!s)return;v(0),E(!1);const r=requestAnimationFrame(()=>{const n=g.current?.getBoundingClientRect(),m=d.current?.getBoundingClientRect();if(!n)return;let P=0;n.right>window.innerWidth-8?P=window.innerWidth-8-n.right:n.left<8&&(P=8-n.left),v(Math.round(P)),m&&m.top<n.height+24&&E(!0)});return()=>cancelAnimationFrame(r)},[s]);const a=p,S=Ee(()=>{if(a!==void 0){if(a<=100)return Array.from({length:a},(m,P)=>P+1);const n=new Set([1,a]);for(let m=t-10;m<=t+10;m++)m>=1&&m<=a&&n.add(m);return[...n].sort((m,P)=>m-P)}const r=l?t+1:t;return Array.from({length:r},(n,m)=>m+1)},[a,t,l]),T=r=>{const n=a!==void 0?Math.min(Math.max(1,r),a):Math.max(1,r);b(!1),_(""),n!==t&&i(n)},L=()=>{const r=parseInt(B,10);Number.isNaN(r)||T(r)},D=h||(a!==void 0?t>=a:!l);return e("div",{className:w.pagination,ref:M,children:[e("button",{className:w.pageBtn,onClick:()=>i(t-1),disabled:t<=1||h,"aria-label":"Previous page",children:[e(k,{name:"chevron-left",size:14}),f==="labeled"&&e("span",{children:"Previous"})]}),e("div",{className:w.pagePicker,ref:d,children:[e("button",{className:w.pageBtn,onClick:()=>{_(""),b(r=>!r)},disabled:h,"aria-label":"Jump to page","aria-expanded":s,children:e("span",{className:w.pageInfo,children:["Page ",e("strong",{children:t}),a!==void 0&&` of ${a}`]})}),s&&e("div",{ref:g,className:`${w.dropdown} ${N?w.flipDown:""}`,style:y!==0?{marginLeft:y}:void 0,children:[e("div",{className:w.jumpRow,children:[e("input",{className:w.jumpInput,type:"number",inputMode:"numeric",min:1,max:a,value:B,placeholder:"Page #",onChange:r=>_(r.currentTarget.value),onKeyDown:r=>{r.key==="Enter"&&L()}}),e("button",{className:w.jumpGo,onClick:L,children:"Go"})]}),e("div",{className:w.optionList,children:S.map(r=>e("button",{className:`${w.optionBtn} ${r===t?w.current:""}`,onClick:()=>T(r),disabled:r===t,children:r},r))})]})]}),e("button",{className:w.pageBtn,onClick:()=>i(t+1),disabled:D,"aria-label":"Next page",children:[f==="labeled"&&e("span",{children:"Next"}),e(k,{name:"chevron-right",size:14})]})]})},tt="_popupPortal_1d6yy_1",nt="_popupContent_1d6yy_6",ot="_popupBackdrop_1d6yy_31",st="_mobile_1d6yy_38",rt="_header_1d6yy_62",at="_title_1d6yy_67",ct="_altTitle_1d6yy_78",lt="_cover_1d6yy_87",it="_body_1d6yy_97",dt="_metaRow_1d6yy_104",ut="_metaItem_1d6yy_111",pt="_scoreIcon_1d6yy_117",_t="_synopsis_1d6yy_121",mt="_genres_1d6yy_143",ft="_genre_1d6yy_143",ht="_footer_1d6yy_158",gt="_primaryAction_1d6yy_167",bt="_watchBtn_1d6yy_171",yt="_secondaryActions_1d6yy_194",vt="_watchlistBtn_1d6yy_199",Bt="_detailsBtn_1d6yy_200",wt="_active_1d6yy_226",kt="_loading_1d6yy_237",Nt="_spinner_1d6yy_247",c={popupPortal:tt,popupContent:nt,popupBackdrop:ot,mobile:st,header:rt,title:at,altTitle:ct,cover:lt,body:it,metaRow:dt,metaItem:ut,scoreIcon:pt,synopsis:_t,genres:mt,genre:ft,footer:ht,primaryAction:gt,watchBtn:bt,secondaryActions:yt,watchlistBtn:vt,detailsBtn:Bt,active:wt,loading:kt,spinner:Nt},Ct=({anchorRect:t,onMouseEnter:p,onMouseLeave:l,onRequestClose:i,children:h})=>{const f=re(),s=x.useMemo(()=>({getBoundingClientRect:()=>t}),[t]),{refs:b,floatingStyles:B}=$e({placement:"right-start",middleware:[Le({fallbackAxisSideDirection:"start"}),De({padding:20})],whileElementsMounted:Se});x.useEffect(()=>{b.setPositionReference(s)},[b,s]),x.useEffect(()=>{if(!f)return;const y=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=y}},[f]);const _=e(H,{children:[f&&e("div",{className:c.popupBackdrop,onClick:()=>i?.()}),e("div",{ref:f?void 0:b.setFloating,className:`${c.popupPortal} ${f?c.mobile:""}`,style:f?void 0:B,onMouseEnter:p,onMouseLeave:l,children:e("div",{className:c.popupContent,children:h})})]});return Re(_,document.body)},vn=({anchorRect:t,title:p,subtitle:l,cover:i,loading:h,error:f,meta:s=[],genres:b=[],synopsis:B,primaryAction:_,secondaryAction:y,bookmarked:v,bookmarkLabel:N="Watchlist",onToggleBookmark:E,extraActions:M,onMouseEnter:d,onMouseLeave:g,onRequestClose:a})=>{const S=z(!1),T=()=>{S.current=!0,d()},L=()=>{S.current=!1,g()},D=n=>{!n&&!S.current&&g()},r=!!_||!!y||!!M;return e(Ct,{anchorRect:t,onMouseEnter:T,onMouseLeave:L,onRequestClose:a,children:h?e("div",{className:c.loading,children:[e("div",{className:c.spinner}),e("span",{children:"Fetching details..."})]}):f?e("div",{className:c.loading,children:f}):e(H,{children:[p&&e("div",{className:c.header,children:[i&&e("img",{src:i,alt:p,loading:"lazy",decoding:"async",className:c.cover}),e("div",{className:c.title,children:p}),l&&e("div",{className:c.altTitle,children:l})]}),e("div",{className:c.body,children:[s.length>0&&e("div",{className:c.metaRow,children:s.map((n,m)=>e("div",{className:c.metaItem,children:[n.icon&&e(k,{name:n.icon,className:n.accent?c.scoreIcon:void 0,size:14}),e("span",{children:n.label})]},`${n.label}-${m}`))}),b.length>0&&e("div",{className:c.genres,children:b.map(n=>e("span",{className:c.genre,children:n},n))}),B&&e("div",{className:c.synopsis,children:B})]}),r&&e("div",{className:c.footer,children:[_&&e("div",{className:c.primaryAction,children:_.disabled?e("span",{className:c.watchBtn,"aria-disabled":"true",style:{opacity:.5,pointerEvents:"none"},children:[e(k,{name:_.icon??"play",size:14}),_.label]}):e(Y,{to:_.to,className:c.watchBtn,onClick:a,children:[e(k,{name:_.icon??"play",size:14}),_.label]})}),e("div",{className:c.secondaryActions,children:[e("button",{className:`${c.watchlistBtn} ${v?c.active:""}`,onClick:n=>{n.preventDefault(),n.stopPropagation(),E()},children:[v?e(k,{name:"check",size:12}):e(k,{name:"plus",size:12}),e("span",{children:v?"Remove":N})]}),M?.(D),y&&e(Y,{to:y.to,className:c.detailsBtn,onClick:a,children:[y.icon&&e(k,{name:y.icon,size:12}),e("span",{children:y.label})]})]})]})]})})},Pt=t=>!t||t.trim()===""?!0:t.includes("placeholder");function Mt(t,p){const[l,i]=$(p);return F(()=>{i(p)},[p]),F(()=>{if(!Pt(p)||!t)return;let h=!1;return Oe.data.showMeta.query({id:t}).then(f=>{const s=f?.thumbnail;!h&&s&&s.trim()!==""&&!s.includes("placeholder")&&i(s)}).catch(()=>{}),()=>{h=!0}},[t,p]),{thumbnail:l}}const Tt="_cardWrapper_erb2k_1",Et="_card_erb2k_1",Rt="_cardButton_erb2k_36",It="_hoverOverlay_erb2k_63",zt="_matureOverlay_erb2k_98",$t="_posterContainer_erb2k_108",St="_horizontal_erb2k_117",Lt="_posterImg_erb2k_121",Dt="_blurred_erb2k_133",xt="_flat_erb2k_156",Ot="_loaded_erb2k_160",At="_progressSection_erb2k_169",jt="_titleSection_erb2k_176",Ft="_title_erb2k_176",Ut="_titleText_erb2k_195",Wt="_badge_erb2k_207",Vt="_typeBadge_erb2k_218 _badge_erb2k_207",Gt="_epBadge_erb2k_227 _badge_erb2k_207",Xt="_airTime_erb2k_236",Yt="_adultBadge_erb2k_243 _badge_erb2k_207",Ht="_gated_erb2k_256",Kt="_notAiredBadge_erb2k_262 _badge_erb2k_207",qt="_metaRow_erb2k_277",Jt="_metaItem_erb2k_288",Qt="_progressContainer_erb2k_305",Zt="_progressBar_erb2k_313",en="_timestamp_erb2k_321",tn="_removeBtn_erb2k_326",nn="_infoBtn_erb2k_327",on="_mobileBadges_erb2k_378",sn="_mobileBadgeBase_erb2k_385",rn="_mobileType_erb2k_393 _mobileBadgeBase_erb2k_385",an="_mobileEp_erb2k_400 _mobileBadgeBase_erb2k_385",cn="_lowEnd_erb2k_470",o={cardWrapper:Tt,card:Et,cardButton:Rt,hoverOverlay:It,matureOverlay:zt,posterContainer:$t,horizontal:St,posterImg:Lt,blurred:Dt,flat:xt,loaded:Ot,progressSection:At,titleSection:jt,title:Ft,titleText:Ut,badge:Wt,typeBadge:Vt,epBadge:Gt,airTime:Xt,adultBadge:Yt,gated:Ht,notAiredBadge:Kt,metaRow:qt,metaItem:Jt,progressContainer:Qt,progressBar:Zt,timestamp:en,removeBtn:tn,infoBtn:nn,mobileBadges:on,mobileBadgeBase:sn,mobileType:rn,mobileEp:an,lowEnd:cn},ln=500,se=20,dn=300;function un(t){const p=z(null),l=z(null),i=z(!1),h=z({x:0,y:0}),f=z(null),s=C(()=>{l.current&&(clearTimeout(l.current),l.current=null)},[]),b=C(()=>{p.current&&(clearTimeout(p.current),p.current=null)},[]),B=C(d=>{p.current&&clearTimeout(p.current),p.current=setTimeout(d,dn)},[]),_=C((d,g=!1)=>{i.current=g,t(d,g)},[t]),y=C((d,g)=>{if(g||d.pointerType==="mouse")return;f.current=d.pointerType,i.current=!1,h.current={x:d.clientX,y:d.clientY};const a=d.currentTarget.getBoundingClientRect();s(),l.current=setTimeout(()=>{l.current=null,_(a,!0)},ln)},[s,_]),v=C(d=>{if(!l.current)return;const g=Math.abs(d.clientX-h.current.x),a=Math.abs(d.clientY-h.current.y);(g>se||a>se)&&s()},[s]),N=C(()=>{s(),f.current=null},[s]),E=C((d,g)=>{d.preventDefault(),d.stopPropagation(),f.current==="touch"?l.current&&(clearTimeout(l.current),l.current=null,_(d.currentTarget.getBoundingClientRect(),!0)):!g&&!i.current&&_(d.currentTarget.getBoundingClientRect())},[_]),M=C(()=>i.current?(i.current=!1,!0):!1,[]);return{longPressFiredRef:i,cancelLongPress:s,clearPopupTimeout:b,schedulePopupClose:B,openViaHold:_,handlePointerDown:y,handlePointerMove:v,handlePointerUpOrCancel:N,handleContextMenu:E,consumeLongPressClick:M}}const X={elements:{poster:{typeBadge:!0,chapterBadge:!0,adultBadge:!0},info:{title:!0,mobileBadges:!0,progress:!0,meta:!0}}},Bn=Ie(({item:t,linkTo:p,hoverIcon:l,progress:i,showProgress:h=!1,metaRow:f,display:s,layout:b="vertical",onRemove:B,showRemoveButton:_,showInfoButton:y=!1,onOpenDetails:v,renderPopup:N,onPopupHoverIntent:E,rawThumbnail:M,enrichedId:d})=>{const g=ze(),a=re(),{titlePreference:S}=Ae(),{lowEndMode:T}=je(),[L,D]=$(!1),[r,n]=$(!1),{thumbnail:m}=Mt(d,t.thumbnail),[P,K]=$(!1),[q,J]=$(null),Q=u=>{J(u),K(!0)},U=C(()=>{K(!1),J(null)},[]),R=un(u=>{if(v){v(u);return}N&&Q(u)}),W=C(()=>{R.schedulePopupClose(U)},[R,U]),Z=R.clearPopupTimeout,ae=u=>{if(a)return;const oe=u.currentTarget.getBoundingClientRect();if(v){v(oe);return}N&&Q(oe)},ce=()=>{N&&W()},le=()=>{Z()},ie=()=>{N&&W()},de=u=>{R.handlePointerDown(u,I)},ue=u=>{R.handlePointerMove(u)},ee=()=>{R.handlePointerUpOrCancel()},pe=u=>{if(v){u.preventDefault(),u.stopPropagation(),v(u.currentTarget.getBoundingClientRect());return}if(N){R.handleContextMenu(u,I);return}R.handleContextMenu(u,I)},te={...s,elements:{...X.elements,...s?.elements||{},poster:{...X.elements?.poster,...s?.elements?.poster||{}},info:{...X.elements?.info,...s?.elements?.info||{}}}},V=t[S]||t.title,O=te.elements?.poster,A=te.elements?.info,_e=(O?.typeBadge??!0)&&!!t.typeBadge,me=(O?.chapterBadge??!0)&&!!t.chapterBadge,fe=_??O?.removeButton??!!B,he=O?.adultBadge??!0,ge=A?.mobileBadges??!0,be=A?.progress??!0,ye=A?.meta??!0,ve=h&&!!i&&i.percent>0,ne=!!t.isAdult,{hasConsent:Be,grant:we}=Fe(),[ke,G]=x.useState(!1),j=x.useRef(null),Ne=()=>{we(),G(!1),j.current&&(g(j.current),j.current=null)},I=ne&&!Be,Ce=u=>{if(R.consumeLongPressClick()){u.preventDefault(),u.stopPropagation();return}I&&(u.preventDefault(),u.stopPropagation(),j.current=p,G(!0))},Pe=l==="book"?e(k,{name:"book",size:28}):l==="play"?e(k,{name:"play",size:28}):l==="info"?e(k,{name:"info-circle",size:28}):e(k,{name:"info-circle",size:28}),Me=C(u=>{u.preventDefault(),u.stopPropagation(),B&&B(t.id)},[B,t.id]),Te=M?m??t.thumbnail:Ue(m,T?100:150,T?150:200);return e("div",{className:`${o.cardWrapper} ${T?o.lowEnd:""}`,onMouseEnter:()=>{n(!0),E?.(!0),P&&Z()},onMouseLeave:()=>{n(!1),E?.(!1),P&&W()},children:[e(Y,{to:p,className:`${o.card} ${o[b]} ${I?o.cardButton:""}`,onClick:Ce,onContextMenu:pe,onPointerDown:de,onPointerMove:ue,onPointerUp:ee,onPointerCancel:ee,children:[e("div",{className:o.posterContainer,children:[I&&e("div",{className:`${o.matureOverlay} ${T?o.flat:""}`}),e("img",{src:Te,alt:V,className:`${o.posterImg} ${L?o.loaded:""} ${I&&!T?o.blurred:""}`,loading:"lazy",decoding:"async",onLoad:()=>D(!0)}),!a&&e(H,{children:[_e&&e("div",{className:o.typeBadge,children:t.typeBadge}),me&&e("div",{className:o.epBadge,children:[t.chapterBadge,t.airMeta&&e("span",{className:o.airTime,children:t.airMeta})]})]}),he&&ne&&e("div",{className:`${o.adultBadge} ${I?o.gated:""}`,children:"18+"}),t.notAired&&e("div",{className:o.notAiredBadge,children:"NOT AIRED"}),!a&&r&&e("div",{className:o.hoverOverlay,children:Pe})]}),be&&h&&ve&&i&&e("div",{className:o.progressSection,children:[e("div",{className:o.progressContainer,children:e("div",{className:o.progressBar,style:{width:`${i.percent}%`}})}),e("div",{className:o.timestamp,children:i.label})]}),e("div",{className:o.titleSection,children:[a&&ge&&e("div",{className:o.mobileBadges,children:[!!t.typeBadge&&e("span",{className:o.mobileType,children:t.typeBadge}),t.chapterBadge&&e("span",{className:o.mobileEp,children:t.chapterBadge})]}),A?.title!==!1&&e("div",{className:o.title,title:V,children:e("span",{className:o.titleText,children:V})}),ye&&f&&e("div",{className:o.metaRow,children:f})]})]}),ke&&e(xe,{isOpen:!0,showResetHint:!0,onClose:()=>G(!1),onGrant:Ne}),fe&&e("button",{className:o.removeBtn,onClick:Me,"aria-label":"Remove",children:e(k,{name:"times",size:10})}),y&&!a&&!I&&e("button",{className:o.infoBtn,onMouseEnter:ae,onMouseLeave:ce,"aria-label":"Info",children:e(k,{name:"info",size:11})}),N&&P&&q?N(q,{close:U,onMouseEnter:le,onMouseLeave:ie}):null]})});export{Bn as M,yn as P,vn as a,o as m,c as p};
@@ -1 +0,0 @@
1
- import{X as Ee,x as we,u as d,A as x,q as de,h as X,d as ae,T as oe,_ as Te,C as me}from"./vendor-core-DfaOB3Rn.js";import{I as te}from"./vendor-icons-DrybRNxP.js";import{_ as Pe,p as pe,g as be}from"./index-fS4AGBy2.js";const ye=Ee(null);function j(){const n=we(ye);if(!n)throw new Error("Player controls must be inside a PlayerProvider.");return n}function ve(n,i){const t=j(),r=x(i);r.current=i;const l=n?.url,m=n?.hls,s=de(k=>{t.mediaRef.current=k,t.connect()},[t]);return X(()=>{if(l)return t.loadSource({url:l,hls:m},r.current)},[t,l,m]),s}function Ye({source:n,sourceOptions:i,...t}){const r=ve(n,i);return d("video",{playsInline:!0,...t,ref:r})}function Ze({source:n,sourceOptions:i,...t}){const r=ve(n,i);return d("audio",{...t,ref:r})}const Se="_shell_qjnah_1",Le="_stage_qjnah_38",Fe="_topBarTitleInfo_qjnah_59",_e="_streamDetails_qjnah_65",Re="_modeTag_qjnah_86",Me="_shellFill_qjnah_122",xe="_shellFullscreen_qjnah_130",Ce="_uiLayer_qjnah_145",Be="_engineStatus_qjnah_156",Ae="_volumeWrap_qjnah_169",De="_volumeSlider_qjnah_175",se={shell:Se,stage:Le,topBarTitleInfo:Fe,streamDetails:_e,modeTag:Re,shellFill:Me,shellFullscreen:xe,uiLayer:Ce,engineStatus:Be,volumeWrap:Ae,volumeSlider:De},Ie=({classes:n,videoRef:i,duration:t,formatTime:r,isScrubbing:l,buffered:m="auto",onSeek:s,onScrubStart:k,onScrubMove:v,onScrubEnd:_,timeLabelRef:E,children:w})=>{const p=x(null),S=x(null),P=x(null),g=x(null),h=x(null),a=x(!1),f=x(l);f.current=l;const b=x({onScrubMove:v,onScrubEnd:_});b.current={onScrubMove:v,onScrubEnd:_};const[A,$]=ae({time:0,position:null});X(()=>{const c=i.current;if(!c)return;const y=C=>{const V=C/t*100||0;p.current?.setAttribute("aria-valuenow",String(Math.round(C))),p.current?.setAttribute("aria-valuetext",`${r(C)} of ${r(t)}`),S.current&&(S.current.style.width=`${V}%`),P.current&&(P.current.style.left=`${V}%`),E?.current&&(E.current.innerText=`${r(C)} / ${r(t)}`)},R=()=>{l||y(c.currentTime)},D=()=>{if(m==="auto"&&c.buffered.length>0){const V=c.buffered.end(c.buffered.length-1)/t*100||0;g.current&&(g.current.style.width=`${V}%`)}};return y(c.currentTime),D(),c.addEventListener("timeupdate",R),c.addEventListener("progress",D),()=>{c.removeEventListener("timeupdate",R),c.removeEventListener("progress",D)}},[i,t,l,m,r,E]);const I=c=>{if(!p.current)return 0;const y=p.current.getBoundingClientRect();return y.width<=0?0:Math.min(1,Math.max(0,(c-y.left)/y.width))},Q=c=>{const y=c*t;p.current?.setAttribute("aria-valuenow",String(Math.round(y))),p.current?.setAttribute("aria-valuetext",`${r(y)} of ${r(t)}`);const R=y/t*100||0;S.current&&(S.current.style.width=`${R}%`),P.current&&(P.current.style.left=`${R}%`),E?.current&&(E.current.innerText=`${r(y)} / ${r(t)}`);const D=p.current?.getBoundingClientRect();$({time:y,position:D?c*D.width:null})};X(()=>{if(!l){h.current=null;return}const c=R=>{if(h.current!==null&&R.pointerId!==h.current||!t)return;const D=I(R.clientX);b.current.onScrubMove(D);const C=D*t;p.current?.setAttribute("aria-valuenow",String(Math.round(C))),p.current?.setAttribute("aria-valuetext",`${r(C)} of ${r(t)}`);const V=C/t*100||0;S.current&&(S.current.style.width=`${V}%`),P.current&&(P.current.style.left=`${V}%`),E?.current&&(E.current.innerText=`${r(C)} / ${r(t)}`);const e=p.current?.getBoundingClientRect();$({time:C,position:e?D*e.width:null})},y=R=>{h.current!==null&&R.pointerId!==h.current||(h.current=null,a.current=!0,R.pointerType!=="mouse"&&$({time:0,position:null}),b.current.onScrubEnd())};return document.addEventListener("pointermove",c),document.addEventListener("pointerup",y),document.addEventListener("pointercancel",y),()=>{document.removeEventListener("pointermove",c),document.removeEventListener("pointerup",y),document.removeEventListener("pointercancel",y)}},[l,t,r,E]);const ne=c=>{if(c.pointerType==="mouse"&&c.button!==0||!i.current||!t)return;c.preventDefault(),h.current=c.pointerId;try{p.current?.setPointerCapture(c.pointerId)}catch{}f.current||(f.current=!0,k());const y=I(c.clientX);v(y),Q(y)},G=c=>{if(!t||f.current||c.pointerType!=="mouse")return;const y=I(c.clientX);$({time:y*t,position:c.clientX-(p.current?.getBoundingClientRect().left??0)})},Z=c=>{if(!(h.current!==null&&c.pointerId!==h.current)&&f.current){h.current=null,a.current=!0,c.pointerType!=="mouse"&&$({time:0,position:null});try{p.current?.hasPointerCapture(c.pointerId)&&p.current.releasePointerCapture(c.pointerId)}catch{}_()}};return d("div",{className:`${n.container} ${l&&n.scrubbing?n.scrubbing:""}`,ref:p,role:"slider","aria-label":"Seek","aria-valuemin":0,"aria-valuemax":Math.round(t||0),"aria-valuenow":Math.round(i.current?.currentTime||0),"aria-disabled":!t,tabIndex:0,onClick:c=>{if(a.current){a.current=!1;return}!i.current||isNaN(t)||t===0||s(I(c.clientX))},onPointerDown:ne,onPointerMove:G,onPointerUp:Z,onPointerCancel:Z,onMouseMove:c=>{if(l||!t)return;const y=I(c.clientX);$({time:y*t,position:c.clientX-(p.current?.getBoundingClientRect().left??0)})},onMouseLeave:()=>{l||$({time:0,position:null})},onKeyDown:c=>{if(!(!i.current||!t)&&((c.key==="Home"||c.key==="End")&&(c.preventDefault(),s(c.key==="Home"?0:1)),c.key==="ArrowRight"||c.key==="ArrowLeft")){c.preventDefault();const y=(c.key==="ArrowRight"?5:-5)/t,R=i.current.currentTime/t||0;s(Math.min(1,Math.max(0,R+y)))}},children:[A.position!==null&&d("div",{className:n.timeBubble,style:{left:A.position},children:r(A.time)}),d("div",{className:n.bar,children:[d("div",{className:n.buffered,ref:g,style:m==="full"?{width:"100%"}:void 0}),d("div",{className:n.watched,ref:S}),d("div",{className:n.thumb,ref:P,onMouseDown:c=>{c.preventDefault(),i.current&&(f.current||k())}}),w]})]})};function re(){try{if(typeof window>"u")return!1;const n=window.matchMedia?.("(pointer: coarse)").matches??!1,t=(navigator.maxTouchPoints??0)>0||"ontouchstart"in window;return n||t}catch{return!1}}function $e(){const[n,i]=ae(re);return X(()=>{i(re());let t=null;const r=()=>i(re());try{t=window.matchMedia("(pointer: coarse)"),t.addEventListener?t.addEventListener("change",r):t.addListener(r)}catch{}return window.addEventListener("touchstart",r,{passive:!0,once:!0}),()=>{try{t&&(t.removeEventListener?t.removeEventListener("change",r):t.removeListener(r))}catch{}window.removeEventListener("touchstart",r)}},[]),n}const Ne=450,qe=({muted:n,volume:i,volumeIcon:t,buttonClassName:r,sliderClassName:l,onToggleMute:m,onVolumeChange:s,onExpandedChange:k})=>{const v=$e(),[_,E]=ae(!1),w=x(null),p=x(!1),S=x(null),P=de(b=>{E(b),k?.(b)},[k]);X(()=>()=>{w.current&&window.clearTimeout(w.current)},[]),X(()=>{if(!_)return;const b=A=>{S.current&&!S.current.contains(A.target)&&P(!1)};return document.addEventListener("pointerdown",b),()=>document.removeEventListener("pointerdown",b)},[_,P]);const g=n?0:i,h=()=>{p.current=!1,w.current&&window.clearTimeout(w.current),w.current=window.setTimeout(()=>{p.current=!0,P(!0)},Ne)},a=()=>{w.current&&(window.clearTimeout(w.current),w.current=null)},f=b=>{if(b.stopPropagation(),p.current){p.current=!1;return}if(v){_?m():P(!0);return}m()};return d("div",{ref:S,className:se.volumeWrap,"data-expanded":_?"true":"false",onContextMenu:b=>b.preventDefault(),children:[d("button",{type:"button",className:r,onClick:f,onPointerDown:h,onPointerUp:a,onPointerLeave:a,onContextMenu:b=>b.preventDefault(),"aria-label":n?"Unmute":"Mute","aria-expanded":_,children:t}),d("input",{type:"range",min:"0",max:"1",step:"0.05",value:g,onChange:b=>s(parseFloat(b.currentTarget.value)),onClick:b=>b.stopPropagation(),onPointerDown:b=>b.stopPropagation(),onContextMenu:b=>b.preventDefault(),className:`${se.volumeSlider} ${l??""}`,style:{"--volume-percent":`${g*100}%`},"aria-label":"Volume"})]})};let ee=null,ie=null;async function je(){return ee||(ie||(ie=Pe(()=>import("./hls-BOLXTnjL.js"),[]).then(n=>(ee=n.default,ee)).catch(()=>null)),ie)}function Ve(n){return n.canPlayType("application/vnd.apple.mpegurl")!==""||n.canPlayType("application/x-mpegURL")!==""}function ue(){return document}function le(n){const i=ue();if(document.fullscreenElement)return document.fullscreenElement;if(i.webkitFullscreenElement)return i.webkitFullscreenElement;const t=n;return t?.webkitDisplayingFullscreen?t:null}function ke(n){return le(n)!==null}async function Ue(n,i){if(le(i))return;const t=n;try{if(typeof n.requestFullscreen=="function"){await n.requestFullscreen();return}if(typeof t.webkitRequestFullscreen=="function"){await t.webkitRequestFullscreen();return}if(typeof t.webkitRequestFullScreen=="function"){await t.webkitRequestFullScreen();return}}catch{}const r=i;if(r&&typeof r.webkitEnterFullscreen=="function"){if(r.webkitSupportsFullscreen===!1)return;try{await r.webkitEnterFullscreen()}catch{}}}async function He(n){const i=ue();try{if(document.fullscreenElement&&typeof document.exitFullscreen=="function"){await document.exitFullscreen();return}if(i.webkitFullscreenElement&&typeof i.webkitExitFullscreen=="function"){await i.webkitExitFullscreen();return}}catch{}const t=n;if(t?.webkitDisplayingFullscreen&&typeof t.webkitExitFullscreen=="function"){try{t.webkitExitFullscreen()}catch{}return}try{typeof i.webkitCancelFullScreen=="function"?i.webkitCancelFullScreen():!document.fullscreenElement&&typeof document.exitFullscreen=="function"&&(document.fullscreenElement??i.webkitFullscreenElement)&&await document.exitFullscreen()}catch{}}async function Ke(n,i){!n&&!i||(ke(i)?await He(i):n&&await Ue(n,i))}function Oe(n,i){const t=()=>{try{i(ke(n()))}catch{}},r=ue(),l=t;r.addEventListener("fullscreenchange",t),r.addEventListener("webkitfullscreenchange",l),r.addEventListener("webkitbeginfullscreen",l,!0),r.addEventListener("webkitendfullscreen",l,!0);const m=n();return m?.addEventListener("webkitbeginfullscreen",l),m?.addEventListener("webkitendfullscreen",l),()=>{r.removeEventListener("fullscreenchange",t),r.removeEventListener("webkitfullscreenchange",l),r.removeEventListener("webkitbeginfullscreen",l,!0),r.removeEventListener("webkitendfullscreen",l,!0),m?.removeEventListener("webkitbeginfullscreen",l),m?.removeEventListener("webkitendfullscreen",l)}}let H=null;function fe(n){try{return n?pe.getItem(n):null}catch{return null}}function Y(n,i){try{n&&pe.setItem(n,String(i))}catch{}}function We(n={}){const i=Number.parseFloat(fe(n.volumeKey)??"");let t={isPlaying:!1,isBuffering:!1,isMuted:fe(n.mutedKey)==="true",volume:Number.isFinite(i)?Math.max(0,Math.min(1,i)):1,duration:0,playbackRate:1,isScrubbing:!1,isFullscreen:!1,showControls:!0,isSpeedBoostActive:!1,audioTracks:[],subtitleTracks:[],qualities:[],activeAudioTrack:-1,activeSubtitleTrack:-1,activeQuality:-1,error:null,playBlocked:!1,playbackLocked:!1},r={currentTime:0,bufferedEnd:0};const l=new Set,m=new Set,s={current:null},k={current:null};let v=null,_=()=>{},E=()=>{},w=0,p=!1,S=1,P=!1,g=null,h=!1;function a(e){Object.entries(e).every(([u,o])=>Object.is(t[u],o))||(t={...t,...e},l.forEach(u=>u()))}function f(e){r.currentTime===e.currentTime&&r.bufferedEnd===e.bufferedEnd||(r=e,m.forEach(u=>u()))}function b(e){if(!e)return;let u=0;for(let o=0;o<e.buffered.length;o++)if(e.buffered.start(o)<=e.currentTime&&e.buffered.end(o)>=e.currentTime){u=e.buffered.end(o);break}f({currentTime:Number.isFinite(e.currentTime)?e.currentTime:0,bufferedEnd:u})}function A(){b(s.current)}function $(){const e=s.current;if(v===e||(v&&(H===v&&(H=e),b(v),E(),v.pause(),v.removeAttribute("src"),v.load()),_(),v=e,!e))return;P=!1,H||(H=e),e.volume=t.volume,e.muted=t.isMuted,e.playbackRate=t.playbackRate;const u=()=>{const T=Array.from(e.textTracks);if(!T.length)return;const U=T.findIndex(W=>W.mode==="showing");a({subtitleTracks:T.map((W,z)=>({id:z,label:W.label||W.language||`Track ${z+1}`,language:W.language})),...U>=0?{activeSubtitleTrack:U}:{}})},o={play:()=>{H=e,a({isPlaying:!0,playBlocked:!1,error:null})},playing:()=>a({isPlaying:!0,isBuffering:!1,playBlocked:!1}),pause:()=>a({isPlaying:!1,isBuffering:!1}),ended:()=>{a({isPlaying:!1,isBuffering:!1}),A()},waiting:()=>{!e.paused&&(e.readyState<3||e.seeking)&&a({isBuffering:!0})},canplay:()=>a({isBuffering:!1}),seeking:()=>{e.paused||a({isBuffering:!0}),A()},seeked:()=>{a({isBuffering:!1}),A()},timeupdate:()=>{A(),!e.paused&&!e.seeking&&a({isBuffering:!1})},progress:A,loadedmetadata:()=>{e.playbackRate=t.playbackRate,a({duration:Number.isFinite(e.duration)?e.duration:0}),u()},durationchange:()=>a({duration:Number.isFinite(e.duration)?e.duration:0}),ratechange:()=>{t.isSpeedBoostActive||(S=e.playbackRate),e.defaultPlaybackRate!==e.playbackRate&&(e.defaultPlaybackRate=e.playbackRate),a({playbackRate:e.playbackRate})},volumechange:()=>{a({volume:e.volume,isMuted:e.muted}),Y(n.volumeKey,e.volume),Y(n.mutedKey,e.muted)},error:()=>a({error:e.error?.message||"Unable to play this source.",isPlaying:!1,isBuffering:!1})};Object.entries(o).forEach(([T,U])=>e.addEventListener(T,U)),e.textTracks.addEventListener("addtrack",u),e.textTracks.addEventListener("removetrack",u),e.textTracks.addEventListener("change",u);const L=()=>e.tagName==="VIDEO"?e:null,O=()=>{const T=le(L());a({isFullscreen:T!==null&&(T===e||T===k.current)})},B=typeof document>"u"?()=>{}:Oe(L,O);typeof document<"u"&&O(),_=()=>{Object.entries(o).forEach(([T,U])=>e.removeEventListener(T,U)),B(),e.textTracks.removeEventListener("addtrack",u),e.textTracks.removeEventListener("removetrack",u),e.textTracks.removeEventListener("change",u)}}async function I(){if(t.playbackLocked&&!h)return!1;const e=s.current;if(!e)return!1;H=e;const u=w;try{return await e.play(),u===w}catch(o){if(u===w){const L=o instanceof Error&&o.name==="NotAllowedError",O=o instanceof Error&&o.name==="AbortError";a({isPlaying:!1,isBuffering:!1,playBlocked:L,...!L&&!O?{error:o instanceof Error?o.message:"Playback failed."}:{}})}return!1}}function Q(){t.playbackLocked&&!h||s.current?.pause()}function ne(){s.current?.paused?I():Q()}function G(e){if(t.playbackLocked&&!h)return;const u=s.current;if(!u||!Number.isFinite(e))return;let o=Math.max(0,e);if(Number.isFinite(u.duration))o=Math.min(u.duration,o);else if(u.seekable.length)for(let L=0;L<u.seekable.length;L++){if(o<=u.seekable.end(L)){o=Math.max(u.seekable.start(L),o);break}L===u.seekable.length-1&&(o=u.seekable.end(L))}u.currentTime=o,A()}function Z(e){G((s.current?.currentTime??r.currentTime)+e)}function c(e){if(!Number.isFinite(e))return;const u=Math.max(0,Math.min(1,e));a({volume:u,isMuted:u===0}),s.current&&(s.current.volume=u,s.current.muted=u===0),Y(n.volumeKey,u),Y(n.mutedKey,u===0)}function y(){const e=!t.isMuted;!e&&t.volume===0&&c(.5),a({isMuted:e}),s.current&&(s.current.muted=e),Y(n.mutedKey,e)}function R(e){if(t.playbackLocked&&!h||!Number.isFinite(e)||e<.25||e>4)return;S=e;const u=t.isSpeedBoostActive?2:e;a({playbackRate:u}),s.current&&(s.current.playbackRate=u)}function D(){t.playbackLocked||t.isScrubbing||(p=!!s.current&&!s.current.paused,a({isScrubbing:!0}),Q())}function C(){t.isScrubbing&&(a({isScrubbing:!1}),p&&I(),p=!1)}function V(e,u={}){E(),$();const o=s.current,L=++w;if(!o)return()=>{};let O=!1,B=null;const T=()=>!O&&w===L&&s.current===o;o.pause(),o.removeAttribute("src"),o.load(),a({duration:0,isPlaying:!1,isBuffering:!0,isScrubbing:!1,error:null,playBlocked:!1,audioTracks:[],subtitleTracks:[],qualities:[],activeAudioTrack:-1,activeSubtitleTrack:-1,activeQuality:-1}),f({currentTime:0,bufferedEnd:0});const U=()=>{T()&&u.initialTime&&u.initialTime>0&&G(u.initialTime)};o.addEventListener("loadedmetadata",U,{once:!0});const W=()=>{T()&&(u.onReady?.(),u.autoPlay&&T()&&I())},z=F=>{if(!T())return;const N=F instanceof Error?F:new Error(String(F));a({error:N.message,isPlaying:!1,isBuffering:!1}),u.onError?.(N)},J=()=>{O||(O=!0,o.removeEventListener("loadedmetadata",U),o.removeEventListener("error",ce),B?.destroy(),g===B&&(g=null),B=null,w===L&&w++)},ce=()=>{z(new Error(o.error?.message||"Unable to play this source.")),J()};return o.addEventListener("error",ce),E=J,(async()=>{if(e.hls){const F=await je();if(!T())return;if(F?.isSupported()){B=new F({enableWorker:!0,startPosition:u.initialTime??-1,...u.hlsConfig}),g=B;const N=B,he=()=>{T()&&a({audioTracks:N.audioTracks.map((M,q)=>({id:q,label:M.name||M.lang||`Track ${q+1}`,language:M.lang})),...o.querySelector("track")?{}:{subtitleTracks:N.subtitleTracks.map((M,q)=>({id:q,label:M.name||M.lang||`Track ${q+1}`,language:M.lang}))},qualities:N.levels.map((M,q)=>({id:q,label:M.height?`${M.height}p`:`${Math.round(M.bitrate/1e3)}k`})),activeAudioTrack:N.audioTrack,...o.querySelector("track")?{}:{activeSubtitleTrack:N.subtitleTrack},activeQuality:N.currentLevel})};for(const M of[F.Events.MANIFEST_PARSED,F.Events.AUDIO_TRACKS_UPDATED,F.Events.AUDIO_TRACK_SWITCHED,F.Events.SUBTITLE_TRACKS_UPDATED,F.Events.SUBTITLE_TRACK_SWITCH,F.Events.LEVEL_SWITCHED])N.on(M,he);if(B.on(F.Events.ERROR,(M,q)=>{q.fatal&&T()&&(z(new Error(`Stream failed (${q.details}). Try another source or reload.`)),J())}),B.once(F.Events.MANIFEST_PARSED,W),u.onHls?.(B,F),!T())return;B.loadSource(e.url),B.attachMedia(o);return}if(!Ve(o))throw new Error("HLS playback is unavailable in this browser.")}T()&&(o.src=e.url,o.load(),W())})().catch(F=>{z(F),J()}),J}return{mediaRef:s,containerRef:k,connect:$,getState:()=>t,getTimeline:()=>r,getHls:()=>g,isActive:()=>H===s.current,subscribe:e=>(l.add(e),()=>{l.delete(e)}),subscribeTimeline:e=>(m.add(e),()=>{m.delete(e)}),play:I,pause:Q,togglePlay:ne,seek:G,seekRelative:Z,setVolume:c,toggleMute:y,setPlaybackRate:R,setPlaybackLocked:e=>a({playbackLocked:e}),applyRemotePlayback:(e,u,o)=>{h=!0;try{e!==void 0&&G(e),Math.abs(t.playbackRate-o)>.001&&R(o),u&&s.current?.paused?I():!u&&!s.current?.paused&&Q()}finally{h=!1}},setAudioTrack:e=>{g&&t.audioTracks.some(u=>u.id===e)&&(g.audioTrack=e,a({activeAudioTrack:e}))},setSubtitleTrack:e=>{if(e!==-1&&!t.subtitleTracks.some(o=>o.id===e))return;const u=s.current;u?.querySelector("track")?Array.from(u.textTracks).forEach((o,L)=>{o.mode=L===e?"showing":"disabled"}):g&&(g.subtitleTrack=e),a({activeSubtitleTrack:e})},setQuality:e=>{g&&(e===-1||t.qualities.some(u=>u.id===e))&&(g.currentLevel=e,a({activeQuality:e}))},setSpeedBoost:e=>{if(t.playbackLocked)return;const u=e?2:S;a({isSpeedBoostActive:e,playbackRate:u}),s.current&&(s.current.playbackRate=u)},setShowControls:e=>a({showControls:e}),startScrubbing:D,endScrubbing:C,loadSource:V,unload:()=>{const e=s.current;b(e),E(),e&&(e.pause(),e.removeAttribute("src"),e.load()),a({isPlaying:!1,isBuffering:!1,duration:0,error:null}),f({currentTime:0,bufferedEnd:0})},toggleFullscreen:()=>{const e=s.current;Ke(k.current,e?.tagName==="VIDEO"?e:null).catch(u=>a({error:u instanceof Error?u.message:"Fullscreen failed."}))},reset:()=>{a({duration:0,isBuffering:!1,error:null}),f({currentTime:0,bufferedEnd:0})},destroy:()=>{if(P)return;P=!0;const e=v??s.current;b(e),_(),v=null,E(),e?.pause(),e?.removeAttribute("src"),e?.load(),H===e&&(H=null)}}}function K(n){return me(n.subscribe,n.getState)}function ge(n){return me(n.subscribeTimeline,n.getTimeline)}function et(n={}){const i=x(n),t=oe(()=>We(i.current),[]);return Te(()=>{t.connect()}),X(()=>()=>t.destroy(),[t]),oe(()=>({engine:t,mediaRef:t.mediaRef}),[t])}function Xe({children:n,...i}){const t=j(),{isPlaying:r,playbackLocked:l}=K(t);return d("button",{type:"button","aria-label":r?"Pause":"Play",...i,disabled:l||i.disabled,onClick:t.togglePlay,children:n??d(te,{name:r?"pause":"play"})})}function tt({seconds:n,children:i,...t}){const r=j(),{playbackLocked:l}=K(r);return d("button",{type:"button","aria-label":`Seek ${n<0?"back":"forward"} ${Math.abs(n)} seconds`,...t,disabled:l||t.disabled,onClick:()=>r.seekRelative(n),children:i??d(te,{name:n<0?"replay-10":"forward-10"})})}function nt(n){const i=j(),{isFullscreen:t}=K(i);return d("button",{type:"button","aria-label":t?"Exit Fullscreen":"Fullscreen",...n,onClick:i.toggleFullscreen,children:d(te,{name:t?"compress":"expand"})})}function rt({buttonClassName:n,onExpandedChange:i}){const t=j(),{isMuted:r,volume:l}=K(t);return d(qe,{muted:r,volume:l,volumeIcon:d(te,{name:r||l===0?"volume-mute":l<.5?"volume-down":"volume-up"}),buttonClassName:n,onToggleMute:t.toggleMute,onVolumeChange:t.setVolume,onExpandedChange:i})}function it({className:n}){const i=j(),{volume:t,isMuted:r}=K(i);return d("input",{type:"range",min:0,max:1,step:.01,value:r?0:t,onChange:l=>i.setVolume(Number(l.currentTarget.value)),className:n,style:{"--volume-percent":`${(r?0:t)*100}%`},"aria-label":"Volume"})}function at({classes:n,timeLabelRef:i,children:t}){const r=j(),{duration:l,isScrubbing:m,playbackLocked:s}=K(r);return d("div",{inert:s||void 0,style:{display:"contents"},children:d(Ie,{classes:n,videoRef:r.mediaRef,duration:l,formatTime:be,isScrubbing:m,onSeek:k=>r.seek(k*l),onScrubStart:r.startScrubbing,onScrubMove:k=>r.seek(k*l),onScrubEnd:r.endScrubbing,timeLabelRef:i,children:t})})}function ut({className:n}){const i=j(),{currentTime:t,bufferedEnd:r}=ge(i),{duration:l,playbackLocked:m}=K(i),s=l?Math.min(100,t/l*100):0,k=l?Math.min(100,Math.max(s,r/l*100)):0;return d("input",{type:"range",disabled:m,min:0,max:l,step:.1,value:Math.min(t,l),onChange:v=>i.seek(Number(v.currentTarget.value)),onPointerDown:v=>{v.currentTarget.setPointerCapture(v.pointerId),i.startScrubbing()},onPointerUp:i.endScrubbing,onPointerCancel:i.endScrubbing,onLostPointerCapture:i.endScrubbing,className:n,style:{"--played-percent":`${s}%`,"--buffered-percent":`${k}%`},"aria-label":"Seek"})}function lt({className:n,durationOnly:i=!1}){const t=j(),{currentTime:r}=ge(t),{duration:l}=K(t);return d("span",{className:n,children:be(i?l:r)})}function ct(){const n=j(),{error:i,playBlocked:t,isBuffering:r,playbackLocked:l}=K(n);return i?d("div",{role:"alert",children:i}):t&&l?d("span",{children:"Enable playback from the watch-along panel."}):t?d(Xe,{children:"Tap to play"}):r?d("div",{role:"status","aria-label":"Buffering",children:"Loading…"}):null}const Qe='input, textarea, button, select, a, [role="button"], [role="slider"], [contenteditable]:not([contenteditable="false"]), [data-player-ui="true"], [data-speed-boost-ignore="true"]';function ot(n,i,t=!0){const r=x(i);r.current=i,X(()=>{if(!t)return;let l=!1,m=!1,s=!1,k,v,_=!1;const E=()=>{const a=m||s;a!==_&&(_=a,n.setSpeedBoost(a))},w=a=>a instanceof Element&&!!a.closest(Qe),p=a=>{if(!n.isActive()||!n.mediaRef.current||a.defaultPrevented||a.ctrlKey||a.metaKey||a.altKey||w(a.target))return;if(a.code==="Space"){if(a.preventDefault(),l)return;l=!0,k=setTimeout(()=>{k=void 0,m=!0,E()},180),r.current();return}const f=a.key.toLowerCase();["k","j","l","arrowleft","arrowright","arrowup","arrowdown","m","f"].includes(f)&&(a.preventDefault(),!(a.repeat&&["k","m","f"].includes(f))&&(f==="k"&&n.togglePlay(),(f==="j"||f==="arrowleft")&&n.seekRelative(-10),(f==="l"||f==="arrowright")&&n.seekRelative(10),f==="arrowup"&&n.setVolume(n.getState().volume+.1),f==="arrowdown"&&n.setVolume(n.getState().volume-.1),f==="m"&&n.toggleMute(),f==="f"&&n.toggleFullscreen(),r.current()))},S=a=>{a.code!=="Space"||!l||(a.preventDefault(),l=!1,clearTimeout(k),k=void 0,m?(m=!1,E()):n.togglePlay(),r.current())},P=a=>{const f=a.target;a.button!==0||!(f instanceof Element)||w(f)||!n.containerRef.current?.contains(f)||(clearTimeout(v),v=setTimeout(()=>{v=void 0,s=!0,E()},180))},g=()=>{clearTimeout(v),v=void 0,s=!1,E()},h=()=>{clearTimeout(k),k=void 0,l=!1,m=!1,g()};return document.addEventListener("keydown",p),document.addEventListener("keyup",S),document.addEventListener("pointerdown",P),document.addEventListener("pointerup",g),document.addEventListener("pointercancel",g),window.addEventListener("blur",h),()=>{document.removeEventListener("keydown",p),document.removeEventListener("keyup",S),document.removeEventListener("pointerdown",P),document.removeEventListener("pointerup",g),document.removeEventListener("pointercancel",g),window.removeEventListener("blur",h),h()}},[n,t])}function st({engine:n,children:i}){return d(ye.Provider,{value:n,children:i})}export{nt as F,at as P,tt as S,it as V,Xe as a,rt as b,Ye as c,st as d,j as e,K as f,ge as g,ot as h,lt as i,ut as j,ct as k,Ze as l,$e as m,ke as n,se as s,et as u};
@@ -1,21 +0,0 @@
1
- import{d as s,u as e,S as ge,A as Z,h as G,q as me,T as Me,p as qe,g as we,_ as ze}from"./vendor-core-DfaOB3Rn.js";import{b as pe,u as te}from"./vendor-query-BBT5_sHx.js";import{N as ee,O as J,P as U,Q as be,B as S,R as Ue,L as K,d as Ke,H as _e,t as C,n as Te,l as Ee,F as Ce,S as X,q as H,U as ke,V as Fe,W as $e,u as He,e as We,X as Be,G as le,p as je,Y as Qe,Z as Ve}from"./index-fS4AGBy2.js";import{I as B}from"./vendor-icons-DrybRNxP.js";import{T as $}from"./ToggleSwitch-CN_ppEc9.js";import{M as Ye}from"./MatureConsentModal-J7mF0tSH.js";const Je="_sectionCard_1vuib_1",Xe="_dangerCard_1vuib_20",Ze="_settingRow_1vuib_31",L={sectionCard:Je,dangerCard:Xe,settingRow:Ze};function et(){const{data:t}=pe(ee),{data:o}=pe({queryKey:["profiles"],queryFn:()=>J("/api/profiles/status"),enabled:!!t?.owner}),c=te(),[g,p]=s(null),[h,k]=s(""),[y,i]=s(""),[r,m]=s(""),[f,d]=s(""),[P,l]=s(""),[v,_]=s(!1),[T,O]=s(null),I=async a=>{_(!0),l("");try{await J("/api/profiles/update",{method:"POST",body:JSON.stringify(a)}),await c.invalidateQueries({queryKey:ee.queryKey}),k(""),i(""),l("Profile saved")}catch(N){l(N.message)}finally{_(!1)}};return t?e("section",{className:L.sectionCard,children:[e("h3",{children:"Your profile"}),e("p",{children:"Keep using this profile, rename it, or add another person with their own library and connections."}),e("div",{className:U.avatarRow,children:[e(be,{image:t.image,name:t.name}),e("label",{className:U.uploadButton,children:[e(B,{name:"upload"}),e("span",{children:"Upload image"}),e("input",{className:U.fileInput,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif",disabled:v,onChange:async a=>{const N=a.currentTarget.files?.[0];if(a.currentTarget.value="",!N)return;if(N.size>2*1024*1024){l("Image must be smaller than 2 MB");return}const R=new FileReader;R.onerror=()=>l("Could not read image"),R.onload=()=>{I({avatar:R.result})},R.readAsDataURL(N)}})]}),t.avatar&&e(S,{variant:"secondary",disabled:v,onClick:()=>I({avatar:null}),children:"Clear uploaded image"})]}),e("p",{children:"Your uploaded image takes priority, followed by your active cloud account image, then the default user icon."}),e("form",{className:U.form,onSubmit:a=>{a.preventDefault(),I({name:g??t.name})},children:[e("label",{className:U.field,children:["Profile name",e("input",{value:g??t.name,maxLength:60,required:!0,onChange:a=>p(a.currentTarget.value)})]}),e(S,{type:"submit",disabled:v,children:"Save name"})]}),e("form",{className:U.form,onSubmit:a=>{a.preventDefault(),I({password:h,currentPassword:y})},children:[t.protected&&e("label",{className:U.field,children:["Current password",e("input",{type:"password",autoComplete:"current-password",value:y,required:!0,maxLength:256,onChange:a=>i(a.currentTarget.value)})]}),e("label",{className:U.field,children:[t.protected?"New password (empty removes protection)":"Protect this profile",e("input",{type:"password",autoComplete:"new-password",value:h,minLength:8,maxLength:256,onChange:a=>k(a.currentTarget.value)})]}),e(S,{type:"submit",disabled:v,children:"Save password"})]}),e(S,{variant:"secondary",disabled:v,onClick:async()=>{_(!0);try{await J("/api/profiles/logout",{method:"POST"}),Ue()}catch(a){l(a.message),_(!1)}},children:"Switch profile / sign out"}),t.owner&&e("form",{className:U.form,onSubmit:async a=>{a.preventDefault(),_(!0),l("");try{await J("/api/profiles/create",{method:"POST",body:JSON.stringify({name:r,password:f})}),m(""),d(""),await c.invalidateQueries({queryKey:["profiles"]}),l("Profile created. Sign out to switch to it.")}catch(N){l(N.message)}finally{_(!1)}},children:[e("h3",{children:"Add another profile"}),e("p",{children:"Protect your owner profile first. New profiles start empty and do not inherit your accounts. A profile without a password is accessible to anyone who passes the LAN lock."}),e("label",{className:U.field,children:["Name",e("input",{required:!0,maxLength:60,value:r,onChange:a=>m(a.currentTarget.value)})]}),e("label",{className:U.field,children:["Password (optional)",e("input",{type:"password",autoComplete:"new-password",minLength:8,maxLength:256,value:f,onChange:a=>d(a.currentTarget.value)})]}),e(S,{type:"submit",disabled:v||!t.protected,children:"Create profile"})]}),t.owner&&o?.profiles.some(a=>!a.owner)&&e(ge,{children:[e("h3",{children:"Other profiles"}),e("ul",{className:U.profileList,children:o.profiles.filter(a=>!a.owner).map(a=>e("li",{children:[e("span",{className:U.smallAvatar,children:e(be,{image:a.avatar??a.cloudAvatar,name:a.name})}),e("span",{className:U.profileName,children:a.name}),e(S,{variant:"danger",size:"sm",disabled:v,onClick:()=>{l(""),O(a)},children:"Delete"})]},a.id))})]}),e(K,{isOpen:!!T,onClose:v?void 0:()=>O(null),title:"Delete profile?",width:"sm",footer:e(ge,{children:[e(S,{variant:"secondary",disabled:v,onClick:()=>O(null),children:"Cancel"}),e(S,{variant:"danger",loading:v,onClick:async()=>{if(T){_(!0);try{await J("/api/profiles/delete",{method:"POST",body:JSON.stringify({id:T.id,confirm:!0})}),await c.invalidateQueries({queryKey:["profiles"]}),O(null),l("Profile deleted. Local files will be removed when Dango restarts.")}catch(a){l(a.message),O(null)}finally{_(!1)}}},children:"Delete profile"})]}),children:[e("p",{children:["Delete ",e("strong",{children:T?.name}),"? This signs them out immediately. Their local libraries, settings and connections will be removed when Dango next restarts."]}),e("p",{children:"Cloud backups and tracker lists will stay intact. Export any library you want to keep before deleting."})]}),P&&e("p",{role:"status",children:P})]}):null}const ce={"title-preference-container":"_title-preference-container_sdqgs_1","toggle-button":"_toggle-button_sdqgs_21","toggle-label":"_toggle-label_sdqgs_51"},de=["name","nativeName","englishName"],ue={name:"Default (Romaji)",nativeName:"Native",englishName:"English"},tt=()=>{const{titlePreference:t,setTitlePreference:o,loading:c}=Ke(),g=_e(),[p,h]=s(ue[t]),[k,y]=s(!1),i=Z(null);G(()=>{c||h(ue[t])},[t,c]);const r=async()=>{if(k)return;y(!0);const f=(de.indexOf(t)+1)%de.length,d=de[f],P=ue[d];i.current&&(i.current.style.transform="translateX(-100%)",i.current.style.opacity="0"),setTimeout(async()=>{h(P),o(d),i.current&&(i.current.style.transition="none",i.current.style.transform="translateX(100%)",i.current.style.opacity="0",i.current.offsetWidth,i.current.style.transition="transform 0.3s ease-out, opacity 0.3s ease-out",i.current.style.transform="translateX(0)",i.current.style.opacity="1");try{await g.mutateAsync({key:"titlePreference",value:d})}catch(l){console.error("Error saving title preference:",l)}finally{y(!1)}},300)};return c?e("p",{children:"Loading title preference..."}):e("div",{className:ce["title-preference-container"],children:[e("h4",{children:"Anime Title Display Preference"}),e("button",{onClick:r,className:ce["toggle-button"],disabled:k,children:e("span",{ref:i,className:ce["toggle-label"],children:p})})]})},at="_settingsHeader_gfwoa_1",nt="_pageTitle_gfwoa_6",rt="_pageSubtitle_gfwoa_14",st="_settingsLayout_gfwoa_20",it="_sidebar_gfwoa_27",ot="_sidebarIndicator_gfwoa_35",lt="_sidebarItem_gfwoa_50",ct="_active_gfwoa_72",dt="_mainContent_gfwoa_80",ut="_tabContent_gfwoa_85",ht="_settingItem_gfwoa_103",gt="_shortcutContainer_gfwoa_108",mt="_shortcutGroup_gfwoa_115",pt="_shortcutGroupTitle_gfwoa_121",ft="_shortcutGrid_gfwoa_130",yt="_shortcutCard_gfwoa_136",vt="_controls_gfwoa_170",wt="_status_gfwoa_176",u={settingsHeader:at,pageTitle:nt,pageSubtitle:rt,settingsLayout:st,sidebar:it,sidebarIndicator:ot,sidebarItem:lt,active:ct,mainContent:dt,tabContent:ut,settingItem:ht,shortcutContainer:gt,shortcutGroup:mt,shortcutGroupTitle:pt,shortcutGrid:ft,shortcutCard:yt,controls:vt,status:wt},bt="_title_tm30b_11",Ct="_signIn_tm30b_18",kt="_userInfo_tm30b_25",St="_warning_tm30b_47",Nt="_formGroup_tm30b_54",_t="_label_tm30b_58",Tt="_inputWrapper_tm30b_68",Lt="_input_tm30b_68",Pt="_select_tm30b_92",It="_actions_tm30b_109",xt="_hr_tm30b_117",w={title:bt,signIn:Ct,userInfo:kt,warning:St,formGroup:Nt,label:_t,inputWrapper:Tt,input:Lt,select:Pt,actions:It,hr:xt},Rt=()=>{const t=te(),[o,c]=s(!0),[g,p]=s(!1),[h,k]=s(!1),[y,i]=s(null),[r,m]=s({status:"idle"}),[f,d]=s(!1),[P,l]=s(""),[v,_]=s(!1),T=Z(null),[O,I]=s({show:!1,message:"",type:"info"}),a=()=>{T.current&&(window.clearInterval(T.current),T.current=null)},N=me(b=>{k(b.authenticated),i(b.user||b.device.user||null),m(b.device),d(!!b.hasCustomClientId)},[]),R=me(async()=>{const b=await C.auth.githubStatus.query();N(b)},[N]),q=async()=>{try{const b=await C.auth.githubPoll.query();m(b),b.status==="success"?(a(),await t.invalidateQueries({queryKey:ee.queryKey}),await R(),I({show:!0,message:"GitHub authentication complete. Sync has been initialized.",type:"success"})):b.status==="error"&&(a(),I({show:!0,message:b.error||"GitHub authentication failed.",type:"error"}))}catch{a(),I({show:!0,message:"Failed to poll GitHub authentication status.",type:"error"})}},x=(b=5)=>{a(),T.current=window.setInterval(q,Math.max(b,5)*1e3)};G(()=>(R().catch(()=>{I({show:!0,message:"Failed to load GitHub sync status.",type:"error"})}).finally(()=>c(!1)),a),[R]);const A=async()=>{p(!0);try{const b=await C.auth.githubStart.mutate();m(b),x(b.verification?.interval)}catch(b){I({show:!0,message:b instanceof Error?b.message:"Failed to start GitHub authentication.",type:"error"})}finally{p(!1)}},M=async()=>{try{await C.auth.githubLogout.mutate(),await t.invalidateQueries({queryKey:ee.queryKey}),k(!1),i(null),m({status:"idle"}),I({show:!0,message:"Signed out of GitHub sync.",type:"success"})}catch{I({show:!0,message:"Failed to sign out of GitHub.",type:"error"})}},j=async()=>{_(!0);try{await C.auth.saveGithubAuth.mutate({clientId:P}),l(""),await R(),I({show:!0,message:"Custom GitHub auth saved.",type:"success"})}catch{I({show:!0,message:"Failed to save override.",type:"error"})}finally{_(!1)}},Q=async()=>{_(!0);try{await C.auth.saveGithubAuth.mutate({clientId:""}),l(""),await R(),I({show:!0,message:"Custom auth cleared. Using dango defaults.",type:"success"})}catch{I({show:!0,message:"Failed to clear override.",type:"error"})}finally{_(!1)}};return o?e("div",{style:{color:"var(--text-secondary)",padding:"1.5rem"},children:"Loading..."}):e("div",{className:L.sectionCard,children:[e("h3",{className:w.title,children:"GitHub Cloud Sync"}),e("p",{className:w.signIn,children:"Sync local data through a private GitHub repository named dango-sync-data."}),h&&y?e("div",{className:w.userInfo,children:[e("p",{children:["Signed in as: ",e("strong",{children:y.name||y.login})]}),e(S,{variant:"danger",onClick:M,children:"Sign Out"})]}):e("div",{className:w.signIn,children:e(S,{onClick:A,disabled:g||r.status==="pending",children:g||r.status==="pending"?"Waiting for GitHub...":"Sign in with GitHub"})}),r.status==="pending"&&r.verification&&e(ge,{children:[e("hr",{className:w.hr}),e("div",{className:w.formGroup,children:[e("label",{className:w.label,children:"Verification URL"}),e("div",{className:w.inputWrapper,children:[e("input",{className:w.input,value:r.verification.verification_uri,readOnly:!0}),e(S,{onClick:()=>{const b=r.verification?.verification_uri;b&&/^https?:\/\//i.test(b)&&window.open(b,"_blank","noopener,noreferrer")},children:"Open"})]})]}),e("div",{className:w.formGroup,children:[e("label",{className:w.label,children:"Device Code"}),e("input",{className:w.input,value:r.verification.user_code,readOnly:!0})]})]}),r.status==="error"&&e("p",{className:w.warning,children:r.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 ",f?"(override active)":""]}),e("div",{className:w.formGroup,style:{marginTop:"0.75rem"},children:[e("label",{className:w.label,children:"Client ID (optional)"}),e("input",{className:w.input,value:P,onChange:b=>l(b.currentTarget.value),placeholder:"Your GitHub OAuth app ID"})]}),e("div",{className:w.actions,children:[e(S,{onClick:j,disabled:v,children:"Save override"}),e(S,{variant:"secondary",onClick:Q,disabled:v,children:"Use dango defaults"})]})]}),e(K,{isOpen:O.show,onClose:()=>I(b=>({...b,show:!1})),width:"sm",children:[e(K.Body,{children:e("p",{children:O.message})}),e(K.Actions,{children:e(S,{onClick:()=>I(b=>({...b,show:!1})),children:"OK"})})]})]})},Dt=()=>{const[t,o]=s(!0),[c,g]=s(null),[p,h]=s(!1),[k,y]=s(!1),[i,r]=s(""),[m,f]=s(""),[d,P]=s(""),[l,v]=s(!1),[_,T]=s({show:!1,message:"",type:"info"}),O=async()=>{try{const A=await C.auth.user.query();g(A?.email?A:null)}catch{g(null)}},I=async()=>{try{const[x,A]=await Promise.all([C.auth.configStatus.query(),C.auth.googleAuth.query()]);h(!!x.hasConfig),y(!!(A.hasCustomWorkerUrl||A.hasCustomClientId||A.hasClientSecret))}catch(x){console.error("Failed to fetch config status",x)}};G(()=>{(async()=>{o(!0),await Promise.all([O(),I()]);try{new URLSearchParams(window.location.search).get("google_auth")==="success"&&(await O(),window.history.replaceState(null,"",window.location.pathname))}catch{}o(!1)})();const A=M=>{M.origin===window.location.origin&&typeof M.data=="object"&&M.data!==null&&M.data.type==="GOOGLE_AUTH_SUCCESS"&&(g(M.data.user),window.location.reload())};return window.addEventListener("message",A),()=>window.removeEventListener("message",A)},[]);const a=async()=>{try{const x=await C.auth.googleLogin.mutate();if(x.authenticated){window.location.reload();return}if(x.url){if(typeof window.DangoBridge<"u"){window.location.href=x.url;return}const M=600,j=700,Q=window.innerWidth/2-M/2,b=window.innerHeight/2-j/2;window.open(x.url,"GoogleAuth",`width=${M},height=${j},top=${b},left=${Q}`)}else throw new Error("Auth URL not available")}catch{T({show:!0,message:"Authentication failed. Ensure server is configured correctly.",type:"error"})}},N=async()=>{try{await C.auth.logout.mutate(),g(null),T({show:!0,message:"Successfully signed out.",type:"success"}),window.location.reload()}catch(x){console.error("Sign out failed",x),T({show:!0,message:"Failed to sign out.",type:"error"})}},R=async()=>{v(!0);try{await C.auth.saveGoogleAuth.mutate({workerUrl:i,clientId:m,clientSecret:d}),r(""),f(""),P(""),await I(),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{v(!1)}},q=async()=>{v(!0);try{await C.auth.saveGoogleAuth.mutate({workerUrl:"",clientId:"",clientSecret:""}),r(""),f(""),P(""),await I(),T({show:!0,message:"Custom auth cleared. Using dango defaults.",type:"success"})}catch{T({show:!0,message:"Failed to clear override.",type:"error"})}finally{v(!1)}};return t?e("div",{style:{color:"var(--text-secondary)",padding:"1.5rem"},children:"Loading..."}):e("div",{className:L.sectionCard,children:[e("h3",{className:w.title,children:"Google Drive Sync"}),c?e("div",{className:w.userInfo,children:[e("p",{children:["Signed in as: ",e("strong",{children:c.name})," (",c.email,")"]}),e(S,{variant:"danger",onClick:N,children:"Sign Out"})]}):e("div",{className:w.signIn,children:[e("p",{children:"Sign in with your Google account to enable synchronization features."}),e(S,{onClick:a,disabled:!p,children:"Sign in with Google"}),!p&&e("p",{className:w.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 ",k?"(override active)":""]}),e("div",{className:w.formGroup,style:{marginTop:"0.75rem"},children:[e("label",{className:w.label,children:"Worker URL (optional)"}),e("input",{className:w.input,value:i,onChange:x=>r(x.currentTarget.value),placeholder:"https://your-worker.workers.dev"})]}),e("div",{className:w.formGroup,children:[e("label",{className:w.label,children:"Client ID (optional)"}),e("input",{className:w.input,value:m,onChange:x=>f(x.currentTarget.value),placeholder:"Your Google OAuth client ID"})]}),e("div",{className:w.formGroup,children:[e("label",{className:w.label,children:"Client Secret (optional)"}),e("input",{type:"password",className:w.input,value:d,onChange:x=>P(x.currentTarget.value),placeholder:"Your Google OAuth secret"})]}),e("div",{className:w.actions,children:[e(S,{onClick:R,disabled:l,children:"Save override"}),e(S,{variant:"secondary",onClick:q,disabled:l,children:"Use dango defaults"})]})]}),e(K,{isOpen:_.show,onClose:()=>T(x=>({...x,show:!1})),width:"sm",children:[e(K.Body,{children:e("p",{children:_.message})}),e(K.Actions,{children:e(S,{onClick:()=>T(x=>({...x,show:!1})),children:"OK"})})]})]})},At="_settingItem_3qq0n_1",Ot="_modalOverlay_3qq0n_6",Gt="_modal_3qq0n_6",Mt="_modalActions_3qq0n_41",qt="_modalSecondary_3qq0n_47",zt="_modalPrimary_3qq0n_57",W={settingItem:At,modalOverlay:Ot,modal:Gt,modalActions:Mt,modalSecondary:qt,modalPrimary:zt},Ut={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"]]}},Kt=(t,o)=>{if(t==null)return o;const c=String(t);return c==="true"||c==="1"?!0:c==="false"||c==="0"?!1:o},Se=(t,o,c)=>{const[g,p]=s(o),[h,k]=s(!1),y=te();return G(()=>{(async()=>{try{const m=await C.settings.getByKey.query({key:t});p(Kt(m.value,o))}catch(m){console.error("Failed to fetch setting",m)}})()},[t,o]),{value:g,setValue:p,isUpdating:h,toggle:async()=>{if(h)return;k(!0);const r=!g;p(r);try{await C.settings.set.mutate({key:t,value:r});for(const m of c)y.invalidateQueries({queryKey:m})}catch(m){console.error("Error saving setting:",m),p(!r)}finally{k(!1)}}}},Et=()=>{const{contentType:t}=Te(),o=Ut[t],[c,g]=s(!1),[p,h]=s(!0),[k,y]=s(!1),i=Se(o.ignoreKey,!0,o.invalidateKeys),r=Se(o.listOnlyKey,!1,o.invalidateKeys),[m,f]=s(null),[d,P]=s(!1),l=te(),v=Ee();G(()=>{h(!0),(async()=>{try{const N=await C.settings.getByKey.query({key:o.skipKey});String(N.value)==="true"||String(N.value)==="1"?g(!0):g(!1)}catch(N){console.error("Failed to fetch setting",N)}finally{h(!1)}})()},[o.skipKey]);const _=async()=>{if(k)return;y(!0);const a=!c;g(a);try{await C.settings.set.mutate({key:o.skipKey,value:a})}catch(N){console.error("Error saving setting:",N),g(!a)}finally{y(!1)}},T=async()=>{if(!i.isUpdating){if(i.value)try{let a;if(t==="anime"?a=(await C.continueWatching.adultCount.query()).count:t==="manga"?a=(await C.mangaProgress.adultCount.query()).count:t==="asmr"?a=(await C.asmrProgress.adultCount.query()).count:a=(await C.tvProgress.adultCount.query()).count,typeof a=="number"&&a>0){f(a);return}}catch(a){console.error("Failed to fetch adult count",a)}i.toggle()}},O=()=>{f(null),i.toggle()},I=async()=>{if(!d){P(!0);try{let a;t==="anime"?a=(await C.continueWatching.purgeAdult.mutate()).removed:t==="manga"?a=(await C.mangaProgress.purgeAdult.mutate()).removed:t==="asmr"?a=(await C.asmrProgress.purgeAdult.mutate()).removed:a=(await C.tvProgress.purgeAdult.mutate()).removed,Ce.success(o.purgeDoneText(a??0));for(const N of o.invalidateKeys)l.invalidateQueries({queryKey:N});t==="anime"&&l.invalidateQueries(v.continueWatching.pathFilter()),t==="manga"&&l.invalidateQueries(v.mangaProgress.pathFilter()),t==="asmr"&&l.invalidateQueries(v.asmrProgress.pathFilter()),t==="tv"&&l.invalidateQueries(v.tvProgress.pathFilter())}catch(a){console.error("Failed to purge adult entries",a),Ce.error("Failed to remove adult entries")}finally{P(!1),f(null)}i.toggle()}};return p?e("div",{children:"Loading settings..."}):e("div",{className:L.sectionCard,children:[e("h3",{children:o.heading}),e("p",{children:o.blurb}),e("div",{className:W.settingItem,children:e("div",{className:L.settingRow,children:[e("label",{htmlFor:"skip-confirmation-toggle",children:o.skipLabel}),e($,{isChecked:c,onChange:_,id:"skip-confirmation-toggle",disabled:k})]})}),e("div",{className:W.settingItem,children:e("div",{className:L.settingRow,children:[e("label",{htmlFor:"ignore-adult-toggle",children:o.ignoreLabel}),e($,{isChecked:i.value,onChange:T,id:"ignore-adult-toggle",disabled:i.isUpdating})]})}),e("div",{className:W.settingItem,children:e("div",{className:L.settingRow,children:[e("label",{htmlFor:"cw-watchlist-only-toggle",children:o.listOnlyLabel}),e($,{isChecked:r.value,onChange:r.toggle,id:"cw-watchlist-only-toggle",disabled:r.isUpdating})]})}),m!==null&&e("div",{className:W.modalOverlay,onClick:()=>f(null),children:e("div",{className:W.modal,onClick:a=>a.stopPropagation(),children:[e("h4",{children:"Show adult entries?"}),e("p",{children:[m," adult ",m===1?"entry":"entries"," not in your"," ",o.listNoun," ",m===1?"is":"are"," currently hidden from"," ",o.continueNoun,". You can purge ",m===1?"it":"them"," from the database instead of showing ",m===1?"it":"them","."]}),e("div",{className:W.modalActions,children:[e("button",{type:"button",className:W.modalSecondary,onClick:O,disabled:d,children:"Show them"}),e("button",{type:"button",className:W.modalPrimary,onClick:I,disabled:d,children:d?"Purging...":`Purge ${m}`})]})]})})]})},Ft="_statsGrid_o4nf0_1",$t="_statCard_o4nf0_8",Ht="_statLabel_o4nf0_18",Wt="_statValue_o4nf0_26",Bt="_statMeta_o4nf0_32",jt="_statusBanner_o4nf0_38",Qt="_statusSuccess_o4nf0_49",Vt="_statusUpdating_o4nf0_55",Yt="_statusError_o4nf0_61",Jt="_sha_o4nf0_67",Xt="_settingItem_o4nf0_74",Zt="_settingTitle_o4nf0_79",ea="_settingSubtitle_o4nf0_85",ta="_actionsRow_o4nf0_92",D={statsGrid:Ft,statCard:$t,statLabel:Ht,statValue:Wt,statMeta:Bt,statusBanner:jt,statusSuccess:Qt,statusUpdating:Vt,statusError:Yt,sha:Jt,settingItem:Xt,settingTitle:Zt,settingSubtitle:ea,actionsRow:ta},aa=()=>{const[t,o]=s(null),[c,g]=s(!0),[p,h]=s(!1),[k,y]=s(!1),i=Z(null),r=async()=>{try{const l=await C.settings.offlineDbInfo.query();return o(l),l}catch(l){console.error("Failed to fetch offline DB info:",l)}finally{g(!1)}return null};G(()=>(r(),()=>{i.current&&window.clearInterval(i.current)}),[]),G(()=>{t?.isRefreshing?i.current||(i.current=window.setInterval(async()=>{const l=await r();l&&!l.isRefreshing&&i.current&&(window.clearInterval(i.current),i.current=null)},2e3)):i.current&&(window.clearInterval(i.current),i.current=null)},[t?.isRefreshing]);const m=async()=>{if(!t||p)return;const l=!t.autoUpdateEnabled;h(!0),o({...t,autoUpdateEnabled:l});try{await C.settings.setOfflineDbAutoUpdate.mutate({enabled:l})}catch(v){console.error("Failed to update auto update setting:",v),o({...t,autoUpdateEnabled:!l})}finally{h(!1)}},f=async()=>{if(!(t?.isRefreshing||k)){y(!0);try{await C.settings.triggerOfflineDbUpdate.mutate(),o(l=>l?{...l,isRefreshing:!0,lastStatus:"updating",lastMessage:"Downloading database..."}:null)}catch(l){console.error("Failed to trigger offline DB update:",l)}finally{y(!1)}}},d=l=>{if(!l)return"Never";try{return new Date(l).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}catch{return l}},P=t?.isRefreshing||k;return e("div",{className:L.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:D.statsGrid,children:[e("div",{className:D.statCard,children:[e("span",{className:D.statLabel,children:"MAL Mapped"}),e("span",{className:D.statValue,children:c?"-":(t?.totalMalMapped??0).toLocaleString()})]}),e("div",{className:D.statCard,children:[e("span",{className:D.statLabel,children:"Release"}),e("span",{className:D.statMeta,children:c?"-":t?.releaseTag??"Never"})]}),e("div",{className:D.statCard,children:[e("span",{className:D.statLabel,children:"Last Checked"}),e("span",{className:D.statMeta,children:c?"-":d(t?.lastCheckedAt??null)})]}),e("div",{className:D.statCard,children:[e("span",{className:D.statLabel,children:"Last Updated"}),e("span",{className:D.statMeta,children:c?"-":d(t?.lastUpdatedAt??null)})]})]}),t?.lastMessage&&e("div",{className:`${D.statusBanner} ${t.lastStatus==="failed"?D.statusError:t.lastStatus==="updating"?D.statusUpdating:D.statusSuccess}`,children:[e("span",{children:t.lastMessage}),t.contentSha256&&e("span",{className:D.sha,children:["sha:",t.contentSha256.slice(0,12)]})]}),e("div",{className:D.settingItem,children:e("div",{className:L.settingRow,children:[e("div",{children:[e("span",{className:D.settingTitle,children:"Weekly Automatic Updates (Saturdays)"}),e("div",{className:D.settingSubtitle,children:"Download and index new database releases in the background. Catches up on startup if the server was offline."})]}),e($,{id:"offline-db-auto-update-toggle",isChecked:t?t.autoUpdateEnabled:!0,onChange:m,disabled:c||p})]})}),e("div",{className:D.actionsRow,children:e(S,{onClick:f,disabled:c||P,children:P?"Updating Database...":"Update Offline Database Now"})})]})},na="_status_1wbo0_1",ra="_warningText_1wbo0_7",sa="_ackLabel_1wbo0_11",he={status:na,warningText:ra,ackLabel:sa},ia=()=>{const t=te(),[o,c]=s(!1),[g,p]=s(!1),[h,k]=s(!1),[y,i]=s(""),r=()=>{p(!1),i(""),c(!0)},m=()=>{h||(c(!1),p(!1))},f=async()=>{if(!(!g||h)){k(!0),i("");try{const d=await X("/api/database/clear",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({confirm:!0})}),P=await d.json();if(!d.ok)throw new Error(P.error||"Failed to clear database");const l=P.deleted,v=P.deletedManga,_=P.deletedTv,T=P.deletedAsmr,O=Object.values(l).reduce((R,q)=>R+(q||0),0)+Object.values(v??{}).reduce((R,q)=>R+(q||0),0)+Object.values(_??{}).reduce((R,q)=>R+(q||0),0)+Object.values(T??{}).reduce((R,q)=>R+(q||0),0),I=(v?.manga_library??0)+(v?.manga_progress??0),a=(_?.tv_library??0)+(_?.tv_progress??0),N=(T?.asmr_library??0)+(T?.asmr_progress??0);i(`Library cleared - ${l.watchlist??0} watchlist entries, ${I} manga rows, ${a} TV rows, ${N} ASMR rows and ${O} total rows removed.`),t.invalidateQueries({queryKey:[H.watchlist]}),t.invalidateQueries({queryKey:[H.continueWatching]}),t.invalidateQueries({queryKey:[H.mangaLibrary]}),t.invalidateQueries({queryKey:[H.mangaContinueReading]}),t.invalidateQueries({queryKey:[H.tvLibrary]}),t.invalidateQueries({queryKey:[H.tvContinueWatching]}),t.invalidateQueries({queryKey:[H.asmrLibrary]}),t.invalidateQueries({queryKey:[H.asmrContinueListening]}),c(!1)}catch(d){i(d.message)}finally{k(!1),p(!1)}}};return e("div",{className:`${L.sectionCard} ${L.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(S,{variant:"danger",onClick:r,children:"Clear Library Data"}),y&&e("p",{className:he.status,children:y}),e(K,{isOpen:o,onClose:m,title:"Clear library data?",width:"sm",children:[e(K.Body,{children:[e("p",{className:he.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:he.ackLabel,children:[e("input",{type:"checkbox",checked:g,onChange:d=>p(d.currentTarget.checked),disabled:h}),e("span",{children:"I understand this permanently deletes my library"})]})]}),e(K.Actions,{children:[e(S,{variant:"secondary",onClick:m,disabled:h,children:"Cancel"}),e(S,{variant:"danger",onClick:f,disabled:!g||h,children:h?"Clearing...":"Yes, delete everything"})]})]})]})},oa=()=>{const[t,o]=s(""),[c,g]=s([]),[p,h]=s(null),[k,y]=s(!0),[i,r]=s({show:!1,message:"",type:"info"}),m=async()=>{try{y(!0);const d=await C.auth.rcloneSettings.query();o(d.remote||""),g(d.availableRemotes||[]),h(d.activeRemote||null)}catch(d){console.error("Failed to fetch Rclone settings",d)}finally{y(!1)}};G(()=>{m()},[]);const f=async()=>{try{await C.auth.saveRclone.mutate({remote:t}),r({show:!0,message:"Rclone configuration saved successfully. You must restart the server for these changes to take effect.",type:"success"}),m()}catch{r({show:!0,message:"Failed to save Rclone configuration.",type:"error"})}};return k?e("div",{style:{color:"var(--text-secondary)",padding:"1.5rem"},children:"Loading..."}):e("div",{className:L.sectionCard,children:[e("h3",{className:w.title,children:"Rclone Cloud Sync"}),e("p",{className:w.signIn,children:"Configure which Rclone remote to use for database synchronization."}),p?e("div",{className:w.userInfo,children:e("p",{children:["Current Active Remote: ",e("strong",{children:p})]})}):e("p",{className:w.warning,style:{marginBottom:"1.5rem"},children:"Rclone sync is not currently active. Ensure rclone is installed and a remote is configured."}),e("div",{className:w.formGroup,children:[e("label",{className:w.label,children:"Remote Name"}),e("div",{className:w.inputWrapper,children:e("select",{className:w.select,value:t,onChange:d=>o(d.currentTarget.value),children:[e("option",{value:"",children:"(Disabled / None)"}),c.map(d=>e("option",{value:d,children:d},d)),t&&!c.includes(t)&&e("option",{value:t,children:[t," (Manual)"]})]})}),e("p",{className:w.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:w.actions,children:e(S,{onClick:f,children:"Save Rclone Settings"})}),e(K,{isOpen:i.show,onClose:()=>r(d=>({...d,show:!1})),width:"sm",children:[e(K.Body,{children:e("p",{children:i.message})}),e(K.Actions,{children:e(S,{onClick:()=>r(d=>({...d,show:!1})),children:"OK"})})]})]})},la=()=>{const t=te(),[o,c]=s(null),[g,p]=s(!0),h=async()=>{try{const r=await C.auth.syncSettings.query();c(r)}catch(r){console.error("Failed to fetch sync settings",r)}finally{p(!1)}};G(()=>{h()},[]);const k=async r=>{const m=r.currentTarget.value;try{const f=await C.auth.saveSyncProvider.mutate({provider:m});c(d=>d?{...d,activeProvider:f.activeProvider}:null),await h(),await t.invalidateQueries({queryKey:ee.queryKey}),ke.success(`Sync provider updated to ${m==="default"?"Default Order":m}`)}catch{ke.error("Failed to update sync provider")}};if(g||!o)return null;const y=[{value:"default",label:"Default (Priority Based)"}];o.authenticatedProviders.github&&y.push({value:"github",label:"GitHub"}),o.authenticatedProviders.google&&y.push({value:"google",label:"Google Drive"}),o.authenticatedProviders.rclone&&y.push({value:"rclone",label:"Rclone"}),y.push({value:"none",label:"None (Local Only)"});const i=r=>r==="none"?"Local Only (No Sync)":r==="google"?"Google Drive":r==="github"?"GitHub":r==="rclone"?"Rclone":r;return e("div",{className:L.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:i(o.actualActiveProvider)})]}),e("div",{className:L.settingRow,children:[e("label",{htmlFor:"sync-provider-select",children:"Selected Preference"}),e("select",{id:"sync-provider-select",value:o.activeProvider,onChange:k,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:y.map(r=>e("option",{value:r.value,children:r.label},r.value))})]})]})};function ca(){return"javascript:"+encodeURIComponent(`(function(){
2
- if(!/(^|\\.)discord\\.com$/.test(location.hostname)){alert('Dango: use this bookmarklet while on discord.com');return}
3
- var t=null;
4
- try{
5
- window.webpackChunkdiscord_app.push([[Symbol()],{},function(req){
6
- if(!req.c)return;
7
- var ms=Object.values(req.c);
8
- for(var i=0;i<ms.length;i++){var m=ms[i];
9
- try{
10
- if(!m.exports||m.exports===window)continue;
11
- if(typeof m.exports.getToken==='function'){var x=m.exports.getToken();if(x){t=x;return}}
12
- for(var k in m.exports){try{var ex=m.exports[k];if(ex&&typeof ex.getToken==='function'&&ex[Symbol.toStringTag]!=='IntlMessagesProxy'){var y=ex.getToken();if(y){t=y;return}}}catch(e1){}}
13
- }catch(e2){}}
14
- }]);
15
- window.webpackChunkdiscord_app.pop();
16
- }catch(e3){}
17
- if(!t){alert('Dango: could not grab your token. Make sure you are logged in to Discord in this tab, then run the bookmarklet again.');return}
18
- function copyFallback(){var a=document.createElement('textarea');a.value=t;a.style.position='fixed';a.style.opacity='0';document.body.appendChild(a);a.select();try{document.execCommand('copy')}catch(e4){}document.body.removeChild(a)}
19
- var done=function(){window.close();setTimeout(function(){if(!window.closed){alert('Dango: token copied to clipboard! Could not close this tab, so just close it, go back to Dango Settings, paste the token and press Save.')}},250)};
20
- if(navigator.clipboard&&navigator.clipboard.writeText){navigator.clipboard.writeText(t).then(done,function(){copyFallback();done()})}else{copyFallback();done()}
21
- })()`)}const da=()=>{const t=Me(ca,[]);return e("div",{style:{marginTop:"0.9rem",paddingTop:"0.9rem",borderTop:"1px dashed var(--border-color)"},children:[e("h4",{style:{margin:"0 0 0.35rem",fontSize:"0.95rem"},children:"Grab the token automatically (bookmarklet)"}),e("p",{style:{margin:"0 0 0.6rem",fontSize:"0.85rem",color:"var(--text-secondary)"},children:"Set this up once and you never have to dig through DevTools: the bookmarklet copies your Discord token to the clipboard and closes the Discord tab - then you just paste it above and press Save."}),e("ol",{style:{margin:"0 0 0.75rem",paddingLeft:"1.25rem",fontSize:"0.85rem",color:"var(--text-secondary)",display:"grid",gap:"0.3rem"},children:[e("li",{children:["Drag the ",e("strong",{style:{color:"var(--text-primary)"},children:"Dango Token Grabber"})," ","button below onto your bookmarks bar (press ",e("kbd",{children:"Ctrl"}),"+",e("kbd",{children:"Shift"}),"+",e("kbd",{children:"B"})," ","first if the bar is hidden)."]}),e("li",{children:["Click ",e("strong",{style:{color:"var(--text-primary)"},children:"Open Discord"})," and log in (skip this if you are already logged in)."]}),e("li",{children:["On the Discord tab, click the"," ",e("strong",{style:{color:"var(--text-primary)"},children:"Dango Token Grabber"})," bookmark. The token lands in your clipboard and the tab closes on its own - come back here, paste it above and press ",e("strong",{children:"Save"}),"."]})]}),e("div",{style:{display:"flex",gap:"0.5rem",alignItems:"center",flexWrap:"wrap"},children:[e("a",{href:t,onClick:g=>{g.preventDefault(),alert("Drag this button onto your bookmarks bar instead of clicking it, then click it while you are on discord.com.")},title:"Drag me to your bookmarks bar",draggable:!0,style:{display:"inline-flex",alignItems:"center",padding:"0.4rem 0.8rem",borderRadius:"999px",border:"1px dashed var(--accent)",background:"var(--bg-secondary)",color:"var(--text-primary)",fontSize:"0.85rem",textDecoration:"none",cursor:"grab",userSelect:"none"},children:[e(B,{name:"bookmark",style:{marginRight:"0.45rem",color:"var(--accent)"}}),"Dango Token Grabber"]}),e("a",{className:"btn btn-secondary btn-sm",href:"https://discord.com/channels/@me",target:"_blank",rel:"noopener noreferrer",children:"Open Discord"}),e(S,{variant:"ghost",size:"sm",onClick:async()=>{try{await navigator.clipboard.writeText(t),alert('Bookmarklet code copied. Create a new bookmark on your bookmarks bar, name it "Dango Token" and paste the code as its URL.')}catch{alert(`Could not copy automatically. Right-click the "Dango Token Grabber" button and choose "Copy link address" instead, then paste that into a new bookmark's URL.`)}},children:"Copy code"})]}),e("p",{style:{margin:"0.5rem 0 0",fontSize:"0.75rem",color:"var(--text-tertiary)"},children:`"Copy code" is a fallback for browsers that won't drag bookmarklets: create any bookmark, then paste the copied code as its URL.`})]})},ua="_settingItem_68mz3_1",ha="_field_68mz3_6",ga="_input_68mz3_19",ma="_actions_68mz3_39",pa="_status_68mz3_45",E={settingItem:ua,field:ha,input:ga,actions:ma,status:pa},fa=()=>{const[t,o]=s(!1),[c,g]=s(""),[p,h]=s(""),[k,y]=s(!0),[i,r]=s(!1),[m,f]=s("");G(()=>{(async()=>{try{const T=await(await X("/api/auth/app-status")).json();o(T.hasPassword)}catch{console.error("Failed to fetch LAN auth status")}finally{y(!1)}})()},[]);const d=async()=>{if(f(""),c!==p){f("Passwords do not match");return}if(c.length<4){f("Password must be at least 4 characters");return}r(!0);try{const v=await X("/api/auth/app-setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:c})}),_=await v.json();if(!v.ok){f(_.error||"Failed to update password");return}o(_.hasPassword),g(""),h(""),f(_.hasPassword?"Password set successfully":"Password removed")}catch{f("Network error")}finally{r(!1)}},P=async()=>{r(!0);try{const v=await X("/api/auth/app-setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:""})}),_=await v.json();if(!v.ok){f(_.error||"Failed to remove password");return}o(!1),g(""),h(""),f("Password removed")}catch{f("Network error")}finally{r(!1)}},l=async()=>{r(!0);try{await X("/api/auth/app-logout",{method:"POST"}),f("Logged out"),window.location.reload()}catch{f("Logout failed")}finally{r(!1)}};return k?e("div",{className:L.sectionCard,children:e("p",{children:"Loading..."})}):e("div",{className:L.sectionCard,children:[e("h3",{children:"LAN Lock"}),e("p",{children:"Require a password to access this instance from any device, including this one. Sessions persist across server restarts until logout or password change."}),e("div",{className:E.settingItem,children:[e("div",{className:E.field,children:[e("label",{htmlFor:"lan-password",children:"New Password"}),e("input",{id:"lan-password",type:"password",value:c,onChange:v=>g(v.currentTarget.value),placeholder:t?"Leave empty to keep current password":"Enter a password...",className:E.input})]}),e("div",{className:E.field,children:[e("label",{htmlFor:"lan-confirm-password",children:"Confirm Password"}),e("input",{id:"lan-confirm-password",type:"password",value:p,onChange:v=>h(v.currentTarget.value),placeholder:"Confirm password...",className:E.input})]}),e("div",{className:E.actions,children:[e(S,{variant:"primary",onClick:d,loading:i,disabled:i,children:t?"Update Password":"Set Password"}),t&&e(S,{variant:"danger",onClick:l,loading:i,disabled:i,children:"Logout"}),t&&e(S,{variant:"secondary",onClick:P,loading:i,disabled:i,children:"Remove Password"})]}),m&&e("p",{className:E.status,children:m})]})]})},ya=()=>{const[t,o]=s(""),[c,g]=s(!0),[p,h]=s(!1),[k,y]=s("");G(()=>{J("/api/auth/app-status").then(r=>o(String(r.port??3e3))).catch(()=>y("Failed to load current port")).finally(()=>g(!1))},[]);const i=async()=>{const r=Number(t);if(!Number.isInteger(r)||r<1||r>65535){y("Enter a port between 1 and 65535");return}h(!0),y("");try{await C.auth.setServerPort.mutate({port:r}),y(`Saved. Restart dango, then open http://localhost:${r} - this overrides the PORT environment variable.`)}catch(m){y(m.message)}finally{h(!1)}};return c?e("div",{className:L.sectionCard,children:e("p",{children:"Loading..."})}):e("div",{className:L.sectionCard,children:[e("h3",{children:"Server Port"}),e("p",{children:"Port the backend listens on. Takes effect after a restart. Google and AniList sign-in need the matching redirect URI registered with the provider."}),e("div",{className:E.settingItem,children:[e("div",{className:E.field,children:[e("label",{htmlFor:"server-port",children:"Port"}),e("input",{id:"server-port",type:"number",min:1,max:65535,value:t,onChange:r=>o(r.currentTarget.value),className:E.input})]}),e("div",{className:E.actions,children:e(S,{variant:"primary",onClick:i,loading:p,disabled:p,children:"Save Port"})}),k&&e("p",{className:E.status,children:k})]})]})},va=()=>{const{theme:t,setTheme:o,loading:c}=Fe();return e("div",{children:[e("h4",{style:{margin:"0 0 0.25rem",fontSize:"1rem"},children:"Palette"}),e("p",{style:{margin:"0 0 0.75rem",fontSize:"0.85rem",color:"var(--text-secondary)"},children:"Taro is the default. Pick a palette that suits you."}),e("div",{role:"radiogroup","aria-label":"Palette",style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(150px, 1fr))",gap:"0.6rem"},children:$e.map(g=>{const p=t===g.id;return e("button",{role:"radio","aria-checked":p,disabled:c,onClick:()=>o(g.id),style:{display:"flex",gap:"0.6rem",alignItems:"center",textAlign:"left",padding:"0.65rem 0.75rem",borderRadius:"10px",cursor:"pointer",background:p?"var(--accent-subtle)":"var(--bg-tertiary)",border:p?"1px solid var(--accent)":"1px solid var(--border-primary)",color:"var(--text-primary)"},children:[e("span",{"aria-hidden":!0,style:{width:26,height:26,borderRadius:"50%",flex:"none",background:g.swatch,border:"1px solid rgba(0,0,0,0.35)"}}),e("span",{style:{minWidth:0},children:[e("span",{style:{display:"block",fontSize:"0.85rem",fontWeight:700},children:g.label}),e("span",{style:{display:"block",fontSize:"0.75rem",color:"var(--text-secondary)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:g.blurb})]})]},g.id)})})]})};function wa({variant:t="info",children:o,className:c=""}){return e("div",{className:`alert alert-${t} ${c}`,children:o})}const ba={anime:"Watchlist",manga:"Reading List",tv:"TV Watchlist",asmr:"Listening List"},Ne=["general","presence","server","sync","watchlist","database"],La=()=>{const{data:t}=pe(ee),[o,c]=qe(),{contentType:g}=Te(),p=o.get("tab"),[h,k]=s(p&&Ne.includes(p)?p:"general"),[y,i]=s(""),r=Z(null),m=Z(null),f=Z(new Map),[d,P]=s({top:0,height:0,left:0,width:0}),{lowEndMode:l,setLowEndMode:v}=He(),{hasConsent:_,grant:T,revoke:O}=We(),[I,a]=s(!1),[N,R]=s(Be),[q,x]=s(!0),{data:A}=le("discordRPCEnabled"),M=_e(),[j,Q]=s(!0),{data:b}=le("dangoGaze"),[Le,fe]=s(!0),{data:ae}=le("discordRPCHideMature"),[ye,ie]=s(""),[ne,oe]=s(null);G(()=>{t?.owner&&C.discord.gatewayStatus.query().then(n=>{oe(n),n.masked&&n.masked!=="none"&&ie(n.masked)}).catch(()=>{})},[t?.owner]),G(()=>{A!==void 0&&x(A==="true"||A===!0||A===null)},[A]),G(()=>{ae!==void 0&&fe(ae==="true"||ae===!0||ae===null)},[ae]);const Pe=n=>{x(n),M.mutate({key:"discordRPCEnabled",value:String(n)})};G(()=>{b!==void 0&&Q(b!=="false"&&b!==!1)},[b]);const Ie=n=>{Q(n),M.mutate({key:"dangoGaze",value:String(n)})},xe=n=>{fe(n),M.mutate({key:"discordRPCHideMature",value:String(n)})},Re=n=>{R(n),je.setItem(Qe,String(n)),window.dispatchEvent(new CustomEvent(Ve))};we.useEffect(()=>{document.title="Settings - dango"},[]),we.useEffect(()=>{const n=o.get("tab");n&&Ne.includes(n)&&k(n)},[o]);const V=n=>{k(n),c(n==="general"?{}:{tab:n})},re=me(()=>{const n=f.current.get(h),z=m.current;if(n&&z){const Y=z.getBoundingClientRect(),F=n.getBoundingClientRect(),se=window.matchMedia("(max-width: 900px)").matches;P(se?{top:F.top-Y.top,height:F.height,left:F.left-Y.left,width:F.width}:{top:F.top-Y.top,height:F.height,left:0,width:0})}},[h]);ze(()=>{re()},[h,re]),G(()=>{const n=()=>re();window.addEventListener("resize",n);let z=!1;return document.fonts?.ready&&document.fonts.ready.then(()=>{z||re()}),()=>{z=!0,window.removeEventListener("resize",n)}},[h,re]);const De=()=>{i("Exporting databases...");const n=window.DangoBridge;if(n?.downloadFile){n.downloadFile("/api/backup-db","dango-backup.json"),setTimeout(()=>{i("Databases exported successfully!")},1500);return}const z=document.createElement("a");z.href="/api/backup-db",z.download="dango-backup.json",document.body.appendChild(z),z.click(),z.remove(),setTimeout(()=>{i("Databases exported successfully!")},1500)},Ae=async n=>{const z=n.currentTarget.files?.[0];if(!z)return;i("Importing databases...");const Y=new FormData;Y.append("dbfile",z);try{const F=await X("/api/restore-db",{method:"POST",body:Y}),se=await F.json();if(F.ok){const ve=Array.isArray(se.restored)?se.restored.join(", "):null;i(ve?`Databases imported successfully (${ve})!`:"Database imported successfully!"),setTimeout(()=>window.location.reload(),2e3)}else i(`Import failed: ${se.error}`)}catch{i("Import failed: An unexpected error occurred.")}finally{n.currentTarget.value=""}},Oe=()=>{r.current?.click()},Ge=()=>{switch(h){case"general":return e("div",{className:u.tabContent,children:[e(et,{}),e("div",{className:L.sectionCard,children:[e("h3",{children:"Appearance & Preferences"}),e("p",{children:"Configure how titles are displayed and other general preferences."}),e("div",{className:u.settingItem,children:e(tt,{})}),e("div",{className:u.settingItem,style:{marginTop:"1.5rem"},children:e(va,{})}),e("div",{className:u.settingItem,style:{marginTop:"1.5rem"},children:e("div",{className:L.settingRow,children:[e("div",{style:{minWidth:0},children:[e("h4",{style:{margin:0,fontSize:"1rem"},children:"Low End Mode"}),e("p",{style:{margin:"0.25rem 0 0",fontSize:"0.85rem",color:"var(--text-secondary)"},children:"Disables animations and heavy visual effects for better performance on older hardware."})]}),e($,{isChecked:l,onChange:n=>v(n.currentTarget.checked),id:"low-end-mode"})]})}),e("div",{className:u.settingItem,style:{marginTop:"1.5rem"},children:e("div",{className:L.settingRow,children:[e("div",{style:{minWidth:0},children:[e("h4",{style:{margin:0,fontSize:"1rem"},children:"Dango Animations"}),e("p",{style:{margin:"0.25rem 0 0",fontSize:"0.85rem",color:"var(--text-secondary)"},children:"Lets the dango logo look around, blink and react when you pet it. Always off in Low End Mode."})]}),e($,{isChecked:j,onChange:n=>Ie(n.currentTarget.checked),id:"dango-gaze"})]})}),e("div",{className:u.settingItem,style:{marginTop:"1.5rem"},children:e("div",{className:L.settingRow,children:[e("div",{style:{minWidth:0},children:[e("h4",{style:{margin:0,fontSize:"1rem"},children:"Virtual Keyboard"}),e("p",{style:{margin:"0.25rem 0 0",fontSize:"0.85rem",color:"var(--text-secondary)"},children:"Shows an on-screen keyboard when text search fields are focused."})]}),e($,{isChecked:N,onChange:n=>Re(n.currentTarget.checked),id:"virtual-keyboard-enabled"})]})})]}),e("section",{className:L.sectionCard,children:[e("h3",{children:"Keyboard Shortcuts"}),e("p",{children:"Use S or Ctrl+K to focus search anywhere, or use player keys while watching."}),e("div",{className:u.shortcutContainer,children:[e("div",{className:u.shortcutGroup,children:[e("h4",{className:u.shortcutGroupTitle,children:"Search"}),e("div",{className:u.shortcutGrid,children:[e("div",{className:u.shortcutCard,children:[e("kbd",{children:"S"}),e("span",{children:"Focus search"})]}),e("div",{className:u.shortcutCard,children:[e("kbd",{children:"Ctrl + K / ⌘ + K"}),e("span",{children:"Focus search"})]})]})]}),e("div",{className:u.shortcutGroup,children:[e("h4",{className:u.shortcutGroupTitle,children:"Player"}),e("div",{className:u.shortcutGrid,children:[e("div",{className:u.shortcutCard,children:[e("kbd",{children:"Space / K"}),e("span",{children:"Play / pause"})]}),e("div",{className:u.shortcutCard,children:[e("kbd",{children:"J / L · ← / →"}),e("span",{children:"Seek back / fwd"})]}),e("div",{className:u.shortcutCard,children:[e("kbd",{children:"↑ / ↓"}),e("span",{children:"Adjust volume"})]}),e("div",{className:u.shortcutCard,children:[e("kbd",{children:"M / F"}),e("span",{children:"Mute / fullscreen"})]}),e("div",{className:u.shortcutCard,children:[e("kbd",{children:"N / P"}),e("span",{children:"Next / prev episode"})]}),e("div",{className:u.shortcutCard,children:[e("kbd",{children:"T"}),e("span",{children:"Theater mode"})]})]})]})]})]})]});case"presence":return e("div",{className:u.tabContent,children:e("div",{className:L.sectionCard,children:[e("h3",{children:"Presence & Content"}),e("p",{children:"Control what Dango shares on Discord and your mature-content preference."}),t?.owner&&e("div",{className:u.settingItem,style:{marginTop:"1.5rem"},children:e("div",{className:L.settingRow,children:[e("div",{style:{minWidth:0},children:[e("h4",{style:{margin:0,fontSize:"1rem"},children:"Discord Rich Presence"}),e("p",{style:{margin:"0.25rem 0 0",fontSize:"0.85rem",color:"var(--text-secondary)"},children:"Show your current anime and watch progress on your Discord profile status."})]}),e($,{isChecked:q,onChange:n=>Pe(n.currentTarget.checked),id:"discord-rpc-enabled"})]})}),t?.owner&&q&&e("div",{className:u.settingItem,style:{marginTop:"1rem"},children:e("div",{className:L.settingRow,children:[e("div",{style:{minWidth:0},children:[e("h4",{style:{margin:0,fontSize:"1rem"},children:"Hide Mature Content"}),e("p",{style:{margin:"0.25rem 0 0",fontSize:"0.85rem",color:"var(--text-secondary)"},children:"Hide mature content (18+) from Discord Rich Presence."})]}),e($,{isChecked:Le,onChange:n=>xe(n.currentTarget.checked),id:"discord-hide-mature"})]})}),t?.owner&&e("div",{className:u.settingItem,style:{marginTop:"1.5rem",background:"var(--bg-tertiary)",padding:"1rem",borderRadius:"8px",border:"1px solid var(--border-color)"},children:[e("div",{className:L.settingRow,children:e("div",{style:{minWidth:0},children:[e("h4",{style:{margin:0,fontSize:"1rem"},children:"Discord Mobile Presence (Gateway)"}),e("p",{style:{margin:"0.25rem 0 0.75rem",fontSize:"0.85rem",color:"var(--text-secondary)"},children:"Paste your Discord authentication token to enable presence on mobile devices. If no token is saved, the default desktop Rich Presence is used. The token is stored locally in your configuration and never shared."})]})}),e(wa,{variant:"warning",style:{marginTop:"1.25rem",paddingTop:"1.25rem"},children:[e("strong",{children:"Use at your own risk."})," This feature uses the Discord Gateway API with your user token, which violates Discord's Terms of Service. Discord may detect this usage and take action against your account, including phone number locks, temporary suspensions, or permanent bans. While the risk is generally low, it is not zero. Only use this if you understand and accept the risks."]}),e("div",{style:{marginTop:"0.75rem",display:"flex",gap:"0.5rem",alignItems:"center",flexWrap:"wrap"},children:[e("input",{type:"password",value:ye,onChange:n=>ie(n.currentTarget.value),placeholder:"Paste Discord token here...",style:{flex:"1 1 200px",padding:"0.5rem",borderRadius:"4px",border:"1px solid var(--border-color)",background:"var(--bg-primary)",color:"var(--text-primary)",fontFamily:"monospace",minWidth:0}}),e(S,{variant:"primary",size:"sm",onClick:async()=>{try{const n=await C.discord.gatewaySave.mutate({token:ye});oe({hasToken:!0,masked:n.masked,enabled:!0}),ie(n.masked)}catch(n){alert(n instanceof Error?n.message:"Failed to save token")}},children:"Save"}),e(S,{variant:"secondary",size:"sm",onClick:async()=>{await C.discord.gatewayRemove.mutate().catch(()=>{}),ie(""),oe({hasToken:!1,masked:null,enabled:!1})},children:"Remove"})]}),ne&&e("p",{style:{marginTop:"0.5rem",fontSize:"0.8rem",color:ne.hasToken?"green":"var(--text-secondary)"},children:["Status:"," ",ne.hasToken?`Token saved (${ne.masked})`:"No token saved",ne.enabled?" - Gateway active":""]}),t?.owner&&e(da,{})]}),e("div",{className:u.settingItem,style:{marginTop:"1.5rem"},children:e("div",{className:L.settingRow,children:[e("div",{style:{minWidth:0},children:[e("h4",{style:{margin:0,fontSize:"1rem"},children:"Mature Content"}),e("p",{style:{margin:"0.25rem 0 0",fontSize:"0.85rem",color:"var(--text-secondary)"},children:"Allow mature content intended for adults 18 and older. Turning this off restores filtering and blur gates."})]}),e($,{isChecked:_,onChange:n=>{n.currentTarget.checked?a(!0):(O(),window.location.reload())},id:"mature-content-enabled"})]})})]})});case"server":return e("div",{className:u.tabContent,children:[t?.owner&&e(fa,{}),t?.owner&&e(ya,{})]});case"sync":return e("div",{className:u.tabContent,children:[e(la,{}),e(Rt,{}),e(Dt,{}),t?.owner&&e(oa,{})]});case"watchlist":return e("div",{className:u.tabContent,children:e(Et,{})});case"database":return e("div",{className:u.tabContent,children:[e("div",{className:L.sectionCard,children:[e("h3",{children:"Database Management"}),e("p",{children:"Download a backup of all databases (anime, manga, TV and ASMR) or restore from a backup file. Legacy single-file anime (.db) backups can still be restored."}),e("div",{className:u.controls,children:[e(S,{onClick:De,children:"Backup Database"}),e(S,{variant:"secondary",onClick:Oe,children:"Restore Database"})]}),e("input",{type:"file",ref:r,onChange:Ae,style:{position:"absolute",width:1,height:1,opacity:0,overflow:"hidden"},accept:".json,.db,application/octet-stream"}),y&&e("p",{className:u.status,children:y})]}),t?.owner&&e(aa,{}),e(ia,{})]});default:return null}};return e("div",{className:"page-container",children:[e("div",{className:u.settingsHeader,children:[e("h1",{className:u.pageTitle,children:"Settings"}),e("p",{className:u.pageSubtitle,children:"Manage your preferences and data synchronization"})]}),e("div",{className:u.settingsLayout,children:[e("aside",{className:u.sidebar,ref:m,children:[e("div",{className:u.sidebarIndicator,style:{top:d.top,height:d.height,left:d.left,...d.width?{width:d.width}:{}}}),e("button",{ref:n=>{n&&f.current.set("general",n)},className:`${u.sidebarItem} ${h==="general"?u.active:""}`,onClick:()=>V("general"),children:[e(B,{name:"cog"})," ",e("span",{children:"General"})]}),e("button",{ref:n=>{n&&f.current.set("presence",n)},className:`${u.sidebarItem} ${h==="presence"?u.active:""}`,onClick:()=>V("presence"),children:[e(B,{name:"discord"})," ",e("span",{children:"Presence"})]}),e("button",{ref:n=>{n&&f.current.set("server",n)},className:`${u.sidebarItem} ${h==="server"?u.active:""}`,onClick:()=>V("server"),children:[e(B,{name:"server"})," ",e("span",{children:"Server"})]}),e("button",{ref:n=>{n&&f.current.set("sync",n)},className:`${u.sidebarItem} ${h==="sync"?u.active:""}`,onClick:()=>V("sync"),children:[e(B,{name:"cloud"})," ",e("span",{children:"Synchronization"})]}),e("button",{ref:n=>{n&&f.current.set("watchlist",n)},className:`${u.sidebarItem} ${h==="watchlist"?u.active:""}`,onClick:()=>V("watchlist"),children:[e(B,{name:"list"})," ",e("span",{children:ba[g]})]}),e("button",{ref:n=>{n&&f.current.set("database",n)},className:`${u.sidebarItem} ${h==="database"?u.active:""}`,onClick:()=>V("database"),children:[e(B,{name:"database"})," ",e("span",{children:"Database"})]})]}),e("main",{className:u.mainContent,children:e("div",{className:u.tabContent,children:Ge()},h)})]}),e(Ye,{isOpen:I,onClose:()=>a(!1),onGrant:()=>{T(),a(!1)},scope:"section"})]})};export{La as default};