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