(window.webpackJsonpvtex_store_drawer_0_18_1=window.webpackJsonpvtex_store_drawer_0_18_1||[]).push([[0],{35:function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return h}));var o=n(3),i=n(21),r=n(22),s=n(24),a=n(23),u=n(14),c=n(0),l=n.n(c);var p=function(e){if("number"==typeof e)return[e,"px",!0];var t=e.match(/([-\d]*)([^0-9\n]+)/);if(!t)return null;var n=Object(o.a)(t,3),i=n[1],r=n[2];return[parseInt(i,10),r,!1]},f=[];function d(e){var t=e.object,n=e.prop,i=e.target,r=e.duration,s=e.speed,a=e.acceleration,u=e.maxSpeed,c=e.onUpdate,l=void 0===c?void 0:c,d=e.onComplete,m=void 0===d?void 0:d,g=p(i),h=Object(o.a)(g,3),v=h[0],w=h[1],D=h[2],b=p(t[n]),S=Object(o.a)(b,2),P=S[0],O=S[1],y=D?O:w,T=v-P,j=!1,L=function(){j=!0},E=r?0:P,k=null;!function e(o){if(!j){var i,c=1;if(null!=k)(c=(o-k)/(1e3/60))>2&&(c=2);if(k=o,r){(E+=1e3/60/(1e3*r)*c)>=1&&(E=1,null!=m&&m(),L());var p="".concat(P+(i=E,i*(2-i)*T)).concat(y);t[n]=p,null!=l&&l(p)}else if(s){E+=s/(60*c),a&&(s*=a),u&&s>u&&(s=u),(s>0&&E>=v||s<0&&E<=v)&&(E=v,null!=m&&m(),L());var f="".concat(E).concat(y);t[n]=f,null!=l&&l(f)}requestAnimationFrame(e)}}();var C,x={object:(C={object:t,prop:n,stop:L,isStopped:function(){return j}}).object,prop:C.prop,stop:C.stop,isStopped:C.isStopped};return function(e){f.filter((function(t){return t.object===e.object&&t.prop===e.prop&&t.stop(),!t.isStopped()}))}(x),f.push(x),L}function m(e){if(function(e){return!!e.clientX}(e))return{x:e.clientX,y:e.clientY,source:"mouse",timeStamp:e.timeStamp};if(!function(e){return"touches"in e}(e))return null;var t=e.touches[0];return{x:t.clientX,y:t.clientY,source:"touch",timeStamp:e.timeStamp}}function g(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,o=Object(u.a)(e);if(t){var i=Object(u.a)(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return Object(a.a)(this,n)}}var h=function(e){Object(s.a)(n,e);var t=g(n);function n(e){var r;return Object(i.a)(this,n),(r=t.call(this,e)).handleClick=function(e){(r.wasDragging||r.isPointerDown)&&(e.preventDefault(),e.stopPropagation()),r.wasDragging=!1},r.updatePosition=function(){r.momentumTimeout&&(clearTimeout(r.momentumTimeout),r.momentumTimeout=null),r.offsetAnimation.value=r.offset,d(Object.assign(Object.assign({object:r.offsetAnimation,prop:"value",target:r.getOffsetFromPosition()},r.momentum?{speed:r.momentum,acceleration:1.25}:{duration:.25}),{onUpdate:function(e){r.setOffset(e)}})),r.momentum=null},r.getOffsetFromPosition=function(){switch(r.props.position){case"center":return 0;case"right":return r.props.positionRight;case"left":return r.props.positionLeft;default:return 0}},r.handleDragStart=function(e){var t;if(!r.isPointerDown&&r.props.enabled&&(r.props.allowOutsideDrag||(null===(t=r.dragContainer.current)||void 0===t?void 0:t.contains(e.target)))){var n=m(e);null!==n&&(r.isPointerDown=!0,r.isScrolling=!1,r.isDragging=!1,r.stopAnimation(),r.dragStartPos=Object.assign({},n),r.previousDragPositions=[n],r.willTrigger=null,r.dispatchTriggerChange(r.willTrigger))}},r.dispatchTriggerChange=function(e){var t=r.props.onTriggerChange;t&&t(e)},r.handleDragMove=function(e){var t=r.props,n=t.onDragStart,o=t.onLockScroll,i=t.onSwipeLeft,s=t.onSwipeRight,a=t.enabled,u=t.rubberBanding;if(r.isPointerDown&&!r.isScrolling){var c=m(e);if(null!==c){var l=r.previousDragPositions[r.previousDragPositions.length-1];if(!l||c.source===l.source){var p=15,f=10,d={x:c.x-r.dragStartPos.x,y:c.y-r.dragStartPos.y};if(r.isDragging){r.offset=d.x;var g=function(e){return u?.3*e:0};(!a||!i&&r.offset<0||!a||!s&&r.offset>0)&&(r.offset=g(r.offset)),r.setOffset(r.offset),r.previousDragPositions.push(c);var h=r.checkTrigger();r.willTrigger!=h&&r.dispatchTriggerChange(h),r.willTrigger=h}else Math.abs(d.x)>=p?(r.isDragging=!0,n(),o()):Math.abs(d.y)>=f&&(r.isScrolling=!0)}}}},r.setOffset=function(e){r.dragContainer&&r.dragContainer.current&&(r.props.onSetPosition({element:r.props.element||r.dragContainer.current,offset:e}),r.props.onUpdateOffset(e)),r.offset=e},r.setMomentum=function(e,t){var n,i=null!==(n=p(t))&&void 0!==n?n:[],s=Object(o.a)(i,2)[1];if(null!=r.dragContainer.current){if("%"===s){var a=r.dragContainer.current.getBoundingClientRect().width;r.offset="".concat(Number(r.offset)/a*100,"%"),e=e/a*100}r.momentum=e,r.momentumTimeout&&clearTimeout(r.momentumTimeout),r.momentumTimeout=setTimeout((function(){r.momentum=null,r.momentumTimeout=null}),100)}},r.checkTrigger=function(){if(!r.props.enabled)return null;var e=60*r.previousDragPositions.slice(-6).map((function(e,t,n){var o=n[t-1];return null==o?null:e.x-o.x})).filter((function(e){return null!=e})).reduce((function(e,t){return e+(null!=t?t:0)/6}),0),t=r.props,n=t.onSwipeLeft,o=t.onSwipeRight,i=n&&e<0&&r.offset<-r.props.threshold,s=o&&e>0&&r.offset>r.props.threshold;return i?{type:"left",speed:e}:s?{type:"right",speed:e}:null},r.handleDragEnd=function(e){if(r.isPointerDown&&r.isDragging){e.preventDefault(),e.stopPropagation();var t=r.checkTrigger();if(t)switch(t.type){case"left":r.props.preserveMomentum&&r.setMomentum(t.speed,r.props.positionLeft),r.props.onSwipeLeft();break;case"right":r.props.preserveMomentum&&r.setMomentum(t.speed,r.props.positionRight),r.props.onSwipeRight()}else r.offsetAnimation.value=r.offset,d({object:r.offsetAnimation,prop:"value",target:0,duration:.2,onUpdate:function(e){r.setOffset(e)}});r.props.onDragEnd(),r.props.onUnlockScroll()}r.isScrolling=!1,r.wasDragging=r.isPointerDown&&r.isDragging,r.isPointerDown=!1},r.dragContainer=l.a.createRef(),r.stopAnimation=function(){},r.isPointerDown=!1,r.isDragging=!1,r.isScrolling=!1,r.wasDragging=!1,r.offset=r.getOffsetFromPosition(),r.offsetAnimation={value:r.offset},r.momentum=null,r.momentumTimeout=null,r.dragStartPos={x:0,y:0},r.previousDragPositions=[],r.willTrigger=null,r}return Object(r.a)(n,[{key:"componentDidMount",value:function(){window&&window.document&&(window.document.addEventListener("mousedown",this.handleDragStart),window.document.addEventListener("touchstart",this.handleDragStart),window.document.addEventListener("mousemove",this.handleDragMove),window.document.addEventListener("touchmove",this.handleDragMove),window.document.addEventListener("mouseup",this.handleDragEnd),window.document.addEventListener("touchend",this.handleDragEnd),window.document.addEventListener("click",this.handleClick,{capture:!0}))}},{key:"componentWillUnmount",value:function(){window&&window.document&&(window.document.removeEventListener("mousedown",this.handleDragStart),window.document.removeEventListener("touchstart",this.handleDragStart),window.document.removeEventListener("mousemove",this.handleDragMove),window.document.removeEventListener("touchmove",this.handleDragMove),window.document.removeEventListener("mouseup",this.handleDragEnd),window.document.removeEventListener("touchend",this.handleDragEnd),window.document.removeEventListener("click",this.handleClick,{capture:!0}))}},{key:"componentDidUpdate",value:function(e){e.enabled&&!this.props.enabled&&this.isPointerDown&&(this.isPointerDown=!1),e.position!==this.props.position&&this.updatePosition()}},{key:"render",value:function(){return l.a.createElement("div",{"aria-hidden":this.props.enabled?"false":"true",ref:this.dragContainer,style:Object.assign(Object.assign({},this.props.style),{transform:"translate3d(".concat(this.getOffsetFromPosition(),", 0, 0)")}),className:this.props.className},this.props.children)}}]),n}(l.a.Component);h.defaultProps={onSwipeLeft:null,leftTargetPosition:null,onSwipeRight:null,rightTargetPosition:null,onTriggerChange:null,position:"center",onLockScroll:function(){},onUnlockScroll:function(){},onDragStart:function(){},onDragEnd:function(){},onSetPosition:function(e){var t=e.element,n=e.offset,o="number"==typeof n?"px":"";t.style.transform="translate3d(".concat(n).concat(o,",0,0)")},onUpdateOffset:function(){},element:null,threshold:0,enabled:!0,rubberBanding:!1,style:{},positionRight:"100%",positionLeft:"-100%",preserveMomentum:!0,allowOutsideDrag:!1}}}]);