map_view_vue3 0.0.0-stage → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,10 @@
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("vue")):typeof define==`function`&&define.amd?define([`exports`,`vue`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.map_view_vue3={},e.Vue))})(this,function(e,t){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var n={ADD:`add`,REMOVE:`remove`},r={PROPERTYCHANGE:`propertychange`};function i(e){for(let t in e)delete e[t]}function a(e){let t;for(t in e)return!1;return!t}function o(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 s(e,t,n,r){return o(e,t,n,r,!0)}function c(e){e&&e.target&&(e.target.removeEventListener(e.type,e.listener),i(e))}var l={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`},u=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}};function d(e,t,n){let r,i;n||=f;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 f(e,t){return e>t?1:e<t?-1:0}function p(e,t){return e<t?1:e>t?-1:0}function m(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 h(e,t,n){for(;t<n;){let r=e[t];e[t]=e[n],e[n]=r,++t,--n}}function g(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 _(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 v(e,t,n){let r=t||f;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 y(){throw Error(`Unimplemented abstract method.`)}var b=0;function x(e){let t=e;return t.ol_uid||=String(++b)}function S(e){return!!e&&typeof e.then==`function`&&typeof e.catch==`function`}function C(){return!0}function w(){return!1}function T(){}function E(e){let t,n,r;return function(){let i=Array.prototype.slice.call(arguments);return n&&this===r&&_(i,n)||(r=this,n=i,t=e.apply(this,i)),t}}function D(e){function t(){let t;try{t=e()}catch(e){return Promise.reject(e)}return S(t)?t:Promise.resolve(t)}return t()}var O=class{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}},k=class extends u{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 O(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,T);delete a[n]}return s}disposeInternal(){this.listeners_&&i(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]=T,++this.pendingRemovals_[e]):(n.splice(r,1),n.length===0&&delete this.listeners_[e]))}},A=class extends k{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(l.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]=o(this,e[i],t);return r}return o(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]=s(this,e[i],t)}else n=s(this,e,t);return t.ol_key=n,n}unInternal(e,t){let n=t.ol_key;if(n)ee(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)}};A.prototype.on,A.prototype.once,A.prototype.un;function ee(e){if(Array.isArray(e))for(let t=0,n=e.length;t<n;++t)c(e[t]);else c(e)}var te=class extends O{constructor(e,t,n){super(e),this.key=t,this.oldValue=n}},ne=class extends A{constructor(e){super(),this.on,this.once,this.un,x(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 te(n,e,t)),n=r.PROPERTYCHANGE,this.hasListener(n)&&this.dispatchEvent(new te(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],a(this.values_)&&(this.values_=null),t||this.notify(e,n)}}},j={LENGTH:`length`},re=class extends O{constructor(e,t,n){super(e),this.element=t,this.index=n}},ie=class extends ne{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(j.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 re(n.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 re(n.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 r=this.array_[e];this.array_[e]=t,this.dispatchEvent(new re(n.REMOVE,r,e)),this.dispatchEvent(new re(n.ADD,t,e))}updateLength_(){this.set(j.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`)}};function M(e,t){if(!e)throw Error(t)}var ae=class e extends ne{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_&&=(c(this.geometryChangeKey_),null);let e=this.getGeometry();e&&(this.geometryChangeKey_=o(e,l.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(e){this.set(this.geometryName_,e)}setStyle(e){this.style_=e??null,this.styleFunction_=e?oe(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 oe(e){if(typeof e==`function`)return e;let t;return Array.isArray(e)?t=e:(M(typeof e.getZIndex==`function`,"Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),t=[e]),function(){return t}}var se={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function ce(e){let t=me();for(let n=0,r=e.length;n<r;++n)xe(t,e[n]);return t}function N(e,t,n){return he(Math.min.apply(null,e),Math.min.apply(null,t),Math.max.apply(null,e),Math.max.apply(null,t),n)}function le(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 ue(e,t){return t?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):e.slice()}function de(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 P(e,t){return pe(e,t[0],t[1])}function fe(e,t){return e[0]<=t[0]&&t[2]<=e[2]&&e[1]<=t[1]&&t[3]<=e[3]}function pe(e,t,n){return e[0]<=t&&t<=e[2]&&e[1]<=n&&n<=e[3]}function F(e,t){let n=e[0],r=e[1],i=e[2],a=e[3],o=t[0],s=t[1],c=se.UNKNOWN;return o<n?c|=se.LEFT:o>i&&(c|=se.RIGHT),s<r?c|=se.BELOW:s>a&&(c|=se.ABOVE),c===se.UNKNOWN&&(c=se.INTERSECTING),c}function me(){return[1/0,1/0,-1/0,-1/0]}function he(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 ge(e){return he(1/0,1/0,-1/0,-1/0,e)}function _e(e,t){let n=e[0],r=e[1];return he(n,r,n,r,t)}function ve(e,t,n,r,i){return Se(ge(i),e,t,n,r)}function ye(e,t){return e[0]==t[0]&&e[2]==t[2]&&e[1]==t[1]&&e[3]==t[3]}function be(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 xe(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 Se(e,t,n,r,i){for(;n<r;n+=i)Ce(e,t[n],t[n+1]);return e}function Ce(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 we(e,t){let n;return n=t(Ee(e)),n||(n=t(De(e)),n)||(n=t(Fe(e)),n)||(n=t(Pe(e)),n)?n:!1}function Te(e){let t=0;return Le(e)||(t=L(e)*I(e)),t}function Ee(e){return[e[0],e[1]]}function De(e){return[e[2],e[1]]}function Oe(e){return[(e[0]+e[2])/2,(e[1]+e[3])/2]}function ke(e,t){let n;if(t===`bottom-left`)n=Ee(e);else if(t===`bottom-right`)n=De(e);else if(t===`top-left`)n=Pe(e);else if(t===`top-right`)n=Fe(e);else throw Error(`Invalid corner`);return n}function Ae(e,t,n,r,i){let[a,o,s,c,l,u,d,f]=je(e,t,n,r);return he(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 je(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 I(e){return e[3]-e[1]}function Me(e,t,n){let r=n||me();return Ie(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]):ge(r),r}function Ne(e,t){if(!Ie(e,t))return[e.slice()];if(fe(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 Pe(e){return[e[0],e[3]]}function Fe(e){return[e[2],e[3]]}function L(e){return e[2]-e[0]}function Ie(e,t){return e[0]<=t[2]&&e[2]>=t[0]&&e[1]<=t[3]&&e[3]>=t[1]}function Le(e){return e[2]<e[0]||e[3]<e[1]}function Re(e,t){return t?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):e}function ze(e,t,n){let r=!1,i=F(e,t),a=F(e,n);if(i===se.INTERSECTING||a===se.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&se.ABOVE&&!(i&se.ABOVE)&&(h=f-(p-l)/m,r=h>=o&&h<=c),!r&&a&se.RIGHT&&!(i&se.RIGHT)&&(g=p-(f-c)*m,r=g>=s&&g<=l),!r&&a&se.BELOW&&!(i&se.BELOW)&&(h=f-(p-s)/m,r=h>=o&&h<=c),!r&&a&se.LEFT&&!(i&se.LEFT)&&(g=p-(f-o)*m,r=g>=s&&g<=l)}return r}function Be(e,t,n,r){if(Le(e))return ge(n);let i=[];if(r!==void 0&&r>1){let t=e[2]-e[0],n=e[3]-e[1];for(let a=0;a<r;++a)i.push(e[0]+t*a/r,e[1],e[2],e[1]+n*a/r,e[2]-t*a/r,e[3],e[0],e[3]-n*a/r)}else i=[e[0],e[1],e[2],e[1],e[2],e[3],e[0],e[3]];t(i,i,2);let a=[],o=[];for(let e=0,t=i.length;e<t;e+=2)a.push(i[e]),o.push(i[e+1]);return N(a,o,n)}function Ve(e,t){let n=t.getExtent(),r=Oe(e);if(t.canWrapX()&&(r[0]<n[0]||r[0]>=n[2])){let t=L(n),i=Math.floor((r[0]-n[0])/t)*t;e[0]-=i,e[2]-=i}return e}function He(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]]];Ve(e,t);let i=L(r);if(L(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 Ue(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(...Ne(n[i],t[e]));n=r}return n}function R(e,t,n){return Math.min(Math.max(e,t),n)}function We(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 Ge(e,t,n,r)}function Ge(e,t,n,r){let i=n-e,a=r-t;return i*i+a*a}function Ke(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 qe(e){return e*180/Math.PI}function Je(e){return e*Math.PI/180}function Ye(e,t){let n=e%t;return n*t<0?n+t:n}function Xe(e,t,n){return e+n*(t-e)}function Ze(e,t){let n=10**t;return Math.round(e*n)/n}function Qe(e,t){return Math.floor(Ze(e,t))}function $e(e,t){return Math.ceil(Ze(e,t))}function et(e,t,n){if(e>=t&&e<n)return e;let r=n-t;return((e-t)%r+r)%r+t}function tt(e,t,n){n||=6371008.8;let r=Je(e[1]),i=Je(t[1]),a=(i-r)/2,o=Je(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 nt={info:1,warn:2,error:3,none:4},rt=nt.info;function it(...e){rt>nt.warn||console.warn(...e)}function at(e,t){return e[0]+=+t[0],e[1]+=+t[1],e}function ot(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 st(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 ct(e,t){return e[0]*=t,e[1]*=t,e}function lt(e,t){if(t.canWrapX()){let n=L(t.getExtent()),r=dt(e,t,n);r&&(e[0]-=r*n)}return e}function ut(e,t,n){if(t.canWrapX()){let r=L(t.getExtent()),i=Math.round((n-e[0])/r);i!==0&&(e[0]+=i*r)}return e}function dt(e,t,n){let r=t.getExtent(),i=0;return t.canWrapX()&&(e[0]<r[0]||e[0]>r[2])&&(n||=L(r),i=Math.floor((e[0]-r[0])/n)),i}function ft(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(R(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}var pt={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937},mt=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_||pt[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_}},ht=6378137,z=Math.PI*ht,gt=[-z,-z,z,z],_t=[-180,-85,180,85],vt=ht*Math.log(Math.tan(Math.PI/2)),yt=class extends mt{constructor(e){super({code:e,units:`m`,extent:gt,global:!0,worldExtent:_t,getPointResolution:function(e,t){return e/Math.cosh(t[1]/ht)}})}},bt=[new yt(`EPSG:3857`),new yt(`EPSG:102100`),new yt(`EPSG:102113`),new yt(`EPSG:900913`),new yt(`http://www.opengis.net/def/crs/EPSG/0/3857`),new yt(`http://www.opengis.net/gml/srs/epsg.xml#3857`)];function xt(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]=z*e[n]/180;let r=ht*Math.log(Math.tan(Math.PI*(+e[n+1]+90)/360));r>vt?r=vt:r<-vt&&(r=-vt),t[n+1]=r}return t}function St(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]/z,t[n+1]=360*Math.atan(Math.exp(e[n+1]/ht))/Math.PI-90;return t}var Ct=6378137,wt=[-180,-90,180,90],Tt=Math.PI*Ct/180,Et=class extends mt{constructor(e,t){super({code:e,units:`degrees`,extent:wt,axisOrientation:t,global:!0,metersPerUnit:Tt,worldExtent:wt})}},Dt=[new Et(`CRS:84`),new Et(`EPSG:4326`,`neu`),new Et(`urn:ogc:def:crs:OGC:1.3:CRS84`),new Et(`urn:ogc:def:crs:OGC:2:84`),new Et(`http://www.opengis.net/def/crs/OGC/1.3/CRS84`),new Et(`http://www.opengis.net/gml/srs/epsg.xml#4326`,`neu`),new Et(`http://www.opengis.net/def/crs/EPSG/0/4326`,`neu`)],Ot={};function kt(e){return Ot[e]||Ot[e.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,`EPSG:$3`)]||null}function At(e,t){Ot[e]=t}var jt={};function Mt(e,t,n){let r=e.getCode(),i=t.getCode();r in jt||(jt[r]={}),jt[r][i]=n}function Nt(e,t){return e in jt&&t in jt[e]?jt[e][t]:null}var Pt=.9996,Ft=.00669438,It=Ft*Ft,Lt=It*Ft,Rt=Ft/.99330562,zt=Math.sqrt(.99330562),Bt=(1-zt)/(1+zt),Vt=Bt*Bt,Ht=Vt*Bt,Ut=Ht*Bt,Wt=Ut*Bt,Gt=1-Ft/4-3*It/64-5*Lt/256,Kt=.002514607064228144,qt=26390466021299826e-22,Jt=35*Lt/3072,Yt=3/2*Bt-27/32*Ht+269/512*Wt,Xt=21/16*Vt-55/32*Ut,Zt=151/96*Ht-417/128*Wt,Qt=1097/512*Ut,$t=6378137;function en(e,t,n){let r=e-5e5,i=(n.north?t:t-1e7)/Pt/($t*Gt),a=i+Yt*Math.sin(2*i)+Xt*Math.sin(4*i)+Zt*Math.sin(6*i)+Qt*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-Ft*s,p=$t/Math.sqrt(1-Ft*s),m=.99330562/f,h=Rt*c**2,g=h*h,_=r/(p*Pt),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*Rt))+S/720*(61+90*u+298*h+45*d-252*Rt-3*g),w=(_-y/6*(1+2*u+h)+x/120*(5-2*h+28*u-3*g+8*Rt+24*d))/c;return w=et(w+Je(sn(n.number)),-Math.PI,Math.PI),[qe(w),qe(C)]}var tn=-80,nn=84,rn=-180,an=180;function on(e,t,n){e=et(e,rn,an),t<tn?t=tn:t>nn&&(t=nn);let r=Je(t),i=Math.sin(r),a=Math.cos(r),o=i/a,s=o*o,c=s*s,l=Je(e),u=Je(sn(n.number)),d=$t/Math.sqrt(1-Ft*i**2),f=Rt*a**2,p=a*et(l-u,-Math.PI,Math.PI),m=p*p,h=m*p,g=h*p,_=g*p,v=_*p,y=$t*(Gt*r-Kt*Math.sin(2*r)+qt*Math.sin(4*r)-Jt*Math.sin(6*r)),b=Pt*d*(p+h/6*(1-s+f)+_/120*(5-18*s+c+72*f-58*Rt))+5e5,x=Pt*(y+d*o*(m/2+g/24*(5-s+9*f+4*f**2)+v/720*(61-58*s+c+600*f-330*Rt)));return n.north||(x+=1e7),[b,x]}function sn(e){return(e-1)*6-180+3}var cn=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function ln(e){let t=0;for(let n of cn){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 un(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 dn(e){return ln(e)?new mt({code:e,units:`m`}):null}function fn(e){let t=ln(e.getCode());return t?{forward:un(on,t),inverse:un(en,t)}:null}var pn=[fn],mn=[dn],hn=!0;function gn(e){hn=!(e===void 0||e)}function _n(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 vn(e,t){if(t!==void 0&&e!==t){for(let n=0,r=e.length;n<r;++n)t[n]=e[n];e=t}return e}function yn(e){At(e.getCode(),e),Mt(e,e,_n)}function bn(e){e.forEach(yn)}function B(e){if(typeof e!=`string`)return e===void 0?null:e;let t=kt(e);if(t)return t;for(let t of mn){let n=t(e);if(n)return n}return null}function xn(e,t,n,r){let i=B(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/pt[r])}}else{let e=i.getUnits();if(e==`degrees`&&!r||r==`degrees`)a=t;else{let o=An(i,B(`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=(tt(e.slice(0,2),e.slice(2,4))+tt(e.slice(4,6),e.slice(6,8)))/2}let s=r?pt[r]:i.getMetersPerUnit();s!==void 0&&(a/=s)}}return a}function Sn(e){bn(e),e.forEach(function(t){e.forEach(function(e){t!==e&&Mt(t,e,_n)})})}function Cn(e,t,n,r){e.forEach(function(e){t.forEach(function(t){Mt(e,t,n),Mt(t,e,r)})})}function wn(e,t){return e?typeof e==`string`?B(e):e:B(t)}function Tn(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 En(e,t,n,r){let i=B(e),a=B(t);i&&a&&(Mt(i,a,Tn(n)),Mt(a,i,Tn(r)))}function Dn(e,t){return gn(),Nn(e,`EPSG:4326`,t===void 0?`EPSG:3857`:t)}function On(e,t){let n=Nn(e,t===void 0?`EPSG:3857`:t,`EPSG:4326`),r=n[0];return(r<-180||r>180)&&(n[0]=Ye(r+180,360)-180),n}function kn(e,t){if(e===t)return!0;let n=e.getUnits()===t.getUnits();return(e.getCode()===t.getCode()||An(e,t)===_n)&&n}function An(e,t){if(!e||!t)return null;let n=e.getCode(),r=t.getCode(),i=Nt(n,r);if(i)return i;let a=null,o=null;for(let n of pn)a||=n(e),o||=n(t);if(!a&&!o)return null;let s=`EPSG:4326`;if(!o&&a){let e=Nt(s,r);e&&(i=jn(a.inverse,e))}else if(!a&&o){let e=Nt(n,s);e&&(i=jn(e,o.forward))}else a&&o&&(i=jn(a.inverse,o.forward));return i&&(yn(e),yn(t),Mt(e,t,i)),i}function jn(e,t){return function(n,r,i,a){return r=e(n,r,i,a),t(r,r,i,a)}}function Mn(e,t){return An(B(e),B(t))}function Nn(e,t,n){let r=Mn(t,n);if(!r){let e=B(t)?.getCode()??String(t),r=B(n)?.getCode()??String(n);throw Error(`No transform available between ${e} and ${r}`)}return r(e,void 0,e.length)}function Pn(e,t,n,r){let i=Mn(t,n);return i?Be(e,i,void 0,r):e.slice()}var Fn=null;function In(){return Fn}function Ln(e,t){return e}function Rn(e,t){return hn&&!ot(e,[0,0])&&e[0]>=-180&&e[0]<=180&&e[1]>=-90&&e[1]<=90&&(hn=!1,it(`Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.`)),e}function zn(e,t){return e}function Bn(e,t){return e}function Vn(e,t){return e}function Hn(e,t,n){return function(r){let i,a;if(e.canWrapX()){let t=e.getExtent(),o=L(t);r=r.slice(0),a=dt(r,e,o),a&&(r[0]-=a*o),r[0]=R(r[0],t[0],t[2]),r[1]=R(r[1],t[1],t[3]),i=n(r)}else i=n(r);return a&&t.canWrapX()&&(i[0]+=a*L(t.getExtent())),i}}function Un(){Sn(bt),Sn(Dt),Cn(Dt,bt,xt,St)}Un();var Wn=[1,0,0,1,0,0];function Gn(){return Wn.slice(0)}function Kn(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 qn(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 Jn(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 Yn(e,t){let n=Xn(t);M(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 Xn(e){return e[0]*e[3]-e[1]*e[2]}var Zn=[1e5,1e5,1e5,1e5,2,2];function Qn(e){return`matrix(`+e.join(`, `)+`)`}function $n(e){return e.substring(7,e.length-1).split(`,`).map(parseFloat)}function er(e,t){let n=$n(e),r=$n(t);for(let e=0;e<6;++e)if(Math.round((n[e]-r[e])*Zn[e])!==0)return!1;return!0}function tr(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 nr(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 rr(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 ir(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 ar=Gn(),or=[NaN,NaN],sr=class extends ne{constructor(){super(),this.extent_=me(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=E((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 y()}closestPointXY(e,t,n,r){return y()}containsXY(e,t){return this.closestPointXY(e,t,or,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 y()}getExtent(e){if(this.extentRevision_!=this.getRevision()){let e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&ge(e),this.extentRevision_=this.getRevision()}return Re(this.extent_,e)}rotate(e,t){y()}scale(e,t,n){y()}simplify(e){return this.getSimplifiedGeometry(e*e)}getSimplifiedGeometry(e){return y()}getType(){return y()}applyTransform(e){y()}intersectsExtent(e){return y()}translate(e,t){y()}transform(e,t){let n=B(e);if(!n)return this;let r=n.getUnits()==`tile-pixels`?function(e,r,i){let a=n.getExtent(),o=n.getWorldExtent(),s=I(o)/I(a);Jn(ar,o[0],o[3],s,-s,0,0,0);let c=tr(e,0,e.length,i,ar,r),l=Mn(n,t);return l?l(c,c,i):c}:Mn(n,t);return r&&this.applyTransform(r),this}},cr=class extends sr{constructor(){super(),this.layout=`XY`,this.stride=2,this.flatCoordinates}computeExtent(e){return ve(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinates(){return y()}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=ur(e),this.layout=e,this.flatCoordinates=t}setCoordinates(e,t){y()}setLayout(e,t,n){let r;if(e)r=ur(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=lr(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();nr(n,0,n.length,r,e,t,n),this.changed()}}scale(e,t,n){t===void 0&&(t=e),n||=Oe(this.getExtent());let r=this.getFlatCoordinates();if(r){let i=this.getStride();rr(r,0,r.length,i,e,t,n,r),this.changed()}}translate(e,t){let n=this.getFlatCoordinates();if(n){let r=this.getStride();ir(n,0,n.length,r,e,t,n),this.changed()}}};function lr(e){let t;return e==2?t=`XY`:e==3?t=`XYZ`:e==4&&(t=`XYZM`),t}function ur(e){let t;return e==`XY`?t=2:e==`XYZ`||e==`XYM`?t=3:e==`XYZM`&&(t=4),t}function dr(e,t,n){let r=e.getFlatCoordinates();if(!r)return null;let i=e.getStride();return tr(r,0,r.length,i,t,n)}function fr(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 pr(e,t,n,r){let i=0;for(let a=0,o=n.length;a<o;++a){let o=n[a];i+=fr(e,t,o,r),t=o}return i}function mr(e,t,n,r){let i=0;for(let a=0,o=n.length;a<o;++a){let o=n[a];i+=pr(e,t,o,r),t=o[o.length-1]}return i}function hr(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]=Xe(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 gr(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=Ge(a,o,n,r);s>i&&(i=s),a=n,o=r}return i}function _r(e,t,n,r,i){for(let a=0,o=n.length;a<o;++a){let o=n[a];i=gr(e,t,o,r,i),t=o}return i}function vr(e,t,n,r,i){for(let a=0,o=n.length;a<o;++a){let o=n[a];i=_r(e,t,o,r,i),t=o[o.length-1]}return i}function yr(e,t,n,r,i,a,o,s,c,l,u){if(t==n)return l;let d,f;if(i===0){if(f=Ge(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(hr(e,p-r,p,r,o,s,u),f=Ge(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&&(hr(e,n-r,t,r,o,s,u),f=Ge(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 br(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=yr(e,t,f,r,i,a,o,s,c,l,u),t=f}return l}function xr(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=br(e,t,f,r,i,a,o,s,c,l,u),t=f[f.length-1]}return l}function Sr(e,t,n,r){for(let i=0;i<r;++i)e[t++]=n[i];return t}function Cr(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 wr(e,t,n,r,i){i||=[];let a=0;for(let o=0,s=n.length;o<s;++o){let s=Cr(e,t,n[o],r);i[a++]=s,t=s}return i.length=a,i}function Tr(e,t,n,r,i){i||=[];let a=0;for(let o=0,s=n.length;o<s;++o){let s=wr(e,t,n[o],r,i[a]);s.length===0&&(s[0]=t),i[a++]=s,t=s[s.length-1]}return i.length=a,i}function Er(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 Dr(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++]=Er(e,t,s,r,i[a]),t=s}return i.length=a,i}function Or(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?[]:Dr(e,t,s,r,i[a]),t=s[s.length-1]}return i.length=a,i}function kr(e,t,n,r,i){return!we(i,function(i){return!Ar(e,t,n,r,i[0],i[1])})}function Ar(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 jr(e,t,n,r,i,a){if(n.length===0||!Ar(e,t,n[0],r,i,a))return!1;for(let t=1,o=n.length;t<o;++t)if(Ar(e,n[t-1],n[t],r,i,a))return!1;return!0}function Mr(e,t,n,r,i,a){if(n.length===0)return!1;for(let o=0,s=n.length;o<s;++o){let s=n[o];if(jr(e,t,s,r,i,a))return!0;t=s[s.length-1]}return!1}function Nr(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 Pr(e,t,n,r,i,a){return a??=Se(me(),e,t,n,r),Ie(i,a)?a[0]>=i[0]&&a[2]<=i[2]||a[1]>=i[1]&&a[3]<=i[3]||Nr(e,t,n,r,function(e,t){return ze(i,e,t)}):!1}function Fr(e,t,n,r,i){for(let a=0,o=n.length;a<o;++a){if(Pr(e,t,n[a],r,i))return!0;t=n[a]}return!1}function Ir(e,t,n,r,i){return!!(Pr(e,t,n,r,i)||Ar(e,t,n,r,i[0],i[1])||Ar(e,t,n,r,i[0],i[3])||Ar(e,t,n,r,i[2],i[1])||Ar(e,t,n,r,i[2],i[3]))}function Lr(e,t,n,r,i){if(!Ir(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(kr(e,n[t-1],n[t],r,i)&&!Pr(e,n[t-1],n[t],r,i))return!1;return!0}function Rr(e,t,n,r,i){for(let a=0,o=n.length;a<o;++a){let o=n[a];if(Lr(e,t,o,r,i))return!0;t=o[o.length-1]}return!1}function zr(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=We(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 Br(e,t,n,r,i,a,o,s){for(let c=0,l=n.length;c<l;++c){let l=n[c];o=zr(e,t,l,r,i,a,o),s.push(o),t=l}return o}function Vr(e,t){return t*Math.round(e/t)}function Hr(e,t,n,r,i,a,o){if(t==n)return o;let s=Vr(e[t],i),c=Vr(e[t+1],i);t+=r,a[o++]=s,a[o++]=c;let l,u;do if(l=Vr(e[t],i),u=Vr(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=Vr(e[t],i),d=Vr(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 Ur(e,t,n,r,i,a,o,s){for(let c=0,l=n.length;c<l;++c){let l=n[c];o=Hr(e,t,l,r,i,a,o),s.push(o),t=l}return o}function Wr(e,t,n,r,i,a,o,s){for(let c=0,l=n.length;c<l;++c){let l=n[c],u=[];o=Ur(e,t,l,r,i,a,o,u),s.push(u),t=l[l.length-1]}return o}var Gr=class e extends cr{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<de(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(gr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),yr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,e,t,n,r))}getArea(){return fr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Er(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){let n=[];return n.length=zr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,n,0),new e(n,`XY`)}getType(){return`LinearRing`}intersectsExtent(e){return Pr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||=[],this.flatCoordinates.length=Cr(this.flatCoordinates,0,e,this.stride),this.changed()}},Kr=class e extends cr{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=Ge(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 _e(this.flatCoordinates,e)}getType(){return`Point`}intersectsExtent(e){return pe(e,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(e,t){this.setLayout(t,e,0),this.flatCoordinates||=[],this.flatCoordinates.length=Sr(this.flatCoordinates,0,e,this.stride),this.changed()}};function qr(e,t,n,r,i,a,o){let s,c,l,u,d,p,m,h=i[a+1],g=[];for(let i=0,a=n.length;i<a;++i){let a=n[i];for(u=e[a-r],p=e[a-r+1],s=t;s<a;s+=r)d=e[s],m=e[s+1],(h<=p&&m<=h||p<=h&&h<=m)&&(l=(h-p)/(m-p)*(d-u)+u,g.push(l)),u=d,p=m}let _=NaN,v=-1/0;for(g.sort(f),u=g[0],s=1,c=g.length;s<c;++s){d=g[s];let i=Math.abs(d-u);i>v&&(l=(u+d)/2,jr(e,t,n,r,l,h)&&(_=l,v=i)),u=d}return isNaN(_)&&(_=i[a]),o?(o.push(_,h,v),o):[_,h,v]}function Jr(e,t,n,r,i){let a=[];for(let o=0,s=n.length;o<s;++o){let s=n[o];a=qr(e,t,s,r,i,2*o,a),t=s[s.length-1]}return a}function Yr(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 Xr(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 Zr(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=Xr(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 Qr(e,t,n,r,i){for(let a=0,o=n.length;a<o;++a){let o=n[a];if(!Zr(e,t,o,r,i))return!1;o.length&&(t=o[o.length-1])}return!0}function $r(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=Xr(e,t,o,r);(a===0?i&&s||!i&&!s:i&&!s||!i&&s)&&Yr(e,t,o,r),t=o}return t}function ei(e,t,n,r,i){for(let a=0,o=n.length;a<o;++a)t=$r(e,t,n[a],r,i);return t}function ti(e,t){let n=[],r=0,i=0,a;for(let o=0,s=t.length;o<s;++o){let s=t[o],c=Xr(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 ni=class e extends cr{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?g(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<de(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(_r(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),br(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return jr(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,t)}getArea(){return pr(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(e){let t;return e===void 0?t=this.flatCoordinates:(t=this.getOrientedFlatCoordinates().slice(),$r(t,0,this.ends_,this.stride,e)),Dr(t,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){let e=Oe(this.getExtent());this.flatInteriorPoint_=qr(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Kr(this.getFlatInteriorPoint(),`XYM`)}getLinearRingCount(){return this.ends_.length}getLinearRing(e){return e<0||this.ends_.length<=e?null:new Gr(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 Gr(t.slice(i,o),e);r.push(s),i=o}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;Zr(e,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=$r(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){let n=[],r=[];return n.length=Ur(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),n,0,r),new e(n,`XY`,r)}getType(){return`Polygon`}intersectsExtent(e){return Lr(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||=[];let n=wr(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}};function ri(e){if(Le(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 ni(a,`XY`,[a.length])}var V={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4},ii=typeof navigator<`u`&&navigator.userAgent!==void 0?navigator.userAgent.toLowerCase():``;ii.includes(`safari`)&&!ii.includes(`chrom`)&&(ii.includes(`version/15.4`)||/cpu (os|iphone os) 15_4 like mac os x/.test(ii));var ai=ii.includes(`webkit`)&&!ii.includes(`edge`),oi=ii.includes(`macintosh`),si=typeof devicePixelRatio<`u`?devicePixelRatio:1,ci=typeof WorkerGlobalScope<`u`&&typeof OffscreenCanvas<`u`&&self instanceof WorkerGlobalScope,li=typeof Image<`u`&&Image.prototype.decode,ui=typeof createImageBitmap==`function`,di=(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})(),fi=class extends k{constructor(e,t,n,r){super(),this.extent=e,this.pixelRatio_=n,this.resolution=t,this.state=typeof r==`function`?V.IDLE:r,this.image_=null,this.loader=typeof r==`function`?r:null}changed(){this.dispatchEvent(l.CHANGE)}getExtent(){return this.extent}getImage(){return this.image_}getPixelRatio(){return this.pixelRatio_}getResolution(){return this.resolution}getState(){return this.state}load(){if(this.state==V.IDLE){let e=this.loader;if(e){this.state=V.LOADING,this.changed();let t=this.getResolution(),n=Array.isArray(t)?t[0]:t;D(()=>e(this.getExtent(),n,this.getPixelRatio())).then(e=>{`image`in e&&(this.image_=e.image),`extent`in e&&e.extent&&(this.extent=e.extent),`resolution`in e&&e.resolution!==void 0&&(this.resolution=e.resolution),`pixelRatio`in e&&e.pixelRatio!==void 0&&(this.pixelRatio_=e.pixelRatio),(e instanceof HTMLImageElement||ui&&e instanceof ImageBitmap||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement)&&(this.image_=e),this.state=V.LOADED}).catch(e=>{this.state=V.ERROR,console.error(e)}).finally(()=>this.changed())}}}setImage(e){this.image_=e}setResolution(e){this.resolution=e}};function pi(e,t,n){let r=e,i=!0,a=!1,o=!1,u=[s(r,l.LOAD,function(){o=!0,a||t()})];return r.src&&li?(a=!0,r.decode().then(function(){i&&t()}).catch(function(e){i&&(o?t():n())})):u.push(s(r,l.ERROR,n)),function(){i=!1,u.forEach(c)}}function mi(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 hi(e,t){return t&&(e.src=t),e.src&&li?new Promise((t,n)=>e.decode().then(()=>t(e)).catch(r=>e.complete&&e.width?t(e):n(r))):mi(e)}function gi(e,t){return t&&(e.src=t),e.src&&li&&ui?e.decode().then(()=>createImageBitmap(e)).catch(t=>{if(e.complete&&e.width)return e;throw t}):hi(e)}var H={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function _i(e){return e**3}function vi(e){return 1-_i(1-e)}function yi(e){return 3*e*e-2*e*e*e}function bi(e){return e}var xi=class extends k{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(l.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(){y()}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:_i(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 Si(e,t,n,r){let i;return i=n&&n.length?n.shift():ci?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 Ci;function wi(){return Ci||=Si(1,1),Ci}function Ti(e){let t=e.canvas;t.width=1,t.height=1,e.clearRect(0,0,1,1)}function Ei(e,t){let n=t.parentNode;n&&n.replaceChild(e,t)}function Di(e){for(;e.lastChild;)e.lastChild.remove()}function Oi(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 ki(){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 Ai(e){return typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof OffscreenCanvas<`u`&&e instanceof OffscreenCanvas}var ji=class extends xi{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_,ci?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_=Mi(),this.changed()}handleImageLoad_(){if(ci)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_=pi(e,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}}unlistenImage_(){this.unlisten_&&=(this.unlisten_(),null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}};function Mi(){let e=Si(1,1);return e.fillStyle=`rgba(0,0,0,0)`,e.fillRect(0,0,1,1),e.canvas}var Ni=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_}};function Pi(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 f=i*l,p=d(u,f);p<0?(c=(f-u[-p-2])/(u[-p-1]-u[-p-2]),s=t+(-p-2)*r):s=t+p*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]:Xe(e[s+t],e[s+r+t],c);return a}function Fi(e,t,n,r,i,a){if(n==t)return null;let o;if(i<e[t+r-1])return a?(o=e.slice(t,t+r),o[r-1]=i,o):null;if(e[n-1]<i)return a?(o=e.slice(n-r,n),o[r-1]=i,o):null;if(i==e[t+r-1])return e.slice(t,t+r);let s=t/r,c=n/r;for(;s<c;){let t=s+c>>1;i<e[(t+1)*r-1]?c=t:s=t+1}let l=e[s*r-1];if(i==l)return e.slice((s-1)*r,(s-1)*r+r);let u=e[(s+1)*r-1],d=(i-l)/(u-l);o=[];for(let t=0;t<r-1;++t)o.push(Xe(e[(s-1)*r+t],e[s*r+t],d));return o.push(i),o}function Ii(e,t,n,r,i,a,o){if(o)return Fi(e,t,n[n.length-1],r,i,a);let s;if(i<e[r-1])return a?(s=e.slice(0,r),s[r-1]=i,s):null;if(e[e.length-1]<i)return a?(s=e.slice(e.length-r),s[r-1]=i,s):null;for(let a=0,o=n.length;a<o;++a){let o=n[a];if(t!=o){if(i<e[t+r-1])return null;if(i<=e[o-1])return Fi(e,t,o,r,i,!1);t=o}}return null}function Li(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}var Ri=class e extends cr{constructor(e,t){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendCoordinate(e){g(this.flatCoordinates,e),this.changed()}clone(){let t=new e(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(e,t,n,r){return r<de(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(gr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),yr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,e,t,n,r))}forEachSegment(e){return Nr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinateAtM(e,t){return this.layout!=`XYM`&&this.layout!=`XYZM`?null:(t=t!==void 0&&t,Fi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t))}getCoordinates(){return Er(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(e,t){return Pi(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,this.stride)}getLength(){return Li(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(t){let n=[];return n.length=zr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,n,0),new e(n,`XY`)}getType(){return`LineString`}intersectsExtent(e){return Pr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,this.getExtent())}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||=[],this.flatCoordinates.length=Cr(this.flatCoordinates,0,e,this.stride),this.changed()}},zi=[NaN,NaN,NaN,0],Bi;function Vi(){return Bi||=Si(1,1,void 0,{willReadFrequently:!0,desynchronized:!0}),Bi}var Hi=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Ui=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Wi=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Gi=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function Ki(e,t){return e.endsWith(`%`)?Number(e.substring(0,e.length-1))/t:Number(e)}function qi(e){throw Error(`failed to parse "`+e+`" as color`)}function Ji(e){if(e.toLowerCase().startsWith(`rgb`)){let t=e.match(Ui)||e.match(Hi)||e.match(Wi);if(t){let e=t[4],n=100/255;return[R(Ki(t[1],n)+.5|0,0,255),R(Ki(t[2],n)+.5|0,0,255),R(Ki(t[3],n)+.5|0,0,255),e===void 0?1:R(Ki(e,100),0,1)]}qi(e)}if(e.startsWith(`#`)){if(Gi.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}qi(e)}let t=Vi();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&&qi(e));let r=t.fillStyle;if(r.startsWith(`#`)||r.startsWith(`rgba`))return Ji(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]=Ze(i[3]/255,3),i}function Yi(e){return typeof e==`string`?e:ca(e)}var Xi=1024,Zi={},Qi=0;function $i(e){if(e.length===4)return e;let t=e.slice();return t[3]=1,t}function ea(e){return e>.0031308?e**(1/2.4)*269.025-14.025:e*3294.6}function ta(e){return e>.2068965?e**3:(e-4/29)*(108/841)}function na(e){return e>10.314724?((e+14.025)/269.025)**2.4:e/3294.6}function ra(e){return e>.0088564?e**(1/3):e/(108/841)+4/29}function ia(e){let t=na(e[0]),n=na(e[1]),r=na(e[2]),i=ra(t*.222488403+n*.716873169+r*.06060791),a=500*(ra(t*.452247074+n*.399439023+r*.148375274)-i),o=200*(i-ra(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 aa(e){let t=(e[0]+16)/116,n=e[1],r=e[2]*Math.PI/180,i=ta(t),a=ta(t+n/500*Math.cos(r)),o=ta(t-n/200*Math.sin(r)),s=ea(a*3.021973625-i*1.617392459-o*.404875592),c=ea(a*-.943766287+i*1.916279586+o*.027607165),l=ea(a*.069407491-i*.22898585+o*1.159737864);return[R(s+.5|0,0,255),R(c+.5|0,0,255),R(l+.5|0,0,255),e[3]]}function oa(e){if(e===`none`)return zi;if(Zi.hasOwnProperty(e))return Zi[e];if(Qi>=Xi){let e=0;for(let t in Zi)e++&3||(delete Zi[t],--Qi)}let t=Ji(e);t.length!==4&&qi(e);for(let n of t)isNaN(n)&&qi(e);return Zi[e]=t,++Qi,t}function sa(e){return Array.isArray(e)?e:oa(e)}function ca(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+`)`}var la=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=ua(e,t);return n in this.cache_?this.cache_[n]:null}getPattern(e,t){let n=ua(e,t);return n in this.patternCache_?this.patternCache_[n]:null}set(e,t,n,r){let i=ua(e,t),a=i in this.cache_;if(n&&(this.cache_[i]=n),r&&n){if(n.getImageState()===V.IDLE&&n.load(),n.getImageState()===V.LOADING)n.ready().then(()=>{let e=wi().createPattern(n.getImage(1),`repeat`);e&&(this.patternCache_[i]=e)});else{let e=wi().createPattern(n.getImage(1),`repeat`);e&&(this.patternCache_[i]=e)}}a||++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}};function ua(e,t){let n=t?sa(t):`null`;return e+`:`+n}var da=new la,fa=null,pa=class extends k{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?V.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_===V.LOADED){let e=this.image_;if(!e)return!1;fa||=Si(1,1,void 0,{willReadFrequently:!0}),fa.drawImage(e,0,0);try{fa.getImageData(0,0,1,1),this.tainted_=!1}catch{fa=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(l.CHANGE)}handleImageError_(){this.imageState_=V.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=V.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=Si(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_===V.IDLE){this.image_||this.initializeImage_(),this.imageState_=V.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&hi(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_!==V.LOADED)return;let t=this.image_;if(!t)return;let n=Si(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=Yi(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_===V.LOADED||this.imageState_===V.ERROR)e();else{let t=()=>{(this.imageState_===V.LOADED||this.imageState_===V.ERROR)&&(this.removeEventListener(l.CHANGE,t),e())};this.addEventListener(l.CHANGE,t)}}),this.ready_}};function ma(e,t,n,r,i,a){let o=t===void 0?void 0:da.get(t,i);return o||(o=new pa(e,e&&`src`in e?e.src||void 0:t,n,r,i),t!==void 0&&da.set(t,i,o,a)),a&&o&&t!==void 0&&!da.getPattern(t,i)&&da.set(t,i,o,a),o}function ha(e){return e?Array.isArray(e)?ca(e):typeof e==`object`&&`src`in e?ga(e):e:null}function ga(e){if(!e.offset||!e.size)return da.getPattern(e.src,e.color??null);let t=e.src+`:`+e.offset,n=da.getPattern(t,e.color??null);if(n)return n;let r=da.get(e.src,null);if(!r||r.getImageState()!==V.LOADED)return null;let i=Si(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]),ma(i.canvas,t,{},V.LOADED,e.color??null,!0),da.getPattern(t,e.color??null)}function _a(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]=va(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 va(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=ft([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 ya(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 ba=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){}},xa=`ol-hidden`,Sa=`ol-unselectable`,Ca=`ol-unsupported`,wa=`ol-control`,Ta=`ol-collapsed`,Ea=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*$`,`i`),Da=[`style`,`variant`,`weight`,`size`,`lineHeight`,`family`],Oa={normal:400,bold:700},ka=function(e){let t=e.match(Ea);if(!t)return null;let n={lineHeight:`normal`,size:`1.2em`,style:`normal`,weight:`400`,variant:`normal`};for(let e=0,r=Da.length;e<r;++e){let r=t[e+1];r!==void 0&&(n[Da[e]]=typeof r==`string`?r.trim():r)}return isNaN(Number(n.weight))&&n.weight in Oa&&(n.weight=Oa[n.weight]),n.families=n.family.split(/,\s?/).map(e=>e.trim().replace(/^['"]|['"]$/g,``)),n},Aa=`10px sans-serif`,ja=`#000`,Ma=`round`,Na=[],Pa=`round`,Fa=`#000`,Ia=`center`,La=`middle`,Ra=[0,0,0,0],za=new ne,Ba=null,Va,Ha={},Ua=new Set([`serif`,`sans-serif`,`monospace`,`cursive`,`fantasy`,`system-ui`,`ui-serif`,`ui-sans-serif`,`ui-monospace`,`ui-rounded`,`emoji`,`math`,`fangsong`]);function Wa(e,t,n){return`${e} ${t} 16px "${n}"`}var Ga=(function(){let e,t;async function n(e){await t.ready;let n=ka(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=Oa[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 a=!0,o=za.getProperties(),s=Object.keys(o).filter(e=>o[e]<100);for(let e=s.length-1;e>=0;--e){let t=s[e],r=o[t];r<100&&(await n(t)?(i(Ha),za.set(t,100)):(r+=10,za.set(t,r,!0),r<100&&(a=!1)))}e=void 0,a||(e=setTimeout(r,100))}return async function(n){t||=ci?self.fonts:document.fonts;let i=ka(n);if(!i)return;let a=i.families,o=!1;for(let e of a){if(Ua.has(e))continue;let t=Wa(i.style,i.weight,e);za.get(t)===void 0&&(za.set(t,0,!0),o=!0)}o&&(clearTimeout(e),e=setTimeout(r,100))}})(),Ka=(function(){let e;return function(t){let n=Ha[t];if(n==null){if(ci){let e=ka(t),r=qa(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);Ha[t]=n}return n}})();function qa(e,t){return Ba||=Si(1,1),e!=Va&&(Ba.font=e,Va=Ba.font),Ba.measureText(t)}function Ja(e,t){return qa(e,t).width}function Ya(e,t,n){if(t in n)return n[t];let r=t.split(`
2
+ `).reduce((t,n)=>Math.max(t,Ja(e,n)),0);return n[t]=r,r}function Xa(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===`
3
+ `||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=Ja(f,d);n.push(p),o+=p;let m=Ka(f);r.push(m),c=Math.max(c,m)}return{width:a,height:s,widths:n,heights:r,lineWidths:i}}function Za(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]),Qa(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 Qa(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 $a=class extends ba{constructor(e,t,n,r,i,a,o){super(),this.context_=e,this.pixelRatio_=t,this.extent_=n,this.transform_=r,this.transformRotation_=r?Ze(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_=Gn()}drawImages_(e,t,n,r){if(!this.image_)return;let i=tr(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_;Jn(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=tr(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=tr(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=_a(c,0,e,2,s,t,c),ya(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_)),Ie(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=dr(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_)),Ie(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(Ie(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_)),Ie(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_)),Ie(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),_(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:Ia;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:ha(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||Na,l=t.getOffset();this.strokeState_={lineCap:n===void 0?Ma:n,lineDash:this.pixelRatio_===1?c:c.map(e=>e*this.pixelRatio_),lineDashOffset:(i||0)*this.pixelRatio_,lineJoin:a===void 0?Pa:a,lineWidth:(o===void 0?1:o)*this.pixelRatio_,miterLimit:s===void 0?10:s,strokeStyle:ha(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:ha(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?Ma:t,lineDash:r||Na,lineDashOffset:i||0,lineJoin:a===void 0?Pa:a,lineWidth:o===void 0?1:o,miterLimit:s===void 0?10:s,strokeStyle:ha(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?Aa:r,textAlign:u===void 0?Ia:u,textBaseline:d===void 0?La: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]]}}},eo=.5,to={Point:mo,LineString:uo,Polygon:go,MultiPoint:ho,MultiLineString:fo,MultiPolygon:po,GeometryCollection:lo,Circle:ao};function no(e,t){return parseInt(x(e),10)-parseInt(x(t),10)}function ro(e,t){let n=io(e,t);return n*n}function io(e,t){return eo*e/t}function ao(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 oo(e,t,n,r,i,a,o,s){let c=[],l=n.getImage();if(l){let e=!0,t=l.getImageState();t==V.LOADED||t==V.ERROR?e=!1:t==V.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)),so(e,t,n,r,a,o,s),d}function so(e,t,n,r,i,a,o){let s=n.getGeometryFunction()(t);if(!s)return;let c=s.simplifyTransformed(r,i);if(n.getRenderer())co(e,c,n,t,o);else{let r=to[c.getType()];r(e,c,n,t,o,a)}}function co(e,t,n,r,i){if(t.getType()==`GeometryCollection`){let a=t.getGeometries();for(let t=0,o=a.length;t<o;++t)co(e,a[t],n,r,i)}else e.getBuilder(n.getZIndex(),`Default`).drawCustom(t,r,n.getRenderer(),n.getHitDetectionRenderer(),i)}function lo(e,t,n,r,i,a){let o=t.getGeometriesArray(),s,c;for(s=0,c=o.length;s<c;++s){let t=to[o[s].getType()];t(e,o[s],n,r,i,a)}}function uo(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 fo(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 po(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 mo(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()!=V.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 ho(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()!=V.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 go(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 _o={PRERENDER:`prerender`,POSTRENDER:`postrender`,PRECOMPOSE:`precompose`,POSTCOMPOSE:`postcompose`,RENDERCOMPLETE:`rendercomplete`},vo=!1;function yo(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=vo,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 bo(e,t){return function(n,r,i,a,o){yo(e,t,n,r,i,(e,t)=>{this.addFeatures(e),a!==void 0&&a(e)},()=>{this.changed(),o!==void 0&&o()})}}function xo(e,t){return[[-1/0,-1/0,1/0,1/0]]}var So=class e extends cr{constructor(e,t,n){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(e[0]))this.setCoordinates(e,t);else if(t!==void 0&&n)this.setFlatCoordinates(t,e),this.ends_=n;else{let t=e,n=[],r=[];for(let e=0,i=t.length;e<i;++e){let i=t[e];g(n,i.getFlatCoordinates()),r.push(n.length)}let i=t.length===0?this.getLayout():t[0].getLayout();this.setFlatCoordinates(i,n),this.ends_=r}}appendLineString(e){g(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<de(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(_r(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),br(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,e,t,n,r))}getCoordinateAtM(e,t,n){return this.layout!=`XYM`&&this.layout!=`XYZM`||this.flatCoordinates.length===0?null:(t=t!==void 0&&t,n=n!==void 0&&n,Ii(this.flatCoordinates,0,this.ends_,this.stride,e,t,n))}getCoordinates(){return Dr(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(e){return e<0||this.ends_.length<=e?null:new Ri(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLineStrings(){let e=this.flatCoordinates,t=this.ends_,n=this.layout,r=[],i=0;for(let a=0,o=t.length;a<o;++a){let o=t[a],s=new Ri(e.slice(i,o),n);r.push(s),i=o}return r}getLength(){let e=this.ends_,t=0,n=0;for(let r=0,i=e.length;r<i;++r)n+=Li(this.flatCoordinates,t,e[r],this.stride),t=e[r];return n}getFlatMidpoints(){let e=[],t=this.flatCoordinates,n=0,r=this.ends_,i=this.stride;for(let a=0,o=r.length;a<o;++a){let o=r[a];g(e,Pi(t,n,o,i,.5)),n=o}return e}getSimplifiedGeometryInternal(t){let n=[],r=[];return n.length=Br(this.flatCoordinates,0,this.ends_,this.stride,t,n,0,r),new e(n,`XY`,r)}getType(){return`MultiLineString`}intersectsExtent(e){return Fr(this.flatCoordinates,0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||=[];let n=wr(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}},Co=class e extends cr{constructor(e,t){super(),t&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendPoint(e){g(this.flatCoordinates,e.getFlatCoordinates()),this.changed()}clone(){let t=new e(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(e,t,n,r){if(r<de(this.getExtent(),e,t))return r;let i=this.flatCoordinates,a=this.stride;for(let o=0,s=i.length;o<s;o+=a){let s=Ge(e,t,i[o],i[o+1]);if(s<r){r=s;for(let e=0;e<a;++e)n[e]=i[o+e];n.length=a}}return r}getCoordinates(){return Er(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(e){let t=this.flatCoordinates.length/this.stride;return e<0||t<=e?null:new Kr(this.flatCoordinates.slice(e*this.stride,(e+1)*this.stride),this.layout)}getPoints(){let e=this.flatCoordinates,t=this.layout,n=this.stride,r=[];for(let i=0,a=e.length;i<a;i+=n){let a=new Kr(e.slice(i,i+n),t);r.push(a)}return r}getType(){return`MultiPoint`}intersectsExtent(e){let t=this.flatCoordinates,n=this.stride;for(let r=0,i=t.length;r<i;r+=n){let n=t[r],i=t[r+1];if(pe(e,n,i))return!0}return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||=[],this.flatCoordinates.length=Cr(this.flatCoordinates,0,e,this.stride),this.changed()}};function wo(e,t,n,r){let i=[],a=me();for(let o=0,s=n.length;o<s;++o){let s=n[o];a=ve(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 To=class e extends cr{constructor(e,t,n){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!n&&!Array.isArray(e[0])){let r=e,i=[],a=[];for(let e=0,t=r.length;e<t;++e){let t=r[e],n=i.length,o=t.getEnds();for(let e=0,t=o.length;e<t;++e)o[e]+=n;g(i,t.getFlatCoordinates()),a.push(o)}t=r.length===0?this.getLayout():r[0].getLayout(),e=i,n=a}t!==void 0&&n?(this.setFlatCoordinates(t,e),this.endss_=n):this.setCoordinates(e,t)}appendPolygon(e){let t;if(!this.flatCoordinates)this.flatCoordinates=e.getFlatCoordinates().slice(),t=e.getEnds().slice(),this.endss_.push();else{let n=this.flatCoordinates.length;g(this.flatCoordinates,e.getFlatCoordinates()),t=e.getEnds().slice();for(let e=0,r=t.length;e<r;++e)t[e]+=n}this.endss_.push(t),this.changed()}clone(){let t=this.endss_.length,n=Array(t);for(let e=0;e<t;++e)n[e]=this.endss_[e].slice();let r=new e(this.flatCoordinates.slice(),this.layout,n);return r.applyProperties(this),r}closestPointXY(e,t,n,r){return r<de(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(vr(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),xr(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return Mr(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e,t)}getArea(){return mr(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(e){let t;return e===void 0?t=this.flatCoordinates:(t=this.getOrientedFlatCoordinates().slice(),ei(t,0,this.endss_,this.stride,e)),Or(t,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){let e=wo(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=Jr(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new Co(this.getFlatInteriorPoints().slice(),`XYM`)}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;Qr(e,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=ei(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){let n=[],r=[];return n.length=Wr(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(t),n,0,r),new e(n,`XY`,r)}getPolygon(e){if(e<0||this.endss_.length<=e)return null;let t;if(e===0)t=0;else{let n=this.endss_[e-1];t=n[n.length-1]}let n=this.endss_[e].slice(),r=n[n.length-1];if(t!==0)for(let e=0,r=n.length;e<r;++e)n[e]-=t;return new ni(this.flatCoordinates.slice(t,r),this.layout,n)}getPolygons(){let e=this.layout,t=this.flatCoordinates,n=this.endss_,r=[],i=0;for(let a=0,o=n.length;a<o;++a){let o=n[a].slice(),s=o[o.length-1];if(i!==0)for(let e=0,t=o.length;e<t;++e)o[e]-=i;let c=new ni(t.slice(i,s),e,o);r.push(c),i=s}return r}getType(){return`MultiPolygon`}intersectsExtent(e){return Rr(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,3),this.flatCoordinates||=[];let n=Tr(this.flatCoordinates,0,e,this.stride,this.endss_);if(n.length===0)this.flatCoordinates.length=0;else{let e=n[n.length-1];this.flatCoordinates.length=e.length===0?0:e[e.length-1]}this.changed()}},Eo=Gn(),Do=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`?_e(this.flatCoordinates_):ve(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){let e=Oe(this.getExtent());this.flatInteriorPoints_=qr(this.flatCoordinates_,0,this.ends_,this.stride_,e,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){let e=ti(this.flatCoordinates_,this.ends_),t=wo(this.flatCoordinates_,0,e,this.stride_);this.flatInteriorPoints_=Jr(this.flatCoordinates_,0,e,this.stride_,t)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||=Pi(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=Pi(e,t,i,this.stride_,.5);g(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=B(e);let t=e.getExtent(),n=e.getWorldExtent();if(t&&n){let e=I(n)/I(t);Jn(Eo,n[0],n[3],e,-e,0,0,0),tr(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,Eo,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=E((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=zr(r,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,r,0),i=[r.length];break;case`MultiLineString`:i=[],r.length=Br(r,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,r,0,i);break;case`Polygon`:i=[],r.length=Ur(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}};Do.prototype.getFlatCoordinates=Do.prototype.getOrientedFlatCoordinates;function Oo(e,t,n=0,r=e.length-1,i=Ao){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);Oo(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(ko(e,n,t),i(e[r],a)>0&&ko(e,n,r);o<s;){for(ko(e,o,s),o++,s--;i(e[o],a)<0;)o++;for(;i(e[s],a)>0;)s--}i(e[n],a)===0?ko(e,n,s):(s++,ko(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}}function ko(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function Ao(e,t){return e<t?-1:+(e>t)}var jo=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(!Uo(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;Uo(e,s)&&(t.leaf?n.push(o):Ho(e,s)?this._all(o,n):i.push(o))}t=i.pop()}return n}collides(e){let t=this.data;if(!Uo(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(Uo(e,a)){if(t.leaf||Ho(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=Wo([]),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=Mo(e,n.children,t);if(r!==-1)return n.children.splice(r,1),i.push(n),this._condense(i),this}!c&&!n.leaf&&Ho(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=Wo(e.slice(t,n+1)),No(o,this.toBBox),o;r||(r=Math.ceil(Math.log(i)/Math.log(a)),a=Math.ceil(i/a**(r-1))),o=Wo([]),o.leaf=!1,o.height=r;let s=Math.ceil(i/a),c=s*Math.ceil(Math.sqrt(a));Go(e,t,n,c,this.compareMinX);for(let i=t;i<=n;i+=c){let t=Math.min(i+c-1,n);Go(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 No(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=Ro(o),c=Bo(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),Fo(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=Wo(n.children.splice(a,n.children.length-a));o.height=n.height,o.leaf=n.leaf,No(n,this.toBBox),No(o,this.toBBox),t?e[t-1].children.push(o):this._splitRoot(n,o)}_splitRoot(e,t){this.data=Wo([e,t]),this.data.height=e.height+1,this.data.leaf=!1,No(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=Po(e,0,o,this.toBBox),s=Po(e,o,n,this.toBBox),c=Vo(t,s),l=Ro(t)+Ro(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:Io,i=e.leaf?this.compareMinY:Lo;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=Po(e,0,t,i),o=Po(e,n-t,n,i),s=zo(a)+zo(o);for(let r=t;r<n-t;r++){let t=e.children[r];Fo(a,e.leaf?i(t):t),s+=zo(a)}for(let r=n-t-1;r>=t;r--){let t=e.children[r];Fo(o,e.leaf?i(t):t),s+=zo(o)}return s}_adjustParentBBoxes(e,t,n){for(let r=n;r>=0;r--)Fo(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():No(e[t],this.toBBox)}};function Mo(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 No(e,t){Po(e,0,e.children.length,t,e)}function Po(e,t,n,r,i){i||=Wo(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];Fo(i,e.leaf?r(t):t)}return i}function Fo(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 Io(e,t){return e.minX-t.minX}function Lo(e,t){return e.minY-t.minY}function Ro(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function zo(e){return e.maxX-e.minX+(e.maxY-e.minY)}function Bo(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 Vo(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 Ho(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function Uo(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function Wo(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Go(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;Oo(e,o,t,n,i),a.push(t,o,o,n)}}var Ko=class{constructor(e){this.rbush_=new jo(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_[x(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_[x(a)]=o}this.rbush_.load(n)}remove(e){let t=x(e),n=this.items_[t];return delete this.items_[t],this.rbush_.remove(n)!==null}update(e,t){let n=this.items_[x(t)];ye([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 a(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){let t=this.rbush_.toJSON();return he(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]}},qo=class extends ne{constructor(e){super(),this.projection=B(e.projection),this.attributions_=Jo(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_=Jo(e),this.changed()}setState(e){this.state_=e,this.changed()}};function Jo(e){return e?typeof e==`function`?e:(Array.isArray(e)||(e=[e]),t=>e):null}var Yo={ADDFEATURE:`addfeature`,CHANGEFEATURE:`changefeature`,CLEAR:`clear`,REMOVEFEATURE:`removefeature`,FEATURESLOADSTART:`featuresloadstart`,FEATURESLOADEND:`featuresloadend`,FEATURESLOADERROR:`featuresloaderror`},Xo=class extends O{constructor(e,t,n){super(e),this.feature=t,this.features=n}},Zo=class extends qo{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_=T,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&&(M(this.format_,"`format` must be set when `url` is set"),this.loader_=bo(this.url_,this.format_)):this.loader_=e.loader,this.strategy_=e.strategy===void 0?xo:e.strategy;let t=e.useSpatialIndex===void 0||e.useSpatialIndex;this.featuresRtree_=t?new Ko:null,this.loadedExtentsRtree_=new Ko,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 ie(r)),r!==void 0&&this.addFeaturesInternal(r),n!==void 0&&this.bindFeaturesCollection_(n)}addFeature(e){this.addFeatureInternal(e),this.changed()}addFeatureInternal(e){let t=x(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 Xo(Yo.ADDFEATURE,e))}setupChangeEvents_(e,t){t instanceof Do||(this.featureChangeKeys_[e]=[o(t,l.CHANGE,this.handleFeatureChange_,this),o(t,r.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 Do){let r=this.idIndex_[e];r instanceof Do?Array.isArray(r)?r.push(t):this.idIndex_[e]=[r,t]:n=!1}else n=!1}return n&&(M(!(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=x(r);this.addToIndex_(i,r)&&n.push(r)}for(let e=0,i=n.length;e<i;e++){let i=n[e],a=x(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(Yo.ADDFEATURE))for(let e=0,t=n.length;e<t;e++)this.dispatchEvent(new Xo(Yo.ADDFEATURE,n[e]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener(Yo.ADDFEATURE,(function(n){!t&&n.feature&&(t=!0,e.push(n.feature),t=!1)})),this.addEventListener(Yo.REMOVEFEATURE,(function(n){!t&&n.feature&&(t=!0,e.remove(n.feature),t=!1)})),e.addEventListener(n.ADD,(e=>{t||=(t=!0,this.addFeature(e.element),!1)})),e.addEventListener(n.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(c);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 Xo(Yo.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 Do||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 Do||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(),a(this.nullGeometryFeatures_)||g(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 He(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||=C;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 Do?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=x(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 Xo(Yo.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 x(e)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&a(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 fe(e.extent,a)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new Xo(Yo.FEATURESLOADSTART));let e=e=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new Xo(Yo.FEATURESLOADEND,void 0,e))},i=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new Xo(Yo.FEATURESLOADERROR))},o=!1,s=this.loader_.call(this,a,t,n,t=>o||e(t),()=>o||i());S(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=Ne(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=x(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(c),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(Yo.REMOVEFEATURE)&&this.dispatchEvent(new Xo(Yo.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){M(this.format_,"`format` must be set when `url` is set"),this.url_=e,this.setLoader(bo(e,this.format_))}setOverlaps(e){this.overlaps_=e,this.changed()}},Qo=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=ma(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()===V.IDLE&&t.load(),t.getImageState()===V.LOADING&&(this.patternImage_=t)}this.color_=e}getKey(){let e=this.getColor();return e?e instanceof CanvasPattern||e instanceof CanvasGradient?x(e):typeof e==`object`&&`src`in e?e.src+`:`+e.offset:sa(e).toString():``}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}},$o=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}};function es(e){return e[0]>0&&e[1]>0}function ts(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 ns(e,t){return Array.isArray(e)?e:(t===void 0?t=[e,e]:(t[0]=e,t[1]=e),t)}var rs=class e{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=ns(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 y()}getImage(e){return y()}getHitDetectionImage(){return y()}getPixelRatio(e){return 1}getImageState(){return y()}getImageSize(){return y()}getOrigin(){return y()}getSize(){return y()}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_=ns(e)}listenImageChange(e){y()}load(){y()}unlistenImageChange(e){y()}ready(){return Promise.resolve()}},is=class e extends rs{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()?V.LOADING:V.LOADED,this.imageState_===V.LOADING&&this.ready().then(()=>this.imageState_=V.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=da.get(n,null)?.getImage(1);if(!r){let t=this.renderOptions_,i=Math.ceil(t.size*e),a=Si(i,i);this.draw_(t,a,e),r=a.canvas;let o=new pa(r,void 0,{},V.LOADED,null);da.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=Ma,t=Pa,n=0,r=null,i=0,a,o=0;this.stroke_&&(a=ha(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=ja),t.fillStyle=ha(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=sa(n)),n===null?r=1:Array.isArray(n)&&(r=n.length===4?n[3]:1),r===0&&(t=Si(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=ja,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()}},as=class e extends is{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}},os=class e{constructor(e){e||={},this.geometry_=null,this.geometryFunction_=us,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_=us,this.geometry_=e}setZIndex(e){this.zIndex_=e}};function ss(e){let t;if(typeof e==`function`)t=e;else{let n;Array.isArray(e)?n=e:(M(typeof e.getZIndex==`function`,"Expected an `Style` or an array of `Style`"),n=[e]),t=function(){return n}}return t}var cs=null;function ls(e,t){if(!cs){let e=new Qo({color:`rgba(255,255,255,0.4)`}),t=new $o({color:`#3399CC`,width:1.25});cs=[new os({image:new as({fill:e,stroke:t,radius:5}),fill:e,stroke:t})]}return cs}function us(e){return e.getGeometry()}var ds=`#333`,fs=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_=ns(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 Qo({color:ds}):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 Qo?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_=ns(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}},ps={ANIMATING:0,INTERACTING:1},U={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},ms=[U.FILL],hs=[U.STROKE],gs=[U.BEGIN_PATH],_s=[U.CLOSE_PATH],vs=class extends ba{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],P(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=F(c,d),h===m?h===se.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([U.CUSTOM,s,u,e,n,Or,i]),this.hitDetectionInstructions.push([U.CUSTOM,s,u,e,r||n,Or,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([U.CUSTOM,s,d,e,n,Dr,i]),this.hitDetectionInstructions.push([U.CUSTOM,s,d,e,r||n,Dr,i]);break;case`LineString`:case`Circle`:c=e.getFlatCoordinates(),l=this.appendFlatLineCoordinates(c,0,c.length,o,!1,!1),this.instructions.push([U.CUSTOM,s,l,e,n,Er,i]),this.hitDetectionInstructions.push([U.CUSTOM,s,l,e,r||n,Er,i]);break;case`MultiPoint`:c=e.getFlatCoordinates(),l=this.appendFlatPointCoordinates(c,o),l>s&&(this.instructions.push([U.CUSTOM,s,l,e,n,Er,i]),this.hitDetectionInstructions.push([U.CUSTOM,s,l,e,r||n,Er,i]));break;case`Point`:c=e.getFlatCoordinates(),this.coordinates.push(c[0],c[1]),l=this.coordinates.length,this.instructions.push([U.CUSTOM,s,l,e,n,void 0,i]),this.hitDetectionInstructions.push([U.CUSTOM,s,l,e,r||n,void 0,i])}this.endGeometry(t)}beginGeometry(e,t,n){this.beginGeometryInstruction1_=[U.BEGIN_GEOMETRY,t,0,e,n],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[U.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==U.END_GEOMETRY?a=t:i==U.BEGIN_GEOMETRY&&(r[2]=t,h(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=ha(n||`#000`)??void 0}else t.fillStyle=void 0;return t}strokeStyleToState(e,t={}){if(e){t.strokeStyle=ha(e.getColor()||`#000`)??void 0;let n=e.getLineCap();t.lineCap=n===void 0?Ma:n;let r=e.getLineDash();t.lineDash=r?r.slice():Na,t.lineDashOffset=e.getLineDashOffset()||0;let i=e.getLineJoin();t.lineJoin=i===void 0?Pa: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=[U.SET_FILL_STYLE,t];return typeof t!=`string`&&n.push(e.fillPatternScale),n}applyStroke(e){this.instructions.push(this.createStroke(e))}createStroke(e){return[U.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&&_(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=[U.END_GEOMETRY,e];this.instructions.push(t),this.hitDetectionInstructions.push(t)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=ue(this.maxExtent),this.maxLineWidth>0)){let e=this.resolution*(this.maxLineWidth+1)/2;le(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},ys=class extends vs{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&&!P(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([U.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([U.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||P(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([U.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([U.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)}},bs=class extends vs{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([U.MOVE_TO_LINE_TO,o,s,a]),this.hitDetectionInstructions.push([U.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([U.SET_STROKE_STYLE,Fa,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Na,0],gs);let s=e.getFlatCoordinates(),c=e.getStride();this.drawFlatCoordinates_(s,0,s.length,c,o),this.hitDetectionInstructions.push(hs),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([U.SET_STROKE_STYLE,Fa,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Na,0],gs);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(hs),this.endGeometry(t)}finish(){let e=this.state;return e&&e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&this.instructions.push(hs),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(hs),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(gs)}},xs=class extends vs{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(gs),this.hitDetectionInstructions.push(gs);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([U.MOVE_TO_LINE_TO,s,l,o*this.pixelRatio,!0]),this.hitDetectionInstructions.push([U.MOVE_TO_LINE_TO,s,l,o,!0]),c&&(this.instructions.push(_s),this.hitDetectionInstructions.push(_s)),t=a}return s&&(this.instructions.push(ms),this.hitDetectionInstructions.push(ms)),c&&(this.instructions.push(hs),this.hitDetectionInstructions.push(hs)),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([U.SET_FILL_STYLE,ja]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([U.SET_STROKE_STYLE,Fa,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Na,0]);let s=e.getFlatCoordinates(),c=e.getStride(),l=this.coordinates.length;this.appendFlatLineCoordinates(s,0,s.length,c,!1,!1);let u=[U.CIRCLE,l,o];this.instructions.push(gs,u),this.hitDetectionInstructions.push(gs,u),r.fillStyle!==void 0&&(this.instructions.push(ms),this.hitDetectionInstructions.push(ms)),r.strokeStyle!==void 0&&(this.instructions.push(hs),this.hitDetectionInstructions.push(hs)),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([U.SET_FILL_STYLE,ja]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([U.SET_STROKE_STYLE,Fa,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Na,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([U.SET_FILL_STYLE,ja]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([U.SET_STROKE_STYLE,Fa,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Na,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]=Vr(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)}},Ss=0,Cs=1;function ws(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 Ss=u,Cs=d,!0}function Ts(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(ws(i,a,o,s,h,g,n,r)){let e=n-h,t=r-g,i=h+Ss*e,a=g+Ss*t,o=h+Cs*e,s=g+Cs*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 Es(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=Xe(n,l,t),p=Xe(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=Xe(n,l,e/d),f=Xe(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 Ds(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 Os={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},ks={Circle:xs,Default:vs,Image:ys,LineString:bs,Polygon:xs,Text:class extends vs{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[ja]={fillStyle:ja},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(!Ie(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`)&&!fe(this.getBufferedMaxExtent(),r)){let e=Ts(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?Es(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=Ds(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??Ra;if(m!=Ra&&(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([U.DRAW_IMAGE,s,i,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,m==Ra?Ra: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]=ja),this.hitDetectionInstructions.push([U.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_?ja: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=Os[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([U.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([U.DRAW_CHARS,e,t,c,r.overflow,o&&ja,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=ha(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():Na,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=ha(a.getColor()||`#000`)||`#000`}n=this.textState_;let o=e.getFont()||`10px sans-serif`;Ga(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()||Ra,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:x(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:`|`+x(r.fillStyle):``}this.declutterMode_=e?e.getDeclutterMode():void 0,this.declutterImageWithText_=t}}},As=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=ks[t];i=new e(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[t]=i}return i}},js,Ms=RegExp(`[֑-ࣿיִ-﷿ﹰ-ﻼࠀ-࿿-]`);function Ns(){return js||=new Intl.Segmenter(void 0,{granularity:`grapheme`}),js}function Ps(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=Xe(h,p,b),S=Xe(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=Xe(h,p,b),D=Xe(g,m,b),O=!1;if(f){if(d){let e=[x,S,E,D];nr(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(Ns().segment(i),e=>e.segment),j=O!==Ms.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[j?i-e-1:e],u);if(t+r<n&&v+_<a+x+o/2)break;x+=o}if(e===f)continue;let S=(j?ne.slice(i-e,i-f):ne.slice(f,e)).join(``);b=_===0?0:(a+x/2-v)/_;let C=Xe(h,p,b),w=Xe(g,m,b);A.push([C,w,x/2,d,S]),a+=x}return A}var Fs=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(wi(),{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}},Is=me(),Ls=[],Rs=[],zs=[],Bs=[];function Vs(e){return e[3].declutterBox}function Hs(e,t){return t===`start`?t=Ms.test(e)?`right`:`left`:t===`end`&&(t=Ms.test(e)?`left`:`right`),Os[t]}function Us(e,t,n){return n>0&&e.push(`
4
+ `,``),e.push(t,``),e}function Ws(e,t,n){return n%2==0&&(e+=t),e}var Gs=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_=Gn(),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 Fs: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?Os[s.justify]:Hs(Array.isArray(e)?e[0]:e,s.textAlign||`center`),d=r&&a.lineWidth?a.lineWidth:0,f=Array.isArray(e)?e:String(e).split(`
5
+ `).reduce(Us,[]),{width:p,height:m,widths:h,heights:g,lineWidths:_}=Xa(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===`
6
+ `){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)&&(Ls[0]=S,Bs[0]=S,Ls[1]=C,Rs[1]=C,Rs[0]=S+b,zs[0]=Rs[0],zs[1]=C+x,Bs[1]=zs[1]);let w;return u===0?he(Math.min(S,S+b),Math.min(C,C+x),Math.max(S,S+b),Math.max(C,C+x),Is):(w=Jn(Gn(),n,r,1,1,u,-n,-r),qn(w,Ls),qn(w,Rs),qn(w,zs),qn(w,Bs),he(Math.min(Ls[0],Rs[0],zs[0],Bs[0]),Math.min(Ls[1],Rs[1],zs[1],Bs[1]),Math.max(Ls[0],Rs[0],zs[0],Bs[0]),Math.max(Ls[1],Rs[1],zs[1],Bs[1]),Is)),f&&(g=Math.round(g),_=Math.round(_)),{drawImageX:g,drawImageY:_,drawImageW:v,drawImageH:y,originX:c,originY:l,declutterBox:{minX:Is[0],minY:Is[1],maxX:Is[2],maxY:Is[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,Ls,Rs,zs,Bs,a,o),Za(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=qn(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=Hs(Array.isArray(e)?e[0]:e,i.textAlign||`center`),l=Os[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_&&_(n,this.renderedTransform_)?l=this.pixelCoordinates_:(this.pixelCoordinates_||=[],l=tr(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),Kn(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,k=0,A=0,ee=this.coordinateCache_,te=this.viewRotation_,ne=Math.round(Math.atan2(-n[1],n[0])*0xe8d4a51000)/0xe8d4a51000,j={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:te},re=this.instructions!=r||this.overlaps?0:200,ie,M,ae,oe;for(;u<d;){let n=r[u];switch(n[0]){case U.BEGIN_GEOMETRY:ie=n[1],oe=n[3],ie.getGeometry()?o!==void 0&&!Ie(o,oe.getExtent())?u=n[2]+1:++u:u=n[2],c&&(c.zIndex=n[4]);break;case U.BEGIN_PATH:k>re&&(this.fill_(e),k=0),A>re&&(e.stroke(),A=0),!k&&!A&&(e.beginPath(),b=NaN,x=NaN),++u;break;case U.CIRCLE:f=n[1],v=n[2]??0;let r=l[f],d=l[f+1],_=l[f+2]-v,se=l[f+3]-v,ce=_-r,N=se-d,le=Math.sqrt(ce*ce+N*N);e.moveTo(r+le,d),e.arc(r,d,le,0,2*Math.PI,!0),++u;break;case U.CLOSE_PATH:e.closePath(),++u;break;case U.CUSTOM:f=n[1],p=n[2];let ue=n[3],de=n[4],P=n[5];j.geometry=ue,j.feature=ie,u in ee||(ee[u]=[]);let fe=ee[u];P?P(l,f,p,2,fe):(fe[0]=l[f],fe[1]=l[f+1],fe.length=2),c&&(c.zIndex=n[6]),de(fe,j),++u;break;case U.DRAW_IMAGE:f=n[1],p=n[2],w=n[3],h=n[4],g=n[5];let pe=n[6],F=n[7],me=n[8],he=n[9],ge=n[10],_e=n[11],ve=n[12],ye=n[13];y=n[14]||`declutter`;let be=n[15];if(!w&&n.length>=20){T=n[19],E=n[20],D=n[21],O=n[22];let e=this.drawLabelWithPointPlacement_(T,E,D,O);w=e.label,n[3]=w;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=w.height,n[6]=pe,ye=w.width,n[13]=ye}let xe;n.length>25&&(xe=n[25]);let Se,Ce,we;n.length>17?(Se=n[16],Ce=n[17],we=n[18]):(Se=Ra,Ce=null,we=null),ge&&ne?_e+=te:!ge&&!ne&&(_e-=te);let Te=0;for(;f<p;f+=2){if(xe&&xe[Te++]<ye/this.pixelRatio)continue;let n=this.calculateImageOrLabelDimensions_(w.width,w.height,l[f],l[f+1],ye,pe,h,g,me,he,_e,ve,i,Se,!!Ce||!!we,ie),r=[e,t,w,n,F,Ce,we];if(s){let e,t,i;if(be){let n=p-f;if(!be[n]){be[n]={args:r,declutterMode:y};continue}let a=be[n];e=a.args,t=a.declutterMode,delete be[n],i=Vs(e)}let a,o;if(e&&(t!==`declutter`||!s.collides(i))&&(a=!0),y===`declutter`&&s.collides(n.declutterBox)||(o=!0),t===`declutter`&&y===`declutter`){let e=a&&o;a=e,o=e}a&&(t!==`none`&&s.insert(i),this.replayImageOrLabelArgs_(e)),o&&(y!==`none`&&s.insert(n.declutterBox),this.replayImageOrLabelArgs_(r))}else this.replayImageOrLabelArgs_(r)}++u;break;case U.DRAW_CHARS:let Ee=n[1],De=n[2],Oe=n[3],ke=n[4];O=n[5];let Ae=n[6],je=n[7],I=n[8];D=n[9];let Me=n[10];T=n[11],Array.isArray(T)&&(T=T.reduce(Ws,``)),E=n[12];let Ne=[n[13],n[13]];y=n[14]||`declutter`;let Pe=n[15],Fe=n[16],L=this.textStates[E],Le=L.font,Re=[L.scale[0]*je,L.scale[1]*je],ze;Le in this.widths_?ze=this.widths_[Le]:(ze={},this.widths_[Le]=ze);let Be=Li(l,Ee,De,2),Ve=Math.abs(Re[0])*Ya(Le,T,ze);if(ke||Ve<=Be){let n=this.textStates[E].textAlign,r=(Be-Ve)*Hs(T,n),i=Ps(l,Ee,De,2,T,r,Ae,Math.abs(Re[0]),Ya,Le,ze,ne?0:this.viewRotation_,Pe);drawChars:if(i){let n=[],r,a,o,c,l;if(D)for(r=0,a=i.length;r<a;++r){l=i[r],o=l[4],c=this.createLabel(o,E,``,D),h=l[2]+(Re[0]<0?-Me:Me)-Fe,g=Oe*c.height+(.5-Oe)*2*Me*Re[1]/Re[0]-I;let a=this.calculateImageOrLabelDimensions_(c.width,c.height,l[0],l[1],c.width,c.height,h,g,0,0,l[3],Ne,!1,Ra,!1,ie);if(s&&y===`declutter`&&s.collides(a.declutterBox))break drawChars;n.push([e,t,c,a,1,null,null])}if(O)for(r=0,a=i.length;r<a;++r){l=i[r],o=l[4],c=this.createLabel(o,E,O,``),h=l[2]-Fe,g=Oe*c.height-I;let a=this.calculateImageOrLabelDimensions_(c.width,c.height,l[0],l[1],c.width,c.height,h,g,0,0,l[3],Ne,!1,Ra,!1,ie);if(s&&y===`declutter`&&s.collides(a.declutterBox))break drawChars;n.push([e,t,c,a,1,null,null])}s&&y!==`none`&&s.load(n.map(Vs));for(let e=0,t=n.length;e<t;++e)this.replayImageOrLabelArgs_(n[e])}}++u;break;case U.END_GEOMETRY:if(a!==void 0){ie=n[1];let e=a(ie,oe,y);if(e)return e}++u;break;case U.FILL:re?k++:this.fill_(e),++u;break;case U.MOVE_TO_LINE_TO:f=n[1],p=n[2],v=n[3];let He,Ue,R;if(v){let e=(n[4]??!1)||Math.abs(l[f]-l[p-2])<1e-6&&Math.abs(l[f+1]-l[p-1])<1e-6;_a(l,f,p,2,v,e,m),ya(m,2,e),He=m,Ue=0,R=He.length}else He=l,Ue=f,R=p;M=He[Ue],ae=He[Ue+1],e.moveTo(M,ae),b=M+.5|0,x=ae+.5|0;for(let t=Ue+2;t<R;t+=2)M=He[t],ae=He[t+1],S=M+.5|0,C=ae+.5|0,(t==R-2||S!==b||C!==x)&&(e.lineTo(M,ae),b=S,x=C);++u;break;case U.SET_FILL_STYLE:this.alignAndScaleFill_=n[2],k?(this.fill_(e),k=0,A&&=(e.stroke(),0)):A&&n[1]&&(e.stroke(),A=0),e.fillStyle=n[1],++u;break;case U.SET_STROKE_STYLE:k&&n[1]&&(this.fill_(e),k=0),A&&=(e.stroke(),0),this.setStrokeStyle_(e,n),++u;break;case U.STROKE:re?A++:e.stroke(),++u;break;default:++u}}k&&this.fill_(e),A&&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)}},Ks=[`Polygon`,`Circle`,`LineString`,`Image`,`Text`,`Default`],qs=[`Image`,`Text`],Js=Ks.filter(e=>!qs.includes(e)),Ys=!1,Xs=!1;function Zs(){let e=0,t=t=>{let n=Si(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};Ys={[t(!0)]:!0,[t(!1)]:!1,[t(void 0)]:void 0}[e],Xs=!0}var Qs=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_=Gn(),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 Gs(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){Xs===!1&&Zs(),r=Math.round(r);let o=r*2+1,s=Jn(this.hitDetectionTransform_,r+.5,r+.5,1/t,-1/t,-n,-e[0],-e[1]),c=!this.hitDetectionContext_;c&&(this.hitDetectionContext_=Si(o,o,null,{willReadFrequently:Ys}));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=me(),xe(u,e),le(u,t*(this.renderBuffer_+r),u));let d=ec(r),p,m=l;function h(e,t,n){let s=m.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`||p!==`Image`&&p!==`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}m.clearRect(0,0,o,o);break}}let g=Object.keys(this.executorsByZIndex_).map(Number);g.sort(f);let _,v,y,b,x;for(_=g.length-1;_>=0;--_){let e=g[_].toString();for(y=this.executorsByZIndex_[e],v=Ks.length-1;v>=0;--v)if(p=Ks[v],b=y[p],b!==void 0&&(x=b.executeHitDetection(l,s,n,h,u),x))return x}}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 tr(o,0,8,2,e,o),o}isEmpty(){return a(this.executorsByZIndex_)}execute(e,t,n,r,i,a,o){let s=Object.keys(this.executorsByZIndex_).map(Number);s.sort(o?p:f),a||=Ks;let c=Ks.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+Ks.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(f);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}},$s={};function ec(e){if($s[e]!==void 0)return $s[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 $s[e]=i,i}function tc(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 nc=class e extends rs{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;M(!(o!==void 0&&a),"`image` and `src` cannot be provided at the same time"),(o===void 0||o.length===0)&&a&&(o=a.src||x(a)),M(o!==void 0&&o.length>0,"A defined and non-empty `src` or `image` must be provided"),M(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?V.LOADED:V.IDLE:V.LOADING:V.LOADED):s=V.IDLE,this.color_=e.color===void 0?null:sa(e.color),this.iconImage_=ma(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(tc(n[0],n[1],e.width,e.height))};this.listenImageChange(t);return}}t!==void 0&&this.setScale(tc(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?sa(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():V.IDLE;this.iconImage_=ma(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_=ma(null,e,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},V.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()==V.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()==V.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(l.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(l.CHANGE,e)}ready(){return this.iconImage_.ready()}},rc=.5;function ic(e,t,n,r,i,a,o,s,c){let l=c?zn(i,c):i,u=Si(e[0]*rc,e[1]*rc);u.imageSmoothingEnabled=!1;let d=u.canvas,p=new $a(u,rc,i,[1,0,0,1,0,0],o,s??0,c?An(In(),c)??void 0:void 0),m=n.length,h=Math.floor(16777215/m),g={};for(let e=1;e<=m;++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*h).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||!Ie(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=Si(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 nc({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=g[d];f||(f={},g[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 _=Object.keys(g).map(Number).sort(f);for(let e=0,n=_.length;e<n;++e){let n=g[_[e]];for(let e in n){let r=n[e];for(let e=0,n=r.length;e<n;e+=2){p.setStyle(r[e+1]);for(let n=0,i=t.length;n<i;++n)p.setTransform(t[n]),p.drawGeometry(r[e])}}}return u.getImageData(0,0,d.width,d.height)}function ac(e,t,n){let r=[];if(n){let i=Math.floor(Math.round(e[0])*rc),a=Math.floor(Math.round(e[1])*rc),o=(R(i,0,n.width-1)+R(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 oc=class extends O{constructor(e,t,n,r){super(e),this.inversePixelTransform=t,this.frameState=n,this.context=r??void 0}},sc=5,cc=class extends A{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.staleKeys_=[],this.maxStaleKeys=sc,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 y()}getData(e){return null}prepareFrame(e){return y()}renderFrame(e,t){return y()}forEachFeatureAtCoordinate(e,t,n,r,i){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){let t=e.target;(t.getState()===V.LOADED||t.getState()===V.ERROR)&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=V.LOADED&&t!=V.ERROR&&e.addEventListener(l.CHANGE,this.boundHandleImageChange_),t==V.IDLE&&(e.load(),t=e.getState()),t==V.LOADED}renderIfReadyAndVisible(){let e=this.getLayer();e&&e.getVisible()&&e.getSourceState()===`ready`&&e.changed()}renderDeferred(e){}disposeInternal(){this.layer_=void 0,super.disposeInternal()}},lc=[],uc=null;function dc(){uc=Si(1,1,void 0,{willReadFrequently:!0})}var fc=class extends cc{constructor(e){super(e),this.wantRotation=!1,this.container=null,this.renderedResolution,this.tempTransform=Gn(),this.pixelTransform=Gn(),this.inversePixelTransform=Gn(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,n){uc||dc();let r=uc;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 uc=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(Ai(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&&_(sa(e.style.backgroundColor),sa(n)))){let t=e.firstElementChild;Ai(t)&&(s=t.getContext(`2d`))}if(s&&er(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=ci?ki():document.createElement(`div`),o.className=a;let e=o.style;e.position=`absolute`,e.width=`100%`,e.height=`100%`,s=Si();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=Pe(n),i=Fe(n),a=De(n),o=Ee(n);qn(t.coordinateToPixelTransform,r),qn(t.coordinateToPixelTransform,i),qn(t.coordinateToPixelTransform,a),qn(t.coordinateToPixelTransform,o);let s=this.inversePixelTransform;qn(s,r),qn(s,i),qn(s,a),qn(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:L(n)/r*o),c=Math.round(i?e.size[1]*o:I(n)/r*o);Jn(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/o,1/o,a,-s/2,-c/2),Yn(this.inversePixelTransform,this.pixelTransform);let l=Qn(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 oc(e,this.inversePixelTransform,n,t);r.dispatchEvent(i)}}preRender(e,t){this.frameState=t,t.declutter||this.dispatchRenderEvent_(_o.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(_o.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new Fs),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_(_o.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(_o.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 Jn(this.tempTransform,s,c,l,u,-n,d,f)}sourceRotates(){return this.wantRotation&&!!this.getLayer().getSource()?.canRotate}disposeInternal(){delete this.frameState,super.disposeInternal()}},pc=class extends fc{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_=me(),this.wrappedRenderedExtent_=me(),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[ps.ANIMATING]||p[ps.INTERACTING]),h=this.context,g=h.canvas.width,_=h.canvas.height,v=u.getWrapX()&&s.canWrapX(),y=v?L(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?Ks:n?qs:Js,n?d&&t.declutter[d]:void 0)}while(++S<x)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=Si(this.context.canvas.width,this.context.canvas.height,lc))}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,Ti(this.context),lc.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(_o.PRERENDER)||this.getLayer().hasListener(_o.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=Bn(n.extent,s);o=Ie(t,e.extent),o&&!fe(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]*rc,l=e[1]*rc;s.push(this.getRenderTransform(t,n,r,rc,c,l,0).slice());let u=o.getSource(),d=i.getExtent();if(u.getWrapX()&&i.canWrapX()&&!fe(d,a)){let e=a[0],i=L(d),o=0,u;for(;e<d[0];)--o,u=i*o,s.push(this.getRenderTransform(t,n,r,rc,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,rc,c,l,u).slice()),e-=i}let f=In();this.hitDetectionImageData_=ic(e,s,this.renderedFeatures_,o.getStyleFunction(),a,n,r,ro(n,this.renderedPixelRatio_),f?i:null)}t(ac(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=x(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[ps.ANIMATING],i=e.viewHints[ps.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=no);let h=c.center.slice(),g=le(s,p*u),v=g.slice(),y=[g.slice()],b=l.getExtent(),x=n.getWrapX()&&l.canWrapX();if(this.extendX_=!1,x){let e=n.getExtent();e&&!Le(e)&&(this.extendX_=e[0]<b[0]||e[2]>b[2])}if(x&&(!fe(b,e.extent)||this.extendX_)){let e=L(b),t=Math.max(L(g)/2,e),n=b[0],r=b[2];this.extendX_&&(n-=e,r+=e),g[0]=n-t,g[2]=r+t,lt(h,l);let i=Ve(y[0],l);i[0]<b[0]&&i[2]<b[2]?y.push([i[0]+e,i[1],i[2]+e,i[3]]):i[0]>b[0]&&i[2]>b[2]&&y.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&&fe(this.wrappedRenderedExtent_,g))return _(this.renderedExtent_,v)||(this.hitDetectionImageData_=null,this.renderedExtent_=v),this.renderedCenter_=h,this.replayGroupChanged=!1,!0;this.replayGroup_=null;let S=new As(io(u,d),g,u,d),C=In(),w;if(C){for(let e=0,t=y.length;e<t;++e){let t=y[e],r=zn(t,l);n.loadFeatures(r,Vn(u,l),C)}w=An(C,l)}else for(let e=0,t=y.length;e<t;++e)n.loadFeatures(y[e],u,l);let T=ro(u,d),E=!0,D=(e,n)=>{let r,i=e.getStyleFunction()||t.getStyleFunction();if(i&&(r=i(e,u)),r){let t=this.renderFeature(e,T,r,S,w,this.getLayer().getDeclutter(),n);E&&=!t}},O=zn(g,l),k=n.getFeaturesInExtent(O);m&&k.sort(m);for(let e=0,t=k.length;e<t;++e)D(k[e],e);this.renderedFeatures_=k,this.ready=E;let A=S.finish(),ee=new Qs(g,u,d,n.getOverlaps(),A,t.getRenderBuffer(),!!e.declutter);return this.renderedResolution_=u,this.renderedRevision_=f,this.renderedRenderOrder_=m,this.renderedFrameDeclutter_=!!e.declutter,this.renderedExtent_=v,this.wrappedRenderedExtent_=g,this.renderedCenter_=h,this.renderedProjection_=l,this.renderedPixelRatio_=d,this.replayGroup_=ee,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=oo(r,e,n[c],t,this.boundHandleStyleImageChange_,i,a,o)||s;else s=oo(r,e,n,t,this.boundHandleStyleImageChange_,i,a,o);return s}},mc=0,hc=1<<mc++,W=1<<mc++,gc=1<<mc++,_c=1<<mc++,vc=1<<mc++,yc=1<<mc++,bc=2**mc-1,xc={[hc]:`boolean`,[W]:`number`,[gc]:`string`,[_c]:`color`,[vc]:`number[]`,[yc]:`size`},Sc=Object.keys(xc).map(Number).sort(f);function Cc(e){return e in xc}function wc(e){let t=[];for(let n of Sc)Tc(e,n)&&t.push(xc[n]);return t.length===0?`untyped`:t.length<3?t.join(` or `):t.slice(0,-1).join(`, `)+`, or `+t[t.length-1]}function Tc(e,t){return(e&t)===t}function Ec(e,t){return!!(e&t)}function Dc(e,t){return e===t}function Oc(e){return e instanceof Error?e.message:String(e)}var kc=class{constructor(e,t){if(!Cc(e))throw Error(`literal expressions must have a specific type, got ${wc(e)}`);this.type=e,this.value=t}},Ac=class{constructor(e,t,...n){this.type=e,this.operator=t,this.args=n}};function jc(e){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:e}}function Mc(e,t,n){switch(typeof e){case`boolean`:if(Dc(t,gc))return new kc(gc,e?`true`:`false`);if(!Tc(t,hc))throw Error(`got a boolean, but expected ${wc(t)}`);return new kc(hc,e);case`number`:if(Dc(t,yc))return new kc(yc,ns(e));if(Dc(t,hc))return new kc(hc,!!e);if(Dc(t,gc))return new kc(gc,e.toString());if(!Tc(t,W))throw Error(`got a number, but expected ${wc(t)}`);return new kc(W,e);case`string`:if(Dc(t,_c))return new kc(_c,oa(e));if(Dc(t,hc))return new kc(hc,!!e);if(!Tc(t,gc))throw Error(`got a string, but expected ${wc(t)}`);return new kc(gc,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 Zc(e,t,n);for(let t of e)if(typeof t!=`number`)throw Error(`expected an array of numbers`);if(Dc(t,yc)){if(e.length!==2)throw Error(`expected an array of two values for a size, got ${e.length}`);return new kc(yc,e)}if(Dc(t,_c)){if(e.length===3)return new kc(_c,[...e,1]);if(e.length===4)return new kc(_c,e);throw Error(`expected an array of 3 or 4 values for a color, got ${e.length}`)}if(!Tc(t,vc))throw Error(`got an array of numbers, but expected ${wc(t)}`);return new kc(vc,e)}var G={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`},Nc={[G.Get]:J(K(1,1/0),Pc),[G.Var]:Fc(),[G.Has]:J(K(1,1/0),Pc),[G.Id]:J(Ic,Bc),[G.Concat]:J(K(2,1/0),q(gc)),[G.GeometryType]:J(Lc,Bc),[G.LineMetric]:J(Rc,Bc),[G.Resolution]:J(zc,Bc),[G.Zoom]:J(zc,Bc),[G.Time]:J(zc,Bc),[G.Any]:J(K(2,1/0),q(hc)),[G.All]:J(K(2,1/0),q(hc)),[G.Not]:J(K(1,1),q(hc)),[G.Equal]:J(K(2,2),Hc()),[G.NotEqual]:J(K(2,2),Hc()),[G.GreaterThan]:J(K(2,2),q(W)),[G.GreaterThanOrEqualTo]:J(K(2,2),q(W)),[G.LessThan]:J(K(2,2),q(W)),[G.LessThanOrEqualTo]:J(K(2,2),q(W)),[G.Multiply]:J(K(2,1/0),Vc),[G.Coalesce]:J(K(2,1/0),Vc),[G.Divide]:J(K(2,2),q(W)),[G.Add]:J(K(2,1/0),q(W)),[G.Subtract]:J(K(2,2),q(W)),[G.Clamp]:J(K(3,3),q(W)),[G.Mod]:J(K(2,2),q(W)),[G.Pow]:J(K(2,2),q(W)),[G.Abs]:J(K(1,1),q(W)),[G.Floor]:J(K(1,1),q(W)),[G.Ceil]:J(K(1,1),q(W)),[G.Round]:J(K(1,1),q(W)),[G.Sin]:J(K(1,1),q(W)),[G.Cos]:J(K(1,1),q(W)),[G.Atan]:J(K(1,2),q(W)),[G.Sqrt]:J(K(1,1),q(W)),[G.Match]:J(K(4,1/0),Wc,Gc),[G.Between]:J(K(3,3),q(W)),[G.Interpolate]:J(K(6,1/0),Wc,qc),[G.InterpolateHcl]:J(K(6,1/0),Wc,Kc,qc),[G.Case]:J(K(3,1/0),Uc,Jc),[G.In]:J(K(2,2),Yc),[G.Number]:J(K(1,1/0),q(bc)),[G.String]:J(K(1,1/0),q(bc)),[G.Array]:J(K(1,1/0),q(W)),[G.Color]:J(K(1,4),q(W)),[G.Band]:J(K(1,3),q(W)),[G.Palette]:J(K(2,2),Xc),[G.ToString]:J(K(1,1),q(hc|W|gc|_c))};function Pc(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 kc(W,r);break;case`string`:i[a]=new kc(gc,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 Fc(){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=Mc(a,bc,n);if(!(e instanceof kc))throw Error(`style variables should only be literal values (no expressions!), variable name: ${r}`);let o=e.type;if(typeof a==`string`&&Ec(i,_c)&&!Ec(i,gc)?o=_c:Array.isArray(a)&&a.length===2&&Ec(i,yc)&&!Ec(i,vc)&&(o=yc),i&=o,i===0)throw Error(`the type expected from the var operator (${wc(t)}) did not have any overlap with the type of the corresponding style variables (${wc(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 (${wc(t)}) did not have any overlap with the previous type expected for it (${wc(e)}), variable name: ${r}`)}return n.variables.set(r,i),new Ac(i,`var`,new kc(gc,r))}}function Ic(e,t,n){n.featureId=!0}function Lc(e,t,n){n.geometryType=!0}function Rc(e,t,n){n.mCoordinate=!0}function zc(e,t,n){n.mapState=!0}function Bc(e,t,n){let r=e[0];if(e.length!==1)throw Error(`expected no arguments for ${r} operation`);return[]}function K(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 Vc(e,t,n){let r=e.length-1,i=Array(r);for(let a=0;a<r;++a){let r=Mc(e[a+1],t,n);i[a]=r}return i}function q(e){return function(t,n,r){let i=t.length-1,a=Array(i);for(let n=0;n<i;++n){let i=Mc(t[n+1],e,r);a[n]=i}return a}}function Hc(){return function(e,t,n){let r=e[0],i=e.length-1,a=Array(i),o=bc;for(let t=0;t<i;++t){let r=Mc(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=Mc(e[t+1],o,n);a[t]=r}return a}}function Uc(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 Wc(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 Gc(e,t,n){let r=e.length-1,i=Mc(e[e.length-1],t,n),a=gc|W|hc,o=Array(r-2);for(let t=0;t<r-2;t+=2){try{let r=Mc(e[t+2],a,n);a&=r.type}catch(e){let n=Oc(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=Mc(e[t+2],a,n);o[t]=r}catch(e){let n=Oc(e);throw Error(`failed to parse argument ${t+1} of match expression: ${n}`)}try{let r=Mc(e[t+3],i.type,n);o[t+1]=r}catch(e){throw Error(`failed to parse argument ${t+2} of match expression: ${Oc(e)}`)}}return[Mc(e[1],a,n),...o,i]}function Kc(e,t,n){if(!Tc(t,_c))throw Error(`the ${e[0]} operator can only return a color, got ${wc(t)}`)}function qc(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 kc(W,i),o;try{o=Mc(e[2],W,n)}catch(e){throw Error(`failed to parse argument 1 in interpolate expression: ${Oc(e)}`)}let s=Array(e.length-3);for(let r=0;r<s.length;r+=2){try{let t=Mc(e[r+3],W,n);s[r]=t}catch(e){throw Error(`failed to parse argument ${r+2} for interpolate expression: ${Oc(e)}`)}try{let i=Mc(e[r+4],t,n);s[r+1]=i}catch(e){throw Error(`failed to parse argument ${r+3} for interpolate expression: ${Oc(e)}`)}}return[a,o,...s]}function Jc(e,t,n){let r=Mc(e[e.length-1],t,n),i=Array(e.length-1);for(let t=0;t<i.length-1;t+=2){try{let r=Mc(e[t+1],hc,n);i[t]=r}catch(e){throw Error(`failed to parse argument ${t} of case expression: ${Oc(e)}`)}try{let a=Mc(e[t+2],r.type,n);i[t+1]=a}catch(e){throw Error(`failed to parse argument ${t+1} of case expression: ${Oc(e)}`)}}return i[i.length-1]=r,i}function Yc(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`?gc:W;let a=Array(r.length);for(let e=0;e<a.length;e++)try{let t=Mc(r[e],i,n);a[e]=t}catch(t){throw Error(`failed to parse haystack item ${e} for "in" expression: ${Oc(t)}`)}return[Mc(e[1],i,n),...a]}function Xc(e,t,n){let r;try{r=Mc(e[1],W,n)}catch(e){throw Error(`failed to parse first argument in palette expression: ${Oc(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=Mc(i[e],_c,n)}catch(t){throw Error(`failed to parse color at index ${e} in palette expression: ${Oc(t)}`)}if(!(t instanceof kc))throw Error(`the palette color at index ${e} must be a literal value`);a[e]=t}return[r,...a]}function J(...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 Ac(n,i,...a)}}function Zc(e,t,n){let r=e[0],i=Nc[r];if(!i)throw Error(`unknown operator: ${r}`);return i(e,t,n)}function Qc(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 Qc(e.getGeometries()[0]);default:return``}}function $c(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:``}}function el(e,t,n){return tl(Mc(e,t,n),n)}function tl(e,t){if(e instanceof kc){if(e.type===_c&&typeof e.value==`string`){let t=oa(e.value);return function(){return t}}return function(){return e.value}}let n=e.operator;switch(n){case G.Number:case G.String:case G.Coalesce:return il(e,t);case G.Get:case G.Var:case G.Has:return al(e,t);case G.Id:return e=>e.featureId??``;case G.GeometryType:return e=>e.geometryType;case G.Concat:{let n=e.args.map(e=>tl(e,t));return e=>``.concat(...n.map(t=>(t(e)??``).toString()))}case G.Resolution:return e=>e.resolution;case G.Any:case G.All:case G.Between:case G.In:case G.Not:return sl(e,t);case G.Equal:case G.NotEqual:case G.LessThan:case G.LessThanOrEqualTo:case G.GreaterThan:case G.GreaterThanOrEqualTo:return ol(e,t);case G.Multiply:case G.Divide:case G.Add:case G.Subtract:case G.Clamp:case G.Mod:case G.Pow:case G.Abs:case G.Floor:case G.Ceil:case G.Round:case G.Sin:case G.Cos:case G.Atan:case G.Sqrt:return cl(e,t);case G.Case:return ll(e,t);case G.Match:return ul(e,t);case G.Interpolate:case G.InterpolateHcl:return dl(e,t);case G.ToString:return fl(e,t);case G.Array:return nl(e,t);case G.Color:return rl(e,t);default:throw Error(`Unsupported operator ${n}`)}}function nl(e,t){let n=e.args.length,r=Array(n);for(let i=0;i<n;++i)r[i]=tl(e.args[i],t);if(e.type===_c&&(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 rl(e,t){let n=e.args.length,r=Array(n);for(let i=0;i<n;++i)r[i]=tl(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 il(e,t){let n=e.operator,r=e.args.length,i=Array(r);for(let n=0;n<r;++n)i[n]=tl(e.args[n],t);switch(n){case G.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 G.Number:case G.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 al(e,t){let n=e.args[0].value;switch(e.operator){case G.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 G.Var:return e=>e.variables[n];case G.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 ol(e,t){let n=e.operator,r=tl(e.args[0],t),i=tl(e.args[1],t);switch(n){case G.Equal:return e=>r(e)===i(e);case G.NotEqual:return e=>r(e)!==i(e);case G.LessThan:return e=>r(e)<i(e);case G.LessThanOrEqualTo:return e=>r(e)<=i(e);case G.GreaterThan:return e=>r(e)>i(e);case G.GreaterThanOrEqualTo:return e=>r(e)>=i(e);default:throw Error(`Unsupported comparison operator ${n}`)}}function sl(e,t){let n=e.operator,r=e.args.length,i=Array(r);for(let n=0;n<r;++n)i[n]=tl(e.args[n],t);switch(n){case G.Any:return e=>{for(let t=0;t<r;++t)if(i[t](e))return!0;return!1};case G.All:return e=>{for(let t=0;t<r;++t)if(!i[t](e))return!1;return!0};case G.Between:return e=>{let t=i[0](e),n=i[1](e),r=i[2](e);return t>=n&&t<=r};case G.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 G.Not:return e=>!i[0](e);default:throw Error(`Unsupported logical operator ${n}`)}}function cl(e,t){let n=e.operator,r=e.args.length,i=Array(r);for(let n=0;n<r;++n)i[n]=tl(e.args[n],t);switch(n){case G.Multiply:return e=>{let t=1;for(let n=0;n<r;++n)t*=i[n](e);return t};case G.Divide:return e=>i[0](e)/i[1](e);case G.Add:return e=>{let t=0;for(let n=0;n<r;++n)t+=i[n](e);return t};case G.Subtract:return e=>i[0](e)-i[1](e);case G.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 G.Mod:return e=>i[0](e)%i[1](e);case G.Pow:return e=>i[0](e)**+i[1](e);case G.Abs:return e=>Math.abs(i[0](e));case G.Floor:return e=>Math.floor(i[0](e));case G.Ceil:return e=>Math.ceil(i[0](e));case G.Round:return e=>Math.round(i[0](e));case G.Sin:return e=>Math.sin(i[0](e));case G.Cos:return e=>Math.cos(i[0](e));case G.Atan:return r===2?e=>Math.atan2(i[0](e),i[1](e)):e=>Math.atan(i[0](e));case G.Sqrt:return e=>Math.sqrt(i[0](e));default:throw Error(`Unsupported numeric operator ${n}`)}}function ll(e,t){let n=e.args.length,r=Array(n);for(let i=0;i<n;++i)r[i]=tl(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 ul(e,t){let n=e.args.length,r=Array(n);for(let i=0;i<n;++i)r[i]=tl(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 dl(e,t){let n=e.args.length,r=Array(n);for(let i=0;i<n;++i)r[i]=tl(e.args[i],t);let i=e.operator===G.InterpolateHcl?hl:ml;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=$i(l)),n>=a)return c===2?l:u?i(t,a,o,s,n,l):pl(t,a,o,s,n,l);o=n,s=l}return s}}function fl(e,t){let n=e.operator,r=e.args.length,i=Array(r);for(let n=0;n<r;++n)i[n]=tl(e.args[n],t);switch(n){case G.ToString:return t=>{let n=i[0](t);return e.args[0].type===_c?ca(n):n.toString()};default:throw Error(`Unsupported convert operator ${n}`)}}function pl(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 ml(e,t,n,r,i,a){return i-n===0?r:[pl(e,t,n,r[0],i,a[0]),pl(e,t,n,r[1],i,a[1]),pl(e,t,n,r[2],i,a[2]),pl(e,t,n,r[3],i,a[3])]}function hl(e,t,n,r,i,a){if(i-n===0)return r;let o=ia(r),s=ia(a),c=s[2]-o[2];return c>180?c-=360:c<-180&&(c+=360),aa([pl(e,t,n,o[0],i,s[0]),pl(e,t,n,o[1],i,s[1]),o[2]+pl(e,t,n,0,i,c),pl(e,t,n,r[3],i,a[3])])}function gl(e){return!0}function _l(e,t){t??=jc();let n=bl(e,t),r=$c();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=Qc(t))}return n(r)}}function vl(e,t){t??=jc();let n=e.length,r=Array(n);for(let i=0;i<n;++i)r[i]=xl(e[i],t);let i=$c(),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=Qc(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 yl(e,t){if(t??=jc(),!Array.isArray(e))return vl([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 _l(r,t)}return vl(e,t)}function bl(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?el(n.filter,hc,t):gl,o;if(Array.isArray(n.style)){let e=n.style.length;o=Array(e);for(let r=0;r<e;++r)o[r]=xl(n.style[r],t)}else o=[xl(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 xl(e,t){let n=Sl(e,``,t),r=Cl(e,``,t),i=wl(e,t),o=Tl(e,t),s=Al(e,`z-index`,t);if(!n&&!r&&!i&&!o&&!a(e))throw Error(`No fill, stroke, point, or text symbolizer properties in style: `+JSON.stringify(e));let c=new os;return function(e){let t=!0;if(n){let r=n(e);r&&(t=!1),c.setFill(r)}if(r){let n=r(e);n&&(t=!1),c.setStroke(n)}if(i){let n=i(e);n&&(t=!1),c.setText(n)}if(o){let n=o(e);n&&(t=!1),c.setImage(n)}return s&&c.setZIndex(s(e)),t?null:c}}function Sl(e,t,n){let r;if(t+`fill-pattern-src`in e)r=Ml(e,t+`fill-`,n);else{if(kl(e,t+`fill-color`)===`none`)return e=>null;r=Pl(e,t+`fill-color`,n)}if(!r)return null;let i=new Qo;return function(e){let t=r(e);return t===zi?null:(i.setColor(t),i)}}function Cl(e,t,n){let r=Al(e,t+`stroke-width`,n),i=Pl(e,t+`stroke-color`,n);if(!r&&!i)return null;let a=jl(e,t+`stroke-line-cap`,n),o=jl(e,t+`stroke-line-join`,n),s=Fl(e,t+`stroke-line-dash`,n),c=Al(e,t+`stroke-line-dash-offset`,n),l=Al(e,t+`stroke-miter-limit`,n),u=Al(e,t+`stroke-offset`,n),d=new $o;return function(e){if(i){let t=i(e);if(t===zi)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 wl(e,t){let n=`text-`,r=jl(e,`text-value`,t);if(!r)return null;let i=Sl(e,n,t),a=Sl(e,`text-background-`,t),o=Cl(e,n,t),s=Cl(e,`text-background-`,t),c=jl(e,`text-font`,t),l=Al(e,`text-max-angle`,t),u=Al(e,`text-offset-x`,t),d=Al(e,`text-offset-y`,t),f=Nl(e,`text-overflow`,t),p=jl(e,`text-placement`,t),m=Al(e,`text-repeat`,t),h=Rl(e,`text-scale`,t),g=Nl(e,`text-rotate-with-view`,t),_=Al(e,`text-rotation`,t),v=jl(e,`text-align`,t),y=jl(e,`text-justify`,t),b=jl(e,`text-baseline`,t),x=Nl(e,`text-keep-upright`,t),S=Fl(e,`text-padding`,t),C=new fs({declutterMode:Gl(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 Tl(e,t){return`icon-src`in e?El(e,t):`shape-points`in e?Dl(e,t):`circle-radius`in e?Ol(e,t):null}function El(e,t){let n=`icon-src`,r=ql(kl(e,n),n),i=Il(e,`icon-anchor`,t),a=Rl(e,`icon-scale`,t),o=Al(e,`icon-opacity`,t),s=Il(e,`icon-displacement`,t),c=Al(e,`icon-rotation`,t),l=Nl(e,`icon-rotate-with-view`,t),u=Hl(e,`icon-anchor-origin`),d=Ul(e,`icon-anchor-x-units`),f=Ul(e,`icon-anchor-y-units`),p=kl(e,`icon-color`),m,h=null;p!==void 0&&(Array.isArray(p)&&p.length>0&&typeof p[0]==`string`?h=Pl(e,`icon-color`,t):m=Yl(p,`icon-color`));let g=Vl(e,`icon-cross-origin`),_=Wl(e,`icon-offset`),v=Hl(e,`icon-offset-origin`),y=zl(e,`icon-width`),b={src:r,anchorOrigin:u,anchorXUnits:d,anchorYUnits:f,crossOrigin:g,offset:_,offsetOrigin:v,height:zl(e,`icon-height`),width:y,size:Bl(e,`icon-size`),declutterMode:Gl(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 nc(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 Dl(e,t){let n=`shape-`,r=`shape-points`,i=`shape-radius`,a=Jl(kl(e,r),r);if(!(i in e))throw Error(`Expected a number for ${i}`);let o=Al(e,i,t),s=kl(e,i),c=typeof s==`number`?s:5,l=`shape-radius2`,u=Al(e,l,t),d=kl(e,l),f=typeof d==`number`?d:void 0,p=Sl(e,n,t),m=Cl(e,n,t),h=Rl(e,`shape-scale`,t),g=Il(e,`shape-displacement`,t),_=Al(e,`shape-rotation`,t),v=Nl(e,`shape-rotate-with-view`,t),y=new is({points:a,radius:c,radius2:f,angle:zl(e,`shape-angle`),declutterMode:Gl(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 Ol(e,t){let n=`circle-`,r=Sl(e,n,t),i=Cl(e,n,t),a=Al(e,`circle-radius`,t),o=Rl(e,`circle-scale`,t),s=Il(e,`circle-displacement`,t),c=Al(e,`circle-rotation`,t),l=Nl(e,`circle-rotate-with-view`,t),u=new as({radius:5,declutterMode:Gl(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 kl(e,t){if(!(t in e))return;let n=e[t];return n===void 0?void 0:n}function Al(e,t,n){let r=kl(e,t);if(r===void 0)return;let i=el(r,W,n);return function(e){return Jl(i(e),t)}}function jl(e,t,n){let r=kl(e,t);if(r===void 0)return null;let i=el(r,gc,n);return function(e){return ql(i(e),t)}}function Ml(e,t,n){let r=jl(e,t+`pattern-src`,n),i=Ll(e,t+`pattern-offset`,n),a=Ll(e,t+`pattern-size`,n),o=Pl(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 Nl(e,t,n){let r=kl(e,t);if(r===void 0)return null;let i=el(r,hc,n);return function(e){let n=i(e);if(typeof n!=`boolean`)throw Error(`Expected a boolean for ${t}`);return n}}function Pl(e,t,n){let r=kl(e,t);if(r===void 0)return null;let i=el(r,_c,n);return function(e){return Yl(i(e),t)}}function Fl(e,t,n){let r=kl(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=el(e,W,n);return function(e){return Jl(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=el(r,vc,n);return function(e){return Kl(i(e),t)}}function Il(e,t,n){let r=kl(e,t);if(r===void 0)return null;let i=el(r,vc,n);return function(e){let n=Kl(i(e),t);if(n.length!==2)throw Error(`Expected two numbers for ${t}`);return n}}function Ll(e,t,n){let r=kl(e,t);if(r===void 0)return null;let i=el(r,vc,n);return function(e){return Xl(i(e),t)}}function Rl(e,t,n){let r=kl(e,t);if(r===void 0)return null;let i=el(r,vc|W,n);return function(e){return Zl(i(e),t)}}function zl(e,t){let n=kl(e,t);if(n!==void 0){if(typeof n!=`number`)throw Error(`Expected a number for ${t}`);return n}}function Bl(e,t){let n=kl(e,t);if(n!==void 0){if(typeof n==`number`)return ns(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 Vl(e,t){let n=kl(e,t);if(n!==void 0){if(typeof n!=`string`)throw Error(`Expected a string for ${t}`);return n}}function Hl(e,t){let n=kl(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 Ul(e,t){let n=kl(e,t);if(n!==void 0){if(n!==`pixels`&&n!==`fraction`)throw Error(`Expected pixels or fraction for ${t}`);return n}}function Wl(e,t){let n=kl(e,t);if(n!==void 0)return Kl(n,t)}function Gl(e,t){let n=kl(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 Kl(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 ql(e,t){if(typeof e!=`string`)throw Error(`Expected a string for ${t}`);return e}function Jl(e,t){if(typeof e!=`number`)throw Error(`Expected a number for ${t}`);return e}function Yl(e,t){if(typeof e==`string`)return e;let n=Kl(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 Xl(e,t){let n=Kl(e,t);if(n.length!==2)throw Error(`Expected an array of two numbers for ${t}`);return n}function Zl(e,t){return typeof e==`number`?e:Xl(e,t)}var Ql={CENTER:`center`,RESOLUTION:`resolution`,ROTATION:`rotation`};function $l(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=R(r[0],f,p),_=R(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 eu(e){return e}function tu(e,t,n,r){let i=L(t)/n[0],a=I(t)/n[1];return r?Math.min(e,Math.max(i,a)):Math.min(e,Math.min(i,a))}function nu(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),R(r,n/2,t*2)}function ru(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?tu(c,n,o,!!r):c;if(s)return t?nu(i,u,l):R(i,l,u);let d=Math.floor(m(e,Math.min(u,i),a));return e[d]>u&&d<e.length-1?e[d+1]:e[d]}})}function iu(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?tu(t,i,c,!!a):t;if(l)return r?nu(o,u,n):R(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 R(t/e**+Math.max(d,p),n,u)}})}function au(e,t,n,r,i){return n=n===void 0||n,(function(a,o,s,c){if(a!==void 0){let o=r?tu(e,r,s,!!i):e;return!n||!c?R(a,t,o):nu(a,o,t)}})}function ou(e){if(e!==void 0)return 0}function su(e){if(e!==void 0)return e}function cu(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 lu(e){let t=e===void 0?Je(5):e;return(function(e,n){return n||e===void 0?e:Math.abs(e)<=t?0:e})}var uu=0,du=class extends ne{constructor(e){super(),this.on,this.once,this.un,e=Object.assign({},e),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=wn(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&&gn(),e.center&&(e.center=Rn(e.center,this.projection_)),e.extent&&(e.extent=Bn(e.extent,this.projection_)),this.applyOptions_(e)}applyOptions_(e){let t=Object.assign({},e);for(let e in Ql)delete t[e];this.setProperties(t,!0);let n=mu(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=pu(e),i=n.constraint,a=hu(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=Rn(n.center,this.getProjection())),n.anchor&&(n=Object.assign({},n),n.anchor=Rn(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&&fu(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||yi,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=Ye(e.rotation-s+Math.PI,2*Math.PI)-Math.PI;t.targetRotation=s+n,s=t.targetRotation}gu(t)?t.complete=!0:i+=t.duration,c.push(t)}this.animations_.push(c),this.setHint(ps.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[ps.ANIMATING]>0}getInteracting(){return this.hints_[ps.INTERACTING]>0}cancelAnimations(){this.setHint(ps.ANIMATING,-this.hints_[ps.ANIMATING]);let e;for(let t=0,n=this.animations_.length;t<n;++t){let n=this.animations_[t];if(n[0].callback&&fu(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?Ye(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(ps.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let e=r[0].callback;e&&fu(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]],st(n,e-this.getRotation()),at(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&&Ln(e,this.getProjection())}getCenterInternal(){return this.get(Ql.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 zn(this.calculateExtentInternal(e),this.getProjection())}calculateExtentInternal(e){e||=this.getViewportSizeMinusPadding_();let t=this.getCenterInternal();M(t,`The view center is not defined`);let n=this.getResolution();M(n!==void 0,`The view resolution is not defined`);let r=this.getRotation();return M(r!==void 0,`The view rotation is not defined`),Ae(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(Ql.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(Bn(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t||=this.getViewportSizeMinusPadding_();let n=L(e)/t[0],r=I(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(Ql.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=_u(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=m(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=R(Math.floor(e),0,this.resolutions_.length-2),n=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/n**+R(e-t,0,1)}return this.maxResolution_/this.zoomFactor_**+(e-this.minZoom_)}fit(e,t){let n;if(M(Array.isArray(e)||typeof e.getSimplifiedGeometry==`function`,"Invalid extent or geometry provided as `geometry`"),Array.isArray(e))M(!Le(e),"Cannot fit empty extent provided as `geometry`"),n=ri(Bn(e,this.getProjection()));else if(e.getType()===`Circle`){let t=Bn(e.getExtent(),this.getProjection());n=ri(t),n.rotate(this.getRotation(),Oe(t))}else{let t=In();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=Oe(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:T;t.duration===void 0?(this.targetResolution_=s,this.targetCenter_=m,this.applyTargetState_(!1,!0),fu(h,!0)):this.animateInternal({resolution:s,center:m,duration:t.duration,easing:t.easing},h)}centerOn(e,t,n){this.centerOnInternal(Rn(e,this.getProjection()),t,n)}centerOnInternal(e,t,n){this.setCenterInternal(_u(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=_u(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=Ln(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&&=Rn(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&&=Rn(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&&Rn(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(Ql.ROTATION)!==r&&this.set(Ql.ROTATION,r),this.get(Ql.RESOLUTION)!==a&&(this.set(Ql.RESOLUTION,a),this.set(`zoom`,this.getZoom(),!0)),o&&this.get(Ql.CENTER)&&ot(this.get(Ql.CENTER),o)||this.set(Ql.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()&&ot(this.getCenterInternal(),s)||(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:i,center:s,resolution:o,duration:e,easing:vi,anchor:n})))}beginInteraction(){this.resolveConstraints(0),this.setHint(ps.INTERACTING,1)}endInteraction(e,t,n){n&&=Rn(n,this.getProjection()),this.endInteractionInternal(e,t,n)}endInteractionInternal(e,t,n){this.getInteracting()&&(this.setHint(ps.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 fu(e,t){setTimeout(function(){e(t)},0)}function pu(e){if(e.extent!==void 0){let t=e.smoothExtentConstraint===void 0||e.smoothExtentConstraint;return $l(e.extent,e.constrainOnlyCenter,t)}let t=wn(e.projection,`EPSG:3857`);if(e.multiWorld!==!0&&t.isGlobal()){let e=t.getExtent().slice();return e[0]=-1/0,e[2]=1/0,$l(e,!1,!1)}return eu}function mu(e){let t,n,r,i=e.minZoom===void 0?uu: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=wn(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?ru(o,c,!f&&p,l):au(n,r,c,!f&&p,l)}else{let s=(d?Math.max(L(d),I(d)):360*pt.degrees/u.getMetersPerUnit())/256/2**uu,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?iu(o,n,r,c,!f&&p,l):au(n,r,c,!f&&p,l)}return{constraint:t,maxResolution:n,minResolution:r,minZoom:i,zoomFactor:o}}function hu(e){if(e.enableRotation===void 0||e.enableRotation){let t=e.constrainRotation;return t===void 0||t===!0?lu():t===!1?su:typeof t==`number`?cu(t):su}return ou}function gu(e){return!(e.sourceCenter&&e.targetCenter&&!ot(e.sourceCenter,e.targetCenter)||e.sourceResolution!==e.targetResolution||e.sourceRotation!==e.targetRotation)}function _u(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 Y={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`},vu=class extends ne{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[Y.OPACITY]=e.opacity===void 0?1:e.opacity,M(typeof t[Y.OPACITY]==`number`,`Layer opacity must be a number`),t[Y.VISIBLE]=e.visible===void 0||e.visible,t[Y.Z_INDEX]=e.zIndex,t[Y.MAX_RESOLUTION]=e.maxResolution===void 0?1/0:e.maxResolution,t[Y.MIN_RESOLUTION]=e.minResolution===void 0?0:e.minResolution,t[Y.MIN_ZOOM]=e.minZoom===void 0?-1/0:e.minZoom,t[Y.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=R(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 y()}getLayerStatesArray(e){return y()}getExtent(){return this.get(Y.EXTENT)}getMaxResolution(){return this.get(Y.MAX_RESOLUTION)}getMinResolution(){return this.get(Y.MIN_RESOLUTION)}getMinZoom(){return this.get(Y.MIN_ZOOM)}getMaxZoom(){return this.get(Y.MAX_ZOOM)}getOpacity(){return this.get(Y.OPACITY)}getSourceState(){return y()}getVisible(){return this.get(Y.VISIBLE)}getZIndex(){return this.get(Y.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(Y.EXTENT,e)}setMaxResolution(e){this.set(Y.MAX_RESOLUTION,e)}setMinResolution(e){this.set(Y.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(Y.MAX_ZOOM,e)}setMinZoom(e){this.set(Y.MIN_ZOOM,e)}setOpacity(e){M(typeof e==`number`,`Layer opacity must be a number`),this.set(Y.OPACITY,e)}setVisible(e){this.set(Y.VISIBLE,e)}setZIndex(e){this.set(Y.Z_INDEX,e)}disposeInternal(){this.state_&&=(this.state_.layer=null,null),super.disposeInternal()}},yu=class extends vu{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(Y.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(Y.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_&&=(c(this.sourceChangeKey_),null),this.sourceReady_=!1;let e=this.getSource();e&&(this.sourceChangeKey_=o(e,l.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 du?{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 bu(i,r.viewState)&&(!a||Ie(a,r.extent))}getAttributions(e){if(!this.isVisible(e))return[];let t=this.getSource()?.getAttributions();if(!t)return[];let n=t(e instanceof du?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(Y.MAP,e)}getMapInternal(){return this.get(Y.MAP)}setMap(e){this.mapPrecomposeKey_&&=(c(this.mapPrecomposeKey_),null),e||this.changed(),this.mapRenderKey_&&=(c(this.mapRenderKey_),null),e&&(this.mapPrecomposeKey_=o(e,_o.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=o(this,l.CHANGE,e.render,e),this.changed())}handlePrecompose_(e){let t=e.frameState?.layerStatesArray;if(!t)return;let n=this.getLayerState(!1);M(!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(Y.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 bu(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}var xu={RENDER_ORDER:`renderOrder`},Su=class extends yu{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(xu.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 jo(9));let r=this.getRenderer();r&&r.renderDeclutter(e,t)}setRenderOrder(e){this.set(xu.RENDER_ORDER,e)}setStyle(e){this.style_=e===void 0?ls:e??null;let t=Cu(e);this.styleFunction_=e===null||t===null?void 0:ss(t),this.changed()}setDeclutter(e){this.declutter_=e?String(e):void 0,this.changed()}};function Cu(e){if(e===void 0)return ls;if(!e)return null;if(typeof e==`function`||e instanceof os)return e;if(Array.isArray(e)&&e.length===0)return[];if(Array.isArray(e)&&e[0]instanceof os){let t=e.length,n=Array(t);for(let r=0;r<t;++r){let t=e[r];if(!(t instanceof os))throw Error(`Expected a list of style instances`);n[r]=t}return n}return yl(e)}var wu=class extends Su{constructor(e){super(e)}createRenderer(){return new pc(this)}},Tu=class extends O{constructor(e,t,n){super(e),this.map=t,this.frameState=n===void 0?null:n}},Eu=class extends Tu{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()}},Du={SINGLECLICK:`singleclick`,CLICK:l.CLICK,DBLCLICK:l.DBLCLICK,POINTERDRAG:`pointerdrag`,POINTERMOVE:`pointermove`,POINTERDOWN:`pointerdown`,POINTERUP:`pointerup`,POINTEROVER:`pointerover`,POINTEROUT:`pointerout`,POINTERENTER:`pointerenter`,POINTERLEAVE:`pointerleave`,POINTERCANCEL:`pointercancel`},Ou={POINTERMOVE:`pointermove`,POINTERDOWN:`pointerdown`,POINTERUP:`pointerup`,POINTEROVER:`pointerover`,POINTEROUT:`pointerout`,POINTERENTER:`pointerenter`,POINTERLEAVE:`pointerleave`,POINTERCANCEL:`pointercancel`},ku=class extends k{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_=o(n,Ou.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=o(n,Ou.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(l.TOUCHMOVE,this.boundHandleTouchMove_,di?{passive:!1}:!1)}emulateClick_(e){let t=new Eu(Du.CLICK,this.map_,e);this.dispatchEvent(t),this.clickTimeoutId_===void 0?this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;let t=new Eu(Du.SINGLECLICK,this.map_,e);this.dispatchEvent(t)},250):(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new Eu(Du.DBLCLICK,this.map_,e),this.dispatchEvent(t))}updateActivePointers_(e){let t=e,n=t.pointerId;if(t.type==Du.POINTERUP||t.type==Du.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==Du.POINTERDOWN||t.type==Du.POINTERMOVE)&&(this.trackedTouches_[n]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);let t=new Eu(Du.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(c),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 Eu(Du.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(o(e,Du.POINTERMOVE,this.handlePointerMove_,this),o(e,Du.POINTERUP,this.handlePointerUp_,this),o(t,Du.POINTERCANCEL,this.handlePointerUp_,this)),t.getRootNode&&t.getRootNode()!==e){let e=t.getRootNode();this.dragListenerKeys_.push(o(e,Du.POINTERUP,this.handlePointerUp_,this))}}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;let t=new Eu(Du.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 Eu(Du.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_&&=(c(this.relayedListenerKey_),void 0),e&&e.removeEventListener(l.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&=(c(this.pointerdownListenerKey_),void 0),this.dragListenerKeys_.forEach(c),this.dragListenerKeys_.length=0,this.element_=void 0,super.disposeInternal()}},Au={POSTRENDER:`postrender`,MOVESTART:`movestart`,MOVEEND:`moveend`,LOADSTART:`loadstart`,LOADEND:`loadend`},ju={LAYERGROUP:`layergroup`,SIZE:`size`,TARGET:`target`,VIEW:`view`},Mu=1/0,Nu=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,i(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){M(!(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_()}},Pu=class extends Nu{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(l.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(l.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 Fu(e,t,n,r,i){if(!e||!(n in e.wantedTiles)||!e.wantedTiles[n][t.getKey()])return Mu;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 Iu=class extends ne{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)c(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!==T&&this.listenerKeys.push(o(e,Au.POSTRENDER,this.render,this)),e.render()}}render(e){}setTarget(e){this.target_=typeof e==`string`?document.getElementById(e):e}},Lu=class extends Iu{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(l.CLICK,this.handleClick_.bind(this),!1);let c=t+` `+Sa+` `+wa+(this.collapsed_&&this.collapsible_?` `+Ta:``)+(this.collapsible_?``:` ol-uncollapsible`),u=this.element;u.className=c,u.appendChild(this.toggleButton_),u.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=>D(()=>e))),r=n.length>0;if(this.renderedVisible_!=r&&(t.style.display=r?``:`none`,this.renderedVisible_=r),!_(n,this.renderedAttributions_)){Di(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(Ta),this.collapsed_?Ei(this.collapseLabel_,this.label_):Ei(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)}},Ru=class extends Iu{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(l.CLICK,this.handleClick_.bind(this),!1);let o=t+` `+Sa+` `+wa,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(xa)}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:vi}):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(xa);!e&&n===0?t.classList.add(xa):e&&n!==0&&t.classList.remove(xa)}this.label_.style.transform=e}this.rotation_=n}},zu=class extends Iu{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,u=document.createElement(`button`);u.className=r,u.setAttribute(`type`,`button`),u.title=s,u.appendChild(typeof a==`string`?document.createTextNode(a):a),u.addEventListener(l.CLICK,this.handleClick_.bind(this,n),!1);let d=document.createElement(`button`);d.className=i,d.setAttribute(`type`,`button`),d.title=c,d.appendChild(typeof o==`string`?document.createTextNode(o):o),d.addEventListener(l.CLICK,this.handleClick_.bind(this,-n),!1);let f=t+` `+Sa+` `+wa,p=this.element;p.className=f,p.appendChild(u),p.appendChild(d),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:vi})):n.setZoom(t)}}};function Bu(e){e||={};let t=new ie;return(e.zoom===void 0||e.zoom)&&t.push(new zu(e.zoomOptions)),(e.rotate===void 0||e.rotate)&&t.push(new Ru(e.rotateOptions)),(e.attribution===void 0||e.attribution)&&t.push(new Lu(e.attributionOptions)),t}var Vu={ACTIVE:`active`},Hu=class extends ne{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(Vu.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(Vu.ACTIVE,e)}setMap(e){this.map_=e}};function Uu(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:bi,center:e.getConstrainedCenter(i)})}}function Wu(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:vi}))}var Gu=class extends Hu{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==Du.DBLCLICK){let n=e.originalEvent,r=e.map,i=e.coordinate,a=n.shiftKey?-this.delta_:this.delta_;Wu(r.getView(),a,i,this.duration_),n.preventDefault(),t=!0}return!t}};function Ku(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 qu=function(e){let t=e.originalEvent;return t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},Ju=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)},Yu=function(e){let t=e.map.getTargetElement();if(!t)return!0;let n=t.getRootNode();return!(n instanceof ShadowRoot?n.host:t).hasAttribute(`tabindex`)||Ju(e)},Xu=C,Zu=function(e){let t=e.originalEvent;return`pointerId`in t&&t.button==0&&!(ai&&oi&&t.ctrlKey)},Qu=function(e){let t=e.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&!t.shiftKey},$u=function(e){let t=e.originalEvent;return oi?t.metaKey:t.ctrlKey},ed=function(e){let t=e.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},td=function(e){let t=e.originalEvent,n=t.target.tagName;return n!==`INPUT`&&n!==`SELECT`&&n!==`TEXTAREA`&&!t.target.isContentEditable},nd=function(e){let t=e.originalEvent;return`pointerId`in t&&t.pointerType==`mouse`},rd=function(e){let t=e.originalEvent;return`pointerId`in t&&t.isPrimary&&t.button===0},id=class extends Hu{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==Du.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==Du.POINTERUP){let t=this.handleUpEvent(e);this.handlingDownUpSequence=t&&this.targetPointers.length>0}}else if(e.type==Du.POINTERDOWN){let n=this.handleDownEvent(e);this.handlingDownUpSequence=n,t=this.stopDown(n)}else e.type==Du.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 ad(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 od=class extends id{constructor(e){super({stopDown:w}),e||={},this.kinetic_=e.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;let t=e.condition?e.condition:Ku(Qu,rd);this.condition_=e.onFocusOnly?Ku(Yu,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(ad(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&&(ct(t,i),st(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:vi})}}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}},sd=class extends id{constructor(e){e||={},super({stopDown:w}),this.condition_=e.condition?e.condition:qu,this.lastAngle_=void 0,this.duration_=e.duration===void 0?250:e.duration}handleDragEvent(e){if(!nd(e))return;let t=e.map,n=t.getView();if(n.getConstraints().rotation===ou)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!nd(e)||(e.map.getView().endInteraction(this.duration_),!1)}handleDownEvent(e){return nd(e)&&Zu(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}},cd=class extends u{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 ni([o])}getGeometry(){return this.geometry_}},ld={BOXSTART:`boxstart`,BOXDRAG:`boxdrag`,BOXEND:`boxend`,BOXCANCEL:`boxcancel`},ud=class extends O{constructor(e,t,n){super(e),this.coordinate=t,this.mapBrowserEvent=n}},dd=class extends id{constructor(e){super(),this.on,this.once,this.un,e??={},this.box_=new cd(e.className||`ol-dragbox`),this.minArea_=e.minArea??64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition??Zu,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 ud(ld.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 ud(t?ld.BOXEND:ld.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 ud(ld.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}setActive(e){e||(this.box_.setMap(null),this.startPixel_&&=(this.dispatchEvent(new ud(ld.BOXCANCEL,this.startPixel_,null)),null)),super.setActive(e)}setMap(e){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&=(this.dispatchEvent(new ud(ld.BOXCANCEL,this.startPixel_,null)),null)),super.setMap(e)}},fd=class extends dd{constructor(e){e||={};let t=e.condition?e.condition:ed;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:vi})}},pd={LEFT:`ArrowLeft`,UP:`ArrowUp`,RIGHT:`ArrowRight`,DOWN:`ArrowDown`},md=class extends Hu{constructor(e){super(),e||={},this.defaultCondition_=function(e){return Qu(e)&&td(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==l.KEYDOWN){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==pd.DOWN||r==pd.LEFT||r==pd.RIGHT||r==pd.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==pd.DOWN?c=-o:r==pd.LEFT?s=-o:r==pd.RIGHT?s=o:c=o;let l=[s,c];st(l,i.getRotation()),Uu(i,l,this.duration_),n.preventDefault(),t=!0}}return!t}},hd=class extends Hu{constructor(e){super(),e||={},this.condition_=e.condition?e.condition:function(e){return!$u(e)&&td(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==l.KEYDOWN||e.type==l.KEYPRESS){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r===`+`||r===`-`)){let i=e.map,a=r===`+`?this.delta_:-this.delta_;Wu(i.getView(),a,void 0,this.duration_),n.preventDefault(),t=!0}}return!t}},gd=40,_d=300,vd=3,yd=class extends Hu{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:Xu;this.condition_=e.onFocusOnly?Ku(Yu,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!==l.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*=gd;break;case WheelEvent.DOM_DELTA_PAGE:i*=_d}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*=vd),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=-R(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),Wu(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)}},bd=class extends id{constructor(e){e||={};let t=e;t.stopDown||=w,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!==ou&&(this.anchor_=a.getCoordinateFromPixelInternal(a.getEventPixel(ad(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}},xd=class extends id{constructor(e){e||={};let t=e;t.stopDown||=w,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(ad(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 Sd(e){e||={};let t=new ie,n=new Ni(-.005,.05,100);return(e.altShiftDragRotate===void 0||e.altShiftDragRotate)&&t.push(new sd),(e.doubleClickZoom===void 0||e.doubleClickZoom)&&t.push(new Gu({delta:e.zoomDelta,duration:e.zoomDuration})),(e.dragPan===void 0||e.dragPan)&&t.push(new od({onFocusOnly:e.onFocusOnly,kinetic:n})),(e.pinchRotate===void 0||e.pinchRotate)&&t.push(new bd),(e.pinchZoom===void 0||e.pinchZoom)&&t.push(new xd({duration:e.zoomDuration})),(e.keyboard===void 0||e.keyboard)&&(t.push(new md),t.push(new hd({delta:e.zoomDelta,duration:e.zoomDuration}))),(e.mouseWheelZoom===void 0||e.mouseWheelZoom)&&t.push(new yd({onFocusOnly:e.onFocusOnly,duration:e.zoomDuration})),(e.shiftDragZoom===void 0||e.shiftDragZoom)&&t.push(new fd({duration:e.zoomDuration})),t}var Cd={ADDLAYER:`addlayer`,REMOVELAYER:`removelayer`},wd=class extends O{constructor(e,t){super(e),this.layer=t}},Td={LAYERS:`layers`},Ed=class e extends vu{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(Td.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new ie(n.slice(),{unique:!0}):M(typeof n.getArray==`function`,"Expected `layers` to be an array or a `Collection`"):n=new ie(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(c),this.layersListenerKeys_.length=0;let e=this.getLayers();this.layersListenerKeys_.push(o(e,n.ADD,this.handleLayersAdd_,this),o(e,n.REMOVE,this.handleLayersRemove_,this));for(let e in this.listenerKeys_)this.listenerKeys_[e].forEach(c);i(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 wd(Cd.ADDLAYER,n))}this.changed()}registerLayerListeners_(t){let n=[o(t,r.PROPERTYCHANGE,this.handleLayerChange_,this),o(t,l.CHANGE,this.handleLayerChange_,this)];t instanceof e&&n.push(o(t,Cd.ADDLAYER,this.handleLayerGroupAdd_,this),o(t,Cd.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[x(t)]=n}handleLayerGroupAdd_(e){this.dispatchEvent(new wd(Cd.ADDLAYER,e.layer))}handleLayerGroupRemove_(e){this.dispatchEvent(new wd(Cd.REMOVELAYER,e.layer))}handleLayersAdd_(e){let t=e.element;this.registerLayerListeners_(t),this.dispatchEvent(new wd(Cd.ADDLAYER,t)),this.changed()}handleLayersRemove_(e){let t=e.element,n=x(t);this.listenerKeys_[n].forEach(c),delete this.listenerKeys_[n],this.dispatchEvent(new wd(Cd.REMOVELAYER,t)),this.changed()}getLayers(){return this.get(Td.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 wd(Cd.REMOVELAYER,e[t]))}this.set(Td.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:Me(n.extent,r.extent)),n.zIndex===void 0&&(n.zIndex=i)}return t}getSourceState(){return`ready`}},Dd=class extends u{constructor(e){super(),this.map_=e}dispatchRenderEvent(e,t){y()}calculateMatrices2D(e){let t=e.viewState,n=e.coordinateToPixelTransform,r=e.pixelToCoordinateTransform;Jn(n,e.size[0]/2,e.size[1]/2,1/t.resolution,-1/t.resolution,-t.rotation,-t.center[0],-t.center[1]),Yn(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=lt(e.slice(),d),p=[[0,0]];if(d.canWrapX()&&r){let e=L(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()&&bu(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,C,this,i,a)!==void 0}getMap(){return this.map_}renderFrame(e){y()}scheduleExpireIconCache(e){da.canExpireCache()&&e.postRenderFunctions.push(Od)}};function Od(e,t){da.expire()}var kd=class extends Dd{constructor(e){super(e),this.fontChangeListenerKey_=o(za,r.PROPERTYCHANGE,e.redrawText,e),this.element_=ci?ki():document.createElement(`div`);let t=this.element_.style;t.position=`absolute`,t.width=`100%`,t.height=`100%`,t.zIndex=`0`,this.element_.className=Sa+` 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 oc(e,void 0,t);n.dispatchEvent(r)}}disposeInternal(){c(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(_o.PRECOMPOSE,e);let t=e.layerStatesArray.sort((e,t)=>e.zIndex-t.zIndex);t.some(e=>e.layer instanceof Su&&e.layer.getDeclutter())&&(e.declutter={});let n=e.viewState;this.children_.length=0;let r=this.getMap().getTargetElement(),i;Ai(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(!bu(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),Oi(this.element_,this.children_),i)for(let e of this.children_){let t=e.firstElementChild||e,n=e.style.backgroundColor;if(n&&(!Ai(t)||t.width>0)&&(i.fillStyle=n,i.fillRect(0,0,i.canvas.width,i.canvas.height)),!Ai(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(...$n(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(_o.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 Ad(e){e instanceof yu?e.setMapInternal(null):e instanceof Ed&&e.getLayers().forEach(Ad)}function jd(e,t){if(e instanceof yu)e.setMapInternal(t);else if(e instanceof Ed){let n=e.getLayers().getArray();for(let e=0,r=n.length;e<r;++e)jd(n[e],t)}}var Md=class extends ne{constructor(e){super(),e||={},this.on,this.once,this.un;let t=Nd(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?si:e.pixelRatio,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=Gn(),this.pixelToCoordinateTransform_=Gn(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,this.viewport_,this.overlayContainer_,this.overlayContainerStopEvent_,ci||(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,ci||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=t.controls||(ci?new ie:Bu()),this.interactions=t.interactions||(ci?new ie:Sd({onFocusOnly:!0})),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new Pu(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(ju.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(ju.VIEW,this.handleViewChanged_),this.addChangeListener(ju.SIZE,this.handleSizeChanged_),this.addChangeListener(ju.TARGET,this.handleTargetChanged_),this.setProperties(t.values);let r=this;e.view&&!(e.view instanceof du)&&e.view.then(function(e){r.setView(new du(e))}),this.controls.addEventListener(n.ADD,(e=>{e.element.setMap(this)})),this.controls.addEventListener(n.REMOVE,(e=>{e.element.setMap(null)})),this.interactions.addEventListener(n.ADD,(e=>{e.element.setMap(this)})),this.interactions.addEventListener(n.REMOVE,(e=>{e.element.setMap(null)})),this.overlays_.addEventListener(n.ADD,(e=>{this.addOverlayInternal_(e.element)})),this.overlays_.addEventListener(n.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){jd(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?C: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 Ed?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?C: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(ju.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(e,t){let n=Ln(this.getCoordinateFromPixelInternal(e),this.getView().getProjection());return t?.wrapX&&n&&lt(n,In()||this.getView().getProjection()),n}getCoordinateFromPixelInternal(e){let t=this.frameState_;return t?qn(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(ju.LAYERGROUP)}setLayers(e){let t=this.getLayerGroup();if(e instanceof ie){t.setLayers(e);return}let n=t.getLayers();n.clear(),n.extend(e)}getLayers(){return this.getLayerGroup().getLayers()}updateRenderComplete_(){this.renderComplete_=(this.hasListener(Au.LOADSTART)||this.hasListener(Au.LOADEND)||this.hasListener(_o.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=Rn(e,n);return t?.wrapX&&this.frameState_&&(r=ut(r.slice(),n,this.frameState_.viewState.center[0])),this.getPixelFromCoordinateInternal(r)}getPixelFromCoordinateInternal(e){let t=this.frameState_;return t?qn(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(ju.SIZE)}getView(){return this.get(ju.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 Fu(this.frameState_,e,t,n,r)}handleBrowserEvent(e,t){t||=e.type;let n=new Eu(t,this,e);this.handleMapBrowserEvent(n)}handleCtrlKey_(e){let t=e;this.ctrlKey_=t.key===`Control`?t.type===l.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===Ou.POINTERDOWN||n===l.WHEEL||n===l.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[ps.ANIMATING]||i[ps.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(_o.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(_o.RENDERCOMPLETE,e),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new Tu(Au.LOADEND,this,e)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new Tu(Au.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)c(e[t]);this.targetChangeHandlerKeys_=null;let t=this.getOwnerDocument();t.removeEventListener(l.KEYDOWN,this.boundHandleCtrlKey_,!0),t.removeEventListener(l.KEYUP,this.boundHandleCtrlKey_,!0),this.ctrlKey_=!1,this.viewport_.removeEventListener(l.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(l.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!Ai(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(Ai(t)||t.appendChild(this.viewport_),this.renderer_||=new kd(this),!Ai(t)){this.mapBrowserEventHandler_=new ku(this,this.moveTolerance_);for(let e in Du)this.mapBrowserEventHandler_.addEventListener(Du[e],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(l.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(l.WHEEL,this.boundHandleBrowserEvent_,di?{passive:!1}:!1);let e=this.getOwnerDocument();e.addEventListener(l.KEYDOWN,this.boundHandleCtrlKey_,!0),e.addEventListener(l.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_=[o(n,l.KEYDOWN,this.handleBrowserEvent,this),o(n,l.KEYPRESS,this.handleBrowserEvent,this)],!Ai(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_&&=(c(this.viewPropertyListenerKey_),null),this.viewChangeListenerKey_&&=(c(this.viewChangeListenerKey_),null);let e=this.getView();e&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=o(e,r.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=o(e,l.CHANGE,this.handleViewPropertyChanged_,this),e.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&=(this.layerGroupPropertyListenerKeys_.forEach(c),null);let e=this.getLayerGroup();e&&(this.handleLayerAdd_(new wd(`addlayer`,e)),this.layerGroupPropertyListenerKeys_=[o(e,r.PROPERTYCHANGE,this.render,this),o(e,l.CHANGE,this.render,this),o(e,`addlayer`,this.handleLayerAdd_,this),o(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){Ad(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&&es(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:Ae(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:x(this),renderTargets:{}},a.nextCenter&&a.nextResolution){let e=isNaN(a.nextRotation)?a.rotation:a.nextRotation;i.nextExtent=Ae(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_&&(Le(this.previousExtent_)||ye(i.extent,this.previousExtent_))||(this.dispatchEvent(new Tu(Au.MOVESTART,this,r)),this.previousExtent_=ge(this.previousExtent_))),this.previousExtent_&&!i.viewHints[ps.ANIMATING]&&!i.viewHints[ps.INTERACTING]&&!ye(i.extent,this.previousExtent_)&&(this.dispatchEvent(new Tu(Au.MOVEEND,this,i)),ue(i.extent,this.previousExtent_))),this.dispatchEvent(new Tu(Au.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 wd(`removelayer`,t)),this.set(ju.LAYERGROUP,e)}setSize(e){this.set(ju.SIZE,e)}setTarget(e){this.set(ju.TARGET,e)}setView(e){if(!e||e instanceof du){this.set(ju.VIEW,e);return}this.set(ju.VIEW,new du);let t=this;e.then(function(e){t.setView(new du(e))})}updateSize(){let e=this.getTargetElement(),t;if(e){let n,r;if(Ai(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)],!es(t)&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&it(`No map visible because the map container's width or height are 0.`))}let n=this.getSize();!t||n&&_(t,n)||(this.updateViewportSize_(t),this.setSize(t))}updateViewportSize_(e){let t=this.getView();t&&t.setViewportSize(e)}};function Nd(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 Ed({layers:e.layers});n[ju.LAYERGROUP]=r,n[ju.TARGET]=e.target,n[ju.VIEW]=e.view instanceof du?e.view:new du;let i;e.controls!==void 0&&(Array.isArray(e.controls)?i=new ie(e.controls.slice()):(M(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 ie(e.interactions.slice()):(M(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 ie:Array.isArray(e.overlays)?o=new ie(e.overlays.slice()):(M(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 Pd=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 Fd(e,t,n,r,i){return i===void 0?new Pd(e,t,n,r):(i.minX=e,i.maxX=t,i.minY=n,i.maxY=r,i)}function Id(e){return e instanceof Image||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageBitmap?e:null}function Ld(e){return e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Float32Array||e instanceof DataView?e:null}var Rd=Error(`disposed`),zd=[256,256],Bd=class extends xi{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=Id(this.data_);return e?[e.width,e.height]:zd}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(Rd),null),super.disposeInternal()}},Vd,Hd=[];function Ud(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 Wd(e,t){return Math.abs(e[t*4]-210)>2||Math.abs(e[t*4+3]-191.25)>2}function Gd(){if(Vd===void 0){let e=Si(6,6,Hd);e.globalCompositeOperation=`lighter`,e.fillStyle=`rgba(210, 0, 0, 0.75)`,Ud(e,4,5,4,0),Ud(e,4,5,0,5);let t=e.getImageData(0,0,3,3).data;Vd=Wd(t,0)||Wd(t,4)||Wd(t,8),Ti(e),Hd.push(e.canvas)}return Vd}function Kd(e,t,n,r){let i=Nn(n,t,e),a=xn(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||P(c,i)){let t=xn(e,a,i)/a;isFinite(t)&&t>0&&(a/=t)}return a}function qd(e,t,n,r){let i=Kd(e,t,Oe(n),r);return(!isFinite(i)||i<=0)&&we(n,function(n){return i=Kd(e,t,n,r),isFinite(i)&&i>0}),i}function Jd(e,t,n,r,i,a,o,s,c,l,u,d,f,p){let m=Si(Math.round(n*e),Math.round(n*t),Hd);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=me();c.forEach(function(e,t,n){be(g,e.extent)});let _,v=n/r,y=(d?1:1+2**-24)/v;if(!f||c.length!==1||l!==0){let e=Si(Math.round(L(g)*v),Math.round(I(g)*v),Hd);if(_=e,d||(e.imageSmoothingEnabled=!1),i&&p){let t=(i[0]-g[0])*v,n=-(i[3]-g[3])*v,r=L(i)*v,a=I(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=L(t.clipExtent)*v,a=I(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=L(t.extent)*v,a=I(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=Pe(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=Ke([[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(),Gd()||!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(L(t)/k.width,-I(t)/k.height)}m.drawImage(k,0,0),m.restore()}),_&&(Ti(_),Hd.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 Yd=10,Xd=.25,Zd=class{constructor(e,t,n,r,i,a,o){this.sourceProj_=e,this.targetProj_=t;let s={},c=o?Tn(e=>qn(o,Nn(e,this.targetProj_,this.sourceProj_))):Mn(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()&&L(r)>=L(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?L(this.sourceProj_.getExtent()):void 0,this.targetWorldWidth_=this.targetProj_.getExtent()?L(this.targetProj_.getExtent()):void 0;let l=Pe(n),u=Fe(n),d=De(n),f=Ee(n),p=this.transformInv_(l),m=this.transformInv_(u),h=this.transformInv_(d),g=this.transformInv_(f),_=Yd+(a?Math.max(0,Math.ceil(Math.log2(Te(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=ce([i,a,o,s]),u=this.sourceWorldWidth_,d=u?L(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=L(ce([e,t,n,r]))/this.targetWorldWidth_>Xd||p),!f&&this.sourceProj_.isGlobal()&&d&&(p=d>Xd||p)),!p&&this.maxSourceExtent_&&isFinite(l[0])&&isFinite(l[1])&&isFinite(l[2])&&isFinite(l[3])&&!Ie(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=(Ye(i[0],e)+Ye(o[0],e))/2-Ye(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=me();return this.triangles_.forEach(function(t,n,r){let i=t.source;xe(e,i[0]),xe(e,i[1]),xe(e,i[2])}),e}getTriangles(){return this.triangles_}},Qd=.5,$d=class extends xi{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?Me(f,p):f;if(Te(h)===0){this.state=H.EMPTY;return}let g=e.getExtent();g&&(m=m?Me(m,g):g);let _=r.getResolution(this.wrappedTileCoord_[0]),v=qd(e,n,h,_);if(!isFinite(v)||v<=0){this.state=H.EMPTY;return}let y=l===void 0?Qd:l;if(this.triangulation_=new Zd(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]=R(b[1],m[1],m[3]),b[3]=R(b[3],m[1],m[3])):b=Me(b,m)),!Te(b))this.state=H.EMPTY;else{let n=0,r=0;e.canWrapX()&&(n=L(g),r=Math.floor((b[0]-g[0])/n)),He(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_=Jd(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=o(n,l.CHANGE,()=>{let r=n.getState();(r==H.LOADED||r==H.ERROR||r==H.EMPTY)&&(c(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(c),null)}release(){this.canvas_&&=(Ti(this.canvas_.getContext(`2d`)),Hd.push(this.canvas_),null),this.sourceTiles_.length=0,super.release()}},ef=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 u&&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 M(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 M(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){M(!(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 tf(e,t,n,r){return r===void 0?[e,t,n]:(r[0]=e,r[1]=t,r[2]=n,r)}function nf(e,t,n){return e+`/`+t+`/`+n}function rf(e,t,n,r,i){return`${x(e)},${t},${nf(n,r,i)}`}function af(e){return of(e[0],e[1],e[2])}function of(e,t,n){return(t<<e)+n}function sf(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 cf=class extends fc{constructor(e){super(e),this.image=null,this.renderedSourceRevision_=0,this.renderedRotation=0}getImage(){return this.image?this.image.getImage():null}prepareFrame(e){let t=e.layerStatesArray[e.layerIndex],n=e.pixelRatio,r=e.viewState,i=r.resolution,a=this.getLayer().getSource(),o=e.viewHints,s=e.extent;if(t.extent!==void 0&&(s=Me(s,Bn(t.extent,r.projection))),!o[ps.ANIMATING]&&!o[ps.INTERACTING]&&!Le(s)){if(a){!this.getLayer().rendered&&this.renderedSourceRevision_!==a.getRevision()&&(this.image=null),this.renderedSourceRevision_=a.getRevision();let e=r.projection,t=a.getImage(s,i,n,e);t&&(this.loadImage(t)?(this.image=t,this.renderedRotation=this.sourceRotates()?r.rotation:0):t.getState()===V.EMPTY&&(this.image=null))}else this.image=null}return!!this.image}getData(e){let t=this.frameState;if(!t||!this.image)return null;let n=this.getLayer(),r=qn(t.pixelToCoordinateTransform,e.slice()),i=n.getExtent();if(i&&!P(i,r))return null;let a=this.image.getExtent(),o=this.image.getImage();if(!o)return null;let s=this.renderedRotation;if(s!==0){let e=Oe(a),t=Math.cos(-s),n=Math.sin(-s),i=r[0]-e[0],o=r[1]-e[1];r[0]=e[0]+t*i-n*o,r[1]=e[1]+n*i+t*o}let c=L(a),l=Math.floor(o.width*((r[0]-a[0])/c));if(l<0||l>=o.width)return null;let u=I(a),d=Math.floor(o.height*((a[3]-r[1])/u));return d<0||d>=o.height?null:this.getImageData(o,l,d)}renderFrame(e,t){let n=this.image;if(!n)return this.getContainerElement();let r=n.getExtent(),i=n.getResolution(),[a,o]=Array.isArray(i)?i:[i,i],s=n.getPixelRatio(),c=this.renderedRotation,l=this.getLayer().getSource(),u=this.sourceRotates(),d=e.layerStatesArray[e.layerIndex],f=e.pixelRatio,p=e.viewState,m=p.center,h=p.resolution,g=p.rotation,_=f*a/(h*s),v=f*o/(h*s);this.prepareContainer(e,t);let y=this.getCanvasContext().canvas.width,b=this.getCanvasContext().canvas.height,x=this.getRenderContext(e),S=!1,C=!0;if(d.extent){let t=Bn(d.extent,p.projection),n=e.extent;C=Ie(t,n),S=C&&!fe(t,n),S&&this.clipUnrotated(x,e,t)}let w=n.getImage();if(!w)return this.getContainerElement();let T,E,D;if(!u)T=Jn(this.tempTransform,y/2,b/2,_,v,0,s*(r[0]-m[0])/a,s*(m[1]-r[3])/o),E=w.width*T[0],D=w.height*T[3];else{let e=f/h,t=Math.cos(g),n=Math.sin(g),i=Oe(r),a=i[0]-m[0],o=i[1]-m[1];T=Jn(this.tempTransform,y/2+e*(t*a+n*o),b/2+e*(n*a-t*o),_,v,g-c,-w.width/2,-w.height/2),E=w.width*_,D=w.height*v}if(this.renderedResolution=o*f/s,l?.getInterpolate()||u&&g!==c||(x.imageSmoothingEnabled=!1),this.preRender(x,e),C&&E>=.5&&D>=.5){let e=d.opacity;if(u)x.save(),e!==1&&(x.globalAlpha=e),x.setTransform(T[0],T[1],T[2],T[3],T[4],T[5]),x.drawImage(w,0,0),x.restore();else{let t=T[4],n=T[5];e!==1&&(x.save(),x.globalAlpha=e),x.drawImage(w,0,0,w.width,w.height,t,n,E,D),e!==1&&x.restore()}}return this.postRender(this.getCanvasContext(),e),S&&x.restore(),x.imageSmoothingEnabled=!0,this.getContainerElement()}},lf=class extends yu{constructor(e){e||={},super(e)}},uf=class extends lf{constructor(e){super(e)}createRenderer(){return new cf(this)}getData(e){return super.getData(e)}};function df(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 ff(e,t,n){let r=e[n];return r?r.delete(t):!1}function pf(e,t){let n=e.layerStatesArray[e.layerIndex];if(n.extent&&(t=Me(t,Bn(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=Me(t,n))}return t}var mf=class extends fc{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=me(),this.tempTileRange_=new Pd(0,0,0,0),this.tempTileCoord_=tf(0,0,0);let n=t.cacheSize===void 0?512:t.cacheSize;this.tileCache_=new ef(n),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=n*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||=new ef(512),this.sourceTileCache_}getOrCreateTile(e,t,n,r){let i=this.tileCache_,a=this.getLayer().getSource();if(!a)return null;let o=rf(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||kn(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=qn(t.pixelToCoordinateTransform,e.slice()),i=n.getExtent();if(i&&!P(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=ns(s.getTileSize(e)),d=s.getResolution(e),f=null;if(i instanceof ji||i instanceof $d)f=i.getImage();else if(i instanceof Bd){let e=i.getData();e&&(f=Id(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=Ld(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=Ld(e.getData()),s=(t[0]-o[0])/a-.5,c=(o[3]-t[3])/a-.5,l=L(t)/a,u=I(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=x(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?je(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||!df(r,n,i))continue;let s=n.getKey();if(u[s]=!0,n.getState()===H.IDLE&&!e.tileQueue.isKeyQueued(s)){let r=tf(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=rf(s,o[e],r,i,a);if(n.containsKey(c)){let e=n.peek(c);if(e&&e.getState()===H.LOADED)return e.endTransition(x(this)),df(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=rf(s,c,n,e,t),l=!1;if(o.containsKey(i)){let e=o.peek(i);e&&e.getState()===H.LOADED&&(df(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),p=u.getResolution(d);this.updateStaleKeys(l.getKey());let m=e.extent,h=l.getTilePixelRatio(s);this.prepareContainer(e,t);let g=this.getCanvasContext().canvas.width,_=this.getCanvasContext().canvas.height;this.layerExtent=n.extent?Bn(n.extent,i):null,this.layerExtent&&(m=Me(m,this.layerExtent));let v=p*g/2/h,y=p*_/2/h,b=[o[0]-v,o[1]-y,o[0]+v,o[1]+y],S={};this.renderedTiles.length=0;let C=c.getPreload();if(e.nextExtent&&this.enqueueTilesForNextExtent()){let t=u.getZForResolution(r.nextResolution??a,l.zDirection),n=pf(e,e.nextExtent);this.enqueueTiles(e,n,t,S,C)}let w=pf(e,m);if(this.enqueueTiles(e,w,d,S,0),C>0&&setTimeout(()=>{this.enqueueTiles(e,w,d-1,S,C-1)},0),!(d in S))return this.getContainerElement();let T=x(this),E=e.time;for(let t of S[d]){let n=t.getState();if(n===H.EMPTY)continue;let r=t.tileCoord;if(n===H.LOADED&&t.getAlpha(T,E)===1){t.endTransition(T);continue}if(n!==H.ERROR&&(this.renderComplete=!1),this.findStaleTile_(r,S)){ff(S,t,d),e.animate=!0;continue}if(this.findAltTiles_(u,r,d+1,S))continue;let i=u.getMinZoom();for(let e=d-1;e>=i&&!this.findAltTiles_(u,r,e,S);--e);}let D=p/a*s/h,O=this.getRenderContext(e);Jn(this.tempTransform,g/2,_/2,D,D,0,-g/2,-_/2),this.layerExtent&&this.clipUnrotated(O,e,this.layerExtent),l.getInterpolate()||(O.imageSmoothingEnabled=!1),this.preRender(O,e);let k=Object.keys(S).map(Number);k.sort(f);let A=[],ee=[],te=[];for(let t=k.length-1;t>=0;--t){let n=k[t],r=l.getTilePixelSize(n,s,i),a=u.getResolution(n)/p,o=r[0]*a*D,c=r[1]*a*D,f=u.getTileCoordForCoordAndZ(Pe(b),n),m=u.getTileCoordExtent(f),g=qn(this.tempTransform,[h*(m[0]-b[0])/p,h*(b[3]-m[3])/p]),_=h*l.getGutterForProjection(i);for(let t of S[n]){if(t.getState()!==H.LOADED)continue;let r=t.tileCoord,i=f[1]-r[1],a=Math.round(g[0]-(i-1)*o),s=f[2]-r[2],u=Math.round(g[1]-(s-1)*c),p=Math.round(g[0]-i*o),m=Math.round(g[1]-s*c),h=a-p,v=u-m,y=n===d;if(y&&t.inTransition(T)){te.push({tile:t,x:p,y:m,w:h,h:v,gutter:_}),this.renderedTiles.unshift(t),this.updateUsedTiles(e.usedTiles,l,t);continue}let b=[p,m,p+h,m+v],x=[];for(let e=0,t=A.length;e<t;++e)n<ee[e]&&Ie(b,A[e])&&x.push(A[e]);let S;x.length>0&&(S=Ue(b,x)),A.push(b),ee.push(n),this.drawTile(t,e,p,m,h,v,_,y,S),this.renderedTiles.unshift(t),this.updateUsedTiles(e.usedTiles,l,t)}}for(let t=0,n=te.length;t<n;++t){let{tile:n,x:r,y:i,w:a,h:o,gutter:s}=te[t];this.drawTile(n,e,r,i,a,o,s,!0,void 0)}return this.renderedResolution=p,this.extentChanged=!this.renderedExtent_||!ye(this.renderedExtent_,b),this.renderedExtent_=b,this.renderedPixelRatio=s,this.postRender(this.getCanvasContext(),e),this.layerExtent&&O.restore(),O.imageSmoothingEnabled=!0,this.renderComplete&&e.postRenderFunctions.push((e,t)=>{let n=x(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 Bd){let t=e.getData();if(!t)return;if(l=Id(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=x(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=x(t);r in e||(e[r]={}),e[r][n.getKey()]=!0}},hf={PRELOAD:`preload`,USE_INTERIM_TILES_ON_ERROR:`useInterimTilesOnError`},gf=class extends yu{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(hf.PRELOAD)}setPreload(e){this.set(hf.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(hf.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(hf.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}},_f=class extends gf{constructor(e){super(e)}createRenderer(){return new mf(this,{cacheSize:this.getCacheSize()})}};function vf(e){return Array.isArray(e)?Math.min(...e):e}var yf=/\{z\}/g,bf=/\{x\}/g,xf=/\{y\}/g,Sf=/\{-y\}/g;function Cf(e,t,n,r,i){return e.replace(yf,t.toString()).replace(bf,n.toString()).replace(xf,r.toString()).replace(Sf,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 wf(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}var Tf=class extends fi{constructor(e,t,n,r,i,a,o){let s=e.getExtent();s&&e.canWrapX()&&(s=s.slice(),s[0]=-1/0,s[2]=1/0);let c=t.getExtent();c&&t.canWrapX()&&(c=c.slice(),c[0]=-1/0,c[2]=1/0);let l=c?Me(n,c):n,u=Kd(e,t,Oe(l),r),d=new Zd(e,t,l,s,u*Qd,r),f=d.calculateSourceExtent(),p=Le(f)?null:a(f,u,i),m=p?V.IDLE:V.EMPTY,h=p?p.getPixelRatio():1;super(n,r,h,m),this.targetProj_=t,this.maxSourceExtent_=s,this.triangulation_=d,this.targetResolution_=r,this.targetExtent_=n,this.sourceImage_=p,this.sourcePixelRatio_=h,this.interpolate_=o,this.canvas_=null,this.sourceListenerKey_=null}disposeInternal(){this.state==V.LOADING&&this.unlistenSource_(),super.disposeInternal()}getImage(){return this.canvas_}getProjection(){return this.targetProj_}reproject_(){let e=this.sourceImage_;if(!e)return;let t=e.getState();if(t==V.LOADED){let t=L(this.targetExtent_)/this.targetResolution_,n=I(this.targetExtent_)/this.targetResolution_,r=e.getImage();if(!r)return;this.canvas_=Jd(t,n,this.sourcePixelRatio_,vf(e.getResolution()),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:e.getExtent(),image:r}],0,void 0,this.interpolate_,!0)}this.state=t,this.changed()}load(){if(this.state==V.IDLE){let e=this.sourceImage_;if(!e)return;this.state=V.LOADING,this.changed();let t=e.getState();t==V.LOADED||t==V.ERROR?this.reproject_():(this.sourceListenerKey_=o(e,l.CHANGE,()=>{let t=e.getState();(t==V.LOADED||t==V.ERROR)&&(this.unlistenSource_(),this.reproject_())}),e.load())}}unlistenSource_(){c(this.sourceListenerKey_),this.sourceListenerKey_=null}},Ef={IMAGELOADSTART:`imageloadstart`,IMAGELOADEND:`imageloadend`,IMAGELOADERROR:`imageloaderror`},Df=class extends O{constructor(e,t){super(e),this.image=t}},Of=class extends qo{constructor(e){super({attributions:e.attributions,projection:e.projection,state:e.state,interpolate:e.interpolate===void 0||e.interpolate}),this.on,this.once,this.un,this.loader=e.loader||null,this.resolutions_=e.resolutions===void 0?null:e.resolutions,this.reprojectedImage_=null,this.reprojectedRevision_=0,this.image=null,this.wantedExtent_,this.wantedResolution_,this.static_=e.loader?e.loader.length===0:!1,this.wantedProjection_=null}getResolutions(){return this.resolutions_}setResolutions(e){this.resolutions_=e}findNearestResolution(e){let t=this.getResolutions();return t&&(e=t[m(t,e,0)]),e}getImage(e,t,n,r){let i=this.getProjection();if(!i||!r||kn(i,r))return i&&(r=i),this.getImageInternal(e,t,n,r);if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&kn(this.reprojectedImage_.getProjection(),r)&&this.reprojectedImage_.getResolution()==t&&ye(this.reprojectedImage_.getExtent(),e))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new Tf(i,r,e,t,n,(e,t,n)=>this.getImageInternal(e,t,n,i),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}getImageInternal(e,t,n,r){if(this.loader){let i=Af(e,t,n,1),a=this.findNearestResolution(t);if(this.image&&(this.static_||this.wantedProjection_===r&&(this.wantedExtent_&&fe(this.wantedExtent_,i)||fe(this.image.getExtent(),i))&&(this.wantedResolution_&&vf(this.wantedResolution_)===a||vf(this.image.getResolution())===a)))return this.image;this.wantedProjection_=r,this.wantedExtent_=i,this.wantedResolution_=a,this.image=new fi(i,a,n,this.loader),this.image.addEventListener(l.CHANGE,this.handleImageChange.bind(this))}return this.image}handleImageChange(e){let t=e.target,n;switch(t.getState()){case V.LOADING:this.loading=!0,n=Ef.IMAGELOADSTART;break;case V.LOADED:this.loading=!1,n=Ef.IMAGELOADEND;break;case V.ERROR:this.loading=!1,n=Ef.IMAGELOADERROR;break;default:return}this.hasListener(n)&&this.dispatchEvent(new Df(n,t))}};function kf(e,t){e.getImage().src=t}function Af(e,t,n,r){let i=t/n,a=Oe(e),o=$e(L(e)/i,4),s=$e(I(e)/i,4);return Ae(a,i,0,[o+2*$e((r-1)*o/2,4),s+2*$e((r-1)*s/2,4)])}var jf=[0,0,0],Mf=5,Nf=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,M(v(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,M(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_=Pe(i)),M(!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,M(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,M(!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 Pd(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=Fd(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 Fd(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 Fd(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?Fd(o,o,s,s,n):Fd(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,jf);let r=jf[1],i=jf[2];this.getTileCoordForXYAndZ_(e[2],e[1],t,!0,jf);let a=jf[1],o=jf[2];return Fd(r,a,i,o,n)}getTileCoordCenter(e){let t=this.getOrigin(e[0]),n=this.getResolution(e[0]),r=ns(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=ns(this.getTileSize(e[0]),this.tmpSize_),a=n[0]+e[1]*i[0]*r,o=n[1]-(e[2]+1)*i[1]*r;return he(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=ns(this.getTileSize(a),this.tmpSize_),l=o*(e-s[0])/n/c[0],u=o*(s[1]-t)/n/c[1];return r?(l=$e(l,Mf)-1,u=$e(u,Mf)-1):(l=Qe(l,Mf),u=Qe(u,Mf)),tf(a,l,u,i)}getTileCoordForXYAndZ_(e,t,n,r,i){let a=this.getOrigin(n),o=this.getResolution(n),s=ns(this.getTileSize(n),this.tmpSize_),c=(e-a[0])/o/s[0],l=(a[1]-t)/o/s[1];return r?(c=$e(c,Mf)-1,l=$e(l,Mf)-1):(c=Qe(c,Mf),l=Qe(l,Mf)),tf(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 R(m(this.resolutions_,e,t||0),this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(e,t){return Ir(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 Pf(e){let t=e.getDefaultTileGrid();return t||(t=zf(e),e.setDefaultTileGrid(t)),t}function Ff(e,t,n){let r=t[0],i=e.getTileCoordCenter(t),a=Bf(n);if(!P(a,i)){let t=L(a),n=Math.ceil((a[0]-i[0])/t);return i[0]+=t*n,e.getTileCoordForCoordAndZ(i,r)}return t}function If(e,t,n,r){r=r===void 0?`top-left`:r;let i=Rf(e,t,n);return new Nf({extent:e,origin:ke(e,r),resolutions:i,tileSize:n})}function Lf(e){let t=e||{},n=t.extent||B(`EPSG:3857`)?.getExtent();if(!n)throw Error(`Unable to determine extent for XYZ tile grid`);return new Nf({extent:n,minZoom:t.minZoom,tileSize:t.tileSize,resolutions:Rf(n,t.maxZoom,t.tileSize,t.maxResolution)})}function Rf(e,t,n,r){t=t===void 0?42:t,n=ns(n===void 0?256:n);let i=I(e),a=L(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 zf(e,t,n,r){return If(Bf(e),t,n,r)}function Bf(e){let t=B(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*pt.degrees/e;n=he(-r,-r,r,r)}return n}function Vf(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 Cf(e,o,n[1],n[2],a)})}function Hf(e,t){let n=e.length,r=Array(n);for(let i=0;i<n;++i)r[i]=Vf(e[i],t);return Uf(r)}function Uf(e){return e.length===1?e[0]:(function(t,n,r){return t?e[Ye(af(t),e.length)](t,n,r):void 0})}var Wf=class extends qo{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&&ns(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),[256,256]),this.tmpSize=[0,0],this.key_=e.key||x(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 y()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:Pf(e)}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,t,n){let r=this.getTileGridForProjection(n),i=this.getTilePixelRatio(t),a=ns(r.getTileSize(e),this.tmpSize);return i==1?a:ts(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=Ff(r,e,n)),sf(e,r)?e:null}clear(){}refresh(){this.clear(),super.refresh()}},Gf=class extends O{constructor(e,t){super(e),this.tile=t}},Kf={TILELOADSTART:`tileloadstart`,TILELOADEND:`tileloadend`,TILELOADERROR:`tileloaderror`},qf=class e extends Wf{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=x(t),r=t.getState(),i;r==H.LOADING?(this.tileLoadingKeys_[n]=!0,i=Kf.TILELOADSTART):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],i=r==H.ERROR?Kf.TILELOADERROR:r==H.LOADED?Kf.TILELOADEND:void 0),i!=null&&this.dispatchEvent(new Gf(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=wf(e);this.urls=t,this.setUrls(t)}setUrls(e){this.urls=e;let t=e.join(`
7
+ `);this.generateTileUrlFunction_?this.setTileUrlFunction(Hf(e,this.tileGrid),t):this.setKey(t)}tileUrlFunction(e,t,n){}},Jf=class extends qf{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:Yf,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?ji:e.tileClass,this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(e){let t=this.getProjection();return t&&e&&!kn(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||kn(t,e)))return this.tileGrid;let n=x(e);return n in this.tileGridForProjection||(this.tileGridForProjection[n]=Pf(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,u=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 u.key=a,u.addEventListener(l.CHANGE,this.handleTileChange.bind(this)),u}getTile(e,t,n,r,i,a){let o=this.getProjection();if(!o||!i||kn(o,i))return this.getTileInternal(e,t,n,r,o||i);let s=[e,t,n],c=this.getKey(),l=new $d(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=rf(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=B(e);if(n){let e=x(n);e in this.tileGridForProjection||(this.tileGridForProjection[e]=t)}}};function Yf(e,t){if(ci){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 Xf=class extends Jf{constructor(e){e||={};let t=e.projection===void 0?`EPSG:3857`:e.projection,n=e.tileGrid===void 0?Lf({extent:Bf(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_}};function Zf(e){let t=Object.keys(e.defs),n=t.length,r,i;for(r=0;r<n;++r){let n=t[r];if(!kt(n)){let t=e.defs(n),r=t.units;!r&&t.projName===`longlat`&&(r=`degrees`),yn(new mt({code:n,axisOrientation:t.axis,metersPerUnit:t.to_meter,units:r}))}}for(r=0;r<n;++r){let a=t[r],o=kt(a);for(i=0;i<n;++i){let n=t[i],r=kt(n);if(o&&r&&!Nt(a,n)){if(e.defs(a)===e.defs(n))Sn([o,r]);else{let t=e(a,n);En(o,r,Hn(o,r,t.forward),Hn(r,o,t.inverse))}}}}}function Qf(e){let t=e.load||gi,n=e.imageExtent,r=e.crossOrigin??null;return()=>{let i=new Image;return i.crossOrigin=r,e.referrerPolicy!==void 0&&(i.referrerPolicy=e.referrerPolicy),t(i,e.url).then(e=>{let t=L(n)/e.width,r=I(n)/e.height;return{image:e,extent:n,resolution:t===r?r:[t,r],pixelRatio:1}})}}var $f=class extends Of{constructor(e){let t=e.crossOrigin===void 0?null:e.crossOrigin,n=e.imageLoadFunction===void 0?kf:e.imageLoadFunction;super({attributions:e.attributions,interpolate:e.interpolate,projection:e.projection}),this.url_=e.url,this.imageExtent_=e.imageExtent,this.image=null,this.image=new fi(this.imageExtent_,void 0,1,Qf({url:e.url,imageExtent:e.imageExtent,crossOrigin:t,referrerPolicy:e.referrerPolicy,load:(e,t)=>{let r=this.image;return r.setImage(e),n(r,t),gi(e)}})),this.image.addEventListener(l.CHANGE,this.handleImageChange.bind(this))}getImageExtent(){return this.imageExtent_}getImageInternal(e,t,n,r){let i=this.image;return i&&Ie(e,i.getExtent())?i:null}getUrl(){return this.url_}},ep=class e extends sr{constructor(e){super(),this.geometries_=e,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(c),this.changeEventsKeys_.length=0}listenGeometriesChange_(){let e=this.geometries_;for(let t=0,n=e.length;t<n;++t)this.changeEventsKeys_.push(o(e[t],l.CHANGE,this.changed,this))}clone(){let t=new e(tp(this.geometries_));return t.applyProperties(this),t}closestPointXY(e,t,n,r){if(r<de(this.getExtent(),e,t))return r;let i=this.geometries_;for(let a=0,o=i.length;a<o;++a)r=i[a].closestPointXY(e,t,n,r);return r}containsXY(e,t){let n=this.geometries_;for(let r=0,i=n.length;r<i;++r)if(n[r].containsXY(e,t))return!0;return!1}computeExtent(e){ge(e);let t=this.geometries_;for(let n=0,r=t.length;n<r;++n)be(e,t[n].getExtent());return e}getGeometries(){return tp(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let e=[],t=this.geometries_;for(let n=0,r=t.length;n<r;++n)t[n].getType()===this.getType()?e=e.concat(t[n].getGeometriesArrayRecursive()):e.push(t[n]);return e}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&t<this.simplifiedGeometryMaxMinSquaredTolerance)return this;let n=[],r=this.geometries_,i=!1;for(let e=0,a=r.length;e<a;++e){let a=r[e],o=a.getSimplifiedGeometry(t);n.push(o),o!==a&&(i=!0)}return i?new e(n):(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getType(){return`GeometryCollection`}intersectsExtent(e){let t=this.geometries_;for(let n=0,r=t.length;n<r;++n)if(t[n].intersectsExtent(e))return!0;return!1}isEmpty(){return this.geometries_.length===0}rotate(e,t){let n=this.geometries_;for(let r=0,i=n.length;r<i;++r)n[r].rotate(e,t);this.changed()}scale(e,t,n){n||=Oe(this.getExtent());let r=this.geometries_;for(let i=0,a=r.length;i<a;++i)r[i].scale(e,t,n);this.changed()}setGeometries(e){this.setGeometriesArray(tp(e))}setGeometriesArray(e){this.unlistenGeometriesChange_(),this.geometries_=e,this.listenGeometriesChange_(),this.changed()}applyTransform(e){let t=this.geometries_;for(let n=0,r=t.length;n<r;++n)t[n].applyTransform(e);this.changed()}translate(e,t){let n=this.geometries_;for(let r=0,i=n.length;r<i;++r)n[r].translate(e,t);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}};function tp(e){return e.map(e=>e.clone())}var np=class{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=ae,this.supportedMediaTypes=void 0}getReadOptions(e,t){if(t){let n=t.dataProjection?B(t.dataProjection):this.readProjection(e);if(t.extent&&n&&n.getUnits()===`tile-pixels`){let e=B(n);e&&(e.setWorldExtent(t.extent),n=e)}t={dataProjection:n??void 0,featureProjection:t.featureProjection}}return this.adaptOptions(t)}adaptOptions(e){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},e)}getType(){return y()}readFeature(e,t){return y()}readFeatures(e,t){return y()}readGeometry(e,t){return y()}readProjection(e){return y()}writeFeature(e,t){return y()}writeFeatures(e,t){return y()}writeGeometry(e,t){return y()}};function rp(e,t,n){let r=n?B(n.featureProjection):null,i=n?B(n.dataProjection):null,a=e;if(r&&i&&!kn(r,i)){t&&(a=e.clone());let n=t?r:i,o=t?i:r;if(n.getUnits()===`tile-pixels`)a.transform(n,o);else{let e=Mn(n,o);e&&a.applyTransform(e)}}if(t&&n&&n.decimals!==void 0){let t=10**n.decimals;a===e&&(a=e.clone()),a.applyTransform(function(e){for(let n=0,r=e.length;n<r;++n)e[n]=Math.round(e[n]*t)/t;return e})}return a}function ip(e,t,n){if(Array.isArray(t[0])){let r=t;return Qr(e,0,r,n)||(e=e.slice(),ei(e,0,r,n)),e}let r=t;return Zr(e,0,r,n)||(e=e.slice(),$r(e,0,r,n)),e}function ap(e,t){let n=e.geometry;if(!n)return[];if(Array.isArray(n))return n.map(t=>ap({...e,geometry:t})).flat();let r=n.type===`MultiPolygon`?`Polygon`:n.type;if(r===`GeometryCollection`||r===`Circle`)throw Error(`Unsupported geometry type: `+r);let i=(n.layout??`XY`).length;return rp(new Do(r,r===`Polygon`?ip(n.flatCoordinates,n.ends,i):n.flatCoordinates,n.ends?.flat()??[],i,e.properties||{},e.id).enableSimplifyTransformed(),!1,t)}function op(e,t){if(!e)return null;if(Array.isArray(e))return new ep(e.map(e=>op(e,t)));let n=e.type,r=e.layout||`XY`,i;switch(n){case`Point`:i=new Kr(e.flatCoordinates,r);break;case`LineString`:i=new Ri(e.flatCoordinates,r);break;case`Polygon`:i=new ni(e.flatCoordinates,r,e.ends);break;case`MultiPoint`:i=new Co(e.flatCoordinates,r);break;case`MultiLineString`:i=new So(e.flatCoordinates,r,e.ends);break;case`MultiPolygon`:i=new To(e.flatCoordinates,r,e.ends);break;default:throw Error(`Unsupported geometry type: `+n)}return rp(i,!1,t)}var sp=class extends np{constructor(){super()}getType(){return`json`}readFeature(e,t){let n=cp(e);return n?this.readFeatureFromObject(n,this.getReadOptions(e,t)):[]}readFeatures(e,t){let n=cp(e);return n?this.readFeaturesFromObject(n,this.getReadOptions(e,t)):[]}readFeatureFromObject(e,t){return y()}readFeaturesFromObject(e,t){return y()}readGeometry(e,t){let n=cp(e);if(!n)throw Error(`Expected a JSON object`);return this.readGeometryFromObject(n,this.getReadOptions(e,t))}readGeometryFromObject(e,t){return y()}readProjection(e){let t=cp(e);if(!t)throw Error(`Expected a JSON object`);return this.readProjectionFromObject(t)}readProjectionFromObject(e){return y()}writeFeature(e,t){return JSON.stringify(this.writeFeatureObject(e,t))}writeFeatureObject(e,t){return y()}writeFeatures(e,t){return JSON.stringify(this.writeFeaturesObject(e,t))}writeFeaturesObject(e,t){return y()}writeGeometry(e,t){return JSON.stringify(this.writeGeometryObject(e,t))}writeGeometryObject(e,t){return y()}};function cp(e){return typeof e==`string`?JSON.parse(e)||null:e===null?null:e}var lp=class extends sp{constructor(e){e||={},super(),this.dataProjection=B(e.dataProjection?e.dataProjection:`EPSG:4326`)??void 0,e.featureProjection&&(this.defaultFeatureProjection=B(e.featureProjection)??void 0),e.featureClass&&(this.featureClass=e.featureClass),this.geometryName_=e.geometryName,this.extractGeometryName_=e.extractGeometryName,this.supportedMediaTypes=[`application/geo+json`,`application/vnd.geo+json`]}readFeatureFromObject(e,t){let n=e,r;r=n.type===`Feature`?n:{type:`Feature`,geometry:e,properties:null};let i=up(r.geometry,t);if(this.featureClass===Do)return ap({geometry:i??void 0,id:r.id,properties:r.properties??void 0},t);let a=this.featureClass,o=new a;return this.geometryName_?o.setGeometryName(this.geometryName_):this.extractGeometryName_&&`geometry_name`in r&&r.geometry_name&&o.setGeometryName(r.geometry_name),o.setGeometry(op(i,t)),`id`in r&&o.setId(r.id),r.properties&&o.setProperties(r.properties,!0),o}readFeaturesFromObject(e,t){let n=e,r=null;if(n.type===`FeatureCollection`){let n=e;r=[];let i=n.features;for(let e=0,n=i.length;e<n;++e){let n=this.readFeatureFromObject(i[e],t);n&&r.push(n)}}else r=[this.readFeatureFromObject(e,t)];return r.flat()}readGeometryFromObject(e,t){return dp(e,t)}readProjectionFromObject(e){let t=e.crs,n;if(t){if(t.type==`name`)n=B(t.properties.name);else if(t.type===`EPSG`)n=B(`EPSG:`+t.properties.code);else throw Error(`Unknown SRS type`)}else n=this.dataProjection;return n}writeFeatureObject(e,t){t=this.adaptOptions(t);let n={type:`Feature`,geometry:null,properties:null},r=e.getId();if(r!==void 0&&(n.id=r),!e.hasProperties())return n;let i=e.getProperties(),o=e.getGeometry();return o&&(n.geometry=yp(o,t),delete i[e.getGeometryName()]),a(i)||(n.properties=i),n}writeFeaturesObject(e,t){t=this.adaptOptions(t);let n=[];for(let r=0,i=e.length;r<i;++r)n.push(this.writeFeatureObject(e[r],t));return{type:`FeatureCollection`,features:n}}writeGeometryObject(e,t){return yp(e,this.adaptOptions(t))}};function up(e,t){if(!e||e.type!==`GeometryCollection`&&Array.isArray(e.coordinates)&&!e.coordinates.length)return null;let n;switch(e.type){case`Point`:n=pp(e);break;case`LineString`:n=mp(e);break;case`Polygon`:n=vp(e);break;case`MultiPoint`:n=gp(e);break;case`MultiLineString`:n=hp(e);break;case`MultiPolygon`:n=_p(e);break;case`GeometryCollection`:n=fp(e);break;default:throw Error(`Unsupported GeoJSON type: `+e.type)}return n}function dp(e,t){let n=up(e,t);return n?op(n,t):null}function fp(e,t){let n=e.geometries,r=[];for(let e of n){let n=up(e,t);n&&r.push(n)}return r}function pp(e){let t=e.coordinates;return{type:`Point`,flatCoordinates:t,layout:lr(t.length)}}function mp(e){let t=e.coordinates,n=t.flat();return{type:`LineString`,flatCoordinates:n,ends:[n.length],layout:lr(t[0]?.length||2)}}function hp(e){let t=e.coordinates,n=t[0]?.[0]?.length||2,r=[];return{type:`MultiLineString`,flatCoordinates:r,ends:wr(r,0,t,n),layout:lr(n)}}function gp(e){let t=e.coordinates;return{type:`MultiPoint`,flatCoordinates:t.flat(),layout:lr(t[0]?.length||2)}}function _p(e){let t=e.coordinates,n=[],r=t[0]?.[0]?.[0].length||2;return{type:`MultiPolygon`,flatCoordinates:n,ends:Tr(n,0,t,r),layout:lr(r)}}function vp(e){let t=e.coordinates,n=[],r=t[0]?.[0]?.length;return{type:`Polygon`,flatCoordinates:n,ends:wr(n,0,t,r),layout:lr(r)}}function yp(e,t){e=rp(e,!0,t);let n=e.getType(),r;switch(n){case`Point`:r=Tp(e,t);break;case`LineString`:r=xp(e,t);break;case`Polygon`:r=Ep(e,t);break;case`MultiPoint`:r=Cp(e,t);break;case`MultiLineString`:r=Sp(e,t);break;case`MultiPolygon`:r=wp(e,t);break;case`GeometryCollection`:r=bp(e,t);break;case`Circle`:r={type:`GeometryCollection`,geometries:[]};break;default:throw Error(`Unsupported geometry type: `+n)}return r}function bp(e,t){return t=Object.assign({},t),delete t.featureProjection,{type:`GeometryCollection`,geometries:e.getGeometriesArray().map(function(e){return yp(e,t)})}}function xp(e,t){return{type:`LineString`,coordinates:e.getCoordinates()}}function Sp(e,t){return{type:`MultiLineString`,coordinates:e.getCoordinates()}}function Cp(e,t){return{type:`MultiPoint`,coordinates:e.getCoordinates()}}function wp(e,t){let n;return t&&(n=t.rightHanded),{type:`MultiPolygon`,coordinates:e.getCoordinates(n)}}function Tp(e,t){return{type:`Point`,coordinates:e.getCoordinates()}}function Ep(e,t){let n;return t&&(n=t.rightHanded),{type:`Polygon`,coordinates:e.getCoordinates(n)}}var Dp=[`fullscreenchange`,`webkitfullscreenchange`],Op={ENTERFULLSCREEN:`enterfullscreen`,LEAVEFULLSCREEN:`leavefullscreen`},kp=class extends Iu{constructor(e){e||={},super({element:document.createElement(`div`),target:e.target}),this.on,this.once,this.un,this.keys_=e.keys!==void 0&&e.keys,this.source_=e.source,this.isInFullscreen_=!1,this.boundHandleMapTargetChange_=this.handleMapTargetChange_.bind(this),this.cssClassName_=e.className===void 0?`ol-full-screen`:e.className,this.documentListeners_=[],this.activeClassName_=e.activeClassName===void 0?[this.cssClassName_+`-true`]:e.activeClassName.split(` `),this.inactiveClassName_=e.inactiveClassName===void 0?[this.cssClassName_+`-false`]:e.inactiveClassName.split(` `);let t=e.label===void 0?`⛶`:e.label;this.labelNode_=typeof t==`string`?document.createTextNode(t):t;let n=e.labelActive===void 0?`×`:e.labelActive;this.labelActiveNode_=typeof n==`string`?document.createTextNode(n):n;let r=e.tipLabel?e.tipLabel:`Toggle full-screen`;this.button_=document.createElement(`button`),this.button_.title=r,this.button_.setAttribute(`type`,`button`),this.button_.appendChild(this.labelNode_),this.button_.addEventListener(l.CLICK,this.handleClick_.bind(this),!1),this.setClassName_(this.button_,this.isInFullscreen_);let i=this.element;i.className=`${this.cssClassName_} ${Sa} ${wa}`,i.appendChild(this.button_)}handleClick_(e){e.preventDefault(),this.handleFullScreen_()}handleFullScreen_(){let e=this.getMap();if(!e)return;let t=e.getOwnerDocument();if(Ap(t)){if(jp(t))Pp(t);else{let n;if(n=this.source_?typeof this.source_==`string`?t.getElementById(this.source_):this.source_:e.getTargetElement(),!n)return;this.keys_?Np(n):Mp(n)}}}handleFullScreenChange_(){let e=this.getMap();if(!e)return;let t=this.isInFullscreen_;this.isInFullscreen_=jp(e.getOwnerDocument()),t!==this.isInFullscreen_&&(this.setClassName_(this.button_,this.isInFullscreen_),this.isInFullscreen_?(Ei(this.labelActiveNode_,this.labelNode_),this.dispatchEvent(Op.ENTERFULLSCREEN)):(Ei(this.labelNode_,this.labelActiveNode_),this.dispatchEvent(Op.LEAVEFULLSCREEN)),e.updateSize())}setClassName_(e,t){t?(e.classList.remove(...this.inactiveClassName_),e.classList.add(...this.activeClassName_)):(e.classList.remove(...this.activeClassName_),e.classList.add(...this.inactiveClassName_))}setMap(e){let t=this.getMap();t&&t.removeChangeListener(ju.TARGET,this.boundHandleMapTargetChange_),super.setMap(e),this.handleMapTargetChange_(),e&&e.addChangeListener(ju.TARGET,this.boundHandleMapTargetChange_)}handleMapTargetChange_(){let e=this.documentListeners_;for(let t=0,n=e.length;t<n;++t)c(e[t]);e.length=0;let t=this.getMap();if(t){let n=t.getOwnerDocument();Ap(n)?this.element.classList.remove(Ca):this.element.classList.add(Ca);for(let t=0,r=Dp.length;t<r;++t)e.push(o(n,Dp[t],this.handleFullScreenChange_,this));this.handleFullScreenChange_()}}};function Ap(e){let t=e.body;return!!(t.webkitRequestFullscreen||`requestFullscreen`in t&&e.fullscreenEnabled)}function jp(e){return!!(e.webkitIsFullScreen||e.fullscreenElement)}function Mp(e){let t=e;e.requestFullscreen?e.requestFullscreen():t.webkitRequestFullscreen&&t.webkitRequestFullscreen()}function Np(e){let t=e;t.webkitRequestFullscreen?t.webkitRequestFullscreen():Mp(e)}function Pp(e){let t=e;e.exitFullscreen?e.exitFullscreen():t.webkitExitFullscreen&&t.webkitExitFullscreen()}var Fp=`projection`,Ip=`coordinateFormat`,Lp=class extends Iu{constructor(e){e||={};let t=document.createElement(`div`);t.className=e.className===void 0?`ol-mouse-position`:e.className,super({element:t,render:e.render,target:e.target}),this.on,this.once,this.un,this.addChangeListener(Fp,this.handleProjectionChanged_),e.coordinateFormat&&this.setCoordinateFormat(e.coordinateFormat),e.projection&&this.setProjection(e.projection),this.renderOnMouseOut_=e.placeholder!==void 0,this.placeholder_=this.renderOnMouseOut_?e.placeholder:`&#160;`,this.renderedHTML_=t.innerHTML,this.mapProjection_=null,this.transform_=null,this.wrapX_=e.wrapX!==!1}handleProjectionChanged_(){this.transform_=null}getCoordinateFormat(){return this.get(Ip)}getProjection(){return this.get(Fp)}handleMouseMove(e){let t=this.getMap();t&&this.updateHTML_(t.getEventPixel(e))}handleMouseOut(e){this.updateHTML_(null)}setMap(e){if(super.setMap(e),e){let t=e.getViewport();if(!t)return;this.listenerKeys.push(o(t,Ou.POINTERMOVE,this.handleMouseMove,this)),this.renderOnMouseOut_&&this.listenerKeys.push(o(t,Ou.POINTEROUT,this.handleMouseOut,this)),this.updateHTML_(null)}}setCoordinateFormat(e){this.set(Ip,e)}setProjection(e){this.set(Fp,B(e))}updateHTML_(e){let t=this.placeholder_;if(e&&this.mapProjection_){if(!this.transform_){let e=this.getProjection();this.transform_=e?An(this.mapProjection_,e):vn}let n=this.getMap();if(!n)return;let r=n.getCoordinateFromPixelInternal(e);if(r){let e=In();e&&(this.transform_=An(this.mapProjection_,e));let n=this.transform_;n&&n(r,r),this.wrapX_&&lt(r,e||this.getProjection()||this.mapProjection_);let i=this.getCoordinateFormat();t=i?i(r):r.toString()}}if(!this.renderedHTML_||t!==this.renderedHTML_){let e=this.element;e&&(e.innerHTML=t,this.renderedHTML_=t)}}render(e){let t=e.frameState;t?this.mapProjection_!=t.viewState.projection&&(this.mapProjection_=t.viewState.projection,this.transform_=null):this.mapProjection_=null}},Rp=`units`,zp=[1,2,5],Bp=25.4/.28,Vp=class extends Iu{constructor(e){e||={};let t=document.createElement(`div`);t.style.pointerEvents=`none`,super({element:t,render:e.render,target:e.target}),this.on,this.once,this.un;let n=e.className===void 0?e.bar?`ol-scale-bar`:`ol-scale-line`:e.className;this.innerElement_=document.createElement(`div`),this.innerElement_.className=n+`-inner`,this.element.className=n+` `+Sa,this.element.appendChild(this.innerElement_),this.viewState_=null,this.minWidth_=e.minWidth===void 0?64:e.minWidth,this.maxWidth_=e.maxWidth,this.renderedVisible_=!1,this.renderedWidth_=void 0,this.renderedHTML_=``,this.addChangeListener(Rp,this.handleUnitsChanged_),this.setUnits(e.units||`metric`),this.scaleBar_=e.bar||!1,this.scaleBarSteps_=e.steps||4,this.scaleBarText_=e.text||!1,this.dpi_=e.dpi||void 0}getUnits(){return this.get(Rp)}handleUnitsChanged_(){this.updateElement_()}setUnits(e){this.set(Rp,e)}setDpi(e){this.dpi_=e}updateElement_(){let e=this.viewState_;if(!e){let e=this.element;this.renderedVisible_&&e&&(e.style.display=`none`,this.renderedVisible_=!1);return}let t=e.center,n=e.projection,r=this.getUnits(),i=r==`degrees`?`degrees`:`m`,a=xn(n,e.resolution,t,i),o=this.minWidth_*(this.dpi_||Bp)/Bp,s=this.maxWidth_===void 0?void 0:this.maxWidth_*(this.dpi_||Bp)/Bp,c=o*a,l=``;if(r==`degrees`){let e=pt.degrees;c*=e,c<e/60?(l=`″`,a*=3600):c<e?(l=`′`,a*=60):l=`°`}else if(r==`imperial`)c<.9144?(l=`in`,a/=.0254):c<1609.344?(l=`ft`,a/=.3048):(l=`mi`,a/=1609.344);else if(r==`nautical`)a/=1852,l=`NM`;else if(r==`metric`)c<1e-6?(l=`nm`,a*=1e9):c<.001?(l=`μm`,a*=1e6):c<1?(l=`mm`,a*=1e3):c<1e3?l=`m`:(l=`km`,a/=1e3);else if(r==`us`)c<.9144?(l=`in`,a*=39.37):c<1609.344?(l=`ft`,a/=.30480061):(l=`mi`,a/=1609.3472);else throw Error(`Invalid units`);let u=3*Math.floor(Math.log(o*a)/Math.log(10)),d,f,p=0,m=0,h,g;for(;;){p=Math.floor(u/3);let e=10**p;if(d=zp[(u%3+3)%3]*e,f=Math.round(d/a),isNaN(f)){let e=this.element;e&&(e.style.display=`none`),this.renderedVisible_=!1;return}if(s!==void 0&&f>=s){d=m,f=h,p=g;break}if(f>=o)break;m=d,h=f,g=p,++u}let _=this.scaleBar_?this.createScaleBar(f,d,l):d.toFixed(p<0?-p:0)+` `+l;if(this.renderedHTML_!=_&&(this.innerElement_.innerHTML=_,this.renderedHTML_=_),this.renderedWidth_!=f&&(this.innerElement_.style.width=f+`px`,this.renderedWidth_=f),!this.renderedVisible_){let e=this.element;e&&(e.style.display=``),this.renderedVisible_=!0}}createScaleBar(e,t,n){let r=this.getScaleForResolution(),i=r<1?Math.round(1/r).toLocaleString()+` : 1`:`1 : `+Math.round(r).toLocaleString(),a=this.scaleBarSteps_,o=e/a,s=[this.createMarker(`absolute`)];for(let r=0;r<a;++r){let i=r%2==0?`ol-scale-singlebar-odd`:`ol-scale-singlebar-even`;s.push(`<div><div class="ol-scale-singlebar ${i}" style="width: ${o}px;"></div>`+this.createMarker(`relative`)+(r%2==0||a===2?this.createStepText(r,e,!1,t,n):``)+`</div>`)}return s.push(this.createStepText(a,e,!0,t,n)),(this.scaleBarText_?`<div class="ol-scale-text" style="width: ${e}px;">`+i+`</div>`:``)+s.join(``)}createMarker(e){return`<div class="ol-scale-step-marker" style="position: ${e}; top: ${e===`absolute`?3:-10}px;"></div>`}createStepText(e,t,n,r,i){let a=(e===0?0:Math.round(r/this.scaleBarSteps_*e*100)/100)+(e===0?``:` `+i),o=e===0?-3:t/this.scaleBarSteps_*-1,s=e===0?0:t/this.scaleBarSteps_*2;return`<div class="ol-scale-step-text" style="margin-left: ${o}px;text-align: ${e===0?`left`:`center`};min-width: ${s}px;left: ${n?t+`px`:`unset`};">`+a+`</div>`}getScaleForResolution(){let e=this.viewState_;if(!e)return 0;let t=xn(e.projection,e.resolution,e.center,`m`),n=this.dpi_||Bp;return 1e3/25.4*t*n}render(e){let t=e.frameState;this.viewState_=t?t.viewState:null,this.updateElement_()}};function Hp(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 Up=6378137,Wp=6356752.314,Gp=.0066943799901413165,Kp=484813681109536e-20,X=Math.PI/2,qp=.16666666666666666,Jp=.04722222222222222,Yp=.022156084656084655,Xp=1e-10,Zp=.017453292519943295,Qp=57.29577951308232,Z=Math.PI/4,$p=Math.PI*2,em=3.14159265359,tm={};tm.greenwich=0,tm.lisbon=-9.131906111111,tm.paris=2.337229166667,tm.bogota=-74.080916666667,tm.madrid=-3.687938888889,tm.rome=12.452333333333,tm.bern=7.439583333333,tm.jakarta=106.807719444444,tm.ferro=-17.666666666667,tm.brussels=4.367975,tm.stockholm=18.058277777778,tm.athens=23.7163375,tm.oslo=10.722916666667;var nm={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}},rm=/[\s_\-\/\(\)]/g;function im(e,t){if(e[t])return e[t];for(var n=Object.keys(e),r=t.toLowerCase().replace(rm,``),i=-1,a,o;++i<n.length;)if(a=n[i],o=a.toLowerCase().replace(rm,``),o===r)return e[a]}function am(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*Zp},lat_1:function(e){t.lat1=e*Zp},lat_2:function(e){t.lat2=e*Zp},lat_ts:function(e){t.lat_ts=e*Zp},lon_0:function(e){t.long0=e*Zp},lon_wrap:function(e){t.long_wrap=parseFloat(e)*Zp},lon_1:function(e){t.long1=e*Zp},lon_2:function(e){t.long2=e*Zp},alpha:function(e){t.alpha=parseFloat(e)*Zp},gamma:function(e){t.rectified_grid_angle=parseFloat(e)*Zp},lonc:function(e){t.longc=e*Zp},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=im(nm,e);n&&(t.to_meter=n.to_meter)},from_greenwich:function(e){t.from_greenwich=e*Zp},pm:function(e){t.from_greenwich=(im(tm,e)||parseFloat(e))*Zp},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 om=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 sm(e){return om.convert(e)}function cm(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 lm=Sm,um=1,dm=2,fm=3,pm=4,mm=5,hm=-1,gm=/\s/,_m=/[A-Za-z]/,vm=/[A-Za-z84_]/,ym=/[,\]]/,bm=/[\d\.E\-\+]/;function xm(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=um}xm.prototype.readCharicter=function(){var e=this.text[this.place++];if(this.state!==pm)for(;gm.test(e);){if(this.place>=this.text.length)return;e=this.text[this.place++]}switch(this.state){case um:return this.neutral(e);case dm:return this.keyword(e);case pm:return this.quoted(e);case mm:return this.afterquote(e);case fm:return this.number(e);case hm:return}},xm.prototype.afterquote=function(e){if(e===`"`)this.word+=`"`,this.state=pm;else if(ym.test(e))this.word=this.word.trim(),this.afterItem(e);else throw Error(`havn't handled "`+e+`" in afterquote yet, index `+this.place)},xm.prototype.afterItem=function(e){e===`,`?(this.word!==null&&this.currentObject.push(this.word),this.word=null,this.state=um):e===`]`&&(this.level--,this.word!==null&&(this.currentObject.push(this.word),this.word=null),this.state=um,this.currentObject=this.stack.pop(),this.currentObject||(this.state=hm))},xm.prototype.number=function(e){if(bm.test(e))this.word+=e;else if(ym.test(e))this.word=parseFloat(this.word),this.afterItem(e);else throw Error(`havn't handled "`+e+`" in number yet, index `+this.place)},xm.prototype.quoted=function(e){e===`"`?this.state=mm:this.word+=e},xm.prototype.keyword=function(e){if(vm.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=um}else if(ym.test(e))this.afterItem(e);else throw Error(`havn't handled "`+e+`" in keyword yet, index `+this.place)},xm.prototype.neutral=function(e){if(_m.test(e))this.word=e,this.state=dm;else if(e===`"`)this.word=``,this.state=pm;else if(bm.test(e))this.word=e,this.state=fm;else if(ym.test(e))this.afterItem(e);else throw Error(`havn't handled "`+e+`" in neutral yet, index `+this.place)},xm.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(this.state===hm)return this.root;throw Error(`unable to parse string "`+this.text+`". State is `+this.state)};function Sm(e){return new xm(e).output()}function Cm(e,t,n){Array.isArray(t)&&(n.unshift(t),t=null);var r=t?{}:e,i=n.reduce(function(e,t){return wm(t,e),e},r);t&&(e[t]=i)}function wm(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]={},wm(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&&wm(e[2],t[n]);return;case`SPHEROID`:case`ELLIPSOID`:t[n]={name:e[0],a:e[1],rf:e[2]},e.length===4&&wm(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]],Cm(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]],Cm(t,n,e),t[n].type=n;return;default:for(r=-1;++r<e.length;)if(!Array.isArray(e[r]))return wm(e,t[n]);return Cm(t,n,e)}}}}var Tm=.017453292519943295;function Em(e){return e*Tm}function Dm(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=Em(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=Em(e.lat0>0?90:-90),delete e.lat1)}function Om(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 km(e){return typeof e==`object`?e.value*e.unit.conversion_factor:e}function Am(e,t){e.ellipsoid.radius?(t.a=e.ellipsoid.radius,t.rf=0):(t.a=km(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-km(e.ellipsoid.semi_minor_axis))):t.rf=e.ellipsoid.inverse_flattening)}function jm(e,t={}){return!e||typeof e!=`object`?e:e.type===`BoundCRS`?(jm(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,Am(r,t)),r.prime_meridian&&(t.from_greenwich=r.prime_meridian.longitude*Math.PI/180);break;case`ellipsoid`:t.ellps=r.name,Am(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}=Om(r.unit);t.units=e,t.to_meter=n}else if(r.axis[0]&&r.axis[0].unit){let{units:e,to_meter:n}=Om(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`:jm(r,t),t.datumCode=r.id?r.id.authority+`_`+r.id.code:r.name}}),!t.datumCode&&(e.type===`GeographicCRS`||e.type===`GeodeticCRS`)&&e.id&&(t.datumCode=e.id.authority+`_`+e.id.code),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),Dm(t),t)}var Mm=[`PROJECTEDCRS`,`PROJCRS`,`GEOGCS`,`GEOCCS`,`PROJCS`,`LOCAL_CS`,`GEODCRS`,`GEODETICCRS`,`GEODETICDATUM`,`ENGCRS`,`ENGINEERINGCRS`];function Nm(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 Pm(e){for(var t=Object.keys(e),n=0,r=t.length;n<r;++n){var i=t[n];Mm.indexOf(i)!==-1&&Fm(e[i]),typeof e[i]==`object`&&Pm(e[i])}}function Fm(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=Em(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&&=Em(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`,Em],[`longitude_of_center`,`Longitude_Of_Center`],[`longitude_of_center`,`Longitude_of_center`],[`longc`,`longitude_of_center`,Em],[`x0`,`false_easting`,s],[`y0`,`false_northing`,s],[`long0`,`central_meridian`,Em],[`lat0`,`latitude_of_origin`,Em],[`lat0`,`standard_parallel_1`,Em],[`lat1`,`standard_parallel_1`,Em],[`lat2`,`standard_parallel_2`,Em],[`azimuth`,`Azimuth`],[`alpha`,`azimuth`,Em],[`srsCode`,`name`]].forEach(function(t){return Nm(e,t)}),Dm(e)}function Im(e){if(typeof e==`object`)return jm(e);let t=cm(e);var n=lm(e);if(t===`WKT2`)return jm(sm(n));var r=n[0],i={};return wm(n,i),Pm(i),i[r]}function Lm(e){var t=this;if(arguments.length===2){var n=arguments[1];typeof n==`string`?Lm[e]=n.charAt(0)===`+`?am(arguments[1]):Im(arguments[1]):n&&typeof n==`object`&&!(`projName`in n)?Lm[e]=Im(arguments[1]):(Lm[e]=n,n||delete Lm[e])}else if(arguments.length===1){if(Array.isArray(e))return e.map(function(e){return Array.isArray(e)?Lm.apply(t,e):Lm(e)});if(typeof e==`string`){if(e in Lm)return Lm[e]}else`EPSG`in e?Lm[`EPSG:`+e.EPSG]=e:`ESRI`in e?Lm[`ESRI:`+e.ESRI]=e:`IAU2000`in e?Lm[`IAU2000:`+e.IAU2000]=e:console.log(e);return}}Hp(Lm);function Rm(e){return typeof e==`string`}function zm(e){return e in Lm}function Bm(e){return e.indexOf(`+`)!==0&&e.indexOf(`[`)!==-1||typeof e==`object`&&!(`srsCode`in e)}var Vm=[`3857`,`900913`,`3785`,`102113`];function Hm(e){if(e.title)return e.title.toLowerCase().indexOf(`epsg:`)===0&&Vm.indexOf(e.title.substr(5))>-1;var t=im(e,`authority`);if(t){var n=im(t,`epsg`);return n&&Vm.indexOf(n)>-1}}function Um(e){var t=im(e,`extension`);if(t)return im(t,`proj4`)}function Wm(e){return e[0]===`+`}function Gm(e){let t;if(Rm(e)){if(zm(e))t=Lm[e];else if(Bm(e)){t=Im(e);var n=Um(t);n&&(t=am(n))}else Wm(e)&&(t=am(e))}else t=`projName`in e?e:Im(e);return t&&Hm(t)?Lm[`EPSG:3857`]:t}function Km(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 qm(e,t,n){var r=e*t;return n/Math.sqrt(1-r*r)}function Jm(e){return e<0?-1:1}function Q(e,t){return t||Math.abs(e)<=3.14159265359?e:e-Jm(e)*$p}function Ym(e,t,n){var r=e*n,i=.5*e;return r=((1-r)/(1+r))**i,Math.tan(.5*(X-t))/r}function Xm(e,t){for(var n=.5*e,r,i,a=X-2*Math.atan(t),o=0;o<=15;o++)if(r=e*Math.sin(a),i=X-2*Math.atan(t*((1-r)/(1+r))**n)-a,a+=i,Math.abs(i)<=1e-10)return a;return-9999}function Zm(){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):qm(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||=this.k?this.k:1}function Qm(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)-X)<=1e-10)return null;if(this.sphere)r=this.x0+this.a*this.k0*Q(t-this.long0,this.over),i=this.y0+this.a*this.k0*Math.log(Math.tan(Z+.5*n));else{var a=Math.sin(n),o=Ym(this.e,n,a);r=this.x0+this.a*this.k0*Q(t-this.long0,this.over),i=this.y0-this.a*this.k0*Math.log(o)}return e.x=r,e.y=i,e}function $m(e){var t=e.x-this.x0,n=e.y-this.y0,r,i;if(this.sphere)i=X-2*Math.atan(Math.exp(-n/(this.a*this.k0)));else{var a=Math.exp(-n/(this.a*this.k0));if(i=Xm(this.e,a),i===-9999)return null}return r=Q(this.long0+t/(this.a*this.k0),this.over),e.x=r,e.y=i,e}var eh={init:Zm,forward:Qm,inverse:$m,names:[`Mercator`,`Popular Visualisation Pseudo Mercator`,`Mercator_1SP`,`Mercator_Auxiliary_Sphere`,`Mercator_Variant_A`,`merc`]};function th(){}function nh(e){return e}var rh=[`longlat`,`identity`,`lonlat`,`latlon`,`latlong`],ih=[eh,{init:th,forward:nh,inverse:nh,names:rh}],ah={},oh=[];function sh(e,t){var n=oh.length;return e.names?(oh[n]=e,e.names.forEach(function(e){ah[e.toLowerCase()]=n}),this):(console.log(t),!0)}function ch(e){return e.replace(/[-\(\)\s]+/g,` `).trim().replace(/ /g,`_`)}function lh(e){if(!e)return!1;var t=e.toLowerCase();if(ah[t]!==void 0&&oh[ah[t]]||(t=ch(t),t in ah&&oh[ah[t]]))return oh[ah[t]]}function uh(){ih.forEach(sh)}var dh={start:uh,add:sh,get:lh},fh={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)`}},ph=fh.WGS84;function mh(e,t,n,r){var i=e*e,a=t*t,o=(i-a)/i,s=0;r?(e*=1-o*(qp+o*(Jp+o*Yp)),i=e*e,o=0):s=Math.sqrt(o);var c=(i-a)/a;return{es:o,e:s,ep2:c}}function hh(e,t,n,r,i){if(!e){var a=im(fh,r);a||=ph,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 gh={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 _h in gh){var vh=gh[_h];vh.datumName&&(gh[vh.datumName]=vh)}function yh(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]*=Kp,s.datum_params[4]*=Kp,s.datum_params[5]*=Kp,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 bh={};function xh(e,t,n){return t instanceof ArrayBuffer?Sh(e,t,n):{ready:Ch(e,t)}}function Sh(e,t,n){var r=!0;n!==void 0&&n.includeErrorFields===!1&&(r=!1);var i=new DataView(t),a=Oh(i),o=kh(i,a),s={header:o,subgrids:jh(i,o,a,r)};return bh[e]=s,s}async function Ch(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(Eh),l=typeof a.fileDirectory.getValue==`function`?a.fileDirectory.getValue(`ModelPixelScale`):a.fileDirectory.ModelPixelScale,u=[l[0],l[1]].map(Eh),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([-Dh(m[g]),Dh(p[g])])}n.push({del:u,lim:s,ll:[-d,f],cvs:h})}var _={header:{nSubgrids:r},subgrids:n};return bh[e]=_,_}function wh(e){return e===void 0?null:e.split(`,`).map(Th)}function Th(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:bh[e]||null,isNull:!1}}function Eh(e){return e*Math.PI/180}function Dh(e){return e/3600*Math.PI/180}function Oh(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 kh(e,t){return{nFields:e.getInt32(8,t),nSubgridFields:e.getInt32(24,t),nSubgrids:e.getInt32(40,t),shiftType:Ah(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 Ah(e,t,n){return String.fromCharCode.apply(null,new Uint8Array(e.buffer.slice(t,n)))}function jh(e,t,n,r){for(var i=176,a=[],o=0;o<t.nSubgrids;o++){var s=Nh(e,i,n),c=Ph(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:[Dh(s.lowerLongitude),Dh(s.lowerLatitude)],del:[Dh(s.longitudeInterval),Dh(s.latitudeInterval)],lim:[l,u],count:s.gridNodeCount,cvs:Mh(c)});var d=16;r===!1&&(d=8),i+=176+s.gridNodeCount*d}return a}function Mh(e){return e.map(function(e){return[Dh(e.longitudeShift),Dh(e.latitudeShift)]})}function Nh(e,t,n){return{name:Ah(e,t+8,t+16).trim(),parent:Ah(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 Ph(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 Fh(e,t){if(!(this instanceof Fh))return new Fh(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=Gm(e);if(typeof n!=`object`)t(`Could not parse to valid json: `+e);else{var r=Fh.projections.get(n.projName);if(!r)t(`Could not get projection name from: `+e);else{if(n.datumCode&&n.datumCode!==`none`){var i=im(gh,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=hh(n.a,n.b,n.rf,n.ellps,n.sphere),o=mh(a.a,a.b,a.rf,n.R_A),s=wh(n.nadgrids),c=n.datum||yh(n.datumCode,n.datum_params,a.a,a.b,o.es,o.ep2,s);Km(this,n),Km(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)}}}Fh.projections=dh,Fh.projections.start();function Ih(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 Lh(e,t,n){var r=e.x,i=e.y,a=e.z?e.z:0,o,s,c,l;if(i<-X&&i>-1.001*X)i=-X;else if(i>X&&i<1.001*X)i=X;else if(i<-X)return{x:-1/0,y:-1/0,z:e.z};else if(i>X)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 Rh(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=X,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 zh(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 Bh(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 Vh(e){return e===1||e===2}function Hh(e,t,n){if(Ih(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(Uh(e,!1,n)!==0)return;r=Up,i=Gp}var a=t.a,o=t.b,s=t.es;if(t.datum_type===3&&(a=Up,o=Wp,s=Gp),i===s&&r===a&&!Vh(e.datum_type)&&!Vh(t.datum_type)||(n=Lh(n,i,r),Vh(e.datum_type)&&(n=zh(n,e.datum_type,e.datum_params)),Vh(t.datum_type)&&(n=Bh(n,t.datum_type,t.datum_params)),n=Rh(n,s,a,o),t.datum_type!==3||Uh(t,!0,n)===0))return n}function Uh(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=Wh(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*Qp+` `+r.y*Qp+` tried: '`+a+`'`),-1):(n.x=-i.x,n.y=i.y,0)}function Wh(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=Q(i.x-Math.PI)+Math.PI;var a=Gh(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=Gh(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=Q(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 Gh(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 Kh=[`x`,`y`,`z`];function qh(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[Kh[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 Jh(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[Kh[r]]=t.x;break;case`w`:n[Kh[r]]=-t.x;break;case`n`:n[Kh[r]]=t.y;break;case`s`:n[Kh[r]]=-t.y;break;case`u`:n[Kh[r]]=t.z;break;case`d`:n[Kh[r]]=-t.z;break;default:return null}return n}function Yh(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 Xh(e){Zh(e.x),Zh(e.y)}function Zh(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 Qh(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 $h(e,t,n,r){var i,a=n.z!==void 0;if(Xh(n),e.datum&&t.datum&&Qh(e,t)&&(i=new Fh(`WGS84`),n=$h(e,i,n,r),e=i),r&&e.axis!==`enu`&&(n=qh(e,n)),e.projName===`longlat`)n={x:n.x*Zp,y:n.y*Zp,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=Hh(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+Q(n.x-t.long_wrap)),n={x:n.x*Qp,y:n.y*Qp,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`?Jh(t,n):(n&&!a&&t.projName!==`geocent`&&delete n.z,n)}function eg(e,t,n,r){return $h(e,t,Array.isArray(n)?Yh(n):{x:n.x,y:n.y,z:n.z,m:n.m},r)}var tg=Fh(`WGS84`);function ng(e,t,n,r){var i,a,o;return Array.isArray(n)?(i=$h(e,t,Yh(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=$h(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 rg(e){return e instanceof Fh?e:typeof e==`object`&&`oProj`in e?e.oProj:Fh(e)}function ig(e,t,n){var r,i,a=!1,o;return t===void 0?(i=rg(e),r=tg,a=!0):(t.x!==void 0||Array.isArray(t))&&(n=t,i=rg(e),r=tg,a=!0),r||=rg(e),i||=rg(t),n?ng(r,i,n):(o={forward:function(e,t){return ng(r,i,e,t)},inverse:function(e,t){return ng(i,r,e,t)}},a&&(o.oProj=i),o)}var ag=6,og=`AJSAJS`,sg=`AFAFAF`,cg=65,lg=73,ug=79,dg=86,fg=90,pg={forward:mg,inverse:hg,toPoint:gg};function mg(e,t){return t||=5,Sg(yg({lat:e[1],lon:e[0]}),t)}function hg(e){var t=bg(Eg(e.toUpperCase()));return t.lat&&t.lon?[t.lon,t.lat,t.lon,t.lat]:[t.left,t.bottom,t.right,t.top]}function gg(e){var t=bg(Eg(e.toUpperCase()));return t.lat&&t.lon?[t.lon,t.lat]:[(t.left+t.right)/2,(t.top+t.bottom)/2]}function _g(e){return Math.PI/180*e}function vg(e){return e/Math.PI*180}function yg(e){var t=e.lat,n=e.lon,r=6378137,i=.00669438,a=.9996,o,s,c,l,u,d,f,p=_g(t),m=_g(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=_g(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:xg(t)}}function bg(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=vg(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+vg(S);var C;if(e.accuracy){var w=bg({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 xg(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 Sg(e,t){var n=`00000`+e.easting,r=`00000`+e.northing;return e.zoneNumber+e.zoneLetter+Cg(e.easting,e.northing,e.zoneNumber)+n.substr(n.length-5,t)+r.substr(r.length-5,t)}function Cg(e,t,n){var r=wg(n);return Tg(Math.floor(e/1e5),Math.floor(t/1e5)%20,r)}function wg(e){var t=e%ag;return t===0&&(t=ag),t}function Tg(e,t,n){var r=n-1,i=og.charCodeAt(r),a=sg.charCodeAt(r),o=i+e-1,s=a+t,c=!1;return o>fg&&(o=o-fg+cg-1,c=!0),(o===lg||i<lg&&o>lg||(o>lg||i<lg)&&c)&&o++,(o===ug||i<ug&&o>ug||(o>ug||i<ug)&&c)&&(o++,o===lg&&o++),o>fg&&(o=o-fg+cg-1),s>dg?(s=s-dg+cg-1,c=!0):c=!1,(s===lg||a<lg&&s>lg||(s>lg||a<lg)&&c)&&s++,(s===ug||a<ug&&s>ug||(s>ug||a<ug)&&c)&&(s++,s===lg&&s++),s>dg&&(s=s-dg+cg-1),String.fromCharCode(o)+String.fromCharCode(s)}function Eg(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=wg(o),l=Dg(n.charAt(0),c),u=Og(n.charAt(1),c);u<kg(s);)u+=2e6;var d=t-a;if(d%2!=0)throw`MGRSPoint has to have an even number
8
+ of digits after the zone letter and two 100km letters - front
9
+ half for easting meters, second half for
10
+ 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 Dg(e,t){for(var n=og.charCodeAt(t-1),r=1e5,i=!1;n!==e.charCodeAt(0);){if(n++,n===lg&&n++,n===ug&&n++,n>fg){if(i)throw`Bad character: `+e;n=cg,i=!0}r+=1e5}return r}function Og(e,t){if(e>`V`)throw`MGRSPoint given invalid Northing `+e;for(var n=sg.charCodeAt(t-1),r=0,i=!1;n!==e.charCodeAt(0);){if(n++,n===lg&&n++,n===ug&&n++,n>dg){if(i)throw`Bad character: `+e;n=cg,i=!0}r+=1e5}return r}function kg(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 Ag(e,t,n){if(!(this instanceof Ag))return new Ag(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`)}Ag.fromMGRS=function(e){return new Ag(gg(e))},Ag.prototype.toMGRS=function(e){return mg([this.x,this.y],e)};var jg=1,Mg=.25,Ng=.046875,Pg=.01953125,Fg=.01068115234375,Ig=.75,Lg=.46875,Rg=.013020833333333334,zg=.007120768229166667,Bg=.3645833333333333,Vg=.005696614583333333,Hg=.3076171875;function Ug(e){var t=[];t[0]=jg-e*(Mg+e*(Ng+e*(Pg+e*Fg))),t[1]=e*(Ig-e*(Ng+e*(Pg+e*Fg)));var n=e*e;return t[2]=n*(Lg-e*(Rg+e*zg)),n*=e,t[3]=n*(Bg-e*Vg),t[4]=n*e*Hg,t}function Wg(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 Gg=20;function Kg(e,t,n){for(var r=1/(1-t),i=e,a=Gg;a;--a){var o=Math.sin(i),s=1-t*o*o;if(s=(Wg(i,o,Math.cos(i),n)-e)*(s*Math.sqrt(s))*r,i-=s,Math.abs(s)<1e-10)return i}return i}function qg(){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=Ug(this.es),this.ml0=Wg(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function Jg(e){var t=e.x,n=e.y,r=Q(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=Wg(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 Yg(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:Q(Math.atan2(c,u)+this.long0,this.over)}else if(t=this.ml0+o/this.k0,n=Kg(t,this.es,this.en),Math.abs(n)<X){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=Q(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=X*Jm(o),i=0;return e.x=i,e.y=r,e}var Xg={init:qg,forward:Jg,inverse:Yg,names:[`Fast_Transverse_Mercator`,`Fast Transverse Mercator`]};function Zg(e){var t=Math.exp(e);return t=(t-1/t)/2,t}function Qg(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 $g(e){var t=1+e,n=t-1;return n===0?e:e*Math.log(t)/n}function e_(e){var t=Math.abs(e);return t=$g(t*(1+t/(Qg(1,t)+1))),e<0?-t:t}function t_(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 n_(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 r_(e){var t=Math.exp(e);return t=(t+1/t)/2,t}function i_(e,t,n){for(var r=Math.sin(t),i=Math.cos(t),a=Zg(n),o=r_(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 a_(){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&&(Xg.init.apply(this),this.forward=Xg.forward,this.inverse=Xg.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=t_(this.cbg,this.lat0);this.Zb=-this.Qn*(r+n_(this.gtu,2*r))}function o_(e){var t=Q(e.x-this.long0,this.over),n=e.y;n=t_(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,Qg(r,i*o)),t=e_(Math.tan(t));var s=i_(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 s_(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=i_(this.utg,2*n,2*t);n+=a[0],t+=a[1],t=Math.atan(Zg(t));var o=Math.sin(n),s=Math.cos(n),c=Math.sin(t),l=Math.cos(t);n=Math.atan2(o*l,Qg(c,l*s)),t=Math.atan2(c,l*s),r=Q(t+this.long0,this.over),i=t_(this.cgb,n)}else r=1/0,i=1/0;return e.x=r,e.y=i,e}var c_={init:a_,forward:o_,inverse:s_,names:[`Extended_Transverse_Mercator`,`Extended Transverse Mercator`,`etmerc`,`Transverse_Mercator`,`Transverse Mercator`,`Gauss Kruger`,`Gauss_Kruger`,`tmerc`]};function l_(e,t){if(e===void 0){if(e=Math.floor((Q(t)+Math.PI)*30/Math.PI)+1,e<0)return 0;if(e>60)return 60}return e}var u_=`etmerc`;function d_(){var e=l_(this.zone,this.long0);if(e===void 0)throw Error(`unknown utm zone`);this.lat0=0,this.long0=(6*Math.abs(e)-183)*Zp,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,c_.init.apply(this),this.forward=c_.forward,this.inverse=c_.inverse}var f_={init:d_,names:[`Universal Transverse Mercator System`,`utm`],dependsOn:u_};function p_(e,t){return((1-e)/(1+e))**t}var m_=20;function h_(){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+Z)/(Math.tan(.5*this.lat0+Z)**+this.C*p_(this.e*e,this.ratexp))}function g_(e){var t=e.x,n=e.y;return e.y=2*Math.atan(this.K*Math.tan(.5*n+Z)**+this.C*p_(this.e*Math.sin(n),this.ratexp))-X,e.x=this.C*t,e}function __(e){for(var t=1e-14,n=e.x/this.C,r=e.y,i=(Math.tan(.5*r+Z)/this.K)**(1/this.C),a=m_;a>0&&(r=2*Math.atan(i*p_(this.e*Math.sin(e.y),-.5*this.e))-X,!(Math.abs(r-e.y)<t));--a)e.y=r;return a?(e.x=n,e.y=r,e):null}var v_={init:h_,forward:g_,inverse:__,names:[`gauss`]};function y_(){v_.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 b_(e){var t,n,r,i;return e.x=Q(e.x-this.long0,this.over),v_.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 x_(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=Qg(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,v_.inverse.apply(this,[e]),e.x=Q(e.x+this.long0,this.over),e}var S_={init:y_,forward:b_,inverse:x_,names:[`Stereographic_North_Pole`,`Oblique_Stereographic`,`sterea`,`Oblique Stereographic Alternative`,`Double_Stereographic`]};function C_(e,t,n){return t*=n,Math.tan(.5*(X+e))*((1-t)/(1+t))**(.5*n)}function w_(){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+Jm(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*qm(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/Ym(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=qm(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(C_(this.lat0,this.sinlat0,this.e))-X,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function T_(e){var t=e.x,n=e.y,r=Math.sin(n),i=Math.cos(n),a,o,s,c,l,u,d=Q(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(C_(n,r,this.e))-X,c=Math.cos(o),s=Math.sin(o),Math.abs(this.coslat0)<=1e-10?(l=Ym(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 E_(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?Q(this.long0+Math.atan2(e.x,-1*e.y),this.over):Q(this.long0+Math.atan2(e.x,e.y),this.over):Q(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*Xm(this.e,r),t=this.con*Q(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=Q(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*Xm(this.e,Math.tan(.5*(X+a)));return e.x=t,e.y=n,e}var D_={init:w_,forward:T_,inverse:E_,names:[`stere`,`Stereographic_South_Pole`,`Polar_Stereographic_variant_A`,`Polar_Stereographic_variant_B`,`Polar_Stereographic`],ssfn_:C_};function O_(){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 k_(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 A_(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 j_={init:O_,forward:k_,inverse:A_,names:[`somerc`]},M_=1e-7;function N_(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(ch(n))!==-1}function P_(){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=N_(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)<=M_||(e=Math.abs(h))<=M_||Math.abs(e-X)<=M_||Math.abs(Math.abs(this.lat0)-X)<=M_||Math.abs(Math.abs(g)-X)<=M_)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*=Ym(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=Ym(this.e,h,Math.sin(h))**+this.B,o=Ym(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-=$p:e>Math.PI&&(m+=$p),this.lam0=Q(.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*Q(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(Z-i)),this.v_pole_s=this.ArB*Math.log(Math.tan(Z+i))}function F_(e){var t={},n,r,i,a,o,s,c,l;if(e.x-=this.lam0,Math.abs(Math.abs(e.y)-X)>1e-10){if(o=this.E/Ym(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)<M_?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 I_(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?-X:X;else{if(c.y=this.E/Math.sqrt((1+s)/(1-s)),c.y=Xm(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 L_={init:P_,forward:F_,inverse:I_,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 R_(){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=qm(this.e,t,n),i=Ym(this.e,this.lat1,t),a=Math.sin(this.lat2),o=Math.cos(this.lat2),s=qm(this.e,a,o),c=Ym(this.e,this.lat2,a),l=Ym(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)-X)<1e-10?0:this.a*this.f0*l**+this.ns,this.title||=`Lambert Conformal Conic`}}function z_(e){var t=e.x,n=e.y;Math.abs(2*Math.abs(n)-Math.PI)<=1e-10&&(n=Jm(n)*(X-2*Xp));var r=Math.abs(Math.abs(n)-X),i,a;if(r>1e-10)i=Ym(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*Q(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 B_(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=Xm(this.e,r),i===-9999)return null}else i=-X;return a=Q(c/this.ns+this.long0,this.over),e.x=a,e.y=i,e}var V_={init:R_,forward:z_,inverse:B_,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 H_(){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 U_(e){var t,n,r,i,a,o,s,c=e.x,l=e.y,u=Q(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 W_(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 G_={init:H_,forward:U_,inverse:W_,names:[`Krovak`,`Krovak Modified`,`Krovak (North Orientated)`,`Krovak Modified (North Orientated)`,`krovak`]};function K_(e,t,n,r,i){return e*i-t*Math.sin(2*i)+n*Math.sin(4*i)-r*Math.sin(6*i)}function q_(e){return 1-.25*e*(1+e/16*(3+1.25*e))}function J_(e){return .375*e*(1+.25*e*(1+.46875*e))}function Y_(e){return .05859375*e*e*(1+.75*e)}function X_(e){return e*e*e*(35/3072)}function Z_(e,t,n){var r=t*n;return e/Math.sqrt(1-r*r)}function Q_(e){return Math.abs(e)<X?e:e-Jm(e)*Math.PI}function $_(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 ev(){this.sphere||(this.e0=q_(this.es),this.e1=J_(this.es),this.e2=Y_(this.es),this.e3=X_(this.es),this.ml0=this.a*K_(this.e0,this.e1,this.e2,this.e3,this.lat0))}function tv(e){var t,n,r=e.x,i=e.y;if(r=Q(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=Z_(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*K_(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 nv(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=$_(this.ml0/this.a+n,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(o)-X)<=1e-10)return e.x=this.long0,e.y=X,n<0&&(e.y*=-1),e;var s=Z_(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=Q(i+this.long0,this.over),e.y=Q_(r),e}var rv={init:ev,forward:tv,inverse:nv,names:[`Cassini`,`Cassini_Soldner`,`cass`]};function iv(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 av=.3333333333333333,ov=.17222222222222222,sv=.10257936507936508,cv=.06388888888888888,lv=.0664021164021164,uv=.016415012942191543;function dv(e){var t,n=[];return n[0]=e*av,t=e*e,n[0]+=t*ov,n[1]=t*cv,t*=e,n[0]+=t*sv,n[1]+=t*lv,n[2]=t*uv,n}function fv(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 pv(){var e=Math.abs(this.lat0);if(this.mode=Math.abs(e-X)<1e-10?this.lat0<0?1:2:Math.abs(e)<1e-10?3:4,this.es>0){var t;switch(this.qp=iv(this.e,1),this.mmf=.5/(1-this.es),this.apa=dv(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=iv(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 mv(e){var t,n,r,i,a,o,s,c,l,u,d=e.x,f=e.y;if(d=Q(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=Z-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=iv(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=X+f,o=this.qp-o;break;case this.S_POLE:l=f-X,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 hv(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=X-i;break;case this.S_POLE:i-=X}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=fv(Math.asin(l),this.apa)}return e.x=Q(this.long0+r,this.over),e.y=i,e}var gv={init:pv,forward:mv,inverse:hv,names:[`Lambert Azimuthal Equal Area`,`Lambert_Azimuthal_Equal_Area`,`laea`],S_POLE:1,N_POLE:2,EQUIT:3,OBLIQ:4};function _v(e){return Math.abs(e)>1&&(e=e>1?1:-1),Math.asin(e)}function vv(){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=qm(this.e3,this.sin_po,this.cos_po),this.qs1=iv(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=qm(this.e3,this.sin_po,this.cos_po),this.qs2=iv(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=iv(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 yv(e){var t=e.x,n=e.y;this.sin_phi=Math.sin(n),this.cos_phi=Math.cos(n);var r=iv(this.e3,this.sin_phi),i=this.a*Math.sqrt(this.c-this.ns0*r)/this.ns0,a=this.ns0*Q(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 bv(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=Q(i/this.ns0+this.long0,this.over),e.x=a,e.y=o,e}function xv(e,t){var n,r,i,a,o,s=_v(.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 Sv={init:vv,forward:yv,inverse:bv,names:[`Albers_Conic_Equal_Area`,`Albers_Equal_Area`,`Albers`,`aea`],phi1z:xv};function Cv(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1}function wv(e){var t,n,r,i,a,o,s,c,l=e.x,u=e.y;return r=Q(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 Tv(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=_v(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=Q(this.long0+a,this.over)):(o=this.phic0,a=0),e.x=a,e.y=o,e}var Ev={init:Cv,forward:wv,inverse:Tv,names:[`gnom`]};function Dv(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*X:X;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 Ov(){this.sphere||(this.k0=qm(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function kv(e){var t=e.x,n=e.y,r,i,a=Q(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=iv(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 Av(e){e.x-=this.x0,e.y-=this.y0;var t,n;return this.sphere?(t=Q(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=Dv(this.e,2*e.y*this.k0/this.a),t=Q(this.long0+e.x/(this.a*this.k0),this.over)),e.x=t,e.y=n,e}var jv={init:Ov,forward:kv,inverse:Av,names:[`cea`]};function Mv(){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 Nv(e){var t=e.x,n=e.y,r=Q(t-this.long0,this.over),i=Q_(n-this.lat0);return e.x=this.x0+this.a*r*this.rc,e.y=this.y0+this.a*i,e}function Pv(e){var t=e.x,n=e.y;return e.x=Q(this.long0+(t-this.x0)/(this.a*this.rc),this.over),e.y=Q_(this.lat0+(n-this.y0)/this.a),e}var Fv={init:Mv,forward:Nv,inverse:Pv,names:[`Equirectangular`,`Equidistant_Cylindrical`,`Equidistant_Cylindrical_Spherical`,`eqc`]},Iv=20;function Lv(){this.temp=this.b/this.a,this.es=1-this.temp**2,this.e=Math.sqrt(this.es),this.e0=q_(this.es),this.e1=J_(this.es),this.e2=Y_(this.es),this.e3=X_(this.es),this.ml0=this.a*K_(this.e0,this.e1,this.e2,this.e3,this.lat0)}function Rv(e){var t=e.x,n=e.y,r,i,a,o=Q(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*(Q_(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=Z_(this.a,this.e,Math.sin(n))/Math.tan(n);r=s*Math.sin(a),i=this.a*K_(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 zv(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=Q(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=Iv;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=Q(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=Q(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=Iv;a;--a)if(h=this.e*Math.sin(c),d=Math.sqrt(1-h*h)*Math.tan(c),f=this.a*K_(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=Q(this.long0+Math.asin(r*d/this.a)/Math.sin(n),this.over)}return e.x=t,e.y=n,e}var Bv={init:Lv,forward:Rv,inverse:zv,names:[`Polyconic`,`American_Polyconic`,`poly`]};function Vv(){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 Hv(e){var t,n=e.x,r=e.y-this.lat0,i=n-this.long0,a=r/Kp*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 Uv(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*Kp*1e5;return e.x=this.long0+w,e.y=D,e}var Wv={init:Vv,forward:Hv,inverse:Uv,names:[`New_Zealand_Map_Grid`,`nzmg`],iterations:1};function Gv(){}function Kv(e){var t=e.x,n=e.y,r=Q(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 qv(e){e.x-=this.x0,e.y-=this.y0;var t=Q(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 Jv={init:Gv,forward:Kv,inverse:qv,names:[`Miller_Cylindrical`,`mill`]},Yv=20;function Xv(){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=Ug(this.es)}function Zv(e){var t,n,r=e.x,i=e.y;if(r=Q(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=Yv;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*Wg(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 Qv(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=_v((this.m*t+Math.sin(t))/this.n):this.n!==1&&(t=_v(Math.sin(t)/this.n)),r=Q(r+this.long0,this.over),t=Q_(t)):(t=Kg(e.y/this.a,this.es,this.en),i=Math.abs(t),i<X?(i=Math.sin(t),n=this.long0+e.x*Math.sqrt(1-this.es*i*i)/(this.a*Math.cos(t)),r=Q(n,this.over)):i-1e-10<X&&(r=this.long0)),e.x=r,e.y=t,e}var $v={init:Xv,forward:Zv,inverse:Qv,names:[`Sinusoidal`,`sinu`]};function ey(){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 ty={init:ey,forward:Zv,inverse:Qv,names:[`Eckert_VI`,`eck6`]};function ny(){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 ry(e){for(var t=e.x,n=e.y,r=Q(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 iy(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=Q(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 ay={init:ny,forward:ry,inverse:iy,names:[`Mollweide`,`moll`]};function oy(){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=q_(this.es),this.e1=J_(this.es),this.e2=Y_(this.es),this.e3=X_(this.es),this.sin_phi=Math.sin(this.lat1),this.cos_phi=Math.cos(this.lat1),this.ms1=qm(this.e,this.sin_phi,this.cos_phi),this.ml1=K_(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=qm(this.e,this.sin_phi,this.cos_phi),this.ml2=K_(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=K_(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))}function sy(e){var t=e.x,n=e.y,r;if(this.sphere)r=this.a*(this.g-n);else{var i=K_(this.e0,this.e1,this.e2,this.e3,n);r=this.a*(this.g-i)}var a=this.ns*Q(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 cy(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=Q(this.long0+a/this.ns,this.over),r=Q_(this.g-n/this.a),e.x=i,e.y=r,e):(r=$_(this.g-n/this.a,this.e0,this.e1,this.e2,this.e3),i=Q(this.long0+a/this.ns,this.over),e.x=i,e.y=r,e)}var ly={init:oy,forward:sy,inverse:cy,names:[`Equidistant_Conic`,`eqdc`]};function uy(){this.R=this.a}function dy(e){var t=e.x,n=e.y,r=Q(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=_v(2*Math.abs(n/Math.PI));if(Math.abs(r)<=1e-10||Math.abs(Math.abs(n)-X)<=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 fy(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:Q(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 py={init:uy,forward:dy,inverse:fy,names:[`Van_der_Grinten_I`,`VanDerGrinten`,`Van_der_Grinten`,`vandg`]};function my(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 hy(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 gy(){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 _y(e){var t=e.x,n=e.y,r=Math.sin(e.y),i=Math.cos(e.y),a=Q(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*(X-n)*Math.sin(a),e.y=this.y0-this.a*(X-n)*Math.cos(a),e):Math.abs(this.sin_p12+1)<=1e-10?(e.x=this.x0+this.a*(X+n)*Math.sin(a),e.y=this.y0+this.a*(X+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=q_(this.es),s=J_(this.es),c=Y_(this.es),l=X_(this.es),Math.abs(this.sin_p12-1)<=1e-10?(u=this.a*K_(o,s,c,l,X),d=this.a*K_(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*K_(o,s,c,l,X),d=this.a*K_(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=my(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 vy(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*X*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=_v(i*this.sin_p12+e.y*r*this.cos_p12/t),s=Math.abs(this.lat0)-X,a=Math.abs(s)<=1e-10?this.lat0>=0?Q(this.long0+Math.atan2(e.x,-e.y),this.over):Q(this.long0-Math.atan2(-e.x,e.y),this.over):Q(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=q_(this.es),l=J_(this.es),u=Y_(this.es),d=X_(this.es),Math.abs(this.sin_p12-1)<=1e-10?(f=this.a*K_(c,l,u,d,X),t=Math.sqrt(e.x*e.x+e.y*e.y),p=f-t,o=$_(p/this.a,c,l,u,d),a=Q(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*K_(c,l,u,d,X),t=Math.sqrt(e.x*e.x+e.y*e.y),p=t-f,o=$_(p/this.a,c,l,u,d),a=Q(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=hy(this.lat0,this.long0,m,h,this.a,this.f),e.x=g.lon2,e.y=g.lat2,e))}var yy={init:gy,forward:_y,inverse:vy,names:[`Azimuthal_Equidistant`,`aeqd`]};function by(){this.sin_p14=Math.sin(this.lat0||0),this.cos_p14=Math.cos(this.lat0||0)}function xy(e){var t,n,r,i,a,o,s,c,l=e.x,u=e.y;return r=Q(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 Sy(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=_v(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=_v(i*this.sin_p14+e.y*r*this.cos_p14/t),a=Math.abs(l)-X,Math.abs(a)<=1e-10?(o=Q(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=Q(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 Cy={init:by,forward:xy,inverse:Sy,names:[`ortho`]},wy={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},$={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function Ty(){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>=X-Z/2?wy.TOP:this.lat0<=-(X-Z/2)?wy.BOTTOM:Math.abs(this.long0)<=Z?wy.FRONT:Math.abs(this.long0)<=X+Z?this.long0>0?wy.RIGHT:wy.LEFT:wy.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 Ey(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===wy.TOP)a=X-n,r>=Z&&r<=X+Z?(c.value=$.AREA_0,i=r-X):r>X+Z||r<=-(X+Z)?(c.value=$.AREA_1,i=r>0?r-em:r+em):r>-(X+Z)&&r<=-Z?(c.value=$.AREA_2,i=r+X):(c.value=$.AREA_3,i=r);else if(this.face===wy.BOTTOM)a=X+n,r>=Z&&r<=X+Z?(c.value=$.AREA_0,i=-r+X):r<Z&&r>=-Z?(c.value=$.AREA_1,i=-r):r<-Z&&r>=-(X+Z)?(c.value=$.AREA_2,i=-r-X):(c.value=$.AREA_3,i=r>0?-r+em:-r-em);else{var l,u,d,f,p,m,h;this.face===wy.RIGHT?r=ky(r,+X):this.face===wy.BACK?r=ky(r,+em):this.face===wy.LEFT&&(r=ky(r,-X)),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===wy.FRONT?(a=Math.acos(l),i=Oy(a,d,u,c)):this.face===wy.RIGHT?(a=Math.acos(u),i=Oy(a,d,-l,c)):this.face===wy.BACK?(a=Math.acos(-l),i=Oy(a,d,-u,c)):this.face===wy.LEFT?(a=Math.acos(-u),i=Oy(a,d,l,c)):(a=i=0,c.value=$.AREA_0)}return s=Math.atan(12/em*(i+Math.acos(Math.sin(i)*Math.cos(Z))-X)),o=Math.sqrt((1-Math.cos(a))/(Math.cos(s)*Math.cos(s))/(1-Math.cos(Math.atan(1/Math.cos(i))))),c.value===$.AREA_1?s+=X:c.value===$.AREA_2?s+=em:c.value===$.AREA_3&&(s+=1.5*em),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 Dy(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=$.AREA_0:e.y>=0&&e.y>=Math.abs(e.x)?(d.value=$.AREA_1,n-=X):e.x<0&&-e.x>=Math.abs(e.y)?(d.value=$.AREA_2,n=n<0?n+em:n-em):(d.value=$.AREA_3,n+=X),u=em/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===wy.TOP)l=Math.acos(c),t.phi=X-l,t.lam=d.value===$.AREA_0?s+X:d.value===$.AREA_1?s<0?s+em:s-em:d.value===$.AREA_2?s-X:s;else if(this.face===wy.BOTTOM)l=Math.acos(c),t.phi=l-X,t.lam=d.value===$.AREA_0?-s+X:d.value===$.AREA_1?-s:d.value===$.AREA_2?-s-X:s<0?-s-em:-s+em;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===$.AREA_1?(u=p,p=-m,m=u):d.value===$.AREA_2?(p=-p,m=-m):d.value===$.AREA_3&&(u=p,p=m,m=-u),this.face===wy.RIGHT?(u=f,f=-p,p=u):this.face===wy.BACK?(f=-f,p=-p):this.face===wy.LEFT&&(u=f,f=p,p=-u),t.phi=Math.acos(-m)-X,t.lam=Math.atan2(p,f),this.face===wy.RIGHT?t.lam=ky(t.lam,-X):this.face===wy.BACK?t.lam=ky(t.lam,-em):this.face===wy.LEFT&&(t.lam=ky(t.lam,+X))}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 Oy(e,t,n,r){var i;return e<1e-10?(r.value=$.AREA_0,i=0):(i=Math.atan2(t,n),Math.abs(i)<=Z?r.value=$.AREA_0:i>Z&&i<=X+Z?(r.value=$.AREA_1,i-=X):i>X+Z||i<=-(X+Z)?(r.value=$.AREA_2,i=i>=0?i-em:i+em):(r.value=$.AREA_3,i+=X)),i}function ky(e,t){var n=e+t;return n<-3.14159265359?n+=$p:n>3.14159265359&&(n-=$p),n}var Ay={init:Ty,forward:Ey,inverse:Dy,names:[`Quadrilateralized Spherical Cube`,`Quadrilateralized_Spherical_Cube`,`qsc`]},jy=[[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]],My=[[-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]],Ny=.8487,Py=1.3523,Fy=Qp/5,Iy=1/Fy,Ly=18,Ry=function(e,t){return e[0]+t*(e[1]+t*(e[2]+t*e[3]))},zy=function(e,t){return e[1]+t*(2*e[2]+t*3*e[3])};function By(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 Vy(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||`Robinson`}function Hy(e){var t=Q(e.x-this.long0,this.over),n=Math.abs(e.y),r=Math.floor(n*Fy);r<0?r=0:r>=Ly&&(r=Ly-1),n=Qp*(n-Iy*r);var i={x:Ry(jy[r],n)*t,y:Ry(My[r],n)};return e.y<0&&(i.y=-i.y),i.x=i.x*this.a*Ny+this.x0,i.y=i.y*this.a*Py+this.y0,e.z!==void 0&&(i.z=e.z),e.m!==void 0&&(i.m=e.m),i}function Uy(e){var t={x:(e.x-this.x0)/(this.a*Ny),y:Math.abs(e.y-this.y0)/(this.a*Py)};if(t.y>=1)t.x/=jy[Ly][0],t.y=e.y<0?-X:X;else{var n=Math.floor(t.y*Ly);for(n<0?n=0:n>=Ly&&(n=Ly-1);;)if(My[n][0]>t.y)--n;else if(My[n+1][0]<=t.y)++n;else break;var r=My[n],i=5*(t.y-r[0])/(My[n+1][0]-r[0]);i=By(function(e){return(Ry(r,e)-t.y)/zy(r,e)},i,Xp,100),t.x/=Ry(jy[n],i),t.y=(5*n+i)*Zp,e.y<0&&(t.y=-t.y)}return t.x=Q(t.x+this.long0,this.over),e.z!==void 0&&(t.z=e.z),e.m!==void 0&&(t.m=e.m),t}var Wy={init:Vy,forward:Hy,inverse:Uy,names:[`Robinson`,`robin`]};function Gy(){this.name=`geocent`}function Ky(e){return Lh(e,this.es,this.a)}function qy(e){return Rh(e,this.es,this.a,this.b)}var Jy={init:Gy,forward:Ky,inverse:qy,names:[`Geocentric`,`geocentric`,`geocent`,`Geocent`]},Yy={N_POLE:0,S_POLE:1,EQUIT:2,OBLIQ:3},Xy={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 Zy(){if(Object.keys(Xy).forEach(function(e){if(this[e]===void 0)this[e]=Xy[e].def;else if(Xy[e].num&&isNaN(this[e]))throw Error(`Invalid parameter value, must be numeric `+e+` = `+this[e]);else Xy[e].num&&(this[e]=parseFloat(this[e]));Xy[e].degrees&&(this[e]=this[e]*Zp)}.bind(this)),Math.abs(Math.abs(this.lat0)-X)<1e-10?this.mode=this.lat0<0?Yy.S_POLE:Yy.N_POLE:Math.abs(this.lat0)<1e-10?this.mode=Yy.EQUIT:(this.mode=Yy.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 Qy(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 Yy.OBLIQ:a=this.sinph0*t+this.cosph0*n*r;break;case Yy.EQUIT:a=n*r;break;case Yy.S_POLE:a=-t;break;case Yy.N_POLE:a=t}switch(a=this.pn1/(this.p-a),i=a*n*Math.sin(e.x),this.mode){case Yy.OBLIQ:a*=this.cosph0*t-this.sinph0*n*r;break;case Yy.EQUIT:a*=t;break;case Yy.N_POLE:a*=-(n*r);break;case Yy.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 $y(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=Qg(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 Yy.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 Yy.EQUIT:t.y=Math.asin(e.y*s/a),e.y=o*a,e.x*=s;break;case Yy.N_POLE:t.y=Math.asin(o),e.y=-e.y;break;case Yy.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 eb={init:Zy,forward:Qy,inverse:$y,names:[`Tilted_Perspective`,`tpers`]};function tb(){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 nb(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/Qg(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/Qg(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/Qg(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/Qg(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/Qg(a,r))));return e.x*=this.a,e.y*=this.a,e}function rb(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)*Qg(1,r)):(n=Math.tan(e.x/this.radius_g_1),r=Math.tan(e.y/this.radius_g_1)*Qg(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 ib={init:tb,forward:nb,inverse:rb,names:[`Geostationary Satellite View`,`Geostationary_Satellite`,`geos`]},ab=1.340264,ob=-.081106,sb=893e-6,cb=.003796,lb=Math.sqrt(3)/2;function ub(){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=dv(this.es),this.qp=iv(this.e,1),this.rqda=Math.sqrt(.5*this.qp))}function db(e){var t=Q(e.x-this.long0,this.over),n=e.y,r=Math.sin(n);this.es!==0&&(r=iv(this.e,r)/this.qp);var i=Math.asin(lb*r),a=i*i,o=a*a*a;return e.x=t*Math.cos(i)/(lb*(ab+3*ob*a+o*(7*sb+9*cb*a))),e.y=i*(ab+ob*a+o*(sb+cb*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 fb(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*(ab+ob*i+a*(sb+cb*i))-e.y,s=ab+3*ob*i+a*(7*sb+9*cb*i),r-=c=o/s,!(Math.abs(c)<t));++l);return i=r*r,a=i*i*i,e.x=lb*e.x*(ab+3*ob*i+a*(7*sb+9*cb*i))/Math.cos(r),e.y=Math.asin(Math.sin(r)/lb),this.es!==0&&(e.y=fv(e.y,this.apa)),e.x=Q(e.x+this.long0,this.over),e}var pb={init:ub,forward:db,inverse:fb,names:[`eqearth`,`Equal Earth`,`Equal_Earth`]},mb=1e-10;function hb(){var e;if(this.phi1=this.lat1,Math.abs(this.phi1)<mb)throw Error();this.es?(this.en=Ug(this.es),this.m1=Wg(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=_b,this.forward=gb):(this.cphi1=Math.abs(this.phi1)+mb>=X?0:1/Math.tan(this.phi1),this.inverse=yb,this.forward=vb)}function gb(e){var t=Q(e.x-(this.long0||0),this.over),n=e.y,r=this.am1+this.m1-Wg(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 _b(e){e.x=(e.x-(this.x0||0))/this.a,e.y=(e.y-(this.y0||0))/this.a;var t,n=Qg(e.x,e.y=this.am1-e.y),r,i=Kg(this.am1+this.m1-n,this.es,this.en);if((t=Math.abs(i))<X)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-X)<=mb)r=0;else throw Error();return e.x=Q(r+(this.long0||0),this.over),e.y=Q_(i),e}function vb(e){var t=Q(e.x-(this.long0||0),this.over),n=e.y,r,i=this.cphi1+this.phi1-n;return Math.abs(i)>mb?(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 yb(e){e.x=(e.x-(this.x0||0))/this.a,e.y=(e.y-(this.y0||0))/this.a;var t,n,r=Qg(e.x,e.y=this.cphi1-e.y);if(n=this.cphi1+this.phi1-r,Math.abs(n)>X)throw Error();return t=Math.abs(Math.abs(n)-X)<=mb?0:r*Math.atan2(e.x,e.y)/Math.cos(n),e.x=Q(t+(this.long0||0),this.over),e.y=Q_(n),e}var bb={init:hb,names:[`bonne`,`Bonne (Werner lat_1=90)`]},xb={OBLIQUE:{forward:Db,inverse:kb},TRANSVERSE:{forward:Ob,inverse:Ab}},Sb={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 Cb(){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=rh.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=Fh(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(Sb),r=e=>{if(this[e]===void 0)return;let t=parseFloat(this[e])*Zp;if(isNaN(t))throw Error(`Invalid value for `+e+`: `+this[e]);return t};for(let e=0;e<n.length;e++){let i=Sb[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}=Eb(this,t);this.lamp=i,Math.abs(a)>1e-10?(this.cphip=Math.cos(a),this.sphip=Math.sin(a),this.projectionType=xb.OBLIQUE):this.projectionType=xb.TRANSVERSE}function wb(e){return this.projectionType.forward(this,e)}function Tb(e){return this.projectionType.inverse(this,e)}function Eb(e,t){let n,r;if(t===Sb.ROTATE){let t=e.oLongC,i=e.oLatC,a=e.oAlpha;if(Math.abs(Math.abs(i)-X)<=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===Sb.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)>X-1e-10)throw Error(`Invalid value for o_lat_1: `+e.o_lat_1+` should be < 90°`);if(Math.abs(o)>X-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 Db(e,t){let{x:n,y:r}=t;n=Q(n-e.long0,e.over);let i=Math.cos(n),a=Math.sin(r),o=Math.cos(r);t.x=Q(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*=Qp,s.y*=Qp),s}function Ob(e,t){let{x:n,y:r}=t;n=Q(n-e.long0,e.over);let i=Math.cos(r),a=Math.cos(n);t.x=Q(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*=Qp,o.y*=Qp),o}function kb(e,t){e.isIdentity&&(t.x*=Zp,t.y*=Zp);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=Q(t.x+e.long0),t}function Ab(e,t){e.isIdentity&&(t.x*=Zp,t.y*=Zp);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=Q(t.x+e.long0),t}var jb={init:Cb,forward:wb,inverse:Tb,names:[`General Oblique Transformation`,`General_Oblique_Transformation`,`ob_tran`]};function Mb(e){e.Proj.projections.add(Xg),e.Proj.projections.add(c_),e.Proj.projections.add(f_),e.Proj.projections.add(S_),e.Proj.projections.add(D_),e.Proj.projections.add(j_),e.Proj.projections.add(L_),e.Proj.projections.add(V_),e.Proj.projections.add(G_),e.Proj.projections.add(rv),e.Proj.projections.add(gv),e.Proj.projections.add(Sv),e.Proj.projections.add(Ev),e.Proj.projections.add(jv),e.Proj.projections.add(Fv),e.Proj.projections.add(Bv),e.Proj.projections.add(Wv),e.Proj.projections.add(Jv),e.Proj.projections.add($v),e.Proj.projections.add(ty),e.Proj.projections.add(ay),e.Proj.projections.add(ly),e.Proj.projections.add(py),e.Proj.projections.add(yy),e.Proj.projections.add(Cy),e.Proj.projections.add(Ay),e.Proj.projections.add(Wy),e.Proj.projections.add(Jy),e.Proj.projections.add(eb),e.Proj.projections.add(ib),e.Proj.projections.add(pb),e.Proj.projections.add(bb),e.Proj.projections.add(jb)}var Nb=Object.assign(ig,{defaultDatum:`WGS84`,Proj:Fh,WGS84:new Fh(`WGS84`),Point:Ag,toPoint:Yh,defs:Lm,nadgrid:xh,transform:eg,mgrs:pg,version:`__VERSION__`});Mb(Nb);var Pb={id:`sidebar`},Fb={class:`sidebar-header`},Ib={class:`sidebar-body`},Lb={class:`block`},Rb={key:0,class:`hint`,id:`map-info-empty`},zb={id:`map-info`},Bb={class:`map-detail`},Vb={id:`info-name`},Hb={class:`map-detail`},Ub={id:`info-kind`},Wb={class:`map-detail`},Gb={id:`info-data-crs`},Kb={class:`map-detail`},qb={id:`info-extent`},Jb={class:`block`,id:`view-crs-block`},Yb={class:`row`},Xb=[`label`],Zb=[`value`],Qb={key:0,label:`自定义`},$b=[`value`],ex={class:`extent-grid`},tx=[`value`],nx=[`value`],rx=[`value`],ix=[`value`],ax={class:`extent-grid`},ox=[`value`],sx=[`value`],cx=[`value`],lx=[`value`],ux={class:`block`,id:`layer-list-block`},dx={class:`layer-list-title`},fx={key:0,class:`layer-summary`},px={id:`layer-list`},mx={class:`layer-info`},hx=[`title`],gx={class:`layer-meta`},_x={class:`layer-controls`},vx=[`onClick`],yx=[`onClick`],bx=[`title`,`onClick`],xx={class:`layer-info`},Sx=[`title`],Cx={class:`layer-meta`},wx={class:`layer-controls`},Tx=[`onClick`],Ex=[`onClick`],Dx=[`title`,`onClick`],Ox=[`title`,`onClick`],kx={class:`layer-info`},Ax=[`title`],jx={class:`layer-meta`},Mx={class:`layer-controls`},Nx=[`onClick`],Px=[`onClick`],Fx=[`title`,`onClick`],Ix={class:`map-loading-mask`},Lx={class:`dialog`},Rx={class:`dialog-header`},zx={class:`block`},Bx={class:`file-btn`},Vx={class:`file-name`,id:`img-file-name`},Hx={class:`file-btn secondary`},Ux={class:`file-name`,id:`world-file-name`},Wx={class:`extent-grid`},Gx={class:`hint`,id:`zone-hint`},Kx={key:0},qx=[`onClick`],Jx={class:`file-btn`},Yx={class:`file-name`,id:`tiles-dir-name`},Xx={class:`check`},Zx={class:`hint`,id:`tiles-info`},Qx={class:`file-btn`},$x={class:`file-name`,id:`geojson-dir-name`},eS={class:`hint`,id:`geojson-crs-hint`},tS={key:0},nS=[`onClick`],rS={class:`hint`,id:`geojson-info`},iS={class:`zoom-range`},aS=[`label`],oS=[`value`],sS={key:0,label:`自定义`},cS=[`value`],lS={class:`extent-grid`},uS={class:`hint`,id:`url-info`},dS={class:`block`},fS=[`label`],pS=[`value`],mS={key:0,label:`自定义`},hS=[`value`],gS={class:`custom-crs`},_S={class:`row`},vS={id:`statusbar`},yS={id:`status-info`,class:`status-seg`},bS={id:`drop-overlay`},xS=[`data-type`],SS=(0,t.defineComponent)({name:`MapViewVue3`,__name:`map_view_vue3`,props:{theme:{type:String,default:`light`},dataCrs:{type:String,default:`EPSG:3857`},zoom:{type:Number,default:4.2},hidePanels:{type:Boolean,default:!1},width:{type:[String,Number],default:null},height:{type:[String,Number],default:null},mapBackground:{type:String,default:null},autoLoad:{type:Object,default:null}},emits:[`active-map-changed`,`layer-removed`,`map-removed`,`notify`,`theme-changed`,`view-changed`],setup(e,{expose:n,emit:r}){Zf(Nb);let i=e,a=r,o=(0,t.ref)(!1),s=(0,t.ref)(342),c=(0,t.ref)(0),l=(0,t.ref)(!1),u=(0,t.ref)(!1),d=(0,t.ref)(`raster`),f=(0,t.ref)(`image`),p=(0,t.ref)(!1),m=(0,t.ref)(!1),h=(0,t.ref)(!1),g=(0,t.ref)(!1),_=(0,t.ref)(`☀️`),v=(0,t.ref)(`切换到深色主题`),y=(0,t.ref)(``),b=(0,t.ref)(``),x=(0,t.ref)(`info`),S=(0,t.ref)(!1),C=(0,t.ref)({active:!1,name:``,kind:``,dataCrs:``,extent:`未知`}),w=(0,t.ref)([]),T=(0,t.ref)(!1),E=(0,t.ref)(``),D=(0,t.ref)(0),O=(0,t.ref)(0),k=(0,t.ref)([]),A=(0,t.ref)({dataCrs:[],viewCrs:[],urlExtentCrs:[]}),ee=(0,t.ref)([]),te=(0,t.ref)({minx:``,miny:``,maxx:``,maxy:``}),ne=(0,t.ref)({minx:``,miny:``,maxx:``,maxy:``}),j=(0,t.ref)({dataCrs:i.dataCrs,viewCrs:`EPSG:3857`,urlExtentCrs:i.dataCrs,imgFileName:`未选择文件`,worldFileName:`未选择文件`,zoneHint:{message:``,options:[]},tilesDirName:`未选择目录`,tilesInfo:`支持 QGIS / GDAL 等导出的 z/x/y.png 目录结构。`,tilesTms:!1,geojsonDirName:`未选择目录`,geojsonInfo:`支持按文件名配对的 .geojson 与 .sld。`,geojsonCrsHint:`未选择 GeoJSON。`,geojsonCrsOptions:[],urlTemplate:``,urlInfo:``,urlMinzoom:``,urlMaxzoom:``,customEpsg:``}),re=null,ie=null,M=null,ae=null,oe=null,se=null,ce=null,N=null,le=null,ue=null,de=null,P=null,fe=null,pe=null,F=null,he=null,ge=null,_e=null,ve=null,ye=null,xe=(0,t.ref)(null),Se=(0,t.ref)(null),Ce=(0,t.ref)(null);(0,t.ref)(null);let we=(0,t.ref)(null),Te=(0,t.ref)(null),Ee=(0,t.ref)(null),De=(0,t.ref)(null),Oe=(0,t.ref)(null),ke=(0,t.ref)(null),Ae=(0,t.ref)(null),je=(0,t.ref)(null),I=(0,t.ref)(null),Me=(0,t.ref)(null);(0,t.ref)(null);let Ne=(0,t.ref)(null),Pe=(0,t.ref)(null),Fe=(0,t.ref)(null),L=(0,t.ref)(null),Ie=(0,t.ref)(null),Le=(0,t.ref)(null);(0,t.ref)(null);let Re=(0,t.ref)(null),ze=(0,t.ref)(null),Be=(0,t.ref)(null),Ve=(0,t.ref)(null),He=(0,t.ref)(null),Ue=(0,t.ref)(null),R=(0,t.computed)(()=>{let e=e=>e==null||e===``?null:typeof e==`number`?e+`px`:String(e),t={},n=e(i.width),r=e(i.height);return n&&(t.width=n),r&&(t.height=r),t[`--sidebar-width`]=s.value+`px`,i.mapBackground&&(t[`--map-bg`]=i.mapBackground),t}),We=(0,t.computed)(()=>c.value>0||l.value);function Ge(){if(o.value)return;P=null,ye=new AbortController,ae=new mt({code:`PIXEL`,units:`pixels`}),yn(ae),re=[],it(`常用`,[{code:`EPSG:3857`,name:`EPSG:3857 · WGS84 伪墨卡托(网络地图)`},{code:`EPSG:4326`,name:`EPSG:4326 · WGS84 经纬度`},{code:`EPSG:4490`,name:`EPSG:4490 · CGCS2000 经纬度(2000国家大地坐标系)`,def:`+proj=longlat +ellps=GRS80 +no_defs`},{code:`PIXEL`,name:`像素坐标(未配准图片)`,pixel:!0}]);let e=[],t=[],n=[],r=[];for(let t=25;t<=45;t++){let n=t*3;e.push({code:`EPSG:${4513+t-25}`,name:`EPSG:${4513+t-25} · CGCS2000 3度带 ${t}(CM ${n}°E)`,def:rt(n,5e5+t*1e6),geoBox:[n-1.5,16,n+1.5,56]})}for(let e=13;e<=23;e++){let t=e*6-3;n.push({code:`EPSG:${4491+e-13}`,name:`EPSG:${4491+e-13} · CGCS2000 6度带 ${e}(CM ${t}°E)`,def:rt(t,5e5+e*1e6),geoBox:[t-3,16,t+3,56]})}it(`CGCS2000 3度带(含带号)`,e),it(`CGCS2000 3度带(中央经线)`,t),it(`CGCS2000 6度带(含带号)`,n),it(`CGCS2000 6度带(中央经线)`,r);let s=[],c=[];for(let e=1;e<=60;e++){let t=6*e-183;s.push({code:`EPSG:${32600+e}`,name:`EPSG:${32600+e} · WGS84 / UTM ${e}N(CM ${t}°E)`,def:`+proj=utm +zone=${e} +north +ellps=WGS84 +datum=WGS84 +units=m +no_defs`,geoBox:[t-3,-80,t+3,84]}),c.push({code:`EPSG:${32700+e}`,name:`EPSG:${32700+e} · WGS84 / UTM ${e}S(CM ${t}°E)`,def:`+proj=utm +zone=${e} +south +ellps=WGS84 +datum=WGS84 +units=m +no_defs`,geoBox:[t-3,-80,t+3,84]})}it(`UTM 北半球`,s),it(`UTM 南半球`,c),_e=new Map;for(let e of re)for(let t of e.items)_e.set(t.code,t);le=[],P=new Md({target:`map`,layers:[],view:new du({projection:j.value.viewCrs,center:Dn([108.5,36.5],j.value.viewCrs),zoom:i.zoom}),controls:[new zu({zoomInTipLabel:`放大`,zoomOutTipLabel:`缩小`}),new kp({tipLabel:`全屏`}),new Vp({units:`metric`,target:Le.value}),new Lp({coordinateFormat:e=>j.valueatCoord(e),undefinedHTML:`—`,target:Ie.value}),nt()]}),lt(),P.on(`moveend`,()=>{dt(),a(`view-changed`,tr())}),P.on(`loadstart`,()=>{l.value=!0}),P.on(`loadend`,()=>{l.value=!1}),ve=null,fe=[],N=null,ue=0,M={image:`图片`,tiles:`本地切片XYZ`,xyz:`在线切片XYZ`,geojson:`GeoJSON / SLD`},se=/(\d+)[\\/](\d+)[\\/](\d+)\.(png|jpe?g|webp)$/i,F=null,ge=null,he=null,ce=[`#3f8cff`,`#39c26d`,`#e8b339`,`#e8718d`,`#9b6fd8`,`#31b8b5`,`#f28f3b`,`#729b6f`],ie=/\.(geojson|json)$/i,oe=/\.(sld|xml)$/i,pe=null,de=0,f.value=`image`,I.value.addEventListener(`change`,()=>{let e=I.value.files&&I.value.files[0];e&&sn(e)}),Ue.value.addEventListener(`change`,async()=>{let e=Ue.value.files&&Ue.value.files[0];if(e)try{ge={text:await e.text(),name:e.name},j.value.worldFileName=e.name,on()}catch{z(`世界文件读取失败`,`err`)}}),Re.value.addEventListener(`change`,()=>dn(Re.value.files)),je.value.addEventListener(`change`,()=>Wn(je.value.files)),mr(i.theme),[`dragenter`,`dragover`].forEach(e=>document.addEventListener(e,e=>{e.preventDefault(),e.dataTransfer&&[...e.dataTransfer.types].includes(`Files`)&&(u.value=!0)},{signal:ye.signal})),document.addEventListener(`dragleave`,e=>{e.relatedTarget||(u.value=!1)},{signal:ye.signal}),document.addEventListener(`drop`,async e=>{e.preventDefault(),u.value=!1;let t=await gr(e.dataTransfer);if(!t.length)return;if(t.some(e=>ie.test(e.name)||oe.test(e.name))){Wn(t),Xn(`geojson`),await Gn();return}let n=t.find(e=>/\.(png|jpe?g|webp)$/i.test(e.name));if(!n){z(`请拖放图片或 GeoJSON/SLD`,`warn`);return}let r=t.find(e=>/\.(pgw|pwg|jgw|gfw|wld|pngw|jpgw)$/i.test(e.name));if(await sn(n),r)try{ge={text:await r.text(),name:r.name},j.value.worldFileName=r.name,on()}catch{}Xn(`image`),z(`图片已就绪,点击“加载到地图”`,`ok`)},{signal:ye.signal}),ot(),j.value.viewCrs=`EPSG:3857`,(async()=>{let e=new URLSearchParams(location.search),t=_r(e.get(`epsg`));t&&st(t)&&(j.value.dataCrs=t);let n=e.get(`xyz`),r=e.get(`img`);if(n){j.value.urlTemplate=n,e.get(`minzoom`)&&(j.value.urlMinzoom=e.get(`minzoom`)),e.get(`maxzoom`)&&(j.value.urlMaxzoom=e.get(`maxzoom`));let t=(e.get(`extent`)||``).split(`,`).map(e=>parseFloat(e.trim()));t.length===4&&t.every(Number.isFinite)&&(Ve.value.value=t[0],He.value.value=t[1],ze.value.value=t[2],Be.value.value=t[3]);let r=_r(e.get(`extentepsg`));r&&(j.value.urlExtentCrs=r),Xn(`url`),gn()}else if(r){Xn(`image`);let t=null,n=e.get(`worldfile`);if(n)try{let e=await fetch(n);e.ok&&(t=await e.text())}catch{}let i=null,a=e.get(`extent`);if(a){let e=a.split(`,`).map(Number);e.length===4&&e.every(isFinite)&&(i=e)}await un({url:r,name:decodeURIComponent(r.split(`/`).pop()||`图片`),worldText:t,extent:i})}})(),dt(),mn(),o.value=!0}function Ke(){c.value+=1}function qe(){c.value=Math.max(0,c.value-1)}function Je(e){e.preventDefault();let t=e.clientX,n=s.value,r=e=>{s.value=Math.min(620,Math.max(280,n+(e.clientX-t)))},i=()=>{window.removeEventListener(`mousemove`,r),window.removeEventListener(`mouseup`,i),document.body.style.cursor=``,document.body.style.userSelect=``};document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,window.addEventListener(`mousemove`,r),window.addEventListener(`mouseup`,i)}function Ye(){Me.value.classList.add(`sidebar-collapsed`)}function Xe(){Me.value.classList.remove(`sidebar-collapsed`)}function Ze(){Me.value.classList.add(`panel-right-collapsed`)}function Qe(){Me.value.classList.remove(`panel-right-collapsed`)}function $e(){mr(Me.value.classList.contains(`light-theme`)?`dark`:`light`)}async function et(){let e=fe.length;f.value===`image`?await ln():f.value===`tiles`?pn():f.value===`geojson`?await dr():await gn(),fe.length>e&&er()}function tt(){ye&&=(ye.abort(),null),P&&=(P.setTarget(null),null),o.value=!1}function nt(){let e=document.createElement(`button`);e.innerHTML=`⤢`,e.title=`复位视图`;let t=document.createElement(`div`);return t.className=`ol-fit-all ol-control`,t.appendChild(e),e.addEventListener(`click`,()=>Bt()),new Iu({element:t})}function rt(e,t){return`+proj=tmerc +lat_0=0 +lon_0=${e} +k=1 +x_0=${t} +y_0=0 +ellps=GRS80 +units=m +no_defs`}function it(e,t){re.push({label:e,items:t})}function at(e){return{groups:re.map(t=>({label:t.label,items:t.items.filter(t=>e||!t.pixel)})).filter(e=>e.items.length),custom:le.map(e=>({code:e.code,name:`${e.code} · 自定义`}))}}function ot(){let e=at(!0),t=at(!1);A.value.dataCrs=e.groups,A.value.viewCrs=t.groups,A.value.urlExtentCrs=t.groups,ee.value=e.custom,j.value.urlExtentCrs||(j.value.urlExtentCrs=`EPSG:3857`)}function st(e){if(!e)return null;if(e===`PIXEL`)return ae;let t=B(e);if(t)return t;let n=_e.get(e)||le.find(t=>t.code===e);if(!n||!n.def)return null;if(Nb.defs(e,n.def),Zf(Nb),t=B(e),t&&n.geoBox&&!t.getExtent())try{let r=Pn(n.geoBox,`EPSG:4326`,e);r.every(isFinite)&&t.setExtent(r)}catch{}return t}function ct(e){let t=P.getView();if(!t||!e)return``;let n=t.getProjection(),r=n.getUnits()===`degrees`,i=e.map(e=>r?e.toFixed(6):e.toFixed(2)).join(`, `);if(n.getCode()===`PIXEL`)return`${i} px`;try{let t=On(e,n);return!isFinite(t[0])||!isFinite(t[1])?i:`${i} | ${t[0].toFixed(6)}, ${t[1].toFixed(6)}°`}catch{return i}}function lt(){P.getView().on(`change:resolution`,()=>dt())}function ut(e){return isFinite(e)?e>=1e3?e.toFixed(0):e>=1?e.toPrecision(4):e.toExponential(1):`-`}function dt(){let e=P&&P.getView();if(!e)return;let t=e.getZoom(),n=e.getResolution(),r=e.getProjection(),i=r.getUnits()===`degrees`?`°/px`:r.getCode()===`PIXEL`?`px`:`m/px`;y.value=`${r.getCode()} · 级别 ${t==null?`-`:t.toFixed(1)} · 分辨率 ${ut(n)} ${i}`,pt(),ft()}function ft(){let e=P&&P.getView(),t=e?e.getProjection():null;if(!N||!N.extent||!t){te.value={minx:``,miny:``,maxx:``,maxy:``};return}let n=N.extent;if(N.projection.getCode()!==t.getCode()){try{n=Pn(n,N.projection,t)}catch{n=null}if(!n||!n.every(isFinite)){te.value={minx:``,miny:``,maxx:``,maxy:``};return}}te.value={minx:ht(n[0]),miny:ht(n[1]),maxx:ht(n[2]),maxy:ht(n[3])}}function pt(){let e=P&&P.getView(),t=P&&P.getSize();if(!e||!t||!N||e.getResolution()==null){ne.value={minx:``,miny:``,maxx:``,maxy:``};return}let n=e.calculateExtent(t);!n||!n.every(isFinite)?ne.value={minx:``,miny:``,maxx:``,maxy:``}:ne.value={minx:ht(n[0]),miny:ht(n[1]),maxx:ht(n[2]),maxy:ht(n[3])}}function ht(e){return isFinite(e)?String(+(Math.abs(e)>=1e3?e.toFixed(2):e.toFixed(6))):``}function z(e,t=`info`){b.value=e,x.value=t,S.value=!0,clearTimeout(ve),ve=setTimeout(()=>{S.value=!1},3200)}function gt(e){return{image:`🖼️`,tiles:`🧩`,xyz:`🌐`,geojson:`🌍`}[e]||`🗺️`}function _t(e){Lt(e),N===e&&Vt(e.extent,e.projection)}function vt(){w.value=fe.map(e=>({id:e.id,entry:e,active:e===N,icon:gt(e.kind),name:e.name,meta:`${e.projection.getCode()} · ${e.viewProjectionCode}`}))}function yt(){if(Ct(),!N){C.value.active=!1;return}let e=N,t=e.projection.getCode();C.value={active:!0,name:e.name,kind:`${gt(e.kind)} ${M[e.kind]||`地图`}`,dataCrs:e.sourceCrs&&e.sourceCrs!==t?`${t}(源:${e.sourceCrs})`:t,extent:e.extent?`X ${Jt(e.extent[0])} ~ ${Jt(e.extent[2])};Y ${Jt(e.extent[1])} ~ ${Jt(e.extent[3])}`:`未知`}}function bt(e){for(let t of e){let e=t.get(`layer`),n=typeof e==`string`?e.trim():``;if(n)return n}return null}function xt(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(!r.group){t.push({type:`layer`,sublayer:r}),n+=1;continue}let i=n,a=[];for(;n<e.length&&e[n].group===r.group;)a.push(e[n]),n+=1;t.push({type:`group`,key:`${i}:${r.group}`,name:r.group,children:a})}return t}function St(e){return e.visible&&e.groupVisible!==!1}function Ct(){if(N&&N.kind===`image`){E.value=`PNG 格式地图无可操作图层`,T.value=!0,k.value=[],D.value=0,O.value=0;return}E.value=``;let e=N&&N.sublayers?N.sublayers:[];D.value=e.length,O.value=e.reduce((e,t)=>e+(Number.isFinite(t.featureCount)?t.featureCount:0),0);let t=!!e.length;if(T.value=t,!t){k.value=[];return}let n=xt(N.sublayers).reverse();k.value=n.map((e,t)=>{if(e.type===`layer`){let n=e.sublayer,r=St(n);return{type:`layer`,key:`layer-${t}`,name:n.name,meta:`${gt(n.kind)} ${M[n.kind]||`图层`}${Number.isFinite(n.featureCount)?` · ${n.featureCount} 要素`:``}`,visible:r,sublayer:n}}let n=e.children.map((e,n)=>({key:`child-${t}-${n}`,name:e.name,meta:`${gt(e.kind)} ${M[e.kind]||`图层`}${Number.isFinite(e.featureCount)?` · ${e.featureCount} 要素`:``}`,visible:St(e),sublayer:e}));return{type:`group`,key:`group-${e.key}-${t}`,name:e.name,collapsed:!N.expandedLayerGroups.has(e.key),visible:n.every(e=>e.sublayer.groupVisible!==!1),group:e,children:n}})}function wt(e){let t=e.sublayer;e.visible?(t.visible=!1,t.layer.setVisible(!1)):(t.visible=!0,t.layer.setVisible(!0)),Ct()}function Tt(e){e.collapsed?N.expandedLayerGroups.add(e.group.key):N.expandedLayerGroups.delete(e.group.key),Ct()}function Et(e){let t=!e.visible;e.children.forEach(e=>{e.sublayer.groupVisible=t,e.sublayer.layer.setVisible(t&&e.sublayer.visible)}),Ct()}function Dt(e,t){let n=t.sublayer;t.visible?(n.visible=!1,n.layer.setVisible(!1)):(n.visible=!0,e.children.forEach(e=>{e.sublayer.groupVisible=!0,e.sublayer.layer.setVisible(e.sublayer.visible)})),Ct()}function Ot(e){if(!e||e.kind!==`geojson`)return null;try{let t=e.source||e.layer.getSource(),n=t&&typeof t.getExtent==`function`?t.getExtent():null;if(Array.isArray(n)&&n.every(isFinite)&&n[2]>n[0]&&n[3]>n[1])return n.slice()}catch{}return null}function kt(e){let t=N,n=e&&e.sublayer;if(!t||!n)return;let r=Ot(n);r?Vt(r,P.getView().getProjection()):Array.isArray(t.extent)&&t.extent.every(isFinite)&&t.extent[2]>t.extent[0]&&t.extent[3]>t.extent[1]?Vt(t.extent,t.projection):z(`该图层暂无有效范围`,`warn`)}function At(e){let t=N;if(!t||!e||!Array.isArray(e.children)||!e.children.length)return;let n=me(),r=!1;e.children.forEach(e=>{let t=Ot(e.sublayer);t&&(be(n,t),r=!0)}),r&&n.every(isFinite)&&n[2]>n[0]&&n[3]>n[1]?Vt(n,P.getView().getProjection()):Vt(t.extent,t.projection)}function jt(e){let t=N;if(!t||!e)return!1;let n=t.sublayers.indexOf(e);if(n<0)return!1;if(t.sublayers.splice(n,1),Array.isArray(t.sources)){let n=t.sources.indexOf(e.source);n>=0&&t.sources.splice(n,1)}if(t.layer&&typeof t.layer.getLayers==`function`){t.layer.getLayers().remove(e.layer);try{e.layer.dispose()}catch{}}return!0}function Mt(e){let t=N;t&&!t.sublayers.length?(zt(t),e&&z(e,`ok`)):(vt(),yt(),e&&z(e,`ok`))}function Nt(e){let t=e&&e.sublayer;t&&jt(t)&&(a(`layer-removed`,{isGroup:!1,name:t.name,layerCount:null,group:t.group}),console.log(`row`,e),Mt(`已删除图层:`+t.name))}function Pt(e){if(!e||!Array.isArray(e.children)||!e.children.length)return;let t=e.children.length;e.children.forEach(e=>jt(e.sublayer)),console.log(`row`,e),a(`layer-removed`,{isGroup:!0,name:e.name,layerCount:t,group:null}),Mt(`已删除图层组(`+t+` 个图层)`)}function Ft(e){Array.isArray(e.sublayers)||(e.sublayers=[{name:e.name,kind:e.kind,layer:e.layer,visible:!0}]);for(let t of e.sublayers)t.name=t.name||e.name,t.kind=t.kind||e.kind,t.group=t.group||null,t.groupVisible=!t.group||t.groupVisible!==!1,t.visible=t.visible!==!1,t.layer.setVisible(St(t)),t.layer.set(`title`,t.name);return e.sublayers}function It(){if(!N)return;let e=P.getView();N.viewState={center:e.getCenter(),resolution:e.getResolution()},N.viewProjectionCode=e.getProjection().getCode()}function Lt(e){if(!e||e===N)return;It(),N&&P.removeLayer(N.layer),N=e,P.addLayer(e.layer);let t=st(e.viewProjectionCode)||e.projection,n=e.viewState;n&&n.center&&n.center.every(isFinite)?Wt(t,{center:n.center,resolution:n.resolution}):(Wt(t),Vt(e.extent,e.projection)),vt(),dt(),yt(),a(`active-map-changed`,{id:e.id,name:e.name,kind:e.kind})}function Rt(e){e.id=++ue,e.expandedLayerGroups=new Set,e.sublayers=Ft(e),e.layer.set(`title`,e.name),e.viewProjectionCode=e.projection.getCode(),e.viewState=null,fe.unshift(e),Lt(e)}function zt(e){let t=fe.indexOf(e);t>=0&&fe.splice(t,1),N===e?(P.removeLayer(e.layer),N=null,fe.length?Lt(fe[0]):(vt(),yt(),dt())):vt();try{e.cleanup&&e.cleanup()}catch{}a(`map-removed`,{id:e.id,name:e.name,kind:e.kind})}function Bt(){N?Vt(N.extent,N.projection):z(`暂无地图`,`warn`)}function Vt(e,t){let n=P.getView(),r=n.getProjection(),i=e;if(t&&t.getCode()!==r.getCode()){try{i=Pn(e,t,r)}catch{i=null}if(!i||!i.every(isFinite)){z(`无法将数据范围转换到当前视图坐标系`,`warn`);return}}!i||i[2]<=i[0]||i[3]<=i[1]||n.fit(i,{padding:[60,60,60,60],maxZoom:28,duration:300})}function Ht(){j.value.viewCrs=P.getView().getProjection().getCode()}function Ut(e){let t=P.getView(),n=t.getProjection(),r=t.getCenter(),i=t.getResolution(),a=null,o=null;try{a=Nn(r,n,e);let t=xn(n,1,r,`m`),s=xn(e,1,a,`m`);a.every(isFinite)&&[t,s].every(isFinite)&&s>0?o=i*t/s:a=null}catch{a=null}return{center:a,resolution:o}}function Wt(e,{center:t,resolution:n}={}){let r=new du({projection:e});if(P.setView(r),t&&t.every(isFinite))r.setCenter(t);else{let t=e.getExtent();t?r.setCenter([(t[0]+t[2])/2,(t[1]+t[3])/2]):r.setCenter([0,0])}if(n&&isFinite(n)&&n>0)try{r.setResolution(n)}catch{}lt(),Ht(),N&&Array.isArray(N.sources)&&N.sources.forEach(e=>e.refresh()),dt()}function Gt(e){let t=e.getExtent();if(!t||!t.every(isFinite))try{t=Pn([-180,-90,180,90],`EPSG:4326`,e)}catch{t=[-1,-1,1,1]}let n=t[2]-t[0],r=t[3]-t[1],i=Math.max(n,r),a=(t[0]+t[2])/2,o=(t[1]+t[3])/2;return[a-i/2,o-i/2,a+i/2,o+i/2]}function Kt(e,t,n=0,r=null){let i=Gt(e),a=(i[2]-i[0])/256,o=[];for(let e=0;e<=t;e++)o.push(a/2**e);return new Nf({extent:r||i,origin:[i[0],i[3]],resolutions:o,tileSize:[256,256],minZoom:n,maxZoom:t})}function qt(e,t){let n=e.getResolution(t.minZ),[r,i]=e.getOrigin(t.minZ);return[r+t.x0*256*n,i-(t.y1+1)*256*n,r+(t.x1+1)*256*n,i-t.y0*256*n]}function Jt(e){return isFinite(e)?Math.abs(e)>=1e3?Math.round(e).toLocaleString(`zh-CN`):String(+e.toFixed(6)):`-`}function Yt(e){return`X ${Jt(e[0])} ~ ${Jt(e[2])};Y ${Jt(e[1])} ~ ${Jt(e[3])}`}function Xt(e,t){let n=st(t);if(!n||n.getCode()===`PIXEL`)return null;let r=Qt(e);return r?qt(Kt(n,r.maxZ,r.minZ),r):null}function Zt(e,t){let n=new Map;for(let r of e){let e=(r.webkitRelativePath||r.name).match(se);if(!e)continue;let i=+e[1],a=+e[2],o=+e[3];t&&(o=(1<<i)-1-o),n.set(`${i}/${a}/${o}`,r)}return n}function Qt(e){if(!e.size)return null;let t=1/0,n=-1/0,r=new Map;for(let i of e.keys()){let[e,a,o]=i.split(`/`).map(Number);e<t&&(t=e),e>n&&(n=e);let s=r.get(e);s||(s={x0:1/0,x1:-1/0,y0:1/0,y1:-1/0},r.set(e,s)),s.x0=Math.min(s.x0,a),s.x1=Math.max(s.x1,a),s.y0=Math.min(s.y0,o),s.y1=Math.max(s.y1,o)}return{minZ:t,maxZ:n,...r.get(t),ranges:r}}function $t(e,t,n,r){let i=parseInt(e,10);return Number.isFinite(i)?Math.min(n,Math.max(t,i)):r}function en(e){return new Promise((t,n)=>{let r=new Image;r.onload=()=>t({width:r.naturalWidth,height:r.naturalHeight}),r.onerror=()=>n(Error(`图片加载失败`)),r.src=e})}function tn(e){let t=e.trim().split(/\r?\n/).map(e=>parseFloat(e.trim()));if(t.length<6||t.slice(0,6).some(e=>!isFinite(e)))throw Error(`世界文件格式无法解析`);return t.slice(0,6)}function nn(e,t,n){let[r,i,a,o,s,c]=n;if(i||a)throw Error(`不支持带旋转的世界文件`);return[s-r/2,c+(t-.5)*o,s+(e-.5)*r,c-o/2]}function rn(e){if(!e)return null;let t=e[2];if(t<=1e6||t>=7e7)return null;let n=Math.round(t/1e6),r=[];return n>=25&&n<=45&&r.push({code:`EPSG:${4513+n-25}`,label:`3度带 ${n},中央经线 ${n*3}°E(EPSG:${4513+n-25},含带号)`}),n>=13&&n<=23&&r.push({code:`EPSG:${4491+n-13}`,label:`6度带 ${n},中央经线 ${n*6-3}°E(EPSG:${4491+n-13},含带号)`}),r.length?(j.value.zoneHint={message:`检测到高斯带号坐标,可能是:`,options:r},r[0].code):null}function an(e){if(j.value.zoneHint={message:``,options:[]},!e)return;let t=rn(e);t&&(j.value.dataCrs=t)}function on(){if(F&&F.width&&ge)try{let e=tn(ge.text),t=nn(F.width,F.height,e);ke.value.value=t[0],Ae.value.value=t[1],De.value.value=t[2],Oe.value.value=t[3],an(t),z(`已根据世界文件计算显示范围`,`ok`)}catch(e){z(`世界文件解析失败:${e.message}`,`err`)}}async function sn(e){F&&F.objectUrl&&URL.revokeObjectURL(F.objectUrl);let t=URL.createObjectURL(e);F={file:e,objectUrl:t,name:e.name,width:null,height:null},j.value.imgFileName=e.name,ke.value.value=Ae.value.value=De.value.value=Oe.value.value=``,an(null);try{let e=await en(t);F.width=e.width,F.height=e.height,on()}catch{z(`图片无法读取`,`err`)}}function cn(){let e=[ke.value,Ae.value,De.value,Oe.value].map(e=>e.value.trim());if(e.some(e=>e===``))return z(`请填写完整的四至范围:X/Y 的最小值和最大值`,`warn`),{ok:!1,extent:null};let t=e.map(Number);return t.some(e=>!isFinite(e))?(z(`范围数值无效`,`warn`),{ok:!1,extent:null}):t[2]>t[0]&&t[3]>t[1]?{ok:!0,extent:t}:(z(`范围无效:需要 X最大 > X最小 且 Y最大 > Y最小`,`warn`),{ok:!1,extent:null})}async function ln(){Ke();try{if(!F){z(`请先选择图片文件`,`warn`);return}let e=st(j.value.dataCrs);if(!e){z(`请先选择或注册有效的坐标系`,`warn`);return}let{width:t,height:n}=F;if(!t||!n)try{let e=await en(F.objectUrl);t=F.width=e.width,n=F.height=e.height}catch{z(`无法读取图片尺寸`,`err`);return}let r=cn();if(!r.ok)return;let i=r.extent,a=URL.createObjectURL(F.file),o=new uf({source:new $f({url:a,imageExtent:i,projection:e})});Rt({name:F.name,kind:`image`,layer:o,extent:i,projection:e,cleanup(){URL.revokeObjectURL(a)}})}finally{qe()}}async function un({url:e,name:t,worldText:n,extent:r,crs:i=null}){Ke();try{let a;try{a=await en(e)}catch{z(`无法加载图片:${e}`,`err`);return}if(n)try{let e=tn(n);r=nn(a.width,a.height,e)}catch(e){z(`世界文件解析失败:${e.message}`,`err`)}r||=[0,-a.height,a.width,0],an(r);let o=i||rn(r)||`EPSG:3857`;j.value.dataCrs=o;let s=st(o)||ae,c=new uf({source:new $f({url:e,imageExtent:r,projection:s})});ke.value.value=r[0],Ae.value.value=r[1],De.value.value=r[2],Oe.value.value=r[3],Rt({name:t,kind:`image`,layer:c,extent:r,projection:s,cleanup(){}})}finally{qe()}}function dn(e){let t=Array.from(e||[]);if(!t.length)return;let n=(t[0].webkitRelativePath||``).split(/[\\/]/)[0]||`本地切片XYZ目录`;he={name:n,files:t},j.value.tilesDirName=`${n}(${t.length} 个文件)`,fn()}function fn(){if(!he)return;let e=Zt(he.files,j.value.tilesTms),t=Qt(e);if(!t){j.value.tilesInfo=`未识别到本地切片XYZ(需要 z/x/y.png 目录结构)`;return}let n=Xt(e,j.value.dataCrs);j.value.tilesInfo=n?`已识别 ${e.size} 张切片,层级 ${t.minZ}–${t.maxZ}。显示范围(${j.value.dataCrs}):${Yt(n)}`:`已识别 ${e.size} 张切片,层级 ${t.minZ}–${t.maxZ}。`}function pn(){Ke();try{if(!he||!he.files.length){z(`请先选择本地切片XYZ目录`,`warn`);return}let e=st(j.value.dataCrs);if(!e){z(`请先选择或注册有效的坐标系`,`warn`);return}let t=Zt(he.files,j.value.tilesTms);if(!t.size){z(`所选目录中未找到 z/x/y 结构的切片文件`,`err`);return}let n=Qt(t),r=qt(Kt(e,n.maxZ,n.minZ),n),i=Kt(e,n.maxZ,n.minZ,r),a=new Map,o=new Xf({projection:e,tileGrid:i,wrapX:!1,minZoom:n.minZ,maxZoom:n.maxZ,tileUrlFunction:([e,n,r])=>{let i=t.get(`${e}/${n}/${r}`);if(!i)return;let o=a.get(i);return o||(o=URL.createObjectURL(i),a.set(i,o)),o}});Rt({name:he.name,kind:`tiles`,layer:new _f({source:o}),extent:r,projection:e,cleanup(){a.forEach(e=>URL.revokeObjectURL(e))}})}finally{qe()}}function mn(){let e=String(j.value.urlTemplate||``).trim();j.value.urlInfo=``,e&&(/^https?:\/\//i.test(e)?/\{z\}/.test(e)&&/\{x\}/.test(e)&&/(\{y\}|\{-y\})/.test(e)||(j.value.urlInfo=`模板需包含 {z}、{x} 和 {y}(或 {-y})。`):j.value.urlInfo=`URL 模板需以 http:// 或 https:// 开头。`)}async function hn(e,t,n,r,i=null){if(!e||!/^https?:\/\//i.test(e))return{error:`URL 模板需以 http:// 或 https:// 开头`};if(!/\{z\}/.test(e)||!/\{x\}/.test(e)||!/(\{y\}|\{-y\})/.test(e))return{error:`模板需包含 {z}、{x} 和 {y}(或 {-y})`};let a=st(t);if(!a)return{error:`请先选择或注册有效的坐标系`};let o=null;if(i){let e=st(i.crs);if(!e)return{error:`范围坐标系无效`};let t=i.extent;if(!t||!t.every(Number.isFinite))return{error:`范围数值无效`};if(t[0]>=t[2]||t[1]>=t[3])return{error:`范围需满足:X最小 < X最大,Y最小 < Y最大`};try{o=Pn(t,e,a)}catch{return{error:`范围坐标系换算失败`}}if(!o||!o.every(Number.isFinite))return{error:`范围坐标系换算失败`}}let s=r??$t(j.value.urlMaxzoom,0,24,22),c=n??$t(j.value.urlMinzoom,0,24,0),l={projection:a,tileGrid:Kt(a,Math.max(s,c),c,o),minZoom:c,maxZoom:s,url:e};return o&&(l.wrapX=!1),{entry:{name:`在线切片XYZ · ${e.length>28?e.slice(0,28)+`…`:e}`,kind:`xyz`,layer:new _f({source:new Xf(l)}),extent:o,projection:a,cleanup(){}}}}async function gn(){Ke();try{let e=String(j.value.urlTemplate||``).trim();if(!e){z(`请填写在线切片XYZ URL 模板`,`warn`);return}if(String(j.value.urlMinzoom||``).trim()===``){z(`请填写最小层级`,`warn`);return}if(String(j.value.urlMaxzoom||``).trim()===``){z(`请填写最大层级`,`warn`);return}let t=[Ve.value.value,He.value.value,ze.value.value,Be.value.value];if(t.some(e=>e.trim()===``)){z(`请填写完整的范围:X/Y 的最小值和最大值`,`warn`);return}let n=t.map(Number);if(!n.every(Number.isFinite)){z(`范围数值无效`,`warn`);return}let r={extent:n,crs:j.value.urlExtentCrs},i=await hn(e,j.value.dataCrs,null,null,r);if(!i.entry){z(i.error||`加载失败`,`warn`);return}j.value.urlInfo=`使用指定范围加载,已自动定位。`,Rt(i.entry)}finally{qe()}}function _n(e){let t=0,n=String(e||`vector`);for(let e=0;e<n.length;e++)t=t*31+n.charCodeAt(e)>>>0;return ce[t%ce.length]}function vn(e,t){return Array.from(e.getElementsByTagName(`*`)).filter(e=>e.localName===t)}function bn(e){let t=new Map,n=[...vn(e,`SvgParameter`),...vn(e,`CssParameter`)];for(let e of n){let n=e.getAttribute(`name`);n&&t.set(n.toLowerCase(),(e.textContent||``).trim())}return t}function Sn(e,t=`stroke`){let n=e.get(t);if(n)return new $o({color:n,width:Number(e.get(t+`-width`))||1,lineCap:e.get(t+`-linecap`)===`square`?`square`:void 0,lineJoin:e.get(t+`-linejoin`)===`mitre`?`miter`:void 0,lineDash:(e.get(t+`-dasharray`)||``).split(/[\s,]+/).filter(Boolean).map(Number).filter(Number.isFinite)})}function Cn(e){let t=new DOMParser().parseFromString(e,`application/xml`);if(t.getElementsByTagName(`parsererror`).length)return null;let n=[],r=null,i=vn(t,`TextSymbolizer`).length>0;for(let e of vn(t,`PointSymbolizer`)){if(i)continue;let t=bn(e),a=t.has(`fill`)?new Qo({color:t.get(`fill`)}):void 0,o=Sn(t),s=Number((vn(e,`Size`)[0]||{}).textContent)||8,c=((vn(e,`WellKnownName`)[0]||{}).textContent||`circle`).toLowerCase(),l={radius:s/2,fill:a,stroke:o},u;u=c===`square`?new is({...l,points:4,angle:Math.PI/4}):c===`triangle`?new is({...l,points:3,angle:0}):c===`cross`?new is({...l,points:4,angle:0,radius2:s/6}):new as(l);let d=new os({image:u});n.push(d),r||=d}for(let e of vn(t,`LineSymbolizer`)){let t=Sn(bn(e));t&&n.push(new os({stroke:t}))}for(let e of vn(t,`PolygonSymbolizer`)){let t=bn(e),r=t.has(`fill`)?new Qo({color:t.get(`fill`)}):void 0,i=Sn(t);(r||i)&&n.push(new os({fill:r,stroke:i}))}for(let e of vn(t,`TextSymbolizer`)){let t=vn(e,`PropertyName`)[0],i=t?t.textContent.trim():``,a=bn(vn(e,`Font`)[0]||e),o=Number(a.get(`font-size`))||10,s=a.get(`font-family`)||`SimSun`,c=a.get(`font-weight`)||`normal`,l=new fs({font:(a.get(`font-style`)||`normal`)+` `+c+` `+o+`px "`+s+`", sans-serif`,fill:new Qo({color:bn(e).get(`fill`)||`#000000`}),text:i?` `:``});r?r.setText(l):n.push(new os({text:l}))}return n.length?n:null}function wn(e){let t=new DOMParser().parseFromString(e,`application/xml`);for(let e of vn(t,`TextSymbolizer`)){let t=vn(e,`PropertyName`)[0];if(t)return t.textContent.trim()}return``}function Tn(e){if(typeof e!=`string`)return null;let t=e.trim().split(`,`).map(e=>Number(e.trim()));if(t.length<3||t.slice(0,3).some(e=>!Number.isFinite(e)||e<0||e>255))return null;let n=t.length>=4&&Number.isFinite(t[3])&&t[3]>=0&&t[3]<=255?t[3]/255:1;return[t[0],t[1],t[2],n]}function En(e){let t=Number(e);return!Number.isFinite(t)||t<0||t>16777215?null:[t>>16&255,t>>8&255,t&255,1]}function kn(e){return Tn(e.get(`color`))||En(e.get(`color24`))||null}function An(e,t,n){if(!t)return;let r=e.getStroke(),i=e.getFill(),a=e.getText();n.includes(`Polygon`)?(r&&e.setStroke(new $o({color:t,width:r.getWidth(),lineCap:r.getLineCap(),lineJoin:r.getLineJoin(),lineDash:r.getLineDash(),lineDashOffset:r.getLineDashOffset(),miterLimit:r.getMiterLimit()})),i&&e.setFill(new Qo({color:t}))):n.includes(`LineString`)||n.includes(`Curve`)?r&&e.setStroke(new $o({color:t,width:r.getWidth(),lineCap:r.getLineCap(),lineJoin:r.getLineJoin(),lineDash:r.getLineDash(),lineDashOffset:r.getLineDashOffset(),miterLimit:r.getMiterLimit()})):n.includes(`Point`)&&(i&&e.setFill(new Qo({color:t})),a&&a.setFill(new Qo({color:t}))),a&&(n.includes(`Point`)||n.includes(`Polygon`))&&a.setFill(new Qo({color:t}))}function jn(e,t){let n=new Map;return(r,i)=>{let a=r.getGeometry(),o=a?a.getType():``,s=t?r.get(t):null,c=kn(r),l=c?c.join(`,`):`sld`,u=a&&a.getFirstCoordinate?a.getFirstCoordinate():P.getView().getCenter(),d=xn(P.getView().getProjection(),Number.isFinite(i)&&i>0?i:1,u,`m`),f=Number(r.get(`height`)),p=Number.isFinite(f)&&f>0?Math.max(3,Math.min(128,f/d)):null,m=Math.round(Math.log2(d)*4),h=Number(r.get(`angle`)),g=Number.isFinite(h)?h*Math.PI/180:null,_=o+`|`+l+`|`+m+`|`+String(s??``)+`|`+g,v=n.get(_);return v||(v=e.map(e=>{let n=e.clone();An(n,c,o);let r=n.getText();if(r&&t&&s!=null&&s!==``){if(r.setText(String(s)),p!=null){let e=r.getFont()||`normal normal 10px "SimSun", sans-serif`;r.setFont(e.replace(/([0-9]+(?:\.[0-9]+)?)px/,p.toFixed(2)+`px`))}g!=null&&r.setRotation(g)}return n}),n.set(_,v)),v}}function Mn(e,t){let n=e.get(`_sldStyle`);if(n)return typeof n==`function`?n(e,t):n;let r=e.getGeometry(),i=r?r.getType():``,a=e.get(`_styleColor`)||_n(e.get(`layer`)||e.get(`_layerName`)),o=e.get(`_labelProperty`)?e.get(e.get(`_labelProperty`)):e.get(`text`),s=o!=null&&o!==``?new fs({font:`12px "Microsoft YaHei", sans-serif`,fill:new Qo({color:`#1c2833`}),text:String(o)}):void 0;return i.includes(`Polygon`)?new os({fill:new Qo({color:a+`26`}),stroke:new $o({color:a,width:1.5}),text:s}):i.includes(`LineString`)||i.includes(`Curve`)?new os({stroke:new $o({color:a,width:1.4}),text:s}):new os({image:new as({radius:4.5,fill:new Qo({color:a}),stroke:new $o({color:`#ffffff`,width:1})}),text:s})}function Fn(e){let t=me();for(let n of e){let e=n.getGeometry();e&&be(t,e.getExtent())}return t}function In(e,t){return new Zo({loader(n,r,i){let a=e.map(e=>{let n=e.clone(),r=n.getGeometry();return r&&r.transform(t,i),n});return this.addFeatures(a),a}})}function Ln(e){let t=e&&e.crs&&e.crs.properties&&e.crs.properties.name;if(!t)return null;if(/CRS84$/i.test(t))return`EPSG:4326`;let n=String(t).match(/EPSG[:\s]+(\d+)/i);return n?`EPSG:`+n[1]:null}function Rn(e,t){let n=e===`EPSG:4326`?`EPSG:4326(WGS84 / CRS84)`:e;return t?n+`(`+t+` 个文件)`:n}function zn(e,t){t?!e||!e.size?(j.value.geojsonCrsHint=`已检查 ${t} 个 GeoJSON,未发现 CRS 声明。`,j.value.geojsonCrsOptions=[]):(j.value.geojsonCrsHint=`检测到 ${e.size} 种 CRS:`,j.value.geojsonCrsOptions=[...e].map(([e,t])=>({code:e,label:Rn(e,t)}))):(j.value.geojsonCrsHint=`未识别到 GeoJSON,无法检测 CRS。`,j.value.geojsonCrsOptions=[])}async function Bn(e,t){let n=new Map,r=0;for(let i of e){if(t!==de)return;try{let e=Ln(JSON.parse(await i.file.text()));e&&n.set(e,(n.get(e)||0)+1)}catch{}r+=1,zn(n,r)}if(t===de&&(zn(n,r),n.size)){let e=[...n.entries()].sort((e,t)=>t[1]-e[1]);j.value.dataCrs=e[0][0]}}function Vn(e){return/^metadata\.json$/i.test(e.name)}function Hn(e){let t=e.filter(e=>ie.test(e.name)&&!Vn(e)),n=new Map;for(let t of e)oe.test(t.name)&&n.set(t.name.replace(/\.[^.]+$/,``),t);return t.map(e=>({file:e,sld:n.get(e.name.replace(/\.[^.]+$/,``))||null}))}async function Un(e,t){if(!t)return{pairs:e,metadata:null};let n=JSON.parse(await t.text());if(!n||!Array.isArray(n.layers))throw Error(`metadata.json 缺少 layers 数组`);let r=new Map(e.map(e=>[e.file.name,e])),i=[],a=new Set;for(let e of n.layers){let t=e&&e.geojson,n=r.get(t);n&&!a.has(t)&&(n.layerTitle=e.title||``,i.push(n),a.add(t))}for(let t of e)a.has(t.file.name)||i.push(t);return{pairs:i,metadata:n}}function Wn(e){let t=Array.from(e||[]),n=t.length?(t[0].webkitRelativePath||``).split(/[\\/]/)[0]:`GeoJSON 目录`,r=Hn(t),i=t.find(Vn)||null;pe={name:n,files:t,pairs:r,metadataFile:i,metadataName:null},j.value.geojsonDirName=r.length?n+`(`+r.length+` 个 GeoJSON,`+r.filter(e=>e.sld).length+` 个 SLD)`:`未识别到 GeoJSON 文件`,j.value.geojsonInfo=r.length?(i?`已识别 metadata.json,将按其中的图层顺序加载;`:``)+`未配对的 .sld 使用默认矢量样式。`:`请选择包含 .geojson(或 .json)和可选同名 .sld 的目录。`,de+=1,r.length?(j.value.geojsonCrsHint=`正在检测 GeoJSON CRS…`,Bn(r,de)):j.value.geojsonCrsHint=`未选择 GeoJSON。`}async function Gn(){Ke();try{if(!pe||!pe.pairs.length){z(`请先选择包含 GeoJSON 文件的目录`,`warn`);return}let e=new lp,t=[],n=null,r=null,i=0,a=pe.pairs,o=[];try{if(pe.metadataFile){let e=await Un(pe.pairs,pe.metadataFile);a=e.pairs,pe.metadataName=e.metadata&&e.metadata.name?e.metadata.name:null}for(let s of a){let a=await s.file.text(),c=JSON.parse(a),l=Ln(c)||j.value.dataCrs,u=st(l);if(!u)throw Error(`无效坐标系:`+l);let d=e.readFeatures(c,{dataProjection:l,featureProjection:l});if(n){if(u.getCode()!==r)for(let e of d){let t=e.getGeometry();t&&t.transform(u,n)}}else n=u,r=u.getCode();if(s.sld){let e=await s.sld.text(),t=Cn(e);if(t){let n=jn(t,wn(e));for(let e of d)e.set(`_sldStyle`,n,!0),s.layerTitle&&e.set(`_layerName`,s.layerTitle,!0);i++}}o.push({pair:s,features:d}),t.push(...d)}}catch(e){z(`GeoJSON 加载失败:`+e.message,`err`);return}if(!t.length){z(`所选文件中没有有效要素`,`warn`);return}let s=o.map(({pair:e,features:t})=>{let r=In(t,n),i=new wu({source:r,style:(e,t)=>Mn(e,t)});return{name:e.layerTitle||e.file.name,kind:`geojson`,layer:i,featureCount:t.length,visible:!0,group:bt(t),groupVisible:!0,source:r}});if(s.some(e=>e.group===`0`))for(let e of s)e.group||=`0`;let c=new Ed({layers:s.map(e=>e.layer)});Rt({name:pe.metadataName||pe.name,kind:`geojson`,layer:c,sublayers:s.map(e=>{let t={...e};return delete t.source,t}),extent:Fn(t),projection:n,sourceCrs:r,sources:s.map(e=>e.source),cleanup(){}}),j.value.geojsonInfo=`已按 metadata.json 顺序加载 `+a.length+` 个图层、`+t.length+` 个要素,应用 `+i+` 个 SLD 样式,数据坐标系 `+r+`。`}finally{qe()}}function Kn(){let e=j.value.viewCrs,t=P.getView().getProjection();if(t.getCode()===e){z(`当前视图已使用该坐标系`,`info`);return}if(t.getCode()===`PIXEL`||e===`PIXEL`){z(`像素坐标无法与其他坐标系互转`,`warn`);return}let n=st(e);if(!n){z(`目标坐标系未注册`,`warn`);return}let{center:r,resolution:i}=Ut(n);Wt(n,{center:r,resolution:i}),r&&!i&&N&&Bt(),N&&(N.viewProjectionCode=n.getCode(),vt())}function qn(e,t){try{if(B(e)||(Nb.defs(e,t),Zf(Nb)),!B(e))throw Error(`注册失败`)}catch(e){return z(`坐标系注册失败:${e.message}`,`err`),!1}return le.some(t=>t.code===e)||le.push({code:e,name:`${e} · 自定义`,def:t}),ot(),j.value.dataCrs=e,!0}async function Jn(){let e=String(parseInt(Te.value.value.trim(),10));if(!e||e===`NaN`){z(`请输入有效的 EPSG 代码`,`warn`);return}let t=`EPSG:${e}`;z(`正在从 epsg.io 获取 ${t} …`);try{let n=await fetch(`https://epsg.io/${e}.proj4`);if(!n.ok)throw Error(`HTTP ${n.status}`);let r=(await n.text()).trim();if(!r.startsWith(`+`))throw Error(`返回内容不是 proj4 定义`);qn(t,r)&&z(`已注册并应用 ${t}`,`ok`)}catch(e){z(`获取失败(${e.message}),请检查网络后重试`,`err`)}}function Yn(e){d.value=e}function Xn(e){f.value=e,d.value=[`image`,`tiles`,`url`].includes(e)?`raster`:`vector`}function Zn(e){Yn(e),Xn(e===`raster`?`image`:`geojson`)}function Qn(){F&&F.objectUrl&&URL.revokeObjectURL(F.objectUrl),F=null,ge=null,he=null,pe=null,I.value.value=``,Ue.value.value=``,Re.value.value=``,je.value.value=``,j.value.imgFileName=`未选择文件`,j.value.worldFileName=`未选择文件`,j.value.tilesDirName=`未选择目录`,j.value.tilesInfo=`支持 QGIS / GDAL 等导出的 z/x/y.png 目录结构。`,j.value.tilesTms=!1,j.value.geojsonDirName=`未选择目录`,j.value.geojsonInfo=`支持按文件名配对的 .geojson 与 .sld。`,de+=1,j.value.geojsonCrsHint=`未选择 GeoJSON。`,j.value.geojsonCrsOptions=[],ke.value.value=Ae.value.value=De.value.value=Oe.value.value=``,j.value.zoneHint={message:``,options:[]},j.value.urlTemplate=``,j.value.urlMinzoom=j.value.urlMaxzoom=``,Ve.value.value=He.value.value=ze.value.value=Be.value.value=``,j.value.urlExtentCrs=`EPSG:3857`,j.value.urlInfo=``,j.value.customEpsg=``,j.value.dataCrs=`EPSG:3857`,Xn(`image`)}function $n(){Qn(),p.value=!0}function er(){p.value=!1}function tr(){if(!P)return null;let e=P.getView();return{center:e.getCenter(),zoom:e.getZoom(),crs:e.getProjection().getCode()}}function nr(){let e=N;if(!e)return null;let t=P.getView();return{id:e.id,name:e.name,kind:e.kind,dataCrs:e.projection.getCode(),viewCrs:e.viewProjectionCode,extent:e.extent,sublayerCount:e.sublayers.length,center:t.getCenter(),zoom:t.getZoom()}}async function rr({url:e,crs:t=`EPSG:3857`,minZoom:n=0,maxZoom:r=22,extent:i=null,extentCrs:a=null}={}){o.value||await fr();let s=await hn(e,t,n,r,i&&i.length===4?{extent:i,crs:a||t}:null);return s.entry?(Rt(s.entry),s.entry):(z(s.error||`加载失败`,`warn`),null)}async function ir({url:e,name:t=null,crs:n=null,worldFileUrl:r=null,worldText:i=null,extent:a=null}={}){if(o.value||await fr(),n&&(j.value.dataCrs=n),!i&&r)try{let e=await fetch(r);e.ok&&(i=await e.text())}catch{}return await un({url:e,name:t||decodeURIComponent(String(e).split(`/`).pop()||`图片`),worldText:i,extent:a,crs:n}),N}async function ar(e){return o.value||await fr(),Wn(e),await Gn(),N}async function or(e,t=``){o.value||await fr();let n=sr(e);if(!n.length)return z(`清单中没有文件`,`warn`),null;let r=[],i=[];for(let e of n){let n=cr(e.url,t);try{let e=await fetch(n);if(!e.ok)throw Error(`HTTP `+e.status);let t=await e.blob();r.push(new File([t],lr(n),{type:t.type||`application/octet-stream`}))}catch(e){console.error(`[manifest] 文件加载失败:`,n,e),i.push(lr(n)+`:`+e.message)}}if(i.length&&z(`有 `+i.length+` 个文件加载失败:`+i.slice(0,3).join(`;`)+(i.length>3?` 等`:``),`warn`),!r.length)throw Error(`矢量文件全部加载失败(共 `+i.length+` 个)`);return ar(r)}function sr(e){let t=e=>{if(typeof e==`string`)return{url:e};if(!e||typeof e!=`object`)return null;let t=e.url||e.geojson||e.image||e.png||null;return t?{url:t,type:e.type||null,name:e.name||e.title||null,crs:e.crs||null,worldFile:e.worldFile||e.worldfile||null,worldText:e.worldText||null,extent:Array.isArray(e.extent)&&e.extent.length===4?e.extent:null,sld:e.sld||null}:null},n=e=>{let n=[],r=t(e);return r&&n.push(r),e&&typeof e==`object`&&typeof e.sld==`string`&&e.sld&&(r&&r.url===e.sld||n.push({url:e.sld})),n};if(Array.isArray(e))return[].concat.apply([],e.map(n));if(!e)return[];if(Array.isArray(e.files))return[].concat.apply([],e.files.map(n));if(Array.isArray(e.layers)){let n=[];for(let r of e.layers)r&&r.geojson&&n.push(t(Object.assign({},r,{url:r.geojson,sld:null}))),r&&r.sld&&n.push({url:r.sld});return n.push({url:`metadata.json`}),n}return[]}function cr(e,t){let n=String(e);return/^https?:\/\//i.test(n)||!t?n:t.replace(/\/$/,``)+`/`+n.replace(/^\//,``)}function lr(e){return decodeURIComponent(String(e).split(`/`).pop().split(`?`)[0]||`未命名`)}async function ur(e){if(o.value||await fr(),!Array.isArray(e)||!e.length)return z(`没有可加载的图层数据`,`warn`),null;let t=[];for(let n of e){if(!n||!n.geojson)continue;let e=typeof n.geojson==`string`?n.geojson:JSON.stringify(n.geojson);if(t.push(new File([e],n.name+`.geojson`,{type:`application/geo+json`})),n.sld){let e=typeof n.sld==`string`?n.sld:JSON.stringify(n.sld);t.push(new File([e],n.name+`.sld`,{type:`application/xml`}))}}return t.length?ar(t):(z(`没有可加载的图层数据`,`warn`),null)}async function dr(){await Gn()}function fr(){return o.value?Promise.resolve():new Promise(e=>{let t=setInterval(()=>{o.value&&(clearInterval(t),e())},50)})}async function pr(){Ke();try{let e=i.autoLoad;if(!e||!e.url)return;if(e.type===`manifest`){let t=await fetch(e.url);if(!t.ok)throw Error(`获取失败:`+e.url+`(`+t.status+`)`);await or(await t.json(),e.baseUrl||``)}else e.type===`image`&&await ir({url:e.url,name:e.name||null,crs:e.crs||null,worldFileUrl:e.worldFile||null,worldText:e.worldText||null,extent:e.extent||null})}finally{qe()}}function mr(e){g.value=e===`light`,i.themeIcon=g.value?`🌙`:`☀️`,i.themeTitle=g.value?`切换到深色主题`:`切换到浅色主题`,a(`theme-changed`,e)}async function hr(e,t=``){if(!e)return[];if(e.isFile)return await new Promise(n=>{e.file(r=>{try{Object.defineProperty(r,"webkitRelativePath",{value:t+e.name})}catch{}n([r])},()=>n([]))});let n=e.createReader(),r=[];for(;;){let e=await new Promise(e=>n.readEntries(e,()=>e([])));if(!e.length)break;r.push(...e)}let i=[];for(let n of r)i.push(...await hr(n,t+e.name+`/`));return i}async function gr(e){let t=Array.from(e&&e.files||[]);if(t.length)return t;let n=Array.from(e&&e.items||[]).map(e=>e.webkitGetAsEntry&&e.webkitGetAsEntry()).filter(Boolean);return n.length?(await Promise.all(n.map(e=>hr(e)))).flat():[]}function _r(e){return e=String(e||``).trim(),/^\d+$/.test(e)?`EPSG:${e}`:/^epsg:\d+$/i.test(e)?e.toUpperCase():null}return(0,t.onMounted)(()=>{Ge(),pr().catch(e=>{console.error(`[autoLoad] 自动加载失败:`,e),z(`自动加载失败:`+e.message,`err`)}),i.hidePanels&&(Ye(),Ze())}),(0,t.onBeforeUnmount)(()=>{tt()}),n({viewerReady:o,sidebarWidth:s,loadingTasks:c,olLoading:l,dropVisible:u,sourceCategory:d,currentTab:f,loadDialogVisible:p,sidebarCollapsed:m,panelRightCollapsed:h,isLight:g,themeIcon:_,themeTitle:v,statusInfo:y,toastText:b,toastType:x,toastVisible:S,mapInfo:C,mapListItems:w,layerListVisible:T,layerListHint:E,layerTotal:D,layerFeatureTotal:O,layerListItems:k,crsOptions:A,customCrsOptions:ee,mapExtent:te,viewExtent:ne,form:j,initViewer:Ge,pushLoading:Ke,popLoading:qe,startSidebarResize:Je,collapseSidebar:Ye,expandSidebar:Xe,collapsePanelRight:Ze,expandPanelRight:Qe,toggleTheme:$e,loadToMap:et,destroyViewer:tt,createFitAllControl:nt,gkDef:rt,addGroup:it,buildCrsOptionGroups:at,refillCrsSelects:ot,ensureProjection:st,formatCoord:ct,attachViewListener:lt,fmtRes:ut,updateStatus:dt,updateMapExtent:ft,updateViewExtent:pt,fmtExtentInput:ht,toast:z,kindIcon:gt,selectAndFitMap:_t,renderMapList:vt,renderMapInfo:yt,inferGeoJsonGroup:bt,buildLayerGroups:xt,isLayerEffectivelyVisible:St,renderLayerList:Ct,toggleLayerVisible:wt,toggleLayerGroupExpanded:Tt,toggleLayerGroupVisible:Et,toggleLayerChildVisible:Dt,getVectorSourceExtent:Ot,zoomToLayer:kt,zoomToLayerGroup:At,removeSublayerInternal:jt,afterLayersRemoved:Mt,removeLayerItem:Nt,removeLayerGroup:Pt,normalizeSublayers:Ft,saveActiveViewState:It,selectMapEntry:Lt,addMapEntry:Rt,deleteMapEntry:zt,fitActiveMap:Bt,fitToExtent:Vt,syncViewCrsSelect:Ht,computeViewTransition:Ut,setViewProjection:Wt,worldSquareExtent:Gt,buildTileGrid:Kt,tilesExtent:qt,fmtExtentNum:Jt,extentText:Yt,extentFromTileMap:Xt,scanTileFiles:Zt,tileStats:Qt,clampInt:$t,getImageSize:en,parseWorldFile:tn,extentFromWorldFile:nn,guessCrsFromExtent:rn,updateZoneHint:an,applyWorldFileToExtent:on,onImageFileChosen:sn,readExtentInputs:cn,loadImageLayer:ln,addImageFromUrl:un,onTilesDirChosen:dn,updateTilesInfo:fn,loadTilesLayer:pn,updateUrlTemplateHint:mn,createXyzEntry:hn,loadUrlLayer:gn,vectorColor:_n,descendants:vn,svgParameters:bn,strokeFromParams:Sn,parseSldStyles:Cn,sldLabelProperty:wn,parseCadColor:Tn,parseCadColor24:En,resolveGeoJsonCadColor:kn,setStyleColor:An,makeSldStyleFunction:jn,defaultVectorStyle:Mn,featuresExtent:Fn,createReprojectingVectorSource:In,geoJsonCrsCode:Ln,geoJsonCrsChipLabel:Rn,updateGeoJsonCrsHint:zn,detectGeoJsonCrsHints:Bn,isMetadataJson:Vn,matchGeoJsonPairs:Hn,orderGeoJsonPairsByMetadata:Un,onGeoJsonDirChosen:Wn,loadGeoJsonLayers:Gn,switchViewProjection:Kn,registerCustom:qn,fetchAndRegisterEpsg:Jn,setSourceCategory:Yn,setActiveTab:Xn,setSourceCategoryAndDefault:Zn,resetLoadDialog:Qn,openLoadDialog:$n,closeLoadDialog:er,getViewState:tr,getActiveMapInfo:nr,addXyzLayer:rr,loadImageFromUrl:ir,loadGeoJsonFromFiles:ar,loadGeoJsonFromManifest:or,manifestEntries:sr,resolveManifestUrl:cr,manifestUrlName:lr,loadGeoJsonFromData:ur,loadGeoJsonForCurrentSource:dr,waitViewerReady:fr,processAutoLoad:pr,applyTheme:mr,readDroppedEntry:hr,filesFromDataTransfer:gr,normalizeEpsg:_r}),(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{ref_key:`mapViewer`,ref:Me,class:(0,t.normalizeClass)([`map-viewer-root`,{"light-theme":g.value,"sidebar-collapsed":m.value,"panel-right-collapsed":h.value}]),style:(0,t.normalizeStyle)(R.value)},[(0,t.createElementVNode)(`aside`,Pb,[(0,t.createElementVNode)(`header`,Fb,[n[11]||=(0,t.createElementVNode)(`div`,{class:`brand`},[(0,t.createElementVNode)(`span`,{class:`logo`},`🗺️`),(0,t.createElementVNode)(`div`,null,[(0,t.createElementVNode)(`h1`,null,`地图查看器`),(0,t.createElementVNode)(`p`,null,`当前地图信息`)])],-1),(0,t.createElementVNode)(`button`,{id:`sidebar-collapse`,title:`收起面板`,ref_key:`sidebarCollapse`,ref:Pe,onClick:Ye},`‹`,512)]),(0,t.createElementVNode)(`div`,Ib,[(0,t.createElementVNode)(`section`,Lb,[n[16]||=(0,t.createElementVNode)(`h2`,null,`当前地图`,-1),C.value.active?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Rb,`暂无地图,请上传地图。`)),(0,t.withDirectives)((0,t.createElementVNode)(`div`,zb,[(0,t.createElementVNode)(`div`,Bb,[n[12]||=(0,t.createElementVNode)(`span`,{class:`detail-label`},`名称`,-1),(0,t.createElementVNode)(`span`,Vb,(0,t.toDisplayString)(C.value.name),1)]),(0,t.createElementVNode)(`div`,Hb,[n[13]||=(0,t.createElementVNode)(`span`,{class:`detail-label`},`类型`,-1),(0,t.createElementVNode)(`span`,Ub,(0,t.toDisplayString)(C.value.kind),1)]),(0,t.createElementVNode)(`div`,Wb,[n[14]||=(0,t.createElementVNode)(`span`,{class:`detail-label`},`数据坐标系`,-1),(0,t.createElementVNode)(`span`,Gb,(0,t.toDisplayString)(C.value.dataCrs),1)]),(0,t.createElementVNode)(`div`,Kb,[n[15]||=(0,t.createElementVNode)(`span`,{class:`detail-label`},`显示范围`,-1),(0,t.createElementVNode)(`span`,qb,(0,t.toDisplayString)(C.value.extent),1)])],512),[[t.vShow,C.value.active]])]),(0,t.withDirectives)((0,t.createElementVNode)(`section`,Jb,[n[25]||=(0,t.createElementVNode)(`h2`,null,`视图坐标系`,-1),(0,t.createElementVNode)(`div`,Yb,[(0,t.withDirectives)((0,t.createElementVNode)(`select`,{id:`view-crs`,"onUpdate:modelValue":n[0]||=e=>j.value.viewCrs=e},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(A.value.viewCrs,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`optgroup`,{key:e.label,label:e.label},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.items,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`option`,{key:e.code,value:e.code},(0,t.toDisplayString)(e.name),9,Zb))),128))],8,Xb))),128)),ee.value.length?((0,t.openBlock)(),(0,t.createElementBlock)(`optgroup`,Qb,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(ee.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`option`,{key:e.code,value:e.code},(0,t.toDisplayString)(e.name),9,$b))),128))])):(0,t.createCommentVNode)(``,!0)],512),[[t.vModelSelect,j.value.viewCrs]]),(0,t.createElementVNode)(`button`,{id:`btn-switch-view`,class:`mini-btn`,type:`button`,ref_key:`btnSwitchView`,ref:we,onClick:Kn},`切换`,512)]),n[26]||=(0,t.createElementVNode)(`label`,{class:`grid-caption`},`显示范围`,-1),(0,t.createElementVNode)(`div`,ex,[(0,t.createElementVNode)(`label`,null,[n[17]||=(0,t.createTextVNode)(`X 最小(西)`,-1),(0,t.createElementVNode)(`input`,{type:`number`,id:`map-ext-minx`,step:`any`,readonly:``,value:te.value.minx},null,8,tx)]),(0,t.createElementVNode)(`label`,null,[n[18]||=(0,t.createTextVNode)(`Y 最小(南)`,-1),(0,t.createElementVNode)(`input`,{type:`number`,id:`map-ext-miny`,step:`any`,readonly:``,value:te.value.miny},null,8,nx)]),(0,t.createElementVNode)(`label`,null,[n[19]||=(0,t.createTextVNode)(`X 最大(东)`,-1),(0,t.createElementVNode)(`input`,{type:`number`,id:`map-ext-maxx`,step:`any`,readonly:``,value:te.value.maxx},null,8,rx)]),(0,t.createElementVNode)(`label`,null,[n[20]||=(0,t.createTextVNode)(`Y 最大(北)`,-1),(0,t.createElementVNode)(`input`,{type:`number`,id:`map-ext-maxy`,step:`any`,readonly:``,value:te.value.maxy},null,8,ix)])]),n[27]||=(0,t.createElementVNode)(`label`,{class:`grid-caption`},`当前视野`,-1),(0,t.createElementVNode)(`div`,ax,[(0,t.createElementVNode)(`label`,null,[n[21]||=(0,t.createTextVNode)(`X 最小(西)`,-1),(0,t.createElementVNode)(`input`,{type:`number`,id:`view-ext-minx`,step:`any`,readonly:``,value:ne.value.minx},null,8,ox)]),(0,t.createElementVNode)(`label`,null,[n[22]||=(0,t.createTextVNode)(`Y 最小(南)`,-1),(0,t.createElementVNode)(`input`,{type:`number`,id:`view-ext-miny`,step:`any`,readonly:``,value:ne.value.miny},null,8,sx)]),(0,t.createElementVNode)(`label`,null,[n[23]||=(0,t.createTextVNode)(`X 最大(东)`,-1),(0,t.createElementVNode)(`input`,{type:`number`,id:`view-ext-maxx`,step:`any`,readonly:``,value:ne.value.maxx},null,8,cx)]),(0,t.createElementVNode)(`label`,null,[n[24]||=(0,t.createTextVNode)(`Y 最大(北)`,-1),(0,t.createElementVNode)(`input`,{type:`number`,id:`view-ext-maxy`,step:`any`,readonly:``,value:ne.value.maxy},null,8,lx)])])],512),[[t.vShow,C.value.active]]),(0,t.withDirectives)((0,t.createElementVNode)(`section`,ux,[(0,t.createElementVNode)(`h2`,dx,[n[28]||=(0,t.createTextVNode)(`图层列表`,-1),E.value?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,fx,(0,t.toDisplayString)(D.value)+` 个图层 · `+(0,t.toDisplayString)(O.value)+` 个要素`,1))]),(0,t.withDirectives)((0,t.createElementVNode)(`p`,{class:`layer-list-hint`},(0,t.toDisplayString)(E.value),513),[[t.vShow,E.value]]),(0,t.createElementVNode)(`ul`,px,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(k.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,[e.type===`layer`?((0,t.openBlock)(),(0,t.createElementBlock)(`li`,{key:e.key,class:(0,t.normalizeClass)([`layer-item`,{"hidden-layer":!e.visible}])},[(0,t.createElementVNode)(`div`,mx,[(0,t.createElementVNode)(`span`,{class:`layer-name`,title:e.name},(0,t.toDisplayString)(e.name),9,hx),(0,t.createElementVNode)(`span`,gx,(0,t.toDisplayString)(e.meta),1)]),(0,t.createElementVNode)(`div`,_x,[(0,t.createElementVNode)(`button`,{class:`icon-btn layer-zoom`,type:`button`,title:`缩放到当前图层`,onClick:t=>kt(e)},`🔍`,8,vx),(0,t.createElementVNode)(`button`,{class:`icon-btn layer-delete`,type:`button`,title:`删除图层`,onClick:t=>Nt(e)},`🗑`,8,yx),(0,t.createElementVNode)(`button`,{class:`icon-btn layer-toggle`,type:`button`,title:e.visible?`隐藏图层`:`显示图层`,onClick:t=>wt(e)},(0,t.toDisplayString)(e.visible?`👁️`:`🚫`),9,bx)])],2)):((0,t.openBlock)(),(0,t.createElementBlock)(`li`,{key:e.name,class:(0,t.normalizeClass)([`layer-item layer-group`,{"hidden-layer":!e.visible}])},[(0,t.createElementVNode)(`div`,xx,[(0,t.createElementVNode)(`span`,{class:`layer-name`,title:e.name},(0,t.toDisplayString)(e.name),9,Sx),(0,t.createElementVNode)(`span`,Cx,(0,t.toDisplayString)(e.meta),1)]),(0,t.createElementVNode)(`div`,wx,[(0,t.createElementVNode)(`button`,{class:`icon-btn layer-zoom`,type:`button`,title:`缩放到图层组`,onClick:t=>At(e)},`🔍`,8,Tx),(0,t.createElementVNode)(`button`,{class:`icon-btn layer-delete`,type:`button`,title:`删除图层组`,onClick:t=>Pt(e)},`🗑`,8,Ex),(0,t.createElementVNode)(`button`,{class:`icon-btn layer-fold`,type:`button`,title:e.collapsed?`展开图层组`:`折叠图层组`,onClick:t=>Tt(e)},(0,t.toDisplayString)(e.collapsed?`▸`:`▾`),9,Dx),(0,t.createElementVNode)(`button`,{class:`icon-btn layer-toggle`,type:`button`,title:e.visible?`隐藏图层组`:`显示图层组`,onClick:t=>Et(e)},(0,t.toDisplayString)(e.visible?`👁️`:`🚫`),9,Ox)])],2)),e.type===`group`&&!e.collapsed?((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,{key:2},(0,t.renderList)(e.children,n=>((0,t.openBlock)(),(0,t.createElementBlock)(`li`,{key:n.key,class:(0,t.normalizeClass)([`layer-item layer-child`,{"hidden-layer":!n.visible}])},[(0,t.createElementVNode)(`div`,kx,[(0,t.createElementVNode)(`span`,{class:`layer-name`,title:n.name},(0,t.toDisplayString)(n.name),9,Ax),(0,t.createElementVNode)(`span`,jx,(0,t.toDisplayString)(n.meta),1)]),(0,t.createElementVNode)(`div`,Mx,[(0,t.createElementVNode)(`button`,{class:`icon-btn layer-zoom`,type:`button`,title:`缩放到当前图层`,onClick:e=>kt(n)},`🔍`,8,Nx),(0,t.createElementVNode)(`button`,{class:`icon-btn layer-delete`,type:`button`,title:`删除图层`,onClick:e=>Nt(n)},`🗑`,8,Px),(0,t.createElementVNode)(`button`,{class:`icon-btn layer-toggle`,type:`button`,title:n.visible?`隐藏图层`:`显示图层`,onClick:t=>Dt(e,n)},(0,t.toDisplayString)(n.visible?`👁️`:`🚫`),9,Fx)])],2))),128)):(0,t.createCommentVNode)(``,!0)],64))),256))])],512),[[t.vShow,T.value]])])]),(0,t.withDirectives)((0,t.createElementVNode)(`div`,{class:`sidebar-resizer`,title:`拖动调整侧栏宽度`,onMousedown:Je},null,544),[[t.vShow,!m.value]]),(0,t.createElementVNode)(`button`,{id:`sidebar-open`,title:`展开面板`,type:`button`,ref_key:`sidebarOpen`,ref:Fe,onClick:Xe},`›`,512),(0,t.createElementVNode)(`button`,{id:`panel-right-open`,title:`展开面板`,type:`button`,ref_key:`panelRightOpen`,ref:Ne,onClick:Qe},`‹`,512),n[56]||=(0,t.createElementVNode)(`main`,{id:`map`},null,-1),(0,t.withDirectives)((0,t.createElementVNode)(`div`,Ix,[...n[29]||=[(0,t.createElementVNode)(`span`,{class:`map-loading-spinner`},null,-1),(0,t.createElementVNode)(`span`,{class:`map-loading-text`},`地图加载中...`,-1)]],512),[[t.vShow,We.value]]),(0,t.createElementVNode)(`div`,{id:`load-dialog`,class:(0,t.normalizeClass)([`dialog-overlay`,{show:p.value}])},[(0,t.createElementVNode)(`div`,Lx,[(0,t.createElementVNode)(`header`,Rx,[n[30]||=(0,t.createElementVNode)(`div`,{class:`brand`},[(0,t.createElementVNode)(`span`,{class:`logo`},`📥`),(0,t.createElementVNode)(`div`,null,[(0,t.createElementVNode)(`h1`,null,`加载地图`),(0,t.createElementVNode)(`p`,null,`选择数据源并加载`)])],-1),(0,t.createElementVNode)(`button`,{id:`btn-dialog-close`,title:`关闭`,type:`button`,ref_key:`btnDialogClose`,ref:xe,onClick:er},`✕`,512)]),(0,t.createElementVNode)(`div`,{ref_key:`dialogBody`,ref:Ee,class:`dialog-body`},[(0,t.createElementVNode)(`section`,zx,[n[51]||=(0,t.createElementVNode)(`h2`,null,`数据类型`,-1),(0,t.createElementVNode)(`div`,{class:`tabs source-type-tabs`,id:`source-type-tabs`,ref_key:`sourceTypeTabs`,ref:L},[(0,t.createElementVNode)(`button`,{class:(0,t.normalizeClass)([`tab-btn source-type-btn`,{active:d.value===`raster`}]),type:`button`,onClick:n[1]||=e=>Zn(`raster`)},`栅格`,2),(0,t.createElementVNode)(`button`,{class:(0,t.normalizeClass)([`tab-btn source-type-btn`,{active:d.value===`vector`}]),type:`button`,onClick:n[2]||=e=>Zn(`vector`)},`矢量`,2)],512),n[52]||=(0,t.createElementVNode)(`h2`,null,`数据源`,-1),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`tab-pane`,{active:f.value===`image`}]),id:`tab-image`},[(0,t.createElementVNode)(`label`,Bx,[n[31]||=(0,t.createTextVNode)(` 选择 PNG / JPG 图片 `,-1),(0,t.createElementVNode)(`input`,{type:`file`,id:`img-file`,accept:`.png,.jpg,.jpeg,.webp,image/png,image/jpeg,image/webp`,hidden:``,ref_key:`imgFile`,ref:I},null,512)]),(0,t.createElementVNode)(`div`,Vx,(0,t.toDisplayString)(j.value.imgFileName),1),(0,t.createElementVNode)(`label`,Hx,[n[32]||=(0,t.createTextVNode)(` 坐标信息文件(可选 .pgw / .wld) `,-1),(0,t.createElementVNode)(`input`,{type:`file`,id:`world-file`,accept:`.pgw,.pwg,.jgw,.gfw,.wld,.pngw,.jpgw,.txt`,hidden:``,ref_key:`worldFile`,ref:Ue},null,512)]),(0,t.createElementVNode)(`div`,Ux,(0,t.toDisplayString)(j.value.worldFileName),1),(0,t.createElementVNode)(`div`,Wx,[(0,t.createElementVNode)(`label`,null,[n[33]||=(0,t.createTextVNode)(`X 最小(西)`,-1),(0,t.createElementVNode)(`input`,{type:`number`,id:`ext-minx`,step:`any`,placeholder:`必填`,ref_key:`extMinx`,ref:ke},null,512)]),(0,t.createElementVNode)(`label`,null,[n[34]||=(0,t.createTextVNode)(`Y 最小(南)`,-1),(0,t.createElementVNode)(`input`,{type:`number`,id:`ext-miny`,step:`any`,placeholder:`必填`,ref_key:`extMiny`,ref:Ae},null,512)]),(0,t.createElementVNode)(`label`,null,[n[35]||=(0,t.createTextVNode)(`X 最大(东)`,-1),(0,t.createElementVNode)(`input`,{type:`number`,id:`ext-maxx`,step:`any`,placeholder:`必填`,ref_key:`extMaxx`,ref:De},null,512)]),(0,t.createElementVNode)(`label`,null,[n[36]||=(0,t.createTextVNode)(`Y 最大(北)`,-1),(0,t.createElementVNode)(`input`,{type:`number`,id:`ext-maxy`,step:`any`,placeholder:`必填`,ref_key:`extMaxy`,ref:Oe},null,512)])]),(0,t.createElementVNode)(`div`,Gx,[j.value.zoneHint.message?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Kx,(0,t.toDisplayString)(j.value.zoneHint.message),1)):(0,t.createCommentVNode)(``,!0),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(j.value.zoneHint.options,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:e.code,class:`chip`,type:`button`,onClick:t=>j.value.dataCrs=e.code},(0,t.toDisplayString)(e.label),9,qx))),128))]),n[37]||=(0,t.createElementVNode)(`p`,{class:`tip`},`范围必填:四至范围需填写完整,选择坐标信息文件后可自动计算填充。`,-1)],2),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`tab-pane`,{active:f.value===`tiles`}]),id:`tab-tiles`},[(0,t.createElementVNode)(`label`,Jx,[n[38]||=(0,t.createTextVNode)(` 选择切片XYZ目录(z/x/y 结构) `,-1),(0,t.createElementVNode)(`input`,{type:`file`,id:`tiles-dir`,webkitdirectory:``,directory:``,multiple:``,hidden:``,ref_key:`tilesDir`,ref:Re},null,512)]),(0,t.createElementVNode)(`div`,Yx,(0,t.toDisplayString)(j.value.tilesDirName),1),(0,t.createElementVNode)(`label`,Xx,[(0,t.withDirectives)((0,t.createElementVNode)(`input`,{type:`checkbox`,id:`tiles-tms`,"onUpdate:modelValue":n[3]||=e=>j.value.tilesTms=e,onChange:n[4]||=e=>fn()},null,544),[[t.vModelCheckbox,j.value.tilesTms]]),n[39]||=(0,t.createTextVNode)(` TMS 顺序(Y 轴从下往上)`,-1)]),(0,t.createElementVNode)(`div`,Zx,(0,t.toDisplayString)(j.value.tilesInfo),1),n[40]||=(0,t.createElementVNode)(`p`,{class:`tip`},`大多数切片XYZ使用 EPSG:3857(网络墨卡托)网格。`,-1)],2),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`tab-pane`,{active:f.value===`geojson`}]),id:`tab-geojson`},[(0,t.createElementVNode)(`label`,Qx,[n[41]||=(0,t.createTextVNode)(` 选择 GeoJSON + SLD 目录(同名配对) `,-1),(0,t.createElementVNode)(`input`,{type:`file`,id:`geojson-dir`,webkitdirectory:``,directory:``,multiple:``,hidden:``,ref_key:`geojsonDir`,ref:je},null,512)]),(0,t.createElementVNode)(`div`,$x,(0,t.toDisplayString)(j.value.geojsonDirName),1),(0,t.createElementVNode)(`div`,eS,[j.value.geojsonCrsHint?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,tS,(0,t.toDisplayString)(j.value.geojsonCrsHint),1)):(0,t.createCommentVNode)(``,!0),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(j.value.geojsonCrsOptions,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:e.code,class:`chip`,type:`button`,onClick:t=>j.value.dataCrs=e.code},(0,t.toDisplayString)(e.label),9,nS))),128))]),(0,t.createElementVNode)(`div`,rS,(0,t.toDisplayString)(j.value.geojsonInfo),1)],2),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`tab-pane`,{active:f.value===`url`}]),id:`tab-url`},[(0,t.createElementVNode)(`label`,null,[n[42]||=(0,t.createTextVNode)(`在线切片XYZ URL 模板 `,-1),(0,t.withDirectives)((0,t.createElementVNode)(`input`,{type:`text`,id:`url-template`,placeholder:`https://example.com/tiles/{z}/{x}/{y}.png`,spellcheck:`false`,"onUpdate:modelValue":n[5]||=e=>j.value.urlTemplate=e,onChange:mn},null,544),[[t.vModelText,j.value.urlTemplate]])]),(0,t.createElementVNode)(`div`,iS,[(0,t.createElementVNode)(`label`,null,[n[43]||=(0,t.createTextVNode)(`最小层级`,-1),(0,t.withDirectives)((0,t.createElementVNode)(`input`,{type:`number`,id:`url-minzoom`,min:`0`,max:`24`,placeholder:`必填`,"onUpdate:modelValue":n[6]||=e=>j.value.urlMinzoom=e},null,512),[[t.vModelText,j.value.urlMinzoom]])]),(0,t.createElementVNode)(`label`,null,[n[44]||=(0,t.createTextVNode)(`最大层级`,-1),(0,t.withDirectives)((0,t.createElementVNode)(`input`,{type:`number`,id:`url-maxzoom`,min:`0`,max:`24`,placeholder:`必填`,"onUpdate:modelValue":n[7]||=e=>j.value.urlMaxzoom=e},null,512),[[t.vModelText,j.value.urlMaxzoom]])])]),(0,t.createElementVNode)(`label`,null,[n[45]||=(0,t.createTextVNode)(`范围`,-1),(0,t.withDirectives)((0,t.createElementVNode)(`select`,{id:`url-extent-crs`,"onUpdate:modelValue":n[8]||=e=>j.value.urlExtentCrs=e},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(A.value.urlExtentCrs,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`optgroup`,{key:e.label,label:e.label},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.items,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`option`,{key:e.code,value:e.code},(0,t.toDisplayString)(e.name),9,oS))),128))],8,aS))),128)),ee.value.length?((0,t.openBlock)(),(0,t.createElementBlock)(`optgroup`,sS,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(ee.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`option`,{key:e.code,value:e.code},(0,t.toDisplayString)(e.name),9,cS))),128))])):(0,t.createCommentVNode)(``,!0)],512),[[t.vModelSelect,j.value.urlExtentCrs]])]),(0,t.createElementVNode)(`div`,lS,[(0,t.createElementVNode)(`label`,null,[n[46]||=(0,t.createTextVNode)(`X 最小(西)`,-1),(0,t.createElementVNode)(`input`,{type:`number`,id:`url-ext-minx`,step:`any`,placeholder:`必填`,ref_key:`urlExtMinx`,ref:Ve},null,512)]),(0,t.createElementVNode)(`label`,null,[n[47]||=(0,t.createTextVNode)(`Y 最小(南)`,-1),(0,t.createElementVNode)(`input`,{type:`number`,id:`url-ext-miny`,step:`any`,placeholder:`必填`,ref_key:`urlExtMiny`,ref:He},null,512)]),(0,t.createElementVNode)(`label`,null,[n[48]||=(0,t.createTextVNode)(`X 最大(东)`,-1),(0,t.createElementVNode)(`input`,{type:`number`,id:`url-ext-maxx`,step:`any`,placeholder:`必填`,ref_key:`urlExtMaxx`,ref:ze},null,512)]),(0,t.createElementVNode)(`label`,null,[n[49]||=(0,t.createTextVNode)(`Y 最大(北)`,-1),(0,t.createElementVNode)(`input`,{type:`number`,id:`url-ext-maxy`,step:`any`,placeholder:`必填`,ref_key:`urlExtMaxy`,ref:Be},null,512)])]),(0,t.createElementVNode)(`div`,uS,(0,t.toDisplayString)(j.value.urlInfo),1),n[50]||=(0,t.createElementVNode)(`p`,{class:`tip`},`必须为完整 http(s) URL,模板变量 {z} {x} {y},TMS 用 {-y}。`,-1)],2)]),(0,t.createElementVNode)(`section`,dS,[n[54]||=(0,t.createElementVNode)(`h2`,null,`数据坐标系`,-1),(0,t.withDirectives)((0,t.createElementVNode)(`select`,{id:`data-crs`,"onUpdate:modelValue":n[9]||=e=>j.value.dataCrs=e,onChange:n[10]||=e=>fn()},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(A.value.dataCrs,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`optgroup`,{key:e.label,label:e.label},[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.items,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`option`,{key:e.code,value:e.code},(0,t.toDisplayString)(e.name),9,pS))),128))],8,fS))),128)),ee.value.length?((0,t.openBlock)(),(0,t.createElementBlock)(`optgroup`,mS,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(ee.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`option`,{key:e.code,value:e.code},(0,t.toDisplayString)(e.name),9,hS))),128))])):(0,t.createCommentVNode)(``,!0)],544),[[t.vModelSelect,j.value.dataCrs]]),(0,t.createElementVNode)(`div`,gS,[(0,t.createElementVNode)(`div`,_S,[(0,t.createElementVNode)(`input`,{type:`number`,id:`custom-epsg`,min:`1`,step:`1`,placeholder:`EPSG 代码,如 4525`,ref_key:`customEpsg`,ref:Te},null,512),(0,t.createElementVNode)(`button`,{id:`btn-fetch-epsg`,class:`mini-btn`,type:`button`,ref_key:`btnFetchEpsg`,ref:Se,onClick:Jn},`在线获取`,512)]),n[53]||=(0,t.createElementVNode)(`p`,{class:`tip`},`在线获取来自 epsg.io,需要联网。`,-1)])]),(0,t.createElementVNode)(`button`,{id:`btn-load`,class:`primary-btn`,type:`button`,ref_key:`btnLoad`,ref:Ce,onClick:et},`加载到地图`,512)],512)])],2),(0,t.createElementVNode)(`footer`,vS,[(0,t.createElementVNode)(`span`,{id:`status-coords`,class:`status-seg`,ref_key:`statusCoords`,ref:Ie},null,512),(0,t.createElementVNode)(`span`,{id:`status-scale`,class:`status-seg`,ref_key:`statusScale`,ref:Le},null,512),(0,t.createElementVNode)(`span`,yS,(0,t.toDisplayString)(y.value),1)]),(0,t.withDirectives)((0,t.createElementVNode)(`div`,bS,[...n[55]||=[(0,t.createElementVNode)(`div`,null,`松开鼠标,加载地图文件`,-1)]],512),[[t.vShow,u.value]]),(0,t.withDirectives)((0,t.createElementVNode)(`div`,{id:`toast`,"data-type":x.value},(0,t.toDisplayString)(b.value),9,xS),[[t.vShow,S.value]])],6))}}),CS=[SS];e.MapViewVue3=SS,e.default={install:e=>{CS.forEach(t=>{e.component(t.name,t)})}}});