@serifpersia/dango 3.7.8 → 3.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/client/dist/assets/{AnimeCard-B_eNHj3Q.js → AnimeCard-BURLDiUV.js} +1 -1
- package/client/dist/assets/{AnimeInfo-B4DtKpJi.js → AnimeInfo-D2coN_ZJ.js} +1 -1
- package/client/dist/assets/{AnimeInfoPage-BTJBbJx7.js → AnimeInfoPage-BfPP9trp.js} +2 -2
- package/client/dist/assets/{Asmr-DB4F0zQm.js → Asmr-CiuBtMGl.js} +1 -1
- package/client/dist/assets/{AsmrResetProgressModal-BkO6uAVo.js → AsmrResetProgressModal-BDFeO6fQ.js} +1 -1
- package/client/dist/assets/{Home-BYtjQAAm.js → Home-GShTLEbZ.js} +1 -1
- package/client/dist/assets/{Insights-kd8R5HFL.js → Insights-CKk02Whw.js} +1 -1
- package/client/dist/assets/{LibraryListPage-BXCoAwO-.js → LibraryListPage-AGyVc7pR.js} +1 -1
- package/client/dist/assets/{ListeningList-B58inkaW.js → ListeningList-DeAdvRjS.js} +1 -1
- package/client/dist/assets/{Manga-B09DXrt3.js → Manga-CiPWc8Ly.js} +1 -1
- package/client/dist/assets/{MangaInfoPage-HniBD97j.js → MangaInfoPage-3jObt7zd.js} +1 -1
- package/client/dist/assets/{MangaReadPage-XTo4eB8e.js → MangaReadPage-V5M2BLWG.js} +1 -1
- package/client/dist/assets/{MangaResetProgressModal-DgD2JJiz.js → MangaResetProgressModal-CXRvdwD9.js} +1 -1
- package/client/dist/assets/{Mature--NRjmFgA.js → Mature-B9IEX0IP.js} +1 -1
- package/client/dist/assets/{MatureConsentModal-BxCEXBbj.js → MatureConsentModal-LTZSG_Kx.js} +1 -1
- package/client/dist/assets/{MediaCard-BXWAjpwt.js → MediaCard-l2gAJctz.js} +1 -1
- package/client/dist/assets/{OptionListMenu-DHzVKmrw.js → OptionListMenu-CHJb3qot.js} +1 -1
- package/client/dist/assets/{Player-BopSS6Gv.js → Player-BTimy0Mp.js} +2 -2
- package/client/dist/assets/{PlayerProvider-Cj4nkG1Z.js → PlayerProvider-BXBzQc8G.js} +1 -1
- package/client/dist/assets/{PlayerSettings-BEorvGw8.js → PlayerSettings-B-_QOjfP.js} +1 -1
- package/client/dist/assets/{QueueOptionsButton-E2SuRJH_.js → QueueOptionsButton-BCxERY1G.js} +1 -1
- package/client/dist/assets/{QueueRail-ZlyY6iwq.js → QueueRail-BX4CwNHY.js} +1 -1
- package/client/dist/assets/{ReadingList-DEOzfsq9.js → ReadingList-BLUM-leI.js} +1 -1
- package/client/dist/assets/{ResetProgressModal-B4qmiw-m.js → ResetProgressModal-DLs9yqI-.js} +1 -1
- package/client/dist/assets/{Search-C2mxeTuG.js → Search-tnIvsV_a.js} +1 -1
- package/client/dist/assets/{Settings-BqOAQxhe.js → Settings-CibKc1Rt.js} +1 -1
- package/client/dist/assets/{SkeletonGrid-Od92F7If.js → SkeletonGrid-nW7P1jQU.js} +1 -1
- package/client/dist/assets/{Trackers-CyWVHtOz.js → Trackers-Cynvnhc3.js} +1 -1
- package/client/dist/assets/{Tv-B8tWYqQt.js → Tv-BePMuQoo.js} +1 -1
- package/client/dist/assets/{TvInfo-CYh7oICz.js → TvInfo-DGIpvh-v.js} +1 -1
- package/client/dist/assets/{TvPopup-8uQGvzWG.js → TvPopup-BS4iiQMd.js} +1 -1
- package/client/dist/assets/{TvSearch-DMc5DzU4.js → TvSearch-p0kCDTee.js} +1 -1
- package/client/dist/assets/{TvWatchlist-fPe4D63a.js → TvWatchlist-CmXQkDQp.js} +1 -1
- package/client/dist/assets/{VirtualKeyboard-CjOEv-Zs.js → VirtualKeyboard-CroH8QGP.js} +1 -1
- package/client/dist/assets/{WatchAlong-Cd_rNUGz.js → WatchAlong-iCJlxiZA.js} +1 -1
- package/client/dist/assets/{WatchAlongPanel-BKprdx-w.js → WatchAlongPanel-R7Nd5MXr.js} +1 -1
- package/client/dist/assets/{Watchlist-DMj82PtZ.js → Watchlist-D2sHodVo.js} +1 -1
- package/client/dist/assets/index-DYanm9eZ.js +178 -0
- package/client/dist/assets/{libraryInvalidation-DeUzK6TJ.js → libraryInvalidation-DlwONLN-.js} +1 -1
- package/client/dist/assets/{playbackCompletion-_kwPgoZi.js → playbackCompletion-CxGa4g7a.js} +1 -1
- package/client/dist/assets/{useAnimeInfoData-CH9hmj5A.js → useAnimeInfoData-DMeGA3wY.js} +1 -1
- package/client/dist/assets/{useAsmr-DQsv1SQT.js → useAsmr-B88X71vs.js} +1 -1
- package/client/dist/assets/{useAsmrPopup-6kWviNqn.js → useAsmrPopup-DEhKwHLC.js} +1 -1
- package/client/dist/assets/{useMangaLibrary-DlU4Z9JL.js → useMangaLibrary-CX_0zLJK.js} +1 -1
- package/client/dist/assets/{useMangaPopup-3MuX6uO9.js → useMangaPopup-Dkq2Yw-e.js} +1 -1
- package/client/dist/assets/{useProviders-Dx9rG8FY.js → useProviders-D9QoFCnY.js} +1 -1
- package/client/dist/assets/{useTv-DZQzHJgO.js → useTv-BGXZmuV8.js} +1 -1
- package/client/dist/assets/{useTvLibrary-DVpLBz5c.js → useTvLibrary-TnVQ2e21.js} +1 -1
- package/client/dist/assets/{useWatchAlongPlayer-KZT7d2pQ.js → useWatchAlongPlayer-3HXJvQR2.js} +1 -1
- package/client/dist/index.html +1 -1
- package/package.json +2 -2
- package/server/dist/server.js +1 -1
- package/server/dist/shipped-defaults.js +1 -1
- package/server/package.json +1 -1
- package/client/dist/assets/index-B_2ppn5P.js +0 -178
|
@@ -1 +1 @@
|
|
|
1
|
-
import{X as Ee,x as we,u as d,A as C,q as de,h as X,d as ue,T as oe,_ as Te,C as me}from"./vendor-core-DfaOB3Rn.js";import{I as te}from"./vendor-icons-DrybRNxP.js";import{_ as Pe,p as pe,g as be}from"./index-B_2ppn5P.js";const ye=Ee(null);function q(){const n=we(ye);if(!n)throw new Error("Player controls must be inside a PlayerProvider.");return n}function ve(n,i){const t=q(),r=C(i);r.current=i;const l=n?.url,m=n?.hls,s=de(g=>{t.mediaRef.current=g,t.connect()},[t]);return X(()=>{if(l)return t.loadSource({url:l,hls:m},r.current)},[t,l,m]),s}function Ge({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_u5gii_1",Le="_stage_u5gii_38",Fe="_shellFill_u5gii_87",Re="_shellFullscreen_u5gii_95",Me="_uiLayer_u5gii_110",xe="_engineStatus_u5gii_121",Ce="_volumeWrap_u5gii_134",_e="_volumeSlider_u5gii_140",se={shell:Se,stage:Le,shellFill:Fe,shellFullscreen:Re,uiLayer:Me,engineStatus:xe,volumeWrap:Ce,volumeSlider:_e},Be=({classes:n,videoRef:i,duration:t,formatTime:r,isScrubbing:l,buffered:m="auto",onSeek:s,onScrubStart:g,onScrubMove:v,onScrubEnd:R,timeLabelRef:E,children:w})=>{const p=C(null),S=C(null),P=C(null),k=C(null),h=C(null),u=C(!1),f=C(l);f.current=l;const b=C({onScrubMove:v,onScrubEnd:R});b.current={onScrubMove:v,onScrubEnd:R};const[A,I]=ue({time:0,position:null});X(()=>{const c=i.current;if(!c)return;const y=_=>{const U=_/t*100||0;p.current?.setAttribute("aria-valuenow",String(Math.round(_))),p.current?.setAttribute("aria-valuetext",`${r(_)} of ${r(t)}`),S.current&&(S.current.style.width=`${U}%`),P.current&&(P.current.style.left=`${U}%`),E?.current&&(E.current.innerText=`${r(_)} / ${r(t)}`)},M=()=>{l||y(c.currentTime)},$=()=>{if(m==="auto"&&c.buffered.length>0){const U=c.buffered.end(c.buffered.length-1)/t*100||0;k.current&&(k.current.style.width=`${U}%`)}};return y(c.currentTime),$(),c.addEventListener("timeupdate",M),c.addEventListener("progress",$),()=>{c.removeEventListener("timeupdate",M),c.removeEventListener("progress",$)}},[i,t,l,m,r,E]);const D=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 M=y/t*100||0;S.current&&(S.current.style.width=`${M}%`),P.current&&(P.current.style.left=`${M}%`),E?.current&&(E.current.innerText=`${r(y)} / ${r(t)}`);const $=p.current?.getBoundingClientRect();I({time:y,position:$?c*$.width:null})};X(()=>{if(!l){h.current=null;return}const c=M=>{if(h.current!==null&&M.pointerId!==h.current||!t)return;const $=D(M.clientX);b.current.onScrubMove($);const _=$*t;p.current?.setAttribute("aria-valuenow",String(Math.round(_))),p.current?.setAttribute("aria-valuetext",`${r(_)} of ${r(t)}`);const U=_/t*100||0;S.current&&(S.current.style.width=`${U}%`),P.current&&(P.current.style.left=`${U}%`),E?.current&&(E.current.innerText=`${r(_)} / ${r(t)}`);const e=p.current?.getBoundingClientRect();I({time:_,position:e?$*e.width:null})},y=M=>{h.current!==null&&M.pointerId!==h.current||(h.current=null,u.current=!0,M.pointerType!=="mouse"&&I({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,g());const y=D(c.clientX);v(y),Q(y)},G=c=>{if(!t||f.current||c.pointerType!=="mouse")return;const y=D(c.clientX);I({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,u.current=!0,c.pointerType!=="mouse"&&I({time:0,position:null});try{p.current?.hasPointerCapture(c.pointerId)&&p.current.releasePointerCapture(c.pointerId)}catch{}R()}};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(u.current){u.current=!1;return}!i.current||isNaN(t)||t===0||s(D(c.clientX))},onPointerDown:ne,onPointerMove:G,onPointerUp:Z,onPointerCancel:Z,onMouseMove:c=>{if(l||!t)return;const y=D(c.clientX);I({time:y*t,position:c.clientX-(p.current?.getBoundingClientRect().left??0)})},onMouseLeave:()=>{l||I({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,M=i.current.currentTime/t||0;s(Math.min(1,Math.max(0,M+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:k,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||g())}}),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 Ae(){const[n,i]=ue(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 $e=450,De=({muted:n,volume:i,volumeIcon:t,buttonClassName:r,sliderClassName:l,onToggleMute:m,onVolumeChange:s,onExpandedChange:g})=>{const v=Ae(),[R,E]=ue(!1),w=C(null),p=C(!1),S=C(null),P=de(b=>{E(b),g?.(b)},[g]);X(()=>()=>{w.current&&window.clearTimeout(w.current)},[]),X(()=>{if(!R)return;const b=A=>{S.current&&!S.current.contains(A.target)&&P(!1)};return document.addEventListener("pointerdown",b),()=>document.removeEventListener("pointerdown",b)},[R,P]);const k=n?0:i,h=()=>{p.current=!1,w.current&&window.clearTimeout(w.current),w.current=window.setTimeout(()=>{p.current=!0,P(!0)},$e)},u=()=>{w.current&&(window.clearTimeout(w.current),w.current=null)},f=b=>{if(b.stopPropagation(),p.current){p.current=!1;return}if(v){R?m():P(!0);return}m()};return d("div",{ref:S,className:se.volumeWrap,"data-expanded":R?"true":"false",onContextMenu:b=>b.preventDefault(),children:[d("button",{type:"button",className:r,onClick:f,onPointerDown:h,onPointerUp:u,onPointerLeave:u,onContextMenu:b=>b.preventDefault(),"aria-label":n?"Unmute":"Mute","aria-expanded":R,children:t}),d("input",{type:"range",min:"0",max:"1",step:"0.05",value:k,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":`${k*100}%`},"aria-label":"Volume"})]})};let ee=null,ie=null;async function Ie(){return ee||(ie||(ie=Pe(()=>import("./hls-BOLXTnjL.js"),[]).then(n=>(ee=n.default,ee)).catch(()=>null)),ie)}function Ne(n){return n.canPlayType("application/vnd.apple.mpegurl")!==""||n.canPlayType("application/x-mpegURL")!==""}function ae(){return document}function le(n){const i=ae();if(document.fullscreenElement)return document.fullscreenElement;if(i.webkitFullscreenElement)return i.webkitFullscreenElement;const t=n;return t?.webkitDisplayingFullscreen?t:null}function ge(n){return le(n)!==null}async function Ve(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 qe(n){const i=ae();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 Ue(n,i){!n&&!i||(ge(i)?await qe(i):n&&await Ve(n,i))}function He(n,i){const t=()=>{try{i(ge(n()))}catch{}},r=ae(),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 K=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 Ke(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},g={current:null};let v=null,R=()=>{},E=()=>{},w=0,p=!1,S=1,P=!1,k=null,h=!1;function u(e){Object.entries(e).every(([a,o])=>Object.is(t[a],o))||(t={...t,...e},l.forEach(a=>a()))}function f(e){r.currentTime===e.currentTime&&r.bufferedEnd===e.bufferedEnd||(r=e,m.forEach(a=>a()))}function b(e){if(!e)return;let a=0;for(let o=0;o<e.buffered.length;o++)if(e.buffered.start(o)<=e.currentTime&&e.buffered.end(o)>=e.currentTime){a=e.buffered.end(o);break}f({currentTime:Number.isFinite(e.currentTime)?e.currentTime:0,bufferedEnd:a})}function A(){b(s.current)}function I(){const e=s.current;if(v===e||(v&&(K===v&&(K=e),b(v),E(),v.pause(),v.removeAttribute("src"),v.load()),R(),v=e,!e))return;P=!1,K||(K=e),e.volume=t.volume,e.muted=t.isMuted,e.playbackRate=t.playbackRate;const a=()=>{const T=Array.from(e.textTracks);if(!T.length)return;const H=T.findIndex(W=>W.mode==="showing");u({subtitleTracks:T.map((W,z)=>({id:z,label:W.label||W.language||`Track ${z+1}`,language:W.language})),...H>=0?{activeSubtitleTrack:H}:{}})},o={play:()=>{K=e,u({isPlaying:!0,playBlocked:!1,error:null})},playing:()=>u({isPlaying:!0,isBuffering:!1,playBlocked:!1}),pause:()=>u({isPlaying:!1,isBuffering:!1}),ended:()=>{u({isPlaying:!1,isBuffering:!1}),A()},waiting:()=>{!e.paused&&(e.readyState<3||e.seeking)&&u({isBuffering:!0})},canplay:()=>u({isBuffering:!1}),seeking:()=>{e.paused||u({isBuffering:!0}),A()},seeked:()=>{u({isBuffering:!1}),A()},timeupdate:()=>{A(),!e.paused&&!e.seeking&&u({isBuffering:!1})},progress:A,loadedmetadata:()=>{e.playbackRate=t.playbackRate,u({duration:Number.isFinite(e.duration)?e.duration:0}),a()},durationchange:()=>u({duration:Number.isFinite(e.duration)?e.duration:0}),ratechange:()=>{t.isSpeedBoostActive||(S=e.playbackRate),e.defaultPlaybackRate!==e.playbackRate&&(e.defaultPlaybackRate=e.playbackRate),u({playbackRate:e.playbackRate})},volumechange:()=>{u({volume:e.volume,isMuted:e.muted}),Y(n.volumeKey,e.volume),Y(n.mutedKey,e.muted)},error:()=>u({error:e.error?.message||"Unable to play this source.",isPlaying:!1,isBuffering:!1})};Object.entries(o).forEach(([T,H])=>e.addEventListener(T,H)),e.textTracks.addEventListener("addtrack",a),e.textTracks.addEventListener("removetrack",a),e.textTracks.addEventListener("change",a);const L=()=>e.tagName==="VIDEO"?e:null,j=()=>{const T=le(L());u({isFullscreen:T!==null&&(T===e||T===g.current)})},B=typeof document>"u"?()=>{}:He(L,j);typeof document<"u"&&j(),R=()=>{Object.entries(o).forEach(([T,H])=>e.removeEventListener(T,H)),B(),e.textTracks.removeEventListener("addtrack",a),e.textTracks.removeEventListener("removetrack",a),e.textTracks.removeEventListener("change",a)}}async function D(){if(t.playbackLocked&&!h)return!1;const e=s.current;if(!e)return!1;K=e;const a=w;try{return await e.play(),a===w}catch(o){if(a===w){const L=o instanceof Error&&o.name==="NotAllowedError",j=o instanceof Error&&o.name==="AbortError";u({isPlaying:!1,isBuffering:!1,playBlocked:L,...!L&&!j?{error:o instanceof Error?o.message:"Playback failed."}:{}})}return!1}}function Q(){t.playbackLocked&&!h||s.current?.pause()}function ne(){s.current?.paused?D():Q()}function G(e){if(t.playbackLocked&&!h)return;const a=s.current;if(!a||!Number.isFinite(e))return;let o=Math.max(0,e);if(Number.isFinite(a.duration))o=Math.min(a.duration,o);else if(a.seekable.length)for(let L=0;L<a.seekable.length;L++){if(o<=a.seekable.end(L)){o=Math.max(a.seekable.start(L),o);break}L===a.seekable.length-1&&(o=a.seekable.end(L))}a.currentTime=o,A()}function Z(e){G((s.current?.currentTime??r.currentTime)+e)}function c(e){if(!Number.isFinite(e))return;const a=Math.max(0,Math.min(1,e));u({volume:a,isMuted:a===0}),s.current&&(s.current.volume=a,s.current.muted=a===0),Y(n.volumeKey,a),Y(n.mutedKey,a===0)}function y(){const e=!t.isMuted;!e&&t.volume===0&&c(.5),u({isMuted:e}),s.current&&(s.current.muted=e),Y(n.mutedKey,e)}function M(e){if(t.playbackLocked&&!h||!Number.isFinite(e)||e<.25||e>4)return;S=e;const a=t.isSpeedBoostActive?2:e;u({playbackRate:a}),s.current&&(s.current.playbackRate=a)}function $(){t.playbackLocked||t.isScrubbing||(p=!!s.current&&!s.current.paused,u({isScrubbing:!0}),Q())}function _(){t.isScrubbing&&(u({isScrubbing:!1}),p&&D(),p=!1)}function U(e,a={}){E(),I();const o=s.current,L=++w;if(!o)return()=>{};let j=!1,B=null;const T=()=>!j&&w===L&&s.current===o;o.pause(),o.removeAttribute("src"),o.load(),u({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 H=()=>{T()&&a.initialTime&&a.initialTime>0&&G(a.initialTime)};o.addEventListener("loadedmetadata",H,{once:!0});const W=()=>{T()&&(a.onReady?.(),a.autoPlay&&T()&&D())},z=F=>{if(!T())return;const N=F instanceof Error?F:new Error(String(F));u({error:N.message,isPlaying:!1,isBuffering:!1}),a.onError?.(N)},J=()=>{j||(j=!0,o.removeEventListener("loadedmetadata",H),o.removeEventListener("error",ce),B?.destroy(),k===B&&(k=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 Ie();if(!T())return;if(F?.isSupported()){B=new F({enableWorker:!0,startPosition:a.initialTime??-1,...a.hlsConfig}),k=B;const N=B,he=()=>{T()&&u({audioTracks:N.audioTracks.map((x,V)=>({id:V,label:x.name||x.lang||`Track ${V+1}`,language:x.lang})),...o.querySelector("track")?{}:{subtitleTracks:N.subtitleTracks.map((x,V)=>({id:V,label:x.name||x.lang||`Track ${V+1}`,language:x.lang}))},qualities:N.levels.map((x,V)=>({id:V,label:x.height?`${x.height}p`:`${Math.round(x.bitrate/1e3)}k`})),activeAudioTrack:N.audioTrack,...o.querySelector("track")?{}:{activeSubtitleTrack:N.subtitleTrack},activeQuality:N.currentLevel})};for(const x 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(x,he);if(B.on(F.Events.ERROR,(x,V)=>{V.fatal&&T()&&(z(new Error(`Stream failed (${V.details}). Try another source or reload.`)),J())}),B.once(F.Events.MANIFEST_PARSED,W),a.onHls?.(B,F),!T())return;B.loadSource(e.url),B.attachMedia(o);return}if(!Ne(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:g,connect:I,getState:()=>t,getTimeline:()=>r,getHls:()=>k,isActive:()=>K===s.current,subscribe:e=>(l.add(e),()=>{l.delete(e)}),subscribeTimeline:e=>(m.add(e),()=>{m.delete(e)}),play:D,pause:Q,togglePlay:ne,seek:G,seekRelative:Z,setVolume:c,toggleMute:y,setPlaybackRate:M,setPlaybackLocked:e=>u({playbackLocked:e}),applyRemotePlayback:(e,a,o)=>{h=!0;try{e!==void 0&&G(e),Math.abs(t.playbackRate-o)>.001&&M(o),a&&s.current?.paused?D():!a&&!s.current?.paused&&Q()}finally{h=!1}},setAudioTrack:e=>{k&&t.audioTracks.some(a=>a.id===e)&&(k.audioTrack=e,u({activeAudioTrack:e}))},setSubtitleTrack:e=>{if(e!==-1&&!t.subtitleTracks.some(o=>o.id===e))return;const a=s.current;a?.querySelector("track")?Array.from(a.textTracks).forEach((o,L)=>{o.mode=L===e?"showing":"disabled"}):k&&(k.subtitleTrack=e),u({activeSubtitleTrack:e})},setQuality:e=>{k&&(e===-1||t.qualities.some(a=>a.id===e))&&(k.currentLevel=e,u({activeQuality:e}))},setSpeedBoost:e=>{if(t.playbackLocked)return;const a=e?2:S;u({isSpeedBoostActive:e,playbackRate:a}),s.current&&(s.current.playbackRate=a)},setShowControls:e=>u({showControls:e}),startScrubbing:$,endScrubbing:_,loadSource:U,unload:()=>{const e=s.current;b(e),E(),e&&(e.pause(),e.removeAttribute("src"),e.load()),u({isPlaying:!1,isBuffering:!1,duration:0,error:null}),f({currentTime:0,bufferedEnd:0})},toggleFullscreen:()=>{const e=s.current;Ue(g.current,e?.tagName==="VIDEO"?e:null).catch(a=>u({error:a instanceof Error?a.message:"Fullscreen failed."}))},reset:()=>{u({duration:0,isBuffering:!1,error:null}),f({currentTime:0,bufferedEnd:0})},destroy:()=>{if(P)return;P=!0;const e=v??s.current;b(e),R(),v=null,E(),e?.pause(),e?.removeAttribute("src"),e?.load(),K===e&&(K=null)}}}function O(n){return me(n.subscribe,n.getState)}function ke(n){return me(n.subscribeTimeline,n.getTimeline)}function Je(n={}){const i=C(n),t=oe(()=>Ke(i.current),[]);return Te(()=>{t.connect()}),X(()=>()=>t.destroy(),[t]),oe(()=>({engine:t,mediaRef:t.mediaRef}),[t])}function Oe({children:n,...i}){const t=q(),{isPlaying:r,playbackLocked:l}=O(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 Ye({seconds:n,children:i,...t}){const r=q(),{playbackLocked:l}=O(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 Ze(n){const i=q(),{isFullscreen:t}=O(i);return d("button",{type:"button","aria-label":t?"Exit Fullscreen":"Fullscreen",...n,onClick:i.toggleFullscreen,children:d(te,{name:t?"compress":"expand"})})}function et({buttonClassName:n,onExpandedChange:i}){const t=q(),{isMuted:r,volume:l}=O(t);return d(De,{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 tt({className:n}){const i=q(),{volume:t,isMuted:r}=O(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 nt({classes:n,timeLabelRef:i,children:t}){const r=q(),{duration:l,isScrubbing:m,playbackLocked:s}=O(r);return d("div",{inert:s||void 0,style:{display:"contents"},children:d(Be,{classes:n,videoRef:r.mediaRef,duration:l,formatTime:be,isScrubbing:m,onSeek:g=>r.seek(g*l),onScrubStart:r.startScrubbing,onScrubMove:g=>r.seek(g*l),onScrubEnd:r.endScrubbing,timeLabelRef:i,children:t})})}function rt({className:n}){const i=q(),{currentTime:t,bufferedEnd:r}=ke(i),{duration:l,playbackLocked:m}=O(i),s=l?Math.min(100,t/l*100):0,g=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":`${g}%`},"aria-label":"Seek"})}function it({className:n,durationOnly:i=!1}){const t=q(),{currentTime:r}=ke(t),{duration:l}=O(t);return d("span",{className:n,children:be(i?l:r)})}function ut(){const n=q(),{error:i,playBlocked:t,isBuffering:r,playbackLocked:l}=O(n);return i?d("div",{role:"alert",children:i}):t&&l?d("span",{children:"Enable playback from the watch-along panel."}):t?d(Oe,{children:"Tap to play"}):r?d("div",{role:"status","aria-label":"Buffering",children:"Loading…"}):null}const je='input, textarea, button, select, a, [role="button"], [role="slider"], [contenteditable]:not([contenteditable="false"]), [data-player-ui="true"], [data-speed-boost-ignore="true"]';function at(n,i,t=!0){const r=C(i);r.current=i,X(()=>{if(!t)return;let l=!1,m=!1,s=!1,g,v,R=!1;const E=()=>{const u=m||s;u!==R&&(R=u,n.setSpeedBoost(u))},w=u=>u instanceof Element&&!!u.closest(je),p=u=>{if(!n.isActive()||!n.mediaRef.current||u.defaultPrevented||u.ctrlKey||u.metaKey||u.altKey||w(u.target))return;if(u.code==="Space"){if(u.preventDefault(),l)return;l=!0,g=setTimeout(()=>{g=void 0,m=!0,E()},180),r.current();return}const f=u.key.toLowerCase();["k","j","l","arrowleft","arrowright","arrowup","arrowdown","m","f"].includes(f)&&(u.preventDefault(),!(u.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=u=>{u.code!=="Space"||!l||(u.preventDefault(),l=!1,clearTimeout(g),g=void 0,m?(m=!1,E()):n.togglePlay(),r.current())},P=u=>{const f=u.target;u.button!==0||!(f instanceof Element)||w(f)||!n.containerRef.current?.contains(f)||(clearTimeout(v),v=setTimeout(()=>{v=void 0,s=!0,E()},180))},k=()=>{clearTimeout(v),v=void 0,s=!1,E()},h=()=>{clearTimeout(g),g=void 0,l=!1,m=!1,k()};return document.addEventListener("keydown",p),document.addEventListener("keyup",S),document.addEventListener("pointerdown",P),document.addEventListener("pointerup",k),document.addEventListener("pointercancel",k),window.addEventListener("blur",h),()=>{document.removeEventListener("keydown",p),document.removeEventListener("keyup",S),document.removeEventListener("pointerdown",P),document.removeEventListener("pointerup",k),document.removeEventListener("pointercancel",k),window.removeEventListener("blur",h),h()}},[n,t])}function lt({engine:n,children:i}){return d(ye.Provider,{value:n,children:i})}export{Ze as F,nt as P,Ye as S,tt as V,Oe as a,et as b,Ge as c,lt as d,q as e,O as f,ke as g,at as h,it as i,rt as j,ut as k,ze as l,Ae as m,ge as n,se as s,Je as u};
|
|
1
|
+
import{X as Ee,x as we,u as d,A as C,q as de,h as X,d as ue,T as oe,_ as Te,C as me}from"./vendor-core-DfaOB3Rn.js";import{I as te}from"./vendor-icons-DrybRNxP.js";import{_ as Pe,p as pe,g as be}from"./index-DYanm9eZ.js";const ye=Ee(null);function q(){const n=we(ye);if(!n)throw new Error("Player controls must be inside a PlayerProvider.");return n}function ve(n,i){const t=q(),r=C(i);r.current=i;const l=n?.url,m=n?.hls,s=de(g=>{t.mediaRef.current=g,t.connect()},[t]);return X(()=>{if(l)return t.loadSource({url:l,hls:m},r.current)},[t,l,m]),s}function Ge({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_u5gii_1",Le="_stage_u5gii_38",Fe="_shellFill_u5gii_87",Re="_shellFullscreen_u5gii_95",Me="_uiLayer_u5gii_110",xe="_engineStatus_u5gii_121",Ce="_volumeWrap_u5gii_134",_e="_volumeSlider_u5gii_140",se={shell:Se,stage:Le,shellFill:Fe,shellFullscreen:Re,uiLayer:Me,engineStatus:xe,volumeWrap:Ce,volumeSlider:_e},Be=({classes:n,videoRef:i,duration:t,formatTime:r,isScrubbing:l,buffered:m="auto",onSeek:s,onScrubStart:g,onScrubMove:v,onScrubEnd:R,timeLabelRef:E,children:w})=>{const p=C(null),S=C(null),P=C(null),k=C(null),h=C(null),u=C(!1),f=C(l);f.current=l;const b=C({onScrubMove:v,onScrubEnd:R});b.current={onScrubMove:v,onScrubEnd:R};const[A,I]=ue({time:0,position:null});X(()=>{const c=i.current;if(!c)return;const y=_=>{const U=_/t*100||0;p.current?.setAttribute("aria-valuenow",String(Math.round(_))),p.current?.setAttribute("aria-valuetext",`${r(_)} of ${r(t)}`),S.current&&(S.current.style.width=`${U}%`),P.current&&(P.current.style.left=`${U}%`),E?.current&&(E.current.innerText=`${r(_)} / ${r(t)}`)},M=()=>{l||y(c.currentTime)},$=()=>{if(m==="auto"&&c.buffered.length>0){const U=c.buffered.end(c.buffered.length-1)/t*100||0;k.current&&(k.current.style.width=`${U}%`)}};return y(c.currentTime),$(),c.addEventListener("timeupdate",M),c.addEventListener("progress",$),()=>{c.removeEventListener("timeupdate",M),c.removeEventListener("progress",$)}},[i,t,l,m,r,E]);const D=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 M=y/t*100||0;S.current&&(S.current.style.width=`${M}%`),P.current&&(P.current.style.left=`${M}%`),E?.current&&(E.current.innerText=`${r(y)} / ${r(t)}`);const $=p.current?.getBoundingClientRect();I({time:y,position:$?c*$.width:null})};X(()=>{if(!l){h.current=null;return}const c=M=>{if(h.current!==null&&M.pointerId!==h.current||!t)return;const $=D(M.clientX);b.current.onScrubMove($);const _=$*t;p.current?.setAttribute("aria-valuenow",String(Math.round(_))),p.current?.setAttribute("aria-valuetext",`${r(_)} of ${r(t)}`);const U=_/t*100||0;S.current&&(S.current.style.width=`${U}%`),P.current&&(P.current.style.left=`${U}%`),E?.current&&(E.current.innerText=`${r(_)} / ${r(t)}`);const e=p.current?.getBoundingClientRect();I({time:_,position:e?$*e.width:null})},y=M=>{h.current!==null&&M.pointerId!==h.current||(h.current=null,u.current=!0,M.pointerType!=="mouse"&&I({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,g());const y=D(c.clientX);v(y),Q(y)},G=c=>{if(!t||f.current||c.pointerType!=="mouse")return;const y=D(c.clientX);I({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,u.current=!0,c.pointerType!=="mouse"&&I({time:0,position:null});try{p.current?.hasPointerCapture(c.pointerId)&&p.current.releasePointerCapture(c.pointerId)}catch{}R()}};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(u.current){u.current=!1;return}!i.current||isNaN(t)||t===0||s(D(c.clientX))},onPointerDown:ne,onPointerMove:G,onPointerUp:Z,onPointerCancel:Z,onMouseMove:c=>{if(l||!t)return;const y=D(c.clientX);I({time:y*t,position:c.clientX-(p.current?.getBoundingClientRect().left??0)})},onMouseLeave:()=>{l||I({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,M=i.current.currentTime/t||0;s(Math.min(1,Math.max(0,M+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:k,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||g())}}),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 Ae(){const[n,i]=ue(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 $e=450,De=({muted:n,volume:i,volumeIcon:t,buttonClassName:r,sliderClassName:l,onToggleMute:m,onVolumeChange:s,onExpandedChange:g})=>{const v=Ae(),[R,E]=ue(!1),w=C(null),p=C(!1),S=C(null),P=de(b=>{E(b),g?.(b)},[g]);X(()=>()=>{w.current&&window.clearTimeout(w.current)},[]),X(()=>{if(!R)return;const b=A=>{S.current&&!S.current.contains(A.target)&&P(!1)};return document.addEventListener("pointerdown",b),()=>document.removeEventListener("pointerdown",b)},[R,P]);const k=n?0:i,h=()=>{p.current=!1,w.current&&window.clearTimeout(w.current),w.current=window.setTimeout(()=>{p.current=!0,P(!0)},$e)},u=()=>{w.current&&(window.clearTimeout(w.current),w.current=null)},f=b=>{if(b.stopPropagation(),p.current){p.current=!1;return}if(v){R?m():P(!0);return}m()};return d("div",{ref:S,className:se.volumeWrap,"data-expanded":R?"true":"false",onContextMenu:b=>b.preventDefault(),children:[d("button",{type:"button",className:r,onClick:f,onPointerDown:h,onPointerUp:u,onPointerLeave:u,onContextMenu:b=>b.preventDefault(),"aria-label":n?"Unmute":"Mute","aria-expanded":R,children:t}),d("input",{type:"range",min:"0",max:"1",step:"0.05",value:k,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":`${k*100}%`},"aria-label":"Volume"})]})};let ee=null,ie=null;async function Ie(){return ee||(ie||(ie=Pe(()=>import("./hls-BOLXTnjL.js"),[]).then(n=>(ee=n.default,ee)).catch(()=>null)),ie)}function Ne(n){return n.canPlayType("application/vnd.apple.mpegurl")!==""||n.canPlayType("application/x-mpegURL")!==""}function ae(){return document}function le(n){const i=ae();if(document.fullscreenElement)return document.fullscreenElement;if(i.webkitFullscreenElement)return i.webkitFullscreenElement;const t=n;return t?.webkitDisplayingFullscreen?t:null}function ge(n){return le(n)!==null}async function Ve(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 qe(n){const i=ae();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 Ue(n,i){!n&&!i||(ge(i)?await qe(i):n&&await Ve(n,i))}function He(n,i){const t=()=>{try{i(ge(n()))}catch{}},r=ae(),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 K=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 Ke(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},g={current:null};let v=null,R=()=>{},E=()=>{},w=0,p=!1,S=1,P=!1,k=null,h=!1;function u(e){Object.entries(e).every(([a,o])=>Object.is(t[a],o))||(t={...t,...e},l.forEach(a=>a()))}function f(e){r.currentTime===e.currentTime&&r.bufferedEnd===e.bufferedEnd||(r=e,m.forEach(a=>a()))}function b(e){if(!e)return;let a=0;for(let o=0;o<e.buffered.length;o++)if(e.buffered.start(o)<=e.currentTime&&e.buffered.end(o)>=e.currentTime){a=e.buffered.end(o);break}f({currentTime:Number.isFinite(e.currentTime)?e.currentTime:0,bufferedEnd:a})}function A(){b(s.current)}function I(){const e=s.current;if(v===e||(v&&(K===v&&(K=e),b(v),E(),v.pause(),v.removeAttribute("src"),v.load()),R(),v=e,!e))return;P=!1,K||(K=e),e.volume=t.volume,e.muted=t.isMuted,e.playbackRate=t.playbackRate;const a=()=>{const T=Array.from(e.textTracks);if(!T.length)return;const H=T.findIndex(W=>W.mode==="showing");u({subtitleTracks:T.map((W,z)=>({id:z,label:W.label||W.language||`Track ${z+1}`,language:W.language})),...H>=0?{activeSubtitleTrack:H}:{}})},o={play:()=>{K=e,u({isPlaying:!0,playBlocked:!1,error:null})},playing:()=>u({isPlaying:!0,isBuffering:!1,playBlocked:!1}),pause:()=>u({isPlaying:!1,isBuffering:!1}),ended:()=>{u({isPlaying:!1,isBuffering:!1}),A()},waiting:()=>{!e.paused&&(e.readyState<3||e.seeking)&&u({isBuffering:!0})},canplay:()=>u({isBuffering:!1}),seeking:()=>{e.paused||u({isBuffering:!0}),A()},seeked:()=>{u({isBuffering:!1}),A()},timeupdate:()=>{A(),!e.paused&&!e.seeking&&u({isBuffering:!1})},progress:A,loadedmetadata:()=>{e.playbackRate=t.playbackRate,u({duration:Number.isFinite(e.duration)?e.duration:0}),a()},durationchange:()=>u({duration:Number.isFinite(e.duration)?e.duration:0}),ratechange:()=>{t.isSpeedBoostActive||(S=e.playbackRate),e.defaultPlaybackRate!==e.playbackRate&&(e.defaultPlaybackRate=e.playbackRate),u({playbackRate:e.playbackRate})},volumechange:()=>{u({volume:e.volume,isMuted:e.muted}),Y(n.volumeKey,e.volume),Y(n.mutedKey,e.muted)},error:()=>u({error:e.error?.message||"Unable to play this source.",isPlaying:!1,isBuffering:!1})};Object.entries(o).forEach(([T,H])=>e.addEventListener(T,H)),e.textTracks.addEventListener("addtrack",a),e.textTracks.addEventListener("removetrack",a),e.textTracks.addEventListener("change",a);const L=()=>e.tagName==="VIDEO"?e:null,j=()=>{const T=le(L());u({isFullscreen:T!==null&&(T===e||T===g.current)})},B=typeof document>"u"?()=>{}:He(L,j);typeof document<"u"&&j(),R=()=>{Object.entries(o).forEach(([T,H])=>e.removeEventListener(T,H)),B(),e.textTracks.removeEventListener("addtrack",a),e.textTracks.removeEventListener("removetrack",a),e.textTracks.removeEventListener("change",a)}}async function D(){if(t.playbackLocked&&!h)return!1;const e=s.current;if(!e)return!1;K=e;const a=w;try{return await e.play(),a===w}catch(o){if(a===w){const L=o instanceof Error&&o.name==="NotAllowedError",j=o instanceof Error&&o.name==="AbortError";u({isPlaying:!1,isBuffering:!1,playBlocked:L,...!L&&!j?{error:o instanceof Error?o.message:"Playback failed."}:{}})}return!1}}function Q(){t.playbackLocked&&!h||s.current?.pause()}function ne(){s.current?.paused?D():Q()}function G(e){if(t.playbackLocked&&!h)return;const a=s.current;if(!a||!Number.isFinite(e))return;let o=Math.max(0,e);if(Number.isFinite(a.duration))o=Math.min(a.duration,o);else if(a.seekable.length)for(let L=0;L<a.seekable.length;L++){if(o<=a.seekable.end(L)){o=Math.max(a.seekable.start(L),o);break}L===a.seekable.length-1&&(o=a.seekable.end(L))}a.currentTime=o,A()}function Z(e){G((s.current?.currentTime??r.currentTime)+e)}function c(e){if(!Number.isFinite(e))return;const a=Math.max(0,Math.min(1,e));u({volume:a,isMuted:a===0}),s.current&&(s.current.volume=a,s.current.muted=a===0),Y(n.volumeKey,a),Y(n.mutedKey,a===0)}function y(){const e=!t.isMuted;!e&&t.volume===0&&c(.5),u({isMuted:e}),s.current&&(s.current.muted=e),Y(n.mutedKey,e)}function M(e){if(t.playbackLocked&&!h||!Number.isFinite(e)||e<.25||e>4)return;S=e;const a=t.isSpeedBoostActive?2:e;u({playbackRate:a}),s.current&&(s.current.playbackRate=a)}function $(){t.playbackLocked||t.isScrubbing||(p=!!s.current&&!s.current.paused,u({isScrubbing:!0}),Q())}function _(){t.isScrubbing&&(u({isScrubbing:!1}),p&&D(),p=!1)}function U(e,a={}){E(),I();const o=s.current,L=++w;if(!o)return()=>{};let j=!1,B=null;const T=()=>!j&&w===L&&s.current===o;o.pause(),o.removeAttribute("src"),o.load(),u({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 H=()=>{T()&&a.initialTime&&a.initialTime>0&&G(a.initialTime)};o.addEventListener("loadedmetadata",H,{once:!0});const W=()=>{T()&&(a.onReady?.(),a.autoPlay&&T()&&D())},z=F=>{if(!T())return;const N=F instanceof Error?F:new Error(String(F));u({error:N.message,isPlaying:!1,isBuffering:!1}),a.onError?.(N)},J=()=>{j||(j=!0,o.removeEventListener("loadedmetadata",H),o.removeEventListener("error",ce),B?.destroy(),k===B&&(k=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 Ie();if(!T())return;if(F?.isSupported()){B=new F({enableWorker:!0,startPosition:a.initialTime??-1,...a.hlsConfig}),k=B;const N=B,he=()=>{T()&&u({audioTracks:N.audioTracks.map((x,V)=>({id:V,label:x.name||x.lang||`Track ${V+1}`,language:x.lang})),...o.querySelector("track")?{}:{subtitleTracks:N.subtitleTracks.map((x,V)=>({id:V,label:x.name||x.lang||`Track ${V+1}`,language:x.lang}))},qualities:N.levels.map((x,V)=>({id:V,label:x.height?`${x.height}p`:`${Math.round(x.bitrate/1e3)}k`})),activeAudioTrack:N.audioTrack,...o.querySelector("track")?{}:{activeSubtitleTrack:N.subtitleTrack},activeQuality:N.currentLevel})};for(const x 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(x,he);if(B.on(F.Events.ERROR,(x,V)=>{V.fatal&&T()&&(z(new Error(`Stream failed (${V.details}). Try another source or reload.`)),J())}),B.once(F.Events.MANIFEST_PARSED,W),a.onHls?.(B,F),!T())return;B.loadSource(e.url),B.attachMedia(o);return}if(!Ne(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:g,connect:I,getState:()=>t,getTimeline:()=>r,getHls:()=>k,isActive:()=>K===s.current,subscribe:e=>(l.add(e),()=>{l.delete(e)}),subscribeTimeline:e=>(m.add(e),()=>{m.delete(e)}),play:D,pause:Q,togglePlay:ne,seek:G,seekRelative:Z,setVolume:c,toggleMute:y,setPlaybackRate:M,setPlaybackLocked:e=>u({playbackLocked:e}),applyRemotePlayback:(e,a,o)=>{h=!0;try{e!==void 0&&G(e),Math.abs(t.playbackRate-o)>.001&&M(o),a&&s.current?.paused?D():!a&&!s.current?.paused&&Q()}finally{h=!1}},setAudioTrack:e=>{k&&t.audioTracks.some(a=>a.id===e)&&(k.audioTrack=e,u({activeAudioTrack:e}))},setSubtitleTrack:e=>{if(e!==-1&&!t.subtitleTracks.some(o=>o.id===e))return;const a=s.current;a?.querySelector("track")?Array.from(a.textTracks).forEach((o,L)=>{o.mode=L===e?"showing":"disabled"}):k&&(k.subtitleTrack=e),u({activeSubtitleTrack:e})},setQuality:e=>{k&&(e===-1||t.qualities.some(a=>a.id===e))&&(k.currentLevel=e,u({activeQuality:e}))},setSpeedBoost:e=>{if(t.playbackLocked)return;const a=e?2:S;u({isSpeedBoostActive:e,playbackRate:a}),s.current&&(s.current.playbackRate=a)},setShowControls:e=>u({showControls:e}),startScrubbing:$,endScrubbing:_,loadSource:U,unload:()=>{const e=s.current;b(e),E(),e&&(e.pause(),e.removeAttribute("src"),e.load()),u({isPlaying:!1,isBuffering:!1,duration:0,error:null}),f({currentTime:0,bufferedEnd:0})},toggleFullscreen:()=>{const e=s.current;Ue(g.current,e?.tagName==="VIDEO"?e:null).catch(a=>u({error:a instanceof Error?a.message:"Fullscreen failed."}))},reset:()=>{u({duration:0,isBuffering:!1,error:null}),f({currentTime:0,bufferedEnd:0})},destroy:()=>{if(P)return;P=!0;const e=v??s.current;b(e),R(),v=null,E(),e?.pause(),e?.removeAttribute("src"),e?.load(),K===e&&(K=null)}}}function O(n){return me(n.subscribe,n.getState)}function ke(n){return me(n.subscribeTimeline,n.getTimeline)}function Je(n={}){const i=C(n),t=oe(()=>Ke(i.current),[]);return Te(()=>{t.connect()}),X(()=>()=>t.destroy(),[t]),oe(()=>({engine:t,mediaRef:t.mediaRef}),[t])}function Oe({children:n,...i}){const t=q(),{isPlaying:r,playbackLocked:l}=O(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 Ye({seconds:n,children:i,...t}){const r=q(),{playbackLocked:l}=O(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 Ze(n){const i=q(),{isFullscreen:t}=O(i);return d("button",{type:"button","aria-label":t?"Exit Fullscreen":"Fullscreen",...n,onClick:i.toggleFullscreen,children:d(te,{name:t?"compress":"expand"})})}function et({buttonClassName:n,onExpandedChange:i}){const t=q(),{isMuted:r,volume:l}=O(t);return d(De,{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 tt({className:n}){const i=q(),{volume:t,isMuted:r}=O(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 nt({classes:n,timeLabelRef:i,children:t}){const r=q(),{duration:l,isScrubbing:m,playbackLocked:s}=O(r);return d("div",{inert:s||void 0,style:{display:"contents"},children:d(Be,{classes:n,videoRef:r.mediaRef,duration:l,formatTime:be,isScrubbing:m,onSeek:g=>r.seek(g*l),onScrubStart:r.startScrubbing,onScrubMove:g=>r.seek(g*l),onScrubEnd:r.endScrubbing,timeLabelRef:i,children:t})})}function rt({className:n}){const i=q(),{currentTime:t,bufferedEnd:r}=ke(i),{duration:l,playbackLocked:m}=O(i),s=l?Math.min(100,t/l*100):0,g=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":`${g}%`},"aria-label":"Seek"})}function it({className:n,durationOnly:i=!1}){const t=q(),{currentTime:r}=ke(t),{duration:l}=O(t);return d("span",{className:n,children:be(i?l:r)})}function ut(){const n=q(),{error:i,playBlocked:t,isBuffering:r,playbackLocked:l}=O(n);return i?d("div",{role:"alert",children:i}):t&&l?d("span",{children:"Enable playback from the watch-along panel."}):t?d(Oe,{children:"Tap to play"}):r?d("div",{role:"status","aria-label":"Buffering",children:"Loading…"}):null}const je='input, textarea, button, select, a, [role="button"], [role="slider"], [contenteditable]:not([contenteditable="false"]), [data-player-ui="true"], [data-speed-boost-ignore="true"]';function at(n,i,t=!0){const r=C(i);r.current=i,X(()=>{if(!t)return;let l=!1,m=!1,s=!1,g,v,R=!1;const E=()=>{const u=m||s;u!==R&&(R=u,n.setSpeedBoost(u))},w=u=>u instanceof Element&&!!u.closest(je),p=u=>{if(!n.isActive()||!n.mediaRef.current||u.defaultPrevented||u.ctrlKey||u.metaKey||u.altKey||w(u.target))return;if(u.code==="Space"){if(u.preventDefault(),l)return;l=!0,g=setTimeout(()=>{g=void 0,m=!0,E()},180),r.current();return}const f=u.key.toLowerCase();["k","j","l","arrowleft","arrowright","arrowup","arrowdown","m","f"].includes(f)&&(u.preventDefault(),!(u.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=u=>{u.code!=="Space"||!l||(u.preventDefault(),l=!1,clearTimeout(g),g=void 0,m?(m=!1,E()):n.togglePlay(),r.current())},P=u=>{const f=u.target;u.button!==0||!(f instanceof Element)||w(f)||!n.containerRef.current?.contains(f)||(clearTimeout(v),v=setTimeout(()=>{v=void 0,s=!0,E()},180))},k=()=>{clearTimeout(v),v=void 0,s=!1,E()},h=()=>{clearTimeout(g),g=void 0,l=!1,m=!1,k()};return document.addEventListener("keydown",p),document.addEventListener("keyup",S),document.addEventListener("pointerdown",P),document.addEventListener("pointerup",k),document.addEventListener("pointercancel",k),window.addEventListener("blur",h),()=>{document.removeEventListener("keydown",p),document.removeEventListener("keyup",S),document.removeEventListener("pointerdown",P),document.removeEventListener("pointerup",k),document.removeEventListener("pointercancel",k),window.removeEventListener("blur",h),h()}},[n,t])}function lt({engine:n,children:i}){return d(ye.Provider,{value:n,children:i})}export{Ze as F,nt as P,Ye as S,tt as V,Oe as a,et as b,Ge as c,lt as d,q as e,O as f,ke as g,at as h,it as i,rt as j,ut as k,ze as l,Ae as m,ge as n,se as s,Je 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-
|
|
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-DYanm9eZ.js";import{I as o}from"./vendor-icons-DrybRNxP.js";import{S as le,O as A,a as ie,A as re,b as ce}from"./OptionListMenu-CHJb3qot.js";import"./vendor-query-BBT5_sHx.js";import"./useWatchAlongPlayer-3HXJvQR2.js";import"./PlayerProvider-BXBzQc8G.js";import"./playbackCompletion-CxGa4g7a.js";const oe="_settingsPanel_1dymm_1",me="_header_1dymm_33",de="_backBtn_1dymm_56",ue="_contentWrapper_1dymm_76",he="_menuContent_1dymm_82",pe="_menuItem_1dymm_89",be="_selected_1dymm_114",ye="_currentValue_1dymm_134",ge="_menuNote_1dymm_141",ve="_menuError_1dymm_150",n={settingsPanel:oe,header:me,backBtn:de,contentWrapper:ue,menuContent:he,menuItem:pe,selected:be,currentValue:ye,menuNote:ge,menuError:ve},ke=($,P)=>{const{isOpen:y,onClose:Ce,videoSources:fe,currentSource:C,currentLink:f,onSourceChange:V,subtitles:O,activeSubtitleTrack:g,onSubtitleChange:E,subtitleSettings:z,onSubtitleSettingsChange:T,useNativeControls:v,onNativeControlsToggle:U,anime4kEnabled:u,onAnime4kToggle:B,anime4kSupported:N,anime4kProfile:r,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:k}=$,{lowEndMode:F}=ae(),[a,i]=ne("main");w.useEffect(()=>{if(!y){const t=setTimeout(()=>i("main"),300);return()=>clearTimeout(t)}},[y]);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:g||"Off"})]}),e("button",{className:n.menuItem,onClick:()=>i("subtitle-style"),children:e("span",{children:"Subtitle Style"})}),F&&e("button",{className:`${n.menuItem} ${v?n.selected:""}`,onClick:()=>{const t=!v;U(t),se.setItem("playerUseNativeControls",t.toString())},children:[e("span",{children:"Native Controls"}),v&&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&&k&&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,c)=>(parseInt(c.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 c=t.find(l=>l.resolutionStr===s);c&&V(C,c)}})})},H=()=>e("div",{className:n.menuContent,children:e(A,{classes:{item:n.menuItem,active:n.selected},options:[{key:"off",label:"Off",selected:g==="off"},...O.map(t=>({key:t.label||t.lang,label:t.label,selected:g===(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 c=navigator.userAgent.toLowerCase();return c.includes("chrome")||c.includes("chromium")||c.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} ${r==="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"})]}),r==="low"&&e(o,{name:"check",size:12})]}),e("button",{className:`${n.menuItem} ${r==="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"})]}),r==="balanced"&&e(o,{name:"check",size:12})]}),e("button",{className:`${n.menuItem} ${r==="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"})]}),r==="high"&&e(o,{name:"check",size:12})]}),e("button",{className:`${n.menuItem} ${r==="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"})]}),r==="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(re,{classes:{item:n.menuItem,active:n.selected,note:n.menuNote},enabled:_,delayMs:I,onToggle:M,onDelayChange:D,onCalibrate:x})}),ee=()=>b&&k?e("div",{className:n.menuContent,children:e(ce,{classes:{item:n.menuItem,active:n.selected,note:n.menuNote},values:b,onChange:k})}):null;return y?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(ke);export{Ve as default};
|
package/client/dist/assets/{QueueOptionsButton-E2SuRJH_.js → QueueOptionsButton-BCxERY1G.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as T}from"./vendor-query-BBT5_sHx.js";import{q as z,t as A,r as J,ag as W,ah as X,ai as Y}from"./index-
|
|
1
|
+
import{b as T}from"./vendor-query-BBT5_sHx.js";import{q as z,t as A,r as J,ag as W,ah as X,ai as Y}from"./index-DYanm9eZ.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 y}from"./vendor-icons-DrybRNxP.js";import{d as Y,f as L}from"./index-
|
|
1
|
+
import{g as s,u as n,a as X}from"./vendor-core-DfaOB3Rn.js";import{I as y}from"./vendor-icons-DrybRNxP.js";import{d as Y,f as L}from"./index-DYanm9eZ.js";const z="_section_rx9ev_1",F="_header_rx9ev_10",O="_headerToggle_rx9ev_20",j="_headerActions_rx9ev_34",J="_title_rx9ev_40",K="_badge_rx9ev_50",V="_clearBtn_rx9ev_65",W="_nextBtn_rx9ev_83",Z="_list_rx9ev_101",ee="_item_rx9ev_114",ne="_active_rx9ev_134",te="_dragging_rx9ev_142",re="_dragHandle_rx9ev_149",ae="_thumbnail_rx9ev_167",oe="_meta_rx9ev_175",ce="_name_rx9ev_182",se="_episode_rx9ev_204",ie="_iconBtn_rx9ev_210",le="_metaGap_rx9ev_256",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:x,index:p,onRemove:P,onTouchPointerDown:D,onTouchPointerMove:B,onTouchPointerUp:T,onTouchPointerCancel:w,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":p,className:`${r.item} ${x?r.active:""} ${b?r.dragging:""}`,draggable:!0,onDragStart:R,onDragEnter:f,onDragOver:u=>u.preventDefault(),onDragEnd:c,onPointerDown:u=>D(p,u),onPointerMove:B,onPointerUp:T,onPointerCancel:w,children:[n("button",{className:r.dragHandle,type:"button","aria-label":"Drag queue item",children:n(y,{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:()=>{_()||P(a)},"aria-label":`Remove ${l} episode ${a.episodeNumber} from queue`,children:n(y,{name:"times"})})]})},ge=({title:a="Queue",eyebrow:x,items:p,currentShowId:P,currentEpisode:D,onRemove:B,onReorder:T,onNextQueue:w,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),v=s.useRef(null),d=s.useRef(null),h=s.useRef(!1),C=s.useRef(!1);s.useEffect(()=>{b(p)},[p]),s.useEffect(()=>{u(f)},[f]);const $=e=>{i(e)},k=e=>{if(o===null||o===e)return;const t=[...c],m=t[o];t.splice(o,1),t.splice(e,0,m),i(e),b(t)},A=()=>{o!==null&&T(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&&(T(c.map(t=>({id:t.id,showId:t.showId,episodeNumber:t.episodeNumber}))),C.current=!0,window.setTimeout(()=>{C.current=!1},0)),N.current=null,v.current=null,h.current=!1,i(null)},Q=(e,t)=>{if(t.pointerType==="mouse")return;const m=t.currentTarget,g=t.pointerId;N.current=t.pointerId,v.current={x:t.clientX,y:t.clientY},d.current!==null&&window.clearTimeout(d.current),d.current=window.setTimeout(()=>{h.current=!0,i(e);try{m.setPointerCapture(g)}catch{}},220)},S=e=>{if(e.pointerType==="mouse"||N.current!==e.pointerId)return;if(!h.current&&v.current){const H=Math.abs(e.clientX-v.current.x),G=Math.abs(e.clientY-v.current.y);(H>8||G>8)&&E(!1);return}if(!h.current)return;e.preventDefault();const m=document.elementFromPoint(e.clientX,e.clientY)?.closest?.("[data-queue-index]"),g=m?Number(m.dataset.queueIndex):NaN;if(Number.isNaN(g)||o===null||g===o)return;const I=[...c],U=I[o];I.splice(o,1),I.splice(g,0,U),i(g),b(I)},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:[x&&n("div",{className:"section-eyebrow",children:x}),n("span",{children:a})]}),n("span",{className:r.badge,children:c.length})]}),l?n(y,{name:"chevron-up"}):n(y,{name:"chevron-down"})]}),R&&_&&n("div",{className:r.headerActions,children:[w&&c.length>1&&n("button",{className:r.nextBtn,type:"button",onClick:w,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===P&&e.episodeNumber===D,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{ge 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-
|
|
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-l2gAJctz.js";import{L as F}from"./LibraryListPage-AGyVc7pR.js";import{u as _,M as z}from"./useMangaPopup-Dkq2Yw-e.js";import{M as D}from"./MangaResetProgressModal-CXRvdwD9.js";import{x as G,d as O,o as Q,p as Y,u as q,y as H,z as K,A as V,M as R,m as Z,i as j,b as J,c as W}from"./useMangaLibrary-CX_0zLJK.js";import"./vendor-icons-DrybRNxP.js";import"./vendor-ui-3qrARCPr.js";import"./useIsMobile-Dvx1uJ82.js";import"./MatureConsentModal-LTZSG_Kx.js";import"./index-DYanm9eZ.js";import"./vendor-query-BBT5_sHx.js";import"./SkeletonGrid-nW7P1jQU.js";import"./ErrorMessage-DAxegITP.js";import"./LibraryListPage.module-r6k9nyT9.js";import"./usePopup-DS9jMzp6.js";import"./ResetProgressModal-DLs9yqI-.js";import"./libraryInvalidation-DlwONLN-.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=G(r?"All":e,g,h),s=O(100),I=Q(),T=Y(),{toggle:L,bookmarkedIds:C}=q(),{popup:t,openPopup:k,scheduleClose:c,cancelClose:m,closePopup:M}=_(),f=H(),P=K(),B=V(),S=w(()=>r?(s.data?.data??[]).map(a=>{const o=a.page??0,l=a.pageCount??0;return{key:a.id,libId:a.id,provider:a.provider,mangaId:a.mangaId,title:a.title||"",altTitle:a.altTitle,cover:a.cover||"",status:a.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]),A=r?s.data?.total??0:n.data?.total??0,$=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:A,isLoading:$,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)=>f.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:J(a.provider,a.cover),chapterBadge:a.chapterLabel??null,isAdult:j(a)},linkTo:a.detailTarget,hoverIcon:"book",progress:a.progressPercent!==void 0&&a.progressLabel?{percent:a.progressPercent,label:a.progressLabel}:void 0,showProgress:r,display:{elements:{poster:{typeBadge:!1,chapterBadge:!0,adultBadge:!0},info:{title:!0,mobileBadges:!0,progress:!0,meta:!1}}},onRemove:r?()=>u(a):void 0,onOpenDetails:o=>k(o,y(a)),onPopupHoverIntent:o=>o?m():c(),rawThumbnail:!0}),modals:i(E,{children:[t&&t.data.provider&&i(z,{data:t.data,anchorRect:t.rect,bookmarked:C.has(Z(t.data.provider,t.data.mangaId)),onToggleBookmark:()=>L({id:t.data.mangaId,provider:t.data.provider,title:t.data.title,cover:t.data.cover,altTitle:t.data.altTitle??void 0,contentRating:t.data.contentRating}),onMouseEnter:m,onMouseLeave:c,onRequestClose:M}),i(D,{mangaId:d?d.libId:null,title:d?.title,onClose:()=>u(null)})]})})}export{Ra as default};
|
package/client/dist/assets/{ResetProgressModal-B4qmiw-m.js → ResetProgressModal-DLs9yqI-.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as f,h as u,u as e}from"./vendor-core-DfaOB3Rn.js";import{L as a,B as c}from"./index-
|
|
1
|
+
import{d as f,h as u,u as e}from"./vendor-core-DfaOB3Rn.js";import{L as a,B as c}from"./index-DYanm9eZ.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-
|
|
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-l2gAJctz.js";import{A as Ae}from"./AnimeCard-BURLDiUV.js";import{S as Se}from"./SkeletonGrid-nW7P1jQU.js";import{t as ye,u as be,C as Ne,a4 as te,B as x,a5 as Ce}from"./index-DYanm9eZ.js";import{E as Te}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-LTZSG_Kx.js";import"./useAnimeInfoData-DMeGA3wY.js";import"./vendor-query-BBT5_sHx.js";import"./QueueOptionsButton-BCxERY1G.js";import"./playbackCompletion-CxGa4g7a.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,B]=o(r.get("query")||""),[v,G]=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,C]=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:T,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]);_(()=>{B(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")||""),G(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")),C(e)},[r]);const c=(e=1,s={})=>{Ce();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&&G(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],C(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=>B(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:()=>{C(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:()=>{C({}),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(Te,{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:T})]}),a("div",{className:`${t.resultsGrid} ${oe?t.lowEnd:""}`,children:T?a(Se,{}):E.map(e=>a(Ae,{anime:e},e._id))}),!T&&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:T,variant:"labeled"})})]})}export{We as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d as r,u as e,S as he,A as J,h as q,q as ge,T as De,p as Ae,g as ye,_ as Oe}from"./vendor-core-DfaOB3Rn.js";import{b as me,u as Z}from"./vendor-query-BBT5_sHx.js";import{N as X,O as V,P as U,Q as ve,B as S,R as qe,L as E,d as Ge,H as Ce,t as w,n as Se,l as Me,F as be,S as Y,q as H,U as we,V as ze,W as Ue,u as Ee,e as Ke,X as Fe,G as oe,p as $e,Y as He,Z as We}from"./index-B_2ppn5P.js";import{T as $}from"./ToggleSwitch-CN_ppEc9.js";import{I as ne}from"./vendor-icons-DrybRNxP.js";const Be="_sectionCard_1axuo_1",Qe="_dangerCard_1axuo_23",je="_settingRow_1axuo_31",I={sectionCard:Be,dangerCard:Qe,settingRow:je};function Ve(){const{data:t}=me(X),{data:o}=me({queryKey:["profiles"],queryFn:()=>V("/api/profiles/status"),enabled:!!t?.owner}),c=Z(),[h,m]=r(null),[u,k]=r(""),[p,s]=r(""),[a,g]=r(""),[y,d]=r(""),[L,l]=r(""),[f,N]=r(!1),[T,A]=r(null),P=async n=>{N(!0),l("");try{await V("/api/profiles/update",{method:"POST",body:JSON.stringify(n)}),await c.invalidateQueries({queryKey:X.queryKey}),k(""),s(""),l("Profile saved")}catch(C){l(C.message)}finally{N(!1)}};return t?e("section",{className:I.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(ve,{image:t.image,name:t.name}),e("label",{className:U.field,children:["Upload image",e("input",{type:"file",accept:"image/png,image/jpeg,image/webp,image/gif",disabled:f,onChange:async n=>{const C=n.currentTarget.files?.[0];if(n.currentTarget.value="",!C)return;if(C.size>2*1024*1024){l("Image must be smaller than 2 MB");return}const x=new FileReader;x.onerror=()=>l("Could not read image"),x.onload=()=>{P({avatar:x.result})},x.readAsDataURL(C)}})]}),t.avatar&&e(S,{variant:"secondary",disabled:f,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:h??t.name})},children:[e("label",{className:U.field,children:["Profile name",e("input",{value:h??t.name,maxLength:60,required:!0,onChange:n=>m(n.currentTarget.value)})]}),e(S,{type:"submit",disabled:f,children:"Save name"})]}),e("form",{className:U.form,onSubmit:n=>{n.preventDefault(),P({password:u,currentPassword:p})},children:[t.protected&&e("label",{className:U.field,children:["Current password",e("input",{type:"password",autoComplete:"current-password",value:p,required:!0,maxLength:256,onChange:n=>s(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:u,minLength:8,maxLength:256,onChange:n=>k(n.currentTarget.value)})]}),e(S,{type:"submit",disabled:f,children:"Save password"})]}),e(S,{variant:"secondary",disabled:f,onClick:async()=>{N(!0);try{await V("/api/profiles/logout",{method:"POST"}),qe()}catch(n){l(n.message),N(!1)}},children:"Switch profile / sign out"}),t.owner&&e("form",{className:U.form,onSubmit:async n=>{n.preventDefault(),N(!0),l("");try{await V("/api/profiles/create",{method:"POST",body:JSON.stringify({name:a,password:y})}),g(""),d(""),await c.invalidateQueries({queryKey:["profiles"]}),l("Profile created. Sign out to switch to it.")}catch(C){l(C.message)}finally{N(!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=>g(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=>d(n.currentTarget.value)})]}),e(S,{type:"submit",disabled:f||!t.protected,children:"Create profile"})]}),t.owner&&o?.profiles.some(n=>!n.owner)&&e(he,{children:[e("h3",{children:"Other profiles"}),e("ul",{className:U.profileList,children:o.profiles.filter(n=>!n.owner).map(n=>e("li",{children:[e("span",{className:U.smallAvatar,children:e(ve,{image:n.avatar??n.cloudAvatar,name:n.name})}),e("span",{className:U.profileName,children:n.name}),e(S,{variant:"danger",size:"sm",disabled:f,onClick:()=>{l(""),A(n)},children:"Delete"})]},n.id))})]}),e(E,{isOpen:!!T,onClose:f?void 0:()=>A(null),title:"Delete profile?",width:"sm",footer:e(he,{children:[e(S,{variant:"secondary",disabled:f,onClick:()=>A(null),children:"Cancel"}),e(S,{variant:"danger",loading:f,onClick:async()=>{if(T){N(!0);try{await V("/api/profiles/delete",{method:"POST",body:JSON.stringify({id:T.id,confirm:!0})}),await c.invalidateQueries({queryKey:["profiles"]}),A(null),l("Profile deleted. Local files will be removed when Dango restarts.")}catch(n){l(n.message),A(null)}finally{N(!1)}}},children:"Delete profile"})]}),children:[e("p",{children:["Delete ",e("strong",{children:T?.name}),"? This signs them out immediately. Their local libraries, settings and connections will be removed when Dango next restarts."]}),e("p",{children:"Cloud backups and tracker lists will stay intact. Export any library you want to keep before deleting."})]}),L&&e("p",{role:"status",children:L})]}):null}const le={"title-preference-container":"_title-preference-container_sdqgs_1","toggle-button":"_toggle-button_sdqgs_21","toggle-label":"_toggle-label_sdqgs_51"},ce=["name","nativeName","englishName"],de={name:"Default (Romaji)",nativeName:"Native",englishName:"English"},Ye=()=>{const{titlePreference:t,setTitlePreference:o,loading:c}=Ge(),h=Ce(),[m,u]=r(de[t]),[k,p]=r(!1),s=J(null);q(()=>{c||u(de[t])},[t,c]);const a=async()=>{if(k)return;p(!0);const y=(ce.indexOf(t)+1)%ce.length,d=ce[y],L=de[d];s.current&&(s.current.style.transform="translateX(-100%)",s.current.style.opacity="0"),setTimeout(async()=>{u(L),o(d),s.current&&(s.current.style.transition="none",s.current.style.transform="translateX(100%)",s.current.style.opacity="0",s.current.offsetWidth,s.current.style.transition="transform 0.3s ease-out, opacity 0.3s ease-out",s.current.style.transform="translateX(0)",s.current.style.opacity="1");try{await h.mutateAsync({key:"titlePreference",value:d})}catch(l){console.error("Error saving title preference:",l)}finally{p(!1)}},300)};return c?e("p",{children:"Loading title preference..."}):e("div",{className:le["title-preference-container"],children:[e("h4",{children:"Anime Title Display Preference"}),e("button",{onClick:a,className:le["toggle-button"],disabled:k,children:e("span",{ref:s,className:le["toggle-label"],children:m})})]})},Je="_settingsHeader_ik3bf_1",Xe="_pageTitle_ik3bf_6",Ze="_pageSubtitle_ik3bf_14",et="_settingsLayout_ik3bf_20",tt="_sidebar_ik3bf_27",at="_sidebarIndicator_ik3bf_35",nt="_sidebarItem_ik3bf_50",rt="_active_ik3bf_72",st="_mainContent_ik3bf_80",it="_tabContent_ik3bf_85",ot="_settingItem_ik3bf_103",lt="_controls_ik3bf_108",ct="_status_ik3bf_114",_={settingsHeader:Je,pageTitle:Xe,pageSubtitle:Ze,settingsLayout:et,sidebar:tt,sidebarIndicator:at,sidebarItem:nt,active:rt,mainContent:st,tabContent:it,settingItem:ot,controls:lt,status:ct},dt="_title_tm30b_11",ut="_signIn_tm30b_18",ht="_userInfo_tm30b_25",gt="_warning_tm30b_47",mt="_formGroup_tm30b_54",pt="_label_tm30b_58",ft="_inputWrapper_tm30b_68",yt="_input_tm30b_68",vt="_select_tm30b_92",bt="_actions_tm30b_109",wt="_hr_tm30b_117",v={title:dt,signIn:ut,userInfo:ht,warning:gt,formGroup:mt,label:pt,inputWrapper:ft,input:yt,select:vt,actions:bt,hr:wt},kt=()=>{const t=Z(),[o,c]=r(!0),[h,m]=r(!1),[u,k]=r(!1),[p,s]=r(null),[a,g]=r({status:"idle"}),[y,d]=r(!1),[L,l]=r(""),[f,N]=r(!1),T=J(null),[A,P]=r({show:!1,message:"",type:"info"}),n=()=>{T.current&&(window.clearInterval(T.current),T.current=null)},C=ge(b=>{k(b.authenticated),s(b.user||b.device.user||null),g(b.device),d(!!b.hasCustomClientId)},[]),x=ge(async()=>{const b=await w.auth.githubStatus.query();C(b)},[C]),G=async()=>{try{const b=await w.auth.githubPoll.query();g(b),b.status==="success"?(n(),await t.invalidateQueries({queryKey:X.queryKey}),await x(),P({show:!0,message:"GitHub authentication complete. Sync has been initialized.",type:"success"})):b.status==="error"&&(n(),P({show:!0,message:b.error||"GitHub authentication failed.",type:"error"}))}catch{n(),P({show:!0,message:"Failed to poll GitHub authentication status.",type:"error"})}},R=(b=5)=>{n(),T.current=window.setInterval(G,Math.max(b,5)*1e3)};q(()=>(x().catch(()=>{P({show:!0,message:"Failed to load GitHub sync status.",type:"error"})}).finally(()=>c(!1)),n),[x]);const M=async()=>{m(!0);try{const b=await w.auth.githubStart.mutate();g(b),R(b.verification?.interval)}catch(b){P({show:!0,message:b instanceof Error?b.message:"Failed to start GitHub authentication.",type:"error"})}finally{m(!1)}},O=async()=>{try{await w.auth.githubLogout.mutate(),await t.invalidateQueries({queryKey:X.queryKey}),k(!1),s(null),g({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"})}},B=async()=>{N(!0);try{await w.auth.saveGithubAuth.mutate({clientId:L}),l(""),await x(),P({show:!0,message:"Custom GitHub auth saved.",type:"success"})}catch{P({show:!0,message:"Failed to save override.",type:"error"})}finally{N(!1)}},Q=async()=>{N(!0);try{await w.auth.saveGithubAuth.mutate({clientId:""}),l(""),await x(),P({show:!0,message:"Custom auth cleared. Using dango defaults.",type:"success"})}catch{P({show:!0,message:"Failed to clear override.",type:"error"})}finally{N(!1)}};return o?e("div",{style:{color:"var(--text-secondary)",padding:"1.5rem"},children:"Loading..."}):e("div",{className:I.sectionCard,children:[e("h3",{className:v.title,children:"GitHub Cloud Sync"}),e("p",{className:v.signIn,children:"Sync local data through a private GitHub repository named dango-sync-data."}),u&&p?e("div",{className:v.userInfo,children:[e("p",{children:["Signed in as: ",e("strong",{children:p.name||p.login})]}),e(S,{variant:"danger",onClick:O,children:"Sign Out"})]}):e("div",{className:v.signIn,children:e(S,{onClick:M,disabled:h||a.status==="pending",children:h||a.status==="pending"?"Waiting for GitHub...":"Sign in with GitHub"})}),a.status==="pending"&&a.verification&&e(he,{children:[e("hr",{className:v.hr}),e("div",{className:v.formGroup,children:[e("label",{className:v.label,children:"Verification URL"}),e("div",{className:v.inputWrapper,children:[e("input",{className:v.input,value:a.verification.verification_uri,readOnly:!0}),e(S,{onClick:()=>{const b=a.verification?.verification_uri;b&&/^https?:\/\//i.test(b)&&window.open(b,"_blank","noopener,noreferrer")},children:"Open"})]})]}),e("div",{className:v.formGroup,children:[e("label",{className:v.label,children:"Device Code"}),e("input",{className:v.input,value:a.verification.user_code,readOnly:!0})]})]}),a.status==="error"&&e("p",{className:v.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:v.formGroup,style:{marginTop:"0.75rem"},children:[e("label",{className:v.label,children:"Client ID (optional)"}),e("input",{className:v.input,value:L,onChange:b=>l(b.currentTarget.value),placeholder:"Your GitHub OAuth app ID"})]}),e("div",{className:v.actions,children:[e(S,{onClick:B,disabled:f,children:"Save override"}),e(S,{variant:"secondary",onClick:Q,disabled:f,children:"Use dango defaults"})]})]}),e(E,{isOpen:A.show,onClose:()=>P(b=>({...b,show:!1})),width:"sm",children:[e(E.Body,{children:e("p",{children:A.message})}),e(E.Actions,{children:e(S,{onClick:()=>P(b=>({...b,show:!1})),children:"OK"})})]})]})},Ct=()=>{const[t,o]=r(!0),[c,h]=r(null),[m,u]=r(!1),[k,p]=r(!1),[s,a]=r(""),[g,y]=r(""),[d,L]=r(""),[l,f]=r(!1),[N,T]=r({show:!1,message:"",type:"info"}),A=async()=>{try{const M=await w.auth.user.query();h(M?.email?M:null)}catch{h(null)}},P=async()=>{try{const[R,M]=await Promise.all([w.auth.configStatus.query(),w.auth.googleAuth.query()]);u(!!R.hasConfig),p(!!(M.hasCustomWorkerUrl||M.hasCustomClientId||M.hasClientSecret))}catch(R){console.error("Failed to fetch config status",R)}};q(()=>{(async()=>{o(!0),await Promise.all([A(),P()]);try{new URLSearchParams(window.location.search).get("google_auth")==="success"&&(await A(),window.history.replaceState(null,"",window.location.pathname))}catch{}o(!1)})();const M=O=>{O.origin===window.location.origin&&typeof O.data=="object"&&O.data!==null&&O.data.type==="GOOGLE_AUTH_SUCCESS"&&(h(O.data.user),window.location.reload())};return window.addEventListener("message",M),()=>window.removeEventListener("message",M)},[]);const n=async()=>{try{const R=await w.auth.googleLogin.mutate();if(R.authenticated){window.location.reload();return}if(R.url){if(typeof window.DangoBridge<"u"){window.location.href=R.url;return}const O=600,B=700,Q=window.innerWidth/2-O/2,b=window.innerHeight/2-B/2;window.open(R.url,"GoogleAuth",`width=${O},height=${B},top=${b},left=${Q}`)}else throw new Error("Auth URL not available")}catch{T({show:!0,message:"Authentication failed. Ensure server is configured correctly.",type:"error"})}},C=async()=>{try{await w.auth.logout.mutate(),h(null),T({show:!0,message:"Successfully signed out.",type:"success"}),window.location.reload()}catch(R){console.error("Sign out failed",R),T({show:!0,message:"Failed to sign out.",type:"error"})}},x=async()=>{f(!0);try{await w.auth.saveGoogleAuth.mutate({workerUrl:s,clientId:g,clientSecret:d}),a(""),y(""),L(""),await P(),T({show:!0,message:"Custom auth saved. Restart may be required.",type:"success"})}catch{T({show:!0,message:"Failed to save override.",type:"error"})}finally{f(!1)}},G=async()=>{f(!0);try{await w.auth.saveGoogleAuth.mutate({workerUrl:"",clientId:"",clientSecret:""}),a(""),y(""),L(""),await P(),T({show:!0,message:"Custom auth cleared. Using dango defaults.",type:"success"})}catch{T({show:!0,message:"Failed to clear override.",type:"error"})}finally{f(!1)}};return t?e("div",{style:{color:"var(--text-secondary)",padding:"1.5rem"},children:"Loading..."}):e("div",{className:I.sectionCard,children:[e("h3",{className:v.title,children:"Google Drive Sync"}),c?e("div",{className:v.userInfo,children:[e("p",{children:["Signed in as: ",e("strong",{children:c.name})," (",c.email,")"]}),e(S,{variant:"danger",onClick:C,children:"Sign Out"})]}):e("div",{className:v.signIn,children:[e("p",{children:"Sign in with your Google account to enable synchronization features."}),e(S,{onClick:n,disabled:!m,children:"Sign in with Google"}),!m&&e("p",{className:v.warning,children:"Google sync is not configured on the server."})]}),e("details",{style:{marginTop:"1rem",fontSize:"var(--font-size-sm)"},children:[e("summary",{style:{cursor:"pointer",color:"var(--text-secondary)"},children:["Advanced: use your own auth ",k?"(override active)":""]}),e("div",{className:v.formGroup,style:{marginTop:"0.75rem"},children:[e("label",{className:v.label,children:"Worker URL (optional)"}),e("input",{className:v.input,value:s,onChange:R=>a(R.currentTarget.value),placeholder:"https://your-worker.workers.dev"})]}),e("div",{className:v.formGroup,children:[e("label",{className:v.label,children:"Client ID (optional)"}),e("input",{className:v.input,value:g,onChange:R=>y(R.currentTarget.value),placeholder:"Your Google OAuth client ID"})]}),e("div",{className:v.formGroup,children:[e("label",{className:v.label,children:"Client Secret (optional)"}),e("input",{type:"password",className:v.input,value:d,onChange:R=>L(R.currentTarget.value),placeholder:"Your Google OAuth secret"})]}),e("div",{className:v.actions,children:[e(S,{onClick:x,disabled:l,children:"Save override"}),e(S,{variant:"secondary",onClick:G,disabled:l,children:"Use dango defaults"})]})]}),e(E,{isOpen:N.show,onClose:()=>T(R=>({...R,show:!1})),width:"sm",children:[e(E.Body,{children:e("p",{children:N.message})}),e(E.Actions,{children:e(S,{onClick:()=>T(R=>({...R,show:!1})),children:"OK"})})]})]})},St="_settingItem_3qq0n_1",Nt="_modalOverlay_3qq0n_6",_t="_modal_3qq0n_6",Tt="_modalActions_3qq0n_41",Lt="_modalSecondary_3qq0n_47",Pt="_modalPrimary_3qq0n_57",W={settingItem:St,modalOverlay:Nt,modal:_t,modalActions:Tt,modalSecondary:Lt,modalPrimary:Pt},It={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"]]}},xt=(t,o)=>{if(t==null)return o;const c=String(t);return c==="true"||c==="1"?!0:c==="false"||c==="0"?!1:o},ke=(t,o,c)=>{const[h,m]=r(o),[u,k]=r(!1),p=Z();return q(()=>{(async()=>{try{const g=await w.settings.getByKey.query({key:t});m(xt(g.value,o))}catch(g){console.error("Failed to fetch setting",g)}})()},[t,o]),{value:h,setValue:m,isUpdating:u,toggle:async()=>{if(u)return;k(!0);const a=!h;m(a);try{await w.settings.set.mutate({key:t,value:a});for(const g of c)p.invalidateQueries({queryKey:g})}catch(g){console.error("Error saving setting:",g),m(!a)}finally{k(!1)}}}},Rt=()=>{const{contentType:t}=Se(),o=It[t],[c,h]=r(!1),[m,u]=r(!0),[k,p]=r(!1),s=ke(o.ignoreKey,!0,o.invalidateKeys),a=ke(o.listOnlyKey,!1,o.invalidateKeys),[g,y]=r(null),[d,L]=r(!1),l=Z(),f=Me();q(()=>{u(!0),(async()=>{try{const C=await w.settings.getByKey.query({key:o.skipKey});String(C.value)==="true"||String(C.value)==="1"?h(!0):h(!1)}catch(C){console.error("Failed to fetch setting",C)}finally{u(!1)}})()},[o.skipKey]);const N=async()=>{if(k)return;p(!0);const n=!c;h(n);try{await w.settings.set.mutate({key:o.skipKey,value:n})}catch(C){console.error("Error saving setting:",C),h(!n)}finally{p(!1)}},T=async()=>{if(!s.isUpdating){if(s.value)try{let n;if(t==="anime"?n=(await w.continueWatching.adultCount.query()).count:t==="manga"?n=(await w.mangaProgress.adultCount.query()).count:t==="asmr"?n=(await w.asmrProgress.adultCount.query()).count:n=(await w.tvProgress.adultCount.query()).count,typeof n=="number"&&n>0){y(n);return}}catch(n){console.error("Failed to fetch adult count",n)}s.toggle()}},A=()=>{y(null),s.toggle()},P=async()=>{if(!d){L(!0);try{let n;t==="anime"?n=(await w.continueWatching.purgeAdult.mutate()).removed:t==="manga"?n=(await w.mangaProgress.purgeAdult.mutate()).removed:t==="asmr"?n=(await w.asmrProgress.purgeAdult.mutate()).removed:n=(await w.tvProgress.purgeAdult.mutate()).removed,be.success(o.purgeDoneText(n??0));for(const C of o.invalidateKeys)l.invalidateQueries({queryKey:C});t==="anime"&&l.invalidateQueries(f.continueWatching.pathFilter()),t==="manga"&&l.invalidateQueries(f.mangaProgress.pathFilter()),t==="asmr"&&l.invalidateQueries(f.asmrProgress.pathFilter()),t==="tv"&&l.invalidateQueries(f.tvProgress.pathFilter())}catch(n){console.error("Failed to purge adult entries",n),be.error("Failed to remove adult entries")}finally{L(!1),y(null)}s.toggle()}};return m?e("div",{children:"Loading settings..."}):e("div",{className:I.sectionCard,children:[e("h3",{children:o.heading}),e("p",{children:o.blurb}),e("div",{className:W.settingItem,children:e("div",{className:I.settingRow,children:[e("label",{htmlFor:"skip-confirmation-toggle",children:o.skipLabel}),e($,{isChecked:c,onChange:N,id:"skip-confirmation-toggle",disabled:k})]})}),e("div",{className:W.settingItem,children:e("div",{className:I.settingRow,children:[e("label",{htmlFor:"ignore-adult-toggle",children:o.ignoreLabel}),e($,{isChecked:s.value,onChange:T,id:"ignore-adult-toggle",disabled:s.isUpdating})]})}),e("div",{className:W.settingItem,children:e("div",{className:I.settingRow,children:[e("label",{htmlFor:"cw-watchlist-only-toggle",children:o.listOnlyLabel}),e($,{isChecked:a.value,onChange:a.toggle,id:"cw-watchlist-only-toggle",disabled:a.isUpdating})]})}),g!==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:[g," adult ",g===1?"entry":"entries"," not in your"," ",o.listNoun," ",g===1?"is":"are"," currently hidden from"," ",o.continueNoun,". You can purge ",g===1?"it":"them"," from the database instead of showing ",g===1?"it":"them","."]}),e("div",{className:W.modalActions,children:[e("button",{type:"button",className:W.modalSecondary,onClick:A,disabled:d,children:"Show them"}),e("button",{type:"button",className:W.modalPrimary,onClick:P,disabled:d,children:d?"Purging...":`Purge ${g}`})]})]})})]})},Dt="_statsGrid_o4nf0_1",At="_statCard_o4nf0_8",Ot="_statLabel_o4nf0_18",qt="_statValue_o4nf0_26",Gt="_statMeta_o4nf0_32",Mt="_statusBanner_o4nf0_38",zt="_statusSuccess_o4nf0_49",Ut="_statusUpdating_o4nf0_55",Et="_statusError_o4nf0_61",Kt="_sha_o4nf0_67",Ft="_settingItem_o4nf0_74",$t="_settingTitle_o4nf0_79",Ht="_settingSubtitle_o4nf0_85",Wt="_actionsRow_o4nf0_92",D={statsGrid:Dt,statCard:At,statLabel:Ot,statValue:qt,statMeta:Gt,statusBanner:Mt,statusSuccess:zt,statusUpdating:Ut,statusError:Et,sha:Kt,settingItem:Ft,settingTitle:$t,settingSubtitle:Ht,actionsRow:Wt},Bt=()=>{const[t,o]=r(null),[c,h]=r(!0),[m,u]=r(!1),[k,p]=r(!1),s=J(null),a=async()=>{try{const l=await w.settings.offlineDbInfo.query();return o(l),l}catch(l){console.error("Failed to fetch offline DB info:",l)}finally{h(!1)}return null};q(()=>(a(),()=>{s.current&&window.clearInterval(s.current)}),[]),q(()=>{t?.isRefreshing?s.current||(s.current=window.setInterval(async()=>{const l=await a();l&&!l.isRefreshing&&s.current&&(window.clearInterval(s.current),s.current=null)},2e3)):s.current&&(window.clearInterval(s.current),s.current=null)},[t?.isRefreshing]);const g=async()=>{if(!t||m)return;const l=!t.autoUpdateEnabled;u(!0),o({...t,autoUpdateEnabled:l});try{await w.settings.setOfflineDbAutoUpdate.mutate({enabled:l})}catch(f){console.error("Failed to update auto update setting:",f),o({...t,autoUpdateEnabled:!l})}finally{u(!1)}},y=async()=>{if(!(t?.isRefreshing||k)){p(!0);try{await w.settings.triggerOfflineDbUpdate.mutate(),o(l=>l?{...l,isRefreshing:!0,lastStatus:"updating",lastMessage:"Downloading database..."}:null)}catch(l){console.error("Failed to trigger offline DB update:",l)}finally{p(!1)}}},d=l=>{if(!l)return"Never";try{return new Date(l).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}catch{return l}},L=t?.isRefreshing||k;return e("div",{className:I.sectionCard,children:[e("h3",{children:"Offline Metadata Database"}),e("p",{children:"Local MAL to AniList ID map used for instant imports and metadata enrichment without hitting rate-limited APIs. Updates automatically every Saturday in the background."}),e("div",{className:D.statsGrid,children:[e("div",{className:D.statCard,children:[e("span",{className:D.statLabel,children:"MAL Mapped"}),e("span",{className:D.statValue,children:c?"-":(t?.totalMalMapped??0).toLocaleString()})]}),e("div",{className:D.statCard,children:[e("span",{className:D.statLabel,children:"Release"}),e("span",{className:D.statMeta,children:c?"-":t?.releaseTag??"Never"})]}),e("div",{className:D.statCard,children:[e("span",{className:D.statLabel,children:"Last Checked"}),e("span",{className:D.statMeta,children:c?"-":d(t?.lastCheckedAt??null)})]}),e("div",{className:D.statCard,children:[e("span",{className:D.statLabel,children:"Last Updated"}),e("span",{className:D.statMeta,children:c?"-":d(t?.lastUpdatedAt??null)})]})]}),t?.lastMessage&&e("div",{className:`${D.statusBanner} ${t.lastStatus==="failed"?D.statusError:t.lastStatus==="updating"?D.statusUpdating:D.statusSuccess}`,children:[e("span",{children:t.lastMessage}),t.contentSha256&&e("span",{className:D.sha,children:["sha:",t.contentSha256.slice(0,12)]})]}),e("div",{className:D.settingItem,children:e("div",{className:I.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:g,disabled:c||m})]})}),e("div",{className:D.actionsRow,children:e(S,{onClick:y,disabled:c||L,children:L?"Updating Database...":"Update Offline Database Now"})})]})},Qt="_status_1wbo0_1",jt="_warningText_1wbo0_7",Vt="_ackLabel_1wbo0_11",ue={status:Qt,warningText:jt,ackLabel:Vt},Yt=()=>{const t=Z(),[o,c]=r(!1),[h,m]=r(!1),[u,k]=r(!1),[p,s]=r(""),a=()=>{m(!1),s(""),c(!0)},g=()=>{u||(c(!1),m(!1))},y=async()=>{if(!(!h||u)){k(!0),s("");try{const d=await Y("/api/database/clear",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({confirm:!0})}),L=await d.json();if(!d.ok)throw new Error(L.error||"Failed to clear database");const l=L.deleted,f=L.deletedManga,N=L.deletedTv,T=L.deletedAsmr,A=Object.values(l).reduce((x,G)=>x+(G||0),0)+Object.values(f??{}).reduce((x,G)=>x+(G||0),0)+Object.values(N??{}).reduce((x,G)=>x+(G||0),0)+Object.values(T??{}).reduce((x,G)=>x+(G||0),0),P=(f?.manga_library??0)+(f?.manga_progress??0),n=(N?.tv_library??0)+(N?.tv_progress??0),C=(T?.asmr_library??0)+(T?.asmr_progress??0);s(`Library cleared - ${l.watchlist??0} watchlist entries, ${P} manga rows, ${n} TV rows, ${C} ASMR rows and ${A} total rows removed.`),t.invalidateQueries({queryKey:[H.watchlist]}),t.invalidateQueries({queryKey:[H.continueWatching]}),t.invalidateQueries({queryKey:[H.mangaLibrary]}),t.invalidateQueries({queryKey:[H.mangaContinueReading]}),t.invalidateQueries({queryKey:[H.tvLibrary]}),t.invalidateQueries({queryKey:[H.tvContinueWatching]}),t.invalidateQueries({queryKey:[H.asmrLibrary]}),t.invalidateQueries({queryKey:[H.asmrContinueListening]}),c(!1)}catch(d){s(d.message)}finally{k(!1),m(!1)}}};return e("div",{className:`${I.sectionCard} ${I.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"}),p&&e("p",{className:ue.status,children:p}),e(E,{isOpen:o,onClose:g,title:"Clear library data?",width:"sm",children:[e(E.Body,{children:[e("p",{className:ue.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:ue.ackLabel,children:[e("input",{type:"checkbox",checked:h,onChange:d=>m(d.currentTarget.checked),disabled:u}),e("span",{children:"I understand this permanently deletes my library"})]})]}),e(E.Actions,{children:[e(S,{variant:"secondary",onClick:g,disabled:u,children:"Cancel"}),e(S,{variant:"danger",onClick:y,disabled:!h||u,children:u?"Clearing...":"Yes, delete everything"})]})]})]})},Jt=()=>{const[t,o]=r(""),[c,h]=r([]),[m,u]=r(null),[k,p]=r(!0),[s,a]=r({show:!1,message:"",type:"info"}),g=async()=>{try{p(!0);const d=await w.auth.rcloneSettings.query();o(d.remote||""),h(d.availableRemotes||[]),u(d.activeRemote||null)}catch(d){console.error("Failed to fetch Rclone settings",d)}finally{p(!1)}};q(()=>{g()},[]);const y=async()=>{try{await w.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"}),g()}catch{a({show:!0,message:"Failed to save Rclone configuration.",type:"error"})}};return k?e("div",{style:{color:"var(--text-secondary)",padding:"1.5rem"},children:"Loading..."}):e("div",{className:I.sectionCard,children:[e("h3",{className:v.title,children:"Rclone Cloud Sync"}),e("p",{className:v.signIn,children:"Configure which Rclone remote to use for database synchronization."}),m?e("div",{className:v.userInfo,children:e("p",{children:["Current Active Remote: ",e("strong",{children:m})]})}):e("p",{className:v.warning,style:{marginBottom:"1.5rem"},children:"Rclone sync is not currently active. Ensure rclone is installed and a remote is configured."}),e("div",{className:v.formGroup,children:[e("label",{className:v.label,children:"Remote Name"}),e("div",{className:v.inputWrapper,children:e("select",{className:v.select,value:t,onChange:d=>o(d.currentTarget.value),children:[e("option",{value:"",children:"(Disabled / None)"}),c.map(d=>e("option",{value:d,children:d},d)),t&&!c.includes(t)&&e("option",{value:t,children:[t," (Manual)"]})]})}),e("p",{className:v.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:v.actions,children:e(S,{onClick:y,children:"Save Rclone Settings"})}),e(E,{isOpen:s.show,onClose:()=>a(d=>({...d,show:!1})),width:"sm",children:[e(E.Body,{children:e("p",{children:s.message})}),e(E.Actions,{children:e(S,{onClick:()=>a(d=>({...d,show:!1})),children:"OK"})})]})]})},Xt=()=>{const t=Z(),[o,c]=r(null),[h,m]=r(!0),u=async()=>{try{const a=await w.auth.syncSettings.query();c(a)}catch(a){console.error("Failed to fetch sync settings",a)}finally{m(!1)}};q(()=>{u()},[]);const k=async a=>{const g=a.currentTarget.value;try{const y=await w.auth.saveSyncProvider.mutate({provider:g});c(d=>d?{...d,activeProvider:y.activeProvider}:null),await u(),await t.invalidateQueries({queryKey:X.queryKey}),we.success(`Sync provider updated to ${g==="default"?"Default Order":g}`)}catch{we.error("Failed to update sync provider")}};if(h||!o)return null;const p=[{value:"default",label:"Default (Priority Based)"}];o.authenticatedProviders.github&&p.push({value:"github",label:"GitHub"}),o.authenticatedProviders.google&&p.push({value:"google",label:"Google Drive"}),o.authenticatedProviders.rclone&&p.push({value:"rclone",label:"Rclone"}),p.push({value:"none",label:"None (Local Only)"});const s=a=>a==="none"?"Local Only (No Sync)":a==="google"?"Google Drive":a==="github"?"GitHub":a==="rclone"?"Rclone":a;return e("div",{className:I.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:s(o.actualActiveProvider)})]}),e("div",{className:I.settingRow,children:[e("label",{htmlFor:"sync-provider-select",children:"Selected Preference"}),e("select",{id:"sync-provider-select",value:o.activeProvider,onChange:k,style:{padding:"0.5rem",borderRadius:"var(--radius-md)",background:"rgba(255, 255, 255, 0.05)",color:"var(--text-primary)",border:"1px solid var(--glass-border)",fontSize:"var(--font-size-sm)",minWidth:"220px",outline:"none",cursor:"pointer"},children:p.map(a=>e("option",{value:a.value,children:a.label},a.value))})]})]})};function Zt(){return"javascript:"+encodeURIComponent(`(function(){
|
|
1
|
+
import{d as r,u as e,S as he,A as J,h as q,q as ge,T as De,p as Ae,g as ye,_ as Oe}from"./vendor-core-DfaOB3Rn.js";import{b as me,u as Z}from"./vendor-query-BBT5_sHx.js";import{N as X,O as V,P as U,Q as ve,B as S,R as qe,L as E,d as Ge,H as Ce,t as w,n as Se,l as Me,F as be,S as Y,q as H,U as we,V as ze,W as Ue,u as Ee,e as Ke,X as Fe,G as oe,p as $e,Y as He,Z as We}from"./index-DYanm9eZ.js";import{T as $}from"./ToggleSwitch-CN_ppEc9.js";import{I as ne}from"./vendor-icons-DrybRNxP.js";const Be="_sectionCard_1axuo_1",Qe="_dangerCard_1axuo_23",je="_settingRow_1axuo_31",I={sectionCard:Be,dangerCard:Qe,settingRow:je};function Ve(){const{data:t}=me(X),{data:o}=me({queryKey:["profiles"],queryFn:()=>V("/api/profiles/status"),enabled:!!t?.owner}),c=Z(),[h,m]=r(null),[u,k]=r(""),[p,s]=r(""),[a,g]=r(""),[y,d]=r(""),[L,l]=r(""),[f,N]=r(!1),[T,A]=r(null),P=async n=>{N(!0),l("");try{await V("/api/profiles/update",{method:"POST",body:JSON.stringify(n)}),await c.invalidateQueries({queryKey:X.queryKey}),k(""),s(""),l("Profile saved")}catch(C){l(C.message)}finally{N(!1)}};return t?e("section",{className:I.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(ve,{image:t.image,name:t.name}),e("label",{className:U.field,children:["Upload image",e("input",{type:"file",accept:"image/png,image/jpeg,image/webp,image/gif",disabled:f,onChange:async n=>{const C=n.currentTarget.files?.[0];if(n.currentTarget.value="",!C)return;if(C.size>2*1024*1024){l("Image must be smaller than 2 MB");return}const x=new FileReader;x.onerror=()=>l("Could not read image"),x.onload=()=>{P({avatar:x.result})},x.readAsDataURL(C)}})]}),t.avatar&&e(S,{variant:"secondary",disabled:f,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:h??t.name})},children:[e("label",{className:U.field,children:["Profile name",e("input",{value:h??t.name,maxLength:60,required:!0,onChange:n=>m(n.currentTarget.value)})]}),e(S,{type:"submit",disabled:f,children:"Save name"})]}),e("form",{className:U.form,onSubmit:n=>{n.preventDefault(),P({password:u,currentPassword:p})},children:[t.protected&&e("label",{className:U.field,children:["Current password",e("input",{type:"password",autoComplete:"current-password",value:p,required:!0,maxLength:256,onChange:n=>s(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:u,minLength:8,maxLength:256,onChange:n=>k(n.currentTarget.value)})]}),e(S,{type:"submit",disabled:f,children:"Save password"})]}),e(S,{variant:"secondary",disabled:f,onClick:async()=>{N(!0);try{await V("/api/profiles/logout",{method:"POST"}),qe()}catch(n){l(n.message),N(!1)}},children:"Switch profile / sign out"}),t.owner&&e("form",{className:U.form,onSubmit:async n=>{n.preventDefault(),N(!0),l("");try{await V("/api/profiles/create",{method:"POST",body:JSON.stringify({name:a,password:y})}),g(""),d(""),await c.invalidateQueries({queryKey:["profiles"]}),l("Profile created. Sign out to switch to it.")}catch(C){l(C.message)}finally{N(!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=>g(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=>d(n.currentTarget.value)})]}),e(S,{type:"submit",disabled:f||!t.protected,children:"Create profile"})]}),t.owner&&o?.profiles.some(n=>!n.owner)&&e(he,{children:[e("h3",{children:"Other profiles"}),e("ul",{className:U.profileList,children:o.profiles.filter(n=>!n.owner).map(n=>e("li",{children:[e("span",{className:U.smallAvatar,children:e(ve,{image:n.avatar??n.cloudAvatar,name:n.name})}),e("span",{className:U.profileName,children:n.name}),e(S,{variant:"danger",size:"sm",disabled:f,onClick:()=>{l(""),A(n)},children:"Delete"})]},n.id))})]}),e(E,{isOpen:!!T,onClose:f?void 0:()=>A(null),title:"Delete profile?",width:"sm",footer:e(he,{children:[e(S,{variant:"secondary",disabled:f,onClick:()=>A(null),children:"Cancel"}),e(S,{variant:"danger",loading:f,onClick:async()=>{if(T){N(!0);try{await V("/api/profiles/delete",{method:"POST",body:JSON.stringify({id:T.id,confirm:!0})}),await c.invalidateQueries({queryKey:["profiles"]}),A(null),l("Profile deleted. Local files will be removed when Dango restarts.")}catch(n){l(n.message),A(null)}finally{N(!1)}}},children:"Delete profile"})]}),children:[e("p",{children:["Delete ",e("strong",{children:T?.name}),"? This signs them out immediately. Their local libraries, settings and connections will be removed when Dango next restarts."]}),e("p",{children:"Cloud backups and tracker lists will stay intact. Export any library you want to keep before deleting."})]}),L&&e("p",{role:"status",children:L})]}):null}const le={"title-preference-container":"_title-preference-container_sdqgs_1","toggle-button":"_toggle-button_sdqgs_21","toggle-label":"_toggle-label_sdqgs_51"},ce=["name","nativeName","englishName"],de={name:"Default (Romaji)",nativeName:"Native",englishName:"English"},Ye=()=>{const{titlePreference:t,setTitlePreference:o,loading:c}=Ge(),h=Ce(),[m,u]=r(de[t]),[k,p]=r(!1),s=J(null);q(()=>{c||u(de[t])},[t,c]);const a=async()=>{if(k)return;p(!0);const y=(ce.indexOf(t)+1)%ce.length,d=ce[y],L=de[d];s.current&&(s.current.style.transform="translateX(-100%)",s.current.style.opacity="0"),setTimeout(async()=>{u(L),o(d),s.current&&(s.current.style.transition="none",s.current.style.transform="translateX(100%)",s.current.style.opacity="0",s.current.offsetWidth,s.current.style.transition="transform 0.3s ease-out, opacity 0.3s ease-out",s.current.style.transform="translateX(0)",s.current.style.opacity="1");try{await h.mutateAsync({key:"titlePreference",value:d})}catch(l){console.error("Error saving title preference:",l)}finally{p(!1)}},300)};return c?e("p",{children:"Loading title preference..."}):e("div",{className:le["title-preference-container"],children:[e("h4",{children:"Anime Title Display Preference"}),e("button",{onClick:a,className:le["toggle-button"],disabled:k,children:e("span",{ref:s,className:le["toggle-label"],children:m})})]})},Je="_settingsHeader_ik3bf_1",Xe="_pageTitle_ik3bf_6",Ze="_pageSubtitle_ik3bf_14",et="_settingsLayout_ik3bf_20",tt="_sidebar_ik3bf_27",at="_sidebarIndicator_ik3bf_35",nt="_sidebarItem_ik3bf_50",rt="_active_ik3bf_72",st="_mainContent_ik3bf_80",it="_tabContent_ik3bf_85",ot="_settingItem_ik3bf_103",lt="_controls_ik3bf_108",ct="_status_ik3bf_114",_={settingsHeader:Je,pageTitle:Xe,pageSubtitle:Ze,settingsLayout:et,sidebar:tt,sidebarIndicator:at,sidebarItem:nt,active:rt,mainContent:st,tabContent:it,settingItem:ot,controls:lt,status:ct},dt="_title_tm30b_11",ut="_signIn_tm30b_18",ht="_userInfo_tm30b_25",gt="_warning_tm30b_47",mt="_formGroup_tm30b_54",pt="_label_tm30b_58",ft="_inputWrapper_tm30b_68",yt="_input_tm30b_68",vt="_select_tm30b_92",bt="_actions_tm30b_109",wt="_hr_tm30b_117",v={title:dt,signIn:ut,userInfo:ht,warning:gt,formGroup:mt,label:pt,inputWrapper:ft,input:yt,select:vt,actions:bt,hr:wt},kt=()=>{const t=Z(),[o,c]=r(!0),[h,m]=r(!1),[u,k]=r(!1),[p,s]=r(null),[a,g]=r({status:"idle"}),[y,d]=r(!1),[L,l]=r(""),[f,N]=r(!1),T=J(null),[A,P]=r({show:!1,message:"",type:"info"}),n=()=>{T.current&&(window.clearInterval(T.current),T.current=null)},C=ge(b=>{k(b.authenticated),s(b.user||b.device.user||null),g(b.device),d(!!b.hasCustomClientId)},[]),x=ge(async()=>{const b=await w.auth.githubStatus.query();C(b)},[C]),G=async()=>{try{const b=await w.auth.githubPoll.query();g(b),b.status==="success"?(n(),await t.invalidateQueries({queryKey:X.queryKey}),await x(),P({show:!0,message:"GitHub authentication complete. Sync has been initialized.",type:"success"})):b.status==="error"&&(n(),P({show:!0,message:b.error||"GitHub authentication failed.",type:"error"}))}catch{n(),P({show:!0,message:"Failed to poll GitHub authentication status.",type:"error"})}},R=(b=5)=>{n(),T.current=window.setInterval(G,Math.max(b,5)*1e3)};q(()=>(x().catch(()=>{P({show:!0,message:"Failed to load GitHub sync status.",type:"error"})}).finally(()=>c(!1)),n),[x]);const M=async()=>{m(!0);try{const b=await w.auth.githubStart.mutate();g(b),R(b.verification?.interval)}catch(b){P({show:!0,message:b instanceof Error?b.message:"Failed to start GitHub authentication.",type:"error"})}finally{m(!1)}},O=async()=>{try{await w.auth.githubLogout.mutate(),await t.invalidateQueries({queryKey:X.queryKey}),k(!1),s(null),g({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"})}},B=async()=>{N(!0);try{await w.auth.saveGithubAuth.mutate({clientId:L}),l(""),await x(),P({show:!0,message:"Custom GitHub auth saved.",type:"success"})}catch{P({show:!0,message:"Failed to save override.",type:"error"})}finally{N(!1)}},Q=async()=>{N(!0);try{await w.auth.saveGithubAuth.mutate({clientId:""}),l(""),await x(),P({show:!0,message:"Custom auth cleared. Using dango defaults.",type:"success"})}catch{P({show:!0,message:"Failed to clear override.",type:"error"})}finally{N(!1)}};return o?e("div",{style:{color:"var(--text-secondary)",padding:"1.5rem"},children:"Loading..."}):e("div",{className:I.sectionCard,children:[e("h3",{className:v.title,children:"GitHub Cloud Sync"}),e("p",{className:v.signIn,children:"Sync local data through a private GitHub repository named dango-sync-data."}),u&&p?e("div",{className:v.userInfo,children:[e("p",{children:["Signed in as: ",e("strong",{children:p.name||p.login})]}),e(S,{variant:"danger",onClick:O,children:"Sign Out"})]}):e("div",{className:v.signIn,children:e(S,{onClick:M,disabled:h||a.status==="pending",children:h||a.status==="pending"?"Waiting for GitHub...":"Sign in with GitHub"})}),a.status==="pending"&&a.verification&&e(he,{children:[e("hr",{className:v.hr}),e("div",{className:v.formGroup,children:[e("label",{className:v.label,children:"Verification URL"}),e("div",{className:v.inputWrapper,children:[e("input",{className:v.input,value:a.verification.verification_uri,readOnly:!0}),e(S,{onClick:()=>{const b=a.verification?.verification_uri;b&&/^https?:\/\//i.test(b)&&window.open(b,"_blank","noopener,noreferrer")},children:"Open"})]})]}),e("div",{className:v.formGroup,children:[e("label",{className:v.label,children:"Device Code"}),e("input",{className:v.input,value:a.verification.user_code,readOnly:!0})]})]}),a.status==="error"&&e("p",{className:v.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:v.formGroup,style:{marginTop:"0.75rem"},children:[e("label",{className:v.label,children:"Client ID (optional)"}),e("input",{className:v.input,value:L,onChange:b=>l(b.currentTarget.value),placeholder:"Your GitHub OAuth app ID"})]}),e("div",{className:v.actions,children:[e(S,{onClick:B,disabled:f,children:"Save override"}),e(S,{variant:"secondary",onClick:Q,disabled:f,children:"Use dango defaults"})]})]}),e(E,{isOpen:A.show,onClose:()=>P(b=>({...b,show:!1})),width:"sm",children:[e(E.Body,{children:e("p",{children:A.message})}),e(E.Actions,{children:e(S,{onClick:()=>P(b=>({...b,show:!1})),children:"OK"})})]})]})},Ct=()=>{const[t,o]=r(!0),[c,h]=r(null),[m,u]=r(!1),[k,p]=r(!1),[s,a]=r(""),[g,y]=r(""),[d,L]=r(""),[l,f]=r(!1),[N,T]=r({show:!1,message:"",type:"info"}),A=async()=>{try{const M=await w.auth.user.query();h(M?.email?M:null)}catch{h(null)}},P=async()=>{try{const[R,M]=await Promise.all([w.auth.configStatus.query(),w.auth.googleAuth.query()]);u(!!R.hasConfig),p(!!(M.hasCustomWorkerUrl||M.hasCustomClientId||M.hasClientSecret))}catch(R){console.error("Failed to fetch config status",R)}};q(()=>{(async()=>{o(!0),await Promise.all([A(),P()]);try{new URLSearchParams(window.location.search).get("google_auth")==="success"&&(await A(),window.history.replaceState(null,"",window.location.pathname))}catch{}o(!1)})();const M=O=>{O.origin===window.location.origin&&typeof O.data=="object"&&O.data!==null&&O.data.type==="GOOGLE_AUTH_SUCCESS"&&(h(O.data.user),window.location.reload())};return window.addEventListener("message",M),()=>window.removeEventListener("message",M)},[]);const n=async()=>{try{const R=await w.auth.googleLogin.mutate();if(R.authenticated){window.location.reload();return}if(R.url){if(typeof window.DangoBridge<"u"){window.location.href=R.url;return}const O=600,B=700,Q=window.innerWidth/2-O/2,b=window.innerHeight/2-B/2;window.open(R.url,"GoogleAuth",`width=${O},height=${B},top=${b},left=${Q}`)}else throw new Error("Auth URL not available")}catch{T({show:!0,message:"Authentication failed. Ensure server is configured correctly.",type:"error"})}},C=async()=>{try{await w.auth.logout.mutate(),h(null),T({show:!0,message:"Successfully signed out.",type:"success"}),window.location.reload()}catch(R){console.error("Sign out failed",R),T({show:!0,message:"Failed to sign out.",type:"error"})}},x=async()=>{f(!0);try{await w.auth.saveGoogleAuth.mutate({workerUrl:s,clientId:g,clientSecret:d}),a(""),y(""),L(""),await P(),T({show:!0,message:"Custom auth saved. Restart may be required.",type:"success"})}catch{T({show:!0,message:"Failed to save override.",type:"error"})}finally{f(!1)}},G=async()=>{f(!0);try{await w.auth.saveGoogleAuth.mutate({workerUrl:"",clientId:"",clientSecret:""}),a(""),y(""),L(""),await P(),T({show:!0,message:"Custom auth cleared. Using dango defaults.",type:"success"})}catch{T({show:!0,message:"Failed to clear override.",type:"error"})}finally{f(!1)}};return t?e("div",{style:{color:"var(--text-secondary)",padding:"1.5rem"},children:"Loading..."}):e("div",{className:I.sectionCard,children:[e("h3",{className:v.title,children:"Google Drive Sync"}),c?e("div",{className:v.userInfo,children:[e("p",{children:["Signed in as: ",e("strong",{children:c.name})," (",c.email,")"]}),e(S,{variant:"danger",onClick:C,children:"Sign Out"})]}):e("div",{className:v.signIn,children:[e("p",{children:"Sign in with your Google account to enable synchronization features."}),e(S,{onClick:n,disabled:!m,children:"Sign in with Google"}),!m&&e("p",{className:v.warning,children:"Google sync is not configured on the server."})]}),e("details",{style:{marginTop:"1rem",fontSize:"var(--font-size-sm)"},children:[e("summary",{style:{cursor:"pointer",color:"var(--text-secondary)"},children:["Advanced: use your own auth ",k?"(override active)":""]}),e("div",{className:v.formGroup,style:{marginTop:"0.75rem"},children:[e("label",{className:v.label,children:"Worker URL (optional)"}),e("input",{className:v.input,value:s,onChange:R=>a(R.currentTarget.value),placeholder:"https://your-worker.workers.dev"})]}),e("div",{className:v.formGroup,children:[e("label",{className:v.label,children:"Client ID (optional)"}),e("input",{className:v.input,value:g,onChange:R=>y(R.currentTarget.value),placeholder:"Your Google OAuth client ID"})]}),e("div",{className:v.formGroup,children:[e("label",{className:v.label,children:"Client Secret (optional)"}),e("input",{type:"password",className:v.input,value:d,onChange:R=>L(R.currentTarget.value),placeholder:"Your Google OAuth secret"})]}),e("div",{className:v.actions,children:[e(S,{onClick:x,disabled:l,children:"Save override"}),e(S,{variant:"secondary",onClick:G,disabled:l,children:"Use dango defaults"})]})]}),e(E,{isOpen:N.show,onClose:()=>T(R=>({...R,show:!1})),width:"sm",children:[e(E.Body,{children:e("p",{children:N.message})}),e(E.Actions,{children:e(S,{onClick:()=>T(R=>({...R,show:!1})),children:"OK"})})]})]})},St="_settingItem_3qq0n_1",Nt="_modalOverlay_3qq0n_6",_t="_modal_3qq0n_6",Tt="_modalActions_3qq0n_41",Lt="_modalSecondary_3qq0n_47",Pt="_modalPrimary_3qq0n_57",W={settingItem:St,modalOverlay:Nt,modal:_t,modalActions:Tt,modalSecondary:Lt,modalPrimary:Pt},It={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"]]}},xt=(t,o)=>{if(t==null)return o;const c=String(t);return c==="true"||c==="1"?!0:c==="false"||c==="0"?!1:o},ke=(t,o,c)=>{const[h,m]=r(o),[u,k]=r(!1),p=Z();return q(()=>{(async()=>{try{const g=await w.settings.getByKey.query({key:t});m(xt(g.value,o))}catch(g){console.error("Failed to fetch setting",g)}})()},[t,o]),{value:h,setValue:m,isUpdating:u,toggle:async()=>{if(u)return;k(!0);const a=!h;m(a);try{await w.settings.set.mutate({key:t,value:a});for(const g of c)p.invalidateQueries({queryKey:g})}catch(g){console.error("Error saving setting:",g),m(!a)}finally{k(!1)}}}},Rt=()=>{const{contentType:t}=Se(),o=It[t],[c,h]=r(!1),[m,u]=r(!0),[k,p]=r(!1),s=ke(o.ignoreKey,!0,o.invalidateKeys),a=ke(o.listOnlyKey,!1,o.invalidateKeys),[g,y]=r(null),[d,L]=r(!1),l=Z(),f=Me();q(()=>{u(!0),(async()=>{try{const C=await w.settings.getByKey.query({key:o.skipKey});String(C.value)==="true"||String(C.value)==="1"?h(!0):h(!1)}catch(C){console.error("Failed to fetch setting",C)}finally{u(!1)}})()},[o.skipKey]);const N=async()=>{if(k)return;p(!0);const n=!c;h(n);try{await w.settings.set.mutate({key:o.skipKey,value:n})}catch(C){console.error("Error saving setting:",C),h(!n)}finally{p(!1)}},T=async()=>{if(!s.isUpdating){if(s.value)try{let n;if(t==="anime"?n=(await w.continueWatching.adultCount.query()).count:t==="manga"?n=(await w.mangaProgress.adultCount.query()).count:t==="asmr"?n=(await w.asmrProgress.adultCount.query()).count:n=(await w.tvProgress.adultCount.query()).count,typeof n=="number"&&n>0){y(n);return}}catch(n){console.error("Failed to fetch adult count",n)}s.toggle()}},A=()=>{y(null),s.toggle()},P=async()=>{if(!d){L(!0);try{let n;t==="anime"?n=(await w.continueWatching.purgeAdult.mutate()).removed:t==="manga"?n=(await w.mangaProgress.purgeAdult.mutate()).removed:t==="asmr"?n=(await w.asmrProgress.purgeAdult.mutate()).removed:n=(await w.tvProgress.purgeAdult.mutate()).removed,be.success(o.purgeDoneText(n??0));for(const C of o.invalidateKeys)l.invalidateQueries({queryKey:C});t==="anime"&&l.invalidateQueries(f.continueWatching.pathFilter()),t==="manga"&&l.invalidateQueries(f.mangaProgress.pathFilter()),t==="asmr"&&l.invalidateQueries(f.asmrProgress.pathFilter()),t==="tv"&&l.invalidateQueries(f.tvProgress.pathFilter())}catch(n){console.error("Failed to purge adult entries",n),be.error("Failed to remove adult entries")}finally{L(!1),y(null)}s.toggle()}};return m?e("div",{children:"Loading settings..."}):e("div",{className:I.sectionCard,children:[e("h3",{children:o.heading}),e("p",{children:o.blurb}),e("div",{className:W.settingItem,children:e("div",{className:I.settingRow,children:[e("label",{htmlFor:"skip-confirmation-toggle",children:o.skipLabel}),e($,{isChecked:c,onChange:N,id:"skip-confirmation-toggle",disabled:k})]})}),e("div",{className:W.settingItem,children:e("div",{className:I.settingRow,children:[e("label",{htmlFor:"ignore-adult-toggle",children:o.ignoreLabel}),e($,{isChecked:s.value,onChange:T,id:"ignore-adult-toggle",disabled:s.isUpdating})]})}),e("div",{className:W.settingItem,children:e("div",{className:I.settingRow,children:[e("label",{htmlFor:"cw-watchlist-only-toggle",children:o.listOnlyLabel}),e($,{isChecked:a.value,onChange:a.toggle,id:"cw-watchlist-only-toggle",disabled:a.isUpdating})]})}),g!==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:[g," adult ",g===1?"entry":"entries"," not in your"," ",o.listNoun," ",g===1?"is":"are"," currently hidden from"," ",o.continueNoun,". You can purge ",g===1?"it":"them"," from the database instead of showing ",g===1?"it":"them","."]}),e("div",{className:W.modalActions,children:[e("button",{type:"button",className:W.modalSecondary,onClick:A,disabled:d,children:"Show them"}),e("button",{type:"button",className:W.modalPrimary,onClick:P,disabled:d,children:d?"Purging...":`Purge ${g}`})]})]})})]})},Dt="_statsGrid_o4nf0_1",At="_statCard_o4nf0_8",Ot="_statLabel_o4nf0_18",qt="_statValue_o4nf0_26",Gt="_statMeta_o4nf0_32",Mt="_statusBanner_o4nf0_38",zt="_statusSuccess_o4nf0_49",Ut="_statusUpdating_o4nf0_55",Et="_statusError_o4nf0_61",Kt="_sha_o4nf0_67",Ft="_settingItem_o4nf0_74",$t="_settingTitle_o4nf0_79",Ht="_settingSubtitle_o4nf0_85",Wt="_actionsRow_o4nf0_92",D={statsGrid:Dt,statCard:At,statLabel:Ot,statValue:qt,statMeta:Gt,statusBanner:Mt,statusSuccess:zt,statusUpdating:Ut,statusError:Et,sha:Kt,settingItem:Ft,settingTitle:$t,settingSubtitle:Ht,actionsRow:Wt},Bt=()=>{const[t,o]=r(null),[c,h]=r(!0),[m,u]=r(!1),[k,p]=r(!1),s=J(null),a=async()=>{try{const l=await w.settings.offlineDbInfo.query();return o(l),l}catch(l){console.error("Failed to fetch offline DB info:",l)}finally{h(!1)}return null};q(()=>(a(),()=>{s.current&&window.clearInterval(s.current)}),[]),q(()=>{t?.isRefreshing?s.current||(s.current=window.setInterval(async()=>{const l=await a();l&&!l.isRefreshing&&s.current&&(window.clearInterval(s.current),s.current=null)},2e3)):s.current&&(window.clearInterval(s.current),s.current=null)},[t?.isRefreshing]);const g=async()=>{if(!t||m)return;const l=!t.autoUpdateEnabled;u(!0),o({...t,autoUpdateEnabled:l});try{await w.settings.setOfflineDbAutoUpdate.mutate({enabled:l})}catch(f){console.error("Failed to update auto update setting:",f),o({...t,autoUpdateEnabled:!l})}finally{u(!1)}},y=async()=>{if(!(t?.isRefreshing||k)){p(!0);try{await w.settings.triggerOfflineDbUpdate.mutate(),o(l=>l?{...l,isRefreshing:!0,lastStatus:"updating",lastMessage:"Downloading database..."}:null)}catch(l){console.error("Failed to trigger offline DB update:",l)}finally{p(!1)}}},d=l=>{if(!l)return"Never";try{return new Date(l).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}catch{return l}},L=t?.isRefreshing||k;return e("div",{className:I.sectionCard,children:[e("h3",{children:"Offline Metadata Database"}),e("p",{children:"Local MAL to AniList ID map used for instant imports and metadata enrichment without hitting rate-limited APIs. Updates automatically every Saturday in the background."}),e("div",{className:D.statsGrid,children:[e("div",{className:D.statCard,children:[e("span",{className:D.statLabel,children:"MAL Mapped"}),e("span",{className:D.statValue,children:c?"-":(t?.totalMalMapped??0).toLocaleString()})]}),e("div",{className:D.statCard,children:[e("span",{className:D.statLabel,children:"Release"}),e("span",{className:D.statMeta,children:c?"-":t?.releaseTag??"Never"})]}),e("div",{className:D.statCard,children:[e("span",{className:D.statLabel,children:"Last Checked"}),e("span",{className:D.statMeta,children:c?"-":d(t?.lastCheckedAt??null)})]}),e("div",{className:D.statCard,children:[e("span",{className:D.statLabel,children:"Last Updated"}),e("span",{className:D.statMeta,children:c?"-":d(t?.lastUpdatedAt??null)})]})]}),t?.lastMessage&&e("div",{className:`${D.statusBanner} ${t.lastStatus==="failed"?D.statusError:t.lastStatus==="updating"?D.statusUpdating:D.statusSuccess}`,children:[e("span",{children:t.lastMessage}),t.contentSha256&&e("span",{className:D.sha,children:["sha:",t.contentSha256.slice(0,12)]})]}),e("div",{className:D.settingItem,children:e("div",{className:I.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:g,disabled:c||m})]})}),e("div",{className:D.actionsRow,children:e(S,{onClick:y,disabled:c||L,children:L?"Updating Database...":"Update Offline Database Now"})})]})},Qt="_status_1wbo0_1",jt="_warningText_1wbo0_7",Vt="_ackLabel_1wbo0_11",ue={status:Qt,warningText:jt,ackLabel:Vt},Yt=()=>{const t=Z(),[o,c]=r(!1),[h,m]=r(!1),[u,k]=r(!1),[p,s]=r(""),a=()=>{m(!1),s(""),c(!0)},g=()=>{u||(c(!1),m(!1))},y=async()=>{if(!(!h||u)){k(!0),s("");try{const d=await Y("/api/database/clear",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({confirm:!0})}),L=await d.json();if(!d.ok)throw new Error(L.error||"Failed to clear database");const l=L.deleted,f=L.deletedManga,N=L.deletedTv,T=L.deletedAsmr,A=Object.values(l).reduce((x,G)=>x+(G||0),0)+Object.values(f??{}).reduce((x,G)=>x+(G||0),0)+Object.values(N??{}).reduce((x,G)=>x+(G||0),0)+Object.values(T??{}).reduce((x,G)=>x+(G||0),0),P=(f?.manga_library??0)+(f?.manga_progress??0),n=(N?.tv_library??0)+(N?.tv_progress??0),C=(T?.asmr_library??0)+(T?.asmr_progress??0);s(`Library cleared - ${l.watchlist??0} watchlist entries, ${P} manga rows, ${n} TV rows, ${C} ASMR rows and ${A} total rows removed.`),t.invalidateQueries({queryKey:[H.watchlist]}),t.invalidateQueries({queryKey:[H.continueWatching]}),t.invalidateQueries({queryKey:[H.mangaLibrary]}),t.invalidateQueries({queryKey:[H.mangaContinueReading]}),t.invalidateQueries({queryKey:[H.tvLibrary]}),t.invalidateQueries({queryKey:[H.tvContinueWatching]}),t.invalidateQueries({queryKey:[H.asmrLibrary]}),t.invalidateQueries({queryKey:[H.asmrContinueListening]}),c(!1)}catch(d){s(d.message)}finally{k(!1),m(!1)}}};return e("div",{className:`${I.sectionCard} ${I.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"}),p&&e("p",{className:ue.status,children:p}),e(E,{isOpen:o,onClose:g,title:"Clear library data?",width:"sm",children:[e(E.Body,{children:[e("p",{className:ue.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:ue.ackLabel,children:[e("input",{type:"checkbox",checked:h,onChange:d=>m(d.currentTarget.checked),disabled:u}),e("span",{children:"I understand this permanently deletes my library"})]})]}),e(E.Actions,{children:[e(S,{variant:"secondary",onClick:g,disabled:u,children:"Cancel"}),e(S,{variant:"danger",onClick:y,disabled:!h||u,children:u?"Clearing...":"Yes, delete everything"})]})]})]})},Jt=()=>{const[t,o]=r(""),[c,h]=r([]),[m,u]=r(null),[k,p]=r(!0),[s,a]=r({show:!1,message:"",type:"info"}),g=async()=>{try{p(!0);const d=await w.auth.rcloneSettings.query();o(d.remote||""),h(d.availableRemotes||[]),u(d.activeRemote||null)}catch(d){console.error("Failed to fetch Rclone settings",d)}finally{p(!1)}};q(()=>{g()},[]);const y=async()=>{try{await w.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"}),g()}catch{a({show:!0,message:"Failed to save Rclone configuration.",type:"error"})}};return k?e("div",{style:{color:"var(--text-secondary)",padding:"1.5rem"},children:"Loading..."}):e("div",{className:I.sectionCard,children:[e("h3",{className:v.title,children:"Rclone Cloud Sync"}),e("p",{className:v.signIn,children:"Configure which Rclone remote to use for database synchronization."}),m?e("div",{className:v.userInfo,children:e("p",{children:["Current Active Remote: ",e("strong",{children:m})]})}):e("p",{className:v.warning,style:{marginBottom:"1.5rem"},children:"Rclone sync is not currently active. Ensure rclone is installed and a remote is configured."}),e("div",{className:v.formGroup,children:[e("label",{className:v.label,children:"Remote Name"}),e("div",{className:v.inputWrapper,children:e("select",{className:v.select,value:t,onChange:d=>o(d.currentTarget.value),children:[e("option",{value:"",children:"(Disabled / None)"}),c.map(d=>e("option",{value:d,children:d},d)),t&&!c.includes(t)&&e("option",{value:t,children:[t," (Manual)"]})]})}),e("p",{className:v.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:v.actions,children:e(S,{onClick:y,children:"Save Rclone Settings"})}),e(E,{isOpen:s.show,onClose:()=>a(d=>({...d,show:!1})),width:"sm",children:[e(E.Body,{children:e("p",{children:s.message})}),e(E.Actions,{children:e(S,{onClick:()=>a(d=>({...d,show:!1})),children:"OK"})})]})]})},Xt=()=>{const t=Z(),[o,c]=r(null),[h,m]=r(!0),u=async()=>{try{const a=await w.auth.syncSettings.query();c(a)}catch(a){console.error("Failed to fetch sync settings",a)}finally{m(!1)}};q(()=>{u()},[]);const k=async a=>{const g=a.currentTarget.value;try{const y=await w.auth.saveSyncProvider.mutate({provider:g});c(d=>d?{...d,activeProvider:y.activeProvider}:null),await u(),await t.invalidateQueries({queryKey:X.queryKey}),we.success(`Sync provider updated to ${g==="default"?"Default Order":g}`)}catch{we.error("Failed to update sync provider")}};if(h||!o)return null;const p=[{value:"default",label:"Default (Priority Based)"}];o.authenticatedProviders.github&&p.push({value:"github",label:"GitHub"}),o.authenticatedProviders.google&&p.push({value:"google",label:"Google Drive"}),o.authenticatedProviders.rclone&&p.push({value:"rclone",label:"Rclone"}),p.push({value:"none",label:"None (Local Only)"});const s=a=>a==="none"?"Local Only (No Sync)":a==="google"?"Google Drive":a==="github"?"GitHub":a==="rclone"?"Rclone":a;return e("div",{className:I.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:s(o.actualActiveProvider)})]}),e("div",{className:I.settingRow,children:[e("label",{htmlFor:"sync-provider-select",children:"Selected Preference"}),e("select",{id:"sync-provider-select",value:o.activeProvider,onChange:k,style:{padding:"0.5rem",borderRadius:"var(--radius-md)",background:"rgba(255, 255, 255, 0.05)",color:"var(--text-primary)",border:"1px solid var(--glass-border)",fontSize:"var(--font-size-sm)",minWidth:"220px",outline:"none",cursor:"pointer"},children:p.map(a=>e("option",{value:a.value,children:a.label},a.value))})]})]})};function Zt(){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-
|
|
1
|
+
import{u as o,g as r}from"./vendor-core-DfaOB3Rn.js";import{u as l}from"./index-DYanm9eZ.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};
|