window.libpannellum=function(e,t,a){function o(o){function c(e,t){return 1==e.level&&1!=t.level?-1:1==t.level&&1!=e.level?1:t.timestamp-e.timestamp}function u(e,t){return e.level!=t.level?e.level-t.level:e.diff-t.diff}function d(e,t,a,o,n,i){this.vertices=e,this.side=t,this.level=a,this.x=o,this.y=n,this.path=i.replace("%s",t).replace("%l",a).replace("%x",o).replace("%y",n)}function f(e,t,a,o,n){var i;i=g(e,(l=t.vertices).slice(0,3));var r=g(e,l.slice(3,6)),s=g(e,l.slice(6,9)),l=g(e,l.slice(9,12)),h=i[0]+r[0]+s[0]+l[0];if(-4==h||4==h?i=!1:i=-4!=(h=i[1]+r[1]+s[1]+l[1])&&4!=h&&4!=i[2]+r[2]+s[2]+l[2],i){for(r=(i=t.vertices)[0]+i[3]+i[6]+i[9],s=i[1]+i[4]+i[7]+i[10],l=i[2]+i[5]+i[8]+i[11],h=Math.sqrt(r*r+s*s+l*l),l=Math.asin(l/h),r=Math.atan2(s,r)-o,r+=r>Math.PI?-2*Math.PI:r<-Math.PI?2*Math.PI:0,r=Math.abs(r),t.diff=Math.acos(Math.sin(a)*Math.sin(l)+Math.cos(a)*Math.cos(l)*Math.cos(r)),r=!1,s=0;s<y.nodeCache.length;s++)if(y.nodeCache[s].path==t.path){r=!0,y.nodeCache[s].timestamp=y.nodeCacheTimestamp++,y.nodeCache[s].diff=t.diff,y.currentNodes.push(y.nodeCache[s]);break}if(r||(t.timestamp=y.nodeCacheTimestamp++,y.currentNodes.push(t),y.nodeCache.push(t)),t.level<y.level){l=T.cubeResolution*Math.pow(2,t.level-T.maxLevel),r=Math.ceil(l*T.invTileResolution)-1,s=l%T.tileResolution*2;var c=2*l%T.tileResolution;0===c&&(c=T.tileResolution),0===s&&(s=2*T.tileResolution),h=.5,t.x!=r&&t.y!=r||(h=1-T.tileResolution/(T.tileResolution+c));var u=1-h,p=(l=[],h),m=h,v=h,w=u,b=u,x=u;for(c<T.tileResolution&&(t.x==r&&t.y!=r?(b=m=.5,("d"==t.side||"u"==t.side)&&(x=v=.5)):t.x!=r&&t.y==r&&(w=p=.5,"l"==t.side||"r"==t.side)&&(x=v=.5)),s<=T.tileResolution&&(t.x==r&&(p=0,w=1,"l"==t.side||"r"==t.side)&&(v=0,x=1),t.y==r&&(m=0,b=1,"d"==t.side||"u"==t.side)&&(v=0,x=1)),c=new d(c=[i[0],i[1],i[2],i[0]*p+i[3]*w,i[1]*h+i[4]*u,i[2]*v+i[5]*x,i[0]*p+i[6]*w,i[1]*m+i[7]*b,i[2]*v+i[8]*x,i[0]*h+i[9]*u,i[1]*m+i[10]*b,i[2]*v+i[11]*x],t.side,t.level+1,2*t.x,2*t.y,T.fullpath),l.push(c),t.x==r&&s<=T.tileResolution||(c=new d(c=[i[0]*p+i[3]*w,i[1]*h+i[4]*u,i[2]*v+i[5]*x,i[3],i[4],i[5],i[3]*h+i[6]*u,i[4]*m+i[7]*b,i[5]*v+i[8]*x,i[0]*p+i[6]*w,i[1]*m+i[7]*b,i[2]*v+i[8]*x],t.side,t.level+1,2*t.x+1,2*t.y,T.fullpath),l.push(c)),t.x==r&&s<=T.tileResolution||t.y==r&&s<=T.tileResolution||(c=new d(c=[i[0]*p+i[6]*w,i[1]*m+i[7]*b,i[2]*v+i[8]*x,i[3]*h+i[6]*u,i[4]*m+i[7]*b,i[5]*v+i[8]*x,i[6],i[7],i[8],i[9]*p+i[6]*w,i[10]*h+i[7]*u,i[11]*v+i[8]*x],t.side,t.level+1,2*t.x+1,2*t.y+1,T.fullpath),l.push(c)),t.y==r&&s<=T.tileResolution||(c=new d(c=[i[0]*h+i[9]*u,i[1]*m+i[10]*b,i[2]*v+i[11]*x,i[0]*p+i[6]*w,i[1]*m+i[7]*b,i[2]*v+i[8]*x,i[9]*p+i[6]*w,i[10]*h+i[7]*u,i[11]*v+i[8]*x,i[9],i[10],i[11]],t.side,t.level+1,2*t.x,2*t.y+1,T.fullpath),l.push(c)),t=0;t<l.length;t++)f(e,l[t],a,o,n)}}}function p(e,t,a){var o=Math.sin(t);return t=Math.cos(t),"x"==a?[e[0],t*e[1]+o*e[2],t*e[2]-o*e[1],e[3],t*e[4]+o*e[5],t*e[5]-o*e[4],e[6],t*e[7]+o*e[8],t*e[8]-o*e[7]]:"y"==a?[t*e[0]-o*e[2],e[1],t*e[2]+o*e[0],t*e[3]-o*e[5],e[4],t*e[5]+o*e[3],t*e[6]-o*e[8],e[7],t*e[8]+o*e[6]]:"z"==a?[t*e[0]+o*e[1],t*e[1]-o*e[0],e[2],t*e[3]+o*e[4],t*e[4]-o*e[3],e[5],t*e[6]+o*e[7],t*e[7]-o*e[6],e[8]]:void 0}function m(e){return[e[0],e[4],e[8],e[12],e[1],e[5],e[9],e[13],e[2],e[6],e[10],e[14],e[3],e[7],e[11],e[15]]}function v(e){U(e,e.path+"."+T.extension,(function(t,a){e.texture=t,e.textureLoaded=a?2:1}),k.crossOrigin)}function g(e,t){var a=(n=[e[0]*t[0]+e[1]*t[1]+e[2]*t[2],e[4]*t[0]+e[5]*t[1]+e[6]*t[2],e[11]+e[8]*t[0]+e[9]*t[1]+e[10]*t[2],1/(e[12]*t[0]+e[13]*t[1]+e[14]*t[2])])[0]*n[3],o=n[1]*n[3],n=n[2]*n[3],i=[0,0,0];return-1>a&&(i[0]=-1),1<a&&(i[0]=1),-1>o&&(i[1]=-1),1<o&&(i[1]=1),(-1>n||1<n)&&(i[2]=1),i}function w(){console.log("Reducing canvas size due to error 1286!"),N.width=Math.round(N.width/2),N.height=Math.round(N.height/2)}var y,b,x,E,M,P,R,_,T,L,C,I,A,S,D,k,N=t.createElement("canvas");N.style.width=N.style.height="100%",o.appendChild(N),this.init=function(e,c,u,d,f,p,m,v){function g(e){if(F){var t=e*e*4,a=new Uint8ClampedArray(t),o=v.backgroundColor?v.backgroundColor:[0,0,0];o[0]*=255,o[1]*=255,o[2]*=255;for(var n=0;n<t;n++)a[n++]=o[0],a[n++]=o[1],a[n++]=o[2];for(e=new ImageData(a,e,e),O=0;6>O;O++)0==T[O].width&&(T[O]=e)}}if(c===a&&(c="equirectangular"),"equirectangular"!=c&&"cubemap"!=c&&"multires"!=c)throw console.log("Error: invalid image type specified!"),{type:"config error"};if(L=c,T=e,C=u,k=v||{},y){if(x&&(b.detachShader(y,x),b.deleteShader(x)),E&&(b.detachShader(y,E),b.deleteShader(E)),b.bindBuffer(b.ARRAY_BUFFER,null),b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,null),y.texture&&b.deleteTexture(y.texture),y.nodeCache)for(e=0;e<y.nodeCache.length;e++)b.deleteTexture(y.nodeCache[e].texture);b.deleteProgram(y),y=a}_=a;var O,U,F=!1;if("cubemap"==L)for(O=0;6>O;O++)0<T[O].width?(U===a&&(U=T[O].width),U!=T[O].width&&console.log("Cube faces have inconsistent widths: "+U+" vs. "+T[O].width)):F=!0;if("cubemap"==L&&0!=(U&U-1)&&(navigator.userAgent.toLowerCase().match(/(iphone|ipod|ipad).* os 8_/)||navigator.userAgent.toLowerCase().match(/(iphone|ipod|ipad).* os 9_/)||navigator.userAgent.toLowerCase().match(/(iphone|ipod|ipad).* os 10_/)||navigator.userAgent.match(/Trident.*rv[ :]*11\./))||(b||(b=N.getContext("experimental-webgl",{alpha:!1,depth:!1})),b&&1286==b.getError()&&w()),!b&&("multires"==L&&T.hasOwnProperty("fallbackPath")||"cubemap"==L)&&("WebkitAppearance"in t.documentElement.style||navigator.userAgent.match(/Trident.*rv[ :]*11\./)||-1!==navigator.appVersion.indexOf("MSIE 10"))){P&&o.removeChild(P),(P=t.createElement("div")).className="pnlm-world",d=T.basePath?T.basePath+T.fallbackPath:T.fallbackPath;var B="frblud".split(""),z=0;f=function(){var e=t.createElement("canvas");e.className="pnlm-face pnlm-"+B[this.side]+"face",P.appendChild(e);var a=e.getContext("2d");e.style.width=this.width+4+"px",e.style.height=this.height+4+"px",e.width=this.width+4,e.height=this.height+4,a.drawImage(this,2,2);var o,n,i=a.getImageData(0,0,e.width,e.height),r=i.data;for(o=2;o<e.width-2;o++)for(n=0;4>n;n++)r[4*(o+e.width)+n]=r[4*(o+2*e.width)+n],r[4*(o+e.width*(e.height-2))+n]=r[4*(o+e.width*(e.height-3))+n];for(o=2;o<e.height-2;o++)for(n=0;4>n;n++)r[4*(o*e.width+1)+n]=r[4*(o*e.width+2)+n],r[4*((o+1)*e.width-2)+n]=r[4*((o+1)*e.width-3)+n];for(n=0;4>n;n++)r[4*(e.width+1)+n]=r[4*(2*e.width+2)+n],r[4*(2*e.width-2)+n]=r[4*(3*e.width-3)+n],r[4*(e.width*(e.height-2)+1)+n]=r[4*(e.width*(e.height-3)+2)+n],r[4*(e.width*(e.height-1)-2)+n]=r[4*(e.width*(e.height-2)-3)+n];for(o=1;o<e.width-1;o++)for(n=0;4>n;n++)r[4*o+n]=r[4*(o+e.width)+n],r[4*(o+e.width*(e.height-1))+n]=r[4*(o+e.width*(e.height-2))+n];for(o=1;o<e.height-1;o++)for(n=0;4>n;n++)r[o*e.width*4+n]=r[4*(o*e.width+1)+n],r[4*((o+1)*e.width-1)+n]=r[4*((o+1)*e.width-2)+n];for(n=0;4>n;n++)r[n]=r[4*(e.width+1)+n],r[4*(e.width-1)+n]=r[4*(2*e.width-2)+n],r[e.width*(e.height-1)*4+n]=r[4*(e.width*(e.height-2)+1)+n],r[4*(e.width*e.height-1)+n]=r[4*(e.width*(e.height-1)-2)+n];a.putImageData(i,0,0),H.call(this)};var H=function(){0<this.width?(M===a&&(M=this.width),M!=this.width&&console.log("Fallback faces have inconsistent widths: "+M+" vs. "+this.width)):F=!0,6==++z&&(M=this.width,o.appendChild(P),m())};F=!1;for(O=0;6>O;O++)(p=new Image).crossOrigin=k.crossOrigin?k.crossOrigin:"anonymous",p.side=O,p.onload=f,p.onerror=H,p.src="multires"==L?d.replace("%s",B[O])+"."+T.extension:T[O].src;g(M)}else{if(!b)throw console.log("Error: no WebGL support detected!"),{type:"no webgl"};for("cubemap"==L&&g(U),T.fullpath=T.basePath?T.basePath+T.path:T.path,T.invTileResolution=1/T.tileResolution,e=[-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],R=[],O=0;6>O;O++)R[O]=e.slice(12*O,12*O+12),e=[-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];if(e=0,"equirectangular"==L){if(e=b.getParameter(b.MAX_TEXTURE_SIZE),Math.max(T.width/2,T.height)>e)throw console.log("Error: The image is too big; it's "+T.width+"px wide, but this device's maximum supported size is "+2*e+"px."),{type:"webgl size error",width:T.width,maxWidth:2*e}}else if("cubemap"==L&&U>b.getParameter(b.MAX_CUBE_MAP_TEXTURE_SIZE))throw console.log("Error: The image is too big; it's "+U+"px wide, but this device's maximum supported size is "+e+"px."),{type:"webgl size error",width:U,maxWidth:e};if(v===a||v.horizonPitch===a&&v.horizonRoll===a||(_=[v.horizonPitch==a?0:v.horizonPitch,v.horizonRoll==a?0:v.horizonRoll]),U=b.TEXTURE_2D,b.viewport(0,0,b.drawingBufferWidth,b.drawingBufferHeight),b.getShaderPrecisionFormat&&(c=b.getShaderPrecisionFormat(b.FRAGMENT_SHADER,b.HIGH_FLOAT))&&1>c.precision&&(r=r.replace("highp","mediump")),x=b.createShader(b.VERTEX_SHADER),c=n,"multires"==L&&(c=i),b.shaderSource(x,c),b.compileShader(x),E=b.createShader(b.FRAGMENT_SHADER),c=l,"cubemap"==L?(U=b.TEXTURE_CUBE_MAP,c=s):"multires"==L&&(c=h),b.shaderSource(E,c),b.compileShader(E),y=b.createProgram(),b.attachShader(y,x),b.attachShader(y,E),b.linkProgram(y),b.getShaderParameter(x,b.COMPILE_STATUS)||console.log(b.getShaderInfoLog(x)),b.getShaderParameter(E,b.COMPILE_STATUS)||console.log(b.getShaderInfoLog(E)),b.getProgramParameter(y,b.LINK_STATUS)||console.log(b.getProgramInfoLog(y)),b.useProgram(y),y.drawInProgress=!1,c=v.backgroundColor?v.backgroundColor:[0,0,0],b.clearColor(c[0],c[1],c[2],1),b.clear(b.COLOR_BUFFER_BIT),y.texCoordLocation=b.getAttribLocation(y,"a_texCoord"),b.enableVertexAttribArray(y.texCoordLocation),"multires"!=L?(I||(I=b.createBuffer()),b.bindBuffer(b.ARRAY_BUFFER,I),b.bufferData(b.ARRAY_BUFFER,new Float32Array([-1,1,1,1,1,-1,-1,1,1,-1,-1,-1]),b.STATIC_DRAW),b.vertexAttribPointer(y.texCoordLocation,2,b.FLOAT,!1,0,0),y.aspectRatio=b.getUniformLocation(y,"u_aspectRatio"),b.uniform1f(y.aspectRatio,b.drawingBufferWidth/b.drawingBufferHeight),y.psi=b.getUniformLocation(y,"u_psi"),y.theta=b.getUniformLocation(y,"u_theta"),y.f=b.getUniformLocation(y,"u_f"),y.h=b.getUniformLocation(y,"u_h"),y.v=b.getUniformLocation(y,"u_v"),y.vo=b.getUniformLocation(y,"u_vo"),y.rot=b.getUniformLocation(y,"u_rot"),b.uniform1f(y.h,d/(2*Math.PI)),b.uniform1f(y.v,f/Math.PI),b.uniform1f(y.vo,p/Math.PI*2),"equirectangular"==L&&(y.backgroundColor=b.getUniformLocation(y,"u_backgroundColor"),b.uniform4fv(y.backgroundColor,c.concat([1]))),y.texture=b.createTexture(),b.bindTexture(U,y.texture),"cubemap"==L?(b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X,0,b.RGB,b.RGB,b.UNSIGNED_BYTE,T[1]),b.texImage2D(b.TEXTURE_CUBE_MAP_NEGATIVE_X,0,b.RGB,b.RGB,b.UNSIGNED_BYTE,T[3]),b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_Y,0,b.RGB,b.RGB,b.UNSIGNED_BYTE,T[4]),b.texImage2D(b.TEXTURE_CUBE_MAP_NEGATIVE_Y,0,b.RGB,b.RGB,b.UNSIGNED_BYTE,T[5]),b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_Z,0,b.RGB,b.RGB,b.UNSIGNED_BYTE,T[0]),b.texImage2D(b.TEXTURE_CUBE_MAP_NEGATIVE_Z,0,b.RGB,b.RGB,b.UNSIGNED_BYTE,T[2])):T.width<=e?(b.uniform1i(b.getUniformLocation(y,"u_splitImage"),0),b.texImage2D(U,0,b.RGB,b.RGB,b.UNSIGNED_BYTE,T)):(b.uniform1i(b.getUniformLocation(y,"u_splitImage"),1),(d=t.createElement("canvas")).width=T.width/2,d.height=T.height,(d=d.getContext("2d")).drawImage(T,0,0),f=d.getImageData(0,0,T.width/2,T.height),b.texImage2D(U,0,b.RGB,b.RGB,b.UNSIGNED_BYTE,f),y.texture2=b.createTexture(),b.activeTexture(b.TEXTURE1),b.bindTexture(U,y.texture2),b.uniform1i(b.getUniformLocation(y,"u_image1"),1),d.drawImage(T,-T.width/2,0),f=d.getImageData(0,0,T.width/2,T.height),b.texImage2D(U,0,b.RGB,b.RGB,b.UNSIGNED_BYTE,f),b.texParameteri(U,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE),b.texParameteri(U,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE),b.texParameteri(U,b.TEXTURE_MIN_FILTER,b.LINEAR),b.texParameteri(U,b.TEXTURE_MAG_FILTER,b.LINEAR),b.activeTexture(b.TEXTURE0)),b.texParameteri(U,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE),b.texParameteri(U,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE),b.texParameteri(U,b.TEXTURE_MIN_FILTER,b.LINEAR),b.texParameteri(U,b.TEXTURE_MAG_FILTER,b.LINEAR)):(y.vertPosLocation=b.getAttribLocation(y,"a_vertCoord"),b.enableVertexAttribArray(y.vertPosLocation),A||(A=b.createBuffer()),S||(S=b.createBuffer()),D||(D=b.createBuffer()),b.bindBuffer(b.ARRAY_BUFFER,S),b.bufferData(b.ARRAY_BUFFER,new Float32Array([0,0,1,0,1,1,0,1]),b.STATIC_DRAW),b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,D),b.bufferData(b.ELEMENT_ARRAY_BUFFER,new Uint16Array([0,1,2,0,2,3]),b.STATIC_DRAW),y.perspUniform=b.getUniformLocation(y,"u_perspMatrix"),y.cubeUniform=b.getUniformLocation(y,"u_cubeMatrix"),y.level=-1,y.currentNodes=[],y.nodeCache=[],y.nodeCacheTimestamp=0),0!==(d=b.getError()))throw console.log("Error: Something went wrong with WebGL!",d),{type:"webgl error"};m()}},this.destroy=function(){if(o!==a&&(N!==a&&o.contains(N)&&o.removeChild(N),P!==a&&o.contains(P)&&o.removeChild(P)),b){var e=b.getExtension("WEBGL_lose_context");e&&e.loseContext()}},this.resize=function(){var t=e.devicePixelRatio||1;N.width=N.clientWidth*t,N.height=N.clientHeight*t,b&&(1286==b.getError()&&w(),b.viewport(0,0,b.drawingBufferWidth,b.drawingBufferHeight),"multires"!=L&&b.uniform1f(y.aspectRatio,N.clientWidth/N.clientHeight))},this.resize(),this.setPose=function(e,t){_=[e,t]},this.render=function(e,t,o,n){var i,r=0;if(n===a&&(n={}),n.roll&&(r=n.roll),_!==a){i=_[0];var s=_[1],l=e,h=t,g=Math.cos(s)*Math.sin(e)*Math.sin(i)+Math.cos(e)*(Math.cos(i)*Math.cos(t)+Math.sin(s)*Math.sin(i)*Math.sin(t)),w=-Math.sin(e)*Math.sin(s)+Math.cos(e)*Math.cos(s)*Math.sin(t);e=Math.cos(s)*Math.cos(i)*Math.sin(e)+Math.cos(e)*(-Math.cos(t)*Math.sin(i)+Math.cos(i)*Math.sin(s)*Math.sin(t)),e=Math.asin(Math.max(Math.min(e,1),-1)),t=Math.atan2(w,g),i=[Math.cos(l)*(Math.sin(s)*Math.sin(i)*Math.cos(h)-Math.cos(i)*Math.sin(h)),Math.cos(l)*Math.cos(s)*Math.cos(h),Math.cos(l)*(Math.cos(i)*Math.sin(s)*Math.cos(h)+Math.sin(h)*Math.sin(i))],s=[-Math.cos(e)*Math.sin(t),Math.cos(e)*Math.cos(t)],s=Math.acos(Math.max(Math.min((i[0]*s[0]+i[1]*s[1])/(Math.sqrt(i[0]*i[0]+i[1]*i[1]+i[2]*i[2])*Math.sqrt(s[0]*s[0]+s[1]*s[1])),1),-1)),0>i[2]&&(s=2*Math.PI-s),r+=s}if(b||"multires"!=L&&"cubemap"!=L){if("multires"!=L)o=2*Math.atan(Math.tan(.5*o)/(b.drawingBufferWidth/b.drawingBufferHeight)),o=1/Math.tan(.5*o),b.uniform1f(y.psi,t),b.uniform1f(y.theta,e),b.uniform1f(y.rot,r),b.uniform1f(y.f,o),!0===C&&"equirectangular"==L&&(b.bindTexture(b.TEXTURE_2D,y.texture),b.texImage2D(b.TEXTURE_2D,0,b.RGB,b.RGB,b.UNSIGNED_BYTE,T)),b.drawArrays(b.TRIANGLES,0,6);else{for(i=b.drawingBufferWidth/b.drawingBufferHeight,s=2*Math.atan(Math.tan(o/2)*b.drawingBufferHeight/b.drawingBufferWidth),i=[(s=1/Math.tan(s/2))/i,0,0,0,0,s,0,0,0,0,100.1/-99.9,20/-99.9,0,0,-1,0],s=1;s<T.maxLevel&&b.drawingBufferWidth>T.tileResolution*Math.pow(2,s-1)*Math.tan(o/2)*.707;)s++;if(y.level=s,s=p(s=[1,0,0,0,1,0,0,0,1],-r,"z"),s=p(s,-e,"x"),s=[(s=p(s,t,"y"))[0],s[1],s[2],0,s[3],s[4],s[5],0,s[6],s[7],s[8],0,0,0,0,1],b.uniformMatrix4fv(y.perspUniform,!1,new Float32Array(m(i))),b.uniformMatrix4fv(y.cubeUniform,!1,new Float32Array(m(s))),r=[i[0]*s[0],i[0]*s[1],i[0]*s[2],0,i[5]*s[4],i[5]*s[5],i[5]*s[6],0,i[10]*s[8],i[10]*s[9],i[10]*s[10],i[11],-s[8],-s[9],-s[10],0],y.nodeCache.sort(c),200<y.nodeCache.length&&y.nodeCache.length>y.currentNodes.length+50)for(i=y.nodeCache.splice(200,y.nodeCache.length-200),s=0;s<i.length;s++)b.deleteTexture(i[s].texture);for(y.currentNodes=[],s="fbudlr".split(""),i=0;6>i;i++)f(r,l=new d(R[i],s[i],1,0,0,T.fullpath),e,t,o);for(y.currentNodes.sort(u),e=O.length-1;0<=e;e--)-1===y.currentNodes.indexOf(O[e].node)&&(O[e].node.textureLoad=!1,O.splice(e,1));if(0===O.length)for(e=0;e<y.currentNodes.length;e++)if(!(t=y.currentNodes[e]).texture&&!t.textureLoad){t.textureLoad=!0,setTimeout(v,0,t);break}if(!y.drawInProgress){for(y.drawInProgress=!0,b.clear(b.COLOR_BUFFER_BIT),e=0;e<y.currentNodes.length;e++)1<y.currentNodes[e].textureLoaded&&(b.bindBuffer(b.ARRAY_BUFFER,A),b.bufferData(b.ARRAY_BUFFER,new Float32Array(y.currentNodes[e].vertices),b.STATIC_DRAW),b.vertexAttribPointer(y.vertPosLocation,3,b.FLOAT,!1,0,0),b.bindBuffer(b.ARRAY_BUFFER,S),b.vertexAttribPointer(y.texCoordLocation,2,b.FLOAT,!1,0,0),b.bindTexture(b.TEXTURE_2D,y.currentNodes[e].texture),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));y.drawInProgress=!1}}if(n.returnImage!==a)return N.toDataURL("image/png")}else for(n={f:"translate3d(-"+((i=M/2)+2)+"px, -"+(i+2)+"px, -"+i+"px)",b:"translate3d("+(i+2)+"px, -"+(i+2)+"px, "+i+"px) rotateX(180deg) rotateZ(180deg)",u:"translate3d(-"+(i+2)+"px, -"+i+"px, "+(i+2)+"px) rotateX(270deg)",d:"translate3d(-"+(i+2)+"px, "+i+"px, -"+(i+2)+"px) rotateX(90deg)",l:"translate3d(-"+i+"px, -"+(i+2)+"px, "+(i+2)+"px) rotateX(180deg) rotateY(90deg) rotateZ(180deg)",r:"translate3d("+i+"px, -"+(i+2)+"px, -"+(i+2)+"px) rotateY(270deg)"},t="perspective("+(o=(o=1/Math.tan(o/2))*N.clientWidth/2+"px")+") translateZ("+o+") rotateX("+e+"rad) rotateY("+t+"rad) ",o=Object.keys(n),e=0;6>e;e++)(r=P.querySelector(".pnlm-"+o[e]+"face"))&&(r.style.webkitTransform=t+n[o[e]],r.style.transform=t+n[o[e]])},this.isLoading=function(){if(b&&"multires"==L)for(var e=0;e<y.currentNodes.length;e++)if(!y.currentNodes[e].textureLoaded)return!0;return!1},this.getCanvas=function(){return N};var O=[],U=function(){function e(){var e=this;this.texture=this.callback=null,this.image=new Image,this.image.crossOrigin=a||"anonymous";var t=function(){if(0<e.image.width&&0<e.image.height){var t=e.image;b.bindTexture(b.TEXTURE_2D,e.texture),b.texImage2D(b.TEXTURE_2D,0,b.RGB,b.RGB,b.UNSIGNED_BYTE,t),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.LINEAR),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE),b.bindTexture(b.TEXTURE_2D,null),e.callback(e.texture,!0)}else e.callback(e.texture,!1);O.length?(t=O.shift(),e.loadTexture(t.src,t.texture,t.callback)):n[o++]=e};this.image.addEventListener("load",t),this.image.addEventListener("error",t)}function t(e,t,a,o){this.node=e,this.src=t,this.texture=a,this.callback=o}var a,o=4,n={};e.prototype.loadTexture=function(e,t,a){this.texture=t,this.callback=a,this.image.src=e};for(var i=0;i<o;i++)n[i]=new e;return function(e,i,r,s){return a=s,s=b.createTexture(),o?n[--o].loadTexture(i,s,r):O.push(new t(e,i,s,r)),s}}()}var n="attribute vec2 a_texCoord;varying vec2 v_texCoord;void main() {gl_Position = vec4(a_texCoord, 0.0, 1.0);v_texCoord = a_texCoord;}",i="attribute vec3 a_vertCoord;attribute vec2 a_texCoord;uniform mat4 u_cubeMatrix;uniform mat4 u_perspMatrix;varying mediump vec2 v_texCoord;void main(void) {gl_Position = u_perspMatrix * u_cubeMatrix * vec4(a_vertCoord, 1.0);v_texCoord = a_texCoord;}",r="precision highp float;\nuniform float u_aspectRatio;\nuniform float u_psi;\nuniform float u_theta;\nuniform float u_f;\nuniform float u_h;\nuniform float u_v;\nuniform float u_vo;\nuniform float u_rot;\nconst float PI = 3.14159265358979323846264;\nuniform sampler2D u_image0;\nuniform sampler2D u_image1;\nuniform bool u_splitImage;\nuniform samplerCube u_imageCube;\nvarying vec2 v_texCoord;\nuniform vec4 u_backgroundColor;\nvoid main() {\nfloat x = v_texCoord.x * u_aspectRatio;\nfloat y = v_texCoord.y;\nfloat sinrot = sin(u_rot);\nfloat cosrot = cos(u_rot);\nfloat rot_x = x * cosrot - y * sinrot;\nfloat rot_y = x * sinrot + y * cosrot;\nfloat sintheta = sin(u_theta);\nfloat costheta = cos(u_theta);\nfloat a = u_f * costheta - rot_y * sintheta;\nfloat root = sqrt(rot_x * rot_x + a * a);\nfloat lambda = atan(rot_x / root, a / root) + u_psi;\nfloat phi = atan((rot_y * costheta + u_f * sintheta) / root);",s=r+"float cosphi = cos(phi);\ngl_FragColor = textureCube(u_imageCube, vec3(cosphi*sin(lambda), sin(phi), cosphi*cos(lambda)));\n}",l=r+"lambda = mod(lambda + PI, PI * 2.0) - PI;\nvec2 coord = vec2(lambda / PI, phi / (PI / 2.0));\nif(coord.x < -u_h || coord.x > u_h || coord.y < -u_v + u_vo || coord.y > u_v + u_vo)\ngl_FragColor = u_backgroundColor;\nelse {\nif(u_splitImage) {\nif(coord.x < 0.0)\ngl_FragColor = texture2D(u_image0, vec2((coord.x + u_h) / u_h, (-coord.y + u_v + u_vo) / (u_v * 2.0)));\nelse\ngl_FragColor = texture2D(u_image1, vec2((coord.x + u_h) / u_h - 1.0, (-coord.y + u_v + u_vo) / (u_v * 2.0)));\n} else {\ngl_FragColor = texture2D(u_image0, vec2((coord.x + u_h) / (u_h * 2.0), (-coord.y + u_v + u_vo) / (u_v * 2.0)));\n}\n}\n}",h="varying mediump vec2 v_texCoord;uniform sampler2D u_sampler;void main(void) {gl_FragColor = texture2D(u_sampler, v_texCoord);}";return{renderer:function(e,t,a,n){return new o(e,t,a,n)}}}(window,document),window.pannellum=function(e,t,a){function o(o,n){function i(){if((c=t.createElement("div")).innerHTML="\x3c!--[if lte IE 9]><i></i><![endif]--\x3e",1==c.getElementsByTagName("i").length)l();else{var o;if(ae=V.hfov,oe=V.pitch,"cubemap"==V.type){for($=[],c=0;6>c;c++)$.push(new Image),$[c].crossOrigin=V.crossOrigin;Se.load.lbox.style.display="block",Se.load.lbar.style.display="none"}else if("multires"==V.type)c=JSON.parse(JSON.stringify(V.multiRes)),V.basePath&&V.multiRes.basePath&&!/^(?:[a-z]+:)?\/\//i.test(V.multiRes.basePath)?c.basePath=V.basePath+V.multiRes.basePath:V.multiRes.basePath?c.basePath=V.multiRes.basePath:V.basePath&&(c.basePath=V.basePath),$=c;else if(!0===V.dynamic)$=V.panorama;else{if(V.panorama===a)return void l(V.strings.noPanoramaError);$=new Image}if("cubemap"==V.type)for(var n=6,i=function(){0===--n&&s()},h=function(e){var a=t.createElement("a");a.href=e.target.src,a.textContent=a.href,l(V.strings.fileAccessError.replace("%s",a.outerHTML))},c=0;c<$.length;c++)"null"==(o=V.cubeMap[c])?(console.log("Will use background instead of missing cubemap face "+c),i()):(V.basePath&&!r(o)&&(o=V.basePath+o),$[c].onload=i,$[c].onerror=h,$[c].src=Z(o));else if("multires"==V.type)s();else if(o="",V.basePath&&(o=V.basePath),!0!==V.dynamic){o=r(V.panorama)?V.panorama:o+V.panorama,$.onload=function(){e.URL.revokeObjectURL(this.src),s()};var u=new XMLHttpRequest;u.onloadend=function(){if(200!=u.status){var n=t.createElement("a");n.href=o,n.textContent=n.href,l(V.strings.fileAccessError.replace("%s",n.outerHTML))}!function(t){var o=new FileReader;o.addEventListener("loadend",(function(){var n=o.result;navigator.userAgent.toLowerCase().match(/(iphone|ipod|ipad).* os 8_/)&&((0>(s=n.indexOf("ÿÂ"))||65536<s)&&l(V.strings.iOS8WebGLError));if(-1<(s=n.indexOf("<x:xmpmeta"))&&!0!==V.ignoreGPanoXMP){var i=n.substring(s,n.indexOf("</x:xmpmeta>")+12),r=function(e){var t;return 0<=i.indexOf(e+'="')?t=(t=i.substring(i.indexOf(e+'="')+e.length+2)).substring(0,t.indexOf('"')):0<=i.indexOf(e+">")&&(t=(t=i.substring(i.indexOf(e+">")+e.length+1)).substring(0,t.indexOf("<"))),t!==a?Number(t):null},s=(n=r("GPano:FullPanoWidthPixels"),r("GPano:CroppedAreaImageWidthPixels")),h=r("GPano:FullPanoHeightPixels"),c=r("GPano:CroppedAreaImageHeightPixels"),u=r("GPano:CroppedAreaTopPixels"),d=r("GPano:PoseHeadingDegrees"),f=r("GPano:PosePitchDegrees");r=r("GPano:PoseRollDegrees");null!==n&&null!==s&&null!==h&&null!==c&&null!==u&&(0>Me.indexOf("haov")&&(V.haov=s/n*360),0>Me.indexOf("vaov")&&(V.vaov=c/h*180),0>Me.indexOf("vOffset")&&(V.vOffset=-180*((u+c/2)/h-.5)),null!==d&&0>Me.indexOf("northOffset")&&(V.northOffset=d,!1!==V.compass&&(V.compass=!0)),null!==f&&null!==r&&(0>Me.indexOf("horizonPitch")&&(V.horizonPitch=f),0>Me.indexOf("horizonRoll")&&(V.horizonRoll=r)))}$.src=e.URL.createObjectURL(t)})),o.readAsBinaryString!==a?o.readAsBinaryString(t):o.readAsText(t)}(this.response),Se.load.msg.innerHTML=""},u.onprogress=function(e){var t,a;e.lengthComputable?(Se.load.lbarFill.style.width=e.loaded/e.total*100+"%",1e6<e.total?(t="MB",a=(e.loaded/1e6).toFixed(2),e=(e.total/1e6).toFixed(2)):1e3<e.total?(t="kB",a=(e.loaded/1e3).toFixed(1),e=(e.total/1e3).toFixed(1)):(t="B",a=e.loaded,e=e.total),Se.load.msg.innerHTML=a+" / "+e+" "+t):(Se.load.lbox.style.display="block",Se.load.lbar.style.display="none")};try{u.open("GET",o,!0)}catch(e){l(V.strings.malformedURLError)}u.responseType="blob",u.setRequestHeader("Accept","image/*,*/*;q=0.9"),u.withCredentials="use-credentials"===V.crossOrigin,u.send()}V.draggable&&Le.classList.add("pnlm-grab"),Le.classList.remove("pnlm-grabbing"),Pe=!0===V.dynamicUpdate,V.dynamic&&Pe&&($=V.panorama,s())}}function r(e){return/^(?:[a-z]+:)?\/\//i.test(e)||"/"==e[0]||"blob:"==e.slice(0,5)}function s(){K||(K=new libpannellum.renderer(Ce)),me||(me=!0,Ie.addEventListener("mousedown",c,!1),t.addEventListener("mousemove",f,!1),t.addEventListener("mouseup",p,!1),V.mouseZoom&&(Le.addEventListener("mousewheel",x,!1),Le.addEventListener("DOMMouseScroll",x,!1)),V.doubleClickZoom&&Ie.addEventListener("dblclick",u,!1),o.addEventListener("mozfullscreenchange",F,!1),o.addEventListener("webkitfullscreenchange",F,!1),o.addEventListener("msfullscreenchange",F,!1),o.addEventListener("fullscreenchange",F,!1),e.addEventListener("resize",T,!1),e.addEventListener("orientationchange",T,!1),V.disableKeyboardCtrl||(o.addEventListener("keydown",E,!1),o.addEventListener("keyup",P,!1),o.addEventListener("blur",M,!1)),t.addEventListener("mouseleave",p,!1),""===t.documentElement.style.pointerAction&&""===t.documentElement.style.touchAction?(Ie.addEventListener("pointerdown",w,!1),Ie.addEventListener("pointermove",y,!1),Ie.addEventListener("pointerup",b,!1),Ie.addEventListener("pointerleave",b,!1)):(Ie.addEventListener("touchstart",m,!1),Ie.addEventListener("touchmove",v,!1),Ie.addEventListener("touchend",g,!1)),e.navigator.pointerEnabled&&(o.style.touchAction="none")),function(){try{var e={};V.horizonPitch!==a&&(e.horizonPitch=V.horizonPitch*Math.PI/180),V.horizonRoll!==a&&(e.horizonRoll=V.horizonRoll*Math.PI/180),V.backgroundColor!==a&&(e.backgroundColor=V.backgroundColor),K.init($,V.type,V.dynamic,V.haov*Math.PI/180,V.vaov*Math.PI/180,V.vOffset*Math.PI/180,S,e),!0!==V.dynamic&&($=a)}catch(e){if("webgl error"==e.type||"no webgl"==e.type)l();else{if("webgl size error"!=e.type)throw l(V.strings.unknownError),e;l(V.strings.textureSizeError.replace("%s",e.width).replace("%s",e.maxWidth))}}}(),z(V.hfov),setTimeout((function(){}),500)}function l(e){e===a&&(e=V.strings.genericWebGLError),Se.errorMsg.innerHTML="<p>"+e+"</p>",ke.load.style.display="none",Se.load.box.style.display="none",Se.errorMsg.style.display="table",pe=!0,Q=a,Ce.style.display="none",j("error",e)}function h(e){var t=o.getBoundingClientRect(),a={};return a.x=(e.clientX||e.pageX)-t.left,a.y=(e.clientY||e.pageY)-t.top,a}function c(e){if(e.preventDefault(),o.focus(),Q&&V.draggable){var t=h(e);if(V.hotSpotDebug){var a=d(e);console.log("Pitch: "+a[0]+", Yaw: "+a[1]+", Center Pitch: "+V.pitch+", Center Yaw: "+V.yaw+", HFOV: "+V.hfov)}H(),X(),V.roll=0,ve.hfov=0,ie=!0,re=Date.now(),se=t.x,le=t.y,ce=V.yaw,ue=V.pitch,Le.classList.add("pnlm-grabbing"),Le.classList.remove("pnlm-grab"),j("mousedown",e),L()}}function u(e){V.minHfov===V.hfov?ne.setHfov(ae,1e3):(e=d(e),ne.lookAt(e[0],e[1],V.minHfov,1e3))}function d(e){var t=h(e),a=(e=K.getCanvas()).clientWidth,o=e.clientHeight;e=t.x/a*2-1;o=(1-t.y/o*2)*o/a;var n=1/Math.tan(V.hfov*Math.PI/360),i=Math.sin(V.pitch*Math.PI/180),r=Math.cos(V.pitch*Math.PI/180);t=n*r-o*i,a=Math.sqrt(e*e+t*t),o=180*Math.atan((o*r+n*i)/a)/Math.PI;return-180>(e=180*Math.atan2(e/a,t/a)/Math.PI+V.yaw)&&(e+=360),180<e&&(e-=360),[o,e]}function f(e){if(ie&&Q){re=Date.now();var t=(a=K.getCanvas()).clientWidth,a=a.clientHeight;e=h(e);var o=180*(Math.atan(se/t*2-1)-Math.atan(e.x/t*2-1))/Math.PI*V.hfov/90+ce;ve.yaw=(o-V.yaw)%360*.2,V.yaw=o,t=360*Math.atan(Math.tan(V.hfov/360*Math.PI)*a/t)/Math.PI,t=180*(Math.atan(e.y/a*2-1)-Math.atan(le/a*2-1))/Math.PI*t/90+ue,ve.pitch=.2*(t-V.pitch),V.pitch=t}}function p(e){ie&&(ie=!1,15<Date.now()-re&&(ve.pitch=ve.yaw=0),Le.classList.add("pnlm-grab"),Le.classList.remove("pnlm-grabbing"),re=Date.now(),j("mouseup",e))}function m(e){if(Q&&V.draggable){H(),X(),V.roll=0,ve.hfov=0;var t=h(e.targetTouches[0]);if(se=t.x,le=t.y,2==e.targetTouches.length){var a=h(e.targetTouches[1]);se+=.5*(a.x-t.x),le+=.5*(a.y-t.y),he=Math.sqrt((t.x-a.x)*(t.x-a.x)+(t.y-a.y)*(t.y-a.y))}ie=!0,re=Date.now(),ce=V.yaw,ue=V.pitch,j("touchstart",e),L()}}function v(e){if(V.draggable&&(e.preventDefault(),Q&&(re=Date.now()),ie&&Q)){var t=h(e.targetTouches[0]),a=t.x,o=t.y;2==e.targetTouches.length&&-1!=he&&(a+=.5*((e=h(e.targetTouches[1])).x-t.x),o+=.5*(e.y-t.y),t=Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y)),z(V.hfov+.1*(he-t)),he=t),t=V.hfov/360*V.touchPanSpeedCoeffFactor,a=(se-a)*t+ce,ve.yaw=(a-V.yaw)%360*.2,V.yaw=a,o=(o-le)*t+ue,ve.pitch=.2*(o-V.pitch),V.pitch=o}}function g(){ie=!1,150<Date.now()-re&&(ve.pitch=ve.yaw=0),he=-1,re=Date.now(),j("touchend",event)}function w(e){"touch"==e.pointerType&&Q&&V.draggable&&(Ue.push(e.pointerId),Fe.push({clientX:e.clientX,clientY:e.clientY}),e.targetTouches=Fe,m(e),e.preventDefault())}function y(e){if("touch"==e.pointerType&&V.draggable)for(var t=0;t<Ue.length;t++)if(e.pointerId==Ue[t]){Fe[t].clientX=e.clientX,Fe[t].clientY=e.clientY,e.targetTouches=Fe,v(e),e.preventDefault();break}}function b(e){if("touch"==e.pointerType){for(var t=!1,o=0;o<Ue.length;o++)e.pointerId==Ue[o]&&(Ue[o]=a),Ue[o]&&(t=!0);t||(Ue=[],Fe=[],g()),e.preventDefault()}}function x(e){Q&&("fullscreenonly"!=V.mouseZoom||fe)&&(e.preventDefault(),H(),re=Date.now(),e.wheelDeltaY?(z(V.hfov-.05*e.wheelDeltaY),ve.hfov=0>e.wheelDelta?1:-1):e.wheelDelta?(z(V.hfov-.05*e.wheelDelta),ve.hfov=0>e.wheelDelta?1:-1):e.detail&&(z(V.hfov+1.5*e.detail),ve.hfov=0<e.detail?1:-1),L())}function E(e){H(),re=Date.now(),X(),V.roll=0;var t=e.which||e.keycode;0>V.capturedKeyNumbers.indexOf(t)||(e.preventDefault(),27==t?fe&&U():R(t,!0))}function M(){for(var e=0;10>e;e++)de[e]=!1}function P(e){var t=e.which||e.keycode;0>V.capturedKeyNumbers.indexOf(t)||(e.preventDefault(),R(t,!1))}function R(e,t){var a=!1;switch(e){case 109:case 189:case 17:case 173:de[0]!=t&&(a=!0),de[0]=t;break;case 107:case 187:case 16:case 61:de[1]!=t&&(a=!0),de[1]=t;break;case 38:de[2]!=t&&(a=!0),de[2]=t;break;case 87:de[6]!=t&&(a=!0),de[6]=t;break;case 40:de[3]!=t&&(a=!0),de[3]=t;break;case 83:de[7]!=t&&(a=!0),de[7]=t;break;case 37:de[4]!=t&&(a=!0),de[4]=t;break;case 65:de[8]!=t&&(a=!0),de[8]=t;break;case 39:de[5]!=t&&(a=!0),de[5]=t;break;case 68:de[9]!=t&&(a=!0),de[9]=t}a&&t&&(ee="undefined"!=typeof performance&&performance.now()?performance.now():Date.now(),L())}function _(e){var t=xe[e],a=Math.min(1,Math.max((Date.now()-t.startTime)/1e3/(t.duration/1e3),0));a=t.startPosition+V.animationTimingFunction(a)*(t.endPosition-t.startPosition);(t.endPosition>t.startPosition&&a>=t.endPosition||t.endPosition<t.startPosition&&a<=t.endPosition||t.endPosition===t.startPosition)&&(a=t.endPosition,ve[e]=0,delete xe[e]),V[e]=a}function T(){F("resize")}function L(){ge||(ge=!0,C())}function C(){if(!_e)if(function(){var e;if(Q){var t=K.getCanvas();!1!==V.autoRotate&&(360<V.yaw?V.yaw-=360:-360>V.yaw&&(V.yaw+=360)),e=V.yaw;var o=0;if(V.avoidShowingBackground){var n=V.hfov/2,i=180*Math.atan2(Math.tan(n/180*Math.PI),t.width/t.height)/Math.PI;V.vaov>V.haov?Math.min(Math.cos((V.pitch-n)/180*Math.PI),Math.cos((V.pitch+n)/180*Math.PI)):o=n*(1-Math.min(Math.cos((V.pitch-i)/180*Math.PI),Math.cos((V.pitch+i)/180*Math.PI)))}i=-180;var r=180;360>(n=V.maxYaw-V.minYaw)&&(i=V.minYaw+V.hfov/2+o,r=V.maxYaw-V.hfov/2-o,n<V.hfov&&(i=r=(i+r)/2),V.yaw=Math.max(i,Math.min(r,V.yaw))),!1===V.autoRotate&&(360<V.yaw?V.yaw-=360:-360>V.yaw&&(V.yaw+=360)),!1!==V.autoRotate&&e!=V.yaw&&ee!==a&&(V.autoRotate*=-1),e=2*Math.atan(Math.tan(V.hfov/180*Math.PI*.5)/(t.width/t.height))/Math.PI*180,t=V.minPitch+e/2,o=V.maxPitch-e/2,V.maxPitch-V.minPitch<e&&(t=o=(t+o)/2),isNaN(t)&&(t=-90),isNaN(o)&&(o=90),V.pitch=Math.max(t,Math.min(o,V.pitch)),K.render(V.pitch*Math.PI/180,V.yaw*Math.PI/180,V.hfov*Math.PI/180,{roll:V.roll*Math.PI/180}),V.hotSpots.forEach(k),V.compass&&(Oe.style.transform="rotate("+(-V.yaw-V.northOffset)+"deg)",Oe.style.webkitTransform="rotate("+(-V.yaw-V.northOffset)+"deg)")}}(),te&&clearTimeout(te),ie||!0===we)requestAnimationFrame(C);else if(de[0]||de[1]||de[2]||de[3]||de[4]||de[5]||de[6]||de[7]||de[8]||de[9]||V.autoRotate||xe.pitch||xe.yaw||xe.hfov||.01<Math.abs(ve.yaw)||.01<Math.abs(ve.pitch)||.01<Math.abs(ve.hfov))(function(){if(Q){var e,t=!1,o=V.pitch,n=V.yaw,i=V.hfov;e="undefined"!=typeof performance&&performance.now()?performance.now():Date.now(),ee===a&&(ee=e);var r=(e-ee)*V.hfov/1700;if(r=Math.min(r,1),de[0]&&!0===V.keyboardZoom&&(z(V.hfov+(.8*ve.hfov+.5)*r),t=!0),de[1]&&!0===V.keyboardZoom&&(z(V.hfov+(.8*ve.hfov-.2)*r),t=!0),(de[2]||de[6])&&(V.pitch+=(.8*ve.pitch+.2)*r,t=!0),(de[3]||de[7])&&(V.pitch+=(.8*ve.pitch-.2)*r,t=!0),(de[4]||de[8])&&(V.yaw+=(.8*ve.yaw-.2)*r,t=!0),(de[5]||de[9])&&(V.yaw+=(.8*ve.yaw+.2)*r,t=!0),t&&(re=Date.now()),V.autoRotate){if(.001<e-ee){t=(e-ee)/1e3;var s=(ve.yaw/t*r-.2*V.autoRotate)*t;s=(0<-V.autoRotate?1:-1)*Math.min(Math.abs(V.autoRotate*t),Math.abs(s)),V.yaw+=s}V.autoRotateStopDelay&&(V.autoRotateStopDelay-=e-ee,0>=V.autoRotateStopDelay&&(V.autoRotateStopDelay=!1,be=V.autoRotate,V.autoRotate=0))}xe.pitch&&(_("pitch"),o=V.pitch),xe.yaw&&(_("yaw"),n=V.yaw),xe.hfov&&(_("hfov"),i=V.hfov),0<r&&!V.autoRotate&&(t=1-V.friction,de[4]||de[5]||de[8]||de[9]||xe.yaw||(V.yaw+=ve.yaw*r*t),de[2]||de[3]||de[6]||de[7]||xe.pitch||(V.pitch+=ve.pitch*r*t),de[0]||de[1]||xe.hfov||z(V.hfov+ve.hfov*r*t)),ee=e,0<r&&(ve.yaw=.8*ve.yaw+(V.yaw-n)/r*.2,ve.pitch=.8*ve.pitch+(V.pitch-o)/r*.2,ve.hfov=.8*ve.hfov+(V.hfov-i)/r*.2,o=V.autoRotate?Math.abs(V.autoRotate):5,ve.yaw=Math.min(o,Math.max(ve.yaw,-o)),ve.pitch=Math.min(o,Math.max(ve.pitch,-o)),ve.hfov=Math.min(o,Math.max(ve.hfov,-o))),de[0]&&de[1]&&(ve.hfov=0),(de[2]||de[6])&&(de[3]||de[7])&&(ve.pitch=0),(de[4]||de[8])&&(de[5]||de[9])&&(ve.yaw=0)}})(),0<=V.autoRotateInactivityDelay&&be&&Date.now()-re>V.autoRotateInactivityDelay&&!V.autoRotate&&(V.autoRotate=be,ne.lookAt(oe,a,ae,3e3)),requestAnimationFrame(C);else if(K&&(K.isLoading()||!0===V.dynamic&&Pe))requestAnimationFrame(C);else{j("animatefinished",{pitch:ne.getPitch(),yaw:ne.getYaw(),hfov:ne.getHfov()}),ge=!1,ee=a;var e=V.autoRotateInactivityDelay-(Date.now()-re);0<e?te=setTimeout((function(){V.autoRotate=be,ne.lookAt(oe,a,ae,3e3),L()}),e):0<=V.autoRotateInactivityDelay&&be&&(V.autoRotate=be,ne.lookAt(oe,a,ae,3e3),L())}}function I(e,t,a,o){this.w=e,this.x=t,this.y=a,this.z=o}function A(t){var a;a=t.alpha;var o=t.beta;t=t.gamma,o=[o?o*Math.PI/180/2:0,t?t*Math.PI/180/2:0,a?a*Math.PI/180/2:0],a=[Math.cos(o[0]),Math.cos(o[1]),Math.cos(o[2])],o=[Math.sin(o[0]),Math.sin(o[1]),Math.sin(o[2])],a=(a=new I(a[0]*a[1]*a[2]-o[0]*o[1]*o[2],o[0]*a[1]*a[2]-a[0]*o[1]*o[2],a[0]*o[1]*a[2]+o[0]*a[1]*o[2],a[0]*a[1]*o[2]+o[0]*o[1]*a[2])).multiply(new I(Math.sqrt(.5),-Math.sqrt(.5),0,0)),o=e.orientation?-e.orientation*Math.PI/180/2:0,a=a.multiply(new I(Math.cos(o),0,-Math.sin(o),0)).toEulerAngles(),"number"==typeof we&&10>we?we+=1:10===we?(ye=a[2]/Math.PI*180+V.yaw,we=!0,requestAnimationFrame(C)):(V.pitch=a[0]/Math.PI*180,V.roll=-a[1]/Math.PI*180,V.yaw=-a[2]/Math.PI*180+ye)}function S(){if(V.sceneFadeDuration&&K.fadeImg!==a){K.fadeImg.style.opacity=0;var e=K.fadeImg;delete K.fadeImg,setTimeout((function(){Ce.removeChild(e),j("scenechangefadedone")}),V.sceneFadeDuration)}Oe.style.display=V.compass?"inline":"none",Re||(V.hotSpots?(V.hotSpots=V.hotSpots.sort((function(e,t){return e.pitch<t.pitch})),V.hotSpots.forEach(D)):V.hotSpots=[],Re=!0,V.hotSpots.forEach(k)),Se.load.box.style.display="none",J!==a&&(Ce.removeChild(J),J=a),Q=!0,j("load"),L()}function D(e){e.pitch=Number(e.pitch)||0,e.yaw=Number(e.yaw)||0;var a=t.createElement("div");a.className="pnlm-hotspot-base",a.className=e.cssClass?a.className+" "+e.cssClass:a.className+" pnlm-hotspot pnlm-sprite pnlm-"+q(e.type);var o,n=t.createElement("span");if(e.text&&(n.innerHTML=q(e.text)),e.video){o=t.createElement("video");var i=e.video;V.basePath&&!r(i)&&(i=V.basePath+i),o.src=Z(i),o.controls=!0,o.style.width=e.width+"px",Ce.appendChild(a),n.appendChild(o)}else if(e.image){i=e.image,V.basePath&&!r(i)&&(i=V.basePath+i),(o=t.createElement("a")).href=Z(e.URL?e.URL:i,!0),o.target="_blank",n.appendChild(o);var s=t.createElement("img");s.src=Z(i),s.style.width=e.width+"px",s.style.paddingTop="5px",Ce.appendChild(a),o.appendChild(s),n.style.maxWidth="initial"}else if(e.URL){if((o=t.createElement("a")).href=Z(e.URL,!0),e.attributes)for(i in e.attributes)o.setAttribute(i,e.attributes[i]);else o.target="_blank";Ce.appendChild(o),a.className+=" pnlm-pointer",n.className+=" pnlm-pointer",o.appendChild(a)}else e.sceneId&&(a.onclick=a.ontouchend=function(){return a.clicked||(a.clicked=!0,Y(e.sceneId,e.targetPitch,e.targetYaw,e.targetHfov)),!1},a.className+=" pnlm-pointer",n.className+=" pnlm-pointer"),Ce.appendChild(a);e.createTooltipFunc?e.createTooltipFunc(a,e.createTooltipArgs):(e.text||e.video||e.image)&&(a.classList.add("pnlm-tooltip"),a.appendChild(n),n.style.width=n.scrollWidth-20+"px",n.style.marginLeft=-(n.scrollWidth-a.offsetWidth)/2+"px",n.style.marginTop=-n.scrollHeight-12+"px"),e.clickHandlerFunc&&(a.addEventListener("click",(function(t){e.clickHandlerFunc(t,e.clickHandlerArgs)}),"false"),a.className+=" pnlm-pointer",n.className+=" pnlm-pointer"),e.div=a}function k(e){var t=Math.sin(e.pitch*Math.PI/180),a=Math.cos(e.pitch*Math.PI/180),o=Math.sin(V.pitch*Math.PI/180),n=Math.cos(V.pitch*Math.PI/180),i=Math.cos((-e.yaw+V.yaw)*Math.PI/180),r=t*o+a*i*n;if(90>=e.yaw&&-90<e.yaw&&0>=r||(90<e.yaw||-90>=e.yaw)&&0>=r)e.div.style.visibility="hidden";else{var s=Math.sin((-e.yaw+V.yaw)*Math.PI/180),l=Math.tan(V.hfov*Math.PI/360);e.div.style.visibility="visible";var h=(c=K.getCanvas()).clientWidth,c=c.clientHeight;t=[-h/l*s*a/r/2,-h/l*(t*n-a*i*o)/r/2],a=Math.sin(V.roll*Math.PI/180),o=Math.cos(V.roll*Math.PI/180);(t=[t[0]*o-t[1]*a,t[0]*a+t[1]*o])[0]+=(h-e.div.offsetWidth)/2,t[1]+=(c-e.div.offsetHeight)/2,h="translate("+t[0]+"px, "+t[1]+"px) translateZ(9999px) rotate("+V.roll+"deg)",e.scale&&(h+=" scale("+ae/V.hfov/r+")"),e.div.style.webkitTransform=h,e.div.style.MozTransform=h,e.div.style.transform=h}}function N(e){V={};var t,a,o="haov vaov vOffset northOffset horizonPitch horizonRoll".split(" ");for(t in Me=[],Te)Te.hasOwnProperty(t)&&(V[t]=Te[t]);for(t in n.default)if(n.default.hasOwnProperty(t))if("strings"==t)for(a in n.default.strings)n.default.strings.hasOwnProperty(a)&&(V.strings[a]=q(n.default.strings[a]));else V[t]=n.default[t],0<=o.indexOf(t)&&Me.push(t);if(null!==e&&""!==e&&n.scenes&&n.scenes[e]){var i=n.scenes[e];for(t in i)if(i.hasOwnProperty(t))if("strings"==t)for(a in i.strings)i.strings.hasOwnProperty(a)&&(V.strings[a]=q(i.strings[a]));else V[t]=i[t],0<=o.indexOf(t)&&Me.push(t);V.scene=e}for(t in n)if(n.hasOwnProperty(t))if("strings"==t)for(a in n.strings)n.strings.hasOwnProperty(a)&&(V.strings[a]=q(n.strings[a]));else V[t]=n[t],0<=o.indexOf(t)&&Me.push(t)}function O(e){if((e=e||!1)&&"preview"in V){var o=V.preview;V.basePath&&!r(o)&&(o=V.basePath+o),(J=t.createElement("div")).className="pnlm-preview-img",J.style.backgroundImage="url('"+Z(o).replace(/"/g,"%22").replace(/'/g,"%27")+"')",Ce.appendChild(J)}o=V.title;var n=V.author;for(var s in e&&("previewTitle"in V&&(V.title=V.previewTitle),"previewAuthor"in V&&(V.author=V.previewAuthor)),V.hasOwnProperty("title")||(Se.title.innerHTML=""),V.hasOwnProperty("author")||(Se.author.innerHTML=""),V.hasOwnProperty("title")||V.hasOwnProperty("author")||(Se.container.style.display="none"),ke.load.innerHTML="<p>"+V.strings.loadButtonLabel+"</p>",Se.load.boxp.innerHTML=V.strings.loadingLabel,V)if(V.hasOwnProperty(s))switch(s){case"title":Se.title.innerHTML=q(V[s]),Se.container.style.display="inline";break;case"author":var l=q(V[s]);V.authorURL&&((l=t.createElement("a")).href=Z(V.authorURL,!0),l.target="_blank",l.innerHTML=q(V[s]),l=l.outerHTML),Se.author.innerHTML=V.strings.bylineLabel.replace("%s",l),Se.container.style.display="inline";break;case"fallback":(l=t.createElement("a")).href=Z(V[s],!0),l.target="_blank",l.textContent="Click here to view this panorama in an alternative viewer.";var h=t.createElement("p");h.textContent="Your browser does not support WebGL.",h.appendChild(t.createElement("br")),h.appendChild(l),Se.errorMsg.innerHTML="",Se.errorMsg.appendChild(h);break;case"hfov":z(Number(V[s]));break;case"autoLoad":!0===V[s]&&K===a&&(Se.load.box.style.display="inline",ke.load.style.display="none",i());break;case"showZoomCtrl":ke.zoom.style.display=V[s]&&0!=V.showControls?"block":"none";break;case"showFullscreenCtrl":ke.fullscreen.style.display=V[s]&&0!=V.showControls&&("fullscreen"in t||"mozFullScreen"in t||"webkitIsFullScreen"in t||"msFullscreenElement"in t)?"block":"none";break;case"hotSpotDebug":De.style.display=V[s]?"block":"none";break;case"showControls":V[s]||(ke.orientation.style.display="none",ke.zoom.style.display="none",ke.fullscreen.style.display="none");break;case"orientationOnByDefault":V[s]&&W()}e&&(o?V.title=o:delete V.title,n?V.author=n:delete V.author)}function U(){if(Q&&!pe)if(fe)t.exitFullscreen?t.exitFullscreen():t.mozCancelFullScreen?t.mozCancelFullScreen():t.webkitCancelFullScreen?t.webkitCancelFullScreen():t.msExitFullscreen&&t.msExitFullscreen();else try{o.requestFullscreen?o.requestFullscreen():o.mozRequestFullScreen?o.mozRequestFullScreen():o.msRequestFullscreen?o.msRequestFullscreen():o.webkitRequestFullScreen()}catch(e){}}function F(e){t.fullscreenElement||t.fullscreen||t.mozFullScreen||t.webkitIsFullScreen||t.msFullscreenElement?(ke.fullscreen.classList.add("pnlm-fullscreen-toggle-button-active"),fe=!0):(ke.fullscreen.classList.remove("pnlm-fullscreen-toggle-button-active"),fe=!1),"resize"!==e&&j("fullscreenchange",fe),K.resize(),z(V.hfov),L()}function B(e){var t=V.minHfov;if("multires"==V.type&&K&&!V.multiResMinHfov&&(t=Math.min(t,K.getCanvas().width/(V.multiRes.cubeResolution/90*.9))),t>V.maxHfov)return console.log("HFOV bounds do not make sense (minHfov > maxHfov)."),V.hfov;var a=V.hfov;a=e<t?t:e>V.maxHfov?V.maxHfov:e;return V.avoidShowingBackground&&K&&(e=K.getCanvas(),a=Math.min(a,360*Math.atan(Math.tan((V.maxPitch-V.minPitch)/360*Math.PI)/e.height*e.width)/Math.PI)),a}function z(e){V.hfov=B(e),j("zoomchange",V.hfov)}function H(){xe={},be=V.autoRotate?V.autoRotate:be,V.autoRotate=!1}function G(){pe&&(Se.load.box.style.display="none",Se.errorMsg.style.display="none",pe=!1,Ce.style.display="block",j("errorcleared")),Q=!1,ke.load.style.display="none",Se.load.box.style.display="inline",i()}function Y(e,t,o,i,r){var s,l;if(Q||(r=!0),Q=!1,xe={},V.sceneFadeDuration&&!r&&(s=K.render(V.pitch*Math.PI/180,V.yaw*Math.PI/180,V.hfov*Math.PI/180,{returnImage:!0}))!==a)return(r=new Image).className="pnlm-fade-img",r.style.transition="opacity "+V.sceneFadeDuration/1e3+"s",r.style.width="100%",r.style.height="100%",r.onload=function(){Y(e,t,o,i,!0)},r.src=s,Ce.appendChild(r),void(K.fadeImg=r);r="same"===t?V.pitch:t,s="same"===o?V.yaw:"sameAzimuth"===o?V.yaw+(V.northOffset||0)-(n.scenes[e].northOffset||0):o,l="same"===i?V.hfov:i,function(){var e=V.hotSpots;if(Re=!1,delete V.hotSpots,e)for(var t=0;t<e.length;t++){var a=e[t].div;if(a){for(;a.parentNode&&a.parentNode!=Ce;)a=a.parentNode;Ce.removeChild(a)}delete e[t].div}}(),N(e),ve.yaw=ve.pitch=ve.hfov=0,O(),r!==a&&(V.pitch=r),s!==a&&(V.yaw=s),l!==a&&(V.hfov=l),j("scenechange",e),G()}function X(){e.removeEventListener("deviceorientation",A),ke.orientation.classList.remove("pnlm-orientation-button-active"),we=!1}function W(){"function"==typeof DeviceMotionEvent.requestPermission?DeviceOrientationEvent.requestPermission().then((function(t){"granted"==t&&(we=1,e.addEventListener("deviceorientation",A),ke.orientation.classList.add("pnlm-orientation-button-active"))})):(we=1,e.addEventListener("deviceorientation",A),ke.orientation.classList.add("pnlm-orientation-button-active"))}function q(e){return n.escapeHTML?String(e).split(/&/g).join("&amp;").split('"').join("&quot;").split("'").join("&#39;").split("<").join("&lt;").split(">").join("&gt;").split("/").join("&#x2f;").split("\n").join("<br>"):String(e).split("\n").join("<br>")}function Z(e,t){try{var a=decodeURIComponent(function(e){return e.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,(function(e,t){return"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""}))}(e)).replace(/[^\w:]/g,"").toLowerCase()}catch(e){return"about:blank"}return 0===a.indexOf("javascript:")||0===a.indexOf("vbscript:")?(console.log("Script URL removed."),"about:blank"):t&&0===a.indexOf("data:")?(console.log("Data URI removed from link."),"about:blank"):e}function j(e){if(e in Ee)for(var t=Ee[e].length;0<t;t--)Ee[e][Ee[e].length-t].apply(null,[].slice.call(arguments,1))}var V,K,J,Q,$,ee,te,ae,oe,ne=this,ie=!1,re=Date.now(),se=0,le=0,he=-1,ce=0,ue=0,de=Array(10),fe=!1,pe=!1,me=!1,ve={yaw:0,pitch:0,hfov:0},ge=!1,we=!1,ye=0,be=0,xe={},Ee={},Me=[],Pe=!1,Re=!1,_e=!1,Te={hfov:100,minHfov:50,multiResMinHfov:!1,maxHfov:120,pitch:0,minPitch:a,maxPitch:a,yaw:0,minYaw:-180,maxYaw:180,roll:0,haov:360,vaov:180,vOffset:0,autoRotate:!1,autoRotateInactivityDelay:-1,autoRotateStopDelay:a,type:"equirectangular",northOffset:0,showFullscreenCtrl:!0,dynamic:!1,dynamicUpdate:!1,doubleClickZoom:!0,keyboardZoom:!0,mouseZoom:!0,showZoomCtrl:!0,autoLoad:!1,showControls:!0,orientationOnByDefault:!1,hotSpotDebug:!1,backgroundColor:[0,0,0],avoidShowingBackground:!1,animationTimingFunction:function(e){return.5>e?2*e*e:(4-2*e)*e-1},draggable:!0,disableKeyboardCtrl:!1,crossOrigin:"anonymous",touchPanSpeedCoeffFactor:1,capturedKeyNumbers:[16,17,27,37,38,39,40,61,65,68,83,87,107,109,173,187,189],friction:.15,strings:{loadButtonLabel:"Click to<br>Load<br>Panorama",loadingLabel:"Loading...",bylineLabel:"by %s",noPanoramaError:"No panorama image was specified.",fileAccessError:"The file %s could not be accessed.",malformedURLError:"There is something wrong with the panorama URL.",iOS8WebGLError:"Due to iOS 8's broken WebGL implementation, only progressive encoded JPEGs work for your device (this panorama uses standard encoding).",genericWebGLError:"Your browser does not have the necessary WebGL support to display this panorama.",textureSizeError:"This panorama is too big for your device! It's %spx wide, but your device only supports images up to %spx wide. Try another device. (If you're the author, try scaling down the image.)",unknownError:"Unknown error. Check developer console."}};(o="string"==typeof o?t.getElementById(o):o).classList.add("pnlm-container"),o.tabIndex=0;var Le=t.createElement("div");Le.className="pnlm-ui",o.appendChild(Le);var Ce=t.createElement("div");Ce.className="pnlm-render-container",o.appendChild(Ce);var Ie=t.createElement("div");Ie.className="pnlm-dragfix",Le.appendChild(Ie);var Ae=t.createElement("span");Ae.className="pnlm-about-msg",Ae.innerHTML='<a href="https://pannellum.org/" target="_blank">Pannellum</a> 2.5.6',Le.appendChild(Ae),Ie.addEventListener("contextmenu",(function e(t){var a=h(t);Ae.style.left=a.x+"px",Ae.style.top=a.y+"px",clearTimeout(e.t1),clearTimeout(e.t2),Ae.style.display="block",Ae.style.opacity=1,e.t1=setTimeout((function(){Ae.style.opacity=0}),2e3),e.t2=setTimeout((function(){Ae.style.display="none"}),2500),t.preventDefault()}));var Se={},De=t.createElement("div");De.className="pnlm-sprite pnlm-hot-spot-debug-indicator",Le.appendChild(De),Se.container=t.createElement("div"),Se.container.className="pnlm-panorama-info",Se.title=t.createElement("div"),Se.title.className="pnlm-title-box",Se.container.appendChild(Se.title),Se.author=t.createElement("div"),Se.author.className="pnlm-author-box",Se.container.appendChild(Se.author),Le.appendChild(Se.container),Se.load={},Se.load.box=t.createElement("div"),Se.load.box.className="pnlm-load-box",Se.load.boxp=t.createElement("p"),Se.load.box.appendChild(Se.load.boxp),Se.load.lbox=t.createElement("div"),Se.load.lbox.className="pnlm-lbox",Se.load.lbox.innerHTML='<div class="pnlm-loading"></div>',Se.load.box.appendChild(Se.load.lbox),Se.load.lbar=t.createElement("div"),Se.load.lbar.className="pnlm-lbar",Se.load.lbarFill=t.createElement("div"),Se.load.lbarFill.className="pnlm-lbar-fill",Se.load.lbar.appendChild(Se.load.lbarFill),Se.load.box.appendChild(Se.load.lbar),Se.load.msg=t.createElement("p"),Se.load.msg.className="pnlm-lmsg",Se.load.box.appendChild(Se.load.msg),Le.appendChild(Se.load.box),Se.errorMsg=t.createElement("div"),Se.errorMsg.className="pnlm-error-msg pnlm-info-box",Le.appendChild(Se.errorMsg);var ke={};ke.container=t.createElement("div"),ke.container.className="pnlm-controls-container",Le.appendChild(ke.container),ke.load=t.createElement("div"),ke.load.className="pnlm-load-button",ke.load.addEventListener("click",(function(){O(),G()})),Le.appendChild(ke.load),ke.zoom=t.createElement("div"),ke.zoom.className="pnlm-zoom-controls pnlm-controls",ke.zoomIn=t.createElement("div"),ke.zoomIn.className="pnlm-zoom-in pnlm-sprite pnlm-control",ke.zoomIn.addEventListener("click",(function(){Q&&(z(V.hfov-5),L())})),ke.zoom.appendChild(ke.zoomIn),ke.zoomOut=t.createElement("div"),ke.zoomOut.className="pnlm-zoom-out pnlm-sprite pnlm-control",ke.zoomOut.addEventListener("click",(function(){Q&&(z(V.hfov+5),L())})),ke.zoom.appendChild(ke.zoomOut),ke.container.appendChild(ke.zoom),ke.fullscreen=t.createElement("div"),ke.fullscreen.addEventListener("click",U),ke.fullscreen.className="pnlm-fullscreen-toggle-button pnlm-sprite pnlm-fullscreen-toggle-button-inactive pnlm-controls pnlm-control",(t.fullscreenEnabled||t.mozFullScreenEnabled||t.webkitFullscreenEnabled||t.msFullscreenEnabled)&&ke.container.appendChild(ke.fullscreen),ke.orientation=t.createElement("div"),ke.orientation.addEventListener("click",(function(e){we?X():W()})),ke.orientation.addEventListener("mousedown",(function(e){e.stopPropagation()})),ke.orientation.addEventListener("touchstart",(function(e){e.stopPropagation()})),ke.orientation.addEventListener("pointerdown",(function(e){e.stopPropagation()})),ke.orientation.className="pnlm-orientation-button pnlm-orientation-button-inactive pnlm-sprite pnlm-controls pnlm-control";var Ne=!1;e.DeviceOrientationEvent&&"https:"==location.protocol&&0<=navigator.userAgent.toLowerCase().indexOf("mobi")&&(ke.container.appendChild(ke.orientation),Ne=!0);var Oe=t.createElement("div");Oe.className="pnlm-compass pnlm-controls pnlm-control",Le.appendChild(Oe),n.firstScene?N(n.firstScene):n.default&&n.default.firstScene?N(n.default.firstScene):N(null),O(!0);var Ue=[],Fe=[];I.prototype.multiply=function(e){return new I(this.w*e.w-this.x*e.x-this.y*e.y-this.z*e.z,this.x*e.w+this.w*e.x+this.y*e.z-this.z*e.y,this.y*e.w+this.w*e.y+this.z*e.x-this.x*e.z,this.z*e.w+this.w*e.z+this.x*e.y-this.y*e.x)},I.prototype.toEulerAngles=function(){return[Math.atan2(2*(this.w*this.x+this.y*this.z),1-2*(this.x*this.x+this.y*this.y)),Math.asin(2*(this.w*this.y-this.z*this.x)),Math.atan2(2*(this.w*this.z+this.x*this.y),1-2*(this.y*this.y+this.z*this.z))]},this.isLoaded=function(){return Boolean(Q)},this.getPitch=function(){return V.pitch},this.setPitch=function(e,t,o,n){return re=Date.now(),1e-6>=Math.abs(e-V.pitch)?("function"==typeof o&&o(n),this):((t=t==a?1e3:Number(t))?(xe.pitch={startTime:Date.now(),startPosition:V.pitch,endPosition:e,duration:t},"function"==typeof o&&setTimeout((function(){o(n)}),t)):V.pitch=e,L(),this)},this.getPitchBounds=function(){return[V.minPitch,V.maxPitch]},this.setPitchBounds=function(e){return V.minPitch=Math.max(-90,Math.min(e[0],90)),V.maxPitch=Math.max(-90,Math.min(e[1],90)),this},this.getYaw=function(){return(V.yaw+540)%360-180},this.setYaw=function(e,t,o,n){return re=Date.now(),1e-6>=Math.abs(e-V.yaw)?("function"==typeof o&&o(n),this):(e=(e+180)%360-180,(t=t==a?1e3:Number(t))?(180<V.yaw-e?e+=360:180<e-V.yaw&&(e-=360),xe.yaw={startTime:Date.now(),startPosition:V.yaw,endPosition:e,duration:t},"function"==typeof o&&setTimeout((function(){o(n)}),t)):V.yaw=e,L(),this)},this.getYawBounds=function(){return[V.minYaw,V.maxYaw]},this.setYawBounds=function(e){return V.minYaw=Math.max(-360,Math.min(e[0],360)),V.maxYaw=Math.max(-360,Math.min(e[1],360)),this},this.getHfov=function(){return V.hfov},this.setHfov=function(e,t,o,n){return re=Date.now(),1e-6>=Math.abs(e-V.hfov)?("function"==typeof o&&o(n),this):((t=t==a?1e3:Number(t))?(xe.hfov={startTime:Date.now(),startPosition:V.hfov,endPosition:B(e),duration:t},"function"==typeof o&&setTimeout((function(){o(n)}),t)):z(e),L(),this)},this.getHfovBounds=function(){return[V.minHfov,V.maxHfov]},this.setHfovBounds=function(e){return V.minHfov=Math.max(0,e[0]),V.maxHfov=Math.max(0,e[1]),this},this.lookAt=function(e,t,o,n,i,r){return n=n==a?1e3:Number(n),e!==a&&1e-6<Math.abs(e-V.pitch)&&(this.setPitch(e,n,i,r),i=a),t!==a&&1e-6<Math.abs(t-V.yaw)&&(this.setYaw(t,n,i,r),i=a),o!==a&&1e-6<Math.abs(o-V.hfov)&&(this.setHfov(o,n,i,r),i=a),"function"==typeof i&&i(r),this},this.getNorthOffset=function(){return V.northOffset},this.setNorthOffset=function(e){return V.northOffset=Math.min(360,Math.max(0,e)),L(),this},this.getHorizonRoll=function(){return V.horizonRoll},this.setHorizonRoll=function(e){return V.horizonRoll=Math.min(90,Math.max(-90,e)),K.setPose(V.horizonPitch*Math.PI/180,V.horizonRoll*Math.PI/180),L(),this},this.getHorizonPitch=function(){return V.horizonPitch},this.setHorizonPitch=function(e){return V.horizonPitch=Math.min(90,Math.max(-90,e)),K.setPose(V.horizonPitch*Math.PI/180,V.horizonRoll*Math.PI/180),L(),this},this.startAutoRotate=function(e,t){return e=e||be||1,t=t===a?oe:t,V.autoRotate=e,ne.lookAt(t,a,ae,3e3),L(),this},this.stopAutoRotate=function(){return be=V.autoRotate?V.autoRotate:be,V.autoRotate=!1,V.autoRotateInactivityDelay=-1,this},this.stopMovement=function(){H(),ve={yaw:0,pitch:0,hfov:0}},this.getRenderer=function(){return K},this.setUpdate=function(e){return Pe=!0===e,K===a?s():L(),this},this.mouseEventToCoords=function(e){return d(e)},this.loadScene=function(e,t,a,o){return!1!==Q&&Y(e,t,a,o),this},this.getScene=function(){return V.scene},this.addScene=function(e,t){return n.scenes[e]=t,this},this.removeScene=function(e){return!(V.scene===e||!n.scenes.hasOwnProperty(e))&&(delete n.scenes[e],!0)},this.toggleFullscreen=function(){return U(),this},this.getConfig=function(){return V},this.getContainer=function(){return o},this.addHotSpot=function(e,t){if(t===a&&V.scene===a)V.hotSpots.push(e);else{var o=t!==a?t:V.scene;if(!n.scenes.hasOwnProperty(o))throw"Invalid scene ID!";n.scenes[o].hasOwnProperty("hotSpots")||(n.scenes[o].hotSpots=[],o==V.scene&&(V.hotSpots=n.scenes[o].hotSpots)),n.scenes[o].hotSpots.push(e)}return t!==a&&V.scene!=t||(D(e),Q&&k(e)),this},this.removeHotSpot=function(e,t){if(t===a||V.scene==t){if(!V.hotSpots)return!1;for(var o=0;o<V.hotSpots.length;o++)if(V.hotSpots[o].hasOwnProperty("id")&&V.hotSpots[o].id===e){for(var i=V.hotSpots[o].div;i.parentNode!=Ce;)i=i.parentNode;return Ce.removeChild(i),delete V.hotSpots[o].div,V.hotSpots.splice(o,1),!0}}else{if(!n.scenes.hasOwnProperty(t))return!1;if(!n.scenes[t].hasOwnProperty("hotSpots"))return!1;for(o=0;o<n.scenes[t].hotSpots.length;o++)if(n.scenes[t].hotSpots[o].hasOwnProperty("id")&&n.scenes[t].hotSpots[o].id===e)return n.scenes[t].hotSpots.splice(o,1),!0}},this.resize=function(){K&&T()},this.isLoaded=function(){return Q},this.isOrientationSupported=function(){return Ne||!1},this.stopOrientation=function(){X()},this.startOrientation=function(){Ne&&W()},this.isOrientationActive=function(){return Boolean(we)},this.on=function(e,t){return Ee[e]=Ee[e]||[],Ee[e].push(t),this},this.off=function(e,t){if(!e)return Ee={},this;if(t){var a=Ee[e].indexOf(t);0<=a&&Ee[e].splice(a,1),0==Ee[e].length&&delete Ee[e]}else delete Ee[e];return this},this.destroy=function(){_e=!0,clearTimeout(te),K&&K.destroy(),me&&(t.removeEventListener("mousemove",f,!1),t.removeEventListener("mouseup",p,!1),o.removeEventListener("mozfullscreenchange",F,!1),o.removeEventListener("webkitfullscreenchange",F,!1),o.removeEventListener("msfullscreenchange",F,!1),o.removeEventListener("fullscreenchange",F,!1),e.removeEventListener("resize",T,!1),e.removeEventListener("orientationchange",T,!1),o.removeEventListener("keydown",E,!1),o.removeEventListener("keyup",P,!1),o.removeEventListener("blur",M,!1),t.removeEventListener("mouseleave",p,!1)),o.innerHTML="",o.classList.remove("pnlm-container")}}return{viewer:function(e,t){return new o(e,t)}}}(window,document);