import{e as S,u as M,a as j}from"./input-CcQzS21A.js";import{k as d,j as n}from"./index-D0iJORaS.js";import{P as H,a as R,u as G,c as w,g as K,d as U,C as X}from"./index-BDB3jGHw.js";import{u as $}from"./index-BMUrwkl5.js";const J=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],ce=S("eye-off",J);const Q=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],se=S("eye",Q);var g="Checkbox",[V]=U(g),[W,I]=V(g);function Y(t){const{__scopeCheckbox:c,checked:o,children:l,defaultChecked:s,disabled:e,form:f,name:h,onCheckedChange:i,required:k,value:m="on",internal_do_not_use_render:u}=t,[p,y]=G({prop:o,defaultProp:s??!1,onChange:i,caller:g}),[C,x]=d.useState(null),[v,r]=d.useState(null),a=d.useRef(!1),E=C?!!f||!!C.closest("form"):!0,_={checked:p,disabled:e,setChecked:y,control:C,setControl:x,name:h,form:f,value:m,hasConsumerStoppedPropagationRef:a,required:k,defaultChecked:b(s)?!1:s,isFormControl:E,bubbleInput:v,setBubbleInput:r};return n.jsx(W,{scope:c,..._,children:Z(u)?u(_):l})}var B="CheckboxTrigger",T=d.forwardRef(({__scopeCheckbox:t,onKeyDown:c,onClick:o,...l},s)=>{const{control:e,value:f,disabled:h,checked:i,required:k,setControl:m,setChecked:u,hasConsumerStoppedPropagationRef:p,isFormControl:y,bubbleInput:C}=I(B,t),x=M(s,m),v=d.useRef(i);return d.useEffect(()=>{const r=e?.form;if(r){const a=()=>u(v.current);return r.addEventListener("reset",a),()=>r.removeEventListener("reset",a)}},[e,u]),n.jsx(R.button,{type:"button",role:"checkbox","aria-checked":b(i)?"mixed":i,"aria-required":k,"data-state":D(i),"data-disabled":h?"":void 0,disabled:h,value:f,...l,ref:x,onKeyDown:w(c,r=>{r.key==="Enter"&&r.preventDefault()}),onClick:w(o,r=>{u(a=>b(a)?!0:!a),C&&y&&(p.current=r.isPropagationStopped(),p.current||r.stopPropagation())})})});T.displayName=B;var P=d.forwardRef((t,c)=>{const{__scopeCheckbox:o,name:l,checked:s,defaultChecked:e,required:f,disabled:h,value:i,onCheckedChange:k,form:m,...u}=t;return n.jsx(Y,{__scopeCheckbox:o,checked:s,defaultChecked:e,disabled:h,required:f,onCheckedChange:k,name:l,form:m,value:i,internal_do_not_use_render:({isFormControl:p})=>n.jsxs(n.Fragment,{children:[n.jsx(T,{...u,ref:c,__scopeCheckbox:o}),p&&n.jsx(O,{__scopeCheckbox:o})]})})});P.displayName=g;var q="CheckboxIndicator",A=d.forwardRef((t,c)=>{const{__scopeCheckbox:o,forceMount:l,...s}=t,e=I(q,o);return n.jsx(H,{present:l||b(e.checked)||e.checked===!0,children:n.jsx(R.span,{"data-state":D(e.checked),"data-disabled":e.disabled?"":void 0,...s,ref:c,style:{pointerEvents:"none",...t.style}})})});A.displayName=q;var L="CheckboxBubbleInput",O=d.forwardRef(({__scopeCheckbox:t,...c},o)=>{const{control:l,hasConsumerStoppedPropagationRef:s,checked:e,defaultChecked:f,required:h,disabled:i,name:k,value:m,form:u,bubbleInput:p,setBubbleInput:y}=I(L,t),C=M(o,y),x=$(e),v=K(l);d.useEffect(()=>{const a=p;if(!a)return;const E=window.HTMLInputElement.prototype,N=Object.getOwnPropertyDescriptor(E,"checked").set,F=!s.current;if(x!==e&&N){const z=new Event("click",{bubbles:F});a.indeterminate=b(e),N.call(a,b(e)?!1:e),a.dispatchEvent(z)}},[p,x,e,s]);const r=d.useRef(b(e)?!1:e);return n.jsx(R.input,{type:"checkbox","aria-hidden":!0,defaultChecked:f??r.current,required:h,disabled:i,name:k,value:m,form:u,...c,tabIndex:-1,ref:C,style:{...c.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});O.displayName=L;function Z(t){return typeof t=="function"}function b(t){return t==="indeterminate"}function D(t){return b(t)?"indeterminate":t?"checked":"unchecked"}const ee=d.forwardRef(({className:t,...c},o)=>n.jsx(P,{ref:o,className:j("grid place-content-center 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",t),...c,children:n.jsx(A,{className:j("grid place-content-center text-current"),children:n.jsx(X,{className:"h-4 w-4"})})}));ee.displayName=P.displayName;export{ee as C,se as E,ce as a};
