@serifpersia/dango 3.6.3 → 3.6.5
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-Cwc6Z9rO.js → AnimeCard-JkXG40Es.js} +1 -1
- package/client/dist/assets/{AnimeInfo-ad7aMRq5.js → AnimeInfo-2L0UJkbB.js} +1 -1
- package/client/dist/assets/{AnimeInfoPage-B795AIlr.js → AnimeInfoPage-BDs03vKk.js} +2 -2
- package/client/dist/assets/{Asmr-jqhD7q69.js → Asmr-D2mVKEl9.js} +1 -1
- package/client/dist/assets/{AsmrResetProgressModal-Bey2zoeh.js → AsmrResetProgressModal-MQA_bNQM.js} +1 -1
- package/client/dist/assets/{AvSyncCalibrator-B2fQmjbo.js → AvSyncCalibrator-DmoH5eRA.js} +1 -1
- package/client/dist/assets/{Home-rRTAnTfL.js → Home-DxMBHFmc.js} +1 -1
- package/client/dist/assets/{Insights-CN2bm8wf.js → Insights-hmLWsSXY.js} +1 -1
- package/client/dist/assets/{LibraryListPage-BlNQWLrf.js → LibraryListPage-CWI7hgUh.js} +1 -1
- package/client/dist/assets/{ListeningList-Pi1Baxgd.js → ListeningList-NOc28KAV.js} +1 -1
- package/client/dist/assets/{Manga-7Jt2tJyE.js → Manga-B5qNhI7v.js} +1 -1
- package/client/dist/assets/{MangaInfoPage-45jPSjxB.js → MangaInfoPage-D4wIyb-V.js} +1 -1
- package/client/dist/assets/{MangaReadPage-BWgX9bSn.js → MangaReadPage-Ce1VX7-0.js} +1 -1
- package/client/dist/assets/{MangaResetProgressModal-DLgJrIVT.js → MangaResetProgressModal-P3oY4_14.js} +1 -1
- package/client/dist/assets/{Mature-2I4mvoWk.js → Mature-D8EwGYQq.js} +1 -1
- package/client/dist/assets/{MediaCard-cSWL_NlR.js → MediaCard-Dp8DjyXB.js} +1 -1
- package/client/dist/assets/{Music-bUuge7On.js → Music-DULtVsAM.js} +1 -1
- package/client/dist/assets/{OptionListMenu-D4ejupic.js → OptionListMenu-fIHdE-nq.js} +1 -1
- package/client/dist/assets/Player-B8XeOmso.js +56 -0
- package/client/dist/assets/{PlayerSettings-e_PohoiO.js → PlayerSettings-BycNCiCs.js} +1 -1
- package/client/dist/assets/{QueueOptionsButton-BMl804vN.js → QueueOptionsButton-T1J37IZT.js} +1 -1
- package/client/dist/assets/{QueueRail-BfNg-4sG.js → QueueRail-BAwI-apz.js} +1 -1
- package/client/dist/assets/{Radio-BbkMYqMU.js → Radio-Bv9DyKtZ.js} +1 -1
- package/client/dist/assets/{ReadingList-BN03nBXY.js → ReadingList-Cl0CcVp3.js} +1 -1
- package/client/dist/assets/{ResetProgressModal-CuoM4S_P.js → ResetProgressModal--N60WWCB.js} +1 -1
- package/client/dist/assets/{Search-DnBPEHjw.js → Search-DvgVDlUR.js} +1 -1
- package/client/dist/assets/{Settings-CqiYnqx7.js → Settings-dCz_-bJn.js} +1 -1
- package/client/dist/assets/{SkeletonGrid-CYZ3cstC.js → SkeletonGrid-BZHKk1I6.js} +1 -1
- package/client/dist/assets/{Trackers-DlkQl9Qs.js → Trackers-C1T5VcPu.js} +1 -1
- package/client/dist/assets/{Tv-Ac8wPuCw.js → Tv-Dhv_cg4y.js} +2 -2
- package/client/dist/assets/{TvInfo-Dhv0lmCc.js → TvInfo-DgaLK2H6.js} +1 -1
- package/client/dist/assets/{TvPopup-5lwvCCOQ.js → TvPopup-DyX7f8kC.js} +1 -1
- package/client/dist/assets/{TvSearch-B3_Vf8Dk.js → TvSearch-Bp0H6kue.js} +1 -1
- package/client/dist/assets/{TvWatchlist-B_jtSOjL.js → TvWatchlist-ohMtMeKa.js} +1 -1
- package/client/dist/assets/{Watchlist-BtFidAWI.js → Watchlist-BbQtzsER.js} +1 -1
- package/client/dist/assets/{hls-CEWF8efn.js → hls-Bi1cjpLZ.js} +1 -1
- package/client/dist/assets/{index-C93G341i.js → index-BTnhzofk.js} +3 -3
- package/client/dist/assets/{useAnimeInfoData-gz0XXrYm.js → useAnimeInfoData-Cvmso3IK.js} +1 -1
- package/client/dist/assets/{useAsmr-BrRbA9AW.js → useAsmr-CbzGCzmv.js} +1 -1
- package/client/dist/assets/{useAsmrPopup-C4gKdZId.js → useAsmrPopup-DaREZ9Ie.js} +1 -1
- package/client/dist/assets/{useMangaLibrary-DkGSBFSX.js → useMangaLibrary-BVQRhsFh.js} +1 -1
- package/client/dist/assets/{useMangaPopup-DwKm2HYt.js → useMangaPopup-CzsCbndG.js} +1 -1
- package/client/dist/assets/{useProviders-C3E0fPpP.js → useProviders-UuUPzft-.js} +1 -1
- package/client/dist/assets/{useTv-BQ3K3Xdh.js → useTv-CSsbWKH9.js} +1 -1
- package/client/dist/assets/{useTvLibrary-DizEfaXg.js → useTvLibrary-a_Y0c2FS.js} +1 -1
- package/client/dist/index.html +1 -1
- package/package.json +2 -2
- package/server/dist/google.js +1 -1
- package/server/dist/hono/proxy.js +71 -32
- package/server/dist/hono/tv.js +11 -7
- package/server/dist/providers/remote-loader.js +3 -1
- package/server/dist/trpc/routers/data.js +15 -8
- package/server/package.json +1 -1
- package/client/dist/assets/Player-Fm7-Iaym.js +0 -56
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/PlayerSettings-BycNCiCs.js","assets/vendor-core-DfaOB3Rn.js","assets/vendor-icons-DrybRNxP.js","assets/OptionListMenu-fIHdE-nq.js","assets/AvSyncCalibrator-DmoH5eRA.js","assets/index-BTnhzofk.js","assets/vendor-query-BBT5_sHx.js","assets/index-D0Haw_Zl.css","assets/AvSyncCalibrator-ZSpMgUid.css","assets/PlayerSettings-BXGe3F5k.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{u as r,g as Ut,h as D,P as $r,z as Fr,d as ue,A as m,q as K,y as Or,T as Je,o as Wr,a as Ur,c as Vr,_ as qr,S as Wt}from"./vendor-core-DfaOB3Rn.js";import{_ as fr,S as _t,h as Qr,t as Ee,z as Oe,J as zr,K as yt,M as Be,e as Gr,l as Kr,m as Hr,n as jr,o as Yr,d as Xr,u as Jr,B as it,L as Zr,f as en}from"./index-BTnhzofk.js";import{u as vr,b as cr,a as Yt}from"./vendor-query-BBT5_sHx.js";import{S as tn,U as rn,p as Xt,s as nn,C as sn,a as on,b as an,c as at,l as ln,u as cn,d as un,e as dn,f as hn,i as pn,g as ur,h as mn,j as fn,k as dr,m as hr,n as vn,o as gn,q as bn,r as yn,t as xe,A as Sn,R as En,E as wn,v as kn,w as h,x as Tn,y as Cn,P as Rn,z as Mn,B as _n}from"./AvSyncCalibrator-DmoH5eRA.js";import{I as Z}from"./vendor-icons-DrybRNxP.js";import{l as Nn}from"./hls-Bi1cjpLZ.js";import{u as Pn}from"./useIsMobile-Dvx1uJ82.js";import{s as ze,Q as An}from"./QueueRail-BAwI-apz.js";import{u as xn,Q as Bn}from"./QueueOptionsButton-T1J37IZT.js";import{u as gr}from"./useProviders-UuUPzft-.js";import{A as Ln}from"./AnimeMetaDetails-BogOi_bM.js";import{S as In}from"./SynopsisText-B3Sa5pRv.js";import"./vendor-ui-3qrARCPr.js";const Dn={soft:"Softsub",hard:"Hardsub",mixed:"Mixed"},$n={direct:"Direct",embed:"Embed",cookie:"Needs cookie"},Fn=["direct","cookie","embed"],On="_controlsOverlay_1h2da_1",Wn="_hidden_1h2da_21",Un="_topControls_1h2da_27",Vn="_backBtn_1h2da_47",qn="_videoTitleInfo_1h2da_67",Qn="_animeTitle_1h2da_73",zn="_episodeNumber_1h2da_83",Gn="_bottomControls_1h2da_91",Kn="_progressBarContainer_1h2da_110",Hn="_progressBar_1h2da_110",jn="_thumb_1h2da_129",Yn="_scrubbing_1h2da_144",Xn="_watchedBar_1h2da_148",Jn="_bufferedBar_1h2da_149",Zn="_timeBubble_1h2da_187",es="_skipSegment_1h2da_221",ts="_op_1h2da_231",rs="_ed_1h2da_234",ns="_recap_1h2da_237",ss="_bottomControlsRow_1h2da_241",os="_leftControls_1h2da_249",is="_rightControls_1h2da_250",as="_controlBtn_1h2da_257",ls="_theaterBtn_1h2da_298",cs="_nextEpisodeBtn_1h2da_302",us="_active_1h2da_323",ds="_timeDisplay_1h2da_327",hs="_skipControls_1h2da_335",ps="_skipBtn_1h2da_341",ms="_volumeContainer_1h2da_382",fs="_volumeSlider_1h2da_388",vs="_playerPageLayout_1h2da_446",gs="_videoPlayerWrapper_1h2da_450",bs="_playerInfoContainer_1h2da_455",ys="_visible_1h2da_572",Ss="_shortcuts_1h2da_590",C={controlsOverlay:On,hidden:Wn,topControls:Un,backBtn:Vn,videoTitleInfo:qn,animeTitle:Qn,episodeNumber:zn,bottomControls:Gn,progressBarContainer:Kn,progressBar:Hn,thumb:jn,scrubbing:Yn,watchedBar:Xn,bufferedBar:Jn,timeBubble:Zn,skipSegment:es,op:ts,ed:rs,recap:ns,bottomControlsRow:ss,leftControls:os,rightControls:is,controlBtn:as,theaterBtn:ls,nextEpisodeBtn:cs,active:us,timeDisplay:ds,skipControls:hs,skipBtn:ps,volumeContainer:ms,volumeSlider:fs,playerPageLayout:vs,videoPlayerWrapper:gs,playerInfoContainer:bs,visible:ys,shortcuts:Ss},Es=({player:n,handlers:i,visible:p,skipIntervals:B,showNextEpisodeButton:f,onNextEpisode:E,isTheaterMode:v,onTheaterModeToggle:L,settingsBtnRef:P,timeDisplayRef:F})=>{const{state:w,refs:e,actions:o}=n,{showSettings:J}=w,g=()=>w.isMuted||w.volume===0?r(Z,{name:"volume-mute"}):w.volume<.5?r(Z,{name:"volume-down"}):r(Z,{name:"volume-up"});return r("div",{className:`${C.controlsOverlay} ${p?"":C.hidden} `,"data-speed-boost-ignore":"true",style:{pointerEvents:"none",background:"none",justifyContent:"flex-end"},children:r("div",{className:C.bottomControls,"data-speed-boost-ignore":"true",onClick:A=>A.stopPropagation(),children:[r(tn,{classes:{container:C.progressBarContainer,scrubbing:C.scrubbing,timeBubble:C.timeBubble,bar:C.progressBar,buffered:C.bufferedBar,watched:C.watchedBar,thumb:C.thumb},videoRef:e.videoRef,duration:w.duration,formatTime:o.formatTime,isScrubbing:w.isScrubbing,onSeek:i.handleSeek,onScrubStart:i.handleScrubStart,onScrubMove:i.handleScrubMove,onScrubEnd:i.handleScrubEnd,timeLabelRef:F,children:[w.duration>0&&n.state.currentSkipInterval&&r("div",{className:`${C.skipSegment} ${C[n.state.currentSkipInterval.skip_type]} `,style:{left:`${n.state.currentSkipInterval.start_time/w.duration*100}% `,width:`${(n.state.currentSkipInterval.end_time-n.state.currentSkipInterval.start_time)/w.duration*100}% `}}),B.map(A=>{const de=A.start_time/w.duration*100,V=(A.end_time-A.start_time)/w.duration*100;return r("div",{className:`${C.skipSegment} ${C[A.skip_type]} `,style:{left:`${de}% `,width:`${V}% `},title:A.skip_type.toUpperCase()},A.skip_id)})]}),r("div",{className:C.bottomControlsRow,children:[r("div",{className:C.leftControls,children:[r("button",{className:C.controlBtn,onClick:o.togglePlay,"aria-label":w.isPlaying?"Pause":"Play",children:w.isPlaying?r(Z,{name:"pause"}):r(Z,{name:"play"})}),r(rn,{muted:w.isMuted,volume:w.volume,volumeIcon:g(),buttonClassName:C.controlBtn,onToggleMute:o.toggleMute,onVolumeChange:i.handleVolumeChange,onExpandedChange:A=>o.setShowVolumeSlider(A)}),r("span",{className:C.timeDisplay,ref:F,children:[o.formatTime(0)," / ",o.formatTime(w.duration)]}),w.currentSkipInterval&&!w.isAutoSkipEnabled&&r("button",{className:C.controlBtn,onClick:()=>{e.videoRef.current&&w.currentSkipInterval&&(e.videoRef.current.currentTime=w.currentSkipInterval.end_time,o.setCurrentSkipInterval(null))},children:["Skip ",w.currentSkipInterval.skip_type==="op"?"Opening":"Ending"]})]}),r("div",{className:C.rightControls,children:[r("div",{className:C.skipControls,children:f&&r("button",{className:C.nextEpisodeBtn,onClick:E,title:"Play next episode",children:"Next EP"})}),r("button",{className:`${C.controlBtn} ${i.isSubtitleActive?C.active:""}`,onClick:i.handleCCToggle,title:i.isSubtitleActive?"Disable Subtitles":"Enable Subtitles","aria-label":"Toggle Subtitles",children:r(Z,{name:"closed-captioning",size:22})}),r("button",{ref:P,className:`${C.controlBtn} ${J?C.active:""} `,onClick:()=>o.setShowSettings(!J),"aria-label":"Settings",children:r(Z,{name:"cog"})}),r("button",{className:`${C.controlBtn} ${C.theaterBtn} ${v?C.active:""} `,onClick:A=>{A.stopPropagation(),L()},title:v?"Exit Theater Mode":"Theater Mode","aria-label":v?"Exit Theater Mode":"Theater Mode",children:r(Z,{name:"tv"})}),r("button",{className:C.controlBtn,onClick:o.toggleFullscreen,"aria-label":w.isFullscreen?"Exit Fullscreen":"Fullscreen",children:w.isFullscreen?r(Z,{name:"compress"}):r(Z,{name:"expand"})})]})]})]})})};function ws(n){const{state:i,refs:p,actions:B}=n,f=o=>{p.videoRef.current&&(p.videoRef.current.volume=o,p.videoRef.current.muted=o===0)},E=o=>{!p.videoRef.current||isNaN(i.duration)||i.duration===0||(p.videoRef.current.currentTime=o*i.duration,B.sendProgressUpdate(!1,!0))},v=()=>{p.videoRef.current&&(B.setIsScrubbing(!0),B.wasPlayingBeforeScrub.current=!p.videoRef.current.paused,p.videoRef.current.pause())},L=o=>{!p.videoRef.current||!i.duration||(p.videoRef.current.currentTime=o*i.duration)},P=()=>{B.setIsScrubbing(!1),B.wasPlayingBeforeScrub.current&&p.videoRef.current?.play()},F=o=>{if(!p.videoRef.current)return;B.setActiveSubtitleTrack(o);try{if(o===null||o==="off")localStorage.setItem("playerSubtitlesEnabled","false");else{localStorage.setItem("playerSubtitlesEnabled","true");const g=i.availableSubtitles.find(A=>A.label===o||A.lang===o);g?localStorage.setItem("playerLastSubtitle",nn(g)):localStorage.setItem("playerLastSubtitle",o)}}catch{}let J=!1;Array.from(p.videoRef.current.textTracks).forEach(g=>{const de=o!==null&&o!=="off"&&(g.language===o||g.label===o)&&!J;g.mode=de?"showing":"hidden",de&&(J=!0)})},w=i.activeSubtitleTrack!==null&&i.activeSubtitleTrack!=="off";return{handleVolumeChange:f,handleSeek:E,handleScrubStart:v,handleScrubMove:L,handleScrubEnd:P,handleSubtitleSelection:F,isSubtitleActive:w,handleCCToggle:()=>{if(!p.videoRef.current)return;if(w){F("off");return}if(i.availableSubtitles.length===0)return;let o=null;try{o=localStorage.getItem("playerLastSubtitle")}catch{}const J=Xt(i.availableSubtitles,{lastKey:o,enabled:!0});if(J<0)return;const g=i.availableSubtitles[J];F(g.label||g.lang)}}}const ks=Fr(()=>fr(()=>import("./PlayerSettings-BycNCiCs.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),Ts=({player:n,isAutoplayEnabled:i,onAutoplayChange:p,showNextEpisodeButton:B,onNextEpisode:f,videoSources:E,selectedSource:v,selectedLink:L,onSourceChange:P,loadingVideo:F,skipIntervals:w,animeTitle:e,episodeNumber:o,isTheaterMode:J,onTheaterModeToggle:g,anime4kEnabled:A,onAnime4kToggle:de,anime4kSupported:V,anime4kProfile:x,onAnime4kProfileChange:O,anime4kInitializing:Le,anime4kError:We,videoDelayEnabled:a,onVideoDelayToggle:d,videoDelayMs:k,onVideoDelayChange:ve,onCalibrateAvSync:Ie,fallbackChoice:_e,onFallbackChoiceChange:Ne,ambientSettings:Ue,onAmbientChange:oe,children:we,overlays:c,isInteractingExtra:b=!1,className:T,hideChrome:I=!1})=>{const{state:R,actions:q}=n,{showSettings:ye}=R,{setShowSettings:Y}=q,G=ws(n),ke=Ut.useRef(null),De=Ut.useRef(null),St=Ut.useRef(null);D(()=>{const $=W=>{ke.current&&!ke.current.contains(W.target)&&De.current&&!De.current.contains(W.target)&&ye&&Y(!1)};return ye&&document.addEventListener("mousedown",$),()=>{document.removeEventListener("mousedown",$)}},[ye,Y]);const Ze=R.showControls||ye||R.isScrubbing,Et=r(an,{visible:Ze,title:e,episode:o?`Episode ${o}`:void 0,onBack:()=>window.history.back(),classes:{overlay:C.controlsOverlay,hidden:C.hidden,top:C.topControls,backBtn:C.backBtn,titleInfo:C.videoTitleInfo,title:C.animeTitle,episode:C.episodeNumber}}),H=!F&&!R.isBuffering&&R.duration>0?r(sn,{isPlaying:R.isPlaying,onTogglePlay:q.togglePlay,onSkipBack:()=>q.seek(-10),onSkipForward:()=>q.seek(10)}):null,Pe=r(Es,{player:n,handlers:G,visible:Ze,skipIntervals:w,showNextEpisodeButton:B,onNextEpisode:f,isTheaterMode:J,onTheaterModeToggle:g,settingsBtnRef:De,timeDisplayRef:St}),lt=r($r,{fallback:null,children:r(ks,{ref:ke,isOpen:ye,onClose:()=>Y(!1),videoSources:E,currentSource:v,currentLink:L,onSourceChange:P,subtitles:R.availableSubtitles,activeSubtitleTrack:R.activeSubtitleTrack,onSubtitleChange:G.handleSubtitleSelection,subtitleSettings:{fontSize:R.subtitleFontSize,position:R.subtitlePosition,bgOpacity:R.subtitleBgOpacity,bgColor:R.subtitleBgColor,textColor:R.subtitleTextColor,edge:R.subtitleEdge,bold:R.subtitleBold},onSubtitleSettingsChange:($,W)=>{const Te=(Ve,Ge)=>{try{localStorage.setItem(Ve,String(Ge))}catch{}};switch($){case"fontSize":q.setSubtitleFontSize(W),Te("subtitleFontSize",W);break;case"position":q.setSubtitlePosition(W),Te("subtitlePosition",W);break;case"bgOpacity":q.setSubtitleBgOpacity(W),Te("subtitleBgOpacity",W);break;case"bgColor":q.setSubtitleBgColor(W),Te("subtitleBgColor",W);break;case"textColor":q.setSubtitleTextColor(W),Te("subtitleTextColor",W);break;case"edge":q.setSubtitleEdge(W),Te("subtitleEdge",W);break;case"bold":q.setSubtitleBold(W),Te("subtitleBold",W);break}},useNativeControls:R.useNativeControls,onNativeControlsToggle:q.setUseNativeControls,anime4kEnabled:A,onAnime4kToggle:de,anime4kSupported:V,anime4kProfile:x,onAnime4kProfileChange:O,anime4kInitializing:Le,anime4kError:We,videoDelayEnabled:a,onVideoDelayToggle:d,videoDelayMs:k,onVideoDelayChange:ve,onCalibrateAvSync:Ie,isAutoSkipEnabled:R.isAutoSkipEnabled,onAutoSkipChange:$=>{q.setIsAutoSkipEnabled($);try{localStorage.setItem("autoSkipEnabled",$.toString())}catch{}},isAutoplayEnabled:i,onAutoplayChange:p,fallbackChoice:_e,onFallbackChoiceChange:Ne,isTheaterMode:J,ambientSettings:Ue,onAmbientChange:oe})}),_=ye?r("div",{"data-speed-boost-ignore":"true",onClick:$=>$.stopPropagation(),children:lt}):null;return r(on,{player:n,topBar:Et,centerControls:H,bottomBar:!F&&R.duration>0?Pe:null,settingsPanel:_,overlays:c,isInteracting:b,className:T,chromeDisabled:I,children:we})},Cs=({count:n=3})=>r("section",{className:ze.section,children:[r("div",{className:ze.header,children:r("button",{className:ze.headerToggle,disabled:!0,children:[r("span",{className:ze.title,children:r(_t,{width:"60px",height:"1.2rem",variant:"text"})}),r(Z,{name:"chevron-down",style:{opacity:.3}})]})}),r("div",{className:ze.list,children:Array.from({length:n}).map((i,p)=>r("div",{className:ze.item,style:{pointerEvents:"none"},children:[r("div",{className:ze.dragHandle,style:{opacity:.2},children:r(_t,{width:"16px",height:"16px",variant:"rectangular"})}),r("div",{className:ze.thumbnail,style:{overflow:"hidden",background:"transparent"},children:r(_t,{width:"100%",height:"100%",variant:"rectangular"})}),r("div",{className:ze.meta,children:[r(_t,{width:"80%",height:"1.2rem",variant:"text",className:"mb-2"}),r(_t,{width:"40%",height:"0.8rem",variant:"rectangular",style:{borderRadius:"var(--radius-sm)"}})]})]},p))})]}),Rs=({selectedProvider:n,onProviderChange:i,isAdult:p,options:B})=>{const E=(B&&B.length>0?B:[]).filter(v=>v.mature===(p===!0));return r("div",{className:at.providerSelectContainer,children:[r("h4",{children:"Provider"}),r("select",{className:at.providerSelect,value:n,onChange:v=>i(v.target.value),children:Fn.map(v=>{const L=E.filter(P=>(P.tier??"direct")===v);return L.length===0?null:r("optgroup",{label:$n[v],children:L.map(P=>r("option",{value:P.value,children:P.sub?`${P.label} (${Dn[P.sub]})`:P.label},P.value))},v)})})]})},Ms=({videoSources:n,selectedSource:i,selectedLink:p,onSourceChange:B,onLinkChange:f})=>{const E=Array.isArray(n)?n:[];if(E.length===0)return null;const v=i?.type==="iframe"&&(i.links?.length??0)>1;return r("div",{className:at.sourceSelectionContainer,children:[r("h4",{children:"Source"}),r("div",{className:at.sourceButtons,children:E.map((L,P)=>r("button",{className:`${at.sourceButton} ${i?.sourceName===L.sourceName?at.active:""} `,onClick:()=>B(L),children:L.sourceName},`${L.sourceName}-${P}`))}),v&&r("select",{className:at.sourceSelect,"aria-label":"Fallback embed quality",value:p?.link??i.links[0]?.link??"",onChange:L=>{const P=i.links.find(F=>F.link===L.target.value);P&&f(P)},children:i.links.map(L=>r("option",{value:L.link,children:L.resolutionStr},L.link))})]})},_s=Ut.memo(Ms,(n,i)=>n.selectedSource?.sourceName===i.selectedSource?.sourceName&&n.selectedLink?.link===i.selectedLink?.link&&n.videoSources===i.videoSources),Ns={low:{sd:1.5,hd:1.3,fhd:1.25},balanced:{sd:2,hd:1.5,fhd:1.25},high:{sd:2.5,hd:2,fhd:1.5},denoise:{sd:1.5,hd:1.5,fhd:1.5}},Ps={low:"ModeB",balanced:"ModeA",high:"ModeAA",denoise:"ModeC"},As=5,xs=15e3,Bs=`
|
|
3
|
+
@group(0) @binding(0) var extTex: texture_external;
|
|
4
|
+
@group(0) @binding(1) var extSamp: sampler;
|
|
5
|
+
struct VSOut {
|
|
6
|
+
@builtin(position) pos: vec4f,
|
|
7
|
+
@location(0) uv: vec2f,
|
|
8
|
+
};
|
|
9
|
+
@vertex
|
|
10
|
+
fn vs(@builtin(vertex_index) idx: u32) -> VSOut {
|
|
11
|
+
var positions = array<vec2f, 6>(
|
|
12
|
+
vec2f(-1.0, -1.0), vec2f(1.0, -1.0), vec2f(-1.0, 1.0),
|
|
13
|
+
vec2f(-1.0, 1.0), vec2f(1.0, -1.0), vec2f(1.0, 1.0)
|
|
14
|
+
);
|
|
15
|
+
var uvs = array<vec2f, 6>(
|
|
16
|
+
vec2f(0.0, 1.0), vec2f(1.0, 1.0), vec2f(0.0, 0.0),
|
|
17
|
+
vec2f(0.0, 0.0), vec2f(1.0, 1.0), vec2f(1.0, 0.0)
|
|
18
|
+
);
|
|
19
|
+
var out: VSOut;
|
|
20
|
+
out.pos = vec4f(positions[idx], 0.0, 1.0);
|
|
21
|
+
out.uv = uvs[idx];
|
|
22
|
+
return out;
|
|
23
|
+
}
|
|
24
|
+
@fragment
|
|
25
|
+
fn fs(@location(0) uv: vec2f) -> @location(0) vec4f {
|
|
26
|
+
return textureSampleBaseClampToEdge(extTex, extSamp, uv);
|
|
27
|
+
}
|
|
28
|
+
`;function Ls({videoRef:n,canvasRef:i,profile:p="balanced",delayMs:B=0}){const[f,E]=ue(!1),[v,L]=ue(()=>{try{return localStorage.getItem("anime4kEnabled")==="true"}catch{return!1}}),[P,F]=ue(!1),[w,e]=ue(null),[o,J]=ue(0),g=m(0),A=m(null),de=m(null),V=m(null),x=m(null),O=m(null),Le=m(null),We=m(null),a=m(null),d=m(null),k=m(!1),ve=m(-1),Ie=m(0),_e=m(B);_e.current=B;const Ne=m([]),Ue=m(!1),oe=m(!1),we=m(!1),c=m(null),b=m(-1),T=m(-1),I=m(!1),R=m(0);D(()=>{async function Y(){if(typeof navigator>"u"||!navigator.gpu){E(!1);return}try{const G=await navigator.gpu.requestAdapter();E(!!G)}catch{E(!1)}}Y()},[]),D(()=>{if(!v||!f)return;let Y=!1;const G=++g.current,ke=H=>{if(H)try{H.close()}catch{}},De=()=>{for(const H of Ne.current)ke(H.bitmap);Ne.current=[]},St=H=>Math.max(8,Math.min(40,Math.ceil(H/16.7)+4));function Ze(){d.current!==null&&(cancelAnimationFrame(d.current),d.current=null)}async function Et(){let H=n.current;const Pe=i.current;if(!H||!Pe||g.current!==G)return;const lt=performance.now()+xs;for(;(!H||H.videoWidth===0)&&performance.now()<lt;){if(await new Promise(le=>requestAnimationFrame(le)),Y||g.current!==G)return;H=n.current}if(!H||H.videoWidth===0){!Y&&g.current===G&&(e("Timed out waiting for video metadata"),F(!1),L(!1));return}const _=H.videoWidth,$=H.videoHeight,W=Math.max(_,$),Te=window.innerWidth,Ve=window.innerHeight,Ge=Math.max(Te,Ve),ct=W<Ge?Ge/W:1,ut=Ns[p],dt=W<=480?ut.sd:W<=720?ut.hd:W<=1080?ut.fhd:1,ht=Math.min(dt,ct);Pe.width=Math.round(_*ht),Pe.height=Math.round($*ht),F(!0),e(null),Ie.current=0,ve.current=-1,b.current=-1,T.current=-1,I.current=!1,R.current=0,De(),k.current=!1;try{let le=function(){Y||g.current!==G||(Ze(),d.current=requestAnimationFrame(()=>{xt()}))};const{ModeA:Ke,ModeB:He,ModeC:Nt,ModeAA:wt}=await fr(async()=>{const{ModeA:U,ModeB:Q,ModeC:be,ModeAA:he}=await import("./index-BOKlZEHq.js").then(y=>y.i);return{ModeA:U,ModeB:Q,ModeC:be,ModeAA:he}},[]);if(!navigator.gpu)throw new Error("WebGPU not available");const je=await navigator.gpu.requestAdapter();if(!je)throw new Error("No GPU adapter found");const M=await je.requestDevice();if(!M)throw new Error("Failed to get GPU device");const $e=Pe.getContext("webgpu");if(!$e)throw new Error("Failed to get WebGPU context");const Fe=navigator.gpu.getPreferredCanvasFormat();$e.configure({device:M,format:Fe,alphaMode:"premultiplied"});const ee=M.createTexture({size:[_,$],format:"rgba16float",usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT}),Ye=Ps[p],et=Math.round(_*ht),ge=Math.round($*ht),pt=(()=>{switch(Ye){case"ModeB":return new He({device:M,inputTexture:ee,nativeDimensions:{width:_,height:$},targetDimensions:{width:et,height:ge}});case"ModeC":return new Nt({device:M,inputTexture:ee,nativeDimensions:{width:_,height:$},targetDimensions:{width:et,height:ge}});case"ModeAA":return new wt({device:M,inputTexture:ee,nativeDimensions:{width:_,height:$},targetDimensions:{width:et,height:ge}});default:return new Ke({device:M,inputTexture:ee,nativeDimensions:{width:_,height:$},targetDimensions:{width:et,height:ge}})}})(),mt=pt.getOutputTexture(),qe=M.createSampler({magFilter:"linear",minFilter:"linear"}),kt=M.createShaderModule({code:`
|
|
29
|
+
@group(0) @binding(0) var tex: texture_2d<f32>;
|
|
30
|
+
@group(0) @binding(1) var samp: sampler;
|
|
31
|
+
struct VertexOutput {
|
|
32
|
+
@builtin(position) pos: vec4f,
|
|
33
|
+
@location(0) uv: vec2f,
|
|
34
|
+
}
|
|
35
|
+
@vertex
|
|
36
|
+
fn vs(@builtin(vertex_index) idx: u32) -> VertexOutput {
|
|
37
|
+
var positions = array<vec2f, 6>(
|
|
38
|
+
vec2f(-1.0, -1.0), vec2f(1.0, -1.0), vec2f(-1.0, 1.0),
|
|
39
|
+
vec2f(-1.0, 1.0), vec2f(1.0, -1.0), vec2f(1.0, 1.0)
|
|
40
|
+
);
|
|
41
|
+
var uvs = array<vec2f, 6>(
|
|
42
|
+
vec2f(0.0, 1.0), vec2f(1.0, 1.0), vec2f(0.0, 0.0),
|
|
43
|
+
vec2f(0.0, 0.0), vec2f(1.0, 1.0), vec2f(1.0, 0.0)
|
|
44
|
+
);
|
|
45
|
+
var out: VertexOutput;
|
|
46
|
+
out.pos = vec4f(positions[idx], 0.0, 1.0);
|
|
47
|
+
out.uv = uvs[idx];
|
|
48
|
+
return out;
|
|
49
|
+
}
|
|
50
|
+
@fragment
|
|
51
|
+
fn fs(@location(0) uv: vec2f) -> @location(0) vec4f {
|
|
52
|
+
return textureSample(tex, samp, uv);
|
|
53
|
+
}
|
|
54
|
+
`}),tt=M.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float"}},{binding:1,visibility:GPUShaderStage.FRAGMENT,sampler:{type:"filtering"}}]}),Pt=M.createRenderPipeline({layout:M.createPipelineLayout({bindGroupLayouts:[tt]}),vertex:{module:kt,entryPoint:"vs"},fragment:{module:kt,entryPoint:"fs",targets:[{format:Fe}]},primitive:{topology:"triangle-list"}}),rt=M.createBindGroup({layout:tt,entries:[{binding:0,resource:mt.createView()},{binding:1,resource:qe}]});try{const U=M.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,externalTexture:{}},{binding:1,visibility:GPUShaderStage.FRAGMENT,sampler:{type:"filtering"}}]}),Q=M.createShaderModule({code:Bs}),be=M.createRenderPipeline({layout:M.createPipelineLayout({bindGroupLayouts:[U]}),vertex:{module:Q,entryPoint:"vs"},fragment:{module:Q,entryPoint:"fs",targets:[{format:"rgba16float"}]},primitive:{topology:"triangle-list"}});c.current={pipeline:be,layout:U,inputView:ee.createView()}}catch{c.current=null}if(g.current!==G){ee.destroy(),M.destroy();return}A.current=M,de.current=$e,V.current=pt,x.current=ee,O.current=mt,Le.current=Pt,We.current=qe,a.current=tt,oe.current=!1,we.current=!1;async function At(){const U=c.current;if(!U||oe.current)return!1;const Q=n.current;if(!Q)return!1;const be=!we.current;be&&M.pushErrorScope("validation");try{const he=M.importExternalTexture({source:Q}),y=M.createBindGroup({layout:U.layout,entries:[{binding:0,resource:he},{binding:1,resource:qe}]}),Ce=M.createCommandEncoder(),pe=Ce.beginRenderPass({colorAttachments:[{view:U.inputView,loadOp:"load",storeOp:"store"}]});pe.setPipeline(U.pipeline),pe.setBindGroup(0,y),pe.draw(6),pe.end(),M.queue.submit([Ce.finish()])}catch{return oe.current=!0,c.current=null,!1}if(be){const he=await M.popErrorScope().catch(()=>null);if(he)return console.warn("[anime4k] blit probe failed:",he.message),oe.current=!0,c.current=null,!1;we.current=!0}return!0}F(!1);async function xt(){if(Y||g.current!==G)return;const U=n.current;if(!U||U.videoWidth===0){le();return}if(U!==H||U.videoWidth!==_||U.videoHeight!==$){J(y=>y+1);return}if(U.paused||U.ended||document.hidden||U.readyState<HTMLMediaElement.HAVE_CURRENT_DATA){le();return}const Q=U.getVideoPlaybackQuality().totalVideoFrames;if(Q===T.current){le();return}if(k.current){le();return}const be=U.currentTime;(U.seeking||b.current>=0&&Math.abs(be-b.current)>.5)&&(De(),I.current=!1,R.current=0,T.current=-1),b.current=be;const he=Math.max(0,_e.current||0);he>R.current&&(I.current=!1),k.current=!0;try{const y=performance.now();let Ce=null,pe=!1;if(he<=0){Ne.current.length>0&&De(),I.current=!1,R.current=0;let Ae=!1;if(!Ue.current)try{M.queue.copyExternalImageToTexture({source:U},{texture:ee},[_,$]),T.current=Q,Ae=!0}catch(z){if(z instanceof TypeError)Ue.current=!0;else throw z}if(!Ae&&!oe.current&&c.current&&await At()&&(T.current=Q,Ae=!0),!Ae){const z=await createImageBitmap(U);T.current=Q,M.queue.copyExternalImageToTexture({source:z},{texture:ee},[_,$]),ke(z)}}else{const Ae=await createImageBitmap(U);T.current=Q;const z=Ne.current;z.push({bitmap:Ae,capture:y});const Tt=St(he);for(;z.length>Tt;)ke(z.shift()?.bitmap);let Ct=-1;for(let te=z.length-1;te>=0;te--)if(y-z[te].capture>=he){Ct=te;break}if(Ct!==-1){for(let vt=0;vt<Ct;vt++)ke(z.shift()?.bitmap);const te=z.shift();te?(Ce=te.bitmap,I.current=!0,R.current=he):(Ce=Ae,pe=!0)}else if(!I.current)Ce=Ae,pe=!0;else{const te=z.shift();Ce=te?te.bitmap:Ae,te||(pe=!0)}if(!Ce){k.current=!1,le();return}M.queue.copyExternalImageToTexture({source:Ce},{texture:ee},[_,$]),pe||ke(Ce)}const nt=M.createCommandEncoder();await pt.pass(nt);const ft=nt.beginRenderPass({colorAttachments:[{view:$e.getCurrentTexture().createView(),clearValue:{r:0,g:0,b:0,a:1},loadOp:"clear",storeOp:"store"}]});ft.setPipeline(Pt),ft.setBindGroup(0,rt),ft.draw(6),ft.end(),M.queue.submit([nt.finish()]),ve.current=Q,Ie.current=0,M.queue.onSubmittedWorkDone().then(()=>{g.current===G&&(k.current=!1)})}catch(y){if(k.current=!1,Ie.current+=1,Ie.current>=As&&!Y&&g.current===G){console.error(y),e(y instanceof Error?y.message:"Render error"),L(!1);return}}le()}le()}catch(le){!Y&&g.current===G&&(e(le instanceof Error?le.message:"Failed to initialize upscaler"),F(!1),L(!1))}}return Et(),()=>{Y=!0,g.current+=1,Ze(),De(),x.current&&(x.current.destroy(),x.current=null),O.current&&(O.current.destroy(),O.current=null),A.current&&(A.current.destroy(),A.current=null),V.current=null,Le.current=null,We.current=null,a.current=null,c.current=null,de.current=null,k.current=!1}},[v,f,n,i,p,o]);const q=K(Y=>{L(Y);try{localStorage.setItem("anime4kEnabled",String(Y))}catch{}},[]),ye=K(()=>{L(Y=>{const G=!Y;try{localStorage.setItem("anime4kEnabled",String(G))}catch{}return G})},[]);return{isWebGPUSupported:f,isEnabled:v,isInitializing:P,error:w,toggle:ye,setEnabled:q}}const Is=()=>localStorage.getItem("preferredMode")==="dub"?"dub":"sub",Ds=/^[a-z0-9-]+$/i,br=n=>n?"preferredProviderMature":"preferredProvider",yr=n=>{const i=localStorage.getItem(br(n));return i&&Ds.test(i)?i:null},pr=(n,i)=>{localStorage.setItem(br(i),n)},$s=()=>yr(!1)??"megaplay",Fs=()=>({showMeta:{},episodes:[],watchedEpisodes:[],watchlistStatus:null,showCombinedDetails:!1,currentMode:Is(),inWatchlist:!1,videoSources:[],selectedSource:null,selectedLink:null,isAutoplayEnabled:ln(),showResumeModal:!0,resumeTime:0,resumeDuration:0,skipIntervals:[],selectedProvider:$s(),loadingShowData:!0,loadingVideo:!1,error:null,showCookieModal:!1,cookieProvider:null});function Os(n,i){switch(i.type){case"SET_STATE":return{...n,...i.payload};case"SET_MODE":return{...n,currentMode:i.payload,videoSources:[],selectedSource:null,selectedLink:null};case"SET_PROVIDER":return{...n,selectedProvider:i.payload};default:return n}}async function mr(n,i,p,B,f=!1){if(!n||!i)throw new Error("Missing params");try{const[E,v,L,P]=await Promise.all([Ee.data.video.query({showId:n,episodeNumber:i,mode:p.currentMode,provider:p.selectedProvider}).catch(x=>{const O=x.data?.cause;return x.message==="AUTH_REQUIRED"&&O?.provider==="mkissa"&&B({type:"SET_STATE",payload:{showCookieModal:!0,cookieProvider:"mkissa"}}),null}),Ee.progress.getEpisode.query({showId:n,episodeNumber:i}).catch(()=>null),Ee.settings.getByKey.query({key:"preferredSource"}).catch(()=>null),Ee.data.skipTimes.query({showId:n,episodeNumber:i}).catch(()=>[])]),F=L?.value,w=E?.filter(x=>{const O=x.sourceName.toLowerCase();return p.currentMode==="dub"?O.includes("eng")||O.includes("dub"):O.includes("jpn")||O.includes("sub")||!O.includes("eng")&&!O.includes("dub")})??[],e=w.length>0?w:E??[];let o=e.length>0?e[0]:null;if(F){const x=e.find(O=>O.sourceName===F);x&&(o=x)}const J=o&&o.links.length>0?o.links.sort((x,O)=>(parseInt(O.resolutionStr)||0)-(parseInt(x.resolutionStr)||0))[0]:null,g=v?.currentTime||0,A=v?.duration||0,V=(Array.isArray(P)?P:P?.results||[]).map(x=>({skip_id:x.skip_id||"",skip_type:x.skip_type||"",start_time:x.interval?.start_time??x.start_time??0,end_time:x.interval?.end_time??x.end_time??0})).filter(x=>x.end_time>0);return(!E||E.length===0)&&(f||Oe.error(`No video sources found for ${p.selectedProvider}`)),{videoSources:E,selectedSource:o,selectedLink:J,resumeTime:g,resumeDuration:A,showResumeModal:g>5&&o?.type!=="iframe",skipIntervals:V,fetchedEpisodeNumber:i}}catch(E){const v=E;if(v.message==="AUTH_REQUIRED")return B({type:"SET_STATE",payload:{showCookieModal:!0,cookieProvider:v.provider}}),{videoSources:[],selectedSource:null,selectedLink:null,resumeTime:0,resumeDuration:0,showResumeModal:!1,skipIntervals:[],fetchedEpisodeNumber:i};throw E}}const Ws=(n,i,p,B)=>{const[f,E]=Or(Os,p,c=>({...Fs(),showMeta:c?.name?{name:c.name,thumbnail:c.thumbnail,nativeName:c.nativeName,englishName:c.englishName,names:{romaji:c.name||c.englishName,english:c.englishName||c.name,native:c.nativeName}}:{}})),v=vr(),L=Qr(),P=m(null),F=m(null),{options:w}=gr(),e=Je(()=>w.filter(c=>(c.kind??"anime")==="anime"),[w]),o=i||f.initialEpisode,J=m(o);D(()=>{J.current!==o&&(J.current=o,E({type:"SET_STATE",payload:{selectedSource:null,selectedLink:null}}))},[o,E]),D(()=>{n&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(n)&&f.selectedProvider!=="animepahe"&&P.current!==n&&(P.current=n,E({type:"SET_PROVIDER",payload:"animepahe"}))},[n,f.selectedProvider]);const{data:g,isLoading:A,error:de}=xn(n),{data:V}=cr({queryKey:["player-data",n,f.currentMode,f.selectedProvider],queryFn:async()=>{if(!n)throw new Error("No showId");const c=async()=>{try{const q=await Ee.data.episodes.query({showId:n,mode:f.currentMode,provider:f.selectedProvider}).catch(()=>null);if(q?.episodes?.length)return q}catch{}return null},[b,T,I]=await Promise.all([c(),Ee.watchlist.check.query({showId:n}).catch(()=>({inWatchlist:!1,status:null})),Ee.progress.getWatchedEpisodes.query({showId:n}).catch(()=>[])]),R=b?.episodes?b.episodes.sort((q,ye)=>parseFloat(q)-parseFloat(ye)):[];return{description:b?.description||"",episodes:R,inWatchlist:T.inWatchlist,watchlistStatus:T.status??null,watchedEpisodes:I}},enabled:!!n});D(()=>{!i&&V?.episodes&&V.episodes.length>0&&!i&&E({type:"SET_STATE",payload:{initialEpisode:V.episodes[0]}})},[V,i]),D(()=>{if(g?.isAdult===void 0||F.current===n)return;const c=g.isAdult===!0,b=e.filter(I=>I.mature===c);if(b.length===0||e.find(I=>I.value===f.selectedProvider)?.mature===c)return;const T=yr(c);F.current=n,E({type:"SET_PROVIDER",payload:b.find(I=>I.value===T)?.value??b[0].value})},[g?.isAdult,f.selectedProvider,n,e]),D(()=>{if(!n||!/^dango-mt-\d+$/.test(n)||F.current===`temp:${n}`)return;const c=g?.provider;c&&(F.current=`temp:${n}`,c!==f.selectedProvider&&E({type:"SET_PROVIDER",payload:c}))},[n,g,f.selectedProvider]);const{data:x,isLoading:O,error:Le}=cr({queryKey:["video-sources",n,o,f.selectedProvider,f.currentMode],queryFn:()=>mr(n,o,f,E),enabled:!!n&&!!o&&!(f.showMeta?.isAdult===!0&&!B?.hasMatureConsent)}),{mutateAsync:We}=Yt({mutationFn:async({wasIn:c,showMeta:b})=>{if(!n)throw new Error("Missing showId");if(c)await Ee.watchlist.remove.mutate({id:n});else{const T=b.name||b.names?.romaji;if(!T)throw new Error("Missing show name");await Ee.watchlist.add.mutate({id:n,name:T,thumbnail:b.thumbnail,nativeName:b.names?.native,englishName:b.names?.english,type:b.type,isAdult:b.isAdult})}return!c},onSuccess:c=>{Oe.success(c?"Added to watchlist":"Removed from watchlist"),v.invalidateQueries({queryKey:["player-data",n]}),v.invalidateQueries({queryKey:["show-data",n]}),v.invalidateQueries({queryKey:["watchlist"]})},onError:c=>Oe.error(c instanceof Error?c.message:"Failed to update watchlist")}),a=K(async()=>{!n||!g||await We({wasIn:!!V?.inWatchlist,showMeta:g})},[n,g,V?.inWatchlist,We]),d=K(async c=>{try{await Ee.settings.set.mutate({key:"preferredSource",value:c})}catch(b){console.error(b)}},[]),{mutateAsync:k,isPending:ve}=Yt({mutationFn:async({status:c})=>{if(!n)throw new Error("Missing showId");return await Ee.watchlist.setStatus.mutate({id:n,status:c}),c},onSuccess:c=>{E({type:"SET_STATE",payload:{inWatchlist:!0,watchlistStatus:c}}),Oe.success(`Moved to ${c}`),v.invalidateQueries({queryKey:["show-data",n]}),v.invalidateQueries({queryKey:["watchlist"]}),v.invalidateQueries({queryKey:["allContinueWatching"]})},onError:()=>Oe.error("Failed to update watchlist status")}),Ie=K(async()=>{await k({status:"Completed"})},[k]),{mutateAsync:_e}=Yt({mutationFn:async({episodeNumber:c,duration:b,showMeta:T,episodes:I})=>{await Ee.progress.updateProgress.mutate({showId:n,episodeNumber:c,currentTime:b,duration:b,showName:T.name,showThumbnail:T.thumbnail,nativeName:T.names?.native,englishName:T.names?.english,genres:T.genres?.map(R=>R.name),popularityScore:zr(T.score??T.stats?.averageScore),type:T.type,status:T.status,episodeCount:I.length,isAdult:T.isAdult})},onSuccess:(c,b)=>{Oe.success(`Episode ${b.episodeNumber} marked as watched`),v.invalidateQueries({queryKey:["player-data",n]}),v.invalidateQueries({queryKey:["show-meta",n]}),v.invalidateQueries({queryKey:["video-sources",n,b.episodeNumber]}),v.invalidateQueries({queryKey:["allContinueWatching"]}),v.invalidateQueries({queryKey:["thisWeekSchedule"]}),v.invalidateQueries(L.continueWatching.pathFilter())},onError:()=>Oe.error("Failed to mark episode as watched")}),Ne=K(async(c,b)=>{!n||!g||await _e({episodeNumber:c,duration:b,showMeta:g,episodes:V?.episodes||[]})},[n,g,V?.episodes,_e]),Ue=K(async()=>{E({type:"SET_STATE",payload:{showCombinedDetails:!f.showCombinedDetails}})},[f.showCombinedDetails]),oe=Je(()=>{const c=de||Le,b=c?c.message:null,T=b==="AUTH_REQUIRED"?null:b,I=x&&x.fetchedEpisodeNumber===o?x:null,R=!!x&&!I;return{...f,currentEpisode:o,showMeta:{...f.showMeta||{},...g||{}},episodes:V?.episodes||[],watchedEpisodes:V?.watchedEpisodes||[],inWatchlist:!!V?.inWatchlist,watchlistStatus:V?.watchlistStatus??f.watchlistStatus??null,videoSources:I?.videoSources||[],selectedSource:f.selectedSource||I?.selectedSource||null,selectedLink:f.selectedLink||I?.selectedLink||null,resumeTime:I?.resumeTime||0,resumeDuration:I?.resumeDuration||0,showResumeModal:f.showResumeModal&&(I?.showResumeModal??!1),skipIntervals:I?.skipIntervals||[],loadingShowData:A,loadingVideo:O||R,error:T,fetchedEpisodeNumber:I?.fetchedEpisodeNumber}},[f,g,V,x,A,O,de,Le,o]),we=K((c,b)=>{const T=b||n;if(!T||!c||T===n&&c===o)return;const R=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(T)&&f.selectedProvider!=="animepahe"?"animepahe":f.selectedProvider,q=["video-sources",T,c,R,f.currentMode];v.getQueryState(q)?.status!=="success"&&v.prefetchQuery({queryKey:q,queryFn:()=>mr(T,c,{selectedProvider:R,currentMode:f.currentMode},E,!0),staleTime:300*1e3,gcTime:1800*1e3})},[n,o,v,f,E]);return{state:oe,dispatch:E,toggleWatchlist:a,moveToCompleted:Ie,setPreferredSource:d,handleToggleDetails:Ue,markEpisodeWatched:Ne,prefetchEpisodeSources:we,isMarkingWatched:_e.isPending,isUpdatingWatchlistStatus:ve}},Us=({isOpen:n,onClose:i,onSuccess:p})=>{const B=()=>{p?.(),i()};return r(Be,{isOpen:n,onClose:i,title:"MKissa Browser Verification",children:r("div",{className:yt.container,children:[r("p",{children:"Open MKissa in this browser, play an anime episode, and complete any Cloudflare verification it shows. Once playback works there, return to Dango and click Refresh."}),r("div",{className:yt.actions,children:r("a",{className:yt.link,href:"https://mkissa.to/anime",target:"_blank",rel:"noreferrer",children:"Open MKissa anime"})}),r("div",{className:yt.actions,children:[r("button",{className:yt.secondaryButton,onClick:i,children:"Cancel"}),r("button",{className:yt.button,onClick:B,children:"Refresh Dango"})]})]})})},Jt="fallbackChoice";function Vs(){try{const n=localStorage.getItem(Jt);return n==="iframe"||n==="retry"?n:null}catch{return null}}function qs(n){try{n===null?localStorage.removeItem(Jt):localStorage.setItem(Jt,n)}catch{}}const ao=()=>{const{id:n,episodeNumber:i}=Wr(),p=Ur(),B=vr(),f=Vr(),{hasConsent:E,grant:v}=Gr(),{options:L}=gr(),P=Je(()=>L.filter(t=>(t.kind??"anime")==="anime"),[L]),F=Je(()=>P.map(t=>t.value),[P]),w=Je(()=>new Set(P.filter(t=>t.mature).map(t=>t.value)),[P]),{state:e,dispatch:o,toggleWatchlist:J,moveToCompleted:g,setPreferredSource:A,handleToggleDetails:de,markEpisodeWatched:V,prefetchEpisodeSources:x,isMarkingWatched:O,isUpdatingWatchlistStatus:Le}=Ws(n,i,f.state||null,{hasMatureConsent:E});D(()=>{if(n&&e.showMeta?.id&&e.showMeta.id!==n){const t=i?`/watch/${e.showMeta.id}/${i}${window.location.search}`:`/watch/${e.showMeta.id}${window.location.search}`;p(t,{replace:!0})}},[n,e.showMeta?.id,i,p]);const We=Je(()=>{if(e.showMeta.name)return{name:e.showMeta.name,thumbnail:e.showMeta.thumbnail,names:e.showMeta.names,genres:e.showMeta.genres,score:e.showMeta.score,isAdult:e.showMeta.isAdult}},[e.showMeta.name,e.showMeta.thumbnail,e.showMeta.names,e.showMeta.genres,e.showMeta.score,e.showMeta.isAdult]),a=cn({skipIntervals:e.skipIntervals,showId:n,episodeNumber:e.currentEpisode?.toString(),episodeCount:e.episodes.length||void 0,sourceType:e.selectedSource?.type,showMeta:We}),{refs:d,actions:k}=a,ve=m(null),Ie=Pn(),_e=m(null),Ne=m(null),Ue=m(null),oe=m(0),we=m(e.resumeTime),c=m(e.showResumeModal),[b,T]=ue(()=>{try{const t=localStorage.getItem("anime4kProfile");return["low","balanced","high","denoise"].includes(t)?t:"balanced"}catch{return"balanced"}}),{videoDelayMs:I,videoDelayEnabled:R,setDelayEnabled:q,handleVideoDelayChange:ye,isCalibrating:Y,testClipActive:G,stopCalibration:ke,openAvSyncCalibrator:De,cancelAvSyncCalibrator:St,applyAvSyncCalibrator:Ze,toggleTestClip:Et,calibReturnRef:H,effectiveVideoDelayMs:Pe}=un(d.videoRef,()=>k.setShowSettings(!1)),lt=m(null),_=Ls({videoRef:d.videoRef,canvasRef:Ne,profile:b,delayMs:Pe}),$=_.isEnabled&&_.isWebGPUSupported,W=`${n??""}:${e.currentEpisode??""}`,Te=m(null),Ve=m(!1),Ge=m(!1),ct=m(_.setEnabled);ct.current=_.setEnabled,D(()=>{const t=Te.current;Te.current=W,!(t===null||t===W)&&(!_.isEnabled||!_.isWebGPUSupported||(Ve.current=!0,Ge.current=!1,ct.current(!1)))},[W,_.isEnabled,_.isWebGPUSupported]),D(()=>{if(!Ve.current)return;if(_.isEnabled){Ge.current&&(Ve.current=!1);return}if(Ge.current=!0,e.loadingVideo||!e.selectedLink)return;if(e.selectedSource?.type==="iframe"){Ve.current=!1,ct.current(!0);return}const t=d.videoRef.current;if(!t)return;let s,l=!1;const u=()=>{l||(l=!0,Ve.current=!1,ct.current(!0))};if(t.readyState>=2)return s=window.setTimeout(u,500),()=>window.clearTimeout(s);const N=()=>{window.setTimeout(u,500)};return t.addEventListener("canplay",N,{once:!0}),t.addEventListener("playing",N,{once:!0}),s=window.setTimeout(u,5e3),()=>{window.clearTimeout(s),t.removeEventListener("canplay",N),t.removeEventListener("playing",N)}},[_.isEnabled,e.loadingVideo,e.selectedLink,e.selectedSource?.type,d.videoRef]),dn({videoRef:d.videoRef,canvasRef:lt,delayMs:Pe,enabled:R&&!$});const ut=R&&!$,dt=$||ut;D(()=>{we.current=e.resumeTime,c.current=e.showResumeModal},[e.resumeTime,e.showResumeModal]);const[ht,le]=ue(!1),[Ke,He]=ue(!1),[Nt,wt]=ue(!1),je=m(!1),[M,$e]=ue(null),Fe=m(!1),ee=m([]),Ye=m(!1),[et,ge]=ue(null),[pt,mt]=ue(!1),[qe,kt]=ue(!1),[tt,Pt]=ue(()=>Vs()??"ask"),rt=K(t=>{Pt(t),qs(t==="ask"?null:t)},[]),At=m(tt);At.current=tt;const xt=m(e.videoSources);xt.current=e.videoSources;const U=m(()=>{}),[Q,be]=ue(null),he=m(i);D(()=>{he.current!==i&&(he.current=i,be(null),$e(null),je.current=!1,ke())},[i,ke]),D(()=>{Fe.current=!1,ee.current=[],Ye.current=!1,ge(null),mt(!1)},[n,e.currentEpisode]),D(()=>{Ke||(je.current=!1)},[Ke]);const{data:y=[],isLoading:Ce}=Kr(),pe=Hr(),nt=m(pe);nt.current=pe;const ft=jr(),Ae=Yr(),{isTheaterMode:z,toggleTheaterMode:Tt,handleLayoutClick:Ct}=hn();qr(()=>{if(a.state.isFullscreen||z)return;const t=d.playerContainerRef.current,s=_e.current;if(!t||!s)return;const l=()=>{const N=t.getBoundingClientRect().height;s.style.height=`${N}px`};l();const u=new ResizeObserver(l);return u.observe(t),()=>u.disconnect()},[a.state.isFullscreen,z,d.playerContainerRef]);const te=Je(()=>e.episodes.findIndex(t=>t===e.currentEpisode),[e.episodes,e.currentEpisode]),vt=te>0?e.episodes[te-1]:null,Re=te>=0&&te<e.episodes.length-1?e.episodes[te+1]:null,Vt=te>-1&&te<e.episodes.length-1,qt=pn(e.resumeTime,e.resumeDuration)||Ke,Xe=qt&&ur(e.episodes,e.currentEpisode,e.showMeta.status),Qt=e.showResumeModal&&(Xe||!qt),Bt=qt&&!Xe&&y.length===0&&!Q&&(e.showResumeModal||Ke),st=Qt||Bt;mn(a,!!e.selectedLink&&!z&&!st),D(()=>{const t=d.videoRef.current;if(!t)return;let s=!1;for(ve.current&&(ve.current.destroy(),ve.current=null),(e.loadingVideo||e.selectedSource)&&(t.pause(),t.removeAttribute("src"),t.load());t.firstChild;)t.removeChild(t.firstChild);if(G)return t.src="/av-sync-test.mp4",t.play().catch(()=>{k.setShowControls(!0)}),()=>{s=!0};if(!e.selectedSource||!e.selectedLink)return;if(e.selectedSource.type==="iframe"){oe.current=0;return}H.current!=null?(oe.current=H.current,H.current=null):we.current>5&&!c.current?oe.current=we.current:c.current&&(oe.current=0);let l=e.selectedLink.link;if(l.startsWith("/api/proxy")||(l=`/api/proxy?url=${encodeURIComponent(l)}`,e.selectedLink.headers?.Referer&&(l+=`&referer=${encodeURIComponent(e.selectedLink.headers.Referer)}`)),e.selectedSource.subtitles){const ce=localStorage.getItem("playerSubtitlesEnabled")!=="false";let Se=null;try{Se=localStorage.getItem("playerLastSubtitle")}catch{}const re=Xt(e.selectedSource.subtitles,{lastKey:Se,enabled:ce}),Me=re>=0?e.selectedSource.subtitles[re]:null;e.selectedSource.subtitles.forEach(fe=>{const ne=document.createElement("track");ne.kind="subtitles",ne.label=fe.label,ne.srclang=fe.lang;const S=fe.src??fe.url;if(S){let se=`/api/subtitle-proxy?url=${encodeURIComponent(S)}`;const ae=e.selectedLink?.headers?.Referer,gt=S.includes("anilight.live")?"https://anilight.live/":"",Ot=ae||gt;Ot&&(se+=`&referer=${encodeURIComponent(Ot)}`),ne.src=se}Me&&fe.label===Me.label&&fe.lang===Me.lang&&(ne.default=!0),t.appendChild(ne)}),ce||k.setActiveSubtitleTrack("off"),k.setAvailableSubtitles(e.selectedSource.subtitles)}const u=oe.current;oe.current=0;const N=()=>{u>0&&(t.currentTime=u)};t.addEventListener("loadedmetadata",N,{once:!0});const me=!(c.current&&we.current>5),X=()=>{me&&t.play().catch(()=>{k.setShowControls(!0)})};e.selectedLink.hls?(async()=>{const ce=await Nn();if(s)return;if(!ce||!ce.isSupported()){t.src=l,X();return}const Se=document.body.classList.contains("low-end"),re=new ce({maxBufferLength:Se?15:30,maxMaxBufferLength:Se?30:60,maxBufferSize:Se?25*1e3*1e3:60*1e3*1e3,startLevel:-1,enableWorker:!0});ve.current=re,re.on(ce.Events.ERROR,(ne,S)=>{S.fatal&&!Fe.current&&U.current()});const Me=(e.selectedSource?.subtitles?.length??0)>0,fe=()=>{try{Me&&typeof re.subtitleTrack=="number"&&re.subtitleTrack!==-1&&(re.subtitleTrack=-1)}catch{}};re.on(ce.Events.SUBTITLE_TRACK_SWITCH,(ne,S)=>{S?.id!==-1&&fe()}),fe(),re.loadSource(l),re.attachMedia(t),re.once(ce.Events.MANIFEST_PARSED,()=>{s||X()})})():(t.src=l,X());const j=localStorage.getItem("playerVolume"),ie=localStorage.getItem("playerMuted");return j!==null&&(t.volume=parseFloat(j)),ie!==null&&(t.muted=ie==="true"),()=>{s=!0,t.removeEventListener("loadedmetadata",N),ve.current&&(ve.current.destroy(),ve.current=null)}},[e.selectedSource,e.selectedLink,d.videoRef,H,k,e.loadingVideo,G]);const Lt=K(t=>{if(Fe.current)return;Fe.current=!0;const s=t.links[0];A(t.sourceName),o({type:"SET_STATE",payload:{selectedSource:t,selectedLink:s}}),ge(null)},[o,A]),It=K(()=>{const s=xt.current.find(l=>l.type==="iframe");return s?.links?.length?s:null},[]),Dt=K(async()=>{const t=e.showMeta?.isAdult,s=F.filter(l=>{if(ee.current.includes(l))return!1;const u=w.has(l);return t===void 0?!0:u===t});mt(!0);try{for(const l of s){ee.current.push(l);let u=null;try{u=await Ee.data.video.query({showId:n,episodeNumber:e.currentEpisode,mode:e.currentMode,provider:l})}catch{continue}const N=(u??[]).filter(j=>{const ie=j.sourceName.toLowerCase();return e.currentMode==="dub"?ie.includes("eng")||ie.includes("dub"):ie.includes("jpn")||ie.includes("sub")||!ie.includes("eng")&&!ie.includes("dub")});if((N.length>0?N:u??[]).find(j=>j.type!=="iframe"&&j.links?.length)){ee.current=[e.selectedProvider],Ye.current=!1,o({type:"SET_STATE",payload:{selectedProvider:l,videoSources:[],selectedSource:null,selectedLink:null,loadingVideo:!0}}),pr(l,e.showMeta?.isAdult===!0),ge(null),Oe.success(`Switched to ${l} (direct stream)`);return}}ge({retryFailed:!0}),Oe.error("No working direct stream found on other providers")}finally{mt(!1)}},[n,e.currentEpisode,e.currentMode,e.showMeta?.isAdult,e.selectedProvider,o,F,w]),Zt=K(()=>{if(Fe.current||Ye.current||e.selectedSource?.type!=="player")return;const t=It();if(!t)return;ee.current.includes(e.selectedProvider)||ee.current.push(e.selectedProvider);const s=At.current;if(s==="iframe"){Lt(t);return}if(s==="retry"){Dt();return}k.setShowControls(!0),ge({retryFailed:!1})},[e.selectedSource,e.selectedProvider,It,Lt,Dt,k]);U.current=Zt;const Sr=K(()=>{Ye.current=!0,ge(null),kt(!1)},[]),Er=K(()=>{qe&&rt("iframe");const t=It();t?Lt(t):ge(null)},[qe,rt,It,Lt]),wr=K(()=>{qe&&rt("retry"),Dt()},[qe,rt,Dt]),Rt=(t,s,l)=>t.showId===s||!!l&&t.showId===l,$t=K(()=>{k.onEnded();const t=y.find(l=>Rt(l,n,e.showMeta?.id)&&l.episodeNumber===e.currentEpisode);if(y.length>0){const l=y.findIndex(N=>Rt(N,n,e.showMeta?.id)&&N.episodeNumber===e.currentEpisode),u=l>=0?y[l+1]||null:y[0];be({nextItem:u,playedItem:t||null}),$e(2)}else t&&nt.current.mutate({showId:t.showId,episodeNumber:t.episodeNumber});let s=!1;if(e.isAutoplayEnabled&&y.length===0){const l=e.episodes.findIndex(u=>u===e.currentEpisode);if(l>-1&&l<e.episodes.length-1){const u=e.episodes[l+1];B.invalidateQueries({queryKey:["allContinueWatching"]}),p(`/watch/${n}/${u}`),s=!0}}!s&&y.length===0&&!Q&&!je.current&&ur(e.episodes,e.currentEpisode,e.showMeta.status)&&o({type:"SET_STATE",payload:{showResumeModal:!0}})},[k,p,y,n,e.showMeta?.id,e.showMeta?.status,e.currentEpisode,e.episodes,e.isAutoplayEnabled,Q,o,B]),zt=K(()=>{if(y.length===0)return;k.onEnded();const t=y.find(u=>Rt(u,n,e.showMeta?.id)&&u.episodeNumber===e.currentEpisode),s=y.findIndex(u=>Rt(u,n,e.showMeta?.id)&&u.episodeNumber===e.currentEpisode),l=s>=0?y[s+1]||null:y[0];t&&pe.mutate({showId:t.showId,episodeNumber:t.episodeNumber}),l?p(`/watch/${l.showId}/${l.episodeNumber}`):t&&o({type:"SET_STATE",payload:{showResumeModal:!0}})},[k,p,y,pe,n,e.showMeta?.id,e.currentEpisode,o]),Mt=K(()=>{Re&&(B.invalidateQueries({queryKey:["allContinueWatching"]}),He(!1),p(`/watch/${n}/${Re}`)),o({type:"SET_STATE",payload:{showResumeModal:!1}})},[Re,p,n,o,B]),er=K(()=>{y.length>0?zt():Re?Mt():Oe.error("No next episode available")},[y.length,zt,Mt,Re]),kr=()=>{vt&&p(`/watch/${n}/${vt}`)};D(()=>{const t=d.videoRef.current;if(!t)return;const s=()=>{G||$t()};return t.addEventListener("ended",s),()=>{t&&t.removeEventListener("ended",s)}},[$t,d.videoRef,G]),D(()=>{const t=s=>{s.origin===window.location.origin&&e.selectedSource?.type==="iframe"&&s.data?.type==="ANI_WEB_MEDIA_ENDED"&&$t()};return window.addEventListener("message",t),()=>window.removeEventListener("message",t)},[$t,e.selectedSource?.type]),D(()=>{if(!Q||M===null)return;if(M<=0){const{nextItem:s,playedItem:l}=Q;be(null),$e(null),l&&nt.current.mutate({showId:l.showId,episodeNumber:l.episodeNumber}),s?p(`/watch/${s.showId}/${s.episodeNumber}`):l&&o({type:"SET_STATE",payload:{showResumeModal:!0}});return}const t=window.setTimeout(()=>{$e(s=>s===null?null:s-1)},1e3);return()=>window.clearTimeout(t)},[Q,M,p,o]),D(()=>{st&&a.state.isFullscreen&&a.actions.toggleFullscreen()},[st,a.state.isFullscreen,a.actions]),D(()=>{st&&d.videoRef.current&&d.videoRef.current.pause()},[st,d.videoRef]);const{titlePreference:Ft}=Xr(),{lowEndMode:tr}=Jr(),{settings:Gt,update:Tr}=fn(),Cr=z&&Gt.enabled&&!tr&&e.selectedSource?.type!=="iframe"&&!!e.selectedLink,ot=Je(()=>{if(!e.showMeta||e.loadingShowData)return"Loading...";const{name:t,names:s}=e.showMeta;return Ft==="name"?t||"Loading...":Ft==="nativeName"?s?.native||t||"Loading...":Ft==="englishName"?s?.english||t||"Loading...":t||"Loading..."},[e.showMeta,Ft,e.loadingShowData]);D(()=>{ot&&ot!=="Loading..."&&e.currentEpisode&&(document.title=`► ${ot} Episode ${e.currentEpisode} - dango`)},[ot,e.currentEpisode]),D(()=>{const t=s=>{s.target.closest('input, textarea, button, select, a, [role="button"], [contenteditable="true"]')||(["arrowup","arrowdown","arrowleft","arrowright"].includes(s.key.toLowerCase())&&(k.setShowControls(!0),a.actions.inactivityTimer.current&&clearTimeout(a.actions.inactivityTimer.current),a.actions.inactivityTimer.current=window.setTimeout(()=>{k.setShowControls(!1)},1e3)),s.key.toLowerCase()==="n"&&er(),s.key.toLowerCase()==="t"&&Tt())};return document.addEventListener("keydown",t),()=>{document.removeEventListener("keydown",t)}},[k,a.actions.inactivityTimer,er,Tt]);const{setAvailableSubtitles:rr,setActiveSubtitleTrack:Kt}=k;D(()=>{const t=d.videoRef.current;if(!t)return;const s=()=>{const l=Array.from(t.textTracks).map(u=>({label:u.label,lang:u.language,src:void 0,mode:u.mode}));rr(l)};return t.textTracks.addEventListener("addtrack",s),t.textTracks.addEventListener("removetrack",s),s(),()=>{t&&(t.textTracks.removeEventListener("addtrack",s),t.textTracks.removeEventListener("removetrack",s))}},[d.videoRef,rr]),D(()=>{if(a.state.activeSubtitleTrack===null&&a.state.availableSubtitles.length>0&&localStorage.getItem("playerSubtitlesEnabled")!=="false"){let t=null;try{t=localStorage.getItem("playerLastSubtitle")}catch{}const s=Xt(a.state.availableSubtitles,{lastKey:t,enabled:!0});if(s<0){Kt("off");return}const l=a.state.availableSubtitles[s];Kt(l.lang||l.label)}},[a.state.activeSubtitleTrack,a.state.availableSubtitles,Kt]),D(()=>{const t=d.videoRef.current;if(!t||a.state.availableSubtitles.length===0)return;const s=a.state.activeSubtitleTrack;if(!(localStorage.getItem("playerSubtitlesEnabled")!=="false")||s==="off"||s===null){Array.from(t.textTracks).forEach(N=>{N.mode="hidden"});return}let u=!1;if(Array.from(t.textTracks).forEach(N=>{const X=(N.language===s||N.label===s)&&!u;N.mode=X?"showing":"hidden",X&&(u=!0)}),!u&&t.textTracks.length>0){const N=Array.from(t.textTracks).find(me=>me.language==="en"||me.label==="English")||t.textTracks[0];N&&(N.mode="showing")}},[a.state.activeSubtitleTrack,a.state.availableSubtitles,d.videoRef]);const[nr,Rr]=ue(0);D(()=>{const t=d.videoRef.current;if(!t)return;const s=()=>Rr(t.clientHeight||0);s();const l=new ResizeObserver(s);return l.observe(t),()=>l.disconnect()},[d.videoRef,e.selectedSource,e.selectedLink]),D(()=>{const t="dynamic-subtitle-styles";let s=document.getElementById(t);s||(s=document.createElement("style"),s.id=t,document.head.appendChild(s));const l={fontSize:a.state.subtitleFontSize,position:a.state.subtitlePosition,bgOpacity:a.state.subtitleBgOpacity,bgColor:a.state.subtitleBgColor,textColor:a.state.subtitleTextColor,edge:a.state.subtitleEdge,bold:a.state.subtitleBold};s.textContent=dr(l);const u=d.videoRef.current;if(!u)return;const N=hr(a.state.subtitleFontSize,nr||u.clientHeight||720);s.textContent=dr({...l,fontSize:N});const me=()=>{const S=Number(a.state.subtitlePosition),se=isNaN(S)?0:Math.max(0,Math.min(100,S));return Math.max(0,Math.min(100,100-se))},X=(S,se)=>{try{const ae=S;ae.snapToLines=!1,ae.line=se}catch{}},j=()=>{const S=N*16,se=u.videoHeight||u.clientHeight||720,ae=u.videoWidth||u.clientWidth||1280;return{step:S*1.3/se*100,chars:Math.max(20,Math.floor(ae/(S*.55)))}},ie=S=>{const se=me(),ae=Array.from(S.activeCues??[]);if(ae.length<=1){ae.forEach(bt=>X(bt,se));return}const{step:gt,chars:Ot}=j();let ar=se;for(let bt=ae.length-1;bt>=0;bt--){const Lr=String(ae[bt].text??"").replace(/<[^>]*>/g,"").split(`
|
|
55
|
+
`).reduce((Ir,Dr)=>Ir+Math.max(1,Math.ceil(Dr.length/Ot)),0),lr=ar-Lr*gt;X(ae[bt],Math.max(0,lr)),ar=lr-gt*.4}},ce=S=>{if(!S.cues)return;const se=me();Array.from(S.cues).forEach(ae=>X(ae,se)),S.mode==="showing"&&ie(S)},Se=()=>{Array.from(u.textTracks).forEach(ce)};Se();const re=S=>{const se=S.target;se.mode==="showing"&&ie(se)};Array.from(u.textTracks).forEach(S=>{S.addEventListener("cuechange",re)});const Me=()=>{Array.from(u.textTracks).forEach(S=>{S.removeEventListener("cuechange",re),S.addEventListener("cuechange",re)}),Se()};u.textTracks.addEventListener("addtrack",Me),u.textTracks.addEventListener("removetrack",Me);const fe=Array.from(u.querySelectorAll("track")),ne=()=>{Se()};return fe.forEach(S=>{S.addEventListener("load",ne)}),()=>{Array.from(u.textTracks).forEach(S=>{S.removeEventListener("cuechange",re)}),u.textTracks.removeEventListener("addtrack",Me),u.textTracks.removeEventListener("removetrack",Me),fe.forEach(S=>{S.removeEventListener("load",ne)})}},[a.state.subtitleFontSize,a.state.subtitlePosition,a.state.subtitleBgOpacity,a.state.subtitleBgColor,a.state.subtitleTextColor,a.state.subtitleEdge,a.state.subtitleBold,a.state.activeSubtitleTrack,a.state.availableSubtitles,e.selectedSource,e.selectedLink,d.videoRef,nr]),D(()=>{if(!dt)return;const t=d.videoRef.current,s=Ue.current;if(!t||!s)return;const l=localStorage.getItem("playerSubtitlesEnabled")!=="false",u=a.state.activeSubtitleTrack;function N(){if(s.innerHTML="",!l||u==="off"||u===null)return;const j=Array.from(t.textTracks).find(ne=>ne.language===u||ne.label===u);if(!j||j.mode!=="showing")return;const ie=Pe/1e3;let ce;if(ie>0&&j.cues){const ne=t.currentTime-ie;ce=Array.from(j.cues).filter(S=>S.startTime<=ne&&ne<=S.endTime)}else ce=Array.from(j.activeCues??[]);if(ce.length===0)return;const Se={fontSize:hr(a.state.subtitleFontSize,t.clientHeight||0),position:a.state.subtitlePosition,bgOpacity:a.state.subtitleBgOpacity,bgColor:a.state.subtitleBgColor,textColor:a.state.subtitleTextColor,edge:a.state.subtitleEdge,bold:a.state.subtitleBold},re=vn(Se),Me=gn(t,Se.position),fe=Array.from(ce);fe.forEach((ne,S)=>{const se=String(ne.text??"");if(!bn(se).trim())return;const ae=document.createElement("div"),gt=(fe.length-1-S)*1.7;ae.style.cssText=`${re}
|
|
56
|
+
bottom: calc(${Me}px + ${gt}em);`,ae.innerHTML=yn(se),s.appendChild(ae)})}const me=()=>N(),X=()=>N();return Array.from(t.textTracks).forEach(j=>{j.addEventListener("cuechange",me)}),t.addEventListener("timeupdate",X),N(),()=>{Array.from(t.textTracks).forEach(j=>{j.removeEventListener("cuechange",me)}),t.removeEventListener("timeupdate",X),s.innerHTML=""}},[_.isEnabled,_.isWebGPUSupported,a.state.subtitleFontSize,a.state.subtitlePosition,a.state.subtitleBgOpacity,a.state.subtitleBgColor,a.state.subtitleTextColor,a.state.subtitleEdge,a.state.subtitleBold,a.state.activeSubtitleTrack,d.videoRef,dt,Pe]),D(()=>{try{localStorage.setItem("anime4kProfile",b)}catch{}},[b]);const Mr=()=>{d.videoRef.current&&(d.videoRef.current.currentTime=e.resumeTime,d.videoRef.current.play()),o({type:"SET_STATE",payload:{showResumeModal:!1}})},_r=()=>{d.videoRef.current&&(d.videoRef.current.currentTime=0,d.videoRef.current.play()),o({type:"SET_STATE",payload:{showResumeModal:!1}})},Ht=K(()=>{Xe&&(je.current=!0),Bt&&He(!1),o({type:"SET_STATE",payload:{showResumeModal:!1}})},[o,Xe,Bt]),Nr=K(()=>{if(He(!1),d.videoRef.current)try{d.videoRef.current.currentTime=0,d.videoRef.current.play().catch(()=>{})}catch{}o({type:"SET_STATE",payload:{showResumeModal:!1}})},[o,d]),Pr=K(async()=>{try{await g(),o({type:"SET_STATE",payload:{showResumeModal:!1}}),p("/")}catch{}},[g,o,p]),sr=(t,s)=>r("div",{className:t,children:[r("button",{className:`${h.episodeNavBtn} ${h.secondary}`,onClick:kr,disabled:!vt,type:"button",children:[r(Z,{name:"chevron-left",size:12}),"Prev EP"]}),r("button",{className:`${h.episodeNavBtn} ${h.primary}`,onClick:Mt,disabled:!Re,type:"button",children:["Next EP",r(Z,{name:"chevron-right",size:12})]}),s==="mobile"&&Ie&&r("button",{className:`${h.episodeNavBtn} ${h.episodePickerBtn}`,onClick:()=>wt(!0),type:"button",children:[r(Z,{name:"list-ul",size:12}),"Episodes"]})]});D(()=>{Ke&&(e.showResumeModal||y.length>0||Q||je.current||Xe&&o({type:"SET_STATE",payload:{showResumeModal:!0}}))},[Ke,Xe,e.showResumeModal,y.length,Q,o]);const Ar=t=>{o({type:"SET_STATE",payload:{isAutoplayEnabled:t}}),_n(t)},or=!!(e.currentEpisode&&e.watchedEpisodes.includes(e.currentEpisode)),xr=e.selectedProvider!=="megaplay"||e.selectedSource?.type==="iframe",jt=m(x);jt.current=x;const ir=m("");D(()=>{const t=d.videoRef.current;if(le(!1),He(!1),!t||e.selectedSource?.type==="iframe")return;const s=()=>{const l=t.duration,u=t.currentTime;if(!l||Number.isNaN(l)){le(!1),He(!1);return}const N=u/l;if(l-u<=60){const me=y.findIndex(ie=>Rt(ie,n,e.showMeta?.id)&&ie.episodeNumber===e.currentEpisode),X=y.length>0?me>=0?y[me+1]||null:y[0]:null,j=X?`${X.showId}:${X.episodeNumber}`:Vt?`${n}:${Re}`:"";j&&ir.current!==j&&(ir.current=j,X?jt.current(X.episodeNumber,X.showId):jt.current(Re))}le(Vt&&N>=.8),He(u>=Math.max(l*.98,l-10))};return s(),t.addEventListener("timeupdate",s),t.addEventListener("loadedmetadata",s),()=>{t.removeEventListener("timeupdate",s),t.removeEventListener("loadedmetadata",s)}},[d.videoRef,Vt,e.currentEpisode,e.selectedSource,Re,n,y,e.showMeta?.id]);const Br=K(async()=>{if(!n||!e.currentEpisode||!e.showMeta.name||O)return;const t=d.videoRef.current?.duration,s=Math.max(t||0,e.resumeDuration||0,(e.showMeta.lengthMin||0)*60,1);await V(e.currentEpisode,s)},[n,e.currentEpisode,e.showMeta,e.resumeDuration,V,O,d.videoRef]);if(e.error&&!e.showMeta.name&&e.videoSources.length===0&&e.episodes.length===0)return r("p",{className:"error-message",children:["Error: ",e.error]});const Qe=e.loadingShowData||e.loadingVideo;return e.showMeta?.isAdult===!0&&!E?r("div",{className:xe.playerPageLayout,children:r(Be,{isOpen:!0,title:"Content Warning",onClose:()=>p("/home"),children:r("div",{style:{padding:"1rem",textAlign:"center"},children:[r("p",{children:"This title contains mature content intended for adult audiences."}),r("p",{children:["By proceeding, you confirm that you are ",r("strong",{children:"18 years of age or older"})," (or the age of majority in your jurisdiction) and wish to view this content."]}),r("div",{style:{marginTop:"1rem",display:"flex",gap:"10px",justifyContent:"center"},children:[r(it,{variant:"secondary",onClick:()=>p("/home"),children:"Go Back"}),r(it,{onClick:v,children:"I'm 18+, Continue"})]})]})})}):r("div",{className:`${xe.playerPageLayout} ${z?xe.theaterMode:""}`,onClick:Ct,children:[z&&r(Sn,{videoRef:d.videoRef,active:Cr,settings:Gt}),r(Be,{isOpen:Qt&&Xe,onClose:Ht,title:"Show Completed!",width:"sm",children:[r(Be.Body,{children:r("p",{children:"Congratulations! You've finished the final episode of this series."})}),r(Be.Actions,{children:r(it,{onClick:Pr,disabled:Le,children:Le?"Saving...":"Move to Completed"})})]}),r(En,{isOpen:Qt&&!Xe,onClose:Ht,title:"Resume Playback?",message:r(Wt,{children:["You were watching at ",r("strong",{children:a.actions.formatTime(e.resumeTime)}),". Would you like to continue?"]}),onResume:Mr,onRestart:_r}),r(Be,{isOpen:Bt,onClose:Ht,title:"Episode Completed",width:"sm",children:[r(Be.Body,{children:r("p",{children:["You've already watched Episode ",r("strong",{children:e.currentEpisode}),".",Re?" Would you like to watch the next episode?":""]})}),r(Be.Actions,{children:[r(it,{variant:"secondary",onClick:Nr,children:"Replay"}),Re&&r(it,{onClick:Mt,children:`Watch EP ${Re}`})]})]}),r(Be,{isOpen:!!et,onClose:Sr,title:"Direct stream failed",width:"sm",children:[r(Be.Body,{children:[r("p",{children:[r("strong",{children:e.selectedProvider}),"'s direct stream failed for this episode."]}),et?.retryFailed&&r("p",{children:"No working direct stream was found on the other providers either."}),r("p",{children:["You can continue with the embedded (iframe) player, but embedded players may show"," ",r("strong",{children:"ads and pop-ups"}),"."]}),r("label",{style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"0.75rem",cursor:"pointer"},children:[r("input",{type:"checkbox",checked:qe,onChange:t=>kt(t.target.checked)}),"Remember my choice"]})]}),r(Be.Actions,{children:[r(it,{variant:"secondary",onClick:Er,children:"Continue with iframe"}),r(it,{onClick:wr,disabled:pt,children:pt?"Searching…":"Try another provider"})]})]}),r(Zr,{isOpen:!!e.showCookieModal&&e.cookieProvider!=="mkissa",onClose:()=>o({type:"SET_STATE",payload:{showCookieModal:!1}}),onSuccess:()=>{B.invalidateQueries({queryKey:["video-sources",n,e.currentEpisode,e.selectedProvider,e.currentMode]})}}),r(Us,{isOpen:!!e.showCookieModal&&e.cookieProvider==="mkissa",onClose:()=>o({type:"SET_STATE",payload:{showCookieModal:!1}}),onSuccess:()=>{B.invalidateQueries({queryKey:["video-sources",n,e.currentEpisode,e.selectedProvider,e.currentMode]})}}),!z&&r("aside",{ref:_e,className:xe.episodeSidebar,children:e.loadingShowData?r(wn,{variant:"sidebar"}):r(kn,{episodes:e.episodes,currentEpisode:e.currentEpisode,watchedEpisodes:e.watchedEpisodes,onEpisodeClick:t=>p(`/watch/${n}/${t}`)})}),r("div",{className:xe.playerMain,children:[r("div",{className:`${h.videoContainer} ${a.state.isFullscreen?"":xe.videoPlayerWrapper} ${a.state.isFullscreen?h.fullscreenActive:""}`,style:{...st?{visibility:"hidden"}:{}},onContextMenu:t=>t.preventDefault(),children:r(Ts,{player:a,isAutoplayEnabled:e.isAutoplayEnabled,onAutoplayChange:Ar,fallbackChoice:tt,onFallbackChoiceChange:rt,ambientSettings:Gt,onAmbientChange:Tr,showNextEpisodeButton:!st&&ht&&y.length===0,onNextEpisode:Mt,videoSources:e.videoSources,selectedSource:e.selectedSource,selectedLink:e.selectedLink,onSourceChange:(t,s)=>{d.videoRef.current&&!isNaN(d.videoRef.current.currentTime)&&(oe.current=d.videoRef.current.currentTime),A(t.sourceName),o({type:"SET_STATE",payload:{selectedSource:t,selectedLink:s,showResumeModal:e.showResumeModal&&t.type!=="iframe"}})},loadingVideo:Qe,skipIntervals:e.skipIntervals,animeTitle:ot,episodeNumber:e.currentEpisode,isTheaterMode:z,onTheaterModeToggle:Tt,anime4kEnabled:_.isEnabled,onAnime4kToggle:_.toggle,anime4kSupported:_.isWebGPUSupported,anime4kProfile:b,onAnime4kProfileChange:T,anime4kInitializing:_.isInitializing,anime4kError:_.error,videoDelayEnabled:R,onVideoDelayToggle:q,videoDelayMs:I,onVideoDelayChange:ye,onCalibrateAvSync:De,isInteractingExtra:Nt||Y,className:Tn.shellFill,hideChrome:e.selectedSource?.type==="iframe",overlays:r(Wt,{children:[a.state.isSpeedBoostActive&&r("div",{className:h.speedBoostBadge,"aria-hidden":"true",children:[r("span",{children:"2x"}),r(Z,{name:"forward",size:12})]}),M!==null&&Q?.nextItem&&r("div",{className:h.queueCountdown,children:["Queue next in ",M,"s"]})]}),children:[Qe&&r("div",{className:h.loadingOverlay,children:r("div",{className:h.loadingDots,children:[r("div",{className:h.dot}),r("div",{className:h.dot}),r("div",{className:h.dot})]})}),a.state.isBuffering&&!Qe&&e.selectedSource?.type!=="iframe"&&r("div",{className:h.bufferingOverlay,children:r("div",{className:h.bufferingSpinner})}),e.selectedSource?.type==="iframe"?!Qe&&r("iframe",{src:e.selectedLink?.link,className:h.videoIframe,allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0,sandbox:e.selectedSource.sandbox?`${e.selectedSource.sandbox} allow-fullscreen allow-popups allow-popups-to-escape-sandbox`:void 0}):r(Wt,{children:[!Qe&&e.videoSources.length===0&&r("div",{className:h.errorOverlay,children:[r("p",{children:["No sources found for this episode with ",e.selectedProvider,"."]}),r("p",{className:h.errorSubtext,children:"Please try selecting a different provider below."}),r("button",{className:h.retryButton,onClick:()=>window.location.reload(),"data-speed-boost-ignore":"true",style:{marginTop:8},children:"Retry"})]}),!Qe&&e.videoSources.length>0&&r("video",{ref:d.videoRef,controls:a.state.useNativeControls,playsInline:!0,"webkit-playsinline":"true",disablePictureInPicture:!0,disableRemotePlayback:!0,onPlay:k.onPlay,onPause:k.onPause,onLoadedMetadata:k.onLoadedMetadata,onTimeUpdate:()=>{G||(k.onTimeUpdate(),Q&&d.videoRef.current&&d.videoRef.current.currentTime<d.videoRef.current.duration-1&&(be(null),$e(null)))},onProgress:k.onProgress,onVolumeChange:k.onVolumeChange,onWaiting:k.onWaiting,onPlaying:k.onPlaying,onCanPlay:k.onCanPlay,onError:Zt,onContextMenu:t=>t.preventDefault(),className:dt?h.videoElementHidden:""}),_.isWebGPUSupported&&!Qe&&e.videoSources.length>0&&r("canvas",{ref:Ne,className:`${h.upscalerCanvas} ${$?h.upscalerActive:""}`}),!$&&!Qe&&e.videoSources.length>0&&r("canvas",{ref:lt,className:`${h.upscalerCanvas} ${ut?h.upscalerActive:""}`}),_.isEnabled&&_.isWebGPUSupported&&_.isInitializing&&r("div",{className:h.upscalerStatusBadge,children:"Preparing upscaler…"}),dt&&r("div",{ref:Ue,className:h.subtitleOverlay}),r(Cn,{isOpen:Y,ms:I,onChange:ye,onApply:Ze,onClose:St,testClipActive:G,onTestClip:Et})]})]})}),!z&&r(Rn,{}),!z&&r(Wt,{children:[Ce&&y.length===0?r(Cs,{count:3}):r(An,{title:"Queue",items:y,currentShowId:n,currentEpisode:e.currentEpisode,onNextQueue:zt,onRemove:t=>pe.mutate({showId:t.showId,episodeNumber:t.episodeNumber}),onClear:()=>ft.mutate(),showClearAll:!0,onReorder:t=>Ae.mutate(t.map(s=>({id:s.id,showId:s.showId,episodeNumber:s.episodeNumber})))}),r("div",{className:h.streamPanel,children:[r(Rs,{selectedProvider:e.selectedProvider,isAdult:e.showMeta?.isAdult,options:P,onProviderChange:t=>{Fe.current=!1,ee.current=[],Ye.current=!1,ge(null),o({type:"SET_STATE",payload:{selectedProvider:t,videoSources:[],selectedSource:null,selectedLink:null,loadingVideo:!0}}),pr(t,e.showMeta?.isAdult===!0)}}),sr(`${h.episodeActions} ${h.desktopEpisodeActions}`,"desktop"),Qe?r("div",{className:h.sourceLoader,children:r("div",{className:h.spinner})}):r(_s,{videoSources:e.videoSources,selectedSource:e.selectedSource,selectedLink:e.selectedLink,onSourceChange:t=>{d.videoRef.current&&!isNaN(d.videoRef.current.currentTime)&&(oe.current=d.videoRef.current.currentTime);const l=(t.links||[]).sort((u,N)=>(parseInt(N.resolutionStr)||0)-(parseInt(u.resolutionStr)||0))[0]||null;A(t.sourceName),o({type:"SET_STATE",payload:{selectedSource:t,selectedLink:l,showResumeModal:e.showResumeModal&&t.type!=="iframe"}})},onLinkChange:t=>{e.selectedSource&&(A(e.selectedSource.sourceName),o({type:"SET_STATE",payload:{selectedLink:t}}))}})]}),r("div",{className:xe.playerInfoContainer,children:[r("div",{className:xe.playerInfoHeader,children:[r("div",{className:xe.playerAnimeCard,children:r("img",{src:en(e.showMeta.thumbnail||""),alt:ot,loading:"lazy",decoding:"async",onError:t=>{t.target.src="/placeholder.svg"}})}),r("div",{className:xe.videoTitleSection,children:[r("div",{className:h.titleContainer,children:[r("h1",{children:ot}),r("div",{className:h.scheduleInfo,children:[e.showMeta.status&&r("span",{className:h.status,children:e.showMeta.status}),e.showMeta.nextEpisodeAirDate&&r("span",{className:h.nextEpisode,children:["Next episode: ",e.showMeta.nextEpisodeAirDate]})]})]}),r("div",{className:h.controls,children:[r("button",{className:`${h.watchlistBtn} ${e.inWatchlist?h.inList:""}`,onClick:J,children:[e.inWatchlist?r(Z,{name:"check",size:14}):r(Z,{name:"plus",size:14}),e.inWatchlist?"In Watchlist":"Add to Watchlist"]}),r(Bn,{showId:n,showName:e.showMeta.name||e.showMeta.names?.romaji,showThumbnail:e.showMeta.thumbnail,nativeName:e.showMeta.names?.native,englishName:e.showMeta.names?.english,showType:e.showMeta.type,className:`${h.watchlistBtn} ${h.queueBtn}`,activeClassName:h.queueActive}),xr&&r("button",{className:`${h.watchlistBtn} ${h.markWatchedBtn} ${or?h.markWatchedDone:""}`,onClick:Br,disabled:O||!e.currentEpisode,children:[r(Z,{name:"check",size:14}),O?"Saving...":or?"Watched":"Mark Watched"]}),r("button",{className:`${h.watchlistBtn} ${h.modeToggleBtn} ${e.currentMode==="dub"?h.modeToggleActive:""}`,onClick:()=>{const t=e.currentMode==="dub"?"sub":"dub";Fe.current=!1,ee.current=[],Ye.current=!1,ge(null),o({type:"SET_MODE",payload:t}),localStorage.setItem("preferredMode",t)},type:"button","aria-pressed":e.currentMode==="dub",children:e.currentMode==="dub"?"DUB":"SUB"}),tr&&r("button",{className:`${h.watchlistBtn} ${h.modeToggleBtn} ${a.state.useNativeControls?h.modeToggleActive:""}`,onClick:()=>{const t=!a.state.useNativeControls;a.actions.setUseNativeControls(t),localStorage.setItem("playerUseNativeControls",t.toString())},type:"button",children:a.state.useNativeControls?"NATIVE: ON":"NATIVE: OFF"})]})]})]}),sr(`${h.episodeActions} ${h.mobileEpisodeActions}`,"mobile"),r("div",{className:xe.infoColumns,children:[r("div",{className:`${h.descriptionSection} ${h.synopsisFlat}`,children:[r("h3",{children:"Synopsis"}),r(In,{text:e.showMeta.description?e.showMeta.description.replace(/<[^>]*>?/gm,""):"",emptyText:"No description available."}),r("button",{className:h.detailsToggleBtn,onClick:de,children:[e.showCombinedDetails?r(Z,{name:"chevron-up"}):r(Z,{name:"chevron-down"}),e.showCombinedDetails?"Hide Details":"Show Details"]})]}),e.showCombinedDetails&&r(Ln,{showMeta:e.showMeta,styles:h})]})]})]})]}),r(Mn,{isOpen:Nt,onClose:()=>wt(!1),episodes:e.episodes,currentEpisode:e.currentEpisode,watchedEpisodes:e.watchedEpisodes,onEpisodeClick:t=>{wt(!1),p(`/watch/${n}/${t}`)}})]})};export{ao as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as w,d as ne,T as te,u as e}from"./vendor-core-DfaOB3Rn.js";import{I as o}from"./vendor-icons-DrybRNxP.js";import{S as ae,O as A,a as se,A as le,b as ie}from"./OptionListMenu-
|
|
1
|
+
import{g as w,d as ne,T as te,u as e}from"./vendor-core-DfaOB3Rn.js";import{I as o}from"./vendor-icons-DrybRNxP.js";import{S as ae,O as A,a as se,A as le,b as ie}from"./OptionListMenu-fIHdE-nq.js";import{u as re}from"./index-BTnhzofk.js";import"./AvSyncCalibrator-DmoH5eRA.js";import"./vendor-query-BBT5_sHx.js";const ce="_settingsPanel_1dymm_1",oe="_header_1dymm_33",me="_backBtn_1dymm_56",de="_contentWrapper_1dymm_76",ue="_menuContent_1dymm_82",he="_menuItem_1dymm_89",pe="_selected_1dymm_114",be="_currentValue_1dymm_134",ye="_menuNote_1dymm_141",ge="_menuError_1dymm_150",n={settingsPanel:ce,header:oe,backBtn:me,contentWrapper:de,menuContent:ue,menuItem:he,selected:pe,currentValue:be,menuNote:ye,menuError:ge},ve=($,P)=>{const{isOpen:y,onClose:ke,videoSources:Ce,currentSource:C,currentLink:N,onSourceChange:V,subtitles:O,activeSubtitleTrack:g,onSubtitleChange:E,subtitleSettings:z,onSubtitleSettingsChange:T,useNativeControls:v,onNativeControlsToggle:U,anime4kEnabled:u,onAnime4kToggle:B,anime4kSupported:f,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}=re(),[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:N?.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),localStorage.setItem("playerUseNativeControls",t.toString())},children:[e("span",{children:"Native Controls"}),v&&e(o,{name:"check",size:12})]}),f&&e("button",{className:`${n.menuItem} ${u?n.selected:""}`,onClick:()=>{B(!u)},children:[e("span",{children:"Anime4K Upscaler"}),u&&e(o,{name:"check",size:12})]}),f&&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:N?.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(se,{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(le,{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(ie,{classes:{item:n.menuItem,active:n.selected,note:n.menuNote},values:b,onChange:k})}):null;return y?e(ae,{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},we=w.forwardRef(ve);export{we as default};
|
package/client/dist/assets/{QueueOptionsButton-BMl804vN.js → QueueOptionsButton-T1J37IZT.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as F}from"./vendor-query-BBT5_sHx.js";import{t as T,l as j,Z as H,$ as J,a0 as W}from"./index-
|
|
1
|
+
import{b as F}from"./vendor-query-BBT5_sHx.js";import{t as T,l as j,Z as H,$ as J,a0 as W}from"./index-BTnhzofk.js";import{d as X,T as R,q as r,u as t,$ as Y,S as w}from"./vendor-core-DfaOB3Rn.js";import{a as ee,c as te,d as ne,b as se,o as oe,f as ae,s as ie}from"./vendor-ui-3qrARCPr.js";import{I as u}from"./vendor-icons-DrybRNxP.js";function Pe(n){return F({queryKey:["show-meta",n],queryFn:async()=>n?T.data.showMeta.query({id:n}):{},enabled:!!n,staleTime:3e4})}async function re(n){try{return await T.watchlist.queueSuggested.query({showId:n})}catch{throw new Error("Failed to resolve suggested episode")}}const ue="_trigger_1vova_6",le="_triggerBtn_1vova_11",me="_chevron_1vova_25",ce="_menu_1vova_34",de="_menuTitle_1vova_51",pe="_menuItem_1vova_60",ge="_removeItem_1vova_91",fe="_menuEmpty_1vova_99",a={trigger:ue,triggerBtn:le,chevron:me,menu:ce,menuTitle:de,menuItem:pe,removeItem:ge,menuEmpty:fe},ve=8,qe=({showId:n,showName:v,showThumbnail:h,nativeName:y,englishName:_,showType:b,className:z="",activeClassName:A="",align:D="right",onMenuOpenChange:p})=>{const{data:E=[]}=j(),P=H(),q=J(),[l,f]=X(!1),{refs:Q,floatingStyles:M,context:S}=ee({open:l,onOpenChange:e=>{e||(f(!1),p?.(!1))},placement:D==="left"?"bottom-start":"bottom-end",middleware:[oe(ve),ae({padding:8}),ie({padding:8})],whileElementsMounted:se}),x=te(S,{outsidePress:!0,escapeKey:!0,referencePress:!1}),{getReferenceProps:C,getFloatingProps:I}=ne([x]),m=R(()=>E.filter(e=>e.showId===n),[E,n]),{data:K}=F({queryKey:["suggestedEpisode",n],queryFn:()=>re(n),enabled:!!n}),{data:$,isFetching:N}=W(n,l),s=R(()=>$?.episodes||[],[$]),k=r(()=>{f(!0),p?.(!0)},[p]),c=r(()=>{f(!1),p?.(!1)},[p]),d=m.length>0,o=s.length>0,g=K?.episodeNumber,i=r(e=>{!n||e.length===0||(P.mutate({showId:n,episodeNumbers:e,showName:v,showThumbnail:h,nativeName:y,englishName:_,type:b}),c())},[n,v,h,y,_,b,P,c]),L=r(()=>{!n||m.length===0||(q.mutate({showId:n,episodeNumbers:m.map(e=>e.episodeNumber)}),c())},[n,m,q,c]),O=r(()=>{o?i([s[0]]):g&&i([String(g)])},[o,s,g,i]),U=r(()=>{o&&i(s.slice(0,3))},[o,s,i]),G=r(()=>{o&&i([...s])},[o,s,i]),B=s[0],V=s[Math.min(2,s.length-1)],Z=t("div",{className:a.trigger,ref:Q.setReference,children:t("span",{className:`${a.triggerBtn} ${z} ${d?A:""}`,role:"button",tabIndex:0,"aria-haspopup":"menu","aria-expanded":l,"aria-label":d?"Queued":"Queue",...C(),onClick:e=>{e.preventDefault(),e.stopPropagation(),l?c():k()},onKeyDown:e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),e.stopPropagation(),l?c():k())},children:[d?t(u,{name:"check",size:14}):t(u,{name:"plus",size:14}),d?"Queued":"Queue",t(u,{name:"chevron-down",size:10,className:a.chevron})]})});return t(w,{children:[Z,l&&Y(t("div",{ref:Q.setFloating,className:a.menu,style:M,role:"menu",...I(),onMouseDown:e=>e.stopPropagation(),onClick:e=>{e.preventDefault(),e.stopPropagation()},children:[t("div",{className:a.menuTitle,children:"Queue episodes"}),t("button",{className:a.menuItem,role:"menuitem",type:"button",disabled:!o&&!g,onClick:e=>{e.stopPropagation(),O()},children:[t(u,{name:"plus",size:11}),t("span",{children:o?`+1 — EP ${B}`:`+1 — EP ${g||"?"}`})]}),t("button",{className:a.menuItem,role:"menuitem",type:"button",disabled:!o,onClick:e=>{e.stopPropagation(),U()},children:[t(u,{name:"plus",size:11}),t("span",{children:o?`+3 — EP ${B}${s.length>1?`-${V}`:""}`:"+3"})]}),t("button",{className:a.menuItem,role:"menuitem",type:"button",disabled:!o,onClick:e=>{e.stopPropagation(),G()},children:[t(u,{name:"plus",size:11}),t("span",{children:["All Remaining",N?"":` (${Math.max(s.length,0)})`]})]}),!N&&s.length===0&&t("div",{className:a.menuEmpty,children:d?"All episodes are already queued":"No remaining unwatched episodes"}),d&&t("button",{className:`${a.menuItem} ${a.removeItem}`,role:"menuitem",type:"button",onClick:e=>{e.stopPropagation(),L()},children:[t(u,{name:"times",size:11}),t("span",{children:["Remove from Queue",m.length>0?` (${m.length})`:""]})]})]}),document.body)]})};export{qe as Q,Pe as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as s,u as n,a as Y}from"./vendor-core-DfaOB3Rn.js";import{I as P}from"./vendor-icons-DrybRNxP.js";import{d as L,f as z}from"./index-
|
|
1
|
+
import{g as s,u as n,a as Y}from"./vendor-core-DfaOB3Rn.js";import{I as P}from"./vendor-icons-DrybRNxP.js";import{d as L,f as z}from"./index-BTnhzofk.js";const F="_section_1pwqc_1",O="_header_1pwqc_10",j="_headerToggle_1pwqc_20",G="_headerActions_1pwqc_34",J="_title_1pwqc_40",K="_badge_1pwqc_50",V="_clearBtn_1pwqc_65",W="_nextBtn_1pwqc_83",Z="_list_1pwqc_101",ee="_item_1pwqc_114",ne="_active_1pwqc_134",te="_dragging_1pwqc_142",re="_dragHandle_1pwqc_149",ce="_thumbnail_1pwqc_167",ae="_meta_1pwqc_175",oe="_name_1pwqc_182",se="_episode_1pwqc_204",ie="_iconBtn_1pwqc_210",r={section:F,header:O,headerToggle:j,headerActions:G,title:J,badge:K,clearBtn:V,nextBtn:W,list:Z,item:ee,active:ne,dragging:te,dragHandle:re,thumbnail:ce,meta:ae,name:oe,episode:se,iconBtn:ie},le=({item:c,isActive:T,index:m,onRemove:D,onTouchPointerDown:v,onTouchPointerMove:x,onTouchPointerUp:q,onTouchPointerCancel:I,shouldIgnoreClick:_,onDragStart:B,onDragEnter:f,onDragEnd:o,isDragging:w})=>{const a=Y(),{titlePreference:i}=L(),l=c[i]||c.name||"Unknown show";return n("div",{"data-queue-index":m,className:`${r.item} ${T?r.active:""} ${w?r.dragging:""}`,draggable:!0,onDragStart:B,onDragEnter:f,onDragOver:u=>u.preventDefault(),onDragEnd:o,onPointerDown:u=>v(m,u),onPointerMove:x,onPointerUp:q,onPointerCancel:I,children:[n("button",{className:r.dragHandle,type:"button","aria-label":"Drag queue item",children:n(P,{name:"bars"})}),n("img",{className:r.thumbnail,src:z(c.thumbnail||"",72,96),alt:l,loading:"lazy",decoding:"async",onError:u=>{u.currentTarget.src="/placeholder.svg"}}),n("div",{className:r.meta,children:[n("button",{className:r.name,type:"button",onClick:()=>{_()||a(`/watch/${c.showId}/${c.episodeNumber}`)},children:l}),n("div",{className:r.episode,children:["Episode ",c.episodeNumber]})]}),n("button",{className:r.iconBtn,type:"button",onClick:()=>{_()||D(c)},"aria-label":`Remove ${l} episode ${c.episodeNumber} from queue`,children:n(P,{name:"times"})})]})},he=({title:c="Queue",eyebrow:T,items:m,currentShowId:D,currentEpisode:v,onRemove:x,onReorder:q,onNextQueue:I,onClear:_,showClearAll:B=!1,defaultExpanded:f=!0})=>{const[o,w]=s.useState([]),[a,i]=s.useState(null),[l,u]=s.useState(f),b=s.useRef(null),N=s.useRef(null),d=s.useRef(null),p=s.useRef(!1),R=s.useRef(!1);s.useEffect(()=>{w(m)},[m]),s.useEffect(()=>{u(f)},[f]);const E=e=>{i(e)},$=e=>{if(a===null||a===e)return;const t=[...o],h=t[a];t.splice(a,1),t.splice(e,0,h),i(e),w(t)},k=()=>{a!==null&&q(o.map(e=>({id:e.id,showId:e.showId,episodeNumber:e.episodeNumber}))),i(null)},C=(e=!1)=>{d.current!==null&&(window.clearTimeout(d.current),d.current=null),e&&p.current&&(q(o.map(t=>({id:t.id,showId:t.showId,episodeNumber:t.episodeNumber}))),R.current=!0,window.setTimeout(()=>{R.current=!1},0)),b.current=null,N.current=null,p.current=!1,i(null)},A=(e,t)=>{if(t.pointerType==="mouse")return;const h=t.currentTarget,g=t.pointerId;b.current=t.pointerId,N.current={x:t.clientX,y:t.clientY},d.current!==null&&window.clearTimeout(d.current),d.current=window.setTimeout(()=>{p.current=!0,i(e);try{h.setPointerCapture(g)}catch{}},220)},Q=e=>{if(e.pointerType==="mouse"||b.current!==e.pointerId)return;if(!p.current&&N.current){const H=Math.abs(e.clientX-N.current.x),X=Math.abs(e.clientY-N.current.y);(H>8||X>8)&&C(!1);return}if(!p.current)return;e.preventDefault();const h=document.elementFromPoint(e.clientX,e.clientY)?.closest?.("[data-queue-index]"),g=h?Number(h.dataset.queueIndex):NaN;if(Number.isNaN(g)||a===null||g===a)return;const y=[...o],U=y[a];y.splice(a,1),y.splice(g,0,U),i(g),w(y)},S=e=>{e.pointerType!=="mouse"&&b.current===e.pointerId&&C(p.current)},M=e=>{e.pointerType!=="mouse"&&b.current===e.pointerId&&C(!1)};return o.length===0?null:n("section",{className:r.section,children:[n("div",{className:r.header,children:[n("button",{className:r.headerToggle,type:"button",onClick:()=>u(e=>!e),"aria-expanded":l,"aria-label":l?`Collapse ${c}`:`Expand ${c}`,children:[n("span",{className:r.title,children:[n("span",{className:"title-stack",children:[T&&n("div",{className:"section-eyebrow",children:T}),n("span",{children:c})]}),n("span",{className:r.badge,children:o.length})]}),l?n(P,{name:"chevron-up"}):n(P,{name:"chevron-down"})]}),B&&_&&n("div",{className:r.headerActions,children:[I&&o.length>1&&n("button",{className:r.nextBtn,type:"button",onClick:I,children:"Next"}),n("button",{className:r.clearBtn,type:"button",onClick:_,children:"Clear All"})]})]}),l&&n("div",{className:r.list,children:o.map((e,t)=>n(le,{item:e,isActive:e.showId===D&&e.episodeNumber===v,index:t,onRemove:x,onTouchPointerDown:A,onTouchPointerMove:Q,onTouchPointerUp:S,onTouchPointerCancel:M,shouldIgnoreClick:()=>R.current,onDragStart:()=>E(t),onDragEnter:()=>$(t),onDragEnd:k,isDragging:a===t},e.id))})]})};export{he as Q,r as s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as h,A as F,h as y,g as se,u as e,S as P,$ as J,T as K}from"./vendor-core-DfaOB3Rn.js";import{I as o}from"./vendor-icons-DrybRNxP.js";import{b as Z}from"./vendor-query-BBT5_sHx.js";import{h as x,t as G,P as re}from"./index-
|
|
1
|
+
import{d as h,A as F,h as y,g as se,u as e,S as P,$ as J,T as K}from"./vendor-core-DfaOB3Rn.js";import{I as o}from"./vendor-icons-DrybRNxP.js";import{b as Z}from"./vendor-query-BBT5_sHx.js";import{h as x,t as G,P as re}from"./index-BTnhzofk.js";import{a}from"./Asmr.module-CdWlioTY.js";import{r as i}from"./Radio.module-DGSZLpKM.js";import{p as L}from"./page.module-C1MlZzf3.js";const ee=300*1e3,le="https://cdn.listen.moe/covers/";function z(n){return n?n.startsWith("http")?n:`${le}${n}`:null}function oe(n){return n?z(n.albums[0]?.image)||z(n.artists[0]?.image)||z(n.sources[0]?.image):null}function U(n){return n?n.artists.map(s=>s.nameRomaji||s.name).join(", "):""}const ie=()=>{const n=x();return Z({...n.radio.stations.queryOptions(),staleTime:ee})},ce=n=>{const s=x();return Z({...s.radio.search.queryOptions({q:n}),enabled:n.trim().length>0,staleTime:ee})},X={song:null,lastPlayed:[],listeners:0,startTime:null},de=n=>{const[s,p]=h(X),[l,c]=h(!1),d=F(null);return y(()=>{if(p(X),c(!1),!n)return;let u=null,f=!1;try{u=new WebSocket(n)}catch{return}return u.onopen=()=>{f||c(!0)},u.onmessage=v=>{try{const m=JSON.parse(v.data);if(m.op===0){const N=m.d?.heartbeat||35e3;d.current&&window.clearInterval(d.current),d.current=window.setInterval(()=>{u&&u.readyState===WebSocket.OPEN&&u.send(JSON.stringify({op:9}))},N)}else m.op===1&&p({song:m.d?.song||null,lastPlayed:m.d?.lastPlayed||[],listeners:m.d?.listeners||0,startTime:m.d?.startTime||null})}catch{}},u.onclose=()=>{f||c(!1)},()=>{f=!0,d.current&&window.clearInterval(d.current),d.current=null,u&&u.close()}},[n]),{nowPlaying:s,connected:l}};function Y(n){if(!n)return"";const s=Math.max(0,Math.floor((Date.now()-new Date(n).getTime())/1e3)),p=Math.floor(s/60),l=s%60;return`${p}:${String(l).padStart(2,"0")}`}const me=({station:n,nowPlaying:s,connected:p,expanded:l,onStationStep:c,onExpandedChange:d,onClose:u})=>{const f=F(null),[v,m]=h(!1),[N,V]=h(!0),[S,I]=h(!1),[T,k]=h(!0),[A,E]=h(""),[b,D]=h(()=>{const t=parseFloat(localStorage.getItem("radioVolume")||"");return Number.isFinite(t)?t:1}),r=F(""),g=F(b);g.current=b,r.current||(r.current=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`radio-${Date.now()}-${Math.random().toString(36).slice(2)}`);const w=s.song,C=oe(w)||n.favicon||null,[B,W]=h(!1);y(()=>{W(!1)},[C]);const M=B?null:C,q=!!M,R=w?`${U(w)} — ${w.title}`:n.name;y(()=>{const t=f.current;if(t)return m(!1),t.src=n.streamUrl,t.load(),t.volume=g.current,t.play().catch(()=>m(!1)),()=>{t.removeAttribute("src")}},[n.id,n.streamUrl]),y(()=>{const t=f.current;t&&(t.volume=b)},[b]),y(()=>{if(l)return document.body.classList.add("asmr-player-open"),()=>document.body.classList.remove("asmr-player-open")},[l]),y(()=>{l&&k(!0)},[l]);const te=t=>t?Math.max(0,Math.floor((Date.now()-new Date(t).getTime())/1e3)):0,H=se.useCallback(t=>{n&&(G.discord.radioPresence.mutate({title:R,stationLabel:n.name,isPlaying:t,thumbnail:M||"",currentTime:te(s.startTime),sessionId:r.current}).catch(()=>{}),G.discord.heartbeat.mutate({sessionId:r.current}).catch(()=>{}))},[n,R,M,s.startTime]);y(()=>{H(v)},[H,v,n.id,R,l]),y(()=>{if(!v)return;const t=window.setInterval(()=>H(!0),15e3);return()=>window.clearInterval(t)},[v,H]),y(()=>{const t=r.current,$=()=>re(t),O=()=>$(),_=()=>{document.visibilityState==="hidden"&&$()};return window.addEventListener("pagehide",O),window.addEventListener("beforeunload",O),document.addEventListener("visibilitychange",_),()=>{window.removeEventListener("pagehide",O),window.removeEventListener("beforeunload",O),document.removeEventListener("visibilitychange",_),$()}},[]),y(()=>{if(!s.startTime){E("");return}E(Y(s.startTime));const t=window.setInterval(()=>E(Y(s.startTime)),1e3);return()=>window.clearInterval(t)},[s.startTime,s.song?.id]),y(()=>{if(!l)return;const t=$=>{$.key==="Escape"&&(S?I(!1):d(!1))};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[l,S,d]);const ae=()=>{const t=f.current;t&&(t.paused?(t.load(),t.play().catch(()=>{})):t.pause())},ne=e(P,{children:[e("div",{className:a.playerButtons,children:[e("button",{className:a.playerBtn,onClick:()=>c(-1),"aria-label":"Previous station",children:e(o,{name:"step-backward"})}),e("button",{className:`${a.playerBtn} ${a.playBtn}`,onClick:ae,"aria-label":v?"Pause":"Play",children:v?e(o,{name:"pause"}):e(o,{name:"play"})}),e("button",{className:a.playerBtn,onClick:()=>c(1),"aria-label":"Next station",children:e(o,{name:"step-forward"})})]}),e("div",{className:a.seekRow,children:[e("span",{className:i.liveBadge,children:[e(o,{name:"broadcast-tower",size:10})," LIVE"]}),A&&e("span",{className:a.timeLabel,children:A}),p&&s.listeners>0&&e("span",{className:a.timeLabel,children:[s.listeners," listening"]}),!p&&n.source==="listen.moe"&&e("span",{className:a.timeLabel,children:"connecting…"})]})]}),j=e(P,{children:[e("button",{className:`${a.playerBtn} ${a.playerToggle}`,onClick:()=>d(!l),"aria-label":l?"Minimize player":"Expand player",title:l?"Minimize to browse":"Expand",children:l?e(o,{name:"chevron-down"}):e(o,{name:"chevron-up"})}),e("div",{className:a.playerInfo,children:[e("p",{className:a.playerTitle,title:R,children:R}),e("p",{className:a.playerTrack,children:n.name})]}),e("div",{className:a.playerControls,children:ne}),e("div",{className:a.playerRight,children:[b===0?e(o,{name:"volume-mute",className:a.volumeIcon}):b<.5?e(o,{name:"volume-down",className:a.volumeIcon}):e(o,{name:"volume-up",className:a.volumeIcon}),e("input",{className:a.volumeBar,type:"range",min:0,max:1,step:.01,value:b,onChange:t=>{const $=parseFloat(t.target.value);D($),localStorage.setItem("radioVolume",String($))},style:{"--volume-percent":`${b*100}%`},"aria-label":"Volume"})]}),e("div",{className:a.playerActions,children:[l&&q&&e("button",{className:a.playerBtn,onClick:()=>V(t=>!t),"aria-label":N?"Hide art":"Show art",title:N?"Hide art":"Show art",children:N?e(o,{name:"eye-slash"}):e(o,{name:"image"})}),l&&s.lastPlayed.length>0&&e("button",{className:`${a.playerBtn} ${S?a.playerBtnActive:""}`,onClick:()=>I(t=>!t),"aria-label":S?"Hide history":"Show history",title:"Recently played",children:e(o,{name:"list-ol"})}),e("button",{className:a.playerBtn,onClick:u,"aria-label":"Close player",children:e(o,{name:"times"})})]})]}),Q=e("audio",{ref:f,preload:"none",onPlay:()=>m(!0),onPause:()=>m(!1)});return l?J(e(P,{children:[Q,e("div",{className:`${a.npOverlay} ${T?"":a.npOverlayControlsHidden}`,children:[e("div",{className:`${a.npStage} ${!N||!q?a.npStageBlank:""}`,onClick:()=>k(t=>!t),children:N&&q&&M&&e("div",{className:i.coverWrap,children:e("img",{src:M,alt:R,loading:"lazy",decoding:"async",draggable:!1,className:i.cover,onError:()=>W(!0)})})}),e("div",{className:`${a.playerBar} ${a.playerBarDocked} ${T?"":a.playerBarDockedHidden}`,onClick:t=>t.stopPropagation(),children:[j,S&&e(P,{children:[e("div",{className:a.npBackdrop,onClick:()=>I(!1)}),e("div",{className:a.chapterPanel,children:s.lastPlayed.map(t=>e("div",{className:a.chapterRow,children:e("span",{className:a.chapterRowLabel,title:`${U(t)} — ${t.title}`,children:[U(t)," — ",t.title]})},t.id))})]})]})]})]}),document.body):J(e(P,{children:[Q,e("div",{className:a.playerBar,children:j})]}),document.body)},Ne=()=>{y(()=>{document.title="Radio - dango"},[]);const[n,s]=h(""),[p,l]=h(""),[c,d]=h(null),[u,f]=h(!0),{data:v,isLoading:m}=ie(),{data:N,isLoading:V}=ce(p),S=K(()=>v?.stations||[],[v]),I=K(()=>N?.stations||[],[N]),T=p?I:S,{nowPlaying:k,connected:A}=de(c?.gateway),E=r=>{d(r),f(!0)},b=r=>{const g=T.length>0?T:S;if(g.length===0||!c)return;const w=g.findIndex(B=>B.id===c.id),C=g[(w<0?0:w+r+g.length)%g.length];d(C)},D=r=>{const g=c?.id===r.id,w=g&&k.song?`${U(k.song)} — ${k.song.title}`:null,C=[r.codec,r.bitrate?`${r.bitrate}k`:"",r.tags].filter(Boolean).join(" · ");return e("button",{className:`${i.stationRow} ${g?i.stationRowActive:""}`,onClick:()=>E(r),children:[r.favicon?e("img",{src:r.favicon,alt:"",className:i.stationThumb,loading:"lazy",decoding:"async",onError:B=>{B.target.style.display="none"}}):e("span",{className:i.stationThumbPlaceholder,children:e(o,{name:"broadcast-tower"})}),e("span",{className:i.stationMeta,children:[e("span",{className:i.stationName,children:r.name}),C&&e("span",{className:i.stationSub,children:C})]}),w&&e("span",{className:i.stationNowPlaying,children:w})]},r.id)};return e("div",{className:`${L.page} ${c?L.pageWithPlayer:""}`,children:[e("div",{className:L.header,children:[e("h1",{className:L.pageTitle,children:[e(o,{name:"broadcast-tower"})," Radio"]}),e("form",{className:L.searchForm,onSubmit:r=>{r.preventDefault(),l(n)},children:[e("input",{className:L.searchInput,value:n,onChange:r=>s(r.target.value),placeholder:"Search stations (anime, j-pop, k-pop…)","aria-label":"Search radio stations"}),e("button",{className:L.searchBtn,type:"submit","aria-label":"Search",children:e(o,{name:"search"})})]})]}),p?e(P,{children:[e("h2",{className:i.sectionTitle,children:["Results for “",p,"”"]}),V?e("p",{className:a.statusMsg,children:"Searching…"}):I.length===0?e("p",{className:a.statusMsg,children:"No stations found."}):e("div",{className:i.stationList,children:I.map(D)})]}):e(P,{children:[e("h2",{className:i.sectionTitle,children:"Featured"}),m?e("p",{className:a.statusMsg,children:"Loading…"}):e("div",{className:i.stationList,children:S.map(D)})]}),c&&e(me,{station:c,nowPlaying:k,connected:A,expanded:u,onStationStep:b,onExpandedChange:f,onClose:()=>d(null)})]})};export{Ne as default};
|
|
@@ -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-Dp8DjyXB.js";import{L as F}from"./LibraryListPage-CWI7hgUh.js";import{u as _,M as z}from"./useMangaPopup-CzsCbndG.js";import{M as D}from"./MangaResetProgressModal-P3oY4_14.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 h,m as Z,i as j,b as J,c as W}from"./useMangaLibrary-BVQRhsFh.js";import"./vendor-ui-3qrARCPr.js";import"./useIsMobile-Dvx1uJ82.js";import"./vendor-icons-DrybRNxP.js";import"./index-BTnhzofk.js";import"./vendor-query-BBT5_sHx.js";import"./SkeletonGrid-BZHKk1I6.js";import"./ErrorMessage-DAxegITP.js";import"./Watchlist.module-XGtVQr1d.js";import"./usePopup-DS9jMzp6.js";import"./ResetProgressModal--N60WWCB.js";const X=["All","Continue Reading",...h],R=24,y=e=>({provider:e.provider,mangaId:e.mangaId,title:e.title,altTitle:e.altTitle,cover:e.cover,contentRating:e.contentRating,readTarget:e.detailTarget,progressLabel:e.progressLabel});function ba(){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,R),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.status,contentRating:a.contentRating||void 0,chapterLabel:a.chapterNumber?`Ch. ${a.chapterNumber}`:void 0,progressPercent:l>0?o/l*100:0,progressLabel:a.chapterNumber&&l>0?`Ch. ${a.chapterNumber} · p. ${o}/${l}`:void 0,detailTarget:a.chapterId&&a.provider&&a.mangaId?`/manga/${a.provider}/${encodeURIComponent(a.mangaId)}/read?chapter=${encodeURIComponent(a.chapterId)}`:`/manga/${a.provider}/${encodeURIComponent(a.mangaId)}`}}):(n.data?.data??[]).map(a=>({key:a.id,libId:a.id,provider:a.provider,mangaId:a.mangaId,title:a.title,altTitle:a.altTitle,cover:a.cover||"",status:a.status,contentRating:a.contentRating||void 0,chapterLabel:a.lastChapterNumber?`Ch. ${a.lastChapterNumber}`:void 0,progressPercent:void 0,progressLabel:void 0,detailTarget:`/manga/${a.provider}/${encodeURIComponent(a.mangaId)}`})),[r,s.data,n.data]),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:[...h],entries:S,total:A,isLoading:$,error:N,page:g,pageSize:R,onPageChange:p,emptyTitle:"Your reading list is looking a bit lonely",emptyFilteredText:"No titles match this filter.",emptyAllText:"Let's find something to read!",browseLabel:"Browse Manga",browseTarget:"/manga",removeListLabel:"Remove from Reading List",listNoun:"reading list",skipConfirmKey:"mangaSkipRemoveConfirmation",onBulkStatus:(a,o)=>f.mutate({ids:a,status:o}),onBulkRemove:a=>{r?B.mutate(a):P.mutate(a)},onStatusChange:(a,o)=>T.mutate({id:a,status:o}),onRemoveItem:a=>I.mutate(a),renderCard:a=>i(x,{item:{id:a.libId,title:a.title,...W({title:a.title,altTitle:a.altTitle}),thumbnail:J(a.provider,a.cover),chapterBadge:a.chapterLabel??null,isAdult:j(a)},linkTo:a.detailTarget,hoverIcon:"book",progress:a.progressPercent!==void 0&&a.progressLabel?{percent:a.progressPercent,label:a.progressLabel}:void 0,showProgress:r,display:{elements:{poster:{typeBadge:!1,chapterBadge:!0,adultBadge:!0},info:{title:!0,mobileBadges:!0,progress:!0,meta:!1}}},onRemove:r?()=>u(a):void 0,onOpenDetails:o=>k(o,y(a)),onPopupHoverIntent:o=>o?m():c(),rawThumbnail:!0}),modals:i(E,{children:[t&&t.data.provider&&i(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{ba as default};
|
package/client/dist/assets/{ResetProgressModal-CuoM4S_P.js → ResetProgressModal--N60WWCB.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as e}from"./vendor-core-DfaOB3Rn.js";import{M as r,B as n}from"./index-
|
|
1
|
+
import{u as e}from"./vendor-core-DfaOB3Rn.js";import{M as r,B as n}from"./index-BTnhzofk.js";const p=({isOpen:t,itemName:c,progressKind:i,listLabel:s,alsoRemove:a,onAlsoRemoveChange:d,onClose:o,onConfirm:l})=>e(r,{isOpen:t,onClose:o,title:"Reset Progress",children:[e(r.Body,{children:[e("p",{children:["Are you sure you want to remove your ",i,' progress for "',c,'"?']}),e("label",{children:[e("input",{type:"checkbox",checked:a,onChange:h=>d(h.target.checked)}),"Also remove from ",s]})]}),e(r.Actions,{children:[e(n,{variant:"secondary",onClick:o,children:"No"}),e(n,{variant:"danger",onClick:l,children:"Yes"})]})]});export{p as R};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as R,p as me,a as ge,d as o,A as ve,g as fe,u as a}from"./vendor-core-DfaOB3Rn.js";import{I as L}from"./vendor-icons-DrybRNxP.js";import{P as ee,S as Le}from"./SkeletonGrid-CYZ3cstC.js";import{A as Ae}from"./AnimeCard-Cwc6Z9rO.js";import{t as be,u as ye,v as Se,N as ae,B as w,O as Ne}from"./index-C93G341i.js";import{E as Ce}from"./ErrorMessage-DAxegITP.js";import{s as t}from"./Search.module-CMEai-B-.js";import"./useAnimeInfoData-gz0XXrYm.js";import"./vendor-query-BBT5_sHx.js";import"./QueueOptionsButton-BMl804vN.js";import"./vendor-ui-3qrARCPr.js";import"./MediaCard-cSWL_NlR.js";import"./useIsMobile-Dvx1uJ82.js";const Te=[{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"}],Ee=[{value:"ALL",label:"All Seasons"},{value:"Winter",label:"Winter"},{value:"Spring",label:"Spring"},{value:"Summer",label:"Summer"},{value:"Fall",label:"Fall"}],Ie=[{value:"ALL",label:"All Countries"},{value:"JP",label:"Japan"},{value:"CN",label:"China"}],De=[{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"}],Pe=[{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 Ve(){R(()=>{document.title="Search - dango"},[]);const[r,te]=me(),le=ge(),[h,k]=o(r.get("query")||""),[p,_]=o(parseInt(r.get("page")||"1")),[u,A]=o(r.get("type")||"ALL"),[m,b]=o(r.get("season")||"ALL"),[g,y]=o(r.get("year")||"ALL"),[B,E]=o(r.get("country")||"ALL"),[G,ne]=o(r.get("provider")||"anilist"),[Y,I]=o(r.get("sortBy")||"POPULARITY_DESC"),[U,D]=o(r.get("status")||""),[S,re]=o(!1),[se,F]=o(null);R(()=>{let e=!1;return be.data.anilistStatus.query().then(n=>{e||F(n.available)}).catch(()=>{e||F(!0)}),()=>{e=!0}},[]);const{lowEndMode:ie}=ye(),P=ve(null),{data:oe}=Se(),M=oe?.genres||[],[v,N]=o(()=>{const e={},n=r.get("genres")?.split(",").map(l=>l.trim()).filter(Boolean)||[],s=r.get("excludeGenres")?.split(",").map(l=>l.trim()).filter(Boolean)||[];return n.forEach(l=>l&&(e[l]="include")),s.forEach(l=>l&&(e[l]="exclude")),e}),$=new URLSearchParams(r);$.delete("page");const V=$.toString(),{data:f=[],isLoading:C,isError:ce,error:ue}=ae(V,p,14),{data:j}=ae(V,p+1,14),[x,de]=o(!1),T=fe.useMemo(()=>G==="anilist"&&u==="ADULT"||x?f:f.filter(e=>!(e.isAdult||e.rating==="R+"||e.rating==="Rx"||e.rating?.includes("17+"))),[f,x,G,u]);R(()=>{k(r.get("query")||""),A(r.get("type")||"ALL"),b(r.get("season")||"ALL"),y(r.get("year")||"ALL"),E(r.get("country")||"ALL"),ne(r.get("provider")||"anilist"),I(r.get("sortBy")||"POPULARITY_DESC"),D(r.get("status")||""),_(parseInt(r.get("page")||"1"));const e={},n=r.get("genres")?.split(",").map(l=>l.trim()).filter(Boolean)||[],s=r.get("excludeGenres")?.split(",").map(l=>l.trim()).filter(Boolean)||[];n.forEach(l=>l&&(e[l]="include")),s.forEach(l=>l&&(e[l]="exclude")),N(e)},[r]);const c=(e=1,n={})=>{Ne();const s=n.type??u,l=n.status??U,q=n.season??m,H=n.year??g,J=n.country??B,K=n.sort??Y,Q=n.genreState??v,pe=n.showMature??x,i=new URLSearchParams;h.trim()&&i.set("query",h.trim()),s!=="ALL"&&i.set("type",s),l&&i.set("status",l),q!=="ALL"&&i.set("season",q),H!=="ALL"&&i.set("year",H),J!=="ALL"&&i.set("country",J),K!=="POPULARITY_DESC"&&i.set("sortBy",K);const X=Object.entries(Q).filter(([,d])=>d==="include").map(([d])=>d),Z=Object.entries(Q).filter(([,d])=>d==="exclude").map(([d])=>d);X.length>0&&i.set("genres",X.join(",")),Z.length>0&&i.set("excludeGenres",Z.join(",")),s!=="ADULT"&&!pe&&i.set("adult","false"),i.set("provider","anilist"),e>1&&i.set("page",e.toString()),te(i),e!==p&&_(e)},W=e=>{if(c(e),P.current){const n=P.current.getBoundingClientRect().top+window.scrollY-100;window.scrollTo({top:n,behavior:"smooth"})}},O=new Date().getFullYear(),he=[{value:"ALL",label:"All Years"},...Array.from({length:O-1980+1},(e,n)=>({value:String(O-n),label:String(O-n)}))],z=f.length>=14&&j&&j.length>0;return a("div",{className:"page-container",children:[a("div",{className:t.header,children:[a("h1",{className:t.pageTitle,children:"Search Anime"}),a("p",{className:t.pageSubtitle,children:"Search through thousands of titles and discover your next favorite"})]}),a("div",{className:t.filterContainer,children:[a("div",{className:t.searchBarWrapper,children:[a("div",{className:t.inputIconWrapper,children:[a(L,{name:"search",className:t.searchIcon}),a("input",{type:"text","data-virtual-keyboard":"true",className:t.searchInput,placeholder:"Search by title, character, or studio...",value:h,onInput:e=>k(e.currentTarget.value),onKeyDown:e=>e.key==="Enter"&&c()})]}),a("div",{className:t.searchActions,children:[a(w,{onClick:()=>c(),className:t.searchBtn,children:"Search"}),a("button",{className:`${t.filterToggleBtn} ${S?t.active:""}`,onClick:()=>re(!S),children:[a(L,{name:"filter",size:14}),a("span",{children:"Filters"}),S?a(L,{name:"chevron-up",size:12}):a(L,{name:"chevron-down",size:12})]})]})]}),a("div",{className:`${t.advancedFilters} ${S?t.show:""}`,children:[a("div",{className:t.filterDivider}),a("div",{className:t.filterGrid,children:[a("div",{className:t.filterItem,children:[a("label",{children:"Type"}),a("select",{value:u,onChange:e=>{if(e.currentTarget.value==="ADULT"){le("/mature?provider=mal");return}A(e.currentTarget.value)},children:Te.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Status"}),a("select",{value:U,onChange:e=>D(e.currentTarget.value),children:[a("option",{value:"",children:"All Status"}),Pe.map(e=>a("option",{value:e.value,children:e.label},e.value))]})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Season"}),a("select",{value:m,onChange:e=>b(e.currentTarget.value),children:Ee.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Year"}),a("select",{value:g,onChange:e=>y(e.currentTarget.value),children:he.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:["Country",se===!1&&a("span",{style:{display:"block",fontSize:"0.75rem",color:"var(--text-muted)",fontWeight:400},children:"AniList only — ignored by fallback providers"})]}),a("select",{value:B,onChange:e=>E(e.currentTarget.value),children:Ie.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Sort By"}),a("select",{value:Y,onChange:e=>I(e.currentTarget.value),children:De.map(e=>a("option",{value:e.value,children:e.label},e.value))})]})]}),M.length>0&&a("div",{className:t.genreSection,children:[a("label",{className:t.genreLabel,children:"Genres"}),a("div",{className:t.genreContainer,children:M.map(e=>a("button",{className:`${t.genreButton} ${t[v[e]||""]}`,onClick:()=>{N(n=>{const s=n[e],l={...n};return s==="include"?l[e]="exclude":s==="exclude"?delete l[e]:l[e]="include",l})},children:e},e))})]}),a("div",{className:t.filterActions,children:[a(w,{variant:"secondary",onClick:()=>{N({}),A("ALL"),b("ALL"),y("ALL"),E("ALL"),I("POPULARITY_DESC"),D(""),de(!1),c(1,{type:"ALL",status:"",season:"ALL",year:"ALL",country:"ALL",sort:"POPULARITY_DESC",genreState:{},showMature:!1})},children:"Reset All"}),a(w,{onClick:()=>c(),className:t.applyBtn,children:"Apply Filters"})]})]})]}),ce&&a(Ce,{message:ue?.message||"Error"}),(u!=="ALL"||m!=="ALL"||g!=="ALL"||Object.keys(v).length>0)&&a("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center",marginBottom:"1.5rem"},children:[a("span",{style:{fontSize:"0.8rem",color:"var(--text-muted)",fontWeight:600},children:"Active Filters:"}),u!=="ALL"&&a("span",{className:"badge badge-secondary",style:{display:"inline-flex",alignItems:"center",gap:"6px"},children:["Type: ",u,a("button",{onClick:e=>{e.stopPropagation(),e.preventDefault(),A("ALL"),c(1,{type:"ALL"})},style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"✕"})]}),m!=="ALL"&&a("span",{className:"badge badge-secondary",style:{display:"inline-flex",alignItems:"center",gap:"6px"},children:["Season: ",m,a("button",{onClick:e=>{e.stopPropagation(),e.preventDefault(),b("ALL"),c(1,{season:"ALL"})},style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"✕"})]}),g!=="ALL"&&a("span",{className:"badge badge-secondary",style:{display:"inline-flex",alignItems:"center",gap:"6px"},children:["Year: ",g,a("button",{onClick:e=>{e.stopPropagation(),e.preventDefault(),y("ALL"),c(1,{year:"ALL"})},style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"✕"})]}),Object.entries(v).map(([e,n])=>a("span",{className:`badge ${n==="include"?"badge-primary":"badge-danger"}`,style:{display:"inline-flex",alignItems:"center",gap:"6px"},children:[n==="include"?`+ ${e}`:`- ${e}`,a("button",{onClick:s=>{s.stopPropagation(),s.preventDefault();const l={...v};delete l[e],N(l),c(1,{genreState:l})},style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"✕"})]},e))]}),a("div",{className:t.resultsHeader,ref:P,children:[a("h2",{className:t.resultsTitle,children:h?`Search Results for "${h}"`:"Discover Anime"}),T.length>0&&a(ee,{page:p,canGoNext:z,onChange:W,isLoading:C})]}),a("div",{className:`${t.resultsGrid} ${ie?t.lowEnd:""}`,children:C?a(Le,{}):T.map(e=>a(Ae,{anime:e},e._id))}),!C&&T.length===0&&a("div",{className:t.noResults,children:[a(L,{name:"search",size:48,className:t.noResultsIcon}),a("h3",{children:"No results found"}),a("p",{children:"Try adjusting your search or filters to find what you're looking for."})]}),T.length>0&&a("div",{className:t.bottomPagination,children:a(ee,{page:p,canGoNext:z,onChange:W,isLoading:C,variant:"labeled"})})]})}export{Ve as default};
|
|
1
|
+
import{h as R,p as me,a as ge,d as o,A as ve,g as fe,u as a}from"./vendor-core-DfaOB3Rn.js";import{I as L}from"./vendor-icons-DrybRNxP.js";import{P as ee,S as Le}from"./SkeletonGrid-BZHKk1I6.js";import{A as Ae}from"./AnimeCard-JkXG40Es.js";import{t as be,u as ye,v as Se,N as ae,B as w,O as Ne}from"./index-BTnhzofk.js";import{E as Ce}from"./ErrorMessage-DAxegITP.js";import{s as t}from"./Search.module-CMEai-B-.js";import"./useAnimeInfoData-Cvmso3IK.js";import"./vendor-query-BBT5_sHx.js";import"./QueueOptionsButton-T1J37IZT.js";import"./vendor-ui-3qrARCPr.js";import"./MediaCard-Dp8DjyXB.js";import"./useIsMobile-Dvx1uJ82.js";const Te=[{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"}],Ee=[{value:"ALL",label:"All Seasons"},{value:"Winter",label:"Winter"},{value:"Spring",label:"Spring"},{value:"Summer",label:"Summer"},{value:"Fall",label:"Fall"}],Ie=[{value:"ALL",label:"All Countries"},{value:"JP",label:"Japan"},{value:"CN",label:"China"}],De=[{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"}],Pe=[{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 Ve(){R(()=>{document.title="Search - dango"},[]);const[r,te]=me(),le=ge(),[h,k]=o(r.get("query")||""),[p,_]=o(parseInt(r.get("page")||"1")),[u,A]=o(r.get("type")||"ALL"),[m,b]=o(r.get("season")||"ALL"),[g,y]=o(r.get("year")||"ALL"),[B,E]=o(r.get("country")||"ALL"),[G,ne]=o(r.get("provider")||"anilist"),[Y,I]=o(r.get("sortBy")||"POPULARITY_DESC"),[U,D]=o(r.get("status")||""),[S,re]=o(!1),[se,F]=o(null);R(()=>{let e=!1;return be.data.anilistStatus.query().then(n=>{e||F(n.available)}).catch(()=>{e||F(!0)}),()=>{e=!0}},[]);const{lowEndMode:ie}=ye(),P=ve(null),{data:oe}=Se(),M=oe?.genres||[],[v,N]=o(()=>{const e={},n=r.get("genres")?.split(",").map(l=>l.trim()).filter(Boolean)||[],s=r.get("excludeGenres")?.split(",").map(l=>l.trim()).filter(Boolean)||[];return n.forEach(l=>l&&(e[l]="include")),s.forEach(l=>l&&(e[l]="exclude")),e}),$=new URLSearchParams(r);$.delete("page");const V=$.toString(),{data:f=[],isLoading:C,isError:ce,error:ue}=ae(V,p,14),{data:j}=ae(V,p+1,14),[x,de]=o(!1),T=fe.useMemo(()=>G==="anilist"&&u==="ADULT"||x?f:f.filter(e=>!(e.isAdult||e.rating==="R+"||e.rating==="Rx"||e.rating?.includes("17+"))),[f,x,G,u]);R(()=>{k(r.get("query")||""),A(r.get("type")||"ALL"),b(r.get("season")||"ALL"),y(r.get("year")||"ALL"),E(r.get("country")||"ALL"),ne(r.get("provider")||"anilist"),I(r.get("sortBy")||"POPULARITY_DESC"),D(r.get("status")||""),_(parseInt(r.get("page")||"1"));const e={},n=r.get("genres")?.split(",").map(l=>l.trim()).filter(Boolean)||[],s=r.get("excludeGenres")?.split(",").map(l=>l.trim()).filter(Boolean)||[];n.forEach(l=>l&&(e[l]="include")),s.forEach(l=>l&&(e[l]="exclude")),N(e)},[r]);const c=(e=1,n={})=>{Ne();const s=n.type??u,l=n.status??U,q=n.season??m,H=n.year??g,J=n.country??B,K=n.sort??Y,Q=n.genreState??v,pe=n.showMature??x,i=new URLSearchParams;h.trim()&&i.set("query",h.trim()),s!=="ALL"&&i.set("type",s),l&&i.set("status",l),q!=="ALL"&&i.set("season",q),H!=="ALL"&&i.set("year",H),J!=="ALL"&&i.set("country",J),K!=="POPULARITY_DESC"&&i.set("sortBy",K);const X=Object.entries(Q).filter(([,d])=>d==="include").map(([d])=>d),Z=Object.entries(Q).filter(([,d])=>d==="exclude").map(([d])=>d);X.length>0&&i.set("genres",X.join(",")),Z.length>0&&i.set("excludeGenres",Z.join(",")),s!=="ADULT"&&!pe&&i.set("adult","false"),i.set("provider","anilist"),e>1&&i.set("page",e.toString()),te(i),e!==p&&_(e)},W=e=>{if(c(e),P.current){const n=P.current.getBoundingClientRect().top+window.scrollY-100;window.scrollTo({top:n,behavior:"smooth"})}},O=new Date().getFullYear(),he=[{value:"ALL",label:"All Years"},...Array.from({length:O-1980+1},(e,n)=>({value:String(O-n),label:String(O-n)}))],z=f.length>=14&&j&&j.length>0;return a("div",{className:"page-container",children:[a("div",{className:t.header,children:[a("h1",{className:t.pageTitle,children:"Search Anime"}),a("p",{className:t.pageSubtitle,children:"Search through thousands of titles and discover your next favorite"})]}),a("div",{className:t.filterContainer,children:[a("div",{className:t.searchBarWrapper,children:[a("div",{className:t.inputIconWrapper,children:[a(L,{name:"search",className:t.searchIcon}),a("input",{type:"text","data-virtual-keyboard":"true",className:t.searchInput,placeholder:"Search by title, character, or studio...",value:h,onInput:e=>k(e.currentTarget.value),onKeyDown:e=>e.key==="Enter"&&c()})]}),a("div",{className:t.searchActions,children:[a(w,{onClick:()=>c(),className:t.searchBtn,children:"Search"}),a("button",{className:`${t.filterToggleBtn} ${S?t.active:""}`,onClick:()=>re(!S),children:[a(L,{name:"filter",size:14}),a("span",{children:"Filters"}),S?a(L,{name:"chevron-up",size:12}):a(L,{name:"chevron-down",size:12})]})]})]}),a("div",{className:`${t.advancedFilters} ${S?t.show:""}`,children:[a("div",{className:t.filterDivider}),a("div",{className:t.filterGrid,children:[a("div",{className:t.filterItem,children:[a("label",{children:"Type"}),a("select",{value:u,onChange:e=>{if(e.currentTarget.value==="ADULT"){le("/mature?provider=mal");return}A(e.currentTarget.value)},children:Te.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Status"}),a("select",{value:U,onChange:e=>D(e.currentTarget.value),children:[a("option",{value:"",children:"All Status"}),Pe.map(e=>a("option",{value:e.value,children:e.label},e.value))]})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Season"}),a("select",{value:m,onChange:e=>b(e.currentTarget.value),children:Ee.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Year"}),a("select",{value:g,onChange:e=>y(e.currentTarget.value),children:he.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:["Country",se===!1&&a("span",{style:{display:"block",fontSize:"0.75rem",color:"var(--text-muted)",fontWeight:400},children:"AniList only — ignored by fallback providers"})]}),a("select",{value:B,onChange:e=>E(e.currentTarget.value),children:Ie.map(e=>a("option",{value:e.value,children:e.label},e.value))})]}),a("div",{className:t.filterItem,children:[a("label",{children:"Sort By"}),a("select",{value:Y,onChange:e=>I(e.currentTarget.value),children:De.map(e=>a("option",{value:e.value,children:e.label},e.value))})]})]}),M.length>0&&a("div",{className:t.genreSection,children:[a("label",{className:t.genreLabel,children:"Genres"}),a("div",{className:t.genreContainer,children:M.map(e=>a("button",{className:`${t.genreButton} ${t[v[e]||""]}`,onClick:()=>{N(n=>{const s=n[e],l={...n};return s==="include"?l[e]="exclude":s==="exclude"?delete l[e]:l[e]="include",l})},children:e},e))})]}),a("div",{className:t.filterActions,children:[a(w,{variant:"secondary",onClick:()=>{N({}),A("ALL"),b("ALL"),y("ALL"),E("ALL"),I("POPULARITY_DESC"),D(""),de(!1),c(1,{type:"ALL",status:"",season:"ALL",year:"ALL",country:"ALL",sort:"POPULARITY_DESC",genreState:{},showMature:!1})},children:"Reset All"}),a(w,{onClick:()=>c(),className:t.applyBtn,children:"Apply Filters"})]})]})]}),ce&&a(Ce,{message:ue?.message||"Error"}),(u!=="ALL"||m!=="ALL"||g!=="ALL"||Object.keys(v).length>0)&&a("div",{style:{display:"flex",flexWrap:"wrap",gap:"8px",alignItems:"center",marginBottom:"1.5rem"},children:[a("span",{style:{fontSize:"0.8rem",color:"var(--text-muted)",fontWeight:600},children:"Active Filters:"}),u!=="ALL"&&a("span",{className:"badge badge-secondary",style:{display:"inline-flex",alignItems:"center",gap:"6px"},children:["Type: ",u,a("button",{onClick:e=>{e.stopPropagation(),e.preventDefault(),A("ALL"),c(1,{type:"ALL"})},style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"✕"})]}),m!=="ALL"&&a("span",{className:"badge badge-secondary",style:{display:"inline-flex",alignItems:"center",gap:"6px"},children:["Season: ",m,a("button",{onClick:e=>{e.stopPropagation(),e.preventDefault(),b("ALL"),c(1,{season:"ALL"})},style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"✕"})]}),g!=="ALL"&&a("span",{className:"badge badge-secondary",style:{display:"inline-flex",alignItems:"center",gap:"6px"},children:["Year: ",g,a("button",{onClick:e=>{e.stopPropagation(),e.preventDefault(),y("ALL"),c(1,{year:"ALL"})},style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"✕"})]}),Object.entries(v).map(([e,n])=>a("span",{className:`badge ${n==="include"?"badge-primary":"badge-danger"}`,style:{display:"inline-flex",alignItems:"center",gap:"6px"},children:[n==="include"?`+ ${e}`:`- ${e}`,a("button",{onClick:s=>{s.stopPropagation(),s.preventDefault();const l={...v};delete l[e],N(l),c(1,{genreState:l})},style:{background:"none",border:"none",color:"inherit",cursor:"pointer"},children:"✕"})]},e))]}),a("div",{className:t.resultsHeader,ref:P,children:[a("h2",{className:t.resultsTitle,children:h?`Search Results for "${h}"`:"Discover Anime"}),T.length>0&&a(ee,{page:p,canGoNext:z,onChange:W,isLoading:C})]}),a("div",{className:`${t.resultsGrid} ${ie?t.lowEnd:""}`,children:C?a(Le,{}):T.map(e=>a(Ae,{anime:e},e._id))}),!C&&T.length===0&&a("div",{className:t.noResults,children:[a(L,{name:"search",size:48,className:t.noResultsIcon}),a("h3",{children:"No results found"}),a("p",{children:"Try adjusting your search or filters to find what you're looking for."})]}),T.length>0&&a("div",{className:t.bottomPagination,children:a(ee,{page:p,canGoNext:z,onChange:W,isLoading:C,variant:"labeled"})})]})}export{Ve as default};
|