const e=require("../_util/classNames.js"),t=require("../_util/props-util/initDefaultProps.js"),n=require("../_util/vue-types/index.js");let r=require("vue");var i={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:n.default.any,required:Boolean},a=(0,r.defineComponent)({compatConfig:{MODE:3},name:`Checkbox`,inheritAttrs:!1,props:t.default(i,{prefixCls:`rc-checkbox`,type:`checkbox`,defaultChecked:!1}),emits:[`click`,`change`],setup(t,{attrs:n,emit:i,expose:a}){let o=(0,r.ref)(t.checked===void 0?t.defaultChecked:t.checked),s=(0,r.ref)();(0,r.watch)(()=>t.checked,()=>{o.value=t.checked}),a({focus(){s.value?.focus()},blur(){s.value?.blur()}});let c=(0,r.ref)(),l=e=>{if(t.disabled)return;t.checked===void 0&&(o.value=e.target.checked),e.shiftKey=c.value;let n={target:{...t,checked:e.target.checked},stopPropagation(){e.stopPropagation()},preventDefault(){e.preventDefault()},nativeEvent:e};t.checked!==void 0&&(s.value.checked=!!t.checked),i(`change`,n),c.value=!1},u=e=>{i(`click`,e),c.value=e.shiftKey};return()=>{let{prefixCls:i,name:a,id:c,type:d,disabled:f,readonly:p,tabindex:m,autofocus:h,value:g,required:_,...v}=t,{class:y,onFocus:b,onBlur:x,onKeydown:S,onKeypress:C,onKeyup:w}=n,T={...v,...n},E=Object.keys(T).reduce((e,t)=>((t.startsWith(`data-`)||t.startsWith(`aria-`)||t===`role`)&&(e[t]=T[t]),e),{}),D=e.default(i,y,{[`${i}-checked`]:o.value,[`${i}-disabled`]:f}),O={name:a,id:c,type:d,readonly:p,disabled:f,tabindex:m,class:`${i}-input`,checked:!!o.value,autofocus:h,value:g,...E,onChange:l,onClick:u,onFocus:b,onBlur:x,onKeydown:S,onKeypress:C,onKeyup:w,required:_};return(0,r.createVNode)(`span`,{class:D},[(0,r.createVNode)(`input`,{ref:s,...O},null),(0,r.createVNode)(`span`,{class:`${i}-inner`},null)])}}});exports.checkboxProps=i,exports.default=a;