const e=require("../../_util/classNames.js"),t=require("../../vc-util/Dom/addEventListener.js"),n=require("../../_util/vue-types/index.js");let r=require("vue");var i=(0,r.defineComponent)({compatConfig:{MODE:3},name:`Handle`,inheritAttrs:!1,props:{prefixCls:String,vertical:{type:Boolean,default:void 0},offset:Number,disabled:{type:Boolean,default:void 0},min:Number,max:Number,value:Number,tabindex:n.default.oneOfType([n.default.number,n.default.string]),reverse:{type:Boolean,default:void 0},ariaLabel:String,ariaLabelledBy:String,ariaValueTextFormatter:Function,onMouseenter:{type:Function},onMouseleave:{type:Function},onMousedown:{type:Function}},setup(n,{attrs:i,emit:a,expose:o}){let s=(0,r.shallowRef)(!1),c=(0,r.shallowRef)(),l=()=>{document.activeElement===c.value&&(s.value=!0)},u=e=>{s.value=!1,a(`blur`,e)},d=()=>{s.value=!1},f=()=>{c.value?.focus()},p=()=>{c.value?.blur()},m=()=>{s.value=!0,f()},h=e=>{e.preventDefault(),f(),a(`mousedown`,e)};o({focus:f,blur:p,clickFocus:m,ref:c});let g=null;(0,r.onMounted)(()=>{g=t.default(document,`mouseup`,l)}),(0,r.onBeforeUnmount)(()=>{g?.remove()});let _=(0,r.computed)(()=>{let{vertical:e,offset:t,reverse:r}=n;return e?{[r?`top`:`bottom`]:`${t}%`,[r?`bottom`:`top`]:`auto`,transform:r?null:`translateY(+50%)`}:{[r?`right`:`left`]:`${t}%`,[r?`left`:`right`]:`auto`,transform:`translateX(${r?`+`:`-`}50%)`}});return()=>{let{prefixCls:t,disabled:a,min:o,max:l,value:f,tabindex:p,ariaLabel:m,ariaLabelledBy:g,ariaValueTextFormatter:v,onMouseenter:y,onMouseleave:b}=n,x=e.default(i.class,{[`${t}-handle-click-focused`]:s.value}),S={"aria-valuemin":o,"aria-valuemax":l,"aria-valuenow":f,"aria-disabled":!!a},C=[i.style,_.value],w=p||0;(a||p===null)&&(w=null);let T;return v&&(T=v(f)),(0,r.createVNode)(`div`,{...i,role:`slider`,tabindex:w,...S,class:x,onBlur:u,onKeydown:d,onMousedown:h,onMouseenter:y,onMouseleave:b,ref:c,style:C,"aria-label":m,"aria-labelledby":g,"aria-valuetext":T},null)}}});exports.default=i;