import{V as P,m as F}from"./VCheckboxBtn-D390s4L9.js";import{g as A,p as K,j as L,cs as R,J,ct as z,n as E,cu as O,cv as V,o as k,ae as U,ap as j,ai as q,cw as D,ay as M,az as y,aA as g,ah as G,aB as h,q as w,E as d,i as v,ax as s,aP as H}from"./index-BRUnowC8.js";const Q=K({...D(),...q(F(),["inline"])},"VCheckbox"),X=A()({name:"VCheckbox",inheritAttrs:!1,props:Q(),emits:{"update:modelValue":e=>!0,"update:focused":e=>!0},setup(e,l){let{attrs:o,slots:u}=l;const c=L(e,"modelValue"),{isFocused:t,focus:r,blur:n}=R(e),a=J(),i=z();return E(()=>{const[f,b]=O(o),p=V.filterProps(e),x=P.filterProps(e);return k(V,U({ref:a,class:["v-checkbox",e.class]},f,p,{modelValue:c.value,"onUpdate:modelValue":m=>c.value=m,id:e.id||`checkbox-${i}`,focused:t.value,style:e.style}),{...u,default:m=>{let{id:B,messagesId:C,isDisabled:I,isReadonly:N,isValid:S}=m;return k(P,U(x,{id:B.value,"aria-describedby":C.value,disabled:I.value,readonly:N.value},b,{error:S.value===!1,modelValue:c.value,"onUpdate:modelValue":$=>c.value=$,onFocus:r,onBlur:n}),u)}})}),j({},a)}}),Y=M({__name:"NowPlayingBadge",props:{showBadge:{type:Boolean,default:!0},showIcon:{type:Boolean,default:!0},badgeStyle:{default:""},iconStyle:{default:""}},setup(e){return(l,o)=>(g(),y(G,null,[e.showBadge?(g(),y("span",{key:0,style:w(e.badgeStyle),class:"now-playing-badge","aria-label":"Now playing"}," Now playing ",4)):h("",!0),e.showIcon?(g(),y("div",{key:1,style:w(e.iconStyle),class:"now-playing-icon"},[...o[0]||(o[0]=[d("div",{class:"bar"},null,-1),d("div",{class:"bar"},null,-1),d("div",{class:"bar"},null,-1),d("div",{class:"bar"},null,-1)])],4)):h("",!0)],64))}});function Z(){const e=v(()=>s.currentUser);function l(t,r){return v(()=>{if(!s.currentUser?.preferences)return r;const n=s.currentUser.preferences[t];return n!==void 0?n:r})}async function o(t,r){if(!s.currentUser){console.warn("Cannot set preference: no user logged in");return}s.currentUser.preferences||(s.currentUser.preferences={});const n=JSON.parse(JSON.stringify(r)),a={...s.currentUser.preferences,[t]:n};s.currentUser.preferences=a;try{await H.updateUser(s.currentUser.user_id,{preferences:a})}catch(i){console.error("Failed to update user preferences:",i)}}function u(t,r){const n=`${t}.${r}`;return v(()=>s.currentUser?.preferences?s.currentUser.preferences[`itemsListing.${n}`]||{}:{})}async function c(t,r,n,a){const f=`itemsListing.${`${t}.${r}`}`,p={...u(t,r).value,[n]:a};await o(f,p)}return{currentUser:e,getPreference:l,setPreference:o,getItemsListingPreferences:u,setItemsListingPreference:c}}export{X as V,Y as _,Z as u};
