@serifpersia/dango 3.8.7 → 3.8.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/README.md +1 -1
  2. package/client/dist/assets/{AnimeCard-DeOILoQY.js → AnimeCard-G3oigO8B.js} +1 -1
  3. package/client/dist/assets/{AnimeInfo-CEWjWNK4.js → AnimeInfo-CR4XFD0Q.js} +1 -1
  4. package/client/dist/assets/{AnimeInfoPage-BBB8hD_-.js → AnimeInfoPage-DbT2RS0J.js} +2 -2
  5. package/client/dist/assets/{Asmr-BJjmJorV.js → Asmr-BaXYabXN.js} +1 -1
  6. package/client/dist/assets/{AsmrPopup-BW-iFW3L.js → AsmrPopup-6ky2U3uz.js} +1 -1
  7. package/client/dist/assets/{AsmrResetProgressModal-BAp7wa4X.js → AsmrResetProgressModal-DXwHSqwf.js} +1 -1
  8. package/client/dist/assets/Home-ZHM84CD8.js +1 -0
  9. package/client/dist/assets/{Home-grKghNM9.css → Home-ujV6ObHi.css} +1 -1
  10. package/client/dist/assets/{Insights-D3-riQFt.js → Insights-C6rMfz5x.js} +1 -1
  11. package/client/dist/assets/{LibraryListPage-CKEWlzgR.js → LibraryListPage-XHeMv9aN.js} +1 -1
  12. package/client/dist/assets/{ListeningList-WhGQuOYx.js → ListeningList-Dm_owBjG.js} +1 -1
  13. package/client/dist/assets/{Manga-XJEPnce1.js → Manga-BmHoV3yQ.js} +1 -1
  14. package/client/dist/assets/{MangaInfoPage-B3xV4o8C.js → MangaInfoPage-Blz86W7a.js} +1 -1
  15. package/client/dist/assets/{MangaReadPage-BdmcONww.js → MangaReadPage-DzEhRrLW.js} +1 -1
  16. package/client/dist/assets/{MangaResetProgressModal-C1Bfn9O_.js → MangaResetProgressModal-DdnI3zEg.js} +1 -1
  17. package/client/dist/assets/{Mature-VH_PWwEN.js → Mature-DGDC_8w6.js} +1 -1
  18. package/client/dist/assets/{MatureConsentModal-Do1CtwDw.js → MatureConsentModal-BXFvhDf0.js} +1 -1
  19. package/client/dist/assets/{MediaCard-BikTKuG3.js → MediaCard-DW8QbvWe.js} +1 -1
  20. package/client/dist/assets/{OptionListMenu-BReFoLC2.js → OptionListMenu-Dxx8rcuO.js} +1 -1
  21. package/client/dist/assets/{Player-CUTDxVY5.js → Player-CQy7jQbB.js} +2 -2
  22. package/client/dist/assets/{PlayerProvider-D60eCjik.js → PlayerProvider-BoJyuLEn.js} +1 -1
  23. package/client/dist/assets/{PlayerSettings-C2pu0sQt.js → PlayerSettings-DSq0bKT6.js} +1 -1
  24. package/client/dist/assets/{QueueOptionsButton-CUyJPdwg.js → QueueOptionsButton-B2p9VIz2.js} +1 -1
  25. package/client/dist/assets/{QueueRail-DqyZVaD-.js → QueueRail-BWcF0bqm.js} +1 -1
  26. package/client/dist/assets/{ReadingList-BXR1JrJ_.js → ReadingList-CKJ1Lt3H.js} +1 -1
  27. package/client/dist/assets/{ResetProgressModal-YVCqneQ5.js → ResetProgressModal-BpNG6BGY.js} +1 -1
  28. package/client/dist/assets/{Search-C27b6qOV.js → Search-D5OkKFDj.js} +1 -1
  29. package/client/dist/assets/{Settings-DEWZN-A-.js → Settings-_URnBHKL.js} +1 -1
  30. package/client/dist/assets/{SkeletonGrid-BpsynMj7.js → SkeletonGrid-BVWffnlT.js} +1 -1
  31. package/client/dist/assets/{Trackers-B3EMJMgo.js → Trackers-D4BC2YOO.js} +1 -1
  32. package/client/dist/assets/{Tv-BfDkrKuI.js → Tv-B0-XYYdF.js} +1 -1
  33. package/client/dist/assets/{TvInfo-BkABl1xJ.js → TvInfo-FWR5_kso.js} +1 -1
  34. package/client/dist/assets/{TvPopup-RchqnXJt.js → TvPopup-JKZPbL5t.js} +1 -1
  35. package/client/dist/assets/{TvSearch-C9oRGjgC.js → TvSearch-Gddgkz5g.js} +1 -1
  36. package/client/dist/assets/{TvWatchlist-ClRCXsXi.js → TvWatchlist-BTTqu23j.js} +1 -1
  37. package/client/dist/assets/{VirtualKeyboard-C0Yf-_br.js → VirtualKeyboard-BD5VOYcJ.js} +1 -1
  38. package/client/dist/assets/{WatchAlong-CIBT0VHg.js → WatchAlong-Czm3Pr1E.js} +1 -1
  39. package/client/dist/assets/{WatchAlongPanel-D87h_8qM.js → WatchAlongPanel-Dsmcqrjh.js} +1 -1
  40. package/client/dist/assets/{Watchlist-1rn0IRne.js → Watchlist-BMRAdzMF.js} +1 -1
  41. package/client/dist/assets/index-Bi-DGtzC.js +178 -0
  42. package/client/dist/assets/index-RwPVmyxh.css +1 -0
  43. package/client/dist/assets/{libraryInvalidation-BHknhNAw.js → libraryInvalidation-B5vX-vJv.js} +1 -1
  44. package/client/dist/assets/{playbackCompletion-ZhAwimeL.js → playbackCompletion-Dz3OK72-.js} +1 -1
  45. package/client/dist/assets/{useAnimeInfoData-l7nCKCe5.js → useAnimeInfoData-CQTVAjpz.js} +1 -1
  46. package/client/dist/assets/{useMangaLibrary-DAPvo2xZ.js → useMangaLibrary-i1RAEkNy.js} +1 -1
  47. package/client/dist/assets/{useMangaPopup-B5LPCa2N.js → useMangaPopup-BMXrc7pH.js} +1 -1
  48. package/client/dist/assets/{useProviders-DsY_iifL.js → useProviders-DbKN3TWq.js} +1 -1
  49. package/client/dist/assets/{useTv-olJK7WfQ.js → useTv-4SqDfx-O.js} +1 -1
  50. package/client/dist/assets/{useTvLibrary-Deie_gJF.js → useTvLibrary-yhqRv3U7.js} +1 -1
  51. package/client/dist/assets/{useWatchAlongPlayer-cl8kIOvd.js → useWatchAlongPlayer-BvcoBlQi.js} +1 -1
  52. package/client/dist/index.html +2 -2
  53. package/package.json +2 -2
  54. package/server/package.json +1 -1
  55. package/client/dist/assets/Home-BqE0OcxM.js +0 -1
  56. package/client/dist/assets/index-Cd1-bH35.js +0 -178
  57. package/client/dist/assets/index-Ej7BS74s.css +0 -1
