import{A as e,C as t,I as n,Q as r,St as i,V as a,_ as o,b as s,g as c,m as l,o as u,s as d,x as f,yt as p,z as m}from"./vue.runtime.esm-bundler-DS0mm12S.js";import{o as h}from"./SelectValue-CPTo3Tck.js";import{t as g}from"./utils-u71wZLxr.js";import{X as _,rt as v}from"./index-aDrlI3dP.js";import{n as y,r as b}from"./VisuallyHidden-nGm_7oL3.js";import{O as x,T as S,g as C,y as w}from"./Teleport-CHY6zPT-.js";import{i as T}from"./button-DQxx5HZh.js";import{t as E}from"./useForwardExpose-DNY3s-e3.js";import{t as D}from"./VisuallyHiddenInput-JR2ARB93.js";import{t as O}from"./RovingFocusItem-BJTgMrxj.js";function k(e,t){return S(e)?!1:Array.isArray(e)?e.some(e=>b(e,t)):b(e,t)}var[A,j]=x(`CheckboxGroupRoot`);function M(e){return e===`indeterminate`}function N(e){return M(e)?`indeterminate`:e?`checked`:`unchecked`}var[P,F]=x(`CheckboxRoot`),I=f({inheritAttrs:!1,__name:`CheckboxRoot`,props:{defaultValue:{type:null,required:!1},modelValue:{type:null,required:!1,default:void 0},disabled:{type:Boolean,required:!1},value:{type:null,required:!1,default:`on`},id:{type:String,required:!1},trueValue:{type:null,required:!1,default:()=>!0},falseValue:{type:null,required:!1,default:()=>!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`},name:{type:String,required:!1},required:{type:Boolean,required:!1}},emits:[`update:modelValue`],setup(t,{emit:i}){let s=t,f=i,{forwardRef:h,currentElement:g}=E(),v=A(null),x=_(s,`modelValue`,f,{defaultValue:s.defaultValue??s.falseValue,passive:s.modelValue===void 0}),C=l(()=>v?.disabled.value||s.disabled),w=l(()=>b(x.value,s.trueValue)),j=l(()=>S(v?.modelValue.value)?x.value===`indeterminate`?`indeterminate`:w.value:k(v.modelValue.value,s.value));function P(){if(S(v?.modelValue.value))x.value===`indeterminate`?x.value=s.trueValue:x.value=w.value?s.falseValue:s.trueValue;else{let e=[...v.modelValue.value||[]];if(k(e,s.value)){let t=e.findIndex(e=>b(e,s.value));e.splice(t,1)}else e.push(s.value);v.modelValue.value=e}}let I=y(g),L=l(()=>s.id&&g.value?document.querySelector(`[for="${s.id}"]`)?.innerText:void 0);return F({disabled:C,state:j}),(t,i)=>(n(),c(a(p(v)?.rovingFocus.value?p(O):p(T)),e(t.$attrs,{id:t.id,ref:p(h),role:`checkbox`,"as-child":t.asChild,as:t.as,type:t.as===`button`?`button`:void 0,"aria-checked":p(M)(j.value)?`mixed`:j.value,"aria-required":t.required,"aria-label":t.$attrs[`aria-label`]||L.value,"data-state":p(N)(j.value),"data-disabled":C.value?``:void 0,disabled:C.value,focusable:p(v)?.rovingFocus.value?!C.value:void 0,onKeydown:u(d(()=>{},[`prevent`]),[`enter`]),onClick:P}),{default:r(()=>[m(t.$slots,`default`,{modelValue:p(x),state:j.value}),p(I)&&t.name&&!p(v)?(n(),c(p(D),{key:0,type:`checkbox`,checked:!!j.value,name:t.name,value:t.value,disabled:C.value,required:t.required},null,8,[`checked`,`name`,`value`,`disabled`,`required`])):o(`v-if`,!0)]),_:3},16,[`id`,`as-child`,`as`,`type`,`aria-checked`,`aria-required`,`aria-label`,`data-state`,`data-disabled`,`disabled`,`focusable`,`onKeydown`]))}}),L=f({__name:`CheckboxIndicator`,props:{forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`span`}},setup(t){let{forwardRef:i}=E(),a=P();return(t,o)=>(n(),c(p(C),{present:t.forceMount||p(M)(p(a).state.value)||p(a).state.value===!0},{default:r(()=>[s(p(T),e({ref:p(i),"data-state":p(N)(p(a).state.value),"data-disabled":p(a).disabled.value?``:void 0,style:{pointerEvents:`none`},"as-child":t.asChild,as:t.as},t.$attrs),{default:r(()=>[m(t.$slots,`default`)]),_:3},16,[`data-state`,`data-disabled`,`as-child`,`as`])]),_:3},8,[`present`]))}}),R=f({__name:`Checkbox`,props:{defaultValue:{},modelValue:{},disabled:{type:Boolean},value:{},id:{},trueValue:{},falseValue:{},asChild:{type:Boolean},as:{},name:{},required:{type:Boolean},class:{type:[Boolean,null,String,Object,Array]}},emits:[`update:modelValue`],setup(a,{emit:o}){let l=a,u=o,d=w(v(l,`class`),u);return(a,o)=>(n(),c(p(I),e({"data-slot":`checkbox`},p(d),{class:p(g)(`peer border-input data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50`,l.class)}),{default:r(e=>[s(p(L),{"data-slot":`checkbox-indicator`,class:`grid place-content-center text-current transition-none`},{default:r(()=>[m(a.$slots,`default`,i(t(e)),()=>[s(p(h),{class:`size-3.5`})])]),_:2},1024)]),_:3},16,[`class`]))}});export{R as t};