/*! For license information please see tcplayer-vr-plugin.1.0.0.js.LICENSE.txt */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("TcplayerVRPlugin",[],t):"object"==typeof exports?exports.TcplayerVRPlugin=t():e.TcplayerVRPlugin=t()}(self,(function(){return(()=>{var __webpack_modules__={774:module=>{function T(e,t,n,i,r,o,s,a){var u,l=!i,c=(e=+e,t=t||[0],i=i||[[this],[{}]],r=r||{},[]),h=null;function d(){return function(e,t,n){return new(Function.bind.apply(e,t))}.apply(null,arguments)}Function.prototype.bind||(u=[].slice,Function.prototype.bind=function(e){if("function"!=typeof this)throw new TypeError("bind101");var t=u.call(arguments,1),n=t.length,i=this,r=function(){},o=function(){return t.length=n,t.push.apply(t,arguments),i.apply(r.prototype.isPrototypeOf(this)?this:e,t)};return this.prototype&&(r.prototype=this.prototype),o.prototype=new r,o});for(var p=[function(){var n=(r=t[e++])?i.slice(-r):[],r=(i.length-=r,i.pop());i.push(r[0][r[1]].apply(r[0],n))},function(){i[i.length-2]=i[i.length-2]*i.pop()},function(){for(var u=i.pop(),l=t[e++],c=[],h=t[e++],d=t[e++],p=[],f=0;f>>i.pop()},function(){i[i.length-2]=i[i.length-2]==i.pop()},function(){i[i.length-2]=i[i.length-2]>i.pop()},function(){i.push([t[e++]])},function(){var n=t[e++];i[n]=void 0===i[n]?[]:i[n]},function(){return!0},function(){i[i.length-1]=t[e++]},function(){h=null},function(){throw i[i.length-1]},function(){var e=i.pop(),t=i.pop();i.push([t[0][t[1]],e])},function(){i[i.length-2]=i[i.length-2]>i.pop()},function(){i[i.length-2]=i[i.length-2]>=i.pop()},function(){e=t[e++]}];;)try{for(var f=!1;!f;)f=p[t[e++]]();if(h)throw h;return l?(i.pop(),i.slice(3+T.v)):i.pop()}catch(t){var A=c.pop();if(void 0===A)throw t;h=t,e=A[0],i.length=A[1],A[2]&&(i[A[2]][0]=h)}}function arrayIndexOf(e,t,n){if("function"==typeof Array.prototype.indexOf)return Array.prototype.indexOf.call(e,t,n);var i,r=o.length;if(0===r)return-1;var s=0|n;if(s>=r)return-1;for(i=Math.max(s>=0?s:r-Math.abs(s),0);i>(-2*o&6)):0)n=arrayIndexOf(i,n);return a}T.v=0,module.exports.r=function(symbols){for(var result=[],i=0;i{"use strict";function i(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function r(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)s.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return s}function o(){for(var e=[],t=0;tdi,DEFAULT_IMAGE_CLASS:()=>ar,DEFAULT_WRAPPER_CLASS:()=>sr,ERROR_TYPE:()=>ai,GYRO_MODE:()=>In,PANOVIEWER_EVENTS:()=>ui,PANOVIEWER_OPTIONS:()=>hi,PROJECTION_TYPE:()=>li,PanoViewer:()=>ir,SPINVIEWER_EVENTS:()=>or,SPINVIEWER_OPTIONS:()=>rr,STEREO_FORMAT:()=>ci,SpinViewer:()=>lr,SpriteImage:()=>ur,VERSION:()=>Ht,generateCanvasKey:()=>vr,getValidProps:()=>gr,updatePanoViewer:()=>pr,withMethods:()=>cr,withPanoViewerMethods:()=>hr,withSpinViewerMethods:()=>dr});var s=function(e){return void 0===e},a=function(){function e(e,t){var n,r;if(this._canceled=!1,t)try{for(var o=i(Object.keys(t)),s=o.next();!s.done;s=o.next()){var a=s.value;this[a]=t[a]}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}this.eventType=e}var t=e.prototype;return t.stop=function(){this._canceled=!0},t.isCanceled=function(){return this._canceled},e}(),u=a;const l=function(){function e(){this._eventHandler={}}var t=e.prototype;return t.trigger=function(e){for(var t=[],n=1;n]*)>/)){var i=document.createElement("div");i.innerHTML=e,n=ee(i.childNodes)}else n=ee(document.querySelectorAll(e));t||(n=n.length>=1?n[0]:void 0)}else e===j?n=e:"value"in e||"current"in e?n=e.value||e.current:!e.nodeName||1!==e.nodeType&&9!==e.nodeType?"jQuery"in j&&e instanceof jQuery||e.constructor.prototype.jquery?n=t?e.toArray():e.get(0):Array.isArray(e)&&(n=e.map((function(e){return te(e)})),t||(n=n.length>=1?n[0]:void 0)):n=e;return n},ne=j.requestAnimationFrame||j.webkitRequestAnimationFrame,ie=j.cancelAnimationFrame||j.webkitCancelAnimationFrame;if(ne&&!ie){var re={},oe=ne;ne=function(e){var t=oe((function(n){re[t]&&e(n)}));return re[t]=!0,t},ie=function(e){delete re[e]}}else ne&&ie||(ne=function(e){return j.setTimeout((function(){e(j.performance&&j.performance.now&&j.performance.now()||(new Date).getTime())}),16)},ie=j.clearTimeout);var se=function(e,t){var n={};for(var i in e)i&&(n[i]=t(e[i],i));return n},ae=function(e,t){var n={};for(var i in e)i&&t(e[i],i)&&(n[i]=e[i]);return n},ue=function(e,t){for(var n in e)if(n&&!t(e[n],n))return!1;return!0},le=function(e,t){return ue(e,(function(e,n){return e===t[n]}))},ce={},he=function(e,t){return ce[t]||(ce[t]=fe(t)),ce[t](e)},de=function(e,t){return e&&t?se(e,(function(e,n){return he(e,"number"==typeof t?t:t[n])})):e},pe=function(e){if(!isFinite(e))return 0;var t="".concat(e);if(t.indexOf("e")>=0){for(var n=0,i=1;Math.round(e*i)/i!==e;)i*=10,n++;return n}return t.indexOf(".")>=0?t.length-t.indexOf(".")-1:0},fe=function(e){var t=e<1?Math.pow(10,pe(e)):1;return function(n){return 0===e?0:Math.round(Math.round(n/e)*e*t)/t}},Ae=function(e){var t=!0;return Object.keys(J).forEach((function(n){e&&e[n]===J[n]||(t=!1)})),t},ge=function(e,t){return e&&t?30:e?6:t?X:1},ve=function(e,t,n){return n?!!(30===t||t&e&&n&e):!!(t&e)},me=function(e,t,n){var i,r=((i={})[1]="auto",i[30]="none",i[24]="pan-x",i[6]="pan-y",i),o={};if(e&&e.style){var s=t.touchAction?t.touchAction:r[n],a=z(z({},J),{"touch-action":"none"===e.style["touch-action"]?"none":s});Object.keys(a).forEach((function(t){o[t]=e.style[t],e.style[t]=a[t]}))}return o},ye=function(e,t){e&&e.style&&t&&Object.keys(t).forEach((function(n){e.style[n]=t[n]}))},_e=function(){function e(e){this._axes=e}var t=e.prototype;return t.hold=function(e,t){var n=this._getRoundPos(e).roundPos;this._axes.trigger(new u("hold",{pos:n,input:t.input||null,inputEvent:t.event||null,isTrusted:!0}))},t.triggerRelease=function(e){var t=this._getRoundPos(e.destPos,e.depaPos),n=t.roundPos,i=t.roundDepa;e.destPos=n,e.depaPos=i,e.setTo=this._createUserControll(e.destPos,e.duration),this._axes.trigger(new u("release",z(z({},e),{bounceRatio:this._getBounceRatio(n)})))},t.triggerChange=function(e,t,n,i){var r=this;void 0===i&&(i=!1);var o=this.animationManager,s=o.axisManager,a=o.getEventInfo(),l=this._getRoundPos(e,t),c=l.roundPos,h=l.roundDepa,d=s.moveTo(c,h),p=(null==n?void 0:n.event)||(null==a?void 0:a.event)||null,f={pos:d.pos,delta:d.delta,bounceRatio:this._getBounceRatio(d.pos),holding:i,inputEvent:p,isTrusted:!!p,input:(null==n?void 0:n.input)||(null==a?void 0:a.input)||null,set:p?this._createUserControll(d.pos):function(){}},A=new u("change",f);return this._axes.trigger(A),Object.keys(d.pos).forEach((function(e){var t=d.pos[e];N(r._axes,e,t).current=t})),p&&s.set(f.set().destPos),!A.isCanceled()},t.triggerAnimationStart=function(e){var t=this._getRoundPos(e.destPos,e.depaPos),n=t.roundPos,i=t.roundDepa;e.destPos=n,e.depaPos=i,e.setTo=this._createUserControll(e.destPos,e.duration);var r=new u("animationStart",e);return this._axes.trigger(r),!r.isCanceled()},t.triggerAnimationEnd=function(e){void 0===e&&(e=!1),this._axes.trigger(new u("animationEnd",{isTrusted:e}))},t.triggerFinish=function(e){void 0===e&&(e=!1),this._axes.trigger(new u("finish",{isTrusted:e}))},t.setAnimationManager=function(e){this.animationManager=e},t.destroy=function(){this._axes.off()},t._createUserControll=function(e,t){void 0===t&&(t=0);var n={destPos:z({},e),duration:t};return function(e,t){return e&&(n.destPos=z({},e)),void 0!==t&&(n.duration=t),n}},t._getRoundPos=function(e,t){var n=this._axes.options.round;return{roundPos:de(e,n),roundDepa:de(t,n)}},t._getBounceRatio=function(e){return this._axes.axisManager.map(e,(function(e,t){return et.range[1]&&0!==t.bounce[1]?(e-t.range[1])/t.bounce[1]:0}))},e}(),we=function(){function e(e){this._options=e,this._prevented=!1}var t=e.prototype;return t.isInterrupting=function(){return this._options.interruptable||this._prevented},t.isInterrupted=function(){return!this._options.interruptable&&this._prevented},t.setInterrupt=function(e){this._options.interruptable||(this._prevented=e)},e}(),be=function(e,t,n,i){var r=e,o=[n[0]?t[0]:i?t[0]-i[0]:t[0],n[1]?t[1]:i?t[1]+i[1]:t[1]];return r=Math.max(o[0],r),Math.min(o[1],r)},xe=function(e,t){return et[1]},Ee=function(e,t,n){return n[1]&&e>t[1]||n[0]&&eo&&(i=(i-o)%s+r),n[0]&&e-1||t.indexOf("none")>-1&&!e.shiftKey&&!e.ctrlKey&&!e.altKey&&!e.metaKey||t.indexOf("shift")>-1&&e.shiftKey||t.indexOf("ctrl")>-1&&e.ctrlKey||t.indexOf("alt")>-1&&e.altKey||t.indexOf("meta")>-1&&e.metaKey)},Fe=function(){function e(){var e=this;this._stopContextMenu=function(t){t.preventDefault(),j.removeEventListener("contextmenu",e._stopContextMenu)}}var t=e.prototype;return t.extendEvent=function(e){var t,n,i,r=this.prevEvent,o=this._getCenter(e),s=r?this._getMovement(e):{x:0,y:0},a=r?this._getScale(e):1,u=r?(n=o.x-r.center.x,i=o.y-r.center.y,180*Math.atan2(i,n)/Math.PI):0,l=r?r.deltaX+s.x:s.x,c=r?r.deltaY+s.y:s.y,h=s.x,d=s.y,p=this._latestInterval,f=Date.now(),A=p?f-p.timestamp:0,g=r?r.velocityX:0,v=r?r.velocityY:0;return(!p||A>=16)&&(p&&(g=(t=[(l-p.deltaX)/A,(c-p.deltaY)/A])[0],v=t[1]),this._latestInterval={timestamp:f,deltaX:l,deltaY:c}),{srcEvent:e,scale:a,angle:u,center:o,deltaX:l,deltaY:c,offsetX:h,offsetY:d,velocityX:g,velocityY:v,preventSystemEvent:!0}},t._getDistance=function(e,t){var n=t.clientX-e.clientX,i=t.clientY-e.clientY;return Math.sqrt(n*n+i*i)},t._getButton=function(e){var t={1:H,2:q,4:Y};return(this._isTouchEvent(e)?H:t[e.buttons])||null},t._isTouchEvent=function(e){return e.type&&e.type.indexOf("touch")>-1},t._isValidButton=function(e,t){return t.indexOf(e)>-1},t._isValidEvent=function(e,t,n){return(!t||Pe(e,t))&&(!n||this._isValidButton(this._getButton(e),n))},t._preventMouseButton=function(e,t){t===q?j.addEventListener("contextmenu",this._stopContextMenu):t===Y&&e.preventDefault()},e}(),De=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.start=["mousedown"],t.move=["mousemove"],t.end=["mouseup"],t}G(t,e);var n=t.prototype;return n.onEventStart=function(e,t,n){var i=this._getButton(e);return this._isValidEvent(e,t,n)?(this._preventMouseButton(e,i),this.extendEvent(e)):null},n.onEventMove=function(e,t,n){return this._isValidEvent(e,t,n)?this.extendEvent(e):null},n.onEventEnd=function(){},n.onRelease=function(){this.prevEvent=null},n.getTouches=function(e,t){if(t){var n={1:H,2:Y,3:q};return this._isValidButton(n[e.which],t)&&-1===this.end.indexOf(e.type)?1:0}return 0},n._getScale=function(){return 1},n._getCenter=function(e){return{x:e.clientX,y:e.clientY}},n._getMovement=function(e){var t=this.prevEvent.srcEvent;return{x:e.clientX-t.clientX,y:e.clientY-t.clientY}},t}(Fe),Ie=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.start=["touchstart"],t.move=["touchmove"],t.end=["touchend","touchcancel"],t}G(t,e);var n=t.prototype;return n.onEventStart=function(e,t){return this._baseTouches=e.touches,this._isValidEvent(e,t)?this.extendEvent(e):null},n.onEventMove=function(e,t){return this._isValidEvent(e,t)?this.extendEvent(e):null},n.onEventEnd=function(e){this._baseTouches=e.touches},n.onRelease=function(){this.prevEvent=null,this._baseTouches=null},n.getTouches=function(e){return e.touches.length},n._getScale=function(e){return 2!==e.touches.length||this._baseTouches.length<2?null:this._getDistance(e.touches[0],e.touches[1])/this._getDistance(this._baseTouches[0],this._baseTouches[1])},n._getCenter=function(e){return{x:e.touches[0].clientX,y:e.touches[0].clientY}},n._getMovement=function(e){var t=this.prevEvent.srcEvent;return e.touches[0].identifier!==t.touches[0].identifier?{x:0,y:0}:{x:e.touches[0].clientX-t.touches[0].clientX,y:e.touches[0].clientY-t.touches[0].clientY}},t}(Fe),Oe=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.start=Me?["pointerdown"]:["MSPointerDown"],t.move=Me?["pointermove"]:["MSPointerMove"],t.end=Me?["pointerup","pointercancel"]:["MSPointerUp","MSPointerCancel"],t._firstInputs=[],t._recentInputs=[],t}G(t,e);var n=t.prototype;return n.onEventStart=function(e,t,n){var i=this._getButton(e);return this._isValidEvent(e,t,n)?(this._preventMouseButton(e,i),this._updatePointerEvent(e),this.extendEvent(e)):null},n.onEventMove=function(e,t,n){return this._isValidEvent(e,t,n)?(this._updatePointerEvent(e),this.extendEvent(e)):null},n.onEventEnd=function(e){this._removePointerEvent(e)},n.onRelease=function(){this.prevEvent=null,this._firstInputs=[],this._recentInputs=[]},n.getTouches=function(){return this._recentInputs.length},n._getScale=function(){return 2!==this._recentInputs.length?null:this._getDistance(this._recentInputs[0],this._recentInputs[1])/this._getDistance(this._firstInputs[0],this._firstInputs[1])},n._getCenter=function(e){return{x:e.clientX,y:e.clientY}},n._getMovement=function(e){var t=this.prevEvent.srcEvent;return e.pointerId!==t.pointerId?{x:0,y:0}:{x:e.clientX-t.clientX,y:e.clientY-t.clientY}},n._updatePointerEvent=function(e){var t=this,n=!1;this._recentInputs.forEach((function(i,r){i.pointerId===e.pointerId&&(n=!0,t._recentInputs[r]=e)})),n||(this._firstInputs.push(e),this._recentInputs.push(e))},n._removePointerEvent=function(e){this._firstInputs=this._firstInputs.filter((function(t){return t.pointerId!==e.pointerId})),this._recentInputs=this._recentInputs.filter((function(t){return t.pointerId!==e.pointerId}))},t}(Fe),Be=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.start=["mousedown","touchstart"],t.move=["mousemove","touchmove"],t.end=["mouseup","touchend","touchcancel"],t}G(t,e);var n=t.prototype;return n.onEventStart=function(e,t,n){var i=this._getButton(e);return this._isTouchEvent(e)&&(this._baseTouches=e.touches),this._isValidEvent(e,t,n)?(this._preventMouseButton(e,i),this.extendEvent(e)):null},n.onEventMove=function(e,t,n){return this._isValidEvent(e,t,n)?this.extendEvent(e):null},n.onEventEnd=function(e){this._isTouchEvent(e)&&(this._baseTouches=e.touches)},n.onRelease=function(){this.prevEvent=null,this._baseTouches=null},n.getTouches=function(e){return this._isTouchEvent(e)?e.touches.length:0},n._getScale=function(e){return this._isTouchEvent(e)?2!==e.touches.length||this._baseTouches.length<2?1:this._getDistance(e.touches[0],e.touches[1])/this._getDistance(this._baseTouches[0],this._baseTouches[1]):this.prevEvent.scale},n._getCenter=function(e){return this._isTouchEvent(e)?{x:e.touches[0].clientX,y:e.touches[0].clientY}:{x:e.clientX,y:e.clientY}},n._getMovement=function(e){var t=this,n=[e,this.prevEvent.srcEvent].map((function(e){return t._isTouchEvent(e)?{id:e.touches[0].identifier,x:e.touches[0].clientX,y:e.touches[0].clientY}:{id:null,x:e.clientX,y:e.clientY}})),i=n[0],r=n[1];return i.id===r.id?{x:i.x-r.x,y:i.y-r.y}:{x:0,y:0}},t}(Fe),Le=function(e,t){return t.reduce((function(t,n,i){return e[i]&&(t[e[i]]=n),t}),{})},Ve=function(e){void 0===e&&(e=[]);var t=!1,n=!1,i=!1;return e.forEach((function(e){switch(e){case"mouse":n=!0;break;case"touch":t=Re;break;case"pointer":i=Ce}})),i?new Oe:t&&n?new Be:t?new Ie:n?new De:null};function ke(e){return e.indexOf("touch")>-1&&{passive:!1}}var Ne=function(){function e(e){var t=e.options,n=e.interruptManager,i=e.eventManager,r=e.axisManager,o=e.animationManager;this._isOutside=!1,this._moveDistance=null,this._isStopped=!1,this.options=t,this._interruptManager=n,this._eventManager=i,this._axisManager=r,this._animationManager=o}var t=e.prototype;return t.get=function(e){return this._axisManager.get(e.axes)},t.hold=function(e,t){if(!this._interruptManager.isInterrupted()&&e.axes.length){var n={input:e,event:t};this._isStopped=!1,this._interruptManager.setInterrupt(!0),this._animationManager.stopAnimation(n),this._moveDistance||this._eventManager.hold(this._axisManager.get(),n),this._isOutside=this._axisManager.isOutside(e.axes),this._moveDistance=this._axisManager.get(e.axes)}},t.change=function(e,t,n,i){if(!this._isStopped&&this._interruptManager.isInterrupting()&&!this._axisManager.every(n,(function(e){return 0===e}))){var r=t.srcEvent?t.srcEvent:t;if(!r.__childrenAxesAlreadyChanged){var o,s=this._moveDistance||this._axisManager.get(e.axes);o=se(s,(function(e,t){return e+(n[t]||0)})),this._moveDistance&&(this._moveDistance=this._axisManager.map(o,(function(e,t){var n=t.circular,i=t.range;return n&&(n[0]||n[1])?Te(e,i,n):e}))),this._isOutside&&this._axisManager.every(s,(function(e,t){return!xe(e,t.range)}))&&(this._isOutside=!1),s=this._atOutside(s),o=this._atOutside(o),this.options.nested&&this._isEndofAxis(n,s,o)||(r.__childrenAxesAlreadyChanged=!0);var a={input:e,event:t};if(i){var u=this._animationManager.getDuration(o,s);this._animationManager.animateTo(o,u,a)}else!this._eventManager.triggerChange(o,s,a,!0)&&(this._isStopped=!0,this._moveDistance=null,this._animationManager.finish(!1))}}},t.release=function(e,t,n,i){if(!this._isStopped&&this._interruptManager.isInterrupting()&&this._moveDistance){var r=t.srcEvent?t.srcEvent:t;r.__childrenAxesAlreadyReleased&&(n=n.map((function(){return 0})));var o=this._axisManager.get(e.axes),s=this._axisManager.get(),a=this._animationManager.getDisplacement(n),u=Le(e.axes,a),l=this._axisManager.get(this._axisManager.map(u,(function(e,t,n){return t.circular&&(t.circular[0]||t.circular[1])?o[n]+e:be(o[n]+e,t.range,t.circular,t.bounce)})));r.__childrenAxesAlreadyReleased=!0;var c=this._animationManager.getDuration(l,o,i);0===c&&(l=z({},s));var h={depaPos:s,destPos:l,duration:c,delta:this._axisManager.getDelta(s,l),inputEvent:t,input:e,isTrusted:!0};this._eventManager.triggerRelease(h),this._moveDistance=null;var d=this._animationManager.getUserControl(h),p=le(d.destPos,s),f={input:e,event:t};p||0===d.duration?(p||this._eventManager.triggerChange(d.destPos,s,f,!0),this._interruptManager.setInterrupt(!1),this._axisManager.isOutside()?this._animationManager.restore(f):this._eventManager.triggerFinish(!0)):this._animationManager.animateTo(d.destPos,d.duration,f)}},t._atOutside=function(e){var t=this;return this._isOutside?this._axisManager.map(e,(function(e,t){var n=t.range[0]-t.bounce[0],i=t.range[1]+t.bounce[1];return e>i?i:er?e:er?r+t._animationManager.interpolate(e-r,o[1]):e}))},t._isEndofAxis=function(e,t,n){return this._axisManager.every(t,(function(i,r,o){return 0===e[o]||t[o]===n[o]&&(s=i,a=r.range,u=r.bounce,!(l=r.circular)[0]&&s===a[0]-u[0]||!l[1]&&s===a[1]+u[1]);var s,a,u,l}))},e}(),Qe=function(e,t,n){return Math.max(Math.min(e,n),t)},Ue=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._useDuration=!0,t}G(t,e);var n=t.prototype;return n.interpolate=function(e,t){var n=this._easing(1e-5)/1e-5;return this._easing(e/(t*n))*t},n.updateAnimation=function(e){var t,n=this._animateParam;if(n){var i=(new Date).getTime()-n.startTime,r=(null==e?void 0:e.destPos)||n.destPos,o=null!==(t=null==e?void 0:e.duration)&&void 0!==t?t:n.duration;if((null==e?void 0:e.restart)||o<=i)this.setTo(r,o-i);else{if(null==e?void 0:e.destPos){var s=this.axisManager.get();this._initialEasingPer=this._prevEasingPer,n.delta=this.axisManager.getDelta(s,r),n.destPos=r}if(null==e?void 0:e.duration){var a=(i+this._durationOffset)/n.duration;this._durationOffset=a*o-i,n.duration=o}}}},n._initState=function(e){return this._initialEasingPer=0,this._prevEasingPer=0,this._durationOffset=0,{pos:e.depaPos,easingPer:0,finished:!1}},n._getNextState=function(e){var t=this,n=this._animateParam,i=e.pos,r=n.destPos,o=se(i,(function(e,t){return e<=r[t]?1:-1})),s=((new Date).getTime()-n.startTime+this._durationOffset)/n.duration,a=this._easing(s),u=this.axisManager.map(i,(function(e,u,l){var c=s>=1?r[l]:e+n.delta[l]*(a-t._prevEasingPer)/(1-t._initialEasingPer),h=Te(c,u.range,u.circular);if(c!==h){var d=o[l]*(u.range[1]-u.range[0]);r[l]-=d,i[l]-=d}return h}));return this._prevEasingPer=a,{pos:u,easingPer:a,finished:a>=1}},n._easing=function(e){return e>1?1:this._options.easing(e)},t}(function(){function e(e){var t=e.options,n=e.interruptManager,i=e.eventManager,r=e.axisManager;this._options=t,this.interruptManager=n,this.eventManager=i,this.axisManager=r,this.animationEnd=this.animationEnd.bind(this)}var t=e.prototype;return t.getDuration=function(e,t,n){var i,r=this;if(void 0!==n)i=n;else{var o=se(t,(function(t,n){return function(e,t){var n=Math.sqrt(e/t*2);return n<100?0:n}(Math.abs(t-e[n]),r._options.deceleration)}));i=Object.keys(o).reduce((function(e,t){return Math.max(e,o[t])}),-1/0)}return Qe(i,this._options.minimumDuration,this._options.maximumDuration)},t.getDisplacement=function(e){var t=Math.pow(e.reduce((function(e,t){return e+t*t}),0),1/e.length),n=Math.abs(t/-this._options.deceleration);return e.map((function(e){return e/2*n}))},t.stopAnimation=function(e){if(this._animateParam){var t=this.axisManager.get(),n=this.axisManager.map(t,(function(e,t){return Te(e,t.range,t.circular)}));ue(n,(function(e,n){return t[n]===e}))||this.eventManager.triggerChange(n,t,e,!!e),this._animateParam=null,this._raf&&(i=this._raf,ie(i)),this._raf=null,this.eventManager.triggerAnimationEnd(!!(null==e?void 0:e.event))}var i},t.getEventInfo=function(){return this._animateParam&&this._animateParam.input&&this._animateParam.inputEvent?{input:this._animateParam.input,event:this._animateParam.inputEvent}:null},t.restore=function(e){var t=this.axisManager.get(),n=this.axisManager.map(t,(function(e,t){return Math.min(t.range[1],Math.max(t.range[0],e))}));this.stopAnimation(),this.animateTo(n,this.getDuration(t,n),e)},t.animationEnd=function(){var e=this.getEventInfo();this._animateParam=null;var t=this.axisManager.filter(this.axisManager.get(),(function(e,t){return Ee(e,t.range,t.circular)}));Object.keys(t).length>0&&this.setTo(this.axisManager.map(t,(function(e,t){return Te(e,t.range,t.circular)}))),this.interruptManager.setInterrupt(!1),this.eventManager.triggerAnimationEnd(!!e),this.axisManager.isOutside()?this.restore(e):this.finish(!!e)},t.finish=function(e){this._animateParam=null,this.interruptManager.setInterrupt(!1),this.eventManager.triggerFinish(e)},t.getUserControl=function(e){var t=e.setTo();return t.destPos=this.axisManager.get(t.destPos),t.duration=Qe(t.duration,this._options.minimumDuration,this._options.maximumDuration),t},t.animateTo=function(e,t,n){var i=this;this.stopAnimation();var r=this._createAnimationParam(e,t,n),o=z({},r.depaPos),s=this.eventManager.triggerAnimationStart(r),a=this.getUserControl(r);if(!s&&this.axisManager.every(a.destPos,(function(e,t){return Ee(e,t.range,t.circular)}))&&console.warn("You can't stop the 'animation' event when 'circular' is true."),s&&!le(a.destPos,o)){var u=(null==n?void 0:n.event)||null;this._animateLoop({depaPos:o,destPos:a.destPos,duration:a.duration,delta:this.axisManager.getDelta(o,a.destPos),isTrusted:!!u,inputEvent:u,input:(null==n?void 0:n.input)||null},(function(){return i.animationEnd()}))}},t.setTo=function(e,t){void 0===t&&(t=0);var n=Object.keys(e),i=this.axisManager.get(n);if(le(e,i))return this;this.interruptManager.setInterrupt(!0);var r=ae(e,(function(e,t){return i[t]!==e}));return Object.keys(r).length?(r=this.axisManager.map(r,(function(e,t){var n=t.range,i=t.circular;return i&&(i[0]||i[1])?e:be(e,n,i)})),le(r,i)||(t>0?this.animateTo(r,t):(this.stopAnimation(),this.eventManager.triggerChange(r),this.finish(!1))),this):this},t.setBy=function(e,t){return void 0===t&&(t=0),this.setTo(se(this.axisManager.get(Object.keys(e)),(function(t,n){return t+e[n]})),t)},t._createAnimationParam=function(e,t,n){var i=this.axisManager.get(),r=e,o=(null==n?void 0:n.event)||null;return{depaPos:i,destPos:r,duration:Qe(t,this._options.minimumDuration,this._options.maximumDuration),delta:this.axisManager.getDelta(i,r),inputEvent:o,input:(null==n?void 0:n.input)||null,isTrusted:!!o,done:this.animationEnd}},t._animateLoop=function(e,t){var n=this;if(e.duration){this._animateParam=z(z({},e),{startTime:(new Date).getTime()});var i=se(e.destPos,(function(e){return e})),r=this._initState(this._animateParam),o=function(){n._raf=null;var e=n._animateParam,s=n._getNextState(r),a=!n.eventManager.triggerChange(s.pos,r.pos);if(r=s,s.finished)return e.destPos=n._getFinalPos(e.destPos,i),le(e.destPos,n.axisManager.get(Object.keys(e.destPos)))||n.eventManager.triggerChange(e.destPos,s.pos),void t();a?n.finish(!1):n._raf=ne(o)};o()}else this.eventManager.triggerChange(e.destPos),t()},t._getFinalPos=function(e,t){var n=this,i=1e-6;return se(e,(function(e,r){if(e>=t[r]-i&&e<=t[r]+i)return t[r];var o=n._getRoundUnit(e,r);return he(e,o)}))},t._getRoundUnit=function(e,t){var n,i=this._options.round,r=null;if(!i){var o=this.axisManager.getAxisOptions(t);n=Math.max(pe(o.range[0]),pe(o.range[1]),pe(e)),r=1/Math.pow(10,n)}return r||i},e}()),We=function(e){function t(t,n,i){void 0===t&&(t={}),void 0===n&&(n={}),void 0===i&&(i={});var r=e.call(this)||this;return r.axis=t,r._inputs=[],r.options=z({easing:function(e){return 1-Math.pow(1-e,3)},interruptable:!0,maximumDuration:1/0,minimumDuration:0,deceleration:6e-4,round:null,nested:!1},n),Object.keys(i).forEach((function(e){r.axis[e].startPos=i[e]})),r.interruptManager=new we(r.options),r.axisManager=new Se(r.axis),r.eventManager=new _e(r),r.animationManager=new Ue(r),r.inputObserver=new Ne(r),r.eventManager.setAnimationManager(r.animationManager),r.eventManager.triggerChange(r.axisManager.get()),r}G(t,e);var n=t.prototype;return n.connect=function(e,t){var n;return n="string"==typeof e?e.split(" "):e.concat(),~this._inputs.indexOf(t)&&this.disconnect(t),t.mapAxes(n),t.connect(this.inputObserver),this._inputs.push(t),this},n.disconnect=function(e){if(e){var t=this._inputs.indexOf(e);t>=0&&(this._inputs[t].disconnect(),this._inputs.splice(t,1))}else this._inputs.forEach((function(e){return e.disconnect()})),this._inputs=[];return this},n.get=function(e){return this.axisManager.get(e)},n.setTo=function(e,t){return void 0===t&&(t=0),this.animationManager.setTo(e,t),this},n.setBy=function(e,t){return void 0===t&&(t=0),this.animationManager.setBy(e,t),this},n.setOptions=function(e){return this.options=z(z({},this.options),e),this},n.setAxis=function(e){return this.axisManager.setAxis(e),this},n.stopAnimation=function(){return this.animationManager.stopAnimation(),this.animationManager.finish(!1),this},n.updateAnimation=function(e){return this.animationManager.updateAnimation(e),this},n.isBounceArea=function(e){return this.axisManager.isOutside(e)},n.destroy=function(){this.disconnect(),this.eventManager.destroy()},t.VERSION="3.8.4",t.TRANSFORM=$,t.DIRECTION_NONE=1,t.DIRECTION_LEFT=2,t.DIRECTION_RIGHT=4,t.DIRECTION_UP=8,t.DIRECTION_DOWN=16,t.DIRECTION_HORIZONTAL=6,t.DIRECTION_VERTICAL=X,t.DIRECTION_ALL=30,function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}([U],t)}(l),Ge=function(){function e(e,t){var n=this;this.axes=[],this.element=null,this._enabled=!1,this._activeEvent=null,this._atRightEdge=!1,this._rightEdgeTimer=0,this._dragged=!1,this._isOverThreshold=!1,this._preventClickWhenDragged=function(e){n._dragged&&(e.preventDefault(),e.stopPropagation()),n._dragged=!1},this._voidFunction=function(){},this.element=te(e),this.options=z({inputType:["touch","mouse","pointer"],inputKey:[Z],inputButton:[H],scale:[1,1],thresholdAngle:45,threshold:0,preventClickOnDrag:!1,iOSEdgeSwipeThreshold:30,releaseOnScroll:!1,touchAction:null},t),this._onPanstart=this._onPanstart.bind(this),this._onPanmove=this._onPanmove.bind(this),this._onPanend=this._onPanend.bind(this)}var t=e.prototype;return t.mapAxes=function(e){this._direction=ge(!!e[0],!!e[1]),this.axes=e},t.connect=function(e){return this._activeEvent&&(this._detachElementEvent(),this._detachWindowEvent(this._activeEvent)),this._attachElementEvent(e),this._originalCssProps=me(this.element,this.options,this._direction),this},t.disconnect=function(){return this._detachElementEvent(),this._detachWindowEvent(this._activeEvent),Ae(this._originalCssProps)||ye(this.element,this._originalCssProps),this._direction=1,this},t.destroy=function(){this.disconnect(),this.element=null},t.enable=function(){return this._enabled=!0,this},t.disable=function(){return this._enabled=!1,this},t.isEnabled=function(){return this._enabled},t.release=function(){var e=this._activeEvent,t=e.prevEvent;return e.onRelease(),this._observer.release(this,t,[0,0]),this._detachWindowEvent(e),this},t._onPanstart=function(e){var t=this.options,n=t.inputKey,i=t.inputButton,r=this._activeEvent,o=r.onEventStart(e,n,i);if(o&&this._enabled&&!(r.getTouches(e,i)>1)&&!1!==o.srcEvent.cancelable){var s=this.options.iOSEdgeSwipeThreshold;this._dragged=!1,this._isOverThreshold=!1,this._observer.hold(this,o),this._atRightEdge=K&&o.center.x>window.innerWidth-s,this._attachWindowEvent(r),r.prevEvent=o}},t._onPanmove=function(e){var t=this,n=this.options,i=n.iOSEdgeSwipeThreshold,r=n.preventClickOnDrag,o=n.releaseOnScroll,s=n.inputKey,a=n.inputButton,u=n.threshold,l=n.thresholdAngle,c=this._activeEvent,h=c.onEventMove(e,s,a),d=c.getTouches(e,a);if(0===d||o&&h&&!h.srcEvent.cancelable)this._onPanend(e);else if(h&&this._enabled&&!(d>1)){var p=function(e,t){if(t<0||t>90)return 1;var n=Math.abs(e);return n>t&&n<180-t?X:6}(h.angle,l),f=ve(6,this._direction,p),A=ve(X,this._direction,p);if(c.prevEvent&&K){if(h.center.x<0)return void this.release();this._atRightEdge&&(clearTimeout(this._rightEdgeTimer),h.deltaX<-i?this._atRightEdge=!1:this._rightEdgeTimer=window.setTimeout((function(){return t.release()}),100))}var g=this._getDistance([h.deltaX,h.deltaY],[f,A]),v=this._getOffset([h.offsetX,h.offsetY],[f,A]),m=v.some((function(e){return 0!==e}));m&&(!1!==h.srcEvent.cancelable&&h.srcEvent.preventDefault(),h.srcEvent.stopPropagation()),h.preventSystemEvent=m,m&&(this._isOverThreshold||g>=u)&&(this._dragged=r,this._isOverThreshold=!0,this._observer.change(this,h,Le(this.axes,v))),c.prevEvent=h}},t._onPanend=function(e){var t=this.options.inputButton,n=this._activeEvent;if(n.onEventEnd(e),this._enabled&&0===n.getTouches(e,t)){this._detachWindowEvent(n),clearTimeout(this._rightEdgeTimer);var i=n.prevEvent,r=this._isOverThreshold?this._getOffset([Math.abs(i.velocityX)*(i.offsetX<0?-1:1),Math.abs(i.velocityY)*(i.offsetY<0?-1:1)],[ve(6,this._direction),ve(X,this._direction)]):[0,0];n.onRelease(),this._observer.release(this,i,r)}},t._attachWindowEvent=function(e){var t=this;null==e||e.move.forEach((function(e){window.addEventListener(e,t._onPanmove,ke(e))})),null==e||e.end.forEach((function(e){window.addEventListener(e,t._onPanend,ke(e))}))},t._detachWindowEvent=function(e){var t=this;null==e||e.move.forEach((function(e){window.removeEventListener(e,t._onPanmove)})),null==e||e.end.forEach((function(e){window.removeEventListener(e,t._onPanend)}))},t._getOffset=function(e,t){var n=this.options.scale;return[t[0]?e[0]*n[0]:0,t[1]?e[1]*n[1]:0]},t._getDistance=function(e,t){return Math.sqrt(Number(t[0])*Math.pow(e[0],2)+Number(t[1])*Math.pow(e[1],2))},t._attachElementEvent=function(e){var t=this,n=Ve(this.options.inputType),i=this.element;if(n){if(!i)throw new Error("Element to connect input does not exist.");this._observer=e,this._enabled=!0,this._activeEvent=n,i.addEventListener("click",this._preventClickWhenDragged,!0),n.start.forEach((function(e){i.addEventListener(e,t._onPanstart)})),n.move.forEach((function(e){i.addEventListener(e,t._voidFunction)}))}},t._detachElementEvent=function(){var e=this,t=this._activeEvent,n=this.element;n&&(n.removeEventListener("click",this._preventClickWhenDragged,!0),null==t||t.start.forEach((function(t){n.removeEventListener(t,e._onPanstart)})),null==t||t.move.forEach((function(t){n.removeEventListener(t,e._voidFunction)}))),this._enabled=!1,this._observer=null},e}(),je=function(){function e(e,t){this.axes=[],this.element=null,this._pinchFlag=!1,this._enabled=!1,this._activeEvent=null,this._isOverThreshold=!1,this.element=te(e),this.options=z({scale:1,threshold:0,inputType:["touch","pointer"],touchAction:"none"},t),this._onPinchStart=this._onPinchStart.bind(this),this._onPinchMove=this._onPinchMove.bind(this),this._onPinchEnd=this._onPinchEnd.bind(this)}var t=e.prototype;return t.mapAxes=function(e){this.axes=e},t.connect=function(e){return this._activeEvent&&this._detachEvent(),this._attachEvent(e),this._originalCssProps=me(this.element,this.options,30),this},t.disconnect=function(){return this._detachEvent(),Ae(this._originalCssProps)||ye(this.element,this._originalCssProps),this},t.destroy=function(){this.disconnect(),this.element=null},t.enable=function(){return this._enabled=!0,this},t.disable=function(){return this._enabled=!1,this},t.isEnabled=function(){return this._enabled},t._onPinchStart=function(e){var t=this._activeEvent,n=t.onEventStart(e);n&&this._enabled&&2===t.getTouches(e)&&(this._baseValue=this._observer.get(this)[this.axes[0]],this._observer.hold(this,e),this._pinchFlag=!0,this._isOverThreshold=!1,t.prevEvent=n)},t._onPinchMove=function(e){var t=this.options.threshold,n=this._activeEvent,i=n.onEventMove(e);if(i&&this._pinchFlag&&this._enabled&&2===n.getTouches(e)){var r=this._getDistance(i.scale),o=this._getOffset(i.scale,n.prevEvent.scale);(this._isOverThreshold||r>=t)&&(this._isOverThreshold=!0,this._observer.change(this,e,Le(this.axes,[o]))),n.prevEvent=i}},t._onPinchEnd=function(e){var t=this._activeEvent;t.onEventEnd(e),!this._pinchFlag||!this._enabled||t.getTouches(e)>=2||(t.onRelease(),this._observer.release(this,e,[0],0),this._baseValue=null,this._pinchFlag=!1)},t._attachEvent=function(e){var t=this,n=Ve(this.options.inputType),i=this.element;if(n){if(!i)throw new Error("Element to connect input does not exist.");this._observer=e,this._enabled=!0,this._activeEvent=n,n.start.forEach((function(e){i.addEventListener(e,t._onPinchStart,!1)})),n.move.forEach((function(e){i.addEventListener(e,t._onPinchMove,!1)})),n.end.forEach((function(e){i.addEventListener(e,t._onPinchEnd,!1)}))}},t._detachEvent=function(){var e=this,t=this._activeEvent,n=this.element;n&&(null==t||t.start.forEach((function(t){n.removeEventListener(t,e._onPinchStart,!1)})),null==t||t.move.forEach((function(t){n.removeEventListener(t,e._onPinchMove,!1)})),null==t||t.end.forEach((function(t){n.removeEventListener(t,e._onPinchEnd,!1)}))),this._enabled=!1,this._observer=null},t._getOffset=function(e,t){return void 0===t&&(t=1),this._baseValue*(e-t)*this.options.scale},t._getDistance=function(e){return Math.abs(e-1)},e}(),ze=function(){function e(e,t){this.axes=[],this.element=null,this._enabled=!1,this._holding=!1,this._timer=null,this.element=te(e),this.options=z({inputKey:[Z],scale:1,releaseDelay:300,useNormalized:!0,useAnimation:!1},t),this._onWheel=this._onWheel.bind(this)}var t=e.prototype;return t.mapAxes=function(e){this._direction=ge(!!e[1],!!e[0]),this.axes=e},t.connect=function(e){return this._detachEvent(),this._attachEvent(e),this},t.disconnect=function(){return this._detachEvent(),this},t.destroy=function(){this.disconnect(),this.element=null},t.enable=function(){return this._enabled=!0,this},t.disable=function(){return this._enabled=!1,this},t.isEnabled=function(){return this._enabled},t._onWheel=function(e){var t=this;if(this._enabled&&Pe(e,this.options.inputKey)){var n=this._getOffset([e.deltaY,e.deltaX],[ve(X,this._direction),ve(6,this._direction)]);0===n[0]&&0===n[1]||(e.preventDefault(),this._holding||(this._observer.hold(this,e),this._holding=!0),this._observer.change(this,e,Le(this.axes,n),this.options.useAnimation),clearTimeout(this._timer),this._timer=setTimeout((function(){t._holding&&(t._holding=!1,t._observer.release(t,e,[0]))}),this.options.releaseDelay))}},t._getOffset=function(e,t){var n=this.options.scale,i=this.options.useNormalized;return[t[0]&&e[0]?(e[0]>0?-1:1)*(i?1:Math.abs(e[0]))*n:0,t[1]&&e[1]?(e[1]>0?-1:1)*(i?1:Math.abs(e[1]))*n:0]},t._attachEvent=function(e){var t=this.element;if(!t)throw new Error("Element to connect input does not exist.");this._observer=e,t.addEventListener("wheel",this._onWheel),this._enabled=!0},t._detachEvent=function(){this.element&&this.element.removeEventListener("wheel",this._onWheel),this._enabled=!1,this._observer=null,this._timer&&(clearTimeout(this._timer),this._timer=null)},e}(),Xe=function(){function e(e,t){this.axes=[],this.element=null,this._enabled=!1,this._holding=!1,this._timer=null,this.element=te(e),this.options=z({scale:[1,1]},t),this._onKeydown=this._onKeydown.bind(this),this._onKeyup=this._onKeyup.bind(this)}var t=e.prototype;return t.mapAxes=function(e){this.axes=e},t.connect=function(e){return this._detachEvent(),"0"!==this.element.getAttribute("tabindex")&&this.element.setAttribute("tabindex","0"),this._attachEvent(e),this},t.disconnect=function(){return this._detachEvent(),this},t.destroy=function(){this.disconnect(),this.element=null},t.enable=function(){return this._enabled=!0,this},t.disable=function(){return this._enabled=!1,this},t.isEnabled=function(){return this._enabled},t._onKeydown=function(e){if(this._enabled){var t=!0,n=1,i=-1;switch(e.keyCode){case 37:case 65:n=-1;break;case 39:case 68:break;case 40:case 83:n=-1,i=1;break;case 38:case 87:i=1;break;default:t=!1}if((-1===i&&!this.axes[0]||1===i&&!this.axes[1])&&(t=!1),t){e.preventDefault();var r=-1===i?[+this.options.scale[0]*n,0]:[0,+this.options.scale[1]*n];this._holding||(this._observer.hold(this,e),this._holding=!0),clearTimeout(this._timer),this._observer.change(this,e,Le(this.axes,r))}}},t._onKeyup=function(e){var t=this;this._holding&&(clearTimeout(this._timer),this._timer=setTimeout((function(){t._observer.release(t,e,[0,0]),t._holding=!1}),80))},t._attachEvent=function(e){var t=this.element;if(!t)throw new Error("Element to connect input does not exist.");this._observer=e,t.addEventListener("keydown",this._onKeydown,!1),t.addEventListener("keypress",this._onKeydown,!1),t.addEventListener("keyup",this._onKeyup,!1),this._enabled=!0},t._detachEvent=function(){var e=this.element;e&&(e.removeEventListener("keydown",this._onKeydown,!1),e.removeEventListener("keypress",this._onKeydown,!1),e.removeEventListener("keyup",this._onKeyup,!1)),this._enabled=!1,this._observer=null},e}();const He=We;var qe=1e-6,Ye="undefined"!=typeof Float32Array?Float32Array:Array;Math.random;var Ze=Math.PI/180;function Ke(e){return e*Ze}function $e(){var e=new Ye(3);return Ye!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function Je(e){var t=e[0],n=e[1],i=e[2];return Math.hypot(t,n,i)}function et(e,t,n){var i=new Ye(3);return i[0]=e,i[1]=t,i[2]=n,i}function tt(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e[2]=t[2]-n[2],e}function nt(e,t,n){var i=t[0],r=t[1],o=t[2],s=n[0],a=n[1],u=n[2];return e[0]=r*u-o*a,e[1]=o*s-i*u,e[2]=i*a-r*s,e}function it(e,t,n){var i=t[0],r=t[1],o=t[2];return e[0]=i*n[0]+r*n[3]+o*n[6],e[1]=i*n[1]+r*n[4]+o*n[7],e[2]=i*n[2]+r*n[5]+o*n[8],e}function rt(e,t,n){var i=n[0],r=n[1],o=n[2],s=n[3],a=t[0],u=t[1],l=t[2],c=r*l-o*u,h=o*a-i*l,d=i*u-r*a,p=r*d-o*h,f=o*c-i*d,A=i*h-r*c,g=2*s;return c*=g,h*=g,d*=g,p*=2,f*=2,A*=2,e[0]=a+c+p,e[1]=u+h+f,e[2]=l+d+A,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var ot;function st(){var e=new Ye(9);return Ye!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function at(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e}function ut(e,t){var n=t[0],i=t[1],r=t[2],o=t[3],s=t[4],a=t[5],u=t[6],l=t[7],c=t[8],h=c*s-a*l,d=-c*o+a*u,p=l*o-s*u,f=n*h+i*d+r*p;return f?(f=1/f,e[0]=h*f,e[1]=(-c*i+r*l)*f,e[2]=(a*i-r*s)*f,e[3]=d*f,e[4]=(c*n-r*u)*f,e[5]=(-a*n+r*o)*f,e[6]=p*f,e[7]=(-l*n+i*u)*f,e[8]=(s*n-i*o)*f,e):null}function lt(){var e=new Ye(4);return Ye!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}$e(),ot=new Ye(4),Ye!=Float32Array&&(ot[0]=0,ot[1]=0,ot[2]=0,ot[3]=0);var ct=function(e){var t=new Ye(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},ht=function(e,t,n,i){var r=new Ye(4);return r[0]=e,r[1]=t,r[2]=n,r[3]=i,r},dt=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},pt=function(e,t){var n=t[0],i=t[1],r=t[2],o=t[3],s=n*n+i*i+r*r+o*o;return s>0&&(s=1/Math.sqrt(s)),e[0]=n*s,e[1]=i*s,e[2]=r*s,e[3]=o*s,e};function ft(e,t){var n=new Ye(2);return n[0]=e,n[1]=t,n}function At(e,t){return e[0]=t[0],e[1]=t[1],e}function gt(e,t){var n=t[0],i=t[1],r=n*n+i*i;return r>0&&(r=1/Math.sqrt(r)),e[0]=t[0]*r,e[1]=t[1]*r,e}function vt(){var e=new Ye(16);return Ye!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function mt(e,t,n){var i=Math.sin(n),r=Math.cos(n),o=t[4],s=t[5],a=t[6],u=t[7],l=t[8],c=t[9],h=t[10],d=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=o*r+l*i,e[5]=s*r+c*i,e[6]=a*r+h*i,e[7]=u*r+d*i,e[8]=l*r-o*i,e[9]=c*r-s*i,e[10]=h*r-a*i,e[11]=d*r-u*i,e}function yt(e,t,n){var i=Math.sin(n),r=Math.cos(n),o=t[0],s=t[1],a=t[2],u=t[3],l=t[8],c=t[9],h=t[10],d=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*r-l*i,e[1]=s*r-c*i,e[2]=a*r-h*i,e[3]=u*r-d*i,e[8]=o*i+l*r,e[9]=s*i+c*r,e[10]=a*i+h*r,e[11]=u*i+d*r,e}$e(),et(1,0,0),et(0,1,0),lt(),lt(),st(),function(){var e;e=new Ye(2),Ye!=Float32Array&&(e[0]=0,e[1]=0)}();var _t=function(e,t,n,i,r){var o,s=1/Math.tan(t/2);return e[0]=s/n,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=r&&r!==1/0?(o=1/(i-r),e[10]=(r+i)*o,e[14]=2*r*i*o):(e[10]=-1,e[14]=-2*i),e},wt=function(e,t){return(wt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function bt(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}wt(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var xt=function(){return(xt=Object.assign||function(e){for(var t,n=1,i=arguments.length;n0},n.clear=function(){this.isPreReadyOver=!1,this.totalCount=0,this.preReadyCount=0,this.readyCount=0,this.totalErrorCount=0,this.elementInfos.forEach((function(e){e.loader&&e.loader.destroy()})),this.elementInfos=[]},n.destroy=function(){this.clear(),this.off()},n.getLoader=function(e,t){var n=this,i=e.tagName.toLowerCase(),r=this.options.loaders,o=t.prefix,s=Object.keys(r);if(r[i])return new r[i](e,t);var a=new Wt(e,t),u=Dt(e.querySelectorAll(s.join(", ")));a.setHasLoading(u.some((function(e){return It(e,o)})));var l=!1,c=this.clone().on("error",(function(e){a.onError(e.target)})).on("ready",(function(){a.onReady(l)}));return a.on("requestChildren",(function(){var t=function(e,t,n){var i=Dt(e.querySelectorAll(function(){for(var e=0,t=0,n=arguments.length;t=1||(e.error?(this.onAlreadyError(e),1):(this.addEvents(),0)))},t.EVENTS=["loadedmetadata","error"],t}(Ut);const Xt=function(e){function t(t){return void 0===t&&(t={}),e.call(this,xt({loaders:{img:jt,video:zt}},t))||this}return bt(t,e),t}(Gt);var Ht="3.6.4",qt=function(e,t){return(qt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function Yt(e,t){function n(){this.constructor=e}qt(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var Zt=function(){return(Zt=Object.assign||function(e){for(var t,n=1,i=arguments.length;n=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function $t(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)s.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return s}function Jt(){for(var e=[],t=0;t0)-Number(e<0)||+e},mn.toDegree=vn,mn.getRotationDelta=function(e,t,n){var i=et(yn[n].targetAxis[0],yn[n].targetAxis[1],yn[n].targetAxis[2]),r=yn[n].meshPoint,o=ct(e),s=ct(t);pt(o,o),pt(s,s);var a=et(0,0,1),u=et(0,0,1);rt(a,a,o),rt(u,u,s),rt(i,i,s);var l,c=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}(i,nt($e(),a,u))>0?1:-1,h=et(r[0],r[1],r[2]);l=n!==yn.YAW_DELTA_BY_YAW?et(0,c,0):et(c,0,0),rt(h,h,s),rt(l,l,s);var d=h,p=l,f=$e();nt(f,d,p),function(e,t){var n=t[0],i=t[1],r=t[2],o=n*n+i*i+r*r;o>0&&(o=1/Math.sqrt(o)),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o}(f,f);var A=f[0],g=f[1],v=f[2];rt(u=et(r[0],r[1],r[2]),u,s),rt(a=et(r[0],r[1],r[2]),a,o);var m=Math.abs(a[0]*A+a[1]*g+a[2]*v),y=$e();tt(y,a,function(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}($e(),f,m));var _=(y[0]*u[0]+y[1]*u[1]+y[2]*u[2])/(Je(y)*Je(u));_>1&&(_=1);var w,b=Math.acos(_),x=nt($e(),u,y);return m=A*x[0]+g*x[1]+v*x[2],w=n!==yn.YAW_DELTA_BY_YAW?m>0?1:-1:m<0?1:-1,vn(b*w*c)},mn.angleBetweenVec2=_n;var wn=-1,bn=null,xn=null,En=/Chrome\/([0-9]+)\.(?:[0-9]*)\.([0-9]*)\.([0-9]*)/i.exec(ln);En&&(wn=parseInt(En[1],10),bn=En[2],xn=En[3]);var Tn,Sn,Rn,Mn=wn,Cn=65===wn&&"3325"===bn&&parseInt(xn,10)<148,Pn=/Android/i.test(ln),Fn=.0014,Dn=[.2,.2],In={NONE:"none",YAWPITCH:"yawPitch",VR:"VR"},On=en.MathUtil||{};On.degToRad=Math.PI/180,On.radToDeg=180/Math.PI,On.Vector2=function(e,t){this.x=e||0,this.y=t||0},On.Vector2.prototype={constructor:On.Vector2,set:function(e,t){return this.x=e,this.y=t,this},copy:function(e){return this.x=e.x,this.y=e.y,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}},On.Vector3=function(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0},On.Vector3.prototype={constructor:On.Vector3,set:function(e,t,n){return this.x=e,this.y=t,this.z=n,this},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},normalize:function(){var e=this.length();if(0!==e){var t=1/e;this.multiplyScalar(t)}else this.x=0,this.y=0,this.z=0;return this},multiplyScalar:function(e){this.x*=e,this.y*=e,this.z*=e},applyQuaternion:function(e){var t=this.x,n=this.y,i=this.z,r=e.x,o=e.y,s=e.z,a=e.w,u=a*t+o*i-s*n,l=a*n+s*t-r*i,c=a*i+r*n-o*t,h=-r*t-o*n-s*i;return this.x=u*a+h*-r+l*-s-c*-o,this.y=l*a+h*-o+c*-r-u*-s,this.z=c*a+h*-s+u*-o-l*-r,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},crossVectors:function(e,t){var n=e.x,i=e.y,r=e.z,o=t.x,s=t.y,a=t.z;return this.x=i*a-r*s,this.y=r*o-n*a,this.z=n*s-i*o,this}},On.Quaternion=function(e,t,n,i){this.x=e||0,this.y=t||0,this.z=n||0,this.w=void 0!==i?i:1},On.Quaternion.prototype={constructor:On.Quaternion,set:function(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this},setFromEulerXYZ:function(e,t,n){var i=Math.cos(e/2),r=Math.cos(t/2),o=Math.cos(n/2),s=Math.sin(e/2),a=Math.sin(t/2),u=Math.sin(n/2);return this.x=s*r*o+i*a*u,this.y=i*a*o-s*r*u,this.z=i*r*u+s*a*o,this.w=i*r*o-s*a*u,this},setFromEulerYXZ:function(e,t,n){var i=Math.cos(e/2),r=Math.cos(t/2),o=Math.cos(n/2),s=Math.sin(e/2),a=Math.sin(t/2),u=Math.sin(n/2);return this.x=s*r*o+i*a*u,this.y=i*a*o-s*r*u,this.z=i*r*u-s*a*o,this.w=i*r*o+s*a*u,this},setFromAxisAngle:function(e,t){var n=t/2,i=Math.sin(n);return this.x=e.x*i,this.y=e.y*i,this.z=e.z*i,this.w=Math.cos(n),this},multiply:function(e){return this.multiplyQuaternions(this,e)},multiplyQuaternions:function(e,t){var n=e.x,i=e.y,r=e.z,o=e.w,s=t.x,a=t.y,u=t.z,l=t.w;return this.x=n*l+o*s+i*u-r*a,this.y=i*l+o*a+r*s-n*u,this.z=r*l+o*u+n*a-i*s,this.w=o*l-n*s-i*a-r*u,this},inverse:function(){return this.x*=-1,this.y*=-1,this.z*=-1,this.normalize(),this},normalize:function(){var e=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);return 0===e?(this.x=0,this.y=0,this.z=0,this.w=1):(e=1/e,this.x=this.x*e,this.y=this.y*e,this.z=this.z*e,this.w=this.w*e),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var n=this.x,i=this.y,r=this.z,o=this.w,s=o*e.w+n*e.x+i*e.y+r*e.z;if(s<0?(this.w=-e.w,this.x=-e.x,this.y=-e.y,this.z=-e.z,s=-s):this.copy(e),s>=1)return this.w=o,this.x=n,this.y=i,this.z=r,this;var a=Math.acos(s),u=Math.sqrt(1-s*s);if(Math.abs(u)<.001)return this.w=.5*(o+this.w),this.x=.5*(n+this.x),this.y=.5*(i+this.y),this.z=.5*(r+this.z),this;var l=Math.sin((1-t)*a)/u,c=Math.sin(t*a)/u;return this.w=o*l+this.w*c,this.x=n*l+this.x*c,this.y=i*l+this.y*c,this.z=r*l+this.z*c,this},setFromUnitVectors:function(e,t){return void 0===Tn&&(Tn=new On.Vector3),(Sn=e.dot(t)+1)<1e-6?(Sn=0,Math.abs(e.x)>Math.abs(e.z)?Tn.set(-e.y,e.x,0):Tn.set(0,-e.z,e.y)):Tn.crossVectors(e,t),this.x=Tn.x,this.y=Tn.y,this.z=Tn.z,this.w=Sn,this.normalize(),this}};var Bn,Ln,Vn,kn,Nn,Qn=null!==(Rn=null==nn?void 0:nn.userAgent)&&void 0!==Rn?Rn:"",Un=en.Util||{};Un.MIN_TIMESTEP=.001,Un.MAX_TIMESTEP=1,Un.base64=function(e,t){return"data:"+e+";base64,"+t},Un.clamp=function(e,t,n){return Math.min(Math.max(t,e),n)},Un.lerp=function(e,t,n){return e+(t-e)*n},Un.isIOS=(Bn=/iPad|iPhone|iPod/.test(null==nn?void 0:nn.platform),function(){return Bn}),Un.isWebViewAndroid=(Ln=-1!==Qn.indexOf("Version")&&-1!==Qn.indexOf("Android")&&-1!==Qn.indexOf("Chrome"),function(){return Ln}),Un.isSafari=(Vn=/^((?!chrome|android).)*safari/i.test(Qn),function(){return Vn}),Un.isFirefoxAndroid=(kn=-1!==Qn.indexOf("Firefox")&&-1!==Qn.indexOf("Android"),function(){return kn}),Un.isR7=(Nn=-1!==Qn.indexOf("R7 Build"),function(){return Nn}),Un.isLandscapeMode=function(){var e=90===en.orientation||-90===en.orientation;return Un.isR7()?!e:e},Un.isTimestampDeltaValid=function(e){return!(isNaN(e)||e<=Un.MIN_TIMESTEP||e>Un.MAX_TIMESTEP)},Un.getScreenWidth=function(){return Math.max(en.screen.width,en.screen.height)*en.devicePixelRatio},Un.getScreenHeight=function(){return Math.min(en.screen.width,en.screen.height)*en.devicePixelRatio},Un.requestFullscreen=function(e){if(Un.isWebViewAndroid())return!1;if(e.requestFullscreen)e.requestFullscreen();else if(e.webkitRequestFullscreen)e.webkitRequestFullscreen();else if(e.mozRequestFullScreen)e.mozRequestFullScreen();else{if(!e.msRequestFullscreen)return!1;e.msRequestFullscreen()}return!0},Un.exitFullscreen=function(){if(tn.exitFullscreen)tn.exitFullscreen();else if(tn.webkitExitFullscreen)tn.webkitExitFullscreen();else if(tn.mozCancelFullScreen)tn.mozCancelFullScreen();else{if(!tn.msExitFullscreen)return!1;tn.msExitFullscreen()}return!0},Un.getFullscreenElement=function(){return tn.fullscreenElement||tn.webkitFullscreenElement||tn.mozFullScreenElement||tn.msFullscreenElement},Un.linkProgram=function(e,t,n,i){var r=e.createShader(e.VERTEX_SHADER);e.shaderSource(r,t),e.compileShader(r);var o=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(o,n),e.compileShader(o);var s=e.createProgram();for(var a in e.attachShader(s,r),e.attachShader(s,o),i)e.bindAttribLocation(s,i[a],a);return e.linkProgram(s),e.deleteShader(r),e.deleteShader(o),s},Un.getProgramUniforms=function(e,t){for(var n={},i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS),r="",o=0;o-1?e.split("/")[2]:e.split("/")[0]).split(":")[0]};var Wn=function(){function e(e){this.predictionTimeS=e,this.previousQ=new On.Quaternion,this.previousTimestampS=null,this.deltaQ=new On.Quaternion,this.outQ=new On.Quaternion}return e.prototype.getPrediction=function(e,t,n){if(!this.previousTimestampS)return this.previousQ.copy(e),this.previousTimestampS=n,e;var i=new On.Vector3;i.copy(t),i.normalize();var r=t.length();if(r<20*On.degToRad)return Un.isDebug()&&console.log("Moving slowly, at %s deg/s: no prediction",(On.radToDeg*r).toFixed(1)),this.outQ.copy(e),this.previousQ.copy(e),this.outQ;this.previousTimestampS;var o=r*this.predictionTimeS;return this.deltaQ.setFromAxisAngle(i,o),this.outQ.copy(this.previousQ),this.outQ.multiply(this.deltaQ),this.previousQ.copy(e),this.previousTimestampS=n,this.outQ},e}(),Gn=function(e){function t(){var t=e.call(this)||this;return t._onDeviceMotion=t._onDeviceMotion.bind(t),t._onDeviceOrientation=t._onDeviceOrientation.bind(t),t._onChromeWithoutDeviceMotion=t._onChromeWithoutDeviceMotion.bind(t),t.isWithoutDeviceMotion=Cn,t.isAndroid=Pn,t.stillGyroVec=$e(),t.rawGyroVec=$e(),t.adjustedGyroVec=$e(),t._timer=-1,t.lastDevicemotionTimestamp=0,t._isEnabled=!1,t.enable(),t}Yt(t,e);var n=t.prototype;return n.enable=function(){this.isAndroid&&en.addEventListener("deviceorientation",this._onDeviceOrientation),this.isWithoutDeviceMotion?en.addEventListener("deviceorientation",this._onChromeWithoutDeviceMotion):en.addEventListener("devicemotion",this._onDeviceMotion),this._isEnabled=!0},n.disable=function(){en.removeEventListener("deviceorientation",this._onDeviceOrientation),en.removeEventListener("deviceorientation",this._onChromeWithoutDeviceMotion),en.removeEventListener("devicemotion",this._onDeviceMotion),this._isEnabled=!1},n._onChromeWithoutDeviceMotion=function(e){var t=e.alpha,n=e.beta,i=e.gamma;null!==t&&(t=(t||0)*Math.PI/180,n=(n||0)*Math.PI/180,i=(i||0)*Math.PI/180,this.trigger(new u("devicemotion",{inputEvent:{deviceorientation:{alpha:t,beta:n,gamma:-i}}})))},n._onDeviceOrientation=function(){var e=this;this._timer&&clearTimeout(this._timer),this._timer=en.setTimeout((function(){(new Date).getTime()-e.lastDevicemotionTimestamp<200&&function(e,t){e[0]=t[0],e[1]=t[1],e[2]=t[2]}(e.stillGyroVec,e.rawGyroVec)}),200)},n._onDeviceMotion=function(e){var t=!(null==e.rotationRate.alpha),n=!(null==e.accelerationIncludingGravity.x);if(0!==e.interval&&t&&n){var i=Zt({},e);i.interval=e.interval,i.timeStamp=e.timeStamp,i.type=e.type,i.rotationRate={alpha:e.rotationRate.alpha,beta:e.rotationRate.beta,gamma:e.rotationRate.gamma},i.accelerationIncludingGravity={x:e.accelerationIncludingGravity.x,y:e.accelerationIncludingGravity.y,z:e.accelerationIncludingGravity.z},i.acceleration={x:e.acceleration.x,y:e.acceleration.y,z:e.acceleration.z},this.isAndroid&&(function(e,t,n,i){e[0]=t,e[1]=n,e[2]=i}(this.rawGyroVec,e.rotationRate.alpha||0,e.rotationRate.beta||0,e.rotationRate.gamma||0),tt(this.adjustedGyroVec,this.rawGyroVec,this.stillGyroVec),this.lastDevicemotionTimestamp=(new Date).getTime(),i.adjustedRotationRate={alpha:this.adjustedGyroVec[0],beta:this.adjustedGyroVec[1],gamma:this.adjustedGyroVec[2]}),this.trigger(new u("devicemotion",{inputEvent:i}))}},t}(l),jn=function(){function e(e,t){this.set(e,t)}var t=e.prototype;return t.set=function(e,t){this.sample=e,this.timestampS=t},t.copy=function(e){this.set(e.sample,e.timestampS)},e}(),zn=function(){function e(e){this.addGyroMeasurement=function(e,t){this.currentGyroMeasurement.set(e,t);var n=t-this.previousGyroMeasurement.timestampS;Un.isTimestampDeltaValid(n)&&this.run_(),this.previousGyroMeasurement.copy(this.currentGyroMeasurement)},this.kFilter=e,this.currentAccelMeasurement=new jn,this.currentGyroMeasurement=new jn,this.previousGyroMeasurement=new jn,Un.isIOS()?this.filterQ=new On.Quaternion(-1,0,0,1):this.filterQ=new On.Quaternion(1,0,0,1),this.previousFilterQ=new On.Quaternion,this.previousFilterQ.copy(this.filterQ),this.accelQ=new On.Quaternion,this.isOrientationInitialized=!1,this.estimatedGravity=new On.Vector3,this.measuredGravity=new On.Vector3,this.gyroIntegralQ=new On.Quaternion}var t=e.prototype;return t.addAccelMeasurement=function(e,t){this.currentAccelMeasurement.set(e,t)},t.getOrientation=function(){return this.filterQ},t.run_=function(){if(!this.isOrientationInitialized)return this.accelQ=this.accelToQuaternion_(this.currentAccelMeasurement.sample),this.previousFilterQ.copy(this.accelQ),void(this.isOrientationInitialized=!0);var e=this.currentGyroMeasurement.timestampS-this.previousGyroMeasurement.timestampS,t=this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample,e);this.gyroIntegralQ.multiply(t),this.filterQ.copy(this.previousFilterQ),this.filterQ.multiply(t);var n=new On.Quaternion;n.copy(this.filterQ),n.inverse(),this.estimatedGravity.set(0,0,-1),this.estimatedGravity.applyQuaternion(n),this.estimatedGravity.normalize(),this.measuredGravity.copy(this.currentAccelMeasurement.sample),this.measuredGravity.normalize();var i=new On.Quaternion;i.setFromUnitVectors(this.estimatedGravity,this.measuredGravity),i.inverse(),Un.isDebug()&&console.log("Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)",On.radToDeg*Un.getQuaternionAngle(i),this.estimatedGravity.x.toFixed(1),this.estimatedGravity.y.toFixed(1),this.estimatedGravity.z.toFixed(1),this.measuredGravity.x.toFixed(1),this.measuredGravity.y.toFixed(1),this.measuredGravity.z.toFixed(1));var r=new On.Quaternion;r.copy(this.filterQ),r.multiply(i),this.filterQ.slerp(r,1-this.kFilter),this.previousFilterQ.copy(this.filterQ)},t.accelToQuaternion_=function(e){var t=new On.Vector3;t.copy(e),t.normalize();var n=new On.Quaternion;return n.setFromUnitVectors(new On.Vector3(0,0,-1),t),n.inverse(),n},t.gyroToQuaternionDelta_=function(e,t){var n=new On.Quaternion,i=new On.Vector3;return i.copy(e),i.normalize(),n.setFromAxisAngle(i,e.length()*t),n},e}();zn.prototype.run_=function(){if(!this.isOrientationInitialized)return this.accelQ=this.accelToQuaternion_(this.currentAccelMeasurement.sample),this.previousFilterQ.copy(this.accelQ),void(this.isOrientationInitialized=!0);var e=this.currentGyroMeasurement.timestampS-this.previousGyroMeasurement.timestampS,t=this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample,e);this.gyroIntegralQ.multiply(t),this.filterQ.copy(this.previousFilterQ),this.filterQ.multiply(t);var n=new On.Quaternion;n.copy(this.filterQ),n.inverse(),this.estimatedGravity.set(0,0,-1),this.estimatedGravity.applyQuaternion(n),this.estimatedGravity.normalize(),this.measuredGravity.copy(this.currentAccelMeasurement.sample),this.measuredGravity.normalize();var i=new On.Quaternion;i.setFromUnitVectors(this.estimatedGravity,this.measuredGravity),i.inverse();var r=new On.Quaternion;r.copy(this.filterQ),r.multiply(i),this.filterQ.slerp(r,1-this.kFilter),this.previousFilterQ.copy(this.filterQ),this.isFilterQuaternionInitialized||(this.isFilterQuaternionInitialized=!0)},zn.prototype.getOrientation=function(){return this.isFilterQuaternionInitialized?this.filterQ:null};var Xn,Hn,qn=function(e){function t(){var t=e.call(this)||this;return t.deviceMotion=new Gn,t.accelerometer=new On.Vector3,t.gyroscope=new On.Vector3,t._onDeviceMotionChange=t._onDeviceMotionChange.bind(t),t._onScreenOrientationChange=t._onScreenOrientationChange.bind(t),t.filter=new zn(.98),t.posePredictor=new Wn(.04),t.filterToWorldQ=new On.Quaternion,t.isFirefoxAndroid=Un.isFirefoxAndroid(),t.isIOS=an||un,t.isChromeUsingDegrees=Mn>=66,t._isEnabled=!1,t.isIOS?t.filterToWorldQ.setFromAxisAngle(new On.Vector3(1,0,0),Math.PI/2):t.filterToWorldQ.setFromAxisAngle(new On.Vector3(1,0,0),-Math.PI/2),t.inverseWorldToScreenQ=new On.Quaternion,t.worldToScreenQ=new On.Quaternion,t.originalPoseAdjustQ=new On.Quaternion,t.originalPoseAdjustQ.setFromAxisAngle(new On.Vector3(0,0,1),-en.orientation*Math.PI/180),t._setScreenTransform(),Un.isLandscapeMode()&&t.filterToWorldQ.multiply(t.inverseWorldToScreenQ),t.resetQ=new On.Quaternion,t.deviceMotion.on("devicemotion",t._onDeviceMotionChange),t.enable(),t}Yt(t,e);var n=t.prototype;return n.enable=function(){this.isEnabled()||(this.deviceMotion.enable(),this._isEnabled=!0,en.addEventListener("orientationchange",this._onScreenOrientationChange))},n.disable=function(){this.isEnabled()&&(this.deviceMotion.disable(),this._isEnabled=!1,en.removeEventListener("orientationchange",this._onScreenOrientationChange))},n.isEnabled=function(){return this._isEnabled},n.destroy=function(){this.disable(),this.deviceMotion=null},n.getOrientation=function(){var e;if(this.deviceMotion.isWithoutDeviceMotion&&this._deviceOrientationQ){this.deviceOrientationFixQ=this.deviceOrientationFixQ||(new On.Quaternion).setFromAxisAngle(new On.Vector3(0,1,0),-this._alpha),e=this._deviceOrientationQ,(n=new On.Quaternion).copy(e),n.multiply(this.filterToWorldQ),n.multiply(this.resetQ),n.multiply(this.worldToScreenQ),n.multiplyQuaternions(this.deviceOrientationFixQ,n);var t=ht(n.x,n.y,n.z,n.w);return pt(t,t)}if(!(e=this.filter.getOrientation()))return null;var n=this._convertFusionToPredicted(e);return t=ht(n.x,n.y,n.z,n.w),pt(t,t)},n._triggerChange=function(){var e=this.getOrientation();e&&(this._prevOrientation?function(e,t){var n=e[0],i=e[1],r=e[2],o=e[3],s=t[0],a=t[1],u=t[2],l=t[3];return Math.abs(n-s)<=qe*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-a)<=qe*Math.max(1,Math.abs(i),Math.abs(a))&&Math.abs(r-u)<=qe*Math.max(1,Math.abs(r),Math.abs(u))&&Math.abs(o-l)<=qe*Math.max(1,Math.abs(o),Math.abs(l))}(this._prevOrientation,e)||this.trigger(new u("change",{quaternion:e})):this._prevOrientation=e)},n._convertFusionToPredicted=function(e){this.predictedQ=this.posePredictor.getPrediction(e,this.gyroscope,this.previousTimestampS);var t=new On.Quaternion;return t.copy(this.filterToWorldQ),t.multiply(this.resetQ),t.multiply(this.predictedQ),t.multiply(this.worldToScreenQ),t},n._onDeviceMotionChange=function(e){var t=e.inputEvent,n=t.deviceorientation,i=t,r=i.accelerationIncludingGravity,o=i.adjustedRotationRate||i.rotationRate,s=i.timeStamp/1e3;n?(this._alpha||(this._alpha=n.alpha),this._deviceOrientationQ=this._deviceOrientationQ||new On.Quaternion,this._deviceOrientationQ.setFromEulerYXZ(n.beta,n.alpha,n.gamma),this._triggerChange()):(this.isFirefoxAndroid&&(s/=1e3),this.accelerometer.set(-r.x,-r.y,-r.z),this.gyroscope.set(o.alpha,o.beta,o.gamma),(this.isIOS||this.isFirefoxAndroid||this.isChromeUsingDegrees)&&this.gyroscope.multiplyScalar(Math.PI/180),this.filter.addAccelMeasurement(this.accelerometer,s),this.filter.addGyroMeasurement(this.gyroscope,s),this._triggerChange(),this.previousTimestampS=s)},n._onScreenOrientationChange=function(){this._setScreenTransform()},n._setScreenTransform=function(){this.worldToScreenQ.set(0,0,0,1);var e=en.orientation;switch(e){case 0:break;case 90:case-90:case 180:this.worldToScreenQ.setFromAxisAngle(new On.Vector3(0,0,1),e/-180*Math.PI)}this.inverseWorldToScreenQ.copy(this.worldToScreenQ),this.inverseWorldToScreenQ.inverse()},t}(l),Yn=function(e,t){return mn.getRotationDelta(e,t,yn.PITCH_DELTA)},Zn=function(e){function t(t,n){void 0===n&&(n={});var i=e.call(this)||this;return i.element=t,i._prevQuaternion=null,i._quaternion=null,i.fusionPoseSensor=null,i.options=Zt({scale:1,threshold:0},n),i._onPoseChange=i._onPoseChange.bind(i),i}Yt(t,e);var n=t.prototype;return n.mapAxes=function(e){this.axes=e},n.connect=function(e){return this.observer||(this.observer=e,this.fusionPoseSensor=new qn,this.fusionPoseSensor.enable(),this._attachEvent()),this},n.disconnect=function(){return this.observer?(this._dettachEvent(),this.fusionPoseSensor.disable(),this.fusionPoseSensor.destroy(),this.fusionPoseSensor=null,this.observer=null,this):this},n.destroy=function(){this.disconnect(),this.element=null,this.options=null,this.axes=null,this._prevQuaternion=null,this._quaternion=null},n._onPoseChange=function(e){if(!this._prevQuaternion)return this._prevQuaternion=ct(e.quaternion),void(this._quaternion=ct(e.quaternion));var t,n,i,r;dt(this._prevQuaternion,this._quaternion),dt(this._quaternion,e.quaternion),this.observer.change(this,e,(t=this.axes,[(n=this._prevQuaternion,i=this._quaternion,r=mn.getRotationDelta(n,i,yn.YAW_DELTA_BY_YAW),mn.getRotationDelta(n,i,yn.YAW_DELTA_BY_ROLL)*Math.sin(mn.extractPitchFromQuat(i))+r),Yn(this._prevQuaternion,this._quaternion)].reduce((function(e,n,i){return t[i]&&(e[t[i]]=n),e}),{})))},n._attachEvent=function(){this.fusionPoseSensor.on("change",this._onPoseChange)},n._dettachEvent=function(){this.fusionPoseSensor.off("change",this._onPoseChange)},t}(l),Kn=null,$n=0,Jn=function(){function e(){if($n++,Kn)return Kn;Kn=this,this._onDeviceOrientation=this._onDeviceOrientation.bind(this),this._onOrientationChange=this._onOrientationChange.bind(this),this._spinR=0,this._screenOrientationAngle=0,en.addEventListener("deviceorientation",this._onDeviceOrientation),en.addEventListener("orientationchange",this._onOrientationChange)}var t=e.prototype;return t.getRadian=function(){return this._spinR+Ke(this._screenOrientationAngle)},t.unref=function(){--$n>0||(en.removeEventListener("deviceorientation",this._onDeviceOrientation),en.removeEventListener("orientationchange",this._onOrientationChange),this._spinR=0,this._screenOrientationAngle=0,Kn=null,$n=0)},t._onDeviceOrientation=function(e){if(null!==e.beta&&null!==e.gamma){var t=Ke(e.beta),n=Ke(e.gamma);this._spinR=Math.atan2(Math.cos(t)*Math.sin(n),Math.sin(t))}},t._onOrientationChange=function(){en.screen&&en.screen.orientation&&void 0!==en.screen.orientation.angle?this._screenOrientationAngle=screen.orientation.angle:void 0!==en.orientation&&(this._screenOrientationAngle=en.orientation>=0?en.orientation:360+en.orientation)},e}(),ei=function(e){function t(t,n){void 0===n&&(n={});var i=e.call(this,t,n)||this;return i._useRotation=!1,i._screenRotationAngle=null,i.setUseRotation(!(!n||!n.useRotation)),i._userDirection=He.DIRECTION_ALL,i}Yt(t,e);var n=t.prototype;return n.setUseRotation=function(e){this._useRotation=e,this._screenRotationAngle&&(this._screenRotationAngle.unref(),this._screenRotationAngle=null),this._useRotation&&(this._screenRotationAngle=new Jn)},n.connect=function(t){return this._userDirection=this._direction,this._useRotation&&this._direction&He.DIRECTION_ALL&&(this._direction=He.DIRECTION_HORIZONTAL),e.prototype.connect.call(this,t)},n.destroy=function(){this._useRotation&&this._screenRotationAngle&&this._screenRotationAngle.unref(),e.prototype.destroy.call(this)},n._getOffset=function(t,n){if(!1===this._useRotation)return e.prototype._getOffset.call(this,t,n);var i=e.prototype._getOffset.call(this,t,[!0,!0]),r=[0,0],o=this._screenRotationAngle.getRadian(),s=Math.cos(o),a=Math.sin(o);return r[0]=i[0]*s-i[1]*a,r[1]=i[1]*s+i[0]*a,this._userDirection&He.DIRECTION_HORIZONTAL?this._userDirection&He.DIRECTION_VERTICAL||(r[1]=0):r[0]=0,r},t}(Ge),ti=et(0,1,0),ni=function(e){function t(){var t=e.call(this)||this;return t._fusionPoseSensor=new qn,t._quaternion=lt(),t._fusionPoseSensor.enable(),t._fusionPoseSensor.on("change",(function(e){t._quaternion=e.quaternion,t.trigger(new u("change",{isTrusted:!0}))})),t}Yt(t,e);var n=t.prototype;return n.getCombinedQuaternion=function(e){var t=function(e,t,n){n*=.5;var i=Math.sin(n);return e[0]=i*t[0],e[1]=i*t[1],e[2]=i*t[2],e[3]=Math.cos(n),e}(lt(),ti,Ke(-e)),n=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}(lt(),this._quaternion);return function(e,t,n){var i=t[0],r=t[1],o=t[2],s=t[3],a=n[0],u=n[1],l=n[2],c=n[3];return e[0]=i*c+s*a+r*l-o*u,e[1]=r*c+s*u+o*a-i*l,e[2]=o*c+s*l+i*u-r*a,e[3]=s*c-i*a-r*u-o*l,e}(lt(),n,t)},n.destroy=function(){this.off(),this._fusionPoseSensor&&(this._fusionPoseSensor.off(),this._fusionPoseSensor.destroy(),this._fusionPoseSensor=null)},t}(l),ii=[-180,180],ri=[-90,90],oi=[-180,180],si=function(e){function t(t){var n=e.call(this)||this;n.options={};var i=Zt({element:null,yaw:0,pitch:0,fov:65,showPolePoint:!1,useZoom:!0,useKeyboard:!0,gyroMode:In.YAWPITCH,touchDirection:6,yawRange:ii,pitchRange:ri,fovRange:[30,110],aspectRatio:1},t);return n._element=i.element,n._initialFov=i.fov,n._enabled=!1,n._isAnimating=!1,n._deviceQuaternion=null,n._initAxes(i),n.option(i),n}Yt(t,e);var n=t.prototype;return n.updatePanScale=function(e){void 0===e&&(e={});var t=this._axes.get().fov,n=e.height||parseInt(window.getComputedStyle(this._element).height,10),i=Dn[0]*t/this._initialFov*320/n;return this._axesPanInput.options.scale=[i,i],this._axes.options.deceleration=Fn*t/110,this},n.option=function(e,t){if(!e)return this._getOptions();if(e&&"string"==typeof e&&void 0===t)return this._getOptions(e);var n={},i=[];if("string"==typeof e)i.push(e),n[e]=t;else{var r=e;i=Object.keys(r),n=Zt({},r)}return this._setOptions(this._getValidatedOptions(n)),this._applyOptions(i),this},n.enable=function(){return this._enabled||(this._enabled=!0,this._applyOptions(Object.keys(this.options)),this.updatePanScale()),this},n.disable=function(e){return void 0===e&&(e=!1),this._enabled?(e||this._resetOrientation(),this._axes.disconnect(),this._enabled=!1,this):this},n.lookAt=function(e,t){var n=e.yaw,i=e.pitch,r=e.fov,o=this._axes.get(),s=void 0===n?0:n-o.yaw,a=void 0===i?0:i-o.pitch,u=void 0===r?0:r-o.fov;this._axes.options.maximumDuration=1/0,this._axes.setBy({yaw:s,pitch:a,fov:u},t)},n.getYawPitch=function(){var e=this._axes.get();return{yaw:e.yaw,pitch:e.pitch}},n.getFov=function(){return this._axes.get().fov},n.getQuaternion=function(){var e=this._axes.get();return this._deviceQuaternion.getCombinedQuaternion(e.yaw)},n.shouldRenderWithQuaternion=function(){return this.options.gyroMode===In.VR},n.destroy=function(){this._axes&&this._axes.destroy(),this._axesPanInput&&this._axesPanInput.destroy(),this._axesWheelInput&&this._axesWheelInput.destroy(),this._axesTiltMotionInput&&this._axesTiltMotionInput.destroy(),this._axesPinchInput&&this._axesPinchInput.destroy(),this._axesMoveKeyInput&&this._axesMoveKeyInput.destroy(),this._deviceQuaternion&&this._deviceQuaternion.destroy()},n._initAxes=function(e){var t=this,n=this._updateYawRange(e.yawRange,e.fov,e.aspectRatio),i=this._updatePitchRange(e.pitchRange,e.fov,e.showPolePoint),r=e.gyroMode===In.VR;this._axesPanInput=new ei(this._element,{useRotation:r}),this._axesWheelInput=new ze(this._element,{scale:-4}),this._axesTiltMotionInput=null,this._axesPinchInput=cn?new je(this._element,{scale:-1}):null,this._axesMoveKeyInput=new Xe(this._element,{scale:[-6,6]}),this._axes=new He({yaw:{range:n,circular:this._isCircular(n),bounce:[0,0]},pitch:{range:i,circular:this._isCircular(i),bounce:[0,0]},fov:{range:e.fovRange,circular:[!1,!1],bounce:[0,0]}},{deceleration:Fn,maximumDuration:1e3},{yaw:e.yaw,pitch:e.pitch,fov:e.fov}).on({hold:function(e){t._axes.options.maximumDuration=1e3,t.trigger(new u("hold",{isTrusted:e.isTrusted}))},change:function(e){0!==e.delta.fov&&(t._updateControlScale(e),t.updatePanScale()),t._triggerChange(e)},release:function(e){t._triggerChange(e)},animationEnd:function(e){t.trigger(new u("animationEnd",{isTrusted:e.isTrusted}))}})},n._getValidatedOptions=function(e){return e.yawRange&&(e.yawRange=this._getValidYawRange(e.yawRange,e.fov,e.aspectRatio)),e.pitchRange&&(e.pitchRange=this._getValidPitchRange(e.pitchRange,e.fov)),e},n._getOptions=function(e){var t;return"string"==typeof e?t=this.options[e]:0===arguments.length&&(t=this.options),t},n._setOptions=function(e){for(var t in e)this.options[t]=e[t]},n._applyOptions=function(e){var t=this.options,n=this._axes,i=t.gyroMode===In.VR,r=t.gyroMode===In.YAWPITCH,o=i?2&t.touchDirection:t.touchDirection;if(e.some((function(e){return"showPolePoint"===e||"fov"===e||"aspectRatio"===e||"yawRange"===e||"pitchRange"===e}))&&(e.indexOf("fov")>=0&&(n.setTo({fov:t.fov}),this.updatePanScale()),this._updateControlScale()),e.some((function(e){return"fovRange"===e}))){var s=t.fovRange,a=n.get().fov,u=n.get().fov;At(n.axis.fov.range,s),us[1]&&(u=s[1]),a!==u&&(n.setTo({fov:u},0),this._updateControlScale(),this.updatePanScale())}if(e.some((function(e){return"gyroMode"===e}))&&hn&&(this._axesTiltMotionInput&&(this._axes.disconnect(this._axesTiltMotionInput),this._axesTiltMotionInput.destroy(),this._axesTiltMotionInput=null),this._deviceQuaternion&&(this._deviceQuaternion.destroy(),this._deviceQuaternion=null),i?this._initDeviceQuaternion():r&&(this._axesTiltMotionInput=new Zn(this._element),this._axes.connect(["yaw","pitch"],this._axesTiltMotionInput)),this._axesPanInput.setUseRotation(i)),e.some((function(e){return"useKeyboard"===e}))&&(t.useKeyboard?n.connect(["yaw","pitch"],this._axesMoveKeyInput):n.disconnect(this._axesMoveKeyInput)),e.some((function(e){return"useZoom"===e}))){var l=t.useZoom;n.disconnect(this._axesWheelInput),l&&n.connect(["fov"],this._axesWheelInput)}this._togglePinchInputByOption(t.touchDirection,t.useZoom),e.some((function(e){return"touchDirection"===e}))&&this._enabled&&this._enableTouch(o)},n._togglePinchInputByOption=function(e,t){this._axesPinchInput&&(this._axes.disconnect(this._axesPinchInput),t&&6===e&&-1===this._axes._inputs.indexOf(this._axesPinchInput)&&this._axes.connect(["fov"],this._axesPinchInput))},n._enableTouch=function(e){this._axesPanInput&&this._axes.disconnect(this._axesPanInput);var t=2&e?"yaw":null,n=4&e?"pitch":null;this._axes.connect([t,n],this._axesPanInput)},n._initDeviceQuaternion=function(){var e=this;this._deviceQuaternion=new ni,this._deviceQuaternion.on("change",(function(t){e._triggerChange(t)}))},n._getValidYawRange=function(e,t,n){var i=this._adjustAspectRatio(n||this.options.aspectRatio||1),r=(t||this._axes.get().fov)*i;return e[1]-e[0]>=r?e:this.options.yawRange||ii},n._getValidPitchRange=function(e,t){var n=t||this._axes.get().fov;return e[1]-e[0]>=n?e:this.options.pitchRange||ri},n._isCircular=function(e){return e[1]-e[0]<360?[!1,!1]:[!0,!0]},n._updateControlScale=function(e){var t=this.options,n=this._axes.get().fov,i=this._updatePitchRange(t.pitchRange,n,t.showPolePoint),r=this._updateYawRange(t.yawRange,n,t.aspectRatio),o=this._axes.get(),s=o.yaw,a=o.pitch;return At(this._axes.axis.yaw.range,r),At(this._axes.axis.pitch.range,i),this._axes.axis.yaw.circular=this._isCircular(r),this._axes.axis.pitch.circular=this._isCircular(i),sr[1]&&(s=r[1]),ai[1]&&(a=i[1]),e&&e.set({yaw:s,pitch:a}),this._axes.setTo({yaw:s,pitch:a},0),this},n._updatePitchRange=function(e,t,n){if(this.options.gyroMode===In.VR)return oi;var i=e[1]-e[0],r=t/2;return!n||i<180?[e[0]+r,e[1]-r]:e.concat()},n._updateYawRange=function(e,t,n){if(this.options.gyroMode===In.VR)return ii;if(e[1]-e[0]>=360)return e.concat();var i=mn.toDegree(Math.atan2(n,1/Math.tan(Ke(t/2))));return[e[0]+i,e[1]-i]},n._triggerChange=function(e){var t=this._axes.get(),n=this.options,i={targetElement:n.element,isTrusted:e.isTrusted,yaw:t.yaw,pitch:t.pitch,fov:t.fov,quaternion:null};n.gyroMode===In.VR&&this._deviceQuaternion&&(i.quaternion=this._deviceQuaternion.getCombinedQuaternion(t.yaw)),this.trigger(new u("change",i))},n._adjustAspectRatio=function(e){for(var t=[.52,.54,.563,.57,.584,.59,.609,.67,.702,.72,.76,.78,.82,.92,.97,1,1.07,1.14,1.19,1.25,1.32,1.38,1.4,1.43,1.53,1.62,1.76,1.77,1.86,1.96,2.26,2.3,2.6,3,5,6],n=[.51,.54,.606,.56,.628,.63,.647,.71,.736,.757,.78,.77,.8,.89,.975,1,1.07,1.1,1.15,1.18,1.22,1.27,1.3,1.33,1.39,1.45,1.54,1.55,1.58,1.62,1.72,1.82,1.92,2,2.24,2.3],i=-1,r=0;r=e){i=r;break}if(-1===i)return t[0]>e?n[0]:n[n[0].length-1];var o=t[i],s=t[i+1],a=n[i],u=n[i+1];return this._lerp(a,u,(e-o)/(s-o))},n._lerp=function(e,t,n){return e+n*(t-e)},n._resetOrientation=function(){var e=this.options;return this._axes.setTo({yaw:e.yaw,pitch:e.pitch,fov:e.fov},0),this},t.VERSION=Ht,t.CONTROL_MODE_VR=1,t.CONTROL_MODE_YAWPITCH=2,t.TOUCH_DIRECTION_ALL=6,t.TOUCH_DIRECTION_YAW=2,t.TOUCH_DIRECTION_PITCH=4,t.TOUCH_DIRECTION_NONE=1,t}(l),ai={INVALID_DEVICE:10,NO_WEBGL:11,FAIL_IMAGE_LOAD:12,FAIL_BIND_TEXTURE:13,INVALID_RESOURCE:14,RENDERING_CONTEXT_LOST:15},ui={READY:"ready",VIEW_CHANGE:"viewChange",ANIMATION_END:"animationEnd",ERROR:"error"},li={EQUIRECTANGULAR:"equirectangular",CUBEMAP:"cubemap",CUBESTRIP:"cubestrip",PANORAMA:"panorama",STEREOSCOPIC_EQUI:"stereoequi"},ci={TOP_BOTTOM:"3dv",LEFT_RIGHT:"3dh",NONE:""},hi={image:!0,video:!0,projectionType:!0,cubemapConfig:!0,stereoFormat:!0,width:!0,height:!0,yaw:!0,pitch:!0,fov:!0,showPolePoint:!0,useZoom:!0,useKeyboard:!0,gyroMode:!0,yawRange:!0,pitchRange:!0,fovRange:!0,touchDirection:!0,canvasClass:!0},di="view360-canvas",pi=function(e,t){var n,i;if("object"==typeof t?(n=t.src,i=t.type):"string"==typeof t&&(n=t),!n)return!1;var r=document.createElement("source");r.src=n,i&&(r.type=i),e.appendChild(r)},fi={0:"NO_ERROR",1280:"INVALID_ENUM",1281:"INVALID_VALUE",1282:"INVALID_OPERATION",1285:"OUT_OF_MEMORY",1286:"INVALID_FRAMEBUFFER_OPERATION",37442:"CONTEXT_LOST_WEBGL"},Ai=null,gi=function(){function e(){}return e.createShader=function(e,t,n){var i=e.createShader(t);return e.shaderSource(i,n),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS)?i:(console.error(e.getShaderInfoLog(i)),null)},e.createProgram=function(e,t,n){var i=e.createProgram();return e.attachShader(i,t),e.attachShader(i,n),e.linkProgram(i),e.deleteShader(t),e.deleteShader(n),e.getProgramParameter(i,e.LINK_STATUS)?i:(e.deleteProgram(i),null)},e.initBuffer=function(e,t,n,i,r){var o=e.createBuffer();return e.bindBuffer(t,o),e.bufferData(t,n,e.STATIC_DRAW),o&&(o.itemSize=i,o.numItems=n.length/i),void 0!==r&&(e.enableVertexAttribArray(r),e.vertexAttribPointer(r,o.itemSize,e.FLOAT,!1,0,0)),o},e.getWebglContext=function(e,t){var n,i,r=null,o=Zt({preserveDrawingBuffer:!1,antialias:!1},t),s=function(e){return e.statusMessage};e.addEventListener("webglcontextcreationerror",s);try{for(var a=Kt(["webgl","experimental-webgl","webkit-3d","moz-webgl"]),u=a.next();!u.done;u=a.next()){var l=u.value;try{r=e.getContext(l,o)}catch(e){}if(r)break}}catch(e){n={error:e}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return e.removeEventListener("webglcontextcreationerror",s),r},e.createTexture=function(e,t){var n=e.createTexture();return e.bindTexture(t,n),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(t,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(t,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(t,null),n},e.isWebGLAvailable=function(){if(null===Ai){var t=document.createElement("canvas"),n=e.getWebglContext(t);if(Ai=!!n,n){var i=n.getExtension("WEBGL_lose_context");i&&i.loseContext()}}return!!Ai},e.isStableWebGL=function(){var e=L(),t=!0;if("android"===e.os.name){var n=parseFloat(e.os.version);(n<=4.3&&n>=1||4.4===n&&"chrome"!==e.browser.name)&&(t=!1)}return t},e.getErrorNameFromWebGLErrorCode=function(e){return e in fi?fi[e]:"UNKNOWN_ERROR"},e.texImage2D=function(e,t,n){try{e.texImage2D(t,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n)}catch(e){console.log("error",e.message),console.error("WebGLUtils.texImage2D error:",e)}},e.getMaxTextureSize=function(e){return e.getParameter(e.MAX_TEXTURE_SIZE)},e}(),vi=L(),mi="ie"===vi.browser.name&&11===vi.browser.majorVersion,yi={ERROR:"error"},_i=function(e){function t(){var t=e.call(this)||this;return t._forceDimension=null,t._pixelCanvas=null,t._pixelContext=null,t}Yt(t,e);var n=t.prototype;return n.render=function(e){var t=e.gl,n=e.shaderProgram,i=e.indexBuffer,r=e.mvMatrix,o=e.pMatrix;t.uniformMatrix4fv(n.pMatrixUniform,!1,o),t.uniformMatrix4fv(n.mvMatrixUniform,!1,r),i&&t.drawElements(t.TRIANGLES,i.numItems,t.UNSIGNED_SHORT,0)},n.getDimension=function(e){return{width:e.naturalWidth||e.videoWidth,height:e.naturalHeight||e.videoHeight}},n.updateShaderData=function(e){},n._initPixelSource=function(e,t){if(void 0===t&&(t=null),mi&&e instanceof HTMLVideoElement||t){var n=t||this.getDimension(e),i=n.width,r=n.height;this._pixelCanvas=document.createElement("canvas"),this._pixelCanvas.width=i,this._pixelCanvas.height=r,this._pixelContext=this._pixelCanvas.getContext("2d")}this._forceDimension=t},n._getPixelSource=function(e){if(!this._pixelCanvas)return e;var t=this.getDimension(e),n=this._forceDimension||t;return this._pixelCanvas.width!==n.width&&(this._pixelCanvas.width=n.width),this._pixelCanvas.height!==n.height&&(this._pixelCanvas.height=n.height),this._forceDimension?this._pixelContext.drawImage(e,0,0,t.width,t.height,0,0,n.width,n.height):this._pixelContext.drawImage(e,0,0),this._pixelCanvas},n._extractTileConfig=function(e){var t=Array.isArray(e.tileConfig)?e.tileConfig:Array.apply(void 0,Jt(Array(6))).map((function(){return e.tileConfig}));return t.map((function(e){return Zt({flipHorizontal:!1,rotation:0},e)}))},n._triggerError=function(e){console.error("Renderer Error:",e),this.trigger(new u(yi.ERROR,{message:"string"==typeof e?e:e.message}))},t.EVENTS=yi,t}(l),wi=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}Yt(t,e);var n=t.prototype;return t.extractOrder=function(e){return e.order||"RLUDBF"},n.getVertexPositionData=function(){return t._VERTEX_POSITION_DATA=null!==t._VERTEX_POSITION_DATA?t._VERTEX_POSITION_DATA:[1,-1,1,-1,-1,1,-1,1,1,1,1,1,-1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1,-1,1,-1,1,1,-1,1,1,1,-1,1,1,1,-1,-1,-1,-1,-1,-1,-1,1,1,-1,1,1,-1,-1,1,-1,1,1,1,1,1,1,-1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1],t._VERTEX_POSITION_DATA},n.getIndexData=function(){if(t._INDEX_DATA)return t._INDEX_DATA;for(var e=[],n=this.getVertexPositionData(),i=0;i0||!e.flipHorizontal&&n<0?i.push(i.shift()):i.unshift(i.pop());for(var o=s.slice(12*t,12*t+12),a=[],u=0;u<4;u++)a[i[u]]=o.splice(0,3);return a})).map((function(e){return n._shrinkCoord({image:i,faceCoords:e,trim:u})})).reduce((function(e,t){return Jt(e,t.reduce((function(e,t){return Jt(e,t)}),[]))}),[])},n.getVertexShaderSource=function(){return"\nattribute vec3 aVertexPosition;\nattribute vec3 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec3 vVertexDirectionVector;\nvoid main(void) {\n vVertexDirectionVector = aTextureCoord;\n gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}"},n.getFragmentShaderSource=function(){return"\nprecision highp float;\nuniform samplerCube uSampler;\nvarying highp vec3 vVertexDirectionVector;\nvoid main(void) {\n gl_FragColor = textureCube(uSampler, vVertexDirectionVector);\n}"},n.updateTexture=function(e,n,i){var r="RLUDBF",o=t.extractOrder(i),s={};o.split("").forEach((function(e,t){s[e]=t}));try{if(n instanceof Array)for(var a=0;a<6;a++){var u=s[r[a]];gi.texImage2D(e,e.TEXTURE_CUBE_MAP_POSITIVE_X+a,n[u])}else{var l=this.getMaxCubeMapTextureSize(e,n);for(a=0;a<6;a++){u=s[r[a]];var c=this.extractTileFromImage(n,u,l);gi.texImage2D(e,e.TEXTURE_CUBE_MAP_POSITIVE_X+a,c)}}}catch(e){this._triggerError(e)}},n.bindTexture=function(e,t,n,i){e.bindTexture(e.TEXTURE_CUBE_MAP,t),this.updateTexture(e,n,i)},n.getSourceTileSize=function(e){var t=this.getDimension(e),n=t.width,i=t.height,r=n/i;return r===1/6?n:6===r?i:r===2/3?n/2:n/3},n.extractTileFromImage=function(e,t,n){var i=this.getDimension(e).width,r=this.getSourceTileSize(e),o=document.createElement("canvas");o.width=n,o.height=n;var s=o.getContext("2d"),a=i/r,u=r*t%(r*a),l=Math.floor(t/a)*r;return s.drawImage(e,u,l,r,r,0,0,n,n),o},n.getMaxCubeMapTextureSize=function(e,t){var n=L(),i=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),r=this.getSourceTileSize(t);if("ie"===n.browser.name&&11===n.browser.majorVersion&&!mn.isPowerOfTwo(r))for(var o=1;o= TEXTURE_DIVISION_X[2]) {\n orgTextureRangeX = vec2(TEXTURE_DIVISION_X[2], TEXTURE_DIVISION_X[3]);\n } else if (vTextureCoord.s >= TEXTURE_DIVISION_X[1]) {\n orgTextureRangeX = vec2(TEXTURE_DIVISION_X[1], TEXTURE_DIVISION_X[2]);\n } else {\n orgTextureRangeX = vec2(TEXTURE_DIVISION_X[0], TEXTURE_DIVISION_X[1]);\n }\n\n if (vTextureCoord.t >= TEXTURE_DIVISION_Y[1]) {\n orgTextureRangeY = vec2(TEXTURE_DIVISION_Y[1], TEXTURE_DIVISION_Y[2]);\n } else {\n orgTextureRangeY = vec2(TEXTURE_DIVISION_Y[0], TEXTURE_DIVISION_Y[1]);\n }\n\n // scaling coors by the coordinates following the range from -1.0 to 1.0.\n float px = scale(orgTextureRangeX, OPERATE_COORDS_RANGE, vTextureCoord.s);\n float py = scale(orgTextureRangeY, OPERATE_COORDS_RANGE, vTextureCoord.t);\n\n float qu = EAC_CONST * atan(px) + 0.5;\n float qv = EAC_CONST * atan(py) + 0.5;\n\n // re-scaling coors by original coordinates ranges\n transformedCoordX = scale(TEXTURE_COORDS_RANGE, orgTextureRangeX, qu);\n transformedCoordY = scale(TEXTURE_COORDS_RANGE, orgTextureRangeY, qv);\n } else {\n // normal cubemap\n transformedCoordX = vTextureCoord.s;\n transformedCoordY = vTextureCoord.t;\n }\n\n gl_FragColor = texture2D(uSampler, vec2(transformedCoordX, transformedCoordY));\n}"},n.getVertexPositionData=function(){return this._vertices||(this._vertices=[1,-1,1,-1,-1,1,-1,1,1,1,1,1,-1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1,-1,1,-1,1,1,-1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,-1,-1,-1,-1,-1,1,-1,-1,1,-1,1,1,1,1,1,1,-1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,1]),this._vertices},n.getIndexData=function(){var e=this;return function(){for(var t=[],n=0;n=0;u--)for(var l=0;l<3;l++){var c=[l/3,u/2,(l+1)/3,u/2,(l+1)/3,(u+1)/2,l/3,(u+1)/2];a.push(c)}var h=this._extractTileConfig(i);return a=a.map((function(e){return t._shrinkCoord(e,r,o)})).map((function(e,n){return t._transformCoord(e,h[n])})),"BFUDRL".split("").map((function(e){return s.indexOf(e)})).map((function(e){return a[e]})).reduce((function(e,t){return e.concat(t)}),[])},n.updateTexture=function(e,t){gi.texImage2D(e,e.TEXTURE_2D,this._getPixelSource(t))},n.bindTexture=function(e,t,n){var i=this.getDimension(n),r=i.width,o=i.height,s=Math.max(r,o),a=gi.getMaxTextureSize(e);s>a?this._triggerError("Image width("+r+") exceeds device limit("+a+"))"):(this._initPixelSource(n),e.activeTexture(e.TEXTURE0),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!0),e.bindTexture(e.TEXTURE_2D,t),this.updateTexture(e,n))},n._transformCoord=function(e,t){var n=e.slice();return t.flipHorizontal&&(n=this._flipHorizontalCoord(n)),t.rotation&&(n=this._rotateCoord(n,t.rotation)),n},n._shrinkCoord=function(e,t,n){var i=t.width,r=n*(1/t.height),o=n*(1/i);return[e[0]+o,e[1]+r,e[2]-o,e[3]+r,e[4]-o,e[5]-r,e[6]+o,e[7]-r]},n._rotateCoord=function(e,t){var n,i=Math.floor(t/90)%4;if(0===i)return e;var r=[];return i>0?(n=e.splice(0,2*i),r=e.concat(n)):r=(n=e.splice(2*(4+i),2*-i)).concat(e),r},n._flipHorizontalCoord=function(e){return[e[2],e[3],e[0],e[1],e[6],e[7],e[4],e[5]]},t}(_i),xi=-.5*Math.PI,Ei=[],Ti=[],Si=[];for(Xn=0;Xn<=60;Xn++){var Ri=(Xn/60-.5)*Math.PI,Mi=Math.sin(Ri),Ci=Math.cos(Ri);for(Hn=0;Hn<=60;Hn++){var Pi=2*(Hn/60-.5)*Math.PI+xi,Fi=Math.sin(Pi),Di=Math.cos(Pi)*Ci,Ii=Mi,Oi=Fi*Ci,Bi=Hn/60,Li=Xn/60;if(Ei.push(Bi,Li),Ti.push(2*Di,2*Ii,2*Oi),60!==Hn&&60!==Xn){var Vi=61*Xn+Hn,ki=Vi+60+1;Si.push(Vi,ki,Vi+1,ki,ki+1,Vi+1)}}}var Ni=function(e){function t(t){var n=e.call(this)||this;return n._stereoFormat=t,n}Yt(t,e);var n=t.prototype;return n.render=function(t){var n,i,r=t.gl,o=t.shaderProgram;switch(this._stereoFormat){case ci.TOP_BOTTOM:n=[1,.5,0,0],i=[1,.5,0,.5];break;case ci.LEFT_RIGHT:n=[.5,1,0,0],i=[.5,1,.5,0];break;default:n=[1,1,0,0],i=[1,1,0,0]}var s=r.getUniformLocation(o,"uTexScaleOffset");r.uniform4fv(s,Jt(n,i)),e.prototype.render.call(this,t)},n.getVertexPositionData=function(){return t._VERTEX_POSITION_DATA},n.getIndexData=function(){return t._INDEX_DATA},n.getTextureCoordData=function(){return t._TEXTURE_COORD_DATA},n.getVertexShaderSource=function(){return"\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nuniform float uEye;\nuniform vec4 uTexScaleOffset[2];\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n vec4 scaleOffset = uTexScaleOffset[int(uEye)];\n vTextureCoord = aTextureCoord.xy * scaleOffset.xy + scaleOffset.zw;\n gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}"},n.getFragmentShaderSource=function(){return"\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nvoid main(void) {\n gl_FragColor = texture2D(uSampler, vTextureCoord.st);\n}"},n.updateTexture=function(e,t){gi.texImage2D(e,e.TEXTURE_2D,this._getPixelSource(t))},n.bindTexture=function(e,t,n){var i=this.getDimension(n),r=i.width,o=i.height,s=Math.max(r,o),a=gi.getMaxTextureSize(e);s>a?this._triggerError("Image width("+r+") exceeds device limit("+a+"))"):(this._initPixelSource(n),e.activeTexture(e.TEXTURE0),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!0),e.bindTexture(e.TEXTURE_2D,t),this.updateTexture(e,n))},t._VERTEX_POSITION_DATA=Ti,t._TEXTURE_COORD_DATA=Ei,t._INDEX_DATA=Si,t}(_i),Qi=60,Ui=[],Wi=[],Gi=[],ji=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}Yt(t,e);var n=t.prototype;return n.getVertexPositionData=function(){return t._VERTEX_POSITION_DATA},n.getIndexData=function(){return t._INDEX_DATA},n.getTextureCoordData=function(){return t._TEXTURE_COORD_DATA},n.getVertexShaderSource=function(){return"\nattribute vec3 aVertexPosition;\nattribute vec2 aTextureCoord;\nuniform mat4 uMVMatrix;\nuniform mat4 uPMatrix;\nvarying highp vec2 vTextureCoord;\nvoid main(void) {\n vTextureCoord = aTextureCoord;\n gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);\n}"},n.getFragmentShaderSource=function(){return"\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nvoid main(void) {\n gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));\n}"},n.updateTexture=function(e,t){gi.texImage2D(e,e.TEXTURE_2D,this._getPixelSource(t))},n.bindTexture=function(e,t,n){var i,r=this.getDimension(n),o=r.width,s=r.height,a=Math.max(o,s),u=gi.getMaxTextureSize(e);a>u&&(this._triggerError("Image width("+o+") exceeds device texture limit("+u+"))"),i=o>s?{width:u,height:u*s/o}:{width:u*o/s,height:u}),this._initPixelSource(n,i),e.activeTexture(e.TEXTURE0),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!0),e.bindTexture(e.TEXTURE_2D,t),this.updateTexture(e,n)},n.updateShaderData=function(e){var t,n,i,r,o,s=e.imageAspectRatio,a=void 0===s?6:s;if(a<1?(r=!0,o=1/a):(r=!1,o=a),o>=6){var u=360/o;n=2*Math.PI,i=Math.tan(Ke(u/2))}else n=o,i=.5;Ui.length=0,Wi.length=0,Gi.length=0;for(var l=[-i,i],c=Math.PI/2+(2*Math.PI-n)/2,h=0,d=l.length;h0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]=0&&(clearTimeout(e._rafTimer),e._rafTimer=-1),r<16?e._rafId=e._context.requestAnimationFrame(e._onLoop):e._rafTimer=window.setTimeout(e._onLoop,0)},this._callback=null,this._context=window,this._rafId=-1,this._rafTimer=-1}var t=e.prototype;return t.setCallback=function(e){this._callback=e},t.setContext=function(e){this._context=e},t.start=function(){var e=this._context,t=this._callback;e&&t&&(this._rafId>=0||this._rafTimer>=0||(this._rafId=un?e.requestAnimationFrame(this._onLoopNextTick):e.requestAnimationFrame(this._onLoop)))},t.stop=function(){this._rafId>=0&&this._context.cancelAnimationFrame(this._rafId),this._rafTimer>=0&&clearTimeout(this._rafTimer),this._rafId=-1,this._rafTimer=-1},e}(),$i=li,Ji=pn||1;Ji>2&&(Ji=2);var er={BIND_TEXTURE:"bindTexture",IMAGE_LOADED:"imageLoaded",ERROR:"error",RENDERING_CONTEXT_LOST:"renderingContextLost",RENDERING_CONTEXT_RESTORE:"renderingContextRestore"},tr={INVALID_DEVICE:10,NO_WEBGL:11,FAIL_IMAGE_LOAD:12,RENDERER_ERROR:13},nr=function(e){function t(t,n,i,r,o,s,a,u){var l=e.call(this)||this;return l.textureCoordBuffer=null,l.vertexBuffer=null,l.indexBuffer=null,l.exitVR=function(){var e=l._vr,t=l.context,n=l._animator;e&&(e.removeEndCallback(l.exitVR),e.destroy(),l._vr=null,an&&l._restoreStyle(),l.updateViewportDimensions(l.width,l.height),l._updateViewport(),t.bindFramebuffer(t.FRAMEBUFFER,null),l._bindBuffers(),l._shouldForceDraw=!0,n.stop(),n.setContext(window),n.setCallback(l._render.bind(l)),n.start())},l._renderStereo=function(e,t){var n,i,r=l._vr,o=l.context,s=r.getEyeParams(o,t);if(s){r.beforeRender(o,t);try{for(var a=Kt([0,1]),u=a.next();!u.done;u=a.next()){var c=u.value,h=s[c];l.mvMatrix=h.mvMatrix,l.pMatrix=h.pMatrix,o.viewport.apply(o,Jt(h.viewport)),o.uniform1f(l.shaderProgram.uEye,c),l._bindBuffers(),l._draw()}}catch(e){n={error:e}}finally{try{u&&!u.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}r.afterRender()}},l._onFirstVRFrame=function(e,t){var n=l._vr,i=l.context,r=l._animator;if(n.canRender(t)){var o=et(0,0,-1),s=n.getEyeParams(i,t)[0],a=at(st(),s.mvMatrix),u=at(st(),s.pMatrix),c=ut(st(),a),h=ut(st(),u),d=it($e(),o,h);it(d,d,c);var p=mn.yawOffsetBetween(d,et(0,0,1));0!==p&&(n.setYawOffset(p),r.setCallback(l._renderStereo))}},l.sphericalConfig=a,l.fieldOfView=a.fieldOfView,l.width=n,l.height=i,l._lastQuaternion=null,l._lastYaw=null,l._lastPitch=null,l._lastFieldOfView=null,l.pMatrix=vt(),l.mvMatrix=vt(),_t(l.pMatrix,Ke(l.fieldOfView),n/i,.1,100),l.textureCoordBuffer=null,l.vertexBuffer=null,l.indexBuffer=null,l.canvas=l._initCanvas(o,s,n,i),l._setDefaultCanvasStyle(),l._wrapper=null,l._wrapperOrigStyle=null,l._renderingContextAttributes=u,l._image=null,l._imageConfig=null,l._imageIsReady=!1,l._shouldForceDraw=!1,l._keepUpdate=!1,l._onContentLoad=l._onContentLoad.bind(l),l._onContentError=l._onContentError.bind(l),l._animator=new Ki,l._vr=null,t&&l.setImage({image:t,imageType:a.imageType,isVideo:r,cubemapConfig:a.cubemapConfig}),l}Yt(t,e);var n=t.prototype;return n.setYawPitchControl=function(e){this._yawPitchControl=e},n.getContent=function(){return this._image},n.setImage=function(e){var t=e.image,n=e.imageType,i=e.isVideo,r=void 0!==i&&i,o=e.cubemapConfig;this._imageIsReady=!1,this._isVideo=r,this._imageConfig=Zt({order:n===$i.CUBEMAP?"RLUDBF":"RLUDFB",tileConfig:{flipHorizontal:!1,rotation:0},trim:0},o),this._setImageType(n),this._contentLoader&&this._contentLoader.destroy(),this._contentLoader=(new Xt).on("ready",this._onContentLoad).on("error",this._onContentError),r?(this._image=function(e){if(e instanceof HTMLVideoElement)return e;var t=document.createElement("video");return t.setAttribute("crossorigin","anonymous"),t.setAttribute("webkit-playsinline",""),t.setAttribute("playsinline",""),e instanceof Array?e.forEach((function(e){return pi(t,e)})):pi(t,e),t.querySelectorAll("source").length>0&&t.readyState<1&&t.load(),t}(t),this._contentLoader.check([this._image]),this._keepUpdate=!0):(this._image=function(e){var t=(e instanceof Array?e:[e]).map((function(e){var t=e;return"string"==typeof e&&((t=new Image).crossOrigin="anonymous",t.src=e),t}));return 1===t.length?t[0]:t}(t),this._contentLoader.check(Array.isArray(this._image)?this._image:[this._image]),this._keepUpdate=!1)},n.isImageLoaded=function(){return!!this._image&&this._imageIsReady&&(!this._isVideo||this._image.readyState>=2)},n.bindTexture=function(){var e=this;return new w((function(t,n){var i=e._contentLoader;return e._image?i?void(i.isReady()?(e._bindTexture(),t()):(i.check(Array.isArray(e._image)?e._image:[e._image]),i.once("ready",(function(i){i.errorCount>0?n("Failed to load images."):(e._bindTexture(),t())})))):n("ImageLoader is not initialized"):n("Image is not defined")}))},n.attachTo=function(e){this._hasExternalCanvas||(this.detach(),e.appendChild(this.canvas)),this._wrapper=e},n.forceContextLoss=function(){if(this.hasRenderingContext()){var e=this.context.getExtension("WEBGL_lose_context");e&&e.loseContext()}},n.detach=function(){!this._hasExternalCanvas&&this.canvas.parentElement&&this.canvas.parentElement.removeChild(this.canvas)},n.destroy=function(){this._contentLoader&&this._contentLoader.destroy(),this._animator.stop(),this.detach(),this.forceContextLoss(),this.off(),this.canvas.removeEventListener("webglcontextlost",this._onWebglcontextlost),this.canvas.removeEventListener("webglcontextrestored",this._onWebglcontextrestored)},n.hasRenderingContext=function(){var e=this.context;return!(!e||e.isContextLost()||!e.getProgramParameter(this.shaderProgram,e.LINK_STATUS))},n.updateFieldOfView=function(e){this.fieldOfView=e,this._updateViewport()},n.updateViewportDimensions=function(e,t){var n=!1;this.width=e,this.height=t;var i=e*Ji,r=t*Ji;i!==this.canvas.width&&(this.canvas.width=i,n=!0),r!==this.canvas.height&&(this.canvas.height=r,n=!0),n&&(this._updateViewport(),this._shouldForceDraw=!0)},n.keepUpdate=function(e){e&&!1===this.isImageLoaded()&&(this._shouldForceDraw=!0),this._keepUpdate=e},n.startRender=function(){this._animator.setCallback(this._render.bind(this)),this._animator.start()},n.stopRender=function(){this._animator.stop()},n.renderWithQuaternion=function(e,t){this.isImageLoaded()&&(!1===this._keepUpdate&&this._lastQuaternion&&function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}(this._lastQuaternion,e)&&this.fieldOfView&&this.fieldOfView===t&&!1===this._shouldForceDraw||(void 0!==t&&t!==this.fieldOfView&&this.updateFieldOfView(t),this.mvMatrix=function(e,t){var n=t[0],i=t[1],r=t[2],o=t[3],s=n+n,a=i+i,u=r+r,l=n*s,c=i*s,h=i*a,d=r*s,p=r*a,f=r*u,A=o*s,g=o*a,v=o*u;return e[0]=1-h-f,e[1]=c+v,e[2]=d-g,e[3]=0,e[4]=c-v,e[5]=1-l-f,e[6]=p+A,e[7]=0,e[8]=d+g,e[9]=p-A,e[10]=1-l-h,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}(vt(),e),this._draw(),this._lastQuaternion=ct(e),this._shouldForceDraw&&(this._shouldForceDraw=!1)))},n.renderWithYawPitch=function(e,t,n){this.isImageLoaded()&&(!1===this._keepUpdate&&null!==this._lastYaw&&this._lastYaw===e&&null!==this._lastPitch&&this._lastPitch===t&&this.fieldOfView&&this.fieldOfView===n&&!1===this._shouldForceDraw||(void 0!==n&&n!==this.fieldOfView&&this.updateFieldOfView(n),function(e){e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1}(this.mvMatrix),mt(this.mvMatrix,this.mvMatrix,-Ke(t)),yt(this.mvMatrix,this.mvMatrix,-Ke(e)),this._draw(),this._lastYaw=e,this._lastPitch=t,this._shouldForceDraw&&(this._shouldForceDraw=!1)))},n.getProjectionRenderer=function(){return this._renderer},n.enterVR=function(e){var t=this._vr;return gn||navigator.getVRDisplays?t&&t.isPresenting()?w.resolve("VR already enabled."):this._requestPresent(e):w.reject("VR is not available on this browser.")},n._setImageType=function(e){var t=this;if(e&&this._imageType!==e){switch(this._imageType=e,this._isCubeMap=e===$i.CUBEMAP,this._renderer&&this._renderer.off(),e){case $i.CUBEMAP:this._renderer=new wi;break;case $i.CUBESTRIP:this._renderer=new bi;break;case $i.PANORAMA:this._renderer=new ji;break;case $i.STEREOSCOPIC_EQUI:this._renderer=new Ni(this.sphericalConfig.stereoFormat);break;default:this._renderer=new Ni(ci.NONE)}this._renderer.on(_i.EVENTS.ERROR,(function(e){t.trigger(new u(er.ERROR,{type:tr.RENDERER_ERROR,message:e.message}))})),this._initWebGL()}},n._initCanvas=function(e,t,n,i){var r=e.querySelector("."+t),o=r||this._createCanvas(t);return this._hasExternalCanvas=!!r,o.width=n,o.height=i,this._onWebglcontextlost=this._onWebglcontextlost.bind(this),this._onWebglcontextrestored=this._onWebglcontextrestored.bind(this),o.addEventListener("webglcontextlost",this._onWebglcontextlost),o.addEventListener("webglcontextrestored",this._onWebglcontextrestored),o},n._createCanvas=function(e){var t=document.createElement("canvas");return t.className=e,t},n._setDefaultCanvasStyle=function(){var e=this.canvas;e.style.bottom="0",e.style.left="0",e.style.right="0",e.style.top="0",e.style.margin="auto",e.style.maxHeight="100%",e.style.maxWidth="100%",e.style.outline="none",e.style.position="absolute"},n._onContentError=function(){return this._imageIsReady=!1,this._image=null,this.trigger(new u(er.ERROR,{type:tr.FAIL_IMAGE_LOAD,message:"failed to load image"})),!1},n._triggerContentLoad=function(){this.trigger(new u(er.IMAGE_LOADED,{content:this._image,isVideo:this._isVideo,projectionType:this._imageType}))},n._onContentLoad=function(e){e.errorCount>0||(this._imageIsReady=!0,this._triggerContentLoad())},n._initShaderProgram=function(){var e=this.context;this.shaderProgram&&(e.deleteProgram(this.shaderProgram),this.shaderProgram=null);var t=this._renderer,n=t.getVertexShaderSource(),i=t.getFragmentShaderSource(),r=gi.createShader(e,e.VERTEX_SHADER,n),o=gi.createShader(e,e.FRAGMENT_SHADER,i),s=gi.createProgram(e,r,o);if(!s)throw new Error("Failed to initialize shaders: "+gi.getErrorNameFromWebGLErrorCode(e.getError()));e.useProgram(s),s.vertexPositionAttribute=e.getAttribLocation(s,"aVertexPosition"),s.pMatrixUniform=e.getUniformLocation(s,"uPMatrix"),s.mvMatrixUniform=e.getUniformLocation(s,"uMVMatrix"),s.samplerUniform=e.getUniformLocation(s,"uSampler"),s.textureCoordAttribute=e.getAttribLocation(s,"aTextureCoord"),s.uEye=e.getUniformLocation(s,"uEye"),e.enableVertexAttribArray(s.vertexPositionAttribute),e.enableVertexAttribArray(s.textureCoordAttribute),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT),e.uniform1i(s.samplerUniform,0),this.shaderProgram=s},n._onWebglcontextlost=function(e){e.preventDefault(),this.trigger(new u(er.RENDERING_CONTEXT_LOST))},n._onWebglcontextrestored=function(){this._initWebGL(),this.trigger(new u(er.RENDERING_CONTEXT_RESTORE))},n._updateViewport=function(){_t(this.pMatrix,Ke(this.fieldOfView),this.canvas.width/this.canvas.height,.1,100),this.context.viewport(0,0,this.context.drawingBufferWidth,this.context.drawingBufferHeight)},n._initWebGL=function(){var e;try{this._initRenderingContext(),e=this.context,this.updateViewportDimensions(this.width,this.height),this._initShaderProgram()}catch(e){return this.trigger(new u(er.ERROR,{type:tr.NO_WEBGL,message:"no webgl support"})),this.destroy(),void console.error(e)}e.clearColor(0,0,0,0);var t=this._isCubeMap?e.TEXTURE_CUBE_MAP:e.TEXTURE_2D;this.texture&&e.deleteTexture(this.texture),this.texture=gi.createTexture(e,t),this._imageType===$i.CUBESTRIP&&e.enable(e.CULL_FACE)},n._initRenderingContext=function(){if(!this.hasRenderingContext()){if(!window.WebGLRenderingContext)throw new Error("WebGLRenderingContext not available.");if(this.context=gi.getWebglContext(this.canvas,this._renderingContextAttributes),!this.context)throw new Error("Failed to acquire 3D rendering context")}},n._initBuffers=function(){var e=this._image,t=this._renderer.getVertexPositionData(),n=this._renderer.getIndexData(),i=this._renderer.getTextureCoordData({image:e,imageConfig:this._imageConfig}),r=this.context;this.vertexBuffer=gi.initBuffer(r,r.ARRAY_BUFFER,new Float32Array(t),3,this.shaderProgram.vertexPositionAttribute),this.indexBuffer=gi.initBuffer(r,r.ELEMENT_ARRAY_BUFFER,new Uint16Array(n),1),this.textureCoordBuffer=gi.initBuffer(r,r.ARRAY_BUFFER,new Float32Array(i),this._isCubeMap?3:2,this.shaderProgram.textureCoordAttribute),this._bindBuffers()},n._bindTexture=function(){if(this._imageType===$i.CUBESTRIP){var e=this._renderer.getDimension(this._image),t=e.width,n=e.height,i=t&&n&&t/n!=1.5?1:0;this.context.uniform1f(this.context.getUniformLocation(this.shaderProgram,"uIsEAC"),i)}else if(this._imageType===$i.PANORAMA){var r=this._renderer.getDimension(this._image),o=(t=r.width,n=r.height,t&&n&&t/n);this._renderer.updateShaderData({imageAspectRatio:o})}this._initBuffers(),this._renderer.bindTexture(this.context,this.texture,this._image,this._imageConfig),this._shouldForceDraw=!0,this.trigger(new u(er.BIND_TEXTURE))},n._updateTexture=function(){this._renderer.updateTexture(this.context,this._image,this._imageConfig)},n._render=function(){var e=this._yawPitchControl,t=e.getFov();if(e.shouldRenderWithQuaternion()){var n=e.getQuaternion();this.renderWithQuaternion(n,t)}else{var i=e.getYawPitch();this.renderWithYawPitch(i.yaw,i.pitch,t)}},n._bindBuffers=function(){var e=this.context,t=this.shaderProgram,n=this.vertexBuffer,i=this.textureCoordBuffer;e.bindBuffer(e.ARRAY_BUFFER,n),e.enableVertexAttribArray(t.vertexPositionAttribute),e.vertexAttribPointer(t.vertexPositionAttribute,n.itemSize,e.FLOAT,!1,0,0),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.indexBuffer),e.bindBuffer(e.ARRAY_BUFFER,i),e.enableVertexAttribArray(t.textureCoordAttribute),e.vertexAttribPointer(t.textureCoordAttribute,i.itemSize,e.FLOAT,!1,0,0)},n._draw=function(){this._isVideo&&this._keepUpdate&&this._updateTexture(),this._renderer.render({gl:this.context,shaderProgram:this.shaderProgram,indexBuffer:this.indexBuffer,mvMatrix:this.mvMatrix,pMatrix:this.pMatrix})},n._requestPresent=function(e){var t=this,n=this.context,i=this.canvas,r=this._animator;this._vr=gn?new Zi(e):new qi;var o=this._vr;return r.stop(),new w((function(e,s){o.requestPresent(i,n).then((function(){o.addEndCallback(t.exitVR),r.setContext(o.context),r.setCallback(t._onFirstVRFrame),an&&t._setWrapperFullscreen(),t._shouldForceDraw=!0,r.start(),e("success")})).catch((function(e){o.destroy(),t._vr=null,r.start(),s(e)}))}))},n._setWrapperFullscreen=function(){var e=this._wrapper;if(e){this._wrapperOrigStyle=e.getAttribute("style");var t=e.style;t.width="100vw",t.height="100vh",t.position="fixed",t.left="0",t.top="0",t.zIndex="9999"}},n._restoreStyle=function(){var e=this._wrapper,t=this.canvas;e&&(this._wrapperOrigStyle?e.setAttribute("style",this._wrapperOrigStyle):e.removeAttribute("style"),this._wrapperOrigStyle=null,t.removeAttribute("style"),this._setDefaultCanvasStyle())},t.EVENTS=er,t.ERROR_TYPE=tr,t}(l),ir=function(e){function t(n,i){void 0===i&&(i={});var r=e.call(this)||this;if(!gi.isWebGLAvailable())return setTimeout((function(){r.trigger(new u(ui.ERROR,{type:ai.NO_WEBGL,message:"no webgl support"}))}),0),r;if(!gi.isStableWebGL())return setTimeout((function(){r.trigger(new u(ui.ERROR,{type:ai.INVALID_DEVICE,message:"blacklisted browser"}))}),0),r;if(i.image&&i.video)return setTimeout((function(){r.trigger(new u(ui.ERROR,{type:ai.INVALID_RESOURCE,message:"Specifying multi resouces(both image and video) is not valid."}))}),0),r;!function(){var e=window.navigator;e.xr&&(e.xr.isSessionSupported?e.xr.isSessionSupported("immersive-vr").then((function(e){gn=e})).catch((function(){})):e.xr.supportsSession&&e.xr.supportsSession("immersive-vr").then((function(e){gn=e})).catch((function(){})))}(),r._container=n,r._image=i.image||i.video,r._isVideo=!!i.video,r._projectionType=i.projectionType||li.EQUIRECTANGULAR,r._cubemapConfig=Zt({order:r._projectionType===li.CUBEMAP?"RLUDBF":"RLUDFB",tileConfig:{flipHorizontal:!1,rotation:0},trim:0},i.cubemapConfig),r._stereoFormat=i.stereoFormat||ci.TOP_BOTTOM,r._width=i.width||parseInt(window.getComputedStyle(n).width,10),r._height=i.height||parseInt(window.getComputedStyle(n).height,10),r._yaw=i.yaw||0,r._pitch=i.pitch||0,r._fov=i.fov||65,r._gyroMode=i.gyroMode||In.YAWPITCH,r._quaternion=null,r._aspectRatio=0!==r._height?r._width/r._height:1,r._canvasClass=i.canvasClass||di;var o=i.fovRange||[30,110],s=t._isValidTouchDirection(i.touchDirection)?i.touchDirection:si.TOUCH_DIRECTION_ALL,a=Zt(Zt({},i),{element:n,yaw:r._yaw,pitch:r._pitch,fov:r._fov,gyroMode:r._gyroMode,fovRange:o,aspectRatio:r._aspectRatio,touchDirection:s});return r._isReady=!1,r._initYawPitchControl(a),r._initRenderer(r._yaw,r._pitch,r._fov,r._projectionType,r._cubemapConfig),r}Yt(t,e);var n=t.prototype;return t.isSupported=function(){return gi.isWebGLAvailable()&&gi.isStableWebGL()},t.isWebGLAvailable=function(){return gi.isWebGLAvailable()},t.isGyroSensorAvailable=function(e){var n;dn||!e?w.race([new w((function(e){n=function(t){var n=!(null==t.rotationRate.alpha);e(n)},window.addEventListener("devicemotion",n)})),new w((function(e){setTimeout((function(){return e(!1)}),1e3)}))]).then((function(i){window.removeEventListener("devicemotion",n),e&&e(i),t.isGyroSensorAvailable=function(e){return e&&e(i),i}})):e(!1)},t._isValidTouchDirection=function(e){return e===t.TOUCH_DIRECTION.NONE||e===t.TOUCH_DIRECTION.YAW||e===t.TOUCH_DIRECTION.PITCH||e===t.TOUCH_DIRECTION.ALL},n.getVideo=function(){return this._isVideo?this._photoSphereRenderer.getContent():null},n.setVideo=function(e,t){return void 0===t&&(t={}),e&&this.setImage(e,{projectionType:t.projectionType,isVideo:!0,cubemapConfig:t.cubemapConfig,stereoFormat:t.stereoFormat}),this},n.getImage=function(){return this._isVideo?null:this._photoSphereRenderer.getContent()},n.setImage=function(e,t){void 0===t&&(t={});var n=Zt({order:"RLUDBF",tileConfig:{flipHorizontal:!1,rotation:0},trim:0},t.cubemapConfig),i=t.stereoFormat||ci.TOP_BOTTOM,r=!!t.isVideo;return this._image&&this._isVideo!==r?(console.warn("PanoViewer is not currently supporting content type changes. (Image <--\x3e Video)"),this):(e&&(this._deactivate(),this._image=e,this._isVideo=r,this._projectionType=t.projectionType||li.EQUIRECTANGULAR,this._cubemapConfig=n,this._stereoFormat=i,this._initRenderer(this._yaw,this._pitch,this._fov,this._projectionType,this._cubemapConfig)),this)},n.keepUpdate=function(e){return this._photoSphereRenderer.keepUpdate(e),this},n.getProjectionType=function(){return this._projectionType},n.enableSensor=function(){return new w((function(e,t){dn&&"function"==typeof dn.requestPermission?dn.requestPermission().then((function(n){"granted"===n?e():t(new Error("permission denied"))})).catch((function(e){t(e)})):e()}))},n.disableSensor=function(){return this},n.enterVR=function(e){var t=this;return void 0===e&&(e={}),this._isReady?new w((function(n,i){t.enableSensor().then((function(){return t._photoSphereRenderer.enterVR(e)})).then((function(e){return n(e)})).catch((function(e){return i(e)}))})):w.reject(new Error("PanoViewer is not ready to show image."))},n.exitVR=function(){return this._photoSphereRenderer.exitVR(),this},n.setUseZoom=function(e){return"boolean"==typeof e&&this._yawPitchControl.option("useZoom",e),this},n.setUseKeyboard=function(e){return this._yawPitchControl.option("useKeyboard",e),this},n.setGyroMode=function(e){return this._yawPitchControl.option("gyroMode",e),this},n.setFovRange=function(e){return this._yawPitchControl.option("fovRange",e),this},n.getFovRange=function(){return this._yawPitchControl.option("fovRange")},n.updateViewportDimensions=function(e){if(void 0===e&&(e={}),!this._isReady)return this;var t;void 0!==e.width&&void 0!==e.height||(t=window.getComputedStyle(this._container));var n=e.width||parseInt(t.width,10),i=e.height||parseInt(t.height,10);return n===this._width&&i===this._height||(this._width=n,this._height=i,this._aspectRatio=n/i,this._photoSphereRenderer.updateViewportDimensions(n,i),this._yawPitchControl.option("aspectRatio",this._aspectRatio),this._yawPitchControl.updatePanScale({height:i}),this.lookAt({},0)),this},n.getFov=function(){return this._fov},n.getYaw=function(){return this._yaw},n.getPitch=function(){return this._pitch},n.getYawRange=function(){return this._yawPitchControl.option("yawRange")},n.getPitchRange=function(){return this._yawPitchControl.option("pitchRange")},n.setYawRange=function(e){return this._yawPitchControl.option("yawRange",e),this},n.setPitchRange=function(e){return this._yawPitchControl.option("pitchRange",e),this},n.setShowPolePoint=function(e){return this._yawPitchControl.option("showPolePoint",e),this},n.lookAt=function(e,t){if(void 0===t&&(t=0),!this._isReady)return this;var n=void 0!==e.yaw?e.yaw:this._yaw,i=void 0!==e.pitch?e.pitch:this._pitch,r=this._yawPitchControl.option("pitchRange"),o=r[1]-r[0],s=void 0!==e.fov?e.fov:this._fov;return othis._rowCount-1||e>this._colCount-1||(this._image&&fn&&(this._image.style[fn]="translate("+-e/this._colCount*100+"%, "+-t/this._rowCount*100+"%)"),this._colRow=[e,t])},n.getColRow=function(){return this._colRow},n.stop=function(){this._autoPlayTimer&&(clearInterval(this._autoPlayTimer),this._autoPlayTimer=-1)},n.play=function(e){var t=this,n=void 0===e?{interval:1e3/this._totalCount,playCount:0}:e,i=n.interval,r=n.playCount;if(this._bg){this._autoPlayTimer&&(clearInterval(this._autoPlayTimer),this._autoPlayTimer=-1);var o=this.getFrameIndex(),s=0,a=0;this._autoPlayTimer=window.setInterval((function(){o%=t._totalCount;var e=t.toColRow(o);t.setColRow(e[0],e[1]),o++,++a===t._totalCount&&(a=0,s++),r>0&&s===r&&clearInterval(t._autoPlayTimer)}),i)}else this._autoPlayReservedInfo={interval:i,playCount:r}},n.toColRow=function(e){var t=this._colCount,n=this._rowCount;return e<0?[0,0]:e>=this._totalCount?[t-1,n-1]:[e%t,Math.floor(e/t)]},t.VERSION=Ht,t}(l),lr=function(e){function t(t,n){void 0===n&&(n={});var i=e.call(this)||this;i._el=t;var r=Zt({},n),o=r.colCount||1,s=r.rowCount||1;return i._scale=r.scale||1,i._panScale=.21*i._scale,i._frameCount=o*s,i._sprites=new ur(t,r).on({load:function(e){i.trigger(new u("load",e))},imageError:function(e){i.trigger(new u("imageError",{imageUrl:e.imageUrl}))}}),i._panInput=new Ge(i._el,{scale:[i._panScale,i._panScale]}),i._axes=new He({angle:{range:[0,359],circular:!0}}).on({change:function(e){var t=Math.floor(e.pos.angle/(360/i._frameCount)),n=i._frameCount-t-1;i._sprites.setFrameIndex(n),i.trigger(new u("change",{frameIndex:n,colRow:i._sprites.getColRow(),angle:e.pos.angle}))},animationEnd:function(e){i.trigger(new u("animationEnd",{isTrusted:e.isTrusted}))}}),i._axes.connect("angle",i._panInput),i}Yt(t,e);var n=t.prototype;return n.setScale=function(e){return isNaN(e)||e<0||(this._scale=e,this._panScale=.21*e,this._panInput.options.scale=[this._panScale,this._panScale]),this},n.getScale=function(){return this._scale},n.spinBy=function(e,t){return void 0===e&&(e=0),void 0===t&&(t={duration:0}),this._axes.setBy({angle:e},t.duration),this},n.spinTo=function(e,t){return void 0===e&&(e=0),void 0===t&&(t={duration:0}),this._axes.setTo({angle:e},t.duration),this},n.getAngle=function(){return this._axes.get().angle||0},t.VERSION=Ht,t}(l),cr=function(e,t,n){[l.prototype,e.prototype].forEach((function(e){Object.getOwnPropertyNames(e).filter((function(e){return!t[e]&&!e.startsWith("_")&&"constructor"!==e})).forEach((function(i){var r=Object.getOwnPropertyDescriptor(e,i);if(r.value)Object.defineProperty(t,i,{value:function(){for(var e,t=[],i=0;i0&&t-1 in e)}function R(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}T.fn=T.prototype={jquery:x,constructor:T,length:0,toArray:function(){return a.call(this)},get:function(e){return null==e?a.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=T.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return T.each(this,e)},map:function(e){return this.pushStack(T.map(this,(function(t,n){return e.call(t,n,t)})))},slice:function(){return this.pushStack(a.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(T.grep(this,(function(e,t){return(t+1)%2})))},odd:function(){return this.pushStack(T.grep(this,(function(e,t){return t%2})))},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n+~]|[\\x20\\t\\r\\n\\f])[\\x20\\t\\r\\n\\f]*"),U=new RegExp(F+"|>"),W=new RegExp(V),G=new RegExp("^"+I+"$"),j={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+V),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\([\\x20\\t\\r\\n\\f]*(even|odd|(([+-]|)(\\d*)n|)[\\x20\\t\\r\\n\\f]*(?:([+-]|)[\\x20\\t\\r\\n\\f]*(\\d+)|))[\\x20\\t\\r\\n\\f]*\\)|)","i"),bool:new RegExp("^(?:"+S+")$","i"),needsContext:new RegExp("^[\\x20\\t\\r\\n\\f]*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\([\\x20\\t\\r\\n\\f]*((?:-\\d)?\\d*)[\\x20\\t\\r\\n\\f]*\\)|)(?=[^-]|$)","i")},z=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,H=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,q=/[+~]/,Y=new RegExp("\\\\[\\da-fA-F]{1,6}[\\x20\\t\\r\\n\\f]?|\\\\([^\\r\\n\\f])","g"),Z=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},K=function(){ue()},$=de((function(e){return!0===e.disabled&&R(e,"fieldset")}),{dir:"parentNode",next:"legend"});try{A.apply(o=a.call(B.childNodes),B.childNodes),o[B.childNodes.length].nodeType}catch(e){A={apply:function(e,t){L.apply(e,a.call(t))},call:function(e){L.apply(e,a.call(arguments,1))}}}function J(e,t,n,i){var r,o,s,a,l,c,p,f=t&&t.ownerDocument,m=t?t.nodeType:9;if(n=n||[],"string"!=typeof e||!e||1!==m&&9!==m&&11!==m)return n;if(!i&&(ue(t),t=t||u,h)){if(11!==m&&(l=H.exec(e)))if(r=l[1]){if(9===m){if(!(s=t.getElementById(r)))return n;if(s.id===r)return A.call(n,s),n}else if(f&&(s=f.getElementById(r))&&J.contains(t,s)&&s.id===r)return A.call(n,s),n}else{if(l[2])return A.apply(n,t.getElementsByTagName(e)),n;if((r=l[3])&&t.getElementsByClassName)return A.apply(n,t.getElementsByClassName(r)),n}if(!(x[e+" "]||d&&d.test(e))){if(p=e,f=t,1===m&&(U.test(e)||Q.test(e))){for((f=q.test(e)&&ae(t.parentNode)||t)==t&&g.scope||((a=t.getAttribute("id"))?a=T.escapeSelector(a):t.setAttribute("id",a=v)),o=(c=ce(e)).length;o--;)c[o]=(a?"#"+a:":scope")+" "+he(c[o]);p=c.join(",")}try{return A.apply(n,f.querySelectorAll(p)),n}catch(t){x(e,!0)}finally{a===v&&t.removeAttribute("id")}}}return me(e.replace(D,"$1"),t,n,i)}function ee(){var e=[];return function n(i,r){return e.push(i+" ")>t.cacheLength&&delete n[e.shift()],n[i+" "]=r}}function te(e){return e[v]=!0,e}function ne(e){var t=u.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ie(e){return function(t){return R(t,"input")&&t.type===e}}function re(e){return function(t){return(R(t,"input")||R(t,"button"))&&t.type===e}}function oe(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&$(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function se(e){return te((function(t){return t=+t,te((function(n,i){for(var r,o=e([],n.length,t),s=o.length;s--;)n[r=o[s]]&&(n[r]=!(i[r]=n[r]))}))}))}function ae(e){return e&&void 0!==e.getElementsByTagName&&e}function ue(e){var n,i=e?e.ownerDocument||e:B;return i!=u&&9===i.nodeType&&i.documentElement?(l=(u=i).documentElement,h=!T.isXMLDoc(u),f=l.matches||l.webkitMatchesSelector||l.msMatchesSelector,B!=u&&(n=u.defaultView)&&n.top!==n&&n.addEventListener("unload",K),g.getById=ne((function(e){return l.appendChild(e).id=T.expando,!u.getElementsByName||!u.getElementsByName(T.expando).length})),g.disconnectedMatch=ne((function(e){return f.call(e,"*")})),g.scope=ne((function(){return u.querySelectorAll(":scope")})),g.cssHas=ne((function(){try{return u.querySelector(":has(*,:jqfake)"),!1}catch(e){return!0}})),g.getById?(t.filter.ID=function(e){var t=e.replace(Y,Z);return function(e){return e.getAttribute("id")===t}},t.find.ID=function(e,t){if(void 0!==t.getElementById&&h){var n=t.getElementById(e);return n?[n]:[]}}):(t.filter.ID=function(e){var t=e.replace(Y,Z);return function(e){var n=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},t.find.ID=function(e,t){if(void 0!==t.getElementById&&h){var n,i,r,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];for(r=t.getElementsByName(e),i=0;o=r[i++];)if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),t.find.TAG=function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):t.querySelectorAll(e)},t.find.CLASS=function(e,t){if(void 0!==t.getElementsByClassName&&h)return t.getElementsByClassName(e)},d=[],ne((function(e){var t;l.appendChild(e).innerHTML="",e.querySelectorAll("[selected]").length||d.push("\\[[\\x20\\t\\r\\n\\f]*(?:value|"+S+")"),e.querySelectorAll("[id~="+v+"-]").length||d.push("~="),e.querySelectorAll("a#"+v+"+*").length||d.push(".#.+[+~]"),e.querySelectorAll(":checked").length||d.push(":checked"),(t=u.createElement("input")).setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),l.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&d.push(":enabled",":disabled"),(t=u.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||d.push("\\[[\\x20\\t\\r\\n\\f]*name[\\x20\\t\\r\\n\\f]*=[\\x20\\t\\r\\n\\f]*(?:''|\"\")")})),g.cssHas||d.push(":has"),d=d.length&&new RegExp(d.join("|")),E=function(e,t){if(e===t)return s=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!g.sortDetached&&t.compareDocumentPosition(e)===n?e===u||e.ownerDocument==B&&J.contains(B,e)?-1:t===u||t.ownerDocument==B&&J.contains(B,t)?1:r?c.call(r,e)-c.call(r,t):0:4&n?-1:1)},u):u}for(e in J.matches=function(e,t){return J(e,null,null,t)},J.matchesSelector=function(e,t){if(ue(e),h&&!x[t+" "]&&(!d||!d.test(t)))try{var n=f.call(e,t);if(n||g.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){x(t,!0)}return J(t,u,null,[e]).length>0},J.contains=function(e,t){return(e.ownerDocument||e)!=u&&ue(e),T.contains(e,t)},J.attr=function(e,n){(e.ownerDocument||e)!=u&&ue(e);var i=t.attrHandle[n.toLowerCase()],r=i&&p.call(t.attrHandle,n.toLowerCase())?i(e,n,!h):void 0;return void 0!==r?r:e.getAttribute(n)},J.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},T.uniqueSort=function(e){var t,n=[],i=0,o=0;if(s=!g.sortStable,r=!g.sortStable&&a.call(e,0),C.call(e,E),s){for(;t=e[o++];)t===e[o]&&(i=n.push(o));for(;i--;)P.call(e,n[i],1)}return r=null,e},T.fn.uniqueSort=function(){return this.pushStack(T.uniqueSort(a.apply(this)))},(t=T.expr={cacheLength:50,createPseudo:te,match:j,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(Y,Z),e[3]=(e[3]||e[4]||e[5]||"").replace(Y,Z),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||J.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&J.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return j.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&W.test(n)&&(t=ce(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(Y,Z).toLowerCase();return"*"===e?function(){return!0}:function(e){return R(e,t)}},CLASS:function(e){var t=_[e+" "];return t||(t=new RegExp("(^|[\\x20\\t\\r\\n\\f])"+e+"("+F+"|$)"))&&_(e,(function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")}))},ATTR:function(e,t,n){return function(i){var r=J.attr(i,e);return null==r?"!="===t:!t||(r+="","="===t?r===n:"!="===t?r!==n:"^="===t?n&&0===r.indexOf(n):"*="===t?n&&r.indexOf(n)>-1:"$="===t?n&&r.slice(-n.length)===n:"~="===t?(" "+r.replace(k," ")+" ").indexOf(n)>-1:"|="===t&&(r===n||r.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,i,r){var o="nth"!==e.slice(0,3),s="last"!==e.slice(-4),a="of-type"===t;return 1===i&&0===r?function(e){return!!e.parentNode}:function(t,n,u){var l,c,h,d,p,f=o!==s?"nextSibling":"previousSibling",A=t.parentNode,g=a&&t.nodeName.toLowerCase(),y=!u&&!a,_=!1;if(A){if(o){for(;f;){for(h=t;h=h[f];)if(a?R(h,g):1===h.nodeType)return!1;p=f="only"===e&&!p&&"nextSibling"}return!0}if(p=[s?A.firstChild:A.lastChild],s&&y){for(_=(d=(l=(c=A[v]||(A[v]={}))[e]||[])[0]===m&&l[1])&&l[2],h=d&&A.childNodes[d];h=++d&&h&&h[f]||(_=d=0)||p.pop();)if(1===h.nodeType&&++_&&h===t){c[e]=[m,d,_];break}}else if(y&&(_=d=(l=(c=t[v]||(t[v]={}))[e]||[])[0]===m&&l[1]),!1===_)for(;(h=++d&&h&&h[f]||(_=d=0)||p.pop())&&(!(a?R(h,g):1===h.nodeType)||!++_||(y&&((c=h[v]||(h[v]={}))[e]=[m,_]),h!==t)););return(_-=r)===i||_%i==0&&_/i>=0}}},PSEUDO:function(e,n){var i,r=t.pseudos[e]||t.setFilters[e.toLowerCase()]||J.error("unsupported pseudo: "+e);return r[v]?r(n):r.length>1?(i=[e,e,"",n],t.setFilters.hasOwnProperty(e.toLowerCase())?te((function(e,t){for(var i,o=r(e,n),s=o.length;s--;)e[i=c.call(e,o[s])]=!(t[i]=o[s])})):function(e){return r(e,0,i)}):r}},pseudos:{not:te((function(e){var t=[],n=[],i=ve(e.replace(D,"$1"));return i[v]?te((function(e,t,n,r){for(var o,s=i(e,null,r,[]),a=e.length;a--;)(o=s[a])&&(e[a]=!(t[a]=o))})):function(e,r,o){return t[0]=e,i(t,null,o,n),t[0]=null,!n.pop()}})),has:te((function(e){return function(t){return J(e,t).length>0}})),contains:te((function(e){return e=e.replace(Y,Z),function(t){return(t.textContent||T.text(t)).indexOf(e)>-1}})),lang:te((function(e){return G.test(e||"")||J.error("unsupported lang: "+e),e=e.replace(Y,Z).toLowerCase(),function(t){var n;do{if(n=h?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}})),target:function(e){var t=i.location&&i.location.hash;return t&&t.slice(1)===e.id},root:function(e){return e===l},focus:function(e){return e===function(){try{return u.activeElement}catch(e){}}()&&u.hasFocus()&&!!(e.type||e.href||~e.tabIndex)},enabled:oe(!1),disabled:oe(!0),checked:function(e){return R(e,"input")&&!!e.checked||R(e,"option")&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!t.pseudos.empty(e)},header:function(e){return X.test(e.nodeName)},input:function(e){return z.test(e.nodeName)},button:function(e){return R(e,"input")&&"button"===e.type||R(e,"button")},text:function(e){var t;return R(e,"input")&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:se((function(){return[0]})),last:se((function(e,t){return[t-1]})),eq:se((function(e,t,n){return[n<0?n+t:n]})),even:se((function(e,t){for(var n=0;nt?t:n;--i>=0;)e.push(i);return e})),gt:se((function(e,t,n){for(var i=n<0?n+t:n;++i1?function(t,n,i){for(var r=e.length;r--;)if(!e[r](t,n,i))return!1;return!0}:e[0]}function fe(e,t,n,i,r){for(var o,s=[],a=0,u=e.length,l=null!=t;a-1&&(o[l]=!(s[l]=d))}}else p=fe(p===s?p.splice(v,p.length):p),r?r(null,s,p,u):A.apply(s,p)}))}function ge(e){for(var i,r,o,s=e.length,a=t.relative[e[0].type],u=a||t.relative[" "],l=a?1:0,h=de((function(e){return e===i}),u,!0),d=de((function(e){return c.call(i,e)>-1}),u,!0),p=[function(e,t,r){var o=!a&&(r||t!=n)||((i=t).nodeType?h(e,t,r):d(e,t,r));return i=null,o}];l1&&pe(p),l>1&&he(e.slice(0,l-1).concat({value:" "===e[l-2].type?"*":""})).replace(D,"$1"),r,l0,o=e.length>0,s=function(s,a,l,c,d){var p,f,g,v=0,y="0",_=s&&[],w=[],b=n,x=s||o&&t.find.TAG("*",d),E=m+=null==b?1:Math.random()||.1,S=x.length;for(d&&(n=a==u||a||d);y!==S&&null!=(p=x[y]);y++){if(o&&p){for(f=0,a||p.ownerDocument==u||(ue(p),l=!h);g=e[f++];)if(g(p,a||u,l)){A.call(c,p);break}d&&(m=E)}r&&((p=!g&&p)&&v--,s&&_.push(p))}if(v+=y,r&&y!==v){for(f=0;g=i[f++];)g(_,w,a,l);if(s){if(v>0)for(;y--;)_[y]||w[y]||(w[y]=M.call(c));w=fe(w)}A.apply(c,w),d&&!s&&w.length>0&&v+i.length>1&&T.uniqueSort(c)}return d&&(m=E,n=b),_};return r?te(s):s}(s,o))).selector=e}return a}function me(e,n,i,r){var o,s,a,u,l,c="function"==typeof e&&e,d=!r&&ce(e=c.selector||e);if(i=i||[],1===d.length){if((s=d[0]=d[0].slice(0)).length>2&&"ID"===(a=s[0]).type&&9===n.nodeType&&h&&t.relative[s[1].type]){if(!(n=(t.find.ID(a.matches[0].replace(Y,Z),n)||[])[0]))return i;c&&(n=n.parentNode),e=e.slice(s.shift().value.length)}for(o=j.needsContext.test(e)?0:s.length;o--&&(a=s[o],!t.relative[u=a.type]);)if((l=t.find[u])&&(r=l(a.matches[0].replace(Y,Z),q.test(s[0].type)&&ae(n.parentNode)||n))){if(s.splice(o,1),!(e=r.length&&he(s)))return A.apply(i,r),i;break}}return(c||ve(e,d))(r,n,!h,i,!n||q.test(e)&&ae(n.parentNode)||n),i}le.prototype=t.filters=t.pseudos,t.setFilters=new le,g.sortStable=v.split("").sort(E).join("")===v,ue(),g.sortDetached=ne((function(e){return 1&e.compareDocumentPosition(u.createElement("fieldset"))})),T.find=J,T.expr[":"]=T.expr.pseudos,T.unique=T.uniqueSort,J.compile=ve,J.select=me,J.setDocument=ue,J.escape=T.escapeSelector,J.getText=T.text,J.isXML=T.isXMLDoc,J.selectors=T.expr,J.support=T.support,J.uniqueSort=T.uniqueSort}();var V=function(e,t,n){for(var i=[],r=void 0!==n;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(r&&T(e).is(n))break;i.push(e)}return i},k=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},N=T.expr.match.needsContext,Q=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function U(e,t,n){return v(t)?T.grep(e,(function(e,i){return!!t.call(e,i,e)!==n})):t.nodeType?T.grep(e,(function(e){return e===t!==n})):"string"!=typeof t?T.grep(e,(function(e){return c.call(t,e)>-1!==n})):T.filter(t,e,n)}T.filter=function(e,t,n){var i=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===i.nodeType?T.find.matchesSelector(i,e)?[i]:[]:T.find.matches(e,T.grep(t,(function(e){return 1===e.nodeType})))},T.fn.extend({find:function(e){var t,n,i=this.length,r=this;if("string"!=typeof e)return this.pushStack(T(e).filter((function(){for(t=0;t1?T.uniqueSort(n):n},filter:function(e){return this.pushStack(U(this,e||[],!1))},not:function(e){return this.pushStack(U(this,e||[],!0))},is:function(e){return!!U(this,"string"==typeof e&&N.test(e)?T(e):e||[],!1).length}});var W,G=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(T.fn.init=function(e,t,n){var i,r;if(!e)return this;if(n=n||W,"string"==typeof e){if(!(i="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:G.exec(e))||!i[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(i[1]){if(t=t instanceof T?t[0]:t,T.merge(this,T.parseHTML(i[1],t&&t.nodeType?t.ownerDocument||t:y,!0)),Q.test(i[1])&&T.isPlainObject(t))for(i in t)v(this[i])?this[i](t[i]):this.attr(i,t[i]);return this}return(r=y.getElementById(i[2]))&&(this[0]=r,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):v(e)?void 0!==n.ready?n.ready(e):e(T):T.makeArray(e,this)}).prototype=T.fn,W=T(y);var j=/^(?:parents|prev(?:Until|All))/,z={children:!0,contents:!0,next:!0,prev:!0};function X(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}T.fn.extend({has:function(e){var t=T(e,this),n=t.length;return this.filter((function(){for(var e=0;e-1:1===n.nodeType&&T.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(o.length>1?T.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?c.call(T(e),this[0]):c.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(T.uniqueSort(T.merge(this.get(),T(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),T.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return V(e,"parentNode")},parentsUntil:function(e,t,n){return V(e,"parentNode",n)},next:function(e){return X(e,"nextSibling")},prev:function(e){return X(e,"previousSibling")},nextAll:function(e){return V(e,"nextSibling")},prevAll:function(e){return V(e,"previousSibling")},nextUntil:function(e,t,n){return V(e,"nextSibling",n)},prevUntil:function(e,t,n){return V(e,"previousSibling",n)},siblings:function(e){return k((e.parentNode||{}).firstChild,e)},children:function(e){return k(e.firstChild)},contents:function(e){return null!=e.contentDocument&&s(e.contentDocument)?e.contentDocument:(R(e,"template")&&(e=e.content||e),T.merge([],e.childNodes))}},(function(e,t){T.fn[e]=function(n,i){var r=T.map(this,t,n);return"Until"!==e.slice(-5)&&(i=n),i&&"string"==typeof i&&(r=T.filter(i,r)),this.length>1&&(z[e]||T.uniqueSort(r),j.test(e)&&r.reverse()),this.pushStack(r)}}));var H=/[^\x20\t\r\n\f]+/g;function q(e){return e}function Y(e){throw e}function Z(e,t,n,i){var r;try{e&&v(r=e.promise)?r.call(e).done(t).fail(n):e&&v(r=e.then)?r.call(e,t,n):t.apply(void 0,[e].slice(i))}catch(e){n.apply(void 0,[e])}}T.Callbacks=function(e){e="string"==typeof e?function(e){var t={};return T.each(e.match(H)||[],(function(e,n){t[n]=!0})),t}(e):T.extend({},e);var t,n,i,r,o=[],s=[],a=-1,u=function(){for(r=r||e.once,i=t=!0;s.length;a=-1)for(n=s.shift();++a-1;)o.splice(n,1),n<=a&&a--})),this},has:function(e){return e?T.inArray(e,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return r=s=[],o=n="",this},disabled:function(){return!o},lock:function(){return r=s=[],n||t||(o=n=""),this},locked:function(){return!!r},fireWith:function(e,n){return r||(n=[e,(n=n||[]).slice?n.slice():n],s.push(n),t||u()),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!i}};return l},T.extend({Deferred:function(e){var t=[["notify","progress",T.Callbacks("memory"),T.Callbacks("memory"),2],["resolve","done",T.Callbacks("once memory"),T.Callbacks("once memory"),0,"resolved"],["reject","fail",T.Callbacks("once memory"),T.Callbacks("once memory"),1,"rejected"]],n="pending",r={state:function(){return n},always:function(){return o.done(arguments).fail(arguments),this},catch:function(e){return r.then(null,e)},pipe:function(){var e=arguments;return T.Deferred((function(n){T.each(t,(function(t,i){var r=v(e[i[4]])&&e[i[4]];o[i[1]]((function(){var e=r&&r.apply(this,arguments);e&&v(e.promise)?e.promise().progress(n.notify).done(n.resolve).fail(n.reject):n[i[0]+"With"](this,r?[e]:arguments)}))})),e=null})).promise()},then:function(e,n,r){var o=0;function s(e,t,n,r){return function(){var a=this,u=arguments,l=function(){var i,l;if(!(e=o&&(n!==Y&&(a=void 0,u=[i]),t.rejectWith(a,u))}};e?c():(T.Deferred.getErrorHook?c.error=T.Deferred.getErrorHook():T.Deferred.getStackHook&&(c.error=T.Deferred.getStackHook()),i.setTimeout(c))}}return T.Deferred((function(i){t[0][3].add(s(0,i,v(r)?r:q,i.notifyWith)),t[1][3].add(s(0,i,v(e)?e:q)),t[2][3].add(s(0,i,v(n)?n:Y))})).promise()},promise:function(e){return null!=e?T.extend(e,r):r}},o={};return T.each(t,(function(e,i){var s=i[2],a=i[5];r[i[1]]=s.add,a&&s.add((function(){n=a}),t[3-e][2].disable,t[3-e][3].disable,t[0][2].lock,t[0][3].lock),s.add(i[3].fire),o[i[0]]=function(){return o[i[0]+"With"](this===o?void 0:this,arguments),this},o[i[0]+"With"]=s.fireWith})),r.promise(o),e&&e.call(o,o),o},when:function(e){var t=arguments.length,n=t,i=Array(n),r=a.call(arguments),o=T.Deferred(),s=function(e){return function(n){i[e]=this,r[e]=arguments.length>1?a.call(arguments):n,--t||o.resolveWith(i,r)}};if(t<=1&&(Z(e,o.done(s(n)).resolve,o.reject,!t),"pending"===o.state()||v(r[n]&&r[n].then)))return o.then();for(;n--;)Z(r[n],s(n),o.reject);return o.promise()}});var K=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;T.Deferred.exceptionHook=function(e,t){i.console&&i.console.warn&&e&&K.test(e.name)&&i.console.warn("jQuery.Deferred exception: "+e.message,e.stack,t)},T.readyException=function(e){i.setTimeout((function(){throw e}))};var $=T.Deferred();function J(){y.removeEventListener("DOMContentLoaded",J),i.removeEventListener("load",J),T.ready()}T.fn.ready=function(e){return $.then(e).catch((function(e){T.readyException(e)})),this},T.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--T.readyWait:T.isReady)||(T.isReady=!0,!0!==e&&--T.readyWait>0||$.resolveWith(y,[T]))}}),T.ready.then=$.then,"complete"===y.readyState||"loading"!==y.readyState&&!y.documentElement.doScroll?i.setTimeout(T.ready):(y.addEventListener("DOMContentLoaded",J),i.addEventListener("load",J));var ee=function(e,t,n,i,r,o,s){var a=0,u=e.length,l=null==n;if("object"===b(n))for(a in r=!0,n)ee(e,t,a,n[a],!0,o,s);else if(void 0!==i&&(r=!0,v(i)||(s=!0),l&&(s?(t.call(e,i),t=null):(l=t,t=function(e,t,n){return l.call(T(e),n)})),t))for(;a1,null,!0)},removeData:function(e){return this.each((function(){ue.remove(this,e)}))}}),T.extend({queue:function(e,t,n){var i;if(e)return t=(t||"fx")+"queue",i=ae.get(e,t),n&&(!i||Array.isArray(n)?i=ae.access(e,t,T.makeArray(n)):i.push(n)),i||[]},dequeue:function(e,t){t=t||"fx";var n=T.queue(e,t),i=n.length,r=n.shift(),o=T._queueHooks(e,t);"inprogress"===r&&(r=n.shift(),i--),r&&("fx"===t&&n.unshift("inprogress"),delete o.stop,r.call(e,(function(){T.dequeue(e,t)}),o)),!i&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return ae.get(e,n)||ae.access(e,n,{empty:T.Callbacks("once memory").add((function(){ae.remove(e,[t+"queue",n])}))})}}),T.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length\x20\t\r\n\f]*)/i,Re=/^$|^module$|\/(?:java|ecma)script/i;xe=y.createDocumentFragment().appendChild(y.createElement("div")),(Ee=y.createElement("input")).setAttribute("type","radio"),Ee.setAttribute("checked","checked"),Ee.setAttribute("name","t"),xe.appendChild(Ee),g.checkClone=xe.cloneNode(!0).cloneNode(!0).lastChild.checked,xe.innerHTML="",g.noCloneChecked=!!xe.cloneNode(!0).lastChild.defaultValue,xe.innerHTML="",g.option=!!xe.lastChild;var Me={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function Ce(e,t){var n;return n=void 0!==e.getElementsByTagName?e.getElementsByTagName(t||"*"):void 0!==e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&R(e,t)?T.merge([e],n):n}function Pe(e,t){for(var n=0,i=e.length;n",""]);var Fe=/<|&#?\w+;/;function De(e,t,n,i,r){for(var o,s,a,u,l,c,h=t.createDocumentFragment(),d=[],p=0,f=e.length;p-1)r&&r.push(o);else if(l=ge(o),s=Ce(h.appendChild(o),"script"),l&&Pe(s),n)for(c=0;o=s[c++];)Re.test(o.type||"")&&n.push(o);return h}var Ie=/^([^.]*)(?:\.(.+)|)/;function Oe(){return!0}function Be(){return!1}function Le(e,t,n,i,r,o){var s,a;if("object"==typeof t){for(a in"string"!=typeof n&&(i=i||n,n=void 0),t)Le(e,a,n,i,t[a],o);return e}if(null==i&&null==r?(r=n,i=n=void 0):null==r&&("string"==typeof n?(r=i,i=void 0):(r=i,i=n,n=void 0)),!1===r)r=Be;else if(!r)return e;return 1===o&&(s=r,(r=function(e){return T().off(e),s.apply(this,arguments)}).guid=s.guid||(s.guid=T.guid++)),e.each((function(){T.event.add(this,t,r,i,n)}))}function Ve(e,t,n){n?(ae.set(e,t,!1),T.event.add(e,t,{namespace:!1,handler:function(e){var n,i=ae.get(this,t);if(1&e.isTrigger&&this[t]){if(i)(T.event.special[t]||{}).delegateType&&e.stopPropagation();else if(i=a.call(arguments),ae.set(this,t,i),this[t](),n=ae.get(this,t),ae.set(this,t,!1),i!==n)return e.stopImmediatePropagation(),e.preventDefault(),n}else i&&(ae.set(this,t,T.event.trigger(i[0],i.slice(1),this)),e.stopPropagation(),e.isImmediatePropagationStopped=Oe)}})):void 0===ae.get(e,t)&&T.event.add(e,t,Oe)}T.event={global:{},add:function(e,t,n,i,r){var o,s,a,u,l,c,h,d,p,f,A,g=ae.get(e);if(oe(e))for(n.handler&&(n=(o=n).handler,r=o.selector),r&&T.find.matchesSelector(Ae,r),n.guid||(n.guid=T.guid++),(u=g.events)||(u=g.events=Object.create(null)),(s=g.handle)||(s=g.handle=function(t){return void 0!==T&&T.event.triggered!==t.type?T.event.dispatch.apply(e,arguments):void 0}),l=(t=(t||"").match(H)||[""]).length;l--;)p=A=(a=Ie.exec(t[l])||[])[1],f=(a[2]||"").split(".").sort(),p&&(h=T.event.special[p]||{},p=(r?h.delegateType:h.bindType)||p,h=T.event.special[p]||{},c=T.extend({type:p,origType:A,data:i,handler:n,guid:n.guid,selector:r,needsContext:r&&T.expr.match.needsContext.test(r),namespace:f.join(".")},o),(d=u[p])||((d=u[p]=[]).delegateCount=0,h.setup&&!1!==h.setup.call(e,i,f,s)||e.addEventListener&&e.addEventListener(p,s)),h.add&&(h.add.call(e,c),c.handler.guid||(c.handler.guid=n.guid)),r?d.splice(d.delegateCount++,0,c):d.push(c),T.event.global[p]=!0)},remove:function(e,t,n,i,r){var o,s,a,u,l,c,h,d,p,f,A,g=ae.hasData(e)&&ae.get(e);if(g&&(u=g.events)){for(l=(t=(t||"").match(H)||[""]).length;l--;)if(p=A=(a=Ie.exec(t[l])||[])[1],f=(a[2]||"").split(".").sort(),p){for(h=T.event.special[p]||{},d=u[p=(i?h.delegateType:h.bindType)||p]||[],a=a[2]&&new RegExp("(^|\\.)"+f.join("\\.(?:.*\\.|)")+"(\\.|$)"),s=o=d.length;o--;)c=d[o],!r&&A!==c.origType||n&&n.guid!==c.guid||a&&!a.test(c.namespace)||i&&i!==c.selector&&("**"!==i||!c.selector)||(d.splice(o,1),c.selector&&d.delegateCount--,h.remove&&h.remove.call(e,c));s&&!d.length&&(h.teardown&&!1!==h.teardown.call(e,f,g.handle)||T.removeEvent(e,p,g.handle),delete u[p])}else for(p in u)T.event.remove(e,p+t[l],n,i,!0);T.isEmptyObject(u)&&ae.remove(e,"handle events")}},dispatch:function(e){var t,n,i,r,o,s,a=new Array(arguments.length),u=T.event.fix(e),l=(ae.get(this,"events")||Object.create(null))[u.type]||[],c=T.event.special[u.type]||{};for(a[0]=u,t=1;t=1))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(o=[],s={},n=0;n-1:T.find(r,this,null,[l]).length),s[r]&&o.push(i);o.length&&a.push({elem:l,handlers:o})}return l=this,u\s*$/g;function Ue(e,t){return R(e,"table")&&R(11!==t.nodeType?t:t.firstChild,"tr")&&T(e).children("tbody")[0]||e}function We(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Ge(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function je(e,t){var n,i,r,o,s,a;if(1===t.nodeType){if(ae.hasData(e)&&(a=ae.get(e).events))for(r in ae.remove(t,"handle events"),a)for(n=0,i=a[r].length;n1&&"string"==typeof f&&!g.checkClone&&Ne.test(f))return e.each((function(r){var o=e.eq(r);A&&(t[0]=f.call(this,r,o.html())),Xe(o,t,n,i)}));if(d&&(o=(r=De(t,e[0].ownerDocument,!1,e,i)).firstChild,1===r.childNodes.length&&(r=o),o||i)){for(a=(s=T.map(Ce(r,"script"),We)).length;h0&&Pe(s,!u&&Ce(e,"script")),a},cleanData:function(e){for(var t,n,i,r=T.event.special,o=0;void 0!==(n=e[o]);o++)if(oe(n)){if(t=n[ae.expando]){if(t.events)for(i in t.events)r[i]?T.event.remove(n,i):T.removeEvent(n,i,t.handle);n[ae.expando]=void 0}n[ue.expando]&&(n[ue.expando]=void 0)}}}),T.fn.extend({detach:function(e){return He(this,e,!0)},remove:function(e){return He(this,e)},text:function(e){return ee(this,(function(e){return void 0===e?T.text(this):this.empty().each((function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)}))}),null,e,arguments.length)},append:function(){return Xe(this,arguments,(function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Ue(this,e).appendChild(e)}))},prepend:function(){return Xe(this,arguments,(function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Ue(this,e);t.insertBefore(e,t.firstChild)}}))},before:function(){return Xe(this,arguments,(function(e){this.parentNode&&this.parentNode.insertBefore(e,this)}))},after:function(){return Xe(this,arguments,(function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)}))},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(T.cleanData(Ce(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map((function(){return T.clone(this,e,t)}))},html:function(e){return ee(this,(function(e){var t=this[0]||{},n=0,i=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!ke.test(e)&&!Me[(Se.exec(e)||["",""])[1].toLowerCase()]){e=T.htmlPrefilter(e);try{for(;n=0&&(u+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-u-a-.5))||0),u+l}function ct(e,t,n){var i=Ze(e),r=(!g.boxSizingReliable()||n)&&"border-box"===T.css(e,"boxSizing",!1,i),o=r,s=Je(e,t,i),a="offset"+t[0].toUpperCase()+t.slice(1);if(qe.test(s)){if(!n)return s;s="auto"}return(!g.boxSizingReliable()&&r||!g.reliableTrDimensions()&&R(e,"tr")||"auto"===s||!parseFloat(s)&&"inline"===T.css(e,"display",!1,i))&&e.getClientRects().length&&(r="border-box"===T.css(e,"boxSizing",!1,i),(o=a in e)&&(s=e[a])),(s=parseFloat(s)||0)+lt(e,t,n||(r?"border":"content"),o,i,s)+"px"}function ht(e,t,n,i,r){return new ht.prototype.init(e,t,n,i,r)}T.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Je(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,aspectRatio:!0,borderImageSlice:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,scale:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeMiterlimit:!0,strokeOpacity:!0},cssProps:{},style:function(e,t,n,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var r,o,s,a=re(t),u=Ye.test(t),l=e.style;if(u||(t=rt(a)),s=T.cssHooks[t]||T.cssHooks[a],void 0===n)return s&&"get"in s&&void 0!==(r=s.get(e,!1,i))?r:l[t];"string"==(o=typeof n)&&(r=pe.exec(n))&&r[1]&&(n=ye(e,t,r),o="number"),null!=n&&n==n&&("number"!==o||u||(n+=r&&r[3]||(T.cssNumber[a]?"":"px")),g.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),s&&"set"in s&&void 0===(n=s.set(e,n,i))||(u?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,i){var r,o,s,a=re(t);return Ye.test(t)||(t=rt(a)),(s=T.cssHooks[t]||T.cssHooks[a])&&"get"in s&&(r=s.get(e,!0,n)),void 0===r&&(r=Je(e,t,i)),"normal"===r&&t in at&&(r=at[t]),""===n||n?(o=parseFloat(r),!0===n||isFinite(o)?o||0:r):r}}),T.each(["height","width"],(function(e,t){T.cssHooks[t]={get:function(e,n,i){if(n)return!ot.test(T.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?ct(e,t,i):Ke(e,st,(function(){return ct(e,t,i)}))},set:function(e,n,i){var r,o=Ze(e),s=!g.scrollboxSize()&&"absolute"===o.position,a=(s||i)&&"border-box"===T.css(e,"boxSizing",!1,o),u=i?lt(e,t,i,a,o):0;return a&&s&&(u-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(o[t])-lt(e,t,"border",!1,o)-.5)),u&&(r=pe.exec(n))&&"px"!==(r[3]||"px")&&(e.style[t]=n,n=T.css(e,t)),ut(0,n,u)}}})),T.cssHooks.marginLeft=et(g.reliableMarginLeft,(function(e,t){if(t)return(parseFloat(Je(e,"marginLeft"))||e.getBoundingClientRect().left-Ke(e,{marginLeft:0},(function(){return e.getBoundingClientRect().left})))+"px"})),T.each({margin:"",padding:"",border:"Width"},(function(e,t){T.cssHooks[e+t]={expand:function(n){for(var i=0,r={},o="string"==typeof n?n.split(" "):[n];i<4;i++)r[e+fe[i]+t]=o[i]||o[i-2]||o[0];return r}},"margin"!==e&&(T.cssHooks[e+t].set=ut)})),T.fn.extend({css:function(e,t){return ee(this,(function(e,t,n){var i,r,o={},s=0;if(Array.isArray(t)){for(i=Ze(e),r=t.length;s1)}}),T.Tween=ht,ht.prototype={constructor:ht,init:function(e,t,n,i,r,o){this.elem=e,this.prop=n,this.easing=r||T.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=i,this.unit=o||(T.cssNumber[n]?"":"px")},cur:function(){var e=ht.propHooks[this.prop];return e&&e.get?e.get(this):ht.propHooks._default.get(this)},run:function(e){var t,n=ht.propHooks[this.prop];return this.options.duration?this.pos=t=T.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):ht.propHooks._default.set(this),this}},ht.prototype.init.prototype=ht.prototype,ht.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=T.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){T.fx.step[e.prop]?T.fx.step[e.prop](e):1!==e.elem.nodeType||!T.cssHooks[e.prop]&&null==e.elem.style[rt(e.prop)]?e.elem[e.prop]=e.now:T.style(e.elem,e.prop,e.now+e.unit)}}},ht.propHooks.scrollTop=ht.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},T.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},T.fx=ht.prototype.init,T.fx.step={};var dt,pt,ft=/^(?:toggle|show|hide)$/,At=/queueHooks$/;function gt(){pt&&(!1===y.hidden&&i.requestAnimationFrame?i.requestAnimationFrame(gt):i.setTimeout(gt,T.fx.interval),T.fx.tick())}function vt(){return i.setTimeout((function(){dt=void 0})),dt=Date.now()}function mt(e,t){var n,i=0,r={height:e};for(t=t?1:0;i<4;i+=2-t)r["margin"+(n=fe[i])]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}function yt(e,t,n){for(var i,r=(_t.tweeners[t]||[]).concat(_t.tweeners["*"]),o=0,s=r.length;o1)},removeAttr:function(e){return this.each((function(){T.removeAttr(this,e)}))}}),T.extend({attr:function(e,t,n){var i,r,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return void 0===e.getAttribute?T.prop(e,t,n):(1===o&&T.isXMLDoc(e)||(r=T.attrHooks[t.toLowerCase()]||(T.expr.match.bool.test(t)?wt:void 0)),void 0!==n?null===n?void T.removeAttr(e,t):r&&"set"in r&&void 0!==(i=r.set(e,n,t))?i:(e.setAttribute(t,n+""),n):r&&"get"in r&&null!==(i=r.get(e,t))?i:null==(i=T.find.attr(e,t))?void 0:i)},attrHooks:{type:{set:function(e,t){if(!g.radioValue&&"radio"===t&&R(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,i=0,r=t&&t.match(H);if(r&&1===e.nodeType)for(;n=r[i++];)e.removeAttribute(n)}}),wt={set:function(e,t,n){return!1===t?T.removeAttr(e,n):e.setAttribute(n,n),n}},T.each(T.expr.match.bool.source.match(/\w+/g),(function(e,t){var n=bt[t]||T.find.attr;bt[t]=function(e,t,i){var r,o,s=t.toLowerCase();return i||(o=bt[s],bt[s]=r,r=null!=n(e,t,i)?s:null,bt[s]=o),r}}));var xt=/^(?:input|select|textarea|button)$/i,Et=/^(?:a|area)$/i;function Tt(e){return(e.match(H)||[]).join(" ")}function St(e){return e.getAttribute&&e.getAttribute("class")||""}function Rt(e){return Array.isArray(e)?e:"string"==typeof e&&e.match(H)||[]}T.fn.extend({prop:function(e,t){return ee(this,T.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each((function(){delete this[T.propFix[e]||e]}))}}),T.extend({prop:function(e,t,n){var i,r,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&T.isXMLDoc(e)||(t=T.propFix[t]||t,r=T.propHooks[t]),void 0!==n?r&&"set"in r&&void 0!==(i=r.set(e,n,t))?i:e[t]=n:r&&"get"in r&&null!==(i=r.get(e,t))?i:e[t]},propHooks:{tabIndex:{get:function(e){var t=T.find.attr(e,"tabindex");return t?parseInt(t,10):xt.test(e.nodeName)||Et.test(e.nodeName)&&e.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),g.optSelected||(T.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),T.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],(function(){T.propFix[this.toLowerCase()]=this})),T.fn.extend({addClass:function(e){var t,n,i,r,o,s;return v(e)?this.each((function(t){T(this).addClass(e.call(this,t,St(this)))})):(t=Rt(e)).length?this.each((function(){if(i=St(this),n=1===this.nodeType&&" "+Tt(i)+" "){for(o=0;o-1;)n=n.replace(" "+r+" "," ");s=Tt(n),i!==s&&this.setAttribute("class",s)}})):this:this.attr("class","")},toggleClass:function(e,t){var n,i,r,o,s=typeof e,a="string"===s||Array.isArray(e);return v(e)?this.each((function(n){T(this).toggleClass(e.call(this,n,St(this),t),t)})):"boolean"==typeof t&&a?t?this.addClass(e):this.removeClass(e):(n=Rt(e),this.each((function(){if(a)for(o=T(this),r=0;r-1)return!0;return!1}});var Mt=/\r/g;T.fn.extend({val:function(e){var t,n,i,r=this[0];return arguments.length?(i=v(e),this.each((function(n){var r;1===this.nodeType&&(null==(r=i?e.call(this,n,T(this).val()):e)?r="":"number"==typeof r?r+="":Array.isArray(r)&&(r=T.map(r,(function(e){return null==e?"":e+""}))),(t=T.valHooks[this.type]||T.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,r,"value")||(this.value=r))}))):r?(t=T.valHooks[r.type]||T.valHooks[r.nodeName.toLowerCase()])&&"get"in t&&void 0!==(n=t.get(r,"value"))?n:"string"==typeof(n=r.value)?n.replace(Mt,""):null==n?"":n:void 0}}),T.extend({valHooks:{option:{get:function(e){var t=T.find.attr(e,"value");return null!=t?t:Tt(T.text(e))}},select:{get:function(e){var t,n,i,r=e.options,o=e.selectedIndex,s="select-one"===e.type,a=s?null:[],u=s?o+1:r.length;for(i=o<0?u:s?o:0;i-1)&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),T.each(["radio","checkbox"],(function(){T.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=T.inArray(T(e).val(),t)>-1}},g.checkOn||(T.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}));var Ct=i.location,Pt={guid:Date.now()},Ft=/\?/;T.parseXML=function(e){var t,n;if(!e||"string"!=typeof e)return null;try{t=(new i.DOMParser).parseFromString(e,"text/xml")}catch(e){}return n=t&&t.getElementsByTagName("parsererror")[0],t&&!n||T.error("Invalid XML: "+(n?T.map(n.childNodes,(function(e){return e.textContent})).join("\n"):e)),t};var Dt=/^(?:focusinfocus|focusoutblur)$/,It=function(e){e.stopPropagation()};T.extend(T.event,{trigger:function(e,t,n,r){var o,s,a,u,l,c,h,d,f=[n||y],A=p.call(e,"type")?e.type:e,g=p.call(e,"namespace")?e.namespace.split("."):[];if(s=d=a=n=n||y,3!==n.nodeType&&8!==n.nodeType&&!Dt.test(A+T.event.triggered)&&(A.indexOf(".")>-1&&(g=A.split("."),A=g.shift(),g.sort()),l=A.indexOf(":")<0&&"on"+A,(e=e[T.expando]?e:new T.Event(A,"object"==typeof e&&e)).isTrigger=r?2:3,e.namespace=g.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+g.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),t=null==t?[e]:T.makeArray(t,[e]),h=T.event.special[A]||{},r||!h.trigger||!1!==h.trigger.apply(n,t))){if(!r&&!h.noBubble&&!m(n)){for(u=h.delegateType||A,Dt.test(u+A)||(s=s.parentNode);s;s=s.parentNode)f.push(s),a=s;a===(n.ownerDocument||y)&&f.push(a.defaultView||a.parentWindow||i)}for(o=0;(s=f[o++])&&!e.isPropagationStopped();)d=s,e.type=o>1?u:h.bindType||A,(c=(ae.get(s,"events")||Object.create(null))[e.type]&&ae.get(s,"handle"))&&c.apply(s,t),(c=l&&s[l])&&c.apply&&oe(s)&&(e.result=c.apply(s,t),!1===e.result&&e.preventDefault());return e.type=A,r||e.isDefaultPrevented()||h._default&&!1!==h._default.apply(f.pop(),t)||!oe(n)||l&&v(n[A])&&!m(n)&&((a=n[l])&&(n[l]=null),T.event.triggered=A,e.isPropagationStopped()&&d.addEventListener(A,It),n[A](),e.isPropagationStopped()&&d.removeEventListener(A,It),T.event.triggered=void 0,a&&(n[l]=a)),e.result}},simulate:function(e,t,n){var i=T.extend(new T.Event,n,{type:e,isSimulated:!0});T.event.trigger(i,null,t)}}),T.fn.extend({trigger:function(e,t){return this.each((function(){T.event.trigger(e,t,this)}))},triggerHandler:function(e,t){var n=this[0];if(n)return T.event.trigger(e,t,n,!0)}});var Ot=/\[\]$/,Bt=/\r?\n/g,Lt=/^(?:submit|button|image|reset|file)$/i,Vt=/^(?:input|select|textarea|keygen)/i;function kt(e,t,n,i){var r;if(Array.isArray(t))T.each(t,(function(t,r){n||Ot.test(e)?i(e,r):kt(e+"["+("object"==typeof r&&null!=r?t:"")+"]",r,n,i)}));else if(n||"object"!==b(t))i(e,t);else for(r in t)kt(e+"["+r+"]",t[r],n,i)}T.param=function(e,t){var n,i=[],r=function(e,t){var n=v(t)?t():t;i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(null==e)return"";if(Array.isArray(e)||e.jquery&&!T.isPlainObject(e))T.each(e,(function(){r(this.name,this.value)}));else for(n in e)kt(n,e[n],t,r);return i.join("&")},T.fn.extend({serialize:function(){return T.param(this.serializeArray())},serializeArray:function(){return this.map((function(){var e=T.prop(this,"elements");return e?T.makeArray(e):this})).filter((function(){var e=this.type;return this.name&&!T(this).is(":disabled")&&Vt.test(this.nodeName)&&!Lt.test(e)&&(this.checked||!Te.test(e))})).map((function(e,t){var n=T(this).val();return null==n?null:Array.isArray(n)?T.map(n,(function(e){return{name:t.name,value:e.replace(Bt,"\r\n")}})):{name:t.name,value:n.replace(Bt,"\r\n")}})).get()}});var Nt=/%20/g,Qt=/#.*$/,Ut=/([?&])_=[^&]*/,Wt=/^(.*?):[ \t]*([^\r\n]*)$/gm,Gt=/^(?:GET|HEAD)$/,jt=/^\/\//,zt={},Xt={},Ht="*/".concat("*"),qt=y.createElement("a");function Yt(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var i,r=0,o=t.toLowerCase().match(H)||[];if(v(n))for(;i=o[r++];)"+"===i[0]?(i=i.slice(1)||"*",(e[i]=e[i]||[]).unshift(n)):(e[i]=e[i]||[]).push(n)}}function Zt(e,t,n,i){var r={},o=e===Xt;function s(a){var u;return r[a]=!0,T.each(e[a]||[],(function(e,a){var l=a(t,n,i);return"string"!=typeof l||o||r[l]?o?!(u=l):void 0:(t.dataTypes.unshift(l),s(l),!1)})),u}return s(t.dataTypes[0])||!r["*"]&&s("*")}function Kt(e,t){var n,i,r=T.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((r[n]?e:i||(i={}))[n]=t[n]);return i&&T.extend(!0,e,i),e}qt.href=Ct.href,T.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Ct.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(Ct.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Ht,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":T.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Kt(Kt(e,T.ajaxSettings),t):Kt(T.ajaxSettings,e)},ajaxPrefilter:Yt(zt),ajaxTransport:Yt(Xt),ajax:function(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var n,r,o,s,a,u,l,c,h,d,p=T.ajaxSetup({},t),f=p.context||p,A=p.context&&(f.nodeType||f.jquery)?T(f):T.event,g=T.Deferred(),v=T.Callbacks("once memory"),m=p.statusCode||{},_={},w={},b="canceled",x={readyState:0,getResponseHeader:function(e){var t;if(l){if(!s)for(s={};t=Wt.exec(o);)s[t[1].toLowerCase()+" "]=(s[t[1].toLowerCase()+" "]||[]).concat(t[2]);t=s[e.toLowerCase()+" "]}return null==t?null:t.join(", ")},getAllResponseHeaders:function(){return l?o:null},setRequestHeader:function(e,t){return null==l&&(e=w[e.toLowerCase()]=w[e.toLowerCase()]||e,_[e]=t),this},overrideMimeType:function(e){return null==l&&(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(l)x.always(e[x.status]);else for(t in e)m[t]=[m[t],e[t]];return this},abort:function(e){var t=e||b;return n&&n.abort(t),E(0,t),this}};if(g.promise(x),p.url=((e||p.url||Ct.href)+"").replace(jt,Ct.protocol+"//"),p.type=t.method||t.type||p.method||p.type,p.dataTypes=(p.dataType||"*").toLowerCase().match(H)||[""],null==p.crossDomain){u=y.createElement("a");try{u.href=p.url,u.href=u.href,p.crossDomain=qt.protocol+"//"+qt.host!=u.protocol+"//"+u.host}catch(e){p.crossDomain=!0}}if(p.data&&p.processData&&"string"!=typeof p.data&&(p.data=T.param(p.data,p.traditional)),Zt(zt,p,t,x),l)return x;for(h in(c=T.event&&p.global)&&0==T.active++&&T.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Gt.test(p.type),r=p.url.replace(Qt,""),p.hasContent?p.data&&p.processData&&0===(p.contentType||"").indexOf("application/x-www-form-urlencoded")&&(p.data=p.data.replace(Nt,"+")):(d=p.url.slice(r.length),p.data&&(p.processData||"string"==typeof p.data)&&(r+=(Ft.test(r)?"&":"?")+p.data,delete p.data),!1===p.cache&&(r=r.replace(Ut,"$1"),d=(Ft.test(r)?"&":"?")+"_="+Pt.guid+++d),p.url=r+d),p.ifModified&&(T.lastModified[r]&&x.setRequestHeader("If-Modified-Since",T.lastModified[r]),T.etag[r]&&x.setRequestHeader("If-None-Match",T.etag[r])),(p.data&&p.hasContent&&!1!==p.contentType||t.contentType)&&x.setRequestHeader("Content-Type",p.contentType),x.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Ht+"; q=0.01":""):p.accepts["*"]),p.headers)x.setRequestHeader(h,p.headers[h]);if(p.beforeSend&&(!1===p.beforeSend.call(f,x,p)||l))return x.abort();if(b="abort",v.add(p.complete),x.done(p.success),x.fail(p.error),n=Zt(Xt,p,t,x)){if(x.readyState=1,c&&A.trigger("ajaxSend",[x,p]),l)return x;p.async&&p.timeout>0&&(a=i.setTimeout((function(){x.abort("timeout")}),p.timeout));try{l=!1,n.send(_,E)}catch(e){if(l)throw e;E(-1,e)}}else E(-1,"No Transport");function E(e,t,s,u){var h,d,y,_,w,b=t;l||(l=!0,a&&i.clearTimeout(a),n=void 0,o=u||"",x.readyState=e>0?4:0,h=e>=200&&e<300||304===e,s&&(_=function(e,t,n){for(var i,r,o,s,a=e.contents,u=e.dataTypes;"*"===u[0];)u.shift(),void 0===i&&(i=e.mimeType||t.getResponseHeader("Content-Type"));if(i)for(r in a)if(a[r]&&a[r].test(i)){u.unshift(r);break}if(u[0]in n)o=u[0];else{for(r in n){if(!u[0]||e.converters[r+" "+u[0]]){o=r;break}s||(s=r)}o=o||s}if(o)return o!==u[0]&&u.unshift(o),n[o]}(p,x,s)),!h&&T.inArray("script",p.dataTypes)>-1&&T.inArray("json",p.dataTypes)<0&&(p.converters["text script"]=function(){}),_=function(e,t,n,i){var r,o,s,a,u,l={},c=e.dataTypes.slice();if(c[1])for(s in e.converters)l[s.toLowerCase()]=e.converters[s];for(o=c.shift();o;)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&i&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(!(s=l[u+" "+o]||l["* "+o]))for(r in l)if((a=r.split(" "))[1]===o&&(s=l[u+" "+a[0]]||l["* "+a[0]])){!0===s?s=l[r]:!0!==l[r]&&(o=a[0],c.unshift(a[1]));break}if(!0!==s)if(s&&e.throws)t=s(t);else try{t=s(t)}catch(e){return{state:"parsererror",error:s?e:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}(p,_,x,h),h?(p.ifModified&&((w=x.getResponseHeader("Last-Modified"))&&(T.lastModified[r]=w),(w=x.getResponseHeader("etag"))&&(T.etag[r]=w)),204===e||"HEAD"===p.type?b="nocontent":304===e?b="notmodified":(b=_.state,d=_.data,h=!(y=_.error))):(y=b,!e&&b||(b="error",e<0&&(e=0))),x.status=e,x.statusText=(t||b)+"",h?g.resolveWith(f,[d,b,x]):g.rejectWith(f,[x,b,y]),x.statusCode(m),m=void 0,c&&A.trigger(h?"ajaxSuccess":"ajaxError",[x,p,h?d:y]),v.fireWith(f,[x,b]),c&&(A.trigger("ajaxComplete",[x,p]),--T.active||T.event.trigger("ajaxStop")))}return x},getJSON:function(e,t,n){return T.get(e,t,n,"json")},getScript:function(e,t){return T.get(e,void 0,t,"script")}}),T.each(["get","post"],(function(e,t){T[t]=function(e,n,i,r){return v(n)&&(r=r||i,i=n,n=void 0),T.ajax(T.extend({url:e,type:t,dataType:r,data:n,success:i},T.isPlainObject(e)&&e))}})),T.ajaxPrefilter((function(e){var t;for(t in e.headers)"content-type"===t.toLowerCase()&&(e.contentType=e.headers[t]||"")})),T._evalUrl=function(e,t,n){return T.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(e){T.globalEval(e,t,n)}})},T.fn.extend({wrapAll:function(e){var t;return this[0]&&(v(e)&&(e=e.call(this[0])),t=T(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map((function(){for(var e=this;e.firstElementChild;)e=e.firstElementChild;return e})).append(this)),this},wrapInner:function(e){return v(e)?this.each((function(t){T(this).wrapInner(e.call(this,t))})):this.each((function(){var t=T(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)}))},wrap:function(e){var t=v(e);return this.each((function(n){T(this).wrapAll(t?e.call(this,n):e)}))},unwrap:function(e){return this.parent(e).not("body").each((function(){T(this).replaceWith(this.childNodes)})),this}}),T.expr.pseudos.hidden=function(e){return!T.expr.pseudos.visible(e)},T.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},T.ajaxSettings.xhr=function(){try{return new i.XMLHttpRequest}catch(e){}};var $t={0:200,1223:204},Jt=T.ajaxSettings.xhr();g.cors=!!Jt&&"withCredentials"in Jt,g.ajax=Jt=!!Jt,T.ajaxTransport((function(e){var t,n;if(g.cors||Jt&&!e.crossDomain)return{send:function(r,o){var s,a=e.xhr();if(a.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(s in e.xhrFields)a[s]=e.xhrFields[s];for(s in e.mimeType&&a.overrideMimeType&&a.overrideMimeType(e.mimeType),e.crossDomain||r["X-Requested-With"]||(r["X-Requested-With"]="XMLHttpRequest"),r)a.setRequestHeader(s,r[s]);t=function(e){return function(){t&&(t=n=a.onload=a.onerror=a.onabort=a.ontimeout=a.onreadystatechange=null,"abort"===e?a.abort():"error"===e?"number"!=typeof a.status?o(0,"error"):o(a.status,a.statusText):o($t[a.status]||a.status,a.statusText,"text"!==(a.responseType||"text")||"string"!=typeof a.responseText?{binary:a.response}:{text:a.responseText},a.getAllResponseHeaders()))}},a.onload=t(),n=a.onerror=a.ontimeout=t("error"),void 0!==a.onabort?a.onabort=n:a.onreadystatechange=function(){4===a.readyState&&i.setTimeout((function(){t&&n()}))},t=t("abort");try{a.send(e.hasContent&&e.data||null)}catch(e){if(t)throw e}},abort:function(){t&&t()}}})),T.ajaxPrefilter((function(e){e.crossDomain&&(e.contents.script=!1)})),T.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return T.globalEval(e),e}}}),T.ajaxPrefilter("script",(function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")})),T.ajaxTransport("script",(function(e){var t,n;if(e.crossDomain||e.scriptAttrs)return{send:function(i,r){t=T("