PageSourceSearch

https://mapjack.com/index_min.js

js mapjack.com collected 2026-10-02 10:39:37 UTC 59,141 bytes, 21 lines download raw bytes

1class EventDispatcher{constructor(){this._listeners=new Map}addEventListener(t,e){this._listeners.has(t)||this._listeners.set(t,[]),this._listeners.get(t).push(e)}removeEventListener(t,e){var i;this._listeners.has(t)&&(i=this._listeners.get(t),this._listeners.set(t,i.filter(t=>t!==e)))}dispatchEvent(t,...e){this._listeners.has(t)&&this._listeners.get(t).forEach(t=>t(...e))}}class Timer extends EventDispatcher{constructor(t){super(),this.time=t,this._interval=null}start(){this._interval=setInterval(function(){this.dispatchEvent("TIMER")}.bind(this),this.time)}stop(){clearInterval(this._interval),this._interval=null}get running(){return null!==this._interval}}class PanoButton{constructor({viewer:t,url:e,urls:i,index:s,disabled:a,click:o,mousedown:n,mouseup:h}){this.viewer=t,this.click=o,this.mousedown=n,this.mouseup=h,this.images=[];for(var r of i??[e]){var l=document.createElement("img");l.src=r,this.images.push(l)}this.image=document.createElement("img"),this.image.className="panoButton",this._index=0,this.imageIndex=s??0,t._canvasWrapper.appendChild(this.image),this._disabled=!!a,this._isDown=!1,this.image.addEventListener("click",t=>{this.viewer._canvas.focus(),this.click&&!this._disabled&&this.click(t)}),this.image.addEventListener("mousedown",t=>{this.viewer._canvas.focus(),this._isDown=!0,this.mousedown&&!this._disabled&&this.mousedown(t)}),this.image.addEventListener("mouseup",t=>{this._isDown=!1,this.mouseup&&!this._disabled&&this.mouseup(t)}),this.image.addEventListener("mouseout",t=>{this._isDown&&(this._isDown=!1,this.mouseup)&&!this._disabled&&this.mouseup(t)})}set imageIndex(t){this._index=t,this.image.src=this.images[this._index].src}get imageIndex(){return this._index}set visible(t){this.image.style.display=t?"block":"none"}set x(t){this.image.style.left=t/this.viewer._scale+"px"}set y(t){this.image.style.top=t/this.viewer._scale+"px"}set disabled(t){this._disabled=t,this.image.classList.toggle("disabled",t)}}class TextOverlay{constructor({viewer:t,disabled:e,click:i}){this.viewer=t,this.click=i,this.elem=document.createElement("div"),this.elem.className="panoTextOverlay",t._canvasWrapper.appendChild(this.elem),this._disabled=!!e,this.elem.addEventListener("click",t=>{this.click&&!this._disabled&&this.click(t)})}set visible(t){this.elem.style.display=t?"block":"none"}set x(t){this.elem.style.left=t/this.viewer._scale+"px"}set x2(t){this.elem.style.right=t/this.viewer._scale+"px"}set y(t){this.elem.style.top=t/this.viewer._scale+"px"}set text(t){this.elem.innerText=t}set transparent(t){this.elem.classList.toggle("transparent",t)}set selectable(t){this.elem.classList.toggle("selectable",t)}set disabled(t){this._disabled=t,this.elem.classList.toggle("disabled",t)}set multiLine(t){this.elem.classList.toggle("multiline",t)}set center(t){this.elem.classList.toggle("center",t)}set textWidth(t){this.elem.style.width=t+"px"}}let ENCODE_CHARS="ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz23456789";function getTextureName(t,e,i,s){return String(t).padStart(12,"0")+"_"+(e+1)+String(i+1).padStart(2,"0")+String(s+1).padStart(2,"0")}function getTextureNameSuffix(t,e){return String(t).padStart(12,"0")+"_"+e}function getTextureSuffix(t,e,i){return t+1+String(e+1).padStart(2,"0")+String(i+1).padStart(2,"0")}function cylindricalToRectilinear(t,e,i){let s=t/i,a=-e/i+Math.PI/2;return a<0&&(a=-a,s+=Math.PI),a>Math.PI&&(a=Math.PI-(a-Math.PI),s+=Math.PI),{x:i*Math.tan(s),y:i/(Math.tan(a)*Math.cos(s))}}function rectilinearToCylindrical(t,e,i){return{x:i*Math.atan2(t,i),y:i*Math.atan2(e,Math.sqrt(i*i+t*t))}}function normalize360(t){for(;t<0;)t+=360;for(;360<t;)t-=360;return t}function normalizeBP180(t){for(;180<t;)t-=360;for(;t<=-180;)t=360+t;return t}function normalize180(t){for(;180<t;)t-=360;for(;t<=-180;)t=360+t;return Math.abs(t)}function calcHeading(t,e,i,s){let a=calcLatLonDistance(t,e,i,e),o=(i<t&&(a=-a),calcLatLonDistance(t,e,t,s));return s<e&&(o=-o),normalize360(180*Math.atan2(o,a)/Math.PI)}function calcLatLonDistance(t,e,i,s){return t===i&&e===s?0:(t=t*Math.PI/180,e=e*Math.PI/180,i=i*Math.PI/180,s=s*Math.PI/180,6371e3*Math.acos(Math.sin(t)*Math.sin(i)+Math.cos(t)*Math.cos(i)*Math.cos(s-e)))}
1function encodePosition(t,e,i){t=Math.floor(Math.round(1e6*(180+t))),e=Math.floor(Math.round(1e6*(180+e))),i=Math.round(i);return encodeInt(t,5)+encodeInt(e,5)+encodeInt(i,2)}function encodePositionZoom(t,e,i,s,a){t=Math.floor(Math.round(1e6*(180+t))),e=Math.floor(Math.round(1e6*(180+e))),i=Math.floor(Math.round(i)),s=Math.floor(Math.round(s+180)),a=Math.floor(Math.round(a));return encodeInt(t,5)+encodeInt(e,5)+encodeInt(i,2)+encodeInt(s,2)+encodeInt(a,2)}function encodeInt(e,i){let s="";for(let t=0;t<i;t++)s+=ENCODE_CHARS[e%ENCODE_CHARS.length],e=Math.floor(e/ENCODE_CHARS.length);return s}function decodePosition(t){var e,i;return 10!==t.length&&12!==t.length&&16!==t.length?null:(e={lat:0,lon:0,heading:0,zoom:0},i=decodeInt(t.substring(0,5)),e.lat=i/1e6-180,i=decodeInt(t.substring(5,10)),e.lon=i/1e6-180,t.length<12||(e.heading=decodeInt(t.substring(10,12)),t.length<16)||(e.tilt=decodeInt(t.substring(12,14))-180,e.zoom=decodeInt(t.substring(14,16))),e)}function decodeInt(e){let i=0;for(let t=e.length-1;0<=t;t--){var s=ENCODE_CHARS.indexOf(e[t]);if(s<0||s>=ENCODE_CHARS.length)return 0;i=i*ENCODE_CHARS.length+s}return i}function equalObjects(t,e){if(t!==e){if("object"!=typeof t||"object"!=typeof e||null===t||null===e)return!1;var i,s=Object.keys(t),a=Object.keys(e);if(s.length!==a.length)return!1;for(i of s)if(!a.includes(i)||t[i]!==e[i])return!1}return!0}function isDef(t){return void 0!==t}function isN(t){return Number.isFinite(t)}function readCookie(e){let i="";e+="=";if(0<document.cookie.length){var s=document.cookie.indexOf(e);if(-1!=s){s+=e.length;let t=document.cookie.indexOf(";",s);-1==t&&(t=document.cookie.length),i=decodeURIComponent(document.cookie.substring(s,t))}}return i}function writeCookie(t,e,i=31536e3,s="/"){null!=e&&null!=t&&(document.cookie=t+"="+encodeURIComponent(e)+"; max-age="+i+"; path="+s)}function minMax(t,e,i){return t<e?e:i<t?i:t}let EMULATE_NETWORK_DELAY=0,MIN_PANORAMA_INDEX=0,MAX_PANORAMA_INDEX=109999999999,MONTH_STRINGS=["January","February","March","April","May","June","July","August","September","October","November","December"],MIN_ZOOM_DEG=170,MAX_ZOOM_DEG=20,ZOOM_LOG=2,MIN_PROJECTION=1,MAX_PROJECTION=5,PROJECTION_LOG=.3,TOTAL_WIDTH_DEG=360,AIMED_QUAD_WIDTH_PIX=30,AIMED_QUAD_HEIGHT_PIX=30,MIN_QUAD_COLUMN_COUNT=8,MIN_QUAD_ROW_COUNT=4,LEVEL_COLUMNS=[2,2,2,4,8],LEVEL_ROWS=[1,1,1,2,4],LEVEL_WIDTHS=[250,500,1e3,1e3,1e3],LEVEL_HEIGHTS=[88,175,350,350,350],INFO_MODE_ADDRESS=0,INFO_MODE_DATA=1,INFO_MODE_DEBUG=2;class PanoramaViewer extends EventDispatcher{constructor(t,e){super(),this._canvasWrapper=t,this.serverAddress=e,this._canvas=document.createElement("canvas"),this._canvasWrapper.appendChild(this._canvas),this._canvas.setAttribute("tabindex","0"),this._canvas.style.outline="none",this._scale=2,this.loadingObjects=new Map,this._drawPanoramaIndex=-1,this._textureCache=new Map,this._activeTextures=[],this._emptyTexture=new PanoramaTexture(this),this._emptyTexture.load("blank","data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAAAAAAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQgJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAAIAAoDASIAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAb/xAAUEAEAAAAAAAAAAAAAAAAAAAAA/8QAFQABAQAAAAAAAAAAAAAAAAAAAAb/xAAUEAEAAAAAAAAAAAAAAAAAAAAA/8QAFBEBAAAAAAAAAAAAAAAAAAAAAP/aAAwDAQACEQMRAD8AANoAAAAAAAAA/9k="),this._navigationDots=[];for(let t=0;t<MAX_BLUE_DOT_COUNT;t++){var i=this.addOverlayImg("images/dot.png","panoNavDot");i.addEventListener("click",this.blueDotMouseUp.bind(this)),this._navigationDots.push(i)}this._navigationArrow=this.addOverlayImg("images/dot_arrow.png","panoNavArrow"),this._compassElems=[];for(var s of["compass_n.png","compass_e.png","compass_s.png","compass_w.png"])this._compassElems.push(this.addOverlayImg("images/"+s,"panoCompassImg"));this._addressText=new TextOverlay({viewer:this}),this._copyrightText=new TextOverlay({viewer:this}),this._centerText=new TextOverlay({viewer:this}),this._toolsButton=new PanoButton({viewer:this,url:"images/button_tools.png",click:this.toolsClick.bind(this)}),this._projectionButton=new PanoButton({viewer:this,urls:["images/button_cyl.png","images/button_rect.png"],click:this.projectionClick.bind(this)}),this._dotsButton=new PanoButton({viewer:this,urls:["images/button_dots_on.png","images/button_dots_off.png"],click:this.dotsClick.bind(this)}),this._zoomInButton=new PanoButton({viewer:this,url:"images/button_zoom_in.png",mousedown:this.zoomInMouseDown.bind(this),mouseup:this.zoomInMouseUp.bind(this)}),this._zoomOutButton=new PanoButton({viewer:this,url:"images/button_zoom_out.png",mousedown:this.zoomOutMouseDown.bind(this),mouseup:this.zoomOutMouseUp.bind(this)}),this._forwardButton=new PanoButton({viewer:this,url:"images/button_forward.png",click:this.forwardClick.bind(this)}),this._backButton=new PanoButton({viewer:this,url:"images/button_back.png",click:this.backClick.bind(this)}),this._linkHereButton=new PanoButton({viewer:this,url:"images/button_location.png",click:this.linkHereClick.bind(this)}),this._dotMessage=null,this._addressTextMode=INFO_MODE_ADDRESS,this._stageWidth=1,this._stageHeight=1,this._stageCenterX=0,this._stageCenterY=0,this._mapSites=new MapSiteController(this),this._setAfterNavigate=null,this._defaultHeadingAfterNavigate=!0,this._downMouseAngle=null,this._projectionChangeTimer=null,this._transitionTimer=new Timer(25),this._transTurn=0,this._aimedTransTurn=0,this._transTilt=0,this._aimedTransTilt=0,this._transZoom=0,this._aimedTransZoom=0,this._fastMode=!1,this._drawCount=0,this._timerCheckDrawCount=0,this._loadingTimer=new Timer(300),this._oneTextureLoaded=!0,this._dotInfo=null,this._nearbyDots=null,this._textureLevel=0,this._projection=0,this._projectionFactor=1,this._drawQuality=50,this._sharpness=50,this._zoom=0,this._zoomFactor=1,this._showGrid=!1,this._showDots=!0,this._showAids=!0,this._forwardDot=null,this._dotHistory=[],this._xDeg=90,this._xPix=0,this._yDeg=-6,this._yPix=0,this._pixPerDeg=0,this._widthDeg=170,this._widthPix=0,this._widthAdjustedDeg=0,this._heightDeg=0,this._heightPix=0,this._totalWidthPix=0,this._totalHeightDeg=0,this._totalHeightPix=0,this._projectionDistance=0,this._yCenterFraction=0,this._yCenterDeg=0,this._yCenterPix=0,this._oldSendStatus={}}addOverlayImg(t,e){var i=document.createElement("img");return i.className=e,i.style.display="none",i.src=t,this._canvasWrapper.appendChild(i),i}init(){this.initWebGL(),this._copyrightText.text=" © 2025 MapJack ",this._copyrightText.visible=!0,this._addressText.visible=!1,this._addressText.selectable=!0,this._centerText.visible=!1,this._toolsButton.visible=!1,this._projectionButton.visible=!1,this._dotsButton.visible=!1,this._zoomInButton.visible=!1,this._zoomOutButton.visible=!1,this._forwardButton.visible=!1,this._backButton.visible=!1,this._linkHereButton.visible=!1,window.addEventListener("resize",this.resizeDisplayHandler.bind(this)),document.addEventListener("keydown",this.keyDownUpHandler.bind(this)),document.addEventListener("keyup",this.keyDownUpHandler.bind(this)),this._canvas.addEventListener("mousedown",this.mouseDownHandler.bind(this)),this._canvas.addEventListener("mouseup",this.mouseUpHandler.bind(this)),this._canvas.addEventListener("mousemove",this.mouseMoveHandler.bind(this)),this._canvas.addEventListener("mouseout",this.mouseOutHandler.bind(this)),this._canvas.addEventListener("wheel",this.mouseWheelHandler.bind(this)),this._mapSites.addEventListener("DOTS_FOUND",this.siteAreaLoaded.bind(this)),this._transitionTimer.addEventListener("TIMER",this.transitionTimerHandler.bind(this)),this._transitionTimer.start(),new ResizeObserver(t=>{this.draw({updateLayout:!0})}).observe(this._canvasWrapper)}initWebGL(){if(this.gl=this._canvas.getContext("webgl2")||this._canvas.getContext("webgl"),!this.gl)throw new Error("WebGL not supported");
1this.isWebGL2=this.gl instanceof WebGL2RenderingContext;let i=this.gl;function t(t,e){t=i.createShader(t);if(i.shaderSource(t,e),i.compileShader(t),i.getShaderParameter(t,i.COMPILE_STATUS))return t;throw new Error("Shader compile failed: "+i.getShaderInfoLog(t))}var e=t(i.VERTEX_SHADER,`
2            attribute vec2 a_position;
3            attribute vec2 a_texCoord;
4            varying vec2 v_texCoord;
5            void main() {
6                gl_Position = vec4(a_position, 0.0, 1.0);
7                v_texCoord = a_texCoord;
8            }
9        `),s=t(i.FRAGMENT_SHADER,`
10            precision mediump float;
11            varying vec2 v_texCoord;
12            uniform sampler2D u_texture;
13            void main() {
14                gl_FragColor = texture2D(u_texture, v_texCoord);
15            }
16        `);if(this.program=i.createProgram(),i.attachShader(this.program,e),i.attachShader(this.program,s),i.linkProgram(this.program),!i.getProgramParameter(this.program,i.LINK_STATUS))throw new Error("Program link failed: "+i.getProgramInfoLog(this.program));this.uTextureLoc=i.getUniformLocation(this.program,"u_texture"),i.clearColor(0,0,0,1),i.disable(i.DEPTH_TEST),i.enable(i.BLEND),i.blendFunc(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA)}get viewAngle(){return this._widthAdjustedDeg}get showDots(){return this._showDots}set showDots(t){this._showDots=t,this.draw()}get showAids(){return this._showAids}set showAids(t){this._showAids=t,this.draw({updateLayout:!0})}get zoom(){return this._zoom}set zoom(t){this._zoom=t=100<(t=t<0?0:t)?100:t,this._zoomFactor=1-Math.pow(this._zoom,1/ZOOM_LOG)/Math.pow(100,1/ZOOM_LOG)}get sharpness(){return this._sharpness}set sharpness(t){100<(t=t<0?0:t)&&(t=100),this._sharpness=25*Math.round(t/25),this.draw()}get drawQuality(){return this._drawQuality}set drawQuality(t){this._drawQuality=t=100<(t=t<0?0:t)?100:t,this.draw()}get projection(){return this._projection}set projection(t){this._projection=t=100<(t=t<0?0:t)?100:t;t=Math.pow(t,1/PROJECTION_LOG)/Math.pow(100,1/PROJECTION_LOG);this._projectionFactor=MIN_PROJECTION+(MAX_PROJECTION-MIN_PROJECTION)*t,this.draw()}get latLon(){return this._dotInfo?{lat:this._dotInfo.lat,lon:this._dotInfo.lon}:null}get heading(){return null==this._dotInfo?0:normalize360(this._dotInfo.heading+this._xDeg-90)}set heading(t){null!=this._dotInfo&&(this._xDeg=normalize360(t-this._dotInfo.heading+90))}get tilt(){return this._yDeg}set tilt(t){this._yDeg=t}resizeDisplayHandler(t){this.draw({updateLayout:!0})}loadingTimerHandler(t){}transitionTimerHandler(t){var e;Math.abs(this._transTurn)<.1&&Math.abs(this._transTilt)<.1&&Math.abs(this._transZoom)<.1&&Math.abs(this._aimedTransTurn)<.1&&Math.abs(this._aimedTransTilt)<.1&&Math.abs(this._aimedTransZoom)<.1||(.1<=Math.abs(this._transTurn)&&(this._xDeg=normalize360(this._xDeg+this._transTurn)),.1<=Math.abs(this._transTilt)&&(this._yDeg+=this._transTilt),.1<=Math.abs(this._transZoom)&&(this.zoom+=this._transZoom,0!==this.zoom&&100!==this.zoom||(this._transZoom=0,this._aimedTransZoom=0)),e=this._fastMode?3:1,this._transTurn=(3*this._transTurn+this._aimedTransTurn*e)/4,this._transTilt=(3*this._transTilt+this._aimedTransTilt*e)/4,this._transZoom=(3*this._transZoom+this._aimedTransZoom*e)/4,this.draw())}focus(){this._canvas.focus()}mouseDownHandler(t){t.target===this._canvas&&(t=this.mouseEventCanvasPos(t),this._downMouseAngle=this.pixToDeg(t.x,t.y))}mouseEventCanvasPos(t){var e=t.target.getBoundingClientRect();return{x:(t.clientX-e.left)*this._scale,y:(t.clientY-e.top)*this._scale}}mouseUpHandler(t){this._downMouseAngle=null}mouseOutHandler(t){t.target===this._canvas&&(this._downMouseAngle=null)}mouseMoveHandler(t){this._downMouseAngle&&(t=this.mouseEventCanvasPos(t),this.adjustToDegOffset(t.x,t.y,this._downMouseAngle.x,this._downMouseAngle.y),this.draw())}mouseWheelHandler(t){var e=this.mouseEventCanvasPos(t),i=this.pixToDeg(e.x,e.y);this.zoom-=.1*t.deltaY,this.draw({skipDraw:!0}),this.adjustToDegOffset(e.x,e.y,i.x,i.y),this.draw()}toolsClick(){this._showAids=!this._showAids,this.draw({updateLayout:!0})}projectionClick(){clearTimeout(this._projectionChangeTimer),0===this._projectionButton.imageIndex?(this.projectionChange(5),this._projectionButton.imageIndex=1):(this.projectionChange(-5),this._projectionButton.imageIndex=0)}projectionChange(t){this.projection+=t,(0<t&&this.projection<100||t<0&&
160<this.projection)&&(this._projectionChangeTimer=setTimeout(this.projectionChange.bind(this,t),50))}dotsClick(){0===this._dotsButton.imageIndex?(this.showDots=!1,this._dotsButton.imageIndex=1):(this.showDots=!0,this._dotsButton.imageIndex=0)}zoomInMouseDown(t){this._aimedTransZoom=2}zoomInMouseUp(t){this._aimedTransZoom=0}zoomOutMouseDown(t){this._aimedTransZoom=-2}zoomOutMouseUp(t){this._aimedTransZoom=0}forwardClick(t){this.moveForward()}backClick(t){this.moveBack()}linkHereClick(t){let e=2;t.ctrlKey&&t.shiftKey&&(e=3),this._addressTextMode=(this._addressTextMode+1)%e,this.draw({updateLayout:!0})}keyDownUpHandler(e){if(null!=this._dotInfo&&this._canvasWrapper.contains(document.activeElement)){var i,s=e.code;let t=0;"keydown"===e.type&&(t=1,"KeyF"==s||"ArrowUp"==s&&0==this.zoom?this.moveForward():"KeyB"==s||"ArrowDown"==s&&0==this.zoom?this.moveBack():"KeyT"==s||"End"==s?(this.heading+=180,this.draw()):"Space"!=s&&"Home"!=s&&"Escape"!=s||(this._yDeg=-6,this.zoom=0,i=normalize180(this.heading-this._dotInfo.headingIdeal),this.heading=i<90?this._dotInfo.headingIdeal:this._dotInfo.headingIdeal+180,this._transTurn=0,this._aimedTransTurn=0,this._transTilt=0,this._aimedTransTilt=0,this._transZoom=0,this._aimedTransZoom=0,this.draw())),"KeyR"==s||"ArrowRight"==s?this._aimedTransTurn=t*this.viewAngle/30:"KeyL"==s||"ArrowLeft"==s?this._aimedTransTurn=-t*this.viewAngle/30:"KeyZ"==s||"NumpadAdd"==s||"Equal"==s||"Insert"==s?this._aimedTransZoom=2*t:"KeyX"==s||"NumpadSubtract"==s||"Minus"==s||"Delete"==s?this._aimedTransZoom=2*-t:"KeyU"==s||"PageUp"==s||"ArrowUp"==s&&0<this.zoom?this._aimedTransTilt=-t*this._heightDeg/20:"KeyD"==s||"PageDown"==s||"ArrowDown"==s&&0<this.zoom?this._aimedTransTilt=t*this._heightDeg/20:"ShiftLeft"!=s&&"ShiftRight"!=s||(i="keydown"===e.type)!=this._fastMode&&(this._fastMode=i,this.draw())}}moveForward(){null!=this._forwardDot&&this.navigateTo(this._forwardDot.lat,this._forwardDot.lon)}moveBack(){var t;1<this._dotHistory.length&&(this._dotHistory.pop(),t=this._dotHistory.pop()+"",this.zoom=0,this.navigateToEncoded(t))}draw({updateLayout:l,skipDraw:d}={}){if(null!=this._dotInfo){this._drawCount++;var _=Math.round(this._canvas.clientWidth*this._scale),g=Math.round(this._canvas.clientHeight*this._scale);this._canvas.width===_&&this._canvas.height===g||(this._canvas.width=_,this._canvas.height=g,this.gl.viewport(0,0,this.gl.canvas.width,this.gl.canvas.height)),this._stageWidth=this._canvas.width,this._stageHeight=this._canvas.height,this._totalHeightDeg=this.getTotalHeightDeg(this._dotInfo.index),this._yCenterFraction=this.getYCenterFraction(this._dotInfo.index),this._widthDeg=MAX_ZOOM_DEG+(MIN_ZOOM_DEG-MAX_ZOOM_DEG)*this._zoomFactor,this._widthPix=this._stageWidth,this._heightPix=this._stageHeight,this._stageCenterX=this._stageWidth/2,this._stageCenterY=this._stageHeight/2,this._yCenterDeg=this._totalHeightDeg*this._yCenterFraction;for(let t=0;t<2;t++){this._projectionDistance=.7*this._projectionFactor*this._widthPix*90/this._widthDeg,this._heightDeg=this._widthDeg/(this._widthPix/this._heightPix),this._pixPerDeg=this._widthPix/this._widthDeg,this._totalWidthPix=TOTAL_WIDTH_DEG*this._pixPerDeg,this._totalHeightPix=this._totalHeightDeg*this._pixPerDeg,this._yCenterPix=this._totalHeightPix*this._yCenterFraction,this._xPix=this._xDeg*this._pixPerDeg,this._yPix=this._yDeg*this._pixPerDeg;var e=cylindricalToRectilinear(0,-this._yCenterPix,this._projectionDistance),i=e.y/this._pixPerDeg+this._heightDeg/2,s=cylindricalToRectilinear(0,this._totalHeightPix-this._yCenterPix,this._projectionDistance),a=s.y/this._pixPerDeg-this._heightDeg/2;if(!(a<i&&0==t)){this._yDeg<i?this._yDeg=i:this._yDeg>a&&(this._yDeg=a),this._yPix=this._yDeg*this._pixPerDeg;break}this._widthDeg=this._widthDeg*(s.y-e.y)/this._stageHeight}var _=this._heightPix,g=this.pixToDeg(0,this._stageCenterY),u=this.pixToDeg(this._stageWidth,this._stageCenterY);this._widthAdjustedDeg=normalize360(u.x-g.x),l&&(u=_-70,0,this._toolsButton.x=20,this._toolsButton.y=u,this._toolsButton.visible=160<this._heightPix,this._dotsButton.x=90,this._dotsButton.y=u,this._dotsButton.visible=this._showAids&&160<this._heightPix,this._projectionButton.x=160,this._projectionButton.y=u,this._projectionButton.visible=this._showAids&&160<this._heightPix,this._zoomOutButton.x=230,this._zoomOutButton.y=u,this._zoomOutButton.visible=this._showAids&&160<this._heightPix,this._zoomInButton.x=300,this._zoomInButton.y=u,this._zoomInButton.visible=this._showAids&&160<this._heightPix,this._backButton.x=20,this._backButton.y=u-70,this._backButton.visible=this._showAids&&230<this._heightPix,this._forwardButton.x=20,this._forwardButton.y=u-140,this._forwardButton.visible=this._showAids&&300<this._heightPix,this._linkHereButton.x=20,this._linkHereButton.y=18,this._linkHereButton.visible=this._showAids,this._addressText.x=85,this._addressText.y=24,this._addressText.visible=this._showAids,this._copyrightText.x2=20,this._copyrightText.y=_-70,this._dotMessage?(this._centerText.text=this._dotMessage,this._centerText.center=!0,this._centerText.visible=!0):this._centerText.visible=!1);for(let t=0;t<4;t++){var o=90*t,n=this._compassElems[t];this._showAids&&Math.abs(normalizeBP180(this.heading-o))<90?(o=normalize360(o-this._dotInfo.heading+90),o=this.degToPix(o,0),n.style.left=o.x/this._scale-n.clientWidth/2+"px",n.style.display="block"):n.style.display="none"}let t="";if(this._addressTextMode===INFO_MODE_ADDRESS?this._dotInfo.type===DOTTYPE_VIRTUAL?this._addressText.text="Unknown address":(t=this._dotInfo.rightStNumber+" "+this._dotInfo.rightAddress,(t=(t=0<normalizeBP180(this.heading-this._dotInfo.heading)?this._dotInfo.leftStNumber+" "+this._dotInfo.leftAddress:t).trim())?t+=" (approx)":t="Unknown address",this._addressText.text=t):this._addressTextMode===INFO_MODE_DATA?this._addressText.text="Lat: "+Math.round(1e6*this._dotInfo.lat)/1e6+". Lon: "+Math.round(1e6*this._dotInfo.lon)/1e6+". Hdg: "+Math.round(this.heading)+" deg. Alt: "+Math.round(this._dotInfo.altitude)+" m. Date: "+MONTH_STRINGS[this._dotInfo.date.getMonth()]+" "+this._dotInfo.date.getDate()+", "+this._dotInfo.date.getFullYear()+".":this._addressTextMode===INFO_MODE_DEBUG&&(this._addressText.text="Index: "+this._dotInfo.index+". ZoomLevels: "+this._dotInfo.zoom+". Date: "+this._dotInfo.date.toUTCString()+"."),this.setButtonStatus(this._zoomOutButton,0<this.zoom),this.setButtonStatus(this._zoomInButton,this.zoom<100),this.setButtonStatus(this._backButton,1<this._dotHistory.length),this.setButtonStatus(this._forwardButton,null!=this._forwardDot),d)this.showDotOverlay(this._showDots&&this._oneTextureLoaded);else{this._drawPanoramaIndex=this._dotInfo.index,this._activeTextures=[],this._textureLevel=this.calcLevel(this._totalWidthPix)+Math.floor(this._sharpness/25)-2,this._textureLevel=minMax(this._textureLevel,1,this._dotInfo.zoom
16-1);let t=this.calcLevel(this._totalWidthPix);(t+=Math.floor(this._sharpness/25)-2)<1?t=1:4<t&&(t=4);var g=this._dotInfo.zoom-1,l=(t>g&&(t=g),.5+(100-this._drawQuality)*(100-this._drawQuality)/5e3),c=(l*=1+this._projectionFactor/2-.5,AIMED_QUAD_WIDTH_PIX*l*this._widthDeg/this._widthPix),p=AIMED_QUAD_HEIGHT_PIX*l*this._heightDeg/this._heightPix;let e=MIN_QUAD_COLUMN_COUNT*Math.floor(Math.round(TOTAL_WIDTH_DEG/Number(MIN_QUAD_COLUMN_COUNT)/c)),i=MIN_QUAD_ROW_COUNT*Math.floor(Math.round(this._totalHeightDeg/Number(MIN_QUAD_ROW_COUNT)/p));e<MIN_QUAD_COLUMN_COUNT&&(e=MIN_QUAD_COLUMN_COUNT),i<MIN_QUAD_ROW_COUNT&&(i=MIN_QUAD_ROW_COUNT);var c=TOTAL_WIDTH_DEG/e,p=this._totalHeightDeg/i,u=normalize360(this._xDeg-this._widthDeg/2),m=Math.floor(u/c),v=2+Math.floor(this._widthDeg/c),_=this.pixToDeg(this._stageCenterX,0),g=this.pixToDeg(this._stageCenterX,this._stageHeight),l=this.pixToDeg(0,0),u=this.pixToDeg(0,this._stageHeight);let s=_.y,a=(s>l.y&&(s=l.y),g.y);a<u.y&&(a=u.y);_=s+this._yCenterDeg;let o=Math.floor(_/p),n=(o<0&&(o=0),Math.floor((a+this._yCenterDeg)/p)-o+1),h=(o+n>i&&(n=i-o),null),r=null;for(let t=0;t<n;t++){var A=o+t;if(null!=r)h=r;else{h=new Array;for(let t=0;t<=v;t++){var f=(m+t)%e;h.push(this.degToPix(f*c,A*p-this._yCenterDeg))}}r=new Array;for(let t=0;t<=v;t++){var I=(m+t)%e;r.push(this.degToPix(I*c,(A+1)*p-this._yCenterDeg))}for(let t=0;t<v;t++){var x=(m+t)%e,T=h[t],E=h[t+1],D=r[t+1],y=r[t];T.x>this._widthPix&&E.x>this._widthPix||T.y>this._heightPix&&E.y>this._heightPix||D.x<0&&y.x<0||D.y<0&&y.y<0||T.x>E.x||y.x>D.x||T.y>y.y||E.y>D.y||this.drawTexture(e,i,x,A,T.x,T.y,E.x,E.y,D.x,D.y,y.x,y.y)}}this.graphicsCardRender(),d||this.showDotOverlay(this._showDots&&this._oneTextureLoaded);l={urlEncoded:encodePositionZoom(this._dotInfo.lat,this._dotInfo.lon,this.heading,this.tilt,this.zoom),dotType:this._dotInfo.type,showDots:this._showDots,index:this._dotInfo.index,lat:this._dotInfo.lat,lon:this._dotInfo.lon,heading:this.heading,viewAngle:this.viewAngle};equalObjects(l,this._oldSendStatus)||(this._oldSendStatus=l,this.dispatchEvent("STATUS_UPDATE",l))}}}drawTexture(t,e,i,s,a,o,n,h,r,l,d,_){let g=null,u=this._textureLevel;var c=Math.floor(i*LEVEL_COLUMNS[u]/t),p=Math.floor(s*LEVEL_ROWS[u]/e),m=getTextureName(this._drawPanoramaIndex,u,p,c);if((g=this._textureCache.get(m))||(g=new PanoramaTexture(this,m),this._textureCache.set(m,g),g.addEventListener("TEXTURE_UPDATE",()=>{this.draw()})),!g.image)for(u=LEVEL_COLUMNS.length-1;0<=u;u--){var c=Math.floor(i*LEVEL_COLUMNS[u]/t),p=Math.floor(s*LEVEL_ROWS[u]/e),v=getTextureName(this._drawPanoramaIndex,u,p,c),v=this._textureCache.get(v);if(v&&v.image){g=v;break}}g.image||(g=this._emptyTexture),this._activeTextures.includes(g)||(this._activeTextures.push(g),g.vertices=[],g.indices=[]);var m=Math.floor(t/LEVEL_COLUMNS[u]),A=Math.floor(e/LEVEL_ROWS[u]),f=i%m/m,m=f+1/m,I=s%A/A,A=I+1/A,x=g.vertices.length/16,T=g.vertices,E=2/this._canvas.width,D=2/this._canvas.height,a=(T.push(a*E-1),T.push(-o*D+1),T.push(f),T.push(I),T.push(n*E-1),T.push(-h*D+1),T.push(m),T.push(I),T.push(r*E-1),T.push(-l*D+1),T.push(m),T.push(A),T.push(d*E-1),T.push(-_*D+1),T.push(f),T.push(A),g.indices),o=4*x;a.push(0+o),a.push(1+o),a.push(2+o),a.push(0+o),a.push(2+o),a.push(3+o)}graphicsCardRender(){var t,e,i,s,a,o,n,h=this.gl;h.useProgram(this.program);for(t of this._activeTextures)0!==t.vertices.length&&t.image&&(t!==this._emptyTexture&&(this._textureCache.delete(t.name),this._textureCache.set(t.name,t)),t.tex||(e=h.createTexture(),h.bindTexture(h.TEXTURE_2D,e),h.texImage2D(h.TEXTURE_2D,0,h.RGBA,h.RGBA,h.UNSIGNED_BYTE,t.image),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,h.LINEAR),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,h.LINEAR),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE),t.tex=e),e=new Float32Array(t.vertices),i=h.createBuffer(),h.bindBuffer(h.ARRAY_BUFFER,i),h.bufferData(h.ARRAY_BUFFER,e,h.STATIC_DRAW),s=new Uint16Array(t.indices),a=h.createBuffer(),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,a),h.bufferData(h.ELEMENT_ARRAY_BUFFER,s,h.STATIC_DRAW),o=h.getAttribLocation(this.program,"a_position"),n=h.getAttribLocation(this.program,"a_texCoord"),h.enableVertexAttribArray(o),h.vertexAttribPointer(o,2,h.FLOAT,!1,16,0),h.enableVertexAttribArray(n),h.vertexAttribPointer(n,2,h.FLOAT,!1,16,8),h.activeTexture(h.TEXTURE0),h.bindTexture(h.TEXTURE_2D,t.tex),h.uniform1i(this.uTextureLoc,0),h.drawElements(h.TRIANGLES,s.length,h.UNSIGNED_SHORT,0),h.deleteBuffer(i),h.deleteBuffer(a));for(var r=Array.from(this._textureCache.keys());400<r.length;){var l=r.shift(),d=this._textureCache.get(l);d.tex&&this.gl.deleteTexture(d.tex),d.tex=null,d.image=null,this._textureCache.delete(l)}}calcLevel(e){for(let t=1;t<LEVEL_WIDTHS.length;t++)if(e<=LEVEL_COLUMNS[t]*LEVEL_WIDTHS[t])return t;return LEVEL_WIDTHS.length-1}getTotalHeightDeg(t){return 64.28}getYCenterFraction(t){return.6389}setButtonStatus(t,e){t.disabled=!e}pixToDeg(t,e){t=rectilinearToCylindrical(t-this._widthPix/2,e-(this._heightPix/2-this._yPix),this._projectionDistance);return t.y=t.y/this._pixPerDeg,t.x=normalize360((t.x+this._xPix)/this._pixPerDeg),t}degToPix(t,e){let i=normalize360(t)*this._pixPerDeg-this._xPix;t-this._xDeg>TOTAL_WIDTH_DEG/2&&(i-=+this._totalWidthPix),this._xDeg-t>TOTAL_WIDTH_DEG/2&&(i+=+this._totalWidthPix);t=e*this._pixPerDeg,e=cylindricalToRectilinear(i,t,this._projectionDistance);return e.x+=this._widthPix/2,e.y+=this._heightPix/2-this._yPix,e}adjustToDegOffset(e,i,s,a){let o=0,n=0,h=-this._totalHeightDeg*this._yCenterFraction,r=this._totalHeightDeg*(1-this._yCenterFraction);if(!(a<h||a>r)){for(let t=0;t<20&&(n=(h+r)/2,!(r-h<.1));t++){var l=n*this._pixPerDeg,l=rectilinearToCylindrical(e-this._widthPix/2,i-this._stageCenterY+l,this._projectionDistance),l=(o=s-l.x/this._pixPerDeg,l.y/this._pixPerDeg);a<l?r=n:h=n}this._xDeg=normalize360(o),this._yDeg=n}}navigateTo(t,e,i){this._dotMessage=null,this._defaultHeadingAfterNavigate=i=void 0===i||!!i,this._mapSites.findDots(t,e,LOAD_AREA_SIZE)}navigateToEncoded(t){this._setAfterNavigate=null,this._setAfterNavigate=decodePosition(t),null!=this._setAfterNavigate&&this.navigateTo(this._setAfterNavigate.lat,this._setAfterNavigate.lon,!0)}turnTo(t){this.heading=t,this.draw()}debugShowIndex(t){this._dotInfo=DotInfo.makeNew(DOTTYPE_PANO,t,0,0,0,0,0,null),this.draw({updateLayout:!0})}siteAreaLoaded(t){0!=this._mapSites.foundDots.length&&this._mapSites.foundDots[0].type==DOTTYPE_PANO||(this._dotMessage="There are no pictures in the selected area"),this.showDotOverlay(!1);var e=this._dotInfo,i=this.heading,i=(this._nearbyDots=this._mapSites.foundDots,this._dotInfo=this._nearbyDots.shift(),null!=this._setAfterNavigate?(Number.isFinite(this._setAfterNavigate.heading)&&(this.heading=this._setAfterNavigate.heading),Number.isFinite(this._setAfterNavigate.tilt)&&(this.tilt=this._setAfterNavigate.tilt),Number.isFinite(this._setAfterNavigate.zoom)&&(this.zoom=this._setAfterNavigate.zoom),this._setAfterNavigate=null):(this.heading=this.calcMovedHeading(e,i,this._dotInfo,!0,this._defaultHeadingAfterNavigate),calcLatLonDistance(e.lat,e.lon,this._dotInfo.lat,this._dotInfo.lon)>BIG_MOVE_DIST&&(this.zoom=0)),this._defaultHeadingAfterNavigate||(this.zoom=0),encodePosition(this._dotInfo.lat,this._dotInfo.lon,this.heading));0<this._dotHistory.length&&i==this._dotHistory[this._dotHistory.length-1]&&this._dotHistory.pop(),this._dotHistory.push(i),1e3<this._dotHistory.length&&this._dotHistory.shift(),this.draw({updateLayout:!0})}calcMovedHeading(i,t,s,e,a){if(null==i)return s.headingIdeal;var o=normalize180(i.headingIdeal-s.headingIdeal),n=calcLatLonDistance(i.lat,i.lon,s.lat,s.lon);if(!a||n>BIG_MOVE_DIST||o>BIG_MOVE_ANGLE&&o<180-BIG_MOVE_ANGLE){let t=calcHeading(i.lat,i.lon,s.lat,s.lon),e=(t=normalize180(t-s.headingIdeal),0);return a||(e=90),t=t<90?normalize360(s.headingIdeal+e):normalize360(s.headingIdeal+180+e)}return e?normalize360(o<90?t+s.headingIdeal-i.headingIdeal:t+s.headingIdeal-i.headingIdeal+180):normalize180(t-s.headingIdeal)<90?s.headingIdeal:normalize360(s.headingIdeal+180)}
16showDotOverlay(a){if(!a)for(var t of this._navigationDots){if("none"===t.style.display)break;t.style.display="none"}if(this._navigationArrow.style.display="none",null!=this._dotInfo&&null!=this._nearbyDots){let t=this._forwardDot=null,e=1e6,i=1e6,s=0;var o,n=[];for(o of this._nearbyDots)if(o.type==DOTTYPE_PANO){var h=o.vectorDist;if(!(h>SHOW_DOT_MAX_DISTANCE||h<4)){var r=normalize180(o.vectorAngle-this.heading);if(r<20){let t=h+r/5*7;(t=this._fastMode?SHOW_DOT_MAX_DISTANCE-h+r/5*7:t)<e&&(e=t,this._forwardDot=o),n.push(o)}r<90&&h<i&&(i=h,t=o)}}if(null===this._forwardDot&&(this._forwardDot=t),null!==this._forwardDot&&(s=this.calcMovedHeading(this._dotInfo,this.heading,this._forwardDot,!1,!0)),this.preloadTextures(),a){let e=0;for(let t=0;t<this._nearbyDots.length;t++){var l=this._nearbyDots[t],d=l.vectorDist;if(l.type!=DOTTYPE_POI&&!(l.type!=DOTTYPE_POI&&d>SHOW_DOT_MAX_DISTANCE)){var _=normalize360(l.vectorAngle-this._dotInfo.heading+90);if(!(normalize180(_-this._xDeg)>this._widthDeg/2+10)){let t=180*Math.atan(CAMERA_ELEVATION/d)/Math.PI;l.type==DOTTYPE_POI&&(t=0);var g=this.degToPix(_,t);if(!(g.x<-100||g.x>this._stageWidth+100||g.y<-100||g.y>this._stageHeight+100)){var u=this._navigationDots[e],d=180*Math.atan(DOT_RADIUS/d)/Math.PI,_=2*(this.degToPix(normalize360(_+d),t).x-g.x)/95/this._scale,d=_/4,c=100*_,p=100*d;if(u.dotInfo=l,u.style.top=g.y/this._scale-.5*p+"px",u.style.left=g.x/this._scale-.5*c+"px",u.style.width=c+"px",u.style.height=p+"px",u.style.display="block",l===this._forwardDot&&(c=normalize360(s-l.vectorAngle),this._navigationArrow.style.top=g.y/this._scale+"px",this._navigationArrow.style.left=g.x/this._scale+"px",this._navigationArrow.style.transform="translate(-50%, -50%) scale("+_/2+", "+d/2+") rotate("+c+"deg) ",this._navigationArrow.style.display="block"),++e>=this._navigationDots.length)break}}}}for(let t=e;t<this._navigationDots.length&&"none"!==this._navigationDots[t].style.display;t++)this._navigationDots[t].style.display="none"}}}preloadTextures(){let i=this._nearbyDots.filter(t=>t.type===DOTTYPE_PANO&&t.vectorDist<100);i.sort((t,e)=>t.vectorDist-e.vectorDist);var t=["10101","10102"],s=[];for(let e=0;e<LEVEL_ROWS[this._textureLevel];e++)for(let t=0;t<LEVEL_COLUMNS[this._textureLevel];t++)s.push(getTextureSuffix(this._textureLevel,e,t));var e,a,o,n,h=this._activeTextures.filter(t=>18===t.name.length).map(t=>t.name.substring(13)),r=[];r.push(...t.map(t=>getTextureNameSuffix(this._dotInfo.index,t))),r.push(...s.map(t=>getTextureNameSuffix(this._dotInfo.index,t))),this._forwardDot&&(r.push(...t.map(t=>getTextureNameSuffix(this._forwardDot.index,t))),r.push(...s.map(t=>getTextureNameSuffix(this._forwardDot.index,t))));for(let e=0;e<i.length&&(e<20&&r.push(...t.map(t=>getTextureNameSuffix(i[e].index,t))),e<10&&r.push(...h.map(t=>getTextureNameSuffix(i[e].index,t))),20!==e);e++);for(e of r){if(this.loadingObjects.size>=MAX_CONCURRENT_PRELOADS)break;this._textureCache.has(e)||(a=new PanoramaTexture(this,e),this._textureCache.set(e,a),a.addEventListener("TEXTURE_UPDATE",()=>{this.draw()}))}for([o,n]of this.loadingObjects)o instanceof PanoramaTexture&&(o.isLoaded||r.includes(o.name)||(o.cancel(),this._textureCache.delete(o.name)))}blueDotMouseUp(t){t=t.target.dotInfo;t.type==DOTTYPE_PANO?this.navigateTo(t.lat,t.lon):t.viewPoint?this.navigateToEncoded(t.viewPoint):t.lat&&t.lon&&this.navigateTo(t.lat,t.lon,!1)}setPOIs(t){}}let DOTTYPE_PANO=0,DOTTYPE_POI=1,DOTTYPE_VIRTUAL=2;class DotInfo{constructor(){this.type=0,this.index=0,this.zoom=0,this.date=null,this.lat=0,this.lon=0,this.heading=0,this.headingIdeal=0,this.altitude=0,this.leftAddress=0,this.leftStNumber=0,this.rightAddress=0,this.rightStNumber=0,this.vectorDist=0,this.vectorAngle=0}get name(){return leftAddress}get text(){return rightAddress}get url(){return rightStNumber}get viewPoint(){return leftStNumber}}DotInfo.makeNew=function(t,e,i,s,a,o,n,h,r,l,d){var _=new DotInfo;return _.type=t,_.index=e,_.zoom=i,_.lat=s,_.lon=a,_.heading=o,_.altitude=n,_.leftAddress=h||"",_.leftStNumber=r||"",_.rightAddress=l||"",_.rightStNumber=d||"",_}
16,DotInfo.makeNewPOI=function(t,e,i,s,a,o){var n=new DotInfo;return n.type=DOTTYPEPOI,n.lat=t,n.lon=e,n.leftAddress=i,n.leftStNumber=s,n.rightAddress=a,n.rightStNumber=o,n.index=0,n.zoom=0,n.heading=0,n.altitude=0,n};class MapSite extends EventDispatcher{constructor(t){super(),this.panoramaViewer=t,this.dotInfos=[],this.isLoaded=!1,this.isLoading=!1}async load(t){if(!this.isLoading){this.isLoading=!0;try{this.panoramaViewer.loadingObjects.set(this,!0);var e=await fetch(t);e.ok&&this.parseData(await e.text())}catch(t){}finally{this.panoramaViewer.loadingObjects.delete(this),this.isLoaded||(this.isLoaded=!0,this.dispatchEvent("SITE_LOADED"))}}}parseData(t){try{var a=t.split("\n");if(0!=a.length){var o=a[0].replace("\r","").split("|");if(17==o.length){let e=new DotInfo,i=(e.index=parseInt(o[0],10),parseInt(o[3],10));e.index<0&&(e.type=DOTTYPE_POI),e.date=new Date(100*parseInt(o[4],10)),e.zoom=parseInt(o[6],10),e.lat=Number(o[7])/1e6,e.lon=Number(o[8])/1e6,e.altitude=Number(o[9])/10,e.heading=Number(o[10])/10,e.leftStNumber=o[13],e.leftAddress=o[14];for(let t=0;t<5;t++)e.leftAddress=e.leftAddress.replace("_",", ");e.rightStNumber=o[15],e.rightAddress=o[16];for(let t=0;t<5;t++)e.rightAddress=e.rightAddress.replace("_",", ");4==i&&this.dotInfos.push(e);let s=e;for(let t=1;t<a.length;t++)if(17==(o=a[t].replace("\r","").split("|")).length){if((e=new DotInfo).index=s.index+parseInt(o[0],10),e.index<0&&(e.type=DOTTYPE_POI),i+=parseInt(o[3],10),e.date=new Date(s.date.getTime()+100*parseInt(o[4],10)),e.zoom=s.zoom+parseInt(o[6],10),e.lat=s.lat+Number(o[7])/1e6,e.lon=s.lon+Number(o[8])/1e6,e.altitude=s.altitude+Number(o[9])/10,e.heading=s.heading+Number(o[10])/10,e.headingIdeal=e.heading,e.leftStNumber=o[13],e.leftAddress=o[14],"*"==e.leftAddress)e.leftAddress=s.leftAddress;else for(let t=0;t<5;t++)e.leftAddress=e.leftAddress.replace("_",", ");if(e.rightStNumber=o[15],e.rightAddress=o[16],"*"==e.rightAddress)e.rightAddress=s.rightAddress;else for(let t=0;t<5;t++)e.rightAddress=e.rightAddress.replace("_",", ");4==i&&this.dotInfos.push(e),s=e}for(let e of this.dotInfos){var n=CAM_ADJUSTMENT.find(t=>t.from<=e.index&&t.to>=e.index);n&&(e.headingIdeal=e.heading,e.heading=e.heading+n.deg)}}}}catch(t){throw new Error("Could not parse site file.")}finally{this.isLoaded||(this.isLoaded=!0,this.dispatchEvent("SITE_LOADED"))}}}let SITE_SIZE=.01;class MapSiteController extends EventDispatcher{constructor(t){super(),this.panoramaViewer=t,this._isLoading=!1,this._currentLoadingSites=[],this._sites=new Map,this._lon=0,this._lat=0,this._delta=0,this._poiDelta=.1,this.foundDots=null,this._poiDots=[]}setPOIs(e){if(this._poiDots=[],null!=e)for(let t=0;t<e.length;t++)this._poiDots.push(DotInfo.makeNewPOI(e[t].lat,e[t].lon,e[t].name,e[t].text,e[t].link,e[t].viewPoint))}get isLoading(){return this._isLoading}findDots(t,e,i){this._currentLoadingSites=[],this._lon=e,this._lat=t,this._delta=i,this.foundDots=null;var s=Math.floor(Math.floor((180+e-i)/SITE_SIZE)),a=Math.floor(Math.ceil((180+e+i)/SITE_SIZE)),o=Math.floor(Math.floor((90-t-i)/SITE_SIZE)),n=Math.floor(Math.ceil((90-t+i)/SITE_SIZE));for(let e=s;e<a;e++)for(let t=o;t<n;t++){var h,r=e+"_"+t;this._sites.has(r)?this._currentLoadingSites.push(this._sites.get(r)):((h=new MapSite(this.panoramaViewer)).addEventListener("SITE_LOADED",this.areaSiteLoaded.bind(this)),h.load(this.panoramaViewer.serverAddress+SITE_FILE_FOLDER+"/"+e+"/"+r+".txt"),this._sites.set(r,h),this._currentLoadingSites.push(h))}this.areaSiteLoaded()}areaSiteLoaded(){for(var t of this._currentLoadingSites)if(!t.isLoaded)return;var e,i,s,a,o=[],n=this._delta*this._delta;let h=2*n;for(e of this._currentLoadingSites)for(var r of e.dotInfos)r.index<MIN_PANORAMA_INDEX||r.index>MAX_PANORAMA_INDEX||r.lon>=this._lon-this._delta&&r.lon<this._lon+this._delta&&r.lat>=this._lat-this._delta&&r.lat<this._lat+this._delta&&(i=(i=r.lon-this._lon)*i+(i=r.lat-this._lat)*i)<n&&(i<h&&0<=r.index?(o.unshift(r),h=i):o.push(r));for(s of this._poiDots)s.lon>=this._lon-this._poiDelta&&s.lon<this._lon+this._poiDelta&&s.lat>=this._lat-this._poiDelta&&s.lat<this._lat+this._poiDelta&&o.push(s);0!=o.length&&o[0].type==DOTTYPE_PANO||o.unshift(DotInfo.makeNew(DOTTYPE_VIRTUAL,0,0,this._lat,this._lon,0,0,""));for(a of o)a!==o[0]&&(a.vectorDist=calcLatLonDistance(o[0].lat,o[0].lon,a.lat,a.lon),a.vectorAngle=calcHeading(o[0].lat,o[0].lon,a.lat,a.lon));this.foundDots=o,this._isLoading=!1,this.dispatchEvent("DOTS_FOUND")}}
16class PanoramaTexture extends EventDispatcher{constructor(t,e){super(),this.panoramaViewer=t,this.name=null,this.image=null,this._loadingImage=null,this._tex=null,this.isLoaded=!1,this.isCancelled=!1,this.vertices=[],this.indices=[],e&&this.load(e)}load(t,e){this.name=t;let i=new Image;(this._loadingImage=i).onload=()=>{EMULATE_NETWORK_DELAY?setTimeout(()=>{this.panoramaViewer.loadingObjects.delete(this),this.image=i,this.isLoaded=!0,this.isCancelled||this.dispatchEvent("TEXTURE_UPDATE")},EMULATE_NETWORK_DELAY):(this.panoramaViewer.loadingObjects.delete(this),this.image=i,this.isLoaded=!0,this.isCancelled||this.dispatchEvent("TEXTURE_UPDATE"))},i.onerror=()=>{this.panoramaViewer.loadingObjects.delete(this),this.isLoaded=!0,this.isCancelled||this.dispatchEvent("TEXTURE_UPDATE")},i.onabort=()=>{this.panoramaViewer.loadingObjects.delete(this),this.isLoaded=!0,this.isCancelled||this.dispatchEvent("TEXTURE_UPDATE")},i.src=e||this.panoramaViewer.serverAddress+PICTURE_FILE_FOLDER+"/"+t.substring(0,6)+"/"+t.substring(6,10)+"/"+t+".jpg",this.panoramaViewer.loadingObjects.set(this,!0),setTimeout(()=>{this.panoramaViewer.loadingObjects.delete(this)},1e4)}cancel(){!this._loadingImage||this.isLoaded||this.isCancelled||(this.isCancelled=!0,this._loadingImage.src=null)}}class PanoramaMap extends EventDispatcher{constructor({mapWrapperElem:t,serverAddress:e,searchBoxElem:i,position:s}){super(),this._mapWrapper=t,this.serverAddress=e,this._searchBoxElem=i,this._map=null,this._dotOverlay=null,this._showDotOverlay=!0,this._showMarkers=!0,this._markerData=[],this._markers=[],this._projectionOverlay,this._avatar=null,this._avatarImages=[],this._avatarElement=null,this._avatarLat=s?.lat??0,this._avatarLon=s?.lon??0,this._avatarHeading=0,this._avatarFOV=90,this._isDraggingAvatar=!1,this._beam=null,this._isDraggingBeam=!1,this._beamDraggingDelta=0}
16async init(){var t={lat:this._avatarLat,lng:this._avatarLon},e=(this._map=new google.maps.Map(this._mapWrapper,{zoom:15,center:t,tilt:0,mapId:"MAPJACK_MAP_ID",zoomControl:!1,mapTypeControl:!1,streetViewControl:!1,fullscreenControl:!1,scaleControl:!1,rotateControl:!1,disableDefaultUI:!0,controlSize:25}),this._projectionOverlay=new google.maps.OverlayView,this._projectionOverlay.onAdd=function(){},this._projectionOverlay.draw=function(){},this._projectionOverlay.onRemove=function(){},this._projectionOverlay.setMap(this._map),document.createElementNS("http://www.w3.org/2000/svg","svg")),e=(e.setAttribute("width",2*(BEAM_RADIUS+2)+"px"),e.setAttribute("height",2*(BEAM_RADIUS+2)+"px"),e.style.pointerEvents="none",this._beam=new google.maps.marker.AdvancedMarkerElement({map:this._map,position:t,content:e,zIndex:-1}),this._map.addListener("mousedown",this.beamMouseDown.bind(this)),this._map.addListener("mousemove",this.beamMouseMove.bind(this)),this._map.addListener("mouseup",this.beamMouseUp.bind(this)),this._avatarElement=document.createElement("img"),this._avatarElement.src="images/avatar0.png",this._avatarElement.style.width="19px",this._avatarElement.style.height="42px",this._avatarElement.style.position="absolute",this._avatarElement.style.left="-10px",this._avatarElement.style.top="-36px",document.createElement("div"));e.style.position="relative",e.style.width="0",e.style.height="0",e.appendChild(this._avatarElement),this._avatarLat=t.lat,this._avatarLon=t.lng,this._avatar=new google.maps.marker.AdvancedMarkerElement({map:this._map,position:t,gmpDraggable:!0,content:e,zIndex:Math.round(1e6*(90-this._avatarLat))}),this._avatar.addListener("dragstart",()=>{this._isDraggingAvatar=!0,this.updateBeam()}),this._avatar.addListener("dragend",()=>{this._isDraggingAvatar=!1;var t=this._avatar.position;this._avatarLat=t.lat,this._avatarLon=t.lng,this.updateAvatar(),this.updateBeam(),_panoViewer.focus(),_panoViewer.navigateTo(t.lat,t.lng)});for(let t=0;t<8;t++){var i=new Image;i.src="images/avatar"+t+".png",this._avatarImages[this._avatarImages.length]=i}this._map.addListener("zoom_changed",()=>{this.updateBeam(),this.updateDotOverlay()}),this._map.addListener("maptypeid_changed",()=>{this.updateDotOverlay()}),this._map.addListener("click",t=>{t=t.latLng;_panoViewer.focus(),_panoViewer.navigateTo(t.lat(),t.lng())}),this._searchBoxElem&&this._searchBoxElem.addEventListener("keypress",this.mapSearchKeypress.bind(this)),this.updateBeam(),this.updateDotOverlay(),this._mapTypeButton=new MapButton({map:this._map,urls:["images/button_map.png","images/button_satellite.png"],click:t=>{this._mapTypeButton.imageIndex=(this._mapTypeButton.imageIndex+1)%2,0===this._mapTypeButton.imageIndex?this._map.setMapTypeId(google.maps.MapTypeId.ROADMAP):this._map.setMapTypeId(google.maps.MapTypeId.SATELLITE)},margin:"5px 0 0 10px"}),this._dotsButton=new MapButton({map:this._map,urls:["images/button_dots_on.png","images/button_dots_off.png"],click:t=>{this._dotsButton.imageIndex=(this._dotsButton.imageIndex+1)%2,this._showDotOverlay=0===this._dotsButton.imageIndex,this.updateDotOverlay()}}),this._poisButton=new MapButton({map:this._map,urls:["images/button_location.png","images/button_location_off.png"],click:t=>{this._poisButton.imageIndex=(this._poisButton.imageIndex+1)%2,this._showMarkers=0===this._poisButton.imageIndex,this._updateMarkers()}}),this._zoomOutButton=new MapButton({map:this._map,url:"images/button_zoom_out.png",click:t=>{this._map.setZoom(this._map.getZoom()-1)}}),this._zoomInButton=new MapButton({map:this._map,url:"images/button_zoom_in.png",click:t=>{this._map.setZoom(this._map.getZoom()+1)}})}async mapSearchKeypress(t){var e=this._searchBoxElem.value.trim();if("Enter"===t.key&&e){t.preventDefault();t=this._map.getBounds();try{var i=(await(await fetch("https://places.googleapis.com/v1/places:searchText",{method:"POST",headers:{"Content-Type":"application/json","X-Goog-Api-Key":GOOGLE_PLACES_API_KEY,"X-Goog-FieldMask":"places.displayName,places.location,places.formattedAddress"},body:JSON.stringify({textQuery:e,locationBias:{rectangle:{low:{latitude:t.getSouthWest
16().lat(),longitude:t.getSouthWest().lng()},high:{latitude:t.getNorthEast().lat(),longitude:t.getNorthEast().lng()}}},maxResultCount:50})})).json()||[]).places.map(t=>({name:t.displayName?.text||"Unknown",category:"Search",lat:t.location?.latitude,lon:t.location?.longitude,text:t.formattedAddress||""}));this.dispatchEvent("SEARCH_UPDATE",i)}catch(t){console.error("Error performing search:",t)}}}beamMouseDown(t){var e,i,s,a;this._map.getZoom()<BEAM_ZOOM_LEVEL||(t=t.latLng,e=this._beam.position,e=(i=this._projectionOverlay.getProjection()).fromLatLngToContainerPixel(e),t=(i=i.fromLatLngToContainerPixel(t)).x-e.x,i=i.y-e.y,e=Math.sqrt(t*t+i*i),i=(90+(i=180*Math.atan2(i,t)/Math.PI)+360)%360,a=((t=this._avatarHeading)-(s=Math.max(this._avatarFOV+30,45))/2+360)%360,t=(t+s/2)%360,e<=1.2*BEAM_RADIUS&&(a<=t?a<=i&&i<=t:a<=i||i<=t)&&(this._isDraggingBeam=!0,this._beamDraggingDelta=i-this._avatarHeading,this._map.setOptions({draggable:!1,clickableIcons:!1}),this._avatar.gmpClickable=!1,this._avatar.gmpDraggable=!1,this._beam.gmpClickable=!1))}beamMouseMove(e){if(this._isDraggingBeam){var e=e.latLng,i=this._beam.position,s=this._projectionOverlay.getProjection(),i=s.fromLatLngToContainerPixel(i),s=s.fromLatLngToContainerPixel(e),e=s.x-i.x,s=s.y-i.y;let t=(180*Math.atan2(s,e)/Math.PI+90)%360;t<0&&(t+=360),this._avatarHeading=(t-this._beamDraggingDelta+360)%360,this.updateBeam(),this.updateAvatar(),_panoViewer.turnTo(this._avatarHeading)}}beamMouseUp(){this._isDraggingBeam&&(this._isDraggingBeam=!1,this._map.setOptions({draggable:!0,clickableIcons:!0}),this._avatar.gmpClickable=!0,this._avatar.gmpDraggable=!0,this._beam.gmpClickable=!0)}updateDotOverlay(){var e=this._map.getZoom(),t=6<e&&this._showDotOverlay;if(!t&&this._dotOverlay&&(0<=(i=this._map.overlayMapTypes.getLength()-1)&&this._map.overlayMapTypes.removeAt(i),this._dotOverlay=null),t){let t=1;var i=this._map.getMapTypeId();t=i===google.maps.MapTypeId.SATELLITE?DOT_OPACITY_SAT[e-1]/10:DOT_OPACITY_MAP[e-1]/10,this._dotOverlay||(this._dotOverlay=new google.maps.ImageMapType({getTileUrl:(t,e)=>this.serverAddress+DOT_OVERLAY_FOLDER+"/"+e+"/"+t.x+"/"+e+"_"+t.x+"_"+t.y+".gif",tileSize:new google.maps.Size(256,256),opacity:t,minZoom:0,maxZoom:17}),this._map.overlayMapTypes.push(this._dotOverlay)),this._dotOverlay.opacity!==t&&(this._dotOverlay.opacity=t,this._map.overlayMapTypes.setAt(this._map.overlayMapTypes.getLength()-1,this._dotOverlay))}}updateMap(t,e,i,s){return!(!this._avatar||this._isDraggingBeam||this._isDraggingAvatar||(this._avatarLat=t,this._avatarLon=e,this._avatarHeading=i,this._avatarFOV=s,this.updateAvatar(),this.updateBeam(),0))}updateAvatar(){var t;this._avatar&&(t={lat:this._avatarLat,lng:this._avatarLon},this._avatar.position=t,this._avatar.zIndex=Math.round(1e6*(90-this._avatarLat)),this._beam.position=t,this._avatarElement.src=this._avatarImages[Math.round(this._avatarHeading/45)%8].src,this.panVisible(this._avatar.position))}updateBeam(){var t,e,i,s,a,o,n;!this._isDraggingAvatar&&this._map.getZoom()>=BEAM_ZOOM_LEVEL?(s=this._avatarHeading*Math.PI/180,a=this._avatarFOV*Math.PI/180,o=BEAM_RADIUS+2,n=BEAM_RADIUS+2,e=s-a/2,s=s+a/2,t=o+BEAM_RADIUS*Math.sin(e),e=n+BEAM_RADIUS*-Math.cos(e),i=o+BEAM_RADIUS*Math.sin(s),s=n+BEAM_RADIUS*-Math.cos(s),a=a>Math.PI?1:0,o=`
17                M ${o},${n} 
18                L ${t},${e} 
19                A ${BEAM_RADIUS},${BEAM_RADIUS} 0 ${a} 1 ${i},${s} 
20                Z
21            `,(n=this._beam.content).innerHTML=`<path d="${o}" fill="#AAAAFF" fill-opacity="0.5" stroke="#6666FF" stroke-width="1" />`,n.style.position="absolute",n.style.left=-BEAM_RADIUS-2+"px",n.style.top=-BEAM_RADIUS-2+"px"):this._beam.content.innerHTML=""}panVisible(t){var e=this._map.getBounds();
21if(e){const s=e.getNorthEast().lat()-e.getSouthWest().lat(),a=e.getNorthEast().lng()-e.getSouthWest().lng();var i=new google.maps.LatLng(e.getSouthWest().lat()+.1*s,e.getSouthWest().lng()+.1*a),e=new google.maps.LatLng(e.getNorthEast().lat()-.1*s,e.getNorthEast().lng()-.2*a);new google.maps.LatLngBounds(i,e).contains(t)||this._map.panTo(t)}}showMarkers(t){this._markerData=t,this._updateMarkers(),this._showMarkers&&this.zoomPanOnMarkers()}_updateMarkers(){if(this._map){for(;0<this._markers.length;)this._markers.pop().map=null;if(this._showMarkers)for(var t of this._markerData)this._addMarker(t)}}_addMarker({lat:t,lon:e,index:i,viewPoint:s,toolTip:a}){if(!this._map)return!1;var o=document.createElement("div"),n=(o.className="poiMarkerContainer",o.style.position="relative",o.style.width="28px",o.style.height="19px",o.style.left="14px",document.createElement("img")),n=(n.src="images/marker.png",n.style.width="28px",n.style.height="19px",n.style.position="absolute",o.appendChild(n),document.createElement("div"));n.textContent=i,n.style.position="absolute",n.style.top="50%",n.style.left="50%",n.style.transform="translate(-50%, -50%)",n.style.height="15px",n.style.color="#000000",n.style.fontSize="12px",n.style.fontWeight="bold",n.style.pointerEvents="none",o.appendChild(n);let h=new google.maps.marker.AdvancedMarkerElement({position:{lat:t,lng:e},map:this._map,content:o,zIndex:Math.round(1e6*(90-(t-1e-5))),title:a});return h.addListener("gmp-click",()=>{var t;_panoViewer.focus(),h.viewPoint?_panoViewer.navigateToEncoded(h.viewPoint):(t=h.position,_panoViewer.navigateTo(t.lat(),t.lng()))}),h.viewPoint=s,this._markers.push(h),!0}zoomPanOnMarkers(){if(!this._map||!this._markers||0===this._markers.length)return!1;var e=new google.maps.LatLngBounds;for(let t=0;t<this._markers.length;t++){var i=this._markers[t].position;i&&e.extend(i)}return this._map.fitBounds(e),16<this._map.getZoom()&&this._map.setZoom(16),this._map.setCenter(e.getCenter()),!0}}class MapButton{constructor({map:t,url:e,urls:i,index:s,disabled:a,click:o,mousedown:n,mouseup:h,margin:r}){this._map=t,this.click=o,this.mousedown=n,this.mouseup=h,this.images=[];for(var l of i??[e]){var d=document.createElement("img");d.src=l,this.images.push(d)}this.image=document.createElement("img"),this.image.className="mapButton",r&&(this.image.style.margin=r),this._index=0,this.imageIndex=s??0,this._disabled=!!a,this._isDown=!1,this._map.controls[google.maps.ControlPosition.TOP_LEFT].push(this.image),this.image.addEventListener("click",t=>{this.click&&!this._disabled&&this.click(t)}),this.image.addEventListener("mousedown",t=>{this._isDown=!0,this.mousedown&&!this._disabled&&this.mousedown(t)}),this.image.addEventListener("mouseup",t=>{this._isDown=!1,this.mouseup&&!this._disabled&&this.mouseup(t)}),this.image.addEventListener("mouseout",t=>{this._isDown&&(this._isDown=!1,this.mouseup)&&!this._disabled&&this.mouseup(t)})}set imageIndex(t){this._index=t,this.image.src=this.images[this._index].src}get imageIndex(){return this._index}set visible(t){this.image.style.display=t?"block":"none"}set x(t){this.image.style.left=t/this._map._scale+"px"}set y(t){this.image.style.top=t/this._map._scale+"px"}set disabled(t){this._disabled=t,this.image.classList.toggle("disabled",t)}}let _panoViewer=null,_panoMap=null,_mapsAPILoaded=!1,_selectedCityIndex=-1,_poiCategories=[],_selectedPOICategory=null,_poiStartIndex=0,POI_LIST_LENGTH=8,_poiList=[],_poiMessage=null,_searchResult=[];function init(){if(_mapsAPILoaded){makeResizable(document.getElementById("resizer-vertical"),document.getElementById("content"),document.getElementById("main"),!0),makeResizable(document.getElementById("resizer-horizontal"),document.getElementById("panorama"),document.getElementById("map"),!1);try{var i,s=readCookie(SCREEN_COOKIE);s&&(isN((i=JSON.parse(s)).contentWidth)&&(document.getElementById("content").style.width=i.contentWidth+"px"),isN(i.panoFraction))&&(document.getElementById("panorama").style.flex=i.panoFraction,document.getElementById("map").style.flex=1-i.panoFraction)}catch(t){}let t=new URLSearchParams(window.location.search).get("p");(t=t&&decodePosition(t)?t:readCookie(POSITION_COOKIE))&&decodePosition(t)||(t=PANORAMA_START_POSITION);var a=document.getElementById("citySelect");if(a)for(let t=0;t<CITIES.length;t++){var o=new Option(CITIES[t].name,CITIES[t].name);a.options[a.options.length]=o}let e=null;(_panoViewer=new PanoramaViewer(document.getElementById("panoramaWrapper"),SERVER_ADDRESS)).addEventListener("STATUS_UPDATE",t=>{t.dotType===DOTTYPE_PANO&&writeCookie(POSITION_COOKIE,t.urlEncoded),updateCity(),_panoMap.updateMap(t.lat,t.lon,t.heading,t.viewAngle),clearTimeout(e),e=setTimeout(()=>{window.history.replaceState({},document.title,"?p="+t.urlEncoded)})}),_panoViewer.init(),(_panoMap=new PanoramaMap({mapWrapperElem:document.getElementById("overviewMap"),searchBoxElem:document.getElementById("searchBox"),serverAddress:SERVER_ADDRESS,position:decodePosition(t)})).init(),_panoMap.addEventListener("SEARCH_UPDATE",t=>{_searchResult=t&&0<t.length?t:[{name:"Nothing found",category:"Search"}],_selectedPOICategory="Search",updatePOIList()}),document.getElementById("searchBox").addEventListener("click",function(t){this.select()}
21),_panoViewer.navigateToEncoded(t),_panoViewer.focus()}else setTimeout(init,100)}function mapsAPILoaded(){_mapsAPILoaded=!0}function makeResizable(t,i,s,a){let o=!1;function e(t){var e;o&&(a?50<(e=t.clientX)&&e<window.innerWidth-50&&(i.style.width=e+"px"):(e=t.clientY-i.getBoundingClientRect().top,t=i.offsetHeight+s.offsetHeight,50<e&&e<t-50&&(i.style.flex=e=e/t,s.style.flex=1-e)),saveScreenConfig())}t.addEventListener("mousedown",t=>{o=!0,i.classList.toggle("resizing",!0),s.classList.toggle("resizing",!0),document.addEventListener("mousemove",e),document.addEventListener("mouseup",()=>{o=!1,i.classList.toggle("resizing",!1),s.classList.toggle("resizing",!1)},{once:!0})})}function citySelectChange(){var t=document.getElementById("citySelect").selectedIndex;_panoViewer.focus(),_panoViewer.navigateToEncoded(CITIES[t].viewPoint)}function updateCity(){let e=_panoViewer.latLon;if(null===e||0==e.lat||0===e.lon)return!1;var t=document.getElementById("citySelect");if(t){var i=CITIES.findIndex(t=>t.lat1<=e.lat&&t.lat2>e.lat&&t.lon1<=e.lon&&t.lon2>e.lon);if(t.selectedIndex=i,_selectedCityIndex!==i){if(_selectedCityIndex=i,document.getElementById("searchBox").value="",_searchResult=[],i<0)return!(document.getElementById("poiDiv").innerHTML="");_selectedPOICategory=null,_poiStartIndex=0,_poiMessage=null,updatePOIList()}return!0}}function changePOICategory(t){_selectedPOICategory=t,_poiStartIndex=0,_poiMessage=null,updatePOIList()}function updatePOIList(){var e=document.getElementById("poiDiv");if(e&&!(_selectedCityIndex<0)&&(e.innerHTML="",CITIES[_selectedCityIndex].pois)&&0!=CITIES[_selectedCityIndex].pois.length){var t=[...CITIES[_selectedCityIndex].pois];t.push(..._searchResult),_poiCategories=[],_poiList=[];for(let e of t)null===_selectedPOICategory&&(_selectedPOICategory=e.category),e.category===_selectedPOICategory&&_poiList.push(e),_poiCategories.find(t=>t===e.category)||_poiCategories.push(e.category);let s="";if(1<_poiCategories.length&&(t=_poiCategories.map(function(t){return'<div class="contentButton" onclick="changePOICategory(\''+t+"');\">"+t+"</div>"}).join(""),s+='<div class="poiCategoryMenu">'+t+"</div>"),s+="<h2>"+_selectedPOICategory+"</h2>",_poiMessage)s+='<div class="poiList"><br><b>'+_poiMessage+"</b><br>&nbsp;</div>",e.innerHTML=s;else{s+="<table>";for(let i=0;i<_poiList.length;i++){var a=_poiList[i];if(!(i<_poiStartIndex||i>=_poiStartIndex+POI_LIST_LENGTH))if(a.tooltip="",a.name&&(a.tooltip=a.name),a.text&&(""!=a.tooltip&&(a.tooltip+=" -- "),a.tooltip+=a.text),175<a.tooltip.length&&(a.tooltip=a.tooltip.substring(0,170)+"..."),s+="<tr>",a.viewPoint||a.lat){let t="";a.viewPoint?t="navEnc('"+a.viewPoint+"');":a.lat&&(t="nav("+a.lat+","+a.lon+");");var o='<div class="poiItemWrapper"><img src="images/marker.png" class="poiItemImage" onclick="'+t+'"><div class="poiItemIndex">'+(i+1)+"</div></div>";s+="<td>"+o+"</td>";let e='<a href="javascript:'+t+'" title="'+a.tooltip+'">'+a.name+"</a>";a.link&&(e+='&nbsp;&nbsp;<a href="'+a.link+'" target="_blank" title="'+a.link+'">[info]</a>'),s=s+('<td class="poiItem">'+e+"</td>")+"</tr>"}else s+="<p >"+a.name+"</p>"}s+="</table>";let t="";0<_poiStartIndex&&(t+='<div class="contentButton" onclick="poiBackClick();">Back</div>'),_poiStartIndex+POI_LIST_LENGTH<_poiList.length&&(t+='<div class="contentButton" onclick="poiMoreClick();">More</div>'),s+='<div class="poiListNav">'+t+"</div>",e.innerHTML=s,_panoViewer.setPOIs(_poiList);var i=[];for(let e=0;e<_poiList.length;e++){var n,h=_poiList[e];if(!(e<_poiStartIndex||e>=_poiStartIndex+POI_LIST_LENGTH)){let t=null;h.viewPoint&&(t=h.viewPoint),h.lat&&h.lon?i.push({lat:h.lat,lon:h.lon,index:e+1,viewPoint:t,tooltip:h.tooltip}):t&&(n=decodePosition(t),i.push({lat:n.lat,lon:n.lon,index:e+1,viewPoint:t,tooltip:h.tooltip}))}}_panoMap.showMarkers(i)}}}function poiMoreClick(){_poiStartIndex+=POI_LIST_LENGTH,_poiMessage=null,updatePOIList()}function poiBackClick(){_poiStartIndex-=POI_LIST_LENGTH,_poiMessage=null,updatePOIList()}function nav(t,e,i){_panoViewer.navigateTo(t,e,i),_panoViewer.focus()}function navEnc(t){_panoViewer.navigateToEncoded(t),_panoViewer.focu
21s()}function saveScreenConfig(){var t={contentWidth:document.getElementById("content").offsetWidth,panoFraction:Number(window.getComputedStyle(document.getElementById("panorama")).flexGrow)};writeCookie(SCREEN_COOKIE,JSON.stringify(t))}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.