import{Er as e,G as t,Kr as n,Mr as r,Q as i,U as a,Un as o,Z as s,br as c,ci as l,cr as u,et as d,gr as f,hn as p,ii as m,j as h,kn as g,mi as _,pi as v,r as y,vn as b,wn as x}from"./index-BKLG6eUi.js";import{l as S,m as C,u as w}from"./VTextField-Bs8XQAKI.js";import{m as T,p as E}from"./VSelect-Dy70bHJm.js";var D=g({indeterminate:Boolean,inset:Boolean,flat:Boolean,loading:{type:[Boolean,String],default:!1},...w(),...T()},`VSwitch`),O=x()({name:`VSwitch`,inheritAttrs:!1,props:D(),emits:{"update:focused":e=>!0,"update:modelValue":e=>!0,"update:indeterminate":e=>!0},setup(g,{attrs:x,slots:w}){let T=p(g,`indeterminate`),D=p(g,`modelValue`),{loaderClasses:O}=t(g),{isFocused:k,focus:A,blur:j}=C(g),M=m(),N=m(),P=u&&window.matchMedia(`(forced-colors: active)`).matches,F=l(()=>typeof g.loading==`string`&&g.loading!==``?g.loading:g.color),I=n(),L=l(()=>g.id||`switch-${I}`);function R(){T.value&&=!1}function z(e){e.stopPropagation(),e.preventDefault(),M.value?.input?.click()}return b(()=>{let[t,n]=o(x),l=S.filterProps(g),u=E.filterProps(g);return e(S,r({ref:N,class:[`v-switch`,{"v-switch--flat":g.flat},{"v-switch--inset":g.inset},{"v-switch--indeterminate":T.value},O.value,g.class]},t,l,{modelValue:D.value,"onUpdate:modelValue":e=>D.value=e,id:L.value,focused:k.value,style:g.style}),{...w,default:({id:t,messagesId:o,isDisabled:l,isReadonly:p,isValid:m})=>{let y={model:D,isValid:m};return e(E,r({ref:M},u,{modelValue:D.value,"onUpdate:modelValue":[e=>D.value=e,R],id:t.value,"aria-describedby":o.value,type:`checkbox`,"aria-checked":T.value?`mixed`:void 0,disabled:l.value,readonly:p.value,onFocus:A,onBlur:j},n),{...w,default:({backgroundColorClasses:e,backgroundColorStyles:t})=>c(`div`,{class:v([`v-switch__track`,P?void 0:e.value]),style:_(t.value),onClick:z},[w[`track-true`]&&c(`div`,{key:`prepend`,class:`v-switch__track-true`},[w[`track-true`](y)]),w[`track-false`]&&c(`div`,{key:`append`,class:`v-switch__track-false`},[w[`track-false`](y)])]),input:({inputNode:t,icon:n,backgroundColorClasses:r,backgroundColorStyles:o})=>c(f,null,[t,c(`div`,{class:v([`v-switch__thumb`,{"v-switch__thumb--filled":n||g.loading},g.inset||P?void 0:r.value]),style:_(g.inset?void 0:o.value)},[w.thumb?e(d,{defaults:{VIcon:{icon:n,size:`x-small`}}},{default:()=>[w.thumb({...y,icon:n})]}):e(h,null,{default:()=>[g.loading?e(a,{name:`v-switch`,active:!0,color:m.value===!1?void 0:F.value},{default:t=>w.loader?w.loader(t):e(s,{active:t.isActive,color:t.color,indeterminate:!0,size:`16`,width:`2`},null)}):n&&e(i,{key:String(n),icon:n,size:`x-small`},null)]})])])})}})}),y({},N)}});export{O as t};