import{d as E,A as f,a as V,j as o,e as W,h,_ as F,q as I,P as M}from"./preload-helper.BAt0wiQU.js";var R=function(t,r){var c={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&r.indexOf(n)<0&&(c[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(t);a<n.length;a++)r.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(t,n[a])&&(c[n[a]]=t[n[a]]);return c};const T={prefixCls:String,name:String,id:String,type:String,defaultChecked:{type:[Boolean,Number],default:void 0},checked:{type:[Boolean,Number],default:void 0},disabled:Boolean,tabindex:{type:[Number,String]},readonly:Boolean,autofocus:Boolean,value:M.any,required:Boolean},G=E({compatConfig:{MODE:3},name:"Checkbox",inheritAttrs:!1,props:I(T,{prefixCls:"rc-checkbox",type:"checkbox",defaultChecked:!1}),emits:["click","change"],setup(t,r){let{attrs:c,emit:n,expose:a}=r;const d=f(t.checked===void 0?t.defaultChecked:t.checked),s=f();V(()=>t.checked,()=>{d.value=t.checked}),a({focus(){var e;(e=s.value)===null||e===void 0||e.focus()},blur(){var e;(e=s.value)===null||e===void 0||e.blur()}});const i=f(),y=e=>{if(t.disabled)return;t.checked===void 0&&(d.value=e.target.checked),e.shiftKey=i.value;const u={target:o(o({},t),{checked:e.target.checked}),stopPropagation(){e.stopPropagation()},preventDefault(){e.preventDefault()},nativeEvent:e};t.checked!==void 0&&(s.value.checked=!!t.checked),n("change",u),i.value=!1},k=e=>{n("click",e),i.value=e.shiftKey};return()=>{const{prefixCls:e,name:u,id:g,type:m,disabled:b,readonly:x,tabindex:C,autofocus:O,value:P,required:S}=t,_=R(t,["prefixCls","name","id","type","disabled","readonly","tabindex","autofocus","value","required"]),{class:j,onFocus:B,onBlur:K,onKeydown:N,onKeypress:w,onKeyup:q}=c,v=o(o({},_),c),A=Object.keys(v).reduce((p,l)=>((l.startsWith("data-")||l.startsWith("aria-")||l==="role")&&(p[l]=v[l]),p),{}),D=W(e,j,{["".concat(e,"-checked")]:d.value,["".concat(e,"-disabled")]:b}),$=o(o({name:u,id:g,type:m,readonly:x,disabled:b,tabindex:C,class:"".concat(e,"-input"),checked:!!d.value,autofocus:O,value:P},A),{onChange:y,onClick:k,onFocus:B,onBlur:K,onKeydown:N,onKeypress:w,onKeyup:q,required:S});return h("span",{class:D},[h("input",F({ref:s},$),null),h("span",{class:"".concat(e,"-inner")},null)])}}});export{G as V};