@@ -1 +1 @@
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{a2 as Pe,p as pe,h as be}from"./index-Cd1-bH35.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
+ 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{a2 as Pe,p as pe,h as be}from"./index-Bi-DGtzC.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 +1 @@
1
- import{g as w,d as ne,T as te,u as e}from"./vendor-core-DfaOB3Rn.js";import{u as ae,p as se}from"./index-Cd1-bH35.js";import{I as o}from"./vendor-icons-DrybRNxP.js";import{S as le,O as A,a as ie,A as ce,b as re}from"./OptionListMenu-BReFoLC2.js";import"./vendor-query-BBT5_sHx.js";import"./useWatchAlongPlayer-cl8kIOvd.js";import"./PlayerProvider-D60eCjik.js";import"./playbackCompletion-ZhAwimeL.js";const oe="_settingsPanel_mcacu_1",me="_header_mcacu_35",de="_backBtn_mcacu_58",ue="_contentWrapper_mcacu_78",he="_menuContent_mcacu_84",pe="_menuItem_mcacu_91",be="_selected_mcacu_116",ge="_currentValue_mcacu_136",ve="_menuNote_mcacu_143",ke="_menuError_mcacu_152",n={settingsPanel:oe,header:me,backBtn:de,contentWrapper:ue,menuContent:he,menuItem:pe,selected:be,currentValue:ge,menuNote:ve,menuError:ke},ye=($,P)=>{const{isOpen:g,onClose:Ce,videoSources:fe,currentSource:C,currentLink:f,onSourceChange:V,subtitles:O,activeSubtitleTrack:v,onSubtitleChange:E,subtitleSettings:z,onSubtitleSettingsChange:T,useNativeControls:k,onNativeControlsToggle:U,anime4kEnabled:u,onAnime4kToggle:B,anime4kSupported:N,anime4kProfile:c,onAnime4kProfileChange:h,anime4kInitializing:L,anime4kError:S,videoDelayEnabled:_,onVideoDelayToggle:M,videoDelayMs:I,onVideoDelayChange:D,onCalibrateAvSync:x,isAutoSkipEnabled:m,onAutoSkipChange:W,isAutoplayEnabled:d,onAutoplayChange:G,fallbackChoice:p,onFallbackChoiceChange:j,isTheaterMode:q,ambientSettings:b,onAmbientChange:y}=$,{lowEndMode:F}=ae(),[a,i]=ne("main");w.useEffect(()=>{if(!g){const t=setTimeout(()=>i("main"),300);return()=>clearTimeout(t)}},[g]);const Q=()=>e("div",{className:n.menuContent,children:[e("button",{className:n.menuItem,onClick:()=>i("quality"),children:[e("span",{children:"Quality"}),e("span",{className:n.currentValue,children:f?.resolutionStr||"Auto"})]}),e("button",{className:n.menuItem,onClick:()=>i("subtitles"),children:[e("span",{children:"Subtitles"}),e("span",{className:n.currentValue,children:v||"Off"})]}),e("button",{className:n.menuItem,onClick:()=>i("subtitle-style"),children:e("span",{children:"Subtitle Style"})}),F&&e("button",{className:`${n.menuItem} ${k?n.selected:""}`,onClick:()=>{const t=!k;U(t),se.setItem("playerUseNativeControls",t.toString())},children:[e("span",{children:"Native Controls"}),k&&e(o,{name:"check",size:12})]}),N&&e("button",{className:`${n.menuItem} ${u?n.selected:""}`,onClick:()=>{B(!u)},children:[e("span",{children:"Anime4K Upscaler"}),u&&e(o,{name:"check",size:12})]}),N&&u&&e("button",{className:n.menuItem,onClick:()=>i("upscaler"),children:e("span",{children:"Upscaler Settings"})}),e("button",{className:n.menuItem,onClick:()=>i("av-sync"),children:[e("span",{children:"A/V Sync"}),e("span",{className:n.currentValue,children:_?`${I}ms`:"Off"})]}),e("button",{className:n.menuItem,onClick:()=>i("playback"),children:[e("span",{children:"Playback"}),e("span",{className:n.currentValue,children:[m?"Auto-skip On":null,d?"Autoplay On":null].filter(Boolean).join(" • ")||"Off"})]}),q&&b&&y&&e("button",{className:n.menuItem,onClick:()=>i("ambient"),children:[e("span",{children:"Ambient Light"}),e("span",{className:n.currentValue,children:b.enabled?"On":"Off"})]})]}),R=()=>{const t=C?.links.sort((s,r)=>(parseInt(r.resolutionStr)||0)-(parseInt(s.resolutionStr)||0))||[];return e("div",{className:n.menuContent,children:e(A,{classes:{item:n.menuItem,active:n.selected},options:t.map(s=>({key:s.resolutionStr,label:s.resolutionStr,selected:f?.resolutionStr===s.resolutionStr})),onSelect:s=>{const r=t.find(l=>l.resolutionStr===s);r&&V(C,r)}})})},H=()=>e("div",{className:n.menuContent,children:e(A,{classes:{item:n.menuItem,active:n.selected},options:[{key:"off",label:"Off",selected:v==="off"},...O.map(t=>({key:t.label||t.lang,label:t.label,selected:v===(t.label||t.lang)}))],onSelect:t=>E(t)})}),K=()=>e("div",{className:n.menuContent,children:e(ie,{classes:{item:n.menuItem,active:n.selected},values:z,onChange:T})}),J=te(()=>{try{const s=navigator.userAgentData?.brands?.map(l=>l.brand.toLowerCase())??[];if(s.length>0)return s.some(l=>l.includes("chromium")||l.includes("chrome")||l.includes("edge")||l.includes("opera")||l.includes("brave")||l.includes("vivaldi"));const r=navigator.userAgent.toLowerCase();return r.includes("chrome")||r.includes("chromium")||r.includes("edg")}catch{return!0}},[]),X=()=>e("div",{className:n.menuContent,children:[L&&e("div",{className:n.menuNote,role:"status",children:"Preparing GPU, this can take a few seconds…"}),S&&e("div",{className:n.menuError,role:"alert",children:["Upscaler failed: ",S]}),!J&&e("div",{className:n.menuNote,children:"Upscaling performs best in Chrome-based browsers."}),e("button",{className:`${n.menuItem} ${c==="low"?n.selected:""}`,onClick:()=>h("low"),children:[e("div",{children:[e("div",{children:"Low"}),e("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"Lightest, best for weaker GPUs"})]}),c==="low"&&e(o,{name:"check",size:12})]}),e("button",{className:`${n.menuItem} ${c==="balanced"?n.selected:""}`,onClick:()=>h("balanced"),children:[e("div",{children:[e("div",{children:"Balanced"}),e("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"Source + display aware"})]}),c==="balanced"&&e(o,{name:"check",size:12})]}),e("button",{className:`${n.menuItem} ${c==="high"?n.selected:""}`,onClick:()=>h("high"),children:[e("div",{children:[e("div",{children:"High"}),e("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"Aggressive, needs strong GPU"})]}),c==="high"&&e(o,{name:"check",size:12})]}),e("button",{className:`${n.menuItem} ${c==="denoise"?n.selected:""}`,onClick:()=>h("denoise"),children:[e("div",{children:[e("div",{children:"Denoise"}),e("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"Denoise + upscale noisy, compressed sources"})]}),c==="denoise"&&e(o,{name:"check",size:12})]})]}),Y=()=>e("div",{className:n.menuContent,children:[e("button",{type:"button",className:`${n.menuItem} ${m?n.selected:""}`,onClick:()=>W(!m),"aria-pressed":m,children:[e("span",{children:"Auto-skip openings and endings"}),e("span",{className:n.currentValue,children:m?"On":"Off"})]}),e("div",{className:n.menuNote,children:"Automatically jump past opening, ending and recap segments when detected."}),e("button",{type:"button",className:`${n.menuItem} ${d?n.selected:""}`,onClick:()=>G(!d),"aria-pressed":d,children:[e("span",{children:"Autoplay next episode"}),e("span",{className:n.currentValue,children:d?"On":"Off"})]}),e("div",{className:n.menuNote,children:"Automatically start the next episode when this one ends."}),e("button",{type:"button",className:n.menuItem,onClick:()=>j(p==="ask"?"iframe":p==="iframe"?"retry":"ask"),children:[e("span",{children:"Failed direct stream"}),e("span",{className:n.currentValue,children:p==="iframe"?"Use iframe":p==="retry"?"Try provider":"Ask me"})]}),e("div",{className:n.menuNote,children:"When a direct stream fails: ask each time, go straight to the embedded player (may show ads), or automatically try another provider."})]}),Z=()=>e("div",{className:n.menuContent,children:e(ce,{classes:{item:n.menuItem,active:n.selected,note:n.menuNote},enabled:_,delayMs:I,onToggle:M,onDelayChange:D,onCalibrate:x})}),ee=()=>b&&y?e("div",{className:n.menuContent,children:e(re,{classes:{item:n.menuItem,active:n.selected,note:n.menuNote},values:b,onChange:y})}):null;return g?e(le,{classes:{panel:n.settingsPanel,header:n.header,backBtn:n.backBtn,title:"",content:n.contentWrapper},title:a==="main"?"Settings":a==="ambient"?"Ambient Light":a.charAt(0).toUpperCase()+a.slice(1).replace("-"," "),titleTag:"h3",showBack:a!=="main",onBack:()=>i("main"),panelRef:P,onPanelClick:t=>t.stopPropagation(),children:[a==="main"&&Q(),a==="quality"&&R(),a==="subtitles"&&H(),a==="subtitle-style"&&K(),a==="upscaler"&&X(),a==="av-sync"&&Z(),a==="playback"&&Y(),a==="ambient"&&ee()]}):null},Ve=w.forwardRef(ye);export{Ve as default};
1
+ import{g as w,d as ne,T as te,u as e}from"./vendor-core-DfaOB3Rn.js";import{u as ae,p as se}from"./index-Bi-DGtzC.js";import{I as o}from"./vendor-icons-DrybRNxP.js";import{S as le,O as A,a as ie,A as ce,b as re}from"./OptionListMenu-Dxx8rcuO.js";import"./vendor-query-BBT5_sHx.js";import"./useWatchAlongPlayer-BvcoBlQi.js";import"./PlayerProvider-BoJyuLEn.js";import"./playbackCompletion-Dz3OK72-.js";const oe="_settingsPanel_mcacu_1",me="_header_mcacu_35",de="_backBtn_mcacu_58",ue="_contentWrapper_mcacu_78",he="_menuContent_mcacu_84",pe="_menuItem_mcacu_91",be="_selected_mcacu_116",ge="_currentValue_mcacu_136",ve="_menuNote_mcacu_143",ke="_menuError_mcacu_152",n={settingsPanel:oe,header:me,backBtn:de,contentWrapper:ue,menuContent:he,menuItem:pe,selected:be,currentValue:ge,menuNote:ve,menuError:ke},ye=($,P)=>{const{isOpen:g,onClose:Ce,videoSources:fe,currentSource:C,currentLink:f,onSourceChange:V,subtitles:O,activeSubtitleTrack:v,onSubtitleChange:E,subtitleSettings:z,onSubtitleSettingsChange:T,useNativeControls:k,onNativeControlsToggle:U,anime4kEnabled:u,onAnime4kToggle:B,anime4kSupported:N,anime4kProfile:c,onAnime4kProfileChange:h,anime4kInitializing:L,anime4kError:S,videoDelayEnabled:_,onVideoDelayToggle:M,videoDelayMs:I,onVideoDelayChange:D,onCalibrateAvSync:x,isAutoSkipEnabled:m,onAutoSkipChange:W,isAutoplayEnabled:d,onAutoplayChange:G,fallbackChoice:p,onFallbackChoiceChange:j,isTheaterMode:q,ambientSettings:b,onAmbientChange:y}=$,{lowEndMode:F}=ae(),[a,i]=ne("main");w.useEffect(()=>{if(!g){const t=setTimeout(()=>i("main"),300);return()=>clearTimeout(t)}},[g]);const Q=()=>e("div",{className:n.menuContent,children:[e("button",{className:n.menuItem,onClick:()=>i("quality"),children:[e("span",{children:"Quality"}),e("span",{className:n.currentValue,children:f?.resolutionStr||"Auto"})]}),e("button",{className:n.menuItem,onClick:()=>i("subtitles"),children:[e("span",{children:"Subtitles"}),e("span",{className:n.currentValue,children:v||"Off"})]}),e("button",{className:n.menuItem,onClick:()=>i("subtitle-style"),children:e("span",{children:"Subtitle Style"})}),F&&e("button",{className:`${n.menuItem} ${k?n.selected:""}`,onClick:()=>{const t=!k;U(t),se.setItem("playerUseNativeControls",t.toString())},children:[e("span",{children:"Native Controls"}),k&&e(o,{name:"check",size:12})]}),N&&e("button",{className:`${n.menuItem} ${u?n.selected:""}`,onClick:()=>{B(!u)},children:[e("span",{children:"Anime4K Upscaler"}),u&&e(o,{name:"check",size:12})]}),N&&u&&e("button",{className:n.menuItem,onClick:()=>i("upscaler"),children:e("span",{children:"Upscaler Settings"})}),e("button",{className:n.menuItem,onClick:()=>i("av-sync"),children:[e("span",{children:"A/V Sync"}),e("span",{className:n.currentValue,children:_?`${I}ms`:"Off"})]}),e("button",{className:n.menuItem,onClick:()=>i("playback"),children:[e("span",{children:"Playback"}),e("span",{className:n.currentValue,children:[m?"Auto-skip On":null,d?"Autoplay On":null].filter(Boolean).join(" • ")||"Off"})]}),q&&b&&y&&e("button",{className:n.menuItem,onClick:()=>i("ambient"),children:[e("span",{children:"Ambient Light"}),e("span",{className:n.currentValue,children:b.enabled?"On":"Off"})]})]}),R=()=>{const t=C?.links.sort((s,r)=>(parseInt(r.resolutionStr)||0)-(parseInt(s.resolutionStr)||0))||[];return e("div",{className:n.menuContent,children:e(A,{classes:{item:n.menuItem,active:n.selected},options:t.map(s=>({key:s.resolutionStr,label:s.resolutionStr,selected:f?.resolutionStr===s.resolutionStr})),onSelect:s=>{const r=t.find(l=>l.resolutionStr===s);r&&V(C,r)}})})},H=()=>e("div",{className:n.menuContent,children:e(A,{classes:{item:n.menuItem,active:n.selected},options:[{key:"off",label:"Off",selected:v==="off"},...O.map(t=>({key:t.label||t.lang,label:t.label,selected:v===(t.label||t.lang)}))],onSelect:t=>E(t)})}),K=()=>e("div",{className:n.menuContent,children:e(ie,{classes:{item:n.menuItem,active:n.selected},values:z,onChange:T})}),J=te(()=>{try{const s=navigator.userAgentData?.brands?.map(l=>l.brand.toLowerCase())??[];if(s.length>0)return s.some(l=>l.includes("chromium")||l.includes("chrome")||l.includes("edge")||l.includes("opera")||l.includes("brave")||l.includes("vivaldi"));const r=navigator.userAgent.toLowerCase();return r.includes("chrome")||r.includes("chromium")||r.includes("edg")}catch{return!0}},[]),X=()=>e("div",{className:n.menuContent,children:[L&&e("div",{className:n.menuNote,role:"status",children:"Preparing GPU, this can take a few seconds…"}),S&&e("div",{className:n.menuError,role:"alert",children:["Upscaler failed: ",S]}),!J&&e("div",{className:n.menuNote,children:"Upscaling performs best in Chrome-based browsers."}),e("button",{className:`${n.menuItem} ${c==="low"?n.selected:""}`,onClick:()=>h("low"),children:[e("div",{children:[e("div",{children:"Low"}),e("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"Lightest, best for weaker GPUs"})]}),c==="low"&&e(o,{name:"check",size:12})]}),e("button",{className:`${n.menuItem} ${c==="balanced"?n.selected:""}`,onClick:()=>h("balanced"),children:[e("div",{children:[e("div",{children:"Balanced"}),e("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"Source + display aware"})]}),c==="balanced"&&e(o,{name:"check",size:12})]}),e("button",{className:`${n.menuItem} ${c==="high"?n.selected:""}`,onClick:()=>h("high"),children:[e("div",{children:[e("div",{children:"High"}),e("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"Aggressive, needs strong GPU"})]}),c==="high"&&e(o,{name:"check",size:12})]}),e("button",{className:`${n.menuItem} ${c==="denoise"?n.selected:""}`,onClick:()=>h("denoise"),children:[e("div",{children:[e("div",{children:"Denoise"}),e("div",{style:{fontSize:"0.75rem",color:"var(--text-tertiary)"},children:"Denoise + upscale noisy, compressed sources"})]}),c==="denoise"&&e(o,{name:"check",size:12})]})]}),Y=()=>e("div",{className:n.menuContent,children:[e("button",{type:"button",className:`${n.menuItem} ${m?n.selected:""}`,onClick:()=>W(!m),"aria-pressed":m,children:[e("span",{children:"Auto-skip openings and endings"}),e("span",{className:n.currentValue,children:m?"On":"Off"})]}),e("div",{className:n.menuNote,children:"Automatically jump past opening, ending and recap segments when detected."}),e("button",{type:"button",className:`${n.menuItem} ${d?n.selected:""}`,onClick:()=>G(!d),"aria-pressed":d,children:[e("span",{children:"Autoplay next episode"}),e("span",{className:n.currentValue,children:d?"On":"Off"})]}),e("div",{className:n.menuNote,children:"Automatically start the next episode when this one ends."}),e("button",{type:"button",className:n.menuItem,onClick:()=>j(p==="ask"?"iframe":p==="iframe"?"retry":"ask"),children:[e("span",{children:"Failed direct stream"}),e("span",{className:n.currentValue,children:p==="iframe"?"Use iframe":p==="retry"?"Try provider":"Ask me"})]}),e("div",{className:n.menuNote,children:"When a direct stream fails: ask each time, go straight to the embedded player (may show ads), or automatically try another provider."})]}),Z=()=>e("div",{className:n.menuContent,children:e(ce,{classes:{item:n.menuItem,active:n.selected,note:n.menuNote},enabled:_,delayMs:I,onToggle:M,onDelayChange:D,onCalibrate:x})}),ee=()=>b&&y?e("div",{className:n.menuContent,children:e(re,{classes:{item:n.menuItem,active:n.selected,note:n.menuNote},values:b,onChange:y})}):null;return g?e(le,{classes:{panel:n.settingsPanel,header:n.header,backBtn:n.backBtn,title:"",content:n.contentWrapper},title:a==="main"?"Settings":a==="ambient"?"Ambient Light":a.charAt(0).toUpperCase()+a.slice(1).replace("-"," "),titleTag:"h3",showBack:a!=="main",onBack:()=>i("main"),panelRef:P,onPanelClick:t=>t.stopPropagation(),children:[a==="main"&&Q(),a==="quality"&&R(),a==="subtitles"&&H(),a==="subtitle-style"&&K(),a==="upscaler"&&X(),a==="av-sync"&&Z(),a==="playback"&&Y(),a==="ambient"&&ee()]}):null},Ve=w.forwardRef(ye);export{Ve as default};
@@ -1 +1 @@
1
- import{b as T}from"./vendor-query-BBT5_sHx.js";import{q as z,t as A,x as J,ar as W,as as X,at as Y}from"./index-Cd1-bH35.js";import{d as Z,T as R,q as r,u as t,$ as w,S as ee}from"./vendor-core-DfaOB3Rn.js";import{a as te,c as ne,d as se,b as ae,o as oe,f as ie,s as re}from"./vendor-ui-3qrARCPr.js";import{I as u}from"./vendor-icons-DrybRNxP.js";function Ee(n){return T({queryKey:[z.showMeta,n],queryFn:async()=>n?A.data.showMeta.query({id:n}):{},enabled:!!n,staleTime:3e4})}const ue="_trigger_1vova_6",me="_triggerBtn_1vova_11",le="_chevron_1vova_25",ce="_menu_1vova_34",pe="_menuTitle_1vova_51",de="_menuItem_1vova_60",ge="_removeItem_1vova_91",fe="_menuEmpty_1vova_99",o={trigger:ue,triggerBtn:me,chevron:le,menu:ce,menuTitle:pe,menuItem:de,removeItem:ge,menuEmpty:fe},ve=8,Pe=({showId:n,showName:v,showThumbnail:h,nativeName:y,englishName:_,showType:b,className:D="",activeClassName:F="",align:M="right",onMenuOpenChange:d})=>{const{data:q=[]}=J(),E=W(),P=X(),[m,f]=Z(!1),{refs:Q,floatingStyles:x,context:C}=te({open:m,onOpenChange:e=>{e||(f(!1),d?.(!1))},placement:M==="left"?"bottom-start":"bottom-end",middleware:[oe(ve),ie({padding:8}),re({padding:8})],whileElementsMounted:ae}),I=ne(C,{outsidePress:!0,escapeKey:!0,referencePress:!1}),{getReferenceProps:S,getFloatingProps:K}=se([I]),l=R(()=>q.filter(e=>e.showId===n),[q,n]),{data:L}=T({queryKey:[z.suggestedEpisode,n],queryFn:()=>A.watchlist.queueSuggested.query({showId:n}),enabled:!!n}),{data:$,isFetching:N}=Y(n,m),s=R(()=>$?.episodes||[],[$]),k=r(()=>{f(!0),d?.(!0)},[d]),c=r(()=>{f(!1),d?.(!1)},[d]),p=l.length>0,a=s.length>0,g=L?.episodeNumber,i=r(e=>{!n||e.length===0||(E.mutate({showId:n,episodeNumbers:e,showName:v,showThumbnail:h,nativeName:y,englishName:_,type:b}),c())},[n,v,h,y,_,b,E,c]),O=r(()=>{!n||l.length===0||(P.mutate({showId:n,episodeNumbers:l.map(e=>e.episodeNumber)}),c())},[n,l,P,c]),U=r(()=>{a?i([s[0]]):g&&i([String(g)])},[a,s,g,i]),G=r(()=>{a&&i(s.slice(0,3))},[a,s,i]),V=r(()=>{a&&i([...s])},[a,s,i]),B=s[0],j=s[Math.min(2,s.length-1)],H=t("div",{className:o.trigger,ref:Q.setReference,children:t("span",{className:`${o.triggerBtn} ${D} ${p?F:""}`,role:"button",tabIndex:0,"aria-haspopup":"menu","aria-expanded":m,"aria-label":p?"Queued":"Queue",...S(),onClick:e=>{e.preventDefault(),e.stopPropagation(),m?c():k()},onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),e.stopPropagation(),m?c():k())},children:[p?t(u,{name:"check",size:14}):t(u,{name:"plus",size:14}),p?"Queued":"Queue",t(u,{name:"chevron-down",size:10,className:o.chevron})]})});return t(ee,{children:[H,m&&w(t("div",{ref:Q.setFloating,className:o.menu,style:x,role:"menu",...K(),onMouseDown:e=>e.stopPropagation(),onClick:e=>{e.preventDefault(),e.stopPropagation()},children:[t("div",{className:o.menuTitle,children:"Queue episodes"}),t("button",{className:o.menuItem,role:"menuitem",type:"button",disabled:!a&&!g,onClick:e=>{e.stopPropagation(),U()},children:[t(u,{name:"plus",size:11}),t("span",{children:a?`+1 — EP ${B}`:`+1 — EP ${g||"?"}`})]}),t("button",{className:o.menuItem,role:"menuitem",type:"button",disabled:!a,onClick:e=>{e.stopPropagation(),G()},children:[t(u,{name:"plus",size:11}),t("span",{children:a?`+3 — EP ${B}${s.length>1?`-${j}`:""}`:"+3"})]}),t("button",{className:o.menuItem,role:"menuitem",type:"button",disabled:!a,onClick:e=>{e.stopPropagation(),V()},children:[t(u,{name:"plus",size:11}),t("span",{children:["All Remaining",N?"":` (${Math.max(s.length,0)})`]})]}),!N&&s.length===0&&t("div",{className:o.menuEmpty,children:p?"All episodes are already queued":"No remaining unwatched episodes"}),p&&t("button",{className:`${o.menuItem} ${o.removeItem}`,role:"menuitem",type:"button",onClick:e=>{e.stopPropagation(),O()},children:[t(u,{name:"times",size:11}),t("span",{children:["Remove from Queue",l.length>0?` (${l.length})`:""]})]})]}),document.body)]})};export{Pe as Q,Ee as u};
1
+ import{b as T}from"./vendor-query-BBT5_sHx.js";import{q as z,t as A,x as J,ar as W,as as X,at as Y}from"./index-Bi-DGtzC.js";import{d as Z,T as R,q as r,u as t,$ as w,S as ee}from"./vendor-core-DfaOB3Rn.js";import{a as te,c as ne,d as se,b as ae,o as oe,f as ie,s as re}from"./vendor-ui-3qrARCPr.js";import{I as u}from"./vendor-icons-DrybRNxP.js";function Ee(n){return T({queryKey:[z.showMeta,n],queryFn:async()=>n?A.data.showMeta.query({id:n}):{},enabled:!!n,staleTime:3e4})}const ue="_trigger_1vova_6",me="_triggerBtn_1vova_11",le="_chevron_1vova_25",ce="_menu_1vova_34",pe="_menuTitle_1vova_51",de="_menuItem_1vova_60",ge="_removeItem_1vova_91",fe="_menuEmpty_1vova_99",o={trigger:ue,triggerBtn:me,chevron:le,menu:ce,menuTitle:pe,menuItem:de,removeItem:ge,menuEmpty:fe},ve=8,Pe=({showId:n,showName:v,showThumbnail:h,nativeName:y,englishName:_,showType:b,className:D="",activeClassName:F="",align:M="right",onMenuOpenChange:d})=>{const{data:q=[]}=J(),E=W(),P=X(),[m,f]=Z(!1),{refs:Q,floatingStyles:x,context:C}=te({open:m,onOpenChange:e=>{e||(f(!1),d?.(!1))},placement:M==="left"?"bottom-start":"bottom-end",middleware:[oe(ve),ie({padding:8}),re({padding:8})],whileElementsMounted:ae}),I=ne(C,{outsidePress:!0,escapeKey:!0,referencePress:!1}),{getReferenceProps:S,getFloatingProps:K}=se([I]),l=R(()=>q.filter(e=>e.showId===n),[q,n]),{data:L}=T({queryKey:[z.suggestedEpisode,n],queryFn:()=>A.watchlist.queueSuggested.query({showId:n}),enabled:!!n}),{data:$,isFetching:N}=Y(n,m),s=R(()=>$?.episodes||[],[$]),k=r(()=>{f(!0),d?.(!0)},[d]),c=r(()=>{f(!1),d?.(!1)},[d]),p=l.length>0,a=s.length>0,g=L?.episodeNumber,i=r(e=>{!n||e.length===0||(E.mutate({showId:n,episodeNumbers:e,showName:v,showThumbnail:h,nativeName:y,englishName:_,type:b}),c())},[n,v,h,y,_,b,E,c]),O=r(()=>{!n||l.length===0||(P.mutate({showId:n,episodeNumbers:l.map(e=>e.episodeNumber)}),c())},[n,l,P,c]),U=r(()=>{a?i([s[0]]):g&&i([String(g)])},[a,s,g,i]),G=r(()=>{a&&i(s.slice(0,3))},[a,s,i]),V=r(()=>{a&&i([...s])},[a,s,i]),B=s[0],j=s[Math.min(2,s.length-1)],H=t("div",{className:o.trigger,ref:Q.setReference,children:t("span",{className:`${o.triggerBtn} ${D} ${p?F:""}`,role:"button",tabIndex:0,"aria-haspopup":"menu","aria-expanded":m,"aria-label":p?"Queued":"Queue",...S(),onClick:e=>{e.preventDefault(),e.stopPropagation(),m?c():k()},onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),e.stopPropagation(),m?c():k())},children:[p?t(u,{name:"check",size:14}):t(u,{name:"plus",size:14}),p?"Queued":"Queue",t(u,{name:"chevron-down",size:10,className:o.chevron})]})});return t(ee,{children:[H,m&&w(t("div",{ref:Q.setFloating,className:o.menu,style:x,role:"menu",...K(),onMouseDown:e=>e.stopPropagation(),onClick:e=>{e.preventDefault(),e.stopPropagation()},children:[t("div",{className:o.menuTitle,children:"Queue episodes"}),t("button",{className:o.menuItem,role:"menuitem",type:"button",disabled:!a&&!g,onClick:e=>{e.stopPropagation(),U()},children:[t(u,{name:"plus",size:11}),t("span",{children:a?`+1 — EP ${B}`:`+1 — EP ${g||"?"}`})]}),t("button",{className:o.menuItem,role:"menuitem",type:"button",disabled:!a,onClick:e=>{e.stopPropagation(),G()},children:[t(u,{name:"plus",size:11}),t("span",{children:a?`+3 — EP ${B}${s.length>1?`-${j}`:""}`:"+3"})]}),t("button",{className:o.menuItem,role:"menuitem",type:"button",disabled:!a,onClick:e=>{e.stopPropagation(),V()},children:[t(u,{name:"plus",size:11}),t("span",{children:["All Remaining",N?"":` (${Math.max(s.length,0)})`]})]}),!N&&s.length===0&&t("div",{className:o.menuEmpty,children:p?"All episodes are already queued":"No remaining unwatched episodes"}),p&&t("button",{className:`${o.menuItem} ${o.removeItem}`,role:"menuitem",type:"button",onClick:e=>{e.stopPropagation(),O()},children:[t(u,{name:"times",size:11}),t("span",{children:["Remove from Queue",l.length>0?` (${l.length})`:""]})]})]}),document.body)]})};export{Pe as Q,Ee as u};
@@ -1 +1 @@
1
- import{g as s,u as n,a as X}from"./vendor-core-DfaOB3Rn.js";import{I as D}from"./vendor-icons-DrybRNxP.js";import{d as Y,f as L}from"./index-Cd1-bH35.js";const z="_section_5peha_1",F="_header_5peha_10",O="_headerToggle_5peha_20",j="_headerActions_5peha_34",J="_title_5peha_40",K="_badge_5peha_50",V="_clearBtn_5peha_65",W="_nextBtn_5peha_83",Z="_list_5peha_101",ee="_item_5peha_115",ne="_active_5peha_135",te="_dragging_5peha_143",re="_dragHandle_5peha_150",ae="_thumbnail_5peha_168",oe="_meta_5peha_176",ce="_name_5peha_183",se="_episode_5peha_205",ie="_iconBtn_5peha_211",le="_metaGap_5peha_257",r={section:z,header:F,headerToggle:O,headerActions:j,title:J,badge:K,clearBtn:V,nextBtn:W,list:Z,item:ee,active:ne,dragging:te,dragHandle:re,thumbnail:ae,meta:oe,name:ce,episode:se,iconBtn:ie,metaGap:le},ue=({item:a,isActive:w,index:g,onRemove:v,onTouchPointerDown:x,onTouchPointerMove:B,onTouchPointerUp:I,onTouchPointerCancel:y,shouldIgnoreClick:_,onDragStart:R,onDragEnter:f,onDragEnd:c,isDragging:b})=>{const o=X(),{titlePreference:i}=Y(),l=a[i]||a.name||"Unknown show";return n("div",{"data-queue-index":g,className:`${r.item} ${w?r.active:""} ${b?r.dragging:""}`,draggable:!0,onDragStart:R,onDragEnter:f,onDragOver:u=>u.preventDefault(),onDragEnd:c,onPointerDown:u=>x(g,u),onPointerMove:B,onPointerUp:I,onPointerCancel:y,children:[n("button",{className:r.dragHandle,type:"button","aria-label":"Drag queue item",children:n(D,{name:"bars"})}),n("img",{className:r.thumbnail,src:L(a.thumbnail||"",72,96),alt:l,loading:"lazy",decoding:"async",onError:u=>{u.currentTarget.src="/placeholder.svg"}}),n("div",{className:r.meta,children:[n("button",{className:r.name,type:"button",onClick:()=>{_()||o(`/watch/${a.showId}/${a.episodeNumber}`)},children:l}),n("div",{className:r.episode,children:["Episode ",a.episodeNumber]})]}),n("button",{className:r.iconBtn,type:"button",onClick:()=>{_()||v(a)},"aria-label":`Remove ${l} episode ${a.episodeNumber} from queue`,children:n(D,{name:"times"})})]})},me=({title:a="Queue",eyebrow:w,items:g,currentShowId:v,currentEpisode:x,onRemove:B,onReorder:I,onNextQueue:y,onClear:_,showClearAll:R=!1,defaultExpanded:f=!0})=>{const[c,b]=s.useState([]),[o,i]=s.useState(null),[l,u]=s.useState(f),N=s.useRef(null),T=s.useRef(null),d=s.useRef(null),h=s.useRef(!1),C=s.useRef(!1);s.useEffect(()=>{b(g)},[g]),s.useEffect(()=>{u(f)},[f]);const $=e=>{i(e)},k=e=>{if(o===null||o===e)return;const t=[...c],p=t[o];t.splice(o,1),t.splice(e,0,p),i(e),b(t)},A=()=>{o!==null&&I(c.map(e=>({id:e.id,showId:e.showId,episodeNumber:e.episodeNumber}))),i(null)},E=(e=!1)=>{d.current!==null&&(window.clearTimeout(d.current),d.current=null),e&&h.current&&(I(c.map(t=>({id:t.id,showId:t.showId,episodeNumber:t.episodeNumber}))),C.current=!0,window.setTimeout(()=>{C.current=!1},0)),N.current=null,T.current=null,h.current=!1,i(null)},Q=(e,t)=>{if(t.pointerType==="mouse")return;const p=t.currentTarget,m=t.pointerId;N.current=t.pointerId,T.current={x:t.clientX,y:t.clientY},d.current!==null&&window.clearTimeout(d.current),d.current=window.setTimeout(()=>{h.current=!0,i(e);try{p.setPointerCapture(m)}catch{}},220)},S=e=>{if(e.pointerType==="mouse"||N.current!==e.pointerId)return;if(!h.current&&T.current){const H=Math.abs(e.clientX-T.current.x),G=Math.abs(e.clientY-T.current.y);(H>8||G>8)&&E(!1);return}if(!h.current)return;e.preventDefault();const p=document.elementFromPoint(e.clientX,e.clientY)?.closest?.("[data-queue-index]"),m=p?Number(p.dataset.queueIndex):NaN;if(Number.isNaN(m)||o===null||m===o)return;const P=[...c],U=P[o];P.splice(o,1),P.splice(m,0,U),i(m),b(P)},q=e=>{e.pointerType!=="mouse"&&N.current===e.pointerId&&E(h.current)},M=e=>{e.pointerType!=="mouse"&&N.current===e.pointerId&&E(!1)};return c.length===0?null:n("section",{className:r.section,children:[n("div",{className:r.header,children:[n("button",{className:r.headerToggle,type:"button",onClick:()=>u(e=>!e),"aria-expanded":l,"aria-label":l?`Collapse ${a}`:`Expand ${a}`,children:[n("span",{className:r.title,children:[n("span",{className:"title-stack",children:[w&&n("div",{className:"section-eyebrow",children:w}),n("span",{children:a})]}),n("span",{className:r.badge,children:c.length})]}),l?n(D,{name:"chevron-up"}):n(D,{name:"chevron-down"})]}),R&&_&&n("div",{className:r.headerActions,children:[y&&c.length>1&&n("button",{className:r.nextBtn,type:"button",onClick:y,children:"Next"}),n("button",{className:r.clearBtn,type:"button",onClick:_,children:"Clear All"})]})]}),l&&n("div",{className:r.list,children:c.map((e,t)=>n(ue,{item:e,isActive:e.showId===v&&e.episodeNumber===x,index:t,onRemove:B,onTouchPointerDown:Q,onTouchPointerMove:S,onTouchPointerUp:q,onTouchPointerCancel:M,shouldIgnoreClick:()=>C.current,onDragStart:()=>$(t),onDragEnter:()=>k(t),onDragEnd:A,isDragging:o===t},e.id))})]})};export{me as Q,r as s};
1
+ import{g as s,u as n,a as X}from"./vendor-core-DfaOB3Rn.js";import{I as D}from"./vendor-icons-DrybRNxP.js";import{d as Y,f as L}from"./index-Bi-DGtzC.js";const z="_section_5peha_1",F="_header_5peha_10",O="_headerToggle_5peha_20",j="_headerActions_5peha_34",J="_title_5peha_40",K="_badge_5peha_50",V="_clearBtn_5peha_65",W="_nextBtn_5peha_83",Z="_list_5peha_101",ee="_item_5peha_115",ne="_active_5peha_135",te="_dragging_5peha_143",re="_dragHandle_5peha_150",ae="_thumbnail_5peha_168",oe="_meta_5peha_176",ce="_name_5peha_183",se="_episode_5peha_205",ie="_iconBtn_5peha_211",le="_metaGap_5peha_257",r={section:z,header:F,headerToggle:O,headerActions:j,title:J,badge:K,clearBtn:V,nextBtn:W,list:Z,item:ee,active:ne,dragging:te,dragHandle:re,thumbnail:ae,meta:oe,name:ce,episode:se,iconBtn:ie,metaGap:le},ue=({item:a,isActive:w,index:g,onRemove:v,onTouchPointerDown:x,onTouchPointerMove:B,onTouchPointerUp:I,onTouchPointerCancel:y,shouldIgnoreClick:_,onDragStart:R,onDragEnter:f,onDragEnd:c,isDragging:b})=>{const o=X(),{titlePreference:i}=Y(),l=a[i]||a.name||"Unknown show";return n("div",{"data-queue-index":g,className:`${r.item} ${w?r.active:""} ${b?r.dragging:""}`,draggable:!0,onDragStart:R,onDragEnter:f,onDragOver:u=>u.preventDefault(),onDragEnd:c,onPointerDown:u=>x(g,u),onPointerMove:B,onPointerUp:I,onPointerCancel:y,children:[n("button",{className:r.dragHandle,type:"button","aria-label":"Drag queue item",children:n(D,{name:"bars"})}),n("img",{className:r.thumbnail,src:L(a.thumbnail||"",72,96),alt:l,loading:"lazy",decoding:"async",onError:u=>{u.currentTarget.src="/placeholder.svg"}}),n("div",{className:r.meta,children:[n("button",{className:r.name,type:"button",onClick:()=>{_()||o(`/watch/${a.showId}/${a.episodeNumber}`)},children:l}),n("div",{className:r.episode,children:["Episode ",a.episodeNumber]})]}),n("button",{className:r.iconBtn,type:"button",onClick:()=>{_()||v(a)},"aria-label":`Remove ${l} episode ${a.episodeNumber} from queue`,children:n(D,{name:"times"})})]})},me=({title:a="Queue",eyebrow:w,items:g,currentShowId:v,currentEpisode:x,onRemove:B,onReorder:I,onNextQueue:y,onClear:_,showClearAll:R=!1,defaultExpanded:f=!0})=>{const[c,b]=s.useState([]),[o,i]=s.useState(null),[l,u]=s.useState(f),N=s.useRef(null),T=s.useRef(null),d=s.useRef(null),h=s.useRef(!1),C=s.useRef(!1);s.useEffect(()=>{b(g)},[g]),s.useEffect(()=>{u(f)},[f]);const $=e=>{i(e)},k=e=>{if(o===null||o===e)return;const t=[...c],p=t[o];t.splice(o,1),t.splice(e,0,p),i(e),b(t)},A=()=>{o!==null&&I(c.map(e=>({id:e.id,showId:e.showId,episodeNumber:e.episodeNumber}))),i(null)},E=(e=!1)=>{d.current!==null&&(window.clearTimeout(d.current),d.current=null),e&&h.current&&(I(c.map(t=>({id:t.id,showId:t.showId,episodeNumber:t.episodeNumber}))),C.current=!0,window.setTimeout(()=>{C.current=!1},0)),N.current=null,T.current=null,h.current=!1,i(null)},Q=(e,t)=>{if(t.pointerType==="mouse")return;const p=t.currentTarget,m=t.pointerId;N.current=t.pointerId,T.current={x:t.clientX,y:t.clientY},d.current!==null&&window.clearTimeout(d.current),d.current=window.setTimeout(()=>{h.current=!0,i(e);try{p.setPointerCapture(m)}catch{}},220)},S=e=>{if(e.pointerType==="mouse"||N.current!==e.pointerId)return;if(!h.current&&T.current){const H=Math.abs(e.clientX-T.current.x),G=Math.abs(e.clientY-T.current.y);(H>8||G>8)&&E(!1);return}if(!h.current)return;e.preventDefault();const p=document.elementFromPoint(e.clientX,e.clientY)?.closest?.("[data-queue-index]"),m=p?Number(p.dataset.queueIndex):NaN;if(Number.isNaN(m)||o===null||m===o)return;const P=[...c],U=P[o];P.splice(o,1),P.splice(m,0,U),i(m),b(P)},q=e=>{e.pointerType!=="mouse"&&N.current===e.pointerId&&E(h.current)},M=e=>{e.pointerType!=="mouse"&&N.current===e.pointerId&&E(!1)};return c.length===0?null:n("section",{className:r.section,children:[n("div",{className:r.header,children:[n("button",{className:r.headerToggle,type:"button",onClick:()=>u(e=>!e),"aria-expanded":l,"aria-label":l?`Collapse ${a}`:`Expand ${a}`,children:[n("span",{className:r.title,children:[n("span",{className:"title-stack",children:[w&&n("div",{className:"section-eyebrow",children:w}),n("span",{children:a})]}),n("span",{className:r.badge,children:c.length})]}),l?n(D,{name:"chevron-up"}):n(D,{name:"chevron-down"})]}),R&&_&&n("div",{className:r.headerActions,children:[y&&c.length>1&&n("button",{className:r.nextBtn,type:"button",onClick:y,children:"Next"}),n("button",{className:r.clearBtn,type:"button",onClick:_,children:"Clear All"})]})]}),l&&n("div",{className:r.list,children:c.map((e,t)=>n(ue,{item:e,isActive:e.showId===v&&e.episodeNumber===x,index:t,onRemove:B,onTouchPointerDown:Q,onTouchPointerMove:S,onTouchPointerUp:q,onTouchPointerCancel:M,shouldIgnoreClick:()=>C.current,onDragStart:()=>$(t),onDragEnter:()=>k(t),onDragEnd:A,isDragging:o===t},e.id))})]})};export{me as Q,r as s};
@@ -1 +1 @@
1
- import{o as U,d as v,h as b,T as w,u as i,S as E}from"./vendor-core-DfaOB3Rn.js";import{M as x}from"./MediaCard-BikTKuG3.js";import{L as F}from"./LibraryListPage-CKEWlzgR.js";import{u as _,M as q}from"./useMangaPopup-B5LPCa2N.js";import{M as D}from"./MangaResetProgressModal-C1Bfn9O_.js";import{m as G}from"./index-Cd1-bH35.js";import{n as O,b as Q,h as Y,j,u as z,o as H,q as K,s as V,M as R,m as Z,i as J,a as W}from"./useMangaLibrary-DAPvo2xZ.js";import"./vendor-icons-DrybRNxP.js";import"./vendor-ui-3qrARCPr.js";import"./useIsMobile-Dvx1uJ82.js";import"./MatureConsentModal-Do1CtwDw.js";import"./SkeletonGrid-BpsynMj7.js";import"./ErrorMessage-DAxegITP.js";import"./LibraryListPage.module-r6k9nyT9.js";import"./usePopup-DS9jMzp6.js";import"./ResetProgressModal-YVCqneQ5.js";import"./vendor-query-BBT5_sHx.js";import"./libraryInvalidation-BHknhNAw.js";const X=["All","Continue Reading",...R],h=24,y=e=>({provider:e.provider,mangaId:e.mangaId,title:e.title,altTitle:e.altTitle,cover:e.cover,contentRating:e.contentRating,readTarget:e.detailTarget,progressLabel:e.progressLabel});function Ra(){const{filter:e="All"}=U(),[g,p]=v(1),[d,u]=v(null);b(()=>{document.title="Reading List - dango"},[]),b(()=>{p(1)},[e]);const r=e==="Continue Reading",n=O(r?"All":e,g,h),s=Q(100),I=Y(),T=j(),{toggle:L,bookmarkedIds:C}=z(),{popup:t,openPopup:k,scheduleClose:c,cancelClose:m,closePopup:f}=_(),M=H(),P=K(),B=V(),S=w(()=>r?(s.data?.data??[]).map(a=>{const o=a.page??0,l=a.pageCount??0;return{key:a.id,libId:a.id,provider:a.provider,mangaId:a.mangaId,title:a.title||"",altTitle:a.altTitle,cover:a.cover||"",status:a.watchlistStatus??"",contentRating:a.contentRating||void 0,chapterLabel:a.chapterNumber?`Ch. ${a.chapterNumber}`:void 0,progressPercent:l>0?o/l*100:0,progressLabel:a.chapterNumber&&l>0?`Ch. ${a.chapterNumber} · p. ${o}/${l}`:void 0,detailTarget:a.chapterId&&a.provider&&a.mangaId?`/manga/${a.provider}/${encodeURIComponent(a.mangaId)}/read?chapter=${encodeURIComponent(a.chapterId)}`:`/manga/${a.provider}/${encodeURIComponent(a.mangaId)}`}}):(n.data?.data??[]).map(a=>({key:a.id,libId:a.id,provider:a.provider,mangaId:a.mangaId,title:a.title||"",altTitle:a.altTitle,cover:a.cover||"",status:a.status,contentRating:a.contentRating||void 0,chapterLabel:a.lastChapterNumber?`Ch. ${a.lastChapterNumber}`:void 0,progressPercent:void 0,progressLabel:void 0,detailTarget:`/manga/${a.provider}/${encodeURIComponent(a.mangaId)}`})),[r,s.data,n.data]),$=r?s.data?.total??0:n.data?.total??0,A=r?s.isLoading:n.isLoading,N=r?s.error:n.error;return i(F,{headerTitle:"My Reading List",headerSubtitle:"Track and manage your manga collection",filters:X,filterBy:e,filterBasePath:"/reading-list",continueFilter:"Continue Reading",statusOptions:[...R],entries:S,total:$,isLoading:A,error:N,page:g,pageSize:h,onPageChange:p,emptyTitle:"Your reading list is looking a bit lonely",emptyFilteredText:"No titles match this filter.",emptyAllText:"Let's find something to read!",browseLabel:"Browse Manga",browseTarget:"/manga",removeListLabel:"Remove from Reading List",listNoun:"reading list",skipConfirmKey:"mangaSkipRemoveConfirmation",onBulkStatus:(a,o)=>M.mutate({ids:a,status:o}),onBulkRemove:a=>{r?B.mutate({ids:a}):P.mutate(a)},onStatusChange:(a,o)=>T.mutate({id:a,status:o}),onRemoveItem:a=>I.mutate(a),renderCard:a=>i(x,{item:{id:a.libId,title:a.title,...W({title:a.title,altTitle:a.altTitle}),thumbnail:G(a.provider,a.cover),chapterBadge:a.chapterLabel??null,isAdult:J(a)},linkTo:a.detailTarget,hoverIcon:"book",progress:a.progressPercent!==void 0&&a.progressLabel?{percent:a.progressPercent,label:a.progressLabel}:void 0,showProgress:r,display:{elements:{poster:{typeBadge:!1,chapterBadge:!0,adultBadge:!0},info:{title:!0,mobileBadges:!0,progress:!0,meta:!1}}},onRemove:r?()=>u(a):void 0,onOpenDetails:o=>k(o,y(a)),onPopupHoverIntent:o=>o?m():c(),rawThumbnail:!0}),modals:i(E,{children:[t&&t.data.provider&&i(q,{data:t.data,anchorRect:t.rect,bookmarked:C.has(Z(t.data.provider,t.data.mangaId)),onToggleBookmark:()=>L({id:t.data.mangaId,provider:t.data.provider,title:t.data.title,cover:t.data.cover,altTitle:t.data.altTitle??void 0,contentRating:t.data.contentRating}),onMouseEnter:m,onMouseLeave:c,onRequestClose:f}),i(D,{mangaId:d?d.libId:null,title:d?.title,onClose:()=>u(null)})]})})}export{Ra as default};
1
+ import{o as U,d as v,h as b,T as w,u as i,S as E}from"./vendor-core-DfaOB3Rn.js";import{M as x}from"./MediaCard-DW8QbvWe.js";import{L as F}from"./LibraryListPage-XHeMv9aN.js";import{u as _,M as q}from"./useMangaPopup-BMXrc7pH.js";import{M as D}from"./MangaResetProgressModal-DdnI3zEg.js";import{m as G}from"./index-Bi-DGtzC.js";import{n as O,b as Q,h as Y,j,u as z,o as H,q as K,s as V,M as R,m as Z,i as J,a as W}from"./useMangaLibrary-i1RAEkNy.js";import"./vendor-icons-DrybRNxP.js";import"./vendor-ui-3qrARCPr.js";import"./useIsMobile-Dvx1uJ82.js";import"./MatureConsentModal-BXFvhDf0.js";import"./SkeletonGrid-BVWffnlT.js";import"./ErrorMessage-DAxegITP.js";import"./LibraryListPage.module-r6k9nyT9.js";import"./usePopup-DS9jMzp6.js";import"./ResetProgressModal-BpNG6BGY.js";import"./vendor-query-BBT5_sHx.js";import"./libraryInvalidation-B5vX-vJv.js";const X=["All","Continue Reading",...R],h=24,y=e=>({provider:e.provider,mangaId:e.mangaId,title:e.title,altTitle:e.altTitle,cover:e.cover,contentRating:e.contentRating,readTarget:e.detailTarget,progressLabel:e.progressLabel});function Ra(){const{filter:e="All"}=U(),[g,p]=v(1),[d,u]=v(null);b(()=>{document.title="Reading List - dango"},[]),b(()=>{p(1)},[e]);const r=e==="Continue Reading",n=O(r?"All":e,g,h),s=Q(100),I=Y(),T=j(),{toggle:L,bookmarkedIds:C}=z(),{popup:t,openPopup:k,scheduleClose:c,cancelClose:m,closePopup:f}=_(),M=H(),P=K(),B=V(),S=w(()=>r?(s.data?.data??[]).map(a=>{const o=a.page??0,l=a.pageCount??0;return{key:a.id,libId:a.id,provider:a.provider,mangaId:a.mangaId,title:a.title||"",altTitle:a.altTitle,cover:a.cover||"",status:a.watchlistStatus??"",contentRating:a.contentRating||void 0,chapterLabel:a.chapterNumber?`Ch. ${a.chapterNumber}`:void 0,progressPercent:l>0?o/l*100:0,progressLabel:a.chapterNumber&&l>0?`Ch. ${a.chapterNumber} · p. ${o}/${l}`:void 0,detailTarget:a.chapterId&&a.provider&&a.mangaId?`/manga/${a.provider}/${encodeURIComponent(a.mangaId)}/read?chapter=${encodeURIComponent(a.chapterId)}`:`/manga/${a.provider}/${encodeURIComponent(a.mangaId)}`}}):(n.data?.data??[]).map(a=>({key:a.id,libId:a.id,provider:a.provider,mangaId:a.mangaId,title:a.title||"",altTitle:a.altTitle,cover:a.cover||"",status:a.status,contentRating:a.contentRating||void 0,chapterLabel:a.lastChapterNumber?`Ch. ${a.lastChapterNumber}`:void 0,progressPercent:void 0,progressLabel:void 0,detailTarget:`/manga/${a.provider}/${encodeURIComponent(a.mangaId)}`})),[r,s.data,n.data]),$=r?s.data?.total??0:n.data?.total??0,A=r?s.isLoading:n.isLoading,N=r?s.error:n.error;return i(F,{headerTitle:"My Reading List",headerSubtitle:"Track and manage your manga collection",filters:X,filterBy:e,filterBasePath:"/reading-list",continueFilter:"Continue Reading",statusOptions:[...R],entries:S,total:$,isLoading:A,error:N,page:g,pageSize:h,onPageChange:p,emptyTitle:"Your reading list is looking a bit lonely",emptyFilteredText:"No titles match this filter.",emptyAllText:"Let's find something to read!",browseLabel:"Browse Manga",browseTarget:"/manga",removeListLabel:"Remove from Reading List",listNoun:"reading list",skipConfirmKey:"mangaSkipRemoveConfirmation",onBulkStatus:(a,o)=>M.mutate({ids:a,status:o}),onBulkRemove:a=>{r?B.mutate({ids:a}):P.mutate(a)},onStatusChange:(a,o)=>T.mutate({id:a,status:o}),onRemoveItem:a=>I.mutate(a),renderCard:a=>i(x,{item:{id:a.libId,title:a.title,...W({title:a.title,altTitle:a.altTitle}),thumbnail:G(a.provider,a.cover),chapterBadge:a.chapterLabel??null,isAdult:J(a)},linkTo:a.detailTarget,hoverIcon:"book",progress:a.progressPercent!==void 0&&a.progressLabel?{percent:a.progressPercent,label:a.progressLabel}:void 0,showProgress:r,display:{elements:{poster:{typeBadge:!1,chapterBadge:!0,adultBadge:!0},info:{title:!0,mobileBadges:!0,progress:!0,meta:!1}}},onRemove:r?()=>u(a):void 0,onOpenDetails:o=>k(o,y(a)),onPopupHoverIntent:o=>o?m():c(),rawThumbnail:!0}),modals:i(E,{children:[t&&t.data.provider&&i(q,{data:t.data,anchorRect:t.rect,bookmarked:C.has(Z(t.data.provider,t.data.mangaId)),onToggleBookmark:()=>L({id:t.data.mangaId,provider:t.data.provider,title:t.data.title,cover:t.data.cover,altTitle:t.data.altTitle??void 0,contentRating:t.data.contentRating}),onMouseEnter:m,onMouseLeave:c,onRequestClose:f}),i(D,{mangaId:d?d.libId:null,title:d?.title,onClose:()=>u(null)})]})})}export{Ra as default};
@@ -1 +1 @@
1
- import{d as f,h as u,u as e}from"./vendor-core-DfaOB3Rn.js";import{Q as a,B as c}from"./index-Cd1-bH35.js";const g=({isOpen:o,itemName:n,progressKind:d,listLabel:i,onClose:s,onConfirm:h})=>{const[l,r]=f(!1);return u(()=>{o&&r(!1)},[o]),e(a,{isOpen:o,onClose:()=>{r(!1),s()},title:"Reset Progress",children:[e(a.Body,{children:[e("p",{children:["Are you sure you want to remove your ",d,' progress for "',n,'"?']}),e("label",{children:[e("input",{type:"checkbox",checked:l,onChange:t=>r(t.currentTarget.checked)}),"Also remove from ",i]})]}),e(a.Actions,{children:[e(c,{variant:"secondary",onClick:()=>{r(!1),s()},children:"No"}),e(c,{variant:"danger",onClick:()=>{const t=l;r(!1),h(t),s()},children:"Yes"})]})]})};export{g as R};
1
+ import{d as f,h as u,u as e}from"./vendor-core-DfaOB3Rn.js";import{Q as a,B as c}from"./index-Bi-DGtzC.js";const g=({isOpen:o,itemName:n,progressKind:d,listLabel:i,onClose:s,onConfirm:h})=>{const[l,r]=f(!1);return u(()=>{o&&r(!1)},[o]),e(a,{isOpen:o,onClose:()=>{r(!1),s()},title:"Reset Progress",children:[e(a.Body,{children:[e("p",{children:["Are you sure you want to remove your ",d,' progress for "',n,'"?']}),e("label",{children:[e("input",{type:"checkbox",checked:l,onChange:t=>r(t.currentTarget.checked)}),"Also remove from ",i]})]}),e(a.Actions,{children:[e(c,{variant:"secondary",onClick:()=>{r(!1),s()},children:"No"}),e(c,{variant:"danger",onClick:()=>{const t=l;r(!1),h(t),s()},children:"Yes"})]})]})};export{g as R};
@@ -1 +1 @@
1
- import{h as _,p as pe,a as fe,d as o,A as ge,g as Le,u as a}from"./vendor-core-DfaOB3Rn.js";import{I as f}from"./vendor-icons-DrybRNxP.js";import{P as ae}from"./MediaCard-BikTKuG3.js";import{A as Ae}from"./AnimeCard-DeOILoQY.js";import{S as Se}from"./SkeletonGrid-BpsynMj7.js";import{t as ye,u as be,G as Ne,a9 as te,B as x,aa as Te}from"./index-Cd1-bH35.js";import{E as Ce}from"./ErrorMessage-DAxegITP.js";import{A as Ee}from"./ActiveFilterChips-olGfwxle.js";import{s as t}from"./Search.module-C_qwCdHS.js";import"./vendor-ui-3qrARCPr.js";import"./useIsMobile-Dvx1uJ82.js";import"./MatureConsentModal-Do1CtwDw.js";import"./useAnimeInfoData-l7nCKCe5.js";import"./vendor-query-BBT5_sHx.js";import"./QueueOptionsButton-CUyJPdwg.js";import"./playbackCompletion-ZhAwimeL.js";const Re=[{value:"ALL",label:"All Types"},{value:"TV",label:"TV Series"},{value:"Movie",label:"Movie"},{value:"OVA",label:"OVA"},{value:"ONA",label:"ONA"},{value:"TV_SHORT",label:"TV Short"},{value:"SPECIAL",label:"Special"},{value:"ADULT",label:"Mature"}],Ie=[{value:"ALL",label:"All Seasons"},{value:"Winter",label:"Winter"},{value:"Spring",label:"Spring"},{value:"Summer",label:"Summer"},{value:"Fall",label:"Fall"}],De=[{value:"ALL",label:"All Countries"},{value:"JP",label:"Japan"},{value:"CN",label:"China"}],Pe=[{value:"POPULARITY_DESC",label:"Popularity"},{value:"TRENDING_DESC",label:"Trending"},{value:"SCORE_DESC",label:"Score"},{value:"START_DATE_DESC",label:"Newest"},{value:"START_DATE_ASC",label:"Oldest"},{value:"EPISODES_DESC",label:"Most Episodes"},{value:"FAVOURITES_DESC",label:"Favourites"}],Oe=[{value:"RELEASING",label:"Currently Airing"},{value:"FINISHED",label:"Finished"},{value:"NOT_YET_RELEASED",label:"Not Yet Released"},{value:"CANCELLED",label:"Cancelled"},{value:"HIATUS",label:"Hiatus"}];function We(){_(()=>{document.title="Search - dango"},[]);const[r,le]=pe(),se=fe(),[m,G]=o(r.get("query")||""),[v,B]=o(parseInt(r.get("page")||"1")),[d,g]=o(r.get("type")||"ALL"),[L,A]=o(r.get("season")||"ALL"),[S,y]=o(r.get("year")||"ALL"),[Y,R]=o(r.get("country")||"ALL"),[k,re]=o(r.get("provider")||"anilist"),[U,I]=o(r.get("sortBy")||"POPULARITY_DESC"),[$,D]=o(r.get("status")||""),[b,ne]=o(!1),[ie,F]=o(null);_(()=>{let e=!1;return ye.data.anilistStatus.query().then(s=>{e||F(s.available)}).catch(()=>{e||F(!0)}),()=>{e=!0}},[]);const{lowEndMode:oe}=be(),P=ge(null),{data:ce}=Ne(),M=ce?.genres||[],[N,T]=o(()=>{const e={},s=r.get("genres")?.split(",").map(l=>l.trim()).filter(Boolean)||[],n=r.get("excludeGenres")?.split(",").map(l=>l.trim()).filter(Boolean)||[];return s.forEach(l=>l&&(e[l]="include")),n.forEach(l=>l&&(e[l]="exclude")),e}),V=new URLSearchParams(r);V.delete("page");const j=V.toString(),{data:p=[],isLoading:C,isError:ue,error:de}=te(j,v,14),{data:q}=te(j,v+1,14),[O,he]=o(!1),E=Le.useMemo(()=>k==="anilist"&&d==="ADULT"||O?p:p.filter(e=>!(e.isAdult||e.rating==="R+"||e.rating==="Rx"||e.rating?.includes("17+"))),[p,O,k,d]);_(()=>{G(r.get("query")||""),g(r.get("type")||"ALL"),A(r.get("season")||"ALL"),y(r.get("year")||"ALL"),R(r.get("country")||"ALL"),re(r.get("provider")||"anilist"),I(r.get("sortBy")||"POPULARITY_DESC"),D(r.get("status")||""),B(parseInt(r.get("page")||"1"));const e={},s=r.get("genres")?.split(",").map(l=>l.trim()).filter(Boolean)||[],n=r.get("excludeGenres")?.split(",").map(l=>l.trim()).filter(Boolean)||[];s.forEach(l=>l&&(e[l]="include")),n.forEach(l=>l&&(e[l]="exclude")),T(e)},[r]);const c=(e=1,s={})=>{Te();const n=s.type??d,l=s.status??$,W=s.season??L,J=s.year??S,K=s.country??Y,Q=s.sort??U,X=s.genreState??N,ve=s.showMature??O,i=new URLSearchParams;m.trim()&&i.set("query",m.trim()),n!=="ALL"&&i.set("type",n),l&&i.set("status",l),W!=="ALL"&&i.set("season",W),J!=="ALL"&&i.set("year",J),K!=="ALL"&&i.set("country",K),Q!=="POPULARITY_DESC"&&i.set("sortBy",Q);const Z=Object.entries(X).filter(([,u])=>u==="include").map(([u])=>u),ee=Object.entries(X).filter(([,u])=>u==="exclude").map(([u])=>u);Z.length>0&&i.set("genres",Z.join(",")),ee.length>0&&i.set("excludeGenres",ee.join(",")),n!=="ADULT"&&!ve&&i.set("adult","false"),i.set("provider","anilist"),e>1&&i.set("page",e.toString()),le(i),e!==v&&B(e)},z=e=>{if(c(e),P.current){const s=P.current.getBoundingClientRect().top+window.scrollY-100;window.scrollTo({top:s,behavior:"smooth"})}},w=new Date().getFullYear(),me=[{value:"ALL",label:"All Years"},...Array.from({length:w-1980+1},(e,s)=>({value:String(w-s),label:String(w-s)}))],H=p.length>=14&&q&&q.length>0,h=[];d!=="ALL"&&h.push({key:"type",label:`Type: ${d}`,onRemove:()=>{g("ALL"),c(1,{type:"ALL"})}}),L!=="ALL"&&h.push({key:"season",label:`Season: ${L}`,onRemove:()=>{A("ALL"),c(1,{season:"ALL"})}}),S!=="ALL"&&h.push({key:"year",label:`Year: ${S}`,onRemove:()=>{y("ALL"),c(1,{year:"ALL"})}});for(const[e,s]of Object.entries(N))h.push({key:e,label:s==="include"?`+ ${e}`:`-${e}`,tone:s==="include"?"primary":"danger",onRemove:()=>{const n={...N};delete n[e],T(n),c(1,{genreState:n})}});return a("div",{className:"page-container",children:[a("div",{className:t.header,children:[a("h1",{className:t.pageTitle,children:"Search Anime"}),a("p",{className:t.pageSubtitle,children:"Search through thousands of titles and discover your next favorite"})]}),a("div",{className:t.filterContainer,children:[a("div",{className:t.searchBarWrapper,children:[a("div",{className:t.inputIconWrapper,children:[a(f,{name:"search",className:t.searchIcon}),a("input",{type:"text","data-virtual-keyboard":"true",className:t.searchInput,placeholder:"Search by title, character, or studio...",value:m,onInput:e=>G(e.currentTarget.value),onKeyDown:e=>e.key==="Enter"&&c()})]}),a("div",{className:t.searchActions,children:[a(x,{onClick:()=>c(),className:t.searchBtn,children:"Search"}),a("button",{className:`${t.filterToggleBtn} ${b?t.active:""}`,onClick:()=>ne(!b),children:[a(f,{name:"filter",size:14}),a("span",{children:"Filters"}),b?a(f,{name:"chevron-up",size:12}):a(f,{name:"chevron-down",size:12})]})]})]}),a("div",{className:`${t.advancedFilters} ${b?t.show:""}`,children:[a("div",{className:t.filterDivider}),a("div",{className:t.filterGrid,children:[a("div",{className:t.filterItem,children:[a("label",{children:"Type"}),a("select",{value:d,onChange:e=>{if(e.currentTarget.value==="ADULT"){se("/mature?provider=mal");return}g(e.currentTarget.value)},children:Re.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Status"}),a("select",{value:$,onChange:e=>D(e.currentTarget.value),children:[a("option",{value:"",children:"All Status"}),Oe.map(e=>a("option",{value:e.value,children:e.label},e.value))]})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Season"}),a("select",{value:L,onChange:e=>A(e.currentTarget.value),children:Ie.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Year"}),a("select",{value:S,onChange:e=>y(e.currentTarget.value),children:me.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:["Country",ie===!1&&a("span",{style:{display:"block",fontSize:"0.75rem",color:"var(--text-muted)",fontWeight:400},children:"AniList only - ignored by fallback providers"})]}),a("select",{value:Y,onChange:e=>R(e.currentTarget.value),children:De.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Sort By"}),a("select",{value:U,onChange:e=>I(e.currentTarget.value),children:Pe.map(e=>a("option",{value:e.value,children:e.label},e.value))})]})]}),M.length>0&&a("div",{className:t.genreSection,children:[a("label",{className:t.genreLabel,children:"Genres"}),a("div",{className:t.genreContainer,children:M.map(e=>a("button",{className:`${t.genreButton} ${t[N[e]||""]}`,onClick:()=>{T(s=>{const n=s[e],l={...s};return n==="include"?l[e]="exclude":n==="exclude"?delete l[e]:l[e]="include",l})},children:e},e))})]}),a("div",{className:t.filterActions,children:[a(x,{variant:"secondary",onClick:()=>{T({}),g("ALL"),A("ALL"),y("ALL"),R("ALL"),I("POPULARITY_DESC"),D(""),he(!1),c(1,{type:"ALL",status:"",season:"ALL",year:"ALL",country:"ALL",sort:"POPULARITY_DESC",genreState:{},showMature:!1})},children:"Reset All"}),a(x,{onClick:()=>c(),className:t.applyBtn,children:"Apply Filters"})]})]})]}),ue&&a(Ce,{message:de?.message||"Error"}),h.length>0&&a(Ee,{chips:h}),a("div",{className:t.resultsHeader,ref:P,children:[a("h2",{className:t.resultsTitle,children:m?`Search Results for "${m}"`:"Discover Anime"}),E.length>0&&a(ae,{page:v,canGoNext:H,onChange:z,isLoading:C})]}),a("div",{className:`${t.resultsGrid} ${oe?t.lowEnd:""}`,children:C?a(Se,{}):E.map(e=>a(Ae,{anime:e},e._id))}),!C&&E.length===0&&a("div",{className:t.noResults,children:[a(f,{name:"search",size:48,className:t.noResultsIcon}),a("h3",{children:"No results found"}),a("p",{children:"Try adjusting your search or filters to find what you're looking for."})]}),E.length>0&&a("div",{className:t.bottomPagination,children:a(ae,{page:v,canGoNext:H,onChange:z,isLoading:C,variant:"labeled"})})]})}export{We as default};
1
+ import{h as _,p as pe,a as fe,d as o,A as ge,g as Le,u as a}from"./vendor-core-DfaOB3Rn.js";import{I as f}from"./vendor-icons-DrybRNxP.js";import{P as ae}from"./MediaCard-DW8QbvWe.js";import{A as Ae}from"./AnimeCard-G3oigO8B.js";import{S as Se}from"./SkeletonGrid-BVWffnlT.js";import{t as ye,u as be,G as Ne,a9 as te,B as x,aa as Te}from"./index-Bi-DGtzC.js";import{E as Ce}from"./ErrorMessage-DAxegITP.js";import{A as Ee}from"./ActiveFilterChips-olGfwxle.js";import{s as t}from"./Search.module-C_qwCdHS.js";import"./vendor-ui-3qrARCPr.js";import"./useIsMobile-Dvx1uJ82.js";import"./MatureConsentModal-BXFvhDf0.js";import"./useAnimeInfoData-CQTVAjpz.js";import"./vendor-query-BBT5_sHx.js";import"./QueueOptionsButton-B2p9VIz2.js";import"./playbackCompletion-Dz3OK72-.js";const Re=[{value:"ALL",label:"All Types"},{value:"TV",label:"TV Series"},{value:"Movie",label:"Movie"},{value:"OVA",label:"OVA"},{value:"ONA",label:"ONA"},{value:"TV_SHORT",label:"TV Short"},{value:"SPECIAL",label:"Special"},{value:"ADULT",label:"Mature"}],Ie=[{value:"ALL",label:"All Seasons"},{value:"Winter",label:"Winter"},{value:"Spring",label:"Spring"},{value:"Summer",label:"Summer"},{value:"Fall",label:"Fall"}],De=[{value:"ALL",label:"All Countries"},{value:"JP",label:"Japan"},{value:"CN",label:"China"}],Pe=[{value:"POPULARITY_DESC",label:"Popularity"},{value:"TRENDING_DESC",label:"Trending"},{value:"SCORE_DESC",label:"Score"},{value:"START_DATE_DESC",label:"Newest"},{value:"START_DATE_ASC",label:"Oldest"},{value:"EPISODES_DESC",label:"Most Episodes"},{value:"FAVOURITES_DESC",label:"Favourites"}],Oe=[{value:"RELEASING",label:"Currently Airing"},{value:"FINISHED",label:"Finished"},{value:"NOT_YET_RELEASED",label:"Not Yet Released"},{value:"CANCELLED",label:"Cancelled"},{value:"HIATUS",label:"Hiatus"}];function We(){_(()=>{document.title="Search - dango"},[]);const[r,le]=pe(),se=fe(),[m,G]=o(r.get("query")||""),[v,B]=o(parseInt(r.get("page")||"1")),[d,g]=o(r.get("type")||"ALL"),[L,A]=o(r.get("season")||"ALL"),[S,y]=o(r.get("year")||"ALL"),[Y,R]=o(r.get("country")||"ALL"),[k,re]=o(r.get("provider")||"anilist"),[U,I]=o(r.get("sortBy")||"POPULARITY_DESC"),[$,D]=o(r.get("status")||""),[b,ne]=o(!1),[ie,F]=o(null);_(()=>{let e=!1;return ye.data.anilistStatus.query().then(s=>{e||F(s.available)}).catch(()=>{e||F(!0)}),()=>{e=!0}},[]);const{lowEndMode:oe}=be(),P=ge(null),{data:ce}=Ne(),M=ce?.genres||[],[N,T]=o(()=>{const e={},s=r.get("genres")?.split(",").map(l=>l.trim()).filter(Boolean)||[],n=r.get("excludeGenres")?.split(",").map(l=>l.trim()).filter(Boolean)||[];return s.forEach(l=>l&&(e[l]="include")),n.forEach(l=>l&&(e[l]="exclude")),e}),V=new URLSearchParams(r);V.delete("page");const j=V.toString(),{data:p=[],isLoading:C,isError:ue,error:de}=te(j,v,14),{data:q}=te(j,v+1,14),[O,he]=o(!1),E=Le.useMemo(()=>k==="anilist"&&d==="ADULT"||O?p:p.filter(e=>!(e.isAdult||e.rating==="R+"||e.rating==="Rx"||e.rating?.includes("17+"))),[p,O,k,d]);_(()=>{G(r.get("query")||""),g(r.get("type")||"ALL"),A(r.get("season")||"ALL"),y(r.get("year")||"ALL"),R(r.get("country")||"ALL"),re(r.get("provider")||"anilist"),I(r.get("sortBy")||"POPULARITY_DESC"),D(r.get("status")||""),B(parseInt(r.get("page")||"1"));const e={},s=r.get("genres")?.split(",").map(l=>l.trim()).filter(Boolean)||[],n=r.get("excludeGenres")?.split(",").map(l=>l.trim()).filter(Boolean)||[];s.forEach(l=>l&&(e[l]="include")),n.forEach(l=>l&&(e[l]="exclude")),T(e)},[r]);const c=(e=1,s={})=>{Te();const n=s.type??d,l=s.status??$,W=s.season??L,J=s.year??S,K=s.country??Y,Q=s.sort??U,X=s.genreState??N,ve=s.showMature??O,i=new URLSearchParams;m.trim()&&i.set("query",m.trim()),n!=="ALL"&&i.set("type",n),l&&i.set("status",l),W!=="ALL"&&i.set("season",W),J!=="ALL"&&i.set("year",J),K!=="ALL"&&i.set("country",K),Q!=="POPULARITY_DESC"&&i.set("sortBy",Q);const Z=Object.entries(X).filter(([,u])=>u==="include").map(([u])=>u),ee=Object.entries(X).filter(([,u])=>u==="exclude").map(([u])=>u);Z.length>0&&i.set("genres",Z.join(",")),ee.length>0&&i.set("excludeGenres",ee.join(",")),n!=="ADULT"&&!ve&&i.set("adult","false"),i.set("provider","anilist"),e>1&&i.set("page",e.toString()),le(i),e!==v&&B(e)},z=e=>{if(c(e),P.current){const s=P.current.getBoundingClientRect().top+window.scrollY-100;window.scrollTo({top:s,behavior:"smooth"})}},w=new Date().getFullYear(),me=[{value:"ALL",label:"All Years"},...Array.from({length:w-1980+1},(e,s)=>({value:String(w-s),label:String(w-s)}))],H=p.length>=14&&q&&q.length>0,h=[];d!=="ALL"&&h.push({key:"type",label:`Type: ${d}`,onRemove:()=>{g("ALL"),c(1,{type:"ALL"})}}),L!=="ALL"&&h.push({key:"season",label:`Season: ${L}`,onRemove:()=>{A("ALL"),c(1,{season:"ALL"})}}),S!=="ALL"&&h.push({key:"year",label:`Year: ${S}`,onRemove:()=>{y("ALL"),c(1,{year:"ALL"})}});for(const[e,s]of Object.entries(N))h.push({key:e,label:s==="include"?`+ ${e}`:`-${e}`,tone:s==="include"?"primary":"danger",onRemove:()=>{const n={...N};delete n[e],T(n),c(1,{genreState:n})}});return a("div",{className:"page-container",children:[a("div",{className:t.header,children:[a("h1",{className:t.pageTitle,children:"Search Anime"}),a("p",{className:t.pageSubtitle,children:"Search through thousands of titles and discover your next favorite"})]}),a("div",{className:t.filterContainer,children:[a("div",{className:t.searchBarWrapper,children:[a("div",{className:t.inputIconWrapper,children:[a(f,{name:"search",className:t.searchIcon}),a("input",{type:"text","data-virtual-keyboard":"true",className:t.searchInput,placeholder:"Search by title, character, or studio...",value:m,onInput:e=>G(e.currentTarget.value),onKeyDown:e=>e.key==="Enter"&&c()})]}),a("div",{className:t.searchActions,children:[a(x,{onClick:()=>c(),className:t.searchBtn,children:"Search"}),a("button",{className:`${t.filterToggleBtn} ${b?t.active:""}`,onClick:()=>ne(!b),children:[a(f,{name:"filter",size:14}),a("span",{children:"Filters"}),b?a(f,{name:"chevron-up",size:12}):a(f,{name:"chevron-down",size:12})]})]})]}),a("div",{className:`${t.advancedFilters} ${b?t.show:""}`,children:[a("div",{className:t.filterDivider}),a("div",{className:t.filterGrid,children:[a("div",{className:t.filterItem,children:[a("label",{children:"Type"}),a("select",{value:d,onChange:e=>{if(e.currentTarget.value==="ADULT"){se("/mature?provider=mal");return}g(e.currentTarget.value)},children:Re.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Status"}),a("select",{value:$,onChange:e=>D(e.currentTarget.value),children:[a("option",{value:"",children:"All Status"}),Oe.map(e=>a("option",{value:e.value,children:e.label},e.value))]})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Season"}),a("select",{value:L,onChange:e=>A(e.currentTarget.value),children:Ie.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Year"}),a("select",{value:S,onChange:e=>y(e.currentTarget.value),children:me.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:["Country",ie===!1&&a("span",{style:{display:"block",fontSize:"0.75rem",color:"var(--text-muted)",fontWeight:400},children:"AniList only - ignored by fallback providers"})]}),a("select",{value:Y,onChange:e=>R(e.currentTarget.value),children:De.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Sort By"}),a("select",{value:U,onChange:e=>I(e.currentTarget.value),children:Pe.map(e=>a("option",{value:e.value,children:e.label},e.value))})]})]}),M.length>0&&a("div",{className:t.genreSection,children:[a("label",{className:t.genreLabel,children:"Genres"}),a("div",{className:t.genreContainer,children:M.map(e=>a("button",{className:`${t.genreButton} ${t[N[e]||""]}`,onClick:()=>{T(s=>{const n=s[e],l={...s};return n==="include"?l[e]="exclude":n==="exclude"?delete l[e]:l[e]="include",l})},children:e},e))})]}),a("div",{className:t.filterActions,children:[a(x,{variant:"secondary",onClick:()=>{T({}),g("ALL"),A("ALL"),y("ALL"),R("ALL"),I("POPULARITY_DESC"),D(""),he(!1),c(1,{type:"ALL",status:"",season:"ALL",year:"ALL",country:"ALL",sort:"POPULARITY_DESC",genreState:{},showMature:!1})},children:"Reset All"}),a(x,{onClick:()=>c(),className:t.applyBtn,children:"Apply Filters"})]})]})]}),ue&&a(Ce,{message:de?.message||"Error"}),h.length>0&&a(Ee,{chips:h}),a("div",{className:t.resultsHeader,ref:P,children:[a("h2",{className:t.resultsTitle,children:m?`Search Results for "${m}"`:"Discover Anime"}),E.length>0&&a(ae,{page:v,canGoNext:H,onChange:z,isLoading:C})]}),a("div",{className:`${t.resultsGrid} ${oe?t.lowEnd:""}`,children:C?a(Se,{}):E.map(e=>a(Ae,{anime:e},e._id))}),!C&&E.length===0&&a("div",{className:t.noResults,children:[a(f,{name:"search",size:48,className:t.noResultsIcon}),a("h3",{children:"No results found"}),a("p",{children:"Try adjusting your search or filters to find what you're looking for."})]}),E.length>0&&a("div",{className:t.bottomPagination,children:a(ae,{page:v,canGoNext:H,onChange:z,isLoading:C,variant:"labeled"})})]})}export{We as default};
@@ -1,4 +1,4 @@
1
- import{d as s,u as e,S as ge,A as Z,h as M,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{R as ee,S as J,U,V as be,B as S,W as Ke,Q as E,d as Ue,L as _e,t as b,v as Te,o as Ee,J as Ce,X,q as H,Y as ke,Z as Fe,_ as $e,u as He,e as We,$ as Be,K as le,p as je,a0 as Qe,a1 as Ve}from"./index-Cd1-bH35.js";import{I as B}from"./vendor-icons-DrybRNxP.js";import{T as $}from"./ToggleSwitch-CN_ppEc9.js";import{M as Ye}from"./MatureConsentModal-Do1CtwDw.js";const Je="_sectionCard_1vuib_1",Xe="_dangerCard_1vuib_20",Ze="_settingRow_1vuib_31",T={sectionCard:Je,dangerCard:Xe,settingRow:Ze};function et(){const{data:t}=pe(ee),{data:i}=pe({queryKey:["profiles"],queryFn:()=>J("/api/profiles/status"),enabled:!!t?.owner}),l=te(),[g,f]=s(null),[d,C]=s(""),[m,o]=s(""),[a,p]=s(""),[y,u]=s(""),[L,c]=s(""),[v,_]=s(!1),[I,O]=s(null),P=async n=>{_(!0),c("");try{await J("/api/profiles/update",{method:"POST",body:JSON.stringify(n)}),await l.invalidateQueries({queryKey:ee.queryKey}),C(""),o(""),c("Profile saved")}catch(N){c(N.message)}finally{_(!1)}};return t?e("section",{className:T.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 n=>{const N=n.currentTarget.files?.[0];if(n.currentTarget.value="",!N)return;if(N.size>2*1024*1024){c("Image must be smaller than 2 MB");return}const R=new FileReader;R.onerror=()=>c("Could not read image"),R.onload=()=>{P({avatar:R.result})},R.readAsDataURL(N)}})]}),t.avatar&&e(S,{variant:"secondary",disabled:v,onClick:()=>P({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:n=>{n.preventDefault(),P({name:g??t.name})},children:[e("label",{className:U.field,children:["Profile name",e("input",{value:g??t.name,maxLength:60,required:!0,onChange:n=>f(n.currentTarget.value)})]}),e(S,{type:"submit",disabled:v,children:"Save name"})]}),e("form",{className:U.form,onSubmit:n=>{n.preventDefault(),P({password:d,currentPassword:m})},children:[t.protected&&e("label",{className:U.field,children:["Current password",e("input",{type:"password",autoComplete:"current-password",value:m,required:!0,maxLength:256,onChange:n=>o(n.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:d,minLength:8,maxLength:256,onChange:n=>C(n.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"}),Ke()}catch(n){c(n.message),_(!1)}},children:"Switch profile / sign out"}),t.owner&&e("form",{className:U.form,onSubmit:async n=>{n.preventDefault(),_(!0),c("");try{await J("/api/profiles/create",{method:"POST",body:JSON.stringify({name:a,password:y})}),p(""),u(""),await l.invalidateQueries({queryKey:["profiles"]}),c("Profile created. Sign out to switch to it.")}catch(N){c(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:a,onChange:n=>p(n.currentTarget.value)})]}),e("label",{className:U.field,children:["Password (optional)",e("input",{type:"password",autoComplete:"new-password",minLength:8,maxLength:256,value:y,onChange:n=>u(n.currentTarget.value)})]}),e(S,{type:"submit",disabled:v||!t.protected,children:"Create profile"})]}),t.owner&&i?.profiles.some(n=>!n.owner)&&e(ge,{children:[e("h3",{children:"Other profiles"}),e("ul",{className:U.profileList,children:i.profiles.filter(n=>!n.owner).map(n=>e("li",{children:[e("span",{className:U.smallAvatar,children:e(be,{image:n.avatar??n.cloudAvatar,name:n.name})}),e("span",{className:U.profileName,children:n.name}),e(S,{variant:"danger",size:"sm",disabled:v,onClick:()=>{c(""),O(n)},children:"Delete"})]},n.id))})]}),e(E,{isOpen:!!I,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(I){_(!0);try{await J("/api/profiles/delete",{method:"POST",body:JSON.stringify({id:I.id,confirm:!0})}),await l.invalidateQueries({queryKey:["profiles"]}),O(null),c("Profile deleted. Local files will be removed when Dango restarts.")}catch(n){c(n.message),O(null)}finally{_(!1)}}},children:"Delete profile"})]}),children:[e("p",{children:["Delete ",e("strong",{children:I?.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."})]}),L&&e("p",{role:"status",children:L})]}):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:i,loading:l}=Ue(),g=_e(),[f,d]=s(ue[t]),[C,m]=s(!1),o=Z(null);M(()=>{l||d(ue[t])},[t,l]);const a=async()=>{if(C)return;m(!0);const y=(de.indexOf(t)+1)%de.length,u=de[y],L=ue[u];o.current&&(o.current.style.transform="translateX(-100%)",o.current.style.opacity="0"),setTimeout(async()=>{d(L),i(u),o.current&&(o.current.style.transition="none",o.current.style.transform="translateX(100%)",o.current.style.opacity="0",o.current.offsetWidth,o.current.style.transition="transform 0.3s ease-out, opacity 0.3s ease-out",o.current.style.transform="translateX(0)",o.current.style.opacity="1");try{await g.mutateAsync({key:"titlePreference",value:u})}catch(c){console.error("Error saving title preference:",c)}finally{m(!1)}},300)};return l?e("p",{children:"Loading title preference..."}):e("div",{className:ce["title-preference-container"],children:[e("h4",{children:"Anime Title Display Preference"}),e("button",{onClick:a,className:ce["toggle-button"],disabled:C,children:e("span",{ref:o,className:ce["toggle-label"],children:f})})]})},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",h={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",It="_input_tm30b_68",Lt="_select_tm30b_92",Pt="_actions_tm30b_109",xt="_hr_tm30b_117",w={title:bt,signIn:Ct,userInfo:kt,warning:St,formGroup:Nt,label:_t,inputWrapper:Tt,input:It,select:Lt,actions:Pt,hr:xt},Rt=()=>{const t=te(),[i,l]=s(!0),[g,f]=s(!1),[d,C]=s(!1),[m,o]=s(null),[a,p]=s({status:"idle"}),[y,u]=s(!1),[L,c]=s(""),[v,_]=s(!1),I=Z(null),[O,P]=s({show:!1,message:"",type:"info"}),n=()=>{I.current&&(window.clearInterval(I.current),I.current=null)},N=me(k=>{C(k.authenticated),o(k.user||k.device.user||null),p(k.device),u(!!k.hasCustomClientId)},[]),R=me(async()=>{const k=await b.auth.githubStatus.query();N(k)},[N]),z=async()=>{try{const k=await b.auth.githubPoll.query();p(k),k.status==="success"?(n(),await t.invalidateQueries({queryKey:ee.queryKey}),await R(),P({show:!0,message:"GitHub authentication complete. Sync has been initialized.",type:"success"})):k.status==="error"&&(n(),P({show:!0,message:k.error||"GitHub authentication failed.",type:"error"}))}catch{n(),P({show:!0,message:"Failed to poll GitHub authentication status.",type:"error"})}},x=(k=5)=>{n(),I.current=window.setInterval(z,Math.max(k,5)*1e3)};M(()=>(R().catch(()=>{P({show:!0,message:"Failed to load GitHub sync status.",type:"error"})}).finally(()=>l(!1)),n),[R]);const A=async()=>{f(!0);try{const k=await b.auth.githubStart.mutate();p(k),x(k.verification?.interval)}catch(k){P({show:!0,message:k instanceof Error?k.message:"Failed to start GitHub authentication.",type:"error"})}finally{f(!1)}},q=async()=>{try{await b.auth.githubLogout.mutate(),await t.invalidateQueries({queryKey:ee.queryKey}),C(!1),o(null),p({status:"idle"}),P({show:!0,message:"Signed out of GitHub sync.",type:"success"})}catch{P({show:!0,message:"Failed to sign out of GitHub.",type:"error"})}},j=async()=>{_(!0);try{await b.auth.saveGithubAuth.mutate({clientId:L}),c(""),await R(),P({show:!0,message:"Custom GitHub auth saved.",type:"success"})}catch{P({show:!0,message:"Failed to save override.",type:"error"})}finally{_(!1)}},Q=async()=>{_(!0);try{await b.auth.saveGithubAuth.mutate({clientId:""}),c(""),await R(),P({show:!0,message:"Custom auth cleared. Using dango defaults.",type:"success"})}catch{P({show:!0,message:"Failed to clear override.",type:"error"})}finally{_(!1)}};return i?e("div",{style:{color:"var(--text-secondary)",padding:"1.5rem"},children:"Loading..."}):e("div",{className:T.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."}),d&&m?e("div",{className:w.userInfo,children:[e("p",{children:["Signed in as: ",e("strong",{children:m.name||m.login})]}),e(S,{variant:"danger",onClick:q,children:"Sign Out"})]}):e("div",{className:w.signIn,children:e(S,{onClick:A,disabled:g||a.status==="pending",children:g||a.status==="pending"?"Waiting for GitHub...":"Sign in with GitHub"})}),a.status==="pending"&&a.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:a.verification.verification_uri,readOnly:!0}),e(S,{onClick:()=>{const k=a.verification?.verification_uri;k&&/^https?:\/\//i.test(k)&&window.open(k,"_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:a.verification.user_code,readOnly:!0})]})]}),a.status==="error"&&e("p",{className:w.warning,children:a.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 ",y?"(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:L,onChange:k=>c(k.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(E,{isOpen:O.show,onClose:()=>P(k=>({...k,show:!1})),width:"sm",children:[e(E.Body,{children:e("p",{children:O.message})}),e(E.Actions,{children:e(S,{onClick:()=>P(k=>({...k,show:!1})),children:"OK"})})]})]})},Dt=()=>{const[t,i]=s(!0),[l,g]=s(null),[f,d]=s(!1),[C,m]=s(!1),[o,a]=s(""),[p,y]=s(""),[u,L]=s(""),[c,v]=s(!1),[_,I]=s({show:!1,message:"",type:"info"}),O=async()=>{try{const A=await b.auth.user.query();g(A?.email?A:null)}catch{g(null)}},P=async()=>{try{const[x,A]=await Promise.all([b.auth.configStatus.query(),b.auth.googleAuth.query()]);d(!!x.hasConfig),m(!!(A.hasCustomWorkerUrl||A.hasCustomClientId||A.hasClientSecret))}catch(x){console.error("Failed to fetch config status",x)}};M(()=>{(async()=>{i(!0),await Promise.all([O(),P()]);try{new URLSearchParams(window.location.search).get("google_auth")==="success"&&(await O(),window.history.replaceState(null,"",window.location.pathname))}catch{}i(!1)})();const A=q=>{q.origin===window.location.origin&&typeof q.data=="object"&&q.data!==null&&q.data.type==="GOOGLE_AUTH_SUCCESS"&&(g(q.data.user),window.location.reload())};return window.addEventListener("message",A),()=>window.removeEventListener("message",A)},[]);const n=async()=>{try{const x=await b.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 q=600,j=700,Q=window.innerWidth/2-q/2,k=window.innerHeight/2-j/2;window.open(x.url,"GoogleAuth",`width=${q},height=${j},top=${k},left=${Q}`)}else throw new Error("Auth URL not available")}catch{I({show:!0,message:"Authentication failed. Ensure server is configured correctly.",type:"error"})}},N=async()=>{try{await b.auth.logout.mutate(),g(null),I({show:!0,message:"Successfully signed out.",type:"success"}),window.location.reload()}catch(x){console.error("Sign out failed",x),I({show:!0,message:"Failed to sign out.",type:"error"})}},R=async()=>{v(!0);try{await b.auth.saveGoogleAuth.mutate({workerUrl:o,clientId:p,clientSecret:u}),a(""),y(""),L(""),await P(),I({show:!0,message:"Custom auth saved. Restart may be required.",type:"success"})}catch{I({show:!0,message:"Failed to save override.",type:"error"})}finally{v(!1)}},z=async()=>{v(!0);try{await b.auth.saveGoogleAuth.mutate({workerUrl:"",clientId:"",clientSecret:""}),a(""),y(""),L(""),await P(),I({show:!0,message:"Custom auth cleared. Using dango defaults.",type:"success"})}catch{I({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:T.sectionCard,children:[e("h3",{className:w.title,children:"Google Drive Sync"}),l?e("div",{className:w.userInfo,children:[e("p",{children:["Signed in as: ",e("strong",{children:l.name})," (",l.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:n,disabled:!f,children:"Sign in with Google"}),!f&&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 ",C?"(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:o,onChange:x=>a(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:p,onChange:x=>y(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:u,onChange:x=>L(x.currentTarget.value),placeholder:"Your Google OAuth secret"})]}),e("div",{className:w.actions,children:[e(S,{onClick:R,disabled:c,children:"Save override"}),e(S,{variant:"secondary",onClick:z,disabled:c,children:"Use dango defaults"})]})]}),e(E,{isOpen:_.show,onClose:()=>I(x=>({...x,show:!1})),width:"sm",children:[e(E.Body,{children:e("p",{children:_.message})}),e(E.Actions,{children:e(S,{onClick:()=>I(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},Kt={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"]]}},Ut=(t,i)=>{if(t==null)return i;const l=String(t);return l==="true"||l==="1"?!0:l==="false"||l==="0"?!1:i},Se=(t,i,l)=>{const[g,f]=s(i),[d,C]=s(!1),m=te();return M(()=>{(async()=>{try{const p=await b.settings.getByKey.query({key:t});f(Ut(p.value,i))}catch(p){console.error("Failed to fetch setting",p)}})()},[t,i]),{value:g,setValue:f,isUpdating:d,toggle:async()=>{if(d)return;C(!0);const a=!g;f(a);try{await b.settings.set.mutate({key:t,value:a});for(const p of l)m.invalidateQueries({queryKey:p})}catch(p){console.error("Error saving setting:",p),f(!a)}finally{C(!1)}}}},Et=()=>{const{contentType:t}=Te(),i=Kt[t],[l,g]=s(!1),[f,d]=s(!0),[C,m]=s(!1),o=Se(i.ignoreKey,!0,i.invalidateKeys),a=Se(i.listOnlyKey,!1,i.invalidateKeys),[p,y]=s(null),[u,L]=s(!1),c=te(),v=Ee();M(()=>{d(!0),(async()=>{try{const N=await b.settings.getByKey.query({key:i.skipKey});String(N.value)==="true"||String(N.value)==="1"?g(!0):g(!1)}catch(N){console.error("Failed to fetch setting",N)}finally{d(!1)}})()},[i.skipKey]);const _=async()=>{if(C)return;m(!0);const n=!l;g(n);try{await b.settings.set.mutate({key:i.skipKey,value:n})}catch(N){console.error("Error saving setting:",N),g(!n)}finally{m(!1)}},I=async()=>{if(!o.isUpdating){if(o.value)try{let n;if(t==="anime"?n=(await b.continueWatching.adultCount.query()).count:t==="manga"?n=(await b.mangaProgress.adultCount.query()).count:t==="asmr"?n=(await b.asmrProgress.adultCount.query()).count:n=(await b.tvProgress.adultCount.query()).count,typeof n=="number"&&n>0){y(n);return}}catch(n){console.error("Failed to fetch adult count",n)}o.toggle()}},O=()=>{y(null),o.toggle()},P=async()=>{if(!u){L(!0);try{let n;t==="anime"?n=(await b.continueWatching.purgeAdult.mutate()).removed:t==="manga"?n=(await b.mangaProgress.purgeAdult.mutate()).removed:t==="asmr"?n=(await b.asmrProgress.purgeAdult.mutate()).removed:n=(await b.tvProgress.purgeAdult.mutate()).removed,Ce.success(i.purgeDoneText(n??0));for(const N of i.invalidateKeys)c.invalidateQueries({queryKey:N});t==="anime"&&c.invalidateQueries(v.continueWatching.pathFilter()),t==="manga"&&c.invalidateQueries(v.mangaProgress.pathFilter()),t==="asmr"&&c.invalidateQueries(v.asmrProgress.pathFilter()),t==="tv"&&c.invalidateQueries(v.tvProgress.pathFilter())}catch(n){console.error("Failed to purge adult entries",n),Ce.error("Failed to remove adult entries")}finally{L(!1),y(null)}o.toggle()}};return f?e("div",{children:"Loading settings..."}):e("div",{className:T.sectionCard,children:[e("h3",{children:i.heading}),e("p",{children:i.blurb}),e("div",{className:W.settingItem,children:e("div",{className:T.settingRow,children:[e("label",{htmlFor:"skip-confirmation-toggle",children:i.skipLabel}),e($,{isChecked:l,onChange:_,id:"skip-confirmation-toggle",disabled:C})]})}),e("div",{className:W.settingItem,children:e("div",{className:T.settingRow,children:[e("label",{htmlFor:"ignore-adult-toggle",children:i.ignoreLabel}),e($,{isChecked:o.value,onChange:I,id:"ignore-adult-toggle",disabled:o.isUpdating})]})}),e("div",{className:W.settingItem,children:e("div",{className:T.settingRow,children:[e("label",{htmlFor:"cw-watchlist-only-toggle",children:i.listOnlyLabel}),e($,{isChecked:a.value,onChange:a.toggle,id:"cw-watchlist-only-toggle",disabled:a.isUpdating})]})}),p!==null&&e("div",{className:W.modalOverlay,onClick:()=>y(null),children:e("div",{className:W.modal,onClick:n=>n.stopPropagation(),children:[e("h4",{children:"Show adult entries?"}),e("p",{children:[p," adult ",p===1?"entry":"entries"," not in your"," ",i.listNoun," ",p===1?"is":"are"," currently hidden from"," ",i.continueNoun,". You can purge ",p===1?"it":"them"," from the database instead of showing ",p===1?"it":"them","."]}),e("div",{className:W.modalActions,children:[e("button",{type:"button",className:W.modalSecondary,onClick:O,disabled:u,children:"Show them"}),e("button",{type:"button",className:W.modalPrimary,onClick:P,disabled:u,children:u?"Purging...":`Purge ${p}`})]})]})})]})},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,i]=s(null),[l,g]=s(!0),[f,d]=s(!1),[C,m]=s(!1),o=Z(null),a=async()=>{try{const c=await b.settings.offlineDbInfo.query();return i(c),c}catch(c){console.error("Failed to fetch offline DB info:",c)}finally{g(!1)}return null};M(()=>(a(),()=>{o.current&&window.clearInterval(o.current)}),[]),M(()=>{t?.isRefreshing?o.current||(o.current=window.setInterval(async()=>{const c=await a();c&&!c.isRefreshing&&o.current&&(window.clearInterval(o.current),o.current=null)},2e3)):o.current&&(window.clearInterval(o.current),o.current=null)},[t?.isRefreshing]);const p=async()=>{if(!t||f)return;const c=!t.autoUpdateEnabled;d(!0),i({...t,autoUpdateEnabled:c});try{await b.settings.setOfflineDbAutoUpdate.mutate({enabled:c})}catch(v){console.error("Failed to update auto update setting:",v),i({...t,autoUpdateEnabled:!c})}finally{d(!1)}},y=async()=>{if(!(t?.isRefreshing||C)){m(!0);try{await b.settings.triggerOfflineDbUpdate.mutate(),i(c=>c?{...c,isRefreshing:!0,lastStatus:"updating",lastMessage:"Downloading database..."}:null)}catch(c){console.error("Failed to trigger offline DB update:",c)}finally{m(!1)}}},u=c=>{if(!c)return"Never";try{return new Date(c).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}catch{return c}},L=t?.isRefreshing||C;return e("div",{className:T.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:l?"-":(t?.totalMalMapped??0).toLocaleString()})]}),e("div",{className:D.statCard,children:[e("span",{className:D.statLabel,children:"Release"}),e("span",{className:D.statMeta,children:l?"-":t?.releaseTag??"Never"})]}),e("div",{className:D.statCard,children:[e("span",{className:D.statLabel,children:"Last Checked"}),e("span",{className:D.statMeta,children:l?"-":u(t?.lastCheckedAt??null)})]}),e("div",{className:D.statCard,children:[e("span",{className:D.statLabel,children:"Last Updated"}),e("span",{className:D.statMeta,children:l?"-":u(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:T.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:p,disabled:l||f})]})}),e("div",{className:D.actionsRow,children:e(S,{onClick:y,disabled:l||L,children:L?"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(),[i,l]=s(!1),[g,f]=s(!1),[d,C]=s(!1),[m,o]=s(""),a=()=>{f(!1),o(""),l(!0)},p=()=>{d||(l(!1),f(!1))},y=async()=>{if(!(!g||d)){C(!0),o("");try{const u=await X("/api/database/clear",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({confirm:!0})}),L=await u.json();if(!u.ok)throw new Error(L.error||"Failed to clear database");const c=L.deleted,v=L.deletedManga,_=L.deletedTv,I=L.deletedAsmr,O=Object.values(c).reduce((R,z)=>R+(z||0),0)+Object.values(v??{}).reduce((R,z)=>R+(z||0),0)+Object.values(_??{}).reduce((R,z)=>R+(z||0),0)+Object.values(I??{}).reduce((R,z)=>R+(z||0),0),P=(v?.manga_library??0)+(v?.manga_progress??0),n=(_?.tv_library??0)+(_?.tv_progress??0),N=(I?.asmr_library??0)+(I?.asmr_progress??0);o(`Library cleared - ${c.watchlist??0} watchlist entries, ${P} manga rows, ${n} 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]}),l(!1)}catch(u){o(u.message)}finally{C(!1),f(!1)}}};return e("div",{className:`${T.sectionCard} ${T.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:a,children:"Clear Library Data"}),m&&e("p",{className:he.status,children:m}),e(E,{isOpen:i,onClose:p,title:"Clear library data?",width:"sm",children:[e(E.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:u=>f(u.currentTarget.checked),disabled:d}),e("span",{children:"I understand this permanently deletes my library"})]})]}),e(E.Actions,{children:[e(S,{variant:"secondary",onClick:p,disabled:d,children:"Cancel"}),e(S,{variant:"danger",onClick:y,disabled:!g||d,children:d?"Clearing...":"Yes, delete everything"})]})]})]})},oa=()=>{const[t,i]=s(""),[l,g]=s([]),[f,d]=s(null),[C,m]=s(!0),[o,a]=s({show:!1,message:"",type:"info"}),p=async()=>{try{m(!0);const u=await b.auth.rcloneSettings.query();i(u.remote||""),g(u.availableRemotes||[]),d(u.activeRemote||null)}catch(u){console.error("Failed to fetch Rclone settings",u)}finally{m(!1)}};M(()=>{p()},[]);const y=async()=>{try{await b.auth.saveRclone.mutate({remote:t}),a({show:!0,message:"Rclone configuration saved successfully. You must restart the server for these changes to take effect.",type:"success"}),p()}catch{a({show:!0,message:"Failed to save Rclone configuration.",type:"error"})}};return C?e("div",{style:{color:"var(--text-secondary)",padding:"1.5rem"},children:"Loading..."}):e("div",{className:T.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."}),f?e("div",{className:w.userInfo,children:e("p",{children:["Current Active Remote: ",e("strong",{children:f})]})}):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:u=>i(u.currentTarget.value),children:[e("option",{value:"",children:"(Disabled / None)"}),l.map(u=>e("option",{value:u,children:u},u)),t&&!l.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:y,children:"Save Rclone Settings"})}),e(E,{isOpen:o.show,onClose:()=>a(u=>({...u,show:!1})),width:"sm",children:[e(E.Body,{children:e("p",{children:o.message})}),e(E.Actions,{children:e(S,{onClick:()=>a(u=>({...u,show:!1})),children:"OK"})})]})]})},la=()=>{const t=te(),[i,l]=s(null),[g,f]=s(!0),d=async()=>{try{const a=await b.auth.syncSettings.query();l(a)}catch(a){console.error("Failed to fetch sync settings",a)}finally{f(!1)}};M(()=>{d()},[]);const C=async a=>{const p=a.currentTarget.value;try{const y=await b.auth.saveSyncProvider.mutate({provider:p});l(u=>u?{...u,activeProvider:y.activeProvider}:null),await d(),await t.invalidateQueries({queryKey:ee.queryKey}),ke.success(`Sync provider updated to ${p==="default"?"Default Order":p}`)}catch{ke.error("Failed to update sync provider")}};if(g||!i)return null;const m=[{value:"default",label:"Default (Priority Based)"}];i.authenticatedProviders.github&&m.push({value:"github",label:"GitHub"}),i.authenticatedProviders.google&&m.push({value:"google",label:"Google Drive"}),i.authenticatedProviders.rclone&&m.push({value:"rclone",label:"Rclone"}),m.push({value:"none",label:"None (Local Only)"});const o=a=>a==="none"?"Local Only (No Sync)":a==="google"?"Google Drive":a==="github"?"GitHub":a==="rclone"?"Rclone":a;return e("div",{className:T.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:o(i.actualActiveProvider)})]}),e("div",{className:T.settingRow,children:[e("label",{htmlFor:"sync-provider-select",children:"Selected Preference"}),e("select",{id:"sync-provider-select",value:i.activeProvider,onChange:C,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:m.map(a=>e("option",{value:a.value,children:a.label},a.value))})]})]})};function ca(){return"javascript:"+encodeURIComponent(`(function(){
1
+ import{d as s,u as e,S as ge,A as Z,h as M,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{R as ee,S as J,U,V as be,B as S,W as Ke,Q as E,d as Ue,L as _e,t as b,v as Te,o as Ee,J as Ce,X,q as H,Y as ke,Z as Fe,_ as $e,u as He,e as We,$ as Be,K as le,p as je,a0 as Qe,a1 as Ve}from"./index-Bi-DGtzC.js";import{I as B}from"./vendor-icons-DrybRNxP.js";import{T as $}from"./ToggleSwitch-CN_ppEc9.js";import{M as Ye}from"./MatureConsentModal-BXFvhDf0.js";const Je="_sectionCard_1vuib_1",Xe="_dangerCard_1vuib_20",Ze="_settingRow_1vuib_31",T={sectionCard:Je,dangerCard:Xe,settingRow:Ze};function et(){const{data:t}=pe(ee),{data:i}=pe({queryKey:["profiles"],queryFn:()=>J("/api/profiles/status"),enabled:!!t?.owner}),l=te(),[g,f]=s(null),[d,C]=s(""),[m,o]=s(""),[a,p]=s(""),[y,u]=s(""),[L,c]=s(""),[v,_]=s(!1),[I,O]=s(null),P=async n=>{_(!0),c("");try{await J("/api/profiles/update",{method:"POST",body:JSON.stringify(n)}),await l.invalidateQueries({queryKey:ee.queryKey}),C(""),o(""),c("Profile saved")}catch(N){c(N.message)}finally{_(!1)}};return t?e("section",{className:T.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 n=>{const N=n.currentTarget.files?.[0];if(n.currentTarget.value="",!N)return;if(N.size>2*1024*1024){c("Image must be smaller than 2 MB");return}const R=new FileReader;R.onerror=()=>c("Could not read image"),R.onload=()=>{P({avatar:R.result})},R.readAsDataURL(N)}})]}),t.avatar&&e(S,{variant:"secondary",disabled:v,onClick:()=>P({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:n=>{n.preventDefault(),P({name:g??t.name})},children:[e("label",{className:U.field,children:["Profile name",e("input",{value:g??t.name,maxLength:60,required:!0,onChange:n=>f(n.currentTarget.value)})]}),e(S,{type:"submit",disabled:v,children:"Save name"})]}),e("form",{className:U.form,onSubmit:n=>{n.preventDefault(),P({password:d,currentPassword:m})},children:[t.protected&&e("label",{className:U.field,children:["Current password",e("input",{type:"password",autoComplete:"current-password",value:m,required:!0,maxLength:256,onChange:n=>o(n.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:d,minLength:8,maxLength:256,onChange:n=>C(n.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"}),Ke()}catch(n){c(n.message),_(!1)}},children:"Switch profile / sign out"}),t.owner&&e("form",{className:U.form,onSubmit:async n=>{n.preventDefault(),_(!0),c("");try{await J("/api/profiles/create",{method:"POST",body:JSON.stringify({name:a,password:y})}),p(""),u(""),await l.invalidateQueries({queryKey:["profiles"]}),c("Profile created. Sign out to switch to it.")}catch(N){c(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:a,onChange:n=>p(n.currentTarget.value)})]}),e("label",{className:U.field,children:["Password (optional)",e("input",{type:"password",autoComplete:"new-password",minLength:8,maxLength:256,value:y,onChange:n=>u(n.currentTarget.value)})]}),e(S,{type:"submit",disabled:v||!t.protected,children:"Create profile"})]}),t.owner&&i?.profiles.some(n=>!n.owner)&&e(ge,{children:[e("h3",{children:"Other profiles"}),e("ul",{className:U.profileList,children:i.profiles.filter(n=>!n.owner).map(n=>e("li",{children:[e("span",{className:U.smallAvatar,children:e(be,{image:n.avatar??n.cloudAvatar,name:n.name})}),e("span",{className:U.profileName,children:n.name}),e(S,{variant:"danger",size:"sm",disabled:v,onClick:()=>{c(""),O(n)},children:"Delete"})]},n.id))})]}),e(E,{isOpen:!!I,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(I){_(!0);try{await J("/api/profiles/delete",{method:"POST",body:JSON.stringify({id:I.id,confirm:!0})}),await l.invalidateQueries({queryKey:["profiles"]}),O(null),c("Profile deleted. Local files will be removed when Dango restarts.")}catch(n){c(n.message),O(null)}finally{_(!1)}}},children:"Delete profile"})]}),children:[e("p",{children:["Delete ",e("strong",{children:I?.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."})]}),L&&e("p",{role:"status",children:L})]}):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:i,loading:l}=Ue(),g=_e(),[f,d]=s(ue[t]),[C,m]=s(!1),o=Z(null);M(()=>{l||d(ue[t])},[t,l]);const a=async()=>{if(C)return;m(!0);const y=(de.indexOf(t)+1)%de.length,u=de[y],L=ue[u];o.current&&(o.current.style.transform="translateX(-100%)",o.current.style.opacity="0"),setTimeout(async()=>{d(L),i(u),o.current&&(o.current.style.transition="none",o.current.style.transform="translateX(100%)",o.current.style.opacity="0",o.current.offsetWidth,o.current.style.transition="transform 0.3s ease-out, opacity 0.3s ease-out",o.current.style.transform="translateX(0)",o.current.style.opacity="1");try{await g.mutateAsync({key:"titlePreference",value:u})}catch(c){console.error("Error saving title preference:",c)}finally{m(!1)}},300)};return l?e("p",{children:"Loading title preference..."}):e("div",{className:ce["title-preference-container"],children:[e("h4",{children:"Anime Title Display Preference"}),e("button",{onClick:a,className:ce["toggle-button"],disabled:C,children:e("span",{ref:o,className:ce["toggle-label"],children:f})})]})},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",h={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",It="_input_tm30b_68",Lt="_select_tm30b_92",Pt="_actions_tm30b_109",xt="_hr_tm30b_117",w={title:bt,signIn:Ct,userInfo:kt,warning:St,formGroup:Nt,label:_t,inputWrapper:Tt,input:It,select:Lt,actions:Pt,hr:xt},Rt=()=>{const t=te(),[i,l]=s(!0),[g,f]=s(!1),[d,C]=s(!1),[m,o]=s(null),[a,p]=s({status:"idle"}),[y,u]=s(!1),[L,c]=s(""),[v,_]=s(!1),I=Z(null),[O,P]=s({show:!1,message:"",type:"info"}),n=()=>{I.current&&(window.clearInterval(I.current),I.current=null)},N=me(k=>{C(k.authenticated),o(k.user||k.device.user||null),p(k.device),u(!!k.hasCustomClientId)},[]),R=me(async()=>{const k=await b.auth.githubStatus.query();N(k)},[N]),z=async()=>{try{const k=await b.auth.githubPoll.query();p(k),k.status==="success"?(n(),await t.invalidateQueries({queryKey:ee.queryKey}),await R(),P({show:!0,message:"GitHub authentication complete. Sync has been initialized.",type:"success"})):k.status==="error"&&(n(),P({show:!0,message:k.error||"GitHub authentication failed.",type:"error"}))}catch{n(),P({show:!0,message:"Failed to poll GitHub authentication status.",type:"error"})}},x=(k=5)=>{n(),I.current=window.setInterval(z,Math.max(k,5)*1e3)};M(()=>(R().catch(()=>{P({show:!0,message:"Failed to load GitHub sync status.",type:"error"})}).finally(()=>l(!1)),n),[R]);const A=async()=>{f(!0);try{const k=await b.auth.githubStart.mutate();p(k),x(k.verification?.interval)}catch(k){P({show:!0,message:k instanceof Error?k.message:"Failed to start GitHub authentication.",type:"error"})}finally{f(!1)}},q=async()=>{try{await b.auth.githubLogout.mutate(),await t.invalidateQueries({queryKey:ee.queryKey}),C(!1),o(null),p({status:"idle"}),P({show:!0,message:"Signed out of GitHub sync.",type:"success"})}catch{P({show:!0,message:"Failed to sign out of GitHub.",type:"error"})}},j=async()=>{_(!0);try{await b.auth.saveGithubAuth.mutate({clientId:L}),c(""),await R(),P({show:!0,message:"Custom GitHub auth saved.",type:"success"})}catch{P({show:!0,message:"Failed to save override.",type:"error"})}finally{_(!1)}},Q=async()=>{_(!0);try{await b.auth.saveGithubAuth.mutate({clientId:""}),c(""),await R(),P({show:!0,message:"Custom auth cleared. Using dango defaults.",type:"success"})}catch{P({show:!0,message:"Failed to clear override.",type:"error"})}finally{_(!1)}};return i?e("div",{style:{color:"var(--text-secondary)",padding:"1.5rem"},children:"Loading..."}):e("div",{className:T.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."}),d&&m?e("div",{className:w.userInfo,children:[e("p",{children:["Signed in as: ",e("strong",{children:m.name||m.login})]}),e(S,{variant:"danger",onClick:q,children:"Sign Out"})]}):e("div",{className:w.signIn,children:e(S,{onClick:A,disabled:g||a.status==="pending",children:g||a.status==="pending"?"Waiting for GitHub...":"Sign in with GitHub"})}),a.status==="pending"&&a.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:a.verification.verification_uri,readOnly:!0}),e(S,{onClick:()=>{const k=a.verification?.verification_uri;k&&/^https?:\/\//i.test(k)&&window.open(k,"_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:a.verification.user_code,readOnly:!0})]})]}),a.status==="error"&&e("p",{className:w.warning,children:a.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 ",y?"(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:L,onChange:k=>c(k.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(E,{isOpen:O.show,onClose:()=>P(k=>({...k,show:!1})),width:"sm",children:[e(E.Body,{children:e("p",{children:O.message})}),e(E.Actions,{children:e(S,{onClick:()=>P(k=>({...k,show:!1})),children:"OK"})})]})]})},Dt=()=>{const[t,i]=s(!0),[l,g]=s(null),[f,d]=s(!1),[C,m]=s(!1),[o,a]=s(""),[p,y]=s(""),[u,L]=s(""),[c,v]=s(!1),[_,I]=s({show:!1,message:"",type:"info"}),O=async()=>{try{const A=await b.auth.user.query();g(A?.email?A:null)}catch{g(null)}},P=async()=>{try{const[x,A]=await Promise.all([b.auth.configStatus.query(),b.auth.googleAuth.query()]);d(!!x.hasConfig),m(!!(A.hasCustomWorkerUrl||A.hasCustomClientId||A.hasClientSecret))}catch(x){console.error("Failed to fetch config status",x)}};M(()=>{(async()=>{i(!0),await Promise.all([O(),P()]);try{new URLSearchParams(window.location.search).get("google_auth")==="success"&&(await O(),window.history.replaceState(null,"",window.location.pathname))}catch{}i(!1)})();const A=q=>{q.origin===window.location.origin&&typeof q.data=="object"&&q.data!==null&&q.data.type==="GOOGLE_AUTH_SUCCESS"&&(g(q.data.user),window.location.reload())};return window.addEventListener("message",A),()=>window.removeEventListener("message",A)},[]);const n=async()=>{try{const x=await b.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 q=600,j=700,Q=window.innerWidth/2-q/2,k=window.innerHeight/2-j/2;window.open(x.url,"GoogleAuth",`width=${q},height=${j},top=${k},left=${Q}`)}else throw new Error("Auth URL not available")}catch{I({show:!0,message:"Authentication failed. Ensure server is configured correctly.",type:"error"})}},N=async()=>{try{await b.auth.logout.mutate(),g(null),I({show:!0,message:"Successfully signed out.",type:"success"}),window.location.reload()}catch(x){console.error("Sign out failed",x),I({show:!0,message:"Failed to sign out.",type:"error"})}},R=async()=>{v(!0);try{await b.auth.saveGoogleAuth.mutate({workerUrl:o,clientId:p,clientSecret:u}),a(""),y(""),L(""),await P(),I({show:!0,message:"Custom auth saved. Restart may be required.",type:"success"})}catch{I({show:!0,message:"Failed to save override.",type:"error"})}finally{v(!1)}},z=async()=>{v(!0);try{await b.auth.saveGoogleAuth.mutate({workerUrl:"",clientId:"",clientSecret:""}),a(""),y(""),L(""),await P(),I({show:!0,message:"Custom auth cleared. Using dango defaults.",type:"success"})}catch{I({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:T.sectionCard,children:[e("h3",{className:w.title,children:"Google Drive Sync"}),l?e("div",{className:w.userInfo,children:[e("p",{children:["Signed in as: ",e("strong",{children:l.name})," (",l.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:n,disabled:!f,children:"Sign in with Google"}),!f&&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 ",C?"(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:o,onChange:x=>a(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:p,onChange:x=>y(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:u,onChange:x=>L(x.currentTarget.value),placeholder:"Your Google OAuth secret"})]}),e("div",{className:w.actions,children:[e(S,{onClick:R,disabled:c,children:"Save override"}),e(S,{variant:"secondary",onClick:z,disabled:c,children:"Use dango defaults"})]})]}),e(E,{isOpen:_.show,onClose:()=>I(x=>({...x,show:!1})),width:"sm",children:[e(E.Body,{children:e("p",{children:_.message})}),e(E.Actions,{children:e(S,{onClick:()=>I(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},Kt={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"]]}},Ut=(t,i)=>{if(t==null)return i;const l=String(t);return l==="true"||l==="1"?!0:l==="false"||l==="0"?!1:i},Se=(t,i,l)=>{const[g,f]=s(i),[d,C]=s(!1),m=te();return M(()=>{(async()=>{try{const p=await b.settings.getByKey.query({key:t});f(Ut(p.value,i))}catch(p){console.error("Failed to fetch setting",p)}})()},[t,i]),{value:g,setValue:f,isUpdating:d,toggle:async()=>{if(d)return;C(!0);const a=!g;f(a);try{await b.settings.set.mutate({key:t,value:a});for(const p of l)m.invalidateQueries({queryKey:p})}catch(p){console.error("Error saving setting:",p),f(!a)}finally{C(!1)}}}},Et=()=>{const{contentType:t}=Te(),i=Kt[t],[l,g]=s(!1),[f,d]=s(!0),[C,m]=s(!1),o=Se(i.ignoreKey,!0,i.invalidateKeys),a=Se(i.listOnlyKey,!1,i.invalidateKeys),[p,y]=s(null),[u,L]=s(!1),c=te(),v=Ee();M(()=>{d(!0),(async()=>{try{const N=await b.settings.getByKey.query({key:i.skipKey});String(N.value)==="true"||String(N.value)==="1"?g(!0):g(!1)}catch(N){console.error("Failed to fetch setting",N)}finally{d(!1)}})()},[i.skipKey]);const _=async()=>{if(C)return;m(!0);const n=!l;g(n);try{await b.settings.set.mutate({key:i.skipKey,value:n})}catch(N){console.error("Error saving setting:",N),g(!n)}finally{m(!1)}},I=async()=>{if(!o.isUpdating){if(o.value)try{let n;if(t==="anime"?n=(await b.continueWatching.adultCount.query()).count:t==="manga"?n=(await b.mangaProgress.adultCount.query()).count:t==="asmr"?n=(await b.asmrProgress.adultCount.query()).count:n=(await b.tvProgress.adultCount.query()).count,typeof n=="number"&&n>0){y(n);return}}catch(n){console.error("Failed to fetch adult count",n)}o.toggle()}},O=()=>{y(null),o.toggle()},P=async()=>{if(!u){L(!0);try{let n;t==="anime"?n=(await b.continueWatching.purgeAdult.mutate()).removed:t==="manga"?n=(await b.mangaProgress.purgeAdult.mutate()).removed:t==="asmr"?n=(await b.asmrProgress.purgeAdult.mutate()).removed:n=(await b.tvProgress.purgeAdult.mutate()).removed,Ce.success(i.purgeDoneText(n??0));for(const N of i.invalidateKeys)c.invalidateQueries({queryKey:N});t==="anime"&&c.invalidateQueries(v.continueWatching.pathFilter()),t==="manga"&&c.invalidateQueries(v.mangaProgress.pathFilter()),t==="asmr"&&c.invalidateQueries(v.asmrProgress.pathFilter()),t==="tv"&&c.invalidateQueries(v.tvProgress.pathFilter())}catch(n){console.error("Failed to purge adult entries",n),Ce.error("Failed to remove adult entries")}finally{L(!1),y(null)}o.toggle()}};return f?e("div",{children:"Loading settings..."}):e("div",{className:T.sectionCard,children:[e("h3",{children:i.heading}),e("p",{children:i.blurb}),e("div",{className:W.settingItem,children:e("div",{className:T.settingRow,children:[e("label",{htmlFor:"skip-confirmation-toggle",children:i.skipLabel}),e($,{isChecked:l,onChange:_,id:"skip-confirmation-toggle",disabled:C})]})}),e("div",{className:W.settingItem,children:e("div",{className:T.settingRow,children:[e("label",{htmlFor:"ignore-adult-toggle",children:i.ignoreLabel}),e($,{isChecked:o.value,onChange:I,id:"ignore-adult-toggle",disabled:o.isUpdating})]})}),e("div",{className:W.settingItem,children:e("div",{className:T.settingRow,children:[e("label",{htmlFor:"cw-watchlist-only-toggle",children:i.listOnlyLabel}),e($,{isChecked:a.value,onChange:a.toggle,id:"cw-watchlist-only-toggle",disabled:a.isUpdating})]})}),p!==null&&e("div",{className:W.modalOverlay,onClick:()=>y(null),children:e("div",{className:W.modal,onClick:n=>n.stopPropagation(),children:[e("h4",{children:"Show adult entries?"}),e("p",{children:[p," adult ",p===1?"entry":"entries"," not in your"," ",i.listNoun," ",p===1?"is":"are"," currently hidden from"," ",i.continueNoun,". You can purge ",p===1?"it":"them"," from the database instead of showing ",p===1?"it":"them","."]}),e("div",{className:W.modalActions,children:[e("button",{type:"button",className:W.modalSecondary,onClick:O,disabled:u,children:"Show them"}),e("button",{type:"button",className:W.modalPrimary,onClick:P,disabled:u,children:u?"Purging...":`Purge ${p}`})]})]})})]})},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,i]=s(null),[l,g]=s(!0),[f,d]=s(!1),[C,m]=s(!1),o=Z(null),a=async()=>{try{const c=await b.settings.offlineDbInfo.query();return i(c),c}catch(c){console.error("Failed to fetch offline DB info:",c)}finally{g(!1)}return null};M(()=>(a(),()=>{o.current&&window.clearInterval(o.current)}),[]),M(()=>{t?.isRefreshing?o.current||(o.current=window.setInterval(async()=>{const c=await a();c&&!c.isRefreshing&&o.current&&(window.clearInterval(o.current),o.current=null)},2e3)):o.current&&(window.clearInterval(o.current),o.current=null)},[t?.isRefreshing]);const p=async()=>{if(!t||f)return;const c=!t.autoUpdateEnabled;d(!0),i({...t,autoUpdateEnabled:c});try{await b.settings.setOfflineDbAutoUpdate.mutate({enabled:c})}catch(v){console.error("Failed to update auto update setting:",v),i({...t,autoUpdateEnabled:!c})}finally{d(!1)}},y=async()=>{if(!(t?.isRefreshing||C)){m(!0);try{await b.settings.triggerOfflineDbUpdate.mutate(),i(c=>c?{...c,isRefreshing:!0,lastStatus:"updating",lastMessage:"Downloading database..."}:null)}catch(c){console.error("Failed to trigger offline DB update:",c)}finally{m(!1)}}},u=c=>{if(!c)return"Never";try{return new Date(c).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}catch{return c}},L=t?.isRefreshing||C;return e("div",{className:T.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:l?"-":(t?.totalMalMapped??0).toLocaleString()})]}),e("div",{className:D.statCard,children:[e("span",{className:D.statLabel,children:"Release"}),e("span",{className:D.statMeta,children:l?"-":t?.releaseTag??"Never"})]}),e("div",{className:D.statCard,children:[e("span",{className:D.statLabel,children:"Last Checked"}),e("span",{className:D.statMeta,children:l?"-":u(t?.lastCheckedAt??null)})]}),e("div",{className:D.statCard,children:[e("span",{className:D.statLabel,children:"Last Updated"}),e("span",{className:D.statMeta,children:l?"-":u(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:T.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:p,disabled:l||f})]})}),e("div",{className:D.actionsRow,children:e(S,{onClick:y,disabled:l||L,children:L?"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(),[i,l]=s(!1),[g,f]=s(!1),[d,C]=s(!1),[m,o]=s(""),a=()=>{f(!1),o(""),l(!0)},p=()=>{d||(l(!1),f(!1))},y=async()=>{if(!(!g||d)){C(!0),o("");try{const u=await X("/api/database/clear",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({confirm:!0})}),L=await u.json();if(!u.ok)throw new Error(L.error||"Failed to clear database");const c=L.deleted,v=L.deletedManga,_=L.deletedTv,I=L.deletedAsmr,O=Object.values(c).reduce((R,z)=>R+(z||0),0)+Object.values(v??{}).reduce((R,z)=>R+(z||0),0)+Object.values(_??{}).reduce((R,z)=>R+(z||0),0)+Object.values(I??{}).reduce((R,z)=>R+(z||0),0),P=(v?.manga_library??0)+(v?.manga_progress??0),n=(_?.tv_library??0)+(_?.tv_progress??0),N=(I?.asmr_library??0)+(I?.asmr_progress??0);o(`Library cleared - ${c.watchlist??0} watchlist entries, ${P} manga rows, ${n} 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]}),l(!1)}catch(u){o(u.message)}finally{C(!1),f(!1)}}};return e("div",{className:`${T.sectionCard} ${T.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:a,children:"Clear Library Data"}),m&&e("p",{className:he.status,children:m}),e(E,{isOpen:i,onClose:p,title:"Clear library data?",width:"sm",children:[e(E.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:u=>f(u.currentTarget.checked),disabled:d}),e("span",{children:"I understand this permanently deletes my library"})]})]}),e(E.Actions,{children:[e(S,{variant:"secondary",onClick:p,disabled:d,children:"Cancel"}),e(S,{variant:"danger",onClick:y,disabled:!g||d,children:d?"Clearing...":"Yes, delete everything"})]})]})]})},oa=()=>{const[t,i]=s(""),[l,g]=s([]),[f,d]=s(null),[C,m]=s(!0),[o,a]=s({show:!1,message:"",type:"info"}),p=async()=>{try{m(!0);const u=await b.auth.rcloneSettings.query();i(u.remote||""),g(u.availableRemotes||[]),d(u.activeRemote||null)}catch(u){console.error("Failed to fetch Rclone settings",u)}finally{m(!1)}};M(()=>{p()},[]);const y=async()=>{try{await b.auth.saveRclone.mutate({remote:t}),a({show:!0,message:"Rclone configuration saved successfully. You must restart the server for these changes to take effect.",type:"success"}),p()}catch{a({show:!0,message:"Failed to save Rclone configuration.",type:"error"})}};return C?e("div",{style:{color:"var(--text-secondary)",padding:"1.5rem"},children:"Loading..."}):e("div",{className:T.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."}),f?e("div",{className:w.userInfo,children:e("p",{children:["Current Active Remote: ",e("strong",{children:f})]})}):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:u=>i(u.currentTarget.value),children:[e("option",{value:"",children:"(Disabled / None)"}),l.map(u=>e("option",{value:u,children:u},u)),t&&!l.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:y,children:"Save Rclone Settings"})}),e(E,{isOpen:o.show,onClose:()=>a(u=>({...u,show:!1})),width:"sm",children:[e(E.Body,{children:e("p",{children:o.message})}),e(E.Actions,{children:e(S,{onClick:()=>a(u=>({...u,show:!1})),children:"OK"})})]})]})},la=()=>{const t=te(),[i,l]=s(null),[g,f]=s(!0),d=async()=>{try{const a=await b.auth.syncSettings.query();l(a)}catch(a){console.error("Failed to fetch sync settings",a)}finally{f(!1)}};M(()=>{d()},[]);const C=async a=>{const p=a.currentTarget.value;try{const y=await b.auth.saveSyncProvider.mutate({provider:p});l(u=>u?{...u,activeProvider:y.activeProvider}:null),await d(),await t.invalidateQueries({queryKey:ee.queryKey}),ke.success(`Sync provider updated to ${p==="default"?"Default Order":p}`)}catch{ke.error("Failed to update sync provider")}};if(g||!i)return null;const m=[{value:"default",label:"Default (Priority Based)"}];i.authenticatedProviders.github&&m.push({value:"github",label:"GitHub"}),i.authenticatedProviders.google&&m.push({value:"google",label:"Google Drive"}),i.authenticatedProviders.rclone&&m.push({value:"rclone",label:"Rclone"}),m.push({value:"none",label:"None (Local Only)"});const o=a=>a==="none"?"Local Only (No Sync)":a==="google"?"Google Drive":a==="github"?"GitHub":a==="rclone"?"Rclone":a;return e("div",{className:T.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:o(i.actualActiveProvider)})]}),e("div",{className:T.settingRow,children:[e("label",{htmlFor:"sync-provider-select",children:"Selected Preference"}),e("select",{id:"sync-provider-select",value:i.activeProvider,onChange:C,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:m.map(a=>e("option",{value:a.value,children:a.label},a.value))})]})]})};function ca(){return"javascript:"+encodeURIComponent(`(function(){
2
2
  if(!/(^|\\.)discord\\.com$/.test(location.hostname)){alert('Dango: use this bookmarklet while on discord.com');return}
3
3
  var t=null;
4
4
  try{
@@ -1 +1 @@
1
- import{u as o,g as r}from"./vendor-core-DfaOB3Rn.js";import{u as l}from"./index-Cd1-bH35.js";const a="_skeletonCard_qtypb_1",i="_poster_qtypb_11",d="_line_qtypb_20",c="_info_qtypb_38",_="_short_qtypb_54",m="_lowEnd_qtypb_69",e={skeletonCard:a,poster:i,line:d,"skeleton-wave":"_skeleton-wave_qtypb_1",info:c,short:_,lowEnd:m},p=({layout:n="vertical"})=>{const{lowEndMode:t}=l();return o("div",{className:`${e.skeletonCard} ${e[n]} ${t?e.lowEnd:""}`,children:[o("div",{className:e.poster}),o("div",{className:e.info,children:[o("div",{className:e.line}),o("div",{className:`${e.line} ${e.short}`})]})]})},v=({count:n=14,layout:t="vertical"})=>o("div",{className:"grid-container",children:Array.from({length:n}).map((k,s)=>o(p,{layout:t},s))}),w=r.memo(v);export{p as A,w as S};
1
+ import{u as o,g as r}from"./vendor-core-DfaOB3Rn.js";import{u as l}from"./index-Bi-DGtzC.js";const a="_skeletonCard_qtypb_1",i="_poster_qtypb_11",d="_line_qtypb_20",c="_info_qtypb_38",_="_short_qtypb_54",m="_lowEnd_qtypb_69",e={skeletonCard:a,poster:i,line:d,"skeleton-wave":"_skeleton-wave_qtypb_1",info:c,short:_,lowEnd:m},p=({layout:n="vertical"})=>{const{lowEndMode:t}=l();return o("div",{className:`${e.skeletonCard} ${e[n]} ${t?e.lowEnd:""}`,children:[o("div",{className:e.poster}),o("div",{className:e.info,children:[o("div",{className:e.line}),o("div",{className:`${e.line} ${e.short}`})]})]})},v=({count:n=14,layout:t="vertical"})=>o("div",{className:"grid-container",children:Array.from({length:n}).map((k,s)=>o(p,{layout:t},s))}),w=r.memo(v);export{p as A,w as S};