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