import{c as A,r as a,q as I,s as O,j as n,t as q,P as w,v as g,w as z,x as H,y as K,a as j,C as T}from"./main-C5rJoLCl.js";/**
 * @license lucide-react v0.302.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Q=A("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);var y="Checkbox",[U,W]=q(y),[X,F]=U(y),N=a.forwardRef((e,i)=>{const{__scopeCheckbox:t,name:u,checked:p,defaultChecked:o,required:x,disabled:d,value:C="on",onCheckedChange:b,form:m,...v}=e,[r,E]=a.useState(null),P=I(i,s=>E(s)),l=a.useRef(!1),k=r?m||!!r.closest("form"):!0,[f,R]=O({prop:p,defaultProp:o??!1,onChange:b,caller:y}),L=a.useRef(f);return a.useEffect(()=>{const s=r==null?void 0:r.form;if(s){const h=()=>R(L.current);return s.addEventListener("reset",h),()=>s.removeEventListener("reset",h)}},[r,R]),n.jsxs(X,{scope:t,state:f,disabled:d,children:[n.jsx(w.button,{type:"button",role:"checkbox","aria-checked":c(f)?"mixed":f,"aria-required":x,"data-state":M(f),"data-disabled":d?"":void 0,disabled:d,value:C,...v,ref:P,onKeyDown:g(e.onKeyDown,s=>{s.key==="Enter"&&s.preventDefault()}),onClick:g(e.onClick,s=>{R(h=>c(h)?!0:!h),k&&(l.current=s.isPropagationStopped(),l.current||s.stopPropagation())})}),k&&n.jsx(B,{control:r,bubbles:!l.current,name:u,value:C,checked:f,required:x,disabled:d,form:m,style:{transform:"translateX(-100%)"},defaultChecked:c(o)?!1:o})]})});N.displayName=y;var S="CheckboxIndicator",_=a.forwardRef((e,i)=>{const{__scopeCheckbox:t,forceMount:u,...p}=e,o=F(S,t);return n.jsx(z,{present:u||c(o.state)||o.state===!0,children:n.jsx(w.span,{"data-state":M(o.state),"data-disabled":o.disabled?"":void 0,...p,ref:i,style:{pointerEvents:"none",...e.style}})})});_.displayName=S;var V="CheckboxBubbleInput",B=a.forwardRef(({__scopeCheckbox:e,control:i,checked:t,bubbles:u=!0,defaultChecked:p,...o},x)=>{const d=a.useRef(null),C=I(d,x),b=H(t),m=K(i);a.useEffect(()=>{const r=d.current;if(!r)return;const E=window.HTMLInputElement.prototype,l=Object.getOwnPropertyDescriptor(E,"checked").set;if(b!==t&&l){const k=new Event("click",{bubbles:u});r.indeterminate=c(t),l.call(r,c(t)?!1:t),r.dispatchEvent(k)}},[b,t,u]);const v=a.useRef(c(t)?!1:t);return n.jsx(w.input,{type:"checkbox","aria-hidden":!0,defaultChecked:p??v.current,...o,tabIndex:-1,ref:C,style:{...o.style,...m,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});B.displayName=V;function c(e){return e==="indeterminate"}function M(e){return c(e)?"indeterminate":e?"checked":"unchecked"}var D=N,$=_;const G=a.forwardRef(({className:e,...i},t)=>n.jsx(D,{ref:t,className:j("peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...i,children:n.jsx($,{className:j("flex items-center justify-center text-current"),children:n.jsx(T,{className:"h-4 w-4"})})}));G.displayName=D.displayName;export{Q as C,G as a};
//# sourceMappingURL=checkbox-1SV0mGsA.js.map
