import{$n as e,$t as t,Ar as n,G as r,Nr as i,Rr as a,Tt as o,Un as s,X as c,Xn as l,Y as u,ar as d,br as f,cn as p,fn as m,kt as h,lr as g,nn as _,o as v,p as y,q as b,s as x,v as S,wn as C,zr as w}from"./index-DPtWdFsS.js";import{n as T,r as E}from"./VContainer-BOQOLP3g.js";var D=m({indeterminate:Boolean,inset:Boolean,flat:Boolean,loading:{type:[Boolean,String],default:!1},...x(),...E()},`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:m,slots:x}){let E=t(p,`indeterminate`),D=t(p,`modelValue`),{loaderClasses:O}=b(p),{isFocused:k,focus:A,blur:j}=y(p),M=n(),N=n(),P=s&&window.matchMedia(`(forced-colors: active)`).matches,F=i(()=>typeof p.loading==`string`&&p.loading!==``?p.loading:p.color),I=f(),L=i(()=>p.id||`switch-${I}`);function R(){E.value&&=!1}function z(e){e.stopPropagation(),e.preventDefault(),M.value?.input?.click()}return _(()=>{let[t,n]=C(m),i=v.filterProps(p),s=T.filterProps(p);return d(v,g({ref:N,class:[`v-switch`,{"v-switch--flat":p.flat},{"v-switch--inset":p.inset},{"v-switch--indeterminate":E.value},O.value,p.class]},t,i,{modelValue:D.value,"onUpdate:modelValue":e=>D.value=e,id:L.value,focused:k.value,style:p.style}),{...x,default:({id:t,messagesId:i,isDisabled:f,isReadonly:m,isValid:_})=>{let v={model:D,isValid:_};return d(T,g({ref:M},s,{modelValue:D.value,"onUpdate:modelValue":[e=>D.value=e,R],id:t.value,"aria-describedby":i.value,type:`checkbox`,"aria-checked":E.value?`mixed`:void 0,disabled:f.value,readonly:m.value,onFocus:A,onBlur:j},n),{...x,default:({backgroundColorClasses:t,backgroundColorStyles:n})=>e(`div`,{class:a([`v-switch__track`,P?void 0:t.value]),style:w(n.value),onClick:z},[x[`track-true`]&&e(`div`,{key:`prepend`,class:`v-switch__track-true`},[x[`track-true`](v)]),x[`track-false`]&&e(`div`,{key:`append`,class:`v-switch__track-false`},[x[`track-false`](v)])]),input:({inputNode:t,icon:n,backgroundColorClasses:i,backgroundColorStyles:s})=>e(l,null,[t,e(`div`,{class:a([`v-switch__thumb`,{"v-switch__thumb--filled":n||p.loading},p.inset||P?void 0:i.value]),style:w(p.inset?void 0:s.value)},[x.thumb?d(o,{defaults:{VIcon:{icon:n,size:`x-small`}}},{default:()=>[x.thumb({...v,icon:n})]}):d(h,null,{default:()=>[p.loading?d(r,{name:`v-switch`,active:!0,color:_.value===!1?void 0:F.value},{default:e=>x.loader?x.loader(e):d(u,{active:e.isActive,color:e.color,indeterminate:!0,size:`16`,width:`2`},null)}):n&&d(c,{key:String(n),icon:n,size:`x-small`},null)]})])])})}})}),S({},N)}});export{O as t};