UNPKG

@panoramax/web-viewer

Version:

Panoramax web viewer for geolocated pictures

289 lines (267 loc) 3.1 MB
/*! * * @panoramax/web-viewer v4.2.0 * https://gitlab.com/panoramax/clients/web-viewer * * Copyright (c) Panoramax team * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ !function(at,st){"object"===typeof exports&&"object"===typeof module?module.exports=st():"function"===typeof define&&define.amd?define("Panoramax",[],st):"object"===typeof exports?exports.Panoramax=st():at.Panoramax=st()}(this,(()=>(()=>{var at={9039:(at,st,ot)=>{"use strict";ot.d(st,{A:()=>Basic});var ut=ot(4542),Hl=ot(5254),rc=ot(4964),sc=ot(7208),oc=ot(5995),_c=ot(7343),wc=ot(2614),Sc=ot.n(wc),iu=ot(8330);ot(1865),ot(3638);class Basic extends ut.WF{constructor(){let at=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super(),this.users=["geovisio"],this["map-style"]=this.getAttribute("map-style")||(0,sc.MapTiles)(),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 ${iu.rE} (28dc2ca)\n\n\ud83c\udd98 Issues can be reported at ${iu.Jk.O}`),at||(this._isInternetFast=null,(0,_c.isInternetFast)().then((at=>this._isInternetFast=at)))}connectedCallback(){super.connectedCallback(),this._t=(0,rc.getTranslations)(this.lang),this.loader=(0,oc.createWebComp)("pnx-loader",{_parent:this,"no-label":(0,_c.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()),Object.entries({map:"map-options",psv:"psv-options",fetchOptions:"fetch-options",mapstyle:"map-style"}).forEach((at=>{let[st,ot]=at;this.getAttribute(st)&&console.error(`Component attribute "${st}" has been renamed into "${ot}". Old attribute "${st}" is ignored.`)}))}_setupAPI(){if(this.loader=this.loader||(0,oc.createWebComp)("pnx-loader",{_parent:this}),!this.endpoint)return void console.warn("No endpoint is defined");this._loadsAPI=this.endpoint;let at=this.endpoint;try{this["map-style"]=JSON.parse(this["map-style"])}catch(ot){}try{this.api=new Hl.A(this.endpoint,{users:this.users,fetch:this["fetch-options"],style:this["map-style"]}),this.api.onceReady().then((()=>{if(at!=this._loadsAPI||!this.api)return;let st=this.api.getUnavailableFeatures(),ot=this.api.getAvailableFeatures();ot=0===st.length?"\u2705 All features available":"\u2705 Available features: "+ot.join(", "),st=0===st.length?"":"\ud83d\udeab Unavailable features: "+st.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 ${ot}\n ${st}\n`.trim())})).catch((at=>this.loader.dismiss(at,this._t.pnx.error_api))).finally((()=>delete this._loadsAPI))}catch(ot){var st;delete this._loadsAPI,null!==(st=this.loader)&&void 0!==st&&st.dismiss?this.loader.dismiss(ot,this._t.pnx.error_api):console.error(ot)}}onceReady(){throw new Error("You must override this method on sub-class")}onceAPIReady(){return this.api?this.api.onceReady():new Promise((at=>setTimeout(at,100))).then(this.onceAPIReady.bind(this))}createRenderRoot(){return this}attributeChangedCallback(at,st,ot){if(super.attributeChangedCallback(at,st,ot),"endpoint"===at&&(this._loadsAPI&&ot&&this._loadsAPI===ot||this.api&&this.api._endpoint===ot||!ot||((this._loadsAPI||this.api)&&(delete this.api,delete this._loadsAPI),this._setupAPI())),["picture","sequence"].includes(at)){let ut,Hl,rc,sc;"picture"===at?(ut=this.sequence,rc=this.sequence,Hl=ot,sc=st):(ut=ot,rc=st,Hl=this.picture,sc=this.picture),this.dispatchEvent(new CustomEvent("select",{bubbles:!0,composed:!0,detail:{seqId:ut,picId:Hl,prevSeqId:rc,prevPicId:sc}}))}}getClassName(){return"Basic"}select(){let at=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,st=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=st,this.sequence=at}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 ut.qy`<p>Should not be used directly, use Viewer/CoverageMap/Editor instead</p>`}getSubComponentsNames(){return["loader","api"]}addEventListener(at,st,ot){let ut=at.split(":").shift();if(ut&&this.getSubComponentsNames().includes(ut)){var Hl;const rc=at.substring(ut.length+1);null!==(Hl=this[ut])&&void 0!==Hl&&Hl.addEventListener?this[ut].addEventListener(rc,st,ot):setTimeout((()=>this.addEventListener(at,st,ot)),50)}else super.addEventListener(at,st,ot)}static GetJSONConverter(){return{fromAttribute:at=>null===at||""===at?null:"object"===typeof at||Array.isArray(at)?at:Sc().parse(at),toAttribute:at=>null===at||""===at?"":"string"===typeof at?at:Sc().stringify(at)}}}Basic.properties={picture:{type:String,reflect:!0},sequence:{type:String,reflect:!0},"fetch-options":{converter:Basic.GetJSONConverter()},users:{type:Array,reflect:!0},"map-style":{type:String},lang:{type:String},endpoint:{type:String}}},153:(at,st,ot)=>{"use strict";ot.d(st,{A:()=>CoverageMap});var ut=ot(9039),Hl=ot(5642),rc=ot(8340),sc=ot(927),oc=(ot(7776),ot(2118));class CoverageMap extends ut.A{constructor(){super(),this._mapContainer=document.createElement("div"),this.onceAPIReady().then((()=>{this.loader.setAttribute("value",30),this._initParams=new oc.Ay(oc.Ay.GetComponentProperties(CoverageMap,this)),this._initMap()}))}disconnectedCallback(){var at;super.disconnectedCallback(),null===(at=this.map)||void 0===at||at.destroy()}getClassName(){return"CoverageMap"}onceReady(){return this.map&&this.map.waitForEnoughMapLoaded?this.map.waitForEnoughMapLoaded():new Promise((at=>setTimeout(at,100))).then(this.onceReady.bind(this))}render(){return[this.loader,this._mapContainer]}getSubComponentsNames(){const at=super.getSubComponentsNames();return at.push("map"),at}_initMap(){class MyMap extends Hl.A{_getLayerStyleProperties(at){return"pictures_symbols"===at?{layout:{visibility:"none"}}:super._getLayerStyleProperties(at)}}this.map=new MyMap(this,this._mapContainer,Object.assign({},this._initParams.getMapInit(),{hash:!0})),this.map.addControl(new sc.NavigationControl({showCompass:!1})),this.loader.setAttribute("value",70),this.addEventListener("select",this._onSelect.bind(this)),this.map.on("picture-click",(at=>this.select(at.seqId,at.picId))),this.map.on("sequence-click",(at=>this.select(at.seqId))),this.map.waitForEnoughMapLoaded().then((async()=>{await(0,oc.mK)(this.map,this._initParams.getMapPostInit()),this.map.reloadLayersStyles(),this.loader.dismiss()}))}_onSelect(at){if(at.detail.picId||at.detail.seqId){const st=at.detail.picId?"pictures":"sequences",ot=this.map.queryRenderedFeatures({layers:[...this.map._userLayers].map((at=>(0,rc.getUserLayerId)(at,st))),filter:["==",["get","id"],at.detail.picId||at.detail.seqId]});ot.length>=0&&null!=ot[0]&&this.map._attachPreviewToPictures({features:ot},st)}}}CoverageMap.properties={"map-options":{converter:ut.A.GetJSONConverter()},...ut.A.properties},customElements.define("pnx-coverage-map",CoverageMap)},1752:(at,st,ot)=>{"use strict";ot.d(st,{A:()=>Editor});ot(7365);var ut=ot(9039),Hl=ot(5642),rc=ot(9048),sc=ot(508),oc=ot(8340),_c=ot(1545),wc=ot(5995);const Sc="sequence-headings";class Editor extends ut.A{constructor(){super(),this.raster=null,this.background="streets",this.users=[],this._psvContainer=document.createElement("div"),this._psvContainer.setAttribute("slot","bg"),this._mapContainer=document.createElement("div"),this._mapContainer.setAttribute("slot","bg"),this.grid=(0,wc.createWebComp)("pnx-cornered-grid"),this.grid.appendChild(this._psvContainer),this.grid.appendChild(this._mapContainer),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()}))}disconnectedCallback(){var at,st;super.disconnectedCallback(),null===(at=this.map)||void 0===at||at.destroy(),null===(st=this.psv)||void 0===st||st.destroy()}getClassName(){return"Editor"}onceReady(){var at,st;return this.map&&this.psv&&null!==(at=(st=this.map).loaded)&&void 0!==at&&at.call(st)?Promise.resolve():new Promise((at=>setTimeout(at,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(),this._moveChildToGrid(),window.addEventListener("DOMContentLoaded",(()=>{this._moveChildToGrid()}),{once:!0})}attributeChangedCallback(at,st,ot){"users"===at&&Array.isArray(ot)&&ot.length>0?console.warn("Parameters users can't be changed in Editor, only selected sequence can be visible"):super.attributeChangedCallback(at,st,ot)}render(){return[this.loader,this.grid]}getSubComponentsNames(){return super.getSubComponentsNames().concat(["map","psv","grid"])}_initPSV(){try{this.psv=new rc.Ay(this,this._psvContainer),this.psv._myVTour.datasource.nodeResolver=this._getNode.bind(this)}catch(at){let st=_c.IJ.isWebGLSupported?this._t.pnx.error_psv:this._t.pnx.error_webgl;this.loader.dismiss(at,st)}}_initMap(){try{this.map=new Hl.A(this,this._mapContainer,{raster:this.raster,background:this.background,supplementaryStyle:this._createMapStyle(),zoom:15,picMarkerDraggable:!0}),(0,oc.linkMapAndPhoto)(this),this.loader.setAttribute("value",50),this._loadSequence(),this.map.once("load",(()=>{this.map.hasTwoBackgrounds()&&this._addMapBackgroundWidget(),this._bindPicturesEvents()}));const at=this.map._picMarker.setRotation.bind(this.map._picMarker);this.map._picMarker.setRotation=st=>(st=void 0===this._lastRelHeading?st:st+this._lastRelHeading-this.psv.getPictureRelativeHeading(),at(st))}catch(at){this.loader.dismiss(at,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:{...oc.VECTOR_STYLES.SEQUENCES.layout},paint:{...oc.VECTOR_STYLES.SEQUENCES.paint}},{id:"geovisio_editor_pictures",type:"circle",source:"geovisio_editor_sequences",layout:{...oc.VECTOR_STYLES.PICTURES.layout},paint:{...oc.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((at=>{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=at.features,this.map.getSource("geovisio_editor_sequences").setData({type:"FeatureCollection",features:[{id:this.sequence,type:"Feature",properties:{id:this.sequence},geometry:{type:"LineString",coordinates:at.features.map((at=>at.geometry.coordinates))}},...at.features.map((at=>(at.properties.id=at.id,at.properties.sequences=[this.sequence],at)))]}),this.picture){const st=at.features.find((at=>at.id===this.picture));st?(this.select(this.sequence,this.picture,!0),this.map.jumpTo({center:st.geometry.coordinates,zoom:18})):console.log("Picture with ID",st,"was not found")}else{const st=[...at.features[0].geometry.coordinates,...at.features[0].geometry.coordinates];for(let ot=1;ot<at.features.length;ot++){const ut=at.features[ot].geometry.coordinates;ut[0]<st[0]&&(st[0]=ut[0]),ut[1]<st[1]&&(st[1]=ut[1]),ut[0]>st[2]&&(st[2]=ut[0]),ut[1]>st[3]&&(st[3]=ut[1])}this.map.fitBounds(st,{animate:!1})}})).catch((at=>this.loader.dismiss(at,this._t.pnx.error_api)))}_getNode(at){const st=this._sequenceData.find((st=>st.properties.id===at)),ot=st?(0,sc.apiFeatureToPSVNode)(st,this._t,this._isInternetFast,void 0,(at=>this.api.cleanResourceURL(at))):null;return ot&&delete ot.links,ot}_addMapBackgroundWidget(){const at=(0,wc.createWebComp)("pnx-map-background",{_parent:this,size:"sm",slot:"bottom-left"});this.grid.appendChild(at)}_moveChildToGrid(){Array.from(this.querySelectorAll("[slot]")).forEach((at=>{var st;null!==(st=at.tagName)&&void 0!==st&&st.toLowerCase().startsWith("pnx-")&&(at._parent=this,at._t=this._t),this.grid.appendChild(at)}))}previewSequenceHeadingChange(at){const st=void 0!==this.map.getLayer(Sc);if(this.map._picMarkerPreview.remove(),void 0===at)return delete this._lastRelHeading,st&&this.map.setLayoutProperty(Sc,"visibility","none"),void(this.picture&&this.map._picMarker.setRotation(this.psv.getXY().x));this._lastRelHeading=at,st||this.map.addLayer({id:Sc,type:"symbol",source:"geovisio_editor_sequences",layout:{"icon-image":"pnx-marker","icon-overlap":"always","icon-size":.8}});const ot=-this.psv.getPictureRelativeHeading();this.map.setLayoutProperty(Sc,"visibility","visible"),this.map.setLayoutProperty(Sc,"icon-rotate",["+",["get","view:azimuth"],ot,at]);const ut=[["==",["geometry-type"],"Point"]];this.picture&&ut.push(["!=",["get","id"],this.picture]),this.map.setFilter(Sc,["all",...ut]),this.picture&&this.map._picMarker.setRotation(this.psv.getXY().x)}_onSelect(){void 0!==this._lastRelHeading&&this.previewSequenceHeadingChange(this._lastRelHeading)}}Editor.properties={raster:{converter:ut.A.GetJSONConverter()},background:{type:String},...ut.A.properties},customElements.define("pnx-editor",Editor)},3407:(at,st,ot)=>{"use strict";ot.d(st,{$p:()=>iu,Ay:()=>PhotoViewer,RD:()=>lu});ot(970);var ut=ot(1545),Hl=ot(4451),rc=ot(9039),sc=ot(9048),oc=ot(5995),_c=ot(7343),wc=ot(2118),Sc=ot(4207);const iu=20,su=Math.PI/6,lu=["pnx-mini","pnx-widget-player","pnx-widget-zoom"];class PhotoViewer extends rc.A{constructor(){super(),this["psv-options"]={},this["url-parameters"]=this.getAttribute("url-parameters")||!0,this["keyboard-shortcuts"]=this.getAttribute("keyboard-shortcuts")||!0,this.widgets=this.getAttribute("widgets")||"true",this.grid=(0,oc.createWebComp)("pnx-cornered-grid"),this.psvContainer=document.createElement("div"),this.psvContainer.setAttribute("slot","bg"),this.grid.appendChild(this.psvContainer),this.popup=(0,oc.createWebComp)("pnx-popup",{_parent:this,onclose:this._onPopupClose.bind(this)}),this.tabindex=0,this._sequencesMetadata={}}_createInitParamsHandler(){var at,st;this._initParams=new wc.Ay(wc.Ay.GetComponentProperties(PhotoViewer,this),Object.assign({},null===(at=this.urlHandler)||void 0===at?void 0:at.currentURLParams(),null===(st=this.urlHandler)||void 0===st?void 0:st.currentURLParams(!0)),{disableAnnotations:localStorage.getItem(_c.DISABLE_ANNOTATIONS_PARAM)})}_initWidgets(){"false"!==this._initParams.getParentPostInit().widgets&&((0,_c.isInIframe)()||(this.grid.appendChild((0,oc.createWebComp)("pnx-widget-player",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden",size:this.isHeightSmall()?"md":"xl"})),this.grid.appendChild((0,oc.createWebComp)("pnx-annotations-switch",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden",size:this.isHeightSmall()?"md":"xl"}))),(0,_c.isInIframe)()?(this.legend=(0,oc.createWebComp)("pnx-widget-legend",{slot:"bottom-right",light:!0,_parent:this,focus:this._initParams.getParentPostInit().focus,picture:this._initParams.getParentPostInit().picture}),this.grid.appendChild(this.legend)):this.isWidthSmall()?(this.legend=(0,oc.createWebComp)("pnx-picture-legend",{_parent:this}),this.bottomDrawer=(0,oc.createWebComp)("pnx-bottom-drawer",{slot:"bottom",_parent:this,class:this._initParams.getParentPostInit().willLoadPicture?void 0:"pnx-hidden"}),this.bottomDrawer.appendChild(this.legend),this.grid.appendChild(this.bottomDrawer),this.addEventListener("select",(at=>{(0,_c.isNullId)(at.detail.picId)?this.bottomDrawer.classList.add("pnx-hidden"):this.bottomDrawer.classList.remove("pnx-hidden")}))):(this.legend=(0,oc.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,oc.createWebComp)("pnx-widget-zoom",{slot:"bottom-right",class:"pnx-print-hidden",_parent:this})),this.grid.appendChild(this.legend)))}connectedCallback(){super.connectedCallback(),this.presetsManager=new Sc.A(this.lang),this["url-parameters"]&&"false"!==this["url-parameters"]&&(this.urlHandler=new Hl.A(this),this.onceReady().then((()=>{this.urlHandler.listenToChanges(),this.urlHandler._onParentChange()}))),this.onceAPIReady().then(this._postAPIInit.bind(this)),this._moveChildToGrid(),window.addEventListener("DOMContentLoaded",(()=>{this._moveChildToGrid()}),{once:!0})}disconnectedCallback(){var at,st;super.disconnectedCallback(),null===(at=this.urlHandler)||void 0===at||at.destroy(),null===(st=this.psv)||void 0===st||st.destroy(),document.body.removeEventListener("click",this._toggleKeyboardBasedOnFocus),window.removeEventListener("keypress",this._toggleKeyboardBasedOnFocus)}getClassName(){return"PhotoViewer"}onceReady(){return this.oncePSVReady().then((()=>this._initParams.getParentPostInit().willLoadPicture&&!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 at;return new Promise((st=>{at=setInterval((()=>{this.psv&&"object"===typeof this.psv&&(this.psv.container?(clearInterval(at),st()):this.psv.addEventListener&&this.psv.addEventListener("ready",(()=>{clearInterval(at),st()}),{once:!0}))}),250)}))}onceFirstPicLoaded(){return this.oncePSVReady().then((()=>this.psv.getPictureMetadata()?Promise.resolve():new Promise((at=>{this.psv.addEventListener("picture-loaded",at,{once:!0})}))))}async _postAPIInit(){this.loader.setAttribute("value",30),this._createInitParamsHandler();const at=this._initParams.getParentPostInit();this._initPSV(),this._initWidgets(),(0,wc.ai)(this,at),at.keyboardShortcuts&&this._handleKeyboardManagement(),at.willLoadPicture?this.psv.getPictureMetadata()?this.loader.dismiss():this.psv.addEventListener("picture-loaded",(()=>this.loader.dismiss()),{once:!0}):this.loader.dismiss()}_initPSV(){try{this.psv=new sc.Ay(this,this.psvContainer,{shouldGoFast:this._psvShouldGoFast.bind(this),keyboard:"always",keyboardActions:{...ut.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:()=>{var at;return null===(at=this._toggleFocus)||void 0===at?void 0:at.call(this)},7:()=>{var at;return null===(at=this._toggleFocus)||void 0===at?void 0:at.call(this)},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,wc.Vy)(this.psv,this._initParams.getPSVPostInit())})),this.psv.addEventListener("sequence-playing",(()=>this.classList.add("pnx-playing"))),this.psv.addEventListener("sequence-stopped",(()=>this.classList.remove("pnx-playing")))}catch(at){let st=ut.IJ.isWebGLSupported?this._t.pnx.error_psv:this._t.pnx.error_webgl;this.loader.dismiss(at,st)}}_enableKeyboard(){this.psv.startKeyboardControl()}_disableKeyboard(){this.psv.stopKeyboardControl()}_toggleKeyboardBasedOnFocus(at){const st=(null===at||void 0===at?void 0:at.target)||document.activeElement;if(this.contains(st)){for(let at of this.grid.childNodes)if("bg"!==at.getAttribute("slot")&&!lu.includes(at.tagName.toLowerCase())&&at.contains(st))return void this._disableKeyboard();this._enableKeyboard()}else this._disableKeyboard()}_handleKeyboardManagement(){window.addEventListener("click",(at=>this._toggleKeyboardBasedOnFocus(at))),window.addEventListener("keypress",this._toggleKeyboardBasedOnFocus.bind(this)),this.popup.addEventListener("open",this._disableKeyboard.bind(this)),this.popup.addEventListener("close",this._enableKeyboard.bind(this)),this.psv.addEventListener("click",this._enableKeyboard.bind(this));for(let at of this.grid.childNodes)"bg"===at.getAttribute("slot")||lu.includes(at.tagName.toLowerCase())||(at.addEventListener("focusin",this._disableKeyboard.bind(this)),at.addEventListener("focusout",(()=>{null===this.popup.getAttribute("visible")&&this._enableKeyboard()})))}_psvShouldGoFast(){return this.psv._sequencePlaying&&this.psv.getTransitionDuration()<1e3}_moveChildToGrid(){Array.from(this.querySelectorAll("[slot]")).forEach((at=>{var st;null!==(st=at.tagName)&&void 0!==st&&st.toLowerCase().startsWith("pnx-")&&(at._parent=this,at._t=this._t),"editors"===at.getAttribute("slot")?this.onceReady().then((()=>{var st;return null===(st=this.legend)||void 0===st?void 0:st.appendChild(at)})):this.grid.appendChild(at)}))}setPopup(at){let st=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;at?this.popup.setAttribute("visible",""):this.popup.removeAttribute("visible"),this.popup.innerHTML="","string"===typeof st?this.popup.innerHTML=st:Array.isArray(st)&&st.forEach((at=>this.popup.appendChild(at)))}_onPopupClose(){this.dispatchEvent(new CustomEvent("focus-changed",{detail:{focus:this.map&&this.isMapWide()?"map":"pic"}}))}_showQualityScoreDoc(){this.setPopup(!0,[(0,oc.createWebComp)("pnx-quality-score-doc",{_t:this._t})])}_showReportForm(){if(!this.psv.getPictureMetadata())throw new Error("No picture currently selected");this.setPopup(!0,[(0,oc.createWebComp)("pnx-report-form",{_parent:this})])}_showShareOptions(){this.setPopup(!0,[(0,oc.createWebComp)("pnx-share-menu",{_parent:this})])}_showSemanticsDoc(){this.setPopup(!0,[(0,oc.createWebComp)("pnx-semantics-doc",{_t:this._t})])}moveCenter(){this.psv.getPictureMetadata()&&this._psvAnimate({speed:sc.LM,yaw:0,pitch:0,zoom:sc.cS})}moveLeft(){this._moveToDirection("left")}moveRight(){this._moveToDirection("right")}moveUp(){this._moveToDirection("up")}moveDown(){this._moveToDirection("down")}_moveToDirection(at){let st=this.psv.getPosition();switch(at){case"up":st.pitch+=su;break;case"left":st.yaw-=su;break;case"down":st.pitch-=su;break;case"right":st.yaw+=su}this._psvAnimate({speed:sc.LM,...st})}_psvAnimate(at){this._lastPsvAnim&&this._lastPsvAnim.cancel(),this._lastPsvAnim=this.psv.animate(at)}addEventListener(at,st,ot){super.addEventListener(at,st,ot)}}PhotoViewer.properties={"psv-options":{converter:rc.A.GetJSONConverter()},widgets:{type:String},"url-parameters":{type:String},"keyboard-shortcuts":{type:String},tabindex:{type:Number},...rc.A.properties},customElements.define("pnx-photo-viewer",PhotoViewer)},8743:(at,st,ot)=>{"use strict";ot.d(st,{A:()=>Viewer});ot(9616);var ut=ot(8340),Hl=ot(3407),rc=ot(2771),sc=ot(7343),oc=ot(5995),_c=ot(9683),wc=ot(2e3),Sc=ot(9438),iu=ot(2118);const su=100;class Viewer extends Hl.Ay{constructor(){super(),this["map-options"]=!0,this.geocoder=this.getAttribute("geocoder")||"nominatim",this.mini=(0,oc.createWebComp)("pnx-mini",{slot:"bottom-left",_parent:this,onexpand:this._onMiniExpand.bind(this),collapsed:!!(0,sc.isNullId)(this.picture)||void 0}),this.mini.addEventListener("expand",this._toggleFocus.bind(this)),this.grid.appendChild(this.mini),this.mapContainer=document.createElement("div"),this.tabindex=0}_createInitParamsHandler(){var at,st;this._initParams=new iu.Ay(iu.Ay.GetComponentProperties(Viewer,this),Object.assign({},null===(at=this.urlHandler)||void 0===at?void 0:at.currentURLParams(),null===(st=this.urlHandler)||void 0===st?void 0:st.currentURLParams(!0)),{map:(0,ut.getMapParamsFromLocalStorage)(),disableAnnotations:localStorage.getItem(sc.DISABLE_ANNOTATIONS_PARAM)})}_initWidgets(){var at,st;"false"!==this._initParams.getParentPostInit().widgets&&(this.grid.appendChild((0,oc.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})),(0,sc.isInIframe)()?(this.legend=(0,oc.createWebComp)("pnx-widget-legend",{slot:"bottom-right",light:!0,_parent:this,focus:this._initParams.getParentPostInit().focus,picture:this._initParams.getParentPostInit().picture}),this.grid.appendChild(this.legend)):this.isWidthSmall()?(this.legend=(0,oc.createWebComp)("pnx-picture-legend",{_parent:this}),this.bottomDrawer=(0,oc.createWebComp)("pnx-bottom-drawer",{slot:"bottom",_parent:this,class:this._initParams.getParentPostInit().willLoadPicture?void 0:"pnx-hidden"}),this.bottomDrawer.appendChild(this.legend),this.grid.appendChild(this.bottomDrawer),this.addEventListener("select",(at=>{(0,sc.isNullId)(at.detail.picId)?this.bottomDrawer.classList.add("pnx-hidden"):this.bottomDrawer.classList.remove("pnx-hidden")}))):(this.legend=(0,oc.createWebComp)("pnx-widget-legend",{slot:this.isWidthSmall()?"top":"top-left",_parent:this,focus:this._initParams.getParentPostInit().focus,picture:this._initParams.getParentPostInit().picture}),this._miniPicLegend=(0,oc.createWebComp)("pnx-mini-picture-legend",{_parent:this}),this.grid.appendChild(this.legend)),(0,sc.isInIframe)()||(this.grid.appendChild((0,oc.createWebComp)("pnx-widget-player",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden",size:this.isHeightSmall()?"md":"xl"})),this.grid.appendChild((0,oc.createWebComp)("pnx-annotations-switch",{slot:"top",_parent:this,class:"pnx-only-psv pnx-print-hidden",size:this.isHeightSmall()?"md":"xl"})),this.grid.appendChild((0,oc.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,oc.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===(at=this.map)||void 0===at||null===(st=at._hasQualityScore)||void 0===st?void 0:st.call(at))||!1,class:"pnx-only-map pnx-print-hidden"})),this.grid.appendChild((0,oc.createWebComp)("pnx-widget-maplayers",{slot:"top-right",_parent:this,class:"pnx-only-map pnx-print-hidden"}))))}disconnectedCallback(){var at;super.disconnectedCallback(),null===(at=this.map)||void 0===at||at.destroy()}getClassName(){return"Viewer"}getSubComponentsNames(){return super.getSubComponentsNames().concat(["mini","map"])}onceReady(){return Promise.all([this.oncePSVReady(),this.onceMapReady()]).then((()=>this._initParams.getParentPostInit().willLoadPicture&&!this.psv.getPictureMetadata()?this.onceFirstPicLoaded():Promise.resolve()))}attributeChangedCallback(at,st,ot){var ut,Hl;if(super.attributeChangedCallback(at,st,ot),"picture"===at)if(null===(ut=this.legend)||void 0===ut||null===(Hl=ut.setAttribute)||void 0===Hl||Hl.call(ut,"picture",ot),(0,sc.isNullId)(st)&&!(0,sc.isNullId)(ot)&&this.mini.removeAttribute("collapsed"),(0,sc.isNullId)(ot))this.map&&this.isMapWide()?this.mini.classList.add("pnx-hidden"):this.map&&!this.isMapWide()&&this._setFocus("map");else if((0,sc.isNullId)(st)&&this.sequence==this._initParams.getParentPostInit().sequence&&!this._initParams.getParentPostInit().picture){var rc,oc;this.mini.classList.remove("pnx-hidden"),this.mini.removeAttribute("collapsed"),"closed"===(null===(rc=this.bottomDrawer)||void 0===rc||null===(oc=rc.getAttribute)||void 0===oc?void 0:oc.call(rc,"openness"))&&this.bottomDrawer.setAttribute("openness","half-opened")}else{var _c,wc;if(this.mini.classList.remove("pnx-hidden"),(0,sc.isNullId)(st))this._setFocus("pic"),"closed"===(null===(_c=this.bottomDrawer)||void 0===_c||null===(wc=_c.getAttribute)||void 0===wc?void 0:wc.call(_c,"openness"))&&this.bottomDrawer.setAttribute("openness","half-opened")}"focus"===at&&this._setFocus(ot)}onceMapReady(){if(!this.map)return Promise.resolve();let at;return new Promise((st=>{at=setInterval((()=>{var ot,ut,Hl;"object"===typeof this.map&&(null!==(ot=this.map)&&void 0!==ot&&null!==(ut=ot.loaded)&&void 0!==ut&&ut.call(ot)?(clearInterval(at),st()):null!==(Hl=this.map)&&void 0!==Hl&&Hl.once&&this.map.once("render",(()=>{clearInterval(at),st()})))}),250)}))}async _initMap(){await new Promise((at=>{this.map=new rc.A(this,this.mapContainer,this._initParams.getMapInit()),(0,ut.saveMapParamsToLocalStorage)(this.map),this.map.once("users-changed",(()=>{this.loader.setAttribute("value",75),at()}))})),await(0,iu.mK)(this.map,this._initParams.getMapPostInit()),(0,ut.initMapKeyboardHandler)(this),(0,ut.linkMapAndPhoto)(this)}async _postAPIInit(){this.loader.setAttribute("value",30),this._createInitParamsHandler();const at=this._initParams.getParentPostInit();this._initPSV(),await this._initMap(),this._initWidgets(),this._moveChildToGrid(),(0,iu.iz)(this,at),at.keyboardShortcuts&&this._handleKeyboardManagement(),at.willLoadPicture?this.psv.addEventListener("picture-loaded",(st=>{(0,iu.iz)(this,at),this.loader.dismiss()}),{once:!0}):this.loader.dismiss()}_enableKeyboard(){this.map&&this.isMapWide()?this._enableKeyboardMap():this._enableKeyboardPSV()}_enableKeyboardMap(){this.psv.stopKeyboardControl(),this.map.keyboard.enable()}_enableKeyboardPSV(){this.psv.startKeyboardControl(),this.map.keyboard.disable()}_disableKeyboard(){this.psv.stopKeyboardControl(),this.map.keyboard.disable()}_toggleKeyboardBasedOnFocus(at){const st=(null===at||void 0===at?void 0:at.target)||document.activeElement;if(this.contains(st)){for(let at of this.grid.childNodes)if("bg"!==at.getAttribute("slot")&&!Hl.RD.includes(at.tagName.toLowerCase())&&at.contains(st))return void this._disableKeyboard();this._enableKeyboard()}else this._disableKeyboard()}_handleKeyboardManagement(){window.addEventListener("click",(at=>this._toggleKeyboardBasedOnFocus(at))),window.addEventListener("keypress",this._toggleKeyboardBasedOnFocus.bind(this)),this.addEventListener("focus-changed",(at=>{this.popup.getAttribute("visible")?this._disableKeyboard():"map"===at.detail.focus?this._enableKeyboardMap():this._enableKeyboardPSV()})),this.popup.addEventListener("open",this._disableKeyboard.bind(this)),this.popup.addEventListener("close",this._enableKeyboard.bind(this)),this.psv.addEventListener("click",this._enableKeyboardPSV.bind(this));for(let at of this.grid.childNodes)"bg"===at.getAttribute("slot")||Hl.RD.includes(at.tagName.toLowerCase())||(at.addEventListener("focusin",this._disableKeyboard.bind(this)),at.addEventListener("focusout",(()=>{null===this.popup.getAttribute("visible")&&this._enableKeyboard()})))}moveCenter(){const at=this.psv.getPictureMetadata();at&&(this.map&&this.isMapWide()?this.map.flyTo({center:at.gps,zoom:20}):super.moveCenter())}_moveToDirection(at){if(this.map&&this.isMapWide()){let st;switch(at){case"up":st=[0,-100];break;case"left":st=[-100,0];break;case"down":st=[0,su];break;case"right":st=[su,0]}this.map.panBy(st)}else super._moveToDirection(at)}isMapWide(){return this.mapContainer.parentNode==this.grid}_setFocus(at){var st,ot,ut,Hl;let rc=arguments.length>1&&void 0!==arguments[1]&&arguments[1],Sc=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("map"===at&&!this.map)throw new Error("Map is not enabled");if(!["map","pic"].includes(at))throw new Error("Invalid focus value (should be pic or map)");if(this.focus=at,(Sc||("map"!==at||!this.map||!this.isMapWide())&&("pic"!==at||this.map&&this.isMapWide()))&&("map"===at?(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,oc.fa)(_c.pt),this._miniPicLegend&&this.mini.appendChild(this._miniPicLegend),(0,sc.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._miniPicLegend&&this.mini.removeChild(this._miniPicLegend)),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,oc.fa)(wc.e5),this.psvContainer.focus()),null===this||void 0===this||null===(st=this.map)||void 0===st||null===(ot=st.resize)||void 0===ot||ot.call(st),this.psv.autoSize(),this.psv.forceRefresh(),null===(ut=this.legend)||void 0===ut||null===(Hl=ut.setAttribute)||void 0===Hl||Hl.call(ut,"focus",this.focus),!rc)){const st=new CustomEvent("focus-changed",{detail:{focus:at}});this.dispatchEvent(st)}}_toggleFocus(){this._setFocus(this.isMapWide()?"pic":"map")}_onMiniExpand(){this.map.resize(),this.psv.autoSize()}_onMapFiltersChange(){var at;const st=(0,Sc.qi)("#pnx-map-filters-menu"),ot=(0,Sc.qi)("#pnx-map-theme"),Hl=(0,ut.mapFiltersFormValues)(st,ot,null===(at=this.map)||void 0===at?void 0:at._hasQualityScore());this.map.setFilters(Hl)}}Viewer.properties={"map-options":{converter:Hl.Ay.GetJSONConverter()},focus:{type:String,reflect:!0},geocoder:{type:String},tabindex:{type:Number},...Hl.Ay.properties},customElements.define("pnx-viewer",Viewer)},3921:(at,st,ot)=>{"use strict";ot.r(st),ot.d(st,{Basic:()=>ut.A,CoverageMap:()=>Hl.A,Editor:()=>rc.A,PhotoViewer:()=>oc.Ay,Viewer:()=>sc.A});var ut=ot(9039),Hl=ot(153),rc=ot(1752),sc=ot(8743),oc=ot(3407)},9341:(at,st,ot)=>{"use strict";ot.r(st),ot.d(st,{core:()=>ut,layout:()=>Hl,menus:()=>rc,ui:()=>sc});var ut=ot(3921),Hl=ot(456),rc=ot(8794),sc=ot(7091)},6784:(at,st,ot)=>{"use strict";ot.d(st,{A:()=>BottomDrawer});var ut=ot(4542),Hl=ot(1198),rc=ot(5995);const sc={opened:0,"half-opened":.7,closed:1};class BottomDrawer extends ut.WF{constructor(){super(),this._isDragging=!1,this.openness="half-opened"}firstUpdated(){super.firstUpdated(),this._boundTouchMove=this._onTouchMove.bind(this),this._boundTouchEnd=this._onTouchEnd.bind(this),this._drawerHeight=window.innerHeight-30;const at=this._getDrawer();at&&(at.style.height=`${this._drawerHeight}px`,at.style.maxHeight=`${this._drawerHeight}px`,(0,rc.onceParentAvailable)(this).then((()=>this._parent.onceReady())).then((()=>{var at,st;null===(at=this._parent.map)||void 0===at||at.addEventListener("click",(()=>this.openness="closed")),null===(st=this._parent.psv)||void 0===st||st.addEventListener("click",(()=>this.openness="closed"))})))}attributeChangedCallback(at,st,ot){if(super.attributeChangedCallback(at,st,ot),"openness"===at){if("opened"!==ot){const at=this.shadowRoot.querySelector(".content");at&&(at.scrollTop=0)}const at=this._getDrawer();at&&(at.style.transform=null)}}disconnectedCallback(){super.disconnectedCallback(),this._cleanupTouchListeners()}_getDrawer(){var at;return null===(at=this.shadowRoot)||void 0===at?void 0:at.querySelector(".drawer")}_onHandleClick(){"opened"===this.openness?this.openness="closed":"half-opened"===this.openness?this.openness="opened":"closed"===this.openness&&(this.openness="half-opened")}_onTouchStart(at){this._isDragging=!0,this._startFingerY=at.touches[0].clientY,this._deltaFingerY=0,this._drawerY=this._drawerHeight*sc[this.openness],window.addEventListener("touchmove",this._boundTouchMove,{passive:!0}),window.addEventListener("touchend",this._boundTouchEnd),window.addEventListener("touchcancel",this._boundTouchEnd)}_onTouchMove(at){if(!this._isDragging)return;const st=this.shadowRoot.querySelector(".content");st.scrollHeight>st.offsetHeight&&st.scrollTop>0?this._updateDrawerTransform(0):(this._deltaFingerY=at.touches[0].clientY-this._startFingerY,this._updateDrawerTransform(this._drawerY+this._deltaFingerY))}_onTouchEnd(at){(this._isDragging&&!(Math.abs(this._deltaFingerY)<30)||at.target.closest(".handle"))&&(at.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(at){let st=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const ot=this._getDrawer();ot&&(at=Math.max(0,Math.min(at,this._drawerHeight-30)),st&&(this._deltaFingerY<0?"closed"===this.openness?Math.abs(this._deltaFingerY)>this._drawerHeight*(1-sc["half-opened"])?this.openness="opened":this.openness="half-opened":this.openness="opened":this.openness="closed",this._drawerY=null,at=Math.max(0,Math.min(sc[this.openness]*this._drawerHeight,this._drawerHeight-30))),ot.style.transform=`translateY(${at}px)`)}render(){const at={drawer:!0,[this.openness]:!0,dragging:this._isDragging};return ut.qy` <div class=${(0,Hl.H)(at)} @touchstart="${this._onTouchStart}" @touchmove="${this._onTouchMove}" @touchend="${this._onTouchEnd}" > <div class="handle" @click=${this._onHandleClick}> <div class="handle-bar"></div> </div> <div class="content"> <slot></slot> </div> </div> `}}BottomDrawer.styles=ut.AH` :host { position: fixed; bottom: 0; left: 0; width: 100%; z-index: 130; pointer-events: none; touch-action: none; } .drawer { background: var(--widget-bg); border-top-left-radius: 16px; border-top-right-radius: 16px; box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2); display: flex; flex-direction: column; transition: transform 0.3s ease; will-change: transform; touch-action: auto; pointer-events: auto; } .drawer.dragging { transition: none; } .drawer.closed { transform: translateY(calc(100% - 30px)); } .drawer.half-opened { transform: translateY(70%); } .drawer.half-opened .content { overflow-y: hidden; } .drawer.opened { transform: translateY(0%); } .handle { height: 30px; display: flex; align-items: center; justify-content: center; cursor: pointer; } .handle-bar { width: 40px; height: 5px; background: var(--grey-pale); border-radius: 3px; } .content { overflow: auto; flex: 1; } `,BottomDrawer.properties={_fingerY:{state:!0},_deltaFingerY:{state:!0},_drawerY:{state:!0},_isDragging:{state:!0},_drawerHeight:{state:!0},openness:{type:String,reflect:!0}},customElements.define("pnx-bottom-drawer",BottomDrawer)},7422:(at,st,ot)=>{"use strict";ot.d(st,{A:()=>CorneredGrid});var ut=ot(4542);class CorneredGrid extends ut.WF{render(){return ut.qy` <div class="bg"> <slot name="bg"></slot> </div> <div class="row top"> <div class="corner left" part="corner-top-left"> <slot name="top-left"></slot> </div> <div class="corner middle" part="corner-top"> <slot name="top"></slot> </div> <div class="corner right" part="corner-top-right"> <slot name="top-right"></slot> </div> </div> <div class="row bottom"> <div class="corner left" part="corner-bottom-left"> <slot name="bottom-left"></slot> </div> <div class="corner middle" part="corner-bottom"> <slot name="bottom"></slot> </div> <div class="corner right" part="corner-bottom-right"> <slot name="bottom-right"></slot> </div> </div> `}}CorneredGrid.styles=ut.AH` :host { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; gap: 5px; flex-wrap: no-wrap; } .bg { position: absolute; inset: 0; z-index: 0; } .row { display: flex; flex-direction: row; flex: 1 1 50%; pointer-events: none; } .row.bottom { align-items: flex-end; } .corner { position: relative; flex: 1 1 33%; display: flex; gap: 10px; height: min-content; } .corner slot { pointer-events: auto; position: relative; z-index: 120; } .row.bottom .corner:not(.middle) { flex-direction: column; } .row.bottom .corner.left { flex-direction: column-reverse; justify-content: flex-start; align-items: flex-start; } .row.bottom .corner.middle { justify-content: center; align-items: flex-end; } .row.bottom .corner.right { justify-content: flex-end; align-items: flex-end; } .row.top .corner { flex-direction: row; } .row.top .corner.left { justify-content: flex-start; align-items: flex-start; } .row.top .corner.middle { justify-content: center; } .row.top .corner.right { justify-content: flex-end; align-items: flex-start; } `,customElements.define("pnx-cornered-grid",CorneredGrid)},1445:(at,st,ot)=>{"use strict";ot.d(st,{A:()=>Mini});var ut=ot(4542),Hl=ot(1462),rc=ot(5721);class Mini extends ut.WF{constructor(){super(),this.collapsed=!1,this.icon=null}render(){var at,st;const ot=(null===(at=this._parent)||void 0===at?void 0:at.isWidthSmall())||(null===(st=this._parent)||void 0===st?void 0:st.isHeightSmall()),onExpand=()=>this.dispatchEvent(new Event("expand",{bubbles:!0,composed:!0}));if(this.collapsed||ot){const at=ot?onExpand:()=>this.collapsed=!1;return ut.qy`<pnx-button kind="flat" size="xxl" style="bottom: 0" @click=${at} >${this.icon}</pnx-button>`}var sc,oc,_c;return ut.qy` <slot></slot> <pnx-button kind="superflat" title=${null===(sc=this._parent)||void 0===sc?void 0:sc._t.pnx.expand_info} style="top: 0; right: 0" @click=${onExpand} > <img src=${Hl} alt="" /> ${null===(oc=this._parent)||void 0===oc?void 0:oc._t.pnx.expand} </pnx-button> <pnx-button kind="flat" title=${null===(_c=this._parent)||void 0===_c?void 0:_c._t.pnx.minimize} style="bottom: 0; left: 0" @click=${()=>this.collapsed=!0} > <img src=${rc} alt="" /> </pnx-button> `}}Mini.styles=ut.AH` :host { display: block; position: absolute; inset: 0; pointer-events: none; } slot { z-index: 120; pointer-events: auto; } pnx-button { z-index: 121; position: absolute; pointer-events: auto; } pnx-button img { height: 20px; } pnx-button:not([size="xxl"])::part(btn) { border-top-left-radius: 0; border-bottom-right-radius: 0; } `,Mini.properties={icon:{type:String},collapsed:{type:Boolean,reflect:!0}},customElements.define("pnx-mini",Mini)},5534:(at,st,ot)=>{"use strict";ot.d(st,{A:()=>Tabs});var ut=ot(4542);class Tabs extends ut.WF{constructor(){super(),this.activeTabIndex=0,this.hideNav=!1}_getTabs(){var at;return(null===(at=this.shadowRoot.querySelector("slot[name='title']"))||void 0===at?void 0:at.assignedNodes())||[]}_getContents(){var at;return(null===(at=this.shadowRoot.querySelector("slot[name='content']"))||void 0===at?void 0:at.assignedNodes())||[]}_changeTab(at,st){const ot=this._getTabs(),ut=this._getContents();void 0===at&&void 0===st||(at&&(st=ot.findIndex((st=>st===at||st===at.parentNode))),!isNaN(st)&&st>=0&&st<ot.length&&ot.forEach(((at,ot)=>{ot==st?(this.activeTabIndex=ot,ut[ot].classList.add("active"),at.classList.add("active")):(ut[ot].classList.remove("active"),at.classList.remove("active"))})))}_handleTabClick(at){this._changeTab(at.target)}updated(at){at.has("activeTabIndex")&&this._changeTab(void 0,this.activeTabIndex)}render(){return ut.qy` ${this.hideNav?ut.s6:ut.qy`<nav @click="${this._handleTabClick}"> <slot name="title" @slotchange=${()=>this.activeTabIndex=0}></slot> </nav>`} <div class="contents"> <slot name="content"></slot> </div> `}}Tabs.styles=ut.AH` /* Tabs */ nav { display: flex; gap: 5px; align-items: stretch; overflow-x: auto; touch-action: pan-x; position: sticky; top: 0; background: white; z-index: 125; } nav ::slotted(*) { color: var(--grey-dark); border-bottom: 2px solid rgba(0,0,0,0); cursor: pointer; transition: all 0.1s; flex: 1; } nav ::slotted(*:hover:not(.active)) { background-color: var(--blue-pale); } nav ::slotted(*.active) { color: var(--blue-dark); border-bottom: 2px solid var(--blue-dark); } /* Content */ .contents ::slotted(div) { display: none !important; } .contents ::slotted(.active) { display: block !important; } `,Tabs.properties={activeTabIndex:{type:Number,reflect:!0},hideNav:{type:Boolean}},customElements.define("pnx-tabs",Tabs)},456:(at,st,ot)=>{"use strict";ot.r(st),ot.d(st,{BottomDrawer:()=>ut.A,CorneredGrid:()=>Hl.A,Mini:()=>rc.A,Tabs:()=>sc.A});var ut=ot(6784),Hl=ot(7422),rc=ot(1445),sc=ot(5534)},5036:(at,st,ot)=>{"use strict";ot.d(st,{A:()=>MapBackground});var ut=ot(4542),Hl=ot(7534),rc=ot(6810),sc=ot(5995);class MapBackground extends ut.WF{constructor(){super(),this.size="md"}connectedCallback(){super.connectedCallback(),(0,sc.onceParentAvailable)(this).then((()=>{var at,st;null===(at=this._parent.map)||void 0===at||at.on("background-changed",(at=>{this.bg=at.background})),this.bg=null===(st=this._parent.map)||void 0===st?void 0:st.getBackground()}))}_onBgSelect(at){var st,ot;this.bg=at.target.value,null===(st=this._parent)||void 0===st||null===(ot=st.map)||void 0===ot||ot.setBackground(this.bg)}render(){var at,st;return ut.qy` <input type="radio" id="bg-streets" name="bg" value="streets" @change=${this._onBgSelect} .checked=${"streets"==this.bg} /> <label for="bg-streets"> <img src=${rc} class=${this.size} alt="" /> ${null===(at=this._parent)||void 0===at?void 0:at._t.pnx.map_background_streets} </label> <input type="radio" id="bg-aerial" name="bg" value="aerial" @change=${this._onBgSelect} .checked=${"aerial"==this.bg} /> <label for="bg-aerial"> <img src=${Hl} class=${this.size} alt="" /> ${null===(st=this._parent)||void 0===st?void 0:st._t.pnx.map_background_aerial} </label> `}}MapBackground.styles=[ut.AH` :host { justify-content: space-evenly; box-sizing: border-box; display: flex; gap: 10px; } input { display: none; } label { cursor: pointer; } img { width: 40px; border-radius: 5px; vertical-align: middle; margin-right: 5px; border: 2px solid var(--widget-bg); } img.sm { width: 32px; } input:checked + label img { outline: 3px solid var(--widget-border-btn); } `],MapBackground.properties={bg:{state:!0},size:{type:String}},customElements.define("pnx-map-background",MapBackground)},3581:(at,st,ot)=>{"use strict";ot.d(st,{A:()=>MapFilters});var ut=ot(4542),Hl=ot(5995),rc=ot(7343),sc=ot(8591),oc=ot(5279),_c=ot(9186),wc=ot(6069),Sc=ot(3233),iu=ot(6668),su=ot(7879);class MapFilters extends ut.WF{constructor(){super(),this._formDelay=null,this.showZoomIn=!0}connectedCallback(){super.connectedCallback();for(let at of this.shadowRoot.querySelectorAll("input"))at.addEventListener("change",this._onFormChange.bind(this)),at.addEventListener("keypress",this._onFormChange.bind(this)),at.addEventListener("paste",this._onFormChange.bind(this)),at.addEventListener("input",this._onFormChange.bind(this));(0,Hl.onceParentAvailable)(this).then((()=>{var at,st;return null===(at=(st=this._parent).onceMapReady)||void 0===at?void 0:at.call(st).then((async()=>{this._parent.map.on("zoomend",this._onMapZoom.bind(this)),this._parent.map.on("filters-changed",this._onParentFilterChange.bind(this)),this._onMapZoom(),this._onParentFilterChange(this._parent.map._mapFilters);const at=this._parent.map.getVisibleUsers();if((null===at||void 0===at?void 0:at.length)>0&&"geovisio"!=at[0]){this.user=at[0];const st=await this._parent.api.getUserName(at[0]);st&&(this.user=st)}}))}))}_onMapZoom(){this.showZoomIn=this._parent.map.getZoom()<7}_onParentFilterChange(at){var st;if(this.minDate=(null===at||void 0===at?void 0:at.minDate)||null,this.maxDate=(null===at||void 0===at?void 0:at.maxDate)||null,this.minDate&&this.maxDate&&this.minDate>this.maxDate){const at=this.minDate;this.minDate=this.maxDate,this.maxDate=at,this._onFormChange()}this.score=(null===at||void 0===at||null===(st=at.qualityscore)||void 0===st?void 0:st.length)<5?at.qualityscore.join(","):"",this.type="",null!==at&&void 0!==at&&at.pic_type&&""!=at.pic_type&&(this.type="flat"==at.pic_type?"flat":"equirectangular")}_onSubmit(at){return at.preventDefault(),this._onFormChange(),!1}_onFormChange(){this._formDelay&&clearTimeout(this._formDelay),this._formDelay=setTimeout((()=>{var at;return null===(at=this._parent)||void 0===at?void 0:at._onMapFiltersChange()}),250)}_userSearch(at){return null===this||void 0===this?void 0:this._parent.api.searchUsers(at).then((at=>(at||[]).map((at=>({title:at.label,data:at})))))}_onUserSearchResult(at){var st,ot,ut;return at.detail?at.target.classList.add("pnx-filter-active"):at.target.classList.remove("pnx-filter-active"),null===(st=this._parent)||void 0===st||null===(ot=st.map)||void 0===ot?void 0:ot.setVisibleUsers(null!==(ut=at.detail)&&void 0!==ut&&ut.data?[at.detail.data.id]:["geovisio"])}_onReset(){var at,st;null===(at=this.shadowRoot.querySelector("#pnx-filter-qualityscore"))||void 0===at||at.setAttribute("g