"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5560],{15560:function(e,t,n){n.r(t),n.d(t,{default:function(){return y}});var r=n(4942),a=n(74902),u=n(97685),o=n(71002),l=n(67294),i=n(94184),c=n.n(i),s=n(96774),f=n.n(s),d=n(21770),v=n(87462),g=n(45987),m=n(1413),h=n(15105),p=l.createContext({min:0,max:0,direction:"ltr",step:1,includedStart:0,includedEnd:0,tabIndex:0});function getDirectionStyle(e,t,n,r){var a=(t-n)/(r-n),u={};switch(e){case"rtl":u.right="".concat(100*a,"%"),u.transform="translateX(50%)";break;case"btt":u.bottom="".concat(100*a,"%"),u.transform="translateY(50%)";break;case"ttb":u.top="".concat(100*a,"%"),u.transform="translateY(-50%)";break;default:u.left="".concat(100*a,"%"),u.transform="translateX(-50%)"}return u}function getIndex(e,t){return Array.isArray(e)?e[t]:e}var b=["prefixCls","value","valueIndex","onStartMove","style","render","dragging","onOffsetChange"],M=l.forwardRef(function(e,t){var n,a,u=e.prefixCls,o=e.value,i=e.valueIndex,s=e.onStartMove,f=e.style,d=e.render,M=e.dragging,x=e.onOffsetChange,C=(0,g.Z)(e,b),y=l.useContext(p),k=y.min,E=y.max,Z=y.direction,S=y.disabled,V=y.range,I=y.tabIndex,D=y.ariaLabelForHandle,w=y.ariaLabelledByForHandle,T=y.ariaValueTextFormatterForHandle,F="".concat(u,"-handle"),onInternalStartMove=function(e){S||s(e,i)},L=getDirectionStyle(Z,o,k,E),P=l.createElement("div",(0,v.Z)({ref:t,className:c()(F,(n={},(0,r.Z)(n,"".concat(F,"-").concat(i+1),V),(0,r.Z)(n,"".concat(F,"-dragging"),M),n)),style:(0,m.Z)((0,m.Z)({},L),f),onMouseDown:onInternalStartMove,onTouchStart:onInternalStartMove,onKeyDown:function(e){if(!S){var t=null;switch(e.which||e.keyCode){case h.Z.LEFT:t="ltr"===Z||"btt"===Z?-1:1;break;case h.Z.RIGHT:t="ltr"===Z||"btt"===Z?1:-1;break;case h.Z.UP:t="ttb"!==Z?1:-1;break;case h.Z.DOWN:t="ttb"!==Z?-1:1;break;case h.Z.HOME:t="min";break;case h.Z.END:t="max";break;case h.Z.PAGE_UP:t=2;break;case h.Z.PAGE_DOWN:t=-2}null!==t&&(e.preventDefault(),x(t,i))}},tabIndex:S?null:getIndex(I,i),role:"slider","aria-valuemin":k,"aria-valuemax":E,"aria-valuenow":o,"aria-disabled":S,"aria-label":getIndex(D,i),"aria-labelledby":getIndex(w,i),"aria-valuetext":null===(a=getIndex(T,i))||void 0===a?void 0:a(o)},C));return d&&(P=d(P,{index:i,prefixCls:u,value:o,dragging:M})),P}),x=["prefixCls","style","onStartMove","onOffsetChange","values","handleRender","draggingIndex"],C=l.forwardRef(function(e,t){var n=e.prefixCls,r=e.style,a=e.onStartMove,u=e.onOffsetChange,o=e.values,i=e.handleRender,c=e.draggingIndex,s=(0,g.Z)(e,x),f=l.useRef({});return l.useImperativeHandle(t,function(){return{focus:function(e){var t;null===(t=f.current[e])||void 0===t||t.focus()}}}),l.createElement(l.Fragment,null,o.map(function(e,t){return l.createElement(M,(0,v.Z)({ref:function(e){e?f.current[t]=e:delete f.current[t]},dragging:c===t,prefixCls:n,style:getIndex(r,t),key:t,value:e,valueIndex:t,onStartMove:a,onOffsetChange:u,render:i},s))}))});function getPosition(e){var t="touches"in e?e.touches[0]:e;return{pageX:t.pageX,pageY:t.pageY}}function useDrag(e,t,n,r,o,i,c,s,f){var d=l.useState(null),v=(0,u.Z)(d,2),g=v[0],m=v[1],h=l.useState(-1),p=(0,u.Z)(h,2),b=p[0],M=p[1],x=l.useState(n),C=(0,u.Z)(x,2),y=C[0],k=C[1],E=l.useState(n),Z=(0,u.Z)(E,2),S=Z[0],V=Z[1],I=l.useRef(null),D=l.useRef(null);l.useEffect(function(){-1===b&&k(n)},[n,b]),l.useEffect(function(){return function(){document.removeEventListener("mousemove",I.current),document.removeEventListener("mouseup",D.current),document.removeEventListener("touchmove",I.current),document.removeEventListener("touchend",D.current)}},[]);var flushValues=function(e,t){y.some(function(t,n){return t!==e[n]})&&(void 0!==t&&m(t),k(e),c(e))},updateCacheValue=function(e,t){if(-1===e){var n=S[0],u=S[S.length-1],l=r-n,c=t*(o-r);c=i(n+(c=Math.min(c=Math.max(c,l),o-u)))-n,flushValues(S.map(function(e){return e+c}))}else{var s=(0,a.Z)(y);s[e]=S[e];var d=f(s,(o-r)*t,e,"dist");flushValues(d.values,d.value)}},w=l.useRef(updateCacheValue);return w.current=updateCacheValue,[b,g,l.useMemo(function(){var e=(0,a.Z)(n).sort(function(e,t){return e-t}),t=(0,a.Z)(y).sort(function(e,t){return e-t});return e.every(function(e,n){return e===t[n]})?y:n},[n,y]),function(r,a){r.stopPropagation();var u=n[a];M(a),m(u),V(n);var o=getPosition(r),l=o.pageX,i=o.pageY,onMouseMove=function(n){n.preventDefault();var r,u=getPosition(n),o=u.pageX,c=u.pageY,s=o-l,f=c-i,d=e.current.getBoundingClientRect(),v=d.width,g=d.height;switch(t){case"btt":r=-f/g;break;case"ttb":r=f/g;break;case"rtl":r=-s/v;break;default:r=s/v}w.current(a,r)},onMouseUp=function onMouseUp(e){e.preventDefault(),document.removeEventListener("mouseup",onMouseUp),document.removeEventListener("mousemove",onMouseMove),document.removeEventListener("touchend",onMouseUp),document.removeEventListener("touchmove",onMouseMove),I.current=null,D.current=null,M(-1),s()};document.addEventListener("mouseup",onMouseUp),document.addEventListener("mousemove",onMouseMove),document.addEventListener("touchend",onMouseUp),document.addEventListener("touchmove",onMouseMove),I.current=onMouseMove,D.current=onMouseUp}]}function Track(e){var t=e.prefixCls,n=e.style,r=e.start,a=e.end,u=e.index,o=e.onStartMove,i=l.useContext(p),s=i.direction,f=i.min,d=i.max,v=i.disabled,g=i.range,h="".concat(t,"-track"),b=(r-f)/(d-f),M=(a-f)/(d-f),onInternalStartMove=function(e){!v&&o&&o(e,-1)},x={};switch(s){case"rtl":x.right="".concat(100*b,"%"),x.width="".concat(100*M-100*b,"%");break;case"btt":x.bottom="".concat(100*b,"%"),x.height="".concat(100*M-100*b,"%");break;case"ttb":x.top="".concat(100*b,"%"),x.height="".concat(100*M-100*b,"%");break;default:x.left="".concat(100*b,"%"),x.width="".concat(100*M-100*b,"%")}return l.createElement("div",{className:c()(h,g&&"".concat(h,"-").concat(u+1)),style:(0,m.Z)((0,m.Z)({},x),n),onMouseDown:onInternalStartMove,onTouchStart:onInternalStartMove})}function Tracks(e){var t=e.prefixCls,n=e.style,r=e.values,a=e.startPoint,u=e.onStartMove,o=l.useContext(p),i=o.included,c=o.range,s=o.min,f=l.useMemo(function(){if(!c){if(0===r.length)return[];var e=null!=a?a:s,t=r[0];return[{start:Math.min(e,t),end:Math.max(e,t)}]}for(var n=[],u=0;u3&&void 0!==arguments[3]?arguments[3]:"unit";if("number"==typeof o){var s,f=u[l],d=f+o,v=[];r.forEach(function(e){v.push(e.value)}),v.push(e,t),v.push(c(f));var g=o>0?1:-1;"unit"===i?v.push(c(f+g*n)):v.push(c(d)),v=v.filter(function(e){return null!==e}).filter(function(e){return o<0?e<=f:e>=f}),"unit"===i&&(v=v.filter(function(e){return e!==f}));var m="unit"===i?f:d,h=Math.abs((s=v[0])-m);if(v.forEach(function(e){var t=Math.abs(e-m);t1){var p=(0,a.Z)(u);return p[l]=s,offsetValue(p,o-g,l,i)}return s}return"min"===o?e:"max"===o?t:void 0},offsetChangedValue=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unit",a=e[n],u=offsetValue(e,t,n,r);return{value:u,changed:u!==a}},needPush=function(e){return null===o&&0===e||"number"==typeof o&&e3&&void 0!==arguments[3]?arguments[3]:"unit",a=e.map(s),l=a[n],i=offsetValue(a,t,n,r);if(a[n]=i,!1===u){var c=o||0;n>0&&a[n-1]!==l&&(a[n]=Math.max(a[n],a[n-1]+c)),n0;g-=1)for(var m=!0;needPush(a[g]-a[g-1])&&m;){var h=offsetChangedValue(a,-1,g-1);a[g-1]=h.value,m=h.changed}for(var p=a.length-1;p>0;p-=1)for(var b=!0;needPush(a[p]-a[p-1])&&b;){var M=offsetChangedValue(a,-1,p-1);a[p-1]=M.value,b=M.changed}for(var x=0;x=0&&O},[O,ei]),es=l.useMemo(function(){return Object.keys(K||{}).map(function(e){var t=K[e],n={value:Number(e)};return t&&"object"===(0,o.Z)(t)&&!l.isValidElement(t)&&("label"in t||"style"in t)?(n.style=t.style,n.label=t.label):n.label=t,n}).filter(function(e){var t=e.label;return t||"number"==typeof t}).sort(function(e,t){return e.value-t.value})},[K]),ef=useOffset(eo,el,ei,es,void 0===R||R,ec),ed=(0,u.Z)(ef,2),ev=ed[0],eg=ed[1],em=(0,d.Z)(D,{value:I}),eh=(0,u.Z)(em,2),ep=eh[0],eb=eh[1],eM=l.useMemo(function(){var e=null==ep?[]:Array.isArray(ep)?ep:[ep],t=(0,u.Z)(e,1)[0],n=void 0===t?eo:t,r=null===ep?[]:[n];if(w){if(r=(0,a.Z)(e),T||void 0===ep){var o,l=T>=0?T+1:2;for(r=r.slice(0,l);r.length=0&&er.current.focus(e)}eE(null)},[ek]);var eZ=l.useMemo(function(){return(!H||null!==ei)&&H},[H,ei]),eS=useDrag(ea,eu,eM,eo,el,ev,triggerChange,function(){null==P||P(getTriggerValue(ex.current))},eg),eV=(0,u.Z)(eS,4),eI=eV[0],eD=eV[1],ew=eV[2],eT=eV[3],onStartMove=function(e,t){eT(e,t),null==L||L(getTriggerValue(ex.current))},eF=-1!==eI;l.useEffect(function(){if(!eF){var e=eM.lastIndexOf(eD);er.current.focus(e)}},[eF]);var eL=l.useMemo(function(){return(0,a.Z)(ew).sort(function(e,t){return e-t})},[ew]),eP=l.useMemo(function(){return w?[eL[0],eL[eL.length-1]]:[eo,eL[0]]},[eL,w,eo]),eR=(0,u.Z)(eP,2),eN=eR[0],eO=eR[1];l.useImperativeHandle(t,function(){return{focus:function(){er.current.focus(0)},blur:function(){var e=document.activeElement;ea.current.contains(e)&&(null==e||e.blur())}}}),l.useEffect(function(){b&&er.current.focus(0)},[]);var eH=l.useMemo(function(){return{min:eo,max:el,direction:eu,disabled:h,step:ei,included:X,includedStart:eN,includedEnd:eO,range:w,tabIndex:$,ariaLabelForHandle:ee,ariaLabelledByForHandle:et,ariaValueTextFormatterForHandle:en}},[eo,el,eu,h,ei,X,eN,eO,w,$,ee,et,en]);return l.createElement(p.Provider,{value:eH},l.createElement("div",{ref:ea,className:c()(s,v,(n={},(0,r.Z)(n,"".concat(s,"-disabled"),h),(0,r.Z)(n,"".concat(s,"-vertical"),A),(0,r.Z)(n,"".concat(s,"-horizontal"),!A),(0,r.Z)(n,"".concat(s,"-with-marks"),es.length),n)),style:g,onMouseDown:function(e){e.preventDefault();var t,n=ea.current.getBoundingClientRect(),r=n.width,a=n.height,u=n.left,o=n.top,l=n.bottom,i=n.right,c=e.clientX,s=e.clientY;switch(eu){case"btt":t=(l-s)/a;break;case"ttb":t=(s-o)/a;break;case"rtl":t=(i-c)/r;break;default:t=(c-u)/r}changeToCloseValue(ev(eo+t*(el-eo)))}},l.createElement("div",{className:"".concat(s,"-rail"),style:j}),l.createElement(Tracks,{prefixCls:s,style:_,values:eL,startPoint:Y,onStartMove:eZ?onStartMove:null}),l.createElement(Steps,{prefixCls:s,marks:es,dots:q,style:W,activeStyle:z}),l.createElement(C,{ref:er,prefixCls:s,style:G,values:ew,draggingIndex:eI,onStartMove:onStartMove,onOffsetChange:function(e,t){if(!h){var n=eg(eM,e,t);null==L||L(getTriggerValue(eM)),triggerChange(n.values),null==P||P(getTriggerValue(n.values)),eE(n.value)}},onFocus:M,onBlur:x,handleRender:J}),l.createElement(Marks,{prefixCls:s,marks:es,onClick:changeToCloseValue})))})}}]);