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