import{n as e}from"./rolldown-runtime-DAXXjFlN.js";import{An as t,Ar as n,Dn as r,En as i,Fn as a,Hn as o,Ln as s,On as c,Pn as l,Qn as u,Sn as d,Zn as f,_r as p,dr as m,er as h,jn as g,kn as _,pr as v,sn as y,un as b,vr as x}from"./vendor-Dcerr41Y.js";import{Ut as S,Wt as C}from"./vendor-quasar-CU_esu6y.js";import{b as w,di as T,h as E,m as D,ui as O,x as k}from"./ws-DjAvcWfg.js";import{n as A,r as j}from"./windowing-B5kKC8VJ.js";import{on as M,sn as N}from"./smart-playlist-store-U6zHlhLg.js";import{n as P,t as F}from"./CTooltip-VbAiroE6.js";import{g as I,h as L,m as R,p as z}from"./AMPlaybackActions-BhoorvYm.js";var B,V,H,U=e((()=>{P(),C(),y(),k(),A(),D(),N(),R(),I(),B={class:`nav-glyph icon`},V={class:`popup-content`},H=s({__name:`VolumePopup`,setup(e){let s=E(),y=n(null),C=n(null),T=o(`windowContext`,null)||j(),D=r(()=>T&&T!==window),O=o(`setControlsOpen`,null),k=r(()=>T||window),A=r(()=>k.value.document.body),N=n(!1),P=n(!1),I=n(null),R=r(()=>{if(!I.value)return{};let e=I.value.getBoundingClientRect(),t=k.value.innerHeight,n=k.value.innerWidth,r=e.top,i=t-e.bottom;e.left,n-e.right;let a,o=e.left+e.width/2,s=`translateX(-50%)`;if(r>=72)a=e.top-12,s=`translate(-50%, -100%)`;else if(i>=72)a=e.bottom+12,s=`translateX(-50%)`;else{t-24;let e=(t-60)/2;a=Math.max(12,Math.min(e,t-60-12)),s=`translateX(-50%)`}let c=n-180/2-12;return o=Math.max(102,Math.min(o,c)),{position:`fixed`,left:`${o}px`,top:`${a}px`,transform:s}}),H=r(()=>{if(!I.value)return{};let e=I.value.getBoundingClientRect(),t=k.value.innerHeight;return e.top>=38?{position:`fixed`,left:`${e.left+e.width/2}px`,bottom:`${t-e.top+8}px`,transform:`translateX(-50%)`,zIndex:`99999`}:{position:`fixed`,left:`${e.right+8}px`,top:`${e.top+e.height/2}px`,transform:`translateY(-50%)`,zIndex:`99999`}});function U(){if(w(`audio.volumeDisplaySPL.enabled`)){let e=Number(w(`audio.volumeDisplaySPL.calibration`)??90)+Math.round(Math.log10(s.normalizedVolume)*20);return`${Number.isFinite(e)?e:0} dB SPL`}return`${Math.round(s.normalizedVolume*100)}%`}let W=r(()=>{let e=Math.round(s.normalizedVolume/w(`audio.maxVolume`)*100);return e===0?`volume-x`:e<25?`volume`:e<50?`volume-1`:`volume-2`});function G(e){let t=Math.max(-1,Math.min(1,e.wheelDelta||-e.detail)),n=s.normalizedVolume,r=+(w(`audio.volumeStep`)??.01),i=+n+t*r;i>1?s.normalizedVolume=1:i<0?s.normalizedVolume=0:s.normalizedVolume=i}function K(){N.value=!N.value}function q(){I.value&&(N.value=!1,C.value?.open(I.value))}function J(e){let t=e.target;I.value&&!I.value.contains(t)&&(t.closest(`.custom-volume-popup`)||(N.value=!1))}return m(N,e=>{O&&O(e)}),f(()=>{k.value.addEventListener(`click`,J)}),u(()=>{k.value.removeEventListener(`click`,J),O&&O(!1)}),(e,n)=>{let r=F;return h(),g(`div`,{class:`volume-popup-wrapper`,ref_key:`buttonRef`,ref:I,onMouseenter:n[0]||=e=>P.value=!0,onMouseleave:n[1]||=e=>P.value=!1},[a(M,{class:`volume-button`,onWheel:d(G,[`prevent`]),onClick:K,onContextmenu:d(q,[`prevent`])},{default:v(()=>[c(`div`,B,[a(S,{name:`svguse:cider-assets/cider-icons/icons.svg#`+W.value,size:`16px`},null,8,[`name`])])]),menu:v(()=>[D.value?t(``,!0):(h(),_(r,{key:0},{default:v(()=>[l(x(U()),1)]),_:1}))]),_:1}),(h(),_(i,{to:A.value},[a(b,{name:`fade`},{default:v(()=>[N.value?(h(),g(`div`,{key:0,class:`custom-volume-popup window-nodrag`,style:p(R.value)},[c(`div`,V,[a(z,{ref_key:`volumeSlider`,ref:y},null,512)])],4)):t(``,!0)]),_:1})],8,[`to`])),D.value?(h(),_(i,{key:0,to:A.value},[a(b,{name:`fade`},{default:v(()=>[P.value&&!N.value?(h(),g(`div`,{key:0,class:`custom-tooltip`,style:p(H.value)},x(U()),5)):t(``,!0)]),_:1})],8,[`to`])):t(``,!0),a(L,{ref_key:`quickMenu`,ref:C},null,512)],544)}}})})),W=e((()=>{})),G,K=e((()=>{U(),U(),W(),T(),G=O(H,[[`__scopeId`,`data-v-a40d9142`]])}));export{K as n,G as t};