UNPKG

92.3 kBJavaScriptView Raw
1/*
2Copyright (c) 2017-present NAVER Corp.
3name: @egjs/view360
4license: MIT
5author: NAVER Corp.
6repository: https://github.com/naver/egjs-view360
7version: 3.6.1
8*/
9!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("@egjs/component"),require("promise-polyfill"),require("@egjs/agent"),require("@egjs/axes"),require("gl-matrix"),require("@egjs/imready")):"function"==typeof define&&define.amd?define(["@egjs/component","promise-polyfill","@egjs/agent","@egjs/axes","gl-matrix","@egjs/imready"],e):((t="undefined"!=typeof globalThis?globalThis:t||self).eg=t.eg||{},t.eg.view360=e(t.eg.Component,t.Promise,t.eg.agent,t.eg.Axes,t.glMatrix,t.eg.ImReady))}(this,function(c,s,a,h,_,r){"use strict";var n="3.6.1",o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)};function l(t,e){function i(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var u=function(){return(u=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var r in e=arguments[i])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function i(t,a,s,h){return new(s=s||Promise)(function(i,e){function n(t){try{o(h.next(t))}catch(t){e(t)}}function r(t){try{o(h.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?i(t.value):((e=t.value)instanceof s?e:new s(function(t){t(e)})).then(n,r)}o((h=h.apply(t,a||[])).next())})}function d(i,n){var r,o,a,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},t={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,o&&(a=2&e[0]?o.return:e[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,e[1])).done)return a;switch(o=0,a&&(e=[2&e[0],a.value]),e[0]){case 0:case 1:a=e;break;case 4:return s.label++,{value:e[1],done:!1};case 5:s.label++,o=e[1],e=[0];continue;case 7:e=s.ops.pop(),s.trys.pop();continue;default:if(!(a=0<(a=s.trys).length&&a[a.length-1])&&(6===e[0]||2===e[0])){s=0;continue}if(3===e[0]&&(!a||e[1]>a[0]&&e[1]<a[3])){s.label=e[1];break}if(6===e[0]&&s.label<a[1]){s.label=a[1],a=e;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(e);break}a[2]&&s.ops.pop(),s.trys.pop();continue}e=n.call(i,s)}catch(t){e=[6,t],o=0}finally{r=a=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}}function f(t){var e="function"==typeof Symbol&&Symbol.iterator,i=e&&t[e],n=0;if(i)return i.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function p(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(function(t,e){var i="function"==typeof Symbol&&t[Symbol.iterator];if(!i)return t;var n,r,o=i.call(t),a=[];try{for(;(void 0===e||0<e--)&&!(n=o.next()).done;)a.push(n.value)}catch(t){r={error:t}}finally{try{n&&!n.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return a}(arguments[e]));return t}var g="undefined"!=typeof window&&window.Math===Math?window:"undefined"!=typeof self&&self.Math===Math?self:Function("return this")(),m=g.document,v=g.navigator,t=a(),e=t.os.name,y=t.browser.name,x="ios"===e,w="mac"===e&&"safari"===y;g.Float32Array=void 0!==g.Float32Array?g.Float32Array:g.Array;g.Float32Array,g.getComputedStyle;function E(t){return 180*t/Math.PI}var R=g.navigator&&g.navigator.userAgent,T="ontouchstart"in g,C="ondevicemotion"in g,I=g.DeviceMotionEvent,b=g.devicePixelRatio,P=function(){for(var t,e=null!==(t=null==m?void 0:m.documentElement.style)&&void 0!==t?t:{},i=["transform","webkitTransform","msTransform","mozTransform"],n=0,r=i.length;n<r;n++)if(i[n]in e)return i[n];return""}(),A=g.CSS&&g.CSS.supports&&g.CSS.supports("will-change","transform"),S=!1,O=function(){var t=window.navigator;t.xr&&(t.xr.isSessionSupported?t.xr.isSessionSupported("immersive-vr").then(function(t){S=t}).catch(function(){}):t.xr.supportsSession&&t.xr.supportsSession("immersive-vr").then(function(t){S=t}).catch(function(){}))},D={isPowerOfTwo:function(t){return t&&0==(t&t-1)}};D.extractPitchFromQuat=function(t){var e,t=(e=t,t=_.vec3.fromValues(0,0,1),_.vec3.transformQuat(t,t,e),t);return-1*Math.atan2(t[1],Math.sqrt(Math.pow(t[0],2)+Math.pow(t[2],2)))},D.hypot=Math.hypot||function(t,e){return Math.sqrt(t*t+e*e)};var M={PITCH_DELTA:1,YAW_DELTA_BY_ROLL:2,YAW_DELTA_BY_YAW:3};M[M.PITCH_DELTA]={targetAxis:[0,1,0],meshPoint:[0,0,1]},M[M.YAW_DELTA_BY_ROLL]={targetAxis:[0,1,0],meshPoint:[1,0,0]},M[M.YAW_DELTA_BY_YAW]={targetAxis:[1,0,0],meshPoint:[0,0,1]};function V(t,e){var i=t[0]*e[1]-e[0]*t[1];return-Math.atan2(i,_.vec2.dot(t,e))}D.yawOffsetBetween=function(t,e){t=_.vec2.fromValues(t[0],t[2]),e=_.vec2.fromValues(e[0],e[2]);return _.vec2.normalize(t,t),_.vec2.normalize(e,e),-V(t,e)},D.sign=function(t){return Math.sign?Math.sign(t):Number(0<t)-Number(t<0)||+t},D.toDegree=E,D.getRotationDelta=function(t,e,i){var n=_.vec3.fromValues(M[i].targetAxis[0],M[i].targetAxis[1],M[i].targetAxis[2]),r=M[i].meshPoint,o=_.quat.clone(t),a=_.quat.clone(e);_.quat.normalize(o,o),_.quat.normalize(a,a);var s=_.vec3.fromValues(0,0,1),h=_.vec3.fromValues(0,0,1);_.vec3.transformQuat(s,s,o),_.vec3.transformQuat(h,h,a),_.vec3.transformQuat(n,n,a);var u=0<_.vec3.dot(n,_.vec3.cross(_.vec3.create(),s,h))?1:-1,c=_.vec3.fromValues(r[0],r[1],r[2]),t=i!==M.YAW_DELTA_BY_YAW?_.vec3.fromValues(0,u,0):_.vec3.fromValues(u,0,0);_.vec3.transformQuat(c,c,a),_.vec3.transformQuat(t,t,a);e=c,n=t,c=_.vec3.create();_.vec3.cross(c,e,n),_.vec3.normalize(c,c);t=c[0],e=c[1],n=c[2],h=_.vec3.fromValues(r[0],r[1],r[2]);_.vec3.transformQuat(h,h,a),s=_.vec3.fromValues(r[0],r[1],r[2]),_.vec3.transformQuat(s,s,o);r=Math.abs(s[0]*t+s[1]*e+s[2]*n),o=_.vec3.create();_.vec3.subtract(o,s,_.vec3.scale(_.vec3.create(),c,r));c=(o[0]*h[0]+o[1]*h[1]+o[2]*h[2])/(_.vec3.length(o)*_.vec3.length(h));1<c&&(c=1);var c=Math.acos(c),o=_.vec3.cross(_.vec3.create(),h,o),r=t*o[0]+e*o[1]+n*o[2],r=i!==M.YAW_DELTA_BY_YAW?0<r?1:-1:r<0?1:-1;return E(c*r*u)},D.angleBetweenVec2=V;var F=-1,t=null,e=null,y=/Chrome\/([0-9]+)\.(?:[0-9]*)\.([0-9]*)\.([0-9]*)/i.exec(R);y&&(F=parseInt(y[1],10),t=y[2],e=y[3]);var L,N,U=F,Q=65===F&&"3325"===t&&parseInt(e,10)<148,z=/Android/i.test(R),G=[.2,.2],B={NONE:"none",YAWPITCH:"yawPitch",VR:"VR"},W=g.MathUtil||{};W.degToRad=Math.PI/180,W.radToDeg=180/Math.PI,W.Vector2=function(t,e){this.x=t||0,this.y=e||0},W.Vector2.prototype={constructor:W.Vector2,set:function(t,e){return this.x=t,this.y=e,this},copy:function(t){return this.x=t.x,this.y=t.y,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}},W.Vector3=function(t,e,i){this.x=t||0,this.y=e||0,this.z=i||0},W.Vector3.prototype={constructor:W.Vector3,set:function(t,e,i){return this.x=t,this.y=e,this.z=i,this},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},normalize:function(){var t=this.length();return 0!==t?(t=1/t,this.multiplyScalar(t)):(this.x=0,this.y=0,this.z=0),this},multiplyScalar:function(t){this.x*=t,this.y*=t,this.z*=t},applyQuaternion:function(t){var e=this.x,i=this.y,n=this.z,r=t.x,o=t.y,a=t.z,s=t.w,h=s*e+o*n-a*i,u=s*i+a*e-r*n,t=s*n+r*i-o*e,n=-r*e-o*i-a*n;return this.x=h*s+n*-r+u*-a-t*-o,this.y=u*s+n*-o+t*-r-h*-a,this.z=t*s+n*-a+h*-o-u*-r,this},dot:function(t){return this.x*t.x+this.y*t.y+this.z*t.z},crossVectors:function(t,e){var i=t.x,n=t.y,r=t.z,o=e.x,t=e.y,e=e.z;return this.x=n*e-r*t,this.y=r*o-i*e,this.z=i*t-n*o,this}},W.Quaternion=function(t,e,i,n){this.x=t||0,this.y=e||0,this.z=i||0,this.w=void 0!==n?n:1},W.Quaternion.prototype={constructor:W.Quaternion,set:function(t,e,i,n){return this.x=t,this.y=e,this.z=i,this.w=n,this},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},setFromEulerXYZ:function(t,e,i){var n=Math.cos(t/2),r=Math.cos(e/2),o=Math.cos(i/2),t=Math.sin(t/2),e=Math.sin(e/2),i=Math.sin(i/2);return this.x=t*r*o+n*e*i,this.y=n*e*o-t*r*i,this.z=n*r*i+t*e*o,this.w=n*r*o-t*e*i,this},setFromEulerYXZ:function(t,e,i){var n=Math.cos(t/2),r=Math.cos(e/2),o=Math.cos(i/2),t=Math.sin(t/2),e=Math.sin(e/2),i=Math.sin(i/2);return this.x=t*r*o+n*e*i,this.y=n*e*o-t*r*i,this.z=n*r*i-t*e*o,this.w=n*r*o+t*e*i,this},setFromAxisAngle:function(t,e){var i=e/2,e=Math.sin(i);return this.x=t.x*e,this.y=t.y*e,this.z=t.z*e,this.w=Math.cos(i),this},multiply:function(t){return this.multiplyQuaternions(this,t)},multiplyQuaternions:function(t,e){var i=t.x,n=t.y,r=t.z,o=t.w,a=e.x,s=e.y,t=e.z,e=e.w;return this.x=i*e+o*a+n*t-r*s,this.y=n*e+o*s+r*a-i*t,this.z=r*e+o*t+i*s-n*a,this.w=o*e-i*a-n*s-r*t,this},inverse:function(){return this.x*=-1,this.y*=-1,this.z*=-1,this.normalize(),this},normalize:function(){var t=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);return 0===t?(this.x=0,this.y=0,this.z=0,this.w=1):(t=1/t,this.x=this.x*t,this.y=this.y*t,this.z=this.z*t,this.w=this.w*t),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var i=this.x,n=this.y,r=this.z,o=this.w,a=o*t.w+i*t.x+n*t.y+r*t.z;if(a<0?(this.w=-t.w,this.x=-t.x,this.y=-t.y,this.z=-t.z,a=-a):this.copy(t),1<=a)return this.w=o,this.x=i,this.y=n,this.z=r,this;var s=Math.acos(a),t=Math.sqrt(1-a*a);if(Math.abs(t)<.001)return this.w=.5*(o+this.w),this.x=.5*(i+this.x),this.y=.5*(n+this.y),this.z=.5*(r+this.z),this;a=Math.sin((1-e)*s)/t,t=Math.sin(e*s)/t;return this.w=o*a+this.w*t,this.x=i*a+this.x*t,this.y=n*a+this.y*t,this.z=r*a+this.z*t,this},setFromUnitVectors:function(t,e){return void 0===L&&(L=new W.Vector3),(N=t.dot(e)+1)<1e-6?(N=0,Math.abs(t.x)>Math.abs(t.z)?L.set(-t.y,t.x,0):L.set(0,-t.z,t.y)):L.crossVectors(t,e),this.x=L.x,this.y=L.y,this.z=L.z,this.w=N,this.normalize(),this}};var k,X,Y,q,j,H,K,Z,J,$=null!==(t=null==v?void 0:v.userAgent)&&void 0!==t?t:"",tt=g.Util||{};function et(t,e,i,n,r){c=t,a=n?n.fieldOfView:null,o=r.depthNear,u=r.depthFar,l=Math.tan(a?a.upDegrees*H:K),h=Math.tan(a?a.downDegrees*H:K),f=Math.tan(a?a.leftDegrees*H:K),d=Math.tan(a?a.rightDegrees*H:K),s=2/(f+d),a=2/(l+h),c[0]=s,c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=a,c[6]=0,c[7]=0,c[8]=-(f-d)*s*.5,c[9]=(l-h)*a*.5,c[10]=u/(o-u),c[11]=-1,c[12]=0,c[13]=0,c[14]=u*o/(o-u),c[15]=0;var o,a,s,h,u,c,l,d,f,_,p,g,m,v,y,x,w,E,R,T,C,I,b,P,A,S,t=i.orientation||Z,r=i.position||J;f=e,d=r,l=(s=t)[0],h=s[1],a=s[2],o=s[3],c=l*(u=l+l),r=l*(i=h+h),s=l*(t=a+a),l=h*i,h*=t,a*=t,u*=o,i*=o,t*=o,f[0]=1-(l+a),f[1]=r+t,f[2]=s-i,f[3]=0,f[4]=r-t,f[5]=1-(c+a),f[6]=h+u,f[7]=0,f[8]=s+i,f[9]=h-u,f[10]=1-(c+l),f[11]=0,f[12]=d[0],f[13]=d[1],f[14]=d[2],f[15]=1,n&&(C=A=e,T=n.offset,P=T[0],b=T[1],I=T[2],C===A?(A[12]=C[0]*P+C[4]*b+C[8]*I+C[12],A[13]=C[1]*P+C[5]*b+C[9]*I+C[13],A[14]=C[2]*P+C[6]*b+C[10]*I+C[14],A[15]=C[3]*P+C[7]*b+C[11]*I+C[15]):(_=C[0],m=C[1],x=C[2],E=C[3],p=C[4],v=C[5],S=C[6],R=C[7],g=C[8],y=C[9],w=C[10],T=C[11],A[0]=_,A[1]=m,A[2]=x,A[3]=E,A[4]=p,A[5]=v,A[6]=S,A[7]=R,A[8]=g,A[9]=y,A[10]=w,A[11]=T,A[12]=_*P+p*b+g*I+C[12],A[13]=m*P+v*b+y*I+C[13],A[14]=x*P+S*b+w*I+C[14],A[15]=E*P+R*b+T*I+C[15])),a=(t=r=e)[0],s=t[1],i=t[2],h=t[3],u=t[4],c=t[5],l=t[6],d=t[7],f=t[8],n=t[9],_=t[10],p=t[11],g=t[12],m=t[13],v=t[14],y=t[15],(t=(x=a*c-s*u)*(S=_*y-p*v)-(w=a*l-i*u)*(A=n*y-p*m)+(E=a*d-h*u)*(P=n*v-_*m)+(R=s*l-i*c)*(b=f*y-p*g)-(T=s*d-h*c)*(I=f*v-_*g)+(C=i*d-h*l)*(e=f*m-n*g))&&(t=1/t,r[0]=(c*S-l*A+d*P)*t,r[1]=(i*A-s*S-h*P)*t,r[2]=(m*C-v*T+y*R)*t,r[3]=(_*T-n*C-p*R)*t,r[4]=(l*b-u*S-d*I)*t,r[5]=(a*S-i*b+h*I)*t,r[6]=(v*E-g*C-y*w)*t,r[7]=(f*C-_*E+p*w)*t,r[8]=(u*A-c*b+d*e)*t,r[9]=(s*b-a*A-h*e)*t,r[10]=(g*T-m*E+y*x)*t,r[11]=(n*E-f*T-p*x)*t,r[12]=(c*I-u*P-l*e)*t,r[13]=(a*P-s*I+i*e)*t,r[14]=(m*w-g*R-v*x)*t,r[15]=(f*R-n*w+_*x)*t)}tt.MIN_TIMESTEP=.001,tt.MAX_TIMESTEP=1,tt.base64=function(t,e){return"data:"+t+";base64,"+e},tt.clamp=function(t,e,i){return Math.min(Math.max(e,t),i)},tt.lerp=function(t,e,i){return t+(e-t)*i},tt.isIOS=(k=/iPad|iPhone|iPod/.test(null==v?void 0:v.platform),function(){return k}),tt.isWebViewAndroid=(X=-1!==$.indexOf("Version")&&-1!==$.indexOf("Android")&&-1!==$.indexOf("Chrome"),function(){return X}),tt.isSafari=(Y=/^((?!chrome|android).)*safari/i.test($),function(){return Y}),tt.isFirefoxAndroid=(q=-1!==$.indexOf("Firefox")&&-1!==$.indexOf("Android"),function(){return q}),tt.isR7=(j=-1!==$.indexOf("R7 Build"),function(){return j}),tt.isLandscapeMode=function(){var t=90===g.orientation||-90===g.orientation;return tt.isR7()?!t:t},tt.isTimestampDeltaValid=function(t){return!isNaN(t)&&(!(t<=tt.MIN_TIMESTEP)&&!(t>tt.MAX_TIMESTEP))},tt.getScreenWidth=function(){return Math.max(g.screen.width,g.screen.height)*g.devicePixelRatio},tt.getScreenHeight=function(){return Math.min(g.screen.width,g.screen.height)*g.devicePixelRatio},tt.requestFullscreen=function(t){if(tt.isWebViewAndroid())return!1;if(t.requestFullscreen)t.requestFullscreen();else if(t.webkitRequestFullscreen)t.webkitRequestFullscreen();else if(t.mozRequestFullScreen)t.mozRequestFullScreen();else{if(!t.msRequestFullscreen)return!1;t.msRequestFullscreen()}return!0},tt.exitFullscreen=function(){if(m.exitFullscreen)m.exitFullscreen();else if(m.webkitExitFullscreen)m.webkitExitFullscreen();else if(m.mozCancelFullScreen)m.mozCancelFullScreen();else{if(!m.msExitFullscreen)return!1;m.msExitFullscreen()}return!0},tt.getFullscreenElement=function(){return m.fullscreenElement||m.webkitFullscreenElement||m.mozFullScreenElement||m.msFullscreenElement},tt.linkProgram=function(t,e,i,n){var r=t.createShader(t.VERTEX_SHADER);t.shaderSource(r,e),t.compileShader(r);e=t.createShader(t.FRAGMENT_SHADER);t.shaderSource(e,i),t.compileShader(e);var o,a=t.createProgram();for(o in t.attachShader(a,r),t.attachShader(a,e),n)t.bindAttribLocation(a,n[o],o);return t.linkProgram(a),t.deleteShader(r),t.deleteShader(e),a},tt.getProgramUniforms=function(t,e){for(var i={},n=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),r="",o=0;o<n;o++)i[r=t.getActiveUniform(e,o).name.replace("[0]","")]=t.getUniformLocation(e,r);return i},tt.orthoMatrix=function(t,e,i,n,r,o,a){var s=1/(e-i),h=1/(n-r),u=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*h,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*u,t[11]=0,t[12]=(e+i)*s,t[13]=(r+n)*h,t[14]=(a+o)*u,t[15]=1,t},tt.copyArray=function(t,e){for(var i=0,n=t.length;i<n;i++)e[i]=t[i]},tt.isMobile=function(){var t,e=!1;return t=$||(null==v?void 0:v.vendor)||g.opera,(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4)))&&(e=!0),e},tt.extend=function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return t},tt.safariCssSizeWorkaround=function(t){var e,i;tt.isIOS()&&(e=t.style.width,i=t.style.height,t.style.width=parseInt(e)+1+"px",t.style.height=parseInt(i)+"px",setTimeout(function(){t.style.width=e,t.style.height=i},100)),g.Util=tt,g.canvas=t},tt.isDebug=function(){return tt.getQueryParameter("debug")},tt.getQueryParameter=function(t){t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");t=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(location.search);return null===t?"":decodeURIComponent(t[1].replace(/\+/g," "))},tt.frameDataFromPose=(H=Math.PI/180,K=.25*Math.PI,Z=new Float32Array([0,0,0,1]),J=new Float32Array([0,0,0]),function(t,e,i){return!(!t||!e)&&(t.pose=e,t.timestamp=e.timestamp,et(t.leftProjectionMatrix,t.leftViewMatrix,e,i.getEyeParameters("left"),i),et(t.rightProjectionMatrix,t.rightViewMatrix,e,i.getEyeParameters("right"),i),!0)}),tt.isInsideCrossDomainIFrame=function(){var t=g.self!==g.top,e=tt.getDomainFromUrl(m.referrer),i=tt.getDomainFromUrl(g.location.href);return t&&e!==i},tt.getDomainFromUrl=function(t){t=-1<t.indexOf("://")?t.split("/")[2]:t.split("/")[0];return t=t.split(":")[0]};var it=function(){function t(t){this.predictionTimeS=t,this.previousQ=new W.Quaternion,this.previousTimestampS=null,this.deltaQ=new W.Quaternion,this.outQ=new W.Quaternion}return t.prototype.getPrediction=function(t,e,i){if(!this.previousTimestampS)return this.previousQ.copy(t),this.previousTimestampS=i,t;var n=new W.Vector3;n.copy(e),n.normalize();e=e.length();if(e<20*W.degToRad)return tt.isDebug()&&console.log("Moving slowly, at %s deg/s: no prediction",(W.radToDeg*e).toFixed(1)),this.outQ.copy(t),this.previousQ.copy(t),this.outQ;this.previousTimestampS;e*=this.predictionTimeS;return this.deltaQ.setFromAxisAngle(n,e),this.outQ.copy(this.previousQ),this.outQ.multiply(this.deltaQ),this.previousQ.copy(t),this.previousTimestampS=i,this.outQ},t}(),nt=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=Q,t.isAndroid=z,t.stillGyroVec=_.vec3.create(),t.rawGyroVec=_.vec3.create(),t.adjustedGyroVec=_.vec3.create(),t._timer=-1,t.lastDevicemotionTimestamp=0,t._isEnabled=!1,t.enable(),t}l(t,e);var i=t.prototype;return i.enable=function(){this.isAndroid&&g.addEventListener("deviceorientation",this._onDeviceOrientation),this.isWithoutDeviceMotion?g.addEventListener("deviceorientation",this._onChromeWithoutDeviceMotion):g.addEventListener("devicemotion",this._onDeviceMotion),this._isEnabled=!0},i.disable=function(){g.removeEventListener("deviceorientation",this._onDeviceOrientation),g.removeEventListener("deviceorientation",this._onChromeWithoutDeviceMotion),g.removeEventListener("devicemotion",this._onDeviceMotion),this._isEnabled=!1},i._onChromeWithoutDeviceMotion=function(t){var e=t.alpha,i=t.beta,t=t.gamma;null!==e&&(e=(e||0)*Math.PI/180,i=(i||0)*Math.PI/180,t=(t||0)*Math.PI/180,this.trigger(new c.ComponentEvent("devicemotion",{inputEvent:{deviceorientation:{alpha:e,beta:i,gamma:-t}}})))},i._onDeviceOrientation=function(){var t=this;this._timer&&clearTimeout(this._timer),this._timer=g.setTimeout(function(){(new Date).getTime()-t.lastDevicemotionTimestamp<200&&_.vec3.copy(t.stillGyroVec,t.rawGyroVec)},200)},i._onDeviceMotion=function(t){var e=!(null==t.rotationRate.alpha),i=!(null==t.accelerationIncludingGravity.x);0!==t.interval&&e&&i&&((i=u({},t)).interval=t.interval,i.timeStamp=t.timeStamp,i.type=t.type,i.rotationRate={alpha:t.rotationRate.alpha,beta:t.rotationRate.beta,gamma:t.rotationRate.gamma},i.accelerationIncludingGravity={x:t.accelerationIncludingGravity.x,y:t.accelerationIncludingGravity.y,z:t.accelerationIncludingGravity.z},i.acceleration={x:t.acceleration.x,y:t.acceleration.y,z:t.acceleration.z},this.isAndroid&&(_.vec3.set(this.rawGyroVec,t.rotationRate.alpha||0,t.rotationRate.beta||0,t.rotationRate.gamma||0),_.vec3.subtract(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 c.ComponentEvent("devicemotion",{inputEvent:i})))},t}(c),rt=function(){function t(t,e){this.set(t,e)}var e=t.prototype;return e.set=function(t,e){this.sample=t,this.timestampS=e},e.copy=function(t){this.set(t.sample,t.timestampS)},t}(),ot=function(){function t(t){this.addGyroMeasurement=function(t,e){this.currentGyroMeasurement.set(t,e);e-=this.previousGyroMeasurement.timestampS;tt.isTimestampDeltaValid(e)&&this.run_(),this.previousGyroMeasurement.copy(this.currentGyroMeasurement)},this.kFilter=t,this.currentAccelMeasurement=new rt,this.currentGyroMeasurement=new rt,this.previousGyroMeasurement=new rt,tt.isIOS()?this.filterQ=new W.Quaternion(-1,0,0,1):this.filterQ=new W.Quaternion(1,0,0,1),this.previousFilterQ=new W.Quaternion,this.previousFilterQ.copy(this.filterQ),this.accelQ=new W.Quaternion,this.isOrientationInitialized=!1,this.estimatedGravity=new W.Vector3,this.measuredGravity=new W.Vector3,this.gyroIntegralQ=new W.Quaternion}var e=t.prototype;return e.addAccelMeasurement=function(t,e){this.currentAccelMeasurement.set(t,e)},e.getOrientation=function(){return this.filterQ},e.run_=function(){if(!this.isOrientationInitialized)return this.accelQ=this.accelToQuaternion_(this.currentAccelMeasurement.sample),this.previousFilterQ.copy(this.accelQ),void(this.isOrientationInitialized=!0);var t=this.currentGyroMeasurement.timestampS-this.previousGyroMeasurement.timestampS,e=this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample,t);this.gyroIntegralQ.multiply(e),this.filterQ.copy(this.previousFilterQ),this.filterQ.multiply(e);t=new W.Quaternion;t.copy(this.filterQ),t.inverse(),this.estimatedGravity.set(0,0,-1),this.estimatedGravity.applyQuaternion(t),this.estimatedGravity.normalize(),this.measuredGravity.copy(this.currentAccelMeasurement.sample),this.measuredGravity.normalize();e=new W.Quaternion;e.setFromUnitVectors(this.estimatedGravity,this.measuredGravity),e.inverse(),tt.isDebug()&&console.log("Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)",W.radToDeg*tt.getQuaternionAngle(e),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));t=new W.Quaternion;t.copy(this.filterQ),t.multiply(e),this.filterQ.slerp(t,1-this.kFilter),this.previousFilterQ.copy(this.filterQ)},e.accelToQuaternion_=function(t){var e=new W.Vector3;e.copy(t),e.normalize();t=new W.Quaternion;return t.setFromUnitVectors(new W.Vector3(0,0,-1),e),t.inverse(),t},e.gyroToQuaternionDelta_=function(t,e){var i=new W.Quaternion,n=new W.Vector3;return n.copy(t),n.normalize(),i.setFromAxisAngle(n,t.length()*e),i},t}();ot.prototype.run_=function(){if(!this.isOrientationInitialized)return this.accelQ=this.accelToQuaternion_(this.currentAccelMeasurement.sample),this.previousFilterQ.copy(this.accelQ),void(this.isOrientationInitialized=!0);var t=this.currentGyroMeasurement.timestampS-this.previousGyroMeasurement.timestampS,e=this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample,t);this.gyroIntegralQ.multiply(e),this.filterQ.copy(this.previousFilterQ),this.filterQ.multiply(e);t=new W.Quaternion;t.copy(this.filterQ),t.inverse(),this.estimatedGravity.set(0,0,-1),this.estimatedGravity.applyQuaternion(t),this.estimatedGravity.normalize(),this.measuredGravity.copy(this.currentAccelMeasurement.sample),this.measuredGravity.normalize();e=new W.Quaternion;e.setFromUnitVectors(this.estimatedGravity,this.measuredGravity),e.inverse();t=new W.Quaternion;t.copy(this.filterQ),t.multiply(e),this.filterQ.slerp(t,1-this.kFilter),this.previousFilterQ.copy(this.filterQ),this.isFilterQuaternionInitialized||(this.isFilterQuaternionInitialized=!0)},ot.prototype.getOrientation=function(){return this.isFilterQuaternionInitialized?this.filterQ:null};for(var at=function(e){function t(){var t=e.call(this)||this;return t.deviceMotion=new nt,t.accelerometer=new W.Vector3,t.gyroscope=new W.Vector3,t._onDeviceMotionChange=t._onDeviceMotionChange.bind(t),t._onScreenOrientationChange=t._onScreenOrientationChange.bind(t),t.filter=new ot(.98),t.posePredictor=new it(.04),t.filterToWorldQ=new W.Quaternion,t.isFirefoxAndroid=tt.isFirefoxAndroid(),t.isIOS=x||w,t.isChromeUsingDegrees=66<=U,t._isEnabled=!1,t.isIOS?t.filterToWorldQ.setFromAxisAngle(new W.Vector3(1,0,0),Math.PI/2):t.filterToWorldQ.setFromAxisAngle(new W.Vector3(1,0,0),-Math.PI/2),t.inverseWorldToScreenQ=new W.Quaternion,t.worldToScreenQ=new W.Quaternion,t.originalPoseAdjustQ=new W.Quaternion,t.originalPoseAdjustQ.setFromAxisAngle(new W.Vector3(0,0,1),-g.orientation*Math.PI/180),t._setScreenTransform(),tt.isLandscapeMode()&&t.filterToWorldQ.multiply(t.inverseWorldToScreenQ),t.resetQ=new W.Quaternion,t.deviceMotion.on("devicemotion",t._onDeviceMotionChange),t.enable(),t}l(t,e);var i=t.prototype;return i.enable=function(){this.isEnabled()||(this.deviceMotion.enable(),this._isEnabled=!0,g.addEventListener("orientationchange",this._onScreenOrientationChange))},i.disable=function(){this.isEnabled()&&(this.deviceMotion.disable(),this._isEnabled=!1,g.removeEventListener("orientationchange",this._onScreenOrientationChange))},i.isEnabled=function(){return this._isEnabled},i.destroy=function(){this.disable(),this.deviceMotion=null},i.getOrientation=function(){var t,e=this;if(this.deviceMotion.isWithoutDeviceMotion&&this._deviceOrientationQ){this.deviceOrientationFixQ=this.deviceOrientationFixQ||(new W.Quaternion).setFromAxisAngle(new W.Vector3(0,1,0),-e._alpha),t=this._deviceOrientationQ,(n=new W.Quaternion).copy(t),n.multiply(this.filterToWorldQ),n.multiply(this.resetQ),n.multiply(this.worldToScreenQ),n.multiplyQuaternions(this.deviceOrientationFixQ,n);var i=_.quat.fromValues(n.x,n.y,n.z,n.w);return _.quat.normalize(i,i)}if(!(t=this.filter.getOrientation()))return null;var n=this._convertFusionToPredicted(t),i=_.quat.fromValues(n.x,n.y,n.z,n.w);return _.quat.normalize(i,i)},i._triggerChange=function(){var t=this.getOrientation();t&&(this._prevOrientation?_.quat.equals(this._prevOrientation,t)||this.trigger(new c.ComponentEvent("change",{quaternion:t})):this._prevOrientation=t)},i._convertFusionToPredicted=function(t){this.predictedQ=this.posePredictor.getPrediction(t,this.gyroscope,this.previousTimestampS);t=new W.Quaternion;return t.copy(this.filterToWorldQ),t.multiply(this.resetQ),t.multiply(this.predictedQ),t.multiply(this.worldToScreenQ),t},i._onDeviceMotionChange=function(t){var e=t.inputEvent,i=e.deviceorientation,n=e.accelerationIncludingGravity,t=e.adjustedRotationRate||e.rotationRate,e=e.timeStamp/1e3;i?(this._alpha||(this._alpha=i.alpha),this._deviceOrientationQ=this._deviceOrientationQ||new W.Quaternion,this._deviceOrientationQ.setFromEulerYXZ(i.beta,i.alpha,i.gamma),this._triggerChange()):(this.isFirefoxAndroid&&(e/=1e3),this.accelerometer.set(-n.x,-n.y,-n.z),this.gyroscope.set(t.alpha,t.beta,t.gamma),(this.isIOS||this.isFirefoxAndroid||this.isChromeUsingDegrees)&&this.gyroscope.multiplyScalar(Math.PI/180),this.filter.addAccelMeasurement(this.accelerometer,e),this.filter.addGyroMeasurement(this.gyroscope,e),this._triggerChange(),this.previousTimestampS=e)},i._onScreenOrientationChange=function(){this._setScreenTransform()},i._setScreenTransform=function(){this.worldToScreenQ.set(0,0,0,1);var t=g.orientation;switch(t){case 0:break;case 90:case-90:case 180:this.worldToScreenQ.setFromAxisAngle(new W.Vector3(0,0,1),t/-180*Math.PI)}this.inverseWorldToScreenQ.copy(this.worldToScreenQ),this.inverseWorldToScreenQ.inverse()},t}(c),st=function(n){function t(t,e){void 0===e&&(e={});var i=n.call(this)||this;return i.element=t,i._prevQuaternion=null,i._quaternion=null,i.fusionPoseSensor=null,i.options=u({scale:1,threshold:0},e),i._onPoseChange=i._onPoseChange.bind(i),i}l(t,n);var e=t.prototype;return e.mapAxes=function(t){this.axes=t},e.connect=function(t){return this.observer||(this.observer=t,this.fusionPoseSensor=new at,this.fusionPoseSensor.enable(),this._attachEvent()),this},e.disconnect=function(){return this.observer&&(this._dettachEvent(),this.fusionPoseSensor.disable(),this.fusionPoseSensor.destroy(),this.fusionPoseSensor=null,this.observer=null),this},e.destroy=function(){this.disconnect(),this.element=null,this.options=null,this.axes=null,this._prevQuaternion=null,this._quaternion=null},e._onPoseChange=function(t){if(!this._prevQuaternion)return this._prevQuaternion=_.quat.clone(t.quaternion),void(this._quaternion=_.quat.clone(t.quaternion));var n,e,i;_.quat.copy(this._prevQuaternion,this._quaternion),_.quat.copy(this._quaternion,t.quaternion),this.observer.change(this,t,(n=this.axes,[(e=this._prevQuaternion,i=this._quaternion,t=D.getRotationDelta(e,i,M.YAW_DELTA_BY_YAW),D.getRotationDelta(e,i,M.YAW_DELTA_BY_ROLL)*Math.sin(D.extractPitchFromQuat(i))+t),(i=this._prevQuaternion,t=this._quaternion,D.getRotationDelta(i,t,M.PITCH_DELTA))].reduce(function(t,e,i){return n[i]&&(t[n[i]]=e),t},{})))},e._attachEvent=function(){this.fusionPoseSensor.on("change",this._onPoseChange)},e._dettachEvent=function(){this.fusionPoseSensor.off("change",this._onPoseChange)},t}(c),ht=null,ut=0,ct=function(){function t(){if(ut++,ht)return ht;(ht=this)._onDeviceOrientation=this._onDeviceOrientation.bind(this),this._onOrientationChange=this._onOrientationChange.bind(this),this._spinR=0,this._screenOrientationAngle=0,g.addEventListener("deviceorientation",this._onDeviceOrientation),g.addEventListener("orientationchange",this._onOrientationChange)}var e=t.prototype;return e.getRadian=function(){return this._spinR+_.glMatrix.toRadian(this._screenOrientationAngle)},e.unref=function(){0<--ut||(g.removeEventListener("deviceorientation",this._onDeviceOrientation),g.removeEventListener("orientationchange",this._onOrientationChange),this._spinR=0,this._screenOrientationAngle=0,ht=null,ut=0)},e._onDeviceOrientation=function(t){var e;null!==t.beta&&null!==t.gamma&&(e=_.glMatrix.toRadian(t.beta),t=_.glMatrix.toRadian(t.gamma),this._spinR=Math.atan2(Math.cos(e)*Math.sin(t),Math.sin(e)))},e._onOrientationChange=function(){g.screen&&g.screen.orientation&&void 0!==g.screen.orientation.angle?this._screenOrientationAngle=screen.orientation.angle:void 0!==g.orientation&&(this._screenOrientationAngle=0<=g.orientation?g.orientation:360+g.orientation)},t}(),lt=function(r){function t(t,e){void 0===e&&(e={});t=r.call(this,t,e)||this;return t._useRotation=!1,t._screenRotationAngle=null,t.setUseRotation(!(!e||!e.useRotation)),t._userDirection=h.DIRECTION_ALL,t}l(t,r);var e=t.prototype;return e.setUseRotation=function(t){this._useRotation=t,this._screenRotationAngle&&(this._screenRotationAngle.unref(),this._screenRotationAngle=null),this._useRotation&&(this._screenRotationAngle=new ct)},e.connect=function(t){return this._userDirection=this._direction,this._useRotation&&this._direction&h.DIRECTION_ALL&&(this._direction=h.DIRECTION_HORIZONTAL),r.prototype.connect.call(this,t)},e.destroy=function(){this._useRotation&&this._screenRotationAngle&&this._screenRotationAngle.unref(),r.prototype.destroy.call(this)},e.getOffset=function(t,e){if(!1===this._useRotation)return r.prototype.getOffset.call(this,t,e);var i=r.prototype.getOffset.call(this,t,[!0,!0]),n=[0,0],e=this._screenRotationAngle.getRadian(),t=Math.cos(e),e=Math.sin(e);return n[0]=i[0]*t-i[1]*e,n[1]=i[1]*t+i[0]*e,this._userDirection&h.DIRECTION_HORIZONTAL?this._userDirection&h.DIRECTION_VERTICAL||(n[1]=0):n[0]=0,n},t}(h.PanInput),dt=_.vec3.fromValues(0,1,0),ft=function(t){function e(){var e=t.call(this)||this;return e._fusionPoseSensor=new at,e._quaternion=_.quat.create(),e._fusionPoseSensor.enable(),e._fusionPoseSensor.on("change",function(t){e._quaternion=t.quaternion,e.trigger(new c.ComponentEvent("change",{isTrusted:!0}))}),e}l(e,t);var i=e.prototype;return i.getCombinedQuaternion=function(t){var e=_.quat.setAxisAngle(_.quat.create(),dt,_.glMatrix.toRadian(-t)),t=_.quat.conjugate(_.quat.create(),this._quaternion);return _.quat.multiply(_.quat.create(),t,e)},i.destroy=function(){this.off(),this._fusionPoseSensor&&(this._fusionPoseSensor.off(),this._fusionPoseSensor.destroy(),this._fusionPoseSensor=null)},e}(c),_t=[-180,180],pt=[-90,90],gt=[-180,180],mt=function(i){function t(t){var e=i.call(this)||this;e.options={};t=u({element:null,yaw:0,pitch:0,fov:65,showPolePoint:!1,useZoom:!0,useKeyboard:!0,gyroMode:B.YAWPITCH,touchDirection:6,yawRange:_t,pitchRange:pt,fovRange:[30,110],aspectRatio:1},t);return e._element=t.element,e._initialFov=t.fov,e._enabled=!1,e._isAnimating=!1,e._deviceQuaternion=null,e._initAxes(t),e.option(t),e}l(t,i);var e=t.prototype;return e.updatePanScale=function(t){void 0===t&&(t={});var e=this._axes.get().fov,t=t.height||parseInt(window.getComputedStyle(this._element).height,10),t=G[0]*e/this._initialFov*320/t;return this._axesPanInput.options.scale=[t,t],this._axes.options.deceleration=.0014*e/110,this},e.option=function(t,e){if(!t)return this._getOptions();if(t&&"string"==typeof t&&void 0===e)return this._getOptions(t);var i={},n=[];return"string"==typeof t?(n.push(t),i[t]=e):(t=t,n=Object.keys(t),i=u({},t)),this._setOptions(this._getValidatedOptions(i)),this._applyOptions(n),this},e.enable=function(){return this._enabled||(this._enabled=!0,this._applyOptions(Object.keys(this.options)),this.updatePanScale()),this},e.disable=function(t){return void 0===t&&(t=!1),this._enabled&&(t||this._resetOrientation(),this._axes.disconnect(),this._enabled=!1),this},e.lookAt=function(t,e){var i=t.yaw,n=t.pitch,r=t.fov,t=this._axes.get(),i=void 0===i?0:i-t.yaw,n=void 0===n?0:n-t.pitch,t=void 0===r?0:r-t.fov;this._axes.options.maximumDuration=1/0,this._axes.setBy({yaw:i,pitch:n,fov:t},e)},e.getYawPitch=function(){var t=this._axes.get();return{yaw:t.yaw,pitch:t.pitch}},e.getFov=function(){return this._axes.get().fov},e.getQuaternion=function(){var t=this._axes.get();return this._deviceQuaternion.getCombinedQuaternion(t.yaw)},e.shouldRenderWithQuaternion=function(){return this.options.gyroMode===B.VR},e.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()},e._initAxes=function(t){var e=this,i=this._updateYawRange(t.yawRange,t.fov,t.aspectRatio),n=this._updatePitchRange(t.pitchRange,t.fov,t.showPolePoint),r=t.gyroMode===B.VR;this._axesPanInput=new lt(this._element,{useRotation:r}),this._axesWheelInput=new h.WheelInput(this._element,{scale:-4}),this._axesTiltMotionInput=null,this._axesPinchInput=T?new h.PinchInput(this._element,{scale:-1}):null,this._axesMoveKeyInput=new h.MoveKeyInput(this._element,{scale:[-6,6]}),this._axes=new h({yaw:{range:i,circular:this._isCircular(i),bounce:[0,0]},pitch:{range:n,circular:this._isCircular(n),bounce:[0,0]},fov:{range:t.fovRange,circular:[!1,!1],bounce:[0,0]}},{deceleration:.0014,maximumDuration:1e3},{yaw:t.yaw,pitch:t.pitch,fov:t.fov}).on({hold:function(t){e._axes.options.maximumDuration=1e3,e.trigger(new c.ComponentEvent("hold",{isTrusted:t.isTrusted}))},change:function(t){0!==t.delta.fov&&(e._updateControlScale(t),e.updatePanScale()),e._triggerChange(t)},release:function(t){e._triggerChange(t)},animationEnd:function(t){e.trigger(new c.ComponentEvent("animationEnd",{isTrusted:t.isTrusted}))}})},e._getValidatedOptions=function(t){return t.yawRange&&(t.yawRange=this._getValidYawRange(t.yawRange,t.fov,t.aspectRatio)),t.pitchRange&&(t.pitchRange=this._getValidPitchRange(t.pitchRange,t.fov)),t},e._getOptions=function(t){var e;return"string"==typeof t?e=this.options[t]:0===arguments.length&&(e=this.options),e},e._setOptions=function(t){for(var e in t)this.options[e]=t[e]},e._applyOptions=function(t){var e,i,n,r=this.options,o=this._axes,a=r.gyroMode===B.VR,s=r.gyroMode===B.YAWPITCH,h=a?2&r.touchDirection:r.touchDirection;t.some(function(t){return"showPolePoint"===t||"fov"===t||"aspectRatio"===t||"yawRange"===t||"pitchRange"===t})&&(0<=t.indexOf("fov")&&(o.setTo({fov:r.fov}),this.updatePanScale()),this._updateControlScale()),t.some(function(t){return"fovRange"===t})&&(e=r.fovRange,i=o.get().fov,n=o.get().fov,_.vec2.copy(o.axis.fov.range,e),n<e[0]?n=e[0]:i>e[1]&&(n=e[1]),i!==n&&(o.setTo({fov:n},0),this._updateControlScale(),this.updatePanScale())),t.some(function(t){return"gyroMode"===t})&&C&&(this._axesTiltMotionInput&&(this._axes.disconnect(this._axesTiltMotionInput),this._axesTiltMotionInput.destroy(),this._axesTiltMotionInput=null),this._deviceQuaternion&&(this._deviceQuaternion.destroy(),this._deviceQuaternion=null),a?this._initDeviceQuaternion():s&&(this._axesTiltMotionInput=new st(this._element),this._axes.connect(["yaw","pitch"],this._axesTiltMotionInput)),this._axesPanInput.setUseRotation(a)),t.some(function(t){return"useKeyboard"===t})&&(r.useKeyboard?o.connect(["yaw","pitch"],this._axesMoveKeyInput):o.disconnect(this._axesMoveKeyInput)),t.some(function(t){return"useZoom"===t})&&(a=r.useZoom,o.disconnect(this._axesWheelInput),a&&o.connect(["fov"],this._axesWheelInput)),this._togglePinchInputByOption(r.touchDirection,r.useZoom),t.some(function(t){return"touchDirection"===t})&&this._enabled&&this._enableTouch(h)},e._togglePinchInputByOption=function(t,e){this._axesPinchInput&&(this._axes.disconnect(this._axesPinchInput),e&&6===t&&-1===this._axes._inputs.indexOf(this._axesPinchInput)&&this._axes.connect(["fov"],this._axesPinchInput))},e._enableTouch=function(t){this._axesPanInput&&this._axes.disconnect(this._axesPanInput);var e=2&t?"yaw":null,t=4&t?"pitch":null;this._axes.connect([e,t],this._axesPanInput)},e._initDeviceQuaternion=function(){var e=this;this._deviceQuaternion=new ft,this._deviceQuaternion.on("change",function(t){e._triggerChange(t)})},e._getValidYawRange=function(t,e,i){i=this._adjustAspectRatio(i||this.options.aspectRatio||1),i=(e||this._axes.get().fov)*i;return t[1]-t[0]>=i?t:this.options.yawRange||_t},e._getValidPitchRange=function(t,e){e=e||this._axes.get().fov;return t[1]-t[0]>=e?t:this.options.pitchRange||pt},e._isCircular=function(t){return t[1]-t[0]<360?[!1,!1]:[!0,!0]},e._updateControlScale=function(t){var e=this.options,i=this._axes.get().fov,n=this._updatePitchRange(e.pitchRange,i,e.showPolePoint),r=this._updateYawRange(e.yawRange,i,e.aspectRatio),i=this._axes.get(),e=i.yaw,i=i.pitch;return _.vec2.copy(this._axes.axis.yaw.range,r),_.vec2.copy(this._axes.axis.pitch.range,n),this._axes.axis.yaw.circular=this._isCircular(r),this._axes.axis.pitch.circular=this._isCircular(n),e<r[0]?e=r[0]:e>r[1]&&(e=r[1]),i<n[0]?i=n[0]:i>n[1]&&(i=n[1]),t&&t.set({yaw:e,pitch:i}),this._axes.setTo({yaw:e,pitch:i},0),this},e._updatePitchRange=function(t,e,i){if(this.options.gyroMode===B.VR)return gt;var n=t[1]-t[0],e=e/2;return!i||n<180?[t[0]+e,t[1]-e]:t.concat()},e._updateYawRange=function(t,e,i){if(this.options.gyroMode===B.VR)return _t;if(360<=t[1]-t[0])return t.concat();e=D.toDegree(Math.atan2(i,1/Math.tan(_.glMatrix.toRadian(e/2))));return[t[0]+e,t[1]-e]},e._triggerChange=function(t){var e=this._axes.get(),i=this.options,t={targetElement:i.element,isTrusted:t.isTrusted,yaw:e.yaw,pitch:e.pitch,fov:e.fov,quaternion:null};i.gyroMode===B.VR&&this._deviceQuaternion&&(t.quaternion=this._deviceQuaternion.getCombinedQuaternion(e.yaw)),this.trigger(new c.ComponentEvent("change",t))},e._adjustAspectRatio=function(t){for(var e=[.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],i=[.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],n=-1,r=0;r<e.length-1;r++)if(e[r]<=t&&t<=e[r+1]){n=r;break}if(-1===n)return t<e[0]?i[0]:i[i[0].length-1];var o=e[n],a=e[n+1],s=i[n],i=i[n+1];return this._lerp(s,i,(t-o)/(a-o))},e._lerp=function(t,e,i){return t+i*(e-t)},e._resetOrientation=function(){var t=this.options;return this._axes.setTo({yaw:t.yaw,pitch:t.pitch,fov:t.fov},0),this},t.VERSION=n,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}(c),vt={INVALID_DEVICE:10,NO_WEBGL:11,FAIL_IMAGE_LOAD:12,FAIL_BIND_TEXTURE:13,INVALID_RESOURCE:14,RENDERING_CONTEXT_LOST:15},yt={READY:"ready",VIEW_CHANGE:"viewChange",ANIMATION_END:"animationEnd",ERROR:"error"},xt={EQUIRECTANGULAR:"equirectangular",CUBEMAP:"cubemap",CUBESTRIP:"cubestrip",PANORAMA:"panorama",STEREOSCOPIC_EQUI:"stereoequi"},wt={TOP_BOTTOM:"3dv",LEFT_RIGHT:"3dh",NONE:""},Et="view360-canvas",Rt=function(n){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];return t.forEach(function(i){Object.keys(i).forEach(function(t){var e=i[t];Array.isArray(n[t])&&Array.isArray(e)?n[t]=p(n[t],e):n[t]=e})}),n},Tt=function(t,e){var i,n;if("object"==typeof e?(i=e.src,n=e.type):"string"==typeof e&&(i=e),!i)return!1;e=document.createElement("source");e.src=i,n&&(e.type=n),t.appendChild(e)},Ct={0:"NO_ERROR",1280:"INVALID_ENUM",1281:"INVALID_VALUE",1282:"INVALID_OPERATION",1285:"OUT_OF_MEMORY",1286:"INVALID_FRAMEBUFFER_OPERATION",37442:"CONTEXT_LOST_WEBGL"},It=null,bt=function(){function e(){}return e.createShader=function(t,e,i){e=t.createShader(e);return t.shaderSource(e,i),t.compileShader(e),t.getShaderParameter(e,t.COMPILE_STATUS)?e:(console.error(t.getShaderInfoLog(e)),null)},e.createProgram=function(t,e,i){var n=t.createProgram();return t.attachShader(n,e),t.attachShader(n,i),t.linkProgram(n),t.deleteShader(e),t.deleteShader(i),t.getProgramParameter(n,t.LINK_STATUS)?n:(t.deleteProgram(n),null)},e.initBuffer=function(t,e,i,n,r){var o=t.createBuffer();return t.bindBuffer(e,o),t.bufferData(e,i,t.STATIC_DRAW),o&&(o.itemSize=n,o.numItems=i.length/n),void 0!==r&&(t.enableVertexAttribArray(r),t.vertexAttribPointer(r,o.itemSize,t.FLOAT,!1,0,0)),o},e.getWebglContext=function(t,e){var i,n,r=null,o=u({preserveDrawingBuffer:!1,antialias:!1},e),e=function(t){return t.statusMessage};t.addEventListener("webglcontextcreationerror",e);try{for(var a=f(["webgl","experimental-webgl","webkit-3d","moz-webgl"]),s=a.next();!s.done;s=a.next()){var h=s.value;try{r=t.getContext(h,o)}catch(t){}if(r)break}}catch(t){i={error:t}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(i)throw i.error}}return t.removeEventListener("webglcontextcreationerror",e),r},e.createTexture=function(t,e){var i=t.createTexture();return t.bindTexture(e,i),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(e,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(e,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.bindTexture(e,null),i},e.isWebGLAvailable=function(){var t;return null===It&&(t=document.createElement("canvas"),t=e.getWebglContext(t),It=!!t,!t||(t=t.getExtension("WEBGL_lose_context"))&&t.loseContext()),!!It},e.isStableWebGL=function(){var t,e=a(),i=!0;return"android"!==e.os.name||((t=parseFloat(e.os.version))<=4.3&&1<=t||4.4===t&&"chrome"!==e.browser.name)&&(i=!1),i},e.getErrorNameFromWebGLErrorCode=function(t){return t in Ct?Ct[t]:"UNKNOWN_ERROR"},e.texImage2D=function(t,e,i){try{t.texImage2D(e,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,i)}catch(t){console.error("WebGLUtils.texImage2D error:",t)}},e.getMaxTextureSize=function(t){return t.getParameter(t.MAX_TEXTURE_SIZE)},e}(),e=a(),Pt="ie"===e.browser.name&&11===e.browser.majorVersion,At={ERROR:"error"},St=function(e){function t(){var t=e.call(this)||this;return t._forceDimension=null,t._pixelCanvas=null,t._pixelContext=null,t}l(t,e);var i=t.prototype;return i.render=function(t){var e=t.gl,i=t.shaderProgram,n=t.indexBuffer,r=t.mvMatrix,t=t.pMatrix;e.uniformMatrix4fv(i.pMatrixUniform,!1,t),e.uniformMatrix4fv(i.mvMatrixUniform,!1,r),n&&e.drawElements(e.TRIANGLES,n.numItems,e.UNSIGNED_SHORT,0)},i.getDimension=function(t){return{width:t.naturalWidth||t.videoWidth,height:t.naturalHeight||t.videoHeight}},i.updateShaderData=function(t){},i._initPixelSource=function(t,e){var i;void 0===e&&(e=null),(Pt&&t instanceof HTMLVideoElement||e)&&(t=(i=e||this.getDimension(t)).width,i=i.height,this._pixelCanvas=document.createElement("canvas"),this._pixelCanvas.width=t,this._pixelCanvas.height=i,this._pixelContext=this._pixelCanvas.getContext("2d")),this._forceDimension=e},i._getPixelSource=function(t){if(!this._pixelCanvas)return t;var e=this.getDimension(t),i=this._forceDimension||e;return this._pixelCanvas.width!==i.width&&(this._pixelCanvas.width=i.width),this._pixelCanvas.height!==i.height&&(this._pixelCanvas.height=i.height),this._forceDimension?this._pixelContext.drawImage(t,0,0,e.width,e.height,0,0,i.width,i.height):this._pixelContext.drawImage(t,0,0),this._pixelCanvas},i._extractTileConfig=function(t){return(Array.isArray(t.tileConfig)?t.tileConfig:Array.apply(void 0,p(Array(6))).map(function(){return t.tileConfig})).map(function(t){return u({flipHorizontal:!1,rotation:0},t)})},i._triggerError=function(t){console.error("Renderer Error:",t),this.trigger(new c.ComponentEvent(At.ERROR,{message:"string"==typeof t?t:t.message}))},t.EVENTS=At,t}(c),Ot=function(t){function u(){return null!==t&&t.apply(this,arguments)||this}l(u,t);var e=u.prototype;return u.extractOrder=function(t){return t.order||"RLUDBF"},e.getVertexPositionData=function(){return u._VERTEX_POSITION_DATA=null!==u._VERTEX_POSITION_DATA?u._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]},e.getIndexData=function(){if(u._INDEX_DATA)return u._INDEX_DATA;for(var t=[],e=this.getVertexPositionData(),i=0;i<e.length/3;i+=4)t.push(i,i+2,i+1,i,i+3,i+2);return u._INDEX_DATA=t},e.getTextureCoordData=function(t){var e=this,i=t.image,t=t.imageConfig,n=u.extractOrder(t),h=this.getVertexPositionData(),r=this._extractTileConfig(t),o=t.trim;return"BFUDRL".split("").map(function(t){return r[n.indexOf(t)]}).map(function(t,e){for(var i=Math.floor(t.rotation/90),n=t.flipHorizontal?[0,1,2,3]:[1,0,3,2],r=0;r<Math.abs(i);r++)t.flipHorizontal&&0<i||!t.flipHorizontal&&i<0?n.push(n.shift()):n.unshift(n.pop());for(var o=h.slice(12*e,12*e+12),a=[],s=0;s<4;s++)a[n[s]]=o.splice(0,3);return a}).map(function(t){return e._shrinkCoord({image:i,faceCoords:t,trim:o})}).reduce(function(t,e){return p(t,e.reduce(function(t,e){return p(t,e)},[]))},[])},e.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}"},e.getFragmentShaderSource=function(){return"\nprecision highp float;\nuniform samplerCube uSampler;\nvarying highp vec3 vVertexDirectionVector;\nvoid main(void) {\n gl_FragColor = textureCube(uSampler, vVertexDirectionVector);\n}"},e.updateTexture=function(t,e,i){var i=u.extractOrder(i),n={};i.split("").forEach(function(t,e){n[t]=e});try{if(e instanceof Array)for(var r=0;r<6;r++){var o=n["RLUDBF"[r]];bt.texImage2D(t,t.TEXTURE_CUBE_MAP_POSITIVE_X+r,e[o])}else for(var a=this.getMaxCubeMapTextureSize(t,e),r=0;r<6;r++){var o=n["RLUDBF"[r]],s=this.extractTileFromImage(e,o,a);bt.texImage2D(t,t.TEXTURE_CUBE_MAP_POSITIVE_X+r,s)}}catch(t){this._triggerError(t)}},e.bindTexture=function(t,e,i,n){t.bindTexture(t.TEXTURE_CUBE_MAP,e),this.updateTexture(t,i,n)},e.getSourceTileSize=function(t){var e=this.getDimension(t),i=e.width,t=e.height,e=i/t,i=e==1/6?i:6==e?t:e==2/3?i/2:i/3;return i},e.extractTileFromImage=function(t,e,i){var n=this.getDimension(t).width,r=this.getSourceTileSize(t),o=document.createElement("canvas");o.width=i,o.height=i;var a=o.getContext("2d"),s=n/r,n=r*e%(r*s),s=Math.floor(e/s)*r;return a.drawImage(t,n,s,r,r,0,0,i,i),o},e.getMaxCubeMapTextureSize=function(t,e){var i=a(),n=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),r=this.getSourceTileSize(e);if("ie"===i.browser.name&&11===i.browser.majorVersion&&!D.isPowerOfTwo(r))for(var o=1;o<n;o*=2)if(!(o<r)){r=o;break}return"ios"===i.os.name&&(9===(i=i.os.majorVersion)&&(r=1024),8===i&&(r=512)),Math.min(n,r)},e._shrinkCoord=function(t){var e=t.image,n=t.faceCoords,i=1-t.trim*(2/(Array.isArray(e)?this.getDimension(e[0]).width:this.getSourceTileSize(e))),r=[0,1,2].map(function(e){var i=D.sign(n[0][e]);return n.some(function(t){return D.sign(t[e])!==i})}).map(function(t){return t?i:1});return n.map(function(t){return t.map(function(t,e){return t*r[e]})})},u._VERTEX_POSITION_DATA=null,u._INDEX_DATA=null,u}(St),Dt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}l(e,t);var i=e.prototype;return i.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}"},i.getFragmentShaderSource=function(){return"\n#define PI 3.14159265359\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nuniform bool uIsEAC;\nconst vec2 OPERATE_COORDS_RANGE = vec2(-1.0, 1.0);\nconst vec2 TEXTURE_COORDS_RANGE = vec2(0.0, 1.0);\n// vector type is used for initializing values instead of array.\nconst vec4 TEXTURE_DIVISION_X = vec4(0.0, 1.0 / 3.0, 2.0 / 3.0, 1.0);\nconst vec3 TEXTURE_DIVISION_Y = vec3(0.0, 1.0 / 2.0, 1.0);\nconst float EAC_CONST = 2.0 / PI;\nfloat scale(vec2 domainRange, vec2 targetRange, float val) {\n float unit = 1.0 / (domainRange[1] - domainRange[0]);\n return targetRange[0] + (targetRange[1] - targetRange[0]) * (val - domainRange[0]) * unit;\n}\nvoid main(void) {\n float transformedCoordX;\n float transformedCoordY;\n\n if (uIsEAC) {\n vec2 orgTextureRangeX;\n vec2 orgTextureRangeY;\n\n // Apply EAC transform\n if (vTextureCoord.s >= 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}"},i.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},i.getIndexData=function(){var i=this;return function(){for(var t=[],e=0;e<i._vertices.length/3;e+=4)t.push(e,e+1,e+2,e,e+2,e+3);return t}()},i.getTextureCoordData=function(t){for(var i=this,e=t.image,t=t.imageConfig,n=this.getDimension(e),r=t.trim,o=t.order||"RLUDFB",a=[],s=1;0<=s;s--)for(var h=0;h<3;h++){var u=[h/3,s/2,(h+1)/3,s/2,(h+1)/3,(s+1)/2,h/3,(s+1)/2];a.push(u)}var c=this._extractTileConfig(t),a=a.map(function(t){return i._shrinkCoord(t,n,r)}).map(function(t,e){return i._transformCoord(t,c[e])});return"BFUDRL".split("").map(function(t){return o.indexOf(t)}).map(function(t){return a[t]}).reduce(function(t,e){return t.concat(e)},[])},i.updateTexture=function(t,e){bt.texImage2D(t,t.TEXTURE_2D,this._getPixelSource(e))},i.bindTexture=function(t,e,i){var n=this.getDimension(i),r=n.width,o=n.height,n=Math.max(r,o),o=bt.getMaxTextureSize(t);o<n?this._triggerError("Image width("+r+") exceeds device limit("+o+"))"):(this._initPixelSource(i),t.activeTexture(t.TEXTURE0),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!0),t.bindTexture(t.TEXTURE_2D,e),this.updateTexture(t,i))},i._transformCoord=function(t,e){t=t.slice();return e.flipHorizontal&&(t=this._flipHorizontalCoord(t)),e.rotation&&(t=this._rotateCoord(t,e.rotation)),t},i._shrinkCoord=function(t,e,i){var n=e.width,e=i*(1/e.height),n=i*(1/n);return[t[0]+n,t[1]+e,t[2]-n,t[3]+e,t[4]-n,t[5]-e,t[6]+n,t[7]-e]},i._rotateCoord=function(t,e){var i,e=Math.floor(e/90)%4;if(0==e)return t;return 0<e?(i=t.splice(0,2*e),t.concat(i)):(i=t.splice(2*(4+e),2*-e)).concat(t)},i._flipHorizontalCoord=function(t){return[t[2],t[3],t[0],t[1],t[6],t[7],t[4],t[5]]},e}(St),Mt=-.5*Math.PI,Vt=[],Ft=[],Lt=[],Nt=0;Nt<=60;Nt++)for(var Ut=(Nt/60-.5)*Math.PI,Qt=Math.sin(Ut),zt=Math.cos(Ut),Gt=0;Gt<=60;Gt++){var Bt=2*(Gt/60-.5)*Math.PI+Mt,Wt=Math.sin(Bt),kt=Math.cos(Bt)*zt,Xt=Qt,Yt=Wt*zt,Bt=Gt/60,Wt=Nt/60;Vt.push(Bt,Wt),Ft.push(2*kt,2*Xt,2*Yt),60!==Gt&&60!==Nt&&(Yt=(Xt=61*Nt+Gt)+60+1,Lt.push(Xt,Yt,Xt+1,Yt,Yt+1,Xt+1))}var qt=function(o){function t(t){var e=o.call(this)||this;return e._stereoFormat=t,e}l(t,o);var e=t.prototype;return e.render=function(t){var e,i,n=t.gl,r=t.shaderProgram;switch(this._stereoFormat){case wt.TOP_BOTTOM:e=[1,.5,0,0],i=[1,.5,0,.5];break;case wt.LEFT_RIGHT:e=[.5,1,0,0],i=[.5,1,.5,0];break;default:e=[1,1,0,0],i=[1,1,0,0]}r=n.getUniformLocation(r,"uTexScaleOffset");n.uniform4fv(r,p(e,i)),o.prototype.render.call(this,t)},e.getVertexPositionData=function(){return t._VERTEX_POSITION_DATA},e.getIndexData=function(){return t._INDEX_DATA},e.getTextureCoordData=function(){return t._TEXTURE_COORD_DATA},e.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}"},e.getFragmentShaderSource=function(){return"\nprecision highp float;\nvarying highp vec2 vTextureCoord;\nuniform sampler2D uSampler;\nvoid main(void) {\n gl_FragColor = texture2D(uSampler, vTextureCoord.st);\n}"},e.updateTexture=function(t,e){bt.texImage2D(t,t.TEXTURE_2D,this._getPixelSource(e))},e.bindTexture=function(t,e,i){var n=this.getDimension(i),r=n.width,o=n.height,n=Math.max(r,o),o=bt.getMaxTextureSize(t);o<n?this._triggerError("Image width("+r+") exceeds device limit("+o+"))"):(this._initPixelSource(i),t.activeTexture(t.TEXTURE0),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!0),t.bindTexture(t.TEXTURE_2D,e),this.updateTexture(t,i))},t._VERTEX_POSITION_DATA=Ft,t._TEXTURE_COORD_DATA=Vt,t._INDEX_DATA=Lt,t}(St),jt=[],Ht=[],Kt=[],Zt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}l(e,t);var i=e.prototype;return i.getVertexPositionData=function(){return e._VERTEX_POSITION_DATA},i.getIndexData=function(){return e._INDEX_DATA},i.getTextureCoordData=function(){return e._TEXTURE_COORD_DATA},i.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}"},i.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}"},i.updateTexture=function(t,e){bt.texImage2D(t,t.TEXTURE_2D,this._getPixelSource(e))},i.bindTexture=function(t,e,i){var n,r=this.getDimension(i),o=r.width,a=r.height,s=Math.max(o,a),r=bt.getMaxTextureSize(t);r<s&&(this._triggerError("Image width("+o+") exceeds device texture limit("+r+"))"),n=a<o?{width:r,height:r*a/o}:{width:r*o/a,height:r}),this._initPixelSource(i,n),t.activeTexture(t.TEXTURE0),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!0),t.bindTexture(t.TEXTURE_2D,e),this.updateTexture(t,i)},i.updateShaderData=function(t){var e,i,n,r=t.imageAspectRatio,t=void 0===r?6:r,r=t<1?(i=!0,1/t):(i=!1,t);r=6<=r?(t=360/r,n=2*Math.PI,Math.tan(_.glMatrix.toRadian(t/2))):(n=r,.5),jt.length=0,Ht.length=0,Kt.length=0;for(var o=[-r,r],a=Math.PI/2+(2*Math.PI-n)/2,s=0,h=o.length;s<h;s++)for(e=0;e<=60;e++){var u=a+e/60*n,c=Math.cos(u),l=o[s],d=Math.sin(u),f=void 0,u=void 0,u=i?(f=1-s,e/60):(f=e/60,s);jt.push(f,u),Ht.push(c,l,d),0===s&&e<60&&(d=e+60+1,Kt.push(e,d,e+1,d,d+1,e+1))}},e._VERTEX_POSITION_DATA=Ht,e._TEXTURE_COORD_DATA=jt,e._INDEX_DATA=Kt,e}(St),Jt="vrdisplaypresentchange",$t=[0,0,.5,1],te=[.5,0,.5,1],ee="left",ie="right",ne=function(){function t(){var e=this;this.destroy=function(){var t=e._vrDisplay;e.removeEndCallback(e.destroy),t&&t.isPresenting&&t.exitPresent(),e._clear()},this._frameData=new window.VRFrameData,this._clear()}var e=t.prototype;return Object.defineProperty(e,"context",{get:function(){return this._vrDisplay},enumerable:!1,configurable:!0}),e.canRender=function(){return Boolean(this._vrDisplay)},e.beforeRender=function(t){t.bindFramebuffer(t.FRAMEBUFFER,null)},e.afterRender=function(){this._vrDisplay.submitFrame()},e.getEyeParams=function(t){var e=this._vrDisplay,i=.5*t.drawingBufferWidth,n=t.drawingBufferHeight,r=this._frameData;e.getFrameData(r);t=r.leftViewMatrix,e=r.rightViewMatrix;return _.mat4.rotateY(t,t,this._yawOffset),_.mat4.rotateY(e,e,this._yawOffset),[{viewport:[0,0,i,n],mvMatrix:t,pMatrix:r.leftProjectionMatrix},{viewport:[i,0,i,n],mvMatrix:e,pMatrix:r.rightProjectionMatrix}]},e.isPresenting=function(){return Boolean(this._vrDisplay&&this._vrDisplay.isPresenting)},e.addEndCallback=function(t){window.addEventListener(Jt,t)},e.removeEndCallback=function(t){window.removeEventListener(Jt,t)},e.requestPresent=function(n){var r=this;return navigator.getVRDisplays().then(function(t){var i=t.length&&t[0];return i?i.capabilities.canPresent?i.requestPresent([{source:n}]).then(function(){var t=i.getEyeParameters(ee),e=i.getEyeParameters(ie);n.width=2*Math.max(t.renderWidth,e.renderWidth),n.height=Math.max(t.renderHeight,e.renderHeight),r._setDisplay(i)}):s.reject(new Error("Display lacking capability to present.")):s.reject(new Error("No displays available."))})},e.setYawOffset=function(t){this._yawOffset=t},e._setDisplay=function(t){t=(this._vrDisplay=t).getLayers();t.length&&(t=t[0],this._leftBounds=t.leftBounds,this._rightBounds=t.rightBounds),this.addEndCallback(this.destroy)},e._clear=function(){this._vrDisplay=null,this._leftBounds=$t,this._rightBounds=te,this._yawOffset=0},t}(),re=function(){function t(t){var e=this;void 0===t&&(t={}),this.destroy=function(){var t=e._xrSession;e.removeEndCallback(e.destroy),t&&t.end().then(function(){},function(){}),e._clear()},this._clear(),this._options=t}var e=t.prototype;return Object.defineProperty(e,"context",{get:function(){return this._xrSession},enumerable:!1,configurable:!0}),e.canRender=function(t){t=t.getViewerPose(this._xrRefSpace);return Boolean(t)},e.beforeRender=function(t,e){e=e.session.renderState.baseLayer;t.bindFramebuffer(t.FRAMEBUFFER,e.framebuffer)},e.afterRender=function(){},e.getEyeParams=function(t,e){var n=this,i=e.session,e=e.getViewerPose(this._xrRefSpace);if(!e)return null;var r=i.renderState.baseLayer;return e.views.map(function(t){var e=r.getViewport(t),i=t.transform.inverse.matrix;return w&&_.mat4.rotateX(i,i,_.glMatrix.toRadian(180)),_.mat4.rotateY(i,i,n._yawOffset),{viewport:[e.x,e.y,e.width,e.height],mvMatrix:i,pMatrix:t.projectionMatrix}})},e.isPresenting=function(){return this._presenting},e.addEndCallback=function(t){var e;null!==(e=this._xrSession)&&void 0!==e&&e.addEventListener("end",t)},e.removeEndCallback=function(t){var e;null!==(e=this._xrSession)&&void 0!==e&&e.removeEventListener("end",t)},e.requestPresent=function(t,r){return i(this,void 0,void 0,function(){var e,i,n=this;return d(this,function(t){switch(t.label){case 0:return e=Rt({requiredFeatures:["local"]},this._options),(i=r.getContextAttributes())&&!0!==i.xrCompatible?[4,r.makeXRCompatible()]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2,navigator.xr.requestSession("immersive-vr",e).then(function(e){var i=new window.XRWebGLLayer(e,r);return e.updateRenderState({baseLayer:i}),e.requestReferenceSpace("local").then(function(t){n._setSession(e,i,t)})})]}})})},e.setYawOffset=function(t){this._yawOffset=t},e._setSession=function(t,e,i){this._xrSession=t,this._xrLayer=e,this._xrRefSpace=i,this._presenting=!0,this.addEndCallback(this.destroy)},e._clear=function(){this._xrSession=null,this._xrLayer=null,this._xrRefSpace=null,this._presenting=!1,this._yawOffset=0,this._options={}},t}(),oe=function(){function t(){var n=this;this._onLoop=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];n._callback.apply(n,p(t)),n._rafId=n._context.requestAnimationFrame(n._onLoop)},this._onLoopNextTick=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var i=performance.now();n._callback.apply(n,p(t));i=performance.now()-i;0<=n._rafTimer&&(clearTimeout(n._rafTimer),n._rafTimer=-1),i<16?n._rafId=n._context.requestAnimationFrame(n._onLoop):n._rafTimer=window.setTimeout(n._onLoop,0)},this._callback=null,this._context=window,this._rafId=-1,this._rafTimer=-1}var e=t.prototype;return e.setCallback=function(t){this._callback=t},e.setContext=function(t){this._context=t},e.start=function(){var t=this._context,e=this._callback;t&&e&&(0<=this._rafId||0<=this._rafTimer||(this._rafId=w?t.requestAnimationFrame(this._onLoopNextTick):t.requestAnimationFrame(this._onLoop)))},e.stop=function(){0<=this._rafId&&this._context.cancelAnimationFrame(this._rafId),0<=this._rafTimer&&clearTimeout(this._rafTimer),this._rafId=-1,this._rafTimer=-1},t}(),ae=xt,se=b||1;2<se&&(se=2);function he(t,r,o){[c.prototype,t.prototype].forEach(function(i){Object.getOwnPropertyNames(i).filter(function(t){return!r[t]&&!t.startsWith("_")&&"constructor"!==t}).forEach(function(t){var e,n=Object.getOwnPropertyDescriptor(i,t);n.value?Object.defineProperty(r,t,{value:function(){for(var t,e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];return(t=n.value).call.apply(t,p([this[o]],e))}}):(e={},n.get&&(e.get=function(){var t;return null===(t=n.get)||void 0===t?void 0:t.call(this[o])}),n.set&&(e.set=function(){for(var t,e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];return null===(t=n.set)||void 0===t?void 0:t.call.apply(t,p([this[o]],e))}),Object.defineProperty(r,t,e))})})}var ue={BIND_TEXTURE:"bindTexture",IMAGE_LOADED:"imageLoaded",ERROR:"error",RENDERING_CONTEXT_LOST:"renderingContextLost",RENDERING_CONTEXT_RESTORE:"renderingContextRestore"},ce={INVALID_DEVICE:10,NO_WEBGL:11,FAIL_IMAGE_LOAD:12,RENDERER_ERROR:13},le=function(h){function t(t,e,i,n,r,o,a,s){var l=h.call(this)||this;return l.textureCoordBuffer=null,l.vertexBuffer=null,l.indexBuffer=null,l.exitVR=function(){var t=l._vr,e=l.context,i=l._animator;t&&(t.removeEndCallback(l.exitVR),t.destroy(),l._vr=null,x&&l._restoreStyle(),l.updateViewportDimensions(l.width,l.height),l._updateViewport(),e.bindFramebuffer(e.FRAMEBUFFER,null),l._bindBuffers(),l._shouldForceDraw=!0,i.stop(),i.setContext(window),i.setCallback(l._render.bind(l)),i.start())},l._renderStereo=function(t,e){var i,n,r=l._vr,o=l.context,a=r.getEyeParams(o,e);if(a){r.beforeRender(o,e);try{for(var s=f([0,1]),h=s.next();!h.done;h=s.next()){var u=h.value,c=a[u];l.mvMatrix=c.mvMatrix,l.pMatrix=c.pMatrix,o.viewport.apply(o,p(c.viewport)),o.uniform1f(l.shaderProgram.uEye,u),l._bindBuffers(),l._draw()}}catch(t){i={error:t}}finally{try{h&&!h.done&&(n=s.return)&&n.call(s)}finally{if(i)throw i.error}}r.afterRender()}},l._onFirstVRFrame=function(t,e){var i,n=l._vr,r=l.context,o=l._animator;n.canRender(e)&&(i=_.vec3.fromValues(0,0,-1),r=n.getEyeParams(r,e)[0],e=_.mat3.fromMat4(_.mat3.create(),r.mvMatrix),r=_.mat3.fromMat4(_.mat3.create(),r.pMatrix),e=_.mat3.invert(_.mat3.create(),e),r=_.mat3.invert(_.mat3.create(),r),r=_.vec3.transformMat3(_.vec3.create(),i,r),_.vec3.transformMat3(r,r,e),0!==(r=D.yawOffsetBetween(r,_.vec3.fromValues(0,0,1)))&&(n.setYawOffset(r),o.setCallback(l._renderStereo)))},l.sphericalConfig=a,l.fieldOfView=a.fieldOfView,l.width=e,l.height=i,l._lastQuaternion=null,l._lastYaw=null,l._lastPitch=null,l._lastFieldOfView=null,l.pMatrix=_.mat4.create(),l.mvMatrix=_.mat4.create(),_.mat4.perspective(l.pMatrix,_.glMatrix.toRadian(l.fieldOfView),e/i,.1,100),l.textureCoordBuffer=null,l.vertexBuffer=null,l.indexBuffer=null,l.canvas=l._initCanvas(r,o,e,i),l._setDefaultCanvasStyle(),l._wrapper=null,l._wrapperOrigStyle=null,l._renderingContextAttributes=s,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 oe,l._vr=null,t&&l.setImage({image:t,imageType:a.imageType,isVideo:n,cubemapConfig:a.cubemapConfig}),l}l(t,h);var e=t.prototype;return e.setYawPitchControl=function(t){this._yawPitchControl=t},e.getContent=function(){return this._image},e.setImage=function(t){var e=t.image,i=t.imageType,n=t.isVideo,n=void 0!==n&&n,t=t.cubemapConfig;this._imageIsReady=!1,this._isVideo=n,this._imageConfig=u({order:i===ae.CUBEMAP?"RLUDBF":"RLUDFB",tileConfig:{flipHorizontal:!1,rotation:0},trim:0},t),this._setImageType(i),this._contentLoader&&this._contentLoader.destroy(),this._contentLoader=(new r).on("ready",this._onContentLoad).on("error",this._onContentError),n?(this._image=function(t){if(t instanceof HTMLVideoElement)return t;var e=document.createElement("video");return e.setAttribute("crossorigin","anonymous"),e.setAttribute("webkit-playsinline",""),e.setAttribute("playsinline",""),t instanceof Array?t.forEach(function(t){return Tt(e,t)}):Tt(e,t),0<e.querySelectorAll("source").length&&e.readyState<1&&e.load(),e}(e),this._contentLoader.check([this._image]),this._keepUpdate=!0):(this._image=function(t){t=(t instanceof Array?t:[t]).map(function(t){var e=t;return"string"==typeof t&&((e=new Image).crossOrigin="anonymous",e.src=t),e});return 1===t.length?t[0]:t}(e),this._contentLoader.check(Array.isArray(this._image)?this._image:[this._image]),this._keepUpdate=!1)},e.isImageLoaded=function(){return!!this._image&&this._imageIsReady&&(!this._isVideo||2<=this._image.readyState)},e.bindTexture=function(){var n=this;return new s(function(e,i){var t=n._contentLoader;return n._image?t?void(t.isReady()?(n._bindTexture(),e()):(t.check(Array.isArray(n._image)?n._image:[n._image]),t.once("ready",function(t){0<t.errorCount?i("Failed to load images."):(n._bindTexture(),e())}))):i("ImageLoader is not initialized"):i("Image is not defined")})},e.attachTo=function(t){this._hasExternalCanvas||(this.detach(),t.appendChild(this.canvas)),this._wrapper=t},e.forceContextLoss=function(){var t;!this.hasRenderingContext()||(t=this.context.getExtension("WEBGL_lose_context"))&&t.loseContext()},e.detach=function(){!this._hasExternalCanvas&&this.canvas.parentElement&&this.canvas.parentElement.removeChild(this.canvas)},e.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)},e.hasRenderingContext=function(){var t=this.context;return!(!t||t.isContextLost()||!t.getProgramParameter(this.shaderProgram,t.LINK_STATUS))},e.updateFieldOfView=function(t){this.fieldOfView=t,this._updateViewport()},e.updateViewportDimensions=function(t,e){var i=!1;this.width=t,this.height=e;t*=se,e*=se;t!==this.canvas.width&&(this.canvas.width=t,i=!0),e!==this.canvas.height&&(this.canvas.height=e,i=!0),i&&(this._updateViewport(),this._shouldForceDraw=!0)},e.keepUpdate=function(t){t&&!1===this.isImageLoaded()&&(this._shouldForceDraw=!0),this._keepUpdate=t},e.startRender=function(){this._animator.setCallback(this._render.bind(this)),this._animator.start()},e.stopRender=function(){this._animator.stop()},e.renderWithQuaternion=function(t,e){this.isImageLoaded()&&(!1===this._keepUpdate&&this._lastQuaternion&&_.quat.exactEquals(this._lastQuaternion,t)&&this.fieldOfView&&this.fieldOfView===e&&!1===this._shouldForceDraw||(void 0!==e&&e!==this.fieldOfView&&this.updateFieldOfView(e),this.mvMatrix=_.mat4.fromQuat(_.mat4.create(),t),this._draw(),this._lastQuaternion=_.quat.clone(t),this._shouldForceDraw&&(this._shouldForceDraw=!1)))},e.renderWithYawPitch=function(t,e,i){this.isImageLoaded()&&(!1===this._keepUpdate&&null!==this._lastYaw&&this._lastYaw===t&&null!==this._lastPitch&&this._lastPitch===e&&this.fieldOfView&&this.fieldOfView===i&&!1===this._shouldForceDraw||(void 0!==i&&i!==this.fieldOfView&&this.updateFieldOfView(i),_.mat4.identity(this.mvMatrix),_.mat4.rotateX(this.mvMatrix,this.mvMatrix,-_.glMatrix.toRadian(e)),_.mat4.rotateY(this.mvMatrix,this.mvMatrix,-_.glMatrix.toRadian(t)),this._draw(),this._lastYaw=t,this._lastPitch=e,this._shouldForceDraw&&(this._shouldForceDraw=!1)))},e.getProjectionRenderer=function(){return this._renderer},e.enterVR=function(t){var e=this._vr;return S||navigator.getVRDisplays?e&&e.isPresenting()?s.resolve("VR already enabled."):this._requestPresent(t):s.reject("VR is not available on this browser.")},e._setImageType=function(t){var e=this;if(t&&this._imageType!==t){switch(this._imageType=t,this._isCubeMap=t===ae.CUBEMAP,this._renderer&&this._renderer.off(),t){case ae.CUBEMAP:this._renderer=new Ot;break;case ae.CUBESTRIP:this._renderer=new Dt;break;case ae.PANORAMA:this._renderer=new Zt;break;case ae.STEREOSCOPIC_EQUI:this._renderer=new qt(this.sphericalConfig.stereoFormat);break;default:this._renderer=new qt(wt.NONE)}this._renderer.on(St.EVENTS.ERROR,function(t){e.trigger(new c.ComponentEvent(ue.ERROR,{type:ce.RENDERER_ERROR,message:t.message}))}),this._initWebGL()}},e._initCanvas=function(t,e,i,n){t=t.querySelector("."+e),e=t||this._createCanvas(e);return this._hasExternalCanvas=!!t,e.width=i,e.height=n,this._onWebglcontextlost=this._onWebglcontextlost.bind(this),this._onWebglcontextrestored=this._onWebglcontextrestored.bind(this),e.addEventListener("webglcontextlost",this._onWebglcontextlost),e.addEventListener("webglcontextrestored",this._onWebglcontextrestored),e},e._createCanvas=function(t){var e=document.createElement("canvas");return e.className=t,e},e._setDefaultCanvasStyle=function(){var t=this.canvas;t.style.bottom="0",t.style.left="0",t.style.right="0",t.style.top="0",t.style.margin="auto",t.style.maxHeight="100%",t.style.maxWidth="100%",t.style.outline="none",t.style.position="absolute"},e._onContentError=function(){return this._imageIsReady=!1,this._image=null,this.trigger(new c.ComponentEvent(ue.ERROR,{type:ce.FAIL_IMAGE_LOAD,message:"failed to load image"})),!1},e._triggerContentLoad=function(){this.trigger(new c.ComponentEvent(ue.IMAGE_LOADED,{content:this._image,isVideo:this._isVideo,projectionType:this._imageType}))},e._onContentLoad=function(t){0<t.errorCount||(this._imageIsReady=!0,this._triggerContentLoad())},e._initShaderProgram=function(){var t=this.context;this.shaderProgram&&(t.deleteProgram(this.shaderProgram),this.shaderProgram=null);var e=this._renderer,i=e.getVertexShaderSource(),e=e.getFragmentShaderSource(),i=bt.createShader(t,t.VERTEX_SHADER,i),e=bt.createShader(t,t.FRAGMENT_SHADER,e),e=bt.createProgram(t,i,e);if(!e)throw new Error("Failed to initialize shaders: "+bt.getErrorNameFromWebGLErrorCode(t.getError()));t.useProgram(e),e.vertexPositionAttribute=t.getAttribLocation(e,"aVertexPosition"),e.pMatrixUniform=t.getUniformLocation(e,"uPMatrix"),e.mvMatrixUniform=t.getUniformLocation(e,"uMVMatrix"),e.samplerUniform=t.getUniformLocation(e,"uSampler"),e.textureCoordAttribute=t.getAttribLocation(e,"aTextureCoord"),e.uEye=t.getUniformLocation(e,"uEye"),t.enableVertexAttribArray(e.vertexPositionAttribute),t.enableVertexAttribArray(e.textureCoordAttribute),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT|t.STENCIL_BUFFER_BIT),t.uniform1i(e.samplerUniform,0),this.shaderProgram=e},e._onWebglcontextlost=function(t){t.preventDefault(),this.trigger(new c.ComponentEvent(ue.RENDERING_CONTEXT_LOST))},e._onWebglcontextrestored=function(){this._initWebGL(),this.trigger(new c.ComponentEvent(ue.RENDERING_CONTEXT_RESTORE))},e._updateViewport=function(){_.mat4.perspective(this.pMatrix,_.glMatrix.toRadian(this.fieldOfView),this.canvas.width/this.canvas.height,.1,100),this.context.viewport(0,0,this.context.drawingBufferWidth,this.context.drawingBufferHeight)},e._initWebGL=function(){var t;try{this._initRenderingContext(),t=this.context,this.updateViewportDimensions(this.width,this.height),this._initShaderProgram()}catch(t){return this.trigger(new c.ComponentEvent(ue.ERROR,{type:ce.NO_WEBGL,message:"no webgl support"})),this.destroy(),void console.error(t)}t.clearColor(0,0,0,0);var e=this._isCubeMap?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D;this.texture&&t.deleteTexture(this.texture),this.texture=bt.createTexture(t,e),this._imageType===ae.CUBESTRIP&&t.enable(t.CULL_FACE)},e._initRenderingContext=function(){if(!this.hasRenderingContext()){if(!window.WebGLRenderingContext)throw new Error("WebGLRenderingContext not available.");if(this.context=bt.getWebglContext(this.canvas,this._renderingContextAttributes),!this.context)throw new Error("Failed to acquire 3D rendering context")}},e._initBuffers=function(){var t=this._image,e=this._renderer.getVertexPositionData(),i=this._renderer.getIndexData(),n=this._renderer.getTextureCoordData({image:t,imageConfig:this._imageConfig}),t=this.context;this.vertexBuffer=bt.initBuffer(t,t.ARRAY_BUFFER,new Float32Array(e),3,this.shaderProgram.vertexPositionAttribute),this.indexBuffer=bt.initBuffer(t,t.ELEMENT_ARRAY_BUFFER,new Uint16Array(i),1),this.textureCoordBuffer=bt.initBuffer(t,t.ARRAY_BUFFER,new Float32Array(n),this._isCubeMap?3:2,this.shaderProgram.textureCoordAttribute),this._bindBuffers()},e._bindTexture=function(){var t,e,i;this._imageType===ae.CUBESTRIP?(e=(t=this._renderer.getDimension(this._image)).width,i=t.height,t=e&&i&&e/i!=1.5?1:0,this.context.uniform1f(this.context.getUniformLocation(this.shaderProgram,"uIsEAC"),t)):this._imageType===ae.PANORAMA&&(e=(t=this._renderer.getDimension(this._image)).width,i=t.height,i=e&&i&&e/i,this._renderer.updateShaderData({imageAspectRatio:i})),this._initBuffers(),this._renderer.bindTexture(this.context,this.texture,this._image,this._imageConfig),this._shouldForceDraw=!0,this.trigger(new c.ComponentEvent(ue.BIND_TEXTURE))},e._updateTexture=function(){this._renderer.updateTexture(this.context,this._image,this._imageConfig)},e._render=function(){var t,e=this._yawPitchControl,i=e.getFov();e.shouldRenderWithQuaternion()?(t=e.getQuaternion(),this.renderWithQuaternion(t,i)):(e=e.getYawPitch(),this.renderWithYawPitch(e.yaw,e.pitch,i))},e._bindBuffers=function(){var t=this.context,e=this.shaderProgram,i=this.vertexBuffer,n=this.textureCoordBuffer;t.bindBuffer(t.ARRAY_BUFFER,i),t.enableVertexAttribArray(e.vertexPositionAttribute),t.vertexAttribPointer(e.vertexPositionAttribute,i.itemSize,t.FLOAT,!1,0,0),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer),t.bindBuffer(t.ARRAY_BUFFER,n),t.enableVertexAttribArray(e.textureCoordAttribute),t.vertexAttribPointer(e.textureCoordAttribute,n.itemSize,t.FLOAT,!1,0,0)},e._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})},e._requestPresent=function(t){var i=this,n=this.context,r=this.canvas,o=this._animator;this._vr=S?new re(t):new ne;var a=this._vr;return o.stop(),new s(function(t,e){a.requestPresent(r,n).then(function(){a.addEndCallback(i.exitVR),o.setContext(a.context),o.setCallback(i._onFirstVRFrame),x&&i._setWrapperFullscreen(),i._shouldForceDraw=!0,o.start(),t("success")}).catch(function(t){a.destroy(),i._vr=null,o.start(),e(t)})})},e._setWrapperFullscreen=function(){var t=this._wrapper;t&&(this._wrapperOrigStyle=t.getAttribute("style"),(t=t.style).width="100vw",t.height="100vh",t.position="fixed",t.left="0",t.top="0",t.zIndex="9999")},e._restoreStyle=function(){var t=this._wrapper,e=this.canvas;t&&(this._wrapperOrigStyle?t.setAttribute("style",this._wrapperOrigStyle):t.removeAttribute("style"),this._wrapperOrigStyle=null,e.removeAttribute("style"),this._setDefaultCanvasStyle())},t.EVENTS=ue,t.ERROR_TYPE=ce,t}(c),de=function(o){function a(t,e){void 0===e&&(e={});var i=o.call(this)||this;if(!bt.isWebGLAvailable())return setTimeout(function(){i.trigger(new c.ComponentEvent(yt.ERROR,{type:vt.NO_WEBGL,message:"no webgl support"}))},0),i;if(!bt.isStableWebGL())return setTimeout(function(){i.trigger(new c.ComponentEvent(yt.ERROR,{type:vt.INVALID_DEVICE,message:"blacklisted browser"}))},0),i;if(e.image&&e.video)return setTimeout(function(){i.trigger(new c.ComponentEvent(yt.ERROR,{type:vt.INVALID_RESOURCE,message:"Specifying multi resouces(both image and video) is not valid."}))},0),i;O(),i._container=t,i._image=e.image||e.video,i._isVideo=!!e.video,i._projectionType=e.projectionType||xt.EQUIRECTANGULAR,i._cubemapConfig=u({order:i._projectionType===xt.CUBEMAP?"RLUDBF":"RLUDFB",tileConfig:{flipHorizontal:!1,rotation:0},trim:0},e.cubemapConfig),i._stereoFormat=e.stereoFormat||wt.TOP_BOTTOM,i._width=e.width||parseInt(window.getComputedStyle(t).width,10),i._height=e.height||parseInt(window.getComputedStyle(t).height,10),i._yaw=e.yaw||0,i._pitch=e.pitch||0,i._fov=e.fov||65,i._gyroMode=e.gyroMode||B.YAWPITCH,i._quaternion=null,i._aspectRatio=0!==i._height?i._width/i._height:1,i._canvasClass=e.canvasClass||Et;var n=e.fovRange||[30,110],r=a._isValidTouchDirection(e.touchDirection)?e.touchDirection:mt.TOUCH_DIRECTION_ALL,r=u(u({},e),{element:t,yaw:i._yaw,pitch:i._pitch,fov:i._fov,gyroMode:i._gyroMode,fovRange:n,aspectRatio:i._aspectRatio,touchDirection:r});return i._isReady=!1,i._initYawPitchControl(r),i._initRenderer(i._yaw,i._pitch,i._fov,i._projectionType,i._cubemapConfig),i}l(a,o);var t=a.prototype;return a.isSupported=function(){return bt.isWebGLAvailable()&&bt.isStableWebGL()},a.isWebGLAvailable=function(){return bt.isWebGLAvailable()},a.isGyroSensorAvailable=function(t){var i;I||!t?s.race([new s(function(e){i=function(t){t=!(null==t.rotationRate.alpha);e(t)},window.addEventListener("devicemotion",i)}),new s(function(t){setTimeout(function(){return t(!1)},1e3)})]).then(function(e){window.removeEventListener("devicemotion",i),t&&t(e),a.isGyroSensorAvailable=function(t){return t&&t(e),e}}):t(!1)},a._isValidTouchDirection=function(t){return t===a.TOUCH_DIRECTION.NONE||t===a.TOUCH_DIRECTION.YAW||t===a.TOUCH_DIRECTION.PITCH||t===a.TOUCH_DIRECTION.ALL},t.getVideo=function(){return this._isVideo?this._photoSphereRenderer.getContent():null},t.setVideo=function(t,e){return void 0===e&&(e={}),t&&this.setImage(t,{projectionType:e.projectionType,isVideo:!0,cubemapConfig:e.cubemapConfig,stereoFormat:e.stereoFormat}),this},t.getImage=function(){return this._isVideo?null:this._photoSphereRenderer.getContent()},t.setImage=function(t,e){void 0===e&&(e={});var i=u({order:"RLUDBF",tileConfig:{flipHorizontal:!1,rotation:0},trim:0},e.cubemapConfig),n=e.stereoFormat||wt.TOP_BOTTOM,r=!!e.isVideo;return this._image&&this._isVideo!==r?console.warn("PanoViewer is not currently supporting content type changes. (Image <--\x3e Video)"):t&&(this._deactivate(),this._image=t,this._isVideo=r,this._projectionType=e.projectionType||xt.EQUIRECTANGULAR,this._cubemapConfig=i,this._stereoFormat=n,this._initRenderer(this._yaw,this._pitch,this._fov,this._projectionType,this._cubemapConfig)),this},t.keepUpdate=function(t){return this._photoSphereRenderer.keepUpdate(t),this},t.getProjectionType=function(){return this._projectionType},t.enableSensor=function(){return new s(function(e,i){I&&"function"==typeof I.requestPermission?I.requestPermission().then(function(t){"granted"===t?e():i(new Error("permission denied"))}).catch(function(t){i(t)}):e()})},t.disableSensor=function(){return this},t.enterVR=function(t){var n=this;return void 0===t&&(t={}),this._isReady?new s(function(e,i){n.enableSensor().then(function(){return n._photoSphereRenderer.enterVR(t)}).then(function(t){return e(t)}).catch(function(t){return i(t)})}):s.reject(new Error("PanoViewer is not ready to show image."))},t.exitVR=function(){return this._photoSphereRenderer.exitVR(),this},t.setUseZoom=function(t){return"boolean"==typeof t&&this._yawPitchControl.option("useZoom",t),this},t.setUseKeyboard=function(t){return this._yawPitchControl.option("useKeyboard",t),this},t.setGyroMode=function(t){return this._yawPitchControl.option("gyroMode",t),this},t.setFovRange=function(t){return this._yawPitchControl.option("fovRange",t),this},t.getFovRange=function(){return this._yawPitchControl.option("fovRange")},t.updateViewportDimensions=function(t){if(void 0===t&&(t={}),!this._isReady)return this;void 0!==t.width&&void 0!==t.height||(i=window.getComputedStyle(this._container));var e=t.width||parseInt(i.width,10),i=t.height||parseInt(i.height,10);return e===this._width&&i===this._height||(this._width=e,this._height=i,this._aspectRatio=e/i,this._photoSphereRenderer.updateViewportDimensions(e,i),this._yawPitchControl.option("aspectRatio",this._aspectRatio),this._yawPitchControl.updatePanScale({height:i}),this.lookAt({},0)),this},t.getFov=function(){return this._fov},t.getYaw=function(){return this._yaw},t.getPitch=function(){return this._pitch},t.getYawRange=function(){return this._yawPitchControl.option("yawRange")},t.getPitchRange=function(){return this._yawPitchControl.option("pitchRange")},t.setYawRange=function(t){return this._yawPitchControl.option("yawRange",t),this},t.setPitchRange=function(t){return this._yawPitchControl.option("pitchRange",t),this},t.setShowPolePoint=function(t){return this._yawPitchControl.option("showPolePoint",t),this},t.lookAt=function(t,e){if(void 0===e&&(e=0),!this._isReady)return this;var i=void 0!==t.yaw?t.yaw:this._yaw,n=void 0!==t.pitch?t.pitch:this._pitch,r=this._yawPitchControl.option("pitchRange"),r=r[1]-r[0],t=void 0!==t.fov?t.fov:this._fov;return r<t&&(t=r),this._yawPitchControl.lookAt({yaw:i,pitch:n,fov:t},e),0===e&&this._photoSphereRenderer.renderWithYawPitch(i,n,t),this},t.setTouchDirection=function(t){return a._isValidTouchDirection(t)&&this._yawPitchControl.option("touchDirection",t),this},t.getTouchDirection=function(){return this._yawPitchControl.option("touchDirection")},t.destroy=function(){return this._deactivate(),this._yawPitchControl&&(this._yawPitchControl.destroy(),this._yawPitchControl=null),this},t._initRenderer=function(t,e,i,n,r){var o=this;this._photoSphereRenderer=new le(this._image,this._width,this._height,this._isVideo,this._container,this._canvasClass,{initialYaw:t,initialPitch:e,fieldOfView:i,imageType:n,cubemapConfig:r,stereoFormat:this._stereoFormat}),this._photoSphereRenderer.setYawPitchControl(this._yawPitchControl),this._bindRendererHandler(),this._photoSphereRenderer.bindTexture().then(function(){return o._activate()}).catch(function(){o.trigger(new c.ComponentEvent(yt.ERROR,{type:vt.FAIL_BIND_TEXTURE,message:"failed to bind texture"}))})},t._updateYawPitchIfNeeded=function(){var t,e,i;this._projectionType===a.ProjectionType.PANORAMA&&(e=t=void 0,(i=(i=this._photoSphereRenderer.getContent()).naturalWidth/i.naturalHeight)<1&&(i=1/i),e=i<6?(t=D.toDegree(i),2*D.toDegree(Math.atan(.5))):(t=360)/i,i=this._yawPitchControl.option("fovRange")[0],this._yawPitchControl.option({fov:e,yawRange:[-t/2,t/2],pitchRange:[-e/2,e/2],fovRange:[i,e]}),this.lookAt({fov:e}))},t._bindRendererHandler=function(){var e=this;this._photoSphereRenderer.on(le.EVENTS.ERROR,function(t){e.trigger(new c.ComponentEvent(yt.ERROR,t))}),this._photoSphereRenderer.on(le.EVENTS.RENDERING_CONTEXT_LOST,function(){e._deactivate(),e.trigger(new c.ComponentEvent(yt.ERROR,{type:vt.RENDERING_CONTEXT_LOST,message:"webgl rendering context lost"}))})},t._initYawPitchControl=function(t){var e=this;this._yawPitchControl=new mt(t),this._yawPitchControl.on(yt.ANIMATION_END,function(t){e.trigger(new c.ComponentEvent(yt.ANIMATION_END,t))}),this._yawPitchControl.on("change",function(t){e._yaw=t.yaw,e._pitch=t.pitch,e._fov=t.fov,e._quaternion=t.quaternion,e.trigger(new c.ComponentEvent(yt.VIEW_CHANGE,t))})},t._activate=function(){this._photoSphereRenderer.attachTo(this._container),this._yawPitchControl.enable(),this.updateViewportDimensions(),this._isReady=!0,this._updateYawPitchIfNeeded(),this.trigger(new c.ComponentEvent(yt.READY)),this._photoSphereRenderer.startRender()},t._deactivate=function(){var t=this.getVideo();t&&t.pause(),this._isReady&&(this._photoSphereRenderer.stopRender(),this._yawPitchControl.disable(),this._isReady=!1),this._photoSphereRenderer&&(this._photoSphereRenderer.destroy(),this._photoSphereRenderer=null)},a.VERSION=n,a.ERROR_TYPE=vt,a.EVENTS=yt,a.PROJECTION_TYPE=xt,a.GYRO_MODE=B,a.ProjectionType=xt,a.STEREO_FORMAT=wt,a.TOUCH_DIRECTION={NONE:mt.TOUCH_DIRECTION_NONE,YAW:mt.TOUCH_DIRECTION_YAW,PITCH:mt.TOUCH_DIRECTION_PITCH,ALL:mt.TOUCH_DIRECTION_ALL},a}(c),R={__proto__:null,PanoViewer:de,VERSION:n,GYRO_MODE:B,PANOVIEWER_EVENTS:yt,ERROR_TYPE:vt,PROJECTION_TYPE:xt,STEREO_FORMAT:wt,PANOVIEWER_OPTIONS:{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},DEFAULT_CANVAS_CLASS:Et},fe="view360-wrapper",_e="view360-image",pe=function(h){function u(t,e){void 0===e&&(e={});var i=h.call(this)||this,n=e||{};i._el=t,i._rowCount=n.rowCount||1,i._colCount=n.colCount||1,i._totalCount=i._rowCount*i._colCount,i._width=n.width||"auto",i._height=n.height||"auto",i._autoHeight=null==n.autoHeight||n.autoHeight,i._colRow=[0,0],n.colRow?i._colRow=n.colRow:n.frameIndex&&i.setFrameIndex(n.frameIndex),i._el.style.width=u._getSizeString(i._width),i._el.style.height=u._getSizeString(i._height);var r=n.wrapperClass||fe,e=n.imageClass||_e;if(!n.imageUrl)return setTimeout(function(){i.trigger(new c.ComponentEvent("imageError",{imageUrl:n.imageUrl}))},0),i;var o=t.querySelector("."+e),a=t.querySelector("."+r);a&&o&&(o.style.display="none"),i._image=o||new Image;var s=i._image;return s.onload=function(){a&&o&&(o.style.display=""),i._bg=u._createBgDiv(a,s,i._rowCount,i._colCount,i._autoHeight),i._el.appendChild(i._bg),i.setColRow(i._colRow[0],i._colRow[1]),i.trigger(new c.ComponentEvent("load",{target:i._el,bgElement:i._bg})),i._autoPlayReservedInfo&&(i.play(i._autoPlayReservedInfo),i._autoPlayReservedInfo=null)},s.onerror=function(){i.trigger(new c.ComponentEvent("imageError",{imageUrl:n.imageUrl}))},s.src=n.imageUrl,i}l(u,h);var t=u.prototype;return u._createBgDiv=function(t,e,i,n,r){t=t||document.createElement("div");t.style.position="relative",t.style.overflow="hidden",e.style.position="absolute",e.style.width=100*n+"%",e.style.height=100*i+"%",e.ondragstart=function(){return!1},A&&(e.style.willChange="transform"),t.appendChild(e);n=e.naturalWidth/n,i=e.naturalHeight/i;return r?(n=i/n,t.style.paddingBottom=100*n+"%"):t.style.height="100%",t},u._getSizeString=function(t){return"number"==typeof t?t+"px":t},t.setFrameIndex=function(t){t=this.toColRow(t);this.setColRow(t[0],t[1])},t.getFrameIndex=function(){return this._colRow[1]*this._colCount+this._colRow[0]},t.setColRow=function(t,e){e>this._rowCount-1||t>this._colCount-1||(this._image&&P&&(this._image.style[P]="translate("+-(t/this._colCount)*100+"%, "+-(e/this._rowCount)*100+"%)"),this._colRow=[t,e])},t.getColRow=function(){return this._colRow},t.stop=function(){this._autoPlayTimer&&(clearInterval(this._autoPlayTimer),this._autoPlayTimer=-1)},t.play=function(t){var e,i,n,r=this,o=void 0===t?{interval:1e3/this._totalCount,playCount:0}:t,t=o.interval,a=o.playCount;this._bg?(this._autoPlayTimer&&(clearInterval(this._autoPlayTimer),this._autoPlayTimer=-1),e=this.getFrameIndex(),n=i=0,this._autoPlayTimer=window.setInterval(function(){e%=r._totalCount;var t=r.toColRow(e);r.setColRow(t[0],t[1]),e++,++n===r._totalCount&&(n=0,i++),0<a&&i===a&&clearInterval(r._autoPlayTimer)},t)):this._autoPlayReservedInfo={interval:t,playCount:a}},t.toColRow=function(t){var e=this._colCount,i=this._rowCount;return t<0?[0,0]:t>=this._totalCount?[e-1,i-1]:[t%e,Math.floor(t/e)]},u.VERSION=n,u}(c),ge=function(o){function t(t,e){void 0===e&&(e={});var i=o.call(this)||this;i._el=t;var n=u({},e),r=n.colCount||1,e=n.rowCount||1;return i._scale=n.scale||1,i._panScale=.21*i._scale,i._frameCount=r*e,i._sprites=new pe(t,n).on({load:function(t){i.trigger(new c.ComponentEvent("load",t))},imageError:function(t){i.trigger(new c.ComponentEvent("imageError",{imageUrl:t.imageUrl}))}}),i._panInput=new h.PanInput(i._el,{scale:[i._panScale,i._panScale]}),i._axes=new h({angle:{range:[0,359],circular:!0}}).on({change:function(t){var e=Math.floor(t.pos.angle/(360/i._frameCount)),e=i._frameCount-e-1;i._sprites.setFrameIndex(e),i.trigger(new c.ComponentEvent("change",{frameIndex:e,colRow:i._sprites.getColRow(),angle:t.pos.angle}))},animationEnd:function(t){i.trigger(new c.ComponentEvent("animationEnd",{isTrusted:t.isTrusted}))}}),i._axes.connect("angle",i._panInput),i}l(t,o);var e=t.prototype;return e.setScale=function(t){return isNaN(t)||t<0||(this._scale=t,this._panScale=.21*t,this._panInput.options.scale=[this._panScale,this._panScale]),this},e.getScale=function(){return this._scale},e.spinBy=function(t,e){return void 0===t&&(t=0),void 0===e&&(e={duration:0}),this._axes.setBy({angle:t},e.duration),this},e.spinTo=function(t,e){return void 0===t&&(t=0),void 0===e&&(e={duration:0}),this._axes.setTo({angle:t},e.duration),this},e.getAngle=function(){return this._axes.get().angle||0},t.VERSION=n,t}(c),t={__proto__:null,SpinViewer:ge,SpriteImage:pe,VERSION:n,SPINVIEWER_OPTIONS:{imageUrl:!0,rowCount:!0,colCount:!0,width:!0,height:!0,autoHeight:!0,colRow:!0,scale:!0,frameIndex:!0,wrapperClass:!0,imageClass:!0},SPINVIEWER_EVENTS:{LOAD:"load",IMAGE_ERROR:"imageError",CHANGE:"change",ANIMATION_END:"animationEnd"},DEFAULT_WRAPPER_CLASS:fe,DEFAULT_IMAGE_CLASS:_e},me=function(t,e){return null!=t&&t!==e},ve=function(t,e,i,n){me(i[e],n[e])&&t["set"+e[0].toUpperCase()+e.slice(1)](i[e])},e={__proto__:null,withMethods:he,withPanoViewerMethods:function(t,e){he(de,t,e)},withSpinViewerMethods:function(t,e){he(ge,t,e)},updatePanoViewer:function(e,i,n){me(i.image,n.image)?e.setImage(i.image,{projectionType:i.projectionType,cubemapConfig:i.cubemapConfig,stereoFormat:i.stereoFormat,isVideo:!1}):me(i.video,n.video)&&e.setVideo(i.video,{projectionType:i.projectionType,cubemapConfig:i.cubemapConfig,stereoFormat:i.stereoFormat});["fovRange","gyroMode","pitchRange","showPolePoint","touchDirection","useKeyboard","useZoom","yawRange"].forEach(function(t){ve(e,t,i,n)})}},b={};return Rt(b,R),Rt(b,t),Rt(b,e),b});
10//# sourceMappingURL=view360.min.js.map