"),o=t.substring(i,s);return-1!==i&&-1!==s&&o.includes("GPano:")?{isEquirectangular:!0,fullWidth:pe(o,"FullPanoWidthPixels"),fullHeight:pe(o,"FullPanoHeightPixels"),croppedWidth:pe(o,"CroppedAreaImageWidthPixels"),croppedHeight:pe(o,"CroppedAreaImageHeightPixels"),croppedX:pe(o,"CroppedAreaLeftPixels"),croppedY:pe(o,"CroppedAreaTopPixels"),poseHeading:pe(o,"PoseHeadingDegrees"),posePitch:pe(o,"PosePitchDegrees"),poseRoll:pe(o,"PoseRollDegrees")}:null}loadBlobAsString(e){return new Promise(((t,i)=>{const s=new FileReader;s.onload=()=>t(s.result),s.onerror=i,s.readAsText(e)}))}createEquirectangularTexture(e,t){if(this.config.blur||t.fullWidth>Qt.maxTextureWidth||t.croppedWidth!==t.fullWidth||t.croppedHeight!==t.fullHeight){const i=Math.min(1,Qt.maxCanvasWidth/t.fullWidth),s={fullWidth:t.fullWidth*i,fullHeight:t.fullHeight*i,croppedWidth:t.croppedWidth*i,croppedHeight:t.croppedHeight*i,croppedX:t.croppedX*i,croppedY:t.croppedY*i},o=document.createElement("canvas");o.width=s.fullWidth,o.height=s.fullHeight;const n=o.getContext("2d");this.config.backgroundColor&&(n.fillStyle=this.config.backgroundColor,n.fillRect(0,0,o.width,o.height)),this.config.blur&&(n.filter=`blur(${o.width/2048}px)`),n.drawImage(e,s.croppedX,s.croppedY,s.croppedWidth,s.croppedHeight);const r=Me(o);return!this.config.interpolateBackground||t.croppedWidth===t.fullWidth&&t.croppedHeight===t.fullHeight||(this.interpolationWorker.postMessage({image:n.getImageData(s.croppedX,s.croppedY,s.croppedWidth,s.croppedHeight),panoData:s}),this.interpolationWorker.onmessage=e=>{n.putImageData(e.data,0,0),r.needsUpdate=!0,this.viewer.needsUpdate()}),r}return Me(e)}createMesh(e=1){const t=new qt.SphereGeometry(y*e,this.SPHERE_SEGMENTS,this.SPHERE_HORIZONTAL_SEGMENTS,-Math.PI/2).scale(-1,1,1),i=Bt.createOverlayMaterial();return new qt.Mesh(t,i)}setTexture(e,t){this.__setUniform(e,Bt.OVERLAY_UNIFORMS.panorama,t.texture)}setOverlay(e,t,i){this.__setUniform(e,Bt.OVERLAY_UNIFORMS.overlayOpacity,i),t?this.__setUniform(e,Bt.OVERLAY_UNIFORMS.overlay,t.texture):this.__setUniform(e,Bt.OVERLAY_UNIFORMS.overlay,null)}setTextureOpacity(e,t){this.__setUniform(e,Bt.OVERLAY_UNIFORMS.globalOpacity,t),e.material.transparent=t<1}disposeTexture(e){e.texture?.dispose()}__setUniform(e,t,i){e.material.uniforms[t].value=i}__defaultPanoData(e){const t=Math.max(e.width,2*e.height),i=Math.round(t/2),s=Math.round((t-e.width)/2),o=Math.round((i-e.height)/2);return{isEquirectangular:!0,fullWidth:t,fullHeight:i,croppedWidth:e.width,croppedHeight:e.height,croppedX:s,croppedY:o}}};ti.id="equirectangular",ti.VERSION="5.5.0",ti.supportsDownload=!0,ti.supportsOverlay=!0;var ii=class e{constructor(t,i){this.parent=t,this.children=[],this.container=document.createElement("div"),this.state={visible:!0},this.viewer=t instanceof e?t.viewer:t,this.container.className=i.className||"",this.parent.children.push(this),this.parent.container.appendChild(this.container)}destroy(){this.parent.container.removeChild(this.container);const e=this.parent.children.indexOf(this);-1!==e&&this.parent.children.splice(e,1),this.children.slice().forEach((e=>e.destroy())),this.children.length=0}toggle(e=!this.isVisible()){e?this.show():this.hide()}hide(e){this.container.style.display="none",this.state.visible=!1}show(e){this.container.style.display="",this.state.visible=!0}isVisible(){return this.state.visible}},si=Ce({id:null,className:null,title:null,hoverScale:!1,collapsable:!1,tabbable:!0,icon:null,iconActive:null}),oi=class extends ii{constructor(e,t){super(e,{className:`psv-button ${t.hoverScale?"psv-button--hover-scale":""} ${t.className||""}`}),this.state={visible:!0,enabled:!0,supported:!0,collapsed:!1,active:!1,width:0},this.config=si(t),this.config.id=this.constructor.id,t.icon&&this.__setIcon(t.icon),this.state.width=this.container.offsetWidth,this.config.title?this.container.title=this.config.title:this.id&&this.id in this.viewer.config.lang&&(this.container.title=this.viewer.config.lang[this.id]),t.tabbable&&(this.container.tabIndex=0),this.container.addEventListener("click",(e=>{this.state.enabled&&this.onClick(),e.stopPropagation()})),this.container.addEventListener("keydown",(e=>{e.key===M.Enter&&this.state.enabled&&(this.onClick(),e.stopPropagation())}))}get id(){return this.config.id}get title(){return this.container.title}get content(){return this.container.innerHTML}get width(){return this.state.width}get collapsable(){return this.config.collapsable}show(e=!0){this.isVisible()||(this.state.visible=!0,this.state.collapsed||(this.container.style.display=""),e&&this.viewer.navbar.autoSize())}hide(e=!0){this.isVisible()&&(this.state.visible=!1,this.container.style.display="none",e&&this.viewer.navbar.autoSize())}checkSupported(){re(this.isSupported(),((e,t)=>{this.state&&(this.state.supported=e,t?e||this.hide():this.toggle(e))}))}autoSize(){}isSupported(){return!0}toggleActive(e=!this.state.active){e!==this.state.active&&(this.state.active=e,A(this.container,"psv-button--active",this.state.active),this.config.iconActive&&this.__setIcon(this.state.active?this.config.iconActive:this.config.icon))}disable(){this.container.classList.add("psv-button--disabled"),this.state.enabled=!1}enable(){this.container.classList.remove("psv-button--disabled"),this.state.enabled=!0}collapse(){this.state.collapsed=!0,this.container.style.display="none"}uncollapse(){this.state.collapsed=!1,this.state.visible&&(this.container.style.display="")}__setIcon(e){this.container.innerHTML=e,D(this.container.querySelector("svg"),"psv-button-svg")}},ni=class extends oi{constructor(e,t){super(e,{className:`psv-custom-button ${t.className||""}`,hoverScale:!1,collapsable:!1!==t.collapsable,tabbable:!1!==t.tabbable,title:t.title}),this.customOnClick=t.onClick,t.id?this.config.id=t.id:this.config.id="psvButton-"+Math.random().toString(36).substring(2),t.content&&(this.container.innerHTML=t.content),this.state.width=this.container.offsetWidth,t.disabled&&this.disable(),!1===t.visible&&this.hide()}onClick(){this.customOnClick?.(this.viewer)}},ri=class extends oi{constructor(e){super(e,{className:"psv-description-button",hoverScale:!0,collapsable:!1,tabbable:!0,icon:T.info}),this.mode=0,this.viewer.addEventListener(it.type,this),this.viewer.addEventListener(Ot.type,this),this.viewer.addEventListener(rt.type,this),this.viewer.addEventListener(kt.type,this),this.viewer.addEventListener(qe.type,this)}destroy(){this.viewer.removeEventListener(it.type,this),this.viewer.removeEventListener(Ot.type,this),this.viewer.removeEventListener(rt.type,this),this.viewer.removeEventListener(kt.type,this),this.viewer.removeEventListener(qe.type,this),super.destroy()}handleEvent(e){if(e instanceof qe)return void(e.containsOptions("description")&&this.autoSize(!0));if(!this.mode)return;let t=!1;e instanceof it?t=1===this.mode:e instanceof Ot?t=1===this.mode&&e.notificationId!==x.DESCRIPTION:e instanceof rt?t=2===this.mode:e instanceof kt&&(t=2===this.mode&&e.panelId!==x.DESCRIPTION),t&&(this.toggleActive(!1),this.mode=0)}onClick(){this.mode?this.__close():this.__open()}hide(e){super.hide(e),this.mode&&this.__close()}autoSize(e=!1){if(e){const e=this.viewer.navbar.getButton("caption",!1),t=e&&!e.isVisible(),i=!!this.viewer.config.description;t||i?this.show(!1):this.hide(!1)}}__close(){switch(this.mode){case 1:this.viewer.notification.hide(x.DESCRIPTION);break;case 2:this.viewer.panel.hide(x.DESCRIPTION)}}__open(){this.toggleActive(!0),this.viewer.config.description?(this.mode=2,this.viewer.panel.show({id:x.DESCRIPTION,content:(this.viewer.config.caption?`${this.viewer.config.caption}
`:"")+this.viewer.config.description})):(this.mode=1,this.viewer.notification.show({id:x.DESCRIPTION,content:this.viewer.config.caption}))}};ri.id="description";var ai=class extends oi{constructor(e){super(e,{className:"psv-download-button",hoverScale:!0,collapsable:!0,tabbable:!0,icon:T.download}),this.viewer.addEventListener(qe.type,this)}destroy(){this.viewer.removeEventListener(qe.type,this),super.destroy()}handleEvent(e){e instanceof qe&&e.containsOptions("downloadUrl")&&this.checkSupported()}onClick(){const e=document.createElement("a");e.href=this.viewer.config.downloadUrl||this.viewer.config.panorama,e.href.startsWith("data:")&&!this.viewer.config.downloadName?e.download="panorama."+e.href.substring(0,e.href.indexOf(";")).split("/").pop():e.download=this.viewer.config.downloadName||e.href.split("/").pop(),e.target="_blank",this.viewer.container.appendChild(e),e.click(),setTimeout((()=>{this.viewer.container.removeChild(e)}),100)}checkSupported(){this.viewer.adapter.constructor.supportsDownload||this.viewer.config.downloadUrl?this.show():this.hide()}};ai.id="download";var hi=class extends oi{constructor(e){super(e,{className:"psv-fullscreen-button",hoverScale:!0,collapsable:!1,tabbable:!0,icon:T.fullscreenIn,iconActive:T.fullscreenOut}),this.viewer.addEventListener(et.type,this)}destroy(){this.viewer.removeEventListener(et.type,this),super.destroy()}handleEvent(e){e instanceof et&&this.toggleActive(e.fullscreenEnabled)}onClick(){this.viewer.toggleFullscreen()}};hi.id="fullscreen";var ci=class extends oi{constructor(e){super(e,{className:"psv-menu-button",hoverScale:!0,collapsable:!1,tabbable:!0,icon:T.menu}),this.viewer.addEventListener(kt.type,this),this.viewer.addEventListener(rt.type,this),super.hide()}destroy(){this.viewer.removeEventListener(kt.type,this),this.viewer.removeEventListener(rt.type,this),super.destroy()}handleEvent(e){e instanceof kt?this.toggleActive(e.panelId===x.MENU):e instanceof rt&&this.toggleActive(!1)}onClick(){this.state.active?this.__hideMenu():this.__showMenu()}hide(e){super.hide(e),this.__hideMenu()}show(e){super.show(e),this.state.active&&this.__showMenu()}__showMenu(){var e,t;this.viewer.panel.show({id:x.MENU,content:(e=this.viewer.navbar.collapsed,t=this.viewer.config.lang.menu,`\n\n`),noMargin:!0,clickHandler:e=>{const t=e?V(e,"li"):void 0,i=t?t.dataset.psvButton:void 0;i&&(this.viewer.navbar.getButton(i).onClick(),this.__hideMenu())}})}__hideMenu(){this.viewer.panel.hide(x.MENU)}};function li(e){let t=0;switch(e){case 0:t=90;break;case 1:t=-90;break;case 3:t=180;break;default:t=0}return T.arrow.replace("rotate(0",`rotate(${t}`)}ci.id="menu";var di=class extends oi{constructor(e,t){super(e,{className:"psv-move-button",hoverScale:!0,collapsable:!1,tabbable:!0,icon:li(t)}),this.direction=t,this.handler=new Re,this.container.addEventListener("mousedown",this),this.container.addEventListener("keydown",this),this.container.addEventListener("keyup",this),this.viewer.container.addEventListener("mouseup",this),this.viewer.container.addEventListener("touchend",this)}destroy(){this.__onMouseUp(),this.viewer.container.removeEventListener("mouseup",this),this.viewer.container.removeEventListener("touchend",this),super.destroy()}handleEvent(e){switch(e.type){case"mousedown":this.__onMouseDown();break;case"mouseup":case"touchend":this.__onMouseUp();break;case"keydown":e.key===M.Enter&&this.__onMouseDown();break;case"keyup":e.key===M.Enter&&this.__onMouseUp()}}onClick(){}isSupported(){return ae(Qt.isTouchEnabled)}__onMouseDown(){if(!this.state.enabled)return;const e={};switch(this.direction){case 0:e.pitch=!1;break;case 1:e.pitch=!0;break;case 3:e.yaw=!1;break;default:e.yaw=!0}this.viewer.stopAll(),this.viewer.dynamics.position.roll(e),this.handler.down()}__onMouseUp(){this.state.enabled&&this.handler.up((()=>{this.viewer.dynamics.position.stop(),this.viewer.resetIdleTimer()}))}};di.groupId="move";var pi=class extends di{constructor(e){super(e,1)}};pi.id="moveDown";var ui=class extends di{constructor(e){super(e,2)}};ui.id="moveLeft";var vi=class extends di{constructor(e){super(e,3)}};vi.id="moveRight";var mi=class extends di{constructor(e){super(e,0)}};mi.id="moveUp";var wi=class extends oi{constructor(e,t,i){super(e,{className:"psv-zoom-button",hoverScale:!0,collapsable:!1,tabbable:!0,icon:t}),this.direction=i,this.handler=new Re,this.container.addEventListener("mousedown",this),this.container.addEventListener("keydown",this),this.container.addEventListener("keyup",this),this.viewer.container.addEventListener("mouseup",this),this.viewer.container.addEventListener("touchend",this)}destroy(){this.__onMouseUp(),this.viewer.container.removeEventListener("mouseup",this),this.viewer.container.removeEventListener("touchend",this),super.destroy()}handleEvent(e){switch(e.type){case"mousedown":this.__onMouseDown();break;case"mouseup":case"touchend":this.__onMouseUp();break;case"keydown":e.key===M.Enter&&this.__onMouseDown();break;case"keyup":e.key===M.Enter&&this.__onMouseUp()}}onClick(){}isSupported(){return ae(Qt.isTouchEnabled)}__onMouseDown(){this.state.enabled&&(this.viewer.dynamics.zoom.roll(1===this.direction),this.handler.down())}__onMouseUp(){this.state.enabled&&this.handler.up((()=>this.viewer.dynamics.zoom.stop()))}};wi.groupId="zoom";var gi=class extends wi{constructor(e){super(e,T.zoomIn,0)}};gi.id="zoomIn";var fi=class extends wi{constructor(e){super(e,T.zoomOut,1)}};fi.id="zoomOut";var yi=class extends oi{constructor(e){super(e,{className:"psv-zoom-range",hoverScale:!1,collapsable:!1,tabbable:!1}),this.zoomRange=document.createElement("div"),this.zoomRange.className="psv-zoom-range-line",this.container.appendChild(this.zoomRange),this.zoomValue=document.createElement("div"),this.zoomValue.className="psv-zoom-range-handle",this.zoomRange.appendChild(this.zoomValue),this.slider=new Ae(this.container,"HORIZONTAL",(e=>this.__onSliderUpdate(e))),this.mediaMinWidth=parseInt(j(this.container,"max-width"),10),this.viewer.addEventListener(Ut.type,this),this.viewer.state.ready?this.__moveZoomValue(this.viewer.getZoomLevel()):this.viewer.addEventListener(_t.type,this)}destroy(){this.slider.destroy(),this.viewer.removeEventListener(Ut.type,this),this.viewer.removeEventListener(_t.type,this),super.destroy()}handleEvent(e){e instanceof Ut?this.__moveZoomValue(e.zoomLevel):e instanceof _t&&this.__moveZoomValue(this.viewer.getZoomLevel())}onClick(){}isSupported(){return ae(Qt.isTouchEnabled)}autoSize(){this.state.supported&&(this.viewer.state.size.width<=this.mediaMinWidth&&this.state.visible?this.hide(!1):this.viewer.state.size.width>this.mediaMinWidth&&!this.state.visible&&this.show(!1))}__moveZoomValue(e){this.zoomValue.style.left=e/100*this.zoomRange.offsetWidth-this.zoomValue.offsetWidth/2+"px"}__onSliderUpdate(e){e.mousedown&&this.viewer.zoom(100*e.value)}};yi.id="zoomRange",yi.groupId="zoom";var bi=a(),Ei=class extends Ne{constructor(e){super(),this.viewer=e}init(){}destroy(){}},_i=class extends Ei{constructor(e,t){super(e),this.config=this.constructor.configParser(t)}setOption(e,t){this.setOptions({[e]:t})}setOptions(e){const t={...this.config,...e},i=this.constructor,s=i.configParser,o=i.readonlyOptions,n=i.id;for(let[i,r]of Object.entries(e))i in s.defaults?o.includes(i)?le(`${n}: Option "${i}" cannot be updated`):(i in s.parsers&&(r=s.parsers[i](r,{rawConfig:t,defValue:s.defaults[i]})),this.config[i]=r):le(`${n}: Unknown option "${i}"`)}};function xi(e){if(e)for(const[,t]of[["_",e],...Object.entries(e)])if(t.prototype instanceof Ei)return Ie(t.id,t.VERSION,"5.5.0"),t;return null}_i.readonlyOptions=[];var Mi={panorama:null,overlay:null,overlayOpacity:1,container:null,adapter:[ti,null],plugins:[],caption:null,description:null,downloadUrl:null,downloadName:null,loadingImg:null,loadingTxt:"Loading...",size:null,fisheye:0,minFov:30,maxFov:90,defaultZoomLvl:50,defaultYaw:0,defaultPitch:0,sphereCorrection:null,moveSpeed:1,zoomSpeed:1,moveInertia:!0,mousewheel:!0,mousemove:!0,mousewheelCtrlKey:!1,touchmoveTwoFingers:!1,useXmpData:null,panoData:null,requestHeaders:null,canvasBackground:null,rendererParameters:{alpha:!0,antialias:!0},withCredentials:!1,navbar:["zoom","move","download","description","caption","fullscreen"],lang:{zoom:"Zoom",zoomOut:"Zoom out",zoomIn:"Zoom in",moveUp:"Move up",moveDown:"Move down",moveLeft:"Move left",moveRight:"Move right",download:"Download",fullscreen:"Fullscreen",menu:"Menu",close:"Close",twoFingers:"Use two fingers to navigate",ctrlZoom:"Use ctrl + scroll to zoom the image",loadError:"The panorama can't be loaded"},keyboard:"fullscreen",keyboardActions:{[M.ArrowUp]:"ROTATE_UP",[M.ArrowDown]:"ROTATE_DOWN",[M.ArrowRight]:"ROTATE_RIGHT",[M.ArrowLeft]:"ROTATE_LEFT",[M.PageUp]:"ZOOM_IN",[M.PageDown]:"ZOOM_OUT",[M.Plus]:"ZOOM_IN",[M.Minus]:"ZOOM_OUT"}},Ti={panorama:"Use setPanorama method to change the panorama",panoData:"Use setPanorama method to change the panorama",overlay:"Use setOverlay method to changer the overlay",overlayOpacity:"Use setOverlay method to changer the overlay",container:"Cannot change viewer container",adapter:"Cannot change adapter",plugins:"Cannot change plugins"},Oi={container:e=>{if(!e)throw new ne("No value given for container.");return e},adapter:(e,{defValue:t})=>{if(!(e=e?Array.isArray(e)?[Gt(e[0]),e[1]]:[Gt(e),null]:t)[0])throw new ne("An undefined value was given for adapter.");if(!e[0].id)throw new ne("Adapter has no id.");return e},overlayOpacity:e=>bi.MathUtils.clamp(e,0,1),defaultYaw:e=>xe(e),defaultPitch:e=>xe(e,!0),defaultZoomLvl:e=>bi.MathUtils.clamp(e,0,100),minFov:(e,{rawConfig:t})=>(t.maxFov(e(Array.isArray(e.twoFingers)&&(le("lang.twoFingers must not be an array"),e.twoFingers=e.twoFingers[0]),{...Mi.lang,...e}),keyboard:e=>!!e&&("object"==typeof e?(le("Use keyboardActions to configure the keyboard actions, keyboard option must be either true, false, 'fullscreen' or 'always'"),"fullscreen"):"always"===e?"always":"fullscreen"),keyboardActions:(e,{rawConfig:t})=>t.keyboard&&"object"==typeof t.keyboard?t.keyboard:e,fisheye:e=>!0===e?1:!1===e?0:e,requestHeaders:e=>e&&"object"==typeof e?()=>e:"function"==typeof e?e:null,rendererParameters:(e,{defValue:t})=>({...e,...t}),plugins:e=>e.map(((e,t)=>{if(!(e=Array.isArray(e)?[xi(e[0]),e[1]]:[xi(e),null])[0])throw new ne(`An undefined value was given for plugin ${t}.`);if(!e[0].id)throw new ne(`Plugin ${t} has no id.`);return e})),navbar:e=>!1===e?null:!0===e?Q(Mi.navbar):"string"==typeof e?e.split(/[ ,]/):e,useXmpData:e=>(null!==e&&le("Global useXmpData is deprecated, it is now configured on the adapter."),e),canvasBackground:e=>(null!==e&&le("Global canvasBackground is deprecated, it is now configured on the adapter."),e),overlay:e=>(null!==e&&le('"overlay" option is deprecated, use "@photo-sphere-viewer/overlay-plugin" instead.'),e)},Ci=Ce(Mi,Oi),Li=class extends oi{constructor(e){super(e,{className:"psv-caption",hoverScale:!1,collapsable:!1,tabbable:!0}),this.contentWidth=0,this.state.width=0,this.contentElt=document.createElement("div"),this.contentElt.className="psv-caption-content",this.container.appendChild(this.contentElt),this.setCaption(this.viewer.config.caption)}hide(){this.contentElt.style.display="none",this.state.visible=!1}show(){this.contentElt.style.display="",this.state.visible=!0}onClick(){}setCaption(e){this.show(),this.contentElt.innerHTML=e??"",this.contentElt.innerHTML?this.contentWidth=this.contentElt.offsetWidth:this.contentWidth=0,this.autoSize()}autoSize(){this.toggle(this.container.offsetWidth>=this.contentWidth),this.__refreshButton()}__refreshButton(){this.viewer.navbar.getButton(ri.id,!1)?.autoSize(!0)}};Li.id="caption";var Ii={},ki={};function Pi(e,t){if(!e.id)throw new ne("Button id is required");if(Ii[e.id]=e,e.groupId&&(ki[e.groupId]=ki[e.groupId]||[]).push(e),t){const i=Mi.navbar;switch(t){case"start":i.unshift(e.id);break;case"end":i.push(e.id);break;default:{const[s,o]=t.split(":"),n=i.indexOf(s);if(!s||!o||-1===n)throw new ne(`Invalid defaultPosition ${t}`);i.splice(n+("right"===o?1:0),0,e.id)}}}}[fi,yi,gi,ri,Li,ai,hi,ui,vi,mi,pi].forEach((e=>Pi(e)));var Si=class extends ii{constructor(e){super(e,{className:`psv-navbar ${E}`}),this.collapsed=[],this.state.visible=!1}show(){this.viewer.container.classList.add("psv--has-navbar"),this.container.classList.add("psv-navbar--open"),this.state.visible=!0}hide(){this.viewer.container.classList.remove("psv--has-navbar"),this.container.classList.remove("psv-navbar--open"),this.state.visible=!1}setButtons(e){this.children.slice().forEach((e=>e.destroy())),this.children.length=0,-1!==e.indexOf(Li.id)&&-1===e.indexOf(ri.id)&&e.splice(e.indexOf(Li.id),0,ri.id),e.forEach((e=>{"object"==typeof e?new ni(this,e):Ii[e]?new Ii[e](this):ki[e]?ki[e].forEach((e=>{new e(this)})):le(`Unknown button ${e}`)})),new ci(this),this.children.forEach((e=>{e instanceof oi&&e.checkSupported()})),this.autoSize()}setCaption(e){this.children.some((t=>t instanceof Li&&(t.setCaption(e),!0)))}getButton(e,t=!0){const i=this.children.find((t=>t instanceof oi&&t.id===e));return!i&&t&&le(`button "${e}" not found in the navbar`),i}autoSize(){this.children.forEach((e=>{e instanceof oi&&e.autoSize()}));const e=this.container.offsetWidth;let t=0;const i=[];this.children.forEach((e=>{e.isVisible()&&e instanceof oi&&(t+=e.width,e.collapsable&&i.push(e))})),0!==t&&(e0?(i.forEach((e=>e.collapse())),this.collapsed=i,this.getButton(ci.id).show(!1)):e>=t&&this.collapsed.length>0&&(this.collapsed.forEach((e=>e.uncollapse())),this.collapsed=[],this.getButton(ci.id).hide(!1)),this.getButton(Li.id,!1)?.autoSize())}},Hi=class extends ii{constructor(e){super(e,{className:"psv-loader-container"}),this.loader=document.createElement("div"),this.loader.className="psv-loader",this.container.appendChild(this.loader),this.size=this.loader.offsetWidth,this.canvas=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.canvas.setAttribute("class","psv-loader-canvas"),this.canvas.setAttribute("viewBox",`0 0 ${this.size} ${this.size}`),this.loader.appendChild(this.canvas),this.textColor=j(this.loader,"color"),this.color=j(this.canvas,"color"),this.border=parseInt(j(this.loader,"--psv-loader-border"),10),this.thickness=parseInt(j(this.loader,"--psv-loader-tickness"),10),this.viewer.addEventListener(qe.type,this),this.__updateContent(),this.hide()}destroy(){this.viewer.removeEventListener(qe.type,this),super.destroy()}handleEvent(e){e instanceof qe&&e.containsOptions("loadingImg","loadingTxt")&&this.__updateContent()}setProgress(e){const t=Math.min(e,99.999)/100*Math.PI*2,i=this.size/2,s=i,o=this.thickness/2+this.border,n=(this.size-this.thickness)/2-this.border,r=Math.sin(t)*n+i,a=-Math.cos(t)*n+i,h=e>50?"1":"0";this.canvas.innerHTML=`\n \n \n `,this.viewer.dispatchEvent(new pt(Math.round(e)))}__updateContent(){const e=this.loader.querySelector(".psv-loader-image, .psv-loader-text");let t;if(e&&this.loader.removeChild(e),this.viewer.config.loadingImg?(t=document.createElement("img"),t.className="psv-loader-image",t.src=this.viewer.config.loadingImg):this.viewer.config.loadingTxt&&(t=document.createElement("div"),t.className="psv-loader-text",t.innerHTML=this.viewer.config.loadingTxt),t){const e=Math.round(Math.sqrt(2*Math.pow(this.size/2-this.thickness/2-this.border,2)));t.style.maxWidth=e+"px",t.style.maxHeight=e+"px",this.loader.appendChild(t)}}},Ri=class extends ii{constructor(e){super(e,{className:"psv-notification"}),this.state={visible:!1,contentId:null,timeout:null},this.content=document.createElement("div"),this.content.className="psv-notification-content",this.container.appendChild(this.content),this.content.addEventListener("click",(()=>this.hide()))}isVisible(e){return this.state.visible&&(!e||!this.state.contentId||this.state.contentId===e)}toggle(){throw new ne("Notification cannot be toggled")}show(e){this.state.timeout&&(clearTimeout(this.state.timeout),this.state.timeout=null),"string"==typeof e&&(e={content:e}),this.state.contentId=e.id||null,this.content.innerHTML=e.content,this.container.classList.add("psv-notification--visible"),this.state.visible=!0,this.viewer.dispatchEvent(new Ot(e.id)),e.timeout&&(this.state.timeout=setTimeout((()=>this.hide(this.state.contentId)),e.timeout))}hide(e){if(this.isVisible(e)){const e=this.state.contentId;this.container.classList.remove("psv-notification--visible"),this.state.visible=!1,this.state.contentId=null,this.viewer.dispatchEvent(new it(e))}}},zi=class extends ii{constructor(e){super(e,{className:`psv-overlay ${E}`}),this.state={visible:!1,contentId:null,dissmisable:!0},this.image=document.createElement("div"),this.image.className="psv-overlay-image",this.container.appendChild(this.image),this.title=document.createElement("div"),this.title.className="psv-overlay-title",this.container.appendChild(this.title),this.text=document.createElement("div"),this.text.className="psv-overlay-text",this.container.appendChild(this.text),this.container.addEventListener("click",this),this.viewer.addEventListener(lt.type,this),super.hide()}destroy(){this.viewer.removeEventListener(lt.type,this),super.destroy()}handleEvent(e){"click"===e.type?this.isVisible()&&this.state.dissmisable&&(this.hide(),e.stopPropagation()):e instanceof lt&&this.isVisible()&&this.state.dissmisable&&e.key===M.Escape&&(this.hide(),e.preventDefault())}isVisible(e){return this.state.visible&&(!e||!this.state.contentId||this.state.contentId===e)}toggle(){throw new ne("Overlay cannot be toggled")}show(e){"string"==typeof e&&(e={title:e}),this.state.contentId=e.id||null,this.state.dissmisable=!1!==e.dissmisable,this.image.innerHTML=e.image||"",this.title.innerHTML=e.title||"",this.text.innerHTML=e.text||"",super.show(),this.viewer.dispatchEvent(new Lt(e.id))}hide(e){if(this.isVisible(e)){const e=this.state.contentId;super.hide(),this.state.contentId=null,this.viewer.dispatchEvent(new ot(e))}}},Ai="psv-panel-content--no-interaction",Di=class extends ii{constructor(e){super(e,{className:`psv-panel ${E}`}),this.state={visible:!1,contentId:null,mouseX:0,mouseY:0,mousedown:!1,clickHandler:null,keyHandler:null,width:{}};const t=document.createElement("div");t.className="psv-panel-resizer",this.container.appendChild(t);const i=document.createElement("div");i.className="psv-panel-close-button",i.innerHTML=T.close,i.title=e.config.lang.close,this.container.appendChild(i),this.content=document.createElement("div"),this.content.className="psv-panel-content",this.container.appendChild(this.content),this.container.addEventListener("wheel",(e=>e.stopPropagation())),i.addEventListener("click",(()=>this.hide())),t.addEventListener("mousedown",this),t.addEventListener("touchstart",this),this.viewer.container.addEventListener("mouseup",this),this.viewer.container.addEventListener("touchend",this),this.viewer.container.addEventListener("mousemove",this),this.viewer.container.addEventListener("touchmove",this),this.viewer.addEventListener(lt.type,this)}destroy(){this.viewer.removeEventListener(lt.type,this),this.viewer.container.removeEventListener("mousemove",this),this.viewer.container.removeEventListener("touchmove",this),this.viewer.container.removeEventListener("mouseup",this),this.viewer.container.removeEventListener("touchend",this),super.destroy()}handleEvent(e){switch(e.type){case"mousedown":this.__onMouseDown(e);break;case"touchstart":this.__onTouchStart(e);break;case"mousemove":this.__onMouseMove(e);break;case"touchmove":this.__onTouchMove(e);break;case"mouseup":this.__onMouseUp(e);break;case"touchend":this.__onTouchEnd(e);break;case lt.type:this.__onKeyPress(e)}}isVisible(e){return this.state.visible&&(!e||!this.state.contentId||this.state.contentId===e)}toggle(){throw new ne("Panel cannot be toggled")}show(e){"string"==typeof e&&(e={content:e});const t=this.isVisible(e.id);this.state.contentId=e.id||null,this.state.visible=!0,this.state.clickHandler&&(this.content.removeEventListener("click",this.state.clickHandler),this.content.removeEventListener("keydown",this.state.keyHandler),this.state.clickHandler=null,this.state.keyHandler=null),e.id&&this.state.width[e.id]?this.container.style.width=this.state.width[e.id]:e.width?this.container.style.width=e.width:this.container.style.width=null,this.content.innerHTML=e.content,this.content.scrollTop=0,this.container.classList.add("psv-panel--open"),A(this.content,"psv-panel-content--no-margin",!0===e.noMargin),e.clickHandler&&(this.state.clickHandler=t=>{e.clickHandler(t.target)},this.state.keyHandler=t=>{t.key===M.Enter&&e.clickHandler(t.target)},this.content.addEventListener("click",this.state.clickHandler),this.content.addEventListener("keydown",this.state.keyHandler),t||setTimeout((()=>{this.content.querySelector("a,button,[tabindex]")?.focus()}),300)),this.viewer.dispatchEvent(new kt(e.id))}hide(e){if(this.isVisible(e)){const e=this.state.contentId;this.state.visible=!1,this.state.contentId=null,this.content.innerHTML=null,this.container.classList.remove("psv-panel--open"),this.state.clickHandler&&(this.content.removeEventListener("click",this.state.clickHandler),this.state.clickHandler=null),this.viewer.dispatchEvent(new rt(e))}}__onMouseDown(e){e.stopPropagation(),this.__startResize(e.clientX,e.clientY)}__onTouchStart(e){if(e.stopPropagation(),1===e.touches.length){const t=e.touches[0];this.__startResize(t.clientX,t.clientY)}}__onMouseUp(e){this.state.mousedown&&(e.stopPropagation(),this.state.mousedown=!1,this.content.classList.remove(Ai))}__onTouchEnd(e){this.state.mousedown&&(e.stopPropagation(),0===e.touches.length&&(this.state.mousedown=!1,this.content.classList.remove(Ai)))}__onMouseMove(e){this.state.mousedown&&(e.stopPropagation(),this.__resize(e.clientX,e.clientY))}__onTouchMove(e){if(this.state.mousedown){const t=e.touches[0];this.__resize(t.clientX,t.clientY)}}__onKeyPress(e){this.isVisible()&&e.key===M.Escape&&(this.hide(),e.preventDefault())}__startResize(e,t){this.state.mouseX=e,this.state.mouseY=t,this.state.mousedown=!0,this.content.classList.add(Ai)}__resize(e,t){const i=e,s=t,o=Math.max(200,this.container.offsetWidth-(i-this.state.mouseX))+"px";this.state.contentId&&(this.state.width[this.state.contentId]=o),this.container.style.width=o,this.state.mouseX=i,this.state.mouseY=s}},Ui=class extends ii{constructor(e,t){super(e,{className:"psv-tooltip"}),this.state={visible:!0,arrow:0,border:0,state:0,width:0,height:0,pos:"",config:null,data:null},this.content=document.createElement("div"),this.content.className="psv-tooltip-content",this.container.appendChild(this.content),this.arrow=document.createElement("div"),this.arrow.className="psv-tooltip-arrow",this.container.appendChild(this.arrow),this.container.addEventListener("transitionend",this),this.container.addEventListener("touchdown",(e=>e.stopPropagation())),this.container.addEventListener("mousedown",(e=>e.stopPropagation())),this.container.style.top="-1000px",this.container.style.left="-1000px",this.show(t)}handleEvent(e){"transitionend"===e.type&&this.__onTransitionEnd(e)}destroy(){delete this.state.data,super.destroy()}toggle(){throw new ne("Tooltip cannot be toggled")}show(e){if(0!==this.state.state)throw new ne("Initialized tooltip cannot be re-initialized");e.className&&D(this.container,e.className),e.style&&Object.assign(this.container.style,e.style),this.state.state=3,this.update(e.content,e),this.state.data=e.data,this.state.state=1,this.viewer.dispatchEvent(new St(this,this.state.data)),this.__waitImages()}update(e,t){this.content.innerHTML=e;const i=this.container.getBoundingClientRect();this.state.width=i.right-i.left,this.state.height=i.bottom-i.top,this.state.arrow=parseInt(j(this.arrow,"border-top-width"),10),this.state.border=parseInt(j(this.container,"border-top-left-radius"),10),this.move(t??this.state.config)}move(e){if(1!==this.state.state&&3!==this.state.state)throw new ne("Uninitialized tooltip cannot be moved");e.box=e.box??this.state.config?.box??{width:0,height:0},this.state.config=e;const t=this.container,i=this.arrow,s={posClass:ye(e.position,{allowCenter:!1,cssOrder:!1})||["top","center"],width:this.state.width,height:this.state.height,top:0,left:0,arrowTop:0,arrowLeft:0};this.__computeTooltipPosition(s,e);let o=null,n=null;if(s.top<0?o="bottom":s.top+s.height>this.viewer.state.size.height&&(o="top"),s.left<0?n="right":s.left+s.width>this.viewer.state.size.width&&(n="left"),n||o){const t=be(s.posClass);o&&(s.posClass[t?0:1]=o),n&&(s.posClass[t?1:0]=n),this.__computeTooltipPosition(s,e)}t.style.top=s.top+"px",t.style.left=s.left+"px",i.style.top=s.arrowTop+"px",i.style.left=s.arrowLeft+"px";const r=s.posClass.join("-");r!==this.state.pos&&(t.classList.remove(`psv-tooltip--${this.state.pos}`),this.state.pos=r,t.classList.add(`psv-tooltip--${this.state.pos}`))}hide(){this.container.classList.remove("psv-tooltip--visible"),this.state.state=2,this.viewer.dispatchEvent(new ht(this.state.data))}__onTransitionEnd(e){if("transform"===e.propertyName)switch(this.state.state){case 1:this.container.classList.add("psv-tooltip--visible"),this.state.state=3;break;case 2:this.state.state=0,this.destroy()}}__computeTooltipPosition(e,t){const i=this.state.arrow,s=t.top,o=e.height,n=t.left,r=e.width,a=i+this.state.border,h=t.box.width/2+2*i,c=t.box.height/2+2*i;switch(e.posClass.join("-")){case"top-left":e.top=s-c-o,e.left=n+a-r,e.arrowTop=o,e.arrowLeft=r-a-i;break;case"top-center":e.top=s-c-o,e.left=n-r/2,e.arrowTop=o,e.arrowLeft=r/2-i;break;case"top-right":e.top=s-c-o,e.left=n-a,e.arrowTop=o,e.arrowLeft=i;break;case"bottom-left":e.top=s+c,e.left=n+a-r,e.arrowTop=2*-i,e.arrowLeft=r-a-i;break;case"bottom-center":e.top=s+c,e.left=n-r/2,e.arrowTop=2*-i,e.arrowLeft=r/2-i;break;case"bottom-right":e.top=s+c,e.left=n-a,e.arrowTop=2*-i,e.arrowLeft=i;break;case"left-top":e.top=s+a-o,e.left=n-h-r,e.arrowTop=o-a-i,e.arrowLeft=r;break;case"center-left":e.top=s-o/2,e.left=n-h-r,e.arrowTop=o/2-i,e.arrowLeft=r;break;case"left-bottom":e.top=s-a,e.left=n-h-r,e.arrowTop=i,e.arrowLeft=r;break;case"right-top":e.top=s+a-o,e.left=n+h,e.arrowTop=o-a-i,e.arrowLeft=2*-i;break;case"center-right":e.top=s-o/2,e.left=n+h,e.arrowTop=o/2-i,e.arrowLeft=2*-i;break;case"right-bottom":e.top=s-a,e.left=n+h,e.arrowTop=i,e.arrowLeft=2*-i}}__waitImages(){const e=this.content.querySelectorAll("img");if(e.length>0){const t=[];e.forEach((e=>{t.push(new Promise((t=>{e.onload=t,e.onerror=t})))})),Promise.all(t).then((()=>{if(1===this.state.state||3===this.state.state){const e=this.container.getBoundingClientRect();this.state.width=e.right-e.left,this.state.height=e.bottom-e.top,this.move(this.state.config)}}))}}},Ni=a(),Vi={enabled:!0,maxItems:10,ttl:600,items:{},purgeInterval:null,init(){Ni.Cache.enabled&&(le("ThreeJS cache should be disabled"),Ni.Cache.enabled=!1),!this.purgeInterval&&this.enabled&&(this.purgeInterval=setInterval((()=>this.purge()),6e4))},add(e,t,i){this.enabled&&t&&(this.items[t]=this.items[t]??{files:{},lastAccess:null},this.items[t].files[e]=i,this.items[t].lastAccess=Date.now())},get(e,t){if(this.enabled&&t&&this.items[t])return this.items[t].lastAccess=Date.now(),this.items[t].files[e]},remove(e,t){this.enabled&&t&&this.items[t]&&(delete this.items[t].files[e],0===Object.keys(this.items[t].files).length&&delete this.items[t])},purge(){Object.entries(this.items).sort((([,e],[,t])=>t.lastAccess-e.lastAccess)).forEach((([e,{lastAccess:t}],i)=>{i>0&&(Date.now()-t>=1e3*this.ttl||i>=this.maxItems)&&delete this.items[e]}))}},Fi=a(),Wi=class{constructor(e){this.viewer=e,this.config=e.config,this.state=e.state}destroy(){}},ji=new Fi.Vector3,Yi=new Fi.Euler(0,0,0,"ZXY"),Xi=class extends Wi{constructor(e){super(e)}fovToZoomLevel(e){const t=Math.round((e-this.config.minFov)/(this.config.maxFov-this.config.minFov)*100);return t-2*(t-50)}zoomLevelToFov(e){return this.config.maxFov+e/100*(this.config.minFov-this.config.maxFov)}vFovToHFov(e){return Fi.MathUtils.radToDeg(2*Math.atan(Math.tan(Fi.MathUtils.degToRad(e)/2)*this.state.aspect))}getAnimationProperties(e,t,i){const s=!ee(t),o=!ee(i),n={};let r;if(s){const i=this.viewer.getPosition(),s=S(i.yaw,t.yaw);n.yaw={start:i.yaw,end:i.yaw+s},n.pitch={start:i.pitch,end:t.pitch},r=_e(e,H(i,t))}if(o){const t=this.viewer.getZoomLevel(),s=Math.abs(i-t);n.zoom={start:t,end:i},r||(r=_e(e,Math.PI/4*s/100))}return r=Math.max(p,r),{duration:r,properties:n}}textureCoordsToSphericalCoords(e){if(!this.state.textureData?.panoData)throw new ne("Current adapter does not support texture coordinates or no texture has been loaded");const t=this.viewer.adapter.textureCoordsToSphericalCoords(e,this.state.textureData.panoData);return Yi.equals(this.viewer.renderer.panoramaPose)&&Yi.equals(this.viewer.renderer.sphereCorrection)?t:(this.sphericalCoordsToVector3(t,ji),ji.applyEuler(this.viewer.renderer.panoramaPose),ji.applyEuler(this.viewer.renderer.sphereCorrection),this.vector3ToSphericalCoords(ji))}sphericalCoordsToTextureCoords(e){if(!this.state.textureData?.panoData)throw new ne("Current adapter does not support texture coordinates or no texture has been loaded");return Yi.equals(this.viewer.renderer.panoramaPose)&&Yi.equals(this.viewer.renderer.sphereCorrection)||(this.sphericalCoordsToVector3(e,ji),Oe(ji,this.viewer.renderer.sphereCorrection),Oe(ji,this.viewer.renderer.panoramaPose),e=this.vector3ToSphericalCoords(ji)),this.viewer.adapter.sphericalCoordsToTextureCoords(e,this.state.textureData.panoData)}sphericalCoordsToVector3(e,t,i=y){return t||(t=new Fi.Vector3),t.x=i*-Math.cos(e.pitch)*Math.sin(e.yaw),t.y=i*Math.sin(e.pitch),t.z=i*Math.cos(e.pitch)*Math.cos(e.yaw),t}vector3ToSphericalCoords(e){const t=Math.acos(e.y/Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z)),i=Math.atan2(e.x,e.z);return{yaw:i<0?-i:2*Math.PI-i,pitch:Math.PI/2-t}}viewerCoordsToVector3(e){const t=this.viewer.renderer.getIntersections(e).filter((e=>e.object.userData[b]));return t.length?t[0].point:null}viewerCoordsToSphericalCoords(e){const t=this.viewerCoordsToVector3(e);return t?this.vector3ToSphericalCoords(t):null}vector3ToViewerCoords(e){const t=e.clone();return t.project(this.viewer.renderer.camera),{x:Math.round((t.x+1)/2*this.state.size.width),y:Math.round((1-t.y)/2*this.state.size.height)}}sphericalCoordsToViewerCoords(e){return this.sphericalCoordsToVector3(e,ji),this.vector3ToViewerCoords(ji)}isPointVisible(e){let t,i;if(e instanceof Fi.Vector3)t=e,i=this.vector3ToViewerCoords(e);else{if(!de(e))return!1;t=this.sphericalCoordsToVector3(e,ji),i=this.vector3ToViewerCoords(t)}return t.dot(this.viewer.state.direction)>0&&i.x>=0&&i.x<=this.viewer.state.size.width&&i.y>=0&&i.y<=this.viewer.state.size.height}cleanPosition(e){return"yaw"in e&&"pitch"in e?{yaw:xe(e.yaw),pitch:xe(e.pitch,!this.state.littlePlanet)}:this.textureCoordsToSphericalCoords(e)}cleanSphereCorrection(e){return{pan:xe(e?.pan||0),tilt:xe(e?.tilt||0,!0),roll:xe(e?.roll||0,!0,!1)}}cleanPanoramaPose(e){return{pan:Fi.MathUtils.degToRad(e?.poseHeading||0),tilt:Fi.MathUtils.degToRad(e?.posePitch||0),roll:Fi.MathUtils.degToRad(e?.poseRoll||0)}}},$i=a(),Zi=class e{constructor(){this.$=e.IDLE}is(...e){return e.some((e=>this.$&e))}set(e){this.$=e}add(e){this.$|=e}remove(e){this.$&=~e}};Zi.IDLE=0,Zi.CLICK=1,Zi.MOVING=2,Zi.INERTIA=4;var Bi=Zi,Gi=class extends Wi{constructor(e){super(e),this.data={startMouseX:0,startMouseY:0,mouseX:0,mouseY:0,mouseHistory:[],pinchDist:0,ctrlKeyDown:!1,dblclickData:null,dblclickTimeout:null,longtouchTimeout:null,twofingersTimeout:null,ctrlZoomTimeout:null},this.step=new Bi,this.keyHandler=new Re,this.resizeObserver=new ResizeObserver(G((()=>this.viewer.autoSize()),50)),this.moveThreshold=u*Qt.pixelRatio}init(){window.addEventListener("keydown",this,{passive:!1}),window.addEventListener("keyup",this),this.viewer.container.addEventListener("mousedown",this),window.addEventListener("mousemove",this,{passive:!1}),window.addEventListener("mouseup",this),this.viewer.container.addEventListener("touchstart",this,{passive:!1}),window.addEventListener("touchmove",this,{passive:!1}),window.addEventListener("touchend",this,{passive:!1}),this.viewer.container.addEventListener("wheel",this,{passive:!1}),document.addEventListener(Qt.fullscreenEvent,this),this.resizeObserver.observe(this.viewer.container)}destroy(){window.removeEventListener("keydown",this),window.removeEventListener("keyup",this),this.viewer.container.removeEventListener("mousedown",this),window.removeEventListener("mousemove",this),window.removeEventListener("mouseup",this),this.viewer.container.removeEventListener("touchstart",this),window.removeEventListener("touchmove",this),window.removeEventListener("touchend",this),this.viewer.container.removeEventListener("wheel",this),document.removeEventListener(Qt.fullscreenEvent,this),this.resizeObserver.disconnect(),clearTimeout(this.data.dblclickTimeout),clearTimeout(this.data.longtouchTimeout),clearTimeout(this.data.twofingersTimeout),clearTimeout(this.data.ctrlZoomTimeout),super.destroy()}handleEvent(e){switch(e.type){case"keydown":this.__onKeyDown(e);break;case"keyup":this.__onKeyUp();break;case"mousemove":this.__onMouseMove(e);break;case"mouseup":this.__onMouseUp(e);break;case"touchmove":this.__onTouchMove(e);break;case"touchend":this.__onTouchEnd(e);break;case Qt.fullscreenEvent:this.__onFullscreenChange()}if(!V(e.target,"."+E))switch(e.type){case"mousedown":this.__onMouseDown(e);break;case"touchstart":this.__onTouchStart(e);break;case"wheel":this.__onMouseWheel(e)}}__onKeyDown(e){if(this.config.mousewheelCtrlKey&&(this.data.ctrlKeyDown=e.key===M.Control,this.data.ctrlKeyDown&&(clearTimeout(this.data.ctrlZoomTimeout),this.viewer.overlay.hide(x.CTRL_ZOOM))),!this.viewer.dispatchEvent(new lt(e.key)))return;if(!this.state.keyboardEnabled)return;const t=this.config.keyboardActions?.[e.key];if("function"==typeof t)t(this.viewer),e.preventDefault();else if(t&&!this.keyHandler.pending){switch("ZOOM_IN"!==t&&"ZOOM_OUT"!==t&&this.viewer.stopAll(),t){case"ROTATE_UP":this.viewer.dynamics.position.roll({pitch:!1});break;case"ROTATE_DOWN":this.viewer.dynamics.position.roll({pitch:!0});break;case"ROTATE_RIGHT":this.viewer.dynamics.position.roll({yaw:!1});break;case"ROTATE_LEFT":this.viewer.dynamics.position.roll({yaw:!0});break;case"ZOOM_IN":this.viewer.dynamics.zoom.roll(!1);break;case"ZOOM_OUT":this.viewer.dynamics.zoom.roll(!0)}this.keyHandler.down(),e.preventDefault()}}__onKeyUp(){this.data.ctrlKeyDown=!1,this.state.keyboardEnabled&&this.keyHandler.up((()=>{this.viewer.dynamics.position.stop(),this.viewer.dynamics.zoom.stop(),this.viewer.resetIdleTimer()}))}__onMouseDown(e){this.step.add(Bi.CLICK),this.data.startMouseX=e.clientX,this.data.startMouseY=e.clientY}__onMouseUp(e){this.step.is(Bi.CLICK,Bi.MOVING)&&this.__stopMove(e.clientX,e.clientY,e.target,2===e.button)}__onMouseMove(e){this.config.mousemove&&this.step.is(Bi.CLICK,Bi.MOVING)&&(e.preventDefault(),this.__doMove(e.clientX,e.clientY)),this.__handleObjectsEvents(e)}__onTouchStart(e){1===e.touches.length?(this.step.add(Bi.CLICK),this.data.startMouseX=e.touches[0].clientX,this.data.startMouseY=e.touches[0].clientY,this.data.longtouchTimeout||(this.data.longtouchTimeout=setTimeout((()=>{const t=e.touches[0];this.__stopMove(t.clientX,t.clientY,t.target,!0),this.data.longtouchTimeout=null}),m))):2===e.touches.length&&(this.step.set(Bi.IDLE),this.__cancelLongTouch(),this.config.mousemove&&(this.__cancelTwoFingersOverlay(),this.__startMoveZoom(e),e.preventDefault()))}__onTouchEnd(e){if(this.__cancelLongTouch(),this.step.is(Bi.CLICK,Bi.MOVING))if(e.preventDefault(),this.__cancelTwoFingersOverlay(),1===e.touches.length)this.__stopMove(this.data.mouseX,this.data.mouseY);else if(0===e.touches.length){const t=e.changedTouches[0];this.__stopMove(t.clientX,t.clientY,t.target)}}__onTouchMove(e){if(this.__cancelLongTouch(),this.config.mousemove)if(1===e.touches.length){if(this.config.touchmoveTwoFingers)this.step.is(Bi.CLICK)&&!this.data.twofingersTimeout&&(this.data.twofingersTimeout=setTimeout((()=>{this.viewer.overlay.show({id:x.TWO_FINGERS,image:'\n',title:this.config.lang.twoFingers})}),w));else if(this.step.is(Bi.CLICK,Bi.MOVING)){e.preventDefault();const t=e.touches[0];this.__doMove(t.clientX,t.clientY)}}else this.__doMoveZoom(e),this.__cancelTwoFingersOverlay()}__cancelLongTouch(){this.data.longtouchTimeout&&(clearTimeout(this.data.longtouchTimeout),this.data.longtouchTimeout=null)}__cancelTwoFingersOverlay(){this.config.touchmoveTwoFingers&&(this.data.twofingersTimeout&&(clearTimeout(this.data.twofingersTimeout),this.data.twofingersTimeout=null),this.viewer.overlay.hide(x.TWO_FINGERS))}__onMouseWheel(e){if(!this.config.mousewheel||!e.deltaY)return;if(this.config.mousewheelCtrlKey&&!this.data.ctrlKeyDown)return this.viewer.overlay.show({id:x.CTRL_ZOOM,image:'\n',title:this.config.lang.ctrlZoom}),clearTimeout(this.data.ctrlZoomTimeout),void(this.data.ctrlZoomTimeout=setTimeout((()=>this.viewer.overlay.hide(x.CTRL_ZOOM)),g));e.preventDefault(),e.stopPropagation();const t=e.deltaY/Math.abs(e.deltaY)*5*this.config.zoomSpeed;0!==t&&this.viewer.dynamics.zoom.step(-t,5)}__onFullscreenChange(){const e=this.viewer.isFullscreenEnabled();"fullscreen"===this.config.keyboard&&(e?this.viewer.startKeyboardControl():this.viewer.stopKeyboardControl()),this.viewer.dispatchEvent(new et(e))}__resetMove(){this.step.set(Bi.IDLE),this.data.mouseX=0,this.data.mouseY=0,this.data.startMouseX=0,this.data.startMouseY=0,this.data.mouseHistory.length=0}__startMoveZoom(e){this.viewer.stopAll(),this.__resetMove();const t=Y(e);this.step.set(Bi.MOVING),({distance:this.data.pinchDist,center:{x:this.data.mouseX,y:this.data.mouseY}}=t),this.__logMouseMove(this.data.mouseX,this.data.mouseY)}__stopMove(e,t,i,s=!1){this.step.is(Bi.MOVING)?this.config.moveInertia?(this.__logMouseMove(e,t),this.__stopMoveInertia(e,t)):(this.__resetMove(),this.viewer.resetIdleTimer()):(this.step.is(Bi.CLICK)&&!this.__moveThresholdReached(e,t)&&this.__doClick(e,t,i,s),this.step.remove(Bi.CLICK),this.step.is(Bi.INERTIA)||(this.__resetMove(),this.viewer.resetIdleTimer()))}__stopMoveInertia(e,t){const i=new $i.SplineCurve(this.data.mouseHistory.map((([,e,t])=>new $i.Vector2(e,t)))).getTangent(1),s=this.data.mouseHistory.reduce((({total:e,prev:t},i)=>({total:t?e+k({x:t[1],y:t[2]},{x:i[1],y:i[2]})/(i[0]-t[0]):0,prev:i})),{total:0,prev:null}).total/this.data.mouseHistory.length;if(!s)return this.__resetMove(),void this.viewer.resetIdleTimer();this.step.set(Bi.INERTIA);let o=e,n=t;this.state.animation=new ke({properties:{speed:{start:s,end:0}},duration:1e3,easing:"outQuad",onTick:e=>{o+=e.speed*i.x*3*Qt.pixelRatio,n+=e.speed*i.y*3*Qt.pixelRatio,this.__applyMove(o,n)}}),this.state.animation.then((e=>{this.state.animation=null,e&&(this.__resetMove(),this.viewer.resetIdleTimer())}))}__doClick(e,t,i,s=!1){const o=this.viewer.container.getBoundingClientRect(),n=e-o.left,r=t-o.top,a=this.viewer.renderer.getIntersections({x:n,y:r}),h=a.find((e=>e.object.userData[b]));if(h){const o=this.viewer.dataHelper.vector3ToSphericalCoords(h.point),c={rightclick:s,target:i,clientX:e,clientY:t,viewerX:n,viewerY:r,yaw:o.yaw,pitch:o.pitch,objects:a.map((e=>e.object)).filter((e=>!e.userData[b]))};try{const e=this.viewer.dataHelper.sphericalCoordsToTextureCoords(c);Object.assign(c,e)}catch(e){}this.data.dblclickTimeout?(Math.abs(this.data.dblclickData.clientX-c.clientX){this.data.dblclickTimeout=null,this.data.dblclickData=null}),v))}}__handleObjectsEvents(e){if(!J(this.state.objectsObservers)&&N(e.target,this.viewer.container)){const t=F(this.viewer.container),i={x:e.clientX-t.x,y:e.clientY-t.y},s=this.viewer.renderer.getIntersections(i),o=(t,s,o)=>{this.viewer.dispatchEvent(new o(e,t,i,s))};for(const[e,t]of Object.entries(this.state.objectsObservers)){const i=s.find((t=>t.object.userData[e]));i?(t&&i.object!==t&&(o(t,e,jt),this.state.objectsObservers[e]=null),t?o(i.object,e,Xt):(this.state.objectsObservers[e]=i.object,o(i.object,e,Ft))):t&&(o(t,e,jt),this.state.objectsObservers[e]=null)}}}__doMove(e,t){this.step.is(Bi.CLICK)&&this.__moveThresholdReached(e,t)?(this.viewer.stopAll(),this.__resetMove(),this.step.set(Bi.MOVING),this.data.mouseX=e,this.data.mouseY=t,this.__logMouseMove(e,t)):this.step.is(Bi.MOVING)&&(this.__applyMove(e,t),this.__logMouseMove(e,t))}__moveThresholdReached(e,t){return Math.abs(e-this.data.startMouseX)>=this.moveThreshold||Math.abs(t-this.data.startMouseY)>=this.moveThreshold}__applyMove(e,t){const i=this.config.moveSpeed*((e-this.data.mouseX)/this.state.size.width)*$i.MathUtils.degToRad(this.state.littlePlanet?90:this.state.hFov),s=this.config.moveSpeed*((t-this.data.mouseY)/this.state.size.height)*$i.MathUtils.degToRad(this.state.littlePlanet?90:this.state.vFov),o=this.viewer.getPosition();this.viewer.rotate({yaw:o.yaw-i,pitch:o.pitch+s}),this.data.mouseX=e,this.data.mouseY=t}__doMoveZoom(e){if(this.step.is(Bi.MOVING)){e.preventDefault();const t=Y(e),i=(t.distance-this.data.pinchDist)/Qt.pixelRatio*this.config.zoomSpeed;this.viewer.zoom(this.viewer.getZoomLevel()+i),this.__doMove(t.center.x,t.center.y),this.data.pinchDist=t.distance}}__logMouseMove(e,t){const i=Date.now(),s=this.data.mouseHistory.length?this.data.mouseHistory[this.data.mouseHistory.length-1]:[0,-1,-1];s[1]===e&&s[2]===t?s[0]=i:i===s[0]?(s[1]=e,s[2]=t):this.data.mouseHistory.push([i,e,t]);let o=null;for(let e=0;ef/10?(this.data.mouseHistory.splice(0,e),e=0,o=this.data.mouseHistory[e][0]):(o=this.data.mouseHistory[e][0],e++)}},qi=a(),Ki=new qi.Vector2,Qi=new qi.Matrix4,Ji=new qi.Box3,es=class extends Wi{constructor(e){super(e),this.frustumNeedsUpdate=!0,this.renderer=new qi.WebGLRenderer(this.config.rendererParameters),this.renderer.setPixelRatio(Qt.pixelRatio),this.renderer.outputColorSpace=qi.LinearSRGBColorSpace,this.renderer.domElement.className="psv-canvas",this.scene=new qi.Scene,this.camera=new qi.PerspectiveCamera(50,16/9,.1,2*y),this.camera.matrixWorldAutoUpdate=!1,this.mesh=this.viewer.adapter.createMesh(),this.mesh.userData={[b]:!0},this.meshContainer=new qi.Group,this.meshContainer.add(this.mesh),this.scene.add(this.meshContainer),this.raycaster=new qi.Raycaster,this.frustum=new qi.Frustum,this.container=document.createElement("div"),this.container.className="psv-canvas-container",this.container.appendChild(this.renderer.domElement),this.viewer.container.appendChild(this.container),this.viewer.addEventListener(Rt.type,this),this.viewer.addEventListener(Ut.type,this),this.viewer.addEventListener(bt.type,this),this.viewer.addEventListener(qe.type,this),this.hide()}get panoramaPose(){return this.mesh.rotation}get sphereCorrection(){return this.meshContainer.rotation}init(){this.show(),this.renderer.setAnimationLoop((e=>this.__renderLoop(e)))}destroy(){this.renderer.setAnimationLoop(null),this.cleanScene(this.scene),this.viewer.container.removeChild(this.container),this.viewer.removeEventListener(Rt.type,this),this.viewer.removeEventListener(Ut.type,this),this.viewer.removeEventListener(bt.type,this),this.viewer.removeEventListener(qe.type,this),super.destroy()}handleEvent(e){switch(e.type){case Rt.type:this.__onSizeUpdated();break;case Ut.type:this.__onZoomUpdated();break;case bt.type:this.__onPositionUpdated();break;case qe.type:e.containsOptions("fisheye")&&this.__onPositionUpdated(),e.containsOptions("canvasBackground")&&(this.container.style.background=this.config.canvasBackground)}}hide(){this.container.style.opacity="0"}show(){this.container.style.opacity="1"}setCustomRenderer(e){this.customRenderer=e?e(this.renderer):null,this.viewer.needsUpdate()}__onSizeUpdated(){this.renderer.setSize(this.state.size.width,this.state.size.height),this.camera.aspect=this.state.aspect,this.camera.updateProjectionMatrix(),this.viewer.needsUpdate(),this.frustumNeedsUpdate=!0}__onZoomUpdated(){this.camera.fov=this.state.vFov,this.camera.updateProjectionMatrix(),this.viewer.needsUpdate(),this.frustumNeedsUpdate=!0}__onPositionUpdated(){this.camera.position.set(0,0,0),this.camera.lookAt(this.state.direction),this.config.fisheye&&this.camera.position.copy(this.state.direction).multiplyScalar(this.config.fisheye/2).negate(),this.camera.updateMatrixWorld(),this.viewer.needsUpdate(),this.frustumNeedsUpdate=!0}__renderLoop(e){const t=this.timestamp?e-this.timestamp:0;this.timestamp=e,this.viewer.dispatchEvent(new Ye(e,t)),this.viewer.dynamics.update(t),(this.state.needsUpdate||this.state.continuousUpdateCount>0)&&((this.customRenderer||this.renderer).render(this.scene,this.camera),this.viewer.dispatchEvent(new Mt),this.state.needsUpdate=!1)}setTexture(e){this.viewer.adapter.constructor.supportsOverlay&&this.setOverlay(null,0),this.state.textureData&&this.viewer.adapter.disposeTexture(this.state.textureData),this.state.textureData=e,this.viewer.adapter.setTexture(this.mesh,e),this.viewer.needsUpdate()}setOverlay(e,t){this.state.overlayData&&this.viewer.adapter.disposeTexture(this.state.overlayData),this.state.overlayData=e,this.viewer.adapter.setOverlay(this.mesh,e,t),this.viewer.needsUpdate()}setPanoramaPose(e,t=this.mesh){const i=this.viewer.dataHelper.cleanPanoramaPose(e);t.rotation.set(-i.tilt,-i.pan,-i.roll,"ZXY")}setSphereCorrection(e,t=this.meshContainer){const i=this.viewer.dataHelper.cleanSphereCorrection(e);t.rotation.set(i.tilt,i.pan,i.roll,"ZXY")}transition(e,t){const i=!ee(t.position),s=!ee(t.zoom),o=new We(i?this.viewer.dataHelper.cleanPosition(t.position):void 0,t.zoom);this.viewer.dispatchEvent(o);const n=new qi.Group,r=this.viewer.adapter.createMesh(.5);if(this.viewer.adapter.setTexture(r,e,!0),this.viewer.adapter.setTextureOpacity(r,0),this.setPanoramaPose(e.panoData,r),this.setSphereCorrection(t.sphereCorrection,n),i&&"fade-only"===t.transition){const e=this.viewer.getPosition(),t=new qi.Vector3(0,1,0);n.rotateOnWorldAxis(t,o.position.yaw-e.yaw);const i=new qi.Vector3(0,1,0).cross(this.camera.getWorldDirection(new qi.Vector3)).normalize();n.rotateOnWorldAxis(i,o.position.pitch-e.pitch)}n.add(r),this.scene.add(n),this.renderer.setRenderTarget(new qi.WebGLRenderTarget),this.renderer.render(this.scene,this.camera),this.renderer.setRenderTarget(null);const{duration:a,properties:h}=this.viewer.dataHelper.getAnimationProperties(t.transition,!0===t.transition?o.position:null,o.zoomLevel),c=new ke({properties:{...h,opacity:{start:0,end:1}},duration:a,easing:"inOutCubic",onTick:e=>{this.viewer.adapter.setTextureOpacity(r,e.opacity),i&&!0===t.transition&&this.viewer.dynamics.position.setValue({yaw:e.yaw,pitch:e.pitch}),s&&this.viewer.dynamics.zoom.setValue(e.zoom),this.viewer.needsUpdate()}});return c.then((s=>{s?(this.setTexture(e),this.viewer.adapter.setTextureOpacity(this.mesh,1),this.setPanoramaPose(e.panoData),this.setSphereCorrection(t.sphereCorrection),i&&"fade-only"===t.transition&&this.viewer.rotate(t.position)):this.viewer.adapter.disposeTexture(e),this.scene.remove(n),r.geometry.dispose(),r.geometry=null})),c}getIntersections(e){Ki.x=2*e.x/this.state.size.width-1,Ki.y=-2*e.y/this.state.size.height+1,this.raycaster.setFromCamera(Ki,this.camera);const t=this.raycaster.intersectObjects(this.scene.children,!0).filter((e=>e.object.isMesh&&!!e.object.userData));return this.customRenderer?.getIntersections&&t.push(...this.customRenderer.getIntersections(this.raycaster,Ki)),t}isObjectVisible(e){if(!e)return!1;if(this.frustumNeedsUpdate&&(Qi.multiplyMatrices(this.camera.projectionMatrix,this.camera.matrixWorldInverse),this.frustum.setFromProjectionMatrix(Qi),this.frustumNeedsUpdate=!1),e.isVector3)return this.frustum.containsPoint(e);if(e.isMesh&&e.geometry){const t=e;return t.geometry.boundingBox||t.geometry.computeBoundingBox(),Ji.copy(t.geometry.boundingBox).applyMatrix4(t.matrixWorld),this.frustum.intersectsBox(Ji)}return!!e.isObject3D&&this.frustum.intersectsObject(e)}addObject(e){this.scene.add(e)}removeObject(e){this.scene.remove(e)}cleanScene(e){const t=e=>{e.map?.dispose(),e.uniforms&&Object.values(e.uniforms).forEach((e=>{e.value?.dispose?.()})),e.dispose()};e.traverse((i=>{i.geometry?.dispose(),i.material&&(Array.isArray(i.material)?i.material.forEach((e=>{t(e)})):t(i.material)),i instanceof qi.Scene||i.dispose?.(),i!==e&&this.cleanScene(i)}))}},ts=a(),is=class extends Wi{constructor(e){super(e),this.fileLoader=new ts.FileLoader,this.fileLoader.setResponseType("blob"),this.imageLoader=new ts.ImageLoader,this.config.withCredentials&&(this.fileLoader.setWithCredentials(!0),this.imageLoader.setCrossOrigin("use-credentials"))}destroy(){this.abortLoading(),super.destroy()}abortLoading(){}loadFile(e,t,i){const s=Vi.get(e,i);if(s){if(s instanceof Blob)return t?.(100),Promise.resolve(s);Vi.remove(e,i)}return this.config.requestHeaders&&this.fileLoader.setRequestHeader(this.config.requestHeaders(e)),new Promise(((s,o)=>{let n=0;t?.(n),this.fileLoader.load(e,(o=>{n=100,t?.(n),Vi.add(e,i,o),s(o)}),(e=>{if(e.lengthComputable){const i=e.loaded/e.total*100;i>n&&(n=i,t?.(n))}}),(e=>{o(e)}))}))}loadImage(e,t,i){const s=Vi.get(e,i);return s?(t?.(100),s instanceof Blob?this.blobToImage(s):Promise.resolve(s)):t||this.config.requestHeaders?this.loadFile(e,t,i).then((e=>this.blobToImage(e))):this.imageLoader.loadAsync(e).then((t=>(Vi.add(e,i,t),t)))}blobToImage(e){return new Promise(((t,i)=>{const s=document.createElement("img");s.onload=()=>{URL.revokeObjectURL(s.src),t(s)},s.onerror=i,s.src=URL.createObjectURL(e)}))}preloadPanorama(e){return this.viewer.adapter.supportsPreload(e)?this.viewer.adapter.loadTexture(e):Promise.reject(new ne("Current adapter does not support preload"))}},ss=a(),os=class extends Wi{constructor(e){super(e),this.zoom=new Se((e=>{this.viewer.state.vFov=this.viewer.dataHelper.zoomLevelToFov(e),this.viewer.state.hFov=this.viewer.dataHelper.vFovToHFov(this.viewer.state.vFov),this.viewer.dispatchEvent(new Ut(e))}),{defaultValue:this.viewer.config.defaultZoomLvl,min:0,max:100,wrap:!1}),this.position=new He((e=>{this.viewer.dataHelper.sphericalCoordsToVector3(e,this.viewer.state.direction),this.viewer.dispatchEvent(new bt(e))}),{yaw:new Se(null,{defaultValue:this.config.defaultYaw,min:0,max:2*Math.PI,wrap:!0}),pitch:new Se(null,{defaultValue:this.config.defaultPitch,min:this.viewer.state.littlePlanet?0:-Math.PI/2,max:this.viewer.state.littlePlanet?2*Math.PI:Math.PI/2,wrap:this.viewer.state.littlePlanet})}),this.updateSpeeds()}updateSpeeds(){this.zoom.setSpeed(50*this.config.zoomSpeed),this.position.setSpeed(ss.MathUtils.degToRad(50*this.config.moveSpeed))}update(e){this.zoom.update(e),this.position.update(e)}},ns=a(),rs=class{constructor(){this.ready=!1,this.needsUpdate=!1,this.continuousUpdateCount=0,this.keyboardEnabled=!1,this.direction=new ns.Vector3(0,0,y),this.vFov=60,this.hFov=60,this.aspect=1,this.animation=null,this.transitionAnimation=null,this.loadingPromise=null,this.littlePlanet=!1,this.idleTime=-1,this.objectsObservers={},this.size={width:0,height:0}}get panoData(){return le("ViewerState.panoData is deprecated, use ViewerState.textureData.panoData instead"),this.textureData?.panoData}},as=class extends Ne{constructor(e){super(),this.plugins={},this.children=[],this.onResize=G((()=>this.navbar.autoSize()),500),Vi.init(),Qt.load(),this.state=new rs,this.config=Ci(e),this.parent=z(e.container),this.parent[b]=this,this.container=document.createElement("div"),this.container.classList.add("psv-container"),this.parent.appendChild(this.container),Le(this.container,"core"),this.adapter=new this.config.adapter[0](this,this.config.adapter[1]),this.renderer=new es(this),this.textureLoader=new is(this),this.eventsHandler=new Gi(this),this.dataHelper=new Xi(this),this.dynamics=new os(this),this.adapter.init?.(),this.loader=new Hi(this),this.navbar=new Si(this),this.panel=new Di(this),this.notification=new Ri(this),this.overlay=new zi(this),this.resize(this.config.size),this.setCursor(null),re(Qt.isTouchEnabled,(e=>{A(this.container,"psv--is-touch",e)})),this.config.plugins.forEach((([e,t])=>{this.plugins[e.id]=new e(this,t)}));for(const e of Object.values(this.plugins))e.init?.();this.config.navbar&&this.navbar.setButtons(this.config.navbar),this.state.loadingPromise||(this.config.panorama?this.setPanorama(this.config.panorama):this.loader.show())}destroy(){this.stopAll(),this.stopKeyboardControl(),this.exitFullscreen();for(const[e,t]of Object.entries(this.plugins))t.destroy(),delete this.plugins[e];this.children.slice().forEach((e=>e.destroy())),this.children.length=0,this.eventsHandler.destroy(),this.renderer.destroy(),this.textureLoader.destroy(),this.dataHelper.destroy(),this.adapter.destroy(),this.dynamics.destroy(),this.parent.removeChild(this.container),delete this.parent[b]}init(){this.eventsHandler.init(),this.renderer.init(),this.config.navbar&&this.navbar.show(),"always"===this.config.keyboard&&this.startKeyboardControl(),this.resetIdleTimer(),this.state.ready=!0,this.dispatchEvent(new _t)}resetIdleTimer(){this.state.idleTime=performance.now()}disableIdleTimer(){this.state.idleTime=-1}getPlugin(e){if("string"==typeof e)return this.plugins[e];{const t=xi(e);return t?this.plugins[t.id]:null}}getPosition(){return this.dataHelper.cleanPosition(this.dynamics.position.current)}getZoomLevel(){return this.dynamics.zoom.current}getSize(){return{...this.state.size}}isFullscreenEnabled(){return X(this.parent)}needsUpdate(){this.state.needsUpdate=!0}needsContinuousUpdate(e){e?this.state.continuousUpdateCount++:this.state.continuousUpdateCount>0&&this.state.continuousUpdateCount--}autoSize(){this.container.clientWidth===this.state.size.width&&this.container.clientHeight===this.state.size.height||(this.state.size.width=Math.round(this.container.clientWidth),this.state.size.height=Math.round(this.container.clientHeight),this.state.aspect=this.state.size.width/this.state.size.height,this.state.hFov=this.dataHelper.vFovToHFov(this.state.vFov),this.dispatchEvent(new Rt(this.getSize())),this.onResize())}setPanorama(e,t={}){this.textureLoader.abortLoading(),this.state.transitionAnimation?.cancel(),this.state.ready||["sphereCorrection","panoData","overlay","overlayOpacity"].forEach((e=>{e in t||(t[e]=this.config[e])})),de(t)&&(le("PanoramaOptions.yaw and PanoramaOptions.pitch are deprecated, use PanoramaOptions.position instead"),t.position=this.dataHelper.cleanPosition(t)),"number"==typeof t.transition&&(le("Use PanoramaOptions.speed to define the speed/duration of the transition"),t.speed=t.transition,t.transition=!0),void 0===t.transition&&(t.transition=!0),void 0===t.speed&&(t.speed=d),void 0===t.showLoader&&(t.showLoader=!0),void 0===t.caption&&(t.caption=this.config.caption),void 0===t.description&&(t.description=this.config.description),t.panoData||"function"!=typeof this.config.panoData||(t.panoData=this.config.panoData);const i=!ee(t.position),s=!ee(t.zoom);(i||s)&&this.stopAll(),this.hideError(),this.resetIdleTimer(),this.config.panorama=e,this.config.caption=t.caption,this.config.description=t.description;const o=i=>{if(this.loader.hide(),this.state.loadingPromise=null,ce(i))return!1;if(i)throw this.navbar.setCaption(""),this.showError(this.config.lang.loadError),console.error(i),this.dispatchEvent(new ft(e,i)),i;return this.setOverlay(t.overlay,t.overlayOpacity),this.navbar.setCaption(this.config.caption),!0};this.navbar.setCaption(`${this.config.loadingTxt||""}`),!t.showLoader&&this.state.ready||this.loader.show(),this.dispatchEvent(new vt(e));const n=this.adapter.loadTexture(this.config.panorama,t.panoData).then((e=>{if(e.panorama!==this.config.panorama)throw this.adapter.disposeTexture(e),he();return e}));return t.transition&&this.state.ready&&this.adapter.supportsTransition(this.config.panorama)?this.state.loadingPromise=n.then((e=>(this.loader.hide(),this.dispatchEvent(new wt(e)),this.state.transitionAnimation=this.renderer.transition(e,t),this.state.transitionAnimation))).then((e=>{if(this.state.transitionAnimation=null,!e)throw he()})).then((()=>o()),(e=>o(e))):this.state.loadingPromise=n.then((e=>{this.renderer.show(),this.renderer.setTexture(e),this.renderer.setPanoramaPose(e.panoData),this.renderer.setSphereCorrection(t.sphereCorrection),this.state.ready||this.init(),this.dispatchEvent(new wt(e)),s&&this.zoom(t.zoom),i&&this.rotate(t.position)})).then((()=>o()),(e=>o(e))),this.state.loadingPromise}setOverlay(e,t=this.config.overlayOpacity){const i=this.adapter.constructor.supportsOverlay;return e?i?this.adapter.loadTexture(e,(e=>{if(this.state.textureData.panoData.isEquirectangular){const t=this.state.textureData.panoData,i=e.width/t.croppedWidth;return{isEquirectangular:!0,fullWidth:i*t.fullWidth,fullHeight:i*t.fullHeight,croppedWidth:i*t.croppedWidth,croppedHeight:i*t.croppedHeight,croppedX:i*t.croppedX,croppedY:i*t.croppedY}}}),!1,!1).then((e=>{this.renderer.setOverlay(e,t)})):Promise.reject(new ne("Current adapter does not supports overlay")):(i&&this.renderer.setOverlay(null,0),Promise.resolve())}setOptions(e){const t={...this.config,...e};for(let[i,s]of Object.entries(e))if(i in Mi)if(i in Ti)le(Ti[i]);else switch(i in Oi&&(s=Oi[i](s,{rawConfig:t,defValue:Mi[i]})),this.config[i]=s,i){case"mousemove":this.state.cursorOverride||this.setCursor(null);break;case"caption":this.navbar.setCaption(this.config.caption);break;case"size":this.resize(this.config.size);break;case"sphereCorrection":this.renderer.setSphereCorrection(this.config.sphereCorrection);break;case"navbar":case"lang":this.navbar.setButtons(this.config.navbar);break;case"moveSpeed":case"zoomSpeed":this.dynamics.updateSpeeds();break;case"minFov":case"maxFov":this.dynamics.zoom.setValue(this.dataHelper.fovToZoomLevel(this.state.vFov)),this.dispatchEvent(new Ut(this.getZoomLevel()));break;case"keyboard":"always"===this.config.keyboard?this.startKeyboardControl():this.stopKeyboardControl()}else le(`Unknown option ${i}`);this.needsUpdate(),this.dispatchEvent(new qe(Object.keys(e)))}setOption(e,t){this.setOptions({[e]:t})}showError(e){this.overlay.show({id:x.ERROR,image:'\n',title:e,dissmisable:!1})}hideError(){this.overlay.hide(x.ERROR)}rotate(e){const t=new $e(this.dataHelper.cleanPosition(e));this.dispatchEvent(t),t.defaultPrevented||this.dynamics.position.setValue(t.position)}zoom(e){this.dynamics.zoom.setValue(e)}zoomIn(e=1){this.dynamics.zoom.step(e)}zoomOut(e=1){this.dynamics.zoom.step(-e)}animate(e){const t=de(e),i=!ee(e.zoom),s=new We(t?this.dataHelper.cleanPosition(e):void 0,e.zoom);if(this.dispatchEvent(s),s.defaultPrevented)return;this.stopAll();const{duration:o,properties:n}=this.dataHelper.getAnimationProperties(e.speed,s.position,s.zoomLevel);return o?(this.state.animation=new ke({properties:n,duration:o,easing:"inOutSine",onTick:e=>{t&&this.dynamics.position.setValue({yaw:e.yaw,pitch:e.pitch}),i&&this.dynamics.zoom.setValue(e.zoom)}}),this.state.animation.then((()=>{this.state.animation=null,this.resetIdleTimer()})),this.state.animation):(t&&this.rotate(s.position),i&&this.zoom(s.zoomLevel),new ke(null))}stopAnimation(){return this.state.animation?(this.state.animation.cancel(),this.state.animation):Promise.resolve()}resize(e){const t=e;["width","height"].forEach((i=>{e&&t[i]&&(/^[0-9.]+$/.test(t[i])&&(t[i]+="px"),this.parent.style[i]=t[i])})),this.autoSize()}enterFullscreen(){this.isFullscreenEnabled()||$(this.parent)}exitFullscreen(){this.isFullscreenEnabled()&&Z()}toggleFullscreen(){this.isFullscreenEnabled()?this.exitFullscreen():this.enterFullscreen()}startKeyboardControl(){this.state.keyboardEnabled=!0}stopKeyboardControl(){this.state.keyboardEnabled=!1}createTooltip(e){return new Ui(this,e)}setCursor(e){this.state.cursorOverride=e,this.container.style.cursor=e||(this.config.mousemove?"move":"default")}observeObjects(e){this.state.objectsObservers[e]||(this.state.objectsObservers[e]=null)}unobserveObjects(e){delete this.state.objectsObservers[e]}stopAll(){return this.dispatchEvent(new At),this.disableIdleTimer(),this.stopAnimation()}};c.Cache.enabled=!1,c.ColorManagement.enabled=!1;var hs="5.5.0";((e,t,r,a)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let h of o(t))n.call(e,h)||h===r||i(e,h,{get:()=>t[h],enumerable:!(a=s(t,h))||a.enumerable})})(i(e,"__esModule",{value:!0}),h)}));