import{n as e}from"./rolldown-runtime-CMxvf4Kt.js";import{Bn as t,Cn as n,Qn as r,cn as i,hn as a,mn as ee,qt as o,wr as s,xn as c}from"./vendor-C4JLrdLj.js";import{r as te,t as ne}from"./TokenManager-CyKz1gr1.js";import{An as l,Bn as u,Br as d,Fr as re,Gn as ie,Hn as f,Hr as ae,Ht as p,Ii as oe,Jr as m,K as se,Kn as h,M as ce,Ni as g,Nn as _,Oi as le,Rn as ue,Vn as de,Vr as fe,Yn as pe,_i as v,ar as y,gn as me,gr as b,h as he,hr as x,lr as ge,m as _e,mi as ve,or as S,pi as ye,qr as C,rr as w,ur as T,ut as E,vi as D,yi as O,zr as k}from"./ws-JRT2XE7Y.js";import{T as A,v as j,w as M,y as N}from"./index-Dhwlon97.js";import{n as P,t as be}from"./amurl-B2DriWMS.js";import{D as xe,E as F,Ft as Se,I,It as Ce,Lt as L,P as we,Pt as Te,Rt as R,St as Ee,k as De,w as Oe,xt as ke}from"./smart-playlist-store-DUBQztY1.js";import{n as Ae,t as je}from"./AboutPanel-tcKR70KG.js";function Me(e){let t=new w;t.setItems([y(v(`term.settings`),I,{icon:`settings`}),S(v(`term.appleMusic`),[y(v(`action.openUrl`),async()=>{let e=await fe(``,`Enter Apple Music URL`);if(!e.includes(`apple.com`)){ye({title:`Apple Music`,icon:`nicon:queryError`,subtitle:`Not a valid Apple Music URL`,type:`error`});return}P(e)},{icon:`url`}),y(D(`Your Profile`,`action.appleMusic.yourProfile`),async()=>{me(await re(`/v1/me/social-profile`,{fields:`name`}).then(e=>e.data.data[0]))},{icon:`profile`}),y(v(`term.replay`),()=>{_().push(`/am/replay`)},{icon:`rewind`}),T(),U()],{icon:`apple-music`}),H(),S(D(`View`,`term.view`),[y(v(`term.immersive`),()=>de(`immersive`),{icon:`immersive`}),y(v(`term.miniplayer`),we,{icon:`mini-player`}),y(v(`term.commandPalette`),De,{icon:`command`})],{icon:`panorama-image`}),S(D(`Help`,`term.help`),[W(),y(v(`term.createBugIssueReport`),ce),y(D(`Connect a Remote app`,`action.connectRemoteApp`),Oe)],{icon:`help`}),y(D(`Updates`,`term.updates`),()=>I(`updates`),{icon:`download`}),y(D(`Marketplace`,`term.marketplace`),()=>_().push(`/gallery/themes`),{icon:`marketplace`}),S(`Sleep Timer`,[y(`15 Minutes`,()=>N().startTimer(15)),y(`30 Minutes`,()=>N().startTimer(30)),y(`45 Minutes`,()=>N().startTimer(45)),y(`1 Hour`,()=>N().startTimer(60)),y(`Custom...`,async()=>{d({component:ke,componentProps:{}}).show()}),T(),y(`Clear Timer`,()=>N().clearTimer())],{icon:`sleepTimer`}),y(v(`term.audioSettings`),xe,{icon:`sound-waves`}),y(`Dev Test`,()=>_().push(`/am/zoo`),{icon:`brackets`}),K(),G(),y(v(`term.about`),()=>Ae(),{icon:`circle-info`}),y(v(`term.quit`),()=>M.closeWindow(!0),{icon:`power`})]),t.show(e)}var z,B,V,H,U,W,G,K,Ne=e((()=>{g(),A(),Ee(),ve(),je(),te(),F(),ae(),pe(),be(),Se(),p(),l(),u(),O(),_e(),j(),se(),E(),ge(),z=he(),B=()=>h.VitePluginActive.value?!1:y(D(`Enable Vite for Plugins`,`action.plugins.enableVitePlugins`),h.EnableVitePlugin),V=()=>y(D(`Disable plugins for this session`,`action.disablePlugins`),h.DisablePluginsForSession),H=()=>{if(sessionStorage.getItem(`diag:disable-plugins`)===`true`)return!1;let e=ie.MainMenu.items.value,t=S(v(`term.plugins`),[],{icon:`plugins`});return e.forEach(e=>{t.addItem(y(e.label,()=>e.onClick(new MouseEvent(`click`))))}),e.length!==0&&t.addItem(T()),t.addItem(B()),t.addItem(V()),t},U=()=>z.isAuthorized||ne.isAuthorized()?y(v(`menu.signOut`),()=>{k(`Are you sure you want to sign out?`,`Sign out`,{okLabel:`Sign out`,cancelLabel:`Cancel`}).then(e=>{if(e){try{window?.webkit?.messageHandlers.external.postMessage(`mkSignOut`)}catch{}Ce()}})}):y(v(`menu.signIn`),()=>{Te()}),W=()=>le().version.includes(`ptb`)?y(`PTB Changelog`,()=>oe(`https://github.com/ciderapp/Cider-2/blob/main/changelogs/PTB.md`)):!1,G=()=>ue()?y(v(`term.gameMode.disable`),()=>{f().gameMode=!1},{icon:`gamepad`}):y(v(`term.gameMode`),()=>{f().gameMode=!0},{icon:`gamepad`}),K=()=>z.privateEnabled?y(v(`term.disablePrivateSession`),()=>{z.setPrivateState(!1)},{icon:`private`}):y(v(`term.privateSession`),()=>{z.setPrivateState(!0)},{icon:`private`})})),q,J=e((()=>{o(),R(),Ne(),b(),q=n({__name:`MainMenuButton`,setup(e){return(e,n)=>(t(),a(L,{onMousedown:i(s(Me),[`left`])},{default:r(()=>[c(x,{name:`menu-dots`})]),_:1},8,[`onMousedown`]))}})})),Pe=e((()=>{})),Y,Fe=e((()=>{J(),J(),Pe(),m(),Y=C(q,[[`__scopeId`,`data-v-f4be464f`]])})),X,Z,Q=e((()=>{o(),b(),R(),u(),X={class:`nav-glyph`},Z=n({__name:`AirplayButton`,setup(e,{expose:n}){let i=f();function o(){for(let e in i.chromeViews)e===`airplay`?i.chromeViews[e]=!i.chromeViews[e]:i.chromeViews[e]=!1}return n({toggleOpen:o}),(e,n)=>(t(),a(L,{class:`airplay-button`,"native-title":``,title:e.$i(`action.cast.airplay`),active:s(i).isRightDrawerView(`airplay`),onClick:n[0]||=e=>s(i).invokeRightDrawerView(`airplay`)},{default:r(()=>[ee(`div`,X,[c(x,{name:`airplay`})])]),_:1},8,[`title`,`active`]))}})})),Ie=e((()=>{})),$,Le=e((()=>{Q(),Q(),Ie(),m(),$=C(Z,[[`__scopeId`,`data-v-2be7b68d`]])}));export{Fe as i,Le as n,Y as r,$ as t};