import{Ar as e,Dr as t,Fr as n,Ir as r,J as i,K as a,Kn as o,Ot as s,Qt as c,Sn 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-Dh0DFtbo.js";import{n as T,t as E}from"./VSelectionControl-B3gtBbGB.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=c(m,`indeterminate`),D=c(m,`modelValue`),{loaderClasses:O}=a(m),{isFocused:k,focus:A,blur:j}=_(m),M=t(),N=t(),P=w&&window.matchMedia(`(forced-colors: active)`).matches,F=e(()=>typeof m.loading==`string`&&m.loading!==``?m.loading:m.color),I=p(),L=e(()=>m.id||`switch-${I}`);function R(){T.value&&=!1}function z(e){e.stopPropagation(),e.preventDefault(),M.value?.input?.click()}return b(()=>{let[e,t]=l(v),a=h.filterProps(m),c=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]},e,a,{modelValue:D.value,"onUpdate:modelValue":e=>D.value=e,id:L.value,focused:k.value,style:m.style}),{...y,default:({id:e,messagesId:a,isDisabled:l,isReadonly:p,isValid:h})=>{let _={model:D,isValid:h};return x(E,g({ref:M},c,{modelValue:D.value,"onUpdate:modelValue":[e=>D.value=e,R],id:e.value,"aria-describedby":a.value,type:`checkbox`,"aria-checked":T.value?`mixed`:void 0,disabled:l.value,readonly:p.value,onFocus:A,onBlur:j},t),{...y,default:({backgroundColorClasses:e,backgroundColorStyles:t})=>f(`div`,{class:n([`v-switch__track`,P?void 0:e.value]),style:r(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:e,icon:t,backgroundColorClasses:a,backgroundColorStyles:c})=>f(o,null,[e,f(`div`,{class:n([`v-switch__thumb`,{"v-switch__thumb--filled":t||m.loading},m.inset||P?void 0:a.value]),style:r(m.inset?void 0:c.value)},[y.thumb?x(C,{defaults:{VIcon:{icon:t,size:`x-small`}}},{default:()=>[y.thumb({..._,icon:t})]}):x(s,null,{default:()=>[m.loading?x(u,{name:`v-switch`,active:!0,color:h.value===!1?void 0:F.value},{default:e=>y.loader?y.loader(e):x(i,{active:e.isActive,color:e.color,indeterminate:!0,size:`16`,width:`2`},null)}):t&&x(d,{key:String(t),icon:t,size:`x-small`},null)]})])])})}})}),S({},N)}});export{O as t};