import{$t as e,Cr as t,J as n,K as r,Kn as i,Ln as a,Or as o,Qn as s,Tt as c,W as l,Wn as u,Xt as d,Y as f,an as p,bn as m,br as h,kr as g,kt as _,ln as v,o as y,p as b,pr as x,rr as S,s as C,y as w}from"./index-0r0acSeq.js";import{n as T,t as E}from"./VSelectionControl-DC3vDaP0.js";var D=v({indeterminate:Boolean,inset:Boolean,flat:Boolean,loading:{type:[Boolean,String],default:!1},...C(),...T()},`VSwitch`),O=p()({name:`VSwitch`,inheritAttrs:!1,props:D(),emits:{"update:focused":e=>!0,"update:modelValue":e=>!0,"update:indeterminate":e=>!0},setup(p,{attrs:v,slots:C}){let T=d(p,`indeterminate`),D=d(p,`modelValue`),{loaderClasses:O}=r(p),{isFocused:k,focus:A,blur:j}=b(p),M=h(),N=h(),P=a&&window.matchMedia(`(forced-colors: active)`).matches,F=t(()=>typeof p.loading==`string`&&p.loading!==``?p.loading:p.color),I=x(),L=t(()=>p.id||`switch-${I}`);function R(){T.value&&=!1}function z(e){e.stopPropagation(),e.preventDefault(),M.value?.input?.click()}return e(()=>{let[e,t]=m(v),r=y.filterProps(p),a=E.filterProps(p);return s(y,S({ref:N,class:[`v-switch`,{"v-switch--flat":p.flat},{"v-switch--inset":p.inset},{"v-switch--indeterminate":T.value},O.value,p.class]},e,r,{modelValue:D.value,"onUpdate:modelValue":e=>D.value=e,id:L.value,focused:k.value,style:p.style}),{...C,default:({id:e,messagesId:r,isDisabled:d,isReadonly:m,isValid:h})=>{let v={model:D,isValid:h};return s(E,S({ref:M},a,{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:d.value,readonly:m.value,onFocus:A,onBlur:j},t),{...C,default:({backgroundColorClasses:e,backgroundColorStyles:t})=>i(`div`,{class:o([`v-switch__track`,P?void 0:e.value]),style:g(t.value),onClick:z},[C[`track-true`]&&i(`div`,{key:`prepend`,class:`v-switch__track-true`},[C[`track-true`](v)]),C[`track-false`]&&i(`div`,{key:`append`,class:`v-switch__track-false`},[C[`track-false`](v)])]),input:({inputNode:e,icon:t,backgroundColorClasses:r,backgroundColorStyles:a})=>i(u,null,[e,i(`div`,{class:o([`v-switch__thumb`,{"v-switch__thumb--filled":t||p.loading},p.inset||P?void 0:r.value]),style:g(p.inset?void 0:a.value)},[C.thumb?s(c,{defaults:{VIcon:{icon:t,size:`x-small`}}},{default:()=>[C.thumb({...v,icon:t})]}):s(_,null,{default:()=>[p.loading?s(l,{name:`v-switch`,active:!0,color:h.value===!1?void 0:F.value},{default:e=>C.loader?C.loader(e):s(n,{active:e.isActive,color:e.color,indeterminate:!0,size:`16`,width:`2`},null)}):t&&s(f,{key:String(t),icon:t,size:`x-small`},null)]})])])})}})}),w({},N)}});export{O as t};