import{x as U,y as Y,A as R,aa as Z,B as H,R as ee,r as i,k as G,a6 as re,l as T,T as L}from"./FontSizeProvider-Cy0K7gvl.js";import{C as oe}from"./index-BwBXqow1.js";import{ak as ae,H as F,al as te,am as ne,o as ie}from"./trash-2-Dx96Ty-c.js";const le=e=>{const{checkboxCls:r}=e,o=`${r}-wrapper`;return[{[`${r}-group`]:Object.assign(Object.assign({},R(e)),{display:"inline-flex",flexWrap:"wrap",columnGap:e.marginXS,[`> ${e.antCls}-row`]:{flex:1}}),[o]:Object.assign(Object.assign({},R(e)),{display:"inline-flex",alignItems:"baseline",cursor:"pointer","&:after":{display:"inline-block",width:0,overflow:"hidden",content:"'\\a0'"},[`& + ${o}`]:{marginInlineStart:0},[`&${o}-in-form-item`]:{'input[type="checkbox"]':{width:14,height:14}}}),[r]:Object.assign(Object.assign({},R(e)),{position:"relative",whiteSpace:"nowrap",lineHeight:1,cursor:"pointer",borderRadius:e.borderRadiusSM,alignSelf:"center",[`${r}-input`]:{position:"absolute",inset:0,zIndex:1,cursor:"pointer",opacity:0,margin:0,[`&:focus-visible + ${r}-inner`]:Object.assign({},Z(e))},[`${r}-inner`]:{boxSizing:"border-box",display:"block",width:e.checkboxSize,height:e.checkboxSize,direction:"ltr",backgroundColor:e.colorBgContainer,border:`${H(e.lineWidth)} ${e.lineType} ${e.colorBorder}`,borderRadius:e.borderRadiusSM,borderCollapse:"separate",transition:`all ${e.motionDurationSlow}`,"&:after":{boxSizing:"border-box",position:"absolute",top:"50%",insetInlineStart:"25%",display:"table",width:e.calc(e.checkboxSize).div(14).mul(5).equal(),height:e.calc(e.checkboxSize).div(14).mul(8).equal(),border:`${H(e.lineWidthBold)} solid ${e.colorWhite}`,borderTop:0,borderInlineStart:0,transform:"rotate(45deg) scale(0) translate(-50%,-50%)",opacity:0,content:'""',transition:`all ${e.motionDurationFast} ${e.motionEaseInBack}, opacity ${e.motionDurationFast}`}},"& + span":{paddingInlineStart:e.paddingXS,paddingInlineEnd:e.paddingXS}})},{[`
        ${o}:not(${o}-disabled),
        ${r}:not(${r}-disabled)
      `]:{[`&:hover ${r}-inner`]:{borderColor:e.colorPrimary}},[`${o}:not(${o}-disabled)`]:{[`&:hover ${r}-checked:not(${r}-disabled) ${r}-inner`]:{backgroundColor:e.colorPrimaryHover,borderColor:"transparent"},[`&:hover ${r}-checked:not(${r}-disabled):after`]:{borderColor:e.colorPrimaryHover}}},{[`${r}-checked`]:{[`${r}-inner`]:{backgroundColor:e.colorPrimary,borderColor:e.colorPrimary,"&:after":{opacity:1,transform:"rotate(45deg) scale(1) translate(-50%,-50%)",transition:`all ${e.motionDurationMid} ${e.motionEaseOutBack} ${e.motionDurationFast}`}}},[`
        ${o}-checked:not(${o}-disabled),
        ${r}-checked:not(${r}-disabled)
      `]:{[`&:hover ${r}-inner`]:{backgroundColor:e.colorPrimaryHover,borderColor:"transparent"}}},{[r]:{"&-indeterminate":{[`${r}-inner`]:{backgroundColor:e.colorBgContainer,borderColor:e.colorBorder,"&:after":{top:"50%",insetInlineStart:"50%",width:e.calc(e.fontSizeLG).div(2).equal(),height:e.calc(e.fontSizeLG).div(2).equal(),backgroundColor:e.colorPrimary,border:0,transform:"translate(-50%, -50%) scale(1)",opacity:1,content:'""'}}}}},{[`${o}-disabled`]:{cursor:"not-allowed"},[`${r}-disabled`]:{[`&, ${r}-input`]:{cursor:"not-allowed",pointerEvents:"none"},[`${r}-inner`]:{background:e.colorBgContainerDisabled,borderColor:e.colorBorder,"&:after":{borderColor:e.colorTextDisabled}},"&:after":{display:"none"},"& + span":{color:e.colorTextDisabled},[`&${r}-indeterminate ${r}-inner::after`]:{background:e.colorTextDisabled}}}]};function W(e,r){const o=Y(r,{checkboxCls:`.${e}`,checkboxSize:r.controlInteractiveSize});return[le(o)]}const X=U("Checkbox",(e,r)=>{let{prefixCls:o}=r;return[W(o,e)]}),se=ee.createContext(null),A=se;var ce=function(e,r){var o={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&r.indexOf(a)<0&&(o[a]=e[a]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var l=0,a=Object.getOwnPropertySymbols(e);l<a.length;l++)r.indexOf(a[l])<0&&Object.prototype.propertyIsEnumerable.call(e,a[l])&&(o[a[l]]=e[a[l]]);return o};const de=(e,r)=>{var o;const{prefixCls:a,className:l,rootClassName:O,children:g,indeterminate:C=!1,style:S,onMouseEnter:h,onMouseLeave:d,skipGroup:y=!1,disabled:w}=e,s=ce(e,["prefixCls","className","rootClassName","children","indeterminate","style","onMouseEnter","onMouseLeave","skipGroup","disabled"]),{getPrefixCls:x,direction:j,checkbox:u}=i.useContext(G),t=i.useContext(A),{isFormItemInput:E}=i.useContext(ae),I=i.useContext(re),v=(o=(t==null?void 0:t.disabled)||w)!==null&&o!==void 0?o:I,b=i.useRef(s.value);i.useEffect(()=>{t==null||t.registerValue(s.value)},[]),i.useEffect(()=>{if(!y)return s.value!==b.current&&(t==null||t.cancelValue(b.current),t==null||t.registerValue(s.value),b.current=s.value),()=>t==null?void 0:t.cancelValue(s.value)},[s.value]);const c=x("checkbox",a),$=F(c),[P,k,N]=X(c,$),p=Object.assign({},s);t&&!y&&(p.onChange=function(){s.onChange&&s.onChange.apply(s,arguments),t.toggleOption&&t.toggleOption({label:g,value:s.value})},p.name=t.name,p.checked=t.value.includes(s.value));const z=T(`${c}-wrapper`,{[`${c}-rtl`]:j==="rtl",[`${c}-wrapper-checked`]:p.checked,[`${c}-wrapper-disabled`]:v,[`${c}-wrapper-in-form-item`]:E},u==null?void 0:u.className,l,O,N,$,k),B=T({[`${c}-indeterminate`]:C},te,k),D=C?"mixed":void 0;return P(i.createElement(ne,{component:"Checkbox",disabled:v},i.createElement("label",{className:z,style:Object.assign(Object.assign({},u==null?void 0:u.style),S),onMouseEnter:h,onMouseLeave:d},i.createElement(oe,Object.assign({"aria-checked":D},p,{prefixCls:c,className:B,disabled:v,ref:r})),g!==void 0&&i.createElement("span",null,g))))},ue=i.forwardRef(de),_=ue;var be=function(e,r){var o={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&r.indexOf(a)<0&&(o[a]=e[a]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var l=0,a=Object.getOwnPropertySymbols(e);l<a.length;l++)r.indexOf(a[l])<0&&Object.prototype.propertyIsEnumerable.call(e,a[l])&&(o[a[l]]=e[a[l]]);return o};const pe=i.forwardRef((e,r)=>{const{defaultValue:o,children:a,options:l=[],prefixCls:O,className:g,rootClassName:C,style:S,onChange:h}=e,d=be(e,["defaultValue","children","options","prefixCls","className","rootClassName","style","onChange"]),{getPrefixCls:y,direction:w}=i.useContext(G),[s,x]=i.useState(d.value||o||[]),[j,u]=i.useState([]);i.useEffect(()=>{"value"in d&&x(d.value||[])},[d.value]);const t=i.useMemo(()=>l.map(n=>typeof n=="string"||typeof n=="number"?{label:n,value:n}:n),[l]),E=n=>{u(m=>m.filter(f=>f!==n))},I=n=>{u(m=>[].concat(L(m),[n]))},v=n=>{const m=s.indexOf(n.value),f=L(s);m===-1?f.push(n.value):f.splice(m,1),"value"in d||x(f),h==null||h(f.filter(M=>j.includes(M)).sort((M,K)=>{const J=t.findIndex(V=>V.value===M),Q=t.findIndex(V=>V.value===K);return J-Q}))},b=y("checkbox",O),c=`${b}-group`,$=F(b),[P,k,N]=X(b,$),p=ie(d,["value","disabled"]),z=l.length?t.map(n=>i.createElement(_,{prefixCls:b,key:n.value.toString(),disabled:"disabled"in n?n.disabled:d.disabled,value:n.value,checked:s.includes(n.value),onChange:n.onChange,className:`${c}-item`,style:n.style,title:n.title,id:n.id,required:n.required},n.label)):a,B={toggleOption:v,value:s,disabled:d.disabled,name:d.name,registerValue:I,cancelValue:E},D=T(c,{[`${c}-rtl`]:w==="rtl"},g,C,N,$,k);return P(i.createElement("div",Object.assign({className:D,style:S},p,{ref:r}),i.createElement(A.Provider,{value:B},z)))}),me=pe,q=_;q.Group=me,q.__ANT_CHECKBOX=!0;const fe=q;export{fe as C,W as g};
