@egjs/view360
Version:
360 integrated viewing solution from inside-out view to outside-in view. It provides user-friendly service by rotating 360 degrees through various user interaction such as motion sensor and touch.
10 lines • 137 kB
JavaScript
/*
Copyright (c) 2017 NAVER Corp.
@egjs/view360 project is licensed under the MIT license
@egjs/view360 JavaScript library
https://github.com/naver/egjs-view360
@version 3.2.2-rc
All-in-one packaged file for ease use of '@egjs/view360' with below dependencies.
- @egjs/agent ^2.1.5, @egjs/axes ^2.5.8, @egjs/component ^2.1.2, es6-promise ^4.2.5, webvr-polyfill ^0.9.16
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t.eg=t.eg||{},t.eg.view360={}))}(this,function(t){"use strict";function u(){return(u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t}).apply(this,arguments)}function c(t,e){t.prototype=Object.create(e.prototype),(t.prototype.constructor=t).__proto__=e}function h(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var W="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var e,i=(function(t,e){t.exports=function(){function u(t){return"function"==typeof t}var i=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},n=0,e=void 0,r=void 0,a=function(t,e){d[n]=t,d[n+1]=e,2===(n+=2)&&(r?r(f):_())},t="undefined"!=typeof window?window:void 0,o=t||{},s=o.MutationObserver||o.WebKitMutationObserver,h="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),c="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function l(){var t=setTimeout;return function(){return t(f,1)}}var d=new Array(1e3);function f(){for(var t=0;t<n;t+=2){var e=d[t],i=d[t+1];e(i),d[t]=void 0,d[t+1]=void 0}n=0}var p,m,v,g,_=void 0;function y(t,e){var i=this,n=new this.constructor(w);void 0===n[E]&&U(n);var r=i._state;if(r){var o=arguments[r-1];a(function(){return N(r,n,o,i._result)})}else L(i,n,t,e);return n}function x(t){if(t&&"object"==typeof t&&t.constructor===this)return t;var e=new this(w);return S(e,t),e}_=h?function(){return process.nextTick(f)}:s?(m=0,v=new s(f),g=document.createTextNode(""),v.observe(g,{characterData:!0}),function(){g.data=m=++m%2}):c?((p=new MessageChannel).port1.onmessage=f,function(){return p.port2.postMessage(0)}):void 0===t?function(){try{var t=Function("return this")().require("vertx");return void 0===(e=t.runOnLoop||t.runOnContext)?l():function(){e(f)}}catch(t){return l()}}():l();var E=Math.random().toString(36).substring(2);function w(){}var T=void 0,R=1,b=2,I={error:null};function A(t){try{return t.then}catch(t){return I.error=t,I}}function C(t,e,i,n){try{t.call(e,i,n)}catch(t){return t}}function P(t,e,i){var n,r,o,s;e.constructor===t.constructor&&i===y&&e.constructor.resolve===x?(o=t,(s=e)._state===R?M(o,s._result):s._state===b?D(o,s._result):L(s,void 0,function(t){return S(o,t)},function(t){return D(o,t)})):i===I?(D(t,I.error),I.error=null):void 0===i?M(t,e):u(i)?(n=e,r=i,a(function(e){var i=!1,t=C(r,n,function(t){i||(i=!0,n!==t?S(e,t):M(e,t))},function(t){i||(i=!0,D(e,t))},e._label);!i&&t&&(i=!0,D(e,t))},t)):M(t,e)}function S(t,e){var i,n;t===e?D(t,new TypeError("You cannot resolve a promise with itself")):(n=typeof(i=e),null===i||"object"!==n&&"function"!==n?M(t,e):P(t,e,A(e)))}function O(t){t._onerror&&t._onerror(t._result),V(t)}function M(t,e){t._state===T&&(t._result=e,t._state=R,0!==t._subscribers.length&&a(V,t))}function D(t,e){t._state===T&&(t._state=b,t._result=e,a(O,t))}function L(t,e,i,n){var r=t._subscribers,o=r.length;t._onerror=null,r[o]=e,r[o+R]=i,r[o+b]=n,0===o&&t._state&&a(V,t)}function V(t){var e=t._subscribers,i=t._state;if(0!==e.length){for(var n=void 0,r=void 0,o=t._result,s=0;s<e.length;s+=3)n=e[s],r=e[s+i],n?N(i,n,r,o):r(o);t._subscribers.length=0}}function N(t,e,i,n){var r=u(i),o=void 0,s=void 0,a=void 0,h=void 0;if(r){if((o=function(t,e){try{return t(e)}catch(t){return I.error=t,I}}(i,n))===I?(h=!0,s=o.error,o.error=null):a=!0,e===o)return void D(e,new TypeError("A promises callback cannot return that same promise."))}else o=n,a=!0;e._state!==T||(r&&a?S(e,o):h?D(e,s):t===R?M(e,o):t===b&&D(e,o))}var F=0;function U(t){t[E]=F++,t._state=void 0,t._result=void 0,t._subscribers=[]}var z=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(w),this.promise[E]||U(this.promise),i(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?M(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&M(this.promise,this._result))):D(this.promise,new Error("Array Methods must be provided an Array"))}return t.prototype._enumerate=function(t){for(var e=0;this._state===T&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(e,t){var i=this._instanceConstructor,n=i.resolve;if(n===x){var r=A(e);if(r===y&&e._state!==T)this._settledAt(e._state,t,e._result);else if("function"!=typeof r)this._remaining--,this._result[t]=e;else if(i===Q){var o=new i(w);P(o,e,r),this._willSettleAt(o,t)}else this._willSettleAt(new i(function(t){return t(e)}),t)}else this._willSettleAt(n(e),t)},t.prototype._settledAt=function(t,e,i){var n=this.promise;n._state===T&&(this._remaining--,t===b?D(n,i):this._result[e]=i),0===this._remaining&&M(n,this._result)},t.prototype._willSettleAt=function(t,e){var i=this;L(t,void 0,function(t){return i._settledAt(R,e,t)},function(t){return i._settledAt(b,e,t)})},t}(),Q=function(){function e(t){this[E]=F++,this._result=this._state=void 0,this._subscribers=[],w!==t&&("function"!=typeof t&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof e?function(e,t){try{t(function(t){S(e,t)},function(t){D(e,t)})}catch(t){D(e,t)}}(this,t):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return e.prototype.catch=function(t){return this.then(null,t)},e.prototype.finally=function(e){var i=this.constructor;return u(e)?this.then(function(t){return i.resolve(e()).then(function(){return t})},function(t){return i.resolve(e()).then(function(){throw t})}):this.then(e,e)},e}();return Q.prototype.then=y,Q.all=function(t){return new z(this,t).promise},Q.race=function(r){var o=this;return i(r)?new o(function(t,e){for(var i=r.length,n=0;n<i;n++)o.resolve(r[n]).then(t,e)}):new o(function(t,e){return e(new TypeError("You must pass an array to race."))})},Q.resolve=x,Q.reject=function(t){var e=new this(w);return D(e,t),e},Q._setScheduler=function(t){r=t},Q._setAsap=function(t){a=t},Q._asap=a,Q.polyfill=function(){var t=void 0;if(void 0!==W)t=W;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var i=null;try{i=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===i&&!e.cast)return}t.Promise=Q},Q.Promise=Q}()}(e={exports:{}},e.exports),e.exports);function a(t){return void 0===t}var n=function(){var t=function(){function t(){this._eventHandler={},this.options={}}var e=t.prototype;return e.trigger=function(t,e){void 0===e&&(e={});var i=this._eventHandler[t]||[];if(!(0<i.length))return!0;i=i.concat(),e.eventType=t;var n=!1,r=[e],o=0;e.stop=function(){n=!0},e.currentTarget=this;for(var s=arguments.length,a=new Array(2<s?s-2:0),h=2;h<s;h++)a[h-2]=arguments[h];for(1<=a.length&&(r=r.concat(a)),o=0;i[o];o++)i[o].apply(this,r);return!n},e.once=function(r,o){if("object"==typeof r&&a(o)){var t,e=r;for(t in e)this.once(t,e[t]);return this}if("string"==typeof r&&"function"==typeof o){var s=this;this.on(r,function t(){for(var e=arguments.length,i=new Array(e),n=0;n<e;n++)i[n]=arguments[n];o.apply(s,i),s.off(r,t)})}return this},e.hasOn=function(t){return!!this._eventHandler[t]},e.on=function(t,e){if("object"==typeof t&&a(e)){var i,n=t;for(i in n)this.on(i,n[i]);return this}if("string"==typeof t&&"function"==typeof e){var r=this._eventHandler[t];a(r)&&(this._eventHandler[t]=[],r=this._eventHandler[t]),r.push(e)}return this},e.off=function(t,e){if(a(t))return this._eventHandler={},this;if(a(e)){if("string"==typeof t)return this._eventHandler[t]=void 0,this;var i,n=t;for(i in n)this.off(i,n[i]);return this}var r,o,s=this._eventHandler[t];if(s)for(r=0;void 0!==(o=s[r]);r++)if(o===e){s=s.splice(r,1);break}return this},t}();return t.VERSION="2.1.2",t}(),r="undefined"!=typeof window&&window.Math===Math?window:"undefined"!=typeof self&&self.Math===Math?self:Function("return this")(),o=r.document,s=r.navigator.userAgent,l=-1!==s.indexOf("Safari")&&-1===s.indexOf("Chrome")&&-1!==s.indexOf("Mac OS X");r.Float32Array=void 0!==r.Float32Array?r.Float32Array:r.Array;r.Float32Array;var d=r.getComputedStyle,f=r.navigator.userAgent,p="ontouchstart"in r,m="ondevicemotion"in r,v=r.DeviceMotionEvent,g=r.devicePixelRatio,_=function(){for(var t=o.documentElement.style,e=["transform","webkitTransform","msTransform","mozTransform"],i=0,n=e.length;i<n;i++)if(e[i]in t)return e[i];return""}(),y=r.CSS&&r.CSS.supports&&r.CSS.supports("will-change","transform");function x(){return(x=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t}).apply(this,arguments)}function E(t,e){t.prototype=Object.create(e.prototype),(t.prototype.constructor=t).__proto__=e}function w(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var T,R="function"!=typeof Object.assign?function(t){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),i=1;i<arguments.length;i++){var n=arguments[i];if(null!=n)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}:Object.assign,b=["","webkit","Moz","MS","ms","o"],I="undefined"==typeof document?{style:{}}:document.createElement("div"),A="function",C=Math.round,P=Math.abs,S=Date.now;function O(t,e){for(var i,n,r=e[0].toUpperCase()+e.slice(1),o=0;o<b.length;){if((n=(i=b[o])?i+r:e)in t)return n;o++}}T="undefined"==typeof window?{}:window;var M=O(I.style,"touchAction"),D=void 0!==M;var L="compute",V="auto",N="manipulation",F="none",U="pan-x",z="pan-y",Q=function(){if(!D)return!1;var e={},i=T.CSS&&T.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(t){return e[t]=!i||T.CSS.supports("touch-action",t)}),e}(),X="ontouchstart"in T,Y=void 0!==O(T,"PointerEvent"),G=X&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),k="touch",H="mouse",B=25,j=1,q=4,K=8,Z=1,J=2,$=4,tt=8,et=16,it=J|$,nt=tt|et,rt=it|nt,ot=["x","y"],st=["clientX","clientY"];function at(t,e,i){var n;if(t)if(t.forEach)t.forEach(e,i);else if(void 0!==t.length)for(n=0;n<t.length;)e.call(i,t[n],n,t),n++;else for(n in t)t.hasOwnProperty(n)&&e.call(i,t[n],n,t)}function ht(t,e){return typeof t===A?t.apply(e&&e[0]||void 0,e):t}function ut(t,e){return-1<t.indexOf(e)}var ct=function(){function t(t,e){this.manager=t,this.set(e)}var e=t.prototype;return e.set=function(t){t===L&&(t=this.compute()),D&&this.manager.element.style&&Q[t]&&(this.manager.element.style[M]=t),this.actions=t.toLowerCase().trim()},e.update=function(){this.set(this.manager.options.touchAction)},e.compute=function(){var e=[];return at(this.manager.recognizers,function(t){ht(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))}),function(t){if(ut(t,F))return F;var e=ut(t,U),i=ut(t,z);return e&&i?F:e||i?e?U:z:ut(t,N)?N:V}(e.join(" "))},e.preventDefaults=function(t){var e=t.srcEvent,i=t.offsetDirection;if(this.manager.session.prevented)e.preventDefault();else{var n=this.actions,r=ut(n,F)&&!Q[F],o=ut(n,z)&&!Q[z],s=ut(n,U)&&!Q[U];if(r){var a=1===t.pointers.length,h=t.distance<2,u=t.deltaTime<250;if(a&&h&&u)return}if(!s||!o)return r||o&&i&it||s&&i&nt?this.preventSrc(e):void 0}},e.preventSrc=function(t){this.manager.session.prevented=!0,t.preventDefault()},t}();function lt(t,e){for(;t;){if(t===e)return!0;t=t.parentNode}return!1}function dt(t){var e=t.length;if(1===e)return{x:C(t[0].clientX),y:C(t[0].clientY)};for(var i=0,n=0,r=0;r<e;)i+=t[r].clientX,n+=t[r].clientY,r++;return{x:C(i/e),y:C(n/e)}}function ft(t){for(var e=[],i=0;i<t.pointers.length;)e[i]={clientX:C(t.pointers[i].clientX),clientY:C(t.pointers[i].clientY)},i++;return{timeStamp:S(),pointers:e,center:dt(e),deltaX:t.deltaX,deltaY:t.deltaY}}function pt(t,e,i){i||(i=ot);var n=e[i[0]]-t[i[0]],r=e[i[1]]-t[i[1]];return Math.sqrt(n*n+r*r)}function mt(t,e,i){i||(i=ot);var n=e[i[0]]-t[i[0]],r=e[i[1]]-t[i[1]];return 180*Math.atan2(r,n)/Math.PI}function vt(t,e){return t===e?Z:P(t)>=P(e)?t<0?J:$:e<0?tt:et}function gt(t,e,i){return{x:e/t||0,y:i/t||0}}function _t(t,e){var i=t.session,n=e.pointers,r=n.length;i.firstInput||(i.firstInput=ft(e)),1<r&&!i.firstMultiple?i.firstMultiple=ft(e):1===r&&(i.firstMultiple=!1);var o,s,a,h,u,c,l=i.firstInput,d=i.firstMultiple,f=d?d.center:l.center,p=e.center=dt(n);e.timeStamp=S(),e.deltaTime=e.timeStamp-l.timeStamp,e.angle=mt(f,p),e.distance=pt(f,p),o=i,a=(s=e).center,h=o.offsetDelta||{},u=o.prevDelta||{},c=o.prevInput||{},s.eventType!==j&&c.eventType!==q||(u=o.prevDelta={x:c.deltaX||0,y:c.deltaY||0},h=o.offsetDelta={x:a.x,y:a.y}),s.deltaX=u.x+(a.x-h.x),s.deltaY=u.y+(a.y-h.y),e.offsetDirection=vt(e.deltaX,e.deltaY);var m,v,g,_,y=gt(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=y.x,e.overallVelocityY=y.y,e.overallVelocity=P(y.x)>P(y.y)?y.x:y.y,e.scale=d?(m=d.pointers,pt((v=n)[0],v[1],st)/pt(m[0],m[1],st)):1,e.rotation=d?(g=d.pointers,mt((_=n)[1],_[0],st)+mt(g[1],g[0],st)):0,e.maxPointers=i.prevInput?e.pointers.length>i.prevInput.maxPointers?e.pointers.length:i.prevInput.maxPointers:e.pointers.length,function(t,e){var i,n,r,o,s=t.lastInterval||e,a=e.timeStamp-s.timeStamp;if(e.eventType!==K&&(B<a||void 0===s.velocity)){var h=e.deltaX-s.deltaX,u=e.deltaY-s.deltaY,c=gt(a,h,u);n=c.x,r=c.y,i=P(c.x)>P(c.y)?c.x:c.y,o=vt(h,u),t.lastInterval=e}else i=s.velocity,n=s.velocityX,r=s.velocityY,o=s.direction;e.velocity=i,e.velocityX=n,e.velocityY=r,e.direction=o}(i,e);var x=t.element;lt(e.srcEvent.target,x)&&(x=e.srcEvent.target),e.target=x}function yt(t,e,i){var n=i.pointers.length,r=i.changedPointers.length,o=e&j&&n-r==0,s=e&(q|K)&&n-r==0;i.isFirst=!!o,i.isFinal=!!s,o&&(t.session={}),i.eventType=e,_t(t,i),t.emit("hammer.input",i),t.recognize(i),t.session.prevInput=i}function xt(t){return t.trim().split(/\s+/g)}function Et(e,t,i){at(xt(t),function(t){e.addEventListener(t,i,!1)})}function wt(e,t,i){at(xt(t),function(t){e.removeEventListener(t,i,!1)})}function Tt(t){var e=t.ownerDocument||t;return e.defaultView||e.parentWindow||window}var Rt=function(){function t(e,t){var i=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(t){ht(e.options.enable,[e])&&i.handler(t)},this.init()}var e=t.prototype;return e.handler=function(){},e.init=function(){this.evEl&&Et(this.element,this.evEl,this.domHandler),this.evTarget&&Et(this.target,this.evTarget,this.domHandler),this.evWin&&Et(Tt(this.element),this.evWin,this.domHandler)},e.destroy=function(){this.evEl&&wt(this.element,this.evEl,this.domHandler),this.evTarget&&wt(this.target,this.evTarget,this.domHandler),this.evWin&&wt(Tt(this.element),this.evWin,this.domHandler)},t}();function bt(t,e,i){if(t.indexOf&&!i)return t.indexOf(e);for(var n=0;n<t.length;){if(i&&t[n][i]==e||!i&&t[n]===e)return n;n++}return-1}var It={pointerdown:j,pointermove:2,pointerup:q,pointercancel:K,pointerout:K},At={2:k,3:"pen",4:H,5:"kinect"},Ct="pointerdown",Pt="pointermove pointerup pointercancel";T.MSPointerEvent&&!T.PointerEvent&&(Ct="MSPointerDown",Pt="MSPointerMove MSPointerUp MSPointerCancel");var St=function(i){function n(){var t,e=n.prototype;return e.evEl=Ct,e.evWin=Pt,(t=i.apply(this,arguments)||this).store=t.manager.session.pointerEvents=[],t}return E(n,i),n.prototype.handler=function(t){var e=this.store,i=!1,n=t.type.toLowerCase().replace("ms",""),r=It[n],o=At[t.pointerType]||t.pointerType,s=o===k,a=bt(e,t.pointerId,"pointerId");r&j&&(0===t.button||s)?a<0&&(e.push(t),a=e.length-1):r&(q|K)&&(i=!0),a<0||(e[a]=t,this.callback(this.manager,r,{pointers:e,changedPointers:[t],pointerType:o,srcEvent:t}),i&&e.splice(a,1))},n}(Rt);function Ot(t){return Array.prototype.slice.call(t,0)}function Mt(t,i,e){for(var n=[],r=[],o=0;o<t.length;){var s=i?t[o][i]:t[o];bt(r,s)<0&&n.push(t[o]),r[o]=s,o++}return e&&(n=i?n.sort(function(t,e){return t[i]>e[i]}):n.sort()),n}var Dt={touchstart:j,touchmove:2,touchend:q,touchcancel:K},Lt=function(t){function e(){return e.prototype.evTarget="touchstart touchmove touchend touchcancel",e.prototype.targetIds={},t.apply(this,arguments)||this}return E(e,t),e.prototype.handler=function(t){var e=Dt[t.type],i=function(t,e){var i,n,r=Ot(t.touches),o=this.targetIds;if(e&(2|j)&&1===r.length)return o[r[0].identifier]=!0,[r,r];var s=Ot(t.changedTouches),a=[],h=this.target;if(n=r.filter(function(t){return lt(t.target,h)}),e===j)for(i=0;i<n.length;)o[n[i].identifier]=!0,i++;i=0;for(;i<s.length;)o[s[i].identifier]&&a.push(s[i]),e&(q|K)&&delete o[s[i].identifier],i++;return a.length?[Mt(n.concat(a),"identifier",!0),a]:void 0}.call(this,t,e);i&&this.callback(this.manager,e,{pointers:i[0],changedPointers:i[1],pointerType:k,srcEvent:t})},e}(Rt);var Vt={mousedown:j,mousemove:2,mouseup:q},Nt=function(i){function n(){var t,e=n.prototype;return e.evEl="mousedown",e.evWin="mousemove mouseup",(t=i.apply(this,arguments)||this).pressed=!1,t}return E(n,i),n.prototype.handler=function(t){var e=Vt[t.type];e&j&&0===t.button&&(this.pressed=!0),2&e&&1!==t.which&&(e=q),this.pressed&&(e&q&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:H,srcEvent:t}))},n}(Rt),Ft=2500,Ut=25;function zt(t){var e=t.changedPointers[0];if(e.identifier===this.primaryTouch){var i={x:e.clientX,y:e.clientY},n=this.lastTouches;this.lastTouches.push(i);setTimeout(function(){var t=n.indexOf(i);-1<t&&n.splice(t,1)},Ft)}}var Qt=function(){return function(i){function t(t,e){var o;return(o=i.call(this,t,e)||this).handler=function(t,e,i){var n=i.pointerType===k,r=i.pointerType===H;if(!(r&&i.sourceCapabilities&&i.sourceCapabilities.firesTouchEvents)){if(n)(function(t,e){t&j?(this.primaryTouch=e.changedPointers[0].identifier,zt.call(this,e)):t&(q|K)&&zt.call(this,e)}).call(w(w(o)),e,i);else if(r&&function(t){for(var e=t.srcEvent.clientX,i=t.srcEvent.clientY,n=0;n<this.lastTouches.length;n++){var r=this.lastTouches[n],o=Math.abs(e-r.x),s=Math.abs(i-r.y);if(o<=Ut&&s<=Ut)return!0}return!1}.call(w(w(o)),i))return;o.callback(t,e,i)}},o.touch=new Lt(o.manager,o.handler),o.mouse=new Nt(o.manager,o.handler),o.primaryTouch=null,o.lastTouches=[],o}return E(t,i),t.prototype.destroy=function(){this.touch.destroy(),this.mouse.destroy()},t}(Rt)}();function Wt(t,e,i){return!!Array.isArray(t)&&(at(t,i[e],i),!0)}var Xt=1;function Yt(t,e){var i=e.manager;return i?i.get(t):t}function Gt(t){return 16&t?"cancel":8&t?"end":4&t?"move":2&t?"start":""}var kt=function(){function t(t){void 0===t&&(t={}),this.options=x({enable:!0},t),this.id=Xt++,this.manager=null,this.state=1,this.simultaneous={},this.requireFail=[]}var e=t.prototype;return e.set=function(t){return R(this.options,t),this.manager&&this.manager.touchAction.update(),this},e.recognizeWith=function(t){if(Wt(t,"recognizeWith",this))return this;var e=this.simultaneous;return e[(t=Yt(t,this)).id]||(e[t.id]=t).recognizeWith(this),this},e.dropRecognizeWith=function(t){return Wt(t,"dropRecognizeWith",this)||(t=Yt(t,this),delete this.simultaneous[t.id]),this},e.requireFailure=function(t){if(Wt(t,"requireFailure",this))return this;var e=this.requireFail;return-1===bt(e,t=Yt(t,this))&&(e.push(t),t.requireFailure(this)),this},e.dropRequireFailure=function(t){if(Wt(t,"dropRequireFailure",this))return this;t=Yt(t,this);var e=bt(this.requireFail,t);return-1<e&&this.requireFail.splice(e,1),this},e.hasRequireFailures=function(){return 0<this.requireFail.length},e.canRecognizeWith=function(t){return!!this.simultaneous[t.id]},e.emit=function(e){var i=this,t=this.state;function n(t){i.manager.emit(t,e)}t<8&&n(i.options.event+Gt(t)),n(i.options.event),e.additionalEvent&&n(e.additionalEvent),8<=t&&n(i.options.event+Gt(t))},e.tryEmit=function(t){if(this.canEmit())return this.emit(t);this.state=32},e.canEmit=function(){for(var t=0;t<this.requireFail.length;){if(!(33&this.requireFail[t].state))return!1;t++}return!0},e.recognize=function(t){var e=R({},t);if(!ht(this.options.enable,[this,e]))return this.reset(),void(this.state=32);56&this.state&&(this.state=1),this.state=this.process(e),30&this.state&&this.tryEmit(e)},e.process=function(t){},e.getTouchAction=function(){},e.reset=function(){},t}(),Ht={domEvents:!1,touchAction:L,enable:!0,inputTarget:null,inputClass:null,preset:[],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};function Bt(i,n){var r,o=i.element;o.style&&(at(i.options.cssProps,function(t,e){r=O(o.style,e),o.style[r]=n?(i.oldCssProps[r]=o.style[r],t):i.oldCssProps[r]||""}),n||(i.oldCssProps={}))}var jt=function(){function t(t,e){var i,n=this;this.options=R({},Ht,e||{}),this.options.inputTarget=this.options.inputTarget||t,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=t,this.input=new((i=this).options.inputClass||(Y?St:G?Lt:X?Qt:Nt))(i,yt),this.touchAction=new ct(this,this.options.touchAction),Bt(this,!0),at(this.options.recognizers,function(t){var e=n.add(new t[0](t[1]));t[2]&&e.recognizeWith(t[2]),t[3]&&e.requireFailure(t[3])},this)}var e=t.prototype;return e.set=function(t){return R(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this},e.stop=function(t){this.session.stopped=t?2:1},e.recognize=function(t){var e=this.session;if(!e.stopped){var i;this.touchAction.preventDefaults(t);var n=this.recognizers,r=e.curRecognizer;(!r||r&&8&r.state)&&(r=e.curRecognizer=null);for(var o=0;o<n.length;)i=n[o],2===e.stopped||r&&i!==r&&!i.canRecognizeWith(r)?i.reset():i.recognize(t),!r&&14&i.state&&(r=e.curRecognizer=i),o++}},e.get=function(t){if(t instanceof kt)return t;for(var e=this.recognizers,i=0;i<e.length;i++)if(e[i].options.event===t)return e[i];return null},e.add=function(t){if(Wt(t,"add",this))return this;var e=this.get(t.options.event);return e&&this.remove(e),this.recognizers.push(t),(t.manager=this).touchAction.update(),t},e.remove=function(t){if(Wt(t,"remove",this))return this;var e=this.get(t);if(t){var i=this.recognizers,n=bt(i,e);-1!==n&&(i.splice(n,1),this.touchAction.update())}return this},e.on=function(t,e){if(void 0===t||void 0===e)return this;var i=this.handlers;return at(xt(t),function(t){i[t]=i[t]||[],i[t].push(e)}),this},e.off=function(t,e){if(void 0===t)return this;var i=this.handlers;return at(xt(t),function(t){e?i[t]&&i[t].splice(bt(i[t],e),1):delete i[t]}),this},e.emit=function(t,e){var i,n,r;this.options.domEvents&&(i=t,n=e,(r=document.createEvent("Event")).initEvent(i,!0,!0),(r.gesture=n).target.dispatchEvent(r));var o=this.handlers[t]&&this.handlers[t].slice();if(o&&o.length){e.type=t,e.preventDefault=function(){e.srcEvent.preventDefault()};for(var s=0;s<o.length;)o[s](e),s++}},e.destroy=function(){this.element&&Bt(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null},t}();var qt=function(e){function t(t){return void 0===t&&(t={}),e.call(this,x({pointers:1},t))||this}E(t,e);var i=t.prototype;return i.attrTest=function(t){var e=this.options.pointers;return 0===e||t.pointers.length===e},i.process=function(t){var e=this.state,i=t.eventType,n=6&e,r=this.attrTest(t);return n&&(i&K||!r)?16|e:n||r?i&q?8|e:2&e?4|e:2:32},t}(kt);function Kt(t){return t===et?"down":t===tt?"up":t===J?"left":t===$?"right":""}var Zt=function(i){function t(t){var e;return void 0===t&&(t={}),(e=i.call(this,x({event:"pan",threshold:10,pointers:1,direction:rt},t))||this).pX=null,e.pY=null,e}E(t,i);var e=t.prototype;return e.getTouchAction=function(){var t=this.options.direction,e=[];return t&it&&e.push(z),t&nt&&e.push(U),e},e.directionTest=function(t){var e=this.options,i=!0,n=t.distance,r=t.direction,o=t.deltaX,s=t.deltaY;return r&e.direction||(n=e.direction&it?(r=0===o?Z:o<0?J:$,i=o!==this.pX,Math.abs(t.deltaX)):(r=0===s?Z:s<0?tt:et,i=s!==this.pY,Math.abs(t.deltaY))),t.direction=r,i&&n>e.threshold&&r&e.direction},e.attrTest=function(t){return qt.prototype.attrTest.call(this,t)&&(2&this.state||!(2&this.state)&&this.directionTest(t))},e.emit=function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=Kt(t.direction);e&&(t.additionalEvent=this.options.event+e),i.prototype.emit.call(this,t)},t}(qt),Jt=function(i){function t(t){return void 0===t&&(t={}),i.call(this,x({event:"pinch",threshold:0,pointers:2},t))||this}E(t,i);var e=t.prototype;return e.getTouchAction=function(){return[F]},e.attrTest=function(t){return i.prototype.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||2&this.state)},e.emit=function(t){if(1!==t.scale){var e=t.scale<1?"in":"out";t.additionalEvent=this.options.event+e}i.prototype.emit.call(this,t)},t}(qt),$t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])};var te=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var r in e=arguments[i])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t};function ee(t,e,i,n){var r=t,o=[i[0]?e[0]:n?e[0]-n[0]:e[0],i[1]?e[1]:n?e[1]+n[1]:e[1]];return r=Math.max(o[0],r),+(r=Math.min(o[1],r)).toFixed(5)}function ie(t,e){return t<e[0]||t>e[1]}function ne(t,e,i){return i[1]&&t>e[1]||i[0]&&t<e[0]}function re(t,e,i){var n=t,r=e[0],o=e[1],s=o-r;return i[1]&&o<t&&(n=(n-o)%s+r),i[0]&&t<r&&(n=(n-r)%s+o),+n.toFixed(5)}function oe(t,e){for(var i in t)if(t[i]!==e[i])return!1;return!0}var se,ae=function(){function t(t,e){var i=this;this.axis=t,this.options=e,this._complementOptions(),this._pos=Object.keys(this.axis).reduce(function(t,e){return t[e]=i.axis[e].range[0],t},{})}var e=t.prototype;return e._complementOptions=function(){var r=this;Object.keys(this.axis).forEach(function(n){r.axis[n]=te({range:[0,100],bounce:[0,0],circular:[!1,!1]},r.axis[n]),["bounce","circular"].forEach(function(t){var e=r.axis,i=e[n][t];/string|number|boolean/.test(typeof i)&&(e[n][t]=[i,i])})})},e.getDelta=function(t,e){var i=this.get(t);return this.map(this.get(e),function(t,e){return t-i[e]})},e.get=function(t){var i=this;return t&&Array.isArray(t)?t.reduce(function(t,e){return e&&e in i._pos&&(t[e]=i._pos[e]),t},{}):te({},this._pos,t||{})},e.moveTo=function(i){var n=this,t=this.map(this._pos,function(t,e){return i[e]?i[e]-n._pos[e]:0});return this.set(i),{pos:te({},this._pos),delta:t}},e.set=function(t){for(var e in t)e&&e in this._pos&&(this._pos[e]=t[e])},e.every=function(t,e){var i=this.axis;for(var n in t)if(n&&!e(t[n],n,i[n]))return!1;return!0},e.filter=function(t,e){var i={},n=this.axis;for(var r in t)r&&e(t[r],r,n[r])&&(i[r]=t[r]);return i},e.map=function(t,e){var i={},n=this.axis;for(var r in t)r&&(i[r]=e(t[r],r,n[r]));return i},e.isOutside=function(t){return!this.every(t?this.get(t):this._pos,function(t,e,i){return!ie(t,i.range)})},t}();function he(t){for(var e=[],i=0,n=t.length;i<n;i++)e.push(t[i]);return e}function ue(t,e){var i;if(void 0===e&&(e=!1),"string"==typeof t){if(t.match(/^<([a-z]+)\s*([^>]*)>/)){var n=document.createElement("div");n.innerHTML=t,i=he(n.childNodes)}else i=he(document.querySelectorAll(t));e||(i=1<=i.length?i[0]:void 0)}else t===se?i=t:!t.nodeName||1!==t.nodeType&&9!==t.nodeType?"jQuery"in se&&t instanceof jQuery||t.constructor.prototype.jquery?i=e?t.toArray():t.get(0):Array.isArray(t)&&(i=t.map(function(t){return ue(t)}),e||(i=1<=i.length?i[0]:void 0)):i=t;return i}var ce=(se="undefined"==typeof window?{}:window).requestAnimationFrame||se.webkitRequestAnimationFrame,le=se.cancelAnimationFrame||se.webkitCancelAnimationFrame;if(ce&&!le){var de={},fe=ce;ce=function(e){var i=fe(function(t){de[i]&&e(t)});return de[i]=!0,i},le=function(t){delete de[t]}}else ce&&le||(ce=function(t){return se.setTimeout(function(){t(se.performance&&se.performance.now&&se.performance.now()||(new Date).getTime())},16)},le=se.clearTimeout);function pe(t,e,i){return Math.max(Math.min(t,i),e)}var me=function(){function t(t){var e=t.options,i=t.itm,n=t.em,r=t.axm;this.options=e,this.itm=i,this.em=n,this.axm=r,this.animationEnd=this.animationEnd.bind(this)}var e=t.prototype;return e.getDuration=function(o,t,e){var i,s=this;if(void 0!==e)i=e;else{var n=this.axm.map(t,function(t,e){return i=Math.abs(Math.abs(t)-Math.abs(o[e])),n=s.options.deceleration,(r=Math.sqrt(i/n*2))<100?0:r;var i,n,r});i=Object.keys(n).reduce(function(t,e){return Math.max(t,n[e])},-1/0)}return pe(i,this.options.minimumDuration,this.options.maximumDuration)},e.createAnimationParam=function(t,e,i){var n=this.axm.get(),r=t,o=i&&i.event||null;return{depaPos:n,destPos:r,duration:pe(e,this.options.minimumDuration,this.options.maximumDuration),delta:this.axm.getDelta(n,r),inputEvent:o,input:i&&i.input||null,isTrusted:!!o,done:this.animationEnd}},e.grab=function(t,e){if(this._animateParam&&t.length){var i=this.axm.get(t),n=this.axm.map(i,function(t,e,i){return re(t,i.range,i.circular)});this.axm.every(n,function(t,e){return i[e]===t})||this.em.triggerChange(n,e,!!e),this._animateParam=null,this._raf&&(r=this._raf,le(r)),this._raf=null,this.em.triggerAnimationEnd(!(!e||!e.event))}var r},e.getEventInfo=function(){return this._animateParam&&this._animateParam.input&&this._animateParam.inputEvent?{input:this._animateParam.input,event:this._animateParam.inputEvent}:null},e.restore=function(t){var e=this.axm.get(),i=this.axm.map(e,function(t,e,i){return Math.min(i.range[1],Math.max(i.range[0],t))});this.animateTo(i,this.getDuration(e,i),t)},e.animationEnd=function(){var t=this.getEventInfo();this._animateParam=null;var e=this.axm.filter(this.axm.get(),function(t,e,i){return ne(t,i.range,i.circular)});0<Object.keys(e).length&&this.setTo(this.axm.map(e,function(t,e,i){return re(t,i.range,i.circular)})),this.itm.setInterrupt(!1),this.em.triggerAnimationEnd(!!t),this.axm.isOutside()?this.restore(t):this.em.triggerFinish(!!t)},e.animateLoop=function(e,i){if(this._animateParam=te({},e),this._animateParam.startTime=(new Date).getTime(),e.duration){var n=this._animateParam,r=this;!function t(){if(r._raf=null,1<=r.frame(n))return oe(e.destPos,r.axm.get(Object.keys(e.destPos)))||r.em.triggerChange(e.destPos),void i();r._raf=ce(t)}()}else this.em.triggerChange(e.destPos),i()},e.getUserControll=function(t){var e=t.setTo();return e.destPos=this.axm.get(e.destPos),e.duration=pe(e.duration,this.options.minimumDuration,this.options.maximumDuration),e},e.animateTo=function(t,e,i){var n=this,r=this.createAnimationParam(t,e,i),o=te({},r.depaPos),s=this.em.triggerAnimationStart(r),a=this.getUserControll(r);if(!s&&this.axm.every(a.destPos,function(t,e,i){return ne(t,i.range,i.circular)})&&console.warn("You can't stop the 'animation' event when 'circular' is true."),s&&!oe(a.destPos,o)){var h=i&&i.event||null;this.animateLoop({depaPos:o,destPos:a.destPos,duration:a.duration,delta:this.axm.getDelta(o,a.destPos),isTrusted:!!h,inputEvent:h,input:i&&i.input||null},function(){return n.animationEnd()})}},e.frame=function(n){var t=(new Date).getTime()-n.startTime,r=this.easing(t/n.duration),e=n.depaPos;return e=this.axm.map(e,function(t,e,i){return re(t+=n.delta[e]*r,i.range,i.circular)}),this.em.triggerChange(e),r},e.easing=function(t){return 1<t?1:this.options.easing(t)},e.setTo=function(t,n){void 0===n&&(n=0);var e=Object.keys(t);this.grab(e);var i=this.axm.get(e);if(oe(t,i))return this;this.itm.setInterrupt(!0);var r=this.axm.filter(t,function(t,e){return i[e]!==t});return Object.keys(r).length&&(oe(r=this.axm.map(r,function(t,e,i){return i.circular&&(i.circular[0]||i.circular[1])?0<n?t:re(t,i.range,i.circular):ee(t,i.range,i.circular)}),i)||(0<n?this.animateTo(r,n):(this.em.triggerChange(r),this.itm.setInterrupt(!1)))),this},e.setBy=function(i,t){return void 0===t&&(t=0),this.setTo(this.axm.map(this.axm.get(Object.keys(i)),function(t,e){return t+i[e]}),t)},t}(),ve=function(){function t(t){this.axes=t}var e=t.prototype;return e.triggerHold=function(t,e){this.axes.trigger("hold",{pos:t,input:e.input||null,inputEvent:e.event||null,isTrusted:!0})},e.triggerRelease=function(t){t.setTo=this.createUserControll(t.destPos,t.duration),this.axes.trigger("release",t)},e.triggerChange=function(t,e,i){void 0===e&&(e=null),void 0===i&&(i=!1);var n=this.am.getEventInfo(),r=this.am.axm.moveTo(t),o=e&&e.event||n&&n.event||null,s={pos:r.pos,delta:r.delta,holding:i,inputEvent:o,isTrusted:!!o,input:e&&e.input||n&&n.input||null,set:o?this.createUserControll(r.pos):function(){}};this.axes.trigger("change",s),o&&this.am.axm.set(s.set().destPos)},e.triggerAnimationStart=function(t){return t.setTo=this.createUserControll(t.destPos,t.duration),this.axes.trigger("animationStart",t)},e.triggerAnimationEnd=function(t){void 0===t&&(t=!1),this.axes.trigger("animationEnd",{isTrusted:t})},e.triggerFinish=function(t){void 0===t&&(t=!1),this.axes.trigger("finish",{isTrusted:t})},e.createUserControll=function(t,e){void 0===e&&(e=0);var i={destPos:te({},t),duration:e};return function(t,e){return t&&(i.destPos=te({},t)),void 0!==e&&(i.duration=e),i}},e.setAnimationManager=function(t){this.am=t},e.destroy=function(){this.axes.off()},t}(),ge=function(){function t(t){this.options=t,this._prevented=!1}var e=t.prototype;return e.isInterrupting=function(){return this.options.interruptable||this._prevented},e.isInterrupted=function(){return!this.options.interruptable&&this._prevented},e.setInterrupt=function(t){!this.options.interruptable&&(this._prevented=t)},t}(),_e=function(){function t(t){var e=t.options,i=t.itm,n=t.em,r=t.axm,o=t.am;this.isOutside=!1,this.moveDistance=null,this.options=e,this.itm=i,this.em=n,this.axm=r,this.am=o}var e=t.prototype;return e.atOutside=function(t){var s=this;if(this.isOutside)return this.axm.map(t,function(t,e,i){var n=i.range[0]-i.bounce[0],r=i.range[1]+i.bounce[1];return r<t?r:t<n?n:t});var a=this.am.easing(1e-5)/1e-5;return this.axm.map(t,function(t,e,i){var n=i.range[0],r=i.range[1],o=i.bounce;return t<n?n-s.am.easing((n-t)/(o[0]*a))*o[0]:r<t?r+s.am.easing((t-r)/(o[1]*a))*o[1]:t})},e.get=function(t){return this.axm.get(t.axes)},e.hold=function(t,e){if(!this.itm.isInterrupted()&&t.axes.length){var i={input:t,event:e};this.itm.setInterrupt(!0),this.am.grab(t.axes,i),!this.moveDistance&&this.em.triggerHold(this.axm.get(),i),this.isOutside=this.axm.isOutside(t.axes),this.moveDistance=this.axm.get(t.axes)}},e.change=function(t,e,i){if(this.itm.isInterrupting()&&!this.axm.every(i,function(t){return 0===t})){var n,r=this.axm.get(t.axes);n=this.axm.map(this.moveDistance||r,function(t,e){return t+(i[e]||0)}),this.moveDistance&&(this.moveDistance=n),n=this.axm.map(n,function(t,e,i){return re(t,i.range,i.circular)}),this.isOutside&&this.axm.every(r,function(t,e,i){return!ie(t,i.range)})&&(this.isOutside=!1),n=this.atOutside(n),this.em.triggerChange(n,{input:t,event:e},!0)}},e.release=function(t,e,i,n){if(this.itm.isInterrupting()&&this.moveDistance){var r=this.axm.get(t.axes),o=this.axm.get(),s=this.axm.get(this.axm.map(i,function(t,e,i){return i.circular&&(i.circular[0]||i.circular[1])?r[e]+t:ee(r[e]+t,i.range,i.circular,i.bounce)})),a=this.am.getDuration(s,r,n);0===a&&(s=te({},o));var h={depaPos:o,destPos:s,duration:a,delta:this.axm.getDelta(o,s),inputEvent:e,input:t,isTrusted:!0};this.em.triggerRelease(h),this.moveDistance=null;var u=this.am.getUserControll(h),c=oe(u.destPos,o),l={input:t,event:e};c||0===u.duration?(!c&&this.em.triggerChange(u.destPos,l,!0),this.itm.setInterrupt(!1),this.axm.isOutside()?this.am.restore(l):this.em.triggerFinish(!0)):this.am.animateTo(u.destPos,u.duration,l)}},t}(),ye=function(){if("undefined"==typeof document)return"";for(var t=(document.head||document.getElementsByTagName("head")[0]).style,e=["transform","webkitTransform","msTransform","mozTransform"],i=0,n=e.length;i<n;i++)if(e[i]in t)return e[i];return""}(),xe=function(r){function t(t,e,i){void 0===t&&(t={});var n=r.call(this)||this;return n.axis=t,n._inputs=[],n.options=te({easing:function(t){return 1-Math.pow(1-t,3)},interruptable:!0,maximumDuration:1/0,minimumDuration:0,deceleration:6e-4},e),n.itm=new ge(n.options),n.axm=new ae(n.axis,n.options),n.em=new ve(n),n.am=new me(n),n.io=new _e(n),n.em.setAnimationManager(n.am),i&&n.em.triggerChange(i),n}!function(t,e){function i(){this.constructor=t}$t(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}(t,r);var e=t.prototype;return e.connect=function(t,e){var i;if(i="string"==typeof t?t.split(" "):t.concat(),~this._inputs.indexOf(e)&&this.disconnect(e),"hammer"in e){var n=this._inputs.filter(function(t){return t.hammer&&t.element===e.element});n.length&&(e.hammer=n[0].hammer)}return e.mapAxes(i),e.connect(this.io),this._inputs.push(e),this},e.disconnect=function(t){if(t){var e=this._inputs.indexOf(t);0<=e&&(this._inputs[e].disconnect(),this._inputs.splice(e,1))}else this._inputs.forEach(function(t){return t.disconnect()}),this._inputs=[];return this},e.get=function(t){return this.axm.get(t)},e.setTo=function(t,e){return void 0===e&&(e=0),this.am.setTo(t,e),this},e.setBy=function(t,e){return void 0===e&&(e=0),this.am.setBy(t,e),this},e.isBounceArea=function(t){return this.axm.isOutside(t)},e.destroy=function(){this.disconnect(),this.em.destroy()},t.VERSION="2.5.8",t.TRANSFORM=ye,t.DIRECTION_NONE=Z,t.DIRECTION_LEFT=J,t.DIRECTION_RIGHT=$,t.DIRECTION_UP=tt,t.DIRECTION_DOWN=et,t.DIRECTION_HORIZONTAL=it,t.DIRECTION_VERTICAL=nt,t.DIRECTION_ALL=rt,t}(n),Ee="PointerEvent"in se||"MSPointerEvent"in se,we="ontouchstart"in se,Te="_EGJS_AXES_INPUTTYPE_";function Re(n,t){return t.reduce(function(t,e,i){return n[i]&&(t[n[i]]=e),t},{})}function be(t,e){try{return new jt(t,te({},e))}catch(t){return null}}function Ie(t){void 0===t&&(t=[]);var e=!1,i=!1,n=!1;return t.forEach(function(t){switch(t){case"mouse":i=!0;break;case"touch":e=we;break;case"pointer":n=Ee}}),n?St:e&&i?Qt:e?Lt:i?Nt:null}function Ae(t,e,i){return i?!!(e===rt||e&t&&i&t):!!(e&t)}var Ce=function(){function t(t,e){if(this.axes=[],this.hammer=null,this.element=null,this.panRecognizer=null,void 0===jt)throw new Error("The Hammerjs must be loaded before eg.Axes.PanInput.\nhttp://hammerjs.github.io/");this.element=ue(t),this.options=te({inputType:["touch","mouse","pointer"],scale:[1,1],thresholdAngle:45,threshold:0,hammerManagerOptions:{cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",userDrag:"none"}}},e),this.onHammerInput=this.onHammerInput.bind(this),this.onPanmove=this.onPanmove.bind(this),this.onPanend=this.onPanend.bind(this)}var e=t.prototype;return e.mapAxes=function(t){var e=!!t[0],i=!!t[1];this._direction=e&&i?rt:e?it:i?nt:Z,this.axes=t},e.connect=function(t){var e={direction:this._direction,threshold:this.options.threshold};if(this.hammer)this.removeRecognizer(),this.dettachEvent();else{var i=this.element[Te];i||(i=String(Math.round(Math.random()*(new Date).getTime())));var n=Ie(this.options.inputType);if(!n)throw new Error("Wrong inputType parameter!");this.hammer=be(this.element,te({inputClass:n},this.options.hammerManagerOptions)),this.element[Te]=i}return this.panRecognizer=new Zt(e),this.hammer.add(this.panRecognizer),this.attachEvent(t),this},e.disconnect=function(){return this.removeRecognizer(),this.hammer&&this.dettachEvent(),this._direction=Z,this},e.destroy=function(){this.disconnect(),this.hammer&&0===this.hammer.recognizers.length&&this.hammer.destroy(),delete this.element[Te],this.element=null,this.hammer=null},e.enable=function(){return this.hammer&&(this.hammer.get("pan").options.enable=!0),this},e.disable=function(){return this.hammer&&(this.hammer.get("pan").options.enable=!1),this},e.isEnable=function(){return!(!this.hammer||!this.hammer.get("pan").options.enable)},e.removeRecognizer=function(){this.hammer&&this.panRecognizer&&(this.hammer.remove(this.panRecognizer),this.panRecognizer=null)},e.onHammerInput=function(t){this.isEnable()&&(t.isFirst?this.observer.hold(this,t):t.isFinal&&this.onPanend(t))},e.onPanmove=function(t){var e=function(t,e){if(e<0||90<e)return Z;var i=Math.abs(t);return e<i&&i<180-e?nt:it}(t.angle,this.options.thresholdAngle),i=this.hammer.session.prevInput;t.offsetY=i?(t.offsetX=t.deltaX-i.deltaX,t.deltaY-i.deltaY):t.offsetX=0;var n=this.getOffset([t.offsetX,t.offsetY],[Ae(it,this._direction,e),Ae(nt,this._direction,e)]),r=n.some(function(t){return 0!==t});r&&(t.srcEvent.preventDefault(),t.srcEvent.stopPropagation()),(t.preventSystemEvent=r)&&this.observer.change(this,t,Re(this.axes,n))},e.onPanend=function(t){var e,i,n,r,o=this.getOffset([Math.abs(t.velocityX)*(t.deltaX<0?-1:1),Math.abs(t.velocityY)*(t.deltaY<0?-1:1)],[Ae(it,this._direction),Ae(nt,this._direction)]);e=o,i=this.observer.options.deceleration,n=Math.sqrt(e[0]*e[0]+e[1]*e[1]),r=Math.abs(n/-i),o=[e[0]/2*r,e[1]/2*r],this.observer.release(this,t,Re(this.axes,o))},e.attachEvent=function(t){this.observer=t,this.hammer.on("hammer.input",this.onHammerInput).on("panstart panmove",this.onPanmove)},e.dettachEvent=function(){this.hammer.off("hammer.input",this.onHammerInput).off("panstart panmove",this.onPanmove),this.observer=null},e.getOffset=function(t,e){var i=[0,0],n=this.options.scale;return e[0]&&(i[0]=t[0]*n[0]),e[1]&&(i[1]=t[1]*n[1]),i},t}(),Pe=function(){function t(t,e){if(this.axes=[],this.hammer=null,this.element=null,this._base=null,this._prev=null,this.pinchRecognizer=null,void 0===jt)throw new Error("The Hammerjs must be loaded before eg.Axes.PinchInput.\nhttp://hammerjs.github.io/");this.element=ue(t),this.options=te({scale:1,threshold:0,inputType:["touch","pointer"],hammerManagerOptions:{cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",userDrag:"none"}}},e),this.onPinchStart=this.onPinchStart.bind(this),this.onPinchMove=this.onPinchMove.bind(this),this.onPinchEnd=this.onPinchEnd.bind(this)}var e=t.prototype;return e.mapAxes=function(t){this.axes=t},e.connect=function(t){var e={threshold:this.options.threshold};if(this.hammer)this.removeRecognizer(),this.dettachEvent();else{var i=this.element[Te];i||(i=String(Math.round(Math.random()*(new Date).getTime())));var n=Ie(this.options.inputType);if(!n)throw new Error("Wrong inputType parameter!");this.hammer=be(this.element,te({inputClass:n},this.options.hammerManagerOptions)),this.element[Te]=i}return this.pinchRecognizer=new Jt(e),this.hammer.add(this.pinchRecognizer),this.attachEvent(t),this},e.disconnect=function(){return this.removeRecognizer(),this.hammer&&(this.hammer.remove(this.pinchRecognizer),this.pinchRecognizer=null,this.dettachEvent()),this},e.destroy=function(){this.disconnect(),this.hammer&&0===this.hammer.recognizers.length&&this.hammer.destroy(),delete this.element[Te],this.element=null,this.hammer=null},e.removeRecognizer=function(){this.hammer&&this.pinchRecognizer&&(this.hammer.remove(this.pinchRecognizer),this.pinchRecognizer=null)},e.onPinchStart=function(t){this._base=this.observer.get(this)[this.axes[0]];var e=this.getOffset(t.scale);this.observer.hold(this,t),this.observer.change(this,t,Re(this.axes,[e])),this._prev=t.scale},e.onPinchMove=function(t){var e=this.getOffset(t.scale,this._prev);this.observer.change(this,t,Re(this.axes,[e])),this._prev=t.scale},e.onPinchEnd=function(t){var e=this.getOffset(t.scale,this._prev);this.observer.change(this,t,Re(this.axes,[e])),this.observer.release(this,t,Re(this.axes,[0]),0),this._base=null,this._prev=null},e.getOffset=function(t,e){return void 0===e&&(e=1),this._base*(t-e)*this.options.scale},e.attachEvent=function(t){this.observer=t,this.hammer.on("pinchstart",this.onPinchStart).on("pinchmove",this.onPinchMove).on("pinchend",this.onPinchEnd)},e.dettachEvent=function(){this.hammer.off("pinchstart",this.onPinchStart).off("pinchmove",this.onPinchMove).off("pinchend",this.onPinchEnd),this.observer=null,this._prev=null},e.enable=function(){return this.hammer&&(this.hammer.get("pinch").options.enable=!0),this},e.disable=function(){return this.hammer&&(this.hammer.get("pinch").options.enable=!1),this},e.isEnable=function(){return!(!this.hammer||!this.hammer.get("pinch").options.enable)},t}(),Se=function(){function t(t,e){this.axes=[],this.element=null,this._isEnabled=!1,this._isHolded=!1,this._timer=null,this.element=ue(t),this.options=te({scale:1,useNormalized:!0},e),this.onWheel=this.onWheel.bind(this)}var e=t.prototype;return e.mapAxes=function(t){this.axes=t},e.connect=function(t){return this.dettachEvent(),this.attachEvent(t),this},e.disconnect=function(){return this.dettachEvent(),this},e.destroy=function(){this.disconnect(),this.element=null},e.onWheel=function(t){var e=this;if(this._isEnabled&&(t.preventDefault(),0!==t.deltaY)){this._isHolded||(this.observer.hold(this,t),this._isHolded=!0);var i=(0<t.deltaY?-1:1)*this.options.scale*(this.options.useNormalized?1:Math.abs(t.deltaY));this.observer.change(this,t,Re(this.axes,[i])),clearTimeout(this._timer),this._timer=setTimeout(function(){e._isHolded&&(e._isHolded=!1,e.observer.release(e,t,Re(e.axes,[0])))},50)}},e.attachEvent=function(t){this.observer=t,this.element.addEventListener("wheel",this.onWheel),this._isEnabled=!0},e.dettachEvent=function(){this.element.removeEventListener("wheel",this.onWheel),this._isEnabled=!1,this.observer=null,this._timer&&(clearTimeout(this._timer),this._timer=null)},e.enable=function(){return this._isEnabled=!0,this},e.disable=function(){return this._isEnabled=!1,this},e.isEnable=function(){return this._isEnabled},t}(),Oe=function(){function t(t,e){this.axes=[],this.element=null,this._isEnabled=!1,this._isHolded=!1,this._timer=null,this.element=ue(t),this.options=te({scale:[1,1]},e),this.onKeydown=this.onKeydown.bind(this),this.onKeyup=this.onKeyup.bind(this)}var e=t.prototype;return e.mapAxes=function(t){this.axes=t},e.connect=function(t){return this.dettachEvent(),"0"!==this.element.getAttribute("tabindex")&&this.element.setAttribute("tabindex","0"),this.attachEvent(t),this},e.disconnect=function(){return this.dettachEvent(),this},e.destroy=function(){this.disconnect(),this.element=null},e.onKeydown=function(t){if(this._isEnabled){var e=!0,i=1,n=-1;switch(t.keyCode){case 37:case 65:i=-1;break;case 39:case 68:break;case 40:case 83:i=-1,n=1;break;case 38:case 87:n=1;break;default:e=!1}if((-1===n&&!this.axes[0]||1===n&&!this.axes[1])&&(e=!1),e){var r=-1===n?[+this.options.scale[0]*i,0]:[0,+this.options.scale[1]*i];this._isHolded||(this.observer.hold(this,event),this._isHolded=!0),clearTimeout(this._timer),this.observer.change(this,event,Re(this.axes,r))}}},e.onKeyup=function(t){var e=this;this._isHolded&&(clearTimeout(this._timer),this._timer=setTimeout(function(){e.observer.release(e,t,Re(e.axes,[0,0])),e._isHolded=!1},80))},e.attachEvent=function(t){this.observer=t,this.element.addEventListener("keydown",this.onKeydown,!1),this.element.addEventListener("keypress",this.onKeydown,!1),this.element.addEventListener("keyup",this.onKeyup,!1),this._isEnabled=!0},e.dettachEvent=function(){this.element.removeEventListener("keydown",this.onKeydown,!1),this.element.removeEventListener("keypress",this.onKeydown,!1),this.element.removeEventListener("keyup",this.onKeyup,!1),this._isEnabled=!1,this.observer=null},e.enable=function(){return this._isEnabled=!0,this},e.disable=function(){return this._isEnabled=!1,this},e.isEnable=function(){return this._isEnabled},t}();var Me,De,Le=window.MathUtil||{};Le.degToRad=Math.PI/180,Le.radToDeg=180/Math.PI,Le.Vector2=function(t,e){this.x=t||0,this.y=e||0},Le.Vector2.prototype={constructor:Le.Vector2,set:function(t,e){return this.x=t,this.y=e,this},copy:function(t){return this.x=t.x,this.y=t.y,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}},Le.Vector3=function(t,e,i){this.x=t||0,this.y=e||0,this.z=i||0},Le.Vector3.prototype={constructor:Le.Vector3,set:function(t,e,i){return this.x=t,this.y=e,this.z=i,this},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},normalize:function(){var t=this.length();if(0!==t){var e=1/t;this.multiplyScalar(e)}else this.x=0,this.y=0,this.z=0;return this},multiplyScalar:function(t){this.x*=t,this.y*=t,this.z*=t},applyQuaternion:function(t){var e=this.x,i=this.y,n=this.z,r=t.x,o=t.y,s=t.z,a=t.w,h=a*e+o*n-s*i,u=a*i+s*e-r*n,c=a*n+r*i-o*e,l=-r*e-o*i-s*n;return this.x=h*a+l*-r+u*-s-c*-o,this.y=u*a+l*-o+c*-r-h*-s,this.z=c*a+l*-s+h*-o-u*-r,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},crossVectors:function(t,e){var i=t.x,n=t.y,r=t.z,o=e.x,s=e.y,a=e.z;return this.x=n*a-r*s,this.y=r*o-i*a,this.z=i*s-n*o,this}},Le.Quaternion=function(t,e,i,n){this.x=t||0,this.y=e||0,this.z=i||0,this.w=void 0!==n?n:1},Le.Quaternion.prototype={constructor:Le.Quaternion,set:function(t,e,i,n){return this.x=t,this.y=e,this.z=i,this.w=n,this},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},setFromEulerXYZ:function(t,e,i){var n=Math.cos(t/2),r=Math.cos(e/2),o=Math.cos(i/2),s=Math.sin(t/2),a=Math.sin(e/2),h=Math.sin(i/2);return this.x=s*r*o+n*a*h,this.y=n*a*o-s*r*h,this.z=n*r*h+s*a*o,this.w=n*r*o-s*a*h,this},setFromEulerYXZ:function(t,e,i){var n=Math.cos(t/2),r=Math.cos(e/2),o=Math.cos(i/2),s=Math.sin(t/2),a=Math.sin(e/2),h=Math.sin(i/2);return this.x=s*r*o+n*a*h,this.y=n*a*o-s*r*h,this.z=n*r*h-s*a*o,this.w=n*r*o+s*a*h,this},setFromAxisAngle:function(t,e){var i=e/2,n=Math.sin(i);return this.x=t.x*n,this.y=t.y*n,this.z=t.z*n,this.w=Math.cos(i),this},multiply:function(t){return this.multiplyQuaternions(this,t)},multiplyQuaternions:function(t,e){var i=t.