@mapcreator/sdk 3.1.0 → 3.1.2

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.
@@ -243,7 +243,7 @@ import{AttributionControl as e,Event as t,Evented as n,LngLatBounds as r,Map as
243
243
  `;function ha(){return!!(document.fullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled)}function ga(e){return document.fullscreenElement===e||document.webkitFullscreenElement===e||document.mozFullScreenElement===e||document.msFullscreenElement===e}function _a(e){e.requestFullscreen?e.requestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.msRequestFullscreen?e.msRequestFullscreen():e.webkitRequestFullscreen&&e.webkitRequestFullscreen()}function va(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.msExitFullscreen?document.msExitFullscreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen()}function ya(e){if(ha())ga(e)?va():_a(e);else{let e=document.location.href;e+=e.includes(`?`)?`&`:`?`,e+=`close-tab`,window.open(e,`_blank`)}}function ba(e){return $i({type:`button`,className:`control-button fullscreen-control-button`,content:ma,onClick:()=>ya(e.getContainer())})}var xa=`<svg width="12" height="12" viewBox="0 0 12 12" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path d="M6.155 1.146A.546.546 0 0 1 6.53 1c.14 0 .275.053.375.146l1.588 1.5c.1.094.155.221.155.354 0 .132-.056.26-.155.353l-1.588 1.5a.546.546 0 0 1-.373.14.545.545 0 0 1-.37-.146.487.487 0 0 1-.154-.349.486.486 0 0 1 .148-.352L6.84 3.5H6c-1.878 0-3.441 1.476-3.441 3.25S4.122 10 6 10s3.441-1.476 3.441-3.25c0-.133.056-.26.155-.354a.546.546 0 0 1 .375-.146c.14 0 .275.053.374.146.1.094.155.221.155.354C10.5 9.076 8.463 11 6 11S1.5 9.076 1.5 6.75 3.537 2.5 6 2.5h.84l-.685-.647A.486.486 0 0 1 6 1.5c0-.133.056-.26.155-.354Z"/></svg>
244
244
  `;function Sa(e,t){return $i({type:`button`,className:`control-button refresh-button`,content:xa,onClick:()=>{e.easeTo({center:t.center,zoom:t.zoom,pitch:t.pitch,bearing:t.rotation})}})}var Ca=`<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="currentColor"><path d="M5.374.952a4.546 4.546 0 0 1 4.656 4.175 4.55 4.55 0 0 1-.958 3.184l1.824 1.81a.55.55 0 0 1 0 .765.55.55 0 0 1-.602.121.6.6 0 0 1-.179-.12l-1.807-1.81A4.544 4.544 0 0 1 .953 5.376 4.553 4.553 0 0 1 5.374.952m1.454 1.37a3.447 3.447 0 0 0-4.505 4.51 3.45 3.45 0 0 0 3.186 2.13A3.45 3.45 0 0 0 8.957 5.51a3.455 3.455 0 0 0-2.129-3.187"/></svg>
245
245
  `,wa=`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="currentColor"><path d="m7.038 5.96 3.03 3.03L13.1 5.958l1.01 1.01L11.078 10l3.031 3.032-1.01 1.01-3.031-3.031-3.03 3.028-1.01-1.01L9.059 10l-3.03-3.03z"/></svg>
246
- `,Ta={da_DK:{search:`Search`,videoAlert:`The video will only work when you publish the map`,mobileHelpText:`Use two fingers to move the map`,windowsHelpText:`Use Ctrl + scroll to zoom the map`,macHelpText:`Use ⌘ + scroll to zoom the map`},de_DE:{search:`Suche`,videoAlert:`Das Video ist in der veröffentlichten Karte sichtbar.`,mobileHelpText:`Verwenden Sie zwei Finger um die Karte zu bewegen`,windowsHelpText:`Verwenden Sie Strg + Scroll um in der Karte zu zoomen`,macHelpText:`Verwenden Sie ⌘ + Scroll um in der Karte zu zoomen`},en_GB:{search:`Search`,videoAlert:`The video will only work when you publish the map`,mobileHelpText:`Use two fingers to move the map`,windowsHelpText:`Use Ctrl + scroll to zoom the map`,macHelpText:`Use ⌘ + scroll to zoom the map`},es_ES:{search:`Buscar`,videoAlert:`The video will only work when you publish the map`,mobileHelpText:`Use dos dedos para mover el mapa`,windowsHelpText:`Use Ctrl + desplazamiento para hacer zoom en el mapa`,macHelpText:`Use ⌘ + desplazamiento para hacer zoom en el mapa`},fr_FR:{search:`Rechercher`,videoAlert:`Votre vidéo sera diffusée sur la carte publiée`,mobileHelpText:`Utilisez deux doigts pour déplacer la carte`,windowsHelpText:`Utilisez Ctrl + défilement pour zoomer sur la carte`,macHelpText:`Utilisez ⌘ + défilement pour zoomer sur la carte`},it_IT:{search:`Cercare`,videoAlert:`The video will only work when you publish the map`,mobileHelpText:`Usa due dita per muovere la mappa`,windowsHelpText:`Usa Ctrl + Scroll per ingrandire la mappa`,macHelpText:`Usa ⌘ + Scroll per ingrandire la mappa`},nl_NL:{search:`Zoeken`,videoAlert:`The video will only work when you publish the map`,mobileHelpText:`Gebruik twee vingers om de kaart te bewegen`,windowsHelpText:`Gebruik Ctrl + Scroll om de kaart te zoomen`,macHelpText:`Gebruik ⌘ + Scroll om de kaart te zoomen`}};function Ea(){let e=navigator.language.replace(`-`,`_`),t=Object.keys(Ta);return t.find(t=>t===e)??t.find(t=>t.split(`_`)[0]===e.split(`_`)[0])??`en_GB`}var Da=Ea();function Oa(e){return Ta[Da][e]??e}var ka=class{async getLocationInBounds(e,t,n=10){try{let r=await this._callGraphHopper({limit:n,q:e,point:`${t.lat},${t.lng}`});return this._mapResults(r.hits)}catch(e){return console.warn(`Geocoding failed: `,e),[]}}async _callGraphHopper(e){let t=new URLSearchParams(e);t.append(`key`,`c5c40ac9-ed73-4e20-aed6-cfe495604ca8`),t.append(`locale`,Da.slice(0,2));let n={headers:{Accept:`application/json`}},r=`https://graphhopper.com/api/1/geocode?${t}`;return await(await fetch(r,n)).json()}_mapResults(e){return e.map(e=>({id:e.osm_id.toString(),labelTitle:e.name,position:{lng:e.point.lng,lat:e.point.lat},bbox:e.extent?[{lng:e.extent[0],lat:e.extent[1]},{lng:e.extent[2],lat:e.extent[3]}]:null,subtitle:[e.osm_value,e.city,e.state,e.country].filter(Boolean).join(`, `)}))}},Aa=class{map;mapContainer;container;control;input;dropdown;inputWrapper;button;isOpen=!1;geocoder=new ka;suggestions=[];items=[];index=0;debounce;constructor(e){this.map=e,this.container=document.createElement(`div`),this.control=document.createElement(`div`),this.input=document.createElement(`input`),this.dropdown=document.createElement(`div`),this.inputWrapper=document.createElement(`div`),this.button=document.createElement(`button`),this.mapContainer=this.map.getContainer()}init(){this.container.className=`geocoder-container`,this.control.className=`geocoder-control`,this.input.className=`geocoder-input`,this.dropdown.className=`geocoder-dropdown`,this.inputWrapper.className=`geocoder-input-wrapper`,this.button.className=`control-button`,this.input.type=`text`,this.input.placeholder=Oa(`search`),this.button.innerHTML=Ca;let e=document.createElement(`button`);e.className=`geocoder-clear`,e.innerHTML=wa;let t=document.createElement(`div`);return t.className=`geocoder-scrollwrapper`,t.append(this.dropdown),this.inputWrapper.append(this.input,e),this.control.append(this.button,this.inputWrapper,t),e.addEventListener(`click`,()=>this.clearAll()),this.button.addEventListener(`click`,()=>this.toggle()),this.input.addEventListener(`input`,()=>this.onInput()),this.input.addEventListener(`keydown`,e=>this.onKeyDown(e)),this.dropdown.addEventListener(`mousemove`,e=>this.onMouseMove(e)),this.mapContainer.addEventListener(`mousedown`,e=>this.clickOutside(e)),window.addEventListener(`resize`,()=>this.setMaxSizes()),this.setMaxSizes(),this.updateVisibility(),this.container.append(this.control),this.container}clickOutside(e){e.target instanceof Node&&!this.control.contains(e.target)&&this.hide()}setMaxSizes(){let{width:e,height:t}=this.mapContainer.getBoundingClientRect();this.control.style.maxWidth=`${e-40}px`,this.dropdown.style.maxHeight=`${Math.min(310,t-63)}px`}toggle(){this.isOpen=!this.isOpen,this.button.classList.toggle(`open`),this.updateVisibility(),this.isOpen&&this.input.focus()}hide(){this.isOpen&&(this.isOpen=!1,this.button.classList.remove(`open`),this.updateVisibility())}clearDropdown(){this.suggestions=[],this.items=[],this.dropdown.innerHTML=``}clearAll(){this.input.value=``,this.clearDropdown()}updateVisibility(){let e=this.isOpen;this.inputWrapper.style.display=e?`flex`:`none`,e||this.clearAll()}onInput(){let e=this.input.value.trim();if(this.debounce&&clearTimeout(this.debounce),e.length<2){this.dropdown.innerHTML=``;return}this.debounce=window.setTimeout(async()=>{this.suggestions=await this.geocoder.getLocationInBounds(e,this.map.getCenter(),20),this.items=[],this.renderSuggestions()},200)}renderSuggestions(){this.dropdown.innerHTML=``,this.items=[],this.index=0,this.suggestions.forEach(e=>{let t=document.createElement(`div`),n=document.createElement(`div`),r=document.createElement(`div`);t.className=`geocoder-suggestion`,n.className=`title`,r.className=`subtitle`,n.textContent=e.labelTitle,r.textContent=e.subtitle,t.append(n,r),t.addEventListener(`mousedown`,t=>{t.stopPropagation(),this.goToSelection(e)}),this.dropdown.appendChild(t),this.items.push({data:e,el:t})}),this.updateHighlight()}updateHighlight(){this.items.forEach((e,t)=>{e.el.classList.toggle(`highlight`,t===this.index)})}onKeyDown(e){if(e.key===`ArrowUp`)e.preventDefault(),this.index--,this.index<0&&(this.index=this.items.length-1),this.adjustScroll();else if(e.key===`ArrowDown`)e.preventDefault(),this.index++,this.index>this.items.length-1&&(this.index=0),this.adjustScroll();else if(e.key===`Enter`){e.preventDefault();let t=this.items[this.index];t&&this.goToSelection(t.data)}else e.key===`Escape`&&(e.preventDefault(),this.hide());this.updateHighlight()}onMouseMove(e){let t=e.target.closest(`.geocoder-suggestion`);this.index=this.items.findIndex(e=>e.el===t),this.updateHighlight()}goToSelection(e){e.bbox?this.map.fitBounds(e.bbox,{duration:0,animate:!1}):this.map.jumpTo({center:e.position,zoom:16}),this.input.value=e.labelTitle,this.clearDropdown()}adjustScroll(){let e=this.items[this.index].el,t=this.dropdown,n=t.getBoundingClientRect(),r=e.getBoundingClientRect();r.bottom>n.bottom?t.scrollTop+=r.bottom-n.bottom:r.top<n.top&&(t.scrollTop+=r.top-n.top)}};function ja(){return navigator.userAgent.toLowerCase().indexOf(`mobile`)>=0}function Ma(e,t,n,r,i){let a=document.createElement(`div`);return a.classList.add(`web-control`,`adornment`),Na(e,i).forEach(e=>{let i;if(e===`zoomIn`)i=ra(t);else if(e===`zoomOut`)i=ia(t);else if(e===`fullscreen`)i=ba(t);else if(e===`geolocation`)i=pa(t,n);else if(e===`refresh`)i=Sa(t,r);else if(e===`search`)i=new Aa(t).init();else if(e===`toggleAdornments`)i=ea(t,t.getContainer());else return;a.appendChild(i)}),a}function Na(e,t){let n=e.buttons.flatMap(e=>e===`zoom`?[`zoomIn`,`zoomOut`]:e);if(ja()){let e=n.filter(e=>e!==`zoomIn`&&e!==`zoomOut`);if(t){let t=e[0]===`search`?1:0;e.splice(t,0,`toggleAdornments`)}return e}return n}var Pa={here:{href:`https://www.here.com/`,label:`© HERE 2025`},mapcreator:{href:`https://mapcreator.io/`,label:`© Mapcreator`},openStreetMap:{href:`https://www.openstreetmap.org/copyright/`,label:`© OpenStreetMap`}};function Fa(e,t,n){let r=document.createElement(`div`);r.className=`adornment`;let i=()=>{r.innerHTML=Ra(t,e,t.getScale(),n)},a=n.loadReference(e.font??`Arial, sans-serif`).then(i);return t.on(`attributionchange`,i),t.on(`zoomend`,i),t.on(`resize`,i),{element:r,ready:a}}function Ia(e){let t=Object.values(e.style.tileManagers),n=[Pa.mapcreator],r={osm:!1,here:!1};for(let e=0;e<t.length&&!(r.osm&&r.here);++e){let n=t[e];if(n.used){let e=n.getSource();`attribution`in e&&typeof e.attribution==`string`&&(e.attribution.includes(`OpenStreetMap`)&&(r.osm=!0),e.attribution.includes(`HERE`)&&(r.here=!0))}}return r.osm&&n.push(Pa.openStreetMap),r.here&&n.push(Pa.here),n}function La(e,t,n){let r=document.createElement(`span`);r.style.fontFamily=t.cssFamily,r.style.fontWeight=t.weight,r.style.fontStyle=t.style,r.style.fontSize=`${n}px`,r.style.position=`absolute`,r.style.visibility=`hidden`,r.innerText=e,document.body.appendChild(r);let i=Math.max(r.offsetWidth,1);return r.remove(),i}function Ra(e,t,n,r){let{color:i=`#000000`,font:a=`Arial, sans-serif`,fontSize:o=10,orientation:s=`horizontal`,position:c}=t,l=r.resolve(a),u=Ia(e),d=La(u.map(({label:e})=>e).join(` `),l,o),f=o*1.2,p=s===`vertical`,m=[`top_left`,`bottom_left`].includes(c),h=p?f:d,g=p?d:f,_=p?m?-90:90:0,v=p?m?.38*o:.3*o:.38*o,y=u.map(e=>`<a href="${e.href}" target="_blank">${e.label}</a>`).join(` `);return`
246
+ `,Ta={search:`Search`,videoAlert:`The video will only work when you publish the map`,mobileHelpText:`Use two fingers to move the map`,windowsHelpText:`Use Ctrl + scroll to zoom the map`,macHelpText:`Use ⌘ + scroll to zoom the map`},Ea={search:`Suche`,videoAlert:`Das Video ist in der veröffentlichten Karte sichtbar.`,mobileHelpText:`Verwenden Sie zwei Finger um die Karte zu bewegen`,windowsHelpText:`Verwenden Sie Strg + Scroll um in der Karte zu zoomen`,macHelpText:`Verwenden Sie ⌘ + Scroll um in der Karte zu zoomen`},Da={search:`Search`,videoAlert:`The video will only work when you publish the map`,mobileHelpText:`Use two fingers to move the map`,windowsHelpText:`Use Ctrl + scroll to zoom the map`,macHelpText:`Use ⌘ + scroll to zoom the map`,loadingMap:`Loading map`},Oa={da_DK:Ta,de_DE:Ea,en_GB:Da,es_ES:{search:`Buscar`,videoAlert:`The video will only work when you publish the map`,mobileHelpText:`Use dos dedos para mover el mapa`,windowsHelpText:`Use Ctrl + desplazamiento para hacer zoom en el mapa`,macHelpText:`Use ⌘ + desplazamiento para hacer zoom en el mapa`},fr_FR:{search:`Rechercher`,videoAlert:`Votre vidéo sera diffusée sur la carte publiée`,mobileHelpText:`Utilisez deux doigts pour déplacer la carte`,windowsHelpText:`Utilisez Ctrl + défilement pour zoomer sur la carte`,macHelpText:`Utilisez ⌘ + défilement pour zoomer sur la carte`},it_IT:{search:`Cercare`,videoAlert:`The video will only work when you publish the map`,mobileHelpText:`Usa due dita per muovere la mappa`,windowsHelpText:`Usa Ctrl + Scroll per ingrandire la mappa`,macHelpText:`Usa ⌘ + Scroll per ingrandire la mappa`},nl_NL:{search:`Zoeken`,videoAlert:`The video will only work when you publish the map`,mobileHelpText:`Gebruik twee vingers om de kaart te bewegen`,windowsHelpText:`Gebruik Ctrl + Scroll om de kaart te zoomen`,macHelpText:`Gebruik ⌘ + Scroll om de kaart te zoomen`}};function ka(){let e=navigator.language.replace(`-`,`_`),t=Object.keys(Oa);return t.find(t=>t===e)??t.find(t=>t.split(`_`)[0]===e.split(`_`)[0])??`en_GB`}var Aa=ka();function ja(e){return Oa[Aa][e]??Da[e]??e}var Ma=class{async getLocationInBounds(e,t,n=10){try{let r=await this._callGraphHopper({limit:n,q:e,point:`${t.lat},${t.lng}`});return this._mapResults(r.hits)}catch(e){return console.warn(`Geocoding failed: `,e),[]}}async _callGraphHopper(e){let t=new URLSearchParams(e);t.append(`key`,`c5c40ac9-ed73-4e20-aed6-cfe495604ca8`),t.append(`locale`,Aa.slice(0,2));let n={headers:{Accept:`application/json`}},r=`https://graphhopper.com/api/1/geocode?${t}`;return await(await fetch(r,n)).json()}_mapResults(e){return e.map(e=>({id:e.osm_id.toString(),labelTitle:e.name,position:{lng:e.point.lng,lat:e.point.lat},bbox:e.extent?[{lng:e.extent[0],lat:e.extent[1]},{lng:e.extent[2],lat:e.extent[3]}]:null,subtitle:[e.osm_value,e.city,e.state,e.country].filter(Boolean).join(`, `)}))}},Na=class{map;mapContainer;container;control;input;dropdown;inputWrapper;button;isOpen=!1;geocoder=new Ma;suggestions=[];items=[];index=0;debounce;constructor(e){this.map=e,this.container=document.createElement(`div`),this.control=document.createElement(`div`),this.input=document.createElement(`input`),this.dropdown=document.createElement(`div`),this.inputWrapper=document.createElement(`div`),this.button=document.createElement(`button`),this.mapContainer=this.map.getContainer()}init(){this.container.className=`geocoder-container`,this.control.className=`geocoder-control`,this.input.className=`geocoder-input`,this.dropdown.className=`geocoder-dropdown`,this.inputWrapper.className=`geocoder-input-wrapper`,this.button.className=`control-button`,this.input.type=`text`,this.input.placeholder=ja(`search`),this.button.innerHTML=Ca;let e=document.createElement(`button`);e.className=`geocoder-clear`,e.innerHTML=wa;let t=document.createElement(`div`);return t.className=`geocoder-scrollwrapper`,t.append(this.dropdown),this.inputWrapper.append(this.input,e),this.control.append(this.button,this.inputWrapper,t),e.addEventListener(`click`,()=>this.clearAll()),this.button.addEventListener(`click`,()=>this.toggle()),this.input.addEventListener(`input`,()=>this.onInput()),this.input.addEventListener(`keydown`,e=>this.onKeyDown(e)),this.dropdown.addEventListener(`mousemove`,e=>this.onMouseMove(e)),this.mapContainer.addEventListener(`mousedown`,e=>this.clickOutside(e)),window.addEventListener(`resize`,()=>this.setMaxSizes()),this.setMaxSizes(),this.updateVisibility(),this.container.append(this.control),this.container}clickOutside(e){e.target instanceof Node&&!this.control.contains(e.target)&&this.hide()}setMaxSizes(){let{width:e,height:t}=this.mapContainer.getBoundingClientRect();this.control.style.maxWidth=`${e-40}px`,this.dropdown.style.maxHeight=`${Math.min(310,t-63)}px`}toggle(){this.isOpen=!this.isOpen,this.button.classList.toggle(`open`),this.updateVisibility(),this.isOpen&&this.input.focus()}hide(){this.isOpen&&(this.isOpen=!1,this.button.classList.remove(`open`),this.updateVisibility())}clearDropdown(){this.suggestions=[],this.items=[],this.dropdown.innerHTML=``}clearAll(){this.input.value=``,this.clearDropdown()}updateVisibility(){let e=this.isOpen;this.inputWrapper.style.display=e?`flex`:`none`,e||this.clearAll()}onInput(){let e=this.input.value.trim();if(this.debounce&&clearTimeout(this.debounce),e.length<2){this.dropdown.innerHTML=``;return}this.debounce=window.setTimeout(async()=>{this.suggestions=await this.geocoder.getLocationInBounds(e,this.map.getCenter(),20),this.items=[],this.renderSuggestions()},200)}renderSuggestions(){this.dropdown.innerHTML=``,this.items=[],this.index=0,this.suggestions.forEach(e=>{let t=document.createElement(`div`),n=document.createElement(`div`),r=document.createElement(`div`);t.className=`geocoder-suggestion`,n.className=`title`,r.className=`subtitle`,n.textContent=e.labelTitle,r.textContent=e.subtitle,t.append(n,r),t.addEventListener(`mousedown`,t=>{t.stopPropagation(),this.goToSelection(e)}),this.dropdown.appendChild(t),this.items.push({data:e,el:t})}),this.updateHighlight()}updateHighlight(){this.items.forEach((e,t)=>{e.el.classList.toggle(`highlight`,t===this.index)})}onKeyDown(e){if(e.key===`ArrowUp`)e.preventDefault(),this.index--,this.index<0&&(this.index=this.items.length-1),this.adjustScroll();else if(e.key===`ArrowDown`)e.preventDefault(),this.index++,this.index>this.items.length-1&&(this.index=0),this.adjustScroll();else if(e.key===`Enter`){e.preventDefault();let t=this.items[this.index];t&&this.goToSelection(t.data)}else e.key===`Escape`&&(e.preventDefault(),this.hide());this.updateHighlight()}onMouseMove(e){let t=e.target.closest(`.geocoder-suggestion`);this.index=this.items.findIndex(e=>e.el===t),this.updateHighlight()}goToSelection(e){e.bbox?this.map.fitBounds(e.bbox,{duration:0,animate:!1}):this.map.jumpTo({center:e.position,zoom:16}),this.input.value=e.labelTitle,this.clearDropdown()}adjustScroll(){let e=this.items[this.index].el,t=this.dropdown,n=t.getBoundingClientRect(),r=e.getBoundingClientRect();r.bottom>n.bottom?t.scrollTop+=r.bottom-n.bottom:r.top<n.top&&(t.scrollTop+=r.top-n.top)}};function Pa(){return navigator.userAgent.toLowerCase().indexOf(`mobile`)>=0}function Fa(e,t,n,r,i){let a=document.createElement(`div`);return a.classList.add(`web-control`,`adornment`),Ia(e,i).forEach(e=>{let i;if(e===`zoomIn`)i=ra(t);else if(e===`zoomOut`)i=ia(t);else if(e===`fullscreen`)i=ba(t);else if(e===`geolocation`)i=pa(t,n);else if(e===`refresh`)i=Sa(t,r);else if(e===`search`)i=new Na(t).init();else if(e===`toggleAdornments`)i=ea(t,t.getContainer());else return;a.appendChild(i)}),a}function Ia(e,t){let n=e.buttons.flatMap(e=>e===`zoom`?[`zoomIn`,`zoomOut`]:e);if(Pa()){let e=n.filter(e=>e!==`zoomIn`&&e!==`zoomOut`);if(t){let t=e[0]===`search`?1:0;e.splice(t,0,`toggleAdornments`)}return e}return n}var La={here:{href:`https://www.here.com/`,label:`© HERE 2025`},mapcreator:{href:`https://mapcreator.io/`,label:`© Mapcreator`},openStreetMap:{href:`https://www.openstreetmap.org/copyright/`,label:`© OpenStreetMap`}};function Ra(e,t,n){let r=document.createElement(`div`);r.className=`adornment`;let i=()=>{r.innerHTML=Va(t,e,t.getScale(),n)},a=n.loadReference(e.font??`Arial, sans-serif`).then(i);return t.on(`attributionchange`,i),t.on(`zoomend`,i),t.on(`resize`,i),{element:r,ready:a}}function za(e){let t=Object.values(e.style.tileManagers),n=[La.mapcreator],r={osm:!1,here:!1};for(let e=0;e<t.length&&!(r.osm&&r.here);++e){let n=t[e];if(n.used){let e=n.getSource();`attribution`in e&&typeof e.attribution==`string`&&(e.attribution.includes(`OpenStreetMap`)&&(r.osm=!0),e.attribution.includes(`HERE`)&&(r.here=!0))}}return r.osm&&n.push(La.openStreetMap),r.here&&n.push(La.here),n}function Ba(e,t,n){let r=document.createElement(`span`);r.style.fontFamily=t.cssFamily,r.style.fontWeight=t.weight,r.style.fontStyle=t.style,r.style.fontSize=`${n}px`,r.style.position=`absolute`,r.style.visibility=`hidden`,r.innerText=e,document.body.appendChild(r);let i=Math.max(r.offsetWidth,1);return r.remove(),i}function Va(e,t,n,r){let{color:i=`#000000`,font:a=`Arial, sans-serif`,fontSize:o=10,orientation:s=`horizontal`,position:c}=t,l=r.resolve(a),u=za(e),d=Ba(u.map(({label:e})=>e).join(` `),l,o),f=o*1.2,p=s===`vertical`,m=[`top_left`,`bottom_left`].includes(c),h=p?f:d,g=p?d:f,_=p?m?-90:90:0,v=p?m?.38*o:.3*o:.38*o,y=u.map(e=>`<a href="${e.href}" target="_blank">${e.label}</a>`).join(` `);return`
247
247
  <svg
248
248
  class="adornment-svg"
249
249
  data-adornment-name="${B(t.name)}"
@@ -264,7 +264,7 @@ import{AttributionControl as e,Event as t,Evented as n,LngLatBounds as r,Map as
264
264
  pointer-events="none"
265
265
  >${y}</text>
266
266
  </svg>
267
- `}function za(e){return ai(e,(e,t)=>e+Ba(t),0)}function Ba(e){let t=0,n;switch(e.type){case`Polygon`:return Va(e.coordinates);case`MultiPolygon`:for(n=0;n<e.coordinates.length;n++)t+=Va(e.coordinates[n]);return t;case`Point`:case`MultiPoint`:case`LineString`:case`MultiLineString`:return 0}return 0}function Va(e){let t=0;if(e&&e.length>0){t+=Math.abs(Wa(e[0]));for(let n=1;n<e.length;n++)t-=Math.abs(Wa(e[n]))}return t}var Ha=Xr*Xr/2,Ua=Math.PI/180;function Wa(e){let t=e.length-1;if(t<=2)return 0;let n=0,r=0;for(;r<t;){let i=e[r],a=e[r+1===t?0:r+1],o=e[r+2>=t?(r+2)%t:r+2],s=i[0]*Ua,c=a[1]*Ua,l=o[0]*Ua;n+=(l-s)*Math.sin(c),r++}return n*Ha}function Ga(e){return e}function Ka(e){if(e==null)return Ga;var t,n,r=e.scale[0],i=e.scale[1],a=e.translate[0],o=e.translate[1];return function(e,s){s||(t=n=0);var c=2,l=e.length,u=Array(l);for(u[0]=(t+=e[0])*r+a,u[1]=(n+=e[1])*i+o;c<l;)u[c]=e[c],++c;return u}}function qa(e,t){for(var n,r=e.length,i=r-t;i<--r;)n=e[i],e[i++]=e[r],e[r]=n}function Ja(e,t){return typeof t==`string`&&(t=e.objects[t]),t.type===`GeometryCollection`?{type:`FeatureCollection`,features:t.geometries.map(function(t){return Ya(e,t)})}:Ya(e,t)}function Ya(e,t){var n=t.id,r=t.bbox,i=t.properties==null?{}:t.properties,a=Xa(e,t);return n==null&&r==null?{type:`Feature`,properties:i,geometry:a}:r==null?{type:`Feature`,id:n,properties:i,geometry:a}:{type:`Feature`,id:n,bbox:r,properties:i,geometry:a}}function Xa(e,t){var n=Ka(e.transform),r=e.arcs;function i(e,t){t.length&&t.pop();for(var i=r[e<0?~e:e],a=0,o=i.length;a<o;++a)t.push(n(i[a],a));e<0&&qa(t,o)}function a(e){return n(e)}function o(e){for(var t=[],n=0,r=e.length;n<r;++n)i(e[n],t);return t.length<2&&t.push(t[0]),t}function s(e){for(var t=o(e);t.length<4;)t.push(t[0]);return t}function c(e){return e.map(s)}function l(e){var t=e.type,n;switch(t){case`GeometryCollection`:return{type:t,geometries:e.geometries.map(l)};case`Point`:n=a(e.coordinates);break;case`MultiPoint`:n=e.coordinates.map(a);break;case`LineString`:n=o(e.arcs);break;case`MultiLineString`:n=e.arcs.map(o);break;case`Polygon`:n=c(e.arcs);break;case`MultiPolygon`:n=e.arcs.map(c);break;default:return null}return{type:t,coordinates:n}}return l(t)}var Za=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Qa=Math.ceil,$a=Math.floor,eo=`[BigNumber Error] `,to=eo+`Number primitive has more than 15 significant digits: `,no=0x5af3107a4000,G=14,ro=9007199254740991,io=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,0xe8d4a51000,0x9184e72a000],ao=1e7,K=1e9;function oo(e){var t,n,r,i=v.prototype={constructor:v,toString:null,valueOf:null},a=new v(1),o=20,s=4,c=-7,l=21,u=-1e7,d=1e7,f=!1,p=1,m=0,h={prefix:``,groupSize:3,secondaryGroupSize:0,groupSeparator:`,`,decimalSeparator:`.`,fractionGroupSize:0,fractionGroupSeparator:`\xA0`,suffix:``},g=`0123456789abcdefghijklmnopqrstuvwxyz`,_=!0;function v(e,t){var i,a,c,l,f,p,m,h,y=this;if(!(y instanceof v))return new v(e,t);if(t==null){if(e&&e._isBigNumber===!0){y.s=e.s,!e.c||e.e>d?y.c=y.e=null:e.e<u?y.c=[y.e=0]:(y.e=e.e,y.c=e.c.slice());return}if((p=typeof e==`number`)&&e*0==0){if(y.s=1/e<0?(e=-e,-1):1,e===~~e){for(l=0,f=e;f>=10;f/=10,l++);l>d?y.c=y.e=null:(y.e=l,y.c=[e]);return}h=String(e)}else{if(!Za.test(h=String(e)))return r(y,h,p);y.s=h.charCodeAt(0)==45?(h=h.slice(1),-1):1}(l=h.indexOf(`.`))>-1&&(h=h.replace(`.`,``)),(f=h.search(/e/i))>0?(l<0&&(l=f),l+=+h.slice(f+1),h=h.substring(0,f)):l<0&&(l=h.length)}else{if(q(t,2,g.length,`Base`),t==10&&_)return y=new v(e),S(y,o+y.e+1,s);if(h=String(e),p=typeof e==`number`){if(e*0!=0)return r(y,h,p,t);if(y.s=1/e<0?(h=h.slice(1),-1):1,v.DEBUG&&h.replace(/^0\.0*|\./,``).length>15)throw Error(to+e)}else y.s=h.charCodeAt(0)===45?(h=h.slice(1),-1):1;for(i=g.slice(0,t),l=f=0,m=h.length;f<m;f++)if(i.indexOf(a=h.charAt(f))<0){if(a==`.`){if(f>l){l=m;continue}}else if(!c&&(h==h.toUpperCase()&&(h=h.toLowerCase())||h==h.toLowerCase()&&(h=h.toUpperCase()))){c=!0,f=-1,l=0;continue}return r(y,String(e),p,t)}p=!1,h=n(h,t,10,y.s),(l=h.indexOf(`.`))>-1?h=h.replace(`.`,``):l=h.length}for(f=0;h.charCodeAt(f)===48;f++);for(m=h.length;h.charCodeAt(--m)===48;);if(h=h.slice(f,++m)){if(m-=f,p&&v.DEBUG&&m>15&&(e>ro||e!==$a(e)))throw Error(to+y.s*e);if((l=l-f-1)>d)y.c=y.e=null;else if(l<u)y.c=[y.e=0];else{if(y.e=l,y.c=[],f=(l+1)%G,l<0&&(f+=G),f<m){for(f&&y.c.push(+h.slice(0,f)),m-=G;f<m;)y.c.push(+h.slice(f,f+=G));f=G-(h=h.slice(f)).length}else f-=m;for(;f--;h+=`0`);y.c.push(+h)}}else y.c=[y.e=0]}v.clone=oo,v.ROUND_UP=0,v.ROUND_DOWN=1,v.ROUND_CEIL=2,v.ROUND_FLOOR=3,v.ROUND_HALF_UP=4,v.ROUND_HALF_DOWN=5,v.ROUND_HALF_EVEN=6,v.ROUND_HALF_CEIL=7,v.ROUND_HALF_FLOOR=8,v.EUCLID=9,v.config=v.set=function(e){var t,n;if(e!=null)if(typeof e==`object`){if(e.hasOwnProperty(t=`DECIMAL_PLACES`)&&(n=e[t],q(n,0,K,t),o=n),e.hasOwnProperty(t=`ROUNDING_MODE`)&&(n=e[t],q(n,0,8,t),s=n),e.hasOwnProperty(t=`EXPONENTIAL_AT`)&&(n=e[t],n&&n.pop?(q(n[0],-K,0,t),q(n[1],0,K,t),c=n[0],l=n[1]):(q(n,-K,K,t),c=-(l=n<0?-n:n))),e.hasOwnProperty(t=`RANGE`))if(n=e[t],n&&n.pop)q(n[0],-K,-1,t),q(n[1],1,K,t),u=n[0],d=n[1];else if(q(n,-K,K,t),n)u=-(d=n<0?-n:n);else throw Error(eo+t+` cannot be zero: `+n);if(e.hasOwnProperty(t=`CRYPTO`))if(n=e[t],n===!!n)if(n)if(typeof crypto<`u`&&crypto&&(crypto.getRandomValues||crypto.randomBytes))f=n;else throw f=!n,Error(eo+`crypto unavailable`);else f=n;else throw Error(eo+t+` not true or false: `+n);if(e.hasOwnProperty(t=`MODULO_MODE`)&&(n=e[t],q(n,0,9,t),p=n),e.hasOwnProperty(t=`POW_PRECISION`)&&(n=e[t],q(n,0,K,t),m=n),e.hasOwnProperty(t=`FORMAT`))if(n=e[t],typeof n==`object`)h=n;else throw Error(eo+t+` not an object: `+n);if(e.hasOwnProperty(t=`ALPHABET`))if(n=e[t],typeof n==`string`&&!/^.?$|[+\-.\s]|(.).*\1/.test(n))_=n.slice(0,10)==`0123456789`,g=n;else throw Error(eo+t+` invalid: `+n)}else throw Error(eo+`Object expected: `+e);return{DECIMAL_PLACES:o,ROUNDING_MODE:s,EXPONENTIAL_AT:[c,l],RANGE:[u,d],CRYPTO:f,MODULO_MODE:p,POW_PRECISION:m,FORMAT:h,ALPHABET:g}},v.isBigNumber=function(e){if(!e||e._isBigNumber!==!0)return!1;if(!v.DEBUG)return!0;var t,n,r=e.c,i=e.e,a=e.s;out:if({}.toString.call(r)==`[object Array]`){if((a===1||a===-1)&&i>=-K&&i<=K&&i===$a(i)){if(r[0]===0){if(i===0&&r.length===1)return!0;break out}if(t=(i+1)%G,t<1&&(t+=G),String(r[0]).length==t){for(t=0;t<r.length;t++)if(n=r[t],n<0||n>=no||n!==$a(n))break out;if(n!==0)return!0}}}else if(r===null&&i===null&&(a===null||a===1||a===-1))return!0;throw Error(eo+`Invalid BigNumber: `+e)},v.maximum=v.max=function(){return b(arguments,-1)},v.minimum=v.min=function(){return b(arguments,1)},v.random=(function(){var e=9007199254740992,t=Math.random()*e&2097151?function(){return $a(Math.random()*e)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(e){var n,r,i,s,c,l=0,u=[],d=new v(a);if(e==null?e=o:q(e,0,K),s=Qa(e/G),f)if(crypto.getRandomValues){for(n=crypto.getRandomValues(new Uint32Array(s*=2));l<s;)c=n[l]*131072+(n[l+1]>>>11),c>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),n[l]=r[0],n[l+1]=r[1]):(u.push(c%0x5af3107a4000),l+=2);l=s/2}else if(crypto.randomBytes){for(n=crypto.randomBytes(s*=7);l<s;)c=(n[l]&31)*281474976710656+n[l+1]*1099511627776+n[l+2]*4294967296+n[l+3]*16777216+(n[l+4]<<16)+(n[l+5]<<8)+n[l+6],c>=9e15?crypto.randomBytes(7).copy(n,l):(u.push(c%0x5af3107a4000),l+=7);l=s/7}else throw f=!1,Error(eo+`crypto unavailable`);if(!f)for(;l<s;)c=t(),c<9e15&&(u[l++]=c%0x5af3107a4000);for(s=u[--l],e%=G,s&&e&&(c=io[G-e],u[l]=$a(s/c)*c);u[l]===0;u.pop(),l--);if(l<0)u=[i=0];else{for(i=-1;u[0]===0;u.splice(0,1),i-=G);for(l=1,c=u[0];c>=10;c/=10,l++);l<G&&(i-=G-l)}return d.e=i,d.c=u,d}})(),v.sum=function(){for(var e=1,t=arguments,n=new v(t[0]);e<t.length;)n=n.plus(t[e++]);return n},n=(function(){var e=`0123456789`;function n(e,t,n,r){for(var i,a=[0],o,s=0,c=e.length;s<c;){for(o=a.length;o--;a[o]*=t);for(a[0]+=r.indexOf(e.charAt(s++)),i=0;i<a.length;i++)a[i]>n-1&&(a[i+1]??(a[i+1]=0),a[i+1]+=a[i]/n|0,a[i]%=n)}return a.reverse()}return function(r,i,a,c,l){var u,d,f,p,h,_,y,b,x=r.indexOf(`.`),S=o,C=s;for(x>=0&&(p=m,m=0,r=r.replace(`.`,``),b=new v(i),_=b.pow(r.length-x),m=p,b.c=n(po(co(_.c),_.e,`0`),10,a,e),b.e=b.c.length),y=n(r,i,a,l?(u=g,e):(u=e,g)),f=p=y.length;y[--p]==0;y.pop());if(!y[0])return u.charAt(0);if(x<0?--f:(_.c=y,_.e=f,_.s=c,_=t(_,b,S,C,a),y=_.c,h=_.r,f=_.e),d=f+S+1,x=y[d],p=a/2,h=h||d<0||y[d+1]!=null,h=C<4?(x!=null||h)&&(C==0||C==(_.s<0?3:2)):x>p||x==p&&(C==4||h||C==6&&y[d-1]&1||C==(_.s<0?8:7)),d<1||!y[0])r=h?po(u.charAt(1),-S,u.charAt(0)):u.charAt(0);else{if(y.length=d,h)for(--a;++y[--d]>a;)y[d]=0,d||(++f,y=[1].concat(y));for(p=y.length;!y[--p];);for(x=0,r=``;x<=p;r+=u.charAt(y[x++]));r=po(r,f,u.charAt(0))}return r}})(),t=(function(){function e(e,t,n){var r,i,a,o,s=0,c=e.length,l=t%ao,u=t/ao|0;for(e=e.slice();c--;)a=e[c]%ao,o=e[c]/ao|0,r=u*a+o*l,i=l*a+r%ao*ao+s,s=(i/n|0)+(r/ao|0)+u*o,e[c]=i%n;return s&&(e=[s].concat(e)),e}function t(e,t,n,r){var i,a;if(n!=r)a=n>r?1:-1;else for(i=a=0;i<n;i++)if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}return a}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=e[n]<t[n]?1:0,e[n]=i*r+e[n]-t[n];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(r,i,a,o,s){var c,l,u,d,f,p,m,h,g,_,y,b,x,C,w,T,E,D=r.s==i.s?1:-1,O=r.c,k=i.c;if(!O||!O[0]||!k||!k[0])return new v(!r.s||!i.s||(O?k&&O[0]==k[0]:!k)?NaN:O&&O[0]==0||!k?D*0:D/0);for(h=new v(D),g=h.c=[],l=r.e-i.e,D=a+l+1,s||(s=no,l=so(r.e/G)-so(i.e/G),D=D/G|0),u=0;k[u]==(O[u]||0);u++);if(k[u]>(O[u]||0)&&l--,D<0)g.push(1),d=!0;else{for(C=O.length,T=k.length,u=0,D+=2,f=$a(s/(k[0]+1)),f>1&&(k=e(k,f,s),O=e(O,f,s),T=k.length,C=O.length),x=T,_=O.slice(0,T),y=_.length;y<T;_[y++]=0);E=k.slice(),E=[0].concat(E),w=k[0],k[1]>=s/2&&w++;do{if(f=0,c=t(k,_,T,y),c<0){if(b=_[0],T!=y&&(b=b*s+(_[1]||0)),f=$a(b/w),f>1)for(f>=s&&(f=s-1),p=e(k,f,s),m=p.length,y=_.length;t(p,_,m,y)==1;)f--,n(p,T<m?E:k,m,s),m=p.length,c=1;else f==0&&(c=f=1),p=k.slice(),m=p.length;if(m<y&&(p=[0].concat(p)),n(_,p,y,s),y=_.length,c==-1)for(;t(k,_,T,y)<1;)f++,n(_,T<y?E:k,y,s),y=_.length}else c===0&&(f++,_=[0]);g[u++]=f,_[0]?_[y++]=O[x]||0:(_=[O[x]],y=1)}while((x++<C||_[0]!=null)&&D--);d=_[0]!=null,g[0]||g.splice(0,1)}if(s==no){for(u=1,D=g[0];D>=10;D/=10,u++);S(h,a+(h.e=u+l*G-1)+1,o,d)}else h.e=l,h.r=+d;return h}})();function y(e,t,n,r){var i,a,o,u,d;if(n==null?n=s:q(n,0,8),!e.c)return e.toString();if(i=e.c[0],o=e.e,t==null)d=co(e.c),d=r==1||r==2&&(o<=c||o>=l)?fo(d,o):po(d,o,`0`);else if(e=S(new v(e),t,n),a=e.e,d=co(e.c),u=d.length,r==1||r==2&&(t<=a||a<=c)){for(;u<t;d+=`0`,u++);d=fo(d,a)}else if(t-=o+(r===2&&a>o),d=po(d,a,`0`),a+1>u){if(--t>0)for(d+=`.`;t--;d+=`0`);}else if(t+=a-u,t>0)for(a+1==u&&(d+=`.`);t--;d+=`0`);return e.s<0&&i?`-`+d:d}function b(e,t){for(var n,r,i=1,a=new v(e[0]);i<e.length;i++)r=new v(e[i]),(!r.s||(n=lo(a,r))===t||n===0&&a.s===t)&&(a=r);return a}function x(e,t,n){for(var r=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,r++);return(n=r+n*G-1)>d?e.c=e.e=null:n<u?e.c=[e.e=0]:(e.e=n,e.c=t),e}r=(function(){var e=/^(-?)0([xbo])(?=\w[\w.]*$)/i,t=/^([^.]+)\.$/,n=/^\.([^.]+)$/,r=/^-?(Infinity|NaN)$/,i=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(a,o,s,c){var l,u=s?o:o.replace(i,``);if(r.test(u))a.s=isNaN(u)?null:u<0?-1:1;else{if(!s&&(u=u.replace(e,function(e,t,n){return l=(n=n.toLowerCase())==`x`?16:n==`b`?2:8,!c||c==l?t:e}),c&&(l=c,u=u.replace(t,`$1`).replace(n,`0.$1`)),o!=u))return new v(u,l);if(v.DEBUG)throw Error(eo+`Not a`+(c?` base `+c:``)+` number: `+o);a.s=null}a.c=a.e=null}})();function S(e,t,n,r){var i,a,o,s,c,l,f,p=e.c,m=io;if(p){out:{for(i=1,s=p[0];s>=10;s/=10,i++);if(a=t-i,a<0)a+=G,o=t,c=p[l=0],f=$a(c/m[i-o-1]%10);else if(l=Qa((a+1)/G),l>=p.length)if(r){for(;p.length<=l;p.push(0));c=f=0,i=1,a%=G,o=a-G+1}else break out;else{for(c=s=p[l],i=1;s>=10;s/=10,i++);a%=G,o=a-G+i,f=o<0?0:$a(c/m[i-o-1]%10)}if(r=r||t<0||p[l+1]!=null||(o<0?c:c%m[i-o-1]),r=n<4?(f||r)&&(n==0||n==(e.s<0?3:2)):f>5||f==5&&(n==4||r||n==6&&(a>0?o>0?c/m[i-o]:0:p[l-1])%10&1||n==(e.s<0?8:7)),t<1||!p[0])return p.length=0,r?(t-=e.e+1,p[0]=m[(G-t%G)%G],e.e=-t||0):p[0]=e.e=0,e;if(a==0?(p.length=l,s=1,l--):(p.length=l+1,s=m[G-a],p[l]=o>0?$a(c/m[i-o]%m[o])*s:0),r)for(;;)if(l==0){for(a=1,o=p[0];o>=10;o/=10,a++);for(o=p[0]+=s,s=1;o>=10;o/=10,s++);a!=s&&(e.e++,p[0]==no&&(p[0]=1));break}else{if(p[l]+=s,p[l]!=no)break;p[l--]=0,s=1}for(a=p.length;p[--a]===0;p.pop());}e.e>d?e.c=e.e=null:e.e<u&&(e.c=[e.e=0])}return e}function C(e){var t,n=e.e;return n===null?e.toString():(t=co(e.c),t=n<=c||n>=l?fo(t,n):po(t,n,`0`),e.s<0?`-`+t:t)}return i.absoluteValue=i.abs=function(){var e=new v(this);return e.s<0&&(e.s=1),e},i.comparedTo=function(e,t){return lo(this,new v(e,t))},i.decimalPlaces=i.dp=function(e,t){var n,r,i,a=this;if(e!=null)return q(e,0,K),t==null?t=s:q(t,0,8),S(new v(a),e+a.e+1,t);if(!(n=a.c))return null;if(r=((i=n.length-1)-so(this.e/G))*G,i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},i.dividedBy=i.div=function(e,n){return t(this,new v(e,n),o,s)},i.dividedToIntegerBy=i.idiv=function(e,n){return t(this,new v(e,n),0,1)},i.exponentiatedBy=i.pow=function(e,t){var n,r,i,o,c,l,u,d,f,p=this;if(e=new v(e),e.c&&!e.isInteger())throw Error(eo+`Exponent not an integer: `+C(e));if(t!=null&&(t=new v(t)),l=e.e>14,!p.c||!p.c[0]||p.c[0]==1&&!p.e&&p.c.length==1||!e.c||!e.c[0])return f=new v(C(p)**(l?e.s*(2-uo(e)):+C(e))),t?f.mod(t):f;if(u=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new v(NaN);r=!u&&p.isInteger()&&t.isInteger(),r&&(p=p.mod(t))}else if(e.e>9&&(p.e>0||p.e<-1||(p.e==0?p.c[0]>1||l&&p.c[1]>=24e7:p.c[0]<8e13||l&&p.c[0]<=9999975e7)))return o=p.s<0&&uo(e)?-0:0,p.e>-1&&(o=1/o),new v(u?1/o:o);else m&&(o=Qa(m/G+2));for(l?(n=new v(.5),u&&(e.s=1),d=uo(e)):(i=Math.abs(+C(e)),d=i%2),f=new v(a);;){if(d){if(f=f.times(p),!f.c)break;o?f.c.length>o&&(f.c.length=o):r&&(f=f.mod(t))}if(i){if(i=$a(i/2),i===0)break;d=i%2}else if(e=e.times(n),S(e,e.e+1,1),e.e>14)d=uo(e);else{if(i=+C(e),i===0)break;d=i%2}p=p.times(p),o?p.c&&p.c.length>o&&(p.c.length=o):r&&(p=p.mod(t))}return r?f:(u&&(f=a.div(f)),t?f.mod(t):o?S(f,m,s,c):f)},i.integerValue=function(e){var t=new v(this);return e==null?e=s:q(e,0,8),S(t,t.e+1,e)},i.isEqualTo=i.eq=function(e,t){return lo(this,new v(e,t))===0},i.isFinite=function(){return!!this.c},i.isGreaterThan=i.gt=function(e,t){return lo(this,new v(e,t))>0},i.isGreaterThanOrEqualTo=i.gte=function(e,t){return(t=lo(this,new v(e,t)))===1||t===0},i.isInteger=function(){return!!this.c&&so(this.e/G)>this.c.length-2},i.isLessThan=i.lt=function(e,t){return lo(this,new v(e,t))<0},i.isLessThanOrEqualTo=i.lte=function(e,t){return(t=lo(this,new v(e,t)))===-1||t===0},i.isNaN=function(){return!this.s},i.isNegative=function(){return this.s<0},i.isPositive=function(){return this.s>0},i.isZero=function(){return!!this.c&&this.c[0]==0},i.minus=function(e,t){var n,r,i,a,o=this,c=o.s;if(e=new v(e,t),t=e.s,!c||!t)return new v(NaN);if(c!=t)return e.s=-t,o.plus(e);var l=o.e/G,u=e.e/G,d=o.c,f=e.c;if(!l||!u){if(!d||!f)return d?(e.s=-t,e):new v(f?o:NaN);if(!d[0]||!f[0])return f[0]?(e.s=-t,e):new v(d[0]?o:s==3?-0:0)}if(l=so(l),u=so(u),d=d.slice(),c=l-u){for((a=c<0)?(c=-c,i=d):(u=l,i=f),i.reverse(),t=c;t--;i.push(0));i.reverse()}else for(r=(a=(c=d.length)<(t=f.length))?c:t,c=t=0;t<r;t++)if(d[t]!=f[t]){a=d[t]<f[t];break}if(a&&(i=d,d=f,f=i,e.s=-e.s),t=(r=f.length)-(n=d.length),t>0)for(;t--;d[n++]=0);for(t=no-1;r>c;){if(d[--r]<f[r]){for(n=r;n&&!d[--n];d[n]=t);--d[n],d[r]+=no}d[r]-=f[r]}for(;d[0]==0;d.splice(0,1),--u);return d[0]?x(e,d,u):(e.s=s==3?-1:1,e.c=[e.e=0],e)},i.modulo=i.mod=function(e,n){var r,i,a=this;return e=new v(e,n),!a.c||!e.s||e.c&&!e.c[0]?new v(NaN):!e.c||a.c&&!a.c[0]?new v(a):(p==9?(i=e.s,e.s=1,r=t(a,e,0,3),e.s=i,r.s*=i):r=t(a,e,0,p),e=a.minus(r.times(e)),!e.c[0]&&p==1&&(e.s=a.s),e)},i.multipliedBy=i.times=function(e,t){var n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_=this,y=_.c,b=(e=new v(e,t)).c;if(!y||!b||!y[0]||!b[0])return!_.s||!e.s||y&&!y[0]&&!b||b&&!b[0]&&!y?e.c=e.e=e.s=null:(e.s*=_.s,!y||!b?e.c=e.e=null:(e.c=[0],e.e=0)),e;for(r=so(_.e/G)+so(e.e/G),e.s*=_.s,c=y.length,d=b.length,c<d&&(m=y,y=b,b=m,i=c,c=d,d=i),i=c+d,m=[];i--;m.push(0));for(h=no,g=ao,i=d;--i>=0;){for(n=0,f=b[i]%g,p=b[i]/g|0,o=c,a=i+o;a>i;)l=y[--o]%g,u=y[o]/g|0,s=p*l+u*f,l=f*l+s%g*g+m[a]+n,n=(l/h|0)+(s/g|0)+p*u,m[a--]=l%h;m[a]=n}return n?++r:m.splice(0,1),x(e,m,r)},i.negated=function(){var e=new v(this);return e.s=-e.s||null,e},i.plus=function(e,t){var n,r=this,i=r.s;if(e=new v(e,t),t=e.s,!i||!t)return new v(NaN);if(i!=t)return e.s=-t,r.minus(e);var a=r.e/G,o=e.e/G,s=r.c,c=e.c;if(!a||!o){if(!s||!c)return new v(i/0);if(!s[0]||!c[0])return c[0]?e:new v(s[0]?r:i*0)}if(a=so(a),o=so(o),s=s.slice(),i=a-o){for(i>0?(o=a,n=c):(i=-i,n=s),n.reverse();i--;n.push(0));n.reverse()}for(i=s.length,t=c.length,i-t<0&&(n=c,c=s,s=n,t=i),i=0;t;)i=(s[--t]=s[t]+c[t]+i)/no|0,s[t]=no===s[t]?0:s[t]%no;return i&&(s=[i].concat(s),++o),x(e,s,o)},i.precision=i.sd=function(e,t){var n,r,i,a=this;if(e!=null&&e!==!!e)return q(e,1,K),t==null?t=s:q(t,0,8),S(new v(a),e,t);if(!(n=a.c))return null;if(i=n.length-1,r=i*G+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return e&&a.e+1>r&&(r=a.e+1),r},i.shiftedBy=function(e){return q(e,-ro,ro),this.times(`1e`+e)},i.squareRoot=i.sqrt=function(){var e,n,r,i,a,c=this,l=c.c,u=c.s,d=c.e,f=o+4,p=new v(`0.5`);if(u!==1||!l||!l[0])return new v(!u||u<0&&(!l||l[0])?NaN:l?c:1/0);if(u=Math.sqrt(+C(c)),u==0||u==1/0?(n=co(l),(n.length+d)%2==0&&(n+=`0`),u=Math.sqrt(+n),d=so((d+1)/2)-(d<0||d%2),u==1/0?n=`5e`+d:(n=u.toExponential(),n=n.slice(0,n.indexOf(`e`)+1)+d),r=new v(n)):r=new v(u+``),r.c[0]){for(d=r.e,u=d+f,u<3&&(u=0);;)if(a=r,r=p.times(a.plus(t(c,a,f,1))),co(a.c).slice(0,u)===(n=co(r.c)).slice(0,u))if(r.e<d&&--u,n=n.slice(u-3,u+1),n==`9999`||!i&&n==`4999`){if(!i&&(S(a,a.e+o+2,0),a.times(a).eq(c))){r=a;break}f+=4,u+=4,i=1}else{(!+n||!+n.slice(1)&&n.charAt(0)==`5`)&&(S(r,r.e+o+2,1),e=!r.times(r).eq(c));break}}return S(r,r.e+o+1,s,e)},i.toExponential=function(e,t){return e!=null&&(q(e,0,K),e++),y(this,e,t,1)},i.toFixed=function(e,t){return e!=null&&(q(e,0,K),e=e+this.e+1),y(this,e,t)},i.toFormat=function(e,t,n){var r,i=this;if(n==null)e!=null&&t&&typeof t==`object`?(n=t,t=null):e&&typeof e==`object`?(n=e,e=t=null):n=h;else if(typeof n!=`object`)throw Error(eo+`Argument not an object: `+n);if(r=i.toFixed(e,t),i.c){var a,o=r.split(`.`),s=+n.groupSize,c=+n.secondaryGroupSize,l=n.groupSeparator||``,u=o[0],d=o[1],f=i.s<0,p=f?u.slice(1):u,m=p.length;if(c&&(a=s,s=c,c=a,m-=a),s>0&&m>0){for(a=m%s||s,u=p.substr(0,a);a<m;a+=s)u+=l+p.substr(a,s);c>0&&(u+=l+p.slice(a)),f&&(u=`-`+u)}r=d?u+(n.decimalSeparator||``)+((c=+n.fractionGroupSize)?d.replace(RegExp(`\\d{`+c+`}\\B`,`g`),`$&`+(n.fractionGroupSeparator||``)):d):u}return(n.prefix||``)+r+(n.suffix||``)},i.toFraction=function(e){var n,r,i,o,c,l,u,f,p,m,h,g,_=this,y=_.c;if(e!=null&&(u=new v(e),!u.isInteger()&&(u.c||u.s!==1)||u.lt(a)))throw Error(eo+`Argument `+(u.isInteger()?`out of range: `:`not an integer: `)+C(u));if(!y)return new v(_);for(n=new v(a),p=r=new v(a),i=f=new v(a),g=co(y),c=n.e=g.length-_.e-1,n.c[0]=io[(l=c%G)<0?G+l:l],e=!e||u.comparedTo(n)>0?c>0?n:p:u,l=d,d=1/0,u=new v(g),f.c[0]=0;m=t(u,n,0,1),o=r.plus(m.times(i)),o.comparedTo(e)!=1;)r=i,i=o,p=f.plus(m.times(o=p)),f=o,n=u.minus(m.times(o=n)),u=o;return o=t(e.minus(r),i,0,1),f=f.plus(o.times(p)),r=r.plus(o.times(i)),f.s=p.s=_.s,c*=2,h=t(p,i,c,s).minus(_).abs().comparedTo(t(f,r,c,s).minus(_).abs())<1?[p,i]:[f,r],d=l,h},i.toNumber=function(){return+C(this)},i.toPrecision=function(e,t){return e!=null&&q(e,1,K),y(this,e,t,2)},i.toString=function(e){var t,r=this,i=r.s,a=r.e;return a===null?i?(t=`Infinity`,i<0&&(t=`-`+t)):t=`NaN`:(e==null?t=a<=c||a>=l?fo(co(r.c),a):po(co(r.c),a,`0`):e===10&&_?(r=S(new v(r),o+a+1,s),t=po(co(r.c),r.e,`0`)):(q(e,2,g.length,`Base`),t=n(po(co(r.c),a,`0`),10,e,i,!0)),i<0&&r.c[0]&&(t=`-`+t)),t},i.valueOf=i.toJSON=function(){return C(this)},i._isBigNumber=!0,i[Symbol.toStringTag]=`BigNumber`,i[Symbol.for(`nodejs.util.inspect.custom`)]=i.valueOf,e!=null&&v.set(e),v}function so(e){var t=e|0;return e>0||e===t?t:t-1}function co(e){for(var t,n,r=1,i=e.length,a=e[0]+``;r<i;){for(t=e[r++]+``,n=G-t.length;n--;t=`0`+t);a+=t}for(i=a.length;a.charCodeAt(--i)===48;);return a.slice(0,i+1||1)}function lo(e,t){var n,r,i=e.c,a=t.c,o=e.s,s=t.s,c=e.e,l=t.e;if(!o||!s)return null;if(n=i&&!i[0],r=a&&!a[0],n||r)return n?r?0:-s:o;if(o!=s)return o;if(n=o<0,r=c==l,!i||!a)return r?0:!i^n?1:-1;if(!r)return c>l^n?1:-1;for(s=(c=i.length)<(l=a.length)?c:l,o=0;o<s;o++)if(i[o]!=a[o])return i[o]>a[o]^n?1:-1;return c==l?0:c>l^n?1:-1}function q(e,t,n,r){if(e<t||e>n||e!==$a(e))throw Error(eo+(r||`Argument`)+(typeof e==`number`?e<t||e>n?` out of range: `:` not an integer: `:` not a primitive number: `)+String(e))}function uo(e){var t=e.c.length-1;return so(e.e/G)==t&&e.c[t]%2!=0}function fo(e,t){return(e.length>1?e.charAt(0)+`.`+e.slice(1):e)+(t<0?`e`:`e+`)+t}function po(e,t,n){var r,i;if(t<0){for(i=n+`.`;++t;i+=n);e=i+e}else if(r=e.length,++t>r){for(i=n,t-=r;--t;i+=n);e+=i}else t<r&&(e=e.slice(0,t)+`.`+e.slice(t));return e}var mo=oo(),ho=class{key;left=null;right=null;constructor(e){this.key=e}},go=class extends ho{constructor(e){super(e)}},_o=class{size=0;modificationCount=0;splayCount=0;splay(e){let t=this.root;if(t==null)return this.compare(e,e),-1;let n=null,r=null,i=null,a=null,o=t,s=this.compare,c;for(;;)if(c=s(o.key,e),c>0){let t=o.left;if(t==null||(c=s(t.key,e),c>0&&(o.left=t.right,t.right=o,o=t,t=o.left,t==null)))break;n==null?r=o:n.left=o,n=o,o=t}else if(c<0){let t=o.right;if(t==null||(c=s(t.key,e),c<0&&(o.right=t.left,t.left=o,o=t,t=o.right,t==null)))break;i==null?a=o:i.right=o,i=o,o=t}else break;return i!=null&&(i.right=o.left,o.left=a),n!=null&&(n.left=o.right,o.right=r),this.root!==o&&(this.root=o,this.splayCount++),c}splayMin(e){let t=e,n=t.left;for(;n!=null;){let e=n;t.left=e.right,e.right=t,t=e,n=t.left}return t}splayMax(e){let t=e,n=t.right;for(;n!=null;){let e=n;t.right=e.left,e.left=t,t=e,n=t.right}return t}_delete(e){if(this.root==null||this.splay(e)!=0)return null;let t=this.root,n=t,r=t.left;if(this.size--,r==null)this.root=t.right;else{let e=t.right;t=this.splayMax(r),t.right=e,this.root=t}return this.modificationCount++,n}addNewRoot(e,t){this.size++,this.modificationCount++;let n=this.root;if(n==null){this.root=e;return}t<0?(e.left=n,e.right=n.right,n.right=null):(e.right=n,e.left=n.left,n.left=null),this.root=e}_first(){let e=this.root;return e==null?null:(this.root=this.splayMin(e),this.root)}_last(){let e=this.root;return e==null?null:(this.root=this.splayMax(e),this.root)}clear(){this.root=null,this.size=0,this.modificationCount++}has(e){return this.validKey(e)&&this.splay(e)==0}defaultCompare(){return(e,t)=>e<t?-1:e>t?1:0}wrap(){return{getRoot:()=>this.root,setRoot:e=>{this.root=e},getSize:()=>this.size,getModificationCount:()=>this.modificationCount,getSplayCount:()=>this.splayCount,setSplayCount:e=>{this.splayCount=e},splay:e=>this.splay(e),has:e=>this.has(e)}}},vo=class e extends _o{root=null;compare;validKey;constructor(e,t){super(),this.compare=e??this.defaultCompare(),this.validKey=t??(e=>e!=null&&e!=null)}delete(e){return this.validKey(e)?this._delete(e)!=null:!1}deleteAll(e){for(let t of e)this.delete(t)}forEach(e){let t=this[Symbol.iterator](),n;for(;n=t.next(),!n.done;)e(n.value,n.value,this)}add(e){let t=this.splay(e);return t!=0&&this.addNewRoot(new go(e),t),this}addAndReturn(e){let t=this.splay(e);return t!=0&&this.addNewRoot(new go(e),t),this.root.key}addAll(e){for(let t of e)this.add(t)}isEmpty(){return this.root==null}isNotEmpty(){return this.root!=null}single(){if(this.size==0)throw`Bad state: No element`;if(this.size>1)throw`Bad state: Too many element`;return this.root.key}first(){if(this.size==0)throw`Bad state: No element`;return this._first().key}last(){if(this.size==0)throw`Bad state: No element`;return this._last().key}lastBefore(e){if(e==null)throw`Invalid arguments(s)`;if(this.root==null)return null;if(this.splay(e)<0)return this.root.key;let t=this.root.left;if(t==null)return null;let n=t.right;for(;n!=null;)t=n,n=t.right;return t.key}firstAfter(e){if(e==null)throw`Invalid arguments(s)`;if(this.root==null)return null;if(this.splay(e)>0)return this.root.key;let t=this.root.right;if(t==null)return null;let n=t.left;for(;n!=null;)t=n,n=t.left;return t.key}retainAll(t){let n=new e(this.compare,this.validKey),r=this.modificationCount;for(let e of t){if(r!=this.modificationCount)throw`Concurrent modification during iteration.`;this.validKey(e)&&this.splay(e)==0&&n.add(this.root.key)}n.size!=this.size&&(this.root=n.root,this.size=n.size,this.modificationCount++)}lookup(e){return!this.validKey(e)||this.splay(e)!=0?null:this.root.key}intersection(t){let n=new e(this.compare,this.validKey);for(let e of this)t.has(e)&&n.add(e);return n}difference(t){let n=new e(this.compare,this.validKey);for(let e of this)t.has(e)||n.add(e);return n}union(e){let t=this.clone();return t.addAll(e),t}clone(){let t=new e(this.compare,this.validKey);return t.size=this.size,t.root=this.copyNode(this.root),t}copyNode(e){if(e==null)return null;function t(e,n){let r,i;do{if(r=e.left,i=e.right,r!=null){let e=new go(r.key);n.left=e,t(r,e)}if(i!=null){let t=new go(i.key);n.right=t,e=i,n=t}}while(i!=null)}let n=new go(e.key);return t(e,n),n}toSet(){return this.clone()}entries(){return new xo(this.wrap())}keys(){return this[Symbol.iterator]()}values(){return this[Symbol.iterator]()}[Symbol.iterator](){return new bo(this.wrap())}[Symbol.toStringTag]=`[object Set]`},yo=class{tree;path=[];modificationCount=null;splayCount;constructor(e){this.tree=e,this.splayCount=e.getSplayCount()}[Symbol.iterator](){return this}next(){return this.moveNext()?{done:!1,value:this.current()}:{done:!0,value:null}}current(){if(!this.path.length)return null;let e=this.path[this.path.length-1];return this.getValue(e)}rebuildPath(e){this.path.splice(0,this.path.length),this.tree.splay(e),this.path.push(this.tree.getRoot()),this.splayCount=this.tree.getSplayCount()}findLeftMostDescendent(e){for(;e!=null;)this.path.push(e),e=e.left}moveNext(){if(this.modificationCount!=this.tree.getModificationCount()){if(this.modificationCount==null){this.modificationCount=this.tree.getModificationCount();let e=this.tree.getRoot();for(;e!=null;)this.path.push(e),e=e.left;return this.path.length>0}throw`Concurrent modification during iteration.`}if(!this.path.length)return!1;this.splayCount!=this.tree.getSplayCount()&&this.rebuildPath(this.path[this.path.length-1].key);let e=this.path[this.path.length-1],t=e.right;if(t!=null){for(;t!=null;)this.path.push(t),t=t.left;return!0}for(this.path.pop();this.path.length&&this.path[this.path.length-1].right===e;)e=this.path.pop();return this.path.length>0}},bo=class extends yo{getValue(e){return e.key}},xo=class extends yo{getValue(e){return[e.key,e.key]}},So=e=>()=>e,Co=e=>{let t=e?(t,n)=>n.minus(t).abs().isLessThanOrEqualTo(e):So(!1);return(e,n)=>t(e,n)?0:e.comparedTo(n)};function wo(e){let t=e?(t,n,r,i,a)=>t.exponentiatedBy(2).isLessThanOrEqualTo(i.minus(n).exponentiatedBy(2).plus(a.minus(r).exponentiatedBy(2)).times(e)):So(!1);return(e,n,r)=>{let i=e.x,a=e.y,o=r.x,s=r.y,c=a.minus(s).times(n.x.minus(o)).minus(i.minus(o).times(n.y.minus(s)));return t(c,i,a,o,s)?0:c.comparedTo(0)}}var To=e=>e,Eo=e=>{if(e){let t=new vo(Co(e)),n=new vo(Co(e)),r=(e,t)=>t.addAndReturn(e),i=e=>({x:r(e.x,t),y:r(e.y,n)});return i({x:new mo(0),y:new mo(0)}),i}return To},Do=e=>({set:e=>{Oo=Do(e)},reset:()=>Do(e),compare:Co(e),snap:Eo(e),orient:wo(e)}),Oo=Do(),ko=(e,t)=>e.ll.x.isLessThanOrEqualTo(t.x)&&t.x.isLessThanOrEqualTo(e.ur.x)&&e.ll.y.isLessThanOrEqualTo(t.y)&&t.y.isLessThanOrEqualTo(e.ur.y),Ao=(e,t)=>{if(t.ur.x.isLessThan(e.ll.x)||e.ur.x.isLessThan(t.ll.x)||t.ur.y.isLessThan(e.ll.y)||e.ur.y.isLessThan(t.ll.y))return null;let n=e.ll.x.isLessThan(t.ll.x)?t.ll.x:e.ll.x,r=e.ur.x.isLessThan(t.ur.x)?e.ur.x:t.ur.x,i=e.ll.y.isLessThan(t.ll.y)?t.ll.y:e.ll.y,a=e.ur.y.isLessThan(t.ur.y)?e.ur.y:t.ur.y;return{ll:{x:n,y:i},ur:{x:r,y:a}}},jo=(e,t)=>e.x.times(t.y).minus(e.y.times(t.x)),Mo=(e,t)=>e.x.times(t.x).plus(e.y.times(t.y)),No=e=>Mo(e,e).sqrt(),Po=(e,t,n)=>{let r={x:t.x.minus(e.x),y:t.y.minus(e.y)},i={x:n.x.minus(e.x),y:n.y.minus(e.y)};return jo(i,r).div(No(i)).div(No(r))},Fo=(e,t,n)=>{let r={x:t.x.minus(e.x),y:t.y.minus(e.y)},i={x:n.x.minus(e.x),y:n.y.minus(e.y)};return Mo(i,r).div(No(i)).div(No(r))},Io=(e,t,n)=>t.y.isZero()?null:{x:e.x.plus(t.x.div(t.y).times(n.minus(e.y))),y:n},Lo=(e,t,n)=>t.x.isZero()?null:{x:n,y:e.y.plus(t.y.div(t.x).times(n.minus(e.x)))},Ro=(e,t,n,r)=>{if(t.x.isZero())return Lo(n,r,e.x);if(r.x.isZero())return Lo(e,t,n.x);if(t.y.isZero())return Io(n,r,e.y);if(r.y.isZero())return Io(e,t,n.y);let i=jo(t,r);if(i.isZero())return null;let a={x:n.x.minus(e.x),y:n.y.minus(e.y)},o=jo(a,t).div(i),s=jo(a,r).div(i),c=e.x.plus(s.times(t.x)),l=n.x.plus(o.times(r.x)),u=e.y.plus(s.times(t.y)),d=n.y.plus(o.times(r.y));return{x:c.plus(l).div(2),y:u.plus(d).div(2)}},zo=class e{point;isLeft;segment;otherSE;consumedBy;static compare(t,n){let r=e.comparePoints(t.point,n.point);return r===0?(t.point!==n.point&&t.link(n),t.isLeft===n.isLeft?qo.compare(t.segment,n.segment):t.isLeft?1:-1):r}static comparePoints(e,t){return e.x.isLessThan(t.x)?-1:e.x.isGreaterThan(t.x)?1:e.y.isLessThan(t.y)?-1:e.y.isGreaterThan(t.y)?1:0}constructor(e,t){e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=t}link(e){if(e.point===this.point)throw Error(`Tried to link already linked events`);let t=e.point.events;for(let e=0,n=t.length;e<n;e++){let n=t[e];this.point.events.push(n),n.point=this.point}this.checkForConsuming()}checkForConsuming(){let e=this.point.events.length;for(let t=0;t<e;t++){let n=this.point.events[t];if(n.segment.consumedBy===void 0)for(let r=t+1;r<e;r++){let e=this.point.events[r];e.consumedBy===void 0&&n.otherSE.point.events===e.otherSE.point.events&&n.segment.consume(e.segment)}}}getAvailableLinkedEvents(){let e=[];for(let t=0,n=this.point.events.length;t<n;t++){let n=this.point.events[t];n!==this&&!n.segment.ringOut&&n.segment.isInResult()&&e.push(n)}return e}getLeftmostComparator(e){let t=new Map,n=n=>{let r=n.otherSE;t.set(n,{sine:Po(this.point,e.point,r.point),cosine:Fo(this.point,e.point,r.point)})};return(e,r)=>{t.has(e)||n(e),t.has(r)||n(r);let{sine:i,cosine:a}=t.get(e),{sine:o,cosine:s}=t.get(r);return i.isGreaterThanOrEqualTo(0)&&o.isGreaterThanOrEqualTo(0)?a.isLessThan(s)?1:a.isGreaterThan(s)?-1:0:i.isLessThan(0)&&o.isLessThan(0)?a.isLessThan(s)?-1:a.isGreaterThan(s)?1:0:o.isLessThan(i)?-1:o.isGreaterThan(i)?1:0}}},Bo=class e{events;poly;_isExteriorRing;_enclosingRing;static factory(t){let n=[];for(let r=0,i=t.length;r<i;r++){let i=t[r];if(!i.isInResult()||i.ringOut)continue;let a=null,o=i.leftSE,s=i.rightSE,c=[o],l=o.point,u=[];for(;a=o,o=s,c.push(o),o.point!==l;)for(;;){let t=o.getAvailableLinkedEvents();if(t.length===0){let e=c[0].point,t=c[c.length-1].point;throw Error(`Unable to complete output ring starting at [${e.x}, ${e.y}]. Last matching segment found ends at [${t.x}, ${t.y}].`)}if(t.length===1){s=t[0].otherSE;break}let r=null;for(let e=0,t=u.length;e<t;e++)if(u[e].point===o.point){r=e;break}if(r!==null){let t=u.splice(r)[0],i=c.splice(t.index);i.unshift(i[0].otherSE),n.push(new e(i.reverse()));continue}u.push({index:c.length,point:o.point});let i=o.getLeftmostComparator(a);s=t.sort(i)[0].otherSE;break}n.push(new e(c))}return n}constructor(e){this.events=e;for(let t=0,n=e.length;t<n;t++)e[t].segment.ringOut=this;this.poly=null}getGeom(){let e=this.events[0].point,t=[e];for(let n=1,r=this.events.length-1;n<r;n++){let r=this.events[n].point,i=this.events[n+1].point;Oo.orient(r,e,i)!==0&&(t.push(r),e=r)}if(t.length===1)return null;let n=t[0],r=t[1];Oo.orient(n,e,r)===0&&t.shift(),t.push(t[0]);let i=this.isExteriorRing()?1:-1,a=this.isExteriorRing()?0:t.length-1,o=this.isExteriorRing()?t.length:-1,s=[];for(let e=a;e!=o;e+=i)s.push([t[e].x.toNumber(),t[e].y.toNumber()]);return s}isExteriorRing(){if(this._isExteriorRing===void 0){let e=this.enclosingRing();this._isExteriorRing=e?!e.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let e=this.events[0];for(let t=1,n=this.events.length;t<n;t++){let n=this.events[t];zo.compare(e,n)>0&&(e=n)}let t=e.segment.prevInResult(),n=t?t.prevInResult():null;for(;;){if(!t)return null;if(!n)return t.ringOut;if(n.ringOut!==t.ringOut)return n.ringOut?.enclosingRing()===t.ringOut?t.ringOut?.enclosingRing():t.ringOut;t=n.prevInResult(),n=t?t.prevInResult():null}}},Vo=class{exteriorRing;interiorRings;constructor(e){this.exteriorRing=e,e.poly=this,this.interiorRings=[]}addInterior(e){this.interiorRings.push(e),e.poly=this}getGeom(){let e=this.exteriorRing.getGeom();if(e===null)return null;let t=[e];for(let e=0,n=this.interiorRings.length;e<n;e++){let n=this.interiorRings[e].getGeom();n!==null&&t.push(n)}return t}},Ho=class{rings;polys;constructor(e){this.rings=e,this.polys=this._composePolys(e)}getGeom(){let e=[];for(let t=0,n=this.polys.length;t<n;t++){let n=this.polys[t].getGeom();n!==null&&e.push(n)}return e}_composePolys(e){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];if(!r.poly)if(r.isExteriorRing())t.push(new Vo(r));else{let e=r.enclosingRing();e?.poly||t.push(new Vo(e)),e?.poly?.addInterior(r)}}return t}},Uo=class{queue;tree;segments;constructor(e,t=qo.compare){this.queue=e,this.tree=new vo(t),this.segments=[]}process(e){let t=e.segment,n=[];if(e.consumedBy)return e.isLeft?this.queue.delete(e.otherSE):this.tree.delete(t),n;e.isLeft&&this.tree.add(t);let r=t,i=t;do r=this.tree.lastBefore(r);while(r!=null&&r.consumedBy!=null);do i=this.tree.firstAfter(i);while(i!=null&&i.consumedBy!=null);if(e.isLeft){let a=null;if(r){let e=r.getIntersection(t);if(e!==null&&(t.isAnEndpoint(e)||(a=e),!r.isAnEndpoint(e))){let t=this._splitSafely(r,e);for(let e=0,r=t.length;e<r;e++)n.push(t[e])}}let o=null;if(i){let e=i.getIntersection(t);if(e!==null&&(t.isAnEndpoint(e)||(o=e),!i.isAnEndpoint(e))){let t=this._splitSafely(i,e);for(let e=0,r=t.length;e<r;e++)n.push(t[e])}}if(a!==null||o!==null){let e=null;e=a===null?o:o===null||zo.comparePoints(a,o)<=0?a:o,this.queue.delete(t.rightSE),n.push(t.rightSE);let r=t.split(e);for(let e=0,t=r.length;e<t;e++)n.push(r[e])}n.length>0?(this.tree.delete(t),n.push(e)):(this.segments.push(t),t.prev=r)}else{if(r&&i){let e=r.getIntersection(i);if(e!==null){if(!r.isAnEndpoint(e)){let t=this._splitSafely(r,e);for(let e=0,r=t.length;e<r;e++)n.push(t[e])}if(!i.isAnEndpoint(e)){let t=this._splitSafely(i,e);for(let e=0,r=t.length;e<r;e++)n.push(t[e])}}}this.tree.delete(t)}return n}_splitSafely(e,t){this.tree.delete(e);let n=e.rightSE;this.queue.delete(n);let r=e.split(t);return r.push(n),e.consumedBy===void 0&&this.tree.add(e),r}},Wo=new class{type;numMultiPolys;run(e,t,n){Wo.type=e;let r=[new Xo(t,!0)];for(let e=0,t=n.length;e<t;e++)r.push(new Xo(n[e],!1));if(Wo.numMultiPolys=r.length,Wo.type===`difference`){let e=r[0],t=1;for(;t<r.length;)Ao(r[t].bbox,e.bbox)===null?r.splice(t,1):t++}if(Wo.type===`intersection`)for(let e=0,t=r.length;e<t;e++){let t=r[e];for(let n=e+1,i=r.length;n<i;n++)if(Ao(t.bbox,r[n].bbox)===null)return[]}let i=new vo(zo.compare);for(let e=0,t=r.length;e<t;e++){let t=r[e].getSweepEvents();for(let e=0,n=t.length;e<n;e++)i.add(t[e])}let a=new Uo(i),o=null;for(i.size!=0&&(o=i.first(),i.delete(o));o;){let e=a.process(o);for(let t=0,n=e.length;t<n;t++){let n=e[t];n.consumedBy===void 0&&i.add(n)}i.size==0?o=null:(o=i.first(),i.delete(o))}return Oo.reset(),new Ho(Bo.factory(a.segments)).getGeom()}},Go=Wo,Ko=0,qo=class e{id;leftSE;rightSE;rings;windings;ringOut;consumedBy;prev;_prevInResult;_beforeState;_afterState;_isInResult;static compare(e,t){let n=e.leftSE.point.x,r=t.leftSE.point.x,i=e.rightSE.point.x,a=t.rightSE.point.x;if(a.isLessThan(n))return 1;if(i.isLessThan(r))return-1;let o=e.leftSE.point.y,s=t.leftSE.point.y,c=e.rightSE.point.y,l=t.rightSE.point.y;if(n.isLessThan(r)){if(s.isLessThan(o)&&s.isLessThan(c))return 1;if(s.isGreaterThan(o)&&s.isGreaterThan(c))return-1;let n=e.comparePoint(t.leftSE.point);if(n<0)return 1;if(n>0)return-1;let r=t.comparePoint(e.rightSE.point);return r===0?-1:r}if(n.isGreaterThan(r)){if(o.isLessThan(s)&&o.isLessThan(l))return-1;if(o.isGreaterThan(s)&&o.isGreaterThan(l))return 1;let n=t.comparePoint(e.leftSE.point);if(n!==0)return n;let r=e.comparePoint(t.rightSE.point);return r<0?1:r>0?-1:1}if(o.isLessThan(s))return-1;if(o.isGreaterThan(s))return 1;if(i.isLessThan(a)){let n=t.comparePoint(e.rightSE.point);if(n!==0)return n}if(i.isGreaterThan(a)){let n=e.comparePoint(t.rightSE.point);if(n<0)return 1;if(n>0)return-1}if(!i.eq(a)){let e=c.minus(o),t=i.minus(n),u=l.minus(s),d=a.minus(r);if(e.isGreaterThan(t)&&u.isLessThan(d))return 1;if(e.isLessThan(t)&&u.isGreaterThan(d))return-1}return i.isGreaterThan(a)?1:i.isLessThan(a)||c.isLessThan(l)?-1:c.isGreaterThan(l)?1:e.id<t.id?-1:e.id>t.id?1:0}constructor(e,t,n,r){this.id=++Ko,this.leftSE=e,e.segment=this,e.otherSE=t,this.rightSE=t,t.segment=this,t.otherSE=e,this.rings=n,this.windings=r}static fromRing(t,n,r){let i,a,o,s=zo.comparePoints(t,n);if(s<0)i=t,a=n,o=1;else if(s>0)i=n,a=t,o=-1;else throw Error(`Tried to create degenerate segment at [${t.x}, ${t.y}]`);return new e(new zo(i,!0),new zo(a,!1),[r],[o])}replaceRightSE(e){this.rightSE=e,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){let e=this.leftSE.point.y,t=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:e.isLessThan(t)?e:t},ur:{x:this.rightSE.point.x,y:e.isGreaterThan(t)?e:t}}}vector(){return{x:this.rightSE.point.x.minus(this.leftSE.point.x),y:this.rightSE.point.y.minus(this.leftSE.point.y)}}isAnEndpoint(e){return e.x.eq(this.leftSE.point.x)&&e.y.eq(this.leftSE.point.y)||e.x.eq(this.rightSE.point.x)&&e.y.eq(this.rightSE.point.y)}comparePoint(e){return Oo.orient(this.leftSE.point,e,this.rightSE.point)}getIntersection(e){let t=this.bbox(),n=e.bbox(),r=Ao(t,n);if(r===null)return null;let i=this.leftSE.point,a=this.rightSE.point,o=e.leftSE.point,s=e.rightSE.point,c=ko(t,o)&&this.comparePoint(o)===0,l=ko(n,i)&&e.comparePoint(i)===0,u=ko(t,s)&&this.comparePoint(s)===0,d=ko(n,a)&&e.comparePoint(a)===0;if(l&&c)return d&&!u?a:!d&&u?s:null;if(l)return u&&i.x.eq(s.x)&&i.y.eq(s.y)?null:i;if(c)return d&&a.x.eq(o.x)&&a.y.eq(o.y)?null:o;if(d&&u)return null;if(d)return a;if(u)return s;let f=Ro(i,this.vector(),o,e.vector());return f===null||!ko(r,f)?null:Oo.snap(f)}split(t){let n=[],r=t.events!==void 0,i=new zo(t,!0),a=new zo(t,!1),o=this.rightSE;this.replaceRightSE(a),n.push(a),n.push(i);let s=new e(i,o,this.rings.slice(),this.windings.slice());return zo.comparePoints(s.leftSE.point,s.rightSE.point)>0&&s.swapEvents(),zo.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),r&&(i.checkForConsuming(),a.checkForConsuming()),n}swapEvents(){let e=this.rightSE;this.rightSE=this.leftSE,this.leftSE=e,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let e=0,t=this.windings.length;e<t;e++)this.windings[e]*=-1}consume(t){let n=this,r=t;for(;n.consumedBy;)n=n.consumedBy;for(;r.consumedBy;)r=r.consumedBy;let i=e.compare(n,r);if(i!==0){if(i>0){let e=n;n=r,r=e}if(n.prev===r){let e=n;n=r,r=e}for(let e=0,t=r.rings.length;e<t;e++){let t=r.rings[e],i=r.windings[e],a=n.rings.indexOf(t);a===-1?(n.rings.push(t),n.windings.push(i)):n.windings[a]+=i}r.rings=null,r.windings=null,r.consumedBy=n,r.leftSE.consumedBy=n.leftSE,r.rightSE.consumedBy=n.rightSE}}prevInResult(){return this._prevInResult===void 0&&(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null),this._prevInResult}beforeState(){return this._beforeState===void 0&&(this.prev?this._beforeState=(this.prev.consumedBy||this.prev).afterState():this._beforeState={rings:[],windings:[],multiPolys:[]}),this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;let e=this.beforeState();this._afterState={rings:e.rings.slice(0),windings:e.windings.slice(0),multiPolys:[]};let t=this._afterState.rings,n=this._afterState.windings,r=this._afterState.multiPolys;for(let e=0,r=this.rings.length;e<r;e++){let r=this.rings[e],i=this.windings[e],a=t.indexOf(r);a===-1?(t.push(r),n.push(i)):n[a]+=i}let i=[],a=[];for(let e=0,r=t.length;e<r;e++){if(n[e]===0)continue;let r=t[e],o=r.poly;if(a.indexOf(o)===-1)if(r.isExterior)i.push(o);else{a.indexOf(o)===-1&&a.push(o);let e=i.indexOf(r.poly);e!==-1&&i.splice(e,1)}}for(let e=0,t=i.length;e<t;e++){let t=i[e].multiPoly;r.indexOf(t)===-1&&r.push(t)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;let e=this.beforeState().multiPolys,t=this.afterState().multiPolys;switch(Go.type){case`union`:this._isInResult=e.length===0!=(t.length===0);break;case`intersection`:{let n,r;e.length<t.length?(n=e.length,r=t.length):(n=t.length,r=e.length),this._isInResult=r===Go.numMultiPolys&&n<r;break}case`xor`:this._isInResult=Math.abs(e.length-t.length)%2==1;break;case`difference`:{let n=e=>e.length===1&&e[0].isSubject;this._isInResult=n(e)!==n(t);break}}return this._isInResult}},Jo=class{poly;isExterior;segments;bbox;constructor(e,t,n){if(!Array.isArray(e)||e.length===0||(this.poly=t,this.isExterior=n,this.segments=[],typeof e[0][0]!=`number`||typeof e[0][1]!=`number`))throw Error(`Input geometry is not a valid Polygon or MultiPolygon`);let r=Oo.snap({x:new mo(e[0][0]),y:new mo(e[0][1])});this.bbox={ll:{x:r.x,y:r.y},ur:{x:r.x,y:r.y}};let i=r;for(let t=1,n=e.length;t<n;t++){if(typeof e[t][0]!=`number`||typeof e[t][1]!=`number`)throw Error(`Input geometry is not a valid Polygon or MultiPolygon`);let n=Oo.snap({x:new mo(e[t][0]),y:new mo(e[t][1])});n.x.eq(i.x)&&n.y.eq(i.y)||(this.segments.push(qo.fromRing(i,n,this)),n.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=n.x),n.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=n.y),n.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=n.x),n.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=n.y),i=n)}(!r.x.eq(i.x)||!r.y.eq(i.y))&&this.segments.push(qo.fromRing(i,r,this))}getSweepEvents(){let e=[];for(let t=0,n=this.segments.length;t<n;t++){let n=this.segments[t];e.push(n.leftSE),e.push(n.rightSE)}return e}},Yo=class{multiPoly;exteriorRing;interiorRings;bbox;constructor(e,t){if(!Array.isArray(e))throw Error(`Input geometry is not a valid Polygon or MultiPolygon`);this.exteriorRing=new Jo(e[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(let t=1,n=e.length;t<n;t++){let n=new Jo(e[t],this,!1);n.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=n.bbox.ll.x),n.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=n.bbox.ll.y),n.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=n.bbox.ur.x),n.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=n.bbox.ur.y),this.interiorRings.push(n)}this.multiPoly=t}getSweepEvents(){let e=this.exteriorRing.getSweepEvents();for(let t=0,n=this.interiorRings.length;t<n;t++){let n=this.interiorRings[t].getSweepEvents();for(let t=0,r=n.length;t<r;t++)e.push(n[t])}return e}},Xo=class{isSubject;polys;bbox;constructor(e,t){if(!Array.isArray(e))throw Error(`Input geometry is not a valid Polygon or MultiPolygon`);try{typeof e[0][0][0]==`number`&&(e=[e])}catch{}this.polys=[],this.bbox={ll:{x:new mo(1/0),y:new mo(1/0)},ur:{x:new mo(-1/0),y:new mo(-1/0)}};for(let t=0,n=e.length;t<n;t++){let n=new Yo(e[t],this);n.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=n.bbox.ll.x),n.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=n.bbox.ll.y),n.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=n.bbox.ur.x),n.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=n.bbox.ur.y),this.polys.push(n)}this.isSubject=t}getSweepEvents(){let e=[];for(let t=0,n=this.polys.length;t<n;t++){let n=this.polys[t].getSweepEvents();for(let t=0,r=n.length;t<r;t++)e.push(n[t])}return e}},Zo=(e,...t)=>Go.run(`intersection`,e,t);Oo.set;function Qo(e,t={}){let n=[];if(ii(e,e=>{n.push(e.coordinates)}),n.length<2)throw Error(`Must specify at least 2 geometries`);let r=Zo(n[0],...n.slice(1));return r.length===0?null:r.length===1?Qr(r[0],t.properties):ni(r,t.properties)}var J=1e-6,Y=Math.PI,$o=Y/2,es=Y/4,ts=Y*2,ns=180/Y,X=Y/180,Z=Math.abs,rs=Math.atan,is=Math.atan2,Q=Math.cos,as=Math.ceil,os=Math.exp,ss=Math.log,$=Math.sin,cs=Math.sign||function(e){return e>0?1:e<0?-1:0},ls=Math.sqrt,us=Math.tan;function ds(e){return e>1?0:e<-1?Y:Math.acos(e)}function fs(e){return e>1?$o:e<-1?-$o:Math.asin(e)}function ps(){}function ms(e,t){e&&gs.hasOwnProperty(e.type)&&gs[e.type](e,t)}var hs={Feature:function(e,t){ms(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r<i;)ms(n[r].geometry,t)}},gs={Sphere:function(e,t){t.sphere()},Point:function(e,t){e=e.coordinates,t.point(e[0],e[1],e[2])},MultiPoint:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)e=n[r],t.point(e[0],e[1],e[2])},LineString:function(e,t){_s(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)_s(n[r],t,0)},Polygon:function(e,t){vs(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)vs(n[r],t)},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,i=n.length;++r<i;)ms(n[r],t)}};function _s(e,t,n){var r=-1,i=e.length-n,a;for(t.lineStart();++r<i;)a=e[r],t.point(a[0],a[1],a[2]);t.lineEnd()}function vs(e,t){var n=-1,r=e.length;for(t.polygonStart();++n<r;)_s(e[n],t,1);t.polygonEnd()}function ys(e,t){e&&hs.hasOwnProperty(e.type)?hs[e.type](e,t):ms(e,t)}function bs(e){return[is(e[1],e[0]),fs(e[2])]}function xs(e){var t=e[0],n=e[1],r=Q(n);return[r*Q(t),r*$(t),$(n)]}function Ss(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Cs(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function ws(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function Ts(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Es(e){var t=ls(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}function Ds(e,t){function n(n,r){return n=e(n,r),t(n[0],n[1])}return e.invert&&t.invert&&(n.invert=function(n,r){return n=t.invert(n,r),n&&e.invert(n[0],n[1])}),n}function Os(e,t){return Z(e)>Y&&(e-=Math.round(e/ts)*ts),[e,t]}Os.invert=Os;function ks(e,t,n){return(e%=ts)?t||n?Ds(js(e),Ms(t,n)):js(e):t||n?Ms(t,n):Os}function As(e){return function(t,n){return t+=e,Z(t)>Y&&(t-=Math.round(t/ts)*ts),[t,n]}}function js(e){var t=As(e);return t.invert=As(-e),t}function Ms(e,t){var n=Q(e),r=$(e),i=Q(t),a=$(t);function o(e,t){var o=Q(t),s=Q(e)*o,c=$(e)*o,l=$(t),u=l*n+s*r;return[is(c*i-u*a,s*n-l*r),fs(u*i+c*a)]}return o.invert=function(e,t){var o=Q(t),s=Q(e)*o,c=$(e)*o,l=$(t),u=l*i-c*a;return[is(c*i+l*a,s*n+u*r),fs(u*n-s*r)]},o}function Ns(e){e=ks(e[0]*X,e[1]*X,e.length>2?e[2]*X:0);function t(t){return t=e(t[0]*X,t[1]*X),t[0]*=ns,t[1]*=ns,t}return t.invert=function(t){return t=e.invert(t[0]*X,t[1]*X),t[0]*=ns,t[1]*=ns,t},t}function Ps(e,t,n,r,i,a){if(n){var o=Q(t),s=$(t),c=r*n;i==null?(i=t+r*ts,a=t-c/2):(i=Fs(o,i),a=Fs(o,a),(r>0?i<a:i>a)&&(i+=r*ts));for(var l,u=i;r>0?u>a:u<a;u-=c)l=bs([o,-s*Q(u),-s*$(u)]),e.point(l[0],l[1])}}function Fs(e,t){t=xs(t),t[0]-=e,Es(t);var n=ds(-t[1]);return((-t[2]<0?-n:n)+ts-J)%ts}function Is(){var e=[],t;return{point:function(e,n,r){t.push([e,n,r])},lineStart:function(){e.push(t=[])},lineEnd:ps,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function Ls(e,t){return Z(e[0]-t[0])<1e-6&&Z(e[1]-t[1])<1e-6}function Rs(e,t,n,r){this.x=e,this.z=t,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function zs(e,t,n,r,i){var a=[],o=[],s,c;if(e.forEach(function(e){if(!((t=e.length-1)<=0)){var t,n=e[0],r=e[t],c;if(Ls(n,r)){if(!n[2]&&!r[2]){for(i.lineStart(),s=0;s<t;++s)i.point((n=e[s])[0],n[1]);i.lineEnd();return}r[0]+=2*J}a.push(c=new Rs(n,e,null,!0)),o.push(c.o=new Rs(n,null,c,!1)),a.push(c=new Rs(r,e,null,!1)),o.push(c.o=new Rs(r,null,c,!0))}}),a.length){for(o.sort(t),Bs(a),Bs(o),s=0,c=o.length;s<c;++s)o[s].e=n=!n;for(var l=a[0],u,d;;){for(var f=l,p=!0;f.v;)if((f=f.n)===l)return;u=f.z,i.lineStart();do{if(f.v=f.o.v=!0,f.e){if(p)for(s=0,c=u.length;s<c;++s)i.point((d=u[s])[0],d[1]);else r(f.x,f.n.x,1,i);f=f.n}else{if(p)for(u=f.p.z,s=u.length-1;s>=0;--s)i.point((d=u[s])[0],d[1]);else r(f.x,f.p.x,-1,i);f=f.p}f=f.o,u=f.z,p=!p}while(!f.v);i.lineEnd()}}}function Bs(e){if(t=e.length){for(var t,n=0,r=e[0],i;++n<t;)r.n=i=e[n],i.p=r,r=i;r.n=i=e[0],i.p=r}}function Vs(e){return Z(e[0])<=Y?e[0]:cs(e[0])*((Z(e[0])+Y)%ts-Y)}function Hs(e,t){var n=Vs(t),r=t[1],i=$(r),a=[$(n),-Q(n),0],o=0,s=0,c=new mt;i===1?r=$o+J:i===-1&&(r=-$o-J);for(var l=0,u=e.length;l<u;++l)if(f=(d=e[l]).length)for(var d,f,p=d[f-1],m=Vs(p),h=p[1]/2+es,g=$(h),_=Q(h),v=0;v<f;++v,m=b,g=S,_=C,p=y){var y=d[v],b=Vs(y),x=y[1]/2+es,S=$(x),C=Q(x),w=b-m,T=w>=0?1:-1,E=T*w,D=E>Y,O=g*S;if(c.add(is(O*T*$(E),_*C+O*Q(E))),o+=D?w+T*ts:w,D^m>=n^b>=n){var k=Cs(xs(p),xs(y));Es(k);var A=Cs(a,k);Es(A);var j=(D^w>=0?-1:1)*fs(A[2]);(r>j||r===j&&(k[0]||k[1]))&&(s+=D^w>=0?1:-1)}}return(o<-1e-6||o<1e-6&&c<-1e-12)^s&1}function Us(e,t,n,r){return function(i){var a=t(i),o=Is(),s=t(o),c=!1,l,u,d,f={point:p,lineStart:h,lineEnd:g,polygonStart:function(){f.point=_,f.lineStart=v,f.lineEnd=y,u=[],l=[]},polygonEnd:function(){f.point=p,f.lineStart=h,f.lineEnd=g,u=kt(u);var e=Hs(l,r);u.length?(c||=(i.polygonStart(),!0),zs(u,Gs,e,n,i)):e&&(c||=(i.polygonStart(),!0),i.lineStart(),n(null,null,1,i),i.lineEnd()),c&&=(i.polygonEnd(),!1),u=l=null},sphere:function(){i.polygonStart(),i.lineStart(),n(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function p(t,n){e(t,n)&&i.point(t,n)}function m(e,t){a.point(e,t)}function h(){f.point=m,a.lineStart()}function g(){f.point=p,a.lineEnd()}function _(e,t){d.push([e,t]),s.point(e,t)}function v(){s.lineStart(),d=[]}function y(){_(d[0][0],d[0][1]),s.lineEnd();var e=s.clean(),t=o.result(),n,r=t.length,a,f,p;if(d.pop(),l.push(d),d=null,r){if(e&1){if(f=t[0],(a=f.length-1)>0){for(c||=(i.polygonStart(),!0),i.lineStart(),n=0;n<a;++n)i.point((p=f[n])[0],p[1]);i.lineEnd()}return}r>1&&e&2&&t.push(t.pop().concat(t.shift())),u.push(t.filter(Ws))}}return f}}function Ws(e){return e.length>1}function Gs(e,t){return((e=e.x)[0]<0?e[1]-$o-J:$o-e[1])-((t=t.x)[0]<0?t[1]-$o-J:$o-t[1])}var Ks=Us(function(){return!0},qs,Ys,[-Y,-$o]);function qs(e){var t=NaN,n=NaN,r=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(a,o){var s=a>0?Y:-Y,c=Z(a-t);Z(c-Y)<1e-6?(e.point(t,n=(n+o)/2>0?$o:-$o),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(s,n),e.point(a,n),i=0):r!==s&&c>=Y&&(Z(t-r)<1e-6&&(t-=r*J),Z(a-s)<1e-6&&(a-=s*J),n=Js(t,n,a,o),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(s,n),i=0),e.point(t=a,n=o),r=s},lineEnd:function(){e.lineEnd(),t=n=NaN},clean:function(){return 2-i}}}function Js(e,t,n,r){var i,a,o=$(e-n);return Z(o)>1e-6?rs(($(t)*(a=Q(r))*$(n)-$(r)*(i=Q(t))*$(e))/(i*a*o)):(t+r)/2}function Ys(e,t,n,r){var i;if(e==null)i=n*$o,r.point(-Y,i),r.point(0,i),r.point(Y,i),r.point(Y,0),r.point(Y,-i),r.point(0,-i),r.point(-Y,-i),r.point(-Y,0),r.point(-Y,i);else if(Z(e[0]-t[0])>1e-6){var a=e[0]<t[0]?Y:-Y;i=n*a/2,r.point(-a,i),r.point(0,i),r.point(a,i)}else r.point(t[0],t[1])}function Xs(e){var t=Q(e),n=2*X,r=t>0,i=Z(t)>J;function a(t,r,i,a){Ps(a,e,n,i,t,r)}function o(e,n){return Q(e)*Q(n)>t}function s(e){var t,n,a,s,u;return{lineStart:function(){s=a=!1,u=1},point:function(d,f){var p=[d,f],m,h=o(d,f),g=r?h?0:l(d,f):h?l(d+(d<0?Y:-Y),f):0;if(!t&&(s=a=h)&&e.lineStart(),h!==a&&(m=c(t,p),(!m||Ls(t,m)||Ls(p,m))&&(p[2]=1)),h!==a)u=0,h?(e.lineStart(),m=c(p,t),e.point(m[0],m[1])):(m=c(t,p),e.point(m[0],m[1],2),e.lineEnd()),t=m;else if(i&&t&&r^h){var _;!(g&n)&&(_=c(p,t,!0))&&(u=0,r?(e.lineStart(),e.point(_[0][0],_[0][1]),e.point(_[1][0],_[1][1]),e.lineEnd()):(e.point(_[1][0],_[1][1]),e.lineEnd(),e.lineStart(),e.point(_[0][0],_[0][1],3)))}h&&(!t||!Ls(t,p))&&e.point(p[0],p[1]),t=p,a=h,n=g},lineEnd:function(){a&&e.lineEnd(),t=null},clean:function(){return u|(s&&a)<<1}}}function c(e,n,r){var i=xs(e),a=xs(n),o=[1,0,0],s=Cs(i,a),c=Ss(s,s),l=s[0],u=c-l*l;if(!u)return!r&&e;var d=t*c/u,f=-t*l/u,p=Cs(o,s),m=Ts(o,d);ws(m,Ts(s,f));var h=p,g=Ss(m,h),_=Ss(h,h),v=g*g-_*(Ss(m,m)-1);if(!(v<0)){var y=ls(v),b=Ts(h,(-g-y)/_);if(ws(b,m),b=bs(b),!r)return b;var x=e[0],S=n[0],C=e[1],w=n[1],T;S<x&&(T=x,x=S,S=T);var E=S-x,D=Z(E-Y)<J,O=D||E<1e-6;if(!D&&w<C&&(T=C,C=w,w=T),O?D?C+w>0^b[1]<(Z(b[0]-x)<1e-6?C:w):C<=b[1]&&b[1]<=w:E>Y^(x<=b[0]&&b[0]<=S)){var k=Ts(h,(-g+y)/_);return ws(k,m),[b,bs(k)]}}}function l(t,n){var i=r?e:Y-e,a=0;return t<-i?a|=1:t>i&&(a|=2),n<-i?a|=4:n>i&&(a|=8),a}return Us(o,s,a,r?[0,-e]:[-Y,e-Y])}function Zs(e,t,n,r,i,a){var o=e[0],s=e[1],c=t[0],l=t[1],u=0,d=1,f=c-o,p=l-s,m=n-o;if(!(!f&&m>0)){if(m/=f,f<0){if(m<u)return;m<d&&(d=m)}else if(f>0){if(m>d)return;m>u&&(u=m)}if(m=i-o,!(!f&&m<0)){if(m/=f,f<0){if(m>d)return;m>u&&(u=m)}else if(f>0){if(m<u)return;m<d&&(d=m)}if(m=r-s,!(!p&&m>0)){if(m/=p,p<0){if(m<u)return;m<d&&(d=m)}else if(p>0){if(m>d)return;m>u&&(u=m)}if(m=a-s,!(!p&&m<0)){if(m/=p,p<0){if(m>d)return;m>u&&(u=m)}else if(p>0){if(m<u)return;m<d&&(d=m)}return u>0&&(e[0]=o+u*f,e[1]=s+u*p),d<1&&(t[0]=o+d*f,t[1]=s+d*p),!0}}}}}var Qs=1e9,$s=-Qs;function ec(e,t,n,r){function i(i,a){return e<=i&&i<=n&&t<=a&&a<=r}function a(i,a,s,l){var u=0,d=0;if(i==null||(u=o(i,s))!==(d=o(a,s))||c(i,a)<0^s>0)do l.point(u===0||u===3?e:n,u>1?r:t);while((u=(u+s+4)%4)!==d);else l.point(a[0],a[1])}function o(r,i){return Z(r[0]-e)<1e-6?i>0?0:3:Z(r[0]-n)<1e-6?i>0?2:1:Z(r[1]-t)<1e-6?i>0?1:0:i>0?3:2}function s(e,t){return c(e.x,t.x)}function c(e,t){var n=o(e,1),r=o(t,1);return n===r?n===0?t[1]-e[1]:n===1?e[0]-t[0]:n===2?e[1]-t[1]:t[0]-e[0]:n-r}return function(o){var c=o,l=Is(),u,d,f,p,m,h,g,_,v,y,b,x={point:S,lineStart:E,lineEnd:D,polygonStart:w,polygonEnd:T};function S(e,t){i(e,t)&&c.point(e,t)}function C(){for(var t=0,n=0,i=d.length;n<i;++n)for(var a=d[n],o=1,s=a.length,c=a[0],l,u,f=c[0],p=c[1];o<s;++o)l=f,u=p,c=a[o],f=c[0],p=c[1],u<=r?p>r&&(f-l)*(r-u)>(p-u)*(e-l)&&++t:p<=r&&(f-l)*(r-u)<(p-u)*(e-l)&&--t;return t}function w(){c=l,u=[],d=[],b=!0}function T(){var e=C(),t=b&&e,n=(u=kt(u)).length;(t||n)&&(o.polygonStart(),t&&(o.lineStart(),a(null,null,1,o),o.lineEnd()),n&&zs(u,s,e,a,o),o.polygonEnd()),c=o,u=d=f=null}function E(){x.point=O,d&&d.push(f=[]),y=!0,v=!1,g=_=NaN}function D(){u&&(O(p,m),h&&v&&l.rejoin(),u.push(l.result())),x.point=S,v&&c.lineEnd()}function O(a,o){var s=i(a,o);if(d&&f.push([a,o]),y)p=a,m=o,h=s,y=!1,s&&(c.lineStart(),c.point(a,o));else if(s&&v)c.point(a,o);else{var l=[g=Math.max($s,Math.min(Qs,g)),_=Math.max($s,Math.min(Qs,_))],u=[a=Math.max($s,Math.min(Qs,a)),o=Math.max($s,Math.min(Qs,o))];Zs(l,u,e,t,n,r)?(v||(c.lineStart(),c.point(l[0],l[1])),c.point(u[0],u[1]),s||c.lineEnd(),b=!1):s&&(c.lineStart(),c.point(a,o),b=!1)}g=a,_=o,v=s}return x}}function tc(e,t,n){var r=At(e,t-J,n).concat(t);return function(e){return r.map(function(t){return[e,t]})}}function nc(e,t,n){var r=At(e,t-J,n).concat(t);return function(e){return r.map(function(t){return[t,e]})}}function rc(){var e,t,n,r,i,a,o,s,c=10,l=c,u=90,d=360,f,p,m,h,g=2.5;function _(){return{type:`MultiLineString`,coordinates:v()}}function v(){return At(as(r/u)*u,n,u).map(m).concat(At(as(s/d)*d,o,d).map(h)).concat(At(as(t/c)*c,e,c).filter(function(e){return Z(e%u)>J}).map(f)).concat(At(as(a/l)*l,i,l).filter(function(e){return Z(e%d)>J}).map(p))}return _.lines=function(){return v().map(function(e){return{type:`LineString`,coordinates:e}})},_.outline=function(){return{type:`Polygon`,coordinates:[m(r).concat(h(o).slice(1),m(n).reverse().slice(1),h(s).reverse().slice(1))]}},_.extent=function(e){return arguments.length?_.extentMajor(e).extentMinor(e):_.extentMinor()},_.extentMajor=function(e){return arguments.length?(r=+e[0][0],n=+e[1][0],s=+e[0][1],o=+e[1][1],r>n&&(e=r,r=n,n=e),s>o&&(e=s,s=o,o=e),_.precision(g)):[[r,s],[n,o]]},_.extentMinor=function(n){return arguments.length?(t=+n[0][0],e=+n[1][0],a=+n[0][1],i=+n[1][1],t>e&&(n=t,t=e,e=n),a>i&&(n=a,a=i,i=n),_.precision(g)):[[t,a],[e,i]]},_.step=function(e){return arguments.length?_.stepMajor(e).stepMinor(e):_.stepMinor()},_.stepMajor=function(e){return arguments.length?(u=+e[0],d=+e[1],_):[u,d]},_.stepMinor=function(e){return arguments.length?(c=+e[0],l=+e[1],_):[c,l]},_.precision=function(c){return arguments.length?(g=+c,f=tc(a,i,90),p=nc(t,e,g),m=tc(s,o,90),h=nc(r,n,g),_):g},_.extentMajor([[-180,-90+J],[180,90-J]]).extentMinor([[-180,-80-J],[180,80+J]])}var ic=e=>e,ac=new mt,oc=new mt,sc,cc,lc,uc,dc={point:ps,lineStart:ps,lineEnd:ps,polygonStart:function(){dc.lineStart=fc,dc.lineEnd=hc},polygonEnd:function(){dc.lineStart=dc.lineEnd=dc.point=ps,ac.add(Z(oc)),oc=new mt},result:function(){var e=ac/2;return ac=new mt,e}};function fc(){dc.point=pc}function pc(e,t){dc.point=mc,sc=lc=e,cc=uc=t}function mc(e,t){oc.add(uc*e-lc*t),lc=e,uc=t}function hc(){mc(sc,cc)}var gc=1/0,_c=gc,vc=-gc,yc=vc,bc={point:xc,lineStart:ps,lineEnd:ps,polygonStart:ps,polygonEnd:ps,result:function(){var e=[[gc,_c],[vc,yc]];return vc=yc=-(_c=gc=1/0),e}};function xc(e,t){e<gc&&(gc=e),e>vc&&(vc=e),t<_c&&(_c=t),t>yc&&(yc=t)}var Sc=0,Cc=0,wc=0,Tc=0,Ec=0,Dc=0,Oc=0,kc=0,Ac=0,jc,Mc,Nc,Pc,Fc={point:Ic,lineStart:Lc,lineEnd:Bc,polygonStart:function(){Fc.lineStart=Vc,Fc.lineEnd=Hc},polygonEnd:function(){Fc.point=Ic,Fc.lineStart=Lc,Fc.lineEnd=Bc},result:function(){var e=Ac?[Oc/Ac,kc/Ac]:Dc?[Tc/Dc,Ec/Dc]:wc?[Sc/wc,Cc/wc]:[NaN,NaN];return Sc=Cc=wc=Tc=Ec=Dc=Oc=kc=Ac=0,e}};function Ic(e,t){Sc+=e,Cc+=t,++wc}function Lc(){Fc.point=Rc}function Rc(e,t){Fc.point=zc,Ic(Nc=e,Pc=t)}function zc(e,t){var n=e-Nc,r=t-Pc,i=ls(n*n+r*r);Tc+=i*(Nc+e)/2,Ec+=i*(Pc+t)/2,Dc+=i,Ic(Nc=e,Pc=t)}function Bc(){Fc.point=Ic}function Vc(){Fc.point=Uc}function Hc(){Wc(jc,Mc)}function Uc(e,t){Fc.point=Wc,Ic(jc=Nc=e,Mc=Pc=t)}function Wc(e,t){var n=e-Nc,r=t-Pc,i=ls(n*n+r*r);Tc+=i*(Nc+e)/2,Ec+=i*(Pc+t)/2,Dc+=i,i=Pc*e-Nc*t,Oc+=i*(Nc+e),kc+=i*(Pc+t),Ac+=i*3,Ic(Nc=e,Pc=t)}function Gc(e){this._context=e}Gc.prototype={_radius:4.5,pointRadius:function(e){return this._radius=e,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(e,t){switch(this._point){case 0:this._context.moveTo(e,t),this._point=1;break;case 1:this._context.lineTo(e,t);break;default:this._context.moveTo(e+this._radius,t),this._context.arc(e,t,this._radius,0,ts);break}},result:ps};var Kc=new mt,qc,Jc,Yc,Xc,Zc,Qc={point:ps,lineStart:function(){Qc.point=$c},lineEnd:function(){qc&&el(Jc,Yc),Qc.point=ps},polygonStart:function(){qc=!0},polygonEnd:function(){qc=null},result:function(){var e=+Kc;return Kc=new mt,e}};function $c(e,t){Qc.point=el,Jc=Xc=e,Yc=Zc=t}function el(e,t){Xc-=e,Zc-=t,Kc.add(ls(Xc*Xc+Zc*Zc)),Xc=e,Zc=t}var tl,nl,rl,il,al=class{constructor(e){this._append=e==null?ol:sl(e),this._radius=4.5,this._=``}pointRadius(e){return this._radius=+e,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){this._line===0&&(this._+=`Z`),this._point=NaN}point(e,t){switch(this._point){case 0:this._append`M${e},${t}`,this._point=1;break;case 1:this._append`L${e},${t}`;break;default:if(this._append`M${e},${t}`,this._radius!==rl||this._append!==nl){let e=this._radius,t=this._;this._=``,this._append`m0,${e}a${e},${e} 0 1,1 0,${-2*e}a${e},${e} 0 1,1 0,${2*e}z`,rl=e,nl=this._append,il=this._,this._=t}this._+=il;break}}result(){let e=this._;return this._=``,e.length?e:null}};function ol(e){let t=1;this._+=e[0];for(let n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function sl(e){let t=Math.floor(e);if(!(t>=0))throw RangeError(`invalid digits: ${e}`);if(t>15)return ol;if(t!==tl){let e=10**t;tl=t,nl=function(t){let n=1;this._+=t[0];for(let r=t.length;n<r;++n)this._+=Math.round(arguments[n]*e)/e+t[n]}}return nl}function cl(e,t){let n=3,r=4.5,i,a;function o(e){return e&&(typeof r==`function`&&a.pointRadius(+r.apply(this,arguments)),ys(e,i(a))),a.result()}return o.area=function(e){return ys(e,i(dc)),dc.result()},o.measure=function(e){return ys(e,i(Qc)),Qc.result()},o.bounds=function(e){return ys(e,i(bc)),bc.result()},o.centroid=function(e){return ys(e,i(Fc)),Fc.result()},o.projection=function(t){return arguments.length?(i=t==null?(e=null,ic):(e=t).stream,o):e},o.context=function(e){return arguments.length?(a=e==null?(t=null,new al(n)):new Gc(t=e),typeof r!=`function`&&a.pointRadius(r),o):t},o.pointRadius=function(e){return arguments.length?(r=typeof e==`function`?e:(a.pointRadius(+e),+e),o):r},o.digits=function(e){if(!arguments.length)return n;if(e==null)n=null;else{let t=Math.floor(e);if(!(t>=0))throw RangeError(`invalid digits: ${e}`);n=t}return t===null&&(a=new al(n)),o},o.projection(e).digits(n).context(t)}function ll(e){return function(t){var n=new ul;for(var r in e)n[r]=e[r];return n.stream=t,n}}function ul(){}ul.prototype={constructor:ul,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function dl(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),r!=null&&e.clipExtent(null),ys(n,e.stream(bc)),t(bc.result()),r!=null&&e.clipExtent(r),e}function fl(e,t,n){return dl(e,function(n){var r=t[1][0]-t[0][0],i=t[1][1]-t[0][1],a=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),o=+t[0][0]+(r-a*(n[1][0]+n[0][0]))/2,s=+t[0][1]+(i-a*(n[1][1]+n[0][1]))/2;e.scale(150*a).translate([o,s])},n)}function pl(e,t,n){return fl(e,[[0,0],t],n)}function ml(e,t,n){return dl(e,function(n){var r=+t,i=r/(n[1][0]-n[0][0]),a=(r-i*(n[1][0]+n[0][0]))/2,o=-i*n[0][1];e.scale(150*i).translate([a,o])},n)}function hl(e,t,n){return dl(e,function(n){var r=+t,i=r/(n[1][1]-n[0][1]),a=-i*n[0][0],o=(r-i*(n[1][1]+n[0][1]))/2;e.scale(150*i).translate([a,o])},n)}var gl=16,_l=Q(30*X);function vl(e,t){return+t?bl(e,t):yl(e)}function yl(e){return ll({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function bl(e,t){function n(r,i,a,o,s,c,l,u,d,f,p,m,h,g){var _=l-r,v=u-i,y=_*_+v*v;if(y>4*t&&h--){var b=o+f,x=s+p,S=c+m,C=ls(b*b+x*x+S*S),w=fs(S/=C),T=Z(Z(S)-1)<1e-6||Z(a-d)<1e-6?(a+d)/2:is(x,b),E=e(T,w),D=E[0],O=E[1],k=D-r,A=O-i,j=v*k-_*A;(j*j/y>t||Z((_*k+v*A)/y-.5)>.3||o*f+s*p+c*m<_l)&&(n(r,i,a,o,s,c,D,O,T,b/=C,x/=C,S,h,g),g.point(D,O),n(D,O,T,b,x,S,l,u,d,f,p,m,h,g))}}return function(t){var r,i,a,o,s,c,l,u,d,f,p,m,h={point:g,lineStart:_,lineEnd:y,polygonStart:function(){t.polygonStart(),h.lineStart=b},polygonEnd:function(){t.polygonEnd(),h.lineStart=_}};function g(n,r){n=e(n,r),t.point(n[0],n[1])}function _(){u=NaN,h.point=v,t.lineStart()}function v(r,i){var a=xs([r,i]),o=e(r,i);n(u,d,l,f,p,m,u=o[0],d=o[1],l=r,f=a[0],p=a[1],m=a[2],gl,t),t.point(u,d)}function y(){h.point=g,t.lineEnd()}function b(){_(),h.point=x,h.lineEnd=S}function x(e,t){v(r=e,t),i=u,a=d,o=f,s=p,c=m,h.point=v}function S(){n(u,d,l,f,p,m,i,a,r,o,s,c,gl,t),h.lineEnd=y,y()}return h}}var xl=ll({point:function(e,t){this.stream.point(e*X,t*X)}});function Sl(e){return ll({point:function(t,n){var r=e(t,n);return this.stream.point(r[0],r[1])}})}function Cl(e,t,n,r,i){function a(a,o){return a*=r,o*=i,[t+e*a,n-e*o]}return a.invert=function(a,o){return[(a-t)/e*r,(n-o)/e*i]},a}function wl(e,t,n,r,i,a){if(!a)return Cl(e,t,n,r,i);var o=Q(a),s=$(a),c=o*e,l=s*e,u=o/e,d=s/e,f=(s*n-o*t)/e,p=(s*t+o*n)/e;function m(e,a){return e*=r,a*=i,[c*e-l*a+t,n-l*e-c*a]}return m.invert=function(e,t){return[r*(u*e-d*t+f),i*(p-d*e-u*t)]},m}function Tl(e){return El(function(){return e})()}function El(e){var t,n=150,r=480,i=250,a=0,o=0,s=0,c=0,l=0,u,d=0,f=1,p=1,m=null,h=Ks,g=null,_,v,y,b=ic,x=.5,S,C,w,T,E;function D(e){return w(e[0]*X,e[1]*X)}function O(e){return e=w.invert(e[0],e[1]),e&&[e[0]*ns,e[1]*ns]}D.stream=function(e){return T&&E===e?T:T=xl(Sl(u)(h(S(b(E=e)))))},D.preclip=function(e){return arguments.length?(h=e,m=void 0,A()):h},D.postclip=function(e){return arguments.length?(b=e,g=_=v=y=null,A()):b},D.clipAngle=function(e){return arguments.length?(h=+e?Xs(m=e*X):(m=null,Ks),A()):m*ns},D.clipExtent=function(e){return arguments.length?(b=e==null?(g=_=v=y=null,ic):ec(g=+e[0][0],_=+e[0][1],v=+e[1][0],y=+e[1][1]),A()):g==null?null:[[g,_],[v,y]]},D.scale=function(e){return arguments.length?(n=+e,k()):n},D.translate=function(e){return arguments.length?(r=+e[0],i=+e[1],k()):[r,i]},D.center=function(e){return arguments.length?(a=e[0]%360*X,o=e[1]%360*X,k()):[a*ns,o*ns]},D.rotate=function(e){return arguments.length?(s=e[0]%360*X,c=e[1]%360*X,l=e.length>2?e[2]%360*X:0,k()):[s*ns,c*ns,l*ns]},D.angle=function(e){return arguments.length?(d=e%360*X,k()):d*ns},D.reflectX=function(e){return arguments.length?(f=e?-1:1,k()):f<0},D.reflectY=function(e){return arguments.length?(p=e?-1:1,k()):p<0},D.precision=function(e){return arguments.length?(S=vl(C,x=e*e),A()):ls(x)},D.fitExtent=function(e,t){return fl(D,e,t)},D.fitSize=function(e,t){return pl(D,e,t)},D.fitWidth=function(e,t){return ml(D,e,t)},D.fitHeight=function(e,t){return hl(D,e,t)};function k(){var e=wl(n,0,0,f,p,d).apply(null,t(a,o)),m=wl(n,r-e[0],i-e[1],f,p,d);return u=ks(s,c,l),C=Ds(t,m),w=Ds(u,C),S=vl(C,x),A()}function A(){return T=E=null,D}return function(){return t=e.apply(this,arguments),D.invert=t.invert&&O,k()}}function Dl(e){return function(t,n){var r=ls(t*t+n*n),i=e(r),a=$(i),o=Q(i);return[is(t*a,r*o),fs(r&&n*a/r)]}}function Ol(e,t){return[e,ss(us(($o+t)/2))]}Ol.invert=function(e,t){return[e,2*rs(os(t))-$o]};function kl(){return Al(Ol).scale(961/ts)}function Al(e){var t=Tl(e),n=t.center,r=t.scale,i=t.translate,a=t.clipExtent,o=null,s,c,l;t.scale=function(e){return arguments.length?(r(e),u()):r()},t.translate=function(e){return arguments.length?(i(e),u()):i()},t.center=function(e){return arguments.length?(n(e),u()):n()},t.clipExtent=function(e){return arguments.length?(e==null?o=s=c=l=null:(o=+e[0][0],s=+e[0][1],c=+e[1][0],l=+e[1][1]),u()):o==null?null:[[o,s],[c,l]]};function u(){var n=Y*r(),i=t(Ns(t.rotate()).invert([0,0]));return a(o==null?[[i[0]-n,i[1]-n],[i[0]+n,i[1]+n]]:e===Ol?[[Math.max(i[0]-n,o),s],[Math.min(i[0]+n,c),l]]:[[o,Math.max(i[1]-n,s)],[c,Math.min(i[1]+n,l)]])}return u()}function jl(e,t){return[Q(t)*$(e),$(t)]}jl.invert=Dl(fs);function Ml(){return Tl(jl).scale(249.5).clipAngle(90+J)}var Nl=100;function Pl(e,t,n,r){let i=document.createElement(`div`);i.className=`adornment`;let a=e.scale??1;i.style.flexGrow=`0`,i.style.flexShrink=`0`;let o={id:e.id,name:e.name,map:t,container:i,moveEndPosition:t.getCenter(),geoJson:void 0,isGlobe:e.isGlobe,boundingBox:e.boundingBox,scale:a,backgroundColor:e.backgroundColor??`#000000`,globeBackgroundColor:e.globeBackgroundColor??`#000000`,borderColor:e.borderColor??`#000000`,primaryFillColor:e.primaryFillColor??`#000000`,primaryStrokeColor:e.primaryStrokeColor??`#000000`,secondaryFillColor:e.secondaryFillColor??`#000000`,secondaryStrokeColor:e.secondaryStrokeColor??`#000000`,graticuleColor:e.graticuleColor??`#000000`,frameColor:e.frameColor??`#000000`,frameOutlineColor:e.frameOutlineColor??`#000000`,dotColor:e.dotColor??`#000000`,dotOutlineColor:e.dotOutlineColor??`#000000`,globeFallbackActive:!1,globeGeoJson:void 0},s=[fetch(`${n}/data/insetmaps/${e.fileName}`).then(e=>e.json()).then(e=>{o.geoJson=Ja(e,Object.keys(e.objects)[0])})];if(!e.isGlobe){let e=fetch(`${n}/data/insetmaps/world-110m.json`).then(e=>e.json()).then(e=>{o.globeGeoJson=Ja(e,Object.keys(e.objects)[0])});s.push(e)}Fl(o),r!==`interactive`&&t.on(`resize`,()=>Fl(o));let c=Promise.all(s).then(()=>Fl(o)).catch(()=>{});return t.on(`moveend`,()=>{o.moveEndPosition=t.getCenter(),(o.isGlobe||o.globeFallbackActive)&&Fl(o)}),t.on(`move`,()=>{if(!o.isGlobe){let[e,n,r,i]=o.boundingBox,a=Rl(t),s=Qo(ei([a,Qr([[[e,n],[e,i],[r,i],[r,n],[e,n]]])])),c=za(a),l=(s?za(s):0)<c*.75;o.globeFallbackActive!==l&&(o.globeFallbackActive=l,o.moveEndPosition=t.getCenter(),Fl(o))}Ll(o)}),{element:i,ready:c}}function Fl(e){let{id:t,map:n,container:r,scale:i,backgroundColor:a,globeBackgroundColor:o,secondaryFillColor:s,secondaryStrokeColor:c,primaryFillColor:l,primaryStrokeColor:u,graticuleColor:d,borderColor:f,frameColor:p,frameOutlineColor:m,dotColor:h,dotOutlineColor:g}=e,_=Nl*i,v=n.getScale();r.style.width=`${_*v}px`,r.style.height=`${_*v}px`;let y=e.globeFallbackActive&&e.globeGeoJson!==void 0,b=y?e.globeGeoJson:e.geoJson,x=y||e.isGlobe;if(b===void 0)return;let S=_/2,C=.1*i,w=[x?`<circle cx="${S}" cy="${S}" r="${S}" ${H(o)}></circle>`:`<rect x="0" y="0" width="${_}" height="${_}" ${H(a)}></rect>`],{path:T}=Il(e),E=T({...b,features:b.features.filter(e=>e.properties?.class!==`P1`)});E&&w.push(`
267
+ `}function Ha(e){return ai(e,(e,t)=>e+Ua(t),0)}function Ua(e){let t=0,n;switch(e.type){case`Polygon`:return Wa(e.coordinates);case`MultiPolygon`:for(n=0;n<e.coordinates.length;n++)t+=Wa(e.coordinates[n]);return t;case`Point`:case`MultiPoint`:case`LineString`:case`MultiLineString`:return 0}return 0}function Wa(e){let t=0;if(e&&e.length>0){t+=Math.abs(qa(e[0]));for(let n=1;n<e.length;n++)t-=Math.abs(qa(e[n]))}return t}var Ga=Xr*Xr/2,Ka=Math.PI/180;function qa(e){let t=e.length-1;if(t<=2)return 0;let n=0,r=0;for(;r<t;){let i=e[r],a=e[r+1===t?0:r+1],o=e[r+2>=t?(r+2)%t:r+2],s=i[0]*Ka,c=a[1]*Ka,l=o[0]*Ka;n+=(l-s)*Math.sin(c),r++}return n*Ga}function Ja(e){return e}function Ya(e){if(e==null)return Ja;var t,n,r=e.scale[0],i=e.scale[1],a=e.translate[0],o=e.translate[1];return function(e,s){s||(t=n=0);var c=2,l=e.length,u=Array(l);for(u[0]=(t+=e[0])*r+a,u[1]=(n+=e[1])*i+o;c<l;)u[c]=e[c],++c;return u}}function Xa(e,t){for(var n,r=e.length,i=r-t;i<--r;)n=e[i],e[i++]=e[r],e[r]=n}function Za(e,t){return typeof t==`string`&&(t=e.objects[t]),t.type===`GeometryCollection`?{type:`FeatureCollection`,features:t.geometries.map(function(t){return Qa(e,t)})}:Qa(e,t)}function Qa(e,t){var n=t.id,r=t.bbox,i=t.properties==null?{}:t.properties,a=$a(e,t);return n==null&&r==null?{type:`Feature`,properties:i,geometry:a}:r==null?{type:`Feature`,id:n,properties:i,geometry:a}:{type:`Feature`,id:n,bbox:r,properties:i,geometry:a}}function $a(e,t){var n=Ya(e.transform),r=e.arcs;function i(e,t){t.length&&t.pop();for(var i=r[e<0?~e:e],a=0,o=i.length;a<o;++a)t.push(n(i[a],a));e<0&&Xa(t,o)}function a(e){return n(e)}function o(e){for(var t=[],n=0,r=e.length;n<r;++n)i(e[n],t);return t.length<2&&t.push(t[0]),t}function s(e){for(var t=o(e);t.length<4;)t.push(t[0]);return t}function c(e){return e.map(s)}function l(e){var t=e.type,n;switch(t){case`GeometryCollection`:return{type:t,geometries:e.geometries.map(l)};case`Point`:n=a(e.coordinates);break;case`MultiPoint`:n=e.coordinates.map(a);break;case`LineString`:n=o(e.arcs);break;case`MultiLineString`:n=e.arcs.map(o);break;case`Polygon`:n=c(e.arcs);break;case`MultiPolygon`:n=e.arcs.map(c);break;default:return null}return{type:t,coordinates:n}}return l(t)}var eo=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,to=Math.ceil,no=Math.floor,ro=`[BigNumber Error] `,io=ro+`Number primitive has more than 15 significant digits: `,ao=0x5af3107a4000,G=14,oo=9007199254740991,so=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,0xe8d4a51000,0x9184e72a000],co=1e7,K=1e9;function lo(e){var t,n,r,i=v.prototype={constructor:v,toString:null,valueOf:null},a=new v(1),o=20,s=4,c=-7,l=21,u=-1e7,d=1e7,f=!1,p=1,m=0,h={prefix:``,groupSize:3,secondaryGroupSize:0,groupSeparator:`,`,decimalSeparator:`.`,fractionGroupSize:0,fractionGroupSeparator:`\xA0`,suffix:``},g=`0123456789abcdefghijklmnopqrstuvwxyz`,_=!0;function v(e,t){var i,a,c,l,f,p,m,h,y=this;if(!(y instanceof v))return new v(e,t);if(t==null){if(e&&e._isBigNumber===!0){y.s=e.s,!e.c||e.e>d?y.c=y.e=null:e.e<u?y.c=[y.e=0]:(y.e=e.e,y.c=e.c.slice());return}if((p=typeof e==`number`)&&e*0==0){if(y.s=1/e<0?(e=-e,-1):1,e===~~e){for(l=0,f=e;f>=10;f/=10,l++);l>d?y.c=y.e=null:(y.e=l,y.c=[e]);return}h=String(e)}else{if(!eo.test(h=String(e)))return r(y,h,p);y.s=h.charCodeAt(0)==45?(h=h.slice(1),-1):1}(l=h.indexOf(`.`))>-1&&(h=h.replace(`.`,``)),(f=h.search(/e/i))>0?(l<0&&(l=f),l+=+h.slice(f+1),h=h.substring(0,f)):l<0&&(l=h.length)}else{if(q(t,2,g.length,`Base`),t==10&&_)return y=new v(e),S(y,o+y.e+1,s);if(h=String(e),p=typeof e==`number`){if(e*0!=0)return r(y,h,p,t);if(y.s=1/e<0?(h=h.slice(1),-1):1,v.DEBUG&&h.replace(/^0\.0*|\./,``).length>15)throw Error(io+e)}else y.s=h.charCodeAt(0)===45?(h=h.slice(1),-1):1;for(i=g.slice(0,t),l=f=0,m=h.length;f<m;f++)if(i.indexOf(a=h.charAt(f))<0){if(a==`.`){if(f>l){l=m;continue}}else if(!c&&(h==h.toUpperCase()&&(h=h.toLowerCase())||h==h.toLowerCase()&&(h=h.toUpperCase()))){c=!0,f=-1,l=0;continue}return r(y,String(e),p,t)}p=!1,h=n(h,t,10,y.s),(l=h.indexOf(`.`))>-1?h=h.replace(`.`,``):l=h.length}for(f=0;h.charCodeAt(f)===48;f++);for(m=h.length;h.charCodeAt(--m)===48;);if(h=h.slice(f,++m)){if(m-=f,p&&v.DEBUG&&m>15&&(e>oo||e!==no(e)))throw Error(io+y.s*e);if((l=l-f-1)>d)y.c=y.e=null;else if(l<u)y.c=[y.e=0];else{if(y.e=l,y.c=[],f=(l+1)%G,l<0&&(f+=G),f<m){for(f&&y.c.push(+h.slice(0,f)),m-=G;f<m;)y.c.push(+h.slice(f,f+=G));f=G-(h=h.slice(f)).length}else f-=m;for(;f--;h+=`0`);y.c.push(+h)}}else y.c=[y.e=0]}v.clone=lo,v.ROUND_UP=0,v.ROUND_DOWN=1,v.ROUND_CEIL=2,v.ROUND_FLOOR=3,v.ROUND_HALF_UP=4,v.ROUND_HALF_DOWN=5,v.ROUND_HALF_EVEN=6,v.ROUND_HALF_CEIL=7,v.ROUND_HALF_FLOOR=8,v.EUCLID=9,v.config=v.set=function(e){var t,n;if(e!=null)if(typeof e==`object`){if(e.hasOwnProperty(t=`DECIMAL_PLACES`)&&(n=e[t],q(n,0,K,t),o=n),e.hasOwnProperty(t=`ROUNDING_MODE`)&&(n=e[t],q(n,0,8,t),s=n),e.hasOwnProperty(t=`EXPONENTIAL_AT`)&&(n=e[t],n&&n.pop?(q(n[0],-K,0,t),q(n[1],0,K,t),c=n[0],l=n[1]):(q(n,-K,K,t),c=-(l=n<0?-n:n))),e.hasOwnProperty(t=`RANGE`))if(n=e[t],n&&n.pop)q(n[0],-K,-1,t),q(n[1],1,K,t),u=n[0],d=n[1];else if(q(n,-K,K,t),n)u=-(d=n<0?-n:n);else throw Error(ro+t+` cannot be zero: `+n);if(e.hasOwnProperty(t=`CRYPTO`))if(n=e[t],n===!!n)if(n)if(typeof crypto<`u`&&crypto&&(crypto.getRandomValues||crypto.randomBytes))f=n;else throw f=!n,Error(ro+`crypto unavailable`);else f=n;else throw Error(ro+t+` not true or false: `+n);if(e.hasOwnProperty(t=`MODULO_MODE`)&&(n=e[t],q(n,0,9,t),p=n),e.hasOwnProperty(t=`POW_PRECISION`)&&(n=e[t],q(n,0,K,t),m=n),e.hasOwnProperty(t=`FORMAT`))if(n=e[t],typeof n==`object`)h=n;else throw Error(ro+t+` not an object: `+n);if(e.hasOwnProperty(t=`ALPHABET`))if(n=e[t],typeof n==`string`&&!/^.?$|[+\-.\s]|(.).*\1/.test(n))_=n.slice(0,10)==`0123456789`,g=n;else throw Error(ro+t+` invalid: `+n)}else throw Error(ro+`Object expected: `+e);return{DECIMAL_PLACES:o,ROUNDING_MODE:s,EXPONENTIAL_AT:[c,l],RANGE:[u,d],CRYPTO:f,MODULO_MODE:p,POW_PRECISION:m,FORMAT:h,ALPHABET:g}},v.isBigNumber=function(e){if(!e||e._isBigNumber!==!0)return!1;if(!v.DEBUG)return!0;var t,n,r=e.c,i=e.e,a=e.s;out:if({}.toString.call(r)==`[object Array]`){if((a===1||a===-1)&&i>=-K&&i<=K&&i===no(i)){if(r[0]===0){if(i===0&&r.length===1)return!0;break out}if(t=(i+1)%G,t<1&&(t+=G),String(r[0]).length==t){for(t=0;t<r.length;t++)if(n=r[t],n<0||n>=ao||n!==no(n))break out;if(n!==0)return!0}}}else if(r===null&&i===null&&(a===null||a===1||a===-1))return!0;throw Error(ro+`Invalid BigNumber: `+e)},v.maximum=v.max=function(){return b(arguments,-1)},v.minimum=v.min=function(){return b(arguments,1)},v.random=(function(){var e=9007199254740992,t=Math.random()*e&2097151?function(){return no(Math.random()*e)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(e){var n,r,i,s,c,l=0,u=[],d=new v(a);if(e==null?e=o:q(e,0,K),s=to(e/G),f)if(crypto.getRandomValues){for(n=crypto.getRandomValues(new Uint32Array(s*=2));l<s;)c=n[l]*131072+(n[l+1]>>>11),c>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),n[l]=r[0],n[l+1]=r[1]):(u.push(c%0x5af3107a4000),l+=2);l=s/2}else if(crypto.randomBytes){for(n=crypto.randomBytes(s*=7);l<s;)c=(n[l]&31)*281474976710656+n[l+1]*1099511627776+n[l+2]*4294967296+n[l+3]*16777216+(n[l+4]<<16)+(n[l+5]<<8)+n[l+6],c>=9e15?crypto.randomBytes(7).copy(n,l):(u.push(c%0x5af3107a4000),l+=7);l=s/7}else throw f=!1,Error(ro+`crypto unavailable`);if(!f)for(;l<s;)c=t(),c<9e15&&(u[l++]=c%0x5af3107a4000);for(s=u[--l],e%=G,s&&e&&(c=so[G-e],u[l]=no(s/c)*c);u[l]===0;u.pop(),l--);if(l<0)u=[i=0];else{for(i=-1;u[0]===0;u.splice(0,1),i-=G);for(l=1,c=u[0];c>=10;c/=10,l++);l<G&&(i-=G-l)}return d.e=i,d.c=u,d}})(),v.sum=function(){for(var e=1,t=arguments,n=new v(t[0]);e<t.length;)n=n.plus(t[e++]);return n},n=(function(){var e=`0123456789`;function n(e,t,n,r){for(var i,a=[0],o,s=0,c=e.length;s<c;){for(o=a.length;o--;a[o]*=t);for(a[0]+=r.indexOf(e.charAt(s++)),i=0;i<a.length;i++)a[i]>n-1&&(a[i+1]??(a[i+1]=0),a[i+1]+=a[i]/n|0,a[i]%=n)}return a.reverse()}return function(r,i,a,c,l){var u,d,f,p,h,_,y,b,x=r.indexOf(`.`),S=o,C=s;for(x>=0&&(p=m,m=0,r=r.replace(`.`,``),b=new v(i),_=b.pow(r.length-x),m=p,b.c=n(go(fo(_.c),_.e,`0`),10,a,e),b.e=b.c.length),y=n(r,i,a,l?(u=g,e):(u=e,g)),f=p=y.length;y[--p]==0;y.pop());if(!y[0])return u.charAt(0);if(x<0?--f:(_.c=y,_.e=f,_.s=c,_=t(_,b,S,C,a),y=_.c,h=_.r,f=_.e),d=f+S+1,x=y[d],p=a/2,h=h||d<0||y[d+1]!=null,h=C<4?(x!=null||h)&&(C==0||C==(_.s<0?3:2)):x>p||x==p&&(C==4||h||C==6&&y[d-1]&1||C==(_.s<0?8:7)),d<1||!y[0])r=h?go(u.charAt(1),-S,u.charAt(0)):u.charAt(0);else{if(y.length=d,h)for(--a;++y[--d]>a;)y[d]=0,d||(++f,y=[1].concat(y));for(p=y.length;!y[--p];);for(x=0,r=``;x<=p;r+=u.charAt(y[x++]));r=go(r,f,u.charAt(0))}return r}})(),t=(function(){function e(e,t,n){var r,i,a,o,s=0,c=e.length,l=t%co,u=t/co|0;for(e=e.slice();c--;)a=e[c]%co,o=e[c]/co|0,r=u*a+o*l,i=l*a+r%co*co+s,s=(i/n|0)+(r/co|0)+u*o,e[c]=i%n;return s&&(e=[s].concat(e)),e}function t(e,t,n,r){var i,a;if(n!=r)a=n>r?1:-1;else for(i=a=0;i<n;i++)if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}return a}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=e[n]<t[n]?1:0,e[n]=i*r+e[n]-t[n];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(r,i,a,o,s){var c,l,u,d,f,p,m,h,g,_,y,b,x,C,w,T,E,D=r.s==i.s?1:-1,O=r.c,k=i.c;if(!O||!O[0]||!k||!k[0])return new v(!r.s||!i.s||(O?k&&O[0]==k[0]:!k)?NaN:O&&O[0]==0||!k?D*0:D/0);for(h=new v(D),g=h.c=[],l=r.e-i.e,D=a+l+1,s||(s=ao,l=uo(r.e/G)-uo(i.e/G),D=D/G|0),u=0;k[u]==(O[u]||0);u++);if(k[u]>(O[u]||0)&&l--,D<0)g.push(1),d=!0;else{for(C=O.length,T=k.length,u=0,D+=2,f=no(s/(k[0]+1)),f>1&&(k=e(k,f,s),O=e(O,f,s),T=k.length,C=O.length),x=T,_=O.slice(0,T),y=_.length;y<T;_[y++]=0);E=k.slice(),E=[0].concat(E),w=k[0],k[1]>=s/2&&w++;do{if(f=0,c=t(k,_,T,y),c<0){if(b=_[0],T!=y&&(b=b*s+(_[1]||0)),f=no(b/w),f>1)for(f>=s&&(f=s-1),p=e(k,f,s),m=p.length,y=_.length;t(p,_,m,y)==1;)f--,n(p,T<m?E:k,m,s),m=p.length,c=1;else f==0&&(c=f=1),p=k.slice(),m=p.length;if(m<y&&(p=[0].concat(p)),n(_,p,y,s),y=_.length,c==-1)for(;t(k,_,T,y)<1;)f++,n(_,T<y?E:k,y,s),y=_.length}else c===0&&(f++,_=[0]);g[u++]=f,_[0]?_[y++]=O[x]||0:(_=[O[x]],y=1)}while((x++<C||_[0]!=null)&&D--);d=_[0]!=null,g[0]||g.splice(0,1)}if(s==ao){for(u=1,D=g[0];D>=10;D/=10,u++);S(h,a+(h.e=u+l*G-1)+1,o,d)}else h.e=l,h.r=+d;return h}})();function y(e,t,n,r){var i,a,o,u,d;if(n==null?n=s:q(n,0,8),!e.c)return e.toString();if(i=e.c[0],o=e.e,t==null)d=fo(e.c),d=r==1||r==2&&(o<=c||o>=l)?ho(d,o):go(d,o,`0`);else if(e=S(new v(e),t,n),a=e.e,d=fo(e.c),u=d.length,r==1||r==2&&(t<=a||a<=c)){for(;u<t;d+=`0`,u++);d=ho(d,a)}else if(t-=o+(r===2&&a>o),d=go(d,a,`0`),a+1>u){if(--t>0)for(d+=`.`;t--;d+=`0`);}else if(t+=a-u,t>0)for(a+1==u&&(d+=`.`);t--;d+=`0`);return e.s<0&&i?`-`+d:d}function b(e,t){for(var n,r,i=1,a=new v(e[0]);i<e.length;i++)r=new v(e[i]),(!r.s||(n=po(a,r))===t||n===0&&a.s===t)&&(a=r);return a}function x(e,t,n){for(var r=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,r++);return(n=r+n*G-1)>d?e.c=e.e=null:n<u?e.c=[e.e=0]:(e.e=n,e.c=t),e}r=(function(){var e=/^(-?)0([xbo])(?=\w[\w.]*$)/i,t=/^([^.]+)\.$/,n=/^\.([^.]+)$/,r=/^-?(Infinity|NaN)$/,i=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(a,o,s,c){var l,u=s?o:o.replace(i,``);if(r.test(u))a.s=isNaN(u)?null:u<0?-1:1;else{if(!s&&(u=u.replace(e,function(e,t,n){return l=(n=n.toLowerCase())==`x`?16:n==`b`?2:8,!c||c==l?t:e}),c&&(l=c,u=u.replace(t,`$1`).replace(n,`0.$1`)),o!=u))return new v(u,l);if(v.DEBUG)throw Error(ro+`Not a`+(c?` base `+c:``)+` number: `+o);a.s=null}a.c=a.e=null}})();function S(e,t,n,r){var i,a,o,s,c,l,f,p=e.c,m=so;if(p){out:{for(i=1,s=p[0];s>=10;s/=10,i++);if(a=t-i,a<0)a+=G,o=t,c=p[l=0],f=no(c/m[i-o-1]%10);else if(l=to((a+1)/G),l>=p.length)if(r){for(;p.length<=l;p.push(0));c=f=0,i=1,a%=G,o=a-G+1}else break out;else{for(c=s=p[l],i=1;s>=10;s/=10,i++);a%=G,o=a-G+i,f=o<0?0:no(c/m[i-o-1]%10)}if(r=r||t<0||p[l+1]!=null||(o<0?c:c%m[i-o-1]),r=n<4?(f||r)&&(n==0||n==(e.s<0?3:2)):f>5||f==5&&(n==4||r||n==6&&(a>0?o>0?c/m[i-o]:0:p[l-1])%10&1||n==(e.s<0?8:7)),t<1||!p[0])return p.length=0,r?(t-=e.e+1,p[0]=m[(G-t%G)%G],e.e=-t||0):p[0]=e.e=0,e;if(a==0?(p.length=l,s=1,l--):(p.length=l+1,s=m[G-a],p[l]=o>0?no(c/m[i-o]%m[o])*s:0),r)for(;;)if(l==0){for(a=1,o=p[0];o>=10;o/=10,a++);for(o=p[0]+=s,s=1;o>=10;o/=10,s++);a!=s&&(e.e++,p[0]==ao&&(p[0]=1));break}else{if(p[l]+=s,p[l]!=ao)break;p[l--]=0,s=1}for(a=p.length;p[--a]===0;p.pop());}e.e>d?e.c=e.e=null:e.e<u&&(e.c=[e.e=0])}return e}function C(e){var t,n=e.e;return n===null?e.toString():(t=fo(e.c),t=n<=c||n>=l?ho(t,n):go(t,n,`0`),e.s<0?`-`+t:t)}return i.absoluteValue=i.abs=function(){var e=new v(this);return e.s<0&&(e.s=1),e},i.comparedTo=function(e,t){return po(this,new v(e,t))},i.decimalPlaces=i.dp=function(e,t){var n,r,i,a=this;if(e!=null)return q(e,0,K),t==null?t=s:q(t,0,8),S(new v(a),e+a.e+1,t);if(!(n=a.c))return null;if(r=((i=n.length-1)-uo(this.e/G))*G,i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},i.dividedBy=i.div=function(e,n){return t(this,new v(e,n),o,s)},i.dividedToIntegerBy=i.idiv=function(e,n){return t(this,new v(e,n),0,1)},i.exponentiatedBy=i.pow=function(e,t){var n,r,i,o,c,l,u,d,f,p=this;if(e=new v(e),e.c&&!e.isInteger())throw Error(ro+`Exponent not an integer: `+C(e));if(t!=null&&(t=new v(t)),l=e.e>14,!p.c||!p.c[0]||p.c[0]==1&&!p.e&&p.c.length==1||!e.c||!e.c[0])return f=new v(C(p)**(l?e.s*(2-mo(e)):+C(e))),t?f.mod(t):f;if(u=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new v(NaN);r=!u&&p.isInteger()&&t.isInteger(),r&&(p=p.mod(t))}else if(e.e>9&&(p.e>0||p.e<-1||(p.e==0?p.c[0]>1||l&&p.c[1]>=24e7:p.c[0]<8e13||l&&p.c[0]<=9999975e7)))return o=p.s<0&&mo(e)?-0:0,p.e>-1&&(o=1/o),new v(u?1/o:o);else m&&(o=to(m/G+2));for(l?(n=new v(.5),u&&(e.s=1),d=mo(e)):(i=Math.abs(+C(e)),d=i%2),f=new v(a);;){if(d){if(f=f.times(p),!f.c)break;o?f.c.length>o&&(f.c.length=o):r&&(f=f.mod(t))}if(i){if(i=no(i/2),i===0)break;d=i%2}else if(e=e.times(n),S(e,e.e+1,1),e.e>14)d=mo(e);else{if(i=+C(e),i===0)break;d=i%2}p=p.times(p),o?p.c&&p.c.length>o&&(p.c.length=o):r&&(p=p.mod(t))}return r?f:(u&&(f=a.div(f)),t?f.mod(t):o?S(f,m,s,c):f)},i.integerValue=function(e){var t=new v(this);return e==null?e=s:q(e,0,8),S(t,t.e+1,e)},i.isEqualTo=i.eq=function(e,t){return po(this,new v(e,t))===0},i.isFinite=function(){return!!this.c},i.isGreaterThan=i.gt=function(e,t){return po(this,new v(e,t))>0},i.isGreaterThanOrEqualTo=i.gte=function(e,t){return(t=po(this,new v(e,t)))===1||t===0},i.isInteger=function(){return!!this.c&&uo(this.e/G)>this.c.length-2},i.isLessThan=i.lt=function(e,t){return po(this,new v(e,t))<0},i.isLessThanOrEqualTo=i.lte=function(e,t){return(t=po(this,new v(e,t)))===-1||t===0},i.isNaN=function(){return!this.s},i.isNegative=function(){return this.s<0},i.isPositive=function(){return this.s>0},i.isZero=function(){return!!this.c&&this.c[0]==0},i.minus=function(e,t){var n,r,i,a,o=this,c=o.s;if(e=new v(e,t),t=e.s,!c||!t)return new v(NaN);if(c!=t)return e.s=-t,o.plus(e);var l=o.e/G,u=e.e/G,d=o.c,f=e.c;if(!l||!u){if(!d||!f)return d?(e.s=-t,e):new v(f?o:NaN);if(!d[0]||!f[0])return f[0]?(e.s=-t,e):new v(d[0]?o:s==3?-0:0)}if(l=uo(l),u=uo(u),d=d.slice(),c=l-u){for((a=c<0)?(c=-c,i=d):(u=l,i=f),i.reverse(),t=c;t--;i.push(0));i.reverse()}else for(r=(a=(c=d.length)<(t=f.length))?c:t,c=t=0;t<r;t++)if(d[t]!=f[t]){a=d[t]<f[t];break}if(a&&(i=d,d=f,f=i,e.s=-e.s),t=(r=f.length)-(n=d.length),t>0)for(;t--;d[n++]=0);for(t=ao-1;r>c;){if(d[--r]<f[r]){for(n=r;n&&!d[--n];d[n]=t);--d[n],d[r]+=ao}d[r]-=f[r]}for(;d[0]==0;d.splice(0,1),--u);return d[0]?x(e,d,u):(e.s=s==3?-1:1,e.c=[e.e=0],e)},i.modulo=i.mod=function(e,n){var r,i,a=this;return e=new v(e,n),!a.c||!e.s||e.c&&!e.c[0]?new v(NaN):!e.c||a.c&&!a.c[0]?new v(a):(p==9?(i=e.s,e.s=1,r=t(a,e,0,3),e.s=i,r.s*=i):r=t(a,e,0,p),e=a.minus(r.times(e)),!e.c[0]&&p==1&&(e.s=a.s),e)},i.multipliedBy=i.times=function(e,t){var n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_=this,y=_.c,b=(e=new v(e,t)).c;if(!y||!b||!y[0]||!b[0])return!_.s||!e.s||y&&!y[0]&&!b||b&&!b[0]&&!y?e.c=e.e=e.s=null:(e.s*=_.s,!y||!b?e.c=e.e=null:(e.c=[0],e.e=0)),e;for(r=uo(_.e/G)+uo(e.e/G),e.s*=_.s,c=y.length,d=b.length,c<d&&(m=y,y=b,b=m,i=c,c=d,d=i),i=c+d,m=[];i--;m.push(0));for(h=ao,g=co,i=d;--i>=0;){for(n=0,f=b[i]%g,p=b[i]/g|0,o=c,a=i+o;a>i;)l=y[--o]%g,u=y[o]/g|0,s=p*l+u*f,l=f*l+s%g*g+m[a]+n,n=(l/h|0)+(s/g|0)+p*u,m[a--]=l%h;m[a]=n}return n?++r:m.splice(0,1),x(e,m,r)},i.negated=function(){var e=new v(this);return e.s=-e.s||null,e},i.plus=function(e,t){var n,r=this,i=r.s;if(e=new v(e,t),t=e.s,!i||!t)return new v(NaN);if(i!=t)return e.s=-t,r.minus(e);var a=r.e/G,o=e.e/G,s=r.c,c=e.c;if(!a||!o){if(!s||!c)return new v(i/0);if(!s[0]||!c[0])return c[0]?e:new v(s[0]?r:i*0)}if(a=uo(a),o=uo(o),s=s.slice(),i=a-o){for(i>0?(o=a,n=c):(i=-i,n=s),n.reverse();i--;n.push(0));n.reverse()}for(i=s.length,t=c.length,i-t<0&&(n=c,c=s,s=n,t=i),i=0;t;)i=(s[--t]=s[t]+c[t]+i)/ao|0,s[t]=ao===s[t]?0:s[t]%ao;return i&&(s=[i].concat(s),++o),x(e,s,o)},i.precision=i.sd=function(e,t){var n,r,i,a=this;if(e!=null&&e!==!!e)return q(e,1,K),t==null?t=s:q(t,0,8),S(new v(a),e,t);if(!(n=a.c))return null;if(i=n.length-1,r=i*G+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return e&&a.e+1>r&&(r=a.e+1),r},i.shiftedBy=function(e){return q(e,-oo,oo),this.times(`1e`+e)},i.squareRoot=i.sqrt=function(){var e,n,r,i,a,c=this,l=c.c,u=c.s,d=c.e,f=o+4,p=new v(`0.5`);if(u!==1||!l||!l[0])return new v(!u||u<0&&(!l||l[0])?NaN:l?c:1/0);if(u=Math.sqrt(+C(c)),u==0||u==1/0?(n=fo(l),(n.length+d)%2==0&&(n+=`0`),u=Math.sqrt(+n),d=uo((d+1)/2)-(d<0||d%2),u==1/0?n=`5e`+d:(n=u.toExponential(),n=n.slice(0,n.indexOf(`e`)+1)+d),r=new v(n)):r=new v(u+``),r.c[0]){for(d=r.e,u=d+f,u<3&&(u=0);;)if(a=r,r=p.times(a.plus(t(c,a,f,1))),fo(a.c).slice(0,u)===(n=fo(r.c)).slice(0,u))if(r.e<d&&--u,n=n.slice(u-3,u+1),n==`9999`||!i&&n==`4999`){if(!i&&(S(a,a.e+o+2,0),a.times(a).eq(c))){r=a;break}f+=4,u+=4,i=1}else{(!+n||!+n.slice(1)&&n.charAt(0)==`5`)&&(S(r,r.e+o+2,1),e=!r.times(r).eq(c));break}}return S(r,r.e+o+1,s,e)},i.toExponential=function(e,t){return e!=null&&(q(e,0,K),e++),y(this,e,t,1)},i.toFixed=function(e,t){return e!=null&&(q(e,0,K),e=e+this.e+1),y(this,e,t)},i.toFormat=function(e,t,n){var r,i=this;if(n==null)e!=null&&t&&typeof t==`object`?(n=t,t=null):e&&typeof e==`object`?(n=e,e=t=null):n=h;else if(typeof n!=`object`)throw Error(ro+`Argument not an object: `+n);if(r=i.toFixed(e,t),i.c){var a,o=r.split(`.`),s=+n.groupSize,c=+n.secondaryGroupSize,l=n.groupSeparator||``,u=o[0],d=o[1],f=i.s<0,p=f?u.slice(1):u,m=p.length;if(c&&(a=s,s=c,c=a,m-=a),s>0&&m>0){for(a=m%s||s,u=p.substr(0,a);a<m;a+=s)u+=l+p.substr(a,s);c>0&&(u+=l+p.slice(a)),f&&(u=`-`+u)}r=d?u+(n.decimalSeparator||``)+((c=+n.fractionGroupSize)?d.replace(RegExp(`\\d{`+c+`}\\B`,`g`),`$&`+(n.fractionGroupSeparator||``)):d):u}return(n.prefix||``)+r+(n.suffix||``)},i.toFraction=function(e){var n,r,i,o,c,l,u,f,p,m,h,g,_=this,y=_.c;if(e!=null&&(u=new v(e),!u.isInteger()&&(u.c||u.s!==1)||u.lt(a)))throw Error(ro+`Argument `+(u.isInteger()?`out of range: `:`not an integer: `)+C(u));if(!y)return new v(_);for(n=new v(a),p=r=new v(a),i=f=new v(a),g=fo(y),c=n.e=g.length-_.e-1,n.c[0]=so[(l=c%G)<0?G+l:l],e=!e||u.comparedTo(n)>0?c>0?n:p:u,l=d,d=1/0,u=new v(g),f.c[0]=0;m=t(u,n,0,1),o=r.plus(m.times(i)),o.comparedTo(e)!=1;)r=i,i=o,p=f.plus(m.times(o=p)),f=o,n=u.minus(m.times(o=n)),u=o;return o=t(e.minus(r),i,0,1),f=f.plus(o.times(p)),r=r.plus(o.times(i)),f.s=p.s=_.s,c*=2,h=t(p,i,c,s).minus(_).abs().comparedTo(t(f,r,c,s).minus(_).abs())<1?[p,i]:[f,r],d=l,h},i.toNumber=function(){return+C(this)},i.toPrecision=function(e,t){return e!=null&&q(e,1,K),y(this,e,t,2)},i.toString=function(e){var t,r=this,i=r.s,a=r.e;return a===null?i?(t=`Infinity`,i<0&&(t=`-`+t)):t=`NaN`:(e==null?t=a<=c||a>=l?ho(fo(r.c),a):go(fo(r.c),a,`0`):e===10&&_?(r=S(new v(r),o+a+1,s),t=go(fo(r.c),r.e,`0`)):(q(e,2,g.length,`Base`),t=n(go(fo(r.c),a,`0`),10,e,i,!0)),i<0&&r.c[0]&&(t=`-`+t)),t},i.valueOf=i.toJSON=function(){return C(this)},i._isBigNumber=!0,i[Symbol.toStringTag]=`BigNumber`,i[Symbol.for(`nodejs.util.inspect.custom`)]=i.valueOf,e!=null&&v.set(e),v}function uo(e){var t=e|0;return e>0||e===t?t:t-1}function fo(e){for(var t,n,r=1,i=e.length,a=e[0]+``;r<i;){for(t=e[r++]+``,n=G-t.length;n--;t=`0`+t);a+=t}for(i=a.length;a.charCodeAt(--i)===48;);return a.slice(0,i+1||1)}function po(e,t){var n,r,i=e.c,a=t.c,o=e.s,s=t.s,c=e.e,l=t.e;if(!o||!s)return null;if(n=i&&!i[0],r=a&&!a[0],n||r)return n?r?0:-s:o;if(o!=s)return o;if(n=o<0,r=c==l,!i||!a)return r?0:!i^n?1:-1;if(!r)return c>l^n?1:-1;for(s=(c=i.length)<(l=a.length)?c:l,o=0;o<s;o++)if(i[o]!=a[o])return i[o]>a[o]^n?1:-1;return c==l?0:c>l^n?1:-1}function q(e,t,n,r){if(e<t||e>n||e!==no(e))throw Error(ro+(r||`Argument`)+(typeof e==`number`?e<t||e>n?` out of range: `:` not an integer: `:` not a primitive number: `)+String(e))}function mo(e){var t=e.c.length-1;return uo(e.e/G)==t&&e.c[t]%2!=0}function ho(e,t){return(e.length>1?e.charAt(0)+`.`+e.slice(1):e)+(t<0?`e`:`e+`)+t}function go(e,t,n){var r,i;if(t<0){for(i=n+`.`;++t;i+=n);e=i+e}else if(r=e.length,++t>r){for(i=n,t-=r;--t;i+=n);e+=i}else t<r&&(e=e.slice(0,t)+`.`+e.slice(t));return e}var _o=lo(),vo=class{key;left=null;right=null;constructor(e){this.key=e}},yo=class extends vo{constructor(e){super(e)}},bo=class{size=0;modificationCount=0;splayCount=0;splay(e){let t=this.root;if(t==null)return this.compare(e,e),-1;let n=null,r=null,i=null,a=null,o=t,s=this.compare,c;for(;;)if(c=s(o.key,e),c>0){let t=o.left;if(t==null||(c=s(t.key,e),c>0&&(o.left=t.right,t.right=o,o=t,t=o.left,t==null)))break;n==null?r=o:n.left=o,n=o,o=t}else if(c<0){let t=o.right;if(t==null||(c=s(t.key,e),c<0&&(o.right=t.left,t.left=o,o=t,t=o.right,t==null)))break;i==null?a=o:i.right=o,i=o,o=t}else break;return i!=null&&(i.right=o.left,o.left=a),n!=null&&(n.left=o.right,o.right=r),this.root!==o&&(this.root=o,this.splayCount++),c}splayMin(e){let t=e,n=t.left;for(;n!=null;){let e=n;t.left=e.right,e.right=t,t=e,n=t.left}return t}splayMax(e){let t=e,n=t.right;for(;n!=null;){let e=n;t.right=e.left,e.left=t,t=e,n=t.right}return t}_delete(e){if(this.root==null||this.splay(e)!=0)return null;let t=this.root,n=t,r=t.left;if(this.size--,r==null)this.root=t.right;else{let e=t.right;t=this.splayMax(r),t.right=e,this.root=t}return this.modificationCount++,n}addNewRoot(e,t){this.size++,this.modificationCount++;let n=this.root;if(n==null){this.root=e;return}t<0?(e.left=n,e.right=n.right,n.right=null):(e.right=n,e.left=n.left,n.left=null),this.root=e}_first(){let e=this.root;return e==null?null:(this.root=this.splayMin(e),this.root)}_last(){let e=this.root;return e==null?null:(this.root=this.splayMax(e),this.root)}clear(){this.root=null,this.size=0,this.modificationCount++}has(e){return this.validKey(e)&&this.splay(e)==0}defaultCompare(){return(e,t)=>e<t?-1:e>t?1:0}wrap(){return{getRoot:()=>this.root,setRoot:e=>{this.root=e},getSize:()=>this.size,getModificationCount:()=>this.modificationCount,getSplayCount:()=>this.splayCount,setSplayCount:e=>{this.splayCount=e},splay:e=>this.splay(e),has:e=>this.has(e)}}},xo=class e extends bo{root=null;compare;validKey;constructor(e,t){super(),this.compare=e??this.defaultCompare(),this.validKey=t??(e=>e!=null&&e!=null)}delete(e){return this.validKey(e)?this._delete(e)!=null:!1}deleteAll(e){for(let t of e)this.delete(t)}forEach(e){let t=this[Symbol.iterator](),n;for(;n=t.next(),!n.done;)e(n.value,n.value,this)}add(e){let t=this.splay(e);return t!=0&&this.addNewRoot(new yo(e),t),this}addAndReturn(e){let t=this.splay(e);return t!=0&&this.addNewRoot(new yo(e),t),this.root.key}addAll(e){for(let t of e)this.add(t)}isEmpty(){return this.root==null}isNotEmpty(){return this.root!=null}single(){if(this.size==0)throw`Bad state: No element`;if(this.size>1)throw`Bad state: Too many element`;return this.root.key}first(){if(this.size==0)throw`Bad state: No element`;return this._first().key}last(){if(this.size==0)throw`Bad state: No element`;return this._last().key}lastBefore(e){if(e==null)throw`Invalid arguments(s)`;if(this.root==null)return null;if(this.splay(e)<0)return this.root.key;let t=this.root.left;if(t==null)return null;let n=t.right;for(;n!=null;)t=n,n=t.right;return t.key}firstAfter(e){if(e==null)throw`Invalid arguments(s)`;if(this.root==null)return null;if(this.splay(e)>0)return this.root.key;let t=this.root.right;if(t==null)return null;let n=t.left;for(;n!=null;)t=n,n=t.left;return t.key}retainAll(t){let n=new e(this.compare,this.validKey),r=this.modificationCount;for(let e of t){if(r!=this.modificationCount)throw`Concurrent modification during iteration.`;this.validKey(e)&&this.splay(e)==0&&n.add(this.root.key)}n.size!=this.size&&(this.root=n.root,this.size=n.size,this.modificationCount++)}lookup(e){return!this.validKey(e)||this.splay(e)!=0?null:this.root.key}intersection(t){let n=new e(this.compare,this.validKey);for(let e of this)t.has(e)&&n.add(e);return n}difference(t){let n=new e(this.compare,this.validKey);for(let e of this)t.has(e)||n.add(e);return n}union(e){let t=this.clone();return t.addAll(e),t}clone(){let t=new e(this.compare,this.validKey);return t.size=this.size,t.root=this.copyNode(this.root),t}copyNode(e){if(e==null)return null;function t(e,n){let r,i;do{if(r=e.left,i=e.right,r!=null){let e=new yo(r.key);n.left=e,t(r,e)}if(i!=null){let t=new yo(i.key);n.right=t,e=i,n=t}}while(i!=null)}let n=new yo(e.key);return t(e,n),n}toSet(){return this.clone()}entries(){return new wo(this.wrap())}keys(){return this[Symbol.iterator]()}values(){return this[Symbol.iterator]()}[Symbol.iterator](){return new Co(this.wrap())}[Symbol.toStringTag]=`[object Set]`},So=class{tree;path=[];modificationCount=null;splayCount;constructor(e){this.tree=e,this.splayCount=e.getSplayCount()}[Symbol.iterator](){return this}next(){return this.moveNext()?{done:!1,value:this.current()}:{done:!0,value:null}}current(){if(!this.path.length)return null;let e=this.path[this.path.length-1];return this.getValue(e)}rebuildPath(e){this.path.splice(0,this.path.length),this.tree.splay(e),this.path.push(this.tree.getRoot()),this.splayCount=this.tree.getSplayCount()}findLeftMostDescendent(e){for(;e!=null;)this.path.push(e),e=e.left}moveNext(){if(this.modificationCount!=this.tree.getModificationCount()){if(this.modificationCount==null){this.modificationCount=this.tree.getModificationCount();let e=this.tree.getRoot();for(;e!=null;)this.path.push(e),e=e.left;return this.path.length>0}throw`Concurrent modification during iteration.`}if(!this.path.length)return!1;this.splayCount!=this.tree.getSplayCount()&&this.rebuildPath(this.path[this.path.length-1].key);let e=this.path[this.path.length-1],t=e.right;if(t!=null){for(;t!=null;)this.path.push(t),t=t.left;return!0}for(this.path.pop();this.path.length&&this.path[this.path.length-1].right===e;)e=this.path.pop();return this.path.length>0}},Co=class extends So{getValue(e){return e.key}},wo=class extends So{getValue(e){return[e.key,e.key]}},To=e=>()=>e,Eo=e=>{let t=e?(t,n)=>n.minus(t).abs().isLessThanOrEqualTo(e):To(!1);return(e,n)=>t(e,n)?0:e.comparedTo(n)};function Do(e){let t=e?(t,n,r,i,a)=>t.exponentiatedBy(2).isLessThanOrEqualTo(i.minus(n).exponentiatedBy(2).plus(a.minus(r).exponentiatedBy(2)).times(e)):To(!1);return(e,n,r)=>{let i=e.x,a=e.y,o=r.x,s=r.y,c=a.minus(s).times(n.x.minus(o)).minus(i.minus(o).times(n.y.minus(s)));return t(c,i,a,o,s)?0:c.comparedTo(0)}}var Oo=e=>e,ko=e=>{if(e){let t=new xo(Eo(e)),n=new xo(Eo(e)),r=(e,t)=>t.addAndReturn(e),i=e=>({x:r(e.x,t),y:r(e.y,n)});return i({x:new _o(0),y:new _o(0)}),i}return Oo},Ao=e=>({set:e=>{jo=Ao(e)},reset:()=>Ao(e),compare:Eo(e),snap:ko(e),orient:Do(e)}),jo=Ao(),Mo=(e,t)=>e.ll.x.isLessThanOrEqualTo(t.x)&&t.x.isLessThanOrEqualTo(e.ur.x)&&e.ll.y.isLessThanOrEqualTo(t.y)&&t.y.isLessThanOrEqualTo(e.ur.y),No=(e,t)=>{if(t.ur.x.isLessThan(e.ll.x)||e.ur.x.isLessThan(t.ll.x)||t.ur.y.isLessThan(e.ll.y)||e.ur.y.isLessThan(t.ll.y))return null;let n=e.ll.x.isLessThan(t.ll.x)?t.ll.x:e.ll.x,r=e.ur.x.isLessThan(t.ur.x)?e.ur.x:t.ur.x,i=e.ll.y.isLessThan(t.ll.y)?t.ll.y:e.ll.y,a=e.ur.y.isLessThan(t.ur.y)?e.ur.y:t.ur.y;return{ll:{x:n,y:i},ur:{x:r,y:a}}},Po=(e,t)=>e.x.times(t.y).minus(e.y.times(t.x)),Fo=(e,t)=>e.x.times(t.x).plus(e.y.times(t.y)),Io=e=>Fo(e,e).sqrt(),Lo=(e,t,n)=>{let r={x:t.x.minus(e.x),y:t.y.minus(e.y)},i={x:n.x.minus(e.x),y:n.y.minus(e.y)};return Po(i,r).div(Io(i)).div(Io(r))},Ro=(e,t,n)=>{let r={x:t.x.minus(e.x),y:t.y.minus(e.y)},i={x:n.x.minus(e.x),y:n.y.minus(e.y)};return Fo(i,r).div(Io(i)).div(Io(r))},zo=(e,t,n)=>t.y.isZero()?null:{x:e.x.plus(t.x.div(t.y).times(n.minus(e.y))),y:n},Bo=(e,t,n)=>t.x.isZero()?null:{x:n,y:e.y.plus(t.y.div(t.x).times(n.minus(e.x)))},Vo=(e,t,n,r)=>{if(t.x.isZero())return Bo(n,r,e.x);if(r.x.isZero())return Bo(e,t,n.x);if(t.y.isZero())return zo(n,r,e.y);if(r.y.isZero())return zo(e,t,n.y);let i=Po(t,r);if(i.isZero())return null;let a={x:n.x.minus(e.x),y:n.y.minus(e.y)},o=Po(a,t).div(i),s=Po(a,r).div(i),c=e.x.plus(s.times(t.x)),l=n.x.plus(o.times(r.x)),u=e.y.plus(s.times(t.y)),d=n.y.plus(o.times(r.y));return{x:c.plus(l).div(2),y:u.plus(d).div(2)}},Ho=class e{point;isLeft;segment;otherSE;consumedBy;static compare(t,n){let r=e.comparePoints(t.point,n.point);return r===0?(t.point!==n.point&&t.link(n),t.isLeft===n.isLeft?Xo.compare(t.segment,n.segment):t.isLeft?1:-1):r}static comparePoints(e,t){return e.x.isLessThan(t.x)?-1:e.x.isGreaterThan(t.x)?1:e.y.isLessThan(t.y)?-1:e.y.isGreaterThan(t.y)?1:0}constructor(e,t){e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=t}link(e){if(e.point===this.point)throw Error(`Tried to link already linked events`);let t=e.point.events;for(let e=0,n=t.length;e<n;e++){let n=t[e];this.point.events.push(n),n.point=this.point}this.checkForConsuming()}checkForConsuming(){let e=this.point.events.length;for(let t=0;t<e;t++){let n=this.point.events[t];if(n.segment.consumedBy===void 0)for(let r=t+1;r<e;r++){let e=this.point.events[r];e.consumedBy===void 0&&n.otherSE.point.events===e.otherSE.point.events&&n.segment.consume(e.segment)}}}getAvailableLinkedEvents(){let e=[];for(let t=0,n=this.point.events.length;t<n;t++){let n=this.point.events[t];n!==this&&!n.segment.ringOut&&n.segment.isInResult()&&e.push(n)}return e}getLeftmostComparator(e){let t=new Map,n=n=>{let r=n.otherSE;t.set(n,{sine:Lo(this.point,e.point,r.point),cosine:Ro(this.point,e.point,r.point)})};return(e,r)=>{t.has(e)||n(e),t.has(r)||n(r);let{sine:i,cosine:a}=t.get(e),{sine:o,cosine:s}=t.get(r);return i.isGreaterThanOrEqualTo(0)&&o.isGreaterThanOrEqualTo(0)?a.isLessThan(s)?1:a.isGreaterThan(s)?-1:0:i.isLessThan(0)&&o.isLessThan(0)?a.isLessThan(s)?-1:a.isGreaterThan(s)?1:0:o.isLessThan(i)?-1:o.isGreaterThan(i)?1:0}}},Uo=class e{events;poly;_isExteriorRing;_enclosingRing;static factory(t){let n=[];for(let r=0,i=t.length;r<i;r++){let i=t[r];if(!i.isInResult()||i.ringOut)continue;let a=null,o=i.leftSE,s=i.rightSE,c=[o],l=o.point,u=[];for(;a=o,o=s,c.push(o),o.point!==l;)for(;;){let t=o.getAvailableLinkedEvents();if(t.length===0){let e=c[0].point,t=c[c.length-1].point;throw Error(`Unable to complete output ring starting at [${e.x}, ${e.y}]. Last matching segment found ends at [${t.x}, ${t.y}].`)}if(t.length===1){s=t[0].otherSE;break}let r=null;for(let e=0,t=u.length;e<t;e++)if(u[e].point===o.point){r=e;break}if(r!==null){let t=u.splice(r)[0],i=c.splice(t.index);i.unshift(i[0].otherSE),n.push(new e(i.reverse()));continue}u.push({index:c.length,point:o.point});let i=o.getLeftmostComparator(a);s=t.sort(i)[0].otherSE;break}n.push(new e(c))}return n}constructor(e){this.events=e;for(let t=0,n=e.length;t<n;t++)e[t].segment.ringOut=this;this.poly=null}getGeom(){let e=this.events[0].point,t=[e];for(let n=1,r=this.events.length-1;n<r;n++){let r=this.events[n].point,i=this.events[n+1].point;jo.orient(r,e,i)!==0&&(t.push(r),e=r)}if(t.length===1)return null;let n=t[0],r=t[1];jo.orient(n,e,r)===0&&t.shift(),t.push(t[0]);let i=this.isExteriorRing()?1:-1,a=this.isExteriorRing()?0:t.length-1,o=this.isExteriorRing()?t.length:-1,s=[];for(let e=a;e!=o;e+=i)s.push([t[e].x.toNumber(),t[e].y.toNumber()]);return s}isExteriorRing(){if(this._isExteriorRing===void 0){let e=this.enclosingRing();this._isExteriorRing=e?!e.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let e=this.events[0];for(let t=1,n=this.events.length;t<n;t++){let n=this.events[t];Ho.compare(e,n)>0&&(e=n)}let t=e.segment.prevInResult(),n=t?t.prevInResult():null;for(;;){if(!t)return null;if(!n)return t.ringOut;if(n.ringOut!==t.ringOut)return n.ringOut?.enclosingRing()===t.ringOut?t.ringOut?.enclosingRing():t.ringOut;t=n.prevInResult(),n=t?t.prevInResult():null}}},Wo=class{exteriorRing;interiorRings;constructor(e){this.exteriorRing=e,e.poly=this,this.interiorRings=[]}addInterior(e){this.interiorRings.push(e),e.poly=this}getGeom(){let e=this.exteriorRing.getGeom();if(e===null)return null;let t=[e];for(let e=0,n=this.interiorRings.length;e<n;e++){let n=this.interiorRings[e].getGeom();n!==null&&t.push(n)}return t}},Go=class{rings;polys;constructor(e){this.rings=e,this.polys=this._composePolys(e)}getGeom(){let e=[];for(let t=0,n=this.polys.length;t<n;t++){let n=this.polys[t].getGeom();n!==null&&e.push(n)}return e}_composePolys(e){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];if(!r.poly)if(r.isExteriorRing())t.push(new Wo(r));else{let e=r.enclosingRing();e?.poly||t.push(new Wo(e)),e?.poly?.addInterior(r)}}return t}},Ko=class{queue;tree;segments;constructor(e,t=Xo.compare){this.queue=e,this.tree=new xo(t),this.segments=[]}process(e){let t=e.segment,n=[];if(e.consumedBy)return e.isLeft?this.queue.delete(e.otherSE):this.tree.delete(t),n;e.isLeft&&this.tree.add(t);let r=t,i=t;do r=this.tree.lastBefore(r);while(r!=null&&r.consumedBy!=null);do i=this.tree.firstAfter(i);while(i!=null&&i.consumedBy!=null);if(e.isLeft){let a=null;if(r){let e=r.getIntersection(t);if(e!==null&&(t.isAnEndpoint(e)||(a=e),!r.isAnEndpoint(e))){let t=this._splitSafely(r,e);for(let e=0,r=t.length;e<r;e++)n.push(t[e])}}let o=null;if(i){let e=i.getIntersection(t);if(e!==null&&(t.isAnEndpoint(e)||(o=e),!i.isAnEndpoint(e))){let t=this._splitSafely(i,e);for(let e=0,r=t.length;e<r;e++)n.push(t[e])}}if(a!==null||o!==null){let e=null;e=a===null?o:o===null||Ho.comparePoints(a,o)<=0?a:o,this.queue.delete(t.rightSE),n.push(t.rightSE);let r=t.split(e);for(let e=0,t=r.length;e<t;e++)n.push(r[e])}n.length>0?(this.tree.delete(t),n.push(e)):(this.segments.push(t),t.prev=r)}else{if(r&&i){let e=r.getIntersection(i);if(e!==null){if(!r.isAnEndpoint(e)){let t=this._splitSafely(r,e);for(let e=0,r=t.length;e<r;e++)n.push(t[e])}if(!i.isAnEndpoint(e)){let t=this._splitSafely(i,e);for(let e=0,r=t.length;e<r;e++)n.push(t[e])}}}this.tree.delete(t)}return n}_splitSafely(e,t){this.tree.delete(e);let n=e.rightSE;this.queue.delete(n);let r=e.split(t);return r.push(n),e.consumedBy===void 0&&this.tree.add(e),r}},qo=new class{type;numMultiPolys;run(e,t,n){qo.type=e;let r=[new $o(t,!0)];for(let e=0,t=n.length;e<t;e++)r.push(new $o(n[e],!1));if(qo.numMultiPolys=r.length,qo.type===`difference`){let e=r[0],t=1;for(;t<r.length;)No(r[t].bbox,e.bbox)===null?r.splice(t,1):t++}if(qo.type===`intersection`)for(let e=0,t=r.length;e<t;e++){let t=r[e];for(let n=e+1,i=r.length;n<i;n++)if(No(t.bbox,r[n].bbox)===null)return[]}let i=new xo(Ho.compare);for(let e=0,t=r.length;e<t;e++){let t=r[e].getSweepEvents();for(let e=0,n=t.length;e<n;e++)i.add(t[e])}let a=new Ko(i),o=null;for(i.size!=0&&(o=i.first(),i.delete(o));o;){let e=a.process(o);for(let t=0,n=e.length;t<n;t++){let n=e[t];n.consumedBy===void 0&&i.add(n)}i.size==0?o=null:(o=i.first(),i.delete(o))}return jo.reset(),new Go(Uo.factory(a.segments)).getGeom()}},Jo=qo,Yo=0,Xo=class e{id;leftSE;rightSE;rings;windings;ringOut;consumedBy;prev;_prevInResult;_beforeState;_afterState;_isInResult;static compare(e,t){let n=e.leftSE.point.x,r=t.leftSE.point.x,i=e.rightSE.point.x,a=t.rightSE.point.x;if(a.isLessThan(n))return 1;if(i.isLessThan(r))return-1;let o=e.leftSE.point.y,s=t.leftSE.point.y,c=e.rightSE.point.y,l=t.rightSE.point.y;if(n.isLessThan(r)){if(s.isLessThan(o)&&s.isLessThan(c))return 1;if(s.isGreaterThan(o)&&s.isGreaterThan(c))return-1;let n=e.comparePoint(t.leftSE.point);if(n<0)return 1;if(n>0)return-1;let r=t.comparePoint(e.rightSE.point);return r===0?-1:r}if(n.isGreaterThan(r)){if(o.isLessThan(s)&&o.isLessThan(l))return-1;if(o.isGreaterThan(s)&&o.isGreaterThan(l))return 1;let n=t.comparePoint(e.leftSE.point);if(n!==0)return n;let r=e.comparePoint(t.rightSE.point);return r<0?1:r>0?-1:1}if(o.isLessThan(s))return-1;if(o.isGreaterThan(s))return 1;if(i.isLessThan(a)){let n=t.comparePoint(e.rightSE.point);if(n!==0)return n}if(i.isGreaterThan(a)){let n=e.comparePoint(t.rightSE.point);if(n<0)return 1;if(n>0)return-1}if(!i.eq(a)){let e=c.minus(o),t=i.minus(n),u=l.minus(s),d=a.minus(r);if(e.isGreaterThan(t)&&u.isLessThan(d))return 1;if(e.isLessThan(t)&&u.isGreaterThan(d))return-1}return i.isGreaterThan(a)?1:i.isLessThan(a)||c.isLessThan(l)?-1:c.isGreaterThan(l)?1:e.id<t.id?-1:e.id>t.id?1:0}constructor(e,t,n,r){this.id=++Yo,this.leftSE=e,e.segment=this,e.otherSE=t,this.rightSE=t,t.segment=this,t.otherSE=e,this.rings=n,this.windings=r}static fromRing(t,n,r){let i,a,o,s=Ho.comparePoints(t,n);if(s<0)i=t,a=n,o=1;else if(s>0)i=n,a=t,o=-1;else throw Error(`Tried to create degenerate segment at [${t.x}, ${t.y}]`);return new e(new Ho(i,!0),new Ho(a,!1),[r],[o])}replaceRightSE(e){this.rightSE=e,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){let e=this.leftSE.point.y,t=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:e.isLessThan(t)?e:t},ur:{x:this.rightSE.point.x,y:e.isGreaterThan(t)?e:t}}}vector(){return{x:this.rightSE.point.x.minus(this.leftSE.point.x),y:this.rightSE.point.y.minus(this.leftSE.point.y)}}isAnEndpoint(e){return e.x.eq(this.leftSE.point.x)&&e.y.eq(this.leftSE.point.y)||e.x.eq(this.rightSE.point.x)&&e.y.eq(this.rightSE.point.y)}comparePoint(e){return jo.orient(this.leftSE.point,e,this.rightSE.point)}getIntersection(e){let t=this.bbox(),n=e.bbox(),r=No(t,n);if(r===null)return null;let i=this.leftSE.point,a=this.rightSE.point,o=e.leftSE.point,s=e.rightSE.point,c=Mo(t,o)&&this.comparePoint(o)===0,l=Mo(n,i)&&e.comparePoint(i)===0,u=Mo(t,s)&&this.comparePoint(s)===0,d=Mo(n,a)&&e.comparePoint(a)===0;if(l&&c)return d&&!u?a:!d&&u?s:null;if(l)return u&&i.x.eq(s.x)&&i.y.eq(s.y)?null:i;if(c)return d&&a.x.eq(o.x)&&a.y.eq(o.y)?null:o;if(d&&u)return null;if(d)return a;if(u)return s;let f=Vo(i,this.vector(),o,e.vector());return f===null||!Mo(r,f)?null:jo.snap(f)}split(t){let n=[],r=t.events!==void 0,i=new Ho(t,!0),a=new Ho(t,!1),o=this.rightSE;this.replaceRightSE(a),n.push(a),n.push(i);let s=new e(i,o,this.rings.slice(),this.windings.slice());return Ho.comparePoints(s.leftSE.point,s.rightSE.point)>0&&s.swapEvents(),Ho.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),r&&(i.checkForConsuming(),a.checkForConsuming()),n}swapEvents(){let e=this.rightSE;this.rightSE=this.leftSE,this.leftSE=e,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let e=0,t=this.windings.length;e<t;e++)this.windings[e]*=-1}consume(t){let n=this,r=t;for(;n.consumedBy;)n=n.consumedBy;for(;r.consumedBy;)r=r.consumedBy;let i=e.compare(n,r);if(i!==0){if(i>0){let e=n;n=r,r=e}if(n.prev===r){let e=n;n=r,r=e}for(let e=0,t=r.rings.length;e<t;e++){let t=r.rings[e],i=r.windings[e],a=n.rings.indexOf(t);a===-1?(n.rings.push(t),n.windings.push(i)):n.windings[a]+=i}r.rings=null,r.windings=null,r.consumedBy=n,r.leftSE.consumedBy=n.leftSE,r.rightSE.consumedBy=n.rightSE}}prevInResult(){return this._prevInResult===void 0&&(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null),this._prevInResult}beforeState(){return this._beforeState===void 0&&(this.prev?this._beforeState=(this.prev.consumedBy||this.prev).afterState():this._beforeState={rings:[],windings:[],multiPolys:[]}),this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;let e=this.beforeState();this._afterState={rings:e.rings.slice(0),windings:e.windings.slice(0),multiPolys:[]};let t=this._afterState.rings,n=this._afterState.windings,r=this._afterState.multiPolys;for(let e=0,r=this.rings.length;e<r;e++){let r=this.rings[e],i=this.windings[e],a=t.indexOf(r);a===-1?(t.push(r),n.push(i)):n[a]+=i}let i=[],a=[];for(let e=0,r=t.length;e<r;e++){if(n[e]===0)continue;let r=t[e],o=r.poly;if(a.indexOf(o)===-1)if(r.isExterior)i.push(o);else{a.indexOf(o)===-1&&a.push(o);let e=i.indexOf(r.poly);e!==-1&&i.splice(e,1)}}for(let e=0,t=i.length;e<t;e++){let t=i[e].multiPoly;r.indexOf(t)===-1&&r.push(t)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;let e=this.beforeState().multiPolys,t=this.afterState().multiPolys;switch(Jo.type){case`union`:this._isInResult=e.length===0!=(t.length===0);break;case`intersection`:{let n,r;e.length<t.length?(n=e.length,r=t.length):(n=t.length,r=e.length),this._isInResult=r===Jo.numMultiPolys&&n<r;break}case`xor`:this._isInResult=Math.abs(e.length-t.length)%2==1;break;case`difference`:{let n=e=>e.length===1&&e[0].isSubject;this._isInResult=n(e)!==n(t);break}}return this._isInResult}},Zo=class{poly;isExterior;segments;bbox;constructor(e,t,n){if(!Array.isArray(e)||e.length===0||(this.poly=t,this.isExterior=n,this.segments=[],typeof e[0][0]!=`number`||typeof e[0][1]!=`number`))throw Error(`Input geometry is not a valid Polygon or MultiPolygon`);let r=jo.snap({x:new _o(e[0][0]),y:new _o(e[0][1])});this.bbox={ll:{x:r.x,y:r.y},ur:{x:r.x,y:r.y}};let i=r;for(let t=1,n=e.length;t<n;t++){if(typeof e[t][0]!=`number`||typeof e[t][1]!=`number`)throw Error(`Input geometry is not a valid Polygon or MultiPolygon`);let n=jo.snap({x:new _o(e[t][0]),y:new _o(e[t][1])});n.x.eq(i.x)&&n.y.eq(i.y)||(this.segments.push(Xo.fromRing(i,n,this)),n.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=n.x),n.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=n.y),n.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=n.x),n.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=n.y),i=n)}(!r.x.eq(i.x)||!r.y.eq(i.y))&&this.segments.push(Xo.fromRing(i,r,this))}getSweepEvents(){let e=[];for(let t=0,n=this.segments.length;t<n;t++){let n=this.segments[t];e.push(n.leftSE),e.push(n.rightSE)}return e}},Qo=class{multiPoly;exteriorRing;interiorRings;bbox;constructor(e,t){if(!Array.isArray(e))throw Error(`Input geometry is not a valid Polygon or MultiPolygon`);this.exteriorRing=new Zo(e[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(let t=1,n=e.length;t<n;t++){let n=new Zo(e[t],this,!1);n.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=n.bbox.ll.x),n.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=n.bbox.ll.y),n.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=n.bbox.ur.x),n.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=n.bbox.ur.y),this.interiorRings.push(n)}this.multiPoly=t}getSweepEvents(){let e=this.exteriorRing.getSweepEvents();for(let t=0,n=this.interiorRings.length;t<n;t++){let n=this.interiorRings[t].getSweepEvents();for(let t=0,r=n.length;t<r;t++)e.push(n[t])}return e}},$o=class{isSubject;polys;bbox;constructor(e,t){if(!Array.isArray(e))throw Error(`Input geometry is not a valid Polygon or MultiPolygon`);try{typeof e[0][0][0]==`number`&&(e=[e])}catch{}this.polys=[],this.bbox={ll:{x:new _o(1/0),y:new _o(1/0)},ur:{x:new _o(-1/0),y:new _o(-1/0)}};for(let t=0,n=e.length;t<n;t++){let n=new Qo(e[t],this);n.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=n.bbox.ll.x),n.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=n.bbox.ll.y),n.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=n.bbox.ur.x),n.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=n.bbox.ur.y),this.polys.push(n)}this.isSubject=t}getSweepEvents(){let e=[];for(let t=0,n=this.polys.length;t<n;t++){let n=this.polys[t].getSweepEvents();for(let t=0,r=n.length;t<r;t++)e.push(n[t])}return e}},es=(e,...t)=>Jo.run(`intersection`,e,t);jo.set;function ts(e,t={}){let n=[];if(ii(e,e=>{n.push(e.coordinates)}),n.length<2)throw Error(`Must specify at least 2 geometries`);let r=es(n[0],...n.slice(1));return r.length===0?null:r.length===1?Qr(r[0],t.properties):ni(r,t.properties)}var J=1e-6,Y=Math.PI,ns=Y/2,rs=Y/4,is=Y*2,as=180/Y,X=Y/180,Z=Math.abs,os=Math.atan,ss=Math.atan2,Q=Math.cos,cs=Math.ceil,ls=Math.exp,us=Math.log,$=Math.sin,ds=Math.sign||function(e){return e>0?1:e<0?-1:0},fs=Math.sqrt,ps=Math.tan;function ms(e){return e>1?0:e<-1?Y:Math.acos(e)}function hs(e){return e>1?ns:e<-1?-ns:Math.asin(e)}function gs(){}function _s(e,t){e&&ys.hasOwnProperty(e.type)&&ys[e.type](e,t)}var vs={Feature:function(e,t){_s(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r<i;)_s(n[r].geometry,t)}},ys={Sphere:function(e,t){t.sphere()},Point:function(e,t){e=e.coordinates,t.point(e[0],e[1],e[2])},MultiPoint:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)e=n[r],t.point(e[0],e[1],e[2])},LineString:function(e,t){bs(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)bs(n[r],t,0)},Polygon:function(e,t){xs(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)xs(n[r],t)},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,i=n.length;++r<i;)_s(n[r],t)}};function bs(e,t,n){var r=-1,i=e.length-n,a;for(t.lineStart();++r<i;)a=e[r],t.point(a[0],a[1],a[2]);t.lineEnd()}function xs(e,t){var n=-1,r=e.length;for(t.polygonStart();++n<r;)bs(e[n],t,1);t.polygonEnd()}function Ss(e,t){e&&vs.hasOwnProperty(e.type)?vs[e.type](e,t):_s(e,t)}function Cs(e){return[ss(e[1],e[0]),hs(e[2])]}function ws(e){var t=e[0],n=e[1],r=Q(n);return[r*Q(t),r*$(t),$(n)]}function Ts(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Es(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function Ds(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function Os(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function ks(e){var t=fs(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}function As(e,t){function n(n,r){return n=e(n,r),t(n[0],n[1])}return e.invert&&t.invert&&(n.invert=function(n,r){return n=t.invert(n,r),n&&e.invert(n[0],n[1])}),n}function js(e,t){return Z(e)>Y&&(e-=Math.round(e/is)*is),[e,t]}js.invert=js;function Ms(e,t,n){return(e%=is)?t||n?As(Ps(e),Fs(t,n)):Ps(e):t||n?Fs(t,n):js}function Ns(e){return function(t,n){return t+=e,Z(t)>Y&&(t-=Math.round(t/is)*is),[t,n]}}function Ps(e){var t=Ns(e);return t.invert=Ns(-e),t}function Fs(e,t){var n=Q(e),r=$(e),i=Q(t),a=$(t);function o(e,t){var o=Q(t),s=Q(e)*o,c=$(e)*o,l=$(t),u=l*n+s*r;return[ss(c*i-u*a,s*n-l*r),hs(u*i+c*a)]}return o.invert=function(e,t){var o=Q(t),s=Q(e)*o,c=$(e)*o,l=$(t),u=l*i-c*a;return[ss(c*i+l*a,s*n+u*r),hs(u*n-s*r)]},o}function Is(e){e=Ms(e[0]*X,e[1]*X,e.length>2?e[2]*X:0);function t(t){return t=e(t[0]*X,t[1]*X),t[0]*=as,t[1]*=as,t}return t.invert=function(t){return t=e.invert(t[0]*X,t[1]*X),t[0]*=as,t[1]*=as,t},t}function Ls(e,t,n,r,i,a){if(n){var o=Q(t),s=$(t),c=r*n;i==null?(i=t+r*is,a=t-c/2):(i=Rs(o,i),a=Rs(o,a),(r>0?i<a:i>a)&&(i+=r*is));for(var l,u=i;r>0?u>a:u<a;u-=c)l=Cs([o,-s*Q(u),-s*$(u)]),e.point(l[0],l[1])}}function Rs(e,t){t=ws(t),t[0]-=e,ks(t);var n=ms(-t[1]);return((-t[2]<0?-n:n)+is-J)%is}function zs(){var e=[],t;return{point:function(e,n,r){t.push([e,n,r])},lineStart:function(){e.push(t=[])},lineEnd:gs,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function Bs(e,t){return Z(e[0]-t[0])<1e-6&&Z(e[1]-t[1])<1e-6}function Vs(e,t,n,r){this.x=e,this.z=t,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function Hs(e,t,n,r,i){var a=[],o=[],s,c;if(e.forEach(function(e){if(!((t=e.length-1)<=0)){var t,n=e[0],r=e[t],c;if(Bs(n,r)){if(!n[2]&&!r[2]){for(i.lineStart(),s=0;s<t;++s)i.point((n=e[s])[0],n[1]);i.lineEnd();return}r[0]+=2*J}a.push(c=new Vs(n,e,null,!0)),o.push(c.o=new Vs(n,null,c,!1)),a.push(c=new Vs(r,e,null,!1)),o.push(c.o=new Vs(r,null,c,!0))}}),a.length){for(o.sort(t),Us(a),Us(o),s=0,c=o.length;s<c;++s)o[s].e=n=!n;for(var l=a[0],u,d;;){for(var f=l,p=!0;f.v;)if((f=f.n)===l)return;u=f.z,i.lineStart();do{if(f.v=f.o.v=!0,f.e){if(p)for(s=0,c=u.length;s<c;++s)i.point((d=u[s])[0],d[1]);else r(f.x,f.n.x,1,i);f=f.n}else{if(p)for(u=f.p.z,s=u.length-1;s>=0;--s)i.point((d=u[s])[0],d[1]);else r(f.x,f.p.x,-1,i);f=f.p}f=f.o,u=f.z,p=!p}while(!f.v);i.lineEnd()}}}function Us(e){if(t=e.length){for(var t,n=0,r=e[0],i;++n<t;)r.n=i=e[n],i.p=r,r=i;r.n=i=e[0],i.p=r}}function Ws(e){return Z(e[0])<=Y?e[0]:ds(e[0])*((Z(e[0])+Y)%is-Y)}function Gs(e,t){var n=Ws(t),r=t[1],i=$(r),a=[$(n),-Q(n),0],o=0,s=0,c=new mt;i===1?r=ns+J:i===-1&&(r=-ns-J);for(var l=0,u=e.length;l<u;++l)if(f=(d=e[l]).length)for(var d,f,p=d[f-1],m=Ws(p),h=p[1]/2+rs,g=$(h),_=Q(h),v=0;v<f;++v,m=b,g=S,_=C,p=y){var y=d[v],b=Ws(y),x=y[1]/2+rs,S=$(x),C=Q(x),w=b-m,T=w>=0?1:-1,E=T*w,D=E>Y,O=g*S;if(c.add(ss(O*T*$(E),_*C+O*Q(E))),o+=D?w+T*is:w,D^m>=n^b>=n){var k=Es(ws(p),ws(y));ks(k);var A=Es(a,k);ks(A);var j=(D^w>=0?-1:1)*hs(A[2]);(r>j||r===j&&(k[0]||k[1]))&&(s+=D^w>=0?1:-1)}}return(o<-1e-6||o<1e-6&&c<-1e-12)^s&1}function Ks(e,t,n,r){return function(i){var a=t(i),o=zs(),s=t(o),c=!1,l,u,d,f={point:p,lineStart:h,lineEnd:g,polygonStart:function(){f.point=_,f.lineStart=v,f.lineEnd=y,u=[],l=[]},polygonEnd:function(){f.point=p,f.lineStart=h,f.lineEnd=g,u=kt(u);var e=Gs(l,r);u.length?(c||=(i.polygonStart(),!0),Hs(u,Js,e,n,i)):e&&(c||=(i.polygonStart(),!0),i.lineStart(),n(null,null,1,i),i.lineEnd()),c&&=(i.polygonEnd(),!1),u=l=null},sphere:function(){i.polygonStart(),i.lineStart(),n(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function p(t,n){e(t,n)&&i.point(t,n)}function m(e,t){a.point(e,t)}function h(){f.point=m,a.lineStart()}function g(){f.point=p,a.lineEnd()}function _(e,t){d.push([e,t]),s.point(e,t)}function v(){s.lineStart(),d=[]}function y(){_(d[0][0],d[0][1]),s.lineEnd();var e=s.clean(),t=o.result(),n,r=t.length,a,f,p;if(d.pop(),l.push(d),d=null,r){if(e&1){if(f=t[0],(a=f.length-1)>0){for(c||=(i.polygonStart(),!0),i.lineStart(),n=0;n<a;++n)i.point((p=f[n])[0],p[1]);i.lineEnd()}return}r>1&&e&2&&t.push(t.pop().concat(t.shift())),u.push(t.filter(qs))}}return f}}function qs(e){return e.length>1}function Js(e,t){return((e=e.x)[0]<0?e[1]-ns-J:ns-e[1])-((t=t.x)[0]<0?t[1]-ns-J:ns-t[1])}var Ys=Ks(function(){return!0},Xs,Qs,[-Y,-ns]);function Xs(e){var t=NaN,n=NaN,r=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(a,o){var s=a>0?Y:-Y,c=Z(a-t);Z(c-Y)<1e-6?(e.point(t,n=(n+o)/2>0?ns:-ns),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(s,n),e.point(a,n),i=0):r!==s&&c>=Y&&(Z(t-r)<1e-6&&(t-=r*J),Z(a-s)<1e-6&&(a-=s*J),n=Zs(t,n,a,o),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(s,n),i=0),e.point(t=a,n=o),r=s},lineEnd:function(){e.lineEnd(),t=n=NaN},clean:function(){return 2-i}}}function Zs(e,t,n,r){var i,a,o=$(e-n);return Z(o)>1e-6?os(($(t)*(a=Q(r))*$(n)-$(r)*(i=Q(t))*$(e))/(i*a*o)):(t+r)/2}function Qs(e,t,n,r){var i;if(e==null)i=n*ns,r.point(-Y,i),r.point(0,i),r.point(Y,i),r.point(Y,0),r.point(Y,-i),r.point(0,-i),r.point(-Y,-i),r.point(-Y,0),r.point(-Y,i);else if(Z(e[0]-t[0])>1e-6){var a=e[0]<t[0]?Y:-Y;i=n*a/2,r.point(-a,i),r.point(0,i),r.point(a,i)}else r.point(t[0],t[1])}function $s(e){var t=Q(e),n=2*X,r=t>0,i=Z(t)>J;function a(t,r,i,a){Ls(a,e,n,i,t,r)}function o(e,n){return Q(e)*Q(n)>t}function s(e){var t,n,a,s,u;return{lineStart:function(){s=a=!1,u=1},point:function(d,f){var p=[d,f],m,h=o(d,f),g=r?h?0:l(d,f):h?l(d+(d<0?Y:-Y),f):0;if(!t&&(s=a=h)&&e.lineStart(),h!==a&&(m=c(t,p),(!m||Bs(t,m)||Bs(p,m))&&(p[2]=1)),h!==a)u=0,h?(e.lineStart(),m=c(p,t),e.point(m[0],m[1])):(m=c(t,p),e.point(m[0],m[1],2),e.lineEnd()),t=m;else if(i&&t&&r^h){var _;!(g&n)&&(_=c(p,t,!0))&&(u=0,r?(e.lineStart(),e.point(_[0][0],_[0][1]),e.point(_[1][0],_[1][1]),e.lineEnd()):(e.point(_[1][0],_[1][1]),e.lineEnd(),e.lineStart(),e.point(_[0][0],_[0][1],3)))}h&&(!t||!Bs(t,p))&&e.point(p[0],p[1]),t=p,a=h,n=g},lineEnd:function(){a&&e.lineEnd(),t=null},clean:function(){return u|(s&&a)<<1}}}function c(e,n,r){var i=ws(e),a=ws(n),o=[1,0,0],s=Es(i,a),c=Ts(s,s),l=s[0],u=c-l*l;if(!u)return!r&&e;var d=t*c/u,f=-t*l/u,p=Es(o,s),m=Os(o,d);Ds(m,Os(s,f));var h=p,g=Ts(m,h),_=Ts(h,h),v=g*g-_*(Ts(m,m)-1);if(!(v<0)){var y=fs(v),b=Os(h,(-g-y)/_);if(Ds(b,m),b=Cs(b),!r)return b;var x=e[0],S=n[0],C=e[1],w=n[1],T;S<x&&(T=x,x=S,S=T);var E=S-x,D=Z(E-Y)<J,O=D||E<1e-6;if(!D&&w<C&&(T=C,C=w,w=T),O?D?C+w>0^b[1]<(Z(b[0]-x)<1e-6?C:w):C<=b[1]&&b[1]<=w:E>Y^(x<=b[0]&&b[0]<=S)){var k=Os(h,(-g+y)/_);return Ds(k,m),[b,Cs(k)]}}}function l(t,n){var i=r?e:Y-e,a=0;return t<-i?a|=1:t>i&&(a|=2),n<-i?a|=4:n>i&&(a|=8),a}return Ks(o,s,a,r?[0,-e]:[-Y,e-Y])}function ec(e,t,n,r,i,a){var o=e[0],s=e[1],c=t[0],l=t[1],u=0,d=1,f=c-o,p=l-s,m=n-o;if(!(!f&&m>0)){if(m/=f,f<0){if(m<u)return;m<d&&(d=m)}else if(f>0){if(m>d)return;m>u&&(u=m)}if(m=i-o,!(!f&&m<0)){if(m/=f,f<0){if(m>d)return;m>u&&(u=m)}else if(f>0){if(m<u)return;m<d&&(d=m)}if(m=r-s,!(!p&&m>0)){if(m/=p,p<0){if(m<u)return;m<d&&(d=m)}else if(p>0){if(m>d)return;m>u&&(u=m)}if(m=a-s,!(!p&&m<0)){if(m/=p,p<0){if(m>d)return;m>u&&(u=m)}else if(p>0){if(m<u)return;m<d&&(d=m)}return u>0&&(e[0]=o+u*f,e[1]=s+u*p),d<1&&(t[0]=o+d*f,t[1]=s+d*p),!0}}}}}var tc=1e9,nc=-tc;function rc(e,t,n,r){function i(i,a){return e<=i&&i<=n&&t<=a&&a<=r}function a(i,a,s,l){var u=0,d=0;if(i==null||(u=o(i,s))!==(d=o(a,s))||c(i,a)<0^s>0)do l.point(u===0||u===3?e:n,u>1?r:t);while((u=(u+s+4)%4)!==d);else l.point(a[0],a[1])}function o(r,i){return Z(r[0]-e)<1e-6?i>0?0:3:Z(r[0]-n)<1e-6?i>0?2:1:Z(r[1]-t)<1e-6?i>0?1:0:i>0?3:2}function s(e,t){return c(e.x,t.x)}function c(e,t){var n=o(e,1),r=o(t,1);return n===r?n===0?t[1]-e[1]:n===1?e[0]-t[0]:n===2?e[1]-t[1]:t[0]-e[0]:n-r}return function(o){var c=o,l=zs(),u,d,f,p,m,h,g,_,v,y,b,x={point:S,lineStart:E,lineEnd:D,polygonStart:w,polygonEnd:T};function S(e,t){i(e,t)&&c.point(e,t)}function C(){for(var t=0,n=0,i=d.length;n<i;++n)for(var a=d[n],o=1,s=a.length,c=a[0],l,u,f=c[0],p=c[1];o<s;++o)l=f,u=p,c=a[o],f=c[0],p=c[1],u<=r?p>r&&(f-l)*(r-u)>(p-u)*(e-l)&&++t:p<=r&&(f-l)*(r-u)<(p-u)*(e-l)&&--t;return t}function w(){c=l,u=[],d=[],b=!0}function T(){var e=C(),t=b&&e,n=(u=kt(u)).length;(t||n)&&(o.polygonStart(),t&&(o.lineStart(),a(null,null,1,o),o.lineEnd()),n&&Hs(u,s,e,a,o),o.polygonEnd()),c=o,u=d=f=null}function E(){x.point=O,d&&d.push(f=[]),y=!0,v=!1,g=_=NaN}function D(){u&&(O(p,m),h&&v&&l.rejoin(),u.push(l.result())),x.point=S,v&&c.lineEnd()}function O(a,o){var s=i(a,o);if(d&&f.push([a,o]),y)p=a,m=o,h=s,y=!1,s&&(c.lineStart(),c.point(a,o));else if(s&&v)c.point(a,o);else{var l=[g=Math.max(nc,Math.min(tc,g)),_=Math.max(nc,Math.min(tc,_))],u=[a=Math.max(nc,Math.min(tc,a)),o=Math.max(nc,Math.min(tc,o))];ec(l,u,e,t,n,r)?(v||(c.lineStart(),c.point(l[0],l[1])),c.point(u[0],u[1]),s||c.lineEnd(),b=!1):s&&(c.lineStart(),c.point(a,o),b=!1)}g=a,_=o,v=s}return x}}function ic(e,t,n){var r=At(e,t-J,n).concat(t);return function(e){return r.map(function(t){return[e,t]})}}function ac(e,t,n){var r=At(e,t-J,n).concat(t);return function(e){return r.map(function(t){return[t,e]})}}function oc(){var e,t,n,r,i,a,o,s,c=10,l=c,u=90,d=360,f,p,m,h,g=2.5;function _(){return{type:`MultiLineString`,coordinates:v()}}function v(){return At(cs(r/u)*u,n,u).map(m).concat(At(cs(s/d)*d,o,d).map(h)).concat(At(cs(t/c)*c,e,c).filter(function(e){return Z(e%u)>J}).map(f)).concat(At(cs(a/l)*l,i,l).filter(function(e){return Z(e%d)>J}).map(p))}return _.lines=function(){return v().map(function(e){return{type:`LineString`,coordinates:e}})},_.outline=function(){return{type:`Polygon`,coordinates:[m(r).concat(h(o).slice(1),m(n).reverse().slice(1),h(s).reverse().slice(1))]}},_.extent=function(e){return arguments.length?_.extentMajor(e).extentMinor(e):_.extentMinor()},_.extentMajor=function(e){return arguments.length?(r=+e[0][0],n=+e[1][0],s=+e[0][1],o=+e[1][1],r>n&&(e=r,r=n,n=e),s>o&&(e=s,s=o,o=e),_.precision(g)):[[r,s],[n,o]]},_.extentMinor=function(n){return arguments.length?(t=+n[0][0],e=+n[1][0],a=+n[0][1],i=+n[1][1],t>e&&(n=t,t=e,e=n),a>i&&(n=a,a=i,i=n),_.precision(g)):[[t,a],[e,i]]},_.step=function(e){return arguments.length?_.stepMajor(e).stepMinor(e):_.stepMinor()},_.stepMajor=function(e){return arguments.length?(u=+e[0],d=+e[1],_):[u,d]},_.stepMinor=function(e){return arguments.length?(c=+e[0],l=+e[1],_):[c,l]},_.precision=function(c){return arguments.length?(g=+c,f=ic(a,i,90),p=ac(t,e,g),m=ic(s,o,90),h=ac(r,n,g),_):g},_.extentMajor([[-180,-90+J],[180,90-J]]).extentMinor([[-180,-80-J],[180,80+J]])}var sc=e=>e,cc=new mt,lc=new mt,uc,dc,fc,pc,mc={point:gs,lineStart:gs,lineEnd:gs,polygonStart:function(){mc.lineStart=hc,mc.lineEnd=vc},polygonEnd:function(){mc.lineStart=mc.lineEnd=mc.point=gs,cc.add(Z(lc)),lc=new mt},result:function(){var e=cc/2;return cc=new mt,e}};function hc(){mc.point=gc}function gc(e,t){mc.point=_c,uc=fc=e,dc=pc=t}function _c(e,t){lc.add(pc*e-fc*t),fc=e,pc=t}function vc(){_c(uc,dc)}var yc=1/0,bc=yc,xc=-yc,Sc=xc,Cc={point:wc,lineStart:gs,lineEnd:gs,polygonStart:gs,polygonEnd:gs,result:function(){var e=[[yc,bc],[xc,Sc]];return xc=Sc=-(bc=yc=1/0),e}};function wc(e,t){e<yc&&(yc=e),e>xc&&(xc=e),t<bc&&(bc=t),t>Sc&&(Sc=t)}var Tc=0,Ec=0,Dc=0,Oc=0,kc=0,Ac=0,jc=0,Mc=0,Nc=0,Pc,Fc,Ic,Lc,Rc={point:zc,lineStart:Bc,lineEnd:Uc,polygonStart:function(){Rc.lineStart=Wc,Rc.lineEnd=Gc},polygonEnd:function(){Rc.point=zc,Rc.lineStart=Bc,Rc.lineEnd=Uc},result:function(){var e=Nc?[jc/Nc,Mc/Nc]:Ac?[Oc/Ac,kc/Ac]:Dc?[Tc/Dc,Ec/Dc]:[NaN,NaN];return Tc=Ec=Dc=Oc=kc=Ac=jc=Mc=Nc=0,e}};function zc(e,t){Tc+=e,Ec+=t,++Dc}function Bc(){Rc.point=Vc}function Vc(e,t){Rc.point=Hc,zc(Ic=e,Lc=t)}function Hc(e,t){var n=e-Ic,r=t-Lc,i=fs(n*n+r*r);Oc+=i*(Ic+e)/2,kc+=i*(Lc+t)/2,Ac+=i,zc(Ic=e,Lc=t)}function Uc(){Rc.point=zc}function Wc(){Rc.point=Kc}function Gc(){qc(Pc,Fc)}function Kc(e,t){Rc.point=qc,zc(Pc=Ic=e,Fc=Lc=t)}function qc(e,t){var n=e-Ic,r=t-Lc,i=fs(n*n+r*r);Oc+=i*(Ic+e)/2,kc+=i*(Lc+t)/2,Ac+=i,i=Lc*e-Ic*t,jc+=i*(Ic+e),Mc+=i*(Lc+t),Nc+=i*3,zc(Ic=e,Lc=t)}function Jc(e){this._context=e}Jc.prototype={_radius:4.5,pointRadius:function(e){return this._radius=e,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(e,t){switch(this._point){case 0:this._context.moveTo(e,t),this._point=1;break;case 1:this._context.lineTo(e,t);break;default:this._context.moveTo(e+this._radius,t),this._context.arc(e,t,this._radius,0,is);break}},result:gs};var Yc=new mt,Xc,Zc,Qc,$c,el,tl={point:gs,lineStart:function(){tl.point=nl},lineEnd:function(){Xc&&rl(Zc,Qc),tl.point=gs},polygonStart:function(){Xc=!0},polygonEnd:function(){Xc=null},result:function(){var e=+Yc;return Yc=new mt,e}};function nl(e,t){tl.point=rl,Zc=$c=e,Qc=el=t}function rl(e,t){$c-=e,el-=t,Yc.add(fs($c*$c+el*el)),$c=e,el=t}var il,al,ol,sl,cl=class{constructor(e){this._append=e==null?ll:ul(e),this._radius=4.5,this._=``}pointRadius(e){return this._radius=+e,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){this._line===0&&(this._+=`Z`),this._point=NaN}point(e,t){switch(this._point){case 0:this._append`M${e},${t}`,this._point=1;break;case 1:this._append`L${e},${t}`;break;default:if(this._append`M${e},${t}`,this._radius!==ol||this._append!==al){let e=this._radius,t=this._;this._=``,this._append`m0,${e}a${e},${e} 0 1,1 0,${-2*e}a${e},${e} 0 1,1 0,${2*e}z`,ol=e,al=this._append,sl=this._,this._=t}this._+=sl;break}}result(){let e=this._;return this._=``,e.length?e:null}};function ll(e){let t=1;this._+=e[0];for(let n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function ul(e){let t=Math.floor(e);if(!(t>=0))throw RangeError(`invalid digits: ${e}`);if(t>15)return ll;if(t!==il){let e=10**t;il=t,al=function(t){let n=1;this._+=t[0];for(let r=t.length;n<r;++n)this._+=Math.round(arguments[n]*e)/e+t[n]}}return al}function dl(e,t){let n=3,r=4.5,i,a;function o(e){return e&&(typeof r==`function`&&a.pointRadius(+r.apply(this,arguments)),Ss(e,i(a))),a.result()}return o.area=function(e){return Ss(e,i(mc)),mc.result()},o.measure=function(e){return Ss(e,i(tl)),tl.result()},o.bounds=function(e){return Ss(e,i(Cc)),Cc.result()},o.centroid=function(e){return Ss(e,i(Rc)),Rc.result()},o.projection=function(t){return arguments.length?(i=t==null?(e=null,sc):(e=t).stream,o):e},o.context=function(e){return arguments.length?(a=e==null?(t=null,new cl(n)):new Jc(t=e),typeof r!=`function`&&a.pointRadius(r),o):t},o.pointRadius=function(e){return arguments.length?(r=typeof e==`function`?e:(a.pointRadius(+e),+e),o):r},o.digits=function(e){if(!arguments.length)return n;if(e==null)n=null;else{let t=Math.floor(e);if(!(t>=0))throw RangeError(`invalid digits: ${e}`);n=t}return t===null&&(a=new cl(n)),o},o.projection(e).digits(n).context(t)}function fl(e){return function(t){var n=new pl;for(var r in e)n[r]=e[r];return n.stream=t,n}}function pl(){}pl.prototype={constructor:pl,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function ml(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),r!=null&&e.clipExtent(null),Ss(n,e.stream(Cc)),t(Cc.result()),r!=null&&e.clipExtent(r),e}function hl(e,t,n){return ml(e,function(n){var r=t[1][0]-t[0][0],i=t[1][1]-t[0][1],a=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),o=+t[0][0]+(r-a*(n[1][0]+n[0][0]))/2,s=+t[0][1]+(i-a*(n[1][1]+n[0][1]))/2;e.scale(150*a).translate([o,s])},n)}function gl(e,t,n){return hl(e,[[0,0],t],n)}function _l(e,t,n){return ml(e,function(n){var r=+t,i=r/(n[1][0]-n[0][0]),a=(r-i*(n[1][0]+n[0][0]))/2,o=-i*n[0][1];e.scale(150*i).translate([a,o])},n)}function vl(e,t,n){return ml(e,function(n){var r=+t,i=r/(n[1][1]-n[0][1]),a=-i*n[0][0],o=(r-i*(n[1][1]+n[0][1]))/2;e.scale(150*i).translate([a,o])},n)}var yl=16,bl=Q(30*X);function xl(e,t){return+t?Cl(e,t):Sl(e)}function Sl(e){return fl({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function Cl(e,t){function n(r,i,a,o,s,c,l,u,d,f,p,m,h,g){var _=l-r,v=u-i,y=_*_+v*v;if(y>4*t&&h--){var b=o+f,x=s+p,S=c+m,C=fs(b*b+x*x+S*S),w=hs(S/=C),T=Z(Z(S)-1)<1e-6||Z(a-d)<1e-6?(a+d)/2:ss(x,b),E=e(T,w),D=E[0],O=E[1],k=D-r,A=O-i,j=v*k-_*A;(j*j/y>t||Z((_*k+v*A)/y-.5)>.3||o*f+s*p+c*m<bl)&&(n(r,i,a,o,s,c,D,O,T,b/=C,x/=C,S,h,g),g.point(D,O),n(D,O,T,b,x,S,l,u,d,f,p,m,h,g))}}return function(t){var r,i,a,o,s,c,l,u,d,f,p,m,h={point:g,lineStart:_,lineEnd:y,polygonStart:function(){t.polygonStart(),h.lineStart=b},polygonEnd:function(){t.polygonEnd(),h.lineStart=_}};function g(n,r){n=e(n,r),t.point(n[0],n[1])}function _(){u=NaN,h.point=v,t.lineStart()}function v(r,i){var a=ws([r,i]),o=e(r,i);n(u,d,l,f,p,m,u=o[0],d=o[1],l=r,f=a[0],p=a[1],m=a[2],yl,t),t.point(u,d)}function y(){h.point=g,t.lineEnd()}function b(){_(),h.point=x,h.lineEnd=S}function x(e,t){v(r=e,t),i=u,a=d,o=f,s=p,c=m,h.point=v}function S(){n(u,d,l,f,p,m,i,a,r,o,s,c,yl,t),h.lineEnd=y,y()}return h}}var wl=fl({point:function(e,t){this.stream.point(e*X,t*X)}});function Tl(e){return fl({point:function(t,n){var r=e(t,n);return this.stream.point(r[0],r[1])}})}function El(e,t,n,r,i){function a(a,o){return a*=r,o*=i,[t+e*a,n-e*o]}return a.invert=function(a,o){return[(a-t)/e*r,(n-o)/e*i]},a}function Dl(e,t,n,r,i,a){if(!a)return El(e,t,n,r,i);var o=Q(a),s=$(a),c=o*e,l=s*e,u=o/e,d=s/e,f=(s*n-o*t)/e,p=(s*t+o*n)/e;function m(e,a){return e*=r,a*=i,[c*e-l*a+t,n-l*e-c*a]}return m.invert=function(e,t){return[r*(u*e-d*t+f),i*(p-d*e-u*t)]},m}function Ol(e){return kl(function(){return e})()}function kl(e){var t,n=150,r=480,i=250,a=0,o=0,s=0,c=0,l=0,u,d=0,f=1,p=1,m=null,h=Ys,g=null,_,v,y,b=sc,x=.5,S,C,w,T,E;function D(e){return w(e[0]*X,e[1]*X)}function O(e){return e=w.invert(e[0],e[1]),e&&[e[0]*as,e[1]*as]}D.stream=function(e){return T&&E===e?T:T=wl(Tl(u)(h(S(b(E=e)))))},D.preclip=function(e){return arguments.length?(h=e,m=void 0,A()):h},D.postclip=function(e){return arguments.length?(b=e,g=_=v=y=null,A()):b},D.clipAngle=function(e){return arguments.length?(h=+e?$s(m=e*X):(m=null,Ys),A()):m*as},D.clipExtent=function(e){return arguments.length?(b=e==null?(g=_=v=y=null,sc):rc(g=+e[0][0],_=+e[0][1],v=+e[1][0],y=+e[1][1]),A()):g==null?null:[[g,_],[v,y]]},D.scale=function(e){return arguments.length?(n=+e,k()):n},D.translate=function(e){return arguments.length?(r=+e[0],i=+e[1],k()):[r,i]},D.center=function(e){return arguments.length?(a=e[0]%360*X,o=e[1]%360*X,k()):[a*as,o*as]},D.rotate=function(e){return arguments.length?(s=e[0]%360*X,c=e[1]%360*X,l=e.length>2?e[2]%360*X:0,k()):[s*as,c*as,l*as]},D.angle=function(e){return arguments.length?(d=e%360*X,k()):d*as},D.reflectX=function(e){return arguments.length?(f=e?-1:1,k()):f<0},D.reflectY=function(e){return arguments.length?(p=e?-1:1,k()):p<0},D.precision=function(e){return arguments.length?(S=xl(C,x=e*e),A()):fs(x)},D.fitExtent=function(e,t){return hl(D,e,t)},D.fitSize=function(e,t){return gl(D,e,t)},D.fitWidth=function(e,t){return _l(D,e,t)},D.fitHeight=function(e,t){return vl(D,e,t)};function k(){var e=Dl(n,0,0,f,p,d).apply(null,t(a,o)),m=Dl(n,r-e[0],i-e[1],f,p,d);return u=Ms(s,c,l),C=As(t,m),w=As(u,C),S=xl(C,x),A()}function A(){return T=E=null,D}return function(){return t=e.apply(this,arguments),D.invert=t.invert&&O,k()}}function Al(e){return function(t,n){var r=fs(t*t+n*n),i=e(r),a=$(i),o=Q(i);return[ss(t*a,r*o),hs(r&&n*a/r)]}}function jl(e,t){return[e,us(ps((ns+t)/2))]}jl.invert=function(e,t){return[e,2*os(ls(t))-ns]};function Ml(){return Nl(jl).scale(961/is)}function Nl(e){var t=Ol(e),n=t.center,r=t.scale,i=t.translate,a=t.clipExtent,o=null,s,c,l;t.scale=function(e){return arguments.length?(r(e),u()):r()},t.translate=function(e){return arguments.length?(i(e),u()):i()},t.center=function(e){return arguments.length?(n(e),u()):n()},t.clipExtent=function(e){return arguments.length?(e==null?o=s=c=l=null:(o=+e[0][0],s=+e[0][1],c=+e[1][0],l=+e[1][1]),u()):o==null?null:[[o,s],[c,l]]};function u(){var n=Y*r(),i=t(Is(t.rotate()).invert([0,0]));return a(o==null?[[i[0]-n,i[1]-n],[i[0]+n,i[1]+n]]:e===jl?[[Math.max(i[0]-n,o),s],[Math.min(i[0]+n,c),l]]:[[o,Math.max(i[1]-n,s)],[c,Math.min(i[1]+n,l)]])}return u()}function Pl(e,t){return[Q(t)*$(e),$(t)]}Pl.invert=Al(hs);function Fl(){return Ol(Pl).scale(249.5).clipAngle(90+J)}var Il=100;function Ll(e,t,n,r){let i=document.createElement(`div`);i.className=`adornment`;let a=e.scale??1;i.style.flexGrow=`0`,i.style.flexShrink=`0`;let o={id:e.id,name:e.name,map:t,container:i,moveEndPosition:t.getCenter(),geoJson:void 0,isGlobe:e.isGlobe,boundingBox:e.boundingBox,scale:a,backgroundColor:e.backgroundColor??`#000000`,globeBackgroundColor:e.globeBackgroundColor??`#000000`,borderColor:e.borderColor??`#000000`,primaryFillColor:e.primaryFillColor??`#000000`,primaryStrokeColor:e.primaryStrokeColor??`#000000`,secondaryFillColor:e.secondaryFillColor??`#000000`,secondaryStrokeColor:e.secondaryStrokeColor??`#000000`,graticuleColor:e.graticuleColor??`#000000`,frameColor:e.frameColor??`#000000`,frameOutlineColor:e.frameOutlineColor??`#000000`,dotColor:e.dotColor??`#000000`,dotOutlineColor:e.dotOutlineColor??`#000000`,globeFallbackActive:!1,globeGeoJson:void 0},s=[fetch(`${n}/data/insetmaps/${e.fileName}`).then(e=>e.json()).then(e=>{o.geoJson=Za(e,Object.keys(e.objects)[0])})];if(!e.isGlobe){let e=fetch(`${n}/data/insetmaps/world-110m.json`).then(e=>e.json()).then(e=>{o.globeGeoJson=Za(e,Object.keys(e.objects)[0])});s.push(e)}Rl(o),r!==`interactive`&&t.on(`resize`,()=>Rl(o));let c=Promise.all(s).then(()=>Rl(o)).catch(()=>{});return t.on(`moveend`,()=>{o.moveEndPosition=t.getCenter(),(o.isGlobe||o.globeFallbackActive)&&Rl(o)}),t.on(`move`,()=>{if(!o.isGlobe){let[e,n,r,i]=o.boundingBox,a=Vl(t),s=ts(ei([a,Qr([[[e,n],[e,i],[r,i],[r,n],[e,n]]])])),c=Ha(a),l=(s?Ha(s):0)<c*.75;o.globeFallbackActive!==l&&(o.globeFallbackActive=l,o.moveEndPosition=t.getCenter(),Rl(o))}Bl(o)}),{element:i,ready:c}}function Rl(e){let{id:t,map:n,container:r,scale:i,backgroundColor:a,globeBackgroundColor:o,secondaryFillColor:s,secondaryStrokeColor:c,primaryFillColor:l,primaryStrokeColor:u,graticuleColor:d,borderColor:f,frameColor:p,frameOutlineColor:m,dotColor:h,dotOutlineColor:g}=e,_=Il*i,v=n.getScale();r.style.width=`${_*v}px`,r.style.height=`${_*v}px`;let y=e.globeFallbackActive&&e.globeGeoJson!==void 0,b=y?e.globeGeoJson:e.geoJson,x=y||e.isGlobe;if(b===void 0)return;let S=_/2,C=.1*i,w=[x?`<circle cx="${S}" cy="${S}" r="${S}" ${H(o)}></circle>`:`<rect x="0" y="0" width="${_}" height="${_}" ${H(a)}></rect>`],{path:T}=zl(e),E=T({...b,features:b.features.filter(e=>e.properties?.class!==`P1`)});E&&w.push(`
268
268
  <path
269
269
  d="${E}"
270
270
  ${H(s)}
@@ -278,7 +278,7 @@ import{AttributionControl as e,Event as t,Evented as n,LngLatBounds as r,Map as
278
278
  ${H(u,`stroke`)}
279
279
  stroke-width="${C}"
280
280
  ></path>
281
- `),x){let e=T(ei(rc().step([10,10]).lines().map(e=>$r(e.coordinates))));w.push(`
281
+ `),x){let e=T(ei(oc().step([10,10]).lines().map(e=>$r(e.coordinates))));w.push(`
282
282
  <path
283
283
  d="${e}"
284
284
  fill="none"
@@ -328,7 +328,7 @@ import{AttributionControl as e,Event as t,Evented as n,LngLatBounds as r,Map as
328
328
  >
329
329
  ${w.join(``)}
330
330
  </svg>
331
- `,Ll(e)}function Il(e){let{scale:t,boundingBox:n,moveEndPosition:r}=e,i=e.globeFallbackActive&&e.globeGeoJson!==void 0||e.isGlobe,a=Nl*t,o=cl(),s;if(i){let{lng:e,lat:t}=r;s=Ml().scale(a/2).translate([a/2,a/2]).rotate([-e,-t]).clipAngle(90)}else{s=kl().scale(1).translate([0,0]);let e=s([n[0],n[3]]),t=s([n[2],n[1]]),r=Math.abs(t[0]-e[0]),i=Math.abs(t[1]-e[1]),o=(e[0]+t[0])/2,c=(e[1]+t[1])/2,l=1/Math.max(r/a,i/a);s.scale(l).translate([a/2-l*o,a/2-l*c])}return o.projection(s),{path:o,projection:s}}function Ll(e){let{id:t,map:n,container:r,scale:i}=e,a=r.querySelector(`#frame-${t}`),o=r.querySelector(`#frame-outline-${t}`),s=r.querySelector(`#dot-${t}`);if(!a||!o||!s)return;let c=Rl(n),{path:l,projection:u}=Il(e),d=1/0,f=-1/0,p=1/0,m=-1/0,h=1/0,g=-1/0;ri(c,e=>{let t=u(e);d=Math.min(d,e[0]),f=Math.max(f,e[0]),p=Math.min(p,t[0]),m=Math.max(m,t[0]),h=Math.min(h,t[1]),g=Math.max(g,t[1])});let _=10*i;if(m-p<_||g-h<_){a.style.display=`none`,o.style.display=`none`,s.style.display=`block`;let e=n.getCenter(),[t,r]=u([e.lng,e.lat]);s.setAttribute(`cx`,String(t)),s.setAttribute(`cy`,String(r))}else if(f-d<180){a.style.display=`block`,o.style.display=`block`,s.style.display=`none`;let e=l(c);a.setAttribute(`d`,e),o.setAttribute(`d`,e)}else a.style.display=`none`,o.style.display=`none`,s.style.display=`none`}function Rl(e){let{clientWidth:t,clientHeight:n}=e.getCanvas(),r=[];for(let n=0;n<64;n++){let{lng:i,lat:a}=e.unprojectWithScaleCorrection([I(0,t,n/64),0]);r.push([i,a])}for(let i=0;i<64;i++){let{lng:a,lat:o}=e.unprojectWithScaleCorrection([t,I(0,n,i/64)]);r.push([a,o])}for(let i=0;i<64;i++){let{lng:a,lat:o}=e.unprojectWithScaleCorrection([I(t,0,i/64),n]);r.push([a,o])}for(let t=0;t<64;t++){let{lng:i,lat:a}=e.unprojectWithScaleCorrection([0,I(n,0,t/64)]);r.push([i,a])}let{lng:i,lat:a}=e.unprojectWithScaleCorrection([0,0]);return r.push([i,a]),{type:`Feature`,properties:{},geometry:{coordinates:[r],type:`Polygon`}}}var zl=[10,5,3,2,1];function Bl(e,t=1e-6){let n=Math.floor(e);if(e-=n,e<t)return[n,1];if(1-t<e)return[n+1,1];let r=0,i=1,a=1,o=1;for(;;){let s=r+a,c=i+o;if(c*(e+t)<s)a=s,o=c;else if(s<(e-t)*c)r=s,i=c;else return[n*c+s,c]}}function Vl(e){let t=10**Math.floor(Math.log10(e)),n=e/t;for(let e of zl)if(n>=e)return e*t;return Hl(n)*t}function Hl(e){let t=10**Math.ceil(-Math.log(e)/Math.LN10);return Math.round(e*t)/t}var Ul={kilometer:`km`,meter:`m`,mile:`mi`,foot:`ft`,nauticalMile:`nm`};function Wl(e,t,n,r){let i=document.createElement(`div`);i.className=`adornment`;let a=`Arial, sans-serif`;return{element:i,ready:n.loadReference(e.font??a,`700`).then(()=>{let o=()=>{i.innerHTML=Gl(t,e,t.getScale(),a,n)};o(),t.on(`move`,o),r!==`interactive`&&t.on(`resize`,o)})}}function Gl(e,t,n,r,i){let{maxWidth:a=100,fontSize:o=8,color:s=`#000000`,unit:c=`metric_and_imperial`}=t,l=i.resolve(t.font??r,`700`),u=e.getCenter(),d=e.project(u),f=T(u,e.unproject([d.x+a,d.y])),p=Object.fromEntries(Object.entries(Ul).map(([e,t])=>{let n=M(`meter`,e,f),r=Vl(n)||0;return[e,{value:n,ratio:n?r/n:0,humanized:r<1?`${Bl(r).join(`/`)} ${t}`:`${r} ${t}`}]})),m=p.meter.value>1e3?p.kilometer:p.meter,h=p.foot.value>5280?p.mile:p.foot,g={imperial:h,metric:m,nautical:p.nauticalMile},_=c===`metric_and_imperial`?void 0:g[c],v={metric:Math.round(a*m.ratio),imperial:Math.round(a*h.ratio)},y=c===`metric_and_imperial`?Math.max(v.metric,v.imperial):Math.round(a*(_?.ratio??0)),b=o+7,x=o+3,S=c===`metric_and_imperial`?10+x*2:10+x;return c===`metric_and_imperial`?`
331
+ `,Bl(e)}function zl(e){let{scale:t,boundingBox:n,moveEndPosition:r}=e,i=e.globeFallbackActive&&e.globeGeoJson!==void 0||e.isGlobe,a=Il*t,o=dl(),s;if(i){let{lng:e,lat:t}=r;s=Fl().scale(a/2).translate([a/2,a/2]).rotate([-e,-t]).clipAngle(90)}else{s=Ml().scale(1).translate([0,0]);let e=s([n[0],n[3]]),t=s([n[2],n[1]]),r=Math.abs(t[0]-e[0]),i=Math.abs(t[1]-e[1]),o=(e[0]+t[0])/2,c=(e[1]+t[1])/2,l=1/Math.max(r/a,i/a);s.scale(l).translate([a/2-l*o,a/2-l*c])}return o.projection(s),{path:o,projection:s}}function Bl(e){let{id:t,map:n,container:r,scale:i}=e,a=r.querySelector(`#frame-${t}`),o=r.querySelector(`#frame-outline-${t}`),s=r.querySelector(`#dot-${t}`);if(!a||!o||!s)return;let c=Vl(n),{path:l,projection:u}=zl(e),d=1/0,f=-1/0,p=1/0,m=-1/0,h=1/0,g=-1/0;ri(c,e=>{let t=u(e);d=Math.min(d,e[0]),f=Math.max(f,e[0]),p=Math.min(p,t[0]),m=Math.max(m,t[0]),h=Math.min(h,t[1]),g=Math.max(g,t[1])});let _=10*i;if(m-p<_||g-h<_){a.style.display=`none`,o.style.display=`none`,s.style.display=`block`;let e=n.getCenter(),[t,r]=u([e.lng,e.lat]);s.setAttribute(`cx`,String(t)),s.setAttribute(`cy`,String(r))}else if(f-d<180){a.style.display=`block`,o.style.display=`block`,s.style.display=`none`;let e=l(c);a.setAttribute(`d`,e),o.setAttribute(`d`,e)}else a.style.display=`none`,o.style.display=`none`,s.style.display=`none`}function Vl(e){let{clientWidth:t,clientHeight:n}=e.getCanvas(),r=[];for(let n=0;n<64;n++){let{lng:i,lat:a}=e.unprojectWithScaleCorrection([I(0,t,n/64),0]);r.push([i,a])}for(let i=0;i<64;i++){let{lng:a,lat:o}=e.unprojectWithScaleCorrection([t,I(0,n,i/64)]);r.push([a,o])}for(let i=0;i<64;i++){let{lng:a,lat:o}=e.unprojectWithScaleCorrection([I(t,0,i/64),n]);r.push([a,o])}for(let t=0;t<64;t++){let{lng:i,lat:a}=e.unprojectWithScaleCorrection([0,I(n,0,t/64)]);r.push([i,a])}let{lng:i,lat:a}=e.unprojectWithScaleCorrection([0,0]);return r.push([i,a]),{type:`Feature`,properties:{},geometry:{coordinates:[r],type:`Polygon`}}}var Hl=[10,5,3,2,1];function Ul(e,t=1e-6){let n=Math.floor(e);if(e-=n,e<t)return[n,1];if(1-t<e)return[n+1,1];let r=0,i=1,a=1,o=1;for(;;){let s=r+a,c=i+o;if(c*(e+t)<s)a=s,o=c;else if(s<(e-t)*c)r=s,i=c;else return[n*c+s,c]}}function Wl(e){let t=10**Math.floor(Math.log10(e)),n=e/t;for(let e of Hl)if(n>=e)return e*t;return Gl(n)*t}function Gl(e){let t=10**Math.ceil(-Math.log(e)/Math.LN10);return Math.round(e*t)/t}var Kl={kilometer:`km`,meter:`m`,mile:`mi`,foot:`ft`,nauticalMile:`nm`};function ql(e,t,n,r){let i=document.createElement(`div`);i.className=`adornment`;let a=`Arial, sans-serif`;return{element:i,ready:n.loadReference(e.font??a,`700`).then(()=>{let o=()=>{i.innerHTML=Jl(t,e,t.getScale(),a,n)};o(),t.on(`move`,o),r!==`interactive`&&t.on(`resize`,o)})}}function Jl(e,t,n,r,i){let{maxWidth:a=100,fontSize:o=8,color:s=`#000000`,unit:c=`metric_and_imperial`}=t,l=i.resolve(t.font??r,`700`),u=e.getCenter(),d=e.project(u),f=T(u,e.unproject([d.x+a,d.y])),p=Object.fromEntries(Object.entries(Kl).map(([e,t])=>{let n=M(`meter`,e,f),r=Wl(n)||0;return[e,{value:n,ratio:n?r/n:0,humanized:r<1?`${Ul(r).join(`/`)} ${t}`:`${r} ${t}`}]})),m=p.meter.value>1e3?p.kilometer:p.meter,h=p.foot.value>5280?p.mile:p.foot,g={imperial:h,metric:m,nautical:p.nauticalMile},_=c===`metric_and_imperial`?void 0:g[c],v={metric:Math.round(a*m.ratio),imperial:Math.round(a*h.ratio)},y=c===`metric_and_imperial`?Math.max(v.metric,v.imperial):Math.round(a*(_?.ratio??0)),b=o+7,x=o+3,S=c===`metric_and_imperial`?10+x*2:10+x;return c===`metric_and_imperial`?`
332
332
  <svg
333
333
  class="adornment-svg"
334
334
  data-adornment-name="${B(t.name)}"
@@ -454,14 +454,14 @@ import{AttributionControl as e,Event as t,Evented as n,LngLatBounds as r,Map as
454
454
  ${_?.humanized??``}
455
455
  </text>
456
456
  </svg>
457
- `}function Kl(e,t,n,r){let i=document.createElement(`div`);i.className=`adornment`;let a=`ArialMT`,o=Array.from(new Set([e.titleFont??a,e.subtitleFont??a]));return{element:i,ready:Promise.all(o.map(e=>n.loadReference(e))).then(()=>{let o=()=>{i.innerHTML=ql(e,a,t.getScale(),n)};o(),r!==`interactive`&&t.on(`resize`,o)})}}function ql(e,t,n,r){let{title:i,titleColor:a=`#000000`,titleFontSize:o=20,titleJustify:s=`center`,subtitle:c,subtitleColor:l=`#000000`,subtitleFontSize:u=12,subtitleJustify:d=`center`,background:f=`#ffffff`,showBackground:p=!1}=e,m=r.resolve(e.titleFont??t),h=r.resolve(e.subtitleFont??t),g=0,_=0,v=0,y=0,b=0,x=i.trim().length>0?qe([i],m,o):null,S=c.trim().length>0?qe([c],h,u):null;if(g=Math.max(x?.width??0,S?.width??0),x){let{ascent:e,descent:t}=x;_=e+t,y=8+e}if(S){let{ascent:e,descent:t}=S;v=e+t,b=x?y+x.descent+e:8+e}let C=g+16,w=_+v+16,T=s===`center`?C/2:s===`right`?C-8:8,E=d===`center`?C/2:d===`right`?C-8:8,D=``;if(D+=`<svg class="adornment-svg" data-adornment-name="${B(e.name)}" xmlns="http://www.w3.org/2000/svg" width="${C*n}" height="${w*n}" viewBox="0 0 ${C} ${w}">`,D+=`<rect x="0" y="0" width="${C}" height="${w}" ${H(f)} rx="6" style="visibility:${p?`visible`:`hidden`}" />`,x||S){let e=s===`center`?`middle`:s===`right`?`end`:`start`,t=d===`center`?`middle`:d===`right`?`end`:`start`;D+=`<text x="${T}" y="${y}" ${H(a)} ${we(m)} font-size="${o}" text-anchor="${e}">`,x&&(D+=`${B(i)}`),S&&(D+=`<tspan x="${E}" y="${b}" ${H(l)} ${we(h)} font-size="${u}" text-anchor="${t}">`,D+=`${B(c)}`,D+=`</tspan>`),D+=`</text>`}return D+=`</svg>`,D}var Jl={"sky-color":`#6babff`,"sky-horizon-blend":1,"horizon-color":[`interpolate-hcl`,[`linear`],[`zoom`],0,`#edf7fc`,9,`#edf7fc`,10,`#dcf0fa`],"horizon-fog-blend":.5,"fog-color":`#edf7fc`,"fog-ground-blend":.5,"atmosphere-blend":1},Yl={top_left:{x:5,y:5,unit:`px`},top_center:{x:0,y:5,unit:`px`},top_right:{x:5,y:5,unit:`px`},right_center:{x:5,y:0,unit:`px`},bottom_right:{x:5,y:5,unit:`px`},bottom_center:{x:0,y:5,unit:`px`},bottom_left:{x:5,y:5,unit:`px`},left_center:{x:5,y:0,unit:`px`}},Xl={top_left:{x:`left`,y:`top`},top_center:{x:`center`,y:`top`},top_right:{x:`right`,y:`top`},right_center:{x:`right`,y:`center`},bottom_right:{x:`right`,y:`bottom`},bottom_center:{x:`center`,y:`bottom`},bottom_left:{x:`left`,y:`bottom`},left_center:{x:`left`,y:`center`}},Zl={fill:{props:[`fill-opacity`],defaultValue:1},line:{props:[`line-opacity`],defaultValue:1},circle:{props:[`circle-opacity`,`circle-stroke-opacity`],defaultValue:1},heatmap:{props:[`heatmap-opacity`],defaultValue:1},"fill-extrusion":{props:[`fill-extrusion-opacity`],defaultValue:1},symbol:{props:[`icon-opacity`,`text-opacity`],defaultValue:1},raster:{props:[`raster-opacity`],defaultValue:1},hillshade:{props:[`hillshade-exaggeration`],defaultValue:.5},"color-relief":{props:[`color-relief-opacity`],defaultValue:1},background:{props:[`background-opacity`],defaultValue:1},custom:{props:[],defaultValue:1}},Ql=[`beforeWaters`,`beforeBoundaries`,`beforeNames`,`beforeNone`],$l={beforeWaters:`mc-before-waters`,beforeBoundaries:`mc-before-boundaries`,beforeNames:`mc-before-names`,beforeNone:`mc-before-none`},eu={jpg:`static`,png:`static`,svg:`static`,pdf:`static`,tiff:`static`,eps:`static`,eps_log:`static`,mp4:`video`,mov:`video`,mkv:`video`,mxf:`video`,webm:`video`,jpg_sequence:`video`,png_sequence:`video`,web_video:`video`,web:`interactive`,web_download:`interactive`},tu=[`top_left`,`top_right`,`bottom_left`,`bottom_right`,`top_center`,`left_center`,`right_center`,`bottom_center`],nu=new Map,ru=e=>nu.delete(e);async function iu(e,t,n,r,i,a,o){let s=[...e.adornments??[]],{fonts:c}=r;au(n),ou(n,t,o);let l=[],u=s.some(e=>![`copyright`,`webControls`].includes(e.type));ja()&&u&&!s.some(e=>e.type===`webControls`)&&s.unshift({type:`webControls`,id:`web_controls`,name:`Web controls`,position:`top_left`,stacking:`vertical`,buttons:[]}),s.forEach(t=>{if(t.type===`custom`)cu(n,de(t,n,o),t.position,t.stacking);else if(t.type===`northArrow`)cu(n,Xi(t,n,o),t.position,t.stacking);else if(t.type===`webControls`&&t.buttons&&o===`interactive`)cu(n,Ma(t,n,r,i,u),t.position,t.stacking);else if(t.type===`scalebar`){let{element:e,ready:r}=Wl(t,n,c,o);cu(n,e,t.position,t.stacking),l.push(r)}else if(t.type===`insetMap`){let{element:e,ready:r}=Pl(t,n,a,o);cu(n,e,t.position,t.stacking),l.push(r)}else if(t.type===`heading`){let{element:e,ready:r}=Kl(t,n,c,o);cu(n,e,t.position,t.stacking),l.push(r)}else if(t.type===`manualLegend`){let{element:e,ready:r}=Yi(t,n,c,o);cu(n,e,t.position,t.stacking),l.push(r)}else if(t.type===`connectedLegend`){let{element:r,ready:i}=Vi(t,e,n,c,o);cu(n,r,t.position,t.stacking),l.push(i)}else if(t.type===`copyright`&&o!==`interactive`){let{element:e,ready:r}=Fa(t,n,c);cu(n,e,t.position,t.stacking),l.push(r)}}),n.on(`resize`,()=>ou(n,t,o)),await Promise.all(l)}function au(e){let t=new Map,n=e.getContainer(),r=window.getComputedStyle(n);n.style.setProperty(`--adornment-text-direction`,r.direction),n.style.setProperty(`--adornment-text-writing-mode`,r.writingMode);for(let e of tu){let r=document.createElement(`div`),i=document.createElement(`div`),a=document.createElement(`div`);r.classList.add(`adornment-container`,e),i.classList.add(`inner`),a.classList.add(`inner`,`vertical`),r.append(i,a),n.appendChild(r),t.set(e,{container:r,horizontal:i,vertical:a})}nu.set(e,t)}function ou(e,t,n){let r=nu.get(e),i=e.getScale();if(r){e.getContainer().style.setProperty(`--adornment-spacing`,`${5*i}px`);for(let[e,{container:a}]of r)a.style.cssText=su(e,t[e],i,n)}}function su(e,t,n,r){let i=Xl[e],a=``,o=[],{x:s,y:c,unit:l}=t;return l===`px`&&(s*=n,c*=n),i.x===`center`?o.push(`translateX(${s}${l})`):a+=`${i.x}: ${s}${l};`,i.y===`center`?o.push(`translateY(${c}${l})`):e===`bottom_right`&&r===`interactive`?a+=`${i.y}: max(${c}${l}, 25px);`:a+=`${i.y}: ${c}${l};`,o.length&&(a+=`transform: ${o.join(` `)};`),a}function cu(e,t,n,r){ja()&&!t.classList.contains(`web-control`)&&t.classList.add(`hide`),r||=[`left_center`,`right_center`].includes(n)?`vertical`:`horizontal`;let i=nu.get(e)?.get(n),a=n===`left_center`||n===`right_center`?`vertical`:`horizontal`;i?.[a].hasChildNodes()||(r=a),(i?.[r])?.appendChild(t)}function lu(e){for(let t of Ql){let n=$l[t];e.layers.find(e=>e.id===n)===void 0&&(e.sources.empty===void 0&&(e.sources.empty={type:`geojson`,data:{type:`FeatureCollection`,features:[]}}),e.layers.push({id:n,type:`fill`,source:`empty`,layout:{visibility:`none`}}))}}function uu(e,t,n,r,i){e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:t.models.filter(e=>e.visible??!0).map(e=>du(t,e,r,i))}}),e.addLayer({id:t.id,type:`fill`,source:t.id,metadata:{"mc-model-type":`polygon`,"mc-group-id":t.id},paint:{"fill-color":[`get`,`fill-color`],"fill-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n),e.addLayer({id:`${t.id}-pattern`,type:`fill`,source:t.id,filter:[`has`,`fill-pattern`],paint:{"fill-pattern":[`get`,`fill-pattern`],"fill-opacity":[`coalesce`,[`feature-state`,`opacity`],1]},metadata:{"mc-model-type":`polygon`,"mc-group-id":t.id}},n),e.addLayer({id:`${t.id}-outline`,type:`line`,source:t.id,metadata:{"mc-model-type":`polygon`,"mc-group-id":t.id},layout:{"line-cap":`round`,"line-join":`round`},paint:{"line-width":[`get`,`outline-width`],"line-color":[`get`,`outline-color`],"line-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n)}function du(e,t,n,r){let i=t.fillPattern===void 0?void 0:r.getMapLibreImageKey(n[t.fillPattern],2*window.devicePixelRatio);return{type:`Feature`,id:E(t.id),properties:{id:t.id,"fill-color":e.fillColor||t.fillColor?Je(t.dataBindings??{},t.fillColor,e.fillColor):`#000000`,"outline-color":e.outlineColor||t.outlineColor?Je(t.dataBindings??{},t.outlineColor,e.outlineColor):`#000000`,"outline-width":t.outlineWidth??0,"fill-pattern":i},geometry:{type:`Polygon`,coordinates:Si(t)}}}function fu(e,t,n,r,i){e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:t.models.filter(e=>e.visible??!0).map(e=>pu(t,e,1,r,i))}}),e.addLayer({id:t.id,type:`fill`,source:t.id,metadata:{"mc-model-type":`circle`,"mc-group-id":t.id},filter:[`==`,[`geometry-type`],`Polygon`],paint:{"fill-color":[`get`,`fill-color`],"fill-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n),e.addLayer({id:`${t.id}-pattern`,type:`fill`,source:t.id,filter:[`has`,`fill-pattern`],paint:{"fill-pattern":[`get`,`fill-pattern`],"fill-opacity":[`coalesce`,[`feature-state`,`opacity`],1]},metadata:{"mc-model-type":`circle`,"mc-group-id":t.id}},n),e.addLayer({id:`${t.id}-radius-line`,type:`line`,source:t.id,metadata:{"mc-model-type":`circle`,"mc-group-id":t.id},filter:[`all`,[`==`,[`geometry-type`],`LineString`],[`get`,`radius-line-enabled`]],paint:{"line-color":[`get`,`radius-line-color`],"line-width":[`get`,`radius-line-width`],"line-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n),e.addLayer({id:`${t.id}-outline`,type:`line`,source:t.id,metadata:{"mc-model-type":`circle`,"mc-group-id":t.id},filter:[`==`,[`geometry-type`],`Polygon`],layout:{"line-cap":`round`,"line-join":`round`},paint:{"line-width":[`get`,`outline-width`],"line-color":[`get`,`outline-color`],"line-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n)}function pu(e,t,n,r,i){let a=t.fillPattern===void 0?void 0:i.getMapLibreImageKey(r[t.fillPattern],2*window.devicePixelRatio);return{type:`Feature`,id:E(t.id),properties:{id:t.id,"fill-color":e.fillColor||t.fillColor?Je(t.dataBindings??{},t.fillColor,e.fillColor):`#000000`,"outline-color":e.outlineColor||t.outlineColor?Je(t.dataBindings??{},t.outlineColor,e.outlineColor):`#000000`,"outline-width":t.outlineWidth??0,"fill-pattern":a,"radius-line-enabled":t.radiusLineEnabled??!1,"radius-line-color":e.radiusLineColor||t.radiusLineColor?Je(t.dataBindings??{},t.radiusLineColor,e.radiusLineColor):`#000000`,"radius-line-width":t.radiusLineWidth??0},geometry:{type:`GeometryCollection`,geometries:[{type:`Polygon`,coordinates:[_i(t.center,t.radius*n)]},{type:`LineString`,coordinates:vi(t.center,t.radius*n,t.radiusLineBearing??0)}]}}}var mu=`Roboto-Regular`;function hu(e,t,n,r,i,a){let o=[],s=new Set,c=new Set,l=[`match`,[`get`,`text-font`]],u=!!t.clustering;for(let n of t.models)(n.visible??!0)&&o.push(_u(e,t,n,1,r,i)),s.add(n.textFont),c.add(n.textLineHeight??1.2);if(Array.from(s).length>0){for(let e of Array.from(s))l.push(e,[`literal`,[e,mu]]);l.push([`literal`,[mu]])}e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:o},cluster:u,clusterRadius:t.clusterRadius??50,clusterMaxZoom:t.clusterMaxZoom??14});let d=!t.collisionDetection,f=t.labelCollisionDetection===void 0?d:!t.labelCollisionDetection;c.forEach(r=>{e.addLayer({id:`${t.id}-${r}`,type:`symbol`,source:t.id,metadata:{"mc-model-type":`marker`,"mc-group-id":t.id},layout:{"icon-allow-overlap":d,"icon-ignore-placement":d,"text-allow-overlap":f,"text-ignore-placement":f,"text-optional":!0,"icon-image":[`get`,`mc-image-key`],"icon-anchor":[`get`,`icon-anchor`],"icon-size":[`get`,`icon-size`],"icon-rotate":[`get`,`icon-rotate`],"icon-offset":[`get`,`icon-offset`],"text-field":`{text}`,"text-font":l,"text-max-width":[`get`,`text-max-width`],"text-offset":[`get`,`text-offset`],"text-rotate":[`get`,`text-rotate`],"text-size":[`get`,`text-size`],"text-anchor":[`get`,`text-anchor`],"text-letter-spacing":[`get`,`text-letter-spacing`],"text-line-height":r,"text-justify":[`get`,`text-justify`]},paint:{"icon-opacity":[`coalesce`,[`feature-state`,`opacity`],1],"text-color":[`get`,`text-color`],"text-halo-color":[`get`,`text-halo-color`],"text-halo-width":[`get`,`text-halo-width`],"text-opacity":[`coalesce`,[`feature-state`,`opacity`],1]},filter:[`all`,[`==`,[`get`,`text-line-height`],r],[`!`,[`has`,`point_count`]]]},n)}),u&&(e.addLayer({id:`${t.id}-circle-cluster`,type:`circle`,source:t.id,filter:[`has`,`point_count`],paint:{"circle-color":{property:`point_count`,type:`interval`,stops:t.clusterCircleColor??[]},"circle-radius":{property:`point_count`,type:`interval`,stops:t.clusterCircleRadius??[]}}}),e.addLayer({id:`${t.id}-text-cluster`,type:`symbol`,source:t.id,filter:[`has`,`point_count`],paint:{"text-color":{property:`point_count`,type:`interval`,stops:t.clusterTextColor??[]}},layout:{"text-font":[`literal`,[mu]],"text-field":`{point_count_abbreviated}`,"text-size":{property:`point_count`,type:`interval`,stops:t.clusterTextSize??[]}}}),a===`interactive`&&(e.addSource(`${t.id}-selected-element`,{type:`geojson`,data:{type:`FeatureCollection`,features:[]}}),c.forEach(n=>{e.addLayer({id:`${t.id}-selected-element-${n}`,type:`symbol`,source:`${t.id}-selected-element`,metadata:{"mc-model-type":`marker`,"mc-group-id":t.id},layout:{"icon-allow-overlap":!0,"icon-ignore-placement":!0,"text-allow-overlap":!0,"text-ignore-placement":!0,"icon-image":[`get`,`mc-image-key`],"icon-anchor":[`get`,`icon-anchor`],"icon-size":[`get`,`icon-size`],"icon-rotate":[`get`,`icon-rotate`],"icon-offset":[`get`,`icon-offset`],"text-field":`{text}`,"text-font":l,"text-max-width":[`get`,`text-max-width`],"text-offset":[`get`,`text-offset`],"text-rotate":[`get`,`text-rotate`],"text-size":[`get`,`text-size`],"text-anchor":[`get`,`text-anchor`],"text-letter-spacing":[`get`,`text-letter-spacing`],"text-line-height":n,"text-justify":[`get`,`text-justify`]},paint:{"icon-opacity":[`coalesce`,[`feature-state`,`opacity`],[`global-state`,`opacity-${t.id}`],1],"text-color":[`get`,`text-color`],"text-halo-color":[`get`,`text-halo-color`],"text-halo-width":[`get`,`text-halo-width`],"text-opacity":[`coalesce`,[`feature-state`,`opacity`],[`global-state`,`opacity-${t.id}`],1]},filter:[`all`,[`==`,[`get`,`text-line-height`],n],[`!`,[`has`,`point_count`]]]})}),gu(e,t)))}function gu(e,t){e.on(`click`,`${t.id}-circle-cluster`,async t=>{let n=e.queryRenderedFeatures(t.point).find(e=>e.properties.cluster);if(!n)return;let r=e.getSource(n.source);if(!r)return;let i=await r.getClusterExpansionZoom(Number(n.id));e.easeTo({center:n.geometry.coordinates,zoom:i})})}function _u(e,t,n,r,i,a){let o=n.svg===void 0?void 0:Xe(n.dataBindings??{},i[n.svg],t.svg?i[t.svg]:void 0),s=o===void 0?void 0:a.getMapLibreImageKey(o,window.devicePixelRatio*(n.iconScale??1)*e.getScale()),c=o===void 0?void 0:Ve(o);return{type:`Feature`,id:E(n.id),properties:{id:n.id,"mc-image-key":s,"mc-svg-string":o,"icon-anchor":n.iconAnchor??`center`,"icon-rotate":n.iconRotation??0,"icon-offset":n.iconOffset??[0,0],"icon-size":(n.iconScale??1)*r,"icon-collision-box":c??[0,0,0,0],text:t.text||n.text?Ye(n.dataBindings??{},n.text,t.text):void 0,"text-anchor":n.textAnchor??`center`,"text-font":n.textFont,"text-offset":[(n.textOffset?.[0]??0)/(n.textSize??16),(n.textOffset?.[1]??0)/(n.textSize??16)],"text-rotate":n.textRotation??0,"text-max-width":n.textMaxWidth??10,"text-size":(n.textSize??16)*r,"text-color":t.textColor||n.textColor?Je(n.dataBindings??{},n.textColor,t.textColor):`#000000`,"text-halo-color":t.textHaloColor||n.textHaloColor?Je(n.dataBindings??{},n.textHaloColor,t.textHaloColor):`#000000`,"text-halo-width":n.textHaloWidth??0,"text-line-height":n.textLineHeight??1.2,"text-letter-spacing":n.textLetterSpacing??0,"text-justify":n.textJustify??`center`},geometry:{type:`Point`,coordinates:[n.lngLat.lng,n.lngLat.lat]}}}async function vu(e,t,n,r,i,a){let o=await Promise.all(t.map(e=>`${r}/styles/${e}.json?access_token=${i}`).map(e=>fetch(e).then(e=>e.json()))),s=re(o.map(e=>e.sprite).filter(e=>typeof e==`string`));await Promise.all(s.map(e=>n.loadSprite(e).then(e=>n.addImages(e)).catch(()=>{})));for(let t=0;t<e.length;t++){let r=e[t],i=o[t];for(let e of i.layers)e.metadata===void 0&&(e.metadata={}),e.metadata[`mc-original-layer-id`]=e.id,e.id=`${r} | ${e.id}`;yu(i,n,a)}return o}function yu(e,t,n){for(let n in e.sources)t.getSource(n)===void 0&&t.addSource(n,e.sources[n]);for(let r of e.layers){t.getLayer(r.id)!==void 0&&t.removeLayer(r.id);let e=r.metadata?.[`mc-add-before`]??`mc-before-none`;t.addLayer(bu(r,n),e)}}function bu(e,t){let n=t??{},r=e.metadata?.[`mc-original-layer-id`],i=r===void 0?{}:n[r]??{},a={...e,layout:{...e.layout,...i.layout},paint:{...e.paint,...i.paint},metadata:{...e.metadata,...i.metadata}};return i.minzoom!==void 0&&(a.minzoom=i.minzoom),i.maxzoom!==void 0&&(a.maxzoom=i.maxzoom),`filter`in i&&a.type!==`background`&&(a.filter=i.filter),a}var xu=`<svg xmlns="http://www.w3.org/2000/svg" width="6" height="10" viewBox="0 0 6 10" fill="currentColor"><path d="m0 4.647 4.282 4.4a.814.814 0 0 0 1.166-1.134L2.27 4.647l3.178-3.266A.814.814 0 1 0 4.282.246z"/></svg>
458
- `,Su=`<svg xmlns="http://www.w3.org/2000/svg" width="10" height="11" viewBox="0 0 10 11" fill="currentColor"><path d="M.21.71a.714.714 0 0 1 1.011 0l3.78 3.78L8.778.71a.715.715 0 0 1 1.013 1.01L6.01 5.501l3.78 3.778a.715.715 0 0 1-1.01 1.012L5 6.51l-3.779 3.78A.716.716 0 0 1 .21 9.28L3.99 5.5.21 1.721A.714.714 0 0 1 .21.71"/></svg>
459
- `,Cu=`<svg xmlns="http://www.w3.org/2000/svg" width="6" height="10" viewBox="0 0 6 10" fill="currentColor"><path d="m5.678 4.647-4.282 4.4A.814.814 0 1 1 .23 7.914l3.177-3.266L.23 1.381A.814.814 0 1 1 1.396.246z"/></svg>
460
- `,wu=`<svg width="20" height="20" viewBox="0 0 40 40" stroke="currentColor" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M20 4.167 1.667 35.834h36.667z" stroke-width="2" stroke-linejoin="round"/><path d="M20 29.167v.834m0-14.167.007 8.333" stroke-width="2" stroke-linecap="round"/></svg>
461
- `;function Tu(e,t){let{allowFullscreen:n,loop:r}=e,i=D(e.src,t),a,o=i.match(/(?:youtube\.com\/(?:watch\?.*v=|embed\/|v\/)|youtu\.be\/)([-\w]{11})/)?.[1];a=o?`https://www.youtube.com/embed/${o}`:i;let s=[];if(n||s.push(`fs=0`),r&&o&&s.push(`loop=1&playlist=${o}`),a=Du(a),a=Eu(a),s.length){let e=a.includes(`?`)?`&`:`?`;a+=`${e}${s.join(`&`)}`}return a}function Eu(e){return e.replace(/([?&])si=[^&]+(&)?/,(e,t,n)=>t===`?`&&!n?``:t===`?`&&n?`?`:n?`&`:``)}function Du(e){let t=new URL(e),n=t.searchParams.get(`t`);if(!n)return e;let r=0,i=/^((\d+)m)?((\d+)s)?$/;if(/^\d+$/.test(n))r=parseInt(n,10);else{let e=n.match(i);if(e){let t=parseInt(e[2]||`0`,10),n=parseInt(e[4]||`0`,10);r=t*60+n}}return r>0&&(t.searchParams.delete(`t`),t.searchParams.set(`start`,String(r))),t.toString()}function Ou(e,t,n,r){let i;if(t?.type===`video`)i=r?Nu(t.src,n):`
457
+ `}function Yl(e,t,n,r){let i=document.createElement(`div`);i.className=`adornment`;let a=`ArialMT`,o=Array.from(new Set([e.titleFont??a,e.subtitleFont??a]));return{element:i,ready:Promise.all(o.map(e=>n.loadReference(e))).then(()=>{let o=()=>{i.innerHTML=Xl(e,a,t.getScale(),n)};o(),r!==`interactive`&&t.on(`resize`,o)})}}function Xl(e,t,n,r){let{title:i,titleColor:a=`#000000`,titleFontSize:o=20,titleJustify:s=`center`,subtitle:c,subtitleColor:l=`#000000`,subtitleFontSize:u=12,subtitleJustify:d=`center`,background:f=`#ffffff`,showBackground:p=!1}=e,m=r.resolve(e.titleFont??t),h=r.resolve(e.subtitleFont??t),g=0,_=0,v=0,y=0,b=0,x=i.trim().length>0?qe([i],m,o):null,S=c.trim().length>0?qe([c],h,u):null;if(g=Math.max(x?.width??0,S?.width??0),x){let{ascent:e,descent:t}=x;_=e+t,y=8+e}if(S){let{ascent:e,descent:t}=S;v=e+t,b=x?y+x.descent+e:8+e}let C=g+16,w=_+v+16,T=s===`center`?C/2:s===`right`?C-8:8,E=d===`center`?C/2:d===`right`?C-8:8,D=``;if(D+=`<svg class="adornment-svg" data-adornment-name="${B(e.name)}" xmlns="http://www.w3.org/2000/svg" width="${C*n}" height="${w*n}" viewBox="0 0 ${C} ${w}">`,D+=`<rect x="0" y="0" width="${C}" height="${w}" ${H(f)} rx="6" style="visibility:${p?`visible`:`hidden`}" />`,x||S){let e=s===`center`?`middle`:s===`right`?`end`:`start`,t=d===`center`?`middle`:d===`right`?`end`:`start`;D+=`<text x="${T}" y="${y}" ${H(a)} ${we(m)} font-size="${o}" text-anchor="${e}">`,x&&(D+=`${B(i)}`),S&&(D+=`<tspan x="${E}" y="${b}" ${H(l)} ${we(h)} font-size="${u}" text-anchor="${t}">`,D+=`${B(c)}`,D+=`</tspan>`),D+=`</text>`}return D+=`</svg>`,D}var Zl={"sky-color":`#6babff`,"sky-horizon-blend":1,"horizon-color":[`interpolate-hcl`,[`linear`],[`zoom`],0,`#edf7fc`,9,`#edf7fc`,10,`#dcf0fa`],"horizon-fog-blend":.5,"fog-color":`#edf7fc`,"fog-ground-blend":.5,"atmosphere-blend":1},Ql={top_left:{x:5,y:5,unit:`px`},top_center:{x:0,y:5,unit:`px`},top_right:{x:5,y:5,unit:`px`},right_center:{x:5,y:0,unit:`px`},bottom_right:{x:5,y:5,unit:`px`},bottom_center:{x:0,y:5,unit:`px`},bottom_left:{x:5,y:5,unit:`px`},left_center:{x:5,y:0,unit:`px`}},$l={top_left:{x:`left`,y:`top`},top_center:{x:`center`,y:`top`},top_right:{x:`right`,y:`top`},right_center:{x:`right`,y:`center`},bottom_right:{x:`right`,y:`bottom`},bottom_center:{x:`center`,y:`bottom`},bottom_left:{x:`left`,y:`bottom`},left_center:{x:`left`,y:`center`}},eu={fill:{props:[`fill-opacity`],defaultValue:1},line:{props:[`line-opacity`],defaultValue:1},circle:{props:[`circle-opacity`,`circle-stroke-opacity`],defaultValue:1},heatmap:{props:[`heatmap-opacity`],defaultValue:1},"fill-extrusion":{props:[`fill-extrusion-opacity`],defaultValue:1},symbol:{props:[`icon-opacity`,`text-opacity`],defaultValue:1},raster:{props:[`raster-opacity`],defaultValue:1},hillshade:{props:[`hillshade-exaggeration`],defaultValue:.5},"color-relief":{props:[`color-relief-opacity`],defaultValue:1},background:{props:[`background-opacity`],defaultValue:1},custom:{props:[],defaultValue:1}},tu=[`beforeWaters`,`beforeBoundaries`,`beforeNames`,`beforeNone`],nu={beforeWaters:`mc-before-waters`,beforeBoundaries:`mc-before-boundaries`,beforeNames:`mc-before-names`,beforeNone:`mc-before-none`},ru={jpg:`static`,png:`static`,svg:`static`,pdf:`static`,tiff:`static`,eps:`static`,eps_log:`static`,mp4:`video`,mov:`video`,mkv:`video`,mxf:`video`,webm:`video`,jpg_sequence:`video`,png_sequence:`video`,web_video:`video`,web:`interactive`,web_download:`interactive`},iu=[`top_left`,`top_right`,`bottom_left`,`bottom_right`,`top_center`,`left_center`,`right_center`,`bottom_center`],au=new Map,ou=e=>au.delete(e);async function su(e,t,n,r,i,a,o){let s=[...e.adornments??[]],{fonts:c}=r;cu(n),lu(n,t,o);let l=[],u=s.some(e=>![`copyright`,`webControls`].includes(e.type));Pa()&&u&&!s.some(e=>e.type===`webControls`)&&s.unshift({type:`webControls`,id:`web_controls`,name:`Web controls`,position:`top_left`,stacking:`vertical`,buttons:[]}),s.forEach(t=>{if(t.type===`custom`)du(n,de(t,n,o),t.position,t.stacking);else if(t.type===`northArrow`)du(n,Xi(t,n,o),t.position,t.stacking);else if(t.type===`webControls`&&t.buttons&&o===`interactive`)du(n,Fa(t,n,r,i,u),t.position,t.stacking);else if(t.type===`scalebar`){let{element:e,ready:r}=ql(t,n,c,o);du(n,e,t.position,t.stacking),l.push(r)}else if(t.type===`insetMap`){let{element:e,ready:r}=Ll(t,n,a,o);du(n,e,t.position,t.stacking),l.push(r)}else if(t.type===`heading`){let{element:e,ready:r}=Yl(t,n,c,o);du(n,e,t.position,t.stacking),l.push(r)}else if(t.type===`manualLegend`){let{element:e,ready:r}=Yi(t,n,c,o);du(n,e,t.position,t.stacking),l.push(r)}else if(t.type===`connectedLegend`){let{element:r,ready:i}=Vi(t,e,n,c,o);du(n,r,t.position,t.stacking),l.push(i)}else if(t.type===`copyright`&&o!==`interactive`){let{element:e,ready:r}=Ra(t,n,c);du(n,e,t.position,t.stacking),l.push(r)}}),n.on(`resize`,()=>lu(n,t,o)),await Promise.all(l)}function cu(e){let t=new Map,n=e.getContainer(),r=window.getComputedStyle(n);n.style.setProperty(`--adornment-text-direction`,r.direction),n.style.setProperty(`--adornment-text-writing-mode`,r.writingMode);for(let e of iu){let r=document.createElement(`div`),i=document.createElement(`div`),a=document.createElement(`div`);r.classList.add(`adornment-container`,e),i.classList.add(`inner`),a.classList.add(`inner`,`vertical`),r.append(i,a),n.appendChild(r),t.set(e,{container:r,horizontal:i,vertical:a})}au.set(e,t)}function lu(e,t,n){let r=au.get(e),i=e.getScale();if(r){e.getContainer().style.setProperty(`--adornment-spacing`,`${5*i}px`);for(let[e,{container:a}]of r)a.style.cssText=uu(e,t[e],i,n)}}function uu(e,t,n,r){let i=$l[e],a=``,o=[],{x:s,y:c,unit:l}=t;return l===`px`&&(s*=n,c*=n),i.x===`center`?o.push(`translateX(${s}${l})`):a+=`${i.x}: ${s}${l};`,i.y===`center`?o.push(`translateY(${c}${l})`):e===`bottom_right`&&r===`interactive`?a+=`${i.y}: max(${c}${l}, 25px);`:a+=`${i.y}: ${c}${l};`,o.length&&(a+=`transform: ${o.join(` `)};`),a}function du(e,t,n,r){Pa()&&!t.classList.contains(`web-control`)&&t.classList.add(`hide`),r||=[`left_center`,`right_center`].includes(n)?`vertical`:`horizontal`;let i=au.get(e)?.get(n),a=n===`left_center`||n===`right_center`?`vertical`:`horizontal`;i?.[a].hasChildNodes()||(r=a),(i?.[r])?.appendChild(t)}function fu(e){for(let t of tu){let n=nu[t];e.layers.find(e=>e.id===n)===void 0&&(e.sources.empty===void 0&&(e.sources.empty={type:`geojson`,data:{type:`FeatureCollection`,features:[]}}),e.layers.push({id:n,type:`fill`,source:`empty`,layout:{visibility:`none`}}))}}function pu(e,t,n,r,i){e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:t.models.filter(e=>e.visible??!0).map(e=>mu(t,e,r,i))}}),e.addLayer({id:t.id,type:`fill`,source:t.id,metadata:{"mc-model-type":`polygon`,"mc-group-id":t.id},paint:{"fill-color":[`get`,`fill-color`],"fill-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n),e.addLayer({id:`${t.id}-pattern`,type:`fill`,source:t.id,filter:[`has`,`fill-pattern`],paint:{"fill-pattern":[`get`,`fill-pattern`],"fill-opacity":[`coalesce`,[`feature-state`,`opacity`],1]},metadata:{"mc-model-type":`polygon`,"mc-group-id":t.id}},n),e.addLayer({id:`${t.id}-outline`,type:`line`,source:t.id,metadata:{"mc-model-type":`polygon`,"mc-group-id":t.id},layout:{"line-cap":`round`,"line-join":`round`},paint:{"line-width":[`get`,`outline-width`],"line-color":[`get`,`outline-color`],"line-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n)}function mu(e,t,n,r){let i=t.fillPattern===void 0?void 0:r.getMapLibreImageKey(n[t.fillPattern],2*window.devicePixelRatio);return{type:`Feature`,id:E(t.id),properties:{id:t.id,"fill-color":e.fillColor||t.fillColor?Je(t.dataBindings??{},t.fillColor,e.fillColor):`#000000`,"outline-color":e.outlineColor||t.outlineColor?Je(t.dataBindings??{},t.outlineColor,e.outlineColor):`#000000`,"outline-width":t.outlineWidth??0,"fill-pattern":i},geometry:{type:`Polygon`,coordinates:Si(t)}}}function hu(e,t,n,r,i){e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:t.models.filter(e=>e.visible??!0).map(e=>gu(t,e,1,r,i))}}),e.addLayer({id:t.id,type:`fill`,source:t.id,metadata:{"mc-model-type":`circle`,"mc-group-id":t.id},filter:[`==`,[`geometry-type`],`Polygon`],paint:{"fill-color":[`get`,`fill-color`],"fill-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n),e.addLayer({id:`${t.id}-pattern`,type:`fill`,source:t.id,filter:[`has`,`fill-pattern`],paint:{"fill-pattern":[`get`,`fill-pattern`],"fill-opacity":[`coalesce`,[`feature-state`,`opacity`],1]},metadata:{"mc-model-type":`circle`,"mc-group-id":t.id}},n),e.addLayer({id:`${t.id}-radius-line`,type:`line`,source:t.id,metadata:{"mc-model-type":`circle`,"mc-group-id":t.id},filter:[`all`,[`==`,[`geometry-type`],`LineString`],[`get`,`radius-line-enabled`]],paint:{"line-color":[`get`,`radius-line-color`],"line-width":[`get`,`radius-line-width`],"line-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n),e.addLayer({id:`${t.id}-outline`,type:`line`,source:t.id,metadata:{"mc-model-type":`circle`,"mc-group-id":t.id},filter:[`==`,[`geometry-type`],`Polygon`],layout:{"line-cap":`round`,"line-join":`round`},paint:{"line-width":[`get`,`outline-width`],"line-color":[`get`,`outline-color`],"line-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n)}function gu(e,t,n,r,i){let a=t.fillPattern===void 0?void 0:i.getMapLibreImageKey(r[t.fillPattern],2*window.devicePixelRatio);return{type:`Feature`,id:E(t.id),properties:{id:t.id,"fill-color":e.fillColor||t.fillColor?Je(t.dataBindings??{},t.fillColor,e.fillColor):`#000000`,"outline-color":e.outlineColor||t.outlineColor?Je(t.dataBindings??{},t.outlineColor,e.outlineColor):`#000000`,"outline-width":t.outlineWidth??0,"fill-pattern":a,"radius-line-enabled":t.radiusLineEnabled??!1,"radius-line-color":e.radiusLineColor||t.radiusLineColor?Je(t.dataBindings??{},t.radiusLineColor,e.radiusLineColor):`#000000`,"radius-line-width":t.radiusLineWidth??0},geometry:{type:`GeometryCollection`,geometries:[{type:`Polygon`,coordinates:[_i(t.center,t.radius*n)]},{type:`LineString`,coordinates:vi(t.center,t.radius*n,t.radiusLineBearing??0)}]}}}var _u=`Roboto-Regular`;function vu(e,t,n,r,i,a){let o=[],s=new Set,c=new Set,l=[`match`,[`get`,`text-font`]],u=!!t.clustering;for(let n of t.models)(n.visible??!0)&&o.push(bu(e,t,n,1,r,i)),s.add(n.textFont),c.add(n.textLineHeight??1.2);if(Array.from(s).length>0){for(let e of Array.from(s))l.push(e,[`literal`,[e,_u]]);l.push([`literal`,[_u]])}e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:o},cluster:u,clusterRadius:t.clusterRadius??50,clusterMaxZoom:t.clusterMaxZoom??14});let d=!t.collisionDetection,f=t.labelCollisionDetection===void 0?d:!t.labelCollisionDetection;c.forEach(r=>{e.addLayer({id:`${t.id}-${r}`,type:`symbol`,source:t.id,metadata:{"mc-model-type":`marker`,"mc-group-id":t.id},layout:{"icon-allow-overlap":d,"icon-ignore-placement":d,"text-allow-overlap":f,"text-ignore-placement":f,"text-optional":!0,"icon-image":[`get`,`mc-image-key`],"icon-anchor":[`get`,`icon-anchor`],"icon-size":[`get`,`icon-size`],"icon-rotate":[`get`,`icon-rotate`],"icon-offset":[`get`,`icon-offset`],"text-field":`{text}`,"text-font":l,"text-max-width":[`get`,`text-max-width`],"text-offset":[`get`,`text-offset`],"text-rotate":[`get`,`text-rotate`],"text-size":[`get`,`text-size`],"text-anchor":[`get`,`text-anchor`],"text-letter-spacing":[`get`,`text-letter-spacing`],"text-line-height":r,"text-justify":[`get`,`text-justify`]},paint:{"icon-opacity":[`coalesce`,[`feature-state`,`opacity`],1],"text-color":[`get`,`text-color`],"text-halo-color":[`get`,`text-halo-color`],"text-halo-width":[`get`,`text-halo-width`],"text-opacity":[`coalesce`,[`feature-state`,`opacity`],1]},filter:[`all`,[`==`,[`get`,`text-line-height`],r],[`!`,[`has`,`point_count`]]]},n)}),u&&(e.addLayer({id:`${t.id}-circle-cluster`,type:`circle`,source:t.id,filter:[`has`,`point_count`],paint:{"circle-color":{property:`point_count`,type:`interval`,stops:t.clusterCircleColor??[]},"circle-radius":{property:`point_count`,type:`interval`,stops:t.clusterCircleRadius??[]}}}),e.addLayer({id:`${t.id}-text-cluster`,type:`symbol`,source:t.id,filter:[`has`,`point_count`],paint:{"text-color":{property:`point_count`,type:`interval`,stops:t.clusterTextColor??[]}},layout:{"text-font":[`literal`,[_u]],"text-field":`{point_count_abbreviated}`,"text-size":{property:`point_count`,type:`interval`,stops:t.clusterTextSize??[]}}}),a===`interactive`&&(e.addSource(`${t.id}-selected-element`,{type:`geojson`,data:{type:`FeatureCollection`,features:[]}}),c.forEach(n=>{e.addLayer({id:`${t.id}-selected-element-${n}`,type:`symbol`,source:`${t.id}-selected-element`,metadata:{"mc-model-type":`marker`,"mc-group-id":t.id},layout:{"icon-allow-overlap":!0,"icon-ignore-placement":!0,"text-allow-overlap":!0,"text-ignore-placement":!0,"icon-image":[`get`,`mc-image-key`],"icon-anchor":[`get`,`icon-anchor`],"icon-size":[`get`,`icon-size`],"icon-rotate":[`get`,`icon-rotate`],"icon-offset":[`get`,`icon-offset`],"text-field":`{text}`,"text-font":l,"text-max-width":[`get`,`text-max-width`],"text-offset":[`get`,`text-offset`],"text-rotate":[`get`,`text-rotate`],"text-size":[`get`,`text-size`],"text-anchor":[`get`,`text-anchor`],"text-letter-spacing":[`get`,`text-letter-spacing`],"text-line-height":n,"text-justify":[`get`,`text-justify`]},paint:{"icon-opacity":[`coalesce`,[`feature-state`,`opacity`],[`global-state`,`opacity-${t.id}`],1],"text-color":[`get`,`text-color`],"text-halo-color":[`get`,`text-halo-color`],"text-halo-width":[`get`,`text-halo-width`],"text-opacity":[`coalesce`,[`feature-state`,`opacity`],[`global-state`,`opacity-${t.id}`],1]},filter:[`all`,[`==`,[`get`,`text-line-height`],n],[`!`,[`has`,`point_count`]]]})}),yu(e,t)))}function yu(e,t){e.on(`click`,`${t.id}-circle-cluster`,async t=>{let n=e.queryRenderedFeatures(t.point).find(e=>e.properties.cluster);if(!n)return;let r=e.getSource(n.source);if(!r)return;let i=await r.getClusterExpansionZoom(Number(n.id));e.easeTo({center:n.geometry.coordinates,zoom:i})})}function bu(e,t,n,r,i,a){let o=n.svg===void 0?void 0:Xe(n.dataBindings??{},i[n.svg],t.svg?i[t.svg]:void 0),s=o===void 0?void 0:a.getMapLibreImageKey(o,window.devicePixelRatio*(n.iconScale??1)*e.getScale()),c=o===void 0?void 0:Ve(o);return{type:`Feature`,id:E(n.id),properties:{id:n.id,"mc-image-key":s,"mc-svg-string":o,"icon-anchor":n.iconAnchor??`center`,"icon-rotate":n.iconRotation??0,"icon-offset":n.iconOffset??[0,0],"icon-size":(n.iconScale??1)*r,"icon-collision-box":c??[0,0,0,0],text:t.text||n.text?Ye(n.dataBindings??{},n.text,t.text):void 0,"text-anchor":n.textAnchor??`center`,"text-font":n.textFont,"text-offset":[(n.textOffset?.[0]??0)/(n.textSize??16),(n.textOffset?.[1]??0)/(n.textSize??16)],"text-rotate":n.textRotation??0,"text-max-width":n.textMaxWidth??10,"text-size":(n.textSize??16)*r,"text-color":t.textColor||n.textColor?Je(n.dataBindings??{},n.textColor,t.textColor):`#000000`,"text-halo-color":t.textHaloColor||n.textHaloColor?Je(n.dataBindings??{},n.textHaloColor,t.textHaloColor):`#000000`,"text-halo-width":n.textHaloWidth??0,"text-line-height":n.textLineHeight??1.2,"text-letter-spacing":n.textLetterSpacing??0,"text-justify":n.textJustify??`center`},geometry:{type:`Point`,coordinates:[n.lngLat.lng,n.lngLat.lat]}}}async function xu(e,t,n,r,i,a){let o=await Promise.all(t.map(e=>`${r}/styles/${e}.json?access_token=${i}`).map(e=>fetch(e).then(e=>e.json()))),s=re(o.map(e=>e.sprite).filter(e=>typeof e==`string`));await Promise.all(s.map(e=>n.loadSprite(e).then(e=>n.addImages(e)).catch(()=>{})));for(let t=0;t<e.length;t++){let r=e[t],i=o[t];for(let e of i.layers)e.metadata===void 0&&(e.metadata={}),e.metadata[`mc-original-layer-id`]=e.id,e.id=`${r} | ${e.id}`;Su(i,n,a)}return o}function Su(e,t,n){for(let n in e.sources)t.getSource(n)===void 0&&t.addSource(n,e.sources[n]);for(let r of e.layers){t.getLayer(r.id)!==void 0&&t.removeLayer(r.id);let e=r.metadata?.[`mc-add-before`]??`mc-before-none`;t.addLayer(Cu(r,n),e)}}function Cu(e,t){let n=t??{},r=e.metadata?.[`mc-original-layer-id`],i=r===void 0?{}:n[r]??{},a={...e,layout:{...e.layout,...i.layout},paint:{...e.paint,...i.paint},metadata:{...e.metadata,...i.metadata}};return i.minzoom!==void 0&&(a.minzoom=i.minzoom),i.maxzoom!==void 0&&(a.maxzoom=i.maxzoom),`filter`in i&&a.type!==`background`&&(a.filter=i.filter),a}var wu=`<svg xmlns="http://www.w3.org/2000/svg" width="6" height="10" viewBox="0 0 6 10" fill="currentColor"><path d="m0 4.647 4.282 4.4a.814.814 0 0 0 1.166-1.134L2.27 4.647l3.178-3.266A.814.814 0 1 0 4.282.246z"/></svg>
458
+ `,Tu=`<svg xmlns="http://www.w3.org/2000/svg" width="10" height="11" viewBox="0 0 10 11" fill="currentColor"><path d="M.21.71a.714.714 0 0 1 1.011 0l3.78 3.78L8.778.71a.715.715 0 0 1 1.013 1.01L6.01 5.501l3.78 3.778a.715.715 0 0 1-1.01 1.012L5 6.51l-3.779 3.78A.716.716 0 0 1 .21 9.28L3.99 5.5.21 1.721A.714.714 0 0 1 .21.71"/></svg>
459
+ `,Eu=`<svg xmlns="http://www.w3.org/2000/svg" width="6" height="10" viewBox="0 0 6 10" fill="currentColor"><path d="m5.678 4.647-4.282 4.4A.814.814 0 1 1 .23 7.914l3.177-3.266L.23 1.381A.814.814 0 1 1 1.396.246z"/></svg>
460
+ `,Du=`<svg width="20" height="20" viewBox="0 0 40 40" stroke="currentColor" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M20 4.167 1.667 35.834h36.667z" stroke-width="2" stroke-linejoin="round"/><path d="M20 29.167v.834m0-14.167.007 8.333" stroke-width="2" stroke-linecap="round"/></svg>
461
+ `;function Ou(e,t){let{allowFullscreen:n,loop:r}=e,i=D(e.src,t),a,o=i.match(/(?:youtube\.com\/(?:watch\?.*v=|embed\/|v\/)|youtu\.be\/)([-\w]{11})/)?.[1];a=o?`https://www.youtube.com/embed/${o}`:i;let s=[];if(n||s.push(`fs=0`),r&&o&&s.push(`loop=1&playlist=${o}`),a=Au(a),a=ku(a),s.length){let e=a.includes(`?`)?`&`:`?`;a+=`${e}${s.join(`&`)}`}return a}function ku(e){return e.replace(/([?&])si=[^&]+(&)?/,(e,t,n)=>t===`?`&&!n?``:t===`?`&&n?`?`:n?`&`:``)}function Au(e){let t=new URL(e),n=t.searchParams.get(`t`);if(!n)return e;let r=0,i=/^((\d+)m)?((\d+)s)?$/;if(/^\d+$/.test(n))r=parseInt(n,10);else{let e=n.match(i);if(e){let t=parseInt(e[2]||`0`,10),n=parseInt(e[4]||`0`,10);r=t*60+n}}return r>0&&(t.searchParams.delete(`t`),t.searchParams.set(`start`,String(r))),t.toString()}function ju(e,t,n,r){let i;if(t?.type===`video`)i=r?Iu(t.src,n):`
462
462
  <div class="youtube-container">
463
463
  <iframe
464
- src="${Tu(t,n)}"
464
+ src="${Ou(t,n)}"
465
465
  width="100%" height="300" style="border: none" allowfullscreen>
466
466
  </iframe>
467
467
  </div>
@@ -469,39 +469,39 @@ import{AttributionControl as e,Event as t,Evented as n,LngLatBounds as r,Map as
469
469
  <div class="image-container ${t.fill?`fill`:``}">
470
470
  <img src="${e}" alt="${r}" />
471
471
  </div>
472
- `}i=i?`<div class="media-content">${i}</div>`:``;let a=e?`<div class="text-content">${ju(e,n)}</div>`:``;return`
472
+ `}i=i?`<div class="media-content">${i}</div>`:``;let a=e?`<div class="text-content">${Pu(e,n)}</div>`:``;return`
473
473
  <div class="popup-scroll-wrapper">
474
474
  <div class="mc-popup">
475
475
  ${i}
476
476
  ${a}
477
477
  </div>
478
478
  </div>
479
- `}var ku=`
479
+ `}var Mu=`
480
480
  <button class="mc-popup-button close">
481
- ${Su}
481
+ ${Tu}
482
482
  </button>
483
- `,Au=`
483
+ `,Nu=`
484
484
  <div class="cycle-buttons">
485
485
  <button class="mc-popup-button prev">
486
- ${xu}
486
+ ${wu}
487
487
  </button>
488
488
  <button class="mc-popup-button next">
489
- ${Cu}
489
+ ${Eu}
490
490
  </button>
491
491
  </div>
492
- `;function ju(e,t){return e?(e=e.replace(/placeholder="[^"]+"/,``),e=e.replace(/onerror="[^"]+"/,``),e=e.replace(/youtube\.com\/embed\/\$([^"'<>\\]+)/gi,(e,n)=>{let r=O(t[n]);return r?`youtube.com/embed/${A(r)}?`:``}),e=e.replace(/(\S+?)\s*=\s*"\$([^"]+?)"/g,(e,n,r)=>{let i=O(t[r]);return[`src`,`href`].includes(n)&&!i?``:[`src`,`href`].includes(n)?/^(mailto:|tel:|ftp:|data:|http:\/\/|https:\/\/)/i.test(i)?` ${n}="${i}"`:` ${n}="${Mu(i)}"`:` ${n}="${i}"`}),e=e.replace(/>\$(.+?)</gi,(e,n)=>`>${O(t[n])}<`),e=e.replace(/<span\s+class="mention"\s+data-mention-id="[^"]*">(.*?)<\/span>/gim,(e,t)=>t),e):``}function Mu(e){return/^https?:\/\//i.test(e)?e:`https://${e}`}function Nu(e,t){return`
492
+ `;function Pu(e,t){return e?(e=e.replace(/placeholder="[^"]+"/,``),e=e.replace(/onerror="[^"]+"/,``),e=e.replace(/youtube\.com\/embed\/\$([^"'<>\\]+)/gi,(e,n)=>{let r=O(t[n]);return r?`youtube.com/embed/${A(r)}?`:``}),e=e.replace(/(\S+?)\s*=\s*"\$([^"]+?)"/g,(e,n,r)=>{let i=O(t[r]);return[`src`,`href`].includes(n)&&!i?``:[`src`,`href`].includes(n)?/^(mailto:|tel:|ftp:|data:|http:\/\/|https:\/\/)/i.test(i)?` ${n}="${i}"`:` ${n}="${Fu(i)}"`:` ${n}="${i}"`}),e=e.replace(/>\$(.+?)</gi,(e,n)=>`>${O(t[n])}<`),e=e.replace(/<span\s+class="mention"\s+data-mention-id="[^"]*">(.*?)<\/span>/gim,(e,t)=>t),e):``}function Fu(e){return/^https?:\/\//i.test(e)?e:`https://${e}`}function Iu(e,t){return`
493
493
  <div class="youtube-placeholder">
494
494
  <img src="${`https://img.youtube.com/vi/${A(D(e,t))}/hqdefault.jpg`}" />
495
495
  <div class="popup-alert">
496
- <div class="alert-icon">${wu}</div>
497
- <div>${Oa(`videoAlert`)}</div>
496
+ <div class="alert-icon">${Du}</div>
497
+ <div>${ja(`videoAlert`)}</div>
498
498
  </div>
499
499
  </div>
500
- `}var Pu=[`area`,`circle`,`dot`,`line`,`marker`,`polygon`],Fu=class{models;groups;customGroupIds;constructor(e){this.models={area:{},circle:{},dot:{},line:{},marker:{},polygon:{}},this.groups={area:{},circle:{},dot:{},line:{},marker:{},polygon:{}};for(let t of Pu)for(let n of e.registry?.models?.[t]??[]){this.models[t][n.id]={},this.groups[t][n.id]=n;for(let e of n.models){if(t===`area`){let t=e;t.featureId===void 0&&(t.featureId=Number(t.id),t.id=`${t.vectorUrl}-${t.id}`)}this.models[t][n.id][e.id]=e}}let{beforeWaters:t=[],beforeBoundaries:n=[],beforeNames:r=[],beforeNone:i=[]}=e.registry?.slots??{};this.customGroupIds=[...t,...n,...r,...i].map(e=>e.groupId)}getModel(e){let t=String(e.properties?.id),n=e.layer.metadata,r=n?.[`mc-group-id`],i=n?.[`mc-model-type`],a=n?.[`mc-model-id-prefix`];if(a&&(t=`${a}-${t}`),!(r===void 0||t===void 0||i===void 0))return this.models[i]?.[r]?.[t]}getPopupElements(){let e=[],t=[`circle`,`dot`,`line`,`marker`,`polygon`];for(let n of this.customGroupIds)for(let r of t){let t=this.models[r]?.[n];if(t)for(let[r,i]of Object.entries(t))(i.popup||i.popupMedia)&&e.push({groupId:n,modelId:r,popup:i.popup,popupMedia:i.popupMedia,lngLat:i.lngLat,center:i.center,radius:i.radius,anchorPoints:i.anchorPoints,dataBindings:i.dataBindings})}return e.reverse()}},Iu=class{map;popupElements;currentPopupElement;markerLayerIds;resizeObserver;hiddenCluster;clusterCheckId=0;constructor(e,t){this.map=e,this.popupElements=t,this.markerLayerIds=this.map.getStyle().layers.filter(e=>e.id.startsWith(`custom-marker`)).filter(e=>!e.id.endsWith(`-cluster`)).filter(e=>!e.id.includes(`-selected-element-`)).map(e=>e.id),this.map.on(`zoomend`,()=>{requestAnimationFrame(()=>{this.refreshCurrentCluster()})})}highlight(e,t=!1){if(this.currentPopupElement=e,this.clusterCheckId++,this.resetHiddenCluster(),this.deselect(),!e)return;let{groupId:n,modelId:r}=e,i=this.popupElements.filter(e=>e.groupId===n);i.length>1&&n.startsWith(`custom-marker`)&&this.highlightGroupedMarker(n,r,i),n.startsWith(`custom-marker`)&&this.fadeOtherMarkers(n),this.repositionMap(e,t),t||this.resetCluster(n)}resetCluster(e){this.resetHiddenCluster(),this.setSelectedClusterState(e)}setSelectedClusterState(e,t,n){let r=this.map.getSource(`${e}-selected-element`);r&&r.setData({type:`FeatureCollection`,features:t?[t]:[]});let i=n===void 0?[`has`,`point_count`]:[`all`,[`has`,`point_count`],[`!=`,[`get`,`cluster_id`],n]];this.map.getLayer(`${e}-circle-cluster`)&&this.map.getLayer(`${e}-text-cluster`)&&(this.map.setFilter(`${e}-circle-cluster`,i),this.map.setFilter(`${e}-text-cluster`,i))}resetHiddenCluster(){if(!this.hiddenCluster)return;let{source:e}=this.hiddenCluster,t=this.map.getSource(`${e}-selected-element`);t&&t.setData({type:`FeatureCollection`,features:[]}),this.map.getLayer(`${e}-circle-cluster`)&&this.map.getLayer(`${e}-text-cluster`)&&(this.map.setFilter(`${e}-circle-cluster`,[`has`,`point_count`]),this.map.setFilter(`${e}-text-cluster`,[`has`,`point_count`])),this.hiddenCluster=void 0}async checkCluster(e){let{lngLat:t,groupId:n,modelId:r}=e;if(!t){this.resetHiddenCluster();return}let i=++this.clusterCheckId,a=this.map.getSource(n);if(!a||!this.map.getLayer(`${n}-circle-cluster`)){this.resetCluster(n);return}let o=this.map.project(t),s=[[o.x-100,o.y-100],[o.x+100,o.y+100]],c=this.map.queryRenderedFeatures(s,{layers:[`${n}-circle-cluster`]}),l=new Set;for(let e of c){let t=e.properties?.cluster_id;t!==void 0&&l.add(t)}if(this.hiddenCluster&&this.hiddenCluster.source===n&&l.add(this.hiddenCluster.clusterId),!l.size){this.resetCluster(n);return}for(let e of l)try{let t=await a.getClusterLeaves(e,1/0,0);if(i!==this.clusterCheckId)return;let o=t.find(e=>e.properties?.id===r);if(o){this.resetHiddenCluster(),this.hiddenCluster={clusterId:e,source:n},this.setSelectedClusterState(n,o,e);return}}catch{i===this.clusterCheckId&&this.resetCluster(n)}this.resetCluster(n)}refreshCurrentCluster(){let e=this.currentPopupElement;e?.lngLat&&e.groupId.startsWith(`custom-marker`)&&this.checkCluster(e)}deselect(){this.markerLayerIds.forEach(e=>{this.map.setPaintProperty(e,`icon-opacity`,1),this.map.setPaintProperty(e,`text-opacity`,1)}),this.resizeObserver?.disconnect()}highlightGroupedMarker(e,t,n){let r=this.markerLayerIds.find(t=>t.startsWith(e));r&&(this.map.setPaintProperty(r,`icon-opacity`,[`case`,[`boolean`,[`feature-state`,`highlighted`],!1],1,.3]),this.map.setPaintProperty(r,`text-opacity`,[`case`,[`boolean`,[`feature-state`,`highlighted`],!1],1,.3]),n.forEach(n=>{this.map.setFeatureState({source:e,id:E(n.modelId)},{highlighted:n.modelId===t})}))}fadeOtherMarkers(e){this.markerLayerIds.filter(t=>!t.startsWith(e)).forEach(e=>{this.map.setPaintProperty(e,`icon-opacity`,.3),this.map.setPaintProperty(e,`text-opacity`,.3)})}repositionMap(e,t){let n,i=20;e.lngLat===void 0?e.anchorPoints===void 0?e.center!==void 0&&e.radius!==void 0&&(n=this.getElementBounds(_i(e.center,e.radius))):n=this.getElementBounds(this.flattenCoordinates(e.anchorPoints)):(n=new r(e.lngLat,e.lngLat),i=40);let a=document.querySelector(`.popup-container`);if(!a||!n)return;this.resizeObserver?.disconnect();let o=0;this.resizeObserver=new ResizeObserver(r=>{let a=r[0].contentRect.height;a>o&&(o=a,this.panToElement(n,i,e,t))}),this.resizeObserver.observe(a)}getElementBounds(e){let t=new r(e[0],e[0]);for(let n of e)t.extend(n);return t}flattenCoordinates(e){return Array.isArray(e[0][0])?e.flat():e}panToElement(e,t,n,r){let i=this.map;if(i.getProjection()?.type===`globe`&&[e.getSouthWest(),e.getNorthEast(),e.getNorthWest(),e.getSouthEast()].some(e=>!ie(this.map,e.lng,e.lat))){i.easeTo({center:e.getCenter(),duration:500}),r&&i.once(`moveend`,()=>{this.currentPopupElement&&this.checkCluster(n)});return}let a=i.projectWithScaleCorrection(e.getSouthWest()),o=i.projectWithScaleCorrection(e.getNorthEast()),s=i.getContainer().clientWidth,c=i.getContainer().clientHeight,l=s>600,u=document.querySelector(`.popup-container`)?.getBoundingClientRect(),d=u?.width??0,f=u?.height??0;l||(f=Math.min(f,c/2));let p=c-a.y>f+t,m=a.x>t+(l&&!p?d:0),h=o.x<s-t,g=o.y>t,_=l?a.y<c-t:p;if(m&&h&&g&&_)r&&this.checkCluster(n);else{if(o.x-a.x+2*t<s&&a.y-o.y+2*t<c){let t=e.getCenter();i.easeTo({center:t,duration:500,offset:l?[0,0]:[0,-30]})}else i.fitBounds(e,{padding:t,maxZoom:i.getZoom(),duration:500,linear:!0});r&&i.once(`moveend`,()=>{this.currentPopupElement&&this.checkCluster(n)})}}},Lu=class{map;youTubePlaceholder;language=`en`;publication;restrictMapMovement;center;popupPosition=`bottomLeft`;mapContainer;highlightManager;registry;promoteIdCache=new Map;popupElements=[];popupContainer;floatingPopup;feature;currentModelId;constructor(e,t){this.map=e,this.youTubePlaceholder=t,this.mapContainer=this.map.getContainer(),this.popupContainer=document.createElement(`div`),this.popupContainer.classList.add(`popup-container`),this.map.on(`mousemove`,e=>this.onMouseMove(e)),this.map.on(`click`,e=>this.onClick(e))}setJobObject(e){this.registry=new Fu(e)}setParams(e,t,n,r){this.popupPosition=e,this.language=t,this.restrictMapMovement=n,this.center=r}setPublication(e){this.publication=e}setpopupElements(){this.popupElements=this.registry.getPopupElements()}setHighlightManager(){this.highlightManager=new Iu(this.map,this.popupElements)}onMouseMove(e){this.feature=this.getInteractiveFeature(e),this.feature?this.map.getCanvas().style.cursor=`pointer`:this.map.getCanvas().style.cursor=``}onClick(e){this.feature=this.getInteractiveFeature(e);let t;this.feature?(t=this.registry.getModel(this.feature)?.id??(this.feature.id===void 0?void 0:String(this.feature.id)),t&&(!this.mapContainer.contains(this.popupContainer)||t!==this.currentModelId)&&(this.currentModelId=t,this.addPopup(e),this.highlightManager?.highlight(this.popupElements.find(e=>e.modelId===t)))):(this.hidePopup(),this.highlightManager?.highlight(void 0),this.currentModelId=void 0)}getInteractiveFeature(e){return this.map.queryRenderedFeatures(e.point).find(e=>{if(Object.keys(e.layer.metadata??{}).some(e=>e.startsWith(`mc-interactivity-template`)))return!0;let t=this.registry.getModel(e);return!!(t?.popup??t?.popupMedia)})}addPopup(e){if(!this.feature)return;this.floatingPopup?.remove();let t=this.getTemplate(this.feature);if(t)if(this.popupPosition===`mapElement`)if(this.feature.geometry.type===`Point`)this.addFloatingPopup(t,this.feature.geometry.coordinates);else{let{lng:n,lat:r}=this.map.unprojectWithScaleCorrection(e.point);this.addFloatingPopup(t,[n,r])}else this.popupContainer.innerHTML=t,this.popupElements.find(e=>e.modelId===this.currentModelId)&&this.addPopupControls(),this.mapContainer.appendChild(this.popupContainer)}addFloatingPopup(e,t){let n=this.restrictMapMovement?this.getAnchor(t):void 0;this.floatingPopup=new s({maxWidth:`none`,closeButton:!1,offset:20,...n!==void 0&&{anchor:n}}).setLngLat(t).setHTML(e).addTo(this.map)}getAnchor(e){let t=this.map.projectWithScaleCorrection(e),n=this.map.getContainer().clientWidth,r=this.map.getContainer().clientHeight,i,a;return i=t.y<r*.33?`top`:t.y>r*.66?`bottom`:`center`,a=t.x<n*.33?`left`:t.x>n*.66?`right`:`center`,i===`center`&&a===`center`?`bottom`:i===`center`?a:a===`center`?i:`${i}-${a}`}hidePopup(){this.popupContainer&&(this.popupContainer.remove(),this.feature=void 0,this.currentModelId=void 0),this.restrictMapMovement&&this.center&&this.map.easeTo({center:this.center})}getTemplate(e){let{layer:t}=e,n,r=this.registry.getModel(e);if(r?.popup||r?.popupMedia)n=Ou(r.popup,r.popupMedia,r.dataBindings??{},this.youTubePlaceholder);else{let r=[];this.publication&&(r.push(`:${this.publication}-${this.language}`),r.push(`:${this.publication}-:en`)),r.push(`:${this.language}`),r.push(`:en`),r.push(``);for(let i of r){let r=t.metadata?.[`mc-interactivity-template${i}`];if(r){n=this.fillDatalayerTemplate(e,r,i);break}}n&&=`
500
+ `}var Lu=[`area`,`circle`,`dot`,`line`,`marker`,`polygon`],Ru=class{models;groups;customGroupIds;constructor(e){this.models={area:{},circle:{},dot:{},line:{},marker:{},polygon:{}},this.groups={area:{},circle:{},dot:{},line:{},marker:{},polygon:{}};for(let t of Lu)for(let n of e.registry?.models?.[t]??[]){this.models[t][n.id]={},this.groups[t][n.id]=n;for(let e of n.models){if(t===`area`){let t=e;t.featureId===void 0&&(t.featureId=Number(t.id),t.id=`${t.vectorUrl}-${t.id}`)}this.models[t][n.id][e.id]=e}}let{beforeWaters:t=[],beforeBoundaries:n=[],beforeNames:r=[],beforeNone:i=[]}=e.registry?.slots??{};this.customGroupIds=[...t,...n,...r,...i].map(e=>e.groupId)}getModel(e){let t=String(e.properties?.id),n=e.layer.metadata,r=n?.[`mc-group-id`],i=n?.[`mc-model-type`],a=n?.[`mc-model-id-prefix`];if(a&&(t=`${a}-${t}`),!(r===void 0||t===void 0||i===void 0))return this.models[i]?.[r]?.[t]}getPopupElements(){let e=[],t=[`circle`,`dot`,`line`,`marker`,`polygon`];for(let n of this.customGroupIds)for(let r of t){let t=this.models[r]?.[n];if(t)for(let[r,i]of Object.entries(t))(i.popup||i.popupMedia)&&e.push({groupId:n,modelId:r,popup:i.popup,popupMedia:i.popupMedia,lngLat:i.lngLat,center:i.center,radius:i.radius,anchorPoints:i.anchorPoints,dataBindings:i.dataBindings})}return e.reverse()}},zu=class{map;popupElements;currentPopupElement;markerLayerIds;resizeObserver;hiddenCluster;clusterCheckId=0;constructor(e,t){this.map=e,this.popupElements=t,this.markerLayerIds=this.map.getStyle().layers.filter(e=>e.id.startsWith(`custom-marker`)).filter(e=>!e.id.endsWith(`-cluster`)).filter(e=>!e.id.includes(`-selected-element-`)).map(e=>e.id),this.map.on(`zoomend`,()=>{requestAnimationFrame(()=>{this.refreshCurrentCluster()})})}highlight(e,t=!1){if(this.currentPopupElement=e,this.clusterCheckId++,this.resetHiddenCluster(),this.deselect(),!e)return;let{groupId:n,modelId:r}=e,i=this.popupElements.filter(e=>e.groupId===n);i.length>1&&n.startsWith(`custom-marker`)&&this.highlightGroupedMarker(n,r,i),n.startsWith(`custom-marker`)&&this.fadeOtherMarkers(n),this.repositionMap(e,t),t||this.resetCluster(n)}resetCluster(e){this.resetHiddenCluster(),this.setSelectedClusterState(e)}setSelectedClusterState(e,t,n){let r=this.map.getSource(`${e}-selected-element`);r&&r.setData({type:`FeatureCollection`,features:t?[t]:[]});let i=n===void 0?[`has`,`point_count`]:[`all`,[`has`,`point_count`],[`!=`,[`get`,`cluster_id`],n]];this.map.getLayer(`${e}-circle-cluster`)&&this.map.getLayer(`${e}-text-cluster`)&&(this.map.setFilter(`${e}-circle-cluster`,i),this.map.setFilter(`${e}-text-cluster`,i))}resetHiddenCluster(){if(!this.hiddenCluster)return;let{source:e}=this.hiddenCluster,t=this.map.getSource(`${e}-selected-element`);t&&t.setData({type:`FeatureCollection`,features:[]}),this.map.getLayer(`${e}-circle-cluster`)&&this.map.getLayer(`${e}-text-cluster`)&&(this.map.setFilter(`${e}-circle-cluster`,[`has`,`point_count`]),this.map.setFilter(`${e}-text-cluster`,[`has`,`point_count`])),this.hiddenCluster=void 0}async checkCluster(e){let{lngLat:t,groupId:n,modelId:r}=e;if(!t){this.resetHiddenCluster();return}let i=++this.clusterCheckId,a=this.map.getSource(n);if(!a||!this.map.getLayer(`${n}-circle-cluster`)){this.resetCluster(n);return}let o=this.map.project(t),s=[[o.x-100,o.y-100],[o.x+100,o.y+100]],c=this.map.queryRenderedFeatures(s,{layers:[`${n}-circle-cluster`]}),l=new Set;for(let e of c){let t=e.properties?.cluster_id;t!==void 0&&l.add(t)}if(this.hiddenCluster&&this.hiddenCluster.source===n&&l.add(this.hiddenCluster.clusterId),!l.size){this.resetCluster(n);return}for(let e of l)try{let t=await a.getClusterLeaves(e,1/0,0);if(i!==this.clusterCheckId)return;let o=t.find(e=>e.properties?.id===r);if(o){this.resetHiddenCluster(),this.hiddenCluster={clusterId:e,source:n},this.setSelectedClusterState(n,o,e);return}}catch{i===this.clusterCheckId&&this.resetCluster(n)}this.resetCluster(n)}refreshCurrentCluster(){let e=this.currentPopupElement;e?.lngLat&&e.groupId.startsWith(`custom-marker`)&&this.checkCluster(e)}deselect(){this.markerLayerIds.forEach(e=>{this.map.setPaintProperty(e,`icon-opacity`,1),this.map.setPaintProperty(e,`text-opacity`,1)}),this.resizeObserver?.disconnect()}highlightGroupedMarker(e,t,n){let r=this.markerLayerIds.find(t=>t.startsWith(e));r&&(this.map.setPaintProperty(r,`icon-opacity`,[`case`,[`boolean`,[`feature-state`,`highlighted`],!1],1,.3]),this.map.setPaintProperty(r,`text-opacity`,[`case`,[`boolean`,[`feature-state`,`highlighted`],!1],1,.3]),n.forEach(n=>{this.map.setFeatureState({source:e,id:E(n.modelId)},{highlighted:n.modelId===t})}))}fadeOtherMarkers(e){this.markerLayerIds.filter(t=>!t.startsWith(e)).forEach(e=>{this.map.setPaintProperty(e,`icon-opacity`,.3),this.map.setPaintProperty(e,`text-opacity`,.3)})}repositionMap(e,t){let n,i=20;e.lngLat===void 0?e.anchorPoints===void 0?e.center!==void 0&&e.radius!==void 0&&(n=this.getElementBounds(_i(e.center,e.radius))):n=this.getElementBounds(this.flattenCoordinates(e.anchorPoints)):(n=new r(e.lngLat,e.lngLat),i=40);let a=document.querySelector(`.popup-container`);if(!a||!n)return;this.resizeObserver?.disconnect();let o=0;this.resizeObserver=new ResizeObserver(r=>{let a=r[0].contentRect.height;a>o&&(o=a,this.panToElement(n,i,e,t))}),this.resizeObserver.observe(a)}getElementBounds(e){let t=new r(e[0],e[0]);for(let n of e)t.extend(n);return t}flattenCoordinates(e){return Array.isArray(e[0][0])?e.flat():e}panToElement(e,t,n,r){let i=this.map;if(i.getProjection()?.type===`globe`&&[e.getSouthWest(),e.getNorthEast(),e.getNorthWest(),e.getSouthEast()].some(e=>!ie(this.map,e.lng,e.lat))){i.easeTo({center:e.getCenter(),duration:500}),r&&i.once(`moveend`,()=>{this.currentPopupElement&&this.checkCluster(n)});return}let a=i.projectWithScaleCorrection(e.getSouthWest()),o=i.projectWithScaleCorrection(e.getNorthEast()),s=i.getContainer().clientWidth,c=i.getContainer().clientHeight,l=s>600,u=document.querySelector(`.popup-container`)?.getBoundingClientRect(),d=u?.width??0,f=u?.height??0;l||(f=Math.min(f,c/2));let p=c-a.y>f+t,m=a.x>t+(l&&!p?d:0),h=o.x<s-t,g=o.y>t,_=l?a.y<c-t:p;if(m&&h&&g&&_)r&&this.checkCluster(n);else{if(o.x-a.x+2*t<s&&a.y-o.y+2*t<c){let t=e.getCenter();i.easeTo({center:t,duration:500,offset:l?[0,0]:[0,-30]})}else i.fitBounds(e,{padding:t,maxZoom:i.getZoom(),duration:500,linear:!0});r&&i.once(`moveend`,()=>{this.currentPopupElement&&this.checkCluster(n)})}}},Bu=class{map;youTubePlaceholder;language=`en`;publication;restrictMapMovement;center;popupPosition=`bottomLeft`;mapContainer;highlightManager;registry;promoteIdCache=new Map;popupElements=[];popupContainer;floatingPopup;feature;currentModelId;constructor(e,t){this.map=e,this.youTubePlaceholder=t,this.mapContainer=this.map.getContainer(),this.popupContainer=document.createElement(`div`),this.popupContainer.classList.add(`popup-container`),this.map.on(`mousemove`,e=>this.onMouseMove(e)),this.map.on(`click`,e=>this.onClick(e))}setJobObject(e){this.registry=new Ru(e)}setParams(e,t,n,r){this.popupPosition=e,this.language=t,this.restrictMapMovement=n,this.center=r}setPublication(e){this.publication=e}setpopupElements(){this.popupElements=this.registry.getPopupElements()}setHighlightManager(){this.highlightManager=new zu(this.map,this.popupElements)}onMouseMove(e){this.feature=this.getInteractiveFeature(e),this.feature?this.map.getCanvas().style.cursor=`pointer`:this.map.getCanvas().style.cursor=``}onClick(e){this.feature=this.getInteractiveFeature(e);let t;this.feature?(t=this.registry.getModel(this.feature)?.id??(this.feature.id===void 0?void 0:String(this.feature.id)),t&&(!this.mapContainer.contains(this.popupContainer)||t!==this.currentModelId)&&(this.currentModelId=t,this.addPopup(e),this.highlightManager?.highlight(this.popupElements.find(e=>e.modelId===t)))):(this.hidePopup(),this.highlightManager?.highlight(void 0),this.currentModelId=void 0)}getInteractiveFeature(e){return this.map.queryRenderedFeatures(e.point).find(e=>{if(Object.keys(e.layer.metadata??{}).some(e=>e.startsWith(`mc-interactivity-template`)))return!0;let t=this.registry.getModel(e);return!!(t?.popup??t?.popupMedia)})}addPopup(e){if(!this.feature)return;this.floatingPopup?.remove();let t=this.getTemplate(this.feature);if(t)if(this.popupPosition===`mapElement`)if(this.feature.geometry.type===`Point`)this.addFloatingPopup(t,this.feature.geometry.coordinates);else{let{lng:n,lat:r}=this.map.unprojectWithScaleCorrection(e.point);this.addFloatingPopup(t,[n,r])}else this.popupContainer.innerHTML=t,this.popupElements.find(e=>e.modelId===this.currentModelId)&&this.addPopupControls(),this.mapContainer.appendChild(this.popupContainer)}addFloatingPopup(e,t){let n=this.restrictMapMovement?this.getAnchor(t):void 0;this.floatingPopup=new s({maxWidth:`none`,closeButton:!1,offset:20,...n!==void 0&&{anchor:n}}).setLngLat(t).setHTML(e).addTo(this.map)}getAnchor(e){let t=this.map.projectWithScaleCorrection(e),n=this.map.getContainer().clientWidth,r=this.map.getContainer().clientHeight,i,a;return i=t.y<r*.33?`top`:t.y>r*.66?`bottom`:`center`,a=t.x<n*.33?`left`:t.x>n*.66?`right`:`center`,i===`center`&&a===`center`?`bottom`:i===`center`?a:a===`center`?i:`${i}-${a}`}hidePopup(){this.popupContainer&&(this.popupContainer.remove(),this.feature=void 0,this.currentModelId=void 0),this.restrictMapMovement&&this.center&&this.map.easeTo({center:this.center})}getTemplate(e){let{layer:t}=e,n,r=this.registry.getModel(e);if(r?.popup||r?.popupMedia)n=ju(r.popup,r.popupMedia,r.dataBindings??{},this.youTubePlaceholder);else{let r=[];this.publication&&(r.push(`:${this.publication}-${this.language}`),r.push(`:${this.publication}-:en`)),r.push(`:${this.language}`),r.push(`:en`),r.push(``);for(let i of r){let r=t.metadata?.[`mc-interactivity-template${i}`];if(r){n=this.fillDatalayerTemplate(e,r,i);break}}n&&=`
501
501
  <div class="popup-scroll-wrapper">
502
502
  <div class="mc-popup data-layer text-content">${n}</div>
503
503
  </div>
504
- `}return n}htmlToElement(e){let t=document.createElement(`template`);return t.innerHTML=e.trim(),t.content.firstElementChild}addPopupControls(){let e=this.htmlToElement(ku);if(e&&(e.addEventListener(`click`,()=>{this.hidePopup(),this.highlightManager.highlight(void 0)}),this.popupContainer.appendChild(e)),this.popupElements.length>1){let e=this.htmlToElement(Au);e&&(e.querySelector(`.prev`)?.addEventListener(`click`,()=>this.cyclePopups(!1)),e.querySelector(`.next`)?.addEventListener(`click`,()=>this.cyclePopups()),this.popupContainer.appendChild(e))}}fillDatalayerTemplate(e,t,n){let r=`data-mention-id`,i=new DOMParser().parseFromString(t,`text/html`).body;for(let t of i.querySelectorAll(`[${r}]`)){let i=this.getProperty(e,t.getAttribute(r),n);i!==void 0&&(t.innerText=i)}return i.innerHTML}getProperty(e,t,n){if(!t)return;let r=t.endsWith(`:en`)?[t.replace(`:en`,n),t]:[t];for(let t of r){let n=e.properties[t]??this.getVectorProperty(e,t);if(n!==void 0)return n}}getVectorProperty(e,t){let n=this.promoteIdCache.get(e.source);n===void 0&&(n=this.map.getSource(e.source)?.serialize().promoteId||`id`,this.promoteIdCache.set(e.source,n));try{let r=e.properties[n];return e.layer.metadata.properties[t][r]}catch{return}}cyclePopups(e=!0){let t=this.popupElements?.findIndex(e=>e.modelId===this.currentModelId);if(t!==-1){let n=0;n=e?t===this.popupElements.length-1?0:t+1:t===0?this.popupElements.length-1:t-1;let r=this.popupElements?.[n];this.currentModelId=r.modelId,this.highlightManager.highlight(r,!0);let i=Ou(r.popup,r.popupMedia,r.dataBindings??{},this.youTubePlaceholder),a=this.popupContainer;this.popupContainer.remove(),a.innerHTML=i,this.mapContainer.appendChild(a),this.addPopupControls(),e?this.popupContainer.querySelector(`.mc-popup-button.next`)?.focus():this.popupContainer.querySelector(`.mc-popup-button.prev`)?.focus()}}},Ru=class{line;mercatorLine;distances;totalLength;constructor(e){this.line=e.filter((t,n)=>n===0||e[n][0]!==e[n-1][0]||e[n][1]!==e[n-1][1]),this.mercatorLine=this.line.map(e=>a.fromLngLat(e)),this.distances=zu(this.mercatorLine),this.totalLength=this.distances[this.distances.length-1]}sample(e){let t=this.mercatorLine,n=this.distances;if(t.length<2)return t[0];e*=this.totalLength;for(let r=1;r<t.length;++r){let i=t[r-1],o=t[r],s=n[r-1],c=n[r];if(c>=e){let t=(e-s)/(c-s);return new a(I(i.x,o.x,t),I(i.y,o.y,t))}}return new a(t[t.length-1].x,t[t.length-1].y)}slice(e,t){if(this.line.length<2)return this.line;let n=this.mercatorLine.filter((n,r)=>this.distances[r]>=e*this.totalLength&&this.distances[r]<=t*this.totalLength);if(e>0){let t=this.sample(e);Bu(t,n[0])||n.unshift(t)}if(t<1){let e=this.sample(t);Bu(e,n[n.length-1])||n.push(e)}return n.map(e=>{let{lng:t,lat:n}=e.toLngLat();return[t,n]})}get length(){return this.totalLength}};function zu(e){let t=0,n=[t];for(let r=1;r<e.length;++r){let i=e[r-1],a=e[r],o=a.x-i.x,s=a.y-i.y;t+=Math.sqrt(o*o+s*s),n.push(t)}return n}function Bu(e,t){return e.x===t.x&&e.y===t.y}var Vu={solid:[1,0],dotted:[.7,.3],dashed:[3.5,1.5]};function Hu(e,t,n,r,i){e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:t.models.filter(e=>e.visible??!0).map(n=>Uu(e,t,n,1,r))}}),Object.entries(Vu).forEach(([r,i])=>{t.models.some(e=>(e.lineStyle??`solid`)===r)&&e.addLayer({id:`${t.id}-${r}`,type:`line`,source:t.id,metadata:{"mc-model-type":`line`,"mc-group-id":t.id},filter:[`all`,[`==`,[`geometry-type`],`LineString`],[`==`,[`get`,`line-style`],r]],paint:{"line-width":[`get`,`line-width`],"line-color":[`get`,`line-color`],"line-dasharray":i,"line-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n)}),i===`interactive`&&e.addLayer({id:`${t.id}-clickable`,type:`line`,source:t.id,metadata:{"mc-model-type":`line`,"mc-group-id":t.id},paint:{"line-width":[`max`,[`get`,`line-width`],15],"line-opacity":0},filter:[`==`,[`geometry-type`],`LineString`]},n),t.models.some(e=>e.svg)&&e.addLayer({id:`${t.id}-icon`,type:`symbol`,source:t.id,metadata:{"mc-model-type":`line`,"mc-group-id":t.id},layout:{"icon-allow-overlap":!0,"icon-ignore-placement":!0,"icon-image":[`get`,`mc-image-key`],"icon-anchor":`center`,"icon-size":[`get`,`icon-size`],"icon-rotate":[`get`,`icon-rotate`],"icon-offset":[`get`,`icon-offset`]},paint:{"icon-opacity":[`coalesce`,[`feature-state`,`opacity`],1]},filter:[`==`,[`geometry-type`],`Point`]},n)}function Uu(e,t,n,r,i){let a=new Ru(n.geometry).slice(0,r),o=n.svg!==void 0&&a.length>1?Xe(n.dataBindings??{},n.svg,void 0):void 0,s=o===void 0?void 0:i.getMapLibreImageKey(o,window.devicePixelRatio*(n.iconScale??1)*e.getScale());return{type:`Feature`,id:E(n.id),properties:{id:n.id,"line-width":n.lineWidth??3,"line-color":t.lineColor||n.lineColor?Je(n.dataBindings??{},n.lineColor,t.lineColor):`#000000`,"line-style":n.lineStyle??`solid`,"mc-image-key":s,"mc-svg-string":o,"icon-rotate":Wu(n,a,e),"icon-offset":n.iconOffset,"icon-size":n.iconScale},geometry:{type:`GeometryCollection`,geometries:[{type:`LineString`,coordinates:a},{type:`Point`,coordinates:a[a.length-1]}]}}}function Wu(e,t,n){return e.iconRotation?e.iconAlign?Ei(t,n)+e.iconRotation:e.iconRotation:0}function Gu(e,t,n,r,i,a,o){let s=Ni(t),c=new Map,l=new Map;for(let e of t.models){let n=e.featureId,a=t.id,o=[],u=wi(e),d=Ci(a,e),f=l.get(d)??{model:e,featureIds:o,modelIdToFillColor:{},modelIdToFillPattern:{},modelIdToOutlineColor:{},modelIdToOutlineWidth:{}};if(e.visible??!0){f.featureIds.push(n);let a=e.fillPattern===void 0?null:i.getMapLibreImageKey(r[e.fillPattern],2*window.devicePixelRatio);f.modelIdToFillColor[n]=t.fillColor||e.fillColor?Je(e.dataBindings??{},e.fillColor,t.fillColor,s,t.choropleth?.unmatchedColor):`#000000`,f.modelIdToFillPattern[n]=a,f.modelIdToOutlineColor[n]=t.outlineColor||e.outlineColor?Je(e.dataBindings??{},e.outlineColor,t.outlineColor):`#000000`,f.modelIdToOutlineWidth[n]=e.outlineWidth??.5}c.set(u,e),l.set(d,f)}for(let t of c.keys())e.getSource(t)||e.addSource(t,{type:`vector`,url:`${a}${c.get(t).vectorUrl}?access_token=${o}`,promoteId:`id`});for(let r of l.keys()){let{model:i}=l.get(r),{sourceLayerId:a}=i,o=wi(i);e.addLayer({id:r,type:`fill`,source:o,"source-layer":a,filter:[`literal`,!1],metadata:{"mc-model-type":`area`,"mc-model-id-prefix":i.vectorUrl,"mc-group-id":t.id},paint:{"fill-color":`#ffffff`,"fill-outline-color":`#000000`,"fill-antialias":!1,"fill-opacity":[`coalesce`,[`feature-state`,`opacity-${t.id}`],1]}},n),e.addLayer({id:`${r}-pattern`,type:`fill`,source:o,"source-layer":a,filter:[`literal`,!1],metadata:{"mc-model-type":`area`,"mc-model-id-prefix":i.vectorUrl,"mc-group-id":t.id},paint:{"fill-pattern":[`get`,`fill-pattern`],"fill-opacity":[`coalesce`,[`feature-state`,`opacity-${t.id}`],1]},layout:{visibility:`visible`}},n),e.addLayer({id:`${r}-outline`,type:`line`,source:o,"source-layer":a,filter:[`literal`,!1],metadata:{"mc-model-type":`area`,"mc-model-id-prefix":i.vectorUrl,"mc-group-id":t.id},paint:{"line-color":`#000000`,"line-width":.5,"line-opacity":[`coalesce`,[`feature-state`,`opacity-${t.id}`],1]}},n)}l.forEach((t,n)=>{let{featureIds:r,modelIdToFillColor:i,modelIdToFillPattern:a,modelIdToOutlineColor:o,modelIdToOutlineWidth:s}=t;e.setFilter(n,[`in`,`id`,...r]),e.setFilter(`${n}-outline`,[`in`,`id`,...r]),e.setPaintProperty(n,`fill-color`,[`get`,[`case`,[`==`,[`typeof`,[`get`,`id`]],`number`],[`to-string`,[`get`,`id`]],[`get`,`id`]],[`literal`,i]]),e.setPaintProperty(`${n}-outline`,`line-color`,[`get`,[`case`,[`==`,[`typeof`,[`get`,`id`]],`number`],[`to-string`,[`get`,`id`]],[`get`,`id`]],[`literal`,o]]),e.setPaintProperty(`${n}-outline`,`line-width`,[`get`,[`case`,[`==`,[`typeof`,[`get`,`id`]],`number`],[`to-string`,[`get`,`id`]],[`get`,`id`]],[`literal`,s]]),e.setFilter(`${n}-pattern`,[`to-boolean`,[`get`,[`case`,[`==`,[`typeof`,[`get`,`id`]],`number`],[`to-string`,[`get`,`id`]],[`get`,`id`]],[`literal`,a]]]),e.setPaintProperty(`${n}-pattern`,`fill-pattern`,[`get`,[`case`,[`==`,[`typeof`,[`get`,`id`]],`number`],[`to-string`,[`get`,`id`]],[`get`,`id`]],[`literal`,a]])})}function Ku(e,t,n){e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:t.models.filter(e=>e.visible??!0).map(e=>qu(t,e))}}),e.addLayer({id:t.id,type:`circle`,source:t.id,metadata:{"mc-model-type":`dot`,"mc-group-id":t.id},paint:{"circle-color":[`get`,`circle-color`],"circle-radius":[`get`,`circle-radius`],"circle-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n)}function qu(e,t){return{type:`Feature`,id:t.id,properties:{id:t.id,"circle-radius":t.radius,"circle-color":e.fillColor||t.fillColor?Je(t.dataBindings??{},t.fillColor,e.fillColor):`#000000`},geometry:{type:`Point`,coordinates:[t.center.lng,t.center.lat]}}}function Ju(e){let t=new Map,n=new Map,r=new Map;function i(n){return t.get(n)??t.set(n,e.load(n)).get(n)}return async(t,a,o,s,c)=>{let l=a||400,u=o||`normal`,d=be(t),f=JSON.stringify([d,l,u]);n.has(f)||n.set(f,(async()=>{for(let t of d){if(t.generic)continue;let n=e.registered(t.name,l,u);if(n!==void 0)return n;let r=await e.search(t.name,l,u);if(r!==void 0)return{name:r,weight:l,style:u};if(await i(t.name)!==void 0)return{name:t.name,weight:400,style:`normal`}}return{name:`Roboto-Regular`,weight:400,style:`normal`}})());let p=await n.get(f);return c!==void 0&&(c.fauxBold=l>=600&&p.weight<600,c.fauxItalic=u!==`normal`&&p.style===`normal`),r.has(p.name)||r.set(p.name,i(p.name).then(e=>{if(e===void 0)throw Error(`PDF font "${p.name}" is unavailable`);s.registerFont(p.name,e)})),await r.get(p.name),p.name}}function Yu(e,t,n){let r=e.metadata?.colorconversion,i=r?new Map(r.map(e=>[Xu(e.rgbin.split(` `).map(e=>Number(e))),e.cmykout.split(` `).map(e=>Number(e)*100)])):null;return{colorCallback:Zu.bind(null,i),fontCallback:Qu(t,n),assumePt:!0}}var Xu=([e,t,n])=>`R${e}G${t}B${n}`;function Zu(e,t){if(!t)return;let n=t[0],r=Xu(n),i=e?.get(r);if(i)return[i,t[1]];let a=(255-n[0])/255,o=(255-n[1])/255,s=(255-n[2])/255,c=Math.min(a,o,s);return[[(a-c)*100,(o-c)*100,(s-c)*100,c*100],t[1]]}function Qu(e,t){return Ju({registered:(t,n,r)=>{let i=Ce(e.fontMap.values(),t,n,r)??e.getDirectFont(t);return i&&{name:i.name,weight:i.weight===`bold`?700:Number(i.weight)||400,style:i.style}},search:async(e,n,r)=>(await $u(t,{family:e,weight:String(n),style:r}))[0]?.name,load:async e=>{let n=await fetch(`${t.vapiUrl}/fonts/${encodeURIComponent(e)}.ttf?access_token=${t.accessToken}`);if(!(n.status===404||n.status===410)){if(!n.ok)throw Error(`Failed to load PDF font "${e}": ${n.status}`);return n.arrayBuffer()}}})}async function $u(e,t){let n=new URLSearchParams(Object.entries(t).map(([e,t])=>[e,String(t)])),r=`${e.apiUrl??`https://api.mapcreator.io`}/v1/fonts/search?${n}`,i={Accept:`application/json`,Authorization:e.bearerToken.startsWith(`Bearer `)?e.bearerToken:`Bearer ${e.bearerToken}`},a=await fetch(r,{headers:i});if(a.ok){let e=await a.json().catch(()=>({success:!1,error:{type:`SyntaxError`,message:`Malformed JSON response`}}));if(e.success)return Array.isArray(e.data)?e.data:[e.data];throw Error(e.error.message)}else throw Error(a.statusText)}function ed(e,{width:t,height:n}){let r=[];for(let i=0;i<=2;i++)for(let s=0;s<=2;s++){let c=i/2*t,l=s/2*n,{x:u,y:d}=td(a.fromLngLat(e.unprojectWithScaleCorrection(new o(c,l))));r.push(c,l,0,u,d,0)}return{width:t,height:n,GTRasterTypeGeoKey:1,PhotometricInterpretation:2,ProjectedCSTypeGeoKey:3857,ModelTiepoint:r,ModelPixelScale:[]}}function td(e){return{x:I(-20037508.34,20037508.34,e.x),y:I(20037508.34,-20037508.34,e.y)}}var nd=class{mcMap;format;svgCache;backgroundColor;constructor(e,t,n,r){this.mcMap=e,this.format=t,this.svgCache=n,this.backgroundColor=r}async frame(e){let t=this.mcMap.map;t.triggerRepaint(),await t.once(`idle`);let n=t.getCanvas(),{width:r,height:i}=n;if(![`jpg`,`png`,`tiff`].includes(this.format))return e?new Blob:new ImageData(r,i);let a=new OffscreenCanvas(r,i),o=a.getContext(`2d`,{willReadFrequently:!0});return this.format===`jpg`&&(o.fillStyle=this.backgroundColor,o.fillRect(0,0,r,i)),o.drawImage(n,0,0),await je(o,this.svgCache,t.getContainer()),e?a.convertToBlob({type:this.format===`jpg`?`image/jpeg`:`image/png`,quality:1}):o.getImageData(0,0,r,i)}};function rd(e){let t=e.length>0?[id(e[0])]:[],n=0,r=0;for(let i=1;i<e.length;++i){let a=id(e[i]);n+=ad(e[i-1].center[0],a.center[0]),r+=ad(e[i-1].bearing,a.bearing),a.center[0]+=n*360,a.x+=n,a.bearing+=r*360,t.push(a)}return t}function id(e){return{...e,center:[e.center[0],e.center[1]]}}function ad(e,t){if(Math.abs(e)+Math.abs(t)>180){if(e>0&&t<0)return 1;if(e<0&&t>0)return-1}return 0}function od(e){return 2**-e}function sd(e){return e.length>0?e[e.length-1].time:0}function cd(e){return`${String(Math.floor(e%36e5/6e4)).padStart(2,`0`)}:${String(Math.floor(e%6e4/1e3)).padStart(2,`0`)}`}function ld(e){return z(e,23.976)?24e3/1001:z(e,29.97)?3e4/1001:z(e,59.94)?6e4/1001:e}function ud(e,t){return e===void 0||t===void 0?e===t:e.center.lat===t.center.lat&&e.center.lng===t.center.lng&&e.zoom===t.zoom&&e.bearing===t.bearing&&e.pitch===t.pitch&&e.fov===t.fov&&e.elevation===t.elevation}var dd=`
504
+ `}return n}htmlToElement(e){let t=document.createElement(`template`);return t.innerHTML=e.trim(),t.content.firstElementChild}addPopupControls(){let e=this.htmlToElement(Mu);if(e&&(e.addEventListener(`click`,()=>{this.hidePopup(),this.highlightManager.highlight(void 0)}),this.popupContainer.appendChild(e)),this.popupElements.length>1){let e=this.htmlToElement(Nu);e&&(e.querySelector(`.prev`)?.addEventListener(`click`,()=>this.cyclePopups(!1)),e.querySelector(`.next`)?.addEventListener(`click`,()=>this.cyclePopups()),this.popupContainer.appendChild(e))}}fillDatalayerTemplate(e,t,n){let r=`data-mention-id`,i=new DOMParser().parseFromString(t,`text/html`).body;for(let t of i.querySelectorAll(`[${r}]`)){let i=this.getProperty(e,t.getAttribute(r),n);i!==void 0&&(t.innerText=i)}return i.innerHTML}getProperty(e,t,n){if(!t)return;let r=t.endsWith(`:en`)?[t.replace(`:en`,n),t]:[t];for(let t of r){let n=e.properties[t]??this.getVectorProperty(e,t);if(n!==void 0)return n}}getVectorProperty(e,t){let n=this.promoteIdCache.get(e.source);n===void 0&&(n=this.map.getSource(e.source)?.serialize().promoteId||`id`,this.promoteIdCache.set(e.source,n));try{let r=e.properties[n];return e.layer.metadata.properties[t][r]}catch{return}}cyclePopups(e=!0){let t=this.popupElements?.findIndex(e=>e.modelId===this.currentModelId);if(t!==-1){let n=0;n=e?t===this.popupElements.length-1?0:t+1:t===0?this.popupElements.length-1:t-1;let r=this.popupElements?.[n];this.currentModelId=r.modelId,this.highlightManager.highlight(r,!0);let i=ju(r.popup,r.popupMedia,r.dataBindings??{},this.youTubePlaceholder),a=this.popupContainer;this.popupContainer.remove(),a.innerHTML=i,this.mapContainer.appendChild(a),this.addPopupControls(),e?this.popupContainer.querySelector(`.mc-popup-button.next`)?.focus():this.popupContainer.querySelector(`.mc-popup-button.prev`)?.focus()}}},Vu=class{line;mercatorLine;distances;totalLength;constructor(e){this.line=e.filter((t,n)=>n===0||e[n][0]!==e[n-1][0]||e[n][1]!==e[n-1][1]),this.mercatorLine=this.line.map(e=>a.fromLngLat(e)),this.distances=Hu(this.mercatorLine),this.totalLength=this.distances[this.distances.length-1]}sample(e){let t=this.mercatorLine,n=this.distances;if(t.length<2)return t[0];e*=this.totalLength;for(let r=1;r<t.length;++r){let i=t[r-1],o=t[r],s=n[r-1],c=n[r];if(c>=e){let t=(e-s)/(c-s);return new a(I(i.x,o.x,t),I(i.y,o.y,t))}}return new a(t[t.length-1].x,t[t.length-1].y)}slice(e,t){if(this.line.length<2)return this.line;let n=this.mercatorLine.filter((n,r)=>this.distances[r]>=e*this.totalLength&&this.distances[r]<=t*this.totalLength);if(e>0){let t=this.sample(e);Uu(t,n[0])||n.unshift(t)}if(t<1){let e=this.sample(t);Uu(e,n[n.length-1])||n.push(e)}return n.map(e=>{let{lng:t,lat:n}=e.toLngLat();return[t,n]})}get length(){return this.totalLength}};function Hu(e){let t=0,n=[t];for(let r=1;r<e.length;++r){let i=e[r-1],a=e[r],o=a.x-i.x,s=a.y-i.y;t+=Math.sqrt(o*o+s*s),n.push(t)}return n}function Uu(e,t){return e.x===t.x&&e.y===t.y}var Wu={solid:[1,0],dotted:[.7,.3],dashed:[3.5,1.5]};function Gu(e,t,n,r,i){e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:t.models.filter(e=>e.visible??!0).map(n=>Ku(e,t,n,1,r))}}),Object.entries(Wu).forEach(([r,i])=>{t.models.some(e=>(e.lineStyle??`solid`)===r)&&e.addLayer({id:`${t.id}-${r}`,type:`line`,source:t.id,metadata:{"mc-model-type":`line`,"mc-group-id":t.id},filter:[`all`,[`==`,[`geometry-type`],`LineString`],[`==`,[`get`,`line-style`],r]],paint:{"line-width":[`get`,`line-width`],"line-color":[`get`,`line-color`],"line-dasharray":i,"line-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n)}),i===`interactive`&&e.addLayer({id:`${t.id}-clickable`,type:`line`,source:t.id,metadata:{"mc-model-type":`line`,"mc-group-id":t.id},paint:{"line-width":[`max`,[`get`,`line-width`],15],"line-opacity":0},filter:[`==`,[`geometry-type`],`LineString`]},n),t.models.some(e=>e.svg)&&e.addLayer({id:`${t.id}-icon`,type:`symbol`,source:t.id,metadata:{"mc-model-type":`line`,"mc-group-id":t.id},layout:{"icon-allow-overlap":!0,"icon-ignore-placement":!0,"icon-image":[`get`,`mc-image-key`],"icon-anchor":`center`,"icon-size":[`get`,`icon-size`],"icon-rotate":[`get`,`icon-rotate`],"icon-offset":[`get`,`icon-offset`]},paint:{"icon-opacity":[`coalesce`,[`feature-state`,`opacity`],1]},filter:[`==`,[`geometry-type`],`Point`]},n)}function Ku(e,t,n,r,i){let a=new Vu(n.geometry).slice(0,r),o=n.svg!==void 0&&a.length>1?Xe(n.dataBindings??{},n.svg,void 0):void 0,s=o===void 0?void 0:i.getMapLibreImageKey(o,window.devicePixelRatio*(n.iconScale??1)*e.getScale());return{type:`Feature`,id:E(n.id),properties:{id:n.id,"line-width":n.lineWidth??3,"line-color":t.lineColor||n.lineColor?Je(n.dataBindings??{},n.lineColor,t.lineColor):`#000000`,"line-style":n.lineStyle??`solid`,"mc-image-key":s,"mc-svg-string":o,"icon-rotate":qu(n,a,e),"icon-offset":n.iconOffset,"icon-size":n.iconScale},geometry:{type:`GeometryCollection`,geometries:[{type:`LineString`,coordinates:a},{type:`Point`,coordinates:a[a.length-1]}]}}}function qu(e,t,n){return e.iconRotation?e.iconAlign?Ei(t,n)+e.iconRotation:e.iconRotation:0}function Ju(e,t,n,r,i,a,o){let s=Ni(t),c=new Map,l=new Map;for(let e of t.models){let n=e.featureId,a=t.id,o=[],u=wi(e),d=Ci(a,e),f=l.get(d)??{model:e,featureIds:o,modelIdToFillColor:{},modelIdToFillPattern:{},modelIdToOutlineColor:{},modelIdToOutlineWidth:{}};if(e.visible??!0){f.featureIds.push(n);let a=e.fillPattern===void 0?null:i.getMapLibreImageKey(r[e.fillPattern],2*window.devicePixelRatio);f.modelIdToFillColor[n]=t.fillColor||e.fillColor?Je(e.dataBindings??{},e.fillColor,t.fillColor,s,t.choropleth?.unmatchedColor):`#000000`,f.modelIdToFillPattern[n]=a,f.modelIdToOutlineColor[n]=t.outlineColor||e.outlineColor?Je(e.dataBindings??{},e.outlineColor,t.outlineColor):`#000000`,f.modelIdToOutlineWidth[n]=e.outlineWidth??.5}c.set(u,e),l.set(d,f)}for(let t of c.keys())e.getSource(t)||e.addSource(t,{type:`vector`,url:`${a}${c.get(t).vectorUrl}?access_token=${o}`,promoteId:`id`});for(let r of l.keys()){let{model:i}=l.get(r),{sourceLayerId:a}=i,o=wi(i);e.addLayer({id:r,type:`fill`,source:o,"source-layer":a,filter:[`literal`,!1],metadata:{"mc-model-type":`area`,"mc-model-id-prefix":i.vectorUrl,"mc-group-id":t.id},paint:{"fill-color":`#ffffff`,"fill-outline-color":`#000000`,"fill-antialias":!1,"fill-opacity":[`coalesce`,[`feature-state`,`opacity-${t.id}`],1]}},n),e.addLayer({id:`${r}-pattern`,type:`fill`,source:o,"source-layer":a,filter:[`literal`,!1],metadata:{"mc-model-type":`area`,"mc-model-id-prefix":i.vectorUrl,"mc-group-id":t.id},paint:{"fill-pattern":[`get`,`fill-pattern`],"fill-opacity":[`coalesce`,[`feature-state`,`opacity-${t.id}`],1]},layout:{visibility:`visible`}},n),e.addLayer({id:`${r}-outline`,type:`line`,source:o,"source-layer":a,filter:[`literal`,!1],metadata:{"mc-model-type":`area`,"mc-model-id-prefix":i.vectorUrl,"mc-group-id":t.id},paint:{"line-color":`#000000`,"line-width":.5,"line-opacity":[`coalesce`,[`feature-state`,`opacity-${t.id}`],1]}},n)}l.forEach((t,n)=>{let{featureIds:r,modelIdToFillColor:i,modelIdToFillPattern:a,modelIdToOutlineColor:o,modelIdToOutlineWidth:s}=t;e.setFilter(n,[`in`,`id`,...r]),e.setFilter(`${n}-outline`,[`in`,`id`,...r]),e.setPaintProperty(n,`fill-color`,[`get`,[`case`,[`==`,[`typeof`,[`get`,`id`]],`number`],[`to-string`,[`get`,`id`]],[`get`,`id`]],[`literal`,i]]),e.setPaintProperty(`${n}-outline`,`line-color`,[`get`,[`case`,[`==`,[`typeof`,[`get`,`id`]],`number`],[`to-string`,[`get`,`id`]],[`get`,`id`]],[`literal`,o]]),e.setPaintProperty(`${n}-outline`,`line-width`,[`get`,[`case`,[`==`,[`typeof`,[`get`,`id`]],`number`],[`to-string`,[`get`,`id`]],[`get`,`id`]],[`literal`,s]]),e.setFilter(`${n}-pattern`,[`to-boolean`,[`get`,[`case`,[`==`,[`typeof`,[`get`,`id`]],`number`],[`to-string`,[`get`,`id`]],[`get`,`id`]],[`literal`,a]]]),e.setPaintProperty(`${n}-pattern`,`fill-pattern`,[`get`,[`case`,[`==`,[`typeof`,[`get`,`id`]],`number`],[`to-string`,[`get`,`id`]],[`get`,`id`]],[`literal`,a]])})}function Yu(e,t,n){e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:t.models.filter(e=>e.visible??!0).map(e=>Xu(t,e))}}),e.addLayer({id:t.id,type:`circle`,source:t.id,metadata:{"mc-model-type":`dot`,"mc-group-id":t.id},paint:{"circle-color":[`get`,`circle-color`],"circle-radius":[`get`,`circle-radius`],"circle-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n)}function Xu(e,t){return{type:`Feature`,id:t.id,properties:{id:t.id,"circle-radius":t.radius,"circle-color":e.fillColor||t.fillColor?Je(t.dataBindings??{},t.fillColor,e.fillColor):`#000000`},geometry:{type:`Point`,coordinates:[t.center.lng,t.center.lat]}}}function Zu(e){let t=new Map,n=new Map,r=new Map;function i(n){return t.get(n)??t.set(n,e.load(n)).get(n)}return async(t,a,o,s,c)=>{let l=a||400,u=o||`normal`,d=be(t),f=JSON.stringify([d,l,u]);n.has(f)||n.set(f,(async()=>{for(let t of d){if(t.generic)continue;let n=e.registered(t.name,l,u);if(n!==void 0)return n;let r=await e.search(t.name,l,u);if(r!==void 0)return{name:r,weight:l,style:u};if(await i(t.name)!==void 0)return{name:t.name,weight:400,style:`normal`}}return{name:`Roboto-Regular`,weight:400,style:`normal`}})());let p=await n.get(f);return c!==void 0&&(c.fauxBold=l>=600&&p.weight<600,c.fauxItalic=u!==`normal`&&p.style===`normal`),r.has(p.name)||r.set(p.name,i(p.name).then(e=>{if(e===void 0)throw Error(`PDF font "${p.name}" is unavailable`);s.registerFont(p.name,e)})),await r.get(p.name),p.name}}function Qu(e,t,n){let r=e.metadata?.colorconversion,i=r?new Map(r.map(e=>[$u(e.rgbin.split(` `).map(e=>Number(e))),e.cmykout.split(` `).map(e=>Number(e)*100)])):null;return{colorCallback:ed.bind(null,i),fontCallback:td(t,n),assumePt:!0}}var $u=([e,t,n])=>`R${e}G${t}B${n}`;function ed(e,t){if(!t)return;let n=t[0],r=$u(n),i=e?.get(r);if(i)return[i,t[1]];let a=(255-n[0])/255,o=(255-n[1])/255,s=(255-n[2])/255,c=Math.min(a,o,s);return[[(a-c)*100,(o-c)*100,(s-c)*100,c*100],t[1]]}function td(e,t){return Zu({registered:(t,n,r)=>{let i=Ce(e.fontMap.values(),t,n,r)??e.getDirectFont(t);return i&&{name:i.name,weight:i.weight===`bold`?700:Number(i.weight)||400,style:i.style}},search:async(e,n,r)=>(await nd(t,{family:e,weight:String(n),style:r}))[0]?.name,load:async e=>{let n=await fetch(`${t.vapiUrl}/fonts/${encodeURIComponent(e)}.ttf?access_token=${t.accessToken}`);if(!(n.status===404||n.status===410)){if(!n.ok)throw Error(`Failed to load PDF font "${e}": ${n.status}`);return n.arrayBuffer()}}})}async function nd(e,t){let n=new URLSearchParams(Object.entries(t).map(([e,t])=>[e,String(t)])),r=`${e.apiUrl??`https://api.mapcreator.io`}/v1/fonts/search?${n}`,i={Accept:`application/json`,Authorization:e.bearerToken.startsWith(`Bearer `)?e.bearerToken:`Bearer ${e.bearerToken}`},a=await fetch(r,{headers:i});if(a.ok){let e=await a.json().catch(()=>({success:!1,error:{type:`SyntaxError`,message:`Malformed JSON response`}}));if(e.success)return Array.isArray(e.data)?e.data:[e.data];throw Error(e.error.message)}else throw Error(a.statusText)}function rd(e,{width:t,height:n}){let r=[];for(let i=0;i<=2;i++)for(let s=0;s<=2;s++){let c=i/2*t,l=s/2*n,{x:u,y:d}=id(a.fromLngLat(e.unprojectWithScaleCorrection(new o(c,l))));r.push(c,l,0,u,d,0)}return{width:t,height:n,GTRasterTypeGeoKey:1,PhotometricInterpretation:2,ProjectedCSTypeGeoKey:3857,ModelTiepoint:r,ModelPixelScale:[]}}function id(e){return{x:I(-20037508.34,20037508.34,e.x),y:I(20037508.34,-20037508.34,e.y)}}var ad=class{mcMap;format;svgCache;backgroundColor;constructor(e,t,n,r){this.mcMap=e,this.format=t,this.svgCache=n,this.backgroundColor=r}async frame(e){let t=this.mcMap.map;t.triggerRepaint(),await t.once(`idle`);let n=t.getCanvas(),{width:r,height:i}=n;if(![`jpg`,`png`,`tiff`].includes(this.format))return e?new Blob:new ImageData(r,i);let a=new OffscreenCanvas(r,i),o=a.getContext(`2d`,{willReadFrequently:!0});return this.format===`jpg`&&(o.fillStyle=this.backgroundColor,o.fillRect(0,0,r,i)),o.drawImage(n,0,0),await je(o,this.svgCache,t.getContainer()),e?a.convertToBlob({type:this.format===`jpg`?`image/jpeg`:`image/png`,quality:1}):o.getImageData(0,0,r,i)}};function od(e){let t=e.length>0?[sd(e[0])]:[],n=0,r=0;for(let i=1;i<e.length;++i){let a=sd(e[i]);n+=cd(e[i-1].center[0],a.center[0]),r+=cd(e[i-1].bearing,a.bearing),a.center[0]+=n*360,a.x+=n,a.bearing+=r*360,t.push(a)}return t}function sd(e){return{...e,center:[e.center[0],e.center[1]]}}function cd(e,t){if(Math.abs(e)+Math.abs(t)>180){if(e>0&&t<0)return 1;if(e<0&&t>0)return-1}return 0}function ld(e){return 2**-e}function ud(e){return e.length>0?e[e.length-1].time:0}function dd(e){return`${String(Math.floor(e%36e5/6e4)).padStart(2,`0`)}:${String(Math.floor(e%6e4/1e3)).padStart(2,`0`)}`}function fd(e){return z(e,23.976)?24e3/1001:z(e,29.97)?3e4/1001:z(e,59.94)?6e4/1001:e}function pd(e,t){return e===void 0||t===void 0?e===t:e.center.lat===t.center.lat&&e.center.lng===t.center.lng&&e.zoom===t.zoom&&e.bearing===t.bearing&&e.pitch===t.pitch&&e.fov===t.fov&&e.elevation===t.elevation}var md=`
505
505
  <div class="preload-bar-vertical"></div>
506
506
  <div class="preload-bar-horizontal"></div>
507
507
  <div class="preload-badge">
@@ -512,13 +512,13 @@ import{AttributionControl as e,Event as t,Evented as n,LngLatBounds as r,Map as
512
512
  <div class="preload-logo"><svg xmlns="http://www.w3.org/2000/svg" width="130" height="18" viewBox="0 0 130 18" fill="currentColor"><path d="M16.49.815h-3.283V17.35h3.283zm-6.566 0h-3.32v6.567h3.32zm16.461 0h-6.567v3.32h6.567zm0 13.215h-6.567v3.319h6.567zM3.321.815H.038V17.35h3.283zM38.38 5.18l2.01 5.667 2-5.666h2.12v7.812h-1.62v-2.137l.164-3.684-2.092 5.82h-1.128l-2.11-5.82.164 3.684v2.137h-1.61V5.18zm14.488 6.176h-2.81l-.537 1.61h-1.728l2.91-7.812h1.492l2.928 7.812h-1.719zm-2.392-1.273h1.955l-.982-2.929zm9.432.154v2.729h-1.61V5.18h3.046a3.5 3.5 0 0 1 1.547.318c.426.193.784.51 1.027.91.246.405.372.872.364 1.346a2.21 2.21 0 0 1-.791 1.819 3.27 3.27 0 0 1-2.174.663zm0-1.3h1.436c.352.02.698-.09.974-.31a1.1 1.1 0 0 0 .336-.909 1.2 1.2 0 0 0-1.1-1.291h-1.646zm14.059 1.455a2.73 2.73 0 0 1-.91 1.982 3.2 3.2 0 0 1-2.21.728 2.94 2.94 0 0 1-2.364-1.01 4.16 4.16 0 0 1-.91-2.783v-.472a4.7 4.7 0 0 1 .419-2.028c.25-.535.656-.982 1.164-1.283a3.24 3.24 0 0 1 1.71-.455 3.17 3.17 0 0 1 2.182.728c.557.53.884 1.259.91 2.028h-1.592a1.62 1.62 0 0 0-.418-1.091 1.57 1.57 0 0 0-1.11-.346 1.35 1.35 0 0 0-1.2.582 3.1 3.1 0 0 0-.41 1.82v.59c-.037.63.095 1.258.383 1.82a1.32 1.32 0 0 0 1.21.581c.398.034.796-.086 1.109-.336.273-.284.426-.662.427-1.055zm6.393-.255h-1.28v2.856h-1.61V5.18h2.9a3.2 3.2 0 0 1 2.138.618 2.12 2.12 0 0 1 .755 1.737 2.17 2.17 0 0 1-1.373 2.192l1.691 3.192v.073H81.89zm-1.281-1.31h1.3c.332.018.657-.092.91-.309a1.1 1.1 0 0 0 .336-.845 1.2 1.2 0 0 0-.318-.91 1.32 1.32 0 0 0-.964-.318h-1.264zm12.55.783h-3.093v2.09h3.638v1.292h-5.247V5.18h5.23v1.3h-3.639v1.865h3.092zm8.339 1.746H97.14l-.537 1.61h-1.71l2.91-7.812h1.492l2.929 7.812h-1.71zm-2.392-1.3h1.956l-.983-2.929zm13.06-3.575h-2.374v6.512h-1.609V6.48h-2.365v-1.3h6.366zm9.631 2.783a4.7 4.7 0 0 1-.409 2.028 3 3 0 0 1-1.164 1.337 3.44 3.44 0 0 1-3.474 0 3.07 3.07 0 0 1-1.183-1.337 4.55 4.55 0 0 1-.427-1.991V8.91a4.56 4.56 0 0 1 .418-2.028 3.1 3.1 0 0 1 1.174-1.355 3.48 3.48 0 0 1 3.474 0c.516.325.925.797 1.173 1.355a4.56 4.56 0 0 1 .418 2.028zm-1.628-.354a3.2 3.2 0 0 0-.445-1.874 1.45 1.45 0 0 0-1.255-.636 1.42 1.42 0 0 0-1.246.636 3.2 3.2 0 0 0-.446 1.82v.381c-.03.636.121 1.267.437 1.819a1.53 1.53 0 0 0 1.255.65 1.54 1.54 0 0 0 1.255-.65 3.36 3.36 0 0 0 .445-1.819zm8.14 1.227h-1.237v2.856h-1.619V5.18h2.91a3.2 3.2 0 0 1 2.137.618 2.12 2.12 0 0 1 .755 1.737 2.23 2.23 0 0 1-1.455 2.192l1.692 3.192v.073h-1.692zm-1.237-1.31h1.291c.33.01.653-.1.91-.309a1.08 1.08 0 0 0 .327-.845 1.2 1.2 0 0 0-.309-.91 1.33 1.33 0 0 0-.964-.318h-1.255z"/></svg>
513
513
  </div>
514
514
  <div class="preload-percentage">0%</div>
515
- <div class="preload-label">Preloading tiles...</div>
515
+ <div class="preload-label">${ja(`loadingMap`)}</div>
516
516
  </div>
517
517
  </div>
518
- `,fd=class{container;percentage;constructor(e){this.container=document.createElement(`div`),this.container.className=`preload-overlay`,this.container.innerHTML=dd,this.percentage=this.container.querySelector(`.preload-percentage`),e.getContainer().appendChild(this.container)}remove(){this.container.remove()}setProgress(e){this.percentage.innerText=`${Math.floor(e*100)}%`}};function pd(e){return e<0?-1:1}function md(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(pd(a)+pd(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function hd(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function gd(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function _d(e){this._context=e}_d.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:gd(this,this._t0,hd(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,gd(this,hd(this,n=md(this,e,t)),n);break;default:gd(this,this._t0,n=md(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function vd(e){this._context=new yd(e)}(vd.prototype=Object.create(_d.prototype)).point=function(e,t){_d.prototype.point.call(this,t,e)};function yd(e){this._context=e}yd.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function bd(e){return new _d(e)}var xd=m(((e,t)=>{var n=4,r=.001,i=1e-7,a=10,o=11,s=1/(o-1),c=typeof Float32Array==`function`;function l(e,t){return 1-3*t+3*e}function u(e,t){return 3*t-6*e}function d(e){return 3*e}function f(e,t,n){return((l(t,n)*e+u(t,n))*e+d(t))*e}function p(e,t,n){return 3*l(t,n)*e*e+2*u(t,n)*e+d(t)}function m(e,t,n,r,o){var s,c,l=0;do c=t+(n-t)/2,s=f(c,r,o)-e,s>0?n=c:t=c;while(Math.abs(s)>i&&++l<a);return c}function h(e,t,r,i){for(var a=0;a<n;++a){var o=p(t,r,i);if(o===0)return t;var s=f(t,r,i)-e;t-=s/o}return t}function g(e){return e}t.exports=function(e,t,n,i){if(!(0<=e&&e<=1&&0<=n&&n<=1))throw Error(`bezier x values must be in [0, 1] range`);if(e===t&&n===i)return g;for(var a=c?new Float32Array(o):Array(o),l=0;l<o;++l)a[l]=f(l*s,e,n);function u(t){for(var i=0,c=1,l=o-1;c!==l&&a[c]<=t;++c)i+=s;--c;var u=(t-a[c])/(a[c+1]-a[c]),d=i+u*s,f=p(d,e,n);return f>=r?h(t,d,e,n):f===0?d:m(t,i,i+s,e,n)}return function(e){return e===0?0:e===1?1:f(u(e),t,i)}}})),Sd=m(((e,t)=>{t.exports=n;function n(e,t,n,r){var i,a,o,s,c,l,u,d,f,p,m,h,g,_;for(typeof t!=`function`&&(r=n,n=t,t=null),r||={},s=r.tolerance===void 0?1e-7:r.tolerance,_=r.epsilon===void 0?2220446049250313e-31:r.epsilon,c=r.maxIterations===void 0?20:r.maxIterations,m=r.h===void 0?1e-4:r.h,g=r.verbose===void 0?!1:r.verbose,h=1/m,l=0;l++<c;){if(a=e(n),t?o=t(n):(u=e(n+m),d=e(n-m),f=e(n+2*m),p=e(n-2*m),o=(p-f+8*(u-d))*h/12),Math.abs(o)<=_*Math.abs(a))return g&&console.log(`Newton-Raphson: failed to converged due to nearly zero first derivative`),!1;if(i=n-a/o,Math.abs(i-n)<=s*Math.abs(i))return g&&console.log(`Newton-Raphson: converged to x = `+i+` after `+l+` iterations`),i;n=i}return g&&console.log(`Newton-Raphson: Maximum iterations reached (`+c+`)`),!1}})),Cd=g(xd(),1),wd=g(Sd(),1),Td=class{segments;constructor(e){this.segments=[];let t=new Ed,n=bd(t);n.lineStart();for(let t of e)n.point(t.x,t.y);n.lineEnd(),this.segments=t.segments}sample(e){if(e<=0)return this.segments[0].startY;if(e>=this.segments[this.segments.length-1].endX)return this.segments[this.segments.length-1].endY;let t=this.segments.find(t=>e>=t.startX&&e<t.endX),n=te(t.startX,t.endX,e);return t.startY!==t.endY&&t.easing!==void 0?I(t.startY,t.endY,t.easing(n)):I(t.startY,t.endY,n)}solve(e,t){let n=(0,wd.default)(t=>this.sample(t)-e,t);return n===!1?t:n}},Ed=class{previousPoint={x:0,y:0};segments=[];bezierCurveTo(e,t,n,r,i,a){let o=this.previousPoint.x,s=this.previousPoint.y,c=i===o?void 0:(0,Cd.default)((e-o)/(i-o),(t-s)/(a-s),(n-o)/(i-o),(r-s)/(a-s));this.segments.push({startX:o,endX:i,startY:s,endY:a,easing:c}),this.previousPoint={x:i,y:a}}lineTo(e,t){this.segments.push({startX:this.previousPoint.x,endX:e,startY:this.previousPoint.y,endY:t,easing:void 0}),this.previousPoint={x:e,y:t}}moveTo(e,t){this.previousPoint={x:e,y:t}}closePath(){}arc(){}rect(){}arcTo(){}quadraticCurveTo(){}};function Dd(e,t,n,r){return t+n/r*e}function Od(e,t,n,r){return n*((e=e/r-1)*e*e+1)+t}function kd(e,t,n,r){let i=1.70158,a=0,o=n;return e===0?t:(e/=r)===1?t+n:(a||=r*.3,o<Math.abs(n)?(o=n,i=a/4):i=a/(2*Math.PI)*Math.asin(n/o),o*2**(-10*e)*Math.sin((e*r-i)*(2*Math.PI)/a)+n+t)}function Ad(e,t,n,r,i){return i===void 0&&(i=1.70158),n*((e=e/r-1)*e*((i+1)*e+i)+1)+t}function jd(e,t,n,r){return(e/=r)<1/2.75?n*(7.5625*e*e)+t:e<2/2.75?n*(7.5625*(e-=1.5/2.75)*e+.75)+t:e<2.5/2.75?n*(7.5625*(e-=2.25/2.75)*e+.9375)+t:n*(7.5625*(e-=2.625/2.75)*e+.984375)+t}var Md=class{script;xCurve;yCurve;fovCurve;zoomCurve;pitchCurve;bearingCurve;altitudeCurve;elevationCurve;constructor(e){this.script=rd(e),this.xCurve=this.createMonotonicCurve(this.script,`x`),this.yCurve=this.createMonotonicCurve(this.script,`y`),this.fovCurve=this.createMonotonicCurve(this.script,`fov`),this.zoomCurve=this.createMonotonicCurve(this.script,`zoom`),this.pitchCurve=this.createMonotonicCurve(this.script,`pitch`),this.bearingCurve=this.createMonotonicCurve(this.script,`bearing`),this.altitudeCurve=this.createMonotonicCurve(this.script,`altitude`),this.elevationCurve=this.createMonotonicCurve(this.script,`elevation`)}sample(e){let t=this.zoomCurve.sample(e),n=this.altitudeCurve.solve(od(t),e),r=this.xCurve.sample(n),i=this.yCurve.sample(n),o=this.elevationCurve.sample(n),s=this.bearingCurve.sample(e),c=this.pitchCurve.sample(e),l=this.fovCurve.sample(e);return{center:new a(r,i).toLngLat(),zoom:t,bearing:s,pitch:c,fov:l,elevation:o}}createMonotonicCurve(e,t){let n=[];for(let r=0;r<e.length;r++){let i=r===0,a=r===e.length-1,o=e[r],s=e[r+1],c=e[r-1],l=this.getKeyframeValue(o,t);if(i&&n.push({x:-1,y:l}),n.push({x:o.time,y:l}),!i&&!a&&c.transition===`instant`&&o.transition===`ease`&&n.push({x:o.time+.1,y:l}),!a)if(o.transition===`linear`){let e=o.time+.1,r=s.time-.1,i=te(o.time,s.time,e),a=te(o.time,s.time,r),c=this.getKeyframeValue(s,t);n.push({x:e,y:I(l,c,i)}),n.push({x:r,y:I(l,c,a)})}else o.transition===`instant`&&(n.push({x:o.time+.1,y:l}),n.push({x:s.time-.1,y:l}));a&&n.push({x:o.time+1,y:l})}return new Td(n)}sampleAutoHideOpacity(e){let t=this.script;if(t.length<2)return 1;let n=this.getKeyframeIndexByTime(e);if(n===-1||n===t.length-1)return 1;let r=t[n],i=t[n+1],a=n>0?t[n-1]:void 0,o;if(r.hideLabels===(a?.hideLabels??!1))o=r.hideLabels?0:1;else{let t=e-r.time,n=Math.min(400,i.time-r.time);o=ne(Od(t,r.hideLabels?1:0,r.hideLabels?-1:1,n),0,1)}let s;if(n===t.length-2&&r.hideLabels){let t=Math.max(r.time,i.time-400);s=ne(Od(e-t,0,1,i.time-t),0,1)}else s=0;return Math.max(o,s)}getKeyframeIndexByTime(e){let t=this.script;if(t.length!==0){for(let n=0;n<t.length;n++)if(e<t[n].time)return n-1;return t.length-1}}getKeyframeValue(e,t){return t===`altitude`?od(e.zoom):e[t]}},Nd=`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor"><path d="M2.83545 2.66675V6.00008H6.00078M3.38078 5.33341C3.99882 4.26305 4.96943 3.44057 6.1267 3.00656C7.28398 2.57255 8.55607 2.55396 9.72553 2.95397C10.895 3.35397 11.8892 4.14774 12.5383 5.19959C13.1873 6.25144 13.4509 7.49606 13.2839 8.72072C13.117 9.94537 12.5298 11.074 11.6229 11.9137C10.716 12.7535 9.54555 13.2521 8.31169 13.3245C7.07782 13.3968 5.85714 13.0384 4.85828 12.3104C3.85942 11.5824 3.1444 10.5302 2.83545 9.33341" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round"/></svg>
519
- `,Pd=`<svg xmlns="http://www.w3.org/2000/svg" width="10" height="12" viewBox="0 0 10 12" fill="currentColor"><path fill-rule="evenodd" clip-rule="evenodd" d="M0.991136 3.66807e-08C1.53861 1.64225e-08 1.98242 0.474849 1.98242 1.06061L1.98242 10.6061C1.98242 11.1918 1.53861 11.6667 0.991137 11.6667C0.443665 11.6667 -0.000148911 11.1918 -0.000148941 10.6061L-0.000149434 1.06061C-0.000149464 0.47485 0.443664 5.69389e-08 0.991136 3.66807e-08Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M8.92082 3.66807e-08C9.4683 1.64225e-08 9.91211 0.474849 9.91211 1.06061L9.91211 10.6061C9.91211 11.1918 9.4683 11.6667 8.92082 11.6667C8.37335 11.6667 7.92954 11.1918 7.92954 10.6061L7.92954 1.06061C7.92954 0.47485 8.37335 5.69389e-08 8.92082 3.66807e-08Z"/></svg>
520
- `,Fd=`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="currentColor"><path d="M4.88141 14.9874C4.58039 14.9874 4.2919 14.9121 4.01596 14.774C3.38883 14.4475 3 13.8072 3 13.104V2.88322C3 2.18007 3.38883 1.5397 4.01596 1.21323C4.6431 0.886771 5.39567 0.936996 5.97263 1.35135L13.2098 6.46175C13.7115 6.81332 14 7.39091 14 8.00617C14 8.62142 13.699 9.18645 13.2098 9.55059L5.97263 14.6484C5.64652 14.8744 5.27024 15 4.89396 15L4.88141 14.9874ZM4.88141 2.2554C4.78107 2.2554 4.68073 2.28052 4.59293 2.33074C4.3797 2.44375 4.25428 2.64465 4.25428 2.88322V13.104C4.25428 13.3426 4.3797 13.556 4.59293 13.6565C4.80616 13.7695 5.04447 13.7444 5.24515 13.6063L12.4823 8.49586C12.5634 8.4368 12.6294 8.35937 12.6749 8.2699C12.7204 8.18043 12.7442 8.08145 12.7442 7.98105C12.7442 7.88065 12.7204 7.78168 12.6749 7.69221C12.6294 7.60274 12.5634 7.52531 12.4823 7.46625L5.24515 2.36841C5.1378 2.29542 5.01118 2.25608 4.88141 2.2554Z"/></svg>
521
- `,Id=e=>`
518
+ `,hd=class{container;percentage;constructor(e){this.container=document.createElement(`div`),this.container.className=`preload-overlay`,this.container.innerHTML=md,this.percentage=this.container.querySelector(`.preload-percentage`),e.getContainer().appendChild(this.container)}remove(){this.container.remove()}setProgress(e){this.percentage.innerText=`${Math.floor(e*100)}%`}};function gd(e){return e<0?-1:1}function _d(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(gd(a)+gd(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function vd(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function yd(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function bd(e){this._context=e}bd.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:yd(this,this._t0,vd(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,yd(this,vd(this,n=_d(this,e,t)),n);break;default:yd(this,this._t0,n=_d(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function xd(e){this._context=new Sd(e)}(xd.prototype=Object.create(bd.prototype)).point=function(e,t){bd.prototype.point.call(this,t,e)};function Sd(e){this._context=e}Sd.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function Cd(e){return new bd(e)}var wd=m(((e,t)=>{var n=4,r=.001,i=1e-7,a=10,o=11,s=1/(o-1),c=typeof Float32Array==`function`;function l(e,t){return 1-3*t+3*e}function u(e,t){return 3*t-6*e}function d(e){return 3*e}function f(e,t,n){return((l(t,n)*e+u(t,n))*e+d(t))*e}function p(e,t,n){return 3*l(t,n)*e*e+2*u(t,n)*e+d(t)}function m(e,t,n,r,o){var s,c,l=0;do c=t+(n-t)/2,s=f(c,r,o)-e,s>0?n=c:t=c;while(Math.abs(s)>i&&++l<a);return c}function h(e,t,r,i){for(var a=0;a<n;++a){var o=p(t,r,i);if(o===0)return t;var s=f(t,r,i)-e;t-=s/o}return t}function g(e){return e}t.exports=function(e,t,n,i){if(!(0<=e&&e<=1&&0<=n&&n<=1))throw Error(`bezier x values must be in [0, 1] range`);if(e===t&&n===i)return g;for(var a=c?new Float32Array(o):Array(o),l=0;l<o;++l)a[l]=f(l*s,e,n);function u(t){for(var i=0,c=1,l=o-1;c!==l&&a[c]<=t;++c)i+=s;--c;var u=(t-a[c])/(a[c+1]-a[c]),d=i+u*s,f=p(d,e,n);return f>=r?h(t,d,e,n):f===0?d:m(t,i,i+s,e,n)}return function(e){return e===0?0:e===1?1:f(u(e),t,i)}}})),Td=m(((e,t)=>{t.exports=n;function n(e,t,n,r){var i,a,o,s,c,l,u,d,f,p,m,h,g,_;for(typeof t!=`function`&&(r=n,n=t,t=null),r||={},s=r.tolerance===void 0?1e-7:r.tolerance,_=r.epsilon===void 0?2220446049250313e-31:r.epsilon,c=r.maxIterations===void 0?20:r.maxIterations,m=r.h===void 0?1e-4:r.h,g=r.verbose===void 0?!1:r.verbose,h=1/m,l=0;l++<c;){if(a=e(n),t?o=t(n):(u=e(n+m),d=e(n-m),f=e(n+2*m),p=e(n-2*m),o=(p-f+8*(u-d))*h/12),Math.abs(o)<=_*Math.abs(a))return g&&console.log(`Newton-Raphson: failed to converged due to nearly zero first derivative`),!1;if(i=n-a/o,Math.abs(i-n)<=s*Math.abs(i))return g&&console.log(`Newton-Raphson: converged to x = `+i+` after `+l+` iterations`),i;n=i}return g&&console.log(`Newton-Raphson: Maximum iterations reached (`+c+`)`),!1}})),Ed=g(wd(),1),Dd=g(Td(),1),Od=class{segments;constructor(e){this.segments=[];let t=new kd,n=Cd(t);n.lineStart();for(let t of e)n.point(t.x,t.y);n.lineEnd(),this.segments=t.segments}sample(e){if(e<=0)return this.segments[0].startY;if(e>=this.segments[this.segments.length-1].endX)return this.segments[this.segments.length-1].endY;let t=this.segments.find(t=>e>=t.startX&&e<t.endX),n=te(t.startX,t.endX,e);return t.startY!==t.endY&&t.easing!==void 0?I(t.startY,t.endY,t.easing(n)):I(t.startY,t.endY,n)}solve(e,t){let n=(0,Dd.default)(t=>this.sample(t)-e,t);return n===!1?t:n}},kd=class{previousPoint={x:0,y:0};segments=[];bezierCurveTo(e,t,n,r,i,a){let o=this.previousPoint.x,s=this.previousPoint.y,c=i===o?void 0:(0,Ed.default)((e-o)/(i-o),(t-s)/(a-s),(n-o)/(i-o),(r-s)/(a-s));this.segments.push({startX:o,endX:i,startY:s,endY:a,easing:c}),this.previousPoint={x:i,y:a}}lineTo(e,t){this.segments.push({startX:this.previousPoint.x,endX:e,startY:this.previousPoint.y,endY:t,easing:void 0}),this.previousPoint={x:e,y:t}}moveTo(e,t){this.previousPoint={x:e,y:t}}closePath(){}arc(){}rect(){}arcTo(){}quadraticCurveTo(){}};function Ad(e,t,n,r){return t+n/r*e}function jd(e,t,n,r){return n*((e=e/r-1)*e*e+1)+t}function Md(e,t,n,r){let i=1.70158,a=0,o=n;return e===0?t:(e/=r)===1?t+n:(a||=r*.3,o<Math.abs(n)?(o=n,i=a/4):i=a/(2*Math.PI)*Math.asin(n/o),o*2**(-10*e)*Math.sin((e*r-i)*(2*Math.PI)/a)+n+t)}function Nd(e,t,n,r,i){return i===void 0&&(i=1.70158),n*((e=e/r-1)*e*((i+1)*e+i)+1)+t}function Pd(e,t,n,r){return(e/=r)<1/2.75?n*(7.5625*e*e)+t:e<2/2.75?n*(7.5625*(e-=1.5/2.75)*e+.75)+t:e<2.5/2.75?n*(7.5625*(e-=2.25/2.75)*e+.9375)+t:n*(7.5625*(e-=2.625/2.75)*e+.984375)+t}var Fd=class{script;xCurve;yCurve;fovCurve;zoomCurve;pitchCurve;bearingCurve;altitudeCurve;elevationCurve;constructor(e){this.script=od(e),this.xCurve=this.createMonotonicCurve(this.script,`x`),this.yCurve=this.createMonotonicCurve(this.script,`y`),this.fovCurve=this.createMonotonicCurve(this.script,`fov`),this.zoomCurve=this.createMonotonicCurve(this.script,`zoom`),this.pitchCurve=this.createMonotonicCurve(this.script,`pitch`),this.bearingCurve=this.createMonotonicCurve(this.script,`bearing`),this.altitudeCurve=this.createMonotonicCurve(this.script,`altitude`),this.elevationCurve=this.createMonotonicCurve(this.script,`elevation`)}sample(e){let t=this.zoomCurve.sample(e),n=this.altitudeCurve.solve(ld(t),e),r=this.xCurve.sample(n),i=this.yCurve.sample(n),o=this.elevationCurve.sample(n),s=this.bearingCurve.sample(e),c=this.pitchCurve.sample(e),l=this.fovCurve.sample(e);return{center:new a(r,i).toLngLat(),zoom:t,bearing:s,pitch:c,fov:l,elevation:o}}createMonotonicCurve(e,t){let n=[];for(let r=0;r<e.length;r++){let i=r===0,a=r===e.length-1,o=e[r],s=e[r+1],c=e[r-1],l=this.getKeyframeValue(o,t);if(i&&n.push({x:-1,y:l}),n.push({x:o.time,y:l}),!i&&!a&&c.transition===`instant`&&o.transition===`ease`&&n.push({x:o.time+.1,y:l}),!a)if(o.transition===`linear`){let e=o.time+.1,r=s.time-.1,i=te(o.time,s.time,e),a=te(o.time,s.time,r),c=this.getKeyframeValue(s,t);n.push({x:e,y:I(l,c,i)}),n.push({x:r,y:I(l,c,a)})}else o.transition===`instant`&&(n.push({x:o.time+.1,y:l}),n.push({x:s.time-.1,y:l}));a&&n.push({x:o.time+1,y:l})}return new Od(n)}sampleAutoHideOpacity(e){let t=this.script;if(t.length<2)return 1;let n=this.getKeyframeIndexByTime(e);if(n===-1||n===t.length-1)return 1;let r=t[n],i=t[n+1],a=n>0?t[n-1]:void 0,o;if(r.hideLabels===(a?.hideLabels??!1))o=r.hideLabels?0:1;else{let t=e-r.time,n=Math.min(400,i.time-r.time);o=ne(jd(t,r.hideLabels?1:0,r.hideLabels?-1:1,n),0,1)}let s;if(n===t.length-2&&r.hideLabels){let t=Math.max(r.time,i.time-400);s=ne(jd(e-t,0,1,i.time-t),0,1)}else s=0;return Math.max(o,s)}getKeyframeIndexByTime(e){let t=this.script;if(t.length!==0){for(let n=0;n<t.length;n++)if(e<t[n].time)return n-1;return t.length-1}}getKeyframeValue(e,t){return t===`altitude`?ld(e.zoom):e[t]}},Id=`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor"><path d="M2.83545 2.66675V6.00008H6.00078M3.38078 5.33341C3.99882 4.26305 4.96943 3.44057 6.1267 3.00656C7.28398 2.57255 8.55607 2.55396 9.72553 2.95397C10.895 3.35397 11.8892 4.14774 12.5383 5.19959C13.1873 6.25144 13.4509 7.49606 13.2839 8.72072C13.117 9.94537 12.5298 11.074 11.6229 11.9137C10.716 12.7535 9.54555 13.2521 8.31169 13.3245C7.07782 13.3968 5.85714 13.0384 4.85828 12.3104C3.85942 11.5824 3.1444 10.5302 2.83545 9.33341" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round"/></svg>
519
+ `,Ld=`<svg xmlns="http://www.w3.org/2000/svg" width="10" height="12" viewBox="0 0 10 12" fill="currentColor"><path fill-rule="evenodd" clip-rule="evenodd" d="M0.991136 3.66807e-08C1.53861 1.64225e-08 1.98242 0.474849 1.98242 1.06061L1.98242 10.6061C1.98242 11.1918 1.53861 11.6667 0.991137 11.6667C0.443665 11.6667 -0.000148911 11.1918 -0.000148941 10.6061L-0.000149434 1.06061C-0.000149464 0.47485 0.443664 5.69389e-08 0.991136 3.66807e-08Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M8.92082 3.66807e-08C9.4683 1.64225e-08 9.91211 0.474849 9.91211 1.06061L9.91211 10.6061C9.91211 11.1918 9.4683 11.6667 8.92082 11.6667C8.37335 11.6667 7.92954 11.1918 7.92954 10.6061L7.92954 1.06061C7.92954 0.47485 8.37335 5.69389e-08 8.92082 3.66807e-08Z"/></svg>
520
+ `,Rd=`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="currentColor"><path d="M4.88141 14.9874C4.58039 14.9874 4.2919 14.9121 4.01596 14.774C3.38883 14.4475 3 13.8072 3 13.104V2.88322C3 2.18007 3.38883 1.5397 4.01596 1.21323C4.6431 0.886771 5.39567 0.936996 5.97263 1.35135L13.2098 6.46175C13.7115 6.81332 14 7.39091 14 8.00617C14 8.62142 13.699 9.18645 13.2098 9.55059L5.97263 14.6484C5.64652 14.8744 5.27024 15 4.89396 15L4.88141 14.9874ZM4.88141 2.2554C4.78107 2.2554 4.68073 2.28052 4.59293 2.33074C4.3797 2.44375 4.25428 2.64465 4.25428 2.88322V13.104C4.25428 13.3426 4.3797 13.556 4.59293 13.6565C4.80616 13.7695 5.04447 13.7444 5.24515 13.6063L12.4823 8.49586C12.5634 8.4368 12.6294 8.35937 12.6749 8.2699C12.7204 8.18043 12.7442 8.08145 12.7442 7.98105C12.7442 7.88065 12.7204 7.78168 12.6749 7.69221C12.6294 7.60274 12.5634 7.52531 12.4823 7.46625L5.24515 2.36841C5.1378 2.29542 5.01118 2.25608 4.88141 2.2554Z"/></svg>
521
+ `,zd=e=>`
522
522
  <div class="video-slider-container">
523
523
  <div class="video-slider-line-wrapper">
524
524
  <div class="video-slider-line-left"></div>
@@ -528,18 +528,18 @@ import{AttributionControl as e,Event as t,Evented as n,LngLatBounds as r,Map as
528
528
  </div>
529
529
  <div class="video-controls-row">
530
530
  <button class="video-button play">
531
- <span class="video-icon play-icon">${Fd}</span>
532
- <span class="video-icon pause-icon">${Pd}</span>
531
+ <span class="video-icon play-icon">${Rd}</span>
532
+ <span class="video-icon pause-icon">${Ld}</span>
533
533
  </button>
534
534
  <button class="video-button restart">
535
- ${Nd}
535
+ ${Id}
536
536
  </button>
537
537
  <div class="video-time">
538
- <span class="video-playhead">${cd(0)}</span> /
539
- <span class="video-duration">${cd(e)}</span>
538
+ <span class="video-playhead">${dd(0)}</span> /
539
+ <span class="video-duration">${dd(e)}</span>
540
540
  </div>
541
541
  <button class="video-button fullscreen">
542
542
  ${ma}
543
543
  </button>
544
544
  </div>
545
- `,Ld=class{callbacks;duration;container;mapContainer;playButton;restartButton;fullscreenButton;slider;sliderFill;playheadLabel;playhead=0;isPlaying=!1;constructor(e,t,n){this.duration=t,this.callbacks=n,this.mapContainer=e.getContainer(),this.container=document.createElement(`div`),this.container.className=`video-controls`,this.container.innerHTML=Id(t),this.playButton=this.container.querySelector(`.video-button.play`),this.restartButton=this.container.querySelector(`.video-button.restart`),this.fullscreenButton=this.container.querySelector(`.video-button.fullscreen`),this.slider=this.container.querySelector(`.video-slider`),this.sliderFill=this.container.querySelector(`.video-slider-line-left`),this.playheadLabel=this.container.querySelector(`.video-playhead`),this.playButton.addEventListener(`click`,()=>this.callbacks.playPause()),this.restartButton.addEventListener(`click`,()=>this.callbacks.restart()),this.fullscreenButton.addEventListener(`click`,()=>ya(this.mapContainer)),this.slider.addEventListener(`input`,()=>{this.duration>0&&this.callbacks.seek(Number(this.slider.value))}),this.mapContainer.appendChild(this.container),this.update()}setPlayhead(e){this.playhead=e,this.update()}setPlaying(e){this.isPlaying=e,this.update()}update(){let{duration:e,playhead:t}=this;this.playButton.classList.toggle(`playing`,this.isPlaying),this.restartButton.classList.toggle(`disabled`,t===0),this.slider.value=String(t),this.sliderFill.style.width=`${te(0,e,t)*100}%`,this.playheadLabel.textContent=cd(t)}},Rd=class extends t{time;constructor(e,t){super(e),this.time=t}},zd={linear:Dd,easeOutCubic:Od,easeOutBack:Ad,easeOutBounce:jd,easeOutElastic:kd};function Bd(e){return e.entryType===`fade`||e.exitType===`fade`||e.entryType===`instant`||e.exitType===`instant`}function Vd(e){return e.entryType===`grow`||e.exitType===`grow`}function Hd(e,t,n){let{entry:r,entryDuration:i,exit:a,exitDuration:o}=e,{entryType:s,entryEasing:c,exitType:l,exitEasing:u}=e;return n<r&&(s===t||s===`instant`&&t===`fade`)||n>a&&(l===t||l===`instant`&&t===`fade`)?0:i>0&&n<r+i&&s===t?zd[c](n-r,0,1,i):o>0&&n>a-o&&l===t?zd[u](n-(a-o),1,-1,o):1}function Ud(e){return e.target.type===`model`}function Wd(e){return e.target.type===`layer`||e.target.type===`overlay`}var Gd=class{mcMap;cameraCurve;registryAnimations;layerAnimations;registry;svgs;svgCache;duration;frameRate;loop;mapstyle;overlays;layerInfo;backgroundColor;playhead;playbackContext;controls;preloadOverlay;constructor(e,t,n,r,i,o,s,c){this.mcMap=e,this.playhead=0,this.playbackContext=void 0;let l=(t.video?.keyframes??[]).map(e=>{let{x:t,y:n}=a.fromLngLat(e.center);return{...e,x:t,y:n,fov:e.fov??36.87,elevation:e.elevation??0}}),u=t.video?.animations??[];this.layerAnimations=u.filter(Wd);let d=u.filter(Ud);this.registryAnimations=[...d.filter(e=>e.target.modelId===void 0),...d.filter(e=>e.target.modelId!==void 0)],this.duration=sd(l),this.frameRate=ld(t.export?.frameRate??60),this.cameraCurve=new Md(l),this.registry=new Fu(t),this.svgs=n,this.svgCache=r,this.mapstyle=i,this.overlays=o,this.layerInfo=s,this.backgroundColor=c;let f=t.export?.format===`web_video`;this.loop=f&&(t.web?.loop??!1),f&&t.web?.controls&&(this.controls=new Ld(e.map,this.duration,{playPause:()=>this.playbackContext===void 0?this.play():this.pause(),restart:()=>{this.seekTo(0),this.play()},seek:e=>{this.pause(),this.seekTo(e)}}));let p=this.mcMap.map;p.setCenterClampedToGround(!1),p.setRasterAlignment(!1),p.style?.stylesheet&&(p.style.stylesheet.transition={duration:0,delay:0}),this.setFrame(0),f&&this.launch(t)}async launch(e){e.web?.preload&&await this.preload(),e.web?.autoplay&&setTimeout(()=>this.play())}play(){this.playbackContext===void 0&&this.duration>0&&(this.playhead>=this.duration&&(this.playhead=0),this.playbackContext={startTime:Date.now(),startPlayhead:this.playhead},this.mcMap.fire(new Rd(`playstart`,this.playhead)),this.controls?.setPlaying(!0),this.playFrame())}pause(){this.playbackContext!==void 0&&(this.playbackContext=void 0,this.mcMap.fire(new Rd(`playend`,this.playhead)),this.controls?.setPlaying(!1))}seekTo(e){this.duration>0&&(e=ne(e,0,this.duration),this.setFrame(e),this.playbackContext!==void 0&&(this.playbackContext={startTime:Date.now(),startPlayhead:e}))}remove(){this.playbackContext=void 0}async*frames(e){let t=this.mcMap.map,n=Math.ceil(this.duration*this.frameRate/1e3);t._fadeDuration=0;let r=t.getCanvas(),{width:i,height:a}=r,o=new OffscreenCanvas(i,a),s=o.getContext(`2d`,{willReadFrequently:!0}),c=t.getContainer(),l=c.getBoundingClientRect();for(let t=0;t<n;t++)yield this.captureFrame(t*1e3/this.frameRate,e,r,o,s,i,a,c,l);t._fadeDuration=300,this.playhead=0}async preload(){this.playbackContext!==void 0&&this.pause();let e=this.mcMap.map,t=Math.ceil(this.duration*this.frameRate/1e3);this.preloadOverlay=new fd(this.mcMap.map),e._fadeDuration=0;try{let n;for(let r=0;r<t;r++){this.preloadOverlay?.setProgress(r/t);let i=this.cameraCurve.sample(r*1e3/this.frameRate);ud(n,i)||(this.setCamera(i),await this.waitForRenderOrAbort()===`render`?n=i:(n!==void 0&&this.setCamera(n),e.triggerRepaint(),await e.once(`idle`),r--))}e.areTilesLoaded()||await e.once(`idle`)}finally{this.setFrame(this.playhead),e._fadeDuration=300,this.preloadOverlay?.remove(),this.preloadOverlay=void 0}}waitForRenderOrAbort(){let e=this.mcMap.map;return new Promise(t=>{let n=()=>{e.off(`render`,r),e.off(`dataabort`,i)},r=()=>{n(),t(`render`)},i=e=>{e.tile?.state===`loading`&&(n(),t(`abort`))};e.on(`render`,r),e.on(`dataabort`,i)})}async captureFrame(e,t,n,r,i,a,o,s,c){return this.setFrame(e),await this.mcMap.map.once(`idle`),i.fillStyle=this.backgroundColor,i.fillRect(0,0,a,o),i.drawImage(n,0,0),await je(i,this.svgCache,s,c),t?r.convertToBlob():i.getImageData(0,0,a,o)}playFrame(){if(this.playbackContext!==void 0){let e=this.playbackContext.startPlayhead+(Date.now()-this.playbackContext.startTime);e>this.duration?this.loop?(this.seekTo(0),requestAnimationFrame(()=>this.playFrame())):(this.setFrame(this.duration),this.playbackContext=void 0,this.mcMap.fire(new Rd(`playend`,this.playhead)),this.controls?.setPlaying(!1)):(this.setFrame(e),requestAnimationFrame(()=>this.playFrame()))}}setFrame(e){this.playhead=e;let t=this.cameraCurve.sample(e);this.setCamera(t),this.applyAnimations(e),this.mcMap.fire(new Rd(`play`,e)),this.controls?.setPlayhead(e)}setCamera(e){let t=this.mcMap.map,n=t.getCenter(),r=t.getZoom(),i=t.getBearing(),a=t.getPitch(),o=t.getCenterElevation(),s=t.getVerticalFieldOfView();e.center.lat!==n.lat||e.center.lng!==n.lng||e.zoom!==r||e.bearing!==i||e.pitch!==a||e.elevation!==o||e.fov!==s?(t.setVerticalFieldOfView(e.fov),t.jumpTo(e)):t.triggerRepaint()}applyAnimations(e){let t=this.mcMap.map,{svgs:n,svgCache:r,registryAnimations:i}=this;for(let n of i){let{target:r}=n;if(!Bd(n))continue;let{modelType:i,groupId:a,modelId:o}=r,s=Hd(n,`fade`,e);if(i===`area`){let e=this.registry.models.area[a]??{},n=o===void 0?Object.values(e):e[o]?[e[o]]:[];for(let e of n)t.setFeatureState({source:wi(e),sourceLayer:e.sourceLayerId,id:e.featureId},{[`opacity-${a}`]:s})}else if(i===`polygon`||i===`circle`||i===`line`||i===`marker`||i===`dot`){let e=this.registry.models[i][a]??{},n=o===void 0?Object.keys(e):[o];for(let e of n)t.setFeatureState({source:a,id:E(e)},{opacity:s})}}for(let i of Object.values(this.registry.groups.circle)){let{groupAnimation:a,modelAnimations:o}=this.getGroupAnimations(`circle`,i.id,`scale`),s=a===void 0?1:Hd(a,`grow`,e);(a!==void 0||o.size>0)&&t.getSource(i.id).setData({type:`FeatureCollection`,features:i.models.filter(e=>e.visible??!0).map(t=>{let a=o.get(t.id);return pu(i,t,a===void 0?s:Hd(a,`grow`,e),n,r)})})}for(let n of Object.values(this.registry.groups.line)){let{groupAnimation:i,modelAnimations:a}=this.getGroupAnimations(`line`,n.id,`scale`),o=i===void 0?1:Hd(i,`grow`,e);(i!==void 0||a.size>0)&&t.getSource(n.id).setData({type:`FeatureCollection`,features:n.models.filter(e=>e.visible??!0).map(i=>{let s=a.get(i.id);return Uu(t,n,i,s===void 0?o:Hd(s,`grow`,e),r)})})}for(let i of Object.values(this.registry.groups.marker)){let{groupAnimation:a,modelAnimations:o}=this.getGroupAnimations(`marker`,i.id,`scale`),s=a===void 0?1:Hd(a,`grow`,e);(a!==void 0||o.size>0)&&t.getSource(i.id).setData({type:`FeatureCollection`,features:i.models.filter(e=>e.visible??!0).map(a=>{let c=o.get(a.id);return _u(t,i,a,c===void 0?s:Hd(c,`grow`,e),n,r)})})}let a=this.cameraCurve.sampleAutoHideOpacity(e);for(let t of this.mapstyle.layers){let n=this.getLayerOpacity(t,e,void 0);n===void 0?t.type===`symbol`&&this.setLayerOpacity(t,a):this.setLayerOpacity(t,n)}for(let[t,n]of this.overlays)for(let r of n.layers){let n=this.getLayerOpacity(r,e,t);n===void 0?this.resetLayerOpacity(r):this.setLayerOpacity(r,n)}}getGroupAnimations(e,t,n){let r,i=new Map;for(let a of this.registryAnimations){let{target:o}=a;o.modelType===e&&o.groupId===t&&(n===`opacity`&&Bd(a)||n===`scale`&&Vd(a))&&(o.modelId===void 0?r=a:i.set(o.modelId,a))}return{groupAnimation:r,modelAnimations:i}}getLayerOpacity(e,t,n){let r,i,a=1/0;n!==void 0&&(r=this.layerAnimations.find(e=>e.target.type===`overlay`&&e.target.id===n));for(let t of this.layerAnimations){let{target:n}=t;n.type===`layer`&&n.ids.includes(e.id)&&n.ids.length<a&&(i=t,a=n.ids.length)}let o=this.layerInfo[e.id]?.opacity??Zl[e.type].defaultValue;return i===void 0?r===void 0?void 0:Hd(r,`fade`,t)*o:Hd(i,`fade`,t)*o}setLayerOpacity(e,t){let n=this.mcMap.map,r=Zl[e.type];for(let i of r.props)n.setPaintProperty(e.id,i,t)}resetLayerOpacity(e){let t=this.mcMap.map,n=Zl[e.type],r=this.layerInfo[e.id]?.opacity;for(let i of n.props)t.setPaintProperty(e.id,i,r??e.paint?.[i]??n.defaultValue)}},Kd=class extends n{map;format;mapstyle;svgCache;backgroundColor;vapiUrl;accessToken;image;video;constructor(e,t,n,r,i,a,o,s,c,l,u,d){super(),this.map=e,this.format=t,this.mapstyle=o,this.svgCache=a,this.backgroundColor=l,this.vapiUrl=u,this.accessToken=d,this.image=new nd(this,t,a,l),n===`video`&&(r.video?.keyframes??[]).length>0&&(this.video=new Gd(this,r,i,a,o,s,c,l))}play(){this.video?.play()}pause(){this.video?.pause()}seekTo(e){this.video?.seekTo(e)}async*frames(e=!1){this.video===void 0?yield this.image.frame(e):yield*this.video.frames(e)}preload(){return this.video?.preload()??Promise.resolve()}geoTiffMetadata(e){return ed(this.map,e)}svgExportOptions(e,t,n){return{map:this.map,api:e,signal:n,options:{svgElements:Ae(this.map.getContainer()),fillPatterns:this.svgCache.getFillPatterns(2*window.devicePixelRatio),backgroundColor:this.backgroundColor,detailLevel:this.map.getDetailLevel(),forPDF:this.format===`pdf`,geoRef:this.format===`svg`&&!!t}}}pdfExportOptions(e){return Yu(this.mapstyle,this.svgCache.fonts,{vapiUrl:this.vapiUrl,accessToken:this.accessToken,apiUrl:e.href,bearerToken:e.token})}remove(){let e=this.map.getContainer();ru(this.map),this.video?.remove(),this.map.remove(),e.innerHTML=``,e.style.backgroundColor=``,e.classList.remove(`mc-map`),e.classList.remove(`mc-mode-web`)}};async function qd(t){let{accessToken:n,env:r=`production`}=t,a=r===`bleeding`?`https://vapi.bleeding.mc-cdn.io`:r===`beta`?`https://vapi.beta.mc-cdn.io`:`https://vapi.mc-cdn.io`,o=r===`bleeding`?`https://cdn.bleeding.mapcreator.io`:r===`beta`?`https://cdn.beta.mapcreator.io`:`https://cdn.mapcreator.io`,s=typeof t.job==`string`?await Jd(t.job,o,n):t.job,c=s.export?.format??`png`,l=eu[c]??`static`;await Yd();let u={container:t.container,attributionControl:!1,style:null,maxBounds:[-1/0,-90,1/0,90],maxPitch:85,maxZoom:22,locale:{"CooperativeGesturesHandler.WindowsHelpText":Oa(`windowsHelpText`),"CooperativeGesturesHandler.MacHelpText":Oa(`macHelpText`),"CooperativeGesturesHandler.MobileHelpText":Oa(`mobileHelpText`)},maxCanvasSize:F(),canvasContextAttributes:{preserveDrawingBuffer:t.preserveDrawingBuffer??!1}};l===`video`&&(u.maxTileCacheSize=1/0,u.maxTileCacheZoomLevels=1/0,u.refreshExpiredTiles=!1);let d=new i(u),f=d.getContainer();f.classList.add(`mc-map`),l===`interactive`&&f.classList.add(`mc-mode-web`);let p=l===`interactive`?new Lu(d,t.youTubePlaceholder??!1):void 0,{map:{language:m,hideBasemap:h,detailLevel:g=0,projection:v=`mercator`,terrain:b=!1,terrainExaggeration:S=1},registry:C={},web:w,positionOffsets:T}=s,{models:E={},slots:D={},svgs:O={}}=C,k=new Ue(d,await ge(r,a,n),a,n);d.resize();let A=l===`video`?s.video?.keyframes[0]:void 0,j=A?.pitch??s.map.pitch??0,M=A?.bearing??s.map.rotation??0,N=A?.zoom??s.map.zoom,P=A?.center===void 0?s.map.center:{lng:A.center[0],lat:A.center[1]};d.setPitch(j),d.setBearing(M);let ee=R(s,f,l,c),I,te;l===`interactive`?(te=N-g+Math.log2(ee),I=1):(te=N-g,I=ee,d.on(`resize`,()=>{let e=R(s,f,l,c);e!==d.getScale()&&d.setScale(e)})),d.setScale(I),d.setZoom(te),d.setCenter(P),d.setDetailLevel(g),d.setMinZoom(g),d.addControl(new e({compact:!1})),await iu(s,T??Yl,d,k,{center:P,zoom:te,pitch:j,rotation:M},o,l),p?.setJobObject(s);let ne=l!==`interactive`||(w?.restrictMapMovement??!1);ne&&(d.boxZoom.disable(),d.doubleClickZoom.disable(),d.dragPan.disable(),d.dragRotate.disable(),d.keyboard.disable(),d.scrollZoom.disable(),d.touchPitch.disable(),d.touchZoomRotate.disable(),d.getCanvasContainer().style.cursor=`default`),p?.setParams(w?.popupPosition??`bottomLeft`,x(m,y.TWO),ne,P);let re=s.meta?.mapstyleSet,L=re===void 0?{version:8,sources:{},layers:[]}:await fetch(`${a}/styles/${re}.json?access_token=${n}`).then(e=>e.json());lu(L),d.setStyle(null),d.setStyle(L),await d.once(`style.load`),ue(d,l),d.on(`moveend`,()=>ue(d,l)),d.on(`resize`,()=>ue(d,l)),d.on(`attributionchange`,()=>ue(d,l)),_(m,d);let z=s.map.overlays??[],ie=s.meta?.layers??[];z.length!==ie.length&&(z=[],ie=[]);let ae=await vu(z,ie,d,a,n,L.metadata?.styleOverride),oe=z.reduce((e,t,n)=>e.set(t,ae[n]),new Map);tf(d,k,E,D,O,a,n,l),_(m,d),p?.setPublication(L.metadata?.publication),p?.setpopupElements(),p?.setHighlightManager(),d.setProjection({type:v===`globe`?`globe`:`mercator`});let se=Xd(d,v);Zd(d,se),b&&Qd(d,a,n,S);let ce=$d(s.map.layerInfo,L,ae);ef(d,ce,!h);let le=new Kd(d,c,l,s,O,k,L,oe,ce,se,a,n);return await k.settledImages(),le}function Jd(e,t,n){return fetch(`${t}/jobs/${e}.json?access_token=${n}`).then(e=>e.json())}function Yd(){return new Promise(e=>{let t=()=>{window.innerWidth>0&&window.innerHeight>0&&(window.removeEventListener(`resize`,t),e())};window.addEventListener(`resize`,t),t()})}function Xd(e,t){let n=e.getStyle().metadata??{},r=n[`mc:background-color`]??`#f8f8f8`,i=n[`mc:background-color-globe`]??`#000000`;return t===`globe`?i:r}function Zd(e,t){e.getContainer().style.backgroundColor=t,e.setSky(e.getStyle().sky??Jl),e.setLight({position:[1.15,210,45]})}function Qd(e,t,n,r){e.addSource(`mc-dem`,{type:`raster-dem`,tiles:[`${t}/dataset/jaxa_terrainrgb/{z}/{x}/{y}?access_token=${n}`],attribution:`<a href="https://earth.jaxa.jp/en/data/policy" target="_blank">© AW3D30 (JAXA)</a>`,minzoom:0,maxzoom:12}),e.setTerrain({source:`mc-dem`,exaggeration:r})}function $d(e,t,n){let r=e?.reduce((e,t)=>(e[t.id]={visibility:t.visibility,...t.opacity!==void 0&&{opacity:t.opacity}},e),{})??{},i={};for(let e of t.layers)i[e.id]=r[e.id]??{visibility:(e.layout?.visibility??`visible`)===`visible`};for(let e of n)for(let t of e.layers)i[t.id]=r[t.id]??{visibility:!1};return i}function ef(e,t,n){for(let r in t){let i=e.getLayer(r);if(i!==void 0){let a=t[r];if(e.setLayoutProperty(r,`visibility`,a.visibility&&n?`visible`:`none`),a.opacity!==void 0){let t=Zl[i.type];for(let n of t.props)e.setPaintProperty(r,n,a.opacity)}}}}function tf(e,t,n,r,i,a,o,s){let{beforeNone:c=[],beforeNames:l=[],beforeBoundaries:u=[],beforeWaters:d=[]}=r;c.forEach(r=>{nf(e,t,n,r,i,`mc-before-none`,a,o,s)}),l.forEach(r=>{nf(e,t,n,r,i,`mc-before-names`,a,o,s)}),u.forEach(r=>{nf(e,t,n,r,i,`mc-before-boundaries`,a,o,s)}),d.forEach(r=>{nf(e,t,n,r,i,`mc-before-waters`,a,o,s)})}function nf(e,t,n,r,i,a,o,s,c){if(r.type===`marker`){let o=n.marker?.find(e=>e.id===r.groupId);o&&hu(e,o,a,i,t,c)}else if(r.type===`polygon`){let o=n.polygon?.find(e=>e.id===r.groupId);o&&uu(e,o,a,i,t)}else if(r.type===`circle`){let o=n.circle?.find(e=>e.id===r.groupId);o&&fu(e,o,a,i,t)}else if(r.type===`line`){let i=n.line?.find(e=>e.id===r.groupId);i&&Hu(e,i,a,t,c)}else if(r.type===`dot`){let t=n.dot?.find(e=>e.id===r.groupId);t&&Ku(e,t,a)}else if(r.type===`area`){let c=n.area?.find(e=>e.id===r.groupId);c&&Gu(e,c,a,i,t,o,s)}}export{qd as initMap};
545
+ `,Bd=class{callbacks;duration;container;mapContainer;playButton;restartButton;fullscreenButton;slider;sliderFill;playheadLabel;playhead=0;isPlaying=!1;constructor(e,t,n){this.duration=t,this.callbacks=n,this.mapContainer=e.getContainer(),this.container=document.createElement(`div`),this.container.className=`video-controls`,this.container.innerHTML=zd(t),this.playButton=this.container.querySelector(`.video-button.play`),this.restartButton=this.container.querySelector(`.video-button.restart`),this.fullscreenButton=this.container.querySelector(`.video-button.fullscreen`),this.slider=this.container.querySelector(`.video-slider`),this.sliderFill=this.container.querySelector(`.video-slider-line-left`),this.playheadLabel=this.container.querySelector(`.video-playhead`),this.playButton.addEventListener(`click`,()=>this.callbacks.playPause()),this.restartButton.addEventListener(`click`,()=>this.callbacks.restart()),this.fullscreenButton.addEventListener(`click`,()=>ya(this.mapContainer)),this.slider.addEventListener(`input`,()=>{this.duration>0&&this.callbacks.seek(Number(this.slider.value))}),this.mapContainer.appendChild(this.container),this.update()}setPlayhead(e){this.playhead=e,this.update()}setPlaying(e){this.isPlaying=e,this.update()}update(){let{duration:e,playhead:t}=this;this.playButton.classList.toggle(`playing`,this.isPlaying),this.restartButton.classList.toggle(`disabled`,t===0),this.slider.value=String(t),this.sliderFill.style.width=`${te(0,e,t)*100}%`,this.playheadLabel.textContent=dd(t)}},Vd=class extends t{time;constructor(e,t){super(e),this.time=t}},Hd={linear:Ad,easeOutCubic:jd,easeOutBack:Nd,easeOutBounce:Pd,easeOutElastic:Md};function Ud(e){return e.entryType===`fade`||e.exitType===`fade`||e.entryType===`instant`||e.exitType===`instant`}function Wd(e){return e.entryType===`grow`||e.exitType===`grow`}function Gd(e,t,n){let{entry:r,entryDuration:i,exit:a,exitDuration:o}=e,{entryType:s,entryEasing:c,exitType:l,exitEasing:u}=e;return n<r&&(s===t||s===`instant`&&t===`fade`)||n>a&&(l===t||l===`instant`&&t===`fade`)?0:i>0&&n<r+i&&s===t?Hd[c](n-r,0,1,i):o>0&&n>a-o&&l===t?Hd[u](n-(a-o),1,-1,o):1}function Kd(e){return e.target.type===`model`}function qd(e){return e.target.type===`layer`||e.target.type===`overlay`}var Jd=class{mcMap;cameraCurve;registryAnimations;layerAnimations;registry;svgs;svgCache;duration;frameRate;loop;mapstyle;overlays;layerInfo;backgroundColor;playhead;playbackContext;controls;preloadOverlay;constructor(e,t,n,r,i,o,s,c){this.mcMap=e,this.playhead=0,this.playbackContext=void 0;let l=(t.video?.keyframes??[]).map(e=>{let{x:t,y:n}=a.fromLngLat(e.center);return{...e,x:t,y:n,fov:e.fov??36.87,elevation:e.elevation??0}}),u=t.video?.animations??[];this.layerAnimations=u.filter(qd);let d=u.filter(Kd);this.registryAnimations=[...d.filter(e=>e.target.modelId===void 0),...d.filter(e=>e.target.modelId!==void 0)],this.duration=ud(l),this.frameRate=fd(t.export?.frameRate??60),this.cameraCurve=new Fd(l),this.registry=new Ru(t),this.svgs=n,this.svgCache=r,this.mapstyle=i,this.overlays=o,this.layerInfo=s,this.backgroundColor=c;let f=t.export?.format===`web_video`;this.loop=f&&(t.web?.loop??!1),f&&t.web?.controls&&(this.controls=new Bd(e.map,this.duration,{playPause:()=>this.playbackContext===void 0?this.play():this.pause(),restart:()=>{this.seekTo(0),this.play()},seek:e=>{this.pause(),this.seekTo(e)}}));let p=this.mcMap.map;p.setCenterClampedToGround(!1),p.setRasterAlignment(!1),p.style?.stylesheet&&(p.style.stylesheet.transition={duration:0,delay:0}),this.setFrame(0),f&&this.launch(t)}async launch(e){e.web?.preload&&await this.preload(),e.web?.autoplay&&setTimeout(()=>this.play())}play(){this.playbackContext===void 0&&this.duration>0&&(this.playhead>=this.duration&&(this.playhead=0),this.playbackContext={startTime:Date.now(),startPlayhead:this.playhead},this.mcMap.fire(new Vd(`playstart`,this.playhead)),this.controls?.setPlaying(!0),this.playFrame())}pause(){this.playbackContext!==void 0&&(this.playbackContext=void 0,this.mcMap.fire(new Vd(`playend`,this.playhead)),this.controls?.setPlaying(!1))}seekTo(e){this.duration>0&&(e=ne(e,0,this.duration),this.setFrame(e),this.playbackContext!==void 0&&(this.playbackContext={startTime:Date.now(),startPlayhead:e}))}remove(){this.playbackContext=void 0}async*frames(e){let t=this.mcMap.map,n=Math.ceil(this.duration*this.frameRate/1e3);t._fadeDuration=0;let r=t.getCanvas(),{width:i,height:a}=r,o=new OffscreenCanvas(i,a),s=o.getContext(`2d`,{willReadFrequently:!0}),c=t.getContainer(),l=c.getBoundingClientRect();for(let t=0;t<n;t++)yield this.captureFrame(t*1e3/this.frameRate,e,r,o,s,i,a,c,l);t._fadeDuration=300,this.playhead=0}async preload(){this.playbackContext!==void 0&&this.pause();let e=this.mcMap.map,t=Math.ceil(this.duration*this.frameRate/1e3),n=new Map,r=new Set;for(let t of Object.values(e.style.tileManagers)){let e=t.getSource();if(e.type===`vector`||e.type===`raster`||e.type===`raster-dem`||e.type===`geojson`){let r=t.usedForTerrain?t.tileSize:e.tileSize,i=!t.usedForTerrain&&(e.roundZoom??!1);n.set(`${r}/${i}`,{tileSize:r,roundZoom:i})}}this.preloadOverlay=new hd(this.mcMap.map),e._fadeDuration=0;try{let i,a=new Set;for(let o=0;o<t;o++){this.preloadOverlay?.setProgress(o/t);let s=this.cameraCurve.sample(o*1e3/this.frameRate);if(pd(i,s))continue;this.setCamera(s);let c=new Set([...n].flatMap(([t,n])=>e.coveringTiles(n).map(e=>`${t}/${e.key}`)));if(i!==void 0&&[...a].some(e=>!r.has(e)&&!c.has(e))){this.setCamera(i),await e.once(`idle`);for(let e of a)r.add(e)}i=s,a=c}i!==void 0&&(this.setCamera(i),await e.once(`idle`))}finally{this.setFrame(this.playhead),e._fadeDuration=300,this.preloadOverlay?.remove(),this.preloadOverlay=void 0}}async captureFrame(e,t,n,r,i,a,o,s,c){return this.setFrame(e),await this.mcMap.map.once(`idle`),i.fillStyle=this.backgroundColor,i.fillRect(0,0,a,o),i.drawImage(n,0,0),await je(i,this.svgCache,s,c),t?r.convertToBlob():i.getImageData(0,0,a,o)}playFrame(){if(this.playbackContext!==void 0){let e=this.playbackContext.startPlayhead+(Date.now()-this.playbackContext.startTime);e>this.duration?this.loop?(this.seekTo(0),requestAnimationFrame(()=>this.playFrame())):(this.setFrame(this.duration),this.playbackContext=void 0,this.mcMap.fire(new Vd(`playend`,this.playhead)),this.controls?.setPlaying(!1)):(this.setFrame(e),requestAnimationFrame(()=>this.playFrame()))}}setFrame(e){this.playhead=e;let t=this.cameraCurve.sample(e);this.setCamera(t),this.applyAnimations(e),this.mcMap.fire(new Vd(`play`,e)),this.controls?.setPlayhead(e)}setCamera(e){let t=this.mcMap.map,n=t.getCenter(),r=t.getZoom(),i=t.getBearing(),a=t.getPitch(),o=t.getCenterElevation(),s=t.getVerticalFieldOfView();e.center.lat!==n.lat||e.center.lng!==n.lng||e.zoom!==r||e.bearing!==i||e.pitch!==a||e.elevation!==o||e.fov!==s?(t.setVerticalFieldOfView(e.fov),t.jumpTo(e)):t.triggerRepaint()}applyAnimations(e){let t=this.mcMap.map,{svgs:n,svgCache:r,registryAnimations:i}=this;for(let n of i){let{target:r}=n;if(!Ud(n))continue;let{modelType:i,groupId:a,modelId:o}=r,s=Gd(n,`fade`,e);if(i===`area`){let e=this.registry.models.area[a]??{},n=o===void 0?Object.values(e):e[o]?[e[o]]:[];for(let e of n)t.setFeatureState({source:wi(e),sourceLayer:e.sourceLayerId,id:e.featureId},{[`opacity-${a}`]:s})}else if(i===`polygon`||i===`circle`||i===`line`||i===`marker`||i===`dot`){let e=this.registry.models[i][a]??{},n=o===void 0?Object.keys(e):[o];for(let e of n)t.setFeatureState({source:a,id:E(e)},{opacity:s})}}for(let i of Object.values(this.registry.groups.circle)){let{groupAnimation:a,modelAnimations:o}=this.getGroupAnimations(`circle`,i.id,`scale`),s=a===void 0?1:Gd(a,`grow`,e);(a!==void 0||o.size>0)&&t.getSource(i.id).setData({type:`FeatureCollection`,features:i.models.filter(e=>e.visible??!0).map(t=>{let a=o.get(t.id);return gu(i,t,a===void 0?s:Gd(a,`grow`,e),n,r)})})}for(let n of Object.values(this.registry.groups.line)){let{groupAnimation:i,modelAnimations:a}=this.getGroupAnimations(`line`,n.id,`scale`),o=i===void 0?1:Gd(i,`grow`,e);(i!==void 0||a.size>0)&&t.getSource(n.id).setData({type:`FeatureCollection`,features:n.models.filter(e=>e.visible??!0).map(i=>{let s=a.get(i.id);return Ku(t,n,i,s===void 0?o:Gd(s,`grow`,e),r)})})}for(let i of Object.values(this.registry.groups.marker)){let{groupAnimation:a,modelAnimations:o}=this.getGroupAnimations(`marker`,i.id,`scale`),s=a===void 0?1:Gd(a,`grow`,e);(a!==void 0||o.size>0)&&t.getSource(i.id).setData({type:`FeatureCollection`,features:i.models.filter(e=>e.visible??!0).map(a=>{let c=o.get(a.id);return bu(t,i,a,c===void 0?s:Gd(c,`grow`,e),n,r)})})}let a=this.cameraCurve.sampleAutoHideOpacity(e);for(let t of this.mapstyle.layers){let n=this.getLayerOpacity(t,e,void 0);n===void 0?t.type===`symbol`&&this.setLayerOpacity(t,a):this.setLayerOpacity(t,n)}for(let[t,n]of this.overlays)for(let r of n.layers){let n=this.getLayerOpacity(r,e,t);n===void 0?this.resetLayerOpacity(r):this.setLayerOpacity(r,n)}}getGroupAnimations(e,t,n){let r,i=new Map;for(let a of this.registryAnimations){let{target:o}=a;o.modelType===e&&o.groupId===t&&(n===`opacity`&&Ud(a)||n===`scale`&&Wd(a))&&(o.modelId===void 0?r=a:i.set(o.modelId,a))}return{groupAnimation:r,modelAnimations:i}}getLayerOpacity(e,t,n){let r,i,a=1/0;n!==void 0&&(r=this.layerAnimations.find(e=>e.target.type===`overlay`&&e.target.id===n));for(let t of this.layerAnimations){let{target:n}=t;n.type===`layer`&&n.ids.includes(e.id)&&n.ids.length<a&&(i=t,a=n.ids.length)}let o=this.layerInfo[e.id]?.opacity??eu[e.type].defaultValue;return i===void 0?r===void 0?void 0:Gd(r,`fade`,t)*o:Gd(i,`fade`,t)*o}setLayerOpacity(e,t){let n=this.mcMap.map,r=eu[e.type];for(let i of r.props)n.setPaintProperty(e.id,i,t)}resetLayerOpacity(e){let t=this.mcMap.map,n=eu[e.type],r=this.layerInfo[e.id]?.opacity;for(let i of n.props)t.setPaintProperty(e.id,i,r??e.paint?.[i]??n.defaultValue)}},Yd=class extends n{map;format;mapstyle;svgCache;backgroundColor;vapiUrl;accessToken;image;video;constructor(e,t,n,r,i,a,o,s,c,l,u,d){super(),this.map=e,this.format=t,this.mapstyle=o,this.svgCache=a,this.backgroundColor=l,this.vapiUrl=u,this.accessToken=d,this.image=new ad(this,t,a,l),n===`video`&&(r.video?.keyframes??[]).length>0&&(this.video=new Jd(this,r,i,a,o,s,c,l))}play(){this.video?.play()}pause(){this.video?.pause()}seekTo(e){this.video?.seekTo(e)}async*frames(e=!1){this.video===void 0?yield this.image.frame(e):yield*this.video.frames(e)}preload(){return this.video?.preload()??Promise.resolve()}geoTiffMetadata(e){return rd(this.map,e)}svgExportOptions(e,t,n){return{map:this.map,api:e,signal:n,options:{svgElements:Ae(this.map.getContainer()),fillPatterns:this.svgCache.getFillPatterns(2*window.devicePixelRatio),backgroundColor:this.backgroundColor,detailLevel:this.map.getDetailLevel(),forPDF:this.format===`pdf`,geoRef:this.format===`svg`&&!!t}}}pdfExportOptions(e){return Qu(this.mapstyle,this.svgCache.fonts,{vapiUrl:this.vapiUrl,accessToken:this.accessToken,apiUrl:e.href,bearerToken:e.token})}remove(){let e=this.map.getContainer();ou(this.map),this.video?.remove(),this.map.remove(),e.innerHTML=``,e.style.backgroundColor=``,e.classList.remove(`mc-map`),e.classList.remove(`mc-mode-web`)}};async function Xd(t){let{accessToken:n,env:r=`production`}=t,a=r===`bleeding`?`https://vapi.bleeding.mc-cdn.io`:r===`beta`?`https://vapi.beta.mc-cdn.io`:`https://vapi.mc-cdn.io`,o=r===`bleeding`?`https://cdn.bleeding.mapcreator.io`:r===`beta`?`https://cdn.beta.mapcreator.io`:`https://cdn.mapcreator.io`,s=typeof t.job==`string`?await Zd(t.job,o,n):t.job,c=s.export?.format??`png`,l=ru[c]??`static`;await Qd();let u={container:t.container,attributionControl:!1,style:null,maxBounds:[-1/0,-90,1/0,90],maxPitch:85,maxZoom:22,locale:{"CooperativeGesturesHandler.WindowsHelpText":ja(`windowsHelpText`),"CooperativeGesturesHandler.MacHelpText":ja(`macHelpText`),"CooperativeGesturesHandler.MobileHelpText":ja(`mobileHelpText`)},maxCanvasSize:F(),canvasContextAttributes:{preserveDrawingBuffer:t.preserveDrawingBuffer??!1}};l===`video`&&(u.maxTileCacheSize=1/0,u.maxTileCacheZoomLevels=1/0,u.refreshExpiredTiles=!1);let d=new i(u),f=d.getContainer();f.classList.add(`mc-map`),l===`interactive`&&f.classList.add(`mc-mode-web`);let p=l===`interactive`?new Bu(d,t.youTubePlaceholder??!1):void 0,{map:{language:m,hideBasemap:h,detailLevel:g=0,projection:v=`mercator`,terrain:b=!1,terrainExaggeration:S=1},registry:C={},web:w,positionOffsets:T}=s,{models:E={},slots:D={},svgs:O={}}=C,k=new Ue(d,await ge(r,a,n),a,n);d.resize();let A=l===`video`?s.video?.keyframes[0]:void 0,j=A?.pitch??s.map.pitch??0,M=A?.bearing??s.map.rotation??0,N=A?.zoom??s.map.zoom,P=A?.center===void 0?s.map.center:{lng:A.center[0],lat:A.center[1]};d.setPitch(j),d.setBearing(M);let ee=R(s,f,l,c),I,te;l===`interactive`?(te=N-g+Math.log2(ee),I=1):(te=N-g,I=ee,d.on(`resize`,()=>{let e=R(s,f,l,c);e!==d.getScale()&&d.setScale(e)})),d.setScale(I),d.setZoom(te),d.setCenter(P),d.setDetailLevel(g),d.setMinZoom(g),d.addControl(new e({compact:!1})),await su(s,T??Ql,d,k,{center:P,zoom:te,pitch:j,rotation:M},o,l),p?.setJobObject(s);let ne=l!==`interactive`||(w?.restrictMapMovement??!1);ne&&(d.boxZoom.disable(),d.doubleClickZoom.disable(),d.dragPan.disable(),d.dragRotate.disable(),d.keyboard.disable(),d.scrollZoom.disable(),d.touchPitch.disable(),d.touchZoomRotate.disable(),d.getCanvasContainer().style.cursor=`default`),p?.setParams(w?.popupPosition??`bottomLeft`,x(m,y.TWO),ne,P);let re=s.meta?.mapstyleSet,L=re===void 0?{version:8,sources:{},layers:[]}:await fetch(`${a}/styles/${re}.json?access_token=${n}`).then(e=>e.json());fu(L),d.setStyle(null),d.setStyle(L),await d.once(`style.load`),ue(d,l),d.on(`moveend`,()=>ue(d,l)),d.on(`resize`,()=>ue(d,l)),d.on(`attributionchange`,()=>ue(d,l)),_(m,d);let z=s.map.overlays??[],ie=s.meta?.layers??[];z.length!==ie.length&&(z=[],ie=[]);let ae=await xu(z,ie,d,a,n,L.metadata?.styleOverride),oe=z.reduce((e,t,n)=>e.set(t,ae[n]),new Map);af(d,k,E,D,O,a,n,l),_(m,d),p?.setPublication(L.metadata?.publication),p?.setpopupElements(),p?.setHighlightManager(),d.setProjection({type:v===`globe`?`globe`:`mercator`});let se=$d(d,v);ef(d,se),b&&tf(d,a,n,S);let ce=nf(s.map.layerInfo,L,ae);rf(d,ce,!h);let le=new Yd(d,c,l,s,O,k,L,oe,ce,se,a,n);return await k.settledImages(),le}function Zd(e,t,n){return fetch(`${t}/jobs/${e}.json?access_token=${n}`).then(e=>e.json())}function Qd(){return new Promise(e=>{let t=()=>{window.innerWidth>0&&window.innerHeight>0&&(window.removeEventListener(`resize`,t),e())};window.addEventListener(`resize`,t),t()})}function $d(e,t){let n=e.getStyle().metadata??{},r=n[`mc:background-color`]??`#f8f8f8`,i=n[`mc:background-color-globe`]??`#000000`;return t===`globe`?i:r}function ef(e,t){e.getContainer().style.backgroundColor=t,e.setSky(e.getStyle().sky??Zl),e.setLight({position:[1.15,210,45]})}function tf(e,t,n,r){e.addSource(`mc-dem`,{type:`raster-dem`,tiles:[`${t}/dataset/jaxa_terrainrgb/{z}/{x}/{y}?access_token=${n}`],attribution:`<a href="https://earth.jaxa.jp/en/data/policy" target="_blank">© AW3D30 (JAXA)</a>`,minzoom:0,maxzoom:12}),e.setTerrain({source:`mc-dem`,exaggeration:r})}function nf(e,t,n){let r=e?.reduce((e,t)=>(e[t.id]={visibility:t.visibility,...t.opacity!==void 0&&{opacity:t.opacity}},e),{})??{},i={};for(let e of t.layers)i[e.id]=r[e.id]??{visibility:(e.layout?.visibility??`visible`)===`visible`};for(let e of n)for(let t of e.layers)i[t.id]=r[t.id]??{visibility:!1};return i}function rf(e,t,n){for(let r in t){let i=e.getLayer(r);if(i!==void 0){let a=t[r];if(e.setLayoutProperty(r,`visibility`,a.visibility&&n?`visible`:`none`),a.opacity!==void 0){let t=eu[i.type];for(let n of t.props)e.setPaintProperty(r,n,a.opacity)}}}}function af(e,t,n,r,i,a,o,s){let{beforeNone:c=[],beforeNames:l=[],beforeBoundaries:u=[],beforeWaters:d=[]}=r;c.forEach(r=>{of(e,t,n,r,i,`mc-before-none`,a,o,s)}),l.forEach(r=>{of(e,t,n,r,i,`mc-before-names`,a,o,s)}),u.forEach(r=>{of(e,t,n,r,i,`mc-before-boundaries`,a,o,s)}),d.forEach(r=>{of(e,t,n,r,i,`mc-before-waters`,a,o,s)})}function of(e,t,n,r,i,a,o,s,c){if(r.type===`marker`){let o=n.marker?.find(e=>e.id===r.groupId);o&&vu(e,o,a,i,t,c)}else if(r.type===`polygon`){let o=n.polygon?.find(e=>e.id===r.groupId);o&&pu(e,o,a,i,t)}else if(r.type===`circle`){let o=n.circle?.find(e=>e.id===r.groupId);o&&hu(e,o,a,i,t)}else if(r.type===`line`){let i=n.line?.find(e=>e.id===r.groupId);i&&Gu(e,i,a,t,c)}else if(r.type===`dot`){let t=n.dot?.find(e=>e.id===r.groupId);t&&Yu(e,t,a)}else if(r.type===`area`){let c=n.area?.find(e=>e.id===r.groupId);c&&Ju(e,c,a,i,t,o,s)}}export{Xd as initMap};