@panoramax/web-viewer 4.0.3-develop-e6749fd4 → 4.0.3-develop-39c77140

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -17,6 +17,11 @@ Before _2.0.0_, Viewer was embed in the [API repository](https://gitlab.com/pano
17
17
 
18
18
  - In picture legend, in _General_ tab, capture date shows seconds and is clickable to access _Camera_ tab.
19
19
  - Map legend font size a bit reduced, map attribution integrated in a sentence.
20
+ - In picture legend, the "..." keeps the same entries between collapsed and expanded display.
21
+
22
+ ### Fixed
23
+
24
+ - Map filters were not correctly applied after user change.
20
25
 
21
26
  ## [4.0.3] - 2025-05-23
22
27
 
package/build/index.js CHANGED
@@ -9,7 +9,7 @@
9
9
  * LICENSE file in the root directory of this source tree.
10
10
  *
11
11
  */
12
- !function(Qe,rt){"object"===typeof exports&&"object"===typeof module?module.exports=rt():"function"===typeof define&&define.amd?define("Panoramax",[],rt):"object"===typeof exports?exports.Panoramax=rt():Qe.Panoramax=rt()}(this,(()=>(()=>{var Qe={9039:(Qe,rt,Wn)=>{"use strict";Wn.d(rt,{A:()=>Basic});var Co=Wn(4542),Dl=Wn(5254),Ll=Wn(4964),Rl=Wn(8340),Ul=Wn(5995),Gl=Wn(7343),Zl=Wn(2614),Hl=Wn.n(Zl),ql=Wn(8330);Wn(1865),Wn(3638);class Basic extends Co.WF{constructor(){let Qe=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),this.users=["geovisio"],this.mapstyle=this.getAttribute("mapstyle")||Rl.DEFAULT_TILES,this.lang=this.getAttribute("lang")||null,this.endpoint=this.getAttribute("endpoint")||null,this.picture=this.getAttribute("picture")||null,this.sequence=this.getAttribute("sequence")||null,console.info(`\ud83d\udcf7 Panoramax ${this.getClassName()} - Version ${ql.rE} (e6749fd)\n\n\ud83c\udd98 Issues can be reported at ${ql.Jk.O}`),Qe||(this._isInternetFast=null,(0,Gl.isInternetFast)().then((Qe=>this._isInternetFast=Qe)))}connectedCallback(){super.connectedCallback(),this._t=(0,Ll.getTranslations)(this.lang),this.loader=(0,Ul.createWebComp)("pnx-loader",{_parent:this,"no-label":(0,Gl.isInIframe)()}),this._loadsAPI&&this.endpoint&&this._loadsAPI===this.endpoint||this.api&&this.api._endpoint===this.endpoint||!this.endpoint||((this._loadsAPI||this.api)&&(delete this.api,delete this._loadsAPI),this._setupAPI())}_setupAPI(){if(this.loader=this.loader||(0,Ul.createWebComp)("pnx-loader",{_parent:this}),!this.endpoint)return void console.warn("No endpoint is defined");this._loadsAPI=this.endpoint;let Qe=this.endpoint;try{this.mapstyle=JSON.parse(this.mapstyle)}catch(Wn){}try{this.api=new Dl.A(this.endpoint,{users:this.users,fetch:this.fetchOptions,style:this.mapstyle}),this.api.onceReady().then((()=>{if(Qe!=this._loadsAPI||!this.api)return;let rt=this.api.getUnavailableFeatures(),Wn=this.api.getAvailableFeatures();Wn=0===rt.length?"\u2705 All features available":"\u2705 Available features: "+Wn.join(", "),rt=0===rt.length?"":"\ud83d\udeab Unavailable features: "+rt.join(", "),console.info(`\ud83c\udf10 Connected to API "${this.api._metadata.name}" (${this.api._endpoint})\n\u2139\ufe0f API runs STAC ${this.api._metadata.stac_version} ${this.api._metadata.geovisio_version?"& GeoVisio "+this.api._metadata.geovisio_version:""}\n ${Wn}\n ${rt}\n`.trim())})).catch((Qe=>this.loader.dismiss(Qe,this._t.pnx.error_api))).finally((()=>delete this._loadsAPI))}catch(Wn){var rt;delete this._loadsAPI,null!==(rt=this.loader)&&void 0!==rt&&rt.dismiss?this.loader.dismiss(Wn,this._t.pnx.error_api):console.error(Wn)}}onceReady(){throw new Error("You must override this method on sub-class")}onceAPIReady(){return this.api?this.api.onceReady():new Promise((Qe=>setTimeout(Qe,100))).then(this.onceAPIReady.bind(this))}createRenderRoot(){return this}attributeChangedCallback(Qe,rt,Wn){if(super.attributeChangedCallback(Qe,rt,Wn),"endpoint"===Qe&&(this._loadsAPI&&Wn&&this._loadsAPI===Wn||this.api&&this.api._endpoint===Wn||!Wn||((this._loadsAPI||this.api)&&(delete this.api,delete this._loadsAPI),this._setupAPI())),["picture","sequence"].includes(Qe)){let Co,Dl,Ll,Rl;"picture"===Qe?(Co=this.sequence,Ll=this.sequence,Dl=Wn,Rl=rt):(Co=Wn,Ll=rt,Dl=this.picture,Rl=this.picture),this.dispatchEvent(new CustomEvent("select",{bubbles:!0,composed:!0,detail:{seqId:Co,picId:Dl,prevSeqId:Ll,prevPicId:Rl}}))}}getClassName(){return"Basic"}select(){let Qe=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,rt=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;arguments.length>2&&void 0!==arguments[2]&&arguments[2]&&(this.picture=null,this.sequence=null),this.picture=rt,this.sequence=Qe}isWidthSmall(){return(null===this||void 0===this?void 0:this.offsetWidth)<576}isHeightSmall(){return(null===this||void 0===this?void 0:this.offsetHeight)<400}render(){return Co.qy`<p>Should not be used directly, use Viewer/CoverageMap/Editor instead</p>`}getSubComponentsNames(){return["loader","api"]}addEventListener(Qe,rt,Wn){let Co=Qe.split(":").shift();if(Co&&this.getSubComponentsNames().includes(Co)){var Dl;const Ll=Qe.substring(Co.length+1);null!==(Dl=this[Co])&&void 0!==Dl&&Dl.addEventListener?this[Co].addEventListener(Ll,rt,Wn):setTimeout((()=>this.addEventListener(Qe,rt,Wn)),50)}else super.addEventListener(Qe,rt,Wn)}static GetJSONConverter(){return{fromAttribute:Qe=>"object"===typeof Qe?Qe:Hl().parse(Qe),toAttribute:Qe=>JSON.stringify(Qe)}}}Basic.properties={picture:{type:String,reflect:!0},sequence:{type:String,reflect:!0},fetchOptions:{converter:Basic.GetJSONConverter()},users:{type:Array,reflect:!0},mapstyle:{type:String},lang:{type:String},endpoint:{type:String}}},153:(Qe,rt,Wn)=>{"use strict";Wn.d(rt,{A:()=>CoverageMap});var Co=Wn(9039),Dl=Wn(5642),Ll=Wn(8340),Rl=Wn(927),Ul=(Wn(7776),Wn(2118));class CoverageMap extends Co.A{constructor(){super(),this._mapContainer=document.createElement("div"),this.onceAPIReady().then((()=>{this.loader.setAttribute("value",30),this._initParams=new Ul.Ay(Ul.Ay.GetComponentProperties(CoverageMap,this)),this._initMap()}))}getClassName(){return"CoverageMap"}onceReady(){return this.map&&this.map.waitForEnoughMapLoaded?this.map.waitForEnoughMapLoaded():new Promise((Qe=>setTimeout(Qe,100))).then(this.onceReady.bind(this))}render(){return[this.loader,this._mapContainer]}getSubComponentsNames(){const Qe=super.getSubComponentsNames();return Qe.push("map"),Qe}_initMap(){class MyMap extends Dl.A{_getLayerStyleProperties(Qe){return"pictures_symbols"===Qe?{layout:{visibility:"none"}}:super._getLayerStyleProperties(Qe)}}this.map=new MyMap(this,this._mapContainer,Object.assign({},this._initParams.getMapInit(),{hash:!0})),this.map.addControl(new Rl.NavigationControl({showCompass:!1})),this.loader.setAttribute("value",70),this.addEventListener("select",this._onSelect.bind(this)),this.map.on("picture-click",(Qe=>this.select(Qe.seqId,Qe.picId))),this.map.on("sequence-click",(Qe=>this.select(Qe.seqId))),this.map.waitForEnoughMapLoaded().then((async()=>{await(0,Ul.mK)(this.map,this._initParams.getMapPostInit()),this.map.reloadLayersStyles(),this.loader.dismiss()}))}_onSelect(Qe){if(Qe.detail.picId||Qe.detail.seqId){const rt=Qe.detail.picId?"pictures":"sequences",Wn=this.map.queryRenderedFeatures({layers:[...this.map._userLayers].map((Qe=>(0,Ll.getUserLayerId)(Qe,rt))),filter:["==",["get","id"],Qe.detail.picId||Qe.detail.seqId]});Wn.length>=0&&null!=Wn[0]&&this.map._attachPreviewToPictures({features:Wn},rt)}}}CoverageMap.properties={map:{converter:Co.A.GetJSONConverter()},...Co.A.properties},customElements.define("pnx-coverage-map",CoverageMap)},1752:(Qe,rt,Wn)=>{"use strict";Wn.d(rt,{A:()=>Editor});Wn(7365);var Co=Wn(9039),Dl=Wn(5642),Ll=Wn(9048),Rl=(Wn(7534),Wn(6810),Wn(508)),Ul=Wn(8340),Gl=Wn(1545),Zl=(Wn(4542),Wn(5995));const Hl="sequence-headings";class Editor extends Co.A{constructor(){super(),this.raster=null,this.background="streets",this.users=[],this._psvContainer=document.createElement("div"),this._mapContainer=document.createElement("div"),this.onceAPIReady().then((()=>{this.loader.setAttribute("value",30),this.sequence||this.loader.dismiss({},"No sequence is selected"),this.addEventListener("select",this._onSelect.bind(this)),this._initPSV(),this._initMap()}))}getClassName(){return"Editor"}onceReady(){var Qe,rt;return this.map&&this.psv&&null!==(Qe=(rt=this.map).loaded)&&void 0!==Qe&&Qe.call(rt)?Promise.resolve():new Promise((Qe=>setTimeout(Qe,100))).then(this.onceReady.bind(this))}connectedCallback(){Array.isArray(this.users)&&this.users.length>0&&(console.warn("Parameters users can't be changed in Editor, only selected sequence can be visible"),this.users=[]),super.connectedCallback()}attributeChangedCallback(Qe,rt,Wn){"users"===Qe&&Array.isArray(Wn)&&Wn.length>0?console.warn("Parameters users can't be changed in Editor, only selected sequence can be visible"):super.attributeChangedCallback(Qe,rt,Wn)}render(){return[this.loader,this._psvContainer,this._mapContainer]}getSubComponentsNames(){return super.getSubComponentsNames().concat(["map","psv"])}_initPSV(){try{this.psv=new Ll.Ay(this,this._psvContainer),this.psv._myVTour.datasource.nodeResolver=this._getNode.bind(this)}catch(Qe){let rt=Gl.IJ.isWebGLSupported?this._t.pnx.error_psv:this._t.pnx.error_webgl;this.loader.dismiss(Qe,rt)}}_initMap(){try{this.map=new Dl.A(this,this._mapContainer,{raster:this.raster,background:this.background,supplementaryStyle:this._createMapStyle(),zoom:15}),(0,Ul.linkMapAndPhoto)(this),this.loader.setAttribute("value",50),this._loadSequence(),this.map.once("load",(()=>{this.map.hasTwoBackgrounds()&&this._addMapBackgroundWidget(),this._bindPicturesEvents()}));const Qe=this.map._picMarker.setRotation.bind(this.map._picMarker);this.map._picMarker.setRotation=rt=>(rt=void 0===this._lastRelHeading?rt:rt+this._lastRelHeading-this.psv.getPictureRelativeHeading(),Qe(rt))}catch(Qe){this.loader.dismiss(Qe,this._t.pnx.error_psv)}}_createMapStyle(){return{sources:{geovisio_editor_sequences:{type:"geojson",data:{type:"FeatureCollection",features:[]}}},layers:[{id:"geovisio_editor_sequences",type:"line",source:"geovisio_editor_sequences",layout:{...Ul.VECTOR_STYLES.SEQUENCES.layout},paint:{...Ul.VECTOR_STYLES.SEQUENCES.paint}},{id:"geovisio_editor_pictures",type:"circle",source:"geovisio_editor_sequences",layout:{...Ul.VECTOR_STYLES.PICTURES.layout},paint:{...Ul.VECTOR_STYLES.PICTURES.paint}}]}}_bindPicturesEvents(){this.map.on("mousemove","geovisio_editor_pictures",(()=>{this.map.getCanvas().style.cursor="pointer"})),this.map.on("mouseleave","geovisio_editor_pictures",(()=>{this.map.getCanvas().style.cursor=""})),this.map.on("click","geovisio_editor_pictures",this.map._onPictureClick.bind(this.map))}_loadSequence(){return this.loader.setAttribute("value",60),this.api.getSequenceItems(this.sequence).then((Qe=>{if(this.loader.setAttribute("value",80),this.map.once("sourcedata",(()=>{this.map.setPaintProperty("geovisio_editor_sequences","line-color",this.map._getLayerColorStyle("sequences")),this.map.setPaintProperty("geovisio_editor_pictures","circle-color",this.map._getLayerColorStyle("pictures")),this.map.setLayoutProperty("geovisio_editor_sequences","visibility","visible"),this.map.setLayoutProperty("geovisio_editor_pictures","visibility","visible"),this.map.once("styledata",(()=>this.loader.dismiss()))})),this._sequenceData=Qe.features,this.map.getSource("geovisio_editor_sequences").setData({type:"FeatureCollection",features:[{type:"Feature",properties:{id:this.sequence},geometry:{type:"LineString",coordinates:Qe.features.map((Qe=>Qe.geometry.coordinates))}},...Qe.features.map((Qe=>(Qe.properties.id=Qe.id,Qe.properties.sequences=[this.sequence],Qe)))]}),this.picture){const rt=Qe.features.find((Qe=>Qe.id===this.picture));rt?(this.select(this.sequence,this.picture,!0),this.map.jumpTo({center:rt.geometry.coordinates,zoom:18})):console.log("Picture with ID",rt,"was not found")}else{const rt=[...Qe.features[0].geometry.coordinates,...Qe.features[0].geometry.coordinates];for(let Wn=1;Wn<Qe.features.length;Wn++){const Co=Qe.features[Wn].geometry.coordinates;Co[0]<rt[0]&&(rt[0]=Co[0]),Co[1]<rt[1]&&(rt[1]=Co[1]),Co[0]>rt[2]&&(rt[2]=Co[0]),Co[1]>rt[3]&&(rt[3]=Co[1])}this.map.fitBounds(rt,{animate:!1})}})).catch((Qe=>this.loader.dismiss(Qe,this._t.pnx.error_api)))}_getNode(Qe){const rt=this._sequenceData.find((rt=>rt.properties.id===Qe)),Wn=rt?(0,Rl.apiFeatureToPSVNode)(rt,this._t,this._isInternetFast):null;return Wn&&delete Wn.links,Wn}_addMapBackgroundWidget(){const Qe=(0,Zl.createWebComp)("pnx-map-background",{_parent:this,size:"sm"});this._mapContainer.appendChild(Qe)}previewSequenceHeadingChange(Qe){const rt=void 0!==this.map.getLayer(Hl);if(this.map._picMarkerPreview.remove(),void 0===Qe)return delete this._lastRelHeading,rt&&this.map.setLayoutProperty(Hl,"visibility","none"),void(this.picture&&this.map._picMarker.setRotation(this.psv.getXY().x));this._lastRelHeading=Qe,rt||this.map.addLayer({id:Hl,type:"symbol",source:"geovisio_editor_sequences",layout:{"icon-image":"pnx-marker","icon-overlap":"always","icon-size":.8}});const Wn=-this.psv.getPictureRelativeHeading();this.map.setLayoutProperty(Hl,"visibility","visible"),this.map.setLayoutProperty(Hl,"icon-rotate",["+",["get","view:azimuth"],Wn,Qe]);const Co=[["==",["geometry-type"],"Point"]];this.picture&&Co.push(["!=",["get","id"],this.picture]),this.map.setFilter(Hl,["all",...Co]),this.picture&&this.map._picMarker.setRotation(this.psv.getXY().x)}_onSelect(){void 0!==this._lastRelHeading&&this.previewSequenceHeadingChange(this._lastRelHeading)}}Editor.properties={raster:{converter:Co.A.GetJSONConverter()},background:{type:String},...Co.A.properties},customElements.define("pnx-editor",Editor)},3407:(Qe,rt,Wn)=>{"use strict";Wn.d(rt,{A:()=>PhotoViewer});Wn(970);var Co=Wn(1545),Dl=Wn(4451),Ll=Wn(9039),Rl=Wn(9048),Ul=Wn(5995),Gl=Wn(7343),Zl=Wn(2118),Hl=Wn(4207);const ql=Math.PI/6;class PhotoViewer extends Ll.A{constructor(){super(),this.psv={},this["url-parameters"]=this.getAttribute("url-parameters")||!0,this.widgets=this.getAttribute("widgets")||"true",this.grid=(0,Ul.createWebComp)("pnx-cornered-grid"),this.psvContainer=document.createElement("div"),this.psvContainer.setAttribute("slot","bg"),this.grid.appendChild(this.psvContainer),this.popup=(0,Ul.createWebComp)("pnx-popup",{_parent:this,onclose:this._onPopupClose.bind(this)})}_createInitParamsHandler(){var Qe,rt;this._initParams=new Zl.Ay(Zl.Ay.GetComponentProperties(PhotoViewer,this),Object.assign({},null===(Qe=this.urlHandler)||void 0===Qe?void 0:Qe.currentURLParams(),null===(rt=this.urlHandler)||void 0===rt?void 0:rt.currentURLParams(!0)),{})}_initWidgets(){"false"!==this._initParams.getParentPostInit().widgets&&(this.grid.appendChild((0,Ul.createWebComp)("pnx-widget-player",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden",size:this.isHeightSmall()?"md":"xl"})),this.isWidthSmall()?(this.legend=(0,Ul.createWebComp)("pnx-picture-legend",{_parent:this}),this.bottomDrawer=(0,Ul.createWebComp)("pnx-bottom-drawer",{slot:"bottom",_parent:this,class:this._initParams.getParentPostInit().picture?void 0:"pnx-hidden"}),this.bottomDrawer.appendChild(this.legend),this.grid.appendChild(this.bottomDrawer),this.addEventListener("select",(Qe=>{(0,Gl.isNullId)(Qe.detail.picId)?this.bottomDrawer.classList.add("pnx-hidden"):this.bottomDrawer.classList.remove("pnx-hidden")}))):(this.legend=(0,Ul.createWebComp)("pnx-widget-legend",{slot:this.isWidthSmall()?void 0:"top-left",_parent:this,focus:this._initParams.getParentPostInit().focus,picture:this._initParams.getParentPostInit().picture}),this.grid.appendChild((0,Ul.createWebComp)("pnx-widget-zoom",{slot:"bottom-right",class:"pnx-print-hidden",_parent:this})),this.grid.appendChild(this.legend),this.grid.appendChild((0,Ul.createWebComp)("pnx-hashtags",{slot:"top-right",_parent:this,class:"pnx-only-psv pnx-print-hidden"}))))}connectedCallback(){super.connectedCallback(),this.presetsManager=new Hl.A(this.lang),this["url-parameters"]&&"false"!==this["url-parameters"]&&(this.urlHandler=new Dl.A(this),this.onceReady().then((()=>{this.urlHandler.listenToChanges(),this.urlHandler._onParentChange()}))),this.onceAPIReady().then(this._postAPIInit.bind(this))}firstUpdated(){super.firstUpdated(),this._moveChildToGrid()}getClassName(){return"PhotoViewer"}onceReady(){return this.oncePSVReady().then((()=>this._initParams.getParentPostInit().picture&&!this.psv.getPictureMetadata()?this.onceFirstPicLoaded():Promise.resolve()))}render(){return[this.loader,this.grid,this.popup]}getSubComponentsNames(){return super.getSubComponentsNames().concat(["psv","grid","popup","urlHandler"])}oncePSVReady(){let Qe;return new Promise((rt=>{Qe=setInterval((()=>{this.psv&&"object"===typeof this.psv&&(this.psv.container?(clearInterval(Qe),rt()):this.psv.addEventListener&&this.psv.addEventListener("ready",(()=>{clearInterval(Qe),rt()}),{once:!0}))}),250)}))}onceFirstPicLoaded(){return this.oncePSVReady().then((()=>this.psv.getPictureMetadata()?Promise.resolve():new Promise((Qe=>{this.psv.addEventListener("picture-loaded",Qe,{once:!0})}))))}async _postAPIInit(){this.loader.setAttribute("value",30),this._createInitParamsHandler();const Qe=this._initParams.getParentPostInit();this._initPSV(),this._initWidgets(),(0,Zl.ai)(this,Qe),this._handleKeyboardManagement(),Qe.picture?this.psv.addEventListener("picture-loaded",(()=>this.loader.dismiss()),{once:!0}):this.loader.dismiss()}_initPSV(){try{this.psv=new Rl.Ay(this,this.psvContainer,{shouldGoFast:this._psvShouldGoFast.bind(this),keyboard:"always",keyboardActions:{...Co.zY.keyboardActions,8:"ROTATE_UP",2:"ROTATE_DOWN",4:"ROTATE_LEFT",6:"ROTATE_RIGHT",PageUp:()=>this.psv.goToNextPicture(),9:()=>this.psv.goToNextPicture(),PageDown:()=>this.psv.goToPrevPicture(),3:()=>this.psv.goToPrevPicture(),5:()=>this.moveCenter(),"*":()=>this.moveCenter(),Home:()=>this._toggleFocus(),7:()=>this._toggleFocus(),End:()=>this.mini.toggleAttribute("collapsed"),1:()=>this.mini.toggleAttribute("collapsed")," ":()=>this.psv.toggleSequencePlaying(),0:()=>this.psv.toggleSequencePlaying()},...this._initParams.getPSVInit()}),this.oncePSVReady().then((()=>{this.loader.setAttribute("value",50),(0,Zl.Vy)(this.psv,this._initParams.getPSVPostInit())}))}catch(Qe){let rt=Co.IJ.isWebGLSupported?this._t.pnx.error_psv:this._t.pnx.error_webgl;this.loader.dismiss(Qe,rt)}}_handleKeyboardManagement(){const keytonone=()=>this.psv.stopKeyboardControl(),keytopsv=()=>this.psv.startKeyboardControl();this.popup.addEventListener("open",(()=>keytonone())),this.popup.addEventListener("close",(()=>keytopsv()));for(let Qe of this.grid.childNodes)"bg"!==Qe.getAttribute("slot")&&(Qe.addEventListener("focusin",(()=>keytonone())),Qe.addEventListener("focusout",(()=>{null===this.popup.getAttribute("visible")&&keytopsv()})))}_psvShouldGoFast(){return this.psv._sequencePlaying&&this.psv.getTransitionDuration()<1e3}_moveChildToGrid(){Array.from(this.querySelectorAll("[slot]")).forEach((Qe=>{var rt;null!==(rt=Qe.tagName)&&void 0!==rt&&rt.toLowerCase().startsWith("pnx-")&&(Qe._parent=this,Qe._t=this._t),"editors"===Qe.getAttribute("slot")?this.onceReady().then((()=>{var rt;return null===(rt=this.legend)||void 0===rt?void 0:rt.appendChild(Qe)})):this.grid.appendChild(Qe)}))}setPopup(Qe){let rt=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;Qe?this.popup.setAttribute("visible",""):this.popup.removeAttribute("visible"),this.popup.innerHTML="","string"===typeof rt?this.popup.innerHTML=rt:Array.isArray(rt)&&rt.forEach((Qe=>this.popup.appendChild(Qe)))}_onPopupClose(){this.dispatchEvent(new CustomEvent("focus-changed",{detail:{focus:this.map&&this.isMapWide()?"map":"pic"}}))}_showQualityScoreDoc(){this.setPopup(!0,[(0,Ul.createWebComp)("pnx-quality-score-doc",{_t:this._t})])}_showReportForm(){if(!this.psv.getPictureMetadata())throw new Error("No picture currently selected");this.setPopup(!0,[(0,Ul.createWebComp)("pnx-report-form",{_parent:this})])}_showShareOptions(){this.setPopup(!0,[(0,Ul.createWebComp)("pnx-share-menu",{_parent:this})])}moveCenter(){this.psv.getPictureMetadata()&&this._psvAnimate({speed:Rl.LM,yaw:0,pitch:0,zoom:Rl.cS})}moveLeft(){this._moveToDirection("left")}moveRight(){this._moveToDirection("right")}moveUp(){this._moveToDirection("up")}moveDown(){this._moveToDirection("down")}_moveToDirection(Qe){let rt=this.psv.getPosition();switch(Qe){case"up":rt.pitch+=ql;break;case"left":rt.yaw-=ql;break;case"down":rt.pitch-=ql;break;case"right":rt.yaw+=ql}this._psvAnimate({speed:Rl.LM,...rt})}_psvAnimate(Qe){this._lastPsvAnim&&this._lastPsvAnim.cancel(),this._lastPsvAnim=this.psv.animate(Qe)}addEventListener(Qe,rt,Wn){super.addEventListener(Qe,rt,Wn)}}PhotoViewer.properties={psv:{converter:Ll.A.GetJSONConverter()},widgets:{type:String},"url-parameters":{type:String},...Ll.A.properties},customElements.define("pnx-photo-viewer",PhotoViewer)},8743:(Qe,rt,Wn)=>{"use strict";Wn.d(rt,{$:()=>Ql,A:()=>Viewer});Wn(9616);var Co=Wn(8340),Dl=Wn(3407),Ll=(Wn(9039),Wn(2771)),Rl=Wn(7343),Ul=Wn(5995),Gl=Wn(9683),Zl=Wn(2e3),Hl=Wn(9438),ql=Wn(2118);const Ql=20,Kl=(Math.PI,100);class Viewer extends Dl.A{constructor(){super(),this.map=!0,this.geocoder=this.getAttribute("geocoder")||"nominatim",this.mini=(0,Ul.createWebComp)("pnx-mini",{slot:"bottom-left",_parent:this,onexpand:this._onMiniExpand.bind(this),collapsed:!!(0,Rl.isNullId)(this.picture)||void 0}),this.mini.addEventListener("expand",this._toggleFocus.bind(this)),this.grid.appendChild(this.mini),this.mapContainer=document.createElement("div")}_createInitParamsHandler(){var Qe,rt;this._initParams=new ql.Ay(ql.Ay.GetComponentProperties(Viewer,this),Object.assign({},null===(Qe=this.urlHandler)||void 0===Qe?void 0:Qe.currentURLParams(),null===(rt=this.urlHandler)||void 0===rt?void 0:rt.currentURLParams(!0)),{map:(0,Co.getMapParamsFromLocalStorage)()})}_initWidgets(){var Qe,rt;"false"!==this._initParams.getParentPostInit().widgets&&(this.grid.appendChild((0,Ul.createWebComp)("pnx-widget-zoom",{slot:this.isWidthSmall()?"top-left":"bottom-right",class:this.isWidthSmall()?"pnx-only-map pnx-print-hidden":"pnx-print-hidden",_parent:this})),this.isWidthSmall()?(this.legend=(0,Ul.createWebComp)("pnx-picture-legend",{_parent:this}),this.bottomDrawer=(0,Ul.createWebComp)("pnx-bottom-drawer",{slot:"bottom",_parent:this,class:this._initParams.getParentPostInit().picture?void 0:"pnx-hidden"}),this.bottomDrawer.appendChild(this.legend),this.grid.appendChild(this.bottomDrawer),this.addEventListener("select",(Qe=>{(0,Rl.isNullId)(Qe.detail.picId)?this.bottomDrawer.classList.add("pnx-hidden"):this.bottomDrawer.classList.remove("pnx-hidden")}))):(this.legend=(0,Ul.createWebComp)("pnx-widget-legend",{slot:this.isWidthSmall()?"top":"top-left",_parent:this,focus:this._initParams.getParentPostInit().focus,picture:this._initParams.getParentPostInit().picture}),this.grid.appendChild(this.legend),this.grid.appendChild((0,Ul.createWebComp)("pnx-hashtags",{slot:"top-right",_parent:this,class:"pnx-only-psv pnx-print-hidden"}))),this.grid.appendChild((0,Ul.createWebComp)("pnx-widget-player",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden",size:this.isHeightSmall()?"md":"xl"})),this.grid.appendChild((0,Ul.createWebComp)("pnx-widget-geosearch",{slot:this.isWidthSmall()?"top-right":"top-left",_parent:this,class:"pnx-only-map pnx-print-hidden",geocoder:this._initParams.getParentPostInit().geocoder})),this.grid.appendChild((0,Ul.createWebComp)("pnx-widget-mapfilters",{slot:this.isWidthSmall()?"top-right":"top-left",_parent:this,"user-search":null!==this.api._endpoints.user_search&&null!==this.api._endpoints.user_tiles,"quality-score":(null===(Qe=this.map)||void 0===Qe||null===(rt=Qe._hasQualityScore)||void 0===rt?void 0:rt.call(Qe))||!1,class:"pnx-only-map pnx-print-hidden"})),this.grid.appendChild((0,Ul.createWebComp)("pnx-widget-maplayers",{slot:"top-right",_parent:this,class:"pnx-only-map pnx-print-hidden"})))}getClassName(){return"Viewer"}getSubComponentsNames(){return super.getSubComponentsNames().concat(["mini","map"])}onceReady(){return Promise.all([this.oncePSVReady(),this.onceMapReady()]).then((()=>this._initParams.getParentPostInit().picture&&!this.psv.getPictureMetadata()?this.onceFirstPicLoaded():Promise.resolve()))}attributeChangedCallback(Qe,rt,Wn){var Co,Dl,Ll,Ul;(super.attributeChangedCallback(Qe,rt,Wn),"picture"===Qe)&&(null===(Co=this.legend)||void 0===Co||null===(Dl=Co.setAttribute)||void 0===Dl||Dl.call(Co,"picture",Wn),(0,Rl.isNullId)(rt)&&!(0,Rl.isNullId)(Wn)&&this.mini.removeAttribute("collapsed"),(0,Rl.isNullId)(Wn)?this.map&&this.isMapWide()?this.mini.classList.add("pnx-hidden"):this.map&&!this.isMapWide()&&this._setFocus("map"):(this.mini.classList.remove("pnx-hidden"),(0,Rl.isNullId)(rt)&&(this._setFocus("pic"),"closed"===(null===(Ll=this.bottomDrawer)||void 0===Ll||null===(Ul=Ll.getAttribute)||void 0===Ul?void 0:Ul.call(Ll,"openness"))&&this.bottomDrawer.setAttribute("openness","half-opened"))));"focus"===Qe&&this._setFocus(Wn)}onceMapReady(){if(!this.map)return Promise.resolve();let Qe;return new Promise((rt=>{Qe=setInterval((()=>{var Wn,Co,Dl;"object"===typeof this.map&&(null!==(Wn=this.map)&&void 0!==Wn&&null!==(Co=Wn.loaded)&&void 0!==Co&&Co.call(Wn)?(clearInterval(Qe),rt()):null!==(Dl=this.map)&&void 0!==Dl&&Dl.once&&this.map.once("render",(()=>{clearInterval(Qe),rt()})))}),250)}))}async _initMap(){await new Promise((Qe=>{this.map=new Ll.A(this,this.mapContainer,this._initParams.getMapInit()),(0,Co.saveMapParamsToLocalStorage)(this.map),this.map.once("users-changed",(()=>{this.loader.setAttribute("value",75),Qe()}))})),await(0,ql.mK)(this.map,this._initParams.getMapPostInit()),(0,Co.initMapKeyboardHandler)(this),(0,Co.linkMapAndPhoto)(this)}async _postAPIInit(){this.loader.setAttribute("value",30),this._createInitParamsHandler();const Qe=this._initParams.getParentPostInit();this._initPSV(),await this._initMap(),this._initWidgets(),this._moveChildToGrid(),(0,ql.iz)(this,Qe),this._handleKeyboardManagement(),Qe.picture?this.psv.addEventListener("picture-loaded",(()=>{(0,ql.iz)(this,Qe),this.loader.dismiss()}),{once:!0}):this.loader.dismiss()}_handleKeyboardManagement(){const keytomap=()=>{this.psv.stopKeyboardControl(),this.map.keyboard.enable()},keytopsv=()=>{this.psv.startKeyboardControl(),this.map.keyboard.disable()},keytonone=()=>{this.psv.stopKeyboardControl(),this.map.keyboard.disable()},keytofocused=()=>{this.map&&this.isMapWide()?keytomap():keytopsv()};this.addEventListener("focus-changed",(Qe=>{"map"===Qe.detail.focus&&keytomap(),this.popup.getAttribute("visible")?keytonone():keytopsv()})),this.popup.addEventListener("open",(()=>keytonone())),this.popup.addEventListener("close",(()=>keytofocused()));for(let Qe of this.grid.childNodes)"bg"!==Qe.getAttribute("slot")&&(Qe.addEventListener("focusin",(()=>keytonone())),Qe.addEventListener("focusout",(()=>{null===this.popup.getAttribute("visible")&&keytofocused()})))}moveCenter(){const Qe=this.psv.getPictureMetadata();Qe&&(this.map&&this.isMapWide()?this.map.flyTo({center:Qe.gps,zoom:20}):super.moveCenter())}_moveToDirection(Qe){if(this.map&&this.isMapWide()){let rt;switch(Qe){case"up":rt=[0,-100];break;case"left":rt=[-100,0];break;case"down":rt=[0,Kl];break;case"right":rt=[Kl,0]}this.map.panBy(rt)}else super._moveToDirection(Qe)}isMapWide(){return this.mapContainer.parentNode==this.grid}_setFocus(Qe){var rt,Wn,Co,Dl;let Ll=arguments.length>1&&void 0!==arguments[1]&&arguments[1],Hl=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("map"===Qe&&!this.map)throw new Error("Map is not enabled");if(!["map","pic"].includes(Qe))throw new Error("Invalid focus value (should be pic or map)");if(this.focus=Qe,(Hl||("map"!==Qe||!this.map||!this.isMapWide())&&("pic"!==Qe||this.map&&this.isMapWide()))&&("map"===Qe?(this.psvContainer.parentNode==this.grid&&(this.grid.removeChild(this.psvContainer),this.psvContainer.removeAttribute("slot")),this.mapContainer.parentNode==this.mini&&this.mini.removeChild(this.mapContainer),this.mapContainer.setAttribute("slot","bg"),this.grid.appendChild(this.mapContainer),this.mini.appendChild(this.psvContainer),this.mini.icon=(0,Ul.fa)(Gl.pt),(0,Rl.isNullId)(this.picture)?this.mini.classList.add("pnx-hidden"):this.mini.classList.remove("pnx-hidden"),this.map.getCanvas().focus()):(this.mapContainer.parentNode==this.grid&&(this.grid.removeChild(this.mapContainer),this.mapContainer.removeAttribute("slot")),this.psvContainer.parentNode==this.mini&&this.mini.removeChild(this.psvContainer),this.psvContainer.setAttribute("slot","bg"),this.grid.appendChild(this.psvContainer),this.mini.classList.remove("pnx-hidden"),this.mini.appendChild(this.mapContainer),this.mini.icon=(0,Ul.fa)(Zl.e5),this.psvContainer.focus()),null===this||void 0===this||null===(rt=this.map)||void 0===rt||null===(Wn=rt.resize)||void 0===Wn||Wn.call(rt),this.psv.autoSize(),this.psv.forceRefresh(),null===(Co=this.legend)||void 0===Co||null===(Dl=Co.setAttribute)||void 0===Dl||Dl.call(Co,"focus",this.focus),!Ll)){const rt=new CustomEvent("focus-changed",{detail:{focus:Qe}});this.dispatchEvent(rt)}}_toggleFocus(){this._setFocus(this.isMapWide()?"pic":"map")}_onMiniExpand(){this.map.resize(),this.psv.autoSize()}_onMapFiltersChange(){var Qe;const rt=(0,Hl.qi)("#pnx-map-filters-menu"),Wn=null===rt||void 0===rt?void 0:rt.shadowRoot.getElementById("pnx-filter-date-from"),Co=null===rt||void 0===rt?void 0:rt.shadowRoot.getElementById("pnx-filter-date-end"),Dl=null===rt||void 0===rt?void 0:rt.shadowRoot.querySelectorAll("input[name='pnx-filter-type']"),Ll=(0,Hl.qi)("#pnx-map-theme");let Rl="";for(let Zl=0;Zl<Dl.length;Zl++){const Qe=Dl[Zl];if(Qe.checked){Rl=Qe.value;break}}let Ul=[];if(null!==(Qe=this.map)&&void 0!==Qe&&Qe._hasQualityScore()){const Qe=null===rt||void 0===rt?void 0:rt.shadowRoot.getElementById("pnx-filter-qualityscore");Ul=((null===Qe||void 0===Qe?void 0:Qe.grade)||"").split(",").map((Qe=>parseInt(Qe))).filter((Qe=>!isNaN(Qe))),5==Ul.length&&(Ul=[])}const Gl={minDate:null===Wn||void 0===Wn?void 0:Wn.value,maxDate:null===Co||void 0===Co?void 0:Co.value,pic_type:Rl,theme:null===Ll||void 0===Ll?void 0:Ll.value,qualityscore:Ul};this.map.setFilters(Gl)}}Viewer.properties={map:{converter:Dl.A.GetJSONConverter()},focus:{type:String,reflect:!0},geocoder:{type:String},...Dl.A.properties},customElements.define("pnx-viewer",Viewer)},3921:(Qe,rt,Wn)=>{"use strict";Wn.r(rt),Wn.d(rt,{Basic:()=>Co.A,CoverageMap:()=>Dl.A,Editor:()=>Ll.A,PhotoViewer:()=>Ul.A,Viewer:()=>Rl.A});var Co=Wn(9039),Dl=Wn(153),Ll=Wn(1752),Rl=Wn(8743),Ul=Wn(3407)},9341:(Qe,rt,Wn)=>{"use strict";Wn.r(rt),Wn.d(rt,{core:()=>Co,layout:()=>Dl,menus:()=>Ll,ui:()=>Rl});var Co=Wn(3921),Dl=Wn(456),Ll=Wn(8794),Rl=Wn(9472)},6784:(Qe,rt,Wn)=>{"use strict";Wn.d(rt,{A:()=>BottomDrawer});var Co=Wn(4542),Dl=Wn(1198);const Ll={opened:0,"half-opened":.7,closed:1};class BottomDrawer extends Co.WF{constructor(){super(),this._isDragging=!1,this.openness="half-opened"}firstUpdated(){var Qe;super.firstUpdated(),this._boundTouchMove=this._onTouchMove.bind(this),this._boundTouchEnd=this._onTouchEnd.bind(this),this._drawerHeight=window.innerHeight-30;const rt=this._getDrawer();rt&&(rt.style.height=`${this._drawerHeight}px`,rt.style.maxHeight=`${this._drawerHeight}px`,null===(Qe=this._parent)||void 0===Qe||Qe.onceReady().then((()=>{var Qe,rt;null===(Qe=this._parent.map)||void 0===Qe||Qe.addEventListener("click",(()=>this.openness="closed")),null===(rt=this._parent.psv)||void 0===rt||rt.addEventListener("click",(()=>this.openness="closed"))})))}attributeChangedCallback(Qe,rt,Wn){if(super.attributeChangedCallback(Qe,rt,Wn),"openness"===Qe){if("opened"!==Wn){const Qe=this.shadowRoot.querySelector(".content");Qe&&(Qe.scrollTop=0)}const Qe=this._getDrawer();Qe&&(Qe.style.transform=null)}}disconnectedCallback(){super.disconnectedCallback(),this._cleanupTouchListeners()}_getDrawer(){var Qe;return null===(Qe=this.shadowRoot)||void 0===Qe?void 0:Qe.querySelector(".drawer")}_onHandleClick(){"opened"===this.openness?this.openness="closed":"half-opened"===this.openness?this.openness="opened":"closed"===this.openness&&(this.openness="half-opened")}_onTouchStart(Qe){this._isDragging=!0,this._startFingerY=Qe.touches[0].clientY,this._deltaFingerY=0,this._drawerY=this._drawerHeight*Ll[this.openness],window.addEventListener("touchmove",this._boundTouchMove,{passive:!0}),window.addEventListener("touchend",this._boundTouchEnd),window.addEventListener("touchcancel",this._boundTouchEnd)}_onTouchMove(Qe){if(!this._isDragging)return;const rt=this.shadowRoot.querySelector(".content");rt.scrollHeight>rt.offsetHeight&&rt.scrollTop>0?this._updateDrawerTransform(0):(this._deltaFingerY=Qe.touches[0].clientY-this._startFingerY,this._updateDrawerTransform(this._drawerY+this._deltaFingerY))}_onTouchEnd(Qe){(this._isDragging&&!(Math.abs(this._deltaFingerY)<30)||Qe.target.closest(".handle"))&&(Qe.preventDefault(),this._isDragging=!1,0===this._deltaFingerY&&"closed"===this.openness?this.openness="half-opened":this._updateDrawerTransform(this._drawerY+this._deltaFingerY,!0),this._cleanupTouchListeners(),this._startFingerY=null,this._deltaFingerY=null)}_cleanupTouchListeners(){window.removeEventListener("touchmove",this._boundTouchMove),window.removeEventListener("touchend",this._boundTouchEnd),window.removeEventListener("touchcancel",this._boundTouchCancel)}_updateDrawerTransform(Qe){let rt=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const Wn=this._getDrawer();Wn&&(Qe=Math.max(0,Math.min(Qe,this._drawerHeight-30)),rt&&(this._deltaFingerY<0?"closed"===this.openness?Math.abs(this._deltaFingerY)>this._drawerHeight*(1-Ll["half-opened"])?this.openness="opened":this.openness="half-opened":this.openness="opened":this.openness="closed",this._drawerY=null,Qe=Math.max(0,Math.min(Ll[this.openness]*this._drawerHeight,this._drawerHeight-30))),Wn.style.transform=`translateY(${Qe}px)`)}render(){const Qe={drawer:!0,[this.openness]:!0,dragging:this._isDragging};return Co.qy`
12
+ !function(Qe,rt){"object"===typeof exports&&"object"===typeof module?module.exports=rt():"function"===typeof define&&define.amd?define("Panoramax",[],rt):"object"===typeof exports?exports.Panoramax=rt():Qe.Panoramax=rt()}(this,(()=>(()=>{var Qe={9039:(Qe,rt,Wn)=>{"use strict";Wn.d(rt,{A:()=>Basic});var Co=Wn(4542),Dl=Wn(5254),Ll=Wn(4964),Rl=Wn(8340),Ul=Wn(5995),Gl=Wn(7343),Zl=Wn(2614),Hl=Wn.n(Zl),ql=Wn(8330);Wn(1865),Wn(3638);class Basic extends Co.WF{constructor(){let Qe=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),this.users=["geovisio"],this.mapstyle=this.getAttribute("mapstyle")||Rl.DEFAULT_TILES,this.lang=this.getAttribute("lang")||null,this.endpoint=this.getAttribute("endpoint")||null,this.picture=this.getAttribute("picture")||null,this.sequence=this.getAttribute("sequence")||null,console.info(`\ud83d\udcf7 Panoramax ${this.getClassName()} - Version ${ql.rE} (39c7714)\n\n\ud83c\udd98 Issues can be reported at ${ql.Jk.O}`),Qe||(this._isInternetFast=null,(0,Gl.isInternetFast)().then((Qe=>this._isInternetFast=Qe)))}connectedCallback(){super.connectedCallback(),this._t=(0,Ll.getTranslations)(this.lang),this.loader=(0,Ul.createWebComp)("pnx-loader",{_parent:this,"no-label":(0,Gl.isInIframe)()}),this._loadsAPI&&this.endpoint&&this._loadsAPI===this.endpoint||this.api&&this.api._endpoint===this.endpoint||!this.endpoint||((this._loadsAPI||this.api)&&(delete this.api,delete this._loadsAPI),this._setupAPI())}_setupAPI(){if(this.loader=this.loader||(0,Ul.createWebComp)("pnx-loader",{_parent:this}),!this.endpoint)return void console.warn("No endpoint is defined");this._loadsAPI=this.endpoint;let Qe=this.endpoint;try{this.mapstyle=JSON.parse(this.mapstyle)}catch(Wn){}try{this.api=new Dl.A(this.endpoint,{users:this.users,fetch:this.fetchOptions,style:this.mapstyle}),this.api.onceReady().then((()=>{if(Qe!=this._loadsAPI||!this.api)return;let rt=this.api.getUnavailableFeatures(),Wn=this.api.getAvailableFeatures();Wn=0===rt.length?"\u2705 All features available":"\u2705 Available features: "+Wn.join(", "),rt=0===rt.length?"":"\ud83d\udeab Unavailable features: "+rt.join(", "),console.info(`\ud83c\udf10 Connected to API "${this.api._metadata.name}" (${this.api._endpoint})\n\u2139\ufe0f API runs STAC ${this.api._metadata.stac_version} ${this.api._metadata.geovisio_version?"& GeoVisio "+this.api._metadata.geovisio_version:""}\n ${Wn}\n ${rt}\n`.trim())})).catch((Qe=>this.loader.dismiss(Qe,this._t.pnx.error_api))).finally((()=>delete this._loadsAPI))}catch(Wn){var rt;delete this._loadsAPI,null!==(rt=this.loader)&&void 0!==rt&&rt.dismiss?this.loader.dismiss(Wn,this._t.pnx.error_api):console.error(Wn)}}onceReady(){throw new Error("You must override this method on sub-class")}onceAPIReady(){return this.api?this.api.onceReady():new Promise((Qe=>setTimeout(Qe,100))).then(this.onceAPIReady.bind(this))}createRenderRoot(){return this}attributeChangedCallback(Qe,rt,Wn){if(super.attributeChangedCallback(Qe,rt,Wn),"endpoint"===Qe&&(this._loadsAPI&&Wn&&this._loadsAPI===Wn||this.api&&this.api._endpoint===Wn||!Wn||((this._loadsAPI||this.api)&&(delete this.api,delete this._loadsAPI),this._setupAPI())),["picture","sequence"].includes(Qe)){let Co,Dl,Ll,Rl;"picture"===Qe?(Co=this.sequence,Ll=this.sequence,Dl=Wn,Rl=rt):(Co=Wn,Ll=rt,Dl=this.picture,Rl=this.picture),this.dispatchEvent(new CustomEvent("select",{bubbles:!0,composed:!0,detail:{seqId:Co,picId:Dl,prevSeqId:Ll,prevPicId:Rl}}))}}getClassName(){return"Basic"}select(){let Qe=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,rt=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;arguments.length>2&&void 0!==arguments[2]&&arguments[2]&&(this.picture=null,this.sequence=null),this.picture=rt,this.sequence=Qe}isWidthSmall(){return(null===this||void 0===this?void 0:this.offsetWidth)<576}isHeightSmall(){return(null===this||void 0===this?void 0:this.offsetHeight)<400}render(){return Co.qy`<p>Should not be used directly, use Viewer/CoverageMap/Editor instead</p>`}getSubComponentsNames(){return["loader","api"]}addEventListener(Qe,rt,Wn){let Co=Qe.split(":").shift();if(Co&&this.getSubComponentsNames().includes(Co)){var Dl;const Ll=Qe.substring(Co.length+1);null!==(Dl=this[Co])&&void 0!==Dl&&Dl.addEventListener?this[Co].addEventListener(Ll,rt,Wn):setTimeout((()=>this.addEventListener(Qe,rt,Wn)),50)}else super.addEventListener(Qe,rt,Wn)}static GetJSONConverter(){return{fromAttribute:Qe=>"object"===typeof Qe?Qe:Hl().parse(Qe),toAttribute:Qe=>JSON.stringify(Qe)}}}Basic.properties={picture:{type:String,reflect:!0},sequence:{type:String,reflect:!0},fetchOptions:{converter:Basic.GetJSONConverter()},users:{type:Array,reflect:!0},mapstyle:{type:String},lang:{type:String},endpoint:{type:String}}},153:(Qe,rt,Wn)=>{"use strict";Wn.d(rt,{A:()=>CoverageMap});var Co=Wn(9039),Dl=Wn(5642),Ll=Wn(8340),Rl=Wn(927),Ul=(Wn(7776),Wn(2118));class CoverageMap extends Co.A{constructor(){super(),this._mapContainer=document.createElement("div"),this.onceAPIReady().then((()=>{this.loader.setAttribute("value",30),this._initParams=new Ul.Ay(Ul.Ay.GetComponentProperties(CoverageMap,this)),this._initMap()}))}getClassName(){return"CoverageMap"}onceReady(){return this.map&&this.map.waitForEnoughMapLoaded?this.map.waitForEnoughMapLoaded():new Promise((Qe=>setTimeout(Qe,100))).then(this.onceReady.bind(this))}render(){return[this.loader,this._mapContainer]}getSubComponentsNames(){const Qe=super.getSubComponentsNames();return Qe.push("map"),Qe}_initMap(){class MyMap extends Dl.A{_getLayerStyleProperties(Qe){return"pictures_symbols"===Qe?{layout:{visibility:"none"}}:super._getLayerStyleProperties(Qe)}}this.map=new MyMap(this,this._mapContainer,Object.assign({},this._initParams.getMapInit(),{hash:!0})),this.map.addControl(new Rl.NavigationControl({showCompass:!1})),this.loader.setAttribute("value",70),this.addEventListener("select",this._onSelect.bind(this)),this.map.on("picture-click",(Qe=>this.select(Qe.seqId,Qe.picId))),this.map.on("sequence-click",(Qe=>this.select(Qe.seqId))),this.map.waitForEnoughMapLoaded().then((async()=>{await(0,Ul.mK)(this.map,this._initParams.getMapPostInit()),this.map.reloadLayersStyles(),this.loader.dismiss()}))}_onSelect(Qe){if(Qe.detail.picId||Qe.detail.seqId){const rt=Qe.detail.picId?"pictures":"sequences",Wn=this.map.queryRenderedFeatures({layers:[...this.map._userLayers].map((Qe=>(0,Ll.getUserLayerId)(Qe,rt))),filter:["==",["get","id"],Qe.detail.picId||Qe.detail.seqId]});Wn.length>=0&&null!=Wn[0]&&this.map._attachPreviewToPictures({features:Wn},rt)}}}CoverageMap.properties={map:{converter:Co.A.GetJSONConverter()},...Co.A.properties},customElements.define("pnx-coverage-map",CoverageMap)},1752:(Qe,rt,Wn)=>{"use strict";Wn.d(rt,{A:()=>Editor});Wn(7365);var Co=Wn(9039),Dl=Wn(5642),Ll=Wn(9048),Rl=(Wn(7534),Wn(6810),Wn(508)),Ul=Wn(8340),Gl=Wn(1545),Zl=(Wn(4542),Wn(5995));const Hl="sequence-headings";class Editor extends Co.A{constructor(){super(),this.raster=null,this.background="streets",this.users=[],this._psvContainer=document.createElement("div"),this._mapContainer=document.createElement("div"),this.onceAPIReady().then((()=>{this.loader.setAttribute("value",30),this.sequence||this.loader.dismiss({},"No sequence is selected"),this.addEventListener("select",this._onSelect.bind(this)),this._initPSV(),this._initMap()}))}getClassName(){return"Editor"}onceReady(){var Qe,rt;return this.map&&this.psv&&null!==(Qe=(rt=this.map).loaded)&&void 0!==Qe&&Qe.call(rt)?Promise.resolve():new Promise((Qe=>setTimeout(Qe,100))).then(this.onceReady.bind(this))}connectedCallback(){Array.isArray(this.users)&&this.users.length>0&&(console.warn("Parameters users can't be changed in Editor, only selected sequence can be visible"),this.users=[]),super.connectedCallback()}attributeChangedCallback(Qe,rt,Wn){"users"===Qe&&Array.isArray(Wn)&&Wn.length>0?console.warn("Parameters users can't be changed in Editor, only selected sequence can be visible"):super.attributeChangedCallback(Qe,rt,Wn)}render(){return[this.loader,this._psvContainer,this._mapContainer]}getSubComponentsNames(){return super.getSubComponentsNames().concat(["map","psv"])}_initPSV(){try{this.psv=new Ll.Ay(this,this._psvContainer),this.psv._myVTour.datasource.nodeResolver=this._getNode.bind(this)}catch(Qe){let rt=Gl.IJ.isWebGLSupported?this._t.pnx.error_psv:this._t.pnx.error_webgl;this.loader.dismiss(Qe,rt)}}_initMap(){try{this.map=new Dl.A(this,this._mapContainer,{raster:this.raster,background:this.background,supplementaryStyle:this._createMapStyle(),zoom:15}),(0,Ul.linkMapAndPhoto)(this),this.loader.setAttribute("value",50),this._loadSequence(),this.map.once("load",(()=>{this.map.hasTwoBackgrounds()&&this._addMapBackgroundWidget(),this._bindPicturesEvents()}));const Qe=this.map._picMarker.setRotation.bind(this.map._picMarker);this.map._picMarker.setRotation=rt=>(rt=void 0===this._lastRelHeading?rt:rt+this._lastRelHeading-this.psv.getPictureRelativeHeading(),Qe(rt))}catch(Qe){this.loader.dismiss(Qe,this._t.pnx.error_psv)}}_createMapStyle(){return{sources:{geovisio_editor_sequences:{type:"geojson",data:{type:"FeatureCollection",features:[]}}},layers:[{id:"geovisio_editor_sequences",type:"line",source:"geovisio_editor_sequences",layout:{...Ul.VECTOR_STYLES.SEQUENCES.layout},paint:{...Ul.VECTOR_STYLES.SEQUENCES.paint}},{id:"geovisio_editor_pictures",type:"circle",source:"geovisio_editor_sequences",layout:{...Ul.VECTOR_STYLES.PICTURES.layout},paint:{...Ul.VECTOR_STYLES.PICTURES.paint}}]}}_bindPicturesEvents(){this.map.on("mousemove","geovisio_editor_pictures",(()=>{this.map.getCanvas().style.cursor="pointer"})),this.map.on("mouseleave","geovisio_editor_pictures",(()=>{this.map.getCanvas().style.cursor=""})),this.map.on("click","geovisio_editor_pictures",this.map._onPictureClick.bind(this.map))}_loadSequence(){return this.loader.setAttribute("value",60),this.api.getSequenceItems(this.sequence).then((Qe=>{if(this.loader.setAttribute("value",80),this.map.once("sourcedata",(()=>{this.map.setPaintProperty("geovisio_editor_sequences","line-color",this.map._getLayerColorStyle("sequences")),this.map.setPaintProperty("geovisio_editor_pictures","circle-color",this.map._getLayerColorStyle("pictures")),this.map.setLayoutProperty("geovisio_editor_sequences","visibility","visible"),this.map.setLayoutProperty("geovisio_editor_pictures","visibility","visible"),this.map.once("styledata",(()=>this.loader.dismiss()))})),this._sequenceData=Qe.features,this.map.getSource("geovisio_editor_sequences").setData({type:"FeatureCollection",features:[{type:"Feature",properties:{id:this.sequence},geometry:{type:"LineString",coordinates:Qe.features.map((Qe=>Qe.geometry.coordinates))}},...Qe.features.map((Qe=>(Qe.properties.id=Qe.id,Qe.properties.sequences=[this.sequence],Qe)))]}),this.picture){const rt=Qe.features.find((Qe=>Qe.id===this.picture));rt?(this.select(this.sequence,this.picture,!0),this.map.jumpTo({center:rt.geometry.coordinates,zoom:18})):console.log("Picture with ID",rt,"was not found")}else{const rt=[...Qe.features[0].geometry.coordinates,...Qe.features[0].geometry.coordinates];for(let Wn=1;Wn<Qe.features.length;Wn++){const Co=Qe.features[Wn].geometry.coordinates;Co[0]<rt[0]&&(rt[0]=Co[0]),Co[1]<rt[1]&&(rt[1]=Co[1]),Co[0]>rt[2]&&(rt[2]=Co[0]),Co[1]>rt[3]&&(rt[3]=Co[1])}this.map.fitBounds(rt,{animate:!1})}})).catch((Qe=>this.loader.dismiss(Qe,this._t.pnx.error_api)))}_getNode(Qe){const rt=this._sequenceData.find((rt=>rt.properties.id===Qe)),Wn=rt?(0,Rl.apiFeatureToPSVNode)(rt,this._t,this._isInternetFast):null;return Wn&&delete Wn.links,Wn}_addMapBackgroundWidget(){const Qe=(0,Zl.createWebComp)("pnx-map-background",{_parent:this,size:"sm"});this._mapContainer.appendChild(Qe)}previewSequenceHeadingChange(Qe){const rt=void 0!==this.map.getLayer(Hl);if(this.map._picMarkerPreview.remove(),void 0===Qe)return delete this._lastRelHeading,rt&&this.map.setLayoutProperty(Hl,"visibility","none"),void(this.picture&&this.map._picMarker.setRotation(this.psv.getXY().x));this._lastRelHeading=Qe,rt||this.map.addLayer({id:Hl,type:"symbol",source:"geovisio_editor_sequences",layout:{"icon-image":"pnx-marker","icon-overlap":"always","icon-size":.8}});const Wn=-this.psv.getPictureRelativeHeading();this.map.setLayoutProperty(Hl,"visibility","visible"),this.map.setLayoutProperty(Hl,"icon-rotate",["+",["get","view:azimuth"],Wn,Qe]);const Co=[["==",["geometry-type"],"Point"]];this.picture&&Co.push(["!=",["get","id"],this.picture]),this.map.setFilter(Hl,["all",...Co]),this.picture&&this.map._picMarker.setRotation(this.psv.getXY().x)}_onSelect(){void 0!==this._lastRelHeading&&this.previewSequenceHeadingChange(this._lastRelHeading)}}Editor.properties={raster:{converter:Co.A.GetJSONConverter()},background:{type:String},...Co.A.properties},customElements.define("pnx-editor",Editor)},3407:(Qe,rt,Wn)=>{"use strict";Wn.d(rt,{A:()=>PhotoViewer});Wn(970);var Co=Wn(1545),Dl=Wn(4451),Ll=Wn(9039),Rl=Wn(9048),Ul=Wn(5995),Gl=Wn(7343),Zl=Wn(2118),Hl=Wn(4207);const ql=Math.PI/6;class PhotoViewer extends Ll.A{constructor(){super(),this.psv={},this["url-parameters"]=this.getAttribute("url-parameters")||!0,this.widgets=this.getAttribute("widgets")||"true",this.grid=(0,Ul.createWebComp)("pnx-cornered-grid"),this.psvContainer=document.createElement("div"),this.psvContainer.setAttribute("slot","bg"),this.grid.appendChild(this.psvContainer),this.popup=(0,Ul.createWebComp)("pnx-popup",{_parent:this,onclose:this._onPopupClose.bind(this)})}_createInitParamsHandler(){var Qe,rt;this._initParams=new Zl.Ay(Zl.Ay.GetComponentProperties(PhotoViewer,this),Object.assign({},null===(Qe=this.urlHandler)||void 0===Qe?void 0:Qe.currentURLParams(),null===(rt=this.urlHandler)||void 0===rt?void 0:rt.currentURLParams(!0)),{})}_initWidgets(){"false"!==this._initParams.getParentPostInit().widgets&&(this.grid.appendChild((0,Ul.createWebComp)("pnx-widget-player",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden",size:this.isHeightSmall()?"md":"xl"})),this.isWidthSmall()?(this.legend=(0,Ul.createWebComp)("pnx-picture-legend",{_parent:this}),this.bottomDrawer=(0,Ul.createWebComp)("pnx-bottom-drawer",{slot:"bottom",_parent:this,class:this._initParams.getParentPostInit().picture?void 0:"pnx-hidden"}),this.bottomDrawer.appendChild(this.legend),this.grid.appendChild(this.bottomDrawer),this.addEventListener("select",(Qe=>{(0,Gl.isNullId)(Qe.detail.picId)?this.bottomDrawer.classList.add("pnx-hidden"):this.bottomDrawer.classList.remove("pnx-hidden")}))):(this.legend=(0,Ul.createWebComp)("pnx-widget-legend",{slot:this.isWidthSmall()?void 0:"top-left",_parent:this,focus:this._initParams.getParentPostInit().focus,picture:this._initParams.getParentPostInit().picture}),this.grid.appendChild((0,Ul.createWebComp)("pnx-widget-zoom",{slot:"bottom-right",class:"pnx-print-hidden",_parent:this})),this.grid.appendChild(this.legend),this.grid.appendChild((0,Ul.createWebComp)("pnx-hashtags",{slot:"top-right",_parent:this,class:"pnx-only-psv pnx-print-hidden"}))))}connectedCallback(){super.connectedCallback(),this.presetsManager=new Hl.A(this.lang),this["url-parameters"]&&"false"!==this["url-parameters"]&&(this.urlHandler=new Dl.A(this),this.onceReady().then((()=>{this.urlHandler.listenToChanges(),this.urlHandler._onParentChange()}))),this.onceAPIReady().then(this._postAPIInit.bind(this))}firstUpdated(){super.firstUpdated(),this._moveChildToGrid()}getClassName(){return"PhotoViewer"}onceReady(){return this.oncePSVReady().then((()=>this._initParams.getParentPostInit().picture&&!this.psv.getPictureMetadata()?this.onceFirstPicLoaded():Promise.resolve()))}render(){return[this.loader,this.grid,this.popup]}getSubComponentsNames(){return super.getSubComponentsNames().concat(["psv","grid","popup","urlHandler"])}oncePSVReady(){let Qe;return new Promise((rt=>{Qe=setInterval((()=>{this.psv&&"object"===typeof this.psv&&(this.psv.container?(clearInterval(Qe),rt()):this.psv.addEventListener&&this.psv.addEventListener("ready",(()=>{clearInterval(Qe),rt()}),{once:!0}))}),250)}))}onceFirstPicLoaded(){return this.oncePSVReady().then((()=>this.psv.getPictureMetadata()?Promise.resolve():new Promise((Qe=>{this.psv.addEventListener("picture-loaded",Qe,{once:!0})}))))}async _postAPIInit(){this.loader.setAttribute("value",30),this._createInitParamsHandler();const Qe=this._initParams.getParentPostInit();this._initPSV(),this._initWidgets(),(0,Zl.ai)(this,Qe),this._handleKeyboardManagement(),Qe.picture?this.psv.addEventListener("picture-loaded",(()=>this.loader.dismiss()),{once:!0}):this.loader.dismiss()}_initPSV(){try{this.psv=new Rl.Ay(this,this.psvContainer,{shouldGoFast:this._psvShouldGoFast.bind(this),keyboard:"always",keyboardActions:{...Co.zY.keyboardActions,8:"ROTATE_UP",2:"ROTATE_DOWN",4:"ROTATE_LEFT",6:"ROTATE_RIGHT",PageUp:()=>this.psv.goToNextPicture(),9:()=>this.psv.goToNextPicture(),PageDown:()=>this.psv.goToPrevPicture(),3:()=>this.psv.goToPrevPicture(),5:()=>this.moveCenter(),"*":()=>this.moveCenter(),Home:()=>this._toggleFocus(),7:()=>this._toggleFocus(),End:()=>this.mini.toggleAttribute("collapsed"),1:()=>this.mini.toggleAttribute("collapsed")," ":()=>this.psv.toggleSequencePlaying(),0:()=>this.psv.toggleSequencePlaying()},...this._initParams.getPSVInit()}),this.oncePSVReady().then((()=>{this.loader.setAttribute("value",50),(0,Zl.Vy)(this.psv,this._initParams.getPSVPostInit())}))}catch(Qe){let rt=Co.IJ.isWebGLSupported?this._t.pnx.error_psv:this._t.pnx.error_webgl;this.loader.dismiss(Qe,rt)}}_handleKeyboardManagement(){const keytonone=()=>this.psv.stopKeyboardControl(),keytopsv=()=>this.psv.startKeyboardControl();this.popup.addEventListener("open",(()=>keytonone())),this.popup.addEventListener("close",(()=>keytopsv()));for(let Qe of this.grid.childNodes)"bg"!==Qe.getAttribute("slot")&&(Qe.addEventListener("focusin",(()=>keytonone())),Qe.addEventListener("focusout",(()=>{null===this.popup.getAttribute("visible")&&keytopsv()})))}_psvShouldGoFast(){return this.psv._sequencePlaying&&this.psv.getTransitionDuration()<1e3}_moveChildToGrid(){Array.from(this.querySelectorAll("[slot]")).forEach((Qe=>{var rt;null!==(rt=Qe.tagName)&&void 0!==rt&&rt.toLowerCase().startsWith("pnx-")&&(Qe._parent=this,Qe._t=this._t),"editors"===Qe.getAttribute("slot")?this.onceReady().then((()=>{var rt;return null===(rt=this.legend)||void 0===rt?void 0:rt.appendChild(Qe)})):this.grid.appendChild(Qe)}))}setPopup(Qe){let rt=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;Qe?this.popup.setAttribute("visible",""):this.popup.removeAttribute("visible"),this.popup.innerHTML="","string"===typeof rt?this.popup.innerHTML=rt:Array.isArray(rt)&&rt.forEach((Qe=>this.popup.appendChild(Qe)))}_onPopupClose(){this.dispatchEvent(new CustomEvent("focus-changed",{detail:{focus:this.map&&this.isMapWide()?"map":"pic"}}))}_showQualityScoreDoc(){this.setPopup(!0,[(0,Ul.createWebComp)("pnx-quality-score-doc",{_t:this._t})])}_showReportForm(){if(!this.psv.getPictureMetadata())throw new Error("No picture currently selected");this.setPopup(!0,[(0,Ul.createWebComp)("pnx-report-form",{_parent:this})])}_showShareOptions(){this.setPopup(!0,[(0,Ul.createWebComp)("pnx-share-menu",{_parent:this})])}moveCenter(){this.psv.getPictureMetadata()&&this._psvAnimate({speed:Rl.LM,yaw:0,pitch:0,zoom:Rl.cS})}moveLeft(){this._moveToDirection("left")}moveRight(){this._moveToDirection("right")}moveUp(){this._moveToDirection("up")}moveDown(){this._moveToDirection("down")}_moveToDirection(Qe){let rt=this.psv.getPosition();switch(Qe){case"up":rt.pitch+=ql;break;case"left":rt.yaw-=ql;break;case"down":rt.pitch-=ql;break;case"right":rt.yaw+=ql}this._psvAnimate({speed:Rl.LM,...rt})}_psvAnimate(Qe){this._lastPsvAnim&&this._lastPsvAnim.cancel(),this._lastPsvAnim=this.psv.animate(Qe)}addEventListener(Qe,rt,Wn){super.addEventListener(Qe,rt,Wn)}}PhotoViewer.properties={psv:{converter:Ll.A.GetJSONConverter()},widgets:{type:String},"url-parameters":{type:String},...Ll.A.properties},customElements.define("pnx-photo-viewer",PhotoViewer)},8743:(Qe,rt,Wn)=>{"use strict";Wn.d(rt,{$:()=>Ql,A:()=>Viewer});Wn(9616);var Co=Wn(8340),Dl=Wn(3407),Ll=(Wn(9039),Wn(2771)),Rl=Wn(7343),Ul=Wn(5995),Gl=Wn(9683),Zl=Wn(2e3),Hl=Wn(9438),ql=Wn(2118);const Ql=20,Kl=(Math.PI,100);class Viewer extends Dl.A{constructor(){super(),this.map=!0,this.geocoder=this.getAttribute("geocoder")||"nominatim",this.mini=(0,Ul.createWebComp)("pnx-mini",{slot:"bottom-left",_parent:this,onexpand:this._onMiniExpand.bind(this),collapsed:!!(0,Rl.isNullId)(this.picture)||void 0}),this.mini.addEventListener("expand",this._toggleFocus.bind(this)),this.grid.appendChild(this.mini),this.mapContainer=document.createElement("div")}_createInitParamsHandler(){var Qe,rt;this._initParams=new ql.Ay(ql.Ay.GetComponentProperties(Viewer,this),Object.assign({},null===(Qe=this.urlHandler)||void 0===Qe?void 0:Qe.currentURLParams(),null===(rt=this.urlHandler)||void 0===rt?void 0:rt.currentURLParams(!0)),{map:(0,Co.getMapParamsFromLocalStorage)()})}_initWidgets(){var Qe,rt;"false"!==this._initParams.getParentPostInit().widgets&&(this.grid.appendChild((0,Ul.createWebComp)("pnx-widget-zoom",{slot:this.isWidthSmall()?"top-left":"bottom-right",class:this.isWidthSmall()?"pnx-only-map pnx-print-hidden":"pnx-print-hidden",_parent:this})),this.isWidthSmall()?(this.legend=(0,Ul.createWebComp)("pnx-picture-legend",{_parent:this}),this.bottomDrawer=(0,Ul.createWebComp)("pnx-bottom-drawer",{slot:"bottom",_parent:this,class:this._initParams.getParentPostInit().picture?void 0:"pnx-hidden"}),this.bottomDrawer.appendChild(this.legend),this.grid.appendChild(this.bottomDrawer),this.addEventListener("select",(Qe=>{(0,Rl.isNullId)(Qe.detail.picId)?this.bottomDrawer.classList.add("pnx-hidden"):this.bottomDrawer.classList.remove("pnx-hidden")}))):(this.legend=(0,Ul.createWebComp)("pnx-widget-legend",{slot:this.isWidthSmall()?"top":"top-left",_parent:this,focus:this._initParams.getParentPostInit().focus,picture:this._initParams.getParentPostInit().picture}),this.grid.appendChild(this.legend),this.grid.appendChild((0,Ul.createWebComp)("pnx-hashtags",{slot:"top-right",_parent:this,class:"pnx-only-psv pnx-print-hidden"}))),this.grid.appendChild((0,Ul.createWebComp)("pnx-widget-player",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden",size:this.isHeightSmall()?"md":"xl"})),this.grid.appendChild((0,Ul.createWebComp)("pnx-widget-geosearch",{slot:this.isWidthSmall()?"top-right":"top-left",_parent:this,class:"pnx-only-map pnx-print-hidden",geocoder:this._initParams.getParentPostInit().geocoder})),this.grid.appendChild((0,Ul.createWebComp)("pnx-widget-mapfilters",{slot:this.isWidthSmall()?"top-right":"top-left",_parent:this,"user-search":null!==this.api._endpoints.user_search&&null!==this.api._endpoints.user_tiles,"quality-score":(null===(Qe=this.map)||void 0===Qe||null===(rt=Qe._hasQualityScore)||void 0===rt?void 0:rt.call(Qe))||!1,class:"pnx-only-map pnx-print-hidden"})),this.grid.appendChild((0,Ul.createWebComp)("pnx-widget-maplayers",{slot:"top-right",_parent:this,class:"pnx-only-map pnx-print-hidden"})))}getClassName(){return"Viewer"}getSubComponentsNames(){return super.getSubComponentsNames().concat(["mini","map"])}onceReady(){return Promise.all([this.oncePSVReady(),this.onceMapReady()]).then((()=>this._initParams.getParentPostInit().picture&&!this.psv.getPictureMetadata()?this.onceFirstPicLoaded():Promise.resolve()))}attributeChangedCallback(Qe,rt,Wn){var Co,Dl,Ll,Ul;(super.attributeChangedCallback(Qe,rt,Wn),"picture"===Qe)&&(null===(Co=this.legend)||void 0===Co||null===(Dl=Co.setAttribute)||void 0===Dl||Dl.call(Co,"picture",Wn),(0,Rl.isNullId)(rt)&&!(0,Rl.isNullId)(Wn)&&this.mini.removeAttribute("collapsed"),(0,Rl.isNullId)(Wn)?this.map&&this.isMapWide()?this.mini.classList.add("pnx-hidden"):this.map&&!this.isMapWide()&&this._setFocus("map"):(this.mini.classList.remove("pnx-hidden"),(0,Rl.isNullId)(rt)&&(this._setFocus("pic"),"closed"===(null===(Ll=this.bottomDrawer)||void 0===Ll||null===(Ul=Ll.getAttribute)||void 0===Ul?void 0:Ul.call(Ll,"openness"))&&this.bottomDrawer.setAttribute("openness","half-opened"))));"focus"===Qe&&this._setFocus(Wn)}onceMapReady(){if(!this.map)return Promise.resolve();let Qe;return new Promise((rt=>{Qe=setInterval((()=>{var Wn,Co,Dl;"object"===typeof this.map&&(null!==(Wn=this.map)&&void 0!==Wn&&null!==(Co=Wn.loaded)&&void 0!==Co&&Co.call(Wn)?(clearInterval(Qe),rt()):null!==(Dl=this.map)&&void 0!==Dl&&Dl.once&&this.map.once("render",(()=>{clearInterval(Qe),rt()})))}),250)}))}async _initMap(){await new Promise((Qe=>{this.map=new Ll.A(this,this.mapContainer,this._initParams.getMapInit()),(0,Co.saveMapParamsToLocalStorage)(this.map),this.map.once("users-changed",(()=>{this.loader.setAttribute("value",75),Qe()}))})),await(0,ql.mK)(this.map,this._initParams.getMapPostInit()),(0,Co.initMapKeyboardHandler)(this),(0,Co.linkMapAndPhoto)(this)}async _postAPIInit(){this.loader.setAttribute("value",30),this._createInitParamsHandler();const Qe=this._initParams.getParentPostInit();this._initPSV(),await this._initMap(),this._initWidgets(),this._moveChildToGrid(),(0,ql.iz)(this,Qe),this._handleKeyboardManagement(),Qe.picture?this.psv.addEventListener("picture-loaded",(()=>{(0,ql.iz)(this,Qe),this.loader.dismiss()}),{once:!0}):this.loader.dismiss()}_handleKeyboardManagement(){const keytomap=()=>{this.psv.stopKeyboardControl(),this.map.keyboard.enable()},keytopsv=()=>{this.psv.startKeyboardControl(),this.map.keyboard.disable()},keytonone=()=>{this.psv.stopKeyboardControl(),this.map.keyboard.disable()},keytofocused=()=>{this.map&&this.isMapWide()?keytomap():keytopsv()};this.addEventListener("focus-changed",(Qe=>{"map"===Qe.detail.focus&&keytomap(),this.popup.getAttribute("visible")?keytonone():keytopsv()})),this.popup.addEventListener("open",(()=>keytonone())),this.popup.addEventListener("close",(()=>keytofocused()));for(let Qe of this.grid.childNodes)"bg"!==Qe.getAttribute("slot")&&(Qe.addEventListener("focusin",(()=>keytonone())),Qe.addEventListener("focusout",(()=>{null===this.popup.getAttribute("visible")&&keytofocused()})))}moveCenter(){const Qe=this.psv.getPictureMetadata();Qe&&(this.map&&this.isMapWide()?this.map.flyTo({center:Qe.gps,zoom:20}):super.moveCenter())}_moveToDirection(Qe){if(this.map&&this.isMapWide()){let rt;switch(Qe){case"up":rt=[0,-100];break;case"left":rt=[-100,0];break;case"down":rt=[0,Kl];break;case"right":rt=[Kl,0]}this.map.panBy(rt)}else super._moveToDirection(Qe)}isMapWide(){return this.mapContainer.parentNode==this.grid}_setFocus(Qe){var rt,Wn,Co,Dl;let Ll=arguments.length>1&&void 0!==arguments[1]&&arguments[1],Hl=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("map"===Qe&&!this.map)throw new Error("Map is not enabled");if(!["map","pic"].includes(Qe))throw new Error("Invalid focus value (should be pic or map)");if(this.focus=Qe,(Hl||("map"!==Qe||!this.map||!this.isMapWide())&&("pic"!==Qe||this.map&&this.isMapWide()))&&("map"===Qe?(this.psvContainer.parentNode==this.grid&&(this.grid.removeChild(this.psvContainer),this.psvContainer.removeAttribute("slot")),this.mapContainer.parentNode==this.mini&&this.mini.removeChild(this.mapContainer),this.mapContainer.setAttribute("slot","bg"),this.grid.appendChild(this.mapContainer),this.mini.appendChild(this.psvContainer),this.mini.icon=(0,Ul.fa)(Gl.pt),(0,Rl.isNullId)(this.picture)?this.mini.classList.add("pnx-hidden"):this.mini.classList.remove("pnx-hidden"),this.map.getCanvas().focus()):(this.mapContainer.parentNode==this.grid&&(this.grid.removeChild(this.mapContainer),this.mapContainer.removeAttribute("slot")),this.psvContainer.parentNode==this.mini&&this.mini.removeChild(this.psvContainer),this.psvContainer.setAttribute("slot","bg"),this.grid.appendChild(this.psvContainer),this.mini.classList.remove("pnx-hidden"),this.mini.appendChild(this.mapContainer),this.mini.icon=(0,Ul.fa)(Zl.e5),this.psvContainer.focus()),null===this||void 0===this||null===(rt=this.map)||void 0===rt||null===(Wn=rt.resize)||void 0===Wn||Wn.call(rt),this.psv.autoSize(),this.psv.forceRefresh(),null===(Co=this.legend)||void 0===Co||null===(Dl=Co.setAttribute)||void 0===Dl||Dl.call(Co,"focus",this.focus),!Ll)){const rt=new CustomEvent("focus-changed",{detail:{focus:Qe}});this.dispatchEvent(rt)}}_toggleFocus(){this._setFocus(this.isMapWide()?"pic":"map")}_onMiniExpand(){this.map.resize(),this.psv.autoSize()}_onMapFiltersChange(){var Qe;const rt=(0,Hl.qi)("#pnx-map-filters-menu"),Wn=null===rt||void 0===rt?void 0:rt.shadowRoot.getElementById("pnx-filter-date-from"),Co=null===rt||void 0===rt?void 0:rt.shadowRoot.getElementById("pnx-filter-date-end"),Dl=null===rt||void 0===rt?void 0:rt.shadowRoot.querySelectorAll("input[name='pnx-filter-type']"),Ll=(0,Hl.qi)("#pnx-map-theme");let Rl="";for(let Zl=0;Zl<Dl.length;Zl++){const Qe=Dl[Zl];if(Qe.checked){Rl=Qe.value;break}}let Ul=[];if(null!==(Qe=this.map)&&void 0!==Qe&&Qe._hasQualityScore()){const Qe=null===rt||void 0===rt?void 0:rt.shadowRoot.getElementById("pnx-filter-qualityscore");Ul=((null===Qe||void 0===Qe?void 0:Qe.grade)||"").split(",").map((Qe=>parseInt(Qe))).filter((Qe=>!isNaN(Qe))),5==Ul.length&&(Ul=[])}const Gl={minDate:null===Wn||void 0===Wn?void 0:Wn.value,maxDate:null===Co||void 0===Co?void 0:Co.value,pic_type:Rl,theme:null===Ll||void 0===Ll?void 0:Ll.value,qualityscore:Ul};this.map.setFilters(Gl)}}Viewer.properties={map:{converter:Dl.A.GetJSONConverter()},focus:{type:String,reflect:!0},geocoder:{type:String},...Dl.A.properties},customElements.define("pnx-viewer",Viewer)},3921:(Qe,rt,Wn)=>{"use strict";Wn.r(rt),Wn.d(rt,{Basic:()=>Co.A,CoverageMap:()=>Dl.A,Editor:()=>Ll.A,PhotoViewer:()=>Ul.A,Viewer:()=>Rl.A});var Co=Wn(9039),Dl=Wn(153),Ll=Wn(1752),Rl=Wn(8743),Ul=Wn(3407)},9341:(Qe,rt,Wn)=>{"use strict";Wn.r(rt),Wn.d(rt,{core:()=>Co,layout:()=>Dl,menus:()=>Ll,ui:()=>Rl});var Co=Wn(3921),Dl=Wn(456),Ll=Wn(8794),Rl=Wn(9472)},6784:(Qe,rt,Wn)=>{"use strict";Wn.d(rt,{A:()=>BottomDrawer});var Co=Wn(4542),Dl=Wn(1198);const Ll={opened:0,"half-opened":.7,closed:1};class BottomDrawer extends Co.WF{constructor(){super(),this._isDragging=!1,this.openness="half-opened"}firstUpdated(){var Qe;super.firstUpdated(),this._boundTouchMove=this._onTouchMove.bind(this),this._boundTouchEnd=this._onTouchEnd.bind(this),this._drawerHeight=window.innerHeight-30;const rt=this._getDrawer();rt&&(rt.style.height=`${this._drawerHeight}px`,rt.style.maxHeight=`${this._drawerHeight}px`,null===(Qe=this._parent)||void 0===Qe||Qe.onceReady().then((()=>{var Qe,rt;null===(Qe=this._parent.map)||void 0===Qe||Qe.addEventListener("click",(()=>this.openness="closed")),null===(rt=this._parent.psv)||void 0===rt||rt.addEventListener("click",(()=>this.openness="closed"))})))}attributeChangedCallback(Qe,rt,Wn){if(super.attributeChangedCallback(Qe,rt,Wn),"openness"===Qe){if("opened"!==Wn){const Qe=this.shadowRoot.querySelector(".content");Qe&&(Qe.scrollTop=0)}const Qe=this._getDrawer();Qe&&(Qe.style.transform=null)}}disconnectedCallback(){super.disconnectedCallback(),this._cleanupTouchListeners()}_getDrawer(){var Qe;return null===(Qe=this.shadowRoot)||void 0===Qe?void 0:Qe.querySelector(".drawer")}_onHandleClick(){"opened"===this.openness?this.openness="closed":"half-opened"===this.openness?this.openness="opened":"closed"===this.openness&&(this.openness="half-opened")}_onTouchStart(Qe){this._isDragging=!0,this._startFingerY=Qe.touches[0].clientY,this._deltaFingerY=0,this._drawerY=this._drawerHeight*Ll[this.openness],window.addEventListener("touchmove",this._boundTouchMove,{passive:!0}),window.addEventListener("touchend",this._boundTouchEnd),window.addEventListener("touchcancel",this._boundTouchEnd)}_onTouchMove(Qe){if(!this._isDragging)return;const rt=this.shadowRoot.querySelector(".content");rt.scrollHeight>rt.offsetHeight&&rt.scrollTop>0?this._updateDrawerTransform(0):(this._deltaFingerY=Qe.touches[0].clientY-this._startFingerY,this._updateDrawerTransform(this._drawerY+this._deltaFingerY))}_onTouchEnd(Qe){(this._isDragging&&!(Math.abs(this._deltaFingerY)<30)||Qe.target.closest(".handle"))&&(Qe.preventDefault(),this._isDragging=!1,0===this._deltaFingerY&&"closed"===this.openness?this.openness="half-opened":this._updateDrawerTransform(this._drawerY+this._deltaFingerY,!0),this._cleanupTouchListeners(),this._startFingerY=null,this._deltaFingerY=null)}_cleanupTouchListeners(){window.removeEventListener("touchmove",this._boundTouchMove),window.removeEventListener("touchend",this._boundTouchEnd),window.removeEventListener("touchcancel",this._boundTouchCancel)}_updateDrawerTransform(Qe){let rt=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const Wn=this._getDrawer();Wn&&(Qe=Math.max(0,Math.min(Qe,this._drawerHeight-30)),rt&&(this._deltaFingerY<0?"closed"===this.openness?Math.abs(this._deltaFingerY)>this._drawerHeight*(1-Ll["half-opened"])?this.openness="opened":this.openness="half-opened":this.openness="opened":this.openness="closed",this._drawerY=null,Qe=Math.max(0,Math.min(Ll[this.openness]*this._drawerHeight,this._drawerHeight-30))),Wn.style.transform=`translateY(${Qe}px)`)}render(){const Qe={drawer:!0,[this.openness]:!0,dragging:this._isDragging};return Co.qy`
13
13
  <div
14
14
  class=${(0,Dl.H)(Qe)}
15
15
  @touchstart="${this._onTouchStart}"
@@ -1708,7 +1708,7 @@
1708
1708
  }
1709
1709
  /* Logo */
1710
1710
  img.logo-dead { width: 100px; }
1711
- `,Loader.properties={_mode:{state:!0},_label:{state:!0},_isLabelFun:{state:!0},visible:{type:Boolean,reflect:!0},"no-label":{type:Boolean},value:{type:Number}},customElements.define("pnx-loader",Loader)},5642:(Qe,rt,Wn)=>{"use strict";Wn.d(rt,{A:()=>Map});Wn(3041);var Co=Wn(8340),Dl=Wn(7343),Ll=Wn(6883),Rl=Wn(270),Ul=Wn(6462),Gl=Wn(9740),Zl=(Wn(6795),Wn(927)),Hl=Wn.n(Zl),ql=Wn(2968),Ql=Wn.n(ql),Kl=Wn(748);Hl().workerClass=Ql(),Hl().addProtocol("pmtiles",(new Kl.Zs).tile);class Map extends Hl().Map{constructor(Qe,rt){let Wn=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var Dl;(super({container:rt,style:(0,Co.combineStyles)(Qe,Wn),center:[0,0],zoom:0,maxZoom:24,attributionControl:!1,dragRotate:!1,pitchWithRotate:!1,touchZoomRotate:!0,touchPitch:!1,doubleClickZoom:!1,canvasContextAttributes:{preserveDrawingBuffer:!Qe.isWidthSmall()},transformRequest:Qe.api._getMapRequestTransform(),locale:Qe._t.maplibre,hash:!1,...Wn}),this._loadMarkerImages(),this._parent=Qe,this._options=Wn,this.getContainer().classList.add("pnx-map"),void 0===Wn.touchZoomRotate)&&(null===this||void 0===this||null===(Dl=this.touchZoomRotate)||void 0===Dl||Dl.disableRotation());this._options.raster&&(this._options.background=this._options.background||"streets"),this._attribution=new(Hl().AttributionControl)({compact:!1,...Wn.attributionControl}),this.addControl(this._attribution),this._initMapPosition(),this._picMarker=this._getPictureMarker(),this._picMarkerPreview=this._getPictureMarker(!1),this._picThumbUrl={},this._seqPictures={},this._userLayers=new Set,this._parent.addEventListener("select",this.reloadLayersStyles.bind(this)),setTimeout((()=>{var Qe;!this.loaded()&&null!==(Qe=this._parent)&&void 0!==Qe&&Qe.loader.isVisible()&&this._parent.loader.dismiss({},this._parent._t.map.slow_loading,(async()=>{await this._postLoad(),this._parent.loader.dismiss()}))}),15e3),this.waitForEnoughMapLoaded().then((async()=>await this._postLoad()))}async _postLoad(){this.resize(),await this.setVisibleUsers(this._parent.users),this.reloadLayersStyles(),this.fire("ready")}destroy(){this.remove(),delete this._parent,delete this._options,delete this._attribution,delete this._picMarker,delete this._picMarkerPreview,delete this._picThumbUrl,delete this._seqPictures,delete this._userLayers}waitForEnoughMapLoaded(){return new Promise((Qe=>{let rt=0,Wn=0,Co=0,Dl=0;const onSourceDataLoading=Qe=>{"source"===Qe.dataType&&Qe.tile&&(Qe.sourceId.startsWith("geovisio")?Wn++:rt++)},onSourceData=Qe=>{"source"===Qe.dataType&&Qe.tile&&(Qe.sourceId.startsWith("geovisio")?(Dl++,Qe.isSourceLoaded&&(Dl=Wn)):(Co++,Qe.isSourceLoaded&&(Co=rt))),checkEnoughLoaded()},checkEnoughLoaded=()=>{Co/rt>=.75&&(0===Wn||Dl/Wn>=.75)&&(this.off("sourcedata",onSourceData),this.off("sourcedataloading",onSourceDataLoading),Qe())};this.on("sourcedataloading",onSourceDataLoading),this.on("sourcedata",onSourceData)}))}_initMapPosition(){this._options.center&&this._options.center!=[0,0]||this._options.zoom&&0!==this._options.zoom||this._options.hash||this._parent.onceAPIReady().then((()=>{var Qe,rt;let Wn=null===(Qe=this._parent)||void 0===Qe||null===(rt=Qe.api)||void 0===rt?void 0:rt.getDataBbox();if(Wn)try{Wn=new(Hl().LngLatBounds)(Wn),this.loaded()?this.fitBounds(Wn,{animate:!1}):this.waitForEnoughMapLoaded().then((()=>this.fitBounds(Wn,{animate:!1})))}catch(Co){console.warn("Received invalid bbox: "+Wn)}}))}_loadMarkerImages(){[{id:"pnx-marker",img:Ll},{id:"pnx-arrow-flat",img:Ul},{id:"pnx-arrow-360",img:Gl}].forEach((Qe=>{const rt=new Image(64,64);rt.onload=()=>this.addImage(Qe.id,rt),rt.src=Qe.img}))}_hasQualityScore(){var Qe,rt,Wn,Co;const Dl=(null===(Qe=this.getStyle())||void 0===Qe||null===(rt=Qe.metadata)||void 0===rt?void 0:rt["panoramax:fields"])||{};return(null===Dl||void 0===Dl||null===(Wn=Dl.pictures)||void 0===Wn?void 0:Wn.includes("gps_accuracy"))&&(null===Dl||void 0===Dl||null===(Co=Dl.pictures)||void 0===Co?void 0:Co.includes("h_pixel_density"))}_hasGridStats(){var Qe,rt,Wn,Co,Dl,Ll;const Rl=(null===(Qe=this.getStyle())||void 0===Qe||null===(rt=Qe.metadata)||void 0===rt?void 0:rt["panoramax:fields"])||{};return(null===Rl||void 0===Rl||null===(Wn=Rl.grid)||void 0===Wn?void 0:Wn.includes("nb_360_pictures"))&&(null===Rl||void 0===Rl||null===(Co=Rl.grid)||void 0===Co?void 0:Co.includes("nb_flat_pictures"))&&(null===Rl||void 0===Rl||null===(Dl=Rl.grid)||void 0===Dl?void 0:Dl.includes("coef_360_pictures"))&&(null===Rl||void 0===Rl||null===(Ll=Rl.grid)||void 0===Ll?void 0:Ll.includes("coef_flat_pictures"))}reloadVectorTiles(){[...this._userLayers].forEach((Qe=>{const rt=this.getSource((0,Co.getUserSourceId)(Qe));rt.setTiles(rt.tiles)}))}hasTwoBackgrounds(){return void 0!==this.getLayer(Co.RASTER_LAYER_ID)}getBackground(){if(!this.getLayer(Co.RASTER_LAYER_ID))return"streets";return"visible"==this.getLayoutProperty(Co.RASTER_LAYER_ID,"visibility")?"aerial":"streets"}setBackground(Qe){if(!this.getLayer(Co.RASTER_LAYER_ID)&&"aerial"===Qe)throw new Error("No aerial imagery available");this.getLayer(Co.RASTER_LAYER_ID)&&(this.setLayoutProperty(Co.RASTER_LAYER_ID,"visibility","aerial"===Qe?"visible":"none"),this.fire("background-changed",{background:Qe||"streets"}))}getVisibleUsers(){return[...this._userLayers].filter((Qe=>this.getLayer((0,Co.getUserLayerId)(Qe,"pictures"))&&"visible"===this.getLayoutProperty((0,Co.getUserLayerId)(Qe,"pictures"),"visibility")))}onceLayerReady(Qe){return this.getLayer(Qe)?Promise.resolve():new Promise((Qe=>{setTimeout(Qe,250)})).then((()=>this.onceLayerReady(Qe)))}async setVisibleUsers(){let Qe=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];"string"===typeof Qe?Qe=[Qe]:null===Qe&&(Qe=[]),await Promise.all(Qe.filter((Qe=>""!=Qe&&!this._userLayers.has(Qe))).map((Qe=>(this._createPicturesTilesLayer(Qe),this.onceLayerReady((0,Co.getUserLayerId)(Qe,"pictures"))))));const rt=["pictures","sequences","sequences_plus","grid","pictures_symbols"];[...this._userLayers].forEach((Wn=>{rt.forEach((rt=>{const Dl=(0,Co.getUserLayerId)(Wn,rt);this.getLayer(Dl)&&this.setLayoutProperty(Dl,"visibility",Qe.includes(Wn)?"visible":"none")}))})),this.fire("users-changed",{usersIds:Qe})}filterUserLayersContent(Qe,rt){[...this._userLayers].forEach((Wn=>{this.getLayer((0,Co.getUserLayerId)(Wn,Qe))?(this.setFilter((0,Co.getUserLayerId)(Wn,Qe),rt),"sequences"===Qe&&this.getLayer((0,Co.getUserLayerId)(Wn,"sequences_plus"))&&this.setFilter((0,Co.getUserLayerId)(Wn,"sequences_plus"),rt),"pictures"===Qe&&this.getLayer((0,Co.getUserLayerId)(Wn,"pictures_symbols"))&&this.setFilter((0,Co.getUserLayerId)(Wn,"pictures_symbols"),rt)):console.warn("Layer",(0,Co.getUserLayerId)(Wn,Qe),"not ready")}))}displayPictureMarker(Qe,rt,Wn){let Dl=arguments.length>3&&void 0!==arguments[3]&&arguments[3];this._picMarkerPreview.remove(),void 0!==Qe&&void 0!==rt?this._picMarker.setLngLat([Qe,rt]).setRotation(Wn).addTo(this):this._picMarker.remove(),this.reloadLayersStyles(),Dl||void 0===Qe||void 0===rt||this.flyTo({center:[Qe,rt],zoom:this.getZoom()<Co.TILES_PICTURES_ZOOM+2?Co.TILES_PICTURES_ZOOM+2:this.getZoom(),maxDuration:2e3})}reloadLayersStyles(){const updateStyle=(Qe,rt)=>{[...this._userLayers].forEach((Wn=>{const Dl=(0,Co.getUserLayerId)(Wn,Qe);if(this.getLayer(Dl)){for(let Qe in rt.layout)this.setLayoutProperty(Dl,Qe,rt.layout[Qe]);for(let Qe in rt.paint)this.setPaintProperty(Dl,Qe,rt.paint[Qe])}else console.warn("Layer",Dl,"not ready")}))};["pictures","pictures_symbols","sequences"].forEach((Qe=>{updateStyle(Qe,this._getLayerStyleProperties(Qe))}))}async _createPicturesTilesLayer(Qe){this._userLayers.add(Qe);const rt=this.getStyle().layers.find(Co.isLabelLayer);if("geovisio"!==Qe&&!this.getSource(`geovisio_${Qe}`)){const Wn=await this._parent.api.getUserMapStyle(Qe);Object.entries(Wn.sources).forEach((Qe=>{let[rt,Wn]=Qe;return this.addSource(rt,Wn)})),Wn.layers=Wn.layers||[];Wn.layers.concat((0,Co.getMissingLayerStyles)(Wn.sources,Wn.layers)).filter((Qe=>Object.keys(Qe).length>0)).forEach((Qe=>this.addLayer(Qe,null===rt||void 0===rt?void 0:rt.id)))}this._picPreviewTimer=null,this._picPopup=new(Hl().Popup)({closeButton:!1,closeOnClick:!this._parent.isWidthSmall(),offset:3}),this._picPopup.on("close",(()=>{delete this._picPopup._picId}));const Wn=(0,Co.getUserLayerId)(Qe,"pictures");this.on("mousemove",Wn,(Qe=>{this.getCanvas().style.cursor="pointer";const rt=Object.assign({},Qe);clearTimeout(this._picPreviewTimer),this._picPreviewTimer=setTimeout((()=>this._attachPreviewToPictures(rt,Wn)),100)})),this.on("mouseleave",Wn,(()=>{clearTimeout(this._picPreviewTimer),this.getCanvas().style.cursor="",this._picPopup._picId,this._picPopup.remove()})),this.on("click",Wn,this._onPictureClick.bind(this));const Dl=(0,Co.getUserLayerId)(Qe,"sequences_plus");this.on("mousemove",Dl,(Qe=>{if(this._onSequenceHover(Qe),this.getZoom()<=Co.TILES_PICTURES_ZOOM+1&&(this.getCanvas().style.cursor="pointer",Qe.features[0].properties.id)){const rt=Object.assign({},Qe);clearTimeout(this._picPreviewTimer),this._picPreviewTimer=setTimeout((()=>this._attachPreviewToPictures(rt,Dl)),100)}})),this.on("mouseleave",Dl,(()=>{clearTimeout(this._picPreviewTimer),this.getCanvas().style.cursor="",this._picPopup._picId,this._picPopup.remove()})),this.on("click",Dl,(Qe=>{Qe.preventDefault(),this.getZoom()<=Co.TILES_PICTURES_ZOOM+1&&this._onSequenceClick(Qe)})),"geovisio"===Qe&&this.getLayer("geovisio_grid")&&(this.on("mousemove","geovisio_grid",(Qe=>{if(this.getZoom()<=Co.TILES_PICTURES_ZOOM+1){this.getCanvas().style.cursor="pointer";const rt=Object.assign({},Qe);clearTimeout(this._picPreviewTimer),this._picPreviewTimer=setTimeout((()=>this._attachPreviewToPictures(rt,"geovisio_grid")),100)}})),this.on("mouseleave","geovisio_grid",(()=>{clearTimeout(this._picPreviewTimer),this.getCanvas().style.cursor="",this._picPopup._picId,this._picPopup.remove()})),this.on("click","geovisio_grid",(Qe=>{Qe.preventDefault(),this.flyTo({center:Qe.lngLat,zoom:Co.TILES_PICTURES_ZOOM-6})}))),this.on("click",(Qe=>{!1===Qe.defaultPrevented&&(clearTimeout(this._picPreviewTimer),this._picPopup.remove())}))}_getLayerStyleProperties(Qe){if("pictures_symbols"===Qe)return{paint:{},layout:{"icon-image":["case",["==",["get","id"],this._parent.picture],"",["==",["get","type"],"equirectangular"],"pnx-arrow-360","pnx-arrow-flat"],"symbol-sort-key":this._getLayerSortStyle(Qe)}};{const rt={pictures:"circle",sequences:"line"};return{paint:Object.assign({[`${rt[Qe]}-color`]:this._getLayerColorStyle(Qe)},Co.VECTOR_STYLES[Qe.toUpperCase()].paint),layout:Object.assign({[`${rt[Qe]}-sort-key`]:this._getLayerSortStyle(Qe)},Co.VECTOR_STYLES[Qe.toUpperCase()].layout)}}}_getLayerColorStyle(Qe){const rt=["case",["==",["get","hidden"],!0],Dl.COLORS.HIDDEN,["==",["get","geovisio:status"],"hidden"],Dl.COLORS.HIDDEN],Wn=this._parent.sequence;return"sequences"==Qe&&Wn?rt.push(["==",["get","id"],Wn],Dl.COLORS.SELECTED):Qe.startsWith("pictures")&&Wn&&rt.push(["in",Wn,["get","sequences"]],Dl.COLORS.SELECTED),rt.push(Dl.COLORS.BASE),rt}_getLayerSortStyle(Qe){const rt=["case",["==",["get","hidden"],!0],90],Wn=this._parent.sequence;return"sequences"==Qe&&Wn?rt.push(["==",["get","id"],Wn],100):Qe.startsWith("pictures")&&Wn&&rt.push(["in",Wn,["get","sequences"]],100),rt.push(10),rt}_attachPreviewToPictures(Qe,rt){let Wn=Qe.features.pop();if(!Wn||Wn.properties.id==this._picPopup._picId)return;let Dl=null;if(rt.endsWith("pictures")?Dl=Wn.geometry.coordinates.slice():Qe.lngLat&&(Dl=[Qe.lngLat.lng,Qe.lngLat.lat]),!Dl){const Qe="LineString"===Wn.geometry.type?[Wn.geometry.coordinates]:Wn.geometry.coordinates;let rt=null;const Co=this.getBounds(),Ll=Co.getCenter();for(let Wn=0;Wn<Qe.length;Wn++)for(let Rl=0;Rl<Qe[Wn].length;Rl++)if(Co.contains(Qe[Wn][Rl])){let Co=Ll.distanceTo(new(Hl().LngLat)(...Qe[Wn][Rl]));(null===rt||Co<rt)&&(Dl=Qe[Wn][Rl],rt=Co)}if(!Dl)return}this._picPopup.setLngLat(Dl).addTo(this),this._picThumbUrl[Wn.properties.id]||this._picPopup.setDOMContent((0,Co.getThumbGif)(this._parent._t)),this._picPopup._loading=Wn.properties.id,this._picPopup._picId=Wn.properties.id;const displayThumb=Qe=>{if(this._picPopup._loading===Wn.properties.id)if(delete this._picPopup._loading,Qe){let rt=document.createElement("img");rt.classList.add("pnx-map-thumb"),rt.alt=this._parent._t.map.thumbnail;let Co=new Image;if(Co.src=Qe,Co.addEventListener("load",(()=>{Wn.properties.hidden?rt.children[0].src=Co.src:rt.src=Co.src,this._picPopup.setDOMContent(rt)})),Wn.properties.hidden){const Qe=document.createElement("div");Qe.classList.add("pnx-map-thumb-legend"),Qe.appendChild(document.createTextNode(this._parent._t.map.not_public));const Wn=document.createElement("div");Wn.appendChild(rt),Wn.appendChild(Qe),rt=Wn}}else this._picPopup.remove()};rt.endsWith("pictures")?this._getPictureThumbURL(Wn.properties.id).then(displayThumb):rt.endsWith("grid")?this._getThumbURL(Dl).then(displayThumb):this._getSequenceThumbURL(Wn.properties.id,new(Hl().LngLat)(...Dl)).then(displayThumb)}_getThumbURL(Qe){return this._parent.api.getPicturesAroundCoordinates(Qe[1],Qe[0],.1,1).then((Qe=>{var rt;const Wn=null===Qe||void 0===Qe||null===(rt=Qe.features)||void 0===rt?void 0:rt.pop();return Wn?this._parent.api.findThumbnailInPictureFeature(Wn):null}))}_getSequenceThumbURL(Qe,rt){return rt?this._parent.api.getPicturesAroundCoordinates(rt.lat,rt.lng,1,1,Qe).then((rt=>{var Wn;return(null===rt||void 0===rt||null===(Wn=rt.features)||void 0===Wn?void 0:Wn.length)>0?this._parent.api.findThumbnailInPictureFeature(rt.features[0]):this._parent.api.getPictureThumbnailURLForSequence(Qe)})):this._parent.api.getPictureThumbnailURLForSequence(Qe)}_getPictureThumbURL(Qe,rt){let Wn=null;return Qe&&(void 0!==this._picThumbUrl[Qe]?Wn="string"===typeof this._picThumbUrl[Qe]?Promise.resolve(this._picThumbUrl[Qe]):this._picThumbUrl[Qe]:(this._picThumbUrl[Qe]=this._parent.api.getPictureThumbnailURL(Qe,rt).then((rt=>rt?(this._picThumbUrl[Qe]=rt,rt):(this._picThumbUrl[Qe]=null,null))).catch((()=>{this._picThumbUrl[Qe]=null})),Wn=this._picThumbUrl[Qe])),Wn}_getPictureMarker(){let Qe=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const rt=document.createElement("img");return rt.src=Qe?Rl:Ll,rt.alt="",new(Hl().Marker)({element:rt})}_onSequenceHover(Qe){var rt;Qe.preventDefault(),Qe.features.length>0&&null!==(rt=Qe.features[0].properties)&&void 0!==rt&&rt.id&&this.fire("sequence-hover",{seqId:Qe.features[0].properties.id})}_onSequenceClick(Qe){var rt;Qe.preventDefault(),Qe.features.length>0&&null!==(rt=Qe.features[0].properties)&&void 0!==rt&&rt.id&&this.fire("sequence-click",{seqId:Qe.features[0].properties.id,coordinates:Qe.lngLat})}_onPictureClick(Qe){var rt,Wn;Qe.preventDefault();const Co=(null===Qe||void 0===Qe||null===(rt=Qe.features)||void 0===rt?void 0:rt.length)>0?Qe.features[0]:null;if(null!==Co&&void 0!==Co&&null!==(Wn=Co.properties)&&void 0!==Wn&&Wn.id){let rt=null;try{Co.properties.sequences&&(Array.isArray(Co.properties.sequences)||(Co.properties.sequences=JSON.parse(Co.properties.sequences)),rt=Co.properties.sequences.pop())}catch(Qe){console.log("Sequence ID is not available in vector tiles for picture "+Co.properties.id)}this.fire("picture-click",{picId:Co.properties.id,seqId:rt,feature:Co})}}addEventListener(Qe,rt){let Wn=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};null!==Wn&&void 0!==Wn&&Wn.once?this.once(Qe,rt):this.on(Qe,rt)}}},2771:(Qe,rt,Wn)=>{"use strict";Wn.d(rt,{A:()=>MapMore,T:()=>Ul});var Co=Wn(5642),Dl=Wn(7343),Ll=Wn(8340);const Rl={DEFAULT:"default",AGE:"age",TYPE:"type",SCORE:"score"},Ul=["minDate","maxDate","pic_type","camera","theme","qualityscore"];class MapMore extends Co.A{constructor(Qe,rt){super(Qe,rt,arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}),this._mapFilters={},this._options.theme&&(this._mapFilters={theme:this._options.theme})}reloadLayersStyles(){if(super.reloadLayersStyles(),this._hasGridStats()){let Qe="coef";this._mapFilters.pic_type&&(Qe="flat"==this._mapFilters.pic_type?"coef_flat_pictures":"coef_360_pictures"),this.getStyle().layers.filter((Qe=>Qe.id.endsWith("_grid"))).forEach((rt=>{const Wn=(0,Ll.switchCoefValue)(rt,Qe);for(let Qe in Wn.layout)this.setLayoutProperty(rt.id,Qe,Wn.layout[Qe]);for(let Qe in Wn.paint)this.setPaintProperty(rt.id,Qe,Wn.paint[Qe])}))}}_getDatesForLayerColors(){const Qe=864e5,rt=Date.now();return[rt-30*Qe,rt-365*Qe,rt-730*Qe].map((Qe=>new Date(Qe).toISOString().split("T")[0]))}_getLayerColorStyle(Qe){var rt,Wn,Co,Ul,Gl,Zl,Hl,ql;const Ql=["case",["==",["get","hidden"],!0],Dl.COLORS.HIDDEN],Kl=(null===(rt=this._parent.psv)||void 0===rt||null===(Wn=rt._myVTour)||void 0===Wn||null===(Co=Wn.state)||void 0===Co?void 0:Co.loadingNode)||(null===(Ul=this._parent.psv)||void 0===Ul||null===(Gl=Ul._myVTour)||void 0===Gl||null===(Zl=Gl.state)||void 0===Zl||null===(Hl=Zl.currentNode)||void 0===Hl?void 0:Hl.id),$l=Kl?null===(ql=this._parent.psv)||void 0===ql?void 0:ql._picturesSequences[Kl]:null;if("sequences"==Qe&&$l?Ql.push(["==",["get","id"],$l],Dl.COLORS.SELECTED):"pictures"==Qe&&$l&&Ql.push(["in",$l,["get","sequences"]],Dl.COLORS.SELECTED),this._mapFilters.theme==Rl.AGE){const rt="sequences"==Qe?"date":"ts",Wn=this._getDatesForLayerColors();Ql.push(["!",["has",rt]],Dl.COLORS.BASE,[">=",["get",rt],Wn[0]],Dl.COLORS.PALETTE_4,[">=",["get",rt],Wn[1]],Dl.COLORS.PALETTE_3,[">=",["get",rt],Wn[2]],Dl.COLORS.PALETTE_2,Dl.COLORS.PALETTE_1)}else this._mapFilters.theme==Rl.TYPE?Ql.push(["!",["has","type"]],Dl.COLORS.BASE,["==",["get","type"],"equirectangular"],Dl.COLORS.QUALI_1,Dl.COLORS.QUALI_2):this._mapFilters.theme==Rl.SCORE?Ql.push(["==",Ll.MAP_EXPR_QUALITYSCORE,5],Dl.QUALITYSCORE_VALUES[0].color,["==",Ll.MAP_EXPR_QUALITYSCORE,4],Dl.QUALITYSCORE_VALUES[1].color,["==",Ll.MAP_EXPR_QUALITYSCORE,3],Dl.QUALITYSCORE_VALUES[2].color,["==",Ll.MAP_EXPR_QUALITYSCORE,2],Dl.QUALITYSCORE_VALUES[3].color,Dl.QUALITYSCORE_VALUES[4].color):Ql.push(Dl.COLORS.BASE);return Ql}_getLayerSortStyle(Qe){var rt,Wn,Co,Dl,Ul,Gl,Zl,Hl;const ql=["case",["==",["get","hidden"],!0],90],Ql=(null===(rt=this._parent.psv)||void 0===rt||null===(Wn=rt._myVTour)||void 0===Wn||null===(Co=Wn.state)||void 0===Co?void 0:Co.loadingNode)||(null===(Dl=this._parent.psv)||void 0===Dl||null===(Ul=Dl._myVTour)||void 0===Ul||null===(Gl=Ul.state)||void 0===Gl||null===(Zl=Gl.currentNode)||void 0===Zl?void 0:Zl.id),Kl=Ql?null===(Hl=this._parent.psv)||void 0===Hl?void 0:Hl._picturesSequences[Ql]:null;if("sequences"==Qe&&Kl?ql.push(["==",["get","id"],Kl],100):"pictures"==Qe&&Kl&&ql.push(["in",Kl,["get","sequences"]],100),this._mapFilters.theme==Rl.AGE){const rt="sequences"==Qe?"date":"ts",Wn=this._getDatesForLayerColors();ql.push(["!",["has",rt]],0,[">=",["get",rt],Wn[0]],50,[">=",["get",rt],Wn[1]],49,[">=",["get",rt],Wn[2]],48)}else this._mapFilters.theme==Rl.TYPE?ql.push(["!",["has","type"]],0,["==",["get","type"],"equirectangular"],50):this._mapFilters.theme==Rl.SCORE&&ql.push(["==",Ll.MAP_EXPR_QUALITYSCORE,5],80,["==",Ll.MAP_EXPR_QUALITYSCORE,4],65,["==",Ll.MAP_EXPR_QUALITYSCORE,3],50,["==",Ll.MAP_EXPR_QUALITYSCORE,2],35,["==",Ll.MAP_EXPR_QUALITYSCORE,1],20);return ql.push(10),ql}setFilters(Qe){let rt=arguments.length>1&&void 0!==arguments[1]&&arguments[1],Wn=[],Co=[],Dl=!1;if(this._mapFilters={},Qe.minDate&&""!==Qe.minDate&&(this._mapFilters.minDate=Qe.minDate,Wn.push([">=",["get","date"],Qe.minDate]),Co.push([">=",["get","ts"],Qe.minDate])),Qe.maxDate&&""!==Qe.maxDate){this._mapFilters.maxDate=Qe.maxDate,Wn.push(["<=",["get","date"],Qe.maxDate]);let rt=new Date(Qe.maxDate);rt.setDate(rt.getDate()+1),rt=rt.toISOString().split("T")[0],Co.push(["<=",["get","ts"],rt])}if(Qe.pic_type&&""!==Qe.pic_type&&(this._mapFilters.pic_type="flat"===Qe.pic_type?"flat":"equirectangular",Wn.push(["==",["get","type"],this._mapFilters.pic_type]),Co.push(["==",["get","type"],this._mapFilters.pic_type])),this._hasGridStats()&&(Dl=!0),Qe.camera&&""!==Qe.camera){this._mapFilters.camera=Qe.camera;const rt=Qe.camera.toLowerCase().trim()+" ",Dl=Qe.camera.toLowerCase().trim()+"zzzzzzzzzzzzzzzzzzzz",Ll=["collator",{"case-sensitive":!1,"diacritic-sensitive":!1}];Wn.push([">=",["get","model"],rt,Ll]),Wn.push(["<=",["get","model"],Dl,Ll]),Co.push([">=",["get","model"],rt,Ll]),Co.push(["<=",["get","model"],Dl,Ll])}Qe.qualityscore&&Qe.qualityscore.length>0&&(this._mapFilters.qualityscore=Qe.qualityscore,Wn.push(["in",Ll.MAP_EXPR_QUALITYSCORE,["literal",this._mapFilters.qualityscore]]),Co.push(["in",Ll.MAP_EXPR_QUALITYSCORE,["literal",this._mapFilters.qualityscore]])),Qe.theme&&Object.values(Rl).includes(Qe.theme)&&(this._mapFilters.theme=Qe.theme,Dl=!0),0==Wn.length?Wn=null:Wn.unshift("all"),0==Co.length?Co=null:(Co.unshift("all"),Co=["step",["zoom"],!0,Ll.TILES_PICTURES_ZOOM,Co]),Dl&&this.reloadLayersStyles();const Ul=this.getVisibleUsers().includes("geovisio");Wn&&Ul&&(Wn=["step",["zoom"],!0,7,Wn]),this.filterUserLayersContent("sequences",Wn),this.filterUserLayersContent("pictures",Co),!rt&&(null!==Wn||null!==Co||null!==this._mapFilters.theme&&this._mapFilters.theme!==Rl.DEFAULT)&&Ul&&this.getZoom()<7&&!this._hasGridStats()&&this.easeTo({zoom:7}),this.fire("filters-changed",Object.assign({},this._mapFilters))}}},9048:(Qe,rt,Wn)=>{"use strict";Wn.d(rt,{Ay:()=>Photo,LM:()=>$l,Vf:()=>Tc,cS:()=>Kl});Wn(5003);var Co=Wn(5975),Dl=Wn(2305),Ll=Wn(7343),Rl=Wn(508),Ul=(Wn(3961),Wn(1080),Wn(2710),Wn(1575),Wn(1545)),Gl=Wn(3348),Zl=Wn(4991),Hl=Wn(3727);const ql={baseUrl:Co,width:1280,cols:2,rows:1,tileUrl:()=>null},Ql={id:Ll.BASE_PANORAMA_ID,caption:"",panorama:ql,links:[],gps:[0,0],sequence:{},sphereCorrection:{},horizontalFov:360,properties:{}},Kl=30,$l=250,Tc=3e3;Ul.jM.useNewAnglesOrder=!0;class Photo extends Ul.jM{constructor(Qe,rt){var Wn,Co;let Dl=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};super({container:rt,adapter:[Hl.A,{showErrorTile:!1,baseBlur:!1,resolution:Qe.isWidthSmall()?32:64,shouldGoFast:Dl.shouldGoFast}],withCredentials:"include"==(null===Qe||void 0===Qe||null===(Wn=Qe.fetchOptions)||void 0===Wn?void 0:Wn.credentials),requestHeaders:null===Qe||void 0===Qe||null===(Co=Qe.fetchOptions)||void 0===Co?void 0:Co.headers,panorama:ql,lang:Qe._t.psv,minFov:5,loadingTxt:"&nbsp;",navbar:null,rendererParameters:{preserveDrawingBuffer:!Qe.isWidthSmall()},plugins:[[Gl.$,{dataMode:"server",positionMode:"gps",renderMode:"3d",preload:!0,getNode:()=>{},transitionOptions:()=>{},arrowsPosition:{linkOverlapAngle:Math.PI/6}}],[Zl.b,{}]],...Dl}),this._parent=Qe,this._options=Dl,rt.classList.add("pnx-psv"),this._shouldGoFast=(null===Dl||void 0===Dl?void 0:Dl.shouldGoFast)||(()=>!1),this._transitionDuration=(null===Dl||void 0===Dl?void 0:Dl.transitionDuration)||$l,this._myVTour=this.getPlugin(Gl.$),this._myVTour.datasource.nodeResolver=this._getNodeFromAPI.bind(this),this._myVTour.config.transitionOptions=this._psvNodeTransition.bind(this),this._clearArrows=this._myVTour.arrowsRenderer.clear.bind(this._myVTour.arrowsRenderer),this._myVTour.arrowsRenderer.clear=()=>{},this._myMarkers=this.getPlugin(Zl.b),this._annotationsVisible=!1,this._sequencePlaying=!1,this._picturesNavigation=this._options.picturesNavigation||"any",this._picturesSequences={},this._myVTour.addEventListener("enter-arrow",this._onEnterArrow.bind(this)),this._myVTour.addEventListener("leave-arrow",this._onLeaveArrow.bind(this)),this._myVTour.addEventListener("node-changed",this._onNodeChanged.bind(this)),this._myMarkers.addEventListener("select-marker",this._onSelectMarker.bind(this)),this.addEventListener("position-updated",this._onPositionUpdated.bind(this)),this.addEventListener("zoom-updated",this._onZoomUpdated.bind(this)),this.addEventListener("dblclick",this._onDoubleClick.bind(this)),this._parent.addEventListener("select",this._onSelect.bind(this)),this.loader.size=150,this.loader.color="rgba(61, 61, 61, 0.5)",this.loader.textColor="rgba(255, 255, 255, 0.7)",this.loader.border=5,this.loader.thickness=10,this.loader.canvas.setAttribute("viewBox","0 0 150 150"),this.loader.__updateContent(),this._options.position&&!this._parent.picture&&this.goToPosition(...this._options.position)}async _getNodeFromAPI(Qe){var rt,Wn;if((0,Ll.isNullId)(Qe))return Ql;const Co=await fetch(this._parent.api.getPictureMetadataUrl(Qe,this._picturesSequences[Qe]),this._parent.api._getFetchOptions());let Dl=await Co.json();if(Dl.features&&(Dl=Dl.features.pop()),!Dl||0===Object.keys(Dl).length||!Co.ok)throw this._parent.loader&&this._parent.loader.dismiss(!0,this._parent._t.pnx.error_pic),new Error("Picture with ID "+Qe+" was not found");this._picturesSequences[Qe]=Dl.collection;const Ul=(0,Rl.apiFeatureToPSVNode)(Dl,this._parent._t,this._parent._isInternetFast,this._picturesNavFilter.bind(this));var Gl,Zl;null!==Ul&&void 0!==Ul&&null!==(rt=Ul.sequence)&&void 0!==rt&&rt.prevPic&&(this._picturesSequences[null===Ul||void 0===Ul||null===(Gl=Ul.sequence)||void 0===Gl?void 0:Gl.prevPic]=Dl.collection);null!==Ul&&void 0!==Ul&&null!==(Wn=Ul.sequence)&&void 0!==Wn&&Wn.nextPic&&(this._picturesSequences[null===Ul||void 0===Ul||null===(Zl=Ul.sequence)||void 0===Zl?void 0:Zl.nextPic]=Dl.collection);return Ul}_psvNodeTransition(Qe,rt,Wn){var Co,Dl,Rl;let Ul={};const Gl=this._shouldGoFast()?0:Math.min($l,this._transitionDuration),Zl=Gl>100,Hl=null!=(Wn||(null===rt||void 0===rt?void 0:rt.links.find((rt=>rt.nodeId==Qe.id)))),ql=rt&&Qe.sequence.id===rt.sequence.id,Ql=((null===rt||void 0===rt||null===(Co=rt.properties)||void 0===Co?void 0:Co["view:azimuth"])||0)*(Math.PI/180),Tc=((null===Qe||void 0===Qe||null===(Dl=Qe.properties)||void 0===Dl?void 0:Dl["view:azimuth"])||0)*(Math.PI/180),tu=(0,Ll.getRelativeHeading)(Qe)*(Math.PI/180);this.setOption("maxFov",Math.min(3*Qe.horizontalFov/4,90));const lu={showLoader:!1,effect:"none",speed:0,rotation:!1,rotateTo:{pitch:0,yaw:-tu},zoomTo:Kl};if(360==Qe.horizontalFov)Ul=rt?(0,Ll.getDistance)(rt.gps,Qe.gps)>=.001?lu:{speed:Gl,effect:Hl&&Zl?"fade":"none",rotation:Hl&&ql&&Zl,rotateTo:this.getPosition()}:lu;else if(ql){const Qe=this.getPosition().yaw,Wn=rt.horizontalFov*(Math.PI/180)/2,Co=Qe<=Wn||Qe>=2*Math.PI-Wn,Dl=Math.abs(Ql-Tc)<=Math.PI/4;Ul={speed:Gl,effect:Hl&&Dl&&Zl?"fade":"none",rotation:Hl&&Dl&&Zl,rotateTo:Co?this.getPosition():{pitch:0,yaw:0},zoomTo:Co?this.getZoomLevel():Kl}}else Ul=Object.assign(lu,{rotateTo:{pitch:0,yaw:0}});"fade"===Ul.effect&&Ul.speed>=150?setTimeout(this._clearArrows,Ul.speed-100):this._clearArrows();const du=new CustomEvent("picture-loading",{detail:{...Object.assign({},this.getXYZ(),Ul.rotateTo?{x:180*(Tc+Ul.rotateTo.yaw)/Math.PI}:null,Ul.zoomTo?{z:Ul.zoomTo}:null),picId:Qe.id,lon:Qe.gps[0],lat:Qe.gps[1],first:(null===(Rl=this._parent._initParams)||void 0===Rl?void 0:Rl.getParentPostInit().picture)==Qe.id}});return this.dispatchEvent(du),Ul}_onEnterArrow(Qe){const rt=Qe.link,Wn=Qe.node;let Co;Wn&&(Co=360===Wn.horizontalFov?(this.getPictureOriginalHeading()+180*this.getPosition().yaw/Math.PI)%360:this.getPictureOriginalHeading());const Dl=new CustomEvent("picture-preview-started",{detail:{picId:rt.nodeId,coordinates:rt.gps,direction:Co}});this.dispatchEvent(Dl)}_onLeaveArrow(Qe){const rt=Qe.link,Wn=new CustomEvent("picture-preview-stopped",{detail:{picId:rt.nodeId}});this.dispatchEvent(Wn)}_onPositionUpdated(Qe){let{position:rt}=Qe;const Wn=(0,Ll.positionToXYZ)(rt,this.getZoomLevel());Wn.x+=this.getPictureOriginalHeading(),Wn.x=Wn.x%360;const Co=new CustomEvent("view-rotated",{detail:Wn});this.dispatchEvent(Co),this._onTilesStartLoading()}_onZoomUpdated(Qe){let{zoomLevel:rt}=Qe;const Wn=new CustomEvent("view-rotated",{detail:{...this.getXY(),z:rt}});this.dispatchEvent(Wn),this._onTilesStartLoading()}_onDoubleClick(){this.unfocusAnnotation()}_onNodeChanged(Qe){for(let Dl of document.getElementsByClassName("pnx-psv-tour-arrows"))Dl.classList.remove("pnx-clicked");if(Qe.node.id){var rt,Wn,Co;const Dl=(null===(rt=this._parent._initParams)||void 0===rt?void 0:rt.getParentPostInit().picture)==Qe.node.id;this._parent.select(null===(Wn=Qe.node)||void 0===Wn||null===(Co=Wn.sequence)||void 0===Co?void 0:Co.id,Qe.node.id);const Ll=this.getPictureMetadata();if(!Ll)return void this.dispatchEvent(new CustomEvent("picture-loaded",{detail:{}}));this._prevSequence=Ll.sequence.id;const Rl=new CustomEvent("picture-loaded",{detail:{...this.getXYZ(),picId:Qe.node.id,lon:Ll.gps[0],lat:Ll.gps[1],first:Dl}});this.dispatchEvent(Rl),Ll.panorama.hdUrl?(this.setOption("downloadUrl",Ll.panorama.hdUrl),this.setOption("downloadName",Qe.node.id+".jpg")):this.setOption("downloadUrl",null),this._annotationsVisible&&this.toggleAllAnnotations(!0)}this._onTilesStartLoading()}_onSelectMarker(Qe){var rt;if(Qe.marker&&null!==(rt=Qe.marker.id)&&void 0!==rt&&rt.startsWith("annotation-")){const rt=new CustomEvent("annotation-click",{detail:{annotationId:Qe.marker.data.id}});this.dispatchEvent(rt)}}_onTilesStartLoading(){this._tilesQueueTimer&&(clearInterval(this._tilesQueueTimer),delete this._tilesQueueTimer),this._tilesQueueTimer=setInterval((()=>{if(0===Object.keys(this.adapter.queue.tasks).length){if(this._myVTour.state.currentNode){const Qe=new CustomEvent("picture-tiles-loaded",{detail:{picId:this._myVTour.state.currentNode.id}});this.dispatchEvent(Qe)}clearInterval(this._tilesQueueTimer),delete this._tilesQueueTimer}}),100)}getPictureMetadata(){var Qe,rt,Wn;return(0,Ll.isNullId)(null===(Qe=this._myVTour)||void 0===Qe||null===(rt=Qe.state)||void 0===rt||null===(Wn=rt.currentNode)||void 0===Wn?void 0:Wn.id)?null:this._myVTour.state.currentNode?Object.assign({},this._myVTour.state.currentNode):null}getPictureId(){var Qe,rt,Wn,Co,Dl;const Rl=(null===(Qe=this._myVTour)||void 0===Qe||null===(rt=Qe.state)||void 0===rt?void 0:rt.loadingNode)||(null===(Wn=this._myVTour)||void 0===Wn||null===(Co=Wn.state)||void 0===Co||null===(Dl=Co.currentNode)||void 0===Dl?void 0:Dl.id);return(0,Ll.isNullId)(Rl)?null:Rl}_onSelect(Qe){var rt;Qe.detail.seqId&&(this._picturesSequences[Qe.detail.picId]=Qe.detail.seqId),(null===(rt=this._myVTour.getCurrentNode())||void 0===rt?void 0:rt.id)!==Qe.detail.picId&&(this.loader.show(),this._myVTour.setCurrentNode(Qe.detail.picId).catch((Qe=>{this.showErrorOverlay(Qe,this._parent._t.pnx.error_pic,!0)})))}goToNextPicture(){if(!this.getPictureMetadata())throw new Error("No picture currently selected");const Qe=this.getPictureMetadata().sequence.nextPic;if(!Qe)throw new Error("No next picture available");this._parent.select(this.getPictureMetadata().sequence.id,Qe)}goToPrevPicture(){if(!this.getPictureMetadata())throw new Error("No picture currently selected");const Qe=this.getPictureMetadata().sequence.prevPic;if(!Qe)throw new Error("No previous picture available");this._parent.select(this.getPictureMetadata().sequence.id,Qe)}async goToPosition(Qe,rt){return this._parent.api.getPicturesAroundCoordinates(Qe,rt).then((Qe=>{if(Qe.features.length>0){const rt=Qe.features.pop();return this._parent.select(null===rt||void 0===rt?void 0:rt.collection,rt.id),rt.id}return Promise.reject(new Error("No picture found nearby given coordinates"))}))}getXY(){const Qe=(0,Ll.positionToXYZ)(this.getPosition());return Qe.x=(Qe.x+this.getPictureOriginalHeading())%360,Qe}getXYZ(){const Qe=this.getXY();return Qe.z=this.getZoomLevel(),Qe}getPictureOriginalHeading(){var Qe,rt;return(null===(Qe=this.getPictureMetadata())||void 0===Qe||null===(rt=Qe.properties)||void 0===rt?void 0:rt["view:azimuth"])||0}getPictureRelativeHeading(){return(0,Ll.getRelativeHeading)(this.getPictureMetadata())}clearPictureMetadataCache(){var Qe,rt,Wn,Co;const Dl=null===(Qe=this.getPictureMetadata())||void 0===Qe?void 0:Qe.id,Ll=null===(rt=this.getPictureMetadata())||void 0===rt||null===(Wn=rt.sequence)||void 0===Wn?void 0:Wn.id;null===(Co=this._myVTour.state.currentTooltip)||void 0===Co||Co.hide(),this._myVTour.state.currentTooltip=null,this._myVTour.state.currentNode=null,this._myVTour.state.preload={},this._myVTour.datasource.nodes={},Dl&&this._parent.select(Ll,Dl)}setXYZ(Qe,rt,Wn){const Co=(0,Ll.xyzToPosition)(Qe-this.getPictureOriginalHeading(),rt,Wn);this.rotate({yaw:Co.yaw,pitch:Co.pitch}),this.zoom(Co.zoom)}setHigherContrast(Qe){this.renderer.renderer.toneMapping=Qe?3:0,this.renderer.renderer.toneMappingExposure=Qe?2:1,this.needsUpdate()}getTransitionDuration(){return this._transitionDuration}setTransitionDuration(Qe){if((Qe=parseFloat(Qe))<100||Qe>Tc)throw new Error("Invalid transition duration (should be between 100 and "+Tc+")");this._transitionDuration=Qe;const rt=new CustomEvent("transition-duration-changed",{detail:{value:Qe}});this.dispatchEvent(rt)}setPanorama(Qe,rt){const onFailure=Qe=>{var rt;return this.showErrorOverlay(Qe,null===(rt=this._parent)||void 0===rt?void 0:rt._t.pnx.error_pic,!0)};try{return super.setPanorama(Qe,rt).catch(onFailure)}catch(Wn){onFailure(Wn)}}showErrorOverlay(Qe,rt,Wn){var Co,Ll,Rl,Ul;null!==(Co=this._parent)&&void 0!==Co&&Co.loader.isVisible()||!this.overlay.isVisible()?null===(Ll=this._parent)||void 0===Ll||Ll.loader.dismiss(Qe,rt,Wn?()=>{var Qe;null===(Qe=this._parent)||void 0===Qe||Qe.loader.dismiss(),this.overlay.hide()}:void 0):(console.error(Qe),this.overlay.show({image:`<img style="width: 200px" src="${Dl}" alt="" />`,title:null===(Rl=this._parent)||void 0===Rl?void 0:Rl._t.pnx.error,text:rt+"<br />"+(null===(Ul=this._parent)||void 0===Ul?void 0:Ul._t.pnx.error_click),dissmisable:Wn}))}playSequence(){this._sequencePlaying=!0;const Qe=new Event("sequence-playing",{bubbles:!0,composed:!0});this.dispatchEvent(Qe);const nextPicturePlay=()=>{if(this._sequencePlaying){this.addEventListener("picture-loaded",(()=>{this._playTimer=setTimeout((()=>{nextPicturePlay()}),this.getTransitionDuration())}),{once:!0});try{this.goToNextPicture()}catch(Qe){this.stopSequence()}}};this.addEventListener("click",(()=>this.stopSequence())),nextPicturePlay()}stopSequence(){this._sequencePlaying=!1,this._playTimer&&(clearTimeout(this._playTimer),delete this._playTimer),this.forceRefresh();const Qe=new Event("sequence-stopped",{bubbles:!0,composed:!0});this.dispatchEvent(Qe)}isSequencePlaying(){return this._sequencePlaying}toggleSequencePlaying(){this.isSequencePlaying()?this.stopSequence():this.playSequence()}getPicturesNavigation(){return this._picturesNavigation}setPicturesNavigation(Qe){"none"===Qe&&(Qe="pic"),this._picturesNavigation=Qe;const rt=new CustomEvent("pictures-navigation-changed",{detail:{value:Qe}});this.dispatchEvent(rt)}_picturesNavFilter(Qe){switch(this._picturesNavigation){case"seq":return["next","prev"].includes(Qe.rel);case"pic":case"none":return!1;default:return!0}}areAnnotationsVisible(){return this._annotationsVisible}toggleAllAnnotations(Qe){const rt=this.getPictureMetadata();if(!rt)throw this._myMarkers.clearMarkers(),new Error("No picture currently selected");if(Qe){var Wn;let Qe=rt.properties.annotations;0===Qe.length&&console.warn("No annotation available on picture",rt.id);const Co=null===(Wn=this.state.textureData.panoData)||void 0===Wn?void 0:Wn.baseData;Qe=Qe.map((Qe=>{const rt=this.getPictureMetadata().properties["pers:interior_orientation"].sensor_array_dimensions;if(!rt)return console.warn("Picture lacks pers:interior_orientation.sensor_array_dimensions property, can't compute marker"),null;const Wn=Qe.shape.coordinates.map((Qe=>Qe.map((Qe=>{const Wn=[Qe[0]*Co.croppedWidth/rt[0],Qe[1]*Co.croppedHeight/rt[1]],Dl=[(Co.croppedX+Wn[0])/Co.fullWidth,(Co.croppedY+Wn[1])/Co.fullHeight];return[2*(Dl[0]-.5)*Math.PI,(.5-Dl[1])*Math.PI]}))));return{id:`annotation-${Qe.id}`,polygon:Wn,data:{id:Qe.id},svgStyle:{stroke:"var(--orange)",strokeWidth:"3px",fill:"var(--orange-transparent)",cursor:"pointer"},tooltip:this._parent._t.pnx.semantics_annotation_tooltip}})),this._myMarkers.setMarkers(Qe)}else this._myMarkers.clearMarkers();const Co=this._annotationsVisible!=Qe;this._annotationsVisible=Qe,Co&&this.dispatchEvent(new CustomEvent("annotations-toggled",{detail:{visible:Qe}}))}focusOnAnnotation(Qe){this.areAnnotationsVisible()||this.toggleAllAnnotations(!0),this.unfocusAnnotation(!0);const rt=`annotation-${Qe}`;this._myMarkers.updateMarker({id:rt,svgStyle:{stroke:"var(--red)",strokeWidth:"3px",fill:"var(--red-transparent)"},data:{selected:!0}}),this._myMarkers.gotoMarker(rt,0),this.zoom(65)}unfocusAnnotation(){let Qe=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const rt=Object.keys(this._myMarkers.markers).filter((Qe=>{var rt,Wn,Co;return Qe.startsWith("annotation-")&&(null===(rt=this._myMarkers.markers[Qe])||void 0===rt||null===(Wn=rt.config)||void 0===Wn||null===(Co=Wn.data)||void 0===Co?void 0:Co.selected)}));rt.length>0&&(rt.forEach((Qe=>{this._myMarkers.updateMarker({id:Qe,svgStyle:{stroke:"var(--orange)",strokeWidth:"3px",fill:"var(--orange-transparent)"},data:{selected:!1}})})),Qe||this.dispatchEvent(new Event("annotations-unfocused")))}forceRefresh(){var Qe;const rt=this._myVTour.getCurrentNode();if(rt&&rt.panorama.baseUrl!==(null===rt||void 0===rt||null===(Qe=rt.panorama)||void 0===Qe?void 0:Qe.origBaseUrl)){const Qe=this.getZoomLevel(),Wn=this.getPosition();this._myVTour.state.currentNode=null,this._myVTour.setCurrentNode(rt.id,{zoomTo:Qe,rotateTo:Wn,fadeIn:!1,speed:0,rotation:!1})}rt&&rt.panorama.rows>1&&this.adapter.__refresh()}}},4374:(Qe,rt,Wn)=>{"use strict";Wn.d(rt,{A:()=>Popup});var Co=Wn(4542),Dl=Wn(5995),Ll=Wn(8591),Rl=Wn(6627);class Popup extends Co.WF{constructor(){super(),this.visible=!1}connectedCallback(){super.connectedCallback(),this.addEventListener("click",(Qe=>{Qe.target===this&&this.close()})),document.addEventListener("keyup",(Qe=>{"Escape"===Qe.key&&this.visible&&this.close()}))}attributeChangedCallback(Qe,rt,Wn){super.attributeChangedCallback(Qe,rt,Wn),"visible"==Qe&&(""!==Wn&&!0!==Wn||this.dispatchEvent(new Event("open")))}close(){this.visible=!1,this.dispatchEvent(new Event("close"))}render(){return Co.qy`
1711
+ `,Loader.properties={_mode:{state:!0},_label:{state:!0},_isLabelFun:{state:!0},visible:{type:Boolean,reflect:!0},"no-label":{type:Boolean},value:{type:Number}},customElements.define("pnx-loader",Loader)},5642:(Qe,rt,Wn)=>{"use strict";Wn.d(rt,{A:()=>Map});Wn(3041);var Co=Wn(8340),Dl=Wn(7343),Ll=Wn(6883),Rl=Wn(270),Ul=Wn(6462),Gl=Wn(9740),Zl=(Wn(6795),Wn(927)),Hl=Wn.n(Zl),ql=Wn(2968),Ql=Wn.n(ql),Kl=Wn(748);Hl().workerClass=Ql(),Hl().addProtocol("pmtiles",(new Kl.Zs).tile);class Map extends Hl().Map{constructor(Qe,rt){let Wn=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var Dl;(super({container:rt,style:(0,Co.combineStyles)(Qe,Wn),center:[0,0],zoom:0,maxZoom:24,attributionControl:!1,dragRotate:!1,pitchWithRotate:!1,touchZoomRotate:!0,touchPitch:!1,doubleClickZoom:!1,canvasContextAttributes:{preserveDrawingBuffer:!Qe.isWidthSmall()},transformRequest:Qe.api._getMapRequestTransform(),locale:Qe._t.maplibre,hash:!1,...Wn}),this._loadMarkerImages(),this._parent=Qe,this._options=Wn,this.getContainer().classList.add("pnx-map"),void 0===Wn.touchZoomRotate)&&(null===this||void 0===this||null===(Dl=this.touchZoomRotate)||void 0===Dl||Dl.disableRotation());this._options.raster&&(this._options.background=this._options.background||"streets"),this._attribution=new(Hl().AttributionControl)({compact:!1,...Wn.attributionControl}),this.addControl(this._attribution),this._initMapPosition(),this._picMarker=this._getPictureMarker(),this._picMarkerPreview=this._getPictureMarker(!1),this._picThumbUrl={},this._seqPictures={},this._userLayers=new Set,this._parent.addEventListener("select",this.reloadLayersStyles.bind(this)),setTimeout((()=>{var Qe;!this.loaded()&&null!==(Qe=this._parent)&&void 0!==Qe&&Qe.loader.isVisible()&&this._parent.loader.dismiss({},this._parent._t.map.slow_loading,(async()=>{await this._postLoad(),this._parent.loader.dismiss()}))}),15e3),this.waitForEnoughMapLoaded().then((async()=>await this._postLoad()))}async _postLoad(){this.resize(),await this.setVisibleUsers(this._parent.users),this.reloadLayersStyles(),this.fire("ready")}destroy(){this.remove(),delete this._parent,delete this._options,delete this._attribution,delete this._picMarker,delete this._picMarkerPreview,delete this._picThumbUrl,delete this._seqPictures,delete this._userLayers}waitForEnoughMapLoaded(){return new Promise((Qe=>{let rt=0,Wn=0,Co=0,Dl=0;const onSourceDataLoading=Qe=>{"source"===Qe.dataType&&Qe.tile&&(Qe.sourceId.startsWith("geovisio")?Wn++:rt++)},onSourceData=Qe=>{"source"===Qe.dataType&&Qe.tile&&(Qe.sourceId.startsWith("geovisio")?(Dl++,Qe.isSourceLoaded&&(Dl=Wn)):(Co++,Qe.isSourceLoaded&&(Co=rt))),checkEnoughLoaded()},checkEnoughLoaded=()=>{Co/rt>=.75&&(0===Wn||Dl/Wn>=.75)&&(this.off("sourcedata",onSourceData),this.off("sourcedataloading",onSourceDataLoading),Qe())};this.on("sourcedataloading",onSourceDataLoading),this.on("sourcedata",onSourceData)}))}_initMapPosition(){this._options.center&&this._options.center!=[0,0]||this._options.zoom&&0!==this._options.zoom||this._options.hash||this._parent.onceAPIReady().then((()=>{var Qe,rt;let Wn=null===(Qe=this._parent)||void 0===Qe||null===(rt=Qe.api)||void 0===rt?void 0:rt.getDataBbox();if(Wn)try{Wn=new(Hl().LngLatBounds)(Wn),this.loaded()?this.fitBounds(Wn,{animate:!1}):this.waitForEnoughMapLoaded().then((()=>this.fitBounds(Wn,{animate:!1})))}catch(Co){console.warn("Received invalid bbox: "+Wn)}}))}_loadMarkerImages(){[{id:"pnx-marker",img:Ll},{id:"pnx-arrow-flat",img:Ul},{id:"pnx-arrow-360",img:Gl}].forEach((Qe=>{const rt=new Image(64,64);rt.onload=()=>this.addImage(Qe.id,rt),rt.src=Qe.img}))}_hasQualityScore(){var Qe,rt,Wn,Co;const Dl=(null===(Qe=this.getStyle())||void 0===Qe||null===(rt=Qe.metadata)||void 0===rt?void 0:rt["panoramax:fields"])||{};return(null===Dl||void 0===Dl||null===(Wn=Dl.pictures)||void 0===Wn?void 0:Wn.includes("gps_accuracy"))&&(null===Dl||void 0===Dl||null===(Co=Dl.pictures)||void 0===Co?void 0:Co.includes("h_pixel_density"))}_hasGridStats(){var Qe,rt,Wn,Co,Dl,Ll;const Rl=(null===(Qe=this.getStyle())||void 0===Qe||null===(rt=Qe.metadata)||void 0===rt?void 0:rt["panoramax:fields"])||{};return(null===Rl||void 0===Rl||null===(Wn=Rl.grid)||void 0===Wn?void 0:Wn.includes("nb_360_pictures"))&&(null===Rl||void 0===Rl||null===(Co=Rl.grid)||void 0===Co?void 0:Co.includes("nb_flat_pictures"))&&(null===Rl||void 0===Rl||null===(Dl=Rl.grid)||void 0===Dl?void 0:Dl.includes("coef_360_pictures"))&&(null===Rl||void 0===Rl||null===(Ll=Rl.grid)||void 0===Ll?void 0:Ll.includes("coef_flat_pictures"))}reloadVectorTiles(){[...this._userLayers].forEach((Qe=>{const rt=this.getSource((0,Co.getUserSourceId)(Qe));rt.setTiles(rt.tiles)}))}hasTwoBackgrounds(){return void 0!==this.getLayer(Co.RASTER_LAYER_ID)}getBackground(){if(!this.getLayer(Co.RASTER_LAYER_ID))return"streets";return"visible"==this.getLayoutProperty(Co.RASTER_LAYER_ID,"visibility")?"aerial":"streets"}setBackground(Qe){if(!this.getLayer(Co.RASTER_LAYER_ID)&&"aerial"===Qe)throw new Error("No aerial imagery available");this.getLayer(Co.RASTER_LAYER_ID)&&(this.setLayoutProperty(Co.RASTER_LAYER_ID,"visibility","aerial"===Qe?"visible":"none"),this.fire("background-changed",{background:Qe||"streets"}))}getVisibleUsers(){return[...this._userLayers].filter((Qe=>this.getLayer((0,Co.getUserLayerId)(Qe,"pictures"))&&"visible"===this.getLayoutProperty((0,Co.getUserLayerId)(Qe,"pictures"),"visibility")))}onceLayerReady(Qe){return this.getLayer(Qe)?Promise.resolve():new Promise((Qe=>{setTimeout(Qe,250)})).then((()=>this.onceLayerReady(Qe)))}async setVisibleUsers(){let Qe=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];"string"===typeof Qe?Qe=[Qe]:null===Qe&&(Qe=[]),await Promise.all(Qe.filter((Qe=>""!=Qe&&!this._userLayers.has(Qe))).map((Qe=>(this._createPicturesTilesLayer(Qe),this.onceLayerReady((0,Co.getUserLayerId)(Qe,"pictures"))))));const rt=["pictures","sequences","sequences_plus","grid","pictures_symbols"];[...this._userLayers].forEach((Wn=>{rt.forEach((rt=>{const Dl=(0,Co.getUserLayerId)(Wn,rt);this.getLayer(Dl)&&this.setLayoutProperty(Dl,"visibility",Qe.includes(Wn)?"visible":"none")}))})),this.reloadLayersStyles(),this.fire("users-changed",{usersIds:Qe})}filterUserLayersContent(Qe,rt){[...this._userLayers].forEach((Wn=>{this.getLayer((0,Co.getUserLayerId)(Wn,Qe))?(this.setFilter((0,Co.getUserLayerId)(Wn,Qe),rt),"sequences"===Qe&&this.getLayer((0,Co.getUserLayerId)(Wn,"sequences_plus"))&&this.setFilter((0,Co.getUserLayerId)(Wn,"sequences_plus"),rt),"pictures"===Qe&&this.getLayer((0,Co.getUserLayerId)(Wn,"pictures_symbols"))&&this.setFilter((0,Co.getUserLayerId)(Wn,"pictures_symbols"),rt)):console.warn("Layer",(0,Co.getUserLayerId)(Wn,Qe),"not ready")}))}displayPictureMarker(Qe,rt,Wn){let Dl=arguments.length>3&&void 0!==arguments[3]&&arguments[3];this._picMarkerPreview.remove(),void 0!==Qe&&void 0!==rt?this._picMarker.setLngLat([Qe,rt]).setRotation(Wn).addTo(this):this._picMarker.remove(),this.reloadLayersStyles(),Dl||void 0===Qe||void 0===rt||this.flyTo({center:[Qe,rt],zoom:this.getZoom()<Co.TILES_PICTURES_ZOOM+2?Co.TILES_PICTURES_ZOOM+2:this.getZoom(),maxDuration:2e3})}reloadLayersStyles(){const updateStyle=(Qe,rt)=>{[...this._userLayers].forEach((Wn=>{const Dl=(0,Co.getUserLayerId)(Wn,Qe);if(this.getLayer(Dl)){for(let Qe in rt.layout)this.setLayoutProperty(Dl,Qe,rt.layout[Qe]);for(let Qe in rt.paint)this.setPaintProperty(Dl,Qe,rt.paint[Qe])}else console.warn("Layer",Dl,"not ready")}))};["pictures","pictures_symbols","sequences"].forEach((Qe=>{updateStyle(Qe,this._getLayerStyleProperties(Qe))}))}async _createPicturesTilesLayer(Qe){this._userLayers.add(Qe);const rt=this.getStyle().layers.find(Co.isLabelLayer);if("geovisio"!==Qe&&!this.getSource(`geovisio_${Qe}`)){const Wn=await this._parent.api.getUserMapStyle(Qe);Object.entries(Wn.sources).forEach((Qe=>{let[rt,Wn]=Qe;return this.addSource(rt,Wn)})),Wn.layers=Wn.layers||[];Wn.layers.concat((0,Co.getMissingLayerStyles)(Wn.sources,Wn.layers)).filter((Qe=>Object.keys(Qe).length>0)).forEach((Qe=>this.addLayer(Qe,null===rt||void 0===rt?void 0:rt.id)))}this._picPreviewTimer=null,this._picPopup=new(Hl().Popup)({closeButton:!1,closeOnClick:!this._parent.isWidthSmall(),offset:3}),this._picPopup.on("close",(()=>{delete this._picPopup._picId}));const Wn=(0,Co.getUserLayerId)(Qe,"pictures");this.on("mousemove",Wn,(Qe=>{this.getCanvas().style.cursor="pointer";const rt=Object.assign({},Qe);clearTimeout(this._picPreviewTimer),this._picPreviewTimer=setTimeout((()=>this._attachPreviewToPictures(rt,Wn)),100)})),this.on("mouseleave",Wn,(()=>{clearTimeout(this._picPreviewTimer),this.getCanvas().style.cursor="",this._picPopup._picId,this._picPopup.remove()})),this.on("click",Wn,this._onPictureClick.bind(this));const Dl=(0,Co.getUserLayerId)(Qe,"sequences_plus");this.on("mousemove",Dl,(Qe=>{if(this._onSequenceHover(Qe),this.getZoom()<=Co.TILES_PICTURES_ZOOM+1&&(this.getCanvas().style.cursor="pointer",Qe.features[0].properties.id)){const rt=Object.assign({},Qe);clearTimeout(this._picPreviewTimer),this._picPreviewTimer=setTimeout((()=>this._attachPreviewToPictures(rt,Dl)),100)}})),this.on("mouseleave",Dl,(()=>{clearTimeout(this._picPreviewTimer),this.getCanvas().style.cursor="",this._picPopup._picId,this._picPopup.remove()})),this.on("click",Dl,(Qe=>{Qe.preventDefault(),this.getZoom()<=Co.TILES_PICTURES_ZOOM+1&&this._onSequenceClick(Qe)})),"geovisio"===Qe&&this.getLayer("geovisio_grid")&&(this.on("mousemove","geovisio_grid",(Qe=>{if(this.getZoom()<=Co.TILES_PICTURES_ZOOM+1){this.getCanvas().style.cursor="pointer";const rt=Object.assign({},Qe);clearTimeout(this._picPreviewTimer),this._picPreviewTimer=setTimeout((()=>this._attachPreviewToPictures(rt,"geovisio_grid")),100)}})),this.on("mouseleave","geovisio_grid",(()=>{clearTimeout(this._picPreviewTimer),this.getCanvas().style.cursor="",this._picPopup._picId,this._picPopup.remove()})),this.on("click","geovisio_grid",(Qe=>{Qe.preventDefault(),this.flyTo({center:Qe.lngLat,zoom:Co.TILES_PICTURES_ZOOM-6})}))),this.on("click",(Qe=>{!1===Qe.defaultPrevented&&(clearTimeout(this._picPreviewTimer),this._picPopup.remove())}))}_getLayerStyleProperties(Qe){if("pictures_symbols"===Qe)return{paint:{},layout:{"icon-image":["case",["==",["get","id"],this._parent.picture],"",["==",["get","type"],"equirectangular"],"pnx-arrow-360","pnx-arrow-flat"],"symbol-sort-key":this._getLayerSortStyle(Qe)}};{const rt={pictures:"circle",sequences:"line"};return{paint:Object.assign({[`${rt[Qe]}-color`]:this._getLayerColorStyle(Qe)},Co.VECTOR_STYLES[Qe.toUpperCase()].paint),layout:Object.assign({[`${rt[Qe]}-sort-key`]:this._getLayerSortStyle(Qe)},Co.VECTOR_STYLES[Qe.toUpperCase()].layout)}}}_getLayerColorStyle(Qe){const rt=["case",["==",["get","hidden"],!0],Dl.COLORS.HIDDEN,["==",["get","geovisio:status"],"hidden"],Dl.COLORS.HIDDEN],Wn=this._parent.sequence;return"sequences"==Qe&&Wn?rt.push(["==",["get","id"],Wn],Dl.COLORS.SELECTED):Qe.startsWith("pictures")&&Wn&&rt.push(["in",Wn,["get","sequences"]],Dl.COLORS.SELECTED),rt.push(Dl.COLORS.BASE),rt}_getLayerSortStyle(Qe){const rt=["case",["==",["get","hidden"],!0],90],Wn=this._parent.sequence;return"sequences"==Qe&&Wn?rt.push(["==",["get","id"],Wn],100):Qe.startsWith("pictures")&&Wn&&rt.push(["in",Wn,["get","sequences"]],100),rt.push(10),rt}_attachPreviewToPictures(Qe,rt){let Wn=Qe.features.pop();if(!Wn||Wn.properties.id==this._picPopup._picId)return;let Dl=null;if(rt.endsWith("pictures")?Dl=Wn.geometry.coordinates.slice():Qe.lngLat&&(Dl=[Qe.lngLat.lng,Qe.lngLat.lat]),!Dl){const Qe="LineString"===Wn.geometry.type?[Wn.geometry.coordinates]:Wn.geometry.coordinates;let rt=null;const Co=this.getBounds(),Ll=Co.getCenter();for(let Wn=0;Wn<Qe.length;Wn++)for(let Rl=0;Rl<Qe[Wn].length;Rl++)if(Co.contains(Qe[Wn][Rl])){let Co=Ll.distanceTo(new(Hl().LngLat)(...Qe[Wn][Rl]));(null===rt||Co<rt)&&(Dl=Qe[Wn][Rl],rt=Co)}if(!Dl)return}this._picPopup.setLngLat(Dl).addTo(this),this._picThumbUrl[Wn.properties.id]||this._picPopup.setDOMContent((0,Co.getThumbGif)(this._parent._t)),this._picPopup._loading=Wn.properties.id,this._picPopup._picId=Wn.properties.id;const displayThumb=Qe=>{if(this._picPopup._loading===Wn.properties.id)if(delete this._picPopup._loading,Qe){let rt=document.createElement("img");rt.classList.add("pnx-map-thumb"),rt.alt=this._parent._t.map.thumbnail;let Co=new Image;if(Co.src=Qe,Co.addEventListener("load",(()=>{Wn.properties.hidden?rt.children[0].src=Co.src:rt.src=Co.src,this._picPopup.setDOMContent(rt)})),Wn.properties.hidden){const Qe=document.createElement("div");Qe.classList.add("pnx-map-thumb-legend"),Qe.appendChild(document.createTextNode(this._parent._t.map.not_public));const Wn=document.createElement("div");Wn.appendChild(rt),Wn.appendChild(Qe),rt=Wn}}else this._picPopup.remove()};rt.endsWith("pictures")?this._getPictureThumbURL(Wn.properties.id).then(displayThumb):rt.endsWith("grid")?this._getThumbURL(Dl).then(displayThumb):this._getSequenceThumbURL(Wn.properties.id,new(Hl().LngLat)(...Dl)).then(displayThumb)}_getThumbURL(Qe){return this._parent.api.getPicturesAroundCoordinates(Qe[1],Qe[0],.1,1).then((Qe=>{var rt;const Wn=null===Qe||void 0===Qe||null===(rt=Qe.features)||void 0===rt?void 0:rt.pop();return Wn?this._parent.api.findThumbnailInPictureFeature(Wn):null}))}_getSequenceThumbURL(Qe,rt){return rt?this._parent.api.getPicturesAroundCoordinates(rt.lat,rt.lng,1,1,Qe).then((rt=>{var Wn;return(null===rt||void 0===rt||null===(Wn=rt.features)||void 0===Wn?void 0:Wn.length)>0?this._parent.api.findThumbnailInPictureFeature(rt.features[0]):this._parent.api.getPictureThumbnailURLForSequence(Qe)})):this._parent.api.getPictureThumbnailURLForSequence(Qe)}_getPictureThumbURL(Qe,rt){let Wn=null;return Qe&&(void 0!==this._picThumbUrl[Qe]?Wn="string"===typeof this._picThumbUrl[Qe]?Promise.resolve(this._picThumbUrl[Qe]):this._picThumbUrl[Qe]:(this._picThumbUrl[Qe]=this._parent.api.getPictureThumbnailURL(Qe,rt).then((rt=>rt?(this._picThumbUrl[Qe]=rt,rt):(this._picThumbUrl[Qe]=null,null))).catch((()=>{this._picThumbUrl[Qe]=null})),Wn=this._picThumbUrl[Qe])),Wn}_getPictureMarker(){let Qe=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const rt=document.createElement("img");return rt.src=Qe?Rl:Ll,rt.alt="",new(Hl().Marker)({element:rt})}_onSequenceHover(Qe){var rt;Qe.preventDefault(),Qe.features.length>0&&null!==(rt=Qe.features[0].properties)&&void 0!==rt&&rt.id&&this.fire("sequence-hover",{seqId:Qe.features[0].properties.id})}_onSequenceClick(Qe){var rt;Qe.preventDefault(),Qe.features.length>0&&null!==(rt=Qe.features[0].properties)&&void 0!==rt&&rt.id&&this.fire("sequence-click",{seqId:Qe.features[0].properties.id,coordinates:Qe.lngLat})}_onPictureClick(Qe){var rt,Wn;Qe.preventDefault();const Co=(null===Qe||void 0===Qe||null===(rt=Qe.features)||void 0===rt?void 0:rt.length)>0?Qe.features[0]:null;if(null!==Co&&void 0!==Co&&null!==(Wn=Co.properties)&&void 0!==Wn&&Wn.id){let rt=null;try{Co.properties.sequences&&(Array.isArray(Co.properties.sequences)||(Co.properties.sequences=JSON.parse(Co.properties.sequences)),rt=Co.properties.sequences.pop())}catch(Qe){console.log("Sequence ID is not available in vector tiles for picture "+Co.properties.id)}this.fire("picture-click",{picId:Co.properties.id,seqId:rt,feature:Co})}}addEventListener(Qe,rt){let Wn=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};null!==Wn&&void 0!==Wn&&Wn.once?this.once(Qe,rt):this.on(Qe,rt)}}},2771:(Qe,rt,Wn)=>{"use strict";Wn.d(rt,{A:()=>MapMore,T:()=>Ul});var Co=Wn(5642),Dl=Wn(7343),Ll=Wn(8340);const Rl={DEFAULT:"default",AGE:"age",TYPE:"type",SCORE:"score"},Ul=["minDate","maxDate","pic_type","camera","theme","qualityscore"];class MapMore extends Co.A{constructor(Qe,rt){super(Qe,rt,arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}),this._mapFilters={},this._options.theme&&(this._mapFilters={theme:this._options.theme})}reloadLayersStyles(){if(super.reloadLayersStyles(),this._hasGridStats()){let Qe="coef";this._mapFilters.pic_type&&(Qe="flat"==this._mapFilters.pic_type?"coef_flat_pictures":"coef_360_pictures"),this.getStyle().layers.filter((Qe=>Qe.id.endsWith("_grid"))).forEach((rt=>{const Wn=(0,Ll.switchCoefValue)(rt,Qe);for(let Qe in Wn.layout)this.setLayoutProperty(rt.id,Qe,Wn.layout[Qe]);for(let Qe in Wn.paint)this.setPaintProperty(rt.id,Qe,Wn.paint[Qe])}))}}_getDatesForLayerColors(){const Qe=864e5,rt=Date.now();return[rt-30*Qe,rt-365*Qe,rt-730*Qe].map((Qe=>new Date(Qe).toISOString().split("T")[0]))}_getLayerColorStyle(Qe){var rt,Wn,Co,Ul,Gl,Zl,Hl,ql;const Ql=["case",["==",["get","hidden"],!0],Dl.COLORS.HIDDEN],Kl=(null===(rt=this._parent.psv)||void 0===rt||null===(Wn=rt._myVTour)||void 0===Wn||null===(Co=Wn.state)||void 0===Co?void 0:Co.loadingNode)||(null===(Ul=this._parent.psv)||void 0===Ul||null===(Gl=Ul._myVTour)||void 0===Gl||null===(Zl=Gl.state)||void 0===Zl||null===(Hl=Zl.currentNode)||void 0===Hl?void 0:Hl.id),$l=Kl?null===(ql=this._parent.psv)||void 0===ql?void 0:ql._picturesSequences[Kl]:null;if("sequences"==Qe&&$l?Ql.push(["==",["get","id"],$l],Dl.COLORS.SELECTED):"pictures"==Qe&&$l&&Ql.push(["in",$l,["get","sequences"]],Dl.COLORS.SELECTED),this._mapFilters.theme==Rl.AGE){const rt="sequences"==Qe?"date":"ts",Wn=this._getDatesForLayerColors();Ql.push(["!",["has",rt]],Dl.COLORS.BASE,[">=",["get",rt],Wn[0]],Dl.COLORS.PALETTE_4,[">=",["get",rt],Wn[1]],Dl.COLORS.PALETTE_3,[">=",["get",rt],Wn[2]],Dl.COLORS.PALETTE_2,Dl.COLORS.PALETTE_1)}else this._mapFilters.theme==Rl.TYPE?Ql.push(["!",["has","type"]],Dl.COLORS.BASE,["==",["get","type"],"equirectangular"],Dl.COLORS.QUALI_1,Dl.COLORS.QUALI_2):this._mapFilters.theme==Rl.SCORE?Ql.push(["==",Ll.MAP_EXPR_QUALITYSCORE,5],Dl.QUALITYSCORE_VALUES[0].color,["==",Ll.MAP_EXPR_QUALITYSCORE,4],Dl.QUALITYSCORE_VALUES[1].color,["==",Ll.MAP_EXPR_QUALITYSCORE,3],Dl.QUALITYSCORE_VALUES[2].color,["==",Ll.MAP_EXPR_QUALITYSCORE,2],Dl.QUALITYSCORE_VALUES[3].color,Dl.QUALITYSCORE_VALUES[4].color):Ql.push(Dl.COLORS.BASE);return Ql}_getLayerSortStyle(Qe){var rt,Wn,Co,Dl,Ul,Gl,Zl,Hl;const ql=["case",["==",["get","hidden"],!0],90],Ql=(null===(rt=this._parent.psv)||void 0===rt||null===(Wn=rt._myVTour)||void 0===Wn||null===(Co=Wn.state)||void 0===Co?void 0:Co.loadingNode)||(null===(Dl=this._parent.psv)||void 0===Dl||null===(Ul=Dl._myVTour)||void 0===Ul||null===(Gl=Ul.state)||void 0===Gl||null===(Zl=Gl.currentNode)||void 0===Zl?void 0:Zl.id),Kl=Ql?null===(Hl=this._parent.psv)||void 0===Hl?void 0:Hl._picturesSequences[Ql]:null;if("sequences"==Qe&&Kl?ql.push(["==",["get","id"],Kl],100):"pictures"==Qe&&Kl&&ql.push(["in",Kl,["get","sequences"]],100),this._mapFilters.theme==Rl.AGE){const rt="sequences"==Qe?"date":"ts",Wn=this._getDatesForLayerColors();ql.push(["!",["has",rt]],0,[">=",["get",rt],Wn[0]],50,[">=",["get",rt],Wn[1]],49,[">=",["get",rt],Wn[2]],48)}else this._mapFilters.theme==Rl.TYPE?ql.push(["!",["has","type"]],0,["==",["get","type"],"equirectangular"],50):this._mapFilters.theme==Rl.SCORE&&ql.push(["==",Ll.MAP_EXPR_QUALITYSCORE,5],80,["==",Ll.MAP_EXPR_QUALITYSCORE,4],65,["==",Ll.MAP_EXPR_QUALITYSCORE,3],50,["==",Ll.MAP_EXPR_QUALITYSCORE,2],35,["==",Ll.MAP_EXPR_QUALITYSCORE,1],20);return ql.push(10),ql}_mapFiltersToLayersFilters(Qe){let rt={},Wn=[],Co=[],Dl=!1;if(Qe.minDate&&""!==Qe.minDate&&(rt.minDate=Qe.minDate,Wn.push([">=",["get","date"],Qe.minDate]),Co.push([">=",["get","ts"],Qe.minDate])),Qe.maxDate&&""!==Qe.maxDate){rt.maxDate=Qe.maxDate,Wn.push(["<=",["get","date"],Qe.maxDate]);let Dl=new Date(Qe.maxDate);Dl.setDate(Dl.getDate()+1),Dl=Dl.toISOString().split("T")[0],Co.push(["<=",["get","ts"],Dl])}if(Qe.pic_type&&""!==Qe.pic_type&&(rt.pic_type="flat"===Qe.pic_type?"flat":"equirectangular",Wn.push(["==",["get","type"],rt.pic_type]),Co.push(["==",["get","type"],rt.pic_type])),this._hasGridStats()&&(Dl=!0),Qe.camera&&""!==Qe.camera){rt.camera=Qe.camera;const Dl=Qe.camera.toLowerCase().trim()+" ",Ll=Qe.camera.toLowerCase().trim()+"zzzzzzzzzzzzzzzzzzzz",Rl=["collator",{"case-sensitive":!1,"diacritic-sensitive":!1}];Wn.push([">=",["get","model"],Dl,Rl]),Wn.push(["<=",["get","model"],Ll,Rl]),Co.push([">=",["get","model"],Dl,Rl]),Co.push(["<=",["get","model"],Ll,Rl])}return Qe.qualityscore&&Qe.qualityscore.length>0&&(rt.qualityscore=Qe.qualityscore,Wn.push(["in",Ll.MAP_EXPR_QUALITYSCORE,["literal",rt.qualityscore]]),Co.push(["in",Ll.MAP_EXPR_QUALITYSCORE,["literal",rt.qualityscore]])),Qe.theme&&Object.values(Rl).includes(Qe.theme)&&(rt.theme=Qe.theme,Dl=!0),0==Wn.length?Wn=null:Wn.unshift("all"),0==Co.length?Co=null:(Co.unshift("all"),Co=["step",["zoom"],!0,Ll.TILES_PICTURES_ZOOM,Co]),{mapFilters:rt,mapSeqFilters:Wn,mapPicFilters:Co,reloadMapStyle:Dl}}setFilters(Qe){let rt=arguments.length>1&&void 0!==arguments[1]&&arguments[1],{mapFilters:Wn,mapSeqFilters:Co,mapPicFilters:Dl,reloadMapStyle:Ll}=this._mapFiltersToLayersFilters(Qe);this._mapFilters=Wn,Ll&&this.reloadLayersStyles();const Ul=this.getVisibleUsers().includes("geovisio");Co&&Ul&&(Co=["step",["zoom"],!0,7,Co]),this.filterUserLayersContent("sequences",Co),this.filterUserLayersContent("pictures",Dl),!rt&&(null!==Co||null!==Dl||null!==this._mapFilters.theme&&this._mapFilters.theme!==Rl.DEFAULT)&&Ul&&this.getZoom()<7&&!this._hasGridStats()&&this.easeTo({zoom:7}),this.fire("filters-changed",Object.assign({},this._mapFilters))}async setVisibleUsers(){let Qe=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];await super.setVisibleUsers(Qe);let{mapSeqFilters:rt,mapPicFilters:Wn,reloadMapStyle:Co}=this._mapFiltersToLayersFilters(this._mapFilters);Co&&this.reloadLayersStyles();const Dl=Qe.includes("geovisio");rt&&Dl&&(rt=["step",["zoom"],!0,7,rt]),this.filterUserLayersContent("sequences",rt),this.filterUserLayersContent("pictures",Wn)}}},9048:(Qe,rt,Wn)=>{"use strict";Wn.d(rt,{Ay:()=>Photo,LM:()=>$l,Vf:()=>Tc,cS:()=>Kl});Wn(5003);var Co=Wn(5975),Dl=Wn(2305),Ll=Wn(7343),Rl=Wn(508),Ul=(Wn(3961),Wn(1080),Wn(2710),Wn(1575),Wn(1545)),Gl=Wn(3348),Zl=Wn(4991),Hl=Wn(3727);const ql={baseUrl:Co,width:1280,cols:2,rows:1,tileUrl:()=>null},Ql={id:Ll.BASE_PANORAMA_ID,caption:"",panorama:ql,links:[],gps:[0,0],sequence:{},sphereCorrection:{},horizontalFov:360,properties:{}},Kl=30,$l=250,Tc=3e3;Ul.jM.useNewAnglesOrder=!0;class Photo extends Ul.jM{constructor(Qe,rt){var Wn,Co;let Dl=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};super({container:rt,adapter:[Hl.A,{showErrorTile:!1,baseBlur:!1,resolution:Qe.isWidthSmall()?32:64,shouldGoFast:Dl.shouldGoFast}],withCredentials:"include"==(null===Qe||void 0===Qe||null===(Wn=Qe.fetchOptions)||void 0===Wn?void 0:Wn.credentials),requestHeaders:null===Qe||void 0===Qe||null===(Co=Qe.fetchOptions)||void 0===Co?void 0:Co.headers,panorama:ql,lang:Qe._t.psv,minFov:5,loadingTxt:"&nbsp;",navbar:null,rendererParameters:{preserveDrawingBuffer:!Qe.isWidthSmall()},plugins:[[Gl.$,{dataMode:"server",positionMode:"gps",renderMode:"3d",preload:!0,getNode:()=>{},transitionOptions:()=>{},arrowsPosition:{linkOverlapAngle:Math.PI/6}}],[Zl.b,{}]],...Dl}),this._parent=Qe,this._options=Dl,rt.classList.add("pnx-psv"),this._shouldGoFast=(null===Dl||void 0===Dl?void 0:Dl.shouldGoFast)||(()=>!1),this._transitionDuration=(null===Dl||void 0===Dl?void 0:Dl.transitionDuration)||$l,this._myVTour=this.getPlugin(Gl.$),this._myVTour.datasource.nodeResolver=this._getNodeFromAPI.bind(this),this._myVTour.config.transitionOptions=this._psvNodeTransition.bind(this),this._clearArrows=this._myVTour.arrowsRenderer.clear.bind(this._myVTour.arrowsRenderer),this._myVTour.arrowsRenderer.clear=()=>{},this._myMarkers=this.getPlugin(Zl.b),this._annotationsVisible=!1,this._sequencePlaying=!1,this._picturesNavigation=this._options.picturesNavigation||"any",this._picturesSequences={},this._myVTour.addEventListener("enter-arrow",this._onEnterArrow.bind(this)),this._myVTour.addEventListener("leave-arrow",this._onLeaveArrow.bind(this)),this._myVTour.addEventListener("node-changed",this._onNodeChanged.bind(this)),this._myMarkers.addEventListener("select-marker",this._onSelectMarker.bind(this)),this.addEventListener("position-updated",this._onPositionUpdated.bind(this)),this.addEventListener("zoom-updated",this._onZoomUpdated.bind(this)),this.addEventListener("dblclick",this._onDoubleClick.bind(this)),this._parent.addEventListener("select",this._onSelect.bind(this)),this.loader.size=150,this.loader.color="rgba(61, 61, 61, 0.5)",this.loader.textColor="rgba(255, 255, 255, 0.7)",this.loader.border=5,this.loader.thickness=10,this.loader.canvas.setAttribute("viewBox","0 0 150 150"),this.loader.__updateContent(),this._options.position&&!this._parent.picture&&this.goToPosition(...this._options.position)}async _getNodeFromAPI(Qe){var rt,Wn;if((0,Ll.isNullId)(Qe))return Ql;const Co=await fetch(this._parent.api.getPictureMetadataUrl(Qe,this._picturesSequences[Qe]),this._parent.api._getFetchOptions());let Dl=await Co.json();if(Dl.features&&(Dl=Dl.features.pop()),!Dl||0===Object.keys(Dl).length||!Co.ok)throw this._parent.loader&&this._parent.loader.dismiss(!0,this._parent._t.pnx.error_pic),new Error("Picture with ID "+Qe+" was not found");this._picturesSequences[Qe]=Dl.collection;const Ul=(0,Rl.apiFeatureToPSVNode)(Dl,this._parent._t,this._parent._isInternetFast,this._picturesNavFilter.bind(this));var Gl,Zl;null!==Ul&&void 0!==Ul&&null!==(rt=Ul.sequence)&&void 0!==rt&&rt.prevPic&&(this._picturesSequences[null===Ul||void 0===Ul||null===(Gl=Ul.sequence)||void 0===Gl?void 0:Gl.prevPic]=Dl.collection);null!==Ul&&void 0!==Ul&&null!==(Wn=Ul.sequence)&&void 0!==Wn&&Wn.nextPic&&(this._picturesSequences[null===Ul||void 0===Ul||null===(Zl=Ul.sequence)||void 0===Zl?void 0:Zl.nextPic]=Dl.collection);return Ul}_psvNodeTransition(Qe,rt,Wn){var Co,Dl,Rl;let Ul={};const Gl=this._shouldGoFast()?0:Math.min($l,this._transitionDuration),Zl=Gl>100,Hl=null!=(Wn||(null===rt||void 0===rt?void 0:rt.links.find((rt=>rt.nodeId==Qe.id)))),ql=rt&&Qe.sequence.id===rt.sequence.id,Ql=((null===rt||void 0===rt||null===(Co=rt.properties)||void 0===Co?void 0:Co["view:azimuth"])||0)*(Math.PI/180),Tc=((null===Qe||void 0===Qe||null===(Dl=Qe.properties)||void 0===Dl?void 0:Dl["view:azimuth"])||0)*(Math.PI/180),tu=(0,Ll.getRelativeHeading)(Qe)*(Math.PI/180);this.setOption("maxFov",Math.min(3*Qe.horizontalFov/4,90));const lu={showLoader:!1,effect:"none",speed:0,rotation:!1,rotateTo:{pitch:0,yaw:-tu},zoomTo:Kl};if(360==Qe.horizontalFov)Ul=rt?(0,Ll.getDistance)(rt.gps,Qe.gps)>=.001?lu:{speed:Gl,effect:Hl&&Zl?"fade":"none",rotation:Hl&&ql&&Zl,rotateTo:this.getPosition()}:lu;else if(ql){const Qe=this.getPosition().yaw,Wn=rt.horizontalFov*(Math.PI/180)/2,Co=Qe<=Wn||Qe>=2*Math.PI-Wn,Dl=Math.abs(Ql-Tc)<=Math.PI/4;Ul={speed:Gl,effect:Hl&&Dl&&Zl?"fade":"none",rotation:Hl&&Dl&&Zl,rotateTo:Co?this.getPosition():{pitch:0,yaw:0},zoomTo:Co?this.getZoomLevel():Kl}}else Ul=Object.assign(lu,{rotateTo:{pitch:0,yaw:0}});"fade"===Ul.effect&&Ul.speed>=150?setTimeout(this._clearArrows,Ul.speed-100):this._clearArrows();const du=new CustomEvent("picture-loading",{detail:{...Object.assign({},this.getXYZ(),Ul.rotateTo?{x:180*(Tc+Ul.rotateTo.yaw)/Math.PI}:null,Ul.zoomTo?{z:Ul.zoomTo}:null),picId:Qe.id,lon:Qe.gps[0],lat:Qe.gps[1],first:(null===(Rl=this._parent._initParams)||void 0===Rl?void 0:Rl.getParentPostInit().picture)==Qe.id}});return this.dispatchEvent(du),Ul}_onEnterArrow(Qe){const rt=Qe.link,Wn=Qe.node;let Co;Wn&&(Co=360===Wn.horizontalFov?(this.getPictureOriginalHeading()+180*this.getPosition().yaw/Math.PI)%360:this.getPictureOriginalHeading());const Dl=new CustomEvent("picture-preview-started",{detail:{picId:rt.nodeId,coordinates:rt.gps,direction:Co}});this.dispatchEvent(Dl)}_onLeaveArrow(Qe){const rt=Qe.link,Wn=new CustomEvent("picture-preview-stopped",{detail:{picId:rt.nodeId}});this.dispatchEvent(Wn)}_onPositionUpdated(Qe){let{position:rt}=Qe;const Wn=(0,Ll.positionToXYZ)(rt,this.getZoomLevel());Wn.x+=this.getPictureOriginalHeading(),Wn.x=Wn.x%360;const Co=new CustomEvent("view-rotated",{detail:Wn});this.dispatchEvent(Co),this._onTilesStartLoading()}_onZoomUpdated(Qe){let{zoomLevel:rt}=Qe;const Wn=new CustomEvent("view-rotated",{detail:{...this.getXY(),z:rt}});this.dispatchEvent(Wn),this._onTilesStartLoading()}_onDoubleClick(){this.unfocusAnnotation()}_onNodeChanged(Qe){for(let Dl of document.getElementsByClassName("pnx-psv-tour-arrows"))Dl.classList.remove("pnx-clicked");if(Qe.node.id){var rt,Wn,Co;const Dl=(null===(rt=this._parent._initParams)||void 0===rt?void 0:rt.getParentPostInit().picture)==Qe.node.id;this._parent.select(null===(Wn=Qe.node)||void 0===Wn||null===(Co=Wn.sequence)||void 0===Co?void 0:Co.id,Qe.node.id);const Ll=this.getPictureMetadata();if(!Ll)return void this.dispatchEvent(new CustomEvent("picture-loaded",{detail:{}}));this._prevSequence=Ll.sequence.id;const Rl=new CustomEvent("picture-loaded",{detail:{...this.getXYZ(),picId:Qe.node.id,lon:Ll.gps[0],lat:Ll.gps[1],first:Dl}});this.dispatchEvent(Rl),Ll.panorama.hdUrl?(this.setOption("downloadUrl",Ll.panorama.hdUrl),this.setOption("downloadName",Qe.node.id+".jpg")):this.setOption("downloadUrl",null),this._annotationsVisible&&this.toggleAllAnnotations(!0)}this._onTilesStartLoading()}_onSelectMarker(Qe){var rt;if(Qe.marker&&null!==(rt=Qe.marker.id)&&void 0!==rt&&rt.startsWith("annotation-")){const rt=new CustomEvent("annotation-click",{detail:{annotationId:Qe.marker.data.id}});this.dispatchEvent(rt)}}_onTilesStartLoading(){this._tilesQueueTimer&&(clearInterval(this._tilesQueueTimer),delete this._tilesQueueTimer),this._tilesQueueTimer=setInterval((()=>{if(0===Object.keys(this.adapter.queue.tasks).length){if(this._myVTour.state.currentNode){const Qe=new CustomEvent("picture-tiles-loaded",{detail:{picId:this._myVTour.state.currentNode.id}});this.dispatchEvent(Qe)}clearInterval(this._tilesQueueTimer),delete this._tilesQueueTimer}}),100)}getPictureMetadata(){var Qe,rt,Wn;return(0,Ll.isNullId)(null===(Qe=this._myVTour)||void 0===Qe||null===(rt=Qe.state)||void 0===rt||null===(Wn=rt.currentNode)||void 0===Wn?void 0:Wn.id)?null:this._myVTour.state.currentNode?Object.assign({},this._myVTour.state.currentNode):null}getPictureId(){var Qe,rt,Wn,Co,Dl;const Rl=(null===(Qe=this._myVTour)||void 0===Qe||null===(rt=Qe.state)||void 0===rt?void 0:rt.loadingNode)||(null===(Wn=this._myVTour)||void 0===Wn||null===(Co=Wn.state)||void 0===Co||null===(Dl=Co.currentNode)||void 0===Dl?void 0:Dl.id);return(0,Ll.isNullId)(Rl)?null:Rl}_onSelect(Qe){var rt;Qe.detail.seqId&&(this._picturesSequences[Qe.detail.picId]=Qe.detail.seqId),(null===(rt=this._myVTour.getCurrentNode())||void 0===rt?void 0:rt.id)!==Qe.detail.picId&&(this.loader.show(),this._myVTour.setCurrentNode(Qe.detail.picId).catch((Qe=>{this.showErrorOverlay(Qe,this._parent._t.pnx.error_pic,!0)})))}goToNextPicture(){if(!this.getPictureMetadata())throw new Error("No picture currently selected");const Qe=this.getPictureMetadata().sequence.nextPic;if(!Qe)throw new Error("No next picture available");this._parent.select(this.getPictureMetadata().sequence.id,Qe)}goToPrevPicture(){if(!this.getPictureMetadata())throw new Error("No picture currently selected");const Qe=this.getPictureMetadata().sequence.prevPic;if(!Qe)throw new Error("No previous picture available");this._parent.select(this.getPictureMetadata().sequence.id,Qe)}async goToPosition(Qe,rt){return this._parent.api.getPicturesAroundCoordinates(Qe,rt).then((Qe=>{if(Qe.features.length>0){const rt=Qe.features.pop();return this._parent.select(null===rt||void 0===rt?void 0:rt.collection,rt.id),rt.id}return Promise.reject(new Error("No picture found nearby given coordinates"))}))}getXY(){const Qe=(0,Ll.positionToXYZ)(this.getPosition());return Qe.x=(Qe.x+this.getPictureOriginalHeading())%360,Qe}getXYZ(){const Qe=this.getXY();return Qe.z=this.getZoomLevel(),Qe}getPictureOriginalHeading(){var Qe,rt;return(null===(Qe=this.getPictureMetadata())||void 0===Qe||null===(rt=Qe.properties)||void 0===rt?void 0:rt["view:azimuth"])||0}getPictureRelativeHeading(){return(0,Ll.getRelativeHeading)(this.getPictureMetadata())}clearPictureMetadataCache(){var Qe,rt,Wn,Co;const Dl=null===(Qe=this.getPictureMetadata())||void 0===Qe?void 0:Qe.id,Ll=null===(rt=this.getPictureMetadata())||void 0===rt||null===(Wn=rt.sequence)||void 0===Wn?void 0:Wn.id;null===(Co=this._myVTour.state.currentTooltip)||void 0===Co||Co.hide(),this._myVTour.state.currentTooltip=null,this._myVTour.state.currentNode=null,this._myVTour.state.preload={},this._myVTour.datasource.nodes={},Dl&&this._parent.select(Ll,Dl)}setXYZ(Qe,rt,Wn){const Co=(0,Ll.xyzToPosition)(Qe-this.getPictureOriginalHeading(),rt,Wn);this.rotate({yaw:Co.yaw,pitch:Co.pitch}),this.zoom(Co.zoom)}setHigherContrast(Qe){this.renderer.renderer.toneMapping=Qe?3:0,this.renderer.renderer.toneMappingExposure=Qe?2:1,this.needsUpdate()}getTransitionDuration(){return this._transitionDuration}setTransitionDuration(Qe){if((Qe=parseFloat(Qe))<100||Qe>Tc)throw new Error("Invalid transition duration (should be between 100 and "+Tc+")");this._transitionDuration=Qe;const rt=new CustomEvent("transition-duration-changed",{detail:{value:Qe}});this.dispatchEvent(rt)}setPanorama(Qe,rt){const onFailure=Qe=>{var rt;return this.showErrorOverlay(Qe,null===(rt=this._parent)||void 0===rt?void 0:rt._t.pnx.error_pic,!0)};try{return super.setPanorama(Qe,rt).catch(onFailure)}catch(Wn){onFailure(Wn)}}showErrorOverlay(Qe,rt,Wn){var Co,Ll,Rl,Ul;null!==(Co=this._parent)&&void 0!==Co&&Co.loader.isVisible()||!this.overlay.isVisible()?null===(Ll=this._parent)||void 0===Ll||Ll.loader.dismiss(Qe,rt,Wn?()=>{var Qe;null===(Qe=this._parent)||void 0===Qe||Qe.loader.dismiss(),this.overlay.hide()}:void 0):(console.error(Qe),this.overlay.show({image:`<img style="width: 200px" src="${Dl}" alt="" />`,title:null===(Rl=this._parent)||void 0===Rl?void 0:Rl._t.pnx.error,text:rt+"<br />"+(null===(Ul=this._parent)||void 0===Ul?void 0:Ul._t.pnx.error_click),dissmisable:Wn}))}playSequence(){this._sequencePlaying=!0;const Qe=new Event("sequence-playing",{bubbles:!0,composed:!0});this.dispatchEvent(Qe);const nextPicturePlay=()=>{if(this._sequencePlaying){this.addEventListener("picture-loaded",(()=>{this._playTimer=setTimeout((()=>{nextPicturePlay()}),this.getTransitionDuration())}),{once:!0});try{this.goToNextPicture()}catch(Qe){this.stopSequence()}}};this.addEventListener("click",(()=>this.stopSequence())),nextPicturePlay()}stopSequence(){this._sequencePlaying=!1,this._playTimer&&(clearTimeout(this._playTimer),delete this._playTimer),this.forceRefresh();const Qe=new Event("sequence-stopped",{bubbles:!0,composed:!0});this.dispatchEvent(Qe)}isSequencePlaying(){return this._sequencePlaying}toggleSequencePlaying(){this.isSequencePlaying()?this.stopSequence():this.playSequence()}getPicturesNavigation(){return this._picturesNavigation}setPicturesNavigation(Qe){"none"===Qe&&(Qe="pic"),this._picturesNavigation=Qe;const rt=new CustomEvent("pictures-navigation-changed",{detail:{value:Qe}});this.dispatchEvent(rt)}_picturesNavFilter(Qe){switch(this._picturesNavigation){case"seq":return["next","prev"].includes(Qe.rel);case"pic":case"none":return!1;default:return!0}}areAnnotationsVisible(){return this._annotationsVisible}toggleAllAnnotations(Qe){const rt=this.getPictureMetadata();if(!rt)throw this._myMarkers.clearMarkers(),new Error("No picture currently selected");if(Qe){var Wn,Co;let Qe=rt.properties.annotations;0===(null===(Wn=Qe)||void 0===Wn?void 0:Wn.length)&&console.warn("No annotation available on picture",rt.id);const Dl=null===(Co=this.state.textureData.panoData)||void 0===Co?void 0:Co.baseData;Qe=Qe.map((Qe=>{const rt=this.getPictureMetadata().properties["pers:interior_orientation"].sensor_array_dimensions;if(!rt)return console.warn("Picture lacks pers:interior_orientation.sensor_array_dimensions property, can't compute marker"),null;const Wn=Qe.shape.coordinates.map((Qe=>Qe.map((Qe=>{const Wn=[Qe[0]*Dl.croppedWidth/rt[0],Qe[1]*Dl.croppedHeight/rt[1]],Co=[(Dl.croppedX+Wn[0])/Dl.fullWidth,(Dl.croppedY+Wn[1])/Dl.fullHeight];return[2*(Co[0]-.5)*Math.PI,(.5-Co[1])*Math.PI]}))));return{id:`annotation-${Qe.id}`,polygon:Wn,data:{id:Qe.id},svgStyle:{stroke:"var(--orange)",strokeWidth:"3px",fill:"var(--orange-transparent)",cursor:"pointer"},tooltip:this._parent._t.pnx.semantics_annotation_tooltip}})),this._myMarkers.setMarkers(Qe)}else this._myMarkers.clearMarkers();const Dl=this._annotationsVisible!=Qe;this._annotationsVisible=Qe,Dl&&this.dispatchEvent(new CustomEvent("annotations-toggled",{detail:{visible:Qe}}))}focusOnAnnotation(Qe){this.areAnnotationsVisible()||this.toggleAllAnnotations(!0),this.unfocusAnnotation(!0);const rt=`annotation-${Qe}`;this._myMarkers.updateMarker({id:rt,svgStyle:{stroke:"var(--red)",strokeWidth:"3px",fill:"var(--red-transparent)"},data:{selected:!0}}),this._myMarkers.gotoMarker(rt,0),this.zoom(65)}unfocusAnnotation(){let Qe=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const rt=Object.keys(this._myMarkers.markers).filter((Qe=>{var rt,Wn,Co;return Qe.startsWith("annotation-")&&(null===(rt=this._myMarkers.markers[Qe])||void 0===rt||null===(Wn=rt.config)||void 0===Wn||null===(Co=Wn.data)||void 0===Co?void 0:Co.selected)}));rt.length>0&&(rt.forEach((Qe=>{this._myMarkers.updateMarker({id:Qe,svgStyle:{stroke:"var(--orange)",strokeWidth:"3px",fill:"var(--orange-transparent)"},data:{selected:!1}})})),Qe||this.dispatchEvent(new Event("annotations-unfocused")))}forceRefresh(){var Qe;const rt=this._myVTour.getCurrentNode();if(rt&&rt.panorama.baseUrl!==(null===rt||void 0===rt||null===(Qe=rt.panorama)||void 0===Qe?void 0:Qe.origBaseUrl)){const Qe=this.getZoomLevel(),Wn=this.getPosition();this._myVTour.state.currentNode=null,this._myVTour.setCurrentNode(rt.id,{zoomTo:Qe,rotateTo:Wn,fadeIn:!1,speed:0,rotation:!1})}rt&&rt.panorama.rows>1&&this.adapter.__refresh()}}},4374:(Qe,rt,Wn)=>{"use strict";Wn.d(rt,{A:()=>Popup});var Co=Wn(4542),Dl=Wn(5995),Ll=Wn(8591),Rl=Wn(6627);class Popup extends Co.WF{constructor(){super(),this.visible=!1}connectedCallback(){super.connectedCallback(),this.addEventListener("click",(Qe=>{Qe.target===this&&this.close()})),document.addEventListener("keyup",(Qe=>{"Escape"===Qe.key&&this.visible&&this.close()}))}attributeChangedCallback(Qe,rt,Wn){super.attributeChangedCallback(Qe,rt,Wn),"visible"==Qe&&(""!==Wn&&!0!==Wn||this.dispatchEvent(new Event("open")))}close(){this.visible=!1,this.dispatchEvent(new Event("close"))}render(){return Co.qy`
1712
1712
  <div class="pnx-panel pnx-padded">
1713
1713
  <pnx-button
1714
1714
  class="btn-close"