import{J as e,K as t,Kn as n,Nr as r,Or as i,Ot as a,Pr as o,Qt as s,Sn as c,Tr as l,W as u,Y as d,Yn as f,_r as p,dn as m,o as h,or as g,p as _,s as v,sn as y,tn as b,tr as x,v as S,wt as C,zn as w}from"./index-CV04KYXR.js";import{n as T,t as E}from"./VSelectionControl-C5mhuhVs.js";var D=m({indeterminate:Boolean,inset:Boolean,flat:Boolean,loading:{type:[Boolean,String],default:!1},...v(),...T()},`VSwitch`),O=y()({name:`VSwitch`,inheritAttrs:!1,props:D(),emits:{"update:focused":e=>!0,"update:modelValue":e=>!0,"update:indeterminate":e=>!0},setup(m,{attrs:v,slots:y}){let T=s(m,`indeterminate`),D=s(m,`modelValue`),{loaderClasses:O}=t(m),{isFocused:k,focus:A,blur:j}=_(m),M=l(),N=l(),P=w&&window.matchMedia(`(forced-colors: active)`).matches,F=i(()=>typeof m.loading==`string`&&m.loading!==``?m.loading:m.color),I=p(),L=i(()=>m.id||`switch-${I}`);function R(){T.value&&=!1}function z(e){e.stopPropagation(),e.preventDefault(),M.value?.input?.click()}return b(()=>{let[t,i]=c(v),s=h.filterProps(m),l=E.filterProps(m);return x(h,g({ref:N,class:[`v-switch`,{"v-switch--flat":m.flat},{"v-switch--inset":m.inset},{"v-switch--indeterminate":T.value},O.value,m.class]},t,s,{modelValue:D.value,"onUpdate:modelValue":e=>D.value=e,id:L.value,focused:k.value,style:m.style}),{...y,default:({id:t,messagesId:s,isDisabled:c,isReadonly:p,isValid:h})=>{let _={model:D,isValid:h};return x(E,g({ref:M},l,{modelValue:D.value,"onUpdate:modelValue":[e=>D.value=e,R],id:t.value,"aria-describedby":s.value,type:`checkbox`,"aria-checked":T.value?`mixed`:void 0,disabled:c.value,readonly:p.value,onFocus:A,onBlur:j},i),{...y,default:({backgroundColorClasses:e,backgroundColorStyles:t})=>f(`div`,{class:r([`v-switch__track`,P?void 0:e.value]),style:o(t.value),onClick:z},[y[`track-true`]&&f(`div`,{key:`prepend`,class:`v-switch__track-true`},[y[`track-true`](_)]),y[`track-false`]&&f(`div`,{key:`append`,class:`v-switch__track-false`},[y[`track-false`](_)])]),input:({inputNode:t,icon:i,backgroundColorClasses:s,backgroundColorStyles:c})=>f(n,null,[t,f(`div`,{class:r([`v-switch__thumb`,{"v-switch__thumb--filled":i||m.loading},m.inset||P?void 0:s.value]),style:o(m.inset?void 0:c.value)},[y.thumb?x(C,{defaults:{VIcon:{icon:i,size:`x-small`}}},{default:()=>[y.thumb({..._,icon:i})]}):x(a,null,{default:()=>[m.loading?x(u,{name:`v-switch`,active:!0,color:h.value===!1?void 0:F.value},{default:t=>y.loader?y.loader(t):x(e,{active:t.isActive,color:t.color,indeterminate:!0,size:`16`,width:`2`},null)}):i&&x(d,{key:String(i),icon:i,size:`x-small`},null)]})])])})}})}),S({},N)}});export{O as t};