react-use-gesture
Advanced tools
Comparing version 8.1.0-alpha.12 to 8.1.0-beta.1
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),n=(e=t)&&"object"==typeof e&&"default"in e?e.default:e;function r(e,t){return e.map((function(e,n){return e+t[n]}))}function i(e,t){return e.map((function(e,n){return e-t[n]}))}function o(e){return Math.hypot.apply(Math,e)}function a(e,t){void 0===t&&(t=e);var n=o(t),r=0===n?0:1/n,i=t.map((function(e){return r*e}));return{distance:o(e),direction:i}}function s(e,t,n){var r=o(t),i=0===r?0:1/r,a=0===n?0:1/n,s=a*r,u=t.map((function(e){return a*e})),c=t.map((function(e){return i*e}));return{velocities:u,velocity:s,distance:o(e),direction:c}}function u(e){return Math.sign?Math.sign(e):Number(e>0)-Number(e<0)||+e}function c(e,t,n){return 0===t||Infinity===Math.abs(t)?function(e,t){return Math.pow(e,5*t)}(e,n):e*t*n/(t+n*e)}function l(e,t,n,r){return void 0===r&&(r=.15),0===r?function(e,t,n){return Math.max(t,Math.min(e,n))}(e,t,n):e<t?-c(t-e,n-t,r)+t:e>n?+c(e-n,n-t,r)+n:e}function d(){return(d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function v(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function f(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)t.indexOf(n=o[r])>=0||(i[n]=e[n]);return i}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function g(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return p(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function m(){}function y(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?m:1===t.length?t[0]:function(){for(var e,n,r=g(t);!(n=r()).done;){var i=n.value;e=i.apply(this,arguments)||e}return e}}function S(e,t){if(void 0===e){if(void 0===t)throw new Error("Must define fallback value if undefined is expected");e=t}return Array.isArray(e)?e:[e,e]}function w(e,t){return Object.assign({},t,e||{})}function b(e){if("function"==typeof e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return e.apply(void 0,n)}return e}function _(e,t){void 0===e&&(e={});for(var n={},r=0,i=Object.entries(t);r<i.length;r++){var o=i[r],a=o[0],s=o[1];switch(typeof s){case"function":n[a]=s.call(n,e[a],a,e);break;case"object":n[a]=_(e[a],s);break;case"boolean":s&&(n[a]=e[a])}}return n}var T={threshold:function(e){return void 0===e&&(e=0),S(e)},rubberband:function(e){switch(void 0===e&&(e=0),e){case!0:return S(.15);case!1:return S(0);default:return S(e)}},enabled:function(e){return void 0===e&&(e=!0),e},triggerAllEvents:function(e){return void 0===e&&(e=!1),e},initial:function(e){return void 0===e&&(e=0),"function"==typeof e?e:S(e)},transform:!0},G=d({},T,{axis:!0,lockDirection:function(e){return void 0===e&&(e=!1),e},bounds:function(e){if(void 0===e&&(e={}),"function"==typeof e)return function(t){return G.bounds(e(t))};var t=e.left,n=e.right,r=e.top,i=e.bottom;return[[void 0===t?-Infinity:t,void 0===n?Infinity:n],[void 0===r?-Infinity:r,void 0===i?Infinity:i]]}}),M="undefined"!=typeof window&&window.document&&window.document.createElement,O={enabled:function(e){return void 0===e&&(e=!0),e},domTarget:!0,window:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(e){return void 0===e&&(e=M?window:void 0),e})),eventOptions:function(e){var t=void 0===e?{}:e,n=t.passive,r=t.capture;return{passive:void 0===n||n,capture:void 0!==r&&r}},transform:!0},x=d({},T,{bounds:function(e,t,n){var r=n.distanceBounds,i=void 0===r?{}:r,o=n.angleBounds,a=void 0===o?{}:o,s=function(e){var t=w(b(i,e),{min:-Infinity,max:Infinity});return[t.min,t.max]},u=function(e){var t=w(b(a,e),{min:-Infinity,max:Infinity});return[t.min,t.max]};return"function"!=typeof i&&"function"!=typeof a?[s(),u()]:function(e){return[s(e),u(e)]}}}),E=d({},G,{experimental_preventWindowScrollY:function(e){return void 0===e&&(e=!1),e},threshold:function(e,t,n){var r=n.filterTaps,i=void 0!==r&&r,o=n.lockDirection,a=n.axis,s=S(e,i?3:void 0!==o&&o||(void 0===a?void 0:a)?1:0);return this.filterTaps=i,s},swipeVelocity:function(e){return void 0===e&&(e=.5),S(e)},swipeDistance:function(e){return void 0===e&&(e=60),S(e)},delay:function(e){switch(void 0===e&&(e=0),e){case!0:return 180;case!1:return 0;default:return e}}});function P(e){return void 0===e&&(e={}),_(e,O)}function K(e){return void 0===e&&(e={}),_(e,G)}function D(e){return void 0===e&&(e={}),_(e,x)}function C(e){return void 0===e&&(e={}),_(e,E)}function k(e){var t=e.domTarget,n=e.eventOptions,r=e.window,i=e.enabled,o=f(e,["domTarget","eventOptions","window","enabled"]),a=P({domTarget:t,eventOptions:n,window:r,enabled:i});return a.move=K(o),a}function I(e){var t=e.domTarget,n=e.eventOptions,r=e.window,i=e.enabled,o=f(e,["domTarget","eventOptions","window","enabled"]),a=P({domTarget:t,eventOptions:n,window:r,enabled:i});return a.hover=d({enabled:!0},o),a}function j(e){var t=e.domTarget,n=e.eventOptions,r=e.window,i=e.enabled,o=f(e,["domTarget","eventOptions","window","enabled"]),a=P({domTarget:t,eventOptions:n,window:r,enabled:i});return a.drag=C(o),a}function H(e){var t=e.domTarget,n=e.eventOptions,r=e.window,i=e.enabled,o=f(e,["domTarget","eventOptions","window","enabled"]),a=P({domTarget:t,eventOptions:n,window:r,enabled:i});return a.pinch=D(o),a}function W(e){var t=e.domTarget,n=e.eventOptions,r=e.window,i=e.enabled,o=f(e,["domTarget","eventOptions","window","enabled"]),a=P({domTarget:t,eventOptions:n,window:r,enabled:i});return a.scroll=K(o),a}function A(e){var t=e.domTarget,n=e.eventOptions,r=e.window,i=e.enabled,o=f(e,["domTarget","eventOptions","window","enabled"]),a=P({domTarget:t,eventOptions:n,window:r,enabled:i});return a.wheel=K(o),a}function Y(e){return d({_active:!1,_blocked:!1,_intentional:[!1,!1],_movement:[0,0],_initial:[0,0],_bounds:[[-Infinity,Infinity],[-Infinity,Infinity]],_lastEventType:void 0,_dragStarted:!1,_dragPreventScroll:!1,_dragIsTap:!0,_dragDelayed:!1,event:void 0,intentional:!1,values:[0,0],velocities:[0,0],delta:[0,0],movement:[0,0],offset:[0,0],lastOffset:[0,0],direction:[0,0],initial:[0,0],previous:[0,0],first:!1,last:!1,active:!1,timeStamp:0,startTime:0,elapsedTime:0,cancel:m,canceled:!1,memo:void 0,args:void 0},e)}function L(){return{shared:{hovering:!1,scrolling:!1,wheeling:!1,dragging:!1,moving:!1,pinching:!1,touches:0,buttons:0,down:!1,shiftKey:!1,altKey:!1,metaKey:!1,ctrlKey:!1},drag:Y({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0,tap:!1,swipe:[0,0]}),pinch:Y({da:[0,0],vdva:[0,0],origin:void 0,turns:0}),wheel:Y({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0}),move:Y({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0}),scroll:Y({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0})}}var R=new Map,V=function(){function e(e,t){var n=this;void 0===t&&(t=[]),this.controller=e,this.args=t,this.debounced=!0,this.setTimeout=function(e,t){var r;void 0===t&&(t=140),clearTimeout(n.controller.timeouts[n.stateKey]);for(var i=arguments.length,o=new Array(i>2?i-2:0),a=2;a<i;a++)o[a-2]=arguments[a];n.controller.timeouts[n.stateKey]=(r=window).setTimeout.apply(r,[e,t].concat(o))},this.clearTimeout=function(){clearTimeout(n.controller.timeouts[n.stateKey])},this.fireGestureHandler=function(e){if(void 0===e&&(e=!1),n.state._blocked)return n.debounced||(n.state._active=!1,n.clean()),null;if(!e&&!n.state.intentional&&!n.config.triggerAllEvents)return null;if(n.state.intentional){var t=n.state.active,r=n.state._active;n.state.active=r,n.state.first=r&&!t,n.state.last=t&&!r,n.controller.state.shared[n.ingKey]=r}var i=d({},n.controller.state.shared,n.state,n.mapStateValues(n.state)),o=n.handler(i);return n.state.memo=void 0!==o?o:n.state.memo,i}}var t,n=e.prototype;return n.updateSharedState=function(e){Object.assign(this.controller.state.shared,e)},n.updateGestureState=function(e){Object.assign(this.state,e)},n.checkIntentionality=function(e,t){return{_intentional:e,_blocked:!1}},n.getMovement=function(e){var t=this.config,n=t.initial,o=t.bounds,a=t.rubberband,s=t.threshold,u=this.state,c=u._bounds,l=u._initial,v=u._active,f=u._intentional,h=u.lastOffset,p=u.movement,g=this.getInternalMovement(e,this.state),m=!1===f[0]?X(g[0],s[0]):f[0],y=!1===f[1]?X(g[1],s[1]):f[1],S=this.checkIntentionality([m,y],g);if(S._blocked)return d({},S,{_movement:g,delta:[0,0]});var w,_,T,G,M=S._intentional,O=g;!1!==M[0]&&!1===f[0]&&(_=b(n,this.state),w=b(o,this.state),l[0]=_[0],c[0]=w[0]),!1!==M[1]&&!1===f[1]&&(_=null!=(T=_)?T:b(n,this.state),w=null!=(G=w)?G:b(o,this.state),l[1]=_[1],c[1]=w[1]);var x=[!1!==M[0]?g[0]-M[0]:l[0],!1!==M[1]?g[1]-M[1]:l[1]],E=r(x,h),P=v?a:[0,0];return x=B(c,r(x,l),P),d({},S,{intentional:!1!==M[0]||!1!==M[1],_initial:l,_movement:O,movement:x,values:e,offset:B(c,E,P),delta:i(x,p)})},n.clean=function(){this.clearTimeout()},(t=[{key:"config",get:function(){return this.controller.config[this.stateKey]}},{key:"enabled",get:function(){return this.controller.config.enabled&&this.config.enabled}},{key:"state",get:function(){return this.controller.state[this.stateKey]}},{key:"handler",get:function(){return this.controller.handlers[this.stateKey]}},{key:"transform",get:function(){return this.config.transform||this.controller.config.transform}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}();function X(e,t){return Math.abs(e)>=t&&u(e)*t}function B(e,t,n){var r=t[1],i=n[1],o=e[0],a=e[1],s=a[0],u=a[1];return[l(t[0],o[0],o[1],n[0]),l(r,s,u,i)]}function U(e,t,n){var r=e.state,i=t.timeStamp;return{_lastEventType:t.type,event:t,timeStamp:i,elapsedTime:n?0:i-r.startTime,args:e.args,previous:r.values}}function F(e,t,n){var r=e.state.offset,i=n.timeStamp;return d({},L()[e.stateKey],{_active:!0,values:t,initial:t,offset:r,lastOffset:r,startTime:i})}function z(e){if("touches"in e){var t=e.targetTouches;return t.length>0?t:e.changedTouches}return null}function q(e){var t="buttons"in e?e.buttons:0,n=z(e),r=n&&n.length||0;return{touches:r,down:r>0||t>0,buttons:t,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey}}var $=function(e){return e};function N(e,t){void 0===t&&(t=$);var n=z(e),r=n?n[0]:e;return t([r.clientX,r.clientY])}function J(e,t){void 0===t&&(t=$);var n=e.currentTarget;return t([n.scrollX||n.scrollLeft||0,n.scrollY||n.scrollTop||0])}function Q(e,t){return void 0===t&&(t=$),t([e.deltaX,e.deltaY])}function Z(e,t){return void 0===t&&(t=$),t([260*e.scale,e.rotation])}function ee(e,t){var n;void 0===t&&(t=$);var r=e.targetTouches,i=r[0],o=r[1],a=o.clientX-i.clientX,s=o.clientY-i.clientY,u=(o.clientX+i.clientX)/2,c=(o.clientY+i.clientY)/2,l="nativeEvent"in e?e.nativeEvent:e;return{values:t([Math.hypot(a,s),null!=(n=l.rotation)?n:-180*Math.atan2(a,s)/Math.PI]),origin:t([u,c])}}function te(e,t){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];return e.call.apply(e,[this,d({},t,{event:n})].concat(i))}}var ne=function(e){var t=this;this.classes=e,this.supportsTouchEvents="undefined"!=typeof window&&"ontouchstart"in window,this.supportsGestureEvents=function(){try{return"constructor"in GestureEvent}catch(e){return!1}}(),this.bind=function(){for(var e={},n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];for(var o,a=g(t.classes);!(o=a()).done;){var s=o.value;new s(t,r).addBindings(e)}for(var u=0,c=Object.entries(t.nativeRefs);u<c.length;u++){var l=c[u],v=l[0],f=l[1];ce(e,v,te(f,d({},t.state.shared,{args:r})))}return t.config.domTarget?oe(t,e):ae(t,e)},this.effect=function(){return t.config.domTarget&&t.bind(),t.clean},this.clean=function(){var e=ue(t.config),n=t.config.eventOptions;e&&de(e,se(t.domListeners),n),Object.values(t.timeouts).forEach(clearTimeout),function(e){var t=e.config,n=t.window,r=t.eventOptions,i=e.windowListeners;if(n){for(var o in i)de(n,i[o],r);e.windowListeners={}}}(t)},this.state=L(),this.timeouts={},this.domListeners=[],this.windowListeners={}};function re(e,t,n){var r=e.config,i=e.windowListeners;void 0===n&&(n=r.eventOptions),r.window&&(de(r.window,i[t],n),delete i[t])}function ie(e,t,n,r){var i=e.config,o=e.windowListeners;void 0===n&&(n=[]),void 0===r&&(r=i.eventOptions),i.window&&(de(i.window,o[t],r),le(i.window,o[t]=n,r))}function oe(e,t){var n=e.config,r=e.domListeners,i=ue(n);if(!i)throw new Error("domTarget must be defined");var o=n.eventOptions;de(i,se(r),o);for(var a=0,s=Object.entries(t);a<s.length;a++){var u=s[a],c=u[1],l=u[0].slice(2).toLowerCase();r.push([l,y.apply(void 0,c)])}le(i,r,o)}function ae(e,t){for(var n={},r=e.config.eventOptions.capture?"Capture":"",i=0,o=Object.entries(t);i<o.length;i++){var a=o[i],s=a[0],u=a[1],c=Array.isArray(u)?u:[u];n[s+r]=y.apply(void 0,c)}return n}function se(e){return void 0===e&&(e=[]),e.splice(0,e.length)}function ue(e){var t=e.domTarget;return t&&"current"in t?t.current:t}function ce(e,t,n){e[t]||(e[t]=[]),e[t].push(n)}function le(e,t,n){void 0===t&&(t=[]),void 0===n&&(n={});for(var r,i=g(t);!(r=i()).done;){var o=r.value;e.addEventListener(o[0],o[1],n)}}function de(e,t,n){void 0===t&&(t=[]),void 0===n&&(n={});for(var r,i=g(t);!(r=i()).done;){var o=r.value;e.removeEventListener(o[0],o[1],n)}}function ve(e,t,r){void 0===r&&(r={});var i=function(e){var t=new Set;return e.drag&&t.add(R.get("drag")),e.wheel&&t.add(R.get("wheel")),e.scroll&&t.add(R.get("scroll")),e.move&&t.add(R.get("move")),e.pinch&&t.add(R.get("pinch")),e.hover&&t.add(R.get("hover")),t}(e),o=n.useMemo((function(){return new ne(i)}),[]);return o.config=t,o.handlers=e,o.nativeRefs=r,n.useEffect(o.effect,[]),o.config.domTarget?fe:o.bind}function fe(){}var he=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.getInternalMovement=function(e,t){return i(e,t.initial)},n.checkIntentionality=function(e,t){if(!1===e[0]&&!1===e[1])return{_intentional:e,axis:this.state.axis};var n=t.map(Math.abs),r=n[0],i=n[1],o=this.state.axis||(r>i?"x":r<i?"y":void 0);return this.config.axis||this.config.lockDirection?o?this.config.axis&&o!==this.config.axis?{_intentional:e,_blocked:!0,axis:o}:(e["x"===o?1:0]=!1,{_intentional:e,_blocked:!1,axis:o}):{_intentional:[!1,!1],_blocked:!1,axis:o}:{_intentional:e,_blocked:!1,axis:o}},n.getKinematics=function(e,t){var n=this.getMovement(e);return n._blocked||Object.assign(n,s(n.movement,n.delta,t.timeStamp-this.state.timeStamp)),n},n.mapStateValues=function(e){return{xy:e.values,vxvy:e.velocities}},t}(V);function pe(e){"persist"in e&&"function"==typeof e.persist&&e.persist()}var ge=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).ingKey="dragging",t.stateKey="drag",t.setPointerCapture=function(e){var n=e.target,r=e.pointerId;n&&"setPointerCapture"in n&&(n.setPointerCapture(r),t.updateGestureState({_dragTarget:n,_dragPointerId:r}))},t.releasePointerCapture=function(){var e=t.state,n=e._dragTarget,r=e._dragPointerId;if(r&&n&&"releasePointerCapture"in n&&(!("hasPointerCapture"in n)||n.hasPointerCapture(r)))try{n.releasePointerCapture(r)}catch(e){}},t.preventScroll=function(e){t.state._dragPreventScroll&&e.cancelable&&e.preventDefault()},t.shouldPreventWindowScrollY=t.config.experimental_preventWindowScrollY&&t.controller.supportsTouchEvents,t.setUpWindowScrollDetection=function(e){pe(e),ie(t.controller,t.stateKey,[["touchmove",t.preventScroll],["touchend",t.clean.bind(h(t))],["touchcancel",t.clean.bind(h(t))]],{passive:!1}),t.setTimeout(t.startDrag.bind(h(t)),250,e)},t.setUpDelayedDragTrigger=function(e){t.state._dragDelayed=!0,pe(e),t.setTimeout(t.startDrag.bind(h(t)),t.config.delay,e)},t.setStartState=function(e){var n=N(e,t.transform);t.updateSharedState(q(e)),t.updateGestureState(d({},F(h(t),n,e),U(h(t),e,!0))),t.updateGestureState(t.getMovement(n))},t.onDragStart=function(e){t.enabled&&!t.state._active&&(t.setStartState(e),t.setPointerCapture(e),t.shouldPreventWindowScrollY?t.setUpWindowScrollDetection(e):t.config.delay>0?t.setUpDelayedDragTrigger(e):t.startDrag(e,!0))},t.onDragChange=function(e){if(t.state._active&&!t.state.canceled){var n=N(e,t.transform),r=t.getKinematics(n,e);if(!t.state._dragStarted){if(t.state._dragDelayed)return void t.startDrag(e);if(!t.shouldPreventWindowScrollY)return;if(t.state._dragPreventScroll||!r.axis)return;if("x"!==r.axis)return void(t.state._active=!1);t.startDrag(e)}var i=q(e);if(i.down){t.updateSharedState(i);var a=U(h(t),e),s=o(r._movement),u=t.state._dragIsTap;u&&s>=3&&(u=!1),t.updateGestureState(d({},a,r,{_dragIsTap:u})),t.fireGestureHandler()}else t.onDragEnd(e)}},t.onDragEnd=function(e){if(t.clean(),t.state._active){t.state._active=!1;var n=t.state._dragIsTap,r=t.state.velocities,i=r[0],o=r[1],a=t.state.movement,s=a[0],c=a[1],l=t.state._intentional,v=l[0],f=l[1],p=t.config.swipeVelocity,g=p[0],m=p[1],y=t.config.swipeDistance,S=y[0],w=y[1],b=d({},U(h(t),e),t.getMovement(t.state.values)),_=[0,0];b.elapsedTime<220&&(!1!==v&&Math.abs(i)>g&&Math.abs(s)>S&&(_[0]=u(i)),!1!==f&&Math.abs(o)>m&&Math.abs(c)>w&&(_[1]=u(o))),t.updateSharedState({down:!1,buttons:0,touches:0}),t.updateGestureState(d({},b,{tap:n,swipe:_})),t.fireGestureHandler(t.config.filterTaps&&!0===n)}},t.clean=function(){e.prototype.clean.call(h(t)),t.state._dragStarted=!1,t.releasePointerCapture(),re(t.controller,t.stateKey)},t.onCancel=function(){t.state.canceled||(t.updateGestureState({canceled:!0,_active:!1}),t.updateSharedState({down:!1,buttons:0,touches:0}),requestAnimationFrame((function(){return t.fireGestureHandler()})))},t.onClick=function(e){t.state._dragIsTap||e.stopPropagation()},t}v(t,e);var n=t.prototype;return n.startDrag=function(e,t){void 0===t&&(t=!1),this.state._active&&!this.state._dragStarted&&(t||this.setStartState(e),this.updateGestureState({_dragStarted:!0,_dragPreventScroll:!0,cancel:this.onCancel}),this.clearTimeout(),this.fireGestureHandler())},n.addBindings=function(e){ce(e,"onPointerDown",this.onDragStart),ce(e,"onPointerMove",this.onDragChange),ce(e,"onPointerUp",this.onDragEnd),ce(e,"onPointerCancel",this.onDragEnd),this.config.filterTaps&&ce(e,this.controller.config.eventOptions.capture?"onClick":"onClickCapture",this.onClick)},t}(he);function me(e,t){var n,r,i=[],o=!1;return function(){for(var a=arguments.length,s=new Array(a),u=0;u<a;u++)s[u]=arguments[u];return o&&n===this&&t(s,i)||(r=e.apply(this,s),o=!0,n=this,i=s),r}}function ye(e,t){try{return function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var r,i,o,a;if(Array.isArray(t)){if((r=t.length)!==n.length)return!1;for(i=r;0!=i--;)if(!e(t[i],n[i]))return!1;return!0}if("function"==typeof Map&&t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(a=t.entries();!(i=a.next()).done;)if(!n.has(i.value[0]))return!1;for(a=t.entries();!(i=a.next()).done;)if(!e(i.value[1],n.get(i.value[0])))return!1;return!0}if("function"==typeof Set&&t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(a=t.entries();!(i=a.next()).done;)if(!n.has(i.value[0]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(o=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(i=r;0!=i--;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return!1;if("undefined"!=typeof Element&&t instanceof Element)return!1;for(i=r;0!=i--;)if(!("_owner"===o[i]&&t.$$typeof||e(t[o[i]],n[o[i]])))return!1;return!0}return t!=t&&n!=n}(e,t)}catch(e){if((e.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw e}}var Se=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).ingKey="pinching",t.stateKey="pinch",t.pinchShouldStart=function(e){var n=q(e);return t.enabled&&2===n.touches},t.onPinchStart=function(e){if(t.pinchShouldStart(e)){var n=ee(e,t.transform),r=n.values,i=n.origin;t.updateSharedState(q(e)),t.updateGestureState(d({},F(h(t),r,e),U(h(t),e,!0),{cancel:t.onCancel,origin:i})),t.updateGestureState(t.getMovement(r)),t.fireGestureHandler()}},t.onPinchChange=function(e){var n=t.state;if(!n.canceled&&n._active){var r=q(e);t.updateSharedState(r);var i=ee(e,t.transform),o=i.origin,a=t.getKinematics(i.values,e);t.updateGestureState(d({},U(h(t),e),a,{origin:o})),t.fireGestureHandler()}},t.onPinchEnd=function(e){t.clean(),t.state._active&&(t.updateSharedState({down:!1,touches:0}),t.updateGestureState(d({},U(h(t),e),t.getMovement(t.state.values),{_active:!1})),t.fireGestureHandler())},t.onCancel=function(){t.state.canceled||(t.updateGestureState({_active:!1,canceled:!0}),t.updateSharedState({down:!1,touches:0}),requestAnimationFrame((function(){return t.fireGestureHandler()})))},t.onGestureStart=function(e){if(t.enabled){e.preventDefault();var n=Z(e,t.transform);t.updateSharedState(q(e)),t.updateGestureState(d({},F(h(t),n,e),U(h(t),e,!0),{origin:[e.clientX,e.clientY],cancel:t.onCancel})),t.updateGestureState(t.getMovement(n)),t.fireGestureHandler()}},t.onGestureChange=function(e){var n=t.state;if(!n.canceled&&n._active){e.preventDefault();var r=q(e);t.updateSharedState(r);var i=Z(e,t.transform),o=t.getKinematics(i,e);t.updateGestureState(d({},U(h(t),e),o,{origin:[e.clientX,e.clientY]})),t.fireGestureHandler()}},t.onGestureEnd=function(e){t.clean(),t.state._active&&(t.updateSharedState({down:!1,touches:0}),t.updateGestureState(d({},U(h(t),e),t.getMovement(t.state.values),{_active:!1,origin:[e.clientX,e.clientY]})),t.fireGestureHandler())},t.wheelShouldRun=function(e){return t.enabled&&e.ctrlKey},t.getWheelValuesFromEvent=function(e){var n=Q(e,t.transform)[1],r=t.state.values,i=r[1];return{values:[r[0]-n,void 0!==i?i:0],origin:[e.clientX,e.clientY],delta:[0,n]}},t.onWheel=function(e){t.wheelShouldRun(e)&&(t.setTimeout(t.onWheelEnd),t.state._active?t.onWheelChange(e):t.onWheelStart(e))},t.onWheelStart=function(e){var n=t.getWheelValuesFromEvent(e),r=n.values,i=n.delta,o=n.origin;e.cancelable&&e.preventDefault(),t.updateSharedState(q(e)),t.updateGestureState(d({},F(h(t),r,e),U(h(t),e,!0),{initial:t.state.values,offset:r,delta:i,origin:o})),t.updateGestureState(t.getMovement(r)),t.fireGestureHandler()},t.onWheelChange=function(e){t.updateSharedState(q(e));var n=t.getWheelValuesFromEvent(e),r=n.values,i=n.origin,o=n.delta;t.updateGestureState(d({},U(h(t),e),t.getKinematics(r,e),{origin:i,delta:o})),t.fireGestureHandler()},t.onWheelEnd=function(){t.clean(),t.state._active&&(t.state._active=!1,t.updateGestureState(t.getMovement(t.state.values)),t.fireGestureHandler())},t}return v(t,e),t.prototype.addBindings=function(e){this.controller.config.domTarget&&!this.controller.supportsTouchEvents&&this.controller.supportsGestureEvents?(ce(e,"onGestureStart",this.onGestureStart),ce(e,"onGestureChange",this.onGestureChange),ce(e,"onGestureEnd",this.onGestureEnd)):(ce(e,"onTouchStart",this.onPinchStart),ce(e,"onTouchMove",this.onPinchChange),ce(e,"onTouchEnd",this.onPinchEnd),ce(e,"onTouchCancel",this.onPinchEnd),ce(e,"onWheel",this.onWheel))},t}(function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.getInternalMovement=function(e,t){var n=t.values[1],r=e[0],o=e[1],a=void 0===o?n:o,s=a-n,c=t.turns;return Math.abs(s)>270&&(c+=u(s)),i([r,a-360*c],t.initial)},n.getKinematics=function(e,t){var n=this.getMovement(e);return d({turns:(e[1]-n.movement[1]-this.state.initial[1])/360},n,s(n.movement,n.delta,t.timeStamp-this.state.timeStamp))},n.mapStateValues=function(e){return{da:e.values,vdva:e.velocities}},t}(V)),we=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).ingKey="wheeling",t.stateKey="wheel",t.debounced=!0,t.handleEvent=function(e){if((!e.ctrlKey||!("pinch"in t.controller.handlers))&&t.enabled){t.setTimeout(t.onEnd),t.updateSharedState(q(e));var n=r(Q(e,t.transform),t.state.values);if(t.state._active)t.updateGestureState(d({},U(h(t),e),t.getKinematics(n,e)));else{t.updateGestureState(d({},F(h(t),n,e),U(h(t),e,!0),{initial:t.state.values}));var i=t.getMovement(n),o=a(i.delta);t.updateGestureState(i),t.updateGestureState(o)}t.fireGestureHandler()}},t.onEnd=function(){if(t.clean(),t.state._active){var e=t.getMovement(t.state.values);t.updateGestureState(e),t.updateGestureState({_active:!1,velocities:[0,0],velocity:0}),t.fireGestureHandler()}},t}return v(t,e),t.prototype.addBindings=function(e){ce(e,"onWheel",this.handleEvent)},t}(he),be=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).ingKey="moving",t.stateKey="move",t.debounced=!0,t.onMove=function(e){t.enabled&&(t.setTimeout(t.onMoveEnd),t.state._active?t.onMoveChange(e):t.onMoveStart(e))},t.onMoveStart=function(e){t.updateSharedState(q(e));var n=N(e,t.transform);t.updateGestureState(d({},F(h(t),n,e),U(h(t),e,!0))),t.updateGestureState(t.getMovement(n)),t.fireGestureHandler()},t.onMoveChange=function(e){t.updateSharedState(q(e));var n=N(e,t.transform);t.updateGestureState(d({},U(h(t),e),t.getKinematics(n,e))),t.fireGestureHandler()},t.onMoveEnd=function(){t.clean(),t.state._active&&(t.updateGestureState(t.getMovement(t.state.values)),t.updateGestureState({velocities:[0,0],velocity:0,_active:!1}),t.fireGestureHandler())},t.hoverTransform=function(){return t.controller.config.hover.transform||t.controller.config.transform},t.onPointerEnter=function(e){if(t.controller.state.shared.hovering=!0,t.controller.config.enabled){if(t.controller.config.hover.enabled){var n=N(e,t.hoverTransform()),r=d({},t.controller.state.shared,t.state,U(h(t),e,!0),{values:n,active:!0,hovering:!0});t.controller.handlers.hover(d({},r,t.mapStateValues(r)))}"move"in t.controller.handlers&&t.onMoveStart(e)}},t.onPointerLeave=function(e){if(t.controller.state.shared.hovering=!1,"move"in t.controller.handlers&&t.onMoveEnd(),t.controller.config.hover.enabled){var n=N(e,t.hoverTransform()),r=d({},t.controller.state.shared,t.state,U(h(t),e),{values:n,active:!1});t.controller.handlers.hover(d({},r,t.mapStateValues(r)))}},t}return v(t,e),t.prototype.addBindings=function(e){"move"in this.controller.handlers&&ce(e,"onPointerMove",this.onMove),"hover"in this.controller.handlers&&(ce(e,"onPointerEnter",this.onPointerEnter),ce(e,"onPointerLeave",this.onPointerLeave))},t}(he),_e=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).ingKey="scrolling",t.stateKey="scroll",t.debounced=!0,t.handleEvent=function(e){if(t.enabled){t.clearTimeout(),t.setTimeout(t.onEnd);var n=J(e,t.transform);if(t.updateSharedState(q(e)),t.state._active)t.updateGestureState(d({},U(h(t),e),t.getKinematics(n,e)));else{t.updateGestureState(d({},F(h(t),n,e),U(h(t),e,!0),{initial:t.state.values}));var r=t.getMovement(n),i=a(r.delta);t.updateGestureState(r),t.updateGestureState(i)}t.fireGestureHandler()}},t.onEnd=function(){t.clean(),t.state._active&&(t.updateGestureState(d({},t.getMovement(t.state.values),{_active:!1,velocities:[0,0],velocity:0})),t.fireGestureHandler())},t}return v(t,e),t.prototype.addBindings=function(e){ce(e,"onScroll",this.handleEvent)},t}(he),Te=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;function Ge(e,t){var n=t+"Start",r=t+"End";return function(i){var o=void 0;return i.first&&n in e&&e[n](i),t in e&&(o=e[t](i)),i.last&&r in e&&e[r](i),o}}exports.addV=r,exports.rubberbandIfOutOfBounds=l,exports.subV=i,exports.useDrag=function(e,n){void 0===n&&(n={}),R.set("drag",ge);var r=t.useRef();return r.current||(r.current=me(j,ye)),ve({drag:e},r.current(n))},exports.useGesture=function(e,t){void 0===t&&(t={});var n=function(e){var t={},n={},r=new Set;for(var i in e)Te.test(i)?(r.add(RegExp.lastMatch),n[i]=e[i]):t[i]=e[i];return[n,t,r]}(e),r=n[0],i=n[1],o=n[2];R.set("drag",ge),R.set("hover",be),R.set("move",be),R.set("pinch",Se),R.set("scroll",_e),R.set("wheel",we);var a=function(e,t){void 0===e&&(e={}),void 0===t&&(t=new Set);var n=e.drag,r=e.wheel,i=e.move,o=e.scroll,a=e.pinch,s=e.hover,u=P({domTarget:e.domTarget,eventOptions:e.eventOptions,transform:e.transform,window:e.window,enabled:e.enabled});return t.has("onDrag")&&(u.drag=C(n)),t.has("onWheel")&&(u.wheel=K(r)),t.has("onScroll")&&(u.scroll=K(o)),t.has("onMove")&&(u.move=K(i)),t.has("onPinch")&&(u.pinch=D(a)),t.has("onHover")&&(u.hover=d({enabled:!0},s)),u}(t,o),s={};return o.has("onDrag")&&(s.drag=Ge(r,"onDrag")),o.has("onWheel")&&(s.wheel=Ge(r,"onWheel")),o.has("onScroll")&&(s.scroll=Ge(r,"onScroll")),o.has("onMove")&&(s.move=Ge(r,"onMove")),o.has("onPinch")&&(s.pinch=Ge(r,"onPinch")),o.has("onHover")&&(s.hover=r.onHover),ve(s,a,i)},exports.useHover=function(e,n){void 0===n&&(n={}),R.set("hover",be);var r=t.useRef();return r.current||(r.current=me(I,ye)),ve({hover:e},r.current(n))},exports.useMove=function(e,n){void 0===n&&(n={}),R.set("move",be);var r=t.useRef();return r.current||(r.current=me(k,ye)),ve({move:e},r.current(n))},exports.usePinch=function(e,n){void 0===n&&(n={}),R.set("pinch",Se);var r=t.useRef();return r.current||(r.current=me(H,ye)),ve({pinch:e},r.current(n))},exports.useScroll=function(e,n){void 0===n&&(n={}),R.set("scroll",_e);var r=t.useRef();return r.current||(r.current=me(W,ye)),ve({scroll:e},r.current(n))},exports.useWheel=function(e,n){void 0===n&&(n={}),R.set("wheel",we);var r=t.useRef();return r.current||(r.current=me(A,ye)),ve({wheel:e},r.current(n))}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),n=(e=t)&&"object"==typeof e&&"default"in e?e.default:e;function r(e,t){return e.map((function(e,n){return e+t[n]}))}function i(e,t){return e.map((function(e,n){return e-t[n]}))}function o(e){return Math.hypot.apply(Math,e)}function a(e,t){void 0===t&&(t=e);var n=o(t),r=0===n?0:1/n,i=t.map((function(e){return r*e}));return{distance:o(e),direction:i}}function s(e,t,n){var r=o(t),i=0===r?0:1/r,a=0===n?0:1/n,s=a*r,u=t.map((function(e){return a*e})),c=t.map((function(e){return i*e}));return{velocities:u,velocity:s,distance:o(e),direction:c}}function u(e){return Math.sign?Math.sign(e):Number(e>0)-Number(e<0)||+e}function c(e,t,n){return 0===t||Infinity===Math.abs(t)?function(e,t){return Math.pow(e,5*t)}(e,n):e*t*n/(t+n*e)}function l(e,t,n,r){return void 0===r&&(r=.15),0===r?function(e,t,n){return Math.max(t,Math.min(e,n))}(e,t,n):e<t?-c(t-e,n-t,r)+t:e>n?+c(e-n,n-t,r)+n:e}function d(){return(d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function v(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function f(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)t.indexOf(n=o[r])>=0||(i[n]=e[n]);return i}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function g(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return p(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function m(){}function y(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?m:1===t.length?t[0]:function(){for(var e,n,r=g(t);!(n=r()).done;){var i=n.value;e=i.apply(this,arguments)||e}return e}}function S(e,t){if(void 0===e){if(void 0===t)throw new Error("Must define fallback value if undefined is expected");e=t}return Array.isArray(e)?e:[e,e]}function w(e,t){return Object.assign({},t,e||{})}function b(e){if("function"==typeof e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return e.apply(void 0,n)}return e}function _(e,t){void 0===e&&(e={});for(var n={},r=0,i=Object.entries(t);r<i.length;r++){var o=i[r],a=o[0],s=o[1];switch(typeof s){case"function":n[a]=s.call(n,e[a],a,e);break;case"object":n[a]=_(e[a],s);break;case"boolean":s&&(n[a]=e[a])}}return n}var T={threshold:function(e){return void 0===e&&(e=0),S(e)},rubberband:function(e){switch(void 0===e&&(e=0),e){case!0:return S(.15);case!1:return S(0);default:return S(e)}},enabled:function(e){return void 0===e&&(e=!0),e},triggerAllEvents:function(e){return void 0===e&&(e=!1),e},initial:function(e){return void 0===e&&(e=0),"function"==typeof e?e:S(e)},transform:!0},G=d({},T,{axis:!0,lockDirection:function(e){return void 0===e&&(e=!1),e},bounds:function(e){if(void 0===e&&(e={}),"function"==typeof e)return function(t){return G.bounds(e(t))};var t=e.left,n=e.right,r=e.top,i=e.bottom;return[[void 0===t?-Infinity:t,void 0===n?Infinity:n],[void 0===r?-Infinity:r,void 0===i?Infinity:i]]}}),M="undefined"!=typeof window&&window.document&&window.document.createElement,O={enabled:function(e){return void 0===e&&(e=!0),e},domTarget:!0,window:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(e){return void 0===e&&(e=M?window:void 0),e})),eventOptions:function(e){var t=void 0===e?{}:e,n=t.passive,r=t.capture;return{passive:void 0===n||n,capture:void 0!==r&&r}},transform:!0},x=d({},T,{bounds:function(e,t,n){var r=n.distanceBounds,i=void 0===r?{}:r,o=n.angleBounds,a=void 0===o?{}:o,s=function(e){var t=w(b(i,e),{min:-Infinity,max:Infinity});return[t.min,t.max]},u=function(e){var t=w(b(a,e),{min:-Infinity,max:Infinity});return[t.min,t.max]};return"function"!=typeof i&&"function"!=typeof a?[s(),u()]:function(e){return[s(e),u(e)]}}}),E=d({},G,{experimental_preventWindowScrollY:function(e){return void 0===e&&(e=!1),e},threshold:function(e,t,n){var r=n.filterTaps,i=void 0!==r&&r,o=n.lockDirection,a=n.axis,s=S(e,i?3:void 0!==o&&o||(void 0===a?void 0:a)?1:0);return this.filterTaps=i,s},swipeVelocity:function(e){return void 0===e&&(e=.5),S(e)},swipeDistance:function(e){return void 0===e&&(e=60),S(e)},delay:function(e){switch(void 0===e&&(e=0),e){case!0:return 180;case!1:return 0;default:return e}}});function P(e){return void 0===e&&(e={}),_(e,O)}function K(e){return void 0===e&&(e={}),_(e,G)}function D(e){return void 0===e&&(e={}),_(e,x)}function C(e){return void 0===e&&(e={}),_(e,E)}function k(e){var t=e.domTarget,n=e.eventOptions,r=e.window,i=e.enabled,o=f(e,["domTarget","eventOptions","window","enabled"]),a=P({domTarget:t,eventOptions:n,window:r,enabled:i});return a.move=K(o),a}function I(e){var t=e.domTarget,n=e.eventOptions,r=e.window,i=e.enabled,o=f(e,["domTarget","eventOptions","window","enabled"]),a=P({domTarget:t,eventOptions:n,window:r,enabled:i});return a.hover=d({enabled:!0},o),a}function j(e){var t=e.domTarget,n=e.eventOptions,r=e.window,i=e.enabled,o=f(e,["domTarget","eventOptions","window","enabled"]),a=P({domTarget:t,eventOptions:n,window:r,enabled:i});return a.drag=C(o),a}function H(e){var t=e.domTarget,n=e.eventOptions,r=e.window,i=e.enabled,o=f(e,["domTarget","eventOptions","window","enabled"]),a=P({domTarget:t,eventOptions:n,window:r,enabled:i});return a.pinch=D(o),a}function W(e){var t=e.domTarget,n=e.eventOptions,r=e.window,i=e.enabled,o=f(e,["domTarget","eventOptions","window","enabled"]),a=P({domTarget:t,eventOptions:n,window:r,enabled:i});return a.scroll=K(o),a}function A(e){var t=e.domTarget,n=e.eventOptions,r=e.window,i=e.enabled,o=f(e,["domTarget","eventOptions","window","enabled"]),a=P({domTarget:t,eventOptions:n,window:r,enabled:i});return a.wheel=K(o),a}function Y(e){return d({_active:!1,_blocked:!1,_intentional:[!1,!1],_movement:[0,0],_initial:[0,0],_bounds:[[-Infinity,Infinity],[-Infinity,Infinity]],_lastEventType:void 0,_dragStarted:!1,_dragPreventScroll:!1,_dragIsTap:!0,_dragDelayed:!1,event:void 0,intentional:!1,values:[0,0],velocities:[0,0],delta:[0,0],movement:[0,0],offset:[0,0],lastOffset:[0,0],direction:[0,0],initial:[0,0],previous:[0,0],first:!1,last:!1,active:!1,timeStamp:0,startTime:0,elapsedTime:0,cancel:m,canceled:!1,memo:void 0,args:void 0},e)}function L(){return{shared:{hovering:!1,scrolling:!1,wheeling:!1,dragging:!1,moving:!1,pinching:!1,touches:0,buttons:0,down:!1,shiftKey:!1,altKey:!1,metaKey:!1,ctrlKey:!1},drag:Y({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0,tap:!1,swipe:[0,0]}),pinch:Y({da:[0,0],vdva:[0,0],origin:void 0,turns:0}),wheel:Y({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0}),move:Y({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0}),scroll:Y({axis:void 0,xy:[0,0],vxvy:[0,0],velocity:0,distance:0})}}var R=new Map,V=function(e){return e},X=function(){function e(e,t){var n=this;void 0===t&&(t=[]),this.controller=e,this.args=t,this.debounced=!0,this.setTimeout=function(e,t){var r;void 0===t&&(t=140),clearTimeout(n.controller.timeouts[n.stateKey]);for(var i=arguments.length,o=new Array(i>2?i-2:0),a=2;a<i;a++)o[a-2]=arguments[a];n.controller.timeouts[n.stateKey]=(r=window).setTimeout.apply(r,[e,t].concat(o))},this.clearTimeout=function(){clearTimeout(n.controller.timeouts[n.stateKey])},this.fireGestureHandler=function(e){if(void 0===e&&(e=!1),n.state._blocked)return n.debounced||(n.state._active=!1,n.clean()),null;if(!e&&!n.state.intentional&&!n.config.triggerAllEvents)return null;if(n.state.intentional){var t=n.state.active,r=n.state._active;n.state.active=r,n.state.first=r&&!t,n.state.last=t&&!r,n.controller.state.shared[n.ingKey]=r}var i=d({},n.controller.state.shared,n.state,n.mapStateValues(n.state)),o=n.handler(i);return n.state.memo=void 0!==o?o:n.state.memo,i}}var t,n=e.prototype;return n.updateSharedState=function(e){Object.assign(this.controller.state.shared,e)},n.updateGestureState=function(e){Object.assign(this.state,e)},n.checkIntentionality=function(e,t){return{_intentional:e,_blocked:!1}},n.getMovement=function(e){var t=this.config,n=t.initial,o=t.bounds,a=t.rubberband,s=t.threshold,u=this.state,c=u._bounds,l=u._initial,v=u._active,f=u._intentional,h=u.lastOffset,p=u.movement,g=this.getInternalMovement(e,this.state),m=this.transform(s),y=!1===f[0]?B(g[0],m[0]):f[0],S=!1===f[1]?B(g[1],m[1]):f[1],w=this.checkIntentionality([y,S],g);if(w._blocked)return d({},w,{_movement:g,delta:[0,0]});var _,T,G,M,O=w._intentional,x=g;!1!==O[0]&&!1===f[0]&&(T=b(n,this.state),_=b(o,this.state),l[0]=T[0],c[0]=_[0]),!1!==O[1]&&!1===f[1]&&(T=null!=(G=T)?G:b(n,this.state),_=null!=(M=_)?M:b(o,this.state),l[1]=T[1],c[1]=_[1]);var E=[!1!==O[0]?g[0]-O[0]:l[0],!1!==O[1]?g[1]-O[1]:l[1]],P=r(E,h),K=v?a:[0,0];return E=U(c,r(E,l),K),d({},w,{intentional:!1!==O[0]||!1!==O[1],_initial:l,_movement:x,movement:E,values:e,offset:U(c,P,K),delta:i(E,p)})},n.clean=function(){this.clearTimeout()},(t=[{key:"config",get:function(){return this.controller.config[this.stateKey]}},{key:"enabled",get:function(){return this.controller.config.enabled&&this.config.enabled}},{key:"state",get:function(){return this.controller.state[this.stateKey]}},{key:"handler",get:function(){return this.controller.handlers[this.stateKey]}},{key:"transform",get:function(){return this.config.transform||this.controller.config.transform||V}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}();function B(e,t){return Math.abs(e)>=t&&u(e)*t}function U(e,t,n){var r=t[1],i=n[1],o=e[0],a=e[1],s=a[0],u=a[1];return[l(t[0],o[0],o[1],n[0]),l(r,s,u,i)]}function F(e,t,n){var r=e.state,i=t.timeStamp;return{_lastEventType:t.type,event:t,timeStamp:i,elapsedTime:n?0:i-r.startTime,args:e.args,previous:r.values}}function z(e,t,n){var r=e.state.offset,i=n.timeStamp;return d({},L()[e.stateKey],{_active:!0,values:t,initial:t,offset:r,lastOffset:r,startTime:i})}function q(e){if("touches"in e){var t=e.targetTouches;return t.length>0?t:e.changedTouches}return null}function $(e){var t="buttons"in e?e.buttons:0,n=q(e),r=n&&n.length||0;return{touches:r,down:r>0||t>0,buttons:t,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey}}var N=function(e){return e};function J(e,t){void 0===t&&(t=N);var n=q(e),r=n?n[0]:e;return t([r.clientX,r.clientY])}function Q(e,t){void 0===t&&(t=N);var n=e.currentTarget;return t([n.scrollX||n.scrollLeft||0,n.scrollY||n.scrollTop||0])}function Z(e,t){return void 0===t&&(t=N),t([e.deltaX,e.deltaY])}function ee(e,t){return void 0===t&&(t=N),t([260*e.scale,e.rotation])}function te(e,t){var n;void 0===t&&(t=N);var r=e.targetTouches,i=r[0],o=r[1],a=o.clientX-i.clientX,s=o.clientY-i.clientY,u=(o.clientX+i.clientX)/2,c=(o.clientY+i.clientY)/2,l="nativeEvent"in e?e.nativeEvent:e;return{values:t([Math.hypot(a,s),null!=(n=l.rotation)?n:-180*Math.atan2(a,s)/Math.PI]),origin:t([u,c])}}function ne(e,t){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];return e.call.apply(e,[this,d({},t,{event:n})].concat(i))}}var re=function(e){var t=this;this.classes=e,this.supportsTouchEvents="undefined"!=typeof window&&"ontouchstart"in window,this.supportsGestureEvents=function(){try{return"constructor"in GestureEvent}catch(e){return!1}}(),this.bind=function(){for(var e={},n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];for(var o,a=g(t.classes);!(o=a()).done;){var s=o.value;new s(t,r).addBindings(e)}for(var u=0,c=Object.entries(t.nativeRefs);u<c.length;u++){var l=c[u],v=l[0],f=l[1];le(e,v,ne(f,d({},t.state.shared,{args:r})))}return t.config.domTarget?ae(t,e):se(t,e)},this.effect=function(){return t.config.domTarget&&t.bind(),t.clean},this.clean=function(){var e=ce(t.config),n=t.config.eventOptions;e&&ve(e,ue(t.domListeners),n),Object.values(t.timeouts).forEach(clearTimeout),function(e){var t=e.config,n=t.window,r=t.eventOptions,i=e.windowListeners;if(n){for(var o in i)ve(n,i[o],r);e.windowListeners={}}}(t)},this.state=L(),this.timeouts={},this.domListeners=[],this.windowListeners={}};function ie(e,t,n){var r=e.config,i=e.windowListeners;void 0===n&&(n=r.eventOptions),r.window&&(ve(r.window,i[t],n),delete i[t])}function oe(e,t,n,r){var i=e.config,o=e.windowListeners;void 0===n&&(n=[]),void 0===r&&(r=i.eventOptions),i.window&&(ve(i.window,o[t],r),de(i.window,o[t]=n,r))}function ae(e,t){var n=e.config,r=e.domListeners,i=ce(n);if(!i)throw new Error("domTarget must be defined");var o=n.eventOptions;ve(i,ue(r),o);for(var a=0,s=Object.entries(t);a<s.length;a++){var u=s[a],c=u[1],l=u[0].slice(2).toLowerCase();r.push([l,y.apply(void 0,c)])}de(i,r,o)}function se(e,t){for(var n={},r=e.config.eventOptions.capture?"Capture":"",i=0,o=Object.entries(t);i<o.length;i++){var a=o[i],s=a[0],u=a[1],c=Array.isArray(u)?u:[u];n[s+r]=y.apply(void 0,c)}return n}function ue(e){return void 0===e&&(e=[]),e.splice(0,e.length)}function ce(e){var t=e.domTarget;return t&&"current"in t?t.current:t}function le(e,t,n){e[t]||(e[t]=[]),e[t].push(n)}function de(e,t,n){void 0===t&&(t=[]),void 0===n&&(n={});for(var r,i=g(t);!(r=i()).done;){var o=r.value;e.addEventListener(o[0],o[1],n)}}function ve(e,t,n){void 0===t&&(t=[]),void 0===n&&(n={});for(var r,i=g(t);!(r=i()).done;){var o=r.value;e.removeEventListener(o[0],o[1],n)}}function fe(e,t,r){void 0===r&&(r={});var i=function(e){var t=new Set;return e.drag&&t.add(R.get("drag")),e.wheel&&t.add(R.get("wheel")),e.scroll&&t.add(R.get("scroll")),e.move&&t.add(R.get("move")),e.pinch&&t.add(R.get("pinch")),e.hover&&t.add(R.get("hover")),t}(e),o=n.useMemo((function(){return new re(i)}),[]);return o.config=t,o.handlers=e,o.nativeRefs=r,n.useEffect(o.effect,[]),o.config.domTarget?he:o.bind}function he(){}var pe=function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.getInternalMovement=function(e,t){return i(e,t.initial)},n.checkIntentionality=function(e,t){if(!1===e[0]&&!1===e[1])return{_intentional:e,axis:this.state.axis};var n=t.map(Math.abs),r=n[0],i=n[1],o=this.state.axis||(r>i?"x":r<i?"y":void 0);return this.config.axis||this.config.lockDirection?o?this.config.axis&&o!==this.config.axis?{_intentional:e,_blocked:!0,axis:o}:(e["x"===o?1:0]=!1,{_intentional:e,_blocked:!1,axis:o}):{_intentional:[!1,!1],_blocked:!1,axis:o}:{_intentional:e,_blocked:!1,axis:o}},n.getKinematics=function(e,t){var n=this.getMovement(e);return n._blocked||Object.assign(n,s(n.movement,n.delta,t.timeStamp-this.state.timeStamp)),n},n.mapStateValues=function(e){return{xy:e.values,vxvy:e.velocities}},t}(X);function ge(e){"persist"in e&&"function"==typeof e.persist&&e.persist()}var me=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).ingKey="dragging",t.stateKey="drag",t.setPointerCapture=function(e){var n=e.target,r=e.pointerId;n&&"setPointerCapture"in n&&(n.setPointerCapture(r),t.updateGestureState({_dragTarget:n,_dragPointerId:r}))},t.releasePointerCapture=function(){var e=t.state,n=e._dragTarget,r=e._dragPointerId;if(r&&n&&"releasePointerCapture"in n&&(!("hasPointerCapture"in n)||n.hasPointerCapture(r)))try{n.releasePointerCapture(r)}catch(e){}},t.preventScroll=function(e){t.state._dragPreventScroll&&e.cancelable&&e.preventDefault()},t.shouldPreventWindowScrollY=t.config.experimental_preventWindowScrollY&&t.controller.supportsTouchEvents,t.setUpWindowScrollDetection=function(e){ge(e),oe(t.controller,t.stateKey,[["touchmove",t.preventScroll],["touchend",t.clean.bind(h(t))],["touchcancel",t.clean.bind(h(t))]],{passive:!1}),t.setTimeout(t.startDrag.bind(h(t)),250,e)},t.setUpDelayedDragTrigger=function(e){t.state._dragDelayed=!0,ge(e),t.setTimeout(t.startDrag.bind(h(t)),t.config.delay,e)},t.setStartState=function(e){var n=J(e,t.transform);t.updateSharedState($(e)),t.updateGestureState(d({},z(h(t),n,e),F(h(t),e,!0))),t.updateGestureState(t.getMovement(n))},t.onDragStart=function(e){t.enabled&&!t.state._active&&(t.setStartState(e),t.setPointerCapture(e),t.shouldPreventWindowScrollY?t.setUpWindowScrollDetection(e):t.config.delay>0?t.setUpDelayedDragTrigger(e):t.startDrag(e,!0))},t.onDragChange=function(e){if(t.state._active&&!t.state.canceled){var n=J(e,t.transform),r=t.getKinematics(n,e);if(!t.state._dragStarted){if(t.state._dragDelayed)return void t.startDrag(e);if(!t.shouldPreventWindowScrollY)return;if(t.state._dragPreventScroll||!r.axis)return;if("x"!==r.axis)return void(t.state._active=!1);t.startDrag(e)}var i=$(e);if(i.down){t.updateSharedState(i);var a=F(h(t),e),s=o(r._movement),u=t.state._dragIsTap;u&&s>=3&&(u=!1),t.updateGestureState(d({},a,r,{_dragIsTap:u})),t.fireGestureHandler()}else t.onDragEnd(e)}},t.onDragEnd=function(e){if(t.clean(),t.state._active){t.state._active=!1;var n=t.state._dragIsTap,r=t.state.velocities,i=r[0],o=r[1],a=t.state.movement,s=a[0],c=a[1],l=t.state._intentional,v=l[0],f=l[1],p=t.config.swipeVelocity,g=p[0],m=p[1],y=t.config.swipeDistance,S=y[0],w=y[1],b=d({},F(h(t),e),t.getMovement(t.state.values)),_=[0,0];b.elapsedTime<220&&(!1!==v&&Math.abs(i)>g&&Math.abs(s)>S&&(_[0]=u(i)),!1!==f&&Math.abs(o)>m&&Math.abs(c)>w&&(_[1]=u(o))),t.updateSharedState({down:!1,buttons:0,touches:0}),t.updateGestureState(d({},b,{tap:n,swipe:_})),t.fireGestureHandler(t.config.filterTaps&&!0===n)}},t.clean=function(){e.prototype.clean.call(h(t)),t.state._dragStarted=!1,t.releasePointerCapture(),ie(t.controller,t.stateKey)},t.onCancel=function(){t.state.canceled||(t.updateGestureState({canceled:!0,_active:!1}),t.updateSharedState({down:!1,buttons:0,touches:0}),requestAnimationFrame((function(){return t.fireGestureHandler()})))},t.onClick=function(e){t.state._dragIsTap||e.stopPropagation()},t}v(t,e);var n=t.prototype;return n.startDrag=function(e,t){void 0===t&&(t=!1),this.state._active&&!this.state._dragStarted&&(t||this.setStartState(e),this.updateGestureState({_dragStarted:!0,_dragPreventScroll:!0,cancel:this.onCancel}),this.clearTimeout(),this.fireGestureHandler())},n.addBindings=function(e){le(e,"onPointerDown",this.onDragStart),le(e,"onPointerMove",this.onDragChange),le(e,"onPointerUp",this.onDragEnd),le(e,"onPointerCancel",this.onDragEnd),this.config.filterTaps&&le(e,this.controller.config.eventOptions.capture?"onClick":"onClickCapture",this.onClick)},t}(pe);function ye(e,t){var n,r,i=[],o=!1;return function(){for(var a=arguments.length,s=new Array(a),u=0;u<a;u++)s[u]=arguments[u];return o&&n===this&&t(s,i)||(r=e.apply(this,s),o=!0,n=this,i=s),r}}function Se(e,t){try{return function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var r,i,o,a;if(Array.isArray(t)){if((r=t.length)!==n.length)return!1;for(i=r;0!=i--;)if(!e(t[i],n[i]))return!1;return!0}if("function"==typeof Map&&t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(a=t.entries();!(i=a.next()).done;)if(!n.has(i.value[0]))return!1;for(a=t.entries();!(i=a.next()).done;)if(!e(i.value[1],n.get(i.value[0])))return!1;return!0}if("function"==typeof Set&&t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(a=t.entries();!(i=a.next()).done;)if(!n.has(i.value[0]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(o=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(i=r;0!=i--;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return!1;if("undefined"!=typeof Element&&t instanceof Element)return!1;for(i=r;0!=i--;)if(!("_owner"===o[i]&&t.$$typeof||e(t[o[i]],n[o[i]])))return!1;return!0}return t!=t&&n!=n}(e,t)}catch(e){if((e.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw e}}var we=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).ingKey="pinching",t.stateKey="pinch",t.pinchShouldStart=function(e){var n=$(e);return t.enabled&&2===n.touches},t.onPinchStart=function(e){if(t.pinchShouldStart(e)){var n=te(e,t.transform),r=n.values,i=n.origin;t.updateSharedState($(e)),t.updateGestureState(d({},z(h(t),r,e),F(h(t),e,!0),{cancel:t.onCancel,origin:i})),t.updateGestureState(t.getMovement(r)),t.fireGestureHandler()}},t.onPinchChange=function(e){var n=t.state;if(!n.canceled&&n._active){var r=$(e);t.updateSharedState(r);var i=te(e,t.transform),o=i.origin,a=t.getKinematics(i.values,e);t.updateGestureState(d({},F(h(t),e),a,{origin:o})),t.fireGestureHandler()}},t.onPinchEnd=function(e){t.clean(),t.state._active&&(t.updateSharedState({down:!1,touches:0}),t.updateGestureState(d({},F(h(t),e),t.getMovement(t.state.values),{_active:!1})),t.fireGestureHandler())},t.onCancel=function(){t.state.canceled||(t.updateGestureState({_active:!1,canceled:!0}),t.updateSharedState({down:!1,touches:0}),requestAnimationFrame((function(){return t.fireGestureHandler()})))},t.onGestureStart=function(e){if(t.enabled){e.preventDefault();var n=ee(e,t.transform);t.updateSharedState($(e)),t.updateGestureState(d({},z(h(t),n,e),F(h(t),e,!0),{origin:[e.clientX,e.clientY],cancel:t.onCancel})),t.updateGestureState(t.getMovement(n)),t.fireGestureHandler()}},t.onGestureChange=function(e){var n=t.state;if(!n.canceled&&n._active){e.preventDefault();var r=$(e);t.updateSharedState(r);var i=ee(e,t.transform),o=t.getKinematics(i,e);t.updateGestureState(d({},F(h(t),e),o,{origin:[e.clientX,e.clientY]})),t.fireGestureHandler()}},t.onGestureEnd=function(e){t.clean(),t.state._active&&(t.updateSharedState({down:!1,touches:0}),t.updateGestureState(d({},F(h(t),e),t.getMovement(t.state.values),{_active:!1,origin:[e.clientX,e.clientY]})),t.fireGestureHandler())},t.wheelShouldRun=function(e){return t.enabled&&e.ctrlKey},t.getWheelValuesFromEvent=function(e){var n=Z(e,t.transform)[1],r=t.state.values,i=r[1];return{values:[r[0]-n,void 0!==i?i:0],origin:[e.clientX,e.clientY],delta:[0,n]}},t.onWheel=function(e){t.wheelShouldRun(e)&&(t.setTimeout(t.onWheelEnd),t.state._active?t.onWheelChange(e):t.onWheelStart(e))},t.onWheelStart=function(e){var n=t.getWheelValuesFromEvent(e),r=n.values,i=n.delta,o=n.origin;e.cancelable&&e.preventDefault(),t.updateSharedState($(e)),t.updateGestureState(d({},z(h(t),r,e),F(h(t),e,!0),{initial:t.state.values,offset:r,delta:i,origin:o})),t.updateGestureState(t.getMovement(r)),t.fireGestureHandler()},t.onWheelChange=function(e){t.updateSharedState($(e));var n=t.getWheelValuesFromEvent(e),r=n.values,i=n.origin,o=n.delta;t.updateGestureState(d({},F(h(t),e),t.getKinematics(r,e),{origin:i,delta:o})),t.fireGestureHandler()},t.onWheelEnd=function(){t.clean(),t.state._active&&(t.state._active=!1,t.updateGestureState(t.getMovement(t.state.values)),t.fireGestureHandler())},t}return v(t,e),t.prototype.addBindings=function(e){this.controller.config.domTarget&&!this.controller.supportsTouchEvents&&this.controller.supportsGestureEvents?(le(e,"onGestureStart",this.onGestureStart),le(e,"onGestureChange",this.onGestureChange),le(e,"onGestureEnd",this.onGestureEnd)):(le(e,"onTouchStart",this.onPinchStart),le(e,"onTouchMove",this.onPinchChange),le(e,"onTouchEnd",this.onPinchEnd),le(e,"onTouchCancel",this.onPinchEnd),le(e,"onWheel",this.onWheel))},t}(function(e){function t(){return e.apply(this,arguments)||this}v(t,e);var n=t.prototype;return n.getInternalMovement=function(e,t){var n=t.values[1],r=e[0],o=e[1],a=void 0===o?n:o,s=a-n,c=t.turns;return Math.abs(s)>270&&(c+=u(s)),i([r,a-360*c],t.initial)},n.getKinematics=function(e,t){var n=this.getMovement(e);return d({turns:(e[1]-n.movement[1]-this.state.initial[1])/360},n,s(n.movement,n.delta,t.timeStamp-this.state.timeStamp))},n.mapStateValues=function(e){return{da:e.values,vdva:e.velocities}},t}(X)),be=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).ingKey="wheeling",t.stateKey="wheel",t.debounced=!0,t.handleEvent=function(e){if((!e.ctrlKey||!("pinch"in t.controller.handlers))&&t.enabled){t.setTimeout(t.onEnd),t.updateSharedState($(e));var n=r(Z(e,t.transform),t.state.values);if(t.state._active)t.updateGestureState(d({},F(h(t),e),t.getKinematics(n,e)));else{t.updateGestureState(d({},z(h(t),n,e),F(h(t),e,!0),{initial:t.state.values}));var i=t.getMovement(n),o=a(i.delta);t.updateGestureState(i),t.updateGestureState(o)}t.fireGestureHandler()}},t.onEnd=function(){if(t.clean(),t.state._active){var e=t.getMovement(t.state.values);t.updateGestureState(e),t.updateGestureState({_active:!1,velocities:[0,0],velocity:0}),t.fireGestureHandler()}},t}return v(t,e),t.prototype.addBindings=function(e){le(e,"onWheel",this.handleEvent)},t}(pe),_e=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).ingKey="moving",t.stateKey="move",t.debounced=!0,t.onMove=function(e){t.enabled&&(t.setTimeout(t.onMoveEnd),t.state._active?t.onMoveChange(e):t.onMoveStart(e))},t.onMoveStart=function(e){t.updateSharedState($(e));var n=J(e,t.transform);t.updateGestureState(d({},z(h(t),n,e),F(h(t),e,!0))),t.updateGestureState(t.getMovement(n)),t.fireGestureHandler()},t.onMoveChange=function(e){t.updateSharedState($(e));var n=J(e,t.transform);t.updateGestureState(d({},F(h(t),e),t.getKinematics(n,e))),t.fireGestureHandler()},t.onMoveEnd=function(){t.clean(),t.state._active&&(t.updateGestureState(t.getMovement(t.state.values)),t.updateGestureState({velocities:[0,0],velocity:0,_active:!1}),t.fireGestureHandler())},t.hoverTransform=function(){return t.controller.config.hover.transform||t.controller.config.transform},t.onPointerEnter=function(e){if(t.controller.state.shared.hovering=!0,t.controller.config.enabled){if(t.controller.config.hover.enabled){var n=J(e,t.hoverTransform()),r=d({},t.controller.state.shared,t.state,F(h(t),e,!0),{values:n,active:!0,hovering:!0});t.controller.handlers.hover(d({},r,t.mapStateValues(r)))}"move"in t.controller.handlers&&t.onMoveStart(e)}},t.onPointerLeave=function(e){if(t.controller.state.shared.hovering=!1,"move"in t.controller.handlers&&t.onMoveEnd(),t.controller.config.hover.enabled){var n=J(e,t.hoverTransform()),r=d({},t.controller.state.shared,t.state,F(h(t),e),{values:n,active:!1});t.controller.handlers.hover(d({},r,t.mapStateValues(r)))}},t}return v(t,e),t.prototype.addBindings=function(e){"move"in this.controller.handlers&&le(e,"onPointerMove",this.onMove),"hover"in this.controller.handlers&&(le(e,"onPointerEnter",this.onPointerEnter),le(e,"onPointerLeave",this.onPointerLeave))},t}(pe),Te=function(e){function t(){var t;return(t=e.apply(this,arguments)||this).ingKey="scrolling",t.stateKey="scroll",t.debounced=!0,t.handleEvent=function(e){if(t.enabled){t.clearTimeout(),t.setTimeout(t.onEnd);var n=Q(e,t.transform);if(t.updateSharedState($(e)),t.state._active)t.updateGestureState(d({},F(h(t),e),t.getKinematics(n,e)));else{t.updateGestureState(d({},z(h(t),n,e),F(h(t),e,!0),{initial:t.state.values}));var r=t.getMovement(n),i=a(r.delta);t.updateGestureState(r),t.updateGestureState(i)}t.fireGestureHandler()}},t.onEnd=function(){t.clean(),t.state._active&&(t.updateGestureState(d({},t.getMovement(t.state.values),{_active:!1,velocities:[0,0],velocity:0})),t.fireGestureHandler())},t}return v(t,e),t.prototype.addBindings=function(e){le(e,"onScroll",this.handleEvent)},t}(pe),Ge=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;function Me(e,t){var n=t+"Start",r=t+"End";return function(i){var o=void 0;return i.first&&n in e&&e[n](i),t in e&&(o=e[t](i)),i.last&&r in e&&e[r](i),o}}exports.addV=r,exports.rubberbandIfOutOfBounds=l,exports.subV=i,exports.useDrag=function(e,n){void 0===n&&(n={}),R.set("drag",me);var r=t.useRef();return r.current||(r.current=ye(j,Se)),fe({drag:e},r.current(n))},exports.useGesture=function(e,t){void 0===t&&(t={});var n=function(e){var t={},n={},r=new Set;for(var i in e)Ge.test(i)?(r.add(RegExp.lastMatch),n[i]=e[i]):t[i]=e[i];return[n,t,r]}(e),r=n[0],i=n[1],o=n[2];R.set("drag",me),R.set("hover",_e),R.set("move",_e),R.set("pinch",we),R.set("scroll",Te),R.set("wheel",be);var a=function(e,t){void 0===e&&(e={}),void 0===t&&(t=new Set);var n=e.drag,r=e.wheel,i=e.move,o=e.scroll,a=e.pinch,s=e.hover,u=P({domTarget:e.domTarget,eventOptions:e.eventOptions,transform:e.transform,window:e.window,enabled:e.enabled});return t.has("onDrag")&&(u.drag=C(n)),t.has("onWheel")&&(u.wheel=K(r)),t.has("onScroll")&&(u.scroll=K(o)),t.has("onMove")&&(u.move=K(i)),t.has("onPinch")&&(u.pinch=D(a)),t.has("onHover")&&(u.hover=d({enabled:!0},s)),u}(t,o),s={};return o.has("onDrag")&&(s.drag=Me(r,"onDrag")),o.has("onWheel")&&(s.wheel=Me(r,"onWheel")),o.has("onScroll")&&(s.scroll=Me(r,"onScroll")),o.has("onMove")&&(s.move=Me(r,"onMove")),o.has("onPinch")&&(s.pinch=Me(r,"onPinch")),o.has("onHover")&&(s.hover=r.onHover),fe(s,a,i)},exports.useHover=function(e,n){void 0===n&&(n={}),R.set("hover",_e);var r=t.useRef();return r.current||(r.current=ye(I,Se)),fe({hover:e},r.current(n))},exports.useMove=function(e,n){void 0===n&&(n={}),R.set("move",_e);var r=t.useRef();return r.current||(r.current=ye(k,Se)),fe({move:e},r.current(n))},exports.usePinch=function(e,n){void 0===n&&(n={}),R.set("pinch",we);var r=t.useRef();return r.current||(r.current=ye(H,Se)),fe({pinch:e},r.current(n))},exports.useScroll=function(e,n){void 0===n&&(n={}),R.set("scroll",Te);var r=t.useRef();return r.current||(r.current=ye(W,Se)),fe({scroll:e},r.current(n))},exports.useWheel=function(e,n){void 0===n&&(n={}),R.set("wheel",be);var r=t.useRef();return r.current||(r.current=ye(A,Se)),fe({wheel:e},r.current(n))}; | ||
//# sourceMappingURL=react-use-gesture.cjs.production.min.js.map |
@@ -26,3 +26,3 @@ /// <reference types="react" /> | ||
get handler(): NonNullable<import("../types").InternalHandlers[T]>; | ||
get transform(): ((v: Vector2) => Vector2) | undefined; | ||
get transform(): (xy: Vector2) => Vector2; | ||
protected updateSharedState(sharedState: Partial<SharedGestureState> | null): void; | ||
@@ -29,0 +29,0 @@ protected updateGestureState(gestureState: PartialGestureState<T> | null): void; |
@@ -18,3 +18,2 @@ /// <reference types="react" /> | ||
}; | ||
declare type TransformType = (v: Vector2) => Vector2; | ||
/** | ||
@@ -25,3 +24,3 @@ * Gets pointer event values. | ||
*/ | ||
export declare function getPointerEventValues(event: TouchEvent | React.TouchEvent | React.PointerEvent | PointerEvent, transform?: TransformType): Vector2; | ||
export declare function getPointerEventValues(event: TouchEvent | React.TouchEvent | React.PointerEvent | PointerEvent, transform?: (xy: Vector2) => Vector2): Vector2; | ||
/** | ||
@@ -32,3 +31,3 @@ * Gets scroll event values | ||
*/ | ||
export declare function getScrollEventValues(event: React.UIEvent | UIEvent, transform?: TransformType): Vector2; | ||
export declare function getScrollEventValues(event: React.UIEvent | UIEvent, transform?: (xy: Vector2) => Vector2): Vector2; | ||
/** | ||
@@ -39,3 +38,3 @@ * Gets wheel event values. | ||
*/ | ||
export declare function getWheelEventValues(event: React.WheelEvent | WheelEvent, transform?: TransformType): Vector2; | ||
export declare function getWheelEventValues(event: React.WheelEvent | WheelEvent, transform?: (xy: Vector2) => Vector2): Vector2; | ||
/** | ||
@@ -46,3 +45,3 @@ * Gets webkit gesture event values. | ||
*/ | ||
export declare function getWebkitGestureEventValues(event: WebKitGestureEvent, transform?: TransformType): Vector2; | ||
export declare function getWebkitGestureEventValues(event: WebKitGestureEvent, transform?: (xy: Vector2) => Vector2): Vector2; | ||
/** | ||
@@ -53,6 +52,5 @@ * Gets two touches event data | ||
*/ | ||
export declare function getTwoTouchesEventData(event: React.TouchEvent | TouchEvent, transform?: TransformType): { | ||
export declare function getTwoTouchesEventData(event: React.TouchEvent | TouchEvent, transform?: (xy: Vector2) => Vector2): { | ||
values: Vector2; | ||
origin: Vector2; | ||
}; | ||
export {}; |
{ | ||
"name": "react-use-gesture", | ||
"version": "8.1.0-alpha.12", | ||
"version": "8.1.0-beta.1", | ||
"description": "React hook for receiving gestures https://use-gesture.netlify.app", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
633869
5404