mirror of
https://github.com/searxng/searxng.git
synced 2025-11-01 02:57:06 -04:00
* [upd] web-client (simple): Bump the minor group across 1 directory with 6 updates Bumps the minor group with 6 updates in the /client/simple directory: | Package | From | To | | --- | --- | --- | | [@biomejs/biome](https://github.com/biomejs/biome/tree/HEAD/packages/@biomejs/biome) | `2.1.3` | `2.2.0` | | [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) | `24.2.0` | `24.3.0` | | [browserslist](https://github.com/browserslist/browserslist) | `4.25.1` | `4.25.2` | | [edge.js](https://github.com/edge-js/edge) | `6.2.1` | `6.3.0` | | [stylelint](https://github.com/stylelint/stylelint) | `16.23.0` | `16.23.1` | | [vite-bundle-analyzer](https://github.com/nonzzz/vite-bundle-analyzer) | `1.1.0` | `1.2.1` | Updates `@biomejs/biome` from 2.1.3 to 2.2.0 - [Release notes](https://github.com/biomejs/biome/releases) - [Changelog](https://github.com/biomejs/biome/blob/main/packages/@biomejs/biome/CHANGELOG.md) - [Commits](https://github.com/biomejs/biome/commits/@biomejs/biome@2.2.0/packages/@biomejs/biome) Updates `@types/node` from 24.2.0 to 24.3.0 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) Updates `browserslist` from 4.25.1 to 4.25.2 - [Release notes](https://github.com/browserslist/browserslist/releases) - [Changelog](https://github.com/browserslist/browserslist/blob/main/CHANGELOG.md) - [Commits](https://github.com/browserslist/browserslist/compare/4.25.1...4.25.2) Updates `edge.js` from 6.2.1 to 6.3.0 - [Release notes](https://github.com/edge-js/edge/releases) - [Changelog](https://github.com/edge-js/edge/blob/6.x/CHANGELOG.md) - [Commits](https://github.com/edge-js/edge/compare/v6.2.1...v6.3.0) Updates `stylelint` from 16.23.0 to 16.23.1 - [Release notes](https://github.com/stylelint/stylelint/releases) - [Changelog](https://github.com/stylelint/stylelint/blob/main/CHANGELOG.md) - [Commits](https://github.com/stylelint/stylelint/compare/16.23.0...16.23.1) Updates `vite-bundle-analyzer` from 1.1.0 to 1.2.1 - [Release notes](https://github.com/nonzzz/vite-bundle-analyzer/releases) - [Changelog](https://github.com/nonzzz/vite-bundle-analyzer/blob/master/CHANGELOG.md) - [Commits](https://github.com/nonzzz/vite-bundle-analyzer/compare/v1.1.0...v1.2.1) --- updated-dependencies: - dependency-name: "@biomejs/biome" dependency-version: 2.2.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: minor - dependency-name: "@types/node" dependency-version: 24.3.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: minor - dependency-name: browserslist dependency-version: 4.25.2 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: minor - dependency-name: edge.js dependency-version: 6.3.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: minor - dependency-name: stylelint dependency-version: 16.23.1 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: minor - dependency-name: vite-bundle-analyzer dependency-version: 1.2.1 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: minor ... Signed-off-by: dependabot[bot] <support@github.com> * [fix] themes/simple: recreate lock * [fix] themes/simple: promote from nursery - noAwaitInLoop - noBitwiseOperators - noConstantBinaryExpression - noGlobalDirnameFilename - noImplicitCoercion - noUnassignedVariables - noUselessBackrefInRegex - noUselessEscapeInString - useAdjacentGetterSetter - useConsistentObjectDefinition - useConsistentResponse - useIndexOf - useIterableCallbackReturn - useJsonImportAttribute - useNumericSeparators - useObjectSpread - useParseIntRadix - useReadonlyClassProperties - useSingleJsDocAsterisk - useUnifiedTypeSignature * [fix] themes/simple: build static --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ivan Gabaldon <igabaldon@inetol.net>
8 lines
308 KiB
JavaScript
8 lines
308 KiB
JavaScript
var e={ADD:`add`,REMOVE:`remove`},t={PROPERTYCHANGE:`propertychange`},n={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`,LOAD:`load`,RESIZE:`resize`,TOUCHMOVE:`touchmove`,WHEEL:`wheel`},r=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}};function i(e,t,n){let r,i;n||=a;let o=0,s=e.length,c=!1;for(;o<s;)r=o+(s-o>>1),i=+n(e[r],t),i<0?o=r+1:(s=r,c=!i);return c?o:~o}function a(e,t){return e>t?1:e<t?-1:0}function o(e,t){return e<t?1:e>t?-1:0}function s(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 c(e,t,n){for(;t<n;){let r=e[t];e[t]=e[n],e[n]=r,++t,--n}}function l(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 u(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 d(e,t,n){let r=t||a;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 f(){return!0}function p(){return!1}function m(){}function h(e){let t,n,r;return function(){let i=Array.prototype.slice.call(arguments);return(!n||this!==r||!u(i,n))&&(r=this,n=i,t=e.apply(this,arguments)),t}}function g(e){function t(){let t;try{t=e()}catch(e){return Promise.reject(e)}return t instanceof Promise?t:Promise.resolve(t)}return t()}function _(e){for(let t in e)delete e[t]}function v(e){let t;for(t in e)return!1;return!t}var y=class{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}},b=class extends r{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 y(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,m);delete a[n]}return s}disposeInternal(){this.listeners_&&_(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]=m,++this.pendingRemovals_[e]):(n.splice(r,1),n.length===0&&delete this.listeners_[e]))}};function x(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 x(e,t,n,r,!0)}function C(e){e&&e.target&&(e.target.removeEventListener(e.type,e.listener),_(e))}var w=class extends b{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(n.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]=x(this,e[i],t);return r}return x(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)T(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)}};w.prototype.on,w.prototype.once,w.prototype.un;function T(e){if(Array.isArray(e))for(let t=0,n=e.length;t<n;++t)C(e[t]);else C(e)}function E(){throw Error(`Unimplemented abstract method.`)}let D=0;function O(e){return e.ol_uid||=String(++D)}var k=class extends y{constructor(e,t,n){super(e),this.key=t,this.oldValue=n}},A=class extends w{constructor(e){super(),this.on,this.once,this.un,O(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,n){let r;r=`change:${e}`,this.hasListener(r)&&this.dispatchEvent(new k(r,e,n)),r=t.PROPERTYCHANGE,this.hasListener(r)&&this.dispatchEvent(new k(r,e,n))}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],v(this.values_)&&(this.values_=null),t||this.notify(e,n)}}};const ee={LENGTH:`length`};var j=class extends y{constructor(e,t,n){super(e),this.element=t,this.index=n}},M=class extends A{constructor(e,t){if(super(),this.on,this.once,this.un,t||={},this.unique_=!!t.unique,this.array_=e||[],this.unique_)for(let e=0,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(ee.LENGTH)}insertAt(t,n){if(t<0||t>this.getLength())throw Error(`Index out of bounds: `+t);this.unique_&&this.assertUnique_(n),this.array_.splice(t,0,n),this.updateLength_(),this.dispatchEvent(new j(e.ADD,n,t))}pop(){return this.removeAt(this.getLength()-1)}push(e){this.unique_&&this.assertUnique_(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(t){if(t<0||t>=this.getLength())return;let n=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new j(e.REMOVE,n,t)),n}setAt(t,n){let r=this.getLength();if(t>=r){this.insertAt(t,n);return}if(t<0)throw Error(`Index out of bounds: `+t);this.unique_&&this.assertUnique_(n,t);let i=this.array_[t];this.array_[t]=n,this.dispatchEvent(new j(e.REMOVE,i,t)),this.dispatchEvent(new j(e.ADD,n,t))}updateLength_(){this.set(ee.LENGTH,this.array_.length)}assertUnique_(e,t){for(let n=0,r=this.array_.length;n<r;++n)if(this.array_[n]===e&&n!==t)throw Error(`Duplicate item added to a unique collection`)}};function N(e,t){if(!e)throw Error(t)}var te=class e extends A{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(this.hasProperties()?this.getProperties():null);t.setGeometryName(this.getGeometryName());let n=this.getGeometry();n&&t.setGeometry(n.clone());let r=this.getStyle();return r&&t.setStyle(r),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_=x(e,n.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(e){this.set(this.geometryName_,e)}setStyle(e){this.style_=e,this.styleFunction_=e?ne(e):void 0,this.changed()}setId(e){this.id_=e,this.changed()}setGeometryName(e){this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=e,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_()}};function ne(e){if(typeof e==`function`)return e;let t;if(Array.isArray(e))t=e;else{N(typeof e.getZIndex==`function`,"Expected an `ol/style/Style` or an array of `ol/style/Style.js`");let n=e;t=[n]}return function(){return t}}var P={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function re(e){let t=de();for(let n=0,r=e.length;n<r;++n)ve(t,e[n]);return t}function ie(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 ae(e,t){return t?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):e.slice()}function oe(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 se(e,t){return le(e,t[0],t[1])}function ce(e,t){return e[0]<=t[0]&&t[2]<=e[2]&&e[1]<=t[1]&&t[3]<=e[3]}function le(e,t,n){return e[0]<=t&&t<=e[2]&&e[1]<=n&&n<=e[3]}function ue(e,t){let n=e[0],r=e[1],i=e[2],a=e[3],o=t[0],s=t[1],c=P.UNKNOWN;return o<n?c|=P.LEFT:o>i&&(c|=P.RIGHT),s<r?c|=P.BELOW:s>a&&(c|=P.ABOVE),c===P.UNKNOWN&&(c=P.INTERSECTING),c}function de(){return[1/0,1/0,-1/0,-1/0]}function fe(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 pe(e){return fe(1/0,1/0,-1/0,-1/0,e)}function me(e,t){let n=e[0],r=e[1];return fe(n,r,n,r,t)}function he(e,t,n,r,i){let a=pe(i);return ye(a,e,t,n,r)}function ge(e,t){return e[0]==t[0]&&e[2]==t[2]&&e[1]==t[1]&&e[3]==t[3]}function _e(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 ve(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 ye(e,t,n,r,i){for(;n<r;n+=i)be(e,t[n],t[n+1]);return e}function be(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 xe(e,t){let n;return n=t(Ce(e)),n||(n=t(we(e)),n)||(n=t(je(e)),n)||(n=t(Ae(e)),n)?n:!1}function Se(e){let t=0;return Ne(e)||(t=I(e)*F(e)),t}function Ce(e){return[e[0],e[1]]}function we(e){return[e[2],e[1]]}function Te(e){return[(e[0]+e[2])/2,(e[1]+e[3])/2]}function Ee(e,t){let n;if(t===`bottom-left`)n=Ce(e);else if(t===`bottom-right`)n=we(e);else if(t===`top-left`)n=Ae(e);else if(t===`top-right`)n=je(e);else throw Error(`Invalid corner`);return n}function De(e,t,n,r,i){let[a,o,s,c,l,u,d,f]=Oe(e,t,n,r);return fe(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 Oe(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 F(e){return e[3]-e[1]}function ke(e,t,n){let r=n||de();return Me(e,t)?(e[0]>t[0]?r[0]=e[0]:r[0]=t[0],e[1]>t[1]?r[1]=e[1]:r[1]=t[1],e[2]<t[2]?r[2]=e[2]:r[2]=t[2],e[3]<t[3]?r[3]=e[3]:r[3]=t[3]):pe(r),r}function Ae(e){return[e[0],e[3]]}function je(e){return[e[2],e[3]]}function I(e){return e[2]-e[0]}function Me(e,t){return e[0]<=t[2]&&e[2]>=t[0]&&e[1]<=t[3]&&e[3]>=t[1]}function Ne(e){return e[2]<e[0]||e[3]<e[1]}function Pe(e,t){return t?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):e}function Fe(e,t,n){let r=!1,i=ue(e,t),a=ue(e,n);if(i===P.INTERSECTING||a===P.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&P.ABOVE&&!(i&P.ABOVE)&&(h=f-(p-l)/m,r=h>=o&&h<=c),!r&&a&P.RIGHT&&!(i&P.RIGHT)&&(g=p-(f-c)*m,r=g>=s&&g<=l),!r&&a&P.BELOW&&!(i&P.BELOW)&&(h=f-(p-s)/m,r=h>=o&&h<=c),!r&&a&P.LEFT&&!(i&P.LEFT)&&(g=p-(f-o)*m,r=g>=s&&g<=l)}return r}function Ie(e,t){let n=t.getExtent(),r=Te(e);if(t.canWrapX()&&(r[0]<n[0]||r[0]>=n[2])){let t=I(n),i=Math.floor((r[0]-n[0])/t),a=i*t;e[0]-=a,e[2]-=a}return e}function Le(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]]];Ie(e,t);let i=I(r);if(I(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 L(e,t,n){return Math.min(Math.max(e,t),n)}function Re(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 ze(e,t,n,r)}function ze(e,t,n,r){let i=n-e,a=r-t;return i*i+a*a}function Be(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 Ve(e){return e*180/Math.PI}function He(e){return e*Math.PI/180}function Ue(e,t){let n=e%t;return n*t<0?n+t:n}function We(e,t,n){return e+n*(t-e)}function Ge(e,t){let n=10**t;return Math.round(e*n)/n}function Ke(e,t){return Math.floor(Ge(e,t))}function qe(e,t){return Math.ceil(Ge(e,t))}function Je(e,t,n){if(e>=t&&e<n)return e;let r=n-t;return((e-t)%r+r)%r+t}function Ye(e,t,n){n||=6371008.8;let r=He(e[1]),i=He(t[1]),a=(i-r)/2,o=He(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))}const Xe={info:1,warn:2,error:3,none:4};let Ze=Xe.info;function Qe(...e){Ze>Xe.warn||console.warn(...e)}function $e(e,t){return e[0]+=+t[0],e[1]+=+t[1],e}function et(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 tt(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 nt(e,t){return e[0]*=t,e[1]*=t,e}function rt(e,t){if(t.canWrapX()){let n=I(t.getExtent()),r=it(e,t,n);r&&(e[0]-=r*n)}return e}function it(e,t,n){let r=t.getExtent(),i=0;return t.canWrapX()&&(e[0]<r[0]||e[0]>r[2])&&(n||=I(r),i=Math.floor((e[0]-r[0])/n)),i}const at={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};var ot=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?!1: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_||at[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_}};const st=6378137,ct=Math.PI*st,lt=[-ct,-ct,ct,ct],ut=[-180,-85,180,85],dt=st*Math.log(Math.tan(Math.PI/2));var ft=class extends ot{constructor(e){super({code:e,units:`m`,extent:lt,global:!0,worldExtent:ut,getPointResolution:function(e,t){return e/Math.cosh(t[1]/st)}})}};const pt=[new ft(`EPSG:3857`),new ft(`EPSG:102100`),new ft(`EPSG:102113`),new ft(`EPSG:900913`),new ft(`http://www.opengis.net/def/crs/EPSG/0/3857`),new ft(`http://www.opengis.net/gml/srs/epsg.xml#3857`)];function mt(e,t,n,r){let i=e.length;n=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]=ct*e[n]/180;let r=st*Math.log(Math.tan(Math.PI*(+e[n+1]+90)/360));r>dt?r=dt:r<-dt&&(r=-dt),t[n+1]=r}return t}function ht(e,t,n,r){let i=e.length;n=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]/ct,t[n+1]=360*Math.atan(Math.exp(e[n+1]/st))/Math.PI-90;return t}const gt=[-180,-90,180,90],_t=Math.PI*6378137/180;var vt=class extends ot{constructor(e,t){super({code:e,units:`degrees`,extent:gt,axisOrientation:t,global:!0,metersPerUnit:_t,worldExtent:gt})}};const yt=[new vt(`CRS:84`),new vt(`EPSG:4326`,`neu`),new vt(`urn:ogc:def:crs:OGC:1.3:CRS84`),new vt(`urn:ogc:def:crs:OGC:2:84`),new vt(`http://www.opengis.net/def/crs/OGC/1.3/CRS84`),new vt(`http://www.opengis.net/gml/srs/epsg.xml#4326`,`neu`),new vt(`http://www.opengis.net/def/crs/EPSG/0/4326`,`neu`)];let bt={};function xt(e){return bt[e]||bt[e.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,`EPSG:$3`)]||null}function St(e,t){bt[e]=t}let Ct={};function wt(e,t,n){let r=e.getCode(),i=t.getCode();r in Ct||(Ct[r]={}),Ct[r][i]=n}function Tt(e,t){return e in Ct&&t in Ct[e]?Ct[e][t]:null}const Et=.9996,Dt=.00669438,Ot=Dt*Dt,kt=Ot*Dt,At=Dt/(1-Dt),jt=Math.sqrt(1-Dt),Mt=(1-jt)/(1+jt),Nt=Mt*Mt,Pt=Nt*Mt,Ft=Pt*Mt,It=Ft*Mt,Lt=1-Dt/4-3*Ot/64-5*kt/256;3*Dt/8+3*Ot/32+45*kt/1024,15*Ot/256+45*kt/1024,35*kt/3072;const Rt=3/2*Mt-27/32*Pt+269/512*It,zt=21/16*Nt-55/32*Ft,Bt=151/96*Pt-417/128*It,Vt=1097/512*Ft,Ht=6378137;function Ut(e,t,n){let r=e-5e5,i=n.north?t:t-1e7,a=i/Et,o=a/(Ht*Lt),s=o+Rt*Math.sin(2*o)+zt*Math.sin(4*o)+Bt*Math.sin(6*o)+Vt*Math.sin(8*o),c=Math.sin(s),l=c*c,u=Math.cos(s),d=c/u,f=d*d,p=f*f,m=1-Dt*l,h=Math.sqrt(1-Dt*l),g=Ht/h,_=(1-Dt)/m,v=At*u**2,y=v*v,b=r/(g*Et),x=b*b,S=x*b,C=S*b,w=C*b,T=w*b,E=s-d/_*(x/2-C/24*(5+3*f+10*v-4*y-9*At))+T/720*(61+90*f+298*v+45*p-252*At-3*y),D=(b-S/6*(1+2*f+v)+w/120*(5-2*v+28*f-3*y+8*At+24*p))/u;return D=Je(D+He(Gt(n.number)),-Math.PI,Math.PI),[Ve(D),Ve(E)]}function Wt(e,t,n){e=Je(e,-180,180),t<-80?t=-80:t>84&&(t=84);let r=He(t),i=Math.sin(r),a=Math.cos(r),o=i/a,s=o*o,c=s*s,l=He(e),u=Gt(n.number),d=He(u),f=Ht/Math.sqrt(1-Dt*i**2),p=At*a**2,m=a*Je(l-d,-Math.PI,Math.PI),h=m*m,g=h*m,_=g*m,v=_*m,y=v*m,b=Ht*(Lt*r-.002514607064228144*Math.sin(2*r)+26390466021299826e-22*Math.sin(4*r)-3.418046101696858e-9*Math.sin(6*r)),x=Et*f*(m+g/6*(1-s+p)+v/120*(5-18*s+c+72*p-58*At))+5e5,S=Et*(b+f*o*(h/2+_/24*(5-s+9*p+4*p**2)+y/720*(61-58*s+c+600*p-330*At)));return n.north||(S+=1e7),[x,S]}function Gt(e){return(e-1)*6-180+3}const Kt=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function qt(e){let t=0;for(let n of Kt){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 Jt(e,t){return function(n,r,i,a){let o=n.length;i=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 Yt(e){let t=qt(e);return t?new ot({code:e,units:`m`}):null}function Xt(e){let t=qt(e.getCode());return t?{forward:Jt(Wt,t),inverse:Jt(Ut,t)}:null}const Zt=[Xt],Qt=[Yt];let $t=!0;function en(e){let t=e===void 0?!0:e;$t=!t}function tn(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 nn(e){St(e.getCode(),e),wt(e,e,tn)}function rn(e){e.forEach(nn)}function R(e){if(typeof e!=`string`)return e;let t=xt(e);if(t)return t;for(let t of Qt){let n=t(e);if(n)return n}return null}function an(e,t,n,r){e=R(e);let i,a=e.getPointResolutionFunc();if(a){if(i=a(t,n),r&&r!==e.getUnits()){let t=e.getMetersPerUnit();t&&(i=i*t/at[r])}}else{let a=e.getUnits();if(a==`degrees`&&!r||r==`degrees`)i=t;else{let o=fn(e,R(`EPSG:4326`));if(!o&&a!==`degrees`)i=t*e.getMetersPerUnit();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];e=o(e,e,2);let r=Ye(e.slice(0,2),e.slice(2,4)),a=Ye(e.slice(4,6),e.slice(6,8));i=(r+a)/2}let s=r?at[r]:e.getMetersPerUnit();s!==void 0&&(i/=s)}}return i}function on(e){rn(e),e.forEach(function(t){e.forEach(function(e){t!==e&&wt(t,e,tn)})})}function sn(e,t,n,r){e.forEach(function(e){t.forEach(function(t){wt(e,t,n),wt(t,e,r)})})}function cn(e,t){return e?typeof e==`string`?R(e):e:R(t)}function ln(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 un(e,t){return en(),hn(e,`EPSG:4326`,t===void 0?`EPSG:3857`:t)}function dn(e,t){if(e===t)return!0;let n=e.getUnits()===t.getUnits();if(e.getCode()===t.getCode())return n;let r=fn(e,t);return r===tn&&n}function fn(e,t){let n=e.getCode(),r=t.getCode(),i=Tt(n,r);if(i)return i;let a=null,o=null;for(let n of Zt)a||=n(e),o||=n(t);if(!a&&!o)return null;let s=`EPSG:4326`;if(o)if(a)i=pn(a.inverse,o.forward);else{let e=Tt(n,s);e&&(i=pn(e,o.forward))}else{let e=Tt(s,r);e&&(i=pn(a.inverse,e))}return i&&(nn(e),nn(t),wt(e,t,i)),i}function pn(e,t){return function(n,r,i,a){return r=e(n,r,i,a),t(r,r,i,a)}}function mn(e,t){let n=R(e),r=R(t);return fn(n,r)}function hn(e,t,n){let r=mn(t,n);if(!r){let e=R(t).getCode(),r=R(n).getCode();throw Error(`No transform available between ${e} and ${r}`)}return r(e,void 0,e.length)}function gn(){return null}function _n(e,t){return e}function vn(e,t){return $t&&!et(e,[0,0])&&e[0]>=-180&&e[0]<=180&&e[1]>=-90&&e[1]<=90&&($t=!1,Qe(`Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.`)),e}function yn(e,t){return e}function bn(e,t){return e}function xn(e,t){return e}function Sn(){on(pt),on(yt),sn(yt,pt,mt,ht)}Sn();function Cn(){return[1,0,0,1,0,0]}function wn(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 z(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 Tn(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 En(e,t){let n=Dn(t);N(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 Dn(e){return e[0]*e[3]-e[1]*e[2]}const On=[1e5,1e5,1e5,1e5,2,2];function kn(e){let t=`matrix(`+e.join(`, `)+`)`;return t}function An(e){let t=e.substring(7,e.length-1).split(`,`);return t.map(parseFloat)}function jn(e,t){let n=An(e),r=An(t);for(let e=0;e<6;++e)if(Math.round((n[e]-r[e])*On[e])!==0)return!1;return!0}function Mn(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 Nn(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 Pn(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 Fn(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}const In=Cn(),Ln=[NaN,NaN];var Rn=class extends A{constructor(){super(),this.extent_=de(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=h((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 E()}closestPointXY(e,t,n,r){return E()}containsXY(e,t){return this.closestPointXY(e,t,Ln,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 E()}getExtent(e){if(this.extentRevision_!=this.getRevision()){let e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&pe(e),this.extentRevision_=this.getRevision()}return Pe(this.extent_,e)}rotate(e,t){E()}scale(e,t,n){E()}simplify(e){return this.getSimplifiedGeometry(e*e)}getSimplifiedGeometry(e){return E()}getType(){return E()}applyTransform(e){E()}intersectsExtent(e){return E()}translate(e,t){E()}transform(e,t){let n=R(e),r=n.getUnits()==`tile-pixels`?function(e,r,i){let a=n.getExtent(),o=n.getWorldExtent(),s=F(o)/F(a);Tn(In,o[0],o[3],s,-s,0,0,0);let c=Mn(e,0,e.length,i,In,r),l=mn(n,t);return l?l(c,c,i):c}:mn(n,t);return this.applyTransform(r),this}},zn=class extends Rn{constructor(){super(),this.layout=`XY`,this.stride=2,this.flatCoordinates}computeExtent(e){return he(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinates(){return E()}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),n=t.getFlatCoordinates();return n.length<this.flatCoordinates.length?t:(this.simplifiedGeometryMaxMinSquaredTolerance=e,this)}getSimplifiedGeometryInternal(e){return this}getStride(){return this.stride}setFlatCoordinates(e,t){this.stride=Vn(e),this.layout=e,this.flatCoordinates=t}setCoordinates(e,t){E()}setLayout(e,t,n){let r;if(e)r=Vn(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=Bn(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();Nn(n,0,n.length,r,e,t,n),this.changed()}}scale(e,t,n){t===void 0&&(t=e),n||=Te(this.getExtent());let r=this.getFlatCoordinates();if(r){let i=this.getStride();Pn(r,0,r.length,i,e,t,n,r),this.changed()}}translate(e,t){let n=this.getFlatCoordinates();if(n){let r=this.getStride();Fn(n,0,n.length,r,e,t,n),this.changed()}}};function Bn(e){let t;return e==2?t=`XY`:e==3?t=`XYZ`:e==4&&(t=`XYZM`),t}function Vn(e){let t;return e==`XY`?t=2:e==`XYZ`||e==`XYM`?t=3:e==`XYZM`&&(t=4),t}function Hn(e,t,n){let r=e.getFlatCoordinates();if(!r)return null;let i=e.getStride();return Mn(r,0,r.length,i,t,n)}function Un(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 Wn(e,t,n,r){let i=0;for(let a=0,o=n.length;a<o;++a){let o=n[a];i+=Un(e,t,o,r),t=o}return i}function Gn(e,t,n,r){let i=0;for(let a=0,o=n.length;a<o;++a){let o=n[a];i+=Wn(e,t,o,r),t=o[o.length-1]}return i}function Kn(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]=We(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 qn(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=ze(a,o,n,r);s>i&&(i=s),a=n,o=r}return i}function Jn(e,t,n,r,i){for(let a=0,o=n.length;a<o;++a){let o=n[a];i=qn(e,t,o,r,i),t=o}return i}function Yn(e,t,n,r,i){for(let a=0,o=n.length;a<o;++a){let o=n[a];i=Jn(e,t,o,r,i),t=o[o.length-1]}return i}function Xn(e,t,n,r,i,a,o,s,c,l,u){if(t==n)return l;let d,f;if(i===0){if(f=ze(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(Kn(e,p-r,p,r,o,s,u),f=ze(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&&(Kn(e,n-r,t,r,o,s,u),f=ze(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 Zn(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=Xn(e,t,f,r,i,a,o,s,c,l,u),t=f}return l}function Qn(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=Zn(e,t,f,r,i,a,o,s,c,l,u),t=f[f.length-1]}return l}function $n(e,t,n,r){for(let r=0,i=n.length;r<i;++r)e[t++]=n[r];return t}function er(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 tr(e,t,n,r,i){i||=[];let a=0;for(let o=0,s=n.length;o<s;++o){let s=er(e,t,n[o],r);i[a++]=s,t=s}return i.length=a,i}function nr(e,t,n,r,i){i||=[];let a=0;for(let o=0,s=n.length;o<s;++o){let s=tr(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 rr(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 ir(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++]=rr(e,t,s,r,i[a]),t=s}return i.length=a,i}function ar(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?[]:ir(e,t,s,r,i[a]),t=s[s.length-1]}return i.length=a,i}function or(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=Re(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 sr(e,t,n,r,i,a,o,s){for(let c=0,l=n.length;c<l;++c){let l=n[c];o=or(e,t,l,r,i,a,o),s.push(o),t=l}return o}function cr(e,t){return t*Math.round(e/t)}function lr(e,t,n,r,i,a,o){if(t==n)return o;let s=cr(e[t],i),c=cr(e[t+1],i);t+=r,a[o++]=s,a[o++]=c;let l,u;do if(l=cr(e[t],i),u=cr(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=cr(e[t],i),d=cr(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;if(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;continue}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=lr(e,t,l,r,i,a,o),s.push(o),t=l}return o}function dr(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 fr=class e extends zn{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<oe(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(qn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Xn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,e,t,n,r))}getArea(){return Un(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return rr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){let n=[];return n.length=or(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,n,0),new e(n,`XY`)}getType(){return`LinearRing`}intersectsExtent(e){return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||=[],this.flatCoordinates.length=er(this.flatCoordinates,0,e,this.stride),this.changed()}},pr=class e extends zn{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=ze(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 me(this.flatCoordinates,e)}getType(){return`Point`}intersectsExtent(e){return le(e,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(e,t){this.setLayout(t,e,0),this.flatCoordinates||=[],this.flatCoordinates.length=$n(this.flatCoordinates,0,e,this.stride),this.changed()}};function mr(e,t,n,r,i){let a=xe(i,function(i){return!hr(e,t,n,r,i[0],i[1])});return!a}function hr(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 gr(e,t,n,r,i,a){if(n.length===0||!hr(e,t,n[0],r,i,a))return!1;for(let t=1,o=n.length;t<o;++t)if(hr(e,n[t-1],n[t],r,i,a))return!1;return!0}function _r(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(gr(e,t,s,r,i,a))return!0;t=s[s.length-1]}return!1}function vr(e,t,n,r,i,o,s){let c,l,u,d,f,p,m,h=i[o+1],g=[];for(let i=0,a=n.length;i<a;++i){let a=n[i];for(d=e[a-r],p=e[a-r+1],c=t;c<a;c+=r)f=e[c],m=e[c+1],(h<=p&&m<=h||p<=h&&h<=m)&&(u=(h-p)/(m-p)*(f-d)+d,g.push(u)),d=f,p=m}let _=NaN,v=-1/0;for(g.sort(a),d=g[0],c=1,l=g.length;c<l;++c){f=g[c];let i=Math.abs(f-d);i>v&&(u=(d+f)/2,gr(e,t,n,r,u,h)&&(_=u,v=i)),d=f}return isNaN(_)&&(_=i[o]),s?(s.push(_,h,v),s):[_,h,v]}function yr(e,t,n,r,i){let a=[];for(let o=0,s=n.length;o<s;++o){let s=n[o];a=vr(e,t,s,r,i,2*o,a),t=s[s.length-1]}return a}function br(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 xr(e,t,n,r,i,a){return a??=ye(de(),e,t,n,r),Me(i,a)?a[0]>=i[0]&&a[2]<=i[2]||a[1]>=i[1]&&a[3]<=i[3]?!0:br(e,t,n,r,function(e,t){return Fe(i,e,t)}):!1}function Sr(e,t,n,r,i){for(let a=0,o=n.length;a<o;++a){if(xr(e,t,n[a],r,i))return!0;t=n[a]}return!1}function Cr(e,t,n,r,i){return!!(xr(e,t,n,r,i)||hr(e,t,n,r,i[0],i[1])||hr(e,t,n,r,i[0],i[3])||hr(e,t,n,r,i[2],i[1])||hr(e,t,n,r,i[2],i[3]))}function wr(e,t,n,r,i){if(!Cr(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(mr(e,n[t-1],n[t],r,i)&&!xr(e,n[t-1],n[t],r,i))return!1;return!0}function Tr(e,t,n,r,i){for(let a=0,o=n.length;a<o;++a){let o=n[a];if(wr(e,t,o,r,i))return!0;t=o[o.length-1]}return!1}function Er(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 Dr(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 Or(e,t,n,r,i){i=i===void 0?!1:i;for(let a=0,o=n.length;a<o;++a){let o=n[a],s=Dr(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 kr(e,t,n,r,i){for(let a=0,o=n.length;a<o;++a){let o=n[a];if(!Or(e,t,o,r,i))return!1;o.length&&(t=o[o.length-1])}return!0}function Ar(e,t,n,r,i){i=i===void 0?!1:i;for(let a=0,o=n.length;a<o;++a){let o=n[a],s=Dr(e,t,o,r),c=a===0?i&&s||!i&&!s:i&&!s||!i&&s;c&&Er(e,t,o,r),t=o}return t}function jr(e,t,n,r,i){for(let a=0,o=n.length;a<o;++a)t=Ar(e,t,n[a],r,i);return t}function Mr(e,t){let n=[],r=0,i=0,a;for(let o=0,s=t.length;o<s;++o){let s=t[o],c=Dr(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 Nr=class e extends zn{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?l(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<oe(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Jn(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Zn(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return gr(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,t)}getArea(){return Wn(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(e){let t;return e===void 0?t=this.flatCoordinates:(t=this.getOrientedFlatCoordinates().slice(),Ar(t,0,this.ends_,this.stride,e)),ir(t,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){let e=Te(this.getExtent());this.flatInteriorPoint_=vr(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new pr(this.getFlatInteriorPoint(),`XYM`)}getLinearRingCount(){return this.ends_.length}getLinearRing(e){return e<0||this.ends_.length<=e?null:new fr(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 fr(t.slice(i,o),e);r.push(s),i=o}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;Or(e,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=Ar(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 wr(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||=[];let n=tr(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}};function Pr(e){if(Ne(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 Nr(a,`XY`,[a.length])}function Fr(e,t,n,r,a,o,s){let c,l,u=(n-t)/r;if(u===1)c=t;else if(u===2)c=t,l=a;else if(u!==0){let o=e[t],s=e[t+1],u=0,d=[0];for(let i=t+r;i<n;i+=r){let t=e[i],n=e[i+1];u+=Math.sqrt((t-o)*(t-o)+(n-s)*(n-s)),d.push(u),o=t,s=n}let f=a*u,p=i(d,f);p<0?(l=(f-d[-p-2])/(d[-p-1]-d[-p-2]),c=t+(-p-2)*r):c=t+p*r}s=s>1?s:2,o||=Array(s);for(let t=0;t<s;++t)o[t]=c===void 0?NaN:l===void 0?e[c+t]:We(e[c+t],e[c+r+t],l);return o}function Ir(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(We(e[(s-1)*r+t],e[s*r+t],d));return o.push(i),o}function Lr(e,t,n,r,i,a,o){if(o)return Ir(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 Ir(e,t,o,r,i,!1);t=o}}return null}function Rr(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 zr=class e extends zn{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){l(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<oe(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(qn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Xn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,e,t,n,r))}forEachSegment(e){return br(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinateAtM(e,t){return this.layout!=`XYM`&&this.layout!=`XYZM`?null:(t=t===void 0?!1:t,Ir(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t))}getCoordinates(){return rr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(e,t){return Fr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,this.stride)}getLength(){return Rr(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=or(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,n,0),new e(n,`XY`)}getType(){return`LineString`}intersectsExtent(e){return xr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,this.getExtent())}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||=[],this.flatCoordinates.length=er(this.flatCoordinates,0,e,this.stride),this.changed()}},Br={PRERENDER:`prerender`,POSTRENDER:`postrender`,PRECOMPOSE:`precompose`,POSTCOMPOSE:`postcompose`,RENDERCOMPLETE:`rendercomplete`};const Vr=typeof navigator<`u`&&navigator.userAgent!==void 0?navigator.userAgent.toLowerCase():``,Hr=Vr.includes(`safari`)&&!Vr.includes(`chrom`);Hr&&(Vr.includes(`version/15.4`)||/cpu (os|iphone os) 15_4 like mac os x/.test(Vr));const Ur=Vr.includes(`webkit`)&&!Vr.includes(`edge`),Wr=Vr.includes(`macintosh`),Gr=typeof devicePixelRatio<`u`?devicePixelRatio:1,Kr=typeof WorkerGlobalScope<`u`&&typeof OffscreenCanvas<`u`&&self instanceof WorkerGlobalScope,qr=typeof Image<`u`&&Image.prototype.decode,Jr=(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})();var B={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function V(e,t,n,r){let i;return i=n&&n.length?n.shift():Kr?new OffscreenCanvas(e||300,t||300):document.createElement(`canvas`),e&&(i.width=e),t&&(i.height=t),i.getContext(`2d`,r)}let Yr;function Xr(){return Yr||=V(1,1),Yr}function Zr(e){let t=e.canvas;t.width=1,t.height=1,e.clearRect(0,0,1,1)}function Qr(e,t){let n=t.parentNode;n&&n.replaceChild(e,t)}function $r(e){for(;e.lastChild;)e.lastChild.remove()}function ei(e,t){let n=e.childNodes;for(let r=0;;++r){let i=n[r],a=t[r];if(!i&&!a)break;if(i!==a){if(!i){e.appendChild(a);continue}if(!a){e.removeChild(i),--r;continue}e.insertBefore(a,i)}}}const ti=[NaN,NaN,NaN,0];let ni;function ri(){return ni||=V(1,1,void 0,{willReadFrequently:!0,desynchronized:!0}),ni}const ii=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,ai=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,oi=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,si=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function ci(e,t){return e.endsWith(`%`)?Number(e.substring(0,e.length-1))/t:Number(e)}function li(e){throw Error(`failed to parse "`+e+`" as color`)}function ui(e){if(e.toLowerCase().startsWith(`rgb`)){let t=e.match(ai)||e.match(ii)||e.match(oi);if(t){let e=t[4],n=100/255;return[L(ci(t[1],n)+.5|0,0,255),L(ci(t[2],n)+.5|0,0,255),L(ci(t[3],n)+.5|0,0,255),e===void 0?1:L(ci(e,100),0,1)]}li(e)}if(e.startsWith(`#`)){if(si.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}li(e)}let t=ri();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&&li(e));let r=t.fillStyle;if(r.startsWith(`#`)||r.startsWith(`rgba`))return ui(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]=Ge(i[3]/255,3),i}function di(e){return typeof e==`string`?e:Ci(e)}const fi={};let pi=0;function mi(e){if(e.length===4)return e;let t=e.slice();return t[3]=1,t}function hi(e){return e>.0031308?e**(1/2.4)*269.025-14.025:e*3294.6}function gi(e){return e>.2068965?e**3:(e-4/29)*(108/841)}function _i(e){return e>10.314724?((e+14.025)/269.025)**2.4:e/3294.6}function vi(e){return e>.0088564?e**(1/3):e/(108/841)+4/29}function yi(e){let t=_i(e[0]),n=_i(e[1]),r=_i(e[2]),i=vi(t*.222488403+n*.716873169+r*.06060791),a=500*(vi(t*.452247074+n*.399439023+r*.148375274)-i),o=200*(i-vi(t*.016863605+n*.117638439+r*.865350722)),s=Math.atan2(o,a)*(180/Math.PI);return[116*i-16,Math.sqrt(a*a+o*o),s<0?s+360:s,e[3]]}function bi(e){let t=(e[0]+16)/116,n=e[1],r=e[2]*Math.PI/180,i=gi(t),a=gi(t+n/500*Math.cos(r)),o=gi(t-n/200*Math.sin(r)),s=hi(a*3.021973625-i*1.617392459-o*.404875592),c=hi(a*-.943766287+i*1.916279586+o*.027607165),l=hi(a*.069407491-i*.22898585+o*1.159737864);return[L(s+.5|0,0,255),L(c+.5|0,0,255),L(l+.5|0,0,255),e[3]]}function xi(e){if(e===`none`)return ti;if(fi.hasOwnProperty(e))return fi[e];if(pi>=1024){let e=0;for(let t in fi)e++&3||(delete fi[t],--pi)}let t=ui(e);t.length!==4&&li(e);for(let n of t)isNaN(n)&&li(e);return fi[e]=t,++pi,t}function Si(e){return Array.isArray(e)?e:xi(e)}function Ci(e){let t=e[0];t!=(t|0)&&(t=t+.5|0);let n=e[1];n!=(n|0)&&(n=n+.5|0);let r=e[2];r!=(r|0)&&(r=r+.5|0);let i=e[3]===void 0?1:Math.round(e[3]*1e3)/1e3;return`rgba(`+t+`,`+n+`,`+r+`,`+i+`)`}function wi(e,t,r){let i=e,a=!0,o=!1,s=!1,c=[S(i,n.LOAD,function(){s=!0,o||t()})];return i.src&&qr?(o=!0,i.decode().then(function(){a&&t()}).catch(function(e){a&&(s?t():r())})):c.push(S(i,n.ERROR,r)),function(){a=!1,c.forEach(C)}}function Ti(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 Ei(e,t){return t&&(e.src=t),e.src&&qr?new Promise((t,n)=>e.decode().then(()=>t(e)).catch(r=>e.complete&&e.width?t(e):n(r))):Ti(e)}var Di=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,n){let r=Oi(e,t,n);return r in this.cache_?this.cache_[r]:null}getPattern(e,t,n){let r=Oi(e,t,n);return r in this.patternCache_?this.patternCache_[r]:null}set(e,t,n,r,i){let a=Oi(e,t,n),o=a in this.cache_;this.cache_[a]=r,i&&(r.getImageState()===B.IDLE&&r.load(),r.getImageState()===B.LOADING?r.ready().then(()=>{this.patternCache_[a]=Xr().createPattern(r.getImage(1),`repeat`)}):this.patternCache_[a]=Xr().createPattern(r.getImage(1),`repeat`)),o||++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}};function Oi(e,t,n){let r=n?Si(n):`null`;return t+`:`+e+`:`+r}const ki=new Di;let Ai=null;var ji=class extends b{constructor(e,t,n,r,i){super(),this.hitDetectionImage_=null,this.image_=e,this.crossOrigin_=n,this.canvas_={},this.color_=i,this.imageState_=r===void 0?B.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_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===B.LOADED){Ai||=V(1,1,void 0,{willReadFrequently:!0}),Ai.drawImage(this.image_,0,0);try{Ai.getImageData(0,0,1,1),this.tainted_=!1}catch{Ai=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(n.CHANGE)}handleImageError_(){this.imageState_=B.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=B.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(e){return this.image_||this.initializeImage_(),this.replaceColor_(e),this.canvas_[e]?this.canvas_[e]:this.image_}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_[0],t=this.size_[1],n=V(e,t);n.fillRect(0,0,e,t),this.hitDetectionImage_=n.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===B.IDLE){this.image_||this.initializeImage_(),this.imageState_=B.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&Ei(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_!==B.LOADED)return;let t=this.image_,n=V(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=di(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_===B.LOADED||this.imageState_===B.ERROR)e();else{let t=()=>{(this.imageState_===B.LOADED||this.imageState_===B.ERROR)&&(this.removeEventListener(n.CHANGE,t),e())};this.addEventListener(n.CHANGE,t)}}),this.ready_}};function Mi(e,t,n,r,i,a){let o=t===void 0?void 0:ki.get(t,n,i);return o||(o=new ji(e,e&&`src`in e?e.src||void 0:t,n,r,i),ki.set(t,n,i,o,a)),a&&o&&!ki.getPattern(t,n,i)&&ki.set(t,n,i,o,a),o}function Ni(e){return e?Array.isArray(e)?Ci(e):typeof e==`object`&&`src`in e?Pi(e):e:null}function Pi(e){if(!e.offset||!e.size)return ki.getPattern(e.src,`anonymous`,e.color);let t=e.src+`:`+e.offset,n=ki.getPattern(t,void 0,e.color);if(n)return n;let r=ki.get(e.src,`anonymous`,null);if(r.getImageState()!==B.LOADED)return null;let i=V(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]),Mi(i.canvas,t,void 0,B.LOADED,e.color,!0),ki.getPattern(t,void 0,e.color)}var Fi=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){}};const Ii=`ol-hidden`,Li=`ol-collapsed`,Ri=new RegExp([`^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)`,`(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)`,`(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)`,`(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?`,`(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))`,`(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))`,`?\\s*([-,\\"\\'\\sa-z0-9]+?)\\s*$`].join(``),`i`),zi=[`style`,`variant`,`weight`,`size`,`lineHeight`,`family`],Bi={normal:400,bold:700},Vi=function(e){let t=e.match(Ri);if(!t)return null;let n={lineHeight:`normal`,size:`1.2em`,style:`normal`,weight:`400`,variant:`normal`};for(let e=0,r=zi.length;e<r;++e){let r=t[e+1];r!==void 0&&(n[zi[e]]=typeof r==`string`?r.trim():r)}return isNaN(Number(n.weight))&&n.weight in Bi&&(n.weight=Bi[n.weight]),n.families=n.family.split(/,\s?/).map(e=>e.trim().replace(/^['"]|['"]$/g,``)),n},Hi=`10px sans-serif`,Ui=`#000`,Wi=`round`,Gi=[],Ki=`round`,qi=`#000`,Ji=`center`,Yi=`middle`,Xi=[0,0,0,0],Zi=new A;let Qi=null,$i;const ea={},ta=new Set([`serif`,`sans-serif`,`monospace`,`cursive`,`fantasy`,`system-ui`,`ui-serif`,`ui-sans-serif`,`ui-monospace`,`ui-rounded`,`emoji`,`math`,`fangsong`]);function na(e,t,n){return`${e} ${t} 16px "${n}"`}const ra=(function(){let e,t;async function n(e){await t.ready;let n=await t.load(e);if(n.length===0)return!1;let r=Vi(e),i=r.families[0].toLowerCase(),a=r.weight;return n.some(e=>{let t=e.family.replace(/^['"]|['"]$/g,``).toLowerCase(),n=Bi[e.weight]||e.weight;return t===i&&e.style===r.style&&n==a})}async function r(){await t.ready;let i=!0,a=Zi.getProperties(),o=Object.keys(a).filter(e=>a[e]<100);for(let e=o.length-1;e>=0;--e){let t=o[e],r=a[t];r<100&&(await n(t)?(_(ea),Zi.set(t,100)):(r+=10,Zi.set(t,r,!0),r<100&&(i=!1)))}e=void 0,i||(e=setTimeout(r,100))}return async function(n){t||=Kr?self.fonts:document.fonts;let i=Vi(n);if(!i)return;let a=i.families,o=!1;for(let e of a){if(ta.has(e))continue;let t=na(i.style,i.weight,e);if(Zi.get(t)!==void 0)continue;Zi.set(t,0,!0),o=!0}o&&(clearTimeout(e),e=setTimeout(r,100))}})(),ia=(function(){let e;return function(t){let n=ea[t];if(n==null){if(Kr){let e=Vi(t),r=aa(t,`Žg`),i=isNaN(Number(e.lineHeight))?1.2:Number(e.lineHeight);n=i*(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);ea[t]=n}return n}})();function aa(e,t){return Qi||=V(1,1),e!=$i&&(Qi.font=e,$i=Qi.font),Qi.measureText(t)}function oa(e,t){return aa(e,t).width}function sa(e,t,n){if(t in n)return n[t];let r=t.split(`
|
||
`).reduce((t,n)=>Math.max(t,oa(e,n)),0);return n[t]=r,r}function ca(e,t){let n=[],r=[],i=[],a=0,o=0,s=0,c=0;for(let l=0,u=t.length;l<=u;l+=2){let d=t[l];if(d===`
|
||
`||l===u){a=Math.max(a,o),i.push(o),o=0,s+=c,c=0;continue}let f=t[l+1]||e.font,p=oa(f,d);n.push(p),o+=p;let m=ia(f);r.push(m),c=Math.max(c,m)}return{width:a,height:s,widths:n,heights:r,lineWidths:i}}function la(e,t,n,r,i,a,o,s,c,l,u){e.save(),n!==1&&(e.globalAlpha===void 0?e.globalAlpha=e=>e.globalAlpha*=n:e.globalAlpha*=n),t&&e.transform.apply(e,t),r.contextInstructions?(e.translate(c,l),e.scale(u[0],u[1]),ua(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 ua(e,t){let n=e.contextInstructions;for(let e=0,r=n.length;e<r;e+=2)Array.isArray(n[e+1])?t[n[e]].apply(t,n[e+1]):t[n[e]]=n[e+1]}var da=class extends Fi{constructor(e,t,n,r,i,a,o){super(),this.context_=e,this.pixelRatio_=t,this.extent_=n,this.transform_=r,this.transformRotation_=r?Ge(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_=Cn()}drawImages_(e,t,n,r){if(!this.image_)return;let i=Mn(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_;Tn(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=Mn(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){let a=this.context_,o=Mn(e,t,n,r,this.transform_,this.pixelCoordinates_);a.moveTo(o[0],o[1]);let s=o.length;i&&(s-=2);for(let e=2;e<s;e+=2)a.lineTo(o[e],o[e+1]);return i&&a.closePath(),n}drawRings_(e,t,n,r){for(let i=0,a=n.length;i<a;++i)t=this.moveToLineTo_(e,t,n[i],r,!0);return t}drawCircle(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),Me(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=Hn(e,this.transform_,this.pixelCoordinates_),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(),e.getStroke()),this.setImageStyle(e.getImage()),this.setTextStyle(e.getText())}setTransform(e){this.transform_=e}drawGeometry(e){let t=e.getType();switch(t){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);break;default:}}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_)),Me(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),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(Me(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);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_)),Me(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.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_)),Me(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.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),u(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:Ji;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:Ni(t||Ui)}}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||Gi;this.strokeState_={lineCap:n===void 0?Wi:n,lineDash:this.pixelRatio_===1?c:c.map(e=>e*this.pixelRatio_),lineDashOffset:(i||0)*this.pixelRatio_,lineJoin:a===void 0?Ki:a,lineWidth:(o===void 0?1:o)*this.pixelRatio_,miterLimit:s===void 0?10:s,strokeStyle:Ni(e||qi)}}}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();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:Ni(e||Ui)}}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?Wi:t,lineDash:r||Gi,lineDashOffset:i||0,lineJoin:a===void 0?Ki:a,lineWidth:o===void 0?1:o,miterLimit:s===void 0?10:s,strokeStyle:Ni(e||qi)}}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?Hi:r,textAlign:u===void 0?Ji:u,textBaseline:d===void 0?Yi: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?!1:o,this.textRotation_=s===void 0?0:s,this.textScale_=[this.pixelRatio_*c[0],this.pixelRatio_*c[1]]}}};const fa={Point:wa,LineString:xa,Polygon:Ea,MultiPoint:Ta,MultiLineString:Sa,MultiPolygon:Ca,GeometryCollection:ba,Circle:ga};function pa(e,t){return parseInt(O(e),10)-parseInt(O(t),10)}function ma(e,t){let n=ha(e,t);return n*n}function ha(e,t){return .5*e/t}function ga(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 i=e.getBuilder(n.getZIndex(),`Text`);i.setTextStyle(s),i.drawText(t,r)}}function _a(e,t,n,r,i,a,o,s){let c=[],l=n.getImage();if(l){let e=!0,t=l.getImageState();t==B.LOADED||t==B.ERROR?e=!1:t==B.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)),va(e,t,n,r,a,o,s),d}function va(e,t,n,r,i,a,o){let s=n.getGeometryFunction()(t);if(!s)return;let c=s.simplifyTransformed(r,i),l=n.getRenderer();if(l)ya(e,c,n,t,o);else{let r=fa[c.getType()];r(e,c,n,t,o,a)}}function ya(e,t,n,r,i){if(t.getType()==`GeometryCollection`){let a=t.getGeometries();for(let t=0,o=a.length;t<o;++t)ya(e,a[t],n,r,i);return}let a=e.getBuilder(n.getZIndex(),`Default`);a.drawCustom(t,r,n.getRenderer(),n.getHitDetectionRenderer(),i)}function ba(e,t,n,r,i,a){let o=t.getGeometriesArray(),s,c;for(s=0,c=o.length;s<c;++s){let t=fa[o[s].getType()];t(e,o[s],n,r,i,a)}}function xa(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 Sa(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 Ca(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 wa(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()!=B.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 Ta(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()!=B.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 Ea(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)}}function Da(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=!1,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 Oa(e,t){return function(n,r,i,a,o){Da(e,t,n,r,i,(e,t)=>{this.addFeatures(e),a!==void 0&&a(e)},()=>{this.changed(),o!==void 0&&o()})}}function ka(e,t){return[[-1/0,-1/0,1/0,1/0]]}function Aa(e,t,n,r){let i=[],a=de();for(let o=0,s=n.length;o<s;++o){let s=n[o];a=he(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 ja=class e extends Rn{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,r=e.length;t<r;++t)this.changeEventsKeys_.push(x(e[t],n.CHANGE,this.changed,this))}clone(){let t=new e(Ma(this.geometries_));return t.applyProperties(this),t}closestPointXY(e,t,n,r){if(r<oe(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){pe(e);let t=this.geometries_;for(let n=0,r=t.length;n<r;++n)_e(e,t[n].getExtent());return e}getGeometries(){return Ma(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)}if(i){let t=new e(n);return t}return 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||=Te(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(Ma(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 Ma(e){return e.map(e=>e.clone())}var Na=class e extends zn{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];l(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){l(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<oe(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Jn(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Zn(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?!1:t,n=n===void 0?!1:n,Lr(this.flatCoordinates,0,this.ends_,this.stride,e,t,n))}getCoordinates(){return ir(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(e){return e<0||this.ends_.length<=e?null:new zr(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 zr(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+=Rr(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],s=Fr(t,n,o,i,.5);l(e,s),n=o}return e}getSimplifiedGeometryInternal(t){let n=[],r=[];return n.length=sr(this.flatCoordinates,0,this.ends_,this.stride,t,n,0,r),new e(n,`XY`,r)}getType(){return`MultiLineString`}intersectsExtent(e){return Sr(this.flatCoordinates,0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||=[];let n=tr(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}},Pa=class e extends zn{constructor(e,t){super(),t&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendPoint(e){l(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<oe(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=ze(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 rr(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(e){let t=this.flatCoordinates.length/this.stride;return e<0||t<=e?null:new pr(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 pr(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(le(e,n,i))return!0}return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||=[],this.flatCoordinates.length=er(this.flatCoordinates,0,e,this.stride),this.changed()}},Fa=class e extends zn{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;l(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;l(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<oe(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Yn(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Qn(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return _r(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e,t)}getArea(){return Gn(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(e){let t;return e===void 0?t=this.flatCoordinates:(t=this.getOrientedFlatCoordinates().slice(),jr(t,0,this.endss_,this.stride,e)),ar(t,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){let e=Aa(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=yr(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new Pa(this.getFlatInteriorPoints().slice(),`XYM`)}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;kr(e,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=jr(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){let n=[],r=[];return n.length=dr(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 Nr(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 Nr(t.slice(i,s),e,o);r.push(c),i=s}return r}getType(){return`MultiPolygon`}intersectsExtent(e){return Tr(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,3),this.flatCoordinates||=[];let n=nr(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()}};const Ia=Cn();var La=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`?me(this.flatCoordinates_):he(this.flatCoordinates_,0,this.flatCoordinates_.length,2),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){let e=Te(this.getExtent());this.flatInteriorPoints_=vr(this.flatCoordinates_,0,this.ends_,2,e,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){let e=Mr(this.flatCoordinates_,this.ends_),t=Aa(this.flatCoordinates_,0,e,2);this.flatInteriorPoints_=yr(this.flatCoordinates_,0,e,2,t)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||=Fr(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.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=Fr(e,t,i,2,.5);l(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=R(e);let t=e.getExtent(),n=e.getWorldExtent();if(t&&n){let e=F(n)/F(t);Tn(Ia,n[0],n[3],e,-e,0,0,0),Mn(this.flatCoordinates_,0,this.flatCoordinates_.length,2,Ia,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=h((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=or(r,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,r,0),i=[r.length];break;case`MultiLineString`:i=[],r.length=sr(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);break;default:}return i&&(this.simplifiedGeometry_=new e(this.type_,r,i,2,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}};La.prototype.getFlatCoordinates=La.prototype.getOrientedFlatCoordinates;function Ra(e,t,n=0,r=e.length-1,i=Ba){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),u=Math.max(n,Math.floor(t-o*c/a+l)),d=Math.min(r,Math.floor(t+(a-o)*c/a+l));Ra(e,t,u,d,i)}let a=e[t],o=n,s=r;for(za(e,n,t),i(e[r],a)>0&&za(e,n,r);o<s;){for(za(e,o,s),o++,s--;i(e[o],a)<0;)o++;for(;i(e[s],a)>0;)s--}i(e[n],a)===0?za(e,n,s):(s++,za(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}}function za(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function Ba(e,t){return e<t?-1:e>t?1:0}var Va=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(!$a(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;$a(e,s)&&(t.leaf?n.push(o):Qa(e,s)?this._all(o,n):i.push(o))}t=i.pop()}return n}collides(e){let t=this.data;if(!$a(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($a(e,a)){if(t.leaf||Qa(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=eo([]),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=Ha(e,n.children,t);if(r!==-1)return n.children.splice(r,1),i.push(n),this._condense(i),this}!c&&!n.leaf&&Qa(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=eo(e.slice(t,n+1)),Ua(o,this.toBBox),o;r||(r=Math.ceil(Math.log(i)/Math.log(a)),a=Math.ceil(i/a**(r-1))),o=eo([]),o.leaf=!1,o.height=r;let s=Math.ceil(i/a),c=s*Math.ceil(Math.sqrt(a));to(e,t,n,c,this.compareMinX);for(let i=t;i<=n;i+=c){let t=Math.min(i+c-1,n);to(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 Ua(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=Ja(o),c=Xa(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),Ga(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=eo(n.children.splice(a,n.children.length-a));o.height=n.height,o.leaf=n.leaf,Ua(n,this.toBBox),Ua(o,this.toBBox),t?e[t-1].children.push(o):this._splitRoot(n,o)}_splitRoot(e,t){this.data=eo([e,t]),this.data.height=e.height+1,this.data.leaf=!1,Ua(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=Wa(e,0,o,this.toBBox),s=Wa(e,o,n,this.toBBox),c=Za(t,s),l=Ja(t)+Ja(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:Ka,i=e.leaf?this.compareMinY:qa,a=this._allDistMargin(e,t,n,r),o=this._allDistMargin(e,t,n,i);a<o&&e.children.sort(r)}_allDistMargin(e,t,n,r){e.children.sort(r);let i=this.toBBox,a=Wa(e,0,t,i),o=Wa(e,n-t,n,i),s=Ya(a)+Ya(o);for(let r=t;r<n-t;r++){let t=e.children[r];Ga(a,e.leaf?i(t):t),s+=Ya(a)}for(let r=n-t-1;r>=t;r--){let t=e.children[r];Ga(o,e.leaf?i(t):t),s+=Ya(o)}return s}_adjustParentBBoxes(e,t,n){for(let r=n;r>=0;r--)Ga(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():Ua(e[t],this.toBBox)}};function Ha(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 Ua(e,t){Wa(e,0,e.children.length,t,e)}function Wa(e,t,n,r,i){i||=eo(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];Ga(i,e.leaf?r(t):t)}return i}function Ga(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 Ka(e,t){return e.minX-t.minX}function qa(e,t){return e.minY-t.minY}function Ja(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function Ya(e){return e.maxX-e.minX+(e.maxY-e.minY)}function Xa(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 Za(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 Qa(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function $a(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function eo(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function to(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;Ra(e,o,t,n,i),a.push(t,o,o,n)}}var no=class{constructor(e){this.rbush_=new Va(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_[O(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_[O(a)]=o}this.rbush_.load(n)}remove(e){let t=O(e),n=this.items_[t];return delete this.items_[t],this.rbush_.remove(n)!==null}update(e,t){let n=this.items_[O(t)],r=[n.minX,n.minY,n.maxX,n.maxY];ge(r,e)||(this.remove(t),this.insert(e,t))}getAll(){let e=this.rbush_.all();return e.map(function(e){return e.value})}getInExtent(e){let t={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]},n=this.rbush_.search(t);return n.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 v(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){let t=this.rbush_.toJSON();return fe(t.minX,t.minY,t.maxX,t.maxY,e)}concat(e){for(let t in this.rbush_.load(e.rbush_.all()),e.items_)this.items_[t]=e.items_[t]}},ro=class extends A{constructor(e){super(),this.projection=R(e.projection),this.attributions_=io(e.attributions),this.attributionsCollapsible_=e.attributionsCollapsible??!0,this.loading=!1,this.state_=e.state===void 0?`ready`:e.state,this.wrapX_=e.wrapX===void 0?!1: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_}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(e){this.attributions_=io(e),this.changed()}setState(e){this.state_=e,this.changed()}};function io(e){return e?typeof e==`function`?e:(Array.isArray(e)||(e=[e]),t=>e):null}var ao={ADDFEATURE:`addfeature`,CHANGEFEATURE:`changefeature`,CLEAR:`clear`,REMOVEFEATURE:`removefeature`,FEATURESLOADSTART:`featuresloadstart`,FEATURESLOADEND:`featuresloadend`,FEATURESLOADERROR:`featuresloaderror`},oo=class extends y{constructor(e,t,n){super(e),this.feature=t,this.features=n}},so=class extends ro{constructor(e){e||={},super({attributions:e.attributions,interpolate:!0,projection:void 0,state:`ready`,wrapX:e.wrapX===void 0?!0:e.wrapX}),this.on,this.once,this.un,this.loader_=m,this.format_=e.format||null,this.overlaps_=e.overlaps===void 0?!0:e.overlaps,this.url_=e.url,e.loader===void 0?this.url_!==void 0&&(N(this.format_,"`format` must be set when `url` is set"),this.loader_=Oa(this.url_,this.format_)):this.loader_=e.loader,this.strategy_=e.strategy===void 0?ka:e.strategy;let t=e.useSpatialIndex===void 0?!0:e.useSpatialIndex;this.featuresRtree_=t?new no:null,this.loadedExtentsRtree_=new no,this.loadingExtentsCount_=0,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 M(r)),r!==void 0&&this.addFeaturesInternal(r),n!==void 0&&this.bindFeaturesCollection_(n)}addFeature(e){this.addFeatureInternal(e),this.changed()}addFeatureInternal(e){let t=O(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 oo(ao.ADDFEATURE,e))}setupChangeEvents_(e,r){r instanceof La||(this.featureChangeKeys_[e]=[x(r,n.CHANGE,this.handleFeatureChange_,this),x(r,t.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 La){let r=this.idIndex_[e];r instanceof La?Array.isArray(r)?r.push(t):this.idIndex_[e]=[r,t]:n=!1}else n=!1}return n&&(N(!(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=O(r);this.addToIndex_(i,r)&&n.push(r)}for(let e=0,i=n.length;e<i;e++){let i=n[e],a=O(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(ao.ADDFEATURE))for(let e=0,t=n.length;e<t;e++)this.dispatchEvent(new oo(ao.ADDFEATURE,n[e]))}bindFeaturesCollection_(t){this.addEventListener(ao.ADDFEATURE,function(e){t.push(e.feature)}),this.addEventListener(ao.REMOVEFEATURE,function(e){t.remove(e.feature)}),t.addEventListener(e.ADD,e=>{this.addFeature(e.element)}),t.addEventListener(e.REMOVE,e=>{this.removeFeature(e.element)}),this.featuresCollection_=t}clear(e){if(e){for(let e in this.featureChangeKeys_){let t=this.featureChangeKeys_[e];t.forEach(C)}this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_)for(let e in this.featuresRtree_.forEach(e=>{this.removeFeatureInternal(e)}),this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[e]);this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};let t=new oo(ao.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 La||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 La||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(),v(this.nullGeometryFeatures_)||l(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_){let n=t&&t.canWrapX()&&this.getWrapX();if(!n)return this.featuresRtree_.getInExtent(e);let r=Le(e,t);return[].concat(...r.map(e=>this.featuresRtree_.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];return t||=f,this.featuresRtree_.forEachInExtent(s,function(e){if(t(e)){let t=e.getGeometry(),c=o;if(o=t instanceof La?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}getExtent(e){return this.featuresRtree_.getExtent(e)}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=O(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 oo(ao.CHANGEFEATURE,t))}hasFeature(e){let t=e.getId();return t===void 0?O(e)in this.uidIndex_:t in this.idIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&v(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!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],o=r.forEachInExtent(a,function(e){return ce(e.extent,a)});o||(++this.loadingExtentsCount_,this.dispatchEvent(new oo(ao.FEATURESLOADSTART)),this.loader_.call(this,a,t,n,e=>{--this.loadingExtentsCount_,this.dispatchEvent(new oo(ao.FEATURESLOADEND,void 0,e))},()=>{--this.loadingExtentsCount_,this.dispatchEvent(new oo(ao.FEATURESLOADERROR))}),r.insert(a,{extent:a.slice()}))}this.loading=this.loader_.length<4?!1:this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(e){let t=this.loadedExtentsRtree_,n=t.forEachInExtent(e,function(t){if(ge(t.extent,e))return t});n&&t.remove(n)}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){if(!e)return;let t=this.removeFeatureInternal(e);t&&this.changed()}removeFeatureInternal(e){let t=O(e);if(!(t in this.uidIndex_))return!1;t in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[t]:this.featuresRtree_&&this.featuresRtree_.remove(e);let n=this.featureChangeKeys_[t];n?.forEach(C),delete this.featureChangeKeys_[t];let r=e.getId();if(r!==void 0){let t=r.toString(),n=this.idIndex_[t];n===e?delete this.idIndex_[t]:Array.isArray(n)&&(n.splice(n.indexOf(e),1),n.length===1&&(this.idIndex_[t]=n[0]))}return delete this.uidIndex_[t],this.hasListener(ao.REMOVEFEATURE)&&this.dispatchEvent(new oo(ao.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){N(this.format_,"`format` must be set when `url` is set"),this.url_=e,this.setLoader(Oa(e,this.format_))}setOverlaps(e){this.overlaps_=e,this.changed()}},co=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=Mi(null,e.src,`anonymous`,void 0,e.offset?null:e.color?e.color:null,!(e.offset&&e.size));t.ready().then(()=>{this.patternImage_=null}),t.getImageState()===B.IDLE&&t.load(),t.getImageState()===B.LOADING&&(this.patternImage_=t)}this.color_=e}getKey(){let e=this.getColor();return e?e instanceof CanvasPattern||e instanceof CanvasGradient?O(e):typeof e==`object`&&`src`in e?e.src+`:`+e.offset:Si(e).toString():``}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}},lo=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.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()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),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_}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}setWidth(e){this.width_=e}};function uo(e){return e[0]>0&&e[1]>0}function fo(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 po(e,t){return Array.isArray(e)?e:(t===void 0?t=[e,e]:(t[0]=e,t[1]=e),t)}var mo=class e{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=po(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 E()}getImage(e){return E()}getHitDetectionImage(){return E()}getPixelRatio(e){return 1}getImageState(){return E()}getImageSize(){return E()}getOrigin(){return E()}getSize(){return E()}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_=po(e)}listenImageChange(e){E()}load(){E()}unlistenImageChange(e){E()}ready(){return Promise.resolve()}},ho=class e extends mo{constructor(e){super({opacity:1,rotateWithView:e.rotateWithView===void 0?!1: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()?B.LOADING:B.LOADED,this.imageState_===B.LOADING&&this.ready().then(()=>this.imageState_=B.LOADED),this.render()}clone(){let t=this.getScale(),n=new e({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,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=ki.get(n,null,null)?.getImage(1);if(!r){let t=this.renderOptions_,i=Math.ceil(t.size*e),a=V(i,i);this.draw_(t,a,e),r=a.canvas,ki.set(n,null,null,new ji(r,void 0,null,B.LOADED,null))}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}getRadius2(){return this.radius2_}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),h=m-r;if(this.radius2_===void 0||e===`bevel`)return h*2;let g=r*Math.sin(o),_=Math.sqrt(r*r-g*g),v=i-_,y=Math.sqrt(g*g+v*v),b=y/g;if(b<=n){let e=b*t/2-i-r;return 2*Math.max(h,e)}return h*2}createRenderOptions(){let e=Wi,t=Ki,n=0,r=null,i=0,a,o=0;this.stroke_&&(a=Ni(this.stroke_.getColor()??qi),o=this.stroke_.getWidth()??1,r=this.stroke_.getLineDash(),i=this.stroke_.getLineDashOffset()??0,t=this.stroke_.getLineJoin()??Ki,e=this.stroke_.getLineCap()??Wi,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=Ui),t.fillStyle=Ni(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=Si(n)),n===null?r=1:Array.isArray(n)&&(r=n.length===4?n[3]:1),r===0&&(t=V(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=Ui,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()}},go=class e extends ho{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?!1: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()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,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}setRadius(e){this.radius=e,this.render()}},_o=class e{constructor(e){e||={},this.geometry_=null,this.geometryFunction_=xo,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()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,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_=xo,this.geometry_=e}setZIndex(e){this.zIndex_=e}};function vo(e){let t;if(typeof e==`function`)t=e;else{let n;if(Array.isArray(e))n=e;else{N(typeof e.getZIndex==`function`,"Expected an `Style` or an array of `Style`");let t=e;n=[t]}t=function(){return n}}return t}let yo=null;function bo(e,t){if(!yo){let e=new co({color:`rgba(255,255,255,0.4)`}),t=new lo({color:`#3399CC`,width:1.25});yo=[new _o({image:new go({fill:e,stroke:t,radius:5}),fill:e,stroke:t})]}return yo}function xo(e){return e.getGeometry()}var So=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_=po(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 co({color:`#333`}):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()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,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_=po(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}},H={ANIMATING:0,INTERACTING:1};const 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},Co=[U.FILL],wo=[U.STROKE],To=[U.BEGIN_PATH],Eo=[U.CLOSE_PATH];var Do=class extends Fi{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],se(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=ue(c,d),h===m?h===P.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(),d=[];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),d.push(n)}this.instructions.push([U.CUSTOM,s,d,e,n,ar,i]),this.hitDetectionInstructions.push([U.CUSTOM,s,d,e,r||n,ar,i]);break;case`Polygon`:case`MultiLineString`:u=[],c=a==`Polygon`?e.getOrientedFlatCoordinates():e.getFlatCoordinates(),f=this.drawCustomCoordinates_(c,0,e.getEnds(),o,u),this.instructions.push([U.CUSTOM,s,u,e,n,ir,i]),this.hitDetectionInstructions.push([U.CUSTOM,s,u,e,r||n,ir,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,rr,i]),this.hitDetectionInstructions.push([U.CUSTOM,s,l,e,r||n,rr,i]);break;case`MultiPoint`:c=e.getFlatCoordinates(),l=this.appendFlatPointCoordinates(c,o),l>s&&(this.instructions.push([U.CUSTOM,s,l,e,n,rr,i]),this.hitDetectionInstructions.push([U.CUSTOM,s,l,e,r||n,rr,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]);break;default:}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,c(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=Ni(n||Ui)}else t.fillStyle=void 0;return t}strokeStyleToState(e,t={}){if(e){let n=e.getColor();t.strokeStyle=Ni(n||qi);let r=e.getLineCap();t.lineCap=r===void 0?Wi:r;let i=e.getLineDash();t.lineDash=i?i.slice():Gi;let a=e.getLineDashOffset();t.lineDashOffset=a||0;let o=e.getLineJoin();t.lineJoin=o===void 0?Ki:o;let s=e.getWidth();t.lineWidth=s===void 0?1:s;let c=e.getMiterLimit();t.miterLimit=c===void 0?10:c,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;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;(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;(e.currentStrokeStyle!=n||e.currentLineCap!=r||i!=e.currentLineDash&&!u(e.currentLineDash,i)||e.currentLineDashOffset!=a||e.currentLineJoin!=o||e.currentLineWidth!=s||e.currentMiterLimit!=c)&&(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)}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_=ae(this.maxExtent),this.maxLineWidth>0)){let e=this.resolution*(this.maxLineWidth+1)/2;ie(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},Oo=class extends Do{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&&!se(this.maxExtent,e.getFlatCoordinates()))return;this.beginGeometry(e,t,n);let r=e.getFlatCoordinates(),i=e.getStride(),a=this.coordinates.length,o=this.appendFlatPointCoordinates(r,i);this.instructions.push([U.DRAW_IMAGE,a,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),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);let r=e.getFlatCoordinates(),i=[];for(let t=0,n=r.length;t<n;t+=e.getStride())(!this.maxExtent||se(this.maxExtent,r.slice(t,t+2)))&&i.push(r[t],r[t+1]);let a=this.coordinates.length,o=this.appendFlatPointCoordinates(i,2);this.instructions.push([U.DRAW_IMAGE,a,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),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();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}},ko=class extends Do{constructor(e,t,n,r){super(e,t,n,r)}drawFlatCoordinates_(e,t,n,r){let i=this.coordinates.length,a=this.appendFlatLineCoordinates(e,t,n,r,!1,!1),o=[U.MOVE_TO_LINE_TO,i,a];return this.instructions.push(o),this.hitDetectionInstructions.push(o),n}drawLineString(e,t,n){let r=this.state,i=r.strokeStyle,a=r.lineWidth;if(i===void 0||a===void 0)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(e,t,n),this.hitDetectionInstructions.push([U.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Gi,0],To);let o=e.getFlatCoordinates(),s=e.getStride();this.drawFlatCoordinates_(o,0,o.length,s),this.hitDetectionInstructions.push(wo),this.endGeometry(t)}drawMultiLineString(e,t,n){let r=this.state,i=r.strokeStyle,a=r.lineWidth;if(i===void 0||a===void 0)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(e,t,n),this.hitDetectionInstructions.push([U.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Gi,0],To);let o=e.getEnds(),s=e.getFlatCoordinates(),c=e.getStride(),l=0;for(let e=0,t=o.length;e<t;++e)l=this.drawFlatCoordinates_(s,l,o[e],c);this.hitDetectionInstructions.push(wo),this.endGeometry(t)}finish(){let e=this.state;return e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&this.instructions.push(wo),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(wo),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(To)}},Ao=class extends Do{constructor(e,t,n,r){super(e,t,n,r)}drawFlatCoordinatess_(e,t,n,r){let i=this.state,a=i.fillStyle!==void 0,o=i.strokeStyle!==void 0,s=n.length;this.instructions.push(To),this.hitDetectionInstructions.push(To);for(let i=0;i<s;++i){let a=n[i],s=this.coordinates.length,c=this.appendFlatLineCoordinates(e,t,a,r,!0,!o),l=[U.MOVE_TO_LINE_TO,s,c];this.instructions.push(l),this.hitDetectionInstructions.push(l),o&&(this.instructions.push(Eo),this.hitDetectionInstructions.push(Eo)),t=a}return a&&(this.instructions.push(Co),this.hitDetectionInstructions.push(Co)),o&&(this.instructions.push(wo),this.hitDetectionInstructions.push(wo)),t}drawCircle(e,t,n){let r=this.state,i=r.fillStyle,a=r.strokeStyle;if(i===void 0&&a===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([U.SET_FILL_STYLE,Ui]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([U.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Gi,0]);let o=e.getFlatCoordinates(),s=e.getStride(),c=this.coordinates.length;this.appendFlatLineCoordinates(o,0,o.length,s,!1,!1);let l=[U.CIRCLE,c];this.instructions.push(To,l),this.hitDetectionInstructions.push(To,l),r.fillStyle!==void 0&&(this.instructions.push(Co),this.hitDetectionInstructions.push(Co)),r.strokeStyle!==void 0&&(this.instructions.push(wo),this.hitDetectionInstructions.push(wo)),this.endGeometry(t)}drawPolygon(e,t,n){let r=this.state,i=r.fillStyle,a=r.strokeStyle;if(i===void 0&&a===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([U.SET_FILL_STYLE,Ui]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([U.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Gi,0]);let o=e.getEnds(),s=e.getOrientedFlatCoordinates(),c=e.getStride();this.drawFlatCoordinatess_(s,0,o,c),this.endGeometry(t)}drawMultiPolygon(e,t,n){let r=this.state,i=r.fillStyle,a=r.strokeStyle;if(i===void 0&&a===void 0)return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([U.SET_FILL_STYLE,Ui]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([U.SET_STROKE_STYLE,r.strokeStyle,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Gi,0]);let o=e.getEndss(),s=e.getOrientedFlatCoordinates(),c=e.getStride(),l=0;for(let e=0,t=o.length;e<t;++e)l=this.drawFlatCoordinatess_(s,l,o[e],c);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]=cr(t[n],e)}return super.finish()}setFillStrokeStyles_(){let e=this.state;this.updateFillStyle(e,this.createFill),this.updateStrokeStyle(e,this.applyStroke)}};function jo(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=We(n,l,t),p=We(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=We(n,l,e/d),f=We(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 Mo(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&&(v=n-m,y=r-h,p=Math.sqrt(v*v+y*y),g!==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,c>s?[l,d]:[a,o]}const No={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};var Po=class extends Do{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[Ui]={fillStyle:Ui},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`)){if(!Me(this.maxExtent,e.getExtent()))return;let r;if(l=e.getFlatCoordinates(),c==`LineString`)r=[l.length];else if(c==`MultiLineString`)r=e.getEnds();else if(c==`Polygon`)r=e.getEnds().slice(0,1);else if(c==`MultiPolygon`){let t=e.getEndss();r=[];for(let e=0,n=t.length;e<n;++e)r.push(t[e][0])}this.beginGeometry(e,t,n);let i=a.repeat,d=i?void 0:a.textAlign,f=0;for(let e=0,t=r.length;e<t;++e){let t;t=i?jo(i*this.resolution,l,f,r[e],u):[l.slice(f,r[e])];for(let n=0,i=t.length;n<i;++n){let i=t[n],c=0,l=i.length;if(d==null){let e=Mo(a.maxAngle,i,0,i.length,2);c=e[0],l=e[1]}for(let e=c;e<l;e+=u)o.push(i[e],i[e+1]);let p=o.length;f=r[e],this.drawChars_(s,p),s=p}}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.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.push(t[e+2]/this.resolution),l.push(t[e],t[e+1]);if(l.length===0)return;u=2;break;default:}let i=this.appendFlatPointCoordinates(l,u);if(i===s)return;if(r&&(i-s)/2!==l.length/u){let e=s/2;r=r.filter((t,n)=>{let r=o[(e+n)*2]===l[n*u]&&o[(e+n)*2+1]===l[n*u+1];return r||--e,r})}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);let p=a.padding;if(p!=Xi&&(a.scale[0]<0||a.scale[1]<0)){let e=a.padding[0],t=a.padding[1],n=a.padding[2],r=a.padding[3];a.scale[0]<0&&(t=-t,r=-r),a.scale[1]<0&&(e=-e,n=-n),p=[e,t,n,r]}let m=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_,p==Xi?Xi:p.map(function(e){return e*m}),d,f,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,r]);let h=1/m,g=d?d.slice(0):null;g&&(g[1]=Ui),this.hitDetectionInstructions.push([U.DRAW_IMAGE,s,i,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[h,h],NaN,this.declutterMode_,this.declutterImageWithText_,p,g,f,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?Ui: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||Ji,justify:t.justify,textBaseline:t.textBaseline||Yi,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=No[r.textBaseline],l=this.textOffsetY_*s,u=this.text_,d=n?n.lineWidth*Math.abs(r.scale[0])/2:0;this.instructions.push([U.DRAW_CHARS,e,t,c,r.overflow,o,r.maxAngle,s,l,i,d*s,u,a,1,this.declutterMode_,this.textKeepUpright_]),this.hitDetectionInstructions.push([U.DRAW_CHARS,e,t,c,r.overflow,o&&Ui,r.maxAngle,s,l,i,d*s,u,a,1/s,this.declutterMode_,this.textKeepUpright_])}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=Ni(t.getColor()||Ui)):(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()||Wi,i.lineDash=e?e.slice():Gi,i.lineDashOffset=t===void 0?0:t,i.lineJoin=a.getLineJoin()||Ki,i.lineWidth=n===void 0?1:n,i.miterLimit=r===void 0?10:r,i.strokeStyle=Ni(a.getColor()||qi)}n=this.textState_;let o=e.getFont()||Hi;ra(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()||Yi,n.backgroundFill=e.getBackgroundFill(),n.backgroundStroke=e.getBackgroundStroke(),n.padding=e.getPadding()||Xi,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?!1:u,this.textKeepUpright_=d===void 0?!0:d,this.textRotation_=f===void 0?0:f,this.strokeKey_=i?(typeof i.strokeStyle==`string`?i.strokeStyle:O(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:`|`+O(r.fillStyle):``}this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}};const Fo={Circle:Ao,Default:Do,Image:Oo,LineString:ko,Polygon:Ao,Text:Po};var Io=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=Fo[t];i=new e(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[t]=i}return i}};function Lo(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=We(h,p,b),S=We(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=We(h,p,b),D=We(g,m,b),O=!1;if(f)if(d){let e=[x,S,E,D];Nn(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 j;if(ee){y(),j=Math.atan2(m-g,p-h),O&&(j+=j>0?-k:k);let e=(E+x)/2,t=(D+S)/2;return A[0]=[e,t,(T-a)/2,j,i],A}i=i.replace(/\n/g,` `);for(let e=0,d=i.length;e<d;){y();let f=Math.atan2(m-g,p-h);if(O&&(f+=f>0?-k:k),j!==void 0){let e=f-j;if(e+=e>k?-2*k:e<-k?2*k:0,Math.abs(e)>o)return null}j=f;let x=e,S=0;for(;e<d;++e){let o=O?d-e-1:e,f=s*c(l,i[o],u);if(t+r<n&&v+_<a+S+f/2)break;S+=f}if(e===x)continue;let C=O?i.substring(d-x,d-e):i.substring(x,e);b=_===0?0:(a+S/2-v)/_;let w=We(h,p,b),T=We(g,m,b);A.push([w,T,S/2,f,C]),a+=S}return A}var Ro=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.context_=new Proxy(Xr(),{get:(e,t)=>{if(typeof Xr()[t]==`function`)return this.push_(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_(e),this);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];if(typeof e[r]==`function`)e[r](...i);else{if(typeof i==`function`){e[r]=i(e);continue}e[r]=i}}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}};const zo=de(),Bo=[],Vo=[],Ho=[],Uo=[];function Wo(e){return e[3].declutterBox}const Go=RegExp(`[֑-ࣿיִ-﷿ﹰ-ﻼࠀ--]`);function Ko(e,t){return t===`start`?t=Go.test(e)?`right`:`left`:t===`end`&&(t=Go.test(e)?`left`:`right`),No[t]}function qo(e,t,n){return n>0&&e.push(`
|
||
`,``),e.push(t,``),e}function Jo(e,t,n){return n%2==0&&(e+=t),e}var Yo=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_=Cn(),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 Ro: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?No[s.justify]:Ko(Array.isArray(e)?e[0]:e,s.textAlign||Ji),d=r&&a.lineWidth?a.lineWidth:0,f=Array.isArray(e)?e:String(e).split(`
|
||
`).reduce(qo,[]),{width:p,height:m,widths:h,heights:g,lineWidths:_}=ca(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&&(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&&y.push(`fillStyle`,o.fillStyle),y.push(`textBaseline`,`middle`),y.push(`textAlign`,`center`);let C=.5-u,w=u*v+C*d,T=[],E=[],D=0,O=0,k=0,A=0,ee;for(let e=0,t=f.length;e<t;e+=2){let t=f[e];if(t===`
|
||
`){O+=D,D=0,w=u*v+C*d,++A;continue}let i=f[e+1]||s.font;i!==ee&&(r&&T.push(`font`,i),n&&E.push(`font`,i),ee=i),D=Math.max(D,g[k]);let a=[t,w+C*h[k]+u*(h[k]-_[A]),.5*(d+D)+O];w+=h[k],r&&T.push(`strokeText`,a),n&&E.push(`fillText`,a),++k}return Array.prototype.push.apply(y,T),Array.prototype.push.apply(y,E),this.labels_[i]=S,S}replayTextBackground_(e,t,n,r,i,a,o){e.beginPath(),e.moveTo.apply(e,t),e.lineTo.apply(e,n),e.lineTo.apply(e,r),e.lineTo.apply(e,i),e.lineTo.apply(e,t),a&&(this.alignAndScaleFill_=a[2],e.fillStyle=a[1],this.fill_(e)),o&&(this.setStrokeStyle_(e,o),e.stroke())}calculateImageOrLabelDimensions_(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){o*=d[0],s*=d[1];let g=n-o,_=r-s,v=i+c>e?e-c:i,y=a+l>t?t-l:a,b=p[3]+v*d[0]+p[1],x=p[0]+y*d[1]+p[2],S=g-p[3],C=_-p[0];(m||u!==0)&&(Bo[0]=S,Uo[0]=S,Bo[1]=C,Vo[1]=C,Vo[0]=S+b,Ho[0]=Vo[0],Ho[1]=C+x,Uo[1]=Ho[1]);let w;return u===0?fe(Math.min(S,S+b),Math.min(C,C+x),Math.max(S,S+b),Math.max(C,C+x),zo):(w=Tn(Cn(),n,r,1,1,u,-n,-r),z(w,Bo),z(w,Vo),z(w,Ho),z(w,Uo),fe(Math.min(Bo[0],Vo[0],Ho[0],Uo[0]),Math.min(Bo[1],Vo[1],Ho[1],Uo[1]),Math.max(Bo[0],Vo[0],Ho[0],Uo[0]),Math.max(Bo[1],Vo[1],Ho[1],Uo[1]),zo)),f&&(g=Math.round(g),_=Math.round(_)),{drawImageX:g,drawImageY:_,drawImageW:v,drawImageH:y,originX:c,originY:l,declutterBox:{minX:zo[0],minY:zo[1],maxX:zo[2],maxY:zo[3],value:h},canvasTransform:w,scale:d}}replayImageOrLabel_(e,t,n,r,i,a,o){let s=!!(a||o),c=r.declutterBox,l=o?o[2]*r.scale[0]/2:0,u=c.minX-l<=t[0]&&c.maxX+l>=0&&c.minY-l<=t[1]&&c.maxY+l>=0;return u&&(s&&this.replayTextBackground_(e,Bo,Vo,Ho,Uo,a,o),la(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=z(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.rotate(this.viewRotation_)}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=Ko(Array.isArray(e)?e[0]:e,i.textAlign||Ji),l=No[i.textBaseline||Yi],u=o&&o.lineWidth?o.lineWidth:0,d=a.width/s-2*i.scale[0],f=c*d+2*(.5-c)*u,p=l*a.height/s+2*(.5-l)*u;return{label:a,anchorX:f,anchorY:p}}execute_(e,t,n,r,i,a,o,s){let c=this.zIndexContext_,l;this.pixelCoordinates_&&u(n,this.renderedTransform_)?l=this.pixelCoordinates_:(this.pixelCoordinates_||=[],l=Mn(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),wn(this.renderedTransform_,n));let d=0,f=r.length,p=0,m,h,g,_,v,y,b,x,S,C,w,T,E,D=0,O=0,k=this.coordinateCache_,A=this.viewRotation_,ee=Math.round(Math.atan2(-n[1],n[0])*0xe8d4a51000)/0xe8d4a51000,j={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:A},M=this.instructions!=r||this.overlaps?0:200,N,te,ne,P;for(;d<f;){let n=r[d],u=n[0];switch(u){case U.BEGIN_GEOMETRY:N=n[1],P=n[3],N.getGeometry()?o!==void 0&&!Me(o,P.getExtent())?d=n[2]+1:++d:d=n[2],c&&(c.zIndex=n[4]);break;case U.BEGIN_PATH:D>M&&(this.fill_(e),D=0),O>M&&(e.stroke(),O=0),!D&&!O&&(e.beginPath(),v=NaN,y=NaN),++d;break;case U.CIRCLE:p=n[1];let r=l[p],u=l[p+1],f=l[p+2],re=l[p+3],ie=f-r,ae=re-u,oe=Math.sqrt(ie*ie+ae*ae);e.moveTo(r+oe,u),e.arc(r,u,oe,0,2*Math.PI,!0),++d;break;case U.CLOSE_PATH:e.closePath(),++d;break;case U.CUSTOM:p=n[1],m=n[2];let se=n[3],ce=n[4],le=n[5];j.geometry=se,j.feature=N,d in k||(k[d]=[]);let ue=k[d];le?le(l,p,m,2,ue):(ue[0]=l[p],ue[1]=l[p+1],ue.length=2),c&&(c.zIndex=n[6]),ce(ue,j),++d;break;case U.DRAW_IMAGE:p=n[1],m=n[2],S=n[3],h=n[4],g=n[5];let de=n[6],fe=n[7],pe=n[8],me=n[9],he=n[10],ge=n[11],_e=n[12],ve=n[13];_=n[14]||`declutter`;let ye=n[15];if(!S&&n.length>=20){C=n[19],w=n[20],T=n[21],E=n[22];let e=this.drawLabelWithPointPlacement_(C,w,T,E);S=e.label,n[3]=S;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,de=S.height,n[6]=de,ve=S.width,n[13]=ve}let be;n.length>25&&(be=n[25]);let xe,Se,Ce;n.length>17?(xe=n[16],Se=n[17],Ce=n[18]):(xe=Xi,Se=null,Ce=null),he&&ee?ge+=A:!he&&!ee&&(ge-=A);let we=0;for(;p<m;p+=2){if(be&&be[we++]<ve/this.pixelRatio)continue;let n=this.calculateImageOrLabelDimensions_(S.width,S.height,l[p],l[p+1],ve,de,h,g,pe,me,ge,_e,i,xe,!!Se||!!Ce,N),r=[e,t,S,n,fe,Se,Ce];if(s){let e,t,i;if(ye){let n=m-p;if(!ye[n]){ye[n]={args:r,declutterMode:_};continue}let a=ye[n];e=a.args,t=a.declutterMode,delete ye[n],i=Wo(e)}let a,o;if(e&&(t!==`declutter`||!s.collides(i))&&(a=!0),(_!==`declutter`||!s.collides(n.declutterBox))&&(o=!0),t===`declutter`&&_===`declutter`){let e=a&&o;a=e,o=e}a&&(t!==`none`&&s.insert(i),this.replayImageOrLabel_.apply(this,e)),o&&(_!==`none`&&s.insert(n.declutterBox),this.replayImageOrLabel_.apply(this,r))}else this.replayImageOrLabel_.apply(this,r)}++d;break;case U.DRAW_CHARS:let Te=n[1],Ee=n[2],De=n[3],Oe=n[4];E=n[5];let F=n[6],ke=n[7],Ae=n[8];T=n[9];let je=n[10];C=n[11],Array.isArray(C)&&(C=C.reduce(Jo,``)),w=n[12];let I=[n[13],n[13]];_=n[14]||`declutter`;let Ne=n[15],Pe=this.textStates[w],Fe=Pe.font,Ie=[Pe.scale[0]*ke,Pe.scale[1]*ke],Le;Fe in this.widths_?Le=this.widths_[Fe]:(Le={},this.widths_[Fe]=Le);let L=Rr(l,Te,Ee,2),Re=Math.abs(Ie[0])*sa(Fe,C,Le);if(Oe||Re<=L){let n=this.textStates[w].textAlign,r=(L-Re)*Ko(C,n),i=Lo(l,Te,Ee,2,C,r,F,Math.abs(Ie[0]),sa,Fe,Le,ee?0:this.viewRotation_,Ne);drawChars:if(i){let n=[],r,a,o,c,l;if(T)for(r=0,a=i.length;r<a;++r){l=i[r],o=l[4],c=this.createLabel(o,w,``,T),h=l[2]+(Ie[0]<0?-je:je),g=De*c.height+(.5-De)*2*je*Ie[1]/Ie[0]-Ae;let a=this.calculateImageOrLabelDimensions_(c.width,c.height,l[0],l[1],c.width,c.height,h,g,0,0,l[3],I,!1,Xi,!1,N);if(s&&_===`declutter`&&s.collides(a.declutterBox))break drawChars;n.push([e,t,c,a,1,null,null])}if(E)for(r=0,a=i.length;r<a;++r){l=i[r],o=l[4],c=this.createLabel(o,w,E,``),h=l[2],g=De*c.height-Ae;let a=this.calculateImageOrLabelDimensions_(c.width,c.height,l[0],l[1],c.width,c.height,h,g,0,0,l[3],I,!1,Xi,!1,N);if(s&&_===`declutter`&&s.collides(a.declutterBox))break drawChars;n.push([e,t,c,a,1,null,null])}s&&_!==`none`&&s.load(n.map(Wo));for(let e=0,t=n.length;e<t;++e)this.replayImageOrLabel_.apply(this,n[e])}}++d;break;case U.END_GEOMETRY:if(a!==void 0){N=n[1];let e=a(N,P,_);if(e)return e}++d;break;case U.FILL:M?D++:this.fill_(e),++d;break;case U.MOVE_TO_LINE_TO:for(p=n[1],m=n[2],te=l[p],ne=l[p+1],e.moveTo(te,ne),v=te+.5|0,y=ne+.5|0,p+=2;p<m;p+=2)te=l[p],ne=l[p+1],b=te+.5|0,x=ne+.5|0,(p==m-2||b!==v||x!==y)&&(e.lineTo(te,ne),v=b,y=x);++d;break;case U.SET_FILL_STYLE:this.alignAndScaleFill_=n[2],D&&(this.fill_(e),D=0,O&&=(e.stroke(),0)),e.fillStyle=n[1],++d;break;case U.SET_STROKE_STYLE:O&&=(e.stroke(),0),this.setStrokeStyle_(e,n),++d;break;case U.STROKE:M?O++:e.stroke(),++d;break;default:++d;break}}D&&this.fill_(e),O&&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)}};const Xo=[`Polygon`,`Circle`,`LineString`,`Image`,`Text`,`Default`],Zo=[`Image`,`Text`],Qo=Xo.filter(e=>!Zo.includes(e));var $o=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_=Cn(),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 Yo(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,o){r=Math.round(r);let s=r*2+1,c=Tn(this.hitDetectionTransform_,r+.5,r+.5,1/t,-1/t,-n,-e[0],-e[1]),l=!this.hitDetectionContext_;l&&(this.hitDetectionContext_=V(s,s));let u=this.hitDetectionContext_;u.canvas.width!==s||u.canvas.height!==s?(u.canvas.width=s,u.canvas.height=s):l||u.clearRect(0,0,s,s);let d;this.renderBuffer_!==void 0&&(d=de(),ve(d,e),ie(d,t*(this.renderBuffer_+r),d));let f=ts(r),p;function m(e,t,n){let a=u.getImageData(0,0,s,s).data;for(let c=0,l=f.length;c<l;c++)if(a[f[c]]>0){if(!o||n===`none`||p!==`Image`&&p!==`Text`||o.includes(e)){let n=(f[c]-3)/4,a=r-n%s,o=r-(n/s|0),l=i(e,t,a*a+o*o);if(l)return l}u.clearRect(0,0,s,s);break}}let h=Object.keys(this.executorsByZIndex_).map(Number);h.sort(a);let g,_,v,y,b;for(g=h.length-1;g>=0;--g){let e=h[g].toString();for(v=this.executorsByZIndex_[e],_=Xo.length-1;_>=0;--_)if(p=Xo[_],y=v[p],y!==void 0&&(b=y.executeHitDetection(u,c,n,m,d),b))return b}}getClipCoords(e){let t=this.maxExtent_;if(!t)return null;let n=t[0],r=t[1],i=t[2],a=t[3],o=[n,r,n,a,i,a,i,r];return Mn(o,0,8,2,e,o),o}isEmpty(){return v(this.executorsByZIndex_)}execute(e,t,n,r,i,s,c){let l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(c?o:a),s||=Xo;let u=Xo.length;for(let a=0,o=l.length;a<o;++a){let o=l[a].toString(),d=this.executorsByZIndex_[o];for(let o=0,f=s.length;o<f;++o){let f=s[o],p=d[f];if(p!==void 0){let o=c===null?void 0:p.getZIndexContext(),s=o?o.getContext():e,d=this.maxExtent_&&f!==`Image`&&f!==`Text`;if(d&&(s.save(),this.clip(s,n)),!o||f===`Text`||f===`Image`?p.execute(s,t,n,r,i,c):o.pushFunction(e=>p.execute(e,t,n,r,i,c)),d&&s.restore(),o){o.offset();let e=l[a]*u+Xo.indexOf(f);this.deferredZIndexContexts_[e]||(this.deferredZIndexContexts_[e]=[]),this.deferredZIndexContexts_[e].push(o)}}}}this.renderedContext_=e}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){let e=this.deferredZIndexContexts_,t=Object.keys(e).map(Number).sort(a);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}};const es={};function ts(e){if(es[e]!==void 0)return es[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 es[e]=i,i}function ns(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 rs=class e extends mo{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?!1: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;let a=e.img===void 0?null:e.img,o=e.src;N(!(o!==void 0&&a),"`image` and `src` cannot be provided at the same time"),(o===void 0||o.length===0)&&a&&(o=a.src||O(a)),N(o!==void 0&&o.length>0,"A defined and non-empty `src` or `image` must be provided"),N(!((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?B.LOADED:B.IDLE:B.LOADING:B.LOADED):s=B.IDLE,this.color_=e.color===void 0?null:Si(e.color),this.iconImage_=Mi(a,o,this.crossOrigin_,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();this.setScale(ns(n[0],n[1],e.width,e.height))};this.listenImageChange(t);return}}t!==void 0&&this.setScale(ns(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_,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_}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()}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()==B.LOADED)return this.iconImage_.getSize()[0]*e[0]}getHeight(){let e=this.getScaleArray();if(this.size_)return this.size_[1]*e[1];if(this.iconImage_.getImageState()==B.LOADED)return this.iconImage_.getSize()[1]*e[1]}setScale(e){delete this.initialOptions_,super.setScale(e)}listenImageChange(e){this.iconImage_.addEventListener(n.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(n.CHANGE,e)}ready(){return this.iconImage_.ready()}};const os=.5;function ss(e,t,n,r,i,o,s,c,l){let u=l?yn(i,l):i,d=e[0]*os,f=e[1]*os,p=V(d,f);p.imageSmoothingEnabled=!1;let m=p.canvas,h=new da(p,os,i,null,s,c,l?fn(gn(),l):null),g=n.length,_=Math.floor((256*256*256-1)/g),v={};for(let e=1;e<=g;++e){let t=n[e-1],i=t.getStyleFunction()||r;if(!i)continue;let a=i(t,o);if(!a)continue;Array.isArray(a)||(a=[a]);let s=e*_,c=s.toString(16).padStart(7,`#00000`);for(let e=0,n=a.length;e<n;++e){let n=a[e],r=n.getGeometryFunction()(t);if(!r||!Me(u,r.getExtent()))continue;let i=n.clone(),o=i.getFill();o&&o.setColor(c);let s=i.getStroke();s&&(s.setColor(c),s.setLineDash(null)),i.setText(void 0);let l=n.getImage();if(l){let e=l.getImageSize();if(!e)continue;let t=V(e[0],e[1],void 0,{alpha:!1}),n=t.canvas;t.fillStyle=c,t.fillRect(0,0,n.width,n.height),i.setImage(new rs({img:n,anchor:l.getAnchor(),anchorXUnits:`pixels`,anchorYUnits:`pixels`,offset:l.getOrigin(),opacity:1,size:l.getSize(),scale:l.getScale(),rotation:l.getRotation(),rotateWithView:l.getRotateWithView()}))}let d=i.getZIndex()||0,f=v[d];f||(f={},v[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 y=Object.keys(v).map(Number).sort(a);for(let e=0,n=y.length;e<n;++e){let n=v[y[e]];for(let e in n){let r=n[e];for(let e=0,n=r.length;e<n;e+=2){h.setStyle(r[e+1]);for(let n=0,i=t.length;n<i;++n)h.setTransform(t[n]),h.drawGeometry(r[e])}}}return p.getImageData(0,0,m.width,m.height)}function cs(e,t,n){let r=[];if(n){let i=Math.floor(Math.round(e[0])*os),a=Math.floor(Math.round(e[1])*os),o=(L(i,0,n.width-1)+L(a,0,n.height-1)*n.width)*4,s=n.data[o],c=n.data[o+1],l=n.data[o+2],u=l+256*(c+256*s),d=Math.floor((256*256*256-1)/t.length);u&&u%d===0&&r.push(t[u/d-1])}return r}var ls=class extends y{constructor(e,t,n,r){super(e),this.inversePixelTransform=t,this.frameState=n,this.context=r}},us=class extends w{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.staleKeys_=[],this.maxStaleKeys=5}getStaleKeys(){return this.staleKeys_}prependStaleKey(e){this.staleKeys_.unshift(e),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}getFeatures(e){return E()}getData(e){return null}prepareFrame(e){return E()}renderFrame(e,t){return E()}forEachFeatureAtCoordinate(e,t,n,r,i){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){let t=e.target;(t.getState()===B.LOADED||t.getState()===B.ERROR)&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=B.LOADED&&t!=B.ERROR&&e.addEventListener(n.CHANGE,this.boundHandleImageChange_),t==B.IDLE&&(e.load(),t=e.getState()),t==B.LOADED}renderIfReadyAndVisible(){let e=this.getLayer();e&&e.getVisible()&&e.getSourceState()===`ready`&&e.changed()}renderDeferred(e){}disposeInternal(){delete this.layer_,super.disposeInternal()}};const ds=[];let fs=null;function ps(){fs=V(1,1,void 0,{willReadFrequently:!0})}var ms=class extends us{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=Cn(),this.pixelTransform=Cn(),this.inversePixelTransform=Cn(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,n){fs||ps(),fs.clearRect(0,0,1,1);let r;try{fs.drawImage(e,t,n,1,1,0,0,1,1),r=fs.getImageData(0,0,1,1).data}catch{return fs=null,null}return r}getBackground(e){let t=this.getLayer(),n=t.getBackground();return typeof n==`function`&&(n=n(e.viewState.resolution)),n||void 0}useContainer(e,t,n){let r=this.getLayer().getClassName(),i,a;if(e&&e.className===r&&(!n||e&&e.style.backgroundColor&&u(Si(e.style.backgroundColor),Si(n)))){let t=e.firstElementChild;t instanceof HTMLCanvasElement&&(a=t.getContext(`2d`))}if(a&&jn(a.canvas.style.transform,t)?(this.container=e,this.context=a,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){i=document.createElement(`div`),i.className=r;let e=i.style;e.position=`absolute`,e.width=`100%`,e.height=`100%`,a=V();let t=a.canvas;i.appendChild(t),e=t.style,e.position=`absolute`,e.left=`0`,e.transformOrigin=`top left`,this.container=i,this.context=a}!this.containerReused&&n&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=n)}clipUnrotated(e,t,n){let r=Ae(n),i=je(n),a=we(n),o=Ce(n);z(t.coordinateToPixelTransform,r),z(t.coordinateToPixelTransform,i),z(t.coordinateToPixelTransform,a),z(t.coordinateToPixelTransform,o);let s=this.inversePixelTransform;z(s,r),z(s,i),z(s,a),z(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=e.viewState.rotation,a=e.pixelRatio,o=Math.round(I(n)/r*a),s=Math.round(F(n)/r*a);Tn(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/a,1/a,i,-o/2,-s/2),En(this.inversePixelTransform,this.pixelTransform);let c=kn(this.pixelTransform);if(this.useContainer(t,c,this.getBackground(e)),!this.containerReused){let e=this.context.canvas;e.width!=o||e.height!=s?(e.width=o,e.height=s):this.context.clearRect(0,0,o,s),c!==e.style.transform&&(e.style.transform=c)}}dispatchRenderEvent_(e,t,n){let r=this.getLayer();if(r.hasListener(e)){let i=new ls(e,this.inversePixelTransform,n,t);r.dispatchEvent(i)}}preRender(e,t){this.frameState=t,!t.declutter&&this.dispatchRenderEvent_(Br.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(Br.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new Ro),e.declutter?this.deferredContext_.getContext():this.context}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(Br.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(Br.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 Tn(this.tempTransform,s,c,l,u,-n,d,f)}disposeInternal(){delete this.frameState,super.disposeInternal()}},hs=class extends ms{constructor(e){super(e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipped_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=de(),this.wrappedRenderedExtent_=de(),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}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[H.ANIMATING]||p[H.INTERACTING]),h=this.context,g=Math.round(I(r)/o*f),_=Math.round(F(r)/o*f),v=u.getWrapX()&&s.canWrapX(),y=v?I(l):null,b=v?Math.ceil((r[2]-l[2])/y)+1:1,x=v?Math.floor((r[0]-l[0])/y):0;do{let r=this.getRenderTransform(a,o,0,f,g,_,x*y);t.declutter&&(r=r.slice(0)),e.execute(h,[h.canvas.width,h.canvas.height],r,c,m,n===void 0?Xo:n?Zo:Qo,n?d&&t.declutter[d]:void 0)}while(++x<b)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=V(this.context.canvas.width,this.context.canvas.height,ds))}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,Zr(this.context),ds.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.replayGroup_.renderDeferred(),this.clipped_&&this.context.restore(),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){let e=this.getLayer().hasListener(Br.PRERENDER)||this.getLayer().hasListener(Br.POSTRENDER);if(!e)return this.container}this.setDrawContext_(),this.preRender(i,e);let s=r.projection;if(this.clipped_=!1,o&&n.extent&&this.clipping){let t=bn(n.extent,s);o=Me(t,e.extent),this.clipped_=o&&!ce(t,e.extent),this.clipped_&&this.clipUnrotated(i,e,t)}return o&&this.renderWorlds(a,e,this.getLayer().getDeclutter()?!1:void 0),!e.declutter&&this.clipped_&&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]*os,l=e[1]*os;s.push(this.getRenderTransform(t,n,r,os,c,l,0).slice());let u=o.getSource(),d=i.getExtent();if(u.getWrapX()&&i.canWrapX()&&!ce(d,a)){let e=a[0],i=I(d),o=0,u;for(;e<d[0];)--o,u=i*o,s.push(this.getRenderTransform(t,n,r,os,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,os,c,l,u).slice()),e-=i}let f=gn();this.hitDetectionImageData_=ss(e,s,this.renderedFeatures_,o.getStyleFunction(),a,n,r,ma(n,this.renderedPixelRatio_),f?i:null)}t(cs(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=O(e),o=c[a];if(o){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}}else{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})}},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[H.ANIMATING],i=e.viewHints[H.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,d=c.resolution,f=e.pixelRatio,p=t.getRevision(),m=t.getRenderBuffer(),h=t.getRenderOrder();h===void 0&&(h=pa);let g=c.center.slice(),_=ie(s,m*d),v=_.slice(),y=[_.slice()],b=l.getExtent();if(n.getWrapX()&&l.canWrapX()&&!ce(b,e.extent)){let e=I(b),t=Math.max(I(_)/2,e);_[0]=b[0]-t,_[2]=b[2]+t,rt(g,l);let n=Ie(y[0],l);n[0]<b[0]&&n[2]<b[2]?y.push([n[0]+e,n[1],n[2]+e,n[3]]):n[0]>b[0]&&n[2]>b[2]&&y.push([n[0]-e,n[1],n[2]-e,n[3]])}if(this.ready&&this.renderedResolution_==d&&this.renderedRevision_==p&&this.renderedRenderOrder_==h&&this.renderedFrameDeclutter_===!!e.declutter&&ce(this.wrappedRenderedExtent_,_))return u(this.renderedExtent_,v)||(this.hitDetectionImageData_=null,this.renderedExtent_=v),this.renderedCenter_=g,this.replayGroupChanged=!1,!0;this.replayGroup_=null;let x=new Io(ha(d,f),_,d,f),S=gn(),C;if(S){for(let e=0,t=y.length;e<t;++e){let t=y[e],r=yn(t,l);n.loadFeatures(r,xn(d,l),S)}C=fn(S,l)}else for(let e=0,t=y.length;e<t;++e)n.loadFeatures(y[e],d,l);let w=ma(d,f),T=!0,E=(e,n)=>{let r,i=e.getStyleFunction()||t.getStyleFunction();if(i&&(r=i(e,d)),r){let t=this.renderFeature(e,w,r,x,C,this.getLayer().getDeclutter(),n);T&&=!t}},D=yn(_,l),O=n.getFeaturesInExtent(D);h&&O.sort(h);for(let e=0,t=O.length;e<t;++e)E(O[e],e);this.renderedFeatures_=O,this.ready=T;let k=x.finish(),A=new $o(_,d,f,n.getOverlaps(),k,t.getRenderBuffer(),!!e.declutter);return this.renderedResolution_=d,this.renderedRevision_=p,this.renderedRenderOrder_=h,this.renderedFrameDeclutter_=!!e.declutter,this.renderedExtent_=v,this.wrappedRenderedExtent_=_,this.renderedCenter_=g,this.renderedProjection_=l,this.renderedPixelRatio_=f,this.replayGroup_=A,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(e,t,n,r,i,a,o){if(!n)return!1;let s=!1;if(Array.isArray(n))for(let c=0,l=n.length;c<l;++c)s=_a(r,e,n[c],t,this.boundHandleStyleImageChange_,i,a,o)||s;else s=_a(r,e,n,t,this.boundHandleStyleImageChange_,i,a,o);return s}};let gs=0;const _s=1<<gs++,W=1<<gs++,vs=1<<gs++,ys=1<<gs++,bs=1<<gs++,xs=1<<gs++,Ss=2**gs-1,Cs={[_s]:`boolean`,[W]:`number`,[vs]:`string`,[ys]:`color`,[bs]:`number[]`,[xs]:`size`},ws=Object.keys(Cs).map(Number).sort(a);function Ts(e){return e in Cs}function Es(e){let t=[];for(let n of ws)Ds(e,n)&&t.push(Cs[n]);return t.length===0?`untyped`:t.length<3?t.join(` or `):t.slice(0,-1).join(`, `)+`, or `+t[t.length-1]}function Ds(e,t){return(e&t)===t}function Os(e,t){return e===t}var G=class{constructor(e,t){if(!Ts(e))throw Error(`literal expressions must have a specific type, got ${Es(e)}`);this.type=e,this.value=t}},ks=class{constructor(e,t,...n){this.type=e,this.operator=t,this.args=n}};function As(){return{variables:new Set,properties:new Set,featureId:!1,geometryType:!1,mapState:!1}}function K(e,t,n){switch(typeof e){case`boolean`:if(Os(t,vs))return new G(vs,e?`true`:`false`);if(!Ds(t,_s))throw Error(`got a boolean, but expected ${Es(t)}`);return new G(_s,e);case`number`:if(Os(t,xs))return new G(xs,po(e));if(Os(t,_s))return new G(_s,!!e);if(Os(t,vs))return new G(vs,e.toString());if(!Ds(t,W))throw Error(`got a number, but expected ${Es(t)}`);return new G(W,e);case`string`:if(Os(t,ys))return new G(ys,xi(e));if(Os(t,_s))return new G(_s,!!e);if(!Ds(t,vs))throw Error(`got a string, but expected ${Es(t)}`);return new G(vs,e);default:}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 Ks(e,t,n);for(let t of e)if(typeof t!=`number`)throw Error(`expected an array of numbers`);if(Os(t,xs)){if(e.length!==2)throw Error(`expected an array of two values for a size, got ${e.length}`);return new G(xs,e)}if(Os(t,ys)){if(e.length===3)return new G(ys,[...e,1]);if(e.length===4)return new G(ys,e);throw Error(`expected an array of 3 or 4 values for a color, got ${e.length}`)}if(!Ds(t,bs))throw Error(`got an array of numbers, but expected ${Es(t)}`);return new G(bs,e)}const q={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`,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`},js={[q.Get]:X(J(1,1/0),Ms),[q.Var]:X(J(1,1),Ns),[q.Has]:X(J(1,1/0),Ms),[q.Id]:X(Ps,Ls),[q.Concat]:X(J(2,1/0),Y(vs)),[q.GeometryType]:X(Fs,Ls),[q.LineMetric]:X(Ls),[q.Resolution]:X(Is,Ls),[q.Zoom]:X(Is,Ls),[q.Time]:X(Is,Ls),[q.Any]:X(J(2,1/0),Y(_s)),[q.All]:X(J(2,1/0),Y(_s)),[q.Not]:X(J(1,1),Y(_s)),[q.Equal]:X(J(2,2),Y(Ss)),[q.NotEqual]:X(J(2,2),Y(Ss)),[q.GreaterThan]:X(J(2,2),Y(W)),[q.GreaterThanOrEqualTo]:X(J(2,2),Y(W)),[q.LessThan]:X(J(2,2),Y(W)),[q.LessThanOrEqualTo]:X(J(2,2),Y(W)),[q.Multiply]:X(J(2,1/0),Rs),[q.Coalesce]:X(J(2,1/0),Rs),[q.Divide]:X(J(2,2),Y(W)),[q.Add]:X(J(2,1/0),Y(W)),[q.Subtract]:X(J(2,2),Y(W)),[q.Clamp]:X(J(3,3),Y(W)),[q.Mod]:X(J(2,2),Y(W)),[q.Pow]:X(J(2,2),Y(W)),[q.Abs]:X(J(1,1),Y(W)),[q.Floor]:X(J(1,1),Y(W)),[q.Ceil]:X(J(1,1),Y(W)),[q.Round]:X(J(1,1),Y(W)),[q.Sin]:X(J(1,1),Y(W)),[q.Cos]:X(J(1,1),Y(W)),[q.Atan]:X(J(1,2),Y(W)),[q.Sqrt]:X(J(1,1),Y(W)),[q.Match]:X(J(4,1/0),Bs,Vs),[q.Between]:X(J(3,3),Y(W)),[q.Interpolate]:X(J(6,1/0),Bs,Hs),[q.Case]:X(J(3,1/0),zs,Us),[q.In]:X(J(2,2),Ws),[q.Number]:X(J(1,1/0),Y(Ss)),[q.String]:X(J(1,1/0),Y(Ss)),[q.Array]:X(J(1,1/0),Y(W)),[q.Color]:X(J(1,4),Y(W)),[q.Band]:X(J(1,3),Y(W)),[q.Palette]:X(J(2,2),Gs),[q.ToString]:X(J(1,1),Y(_s|W|vs|ys))};function Ms(e,t,n){let r=e.length-1,i=Array(r);for(let t=0;t<r;++t){let r=e[t+1];switch(typeof r){case`number`:i[t]=new G(W,r);break;case`string`:i[t]=new G(vs,r);break;default:throw Error(`expected a string key or numeric array index for a get operation, got ${r}`)}t===0&&n.properties.add(String(r))}return i}function Ns(e,t,n){let r=e[1];if(typeof r!=`string`)throw Error(`expected a string argument for var operation`);return n.variables.add(r),[new G(vs,r)]}function Ps(e,t,n){n.featureId=!0}function Fs(e,t,n){n.geometryType=!0}function Is(e,t,n){n.mapState=!0}function Ls(e,t,n){let r=e[0];if(e.length!==1)throw Error(`expected no arguments for ${r} operation`);return[]}function J(e,t){return function(n,r,i){let a=n[0],o=n.length-1;if(e===t){if(o!==e){let t=e===1?``:`s`;throw Error(`expected ${e} argument${t} 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 Rs(e,t,n){let r=e.length-1,i=Array(r);for(let a=0;a<r;++a){let r=K(e[a+1],t,n);i[a]=r}return i}function Y(e){return function(t,n,r){let i=t.length-1,a=Array(i);for(let n=0;n<i;++n){let i=K(t[n+1],e,r);a[n]=i}return a}}function zs(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 Bs(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 Vs(e,t,n){let r=e.length-1,i=vs|W|_s,a=K(e[1],i,n),o=K(e[e.length-1],t,n),s=Array(r-2);for(let t=0;t<r-2;t+=2){try{let r=K(e[t+2],a.type,n);s[t]=r}catch(e){throw Error(`failed to parse argument ${t+1} of match expression: ${e.message}`)}try{let r=K(e[t+3],o.type,n);s[t+1]=r}catch(e){throw Error(`failed to parse argument ${t+2} of match expression: ${e.message}`)}}return[a,...s,o]}function Hs(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 G(W,i),o;try{o=K(e[2],W,n)}catch(e){throw Error(`failed to parse argument 1 in interpolate expression: ${e.message}`)}let s=Array(e.length-3);for(let r=0;r<s.length;r+=2){try{let t=K(e[r+3],W,n);s[r]=t}catch(e){throw Error(`failed to parse argument ${r+2} for interpolate expression: ${e.message}`)}try{let i=K(e[r+4],t,n);s[r+1]=i}catch(e){throw Error(`failed to parse argument ${r+3} for interpolate expression: ${e.message}`)}}return[a,o,...s]}function Us(e,t,n){let r=K(e[e.length-1],t,n),i=Array(e.length-1);for(let t=0;t<i.length-1;t+=2){try{let r=K(e[t+1],_s,n);i[t]=r}catch(e){throw Error(`failed to parse argument ${t} of case expression: ${e.message}`)}try{let a=K(e[t+2],r.type,n);i[t+1]=a}catch(e){throw Error(`failed to parse argument ${t+1} of case expression: ${e.message}`)}}return i[i.length-1]=r,i}function Ws(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(typeof r[0]==`string`){if(r[0]!==`literal`)throw Error(`for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions`);if(!Array.isArray(r[1]))throw Error(`failed to parse "in" expression: the literal operator must be followed by an array`);r=r[1],i=vs}else i=W;let a=Array(r.length);for(let e=0;e<a.length;e++)try{let t=K(r[e],i,n);a[e]=t}catch(t){throw Error(`failed to parse haystack item ${e} for "in" expression: ${t.message}`)}let o=K(e[1],i,n);return[o,...a]}function Gs(e,t,n){let r;try{r=K(e[1],W,n)}catch(e){throw Error(`failed to parse first argument in palette expression: ${e.message}`)}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=K(i[e],ys,n)}catch(t){throw Error(`failed to parse color at index ${e} in palette expression: ${t.message}`)}if(!(t instanceof G))throw Error(`the palette color at index ${e} must be a literal value`);a[e]=t}return[r,...a]}function X(...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 ks(n,i,...a)}}function Ks(e,t,n){let r=e[0],i=js[r];if(!i)throw Error(`unknown operator: ${r}`);return i(e,t,n)}function qs(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 qs(e.getGeometries()[0]);default:return``}}function Js(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:``}}function Ys(e,t,n){let r=K(e,t,n);return Xs(r,n)}function Xs(e,t){if(e instanceof G){if(e.type===ys&&typeof e.value==`string`){let t=xi(e.value);return function(){return t}}return function(){return e.value}}let n=e.operator;switch(n){case q.Number:case q.String:case q.Coalesce:return Zs(e,t);case q.Get:case q.Var:case q.Has:return Qs(e,t);case q.Id:return e=>e.featureId;case q.GeometryType:return e=>e.geometryType;case q.Concat:{let n=e.args.map(e=>Xs(e,t));return e=>``.concat(...n.map(t=>t(e).toString()))}case q.Resolution:return e=>e.resolution;case q.Any:case q.All:case q.Between:case q.In:case q.Not:return ec(e,t);case q.Equal:case q.NotEqual:case q.LessThan:case q.LessThanOrEqualTo:case q.GreaterThan:case q.GreaterThanOrEqualTo:return $s(e,t);case q.Multiply:case q.Divide:case q.Add:case q.Subtract:case q.Clamp:case q.Mod:case q.Pow:case q.Abs:case q.Floor:case q.Ceil:case q.Round:case q.Sin:case q.Cos:case q.Atan:case q.Sqrt:return tc(e,t);case q.Case:return nc(e,t);case q.Match:return rc(e,t);case q.Interpolate:return ic(e,t);case q.ToString:return ac(e,t);default:throw Error(`Unsupported operator ${n}`)}}function Zs(e,t){let n=e.operator,r=e.args.length,i=Array(r);for(let n=0;n<r;++n)i[n]=Xs(e.args[n],t);switch(n){case q.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 q.Number:case q.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 Qs(e,t){let n=e.args[0],r=n.value;switch(e.operator){case q.Get:return t=>{let n=e.args,i=t.properties[r];for(let e=1,t=n.length;e<t;++e){let t=n[e],r=t.value;i=i[r]}return i};case q.Var:return e=>e.variables[r];case q.Has:return t=>{let n=e.args;if(!(r in t.properties))return!1;let i=t.properties[r];for(let e=1,t=n.length;e<t;++e){let t=n[e],r=t.value;if(!i||!Object.hasOwn(i,r))return!1;i=i[r]}return!0};default:throw Error(`Unsupported accessor operator ${e.operator}`)}}function $s(e,t){let n=e.operator,r=Xs(e.args[0],t),i=Xs(e.args[1],t);switch(n){case q.Equal:return e=>r(e)===i(e);case q.NotEqual:return e=>r(e)!==i(e);case q.LessThan:return e=>r(e)<i(e);case q.LessThanOrEqualTo:return e=>r(e)<=i(e);case q.GreaterThan:return e=>r(e)>i(e);case q.GreaterThanOrEqualTo:return e=>r(e)>=i(e);default:throw Error(`Unsupported comparison operator ${n}`)}}function ec(e,t){let n=e.operator,r=e.args.length,i=Array(r);for(let n=0;n<r;++n)i[n]=Xs(e.args[n],t);switch(n){case q.Any:return e=>{for(let t=0;t<r;++t)if(i[t](e))return!0;return!1};case q.All:return e=>{for(let t=0;t<r;++t)if(!i[t](e))return!1;return!0};case q.Between:return e=>{let t=i[0](e),n=i[1](e),r=i[2](e);return t>=n&&t<=r};case q.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 q.Not:return e=>!i[0](e);default:throw Error(`Unsupported logical operator ${n}`)}}function tc(e,t){let n=e.operator,r=e.args.length,i=Array(r);for(let n=0;n<r;++n)i[n]=Xs(e.args[n],t);switch(n){case q.Multiply:return e=>{let t=1;for(let n=0;n<r;++n)t*=i[n](e);return t};case q.Divide:return e=>i[0](e)/i[1](e);case q.Add:return e=>{let t=0;for(let n=0;n<r;++n)t+=i[n](e);return t};case q.Subtract:return e=>i[0](e)-i[1](e);case q.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 q.Mod:return e=>i[0](e)%i[1](e);case q.Pow:return e=>i[0](e)**+i[1](e);case q.Abs:return e=>Math.abs(i[0](e));case q.Floor:return e=>Math.floor(i[0](e));case q.Ceil:return e=>Math.ceil(i[0](e));case q.Round:return e=>Math.round(i[0](e));case q.Sin:return e=>Math.sin(i[0](e));case q.Cos:return e=>Math.cos(i[0](e));case q.Atan:return r===2?e=>Math.atan2(i[0](e),i[1](e)):e=>Math.atan(i[0](e));case q.Sqrt:return e=>Math.sqrt(i[0](e));default:throw Error(`Unsupported numeric operator ${n}`)}}function nc(e,t){let n=e.args.length,r=Array(n);for(let i=0;i<n;++i)r[i]=Xs(e.args[i],t);return e=>{for(let t=0;t<n-1;t+=2){let n=r[t](e);if(n)return r[t+1](e)}return r[n-1](e)}}function rc(e,t){let n=e.args.length,r=Array(n);for(let i=0;i<n;++i)r[i]=Xs(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 ic(e,t){let n=e.args.length,r=Array(n);for(let i=0;i<n;++i)r[i]=Xs(e.args[i],t);return e=>{let t=r[0](e),i=r[1](e),a,o;for(let s=2;s<n;s+=2){let n=r[s](e),c=r[s+1](e),l=Array.isArray(c);if(l&&(c=mi(c)),n>=i)return s===2?c:l?sc(t,i,a,o,n,c):oc(t,i,a,o,n,c);a=n,o=c}return o}}function ac(e,t){let n=e.operator,r=e.args.length,i=Array(r);for(let n=0;n<r;++n)i[n]=Xs(e.args[n],t);switch(n){case q.ToString:return t=>{let n=i[0](t);return e.args[0].type===ys?Ci(n):n.toString()};default:throw Error(`Unsupported convert operator ${n}`)}}function oc(e,t,n,r,i,a){let o=i-n;if(o===0)return r;let s=t-n,c=e===1?s/o:(e**+s-1)/(e**+o-1);return r+c*(a-r)}function sc(e,t,n,r,i,a){let o=i-n;if(o===0)return r;let s=yi(r),c=yi(a),l=c[2]-s[2];l>180?l-=360:l<-180&&(l+=360);let u=[oc(e,t,n,s[0],i,c[0]),oc(e,t,n,s[1],i,c[1]),s[2]+oc(e,t,n,0,i,l),oc(e,t,n,r[3],i,a[3])];return bi(u)}function cc(e){return!0}function lc(e){let t=As(),n=dc(e,t),r=Js();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}return t.geometryType&&(r.geometryType=qs(e.getGeometry())),n(r)}}function uc(e){let t=As(),n=e.length,r=Array(n);for(let i=0;i<n;++i)r[i]=fc(e[i],t);let i=Js(),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}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 dc(e,t){let n=e.length,r=Array(n);for(let i=0;i<n;++i){let n=e[i],a=`filter`in n?Ys(n.filter,_s,t):cc,o;if(Array.isArray(n.style)){let e=n.style.length;o=Array(e);for(let r=0;r<e;++r)o[r]=fc(n.style[r],t)}else o=[fc(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);if(!n)continue;i.push(n)}}}return i}}function fc(e,t){let n=pc(e,``,t),r=mc(e,``,t),i=hc(e,t),a=gc(e,t),o=bc(e,`z-index`,t);if(!n&&!r&&!i&&!a&&!v(e))throw Error(`No fill, stroke, point, or text symbolizer properties in style: `+JSON.stringify(e));let s=new _o;return function(e){let t=!0;if(n){let r=n(e);r&&(t=!1),s.setFill(r)}if(r){let n=r(e);n&&(t=!1),s.setStroke(n)}if(i){let n=i(e);n&&(t=!1),s.setText(n)}if(a){let n=a(e);n&&(t=!1),s.setImage(n)}return o&&s.setZIndex(o(e)),t?null:s}}function pc(e,t,n){let r;if(t+`fill-pattern-src`in e)r=Sc(e,t+`fill-`,n);else{if(e[t+`fill-color`]===`none`)return e=>null;r=wc(e,t+`fill-color`,n)}if(!r)return null;let i=new co;return function(e){let t=r(e);return t===ti?null:(i.setColor(t),i)}}function mc(e,t,n){let r=bc(e,t+`stroke-width`,n),i=wc(e,t+`stroke-color`,n);if(!r&&!i)return null;let a=xc(e,t+`stroke-line-cap`,n),o=xc(e,t+`stroke-line-join`,n),s=Tc(e,t+`stroke-line-dash`,n),c=bc(e,t+`stroke-line-dash-offset`,n),l=bc(e,t+`stroke-miter-limit`,n),u=new lo;return function(e){if(i){let t=i(e);if(t===ti)return null;u.setColor(t)}if(r&&u.setWidth(r(e)),a){let t=a(e);if(t!==`butt`&&t!==`round`&&t!==`square`)throw Error(`Expected butt, round, or square line cap`);u.setLineCap(t)}if(o){let t=o(e);if(t!==`bevel`&&t!==`round`&&t!==`miter`)throw Error(`Expected bevel, round, or miter line join`);u.setLineJoin(t)}return s&&u.setLineDash(s(e)),c&&u.setLineDashOffset(c(e)),l&&u.setMiterLimit(l(e)),u}}function hc(e,t){let n=`text-`,r=xc(e,n+`value`,t);if(!r)return null;let i=pc(e,n,t),a=pc(e,n+`background-`,t),o=mc(e,n,t),s=mc(e,n+`background-`,t),c=xc(e,n+`font`,t),l=bc(e,n+`max-angle`,t),u=bc(e,n+`offset-x`,t),d=bc(e,n+`offset-y`,t),f=Cc(e,n+`overflow`,t),p=xc(e,n+`placement`,t),m=bc(e,n+`repeat`,t),h=Oc(e,n+`scale`,t),g=Cc(e,n+`rotate-with-view`,t),_=bc(e,n+`rotation`,t),v=xc(e,n+`align`,t),y=xc(e,n+`justify`,t),b=xc(e,n+`baseline`,t),x=Cc(e,n+`keep-upright`,t),S=Tc(e,n+`padding`,t),C=Fc(e,n+`declutter-mode`),w=new So({declutterMode:C});return function(e){if(w.setText(r(e)),i&&w.setFill(i(e)),a&&w.setBackgroundFill(a(e)),o&&w.setStroke(o(e)),s&&w.setBackgroundStroke(s(e)),c&&w.setFont(c(e)),l&&w.setMaxAngle(l(e)),u&&w.setOffsetX(u(e)),d&&w.setOffsetY(d(e)),f&&w.setOverflow(f(e)),p){let t=p(e);if(t!==`point`&&t!==`line`)throw Error(`Expected point or line for text-placement`);w.setPlacement(t)}if(m&&w.setRepeat(m(e)),h&&w.setScale(h(e)),g&&w.setRotateWithView(g(e)),_&&w.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`);w.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`);w.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`);w.setTextBaseline(t)}return S&&w.setPadding(S(e)),x&&w.setKeepUpright(x(e)),w}}function gc(e,t){return`icon-src`in e?_c(e,t):`shape-points`in e?vc(e,t):`circle-radius`in e?yc(e,t):null}function _c(e,t){let n=`icon-`,r=n+`src`,i=Rc(e[r],r),a=Ec(e,n+`anchor`,t),o=Oc(e,n+`scale`,t),s=bc(e,n+`opacity`,t),c=Ec(e,n+`displacement`,t),l=bc(e,n+`rotation`,t),u=Cc(e,n+`rotate-with-view`,t),d=Mc(e,n+`anchor-origin`),f=Nc(e,n+`anchor-x-units`),p=Nc(e,n+`anchor-y-units`),m=Ic(e,n+`color`),h=jc(e,n+`cross-origin`),g=Pc(e,n+`offset`),_=Mc(e,n+`offset-origin`),v=kc(e,n+`width`),y=kc(e,n+`height`),b=Ac(e,n+`size`),x=Fc(e,n+`declutter-mode`),S=new rs({src:i,anchorOrigin:d,anchorXUnits:f,anchorYUnits:p,color:m,crossOrigin:h,offset:g,offsetOrigin:_,height:y,width:v,size:b,declutterMode:x});return function(e){return s&&S.setOpacity(s(e)),c&&S.setDisplacement(c(e)),l&&S.setRotation(l(e)),u&&S.setRotateWithView(u(e)),o&&S.setScale(o(e)),a&&S.setAnchor(a(e)),S}}function vc(e,t){let n=`shape-`,r=n+`points`,i=n+`radius`,a=zc(e[r],r),o=zc(e[i],i),s=pc(e,n,t),c=mc(e,n,t),l=Oc(e,n+`scale`,t),u=Ec(e,n+`displacement`,t),d=bc(e,n+`rotation`,t),f=Cc(e,n+`rotate-with-view`,t),p=kc(e,n+`radius2`),m=kc(e,n+`angle`),h=Fc(e,n+`declutter-mode`),g=new ho({points:a,radius:o,radius2:p,angle:m,declutterMode:h});return function(e){return s&&g.setFill(s(e)),c&&g.setStroke(c(e)),u&&g.setDisplacement(u(e)),d&&g.setRotation(d(e)),f&&g.setRotateWithView(f(e)),l&&g.setScale(l(e)),g}}function yc(e,t){let n=`circle-`,r=pc(e,n,t),i=mc(e,n,t),a=bc(e,n+`radius`,t),o=Oc(e,n+`scale`,t),s=Ec(e,n+`displacement`,t),c=bc(e,n+`rotation`,t),l=Cc(e,n+`rotate-with-view`,t),u=Fc(e,n+`declutter-mode`),d=new go({radius:5,declutterMode:u});return function(e){return a&&d.setRadius(a(e)),r&&d.setFill(r(e)),i&&d.setStroke(i(e)),s&&d.setDisplacement(s(e)),c&&d.setRotation(c(e)),l&&d.setRotateWithView(l(e)),o&&d.setScale(o(e)),d}}function bc(e,t,n){if(!(t in e))return;let r=Ys(e[t],W,n);return function(e){return zc(r(e),t)}}function xc(e,t,n){if(!(t in e))return null;let r=Ys(e[t],vs,n);return function(e){return Rc(r(e),t)}}function Sc(e,t,n){let r=xc(e,t+`pattern-src`,n),i=Dc(e,t+`pattern-offset`,n),a=Dc(e,t+`pattern-size`,n),o=wc(e,t+`color`,n);return function(e){return{src:r(e),offset:i&&i(e),size:a&&a(e),color:o&&o(e)}}}function Cc(e,t,n){if(!(t in e))return null;let r=Ys(e[t],_s,n);return function(e){let n=r(e);if(typeof n!=`boolean`)throw Error(`Expected a boolean for ${t}`);return n}}function wc(e,t,n){if(!(t in e))return null;let r=Ys(e[t],ys,n);return function(e){return Bc(r(e),t)}}function Tc(e,t,n){if(!(t in e))return null;let r=Ys(e[t],bs,n);return function(e){return Lc(r(e),t)}}function Ec(e,t,n){if(!(t in e))return null;let r=Ys(e[t],bs,n);return function(e){let n=Lc(r(e),t);if(n.length!==2)throw Error(`Expected two numbers for ${t}`);return n}}function Dc(e,t,n){if(!(t in e))return null;let r=Ys(e[t],bs,n);return function(e){return Vc(r(e),t)}}function Oc(e,t,n){if(!(t in e))return null;let r=Ys(e[t],bs|W,n);return function(e){return Hc(r(e),t)}}function kc(e,t){let n=e[t];if(n!==void 0){if(typeof n!=`number`)throw Error(`Expected a number for ${t}`);return n}}function Ac(e,t){let n=e[t];if(n!==void 0){if(typeof n==`number`)return po(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 jc(e,t){let n=e[t];if(n!==void 0){if(typeof n!=`string`)throw Error(`Expected a string for ${t}`);return n}}function Mc(e,t){let n=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 Nc(e,t){let n=e[t];if(n!==void 0){if(n!==`pixels`&&n!==`fraction`)throw Error(`Expected pixels or fraction for ${t}`);return n}}function Pc(e,t){let n=e[t];if(n!==void 0)return Lc(n,t)}function Fc(e,t){let n=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 Ic(e,t){let n=e[t];if(n!==void 0)return Bc(n,t)}function Lc(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 Rc(e,t){if(typeof e!=`string`)throw Error(`Expected a string for ${t}`);return e}function zc(e,t){if(typeof e!=`number`)throw Error(`Expected a number for ${t}`);return e}function Bc(e,t){if(typeof e==`string`)return e;let n=Lc(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 Vc(e,t){let n=Lc(e,t);if(n.length!==2)throw Error(`Expected an array of two numbers for ${t}`);return n}function Hc(e,t){return typeof e==`number`?e:Vc(e,t)}var Uc={CENTER:`center`,RESOLUTION:`resolution`,ROTATION:`rotation`};function Wc(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,l=t?0:a[1]*i,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=L(r[0],f,p),_=L(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 Gc(e){return e}function Kc(e){return e**3}function qc(e){return 1-Kc(1-e)}function Jc(e){return 3*e*e-2*e*e*e}function Yc(e){return e}function Xc(e,t,n,r){let i=I(t)/n[0],a=F(t)/n[1];return r?Math.min(e,Math.max(i,a)):Math.min(e,Math.min(i,a))}function Zc(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),L(r,n/2,t*2)}function Qc(e,t,n,r){return t=t===void 0?!0:t,(function(i,a,o,c){if(i!==void 0){let l=e[0],u=e[e.length-1],d=n?Xc(l,n,o,r):l;if(c)return t?Zc(i,d,u):L(i,u,d);let f=Math.min(d,i),p=Math.floor(s(e,f,a));return e[p]>d&&p<e.length-1?e[p+1]:e[p]}})}function $c(e,t,n,r,i,a){return r=r===void 0?!0:r,n=n===void 0?0:n,(function(o,s,c,l){if(o!==void 0){let u=i?Xc(t,i,c,a):t;if(l)return r?Zc(o,u,n):L(o,n,u);let d=1e-9,f=Math.ceil(Math.log(t/u)/Math.log(e)-d),p=-s*(.5-d)+.5,m=Math.min(u,o),h=Math.floor(Math.log(t/m)/Math.log(e)+p),g=Math.max(f,h),_=t/e**+g;return L(_,n,u)}})}function el(e,t,n,r,i){return n=n===void 0?!0:n,(function(a,o,s,c){if(a!==void 0){let o=r?Xc(e,r,s,i):e;return!n||!c?L(a,t,o):Zc(a,o,t)}})}function tl(e){if(e!==void 0)return 0}function nl(e){if(e!==void 0)return e}function rl(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 il(e){let t=e===void 0?He(5):e;return(function(e,n){return n||e===void 0?e:Math.abs(e)<=t?0:e})}var al=class extends A{constructor(e){super(),this.on,this.once,this.un,e=Object.assign({},e),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=cn(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&&en(),e.center&&=vn(e.center,this.projection_),e.extent&&=bn(e.extent,this.projection_),this.applyOptions_(e)}applyOptions_(e){let t=Object.assign({},e);for(let e in Uc)delete t[e];this.setProperties(t,!0);let n=cl(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=sl(e),i=n.constraint,a=ll(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),vn(n.center,this.getProjection())),n.anchor&&=(n=Object.assign({},n),vn(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&&ol(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||Jc,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=Ue(e.rotation-s+Math.PI,2*Math.PI)-Math.PI;t.targetRotation=s+n,s=t.targetRotation}ul(t)?t.complete=!0:i+=t.duration,c.push(t)}this.animations_.push(c),this.setHint(H.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[H.ANIMATING]>0}getInteracting(){return this.hints_[H.INTERACTING]>0}cancelAnimations(){this.setHint(H.ANIMATING,-this.hints_[H.ANIMATING]);let e;for(let t=0,n=this.animations_.length;t<n;++t){let n=this.animations_[t];if(n[0].callback&&ol(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?Ue(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(H.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let e=r[0].callback;e&&ol(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]],tt(n,e-this.getRotation()),$e(n,t)),n}calculateCenterZoom(e,t){let n,r=this.getCenterInternal(),i=this.getResolution();if(r!==void 0&&i!==void 0){let a=t[0]-e*(t[0]-r[0])/i,o=t[1]-e*(t[1]-r[1])/i;n=[a,o]}return 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&&_n(e,this.getProjection())}getCenterInternal(){return this.get(Uc.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){let t=this.calculateExtentInternal(e);return yn(t,this.getProjection())}calculateExtentInternal(e){e||=this.getViewportSizeMinusPadding_();let t=this.getCenterInternal();N(t,`The view center is not defined`);let n=this.getResolution();N(n!==void 0,`The view resolution is not defined`);let r=this.getRotation();return N(r!==void 0,`The view rotation is not defined`),De(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(Uc.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(bn(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t||=this.getViewportSizeMinusPadding_();let n=I(e)/t[0],r=F(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){let i=t/e**+(n*r);return i})}getRotation(){return this.get(Uc.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){let r=Math.log(n/e)/t/i;return r})}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=dl(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=s(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=L(Math.floor(e),0,this.resolutions_.length-2),n=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/n**+L(e-t,0,1)}return this.maxResolution_/this.zoomFactor_**+(e-this.minZoom_)}fit(e,t){let n;if(N(Array.isArray(e)||typeof e.getSimplifiedGeometry==`function`,"Invalid extent or geometry provided as `geometry`"),Array.isArray(e)){N(!Ne(e),"Cannot fit empty extent provided as `geometry`");let t=bn(e,this.getProjection());n=Pr(t)}else if(e.getType()===`Circle`){let t=bn(e.getExtent(),this.getProjection());n=Pr(t),n.rotate(this.getRotation(),Te(t))}else{let t=gn();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?!1: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?0:1);let c=this.getRotation(),l=Math.sin(c),u=Math.cos(c),d=Te(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,h=this.getConstrainedCenter([f,p],s),g=t.callback?t.callback:m;t.duration===void 0?(this.targetResolution_=s,this.targetCenter_=h,this.applyTargetState_(!1,!0),ol(g,!0)):this.animateInternal({resolution:s,center:h,duration:t.duration,easing:t.easing},g)}centerOn(e,t,n){this.centerOnInternal(vn(e,this.getProjection()),t,n)}centerOnInternal(e,t,n){this.setCenterInternal(dl(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=dl(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=_n(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&&=vn(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&&=vn(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&&vn(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(Uc.ROTATION)!==r&&this.set(Uc.ROTATION,r),this.get(Uc.RESOLUTION)!==a&&(this.set(Uc.RESOLUTION,a),this.set(`zoom`,this.getZoom(),!0)),(!o||!this.get(Uc.CENTER)||!et(this.get(Uc.CENTER),o))&&this.set(Uc.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));if(e===0&&!this.cancelAnchor_){this.targetResolution_=o,this.targetRotation_=i,this.targetCenter_=s,this.applyTargetState_();return}n||=e===0?this.cancelAnchor_:void 0,this.cancelAnchor_=void 0,(this.getResolution()!==o||this.getRotation()!==i||!this.getCenterInternal()||!et(this.getCenterInternal(),s))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:i,center:s,resolution:o,duration:e,easing:qc,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(H.INTERACTING,1)}endInteraction(e,t,n){n&&=vn(n,this.getProjection()),this.endInteractionInternal(e,t,n)}endInteractionInternal(e,t,n){this.getInteracting()&&(this.setHint(H.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 ol(e,t){setTimeout(function(){e(t)},0)}function sl(e){if(e.extent!==void 0){let t=e.smoothExtentConstraint===void 0?!0:e.smoothExtentConstraint;return Wc(e.extent,e.constrainOnlyCenter,t)}let t=cn(e.projection,`EPSG:3857`);if(e.multiWorld!==!0&&t.isGlobal()){let e=t.getExtent().slice();return e[0]=-1/0,e[2]=1/0,Wc(e,!1,!1)}return Gc}function cl(e){let t,n,r,i=e.minZoom===void 0?0:e.minZoom,a=e.maxZoom===void 0?28:e.maxZoom,o=e.zoomFactor===void 0?2:e.zoomFactor,s=e.multiWorld===void 0?!1:e.multiWorld,c=e.smoothResolutionConstraint===void 0?!0:e.smoothResolutionConstraint,l=e.showFullExtent===void 0?!1:e.showFullExtent,u=cn(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?Qc(o,c,!f&&p,l):el(n,r,c,!f&&p,l)}else{let s=d?Math.max(I(d),F(d)):360*at.degrees/u.getMetersPerUnit(),m=s/256/1,h=m/2**28;n=e.maxResolution,n===void 0?n=m/o**+i:i=0,r=e.minResolution,r===void 0&&(r=e.maxZoom===void 0?h:e.maxResolution===void 0?m/o**+a:n/o**+a),a=i+Math.floor(Math.log(n/r)/Math.log(o)),r=n/o**+(a-i),t=e.constrainResolution?$c(o,n,r,c,!f&&p,l):el(n,r,c,!f&&p,l)}return{constraint:t,maxResolution:n,minResolution:r,minZoom:i,zoomFactor:o}}function ll(e){let t=e.enableRotation===void 0?!0:e.enableRotation;if(t){let t=e.constrainRotation;return t===void 0||t===!0?il():t===!1?nl:typeof t==`number`?rl(t):nl}return tl}function ul(e){return!(e.sourceCenter&&e.targetCenter&&!et(e.sourceCenter,e.targetCenter)||e.sourceResolution!==e.targetResolution||e.sourceRotation!==e.targetRotation)}function dl(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;s+=(t[0]/2-n[0])*r,c+=(n[1]-t[1]/2)*r,o=-o;let l=s*a-c*o,u=c*a+s*o;return[l,u]}var Z={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`},fl=class extends A{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[Z.OPACITY]=e.opacity===void 0?1:e.opacity,N(typeof t[Z.OPACITY]==`number`,`Layer opacity must be a number`),t[Z.VISIBLE]=e.visible===void 0?!0:e.visible,t[Z.Z_INDEX]=e.zIndex,t[Z.MAX_RESOLUTION]=e.maxResolution===void 0?1/0:e.maxResolution,t[Z.MIN_RESOLUTION]=e.minResolution===void 0?0:e.minResolution,t[Z.MIN_ZOOM]=e.minZoom===void 0?-1/0:e.minZoom,t[Z.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?!0:e},n=this.getZIndex();return t.opacity=L(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 E()}getLayerStatesArray(e){return E()}getExtent(){return this.get(Z.EXTENT)}getMaxResolution(){return this.get(Z.MAX_RESOLUTION)}getMinResolution(){return this.get(Z.MIN_RESOLUTION)}getMinZoom(){return this.get(Z.MIN_ZOOM)}getMaxZoom(){return this.get(Z.MAX_ZOOM)}getOpacity(){return this.get(Z.OPACITY)}getSourceState(){return E()}getVisible(){return this.get(Z.VISIBLE)}getZIndex(){return this.get(Z.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(Z.EXTENT,e)}setMaxResolution(e){this.set(Z.MAX_RESOLUTION,e)}setMinResolution(e){this.set(Z.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(Z.MAX_ZOOM,e)}setMinZoom(e){this.set(Z.MIN_ZOOM,e)}setOpacity(e){N(typeof e==`number`,`Layer opacity must be a number`),this.set(Z.OPACITY,e)}setVisible(e){this.set(Z.VISIBLE,e)}setZIndex(e){this.set(Z.Z_INDEX,e)}disposeInternal(){this.state_&&=(this.state_.layer=null,null),super.disposeInternal()}},pl=class extends fl{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(Z.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(Z.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){let e=this.getSource();return e?e.getState():`undefined`}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().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_=x(e,n.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 al?{viewState:e.getState(),extent:e.calculateExtent()}:e,!t.layerStatesArray&&n&&(t.layerStatesArray=n.getLayerGroup().getLayerStatesArray());let r;if(t.layerStatesArray){if(r=t.layerStatesArray.find(e=>e.layer===this),!r)return!1}else r=this.getLayerState();let i=this.getExtent();return ml(r,t.viewState)&&(!i||Me(i,t.extent))}getAttributions(e){if(!this.isVisible(e))return[];let t=this.getSource()?.getAttributions();if(!t)return[];let n=e instanceof al?e.getViewStateAndExtent():e,r=t(n);return Array.isArray(r)||(r=[r]),r}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(Z.MAP,e)}getMapInternal(){return this.get(Z.MAP)}setMap(e){this.mapPrecomposeKey_&&=(C(this.mapPrecomposeKey_),null),e||this.changed(),this.mapRenderKey_&&=(C(this.mapRenderKey_),null),e&&(this.mapPrecomposeKey_=x(e,Br.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=x(this,n.CHANGE,e.render,e),this.changed())}handlePrecompose_(e){let t=e.frameState.layerStatesArray,n=this.getLayerState(!1);N(!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(Z.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 ml(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}const hl={RENDER_ORDER:`renderOrder`};var gl=class extends pl{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?!1:e.updateWhileAnimating,this.updateWhileInteracting_=e.updateWhileInteracting===void 0?!1:e.updateWhileInteracting}getDeclutter(){return this.declutter_}getFeatures(e){return super.getFeatures(e)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(hl.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();n in e.declutter||(e.declutter[n]=new Va(9)),this.getRenderer().renderDeclutter(e,t)}setRenderOrder(e){this.set(hl.RENDER_ORDER,e)}setStyle(e){this.style_=e===void 0?bo:e;let t=_l(e);this.styleFunction_=e===null?void 0:vo(t),this.changed()}setDeclutter(e){this.declutter_=e?String(e):void 0,this.changed()}};function _l(e){if(e===void 0)return bo;if(!e)return null;if(typeof e==`function`||e instanceof _o)return e;if(!Array.isArray(e))return uc([e]);if(e.length===0)return[];let t=e.length,n=e[0];if(n instanceof _o){let n=Array(t);for(let r=0;r<t;++r){let t=e[r];if(!(t instanceof _o))throw Error(`Expected a list of style instances`);n[r]=t}return n}if(`style`in n){let n=Array(t);for(let r=0;r<t;++r){let t=e[r];if(!(`style`in t))throw Error(`Expected a list of rules with a style property`);n[r]=t}return lc(n)}let r=e;return uc(r)}var vl=class extends gl{constructor(e){super(e)}createRenderer(){return new hs(this)}},Q={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4},yl=class extends b{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(n.CHANGE)}release(){this.setState(Q.EMPTY)}getKey(){return this.key+`/`+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(e){if(this.state!==Q.EMPTY){if(this.state!==Q.ERROR&&this.state>e)throw Error(`Tile load sequence violation`);this.state=e,this.changed()}}load(){E()}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:Kc(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()}},bl=class extends yl{constructor(e,t,n,r,i,a){super(e,t,a),this.crossOrigin_=r,this.src_=n,this.key=n,this.image_=new Image,r!==null&&(this.image_.crossOrigin=r),this.unlisten_=null,this.tileLoadFunction_=i}getImage(){return this.image_}setImage(e){this.image_=e,this.state=Q.LOADED,this.unlistenImage_(),this.changed()}handleImageError_(){this.state=Q.ERROR,this.unlistenImage_(),this.image_=xl(),this.changed()}handleImageLoad_(){let e=this.image_;e.naturalWidth&&e.naturalHeight?this.state=Q.LOADED:this.state=Q.EMPTY,this.unlistenImage_(),this.changed()}load(){this.state==Q.ERROR&&(this.state=Q.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==Q.IDLE&&(this.state=Q.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=wi(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&=(this.unlisten_(),null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}};function xl(){let e=V(1,1);return e.fillStyle=`rgba(0,0,0,0)`,e.fillRect(0,0,1,1),e.canvas}var Sl=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_}},Cl=class extends y{constructor(e,t,n){super(e),this.map=t,this.frameState=n===void 0?null:n}},wl=class extends Cl{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?!1:r,this.activePointers=a}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()}},$={SINGLECLICK:`singleclick`,CLICK:n.CLICK,DBLCLICK:n.DBLCLICK,POINTERDRAG:`pointerdrag`,POINTERMOVE:`pointermove`,POINTERDOWN:`pointerdown`,POINTERUP:`pointerup`,POINTEROVER:`pointerover`,POINTEROUT:`pointerout`,POINTERENTER:`pointerenter`,POINTERLEAVE:`pointerleave`,POINTERCANCEL:`pointercancel`},Tl={POINTERMOVE:`pointermove`,POINTERDOWN:`pointerdown`,POINTERUP:`pointerup`,POINTEROVER:`pointerover`,POINTEROUT:`pointerout`,POINTERENTER:`pointerenter`,POINTERLEAVE:`pointerleave`,POINTERCANCEL:`pointercancel`},El=class extends b{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 r=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=r,this.pointerdownListenerKey_=x(r,Tl.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=x(r,Tl.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(n.TOUCHMOVE,this.boundHandleTouchMove_,Jr?{passive:!1}:!1)}emulateClick_(e){let t=new wl($.CLICK,this.map_,e);this.dispatchEvent(t),this.clickTimeoutId_===void 0?this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;let t=new wl($.SINGLECLICK,this.map_,e);this.dispatchEvent(t)},250):(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new wl($.DBLCLICK,this.map_,e),this.dispatchEvent(t))}updateActivePointers_(e){let t=e,n=t.pointerId;if(t.type==$.POINTERUP||t.type==$.POINTERCANCEL){for(let e in delete this.trackedTouches_[n],this.trackedTouches_)if(this.trackedTouches_[e].target!==t.target){delete this.trackedTouches_[e];break}}else (t.type==$.POINTERDOWN||t.type==$.POINTERMOVE)&&(this.trackedTouches_[n]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);let t=new wl($.POINTERUP,this.map_,e,void 0,void 0,this.activePointers_);this.dispatchEvent(t),this.emulateClicks_&&!t.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(e)&&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 wl($.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();this.dragListenerKeys_.push(x(e,$.POINTERMOVE,this.handlePointerMove_,this),x(e,$.POINTERUP,this.handlePointerUp_,this),x(this.element_,$.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==e&&this.dragListenerKeys_.push(x(this.element_.getRootNode(),$.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;let t=new wl($.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 wl($.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){return this.dragging_||Math.abs(e.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(e.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&=(C(this.relayedListenerKey_),null),this.element_.removeEventListener(n.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&=(C(this.pointerdownListenerKey_),null),this.dragListenerKeys_.forEach(C),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},Dl={POSTRENDER:`postrender`,MOVESTART:`movestart`,MOVEEND:`moveend`,LOADSTART:`loadstart`,LOADEND:`loadend`},Ol={LAYERGROUP:`layergroup`,SIZE:`size`,TARGET:`target`,VIEW:`view`};const kl=1/0;var Al=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,_(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){N(!(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==kl?!1:(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==kl?delete this.queuedElements_[this.keyFunction_(a)]:(n[r]=s,t[r++]=a);t.length=r,n.length=r,this.heapify_()}},jl=class extends Al{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);if(t){let t=e[0];t.addEventListener(n.CHANGE,this.boundHandleTileChange_)}return t}getTilesLoading(){return this.tilesLoading_}handleTileChange(e){let t=e.target,r=t.getState();if(r===Q.LOADED||r===Q.ERROR||r===Q.EMPTY){r!==Q.ERROR&&t.removeEventListener(n.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(),r=e.getState();r===Q.IDLE&&!(t in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[t]=!0,++this.tilesLoading_,++n,e.load())}}};function Ml(e,t,n,r,i){if(!e||!(n in e.wantedTiles)||!e.wantedTiles[n][t.getKey()])return kl;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 Nl=class extends A{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.appendChild(this.element),this.render!==m&&this.listenerKeys.push(x(e,Dl.POSTRENDER,this.render,this)),e.render()}}render(e){}setTarget(e){this.target_=typeof e==`string`?document.getElementById(e):e}},Pl=class extends Nl{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?!0:e.collapsed,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=e.collapsible!==void 0,this.collapsible_=e.collapsible===void 0?!0:e.collapsible,this.collapsible_||(this.collapsed_=!1),this.attributions_=e.attributions;let t=e.className===void 0?`ol-attribution`:e.className,r=e.tipLabel===void 0?`Attributions`:e.tipLabel,i=e.expandClassName===void 0?t+`-expand`:e.expandClassName,a=e.collapseLabel===void 0?`›`:e.collapseLabel,o=e.collapseClassName===void 0?t+`-collapse`:e.collapseClassName;typeof a==`string`?(this.collapseLabel_=document.createElement(`span`),this.collapseLabel_.textContent=a,this.collapseLabel_.className=o):this.collapseLabel_=a;let s=e.label===void 0?`i`:e.label;typeof s==`string`?(this.label_=document.createElement(`span`),this.label_.textContent=s,this.label_.className=i):this.label_=s;let c=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=r,this.toggleButton_.appendChild(c),this.toggleButton_.addEventListener(n.CLICK,this.handleClick_.bind(this),!1);let l=t+` ol-unselectable ol-control`+(this.collapsed_&&this.collapsible_?` `+Li:``)+(this.collapsible_?``:` ol-uncollapsible`),u=this.element;u.className=l,u.appendChild(this.toggleButton_),u.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(e){let t=this.getMap().getAllLayers(),n=new Set(t.flatMap(t=>t.getAttributions(e)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(e=>n.add(e)):n.add(this.attributions_)),!this.overrideCollapsible_){let e=!t.some(e=>e.getSource()?.getAttributionsCollapsible()===!1);this.setCollapsible(e)}return Array.from(n)}async updateElement_(e){if(!e){this.renderedVisible_&&=(this.element.style.display=`none`,!1);return}let t=await Promise.all(this.collectSourceAttributions_(e).map(e=>g(()=>e))),n=t.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?``:`none`,this.renderedVisible_=n),!u(t,this.renderedAttributions_)){$r(this.ulElement_);for(let e=0,n=t.length;e<n;++e){let n=document.createElement(`li`);n.innerHTML=t[e],this.ulElement_.appendChild(n)}this.renderedAttributions_=t}}handleClick_(e){e.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(Li),this.collapsed_?Qr(this.collapseLabel_,this.label_):Qr(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute(`aria-expanded`,String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(e){this.collapsible_!==e&&(this.collapsible_=e,this.element.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)}},Fl=class extends Nl{constructor(e){e||={},super({element:document.createElement(`div`),render:e.render,target:e.target});let t=e.className===void 0?`ol-rotate`:e.className,r=e.label===void 0?`⇧`:e.label,i=e.compassClassName===void 0?`ol-compass`:e.compassClassName;this.label_=null,typeof r==`string`?(this.label_=document.createElement(`span`),this.label_.className=i,this.label_.textContent=r):(this.label_=r,this.label_.classList.add(i));let a=e.tipLabel?e.tipLabel:`Reset rotation`,o=document.createElement(`button`);o.className=t+`-reset`,o.setAttribute(`type`,`button`),o.title=a,o.appendChild(this.label_),o.addEventListener(n.CLICK,this.handleClick_.bind(this),!1);let s=t+` ol-unselectable ol-control`,c=this.element;c.className=s,c.appendChild(o),this.callResetNorth_=e.resetNorth?e.resetNorth:void 0,this.duration_=e.duration===void 0?250:e.duration,this.autoHide_=e.autoHide===void 0?!0:e.autoHide,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(Ii)}handleClick_(e){e.preventDefault(),this.callResetNorth_===void 0?this.resetNorth_():this.callResetNorth_()}resetNorth_(){let e=this.getMap(),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:qc}):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)`;if(this.autoHide_){let e=this.element.classList.contains(Ii);!e&&n===0?this.element.classList.add(Ii):e&&n!==0&&this.element.classList.remove(Ii)}this.label_.style.transform=e}this.rotation_=n}},Il=class extends Nl{constructor(e){e||={},super({element:document.createElement(`div`),target:e.target});let t=e.className===void 0?`ol-zoom`:e.className,r=e.delta===void 0?1:e.delta,i=e.zoomInClassName===void 0?t+`-in`:e.zoomInClassName,a=e.zoomOutClassName===void 0?t+`-out`:e.zoomOutClassName,o=e.zoomInLabel===void 0?`+`:e.zoomInLabel,s=e.zoomOutLabel===void 0?`–`:e.zoomOutLabel,c=e.zoomInTipLabel===void 0?`Zoom in`:e.zoomInTipLabel,l=e.zoomOutTipLabel===void 0?`Zoom out`:e.zoomOutTipLabel,u=document.createElement(`button`);u.className=i,u.setAttribute(`type`,`button`),u.title=c,u.appendChild(typeof o==`string`?document.createTextNode(o):o),u.addEventListener(n.CLICK,this.handleClick_.bind(this,r),!1);let d=document.createElement(`button`);d.className=a,d.setAttribute(`type`,`button`),d.title=l,d.appendChild(typeof s==`string`?document.createTextNode(s):s),d.addEventListener(n.CLICK,this.handleClick_.bind(this,-r),!1);let f=t+` ol-unselectable ol-control`,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(),n=t.getView();if(!n)return;let r=n.getZoom();if(r!==void 0){let t=n.getConstrainedZoom(r+e);this.duration_>0?(n.getAnimating()&&n.cancelAnimations(),n.animate({zoom:t,duration:this.duration_,easing:qc})):n.setZoom(t)}}};function Ll(e){e||={};let t=new M,n=e.zoom===void 0?!0:e.zoom;n&&t.push(new Il(e.zoomOptions));let r=e.rotate===void 0?!0:e.rotate;r&&t.push(new Fl(e.rotateOptions));let i=e.attribution===void 0?!0:e.attribution;return i&&t.push(new Pl(e.attributionOptions)),t}var Rl={ACTIVE:`active`},zl=class extends A{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(Rl.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(Rl.ACTIVE,e)}setMap(e){this.map_=e}};function Bl(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:Yc,center:e.getConstrainedCenter(i)})}}function Vl(e,t,n,r){let i=e.getZoom();if(i===void 0)return;let a=e.getConstrainedZoom(i+t),o=e.getResolutionForZoom(a);e.getAnimating()&&e.cancelAnimations(),e.animate({resolution:o,anchor:n,duration:r===void 0?250:r,easing:qc})}var Hl=class extends zl{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==$.DBLCLICK){let n=e.originalEvent,r=e.map,i=e.coordinate,a=n.shiftKey?-this.delta_:this.delta_,o=r.getView();Vl(o,a,i,this.duration_),n.preventDefault(),t=!0}return!t}};function Ul(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}}const Wl=function(e){let t=e.originalEvent;return t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},Gl=function(e){let t=e.map.getTargetElement(),n=t.getRootNode(),r=e.map.getOwnerDocument().activeElement;return n instanceof ShadowRoot?n.host.contains(r):t.contains(r)},Kl=function(e){let t=e.map.getTargetElement(),n=t.getRootNode(),r=n instanceof ShadowRoot?n.host:t;return r.hasAttribute(`tabindex`)?Gl(e):!0},ql=f,Jl=function(e){let t=e.originalEvent;return`pointerId`in t&&t.button==0&&!(Ur&&Wr&&t.ctrlKey)},Yl=function(e){let t=e.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&!t.shiftKey},Xl=function(e){let t=e.originalEvent;return Wr?t.metaKey:t.ctrlKey},Zl=function(e){let t=e.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},Ql=function(e){let t=e.originalEvent,n=t.target.tagName;return n!==`INPUT`&&n!==`SELECT`&&n!==`TEXTAREA`&&!t.target.isContentEditable},$l=function(e){let t=e.originalEvent;return`pointerId`in t&&t.pointerType==`mouse`},eu=function(e){let t=e.originalEvent;return`pointerId`in t&&t.isPrimary&&t.button===0};var tu=class extends zl{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==$.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==$.POINTERUP){let t=this.handleUpEvent(e);this.handlingDownUpSequence=t&&this.targetPointers.length>0}}else if(e.type==$.POINTERDOWN){let n=this.handleDownEvent(e);this.handlingDownUpSequence=n,t=this.stopDown(n)}else e.type==$.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 nu(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 ru=class extends tu{constructor(e){super({stopDown:p}),e||={},this.kinetic_=e.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;let t=e.condition?e.condition:Ul(Yl,eu);this.condition_=e.onFocusOnly?Ul(Kl,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(nu(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,i=n.getView();nt(t,i.getResolution()),tt(t,i.getRotation()),i.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(),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:qc})}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,n=t.getView();return this.lastCentroid=null,n.getAnimating()&&n.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}},iu=class extends tu{constructor(e){e||={},super({stopDown:p}),this.condition_=e.condition?e.condition:Wl,this.lastAngle_=void 0,this.duration_=e.duration===void 0?250:e.duration}handleDragEvent(e){if(!$l(e))return;let t=e.map,n=t.getView();if(n.getConstraints().rotation===tl)return;let r=t.getSize(),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){if(!$l(e))return!0;let t=e.map,n=t.getView();return n.endInteraction(this.duration_),!1}handleDownEvent(e){if(!$l(e))return!1;if(Jl(e)&&this.condition_(e)){let t=e.map;return t.getView().beginInteraction(),this.lastAngle_=void 0,!0}return!1}},au=class extends r{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_,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_){this.map_.getOverlayContainer().removeChild(this.element_);let e=this.element_.style;e.left=`inherit`,e.top=`inherit`,e.width=`inherit`,e.height=`inherit`}this.map_=e,this.map_&&this.map_.getOverlayContainer().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_,n=[e,[e[0],t[1]],t,[t[0],e[1]]],r=n.map(this.map_.getCoordinateFromPixelInternal,this.map_);r[4]=r[0].slice(),this.geometry_?this.geometry_.setCoordinates([r]):this.geometry_=new Nr([r])}getGeometry(){return this.geometry_}};const ou={BOXSTART:`boxstart`,BOXDRAG:`boxdrag`,BOXEND:`boxend`,BOXCANCEL:`boxcancel`};var su=class extends y{constructor(e,t,n){super(e),this.coordinate=t,this.mapBrowserEvent=n}},cu=class extends tu{constructor(e){super(),this.on,this.once,this.un,e??={},this.box_=new au(e.className||`ol-dragbox`),this.minArea_=e.minArea??64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition??Jl,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 su(ou.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 su(t?ou.BOXEND:ou.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 su(ou.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}setActive(e){e||(this.box_.setMap(null),this.startPixel_&&=(this.dispatchEvent(new su(ou.BOXCANCEL,this.startPixel_,null)),null)),super.setActive(e)}setMap(e){let t=this.getMap();t&&(this.box_.setMap(null),this.startPixel_&&=(this.dispatchEvent(new su(ou.BOXCANCEL,this.startPixel_,null)),null)),super.setMap(e)}},lu=class extends cu{constructor(e){e||={};let t=e.condition?e.condition:Zl;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?!1:e.out}onBoxEnd(e){let t=this.getMap(),n=t.getView(),r=this.getGeometry();if(this.out_){let e=n.rotatedExtentForGeometry(r),t=n.getResolutionForExtentInternal(e),i=n.getResolution()/t;r=r.clone(),r.scale(i*i)}n.fitInternal(r,{duration:this.duration_,easing:qc})}},uu={LEFT:`ArrowLeft`,UP:`ArrowUp`,RIGHT:`ArrowRight`,DOWN:`ArrowDown`},du=class extends zl{constructor(e){super(),e||={},this.defaultCondition_=function(e){return Yl(e)&&Ql(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==n.KEYDOWN){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==uu.DOWN||r==uu.LEFT||r==uu.RIGHT||r==uu.UP)){let i=e.map,a=i.getView(),o=a.getResolution()*this.pixelDelta_,s=0,c=0;r==uu.DOWN?c=-o:r==uu.LEFT?s=-o:r==uu.RIGHT?s=o:c=o;let l=[s,c];tt(l,a.getRotation()),Bl(a,l,this.duration_),n.preventDefault(),t=!0}}return!t}},fu=class extends zl{constructor(e){super(),e||={},this.condition_=e.condition?e.condition:function(e){return!Xl(e)&&Ql(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==n.KEYDOWN||e.type==n.KEYPRESS){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r===`+`||r===`-`)){let i=e.map,a=r===`+`?this.delta_:-this.delta_,o=i.getView();Vl(o,a,void 0,this.duration_),n.preventDefault(),t=!0}}return!t}},pu=class extends zl{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?!0:e.useAnchor,this.constrainResolution_=e.constrainResolution===void 0?!1:e.constrainResolution;let t=e.condition?e.condition:ql;this.condition_=e.onFocusOnly?Ul(Kl,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();t.endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(e){if(!this.condition_(e))return!0;let t=e.type;if(t!==n.WHEEL)return!0;let r=e.map,i=e.originalEvent;i.preventDefault(),this.useAnchor_&&(this.lastAnchor_=e.pixel);let a=i.deltaY;switch(i.deltaMode){case WheelEvent.DOM_DELTA_LINE:a*=40;break;case WheelEvent.DOM_DELTA_PAGE:a*=300;break;default:}if(a===0)return!1;this.lastDelta_=a;let o=Date.now();this.startTime_===void 0&&(this.startTime_=o),(!this.mode_||o-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(a)<4?`trackpad`:`wheel`);let s=r.getView();if(this.mode_===`trackpad`&&!(s.getConstrainResolution()||this.constrainResolution_))return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(s.getAnimating()&&s.cancelAnimations(),s.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),s.adjustZoom(-a/this.deltaPerZoom_,this.lastAnchor_?r.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=o,!1;this.totalDelta_+=a;let c=Math.max(this.timeout_-(o-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,r),c),!1}handleWheelZoom_(e){let t=e.getView();t.getAnimating()&&t.cancelAnimations();let n=-L(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),Vl(t,n,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null,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)}},mu=class extends tu{constructor(e){e||={};let t=e;t.stopDown||=p,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!==tl&&(this.anchor_=a.getCoordinateFromPixelInternal(a.getEventPixel(nu(this.targetPointers))),this.rotating_&&(a.render(),o.adjustRotationInternal(t,this.anchor_)))}handleUpEvent(e){if(this.targetPointers.length<2){let t=e.map,n=t.getView();return n.endInteraction(this.duration_),!1}return!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}},hu=class extends tu{constructor(e){e||={};let t=e;t.stopDown||=p,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(nu(this.targetPointers))),s.render(),c.adjustResolutionInternal(t,this.anchor_)}handleUpEvent(e){if(this.targetPointers.length<2){let t=e.map,n=t.getView(),r=this.lastScaleDelta_>1?1:-1;return n.endInteraction(this.duration_,r),!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 gu(e){e||={};let t=new M,n=new Sl(-.005,.05,100),r=e.altShiftDragRotate===void 0?!0:e.altShiftDragRotate;r&&t.push(new iu);let i=e.doubleClickZoom===void 0?!0:e.doubleClickZoom;i&&t.push(new Hl({delta:e.zoomDelta,duration:e.zoomDuration}));let a=e.dragPan===void 0?!0:e.dragPan;a&&t.push(new ru({onFocusOnly:e.onFocusOnly,kinetic:n}));let o=e.pinchRotate===void 0?!0:e.pinchRotate;o&&t.push(new mu);let s=e.pinchZoom===void 0?!0:e.pinchZoom;s&&t.push(new hu({duration:e.zoomDuration}));let c=e.keyboard===void 0?!0:e.keyboard;c&&(t.push(new du),t.push(new fu({delta:e.zoomDelta,duration:e.zoomDuration})));let l=e.mouseWheelZoom===void 0?!0:e.mouseWheelZoom;l&&t.push(new pu({onFocusOnly:e.onFocusOnly,duration:e.zoomDuration}));let u=e.shiftDragZoom===void 0?!0:e.shiftDragZoom;return u&&t.push(new lu({duration:e.zoomDuration})),t}var _u=class extends y{constructor(e,t){super(e),this.layer=t}};const vu={LAYERS:`layers`};var yu=class r extends fl{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(vu.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new M(n.slice(),{unique:!0}):N(typeof n.getArray==`function`,"Expected `layers` to be an array or a `Collection`"):n=new M(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(C),this.layersListenerKeys_.length=0;let t=this.getLayers();for(let n in this.layersListenerKeys_.push(x(t,e.ADD,this.handleLayersAdd_,this),x(t,e.REMOVE,this.handleLayersRemove_,this)),this.listenerKeys_)this.listenerKeys_[n].forEach(C);_(this.listenerKeys_);let n=t.getArray();for(let e=0,t=n.length;e<t;e++){let t=n[e];this.registerLayerListeners_(t),this.dispatchEvent(new _u(`addlayer`,t))}this.changed()}registerLayerListeners_(e){let i=[x(e,t.PROPERTYCHANGE,this.handleLayerChange_,this),x(e,n.CHANGE,this.handleLayerChange_,this)];e instanceof r&&i.push(x(e,`addlayer`,this.handleLayerGroupAdd_,this),x(e,`removelayer`,this.handleLayerGroupRemove_,this)),this.listenerKeys_[O(e)]=i}handleLayerGroupAdd_(e){this.dispatchEvent(new _u(`addlayer`,e.layer))}handleLayerGroupRemove_(e){this.dispatchEvent(new _u(`removelayer`,e.layer))}handleLayersAdd_(e){let t=e.element;this.registerLayerListeners_(t),this.dispatchEvent(new _u(`addlayer`,t)),this.changed()}handleLayersRemove_(e){let t=e.element,n=O(t);this.listenerKeys_[n].forEach(C),delete this.listenerKeys_[n],this.dispatchEvent(new _u(`removelayer`,t)),this.changed()}getLayers(){return this.get(vu.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 _u(`removelayer`,e[t]))}this.set(vu.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===void 0?n.extent=r.extent:n.extent=ke(n.extent,r.extent)),n.zIndex===void 0&&(n.zIndex=i)}return t}getSourceState(){return`ready`}},bu=class extends r{constructor(e){super(),this.map_=e}dispatchRenderEvent(e,t){E()}calculateMatrices2D(e){let t=e.viewState,n=e.coordinateToPixelTransform,r=e.pixelToCoordinateTransform;Tn(n,e.size[0]/2,e.size[1]/2,1/t.resolution,-1/t.resolution,-t.rotation,-t.center[0],-t.center[1]),En(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=rt(e.slice(),d),p=[[0,0]];if(d.canWrapX()&&r){let e=d.getExtent(),t=I(e);p.push([-t,0],[t,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()&&ml(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){let o=this.forEachFeatureAtCoordinate(e,t,n,r,f,this,i,a);return o!==void 0}getMap(){return this.map_}renderFrame(e){E()}scheduleExpireIconCache(e){ki.canExpireCache()&&e.postRenderFunctions.push(xu)}};function xu(e,t){ki.expire()}var Su=class extends bu{constructor(e){super(e),this.fontChangeListenerKey_=x(Zi,t.PROPERTYCHANGE,e.redrawText,e),this.element_=document.createElement(`div`);let n=this.element_.style;n.position=`absolute`,n.width=`100%`,n.height=`100%`,n.zIndex=`0`,this.element_.className=`ol-unselectable ol-layers`;let r=e.getViewport();r.insertBefore(this.element_,r.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(e,t){let n=this.getMap();if(n.hasListener(e)){let r=new ls(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(Br.PRECOMPOSE,e);let t=e.layerStatesArray.sort((e,t)=>e.zIndex-t.zIndex),n=t.some(e=>e.layer instanceof gl&&e.layer.getDeclutter());n&&(e.declutter={});let r=e.viewState;this.children_.length=0;let i=[],a=null;for(let n=0,o=t.length;n<o;++n){let o=t[n];e.layerIndex=n;let s=o.layer,c=s.getSourceState();if(!ml(o,r)||c!=`ready`&&c!=`undefined`){s.unrender();continue}let l=s.render(e,a);l&&(l!==a&&(this.children_.push(l),a=l),i.push(o))}this.declutter(e,i),ei(this.element_,this.children_),this.dispatchRenderEvent(Br.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 Cu(e){if(e instanceof pl){e.setMapInternal(null);return}e instanceof yu&&e.getLayers().forEach(Cu)}function wu(e,t){if(e instanceof pl){e.setMapInternal(t);return}if(e instanceof yu){let n=e.getLayers().getArray();for(let e=0,r=n.length;e<r;++e)wu(n[e],t)}}var Tu=class extends A{constructor(t){super(),t||={},this.on,this.once,this.un;let n=Eu(t);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=t.maxTilesLoading===void 0?16:t.maxTilesLoading,this.pixelRatio_=t.pixelRatio===void 0?Gr:t.pixelRatio,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=Cn(),this.pixelToCoordinateTransform_=Cn(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,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_=t.moveTolerance,this.keyboardEventTarget_=n.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,this.resizeObserver_=new ResizeObserver(()=>this.updateSize()),this.controls=n.controls||Ll(),this.interactions=n.interactions||gu({onFocusOnly:!0}),this.overlays_=n.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new jl(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(Ol.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(Ol.VIEW,this.handleViewChanged_),this.addChangeListener(Ol.SIZE,this.handleSizeChanged_),this.addChangeListener(Ol.TARGET,this.handleTargetChanged_),this.setProperties(n.values);let r=this;t.view&&!(t.view instanceof al)&&t.view.then(function(e){r.setView(new al(e))}),this.controls.addEventListener(e.ADD,e=>{e.element.setMap(this)}),this.controls.addEventListener(e.REMOVE,e=>{e.element.setMap(null)}),this.interactions.addEventListener(e.ADD,e=>{e.element.setMap(this)}),this.interactions.addEventListener(e.REMOVE,e=>{e.element.setMap(null)}),this.overlays_.addEventListener(e.ADD,e=>{this.addOverlayInternal_(e.element)}),this.overlays_.addEventListener(e.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){let t=this.getLayerGroup().getLayers();t.push(e)}handleLayerAdd_(e){wu(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?f: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 yu?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?f: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_,n=t.getBoundingClientRect(),r=this.getSize(),i=n.width/r[0],a=n.height/r[1],o=`changedTouches`in e?e.changedTouches[0]:e;return[(o.clientX-n.left)/i,(o.clientY-n.top)/a]}getTarget(){return this.get(Ol.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(e){return _n(this.getCoordinateFromPixelInternal(e),this.getView().getProjection())}getCoordinateFromPixelInternal(e){let t=this.frameState_;return t?z(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(Ol.LAYERGROUP)}setLayers(e){let t=this.getLayerGroup();if(e instanceof M){t.setLayers(e);return}let n=t.getLayers();n.clear(),n.extend(e)}getLayers(){let e=this.getLayerGroup().getLayers();return e}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){let t=vn(e,this.getView().getProjection());return this.getPixelFromCoordinateInternal(t)}getPixelFromCoordinateInternal(e){let t=this.frameState_;return t?z(t.coordinateToPixelTransform,e.slice(0,2)):null}getRenderer(){return this.renderer_}getSize(){return this.get(Ol.SIZE)}getView(){return this.get(Ol.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 Ml(this.frameState_,e,t,n,r)}handleBrowserEvent(e,t){t||=e.type;let n=new wl(t,this,e);this.handleMapBrowserEvent(n)}handleMapBrowserEvent(e){if(!this.frameState_)return;let t=e.originalEvent,r=t.type;if(r===Tl.POINTERDOWN||r===n.WHEEL||r===n.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())continue;let i=r.handleEvent(e);if(!i||e.propagationStopped)break}}}handlePostRender(){let e=this.frameState_,t=this.tileQueue_;if(!t.isEmpty()){let n=this.maxTilesLoading_,r=n;if(e){let t=e.viewHints;if(t[H.ANIMATING]||t[H.INTERACTING]){let t=Date.now()-e.time>8;n=t?0:8,r=t?0:2}}t.getTilesLoading()<n&&(t.reprioritize(),t.loadMoreTiles(n,r))}e&&this.renderer_&&!e.animate&&(this.renderComplete_?(this.hasListener(Br.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(Br.RENDERCOMPLETE,e),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new Cl(Dl.LOADEND,this,e)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new Cl(Dl.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_){for(let e=0,t=this.targetChangeHandlerKeys_.length;e<t;++e)C(this.targetChangeHandlerKeys_[e]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(n.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(n.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(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{for(let e in t.appendChild(this.viewport_),this.renderer_||=new Su(this),this.mapBrowserEventHandler_=new El(this,this.moveTolerance_),$)this.mapBrowserEventHandler_.addEventListener($[e],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(n.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(n.WHEEL,this.boundHandleBrowserEvent_,Jr?{passive:!1}:!1);let e;if(this.keyboardEventTarget_)e=this.keyboardEventTarget_;else{let n=t.getRootNode(),r=n instanceof ShadowRoot?n.host:t;e=r}this.targetChangeHandlerKeys_=[x(e,n.KEYDOWN,this.handleBrowserEvent,this),x(e,n.KEYPRESS,this.handleBrowserEvent,this)];let r=t.getRootNode();r instanceof ShadowRoot&&this.resizeObserver_.observe(r.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_=x(e,t.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=x(e,n.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 _u(`addlayer`,e)),this.layerGroupPropertyListenerKeys_=[x(e,t.PROPERTYCHANGE,this.render,this),x(e,n.CHANGE,this.render,this),x(e,`addlayer`,this.handleLayerAdd_,this),x(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){let t=this.getLayerGroup().getLayers();return t.remove(e)}handleLayerRemove_(e){Cu(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&&uo(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:De(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:O(this),renderTargets:{}},a.nextCenter&&a.nextResolution){let e=isNaN(a.nextRotation)?a.rotation:a.nextRotation;i.nextExtent=De(a.nextCenter,a.nextResolution,e,t)}}if(this.frameState_=i,this.renderer_.renderFrame(i),i){if(i.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,i.postRenderFunctions),r){let e=!this.previousExtent_||!Ne(this.previousExtent_)&&!ge(i.extent,this.previousExtent_);e&&(this.dispatchEvent(new Cl(Dl.MOVESTART,this,r)),this.previousExtent_=pe(this.previousExtent_))}let e=this.previousExtent_&&!i.viewHints[H.ANIMATING]&&!i.viewHints[H.INTERACTING]&&!ge(i.extent,this.previousExtent_);e&&(this.dispatchEvent(new Cl(Dl.MOVEEND,this,i)),ae(i.extent,this.previousExtent_))}this.dispatchEvent(new Cl(Dl.POSTRENDER,this,i)),this.renderComplete_=(this.hasListener(Dl.LOADSTART)||this.hasListener(Dl.LOADEND)||this.hasListener(Br.RENDERCOMPLETE))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0)}setLayerGroup(e){let t=this.getLayerGroup();t&&this.handleLayerRemove_(new _u(`removelayer`,t)),this.set(Ol.LAYERGROUP,e)}setSize(e){this.set(Ol.SIZE,e)}setTarget(e){this.set(Ol.TARGET,e)}setView(e){if(!e||e instanceof al){this.set(Ol.VIEW,e);return}this.set(Ol.VIEW,new al);let t=this;e.then(function(e){t.setView(new al(e))})}updateSize(){let e=this.getTargetElement(),t;if(e){let n=getComputedStyle(e),r=e.offsetWidth-parseFloat(n.borderLeftWidth)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)-parseFloat(n.borderRightWidth),i=e.offsetHeight-parseFloat(n.borderTopWidth)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)-parseFloat(n.borderBottomWidth);!isNaN(r)&&!isNaN(i)&&(t=[Math.max(0,r),Math.max(0,i)],!uo(t)&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&Qe(`No map visible because the map container's width or height are 0.`))}let n=this.getSize();t&&(!n||!u(t,n))&&(this.setSize(t),this.updateViewportSize_(t))}updateViewportSize_(e){let t=this.getView();t&&t.setViewportSize(e)}};function Eu(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 yu({layers:e.layers});n[Ol.LAYERGROUP]=r,n[Ol.TARGET]=e.target,n[Ol.VIEW]=e.view instanceof al?e.view:new al;let i;e.controls!==void 0&&(Array.isArray(e.controls)?i=new M(e.controls.slice()):(N(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 M(e.interactions.slice()):(N(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 M:Array.isArray(e.overlays)?o=new M(e.overlays.slice()):(N(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 Du=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 Ou(e,t,n,r,i){return i===void 0?new Du(e,t,n,r):(i.minX=e,i.maxX=t,i.minY=n,i.maxY=r,i)}var ku=class{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=te,this.supportedMediaTypes=null}getReadOptions(e,t){if(t){let n=t.dataProjection?R(t.dataProjection):this.readProjection(e);t.extent&&n&&n.getUnits()===`tile-pixels`&&(n=R(n),n.setWorldExtent(t.extent)),t={dataProjection:n,featureProjection:t.featureProjection}}return this.adaptOptions(t)}adaptOptions(e){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},e)}getType(){return E()}readFeature(e,t){return E()}readFeatures(e,t){return E()}readGeometry(e,t){return E()}readProjection(e){return E()}writeFeature(e,t){return E()}writeFeatures(e,t){return E()}writeGeometry(e,t){return E()}};function Au(e,t,n){let r=n?R(n.featureProjection):null,i=n?R(n.dataProjection):null,a=e;if(r&&i&&!dn(r,i)){t&&(a=e.clone());let n=t?r:i,o=t?i:r;n.getUnits()===`tile-pixels`?a.transform(n,o):a.applyTransform(mn(n,o))}if(t&&n&&n.decimals!==void 0){let t=10**n.decimals,r=function(e){for(let n=0,r=e.length;n<r;++n)e[n]=Math.round(e[n]*t)/t;return e};a===e&&(a=e.clone()),a.applyTransform(r)}return a}const ju={Point:pr,LineString:zr,Polygon:Nr,MultiPoint:Pa,MultiLineString:Na,MultiPolygon:Fa};function Mu(e,t,n){return Array.isArray(t[0])?(kr(e,0,t,n)||(e=e.slice(),jr(e,0,t,n)),e):(Or(e,0,t,n)||(e=e.slice(),Ar(e,0,t,n)),e)}function Nu(e,t){let n=e.geometry;if(!n)return[];if(Array.isArray(n))return n.map(t=>Nu({...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.length;return Au(new La(r,r===`Polygon`?Mu(n.flatCoordinates,n.ends,i):n.flatCoordinates,n.ends?.flat(),i,e.properties||{},e.id).enableSimplifyTransformed(),!1,t)}function Pu(e,t){if(!e)return null;if(Array.isArray(e)){let n=e.map(e=>Pu(e,t));return new ja(n)}let n=ju[e.type];return Au(new n(e.flatCoordinates,e.layout||`XY`,e.ends),!1,t)}var Fu=class extends ku{constructor(){super()}getType(){return`json`}readFeature(e,t){return this.readFeatureFromObject(Iu(e),this.getReadOptions(e,t))}readFeatures(e,t){return this.readFeaturesFromObject(Iu(e),this.getReadOptions(e,t))}readFeatureFromObject(e,t){return E()}readFeaturesFromObject(e,t){return E()}readGeometry(e,t){return this.readGeometryFromObject(Iu(e),this.getReadOptions(e,t))}readGeometryFromObject(e,t){return E()}readProjection(e){return this.readProjectionFromObject(Iu(e))}readProjectionFromObject(e){return E()}writeFeature(e,t){return JSON.stringify(this.writeFeatureObject(e,t))}writeFeatureObject(e,t){return E()}writeFeatures(e,t){return JSON.stringify(this.writeFeaturesObject(e,t))}writeFeaturesObject(e,t){return E()}writeGeometry(e,t){return JSON.stringify(this.writeGeometryObject(e,t))}writeGeometryObject(e,t){return E()}};function Iu(e){if(typeof e==`string`){let t=JSON.parse(e);return t||null}return e===null?null:e}var Lu=class extends Fu{constructor(e){e||={},super(),this.dataProjection=R(e.dataProjection?e.dataProjection:`EPSG:4326`),e.featureProjection&&(this.defaultFeatureProjection=R(e.featureProjection)),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=null;n=e.type===`Feature`?e:{type:`Feature`,geometry:e,properties:null};let r=Ru(n.geometry,t);if(this.featureClass===La)return Nu({geometry:r,id:n.id,properties:n.properties},t);let i=new te;return this.geometryName_?i.setGeometryName(this.geometryName_):this.extractGeometryName_&&n.geometry_name&&i.setGeometryName(n.geometry_name),i.setGeometry(Pu(r,t)),`id`in n&&i.setId(n.id),n.properties&&i.setProperties(n.properties,!0),i}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 zu(e,t)}readProjectionFromObject(e){let t=e.crs,n;if(t)if(t.type==`name`)n=R(t.properties.name);else if(t.type===`EPSG`)n=R(`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(),a=e.getGeometry();return a&&(n.geometry=qu(a,t),delete i[e.getGeometryName()]),v(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 qu(e,this.adaptOptions(t))}};function Ru(e,t){if(!e)return null;let n;switch(e.type){case`Point`:n=Vu(e);break;case`LineString`:n=Hu(e);break;case`Polygon`:n=Ku(e);break;case`MultiPoint`:n=Wu(e);break;case`MultiLineString`:n=Uu(e);break;case`MultiPolygon`:n=Gu(e);break;case`GeometryCollection`:n=Bu(e);break;default:throw Error(`Unsupported GeoJSON type: `+e.type)}return n}function zu(e,t){let n=Ru(e,t);return Pu(n,t)}function Bu(e,t){let n=e.geometries.map(function(e){return Ru(e,t)});return n}function Vu(e){let t=e.coordinates;return{type:`Point`,flatCoordinates:t,layout:Bn(t.length)}}function Hu(e){let t=e.coordinates,n=t.flat();return{type:`LineString`,flatCoordinates:n,ends:[n.length],layout:Bn(t[0]?.length||2)}}function Uu(e){let t=e.coordinates,n=t[0]?.[0]?.length||2,r=[],i=tr(r,0,t,n);return{type:`MultiLineString`,flatCoordinates:r,ends:i,layout:Bn(n)}}function Wu(e){let t=e.coordinates;return{type:`MultiPoint`,flatCoordinates:t.flat(),layout:Bn(t[0]?.length||2)}}function Gu(e){let t=e.coordinates,n=[],r=t[0]?.[0]?.[0].length||2,i=nr(n,0,t,r);return{type:`MultiPolygon`,flatCoordinates:n,ends:i,layout:Bn(r)}}function Ku(e){let t=e.coordinates,n=[],r=t[0]?.[0]?.length,i=tr(n,0,t,r);return{type:`Polygon`,flatCoordinates:n,ends:i,layout:Bn(r)}}function qu(e,t){e=Au(e,!0,t);let n=e.getType(),r;switch(n){case`Point`:r=$u(e,t);break;case`LineString`:r=Yu(e,t);break;case`Polygon`:r=ed(e,t);break;case`MultiPoint`:r=Zu(e,t);break;case`MultiLineString`:r=Xu(e,t);break;case`MultiPolygon`:r=Qu(e,t);break;case`GeometryCollection`:r=Ju(e,t);break;case`Circle`:r={type:`GeometryCollection`,geometries:[]};break;default:throw Error(`Unsupported geometry type: `+n)}return r}function Ju(e,t){t=Object.assign({},t),delete t.featureProjection;let n=e.getGeometriesArray().map(function(e){return qu(e,t)});return{type:`GeometryCollection`,geometries:n}}function Yu(e,t){return{type:`LineString`,coordinates:e.getCoordinates()}}function Xu(e,t){return{type:`MultiLineString`,coordinates:e.getCoordinates()}}function Zu(e,t){return{type:`MultiPoint`,coordinates:e.getCoordinates()}}function Qu(e,t){let n;return t&&(n=t.rightHanded),{type:`MultiPolygon`,coordinates:e.getCoordinates(n)}}function $u(e,t){return{type:`Point`,coordinates:e.getCoordinates()}}function ed(e,t){let n;return t&&(n=t.rightHanded),{type:`Polygon`,coordinates:e.getCoordinates(n)}}function td(e){return e instanceof Image||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageBitmap?e:null}const nd=Error(`disposed`),rd=[256,256];var id=class extends yl{constructor(e){let t=Q.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=td(this.data_);return e?[e.width,e.height]:rd}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==Q.IDLE&&this.state!==Q.ERROR)return;this.state=Q.LOADING,this.changed();let e=this;this.loader_().then(function(t){e.data_=t,e.state=Q.LOADED,e.changed()}).catch(function(t){e.error_=t,e.state=Q.ERROR,e.changed()})}disposeInternal(){this.controller_&&=(this.controller_.abort(nd),null),super.disposeInternal()}};let ad;const od=[];function sd(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 cd(e,t){return Math.abs(e[t*4]-210)>2||Math.abs(e[t*4+3]-.75*255)>2}function ld(){if(ad===void 0){let e=V(6,6,od);e.globalCompositeOperation=`lighter`,e.fillStyle=`rgba(210, 0, 0, 0.75)`,sd(e,4,5,4,0),sd(e,4,5,0,5);let t=e.getImageData(0,0,3,3).data;ad=cd(t,0)||cd(t,4)||cd(t,8),Zr(e),od.push(e.canvas)}return ad}function ud(e,t,n,r){let i=hn(n,t,e),a=an(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||se(c,i)){let t=an(e,a,i)/a;isFinite(t)&&t>0&&(a/=t)}return a}function dd(e,t,n,r){let i=Te(n),a=ud(e,t,i,r);return(!isFinite(a)||a<=0)&&xe(n,function(n){return a=ud(e,t,n,r),isFinite(a)&&a>0}),a}function fd(e,t,n,r,i,a,o,s,c,l,u,d,f,p){let m=V(Math.round(n*e),Math.round(n*t),od);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=de();c.forEach(function(e,t,n){_e(g,e.extent)});let _,v=n/r,y=(d?1:1+2**-24)/v;if(!f||c.length!==1||l!==0){if(_=V(Math.round(I(g)*v),Math.round(F(g)*v),od),d||(_.imageSmoothingEnabled=!1),i&&p){let e=(i[0]-g[0])*v,t=-(i[3]-g[3])*v,n=I(i)*v,r=F(i)*v;_.rect(e,t,n,r),_.clip()}c.forEach(function(e,t,n){if(e.image.width>0&&e.image.height>0){if(e.clipExtent){_.save();let t=(e.clipExtent[0]-g[0])*v,n=-(e.clipExtent[3]-g[3])*v,r=I(e.clipExtent)*v,i=F(e.clipExtent)*v;_.rect(d?t:Math.round(t),d?n:Math.round(n),d?r:Math.round(t+r)-Math.round(t),d?i:Math.round(n+i)-Math.round(n)),_.clip()}let t=(e.extent[0]-g[0])*v,n=-(e.extent[3]-g[3])*v,r=I(e.extent)*v,i=F(e.extent)*v;_.drawImage(e.image,l,l,e.image.width-2*l,e.image.height-2*l,d?t:Math.round(t),d?n:Math.round(n),d?r:Math.round(t+r)-Math.round(t),d?i:Math.round(n+i)-Math.round(n)),e.clipExtent&&_.restore()}})}let b=Ae(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=[[l,u,0,0,S-v],[f,p,0,0,w-v],[0,0,l,u,C-x],[0,0,f,p,T-x]],k=Be(O);if(!k)return;if(m.save(),m.beginPath(),ld()||!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(k[0],k[2],k[1],k[3],v,x),m.translate(g[0]-E,g[3]-D);let A;if(_)A=_.canvas,m.scale(y,-y);else{let e=c[0],t=e.extent;A=e.image,m.scale(I(t)/A.width,-F(t)/A.height)}m.drawImage(A,0,0),m.restore()}),_&&(Zr(_),od.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}const pd=.25;var md=class{constructor(e,t,n,r,i,a,o){this.sourceProj_=e,this.targetProj_=t;let s={},c=o?ln(e=>z(o,hn(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()&&I(r)>=I(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?I(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?I(this.targetProj_.getExtent()):null;let l=Ae(n),u=je(n),d=we(n),f=Ce(n),p=this.transformInv_(l),m=this.transformInv_(u),h=this.transformInv_(d),g=this.transformInv_(f),_=10+(a?Math.max(0,Math.ceil(Math.log2(Se(n)/(a*a*256*256)))):0);if(this.addQuad_(l,u,d,f,p,m,h,g,_),this.wrapsXInSource_){let e=1/0;this.triangles_.forEach(function(t,n,r){e=Math.min(e,t.source[0][0],t.source[1][0],t.source[2][0])}),this.triangles_.forEach(t=>{if(Math.max(t.source[0][0],t.source[1][0],t.source[2][0])-e>this.sourceWorldWidth_/2){let n=[[t.source[0][0],t.source[0][1]],[t.source[1][0],t.source[1][1]],[t.source[2][0],t.source[2][1]]];n[0][0]-e>this.sourceWorldWidth_/2&&(n[0][0]-=this.sourceWorldWidth_),n[1][0]-e>this.sourceWorldWidth_/2&&(n[1][0]-=this.sourceWorldWidth_),n[2][0]-e>this.sourceWorldWidth_/2&&(n[2][0]-=this.sourceWorldWidth_);let r=Math.min(n[0][0],n[1][0],n[2][0]),i=Math.max(n[0][0],n[1][0],n[2][0]);i-r<this.sourceWorldWidth_/2&&(t.source=n)}})}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=re([i,a,o,s]),u=this.sourceWorldWidth_?I(l)/this.sourceWorldWidth_:null,d=this.sourceWorldWidth_,f=this.sourceProj_.canWrapX()&&u>.5&&u<1,p=!1;if(c>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){let i=re([e,t,n,r]),a=I(i)/this.targetWorldWidth_;p=a>pd||p}!f&&this.sourceProj_.isGlobal()&&u&&(p=u>pd||p)}if(!p&&this.maxSourceExtent_&&isFinite(l[0])&&isFinite(l[1])&&isFinite(l[2])&&isFinite(l[3])&&!Me(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])?1:0),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=(Ue(i[0],d)+Ue(o[0],d))/2;a=e-Ue(r[0],d)}else a=(i[0]+o[0])/2-r[0];let s=(i[1]+o[1])/2-r[1],c=a*a+s*s;p=c>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=de();return this.triangles_.forEach(function(t,n,r){let i=t.source;ve(e,i[0]),ve(e,i[1]),ve(e,i[2])}),e}getTriangles(){return this.triangles_}},hd=class extends yl{constructor(e,t,n,r,i,a,o,s,c,l,u,d){super(i,Q.IDLE,d),this.renderEdges_=u===void 0?!1: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?ke(f,p):f;if(Se(h)===0){this.state=Q.EMPTY;return}let g=e.getExtent();g&&(m=m?ke(m,g):g);let _=r.getResolution(this.wrappedTileCoord_[0]),v=dd(e,n,h,_);if(!isFinite(v)||v<=0){this.state=Q.EMPTY;return}let y=l===void 0?.5:l;if(this.triangulation_=new md(e,n,h,m,v*y,_),this.triangulation_.getTriangles().length===0){this.state=Q.EMPTY;return}this.sourceZ_=t.getZForResolution(v);let b=this.triangulation_.calculateSourceExtent();if(m&&(e.canWrapX()?(b[1]=L(b[1],m[1],m[3]),b[3]=L(b[3],m[1],m[3])):b=ke(b,m)),!Se(b))this.state=Q.EMPTY;else{let n=0,r=0;e.canWrapX()&&(n=I(g),r=Math.floor((b[0]-g[0])/n));let i=Le(b.slice(),e,!0);i.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=c(this.sourceZ_,e,t,o);if(i){let e=r*n;this.sourceTiles_.push({tile:i,offset:e})}}++r}),this.sourceTiles_.length===0&&(this.state=Q.EMPTY)}}getImage(){return this.canvas_}reproject_(){let e=[];if(this.sourceTiles_.forEach(t=>{let n=t.tile;if(n&&n.getState()==Q.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),e.push({extent:r,clipExtent:i,image:n.getImage()})}}),this.sourceTiles_.length=0,e.length===0)this.state=Q.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_=fd(r,i,this.pixelRatio_,o,this.sourceTileGrid_.getExtent(),a,s,this.triangulation_,e,this.gutter_,this.renderEdges_,this.interpolate),this.state=Q.LOADED}this.changed()}load(){if(this.state==Q.IDLE){this.state=Q.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:t})=>{let r=t.getState();if(r==Q.IDLE||r==Q.LOADING){e++;let r=x(t,n.CHANGE,n=>{let i=t.getState();(i==Q.LOADED||i==Q.ERROR||i==Q.EMPTY)&&(C(r),e--,e===0&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(r)}}),e===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:e},t,n){let r=e.getState();r==Q.IDLE&&e.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(C),this.sourcesListenerKeys_=null}release(){this.canvas_&&=(Zr(this.canvas_.getContext(`2d`)),od.push(this.canvas_),null),super.release()}},gd=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 r&&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 N(n!==void 0,`Tried to get a value for a key that does not exist in the cache`),n===this.newest_?n.value_:(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 N(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){N(!(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 _d(e,t,n,r){return r===void 0?[e,t,n]:(r[0]=e,r[1]=t,r[2]=n,r)}function vd(e,t,n){return e+`/`+t+`/`+n}function yd(e){return bd(e[0],e[1],e[2])}function bd(e,t,n){return(t<<e)+n}function xd(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):!0}function Sd(e,t,n,r,i){return`${O(e)},${t},${vd(n,r,i)}`}function Cd(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 wd(e,t,n){let r=e[n];return r?r.delete(t):!1}function Td(e,t){let n=e.layerStatesArray[e.layerIndex];n.extent&&(t=ke(t,bn(n.extent,e.viewState.projection)));let r=n.layer.getRenderSource();if(!r.getWrapX()){let n=r.getTileGridForProjection(e.viewState.projection).getExtent();n&&(t=ke(t,n))}return t}var Ed=class extends ms{constructor(e,t){super(e),t||={},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceKey_,this.renderedSourceRevision_,this.tempExtent=de(),this.tempTileRange_=new Du(0,0,0,0),this.tempTileCoord_=_d(0,0,0);let n=t.cacheSize===void 0?512:t.cacheSize;this.tileCache_=new gd(n),this.maxStaleKeys=n*.5}getTileCache(){return this.tileCache_}getOrCreateTile(e,t,n,r){let i=this.tileCache_,a=this.getLayer(),o=a.getSource(),s=Sd(o,o.getKey(),e,t,n),c;if(i.containsKey(s))c=i.get(s);else{if(c=o.getTile(e,t,n,r.pixelRatio,r.viewState.projection),!c)return null;i.set(s,c)}return c}getTile(e,t,n,r){let i=this.getOrCreateTile(e,t,n,r);return i||null}getData(e){let t=this.frameState;if(!t)return null;let n=this.getLayer(),r=z(t.pixelToCoordinateTransform,e.slice()),i=n.getExtent();if(i&&!se(i,r))return null;let a=t.viewState,o=n.getRenderSource(),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()!==Q.LOADED)continue;let l=s.getOrigin(e),u=po(s.getTileSize(e)),d=s.getResolution(e),f;if(i instanceof bl||i instanceof hd)f=i.getImage();else if(i instanceof id){if(f=td(i.getData()),!f)continue}else 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}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.renderedSourceRevision_=n,!0}enqueueTiles(e,t,n,r,i){let a=e.viewState,o=this.getLayer(),s=o.getRenderSource(),c=s.getTileGridForProjection(a.projection),l=O(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?Oe(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&&!c.tileCoordIntersectsViewport([i,t,o],m))continue;let n=this.getTile(i,t,o,e);if(!n)continue;let s=Cd(r,n,i);if(!s)continue;let d=n.getKey();if(u[d]=!0,n.getState()===Q.IDLE&&!e.tileQueue.isKeyQueued(d)){let r=_d(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();for(let e=0;e<o.length;++e){let s=Sd(this.getLayer().getSource(),o[e],r,i,a);if(n.containsKey(s)){let e=n.peek(s);if(e.getState()===Q.LOADED)return e.endTransition(O(this)),Cd(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(),c=s.getKey();for(let e=i.minX;e<=i.maxX;++e)for(let t=i.minY;t<=i.maxY;++t){let i=Sd(s,c,n,e,t),l=!1;if(o.containsKey(i)){let e=o.peek(i);e.getState()===Q.LOADED&&(Cd(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,o=r.resolution,s=r.center,c=e.pixelRatio,l=this.getLayer(),u=l.getSource(),d=u.getTileGridForProjection(i),f=d.getZForResolution(o,u.zDirection),p=d.getResolution(f),m=u.getKey();this.renderedSourceKey_?this.renderedSourceKey_!==m&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=m):this.renderedSourceKey_=m;let h=e.extent,g=u.getTilePixelRatio(c);this.prepareContainer(e,t);let _=this.context.canvas.width,v=this.context.canvas.height,y=n.extent&&bn(n.extent,i);y&&(h=ke(h,bn(n.extent,i)));let b=p*_/2/g,x=p*v/2/g,S=[s[0]-b,s[1]-x,s[0]+b,s[1]+x],C={};this.renderedTiles.length=0;let w=l.getPreload();if(e.nextExtent){let t=d.getZForResolution(r.nextResolution,u.zDirection),n=Td(e,e.nextExtent);this.enqueueTiles(e,n,t,C,w)}let T=Td(e,h);if(this.enqueueTiles(e,T,f,C,0),w>0&&setTimeout(()=>{this.enqueueTiles(e,T,f-1,C,w-1)},0),!(f in C))return this.container;let E=O(this),D=e.time;for(let t of C[f]){let n=t.getState();if(n===Q.EMPTY)continue;let r=t.tileCoord;if(n===Q.LOADED){let e=t.getAlpha(E,D);if(e===1){t.endTransition(E);continue}}n!==Q.ERROR&&(this.renderComplete=!1);let i=this.findStaleTile_(r,C);if(i){wd(C,t,f),e.animate=!0;continue}let a=this.findAltTiles_(d,r,f+1,C);if(a)continue;let o=d.getMinZoom();for(let e=f-1;e>=o;--e){let t=this.findAltTiles_(d,r,e,C);if(t)break}}let k=p/o*c/g,A=this.getRenderContext(e);Tn(this.tempTransform,_/2,v/2,k,k,0,-_/2,-v/2),n.extent&&this.clipUnrotated(A,e,y),u.getInterpolate()||(A.imageSmoothingEnabled=!1),this.preRender(A,e);let ee=Object.keys(C).map(Number);ee.sort(a);let j,M=[],N=[];for(let t=ee.length-1;t>=0;--t){let n=ee[t],r=u.getTilePixelSize(n,c,i),a=d.getResolution(n),o=a/p,s=r[0]*o*k,l=r[1]*o*k,f=d.getTileCoordForCoordAndZ(Ae(S),n),m=d.getTileCoordExtent(f),h=z(this.tempTransform,[g*(m[0]-S[0])/p,g*(S[3]-m[3])/p]),_=g*u.getGutterForProjection(i);for(let t of C[n]){if(t.getState()!==Q.LOADED)continue;let r=t.tileCoord,i=f[1]-r[1],a=Math.round(h[0]-(i-1)*s),o=f[2]-r[2],c=Math.round(h[1]-(o-1)*l),d=Math.round(h[0]-i*s),p=Math.round(h[1]-o*l),m=a-d,g=c-p,v=ee.length===1,y=!1;j=[d,p,d+m,p,d+m,p+g,d,p+g];for(let e=0,t=M.length;e<t;++e)if(!v&&n<N[e]){let t=M[e];Me([d,p,d+m,p+g],[t[0],t[3],t[4],t[7]])&&(y||=(A.save(),!0),A.beginPath(),A.moveTo(j[0],j[1]),A.lineTo(j[2],j[3]),A.lineTo(j[4],j[5]),A.lineTo(j[6],j[7]),A.moveTo(t[6],t[7]),A.lineTo(t[4],t[5]),A.lineTo(t[2],t[3]),A.lineTo(t[0],t[1]),A.clip())}M.push(j),N.push(n),this.drawTile(t,e,d,p,m,g,_,v),y&&A.restore(),this.renderedTiles.unshift(t),this.updateUsedTiles(e.usedTiles,u,t)}}if(this.renderedResolution=p,this.extentChanged=!this.renderedExtent_||!ge(this.renderedExtent_,S),this.renderedExtent_=S,this.renderedPixelRatio=c,this.postRender(this.context,e),n.extent&&A.restore(),A.imageSmoothingEnabled=!0,this.renderComplete){let t=(e,t)=>{let n=O(u),r=t.wantedTiles[n],i=r?Object.keys(r).length:0;this.updateCacheSize(i),this.tileCache_.expireCache()};e.postRenderFunctions.push(t)}return this.container}updateCacheSize(e){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,e*2)}drawTile(e,t,n,r,i,a,o,s){let c;if(e instanceof id){if(c=td(e.getData()),!c)throw Error(`Rendering array data is not yet supported`)}else c=this.getTileImage(e);if(!c)return;let l=this.getRenderContext(t),u=O(this),d=t.layerStatesArray[t.layerIndex],f=d.opacity*(s?e.getAlpha(u,t.time):1),p=f!==l.globalAlpha;p&&(l.save(),l.globalAlpha=f),l.drawImage(c,o,o,c.width-2*o,c.height-2*o,n,r,i,a),p&&l.restore(),f===d.opacity?s&&e.endTransition(u):t.animate=!0}getImage(){let e=this.context;return e?e.canvas:null}getTileImage(e){return e.getImage()}updateUsedTiles(e,t,n){let r=O(t);r in e||(e[r]={}),e[r][n.getKey()]=!0}},Dd={PRELOAD:`preload`,USE_INTERIM_TILES_ON_ERROR:`useInterimTilesOnError`},Od=class extends pl{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?!0:e.useInterimTilesOnError)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(Dd.PRELOAD)}setPreload(e){this.set(Dd.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(Dd.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(Dd.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}},kd=class extends Od{constructor(e){super(e)}createRenderer(){return new Ed(this,{cacheSize:this.getCacheSize()})}};const Ad=[0,0,0];var jd=class{constructor(e){this.minZoom=e.minZoom===void 0?0:e.minZoom,this.resolutions_=e.resolutions,N(d(this.resolutions_,(e,t)=>t-e,!0),"`resolutions` must be sorted in descending order");let t;if(!e.origins){for(let e=0,n=this.resolutions_.length-1;e<n;++e)if(!t)t=this.resolutions_[e]/this.resolutions_[e+1];else if(this.resolutions_[e]/this.resolutions_[e+1]!==t){t=void 0;break}}this.zoomFactor_=t,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,N(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));let n=e.extent;n!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=Ae(n)),N(!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,N(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,N(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=n===void 0?null:n,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],e.sizes===void 0?n&&this.calculateTileRanges_(n):this.fullTileRanges_=e.sizes.map((e,t)=>{let r=new Du(Math.min(0,e[0]),Math.max(e[0]-1,-1),Math.min(0,e[1]),Math.max(e[1]-1,-1));if(n){let e=this.getTileRangeForExtentAndZ(n,t);r.minX=Math.max(e.minX,r.minX),r.maxX=Math.min(e.maxX,r.maxX),r.minY=Math.max(e.minY,r.minY),r.maxY=Math.min(e.maxY,r.maxY)}return r})}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=Ou(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_[e]}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 Ou(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 Ou(i,a,i,a,n);if(this.zoomFactor_){let e=this.zoomFactor_**+(t-r),o=Math.floor(i*e),s=Math.floor(a*e);if(t<r)return Ou(o,o,s,s,n);let c=Math.floor(e*(i+1))-1,l=Math.floor(e*(a+1))-1;return Ou(o,c,s,l,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,Ad);let r=Ad[1],i=Ad[2];this.getTileCoordForXYAndZ_(e[2],e[1],t,!0,Ad);let a=Ad[1],o=Ad[2];return Ou(r,a,i,o,n)}getTileCoordCenter(e){let t=this.getOrigin(e[0]),n=this.getResolution(e[0]),r=po(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=po(this.getTileSize(e[0]),this.tmpSize_),a=n[0]+e[1]*i[0]*r,o=n[1]-(e[2]+1)*i[1]*r,s=a+i[0]*r,c=o+i[1]*r;return fe(a,o,s,c,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=po(this.getTileSize(a),this.tmpSize_),l=o*(e-s[0])/n/c[0],u=o*(s[1]-t)/n/c[1];return r?(l=qe(l,5)-1,u=qe(u,5)-1):(l=Ke(l,5),u=Ke(u,5)),_d(a,l,u,i)}getTileCoordForXYAndZ_(e,t,n,r,i){let a=this.getOrigin(n),o=this.getResolution(n),s=po(this.getTileSize(n),this.tmpSize_),c=(e-a[0])/o/s[0],l=(a[1]-t)/o/s[1];return r?(c=qe(c,5)-1,l=qe(l,5)-1):(c=Ke(c,5),l=Ke(l,5)),_d(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_[e]}getFullTileRange(e){return this.fullTileRanges_?this.fullTileRanges_[e]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,e):null}getZForResolution(e,t){let n=s(this.resolutions_,e,t||0);return L(n,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(e,t){return Cr(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 Md(e){let t=e.getDefaultTileGrid();return t||(t=Ld(e),e.setDefaultTileGrid(t)),t}function Nd(e,t,n){let r=t[0],i=e.getTileCoordCenter(t),a=Rd(n);if(!se(a,i)){let t=I(a),n=Math.ceil((a[0]-i[0])/t);return i[0]+=t*n,e.getTileCoordForCoordAndZ(i,r)}return t}function Pd(e,t,n,r){r=r===void 0?`top-left`:r;let i=Id(e,t,n);return new jd({extent:e,origin:Ee(e,r),resolutions:i,tileSize:n})}function Fd(e){let t=e||{},n=t.extent||R(`EPSG:3857`).getExtent(),r={extent:n,minZoom:t.minZoom,tileSize:t.tileSize,resolutions:Id(n,t.maxZoom,t.tileSize,t.maxResolution)};return new jd(r)}function Id(e,t,n,r){t=t===void 0?42:t,n=po(n===void 0?256:n);let i=F(e),a=I(e);r=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 Ld(e,t,n,r){let i=Rd(e);return Pd(i,t,n,r)}function Rd(e){e=R(e);let t=e.getExtent();if(!t){let n=180*at.degrees/e.getMetersPerUnit();t=fe(-n,-n,n,n)}return t}const zd=/\{z\}/g,Bd=/\{x\}/g,Vd=/\{y\}/g,Hd=/\{-y\}/g;function Ud(e,t,n,r,i){return e.replace(zd,t.toString()).replace(Bd,n.toString()).replace(Vd,r.toString()).replace(Hd,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 Wd(e){let t=[],n=/\{([a-z])-([a-z])\}/.exec(e);if(n){let r=n[1].charCodeAt(0),i=n[2].charCodeAt(0),a;for(a=r;a<=i;++a)t.push(e.replace(n[0],String.fromCharCode(a)));return t}if(n=/\{(\d+)-(\d+)\}/.exec(e),n){let r=parseInt(n[2],10);for(let i=parseInt(n[1],10);i<=r;i++)t.push(e.replace(n[0],i.toString()));return t}return t.push(e),t}function Gd(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 Ud(e,o,n[1],n[2],a)})}function Kd(e,t){let n=e.length,r=Array(n);for(let i=0;i<n;++i)r[i]=Gd(e[i],t);return qd(r)}function qd(e){return e.length===1?e[0]:(function(t,n,r){if(!t)return;let i=yd(t),a=Ue(i,e.length);return e[a](t,n,r)})}var Jd=class extends ro{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;let t=[256,256];this.tileGrid&&po(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),t),this.tmpSize=[0,0],this.key_=e.key||O(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){return E()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:Md(e)}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,t,n){let r=this.getTileGridForProjection(n),i=this.getTilePixelRatio(t),a=po(r.getTileSize(e),this.tmpSize);return i==1?a:fo(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=Nd(r,e,n)),xd(e,r)?e:null}clear(){}refresh(){this.clear(),super.refresh()}},Yd=class extends y{constructor(e,t){super(e),this.tile=t}},Xd={TILELOADSTART:`tileloadstart`,TILELOADEND:`tileloadend`,TILELOADERROR:`tileloaderror`},Zd=class e extends Jd{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=O(t),r=t.getState(),i;r==Q.LOADING?(this.tileLoadingKeys_[n]=!0,i=Xd.TILELOADSTART):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],i=r==Q.ERROR?Xd.TILELOADERROR:r==Q.LOADED?Xd.TILELOADEND:void 0),i!=null&&this.dispatchEvent(new Yd(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=Wd(e);this.urls=t,this.setUrls(t)}setUrls(e){this.urls=e;let t=e.join(`
|
||
`);this.generateTileUrlFunction_?this.setTileUrlFunction(Kd(e,this.tileGrid),t):this.setKey(t)}tileUrlFunction(e,t,n){}},Qd=class extends Zd{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:$d,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:e.tileUrlFunction,url:e.url,urls:e.urls,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate===void 0?!0:e.interpolate,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.crossOrigin=e.crossOrigin===void 0?null:e.crossOrigin,this.tileClass=e.tileClass===void 0?bl:e.tileClass,this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(e){return this.getProjection()&&e&&!dn(this.getProjection(),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||dn(t,e)))return this.tileGrid;let n=O(e);return n in this.tileGridForProjection||(this.tileGridForProjection[n]=Md(e)),this.tileGridForProjection[n]}createTile_(e,t,r,i,a,o){let s=[e,t,r],c=this.getTileCoordForTileUrlFunction(s,a),l=c?this.tileUrlFunction(c,i,a):void 0,u=new this.tileClass(s,l===void 0?Q.EMPTY:Q.IDLE,l===void 0?``:l,this.crossOrigin,this.tileLoadFunction,this.tileOptions);return u.key=o,u.addEventListener(n.CHANGE,this.handleTileChange.bind(this)),u}getTile(e,t,n,r,i){let a=this.getProjection();if(!a||!i||dn(a,i))return this.getTileInternal(e,t,n,r,a||i);let o=[e,t,n],s=this.getKey(),c=this.getTileGridForProjection(a),l=this.getTileGridForProjection(i),u=this.getTileCoordForTileUrlFunction(o,i),d=new hd(a,c,i,l,o,u,this.getTilePixelRatio(r),this.getGutter(),(e,t,n,r)=>this.getTileInternal(e,t,n,r,a),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return d.key=s,d}getTileInternal(e,t,n,r,i){let a=this.getKey();return this.createTile_(e,t,n,r,i,a)}setRenderReprojectionEdges(e){this.renderReprojectionEdges_!=e&&(this.renderReprojectionEdges_=e,this.changed())}setTileGridForProjection(e,t){let n=R(e);if(n){let e=O(n);e in this.tileGridForProjection||(this.tileGridForProjection[e]=t)}}};function $d(e,t){e.getImage().src=t}var ef=class extends Qd{constructor(e){e||={};let t=e.projection===void 0?`EPSG:3857`:e.projection,n=e.tileGrid===void 0?Fd({extent:Rd(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,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?!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_}},tf=class extends ef{constructor(e){e||={};let t;t=e.attributions===void 0?[`© <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors.`]:e.attributions;let n=e.crossOrigin===void 0?`anonymous`:e.crossOrigin,r=e.url===void 0?`https://tile.openstreetmap.org/{z}/{x}/{y}.png`:e.url;super({attributions:t,attributionsCollapsible:!1,cacheSize:e.cacheSize,crossOrigin:n,interpolate:e.interpolate,maxZoom:e.maxZoom===void 0?19:e.maxZoom,reprojectionErrorThreshold:e.reprojectionErrorThreshold,tileLoadFunction:e.tileLoadFunction,transition:e.transition,url:r,wrapX:e.wrapX,zDirection:e.zDirection})}};export{go as Circle,te as Feature,co as Fill,Lu as GeoJSON,tf as OSM,Tu as OlMap,pr as Point,lo as Stroke,_o as Style,kd as TileLayer,vl as VectorLayer,so as VectorSource,al as View,de as createEmpty,un as fromLonLat};
|
||
//# sourceMappingURL=ol.min.js.map
|