Files

58 lines
466 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=`modulepreload`,t=function(e){return`/`+e},n={},r=function(e){return e.pathname.endsWith(`.css`)},i=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},a=function(a,o,s){let c=Promise.resolve();if(o&&o.length>0){let a,l=document.querySelector(`meta[property=csp-nonce]`),u=l?.nonce||l?.getAttribute(`nonce`);function d(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function f(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}c=d(o.map(o=>{o=t(o,s);let c=f(o),l=r(c);return i(n,c.href,()=>{if(a===void 0){a={all:new Set,styles:new Set};let e=document.getElementsByTagName(`link`);for(let t=e.length-1;t>=0;t--){let n=e[t];a.all.add(n.href),n.rel===`stylesheet`&&a.styles.add(n.href)}}if((l?a.styles:a.all).has(c.href))return;let t=document.createElement(`link`);if(t.rel=l?`stylesheet`:e,l||(t.as=`script`),t.crossOrigin=``,t.href=c.href,u&&t.setAttribute(`nonce`,u),document.head.appendChild(t),l)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${c}`)))})})}).filter(e=>e!==void 0))}function l(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return c.then(e=>{for(let t of e||[])t.status===`rejected`&&l(t.reason);return a().catch(l)})},o=`true`,s=`false`,c=o===`true`,l=s===`true`;function u(e={}){let{immediate:t=!1,onNeedReload:n,onNeedRefresh:r,onOfflineReady:i,onRegistered:o,onRegisteredSW:s,onRegisterError:u}=e,d,f,p,m=async(e=!0)=>{await f,c||p?.()};async function h(){if(`serviceWorker`in navigator){if(d=await a(async()=>{let{Workbox:e}=await import(`./workbox-window.prod.es5-Bd17z0YL.js`);return{Workbox:e}},[]).then(({Workbox:e})=>new e(`/sw.js`,{scope:`/`,type:`classic`})).catch(e=>{u?.(e)}),!d)return;if(p=()=>{d?.messageSkipWaiting()},!l){if(c)d.addEventListener(`activated`,e=>{(e.isUpdate||e.isExternal)&&(n?n():window.location.reload())}),d.addEventListener(`installed`,e=>{e.isUpdate||i?.()});else{let e=!1,t=()=>{e=!0,d?.addEventListener(`controlling`,e=>{e.isUpdate&&(n?n():window.location.reload())}),r?.()};d.addEventListener(`installed`,n=>{n.isUpdate===void 0?n.isExternal===void 0?!e&&i?.():n.isExternal?t():!e&&i?.():n.isUpdate||i?.()}),d.addEventListener(`waiting`,t)}}d.register({immediate:t}).then(e=>{s?s(`/sw.js`,e):o?.(e)}).catch(e=>{u?.(e)})}}return f=h(),m}var d=`kacheln`;function f(e){return`/kacheln/${e}.png`}function p(e){if(!e.startsWith(`/kacheln/`)||!e.endsWith(`.png`))return null;let t=e.slice(9,-4);return t.length>0?t:null}function m(){return{async ids(){let e=await(await caches.open(d)).keys(),t=[];for(let n of e){let e=p(new URL(n.url).pathname);e&&t.push(e)}return t},async put(e,t){let n=await caches.open(d),r=new Uint8Array(t);await n.put(f(e),new Response(r,{headers:{"Content-Type":`image/png`}}))},async delete(e){let t=await caches.open(d);await Promise.all(e.map(e=>t.delete(f(e))))}}}var h=`karte-shell-repaired`;async function g(e){let t=await e.registrations();await Promise.all(t.map(e=>e.unregister()));let n=await e.cacheNames();await Promise.all(n.filter(e=>e!==d).map(t=>e.deleteCache(t)))}async function _(e){await e.deleteCache(d)}function v(e){return e instanceof Error&&e.message.trim()?e.message:`Unbekannter Fehler`}function y(){return{async registrations(){return navigator.serviceWorker?navigator.serviceWorker.getRegistrations():[]},cacheNames:()=>caches.keys(),deleteCache:e=>caches.delete(e)}}function b(e=C()){try{return e?.getItem(h)===`1`}catch{return!1}}function x(e=C()){try{e?.setItem(h,`1`)}catch{}}function S(e=C()){try{e?.removeItem(h)}catch{}}function C(){try{return typeof sessionStorage>`u`?null:sessionStorage}catch{return null}}function w(){return{async fetch(e,t){let n=await fetch(f(e),{signal:t,cache:`no-store`});if(!n.ok)throw Error(`Kachel ${e} konnte nicht geladen werden.`);return new Uint8Array(await n.arrayBuffer())}}}var T=`karte`,E=`marks`,D=`heruntergeladen`;function O(){return new Promise((e,t)=>{let n=indexedDB.open(T,1);n.onupgradeneeded=()=>{let e=n.result;e.objectStoreNames.contains(E)||e.createObjectStore(E)},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error??Error(`IndexedDB`))})}function k(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function A(e){if(Array.isArray(e))return{heruntergeladen:k(e),ziele:[],downloadKnopf:!1};if(e&&typeof e==`object`){let t=e;return{heruntergeladen:k(t.heruntergeladen),ziele:k(t.ziele),downloadKnopf:t.downloadKnopf===!0}}return{heruntergeladen:[],ziele:[],downloadKnopf:!1}}function ee(e,t){return new Promise((n,r)=>{e.oncomplete=()=>n(t()),e.onerror=()=>r(e.error??Error(`IndexedDB`)),e.onabort=()=>r(e.error??Error(`IndexedDB`))})}function te(){return{async read(){let e=await O();try{let t=e.transaction(E,`readonly`),n=t.objectStore(E).get(D);return A(await ee(t,()=>n.result))}finally{e.close()}},async write(e){let t=await O();try{let n=t.transaction(E,`readwrite`);n.objectStore(E).put({heruntergeladen:e.heruntergeladen,ziele:e.ziele,downloadKnopf:e.downloadKnopf},D),await ee(n,()=>void 0)}finally{t.close()}}}}function ne(e){e(`EPSG:4326`,`+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees`),e(`EPSG:4269`,`+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees`),e(`EPSG:3857`,`+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs`);for(var t=1;t<=60;++t)e(`EPSG:`+(32600+t),`+proj=utm +zone=`+t+` +datum=WGS84 +units=m`),e(`EPSG:`+(32700+t),`+proj=utm +zone=`+t+` +south +datum=WGS84 +units=m`);e(`EPSG:5041`,`+title=WGS 84 / UPS North (E,N) +proj=stere +lat_0=90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m`),e(`EPSG:5042`,`+title=WGS 84 / UPS South (E,N) +proj=stere +lat_0=-90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m`),e.WGS84=e[`EPSG:4326`],e[`EPSG:3785`]=e[`EPSG:3857`],e.GOOGLE=e[`EPSG:3857`],e[`EPSG:900913`]=e[`EPSG:3857`],e[`EPSG:102113`]=e[`EPSG:3857`]}var re=6378137,j=6356752.314,ie=.0066943799901413165,ae=484813681109536e-20,M=Math.PI/2,oe=.16666666666666666,se=.04722222222222222,ce=.022156084656084655,le=1e-10,N=.017453292519943295,ue=57.29577951308232,P=Math.PI/4,de=Math.PI*2,fe=3.14159265359,pe={};pe.greenwich=0,pe.lisbon=-9.131906111111,pe.paris=2.337229166667,pe.bogota=-74.080916666667,pe.madrid=-3.687938888889,pe.rome=12.452333333333,pe.bern=7.439583333333,pe.jakarta=106.807719444444,pe.ferro=-17.666666666667,pe.brussels=4.367975,pe.stockholm=18.058277777778,pe.athens=23.7163375,pe.oslo=10.722916666667;var me={mm:{to_meter:.001},cm:{to_meter:.01},ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937},fath:{to_meter:1.8288},kmi:{to_meter:1852},"us-ch":{to_meter:20.1168402336805},"us-mi":{to_meter:1609.34721869444},km:{to_meter:1e3},"ind-ft":{to_meter:.30479841},"ind-yd":{to_meter:.91439523},mi:{to_meter:1609.344},yd:{to_meter:.9144},ch:{to_meter:20.1168},link:{to_meter:.201168},dm:{to_meter:.1},in:{to_meter:.0254},"ind-ch":{to_meter:20.11669506},"us-in":{to_meter:.025400050800101},"us-yd":{to_meter:.914401828803658}},he=/[\s_\-\/\(\)]/g;function ge(e,t){if(e[t])return e[t];for(var n=Object.keys(e),r=t.toLowerCase().replace(he,``),i=-1,a,o;++i<n.length;)if(a=n[i],o=a.toLowerCase().replace(he,``),o===r)return e[a]}function _e(e){var t={},n=e.split(`+`).map(function(e){return e.trim()}).filter(function(e){return e}).reduce(function(e,t){var n=t.split(`=`);return n.push(!0),e[n[0].toLowerCase()]=n[1],e},{}),r,i,a,o={proj:function(e){t.projName=[`lonlat`,`latlon`,`latlong`].includes(e)?`longlat`:e},datum:`datumCode`,rf:function(e){t.rf=parseFloat(e)},lat_0:function(e){t.lat0=e*N},lat_1:function(e){t.lat1=e*N},lat_2:function(e){t.lat2=e*N},lat_ts:function(e){t.lat_ts=e*N},lon_0:function(e){t.long0=e*N},lon_wrap:function(e){t.long_wrap=parseFloat(e)*N},lon_1:function(e){t.long1=e*N},lon_2:function(e){t.long2=e*N},alpha:function(e){t.alpha=parseFloat(e)*N},gamma:function(e){t.rectified_grid_angle=parseFloat(e)*N},lonc:function(e){t.longc=e*N},x_0:function(e){t.x0=parseFloat(e)},y_0:function(e){t.y0=parseFloat(e)},k_0:function(e){t.k0=parseFloat(e)},k:function(e){t.k0=parseFloat(e)},a:function(e){t.a=parseFloat(e)},b:function(e){t.b=parseFloat(e)},r:function(e){t.a=t.b=parseFloat(e)},r_a:function(){t.R_A=!0},zone:function(e){t.zone=parseInt(e,10)},south:function(){t.utmSouth=!0},towgs84:function(e){t.datum_params=e.split(`,`).map(function(e){return parseFloat(e)})},to_meter:function(e){t.to_meter=parseFloat(e)},units:function(e){t.units=e;var n=ge(me,e);n&&(t.to_meter=n.to_meter)},from_greenwich:function(e){t.from_greenwich=e*N},pm:function(e){t.from_greenwich=(ge(pe,e)||parseFloat(e))*N},nadgrids:function(e){e===`@null`?t.datumCode=`none`:t.nadgrids=e},axis:function(e){var n=`ewnsud`;e.length===3&&n.indexOf(e.substr(0,1))!==-1&&n.indexOf(e.substr(1,1))!==-1&&n.indexOf(e.substr(2,1))!==-1&&(t.axis=e)},approx:function(){t.approx=!0},over:function(){t.over=!0}};for(r in n)i=n[r],r in o?(a=o[r],typeof a==`function`?a(i):t[a]=i):t[r]=i;return typeof t.datumCode==`string`&&t.datumCode!==`WGS84`&&(t.datumCode=t.datumCode.toLowerCase()),t.projStr=e,t}var ve=class{static getId(e){let t=e.find(e=>Array.isArray(e)&&e[0]===`ID`);return t&&t.length>=3?{authority:t[1],code:parseInt(t[2],10)}:null}static convertUnit(e,t=`unit`){if(!e||e.length<3)return{type:t,name:`unknown`,conversion_factor:null};let n=e[1],r=parseFloat(e[2])||null,i=e.find(e=>Array.isArray(e)&&e[0]===`ID`);return{type:t,name:n,conversion_factor:r,id:i?{authority:i[1],code:parseInt(i[2],10)}:null}}static convertAxis(e){let t=e[1]||`Unknown`,n,r=t.match(/^\((.)\)$/);if(r){let t=r[1].toUpperCase();if(t===`E`)n=`east`;else if(t===`N`)n=`north`;else if(t===`U`)n=`up`;else if(e[2])n=e[2];else throw Error(`Unknown axis abbreviation: ${t}`)}else n=e[2]||`unknown`;let i=e.find(e=>Array.isArray(e)&&e[0]===`ORDER`),a=i?parseInt(i[1],10):null,o=e.find(e=>Array.isArray(e)&&(e[0]===`LENGTHUNIT`||e[0]===`ANGLEUNIT`||e[0]===`SCALEUNIT`)),s=this.convertUnit(o);return{name:t,direction:n,unit:s,order:a}}static extractAxes(e){return e.filter(e=>Array.isArray(e)&&e[0]===`AXIS`).map(e=>this.convertAxis(e)).sort((e,t)=>(e.order||0)-(t.order||0))}static convert(e,t={}){switch(e[0]){case`PROJCRS`:t.type=`ProjectedCRS`,t.name=e[1],t.base_crs=e.find(e=>Array.isArray(e)&&e[0]===`BASEGEOGCRS`)?this.convert(e.find(e=>Array.isArray(e)&&e[0]===`BASEGEOGCRS`)):null,t.conversion=e.find(e=>Array.isArray(e)&&e[0]===`CONVERSION`)?this.convert(e.find(e=>Array.isArray(e)&&e[0]===`CONVERSION`)):null;let n=e.find(e=>Array.isArray(e)&&e[0]===`CS`);n&&(t.coordinate_system={subtype:n[1],axis:this.extractAxes(e)});let r=e.find(e=>Array.isArray(e)&&e[0]===`LENGTHUNIT`);if(r){let e=this.convertUnit(r);t.coordinate_system.unit=e}t.id=this.getId(e);break;case`BASEGEOGCRS`:case`GEOGCRS`:case`GEODCRS`:t.type=e[0]===`GEODCRS`?`GeodeticCRS`:`GeographicCRS`,t.name=e[1];let i=e.find(e=>Array.isArray(e)&&(e[0]===`DATUM`||e[0]===`ENSEMBLE`));if(i){let n=this.convert(i);i[0]===`ENSEMBLE`?t.datum_ensemble=n:t.datum=n;let r=e.find(e=>Array.isArray(e)&&e[0]===`PRIMEM`);r&&r[1]!==`Greenwich`&&(n.prime_meridian={name:r[1],longitude:parseFloat(r[2])})}let a=e.find(e=>Array.isArray(e)&&e[0]===`CS`);t.coordinate_system={subtype:a?a[1]:`ellipsoidal`,axis:this.extractAxes(e)},t.id=this.getId(e);break;case`DATUM`:t.type=`GeodeticReferenceFrame`,t.name=e[1],t.ellipsoid=e.find(e=>Array.isArray(e)&&e[0]===`ELLIPSOID`)?this.convert(e.find(e=>Array.isArray(e)&&e[0]===`ELLIPSOID`)):null;break;case`ENSEMBLE`:t.type=`DatumEnsemble`,t.name=e[1],t.members=e.filter(e=>Array.isArray(e)&&e[0]===`MEMBER`).map(e=>({type:`DatumEnsembleMember`,name:e[1],id:this.getId(e)}));let o=e.find(e=>Array.isArray(e)&&e[0]===`ENSEMBLEACCURACY`);o&&(t.accuracy=parseFloat(o[1]));let s=e.find(e=>Array.isArray(e)&&e[0]===`ELLIPSOID`);s&&(t.ellipsoid=this.convert(s)),t.id=this.getId(e);break;case`ELLIPSOID`:t.type=`Ellipsoid`,t.name=e[1],t.semi_major_axis=parseFloat(e[2]),t.inverse_flattening=parseFloat(e[3]),e.find(e=>Array.isArray(e)&&e[0]===`LENGTHUNIT`)&&this.convert(e.find(e=>Array.isArray(e)&&e[0]===`LENGTHUNIT`),t);break;case`CONVERSION`:t.type=`Conversion`,t.name=e[1],t.method=e.find(e=>Array.isArray(e)&&e[0]===`METHOD`)?this.convert(e.find(e=>Array.isArray(e)&&e[0]===`METHOD`)):null,t.parameters=e.filter(e=>Array.isArray(e)&&e[0]===`PARAMETER`).map(e=>this.convert(e));break;case`METHOD`:t.type=`Method`,t.name=e[1],t.id=this.getId(e);break;case`PARAMETER`:t.type=`Parameter`,t.name=e[1],t.value=parseFloat(e[2]),t.unit=this.convertUnit(e.find(e=>Array.isArray(e)&&(e[0]===`LENGTHUNIT`||e[0]===`ANGLEUNIT`||e[0]===`SCALEUNIT`))),t.id=this.getId(e);break;case`BOUNDCRS`:t.type=`BoundCRS`;let c=e.find(e=>Array.isArray(e)&&e[0]===`SOURCECRS`);if(c){let e=c.find(e=>Array.isArray(e));t.source_crs=e?this.convert(e):null}let l=e.find(e=>Array.isArray(e)&&e[0]===`TARGETCRS`);if(l){let e=l.find(e=>Array.isArray(e));t.target_crs=e?this.convert(e):null}let u=e.find(e=>Array.isArray(e)&&e[0]===`ABRIDGEDTRANSFORMATION`);t.transformation=u?this.convert(u):null;break;case`ABRIDGEDTRANSFORMATION`:if(t.type=`Transformation`,t.name=e[1],t.method=e.find(e=>Array.isArray(e)&&e[0]===`METHOD`)?this.convert(e.find(e=>Array.isArray(e)&&e[0]===`METHOD`)):null,t.parameters=e.filter(e=>Array.isArray(e)&&(e[0]===`PARAMETER`||e[0]===`PARAMETERFILE`)).map(e=>{if(e[0]===`PARAMETER`)return this.convert(e);if(e[0]===`PARAMETERFILE`)return{name:e[1],value:e[2],id:{authority:`EPSG`,code:8656}}}),t.parameters.length===7){let e=t.parameters[6];e.name===`Scale difference`&&(e.value=Math.round((e.value-1)*0xe8d4a51000)/1e6)}t.id=this.getId(e);break;case`AXIS`:t.coordinate_system||={type:`unspecified`,axis:[]},t.coordinate_system.axis.push(this.convertAxis(e));break;case`LENGTHUNIT`:let d=this.convertUnit(e,`LinearUnit`);t.coordinate_system&&t.coordinate_system.axis&&t.coordinate_system.axis.forEach(e=>{e.unit||=d}),d.conversion_factor&&d.conversion_factor!==1&&(t.semi_major_axis&&={value:t.semi_major_axis,unit:d});break;default:t.keyword=e[0]}return t}};function ye(e){return ve.convert(e)}function be(e){let t=e.toUpperCase();return t.includes(`PROJCRS`)||t.includes(`GEOGCRS`)||t.includes(`BOUNDCRS`)||t.includes(`VERTCRS`)||t.includes(`LENGTHUNIT`)||t.includes(`ANGLEUNIT`)||t.includes(`SCALEUNIT`)?`WKT2`:(t.includes(`PROJCS`)||t.includes(`GEOGCS`)||t.includes(`LOCAL_CS`)||t.includes(`VERT_CS`)||t.includes(`UNIT`),`WKT1`)}var xe=Pe,Se=1,Ce=2,we=3,Te=4,Ee=5,De=-1,Oe=/\s/,ke=/[A-Za-z]/,Ae=/[A-Za-z84_]/,je=/[,\]]/,Me=/[\d\.E\-\+]/;function Ne(e){if(typeof e!=`string`)throw Error(`not a string`);this.text=e.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=Se}Ne.prototype.readCharicter=function(){var e=this.text[this.place++];if(this.state!==Te)for(;Oe.test(e);){if(this.place>=this.text.length)return;e=this.text[this.place++]}switch(this.state){case Se:return this.neutral(e);case Ce:return this.keyword(e);case Te:return this.quoted(e);case Ee:return this.afterquote(e);case we:return this.number(e);case De:return}},Ne.prototype.afterquote=function(e){if(e===`"`)this.word+=`"`,this.state=Te;else if(je.test(e))this.word=this.word.trim(),this.afterItem(e);else throw Error(`havn't handled "`+e+`" in afterquote yet, index `+this.place)},Ne.prototype.afterItem=function(e){e===`,`?(this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=Se):e===`]`&&(this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=Se,this.currentObject=this.stack.pop(),this.currentObject||(this.state=De))},Ne.prototype.number=function(e){if(Me.test(e))this.word+=e;else if(je.test(e))this.word=parseFloat(this.word),this.afterItem(e);else throw Error(`havn't handled "`+e+`" in number yet, index `+this.place)},Ne.prototype.quoted=function(e){e===`"`?this.state=Ee:this.word+=e},Ne.prototype.keyword=function(e){if(Ae.test(e))this.word+=e;else if(e===`[`){var t=[];t.push(this.word),this.level++,this.root===null?this.root=t:this.currentObject.push(t),this.stack.push(this.currentObject),this.currentObject=t,this.state=Se}else if(je.test(e))this.afterItem(e);else throw Error(`havn't handled "`+e+`" in keyword yet, index `+this.place)},Ne.prototype.neutral=function(e){if(ke.test(e))this.word=e,this.state=Ce;else if(e===`"`)this.word=``,this.state=Te;else if(Me.test(e))this.word=e,this.state=we;else if(je.test(e))this.afterItem(e);else throw Error(`havn't handled "`+e+`" in neutral yet, index `+this.place)},Ne.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(this.state===De)return this.root;throw Error(`unable to parse string "`+this.text+`". State is `+this.state)};function Pe(e){return new Ne(e).output()}function Fe(e,t,n){Array.isArray(t)&&(n.unshift(t),t=null);var r=t?{}:e,i=n.reduce(function(e,t){return Ie(t,e),e},r);t&&(e[t]=i)}function Ie(e,t){if(!Array.isArray(e))t[e]=!0;else{var n=e.shift();if(n===`PARAMETER`&&(n=e.shift()),e.length===1){if(Array.isArray(e[0])){t[n]={},Ie(e[0],t[n]);return}t[n]=e[0]}else if(!e.length)t[n]=!0;else if(n===`TOWGS84`)t[n]=e;else if(n===`AXIS`)n in t||(t[n]=[]),t[n].push(e);else{Array.isArray(n)||(t[n]={});var r;switch(n){case`UNIT`:case`PRIMEM`:case`VERT_DATUM`:t[n]={name:e[0].toLowerCase(),convert:e[1]},e.length===3&&Ie(e[2],t[n]);return;case`SPHEROID`:case`ELLIPSOID`:t[n]={name:e[0],a:e[1],rf:e[2]},e.length===4&&Ie(e[3],t[n]);return;case`EDATUM`:case`ENGINEERINGDATUM`:case`LOCAL_DATUM`:case`DATUM`:case`VERT_CS`:case`VERTCRS`:case`VERTICALCRS`:e[0]=[`name`,e[0]],Fe(t,n,e);return;case`COMPD_CS`:case`COMPOUNDCRS`:case`FITTED_CS`:case`PROJECTEDCRS`:case`PROJCRS`:case`GEOGCS`:case`GEOCCS`:case`PROJCS`:case`LOCAL_CS`:case`GEODCRS`:case`GEODETICCRS`:case`GEODETICDATUM`:case`ENGCRS`:case`ENGINEERINGCRS`:e[0]=[`name`,e[0]],Fe(t,n,e),t[n].type=n;return;default:for(r=-1;++r<e.length;)if(!Array.isArray(e[r]))return Ie(e,t[n]);return Fe(t,n,e)}}}}var Le=.017453292519943295;function Re(e){return e*Le}function ze(e){let t=(e.projName||``).toLowerCase().replace(/_/g,` `);e.long0===void 0&&e.longc!==void 0&&(e.long0=e.longc),!e.lat_ts&&e.lat1&&(t===`stereographic south pole`||t===`polar stereographic (variant b)`)?(e.lat0=Re(e.lat1>0?90:-90),e.lat_ts=e.lat1,delete e.lat1):!e.lat_ts&&e.lat0&&(t===`polar stereographic`||t===`polar stereographic (variant a)`)&&(e.lat_ts=e.lat0,e.lat0=Re(e.lat0>0?90:-90),delete e.lat1)}function Be(e){let t={units:null,to_meter:void 0};return typeof e==`string`?(t.units=e.toLowerCase(),t.units===`metre`&&(t.units=`meter`),t.units===`meter`&&(t.to_meter=1)):e&&e.name&&(t.units=e.name.toLowerCase(),t.units===`metre`&&(t.units=`meter`),t.to_meter=e.conversion_factor),t}function Ve(e){return typeof e==`object`?e.value*e.unit.conversion_factor:e}function He(e,t){e.ellipsoid.radius?(t.a=e.ellipsoid.radius,t.rf=0):(t.a=Ve(e.ellipsoid.semi_major_axis),e.ellipsoid.inverse_flattening===void 0?e.ellipsoid.semi_major_axis!==void 0&&e.ellipsoid.semi_minor_axis!==void 0&&(t.rf=t.a/(t.a-Ve(e.ellipsoid.semi_minor_axis))):t.rf=e.ellipsoid.inverse_flattening)}function Ue(e,t={}){return!e||typeof e!=`object`?e:e.type===`BoundCRS`?(Ue(e.source_crs,t),e.transformation&&(e.transformation.method&&e.transformation.method.name===`NTv2`?t.nadgrids=e.transformation.parameters[0].value:t.datum_params=e.transformation.parameters.map(e=>e.value)),t):(Object.keys(e).forEach(n=>{let r=e[n];if(r!==null)switch(n){case`name`:if(t.srsCode)break;t.name=r,t.srsCode=r;break;case`type`:r===`GeographicCRS`?t.projName=`longlat`:r===`GeodeticCRS`?t.projName=e.coordinate_system&&e.coordinate_system.subtype===`Cartesian`?`geocent`:`longlat`:r===`ProjectedCRS`&&e.conversion&&e.conversion.method&&(t.projName=e.conversion.method.name);break;case`datum`:case`datum_ensemble`:r.ellipsoid&&(t.ellps=r.ellipsoid.name,He(r,t)),r.prime_meridian&&(t.from_greenwich=r.prime_meridian.longitude*Math.PI/180);break;case`ellipsoid`:t.ellps=r.name,He(r,t);break;case`prime_meridian`:t.long0=(r.longitude||0)*Math.PI/180;break;case`coordinate_system`:if(r.axis){let e={east:`e`,north:`n`,west:`w`,south:`s`,up:`u`,down:`d`,geocentricx:`e`,geocentricy:`n`,geocentricz:`u`},n=r.axis.map(t=>e[t.direction.toLowerCase()]);if(n.every(Boolean)&&(t.axis=n.join(``),t.axis.length===2&&(t.axis+=`u`)),r.unit){let{units:e,to_meter:n}=Be(r.unit);t.units=e,t.to_meter=n}else if(r.axis[0]&&r.axis[0].unit){let{units:e,to_meter:n}=Be(r.axis[0].unit);t.units=e,t.to_meter=n}}break;case`id`:r.authority&&r.code&&(t.title=r.authority+`:`+r.code);break;case`conversion`:r.method&&r.method.name&&(t.projName=r.method.name),r.parameters&&r.parameters.forEach(e=>{let n=e.name.toLowerCase().replace(/\s+/g,`_`),r=e.value;t[n]=e.unit&&e.unit.conversion_factor?r*e.unit.conversion_factor:e.unit===`degree`?r*Math.PI/180:r});break;case`unit`:r.name&&(t.units=r.name.toLowerCase(),t.units===`metre`&&(t.units=`meter`)),r.conversion_factor&&(t.to_meter=r.conversion_factor);break;case`base_crs`:Ue(r,t),t.datumCode=r.id?r.id.authority+`_`+r.id.code:r.name}}),t.latitude_of_false_origin!==void 0&&(t.lat0=t.latitude_of_false_origin),t.longitude_of_false_origin!==void 0&&(t.long0=t.longitude_of_false_origin),t.latitude_of_standard_parallel!==void 0&&(t.lat0=t.latitude_of_standard_parallel,t.lat1=t.latitude_of_standard_parallel),t.latitude_of_1st_standard_parallel!==void 0&&(t.lat1=t.latitude_of_1st_standard_parallel),t.latitude_of_2nd_standard_parallel!==void 0&&(t.lat2=t.latitude_of_2nd_standard_parallel),t.latitude_of_projection_centre!==void 0&&(t.lat0=t.latitude_of_projection_centre),t.longitude_of_projection_centre!==void 0&&(t.longc=t.longitude_of_projection_centre),t.easting_at_false_origin!==void 0&&(t.x0=t.easting_at_false_origin),t.northing_at_false_origin!==void 0&&(t.y0=t.northing_at_false_origin),t.latitude_of_natural_origin!==void 0&&(t.lat0=t.latitude_of_natural_origin),t.longitude_of_natural_origin!==void 0&&(t.long0=t.longitude_of_natural_origin),t.longitude_of_origin!==void 0&&(t.long0=t.longitude_of_origin),t.false_easting!==void 0&&(t.x0=t.false_easting),t.easting_at_projection_centre&&(t.x0=t.easting_at_projection_centre),t.false_northing!==void 0&&(t.y0=t.false_northing),t.northing_at_projection_centre&&(t.y0=t.northing_at_projection_centre),t.standard_parallel_1!==void 0&&(t.lat1=t.standard_parallel_1),t.standard_parallel_2!==void 0&&(t.lat2=t.standard_parallel_2),t.scale_factor_at_natural_origin!==void 0&&(t.k0=t.scale_factor_at_natural_origin),t.scale_factor_at_projection_centre!==void 0&&(t.k0=t.scale_factor_at_projection_centre),t.scale_factor_on_pseudo_standard_parallel!==void 0&&(t.k0=t.scale_factor_on_pseudo_standard_parallel),t.azimuth!==void 0&&(t.alpha=t.azimuth),t.azimuth_at_projection_centre!==void 0&&(t.alpha=t.azimuth_at_projection_centre),t.angle_from_rectified_to_skew_grid&&(t.rectified_grid_angle=t.angle_from_rectified_to_skew_grid),ze(t),t)}var We=[`PROJECTEDCRS`,`PROJCRS`,`GEOGCS`,`GEOCCS`,`PROJCS`,`LOCAL_CS`,`GEODCRS`,`GEODETICCRS`,`GEODETICDATUM`,`ENGCRS`,`ENGINEERINGCRS`];function Ge(e,t){var n=t[0],r=t[1];!(n in e)&&r in e&&(e[n]=e[r],t.length===3&&(e[n]=t[2](e[n])))}function Ke(e){for(var t=Object.keys(e),n=0,r=t.length;n<r;++n){var i=t[n];We.indexOf(i)!==-1&&qe(e[i]),typeof e[i]==`object`&&Ke(e[i])}}function qe(e){if(e.AUTHORITY){var t=Object.keys(e.AUTHORITY)[0];t&&t in e.AUTHORITY&&(e.title=t+`:`+e.AUTHORITY[t])}if(e.type===`GEOGCS`?e.projName=`longlat`:e.type===`LOCAL_CS`?(e.projName=`identity`,e.local=!0):e.projName=typeof e.PROJECTION==`object`?Object.keys(e.PROJECTION)[0]:e.PROJECTION,e.AXIS){for(var n=``,r=0,i=e.AXIS.length;r<i;++r){var a=[e.AXIS[r][0].toLowerCase(),e.AXIS[r][1].toLowerCase()];a[0].indexOf(`north`)!==-1||(a[0]===`y`||a[0]===`lat`)&&a[1]===`north`?n+=`n`:a[0].indexOf(`south`)!==-1||(a[0]===`y`||a[0]===`lat`)&&a[1]===`south`?n+=`s`:a[0].indexOf(`east`)!==-1||(a[0]===`x`||a[0]===`lon`)&&a[1]===`east`?n+=`e`:(a[0].indexOf(`west`)!==-1||(a[0]===`x`||a[0]===`lon`)&&a[1]===`west`)&&(n+=`w`)}n.length===2&&(n+=`u`),n.length===3&&(e.axis=n)}e.UNIT&&(e.units=e.UNIT.name.toLowerCase(),e.units===`metre`&&(e.units=`meter`),e.UNIT.convert&&(e.type===`GEOGCS`?e.DATUM&&e.DATUM.SPHEROID&&(e.to_meter=e.UNIT.convert*e.DATUM.SPHEROID.a):e.to_meter=e.UNIT.convert));var o=e.GEOGCS;e.type===`GEOGCS`&&(o=e),o&&(o.PRIMEM&&o.PRIMEM.convert&&(e.from_greenwich=Re(o.PRIMEM.convert)),e.datumCode=o.DATUM?o.DATUM.name.toLowerCase():o.name.toLowerCase(),e.datumCode.slice(0,2)===`d_`&&(e.datumCode=e.datumCode.slice(2)),e.datumCode===`new_zealand_1949`&&(e.datumCode=`nzgd49`),(e.datumCode===`wgs_1984`||e.datumCode===`world_geodetic_system_1984`)&&(e.PROJECTION===`Mercator_Auxiliary_Sphere`&&(e.sphere=!0),e.datumCode=`wgs84`),e.datumCode===`belge_1972`&&(e.datumCode=`rnb72`),o.DATUM&&o.DATUM.SPHEROID&&(e.ellps=o.DATUM.SPHEROID.name.replace(`_19`,``).replace(/[Cc]larke\_18/,`clrk`),e.ellps.toLowerCase().slice(0,13)===`international`&&(e.ellps=`intl`),e.a=o.DATUM.SPHEROID.a,e.rf=parseFloat(o.DATUM.SPHEROID.rf)),o.DATUM&&o.DATUM.TOWGS84&&(e.datum_params=o.DATUM.TOWGS84),~e.datumCode.indexOf(`osgb_1936`)&&(e.datumCode=`osgb36`),~e.datumCode.indexOf(`osni_1952`)&&(e.datumCode=`osni52`),(~e.datumCode.indexOf(`tm65`)||~e.datumCode.indexOf(`geodetic_datum_of_1965`))&&(e.datumCode=`ire65`),e.datumCode===`ch1903+`&&(e.datumCode=`ch1903`),~e.datumCode.indexOf(`israel`)&&(e.datumCode=`isr93`)),e.b&&!isFinite(e.b)&&(e.b=e.a),e.rectified_grid_angle&&=Re(e.rectified_grid_angle);function s(t){return t*(e.to_meter||1)}[[`standard_parallel_1`,`Standard_Parallel_1`],[`standard_parallel_1`,`Latitude of 1st standard parallel`],[`standard_parallel_2`,`Standard_Parallel_2`],[`standard_parallel_2`,`Latitude of 2nd standard parallel`],[`false_easting`,`False_Easting`],[`false_easting`,`False easting`],[`false-easting`,`Easting at false origin`],[`false_northing`,`False_Northing`],[`false_northing`,`False northing`],[`false_northing`,`Northing at false origin`],[`central_meridian`,`Central_Meridian`],[`central_meridian`,`Longitude of natural origin`],[`central_meridian`,`Longitude of false origin`],[`latitude_of_origin`,`Latitude_Of_Origin`],[`latitude_of_origin`,`Central_Parallel`],[`latitude_of_origin`,`Latitude of natural origin`],[`latitude_of_origin`,`Latitude of false origin`],[`scale_factor`,`Scale_Factor`],[`k0`,`scale_factor`],[`latitude_of_center`,`Latitude_Of_Center`],[`latitude_of_center`,`Latitude_of_center`],[`lat0`,`latitude_of_center`,Re],[`longitude_of_center`,`Longitude_Of_Center`],[`longitude_of_center`,`Longitude_of_center`],[`longc`,`longitude_of_center`,Re],[`x0`,`false_easting`,s],[`y0`,`false_northing`,s],[`long0`,`central_meridian`,Re],[`lat0`,`latitude_of_origin`,Re],[`lat0`,`standard_parallel_1`,Re],[`lat1`,`standard_parallel_1`,Re],[`lat2`,`standard_parallel_2`,Re],[`azimuth`,`Azimuth`],[`alpha`,`azimuth`,Re],[`srsCode`,`name`]].forEach(function(t){return Ge(e,t)}),ze(e)}function Je(e){if(typeof e==`object`)return Ue(e);let t=be(e);var n=xe(e);if(t===`WKT2`)return Ue(ye(n));var r=n[0],i={};return Ie(n,i),Ke(i),i[r]}function Ye(e){var t=this;if(arguments.length===2){var n=arguments[1];typeof n==`string`?Ye[e]=n.charAt(0)===`+`?_e(arguments[1]):Je(arguments[1]):n&&typeof n==`object`&&!(`projName`in n)?Ye[e]=Je(arguments[1]):(Ye[e]=n,n||delete Ye[e])}else if(arguments.length===1){if(Array.isArray(e))return e.map(function(e){return Array.isArray(e)?Ye.apply(t,e):Ye(e)});if(typeof e==`string`){if(e in Ye)return Ye[e]}else`EPSG`in e?Ye[`EPSG:`+e.EPSG]=e:`ESRI`in e?Ye[`ESRI:`+e.ESRI]=e:`IAU2000`in e?Ye[`IAU2000:`+e.IAU2000]=e:console.log(e);return}}ne(Ye);function Xe(e){return typeof e==`string`}function Ze(e){return e in Ye}function Qe(e){return e.indexOf(`+`)!==0&&e.indexOf(`[`)!==-1||typeof e==`object`&&!(`srsCode`in e)}var $e=[`3857`,`900913`,`3785`,`102113`];function et(e){if(e.title)return e.title.toLowerCase().indexOf(`epsg:`)===0&&$e.indexOf(e.title.substr(5))>-1;var t=ge(e,`authority`);if(t){var n=ge(t,`epsg`);return n&&$e.indexOf(n)>-1}}function tt(e){var t=ge(e,`extension`);if(t)return ge(t,`proj4`)}function nt(e){return e[0]===`+`}function rt(e){let t;if(Xe(e)){if(Ze(e))t=Ye[e];else if(Qe(e)){t=Je(e);var n=tt(t);n&&(t=_e(n))}else nt(e)&&(t=_e(e))}else t=`projName`in e?e:Je(e);return t&&et(t)?Ye[`EPSG:3857`]:t}function it(e,t){e||={};var n,r;if(!t)return e;for(r in t)n=t[r],n!==void 0&&(e[r]=n);return e}function at(e,t,n){var r=e*t;return n/Math.sqrt(1-r*r)}function ot(e){return e<0?-1:1}function F(e,t){return t||Math.abs(e)<=3.14159265359?e:e-ot(e)*de}function st(e,t,n){var r=e*n,i=.5*e;return r=((1-r)/(1+r))**i,Math.tan(.5*(M-t))/r}function ct(e,t){for(var n=.5*e,r,i,a=M-2*Math.atan(t),o=0;o<=15;o++)if(r=e*Math.sin(a),i=M-2*Math.atan(t*((1-r)/(1+r))**n)-a,a+=i,Math.abs(i)<=1e-10)return a;return-9999}function lt(){var e=this.b/this.a;this.es=1-e*e,`x0`in this||(this.x0=0),`y0`in this||(this.y0=0),this.long0=this.long0||0,this.e=Math.sqrt(this.es),this.lat_ts?this.k0=this.sphere?Math.cos(this.lat_ts):at(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||=this.k?this.k:1}function ut(e){var t=e.x,n=e.y;if(n*57.29577951308232>90&&n*57.29577951308232<-90&&t*57.29577951308232>180&&t*57.29577951308232<-180)return null;var r,i;if(Math.abs(Math.abs(n)-M)<=1e-10)return null;if(this.sphere)r=this.x0+this.a*this.k0*F(t-this.long0,this.over),i=this.y0+this.a*this.k0*Math.log(Math.tan(P+.5*n));else{var a=Math.sin(n),o=st(this.e,n,a);r=this.x0+this.a*this.k0*F(t-this.long0,this.over),i=this.y0-this.a*this.k0*Math.log(o)}return e.x=r,e.y=i,e}function dt(e){var t=e.x-this.x0,n=e.y-this.y0,r,i;if(this.sphere)i=M-2*Math.atan(Math.exp(-n/(this.a*this.k0)));else{var a=Math.exp(-n/(this.a*this.k0));if(i=ct(this.e,a),i===-9999)return null}return r=F(this.long0+t/(this.a*this.k0),this.over),e.x=r,e.y=i,e}var ft={init:lt,forward:ut,inverse:dt,names:[`Mercator`,`Popular Visualisation Pseudo Mercator`,`Mercator_1SP`,`Mercator_Auxiliary_Sphere`,`Mercator_Variant_A`,`merc`]};function pt(){}function mt(e){return e}var ht=[`longlat`,`identity`,`lonlat`,`latlon`,`latlong`],gt=[ft,{init:pt,forward:mt,inverse:mt,names:ht}],_t={},vt=[];function yt(e,t){var n=vt.length;return e.names?(vt[n]=e,e.names.forEach(function(e){_t[e.toLowerCase()]=n}),this):(console.log(t),!0)}function bt(e){return e.replace(/[-\(\)\s]+/g,` `).trim().replace(/ /g,`_`)}function xt(e){if(!e)return!1;var t=e.toLowerCase();if(_t[t]!==void 0&&vt[_t[t]]||(t=bt(t),t in _t&&vt[_t[t]]))return vt[_t[t]]}function St(){gt.forEach(yt)}var Ct={start:St,add:yt,get:xt},wt={MERIT:{a:6378137,rf:298.257,ellipseName:`MERIT 1983`},SGS85:{a:6378136,rf:298.257,ellipseName:`Soviet Geodetic System 85`},GRS80:{a:6378137,rf:298.257222101,ellipseName:`GRS 1980(IUGG, 1980)`},IAU76:{a:6378140,rf:298.257,ellipseName:`IAU 1976`},airy:{a:6377563.396,b:6356256.91,ellipseName:`Airy 1830`},APL4:{a:6378137,rf:298.25,ellipseName:`Appl. Physics. 1965`},NWL9D:{a:6378145,rf:298.25,ellipseName:`Naval Weapons Lab., 1965`},mod_airy:{a:6377340.189,b:6356034.446,ellipseName:`Modified Airy`},andrae:{a:6377104.43,rf:300,ellipseName:`Andrae 1876 (Den., Iclnd.)`},aust_SA:{a:6378160,rf:298.25,ellipseName:`Australian Natl & S. Amer. 1969`},GRS67:{a:6378160,rf:298.247167427,ellipseName:`GRS 67(IUGG 1967)`},bessel:{a:6377397.155,rf:299.1528128,ellipseName:`Bessel 1841`},bess_nam:{a:6377483.865,rf:299.1528128,ellipseName:`Bessel 1841 (Namibia)`},clrk66:{a:6378206.4,b:6356583.8,ellipseName:`Clarke 1866`},clrk80:{a:6378249.145,rf:293.4663,ellipseName:`Clarke 1880 mod.`},clrk80ign:{a:6378249.2,b:6356515,rf:293.4660213,ellipseName:`Clarke 1880 (IGN)`},clrk58:{a:6378293.645208759,rf:294.2606763692654,ellipseName:`Clarke 1858`},CPM:{a:6375738.7,rf:334.29,ellipseName:`Comm. des Poids et Mesures 1799`},delmbr:{a:6376428,rf:311.5,ellipseName:`Delambre 1810 (Belgium)`},engelis:{a:6378136.05,rf:298.2566,ellipseName:`Engelis 1985`},evrst30:{a:6377276.345,rf:300.8017,ellipseName:`Everest 1830`},evrst48:{a:6377304.063,rf:300.8017,ellipseName:`Everest 1948`},evrst56:{a:6377301.243,rf:300.8017,ellipseName:`Everest 1956`},evrst69:{a:6377295.664,rf:300.8017,ellipseName:`Everest 1969`},evrstSS:{a:6377298.556,rf:300.8017,ellipseName:`Everest (Sabah & Sarawak)`},fschr60:{a:6378166,rf:298.3,ellipseName:`Fischer (Mercury Datum) 1960`},fschr60m:{a:6378155,rf:298.3,ellipseName:`Fischer 1960`},fschr68:{a:6378150,rf:298.3,ellipseName:`Fischer 1968`},helmert:{a:6378200,rf:298.3,ellipseName:`Helmert 1906`},hough:{a:6378270,rf:297,ellipseName:`Hough`},intl:{a:6378388,rf:297,ellipseName:`International 1909 (Hayford)`},kaula:{a:6378163,rf:298.24,ellipseName:`Kaula 1961`},lerch:{a:6378139,rf:298.257,ellipseName:`Lerch 1979`},mprts:{a:6397300,rf:191,ellipseName:`Maupertius 1738`},new_intl:{a:6378157.5,b:6356772.2,ellipseName:`New International 1967`},plessis:{a:6376523,b:6355863,ellipseName:`Plessis 1817 (France)`},krass:{a:6378245,rf:298.3,ellipseName:`Krassovsky, 1942`},SEasia:{a:6378155,b:6356773.3205,ellipseName:`Southeast Asia`},walbeck:{a:6376896,b:6355834.8467,ellipseName:`Walbeck`},WGS60:{a:6378165,rf:298.3,ellipseName:`WGS 60`},WGS66:{a:6378145,rf:298.25,ellipseName:`WGS 66`},WGS7:{a:6378135,rf:298.26,ellipseName:`WGS 72`},WGS84:{a:6378137,rf:298.257223563,ellipseName:`WGS 84`},sphere:{a:6370997,b:6370997,ellipseName:`Normal Sphere (r=6370997)`}},Tt=wt.WGS84;function Et(e,t,n,r){var i=e*e,a=t*t,o=(i-a)/i,s=0;r?(e*=1-o*(oe+o*(se+o*ce)),i=e*e,o=0):s=Math.sqrt(o);var c=(i-a)/a;return{es:o,e:s,ep2:c}}function Dt(e,t,n,r,i){if(!e){var a=ge(wt,r);a||=Tt,e=a.a,t=a.b,n=a.rf}return n&&!t&&(t=(1-1/n)*e),(n===0||Math.abs(e-t)<1e-10)&&(i=!0,t=e),{a:e,b:t,rf:n,sphere:i}}var Ot={wgs84:{towgs84:`0,0,0`,ellipse:`WGS84`,datumName:`WGS84`},ch1903:{towgs84:`674.374,15.056,405.346`,ellipse:`bessel`,datumName:`swiss`},ggrs87:{towgs84:`-199.87,74.79,246.62`,ellipse:`GRS80`,datumName:`Greek_Geodetic_Reference_System_1987`},nad83:{towgs84:`0,0,0`,ellipse:`GRS80`,datumName:`North_American_Datum_1983`},nad27:{nadgrids:`@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat`,ellipse:`clrk66`,datumName:`North_American_Datum_1927`},potsdam:{towgs84:`598.1,73.7,418.2,0.202,0.045,-2.455,6.7`,ellipse:`bessel`,datumName:`Potsdam Rauenberg 1950 DHDN`},carthage:{towgs84:`-263.0,6.0,431.0`,ellipse:`clrk80ign`,datumName:`Carthage 1934 Tunisia`},hermannskogel:{towgs84:`577.326,90.129,463.919,5.137,1.474,5.297,2.4232`,ellipse:`bessel`,datumName:`Hermannskogel`},mgi:{towgs84:`577.326,90.129,463.919,5.137,1.474,5.297,2.4232`,ellipse:`bessel`,datumName:`Militar-Geographische Institut`},osni52:{towgs84:`482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15`,ellipse:`airy`,datumName:`Irish National`},ire65:{towgs84:`482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15`,ellipse:`mod_airy`,datumName:`Ireland 1965`},rassadiran:{towgs84:`-133.63,-157.5,-158.62`,ellipse:`intl`,datumName:`Rassadiran`},nzgd49:{towgs84:`59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993`,ellipse:`intl`,datumName:`New Zealand Geodetic Datum 1949`},osgb36:{towgs84:`446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894`,ellipse:`airy`,datumName:`Ordnance Survey of Great Britain 1936`},s_jtsk:{towgs84:`589,76,480`,ellipse:`bessel`,datumName:`S-JTSK (Ferro)`},beduaram:{towgs84:`-106,-87,188`,ellipse:`clrk80`,datumName:`Beduaram`},gunung_segara:{towgs84:`-403,684,41`,ellipse:`bessel`,datumName:`Gunung Segara Jakarta`},rnb72:{towgs84:`106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1`,ellipse:`intl`,datumName:`Reseau National Belge 1972`},EPSG_5451:{towgs84:`6.41,-49.05,-11.28,1.5657,0.5242,6.9718,-5.7649`},IGNF_LURESG:{towgs84:`-192.986,13.673,-39.309,-0.4099,-2.9332,2.6881,0.43`},EPSG_4614:{towgs84:`-119.4248,-303.65872,-11.00061,1.164298,0.174458,1.096259,3.657065`},EPSG_4615:{towgs84:`-494.088,-312.129,279.877,-1.423,-1.013,1.59,-0.748`},ESRI_37241:{towgs84:`-76.822,257.457,-12.817,2.136,-0.033,-2.392,-0.031`},ESRI_37249:{towgs84:`-440.296,58.548,296.265,1.128,10.202,4.559,-0.438`},ESRI_37245:{towgs84:`-511.151,-181.269,139.609,1.05,2.703,1.798,3.071`},EPSG_4178:{towgs84:`24.9,-126.4,-93.2,-0.063,-0.247,-0.041,1.01`},EPSG_4622:{towgs84:`-472.29,-5.63,-304.12,0.4362,-0.8374,0.2563,1.8984`},EPSG_4625:{towgs84:`126.93,547.94,130.41,-2.7867,5.1612,-0.8584,13.8227`},EPSG_5252:{towgs84:`0.023,0.036,-0.068,0.00176,0.00912,-0.01136,0.00439`},EPSG_4314:{towgs84:`597.1,71.4,412.1,0.894,0.068,-1.563,7.58`},EPSG_4282:{towgs84:`-178.3,-316.7,-131.5,5.278,6.077,10.979,19.166`},EPSG_4231:{towgs84:`-83.11,-97.38,-117.22,0.005693,-0.044698,0.044285,0.1218`},EPSG_4274:{towgs84:`-230.994,102.591,25.199,0.633,-0.239,0.9,1.95`},EPSG_4134:{towgs84:`-180.624,-225.516,173.919,-0.81,-1.898,8.336,16.71006`},EPSG_4254:{towgs84:`18.38,192.45,96.82,0.056,-0.142,-0.2,-0.0013`},EPSG_4159:{towgs84:`-194.513,-63.978,-25.759,-3.4027,3.756,-3.352,-0.9175`},EPSG_4687:{towgs84:`0.072,-0.507,-0.245,0.0183,-0.0003,0.007,-0.0093`},EPSG_4227:{towgs84:`-83.58,-397.54,458.78,-17.595,-2.847,4.256,3.225`},EPSG_4746:{towgs84:`599.4,72.4,419.2,-0.062,-0.022,-2.723,6.46`},EPSG_4745:{towgs84:`612.4,77,440.2,-0.054,0.057,-2.797,2.55`},EPSG_6311:{towgs84:`8.846,-4.394,-1.122,-0.00237,-0.146528,0.130428,0.783926`},EPSG_4289:{towgs84:`565.7381,50.4018,465.2904,-0.395026,0.330772,-1.876073,4.07244`},EPSG_4230:{towgs84:`-68.863,-134.888,-111.49,-0.53,-0.14,0.57,-3.4`},EPSG_4154:{towgs84:`-123.02,-158.95,-168.47`},EPSG_4156:{towgs84:`570.8,85.7,462.8,4.998,1.587,5.261,3.56`},EPSG_4299:{towgs84:`482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15`},EPSG_4179:{towgs84:`33.4,-146.6,-76.3,-0.359,-0.053,0.844,-0.84`},EPSG_4313:{towgs84:`-106.8686,52.2978,-103.7239,0.3366,-0.457,1.8422,-1.2747`},EPSG_4194:{towgs84:`163.511,127.533,-159.789`},EPSG_4195:{towgs84:`105,326,-102.5`},EPSG_4196:{towgs84:`-45,417,-3.5`},EPSG_4611:{towgs84:`-162.619,-276.959,-161.764,0.067753,-2.243648,-1.158828,-1.094246`},EPSG_4633:{towgs84:`137.092,131.66,91.475,-1.9436,-11.5993,-4.3321,-7.4824`},EPSG_4641:{towgs84:`-408.809,366.856,-412.987,1.8842,-0.5308,2.1655,-121.0993`},EPSG_4643:{towgs84:`-480.26,-438.32,-643.429,16.3119,20.1721,-4.0349,-111.7002`},EPSG_4300:{towgs84:`482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15`},EPSG_4188:{towgs84:`482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15`},EPSG_4660:{towgs84:`982.6087,552.753,-540.873,6.681627,-31.611492,-19.848161,16.805`},EPSG_4662:{towgs84:`97.295,-263.247,310.882,-1.5999,0.8386,3.1409,13.3259`},EPSG_3906:{towgs84:`577.88891,165.22205,391.18289,4.9145,-0.94729,-13.05098,7.78664`},EPSG_4307:{towgs84:`-209.3622,-87.8162,404.6198,0.0046,3.4784,0.5805,-1.4547`},EPSG_6892:{towgs84:`-76.269,-16.683,68.562,-6.275,10.536,-4.286,-13.686`},EPSG_4690:{towgs84:`221.597,152.441,176.523,2.403,1.3893,0.884,11.4648`},EPSG_4691:{towgs84:`218.769,150.75,176.75,3.5231,2.0037,1.288,10.9817`},EPSG_4629:{towgs84:`72.51,345.411,79.241,-1.5862,-0.8826,-0.5495,1.3653`},EPSG_4630:{towgs84:`165.804,216.213,180.26,-0.6251,-0.4515,-0.0721,7.4111`},EPSG_4692:{towgs84:`217.109,86.452,23.711,0.0183,-0.0003,0.007,-0.0093`},EPSG_9333:{towgs84:`0,0,0,-0.008393,0.000749,-0.010276,0`},EPSG_9059:{towgs84:`0,0,0`},EPSG_4312:{towgs84:`601.705,84.263,485.227,4.7354,1.3145,5.393,-2.3887`},EPSG_4123:{towgs84:`-96.062,-82.428,-121.753,4.801,0.345,-1.376,1.496`},EPSG_4309:{towgs84:`-124.45,183.74,44.64,-0.4384,0.5446,-0.9706,-2.1365`},ESRI_104106:{towgs84:`-283.088,-70.693,117.445,-1.157,0.059,-0.652,-4.058`},EPSG_4281:{towgs84:`-219.247,-73.802,269.529`},EPSG_4322:{towgs84:`0,0,4.5`},EPSG_4324:{towgs84:`0,0,1.9`},EPSG_4284:{towgs84:`43.822,-108.842,-119.585,1.455,-0.761,0.737,0.549`},EPSG_4277:{towgs84:`446.448,-125.157,542.06,0.15,0.247,0.842,-20.489`},EPSG_4207:{towgs84:`-282.1,-72.2,120,-1.529,0.145,-0.89,-4.46`},EPSG_4688:{towgs84:`347.175,1077.618,2623.677,33.9058,-70.6776,9.4013,186.0647`},EPSG_4689:{towgs84:`410.793,54.542,80.501,-2.5596,-2.3517,-0.6594,17.3218`},EPSG_4720:{towgs84:`0,0,4.5`},EPSG_4273:{towgs84:`278.3,93,474.5,7.889,0.05,-6.61,6.21`},EPSG_4240:{towgs84:`204.64,834.74,293.8`},EPSG_4817:{towgs84:`278.3,93,474.5,7.889,0.05,-6.61,6.21`},ESRI_104131:{towgs84:`426.62,142.62,460.09,4.98,4.49,-12.42,-17.1`},EPSG_4265:{towgs84:`-104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68`},EPSG_4263:{towgs84:`-111.92,-87.85,114.5,1.875,0.202,0.219,0.032`},EPSG_4298:{towgs84:`-689.5937,623.84046,-65.93566,-0.02331,1.17094,-0.80054,5.88536`},EPSG_4270:{towgs84:`-253.4392,-148.452,386.5267,0.15605,0.43,-0.1013,-0.0424`},EPSG_4229:{towgs84:`-121.8,98.1,-10.7`},EPSG_4220:{towgs84:`-55.5,-348,-229.2`},EPSG_4214:{towgs84:`12.646,-155.176,-80.863`},EPSG_4232:{towgs84:`-345,3,223`},EPSG_4238:{towgs84:`-1.977,-13.06,-9.993,0.364,0.254,0.689,-1.037`},EPSG_4168:{towgs84:`-170,33,326`},EPSG_4131:{towgs84:`199,931,318.9`},EPSG_4152:{towgs84:`-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0`},EPSG_5228:{towgs84:`572.213,85.334,461.94,4.9732,1.529,5.2484,3.5378`},EPSG_8351:{towgs84:`485.021,169.465,483.839,7.786342,4.397554,4.102655,0`},EPSG_4683:{towgs84:`-127.62,-67.24,-47.04,-3.068,4.903,1.578,-1.06`},EPSG_4133:{towgs84:`0,0,0`},EPSG_7373:{towgs84:`0.819,-0.5762,-1.6446,-0.00378,-0.03317,0.00318,0.0693`},EPSG_9075:{towgs84:`-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0`},EPSG_9072:{towgs84:`-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0`},EPSG_9294:{towgs84:`1.16835,-1.42001,-2.24431,-0.00822,-0.05508,0.01818,0.23388`},EPSG_4212:{towgs84:`-267.434,173.496,181.814,-13.4704,8.7154,7.3926,14.7492`},EPSG_4191:{towgs84:`-44.183,-0.58,-38.489,2.3867,2.7072,-3.5196,-8.2703`},EPSG_4237:{towgs84:`52.684,-71.194,-13.975,-0.312,-0.1063,-0.3729,1.0191`},EPSG_4740:{towgs84:`-1.08,-0.27,-0.9`},EPSG_4124:{towgs84:`419.3836,99.3335,591.3451,0.850389,1.817277,-7.862238,-0.99496`},EPSG_5681:{towgs84:`584.9636,107.7175,413.8067,1.1155,0.2824,-3.1384,7.9922`},EPSG_4141:{towgs84:`23.772,17.49,17.859,-0.3132,-1.85274,1.67299,-5.4262`},EPSG_4204:{towgs84:`-85.645,-273.077,-79.708,2.289,-1.421,2.532,3.194`},EPSG_4319:{towgs84:`226.702,-193.337,-35.371,-2.229,-4.391,9.238,0.9798`},EPSG_4200:{towgs84:`24.82,-131.21,-82.66`},EPSG_4130:{towgs84:`0,0,0`},EPSG_4127:{towgs84:`-82.875,-57.097,-156.768,-2.158,1.524,-0.982,-0.359`},EPSG_4149:{towgs84:`674.374,15.056,405.346`},EPSG_4617:{towgs84:`-0.991,1.9072,0.5129,0.02579,0.00965,0.01166,0`},EPSG_4663:{towgs84:`-210.502,-66.902,-48.476,2.094,-15.067,-5.817,0.485`},EPSG_4664:{towgs84:`-211.939,137.626,58.3,-0.089,0.251,0.079,0.384`},EPSG_4665:{towgs84:`-105.854,165.589,-38.312,-0.003,-0.026,0.024,-0.048`},EPSG_4666:{towgs84:`631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43`},EPSG_4756:{towgs84:`-192.873,-39.382,-111.202,-0.00205,-0.0005,0.00335,0.0188`},EPSG_4723:{towgs84:`-179.483,-69.379,-27.584,-7.862,8.163,6.042,-13.925`},EPSG_4726:{towgs84:`8.853,-52.644,180.304,-0.393,-2.323,2.96,-24.081`},EPSG_4267:{towgs84:`-8.0,160.0,176.0`},EPSG_5365:{towgs84:`-0.16959,0.35312,0.51846,0.03385,-0.16325,0.03446,0.03693`},EPSG_4218:{towgs84:`304.5,306.5,-318.1`},EPSG_4242:{towgs84:`-33.722,153.789,94.959,-8.581,-4.478,4.54,8.95`},EPSG_4216:{towgs84:`-292.295,248.758,429.447,4.9971,2.99,6.6906,1.0289`},ESRI_104105:{towgs84:`631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43`},ESRI_104129:{towgs84:`0,0,0`},EPSG_4673:{towgs84:`174.05,-25.49,112.57`},EPSG_4202:{towgs84:`-124,-60,154`},EPSG_4203:{towgs84:`-117.763,-51.51,139.061,0.292,0.443,0.277,-0.191`},EPSG_3819:{towgs84:`595.48,121.69,515.35,4.115,-2.9383,0.853,-3.408`},EPSG_8694:{towgs84:`-93.799,-132.737,-219.073,-1.844,0.648,-6.37,-0.169`},EPSG_4145:{towgs84:`275.57,676.78,229.6`},EPSG_4283:{towgs84:`0.06155,-0.01087,-0.04019,0.039492,0.032722,0.032898,-0.009994`},EPSG_4317:{towgs84:`2.3287,-147.0425,-92.0802,-0.309248,0.324822,0.497299,5.689063`},EPSG_4272:{towgs84:`59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993`},EPSG_4248:{towgs84:`-307.7,265.3,-363.5`},EPSG_5561:{towgs84:`24,-121,-76`},EPSG_5233:{towgs84:`-0.293,766.95,87.713,0.195704,1.695068,3.473016,-0.039338`},ESRI_104130:{towgs84:`-86,-98,-119`},ESRI_104102:{towgs84:`682,-203,480`},ESRI_37207:{towgs84:`7,-10,-26`},EPSG_4675:{towgs84:`59.935,118.4,-10.871`},ESRI_104109:{towgs84:`-89.121,-348.182,260.871`},ESRI_104112:{towgs84:`-185.583,-230.096,281.361`},ESRI_104113:{towgs84:`25.1,-275.6,222.6`},IGNF_WGS72G:{towgs84:`0,12,6`},IGNF_NTFG:{towgs84:`-168,-60,320`},IGNF_EFATE57G:{towgs84:`-127,-769,472`},IGNF_PGP50G:{towgs84:`324.8,153.6,172.1`},IGNF_REUN47G:{towgs84:`94,-948,-1262`},IGNF_CSG67G:{towgs84:`-186,230,110`},IGNF_GUAD48G:{towgs84:`-467,-16,-300`},IGNF_TAHI51G:{towgs84:`162,117,154`},IGNF_TAHAAG:{towgs84:`65,342,77`},IGNF_NUKU72G:{towgs84:`84,274,65`},IGNF_PETRELS72G:{towgs84:`365,194,166`},IGNF_WALL78G:{towgs84:`253,-133,-127`},IGNF_MAYO50G:{towgs84:`-382,-59,-262`},IGNF_TANNAG:{towgs84:`-139,-967,436`},IGNF_IGN72G:{towgs84:`-13,-348,292`},IGNF_ATIGG:{towgs84:`1118,23,66`},IGNF_FANGA84G:{towgs84:`150.57,158.33,118.32`},IGNF_RUSAT84G:{towgs84:`202.13,174.6,-15.74`},IGNF_KAUE70G:{towgs84:`126.74,300.1,-75.49`},IGNF_MOP90G:{towgs84:`-10.8,-1.8,12.77`},IGNF_MHPF67G:{towgs84:`338.08,212.58,-296.17`},IGNF_TAHI79G:{towgs84:`160.61,116.05,153.69`},IGNF_ANAA92G:{towgs84:`1.5,3.84,4.81`},IGNF_MARQUI72G:{towgs84:`330.91,-13.92,58.56`},IGNF_APAT86G:{towgs84:`143.6,197.82,74.05`},IGNF_TUBU69G:{towgs84:`237.17,171.61,-77.84`},IGNF_STPM50G:{towgs84:`11.363,424.148,373.13`},EPSG_4150:{towgs84:`674.374,15.056,405.346`},EPSG_4754:{towgs84:`-208.4058,-109.8777,-2.5764`},ESRI_104101:{towgs84:`372.87,149.23,585.29`},EPSG_4693:{towgs84:`0,-0.15,0.68`},EPSG_6207:{towgs84:`293.17,726.18,245.36`},EPSG_4153:{towgs84:`-133.63,-157.5,-158.62`},EPSG_4132:{towgs84:`-241.54,-163.64,396.06`},EPSG_4221:{towgs84:`-154.5,150.7,100.4`},EPSG_4266:{towgs84:`-80.7,-132.5,41.1`},EPSG_4193:{towgs84:`-70.9,-151.8,-41.4`},EPSG_5340:{towgs84:`-0.41,0.46,-0.35`},EPSG_4246:{towgs84:`-294.7,-200.1,525.5`},EPSG_4318:{towgs84:`-3.2,-5.7,2.8`},EPSG_4121:{towgs84:`-199.87,74.79,246.62`},EPSG_4223:{towgs84:`-260.1,5.5,432.2`},EPSG_4158:{towgs84:`-0.465,372.095,171.736`},EPSG_4285:{towgs84:`-128.16,-282.42,21.93`},EPSG_4613:{towgs84:`-404.78,685.68,45.47`},EPSG_4607:{towgs84:`195.671,332.517,274.607`},EPSG_4475:{towgs84:`-381.788,-57.501,-256.673`},EPSG_4208:{towgs84:`-157.84,308.54,-146.6`},EPSG_4743:{towgs84:`70.995,-335.916,262.898`},EPSG_4710:{towgs84:`-323.65,551.39,-491.22`},EPSG_7881:{towgs84:`-0.077,0.079,0.086`},EPSG_4682:{towgs84:`283.729,735.942,261.143`},EPSG_4739:{towgs84:`-156,-271,-189`},EPSG_4679:{towgs84:`-80.01,253.26,291.19`},EPSG_4750:{towgs84:`-56.263,16.136,-22.856`},EPSG_4644:{towgs84:`-10.18,-350.43,291.37`},EPSG_4695:{towgs84:`-103.746,-9.614,-255.95`},EPSG_4292:{towgs84:`-355,21,72`},EPSG_4302:{towgs84:`-61.702,284.488,472.052`},EPSG_4143:{towgs84:`-124.76,53,466.79`},EPSG_4606:{towgs84:`-153,153,307`},EPSG_4699:{towgs84:`-770.1,158.4,-498.2`},EPSG_4247:{towgs84:`-273.5,110.6,-357.9`},EPSG_4160:{towgs84:`8.88,184.86,106.69`},EPSG_4161:{towgs84:`-233.43,6.65,173.64`},EPSG_9251:{towgs84:`-9.5,122.9,138.2`},EPSG_9253:{towgs84:`-78.1,101.6,133.3`},EPSG_4297:{towgs84:`-198.383,-240.517,-107.909`},EPSG_4269:{towgs84:`0,0,0`},EPSG_4301:{towgs84:`-147,506,687`},EPSG_4618:{towgs84:`-59,-11,-52`},EPSG_4612:{towgs84:`0,0,0`},EPSG_4678:{towgs84:`44.585,-131.212,-39.544`},EPSG_4250:{towgs84:`-130,29,364`},EPSG_4144:{towgs84:`214,804,268`},EPSG_4147:{towgs84:`-17.51,-108.32,-62.39`},EPSG_4259:{towgs84:`-254.1,-5.36,-100.29`},EPSG_4164:{towgs84:`-76,-138,67`},EPSG_4211:{towgs84:`-378.873,676.002,-46.255`},EPSG_4182:{towgs84:`-422.651,-172.995,84.02`},EPSG_4224:{towgs84:`-143.87,243.37,-33.52`},EPSG_4225:{towgs84:`-205.57,168.77,-4.12`},EPSG_5527:{towgs84:`-67.35,3.88,-38.22`},EPSG_4752:{towgs84:`98,390,-22`},EPSG_4310:{towgs84:`-30,190,89`},EPSG_9248:{towgs84:`-192.26,65.72,132.08`},EPSG_4680:{towgs84:`124.5,-63.5,-281`},EPSG_4701:{towgs84:`-79.9,-158,-168.9`},EPSG_4706:{towgs84:`-146.21,112.63,4.05`},EPSG_4805:{towgs84:`682,-203,480`},EPSG_4201:{towgs84:`-165,-11,206`},EPSG_4210:{towgs84:`-157,-2,-299`},EPSG_4183:{towgs84:`-104,167,-38`},EPSG_4139:{towgs84:`11,72,-101`},EPSG_4668:{towgs84:`-86,-98,-119`},EPSG_4717:{towgs84:`-2,151,181`},EPSG_4732:{towgs84:`102,52,-38`},EPSG_4280:{towgs84:`-377,681,-50`},EPSG_4209:{towgs84:`-138,-105,-289`},EPSG_4261:{towgs84:`31,146,47`},EPSG_4658:{towgs84:`-73,46,-86`},EPSG_4721:{towgs84:`265.025,384.929,-194.046`},EPSG_4222:{towgs84:`-136,-108,-292`},EPSG_4601:{towgs84:`-255,-15,71`},EPSG_4602:{towgs84:`725,685,536`},EPSG_4603:{towgs84:`72,213.7,93`},EPSG_4605:{towgs84:`9,183,236`},EPSG_4621:{towgs84:`137,248,-430`},EPSG_4657:{towgs84:`-28,199,5`},EPSG_4316:{towgs84:`103.25,-100.4,-307.19`},EPSG_4642:{towgs84:`-13,-348,292`},EPSG_4698:{towgs84:`145,-187,103`},EPSG_4192:{towgs84:`-206.1,-174.7,-87.7`},EPSG_4311:{towgs84:`-265,120,-358`},EPSG_4135:{towgs84:`58,-283,-182`},ESRI_104138:{towgs84:`198,-226,-347`},EPSG_4245:{towgs84:`-11,851,5`},EPSG_4142:{towgs84:`-125,53,467`},EPSG_4213:{towgs84:`-106,-87,188`},EPSG_4253:{towgs84:`-133,-77,-51`},EPSG_4129:{towgs84:`-132,-110,-335`},EPSG_4713:{towgs84:`-77,-128,142`},EPSG_4239:{towgs84:`217,823,299`},EPSG_4146:{towgs84:`295,736,257`},EPSG_4155:{towgs84:`-83,37,124`},EPSG_4165:{towgs84:`-173,253,27`},EPSG_4672:{towgs84:`175,-38,113`},EPSG_4236:{towgs84:`-637,-549,-203`},EPSG_4251:{towgs84:`-90,40,88`},EPSG_4271:{towgs84:`-2,374,172`},EPSG_4175:{towgs84:`-88,4,101`},EPSG_4716:{towgs84:`298,-304,-375`},EPSG_4315:{towgs84:`-23,259,-9`},EPSG_4744:{towgs84:`-242.2,-144.9,370.3`},EPSG_4244:{towgs84:`-97,787,86`},EPSG_4293:{towgs84:`616,97,-251`},EPSG_4714:{towgs84:`-127,-769,472`},EPSG_4736:{towgs84:`260,12,-147`},EPSG_6883:{towgs84:`-235,-110,393`},EPSG_6894:{towgs84:`-63,176,185`},EPSG_4205:{towgs84:`-43,-163,45`},EPSG_4256:{towgs84:`41,-220,-134`},EPSG_4262:{towgs84:`639,405,60`},EPSG_4604:{towgs84:`174,359,365`},EPSG_4169:{towgs84:`-115,118,426`},EPSG_4620:{towgs84:`-106,-129,165`},EPSG_4184:{towgs84:`-203,141,53`},EPSG_4616:{towgs84:`-289,-124,60`},EPSG_9403:{towgs84:`-307,-92,127`},EPSG_4684:{towgs84:`-133,-321,50`},EPSG_4708:{towgs84:`-491,-22,435`},EPSG_4707:{towgs84:`114,-116,-333`},EPSG_4709:{towgs84:`145,75,-272`},EPSG_4712:{towgs84:`-205,107,53`},EPSG_4711:{towgs84:`124,-234,-25`},EPSG_4718:{towgs84:`230,-199,-752`},EPSG_4719:{towgs84:`211,147,111`},EPSG_4724:{towgs84:`208,-435,-229`},EPSG_4725:{towgs84:`189,-79,-202`},EPSG_4735:{towgs84:`647,1777,-1124`},EPSG_4722:{towgs84:`-794,119,-298`},EPSG_4728:{towgs84:`-307,-92,127`},EPSG_4734:{towgs84:`-632,438,-609`},EPSG_4727:{towgs84:`912,-58,1227`},EPSG_4729:{towgs84:`185,165,42`},EPSG_4730:{towgs84:`170,42,84`},EPSG_4733:{towgs84:`276,-57,149`},ESRI_37218:{towgs84:`230,-199,-752`},ESRI_37240:{towgs84:`-7,215,225`},ESRI_37221:{towgs84:`252,-209,-751`},ESRI_4305:{towgs84:`-123,-206,219`},ESRI_104139:{towgs84:`-73,-247,227`},EPSG_4748:{towgs84:`51,391,-36`},EPSG_4219:{towgs84:`-384,664,-48`},EPSG_4255:{towgs84:`-333,-222,114`},EPSG_4257:{towgs84:`-587.8,519.75,145.76`},EPSG_4646:{towgs84:`-963,510,-359`},EPSG_6881:{towgs84:`-24,-203,268`},EPSG_6882:{towgs84:`-183,-15,273`},EPSG_4715:{towgs84:`-104,-129,239`},IGNF_RGF93GDD:{towgs84:`0,0,0`},IGNF_RGM04GDD:{towgs84:`0,0,0`},IGNF_RGSPM06GDD:{towgs84:`0,0,0`},IGNF_RGTAAF07GDD:{towgs84:`0,0,0`},IGNF_RGFG95GDD:{towgs84:`0,0,0`},IGNF_RGNCG:{towgs84:`0,0,0`},IGNF_RGPFGDD:{towgs84:`0,0,0`},IGNF_ETRS89G:{towgs84:`0,0,0`},IGNF_RGR92GDD:{towgs84:`0,0,0`},EPSG_4173:{towgs84:`0,0,0`},EPSG_4180:{towgs84:`0,0,0`},EPSG_4619:{towgs84:`0,0,0`},EPSG_4667:{towgs84:`0,0,0`},EPSG_4075:{towgs84:`0,0,0`},EPSG_6706:{towgs84:`0,0,0`},EPSG_7798:{towgs84:`0,0,0`},EPSG_4661:{towgs84:`0,0,0`},EPSG_4669:{towgs84:`0,0,0`},EPSG_8685:{towgs84:`0,0,0`},EPSG_4151:{towgs84:`0,0,0`},EPSG_9702:{towgs84:`0,0,0`},EPSG_4758:{towgs84:`0,0,0`},EPSG_4761:{towgs84:`0,0,0`},EPSG_4765:{towgs84:`0,0,0`},EPSG_8997:{towgs84:`0,0,0`},EPSG_4023:{towgs84:`0,0,0`},EPSG_4670:{towgs84:`0,0,0`},EPSG_4694:{towgs84:`0,0,0`},EPSG_4148:{towgs84:`0,0,0`},EPSG_4163:{towgs84:`0,0,0`},EPSG_4167:{towgs84:`0,0,0`},EPSG_4189:{towgs84:`0,0,0`},EPSG_4190:{towgs84:`0,0,0`},EPSG_4176:{towgs84:`0,0,0`},EPSG_4659:{towgs84:`0,0,0`},EPSG_3824:{towgs84:`0,0,0`},EPSG_3889:{towgs84:`0,0,0`},EPSG_4046:{towgs84:`0,0,0`},EPSG_4081:{towgs84:`0,0,0`},EPSG_4558:{towgs84:`0,0,0`},EPSG_4483:{towgs84:`0,0,0`},EPSG_5013:{towgs84:`0,0,0`},EPSG_5264:{towgs84:`0,0,0`},EPSG_5324:{towgs84:`0,0,0`},EPSG_5354:{towgs84:`0,0,0`},EPSG_5371:{towgs84:`0,0,0`},EPSG_5373:{towgs84:`0,0,0`},EPSG_5381:{towgs84:`0,0,0`},EPSG_5393:{towgs84:`0,0,0`},EPSG_5489:{towgs84:`0,0,0`},EPSG_5593:{towgs84:`0,0,0`},EPSG_6135:{towgs84:`0,0,0`},EPSG_6365:{towgs84:`0,0,0`},EPSG_5246:{towgs84:`0,0,0`},EPSG_7886:{towgs84:`0,0,0`},EPSG_8431:{towgs84:`0,0,0`},EPSG_8427:{towgs84:`0,0,0`},EPSG_8699:{towgs84:`0,0,0`},EPSG_8818:{towgs84:`0,0,0`},EPSG_4757:{towgs84:`0,0,0`},EPSG_9140:{towgs84:`0,0,0`},EPSG_8086:{towgs84:`0,0,0`},EPSG_4686:{towgs84:`0,0,0`},EPSG_4737:{towgs84:`0,0,0`},EPSG_4702:{towgs84:`0,0,0`},EPSG_4747:{towgs84:`0,0,0`},EPSG_4749:{towgs84:`0,0,0`},EPSG_4674:{towgs84:`0,0,0`},EPSG_4755:{towgs84:`0,0,0`},EPSG_4759:{towgs84:`0,0,0`},EPSG_4762:{towgs84:`0,0,0`},EPSG_4763:{towgs84:`0,0,0`},EPSG_4764:{towgs84:`0,0,0`},EPSG_4166:{towgs84:`0,0,0`},EPSG_4170:{towgs84:`0,0,0`},EPSG_5546:{towgs84:`0,0,0`},EPSG_7844:{towgs84:`0,0,0`},EPSG_4818:{towgs84:`589,76,480`},EPSG_10328:{towgs84:`0,0,0`},EPSG_9782:{towgs84:`0,0,0`},EPSG_9777:{towgs84:`0,0,0`},EPSG_10690:{towgs84:`0,0,0`},EPSG_10639:{towgs84:`0,0,0`},EPSG_10739:{towgs84:`0,0,0`},EPSG_7686:{towgs84:`0,0,0`},EPSG_8900:{towgs84:`0,0,0`},EPSG_5886:{towgs84:`0,0,0`},EPSG_7683:{towgs84:`0,0,0`},EPSG_6668:{towgs84:`0,0,0`},EPSG_20046:{towgs84:`0,0,0`},EPSG_10299:{towgs84:`0,0,0`},EPSG_10310:{towgs84:`0,0,0`},EPSG_10475:{towgs84:`0,0,0`},EPSG_4742:{towgs84:`0,0,0`},EPSG_10671:{towgs84:`0,0,0`},EPSG_10762:{towgs84:`0,0,0`},EPSG_10725:{towgs84:`0,0,0`},EPSG_10791:{towgs84:`0,0,0`},EPSG_10800:{towgs84:`0,0,0`},EPSG_10305:{towgs84:`0,0,0`},EPSG_10941:{towgs84:`0,0,0`},EPSG_10968:{towgs84:`0,0,0`},EPSG_10875:{towgs84:`0,0,0`},EPSG_6318:{towgs84:`0,0,0`},EPSG_10910:{towgs84:`0,0,0`}};for(var kt in Ot){var At=Ot[kt];At.datumName&&(Ot[At.datumName]=At)}function jt(e,t,n,r,i,a,o){var s={};return s.datum_type=5,t&&(s.datum_type=4,s.datum_params=t.map(parseFloat),(s.datum_params[0]!==0||s.datum_params[1]!==0||s.datum_params[2]!==0)&&(s.datum_type=1),s.datum_params.length>3&&(s.datum_params[3]!==0||s.datum_params[4]!==0||s.datum_params[5]!==0||s.datum_params[6]!==0)&&(s.datum_type=2,s.datum_params[3]*=ae,s.datum_params[4]*=ae,s.datum_params[5]*=ae,s.datum_params[6]=s.datum_params[6]/1e6+1)),o&&(s.datum_type=3,s.grids=o),s.a=n,s.b=r,s.es=i,s.ep2=a,s}var Mt={};function Nt(e,t,n){return t instanceof ArrayBuffer?Pt(e,t,n):{ready:Ft(e,t)}}function Pt(e,t,n){var r=!0;n!==void 0&&n.includeErrorFields===!1&&(r=!1);var i=new DataView(t),a=Bt(i),o=Vt(i,a),s={header:o,subgrids:Ut(i,o,a,r)};return Mt[e]=s,s}async function Ft(e,t){for(var n=[],r=await t.getImageCount(),i=r-1;i>=0;i--){var a=await t.getImage(i),o=await a.readRasters(),s=[a.getWidth(),a.getHeight()],c=a.getBoundingBox().map(Rt),l=typeof a.fileDirectory.getValue==`function`?a.fileDirectory.getValue(`ModelPixelScale`):a.fileDirectory.ModelPixelScale,u=[l[0],l[1]].map(Rt),d=c[0]+(s[0]-1)*u[0],f=c[3]-(s[1]-1)*u[1],p=o[0],m=o[1],h=[];for(let e=s[1]-1;e>=0;e--)for(let t=s[0]-1;t>=0;t--){var g=e*s[0]+t;h.push([-zt(m[g]),zt(p[g])])}n.push({del:u,lim:s,ll:[-d,f],cvs:h})}var _={header:{nSubgrids:r},subgrids:n};return Mt[e]=_,_}function It(e){return e===void 0?null:e.split(`,`).map(Lt)}function Lt(e){if(e.length===0)return null;var t=e[0]===`@`;return t&&(e=e.slice(1)),e===`null`?{name:`null`,mandatory:!t,grid:null,isNull:!0}:{name:e,mandatory:!t,grid:Mt[e]||null,isNull:!1}}function Rt(e){return e*Math.PI/180}function zt(e){return e/3600*Math.PI/180}function Bt(e){var t=e.getInt32(8,!1);return t!==11&&(t=e.getInt32(8,!0),t!==11&&console.warn(`Failed to detect nadgrid endian-ness, defaulting to little-endian`),!0)}function Vt(e,t){return{nFields:e.getInt32(8,t),nSubgridFields:e.getInt32(24,t),nSubgrids:e.getInt32(40,t),shiftType:Ht(e,56,64).trim(),fromSemiMajorAxis:e.getFloat64(120,t),fromSemiMinorAxis:e.getFloat64(136,t),toSemiMajorAxis:e.getFloat64(152,t),toSemiMinorAxis:e.getFloat64(168,t)}}function Ht(e,t,n){return String.fromCharCode.apply(null,new Uint8Array(e.buffer.slice(t,n)))}function Ut(e,t,n,r){for(var i=176,a=[],o=0;o<t.nSubgrids;o++){var s=Gt(e,i,n),c=Kt(e,i,s,n,r),l=Math.round(1+(s.upperLongitude-s.lowerLongitude)/s.longitudeInterval),u=Math.round(1+(s.upperLatitude-s.lowerLatitude)/s.latitudeInterval);a.push({ll:[zt(s.lowerLongitude),zt(s.lowerLatitude)],del:[zt(s.longitudeInterval),zt(s.latitudeInterval)],lim:[l,u],count:s.gridNodeCount,cvs:Wt(c)});var d=16;r===!1&&(d=8),i+=176+s.gridNodeCount*d}return a}function Wt(e){return e.map(function(e){return[zt(e.longitudeShift),zt(e.latitudeShift)]})}function Gt(e,t,n){return{name:Ht(e,t+8,t+16).trim(),parent:Ht(e,t+24,t+24+8).trim(),lowerLatitude:e.getFloat64(t+72,n),upperLatitude:e.getFloat64(t+88,n),lowerLongitude:e.getFloat64(t+104,n),upperLongitude:e.getFloat64(t+120,n),latitudeInterval:e.getFloat64(t+136,n),longitudeInterval:e.getFloat64(t+152,n),gridNodeCount:e.getInt32(t+168,n)}}function Kt(e,t,n,r,i){var a=t+176,o=16;i===!1&&(o=8);for(var s=[],c=0;c<n.gridNodeCount;c++){var l={latitudeShift:e.getFloat32(a+c*o,r),longitudeShift:e.getFloat32(a+c*o+4,r)};i!==!1&&(l.latitudeAccuracy=e.getFloat32(a+c*o+8,r),l.longitudeAccuracy=e.getFloat32(a+c*o+12,r)),s.push(l)}return s}function qt(e,t){if(!(this instanceof qt))return new qt(e);this.forward=null,this.inverse=null,this.init=null,this.name,this.axis,this.names=null,this.title,t||=function(e){if(e)throw e};var n=rt(e);if(typeof n!=`object`)t(`Could not parse to valid json: `+e);else{var r=qt.projections.get(n.projName);if(!r)t(`Could not get projection name from: `+e);else{if(n.datumCode&&n.datumCode!==`none`){var i=ge(Ot,n.datumCode);i&&(n.datum_params=n.datum_params||(i.towgs84?i.towgs84.split(`,`):null),n.ellps=i.ellipse,n.datumName=i.datumName?i.datumName:n.datumCode)}n.axis=n.axis||`enu`,n.ellps=n.ellps||`wgs84`,n.lat1=n.lat1||n.lat0;var a=Dt(n.a,n.b,n.rf,n.ellps,n.sphere),o=Et(a.a,a.b,a.rf,n.R_A),s=It(n.nadgrids),c=n.datum||jt(n.datumCode,n.datum_params,a.a,a.b,o.es,o.ep2,s);it(this,n),it(this,r),this.a=a.a,this.b=a.b,this.rf=a.rf,this.sphere=a.sphere,this.es=o.es,this.e=o.e,this.ep2=o.ep2,this.datum=c,`init`in this&&typeof this.init==`function`&&this.init(),this.k0||=1,t(null,this)}}}qt.projections=Ct,qt.projections.start();function Jt(e,t){return e.datum_type!==t.datum_type||e.a!==t.a||Math.abs(e.es-t.es)>5e-11?!1:e.datum_type===1?e.datum_params[0]===t.datum_params[0]&&e.datum_params[1]===t.datum_params[1]&&e.datum_params[2]===t.datum_params[2]:e.datum_type!==2||e.datum_params[0]===t.datum_params[0]&&e.datum_params[1]===t.datum_params[1]&&e.datum_params[2]===t.datum_params[2]&&e.datum_params[3]===t.datum_params[3]&&e.datum_params[4]===t.datum_params[4]&&e.datum_params[5]===t.datum_params[5]&&e.datum_params[6]===t.datum_params[6]}function Yt(e,t,n){var r=e.x,i=e.y,a=e.z?e.z:0,o,s,c,l;if(i<-M&&i>-1.001*M)i=-M;else if(i>M&&i<1.001*M)i=M;else if(i<-M)return{x:-1/0,y:-1/0,z:e.z};else if(i>M)return{x:1/0,y:1/0,z:e.z};return r>Math.PI&&(r-=2*Math.PI),s=Math.sin(i),l=Math.cos(i),c=s*s,o=n/Math.sqrt(1-t*c),{x:(o+a)*l*Math.cos(r),y:(o+a)*l*Math.sin(r),z:(o*(1-t)+a)*s}}function Xt(e,t,n,r){var i=1e-12,a=i*i,o=30,s,c,l,u,d,f,p,m,h,g,_,v,y,b=e.x,x=e.y,S=e.z?e.z:0,C,w,T;if(s=Math.sqrt(b*b+x*x),c=Math.sqrt(b*b+x*x+S*S),s/n<i){if(C=0,c/n<i)return w=M,T=-r,{x:e.x,y:e.y,z:e.z}}else C=Math.atan2(x,b);l=S/c,u=s/c,d=1/Math.sqrt(1-t*(2-t)*u*u),m=u*(1-t)*d,h=l*d,y=0;do y++,p=n/Math.sqrt(1-t*h*h),T=s*m+S*h-p*(1-t*h*h),f=t*p/(p+T),d=1/Math.sqrt(1-f*(2-f)*u*u),g=u*(1-f)*d,_=l*d,v=_*m-g*h,m=g,h=_;while(v*v>a&&y<o);return w=Math.atan(_/Math.abs(g)),{x:C,y:w,z:T}}function Zt(e,t,n){if(t===1)return{x:e.x+n[0],y:e.y+n[1],z:e.z+n[2]};if(t===2){var r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],c=n[5],l=n[6];return{x:l*(e.x-c*e.y+s*e.z)+r,y:l*(c*e.x+e.y-o*e.z)+i,z:l*(-s*e.x+o*e.y+e.z)+a}}}function Qt(e,t,n){if(t===1)return{x:e.x-n[0],y:e.y-n[1],z:e.z-n[2]};if(t===2){var r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],c=n[5],l=n[6],u=(e.x-r)/l,d=(e.y-i)/l,f=(e.z-a)/l;return{x:u+c*d-s*f,y:-c*u+d+o*f,z:s*u-o*d+f}}}function $t(e){return e===1||e===2}function en(e,t,n){if(Jt(e,t)||e.datum_type===5||t.datum_type===5)return n;var r=e.a,i=e.es;if(e.datum_type===3){if(tn(e,!1,n)!==0)return;r=re,i=ie}var a=t.a,o=t.b,s=t.es;if(t.datum_type===3&&(a=re,o=j,s=ie),i===s&&r===a&&!$t(e.datum_type)&&!$t(t.datum_type)||(n=Yt(n,i,r),$t(e.datum_type)&&(n=Zt(n,e.datum_type,e.datum_params)),$t(t.datum_type)&&(n=Qt(n,t.datum_type,t.datum_params)),n=Xt(n,s,a,o),t.datum_type!==3||tn(t,!0,n)===0))return n}function tn(e,t,n){if(e.grids===null||e.grids.length===0)return console.log(`Grid shift grids not found`),-1;var r={x:-n.x,y:n.y},i={x:NaN,y:NaN},a=[];outer:for(var o=0;o<e.grids.length;o++){var s=e.grids[o];if(a.push(s.name),s.isNull){i=r;break}if(s.grid===null){if(s.mandatory)return console.log(`Unable to find mandatory grid '`+s.name+`'`),-1}else for(var c=s.grid.subgrids,l=0,u=c.length;l<u;l++){var d=c[l],f=(Math.abs(d.del[1])+Math.abs(d.del[0]))/1e4,p=d.ll[0]-f,m=d.ll[1]-f,h=d.ll[0]+(d.lim[0]-1)*d.del[0]+f,g=d.ll[1]+(d.lim[1]-1)*d.del[1]+f;if(!(m>r.y||p>r.x||g<r.y||h<r.x)&&(i=nn(r,t,d),!isNaN(i.x)))break outer}}return isNaN(i.x)?(console.log(`Failed to find a grid shift table for location '`+-r.x*ue+` `+r.y*ue+` tried: '`+a+`'`),-1):(n.x=-i.x,n.y=i.y,0)}function nn(e,t,n){var r={x:NaN,y:NaN};if(isNaN(e.x))return r;var i={x:e.x,y:e.y};i.x-=n.ll[0],i.y-=n.ll[1],i.x=F(i.x-Math.PI)+Math.PI;var a=rn(i,n);if(t){if(isNaN(a.x))return r;a.x=i.x-a.x,a.y=i.y-a.y;var o=9,s=1e-12,c,l;do{if(l=rn(a,n),isNaN(l.x)){console.log(`Inverse grid shift iteration failed, presumably at grid edge. Using first approximation.`);break}c={x:i.x-(l.x+a.x),y:i.y-(l.y+a.y)},a.x+=c.x,a.y+=c.y}while(o--&&Math.abs(c.x)>s&&Math.abs(c.y)>s);if(o<0)return console.log(`Inverse grid shift iterator failed to converge.`),r;r.x=F(a.x+n.ll[0]),r.y=a.y+n.ll[1]}else isNaN(a.x)||(r.x=e.x+a.x,r.y=e.y+a.y);return r}function rn(e,t){var n={x:e.x/t.del[0],y:e.y/t.del[1]},r={x:Math.floor(n.x),y:Math.floor(n.y)},i={x:n.x-1*r.x,y:n.y-1*r.y},a={x:NaN,y:NaN},o;if(r.x<0||r.x>=t.lim[0]||r.y<0||r.y>=t.lim[1])return a;o=r.y*t.lim[0]+r.x;var s={x:t.cvs[o][0],y:t.cvs[o][1]};o++;var c={x:t.cvs[o][0],y:t.cvs[o][1]};o+=t.lim[0];var l={x:t.cvs[o][0],y:t.cvs[o][1]};o--;var u={x:t.cvs[o][0],y:t.cvs[o][1]},d=i.x*i.y,f=i.x*(1-i.y),p=(1-i.x)*(1-i.y),m=(1-i.x)*i.y;return a.x=p*s.x+f*c.x+m*u.x+d*l.x,a.y=p*s.y+f*c.y+m*u.y+d*l.y,a}var an=[`x`,`y`,`z`];function on(e,t){let n={};for(let r=0,i=e.axis.length;r<i;r++){if(r===2&&t.z===void 0)continue;let i=t[an[r]];switch(e.axis[r]){case`e`:n.x=i;break;case`w`:n.x=-i;break;case`n`:n.y=i;break;case`s`:n.y=-i;break;case`u`:n.z=i;break;case`d`:n.z=-i;break;default:return null}}return n}function sn(e,t){let n={};for(let r=0,i=e.axis.length;r<i;r++)if(r!==2||t.z!==void 0)switch(e.axis[r]){case`e`:n[an[r]]=t.x;break;case`w`:n[an[r]]=-t.x;break;case`n`:n[an[r]]=t.y;break;case`s`:n[an[r]]=-t.y;break;case`u`:n[an[r]]=t.z;break;case`d`:n[an[r]]=-t.z;break;default:return null}return n}function cn(e){var t={x:e[0],y:e[1]};return e.length>2&&(t.z=e[2]),e.length>3&&(t.m=e[3]),t}function ln(e){un(e.x),un(e.y)}function un(e){if(typeof Number.isFinite==`function`){if(Number.isFinite(e))return;throw TypeError(`coordinates must be finite numbers`)}if(typeof e!=`number`||e!==e||!isFinite(e))throw TypeError(`coordinates must be finite numbers`)}function dn(e,t){return(e.datum.datum_type===1||e.datum.datum_type===2||e.datum.datum_type===3)&&t.datumCode!==`WGS84`||(t.datum.datum_type===1||t.datum.datum_type===2||t.datum.datum_type===3)&&e.datumCode!==`WGS84`}function fn(e,t,n,r){var i,a=n.z!==void 0;if(ln(n),e.datum&&t.datum&&dn(e,t)&&(i=new qt(`WGS84`),n=fn(e,i,n,r),e=i),r&&e.axis!==`enu`&&(n=on(e,n)),e.projName===`longlat`)n={x:n.x*N,y:n.y*N,z:n.z||0};else if(e.to_meter&&(n={x:n.x*e.to_meter,y:n.y*e.to_meter,z:n.z||0}),n=e.inverse(n),!n)return;if(e.from_greenwich&&(n.x+=e.from_greenwich),n=en(e.datum,t.datum,n),n)return n=n,t.from_greenwich&&(n={x:n.x-t.from_greenwich,y:n.y,z:n.z||0}),t.projName===`longlat`?(t.long_wrap!==void 0&&(n.x=t.long_wrap+F(n.x-t.long_wrap)),n={x:n.x*ue,y:n.y*ue,z:n.z||0}):(n=t.forward(n),t.to_meter&&(n={x:n.x/t.to_meter,y:n.y/t.to_meter,z:n.z||0})),r&&t.axis!==`enu`?sn(t,n):(n&&!a&&t.projName!==`geocent`&&delete n.z,n)}function pn(e,t,n,r){return fn(e,t,Array.isArray(n)?cn(n):{x:n.x,y:n.y,z:n.z,m:n.m},r)}var mn=qt(`WGS84`);function hn(e,t,n,r){var i,a,o;return Array.isArray(n)?(i=fn(e,t,cn(n),r)||{x:NaN,y:NaN},n.length>2?(a=e.name!==void 0&&e.name===`geocent`||t.name!==void 0&&t.name===`geocent`,a?typeof i.z==`number`?[i.x,i.y,i.z].concat(n.slice(3)):[i.x,i.y,n[2]].concat(n.slice(3)):r&&typeof i.z==`number`?[i.x,i.y,i.z].concat(n.slice(3)):[i.x,i.y].concat(n.slice(2))):[i.x,i.y]):(i=fn(e,t,{x:n.x,y:n.y,z:n.z,m:n.m},r)||{x:NaN,y:NaN},o=Object.keys(n),o.length===2||(a=e.name!==void 0&&e.name===`geocent`||t.name!==void 0&&t.name===`geocent`,o.forEach(function(e){e!==`x`&&e!==`y`&&(e!==`z`||!a&&!r)&&(i[e]=n[e])})),i)}function gn(e){return e instanceof qt?e:typeof e==`object`&&`oProj`in e?e.oProj:qt(e)}function _n(e,t,n){var r,i,a=!1,o;return t===void 0?(i=gn(e),r=mn,a=!0):(t.x!==void 0||Array.isArray(t))&&(n=t,i=gn(e),r=mn,a=!0),r||=gn(e),i||=gn(t),n?hn(r,i,n):(o={forward:function(e,t){return hn(r,i,e,t)},inverse:function(e,t){return hn(i,r,e,t)}},a&&(o.oProj=i),o)}var vn=6,yn=`AJSAJS`,bn=`AFAFAF`,xn=65,Sn=73,Cn=79,wn=86,Tn=90,En={forward:Dn,inverse:On,toPoint:kn};function Dn(e,t){return t||=5,Fn(Mn({lat:e[1],lon:e[0]}),t)}function On(e){var t=Nn(zn(e.toUpperCase()));return t.lat&&t.lon?[t.lon,t.lat,t.lon,t.lat]:[t.left,t.bottom,t.right,t.top]}function kn(e){var t=Nn(zn(e.toUpperCase()));return t.lat&&t.lon?[t.lon,t.lat]:[(t.left+t.right)/2,(t.top+t.bottom)/2]}function An(e){return Math.PI/180*e}function jn(e){return e/Math.PI*180}function Mn(e){var t=e.lat,n=e.lon,r=6378137,i=.00669438,a=.9996,o,s,c,l,u,d,f,p=An(t),m=An(n),h,g=Math.floor((n+180)/6)+1;n===180&&(g=60),t>=56&&t<64&&n>=3&&n<12&&(g=32),t>=72&&t<84&&(n>=0&&n<9?g=31:n>=9&&n<21?g=33:n>=21&&n<33?g=35:n>=33&&n<42&&(g=37)),o=(g-1)*6-180+3,h=An(o),s=i/(1-i),c=r/Math.sqrt(1-i*Math.sin(p)*Math.sin(p)),l=Math.tan(p)*Math.tan(p),u=s*Math.cos(p)*Math.cos(p),d=Math.cos(p)*(m-h),f=r*((1-i/4-3*i*i/64-5*i*i*i/256)*p-(3*i/8+3*i*i/32+45*i*i*i/1024)*Math.sin(2*p)+(15*i*i/256+45*i*i*i/1024)*Math.sin(4*p)-35*i*i*i/3072*Math.sin(6*p));var _=a*c*(d+(1-l+u)*d*d*d/6+(5-18*l+l*l+72*u-58*s)*d*d*d*d*d/120)+5e5,v=a*(f+c*Math.tan(p)*(d*d/2+(5-l+9*u+4*u*u)*d*d*d*d/24+(61-58*l+l*l+600*u-330*s)*d*d*d*d*d*d/720));return t<0&&(v+=1e7),{northing:Math.round(v),easting:Math.round(_),zoneNumber:g,zoneLetter:Pn(t)}}function Nn(e){var t=e.northing,n=e.easting,r=e.zoneLetter,i=e.zoneNumber;if(i<0||i>60)return null;var a=.9996,o=6378137,s=.00669438,c,l=(1-Math.sqrt(1-s))/(1+Math.sqrt(1-s)),u,d,f,p,m,h,g,_,v,y=n-5e5,b=t;r<`N`&&(b-=1e7),g=(i-1)*6-180+3,c=s/(1-s),h=b/a,_=h/(o*(1-s/4-3*s*s/64-5*s*s*s/256)),v=_+(3*l/2-27*l*l*l/32)*Math.sin(2*_)+(21*l*l/16-55*l*l*l*l/32)*Math.sin(4*_)+151*l*l*l/96*Math.sin(6*_),u=o/Math.sqrt(1-s*Math.sin(v)*Math.sin(v)),d=Math.tan(v)*Math.tan(v),f=c*Math.cos(v)*Math.cos(v),p=o*(1-s)/(1-s*Math.sin(v)*Math.sin(v))**1.5,m=y/(u*a);var x=v-u*Math.tan(v)/p*(m*m/2-(5+3*d+10*f-4*f*f-9*c)*m*m*m*m/24+(61+90*d+298*f+45*d*d-252*c-3*f*f)*m*m*m*m*m*m/720);x=jn(x);var S=(m-(1+2*d+f)*m*m*m/6+(5-2*f+28*d-3*f*f+8*c+24*d*d)*m*m*m*m*m/120)/Math.cos(v);S=g+jn(S);var C;if(e.accuracy){var w=Nn({northing:e.northing+e.accuracy,easting:e.easting+e.accuracy,zoneLetter:e.zoneLetter,zoneNumber:e.zoneNumber});C={top:w.lat,right:w.lon,bottom:x,left:S}}else C={lat:x,lon:S};return C}function Pn(e){var t=`Z`;return 84>=e&&e>=72?t=`X`:72>e&&e>=64?t=`W`:64>e&&e>=56?t=`V`:56>e&&e>=48?t=`U`:48>e&&e>=40?t=`T`:40>e&&e>=32?t=`S`:32>e&&e>=24?t=`R`:24>e&&e>=16?t=`Q`:16>e&&e>=8?t=`P`:8>e&&e>=0?t=`N`:0>e&&e>=-8?t=`M`:-8>e&&e>=-16?t=`L`:-16>e&&e>=-24?t=`K`:-24>e&&e>=-32?t=`J`:-32>e&&e>=-40?t=`H`:-40>e&&e>=-48?t=`G`:-48>e&&e>=-56?t=`F`:-56>e&&e>=-64?t=`E`:-64>e&&e>=-72?t=`D`:-72>e&&e>=-80&&(t=`C`),t}function Fn(e,t){var n=`00000`+e.easting,r=`00000`+e.northing;return e.zoneNumber+e.zoneLetter+In(e.easting,e.northing,e.zoneNumber)+n.substr(n.length-5,t)+r.substr(r.length-5,t)}function In(e,t,n){var r=Ln(n);return Rn(Math.floor(e/1e5),Math.floor(t/1e5)%20,r)}function Ln(e){var t=e%vn;return t===0&&(t=vn),t}function Rn(e,t,n){var r=n-1,i=yn.charCodeAt(r),a=bn.charCodeAt(r),o=i+e-1,s=a+t,c=!1;return o>Tn&&(o=o-Tn+xn-1,c=!0),(o===Sn||i<Sn&&o>Sn||(o>Sn||i<Sn)&&c)&&o++,(o===Cn||i<Cn&&o>Cn||(o>Cn||i<Cn)&&c)&&(o++,o===Sn&&o++),o>Tn&&(o=o-Tn+xn-1),s>wn?(s=s-wn+xn-1,c=!0):c=!1,(s===Sn||a<Sn&&s>Sn||(s>Sn||a<Sn)&&c)&&s++,(s===Cn||a<Cn&&s>Cn||(s>Cn||a<Cn)&&c)&&(s++,s===Sn&&s++),s>wn&&(s=s-wn+xn-1),String.fromCharCode(o)+String.fromCharCode(s)}function zn(e){if(e&&e.length===0)throw`MGRSPoint coverting from nothing`;for(var t=e.length,n=null,r=``,i,a=0;!/[A-Z]/.test(i=e.charAt(a));){if(a>=2)throw`MGRSPoint bad conversion from: `+e;r+=i,a++}var o=parseInt(r,10);if(a===0||a+3>t)throw`MGRSPoint bad conversion from: `+e;var s=e.charAt(a++);if(s<=`A`||s===`B`||s===`Y`||s>=`Z`||s===`I`||s===`O`)throw`MGRSPoint zone letter `+s+` not handled: `+e;n=e.substring(a,a+=2);for(var c=Ln(o),l=Bn(n.charAt(0),c),u=Vn(n.charAt(1),c);u<Hn(s);)u+=2e6;var d=t-a;if(d%2!=0)throw`MGRSPoint has to have an even number
of digits after the zone letter and two 100km letters - front
half for easting meters, second half for
northing meters`+e;var f=d/2,p=0,m=0,h,g,_,v,y;return f>0&&(h=1e5/10**f,g=e.substring(a,a+f),p=parseFloat(g)*h,_=e.substring(a+f),m=parseFloat(_)*h),v=p+l,y=m+u,{easting:v,northing:y,zoneLetter:s,zoneNumber:o,accuracy:h}}function Bn(e,t){for(var n=yn.charCodeAt(t-1),r=1e5,i=!1;n!==e.charCodeAt(0);){if(n++,n===Sn&&n++,n===Cn&&n++,n>Tn){if(i)throw`Bad character: `+e;n=xn,i=!0}r+=1e5}return r}function Vn(e,t){if(e>`V`)throw`MGRSPoint given invalid Northing `+e;for(var n=bn.charCodeAt(t-1),r=0,i=!1;n!==e.charCodeAt(0);){if(n++,n===Sn&&n++,n===Cn&&n++,n>wn){if(i)throw`Bad character: `+e;n=xn,i=!0}r+=1e5}return r}function Hn(e){var t;switch(e){case`C`:t=11e5;break;case`D`:t=2e6;break;case`E`:t=28e5;break;case`F`:t=37e5;break;case`G`:t=46e5;break;case`H`:t=55e5;break;case`J`:t=64e5;break;case`K`:t=73e5;break;case`L`:t=82e5;break;case`M`:t=91e5;break;case`N`:t=0;break;case`P`:t=8e5;break;case`Q`:t=17e5;break;case`R`:t=26e5;break;case`S`:t=35e5;break;case`T`:t=44e5;break;case`U`:t=53e5;break;case`V`:t=62e5;break;case`W`:t=7e6;break;case`X`:t=79e5;break;default:t=-1}if(t>=0)return t;throw`Invalid zone letter: `+e}function Un(e,t,n){if(!(this instanceof Un))return new Un(e,t,n);if(Array.isArray(e))this.x=e[0],this.y=e[1],this.z=e[2]||0;else if(typeof e==`object`)this.x=e.x,this.y=e.y,this.z=e.z||0;else if(typeof e==`string`&&t===void 0){var r=e.split(`,`);this.x=parseFloat(r[0]),this.y=parseFloat(r[1]),this.z=parseFloat(r[2])||0}else this.x=e,this.y=t,this.z=n||0;console.warn(`proj4.Point will be removed in version 3, use proj4.toPoint`)}Un.fromMGRS=function(e){return new Un(kn(e))},Un.prototype.toMGRS=function(e){return Dn([this.x,this.y],e)};var Wn=1,Gn=.25,Kn=.046875,qn=.01953125,Jn=.01068115234375,Yn=.75,Xn=.46875,Zn=.013020833333333334,Qn=.007120768229166667,$n=.3645833333333333,er=.005696614583333333,tr=.3076171875;function nr(e){var t=[];t[0]=Wn-e*(Gn+e*(Kn+e*(qn+e*Jn))),t[1]=e*(Yn-e*(Kn+e*(qn+e*Jn)));var n=e*e;return t[2]=n*(Xn-e*(Zn+e*Qn)),n*=e,t[3]=n*($n-e*er),t[4]=n*e*tr,t}function rr(e,t,n,r){return n*=t,t*=t,r[0]*e-n*(r[1]+t*(r[2]+t*(r[3]+t*r[4])))}var ir=20;function ar(e,t,n){for(var r=1/(1-t),i=e,a=ir;a;--a){var o=Math.sin(i),s=1-t*o*o;if(s=(rr(i,o,Math.cos(i),n)-e)*(s*Math.sqrt(s))*r,i-=s,Math.abs(s)<1e-10)return i}return i}function or(){this.x0=this.x0===void 0?0:this.x0,this.y0=this.y0===void 0?0:this.y0,this.long0=this.long0===void 0?0:this.long0,this.lat0=this.lat0===void 0?0:this.lat0,this.es&&(this.en=nr(this.es),this.ml0=rr(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function sr(e){var t=e.x,n=e.y,r=F(t-this.long0,this.over),i,a,o,s=Math.sin(n),c=Math.cos(n);if(this.es){var l=c*r,u=l**2,d=this.ep2*c**2,f=d**2,p=(Math.abs(c)>1e-10?Math.tan(n):0)**2,m=p**2;i=1-this.es*s**2,l/=Math.sqrt(i);var h=rr(n,s,c,this.en);a=this.a*(this.k0*l*(1+u/6*(1-p+d+u/20*(5-18*p+m+14*d-58*p*d+u/42*(61+179*m-m*p-479*p)))))+this.x0,o=this.a*(this.k0*(h-this.ml0+s*r*l/2*(1+u/12*(5-p+9*d+4*f+u/30*(61+m-58*p+270*d-330*p*d+u/56*(1385+543*m-m*p-3111*p))))))+this.y0}else{var g=c*Math.sin(r);if(Math.abs(Math.abs(g)-1)<1e-10)return 93;if(a=.5*this.a*this.k0*Math.log((1+g)/(1-g))+this.x0,o=c*Math.cos(r)/Math.sqrt(1-g**2),g=Math.abs(o),g>=1){if(g-1>1e-10)return 93;o=0}else o=Math.acos(o);n<0&&(o=-o),o=this.a*this.k0*(o-this.lat0)+this.y0}return e.x=a,e.y=o,e}function cr(e){var t,n,r,i,a=(e.x-this.x0)*(1/this.a),o=(e.y-this.y0)*(1/this.a);if(!this.es){var s=Math.exp(a/this.k0),c=.5*(s-1/s),l=this.lat0+o/this.k0,u=Math.cos(l);t=Math.sqrt((1-u**2)/(1+c**2)),r=Math.asin(t),o<0&&(r=-r),i=c===0&&u===0?0:F(Math.atan2(c,u)+this.long0,this.over)}else if(t=this.ml0+o/this.k0,n=ar(t,this.es,this.en),Math.abs(n)<M){var d=Math.sin(n),f=Math.cos(n),p=Math.abs(f)>1e-10?Math.tan(n):0,m=this.ep2*f**2,h=m**2,g=p**2,_=g**2;t=1-this.es*d**2;var v=a*Math.sqrt(t)/this.k0,y=v**2;t*=p,r=n-t*y/(1-this.es)*.5*(1-y/12*(5+3*g-9*m*g+m-4*h-y/30*(61+90*g-252*m*g+45*_+46*m-y/56*(1385+3633*g+4095*_+1574*_*g)))),i=F(this.long0+v*(1-y/6*(1+2*g+m-y/20*(5+28*g+24*_+8*m*g+6*m-y/42*(61+662*g+1320*_+720*_*g))))/f,this.over)}else r=M*ot(o),i=0;return e.x=i,e.y=r,e}var lr={init:or,forward:sr,inverse:cr,names:[`Fast_Transverse_Mercator`,`Fast Transverse Mercator`]};function ur(e){var t=Math.exp(e);return t=(t-1/t)/2,t}function dr(e,t){e=Math.abs(e),t=Math.abs(t);var n=Math.max(e,t),r=Math.min(e,t)/(n||1);return n*Math.sqrt(1+r**2)}function fr(e){var t=1+e,n=t-1;return n===0?e:e*Math.log(t)/n}function pr(e){var t=Math.abs(e);return t=fr(t*(1+t/(dr(1,t)+1))),e<0?-t:t}function mr(e,t){for(var n=2*Math.cos(2*t),r=e.length-1,i=e[r],a=0,o;--r>=0;)o=-a+n*i+e[r],a=i,i=o;return t+o*Math.sin(2*t)}function hr(e,t){for(var n=2*Math.cos(t),r=e.length-1,i=e[r],a=0,o;--r>=0;)o=-a+n*i+e[r],a=i,i=o;return Math.sin(t)*o}function gr(e){var t=Math.exp(e);return t=(t+1/t)/2,t}function _r(e,t,n){for(var r=Math.sin(t),i=Math.cos(t),a=ur(n),o=gr(n),s=2*i*o,c=-2*r*a,l=e.length-1,u=e[l],d=0,f=0,p=0,m,h;--l>=0;)m=f,h=d,f=u,d=p,u=-m+s*f-c*d+e[l],p=-h+c*f+s*d;return s=r*o,c=i*a,[s*u-c*p,s*p+c*u]}function vr(){if(!this.approx&&(isNaN(this.es)||this.es<=0))throw Error(`Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.`);this.approx&&(lr.init.apply(this),this.forward=lr.forward,this.inverse=lr.inverse),this.x0=this.x0===void 0?0:this.x0,this.y0=this.y0===void 0?0:this.y0,this.long0=this.long0===void 0?0:this.long0,this.lat0=this.lat0===void 0?0:this.lat0,this.k0=this.k0===void 0?1:this.k0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var e=this.es/(1+Math.sqrt(1-this.es)),t=e/(2-e),n=t;this.cgb[0]=t*(2+t*(-2/3+t*(-2+t*(116/45+t*(26/45+-2854/675*t))))),this.cbg[0]=t*(-2+t*(2/3+t*(4/3+t*(-82/45+t*(32/45+4642/4725*t))))),n*=t,this.cgb[1]=n*(7/3+t*(-8/5+t*(-227/45+t*(2704/315+2323/945*t)))),this.cbg[1]=n*(5/3+t*(-16/15+t*(-13/9+t*(904/315+-1522/945*t)))),n*=t,this.cgb[2]=n*(56/15+t*(-136/35+t*(-1262/105+73814/2835*t))),this.cbg[2]=n*(-26/15+t*(34/21+t*(8/5+-12686/2835*t))),n*=t,this.cgb[3]=n*(4279/630+t*(-332/35+-399572/14175*t)),this.cbg[3]=n*(1237/630+t*(-12/5+-24832/14175*t)),n*=t,this.cgb[4]=n*(4174/315+-144838/6237*t),this.cbg[4]=n*(-734/315+109598/31185*t),n*=t,this.cgb[5]=601676/22275*n,this.cbg[5]=444337/155925*n,n=t**2,this.Qn=this.k0/(1+t)*(1+n*(1/4+n*(1/64+n/256))),this.utg[0]=t*(-.5+t*(2/3+t*(-37/96+t*(1/360+t*(81/512+-96199/604800*t))))),this.gtu[0]=t*(.5+t*(-2/3+t*(5/16+t*(41/180+t*(-127/288+7891/37800*t))))),this.utg[1]=n*(-1/48+t*(-1/15+t*(437/1440+t*(-46/105+1118711/3870720*t)))),this.gtu[1]=n*(13/48+t*(-3/5+t*(557/1440+t*(281/630+-1983433/1935360*t)))),n*=t,this.utg[2]=n*(-17/480+t*(37/840+t*(209/4480+-5569/90720*t))),this.gtu[2]=n*(61/240+t*(-103/140+t*(15061/26880+167603/181440*t))),n*=t,this.utg[3]=n*(-4397/161280+t*(11/504+830251/7257600*t)),this.gtu[3]=n*(49561/161280+t*(-179/168+6601661/7257600*t)),n*=t,this.utg[4]=n*(-4583/161280+108847/3991680*t),this.gtu[4]=n*(34729/80640+-3418889/1995840*t),n*=t,this.utg[5]=-20648693/638668800*n,this.gtu[5]=212378941/319334400*n;var r=mr(this.cbg,this.lat0);this.Zb=-this.Qn*(r+hr(this.gtu,2*r))}function yr(e){var t=F(e.x-this.long0,this.over),n=e.y;n=mr(this.cbg,n);var r=Math.sin(n),i=Math.cos(n),a=Math.sin(t),o=Math.cos(t);n=Math.atan2(r,o*i),t=Math.atan2(a*i,dr(r,i*o)),t=pr(Math.tan(t));var s=_r(this.gtu,2*n,2*t);n+=s[0],t+=s[1];var c,l;return Math.abs(t)<=2.623395162778?(c=this.a*(this.Qn*t)+this.x0,l=this.a*(this.Qn*n+this.Zb)+this.y0):(c=1/0,l=1/0),e.x=c,e.y=l,e}function br(e){var t=(e.x-this.x0)*(1/this.a),n=(e.y-this.y0)*(1/this.a);n=(n-this.Zb)/this.Qn,t/=this.Qn;var r,i;if(Math.abs(t)<=2.623395162778){var a=_r(this.utg,2*n,2*t);n+=a[0],t+=a[1],t=Math.atan(ur(t));var o=Math.sin(n),s=Math.cos(n),c=Math.sin(t),l=Math.cos(t);n=Math.atan2(o*l,dr(c,l*s)),t=Math.atan2(c,l*s),r=F(t+this.long0,this.over),i=mr(this.cgb,n)}else r=1/0,i=1/0;return e.x=r,e.y=i,e}var xr={init:vr,forward:yr,inverse:br,names:[`Extended_Transverse_Mercator`,`Extended Transverse Mercator`,`etmerc`,`Transverse_Mercator`,`Transverse Mercator`,`Gauss Kruger`,`Gauss_Kruger`,`tmerc`]};function Sr(e,t){if(e===void 0){if(e=Math.floor((F(t)+Math.PI)*30/Math.PI)+1,e<0)return 0;if(e>60)return 60}return e}var Cr=`etmerc`;function wr(){var e=Sr(this.zone,this.long0);if(e===void 0)throw Error(`unknown utm zone`);this.lat0=0,this.long0=(6*Math.abs(e)-183)*N,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,xr.init.apply(this),this.forward=xr.forward,this.inverse=xr.inverse}var Tr={init:wr,names:[`Universal Transverse Mercator System`,`utm`],dependsOn:Cr};function Er(e,t){return((1-e)/(1+e))**t}var Dr=20;function Or(){var e=Math.sin(this.lat0),t=Math.cos(this.lat0);t*=t,this.rc=Math.sqrt(1-this.es)/(1-this.es*e*e),this.C=Math.sqrt(1+this.es*t*t/(1-this.es)),this.phic0=Math.asin(e/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+P)/(Math.tan(.5*this.lat0+P)**+this.C*Er(this.e*e,this.ratexp))}function kr(e){var t=e.x,n=e.y;return e.y=2*Math.atan(this.K*Math.tan(.5*n+P)**+this.C*Er(this.e*Math.sin(n),this.ratexp))-M,e.x=this.C*t,e}function Ar(e){for(var t=1e-14,n=e.x/this.C,r=e.y,i=(Math.tan(.5*r+P)/this.K)**(1/this.C),a=Dr;a>0&&(r=2*Math.atan(i*Er(this.e*Math.sin(e.y),-.5*this.e))-M,!(Math.abs(r-e.y)<t));--a)e.y=r;return a?(e.x=n,e.y=r,e):null}var jr={init:Or,forward:kr,inverse:Ar,names:[`gauss`]};function Mr(){jr.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||=`Oblique Stereographic Alternative`)}function Nr(e){var t,n,r,i;return e.x=F(e.x-this.long0,this.over),jr.forward.apply(this,[e]),t=Math.sin(e.y),n=Math.cos(e.y),r=Math.cos(e.x),i=this.k0*this.R2/(1+this.sinc0*t+this.cosc0*n*r),e.x=i*n*Math.sin(e.x),e.y=i*(this.cosc0*t-this.sinc0*n*r),e.x=this.a*e.x+this.x0,e.y=this.a*e.y+this.y0,e}function Pr(e){var t,n,r,i,a;if(e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,e.x/=this.k0,e.y/=this.k0,a=dr(e.x,e.y)){var o=2*Math.atan2(a,this.R2);t=Math.sin(o),n=Math.cos(o),i=Math.asin(n*this.sinc0+e.y*t*this.cosc0/a),r=Math.atan2(e.x*t,a*this.cosc0*n-e.y*this.sinc0*t)}else i=this.phic0,r=0;return e.x=r,e.y=i,jr.inverse.apply(this,[e]),e.x=F(e.x+this.long0,this.over),e}var Fr={init:Mr,forward:Nr,inverse:Pr,names:[`Stereographic_North_Pole`,`Oblique_Stereographic`,`sterea`,`Oblique Stereographic Alternative`,`Double_Stereographic`]};function Ir(e,t,n){return t*=n,Math.tan(.5*(M+e))*((1-t)/(1+t))**(.5*n)}function Lr(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=1e-10&&(this.k0=.5*(1+ot(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=1e-10&&(this.con=this.lat0>0?1:-1),this.cons=Math.sqrt((1+this.e)**+(1+this.e)*(1-this.e)**(1-this.e)),!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=1e-10&&Math.abs(Math.cos(this.lat_ts))>1e-10&&(this.k0=.5*this.cons*at(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/st(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=at(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(Ir(this.lat0,this.sinlat0,this.e))-M,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function Rr(e){var t=e.x,n=e.y,r=Math.sin(n),i=Math.cos(n),a,o,s,c,l,u,d=F(t-this.long0,this.over);return Math.abs(Math.abs(t-this.long0)-Math.PI)<=1e-10&&Math.abs(n+this.lat0)<=1e-10?(e.x=NaN,e.y=NaN,e):this.sphere?(a=2*this.k0/(1+this.sinlat0*r+this.coslat0*i*Math.cos(d)),e.x=this.a*a*i*Math.sin(d)+this.x0,e.y=this.a*a*(this.coslat0*r-this.sinlat0*i*Math.cos(d))+this.y0,e):(o=2*Math.atan(Ir(n,r,this.e))-M,c=Math.cos(o),s=Math.sin(o),Math.abs(this.coslat0)<=1e-10?(l=st(this.e,n*this.con,this.con*r),u=2*this.a*this.k0*l/this.cons,e.x=this.x0+u*Math.sin(t-this.long0),e.y=this.y0-this.con*u*Math.cos(t-this.long0),e):(Math.abs(this.sinlat0)<1e-10?(a=2*this.a*this.k0/(1+c*Math.cos(d)),e.y=a*s):(a=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*s+this.cosX0*c*Math.cos(d))),e.y=a*(this.cosX0*s-this.sinX0*c*Math.cos(d))+this.y0),e.x=a*c*Math.sin(d)+this.x0,e))}function zr(e){e.x-=this.x0,e.y-=this.y0;var t,n,r,i,a,o=Math.sqrt(e.x*e.x+e.y*e.y);if(this.sphere){var s=2*Math.atan(o/(2*this.a*this.k0));return t=this.long0,n=this.lat0,o<=1e-10?(e.x=t,e.y=n,e):(n=Math.asin(Math.cos(s)*this.sinlat0+e.y*Math.sin(s)*this.coslat0/o),t=Math.abs(this.coslat0)<1e-10?this.lat0>0?F(this.long0+Math.atan2(e.x,-1*e.y),this.over):F(this.long0+Math.atan2(e.x,e.y),this.over):F(this.long0+Math.atan2(e.x*Math.sin(s),o*this.coslat0*Math.cos(s)-e.y*this.sinlat0*Math.sin(s)),this.over),e.x=t,e.y=n,e)}if(Math.abs(this.coslat0)<=1e-10){if(o<=1e-10)return n=this.lat0,t=this.long0,e.x=t,e.y=n,e;e.x*=this.con,e.y*=this.con,r=o*this.cons/(2*this.a*this.k0),n=this.con*ct(this.e,r),t=this.con*F(this.con*this.long0+Math.atan2(e.x,-1*e.y),this.over)}else i=2*Math.atan(o*this.cosX0/(2*this.a*this.k0*this.ms1)),t=this.long0,o<=1e-10?a=this.X0:(a=Math.asin(Math.cos(i)*this.sinX0+e.y*Math.sin(i)*this.cosX0/o),t=F(this.long0+Math.atan2(e.x*Math.sin(i),o*this.cosX0*Math.cos(i)-e.y*this.sinX0*Math.sin(i)),this.over)),n=-1*ct(this.e,Math.tan(.5*(M+a)));return e.x=t,e.y=n,e}var Br={init:Lr,forward:Rr,inverse:zr,names:[`stere`,`Stereographic_South_Pole`,`Polar_Stereographic_variant_A`,`Polar_Stereographic_variant_B`,`Polar_Stereographic`],ssfn_:Ir};function Vr(){this.k0||=1;var e=this.lat0;this.lambda0=this.long0;var t=Math.sin(e),n=this.a,r=1/this.rf,i=2*r-r**2,a=this.e=Math.sqrt(i);this.R=this.k0*n*Math.sqrt(1-i)/(1-i*t**2),this.alpha=Math.sqrt(1+i/(1-i)*Math.cos(e)**4),this.b0=Math.asin(t/this.alpha);var o=Math.log(Math.tan(Math.PI/4+this.b0/2)),s=Math.log(Math.tan(Math.PI/4+e/2)),c=Math.log((1+a*t)/(1-a*t));this.K=o-this.alpha*s+this.alpha*a/2*c}function Hr(e){var t=Math.log(Math.tan(Math.PI/4-e.y/2)),n=this.e/2*Math.log((1+this.e*Math.sin(e.y))/(1-this.e*Math.sin(e.y))),r=-this.alpha*(t+n)+this.K,i=2*(Math.atan(Math.exp(r))-Math.PI/4),a=this.alpha*(e.x-this.lambda0),o=Math.atan(Math.sin(a)/(Math.sin(this.b0)*Math.tan(i)+Math.cos(this.b0)*Math.cos(a))),s=Math.asin(Math.cos(this.b0)*Math.sin(i)-Math.sin(this.b0)*Math.cos(i)*Math.cos(a));return e.y=this.R/2*Math.log((1+Math.sin(s))/(1-Math.sin(s)))+this.y0,e.x=this.R*o+this.x0,e}function Ur(e){for(var t=e.x-this.x0,n=e.y-this.y0,r=t/this.R,i=2*(Math.atan(Math.exp(n/this.R))-Math.PI/4),a=Math.asin(Math.cos(this.b0)*Math.sin(i)+Math.sin(this.b0)*Math.cos(i)*Math.cos(r)),o=Math.atan(Math.sin(r)/(Math.cos(this.b0)*Math.cos(r)-Math.sin(this.b0)*Math.tan(i))),s=this.lambda0+o/this.alpha,c=0,l=a,u=-1e3,d=0;Math.abs(l-u)>1e-7;){if(++d>20)return;c=1/this.alpha*(Math.log(Math.tan(Math.PI/4+a/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(l))/2)),u=l,l=2*Math.atan(Math.exp(c))-Math.PI/2}return e.x=s,e.y=l,e}var Wr={init:Vr,forward:Hr,inverse:Ur,names:[`somerc`]},Gr=1e-7;function Kr(e){var t=[`Hotine_Oblique_Mercator`,`Hotine_Oblique_Mercator_variant_A`,`Hotine_Oblique_Mercator_Azimuth_Natural_Origin`],n=typeof e.projName==`object`?Object.keys(e.projName)[0]:e.projName;return`no_uoff`in e||`no_off`in e||t.indexOf(n)!==-1||t.indexOf(bt(n))!==-1}function qr(){var e,t,n,r,i,a,o,s,c,l,u=0,d,f=0,p=0,m=0,h=0,g=0,_=0;this.k0||=1,this.no_off=Kr(this),this.no_rot=`no_rot`in this;var v=!1;`alpha`in this&&(v=!0);var y=!1;if(`rectified_grid_angle`in this&&(y=!0),v&&(_=this.alpha),y&&(u=this.rectified_grid_angle,v||=(_=0,!0)),v||y)f=this.longc;else if(p=this.long1,h=this.lat1,m=this.long2,g=this.lat2,Math.abs(h-g)<=Gr||(e=Math.abs(h))<=Gr||Math.abs(e-M)<=Gr||Math.abs(Math.abs(this.lat0)-M)<=Gr||Math.abs(Math.abs(g)-M)<=Gr)throw Error();var b=1-this.es;t=Math.sqrt(b),Math.abs(this.lat0)>1e-10?(s=Math.sin(this.lat0),n=Math.cos(this.lat0),e=1-this.es*s*s,this.B=n*n,this.B=Math.sqrt(1+this.es*this.B*this.B/b),this.A=this.B*this.k0*t/e,r=this.B*t/(n*Math.sqrt(e)),i=r*r-1,i<=0?i=0:(i=Math.sqrt(i),this.lat0<0&&(i=-i)),this.E=i+=r,this.E*=st(this.e,this.lat0,s)**+this.B):(this.B=1/t,this.A=this.k0,this.E=r=i=1),v||y?(v?(d=Math.asin(Math.sin(_)/r),y||(u=_)):(d=u,_=Math.asin(r*Math.sin(d))),this.lam0=f-Math.asin(.5*(i-1/i)*Math.tan(d))/this.B):(a=st(this.e,h,Math.sin(h))**+this.B,o=st(this.e,g,Math.sin(g))**+this.B,i=this.E/a,c=(o-a)/(o+a),l=this.E*this.E,l=(l-o*a)/(l+o*a),e=p-m,e<-Math.PI?m-=de:e>Math.PI&&(m+=de),this.lam0=F(.5*(p+m)-Math.atan(l*Math.tan(.5*this.B*(p-m))/c)/this.B,this.over),d=Math.atan(2*Math.sin(this.B*F(p-this.lam0,this.over))/(i-1/i)),u=_=Math.asin(r*Math.sin(d))),this.singam=Math.sin(d),this.cosgam=Math.cos(d),this.sinrot=Math.sin(u),this.cosrot=Math.cos(u),this.rB=1/this.B,this.ArB=this.A*this.rB,this.BrA=1/this.ArB,this.no_off?this.u_0=0:(this.u_0=Math.abs(this.ArB*Math.atan(Math.sqrt(r*r-1)/Math.cos(_))),this.lat0<0&&(this.u_0=-this.u_0)),i=.5*d,this.v_pole_n=this.ArB*Math.log(Math.tan(P-i)),this.v_pole_s=this.ArB*Math.log(Math.tan(P+i))}function Jr(e){var t={},n,r,i,a,o,s,c,l;if(e.x-=this.lam0,Math.abs(Math.abs(e.y)-M)>1e-10){if(o=this.E/st(this.e,e.y,Math.sin(e.y))**+this.B,s=1/o,n=.5*(o-s),r=.5*(o+s),a=Math.sin(this.B*e.x),i=(n*this.singam-a*this.cosgam)/r,Math.abs(Math.abs(i)-1)<1e-10)throw Error();l=.5*this.ArB*Math.log((1-i)/(1+i)),s=Math.cos(this.B*e.x),c=Math.abs(s)<Gr?this.A*e.x:this.ArB*Math.atan2(n*this.cosgam+a*this.singam,s)}else l=e.y>0?this.v_pole_n:this.v_pole_s,c=this.ArB*e.y;return this.no_rot?(t.x=c,t.y=l):(c-=this.u_0,t.x=l*this.cosrot+c*this.sinrot,t.y=c*this.cosrot-l*this.sinrot),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,e.z!==void 0&&(t.z=e.z),e.m!==void 0&&(t.m=e.m),t}function Yr(e){var t,n,r,i,a,o,s,c={};if(e.x=(e.x-this.x0)*(1/this.a),e.y=(e.y-this.y0)*(1/this.a),this.no_rot?(n=e.y,t=e.x):(n=e.x*this.cosrot-e.y*this.sinrot,t=e.y*this.cosrot+e.x*this.sinrot+this.u_0),r=Math.exp(-this.BrA*n),i=.5*(r-1/r),a=.5*(r+1/r),o=Math.sin(this.BrA*t),s=(o*this.cosgam+i*this.singam)/a,Math.abs(Math.abs(s)-1)<1e-10)c.x=0,c.y=s<0?-M:M;else{if(c.y=this.E/Math.sqrt((1+s)/(1-s)),c.y=ct(this.e,c.y**(1/this.B)),c.y===1/0)throw Error();c.x=-this.rB*Math.atan2(i*this.cosgam-o*this.singam,Math.cos(this.BrA*t))}return c.x+=this.lam0,e.z!==void 0&&(c.z=e.z),e.m!==void 0&&(c.m=e.m),c}var Xr={init:qr,forward:Jr,inverse:Yr,names:[`Hotine_Oblique_Mercator`,`Hotine Oblique Mercator`,`Hotine_Oblique_Mercator_variant_A`,`Hotine_Oblique_Mercator_Variant_B`,`Hotine_Oblique_Mercator_Azimuth_Natural_Origin`,`Hotine_Oblique_Mercator_Two_Point_Natural_Origin`,`Hotine_Oblique_Mercator_Azimuth_Center`,`Oblique_Mercator`,`omerc`]};function Zr(){if(this.lat2||=this.lat1,this.k0||=1,this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,!(Math.abs(this.lat1+this.lat2)<1e-10)){var e=this.b/this.a;this.e=Math.sqrt(1-e*e);var t=Math.sin(this.lat1),n=Math.cos(this.lat1),r=at(this.e,t,n),i=st(this.e,this.lat1,t),a=Math.sin(this.lat2),o=Math.cos(this.lat2),s=at(this.e,a,o),c=st(this.e,this.lat2,a),l=st(this.e,this.lat0,Math.sin(this.lat0));this.ns=Math.abs(this.lat1-this.lat2)>1e-10?Math.log(r/s)/Math.log(i/c):t,isNaN(this.ns)&&(this.ns=t),this.f0=r/(this.ns*i**+this.ns),this.rh=Math.abs(Math.abs(this.lat0)-M)<1e-10?0:this.a*this.f0*l**+this.ns,this.title||=`Lambert Conformal Conic`}}function Qr(e){var t=e.x,n=e.y;Math.abs(2*Math.abs(n)-Math.PI)<=1e-10&&(n=ot(n)*(M-2*le));var r=Math.abs(Math.abs(n)-M),i,a;if(r>1e-10)i=st(this.e,n,Math.sin(n)),a=this.a*this.f0*i**+this.ns;else{if(r=n*this.ns,r<=0)return null;a=0}var o=this.ns*F(t-this.long0,this.over);return e.x=this.k0*(a*Math.sin(o))+this.x0,e.y=this.k0*(this.rh-a*Math.cos(o))+this.y0,e}function $r(e){var t,n,r,i,a,o=(e.x-this.x0)/this.k0,s=this.rh-(e.y-this.y0)/this.k0;this.ns>0?(t=Math.sqrt(o*o+s*s),n=1):(t=-Math.sqrt(o*o+s*s),n=-1);var c=0;if(t!==0&&(c=Math.atan2(n*o,n*s)),t!==0||this.ns>0){if(n=1/this.ns,r=(t/(this.a*this.f0))**+n,i=ct(this.e,r),i===-9999)return null}else i=-M;return a=F(c/this.ns+this.long0,this.over),e.x=a,e.y=i,e}var ei={init:Zr,forward:Qr,inverse:$r,names:[`Lambert Tangential Conformal Conic Projection`,`Lambert_Conformal_Conic`,`Lambert_Conformal_Conic_1SP`,`Lambert_Conformal_Conic_2SP`,`lcc`,`Lambert Conic Conformal (1SP)`,`Lambert Conic Conformal (2SP)`]};function ti(){this.a=6377397.155,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||=.863937979737193,this.long0||=.4334234309119251,this.k0||=.9999,this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.cos(this.fi0)**4/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)))**(this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.tan(this.fi0/2+this.s45)**+this.alfa*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.sin(this.fi0)**2),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq}function ni(e){var t,n,r,i,a,o,s,c=e.x,l=e.y,u=F(c-this.long0,this.over);return t=((1+this.e*Math.sin(l))/(1-this.e*Math.sin(l)))**(this.alfa*this.e/2),n=2*(Math.atan(this.k*Math.tan(l/2+this.s45)**+this.alfa/t)-this.s45),r=-u*this.alfa,i=Math.asin(Math.cos(this.ad)*Math.sin(n)+Math.sin(this.ad)*Math.cos(n)*Math.cos(r)),a=Math.asin(Math.cos(n)*Math.sin(r)/Math.cos(i)),o=this.n*a,s=this.ro0*Math.tan(this.s0/2+this.s45)**+this.n/Math.tan(i/2+this.s45)**+this.n,e.y=s*Math.cos(o)/1,e.x=s*Math.sin(o)/1,this.czech||(e.y*=-1,e.x*=-1),e}function ri(e){var t,n,r,i,a,o,s,c,l=e.x;e.x=e.y,e.y=l,this.czech||(e.y*=-1,e.x*=-1),o=Math.sqrt(e.x*e.x+e.y*e.y),a=Math.atan2(e.y,e.x),i=a/Math.sin(this.s0),r=2*(Math.atan((this.ro0/o)**(1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),t=Math.asin(Math.cos(this.ad)*Math.sin(r)-Math.sin(this.ad)*Math.cos(r)*Math.cos(i)),n=Math.asin(Math.cos(r)*Math.sin(i)/Math.cos(t)),e.x=this.long0-n/this.alfa,s=t,c=0;var u=0;do e.y=2*(Math.atan(this.k**(-1/this.alfa)*Math.tan(t/2+this.s45)**(1/this.alfa)*((1+this.e*Math.sin(s))/(1-this.e*Math.sin(s)))**(this.e/2))-this.s45),Math.abs(s-e.y)<1e-10&&(c=1),s=e.y,u+=1;while(c===0&&u<15);return u>=15?null:e}var ii={init:ti,forward:ni,inverse:ri,names:[`Krovak`,`Krovak Modified`,`Krovak (North Orientated)`,`Krovak Modified (North Orientated)`,`krovak`]};function ai(e,t,n,r,i){return e*i-t*Math.sin(2*i)+n*Math.sin(4*i)-r*Math.sin(6*i)}function oi(e){return 1-.25*e*(1+e/16*(3+1.25*e))}function si(e){return .375*e*(1+.25*e*(1+.46875*e))}function ci(e){return .05859375*e*e*(1+.75*e)}function li(e){return e*e*e*(35/3072)}function ui(e,t,n){var r=t*n;return e/Math.sqrt(1-r*r)}function di(e){return Math.abs(e)<M?e:e-ot(e)*Math.PI}function fi(e,t,n,r,i){for(var a=e/t,o,s=0;s<15;s++)if(o=(e-(t*a-n*Math.sin(2*a)+r*Math.sin(4*a)-i*Math.sin(6*a)))/(t-2*n*Math.cos(2*a)+4*r*Math.cos(4*a)-6*i*Math.cos(6*a)),a+=o,Math.abs(o)<=1e-10)return a;return NaN}function pi(){this.sphere||(this.e0=oi(this.es),this.e1=si(this.es),this.e2=ci(this.es),this.e3=li(this.es),this.ml0=this.a*ai(this.e0,this.e1,this.e2,this.e3,this.lat0))}function mi(e){var t,n,r=e.x,i=e.y;if(r=F(r-this.long0,this.over),this.sphere)t=this.a*Math.asin(Math.cos(i)*Math.sin(r)),n=this.a*(Math.atan2(Math.tan(i),Math.cos(r))-this.lat0);else{var a=Math.sin(i),o=Math.cos(i),s=ui(this.a,this.e,a),c=Math.tan(i)*Math.tan(i),l=r*Math.cos(i),u=l*l,d=this.es*o*o/(1-this.es),f=this.a*ai(this.e0,this.e1,this.e2,this.e3,i);t=s*l*(1-u*c*(1/6-(8-c+8*d)*u/120)),n=f-this.ml0+s*a/o*u*(.5+(5-c+6*d)*u/24)}return e.x=t+this.x0,e.y=n+this.y0,e}function hi(e){e.x-=this.x0,e.y-=this.y0;var t=e.x/this.a,n=e.y/this.a,r,i;if(this.sphere){var a=n+this.lat0;r=Math.asin(Math.sin(a)*Math.cos(t)),i=Math.atan2(Math.tan(t),Math.cos(a))}else{var o=fi(this.ml0/this.a+n,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(o)-M)<=1e-10)return e.x=this.long0,e.y=M,n<0&&(e.y*=-1),e;var s=ui(this.a,this.e,Math.sin(o)),c=s*s*s/this.a/this.a*(1-this.es),l=Math.tan(o)**2,u=t*this.a/s,d=u*u;r=o-s*Math.tan(o)/c*u*u*(.5-(1+3*l)*u*u/24),i=u*(1-d*(l/3+(1+3*l)*l*d/15))/Math.cos(o)}return e.x=F(i+this.long0,this.over),e.y=di(r),e}var gi={init:pi,forward:mi,inverse:hi,names:[`Cassini`,`Cassini_Soldner`,`cass`]};function _i(e,t){var n;return e>1e-7?(n=e*t,(1-e*e)*(t/(1-n*n)-.5/e*Math.log((1-n)/(1+n)))):2*t}var vi=.3333333333333333,yi=.17222222222222222,bi=.10257936507936508,xi=.06388888888888888,Si=.0664021164021164,Ci=.016415012942191543;function wi(e){var t,n=[];return n[0]=e*vi,t=e*e,n[0]+=t*yi,n[1]=t*xi,t*=e,n[0]+=t*bi,n[1]+=t*Si,n[2]=t*Ci,n}function Ti(e,t){var n=e+e;return e+t[0]*Math.sin(n)+t[1]*Math.sin(n+n)+t[2]*Math.sin(n+n+n)}function Ei(){var e=Math.abs(this.lat0);if(this.mode=Math.abs(e-M)<1e-10?this.lat0<0?1:2:Math.abs(e)<1e-10?3:4,this.es>0){var t;switch(this.qp=_i(this.e,1),this.mmf=.5/(1-this.es),this.apa=wi(this.es),this.mode){case 2:this.dd=1;break;case 1:this.dd=1;break;case 3:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case 4:this.rq=Math.sqrt(.5*this.qp),t=Math.sin(this.lat0),this.sinb1=_i(this.e,t)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*t*t)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd}}else this.mode===4&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))}function Di(e){var t,n,r,i,a,o,s,c,l,u,d=e.x,f=e.y;if(d=F(d-this.long0,this.over),this.sphere){if(a=Math.sin(f),u=Math.cos(f),r=Math.cos(d),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(n=this.mode===this.EQUIT?1+u*r:1+this.sinph0*a+this.cosph0*u*r,n<=1e-10)return null;n=Math.sqrt(2/n),t=n*u*Math.sin(d),n*=this.mode===this.EQUIT?a:this.cosph0*a-this.sinph0*u*r}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(r=-r),Math.abs(f+this.lat0)<1e-10)return null;n=P-f*.5,n=2*(this.mode===this.S_POLE?Math.cos(n):Math.sin(n)),t=n*Math.sin(d),n*=r}}else{switch(s=0,c=0,l=0,r=Math.cos(d),i=Math.sin(d),a=Math.sin(f),o=_i(this.e,a),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(s=o/this.qp,c=Math.sqrt(1-s*s)),this.mode){case this.OBLIQ:l=1+this.sinb1*s+this.cosb1*c*r;break;case this.EQUIT:l=1+c*r;break;case this.N_POLE:l=M+f,o=this.qp-o;break;case this.S_POLE:l=f-M,o=this.qp+o}if(Math.abs(l)<1e-10)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:l=Math.sqrt(2/l),n=this.mode===this.OBLIQ?this.ymf*l*(this.cosb1*s-this.sinb1*c*r):(l=Math.sqrt(2/(1+c*r)))*s*this.ymf,t=this.xmf*l*c*i;break;case this.N_POLE:case this.S_POLE:o>=0?(t=(l=Math.sqrt(o))*i,n=r*(this.mode===this.S_POLE?l:-l)):t=n=0}}return e.x=this.a*t+this.x0,e.y=this.a*n+this.y0,e}function Oi(e){e.x-=this.x0,e.y-=this.y0;var t=e.x/this.a,n=e.y/this.a,r,i,a,o,s,c,l;if(this.sphere){var u=0,d,f=0;if(d=Math.sqrt(t*t+n*n),i=d*.5,i>1)return null;switch(i=2*Math.asin(i),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(f=Math.sin(i),u=Math.cos(i)),this.mode){case this.EQUIT:i=Math.abs(d)<=1e-10?0:Math.asin(n*f/d),t*=f,n=u*d;break;case this.OBLIQ:i=Math.abs(d)<=1e-10?this.lat0:Math.asin(u*this.sinph0+n*f*this.cosph0/d),t*=f*this.cosph0,n=(u-Math.sin(i)*this.sinph0)*d;break;case this.N_POLE:n=-n,i=M-i;break;case this.S_POLE:i-=M}r=n===0&&(this.mode===this.EQUIT||this.mode===this.OBLIQ)?0:Math.atan2(t,n)}else{if(l=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(t/=this.dd,n*=this.dd,c=Math.sqrt(t*t+n*n),c<1e-10)return e.x=this.long0,e.y=this.lat0,e;o=2*Math.asin(.5*c/this.rq),a=Math.cos(o),t*=o=Math.sin(o),this.mode===this.OBLIQ?(l=a*this.sinb1+n*o*this.cosb1/c,s=this.qp*l,n=c*this.cosb1*a-n*this.sinb1*o):(l=n*o/c,s=this.qp*l,n=c*a)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(n=-n),s=t*t+n*n,!s)return e.x=this.long0,e.y=this.lat0,e;l=1-s/this.qp,this.mode===this.S_POLE&&(l=-l)}r=Math.atan2(t,n),i=Ti(Math.asin(l),this.apa)}return e.x=F(this.long0+r,this.over),e.y=i,e}var ki={init:Ei,forward:Di,inverse:Oi,names:[`Lambert Azimuthal Equal Area`,`Lambert_Azimuthal_Equal_Area`,`laea`],S_POLE:1,N_POLE:2,EQUIT:3,OBLIQ:4};function Ai(e){return Math.abs(e)>1&&(e=e>1?1:-1),Math.asin(e)}function ji(){Math.abs(this.lat1+this.lat2)<1e-10||(this.temp=this.b/this.a,this.es=1-this.temp**2,this.e3=Math.sqrt(this.es),this.sin_po=Math.sin(this.lat1),this.cos_po=Math.cos(this.lat1),this.t1=this.sin_po,this.con=this.sin_po,this.ms1=at(this.e3,this.sin_po,this.cos_po),this.qs1=_i(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat2),this.cos_po=Math.cos(this.lat2),this.t2=this.sin_po,this.ms2=at(this.e3,this.sin_po,this.cos_po),this.qs2=_i(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat0),this.cos_po=Math.cos(this.lat0),this.t3=this.sin_po,this.qs0=_i(this.e3,this.sin_po),this.ns0=Math.abs(this.lat1-this.lat2)>1e-10?(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)}function Mi(e){var t=e.x,n=e.y;this.sin_phi=Math.sin(n),this.cos_phi=Math.cos(n);var r=_i(this.e3,this.sin_phi),i=this.a*Math.sqrt(this.c-this.ns0*r)/this.ns0,a=this.ns0*F(t-this.long0,this.over),o=i*Math.sin(a)+this.x0,s=this.rh-i*Math.cos(a)+this.y0;return e.x=o,e.y=s,e}function Ni(e){var t,n,r,i,a,o;return e.x-=this.x0,e.y=this.rh-e.y+this.y0,this.ns0>=0?(t=Math.sqrt(e.x*e.x+e.y*e.y),r=1):(t=-Math.sqrt(e.x*e.x+e.y*e.y),r=-1),i=0,t!==0&&(i=Math.atan2(r*e.x,r*e.y)),r=t*this.ns0/this.a,this.sphere?o=Math.asin((this.c-r*r)/(2*this.ns0)):(n=(this.c-r*r)/this.ns0,o=this.phi1z(this.e3,n)),a=F(i/this.ns0+this.long0,this.over),e.x=a,e.y=o,e}function Pi(e,t){var n,r,i,a,o,s=Ai(.5*t);if(e<1e-10)return s;for(var c=e*e,l=1;l<=25;l++)if(n=Math.sin(s),r=Math.cos(s),i=e*n,a=1-i*i,o=.5*a*a/r*(t/(1-c)-n/a+.5/e*Math.log((1-i)/(1+i))),s+=o,Math.abs(o)<=1e-7)return s;return null}var Fi={init:ji,forward:Mi,inverse:Ni,names:[`Albers_Conic_Equal_Area`,`Albers_Equal_Area`,`Albers`,`aea`],phi1z:Pi};function Ii(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1}function Li(e){var t,n,r,i,a,o,s,c,l=e.x,u=e.y;return r=F(l-this.long0,this.over),t=Math.sin(u),n=Math.cos(u),i=Math.cos(r),o=this.sin_p14*t+this.cos_p14*n*i,a=1,o>0||Math.abs(o)<=1e-10?(s=this.x0+this.a*a*n*Math.sin(r)/o,c=this.y0+this.a*a*(this.cos_p14*t-this.sin_p14*n*i)/o):(s=this.x0+this.infinity_dist*n*Math.sin(r),c=this.y0+this.infinity_dist*(this.cos_p14*t-this.sin_p14*n*i)),e.x=s,e.y=c,e}function Ri(e){var t,n,r,i,a,o;return e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,e.x/=this.k0,e.y/=this.k0,(t=Math.sqrt(e.x*e.x+e.y*e.y))?(i=Math.atan2(t,this.rc),n=Math.sin(i),r=Math.cos(i),o=Ai(r*this.sin_p14+e.y*n*this.cos_p14/t),a=Math.atan2(e.x*n,t*this.cos_p14*r-e.y*this.sin_p14*n),a=F(this.long0+a,this.over)):(o=this.phic0,a=0),e.x=a,e.y=o,e}var zi={init:Ii,forward:Li,inverse:Ri,names:[`gnom`]};function Bi(e,t){var n=1-(1-e*e)/(2*e)*Math.log((1-e)/(1+e));if(Math.abs(Math.abs(t)-n)<1e-6)return t<0?-1*M:M;for(var r=Math.asin(.5*t),i,a,o,s,c=0;c<30;c++)if(a=Math.sin(r),o=Math.cos(r),s=e*a,i=(1-s*s)**2/(2*o)*(t/(1-e*e)-a/(1-s*s)+.5/e*Math.log((1-s)/(1+s))),r+=i,Math.abs(i)<=1e-10)return r;return NaN}function Vi(){this.sphere||(this.k0=at(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function Hi(e){var t=e.x,n=e.y,r,i,a=F(t-this.long0,this.over);if(this.sphere)r=this.x0+this.a*a*Math.cos(this.lat_ts),i=this.y0+this.a*Math.sin(n)/Math.cos(this.lat_ts);else{var o=_i(this.e,Math.sin(n));r=this.x0+this.a*this.k0*a,i=this.y0+this.a*o*.5/this.k0}return e.x=r,e.y=i,e}function Ui(e){e.x-=this.x0,e.y-=this.y0;var t,n;return this.sphere?(t=F(this.long0+e.x/this.a/Math.cos(this.lat_ts),this.over),n=Math.asin(e.y/this.a*Math.cos(this.lat_ts))):(n=Bi(this.e,2*e.y*this.k0/this.a),t=F(this.long0+e.x/(this.a*this.k0),this.over)),e.x=t,e.y=n,e}var Wi={init:Vi,forward:Hi,inverse:Ui,names:[`cea`]};function Gi(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||`Equidistant Cylindrical (Plate Carre)`,this.rc=Math.cos(this.lat_ts)}function Ki(e){var t=e.x,n=e.y,r=F(t-this.long0,this.over),i=di(n-this.lat0);return e.x=this.x0+this.a*r*this.rc,e.y=this.y0+this.a*i,e}function qi(e){var t=e.x,n=e.y;return e.x=F(this.long0+(t-this.x0)/(this.a*this.rc),this.over),e.y=di(this.lat0+(n-this.y0)/this.a),e}var Ji={init:Gi,forward:Ki,inverse:qi,names:[`Equirectangular`,`Equidistant_Cylindrical`,`Equidistant_Cylindrical_Spherical`,`eqc`]},Yi=20;function Xi(){this.temp=this.b/this.a,this.es=1-this.temp**2,this.e=Math.sqrt(this.es),this.e0=oi(this.es),this.e1=si(this.es),this.e2=ci(this.es),this.e3=li(this.es),this.ml0=this.a*ai(this.e0,this.e1,this.e2,this.e3,this.lat0)}function Zi(e){var t=e.x,n=e.y,r,i,a,o=F(t-this.long0,this.over);if(a=o*Math.sin(n),this.sphere)Math.abs(n)<=1e-10?(r=this.a*o,i=-1*this.a*this.lat0):(r=this.a*Math.sin(a)/Math.tan(n),i=this.a*(di(n-this.lat0)+(1-Math.cos(a))/Math.tan(n)));else if(Math.abs(n)<=1e-10)r=this.a*o,i=-1*this.ml0;else{var s=ui(this.a,this.e,Math.sin(n))/Math.tan(n);r=s*Math.sin(a),i=this.a*ai(this.e0,this.e1,this.e2,this.e3,n)-this.ml0+s*(1-Math.cos(a))}return e.x=r+this.x0,e.y=i+this.y0,e}function Qi(e){var t,n,r=e.x-this.x0,i=e.y-this.y0,a,o,s,c,l;if(this.sphere){if(Math.abs(i+this.a*this.lat0)<=1e-10)t=F(r/this.a+this.long0,this.over),n=0;else{o=this.lat0+i/this.a,s=r*r/this.a/this.a+o*o,c=o;var u;for(a=Yi;a;--a)if(u=Math.tan(c),l=-1*(o*(c*u+1)-c-.5*(c*c+s)*u)/((c-o)/u-1),c+=l,Math.abs(l)<=1e-10){n=c;break}t=F(this.long0+Math.asin(r*Math.tan(c)/this.a)/Math.sin(n),this.over)}}else if(Math.abs(i+this.ml0)<=1e-10)n=0,t=F(this.long0+r/this.a,this.over);else{o=(this.ml0+i)/this.a,s=r*r/this.a/this.a+o*o,c=o;var d,f,p,m,h;for(a=Yi;a;--a)if(h=this.e*Math.sin(c),d=Math.sqrt(1-h*h)*Math.tan(c),f=this.a*ai(this.e0,this.e1,this.e2,this.e3,c),p=this.e0-2*this.e1*Math.cos(2*c)+4*this.e2*Math.cos(4*c)-6*this.e3*Math.cos(6*c),m=f/this.a,l=(o*(d*m+1)-m-.5*d*(m*m+s))/(this.es*Math.sin(2*c)*(m*m+s-2*o*m)/(4*d)+(o-m)*(d*p-2/Math.sin(2*c))-p),c-=l,Math.abs(l)<=1e-10){n=c;break}d=Math.sqrt(1-this.es*Math.sin(n)**2)*Math.tan(n),t=F(this.long0+Math.asin(r*d/this.a)/Math.sin(n),this.over)}return e.x=t,e.y=n,e}var $i={init:Xi,forward:Zi,inverse:Qi,names:[`Polyconic`,`American_Polyconic`,`poly`]};function ea(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013}function ta(e){var t,n=e.x,r=e.y-this.lat0,i=n-this.long0,a=r/ae*1e-5,o=i,s=1,c=0;for(t=1;t<=10;t++)s*=a,c+=this.A[t]*s;var l=c,u=o,d=1,f=0,p,m,h=0,g=0;for(t=1;t<=6;t++)p=d*l-f*u,m=f*l+d*u,d=p,f=m,h=h+this.B_re[t]*d-this.B_im[t]*f,g=g+this.B_im[t]*d+this.B_re[t]*f;return e.x=g*this.a+this.x0,e.y=h*this.a+this.y0,e}function na(e){var t,n=e.x,r=e.y,i=n-this.x0,a=(r-this.y0)/this.a,o=i/this.a,s=1,c=0,l,u,d=0,f=0;for(t=1;t<=6;t++)l=s*a-c*o,u=c*a+s*o,s=l,c=u,d=d+this.C_re[t]*s-this.C_im[t]*c,f=f+this.C_im[t]*s+this.C_re[t]*c;for(var p=0;p<this.iterations;p++){var m=d,h=f,g,_,v=a,y=o;for(t=2;t<=6;t++)g=m*d-h*f,_=h*d+m*f,m=g,h=_,v+=(t-1)*(this.B_re[t]*m-this.B_im[t]*h),y+=(t-1)*(this.B_im[t]*m+this.B_re[t]*h);m=1,h=0;var b=this.B_re[1],x=this.B_im[1];for(t=2;t<=6;t++)g=m*d-h*f,_=h*d+m*f,m=g,h=_,b+=t*(this.B_re[t]*m-this.B_im[t]*h),x+=t*(this.B_im[t]*m+this.B_re[t]*h);var S=b*b+x*x;d=(v*b+y*x)/S,f=(y*b-v*x)/S}var C=d,w=f,T=1,E=0;for(t=1;t<=9;t++)T*=C,E+=this.D[t]*T;var D=this.lat0+E*ae*1e5;return e.x=this.long0+w,e.y=D,e}var ra={init:ea,forward:ta,inverse:na,names:[`New_Zealand_Map_Grid`,`nzmg`],iterations:1};function ia(){}function aa(e){var t=e.x,n=e.y,r=F(t-this.long0,this.over),i=this.x0+this.a*r,a=this.y0+this.a*Math.log(Math.tan(Math.PI/4+n/2.5))*1.25;return e.x=i,e.y=a,e}function oa(e){e.x-=this.x0,e.y-=this.y0;var t=F(this.long0+e.x/this.a,this.over),n=2.5*(Math.atan(Math.exp(.8*e.y/this.a))-Math.PI/4);return e.x=t,e.y=n,e}var sa={init:ia,forward:aa,inverse:oa,names:[`Miller_Cylindrical`,`mill`]},ca=20;function la(){this.long0=this.long0||0,this.sphere?(this.n=1,this.m=0,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)):this.en=nr(this.es)}function ua(e){var t,n,r=e.x,i=e.y;if(r=F(r-this.long0,this.over),this.sphere){if(!this.m)i=this.n===1?i:Math.asin(this.n*Math.sin(i));else for(var a=this.n*Math.sin(i),o=ca;o;--o){var s=(this.m*i+Math.sin(i)-a)/(this.m+Math.cos(i));if(i-=s,Math.abs(s)<1e-10)break}t=this.a*this.C_x*r*(this.m+Math.cos(i)),n=this.a*this.C_y*i}else{var c=Math.sin(i),l=Math.cos(i);n=this.a*rr(i,c,l,this.en),t=this.a*r*l/Math.sqrt(1-this.es*c*c)}return e.x=t,e.y=n,e}function da(e){var t,n,r,i;return e.x-=this.x0,r=e.x/this.a,e.y-=this.y0,t=e.y/this.a,this.sphere?(t/=this.C_y,r/=this.C_x*(this.m+Math.cos(t)),this.m?t=Ai((this.m*t+Math.sin(t))/this.n):this.n!==1&&(t=Ai(Math.sin(t)/this.n)),r=F(r+this.long0,this.over),t=di(t)):(t=ar(e.y/this.a,this.es,this.en),i=Math.abs(t),i<M?(i=Math.sin(t),n=this.long0+e.x*Math.sqrt(1-this.es*i*i)/(this.a*Math.cos(t)),r=F(n,this.over)):i-1e-10<M&&(r=this.long0)),e.x=r,e.y=t,e}var fa={init:la,forward:ua,inverse:da,names:[`Sinusoidal`,`sinu`]};function pa(){this.sphere=!0,this.b=this.a,this.m=1,this.n=2.5707963267948966,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)}var ma={init:pa,forward:ua,inverse:da,names:[`Eckert_VI`,`eck6`]};function ha(){this.x0=this.x0===void 0?0:this.x0,this.y0=this.y0===void 0?0:this.y0,this.long0=this.long0===void 0?0:this.long0}function ga(e){for(var t=e.x,n=e.y,r=F(t-this.long0,this.over),i=n,a=Math.PI*Math.sin(n);;){var o=-(i+Math.sin(i)-a)/(1+Math.cos(i));if(i+=o,Math.abs(o)<1e-10)break}i/=2,Math.PI/2-Math.abs(n)<1e-10&&(r=0);var s=.900316316158*this.a*r*Math.cos(i)+this.x0,c=1.4142135623731*this.a*Math.sin(i)+this.y0;return e.x=s,e.y=c,e}function _a(e){var t,n;e.x-=this.x0,e.y-=this.y0,n=e.y/(1.4142135623731*this.a),Math.abs(n)>.999999999999&&(n=.999999999999),t=Math.asin(n);var r=F(this.long0+e.x/(.900316316158*this.a*Math.cos(t)),this.over);r<-Math.PI&&(r=-Math.PI),r>Math.PI&&(r=Math.PI),n=(2*t+Math.sin(2*t))/Math.PI,Math.abs(n)>1&&(n=1);var i=Math.asin(n);return e.x=r,e.y=i,e}var va={init:ha,forward:ga,inverse:_a,names:[`Mollweide`,`moll`]};function ya(){Math.abs(this.lat1+this.lat2)<1e-10||(this.lat2=this.lat2||this.lat1,this.temp=this.b/this.a,this.es=1-this.temp**2,this.e=Math.sqrt(this.es),this.e0=oi(this.es),this.e1=si(this.es),this.e2=ci(this.es),this.e3=li(this.es),this.sin_phi=Math.sin(this.lat1),this.cos_phi=Math.cos(this.lat1),this.ms1=at(this.e,this.sin_phi,this.cos_phi),this.ml1=ai(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<1e-10?this.ns=this.sin_phi:(this.sin_phi=Math.sin(this.lat2),this.cos_phi=Math.cos(this.lat2),this.ms2=at(this.e,this.sin_phi,this.cos_phi),this.ml2=ai(this.e0,this.e1,this.e2,this.e3,this.lat2),this.ns=(this.ms1-this.ms2)/(this.ml2-this.ml1)),this.g=this.ml1+this.ms1/this.ns,this.ml0=ai(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))}function ba(e){var t=e.x,n=e.y,r;if(this.sphere)r=this.a*(this.g-n);else{var i=ai(this.e0,this.e1,this.e2,this.e3,n);r=this.a*(this.g-i)}var a=this.ns*F(t-this.long0,this.over),o=this.x0+r*Math.sin(a),s=this.y0+this.rh-r*Math.cos(a);return e.x=o,e.y=s,e}function xa(e){e.x-=this.x0,e.y=this.rh-e.y+this.y0;var t,n,r,i;this.ns>=0?(n=Math.sqrt(e.x*e.x+e.y*e.y),t=1):(n=-Math.sqrt(e.x*e.x+e.y*e.y),t=-1);var a=0;return n!==0&&(a=Math.atan2(t*e.x,t*e.y)),this.sphere?(i=F(this.long0+a/this.ns,this.over),r=di(this.g-n/this.a),e.x=i,e.y=r,e):(r=fi(this.g-n/this.a,this.e0,this.e1,this.e2,this.e3),i=F(this.long0+a/this.ns,this.over),e.x=i,e.y=r,e)}var Sa={init:ya,forward:ba,inverse:xa,names:[`Equidistant_Conic`,`eqdc`]};function Ca(){this.R=this.a}function wa(e){var t=e.x,n=e.y,r=F(t-this.long0,this.over),i,a;if(Math.abs(n)<=1e-10)return i=this.x0+this.R*r,a=this.y0,e.x=i,e.y=a,e;var o=Ai(2*Math.abs(n/Math.PI));if(Math.abs(r)<=1e-10||Math.abs(Math.abs(n)-M)<=1e-10)return i=this.x0,a=n>=0?this.y0+Math.PI*this.R*Math.tan(.5*o):this.y0+Math.PI*this.R*-Math.tan(.5*o),e.x=i,e.y=a,e;var s=.5*Math.abs(Math.PI/r-r/Math.PI),c=s*s,l=Math.sin(o),u=Math.cos(o),d=u/(l+u-1),f=d*d,p=d*(2/l-1),m=p*p,h=Math.PI*this.R*(s*(d-m)+Math.sqrt(c*(d-m)*(d-m)-(m+c)*(f-m)))/(m+c);r<0&&(h=-h),i=this.x0+h;var g=c+d;return h=Math.PI*this.R*(p*g-s*Math.sqrt((m+c)*(c+1)-g*g))/(m+c),a=n>=0?this.y0+h:this.y0-h,e.x=i,e.y=a,e}function Ta(e){var t,n,r,i,a,o,s,c,l,u,d,f,p;return e.x-=this.x0,e.y-=this.y0,d=Math.PI*this.R,r=e.x/d,i=e.y/d,a=r*r+i*i,o=-Math.abs(i)*(1+a),s=o-2*i*i+r*r,c=-2*o+1+2*i*i+a*a,p=i*i/c+(2*s*s*s/c/c/c-9*o*s/c/c)/27,l=(o-s*s/3/c)/c,u=2*Math.sqrt(-l/3),d=3*p/l/u,Math.abs(d)>1&&(d=d>=0?1:-1),f=Math.acos(d)/3,n=e.y>=0?(-u*Math.cos(f+Math.PI/3)-s/3/c)*Math.PI:-(-u*Math.cos(f+Math.PI/3)-s/3/c)*Math.PI,t=Math.abs(r)<1e-10?this.long0:F(this.long0+Math.PI*(a-1+Math.sqrt(1+2*(r*r-i*i)+a*a))/2/r,this.over),e.x=t,e.y=n,e}var Ea={init:Ca,forward:wa,inverse:Ta,names:[`Van_der_Grinten_I`,`VanDerGrinten`,`Van_der_Grinten`,`vandg`]};function Da(e,t,n,r,i,a){let o=r-t,s=Math.atan((1-a)*Math.tan(e)),c=Math.atan((1-a)*Math.tan(n)),l=Math.sin(s),u=Math.cos(s),d=Math.sin(c),f=Math.cos(c),p=o,m,h=100,g,_,v,y,b,x,S,C,w,T,E,D,O,k;do{if(g=Math.sin(p),_=Math.cos(p),v=Math.sqrt(f*g*(f*g)+(u*d-l*f*_)*(u*d-l*f*_)),v===0)return{azi1:0,s12:0};y=l*d+u*f*_,b=Math.atan2(v,y),x=u*f*g/v,S=1-x*x,C=S===0?0:y-2*l*d/S,w=a/16*S*(4+a*(4-3*S)),m=p,p=o+(1-w)*a*x*(b+w*v*(C+w*y*(-1+2*C*C)))}while(Math.abs(p-m)>1e-12&&--h>0);return h===0?{azi1:NaN,s12:NaN}:(T=S*(i*i-i*(1-a)*(i*(1-a)))/(i*(1-a)*(i*(1-a))),E=1+T/16384*(4096+T*(-768+T*(320-175*T))),D=T/1024*(256+T*(-128+T*(74-47*T))),O=D*v*(C+D/4*(y*(-1+2*C*C)-D/6*C*(-3+4*v*v)*(-3+4*C*C))),k=i*(1-a)*E*(b-O),{azi1:Math.atan2(f*g,u*d-l*f*_),s12:k})}function Oa(e,t,n,r,i,a){let o=Math.atan((1-a)*Math.tan(e)),s=Math.sin(o),c=Math.cos(o),l=Math.sin(n),u=Math.cos(n),d=Math.atan2(s,c*u),f=c*l,p=1-f*f,m=p*(i*i-i*(1-a)*(i*(1-a)))/(i*(1-a)*(i*(1-a))),h=1+m/16384*(4096+m*(-768+m*(320-175*m))),g=m/1024*(256+m*(-128+m*(74-47*m))),_=r/(i*(1-a)*h),v,y=100,b,x,S,C;do b=Math.cos(2*d+_),x=Math.sin(_),S=Math.cos(_),C=g*x*(b+g/4*(S*(-1+2*b*b)-g/6*b*(-3+4*x*x)*(-3+4*b*b))),v=_,_=r/(i*(1-a)*h)+C;while(Math.abs(_-v)>1e-12&&--y>0);if(y===0)return{lat2:NaN,lon2:NaN};let w=s*x-c*S*u,T=Math.atan2(s*S+c*x*u,(1-a)*Math.sqrt(f*f+w*w)),E=Math.atan2(x*l,c*S-s*x*u),D=a/16*p*(4+a*(4-3*p));return{lat2:T,lon2:t+(E-(1-D)*a*f*(_+D*x*(b+D*S*(-1+2*b*b))))}}function ka(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0),this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.f=this.es/(1+Math.sqrt(1-this.es))}function Aa(e){var t=e.x,n=e.y,r=Math.sin(e.y),i=Math.cos(e.y),a=F(t-this.long0,this.over),o,s,c,l,u,d,f,p,m,h,g;return this.sphere?Math.abs(this.sin_p12-1)<=1e-10?(e.x=this.x0+this.a*(M-n)*Math.sin(a),e.y=this.y0-this.a*(M-n)*Math.cos(a),e):Math.abs(this.sin_p12+1)<=1e-10?(e.x=this.x0+this.a*(M+n)*Math.sin(a),e.y=this.y0+this.a*(M+n)*Math.cos(a),e):(m=this.sin_p12*r+this.cos_p12*i*Math.cos(a),f=Math.acos(m),p=f?f/Math.sin(f):1,e.x=this.x0+this.a*p*i*Math.sin(a),e.y=this.y0+this.a*p*(this.cos_p12*r-this.sin_p12*i*Math.cos(a)),e):(o=oi(this.es),s=si(this.es),c=ci(this.es),l=li(this.es),Math.abs(this.sin_p12-1)<=1e-10?(u=this.a*ai(o,s,c,l,M),d=this.a*ai(o,s,c,l,n),e.x=this.x0+(u-d)*Math.sin(a),e.y=this.y0-(u-d)*Math.cos(a),e):Math.abs(this.sin_p12+1)<=1e-10?(u=this.a*ai(o,s,c,l,M),d=this.a*ai(o,s,c,l,n),e.x=this.x0+(u+d)*Math.sin(a),e.y=this.y0+(u+d)*Math.cos(a),e):Math.abs(t)<1e-10&&Math.abs(n-this.lat0)<1e-10?(e.x=this.x0,e.y=this.y0,e):(h=Da(this.lat0,this.long0,n,t,this.a,this.f),g=h.azi1,e.x=this.x0+h.s12*Math.sin(g),e.y=this.y0+h.s12*Math.cos(g),e))}function ja(e){e.x-=this.x0,e.y-=this.y0;var t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g;return this.sphere?(t=Math.sqrt(e.x*e.x+e.y*e.y),t>2*M*this.a?void 0:(n=t/this.a,r=Math.sin(n),i=Math.cos(n),a=this.long0,Math.abs(t)<=1e-10?o=this.lat0:(o=Ai(i*this.sin_p12+e.y*r*this.cos_p12/t),s=Math.abs(this.lat0)-M,a=Math.abs(s)<=1e-10?this.lat0>=0?F(this.long0+Math.atan2(e.x,-e.y),this.over):F(this.long0-Math.atan2(-e.x,e.y),this.over):F(this.long0+Math.atan2(e.x*r,t*this.cos_p12*i-e.y*this.sin_p12*r),this.over)),e.x=a,e.y=o,e)):(c=oi(this.es),l=si(this.es),u=ci(this.es),d=li(this.es),Math.abs(this.sin_p12-1)<=1e-10?(f=this.a*ai(c,l,u,d,M),t=Math.sqrt(e.x*e.x+e.y*e.y),p=f-t,o=fi(p/this.a,c,l,u,d),a=F(this.long0+Math.atan2(e.x,-1*e.y),this.over),e.x=a,e.y=o,e):Math.abs(this.sin_p12+1)<=1e-10?(f=this.a*ai(c,l,u,d,M),t=Math.sqrt(e.x*e.x+e.y*e.y),p=t-f,o=fi(p/this.a,c,l,u,d),a=F(this.long0+Math.atan2(e.x,e.y),this.over),e.x=a,e.y=o,e):(m=Math.atan2(e.x,e.y),h=Math.sqrt(e.x*e.x+e.y*e.y),g=Oa(this.lat0,this.long0,m,h,this.a,this.f),e.x=g.lon2,e.y=g.lat2,e))}var Ma={init:ka,forward:Aa,inverse:ja,names:[`Azimuthal_Equidistant`,`aeqd`]};function Na(){this.sin_p14=Math.sin(this.lat0||0),this.cos_p14=Math.cos(this.lat0||0)}function Pa(e){var t,n,r,i,a,o,s,c,l=e.x,u=e.y;return r=F(l-(this.long0||0),this.over),t=Math.sin(u),n=Math.cos(u),i=Math.cos(r),o=this.sin_p14*t+this.cos_p14*n*i,a=1,(o>0||Math.abs(o)<=1e-10)&&(s=(this.x0||0)+this.a*a*n*Math.sin(r),c=(this.y0||0)+this.a*a*(this.cos_p14*t-this.sin_p14*n*i)),e.x=s,e.y=c,e}function Fa(e){var t,n,r,i,a,o,s,c,l;return e.x-=this.x0||0,e.y-=this.y0||0,t=Math.sqrt(e.x*e.x+e.y*e.y),n=Ai(t/this.a),r=Math.sin(n),i=Math.cos(n),c=this.long0||0,l=this.lat0||0,o=c,Math.abs(t)<=1e-10?(s=l,e.x=o,e.y=s,e):(s=Ai(i*this.sin_p14+e.y*r*this.cos_p14/t),a=Math.abs(l)-M,Math.abs(a)<=1e-10?(o=F(l>=0?c+Math.atan2(e.x,-e.y):c-Math.atan2(-e.x,e.y),this.over),e.x=o,e.y=s,e):(o=F(c+Math.atan2(e.x*r,t*this.cos_p14*i-e.y*this.sin_p14*r),this.over),e.x=o,e.y=s,e))}var Ia={init:Na,forward:Pa,inverse:Fa,names:[`ortho`]},La={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},I={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function Ra(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||`Quadrilateralized Spherical Cube`,this.face=this.lat0>=M-P/2?La.TOP:this.lat0<=-(M-P/2)?La.BOTTOM:Math.abs(this.long0)<=P?La.FRONT:Math.abs(this.long0)<=M+P?this.long0>0?La.RIGHT:La.LEFT:La.BACK,this.es!==0&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)}function za(e){var t={x:0,y:0},n,r,i,a,o,s,c={value:0};if(e.x-=this.long0,n=this.es===0?e.y:Math.atan(this.one_minus_f_squared*Math.tan(e.y)),r=e.x,this.face===La.TOP)a=M-n,r>=P&&r<=M+P?(c.value=I.AREA_0,i=r-M):r>M+P||r<=-(M+P)?(c.value=I.AREA_1,i=r>0?r-fe:r+fe):r>-(M+P)&&r<=-P?(c.value=I.AREA_2,i=r+M):(c.value=I.AREA_3,i=r);else if(this.face===La.BOTTOM)a=M+n,r>=P&&r<=M+P?(c.value=I.AREA_0,i=-r+M):r<P&&r>=-P?(c.value=I.AREA_1,i=-r):r<-P&&r>=-(M+P)?(c.value=I.AREA_2,i=-r-M):(c.value=I.AREA_3,i=r>0?-r+fe:-r-fe);else{var l,u,d,f,p,m,h;this.face===La.RIGHT?r=Ha(r,+M):this.face===La.BACK?r=Ha(r,+fe):this.face===La.LEFT&&(r=Ha(r,-M)),f=Math.sin(n),p=Math.cos(n),m=Math.sin(r),h=Math.cos(r),l=p*h,u=p*m,d=f,this.face===La.FRONT?(a=Math.acos(l),i=Va(a,d,u,c)):this.face===La.RIGHT?(a=Math.acos(u),i=Va(a,d,-l,c)):this.face===La.BACK?(a=Math.acos(-l),i=Va(a,d,-u,c)):this.face===La.LEFT?(a=Math.acos(-u),i=Va(a,d,l,c)):(a=i=0,c.value=I.AREA_0)}return s=Math.atan(12/fe*(i+Math.acos(Math.sin(i)*Math.cos(P))-M)),o=Math.sqrt((1-Math.cos(a))/(Math.cos(s)*Math.cos(s))/(1-Math.cos(Math.atan(1/Math.cos(i))))),c.value===I.AREA_1?s+=M:c.value===I.AREA_2?s+=fe:c.value===I.AREA_3&&(s+=1.5*fe),t.x=o*Math.cos(s),t.y=o*Math.sin(s),t.x=t.x*this.a+this.x0,t.y=t.y*this.a+this.y0,e.x=t.x,e.y=t.y,e}function Ba(e){var t={lam:0,phi:0},n,r,i,a,o,s,c,l,u,d={value:0};if(e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,r=Math.atan(Math.sqrt(e.x*e.x+e.y*e.y)),n=Math.atan2(e.y,e.x),e.x>=0&&e.x>=Math.abs(e.y)?d.value=I.AREA_0:e.y>=0&&e.y>=Math.abs(e.x)?(d.value=I.AREA_1,n-=M):e.x<0&&-e.x>=Math.abs(e.y)?(d.value=I.AREA_2,n=n<0?n+fe:n-fe):(d.value=I.AREA_3,n+=M),u=fe/12*Math.tan(n),o=Math.sin(u)/(Math.cos(u)-1/Math.sqrt(2)),s=Math.atan(o),i=Math.cos(n),a=Math.tan(r),c=1-i*i*a*a*(1-Math.cos(Math.atan(1/Math.cos(s)))),c<-1?c=-1:c>1&&(c=1),this.face===La.TOP)l=Math.acos(c),t.phi=M-l,t.lam=d.value===I.AREA_0?s+M:d.value===I.AREA_1?s<0?s+fe:s-fe:d.value===I.AREA_2?s-M:s;else if(this.face===La.BOTTOM)l=Math.acos(c),t.phi=l-M,t.lam=d.value===I.AREA_0?-s+M:d.value===I.AREA_1?-s:d.value===I.AREA_2?-s-M:s<0?-s-fe:-s+fe;else{var f=c,p,m;u=f*f,m=u>=1?0:Math.sqrt(1-u)*Math.sin(s),u+=m*m,p=u>=1?0:Math.sqrt(1-u),d.value===I.AREA_1?(u=p,p=-m,m=u):d.value===I.AREA_2?(p=-p,m=-m):d.value===I.AREA_3&&(u=p,p=m,m=-u),this.face===La.RIGHT?(u=f,f=-p,p=u):this.face===La.BACK?(f=-f,p=-p):this.face===La.LEFT&&(u=f,f=p,p=-u),t.phi=Math.acos(-m)-M,t.lam=Math.atan2(p,f),this.face===La.RIGHT?t.lam=Ha(t.lam,-M):this.face===La.BACK?t.lam=Ha(t.lam,-fe):this.face===La.LEFT&&(t.lam=Ha(t.lam,+M))}if(this.es!==0){var h=+(t.phi<0),g=Math.tan(t.phi),_=this.b/Math.sqrt(g*g+this.one_minus_f_squared);t.phi=Math.atan(Math.sqrt(this.a*this.a-_*_)/(this.one_minus_f*_)),h&&(t.phi=-t.phi)}return t.lam+=this.long0,e.x=t.lam,e.y=t.phi,e}function Va(e,t,n,r){var i;return e<1e-10?(r.value=I.AREA_0,i=0):(i=Math.atan2(t,n),Math.abs(i)<=P?r.value=I.AREA_0:i>P&&i<=M+P?(r.value=I.AREA_1,i-=M):i>M+P||i<=-(M+P)?(r.value=I.AREA_2,i=i>=0?i-fe:i+fe):(r.value=I.AREA_3,i+=M)),i}function Ha(e,t){var n=e+t;return n<-3.14159265359?n+=de:n>3.14159265359&&(n-=de),n}var Ua={init:Ra,forward:za,inverse:Ba,names:[`Quadrilateralized Spherical Cube`,`Quadrilateralized_Spherical_Cube`,`qsc`]},Wa=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-9.86701e-7],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,1.8736e-8],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,9.34959e-7],[.7986,-.00755338,-500009e-10,9.35324e-7],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],Ga=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-1.26793e-9,422642e-15],[.124,.0124,5.07171e-9,-1.60604e-9],[.186,.0123999,-1.90189e-8,6.00152e-9],[.248,.0124002,7.10039e-8,-2.24e-8],[.31,.0123992,-2.64997e-7,8.35986e-8],[.372,.0124029,9.88983e-7,-3.11994e-7],[.434,.0123893,-369093e-11,-4.35621e-7],[.4958,.0123198,-102252e-10,-3.45523e-7],[.5571,.0121916,-154081e-10,-5.82288e-7],[.6176,.0119938,-241424e-10,-5.25327e-7],[.6769,.011713,-320223e-10,-5.16405e-7],[.7346,.0113541,-397684e-10,-6.09052e-7],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-1.40374e-9],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],Ka=.8487,qa=1.3523,Ja=ue/5,Ya=1/Ja,Xa=18,Za=function(e,t){return e[0]+t*(e[1]+t*(e[2]+t*e[3]))},Qa=function(e,t){return e[1]+t*(2*e[2]+t*3*e[3])};function $a(e,t,n,r){for(var i=t;r;--r){var a=e(i);if(i-=a,Math.abs(a)<n)break}return i}function eo(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||`Robinson`}function to(e){var t=F(e.x-this.long0,this.over),n=Math.abs(e.y),r=Math.floor(n*Ja);r<0?r=0:r>=Xa&&(r=Xa-1),n=ue*(n-Ya*r);var i={x:Za(Wa[r],n)*t,y:Za(Ga[r],n)};return e.y<0&&(i.y=-i.y),i.x=i.x*this.a*Ka+this.x0,i.y=i.y*this.a*qa+this.y0,e.z!==void 0&&(i.z=e.z),e.m!==void 0&&(i.m=e.m),i}function no(e){var t={x:(e.x-this.x0)/(this.a*Ka),y:Math.abs(e.y-this.y0)/(this.a*qa)};if(t.y>=1)t.x/=Wa[Xa][0],t.y=e.y<0?-M:M;else{var n=Math.floor(t.y*Xa);for(n<0?n=0:n>=Xa&&(n=Xa-1);;)if(Ga[n][0]>t.y)--n;else if(Ga[n+1][0]<=t.y)++n;else break;var r=Ga[n],i=5*(t.y-r[0])/(Ga[n+1][0]-r[0]);i=$a(function(e){return(Za(r,e)-t.y)/Qa(r,e)},i,le,100),t.x/=Za(Wa[n],i),t.y=(5*n+i)*N,e.y<0&&(t.y=-t.y)}return t.x=F(t.x+this.long0,this.over),e.z!==void 0&&(t.z=e.z),e.m!==void 0&&(t.m=e.m),t}var ro={init:eo,forward:to,inverse:no,names:[`Robinson`,`robin`]};function io(){this.name=`geocent`}function ao(e){return Yt(e,this.es,this.a)}function oo(e){return Xt(e,this.es,this.a,this.b)}var so={init:io,forward:ao,inverse:oo,names:[`Geocentric`,`geocentric`,`geocent`,`Geocent`]},co={N_POLE:0,S_POLE:1,EQUIT:2,OBLIQ:3},lo={h:{def:1e5,num:!0},azi:{def:0,num:!0,degrees:!0},tilt:{def:0,num:!0,degrees:!0},long0:{def:0,num:!0},lat0:{def:0,num:!0}};function uo(){if(Object.keys(lo).forEach(function(e){if(this[e]===void 0)this[e]=lo[e].def;else if(lo[e].num&&isNaN(this[e]))throw Error(`Invalid parameter value, must be numeric `+e+` = `+this[e]);else lo[e].num&&(this[e]=parseFloat(this[e]));lo[e].degrees&&(this[e]=this[e]*N)}.bind(this)),Math.abs(Math.abs(this.lat0)-M)<1e-10?this.mode=this.lat0<0?co.S_POLE:co.N_POLE:Math.abs(this.lat0)<1e-10?this.mode=co.EQUIT:(this.mode=co.OBLIQ,this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0)),this.pn1=this.h/this.a,this.pn1<=0||this.pn1>1e10)throw Error(`Invalid height`);this.p=1+this.pn1,this.rp=1/this.p,this.h1=1/this.pn1,this.pfact=(this.p+1)*this.h1,this.es=0;var e=this.tilt,t=this.azi;this.cg=Math.cos(t),this.sg=Math.sin(t),this.cw=Math.cos(e),this.sw=Math.sin(e)}function fo(e){e.x-=this.long0;var t=Math.sin(e.y),n=Math.cos(e.y),r=Math.cos(e.x),i,a;switch(this.mode){case co.OBLIQ:a=this.sinph0*t+this.cosph0*n*r;break;case co.EQUIT:a=n*r;break;case co.S_POLE:a=-t;break;case co.N_POLE:a=t}switch(a=this.pn1/(this.p-a),i=a*n*Math.sin(e.x),this.mode){case co.OBLIQ:a*=this.cosph0*t-this.sinph0*n*r;break;case co.EQUIT:a*=t;break;case co.N_POLE:a*=-(n*r);break;case co.S_POLE:a*=n*r}var o=a*this.cg+i*this.sg,s=1/(o*this.sw*this.h1+this.cw);return i=(i*this.cg-a*this.sg)*this.cw*s,a=o*s,e.x=i*this.a,e.y=a*this.a,e}function po(e){e.x/=this.a,e.y/=this.a;var t={x:e.x,y:e.y},n,r,i=1/(this.pn1-e.y*this.sw);n=this.pn1*e.x*i,r=this.pn1*e.y*this.cw*i,e.x=n*this.cg+r*this.sg,e.y=r*this.cg-n*this.sg;var a=dr(e.x,e.y);if(Math.abs(a)<1e-10)t.x=0,t.y=e.y;else{var o,s=1-a*a*this.pfact;switch(s=(this.p-Math.sqrt(s))/(this.pn1/a+a/this.pn1),o=Math.sqrt(1-s*s),this.mode){case co.OBLIQ:t.y=Math.asin(o*this.sinph0+e.y*s*this.cosph0/a),e.y=(o-this.sinph0*Math.sin(t.y))*a,e.x*=s*this.cosph0;break;case co.EQUIT:t.y=Math.asin(e.y*s/a),e.y=o*a,e.x*=s;break;case co.N_POLE:t.y=Math.asin(o),e.y=-e.y;break;case co.S_POLE:t.y=-Math.asin(o)}t.x=Math.atan2(e.x,e.y)}return e.x=t.x+this.long0,e.y=t.y,e}var mo={init:uo,forward:fo,inverse:po,names:[`Tilted_Perspective`,`tpers`]};function ho(){if(this.flip_axis=+(this.sweep===`x`),this.h=Number(this.h),this.radius_g_1=this.h/this.a,this.radius_g_1<=0||this.radius_g_1>1e10)throw Error();if(this.radius_g=1+this.radius_g_1,this.C=this.radius_g*this.radius_g-1,this.es!==0){var e=1-this.es,t=1/e;this.radius_p=Math.sqrt(e),this.radius_p2=e,this.radius_p_inv2=t,this.shape=`ellipse`}else this.radius_p=1,this.radius_p2=1,this.radius_p_inv2=1,this.shape=`sphere`;this.title||=`Geostationary Satellite View`}function go(e){var t=e.x,n=e.y,r,i,a,o;if(t-=this.long0,this.shape===`ellipse`){n=Math.atan(this.radius_p2*Math.tan(n));var s=this.radius_p/dr(this.radius_p*Math.cos(n),Math.sin(n));if(i=s*Math.cos(t)*Math.cos(n),a=s*Math.sin(t)*Math.cos(n),o=s*Math.sin(n),(this.radius_g-i)*i-a*a-o*o*this.radius_p_inv2<0)return e.x=NaN,e.y=NaN,e;r=this.radius_g-i,this.flip_axis?(e.x=this.radius_g_1*Math.atan(a/dr(o,r)),e.y=this.radius_g_1*Math.atan(o/r)):(e.x=this.radius_g_1*Math.atan(a/r),e.y=this.radius_g_1*Math.atan(o/dr(a,r)))}else this.shape===`sphere`&&(r=Math.cos(n),i=Math.cos(t)*r,a=Math.sin(t)*r,o=Math.sin(n),r=this.radius_g-i,this.flip_axis?(e.x=this.radius_g_1*Math.atan(a/dr(o,r)),e.y=this.radius_g_1*Math.atan(o/r)):(e.x=this.radius_g_1*Math.atan(a/r),e.y=this.radius_g_1*Math.atan(o/dr(a,r))));return e.x*=this.a,e.y*=this.a,e}function _o(e){var t=-1,n=0,r=0,i,a,o,s;if(e.x/=this.a,e.y/=this.a,this.shape===`ellipse`){this.flip_axis?(r=Math.tan(e.y/this.radius_g_1),n=Math.tan(e.x/this.radius_g_1)*dr(1,r)):(n=Math.tan(e.x/this.radius_g_1),r=Math.tan(e.y/this.radius_g_1)*dr(1,n));var c=r/this.radius_p;if(i=n*n+c*c+t*t,a=2*this.radius_g*t,o=a*a-4*i*this.C,o<0)return e.x=NaN,e.y=NaN,e;s=(-a-Math.sqrt(o))/(2*i),t=this.radius_g+s*t,n*=s,r*=s,e.x=Math.atan2(n,t),e.y=Math.atan(r*Math.cos(e.x)/t),e.y=Math.atan(this.radius_p_inv2*Math.tan(e.y))}else if(this.shape===`sphere`){if(this.flip_axis?(r=Math.tan(e.y/this.radius_g_1),n=Math.tan(e.x/this.radius_g_1)*Math.sqrt(1+r*r)):(n=Math.tan(e.x/this.radius_g_1),r=Math.tan(e.y/this.radius_g_1)*Math.sqrt(1+n*n)),i=n*n+r*r+t*t,a=2*this.radius_g*t,o=a*a-4*i*this.C,o<0)return e.x=NaN,e.y=NaN,e;s=(-a-Math.sqrt(o))/(2*i),t=this.radius_g+s*t,n*=s,r*=s,e.x=Math.atan2(n,t),e.y=Math.atan(r*Math.cos(e.x)/t)}return e.x+=this.long0,e}var vo={init:ho,forward:go,inverse:_o,names:[`Geostationary Satellite View`,`Geostationary_Satellite`,`geos`]},yo=1.340264,bo=-.081106,xo=893e-6,So=.003796,Co=Math.sqrt(3)/2;function wo(){this.long0=this.long0===void 0?0:this.long0,this.x0=this.x0===void 0?0:this.x0,this.y0=this.y0===void 0?0:this.y0,this.es!==0&&(this.apa=wi(this.es),this.qp=_i(this.e,1),this.rqda=Math.sqrt(.5*this.qp))}function To(e){var t=F(e.x-this.long0,this.over),n=e.y,r=Math.sin(n);this.es!==0&&(r=_i(this.e,r)/this.qp);var i=Math.asin(Co*r),a=i*i,o=a*a*a;return e.x=t*Math.cos(i)/(Co*(yo+3*bo*a+o*(7*xo+9*So*a))),e.y=i*(yo+bo*a+o*(xo+So*a)),this.es!==0&&(e.x*=this.rqda,e.y*=this.rqda),e.x=this.a*e.x+this.x0,e.y=this.a*e.y+this.y0,e}function Eo(e){e.x=(e.x-this.x0)/this.a,e.y=(e.y-this.y0)/this.a,this.es!==0&&(e.x/=this.rqda,e.y/=this.rqda);for(var t=1e-9,n=12,r=e.y,i,a,o,s,c,l=0;l<n&&(i=r*r,a=i*i*i,o=r*(yo+bo*i+a*(xo+So*i))-e.y,s=yo+3*bo*i+a*(7*xo+9*So*i),r-=c=o/s,!(Math.abs(c)<t));++l);return i=r*r,a=i*i*i,e.x=Co*e.x*(yo+3*bo*i+a*(7*xo+9*So*i))/Math.cos(r),e.y=Math.asin(Math.sin(r)/Co),this.es!==0&&(e.y=Ti(e.y,this.apa)),e.x=F(e.x+this.long0,this.over),e}var Do={init:wo,forward:To,inverse:Eo,names:[`eqearth`,`Equal Earth`,`Equal_Earth`]},Oo=1e-10;function ko(){var e;if(this.phi1=this.lat1,Math.abs(this.phi1)<Oo)throw Error();this.es?(this.en=nr(this.es),this.m1=rr(this.phi1,this.am1=Math.sin(this.phi1),e=Math.cos(this.phi1),this.en),this.am1=e/(Math.sqrt(1-this.es*this.am1*this.am1)*this.am1),this.inverse=jo,this.forward=Ao):(this.cphi1=Math.abs(this.phi1)+Oo>=M?0:1/Math.tan(this.phi1),this.inverse=No,this.forward=Mo)}function Ao(e){var t=F(e.x-(this.long0||0),this.over),n=e.y,r=this.am1+this.m1-rr(n,i=Math.sin(n),a=Math.cos(n),this.en),i=a*t/(r*Math.sqrt(1-this.es*i*i)),a;return e.x=r*Math.sin(i),e.y=this.am1-r*Math.cos(i),e.x=this.a*e.x+(this.x0||0),e.y=this.a*e.y+(this.y0||0),e}function jo(e){e.x=(e.x-(this.x0||0))/this.a,e.y=(e.y-(this.y0||0))/this.a;var t,n=dr(e.x,e.y=this.am1-e.y),r,i=ar(this.am1+this.m1-n,this.es,this.en);if((t=Math.abs(i))<M)t=Math.sin(i),r=n*Math.atan2(e.x,e.y)*Math.sqrt(1-this.es*t*t)/Math.cos(i);else if(Math.abs(t-M)<=Oo)r=0;else throw Error();return e.x=F(r+(this.long0||0),this.over),e.y=di(i),e}function Mo(e){var t=F(e.x-(this.long0||0),this.over),n=e.y,r,i=this.cphi1+this.phi1-n;return Math.abs(i)>Oo?(e.x=i*Math.sin(r=t*Math.cos(n)/i),e.y=this.cphi1-i*Math.cos(r)):e.x=e.y=0,e.x=this.a*e.x+(this.x0||0),e.y=this.a*e.y+(this.y0||0),e}function No(e){e.x=(e.x-(this.x0||0))/this.a,e.y=(e.y-(this.y0||0))/this.a;var t,n,r=dr(e.x,e.y=this.cphi1-e.y);if(n=this.cphi1+this.phi1-r,Math.abs(n)>M)throw Error();return t=Math.abs(Math.abs(n)-M)<=Oo?0:r*Math.atan2(e.x,e.y)/Math.cos(n),e.x=F(t+(this.long0||0),this.over),e.y=di(n),e}var Po={init:ko,names:[`bonne`,`Bonne (Werner lat_1=90)`]},Fo={OBLIQUE:{forward:Vo,inverse:Uo},TRANSVERSE:{forward:Ho,inverse:Wo}},Io={ROTATE:{o_alpha:`oAlpha`,o_lon_c:`oLongC`,o_lat_c:`oLatC`},NEW_POLE:{o_lat_p:`oLatP`,o_lon_p:`oLongP`},NEW_EQUATOR:{o_lon_1:`oLong1`,o_lat_1:`oLat1`,o_lon_2:`oLong2`,o_lat_2:`oLat2`}};function Lo(){if(this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.title=this.title||`General Oblique Transformation`,this.isIdentity=ht.includes(this.o_proj),!this.o_proj)throw Error(`Missing parameter: o_proj`);if(this.o_proj===`ob_tran`)throw Error(`Invalid value for o_proj: `+this.o_proj);let e=qt(this.projStr.replace(`+proj=ob_tran`,``).replace(`+o_proj=`,`+proj=`).trim());if(!e)throw Error(`Invalid parameter: o_proj. Unknown projection `+this.o_proj);e.long0=0,this.obliqueProjection=e;let t,n=Object.keys(Io),r=e=>{if(this[e]===void 0)return;let t=parseFloat(this[e])*N;if(isNaN(t))throw Error(`Invalid value for `+e+`: `+this[e]);return t};for(let e=0;e<n.length;e++){let i=Io[n[e]],a=Object.entries(i);if(a.some(([e])=>this[e]!==void 0)){t=i;for(let e=0;e<a.length;e++){let[t,n]=a[e],i=r(t);if(i===void 0)throw Error(`Missing parameter: `+t+`.`);this[n]=i}break}}if(!t)throw Error(`No valid parameters provided for ob_tran projection.`);let{lamp:i,phip:a}=Bo(this,t);this.lamp=i,Math.abs(a)>1e-10?(this.cphip=Math.cos(a),this.sphip=Math.sin(a),this.projectionType=Fo.OBLIQUE):this.projectionType=Fo.TRANSVERSE}function Ro(e){return this.projectionType.forward(this,e)}function zo(e){return this.projectionType.inverse(this,e)}function Bo(e,t){let n,r;if(t===Io.ROTATE){let t=e.oLongC,i=e.oLatC,a=e.oAlpha;if(Math.abs(Math.abs(i)-M)<=1e-10)throw Error(`Invalid value for o_lat_c: `+e.o_lat_c+` should be < 90°`);r=t+Math.atan2(-1*Math.cos(a),-1*Math.sin(a)*Math.sin(i)),n=Math.asin(Math.cos(i)*Math.sin(a))}else if(t===Io.NEW_POLE)r=e.oLongP,n=e.oLatP;else{let t=e.oLong1,i=e.oLat1,a=e.oLong2,o=e.oLat2,s=Math.abs(i);if(Math.abs(i)>M-1e-10)throw Error(`Invalid value for o_lat_1: `+e.o_lat_1+` should be < 90°`);if(Math.abs(o)>M-1e-10)throw Error(`Invalid value for o_lat_2: `+e.o_lat_2+` should be < 90°`);if(Math.abs(i-o)<1e-10)throw Error(`Invalid value for o_lat_1 and o_lat_2: o_lat_1 should be different from o_lat_2`);if(s<1e-10)throw Error(`Invalid value for o_lat_1: o_lat_1 should be different from zero`);r=Math.atan2(Math.cos(i)*Math.sin(o)*Math.cos(t)-Math.sin(i)*Math.cos(o)*Math.cos(a),Math.sin(i)*Math.cos(o)*Math.sin(a)-Math.cos(i)*Math.sin(o)*Math.sin(t)),n=Math.atan(-1*Math.cos(r-t)/Math.tan(i))}return{lamp:r,phip:n}}function Vo(e,t){let{x:n,y:r}=t;n=F(n-e.long0,e.over);let i=Math.cos(n),a=Math.sin(r),o=Math.cos(r);t.x=F(Math.atan2(o*Math.sin(n),e.sphip*o*i+e.cphip*a)+e.lamp),t.y=Math.asin(e.sphip*a-e.cphip*o*i);let s=e.obliqueProjection.forward(t);return e.isIdentity&&(s.x*=ue,s.y*=ue),s}function Ho(e,t){let{x:n,y:r}=t;n=F(n-e.long0,e.over);let i=Math.cos(r),a=Math.cos(n);t.x=F(Math.atan2(i*Math.sin(n),Math.sin(r))+e.lamp),t.y=Math.asin(-1*i*a);let o=e.obliqueProjection.forward(t);return e.isIdentity&&(o.x*=ue,o.y*=ue),o}function Uo(e,t){e.isIdentity&&(t.x*=N,t.y*=N);let{x:n,y:r}=e.obliqueProjection.inverse(t);if(n<Number.MAX_VALUE){n-=e.lamp;let i=Math.cos(n),a=Math.sin(r),o=Math.cos(r);t.x=Math.atan2(o*Math.sin(n),e.sphip*o*i-e.cphip*a),t.y=Math.asin(e.sphip*a+e.cphip*o*i)}return t.x=F(t.x+e.long0),t}function Wo(e,t){e.isIdentity&&(t.x*=N,t.y*=N);let{x:n,y:r}=e.obliqueProjection.inverse(t);if(n<Number.MAX_VALUE){let i=Math.cos(r);n-=e.lamp,t.x=Math.atan2(i*Math.sin(n),-1*Math.sin(r)),t.y=Math.asin(i*Math.cos(n))}return t.x=F(t.x+e.long0),t}var Go={init:Lo,forward:Ro,inverse:zo,names:[`General Oblique Transformation`,`General_Oblique_Transformation`,`ob_tran`]};function Ko(e){e.Proj.projections.add(lr),e.Proj.projections.add(xr),e.Proj.projections.add(Tr),e.Proj.projections.add(Fr),e.Proj.projections.add(Br),e.Proj.projections.add(Wr),e.Proj.projections.add(Xr),e.Proj.projections.add(ei),e.Proj.projections.add(ii),e.Proj.projections.add(gi),e.Proj.projections.add(ki),e.Proj.projections.add(Fi),e.Proj.projections.add(zi),e.Proj.projections.add(Wi),e.Proj.projections.add(Ji),e.Proj.projections.add($i),e.Proj.projections.add(ra),e.Proj.projections.add(sa),e.Proj.projections.add(fa),e.Proj.projections.add(ma),e.Proj.projections.add(va),e.Proj.projections.add(Sa),e.Proj.projections.add(Ea),e.Proj.projections.add(Ma),e.Proj.projections.add(Ia),e.Proj.projections.add(Ua),e.Proj.projections.add(ro),e.Proj.projections.add(so),e.Proj.projections.add(mo),e.Proj.projections.add(vo),e.Proj.projections.add(Do),e.Proj.projections.add(Po),e.Proj.projections.add(Go)}var qo=Object.assign(_n,{defaultDatum:`WGS84`,Proj:qt,WGS84:new qt(`WGS84`),Point:Un,toPoint:cn,defs:Ye,nadgrid:Nt,transform:pn,mgrs:En,version:`__VERSION__`});Ko(qo),qo.defs(`EPSG:25832`,`+proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +type=crs`);function Jo(e,t){let n=qo(`EPSG:4326`,`EPSG:25832`,[e,t]);return{easting:n[0],northing:n[1]}}function Yo(e){if(!navigator.geolocation)return e(`denied`),()=>{};let t=navigator.geolocation.watchPosition(t=>{e(Jo(t.coords.longitude,t.coords.latitude))},t=>{t.code===t.PERMISSION_DENIED&&e(`denied`)},{enableHighAccuracy:!0});return()=>navigator.geolocation.clearWatch(t)}var Xo={maxSpanMeters:36e3,minResolutionMeters:1.25,openResolutionMeters:7};function Zo(e,t=Xo){return Math.min(t.maxSpanMeters/e.widthPx,t.maxSpanMeters/e.heightPx)}var Qo=65,$o=73,es=79;function ts(e,t){if(t=typeof t==`number`?t:5,!Array.isArray(e))throw TypeError(`forward did not receive an array`);if(typeof e[0]==`string`||typeof e[1]==`string`)throw TypeError(`forward received an array of strings, but it only accepts an array of numbers.`);let[n,r]=e;if(n<-180||n>180)throw TypeError(`forward received an invalid longitude of `+n);if(r<-90||r>90)throw TypeError(`forward received an invalid latitude of `+r);if(r<-80||r>84)throw TypeError(`forward received a latitude of ${r}, but this library does not support conversions of points in polar regions below 80°S and above 84°N`);return function(e,t){let n=`00000`+e.easting,r=`00000`+e.northing;return e.zoneNumber+e.zoneLetter+function(e,t,n){let r=ss(n);return function(e,t,n){let r=n-1,i=`AJSAJS`.charCodeAt(r),a=`AFAFAF`.charCodeAt(r),o=i+e-1,s=a+t,c=!1;return o>90&&(o=o-90+Qo-1,c=!0),(o===$o||i<$o&&o>$o||(o>$o||i<$o)&&c)&&o++,(o===es||i<es&&o>es||(o>es||i<es)&&c)&&(o++,o===$o&&o++),o>90&&(o=o-90+Qo-1),s>86?(s=s-86+Qo-1,c=!0):c=!1,(s===$o||a<$o&&s>$o||(s>$o||a<$o)&&c)&&s++,(s===es||a<es&&s>es||(s>es||a<es)&&c)&&(s++,s===$o&&s++),s>86&&(s=s-86+Qo-1),String.fromCharCode(o)+String.fromCharCode(s)}(Math.floor(e/1e5),Math.floor(t/1e5)%20,r)}(e.easting,e.northing,e.zoneNumber)+n.substr(n.length-5,t)+r.substr(r.length-5,t)}(function(e){let t=e.lat,n=e.lon,r=6378137,i=rs(t),a=rs(n),o;o=Math.floor((n+180)/6)+1,n===180&&(o=60),t>=56&&t<64&&n>=3&&n<12&&(o=32),t>=72&&t<84&&(n>=0&&n<9?o=31:n>=9&&n<21?o=33:n>=21&&n<33?o=35:n>=33&&n<42&&(o=37));let s=rs(6*(o-1)-180+3),c=r/Math.sqrt(1-.00669438*Math.sin(i)*Math.sin(i)),l=Math.tan(i)*Math.tan(i),u=.006739496752268451*Math.cos(i)*Math.cos(i),d=Math.cos(i)*(a-s),f=r*(.9983242984503243*i-.002514607064228144*Math.sin(2*i)+2639046602129982e-21*Math.sin(4*i)-3.418046101696858e-9*Math.sin(6*i)),p=.9996*c*(d+(1-l+u)*d*d*d/6+(5-18*l+l*l+72*u-.39089081163157013)*d*d*d*d*d/120)+5e5,m=.9996*(f+c*Math.tan(i)*(d*d/2+(5-l+9*u+4*u*u)*d*d*d*d/24+(61-58*l+l*l+600*u-2.2240339282485886)*d*d*d*d*d*d/720));return t<0&&(m+=1e7),{northing:Math.trunc(m),easting:Math.trunc(p),zoneNumber:o,zoneLetter:os(t)}}({lat:r,lon:n}),t)}function ns(e){if(e===``)throw TypeError(`toPoint received a blank string`);let t=as(cs(e.toUpperCase()));return typeof t.lat==`number`&&typeof t.lon==`number`?[t.lon,t.lat]:[(t.left+t.right)/2,(t.top+t.bottom)/2]}function rs(e){return Math.PI/180*e}function is(e){return e/Math.PI*180}function as(e){let t=e.northing,n=e.easting,{zoneLetter:r,zoneNumber:i}=e;if(i<0||i>60)return null;let a=6378137,o=(1-Math.sqrt(.99330562))/(1+Math.sqrt(.99330562)),s=n-5e5,c=t;r<`N`&&(c-=1e7);let l=6*(i-1)-180+3,u=c/.9996/6367449.145945056,d=u+(3*o/2-27*o*o*o/32)*Math.sin(2*u)+(21*o*o/16-55*o*o*o*o/32)*Math.sin(4*u)+151*o*o*o/96*Math.sin(6*u),f=a/Math.sqrt(1-.00669438*Math.sin(d)*Math.sin(d)),p=Math.tan(d)*Math.tan(d),m=.006739496752268451*Math.cos(d)*Math.cos(d),h=.99330562*a/(1-.00669438*Math.sin(d)*Math.sin(d))**1.5,g=s/(.9996*f),_=d-f*Math.tan(d)/h*(g*g/2-(5+3*p+10*m-4*m*m-.06065547077041606)*g*g*g*g/24+(61+90*p+298*m+45*p*p-1.6983531815716497-3*m*m)*g*g*g*g*g*g/720);_=is(_);let v,y=(g-(1+2*p+m)*g*g*g/6+(5-2*m+28*p-3*m*m+.05391597401814761+24*p*p)*g*g*g*g*g/120)/Math.cos(d);if(y=l+is(y),typeof e.accuracy==`number`){let t=as({northing:e.northing+e.accuracy,easting:e.easting+e.accuracy,zoneLetter:e.zoneLetter,zoneNumber:e.zoneNumber});v={top:t.lat,right:t.lon,bottom:_,left:y}}else v={lat:_,lon:y};return v}function os(e){return e<=84&&e>=72?`X`:e<72&&e>=-80?`CDEFGHJKLMNPQRSTUVWX`[Math.floor((e- -80)/8)]:e>84||e<-80?`Z`:void 0}function ss(e){let t=e%6;return t===0&&(t=6),t}function cs(e){if(e&&e.length===0)throw TypeError(`MGRSPoint coverting from nothing`);e=e.replace(/ /g,``);let{length:t}=e,n,r=null,i=``,a=0;for(;!/[A-Z]/.test(n=e.charAt(a));){if(a>=2)throw Error(`MGRSPoint bad conversion from: `+e);i+=n,a++}let o=parseInt(i,10);if(a===0||a+3>t)throw Error(`MGRSPoint bad conversion from `+e);let s=e.charAt(a++);if(s<=`A`||s===`B`||s===`Y`||s>=`Z`||s===`I`||s===`O`)throw Error(`MGRSPoint zone letter ${s} not handled: ${e}`);r=e.substring(a,a+=2);let c=ss(o),l=function(e,t){let n=`AJSAJS`.charCodeAt(t-1),r=1e5,i=!1;for(;n!==e.charCodeAt(0);){if(n++,n===$o&&n++,n===es&&n++,n>90){if(i)throw Error(`Bad character: `+e);n=Qo,i=!0}r+=1e5}return r}(r.charAt(0),c),u=function(e,t){if(e>`V`)throw TypeError(`MGRSPoint given invalid Northing `+e);let n=`AFAFAF`.charCodeAt(t-1),r=0,i=!1;for(;n!==e.charCodeAt(0);){if(n++,n===$o&&n++,n===es&&n++,n>86){if(i)throw Error(`Bad character: `+e);n=Qo,i=!0}r+=1e5}return r}(r.charAt(1),c);for(;u<ls(s);)u+=2e6;let d=t-a;if(d%2!=0)throw Error(`MGRSPoint has to have an even number
of digits after the zone letter and two 100km letters - front
half for easting meters, second half for
northing meters `+e);let f=d/2,p=0,m=0,h=1e5/10**f;if(f>0){let t=e.substring(a,a+f);p=parseFloat(t)*h;let n=e.substring(a+f);m=parseFloat(n)*h}return{easting:p+l,northing:m+u,zoneLetter:s,zoneNumber:o,accuracy:h}}function ls(e){let t;switch(e){case`C`:t=11e5;break;case`D`:t=2e6;break;case`E`:t=28e5;break;case`F`:t=37e5;break;case`G`:t=46e5;break;case`H`:t=55e5;break;case`J`:t=64e5;break;case`K`:t=73e5;break;case`L`:t=82e5;break;case`M`:t=91e5;break;case`N`:t=0;break;case`P`:t=8e5;break;case`Q`:t=17e5;break;case`R`:t=26e5;break;case`S`:t=35e5;break;case`T`:t=44e5;break;case`U`:t=53e5;break;case`V`:t=62e5;break;case`W`:t=7e6;break;case`X`:t=79e5;break;default:t=-1}if(t>=0)return t;throw TypeError(`Invalid zone letter: `+e)}qo.defs(`EPSG:25832`,`+proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +type=crs`);var us=`Rechtswert und Hochwert müssen genau fünf Ziffern haben.`,ds=`Dieses Gitter ist keine gültige Koordinate.`,fs=`Kein Blatt deckt diese Koordinate.`,ps=/^(\d{1,2}[C-HJ-NP-X])([A-HJ-NP-Z]{2})(\d{5})(\d{5})$/,ms=/^(\d{1,2})([C-HJ-NP-X])([A-HJ-NP-Z]{2})$/;function hs(e){let t=qo(`EPSG:25832`,`EPSG:4326`,[Math.round(e.easting),Math.round(e.northing)]),n;try{n=ts([t[0],t[1]],5)}catch{return null}let r=ps.exec(n);return r?{gitter:`${r[1]} ${r[2]}`,rechtswert:r[3],hochwert:r[4]}:null}function gs(e,t){if(!/^\d{5}$/.test(e.rechtswert)||!/^\d{5}$/.test(e.hochwert))return{ok:!1,notice:us};let n=e.gitter.trim().toUpperCase().replace(/\s+/g,``),r=ms.exec(n);if(!r)return{ok:!1,notice:ds};let i;try{i=ns(`${n}${e.rechtswert}${e.hochwert}`)}catch{return{ok:!1,notice:ds}}let a=qo(`EPSG:4326`,`EPSG:25832`,i),o={easting:a[0],northing:a[1]};return t(o)?{ok:!0,point:o,koordinate:`${`${r[1]}${r[2]} ${r[3]}`} ${e.rechtswert} ${e.hochwert}`}:{ok:!1,notice:fs}}var _s=`Nicht auf dem Gerät.`;function vs(e,t){return e.minE<t.maxE&&e.maxE>t.minE&&e.minN<t.maxN&&e.maxN>t.minN}function ys(e,t){return t.easting>=e.minE&&t.easting<e.maxE&&t.northing>=e.minN&&t.northing<e.maxN}function bs(e){let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a of e)t=Math.min(t,a.minE),n=Math.min(n,a.minN),r=Math.max(r,a.maxE),i=Math.max(i,a.maxN);return{easting:(t+r)/2,northing:(n+i)/2}}function xs(e){let t=new Map,{resolutions:n,tileSizePx:r,blaetter:i,gebiete:a}=e;for(let e=0;e<n.length;e+=1){let o=n[e]*r;for(let n of i){let r=Math.floor(n.minE/o),i=Math.ceil(n.maxE/o)-1,s=Math.floor(n.minN/o),c=Math.ceil(n.maxN/o)-1;for(let l=r;l<=i;l+=1)for(let r=s;r<=c;r+=1){let i=`${e}/${l}/${r}`;if(t.has(i))continue;let s={minE:l*o,minN:r*o,maxE:(l+1)*o,maxN:(r+1)*o};if(!vs(s,n))continue;let c=a.filter(e=>e.covers===`all`||e.covers.some(e=>vs(s,e))).map(e=>e.name);t.set(i,{extent:s,gebiete:c})}}}return t}function Ss(e,t){for(let n=e.length-1;n>=0;--n)if(e[n]<=t+1e-9)return n;return 0}function Cs(e,t,n){let r=n.widthPx*t/2,i=n.heightPx*t/2;return{minE:e.easting-r,maxE:e.easting+r,minN:e.northing-i,maxN:e.northing+i}}function ws(e,t,n,r){let i=n[e]*r,a=Math.floor(t.minE/i),o=Math.ceil(t.maxE/i)-1,s=Math.floor(t.minN/i),c=Math.ceil(t.maxN/i)-1,l=[];for(let t=a;t<=o;t+=1)for(let n=s;n<=c;n+=1)l.push({id:`${e}/${t}/${n}`});return l}function Ts(e){if(e<1e3)return`${Math.round(e)} m`;let t=Math.round(e/1e3*10)/10;return Number.isInteger(t)?`${t} km`:`${t.toFixed(1).replace(`.`,`,`)} km`}function Es(e,t){if(!e)return null;let n=Math.hypot(t.easting-e.easting,t.northing-e.northing);return{metres:n,text:Ts(n)}}function Ds(e){return e instanceof DOMException&&e.name===`AbortError`}function Os(e){return typeof e==`object`&&!!e}async function ks(e){let{uebersicht:t,cache:n,marks:r,kacheln:i,config:a}=e,o=xs(t),s=await n.ids(),c=new Set(s),l=new Set(s.filter(e=>o.has(e))),u=await r.read(),d=[];for(let[e,t]of o)t.gebiete.includes(`Hessen`)&&d.push(e);function f(){let e=0;for(let t of d)l.has(t)&&(e+=1);return e}let p={...e.viewport},m=e.online??!1,h=e.appOpen??!0,g=Os(e.standort)?{...e.standort}:null,_=g!==null,v=!1,y=!1,b=ae(u.ziele),x=u.downloadKnopf===!0,S=null,C={gitter:`32U MA`,rechtswert:``,hochwert:``},w=[],T=null,E=null,D=!1,O=new Map,k=new Set,A=new Set;function ee(e){let t=Zo(p,a);return Math.min(Math.max(e,a.minResolutionMeters),t)}function te(){let e=1/0,t=1/0,n=-1/0,r=-1/0,i=!1;for(let a of l){let s=o.get(a);s&&(i=!0,e=Math.min(e,s.extent.minE),t=Math.min(t,s.extent.minN),n=Math.max(n,s.extent.maxE),r=Math.max(r,s.extent.maxN))}return i?{easting:(e+n)/2,northing:(t+r)/2}:null}let ne=g?{...g}:te()??bs(t.blaetter),re=ee(a.openResolutionMeters);function j(){for(let e of A)e()}function ie(){r.write({heruntergeladen:[],ziele:b.map(e=>e.koordinate),downloadKnopf:x})}function ae(e){let n=[];for(let r of e){let e=/^(\d{1,2}[C-HJ-NP-X] [A-HJ-NP-Z]{2}) (\d{5}) (\d{5})$/.exec(r);if(!e)continue;let i=gs({gitter:e[1],rechtswert:e[2],hochwert:e[3]},e=>t.blaetter.some(t=>ys(t,e)));i.ok&&i.koordinate===r&&n.push({koordinate:r,point:i.point})}return n}function M(){let e=Cs(ne,re,p),n=Ss(t.resolutions,re),r=[];for(let i of ws(n,e,t.resolutions,t.tileSizePx)){if(!o.has(i.id)){r.push({id:i.id,appearance:`blank-unknown`});continue}if(l.has(i.id)){r.push({id:i.id,appearance:`drawn`});continue}let e=h&&m&&!k.has(i.id)&&(w.includes(i.id)||O.has(i.id));r.push({id:i.id,appearance:e?`blank-downloading`:`blank-not-on-device`})}return r.sort((e,t)=>e.id.localeCompare(t.id,`en`)),r}function oe(){D=!1}function se(){if(D){w=[];return}let e=Cs(ne,re,p),n=ws(Ss(t.resolutions,re),e,t.resolutions,t.tileSizePx).map(e=>e.id).filter(e=>o.has(e));for(let e of k)n.includes(e)||k.delete(e);let r=[],i=new Set,a=e=>{i.has(e)||l.has(e)||(i.add(e),r.push(e))};for(let e of n)a(e);if(T)for(let e of T)a(e);if(E)for(let e of E)a(e);w=r,ce()}function ce(){if(!h||!m||O.size>=1)return;let e=w.find(e=>!l.has(e)&&!k.has(e)&&!O.has(e));e&&le(e)}async function le(e){let t=new AbortController;O.set(e,t),j();try{let r=await i.fetch(e,t.signal);if(t.signal.aborted)return;l.add(e),c.add(e),await n.put(e,r),T?.every(e=>l.has(e))&&(T=null),E?.every(e=>l.has(e))&&(E=null)}catch(t){Ds(t)||k.add(e)}finally{O.get(e)===t&&O.delete(e),se(),j()}}function N(e){for(let[t,n]of O)e(t)&&(O.delete(t),n.abort())}function ue(){let e=M(),t=!m&&e.some(e=>e.appearance===`blank-not-on-device`),n=S??(t?_s:null);return{center:{...ne},resolution:re,northUp:!0,ziele:b.map(e=>({koordinate:e.koordinate,point:{...e.point},entfernung:Es(g,e.point)})),standort:g?{...g}:null,notice:n,koordinate:{...C},downloadKnopf:x,hessen:{arrived:f(),total:d.length},visit:de(),kacheln:e}}function P(){let e=[],t=new Set;for(let n of T??[])t.has(n)||(t.add(n),e.push(n));for(let n of E??[])t.has(n)||(t.add(n),e.push(n));return e}function de(){let e=P();if(e.length===0)return null;let t=0;for(let n of e)l.has(n)&&(t+=1);return{arrived:t,total:e.length}}function fe(e){let n=[],r=new Set;for(let i=0;i<t.resolutions.length;i+=1)for(let a of ws(i,e,t.resolutions,t.tileSizePx))!r.has(a.id)&&o.has(a.id)&&(r.add(a.id),n.push(a.id));return n}let pe={snapshot:ue,subscribe(e){return A.add(e),()=>A.delete(e)},setViewport(e){oe(),p={...e},re=ee(re),se(),j()},panTo(e){oe(),v=!0,ne={...e},se(),j()},zoomTo(e){oe(),re=ee(e),se(),j()},reportStandort(e){h&&(e===`denied`?(g=null,j()):(g={...e},!_&&!v&&!y&&(oe(),ne={...e},re=ee(a.openResolutionMeters),se()),_=!0,j()))},setAppOpen(e){h=e,e?(oe(),k.clear(),se()):(T=null,E=null,N(()=>!0)),j()},setOnline(e){m=e,e?(oe(),k.clear(),se()):N(()=>!0),j()},tap(e){let n=44*re,r=-1,i=1/0;for(let t=0;t<b.length;t+=1){let a=Math.hypot(e.easting-b[t].point.easting,e.northing-b[t].point.northing);a<=n&&a<i&&(r=t,i=a)}if(r>=0){b=b.filter((e,t)=>t!==r),ie(),j();return}let a=hs(e);if(!a)return;let o=gs(a,e=>t.blaetter.some(t=>ys(t,e)));o.ok&&(b.some(e=>e.koordinate===o.koordinate)?(S=`Diese Koordinate ist schon ein Ziel.`,j()):(S=null,b=[{koordinate:o.koordinate,point:o.point},...b],y=!0,ie(),j()))},enterKoordinate(e){let n=gs(e,e=>t.blaetter.some(t=>ys(t,e)));n.ok?b.some(e=>e.koordinate===n.koordinate)?(S=`Diese Koordinate ist schon ein Ziel.`,j()):(S=null,C={gitter:e.gitter,rechtswert:e.rechtswert,hochwert:e.hochwert},b=[{koordinate:n.koordinate,point:n.point},...b],y=!0,oe(),ne={...n.point},re=ee(a.openResolutionMeters),ie(),se(),j()):(S=n.notice,j())},deleteZiel(e){let t=b.filter(t=>t.koordinate!==e);t.length!==b.length&&(b=t,ie(),j())},setDownloadKnopf(e){x=e,ie(),j()},centerOnStandort(){g&&(oe(),v=!0,ne={...g},re=ee(a.openResolutionMeters),se(),j())},centerOnZiel(e){let t=b.find(t=>t.koordinate===e);t&&(oe(),v=!0,ne={...t.point},re=ee(a.openResolutionMeters),se(),j())},startHessen(){if(T)return;let e=d.filter(e=>!l.has(e));e.length!==0&&(oe(),T=e,se(),j())},downloadView(){if(E)return;let e=fe(Cs(ne,re,p)).filter(e=>!l.has(e));e.length!==0&&(oe(),E=e,se(),j())},deleteCache(){D=!0,T=null,E=null,N(()=>!0);let e=[...c];l.clear(),c.clear(),k.clear(),w=[],n.delete(e),j()}};return h&&m&&se(),pe}function As(e,t){e.replaceChildren();let n=document.createElement(`div`);n.className=`boot-failure`,n.setAttribute(`role`,`alert`);let r=document.createElement(`p`);r.className=`boot-error`,r.textContent=`Die Karte konnte nicht geöffnet werden.`;let i=document.createElement(`p`);i.className=`boot-detail`,i.textContent=v(t);let a=document.createElement(`p`);a.textContent=`Die gespeicherten Kacheln bleiben auf dem Gerät.`;let o=document.createElement(`button`);o.type=`button`,o.className=`secondary`,o.textContent=`Karte neu starten`,n.append(r,i,a,o);let s=null;b()&&(s=document.createElement(`button`),s.type=`button`,s.className=`secondary`,s.textContent=`Gespeicherte Kacheln löschen`,n.append(s)),e.append(n);let c=y(),l=()=>[o,s].filter(e=>e!==null);o.addEventListener(`click`,()=>{u(async()=>{x(),await g(c),location.reload()})}),s?.addEventListener(`click`,()=>{u(async()=>{await g(c),await _(c),location.reload()})});async function u(e){for(let e of l())e.disabled=!0;try{await e()}catch(e){i.textContent=v(e);for(let e of l())e.disabled=!1}}}var js={ADD:`add`,REMOVE:`remove`},Ms={PROPERTYCHANGE:`propertychange`};function Ns(e){for(let t in e)delete e[t]}function Ps(e){let t;for(t in e)return!1;return!t}function L(e,t,n,r,i){if(i){let i=n;n=function(a){return e.removeEventListener(t,n),i.call(r??this,a)}}else r&&r!==e&&(n=n.bind(r));let a={target:e,type:t,listener:n};return e.addEventListener(t,n),a}function Fs(e,t,n,r){return L(e,t,n,r,!0)}function R(e){e&&e.target&&(e.target.removeEventListener(e.type,e.listener),Ns(e))}var z={CHANGE:`change`,ERROR:`error`,BLUR:`blur`,CLEAR:`clear`,CONTEXTMENU:`contextmenu`,CLICK:`click`,DBLCLICK:`dblclick`,DRAGENTER:`dragenter`,DRAGOVER:`dragover`,DROP:`drop`,FOCUS:`focus`,KEYDOWN:`keydown`,KEYPRESS:`keypress`,KEYUP:`keyup`,LOAD:`load`,RESIZE:`resize`,TOUCHMOVE:`touchmove`,WHEEL:`wheel`},Is=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}};function Ls(e,t,n){let r,i;n||=Rs;let a=0,o=e.length,s=!1;for(;a<o;)r=a+(o-a>>1),i=+n(e[r],t),i<0?a=r+1:(o=r,s=!i);return s?a:~a}function Rs(e,t){return e>t?1:e<t?-1:0}function zs(e,t){return e<t?1:e>t?-1:0}function Bs(e,t,n){if(e[0]<=t)return 0;let r=e.length;if(t<=e[r-1])return r-1;if(typeof n==`function`){for(let i=1;i<r;++i){let r=e[i];if(r===t)return i;if(r<t)return n(t,e[i-1],r)>0?i-1:i}return r-1}if(n>0){for(let n=1;n<r;++n)if(e[n]<t)return n-1;return r-1}if(n<0){for(let n=1;n<r;++n)if(e[n]<=t)return n;return r-1}for(let n=1;n<r;++n){if(e[n]==t)return n;if(e[n]<t)return e[n-1]-t<t-e[n]?n-1:n}return r-1}function Vs(e,t,n){for(;t<n;){let r=e[t];e[t]=e[n],e[n]=r,++t,--n}}function Hs(e,t){let n=Array.isArray(t)?t:[t],r=n.length;for(let t=0;t<r;t++)e[e.length]=n[t]}function Us(e,t){let n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}function Ws(e,t,n){let r=t||Rs;return e.every(function(t,i){if(i===0)return!0;let a=r(e[i-1],t);return!(a>0||n&&a===0)})}function B(){throw Error(`Unimplemented abstract method.`)}var Gs=0;function V(e){let t=e;return t.ol_uid||=String(++Gs)}function Ks(e){return!!e&&typeof e.then==`function`&&typeof e.catch==`function`}function qs(){return!0}function Js(){return!1}function Ys(){}function Xs(e){let t,n,r;return function(){let i=Array.prototype.slice.call(arguments);return(!n||this!==r||!Us(i,n))&&(r=this,n=i,t=e.apply(this,i)),t}}function Zs(e){function t(){let t;try{t=e()}catch(e){return Promise.reject(e)}return Ks(t)?t:Promise.resolve(t)}return t()}var Qs=class{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}},$s=class extends Is{constructor(e){super(),this.eventTarget_=e,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(e,t){if(!e||!t)return;let n=this.listeners_||={},r=n[e]||(n[e]=[]);r.includes(t)||r.push(t)}dispatchEvent(e){let t=typeof e==`string`,n=t?e:e.type,r=this.listeners_&&this.listeners_[n];if(!r)return;let i=t?new Qs(e):e;i.target||=this.eventTarget_||this;let a=this.dispatching_||={},o=this.pendingRemovals_||={};n in a||(a[n]=0,o[n]=0),++a[n];let s;for(let e=0,t=r.length;e<t;++e)if(s=`handleEvent`in r[e]?r[e].handleEvent(i):r[e].call(this,i),s===!1||i.propagationStopped){s=!1;break}if(--a[n]===0){let e=o[n];for(delete o[n];e--;)this.removeEventListener(n,Ys);delete a[n]}return s}disposeInternal(){this.listeners_&&Ns(this.listeners_)}getListeners(e){return this.listeners_&&this.listeners_[e]||void 0}hasListener(e){return this.listeners_?e?e in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(e,t){if(!this.listeners_)return;let n=this.listeners_[e];if(!n)return;let r=n.indexOf(t);r!==-1&&(this.pendingRemovals_&&e in this.pendingRemovals_?(n[r]=Ys,++this.pendingRemovals_[e]):(n.splice(r,1),n.length===0&&delete this.listeners_[e]))}},ec=class extends $s{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(z.CHANGE)}getRevision(){return this.revision_}onInternal(e,t){if(Array.isArray(e)){let n=e.length,r=Array(n);for(let i=0;i<n;++i)r[i]=L(this,e[i],t);return r}return L(this,e,t)}onceInternal(e,t){let n;if(Array.isArray(e)){let r=e.length;n=Array(r);for(let i=0;i<r;++i)n[i]=Fs(this,e[i],t)}else n=Fs(this,e,t);return t.ol_key=n,n}unInternal(e,t){let n=t.ol_key;if(n)tc(n);else if(Array.isArray(e))for(let n=0,r=e.length;n<r;++n)this.removeEventListener(e[n],t);else this.removeEventListener(e,t)}};ec.prototype.on,ec.prototype.once,ec.prototype.un;function tc(e){if(Array.isArray(e))for(let t=0,n=e.length;t<n;++t)R(e[t]);else R(e)}var nc=class extends Qs{constructor(e,t,n){super(e),this.key=t,this.oldValue=n}},rc=class extends ec{constructor(e){super(),this.on,this.once,this.un,V(this),this.values_=null,e!==void 0&&this.setProperties(e)}get(e){let t;return this.values_&&this.values_.hasOwnProperty(e)&&(t=this.values_[e]),t}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(e,t){let n;n=`change:${e}`,this.hasListener(n)&&this.dispatchEvent(new nc(n,e,t)),n=Ms.PROPERTYCHANGE,this.hasListener(n)&&this.dispatchEvent(new nc(n,e,t))}addChangeListener(e,t){this.addEventListener(`change:${e}`,t)}removeChangeListener(e,t){this.removeEventListener(`change:${e}`,t)}set(e,t,n){let r=this.values_||={};if(n)r[e]=t;else{let n=r[e];r[e]=t,n!==t&&this.notify(e,n)}}setProperties(e,t){for(let n in e)this.set(n,e[n],t)}applyProperties(e){e.values_&&Object.assign(this.values_||={},e.values_)}unset(e,t){if(this.values_&&e in this.values_){let n=this.values_[e];delete this.values_[e],Ps(this.values_)&&(this.values_=null),t||this.notify(e,n)}}},ic={LENGTH:`length`},ac=class extends Qs{constructor(e,t,n){super(e),this.element=t,this.index=n}},oc=class extends rc{constructor(e,t){if(super(),this.on,this.once,this.un,t||={},this.unique_=!!t.unique,this.array_=e??[],this.unique_)for(let e=1,t=this.array_.length;e<t;++e)this.assertUnique_(this.array_[e],e);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(e){for(let t=0,n=e.length;t<n;++t)this.push(e[t]);return this}forEach(e){let t=this.array_;for(let n=0,r=t.length;n<r;++n)e(t[n],n,t)}getArray(){return this.array_}item(e){return this.array_[e]}getLength(){return this.get(ic.LENGTH)}insertAt(e,t){if(e<0||e>this.getLength())throw Error(`Index out of bounds: `+e);this.unique_&&this.assertUnique_(t),this.array_.splice(e,0,t),this.updateLength_(),this.dispatchEvent(new ac(js.ADD,t,e))}pop(){return this.removeAt(this.getLength()-1)}push(e){let t=this.getLength();return this.insertAt(t,e),this.getLength()}remove(e){let t=this.array_;for(let n=0,r=t.length;n<r;++n)if(t[n]===e)return this.removeAt(n)}removeAt(e){if(e<0||e>=this.getLength())return;let t=this.array_[e];return this.array_.splice(e,1),this.updateLength_(),this.dispatchEvent(new ac(js.REMOVE,t,e)),t}setAt(e,t){if(e>=this.getLength()){this.insertAt(e,t);return}if(e<0)throw Error(`Index out of bounds: `+e);this.unique_&&this.assertUnique_(t,e);let n=this.array_[e];this.array_[e]=t,this.dispatchEvent(new ac(js.REMOVE,n,e)),this.dispatchEvent(new ac(js.ADD,t,e))}updateLength_(){this.set(ic.LENGTH,this.array_.length)}assertUnique_(e,t){let n=this.array_;for(let r=0,i=n.length;r<i;++r)if(n[r]===e&&r!==t)throw Error(`Duplicate item added to a unique collection`)}},sc=class extends Qs{constructor(e,t,n){super(e),this.map=t,this.frameState=n===void 0?null:n}},cc=class extends sc{constructor(e,t,n,r,i,a){super(e,t,i),this.originalEvent=n,this.pixel_=null,this.coordinate_=null,this.dragging=r!==void 0&&r,this.activePointers=a,this.ctrlKey=!1}get pixel(){return this.pixel_||=this.map.getEventPixel(this.originalEvent),this.pixel_}set pixel(e){this.pixel_=e}get coordinate(){return this.coordinate_||=this.map.getCoordinateFromPixel(this.pixel),this.coordinate_}set coordinate(e){this.coordinate_=e}preventDefault(){super.preventDefault(),`preventDefault`in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),`stopPropagation`in this.originalEvent&&this.originalEvent.stopPropagation()}},lc={SINGLECLICK:`singleclick`,CLICK:z.CLICK,DBLCLICK:z.DBLCLICK,POINTERDRAG:`pointerdrag`,POINTERMOVE:`pointermove`,POINTERDOWN:`pointerdown`,POINTERUP:`pointerup`,POINTEROVER:`pointerover`,POINTEROUT:`pointerout`,POINTERENTER:`pointerenter`,POINTERLEAVE:`pointerleave`,POINTERCANCEL:`pointercancel`},uc=typeof navigator<`u`&&navigator.userAgent!==void 0?navigator.userAgent.toLowerCase():``;uc.includes(`safari`)&&!uc.includes(`chrom`)&&(uc.includes(`version/15.4`)||/cpu (os|iphone os) 15_4 like mac os x/.test(uc));var dc=uc.includes(`webkit`)&&!uc.includes(`edge`),fc=uc.includes(`macintosh`),pc=typeof devicePixelRatio<`u`?devicePixelRatio:1,mc=typeof WorkerGlobalScope<`u`&&typeof OffscreenCanvas<`u`&&self instanceof WorkerGlobalScope,hc=typeof Image<`u`&&Image.prototype.decode,gc=(function(){let e=!1;try{let t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener(`_`,null,t),window.removeEventListener(`_`,null,t)}catch{}return e})(),_c={POINTERMOVE:`pointermove`,POINTERDOWN:`pointerdown`,POINTERUP:`pointerup`,POINTEROVER:`pointerover`,POINTEROUT:`pointerout`,POINTERENTER:`pointerenter`,POINTERLEAVE:`pointerleave`,POINTERCANCEL:`pointercancel`},vc=class extends $s{constructor(e,t){super(e),this.map_=e,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=t===void 0?1:t,this.down_=null;let n=this.map_.getViewport();if(!n)throw Error(`Map viewport is required`);this.activePointers_=[],this.trackedTouches_={},this.element_=n,this.pointerdownListenerKey_=L(n,_c.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=L(n,_c.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(z.TOUCHMOVE,this.boundHandleTouchMove_,gc?{passive:!1}:!1)}emulateClick_(e){let t=new cc(lc.CLICK,this.map_,e);this.dispatchEvent(t),this.clickTimeoutId_===void 0?this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;let t=new cc(lc.SINGLECLICK,this.map_,e);this.dispatchEvent(t)},250):(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new cc(lc.DBLCLICK,this.map_,e),this.dispatchEvent(t))}updateActivePointers_(e){let t=e,n=t.pointerId;if(t.type==lc.POINTERUP||t.type==lc.POINTERCANCEL){delete this.trackedTouches_[n];for(let e in this.trackedTouches_)if(this.trackedTouches_[e].target!==t.target){delete this.trackedTouches_[e];break}}else(t.type==lc.POINTERDOWN||t.type==lc.POINTERMOVE)&&(this.trackedTouches_[n]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);let t=new cc(lc.POINTERUP,this.map_,e,void 0,void 0,this.activePointers_);this.dispatchEvent(t),this.emulateClicks_&&!t.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(e)&&this.down_&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(R),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(e){return e.button===0}handlePointerDown_(e){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(e);let t=new cc(lc.POINTERDOWN,this.map_,e,void 0,void 0,this.activePointers_);if(this.dispatchEvent(t),this.down_=new PointerEvent(e.type,e),Object.defineProperty(this.down_,"target",{writable:!1,value:e.target}),this.dragListenerKeys_.length===0){let e=this.map_.getOwnerDocument(),t=this.element_;if(!t)return;if(this.dragListenerKeys_.push(L(e,lc.POINTERMOVE,this.handlePointerMove_,this),L(e,lc.POINTERUP,this.handlePointerUp_,this),L(t,lc.POINTERCANCEL,this.handlePointerUp_,this)),t.getRootNode&&t.getRootNode()!==e){let e=t.getRootNode();this.dragListenerKeys_.push(L(e,lc.POINTERUP,this.handlePointerUp_,this))}}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;let t=new cc(lc.POINTERDRAG,this.map_,e,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(t)}}relayMoveEvent_(e){this.originalPointerMoveEvent_=e;let t=!!(this.down_&&this.isMoving_(e));this.dispatchEvent(new cc(lc.POINTERMOVE,this.map_,e,t))}handleTouchMove_(e){let t=this.originalPointerMoveEvent_;(!t||t.defaultPrevented)&&(typeof e.cancelable!=`boolean`||e.cancelable===!0)&&e.preventDefault()}isMoving_(e){let t=this.down_;return this.dragging_||t!==null&&(Math.abs(e.clientX-t.clientX)>this.moveTolerance_||Math.abs(e.clientY-t.clientY)>this.moveTolerance_)}disposeInternal(){let e=this.element_;this.relayedListenerKey_&&=(R(this.relayedListenerKey_),void 0),e&&e.removeEventListener(z.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&=(R(this.pointerdownListenerKey_),void 0),this.dragListenerKeys_.forEach(R),this.dragListenerKeys_.length=0,this.element_=void 0,super.disposeInternal()}},yc={POSTRENDER:`postrender`,MOVESTART:`movestart`,MOVEEND:`moveend`,LOADSTART:`loadstart`,LOADEND:`loadend`},bc={LAYERGROUP:`layergroup`,SIZE:`size`,TARGET:`target`,VIEW:`view`},H={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function U(e,t){if(!e)throw Error(t)}var xc=1/0,Sc=class{constructor(e,t){this.priorityFunction_=e,this.keyFunction_=t,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,Ns(this.queuedElements_)}dequeue(){let e=this.elements_,t=this.priorities_,n=e[0];e.length==1?(e.length=0,t.length=0):(e[0]=e.pop(),t[0]=t.pop(),this.siftUp_(0));let r=this.keyFunction_(n);return delete this.queuedElements_[r],n}enqueue(e){U(!(this.keyFunction_(e)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");let t=this.priorityFunction_(e);return t!=1/0&&(this.elements_.push(e),this.priorities_.push(t),this.queuedElements_[this.keyFunction_(e)]=!0,this.siftDown_(0,this.elements_.length-1),!0)}getCount(){return this.elements_.length}getLeftChildIndex_(e){return e*2+1}getRightChildIndex_(e){return e*2+2}getParentIndex_(e){return e-1>>1}heapify_(){let e;for(e=(this.elements_.length>>1)-1;e>=0;e--)this.siftUp_(e)}isEmpty(){return this.elements_.length===0}isKeyQueued(e){return e in this.queuedElements_}isQueued(e){return this.isKeyQueued(this.keyFunction_(e))}siftUp_(e){let t=this.elements_,n=this.priorities_,r=t.length,i=t[e],a=n[e],o=e;for(;e<r>>1;){let i=this.getLeftChildIndex_(e),a=this.getRightChildIndex_(e),o=a<r&&n[a]<n[i]?a:i;t[e]=t[o],n[e]=n[o],e=o}t[e]=i,n[e]=a,this.siftDown_(o,e)}siftDown_(e,t){let n=this.elements_,r=this.priorities_,i=n[t],a=r[t];for(;t>e;){let e=this.getParentIndex_(t);if(r[e]>a)n[t]=n[e],r[t]=r[e],t=e;else break}n[t]=i,r[t]=a}reprioritize(){let e=this.priorityFunction_,t=this.elements_,n=this.priorities_,r=0,i=t.length,a,o,s;for(o=0;o<i;++o)a=t[o],s=e(a),s==1/0?delete this.queuedElements_[this.keyFunction_(a)]:(n[r]=s,t[r++]=a);t.length=r,n.length=r,this.heapify_()}},Cc=class extends Sc{constructor(e,t){super(t=>e.apply(null,t),e=>e[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=t,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(e){let t=super.enqueue(e);return t&&e[0].addEventListener(z.CHANGE,this.boundHandleTileChange_),t}getTilesLoading(){return this.tilesLoading_}handleTileChange(e){let t=e.target,n=t.getState();if(n===H.LOADED||n===H.ERROR||n===H.EMPTY){n!==H.ERROR&&t.removeEventListener(z.CHANGE,this.boundHandleTileChange_);let e=t.getKey();e in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[e],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(e,t){let n=0;for(;this.tilesLoading_<e&&n<t&&this.getCount()>0;){let e=this.dequeue()[0],t=e.getKey();e.getState()===H.IDLE&&!(t in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[t]=!0,++this.tilesLoading_,++n,e.load())}}};function wc(e,t,n,r,i){if(!e||!(n in e.wantedTiles)||!e.wantedTiles[n][t.getKey()])return xc;let a=e.viewState.center,o=r[0]-a[0],s=r[1]-a[1];return 65536*Math.log(i)+Math.sqrt(o*o+s*s)/i}var Tc={ANIMATING:0,INTERACTING:1},Ec={CENTER:`center`,RESOLUTION:`resolution`,ROTATION:`rotation`};function W(e,t,n){return Math.min(Math.max(e,t),n)}function Dc(e,t,n,r,i,a){let o=i-n,s=a-r;if(o!==0||s!==0){let c=((e-n)*o+(t-r)*s)/(o*o+s*s);c>1?(n=i,r=a):c>0&&(n+=o*c,r+=s*c)}return Oc(e,t,n,r)}function Oc(e,t,n,r){let i=n-e,a=r-t;return i*i+a*a}function kc(e){let t=e.length;for(let n=0;n<t;n++){let r=n,i=Math.abs(e[n][n]);for(let a=n+1;a<t;a++){let t=Math.abs(e[a][n]);t>i&&(i=t,r=a)}if(i===0)return null;let a=e[r];e[r]=e[n],e[n]=a;for(let r=n+1;r<t;r++){let i=-e[r][n]/e[n][n];for(let a=n;a<t+1;a++)n==a?e[r][a]=0:e[r][a]+=i*e[n][a]}}let n=Array(t);for(let r=t-1;r>=0;r--){n[r]=e[r][t]/e[r][r];for(let i=r-1;i>=0;i--)e[i][t]-=e[i][r]*n[r]}return n}function Ac(e){return e*180/Math.PI}function jc(e){return e*Math.PI/180}function Mc(e,t){let n=e%t;return n*t<0?n+t:n}function Nc(e,t,n){return e+n*(t-e)}function Pc(e,t){let n=10**t;return Math.round(e*n)/n}function Fc(e,t){return Math.floor(Pc(e,t))}function Ic(e,t){return Math.ceil(Pc(e,t))}function Lc(e,t,n){if(e>=t&&e<n)return e;let r=n-t;return((e-t)%r+r)%r+t}function Rc(e,t,n){return(function(r,i,a,o,s){if(!r)return;if(!i&&!t)return r;let c=t?0:a[0]*(i??0),l=t?0:a[1]*(i??0),u=s?s[0]:0,d=s?s[1]:0,f=e[0]+c/2+u,p=e[2]-c/2+u,m=e[1]+l/2+d,h=e[3]-l/2+d;f>p&&(f=(p+f)/2,p=f),m>h&&(m=(h+m)/2,h=m);let g=W(r[0],f,p),_=W(r[1],m,h);if(o&&n&&i){let e=30*i;g+=-e*Math.log(1+Math.max(0,f-r[0])/e)+e*Math.log(1+Math.max(0,r[0]-p)/e),_+=-e*Math.log(1+Math.max(0,m-r[1])/e)+e*Math.log(1+Math.max(0,r[1]-h)/e)}return[g,_]})}function zc(e){return e}var Bc={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function Vc(e){let t=Yc();for(let n=0,r=e.length;n<r;++n)nl(t,e[n]);return t}function Hc(e,t,n){return n?(n[0]=e[0]-t,n[1]=e[1]-t,n[2]=e[2]+t,n[3]=e[3]+t,n):[e[0]-t,e[1]-t,e[2]+t,e[3]+t]}function Uc(e,t){return t?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):e.slice()}function Wc(e,t,n){let r,i;return r=t<e[0]?e[0]-t:e[2]<t?t-e[2]:0,i=n<e[1]?e[1]-n:e[3]<n?n-e[3]:0,r*r+i*i}function Gc(e,t){return qc(e,t[0],t[1])}function Kc(e,t){return e[0]<=t[0]&&t[2]<=e[2]&&e[1]<=t[1]&&t[3]<=e[3]}function qc(e,t,n){return e[0]<=t&&t<=e[2]&&e[1]<=n&&n<=e[3]}function Jc(e,t){let n=e[0],r=e[1],i=e[2],a=e[3],o=t[0],s=t[1],c=Bc.UNKNOWN;return o<n?c|=Bc.LEFT:o>i&&(c|=Bc.RIGHT),s<r?c|=Bc.BELOW:s>a&&(c|=Bc.ABOVE),c===Bc.UNKNOWN&&(c=Bc.INTERSECTING),c}function Yc(){return[1/0,1/0,-1/0,-1/0]}function Xc(e,t,n,r,i){return i?(i[0]=e,i[1]=t,i[2]=n,i[3]=r,i):[e,t,n,r]}function Zc(e){return Xc(1/0,1/0,-1/0,-1/0,e)}function Qc(e,t){let n=e[0],r=e[1];return Xc(n,r,n,r,t)}function $c(e,t,n,r,i){return rl(Zc(i),e,t,n,r)}function el(e,t){return e[0]==t[0]&&e[2]==t[2]&&e[1]==t[1]&&e[3]==t[3]}function tl(e,t){return t[0]<e[0]&&(e[0]=t[0]),t[2]>e[2]&&(e[2]=t[2]),t[1]<e[1]&&(e[1]=t[1]),t[3]>e[3]&&(e[3]=t[3]),e}function nl(e,t){t[0]<e[0]&&(e[0]=t[0]),t[0]>e[2]&&(e[2]=t[0]),t[1]<e[1]&&(e[1]=t[1]),t[1]>e[3]&&(e[3]=t[1])}function rl(e,t,n,r,i){for(;n<r;n+=i)il(e,t[n],t[n+1]);return e}function il(e,t,n){e[0]=Math.min(e[0],t),e[1]=Math.min(e[1],n),e[2]=Math.max(e[2],t),e[3]=Math.max(e[3],n)}function al(e,t){let n;return n=t(sl(e)),n||(n=t(cl(e)),n)||(n=t(_l(e)),n)||(n=t(gl(e)),n)?n:!1}function ol(e){let t=0;return yl(e)||(t=G(e)*pl(e)),t}function sl(e){return[e[0],e[1]]}function cl(e){return[e[2],e[1]]}function ll(e){return[(e[0]+e[2])/2,(e[1]+e[3])/2]}function ul(e,t){let n;if(t===`bottom-left`)n=sl(e);else if(t===`bottom-right`)n=cl(e);else if(t===`top-left`)n=gl(e);else if(t===`top-right`)n=_l(e);else throw Error(`Invalid corner`);return n}function dl(e,t,n,r,i){let[a,o,s,c,l,u,d,f]=fl(e,t,n,r);return Xc(Math.min(a,s,l,d),Math.min(o,c,u,f),Math.max(a,s,l,d),Math.max(o,c,u,f),i)}function fl(e,t,n,r){let i=t*r[0]/2,a=t*r[1]/2,o=Math.cos(n),s=Math.sin(n),c=i*o,l=i*s,u=a*o,d=a*s,f=e[0],p=e[1];return[f-c+d,p-l-u,f-c-d,p-l+u,f+c-d,p+l+u,f+c+d,p+l-u,f-c+d,p-l-u]}function pl(e){return e[3]-e[1]}function ml(e,t,n){let r=n||Yc();return vl(e,t)?(r[0]=e[0]>t[0]?e[0]:t[0],r[1]=e[1]>t[1]?e[1]:t[1],r[2]=e[2]<t[2]?e[2]:t[2],r[3]=e[3]<t[3]?e[3]:t[3]):Zc(r),r}function hl(e,t){if(!vl(e,t))return[e.slice()];if(Kc(t,e))return[];let[n,r,i,a]=e,o=Math.max(n,t[0]),s=Math.max(r,t[1]),c=Math.min(i,t[2]),l=Math.min(a,t[3]),u=[];return o>n&&u.push([n,r,o,a]),c<i&&u.push([c,r,i,a]),s>r&&u.push([o,r,c,s]),l<a&&u.push([o,l,c,a]),u}function gl(e){return[e[0],e[3]]}function _l(e){return[e[2],e[3]]}function G(e){return e[2]-e[0]}function vl(e,t){return e[0]<=t[2]&&e[2]>=t[0]&&e[1]<=t[3]&&e[3]>=t[1]}function yl(e){return e[2]<e[0]||e[3]<e[1]}function bl(e,t){return t?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):e}function xl(e,t,n){let r=!1,i=Jc(e,t),a=Jc(e,n);if(i===Bc.INTERSECTING||a===Bc.INTERSECTING)r=!0;else{let o=e[0],s=e[1],c=e[2],l=e[3],u=t[0],d=t[1],f=n[0],p=n[1],m=(p-d)/(f-u),h,g;a&Bc.ABOVE&&!(i&Bc.ABOVE)&&(h=f-(p-l)/m,r=h>=o&&h<=c),!r&&a&Bc.RIGHT&&!(i&Bc.RIGHT)&&(g=p-(f-c)*m,r=g>=s&&g<=l),!r&&a&Bc.BELOW&&!(i&Bc.BELOW)&&(h=f-(p-s)/m,r=h>=o&&h<=c),!r&&a&Bc.LEFT&&!(i&Bc.LEFT)&&(g=p-(f-o)*m,r=g>=s&&g<=l)}return r}function Sl(e,t){let n=t.getExtent(),r=ll(e);if(t.canWrapX()&&(r[0]<n[0]||r[0]>=n[2])){let t=G(n),i=Math.floor((r[0]-n[0])/t)*t;e[0]-=i,e[2]-=i}return e}function Cl(e,t,n){if(t.canWrapX()){let r=t.getExtent();if(!isFinite(e[0])||!isFinite(e[2]))return[[r[0],e[1],r[2],e[3]]];Sl(e,t);let i=G(r);if(G(e)>i&&!n)return[[r[0],e[1],r[2],e[3]]];if(e[0]<r[0])return[[e[0]+i,e[1],r[2],e[3]],[r[0],e[1],e[2],e[3]]];if(e[2]>r[2])return[[e[0],e[1],r[2],e[3]],[r[0],e[1],e[2]-i,e[3]]]}return[e]}function wl(e,t){let n=[e];for(let e=0,r=t.length;e<r&&n.length>0;++e){let r=[];for(let i=0,a=n.length;i<a;++i)r.push(...hl(n[i],t[e]));n=r}return n}function Tl(e,t){return e[0]+=+t[0],e[1]+=+t[1],e}function El(e,t){let n=!0;for(let r=e.length-1;r>=0;--r)if(e[r]!=t[r]){n=!1;break}return n}function Dl(e,t){let n=Math.cos(t),r=Math.sin(t),i=e[0]*n-e[1]*r,a=e[1]*n+e[0]*r;return e[0]=i,e[1]=a,e}function Ol(e,t){return e[0]*=t,e[1]*=t,e}function kl(e,t){if(t.canWrapX()){let n=G(t.getExtent()),r=jl(e,t,n);r&&(e[0]-=r*n)}return e}function Al(e,t,n){if(t.canWrapX()){let r=G(t.getExtent()),i=Math.round((n-e[0])/r);i!==0&&(e[0]+=i*r)}return e}function jl(e,t,n){let r=t.getExtent(),i=0;return t.canWrapX()&&(e[0]<r[0]||e[0]>r[2])&&(n||=G(r),i=Math.floor((e[0]-r[0])/n)),i}function Ml(e,t,n){let r=Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])),i=[(t[0]-e[0])/r,(t[1]-e[1])/r],a=[-i[1],i[0]],o=Math.sqrt((n[0]-e[0])*(n[0]-e[0])+(n[1]-e[1])*(n[1]-e[1])),s=[(n[0]-e[0])/o,(n[1]-e[1])/o],c=r===0||o===0?0:Math.acos(W(s[0]*i[0]+s[1]*i[1],-1,1));return c=Math.max(c,1e-5),s[0]*a[0]+s[1]*a[1]>0?c:Math.PI*2-c}function Nl(e){return e**3}function Pl(e){return 1-Nl(1-e)}function Fl(e){return 3*e*e-2*e*e*e}function Il(e){return e}function Ll(e,t,n){n||=6371008.8;let r=jc(e[1]),i=jc(t[1]),a=(i-r)/2,o=jc(t[0]-e[0])/2,s=Math.sin(a)*Math.sin(a)+Math.sin(o)*Math.sin(o)*Math.cos(r)*Math.cos(i);return 2*n*Math.atan2(Math.sqrt(s),Math.sqrt(1-s))}var Rl={info:1,warn:2,error:3,none:4},zl=Rl.info;function Bl(...e){zl>Rl.warn||console.warn(...e)}var Vl={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937},Hl=class{constructor(e){this.code_=e.code,this.units_=e.units,this.extent_=e.extent===void 0?null:e.extent,this.worldExtent_=e.worldExtent===void 0?null:e.worldExtent,this.axisOrientation_=e.axisOrientation===void 0?`enu`:e.axisOrientation,this.global_=e.global!==void 0&&e.global,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=e.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=e.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||Vl[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(e){this.global_=e,this.canWrapX_=!!(e&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(e){this.defaultTileGrid_=e}setExtent(e){this.extent_=e,this.canWrapX_=!!(this.global_&&e)}setWorldExtent(e){this.worldExtent_=e}setGetPointResolution(e){this.getPointResolutionFunc_=e}getPointResolutionFunc(){return this.getPointResolutionFunc_}},Ul=6378137,Wl=Math.PI*Ul,Gl=[-Wl,-Wl,Wl,Wl],Kl=[-180,-85,180,85],ql=Ul*Math.log(Math.tan(Math.PI/2)),Jl=class extends Hl{constructor(e){super({code:e,units:`m`,extent:Gl,global:!0,worldExtent:Kl,getPointResolution:function(e,t){return e/Math.cosh(t[1]/Ul)}})}},Yl=[new Jl(`EPSG:3857`),new Jl(`EPSG:102100`),new Jl(`EPSG:102113`),new Jl(`EPSG:900913`),new Jl(`http://www.opengis.net/def/crs/EPSG/0/3857`),new Jl(`http://www.opengis.net/gml/srs/epsg.xml#3857`)];function Xl(e,t,n,r){let i=e.length;n=n!==void 0&&n>1?n:2,r??=n,t===void 0&&(t=n>2?e.slice():Array(i));for(let n=0;n<i;n+=r){t[n]=Wl*e[n]/180;let r=Ul*Math.log(Math.tan(Math.PI*(+e[n+1]+90)/360));r>ql?r=ql:r<-ql&&(r=-ql),t[n+1]=r}return t}function Zl(e,t,n,r){let i=e.length;n=n!==void 0&&n>1?n:2,r??=n,t===void 0&&(t=n>2?e.slice():Array(i));for(let n=0;n<i;n+=r)t[n]=180*e[n]/Wl,t[n+1]=360*Math.atan(Math.exp(e[n+1]/Ul))/Math.PI-90;return t}var Ql=6378137,$l=[-180,-90,180,90],eu=Math.PI*Ql/180,tu=class extends Hl{constructor(e,t){super({code:e,units:`degrees`,extent:$l,axisOrientation:t,global:!0,metersPerUnit:eu,worldExtent:$l})}},nu=[new tu(`CRS:84`),new tu(`EPSG:4326`,`neu`),new tu(`urn:ogc:def:crs:OGC:1.3:CRS84`),new tu(`urn:ogc:def:crs:OGC:2:84`),new tu(`http://www.opengis.net/def/crs/OGC/1.3/CRS84`),new tu(`http://www.opengis.net/gml/srs/epsg.xml#4326`,`neu`),new tu(`http://www.opengis.net/def/crs/EPSG/0/4326`,`neu`)],ru={};function iu(e){return ru[e]||ru[e.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,`EPSG:$3`)]||null}function au(e,t){ru[e]=t}var ou={};function su(e,t,n){let r=e.getCode(),i=t.getCode();r in ou||(ou[r]={}),ou[r][i]=n}function cu(e,t){return e in ou&&t in ou[e]?ou[e][t]:null}var lu=.9996,uu=.00669438,du=uu*uu,fu=du*uu,pu=uu/.99330562,mu=Math.sqrt(.99330562),hu=(1-mu)/(1+mu),gu=hu*hu,_u=gu*hu,vu=_u*hu,yu=vu*hu,bu=1-uu/4-3*du/64-5*fu/256,xu=.002514607064228144,Su=26390466021299826e-22,Cu=35*fu/3072,wu=3/2*hu-27/32*_u+269/512*yu,Tu=21/16*gu-55/32*vu,Eu=151/96*_u-417/128*yu,Du=1097/512*vu,Ou=6378137;function ku(e,t,n){let r=e-5e5,i=(n.north?t:t-1e7)/lu/(Ou*bu),a=i+wu*Math.sin(2*i)+Tu*Math.sin(4*i)+Eu*Math.sin(6*i)+Du*Math.sin(8*i),o=Math.sin(a),s=o*o,c=Math.cos(a),l=o/c,u=l*l,d=u*u,f=1-uu*s,p=Ou/Math.sqrt(1-uu*s),m=.99330562/f,h=pu*c**2,g=h*h,_=r/(p*lu),v=_*_,y=v*_,b=y*_,x=b*_,S=x*_,C=a-l/m*(v/2-b/24*(5+3*u+10*h-4*g-9*pu))+S/720*(61+90*u+298*h+45*d-252*pu-3*g),w=(_-y/6*(1+2*u+h)+x/120*(5-2*h+28*u-3*g+8*pu+24*d))/c;return w=Lc(w+jc(Fu(n.number)),-Math.PI,Math.PI),[Ac(w),Ac(C)]}var Au=-80,ju=84,Mu=-180,Nu=180;function Pu(e,t,n){e=Lc(e,Mu,Nu),t<Au?t=Au:t>ju&&(t=ju);let r=jc(t),i=Math.sin(r),a=Math.cos(r),o=i/a,s=o*o,c=s*s,l=jc(e),u=jc(Fu(n.number)),d=Ou/Math.sqrt(1-uu*i**2),f=pu*a**2,p=a*Lc(l-u,-Math.PI,Math.PI),m=p*p,h=m*p,g=h*p,_=g*p,v=_*p,y=Ou*(bu*r-xu*Math.sin(2*r)+Su*Math.sin(4*r)-Cu*Math.sin(6*r)),b=lu*d*(p+h/6*(1-s+f)+_/120*(5-18*s+c+72*f-58*pu))+5e5,x=lu*(y+d*o*(m/2+g/24*(5-s+9*f+4*f**2)+v/720*(61-58*s+c+600*f-330*pu)));return n.north||(x+=1e7),[b,x]}function Fu(e){return(e-1)*6-180+3}var Iu=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function Lu(e){let t=0;for(let n of Iu){let r=e.match(n);if(r){t=parseInt(r[1]);break}}if(!t)return null;let n=0,r=!1;return t>32700&&t<32761?n=t-32700:t>32600&&t<32661&&(r=!0,n=t-32600),n?{number:n,north:r}:null}function Ru(e,t){return function(n,r,i,a){let o=n.length;i=i!==void 0&&i>1?i:2,a??=i,r||=i>2?n.slice():Array(o);for(let i=0;i<o;i+=a){let a=n[i],o=n[i+1],s=e(a,o,t);r[i]=s[0],r[i+1]=s[1]}return r}}function zu(e){return Lu(e)?new Hl({code:e,units:`m`}):null}function Bu(e){let t=Lu(e.getCode());return t?{forward:Ru(Pu,t),inverse:Ru(ku,t)}:null}var Vu=[Bu],Hu=[zu],Uu=!0;function Wu(e){Uu=!(e===void 0||e)}function Gu(e,t){if(t!==void 0){for(let n=0,r=e.length;n<r;++n)t[n]=e[n];t=t}else t=e.slice();return t}function Ku(e){au(e.getCode(),e),su(e,e,Gu)}function qu(e){e.forEach(Ku)}function Ju(e){if(typeof e!=`string`)return e===void 0?null:e;let t=iu(e);if(t)return t;for(let t of Hu){let n=t(e);if(n)return n}return null}function Yu(e,t,n,r){let i=Ju(e);if(!i)return t;let a,o=i.getPointResolutionFunc();if(o){if(a=o(t,n),r&&r!==i.getUnits()){let e=i.getMetersPerUnit();e&&(a=a*e/Vl[r])}}else{let e=i.getUnits();if(e==`degrees`&&!r||r==`degrees`)a=t;else{let o=nd(i,Ju(`EPSG:4326`));if(!o&&e!==`degrees`)a=t*(i.getMetersPerUnit()??1);else{let e=[n[0]-t/2,n[1],n[0]+t/2,n[1],n[0],n[1]-t/2,n[0],n[1]+t/2];o&&(e=o(e,e,2)),a=(Ll(e.slice(0,2),e.slice(2,4))+Ll(e.slice(4,6),e.slice(6,8)))/2}let s=r?Vl[r]:i.getMetersPerUnit();s!==void 0&&(a/=s)}}return a}function Xu(e){qu(e),e.forEach(function(t){e.forEach(function(e){t!==e&&su(t,e,Gu)})})}function Zu(e,t,n,r){e.forEach(function(e){t.forEach(function(t){su(e,t,n),su(t,e,r)})})}function Qu(e,t){return e?typeof e==`string`?Ju(e):e:Ju(t)}function $u(e){return(function(t,n,r,i){let a=t.length;r=r===void 0?2:r,i??=r,n=n===void 0?Array(a):n;for(let o=0;o<a;o+=i){let a=e(t.slice(o,o+r)),s=a.length;for(let e=0,r=i;e<r;++e)n[o+e]=e>=s?t[o+e]:a[e]}return n})}function ed(e,t,n,r){let i=Ju(e),a=Ju(t);i&&a&&(su(i,a,$u(n)),su(a,i,$u(r)))}function td(e,t){if(e===t)return!0;let n=e.getUnits()===t.getUnits();return(e.getCode()===t.getCode()||nd(e,t)===Gu)&&n}function nd(e,t){if(!e||!t)return null;let n=e.getCode(),r=t.getCode(),i=cu(n,r);if(i)return i;let a=null,o=null;for(let n of Vu)a||=n(e),o||=n(t);if(!a&&!o)return null;let s=`EPSG:4326`;if(!o&&a){let e=cu(s,r);e&&(i=rd(a.inverse,e))}else if(!a&&o){let e=cu(n,s);e&&(i=rd(e,o.forward))}else a&&o&&(i=rd(a.inverse,o.forward));return i&&(Ku(e),Ku(t),su(e,t,i)),i}function rd(e,t){return function(n,r,i,a){return r=e(n,r,i,a),t(r,r,i,a)}}function id(e,t){return nd(Ju(e),Ju(t))}function ad(e,t,n){let r=id(t,n);if(!r){let e=Ju(t)?.getCode()??String(t),r=Ju(n)?.getCode()??String(n);throw Error(`No transform available between ${e} and ${r}`)}return r(e,void 0,e.length)}var od=null;function sd(){return od}function cd(e,t){return e}function ld(e,t){return Uu&&!El(e,[0,0])&&e[0]>=-180&&e[0]<=180&&e[1]>=-90&&e[1]<=90&&(Uu=!1,Bl(`Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.`)),e}function ud(e,t){return e}function dd(e,t){return e}function fd(e,t){return e}function pd(e,t,n){return function(r){let i,a;if(e.canWrapX()){let t=e.getExtent(),o=G(t);r=r.slice(0),a=jl(r,e,o),a&&(r[0]-=a*o),r[0]=W(r[0],t[0],t[2]),r[1]=W(r[1],t[1],t[3]),i=n(r)}else i=n(r);return a&&t.canWrapX()&&(i[0]+=a*G(t.getExtent())),i}}function md(){Xu(Yl),Xu(nu),Zu(nu,Yl,Xl,Zl)}md();var hd=[1,0,0,1,0,0];function gd(){return hd.slice(0)}function _d(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function vd(e,t){let n=t[0],r=t[1];return t[0]=e[0]*n+e[2]*r+e[4],t[1]=e[1]*n+e[3]*r+e[5],t}function yd(e,t,n,r,i,a,o,s){let c=Math.sin(a),l=Math.cos(a);return e[0]=r*l,e[1]=i*c,e[2]=-r*c,e[3]=i*l,e[4]=o*r*l-s*r*c+t,e[5]=o*i*c+s*i*l+n,e}function bd(e,t){let n=xd(t);U(n!==0,`Transformation matrix cannot be inverted`);let r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5];return e[0]=o/n,e[1]=-i/n,e[2]=-a/n,e[3]=r/n,e[4]=(a*c-o*s)/n,e[5]=-(r*c-i*s)/n,e}function xd(e){return e[0]*e[3]-e[1]*e[2]}var Sd=[1e5,1e5,1e5,1e5,2,2];function Cd(e){return`matrix(`+e.join(`, `)+`)`}function wd(e){return e.substring(7,e.length-1).split(`,`).map(parseFloat)}function Td(e,t){let n=wd(e),r=wd(t);for(let e=0;e<6;++e)if(Math.round((n[e]-r[e])*Sd[e])!==0)return!1;return!0}function Ed(e,t,n,r,i,a,o){a||=[],o||=2;let s=0;for(let c=t;c<n;c+=r){let t=e[c],n=e[c+1];a[s++]=i[0]*t+i[2]*n+i[4],a[s++]=i[1]*t+i[3]*n+i[5];for(let t=2;t<o;t++)a[s++]=e[c+t]}return a&&a.length!=s&&(a.length=s),a}function Dd(e,t,n,r,i,a,o){o||=[];let s=Math.cos(i),c=Math.sin(i),l=a[0],u=a[1],d=0;for(let i=t;i<n;i+=r){let t=e[i]-l,n=e[i+1]-u;o[d++]=l+t*s-n*c,o[d++]=u+t*c+n*s;for(let t=i+2;t<i+r;++t)o[d++]=e[t]}return o&&o.length!=d&&(o.length=d),o}function Od(e,t,n,r,i,a,o,s){s||=[];let c=o[0],l=o[1],u=0;for(let o=t;o<n;o+=r){let t=e[o]-c,n=e[o+1]-l;s[u++]=c+i*t,s[u++]=l+a*n;for(let t=o+2;t<o+r;++t)s[u++]=e[t]}return s&&s.length!=u&&(s.length=u),s}function kd(e,t,n,r,i,a,o){o||=[];let s=0;for(let c=t;c<n;c+=r){o[s++]=e[c]+i,o[s++]=e[c+1]+a;for(let t=c+2;t<c+r;++t)o[s++]=e[t]}return o&&o.length!=s&&(o.length=s),o}var Ad=gd(),jd=[NaN,NaN],Md=class extends rc{constructor(){super(),this.extent_=Yc(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=Xs((e,t,n)=>{if(!n)return this.getSimplifiedGeometry(t);let r=this.clone();return r.applyTransform(n),r.getSimplifiedGeometry(t)})}simplifyTransformed(e,t){return this.simplifyTransformedInternal(this.getRevision(),e,t)}clone(){return B()}closestPointXY(e,t,n,r){return B()}containsXY(e,t){return this.closestPointXY(e,t,jd,Number.MIN_VALUE)===0}getClosestPoint(e,t){return t||=[NaN,NaN],this.closestPointXY(e[0],e[1],t,1/0),t}intersectsCoordinate(e){return this.containsXY(e[0],e[1])}computeExtent(e){return B()}getExtent(e){if(this.extentRevision_!=this.getRevision()){let e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&Zc(e),this.extentRevision_=this.getRevision()}return bl(this.extent_,e)}rotate(e,t){B()}scale(e,t,n){B()}simplify(e){return this.getSimplifiedGeometry(e*e)}getSimplifiedGeometry(e){return B()}getType(){return B()}applyTransform(e){B()}intersectsExtent(e){return B()}translate(e,t){B()}transform(e,t){let n=Ju(e);if(!n)return this;let r=n.getUnits()==`tile-pixels`?function(e,r,i){let a=n.getExtent(),o=n.getWorldExtent(),s=pl(o)/pl(a);yd(Ad,o[0],o[3],s,-s,0,0,0);let c=Ed(e,0,e.length,i,Ad,r),l=id(n,t);return l?l(c,c,i):c}:id(n,t);return r&&this.applyTransform(r),this}},Nd=class extends Md{constructor(){super(),this.layout=`XY`,this.stride=2,this.flatCoordinates}computeExtent(e){return $c(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinates(){return B()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(e){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),e<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&e<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;let t=this.getSimplifiedGeometryInternal(e);return t.getFlatCoordinates().length<this.flatCoordinates.length?t:(this.simplifiedGeometryMaxMinSquaredTolerance=e,this)}getSimplifiedGeometryInternal(e){return this}getStride(){return this.stride}setFlatCoordinates(e,t){this.stride=Fd(e),this.layout=e,this.flatCoordinates=t}setCoordinates(e,t){B()}setLayout(e,t,n){let r;if(e)r=Fd(e);else{for(let e=0;e<n;++e){if(t.length===0){this.layout=`XY`,this.stride=2;return}t=t[0]}r=t.length,e=Pd(r)}this.layout=e,this.stride=r}applyTransform(e){this.flatCoordinates&&(e(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith(`XYZ`)?3:2,this.stride),this.changed())}rotate(e,t){let n=this.getFlatCoordinates();if(n){let r=this.getStride();Dd(n,0,n.length,r,e,t,n),this.changed()}}scale(e,t,n){t===void 0&&(t=e),n||=ll(this.getExtent());let r=this.getFlatCoordinates();if(r){let i=this.getStride();Od(r,0,r.length,i,e,t,n,r),this.changed()}}translate(e,t){let n=this.getFlatCoordinates();if(n){let r=this.getStride();kd(n,0,n.length,r,e,t,n),this.changed()}}};function Pd(e){let t;return e==2?t=`XY`:e==3?t=`XYZ`:e==4&&(t=`XYZM`),t}function Fd(e){let t;return e==`XY`?t=2:e==`XYZ`||e==`XYM`?t=3:e==`XYZM`&&(t=4),t}function Id(e,t,n){let r=e.getFlatCoordinates();if(!r)return null;let i=e.getStride();return Ed(r,0,r.length,i,t,n)}function Ld(e,t,n,r){let i=0,a=e[n-r],o=e[n-r+1],s=0,c=0;for(;t<n;t+=r){let n=e[t]-a,r=e[t+1]-o;i+=c*n-s*r,s=n,c=r}return i/2}function Rd(e,t,n,r){let i=0;for(let a=0,o=n.length;a<o;++a){let o=n[a];i+=Ld(e,t,o,r),t=o}return i}function zd(e,t,n,r,i,a,o){let s=e[t],c=e[t+1],l=e[n]-s,u=e[n+1]-c,d;if(l===0&&u===0)d=t;else{let f=((i-s)*l+(a-c)*u)/(l*l+u*u);if(f>1)d=n;else if(f>0){for(let i=0;i<r;++i)o[i]=Nc(e[t+i],e[n+i],f);o.length=r;return}else d=t}for(let t=0;t<r;++t)o[t]=e[d+t];o.length=r}function Bd(e,t,n,r,i){let a=e[t],o=e[t+1];for(t+=r;t<n;t+=r){let n=e[t],r=e[t+1],s=Oc(a,o,n,r);s>i&&(i=s),a=n,o=r}return i}function Vd(e,t,n,r,i){for(let a=0,o=n.length;a<o;++a){let o=n[a];i=Bd(e,t,o,r,i),t=o}return i}function Hd(e,t,n,r,i,a,o,s,c,l,u){if(t==n)return l;let d,f;if(i===0){if(f=Oc(o,s,e[t],e[t+1]),f<l){for(d=0;d<r;++d)c[d]=e[t+d];return c.length=r,f}return l}u||=[NaN,NaN];let p=t+r;for(;p<n;)if(zd(e,p-r,p,r,o,s,u),f=Oc(o,s,u[0],u[1]),f<l){for(l=f,d=0;d<r;++d)c[d]=u[d];c.length=r,p+=r}else p+=r*Math.max((Math.sqrt(f)-Math.sqrt(l))/i|0,1);if(a&&(zd(e,n-r,t,r,o,s,u),f=Oc(o,s,u[0],u[1]),f<l)){for(l=f,d=0;d<r;++d)c[d]=u[d];c.length=r}return l}function Ud(e,t,n,r,i,a,o,s,c,l,u){u||=[NaN,NaN];for(let d=0,f=n.length;d<f;++d){let f=n[d];l=Hd(e,t,f,r,i,a,o,s,c,l,u),t=f}return l}function Wd(e,t,n,r){for(let i=0;i<r;++i)e[t++]=n[i];return t}function Gd(e,t,n,r){for(let i=0,a=n.length;i<a;++i){let a=n[i];for(let n=0;n<r;++n)e[t++]=a[n]}return t}function Kd(e,t,n,r,i){i||=[];let a=0;for(let o=0,s=n.length;o<s;++o){let s=Gd(e,t,n[o],r);i[a++]=s,t=s}return i.length=a,i}function qd(e,t,n,r,i){i=i===void 0?[]:i;let a=0;for(let o=t;o<n;o+=r)i[a++]=e.slice(o,o+r);return i.length=a,i}function Jd(e,t,n,r,i){i=i===void 0?[]:i;let a=0;for(let o=0,s=n.length;o<s;++o){let s=n[o];i[a++]=qd(e,t,s,r,i[a]),t=s}return i.length=a,i}function Yd(e,t,n,r,i){i=i===void 0?[]:i;let a=0;for(let o=0,s=n.length;o<s;++o){let s=n[o];i[a++]=s.length===1&&s[0]===t?[]:Jd(e,t,s,r,i[a]),t=s[s.length-1]}return i.length=a,i}function Xd(e,t,n,r,i){return!al(i,function(i){return!Zd(e,t,n,r,i[0],i[1])})}function Zd(e,t,n,r,i,a){let o=0,s=e[n-r],c=e[n-r+1];for(;t<n;t+=r){let n=e[t],r=e[t+1];c<=a?r>a&&(n-s)*(a-c)-(i-s)*(r-c)>0&&o++:r<=a&&(n-s)*(a-c)-(i-s)*(r-c)<0&&o--,s=n,c=r}return o!==0}function Qd(e,t,n,r,i,a){if(n.length===0||!Zd(e,t,n[0],r,i,a))return!1;for(let t=1,o=n.length;t<o;++t)if(Zd(e,n[t-1],n[t],r,i,a))return!1;return!0}function $d(e,t,n,r,i){let a;for(t+=r;t<n;t+=r)if(a=i(e.slice(t-r,t),e.slice(t,t+r)),a)return a;return!1}function ef(e,t,n,r,i,a){return a??=rl(Yc(),e,t,n,r),vl(i,a)?a[0]>=i[0]&&a[2]<=i[2]||a[1]>=i[1]&&a[3]<=i[3]||$d(e,t,n,r,function(e,t){return xl(i,e,t)}):!1}function tf(e,t,n,r,i){return!!(ef(e,t,n,r,i)||Zd(e,t,n,r,i[0],i[1])||Zd(e,t,n,r,i[0],i[3])||Zd(e,t,n,r,i[2],i[1])||Zd(e,t,n,r,i[2],i[3]))}function nf(e,t,n,r,i){if(!tf(e,t,n[0],r,i))return!1;if(n.length===1)return!0;for(let t=1,a=n.length;t<a;++t)if(Xd(e,n[t-1],n[t],r,i)&&!ef(e,n[t-1],n[t],r,i))return!1;return!0}function rf(e,t,n,r,i,a,o){let s=(n-t)/r;if(s<3){for(;t<n;t+=r)a[o++]=e[t],a[o++]=e[t+1];return o}let c=Array(s);c[0]=1,c[s-1]=1;let l=[t,n-r],u=0;for(;l.length>0;){let n=l.pop(),a=l.pop(),o=0,s=e[a],d=e[a+1],f=e[n],p=e[n+1];for(let t=a+r;t<n;t+=r){let n=e[t],r=e[t+1],i=Dc(n,r,s,d,f,p);i>o&&(u=t,o=i)}o>i&&(c[(u-t)/r]=1,a+r<u&&l.push(a,u),u+r<n&&l.push(u,n))}for(let n=0;n<s;++n)c[n]&&(a[o++]=e[t+n*r],a[o++]=e[t+n*r+1]);return o}function af(e,t,n,r,i,a,o,s){for(let c=0,l=n.length;c<l;++c){let l=n[c];o=rf(e,t,l,r,i,a,o),s.push(o),t=l}return o}function of(e,t){return t*Math.round(e/t)}function sf(e,t,n,r,i,a,o){if(t==n)return o;let s=of(e[t],i),c=of(e[t+1],i);t+=r,a[o++]=s,a[o++]=c;let l,u;do if(l=of(e[t],i),u=of(e[t+1],i),t+=r,t==n)return a[o++]=l,a[o++]=u,o;while(l==s&&u==c);for(;t<n;){let n=of(e[t],i),d=of(e[t+1],i);if(t+=r,n==l&&d==u)continue;let f=l-s,p=u-c,m=n-s,h=d-c;f*h==p*m&&(f<0&&m<f||f==m||f>0&&m>f)&&(p<0&&h<p||p==h||p>0&&h>p)?(l=n,u=d):(a[o++]=l,a[o++]=u,s=l,c=u,l=n,u=d)}return a[o++]=l,a[o++]=u,o}function cf(e,t,n,r,i,a,o,s){for(let c=0,l=n.length;c<l;++c){let l=n[c];o=sf(e,t,l,r,i,a,o),s.push(o),t=l}return o}var lf=class e extends Nd{constructor(e,t){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}clone(){return new e(this.flatCoordinates.slice(),this.layout)}closestPointXY(e,t,n,r){return r<Wc(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Bd(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Hd(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,e,t,n,r))}getArea(){return Ld(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return qd(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){let n=[];return n.length=rf(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,n,0),new e(n,`XY`)}getType(){return`LinearRing`}intersectsExtent(e){return ef(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||=[],this.flatCoordinates.length=Gd(this.flatCoordinates,0,e,this.stride),this.changed()}},uf=class e extends Nd{constructor(e,t){super(),this.setCoordinates(e,t)}clone(){let t=new e(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(e,t,n,r){let i=this.flatCoordinates,a=Oc(e,t,i[0],i[1]);if(a<r){let e=this.stride;for(let t=0;t<e;++t)n[t]=i[t];return n.length=e,a}return r}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(e){return Qc(this.flatCoordinates,e)}getType(){return`Point`}intersectsExtent(e){return qc(e,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(e,t){this.setLayout(t,e,0),this.flatCoordinates||=[],this.flatCoordinates.length=Wd(this.flatCoordinates,0,e,this.stride),this.changed()}};function df(e,t,n,r,i,a,o){let s,c,l,u,d,f,p,m=i[a+1],h=[];for(let i=0,a=n.length;i<a;++i){let a=n[i];for(u=e[a-r],f=e[a-r+1],s=t;s<a;s+=r)d=e[s],p=e[s+1],(m<=f&&p<=m||f<=m&&m<=p)&&(l=(m-f)/(p-f)*(d-u)+u,h.push(l)),u=d,f=p}let g=NaN,_=-1/0;for(h.sort(Rs),u=h[0],s=1,c=h.length;s<c;++s){d=h[s];let i=Math.abs(d-u);i>_&&(l=(u+d)/2,Qd(e,t,n,r,l,m)&&(g=l,_=i)),u=d}return isNaN(g)&&(g=i[a]),o?(o.push(g,m,_),o):[g,m,_]}function ff(e,t,n,r,i){let a=[];for(let o=0,s=n.length;o<s;++o){let s=n[o];a=df(e,t,s,r,i,2*o,a),t=s[s.length-1]}return a}function pf(e,t,n,r){for(;t<n-r;){for(let i=0;i<r;++i){let a=e[t+i];e[t+i]=e[n-r+i],e[n-r+i]=a}t+=r,n-=r}}function mf(e,t,n,r){let i=0,a=e[n-r],o=e[n-r+1];for(;t<n;t+=r){let n=e[t],r=e[t+1];i+=(n-a)*(r+o),a=n,o=r}return i===0?void 0:i>0}function hf(e,t,n,r,i){i=i!==void 0&&i;for(let a=0,o=n.length;a<o;++a){let o=n[a],s=mf(e,t,o,r);if(a===0){if(i&&s||!i&&!s)return!1}else if(i&&!s||!i&&s)return!1;t=o}return!0}function gf(e,t,n,r,i){i=i!==void 0&&i;for(let a=0,o=n.length;a<o;++a){let o=n[a],s=mf(e,t,o,r);(a===0?i&&s||!i&&!s:i&&!s||!i&&s)&&pf(e,t,o,r),t=o}return t}function _f(e,t){let n=[],r=0,i=0,a;for(let o=0,s=t.length;o<s;++o){let s=t[o],c=mf(e,r,s,2);if(a===void 0&&(a=c),c===a)n.push(t.slice(i,o+1));else{if(n.length===0)continue;n[n.length-1].push(t[i])}i=o+1,r=s}return n}var vf=class e extends Nd{constructor(e,t,n){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,t!==void 0&&n?(this.setFlatCoordinates(t,e),this.ends_=n):this.setCoordinates(e,t)}appendLinearRing(e){this.flatCoordinates?Hs(this.flatCoordinates,e.getFlatCoordinates()):this.flatCoordinates=e.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){let t=new e(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(e,t,n,r){return r<Wc(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Vd(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Ud(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return Qd(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,t)}getArea(){return Rd(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(e){let t;return e===void 0?t=this.flatCoordinates:(t=this.getOrientedFlatCoordinates().slice(),gf(t,0,this.ends_,this.stride,e)),Jd(t,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){let e=ll(this.getExtent());this.flatInteriorPoint_=df(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new uf(this.getFlatInteriorPoint(),`XYM`)}getLinearRingCount(){return this.ends_.length}getLinearRing(e){return e<0||this.ends_.length<=e?null:new lf(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLinearRings(){let e=this.layout,t=this.flatCoordinates,n=this.ends_,r=[],i=0;for(let a=0,o=n.length;a<o;++a){let o=n[a],s=new lf(t.slice(i,o),e);r.push(s),i=o}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;hf(e,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=gf(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){let n=[],r=[];return n.length=cf(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),n,0,r),new e(n,`XY`,r)}getType(){return`Polygon`}intersectsExtent(e){return nf(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||=[];let n=Kd(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}};function yf(e){if(yl(e))throw Error(`Cannot create polygon from empty extent`);let t=e[0],n=e[1],r=e[2],i=e[3],a=[t,n,t,i,r,i,r,n,t,n];return new vf(a,`XY`,[a.length])}function bf(e,t,n,r){let i=G(t)/n[0],a=pl(t)/n[1];return r?Math.min(e,Math.max(i,a)):Math.min(e,Math.min(i,a))}function xf(e,t,n){let r=Math.min(e,t);return r*=Math.log(1+50*Math.max(0,e/t-1))/50+1,n&&(r=Math.max(r,n),r/=Math.log(1+50*Math.max(0,n/e-1))/50+1),W(r,n/2,t*2)}function Sf(e,t,n,r){return t=t===void 0||t,(function(i,a,o,s){if(i!==void 0){let c=e[0],l=e[e.length-1],u=n?bf(c,n,o,!!r):c;if(s)return t?xf(i,u,l):W(i,l,u);let d=Math.floor(Bs(e,Math.min(u,i),a));return e[d]>u&&d<e.length-1?e[d+1]:e[d]}})}function Cf(e,t,n,r,i,a){return r=r===void 0||r,n=n===void 0?0:n,(function(o,s,c,l){if(o!==void 0){let u=i?bf(t,i,c,!!a):t;if(l)return r?xf(o,u,n):W(o,n,u);let d=Math.ceil(Math.log(t/u)/Math.log(e)-1e-9),f=-s*.499999999+.5,p=Math.floor(Math.log(t/Math.min(u,o))/Math.log(e)+f);return W(t/e**+Math.max(d,p),n,u)}})}function wf(e,t,n,r,i){return n=n===void 0||n,(function(a,o,s,c){if(a!==void 0){let o=r?bf(e,r,s,!!i):e;return!n||!c?W(a,t,o):xf(a,o,t)}})}function Tf(e){if(e!==void 0)return 0}function Ef(e){if(e!==void 0)return e}function Df(e){let t=2*Math.PI/e;return(function(e,n){if(n)return e;if(e!==void 0)return e=Math.floor(e/t+.5)*t,e})}function Of(e){let t=e===void 0?jc(5):e;return(function(e,n){return n||e===void 0?e:Math.abs(e)<=t?0:e})}var kf=0,Af=class extends rc{constructor(e){super(),this.on,this.once,this.un,e=Object.assign({},e),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=Qu(e.projection,`EPSG:3857`),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,e.projection&&Wu(),e.center&&(e.center=ld(e.center,this.projection_)),e.extent&&(e.extent=dd(e.extent,this.projection_)),this.applyOptions_(e)}applyOptions_(e){let t=Object.assign({},e);for(let e in Ec)delete t[e];this.setProperties(t,!0);let n=Nf(e);this.maxResolution_=n.maxResolution,this.minResolution_=n.minResolution,this.zoomFactor_=n.zoomFactor,this.resolutions_=e.resolutions,this.padding_=e.padding,this.minZoom_=n.minZoom;let r=Mf(e),i=n.constraint,a=Pf(e);this.constraints_={center:r,resolution:i,rotation:a},this.setRotation(e.rotation===void 0?0:e.rotation),this.setCenterInternal(e.center===void 0?null:e.center),e.resolution===void 0?e.zoom!==void 0&&this.setZoom(e.zoom):this.setResolution(e.resolution)}get padding(){return this.padding_}set padding(e){let t=this.padding_;this.padding_=e;let n=this.getCenterInternal();if(n){let r=e||[0,0,0,0];t||=[0,0,0,0];let i=this.getResolution(),a=i/2*(r[3]-t[3]+t[1]-r[1]),o=i/2*(r[0]-t[0]+t[2]-r[2]);this.setCenterInternal([n[0]+a,n[1]-o])}}getUpdatedOptions_(e){let t=this.getProperties();return t.resolution===void 0?t.zoom=this.getZoom():t.resolution=this.getResolution(),t.center=this.getCenterInternal(),t.rotation=this.getRotation(),Object.assign({},t,e)}animate(e){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);let t=Array(arguments.length);for(let e=0;e<t.length;++e){let n=arguments[e];n.center&&(n=Object.assign({},n),n.center=ld(n.center,this.getProjection())),n.anchor&&(n=Object.assign({},n),n.anchor=ld(n.anchor,this.getProjection())),t[e]=n}this.animateInternal.apply(this,t)}animateInternal(e){let t=arguments.length,n;t>1&&typeof arguments[t-1]==`function`&&(n=arguments[t-1],--t);let r=0;for(;r<t&&!this.isDef();++r){let e=arguments[r];e.center&&this.setCenterInternal(e.center),e.zoom===void 0?e.resolution&&this.setResolution(e.resolution):this.setZoom(e.zoom),e.rotation!==void 0&&this.setRotation(e.rotation)}if(r===t){n&&jf(n,!0);return}let i=Date.now(),a=this.targetCenter_.slice(),o=this.targetResolution_,s=this.targetRotation_,c=[];for(;r<t;++r){let e=arguments[r],t={start:i,complete:!1,anchor:e.anchor,duration:e.duration===void 0?1e3:e.duration,easing:e.easing||Fl,callback:n};if(e.center&&(t.sourceCenter=a,t.targetCenter=e.center.slice(),a=t.targetCenter),e.zoom===void 0?e.resolution&&(t.sourceResolution=o,t.targetResolution=e.resolution,o=t.targetResolution):(t.sourceResolution=o,t.targetResolution=this.getResolutionForZoom(e.zoom),o=t.targetResolution),e.rotation!==void 0){t.sourceRotation=s;let n=Mc(e.rotation-s+Math.PI,2*Math.PI)-Math.PI;t.targetRotation=s+n,s=t.targetRotation}Ff(t)?t.complete=!0:i+=t.duration,c.push(t)}this.animations_.push(c),this.setHint(Tc.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[Tc.ANIMATING]>0}getInteracting(){return this.hints_[Tc.INTERACTING]>0}cancelAnimations(){this.setHint(Tc.ANIMATING,-this.hints_[Tc.ANIMATING]);let e;for(let t=0,n=this.animations_.length;t<n;++t){let n=this.animations_[t];if(n[0].callback&&jf(n[0].callback,!1),!e)for(let t=0,r=n.length;t<r;++t){let r=n[t];if(!r.complete){e=r.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=e,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;let e=Date.now(),t=!1;for(let n=this.animations_.length-1;n>=0;--n){let r=this.animations_[n],i=!0;for(let n=0,a=r.length;n<a;++n){let a=r[n];if(a.complete)continue;let o=e-a.start,s=a.duration>0?o/a.duration:1;s>=1?(a.complete=!0,s=1):i=!1;let c=a.easing(s);if(a.sourceCenter){let e=a.sourceCenter[0],t=a.sourceCenter[1],n=a.targetCenter[0],r=a.targetCenter[1];this.nextCenter_=a.targetCenter;let i=e+c*(n-e),o=t+c*(r-t);this.targetCenter_=[i,o]}if(a.sourceResolution&&a.targetResolution){let e=c===1?a.targetResolution:a.sourceResolution+c*(a.targetResolution-a.sourceResolution);if(a.anchor){let t=this.getViewportSize_(this.getRotation()),n=this.constraints_.resolution(e,0,t,!0);this.targetCenter_=this.calculateCenterZoom(n,a.anchor)}this.nextResolution_=a.targetResolution,this.targetResolution_=e,this.applyTargetState_(!0)}if(a.sourceRotation!==void 0&&a.targetRotation!==void 0){let e=c===1?Mc(a.targetRotation+Math.PI,2*Math.PI)-Math.PI:a.sourceRotation+c*(a.targetRotation-a.sourceRotation);if(a.anchor){let t=this.constraints_.rotation(e,!0);this.targetCenter_=this.calculateCenterRotate(t,a.anchor)}this.nextRotation_=a.targetRotation,this.targetRotation_=e}if(this.applyTargetState_(!0),t=!0,!a.complete)break}if(i){this.animations_[n]=null,this.setHint(Tc.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let e=r[0].callback;e&&jf(e,!0)}}this.animations_=this.animations_.filter(Boolean),t&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(e,t){let n,r=this.getCenterInternal();return r!==void 0&&(n=[r[0]-t[0],r[1]-t[1]],Dl(n,e-this.getRotation()),Tl(n,t)),n}calculateCenterZoom(e,t){let n,r=this.getCenterInternal(),i=this.getResolution();return r!==void 0&&i!==void 0&&(n=[t[0]-e*(t[0]-r[0])/i,t[1]-e*(t[1]-r[1])/i]),n}getViewportSize_(e){let t=this.viewportSize_;if(e){let n=t[0],r=t[1];return[Math.abs(n*Math.cos(e))+Math.abs(r*Math.sin(e)),Math.abs(n*Math.sin(e))+Math.abs(r*Math.cos(e))]}return t}setViewportSize(e){this.viewportSize_=Array.isArray(e)?e.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){let e=this.getCenterInternal();return e&&cd(e,this.getProjection())}getCenterInternal(){return this.get(Ec.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get(`constrainResolution`)}getHints(e){return e===void 0?this.hints_.slice():(e[0]=this.hints_[0],e[1]=this.hints_[1],e)}calculateExtent(e){return ud(this.calculateExtentInternal(e),this.getProjection())}calculateExtentInternal(e){e||=this.getViewportSizeMinusPadding_();let t=this.getCenterInternal();U(t,`The view center is not defined`);let n=this.getResolution();U(n!==void 0,`The view resolution is not defined`);let r=this.getRotation();return U(r!==void 0,`The view rotation is not defined`),dl(t,n,r,e)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(e){this.applyOptions_(this.getUpdatedOptions_({maxZoom:e}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(e){this.applyOptions_(this.getUpdatedOptions_({minZoom:e}))}setConstrainResolution(e){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:e}))}getProjection(){return this.projection_}getResolution(){return this.get(Ec.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(dd(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t||=this.getViewportSizeMinusPadding_();let n=G(e)/t[0],r=pl(e)/t[1];return Math.max(n,r)}getResolutionForValueFunction(e){e||=2;let t=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(t/n)/Math.log(e);return(function(n){return t/e**+(n*r)})}getRotation(){return this.get(Ec.ROTATION)}getValueForResolutionFunction(e){let t=Math.log(e||2),n=this.getConstrainedResolution(this.maxResolution_),r=this.minResolution_,i=Math.log(n/r)/t;return(function(e){return Math.log(n/e)/t/i})}getViewportSizeMinusPadding_(e){let t=this.getViewportSize_(e),n=this.padding_;return n&&(t=[t[0]-n[1]-n[3],t[1]-n[0]-n[2]]),t}getState(){let e=this.getProjection(),t=this.getResolution(),n=this.getRotation(),r=this.getCenterInternal(),i=this.padding_;if(i){let e=this.getViewportSizeMinusPadding_();r=If(r,this.getViewportSize_(),[e[0]/2+i[3],e[1]/2+i[0]],t,n)}return{center:r.slice(0),projection:e===void 0?null:e,resolution:t,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:n,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let e,t=this.getResolution();return t!==void 0&&(e=this.getZoomForResolution(t)),e}getZoomForResolution(e){let t=this.minZoom_||0,n,r;if(this.resolutions_){let i=Bs(this.resolutions_,e,1);t=i,n=this.resolutions_[i],r=i==this.resolutions_.length-1?2:n/this.resolutions_[i+1]}else n=this.maxResolution_,r=this.zoomFactor_;return t+Math.log(n/e)/Math.log(r)}getResolutionForZoom(e){if(this.resolutions_?.length){if(this.resolutions_.length===1)return this.resolutions_[0];let t=W(Math.floor(e),0,this.resolutions_.length-2),n=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/n**+W(e-t,0,1)}return this.maxResolution_/this.zoomFactor_**+(e-this.minZoom_)}fit(e,t){let n;if(U(Array.isArray(e)||typeof e.getSimplifiedGeometry==`function`,"Invalid extent or geometry provided as `geometry`"),Array.isArray(e))U(!yl(e),"Cannot fit empty extent provided as `geometry`"),n=yf(dd(e,this.getProjection()));else if(e.getType()===`Circle`){let t=dd(e.getExtent(),this.getProjection());n=yf(t),n.rotate(this.getRotation(),ll(t))}else{let t=sd();n=t?e.clone().transform(t,this.getProjection()):e}this.fitInternal(n,t)}rotatedExtentForGeometry(e){let t=this.getRotation(),n=Math.cos(t),r=Math.sin(-t),i=e.getFlatCoordinates(),a=e.getStride(),o=1/0,s=1/0,c=-1/0,l=-1/0;for(let e=0,t=i.length;e<t;e+=a){let t=i[e]*n-i[e+1]*r,a=i[e]*r+i[e+1]*n;o=Math.min(o,t),s=Math.min(s,a),c=Math.max(c,t),l=Math.max(l,a)}return[o,s,c,l]}fitInternal(e,t){t||={};let n=t.size;n||=this.getViewportSizeMinusPadding_();let r=t.padding===void 0?[0,0,0,0]:t.padding,i=t.nearest!==void 0&&t.nearest,a;a=t.minResolution===void 0?t.maxZoom===void 0?0:this.getResolutionForZoom(t.maxZoom):t.minResolution;let o=this.rotatedExtentForGeometry(e),s=this.getResolutionForExtentInternal(o,[n[0]-r[1]-r[3],n[1]-r[0]-r[2]]);s=isNaN(s)?a:Math.max(s,a),s=this.getConstrainedResolution(s,+!i);let c=this.getRotation(),l=Math.sin(c),u=Math.cos(c),d=ll(o);d[0]+=(r[1]-r[3])/2*s,d[1]+=(r[0]-r[2])/2*s;let f=d[0]*u-d[1]*l,p=d[1]*u+d[0]*l,m=this.getConstrainedCenter([f,p],s),h=t.callback?t.callback:Ys;t.duration===void 0?(this.targetResolution_=s,this.targetCenter_=m,this.applyTargetState_(!1,!0),jf(h,!0)):this.animateInternal({resolution:s,center:m,duration:t.duration,easing:t.easing},h)}centerOn(e,t,n){this.centerOnInternal(ld(e,this.getProjection()),t,n)}centerOnInternal(e,t,n){this.setCenterInternal(If(e,t,n,this.getResolution(),this.getRotation()))}calculateCenterShift(e,t,n,r){let i,a=this.padding_;if(a&&e){let o=this.getViewportSizeMinusPadding_(-n),s=If(e,r,[o[0]/2+a[3],o[1]/2+a[0]],t,n);i=[e[0]-s[0],e[1]-s[1]]}return i}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(e){let t=cd(this.targetCenter_,this.getProjection());this.setCenter([t[0]+e[0],t[1]+e[1]])}adjustCenterInternal(e){let t=this.targetCenter_;this.setCenterInternal([t[0]+e[0],t[1]+e[1]])}adjustResolution(e,t){t&&=ld(t,this.getProjection()),this.adjustResolutionInternal(e,t)}adjustResolutionInternal(e,t){let n=this.getAnimating()||this.getInteracting(),r=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(this.targetResolution_*e,0,r,n);t&&(this.targetCenter_=this.calculateCenterZoom(i,t)),this.targetResolution_*=e,this.applyTargetState_()}adjustZoom(e,t){this.adjustResolution(this.zoomFactor_**+-e,t)}adjustRotation(e,t){t&&=ld(t,this.getProjection()),this.adjustRotationInternal(e,t)}adjustRotationInternal(e,t){let n=this.getAnimating()||this.getInteracting(),r=this.constraints_.rotation(this.targetRotation_+e,n);t&&(this.targetCenter_=this.calculateCenterRotate(r,t)),this.targetRotation_+=e,this.applyTargetState_()}setCenter(e){this.setCenterInternal(e&&ld(e,this.getProjection()))}setCenterInternal(e){this.targetCenter_=e,this.applyTargetState_()}setHint(e,t){return this.hints_[e]+=t,this.changed(),this.hints_[e]}setResolution(e){this.targetResolution_=e,this.applyTargetState_()}setRotation(e){this.targetRotation_=e,this.applyTargetState_()}setZoom(e){this.setResolution(this.getResolutionForZoom(e))}applyTargetState_(e,t){let n=this.getAnimating()||this.getInteracting()||t,r=this.constraints_.rotation(this.targetRotation_,n),i=this.getViewportSize_(r),a=this.constraints_.resolution(this.targetResolution_,0,i,n),o=this.constraints_.center(this.targetCenter_,a,i,n,this.calculateCenterShift(this.targetCenter_,a,r,i));this.get(Ec.ROTATION)!==r&&this.set(Ec.ROTATION,r),this.get(Ec.RESOLUTION)!==a&&(this.set(Ec.RESOLUTION,a),this.set(`zoom`,this.getZoom(),!0)),(!o||!this.get(Ec.CENTER)||!El(this.get(Ec.CENTER),o))&&this.set(Ec.CENTER,o),this.getAnimating()&&!e&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(e,t,n){e=e===void 0?200:e;let r=t||0,i=this.constraints_.rotation(this.targetRotation_),a=this.getViewportSize_(i),o=this.constraints_.resolution(this.targetResolution_,r,a),s=this.constraints_.center(this.targetCenter_,o,a,!1,this.calculateCenterShift(this.targetCenter_,o,i,a));e===0&&!this.cancelAnchor_?(this.targetResolution_=o,this.targetRotation_=i,this.targetCenter_=s,this.applyTargetState_()):(n||=e===0?this.cancelAnchor_:void 0,this.cancelAnchor_=void 0,(this.getResolution()!==o||this.getRotation()!==i||!this.getCenterInternal()||!El(this.getCenterInternal(),s))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:i,center:s,resolution:o,duration:e,easing:Pl,anchor:n})))}beginInteraction(){this.resolveConstraints(0),this.setHint(Tc.INTERACTING,1)}endInteraction(e,t,n){n&&=ld(n,this.getProjection()),this.endInteractionInternal(e,t,n)}endInteractionInternal(e,t,n){this.getInteracting()&&(this.setHint(Tc.INTERACTING,-1),this.resolveConstraints(e,t,n))}getConstrainedCenter(e,t){let n=this.getViewportSize_(this.getRotation());return this.constraints_.center(e,t||this.getResolution(),n)}getConstrainedZoom(e,t){let n=this.getResolutionForZoom(e);return this.getZoomForResolution(this.getConstrainedResolution(n,t))}getConstrainedResolution(e,t){t||=0;let n=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(e,t,n)}};function jf(e,t){setTimeout(function(){e(t)},0)}function Mf(e){if(e.extent!==void 0){let t=e.smoothExtentConstraint===void 0||e.smoothExtentConstraint;return Rc(e.extent,e.constrainOnlyCenter,t)}let t=Qu(e.projection,`EPSG:3857`);if(e.multiWorld!==!0&&t.isGlobal()){let e=t.getExtent().slice();return e[0]=-1/0,e[2]=1/0,Rc(e,!1,!1)}return zc}function Nf(e){let t,n,r,i=e.minZoom===void 0?kf:e.minZoom,a=e.maxZoom===void 0?28:e.maxZoom,o=e.zoomFactor===void 0?2:e.zoomFactor,s=e.multiWorld!==void 0&&e.multiWorld,c=e.smoothResolutionConstraint===void 0||e.smoothResolutionConstraint,l=e.showFullExtent!==void 0&&e.showFullExtent,u=Qu(e.projection,`EPSG:3857`),d=u.getExtent(),f=e.constrainOnlyCenter,p=e.extent;if(!s&&!p&&u.isGlobal()&&(f=!1,p=d),e.resolutions!==void 0){let o=e.resolutions;n=o[i],r=o[a]===void 0?o[o.length-1]:o[a],t=e.constrainResolution?Sf(o,c,!f&&p,l):wf(n,r,c,!f&&p,l)}else{let s=(d?Math.max(G(d),pl(d)):360*Vl.degrees/u.getMetersPerUnit())/256/2**kf,m=s/2**28;n=e.maxResolution,n===void 0?n=s/o**+i:i=0,r=e.minResolution,r===void 0&&(r=e.maxZoom===void 0?m:e.maxResolution===void 0?s/o**+a:n/o**+a),a=i+Math.floor(Math.log(n/r)/Math.log(o)),r=n/o**+(a-i),t=e.constrainResolution?Cf(o,n,r,c,!f&&p,l):wf(n,r,c,!f&&p,l)}return{constraint:t,maxResolution:n,minResolution:r,minZoom:i,zoomFactor:o}}function Pf(e){if(e.enableRotation===void 0||e.enableRotation){let t=e.constrainRotation;return t===void 0||t===!0?Of():t===!1?Ef:typeof t==`number`?Df(t):Ef}return Tf}function Ff(e){return!(e.sourceCenter&&e.targetCenter&&!El(e.sourceCenter,e.targetCenter)||e.sourceResolution!==e.targetResolution||e.sourceRotation!==e.targetRotation)}function If(e,t,n,r,i){let a=Math.cos(-i),o=Math.sin(-i),s=e[0]*a-e[1]*o,c=e[1]*a+e[0]*o;return s+=(t[0]/2-n[0])*r,c+=(n[1]-t[1]/2)*r,o=-o,[s*a-c*o,c*a+s*o]}var Lf=`ol-hidden`,Rf=`ol-unselectable`,zf=`ol-control`,Bf=`ol-collapsed`,Vf=new RegExp([`^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)`,`(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)`,`(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)`,`(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?`,`(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))`,`(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))`,`?\\s*([-,\\"\\'\\sa-z0-9]+?)\\s*$`].join(``),`i`),Hf=[`style`,`variant`,`weight`,`size`,`lineHeight`,`family`],Uf={normal:400,bold:700},Wf=function(e){let t=e.match(Vf);if(!t)return null;let n={lineHeight:`normal`,size:`1.2em`,style:`normal`,weight:`400`,variant:`normal`};for(let e=0,r=Hf.length;e<r;++e){let r=t[e+1];r!==void 0&&(n[Hf[e]]=typeof r==`string`?r.trim():r)}return isNaN(Number(n.weight))&&n.weight in Uf&&(n.weight=Uf[n.weight]),n.families=n.family.split(/,\s?/).map(e=>e.trim().replace(/^['"]|['"]$/g,``)),n};function Gf(e,t,n,r){let i;return i=n&&n.length?n.shift():mc?new class extends OffscreenCanvas{style={}}(e??300,t??150):document.createElement(`canvas`),e&&(i.width=e),t&&(i.height=t),i.getContext(`2d`,r)}var Kf;function qf(){return Kf||=Gf(1,1),Kf}function Jf(e){let t=e.canvas;t.width=1,t.height=1,e.clearRect(0,0,1,1)}function Yf(e,t){let n=t.parentNode;n&&n.replaceChild(e,t)}function Xf(e){for(;e.lastChild;)e.lastChild.remove()}function Zf(e,t){let n=e.childNodes;for(let r=0;;++r){let i=n[r],a=t[r];if(!i&&!a)break;i!==a&&(i?a?e.insertBefore(a,i):(e.removeChild(i),--r):e.appendChild(a))}}function Qf(){return new Proxy({childNodes:[],appendChild:function(e){return this.childNodes.push(e),e},remove:function(){},removeChild:function(e){let t=this.childNodes.indexOf(e);if(t===-1)throw Error(`Node to remove was not found`);return this.childNodes.splice(t,1),e},insertBefore:function(e,t){let n=this.childNodes.indexOf(t);if(n===-1)throw Error(`Reference node not found`);return this.childNodes.splice(n,0,e),e},style:{}},{get(e,t,n){return t===`firstElementChild`?e.childNodes.length>0?e.childNodes[0]:null:Reflect.get(e,t,n)}})}function $f(e){return typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof OffscreenCanvas<`u`&&e instanceof OffscreenCanvas}var ep=class extends rc{constructor(e){super();let t=e.element;t&&!e.target&&!t.style.pointerEvents&&(t.style.pointerEvents=`auto`),this.element=t||null,this.target_=null,this.map_=null,this.listenerKeys=[],e.render&&(this.render=e.render),e.target&&this.setTarget(e.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(e){this.map_&&this.element?.remove();for(let e=0,t=this.listenerKeys.length;e<t;++e)R(this.listenerKeys[e]);if(this.listenerKeys.length=0,this.map_=e,e){let t=this.target_??e.getOverlayContainerStopEvent();this.element&&t&&t.appendChild(this.element),this.render!==Ys&&this.listenerKeys.push(L(e,yc.POSTRENDER,this.render,this)),e.render()}}render(e){}setTarget(e){this.target_=typeof e==`string`?document.getElementById(e):e}},tp=class extends ep{constructor(e){e||={},super({element:document.createElement(`div`),render:e.render,target:e.target}),this.ulElement_=document.createElement(`ul`),this.collapsed_=e.collapsed===void 0||e.collapsed,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=e.collapsible!==void 0,this.collapsible_=e.collapsible===void 0||e.collapsible,this.collapsible_||(this.collapsed_=!1),this.attributions_=e.attributions;let t=e.className===void 0?`ol-attribution`:e.className,n=e.tipLabel===void 0?`Attributions`:e.tipLabel,r=e.expandClassName===void 0?t+`-expand`:e.expandClassName,i=e.collapseLabel===void 0?`›`:e.collapseLabel,a=e.collapseClassName===void 0?t+`-collapse`:e.collapseClassName;typeof i==`string`?(this.collapseLabel_=document.createElement(`span`),this.collapseLabel_.textContent=i,this.collapseLabel_.className=a):this.collapseLabel_=i;let o=e.label===void 0?`i`:e.label;typeof o==`string`?(this.label_=document.createElement(`span`),this.label_.textContent=o,this.label_.className=r):this.label_=o;let s=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement(`button`),this.toggleButton_.setAttribute(`type`,`button`),this.toggleButton_.setAttribute(`aria-expanded`,String(!this.collapsed_)),this.toggleButton_.title=n,this.toggleButton_.appendChild(s),this.toggleButton_.addEventListener(z.CLICK,this.handleClick_.bind(this),!1);let c=t+` `+Rf+` `+zf+(this.collapsed_&&this.collapsible_?` `+Bf:``)+(this.collapsible_?``:` ol-uncollapsible`),l=this.element;l.className=c,l.appendChild(this.toggleButton_),l.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(e){let t=this.getMap();if(!t)return[];let n=t.getAllLayers(),r=new Set(n.flatMap(t=>t.getAttributions(e)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(e=>r.add(e)):r.add(this.attributions_)),!this.overrideCollapsible_){let e=!n.some(e=>e.getSource()?.getAttributionsCollapsible()===!1);this.setCollapsible(e)}return Array.from(r)}async updateElement_(e){let t=this.element;if(!t)return;if(!e){this.renderedVisible_&&=(t.style.display=`none`,!1);return}let n=await Promise.all(this.collectSourceAttributions_(e).map(e=>Zs(()=>e))),r=n.length>0;if(this.renderedVisible_!=r&&(t.style.display=r?``:`none`,this.renderedVisible_=r),!Us(n,this.renderedAttributions_)){Xf(this.ulElement_);for(let e=0,t=n.length;e<t;++e){let t=document.createElement(`li`);t.innerHTML=n[e],this.ulElement_.appendChild(t)}this.renderedAttributions_=n}}handleClick_(e){e.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){let e=this.element;e&&(e.classList.toggle(Bf),this.collapsed_?Yf(this.collapseLabel_,this.label_):Yf(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute(`aria-expanded`,String(!this.collapsed_)))}getCollapsible(){return this.collapsible_}setCollapsible(e){if(this.collapsible_===e)return;this.collapsible_=e;let t=this.element;t&&(t.classList.toggle(`ol-uncollapsible`),this.userCollapsed_&&this.handleToggle_())}setCollapsed(e){this.userCollapsed_=e,this.collapsible_&&this.collapsed_!==e&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(e){this.updateElement_(e.frameState)}},np=class extends ep{constructor(e){e||={},super({element:document.createElement(`div`),render:e.render,target:e.target});let t=e.className===void 0?`ol-rotate`:e.className,n=e.label===void 0?`⇧`:e.label,r=e.compassClassName===void 0?`ol-compass`:e.compassClassName;this.label_,typeof n==`string`?(this.label_=document.createElement(`span`),this.label_.className=r,this.label_.textContent=n):(this.label_=n,this.label_.classList.add(r));let i=e.tipLabel?e.tipLabel:`Reset rotation`,a=document.createElement(`button`);a.className=t+`-reset`,a.setAttribute(`type`,`button`),a.title=i,a.appendChild(this.label_),a.addEventListener(z.CLICK,this.handleClick_.bind(this),!1);let o=t+` `+Rf+` `+zf,s=this.element;s.className=o,s.appendChild(a),this.callResetNorth_=e.resetNorth?e.resetNorth:void 0,this.duration_=e.duration===void 0?250:e.duration,this.autoHide_=e.autoHide===void 0||e.autoHide,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(Lf)}handleClick_(e){e.preventDefault(),this.callResetNorth_===void 0?this.resetNorth_():this.callResetNorth_()}resetNorth_(){let e=this.getMap();if(!e)return;let t=e.getView();if(!t)return;let n=t.getRotation();n!==void 0&&(this.duration_>0&&n%(2*Math.PI)!=0?t.animate({rotation:0,duration:this.duration_,easing:Pl}):t.setRotation(0))}render(e){let t=e.frameState;if(!t)return;let n=t.viewState.rotation;if(n!=this.rotation_){let e=`rotate(`+n+`rad)`,t=this.element;if(this.autoHide_&&t){let e=t.classList.contains(Lf);!e&&n===0?t.classList.add(Lf):e&&n!==0&&t.classList.remove(Lf)}this.label_.style.transform=e}this.rotation_=n}},rp=class extends ep{constructor(e){e||={},super({element:document.createElement(`div`),target:e.target});let t=e.className===void 0?`ol-zoom`:e.className,n=e.delta===void 0?1:e.delta,r=e.zoomInClassName===void 0?t+`-in`:e.zoomInClassName,i=e.zoomOutClassName===void 0?t+`-out`:e.zoomOutClassName,a=e.zoomInLabel===void 0?`+`:e.zoomInLabel,o=e.zoomOutLabel===void 0?`–`:e.zoomOutLabel,s=e.zoomInTipLabel===void 0?`Zoom in`:e.zoomInTipLabel,c=e.zoomOutTipLabel===void 0?`Zoom out`:e.zoomOutTipLabel,l=document.createElement(`button`);l.className=r,l.setAttribute(`type`,`button`),l.title=s,l.appendChild(typeof a==`string`?document.createTextNode(a):a),l.addEventListener(z.CLICK,this.handleClick_.bind(this,n),!1);let u=document.createElement(`button`);u.className=i,u.setAttribute(`type`,`button`),u.title=c,u.appendChild(typeof o==`string`?document.createTextNode(o):o),u.addEventListener(z.CLICK,this.handleClick_.bind(this,-n),!1);let d=t+` `+Rf+` `+zf,f=this.element;f.className=d,f.appendChild(l),f.appendChild(u),this.duration_=e.duration===void 0?250:e.duration}handleClick_(e,t){t.preventDefault(),this.zoomByDelta_(e)}zoomByDelta_(e){let t=this.getMap();if(!t)return;let n=t.getView();if(!n)return;let r=n.getZoom();if(r!==void 0){let t=n.getConstrainedZoom(r+e);if(t===void 0)return;this.duration_>0?(n.getAnimating()&&n.cancelAnimations(),n.animate({zoom:t,duration:this.duration_,easing:Pl})):n.setZoom(t)}}};function ip(e){e||={};let t=new oc;return(e.zoom===void 0||e.zoom)&&t.push(new rp(e.zoomOptions)),(e.rotate===void 0||e.rotate)&&t.push(new np(e.rotateOptions)),(e.attribution===void 0||e.attribution)&&t.push(new tp(e.attributionOptions)),t}var ap=class{constructor(e,t,n){this.decay_=e,this.minVelocity_=t,this.delay_=n,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(e,t){this.points_.push(e,t,Date.now())}end(){if(this.points_.length<6)return!1;let e=Date.now()-this.delay_,t=this.points_.length-3;if(this.points_[t+2]<e)return!1;let n=t-3;for(;n>0&&this.points_[n+2]>e;)n-=3;let r=this.points_[t+2]-this.points_[n+2];if(r<1e3/60)return!1;let i=this.points_[t]-this.points_[n],a=this.points_[t+1]-this.points_[n+1];return this.angle_=Math.atan2(a,i),this.initialVelocity_=Math.sqrt(i*i+a*a)/r,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}},op={ACTIVE:`active`},sp=class extends rc{constructor(e){super(),this.on,this.once,this.un,e&&e.handleEvent&&(this.handleEvent=e.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(op.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(op.ACTIVE,e)}setMap(e){this.map_=e}};function cp(e,t,n){let r=e.getCenterInternal();if(r){let i=[r[0]+t[0],r[1]+t[1]];e.animateInternal({duration:n===void 0?250:n,easing:Il,center:e.getConstrainedCenter(i)})}}function lp(e,t,n,r){let i=e.getZoom();if(i===void 0)return;let a=e.getConstrainedZoom(i+t);if(a===void 0)return;let o=e.getResolutionForZoom(a);o!==void 0&&(e.getAnimating()&&e.cancelAnimations(),e.animate({resolution:o,anchor:n,duration:r===void 0?250:r,easing:Pl}))}var up=class extends sp{constructor(e){super(),e||={},this.delta_=e.delta?e.delta:1,this.duration_=e.duration===void 0?250:e.duration}handleEvent(e){let t=!1;if(e.type==lc.DBLCLICK){let n=e.originalEvent,r=e.map,i=e.coordinate,a=n.shiftKey?-this.delta_:this.delta_;lp(r.getView(),a,i,this.duration_),n.preventDefault(),t=!0}return!t}};function dp(e){let t=arguments;return function(e){let n=!0;for(let r=0,i=t.length;r<i&&(n&&=t[r](e),n);++r);return n}}var fp=function(e){let t=e.originalEvent;return t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},pp=function(e){let t=e.map.getTargetElement();if(!t)return!1;let n=t.getRootNode(),r=e.map.getOwnerDocument().activeElement;return n instanceof ShadowRoot?n.host.contains(r):t.contains(r)},mp=function(e){let t=e.map.getTargetElement();if(!t)return!0;let n=t.getRootNode();return!(n instanceof ShadowRoot?n.host:t).hasAttribute(`tabindex`)||pp(e)},hp=qs,gp=function(e){let t=e.originalEvent;return`pointerId`in t&&t.button==0&&!(dc&&fc&&t.ctrlKey)},_p=function(e){let t=e.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&!t.shiftKey},vp=function(e){let t=e.originalEvent;return fc?t.metaKey:t.ctrlKey},yp=function(e){let t=e.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},bp=function(e){let t=e.originalEvent,n=t.target.tagName;return n!==`INPUT`&&n!==`SELECT`&&n!==`TEXTAREA`&&!t.target.isContentEditable},xp=function(e){let t=e.originalEvent;return`pointerId`in t&&t.pointerType==`mouse`},Sp=function(e){let t=e.originalEvent;return`pointerId`in t&&t.isPrimary&&t.button===0},Cp=class extends sp{constructor(e){e||={},super(e),e.handleDownEvent&&(this.handleDownEvent=e.handleDownEvent),e.handleDragEvent&&(this.handleDragEvent=e.handleDragEvent),e.handleMoveEvent&&(this.handleMoveEvent=e.handleMoveEvent),e.handleUpEvent&&(this.handleUpEvent=e.handleUpEvent),e.stopDown&&(this.stopDown=e.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(e){return!1}handleDragEvent(e){}handleEvent(e){if(!e.originalEvent)return!0;let t=!1;if(this.updateTrackedPointers_(e),this.handlingDownUpSequence){if(e.type==lc.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==lc.POINTERUP){let t=this.handleUpEvent(e);this.handlingDownUpSequence=t&&this.targetPointers.length>0}}else if(e.type==lc.POINTERDOWN){let n=this.handleDownEvent(e);this.handlingDownUpSequence=n,t=this.stopDown(n)}else e.type==lc.POINTERMOVE&&this.handleMoveEvent(e);return!t}handleMoveEvent(e){}handleUpEvent(e){return!1}stopDown(e){return e}updateTrackedPointers_(e){e.activePointers&&(this.targetPointers=e.activePointers)}};function wp(e){let t=e.length,n=0,r=0;for(let i=0;i<t;i++)n+=e[i].clientX,r+=e[i].clientY;return{clientX:n/t,clientY:r/t}}var Tp=class extends Cp{constructor(e){super({stopDown:Js}),e||={},this.kinetic_=e.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;let t=e.condition?e.condition:dp(_p,Sp);this.condition_=e.onFocusOnly?dp(mp,t):t,this.noKinetic_=!1}handleDragEvent(e){let t=e.map;this.panning_||(this.panning_=!0,t.getView().beginInteraction());let n=this.targetPointers,r=t.getEventPixel(wp(n));if(n.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(r[0],r[1]),this.lastCentroid){let t=[this.lastCentroid[0]-r[0],r[1]-this.lastCentroid[1]],n=e.map.getView(),i=n.getResolution();i!==void 0&&(Ol(t,i),Dl(t,n.getRotation()),n.adjustCenterInternal(t))}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=r,this.lastPointersCount_=n.length,e.originalEvent.preventDefault()}handleUpEvent(e){let t=e.map,n=t.getView();if(this.targetPointers.length===0){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){let e=this.kinetic_.getDistance(),r=this.kinetic_.getAngle(),i=n.getCenterInternal();if(i){let a=t.getPixelFromCoordinateInternal(i),o=t.getCoordinateFromPixelInternal([a[0]-e*Math.cos(r),a[1]-e*Math.sin(r)]);n.animateInternal({center:n.getConstrainedCenter(o),duration:500,easing:Pl})}}return this.panning_&&(this.panning_=!1,n.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(e){if(this.targetPointers.length>0&&this.condition_(e)){let t=e.map.getView();return this.lastCentroid=null,t.getAnimating()&&t.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}},Ep=class extends Cp{constructor(e){e||={},super({stopDown:Js}),this.condition_=e.condition?e.condition:fp,this.lastAngle_=void 0,this.duration_=e.duration===void 0?250:e.duration}handleDragEvent(e){if(!xp(e))return;let t=e.map,n=t.getView();if(n.getConstraints().rotation===Tf)return;let r=t.getSize();if(!r)return;let i=e.pixel,a=Math.atan2(r[1]/2-i[1],i[0]-r[0]/2);if(this.lastAngle_!==void 0){let e=a-this.lastAngle_;n.adjustRotationInternal(-e)}this.lastAngle_=a}handleUpEvent(e){return!xp(e)||(e.map.getView().endInteraction(this.duration_),!1)}handleDownEvent(e){return xp(e)&&gp(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}},Dp=class extends Is{constructor(e){super(),this.geometry_=null,this.element_=document.createElement(`div`),this.element_.style.position=`absolute`,this.element_.style.pointerEvents=`auto`,this.element_.className=`ol-box `+e,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){let e=this.startPixel_,t=this.endPixel_;if(!e||!t)return;let n=this.element_.style;n.left=Math.min(e[0],t[0])+`px`,n.top=Math.min(e[1],t[1])+`px`,n.width=Math.abs(t[0]-e[0])+`px`,n.height=Math.abs(t[1]-e[1])+`px`}setMap(e){if(this.map_){let e=this.map_.getOverlayContainer();e&&e.removeChild(this.element_);let t=this.element_.style;t.left=`inherit`,t.top=`inherit`,t.width=`inherit`,t.height=`inherit`}if(this.map_=e,this.map_){let e=this.map_.getOverlayContainer();e&&e.appendChild(this.element_)}}setPixels(e,t){this.startPixel_=e,this.endPixel_=t,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;let e=this.startPixel_,t=this.endPixel_;if(!e||!t)return;let n=[e,[e[0],t[1]],t,[t[0],e[1]]],r=this.map_,i=n.map(e=>r.getCoordinateFromPixelInternal(e)),a=i[0];if(!a)return;i[4]=a.slice();let o=i;this.geometry_?this.geometry_.setCoordinates([o]):this.geometry_=new vf([o])}getGeometry(){return this.geometry_}},Op={BOXSTART:`boxstart`,BOXDRAG:`boxdrag`,BOXEND:`boxend`,BOXCANCEL:`boxcancel`},kp=class extends Qs{constructor(e,t,n){super(e),this.coordinate=t,this.mapBrowserEvent=n}},Ap=class extends Cp{constructor(e){super(),this.on,this.once,this.un,e??={},this.box_=new Dp(e.className||`ol-dragbox`),this.minArea_=e.minArea??64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition??gp,this.boxEndCondition_=e.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(e,t,n){let r=n[0]-t[0],i=n[1]-t[1];return r*r+i*i>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(e){this.startPixel_&&(this.box_.setPixels(this.startPixel_,e.pixel),this.dispatchEvent(new kp(Op.BOXDRAG,e.coordinate,e)))}handleUpEvent(e){if(!this.startPixel_)return!1;let t=this.boxEndCondition_(e,this.startPixel_,e.pixel);return t&&this.onBoxEnd(e),this.dispatchEvent(new kp(t?Op.BOXEND:Op.BOXCANCEL,e.coordinate,e)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(e){return this.condition_(e)?(this.startPixel_=e.pixel,this.box_.setMap(e.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new kp(Op.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}setActive(e){e||(this.box_.setMap(null),this.startPixel_&&=(this.dispatchEvent(new kp(Op.BOXCANCEL,this.startPixel_,null)),null)),super.setActive(e)}setMap(e){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&=(this.dispatchEvent(new kp(Op.BOXCANCEL,this.startPixel_,null)),null)),super.setMap(e)}},jp=class extends Ap{constructor(e){e||={};let t=e.condition?e.condition:yp;super({condition:t,className:e.className||`ol-dragzoom`,minArea:e.minArea}),this.duration_=e.duration===void 0?200:e.duration,this.out_=e.out!==void 0&&e.out}onBoxEnd(e){let t=this.getMap();if(!t)return;let n=t.getView(),r=this.getGeometry();if(this.out_){let e=n.rotatedExtentForGeometry(r),t=n.getResolutionForExtentInternal(e),i=n.getResolution();if(t===void 0||i===void 0)return;let a=i/t;r=r.clone(),r.scale(a*a)}n.fitInternal(r,{duration:this.duration_,easing:Pl})}},Mp={LEFT:`ArrowLeft`,UP:`ArrowUp`,RIGHT:`ArrowRight`,DOWN:`ArrowDown`},Np=class extends sp{constructor(e){super(),e||={},this.defaultCondition_=function(e){return _p(e)&&bp(e)},this.condition_=e.condition===void 0?this.defaultCondition_:e.condition,this.duration_=e.duration===void 0?100:e.duration,this.pixelDelta_=e.pixelDelta===void 0?128:e.pixelDelta}handleEvent(e){let t=!1;if(e.type==z.KEYDOWN){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==Mp.DOWN||r==Mp.LEFT||r==Mp.RIGHT||r==Mp.UP)){let i=e.map.getView(),a=i.getResolution();if(a===void 0)return!0;let o=a*this.pixelDelta_,s=0,c=0;r==Mp.DOWN?c=-o:r==Mp.LEFT?s=-o:r==Mp.RIGHT?s=o:c=o;let l=[s,c];Dl(l,i.getRotation()),cp(i,l,this.duration_),n.preventDefault(),t=!0}}return!t}},Pp=class extends sp{constructor(e){super(),e||={},this.condition_=e.condition?e.condition:function(e){return!vp(e)&&bp(e)},this.delta_=e.delta?e.delta:1,this.duration_=e.duration===void 0?100:e.duration}handleEvent(e){let t=!1;if(e.type==z.KEYDOWN||e.type==z.KEYPRESS){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r===`+`||r===`-`)){let i=e.map,a=r===`+`?this.delta_:-this.delta_;lp(i.getView(),a,void 0,this.duration_),n.preventDefault(),t=!0}}return!t}},Fp=40,Ip=300,Lp=3,Rp=class extends sp{constructor(e){e||={},super(e),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=e.maxDelta===void 0?1:e.maxDelta,this.duration_=e.duration===void 0?250:e.duration,this.timeout_=e.timeout===void 0?80:e.timeout,this.useAnchor_=e.useAnchor===void 0||e.useAnchor,this.constrainResolution_=e.constrainResolution!==void 0&&e.constrainResolution;let t=e.condition?e.condition:hp;this.condition_=e.onFocusOnly?dp(mp,t):t,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;let e=this.getMap();if(!e)return;let t=e.getView(),n=this.lastDelta_?this.lastDelta_>0?1:-1:0;t.endInteraction(this.constrainResolution_||t.getConstrainResolution()?100:void 0,n,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):void 0)}handleEvent(e){if(!this.condition_(e)||e.type!==z.WHEEL)return!0;let t=e.map,n=e.originalEvent;n.preventDefault();let r=n.ctrlKey&&!e.ctrlKey;this.useAnchor_&&(this.lastAnchor_=e.pixel);let i=n.deltaY;switch(n.deltaMode){case WheelEvent.DOM_DELTA_LINE:i*=Fp;break;case WheelEvent.DOM_DELTA_PAGE:i*=Ip}if(i===0)return!1;this.lastDelta_=i;let a=Date.now();this.startTime_===void 0&&(this.startTime_=a),(!this.mode_||a-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(i)<4?`trackpad`:`wheel`);let o=t.getView();if(this.mode_===`trackpad`)return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(o.getAnimating()&&o.cancelAnimations(),o.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),r&&(i*=Lp),o.adjustZoom(-i/this.deltaPerZoom_,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):void 0),this.startTime_=a,!1;this.totalDelta_+=i;let s=Math.max(this.timeout_-(a-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,t),s),!1}handleWheelZoom_(e){let t=e.getView();t.getAnimating()&&t.cancelAnimations();let n=-W(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),lp(t,n,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):void 0,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(e){this.useAnchor_=e,e||(this.lastAnchor_=null)}},zp=class extends Cp{constructor(e){e||={};let t=e;t.stopDown||=Js,super(t),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=e.threshold===void 0?.3:e.threshold,this.duration_=e.duration===void 0?250:e.duration}handleDragEvent(e){let t=0,n=this.targetPointers[0],r=this.targetPointers[1],i=Math.atan2(r.clientY-n.clientY,r.clientX-n.clientX);if(this.lastAngle_!==void 0){let e=i-this.lastAngle_;this.rotationDelta_+=e,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),t=e}this.lastAngle_=i;let a=e.map,o=a.getView();o.getConstraints().rotation!==Tf&&(this.anchor_=a.getCoordinateFromPixelInternal(a.getEventPixel(wp(this.targetPointers)))??null,this.rotating_&&(a.render(),o.adjustRotationInternal(t,this.anchor_??void 0)))}handleUpEvent(e){return this.targetPointers.length<2?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){if(this.targetPointers.length>=2){let t=e.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}},Bp=class extends Cp{constructor(e){e||={};let t=e;t.stopDown||=Js,super(t),this.anchor_=null,this.duration_=e.duration===void 0?400:e.duration,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(e){let t=1,n=this.targetPointers[0],r=this.targetPointers[1],i=n.clientX-r.clientX,a=n.clientY-r.clientY,o=Math.sqrt(i*i+a*a);this.lastDistance_!==void 0&&(t=this.lastDistance_/o),this.lastDistance_=o;let s=e.map,c=s.getView();t!=1&&(this.lastScaleDelta_=t),this.anchor_=s.getCoordinateFromPixelInternal(s.getEventPixel(wp(this.targetPointers)))??null,s.render(),c.adjustResolutionInternal(t,this.anchor_??void 0)}handleUpEvent(e){if(this.targetPointers.length<2){let t=e.map.getView(),n=this.lastScaleDelta_>1?1:-1;return t.endInteraction(this.duration_,n),!1}return!0}handleDownEvent(e){if(this.targetPointers.length>=2){let t=e.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}};function Vp(e){e||={};let t=new oc,n=new ap(-.005,.05,100);return(e.altShiftDragRotate===void 0||e.altShiftDragRotate)&&t.push(new Ep),(e.doubleClickZoom===void 0||e.doubleClickZoom)&&t.push(new up({delta:e.zoomDelta,duration:e.zoomDuration})),(e.dragPan===void 0||e.dragPan)&&t.push(new Tp({onFocusOnly:e.onFocusOnly,kinetic:n})),(e.pinchRotate===void 0||e.pinchRotate)&&t.push(new zp),(e.pinchZoom===void 0||e.pinchZoom)&&t.push(new Bp({duration:e.zoomDuration})),(e.keyboard===void 0||e.keyboard)&&(t.push(new Np),t.push(new Pp({delta:e.zoomDelta,duration:e.zoomDuration}))),(e.mouseWheelZoom===void 0||e.mouseWheelZoom)&&t.push(new Rp({onFocusOnly:e.onFocusOnly,duration:e.zoomDuration})),(e.shiftDragZoom===void 0||e.shiftDragZoom)&&t.push(new jp({duration:e.zoomDuration})),t}var K={OPACITY:`opacity`,VISIBLE:`visible`,EXTENT:`extent`,Z_INDEX:`zIndex`,MAX_RESOLUTION:`maxResolution`,MIN_RESOLUTION:`minResolution`,MAX_ZOOM:`maxZoom`,MIN_ZOOM:`minZoom`,SOURCE:`source`,MAP:`map`},Hp=class extends rc{constructor(e){super(),this.on,this.once,this.un,this.background_=e.background;let t=Object.assign({},e);typeof e.properties==`object`&&(delete t.properties,Object.assign(t,e.properties)),t[K.OPACITY]=e.opacity===void 0?1:e.opacity,U(typeof t[K.OPACITY]==`number`,`Layer opacity must be a number`),t[K.VISIBLE]=e.visible===void 0||e.visible,t[K.Z_INDEX]=e.zIndex,t[K.MAX_RESOLUTION]=e.maxResolution===void 0?1/0:e.maxResolution,t[K.MIN_RESOLUTION]=e.minResolution===void 0?0:e.minResolution,t[K.MIN_ZOOM]=e.minZoom===void 0?-1/0:e.minZoom,t[K.MAX_ZOOM]=e.maxZoom===void 0?1/0:e.maxZoom,this.className_=t.className===void 0?`ol-layer`:t.className,delete t.className,this.setProperties(t),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(e){let t=this.state_||{layer:this,managed:e===void 0||e},n=this.getZIndex();return t.opacity=W(Math.round(this.getOpacity()*100)/100,0,1),t.visible=this.getVisible(),t.extent=this.getExtent(),t.zIndex=n===void 0&&!t.managed?1/0:n,t.maxResolution=this.getMaxResolution(),t.minResolution=Math.max(this.getMinResolution(),0),t.minZoom=this.getMinZoom(),t.maxZoom=this.getMaxZoom(),this.state_=t,t}getLayersArray(e){return B()}getLayerStatesArray(e){return B()}getExtent(){return this.get(K.EXTENT)}getMaxResolution(){return this.get(K.MAX_RESOLUTION)}getMinResolution(){return this.get(K.MIN_RESOLUTION)}getMinZoom(){return this.get(K.MIN_ZOOM)}getMaxZoom(){return this.get(K.MAX_ZOOM)}getOpacity(){return this.get(K.OPACITY)}getSourceState(){return B()}getVisible(){return this.get(K.VISIBLE)}getZIndex(){return this.get(K.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(K.EXTENT,e)}setMaxResolution(e){this.set(K.MAX_RESOLUTION,e)}setMinResolution(e){this.set(K.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(K.MAX_ZOOM,e)}setMinZoom(e){this.set(K.MIN_ZOOM,e)}setOpacity(e){U(typeof e==`number`,`Layer opacity must be a number`),this.set(K.OPACITY,e)}setVisible(e){this.set(K.VISIBLE,e)}setZIndex(e){this.set(K.Z_INDEX,e)}disposeInternal(){this.state_&&=(this.state_.layer=null,null),super.disposeInternal()}},Up={ADDLAYER:`addlayer`,REMOVELAYER:`removelayer`},Wp=class extends Qs{constructor(e,t){super(e),this.layer=t}},Gp={LAYERS:`layers`},Kp=class e extends Hp{constructor(e){e||={};let t=Object.assign({},e);delete t.layers;let n=e.layers;super(t),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(Gp.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new oc(n.slice(),{unique:!0}):U(typeof n.getArray==`function`,"Expected `layers` to be an array or a `Collection`"):n=new oc(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(R),this.layersListenerKeys_.length=0;let e=this.getLayers();this.layersListenerKeys_.push(L(e,js.ADD,this.handleLayersAdd_,this),L(e,js.REMOVE,this.handleLayersRemove_,this));for(let e in this.listenerKeys_)this.listenerKeys_[e].forEach(R);Ns(this.listenerKeys_);let t=e.getArray();for(let e=0,n=t.length;e<n;e++){let n=t[e];this.registerLayerListeners_(n),this.dispatchEvent(new Wp(Up.ADDLAYER,n))}this.changed()}registerLayerListeners_(t){let n=[L(t,Ms.PROPERTYCHANGE,this.handleLayerChange_,this),L(t,z.CHANGE,this.handleLayerChange_,this)];t instanceof e&&n.push(L(t,Up.ADDLAYER,this.handleLayerGroupAdd_,this),L(t,Up.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[V(t)]=n}handleLayerGroupAdd_(e){this.dispatchEvent(new Wp(Up.ADDLAYER,e.layer))}handleLayerGroupRemove_(e){this.dispatchEvent(new Wp(Up.REMOVELAYER,e.layer))}handleLayersAdd_(e){let t=e.element;this.registerLayerListeners_(t),this.dispatchEvent(new Wp(Up.ADDLAYER,t)),this.changed()}handleLayersRemove_(e){let t=e.element,n=V(t);this.listenerKeys_[n].forEach(R),delete this.listenerKeys_[n],this.dispatchEvent(new Wp(Up.REMOVELAYER,t)),this.changed()}getLayers(){return this.get(Gp.LAYERS)}setLayers(e){let t=this.getLayers();if(t){let e=t.getArray();for(let t=0,n=e.length;t<n;++t)this.dispatchEvent(new Wp(Up.REMOVELAYER,e[t]))}this.set(Gp.LAYERS,e)}getLayersArray(e){return e=e===void 0?[]:e,this.getLayers().forEach(function(t){t.getLayersArray(e)}),e}getLayerStatesArray(e){let t=e===void 0?[]:e,n=t.length;this.getLayers().forEach(function(e){e.getLayerStatesArray(t)});let r=this.getLayerState(),i=r.zIndex;!e&&r.zIndex===void 0&&(i=0);for(let e=n,a=t.length;e<a;e++){let n=t[e];n.opacity*=r.opacity,n.visible=n.visible&&r.visible,n.maxResolution=Math.min(n.maxResolution,r.maxResolution),n.minResolution=Math.max(n.minResolution,r.minResolution),n.minZoom=Math.max(n.minZoom,r.minZoom),n.maxZoom=Math.min(n.maxZoom,r.maxZoom),r.extent!==void 0&&(n.extent=n.extent===void 0?r.extent:ml(n.extent,r.extent)),n.zIndex===void 0&&(n.zIndex=i)}return t}getSourceState(){return`ready`}},qp={PRERENDER:`prerender`,POSTRENDER:`postrender`,PRECOMPOSE:`precompose`,POSTCOMPOSE:`postcompose`,RENDERCOMPLETE:`rendercomplete`},Jp=class extends Hp{constructor(e){let t=Object.assign({},e);delete t.source,super(t),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,e.render&&(this.render=e.render),e.map&&this.setMap(e.map),this.addChangeListener(K.SOURCE,this.handleSourcePropertyChange_);let n=e.source?e.source:null;this.setSource(n)}getLayersArray(e){return e||=[],e.push(this),e}getLayerStatesArray(e){return e||=[],e.push(this.getLayerState()),e}getSource(){return this.get(K.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){let e=this.getSource();return e?e.getState():`undefined`}handleSourceChange_(){this.changed();let e=this.getSource();e&&!this.sourceReady_&&e.getState()===`ready`&&(this.sourceReady_=!0,this.dispatchEvent(`sourceready`))}handleSourcePropertyChange_(){this.sourceChangeKey_&&=(R(this.sourceChangeKey_),null),this.sourceReady_=!1;let e=this.getSource();e&&(this.sourceChangeKey_=L(e,z.CHANGE,this.handleSourceChange_,this),e.getState()===`ready`&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent(`sourceready`)},0))),this.changed()}getFeatures(e){return this.renderer_?this.renderer_.getFeatures(e):Promise.resolve([])}getData(e){return!this.renderer_||!this.rendered?null:this.renderer_.getData(e)}isVisible(e){let t,n=this.getMapInternal();!e&&n&&(e=n.getView()),t=e instanceof Af?{viewState:e.getState(),extent:e.calculateExtent()}:e;let r=t;!r.layerStatesArray&&n&&(r.layerStatesArray=n.getLayerGroup().getLayerStatesArray());let i;if(r.layerStatesArray){if(i=r.layerStatesArray.find(e=>e.layer===this),!i)return!1}else i=this.getLayerState();let a=this.getExtent();return Yp(i,r.viewState)&&(!a||vl(a,r.extent))}getAttributions(e){if(!this.isVisible(e))return[];let t=this.getSource()?.getAttributions();if(!t)return[];let n=t(e instanceof Af?e.getViewStateAndExtent():e);return Array.isArray(n)||(n=[n]),n}render(e,t){let n=this.getRenderer();return n.prepareFrame(e)?(this.rendered=!0,n.renderFrame(e,t)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(e,t){}renderDeferred(e){let t=this.getRenderer();t&&t.renderDeferred(e)}setMapInternal(e){e||this.unrender(),this.set(K.MAP,e)}getMapInternal(){return this.get(K.MAP)}setMap(e){this.mapPrecomposeKey_&&=(R(this.mapPrecomposeKey_),null),e||this.changed(),this.mapRenderKey_&&=(R(this.mapRenderKey_),null),e&&(this.mapPrecomposeKey_=L(e,qp.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=L(this,z.CHANGE,e.render,e),this.changed())}handlePrecompose_(e){let t=e.frameState?.layerStatesArray;if(!t)return;let n=this.getLayerState(!1);U(!t.some(e=>e.layer===n.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),t.push(n)}setSource(e){this.set(K.SOURCE,e)}getRenderer(){return this.renderer_||=this.createRenderer(),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}};function Yp(e,t){if(!e.visible)return!1;let n=t.resolution;if(n<e.minResolution||n>=e.maxResolution)return!1;let r=t.zoom;return r>e.minZoom&&r<=e.maxZoom}function Xp(e,t,n=0,r=e.length-1,i=Qp){for(;r>n;){if(r-n>600){let a=r-n+1,o=t-n+1,s=Math.log(a),c=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*c*(a-c)/a)*(o-a/2<0?-1:1);Xp(e,t,Math.max(n,Math.floor(t-o*c/a+l)),Math.min(r,Math.floor(t+(a-o)*c/a+l)),i)}let a=e[t],o=n,s=r;for(Zp(e,n,t),i(e[r],a)>0&&Zp(e,n,r);o<s;){for(Zp(e,o,s),o++,s--;i(e[o],a)<0;)o++;for(;i(e[s],a)>0;)s--}i(e[n],a)===0?Zp(e,n,s):(s++,Zp(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}}function Zp(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function Qp(e,t){return e<t?-1:+(e>t)}var $p=class{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(e){let t=this.data,n=[];if(!dm(e,t))return n;let r=this.toBBox,i=[];for(;t;){for(let a=0;a<t.children.length;a++){let o=t.children[a],s=t.leaf?r(o):o;dm(e,s)&&(t.leaf?n.push(o):um(e,s)?this._all(o,n):i.push(o))}t=i.pop()}return n}collides(e){let t=this.data;if(!dm(e,t))return!1;let n=[];for(;t;){for(let r=0;r<t.children.length;r++){let i=t.children[r],a=t.leaf?this.toBBox(i):i;if(dm(e,a)){if(t.leaf||um(e,a))return!0;n.push(i)}}t=n.pop()}return!1}load(e){if(!(e&&e.length))return this;if(e.length<this._minEntries){for(let t=0;t<e.length;t++)this.insert(e[t]);return this}let t=this._build(e.slice(),0,e.length-1,0);if(!this.data.children.length)this.data=t;else if(this.data.height===t.height)this._splitRoot(this.data,t);else{if(this.data.height<t.height){let e=this.data;this.data=t,t=e}this._insert(t,this.data.height-t.height-1,!0)}return this}insert(e){return e&&this._insert(e,this.data.height-1),this}clear(){return this.data=fm([]),this}remove(e,t){if(!e)return this;let n=this.data,r=this.toBBox(e),i=[],a=[],o,s,c;for(;n||i.length;){if(n||(n=i.pop(),s=i[i.length-1],o=a.pop(),c=!0),n.leaf){let r=em(e,n.children,t);if(r!==-1)return n.children.splice(r,1),i.push(n),this._condense(i),this}!c&&!n.leaf&&um(n,r)?(i.push(n),a.push(o),o=0,s=n,n=n.children[0]):s?(o++,n=s.children[o],c=!1):n=null}return this}toBBox(e){return e}compareMinX(e,t){return e.minX-t.minX}compareMinY(e,t){return e.minY-t.minY}toJSON(){return this.data}fromJSON(e){return this.data=e,this}_all(e,t){let n=[];for(;e;)e.leaf?t.push(...e.children):n.push(...e.children),e=n.pop();return t}_build(e,t,n,r){let i=n-t+1,a=this._maxEntries,o;if(i<=a)return o=fm(e.slice(t,n+1)),tm(o,this.toBBox),o;r||(r=Math.ceil(Math.log(i)/Math.log(a)),a=Math.ceil(i/a**(r-1))),o=fm([]),o.leaf=!1,o.height=r;let s=Math.ceil(i/a),c=s*Math.ceil(Math.sqrt(a));pm(e,t,n,c,this.compareMinX);for(let i=t;i<=n;i+=c){let t=Math.min(i+c-1,n);pm(e,i,t,s,this.compareMinY);for(let n=i;n<=t;n+=s){let i=Math.min(n+s-1,t);o.children.push(this._build(e,n,i,r-1))}}return tm(o,this.toBBox),o}_chooseSubtree(e,t,n,r){for(;r.push(t),!(t.leaf||r.length-1===n);){let n=1/0,r=1/0,i;for(let a=0;a<t.children.length;a++){let o=t.children[a],s=om(o),c=cm(e,o)-s;c<r?(r=c,n=s<n?s:n,i=o):c===r&&s<n&&(n=s,i=o)}t=i||t.children[0]}return t}_insert(e,t,n){let r=n?e:this.toBBox(e),i=[],a=this._chooseSubtree(r,this.data,t,i);for(a.children.push(e),rm(a,r);t>=0&&i[t].children.length>this._maxEntries;)this._split(i,t),t--;this._adjustParentBBoxes(r,i,t)}_split(e,t){let n=e[t],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);let a=this._chooseSplitIndex(n,i,r),o=fm(n.children.splice(a,n.children.length-a));o.height=n.height,o.leaf=n.leaf,tm(n,this.toBBox),tm(o,this.toBBox),t?e[t-1].children.push(o):this._splitRoot(n,o)}_splitRoot(e,t){this.data=fm([e,t]),this.data.height=e.height+1,this.data.leaf=!1,tm(this.data,this.toBBox)}_chooseSplitIndex(e,t,n){let r,i=1/0,a=1/0;for(let o=t;o<=n-t;o++){let t=nm(e,0,o,this.toBBox),s=nm(e,o,n,this.toBBox),c=lm(t,s),l=om(t)+om(s);c<i?(i=c,r=o,a=l<a?l:a):c===i&&l<a&&(a=l,r=o)}return r||n-t}_chooseSplitAxis(e,t,n){let r=e.leaf?this.compareMinX:im,i=e.leaf?this.compareMinY:am;this._allDistMargin(e,t,n,r)<this._allDistMargin(e,t,n,i)&&e.children.sort(r)}_allDistMargin(e,t,n,r){e.children.sort(r);let i=this.toBBox,a=nm(e,0,t,i),o=nm(e,n-t,n,i),s=sm(a)+sm(o);for(let r=t;r<n-t;r++){let t=e.children[r];rm(a,e.leaf?i(t):t),s+=sm(a)}for(let r=n-t-1;r>=t;r--){let t=e.children[r];rm(o,e.leaf?i(t):t),s+=sm(o)}return s}_adjustParentBBoxes(e,t,n){for(let r=n;r>=0;r--)rm(t[r],e)}_condense(e){for(let t=e.length-1,n;t>=0;t--)e[t].children.length===0?t>0?(n=e[t-1].children,n.splice(n.indexOf(e[t]),1)):this.clear():tm(e[t],this.toBBox)}};function em(e,t,n){if(!n)return t.indexOf(e);for(let r=0;r<t.length;r++)if(n(e,t[r]))return r;return-1}function tm(e,t){nm(e,0,e.children.length,t,e)}function nm(e,t,n,r,i){i||=fm(null),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(let a=t;a<n;a++){let t=e.children[a];rm(i,e.leaf?r(t):t)}return i}function rm(e,t){return e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),e}function im(e,t){return e.minX-t.minX}function am(e,t){return e.minY-t.minY}function om(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function sm(e){return e.maxX-e.minX+(e.maxY-e.minY)}function cm(e,t){return(Math.max(t.maxX,e.maxX)-Math.min(t.minX,e.minX))*(Math.max(t.maxY,e.maxY)-Math.min(t.minY,e.minY))}function lm(e,t){let n=Math.max(e.minX,t.minX),r=Math.max(e.minY,t.minY),i=Math.min(e.maxX,t.maxX),a=Math.min(e.maxY,t.maxY);return Math.max(0,i-n)*Math.max(0,a-r)}function um(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function dm(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function fm(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function pm(e,t,n,r,i){let a=[t,n];for(;a.length;){if(n=a.pop(),t=a.pop(),n-t<=r)continue;let o=t+Math.ceil((n-t)/r/2)*r;Xp(e,o,t,n,i),a.push(t,o,o,n)}}var mm=[NaN,NaN,NaN,0],hm;function gm(){return hm||=Gf(1,1,void 0,{willReadFrequently:!0,desynchronized:!0}),hm}var _m=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,vm=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,ym=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,bm=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function xm(e,t){return e.endsWith(`%`)?Number(e.substring(0,e.length-1))/t:Number(e)}function Sm(e){throw Error(`failed to parse "`+e+`" as color`)}function Cm(e){if(e.toLowerCase().startsWith(`rgb`)){let t=e.match(vm)||e.match(_m)||e.match(ym);if(t){let e=t[4],n=100/255;return[W(xm(t[1],n)+.5|0,0,255),W(xm(t[2],n)+.5|0,0,255),W(xm(t[3],n)+.5|0,0,255),e===void 0?1:W(xm(e,100),0,1)]}Sm(e)}if(e.startsWith(`#`)){if(bm.test(e)){let t=e.substring(1),n=t.length<=4?1:2,r=[0,0,0,255];for(let e=0,i=t.length;e<i;e+=n){let i=parseInt(t.substring(e,e+n),16);n===1&&(i+=i<<4),r[e/n]=i}return r[3]/=255,r}Sm(e)}let t=gm();t.fillStyle=`#abcdef`;let n=t.fillStyle;t.fillStyle=e,t.fillStyle===n&&(t.fillStyle=`#fedcba`,n=t.fillStyle,t.fillStyle=e,t.fillStyle===n&&Sm(e));let r=t.fillStyle;if(r.startsWith(`#`)||r.startsWith(`rgba`))return Cm(r);t.clearRect(0,0,1,1),t.fillRect(0,0,1,1);let i=Array.from(t.getImageData(0,0,1,1).data);return i[3]=Pc(i[3]/255,3),i}function wm(e){return typeof e==`string`?e:Lm(e)}var Tm=1024,Em={},Dm=0;function Om(e){if(e.length===4)return e;let t=e.slice();return t[3]=1,t}function km(e){return e>.0031308?e**(1/2.4)*269.025-14.025:e*3294.6}function Am(e){return e>.2068965?e**3:(e-4/29)*(108/841)}function jm(e){return e>10.314724?((e+14.025)/269.025)**2.4:e/3294.6}function Mm(e){return e>.0088564?e**(1/3):e/(108/841)+4/29}function Nm(e){let t=jm(e[0]),n=jm(e[1]),r=jm(e[2]),i=Mm(t*.222488403+n*.716873169+r*.06060791),a=500*(Mm(t*.452247074+n*.399439023+r*.148375274)-i),o=200*(i-Mm(t*.016863605+n*.117638439+r*.865350722)),s=180/Math.PI*Math.atan2(o,a);return[116*i-16,Math.sqrt(a*a+o*o),s<0?s+360:s,e[3]]}function Pm(e){let t=(e[0]+16)/116,n=e[1],r=e[2]*Math.PI/180,i=Am(t),a=Am(t+n/500*Math.cos(r)),o=Am(t-n/200*Math.sin(r)),s=km(a*3.021973625-i*1.617392459-o*.404875592),c=km(a*-.943766287+i*1.916279586+o*.027607165),l=km(a*.069407491-i*.22898585+o*1.159737864);return[W(s+.5|0,0,255),W(c+.5|0,0,255),W(l+.5|0,0,255),e[3]]}function Fm(e){if(e===`none`)return mm;if(Em.hasOwnProperty(e))return Em[e];if(Dm>=Tm){let e=0;for(let t in Em)e++&3||(delete Em[t],--Dm)}let t=Cm(e);t.length!==4&&Sm(e);for(let n of t)isNaN(n)&&Sm(e);return Em[e]=t,++Dm,t}function Im(e){return Array.isArray(e)?e:Fm(e)}function Lm(e){let t=e[0];t!=(t|0)&&(t=t+.5|0);let n=e[1];n!=(n|0)&&(n=n+.5|0);let r=e[2];r!=(r|0)&&(r=r+.5|0);let i=e[3]===void 0?1:Math.round(e[3]*1e3)/1e3;return`rgba(`+t+`,`+n+`,`+r+`,`+i+`)`}function Rm(e){return e[0]>0&&e[1]>0}function zm(e,t,n){return n===void 0&&(n=[0,0]),n[0]=e[0]*t+.5|0,n[1]=e[1]*t+.5|0,n}function Bm(e,t){return Array.isArray(e)?e:(t===void 0?t=[e,e]:(t[0]=e,t[1]=e),t)}var Vm=0,Hm=1<<Vm++,q=1<<Vm++,Um=1<<Vm++,Wm=1<<Vm++,Gm=1<<Vm++,Km=1<<Vm++,qm=2**Vm-1,Jm={[Hm]:`boolean`,[q]:`number`,[Um]:`string`,[Wm]:`color`,[Gm]:`number[]`,[Km]:`size`},Ym=Object.keys(Jm).map(Number).sort(Rs);function Xm(e){return e in Jm}function Zm(e){let t=[];for(let n of Ym)Qm(e,n)&&t.push(Jm[n]);return t.length===0?`untyped`:t.length<3?t.join(` or `):t.slice(0,-1).join(`, `)+`, or `+t[t.length-1]}function Qm(e,t){return(e&t)===t}function $m(e,t){return!!(e&t)}function eh(e,t){return e===t}function th(e){return e instanceof Error?e.message:String(e)}var nh=class{constructor(e,t){if(!Xm(e))throw Error(`literal expressions must have a specific type, got ${Zm(e)}`);this.type=e,this.value=t}},rh=class{constructor(e,t,...n){this.type=e,this.operator=t,this.args=n}};function ih(e){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:e}}function ah(e,t,n){switch(typeof e){case`boolean`:if(eh(t,Um))return new nh(Um,e?`true`:`false`);if(!Qm(t,Hm))throw Error(`got a boolean, but expected ${Zm(t)}`);return new nh(Hm,e);case`number`:if(eh(t,Km))return new nh(Km,Bm(e));if(eh(t,Hm))return new nh(Hm,!!e);if(eh(t,Um))return new nh(Um,e.toString());if(!Qm(t,q))throw Error(`got a number, but expected ${Zm(t)}`);return new nh(q,e);case`string`:if(eh(t,Wm))return new nh(Wm,Fm(e));if(eh(t,Hm))return new nh(Hm,!!e);if(!Qm(t,Um))throw Error(`got a string, but expected ${Zm(t)}`);return new nh(Um,e)}if(!Array.isArray(e))throw Error(`expression must be an array or a primitive value`);if(e.length===0)throw Error(`empty expression`);if(typeof e[0]==`string`)return wh(e,t,n);for(let t of e)if(typeof t!=`number`)throw Error(`expected an array of numbers`);if(eh(t,Km)){if(e.length!==2)throw Error(`expected an array of two values for a size, got ${e.length}`);return new nh(Km,e)}if(eh(t,Wm)){if(e.length===3)return new nh(Wm,[...e,1]);if(e.length===4)return new nh(Wm,e);throw Error(`expected an array of 3 or 4 values for a color, got ${e.length}`)}if(!Qm(t,Gm))throw Error(`got an array of numbers, but expected ${Zm(t)}`);return new nh(Gm,e)}var J={Get:`get`,Var:`var`,Concat:`concat`,GeometryType:`geometry-type`,LineMetric:`line-metric`,Any:`any`,All:`all`,Not:`!`,Resolution:`resolution`,Zoom:`zoom`,Time:`time`,Equal:`==`,NotEqual:`!=`,GreaterThan:`>`,GreaterThanOrEqualTo:`>=`,LessThan:`<`,LessThanOrEqualTo:`<=`,Multiply:`*`,Divide:`/`,Add:`+`,Subtract:`-`,Clamp:`clamp`,Mod:`%`,Pow:`^`,Abs:`abs`,Floor:`floor`,Ceil:`ceil`,Round:`round`,Sin:`sin`,Cos:`cos`,Atan:`atan`,Sqrt:`sqrt`,Match:`match`,Between:`between`,Interpolate:`interpolate`,InterpolateHcl:`interpolate-hcl`,Coalesce:`coalesce`,Case:`case`,In:`in`,Number:`number`,String:`string`,Array:`array`,Color:`color`,Id:`id`,Band:`band`,Palette:`palette`,ToString:`to-string`,Has:`has`},oh={[J.Get]:Z(Y(1,1/0),sh),[J.Var]:ch(),[J.Has]:Z(Y(1,1/0),sh),[J.Id]:Z(lh,ph),[J.Concat]:Z(Y(2,1/0),X(Um)),[J.GeometryType]:Z(uh,ph),[J.LineMetric]:Z(dh,ph),[J.Resolution]:Z(fh,ph),[J.Zoom]:Z(fh,ph),[J.Time]:Z(fh,ph),[J.Any]:Z(Y(2,1/0),X(Hm)),[J.All]:Z(Y(2,1/0),X(Hm)),[J.Not]:Z(Y(1,1),X(Hm)),[J.Equal]:Z(Y(2,2),hh()),[J.NotEqual]:Z(Y(2,2),hh()),[J.GreaterThan]:Z(Y(2,2),X(q)),[J.GreaterThanOrEqualTo]:Z(Y(2,2),X(q)),[J.LessThan]:Z(Y(2,2),X(q)),[J.LessThanOrEqualTo]:Z(Y(2,2),X(q)),[J.Multiply]:Z(Y(2,1/0),mh),[J.Coalesce]:Z(Y(2,1/0),mh),[J.Divide]:Z(Y(2,2),X(q)),[J.Add]:Z(Y(2,1/0),X(q)),[J.Subtract]:Z(Y(2,2),X(q)),[J.Clamp]:Z(Y(3,3),X(q)),[J.Mod]:Z(Y(2,2),X(q)),[J.Pow]:Z(Y(2,2),X(q)),[J.Abs]:Z(Y(1,1),X(q)),[J.Floor]:Z(Y(1,1),X(q)),[J.Ceil]:Z(Y(1,1),X(q)),[J.Round]:Z(Y(1,1),X(q)),[J.Sin]:Z(Y(1,1),X(q)),[J.Cos]:Z(Y(1,1),X(q)),[J.Atan]:Z(Y(1,2),X(q)),[J.Sqrt]:Z(Y(1,1),X(q)),[J.Match]:Z(Y(4,1/0),_h,vh),[J.Between]:Z(Y(3,3),X(q)),[J.Interpolate]:Z(Y(6,1/0),_h,bh),[J.InterpolateHcl]:Z(Y(6,1/0),_h,yh,bh),[J.Case]:Z(Y(3,1/0),gh,xh),[J.In]:Z(Y(2,2),Sh),[J.Number]:Z(Y(1,1/0),X(qm)),[J.String]:Z(Y(1,1/0),X(qm)),[J.Array]:Z(Y(1,1/0),X(q)),[J.Color]:Z(Y(1,4),X(q)),[J.Band]:Z(Y(1,3),X(q)),[J.Palette]:Z(Y(2,2),Ch),[J.ToString]:Z(Y(1,1),X(Hm|q|Um|Wm))};function sh(e,t,n){let r=e.length-1,i=Array(r);for(let a=0;a<r;++a){let r=e[a+1];switch(typeof r){case`number`:i[a]=new nh(q,r);break;case`string`:i[a]=new nh(Um,r);break;default:throw Error(`expected a string key or numeric array index for a get operation, got ${r}`)}a===0&&n.properties.set(String(r),t)}return i}function ch(){return function(e,t,n){let r=e[1];if(typeof r!=`string`)throw Error(`expected a string argument for var operation`);let i=t,a=n.inputVariables?.[r];if(a!==void 0){let e=ah(a,qm,n);if(!(e instanceof nh))throw Error(`style variables should only be literal values (no expressions!), variable name: ${r}`);let o=e.type;if(typeof a==`string`&&$m(i,Wm)&&!$m(i,Um)?o=Wm:Array.isArray(a)&&a.length===2&&$m(i,Km)&&!$m(i,Gm)&&(o=Km),i&=o,i===0)throw Error(`the type expected from the var operator (${Zm(t)}) did not have any overlap with the type of the corresponding style variables (${Zm(o)}), variable name: ${r}`)}if(n.variables.has(r)){let e=n.variables.get(r);if(i&=e,i===0)throw Error(`a new type expected from the var operator (${Zm(t)}) did not have any overlap with the previous type expected for it (${Zm(e)}), variable name: ${r}`)}return n.variables.set(r,i),new rh(i,`var`,new nh(Um,r))}}function lh(e,t,n){n.featureId=!0}function uh(e,t,n){n.geometryType=!0}function dh(e,t,n){n.mCoordinate=!0}function fh(e,t,n){n.mapState=!0}function ph(e,t,n){let r=e[0];if(e.length!==1)throw Error(`expected no arguments for ${r} operation`);return[]}function Y(e,t){return function(n,r,i){let a=n[0],o=n.length-1;if(e===t){if(o!==e)throw Error(`expected ${e} argument${e===1?``:`s`} for ${a}, got ${o}`)}else if(o<e||o>t){let n=t===1/0?`${e} or more`:`${e} to ${t}`;throw Error(`expected ${n} arguments for ${a}, got ${o}`)}}}function mh(e,t,n){let r=e.length-1,i=Array(r);for(let a=0;a<r;++a){let r=ah(e[a+1],t,n);i[a]=r}return i}function X(e){return function(t,n,r){let i=t.length-1,a=Array(i);for(let n=0;n<i;++n){let i=ah(t[n+1],e,r);a[n]=i}return a}}function hh(){return function(e,t,n){let r=e[0],i=e.length-1,a=Array(i),o=qm;for(let t=0;t<i;++t){let r=ah(e[t+1],o,n);o&=r.type}if(o===0)throw Error(`no common type was found among the arguments of ${r}`);for(let t=0;t<i;++t){let r=ah(e[t+1],o,n);a[t]=r}return a}}function gh(e,t,n){let r=e[0],i=e.length-1;if(i%2==0)throw Error(`expected an odd number of arguments for ${r}, got ${i} instead`)}function _h(e,t,n){let r=e[0],i=e.length-1;if(i%2==1)throw Error(`expected an even number of arguments for operation ${r}, got ${i} instead`)}function vh(e,t,n){let r=e.length-1,i=ah(e[e.length-1],t,n),a=Um|q|Hm,o=Array(r-2);for(let t=0;t<r-2;t+=2){try{let r=ah(e[t+2],a,n);a&=r.type}catch(e){let n=th(e);throw Error(`failed to parse argument ${t+1} of match expression: ${n}`)}if(a===0)throw Error(`no common type was found among the arguments of match expression`)}for(let t=0;t<r-2;t+=2){try{let r=ah(e[t+2],a,n);o[t]=r}catch(e){let n=th(e);throw Error(`failed to parse argument ${t+1} of match expression: ${n}`)}try{let r=ah(e[t+3],i.type,n);o[t+1]=r}catch(e){throw Error(`failed to parse argument ${t+2} of match expression: ${th(e)}`)}}return[ah(e[1],a,n),...o,i]}function yh(e,t,n){if(!Qm(t,Wm))throw Error(`the ${e[0]} operator can only return a color, got ${Zm(t)}`)}function bh(e,t,n){let r=e[1],i;switch(r[0]){case`linear`:i=1;break;case`exponential`:let e=r[1];if(typeof e!=`number`||e<=0)throw Error(`expected a number base for exponential interpolation, got ${JSON.stringify(e)} instead`);i=e;break;default:throw Error(`invalid interpolation type: ${JSON.stringify(r)}`)}let a=new nh(q,i),o;try{o=ah(e[2],q,n)}catch(e){throw Error(`failed to parse argument 1 in interpolate expression: ${th(e)}`)}let s=Array(e.length-3);for(let r=0;r<s.length;r+=2){try{let t=ah(e[r+3],q,n);s[r]=t}catch(e){throw Error(`failed to parse argument ${r+2} for interpolate expression: ${th(e)}`)}try{let i=ah(e[r+4],t,n);s[r+1]=i}catch(e){throw Error(`failed to parse argument ${r+3} for interpolate expression: ${th(e)}`)}}return[a,o,...s]}function xh(e,t,n){let r=ah(e[e.length-1],t,n),i=Array(e.length-1);for(let t=0;t<i.length-1;t+=2){try{let r=ah(e[t+1],Hm,n);i[t]=r}catch(e){throw Error(`failed to parse argument ${t} of case expression: ${th(e)}`)}try{let a=ah(e[t+2],r.type,n);i[t+1]=a}catch(e){throw Error(`failed to parse argument ${t+1} of case expression: ${th(e)}`)}}return i[i.length-1]=r,i}function Sh(e,t,n){let r=e[2];if(!Array.isArray(r))throw Error(`the second argument for the "in" operator must be an array`);let i;if(r[0]===`literal`){if(r=r[1],!Array.isArray(r))throw Error(`failed to parse "in" expression: the literal operator must be followed by an array`)}else if(typeof r[0]==`string`)throw Error(`for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions`);i=typeof r[0]==`string`?Um:q;let a=Array(r.length);for(let e=0;e<a.length;e++)try{let t=ah(r[e],i,n);a[e]=t}catch(t){throw Error(`failed to parse haystack item ${e} for "in" expression: ${th(t)}`)}return[ah(e[1],i,n),...a]}function Ch(e,t,n){let r;try{r=ah(e[1],q,n)}catch(e){throw Error(`failed to parse first argument in palette expression: ${th(e)}`)}let i=e[2];if(!Array.isArray(i))throw Error(`the second argument of palette must be an array`);let a=Array(i.length);for(let e=0;e<a.length;e++){let t;try{t=ah(i[e],Wm,n)}catch(t){throw Error(`failed to parse color at index ${e} in palette expression: ${th(t)}`)}if(!(t instanceof nh))throw Error(`the palette color at index ${e} must be a literal value`);a[e]=t}return[r,...a]}function Z(...e){return function(t,n,r){let i=t[0],a=[];for(let i=0;i<e.length;i++){let o=e[i](t,n,r);if(i==e.length-1){if(!o)throw Error(`expected last argument validator to return the parsed args`);a=o}}return new rh(n,i,...a)}}function wh(e,t,n){let r=e[0],i=oh[r];if(!i)throw Error(`unknown operator: ${r}`);return i(e,t,n)}function Th(e){if(!e)return``;let t=e.getType();switch(t){case`Point`:case`LineString`:case`Polygon`:return t;case`MultiPoint`:case`MultiLineString`:case`MultiPolygon`:return t.substring(5);case`Circle`:return`Polygon`;case`GeometryCollection`:return Th(e.getGeometries()[0]);default:return``}}function Eh(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:``}}function Dh(e,t,n){return Oh(ah(e,t,n),n)}function Oh(e,t){if(e instanceof nh){if(e.type===Wm&&typeof e.value==`string`){let t=Fm(e.value);return function(){return t}}return function(){return e.value}}let n=e.operator;switch(n){case J.Number:case J.String:case J.Coalesce:return jh(e,t);case J.Get:case J.Var:case J.Has:return Mh(e,t);case J.Id:return e=>e.featureId??``;case J.GeometryType:return e=>e.geometryType;case J.Concat:{let n=e.args.map(e=>Oh(e,t));return e=>``.concat(...n.map(t=>(t(e)??``).toString()))}case J.Resolution:return e=>e.resolution;case J.Any:case J.All:case J.Between:case J.In:case J.Not:return Ph(e,t);case J.Equal:case J.NotEqual:case J.LessThan:case J.LessThanOrEqualTo:case J.GreaterThan:case J.GreaterThanOrEqualTo:return Nh(e,t);case J.Multiply:case J.Divide:case J.Add:case J.Subtract:case J.Clamp:case J.Mod:case J.Pow:case J.Abs:case J.Floor:case J.Ceil:case J.Round:case J.Sin:case J.Cos:case J.Atan:case J.Sqrt:return Fh(e,t);case J.Case:return Ih(e,t);case J.Match:return Lh(e,t);case J.Interpolate:case J.InterpolateHcl:return Rh(e,t);case J.ToString:return zh(e,t);case J.Array:return kh(e,t);case J.Color:return Ah(e,t);default:throw Error(`Unsupported operator ${n}`)}}function kh(e,t){let n=e.args.length,r=Array(n);for(let i=0;i<n;++i)r[i]=Oh(e.args[i],t);if(e.type===Wm&&(n===3||n===4)){let e=n===4?r[3]:null;return t=>[r[0](t)*255,r[1](t)*255,r[2](t)*255,e?e(t):1]}return e=>{let t=Array(n);for(let i=0;i<n;++i)t[i]=r[i](e);return t}}function Ah(e,t){let n=e.args.length,r=Array(n);for(let i=0;i<n;++i)r[i]=Oh(e.args[i],t);if(n<3){let e=n===2?r[1]:null;return t=>{let n=r[0](t);return[n,n,n,e?e(t):1]}}let i=n===4?r[3]:null;return e=>[r[0](e),r[1](e),r[2](e),i?i(e):1]}function jh(e,t){let n=e.operator,r=e.args.length,i=Array(r);for(let n=0;n<r;++n)i[n]=Oh(e.args[n],t);switch(n){case J.Coalesce:return e=>{for(let t=0;t<r;++t){let n=i[t](e);if(n!=null)return n}throw Error(`Expected one of the values to be non-null`)};case J.Number:case J.String:return e=>{for(let t=0;t<r;++t){let r=i[t](e);if(typeof r===n)return r}throw Error(`Expected one of the values to be a ${n}`)};default:throw Error(`Unsupported assertion operator ${n}`)}}function Mh(e,t){let n=e.args[0].value;switch(e.operator){case J.Get:return t=>{let r=e.args,i=t.properties[n];for(let e=1,t=r.length;e<t;++e){let t=r[e].value;i=i[t]}return i};case J.Var:return e=>e.variables[n];case J.Has:return t=>{let r=e.args;if(!(n in t.properties))return!1;let i=t.properties[n];for(let e=1,t=r.length;e<t;++e){let t=r[e].value;if(!i||!Object.hasOwn(i,t))return!1;i=i[t]}return!0};default:throw Error(`Unsupported accessor operator ${e.operator}`)}}function Nh(e,t){let n=e.operator,r=Oh(e.args[0],t),i=Oh(e.args[1],t);switch(n){case J.Equal:return e=>r(e)===i(e);case J.NotEqual:return e=>r(e)!==i(e);case J.LessThan:return e=>r(e)<i(e);case J.LessThanOrEqualTo:return e=>r(e)<=i(e);case J.GreaterThan:return e=>r(e)>i(e);case J.GreaterThanOrEqualTo:return e=>r(e)>=i(e);default:throw Error(`Unsupported comparison operator ${n}`)}}function Ph(e,t){let n=e.operator,r=e.args.length,i=Array(r);for(let n=0;n<r;++n)i[n]=Oh(e.args[n],t);switch(n){case J.Any:return e=>{for(let t=0;t<r;++t)if(i[t](e))return!0;return!1};case J.All:return e=>{for(let t=0;t<r;++t)if(!i[t](e))return!1;return!0};case J.Between:return e=>{let t=i[0](e),n=i[1](e),r=i[2](e);return t>=n&&t<=r};case J.In:return e=>{let t=i[0](e);for(let n=1;n<r;++n)if(t===i[n](e))return!0;return!1};case J.Not:return e=>!i[0](e);default:throw Error(`Unsupported logical operator ${n}`)}}function Fh(e,t){let n=e.operator,r=e.args.length,i=Array(r);for(let n=0;n<r;++n)i[n]=Oh(e.args[n],t);switch(n){case J.Multiply:return e=>{let t=1;for(let n=0;n<r;++n)t*=i[n](e);return t};case J.Divide:return e=>i[0](e)/i[1](e);case J.Add:return e=>{let t=0;for(let n=0;n<r;++n)t+=i[n](e);return t};case J.Subtract:return e=>i[0](e)-i[1](e);case J.Clamp:return e=>{let t=i[0](e),n=i[1](e);if(t<n)return n;let r=i[2](e);return t>r?r:t};case J.Mod:return e=>i[0](e)%i[1](e);case J.Pow:return e=>i[0](e)**+i[1](e);case J.Abs:return e=>Math.abs(i[0](e));case J.Floor:return e=>Math.floor(i[0](e));case J.Ceil:return e=>Math.ceil(i[0](e));case J.Round:return e=>Math.round(i[0](e));case J.Sin:return e=>Math.sin(i[0](e));case J.Cos:return e=>Math.cos(i[0](e));case J.Atan:return r===2?e=>Math.atan2(i[0](e),i[1](e)):e=>Math.atan(i[0](e));case J.Sqrt:return e=>Math.sqrt(i[0](e));default:throw Error(`Unsupported numeric operator ${n}`)}}function Ih(e,t){let n=e.args.length,r=Array(n);for(let i=0;i<n;++i)r[i]=Oh(e.args[i],t);return e=>{for(let t=0;t<n-1;t+=2)if(r[t](e))return r[t+1](e);return r[n-1](e)}}function Lh(e,t){let n=e.args.length,r=Array(n);for(let i=0;i<n;++i)r[i]=Oh(e.args[i],t);return e=>{let t=r[0](e);for(let i=1;i<n-1;i+=2)if(t===r[i](e))return r[i+1](e);return r[n-1](e)}}function Rh(e,t){let n=e.args.length,r=Array(n);for(let i=0;i<n;++i)r[i]=Oh(e.args[i],t);let i=e.operator===J.InterpolateHcl?Hh:Vh;return e=>{let t=r[0](e),a=r[1](e),o,s;for(let c=2;c<n;c+=2){let n=r[c](e),l=r[c+1](e),u=Array.isArray(l);if(u&&(l=Om(l)),n>=a)return c===2?l:u?i(t,a,o,s,n,l):Bh(t,a,o,s,n,l);o=n,s=l}return s}}function zh(e,t){let n=e.operator,r=e.args.length,i=Array(r);for(let n=0;n<r;++n)i[n]=Oh(e.args[n],t);switch(n){case J.ToString:return t=>{let n=i[0](t);return e.args[0].type===Wm?Lm(n):n.toString()};default:throw Error(`Unsupported convert operator ${n}`)}}function Bh(e,t,n,r,i,a){let o=i-n;if(o===0)return r;let s=t-n;return r+(e===1?s/o:(e**+s-1)/(e**+o-1))*(a-r)}function Vh(e,t,n,r,i,a){return i-n===0?r:[Bh(e,t,n,r[0],i,a[0]),Bh(e,t,n,r[1],i,a[1]),Bh(e,t,n,r[2],i,a[2]),Bh(e,t,n,r[3],i,a[3])]}function Hh(e,t,n,r,i,a){if(i-n===0)return r;let o=Nm(r),s=Nm(a),c=s[2]-o[2];return c>180?c-=360:c<-180&&(c+=360),Pm([Bh(e,t,n,o[0],i,s[0]),Bh(e,t,n,o[1],i,s[1]),o[2]+Bh(e,t,n,0,i,c),Bh(e,t,n,r[3],i,a[3])])}var Q={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function Uh(e,t,n){let r=e,i=!0,a=!1,o=!1,s=[Fs(r,z.LOAD,function(){o=!0,a||t()})];return r.src&&hc?(a=!0,r.decode().then(function(){i&&t()}).catch(function(e){i&&(o?t():n())})):s.push(Fs(r,z.ERROR,n)),function(){i=!1,s.forEach(R)}}function Wh(e,t){return new Promise((n,r)=>{function i(){o(),n(e)}function a(){o(),r(Error(`Image load error`))}function o(){e.removeEventListener(`load`,i),e.removeEventListener(`error`,a)}e.addEventListener(`load`,i),e.addEventListener(`error`,a),t&&(e.src=t)})}function Gh(e,t){return t&&(e.src=t),e.src&&hc?new Promise((t,n)=>e.decode().then(()=>t(e)).catch(r=>e.complete&&e.width?t(e):n(r))):Wh(e)}var Kh=class{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let e=0;for(let t in this.cache_){let n=this.cache_[t];!(e++&3)&&!n.hasListener()&&(delete this.cache_[t],delete this.patternCache_[t],--this.cacheSize_)}}}get(e,t){let n=qh(e,t);return n in this.cache_?this.cache_[n]:null}getPattern(e,t){let n=qh(e,t);return n in this.patternCache_?this.patternCache_[n]:null}set(e,t,n,r){let i=qh(e,t),a=i in this.cache_;if(n&&(this.cache_[i]=n),r&&n){if(n.getImageState()===Q.IDLE&&n.load(),n.getImageState()===Q.LOADING)n.ready().then(()=>{let e=qf().createPattern(n.getImage(1),`repeat`);e&&(this.patternCache_[i]=e)});else{let e=qf().createPattern(n.getImage(1),`repeat`);e&&(this.patternCache_[i]=e)}}a||++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}};function qh(e,t){let n=t?Im(t):`null`;return e+`:`+n}var Jh=new Kh,Yh=null,Xh=class extends $s{constructor(e,t,n,r,i){super(),this.hitDetectionImage_=null,this.image_=e,this.crossOrigin_=n?.crossOrigin??null,this.referrerPolicy_=n?.referrerPolicy,this.canvas_={},this.color_=i,this.imageState_=r===void 0?Q.IDLE:r,this.size_=e&&e.width&&e.height?[e.width,e.height]:null,this.src_=t,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===Q.LOADED){let e=this.image_;if(!e)return!1;Yh||=Gf(1,1,void 0,{willReadFrequently:!0}),Yh.drawImage(e,0,0);try{Yh.getImageData(0,0,1,1),this.tainted_=!1}catch{Yh=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(z.CHANGE)}handleImageError_(){this.imageState_=Q.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=Q.LOADED;let e=this.image_;e&&`width`in e&&`height`in e&&(this.size_=[e.width,e.height]),this.dispatchChangeEvent_()}getImage(e){this.image_||this.initializeImage_(),this.replaceColor_(e);let t=this.image_;return this.canvas_[e]?this.canvas_[e]:t}setImage(e){this.image_=e}getPixelRatio(e){return this.replaceColor_(e),this.canvas_[e]?e:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_){if(this.isTainted_()){let e=this.size_;if(!e)return this.image_;let t=e[0],n=e[1],r=Gf(t,n);r.fillRect(0,0,t,n),this.hitDetectionImage_=r.canvas}else this.hitDetectionImage_=this.image_}return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===Q.IDLE){this.image_||this.initializeImage_(),this.imageState_=Q.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&Gh(this.image_,this.src_).then(e=>{this.image_=e,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(e){if(!this.color_||this.canvas_[e]||this.imageState_!==Q.LOADED)return;let t=this.image_;if(!t)return;let n=Gf(Math.ceil(t.width*e),Math.ceil(t.height*e)),r=n.canvas;n.scale(e,e),n.drawImage(t,0,0),n.globalCompositeOperation=`multiply`,n.fillStyle=wm(this.color_),n.fillRect(0,0,r.width/e,r.height/e),n.globalCompositeOperation=`destination-in`,n.drawImage(t,0,0),this.canvas_[e]=r}ready(){return this.ready_||=new Promise(e=>{if(this.imageState_===Q.LOADED||this.imageState_===Q.ERROR)e();else{let t=()=>{(this.imageState_===Q.LOADED||this.imageState_===Q.ERROR)&&(this.removeEventListener(z.CHANGE,t),e())};this.addEventListener(z.CHANGE,t)}}),this.ready_}};function Zh(e,t,n,r,i,a){let o=t===void 0?void 0:Jh.get(t,i);return o||(o=new Xh(e,e&&`src`in e?e.src||void 0:t,n,r,i),t!==void 0&&Jh.set(t,i,o,a)),a&&o&&t!==void 0&&!Jh.getPattern(t,i)&&Jh.set(t,i,o,a),o}function Qh(e){return e?Array.isArray(e)?Lm(e):typeof e==`object`&&`src`in e?$h(e):e:null}function $h(e){if(!e.offset||!e.size)return Jh.getPattern(e.src,e.color??null);let t=e.src+`:`+e.offset,n=Jh.getPattern(t,e.color??null);if(n)return n;let r=Jh.get(e.src,null);if(!r||r.getImageState()!==Q.LOADED)return null;let i=Gf(e.size[0],e.size[1]);return i.drawImage(r.getImage(1),e.offset[0],e.offset[1],e.size[0],e.size[1],0,0,e.size[0],e.size[1]),Zh(i.canvas,t,{},Q.LOADED,e.color??null,!0),Jh.getPattern(t,e.color??null)}var eg=`10px sans-serif`,tg=`#000`,ng=`round`,rg=[],ig=`round`,ag=`#000`,og=`center`,sg=`middle`,cg=[0,0,0,0],lg=new rc,ug=null,dg,fg={},pg=new Set([`serif`,`sans-serif`,`monospace`,`cursive`,`fantasy`,`system-ui`,`ui-serif`,`ui-sans-serif`,`ui-monospace`,`ui-rounded`,`emoji`,`math`,`fangsong`]);function mg(e,t,n){return`${e} ${t} 16px "${n}"`}var hg=(function(){let e,t;async function n(e){await t.ready;let n=Wf(e);if(!n)return!1;let r=n.families[0].toLowerCase(),i=n.weight,a=[];return t.forEach(e=>{let t=e.family.replace(/^['"]|['"]$/g,``).toLowerCase(),o=Uf[e.weight]||e.weight;t===r&&e.style===n.style&&o==i&&a.push(e)}),a.length!==0&&(await Promise.all(a.map(e=>e.load().then(()=>!0,()=>!1)))).some(e=>e)}async function r(){await t.ready;let i=!0,a=lg.getProperties(),o=Object.keys(a).filter(e=>a[e]<100);for(let e=o.length-1;e>=0;--e){let t=o[e],r=a[t];r<100&&(await n(t)?(Ns(fg),lg.set(t,100)):(r+=10,lg.set(t,r,!0),r<100&&(i=!1)))}e=void 0,i||(e=setTimeout(r,100))}return async function(n){t||=mc?self.fonts:document.fonts;let i=Wf(n);if(!i)return;let a=i.families,o=!1;for(let e of a){if(pg.has(e))continue;let t=mg(i.style,i.weight,e);lg.get(t)===void 0&&(lg.set(t,0,!0),o=!0)}o&&(clearTimeout(e),e=setTimeout(r,100))}})(),gg=(function(){let e;return function(t){let n=fg[t];if(n==null){if(mc){let e=Wf(t),r=_g(t,`Žg`);n=(!e||isNaN(Number(e.lineHeight))?1.2:Number(e.lineHeight))*(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent)}else e||(e=document.createElement(`div`),e.innerHTML=`M`,e.style.minHeight=`0`,e.style.maxHeight=`none`,e.style.height=`auto`,e.style.padding=`0`,e.style.border=`none`,e.style.position=`absolute`,e.style.display=`block`,e.style.left=`-99999px`),e.style.font=t,document.body.appendChild(e),n=e.offsetHeight,document.body.removeChild(e);fg[t]=n}return n}})();function _g(e,t){return ug||=Gf(1,1),e!=dg&&(ug.font=e,dg=ug.font),ug.measureText(t)}function vg(e,t){return _g(e,t).width}function yg(e,t,n){if(t in n)return n[t];let r=t.split(`
`).reduce((t,n)=>Math.max(t,vg(e,n)),0);return n[t]=r,r}function bg(e,t){let n=[],r=[],i=[],a=0,o=0,s=0,c=0;for(let l=0,u=t.length;l<=u;l+=2){let d=t[l];if(d===`
`||l===u){a=Math.max(a,o),i.push(o),o=0,s+=c,c=0;continue}let f=t[l+1]||e.font,p=vg(f,d);n.push(p),o+=p;let m=gg(f);r.push(m),c=Math.max(c,m)}return{width:a,height:s,widths:n,heights:r,lineWidths:i}}function xg(e,t,n,r,i,a,o,s,c,l,u){e.save(),n!==1&&(e.globalAlpha===void 0?e.globalAlpha=function(e){return e.globalAlpha*=n}:e.globalAlpha*=n),t&&e.transform.apply(e,t),r.contextInstructions?(e.translate(c,l),e.scale(u[0],u[1]),Sg(r,e)):u[0]<0||u[1]<0?(e.translate(c,l),e.scale(u[0],u[1]),e.drawImage(r,i,a,o,s,0,0,o,s)):e.drawImage(r,i,a,o,s,c,l,o*u[0],s*u[1]),e.restore()}function Sg(e,t){let n=t,r=e.contextInstructions;for(let e=0,t=r.length;e<t;e+=2)if(Array.isArray(r[e+1]))n[r[e]].apply(n,r[e+1]);else{let t=r[e];n[t]=r[e+1]}}var Cg=class e{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=Bm(e.scale),this.displacement_=e.displacement,this.declutterMode_=e.declutterMode}clone(){let t=this.getScale();return new e({opacity:this.getOpacity(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return B()}getImage(e){return B()}getHitDetectionImage(){return B()}getPixelRatio(e){return 1}getImageState(){return B()}getImageSize(){return B()}getOrigin(){return B()}getSize(){return B()}setDisplacement(e){this.displacement_=e}setOpacity(e){this.opacity_=e}setRotateWithView(e){this.rotateWithView_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=Bm(e)}listenImageChange(e){B()}load(){B()}unlistenImageChange(e){B()}ready(){return Promise.resolve()}},wg=class e extends Cg{constructor(e){super({opacity:1,rotateWithView:e.rotateWithView!==void 0&&e.rotateWithView,rotation:e.rotation===void 0?0:e.rotation,scale:e.scale===void 0?1:e.scale,displacement:e.displacement===void 0?[0,0]:e.displacement,declutterMode:e.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=e.fill===void 0?null:e.fill,this.origin_=[0,0],this.points_=e.points,this.radius=e.radius,this.radius2_=e.radius2,this.angle_=e.angle===void 0?0:e.angle,this.stroke_=e.stroke===void 0?null:e.stroke,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?Q.LOADING:Q.LOADED,this.imageState_===Q.LOADING&&this.ready().then(()=>this.imageState_=Q.LOADED),this.render()}clone(){let t=this.getScale(),n=new e({fill:this.getFill()?.clone(),points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?.clone(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return n.setOpacity(this.getOpacity()),n}getAnchor(){let e=this.size_,t=this.getDisplacement(),n=this.getScaleArray();return[e[0]/2-t[0]/n[0],e[1]/2+t[1]/n[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(e){this.fill_=e,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||=this.createHitDetectionCanvas_(this.renderOptions_),this.hitDetectionCanvas_}getImage(e){let t=this.fill_?.getKey(),n=`${e},${this.angle_},${this.radius},${this.radius2_},${this.points_},${t}`+Object.values(this.renderOptions_).join(`,`),r=Jh.get(n,null)?.getImage(1);if(!r){let t=this.renderOptions_,i=Math.ceil(t.size*e),a=Gf(i,i);this.draw_(t,a,e),r=a.canvas;let o=new Xh(r,void 0,{},Q.LOADED,null);Jh.set(n,null,o),createImageBitmap(r).then(e=>{o.setImage(e)})}return r}getPixelRatio(e){return e}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}setRadius(e){this.radius!==e&&(this.radius=e,this.render())}getRadius2(){return this.radius2_}setRadius2(e){this.radius2_!==e&&(this.radius2_=e,this.render())}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e,this.render()}listenImageChange(e){}load(){}unlistenImageChange(e){}calculateLineJoinSize_(e,t,n){if(t===0||this.points_===1/0||e!==`bevel`&&e!==`miter`)return t;let r=this.radius,i=this.radius2_===void 0?r:this.radius2_;if(r<i){let e=r;r=i,i=e}let a=this.radius2_===void 0?this.points_:this.points_*2,o=2*Math.PI/a,s=i*Math.sin(o),c=Math.sqrt(i*i-s*s),l=r-c,u=Math.sqrt(s*s+l*l),d=u/s;if(e===`miter`&&d<=n)return d*t;let f=t/2/d,p=t/2*(l/u),m=Math.sqrt((r+f)*(r+f)+p*p)-r;if(this.radius2_===void 0||e===`bevel`)return m*2;let h=r*Math.sin(o),g=Math.sqrt(r*r-h*h),_=i-g,v=Math.sqrt(h*h+_*_)/h;if(v<=n){let e=v*t/2-i-r;return 2*Math.max(m,e)}return m*2}createRenderOptions(){let e=ng,t=ig,n=0,r=null,i=0,a,o=0;this.stroke_&&(a=Qh(this.stroke_.getColor()??`#000`),o=this.stroke_.getWidth()??1,r=this.stroke_.getLineDash(),i=this.stroke_.getLineDashOffset()??0,t=this.stroke_.getLineJoin()??`round`,e=this.stroke_.getLineCap()??`round`,n=this.stroke_.getMiterLimit()??10);let s=this.calculateLineJoinSize_(t,o,n),c=Math.max(this.radius,this.radius2_||0),l=Math.ceil(2*c+s);return{strokeStyle:a,strokeWidth:o,size:l,lineCap:e,lineDash:r,lineDashOffset:i,lineJoin:t,miterLimit:n}}render(){this.renderOptions_=this.createRenderOptions();let e=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[e,e]}draw_(e,t,n){if(t.scale(n,n),t.translate(e.size/2,e.size/2),this.createPath_(t),this.fill_){let e=this.fill_.getColor();e===null&&(e=tg),t.fillStyle=Qh(e),t.fill()}e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineCap=e.lineCap,t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}createHitDetectionCanvas_(e){let t;if(this.fill_){let n=this.fill_.getColor(),r=0;typeof n==`string`&&(n=Im(n)),n===null?r=1:Array.isArray(n)&&(r=n.length===4?n[3]:1),r===0&&(t=Gf(e.size,e.size),this.drawHitDetectionCanvas_(e,t))}return t?t.canvas:this.getImage(1)}createPath_(e){let t=this.points_,n=this.radius;if(t===1/0)e.arc(0,0,n,0,2*Math.PI);else{let r=this.radius2_===void 0?n:this.radius2_;this.radius2_!==void 0&&(t*=2);let i=this.angle_-Math.PI/2,a=2*Math.PI/t;for(let o=0;o<t;o++){let t=i+o*a,s=o%2==0?n:r;e.lineTo(s*Math.cos(t),s*Math.sin(t))}e.closePath()}}drawHitDetectionCanvas_(e,t){t.translate(e.size/2,e.size/2),this.createPath_(t),t.fillStyle=tg,t.fill(),e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}},Tg=class e extends wg{constructor(e){e||={radius:5},super({points:1/0,fill:e.fill,radius:e.radius,stroke:e.stroke,scale:e.scale===void 0?1:e.scale,rotation:e.rotation===void 0?0:e.rotation,rotateWithView:e.rotateWithView!==void 0&&e.rotateWithView,displacement:e.displacement===void 0?[0,0]:e.displacement,declutterMode:e.declutterMode})}clone(){let t=this.getScale(),n=new e({fill:this.getFill()?.clone(),stroke:this.getStroke()?.clone(),radius:this.getRadius(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return n.setOpacity(this.getOpacity()),n}},Eg=class e{constructor(e){e||={},this.patternImage_=null,this.color_=null,e.color!==void 0&&this.setColor(e.color)}clone(){let t=this.getColor();return new e({color:Array.isArray(t)?t.slice():t||void 0})}getColor(){return this.color_}setColor(e){if(typeof e==`object`&&e&&`src`in e){let t=Zh(null,e.src,{crossOrigin:`anonymous`},void 0,e.offset?null:e.color?e.color:null,!(e.offset&&e.size));t.ready().then(()=>{this.patternImage_=null}),t.getImageState()===Q.IDLE&&t.load(),t.getImageState()===Q.LOADING&&(this.patternImage_=t)}this.color_=e}getKey(){let e=this.getColor();return e?e instanceof CanvasPattern||e instanceof CanvasGradient?V(e):typeof e==`object`&&`src`in e?e.src+`:`+e.offset:Im(e).toString():``}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}};function Dg(e,t,n,r){return n!==void 0&&r!==void 0?[n/e,r/t]:n===void 0?r===void 0?1:r/t:n/e}var Og=class e extends Cg{constructor(e){e||={};let t=e.opacity===void 0?1:e.opacity,n=e.rotation===void 0?0:e.rotation,r=e.scale===void 0?1:e.scale,i=e.rotateWithView!==void 0&&e.rotateWithView;super({opacity:t,rotation:n,scale:r,displacement:e.displacement===void 0?[0,0]:e.displacement,rotateWithView:i,declutterMode:e.declutterMode}),this.anchor_=e.anchor===void 0?[.5,.5]:e.anchor,this.normalizedAnchor_=null,this.anchorOrigin_=e.anchorOrigin===void 0?`top-left`:e.anchorOrigin,this.anchorXUnits_=e.anchorXUnits===void 0?`fraction`:e.anchorXUnits,this.anchorYUnits_=e.anchorYUnits===void 0?`fraction`:e.anchorYUnits,this.crossOrigin_=e.crossOrigin===void 0?null:e.crossOrigin,this.referrerPolicy_=e.referrerPolicy;let a=e.img===void 0?null:e.img,o=e.src;U(!(o!==void 0&&a),"`image` and `src` cannot be provided at the same time"),(o===void 0||o.length===0)&&a&&(o=a.src||V(a)),U(o!==void 0&&o.length>0,"A defined and non-empty `src` or `image` must be provided"),U(e.width===void 0&&e.height===void 0||e.scale===void 0,"`width` or `height` cannot be provided together with `scale`");let s;if(e.src===void 0?a!==void 0&&(s=`complete`in a?a.complete?a.src?Q.LOADED:Q.IDLE:Q.LOADING:Q.LOADED):s=Q.IDLE,this.color_=e.color===void 0?null:Im(e.color),this.iconImage_=Zh(a,o,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},s,this.color_),this.offset_=e.offset===void 0?[0,0]:e.offset,this.offsetOrigin_=e.offsetOrigin===void 0?`top-left`:e.offsetOrigin,this.origin_=null,this.size_=e.size===void 0?null:e.size,this.initialOptions_,e.width!==void 0||e.height!==void 0){let t,n;if(e.size)[t,n]=e.size;else{let r=this.getImage(1);if(r.width&&r.height)t=r.width,n=r.height;else if(r instanceof HTMLImageElement){this.initialOptions_=e;let t=()=>{if(this.unlistenImageChange(t),!this.initialOptions_)return;let n=this.iconImage_.getSize();n&&this.setScale(Dg(n[0],n[1],e.width,e.height))};this.listenImageChange(t);return}}t!==void 0&&this.setScale(Dg(t,n,e.width,e.height))}}clone(){let t,n,r;return this.initialOptions_?(n=this.initialOptions_.width,r=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new e({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:n,height:r,size:this.size_===null?void 0:this.size_.slice(),src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let e=this.normalizedAnchor_;if(!e){e=this.anchor_;let t=this.getSize();if(this.anchorXUnits_==`fraction`||this.anchorYUnits_==`fraction`){if(!t)return null;e=this.anchor_.slice(),this.anchorXUnits_==`fraction`&&(e[0]*=t[0]),this.anchorYUnits_==`fraction`&&(e[1]*=t[1])}if(this.anchorOrigin_!=`top-left`){if(!t)return null;e===this.anchor_&&(e=this.anchor_.slice()),(this.anchorOrigin_==`top-right`||this.anchorOrigin_==`bottom-right`)&&(e[0]=-e[0]+t[0]),(this.anchorOrigin_==`bottom-left`||this.anchorOrigin_==`bottom-right`)&&(e[1]=-e[1]+t[1])}this.normalizedAnchor_=e}let t=this.getDisplacement(),n=this.getScaleArray();return[e[0]-t[0]/n[0],e[1]+t[1]/n[1]]}setAnchor(e){this.anchor_=e,this.normalizedAnchor_=null}getColor(){return this.color_}setColor(e){let t=e?Im(e):null;if(this.color_===t||this.color_&&t&&this.color_.length===t.length&&this.color_.every((e,n)=>e===t[n]))return;this.color_=t;let n=this.getSrc(),r=n===void 0?this.getHitDetectionImage():null,i=n===void 0?this.iconImage_.getImageState():Q.IDLE;this.iconImage_=Zh(r,n,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},i,this.color_)}getImage(e){return this.iconImage_.getImage(e)}getPixelRatio(e){return this.iconImage_.getPixelRatio(e)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let e=this.offset_;if(this.offsetOrigin_!=`top-left`){let t=this.getSize(),n=this.iconImage_.getSize();if(!t||!n)return null;e=e.slice(),(this.offsetOrigin_==`top-right`||this.offsetOrigin_==`bottom-right`)&&(e[0]=n[0]-t[0]-e[0]),(this.offsetOrigin_==`bottom-left`||this.offsetOrigin_==`bottom-right`)&&(e[1]=n[1]-t[1]-e[1])}return this.origin_=e,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(e){this.iconImage_=Zh(null,e,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},Q.IDLE,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){let e=this.getScaleArray();if(this.size_)return this.size_[0]*e[0];if(this.iconImage_.getImageState()==Q.LOADED){let t=this.iconImage_.getSize();if(t)return t[0]*e[0]}}getHeight(){let e=this.getScaleArray();if(this.size_)return this.size_[1]*e[1];if(this.iconImage_.getImageState()==Q.LOADED){let t=this.iconImage_.getSize();if(t)return t[1]*e[1]}}setScale(e){delete this.initialOptions_,super.setScale(e)}listenImageChange(e){this.iconImage_.addEventListener(z.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(z.CHANGE,e)}ready(){return this.iconImage_.ready()}},kg=class e{constructor(e){e||={},this.color_=e.color===void 0?null:e.color,this.lineCap_=e.lineCap,this.lineDash_=e.lineDash===void 0?null:e.lineDash,this.lineDashOffset_=e.lineDashOffset,this.lineJoin_=e.lineJoin,this.miterLimit_=e.miterLimit,this.offset_=e.offset,this.width_=e.width}clone(){let t=this.getColor();return new e({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?.slice(),lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),offset:this.getOffset(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getOffset(){return this.offset_}getWidth(){return this.width_}setColor(e){this.color_=e}setLineCap(e){this.lineCap_=e}setLineDash(e){this.lineDash_=e}setLineDashOffset(e){this.lineDashOffset_=e}setLineJoin(e){this.lineJoin_=e}setMiterLimit(e){this.miterLimit_=e}setOffset(e){this.offset_=e}setWidth(e){this.width_=e}},Ag=class e{constructor(e){e||={},this.geometry_=null,this.geometryFunction_=Pg,e.geometry!==void 0&&this.setGeometry(e.geometry),this.fill_=e.fill===void 0?null:e.fill,this.image_=e.image===void 0?null:e.image,this.renderer_=e.renderer===void 0?null:e.renderer,this.hitDetectionRenderer_=e.hitDetectionRenderer===void 0?null:e.hitDetectionRenderer,this.stroke_=e.stroke===void 0?null:e.stroke,this.text_=e.text===void 0?null:e.text,this.zIndex_=e.zIndex}clone(){let t=this.getGeometry();return t&&typeof t==`object`&&(t=t.clone()),new e({geometry:t??void 0,fill:this.getFill()?.clone(),image:this.getImage()?.clone(),renderer:this.getRenderer()??void 0,stroke:this.getStroke()?.clone(),text:this.getText()?.clone(),zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(e){this.renderer_=e}setHitDetectionRenderer(e){this.hitDetectionRenderer_=e}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(e){this.fill_=e}getImage(){return this.image_}setImage(e){this.image_=e}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e}getText(){return this.text_}setText(e){this.text_=e}getZIndex(){return this.zIndex_}setGeometry(e){typeof e==`function`?this.geometryFunction_=e:typeof e==`string`?this.geometryFunction_=function(t){return t.get(e)}:e?e!==void 0&&(this.geometryFunction_=function(){return e}):this.geometryFunction_=Pg,this.geometry_=e}setZIndex(e){this.zIndex_=e}};function jg(e){let t;if(typeof e==`function`)t=e;else{let n;Array.isArray(e)?n=e:(U(typeof e.getZIndex==`function`,"Expected an `Style` or an array of `Style`"),n=[e]),t=function(){return n}}return t}var Mg=null;function Ng(e,t){if(!Mg){let e=new Eg({color:`rgba(255,255,255,0.4)`}),t=new kg({color:`#3399CC`,width:1.25});Mg=[new Ag({image:new Tg({fill:e,stroke:t,radius:5}),fill:e,stroke:t})]}return Mg}function Pg(e){return e.getGeometry()}var Fg=`#333`,Ig=class e{constructor(e){e||={},this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.keepUpright_=e.keepUpright,this.scale_=e.scale,this.scaleArray_=Bm(e.scale===void 0?1:e.scale),this.text_=e.text,this.textAlign_=e.textAlign,this.justify_=e.justify,this.repeat_=e.repeat,this.textBaseline_=e.textBaseline,this.fill_=e.fill===void 0?new Eg({color:Fg}):e.fill,this.maxAngle_=e.maxAngle===void 0?Math.PI/4:e.maxAngle,this.placement_=e.placement===void 0?`point`:e.placement,this.overflow_=!!e.overflow,this.stroke_=e.stroke===void 0?null:e.stroke,this.offsetX_=e.offsetX===void 0?0:e.offsetX,this.offsetY_=e.offsetY===void 0?0:e.offsetY,this.backgroundFill_=e.backgroundFill?e.backgroundFill:null,this.backgroundStroke_=e.backgroundStroke?e.backgroundStroke:null,this.padding_=e.padding===void 0?null:e.padding,this.declutterMode_=e.declutterMode}clone(){let t=this.getScale();return new e({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),keepUpright:this.getKeepUpright(),scale:Array.isArray(t)?t.slice():t,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()instanceof Eg?this.getFill().clone():this.getFill(),stroke:this.getStroke()?.clone(),offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?.clone(),backgroundStroke:this.getBackgroundStroke()?.clone(),padding:this.getPadding()||void 0,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getKeepUpright(){return this.keepUpright_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}getDeclutterMode(){return this.declutterMode_}setOverflow(e){this.overflow_=e}setFont(e){this.font_=e}setMaxAngle(e){this.maxAngle_=e}setOffsetX(e){this.offsetX_=e}setOffsetY(e){this.offsetY_=e}setPlacement(e){this.placement_=e}setRepeat(e){this.repeat_=e}setRotateWithView(e){this.rotateWithView_=e}setKeepUpright(e){this.keepUpright_=e}setFill(e){this.fill_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=Bm(e===void 0?1:e)}setStroke(e){this.stroke_=e}setText(e){this.text_=e}setTextAlign(e){this.textAlign_=e}setJustify(e){this.justify_=e}setTextBaseline(e){this.textBaseline_=e}setBackgroundFill(e){this.backgroundFill_=e}setBackgroundStroke(e){this.backgroundStroke_=e}setPadding(e){this.padding_=e}};function Lg(e){return!0}function Rg(e,t){t??=ih();let n=Vg(e,t),r=Eh();return function(e,i){if(r.properties=e.getPropertiesInternal()??{},r.resolution=i,t.featureId){let t=e.getId();t===void 0?r.featureId=null:r.featureId=t}if(t.geometryType){let t=e.getGeometry();t&&(r.geometryType=Th(t))}return n(r)}}function zg(e,t){t??=ih();let n=e.length,r=Array(n);for(let i=0;i<n;++i)r[i]=Hg(e[i],t);let i=Eh(),a=Array(n);return function(e,o){if(i.properties=e.getPropertiesInternal()??{},i.resolution=o,t.featureId){let t=e.getId();t===void 0?i.featureId=null:i.featureId=t}if(t.geometryType){let t=e.getGeometry();t&&(i.geometryType=Th(t))}let s=0;for(let e=0;e<n;++e){let t=r[e](i);t&&(a[s]=t,s+=1)}return a.length=s,a}}function Bg(e,t){if(t??=ih(),!Array.isArray(e))return zg([e],t);let n=e.length;if(`style`in e[0]){let r=Array(n);for(let t=0;t<n;++t){let n=e[t];if(!(`style`in n))throw Error(`Expected a list of rules with a style property`);r[t]=n}return Rg(r,t)}return zg(e,t)}function Vg(e,t){let n=e.length,r=Array(n);for(let i=0;i<n;++i){let n=e[i],a=`filter`in n&&n.filter!==void 0?Dh(n.filter,Hm,t):Lg,o;if(Array.isArray(n.style)){let e=n.style.length;o=Array(e);for(let r=0;r<e;++r)o[r]=Hg(n.style[r],t)}else o=[Hg(n.style,t)];r[i]={filter:a,styles:o}}return function(t){let i=[],a=!1;for(let o=0;o<n;++o){let n=r[o].filter;if(n(t)&&!(e[o].else&&a)){a=!0;for(let e of r[o].styles){let n=e(t);n&&i.push(n)}}}return i}}function Hg(e,t){let n=Ug(e,``,t),r=Wg(e,``,t),i=Gg(e,t),a=Kg(e,t),o=Zg(e,`z-index`,t);if(!n&&!r&&!i&&!a&&!Ps(e))throw Error(`No fill, stroke, point, or text symbolizer properties in style: `+JSON.stringify(e));let s=new Ag;return function(e){let t=!0;if(n){let r=n(e);r&&(t=!1),s.setFill(r)}if(r){let n=r(e);n&&(t=!1),s.setStroke(n)}if(i){let n=i(e);n&&(t=!1),s.setText(n)}if(a){let n=a(e);n&&(t=!1),s.setImage(n)}return o&&s.setZIndex(o(e)),t?null:s}}function Ug(e,t,n){let r;if(t+`fill-pattern-src`in e)r=$g(e,t+`fill-`,n);else{if(Xg(e,t+`fill-color`)===`none`)return e=>null;r=t_(e,t+`fill-color`,n)}if(!r)return null;let i=new Eg;return function(e){let t=r(e);return t===mm?null:(i.setColor(t),i)}}function Wg(e,t,n){let r=Zg(e,t+`stroke-width`,n),i=t_(e,t+`stroke-color`,n);if(!r&&!i)return null;let a=Qg(e,t+`stroke-line-cap`,n),o=Qg(e,t+`stroke-line-join`,n),s=n_(e,t+`stroke-line-dash`,n),c=Zg(e,t+`stroke-line-dash-offset`,n),l=Zg(e,t+`stroke-miter-limit`,n),u=Zg(e,t+`stroke-offset`,n),d=new kg;return function(e){if(i){let t=i(e);if(t===mm)return null;d.setColor(t)}if(r&&d.setWidth(r(e)),a){let t=a(e);if(t!==`butt`&&t!==`round`&&t!==`square`)throw Error(`Expected butt, round, or square line cap`);d.setLineCap(t)}if(o){let t=o(e);if(t!==`bevel`&&t!==`round`&&t!==`miter`)throw Error(`Expected bevel, round, or miter line join`);d.setLineJoin(t)}return s&&d.setLineDash(s(e)),c&&d.setLineDashOffset(c(e)),l&&d.setMiterLimit(l(e)),u&&d.setOffset(u(e)),d}}function Gg(e,t){let n=`text-`,r=Qg(e,`text-value`,t);if(!r)return null;let i=Ug(e,n,t),a=Ug(e,`text-background-`,t),o=Wg(e,n,t),s=Wg(e,`text-background-`,t),c=Qg(e,`text-font`,t),l=Zg(e,`text-max-angle`,t),u=Zg(e,`text-offset-x`,t),d=Zg(e,`text-offset-y`,t),f=e_(e,`text-overflow`,t),p=Qg(e,`text-placement`,t),m=Zg(e,`text-repeat`,t),h=a_(e,`text-scale`,t),g=e_(e,`text-rotate-with-view`,t),_=Zg(e,`text-rotation`,t),v=Qg(e,`text-align`,t),y=Qg(e,`text-justify`,t),b=Qg(e,`text-baseline`,t),x=e_(e,`text-keep-upright`,t),S=n_(e,`text-padding`,t),C=new Ig({declutterMode:f_(e,`text-declutter-mode`)});return function(e){if(C.setText(r(e)),i&&C.setFill(i(e)),a&&C.setBackgroundFill(a(e)),o&&C.setStroke(o(e)),s&&C.setBackgroundStroke(s(e)),c&&C.setFont(c(e)),l&&C.setMaxAngle(l(e)),u&&C.setOffsetX(u(e)),d&&C.setOffsetY(d(e)),f&&C.setOverflow(f(e)),p){let t=p(e);if(t!==`point`&&t!==`line`)throw Error(`Expected point or line for text-placement`);C.setPlacement(t)}if(m&&C.setRepeat(m(e)),h&&C.setScale(h(e)),g&&C.setRotateWithView(g(e)),_&&C.setRotation(_(e)),v){let t=v(e);if(t!==`left`&&t!==`center`&&t!==`right`&&t!==`end`&&t!==`start`)throw Error(`Expected left, right, center, start, or end for text-align`);C.setTextAlign(t)}if(y){let t=y(e);if(t!==`left`&&t!==`right`&&t!==`center`)throw Error(`Expected left, right, or center for text-justify`);C.setJustify(t)}if(b){let t=b(e);if(t!==`bottom`&&t!==`top`&&t!==`middle`&&t!==`alphabetic`&&t!==`hanging`)throw Error(`Expected bottom, top, middle, alphabetic, or hanging for text-baseline`);C.setTextBaseline(t)}return S&&C.setPadding(S(e)),x&&C.setKeepUpright(x(e)),C}}function Kg(e,t){return`icon-src`in e?qg(e,t):`shape-points`in e?Jg(e,t):`circle-radius`in e?Yg(e,t):null}function qg(e,t){let n=`icon-src`,r=m_(Xg(e,n),n),i=r_(e,`icon-anchor`,t),a=a_(e,`icon-scale`,t),o=Zg(e,`icon-opacity`,t),s=r_(e,`icon-displacement`,t),c=Zg(e,`icon-rotation`,t),l=e_(e,`icon-rotate-with-view`,t),u=l_(e,`icon-anchor-origin`),d=u_(e,`icon-anchor-x-units`),f=u_(e,`icon-anchor-y-units`),p=Xg(e,`icon-color`),m,h=null;p!==void 0&&(Array.isArray(p)&&p.length>0&&typeof p[0]==`string`?h=t_(e,`icon-color`,t):m=g_(p,`icon-color`));let g=c_(e,`icon-cross-origin`),_=d_(e,`icon-offset`),v=l_(e,`icon-offset-origin`),y=o_(e,`icon-width`),b={src:r,anchorOrigin:u,anchorXUnits:d,anchorYUnits:f,crossOrigin:g,offset:_,offsetOrigin:v,height:o_(e,`icon-height`),width:y,size:s_(e,`icon-size`),declutterMode:f_(e,`icon-declutter-mode`)},x=null;return function(e){if(x)h&&x.setColor(h(e));else{let t=h?h(e):m;x=new Og(t===void 0?Object.assign({},b):Object.assign({},b,{color:t}))}return o&&x.setOpacity(o(e)),s&&x.setDisplacement(s(e)),c&&x.setRotation(c(e)),l&&x.setRotateWithView(l(e)),a&&x.setScale(a(e)),i&&x.setAnchor(i(e)),x}}function Jg(e,t){let n=`shape-`,r=`shape-points`,i=`shape-radius`,a=h_(Xg(e,r),r);if(!(i in e))throw Error(`Expected a number for ${i}`);let o=Zg(e,i,t),s=Xg(e,i),c=typeof s==`number`?s:5,l=`shape-radius2`,u=Zg(e,l,t),d=Xg(e,l),f=typeof d==`number`?d:void 0,p=Ug(e,n,t),m=Wg(e,n,t),h=a_(e,`shape-scale`,t),g=r_(e,`shape-displacement`,t),_=Zg(e,`shape-rotation`,t),v=e_(e,`shape-rotate-with-view`,t),y=new wg({points:a,radius:c,radius2:f,angle:o_(e,`shape-angle`),declutterMode:f_(e,`shape-declutter-mode`)});return function(e){return o&&y.setRadius(o(e)),u&&y.setRadius2(u(e)),p&&y.setFill(p(e)),m&&y.setStroke(m(e)),g&&y.setDisplacement(g(e)),_&&y.setRotation(_(e)),v&&y.setRotateWithView(v(e)),h&&y.setScale(h(e)),y}}function Yg(e,t){let n=`circle-`,r=Ug(e,n,t),i=Wg(e,n,t),a=Zg(e,`circle-radius`,t),o=a_(e,`circle-scale`,t),s=r_(e,`circle-displacement`,t),c=Zg(e,`circle-rotation`,t),l=e_(e,`circle-rotate-with-view`,t),u=new Tg({radius:5,declutterMode:f_(e,`circle-declutter-mode`)});return function(e){return a&&u.setRadius(a(e)),r&&u.setFill(r(e)),i&&u.setStroke(i(e)),s&&u.setDisplacement(s(e)),c&&u.setRotation(c(e)),l&&u.setRotateWithView(l(e)),o&&u.setScale(o(e)),u}}function Xg(e,t){if(!(t in e))return;let n=e[t];return n===void 0?void 0:n}function Zg(e,t,n){let r=Xg(e,t);if(r===void 0)return;let i=Dh(r,q,n);return function(e){return h_(i(e),t)}}function Qg(e,t,n){let r=Xg(e,t);if(r===void 0)return null;let i=Dh(r,Um,n);return function(e){return m_(i(e),t)}}function $g(e,t,n){let r=Qg(e,t+`pattern-src`,n),i=i_(e,t+`pattern-offset`,n),a=i_(e,t+`pattern-size`,n),o=t_(e,t+`color`,n);return function(e){return r?{src:r(e),offset:i?i(e):null,size:a?a(e):null,color:o?o(e):null}:null}}function e_(e,t,n){let r=Xg(e,t);if(r===void 0)return null;let i=Dh(r,Hm,n);return function(e){let n=i(e);if(typeof n!=`boolean`)throw Error(`Expected a boolean for ${t}`);return n}}function t_(e,t,n){let r=Xg(e,t);if(r===void 0)return null;let i=Dh(r,Wm,n);return function(e){return g_(i(e),t)}}function n_(e,t,n){let r=Xg(e,t);if(r===void 0)return null;if(Array.isArray(r)&&(r.length===0||typeof r[0]!=`string`)){let e=r.map((e,r)=>{if(typeof e==`number`)return()=>e;let i=Dh(e,q,n);return function(e){return h_(i(e),`${t}[${r}]`)}});return function(t){let n=Array(e.length);for(let r=0;r<e.length;++r)n[r]=e[r](t);return n}}let i=Dh(r,Gm,n);return function(e){return p_(i(e),t)}}function r_(e,t,n){let r=Xg(e,t);if(r===void 0)return null;let i=Dh(r,Gm,n);return function(e){let n=p_(i(e),t);if(n.length!==2)throw Error(`Expected two numbers for ${t}`);return n}}function i_(e,t,n){let r=Xg(e,t);if(r===void 0)return null;let i=Dh(r,Gm,n);return function(e){return __(i(e),t)}}function a_(e,t,n){let r=Xg(e,t);if(r===void 0)return null;let i=Dh(r,Gm|q,n);return function(e){return v_(i(e),t)}}function o_(e,t){let n=Xg(e,t);if(n!==void 0){if(typeof n!=`number`)throw Error(`Expected a number for ${t}`);return n}}function s_(e,t){let n=Xg(e,t);if(n!==void 0){if(typeof n==`number`)return Bm(n);if(!Array.isArray(n)||n.length!==2||typeof n[0]!=`number`||typeof n[1]!=`number`)throw Error(`Expected a number or size array for ${t}`);return n}}function c_(e,t){let n=Xg(e,t);if(n!==void 0){if(typeof n!=`string`)throw Error(`Expected a string for ${t}`);return n}}function l_(e,t){let n=Xg(e,t);if(n!==void 0){if(n!==`bottom-left`&&n!==`bottom-right`&&n!==`top-left`&&n!==`top-right`)throw Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${t}`);return n}}function u_(e,t){let n=Xg(e,t);if(n!==void 0){if(n!==`pixels`&&n!==`fraction`)throw Error(`Expected pixels or fraction for ${t}`);return n}}function d_(e,t){let n=Xg(e,t);if(n!==void 0)return p_(n,t)}function f_(e,t){let n=Xg(e,t);if(n!==void 0){if(typeof n!=`string`)throw Error(`Expected a string for ${t}`);if(n!==`declutter`&&n!==`obstacle`&&n!==`none`)throw Error(`Expected declutter, obstacle, or none for ${t}`);return n}}function p_(e,t){if(!Array.isArray(e))throw Error(`Expected an array for ${t}`);let n=e.length;for(let r=0;r<n;++r)if(typeof e[r]!=`number`)throw Error(`Expected an array of numbers for ${t}`);return e}function m_(e,t){if(typeof e!=`string`)throw Error(`Expected a string for ${t}`);return e}function h_(e,t){if(typeof e!=`number`)throw Error(`Expected a number for ${t}`);return e}function g_(e,t){if(typeof e==`string`)return e;let n=p_(e,t),r=n.length;if(r<3||r>4)throw Error(`Expected a color with 3 or 4 values for ${t}`);return n}function __(e,t){let n=p_(e,t);if(n.length!==2)throw Error(`Expected an array of two numbers for ${t}`);return n}function v_(e,t){return typeof e==`number`?e:__(e,t)}var y_={RENDER_ORDER:`renderOrder`},b_=class extends Jp{constructor(e){e||={};let t=Object.assign({},e);delete t.style,delete t.renderBuffer,delete t.updateWhileAnimating,delete t.updateWhileInteracting,super(t),this.declutter_=e.declutter?String(e.declutter):void 0,this.renderBuffer_=e.renderBuffer===void 0?100:e.renderBuffer,this.style_=null,this.styleFunction_=void 0,this.setStyle(e.style),this.updateWhileAnimating_=e.updateWhileAnimating!==void 0&&e.updateWhileAnimating,this.updateWhileInteracting_=e.updateWhileInteracting!==void 0&&e.updateWhileInteracting}getDeclutter(){return this.declutter_}getFeatures(e){return super.getFeatures(e)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(y_.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(e,t){let n=this.getDeclutter();if(!n)return;e.declutter||={},n in e.declutter||(e.declutter[n]=new $p(9));let r=this.getRenderer();r&&r.renderDeclutter(e,t)}setRenderOrder(e){this.set(y_.RENDER_ORDER,e)}setStyle(e){this.style_=e===void 0?Ng:e??null;let t=x_(e);this.styleFunction_=e===null||t===null?void 0:jg(t),this.changed()}setDeclutter(e){this.declutter_=e?String(e):void 0,this.changed()}};function x_(e){if(e===void 0)return Ng;if(!e)return null;if(typeof e==`function`||e instanceof Ag)return e;if(Array.isArray(e)&&e.length===0)return[];if(Array.isArray(e)&&e[0]instanceof Ag){let t=e.length,n=Array(t);for(let r=0;r<t;++r){let t=e[r];if(!(t instanceof Ag))throw Error(`Expected a list of style instances`);n[r]=t}return n}return Bg(e)}var S_=class extends Qs{constructor(e,t,n,r){super(e),this.inversePixelTransform=t,this.frameState=n,this.context=r??void 0}},C_=class extends Is{constructor(e){super(),this.map_=e}dispatchRenderEvent(e,t){B()}calculateMatrices2D(e){let t=e.viewState,n=e.coordinateToPixelTransform,r=e.pixelToCoordinateTransform;yd(n,e.size[0]/2,e.size[1]/2,1/t.resolution,-1/t.resolution,-t.rotation,-t.center[0],-t.center[1]),bd(r,n)}forEachFeatureAtCoordinate(e,t,n,r,i,a,o,s){let c,l=t.viewState;function u(e,t,n,r){return i.call(a,t,e?n:null,r)}let d=l.projection,f=kl(e.slice(),d),p=[[0,0]];if(d.canWrapX()&&r){let e=G(d.getExtent());p.push([-e,0],[e,0])}let m=t.layerStatesArray,h=m.length,g=[],_=[];for(let r=0;r<p.length;r++)for(let i=h-1;i>=0;--i){let a=m[i],d=a.layer;if(d.hasRenderer()&&Yp(a,l)&&o.call(s,d)){let i=d.getRenderer(),o=d.getSource();if(i&&o){let s=o.getWrapX()?f:e,l=u.bind(null,a.managed);_[0]=s[0]+p[r][0],_[1]=s[1]+p[r][1],c=i.forEachFeatureAtCoordinate(_,t,n,l,g)}if(c)return c}}if(g.length===0)return;let v=1/g.length;return g.forEach((e,t)=>e.distanceSq+=t*v),g.sort((e,t)=>e.distanceSq-t.distanceSq),g.some(e=>c=e.callback(e.feature,e.layer,e.geometry)),c}hasFeatureAtCoordinate(e,t,n,r,i,a){return this.forEachFeatureAtCoordinate(e,t,n,r,qs,this,i,a)!==void 0}getMap(){return this.map_}renderFrame(e){B()}scheduleExpireIconCache(e){Jh.canExpireCache()&&e.postRenderFunctions.push(w_)}};function w_(e,t){Jh.expire()}var T_=class extends C_{constructor(e){super(e),this.fontChangeListenerKey_=L(lg,Ms.PROPERTYCHANGE,e.redrawText,e),this.element_=mc?Qf():document.createElement(`div`);let t=this.element_.style;t.position=`absolute`,t.width=`100%`,t.height=`100%`,t.zIndex=`0`,this.element_.className=Rf+` ol-layers`;let n=e.getViewport();n&&n.insertBefore(this.element_,n.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(e,t){let n=this.getMap();if(n.hasListener(e)){let r=new S_(e,void 0,t);n.dispatchEvent(r)}}disposeInternal(){R(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(e){if(!e){this.renderedVisible_&&=(this.element_.style.display=`none`,!1);return}this.calculateMatrices2D(e),this.dispatchRenderEvent(qp.PRECOMPOSE,e);let t=e.layerStatesArray.sort((e,t)=>e.zIndex-t.zIndex);t.some(e=>e.layer instanceof b_&&e.layer.getDeclutter())&&(e.declutter={});let n=e.viewState;this.children_.length=0;let r=this.getMap().getTargetElement(),i;$f(r)&&(i=r.getContext(`2d`),i.setTransform(1,0,0,1,0,0),i.clearRect(0,0,r.width,r.height));let a=[],o=i?r:null;for(let r=0,i=t.length;r<i;++r){let i=t[r];e.layerIndex=r;let s=i.layer,c=s.getSourceState();if(!Yp(i,n)||c!=`ready`&&c!=`undefined`){s.unrender();continue}let l=s.render(e,o);l&&(l!==o&&(this.children_.push(l),o=l),a.push(i))}if(this.declutter(e,a),Zf(this.element_,this.children_),i)for(let e of this.children_){let t=e.firstElementChild||e,n=e.style.backgroundColor;if(n&&(!$f(t)||t.width>0)&&(i.fillStyle=n,i.fillRect(0,0,i.canvas.width,i.canvas.height)),!$f(t)||t.width===0)continue;i.save();let r=e.style.opacity||t.style.opacity;i.globalAlpha=r===``?1:Number(r);let a=t.style.transform;if(a)i.transform(...wd(a));else{let e=parseFloat(t.style.width)/t.width,n=parseFloat(t.style.height)/t.height;i.transform(e,0,0,n,0,0)}i.drawImage(t,0,0),i.restore()}this.dispatchRenderEvent(qp.POSTCOMPOSE,e),this.renderedVisible_||=(this.element_.style.display=``,!0),this.scheduleExpireIconCache(e)}declutter(e,t){if(e.declutter){for(let n=t.length-1;n>=0;--n){let r=t[n],i=r.layer;i.getDeclutter()&&i.renderDeclutter(e,r)}t.forEach(t=>t.layer?.renderDeferred(e))}}};function E_(e){e instanceof Jp?e.setMapInternal(null):e instanceof Kp&&e.getLayers().forEach(E_)}function D_(e,t){if(e instanceof Jp)e.setMapInternal(t);else if(e instanceof Kp){let n=e.getLayers().getArray();for(let e=0,r=n.length;e<r;++e)D_(n[e],t)}}var O_=class extends rc{constructor(e){super(),e||={},this.on,this.once,this.un;let t=k_(e);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.ctrlKey_=!1,this.boundHandleCtrlKey_=this.handleCtrlKey_.bind(this),this.maxTilesLoading_=e.maxTilesLoading===void 0?16:e.maxTilesLoading,this.pixelRatio_=e.pixelRatio===void 0?pc:e.pixelRatio,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=gd(),this.pixelToCoordinateTransform_=gd(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,this.viewport_,this.overlayContainer_,this.overlayContainerStopEvent_,mc||(this.viewport_=document.createElement(`div`),this.viewport_.className=`ol-viewport`+(`ontouchstart`in window?` ol-touch`:``),this.viewport_.style.position=`relative`,this.viewport_.style.overflow=`hidden`,this.viewport_.style.width=`100%`,this.viewport_.style.height=`100%`,this.overlayContainer_=document.createElement(`div`),this.overlayContainer_.style.position=`absolute`,this.overlayContainer_.style.zIndex=`0`,this.overlayContainer_.style.width=`100%`,this.overlayContainer_.style.height=`100%`,this.overlayContainer_.style.pointerEvents=`none`,this.overlayContainer_.className=`ol-overlaycontainer`,this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement(`div`),this.overlayContainerStopEvent_.style.position=`absolute`,this.overlayContainerStopEvent_.style.zIndex=`0`,this.overlayContainerStopEvent_.style.width=`100%`,this.overlayContainerStopEvent_.style.height=`100%`,this.overlayContainerStopEvent_.style.pointerEvents=`none`,this.overlayContainerStopEvent_.className=`ol-overlaycontainer-stopevent`,this.viewport_.appendChild(this.overlayContainerStopEvent_)),this.mapBrowserEventHandler_=null,this.moveTolerance_=e.moveTolerance,this.keyboardEventTarget_=t.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,mc||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=t.controls||(mc?new oc:ip()),this.interactions=t.interactions||(mc?new oc:Vp({onFocusOnly:!0})),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new Cc(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(bc.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(bc.VIEW,this.handleViewChanged_),this.addChangeListener(bc.SIZE,this.handleSizeChanged_),this.addChangeListener(bc.TARGET,this.handleTargetChanged_),this.setProperties(t.values);let n=this;e.view&&!(e.view instanceof Af)&&e.view.then(function(e){n.setView(new Af(e))}),this.controls.addEventListener(js.ADD,(e=>{e.element.setMap(this)})),this.controls.addEventListener(js.REMOVE,(e=>{e.element.setMap(null)})),this.interactions.addEventListener(js.ADD,(e=>{e.element.setMap(this)})),this.interactions.addEventListener(js.REMOVE,(e=>{e.element.setMap(null)})),this.overlays_.addEventListener(js.ADD,(e=>{this.addOverlayInternal_(e.element)})),this.overlays_.addEventListener(js.REMOVE,(e=>{let t=e.element.getId();t!==void 0&&delete this.overlayIdIndex_[t.toString()],e.element.setMap(null)})),this.controls.forEach(e=>{e.setMap(this)}),this.interactions.forEach(e=>{e.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(e){this.getControls().push(e)}addInteraction(e){this.getInteractions().push(e)}addLayer(e){this.getLayerGroup().getLayers().push(e)}handleLayerAdd_(e){D_(e.layer,this)}addOverlay(e){this.getOverlays().push(e)}addOverlayInternal_(e){let t=e.getId();t!==void 0&&(this.overlayIdIndex_[t.toString()]=e),e.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(e,t,n){if(!this.frameState_||!this.renderer_)return;let r=this.getCoordinateFromPixelInternal(e);n=n===void 0?{}:n;let i=n.hitTolerance===void 0?0:n.hitTolerance,a=n.layerFilter===void 0?qs:n.layerFilter,o=n.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(r,this.frameState_,i,o,t,null,a,null)}getFeaturesAtPixel(e,t){let n=[];return this.forEachFeatureAtPixel(e,function(e){n.push(e)},t),n}getAllLayers(){let e=[];function t(n){n.forEach(function(n){n instanceof Kp?t(n.getLayers()):e.push(n)})}return t(this.getLayers()),e}hasFeatureAtPixel(e,t){if(!this.frameState_||!this.renderer_)return!1;let n=this.getCoordinateFromPixelInternal(e);t=t===void 0?{}:t;let r=t.layerFilter===void 0?qs:t.layerFilter,i=t.hitTolerance===void 0?0:t.hitTolerance,a=t.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(n,this.frameState_,i,a,r,null)}getEventCoordinate(e){return this.getCoordinateFromPixel(this.getEventPixel(e))}getEventCoordinateInternal(e){return this.getCoordinateFromPixelInternal(this.getEventPixel(e))}getEventPixel(e){let t=this.viewport_.getBoundingClientRect(),n=this.getSize(),r=t.width/n[0],i=t.height/n[1],a=`changedTouches`in e?e.changedTouches[0]:e;return[(a.clientX-t.left)/r,(a.clientY-t.top)/i]}getTarget(){return this.get(bc.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(e,t){let n=cd(this.getCoordinateFromPixelInternal(e),this.getView().getProjection());return t?.wrapX&&n&&kl(n,sd()||this.getView().getProjection()),n}getCoordinateFromPixelInternal(e){let t=this.frameState_;return t?vd(t.pixelToCoordinateTransform,e.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(e){let t=this.overlayIdIndex_[e.toString()];return t===void 0?null:t}getInteractions(){return this.interactions}getLayerGroup(){return this.get(bc.LAYERGROUP)}setLayers(e){let t=this.getLayerGroup();if(e instanceof oc){t.setLayers(e);return}let n=t.getLayers();n.clear(),n.extend(e)}getLayers(){return this.getLayerGroup().getLayers()}updateRenderComplete_(){this.renderComplete_=(this.hasListener(yc.LOADSTART)||this.hasListener(yc.LOADEND)||this.hasListener(qp.RENDERCOMPLETE))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady()}getLoadingOrNotReady(){let e=this.getLayerGroup().getLayerStatesArray();for(let t=0,n=e.length;t<n;++t){let n=e[t];if(!n.visible)continue;let r=n.layer.getRenderer();if(r&&!r.ready)return!0;let i=n.layer.getSource();if(i&&i.loading)return!0}return!1}getPixelFromCoordinate(e,t){let n=this.getView().getProjection(),r=ld(e,n);return t?.wrapX&&this.frameState_&&(r=Al(r.slice(),n,this.frameState_.viewState.center[0])),this.getPixelFromCoordinateInternal(r)}getPixelFromCoordinateInternal(e){let t=this.frameState_;return t?vd(t.coordinateToPixelTransform,e.slice(0,2)):null}getPixelRatio(){return this.pixelRatio_}setPixelRatio(e){this.pixelRatio_!==e&&(this.pixelRatio_=e,this.render())}getRenderer(){return this.renderer_}getSize(){return this.get(bc.SIZE)}getView(){return this.get(bc.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){let e=this.getTargetElement();return e?e.ownerDocument:document}getTilePriority(e,t,n,r){return wc(this.frameState_,e,t,n,r)}handleBrowserEvent(e,t){t||=e.type;let n=new cc(t,this,e);this.handleMapBrowserEvent(n)}handleCtrlKey_(e){let t=e;this.ctrlKey_=t.key===`Control`?t.type===z.KEYDOWN:t.ctrlKey}handleMapBrowserEvent(e){if(e.originalEvent.ctrlKey===!1&&(this.ctrlKey_=!1),e.ctrlKey=this.ctrlKey_,!this.frameState_)return;let t=e.originalEvent,n=t.type;if(n===_c.POINTERDOWN||n===z.WHEEL||n===z.KEYDOWN){let e=this.getOwnerDocument(),n=this.viewport_.getRootNode?this.viewport_.getRootNode():e,r=t.target,i=n instanceof ShadowRoot?n.host===r?n.host.ownerDocument:n:n===e?e.documentElement:n;if(this.overlayContainerStopEvent_.contains(r)||!i.contains(r))return}if(e.frameState=this.frameState_,this.dispatchEvent(e)!==!1){let t=this.getInteractions().getArray().slice();for(let n=t.length-1;n>=0;n--){let r=t[n];if(r.getMap()===this&&r.getActive()&&this.getTargetElement()&&(!r.handleEvent(e)||e.propagationStopped))break}}}handlePostRender(){let e=this.frameState_,t=this.tileQueue_;if(!t.isEmpty()){let n=this.maxTilesLoading_,r=n,i=e?e.viewHints:void 0;if(i&&(i[Tc.ANIMATING]||i[Tc.INTERACTING])){let t=Date.now()-e.time>8;n=t?0:8,r=t?0:2}if(t.getTilesLoading()<n){let e=t.getCount();t.reprioritize(),t.getCount()<e&&this.updateRenderComplete_(),t.loadMoreTiles(n,r)}}e&&this.renderer_&&!e.animate&&(this.renderComplete_?(this.hasListener(qp.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(qp.RENDERCOMPLETE,e),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new sc(yc.LOADEND,this,e)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new sc(yc.LOADSTART,this,e))));let n=this.postRenderFunctions_;if(e)for(let t=0,r=n.length;t<r;++t)n[t](this,e);n.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){let e=this.targetChangeHandlerKeys_;for(let t=0,n=e.length;t<n;++t)R(e[t]);this.targetChangeHandlerKeys_=null;let t=this.getOwnerDocument();t.removeEventListener(z.KEYDOWN,this.boundHandleCtrlKey_,!0),t.removeEventListener(z.KEYUP,this.boundHandleCtrlKey_,!0),this.ctrlKey_=!1,this.viewport_.removeEventListener(z.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(z.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!$f(this.targetElement_)){this.resizeObserver_?.unobserve(this.targetElement_);let e=this.targetElement_.getRootNode();e instanceof ShadowRoot&&this.resizeObserver_.unobserve(e.host),this.setSize(void 0)}let e=this.getTarget(),t=typeof e==`string`?document.getElementById(e):e;if(this.targetElement_=t,!t)this.renderer_&&=(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),null),this.animationDelayKey_&&=(cancelAnimationFrame(this.animationDelayKey_),void 0);else{if($f(t)||t.appendChild(this.viewport_),this.renderer_||=new T_(this),!$f(t)){this.mapBrowserEventHandler_=new vc(this,this.moveTolerance_);for(let e in lc)this.mapBrowserEventHandler_.addEventListener(lc[e],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(z.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(z.WHEEL,this.boundHandleBrowserEvent_,gc?{passive:!1}:!1);let e=this.getOwnerDocument();e.addEventListener(z.KEYDOWN,this.boundHandleCtrlKey_,!0),e.addEventListener(z.KEYUP,this.boundHandleCtrlKey_,!0);let n;if(this.keyboardEventTarget_)n=this.keyboardEventTarget_;else{let e=t.getRootNode();n=e instanceof ShadowRoot?e.host:t}if(this.targetChangeHandlerKeys_=[L(n,z.KEYDOWN,this.handleBrowserEvent,this),L(n,z.KEYPRESS,this.handleBrowserEvent,this)],!$f(t)){let e=t.getRootNode();e instanceof ShadowRoot&&this.resizeObserver_.observe(e.host),this.resizeObserver_?.observe(t)}}this.updateSize()}}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&=(R(this.viewPropertyListenerKey_),null),this.viewChangeListenerKey_&&=(R(this.viewChangeListenerKey_),null);let e=this.getView();e&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=L(e,Ms.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=L(e,z.CHANGE,this.handleViewPropertyChanged_,this),e.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&=(this.layerGroupPropertyListenerKeys_.forEach(R),null);let e=this.getLayerGroup();e&&(this.handleLayerAdd_(new Wp(`addlayer`,e)),this.layerGroupPropertyListenerKeys_=[L(e,Ms.PROPERTYCHANGE,this.render,this),L(e,z.CHANGE,this.render,this),L(e,`addlayer`,this.handleLayerAdd_,this),L(e,`removelayer`,this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){if(!this.frameState_)return;let e=this.frameState_.layerStatesArray;for(let t=0,n=e.length;t<n;++t){let n=e[t].layer;n.hasRenderer()&&n.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(e){return this.getControls().remove(e)}removeInteraction(e){return this.getInteractions().remove(e)}removeLayer(e){return this.getLayerGroup().getLayers().remove(e)}handleLayerRemove_(e){E_(e.layer)}removeOverlay(e){return this.getOverlays().remove(e)}renderFrame_(e){let t=this.getSize(),n=this.getView(),r=this.frameState_,i=null;if(t!==void 0&&Rm(t)&&n&&n.isDef()){let r=n.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=n.getState();if(i={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:dl(a.center,a.resolution,a.rotation,t),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:t,tileQueue:this.tileQueue_,time:e,usedTiles:{},viewState:a,viewHints:r,wantedTiles:{},mapId:V(this),renderTargets:{}},a.nextCenter&&a.nextResolution){let e=isNaN(a.nextRotation)?a.rotation:a.nextRotation;i.nextExtent=dl(a.nextCenter,a.nextResolution,e,t)}}this.frameState_=i,this.renderer_.renderFrame(i),i&&(i.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,i.postRenderFunctions),r&&(!this.previousExtent_||!yl(this.previousExtent_)&&!el(i.extent,this.previousExtent_))&&(this.dispatchEvent(new sc(yc.MOVESTART,this,r)),this.previousExtent_=Zc(this.previousExtent_)),this.previousExtent_&&!i.viewHints[Tc.ANIMATING]&&!i.viewHints[Tc.INTERACTING]&&!el(i.extent,this.previousExtent_)&&(this.dispatchEvent(new sc(yc.MOVEEND,this,i)),Uc(i.extent,this.previousExtent_))),this.dispatchEvent(new sc(yc.POSTRENDER,this,i)),this.updateRenderComplete_(),this.postRenderTimeoutHandle_||=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0)}setLayerGroup(e){let t=this.getLayerGroup();t&&this.handleLayerRemove_(new Wp(`removelayer`,t)),this.set(bc.LAYERGROUP,e)}setSize(e){this.set(bc.SIZE,e)}setTarget(e){this.set(bc.TARGET,e)}setView(e){if(!e||e instanceof Af){this.set(bc.VIEW,e);return}this.set(bc.VIEW,new Af);let t=this;e.then(function(e){t.setView(new Af(e))})}updateSize(){let e=this.getTargetElement(),t;if(e){let n,r;if($f(e)){let t=e.getContext(`2d`).getTransform();n=e.width/t.a,r=e.height/t.d}else{let t=getComputedStyle(e);n=e.offsetWidth-parseFloat(t.borderLeftWidth)-parseFloat(t.paddingLeft)-parseFloat(t.paddingRight)-parseFloat(t.borderRightWidth),r=e.offsetHeight-parseFloat(t.borderTopWidth)-parseFloat(t.paddingTop)-parseFloat(t.paddingBottom)-parseFloat(t.borderBottomWidth)}!isNaN(n)&&!isNaN(r)&&(t=[Math.max(0,n),Math.max(0,r)],!Rm(t)&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&Bl(`No map visible because the map container's width or height are 0.`))}let n=this.getSize();t&&(!n||!Us(t,n))&&(this.updateViewportSize_(t),this.setSize(t))}updateViewportSize_(e){let t=this.getView();t&&t.setViewportSize(e)}};function k_(e){let t=null;e.keyboardEventTarget!==void 0&&(t=typeof e.keyboardEventTarget==`string`?document.getElementById(e.keyboardEventTarget):e.keyboardEventTarget);let n={},r=e.layers&&typeof e.layers.getLayers==`function`?e.layers:new Kp({layers:e.layers});n[bc.LAYERGROUP]=r,n[bc.TARGET]=e.target,n[bc.VIEW]=e.view instanceof Af?e.view:new Af;let i;e.controls!==void 0&&(Array.isArray(e.controls)?i=new oc(e.controls.slice()):(U(typeof e.controls.getArray==`function`,"Expected `controls` to be an array or an `ol/Collection.js`"),i=e.controls));let a;e.interactions!==void 0&&(Array.isArray(e.interactions)?a=new oc(e.interactions.slice()):(U(typeof e.interactions.getArray==`function`,"Expected `interactions` to be an array or an `ol/Collection.js`"),a=e.interactions));let o;return e.overlays===void 0?o=new oc:Array.isArray(e.overlays)?o=new oc(e.overlays.slice()):(U(typeof e.overlays.getArray==`function`,"Expected `overlays` to be an array or an `ol/Collection.js`"),o=e.overlays),{controls:i,interactions:a,keyboardEventTarget:t,overlays:o,values:n}}var A_=class e extends rc{constructor(e){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_=`geometry`,this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),e){if(typeof e.getSimplifiedGeometry==`function`){let t=e;this.setGeometry(t)}else{let t=e;this.setProperties(t)}}}clone(){let t=new e,n=this.geometryName_;t.setGeometryName(n);let r=this.getPropertiesInternal();if(r){let e=this.getGeometry();for(let i in r)i===n&&e?t.set(i,e.clone()):t.set(i,r[i],!0)}let i=this.getStyle();return i&&t.setStyle(i),t}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&=(R(this.geometryChangeKey_),null);let e=this.getGeometry();e&&(this.geometryChangeKey_=L(e,z.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(e){this.set(this.geometryName_,e)}setStyle(e){this.style_=e??null,this.styleFunction_=e?j_(e):void 0,this.changed()}setId(e){this.id_=e,this.changed()}setGeometryName(e){e!==this.geometryName_&&(this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=e,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_())}};function j_(e){if(typeof e==`function`)return e;let t;return Array.isArray(e)?t=e:(U(typeof e.getZIndex==`function`,"Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),t=[e]),function(){return t}}var M_=class extends $s{constructor(e,t,n){super(),n||={},this.tileCoord=e,this.state=t,this.key=``,this.transition_=n.transition===void 0?250:n.transition,this.transitionStarts_={},this.interpolate=!!n.interpolate}changed(){this.dispatchEvent(z.CHANGE)}release(){this.setState(H.EMPTY)}getKey(){return this.key+`/`+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(e){if(this.state!==H.EMPTY){if(this.state!==H.ERROR&&this.state>e)throw Error(`Tile load sequence violation`);this.state=e,this.changed()}}load(){B()}getAlpha(e,t){if(!this.transition_)return 1;let n=this.transitionStarts_[e];if(!n)n=t,this.transitionStarts_[e]=n;else if(n===-1)return 1;let r=t-n+1e3/60;return r>=this.transition_?1:Nl(r/this.transition_)}inTransition(e){return this.transition_?this.transitionStarts_[e]!==-1:!1}endTransition(e){this.transition_&&(this.transitionStarts_[e]=-1)}disposeInternal(){this.release(),super.disposeInternal()}};function N_(e){return e instanceof Image||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageBitmap?e:null}function P_(e){return e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Float32Array||e instanceof DataView?e:null}var F_=Error(`disposed`),I_=[256,256],L_=class extends M_{constructor(e){let t=H.IDLE;super(e.tileCoord,t,{transition:e.transition,interpolate:e.interpolate}),this.loader_=e.loader,this.data_=null,this.error_=null,this.size_=e.size||null,this.controller_=e.controller||null}getSize(){if(this.size_)return this.size_;let e=N_(this.data_);return e?[e.width,e.height]:I_}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==H.IDLE&&this.state!==H.ERROR)return;this.state=H.LOADING,this.changed();let e=this;this.loader_().then(function(t){e.data_=t,e.state=H.LOADED,e.changed()}).catch(function(t){e.error_=t,e.state=H.ERROR,e.changed()})}disposeInternal(){this.controller_&&=(this.controller_.abort(F_),null),super.disposeInternal()}},R_=class extends M_{constructor(e,t,n,r,i,a){super(e,t,a),this.crossOrigin_=r?.crossOrigin,this.referrerPolicy_=r?.referrerPolicy,this.src_=n,this.key=n,this.image_,mc?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,this.crossOrigin_!==null&&this.crossOrigin_!==void 0&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.unlisten_=null,this.tileLoadFunction_=i}getImage(){return this.image_}setImage(e){this.image_=e,this.state=H.LOADED,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_??null}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=H.ERROR,this.unlistenImage_(),this.image_=z_(),this.changed()}handleImageLoad_(){if(mc)this.state=H.LOADED;else{let e=this.image_;this.state=e.naturalWidth&&e.naturalHeight?H.LOADED:H.EMPTY}this.unlistenImage_(),this.changed()}load(){if(this.state==H.ERROR&&(this.state=H.IDLE,this.image_=new Image,this.crossOrigin_!==null&&this.crossOrigin_!==void 0&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.state==H.IDLE){this.state=H.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_);let e=this.image_;e&&(this.unlisten_=Uh(e,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}}unlistenImage_(){this.unlisten_&&=(this.unlisten_(),null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}};function z_(){let e=Gf(1,1);return e.fillStyle=`rgba(0,0,0,0)`,e.fillRect(0,0,1,1),e.canvas}var B_=class{constructor(e,t,n,r){this.minX=e,this.maxX=t,this.minY=n,this.maxY=r}contains(e){return this.containsXY(e[1],e[2])}containsTileRange(e){return this.minX<=e.minX&&e.maxX<=this.maxX&&this.minY<=e.minY&&e.maxY<=this.maxY}containsXY(e,t){return this.minX<=e&&e<=this.maxX&&this.minY<=t&&t<=this.maxY}equals(e){return this.minX==e.minX&&this.minY==e.minY&&this.maxX==e.maxX&&this.maxY==e.maxY}extend(e){e.minX<this.minX&&(this.minX=e.minX),e.maxX>this.maxX&&(this.maxX=e.maxX),e.minY<this.minY&&(this.minY=e.minY),e.maxY>this.maxY&&(this.maxY=e.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(e){return this.minX<=e.maxX&&this.maxX>=e.minX&&this.minY<=e.maxY&&this.maxY>=e.minY}};function V_(e,t,n,r,i){return i===void 0?new B_(e,t,n,r):(i.minX=e,i.maxX=t,i.minY=n,i.maxY=r,i)}var H_,U_=[];function W_(e,t,n,r,i){e.beginPath(),e.moveTo(0,0),e.lineTo(t,n),e.lineTo(r,i),e.closePath(),e.save(),e.clip(),e.fillRect(0,0,Math.max(t,r)+1,Math.max(n,i)),e.restore()}function G_(e,t){return Math.abs(e[t*4]-210)>2||Math.abs(e[t*4+3]-191.25)>2}function K_(){if(H_===void 0){let e=Gf(6,6,U_);e.globalCompositeOperation=`lighter`,e.fillStyle=`rgba(210, 0, 0, 0.75)`,W_(e,4,5,4,0),W_(e,4,5,0,5);let t=e.getImageData(0,0,3,3).data;H_=G_(t,0)||G_(t,4)||G_(t,8),Jf(e),U_.push(e.canvas)}return H_}function q_(e,t,n,r){let i=ad(n,t,e),a=Yu(t,r,n),o=t.getMetersPerUnit();o!==void 0&&(a*=o);let s=e.getMetersPerUnit();s!==void 0&&(a/=s);let c=e.getExtent();if(!c||Gc(c,i)){let t=Yu(e,a,i)/a;isFinite(t)&&t>0&&(a/=t)}return a}function J_(e,t,n,r){let i=q_(e,t,ll(n),r);return(!isFinite(i)||i<=0)&&al(n,function(n){return i=q_(e,t,n,r),isFinite(i)&&i>0}),i}function Y_(e,t,n,r,i,a,o,s,c,l,u,d,f,p){let m=Gf(Math.round(n*e),Math.round(n*t),U_);if(d||(m.imageSmoothingEnabled=!1),c.length===0)return m.canvas;m.scale(n,n);function h(e){return Math.round(e*n)/n}m.globalCompositeOperation=`lighter`;let g=Yc();c.forEach(function(e,t,n){tl(g,e.extent)});let _,v=n/r,y=(d?1:1+2**-24)/v;if(!f||c.length!==1||l!==0){let e=Gf(Math.round(G(g)*v),Math.round(pl(g)*v),U_);if(_=e,d||(e.imageSmoothingEnabled=!1),i&&p){let t=(i[0]-g[0])*v,n=-(i[3]-g[3])*v,r=G(i)*v,a=pl(i)*v;e.rect(t,n,r,a),e.clip()}c.forEach(function(t,n,r){if(t.image.width>0&&t.image.height>0){if(t.clipExtent){e.save();let n=(t.clipExtent[0]-g[0])*v,r=-(t.clipExtent[3]-g[3])*v,i=G(t.clipExtent)*v,a=pl(t.clipExtent)*v;e.rect(d?n:Math.round(n),d?r:Math.round(r),d?i:Math.round(n+i)-Math.round(n),d?a:Math.round(r+a)-Math.round(r)),e.clip()}let n=(t.extent[0]-g[0])*v,r=-(t.extent[3]-g[3])*v,i=G(t.extent)*v,a=pl(t.extent)*v;e.drawImage(t.image,l,l,t.image.width-2*l,t.image.height-2*l,d?n:Math.round(n),d?r:Math.round(r),d?i:Math.round(n+i)-Math.round(n),d?a:Math.round(r+a)-Math.round(r)),t.clipExtent&&e.restore()}})}let b=gl(o);return s.getTriangles().forEach(function(e,t,n){let r=e.source,i=e.target,o=r[0][0],s=r[0][1],l=r[1][0],u=r[1][1],f=r[2][0],p=r[2][1],v=h((i[0][0]-b[0])/a),x=h(-(i[0][1]-b[1])/a),S=h((i[1][0]-b[0])/a),C=h(-(i[1][1]-b[1])/a),w=h((i[2][0]-b[0])/a),T=h(-(i[2][1]-b[1])/a),E=o,D=s;o=0,s=0,l-=E,u-=D,f-=E,p-=D;let O=kc([[l,u,0,0,S-v],[f,p,0,0,w-v],[0,0,l,u,C-x],[0,0,f,p,T-x]]);if(!O)return;if(m.save(),m.beginPath(),K_()||!d){m.moveTo(S,C);let e=v-S,t=x-C;for(let n=0;n<4;n++)m.lineTo(S+h((n+1)*e/4),C+h(n*t/3)),n!=3&&m.lineTo(S+h((n+1)*e/4),C+h((n+1)*t/3));m.lineTo(w,T)}else m.moveTo(S,C),m.lineTo(v,x),m.lineTo(w,T);m.clip(),m.transform(O[0],O[2],O[1],O[3],v,x),m.translate(g[0]-E,g[3]-D);let k;if(_)k=_.canvas,m.scale(y,-y);else{let e=c[0],t=e.extent;k=e.image,m.scale(G(t)/k.width,-pl(t)/k.height)}m.drawImage(k,0,0),m.restore()}),_&&(Jf(_),U_.push(_.canvas)),u&&(m.save(),m.globalCompositeOperation=`source-over`,m.strokeStyle=`black`,m.lineWidth=1,s.getTriangles().forEach(function(e,t,n){let r=e.target,i=(r[0][0]-b[0])/a,o=-(r[0][1]-b[1])/a,s=(r[1][0]-b[0])/a,c=-(r[1][1]-b[1])/a,l=(r[2][0]-b[0])/a,u=-(r[2][1]-b[1])/a;m.beginPath(),m.moveTo(s,c),m.lineTo(i,o),m.lineTo(l,u),m.closePath(),m.stroke()}),m.restore()),m.canvas}var X_=10,Z_=.25,Q_=class{constructor(e,t,n,r,i,a,o){this.sourceProj_=e,this.targetProj_=t;let s={},c=o?$u(e=>vd(o,ad(e,this.targetProj_,this.sourceProj_))):id(this.targetProj_,this.sourceProj_);this.transformInv_=function(e){let t=e[0]+`/`+e[1];return s[t]||(s[t]=c(e)),s[t]},this.maxSourceExtent_=r,this.errorThresholdSquared_=i*i,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!r&&!!this.sourceProj_.getExtent()&&G(r)>=G(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?G(this.sourceProj_.getExtent()):void 0,this.targetWorldWidth_=this.targetProj_.getExtent()?G(this.targetProj_.getExtent()):void 0;let l=gl(n),u=_l(n),d=cl(n),f=sl(n),p=this.transformInv_(l),m=this.transformInv_(u),h=this.transformInv_(d),g=this.transformInv_(f),_=X_+(a?Math.max(0,Math.ceil(Math.log2(ol(n)/(a*a*256*256)))):0);if(this.addQuad_(l,u,d,f,p,m,h,g,_),this.wrapsXInSource_){let e=this.sourceWorldWidth_;if(!e)return;let t=1/0;this.triangles_.forEach(function(e,n,r){t=Math.min(t,e.source[0][0],e.source[1][0],e.source[2][0])}),this.triangles_.forEach(n=>{if(Math.max(n.source[0][0],n.source[1][0],n.source[2][0])-t>e/2){let r=[[n.source[0][0],n.source[0][1]],[n.source[1][0],n.source[1][1]],[n.source[2][0],n.source[2][1]]];r[0][0]-t>e/2&&(r[0][0]-=e),r[1][0]-t>e/2&&(r[1][0]-=e),r[2][0]-t>e/2&&(r[2][0]-=e);let i=Math.min(r[0][0],r[1][0],r[2][0]);Math.max(r[0][0],r[1][0],r[2][0])-i<e/2&&(n.source=r)}})}s={}}addTriangle_(e,t,n,r,i,a){this.triangles_.push({source:[r,i,a],target:[e,t,n]})}addQuad_(e,t,n,r,i,a,o,s,c){let l=Vc([i,a,o,s]),u=this.sourceWorldWidth_,d=u?G(l)/u:void 0,f=this.sourceProj_.canWrapX()&&d!==void 0&&d>.5&&d<1,p=!1;if(c>0&&(this.targetProj_.isGlobal()&&this.targetWorldWidth_&&(p=G(Vc([e,t,n,r]))/this.targetWorldWidth_>Z_||p),!f&&this.sourceProj_.isGlobal()&&d&&(p=d>Z_||p)),!p&&this.maxSourceExtent_&&isFinite(l[0])&&isFinite(l[1])&&isFinite(l[2])&&isFinite(l[3])&&!vl(l,this.maxSourceExtent_))return;let m=0;if(!p&&(!isFinite(i[0])||!isFinite(i[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(s[0])||!isFinite(s[1]))){if(c>0)p=!0;else if(m=(!isFinite(i[0])||!isFinite(i[1])?8:0)+(!isFinite(a[0])||!isFinite(a[1])?4:0)+(!isFinite(o[0])||!isFinite(o[1])?2:0)+ +(!isFinite(s[0])||!isFinite(s[1])),m!=1&&m!=2&&m!=4&&m!=8)return}if(c>0){if(!p){let t=[(e[0]+n[0])/2,(e[1]+n[1])/2],r=this.transformInv_(t),a;if(f){let e=u;a=(Mc(i[0],e)+Mc(o[0],e))/2-Mc(r[0],e)}else a=(i[0]+o[0])/2-r[0];let s=(i[1]+o[1])/2-r[1];p=a*a+s*s>this.errorThresholdSquared_}if(p){if(Math.abs(e[0]-n[0])<=Math.abs(e[1]-n[1])){let l=[(t[0]+n[0])/2,(t[1]+n[1])/2],u=this.transformInv_(l),d=[(r[0]+e[0])/2,(r[1]+e[1])/2],f=this.transformInv_(d);this.addQuad_(e,t,l,d,i,a,u,f,c-1),this.addQuad_(d,l,n,r,f,u,o,s,c-1)}else{let l=[(e[0]+t[0])/2,(e[1]+t[1])/2],u=this.transformInv_(l),d=[(n[0]+r[0])/2,(n[1]+r[1])/2],f=this.transformInv_(d);this.addQuad_(e,l,d,r,i,u,f,s,c-1),this.addQuad_(l,t,n,d,u,a,o,f,c-1)}return}}if(f){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}m&11||this.addTriangle_(e,n,r,i,o,s),m&14||this.addTriangle_(e,n,t,i,o,a),m&&(m&13||this.addTriangle_(t,r,e,a,s,i),m&7||this.addTriangle_(t,r,n,a,s,o))}calculateSourceExtent(){let e=Yc();return this.triangles_.forEach(function(t,n,r){let i=t.source;nl(e,i[0]),nl(e,i[1]),nl(e,i[2])}),e}getTriangles(){return this.triangles_}},$_=.5,ev=class extends M_{constructor(e,t,n,r,i,a,o,s,c,l,u,d){super(i,H.IDLE,d),this.renderEdges_=u!==void 0&&u,this.pixelRatio_=o,this.gutter_=s,this.canvas_=null,this.sourceTileGrid_=t,this.targetTileGrid_=r,this.wrappedTileCoord_=a||i,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=e.canWrapX()&&e.getExtent()||void 0;let f=r.getTileCoordExtent(this.wrappedTileCoord_),p=this.targetTileGrid_.getExtent(),m=this.sourceTileGrid_.getExtent(),h=p?ml(f,p):f;if(ol(h)===0){this.state=H.EMPTY;return}let g=e.getExtent();g&&(m=m?ml(m,g):g);let _=r.getResolution(this.wrappedTileCoord_[0]),v=J_(e,n,h,_);if(!isFinite(v)||v<=0){this.state=H.EMPTY;return}let y=l===void 0?$_:l;if(this.triangulation_=new Q_(e,n,h,m||void 0,v*y,_),this.triangulation_.getTriangles().length===0){this.state=H.EMPTY;return}this.sourceZ_=t.getZForResolution(v);let b=this.triangulation_.calculateSourceExtent();if(m&&(e.canWrapX()?(b[1]=W(b[1],m[1],m[3]),b[3]=W(b[3],m[1],m[3])):b=ml(b,m)),!ol(b))this.state=H.EMPTY;else{let n=0,r=0;e.canWrapX()&&(n=G(g),r=Math.floor((b[0]-g[0])/n)),Cl(b.slice(),e,!0).forEach(e=>{let i=t.getTileRangeForExtentAndZ(e,this.sourceZ_);for(let e=i.minX;e<=i.maxX;e++)for(let t=i.minY;t<=i.maxY;t++){let i=r*n;this.sourceTiles_.push({getTile:()=>c(this.sourceZ_,e,t,o),offset:i})}++r}),this.sourceTiles_.length===0&&(this.state=H.EMPTY)}}getImage(){return this.canvas_}reproject_(){let e=[];if(this.sourceTiles_.forEach(t=>{let n=t.tile;if(n&&n.getState()==H.LOADED){let r=this.sourceTileGrid_.getTileCoordExtent(n.tileCoord);r[0]+=t.offset,r[2]+=t.offset;let i=this.clipExtent_?.slice();i&&(i[0]+=t.offset,i[2]+=t.offset);let a=n.getImage();if(!a)return;e.push({extent:r,clipExtent:i,image:a})}}),this.sourceTiles_.length=0,e.length===0)this.state=H.ERROR;else{let t=this.wrappedTileCoord_[0],n=this.targetTileGrid_.getTileSize(t),r=typeof n==`number`?n:n[0],i=typeof n==`number`?n:n[1],a=this.targetTileGrid_.getResolution(t),o=this.sourceTileGrid_.getResolution(this.sourceZ_),s=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=Y_(r,i,this.pixelRatio_,o,this.sourceTileGrid_.getExtent()??s,a,s,this.triangulation_,e,this.gutter_,this.renderEdges_,this.interpolate),this.state=H.LOADED}this.changed()}load(){for(let e of this.sourceTiles_)e.tile=e.getTile();if(this.state==H.IDLE){this.state=H.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(t=>{let n=t.tile;if(!n)return;let r=n.getState();if(r==H.IDLE||r==H.LOADING){e++;let t=L(n,z.CHANGE,()=>{let r=n.getState();(r==H.LOADED||r==H.ERROR||r==H.EMPTY)&&(R(t),e--,e===0&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(t)}}),e===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function(e){let t=e.tile;t&&t.getState()==H.IDLE&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_&&=(this.sourcesListenerKeys_.forEach(R),null)}release(){this.canvas_&&=(Jf(this.canvas_.getContext(`2d`)),U_.push(this.canvas_),null),this.sourceTiles_.length=0,super.release()}},tv=class{constructor(e){this.highWaterMark=e===void 0?2048:e,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){let e=this.pop();e instanceof Is&&e.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(e){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(e){return this.entries_.hasOwnProperty(e)}forEach(e){let t=this.oldest_;for(;t;)e(t.value_,t.key_,this),t=t.newer}get(e,t){let n=this.entries_[e];return U(n!==void 0,`Tried to get a value for a key that does not exist in the cache`),n===this.newest_||(n===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(n.newer.older=n.older,n.older.newer=n.newer),n.newer=null,n.older=this.newest_,this.newest_.newer=n,this.newest_=n),n.value_}remove(e){let t=this.entries_[e];return U(t!==void 0,`Tried to get a value for a key that does not exist in the cache`),t===this.newest_?(this.newest_=t.older,this.newest_&&(this.newest_.newer=null)):t===this.oldest_?(this.oldest_=t.newer,this.oldest_&&(this.oldest_.older=null)):(t.newer.older=t.older,t.older.newer=t.newer),delete this.entries_[e],--this.count_,t.value_}getCount(){return this.count_}getKeys(){let e=Array(this.count_),t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.key_;return e}getValues(){let e=Array(this.count_),t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.value_;return e}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(e){return this.entries_[e]?.value_}pop(){let e=this.oldest_;return delete this.entries_[e.key_],e.newer&&(e.newer.older=null),this.oldest_=e.newer,this.oldest_||(this.newest_=null),--this.count_,e.value_}replace(e,t){this.get(e),this.entries_[e].value_=t}set(e,t){U(!(e in this.entries_),`Tried to set a value for a key that is used already`);let n={key_:e,newer:null,older:this.newest_,value_:t};this.newest_?this.newest_.newer=n:this.oldest_=n,this.newest_=n,this.entries_[e]=n,++this.count_}setSize(e){this.highWaterMark=e}};function nv(e,t,n,r){return r===void 0?[e,t,n]:(r[0]=e,r[1]=t,r[2]=n,r)}function rv(e,t,n){return e+`/`+t+`/`+n}function iv(e,t,n,r,i){return`${V(e)},${t},${rv(n,r,i)}`}function av(e){return ov(e[0],e[1],e[2])}function ov(e,t,n){return(t<<e)+n}function sv(e,t){let n=e[0],r=e[1],i=e[2];if(t.getMinZoom()>n||n>t.getMaxZoom())return!1;let a=t.getFullTileRange(n);return!a||a.containsXY(r,i)}var cv=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(qf(),{get:(e,t)=>{if(typeof e[t]==`function`)return this.pendingMethod_=t,this.pushMethodArgs_},set:(e,t,n)=>(this.push_(t,n),!0)})}push_(...e){let t=this.instructions_,n=this.zIndex+this.offset_;t[n]||(t[n]=[]),t[n].push(...e)}pushMethodArgs_=(...e)=>{this.push_(this.pendingMethod_,e)};pushFunction(e){this.push_(e)}getContext(){return this.context_}draw(e){this.instructions_.forEach(t=>{for(let n=0,r=t.length;n<r;++n){let r=t[n];if(typeof r==`function`){r(e);continue}let i=t[++n];typeof e[r]==`function`?e[r](...i):e[r]=typeof i==`function`?i(e):i}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}},lv=5,uv=class extends ec{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.staleKeys_=[],this.maxStaleKeys=lv,this.renderedSourceKey_}getStaleKeys(){return this.staleKeys_}prependStaleKey(e){this.staleKeys_.unshift(e),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}updateStaleKeys(e){this.renderedSourceKey_?this.renderedSourceKey_!==e&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=e):this.renderedSourceKey_=e}getFeatures(e){return B()}getData(e){return null}prepareFrame(e){return B()}renderFrame(e,t){return B()}forEachFeatureAtCoordinate(e,t,n,r,i){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){let t=e.target;(t.getState()===Q.LOADED||t.getState()===Q.ERROR)&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=Q.LOADED&&t!=Q.ERROR&&e.addEventListener(z.CHANGE,this.boundHandleImageChange_),t==Q.IDLE&&(e.load(),t=e.getState()),t==Q.LOADED}renderIfReadyAndVisible(){let e=this.getLayer();e&&e.getVisible()&&e.getSourceState()===`ready`&&e.changed()}renderDeferred(e){}disposeInternal(){this.layer_=void 0,super.disposeInternal()}},dv=[],fv=null;function pv(){fv=Gf(1,1,void 0,{willReadFrequently:!0})}var mv=class extends uv{constructor(e){super(e),this.wantRotation=!1,this.container=null,this.renderedResolution,this.tempTransform=gd(),this.pixelTransform=gd(),this.inversePixelTransform=gd(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,n){fv||pv();let r=fv;if(!r)return null;r.clearRect(0,0,1,1);let i;try{r.drawImage(e,t,n,1,1,0,0,1,1),i=r.getImageData(0,0,1,1).data}catch{return fv=null,null}return i}getBackground(e){let t=this.getLayer().getBackground();return typeof t==`function`&&(t=t(e.viewState.resolution)),t||void 0}useContainer(e,t,n,r,i){if($f(e)&&this.pixelTransform[1]===0&&this.pixelTransform[2]===0&&this.pixelTransform[4]===0&&this.pixelTransform[5]===0&&e.width===r&&e.height===i){let t=e,r=t.getContext(`2d`);if(r){this.container=e,this.context=r,this.containerReused=!0,n&&(r.fillStyle=n,r.fillRect(0,0,t.width,t.height));return}}let a=this.getLayer().getClassName(),o,s;if(e&&e.className===a&&(!n||e&&e.style.backgroundColor&&Us(Im(e.style.backgroundColor),Im(n)))){let t=e.firstElementChild;$f(t)&&(s=t.getContext(`2d`))}if(s&&Td(s.canvas.style.transform,t)?(this.container=e,this.context=s,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){o=mc?Qf():document.createElement(`div`),o.className=a;let e=o.style;e.position=`absolute`,e.width=`100%`,e.height=`100%`,s=Gf();let t=s.canvas;o.appendChild(t),e=t.style,e.position=`absolute`,e.left=`0`,e.transformOrigin=`top left`,this.container=o,this.context=s}!this.containerReused&&n&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=n)}clipUnrotated(e,t,n){let r=gl(n),i=_l(n),a=cl(n),o=sl(n);vd(t.coordinateToPixelTransform,r),vd(t.coordinateToPixelTransform,i),vd(t.coordinateToPixelTransform,a),vd(t.coordinateToPixelTransform,o);let s=this.inversePixelTransform;vd(s,r),vd(s,i),vd(s,a),vd(s,o),e.save(),e.beginPath(),e.moveTo(Math.round(r[0]),Math.round(r[1])),e.lineTo(Math.round(i[0]),Math.round(i[1])),e.lineTo(Math.round(a[0]),Math.round(a[1])),e.lineTo(Math.round(o[0]),Math.round(o[1])),e.clip()}prepareContainer(e,t){let n=e.extent,r=e.viewState.resolution,i=this.sourceRotates(),a=i?0:e.viewState.rotation,o=e.pixelRatio,s=Math.round(i?e.size[0]*o:G(n)/r*o),c=Math.round(i?e.size[1]*o:pl(n)/r*o);yd(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/o,1/o,a,-s/2,-c/2),bd(this.inversePixelTransform,this.pixelTransform);let l=Cd(this.pixelTransform),u=this.getBackground(e);if(this.useContainer(t,l,u,s,c),!this.containerReused){let e=this.context.canvas;e.width!=s||e.height!=c?(e.width=s,e.height=c):this.context.clearRect(0,0,s,c),l!==e.style.transform&&(e.style.transform=l)}}dispatchRenderEvent_(e,t,n){let r=this.getLayer();if(r.hasListener(e)){let i=new S_(e,this.inversePixelTransform,n,t);r.dispatchEvent(i)}}preRender(e,t){this.frameState=t,!t.declutter&&this.dispatchRenderEvent_(qp.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(qp.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new cv),e.declutter?this.deferredContext_.getContext():this.context}getCanvasContext(){let e=this.context;if(!e)throw Error(`Canvas context not initialized`);return e}getContainerElement(){let e=this.container;if(!e)throw Error(`Canvas container not initialized`);return e}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(qp.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(qp.POSTRENDER,this.context,e))}getRenderTransform(e,t,n,r,i,a,o){let s=i/2,c=a/2,l=r/t,u=-l,d=-e[0]+o,f=-e[1];return yd(this.tempTransform,s,c,l,u,-n,d,f)}sourceRotates(){return this.wantRotation&&!!this.getLayer().getSource()?.canRotate}disposeInternal(){delete this.frameState,super.disposeInternal()}};function hv(e,t,n){if(!(n in e))return e[n]=new Set([t]),!0;let r=e[n],i=r.has(t);return i||r.add(t),!i}function gv(e,t,n){let r=e[n];return r?r.delete(t):!1}function _v(e,t){let n=e.layerStatesArray[e.layerIndex];if(n.extent&&(t=ml(t,dd(n.extent,e.viewState.projection))),!n.layer)return t;let r=n.layer.getRenderSource();if(!r.getWrapX()){let n=r.getTileGridForProjection(e.viewState.projection).getExtent();n&&(t=ml(t,n))}return t}var vv=class extends mv{constructor(e,t){super(e),t||={},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceRevision_,this.tempExtent=Yc(),this.tempTileRange_=new B_(0,0,0,0),this.tempTileCoord_=nv(0,0,0);let n=t.cacheSize===void 0?512:t.cacheSize;this.tileCache_=new tv(n),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=n*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||=new tv(512),this.sourceTileCache_}getOrCreateTile(e,t,n,r){let i=this.tileCache_,a=this.getLayer().getSource();if(!a)return null;let o=iv(a,a.getKey(),e,t,n),s;if(i.containsKey(o)){if(s=i.get(o),!s)return null}else{let c=r.viewState.projection,l=a.getProjection();if(s=a.getTile(e,t,n,r.pixelRatio,c,!l||td(l,c)?void 0:this.getSourceTileCache()),!s)return null;i.set(o,s)}return s}getTile(e,t,n,r){return this.getOrCreateTile(e,t,n,r)||null}getData(e){let t=this.frameState;if(!t)return null;let n=this.getLayer(),r=vd(t.pixelToCoordinateTransform,e.slice()),i=n.getExtent();if(i&&!Gc(i,r))return null;let a=t.viewState,o=n.getRenderSource();if(!o)return null;let s=o.getTileGridForProjection(a.projection),c=o.getTilePixelRatio(t.pixelRatio);for(let e=s.getZForResolution(a.resolution);e>=s.getMinZoom();--e){let n=s.getTileCoordForCoordAndZ(r,e),i=this.getTile(e,n[1],n[2],t);if(!i||i.getState()!==H.LOADED)continue;let l=s.getOrigin(e),u=Bm(s.getTileSize(e)),d=s.getResolution(e),f=null;if(i instanceof R_||i instanceof ev)f=i.getImage();else if(i instanceof L_){let e=i.getData();e&&(f=N_(e))}if(!f)continue;let p=Math.floor(c*((r[0]-l[0])/d-n[1]*u[0])),m=Math.floor(c*((l[1]-r[1])/d-n[2]*u[1])),h=Math.round(c*o.getGutterForProjection(a.projection));return this.getImageData(f,p+h,m+h)}return null}readData(e){let t=this.getLayer().getRenderSource();if(!t)return null;let n=e.viewState,r=n.projection;if(t.getGutterForProjection(r))throw Error(`readData() does not support sources with a gutter`);let i=t.getTileGridForProjection(r),a=n.resolution,o=e.extent,s=i.getZForResolution(a),c={};this.enqueueTiles(e,o,s,c,0);let l=c[s];if(!l)return null;let u=[],d=!0;if(l.forEach(e=>{let t=e,n=t.getState();n===H.LOADED?u.push(t):n!==H.ERROR&&n!==H.EMPTY&&(d=!1)}),!d||u.length===0)return null;let f=e.size[0],p=e.size[1],m=u[0],h=P_(m.getData());if(!h||h instanceof DataView)throw Error(`ol/renderer/canvas/TileLayer#readData only supports typed array tile data`);let g=m.getSize(),_=Math.round(h.length/(g[0]*g[1])),v=h.constructor,y=new v(f*p*_);for(let e of u){let t=i.getTileCoordExtent(e.tileCoord,this.tempExtent),n=e.getSize(),r=P_(e.getData()),s=(t[0]-o[0])/a-.5,c=(o[3]-t[3])/a-.5,l=G(t)/a,u=pl(t)/a,d=n[0]/l,m=n[1]/u,h=Math.max(0,Math.ceil(s)),g=Math.min(f,Math.ceil(s+l)),v=Math.max(0,Math.ceil(c)),b=Math.min(p,Math.ceil(c+u));for(let e=v;e<b;++e){let t=Math.min(Math.floor((e-c)*m),n[1]-1);for(let i=h;i<g;++i){let a=Math.min(Math.floor((i-s)*d),n[0]-1),o=(t*n[0]+a)*_,c=(e*f+i)*_;for(let e=0;e<_;++e)y[c+e]=r[o+e]}}}return this.updateCacheSize(l.size),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache(),{data:y,width:f,height:p,bandCount:_}}prepareFrame(e){this.renderedProjection?e.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=e.viewState.projection):this.renderedProjection=e.viewState.projection;let t=this.getLayer().getSource();if(!t)return!1;let n=t.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==n&&(this.renderedSourceRevision_=n,this.renderedSourceKey_===t.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=n,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(e,t,n,r,i){let a=e.viewState,o=this.getLayer(),s=o.getRenderSource();if(!s)return;let c=s.getTileGridForProjection(a.projection),l=V(s);l in e.wantedTiles||(e.wantedTiles[l]={});let u=e.wantedTiles[l],d=o.getMapInternal(),f=Math.max(n-i,c.getMinZoom(),c.getZForResolution(Math.min(o.getMaxResolution(),d?d.getView().getResolutionForZoom(Math.max(o.getMinZoom(),0)):c.getResolution(0)),s.zDirection)),p=a.rotation,m=p?fl(a.center,a.resolution,p,e.size):void 0;for(let i=n;i>=f;--i){let n=c.getTileRangeForExtentAndZ(t,i,this.tempTileRange_),a=c.getResolution(i);for(let t=n.minX;t<=n.maxX;++t)for(let o=n.minY;o<=n.maxY;++o){if(p&&m&&!c.tileCoordIntersectsViewport([i,t,o],m))continue;let n=this.getTile(i,t,o,e);if(!n||!hv(r,n,i))continue;let s=n.getKey();if(u[s]=!0,n.getState()===H.IDLE&&!e.tileQueue.isKeyQueued(s)){let r=nv(i,t,o,this.tempTileCoord_);e.tileQueue.enqueue([n,l,c.getTileCoordCenter(r),a])}}}}findStaleTile_(e,t){let n=this.tileCache_,r=e[0],i=e[1],a=e[2],o=this.getStaleKeys(),s=this.getLayer().getSource();if(!s)return!1;for(let e=0;e<o.length;++e){let c=iv(s,o[e],r,i,a);if(n.containsKey(c)){let e=n.peek(c);if(e&&e.getState()===H.LOADED)return e.endTransition(V(this)),hv(t,e,r),!0}}return!1}findAltTiles_(e,t,n,r){let i=e.getTileRangeForTileCoordAndZ(t,n,this.tempTileRange_);if(!i)return!1;let a=!0,o=this.tileCache_,s=this.getLayer().getRenderSource();if(!s)return!1;let c=s.getKey();for(let e=i.minX;e<=i.maxX;++e)for(let t=i.minY;t<=i.maxY;++t){let i=iv(s,c,n,e,t),l=!1;if(o.containsKey(i)){let e=o.peek(i);e&&e.getState()===H.LOADED&&(hv(r,e,n),l=!0)}l||(a=!1)}return a}renderFrame(e,t){this.renderComplete=!0;let n=e.layerStatesArray[e.layerIndex],r=e.viewState,i=r.projection,a=r.resolution,o=r.center,s=e.pixelRatio,c=this.getLayer(),l=c.getSource();if(!l)return this.getContainerElement();let u=l.getTileGridForProjection(i),d=u.getZForResolution(a,l.zDirection),f=u.getResolution(d);this.updateStaleKeys(l.getKey());let p=e.extent,m=l.getTilePixelRatio(s);this.prepareContainer(e,t);let h=this.getCanvasContext().canvas.width,g=this.getCanvasContext().canvas.height;this.layerExtent=n.extent?dd(n.extent,i):null,this.layerExtent&&(p=ml(p,this.layerExtent));let _=f*h/2/m,v=f*g/2/m,y=[o[0]-_,o[1]-v,o[0]+_,o[1]+v],b={};this.renderedTiles.length=0;let x=c.getPreload();if(e.nextExtent&&this.enqueueTilesForNextExtent()){let t=u.getZForResolution(r.nextResolution??a,l.zDirection),n=_v(e,e.nextExtent);this.enqueueTiles(e,n,t,b,x)}let S=_v(e,p);if(this.enqueueTiles(e,S,d,b,0),x>0&&setTimeout(()=>{this.enqueueTiles(e,S,d-1,b,x-1)},0),!(d in b))return this.getContainerElement();let C=V(this),w=e.time;for(let t of b[d]){let n=t.getState();if(n===H.EMPTY)continue;let r=t.tileCoord;if(n===H.LOADED&&t.getAlpha(C,w)===1){t.endTransition(C);continue}if(n!==H.ERROR&&(this.renderComplete=!1),this.findStaleTile_(r,b)){gv(b,t,d),e.animate=!0;continue}if(this.findAltTiles_(u,r,d+1,b))continue;let i=u.getMinZoom();for(let e=d-1;e>=i&&!this.findAltTiles_(u,r,e,b);--e);}let T=f/a*s/m,E=this.getRenderContext(e);yd(this.tempTransform,h/2,g/2,T,T,0,-h/2,-g/2),this.layerExtent&&this.clipUnrotated(E,e,this.layerExtent),l.getInterpolate()||(E.imageSmoothingEnabled=!1),this.preRender(E,e);let D=Object.keys(b).map(Number);D.sort(Rs);let O=[],k=[],A=[];for(let t=D.length-1;t>=0;--t){let n=D[t],r=l.getTilePixelSize(n,s,i),a=u.getResolution(n)/f,o=r[0]*a*T,c=r[1]*a*T,p=u.getTileCoordForCoordAndZ(gl(y),n),h=u.getTileCoordExtent(p),g=vd(this.tempTransform,[m*(h[0]-y[0])/f,m*(y[3]-h[3])/f]),_=m*l.getGutterForProjection(i);for(let t of b[n]){if(t.getState()!==H.LOADED)continue;let r=t.tileCoord,i=p[1]-r[1],a=Math.round(g[0]-(i-1)*o),s=p[2]-r[2],u=Math.round(g[1]-(s-1)*c),f=Math.round(g[0]-i*o),m=Math.round(g[1]-s*c),h=a-f,v=u-m,y=n===d;if(y&&t.inTransition(C)){A.push({tile:t,x:f,y:m,w:h,h:v,gutter:_}),this.renderedTiles.unshift(t),this.updateUsedTiles(e.usedTiles,l,t);continue}let b=[f,m,f+h,m+v],x=[];for(let e=0,t=O.length;e<t;++e)n<k[e]&&vl(b,O[e])&&x.push(O[e]);let S;x.length>0&&(S=wl(b,x)),O.push(b),k.push(n),this.drawTile(t,e,f,m,h,v,_,y,S),this.renderedTiles.unshift(t),this.updateUsedTiles(e.usedTiles,l,t)}}for(let t=0,n=A.length;t<n;++t){let{tile:n,x:r,y:i,w:a,h:o,gutter:s}=A[t];this.drawTile(n,e,r,i,a,o,s,!0,void 0)}return this.renderedResolution=f,this.extentChanged=!this.renderedExtent_||!el(this.renderedExtent_,y),this.renderedExtent_=y,this.renderedPixelRatio=s,this.postRender(this.getCanvasContext(),e),this.layerExtent&&E.restore(),E.imageSmoothingEnabled=!0,this.renderComplete&&e.postRenderFunctions.push((e,t)=>{let n=V(l),r=t.wantedTiles[n],i=r?Object.keys(r).length:0;this.updateCacheSize(i),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()}),this.getContainerElement()}updateCacheSize(e){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,e*2)}drawTile(e,t,n,r,i,a,o,s,c){let l;if(e instanceof L_){let t=e.getData();if(!t)return;if(l=N_(t),!l)throw Error(`Rendering array data is not yet supported`)}else l=this.getTileImage(e);if(!l)return;let u=this.getRenderContext(t),d=V(this),f=t.layerStatesArray[t.layerIndex],p=f.opacity*(s?e.getAlpha(d,t.time):1),m=p!==u.globalAlpha;m&&(u.save(),u.globalAlpha=p);let h=l.width-2*o,g=l.height-2*o;if(c){let e=h/i,t=g/a;for(let i=0,a=c.length;i<a;++i){let a=c[i],s=a[0],d=a[1],f=a[2]-a[0],p=a[3]-a[1];u.drawImage(l,o+(s-n)*e,o+(d-r)*t,f*e,p*t,s,d,f,p)}}else u.drawImage(l,o,o,h,g,n,r,i,a);m&&u.restore(),p===f.opacity?s&&e.endTransition(d):t.animate=!0}getImage(){let e=this.getCanvasContext();return e?e.canvas:null}getTileImage(e){return e.getImage()??null}updateUsedTiles(e,t,n){let r=V(t);r in e||(e[r]={}),e[r][n.getKey()]=!0}},yv={PRELOAD:`preload`,USE_INTERIM_TILES_ON_ERROR:`useInterimTilesOnError`},bv=class extends Jp{constructor(e){e||={};let t=Object.assign({},e),n=e.cacheSize;delete e.cacheSize,delete t.preload,delete t.useInterimTilesOnError,super(t),this.on,this.once,this.un,this.cacheSize_=n,this.setPreload(e.preload===void 0?0:e.preload),this.setUseInterimTilesOnError(e.useInterimTilesOnError===void 0||e.useInterimTilesOnError)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(yv.PRELOAD)}setPreload(e){this.set(yv.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(yv.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(yv.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}},xv=class extends bv{constructor(e){super(e)}createRenderer(){return new vv(this,{cacheSize:this.getCacheSize()})}},Sv=class{drawCustom(e,t,n,r,i){}drawGeometry(e){}setStyle(e){}drawCircle(e,t,n){}drawFeature(e,t,n){}drawGeometryCollection(e,t,n){}drawLineString(e,t,n){}drawMultiLineString(e,t,n){}drawMultiPoint(e,t,n){}drawMultiPolygon(e,t,n){}drawPoint(e,t,n){}drawPolygon(e,t,n){}drawText(e,t,n){}setFillStrokeStyle(e,t){}setImageStyle(e,t){}setTextStyle(e,t){}},$={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},Cv=[$.FILL],wv=[$.STROKE],Tv=[$.BEGIN_PATH],Ev=[$.CLOSE_PATH],Dv=class extends Sv{constructor(e,t,n,r){super(),this.tolerance=e,this.maxExtent=t,this.pixelRatio=r,this.maxLineWidth=0,this.resolution=n,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(e){let t=this.pixelRatio;return t==1?e:e.map(function(e){return e*t})}appendFlatPointCoordinates(e,t){let n=this.getBufferedMaxExtent(),r=this.tmpCoordinate_,i=this.coordinates,a=i.length;for(let o=0,s=e.length;o<s;o+=t)r[0]=e[o],r[1]=e[o+1],Gc(n,r)&&(i[a++]=r[0],i[a++]=r[1]);return a}appendFlatLineCoordinates(e,t,n,r,i,a){let o=this.coordinates,s=o.length,c=this.getBufferedMaxExtent();a&&(t+=r);let l=e[t],u=e[t+1],d=this.tmpCoordinate_,f=!0,p,m,h;for(p=t+r;p<n;p+=r)d[0]=e[p],d[1]=e[p+1],h=Jc(c,d),h===m?h===Bc.INTERSECTING?(o[s++]=d[0],o[s++]=d[1],f=!1):f=!0:(f&&=(o[s++]=l,o[s++]=u,!1),o[s++]=d[0],o[s++]=d[1]),l=d[0],u=d[1],m=h;return(i&&f||p===t+r)&&(o[s++]=l,o[s++]=u),s}drawCustomCoordinates_(e,t,n,r,i){for(let a=0,o=n.length;a<o;++a){let o=n[a],s=this.appendFlatLineCoordinates(e,t,o,r,!1,!1);i.push(s),t=o}return t}drawCustom(e,t,n,r,i){this.beginGeometry(e,t,i);let a=e.getType(),o=e.getStride(),s=this.coordinates.length,c,l,u,d,f;switch(a){case`MultiPolygon`:c=e.getOrientedFlatCoordinates(),u=[];let t=e.getEndss();f=0;for(let e=0,n=t.length;e<n;++e){let n=[];f=this.drawCustomCoordinates_(c,f,t[e],o,n),u.push(n)}this.instructions.push([$.CUSTOM,s,u,e,n,Yd,i]),this.hitDetectionInstructions.push([$.CUSTOM,s,u,e,r||n,Yd,i]);break;case`Polygon`:case`MultiLineString`:d=[],c=a==`Polygon`?e.getOrientedFlatCoordinates():e.getFlatCoordinates(),f=this.drawCustomCoordinates_(c,0,e.getEnds(),o,d),this.instructions.push([$.CUSTOM,s,d,e,n,Jd,i]),this.hitDetectionInstructions.push([$.CUSTOM,s,d,e,r||n,Jd,i]);break;case`LineString`:case`Circle`:c=e.getFlatCoordinates(),l=this.appendFlatLineCoordinates(c,0,c.length,o,!1,!1),this.instructions.push([$.CUSTOM,s,l,e,n,qd,i]),this.hitDetectionInstructions.push([$.CUSTOM,s,l,e,r||n,qd,i]);break;case`MultiPoint`:c=e.getFlatCoordinates(),l=this.appendFlatPointCoordinates(c,o),l>s&&(this.instructions.push([$.CUSTOM,s,l,e,n,qd,i]),this.hitDetectionInstructions.push([$.CUSTOM,s,l,e,r||n,qd,i]));break;case`Point`:c=e.getFlatCoordinates(),this.coordinates.push(c[0],c[1]),l=this.coordinates.length,this.instructions.push([$.CUSTOM,s,l,e,n,void 0,i]),this.hitDetectionInstructions.push([$.CUSTOM,s,l,e,r||n,void 0,i])}this.endGeometry(t)}beginGeometry(e,t,n){this.beginGeometryInstruction1_=[$.BEGIN_GEOMETRY,t,0,e,n],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[$.BEGIN_GEOMETRY,t,0,e,n],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){let e=this.hitDetectionInstructions;e.reverse();let t,n=e.length,r,i,a=-1;for(t=0;t<n;++t)r=e[t],i=r[0],i==$.END_GEOMETRY?a=t:i==$.BEGIN_GEOMETRY&&(r[2]=t,Vs(this.hitDetectionInstructions,a,t),a=-1)}fillStyleToState(e,t={}){if(e){let n=e.getColor();t.fillPatternScale=n&&typeof n==`object`&&`src`in n?this.pixelRatio:1,t.fillStyle=Qh(n||`#000`)??void 0}else t.fillStyle=void 0;return t}strokeStyleToState(e,t={}){if(e){t.strokeStyle=Qh(e.getColor()||`#000`)??void 0;let n=e.getLineCap();t.lineCap=n===void 0?ng:n;let r=e.getLineDash();t.lineDash=r?r.slice():rg,t.lineDashOffset=e.getLineDashOffset()||0;let i=e.getLineJoin();t.lineJoin=i===void 0?ig:i;let a=e.getWidth();t.lineWidth=a===void 0?1:a;let o=e.getMiterLimit();t.miterLimit=o===void 0?10:o,t.strokeOffset=e.getOffset()??0,t.lineWidth>this.maxLineWidth&&(this.maxLineWidth=t.lineWidth,this.bufferedMaxExtent_=null)}else t.strokeStyle=void 0,t.lineCap=void 0,t.lineDash=null,t.lineDashOffset=void 0,t.lineJoin=void 0,t.lineWidth=void 0,t.miterLimit=void 0,t.strokeOffset=void 0;return t}setFillStrokeStyle(e,t){let n=this.state;this.fillStyleToState(e,n),this.strokeStyleToState(t,n)}createFill(e){let t=e.fillStyle,n=[$.SET_FILL_STYLE,t];return typeof t!=`string`&&n.push(e.fillPatternScale),n}applyStroke(e){this.instructions.push(this.createStroke(e))}createStroke(e){return[$.SET_STROKE_STYLE,e.strokeStyle,e.lineWidth*this.pixelRatio,e.lineCap,e.lineJoin,e.miterLimit,e.lineDash?this.applyPixelRatio(e.lineDash):null,e.lineDashOffset*this.pixelRatio]}updateFillStyle(e,t){let n=e.fillStyle;(n!==void 0&&typeof n!=`string`||e.currentFillStyle!=n)&&(this.instructions.push(t.call(this,e)),e.currentFillStyle=n)}updateStrokeStyle(e,t){let n=e.strokeStyle,r=e.lineCap,i=e.lineDash,a=e.lineDashOffset,o=e.lineJoin,s=e.lineWidth,c=e.miterLimit,l=e.strokeOffset;(e.currentStrokeStyle!=n||e.currentLineCap!=r||i!=e.currentLineDash&&(!i||!e.currentLineDash||!Us(e.currentLineDash,i))||e.currentLineDashOffset!=a||e.currentLineJoin!=o||e.currentLineWidth!=s||e.currentMiterLimit!=c||e.currentStrokeOffset!=l)&&(t.call(this,e),e.currentStrokeStyle=n,e.currentLineCap=r,e.currentLineDash=i,e.currentLineDashOffset=a,e.currentLineJoin=o,e.currentLineWidth=s,e.currentMiterLimit=c,e.currentStrokeOffset=l)}endGeometry(e){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;let t=[$.END_GEOMETRY,e];this.instructions.push(t),this.hitDetectionInstructions.push(t)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Uc(this.maxExtent),this.maxLineWidth>0)){let e=this.resolution*(this.maxLineWidth+1)/2;Hc(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},Ov=class extends Dv{constructor(e,t,n,r){super(e,t,n,r),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(e,t,n){if(!this.image_||this.maxExtent&&!Gc(this.maxExtent,e.getFlatCoordinates()))return;this.beginGeometry(e,t,n??0);let r=e.getFlatCoordinates(),i=e.getStride(),a=this.coordinates.length,o=this.appendFlatPointCoordinates(r,i),s=this.imagePixelRatio_??1,c=this.anchorX_??0,l=this.anchorY_??0,u=this.height_??0,d=this.originX_??0,f=this.originY_??0,p=this.scale_??[1,1],m=this.width_??0;this.instructions.push([$.DRAW_IMAGE,a,o,this.image_,c*s,l*s,Math.ceil(u*s),this.opacity_,d*s,f*s,this.rotateWithView_,this.rotation_,[p[0]*this.pixelRatio/s,p[1]*this.pixelRatio/s],Math.ceil(m*s),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([$.DRAW_IMAGE,a,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}drawMultiPoint(e,t,n){if(!this.image_)return;this.beginGeometry(e,t,n??0);let r=e.getFlatCoordinates(),i=[];for(let t=0,n=r.length;t<n;t+=e.getStride())(!this.maxExtent||Gc(this.maxExtent,r.slice(t,t+2)))&&i.push(r[t],r[t+1]);let a=this.coordinates.length,o=this.appendFlatPointCoordinates(i,2),s=this.imagePixelRatio_??1,c=this.anchorX_??0,l=this.anchorY_??0,u=this.height_??0,d=this.originX_??0,f=this.originY_??0,p=this.scale_??[1,1],m=this.width_??0;this.instructions.push([$.DRAW_IMAGE,a,o,this.image_,c*s,l*s,Math.ceil(u*s),this.opacity_,d*s,f*s,this.rotateWithView_,this.rotation_,[p[0]*this.pixelRatio/s,p[1]*this.pixelRatio/s],Math.ceil(m*s),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([$.DRAW_IMAGE,a,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(e,t){let n=e.getAnchor(),r=e.getSize(),i=e.getOrigin();n&&r&&i&&(this.imagePixelRatio_=e.getPixelRatio(this.pixelRatio),this.anchorX_=n[0],this.anchorY_=n[1],this.hitDetectionImage_=e.getHitDetectionImage(),this.image_=e.getImage(this.pixelRatio),this.height_=r[1],this.opacity_=e.getOpacity(),this.originX_=i[0],this.originY_=i[1],this.rotateWithView_=e.getRotateWithView(),this.rotation_=e.getRotation(),this.scale_=e.getScaleArray(),this.width_=r[0],this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t)}},kv=class extends Dv{constructor(e,t,n,r){super(e,t,n,r)}drawFlatCoordinates_(e,t,n,r,i){let a=(i??0)*this.pixelRatio,o=this.coordinates.length,s=this.appendFlatLineCoordinates(e,t,n,r,!1,!1);return this.instructions.push([$.MOVE_TO_LINE_TO,o,s,a]),this.hitDetectionInstructions.push([$.MOVE_TO_LINE_TO,o,s,i??0]),n}drawLineString(e,t,n){let r=this.state;if(!r)return;let i=r.strokeStyle,a=r.lineWidth,o=r.strokeOffset;if(i===void 0||a===void 0)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(e,t,n??0),this.hitDetectionInstructions.push([$.SET_STROKE_STYLE,ag,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,rg,0],Tv);let s=e.getFlatCoordinates(),c=e.getStride();this.drawFlatCoordinates_(s,0,s.length,c,o),this.hitDetectionInstructions.push(wv),this.endGeometry(t)}drawMultiLineString(e,t,n){let r=this.state;if(!r)return;let i=r.strokeStyle,a=r.lineWidth,o=r.strokeOffset;if(i===void 0||a===void 0)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(e,t,n??0),this.hitDetectionInstructions.push([$.SET_STROKE_STYLE,ag,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,rg,0],Tv);let s=e.getEnds()??[],c=e.getFlatCoordinates(),l=e.getStride(),u=0;for(let e=0,t=s.length;e<t;++e)u=this.drawFlatCoordinates_(c,u,s[e],l,o);this.hitDetectionInstructions.push(wv),this.endGeometry(t)}finish(){let e=this.state;return e&&e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&this.instructions.push(wv),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(wv),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(Tv)}},Av=class extends Dv{constructor(e,t,n,r){super(e,t,n,r)}drawFlatCoordinatess_(e,t,n,r,i){let a=this.state,o=i??0,s=a.fillStyle!==void 0,c=a.strokeStyle!==void 0,l=n.length;this.instructions.push(Tv),this.hitDetectionInstructions.push(Tv);for(let i=0;i<l;++i){let a=n[i],s=this.coordinates.length,l=this.appendFlatLineCoordinates(e,t,a,r,!0,!c);this.instructions.push([$.MOVE_TO_LINE_TO,s,l,o*this.pixelRatio,!0]),this.hitDetectionInstructions.push([$.MOVE_TO_LINE_TO,s,l,o,!0]),c&&(this.instructions.push(Ev),this.hitDetectionInstructions.push(Ev)),t=a}return s&&(this.instructions.push(Cv),this.hitDetectionInstructions.push(Cv)),c&&(this.instructions.push(wv),this.hitDetectionInstructions.push(wv)),t}drawCircle(e,t,n){let r=this.state;if(!r)return;let i=r.fillStyle,a=r.strokeStyle,o=r.strokeOffset;if(i===void 0&&a===void 0||this.handleStrokeOffset_(()=>this.drawCircle(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n??0),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([$.SET_FILL_STYLE,tg]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([$.SET_STROKE_STYLE,ag,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,rg,0]);let s=e.getFlatCoordinates(),c=e.getStride(),l=this.coordinates.length;this.appendFlatLineCoordinates(s,0,s.length,c,!1,!1);let u=[$.CIRCLE,l,o];this.instructions.push(Tv,u),this.hitDetectionInstructions.push(Tv,u),r.fillStyle!==void 0&&(this.instructions.push(Cv),this.hitDetectionInstructions.push(Cv)),r.strokeStyle!==void 0&&(this.instructions.push(wv),this.hitDetectionInstructions.push(wv)),this.endGeometry(t)}drawPolygon(e,t,n){let r=this.state;if(!r)return;let i=r.fillStyle,a=r.strokeStyle,o=r.strokeOffset;if(i===void 0&&a===void 0||this.handleStrokeOffset_(()=>this.drawPolygon(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n??0),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([$.SET_FILL_STYLE,tg]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([$.SET_STROKE_STYLE,ag,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,rg,0]);let s=e.getEnds(),c=e.getOrientedFlatCoordinates(),l=e.getStride();this.drawFlatCoordinatess_(c,0,s,l,o),this.endGeometry(t)}drawMultiPolygon(e,t,n){let r=this.state;if(!r)return;let i=r.fillStyle,a=r.strokeStyle,o=r.strokeOffset;if(i===void 0&&a===void 0||this.handleStrokeOffset_(()=>this.drawMultiPolygon(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n??0),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([$.SET_FILL_STYLE,tg]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([$.SET_STROKE_STYLE,ag,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,rg,0]);let s=e.getEndss(),c=e.getOrientedFlatCoordinates(),l=e.getStride(),u=0;for(let e=0,t=s.length;e<t;++e)u=this.drawFlatCoordinatess_(c,u,s[e],l,o);this.endGeometry(t)}finish(){this.reverseHitDetectionInstructions(),this.state=null;let e=this.tolerance;if(e!==0){let t=this.coordinates;for(let n=0,r=t.length;n<r;++n)t[n]=of(t[n],e)}return super.finish()}setFillStrokeStyles_(){let e=this.state;e&&(this.updateFillStyle(e,this.createFill),this.updateStrokeStyle(e,this.applyStroke))}handleStrokeOffset_(e){let t=this.state,n=t.fillStyle,r=t.strokeStyle,i=t.strokeOffset??0;return Math.abs(i)>0&&n!==void 0&&r!==void 0&&(t.strokeStyle=void 0,t.strokeOffset=0,e(),t.fillStyle=void 0,t.strokeStyle=r,t.strokeOffset=i,e(),t.fillStyle=n,!0)}},jv=0,Mv=1;function Nv(e,t,n,r,i,a,o,s){let c=o-i,l=s-a,u=0,d=1;if(c===0){if(i<e||i>n)return!1}else{let t=(e-i)/c,r=(n-i)/c;if(t>r){let e=t;t=r,r=e}if(t>u&&(u=t),r<d&&(d=r),u>d)return!1}if(l===0){if(a<t||a>r)return!1}else{let e=(t-a)/l,n=(r-a)/l;if(e>n){let t=e;e=n,n=t}if(e>u&&(u=e),n<d&&(d=n),u>d)return!1}return jv=u,Mv=d,!0}function Pv(e,t,n,r){let i=r[0],a=r[1],o=r[2],s=r[3],c=[],l=[],u=!1,d,f,p=0;for(let r=0,m=t.length;r<m;++r){let m=t[r],h=e[p],g=e[p+1],_=!1;for(let t=p+n;t<m;t+=n){let n=e[t],r=e[t+1];if(Nv(i,a,o,s,h,g,n,r)){let e=n-h,t=r-g,i=h+jv*e,a=g+jv*t,o=h+Mv*e,s=g+Mv*t;u&&_&&i===d&&a===f?c.push(o,s):(u&&l.push(c.length),c.push(i,a,o,s),u=!0),d=o,f=s,_=!0}h=n,g=r}p=m}return u&&l.push(c.length),{flatCoordinates:c,ends:l}}function Fv(e,t,n,r,i){let a=[],o=n,s=0,c=t.slice(n,2);for(;s<e&&o+i<r;){let[n,r]=c.slice(-2),l=t[o+i],u=t[o+i+1],d=Math.sqrt((l-n)*(l-n)+(u-r)*(u-r));if(s+=d,s>=e){let t=(e-s+d)/d,f=Nc(n,l,t),p=Nc(r,u,t);c.push(f,p),a.push(c),c=[f,p],s==e&&(o+=i),s=0}else if(s<e)c.push(t[o+i],t[o+i+1]),o+=i;else{let e=d-s,t=Nc(n,l,e/d),f=Nc(r,u,e/d);c.push(t,f),a.push(c),c=[t,f],s=0,o+=i}}return s>0&&a.push(c),a}function Iv(e,t,n,r,i){let a=n,o=n,s=0,c=0,l=n,u,d,f,p,m,h,g,_,v,y;for(d=n;d<r;d+=i){let n=t[d],r=t[d+1];m!==void 0&&h!==void 0&&(v=n-m,y=r-h,p=Math.sqrt(v*v+y*y),g!==void 0&&_!==void 0&&f!==void 0&&(c+=f,u=Math.acos((g*v+_*y)/(f*p)),u>e&&(c>s&&(s=c,a=l,o=d),c=0,l=d-i)),f=p,g=v,_=y),m=n,h=r}return c+=p||0,c>s?[l,d]:[a,o]}var Lv={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},Rv={Circle:Av,Default:Dv,Image:Ov,LineString:kv,Polygon:Av,Text:class extends Dv{constructor(e,t,n,r){super(e,t,n,r),this.labels_=null,this.text_=``,this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[tg]={fillStyle:tg},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_=``,this.fillKey_=``,this.strokeKey_=``,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){let e=super.finish();return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e}drawText(e,t,n){let r=this.textFillState_,i=this.textStrokeState_,a=this.textState_;if(this.text_===``||!a||!r&&!i)return;let o=this.coordinates,s=o.length,c=e.getType(),l=null,u=e.getStride();if(a.placement===`line`&&(c==`LineString`||c==`MultiLineString`||c==`Polygon`||c==`MultiPolygon`)){let r=e.getExtent();if(!vl(this.maxExtent,r))return;let i=[];if(l=e.getFlatCoordinates(),c==`LineString`)i=[l.length];else if(c==`MultiLineString`)i=e.getEnds();else if(c==`Polygon`)i=e.getEnds().slice(0,1);else if(c==`MultiPolygon`){let t=e.getEndss();i=[];for(let e=0,n=t.length;e<n;++e)i.push(t[e][0])}if(a.textAlign===void 0&&(c==`LineString`||c==`MultiLineString`)&&!Kc(this.getBufferedMaxExtent(),r)){let e=Pv(l,i,u,this.getBufferedMaxExtent());if(l=e.flatCoordinates,i=e.ends,u=2,i.length===0)return}this.beginGeometry(e,t,n??0);let d=a.repeat,f=d?void 0:a.textAlign,p=0;for(let e=0,t=i.length;e<t;++e){let t;t=d?Fv(d*this.resolution,l,p,i[e],u):[l.slice(p,i[e])];for(let n=0,r=t.length;n<r;++n){let r=t[n],c=0,l=r.length;if(f==null){let e=Iv(a.maxAngle??Math.PI/4,r,0,r.length,2);c=e[0],l=e[1]}for(let e=c;e<l;e+=u)o.push(r[e],r[e+1]);let d=o.length;p=i[e],this.drawChars_(s,d),s=d}}this.endGeometry(t)}else{let r=a.overflow?null:[];switch(c){case`Point`:case`MultiPoint`:l=e.getFlatCoordinates();break;case`LineString`:l=e.getFlatMidpoint();break;case`Circle`:l=e.getCenter();break;case`MultiLineString`:l=e.getFlatMidpoints(),u=2;break;case`Polygon`:l=e.getFlatInteriorPoint(),!a.overflow&&r&&r.push(l[2]/this.resolution),u=3;break;case`MultiPolygon`:let t=e.getFlatInteriorPoints();l=[];for(let e=0,n=t.length;e<n;e+=3)!a.overflow&&r&&r.push(t[e+2]/this.resolution),l.push(t[e],t[e+1]);if(l.length===0)return;u=2;break;default:return}if(!l)return;let i=this.appendFlatPointCoordinates(l,u);if(i===s)return;if(r&&(i-s)/2!==l.length/u){let e=l,t=s/2;r=r.filter((n,r)=>{let i=o[(t+r)*2]===e[r*u]&&o[(t+r)*2+1]===e[r*u+1];return i||--t,i})}this.saveTextStates_();let d=a.backgroundFill?this.createFill(this.fillStyleToState(a.backgroundFill)):null,f=a.backgroundStroke?this.createStroke(this.strokeStyleToState(a.backgroundStroke)):null;this.beginGeometry(e,t,n??0);let p=a.scale??[1,1],m=a.padding??cg;if(m!=cg&&(p[0]<0||p[1]<0)){let e=m[0],t=m[1],n=m[2],r=m[3];p[0]<0&&(t=-t,r=-r),p[1]<0&&(e=-e,n=-n),m=[e,t,n,r]}let h=this.pixelRatio;this.instructions.push([$.DRAW_IMAGE,s,i,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,m==cg?cg:m.map(function(e){return e*h}),d,f,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,r]);let g=1/h,_=d?d.slice(0):null;_&&(_[1]=tg),this.hitDetectionInstructions.push([$.DRAW_IMAGE,s,i,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[g,g],NaN,this.declutterMode_,this.declutterImageWithText_,m,_,f,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?tg:this.fillKey_,this.textOffsetX_,this.textOffsetY_,r]),this.endGeometry(t)}}saveTextStates_(){let e=this.textStrokeState_,t=this.textState_,n=this.textFillState_,r=this.strokeKey_;e&&(r in this.strokeStates||(this.strokeStates[r]={strokeStyle:e.strokeStyle,lineCap:e.lineCap,lineDashOffset:e.lineDashOffset,lineWidth:e.lineWidth,lineJoin:e.lineJoin,miterLimit:e.miterLimit,lineDash:e.lineDash}));let i=this.textKey_;i in this.textStates||(this.textStates[i]={font:t.font,textAlign:t.textAlign||`center`,justify:t.justify,textBaseline:t.textBaseline||`middle`,scale:t.scale});let a=this.fillKey_;n&&(a in this.fillStates||(this.fillStates[a]={fillStyle:n.fillStyle}))}drawChars_(e,t){let n=this.textStrokeState_,r=this.textState_,i=this.strokeKey_,a=this.textKey_,o=this.fillKey_;this.saveTextStates_();let s=this.pixelRatio,c=Lv[r.textBaseline||`middle`],l=this.textOffsetX_*s,u=this.textOffsetY_*s,d=this.text_,f=r.scale??[1,1],p=n?n.lineWidth*Math.abs(f[0])/2:0;this.instructions.push([$.DRAW_CHARS,e,t,c,r.overflow,o,r.maxAngle,s,u,i,p*s,d,a,1,this.declutterMode_,this.textKeepUpright_,l]),this.hitDetectionInstructions.push([$.DRAW_CHARS,e,t,c,r.overflow,o&&tg,r.maxAngle,s,u,i,p*s,d,a,1/s,this.declutterMode_,this.textKeepUpright_,l])}setTextStyle(e,t){let n,r,i;if(!e)this.text_=``;else{let t=e.getFill();t?(r=this.textFillState_,r||(r={},this.textFillState_=r),r.fillStyle=Qh(t.getColor()||`#000`)||`#000`):(r=null,this.textFillState_=r);let a=e.getStroke();if(!a)i=null,this.textStrokeState_=i;else{i=this.textStrokeState_,i||(i={},this.textStrokeState_=i);let e=a.getLineDash(),t=a.getLineDashOffset(),n=a.getWidth(),r=a.getMiterLimit();i.lineCap=a.getLineCap()||`round`,i.lineDash=e?e.slice():rg,i.lineDashOffset=t===void 0?0:t,i.lineJoin=a.getLineJoin()||`round`,i.lineWidth=n===void 0?1:n,i.miterLimit=r===void 0?10:r,i.strokeStyle=Qh(a.getColor()||`#000`)||`#000`}n=this.textState_;let o=e.getFont()||`10px sans-serif`;hg(o);let s=e.getScaleArray();n.overflow=e.getOverflow(),n.font=o,n.maxAngle=e.getMaxAngle(),n.placement=e.getPlacement(),n.textAlign=e.getTextAlign(),n.repeat=e.getRepeat(),n.justify=e.getJustify(),n.textBaseline=e.getTextBaseline()||`middle`,n.backgroundFill=e.getBackgroundFill()??void 0,n.backgroundStroke=e.getBackgroundStroke()??void 0,n.padding=e.getPadding()||cg,n.scale=s===void 0?[1,1]:s;let c=e.getOffsetX(),l=e.getOffsetY(),u=e.getRotateWithView(),d=e.getKeepUpright(),f=e.getRotation();this.text_=e.getText()||``,this.textOffsetX_=c===void 0?0:c,this.textOffsetY_=l===void 0?0:l,this.textRotateWithView_=u!==void 0&&u,this.textKeepUpright_=d===void 0||d,this.textRotation_=f===void 0?0:f,this.strokeKey_=i?(typeof i.strokeStyle==`string`?i.strokeStyle:V(i.strokeStyle))+i.lineCap+i.lineDashOffset+`|`+i.lineWidth+i.lineJoin+i.miterLimit+`[`+i.lineDash.join()+`]`:``,this.textKey_=n.font+n.scale+(n.textAlign||`?`)+(n.repeat||`?`)+(n.justify||`?`)+(n.textBaseline||`?`),this.fillKey_=r&&r.fillStyle?typeof r.fillStyle==`string`?r.fillStyle:`|`+V(r.fillStyle):``}this.declutterMode_=e?e.getDeclutterMode():void 0,this.declutterImageWithText_=t}}},zv=class{constructor(e,t,n,r){this.tolerance_=e,this.maxExtent_=t,this.pixelRatio_=r,this.resolution_=n,this.buildersByZIndex_={}}finish(){let e={};for(let t in this.buildersByZIndex_){e[t]=e[t]||{};let n=this.buildersByZIndex_[t];for(let r in n){let i=n[r].finish();e[t][r]=i}}return e}getBuilder(e,t){let n=e===void 0?`0`:e.toString(),r=this.buildersByZIndex_[n];r===void 0&&(r={},this.buildersByZIndex_[n]=r);let i=r[t];if(i===void 0){let e=Rv[t];i=new e(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[t]=i}return i}};function Bv(e,t,n,r){let i=e[t],a=e[t+1],o=0;for(let s=t+r;s<n;s+=r){let t=e[s],n=e[s+1];o+=Math.sqrt((t-i)*(t-i)+(n-a)*(n-a)),i=t,a=n}return o}function Vv(e,t,n,r,i,a,o,s){o??=[],s??=r;let c=e[t+r],l=e[t+r+1],u=e[n-2*r],d=e[n-2*r+1],f,p,m,h,g,_,v,y,b=0;for(let x=t;x<n;x+=r){m=f,h=p,g=void 0,_=void 0,x+r<n&&(g=e[x+r],_=e[x+r+1]),a&&x===t&&(m=u,h=d),a&&x===n-r&&(g=c,_=l),f=e[x],p=e[x+1],[v,y]=Hv(f,p,m,h,g,_,i),o[b++]=v,o[b++]=y;for(let t=2;t<s;t++)o[b++]=e[x+t]}return o.length!=b&&(o.length=b),o}function Hv(e,t,n,r,i,a,o){let s,c;n!==void 0&&r!==void 0?(s=e-n,c=t-r):i!==void 0&&a!==void 0?(s=i-e,c=a-t):(s=1,c=0);let l=Math.hypot(s,c),u=s/l,d=c/l;if(s=-d,c=u,n===void 0||r===void 0||i===void 0||a===void 0)return[e+s*o,t+c*o];let f=Ml([e,t],[n,r],[i,a]);if(Math.cos(f)>.998)return[e+u*o,t+d*o];let p=Math.cos(f/2),m=Math.sin(f/2),h=m*s+p*c,g=-p*s+m*c,_=1/m*h,v=1/m*g;return[e+_*o,t+v*o]}function Uv(e,t,n=!1){for(let r=0,i=e.length-2;r<i;r+=t){let i=n&&r===0?e.length-3*t:e.length-2*t;for(let n=i;n>r+t;n-=t){let i=e[r],a=e[r+1],o=e[r+t],s=e[r+t+1],c=e[n],l=e[n+1],u=e[n+t],d=e[n+t+1],f=(d-l)*(o-i)-(u-c)*(s-a);if(f===0)continue;let p=((u-c)*(a-l)-(d-l)*(i-c))/f,m=((o-i)*(a-l)-(s-a)*(i-c))/f;if(p>0&&p<1&&m>0&&m<1){let c=i+p*(o-i),l=a+p*(s-a);e[r+t]=c,e[r+t+1]=l,e.splice(r+2*t,n-r-t);break}}}return e}var Wv,Gv=RegExp(`[֑-ࣿיִ-﷿ﹰ-ﻼࠀ-࿿-]`);function Kv(){return Wv||=new Intl.Segmenter(void 0,{granularity:`grapheme`}),Wv}function qv(e,t,n,r,i,a,o,s,c,l,u,d,f=!0){let p=e[t],m=e[t+1],h=0,g=0,_=0,v=0;function y(){h=p,g=m,t+=r,p=e[t],m=e[t+1],v+=_,_=Math.sqrt((p-h)*(p-h)+(m-g)*(m-g))}do y();while(t<n-r&&v+_<a);let b=_===0?0:(a-v)/_,x=Nc(h,p,b),S=Nc(g,m,b),C=t-r,w=v,T=a+s*c(l,i,u);for(;t<n-r&&v+_<T;)y();b=_===0?0:(T-v)/_;let E=Nc(h,p,b),D=Nc(g,m,b),O=!1;if(f){if(d){let e=[x,S,E,D];Dd(e,0,4,2,d,e,e),O=e[0]>e[2]}else O=x>E}let k=Math.PI,A=[],ee=C+r===t;t=C,_=0,v=w,p=e[t],m=e[t+1];let te;if(ee)return y(),te=Math.atan2(m-g,p-h),O&&(te+=te>0?-k:k),A[0]=[(E+x)/2,(D+S)/2,(T-a)/2,te,i],A;i=i.replace(/\n/g,` `);let ne=Array.from(Kv().segment(i),e=>e.segment),re=O!==Gv.test(i);for(let e=0,i=ne.length;e<i;){y();let d=Math.atan2(m-g,p-h);if(O&&(d+=d>0?-k:k),te!==void 0){let e=d-te;if(e+=e>k?-2*k:e<-k?2*k:0,Math.abs(e)>o)return null}te=d;let f=e,x=0;for(;e<i;++e){let o=s*c(l,ne[re?i-e-1:e],u);if(t+r<n&&v+_<a+x+o/2)break;x+=o}if(e===f)continue;let S=(re?ne.slice(i-e,i-f):ne.slice(f,e)).join(``);b=_===0?0:(a+x/2-v)/_;let C=Nc(h,p,b),w=Nc(g,m,b);A.push([C,w,x/2,d,S]),a+=x}return A}var Jv=Yc(),Yv=[],Xv=[],Zv=[],Qv=[];function $v(e){return e[3].declutterBox}function ey(e,t){return t===`start`?t=Gv.test(e)?`right`:`left`:t===`end`&&(t=Gv.test(e)?`left`:`right`),Lv[t]}function ty(e,t,n){return n>0&&e.push(`
`,``),e.push(t,``),e}function ny(e,t,n){return n%2==0&&(e+=t),e}var ry=class{constructor(e,t,n,r,i){this.overlaps=n,this.pixelRatio=t,this.resolution=e,this.alignAndScaleFill_,this.instructions=r.instructions,this.coordinates=r.coordinates,this.coordinateCache_={},this.renderedTransform_=gd(),this.hitDetectionInstructions=r.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=r.fillStates||{},this.strokeStates=r.strokeStates||{},this.textStates=r.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=i?new cv:null}getZIndexContext(){return this.zIndexContext_}createLabel(e,t,n,r){let i=e+t+n+r;if(this.labels_[i])return this.labels_[i];let a=r?this.strokeStates[r]:null,o=n?this.fillStates[n]:null,s=this.textStates[t],c=this.pixelRatio,l=[s.scale[0]*c,s.scale[1]*c],u=s.justify?Lv[s.justify]:ey(Array.isArray(e)?e[0]:e,s.textAlign||`center`),d=r&&a.lineWidth?a.lineWidth:0,f=Array.isArray(e)?e:String(e).split(`
`).reduce(ty,[]),{width:p,height:m,widths:h,heights:g,lineWidths:_}=bg(s,f),v=p+d,y=[],b=(v+2)*l[0],x=(m+d)*l[1],S={width:b<0?Math.floor(b):Math.ceil(b),height:x<0?Math.floor(x):Math.ceil(x),contextInstructions:y};(l[0]!=1||l[1]!=1)&&y.push(`scale`,l),r&&a&&(y.push(`strokeStyle`,a.strokeStyle),y.push(`lineWidth`,d),y.push(`lineCap`,a.lineCap),y.push(`lineJoin`,a.lineJoin),y.push(`miterLimit`,a.miterLimit),y.push(`setLineDash`,[a.lineDash]),y.push(`lineDashOffset`,a.lineDashOffset)),n&&o&&y.push(`fillStyle`,o.fillStyle),y.push(`textBaseline`,`middle`),y.push(`textAlign`,`center`);let C=.5-u,w=u*v+C*d,T=[],E=[],D=0,O=0,k=0,A=0,ee;for(let e=0,t=f.length;e<t;e+=2){let t=f[e];if(t===`
`){O+=D,D=0,w=u*v+C*d,++A;continue}let i=f[e+1]||s.font;i!==ee&&(r&&T.push(`font`,i),n&&E.push(`font`,i),ee=i),D=Math.max(D,g[k]);let a=[t,w+C*h[k]+u*(h[k]-_[A]),.5*(d+D)+O];w+=h[k],r&&T.push(`strokeText`,a),n&&E.push(`fillText`,a),++k}return Array.prototype.push.apply(y,T),Array.prototype.push.apply(y,E),this.labels_[i]=S,S}replayTextBackground_(e,t,n,r,i,a,o){e.beginPath(),e.moveTo.apply(e,t),e.lineTo.apply(e,n),e.lineTo.apply(e,r),e.lineTo.apply(e,i),e.lineTo.apply(e,t),a&&(this.alignAndScaleFill_=a[2],e.fillStyle=a[1],this.fill_(e)),o&&(this.setStrokeStyle_(e,o),e.stroke())}calculateImageOrLabelDimensions_(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){o*=d[0],s*=d[1];let g=n-o,_=r-s,v=i+c>e?e-c:i,y=a+l>t?t-l:a,b=p[3]+v*d[0]+p[1],x=p[0]+y*d[1]+p[2],S=g-p[3],C=_-p[0];(m||u!==0)&&(Yv[0]=S,Qv[0]=S,Yv[1]=C,Xv[1]=C,Xv[0]=S+b,Zv[0]=Xv[0],Zv[1]=C+x,Qv[1]=Zv[1]);let w;return u===0?Xc(Math.min(S,S+b),Math.min(C,C+x),Math.max(S,S+b),Math.max(C,C+x),Jv):(w=yd(gd(),n,r,1,1,u,-n,-r),vd(w,Yv),vd(w,Xv),vd(w,Zv),vd(w,Qv),Xc(Math.min(Yv[0],Xv[0],Zv[0],Qv[0]),Math.min(Yv[1],Xv[1],Zv[1],Qv[1]),Math.max(Yv[0],Xv[0],Zv[0],Qv[0]),Math.max(Yv[1],Xv[1],Zv[1],Qv[1]),Jv)),f&&(g=Math.round(g),_=Math.round(_)),{drawImageX:g,drawImageY:_,drawImageW:v,drawImageH:y,originX:c,originY:l,declutterBox:{minX:Jv[0],minY:Jv[1],maxX:Jv[2],maxY:Jv[3],value:h},canvasTransform:w,scale:d}}replayImageOrLabelArgs_(e){return this.replayImageOrLabel_(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}replayImageOrLabel_(e,t,n,r,i,a,o){let s=!!(a||o),c=r.declutterBox,l=o?o[2]*r.scale[0]/2:0;return c.minX-l<=t[0]&&c.maxX+l>=0&&c.minY-l<=t[1]&&c.maxY+l>=0&&(s&&this.replayTextBackground_(e,Yv,Xv,Zv,Qv,a,o),xg(e,r.canvasTransform,i,n,r.originX,r.originY,r.drawImageW,r.drawImageH,r.drawImageX,r.drawImageY,r.scale)),!0}fill_(e){let t=this.alignAndScaleFill_;if(t){let n=vd(this.renderedTransform_,[0,0]),r=512*this.pixelRatio;e.save(),e.translate(n[0]%r,n[1]%r),t!==1&&e.scale(t,t)}e.fill(),t&&e.restore()}setStrokeStyle_(e,t){e.strokeStyle=t[1],t[1]&&(e.lineWidth=t[2],e.lineCap=t[3],e.lineJoin=t[4],e.miterLimit=t[5],e.lineDashOffset=t[7],e.setLineDash(t[6]))}drawLabelWithPointPlacement_(e,t,n,r){let i=this.textStates[t],a=this.createLabel(e,t,r,n),o=this.strokeStates[n],s=this.pixelRatio,c=ey(Array.isArray(e)?e[0]:e,i.textAlign||`center`),l=Lv[i.textBaseline||`middle`],u=o&&o.lineWidth?o.lineWidth:0;return{label:a,anchorX:c*(a.width/s-2*i.scale[0])+2*(.5-c)*u,anchorY:l*a.height/s+2*(.5-l)*u}}execute_(e,t,n,r,i,a,o,s){let c=this.zIndexContext_,l;this.pixelCoordinates_&&Us(n,this.renderedTransform_)?l=this.pixelCoordinates_:(this.pixelCoordinates_||=[],l=Ed(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),_d(this.renderedTransform_,n));let u=0,d=r.length,f=0,p,m=[],h,g,_,v,y,b,x,S,C,w,T,E,D,O=0,k=0,A=this.coordinateCache_,ee=this.viewRotation_,te=Math.round(Math.atan2(-n[1],n[0])*0xe8d4a51000)/0xe8d4a51000,ne={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:ee},re=this.instructions!=r||this.overlaps?0:200,j,ie,ae,M;for(;u<d;){let n=r[u];switch(n[0]){case $.BEGIN_GEOMETRY:j=n[1],M=n[3],j.getGeometry()?o!==void 0&&!vl(o,M.getExtent())?u=n[2]+1:++u:u=n[2],c&&(c.zIndex=n[4]);break;case $.BEGIN_PATH:O>re&&(this.fill_(e),O=0),k>re&&(e.stroke(),k=0),!O&&!k&&(e.beginPath(),y=NaN,b=NaN),++u;break;case $.CIRCLE:f=n[1],_=n[2]??0;let r=l[f],d=l[f+1],oe=l[f+2]-_,se=l[f+3]-_,ce=oe-r,le=se-d,N=Math.sqrt(ce*ce+le*le);e.moveTo(r+N,d),e.arc(r,d,N,0,2*Math.PI,!0),++u;break;case $.CLOSE_PATH:e.closePath(),++u;break;case $.CUSTOM:f=n[1],p=n[2];let ue=n[3],P=n[4],de=n[5];ne.geometry=ue,ne.feature=j,u in A||(A[u]=[]);let fe=A[u];de?de(l,f,p,2,fe):(fe[0]=l[f],fe[1]=l[f+1],fe.length=2),c&&(c.zIndex=n[6]),P(fe,ne),++u;break;case $.DRAW_IMAGE:f=n[1],p=n[2],C=n[3],h=n[4],g=n[5];let pe=n[6],me=n[7],he=n[8],ge=n[9],_e=n[10],ve=n[11],ye=n[12],be=n[13];v=n[14]||`declutter`;let xe=n[15];if(!C&&n.length>=20){w=n[19],T=n[20],E=n[21],D=n[22];let e=this.drawLabelWithPointPlacement_(w,T,E,D);C=e.label,n[3]=C;let t=n[23];h=(e.anchorX-t)*this.pixelRatio,n[4]=h;let r=n[24];g=(e.anchorY-r)*this.pixelRatio,n[5]=g,pe=C.height,n[6]=pe,be=C.width,n[13]=be}let Se;n.length>25&&(Se=n[25]);let Ce,we,Te;n.length>17?(Ce=n[16],we=n[17],Te=n[18]):(Ce=cg,we=null,Te=null),_e&&te?ve+=ee:!_e&&!te&&(ve-=ee);let Ee=0;for(;f<p;f+=2){if(Se&&Se[Ee++]<be/this.pixelRatio)continue;let n=this.calculateImageOrLabelDimensions_(C.width,C.height,l[f],l[f+1],be,pe,h,g,he,ge,ve,ye,i,Ce,!!we||!!Te,j),r=[e,t,C,n,me,we,Te];if(s){let e,t,i;if(xe){let n=p-f;if(!xe[n]){xe[n]={args:r,declutterMode:v};continue}let a=xe[n];e=a.args,t=a.declutterMode,delete xe[n],i=$v(e)}let a,o;if(e&&(t!==`declutter`||!s.collides(i))&&(a=!0),(v!==`declutter`||!s.collides(n.declutterBox))&&(o=!0),t===`declutter`&&v===`declutter`){let e=a&&o;a=e,o=e}a&&(t!==`none`&&s.insert(i),this.replayImageOrLabelArgs_(e)),o&&(v!==`none`&&s.insert(n.declutterBox),this.replayImageOrLabelArgs_(r))}else this.replayImageOrLabelArgs_(r)}++u;break;case $.DRAW_CHARS:let De=n[1],Oe=n[2],ke=n[3],Ae=n[4];D=n[5];let je=n[6],Me=n[7],Ne=n[8];E=n[9];let Pe=n[10];w=n[11],Array.isArray(w)&&(w=w.reduce(ny,``)),T=n[12];let Fe=[n[13],n[13]];v=n[14]||`declutter`;let Ie=n[15],Le=n[16],Re=this.textStates[T],ze=Re.font,Be=[Re.scale[0]*Me,Re.scale[1]*Me],Ve;ze in this.widths_?Ve=this.widths_[ze]:(Ve={},this.widths_[ze]=Ve);let He=Bv(l,De,Oe,2),Ue=Math.abs(Be[0])*yg(ze,w,Ve);if(Ae||Ue<=He){let n=this.textStates[T].textAlign,r=(He-Ue)*ey(w,n),i=qv(l,De,Oe,2,w,r,je,Math.abs(Be[0]),yg,ze,Ve,te?0:this.viewRotation_,Ie);drawChars:if(i){let n=[],r,a,o,c,l;if(E)for(r=0,a=i.length;r<a;++r){l=i[r],o=l[4],c=this.createLabel(o,T,``,E),h=l[2]+(Be[0]<0?-Pe:Pe)-Le,g=ke*c.height+(.5-ke)*2*Pe*Be[1]/Be[0]-Ne;let a=this.calculateImageOrLabelDimensions_(c.width,c.height,l[0],l[1],c.width,c.height,h,g,0,0,l[3],Fe,!1,cg,!1,j);if(s&&v===`declutter`&&s.collides(a.declutterBox))break drawChars;n.push([e,t,c,a,1,null,null])}if(D)for(r=0,a=i.length;r<a;++r){l=i[r],o=l[4],c=this.createLabel(o,T,D,``),h=l[2]-Le,g=ke*c.height-Ne;let a=this.calculateImageOrLabelDimensions_(c.width,c.height,l[0],l[1],c.width,c.height,h,g,0,0,l[3],Fe,!1,cg,!1,j);if(s&&v===`declutter`&&s.collides(a.declutterBox))break drawChars;n.push([e,t,c,a,1,null,null])}s&&v!==`none`&&s.load(n.map($v));for(let e=0,t=n.length;e<t;++e)this.replayImageOrLabelArgs_(n[e])}}++u;break;case $.END_GEOMETRY:if(a!==void 0){j=n[1];let e=a(j,M,v);if(e)return e}++u;break;case $.FILL:re?O++:this.fill_(e),++u;break;case $.MOVE_TO_LINE_TO:f=n[1],p=n[2],_=n[3];let We,Ge,Ke;if(_){let e=(n[4]??!1)||Math.abs(l[f]-l[p-2])<1e-6&&Math.abs(l[f+1]-l[p-1])<1e-6;Vv(l,f,p,2,_,e,m),Uv(m,2,e),We=m,Ge=0,Ke=We.length}else We=l,Ge=f,Ke=p;ie=We[Ge],ae=We[Ge+1],e.moveTo(ie,ae),y=ie+.5|0,b=ae+.5|0;for(let t=Ge+2;t<Ke;t+=2)ie=We[t],ae=We[t+1],x=ie+.5|0,S=ae+.5|0,(t==Ke-2||x!==y||S!==b)&&(e.lineTo(ie,ae),y=x,b=S);++u;break;case $.SET_FILL_STYLE:this.alignAndScaleFill_=n[2],O?(this.fill_(e),O=0,k&&=(e.stroke(),0)):k&&n[1]&&(e.stroke(),k=0),e.fillStyle=n[1],++u;break;case $.SET_STROKE_STYLE:O&&n[1]&&(this.fill_(e),O=0),k&&=(e.stroke(),0),this.setStrokeStyle_(e,n),++u;break;case $.STROKE:re?k++:e.stroke(),++u;break;default:++u}}O&&this.fill_(e),k&&e.stroke()}execute(e,t,n,r,i,a){this.viewRotation_=r,this.execute_(e,t,n,this.instructions,i,void 0,void 0,a)}executeHitDetection(e,t,n,r,i){return this.viewRotation_=n,this.execute_(e,[e.canvas.width,e.canvas.height],t,this.hitDetectionInstructions,!0,r,i)}},iy=[`Polygon`,`Circle`,`LineString`,`Image`,`Text`,`Default`],ay=[`Image`,`Text`],oy=iy.filter(e=>!ay.includes(e)),sy=!1,cy=!1;function ly(){let e=0,t=t=>{let n=Gf(1,1,null,{willReadFrequently:t}),r=0,i=performance.now();for(;performance.now()-i<50;++r)n.fillStyle=`rgba(255,0,${r%256},1)`,n.fillRect(0,0,1,1),n.getImageData(0,0,1,1);return e=r>e?r:e,r};sy={[t(!0)]:!0,[t(!1)]:!1,[t(void 0)]:void 0}[e],cy=!0}var uy=class{constructor(e,t,n,r,i,a,o){this.maxExtent_=e,this.overlaps_=r,this.pixelRatio_=n,this.resolution_=t,this.renderBuffer_=a,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=gd(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(i,!!o)}clip(e,t){let n=this.getClipCoords(t);e.beginPath(),e.moveTo(n[0],n[1]),e.lineTo(n[2],n[3]),e.lineTo(n[4],n[5]),e.lineTo(n[6],n[7]),e.clip()}createExecutors_(e,t){for(let n in e){let r=this.executorsByZIndex_[n];r===void 0&&(r={},this.executorsByZIndex_[n]=r);let i=e[n];for(let e in i){let n=i[e];r[e]=new ry(this.resolution_,this.pixelRatio_,this.overlaps_,n,t)}}}hasExecutors(e){for(let t in this.executorsByZIndex_){let n=this.executorsByZIndex_[t];for(let t=0,r=e.length;t<r;++t)if(e[t]in n)return!0}return!1}forEachFeatureAtCoordinate(e,t,n,r,i,a){cy===!1&&ly(),r=Math.round(r);let o=r*2+1,s=yd(this.hitDetectionTransform_,r+.5,r+.5,1/t,-1/t,-n,-e[0],-e[1]),c=!this.hitDetectionContext_;c&&(this.hitDetectionContext_=Gf(o,o,null,{willReadFrequently:sy}));let l=this.hitDetectionContext_;l.canvas.width!==o||l.canvas.height!==o?(l.canvas.width=o,l.canvas.height=o):c||l.clearRect(0,0,o,o);let u;this.renderBuffer_!==void 0&&(u=Yc(),nl(u,e),Hc(u,t*(this.renderBuffer_+r),u));let d=fy(r),f,p=l;function m(e,t,n){let s=p.getImageData(0,0,o,o).data;for(let c=0,l=d.length;c<l;c++)if(s[d[c]]>0){if(!a||n===`none`||f!==`Image`&&f!==`Text`||a.includes(e)){let n=(d[c]-3)/4,a=r-n%o,s=r-(n/o|0),l=i(e,t,a*a+s*s);if(l)return l}p.clearRect(0,0,o,o);break}}let h=Object.keys(this.executorsByZIndex_).map(Number);h.sort(Rs);let g,_,v,y,b;for(g=h.length-1;g>=0;--g){let e=h[g].toString();for(v=this.executorsByZIndex_[e],_=iy.length-1;_>=0;--_)if(f=iy[_],y=v[f],y!==void 0&&(b=y.executeHitDetection(l,s,n,m,u),b))return b}}getClipCoords(e){let t=this.maxExtent_;if(!t)return null;let n=t[0],r=t[1],i=t[2],a=t[3],o=[n,r,n,a,i,a,i,r];return Ed(o,0,8,2,e,o),o}isEmpty(){return Ps(this.executorsByZIndex_)}execute(e,t,n,r,i,a,o){let s=Object.keys(this.executorsByZIndex_).map(Number);s.sort(o?zs:Rs),a||=iy;let c=iy.length;for(let l=0,u=s.length;l<u;++l){let u=s[l].toString(),d=this.executorsByZIndex_[u];for(let u=0,f=a.length;u<f;++u){let f=a[u],p=d[f];if(p!==void 0){let a=o===null?void 0:p.getZIndexContext(),u=a?a.getContext():e,d=this.maxExtent_&&f!==`Image`&&f!==`Text`;if(d&&(u.save(),this.clip(u,n)),!a||f===`Text`||f===`Image`?p.execute(u,t,n,r,i,o):a.pushFunction(e=>p.execute(e,t,n,r,i,o)),d&&u.restore(),a){a.offset();let e=s[l]*c+iy.indexOf(f);this.deferredZIndexContexts_[e]||(this.deferredZIndexContexts_[e]=[]),this.deferredZIndexContexts_[e].push(a)}}}}this.renderedContext_=e}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){let e=this.deferredZIndexContexts_,t=Object.keys(e).map(Number).sort(Rs);for(let n=0,r=t.length;n<r;++n)e[t[n]].forEach(e=>{e.draw(this.renderedContext_),e.clear()}),e[t[n]].length=0}},dy={};function fy(e){if(dy[e]!==void 0)return dy[e];let t=e*2+1,n=e*e,r=Array(n+1);for(let i=0;i<=e;++i)for(let a=0;a<=e;++a){let o=i*i+a*a;if(o>n)break;let s=r[o];s||(s=[],r[o]=s),s.push(((e+i)*t+(e+a))*4+3),i>0&&s.push(((e-i)*t+(e+a))*4+3),a>0&&(s.push(((e+i)*t+(e-a))*4+3),i>0&&s.push(((e-i)*t+(e-a))*4+3))}let i=[];for(let e=0,t=r.length;e<t;++e)r[e]&&i.push(...r[e]);return dy[e]=i,i}var py=class extends Sv{constructor(e,t,n,r,i,a,o){super(),this.context_=e,this.pixelRatio_=t,this.extent_=n,this.transform_=r,this.transformRotation_=r?Pc(Math.atan2(r[1],r[0]),10):0,this.viewRotation_=i,this.squaredTolerance_=a,this.userTransform_=o,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_=``,this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=gd()}drawImages_(e,t,n,r){if(!this.image_)return;let i=Ed(e,t,n,r,this.transform_,this.pixelCoordinates_),a=this.context_,o=this.tmpLocalTransform_,s=a.globalAlpha;this.imageOpacity_!=1&&(a.globalAlpha=s*this.imageOpacity_);let c=this.imageRotation_;this.transformRotation_===0&&(c-=this.viewRotation_),this.imageRotateWithView_&&(c+=this.viewRotation_);for(let e=0,t=i.length;e<t;e+=2){let t=i[e]-this.imageAnchorX_,n=i[e+1]-this.imageAnchorY_;if(c!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){let e=t+this.imageAnchorX_,r=n+this.imageAnchorY_;yd(o,e,r,1,1,c,-e,-r),a.save(),a.transform.apply(a,o),a.translate(e,r),a.scale(this.imageScale_[0],this.imageScale_[1]),a.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),a.restore()}else a.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,t,n,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(a.globalAlpha=s)}drawText_(e,t,n,r){if(!this.textState_||this.text_===``)return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);let i=Ed(e,t,n,r,this.transform_,this.pixelCoordinates_),a=this.context_,o=this.textRotation_;for(this.transformRotation_===0&&(o-=this.viewRotation_),this.textRotateWithView_&&(o+=this.viewRotation_);t<n;t+=r){let e=i[t]+this.textOffsetX_,n=i[t+1]+this.textOffsetY_;o!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(a.save(),a.translate(e-this.textOffsetX_,n-this.textOffsetY_),a.rotate(o),a.translate(this.textOffsetX_,this.textOffsetY_),a.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&a.strokeText(this.text_,0,0),this.textFillState_&&a.fillText(this.text_,0,0),a.restore()):(this.textStrokeState_&&a.strokeText(this.text_,e,n),this.textFillState_&&a.fillText(this.text_,e,n))}}moveToLineTo_(e,t,n,r,i,a){let o=this.context_,s=a??0,c=Ed(e,t,n,r,this.transform_,this.pixelCoordinates_);if(Math.abs(s)>0){let e=c.length,t=i||Math.abs(c[0]-c[e-2])<1e-6&&Math.abs(c[1]-c[e-1])<1e-6;c=Vv(c,0,e,2,s,t,c),Uv(c,2,t)}o.moveTo(c[0],c[1]);let l=c.length;i&&(l-=2);for(let e=2;e<l;e+=2)o.lineTo(c[e],c[e+1]);return i&&o.closePath(),n}drawRings_(e,t,n,r,i){for(let a=0,o=n.length;a<o;++a)t=this.moveToLineTo_(e,t,n[a],r,!0,i);return t}drawCircle(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),vl(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=Id(e,this.transform_,this.pixelCoordinates_);if(!t)return;let n=t[2]-t[0],r=t[3]-t[1],i=Math.sqrt(n*n+r*r),a=this.context_;a.beginPath(),a.arc(t[0],t[1],i,0,2*Math.PI),this.fillState_&&a.fill(),this.strokeState_&&a.stroke()}this.text_!==``&&this.drawText_(e.getCenter(),0,2,2)}}setStyle(e){this.setFillStrokeStyle(e.getFill()??null,e.getStroke()??null),this.setImageStyle(e.getImage()??null),this.setTextStyle(e.getText()??null)}setTransform(e){this.transform_=e}drawGeometry(e){switch(e.getType()){case`Point`:this.drawPoint(e);break;case`LineString`:this.drawLineString(e);break;case`Polygon`:this.drawPolygon(e);break;case`MultiPoint`:this.drawMultiPoint(e);break;case`MultiLineString`:this.drawMultiLineString(e);break;case`MultiPolygon`:this.drawMultiPolygon(e);break;case`GeometryCollection`:this.drawGeometryCollection(e);break;case`Circle`:this.drawCircle(e)}}drawFeature(e,t){let n=t.getGeometryFunction()(e);n&&(this.setStyle(t),this.drawGeometry(n))}drawGeometryCollection(e){let t=e.getGeometriesArray();for(let e=0,n=t.length;e<n;++e)this.drawGeometry(t[e])}drawPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getFlatCoordinates(),n=e.getStride();this.image_&&this.drawImages_(t,0,t.length,n),this.text_!==``&&this.drawText_(t,0,t.length,n)}drawMultiPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getFlatCoordinates(),n=e.getStride();this.image_&&this.drawImages_(t,0,t.length,n),this.text_!==``&&this.drawText_(t,0,t.length,n)}drawLineString(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),vl(this.extent_,e.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let t=this.context_,n=e.getFlatCoordinates();t.beginPath(),this.moveToLineTo_(n,0,n.length,e.getStride(),!1,this.strokeState_.strokeOffset),t.stroke()}if(this.text_!==``){let t=e.getFlatMidpoint();this.drawText_(t,0,2,2)}}}drawMultiLineString(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getExtent();if(vl(this.extent_,t)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let t=this.context_,n=e.getFlatCoordinates(),r=0,i=e.getEnds(),a=e.getStride();t.beginPath();for(let e=0,t=i.length;e<t;++e)r=this.moveToLineTo_(n,r,i[e],a,!1,this.strokeState_.strokeOffset);t.stroke()}if(this.text_!==``){let t=e.getFlatMidpoints();this.drawText_(t,0,t.length,2)}}}drawPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),vl(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=this.context_;t.beginPath(),this.drawRings_(e.getOrientedFlatCoordinates(),0,e.getEnds(),e.getStride(),this.strokeState_?.strokeOffset),this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==``){let t=e.getFlatInteriorPoint();this.drawText_(t,0,2,2)}}}drawMultiPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),vl(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=this.context_,n=e.getOrientedFlatCoordinates(),r=0,i=e.getEndss(),a=e.getStride();t.beginPath();for(let e=0,t=i.length;e<t;++e){let t=i[e];r=this.drawRings_(n,r,t,a,this.strokeState_?.strokeOffset)}this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==``){let t=e.getFlatInteriorPoints();this.drawText_(t,0,t.length,2)}}}setContextFillState_(e){let t=this.context_,n=this.contextFillState_;n?n.fillStyle!=e.fillStyle&&(n.fillStyle=e.fillStyle,t.fillStyle=e.fillStyle):(t.fillStyle=e.fillStyle,this.contextFillState_={fillStyle:e.fillStyle})}setContextStrokeState_(e){let t=this.context_,n=this.contextStrokeState_;n?(n.lineCap!=e.lineCap&&(n.lineCap=e.lineCap,t.lineCap=e.lineCap),Us(n.lineDash,e.lineDash)||t.setLineDash(n.lineDash=e.lineDash),n.lineDashOffset!=e.lineDashOffset&&(n.lineDashOffset=e.lineDashOffset,t.lineDashOffset=e.lineDashOffset),n.lineJoin!=e.lineJoin&&(n.lineJoin=e.lineJoin,t.lineJoin=e.lineJoin),n.lineWidth!=e.lineWidth&&(n.lineWidth=e.lineWidth,t.lineWidth=e.lineWidth),n.miterLimit!=e.miterLimit&&(n.miterLimit=e.miterLimit,t.miterLimit=e.miterLimit),n.strokeStyle!=e.strokeStyle&&(n.strokeStyle=e.strokeStyle,t.strokeStyle=e.strokeStyle)):(t.lineCap=e.lineCap,t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset,t.lineJoin=e.lineJoin,t.lineWidth=e.lineWidth,t.miterLimit=e.miterLimit,t.strokeStyle=e.strokeStyle,this.contextStrokeState_={lineCap:e.lineCap,lineDash:e.lineDash,lineDashOffset:e.lineDashOffset,lineJoin:e.lineJoin,lineWidth:e.lineWidth,miterLimit:e.miterLimit,strokeStyle:e.strokeStyle})}setContextTextState_(e){let t=this.context_,n=this.contextTextState_,r=e.textAlign?e.textAlign:og;n?(n.font!=e.font&&(n.font=e.font,t.font=e.font),n.textAlign!=r&&(n.textAlign=r,t.textAlign=r),n.textBaseline!=e.textBaseline&&(n.textBaseline=e.textBaseline,t.textBaseline=e.textBaseline)):(t.font=e.font,t.textAlign=r,t.textBaseline=e.textBaseline,this.contextTextState_={font:e.font,textAlign:r,textBaseline:e.textBaseline})}setFillStrokeStyle(e,t){if(!e)this.fillState_=null;else{let t=e.getColor();this.fillState_={fillStyle:Qh(t||`#000`)||`#000`}}if(!t)this.strokeState_=null;else{let e=t.getColor(),n=t.getLineCap(),r=t.getLineDash(),i=t.getLineDashOffset(),a=t.getLineJoin(),o=t.getWidth(),s=t.getMiterLimit(),c=r||rg,l=t.getOffset();this.strokeState_={lineCap:n===void 0?ng:n,lineDash:this.pixelRatio_===1?c:c.map(e=>e*this.pixelRatio_),lineDashOffset:(i||0)*this.pixelRatio_,lineJoin:a===void 0?ig:a,lineWidth:(o===void 0?1:o)*this.pixelRatio_,miterLimit:s===void 0?10:s,strokeStyle:Qh(e||`#000`)||`#000`,strokeOffset:(l??0)*this.pixelRatio_}}}setImageStyle(e){let t;if(!e||!(t=e.getSize())){this.image_=null;return}let n=e.getPixelRatio(this.pixelRatio_),r=e.getAnchor(),i=e.getOrigin();if(!r||!i){this.image_=null;return}this.image_=e.getImage(this.pixelRatio_),this.imageAnchorX_=r[0]*n,this.imageAnchorY_=r[1]*n,this.imageHeight_=t[1]*n,this.imageOpacity_=e.getOpacity(),this.imageOriginX_=i[0],this.imageOriginY_=i[1],this.imageRotateWithView_=e.getRotateWithView(),this.imageRotation_=e.getRotation();let a=e.getScaleArray();this.imageScale_=[a[0]*this.pixelRatio_/n,a[1]*this.pixelRatio_/n],this.imageWidth_=t[0]*n}setTextStyle(e){if(!e)this.text_=``;else{let t=e.getFill();if(!t)this.textFillState_=null;else{let e=t.getColor();this.textFillState_={fillStyle:Qh(e||`#000`)||`#000`}}let n=e.getStroke();if(!n)this.textStrokeState_=null;else{let e=n.getColor(),t=n.getLineCap(),r=n.getLineDash(),i=n.getLineDashOffset(),a=n.getLineJoin(),o=n.getWidth(),s=n.getMiterLimit();this.textStrokeState_={lineCap:t===void 0?ng:t,lineDash:r||rg,lineDashOffset:i||0,lineJoin:a===void 0?ig:a,lineWidth:o===void 0?1:o,miterLimit:s===void 0?10:s,strokeStyle:Qh(e||`#000`)||`#000`}}let r=e.getFont(),i=e.getOffsetX(),a=e.getOffsetY(),o=e.getRotateWithView(),s=e.getRotation(),c=e.getScaleArray(),l=e.getText(),u=e.getTextAlign(),d=e.getTextBaseline();this.textState_={font:r===void 0?eg:r,textAlign:u===void 0?og:u,textBaseline:d===void 0?sg:d},this.text_=l===void 0?``:Array.isArray(l)?l.reduce((e,t,n)=>e+=n%2?` `:t,``):l,this.textOffsetX_=i===void 0?0:this.pixelRatio_*i,this.textOffsetY_=a===void 0?0:this.pixelRatio_*a,this.textRotateWithView_=o!==void 0&&o,this.textRotation_=s===void 0?0:s,this.textScale_=[this.pixelRatio_*c[0],this.pixelRatio_*c[1]]}}},my=.5;function hy(e,t,n,r,i,a,o,s,c){let l=c?ud(i,c):i,u=Gf(e[0]*my,e[1]*my);u.imageSmoothingEnabled=!1;let d=u.canvas,f=new py(u,my,i,[1,0,0,1,0,0],o,s??0,c?nd(sd(),c)??void 0:void 0),p=n.length,m=Math.floor(16777215/p),h={};for(let e=1;e<=p;++e){let t=n[e-1],i=t.getStyleFunction()||r;if(!i)continue;let o=i(t,a);if(!o)continue;Array.isArray(o)||(o=[o]);let s=(e*m).toString(16).padStart(7,`#00000`);for(let e=0,n=o.length;e<n;++e){let n=o[e],r=n.getGeometryFunction()(t);if(!r||!vl(l,r.getExtent()))continue;let i=n.clone(),a=i.getFill();a&&a.setColor(s);let c=i.getStroke();c&&(c.setColor(s),c.setLineDash(null)),i.setText(null);let u=n.getImage();if(u){let e=u.getImageSize();if(!e)continue;let t=Gf(e[0],e[1],void 0,{alpha:!1}),n=t.canvas;t.fillStyle=s,t.fillRect(0,0,n.width,n.height),i.setImage(new Og({img:n,anchor:u.getAnchor()??void 0,anchorXUnits:`pixels`,anchorYUnits:`pixels`,offset:u.getOrigin()??void 0,opacity:1,size:u.getSize()??void 0,scale:u.getScale(),rotation:u.getRotation(),rotateWithView:u.getRotateWithView()}))}let d=i.getZIndex()||0,f=h[d];f||(f={},h[d]=f,f.Polygon=[],f.Circle=[],f.LineString=[],f.Point=[]);let p=r.getType();if(p===`GeometryCollection`){let e=r.getGeometriesArrayRecursive();for(let t=0,n=e.length;t<n;++t){let n=e[t];f[n.getType().replace(`Multi`,``)].push(n,i)}}else f[p.replace(`Multi`,``)].push(r,i)}}let g=Object.keys(h).map(Number).sort(Rs);for(let e=0,n=g.length;e<n;++e){let n=h[g[e]];for(let e in n){let r=n[e];for(let e=0,n=r.length;e<n;e+=2){f.setStyle(r[e+1]);for(let n=0,i=t.length;n<i;++n)f.setTransform(t[n]),f.drawGeometry(r[e])}}}return u.getImageData(0,0,d.width,d.height)}function gy(e,t,n){let r=[];if(n){let i=Math.floor(Math.round(e[0])*my),a=Math.floor(Math.round(e[1])*my),o=(W(i,0,n.width-1)+W(a,0,n.height-1)*n.width)*4,s=n.data[o],c=n.data[o+1],l=n.data[o+2]+256*(c+256*s),u=Math.floor(16777215/t.length);l&&l%u===0&&r.push(t[l/u-1])}return r}var _y=.5,vy={Point:Ay,LineString:Dy,Polygon:My,MultiPoint:jy,MultiLineString:Oy,MultiPolygon:ky,GeometryCollection:Ey,Circle:Sy};function yy(e,t){return parseInt(V(e),10)-parseInt(V(t),10)}function by(e,t){let n=xy(e,t);return n*n}function xy(e,t){return _y*e/t}function Sy(e,t,n,r,i){let a=n.getFill(),o=n.getStroke();if(a||o){let s=e.getBuilder(n.getZIndex(),`Circle`);s.setFillStrokeStyle(a,o),s.drawCircle(t,r,i)}let s=n.getText();if(s&&s.getText()){let a=e.getBuilder(n.getZIndex(),`Text`);a.setTextStyle(s),a.drawText(t,r,i)}}function Cy(e,t,n,r,i,a,o,s){let c=[],l=n.getImage();if(l){let e=!0,t=l.getImageState();t==Q.LOADED||t==Q.ERROR?e=!1:t==Q.IDLE&&l.load(),e&&c.push(l.ready())}let u=n.getFill();u&&u.loading()&&c.push(u.ready());let d=c.length>0;return d&&Promise.all(c).then(()=>i(null)),wy(e,t,n,r,a,o,s),d}function wy(e,t,n,r,i,a,o){let s=n.getGeometryFunction()(t);if(!s)return;let c=s.simplifyTransformed(r,i);if(n.getRenderer())Ty(e,c,n,t,o);else{let r=vy[c.getType()];r(e,c,n,t,o,a)}}function Ty(e,t,n,r,i){if(t.getType()==`GeometryCollection`){let a=t.getGeometries();for(let t=0,o=a.length;t<o;++t)Ty(e,a[t],n,r,i)}else e.getBuilder(n.getZIndex(),`Default`).drawCustom(t,r,n.getRenderer(),n.getHitDetectionRenderer(),i)}function Ey(e,t,n,r,i,a){let o=t.getGeometriesArray(),s,c;for(s=0,c=o.length;s<c;++s){let t=vy[o[s].getType()];t(e,o[s],n,r,i,a)}}function Dy(e,t,n,r,i){let a=n.getStroke();if(a){let o=e.getBuilder(n.getZIndex(),`LineString`);o.setFillStrokeStyle(null,a),o.drawLineString(t,r,i)}let o=n.getText();if(o&&o.getText()){let a=e.getBuilder(n.getZIndex(),`Text`);a.setTextStyle(o),a.drawText(t,r,i)}}function Oy(e,t,n,r,i){let a=n.getStroke();if(a){let o=e.getBuilder(n.getZIndex(),`LineString`);o.setFillStrokeStyle(null,a),o.drawMultiLineString(t,r,i)}let o=n.getText();if(o&&o.getText()){let a=e.getBuilder(n.getZIndex(),`Text`);a.setTextStyle(o),a.drawText(t,r,i)}}function ky(e,t,n,r,i){let a=n.getFill(),o=n.getStroke();if(o||a){let s=e.getBuilder(n.getZIndex(),`Polygon`);s.setFillStrokeStyle(a,o),s.drawMultiPolygon(t,r,i)}let s=n.getText();if(s&&s.getText()){let a=e.getBuilder(n.getZIndex(),`Text`);a.setTextStyle(s),a.drawText(t,r,i)}}function Ay(e,t,n,r,i,a){let o=n.getImage(),s=n.getText(),c=s&&s.getText(),l=a&&o&&c?{}:void 0;if(o){if(o.getImageState()!=Q.LOADED)return;let a=e.getBuilder(n.getZIndex(),`Image`);a.setImageStyle(o,l),a.drawPoint(t,r,i)}if(c){let a=e.getBuilder(n.getZIndex(),`Text`);a.setTextStyle(s,l),a.drawText(t,r,i)}}function jy(e,t,n,r,i,a){let o=n.getImage(),s=o&&o.getOpacity()!==0,c=n.getText(),l=c&&c.getText(),u=a&&s&&l?{}:void 0;if(s){if(o.getImageState()!=Q.LOADED)return;let a=e.getBuilder(n.getZIndex(),`Image`);a.setImageStyle(o,u),a.drawMultiPoint(t,r,i)}if(l){let a=e.getBuilder(n.getZIndex(),`Text`);a.setTextStyle(c,u),a.drawText(t,r,i)}}function My(e,t,n,r,i){let a=n.getFill(),o=n.getStroke();if(a||o){let s=e.getBuilder(n.getZIndex(),`Polygon`);s.setFillStrokeStyle(a,o),s.drawPolygon(t,r,i)}let s=n.getText();if(s&&s.getText()){let a=e.getBuilder(n.getZIndex(),`Text`);a.setTextStyle(s),a.drawText(t,r,i)}}var Ny=class extends mv{constructor(e,t){super(e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipExtent_=null,this.extendX_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=Yc(),this.wrappedRenderedExtent_=Yc(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1,t?.wantRotation!==void 0&&(this.wantRotation=t.wantRotation)}renderWorlds(e,t,n){let r=t.extent,i=t.viewState,a=i.center,o=i.resolution,s=i.projection,c=i.rotation,l=s.getExtent(),u=this.getLayer().getSource(),d=this.getLayer().getDeclutter(),f=t.pixelRatio,p=t.viewHints,m=!(p[Tc.ANIMATING]||p[Tc.INTERACTING]),h=this.context,g=h.canvas.width,_=h.canvas.height,v=u.getWrapX()&&s.canWrapX(),y=v?G(l):null,b=r,x=v?Math.ceil((b[2]-l[2])/y)+(this.extendX_?2:1):1,S=v?Math.floor((b[0]-l[0])/y)-+!!this.extendX_:0;do{let r=this.getRenderTransform(a,o,this.sourceRotates()?c:0,f,g,_,S*y);t.declutter&&(r=r.slice(0)),e.execute(h,[h.canvas.width,h.canvas.height],r,c,m,n===void 0?iy:n?ay:oy,n?d&&t.declutter[d]:void 0)}while(++S<x)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=Gf(this.context.canvas.width,this.context.canvas.height,dv))}resetDrawContext_(){if(this.opacity_!==1&&this.targetContext_){let e=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=e,Jf(this.context),dv.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(e){this.replayGroup_&&this.getLayer().getDeclutter()&&this.renderWorlds(this.replayGroup_,e,!0)}renderDeferredInternal(e){this.replayGroup_&&(this.clipExtent_&&this.clipUnrotated(this.context,e,this.clipExtent_),this.replayGroup_.renderDeferred(),this.clipExtent_&&=(this.context.restore(),null),this.resetDrawContext_())}renderFrame(e,t){let n=e.layerStatesArray[e.layerIndex];this.opacity_=n.opacity;let r=e.viewState;this.prepareContainer(e,t);let i=this.context,a=this.replayGroup_,o=a&&!a.isEmpty();if(!o&&!(this.getLayer().hasListener(qp.PRERENDER)||this.getLayer().hasListener(qp.POSTRENDER)))return this.container;this.setDrawContext_(),this.preRender(i,e);let s=r.projection;this.clipExtent_=null;let c=!1;if(o&&n.extent&&this.clipping){let t=dd(n.extent,s);o=vl(t,e.extent),o&&!Kc(t,e.extent)&&(e.declutter?this.clipExtent_=t:(this.clipUnrotated(i,e,t),c=!0))}return o&&this.renderWorlds(a,e,!this.getLayer().getDeclutter()&&void 0),c&&i.restore(),this.postRender(i,e),this.renderedRotation_!==r.rotation&&(this.renderedRotation_=r.rotation,this.hitDetectionImageData_=null),e.declutter||this.resetDrawContext_(),this.container}getFeatures(e){return new Promise(t=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){let e=this.frameState.size.slice(),t=this.renderedCenter_,n=this.renderedResolution_,r=this.renderedRotation_,i=this.renderedProjection_,a=this.wrappedRenderedExtent_,o=this.getLayer(),s=[],c=e[0]*my,l=e[1]*my;s.push(this.getRenderTransform(t,n,r,my,c,l,0).slice());let u=o.getSource(),d=i.getExtent();if(u.getWrapX()&&i.canWrapX()&&!Kc(d,a)){let e=a[0],i=G(d),o=0,u;for(;e<d[0];)--o,u=i*o,s.push(this.getRenderTransform(t,n,r,my,c,l,u).slice()),e+=i;for(o=0,e=a[2];e>d[2];)++o,u=i*o,s.push(this.getRenderTransform(t,n,r,my,c,l,u).slice()),e-=i}let f=sd();this.hitDetectionImageData_=hy(e,s,this.renderedFeatures_,o.getStyleFunction(),a,n,r,by(n,this.renderedPixelRatio_),f?i:null)}t(gy(e,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(e,t,n,r,i){if(!this.replayGroup_)return;let a=t.viewState.resolution,o=t.viewState.rotation,s=this.getLayer(),c={},l=function(e,t,n){let a=V(e),o=c[a];if(!o){if(n===0)return c[a]=!0,r(e,s,t);i.push(c[a]={feature:e,layer:s,geometry:t,distanceSq:n,callback:r})}else if(o!==!0&&n<o.distanceSq){if(n===0)return c[a]=!0,i.splice(i.lastIndexOf(o),1),r(e,s,t);o.geometry=t,o.distanceSq=n}},u=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(e,a,o,n,l,u?t.declutter?.[u]?.all().map(e=>e.value):null)}handleFontsChanged(){let e=this.getLayer();e.getVisible()&&this.replayGroup_&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}prepareFrame(e){let t=this.getLayer(),n=t.getSource();if(!n)return!1;let r=e.viewHints[Tc.ANIMATING],i=e.viewHints[Tc.INTERACTING],a=t.getUpdateWhileAnimating(),o=t.getUpdateWhileInteracting();if(this.ready&&!a&&r||!o&&i)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;let s=e.extent,c=e.viewState,l=c.projection,u=c.resolution,d=e.pixelRatio,f=t.getRevision(),p=t.getRenderBuffer(),m=t.getRenderOrder();m===void 0&&(m=yy);let h=c.center.slice(),g=Hc(s,p*u),_=g.slice(),v=[g.slice()],y=l.getExtent(),b=n.getWrapX()&&l.canWrapX();if(this.extendX_=!1,b){let e=n.getExtent();e&&!yl(e)&&(this.extendX_=e[0]<y[0]||e[2]>y[2])}if(b&&(!Kc(y,e.extent)||this.extendX_)){let e=G(y),t=Math.max(G(g)/2,e),n=y[0],r=y[2];this.extendX_&&(n-=e,r+=e),g[0]=n-t,g[2]=r+t,kl(h,l);let i=Sl(v[0],l);i[0]<y[0]&&i[2]<y[2]?v.push([i[0]+e,i[1],i[2]+e,i[3]]):i[0]>y[0]&&i[2]>y[2]&&v.push([i[0]-e,i[1],i[2]-e,i[3]])}if(this.ready&&this.renderedResolution_==u&&this.renderedPixelRatio_===d&&this.renderedRevision_==f&&this.renderedRenderOrder_==m&&this.renderedFrameDeclutter_===!!e.declutter&&Kc(this.wrappedRenderedExtent_,g))return Us(this.renderedExtent_,_)||(this.hitDetectionImageData_=null,this.renderedExtent_=_),this.renderedCenter_=h,this.replayGroupChanged=!1,!0;this.replayGroup_=null;let x=new zv(xy(u,d),g,u,d),S=sd(),C;if(S){for(let e=0,t=v.length;e<t;++e){let t=v[e],r=ud(t,l);n.loadFeatures(r,fd(u,l),S)}C=nd(S,l)}else for(let e=0,t=v.length;e<t;++e)n.loadFeatures(v[e],u,l);let w=by(u,d),T=!0,E=(e,n)=>{let r,i=e.getStyleFunction()||t.getStyleFunction();if(i&&(r=i(e,u)),r){let t=this.renderFeature(e,w,r,x,C,this.getLayer().getDeclutter(),n);T&&=!t}},D=ud(g,l),O=n.getFeaturesInExtent(D);m&&O.sort(m);for(let e=0,t=O.length;e<t;++e)E(O[e],e);this.renderedFeatures_=O,this.ready=T;let k=x.finish(),A=new uy(g,u,d,n.getOverlaps(),k,t.getRenderBuffer(),!!e.declutter);return this.renderedResolution_=u,this.renderedRevision_=f,this.renderedRenderOrder_=m,this.renderedFrameDeclutter_=!!e.declutter,this.renderedExtent_=_,this.wrappedRenderedExtent_=g,this.renderedCenter_=h,this.renderedProjection_=l,this.renderedPixelRatio_=d,this.replayGroup_=A,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(e,t,n,r,i,a,o){if(!n)return!1;let s=!1;if(Array.isArray(n))for(let c=0,l=n.length;c<l;++c)s=Cy(r,e,n[c],t,this.boundHandleStyleImageChange_,i,a,o)||s;else s=Cy(r,e,n,t,this.boundHandleStyleImageChange_,i,a,o);return s}},Py=class extends b_{constructor(e){super(e)}createRenderer(){return new Ny(this)}};function Fy(e){let t=Object.keys(e.defs),n=t.length,r,i;for(r=0;r<n;++r){let n=t[r];if(!iu(n)){let t=e.defs(n),r=t.units;!r&&t.projName===`longlat`&&(r=`degrees`),Ku(new Hl({code:n,axisOrientation:t.axis,metersPerUnit:t.to_meter,units:r}))}}for(r=0;r<n;++r){let a=t[r],o=iu(a);for(i=0;i<n;++i){let n=t[i],r=iu(n);if(o&&r&&!cu(a,n)){if(e.defs(a)===e.defs(n))Xu([o,r]);else{let t=e(a,n);ed(o,r,pd(o,r,t.forward),pd(r,o,t.inverse))}}}}}var Iy=[0,0,0],Ly=5,Ry=class{constructor(e){let t=e.minZoom,n=e.resolutions;t===void 0&&n&&(t=n.findIndex(e=>e!==void 0)),this.minZoom=t===void 0?0:t,this.resolutions_=n,U(Ws(this.resolutions_,(e,t)=>t-e,!0),"`resolutions` must be sorted in descending order");let r;if(!e.origins){for(let e=0,t=this.resolutions_.length-1;e<t;++e)if(!r)r=this.resolutions_[e]/this.resolutions_[e+1];else if(this.resolutions_[e]/this.resolutions_[e+1]!==r){r=void 0;break}}this.zoomFactor_=r,this.maxZoom=this.resolutions_.length-1,this.origin_=e.origin===void 0?null:e.origin,this.origins_=null,e.origins!==void 0&&(this.origins_=e.origins,U(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));let i=e.extent;i!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=gl(i)),U(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,e.tileSizes!==void 0&&(this.tileSizes_=e.tileSizes,U(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=e.tileSize===void 0?this.tileSizes_?null:256:e.tileSize,U(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=i===void 0?null:i,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],e.tileRanges===void 0?e.sizes===void 0?i&&this.calculateTileRanges_(i):this.fullTileRanges_=e.sizes.map((e,t)=>{let n=new B_(Math.min(0,e[0]),Math.max(e[0]-1,-1),Math.min(0,e[1]),Math.max(e[1]-1,-1));if(i){let e=this.getTileRangeForExtentAndZ(i,t);n.minX=Math.max(e.minX,n.minX),n.maxX=Math.min(e.maxX,n.maxX),n.minY=Math.max(e.minY,n.minY),n.maxY=Math.min(e.maxY,n.maxY)}return n}):this.fullTileRanges_=e.tileRanges}forEachTileCoord(e,t,n){let r=this.getTileRangeForExtentAndZ(e,t);for(let e=r.minX,i=r.maxX;e<=i;++e)for(let i=r.minY,a=r.maxY;i<=a;++i)n([t,e,i])}forEachTileCoordParentTileRange(e,t,n,r){let i,a,o,s=null,c=e[0]-1;for(this.zoomFactor_===2?(a=e[1],o=e[2]):s=this.getTileCoordExtent(e,r);c>=this.minZoom;){if(a!==void 0&&o!==void 0?(a=Math.floor(a/2),o=Math.floor(o/2),i=V_(a,a,o,o,n)):i=this.getTileRangeForExtentAndZ(s,c,n),t(c,i))return!0;--c}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(e){return this.origin_?this.origin_:this.origins_?this.origins_[e]:[0,0]}getOrigins(){return this.origins_}getResolution(e){return this.resolutions_[e]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(e,t,n){if(e[0]<this.maxZoom){if(this.zoomFactor_===2){let n=e[1]*2,r=e[2]*2;return V_(n,n+1,r,r+1,t)}let r=this.getTileCoordExtent(e,n||this.tmpExtent_);return this.getTileRangeForExtentAndZ(r,e[0]+1,t)}return null}getTileRangeForTileCoordAndZ(e,t,n){if(t>this.maxZoom||t<this.minZoom)return null;let r=e[0],i=e[1],a=e[2];if(t===r)return V_(i,i,a,a,n);if(this.zoomFactor_){let e=this.zoomFactor_**+(t-r),o=Math.floor(i*e),s=Math.floor(a*e);return t<r?V_(o,o,s,s,n):V_(o,Math.floor(e*(i+1))-1,s,Math.floor(e*(a+1))-1,n)}let o=this.getTileCoordExtent(e,this.tmpExtent_);return this.getTileRangeForExtentAndZ(o,t,n)}getTileRangeForExtentAndZ(e,t,n){this.getTileCoordForXYAndZ_(e[0],e[3],t,!1,Iy);let r=Iy[1],i=Iy[2];this.getTileCoordForXYAndZ_(e[2],e[1],t,!0,Iy);let a=Iy[1],o=Iy[2];return V_(r,a,i,o,n)}getTileCoordCenter(e){let t=this.getOrigin(e[0]),n=this.getResolution(e[0]),r=Bm(this.getTileSize(e[0]),this.tmpSize_);return[t[0]+(e[1]+.5)*r[0]*n,t[1]-(e[2]+.5)*r[1]*n]}getTileCoordExtent(e,t){let n=this.getOrigin(e[0]),r=this.getResolution(e[0]),i=Bm(this.getTileSize(e[0]),this.tmpSize_),a=n[0]+e[1]*i[0]*r,o=n[1]-(e[2]+1)*i[1]*r;return Xc(a,o,a+i[0]*r,o+i[1]*r,t)}getTileCoordForCoordAndResolution(e,t,n){return this.getTileCoordForXYAndResolution_(e[0],e[1],t,!1,n)}getTileCoordForXYAndResolution_(e,t,n,r,i){let a=this.getZForResolution(n),o=n/this.getResolution(a),s=this.getOrigin(a),c=Bm(this.getTileSize(a),this.tmpSize_),l=o*(e-s[0])/n/c[0],u=o*(s[1]-t)/n/c[1];return r?(l=Ic(l,Ly)-1,u=Ic(u,Ly)-1):(l=Fc(l,Ly),u=Fc(u,Ly)),nv(a,l,u,i)}getTileCoordForXYAndZ_(e,t,n,r,i){let a=this.getOrigin(n),o=this.getResolution(n),s=Bm(this.getTileSize(n),this.tmpSize_),c=(e-a[0])/o/s[0],l=(a[1]-t)/o/s[1];return r?(c=Ic(c,Ly)-1,l=Ic(l,Ly)-1):(c=Fc(c,Ly),l=Fc(l,Ly)),nv(n,c,l,i)}getTileCoordForCoordAndZ(e,t,n){return this.getTileCoordForXYAndZ_(e[0],e[1],t,!1,n)}getTileCoordResolution(e){return this.resolutions_[e[0]]}getTileSize(e){return this.tileSize_?this.tileSize_:this.tileSizes_?this.tileSizes_[e]:256}getFullTileRange(e){return this.fullTileRanges_?this.fullTileRanges_[e]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,e):null}getZForResolution(e,t){return W(Bs(this.resolutions_,e,t||0),this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(e,t){return tf(t,0,t.length,2,this.getTileCoordExtent(e))}calculateTileRanges_(e){let t=this.resolutions_.length,n=Array(t);for(let r=this.minZoom;r<t;++r)n[r]=this.getTileRangeForExtentAndZ(e,r);this.fullTileRanges_=n}};function zy(e){let t=e.getDefaultTileGrid();return t||(t=Wy(e),e.setDefaultTileGrid(t)),t}function By(e,t,n){let r=t[0],i=e.getTileCoordCenter(t),a=Gy(n);if(!Gc(a,i)){let t=G(a),n=Math.ceil((a[0]-i[0])/t);return i[0]+=t*n,e.getTileCoordForCoordAndZ(i,r)}return t}function Vy(e,t,n,r){r=r===void 0?`top-left`:r;let i=Uy(e,t,n);return new Ry({extent:e,origin:ul(e,r),resolutions:i,tileSize:n})}function Hy(e){let t=e||{},n=t.extent||Ju(`EPSG:3857`)?.getExtent();if(!n)throw Error(`Unable to determine extent for XYZ tile grid`);return new Ry({extent:n,minZoom:t.minZoom,tileSize:t.tileSize,resolutions:Uy(n,t.maxZoom,t.tileSize,t.maxResolution)})}function Uy(e,t,n,r){t=t===void 0?42:t,n=Bm(n===void 0?256:n);let i=pl(e),a=G(e);r=r!==void 0&&r>0?r:Math.max(a/n[0],i/n[1]);let o=t+1,s=Array(o);for(let e=0;e<o;++e)s[e]=r/2**e;return s}function Wy(e,t,n,r){return Vy(Gy(e),t,n,r)}function Gy(e){let t=Ju(e);if(!t)throw Error(`Unable to determine extent from unknown projection`);let n=t.getExtent();if(!n){let e=t.getMetersPerUnit();if(e===void 0)throw Error(`Unable to determine extent from projection without units`);let r=180*Vl.degrees/e;n=Xc(-r,-r,r,r)}return n}var Ky=/\{z\}/g,qy=/\{x\}/g,Jy=/\{y\}/g,Yy=/\{-y\}/g;function Xy(e,t,n,r,i){return e.replace(Ky,t.toString()).replace(qy,n.toString()).replace(Jy,r.toString()).replace(Yy,function(){if(i===void 0)throw Error(`If the URL template has a {-y} placeholder, the grid extent must be known`);return(i-r).toString()})}function Zy(e){let t=[],n=/\{([a-z])-([a-z])\}/.exec(e);if(n){let r=n[1].charCodeAt(0),i=n[2].charCodeAt(0),a;for(a=r;a<=i;++a)t.push(e.replace(n[0],String.fromCharCode(a)));return t}if(n=/\{(\d+)-(\d+)\}/.exec(e),n){let r=parseInt(n[2],10);for(let i=parseInt(n[1],10);i<=r;i++)t.push(e.replace(n[0],i.toString()));return t}return t.push(e),t}function Qy(e,t){return(function(n,r,i){if(!n)return;let a,o=n[0];if(t){let e=t.getFullTileRange(o);e&&(a=e.getHeight()-1)}return Xy(e,o,n[1],n[2],a)})}function $y(e,t){let n=e.length,r=Array(n);for(let i=0;i<n;++i)r[i]=Qy(e[i],t);return eb(r)}function eb(e){return e.length===1?e[0]:(function(t,n,r){return t?e[Mc(av(t),e.length)](t,n,r):void 0})}var tb=class extends rc{constructor(e){super(),this.projection=Ju(e.projection),this.attributions_=nb(e.attributions),this.attributionsCollapsible_=e.attributionsCollapsible??!0,this.loading=!1,this.canRotate=!1,this.state_=e.state===void 0?`ready`:e.state,this.wrapX_=e.wrapX!==void 0&&e.wrapX,this.interpolate_=!!e.interpolate,this.viewResolver=null,this.viewRejector=null;let t=this;this.viewPromise_=new Promise(function(e,n){t.viewResolver=e,t.viewRejector=n})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(e){return null}getView(){return this.viewPromise_}ready(){let e=this.getState();return e===`ready`?Promise.resolve():e===`error`?Promise.reject(Error(`Source failed to load`)):new Promise((e,t)=>{let n=()=>{let r=this.getState();r===`ready`?(this.un(`change`,n),e()):r===`error`&&(this.un(`change`,n),t(Error(`Source failed to load`)))};this.on(`change`,n)})}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(e){this.attributions_=nb(e),this.changed()}setState(e){this.state_=e,this.changed()}};function nb(e){return e?typeof e==`function`?e:(Array.isArray(e)||(e=[e]),t=>e):null}var rb=class extends tb{constructor(e){super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,projection:e.projection,state:e.state,wrapX:e.wrapX,interpolate:e.interpolate}),this.on,this.once,this.un,this.tilePixelRatio_=e.tilePixelRatio===void 0?1:e.tilePixelRatio,this.tileGrid=e.tileGrid===void 0?null:e.tileGrid,this.tileGrid&&Bm(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),[256,256]),this.tmpSize=[0,0],this.key_=e.key||V(this),this.tileOptions={transition:e.transition,interpolate:e.interpolate},this.zDirection=e.zDirection?e.zDirection:0}getGutterForProjection(e){return 0}getKey(){return this.key_}setKey(e){this.key_!==e&&(this.key_=e,this.changed())}getResolutions(e){let t=e?this.getTileGridForProjection(e):this.tileGrid;return t?t.getResolutions():null}getTile(e,t,n,r,i,a){return B()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:zy(e)}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,t,n){let r=this.getTileGridForProjection(n),i=this.getTilePixelRatio(t),a=Bm(r.getTileSize(e),this.tmpSize);return i==1?a:zm(a,i,this.tmpSize)}getTileCoordForTileUrlFunction(e,t){let n=t===void 0?this.getProjection():t,r=t===void 0&&this.tileGrid||this.getTileGridForProjection(n);return this.getWrapX()&&n.isGlobal()&&(e=By(r,e,n)),sv(e,r)?e:null}clear(){}refresh(){this.clear(),super.refresh()}},ib=class extends Qs{constructor(e,t){super(e),this.tile=t}},ab={TILELOADSTART:`tileloadstart`,TILELOADEND:`tileloadend`,TILELOADERROR:`tileloaderror`},ob=class e extends rb{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tilePixelRatio:t.tilePixelRatio,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===e.prototype.tileUrlFunction,this.tileLoadFunction=t.tileLoadFunction,t.tileUrlFunction&&(this.tileUrlFunction=t.tileUrlFunction),this.urls=null,t.urls?this.setUrls(t.urls):t.url&&this.setUrl(t.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(e){let t=e.target,n=V(t),r=t.getState(),i;r==H.LOADING?(this.tileLoadingKeys_[n]=!0,i=ab.TILELOADSTART):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],i=r==H.ERROR?ab.TILELOADERROR:r==H.LOADED?ab.TILELOADEND:void 0),i!=null&&this.dispatchEvent(new ib(i,t))}setTileLoadFunction(e){this.tileLoadFunction=e,this.changed()}setTileUrlFunction(e,t){this.tileUrlFunction=e,t===void 0?this.changed():this.setKey(t)}setUrl(e){let t=Zy(e);this.urls=t,this.setUrls(t)}setUrls(e){this.urls=e;let t=e.join(`
`);this.generateTileUrlFunction_?this.setTileUrlFunction($y(e,this.tileGrid),t):this.setKey(t)}tileUrlFunction(e,t,n){}},sb=class extends ob{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:cb,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate===void 0||e.interpolate,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.crossOrigin=e.crossOrigin===void 0?null:e.crossOrigin,this.referrerPolicy=e.referrerPolicy,this.tileClass=e.tileClass===void 0?R_:e.tileClass,this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(e){let t=this.getProjection();return t&&e&&!td(t,e)?0:this.getGutter()}getGutter(){return 0}getKey(){let e=super.getKey();return this.getInterpolate()||(e+=`:disable-interpolation`),e}getTileGridForProjection(e){let t=this.getProjection();if(this.tileGrid&&(!t||td(t,e)))return this.tileGrid;let n=V(e);return n in this.tileGridForProjection||(this.tileGridForProjection[n]=zy(e)),this.tileGridForProjection[n]}createTile_(e,t,n,r,i,a){let o=[e,t,n],s=this.getTileCoordForTileUrlFunction(o,i),c=s?this.tileUrlFunction(s,r,i):void 0,l=new this.tileClass(o,c===void 0?H.EMPTY:H.IDLE,c===void 0?``:c,{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return l.key=a,l.addEventListener(z.CHANGE,this.handleTileChange.bind(this)),l}getTile(e,t,n,r,i,a){let o=this.getProjection();if(!o||!i||td(o,i))return this.getTileInternal(e,t,n,r,o||i);let s=[e,t,n],c=this.getKey(),l=new ev(o,this.getTileGridForProjection(o),i,this.getTileGridForProjection(i),s,this.getTileCoordForTileUrlFunction(s,i)||s,this.getTilePixelRatio(r),this.getGutter(),(e,t,n,r)=>this.getTileInternal(e,t,n,r,o,a),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return l.key=c,l}getTileInternal(e,t,n,r,i,a){let o=this.getKey(),s=iv(this,o,e,t,n);if(a&&a.containsKey(s))return a.get(s);let c=this.createTile_(e,t,n,r,i,o);return a?.set(s,c),c}setRenderReprojectionEdges(e){this.renderReprojectionEdges_!=e&&(this.renderReprojectionEdges_=e,this.changed())}setTileGridForProjection(e,t){let n=Ju(e);if(n){let e=V(n);e in this.tileGridForProjection||(this.tileGridForProjection[e]=t)}}};function cb(e,t){if(mc){let n=e.getCrossOrigin(),r=`same-origin`,i=`same-origin`;n===`anonymous`||n===``?(r=`cors`,i=`omit`):n===`use-credentials`&&(r=`cors`,i=`include`);let a={mode:r,credentials:i,referrerPolicy:e.getReferrerPolicy()};fetch(t,a).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.blob()}).then(e=>createImageBitmap(e)).then(t=>{let n=e.getImage();if(!n)return;n.width=t.width,n.height=t.height;let r=n.getContext(`2d`);r&&(r.drawImage(t,0,0),t.close?.(),n.dispatchEvent(new Event(`load`)))}).catch(()=>{e.getImage()?.dispatchEvent(new Event(`error`))})}else e.getImage().src=t}var lb=class extends sb{constructor(e){e||={};let t=e.projection===void 0?`EPSG:3857`:e.projection,n=e.tileGrid===void 0?Hy({extent:Gy(t),maxResolution:e.maxResolution,maxZoom:e.maxZoom,minZoom:e.minZoom,tileSize:e.tileSize}):e.tileGrid;super({attributions:e.attributions,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,referrerPolicy:e.referrerPolicy,interpolate:e.interpolate,projection:t,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileGrid:n,tileLoadFunction:e.tileLoadFunction,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX===void 0||e.wrapX,transition:e.transition,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.gutter_=e.gutter===void 0?0:e.gutter}getGutter(){return this.gutter_}},ub=!1;function db(e,t,n,r,i,a,o){let s=new XMLHttpRequest;s.open(`GET`,typeof e==`function`?e(n,r,i):e,!0),t.getType()==`arraybuffer`&&(s.responseType=`arraybuffer`),s.withCredentials=ub,s.onload=function(e){if(!s.status||s.status>=200&&s.status<300){let e=t.getType();try{let r;e==`text`||e==`json`?r=s.responseText:e==`xml`?r=s.responseXML||s.responseText:e==`arraybuffer`&&(r=s.response),r?a(t.readFeatures(r,{extent:n,featureProjection:i}),t.readProjection(r)):o()}catch{o()}}else o()},s.onerror=o,s.send()}function fb(e,t){return function(n,r,i,a,o){db(e,t,n,r,i,(e,t)=>{this.addFeatures(e),a!==void 0&&a(e)},()=>{this.changed(),o!==void 0&&o()})}}function pb(e,t){return[[-1/0,-1/0,1/0,1/0]]}function mb(e,t,n,r,i,a,o){let s,c,l=(n-t)/r;if(l===1)s=t;else if(l===2)s=t,c=i;else if(l!==0){let a=e[t],o=e[t+1],l=0,u=[0];for(let i=t+r;i<n;i+=r){let t=e[i],n=e[i+1];l+=Math.sqrt((t-a)*(t-a)+(n-o)*(n-o)),u.push(l),a=t,o=n}let d=i*l,f=Ls(u,d);f<0?(c=(d-u[-f-2])/(u[-f-1]-u[-f-2]),s=t+(-f-2)*r):s=t+f*r}o=o!==void 0&&o>1?o:2,a||=Array(o);for(let t=0;t<o;++t)a[t]=s===void 0?NaN:c===void 0?e[s+t]:Nc(e[s+t],e[s+r+t],c);return a}function hb(e,t,n,r){let i=[],a=Yc();for(let o=0,s=n.length;o<s;++o){let s=n[o];a=$c(e,t,s[0],r),i.push((a[0]+a[2])/2,(a[1]+a[3])/2),t=s[s.length-1]}return i}var gb=gd(),_b=class e{constructor(e,t,n,r,i,a){this.styleFunction,this.extent_,this.id_=a,this.type_=e,this.flatCoordinates_=t,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=n||null,this.properties_=i,this.squaredTolerance_,this.stride_=r,this.simplifiedGeometry_}get(e){return this.properties_[e]}getExtent(){return this.extent_||=this.type_===`Point`?Qc(this.flatCoordinates_):$c(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){let e=ll(this.getExtent());this.flatInteriorPoints_=df(this.flatCoordinates_,0,this.ends_,this.stride_,e,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){let e=_f(this.flatCoordinates_,this.ends_),t=hb(this.flatCoordinates_,0,e,this.stride_);this.flatInteriorPoints_=ff(this.flatCoordinates_,0,e,this.stride_,t)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||=mb(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,.5),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];let e=this.flatCoordinates_,t=0,n=this.ends_;for(let r=0,i=n.length;r<i;++r){let i=n[r],a=mb(e,t,i,this.stride_,.5);Hs(this.flatMidpoints_,a),t=i}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(e){return this}simplifyTransformed(e,t){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(e){e=Ju(e);let t=e.getExtent(),n=e.getWorldExtent();if(t&&n){let e=pl(n)/pl(t);yd(gb,n[0],n[3],e,-e,0,0,0),Ed(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,gb,this.flatCoordinates_)}}applyTransform(e){e(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new e(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=Xs((t,n)=>{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),n&&this.simplifiedGeometry_.applyTransform(n);let r=this.simplifiedGeometry_.getFlatCoordinates(),i;switch(this.type_){case`LineString`:r.length=rf(r,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,r,0),i=[r.length];break;case`MultiLineString`:i=[],r.length=af(r,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,r,0,i);break;case`Polygon`:i=[],r.length=cf(r,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),r,0,i)}return i&&(this.simplifiedGeometry_=new e(this.type_,r,i,this.stride_,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}};_b.prototype.getFlatCoordinates=_b.prototype.getOrientedFlatCoordinates;var vb=class{constructor(e){this.rbush_=new $p(e),this.items_={}}insert(e,t){let n={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3],value:t};this.rbush_.insert(n),this.items_[V(t)]=n}load(e,t){let n=Array(t.length);for(let r=0,i=t.length;r<i;r++){let i=e[r],a=t[r],o={minX:i[0],minY:i[1],maxX:i[2],maxY:i[3],value:a};n[r]=o,this.items_[V(a)]=o}this.rbush_.load(n)}remove(e){let t=V(e),n=this.items_[t];return delete this.items_[t],this.rbush_.remove(n)!==null}update(e,t){let n=this.items_[V(t)];el([n.minX,n.minY,n.maxX,n.maxY],e)||(this.remove(t),this.insert(e,t))}getAll(){return this.rbush_.all().map(function(e){return e.value})}getInExtent(e){let t={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]};return this.rbush_.search(t).map(function(e){return e.value})}forEach(e){return this.forEach_(this.getAll(),e)}forEachInExtent(e,t){return this.forEach_(this.getInExtent(e),t)}forEach_(e,t){let n;for(let r=0,i=e.length;r<i;r++)if(n=t(e[r]),n)return n;return n}isEmpty(){return Ps(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){let t=this.rbush_.toJSON();return Xc(t.minX,t.minY,t.maxX,t.maxY,e)}concat(e){this.rbush_.load(e.rbush_.all());for(let t in e.items_)this.items_[t]=e.items_[t]}},yb={ADDFEATURE:`addfeature`,CHANGEFEATURE:`changefeature`,CLEAR:`clear`,REMOVEFEATURE:`removefeature`,FEATURESLOADSTART:`featuresloadstart`,FEATURESLOADEND:`featuresloadend`,FEATURESLOADERROR:`featuresloaderror`},bb=class extends Qs{constructor(e,t,n){super(e),this.feature=t,this.features=n}},xb=class extends tb{constructor(e){e||={},super({attributions:e.attributions,interpolate:!0,projection:void 0,state:`ready`,wrapX:e.wrapX===void 0||e.wrapX}),this.canRotate=!0,this.on,this.once,this.un,this.loader_=Ys,this.format_=e.format||null,this.overlaps_=e.overlaps===void 0||e.overlaps,this.url_=e.url,e.loader===void 0?this.url_!==void 0&&(U(this.format_,"`format` must be set when `url` is set"),this.loader_=fb(this.url_,this.format_)):this.loader_=e.loader,this.strategy_=e.strategy===void 0?pb:e.strategy;let t=e.useSpatialIndex===void 0||e.useSpatialIndex;this.featuresRtree_=t?new vb:null,this.loadedExtentsRtree_=new vb,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let n,r;Array.isArray(e.features)?r=e.features:e.features&&(n=e.features,r=n.getArray()),!t&&n===void 0&&(n=new oc(r)),r!==void 0&&this.addFeaturesInternal(r),n!==void 0&&this.bindFeaturesCollection_(n)}addFeature(e){this.addFeatureInternal(e),this.changed()}addFeatureInternal(e){let t=V(e);if(!this.addToIndex_(t,e)){this.featuresCollection_&&this.featuresCollection_.remove(e);return}this.setupChangeEvents_(t,e);let n=e.getGeometry();if(n){let t=n.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(t,e)}else this.nullGeometryFeatures_[t]=e;this.dispatchEvent(new bb(yb.ADDFEATURE,e))}setupChangeEvents_(e,t){t instanceof _b||(this.featureChangeKeys_[e]=[L(t,z.CHANGE,this.handleFeatureChange_,this),L(t,Ms.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(e,t){let n=!0;if(t.getId()!==void 0){let e=String(t.getId());if(!(e in this.idIndex_))this.idIndex_[e]=t;else if(t instanceof _b){let r=this.idIndex_[e];r instanceof _b?Array.isArray(r)?r.push(t):this.idIndex_[e]=[r,t]:n=!1}else n=!1}return n&&(U(!(e in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[e]=t),n}addFeatures(e){this.addFeaturesInternal(e),this.changed()}addFeaturesInternal(e){let t=[],n=[],r=[];for(let t=0,r=e.length;t<r;t++){let r=e[t],i=V(r);this.addToIndex_(i,r)&&n.push(r)}for(let e=0,i=n.length;e<i;e++){let i=n[e],a=V(i);this.setupChangeEvents_(a,i);let o=i.getGeometry();if(o){let e=o.getExtent();t.push(e),r.push(i)}else this.nullGeometryFeatures_[a]=i}if(this.featuresRtree_&&this.featuresRtree_.load(t,r),this.hasListener(yb.ADDFEATURE))for(let e=0,t=n.length;e<t;e++)this.dispatchEvent(new bb(yb.ADDFEATURE,n[e]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener(yb.ADDFEATURE,(function(n){!t&&n.feature&&(t=!0,e.push(n.feature),t=!1)})),this.addEventListener(yb.REMOVEFEATURE,(function(n){!t&&n.feature&&(t=!0,e.remove(n.feature),t=!1)})),e.addEventListener(js.ADD,(e=>{t||=(t=!0,this.addFeature(e.element),!1)})),e.addEventListener(js.REMOVE,(e=>{t||=(t=!0,this.removeFeature(e.element),!1)})),this.featuresCollection_=e}clear(e){if(e){for(let e in this.featureChangeKeys_)this.featureChangeKeys_[e].forEach(R);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(e=>{this.removeFeatureInternal(e)});for(let e in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[e])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};let t=new bb(yb.CLEAR);this.dispatchEvent(t),this.changed()}forEachFeature(e){if(this.featuresRtree_)return this.featuresRtree_.forEach(e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureAtCoordinateDirect(e,t){let n=[e[0],e[1],e[0],e[1]];return this.forEachFeatureInExtent(n,function(n){let r=n.getGeometry();if(r instanceof _b||r&&r.intersectsCoordinate(e))return t(n)})}forEachFeatureInExtent(e,t){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(e,t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureIntersectingExtent(e,t){return this.forEachFeatureInExtent(e,function(n){let r=n.getGeometry();if(r instanceof _b||r&&r.intersectsExtent(e)){let e=t(n);if(e)return e}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let e;return this.featuresCollection_?e=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(e=this.featuresRtree_.getAll(),Ps(this.nullGeometryFeatures_)||Hs(e,Object.values(this.nullGeometryFeatures_))),e||[]}getFeaturesAtCoordinate(e){let t=[];return this.forEachFeatureAtCoordinateDirect(e,function(e){t.push(e)}),t}getFeaturesInExtent(e,t){if(this.featuresRtree_){if(!(t&&t.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(e);let n=this.featuresRtree_;return Cl(e,t).flatMap(e=>n.getInExtent(e))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(e,t){let n=e[0],r=e[1],i=null,a=[NaN,NaN],o=1/0,s=[-1/0,-1/0,1/0,1/0];t||=qs;let c=this.featuresRtree_;return c?(c.forEachInExtent(s,function(e){if(t(e)){let t=e.getGeometry();if(!t)return;let c=o;if(o=t instanceof _b?0:t.closestPointXY(n,r,a,o),o<c){i=e;let t=Math.sqrt(o);s[0]=n-t,s[1]=r-t,s[2]=n+t,s[3]=r+t}}}),i):null}getExtent(e){return this.featuresRtree_?.getExtent(e)??null}getFeatureById(e){let t=this.idIndex_[e.toString()];return t===void 0?null:t}getFeatureByUid(e){let t=this.uidIndex_[e];return t===void 0?null:t}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(e){let t=e.target,n=V(t),r=t.getGeometry();if(!r)n in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(t),this.nullGeometryFeatures_[n]=t);else{let e=r.getExtent();n in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[n],this.featuresRtree_&&this.featuresRtree_.insert(e,t)):this.featuresRtree_&&this.featuresRtree_.update(e,t)}let i=t.getId();if(i!==void 0){let e=i.toString();this.idIndex_[e]!==t&&(this.removeFromIdIndex_(t),this.idIndex_[e]=t)}else this.removeFromIdIndex_(t),this.uidIndex_[n]=t;this.changed(),this.dispatchEvent(new bb(yb.CHANGEFEATURE,t))}hasFeature(e){let t=e.getId();if(t!==void 0){let n=this.idIndex_[String(t)];return Array.isArray(n)?n.includes(e):n===e}return V(e)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Ps(this.nullGeometryFeatures_):!this.featuresCollection_||this.featuresCollection_.getLength()===0}loadFeatures(e,t,n){let r=this.loadedExtentsRtree_,i=this.strategy_(e,t,n);for(let e=0,a=i.length;e<a;++e){let a=i[e];if(!r.forEachInExtent(a,function(e){return Kc(e.extent,a)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new bb(yb.FEATURESLOADSTART));let e=e=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new bb(yb.FEATURESLOADEND,void 0,e))},i=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new bb(yb.FEATURESLOADERROR))},o=!1,s=this.loader_.call(this,a,t,n,t=>o||e(t),()=>o||i());Ks(s)?(o=!0,s.then(t=>{let n=t;this.addFeatures(n),e(n)}).catch(i)):this.loader_.length<4&&(this.loading=!1),r.insert(a,{extent:a.slice()})}}}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(e){let t=this.loadedExtentsRtree_,n=[];t.forEachInExtent(e,function(e){n.push(e)}),n.forEach(n=>{t.remove(n);let r=hl(n.extent,e);for(let e of r)t.insert(e,{extent:e})})}removeFeatures(e){let t=!1;for(let n=0,r=e.length;n<r;++n)t=this.removeFeatureInternal(e[n])||t;t&&this.changed()}removeFeature(e){e&&this.removeFeatureInternal(e)&&this.changed()}removeFeatureInternal(e){let t=V(e);if(!(t in this.uidIndex_))return!1;t in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[t]:this.featuresRtree_&&this.featuresRtree_.remove(e),this.featureChangeKeys_[t]?.forEach(R),delete this.featureChangeKeys_[t];let n=e.getId();if(n!==void 0){let t=n.toString(),r=this.idIndex_[t];r===e?delete this.idIndex_[t]:Array.isArray(r)&&(r.splice(r.indexOf(e),1),r.length===1&&(this.idIndex_[t]=r[0]))}return delete this.uidIndex_[t],this.hasListener(yb.REMOVEFEATURE)&&this.dispatchEvent(new bb(yb.REMOVEFEATURE,e)),!0}removeFromIdIndex_(e){for(let t in this.idIndex_)if(this.idIndex_[t]===e){delete this.idIndex_[t];break}}setLoader(e){this.loader_=e}setUrl(e){U(this.format_,"`format` must be set when `url` is set"),this.url_=e,this.setLoader(fb(e,this.format_))}setOverlaps(e){this.overlaps_=e,this.changed()}},Sb=`+proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +type=crs`,Cb=`data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7`,wb=`#e7e1d4`,Tb=`#b42318`,Eb=`#1d4e89`;qo.defs(`EPSG:25832`,Sb),Fy(qo);var Db=class extends lb{generation=0;reload(){this.generation+=1,this.setKey(`kacheln-${this.generation}`),this.refresh()}};function Ob(e){let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a of e.blaetter)t=Math.min(t,a.minE),n=Math.min(n,a.minN),r=Math.max(r,a.maxE),i=Math.max(i,a.maxN);let a=(e.resolutions[e.resolutions.length-1]??1)*e.tileSizePx;return Number.isFinite(t)?[t-a,n-a,r+a,i+a]:[0,0,1e6,1e7]}function kb(e){return new Ag({image:new Tg({radius:9,fill:new Eg({color:e}),stroke:new kg({color:`#ffffff`,width:3})})})}function Ab(e,t){if(!(e instanceof R_))return;let n=e.getImage();if(!(n instanceof HTMLImageElement))return;let r=()=>{n.src=Cb};caches.open(d).then(async e=>{let i=await e.match(t);if(!i){r();return}let a=await i.blob(),o=URL.createObjectURL(a),s=()=>URL.revokeObjectURL(o);n.addEventListener(`load`,s,{once:!0}),n.addEventListener(`error`,()=>{s(),r()},{once:!0}),n.src=o}).catch(r)}function jb(e,t,n){n?(t.getGeometry()?.setCoordinates([n.easting,n.northing]),e.hasFeature(t)||e.addFeature(t)):e.hasFeature(t)&&e.removeFeature(t)}function Mb(e,t,n){e.style.background=wb;let r=Ju(`EPSG:25832`);if(!r)throw Error(`EPSG:25832 ist nicht registriert.`);let i=Ob(t);r.setExtent(i);let a=t.tileSizePx,o=new Ry({origin:[0,1024e4],resolutions:[...t.resolutions].reverse(),tileSize:a,extent:i}),s=new Db({projection:r,tileGrid:o,zDirection:-1,wrapX:!1,transition:0,tileUrlFunction(e){let n=t.resolutions.length-1-e[0];if(n<0||n>=t.resolutions.length)return;let r=o.getResolution(e[0]),i=o.getTileCoordExtent(e),s=r*a;return f(`${n}/${Math.floor(i[0]/s+1e-9)}/${Math.floor(i[1]/s+1e-9)}`)},tileLoadFunction:Ab}),c=new xb,l=kb(Tb),u=new A_({geometry:new uf([0,0])});u.setStyle(kb(Eb));let d=n.snapshot(),p=Nb(e),m=Pb(r,[d.center.easting,d.center.northing],d.resolution,Zo(p,Xo)),h=new O_({target:e,layers:[new xv({source:s}),new Py({source:c,updateWhileAnimating:!0,updateWhileInteracting:!0})],view:m,controls:[],interactions:Vp({altShiftDragRotate:!1,pinchRotate:!1,doubleClickZoom:!1,keyboard:!1,shiftDragZoom:!1})}),g=!1,_=!1,v=0,y=0,b=()=>{let e=h.getView(),t=e.getCenter(),r=e.getResolution();t&&r!==void 0&&(n.panTo({easting:t[0],northing:t[1]}),n.zoomTo(r))},x=()=>{_||(_=!0,b())};h.on(`singleclick`,e=>{let[t,r]=e.coordinate;n.tap({easting:t,northing:r})}),h.on(`pointerdrag`,x),h.getViewport()?.addEventListener(`wheel`,x,{passive:!0}),h.on(`moveend`,()=>{if(g)return;let e=h.getView();!_||e.getInteracting()||e.getAnimating()||(_=!1,b())});let S=e=>{let t=Zo(e,Xo),n=h.getView();if(Math.abs(n.getMaxResolution()-t)<1e-9)return;let i=n.getCenter(),a=n.getResolution();i&&a!==void 0&&(g=!0,m=Pb(r,[i[0],i[1]],Math.min(Math.max(a,Xo.minResolutionMeters),t),t),h.setView(m),requestAnimationFrame(()=>{g=!1}))},C=()=>{let e=h.getSize();if(!e)return;let t=Math.round(e[0]),r=Math.round(e[1]);if(t<1||r<1||t===v&&r===y)return;v=t,y=r;let i={widthPx:t,heightPx:r},a=h.getView();!a.getInteracting()&&!a.getAnimating()&&S(i),n.setViewport(i)};return h.on(`change:size`,C),C(),{apply(e){let t=new Set(e.ziele.map(e=>e.koordinate));for(let e of[...c.getFeatures()]){if(e===u)continue;let n=e.getId();(typeof n!=`string`||!t.has(n))&&c.removeFeature(e)}for(let t of e.ziele){let e=c.getFeatureById(t.koordinate)?.getGeometry();if(e instanceof uf){e.setCoordinates([t.point.easting,t.point.northing]);continue}let n=new A_({geometry:new uf([t.point.easting,t.point.northing])});n.setId(t.koordinate),n.setStyle(l),c.addFeature(n)}jb(c,u,e.standort);let n=h.getView();if(n.getInteracting()||n.getAnimating())return;let r=h.getSize();r&&r[0]>=1&&r[1]>=1&&S({widthPx:Math.round(r[0]),heightPx:Math.round(r[1])});let i=h.getView(),a=i.getCenter(),o=i.getResolution(),s=[e.center.easting,e.center.northing],d=a!==void 0&&Math.abs(a[0]-s[0])<.01&&Math.abs(a[1]-s[1])<.01,f=o!==void 0&&Math.abs(o-e.resolution)<1e-6;d&&f||(g=!0,i.setCenter(s),i.setResolution(e.resolution),i.setRotation(0),requestAnimationFrame(()=>{g=!1}))},refreshTiles(){s.reload()}}}function Nb(e){let t=Math.round(e.clientWidth)||window.innerWidth,n=Math.round(e.clientHeight)||window.innerHeight;return{widthPx:Math.max(t,1),heightPx:Math.max(n,1)}}function Pb(e,t,n,r){let i=Xo.minResolutionMeters,a=Math.max(r,i);return new Af({projection:e,center:t,resolution:Math.min(Math.max(n,i),a),rotation:0,enableRotation:!1,resolutions:[a,i],constrainResolution:!1,smoothResolutionConstraint:!1,multiWorld:!1})}function Fb(e,t,n){e.replaceChildren();let r=document.createElement(`div`);r.className=`map`;let i=document.createElement(`section`);i.className=`panel`,i.innerHTML=`
<div class="panel-head">
<h1>Karte</h1>
<div class="head-actions">
<button type="button" class="secondary icon-button fold-toggle" aria-expanded="false" aria-controls="ziele" aria-label="Ziele" title="Ziele">${Lb}${Vb}</button>
<button type="button" class="secondary icon-button einstellungen-toggle" aria-expanded="false" aria-controls="einstellungen" aria-label="Einstellungen" title="Einstellungen">${Rb}${Vb}</button>
<button type="button" class="secondary icon-button info-toggle" aria-expanded="false" aria-controls="info" aria-label="Info" title="Info">${Bb}${Vb}</button>
</div>
</div>
<div id="ziele" class="fold" hidden>
<form>
<div class="fields">
<label>Gitter <input name="gitter" type="text" autocomplete="off" spellcheck="false" autocapitalize="off" /></label>
<label>Rechtswert <input name="rechtswert" type="text" inputmode="numeric" autocomplete="off" spellcheck="false" /></label>
<label>Hochwert <input name="hochwert" type="text" inputmode="numeric" autocomplete="off" spellcheck="false" /></label>
</div>
<button type="submit">Ziel setzen</button>
</form>
<ul class="ziel-list"></ul>
<div class="actions">
<button type="button" class="secondary">Auf Standort</button>
</div>
</div>
<div id="einstellungen" class="fold" hidden>
<label class="download-knopf"><input type="checkbox" /> <span>Download-Knopf (aktueller Sichtbereich)</span></label>
<div class="gebiet">
<p hidden></p>
<button type="button" class="hessen-download">Hessen herunterladen</button>
</div>
<button type="button" class="secondary wipe">Ganzen Cache löschen</button>
</div>
<div id="info" class="fold info" hidden>
<p><a href="https://gitea.neitzel.de/konrad/karten" target="_blank" rel="noopener noreferrer">Karten</a> © 2026 <a href="mailto:konrad@neitzel.de" target="_blank" rel="noopener noreferrer">Konrad Neitzel</a></p>
<p>Karten: <a href="https://hvbg.hessen.de/landesvermessung/geotopographie/karten/dtk25" target="_blank" rel="noopener noreferrer">DTK25 Karten von Hessen</a></p>
<p><a href="https://hvbg.hessen.de/geoinformation/open-data" target="_blank" rel="noopener noreferrer">Open Data Hinweis der Karten</a></p>
</div>
<p class="notice" role="status" hidden></p>
`;let a=document.createElement(`dialog`);a.innerHTML=`
<h2 class="ask"></h2>
<p class="explain"></p>
<div class="dialog-actions">
<button type="button" class="confirm"></button>
<button type="button" class="secondary cancel">Abbrechen</button>
</div>
`,e.append(i,r,a);let o=i.querySelector(`#ziele`),s=i.querySelector(`.fold-toggle`),c=i.querySelector(`#einstellungen`),l=i.querySelector(`.einstellungen-toggle`),u=i.querySelector(`#info`),d=i.querySelector(`.info-toggle`),f=i.querySelector(`form`),p=i.querySelector(`input[name="gitter"]`),m=i.querySelector(`input[name="rechtswert"]`),h=i.querySelector(`input[name="hochwert"]`),g=i.querySelector(`.ziel-list`),_=i.querySelector(`.actions button`),v=i.querySelector(`.download-knopf input`),y=i.querySelector(`.gebiet`),b=i.querySelector(`.gebiet p`),x=i.querySelector(`.gebiet button`),S=i.querySelector(`.wipe`),C=i.querySelector(`.notice`),w=a.querySelector(`.ask`),T=a.querySelector(`.explain`),E=a.querySelector(`.confirm`),D=a.querySelector(`.cancel`);if(!o||!s||!c||!l||!u||!d||!f||!p||!m||!h||!g||!_||!v||!y||!b||!x||!S||!C||!w||!T||!E||!D)return;let O=t.snapshot();p.value=O.koordinate.gitter,m.value=O.koordinate.rechtswert,h.value=O.koordinate.hochwert;let k=Mb(r,n,t),A=document.createElement(`button`);A.type=`button`,A.className=`map-download icon-button`,A.setAttribute(`aria-label`,`Diese Ansicht herunterladen`),A.title=`Diese Ansicht herunterladen`,A.innerHTML=zb,A.addEventListener(`click`,()=>t.downloadView());let ee=!1,te=Ib(t.snapshot());f.addEventListener(`submit`,e=>{e.preventDefault(),t.enterKoordinate({gitter:p.value,rechtswert:m.value,hochwert:h.value})}),s.addEventListener(`click`,()=>{let e=o.hasAttribute(`hidden`);o.toggleAttribute(`hidden`,!e),s.setAttribute(`aria-expanded`,e?`true`:`false`)}),l.addEventListener(`click`,()=>{let e=c.hasAttribute(`hidden`);c.toggleAttribute(`hidden`,!e),l.setAttribute(`aria-expanded`,e?`true`:`false`)}),d.addEventListener(`click`,()=>{let e=u.hasAttribute(`hidden`);u.toggleAttribute(`hidden`,!e),d.setAttribute(`aria-expanded`,e?`true`:`false`)}),_.addEventListener(`click`,()=>t.centerOnStandort()),v.addEventListener(`change`,()=>{t.setDownloadKnopf(v.checked)}),x.addEventListener(`click`,()=>{x.disabled||t.startHessen()}),S.addEventListener(`click`,()=>j()),E.addEventListener(`click`,()=>{let e=ee;ee=!1,a.close(),e&&t.deleteCache()}),D.addEventListener(`click`,()=>{ee=!1,a.open&&a.close()}),a.addEventListener(`cancel`,()=>{ee=!1});let ne=()=>{let e=t.snapshot();k.apply(e);let n=Ib(e);n!==te&&(te=n,k.refreshTiles()),re(e)},re=e=>{g.replaceChildren();for(let n of e.ziele){let e=document.createElement(`li`),r=document.createElement(`button`);r.type=`button`,r.className=`secondary ziel-open`,r.textContent=n.entfernung?`${n.koordinate} ${n.entfernung.text}`:n.koordinate,r.addEventListener(`click`,()=>t.centerOnZiel(n.koordinate));let i=document.createElement(`button`);i.type=`button`,i.className=`secondary`,i.textContent=`Löschen`,i.addEventListener(`click`,()=>t.deleteZiel(n.koordinate)),e.append(r,i),g.append(e)}e.notice?(C.hidden=!1,C.textContent=e.notice):(C.hidden=!0,C.textContent=``),v.checked=e.downloadKnopf,e.downloadKnopf?r.append(A):A.remove();let n=e.hessen.arrived<e.hessen.total;y.hidden=!1,x.textContent=`Hessen herunterladen`,x.disabled=!n,x.classList.toggle(`hessen-download`,n),e.visit?(b.hidden=!1,b.textContent=`Kacheln: ${e.visit.arrived} von ${e.visit.total}`):(b.hidden=!0,b.textContent=``)},j=()=>{a.open||(ee=!0,w.textContent=`Den ganzen Cache löschen?`,T.textContent=`Alle Kacheln werden gelöscht.`,E.textContent=`Löschen`,a.showModal())};t.subscribe(ne),ne()}function Ib(e){return e.kacheln.map(e=>`${e.id}:${e.appearance}`).join(`
`)}var Lb=`<svg class="glyph" viewBox="0 0 24 24" aria-hidden="true"><path fill="currentColor" d="M6.5 2.2h1.7V21h-1.7z"/><path fill="#b42318" d="M8.2 3.6 17.4 8.4 8.2 13.2z"/></svg>`,Rb=`<svg class="glyph" viewBox="0 0 24 24" aria-hidden="true"><path fill="currentColor" fill-rule="evenodd" d="M10.59 5.55L9.69 1.45L14.31 1.45L13.41 5.55L15.56 6.44L17.82 2.9L21.1 6.18L17.56 8.44L18.45 10.59L22.55 9.69L22.55 14.31L18.45 13.41L17.56 15.56L21.1 17.82L17.82 21.1L15.56 17.56L13.41 18.45L14.31 22.55L9.69 22.55L10.59 18.45L8.44 17.56L6.18 21.1L2.9 17.82L6.44 15.56L5.55 13.41L1.45 14.31L1.45 9.69L5.55 10.59L6.44 8.44L2.9 6.18L6.18 2.9L8.44 6.44ZM12 9.1a2.9 2.9 0 1 0 .01 0z"/></svg>`,zb=`<svg class="glyph" viewBox="0 0 24 24" aria-hidden="true"><path fill="currentColor" d="M11 2.5h2v9.1l2.9-2.9 1.4 1.4L12 15.9 6.7 10.1l1.4-1.4 2.9 2.9V2.5zM4.2 18.2h15.6V21H4.2z"/></svg>`,Bb=`<svg class="glyph" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="8.25" fill="none" stroke="currentColor" stroke-width="1.8"/><circle cx="12" cy="8.2" r="1.15" fill="currentColor"/><rect x="11.1" y="10.55" width="1.8" height="5.7" fill="currentColor"/></svg>`,Vb=`<svg class="strike" viewBox="0 0 24 24" aria-hidden="true"><line x1="3" y1="21" x2="21" y2="3" stroke="#e7e1d4" stroke-width="4.5" stroke-linecap="round"/><line x1="3" y1="21" x2="21" y2="3" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/></svg>`;Hb();async function Hb(){let e=document.querySelector(`#app`);if(e instanceof HTMLElement){navigator.storage?.persist&&navigator.storage.persist(),u({immediate:!0});try{let[t,n]=await Promise.all([Ub(),Wb()]),r=await ks({uebersicht:t,cache:m(),marks:te(),kacheln:w(),config:Xo,viewport:{widthPx:window.innerWidth,heightPx:window.innerHeight},...n===void 0?{}:{standort:n},online:navigator.onLine,appOpen:document.visibilityState===`visible`});Fb(e,r,t),S(),Gb(r)}catch(t){As(e,t)}}}async function Ub(){let e=await fetch(`/uebersicht.json`);if(!e.ok)throw Error(`Übersicht fehlt`);return await e.json()}function Wb(){return navigator.geolocation?new Promise(e=>{navigator.geolocation.getCurrentPosition(t=>{e(Jo(t.coords.longitude,t.coords.latitude))},t=>{t.code===t.TIMEOUT?e(void 0):e(`denied`)},{maximumAge:3e4,timeout:2e3})}):Promise.resolve(`denied`)}function Gb(e){let t=null,n=n=>{t?.(),t=null,n&&(t=Yo(t=>e.reportStandort(t)))};document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`?(e.setAppOpen(!0),n(!0)):(n(!1),e.setAppOpen(!1))}),window.addEventListener(`online`,()=>e.setOnline(!0)),window.addEventListener(`offline`,()=>e.setOnline(!1)),n(document.visibilityState===`visible`)}